mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-12 05:28:43 -04:00
Merge pull request #418 from TwilitRealm/unhackify-widescreen
Widescreen rework & IR scaling
This commit is contained in:
Vendored
+1
-1
Submodule extern/aurora updated: c21a7f75ab...c05e7aace1
@@ -74,6 +74,7 @@ struct UserSettings {
|
||||
ConfigVar<float> bloomMultiplier;
|
||||
ConfigVar<bool> enableWaterRefraction;
|
||||
ConfigVar<bool> enableFrameInterpolation;
|
||||
ConfigVar<int> internalResolutionScale;
|
||||
ConfigVar<int> shadowResolutionMultiplier;
|
||||
|
||||
// Audio
|
||||
|
||||
@@ -286,12 +286,7 @@ public:
|
||||
#if WIDESCREEN_SUPPORT
|
||||
static void setTvSize();
|
||||
|
||||
#if TARGET_PC
|
||||
static void onWide(f32 width, f32 height);
|
||||
#else
|
||||
static void onWide();
|
||||
#endif
|
||||
|
||||
static void offWide();
|
||||
static u8 isWide();
|
||||
|
||||
@@ -304,7 +299,7 @@ public:
|
||||
#endif
|
||||
|
||||
#if TARGET_PC
|
||||
static void setWindowSize(AuroraWindowSize const& size);
|
||||
static void updateRenderSize();
|
||||
#endif
|
||||
|
||||
static TGXTexObj mFrameBufferTexObj;
|
||||
|
||||
@@ -43,10 +43,6 @@ struct mDoLib_clipper {
|
||||
};
|
||||
|
||||
void mDoLib_project(Vec* src, Vec* dst);
|
||||
#if TARGET_PC
|
||||
void mDoLib_project(Vec* src, Vec* dst, JGeometry::TBox2<f32> viewport);
|
||||
#endif
|
||||
|
||||
u32 mDoLib_setResTimgObj(ResTIMG const* res, TGXTexObj* o_texObj, u32 tlut_name,
|
||||
GXTlutObj* o_tlutObj);
|
||||
void mDoLib_pos2camera(Vec* src, Vec* dst);
|
||||
|
||||
@@ -33,24 +33,16 @@ public:
|
||||
static void postRetraceProc(u32);
|
||||
static void drawDoneCallback();
|
||||
|
||||
u16 getFbWidth() const {
|
||||
#if TARGET_PC
|
||||
return m_WindowSize.fb_width;
|
||||
#else
|
||||
return mRenderObj->fbWidth;
|
||||
#endif
|
||||
}
|
||||
u16 getEfbHeight() const {
|
||||
#if TARGET_PC
|
||||
return m_WindowSize.fb_height;
|
||||
#else
|
||||
return mRenderObj->efbHeight;
|
||||
#endif
|
||||
}
|
||||
u16 getFbWidth() const { return mRenderObj->fbWidth; }
|
||||
u16 getEfbHeight() const { return mRenderObj->efbHeight; }
|
||||
void getBounds(u16& width, u16& height) const {
|
||||
width = (u16)getFbWidth();
|
||||
height = (u16)getEfbHeight();
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
u32 getRenderWidth() const { return mRenderWidth; }
|
||||
u32 getRenderHeight() const { return mRenderHeight; }
|
||||
#endif
|
||||
u16 getXfbHeight() const { return u16(mRenderObj->xfbHeight); }
|
||||
u8 isAntiAliasing() const { return u8(mRenderObj->aa); }
|
||||
Pattern getSamplePattern() const { return mRenderObj->sample_pattern; }
|
||||
@@ -63,7 +55,7 @@ public:
|
||||
|
||||
GXRenderModeObj* getRenderMode() const { return mRenderObj; }
|
||||
#if TARGET_PC
|
||||
void setWindowSize(AuroraWindowSize const& size);
|
||||
void setRenderSize(u32 width, u32 height);
|
||||
#endif
|
||||
|
||||
private:
|
||||
@@ -89,7 +81,8 @@ private:
|
||||
|
||||
#if TARGET_PC
|
||||
public:
|
||||
AuroraWindowSize m_WindowSize;
|
||||
u32 mRenderWidth;
|
||||
u32 mRenderHeight;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -64,10 +64,6 @@ void J2DGrafContext::setup2D() {
|
||||
}
|
||||
|
||||
void J2DGrafContext::setScissor() {
|
||||
#if TARGET_PC
|
||||
GXSetScissor(mScissorBounds.i.x, mScissorBounds.i.y, mScissorBounds.getWidth(),
|
||||
mScissorBounds.getHeight());
|
||||
#else
|
||||
JGeometry::TBox2<f32> bounds(0, 0, 1024, 1024);
|
||||
JGeometry::TBox2<f32> curBounds(mScissorBounds);
|
||||
mScissorBounds.intersect(bounds);
|
||||
@@ -81,7 +77,6 @@ void J2DGrafContext::setScissor() {
|
||||
} else {
|
||||
GXSetScissor(0, 0, 0, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void J2DGrafContext::scissor(JGeometry::TBox2<f32> const& bounds) {
|
||||
|
||||
@@ -205,7 +205,8 @@ void JUTVideo::setRenderMode(GXRenderModeObj const* pObj) {
|
||||
void JUTVideo::waitRetraceIfNeed() {}
|
||||
|
||||
#if TARGET_PC
|
||||
void JUTVideo::setWindowSize(AuroraWindowSize const& size) {
|
||||
m_WindowSize = size;
|
||||
void JUTVideo::setRenderSize(u32 width, u32 height) {
|
||||
mRenderWidth = width;
|
||||
mRenderHeight = height;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -180,12 +180,7 @@ void daAlink_c::preKandelaarDraw() {
|
||||
mat_p->setTevColor(2, &color);
|
||||
|
||||
cXyz proj;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&mKandelaarFlamePos, &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&mKandelaarFlamePos, &proj);
|
||||
#endif
|
||||
|
||||
camera_process_class* camera_p = dComIfGp_getCamera(0);
|
||||
f32 trimHeight;
|
||||
|
||||
@@ -318,11 +318,7 @@ void daBalloon2D_c::addScoreCount(cXyz* param_1, u32 param_2, u8 param_3) {
|
||||
field_0x5f8[current].field_0xf = field_0x5f8[prev].field_0xf;
|
||||
}
|
||||
cXyz acStack_2c;
|
||||
#if TARGET_PC
|
||||
mDoLib_project(param_1, &acStack_2c, { 0, 0, FB_WIDTH, FB_HEIGHT });
|
||||
#else
|
||||
mDoLib_project(param_1, &acStack_2c);
|
||||
#endif
|
||||
field_0x5f8[0].field_0x0.set(acStack_2c);
|
||||
field_0x5f8[0].field_0xc = param_2;
|
||||
field_0x5f8[0].field_0xe = 60;
|
||||
|
||||
@@ -337,13 +337,7 @@ void daBoomerang_sight_c::setSight(const cXyz* i_pos, int i_no) {
|
||||
}
|
||||
|
||||
Vec proj;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&m_pos[i_no], &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&m_pos[i_no], &proj);
|
||||
#endif
|
||||
|
||||
m_proj_posX[i_no] = proj.x;
|
||||
m_proj_posY[i_no] = proj.y;
|
||||
}
|
||||
|
||||
@@ -1658,12 +1658,7 @@ int daDemo00_c::draw() {
|
||||
MTXCopy(mModel.field_0x5d4->getAnmMtx(0), mDoMtx_stack_c::get());
|
||||
spb0.set(0.0f, 0.0f, 0.0f);
|
||||
mDoMtx_stack_c::multVec(&spb0, &sp98);
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&sp98, &spa4, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&sp98, &spa4);
|
||||
#endif
|
||||
|
||||
if (spa4.x >= -700.0f && spa4.x < 1600.0f && spa4.y >= -200.0f && spa4.y < 600.0f) {
|
||||
if (mModel.mID.field_0x18 == 0 || mModel.mID.field_0x18 == 1) {
|
||||
|
||||
@@ -429,13 +429,7 @@ void daE_FK_c::DamageAction() {
|
||||
|
||||
bool daE_FK_c::checkViewArea() {
|
||||
Vec proj;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(¤t.pos, &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(¤t.pos, &proj);
|
||||
#endif
|
||||
|
||||
return (proj.x >= 0.0f && proj.x <= FB_WIDTH) && (proj.y >= 0.0f && proj.y <= FB_HEIGHT);
|
||||
}
|
||||
|
||||
|
||||
@@ -463,13 +463,7 @@ static void damage_check(e_fs_class* i_this) {
|
||||
|
||||
static bool checkViewArea(cXyz* i_pos) {
|
||||
Vec proj;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(i_pos, &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(i_pos, &proj);
|
||||
#endif
|
||||
|
||||
bool ret = false;
|
||||
if (proj.x >= 0.0f && proj.x <= FB_WIDTH && proj.y >= 0.0f && proj.y <= FB_HEIGHT) {
|
||||
ret = true;
|
||||
|
||||
@@ -1362,13 +1362,7 @@ void daE_SM_c::E_SM_C_Hook() {
|
||||
|
||||
bool daE_SM_c::CheckViewArea() {
|
||||
Vec vec;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(¤t.pos, &vec, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(¤t.pos, &vec);
|
||||
#endif
|
||||
|
||||
bool rv = false;
|
||||
|
||||
if (vec.x >= 0.0f && vec.x <= FB_WIDTH && vec.y >= 0.0f && vec.y <= FB_HEIGHT) {
|
||||
|
||||
@@ -3342,13 +3342,8 @@ static void daMP_THPGXYuv2RgbSetup(const GXRenderModeObj* rmode) {
|
||||
Mtx44 m;
|
||||
Mtx e_m;
|
||||
|
||||
#if TARGET_PC
|
||||
w = JUTVideo::getManager()->getFbWidth();
|
||||
h = JUTVideo::getManager()->getEfbHeight();
|
||||
#else
|
||||
w = rmode->fbWidth;
|
||||
h = rmode->efbHeight;
|
||||
#endif
|
||||
var_f31 = 0.0f;
|
||||
|
||||
#if WIDESCREEN_SUPPORT
|
||||
|
||||
@@ -2694,12 +2694,7 @@ BOOL daNpcT_chkActorInScreen(fopAc_ac_c* i_ActorP, f32 param_1, f32 param_2, f32
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&pos_array[i], &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&pos_array[i], &proj);
|
||||
#endif
|
||||
|
||||
if (0.0f < proj.x && proj.x < FB_WIDTH && 0.0f < proj.y && proj.y < FB_HEIGHT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -499,13 +499,7 @@ void daObjARI_c::Z_BufferChk() {
|
||||
cXyz vec2, vec1;
|
||||
vec1 = current.pos;
|
||||
vec1.y += 20.0f;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&vec1, &vec2, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&vec1, &vec2);
|
||||
#endif
|
||||
|
||||
f32 trim_height;
|
||||
camera_process_class* camera = dComIfGp_getCamera(0);
|
||||
if (camera != NULL) {
|
||||
|
||||
@@ -285,13 +285,7 @@ bool Hahen_c::CheckCull() {
|
||||
|
||||
bool Hahen_c::checkViewArea() {
|
||||
Vec proj;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&pos, &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&pos, &proj);
|
||||
#endif
|
||||
|
||||
return (proj.x >= -50.0f && proj.x <= 658.0f) && (proj.y >= -50.0f && proj.y <= 498.0f);
|
||||
}
|
||||
|
||||
|
||||
@@ -289,13 +289,7 @@ void daObjCHO_c::Z_BufferChk() {
|
||||
cXyz vec2, vec1;
|
||||
vec1 = current.pos;
|
||||
vec1.y += 20.0f;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&vec1, &vec2, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&vec1, &vec2);
|
||||
#endif
|
||||
|
||||
f32 trim_height;
|
||||
camera_process_class* camera = dComIfGp_getCamera(0);
|
||||
if (camera != NULL) {
|
||||
|
||||
@@ -224,13 +224,7 @@ void daObjCRVFENCE_c::NormalAction() {
|
||||
|
||||
bool daObjCRVFENCE_c::checkViewArea(cXyz* param_1) {
|
||||
Vec sp24;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(param_1, &sp24, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(param_1, &sp24);
|
||||
#endif
|
||||
|
||||
bool rv = false;
|
||||
bool bVar1 = false;
|
||||
|
||||
|
||||
@@ -137,13 +137,7 @@ void daObjCRVHAHEN_c::CheckCull() {
|
||||
|
||||
bool daObjCRVHAHEN_c::checkViewArea(cXyz* i_this) {
|
||||
Vec proj;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(i_this, &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(i_this, &proj);
|
||||
#endif
|
||||
|
||||
bool ret = false;
|
||||
|
||||
if (proj.x >= 0.0f && proj.x <= FB_WIDTH && proj.y >= 0.0f && proj.y <= FB_HEIGHT) {
|
||||
|
||||
@@ -267,13 +267,7 @@ void daObjDAN_c::Z_BufferChk() {
|
||||
cXyz vec2, vec1;
|
||||
vec1 = current.pos;
|
||||
vec1.y += 20.0f;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&vec1, &vec2, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&vec1, &vec2);
|
||||
#endif
|
||||
|
||||
f32 trim_height;
|
||||
camera_process_class* camera = dComIfGp_getCamera(0);
|
||||
if (camera != NULL) {
|
||||
|
||||
@@ -201,13 +201,7 @@ void daObjGOMIKABE_c::CheckCull() {
|
||||
|
||||
bool daObjGOMIKABE_c::checkViewArea(cXyz param_1) {
|
||||
Vec local_24;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(¶m_1, &local_24, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(¶m_1, &local_24);
|
||||
#endif
|
||||
|
||||
bool rv = false;
|
||||
if (local_24.x >= 0.0f && local_24.x <= FB_WIDTH && local_24.y >= 0.0f && local_24.y <= FB_HEIGHT) {
|
||||
rv = true;
|
||||
|
||||
@@ -214,13 +214,7 @@ void daObjHHASHI_c::CheckCull() {
|
||||
|
||||
bool daObjHHASHI_c::checkViewArea(int param_1) {
|
||||
Vec local_20;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&field_0x5b0[param_1], &local_20, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&field_0x5b0[param_1], &local_20);
|
||||
#endif
|
||||
|
||||
bool rv = false;
|
||||
if (local_20.x >= 0.0f && local_20.x <= FB_WIDTH && local_20.y >= 0.0f && local_20.y <= FB_HEIGHT) {
|
||||
rv = true;
|
||||
|
||||
@@ -517,13 +517,7 @@ void daObjKAM_c::Z_BufferChk() {
|
||||
cXyz currentOffset;
|
||||
currentOffset = current.pos;
|
||||
currentOffset.y += 20.0f;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(¤tOffset, ¤tProj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(¤tOffset, ¤tProj);
|
||||
#endif
|
||||
|
||||
camera_process_class* camera = dComIfGp_getCamera(0);
|
||||
f32 cameraHeight;
|
||||
if (camera != NULL) {
|
||||
|
||||
@@ -611,13 +611,7 @@ void daObjKAT_c::Z_BufferChk() {
|
||||
cXyz curWithOff;
|
||||
curWithOff = current.pos;
|
||||
curWithOff.y += 20.0f;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&curWithOff, &projected, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&curWithOff, &projected);
|
||||
#endif
|
||||
|
||||
camera_process_class* camera = dComIfGp_getCamera(0);
|
||||
f32 unkFloat1;
|
||||
if (camera != NULL) {
|
||||
|
||||
@@ -528,13 +528,7 @@ void daObjKUW_c::Z_BufferChk() {
|
||||
|
||||
cStack_68 = current.pos;
|
||||
cStack_68.y += 20.0f;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&cStack_68, &local_5c, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&cStack_68, &local_5c);
|
||||
#endif
|
||||
|
||||
camera_process_class* cc = dComIfGp_getCamera(0);
|
||||
f32 trimHeight;
|
||||
if (cc != NULL) {
|
||||
|
||||
@@ -593,13 +593,7 @@ void daObjTEN_c::Z_BufferChk() {
|
||||
cXyz cStack_68;
|
||||
cStack_68 = current.pos;
|
||||
cStack_68.y += 20.0f;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&cStack_68, &local_5c, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&cStack_68, &local_5c);
|
||||
#endif
|
||||
|
||||
camera_process_class* camera = dComIfGp_getCamera(0);
|
||||
f32 trimHeight;
|
||||
if (camera != NULL) {
|
||||
|
||||
@@ -504,13 +504,7 @@ void daObjTOMBO_c::Z_BufferChk() {
|
||||
cXyz cStack_68;
|
||||
cStack_68 = current.pos;
|
||||
cStack_68.y += 20.0f;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&cStack_68, &local_5c, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&cStack_68, &local_5c);
|
||||
#endif
|
||||
|
||||
camera_process_class* pCamera = dComIfGp_getCamera(0);
|
||||
f32 trimHeight;
|
||||
if (pCamera != NULL) {
|
||||
|
||||
@@ -38,12 +38,7 @@ BOOL daZraFreeze_c::chkActorInScreen() {
|
||||
mDoMtx_stack_c::transM(0.0f, 0.0f, 0.0f);
|
||||
PSMTXMultVecArray(mDoMtx_stack_c::get(), vec, vec, 8);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&vec[i], &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&vec[i], &proj);
|
||||
#endif
|
||||
|
||||
if (0.0f < proj.x && proj.x < FB_WIDTH && 0.0f < proj.y && proj.y < FB_HEIGHT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -421,13 +421,7 @@ void daPy_sightPacket_c::draw() {
|
||||
|
||||
void daPy_sightPacket_c::setSight() {
|
||||
Vec proj;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&mPos, &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&mPos, &proj);
|
||||
#endif
|
||||
|
||||
mDoMtx_stack_c::transS(proj.x, proj.y, proj.z);
|
||||
mDoMtx_stack_c::scaleM(32.0f, 32.0f, 32.0f);
|
||||
mDoMtx_copy(mDoMtx_stack_c::get(), mProjMtx);
|
||||
|
||||
@@ -1544,9 +1544,10 @@ void dDlst_shadowControl_c::imageDraw(Mtx param_0) {
|
||||
#ifdef TARGET_PC
|
||||
GXCreateFrameBuffer(r26, r26);
|
||||
needsRestore = true;
|
||||
#endif
|
||||
#else
|
||||
GXSetViewport(0.0f, 0.0f, r26, r26, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, r26, r26);
|
||||
#endif
|
||||
}
|
||||
GXSetTevColor(GX_TEVREG0, l_imageDrawColor[chan]);
|
||||
if (chan == 3) {
|
||||
|
||||
@@ -3870,16 +3870,10 @@ void dFile_select_c::_draw() {
|
||||
dComIfGd_set2DOpa(mSelIcon2);
|
||||
|
||||
#if PLATFORM_GCN
|
||||
#if TARGET_PC
|
||||
mpFadePict->draw(0, 0,
|
||||
mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), false, false,
|
||||
false);
|
||||
#else
|
||||
mpFadePict->draw(mDoGph_gInf_c::getMinXF(), mDoGph_gInf_c::getMinYF(),
|
||||
mDoGph_gInf_c::getWidthF(), mDoGph_gInf_c::getHeightF(), false, false,
|
||||
false);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,11 +37,10 @@ void dDlst_Gameover_CAPTURE_c::draw() {
|
||||
TGXTexObj tex_obj;
|
||||
Mtx44 m;
|
||||
|
||||
#if TARGET_PC
|
||||
GXSetTexCopySrc(0, 0, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight());
|
||||
GXSetTexCopyDst(mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), GX_TF_RGB565, GX_TRUE);
|
||||
#else
|
||||
GXSetTexCopySrc(0, 0, FB_WIDTH, FB_HEIGHT);
|
||||
#if TARGET_PC
|
||||
GXSetTexCopyDst(FB_WIDTH, FB_HEIGHT, GX_TF_RGB565, GX_FALSE);
|
||||
#else
|
||||
GXSetTexCopyDst(FB_WIDTH / 2, FB_HEIGHT / 2, GX_TF_RGB565, GX_TRUE);
|
||||
#endif
|
||||
GXCopyTex(mDoGph_gInf_c::mZbufferTex, 0);
|
||||
|
||||
@@ -82,11 +82,7 @@ void dInsect_c::CalcZBuffer(f32 param_0) {
|
||||
pos = current.pos;
|
||||
pos.y += 20.0f;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&pos, &pos_projected, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&pos, &pos_projected);
|
||||
#endif
|
||||
|
||||
if (dComIfGp_getCamera(0)) {
|
||||
camera_trim_height = dComIfGp_getCamera(0)->mCamera.mTrimHeight;
|
||||
|
||||
@@ -11004,11 +11004,7 @@ void dKy_depth_dist_set(void* process_p) {
|
||||
|
||||
f32 var_f31 = sp24.abs(camera_p->view.lookat.eye);
|
||||
if (var_f31 < 2000.0f && var_f31 < kankyo->field_0x1268) {
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&actor_p->eyePos, &sp30, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&actor_p->eyePos, &sp30);
|
||||
#endif
|
||||
|
||||
if ((sp30.x >= 0.0f && sp30.x < FB_WIDTH) && (sp30.y >= 0.0f &&
|
||||
#if DEBUG
|
||||
|
||||
@@ -915,12 +915,7 @@ void dKydb_dungeonlight_draw() {
|
||||
rot.y = 0;
|
||||
dDbVw_drawCubeXlu(player->current.pos, size, rot, color);
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&g_env_light.dungeonlight[i].mPosition, &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&g_env_light.dungeonlight[i].mPosition, &proj);
|
||||
#endif
|
||||
|
||||
if (proj.x > 30.0f) {
|
||||
proj.x -= 30.0f;
|
||||
}
|
||||
|
||||
@@ -116,12 +116,7 @@ void dKyr_lenzflare_move() {
|
||||
cXyz vect;
|
||||
cXyz proj;
|
||||
cXyz center;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(lenz_packet->mPositions, &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(lenz_packet->mPositions, &proj);
|
||||
#endif
|
||||
|
||||
center.x = FB_WIDTH / 2;
|
||||
center.y = FB_HEIGHT / 2;
|
||||
@@ -221,12 +216,7 @@ void dKyr_sun_move() {
|
||||
}
|
||||
|
||||
cXyz proj;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(sun_packet->mPos, &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(sun_packet->mPos, &proj);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
cXyz chkpnt = proj;
|
||||
@@ -4127,11 +4117,7 @@ void dKyr_drawStar(Mtx drawMtx, u8** tex) {
|
||||
}
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&moon_pos, &moon_proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&moon_pos, &moon_proj);
|
||||
#endif
|
||||
|
||||
// Dusk optimization: we use vertex color rather than GX_TEVREG0 to set star color.
|
||||
// This allows us to merge all the stars into a single draw.
|
||||
@@ -4280,11 +4266,7 @@ void dKyr_drawStar(Mtx drawMtx, u8** tex) {
|
||||
sp68.y = spBC.y + star_pos.y;
|
||||
sp68.z = spBC.z + star_pos.z;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&sp68, &star_proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&sp68, &star_proj);
|
||||
#endif
|
||||
|
||||
moon_proj.z = 0.0f;
|
||||
star_proj.z = 0.0f;
|
||||
@@ -4699,11 +4681,7 @@ void drawVrkumo(Mtx drawMtx, GXColor& color, u8** tex) {
|
||||
}
|
||||
|
||||
if (g_env_light.daytime > 105.0f && g_env_light.daytime < 240.0f && !dComIfGp_event_runCheck() && sun_packet != NULL && sun_packet->mSunAlpha > 0.0f) {
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&sun_packet->mPos[0], &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&sun_packet->mPos[0], &proj);
|
||||
#endif
|
||||
if (proj.x > 0.0f && proj.x < FB_WIDTH && proj.y > spC4 && proj.y < (458.0f - spC4)) {
|
||||
pass = 0;
|
||||
}
|
||||
@@ -4968,12 +4946,7 @@ void drawVrkumo(Mtx drawMtx, GXColor& color, u8** tex) {
|
||||
x = 100.0f;
|
||||
y = 100.0f;
|
||||
z = 100.0f;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&spF0, &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&spF0, &proj);
|
||||
#endif
|
||||
|
||||
if (proj.x > -x && proj.x < (FB_WIDTH + x) && proj.y > -y && proj.y < (458.0f + z)) {
|
||||
break;
|
||||
@@ -5023,12 +4996,7 @@ void drawVrkumo(Mtx drawMtx, GXColor& color, u8** tex) {
|
||||
x = 100.0f;
|
||||
y = 100.0f;
|
||||
z = 100.0f;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&spE4, &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&spE4, &proj);
|
||||
#endif
|
||||
|
||||
if (proj.x > -x && proj.x < (FB_WIDTH + x) && proj.y > -y && proj.y < (458.0f + z)) {
|
||||
break;
|
||||
@@ -6068,13 +6036,7 @@ static void dKyr_evil_draw2(Mtx drawMtx, u8** tex) {
|
||||
sp34.x = 80.0f;
|
||||
sp34.y = 80.0f;
|
||||
sp34.z = 80.0f;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&sp7C, &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&sp7C, &proj);
|
||||
#endif
|
||||
|
||||
if (!(proj.x > -sp34.x) || !(proj.x < (FB_WIDTH + sp34.x)) ||
|
||||
!(proj.y > -sp34.y) || !(proj.y < (458.0f + sp34.z)))
|
||||
{
|
||||
@@ -6299,12 +6261,7 @@ void dKyr_evil_draw(Mtx drawMtx, u8** tex) {
|
||||
sp44.y = 80.0f;
|
||||
sp44.z = 80.0f;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&spA4, &proj, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&spA4, &proj);
|
||||
#endif
|
||||
|
||||
if (!(proj.x > -sp44.x) || !(proj.x < (FB_WIDTH + sp44.x)) ||
|
||||
!(proj.y > -sp44.y) || !(proj.y < (458.0f + sp44.z)))
|
||||
{
|
||||
|
||||
+7
-16
@@ -16,10 +16,6 @@
|
||||
|
||||
#ifdef TARGET_PC
|
||||
constexpr u16 kMapResolutionMultiplier = 4;
|
||||
// Line widths are relative to the framebuffer size. Since we're rendering to a separate
|
||||
// framebuffer, we have to scale them accordingly. The original game used about half of the
|
||||
// EFB for the map rendering, so this is a reasonable approximation.
|
||||
constexpr u8 kMapLineWidthMultiplier = 2;
|
||||
#endif
|
||||
|
||||
void dMpath_n::dTexObjAggregate_c::create() {
|
||||
@@ -242,11 +238,7 @@ void dDrawPath_c::rendering(dDrawPath_c::line_class const* p_line) {
|
||||
int width = getLineWidth(p_line->field_0x1);
|
||||
|
||||
if (width > 0 && p_line->mDataNum >= 2) {
|
||||
#ifdef TARGET_PC
|
||||
GXSetLineWidth(width * kMapLineWidthMultiplier, GX_TO_ZERO);
|
||||
#else
|
||||
GXSetLineWidth(width * 2, GX_TO_ZERO);
|
||||
#endif
|
||||
GXSetLineWidth(width, GX_TO_ZERO);
|
||||
GXSetTevColor(GX_TEVREG0, *getLineColor(p_line->field_0x0 & 0x3F, p_line->field_0x1));
|
||||
GXBegin(GX_LINESTRIP, GX_VTXFMT0, p_line->mDataNum);
|
||||
|
||||
@@ -435,8 +427,12 @@ void dRenderingFDAmap_c::preRenderingMap() {
|
||||
const u16 w = mTexWidth * kMapResolutionMultiplier;
|
||||
const u16 h = mTexHeight * kMapResolutionMultiplier;
|
||||
GXCreateFrameBuffer(w, h);
|
||||
GXSetViewport(0.0f, 0.0f, w, h, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, w, h);
|
||||
// Set logical viewport dimensions
|
||||
GXSetViewport(0.0f, 0.0f, mTexWidth, mTexHeight, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, mTexWidth, mTexHeight);
|
||||
// Set render viewport dimensions
|
||||
GXSetViewportRender(0.0f, 0.0f, w, h, 0.0f, 1.0f);
|
||||
GXSetScissorRender(0, 0, w, h);
|
||||
#else
|
||||
GXSetViewport(0.0f, 0.0f, mTexWidth, mTexHeight, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, mTexWidth, mTexHeight);
|
||||
@@ -517,13 +513,8 @@ void dRenderingFDAmap_c::renderingDecoration(dDrawPath_c::line_class const* p_li
|
||||
|
||||
BE(u16)* data_p = p_line->mpData;
|
||||
s32 data_num = p_line->mDataNum;
|
||||
#ifdef TARGET_PC
|
||||
GXSetLineWidth(width * kMapLineWidthMultiplier, GX_TO_ZERO);
|
||||
GXSetPointSize(width * kMapLineWidthMultiplier, GX_TO_ONE);
|
||||
#else
|
||||
GXSetLineWidth(width, GX_TO_ONE);
|
||||
GXSetPointSize(width, GX_TO_ONE);
|
||||
#endif
|
||||
GXColor lineColor = *getDecoLineColor(p_line->field_0x0 & 0x3f, p_line->field_0x1);
|
||||
GXSetTevColor(GX_TEVREG0, lineColor);
|
||||
lineColor.r = lineColor.r - 4;
|
||||
|
||||
@@ -2688,12 +2688,7 @@ u8 dMenu_Collect3D_c::getMaskMdlVisible() {
|
||||
f32 dMenu_Collect3D_c::mViewOffsetY = -100.0f;
|
||||
|
||||
void dMenu_Collect3D_c::setupItem3D(Mtx param_0) {
|
||||
#if TARGET_PC
|
||||
f32 scaleFactor = mDoGph_gInf_c::getHeight() / FB_HEIGHT;
|
||||
GXSetViewport(0.0f, mViewOffsetY * scaleFactor, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), 0.0f, 1.0f);
|
||||
#else
|
||||
GXSetViewport(0.0f, mViewOffsetY, FB_WIDTH, FB_HEIGHT, 0.0f, 1.0f);
|
||||
#endif
|
||||
mViewOffsetY = -100.0f;
|
||||
Mtx44 projection;
|
||||
C_MTXPerspective(projection, 45.0f, mDoGph_gInf_c::getAspect(), 1.0f, 100000.0f);
|
||||
|
||||
+1
-29
@@ -864,33 +864,15 @@ void dMenu_DmapBg_c::draw() {
|
||||
J2DOrthoGraph* grafContext = (J2DOrthoGraph*)dComIfGp_getCurrentGrafPort();
|
||||
grafContext->setup2D();
|
||||
|
||||
#if TARGET_PC
|
||||
// GXGetScissor uses 11-bit GC register fields (max 2047) which overflow
|
||||
// at window widths > ~1705px, producing garbage values on restore.
|
||||
scissor_left = 0;
|
||||
scissor_top = 0;
|
||||
scissor_width = (u32)mDoGph_gInf_c::getWidth();
|
||||
scissor_height = (u32)mDoGph_gInf_c::getHeight();
|
||||
#else
|
||||
GXGetScissor(&scissor_left, &scissor_top, &scissor_width, &scissor_height);
|
||||
#endif
|
||||
#if TARGET_PC
|
||||
grafContext->scissor(field_0xd94, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight());
|
||||
#else
|
||||
grafContext->scissor(field_0xd94, 0.0f, FB_WIDTH, FB_HEIGHT);
|
||||
#endif
|
||||
grafContext->scissor(field_0xd94, 0.0f, FB_WIDTH, FB_HEIGHT);
|
||||
grafContext->setScissor();
|
||||
|
||||
mBaseScreen->draw(field_0xd94, field_0xd98, grafContext);
|
||||
dMenu_Dmap_c::myclass->drawFloorScreenBack(mFloorScreen, field_0xd94, field_0xd98, grafContext);
|
||||
|
||||
#if TARGET_PC
|
||||
f32 dVar21 = mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getWidth();
|
||||
f32 dVar16 = mDoGph_gInf_c::getHeightF() / mDoGph_gInf_c::getHeight();
|
||||
#else
|
||||
f32 dVar21 = mDoGph_gInf_c::getWidthF() / FB_WIDTH;
|
||||
f32 dVar16 = mDoGph_gInf_c::getHeightF() / FB_HEIGHT;
|
||||
#endif
|
||||
mMapScreen[0]->draw(field_0xd94, field_0xd98, grafContext);
|
||||
|
||||
if (mpBackTexture != NULL) {
|
||||
@@ -922,15 +904,9 @@ void dMenu_DmapBg_c::draw() {
|
||||
mpBackTexture->draw(local_28c, field_0xd94 + mpBackTexture->getBounds().i.y, mpBackTexture->getWidth(),
|
||||
mpBackTexture->getHeight(), false, false, false);
|
||||
|
||||
#if TARGET_PC
|
||||
grafContext->scissor(field_0xd94,
|
||||
0, mDoGph_gInf_c::getWidth(),
|
||||
scissor_height);
|
||||
#else
|
||||
grafContext->scissor(field_0xd94 + mDoGph_gInf_c::getMinXF(),
|
||||
scissor_top, mDoGph_gInf_c::getWidthF(),
|
||||
scissor_height);
|
||||
#endif
|
||||
grafContext->setScissor();
|
||||
}
|
||||
|
||||
@@ -957,11 +933,7 @@ void dMenu_DmapBg_c::draw() {
|
||||
|
||||
Vec local_26c = pane.getGlobalVtx(mMapPane, &local_110, 0, false, 0);
|
||||
drawIcon(local_26c.x + field_0xd94, local_26c.y, field_0xda8, 1.0f);
|
||||
#if TARGET_PC
|
||||
grafContext->scissor(field_0xd94, scissor_top, mDoGph_gInf_c::getWidth(), scissor_height);
|
||||
#else
|
||||
grafContext->scissor(field_0xd94 + mDoGph_gInf_c::getMinXF(), scissor_top, mDoGph_gInf_c::getWidthF(), scissor_height);
|
||||
#endif
|
||||
grafContext->setScissor();
|
||||
grafContext->scissor(scissor_left, scissor_top, scissor_width, scissor_height);
|
||||
grafContext->setScissor();
|
||||
|
||||
+2
-19
@@ -276,18 +276,14 @@ void dMenu_Fmap2DBack_c::draw() {
|
||||
u32 scissorLeft, scissorTop, scissorWidth, scissorHeight;
|
||||
GXGetScissor(&scissorLeft, &scissorTop, &scissorWidth, &scissorHeight);
|
||||
|
||||
#if TARGET_PC
|
||||
grafPort->scissor(mTransX, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight());
|
||||
#else
|
||||
grafPort->scissor(mTransX, 0.0f, FB_WIDTH, FB_HEIGHT);
|
||||
#endif
|
||||
grafPort->setScissor();
|
||||
|
||||
mpBackTex->setBlackWhite(field_0x1208, field_0x120c);
|
||||
mpBackTex->setAlpha(mAlphaRate * 255.0f * g_fmapHIO.mBackgroundAlpha);
|
||||
mpBackTex->draw(mTransX + mDoGph_gInf_c::getMinXF(),
|
||||
mTransZ + mDoGph_gInf_c::getMinYF(), mDoGph_gInf_c::getWidth(),
|
||||
mDoGph_gInf_c::getHeight(), false, false, false);
|
||||
mTransZ + mDoGph_gInf_c::getMinYF(), mDoGph_gInf_c::getWidthF(),
|
||||
mDoGph_gInf_c::getHeightF(), false, false, false);
|
||||
|
||||
mpBackScreen->draw(mTransX, mTransZ, grafPort);
|
||||
mpBaseScreen->draw(mTransX, mTransZ, grafPort);
|
||||
@@ -297,13 +293,8 @@ void dMenu_Fmap2DBack_c::draw() {
|
||||
|
||||
Vec vec2 = mpMapArea->getGlobalVtx(&mtx, 3, false, 0);
|
||||
|
||||
#if TARGET_PC
|
||||
f32 width = mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getWidth();
|
||||
f32 height = mDoGph_gInf_c::getHeightF() / mDoGph_gInf_c::getHeight();
|
||||
#else
|
||||
f32 width = mDoGph_gInf_c::getWidthF() / FB_WIDTH;
|
||||
f32 height = mDoGph_gInf_c::getHeightF() / FB_HEIGHT;
|
||||
#endif
|
||||
|
||||
grafPort->scissor(mTransX + ((vec1.x - mDoGph_gInf_c::getMinXF()) / width),
|
||||
mTransZ + (vec1.y / height), (vec2.x - vec1.x) / width,
|
||||
@@ -360,11 +351,7 @@ void dMenu_Fmap2DBack_c::draw() {
|
||||
drawDebugRegionArea();
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
grafPort->scissor(scissorLeft, scissorTop, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight());
|
||||
#else
|
||||
grafPort->scissor(scissorLeft, scissorTop, scissorWidth, scissorHeight);
|
||||
#endif
|
||||
grafPort->setScissor();
|
||||
|
||||
if (isArrowDrawFlag()) {
|
||||
@@ -2579,11 +2566,7 @@ void dMenu_Fmap2DTop_c::draw() {
|
||||
J2DOrthoGraph* ctx = static_cast<J2DOrthoGraph*>(dComIfGp_getCurrentGrafPort());
|
||||
ctx->setup2D();
|
||||
GXGetScissor(&scissor_left, &scissor_top, &scissor_width, &scissor_height);
|
||||
#if TARGET_PC
|
||||
ctx->scissor(mTransX, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight());
|
||||
#else
|
||||
ctx->scissor(mTransX, 0.0f, FB_WIDTH, FB_HEIGHT);
|
||||
#endif
|
||||
ctx->setScissor();
|
||||
mpTitleScreen->draw(mTransX, mTransY, ctx);
|
||||
ctx->scissor(scissor_left, scissor_top, scissor_width, scissor_height);
|
||||
|
||||
@@ -223,13 +223,8 @@ void dMenu_Letter_c::_draw() {
|
||||
f32 y1 = local_178.y;
|
||||
Vec local_184;
|
||||
local_184 = afStack_138.getGlobalVtx(field_0x1ec, &mtx, 3, false, 0);
|
||||
#if TARGET_PC
|
||||
f32 dVar17 = mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getWidth();
|
||||
f32 dVar16 = mDoGph_gInf_c::getHeightF() / mDoGph_gInf_c::getHeight();
|
||||
#else
|
||||
f32 dVar17 = mDoGph_gInf_c::getWidthF() / FB_WIDTH;
|
||||
f32 dVar16 = mDoGph_gInf_c::getHeightF() / FB_HEIGHT;
|
||||
#endif
|
||||
f32 fVar1 = (x1 - mDoGph_gInf_c::getMinXF()) / dVar17;
|
||||
f32 fVar2 = y1 / dVar16;
|
||||
grafContext->scissor(fVar1, fVar2,
|
||||
|
||||
@@ -555,19 +555,11 @@ void dMenu_Option_c::_draw() {
|
||||
#endif
|
||||
|
||||
mpBlackTex->setAlpha(0xff);
|
||||
#if TARGET_PC
|
||||
mpBlackTex->draw(mDoGph_gInf_c::getMinXF(), mDoGph_gInf_c::getMinYF(), mDoGph_gInf_c::getWidthF(), mDoGph_gInf_c::getHeightF(), 0, 0, 0);
|
||||
#else
|
||||
mpBlackTex->draw(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, 0, 0, 0);
|
||||
#endif
|
||||
mpBackScreen->draw(0.0f, 0.0f, ctx);
|
||||
f32 alpha = (f32)g_drawHIO.mOptionScreen.mBackgroundAlpha * (f32)field_0x374;
|
||||
mpBlackTex->setAlpha(alpha);
|
||||
#if TARGET_PC
|
||||
mpBlackTex->draw(mDoGph_gInf_c::getMinXF(), mDoGph_gInf_c::getMinYF(), mDoGph_gInf_c::getWidthF(), mDoGph_gInf_c::getHeightF(), 0, 0, 0);
|
||||
#else
|
||||
mpBlackTex->draw(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, 0, 0, 0);
|
||||
#endif
|
||||
mpScreen->draw(0.0f, 0.0f, ctx);
|
||||
mpClipScreen->draw(0.0f, 0.0f, ctx);
|
||||
#if TARGET_PC
|
||||
|
||||
+8
-14
@@ -32,15 +32,9 @@ public:
|
||||
if (getDrawFlag() == 1) {
|
||||
setDrawFlag();
|
||||
dComIfGp_onPauseFlag();
|
||||
|
||||
#if TARGET_PC
|
||||
GXSetTexCopySrc(0, 0, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight());
|
||||
#else
|
||||
GXSetTexCopySrc(0, 0, FB_WIDTH, FB_HEIGHT);
|
||||
#endif
|
||||
|
||||
#if TARGET_PC
|
||||
GXSetTexCopyDst(mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), (GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_ENABLE);
|
||||
GXSetTexCopyDst(FB_WIDTH, FB_HEIGHT, (GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_DISABLE);
|
||||
#else
|
||||
GXSetTexCopyDst(FB_WIDTH / 2, FB_HEIGHT / 2, (GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_ENABLE);
|
||||
#endif
|
||||
@@ -48,17 +42,17 @@ public:
|
||||
GXPixModeSync();
|
||||
#if TARGET_PC
|
||||
// init mTexObj at capture time so the gpu ref survives window resizes
|
||||
mCaptureWidth = mDoGph_gInf_c::getWidth();
|
||||
mCaptureHeight = mDoGph_gInf_c::getHeight();
|
||||
GXInitTexObj(&mTexObj, mDoGph_gInf_c::getFrameBufferTex(), mCaptureWidth, mCaptureHeight,
|
||||
mCaptureWidth = JUTVideo::getManager()->getRenderWidth();
|
||||
mCaptureHeight = JUTVideo::getManager()->getRenderHeight();
|
||||
GXInitTexObj(&mTexObj, mDoGph_gInf_c::getFrameBufferTex(), FB_WIDTH / 2, FB_HEIGHT / 2,
|
||||
(GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GXInitTexObjLOD(&mTexObj, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1);
|
||||
#endif
|
||||
} else {
|
||||
#if TARGET_PC
|
||||
// If the window was resized since capture, force a re-capture at the new size
|
||||
if (mCaptureWidth != (u16)mDoGph_gInf_c::getWidth() ||
|
||||
mCaptureHeight != (u16)mDoGph_gInf_c::getHeight()) {
|
||||
if (mCaptureWidth != JUTVideo::getManager()->getRenderWidth() ||
|
||||
mCaptureHeight != JUTVideo::getManager()->getRenderHeight()) {
|
||||
mFlag = 1;
|
||||
return;
|
||||
}
|
||||
@@ -137,8 +131,8 @@ private:
|
||||
/* 0x5 */ u8 mAlpha;
|
||||
/* 0x6 */ u8 mTopFlag;
|
||||
#if TARGET_PC
|
||||
u16 mCaptureWidth;
|
||||
u16 mCaptureHeight;
|
||||
u32 mCaptureWidth;
|
||||
u32 mCaptureHeight;
|
||||
TGXTexObj mTexObj;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -1468,24 +1468,12 @@ void dMsgObject_c::fukiPosCalc(bool param_1) {
|
||||
fopAc_ac_c* player = dComIfGp_getPlayer(0);
|
||||
cXyz local_3c;
|
||||
cXyz cStack_48;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&player->eyePos, &cStack_48, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&player->eyePos, &cStack_48);
|
||||
#endif
|
||||
|
||||
f32 temp;
|
||||
if ((field_0x100->pos == cXyz(0.0f, 0.0f, 0.0f))) {
|
||||
temp = cStack_48.y;
|
||||
} else {
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&field_0x100->pos, &local_3c, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&field_0x100->pos, &local_3c);
|
||||
#endif
|
||||
|
||||
if (local_3c.x >= 0.0f && local_3c.x <= FB_WIDTH && local_3c.y >= 0.0f &&
|
||||
local_3c.y <= FB_HEIGHT)
|
||||
{
|
||||
|
||||
@@ -607,17 +607,10 @@ void dMsgScrnHowl_c::drawGuide() {
|
||||
J2DGrafContext* grafContext = dComIfGp_getCurrentGrafPort();
|
||||
Vec local_b0 = field_0x128;
|
||||
Vec local_bc = field_0x140;
|
||||
#if TARGET_PC
|
||||
grafContext->scissor(
|
||||
(local_b0.x - mDoGph_gInf_c::getMinXF()) / (mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getWidth()),
|
||||
field_0x2118, (local_bc.x - local_b0.x) / (mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getWidth()),
|
||||
field_0x2120);
|
||||
#else
|
||||
grafContext->scissor(
|
||||
(local_b0.x - mDoGph_gInf_c::getMinXF()) / (mDoGph_gInf_c::getWidthF() / FB_WIDTH),
|
||||
field_0x2118, (local_bc.x - local_b0.x) / (mDoGph_gInf_c::getWidthF() / FB_WIDTH),
|
||||
field_0x2120);
|
||||
#endif
|
||||
grafContext->setScissor();
|
||||
f32 local_cc = mpLineH[0]->getGlobalPosX();
|
||||
s16 sVar12 = 0;
|
||||
@@ -745,19 +738,11 @@ void dMsgScrnHowl_c::drawGuide2() {
|
||||
}
|
||||
Vec local_58 = field_0x128;
|
||||
Vec local_64 = field_0x140;
|
||||
#if TARGET_PC
|
||||
f32 local_70 = mDoGph_gInf_c::getHeightF() / mDoGph_gInf_c::getHeight();
|
||||
grafContext->scissor(
|
||||
(local_58.x - mDoGph_gInf_c::getMinXF()) / (mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getWidth()),
|
||||
field_0x2118, (local_64.x - local_58.x) / (mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getWidth()),
|
||||
field_0x2120);
|
||||
#else
|
||||
f32 local_70 = mDoGph_gInf_c::getHeightF() / mDoGph_gInf_c::getHeight();
|
||||
grafContext->scissor(
|
||||
(local_58.x - mDoGph_gInf_c::getMinXF()) / (mDoGph_gInf_c::getWidthF() / FB_WIDTH),
|
||||
field_0x2118, (local_64.x - local_58.x) / (mDoGph_gInf_c::getWidthF() / FB_WIDTH),
|
||||
field_0x2120);
|
||||
#endif
|
||||
grafContext->setScissor();
|
||||
f32 local_74 = mpLineH[0]->getGlobalPosX();
|
||||
s16 local_134 = 0;
|
||||
@@ -859,15 +844,9 @@ void dMsgScrnHowl_c::drawEffect() {
|
||||
Vec vec1 = field_0x128;
|
||||
Vec vec2 = field_0x140;
|
||||
mDoGph_gInf_c::getHeightF();
|
||||
#if TARGET_PC
|
||||
grafContext->scissor(
|
||||
(vec1.x - mDoGph_gInf_c::getMinXF()) / (mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getWidth()), field_0x2118,
|
||||
12.0f + ((vec2.x - vec1.x) / (mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getWidth())), field_0x2120);
|
||||
#else
|
||||
grafContext->scissor(
|
||||
(vec1.x - mDoGph_gInf_c::getMinXF()) / (mDoGph_gInf_c::getWidthF() / FB_WIDTH), field_0x2118,
|
||||
12.0f + ((vec2.x - vec1.x) / (mDoGph_gInf_c::getWidthF() / FB_WIDTH)), field_0x2120);
|
||||
#endif
|
||||
grafContext->setScissor();
|
||||
u8 timer = daAlink_getAlinkActorClass()->getWolfHowlMgrP()->getReleaseTimer();
|
||||
u8 screenAlpha = mpScreen->search(MULTI_CHAR('line00'))->getAlpha();
|
||||
|
||||
@@ -557,22 +557,11 @@ void dMsgScrnItem_c::fukiPosCalc(u8 param_1) {
|
||||
cXyz local_70;
|
||||
cXyz cStack_7c;
|
||||
f32 f3;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&player->eyePos, &cStack_7c, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&player->eyePos, &cStack_7c);
|
||||
#endif
|
||||
|
||||
if (iVar6->pos == cXyz(0.0f, 0.0f, 0.0f)) {
|
||||
f3 = cStack_7c.y;
|
||||
} else {
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&iVar6->pos, &local_70, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&iVar6->pos, &local_70);
|
||||
#endif
|
||||
|
||||
if (local_70.x >= 0.0f && local_70.x <= FB_WIDTH && local_70.y >= 0.0f &&
|
||||
local_70.y <= FB_HEIGHT)
|
||||
{
|
||||
|
||||
@@ -441,22 +441,11 @@ void dMsgScrnTalk_c::fukiPosCalc(u8 param_1) {
|
||||
cXyz local_70;
|
||||
cXyz cStack_7c;
|
||||
f32 f3y;
|
||||
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&player->eyePos, &cStack_7c, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&player->eyePos, &cStack_7c);
|
||||
#endif
|
||||
|
||||
if (msgActor->pos == cXyz(0.0f, 0.0f, 0.0f)) {
|
||||
f3y = cStack_7c.y;
|
||||
} else {
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&msgActor->pos, &local_70, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&msgActor->pos, &local_70);
|
||||
#endif
|
||||
|
||||
if (local_70.x >= 0.0f && local_70.x <= FB_WIDTH_BASE && local_70.y >= 0.0f &&
|
||||
local_70.y <= FB_HEIGHT_BASE)
|
||||
{
|
||||
|
||||
@@ -12,13 +12,8 @@
|
||||
#include "m_Do/m_Do_graphic.h"
|
||||
|
||||
void dOvlpFd2_dlst_c::draw() {
|
||||
#if TARGET_PC
|
||||
GXSetViewport(0.0f, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight());
|
||||
#else
|
||||
GXSetViewport(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, FB_WIDTH, FB_HEIGHT);
|
||||
#endif
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGB, GX_RGBA4, 0);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
|
||||
+3
-23
@@ -13,11 +13,10 @@
|
||||
#include "m_Do/m_Do_graphic.h"
|
||||
|
||||
void dDlst_snapShot_c::draw() {
|
||||
#if TARGET_PC
|
||||
GXSetTexCopySrc(0, 0, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight());
|
||||
GXSetTexCopyDst(mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), GX_TF_RGBA8, GX_TRUE);
|
||||
#else
|
||||
GXSetTexCopySrc(0, 0, FB_WIDTH, FB_HEIGHT);
|
||||
#if TARGET_PC
|
||||
GXSetTexCopyDst(FB_WIDTH, FB_HEIGHT, GX_TF_RGBA8, GX_FALSE);
|
||||
#else
|
||||
GXSetTexCopyDst(FB_WIDTH / 2, FB_HEIGHT / 2, GX_TF_RGBA8, GX_TRUE);
|
||||
#endif
|
||||
GXCopyTex(mDoGph_gInf_c::getFrameBufferTex(), GX_FALSE);
|
||||
@@ -25,13 +24,8 @@ void dDlst_snapShot_c::draw() {
|
||||
}
|
||||
|
||||
void dOvlpFd3_dlst_c::draw() {
|
||||
#if TARGET_PC
|
||||
GXSetViewport(0.0f, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight());
|
||||
#else
|
||||
GXSetViewport(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, FB_WIDTH, FB_HEIGHT);
|
||||
#endif
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGB, GX_RGBA4, 0);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
@@ -112,19 +106,6 @@ void dOvlpFd3_dlst_c::draw() {
|
||||
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
|
||||
#if TARGET_PC
|
||||
GXPosition2s16(-FB_WIDTH / 2, FB_HEIGHT / 2);
|
||||
GXTexCoord2s8(0, 0);
|
||||
|
||||
GXPosition2s16(FB_WIDTH / 2, FB_HEIGHT / 2);
|
||||
GXTexCoord2s8(1, 0);
|
||||
|
||||
GXPosition2s16(FB_WIDTH / 2, -FB_HEIGHT / 2);
|
||||
GXTexCoord2s8(1, 1);
|
||||
|
||||
GXPosition2s16(-FB_WIDTH / 2, -FB_HEIGHT / 2);
|
||||
GXTexCoord2s8(0, 1);
|
||||
#else
|
||||
GXPosition2s16(-mDoGph_gInf_c::getWidth() / 2, mDoGph_gInf_c::getHeight() / 2);
|
||||
GXTexCoord2s8(0, 0);
|
||||
|
||||
@@ -136,7 +117,6 @@ void dOvlpFd3_dlst_c::draw() {
|
||||
|
||||
GXPosition2s16(-mDoGph_gInf_c::getWidth() / 2, -mDoGph_gInf_c::getHeight() / 2);
|
||||
GXTexCoord2s8(0, 1);
|
||||
#endif
|
||||
|
||||
GXEnd();
|
||||
|
||||
|
||||
@@ -356,12 +356,8 @@ Vec CPaneMgr::getGlobalVtx(J2DPane* p_pane, Mtx* param_1, u8 param_2, bool param
|
||||
Mtx m;
|
||||
MtxP mp = (MtxP)param_1;
|
||||
J2DPane* parent = p_pane->getParentPane();
|
||||
|
||||
#if TARGET_PC
|
||||
J2DOrthoGraph ortho(0.0f, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), -1.0f, 1.0f);
|
||||
#else
|
||||
|
||||
J2DOrthoGraph ortho(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, -1.0f, 1.0f);
|
||||
#endif
|
||||
ortho.setOrtho(mDoGph_gInf_c::getMinXF(), mDoGph_gInf_c::getMinYF(), mDoGph_gInf_c::getWidthF(), mDoGph_gInf_c::getHeightF(), -1.0f, 1.0f);
|
||||
|
||||
if (parent != NULL) {
|
||||
|
||||
@@ -1418,12 +1418,7 @@ static int phase_4(dScnPly_c* i_this) {
|
||||
dComIfGp_setPlayerPtr(i, NULL);
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
dComIfGp_setWindow(0, 0.0f, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), 0.0f,
|
||||
1.0f, 0, 2);
|
||||
#else
|
||||
dComIfGp_setWindow(0, 0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, 0.0f, 1.0f, 0, 2);
|
||||
#endif
|
||||
dComIfGp_setCameraInfo(0, NULL, 0, 0, -1);
|
||||
dComIfGd_setWindow(NULL);
|
||||
dComIfGd_setViewport(NULL);
|
||||
|
||||
@@ -855,11 +855,7 @@ int dShopSystem_c::seq_wait(fopAc_ac_c* param_0, dMsgFlow_c* param_1) {
|
||||
}
|
||||
|
||||
inline void pos3Dto2D(Vec* a, Vec* b) {
|
||||
#if TARGET_PC
|
||||
mDoLib_project(a, b, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(a, b);
|
||||
#endif
|
||||
}
|
||||
|
||||
int dShopSystem_c::seq_start(fopAc_ac_c* actor, dMsgFlow_c* i_flow) {
|
||||
|
||||
@@ -13,7 +13,7 @@ static void ApplyPresetClassic() {
|
||||
auto& s = getSettings();
|
||||
s.video.lockAspectRatio.setValue(true);
|
||||
s.game.bloomMode.setValue(BloomMode::Classic);
|
||||
VILockAspectRatio(defaultAspectRatioW, defaultAspectRatioH);
|
||||
AuroraSetViewportPolicy(AURORA_VIEWPORT_FIT);
|
||||
}
|
||||
|
||||
static void ApplyPresetHD() {
|
||||
|
||||
@@ -45,6 +45,14 @@ static void OpenDataFolder() {
|
||||
#define DUSK_CAN_OPEN_DATA_FOLDER 0
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
constexpr int kInternalResolutionScaleMax = 12;
|
||||
} // namespace
|
||||
|
||||
namespace aurora::gx {
|
||||
extern bool enableLodBias;
|
||||
}
|
||||
|
||||
namespace dusk {
|
||||
void ImGuiMenuGame::ToggleFullscreen() {
|
||||
getSettings().video.enableFullscreen.setValue(!getSettings().video.enableFullscreen);
|
||||
@@ -82,14 +90,34 @@ namespace dusk {
|
||||
getSettings().video.lockAspectRatio.setValue(lockAspect);
|
||||
|
||||
if (lockAspect) {
|
||||
VILockAspectRatio(defaultAspectRatioW, defaultAspectRatioH);
|
||||
AuroraSetViewportPolicy(AURORA_VIEWPORT_FIT);
|
||||
} else {
|
||||
VIUnlockAspectRatio();
|
||||
AuroraSetViewportPolicy(AURORA_VIEWPORT_STRETCH);
|
||||
}
|
||||
|
||||
config::Save();
|
||||
}
|
||||
|
||||
u32 internalResolutionWidth = 0;
|
||||
u32 internalResolutionHeight = 0;
|
||||
AuroraGetRenderSize(&internalResolutionWidth, &internalResolutionHeight);
|
||||
ImGui::TextDisabled("Current internal resolution: %ux%u", internalResolutionWidth,
|
||||
internalResolutionHeight);
|
||||
|
||||
int scale = std::clamp(getSettings().game.internalResolutionScale.getValue(), 0,
|
||||
kInternalResolutionScaleMax);
|
||||
if (ImGui::SliderInt("Internal Resolution", &scale, 0, kInternalResolutionScaleMax,
|
||||
scale == 0 ? "Auto" : "%dx"))
|
||||
{
|
||||
getSettings().game.internalResolutionScale.setValue(scale);
|
||||
VISetFrameBufferScale(static_cast<float>(scale));
|
||||
config::Save();
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Auto renders at the native window resolution.\n"
|
||||
"Higher values scale the game's internal framebuffer.");
|
||||
}
|
||||
|
||||
constexpr const char* bloomModeNames[] = {"Off", "Classic", "Dusk"};
|
||||
int bloomMode = static_cast<int>(getSettings().game.bloomMode.getValue());
|
||||
if (ImGui::BeginCombo("Bloom", bloomModeNames[bloomMode])) {
|
||||
@@ -117,6 +145,8 @@ namespace dusk {
|
||||
|
||||
config::ImGuiCheckbox("Enable Water Refraction", getSettings().game.enableWaterRefraction);
|
||||
|
||||
ImGui::Checkbox("Enable LOD Bias", &aurora::gx::enableLodBias);
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ UserSettings g_userSettings = {
|
||||
.bloomMultiplier {"game.bloomMultiplier", 1.0f},
|
||||
.enableWaterRefraction {"game.enableWaterRefraction", true},
|
||||
.enableFrameInterpolation = {"game.enableFrameInterpolation", false},
|
||||
.internalResolutionScale {"game.internalResolutionScale", 0},
|
||||
.shadowResolutionMultiplier {"game.shadowResolutionMultiplier", 1},
|
||||
|
||||
// Audio
|
||||
@@ -138,6 +139,7 @@ void registerSettings() {
|
||||
Register(g_userSettings.game.bloomMode);
|
||||
Register(g_userSettings.game.bloomMultiplier);
|
||||
Register(g_userSettings.game.enableWaterRefraction);
|
||||
Register(g_userSettings.game.internalResolutionScale);
|
||||
Register(g_userSettings.game.shadowResolutionMultiplier);
|
||||
Register(g_userSettings.game.enableFastIronBoots);
|
||||
Register(g_userSettings.game.canTransformAnywhere);
|
||||
|
||||
@@ -332,14 +332,6 @@ static VIRetraceCallback sVIPostRetraceCallback = NULL;
|
||||
|
||||
extern "C" {
|
||||
|
||||
void VIConfigure(const GXRenderModeObj* rm) {
|
||||
STUB_LOG();
|
||||
}
|
||||
|
||||
void VIConfigurePan(u16 xOrg, u16 yOrg, u16 width, u16 height) {
|
||||
STUB_LOG();
|
||||
}
|
||||
|
||||
u32 VIGetRetraceCount() {
|
||||
return sRetraceCount;
|
||||
}
|
||||
|
||||
+50
-75
@@ -141,7 +141,7 @@ void dDlst_heapMap_c::draw() {
|
||||
f32 var_f29 = field_0x10 - field_0x8;
|
||||
f32 sp4C = field_0x14 - field_0xc;
|
||||
f32 sp48 = var_f29 * sp4C;
|
||||
|
||||
|
||||
uintptr_t start_addr = (uintptr_t)m_heap->getStartAddr();
|
||||
uintptr_t end_addr = (uintptr_t)m_heap->getEndAddr();
|
||||
u32 sp40 = end_addr - start_addr;
|
||||
@@ -156,7 +156,7 @@ void dDlst_heapMap_c::draw() {
|
||||
f32 var_f30 = (f32)sp38 * sp3C;
|
||||
uintptr_t sp34 = (uintptr_t)block - start_addr;
|
||||
f32 sp30 = (f32)sp34 * sp3C;
|
||||
|
||||
|
||||
f32 var_f28 = std::floor(sp30 / var_f29);
|
||||
|
||||
f32 sp2C = sp30 - (var_f29 * var_f28);
|
||||
@@ -562,21 +562,16 @@ struct tvSize {
|
||||
u16 width;
|
||||
u16 height;
|
||||
};
|
||||
const tvSize l_tvSize[2] = {
|
||||
#ifndef TARGET_PC
|
||||
const
|
||||
#endif
|
||||
tvSize l_tvSize[2] = {
|
||||
{FB_WIDTH_BASE, FB_HEIGHT_BASE},
|
||||
{808, FB_HEIGHT_BASE},
|
||||
};
|
||||
|
||||
#if TARGET_PC
|
||||
tvSize pc_tvSize = {608, 448};
|
||||
#endif
|
||||
|
||||
void mDoGph_gInf_c::setTvSize() {
|
||||
#if TARGET_PC
|
||||
const tvSize* tvsize = &pc_tvSize;
|
||||
#else
|
||||
const tvSize* tvsize = &l_tvSize[mWide];
|
||||
#endif
|
||||
|
||||
m_width = tvsize->width;
|
||||
m_height = tvsize->height;
|
||||
@@ -603,21 +598,11 @@ void mDoGph_gInf_c::setTvSize() {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
void mDoGph_gInf_c::onWide(f32 width, f32 height) {
|
||||
mWide = TRUE;
|
||||
pc_tvSize.width = width;
|
||||
pc_tvSize.height = height;
|
||||
setTvSize();
|
||||
dMeter2Info_onWide2D();
|
||||
}
|
||||
#else
|
||||
void mDoGph_gInf_c::onWide() {
|
||||
mWide = TRUE;
|
||||
setTvSize();
|
||||
dMeter2Info_onWide2D();
|
||||
}
|
||||
#endif
|
||||
|
||||
void mDoGph_gInf_c::offWide() {
|
||||
mWide = FALSE;
|
||||
@@ -759,8 +744,11 @@ void mDoGph_gInf_c::updateSafeAreaBounds() {
|
||||
return;
|
||||
}
|
||||
|
||||
u32 renderWidth = 0;
|
||||
u32 renderHeight = 0;
|
||||
AuroraGetRenderSize(&renderWidth, &renderHeight);
|
||||
if (windowSize.native_fb_width == 0 || windowSize.native_fb_height == 0 ||
|
||||
windowSize.fb_width == 0 || windowSize.fb_height == 0)
|
||||
renderWidth == 0 || renderHeight == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -773,23 +761,25 @@ void mDoGph_gInf_c::updateSafeAreaBounds() {
|
||||
const f32 safeRight = static_cast<f32>(safeRect.x + safeRect.w) * nativeScaleX;
|
||||
const f32 safeBottom = static_cast<f32>(safeRect.y + safeRect.h) * nativeScaleY;
|
||||
|
||||
const f32 viewportLeft =
|
||||
(static_cast<f32>(windowSize.native_fb_width) - static_cast<f32>(windowSize.fb_width)) *
|
||||
0.5f;
|
||||
const f32 viewportTop =
|
||||
(static_cast<f32>(windowSize.native_fb_height) - static_cast<f32>(windowSize.fb_height)) *
|
||||
0.5f;
|
||||
const f32 viewportRight = viewportLeft + static_cast<f32>(windowSize.fb_width);
|
||||
const f32 viewportBottom = viewportTop + static_cast<f32>(windowSize.fb_height);
|
||||
f32 viewportWidth = static_cast<f32>(windowSize.native_fb_width);
|
||||
f32 viewportHeight = static_cast<f32>(windowSize.native_fb_height);
|
||||
const f32 targetAspect = viewportWidth / viewportHeight;
|
||||
const f32 contentAspect = static_cast<f32>(renderWidth) / static_cast<f32>(renderHeight);
|
||||
if (targetAspect > contentAspect) {
|
||||
viewportWidth = std::max(1.0f, std::round(viewportHeight * contentAspect));
|
||||
} else if (targetAspect < contentAspect) {
|
||||
viewportHeight = std::max(1.0f, std::round(viewportWidth / contentAspect));
|
||||
}
|
||||
|
||||
const f32 leftInset = std::max(0.0f, safeLeft - viewportLeft) *
|
||||
(m_widthF / static_cast<f32>(windowSize.fb_width));
|
||||
const f32 topInset = std::max(0.0f, safeTop - viewportTop) *
|
||||
(m_heightF / static_cast<f32>(windowSize.fb_height));
|
||||
const f32 rightInset = std::max(0.0f, viewportRight - safeRight) *
|
||||
(m_widthF / static_cast<f32>(windowSize.fb_width));
|
||||
const f32 bottomInset = std::max(0.0f, viewportBottom - safeBottom) *
|
||||
(m_heightF / static_cast<f32>(windowSize.fb_height));
|
||||
const f32 viewportLeft = (static_cast<f32>(windowSize.native_fb_width) - viewportWidth) * 0.5f;
|
||||
const f32 viewportTop = (static_cast<f32>(windowSize.native_fb_height) - viewportHeight) * 0.5f;
|
||||
const f32 viewportRight = viewportLeft + viewportWidth;
|
||||
const f32 viewportBottom = viewportTop + viewportHeight;
|
||||
|
||||
const f32 leftInset = std::max(0.0f, safeLeft - viewportLeft) * (m_widthF / viewportWidth);
|
||||
const f32 topInset = std::max(0.0f, safeTop - viewportTop) * (m_heightF / viewportHeight);
|
||||
const f32 rightInset = std::max(0.0f, viewportRight - safeRight) * (m_widthF / viewportWidth);
|
||||
const f32 bottomInset = std::max(0.0f, viewportBottom - safeBottom) * (m_heightF / viewportHeight);
|
||||
|
||||
const f32 safeMinXF = m_minXF + leftInset;
|
||||
const f32 safeMinYF = m_minYF + topInset;
|
||||
@@ -810,13 +800,13 @@ void mDoGph_gInf_c::updateSafeAreaBounds() {
|
||||
m_safeHeightF = safeHeightF;
|
||||
}
|
||||
|
||||
void mDoGph_gInf_c::setWindowSize(AuroraWindowSize const& size) {
|
||||
JUTVideo::getManager()->setWindowSize(size);
|
||||
dComIfGp_setWindow(0, 0.0f, 0.0f, getWidth(), getHeight(), 0.0f, 1.0f, 0, 2);
|
||||
mFader->mBox.set(0, 0, getWidth(), getHeight());
|
||||
|
||||
f32 newWidth = (getWidth() / getHeight()) * 448.0f;
|
||||
onWide(newWidth, 448.0f);
|
||||
void mDoGph_gInf_c::updateRenderSize() {
|
||||
u32 width, height;
|
||||
AuroraGetRenderSize(&width, &height);
|
||||
JUTVideo::getManager()->setRenderSize(width, height);
|
||||
l_tvSize[1].width = static_cast<u16>(static_cast<float>(width) / static_cast<float>(height) *
|
||||
static_cast<float>(l_tvSize[1].height));
|
||||
onWide();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -952,7 +942,7 @@ static void drawDepth2(view_class* param_0, view_port_class* param_1, int param_
|
||||
GXProject(param_0->lookat.center.x, param_0->lookat.center.y,
|
||||
param_0->lookat.center.z, param_0->viewMtx, sp4C, sp34, &sp1C, &sp18,
|
||||
&sp14);
|
||||
|
||||
|
||||
param_2 = (0xFF0000 - (int)(16777215.0f * sp14)) >> 8;
|
||||
param_2 = cLib_minMaxLimit<int>(param_2, -0x400, 0);
|
||||
}
|
||||
@@ -1317,8 +1307,8 @@ void mDoGph_gInf_c::bloom_c::draw2() {
|
||||
if (mMonoColor.a == 0 && !enabled)
|
||||
return;
|
||||
|
||||
f32 width = mDoGph_gInf_c::getWidth();
|
||||
f32 height = mDoGph_gInf_c::getHeight();
|
||||
f32 width = JUTVideo::getManager()->getRenderWidth();
|
||||
f32 height = JUTVideo::getManager()->getRenderHeight();
|
||||
|
||||
GXLoadTexObj(getFrameBufferTexObj(), GX_TEXMAP0);
|
||||
GXSetNumChans(0);
|
||||
@@ -1402,7 +1392,7 @@ void mDoGph_gInf_c::bloom_c::draw2() {
|
||||
CopyToTexObj(&tmpTex[texNo], texNo, rect.w, rect.h);
|
||||
return &tmpTex[texNo];
|
||||
};
|
||||
|
||||
|
||||
auto divQuad = [&](int divNo) {
|
||||
auto const& rect = divRects[divNo];
|
||||
f32 x0 = rect.x / width;
|
||||
@@ -1435,8 +1425,8 @@ void mDoGph_gInf_c::bloom_c::draw2() {
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
GXCreateFrameBuffer(width * 0.75f, height * 0.5f);
|
||||
GXSetViewport(0.0f, 0.0f, width, height, 0.0f, 1.0f); // use oversized viewport to make the math easier
|
||||
GXCreateFrameBuffer(divRects[2].x + divRects[2].w, divRects[1].y + divRects[1].h);
|
||||
GXSetViewportRender(0.0f, 0.0f, width, height, 0.0f, 1.0f); // use oversized viewport to make the math easier
|
||||
|
||||
GXSetNumTevStages(3);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
@@ -1473,7 +1463,7 @@ void mDoGph_gInf_c::bloom_c::draw2() {
|
||||
GXTexObj* texPass0 = divCopyTex(Pass0, 2);
|
||||
GXLoadTexObj(texPass0, GX_TEXMAP0);
|
||||
|
||||
f32 blurScale = mBlureSize * ((448.0f / getHeight()) / 6400.0f);
|
||||
f32 blurScale = mBlureSize * ((448.0f / height) / 6400.0f);
|
||||
|
||||
// Setup blur filter TEV.
|
||||
GXSetNumTexGens(8);
|
||||
@@ -1507,7 +1497,7 @@ void mDoGph_gInf_c::bloom_c::draw2() {
|
||||
// This is applied over two passes, the second one with an alpha of 25%; however, the clipping that this introduces is a bit integral to the look,
|
||||
// so we do the same thing, letting it clip.
|
||||
float brightnessF32 = (mBlureRatio * 16 / 255.0f);
|
||||
|
||||
|
||||
// Distribute the brightness through the total number of passes.
|
||||
f32 totalNumPasses = (divNum - divStart + 1);
|
||||
float brightnessPerPass = 255.0f * powf(brightnessF32, 1.0f / totalNumPasses);
|
||||
@@ -1579,13 +1569,8 @@ void mDoGph_gInf_c::bloom_c::draw() {
|
||||
|
||||
bool enabled = mEnable && m_buffer != NULL;
|
||||
if (mMonoColor.a != 0 || enabled) {
|
||||
#if TARGET_PC
|
||||
f32 width = mDoGph_gInf_c::getWidth();
|
||||
f32 height = mDoGph_gInf_c::getHeight();
|
||||
#else
|
||||
f32 width = FB_WIDTH;
|
||||
f32 height = FB_HEIGHT;
|
||||
#endif
|
||||
GXSetViewport(0.0f, 0.0f, width, height, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, width, height);
|
||||
|
||||
@@ -1700,7 +1685,7 @@ void mDoGph_gInf_c::bloom_c::draw() {
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||
for (int texCoord = (int)GX_TEXCOORD1; texCoord < (int)GX_MAX_TEXCOORD; texCoord++) {
|
||||
GXSetTexCoordGen((GXTexCoordID)texCoord, GX_TG_MTX2x4, GX_TG_TEX0, texMtxID);
|
||||
|
||||
|
||||
#if TARGET_PC
|
||||
f32 dVar15 = mBlureSize * ((448.0f / height) / 6400.0f);
|
||||
#else
|
||||
@@ -1841,7 +1826,7 @@ static void retry_captue_frame(view_class* param_0, view_port_class* param_1, in
|
||||
var_r23 = height >> 1;
|
||||
GXSetTexCopySrc(x_orig, y_orig_pos, width, height);
|
||||
#ifdef TARGET_PC
|
||||
GXSetTexCopyDst(width, height, (GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_TRUE);
|
||||
GXSetTexCopyDst(width, height, (GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_FALSE);
|
||||
#else
|
||||
GXSetTexCopyDst(var_r24, var_r23, (GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_TRUE);
|
||||
#endif
|
||||
@@ -2097,8 +2082,7 @@ int mDoGph_Painter() {
|
||||
j3dSys.drawInit();
|
||||
GXSetDither(GX_ENABLE);
|
||||
|
||||
J2DOrthoGraph ortho(0.0f, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), -1.0f,
|
||||
1.0f);
|
||||
J2DOrthoGraph ortho(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, -1.0f, 1.0f);
|
||||
ortho.setOrtho(mDoGph_gInf_c::getMinXF(), mDoGph_gInf_c::getMinYF(),
|
||||
mDoGph_gInf_c::getWidthF(), mDoGph_gInf_c::getHeightF(),
|
||||
-1.0f, 1.0f);
|
||||
@@ -2144,13 +2128,8 @@ int mDoGph_Painter() {
|
||||
view_port_class new_port;
|
||||
new_port.x_orig = 0.0f;
|
||||
new_port.y_orig = 0.0f;
|
||||
#if TARGET_PC
|
||||
new_port.width = mDoGph_gInf_c::getWidth();
|
||||
new_port.height = mDoGph_gInf_c::getHeight();
|
||||
#else
|
||||
new_port.width = FB_WIDTH;
|
||||
new_port.height = FB_HEIGHT;
|
||||
#endif
|
||||
new_port.near_z = view_port->near_z;
|
||||
new_port.far_z = view_port->far_z;
|
||||
new_port.scissor = view_port->scissor;
|
||||
@@ -2204,7 +2183,7 @@ int mDoGph_Painter() {
|
||||
dComIfGp_setCurrentView(&camera_p->view);
|
||||
dComIfGp_setCurrentViewport(view_port);
|
||||
GXSetProjection(camera_p->view.projMtx, GX_PERSPECTIVE);
|
||||
|
||||
|
||||
#if DEBUG
|
||||
captureScreenSetProjection(camera_p->view.projMtx);
|
||||
#endif
|
||||
@@ -2281,7 +2260,7 @@ int mDoGph_Painter() {
|
||||
#endif
|
||||
|
||||
GX_DEBUG_GROUP(dComIfGd_drawOpaListPacket);
|
||||
|
||||
|
||||
#if DEBUG
|
||||
// "drawing up to special-use drawing (Opaque) except J3D (Rendering)"
|
||||
fapGm_HIO_c::stopCpuTimer("J3D以外などの特殊用(不透明)描画まで(レンダリング)");
|
||||
@@ -2363,7 +2342,7 @@ int mDoGph_Painter() {
|
||||
GX_DEBUG_GROUP(dComIfGd_drawXluListInvisible);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if DEBUG
|
||||
// "drawing up to projection (Translucent)"
|
||||
@@ -2467,12 +2446,8 @@ int mDoGph_Painter() {
|
||||
retry_captue_frame(&camera_p->view, view_port,
|
||||
dComIfGp_getCameraZoomForcus(camera_id));
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
GXSetViewport(0.0f, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), 0.0f, 1.0f);
|
||||
#else
|
||||
|
||||
GXSetViewport(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, 0.0f, 1.0f);
|
||||
#endif
|
||||
|
||||
Mtx m2;
|
||||
Mtx44 m;
|
||||
|
||||
+5
-70
@@ -95,8 +95,13 @@ void mDoLib_project(Vec* src, Vec* dst) {
|
||||
xOffset = (0.5f * ((2.0f * viewPort->x_orig) + viewPort->width)) - (int)(FB_WIDTH / 2);
|
||||
xSize = FB_WIDTH;
|
||||
} else {
|
||||
#if TARGET_PC
|
||||
xOffset = mDoGph_gInf_c::getSafeMinXF();
|
||||
xSize = viewPort->width * mDoGph_gInf_c::hudAspectScaleUp;
|
||||
#else
|
||||
xOffset = viewPort->x_orig;
|
||||
xSize = viewPort->width;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (viewPort->y_orig != 0.0f) {
|
||||
@@ -117,76 +122,6 @@ void mDoLib_project(Vec* src, Vec* dst) {
|
||||
dst->y = ((0.5f + (multVec.y * (-calcFloat))) * ySize) + yOffset;
|
||||
}
|
||||
|
||||
|
||||
#if TARGET_PC
|
||||
void mDoLib_project(Vec* src, Vec* dst, JGeometry::TBox2<f32> viewport) {
|
||||
if (dComIfGd_getView() == NULL) {
|
||||
dst->x = 0.0f;
|
||||
dst->y = 0.0f;
|
||||
dst->z = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
{ int unused; }
|
||||
|
||||
Vec multVec;
|
||||
cMtx_multVec(*dComIfGd_getProjViewMtx(), src, &multVec);
|
||||
|
||||
f32 calcFloat = (src->x * (*dComIfGd_getProjViewMtx())[3][0]) +
|
||||
(src->y * (*dComIfGd_getProjViewMtx())[3][1]) +
|
||||
(src->z * (*dComIfGd_getProjViewMtx())[3][2]) +
|
||||
(*dComIfGd_getProjViewMtx())[3][3];
|
||||
if (multVec.z >= 0.0f) {
|
||||
multVec.z = 0.0f;
|
||||
}
|
||||
if (calcFloat <= 0.0f) {
|
||||
if (calcFloat == 0.0f) {
|
||||
dst->z = multVec.z * 500000.0f;
|
||||
} else {
|
||||
dst->z = multVec.z * (0.5f / calcFloat);
|
||||
}
|
||||
calcFloat = 500000.0f;
|
||||
} else {
|
||||
calcFloat = 0.5f / calcFloat;
|
||||
dst->z = multVec.z * calcFloat;
|
||||
}
|
||||
|
||||
f32 xOffset;
|
||||
f32 yOffset;
|
||||
f32 xSize;
|
||||
f32 ySize;
|
||||
if (viewport.i.x != 0.0f) {
|
||||
xOffset = (0.5f * ((2.0f * viewport.i.x) + viewport.f.x)) - (int)(FB_WIDTH / 2);
|
||||
xSize = FB_WIDTH;
|
||||
} else {
|
||||
#if TARGET_PC
|
||||
xOffset = mDoGph_gInf_c::getSafeMinXF();
|
||||
xSize = viewport.f.x * mDoGph_gInf_c::hudAspectScaleUp;
|
||||
#else
|
||||
xOffset = viewport.i.x;
|
||||
xSize = viewport.f.x;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (viewport.i.y != 0.0f) {
|
||||
yOffset = (0.5f * ((2.0f * viewport.i.y) + viewport.f.y)) - (int)(FB_HEIGHT / 2);
|
||||
ySize = FB_HEIGHT;
|
||||
} else {
|
||||
yOffset = viewport.i.y;
|
||||
ySize = viewport.f.y;
|
||||
}
|
||||
|
||||
dst->x = ((0.5f + (multVec.x * calcFloat)) * xSize) + xOffset;
|
||||
#if TARGET_PC
|
||||
if (dusk::getSettings().game.enableMirrorMode) {
|
||||
dst->x = ((0.5f + (-multVec.x * calcFloat)) * xSize) + xOffset;
|
||||
}
|
||||
#endif
|
||||
|
||||
dst->y = ((0.5f + (multVec.y * (-calcFloat))) * ySize) + yOffset;
|
||||
}
|
||||
#endif
|
||||
|
||||
void mDoLib_pos2camera(Vec* src, Vec* dst) {
|
||||
if (dComIfGd_getView() == NULL) {
|
||||
dst->x = 0.0f;
|
||||
|
||||
+5
-13
@@ -126,8 +126,6 @@ AuroraStats dusk::lastFrameAuroraStats;
|
||||
float dusk::frameUsagePct = 0.0f;
|
||||
const char* configPath;
|
||||
|
||||
AuroraWindowSize preLaunchUIWindowSize;
|
||||
|
||||
bool launchUILoop() {
|
||||
while (dusk::IsRunning && !dusk::IsGameLaunched) {
|
||||
const AuroraEvent* event = aurora_update();
|
||||
@@ -136,9 +134,6 @@ bool launchUILoop() {
|
||||
case AURORA_SDL_EVENT:
|
||||
dusk::g_imguiConsole.HandleSDLEvent(event->sdl);
|
||||
break;
|
||||
case AURORA_WINDOW_RESIZED:
|
||||
preLaunchUIWindowSize = event->windowSize;
|
||||
break;
|
||||
case AURORA_DISPLAY_SCALE_CHANGED:
|
||||
dusk::ImGuiEngine_Initialize(event->windowSize.scale);
|
||||
break;
|
||||
@@ -202,9 +197,6 @@ void main01(void) {
|
||||
|
||||
OSReport("Entering Main Loop (main01)...\n");
|
||||
|
||||
if (preLaunchUIWindowSize.width != 0)
|
||||
mDoGph_gInf_c::setWindowSize(preLaunchUIWindowSize);
|
||||
|
||||
dusk::game_clock::ensure_initialized();
|
||||
|
||||
do {
|
||||
@@ -217,9 +209,6 @@ void main01(void) {
|
||||
case AURORA_SDL_EVENT:
|
||||
dusk::g_imguiConsole.HandleSDLEvent(event->sdl);
|
||||
break;
|
||||
case AURORA_WINDOW_RESIZED:
|
||||
mDoGph_gInf_c::setWindowSize(event->windowSize);
|
||||
break;
|
||||
case AURORA_DISPLAY_SCALE_CHANGED:
|
||||
dusk::ImGuiEngine_Initialize(event->windowSize.scale);
|
||||
break;
|
||||
@@ -242,6 +231,8 @@ void main01(void) {
|
||||
continue;
|
||||
}
|
||||
|
||||
mDoGph_gInf_c::updateRenderSize();
|
||||
|
||||
if (pacing.is_interpolating) {
|
||||
if (pacing.do_sim_tick) {
|
||||
dusk::frame_interp::set_ui_tick_pending(true);
|
||||
@@ -521,10 +512,11 @@ int game_main(int argc, char* argv[]) {
|
||||
.c_str());
|
||||
|
||||
if (dusk::getSettings().video.lockAspectRatio) {
|
||||
VILockAspectRatio(defaultAspectRatioW, defaultAspectRatioH);
|
||||
AuroraSetViewportPolicy(AURORA_VIEWPORT_FIT);
|
||||
} else {
|
||||
VIUnlockAspectRatio();
|
||||
AuroraSetViewportPolicy(AURORA_VIEWPORT_STRETCH);
|
||||
}
|
||||
VISetFrameBufferScale(dusk::getSettings().game.internalResolutionScale.getValue());
|
||||
|
||||
dusk::audio::SetMasterVolume(dusk::getSettings().audio.masterVolume / 100.0f);
|
||||
dusk::audio::SetEnableReverb(dusk::getSettings().audio.enableReverb);
|
||||
|
||||
Reference in New Issue
Block a user