mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-17 20:43:07 -04:00
Merge branch 'main' into 26-03-27-better-mapping
This commit is contained in:
+24
-10
@@ -850,7 +850,7 @@ daAlink_FaceTexData const daAlink_c::m_faceTexDataTable[] = {
|
||||
{dRes_ID_ALANM_BTP_FDAM01_e, dRes_ID_ALANM_BTK_FFINISHA_e},
|
||||
{dRes_ID_ALANM_BTP_FFINISHA_e, dRes_ID_ALANM_BTK_FFINISHED_e},
|
||||
{dRes_ID_ALANM_BTP_FARELORD_e, dRes_ID_ALANM_BTK_FARELORD_e},
|
||||
{dRes_ID_ALANM_BTP_FARELORDTAME_e, dRes_ID_ALANM_BTK_FARELORDTAME_e},
|
||||
{dRes_ID_ALANM_BTP_FARELORDTAME_e, dRes_ID_ALANM_BTK_FARELORDTAME_e},
|
||||
{dRes_ID_ALANM_BTP_FPUSHW_e, dRes_ID_ALANM_BTK_FPUSHW_e},
|
||||
{dRes_ID_ALANM_BTP_FPULLW_e, dRes_ID_ALANM_BTK_FPULLW_e},
|
||||
{dRes_ID_ALANM_BTP_FWAITST_e, dRes_ID_ALANM_BTK_FWAITST_e},
|
||||
@@ -1001,7 +1001,7 @@ daAlink_FaceTexData const daAlink_c::m_faceTexDataTable[] = {
|
||||
{dRes_ID_ALANM_BTP_WL_FSWIMDIEA_e, dRes_ID_ALANM_BTK_WL_FA_e},
|
||||
{dRes_ID_ALANM_BTP_WL_FSWIMDIEP_e, dRes_ID_ALANM_BTK_WL_FA_e},
|
||||
{dRes_ID_ALANM_BTP_WL_FMDSHOCK_e, dRes_ID_ALANM_BTK_WL_FMDSHOCK_e},
|
||||
{dRes_ID_ALANM_BTP_WL_FENTRANCE_e, dRes_ID_ALANM_BTK_WL_FENTRANCE_e},
|
||||
{dRes_ID_ALANM_BTP_WL_FENTRANCE_e, dRes_ID_ALANM_BTK_WL_FENTRANCE_e},
|
||||
{dRes_ID_ALANM_BTP_WL_FHOWLC_e, dRes_ID_ALANM_BTK_WL_FA_e},
|
||||
{dRes_ID_ALANM_BTP_WL_FC_e, dRes_ID_ALANM_BTK_WL_FA_e},
|
||||
};
|
||||
@@ -4943,7 +4943,7 @@ int daAlink_c::create() {
|
||||
if (dComIfG_resLoad(&mShieldPhaseReq, mShieldArcName, mpShieldArcHeap) != cPhs_COMPLEATE_e) {
|
||||
return cPhs_INIT_e;
|
||||
}
|
||||
|
||||
|
||||
u32 heapSize = 0x3E930;
|
||||
heapSize |= 0x80000000;
|
||||
heapSize |= 0x40000000;
|
||||
@@ -5885,7 +5885,7 @@ void daAlink_c::setItemMatrix(int param_0) {
|
||||
|| (mProcID == PROC_CUT_REVERSE && mProcVar2.field_0x300c != 0)
|
||||
|| mProcID == PROC_GUARD_BREAK
|
||||
|| (mEquipItem == 0x103 && !checkEndResetFlg1(ERFLG1_SHIELD_BACKBONE) && !checkModeFlg(0x400))
|
||||
)
|
||||
)
|
||||
{
|
||||
mShieldModel->setBaseTRMtx(mpLinkModel->getAnmMtx(mRightItemJntNo));
|
||||
|
||||
@@ -5949,9 +5949,23 @@ void daAlink_c::setItemMatrix(int param_0) {
|
||||
mpLinkBootModels[0]->setAnmMtx(3, mpLinkModel->getAnmMtx(0x15));
|
||||
|
||||
mDoMtx_stack_c::XrotS(-0x8000);
|
||||
mDoMtx_concat(mpLinkModel->getAnmMtx(0x18), mDoMtx_stack_c::get(), mpLinkBootModels[1]->getAnmMtx(1));
|
||||
mDoMtx_concat(mpLinkModel->getAnmMtx(0x19), mDoMtx_stack_c::get(), mpLinkBootModels[1]->getAnmMtx(2));
|
||||
mDoMtx_concat(mpLinkModel->getAnmMtx(0x1A), mDoMtx_stack_c::get(), mpLinkBootModels[1]->getAnmMtx(3));
|
||||
#ifdef TARGET_PC
|
||||
if (dusk::getSettings().game.enableFrameInterpolation) {
|
||||
Mtx boot_mtx;
|
||||
mDoMtx_concat(mpLinkModel->getAnmMtx(0x18), mDoMtx_stack_c::get(), boot_mtx);
|
||||
mpLinkBootModels[1]->setAnmMtx(1, boot_mtx);
|
||||
mDoMtx_concat(mpLinkModel->getAnmMtx(0x19), mDoMtx_stack_c::get(), boot_mtx);
|
||||
mpLinkBootModels[1]->setAnmMtx(2, boot_mtx);
|
||||
mDoMtx_concat(mpLinkModel->getAnmMtx(0x1A), mDoMtx_stack_c::get(), boot_mtx);
|
||||
mpLinkBootModels[1]->setAnmMtx(3, boot_mtx);
|
||||
} else {
|
||||
#endif
|
||||
mDoMtx_concat(mpLinkModel->getAnmMtx(0x18), mDoMtx_stack_c::get(), mpLinkBootModels[1]->getAnmMtx(1));
|
||||
mDoMtx_concat(mpLinkModel->getAnmMtx(0x19), mDoMtx_stack_c::get(), mpLinkBootModels[1]->getAnmMtx(2));
|
||||
mDoMtx_concat(mpLinkModel->getAnmMtx(0x1A), mDoMtx_stack_c::get(), mpLinkBootModels[1]->getAnmMtx(3));
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!checkNoResetFlg2(FLG2_STATUS_WINDOW_DRAW)) {
|
||||
@@ -6279,7 +6293,7 @@ void daAlink_c::setWolfAtCollision() {
|
||||
|
||||
void daAlink_c::resetAtCollision(BOOL param_0) {
|
||||
if (checkNoResetFlg0(FLG0_CUT_AT_FLG)) {
|
||||
if (param_0
|
||||
if (param_0
|
||||
&& !setSwordHitVibration(&mAtCps[0])
|
||||
&& !setSwordHitVibration(&mAtCps[1])
|
||||
&& !setSwordHitVibration(&mAtCps[2])
|
||||
@@ -14055,7 +14069,7 @@ void daAlink_c::setMetamorphoseModel(BOOL i_isChangeToWolf) {
|
||||
JKRHeap* heap = setItemHeap();
|
||||
|
||||
mHeldItemModel = initModel(loadAramBmd(dRes_ID_ALANM_BMD_AL_WF_e, 0x6000), 0);
|
||||
|
||||
|
||||
if (!mItemBck.init(bck, FALSE, 2, 1.0f, 0, -1, false)) {
|
||||
JUT_ASSERT(20842, FALSE);
|
||||
}
|
||||
@@ -16727,7 +16741,7 @@ int daAlink_c::procAutoJump() {
|
||||
#if VERSION == VERSION_SHIELD_DEBUG
|
||||
if (!checkStageName("F_SP115") && mGrabItemAcKeep.getActor() != NULL) {
|
||||
if ((fopAcM_GetName(mGrabItemAcKeep.getActor()) == fpcNm_NI_e && ((ni_class*)mGrabItemAcKeep.getActor())->checkGold() != TRUE) ||
|
||||
(fopAcM_GetName(mGrabItemAcKeep.getActor()) == fpcNm_NPC_TKJ2_e))
|
||||
(fopAcM_GetName(mGrabItemAcKeep.getActor()) == fpcNm_NPC_TKJ2_e))
|
||||
{
|
||||
mMaxSpeed = mpHIO->mAutoJump.m.mCuccoJumpMaxSpeed;
|
||||
field_0x3478 = mpHIO->mAutoJump.m.mCuccoFallMaxSpeed;
|
||||
|
||||
@@ -398,7 +398,7 @@ static int daE_TK2_Execute(e_tk2_class* i_this) {
|
||||
cXyz cStack_94;
|
||||
cXyz cStack_a0;
|
||||
|
||||
if (i_this->mExecuteState == 0x00) {
|
||||
if (i_this->mActionTimer[3] == 0x00) {
|
||||
dBgS_ObjGndChk_Spl ground_check;
|
||||
cStack_94 = actor->current.pos;
|
||||
cStack_94.y += 200.0f;
|
||||
@@ -602,7 +602,7 @@ static int daE_TK2_Create(fopAc_ac_c* actor) {
|
||||
i_this->mSound.init(&actor->current.pos, &actor->eyePos, 0x3, 0x1);
|
||||
i_this->mSound.setEnemyName("E_tk2");
|
||||
i_this->mAtInfo.mpSound = &i_this->mSound;
|
||||
i_this->mExecuteState = 0x14;
|
||||
i_this->mActionTimer[3] = 0x14;
|
||||
daE_TK2_Execute(i_this);
|
||||
}
|
||||
return phase;
|
||||
|
||||
@@ -167,6 +167,30 @@ static dCcD_SrcSph cc_vt_magic_src = {
|
||||
} // mSphAttr
|
||||
};
|
||||
|
||||
// !@bug The i<40 loops that index these arrays read one element past the end; on
|
||||
// GC/Wii the OOB reads land on adjacent rodata instead of a defined value.
|
||||
#if AVOID_UB
|
||||
static u8 va_tag_set_size[40] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
|
||||
0x02, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02,
|
||||
0x00,
|
||||
};
|
||||
|
||||
static u8 va_tag_set_num[40] = {
|
||||
0x01, 0x0C, 0x16, 0x1F, 0x21, 0x2A, 0x2B, 0x02, 0x04, 0x0D, 0x0F, 0x15, 0x18,
|
||||
0x20, 0x2C, 0x03, 0x05, 0x06, 0x0B, 0x10, 0x17, 0x19, 0x1A, 0x22, 0x24, 0x29,
|
||||
0x2D, 0x34, 0x49, 0x52, 0x36, 0x3E, 0x54, 0x5C, 0x39, 0x41, 0x4C, 0x56, 0x5E,
|
||||
0x00,
|
||||
};
|
||||
|
||||
static f32 va_tag_offset[40] = {
|
||||
20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 0.0f, 40.0f, 0.0f, 30.0f, 10.0f, 0.0f, 0.0f, 20.0f,
|
||||
0.0f, 10.0f, 20.0f, 40.0f, 0.0f, 20.0f, 0.0f, 0.0f, 20.0f, 0.0f, 10.0f, 0.0f, 0.0f,
|
||||
20.0f, 10.0f, 20.0f, 30.0f, 0.0f, 10.0f, 20.0f, 0.0f, 0.0f, 10.0f, 20.0f, 30.0f, 0.0f,
|
||||
0.0f,
|
||||
};
|
||||
#else
|
||||
static u8 va_tag_set_size[39] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
|
||||
@@ -184,6 +208,7 @@ static f32 va_tag_offset[39] = {
|
||||
0.0f, 10.0f, 20.0f, 40.0f, 0.0f, 20.0f, 0.0f, 0.0f, 20.0f, 0.0f, 10.0f, 0.0f, 0.0f,
|
||||
20.0f, 10.0f, 20.0f, 30.0f, 0.0f, 10.0f, 20.0f, 0.0f, 0.0f, 10.0f, 20.0f, 30.0f, 0.0f,
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "d/d_msg_object.h"
|
||||
#include "d/d_s_play.h"
|
||||
#include "d/d_debug_viewer.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
|
||||
static f32 dummy_lit_3777(int idx, u8 foo) {
|
||||
Vec dummy_vec = {0.0f, 0.0f, 0.0f};
|
||||
@@ -1052,6 +1053,12 @@ void daMidna_c::setBodyPartMatrix() {
|
||||
mpModel->setAnmMtx(i, mpShadowModel->getAnmMtx(i));
|
||||
}
|
||||
mpModel->calcWeightEnvelopeMtx();
|
||||
#ifdef TARGET_PC
|
||||
// Frame interpolation: Record weight envelopes for Midna here, as they are otherwise missed causing distortion
|
||||
for (u16 i = 0; i < mpModel->getModelData()->getWEvlpMtxNum(); i++) {
|
||||
dusk::frame_interp::record_final_mtx_raw(reinterpret_cast<const Mtx*>(mpModel->getWeightAnmMtx(i)), mpModel->getWeightAnmMtx(i));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
mDoMtx_stack_c::transS(mpShadowModel->getAnmMtx(JNT_BACKBONE1)[0][3],
|
||||
|
||||
@@ -411,7 +411,7 @@ void daObjTOMBO_c::BoomChk() {
|
||||
speedF = 5.0f;
|
||||
field_0x71c = 5.0f;
|
||||
mIsHitByBoomerang = false;
|
||||
field_0x718 = 100;
|
||||
field_0x714[2] = 100;
|
||||
mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Tombo", 6), 2, 5.0f, 1.0f,
|
||||
0.0f, -1.0f);
|
||||
home.pos = current.pos;
|
||||
@@ -422,7 +422,7 @@ void daObjTOMBO_c::BoomChk() {
|
||||
mIsHitByBoomerang = false;
|
||||
speedF = 5.0f;
|
||||
field_0x71c = 5.0f;
|
||||
field_0x718 = 100;
|
||||
field_0x714[2] = 100;
|
||||
mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Tombo", 6), 2, 5.0f, 1.0f,
|
||||
0.0f, -1.0f);
|
||||
current.pos.y = old.pos.y = playerPos.y + 100.0f;
|
||||
|
||||
@@ -122,7 +122,7 @@ static procFunc daTitleProc[6] = {
|
||||
|
||||
int daTitle_c::create() {
|
||||
fopAcM_ct(this, daTitle_c);
|
||||
|
||||
|
||||
int phase_state = dComIfG_resLoad(&mPhaseReq, l_arcName);
|
||||
if (phase_state != cPhs_COMPLEATE_e) {
|
||||
return phase_state;
|
||||
@@ -152,15 +152,21 @@ int daTitle_c::createHeapCallBack(fopAc_ac_c* actor) {
|
||||
}
|
||||
|
||||
int daTitle_c::Execute() {
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
mDoGph_gInf_c::resetDimming();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (fopOvlpM_IsPeek()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
dMenu_Collect3D_c::setViewPortOffsetY(0.0f);
|
||||
#ifdef TARGET_PC
|
||||
if (!dusk::getSettings().game.enableFrameInterpolation) {
|
||||
#endif
|
||||
dMenu_Collect3D_c::setViewPortOffsetY(0.0f);
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mDoRst::isReset()) {
|
||||
return 1;
|
||||
@@ -169,9 +175,9 @@ int daTitle_c::Execute() {
|
||||
(this->*daTitleProc[mProcID])();
|
||||
KeyWaitAnm();
|
||||
|
||||
#if VERSION == VERSION_SHIELD_DEBUG
|
||||
#if VERSION == VERSION_SHIELD_DEBUG
|
||||
KeyWaitPosMove();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -390,7 +396,7 @@ int daTitle_c::Delete() {
|
||||
dComIfG_resDelete(&mPhaseReq, l_arcName);
|
||||
JKR_DELETE(mTitle.Scr);
|
||||
JKR_DELETE(field_0x600);
|
||||
|
||||
|
||||
mpMount->getArchive()->removeResourceAll();
|
||||
JKRUnmountArchive(mpMount->getArchive());
|
||||
mpMount->destroy();
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "JSystem/J3DGraphBase/J3DDrawBuffer.h"
|
||||
#include "SSystem/SComponent/c_counter.h"
|
||||
|
||||
#include "dusk/frame_interpolation.h"
|
||||
|
||||
#if TARGET_PC
|
||||
const u16 l_J_Ohana00_64TEX__width = 64;
|
||||
const u16 l_J_Ohana00_64TEX__height = 64;
|
||||
@@ -695,7 +697,16 @@ void dFlower_packet_c::draw() {
|
||||
GXSetChanAmbColor(GX_COLOR0A0, sp64);
|
||||
|
||||
if (!cLib_checkBit<u8>(sp44->m_state, 4) && !cLib_checkBit<u8>(sp44->m_state, 0x40)) {
|
||||
GXLoadPosMtxImm(sp44->m_modelMtx, 0);
|
||||
#ifdef TARGET_PC
|
||||
Mtx flower_mtx;
|
||||
if (dusk::frame_interp::lookup_replacement(reinterpret_cast<const void*>(&sp44->m_modelMtx), flower_mtx)) {
|
||||
GXLoadPosMtxImm(flower_mtx, 0);
|
||||
} else {
|
||||
#endif
|
||||
GXLoadPosMtxImm(sp44->m_modelMtx, 0);
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
GXLoadNrmMtxImm(j3dSys.getViewMtx(), 0);
|
||||
|
||||
#if TARGET_PC
|
||||
@@ -841,7 +852,16 @@ void dFlower_packet_c::draw() {
|
||||
sp30++;
|
||||
|
||||
if (!cLib_checkBit<u8>(sp34->m_state, 4) && cLib_checkBit<u8>(sp34->m_state, 0x40)) {
|
||||
GXLoadPosMtxImm(sp34->m_modelMtx, 0);
|
||||
#ifdef TARGET_PC
|
||||
Mtx flower_mtx;
|
||||
if (dusk::frame_interp::lookup_replacement(reinterpret_cast<const void*>(&sp34->m_modelMtx), flower_mtx)) {
|
||||
GXLoadPosMtxImm(flower_mtx, 0);
|
||||
} else {
|
||||
#endif
|
||||
GXLoadPosMtxImm(sp34->m_modelMtx, 0);
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
GXLoadNrmMtxImm(j3dSys.getViewMtx(), 0);
|
||||
|
||||
#if TARGET_PC
|
||||
@@ -973,6 +993,9 @@ void dFlower_packet_c::update() {
|
||||
mDoMtx_stack_c::copy(temp_r28);
|
||||
mDoMtx_stack_c::scaleM(temp_f31, temp_f31, temp_f31);
|
||||
cMtx_concat(j3dSys.getViewMtx(), temp_r28, data_p->m_modelMtx);
|
||||
#ifdef TARGET_PC
|
||||
dusk::frame_interp::record_final_mtx_raw(reinterpret_cast<const Mtx*>(&data_p->m_modelMtx), data_p->m_modelMtx);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-1
@@ -11,6 +11,8 @@
|
||||
#include "d/d_camera.h"
|
||||
#include "f_op/f_op_camera_mng.h"
|
||||
|
||||
#include "dusk/frame_interpolation.h"
|
||||
|
||||
const u16 l_M_Hijiki00TEX__width = 31;
|
||||
const u16 l_M_Hijiki00TEX__height = 31;
|
||||
const u16 l_M_kusa05_RGBATEX__width = 31;
|
||||
@@ -751,7 +753,16 @@ void dGrass_packet_c::draw() {
|
||||
GXSetChanAmbColor(GX_COLOR0A0, sp38);
|
||||
|
||||
if (!cLib_checkBit<u8>(var_r29->field_0x01, 2)) {
|
||||
GXLoadPosMtxImm(var_r29->m_modelMtx, 0);
|
||||
#ifdef TARGET_PC
|
||||
Mtx grass_mtx;
|
||||
if (dusk::frame_interp::lookup_replacement(reinterpret_cast<const void*>(&var_r29->m_modelMtx), grass_mtx)) {
|
||||
GXLoadPosMtxImm(grass_mtx, 0);
|
||||
} else {
|
||||
#endif
|
||||
GXLoadPosMtxImm(var_r29->m_modelMtx, 0);
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
GXLoadNrmMtxImm(j3dSys.getViewMtx(), 0);
|
||||
if (var_r29->field_0x05 <= 3 || var_r29->field_0x05 >= 10) {
|
||||
if (var_r29->field_0x02 < -1) {
|
||||
@@ -1006,6 +1017,9 @@ void dGrass_packet_c::update() {
|
||||
mDoMtx_stack_c::scaleM(scale, scale, scale);
|
||||
cMtx_concat(j3dSys.getViewMtx(), mDoMtx_stack_c::get(), data_p->m_modelMtx);
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
dusk::frame_interp::record_final_mtx_raw(reinterpret_cast<const Mtx*>(&data_p->m_modelMtx), data_p->m_modelMtx);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
data_p++;
|
||||
|
||||
+8
-3
@@ -20,6 +20,7 @@
|
||||
#include "m_Do/m_Do_controller_pad.h"
|
||||
#include "m_Do/m_Do_graphic.h"
|
||||
#include "m_Do/m_Do_lib.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
@@ -11030,16 +11031,20 @@ static int camera_draw(camera_process_class* i_this) {
|
||||
|
||||
int trim_height = body->TrimHeight();
|
||||
|
||||
#if TARGET_PC
|
||||
#if TARGET_PC
|
||||
trim_height *= viewport->height / FB_HEIGHT;
|
||||
window->setScissor(0.0f, trim_height, viewport->width, viewport->height - trim_height * 2.0f);
|
||||
#else
|
||||
#else
|
||||
window->setScissor(0.0f, trim_height, FB_WIDTH, FB_HEIGHT - trim_height * 2.0f);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
C_MTXPerspective(process->view.projMtx, process->view.fovy, process->view.aspect, process->view.near_, process->view.far_);
|
||||
mDoMtx_lookAt(process->view.viewMtx, &process->view.lookat.eye, &process->view.lookat.center,
|
||||
&process->view.lookat.up, process->view.bank);
|
||||
#ifdef TARGET_PC
|
||||
dusk::frame_interp::record_final_mtx_raw(reinterpret_cast<const Mtx*>(process->view.viewMtx),
|
||||
process->view.viewMtx);
|
||||
#endif
|
||||
|
||||
#if WIDESCREEN_SUPPORT
|
||||
mDoGph_gInf_c::setWideZoomProjection(process->view.projMtx);
|
||||
|
||||
@@ -1018,7 +1018,7 @@ bool dComIfG_inf_c::baseCsr_c::navi_c::draw(f32 param_1, f32 param_2, u8 param_3
|
||||
f32 f27 = f31 - field_0x5c;
|
||||
field_0x58 = f29;
|
||||
field_0x5c = f31;
|
||||
cXyz spdc(param_1 - 304.0f, param_2 - 224.0f, 0.0f);
|
||||
cXyz spdc(param_1 - FB_WIDTH_BASE / 2, param_2 - FB_HEIGHT_BASE / 2, 0.0f);
|
||||
|
||||
f32 target = param_3 != 0 ? 1.5f : 0.0f;
|
||||
|
||||
|
||||
+49
-4
@@ -11,6 +11,7 @@
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "d/d_drawlist.h"
|
||||
#include "d/d_s_play.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include "dusk/gx_helper.h"
|
||||
#include "dusk/logging.h"
|
||||
#include "m_Do/m_Do_graphic.h"
|
||||
@@ -1089,7 +1090,16 @@ void dDlst_shadowReal_c::draw() {
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GXSetCurrentMtx(GX_PNMTX0);
|
||||
GXLoadTexMtxImm(mReceiverProjMtx, GX_TEXMTX0, GX_MTX3x4);
|
||||
#ifdef TARGET_PC
|
||||
Mtx receiver_proj_mtx;
|
||||
if (dusk::frame_interp::lookup_replacement(&mReceiverProjMtx, receiver_proj_mtx)) {
|
||||
GXLoadTexMtxImm(receiver_proj_mtx, GX_TEXMTX0, GX_MTX3x4);
|
||||
} else {
|
||||
#endif
|
||||
GXLoadTexMtxImm(mReceiverProjMtx, GX_TEXMTX0, GX_MTX3x4);
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
mShadowRealPoly.draw();
|
||||
}
|
||||
|
||||
@@ -1247,6 +1257,10 @@ u8 dDlst_shadowReal_c::setShadowRealMtx(cXyz* param_0, cXyz* param_1, f32 param_
|
||||
C_MTXOrtho(mRenderProjMtx, param_2, -param_2, -param_2, param_2, 1.0f, 10000.0f);
|
||||
C_MTXLightOrtho(mReceiverProjMtx, param_2, -param_2, -param_2, param_2, 0.5f, -0.5f, 0.5f, 0.5f);
|
||||
cMtx_concat(mReceiverProjMtx, mViewMtx, mReceiverProjMtx);
|
||||
#ifdef TARGET_PC
|
||||
dusk::frame_interp::record_final_mtx_raw(&mViewMtx, mViewMtx);
|
||||
dusk::frame_interp::record_final_mtx_raw(&mReceiverProjMtx, mReceiverProjMtx);
|
||||
#endif
|
||||
return r29;
|
||||
}
|
||||
|
||||
@@ -1309,13 +1323,31 @@ void dDlst_shadowSimple_c::draw() {
|
||||
GXSetTevColor(GX_TEVREG0, l_color);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_INDEX8);
|
||||
GXLoadPosMtxImm(mVolumeMtx, GX_PNMTX0);
|
||||
#ifdef TARGET_PC
|
||||
Mtx volume_mtx;
|
||||
if (dusk::frame_interp::lookup_replacement(&mVolumeMtx, volume_mtx)) {
|
||||
GXLoadPosMtxImm(volume_mtx, GX_PNMTX0);
|
||||
} else {
|
||||
#endif
|
||||
GXLoadPosMtxImm(mVolumeMtx, GX_PNMTX0);
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
GXSetCurrentMtx(GX_PNMTX0);
|
||||
GXCallDisplayList(l_frontMat, 0x40);
|
||||
GXCallDisplayList(l_shadowVolumeDL, 0x40);
|
||||
GXCallDisplayList(l_backSubMat, 0x20);
|
||||
GXCallDisplayList(l_shadowVolumeDL, 0x40);
|
||||
GXLoadPosMtxImm(mMtx, GX_PNMTX1);
|
||||
#ifdef TARGET_PC
|
||||
Mtx shadow_mtx;
|
||||
if (dusk::frame_interp::lookup_replacement(&mMtx, shadow_mtx)) {
|
||||
GXLoadPosMtxImm(shadow_mtx, GX_PNMTX1);
|
||||
} else {
|
||||
#endif
|
||||
GXLoadPosMtxImm(mMtx, GX_PNMTX1);
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
GXSetCurrentMtx(GX_PNMTX1);
|
||||
|
||||
if (mpTexObj != NULL) {
|
||||
@@ -1394,6 +1426,10 @@ void dDlst_shadowSimple_c::set(cXyz* param_0, f32 param_1, f32 param_2, cXyz* pa
|
||||
mDoMtx_stack_c::YrotM(param_4);
|
||||
mDoMtx_stack_c::scaleM(param_2, 1.0f, param_2 * param_5);
|
||||
cMtx_concat(j3dSys.getViewMtx(), mDoMtx_stack_c::get(), mMtx);
|
||||
#ifdef TARGET_PC
|
||||
dusk::frame_interp::record_final_mtx_raw(&mVolumeMtx, mVolumeMtx);
|
||||
dusk::frame_interp::record_final_mtx_raw(&mMtx, mMtx);
|
||||
#endif
|
||||
mpTexObj = param_6;
|
||||
}
|
||||
|
||||
@@ -1541,7 +1577,16 @@ void dDlst_shadowControl_c::draw(Mtx param_0) {
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX3x4, GX_TG_POS, GX_TEXMTX0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GXLoadPosMtxImm(param_0, GX_PNMTX0);
|
||||
#ifdef TARGET_PC
|
||||
Mtx draw_mtx;
|
||||
if (dusk::frame_interp::lookup_replacement(param_0, draw_mtx)) {
|
||||
GXLoadPosMtxImm(draw_mtx, GX_PNMTX0);
|
||||
} else {
|
||||
#endif
|
||||
GXLoadPosMtxImm(param_0, GX_PNMTX0);
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
GXColor matColor = {0, 0, 0, 0x20};
|
||||
GXSetChanMatColor(GX_ALPHA0, matColor);
|
||||
|
||||
|
||||
@@ -5585,7 +5585,7 @@ void dFile_select3D_c::toItem3Dpos(f32 param_0, f32 param_1, f32 param_2, cXyz*
|
||||
Mtx adStack_98;
|
||||
Mtx auStack_c8;
|
||||
param_0 = (2.0f * ((param_0 - mDoGph_gInf_c::getMinXF()) / mDoGph_gInf_c::getWidthF()) - 1.0f);
|
||||
param_1 = (2.0f * ((param_1 - -100.0f) / 448.0f) - 1.0f);
|
||||
param_1 = (2.0f * ((param_1 - -100.0f) / FB_HEIGHT_BASE) - 1.0f);
|
||||
calcViewMtx(adStack_98);
|
||||
cMtx_inverse(adStack_98, auStack_c8);
|
||||
f32 tangent = std::tan(M_PI / 8.0f);
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#include "d/d_jcam_editor.h"
|
||||
#include "m_Do/m_Do_graphic.h"
|
||||
#include "m_Do/m_Do_hostIO.h"
|
||||
#include "m_Do/m_Do_ext.h"
|
||||
|
||||
dJcame_c* dJcame_c::m_myObj;
|
||||
|
||||
dJcame_c::dJcame_c(const JStage::TSystem* i_system, f32 param_1, JUTGamePad& i_pad) {
|
||||
mOrthoGraph = JKR_NEW J2DOrthoGraph(0.0f, 0.0f, 608.0f, 448.0f, -1.0f, 1.0f);
|
||||
mOrthoGraph = JKR_NEW J2DOrthoGraph(0.0f, 0.0f, FB_WIDTH_BASE, FB_HEIGHT_BASE, -1.0f, 1.0f);
|
||||
mFont = JKR_NEW JUTResFont((ResFONT*)JUTResFONT_Ascfont_fix12, NULL);
|
||||
|
||||
mHeap = JKRExpHeap::create(0x100000, JKRHeap::getRootHeap2(), false);
|
||||
|
||||
+2
-2
@@ -10994,9 +10994,9 @@ void dKy_depth_dist_set(void* process_p) {
|
||||
|
||||
if ((sp30.x >= 0.0f && sp30.x < FB_WIDTH) && (sp30.y >= 0.0f &&
|
||||
#if DEBUG
|
||||
sp30.y < 608.0f
|
||||
sp30.y < FB_WIDTH_BASE
|
||||
#else
|
||||
sp30.y < 600.0f
|
||||
sp30.y < (FB_WIDTH_BASE - 8)
|
||||
#endif
|
||||
)) {
|
||||
cXyz sp18;
|
||||
|
||||
+52
-4
@@ -4086,6 +4086,8 @@ void dKyr_drawStar(Mtx drawMtx, u8** tex) {
|
||||
#endif
|
||||
|
||||
if (star_packet->mEffectNum != 0) {
|
||||
IF_DUSK(GXPushDebugGroup("dKyr_drawStar"));
|
||||
|
||||
if (strcmp(dComIfGp_getStartStageName(), "F_SP200") == 0 && dComIfG_play_c::getLayerNo(0) == 0) {
|
||||
gwolf_howl_stage = true;
|
||||
} else if (strcmp(dComIfGp_getStartStageName(), "F_SP127") == 0 ||
|
||||
@@ -4128,23 +4130,27 @@ void dKyr_drawStar(Mtx drawMtx, u8** tex) {
|
||||
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.
|
||||
GXSetNumChans(1);
|
||||
GXSetChanCtrl(GX_COLOR0, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_CLAMP, GX_AF_NONE);
|
||||
GXSetChanCtrl(GX_COLOR0, GX_DISABLE, GX_SRC_REG, DUSK_IF_ELSE(GX_SRC_VTX, GX_SRC_REG), GX_LIGHT_NULL, GX_DF_CLAMP, GX_AF_NONE);
|
||||
GXSetNumTexGens(0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetTevColor(GX_TEVREG0, color_reg0);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_C0);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, DUSK_IF_ELSE(GX_CC_RASC, GX_CC_C0));
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A0);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, DUSK_IF_ELSE(GX_CA_RASA, GX_CA_A0));
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
||||
GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_DISABLE);
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
|
||||
GXSetAlphaCompare(GX_GREATER, 0, GX_AOP_OR, GX_GREATER, 0);
|
||||
GXSetNumIndStages(0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0);
|
||||
IF_DUSK(GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0));
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
IF_DUSK(GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT));
|
||||
|
||||
Mtx rotMtx;
|
||||
MTXRotRad(rotMtx, 'Z', DEG_TO_RAD(rot));
|
||||
@@ -4204,6 +4210,15 @@ void dKyr_drawStar(Mtx drawMtx, u8** tex) {
|
||||
int sp44 = 0;
|
||||
f32 var_f28 = 0.0f;
|
||||
|
||||
#if TARGET_PC
|
||||
// Dusk optimization: we submit a single large draw call, rather than a thousand.
|
||||
u32 vertCount = 3 * star_packet->mEffectNum;
|
||||
if (draw_mirrored) {
|
||||
vertCount *= 2;
|
||||
}
|
||||
GXBegin(GX_TRIANGLES, GX_VTXFMT0, vertCount);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < star_packet->mEffectNum; i++) {
|
||||
f32 var_f31;
|
||||
cXyz star_pos;
|
||||
@@ -4254,7 +4269,7 @@ void dKyr_drawStar(Mtx drawMtx, u8** tex) {
|
||||
color_reg0.a = 70.0f + ((i & 63) * 2);
|
||||
}
|
||||
|
||||
GXSetTevColor(GX_TEVREG0, color_reg0);
|
||||
IF_NOT_DUSK(GXSetTevColor(GX_TEVREG0, color_reg0));
|
||||
|
||||
cXyz sp68;
|
||||
cXyz sp5C;
|
||||
@@ -4295,6 +4310,33 @@ void dKyr_drawStar(Mtx drawMtx, u8** tex) {
|
||||
}
|
||||
|
||||
// if a star is too close to the moon then avoid drawing
|
||||
#if TARGET_PC
|
||||
// Dusk optimization change: since we submit one large draw, we don't know the count of moon-hidden stars in advance.
|
||||
// So, just set those to have zero alpha.
|
||||
if (moon_dist_to_star <= moon_threshold) {
|
||||
color_reg0.a = 0;
|
||||
}
|
||||
|
||||
GXPosition3f32(sp68.x + (var_f31 * (pos[0].x - spBC.x)), sp68.y + (var_f31 * (pos[0].y - spBC.y)), sp68.z + (var_f31 * (pos[0].z - spBC.z)));
|
||||
GXColor4u8(color_reg0.r, color_reg0.g, color_reg0.b, color_reg0.a);
|
||||
GXPosition3f32(sp68.x + (var_f31 * (pos[1].x - spBC.x)), sp68.y + (var_f31 * (pos[1].y - spBC.y)), sp68.z + (var_f31 * (pos[1].z - spBC.z)));
|
||||
GXColor4u8(color_reg0.r, color_reg0.g, color_reg0.b, color_reg0.a);
|
||||
GXPosition3f32(sp68.x + (var_f31 * (pos[2].x - spBC.x)), sp68.y + (var_f31 * (pos[2].y - spBC.y)), sp68.z + (var_f31 * (pos[2].z - spBC.z)));
|
||||
GXColor4u8(color_reg0.r, color_reg0.g, color_reg0.b, color_reg0.a);
|
||||
|
||||
if (draw_mirrored) {
|
||||
sp5C.x = spBC.x + star_pos.x;
|
||||
sp5C.y = spBC.y - star_pos.y;
|
||||
sp5C.z = spBC.z + star_pos.z;
|
||||
|
||||
GXPosition3f32(sp5C.x + (var_f31 * (pos[0].x - spBC.x)), sp5C.y + (var_f31 * (pos[0].y - spBC.y)), sp5C.z + (var_f31 * (pos[0].z - spBC.z)));
|
||||
GXColor4u8(color_reg0.r, color_reg0.g, color_reg0.b, color_reg0.a);
|
||||
GXPosition3f32(sp5C.x + (var_f31 * (pos[1].x - spBC.x)), sp5C.y + (var_f31 * (pos[1].y - spBC.y)), sp5C.z + (var_f31 * (pos[1].z - spBC.z)));
|
||||
GXColor4u8(color_reg0.r, color_reg0.g, color_reg0.b, color_reg0.a);
|
||||
GXPosition3f32(sp5C.x + (var_f31 * (pos[2].x - spBC.x)), sp5C.y + (var_f31 * (pos[2].y - spBC.y)), sp5C.z + (var_f31 * (pos[2].z - spBC.z)));
|
||||
GXColor4u8(color_reg0.r, color_reg0.g, color_reg0.b, color_reg0.a);
|
||||
}
|
||||
#else
|
||||
if (moon_dist_to_star > moon_threshold) {
|
||||
GXBegin(GX_TRIANGLES, GX_VTXFMT0, 3);
|
||||
GXPosition3f32(sp68.x + (var_f31 * (pos[0].x - spBC.x)), sp68.y + (var_f31 * (pos[0].y - spBC.y)), sp68.z + (var_f31 * (pos[0].z - spBC.z)));
|
||||
@@ -4314,8 +4356,14 @@ void dKyr_drawStar(Mtx drawMtx, u8** tex) {
|
||||
GXEnd();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
GXEnd();
|
||||
GXPopDebugGroup();
|
||||
#endif
|
||||
|
||||
J3DShape::resetVcdVatCache();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2708,7 +2708,7 @@ void dMenu_Collect3D_c::toItem3Dpos(f32 param_0, f32 param_1, f32 param_2, cXyz*
|
||||
Mtx auStack_c8;
|
||||
param_0 =
|
||||
(2.0f * ((param_0 - mDoGph_gInf_c::getMinXF()) / mDoGph_gInf_c::getWidthF()) - 1.0f);
|
||||
param_1 = (2.0f * ((param_1 - -100.0f) / 448.0f) - 1.0f);
|
||||
param_1 = (2.0f * ((param_1 - -100.0f) / FB_HEIGHT_BASE) - 1.0f);
|
||||
calcViewMtx(adStack_98);
|
||||
MTXInverse(adStack_98, auStack_c8);
|
||||
f32 tangent = tan(0.39269909262657166);
|
||||
|
||||
+12
-12
@@ -229,17 +229,17 @@ dMenu_Fmap_c::dMenu_Fmap_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i
|
||||
}
|
||||
|
||||
if (i_panDirection == 1) {
|
||||
mTransX = -608.0f;
|
||||
mTransX = -FB_WIDTH_BASE;
|
||||
mTransY = 0.0f;
|
||||
} else if (i_panDirection == 3) {
|
||||
mTransX = 608.0f;
|
||||
mTransX = FB_WIDTH_BASE;
|
||||
mTransY = 0.0f;
|
||||
} else if (i_panDirection == 2) {
|
||||
mTransX = 0.0f;
|
||||
mTransY = -448.0f;
|
||||
mTransY = -FB_HEIGHT_BASE;
|
||||
} else if (i_panDirection == 0) {
|
||||
mTransX = 0.0f;
|
||||
mTransY = 448.0f;
|
||||
mTransY = FB_HEIGHT_BASE;
|
||||
} else {
|
||||
mTransX = 0.0f;
|
||||
mTransY = 0.0f;
|
||||
@@ -1705,17 +1705,17 @@ bool dMenu_Fmap_c::isOpen() {
|
||||
f32 ratio = (f32)mDisplayFrame / (f32)display_frame_num;
|
||||
|
||||
if (mPanDirection == 1) {
|
||||
mTransX = (1.0f - ratio) * -608.0f;
|
||||
mTransX = (1.0f - ratio) * -FB_WIDTH_BASE;
|
||||
mTransY = 0.0f;
|
||||
} else if (mPanDirection == 3) {
|
||||
mTransX = (1.0f - ratio) * 608.0f;
|
||||
mTransX = (1.0f - ratio) * FB_WIDTH_BASE;
|
||||
mTransY = 0.0f;
|
||||
} else if (mPanDirection == 2) {
|
||||
mTransX = 0.0f;
|
||||
mTransY = (1.0f - ratio) * -448.0f;
|
||||
mTransY = (1.0f - ratio) * -FB_HEIGHT_BASE;
|
||||
} else if (mPanDirection == 0) {
|
||||
mTransX = 0.0f;
|
||||
mTransY = (1.0f - ratio) * 448.0f;
|
||||
mTransY = (1.0f - ratio) * FB_HEIGHT_BASE;
|
||||
}
|
||||
|
||||
mAlphaRatio = ratio;
|
||||
@@ -1755,17 +1755,17 @@ bool dMenu_Fmap_c::isClose() {
|
||||
}
|
||||
|
||||
if (mPanDirection == 1) {
|
||||
mTransX = (1.0f - ratio) * 608.0f;
|
||||
mTransX = (1.0f - ratio) * FB_WIDTH_BASE;
|
||||
mTransY = 0.0f;
|
||||
} else if (mPanDirection == 3) {
|
||||
mTransX = (1.0f - ratio) * -608.0f;
|
||||
mTransX = (1.0f - ratio) * -FB_WIDTH_BASE;
|
||||
mTransY = 0.0f;
|
||||
} else if (mPanDirection == 2) {
|
||||
mTransX = 0.0f;
|
||||
mTransY = (1.0f - ratio) * 448.0f;
|
||||
mTransY = (1.0f - ratio) * FB_HEIGHT_BASE;
|
||||
} else if (mPanDirection == 0) {
|
||||
mTransX = 0.0f;
|
||||
mTransY = (1.0f - ratio) * -448.0f;
|
||||
mTransY = (1.0f - ratio) * -FB_HEIGHT_BASE;
|
||||
}
|
||||
|
||||
mAlphaRatio = ratio;
|
||||
|
||||
+10
-3
@@ -17,6 +17,7 @@
|
||||
#include "d/d_msg_scrn_explain.h"
|
||||
#include "m_Do/m_Do_graphic.h"
|
||||
#include "d/actor/d_a_midna.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include <cstring>
|
||||
|
||||
dMenu_Fmap2DBack_c::dMenu_Fmap2DBack_c() {
|
||||
@@ -390,11 +391,17 @@ void dMenu_Fmap2DBack_c::draw() {
|
||||
(mArrowPos3DZ + control_ypos + fVar3) - fVar5, &mArrowPos2DX,
|
||||
&mArrowPos2DY);
|
||||
|
||||
field_0x11e0 -= g_fmapHIO.mCursorSpeed;
|
||||
#ifdef TARGET_PC
|
||||
for (u32 i = 0; i < dusk::frame_interp::get_presentation_ui_advance_ticks(); ++i) {
|
||||
#endif
|
||||
field_0x11e0 -= g_fmapHIO.mCursorSpeed;
|
||||
|
||||
if (field_0x11e0 < 0.0f) {
|
||||
field_0x11e0 += 360.0f;
|
||||
if (field_0x11e0 < 0.0f) {
|
||||
field_0x11e0 += 360.0f;
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
|
||||
mpPointParent->getPanePtr()->rotate(mpPointParent->getSizeX() / 2.0f,
|
||||
mpPointParent->getSizeY() / 2.0f, ROTATE_Z,
|
||||
|
||||
@@ -183,6 +183,9 @@ void dMenu_Insect_c::_draw() {
|
||||
|
||||
mpExpScreen->draw(0.0f, 0.0f, grafPort);
|
||||
mpSelect_c->setOffsetX(g_drawHIO.mInsectListScreen.mConfirmOptionPosX_4x3);
|
||||
// the magic numbers here are correlated with the framebuffer size, but
|
||||
// were likely either chosen by hand or had multiple arithmetic
|
||||
// operations applied which cannot easily be reverse engineered
|
||||
mpSelect_c->translate(g_drawHIO.mInsectListScreen.mConfirmOptionPosX_4x3 + 486.0f,
|
||||
g_drawHIO.mInsectListScreen.mConfirmOptionPosY_4x3 + 209.0f);
|
||||
mpSelect_c->draw(0.0f, 0.0f);
|
||||
|
||||
@@ -330,6 +330,9 @@ void dMenu_ItemExplain_c::draw(J2DOrthoGraph* i_graph) {
|
||||
mpInfoString->drawOutFontLocal((J2DTextBox*)mpInfoText->getPanePtr(), -1.0f);
|
||||
drawKantera();
|
||||
if (mpSelect_c != NULL) {
|
||||
// the magic numbers here are correlated with the framebuffer size, but
|
||||
// were likely either chosen by hand or had multiple arithmetic
|
||||
// operations applied which cannot easily be reverse engineered
|
||||
mpSelect_c->translate(486.0f, 209.0f);
|
||||
mpSelect_c->draw(0.0f, 0.0f);
|
||||
}
|
||||
|
||||
+18
-18
@@ -87,16 +87,16 @@ dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i
|
||||
mPikariFlashingSpeed = 0.0f;
|
||||
if (mRingOrigin == 0) {
|
||||
mCenterPosX = 0.0f;
|
||||
mCenterPosY = 448.0f;
|
||||
mCenterPosY = FB_HEIGHT_BASE;
|
||||
} else if (mRingOrigin == 2) {
|
||||
mCenterPosX = 0.0f;
|
||||
mCenterPosY = -448.0f;
|
||||
mCenterPosY = -FB_HEIGHT_BASE;
|
||||
}
|
||||
if (mRingOrigin == 3) {
|
||||
mCenterPosX = 608.0f;
|
||||
mCenterPosX = FB_WIDTH_BASE;
|
||||
mCenterPosY = 0.0f;
|
||||
} else if (mRingOrigin == 1) {
|
||||
mCenterPosX = -608.0f;
|
||||
mCenterPosX = -FB_WIDTH_BASE;
|
||||
mCenterPosY = 0.0f;
|
||||
} else {
|
||||
mCenterPosX = 0.0f;
|
||||
@@ -644,15 +644,15 @@ bool dMenu_Ring_c::isOpen() {
|
||||
mAlphaRate = (f32)mOpenCloseFrames / (f32)g_ringHIO.mOpenFrames;
|
||||
if (mRingOrigin == 0) {
|
||||
mCenterPosX = 0.0f;
|
||||
mCenterPosY = (1.0f - mAlphaRate) * 448.0f;
|
||||
mCenterPosY = (1.0f - mAlphaRate) * FB_HEIGHT_BASE;
|
||||
} else if (mRingOrigin == 2) {
|
||||
mCenterPosX = 0.0f;
|
||||
mCenterPosY = (1.0f - mAlphaRate) * -448.0f;
|
||||
mCenterPosY = (1.0f - mAlphaRate) * -FB_HEIGHT_BASE;
|
||||
} else if (mRingOrigin == 3) {
|
||||
mCenterPosX = (1.0f - mAlphaRate) * 608.0f;
|
||||
mCenterPosX = (1.0f - mAlphaRate) * FB_WIDTH_BASE;
|
||||
mCenterPosY = 0.0f;
|
||||
} else if (mRingOrigin == 1) {
|
||||
mCenterPosX = (1.0f - mAlphaRate) * -608.0f;
|
||||
mCenterPosX = (1.0f - mAlphaRate) * -FB_WIDTH_BASE;
|
||||
mCenterPosY = 0.0f;
|
||||
}
|
||||
if (mOpenCloseFrames >= g_ringHIO.mOpenFrames) {
|
||||
@@ -715,15 +715,15 @@ bool dMenu_Ring_c::isClose() {
|
||||
}
|
||||
if (mRingOrigin == 0) {
|
||||
mCenterPosX = 0.0f;
|
||||
mCenterPosY = (1.0f - mAlphaRate) * -448.0f;
|
||||
mCenterPosY = (1.0f - mAlphaRate) * -FB_HEIGHT_BASE;
|
||||
} else if (mRingOrigin == 2) {
|
||||
mCenterPosX = 0.0f;
|
||||
mCenterPosY = (1.0f - mAlphaRate) * 448.0f;
|
||||
mCenterPosY = (1.0f - mAlphaRate) * FB_HEIGHT_BASE;
|
||||
} else if (mRingOrigin == 3) {
|
||||
mCenterPosX = (1.0f - mAlphaRate) * -608.0f;
|
||||
mCenterPosX = (1.0f - mAlphaRate) * -FB_WIDTH_BASE;
|
||||
mCenterPosY = 0.0f;
|
||||
} else if (mRingOrigin == 1) {
|
||||
mCenterPosX = (1.0f - mAlphaRate) * 608.0f;
|
||||
mCenterPosX = (1.0f - mAlphaRate) * FB_WIDTH_BASE;
|
||||
mCenterPosY = 0.0f;
|
||||
}
|
||||
mpDrawCursor->setPos(mItemSlotPosX[mCurrentSlot] + mCenterPosX,
|
||||
@@ -855,11 +855,11 @@ s16 dMenu_Ring_c::calcStickAngle(STControl* i_stick, u8 param_1) {
|
||||
}
|
||||
|
||||
void dMenu_Ring_c::setRotate() {
|
||||
clacEllipsePlotAverage(mItemsTotal, g_ringHIO.mItemRingPosX + 304.0f,
|
||||
g_ringHIO.mItemRingPosY + 224.0f);
|
||||
clacEllipsePlotAverage(mItemsTotal, g_ringHIO.mItemRingPosX + FB_WIDTH_BASE / 2,
|
||||
g_ringHIO.mItemRingPosY + FB_HEIGHT_BASE / 2);
|
||||
for (int i = 0; i < mItemsTotal; i++) {
|
||||
field_0x63e[i] = cM_atan2s(mItemSlotPosX[i] - (304.0f + g_ringHIO.mItemRingPosX),
|
||||
mItemSlotPosY[i] - (224.0f + g_ringHIO.mItemRingPosY));
|
||||
field_0x63e[i] = cM_atan2s(mItemSlotPosX[i] - (FB_WIDTH_BASE / 2 + g_ringHIO.mItemRingPosX),
|
||||
mItemSlotPosY[i] - (FB_HEIGHT_BASE / 2 + g_ringHIO.mItemRingPosY));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1446,9 +1446,9 @@ void dMenu_Ring_c::stick_move_proc() {
|
||||
setStatus(field_0x6b2);
|
||||
} else {
|
||||
f32 itemRingPosX =
|
||||
g_ringHIO.mItemRingPosX + 304.0f + mRingRadiusH * cM_ssin(field_0x66e);
|
||||
g_ringHIO.mItemRingPosX + FB_WIDTH_BASE / 2 + mRingRadiusH * cM_ssin(field_0x66e);
|
||||
f32 itemRingPosY =
|
||||
g_ringHIO.mItemRingPosY + 224.0f + mRingRadiusV * cM_scos(field_0x66e);
|
||||
g_ringHIO.mItemRingPosY + FB_HEIGHT_BASE / 2 + mRingRadiusV * cM_scos(field_0x66e);
|
||||
mpDrawCursor->setPos(itemRingPosX, itemRingPosY);
|
||||
}
|
||||
}
|
||||
|
||||
+53
-34
@@ -20,6 +20,7 @@
|
||||
#include "d/d_msg_class.h"
|
||||
#include "d/d_msg_object.h"
|
||||
#include "d/d_pane_class.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include <cstring>
|
||||
|
||||
dMeter2Draw_c::dMeter2Draw_c(JKRExpHeap* mp_heap) {
|
||||
@@ -636,38 +637,49 @@ void dMeter2Draw_c::draw() {
|
||||
if (field_0x756 >= 0) {
|
||||
var_f29 = g_drawHIO.mLightDrop.mDropPikariAnimSpeed_Completed;
|
||||
int temp_r5_2 = g_drawHIO.mLightDrop.mPikariInterval * 15;
|
||||
#ifdef TARGET_PC
|
||||
// Set even if not advancing
|
||||
var_f28 = g_drawHIO.mLightDrop.mPikariScaleComplete;
|
||||
|
||||
if (field_0x756 <= temp_r5_2) {
|
||||
int temp_r4 = (field_0x756 % g_drawHIO.mLightDrop.mPikariInterval);
|
||||
int temp_r3_5 = field_0x756 / g_drawHIO.mLightDrop.mPikariInterval;
|
||||
const u32 ui_advance_ticks = dusk::frame_interp::get_presentation_ui_advance_ticks();
|
||||
for (u32 tick = 0; tick < ui_advance_ticks; ++tick) {
|
||||
#endif
|
||||
if (field_0x756 <= temp_r5_2) {
|
||||
int temp_r4 = (field_0x756 % g_drawHIO.mLightDrop.mPikariInterval);
|
||||
int temp_r3_5 = field_0x756 / g_drawHIO.mLightDrop.mPikariInterval;
|
||||
|
||||
if (temp_r4 == 0 && field_0x62c[temp_r3_5] == 0.0f) {
|
||||
field_0x62c[temp_r3_5] = 18.0f;
|
||||
}
|
||||
|
||||
var_f28 = g_drawHIO.mLightDrop.mPikariScaleComplete;
|
||||
field_0x756++;
|
||||
} else {
|
||||
int temp_r5_3 = temp_r5_2 + 1;
|
||||
|
||||
if (field_0x756 == temp_r5_3) {
|
||||
if (field_0x62c[15] == 0.0f) {
|
||||
field_0x756++;
|
||||
if (temp_r4 == 0 && field_0x62c[temp_r3_5] == 0.0f) {
|
||||
field_0x62c[temp_r3_5] = 18.0f;
|
||||
}
|
||||
|
||||
var_f28 = g_drawHIO.mLightDrop.mPikariScaleComplete;
|
||||
} else if (field_0x756 >= g_drawHIO.mLightDrop.field_0x54 + temp_r5_3) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
field_0x62c[i] = 18.0f - var_f29;
|
||||
field_0x66c[i] = 18.0f - g_drawHIO.mLightDrop.mPikariLoopAnimSpeed;
|
||||
}
|
||||
|
||||
field_0x756 = -1;
|
||||
} else {
|
||||
field_0x756++;
|
||||
} else {
|
||||
int temp_r5_3 = temp_r5_2 + 1;
|
||||
|
||||
if (field_0x756 == temp_r5_3) {
|
||||
if (field_0x62c[15] == 0.0f) {
|
||||
field_0x756++;
|
||||
}
|
||||
var_f28 = g_drawHIO.mLightDrop.mPikariScaleComplete;
|
||||
} else if (field_0x756 >= g_drawHIO.mLightDrop.field_0x54 + temp_r5_3) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
field_0x62c[i] = 18.0f - var_f29;
|
||||
field_0x66c[i] = 18.0f - g_drawHIO.mLightDrop.mPikariLoopAnimSpeed;
|
||||
}
|
||||
|
||||
field_0x756 = -1;
|
||||
#ifdef TARGET_PC
|
||||
break;
|
||||
#endif
|
||||
} else {
|
||||
field_0x756++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if (field_0x66c[i] > 0.0f) {
|
||||
@@ -1336,20 +1348,27 @@ void dMeter2Draw_c::drawPikari(f32 i_posX, f32 i_posY, f32* i_framep, f32 i_scal
|
||||
if (param_9 != 3 && param_9 != 4 && param_9 != 5 && dMsgObject_isTalkNowCheck()) {
|
||||
*i_framep = 0.0f;
|
||||
} else {
|
||||
*i_framep += param_8;
|
||||
if (*i_framep > var_f31) {
|
||||
if (param_9 == 1 || param_9 == 2 || param_9 == 3) {
|
||||
*i_framep = 18.0f;
|
||||
} else {
|
||||
*i_framep = 0.0f;
|
||||
#ifdef TARGET_PC
|
||||
const u32 ui_advance_ticks = dusk::frame_interp::get_presentation_ui_advance_ticks();
|
||||
for (u32 i = 0; i < ui_advance_ticks; ++i) {
|
||||
#endif
|
||||
*i_framep += param_8;
|
||||
if (*i_framep > var_f31) {
|
||||
if (param_9 == 1 || param_9 == 2 || param_9 == 3) {
|
||||
*i_framep = 18.0f;
|
||||
} else {
|
||||
*i_framep = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (*i_framep == 18.0f && param_9 == 1) {
|
||||
mDoAud_seStart(Z2SE_NAVI_BLINK, NULL, 0, 0);
|
||||
} else if (*i_framep == 18.0f && param_9 == 2) {
|
||||
mDoAud_seStart(Z2SE_SY_ITEM_COMBINE_ICON, NULL, 0, 0);
|
||||
if (*i_framep == 18.0f && param_9 == 1) {
|
||||
mDoAud_seStart(Z2SE_NAVI_BLINK, NULL, 0, 0);
|
||||
} else if (*i_framep == 18.0f && param_9 == 2) {
|
||||
mDoAud_seStart(Z2SE_SY_ITEM_COMBINE_ICON, NULL, 0, 0);
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
|
||||
playPikariBckAnimation(*i_framep);
|
||||
playPikariBpkAnimation(*i_framep);
|
||||
|
||||
@@ -205,11 +205,11 @@ void dMeter2Info_c::init() {
|
||||
unk_0x5c = 0.0f;
|
||||
unk_0x60 = 1.0f;
|
||||
unk_0x64 = 30.0f;
|
||||
unk_0x68 = 304.0f;
|
||||
unk_0x6c = 224.0f;
|
||||
unk_0x68 = FB_WIDTH_BASE / 2;
|
||||
unk_0x6c = FB_HEIGHT_BASE / 2;
|
||||
|
||||
m2DWidth = 608.0f;
|
||||
m2DHeight = 448.0f;
|
||||
m2DWidth = FB_WIDTH_BASE;
|
||||
m2DHeight = FB_HEIGHT_BASE;
|
||||
m2DPosH = 0.0f;
|
||||
m2DPosV = 0.0f;
|
||||
unk_0x80 = 0.0f;
|
||||
|
||||
@@ -197,11 +197,11 @@ void dMeter_drawOptionHIO_c::genMessage(JORMContext* mctx) {
|
||||
mctx->genSlider("位置X", &mOptionTypeBGPosX[3], -300.0f, 300.0f);
|
||||
mctx->genSlider("位置Y", &mOptionTypeBGPosY[3], -300.0f, 300.0f);
|
||||
mctx->genLabel("*****テレビ画面の設定*****", 0);
|
||||
mctx->genSlider("位置X", &mTVsettingPosX, -300.0f, 300.0f);
|
||||
mctx->genSlider("位置Y", &mTVsettingPosY, -300.0f, 300.0f);
|
||||
mctx->genSlider("位置X", &mOptionTypeBGPosX[4], -300.0f, 300.0f);
|
||||
mctx->genSlider("位置Y", &mOptionTypeBGPosY[4], -300.0f, 300.0f);
|
||||
mctx->genLabel("*****キャリブレーション*****", 0);
|
||||
mctx->genSlider("位置X", &mPointerCalibrationPosX, -300.0f, 300.0f);
|
||||
mctx->genSlider("位置Y", &mPointerCalibrationPosY, -300.0f, 300.0f);
|
||||
mctx->genSlider("位置X", &mOptionTypeBGPosX[5], -300.0f, 300.0f);
|
||||
mctx->genSlider("位置Y", &mOptionTypeBGPosY[5], -300.0f, 300.0f);
|
||||
mctx->genLabel("*****設定確認*****", 0);
|
||||
mctx->genSlider("背景アルファ", &mBackgroundAlpha, 0, 255);
|
||||
mctx->genSlider("位置Y", &mBackgroundPosY, -300.0f, 300.0f);
|
||||
@@ -1493,7 +1493,7 @@ dMeter_drawLightDropHIO_c::dMeter_drawLightDropHIO_c() {
|
||||
mPikariInterval = 1;
|
||||
field_0x54 = 0xFFF1;
|
||||
mVesselAlpha[2] = 0.5f;
|
||||
mDropAlpha = 1.0f;
|
||||
mVesselAlpha[3] = 1.0f;
|
||||
|
||||
mDropOnColorBlack.set(30, 255, 255, 0);
|
||||
mDropOnColorWhite.set(255, 255, 255, 255);
|
||||
@@ -1554,7 +1554,7 @@ void dMeter_drawLightDropHIO_c::genMessage(JORMContext* mctx) {
|
||||
mctx->genSlider("位置調整Y(会話)", &mVesselTalkPosY, -300.0f, 300.0f);
|
||||
mctx->genSlider("アルファ(会話)", &mVesselAlpha[1], 0.0f, 1.0f);
|
||||
mctx->genSlider("アルファ(器)", &mVesselAlpha[2], 0.0f, 1.0f);
|
||||
mctx->genSlider("アルファ(雫)", &mDropAlpha, 0.0f, 1.0f);
|
||||
mctx->genSlider("アルファ(雫)", &mVesselAlpha[3], 0.0f, 1.0f);
|
||||
mctx->genLabel("***光の器ゲット後***", 0);
|
||||
mctx->genSlider("拡大縮小", &mDropGetScale, 0.0f, 3.0f);
|
||||
mctx->genSlider("拡縮アニメフレーム数", &mDropGetScaleAnimFrameNum, 0, 30);
|
||||
@@ -4010,9 +4010,9 @@ void dMeter_fmapHIO_c::genMessage(JORMContext* mctx) {
|
||||
mctx->genSlider("リージョン拡大表示範囲", &mRegionZoomRange, 1000.0, 1000000.0);
|
||||
mctx->genCheckBox("表示基準領域枠表示", (u8*)&mDisplayReferenceArea, 0x1);
|
||||
mctx->genCheckBox("スクロール範囲を表示基準", (u8*)&field_0x308, 0x1);
|
||||
mctx->genSlider("左上座標X", &mMapTopLeftPosX, 0.0, 608.0);
|
||||
mctx->genSlider("左上座標Y", &mMapTopLeftPosY, 0.0, 448.0);
|
||||
mctx->genSlider("領域幅", &mMapScale, 0.0, 608.0);
|
||||
mctx->genSlider("左上座標X", &mMapTopLeftPosX, 0.0, FB_WIDTH_BASE);
|
||||
mctx->genSlider("左上座標Y", &mMapTopLeftPosY, 0.0, FB_HEIGHT_BASE);
|
||||
mctx->genSlider("領域幅", &mMapScale, 0.0, FB_WIDTH_BASE);
|
||||
mctx->genLabel("\n*** スクロール速度境界 ***", 0);
|
||||
mctx->genSlider("0~遅", &mScrollSpeedSlowBound, 0.0, 1.0);
|
||||
mctx->genSlider("遅~速", &mScrollSpeedFastBound, 0.0, 1.0);
|
||||
|
||||
@@ -1035,7 +1035,7 @@ void dMeterButton_c::screenInitButton() {
|
||||
}
|
||||
|
||||
field_0x4b0 = 0;
|
||||
mParentCenterX = (608.0f / 2) - mpParent->getInitCenterPosX();
|
||||
mParentCenterX = (FB_WIDTH_BASE / 2.0f) - mpParent->getInitCenterPosX();
|
||||
paneTrans(mpParent, mParentCenterX, 0.0f, 0xFF);
|
||||
|
||||
mpButtonA = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('abtn_n'), 2, NULL);
|
||||
|
||||
@@ -99,28 +99,28 @@ void dMeterHaihai_c::draw() {
|
||||
}
|
||||
|
||||
if (direction & DIR_DOWN_e || i_forceDraw) {
|
||||
mpParent->getPanePtr()->translate(x_pos[0] + 304.0f, y_pos[0] + 224.0f);
|
||||
mpParent->getPanePtr()->translate(x_pos[0] + FB_WIDTH_BASE / 2, y_pos[0] + FB_HEIGHT_BASE / 2);
|
||||
mpParent->getPanePtr()->rotate(mpParent->getPanePtr()->getWidth() / 2,
|
||||
mpParent->getPanePtr()->getHeight() / 2, ROTATE_Z, 0.0f);
|
||||
mpHaihaiScreen->draw(0.0f, 0.0f, dComIfGp_getCurrentGrafPort());
|
||||
}
|
||||
|
||||
if (direction & DIR_RIGHT_e || i_forceDraw) {
|
||||
mpParent->getPanePtr()->translate(x_pos[1] + 304.0f, y_pos[1] + 224.0f);
|
||||
mpParent->getPanePtr()->translate(x_pos[1] + FB_WIDTH_BASE / 2, y_pos[1] + FB_HEIGHT_BASE / 2);
|
||||
mpParent->getPanePtr()->rotate(mpParent->getPanePtr()->getWidth() / 2,
|
||||
mpParent->getPanePtr()->getHeight() / 2, ROTATE_Z, 90.0f);
|
||||
mpHaihaiScreen->draw(0.0f, 0.0f, dComIfGp_getCurrentGrafPort());
|
||||
}
|
||||
|
||||
if (direction & DIR_UP_e || i_forceDraw) {
|
||||
mpParent->getPanePtr()->translate(x_pos[0] + 304.0f, 224.0f - y_pos[0]);
|
||||
mpParent->getPanePtr()->translate(x_pos[0] + FB_WIDTH_BASE / 2, FB_HEIGHT_BASE / 2 - y_pos[0]);
|
||||
mpParent->getPanePtr()->rotate(mpParent->getPanePtr()->getWidth() / 2,
|
||||
mpParent->getPanePtr()->getHeight() / 2, ROTATE_Z, 180.0f);
|
||||
mpHaihaiScreen->draw(0.0f, 0.0f, dComIfGp_getCurrentGrafPort());
|
||||
}
|
||||
|
||||
if (direction & DIR_LEFT_e || i_forceDraw) {
|
||||
mpParent->getPanePtr()->translate(304.0f - x_pos[1], y_pos[1] + 224.0f);
|
||||
mpParent->getPanePtr()->translate(FB_WIDTH_BASE / 2 - x_pos[1], y_pos[1] + FB_HEIGHT_BASE / 2);
|
||||
mpParent->getPanePtr()->rotate(mpParent->getPanePtr()->getWidth() / 2,
|
||||
mpParent->getPanePtr()->getHeight() / 2, ROTATE_Z, 270.0f);
|
||||
mpHaihaiScreen->draw(0.0f, 0.0f, dComIfGp_getCurrentGrafPort());
|
||||
@@ -128,8 +128,8 @@ void dMeterHaihai_c::draw() {
|
||||
}
|
||||
|
||||
void dMeterHaihai_c::drawHaihai(u8 i_direction) {
|
||||
f32 center_x = 304.0f;
|
||||
f32 center_y = 224.0f;
|
||||
f32 center_x = FB_WIDTH_BASE / 2;
|
||||
f32 center_y = FB_HEIGHT_BASE / 2;
|
||||
|
||||
if (mType == 1) {
|
||||
center_x += (3.0f + g_drawHIO.mScrollArrowCenterPosX);
|
||||
|
||||
@@ -2234,7 +2234,13 @@ int dMsgFlow_c::event027(mesg_flow_node_event* i_flowNode_p, fopAc_ac_c* i_speak
|
||||
u16 prm0;
|
||||
getParam(&prm0, &prm1, i_flowNode_p->params);
|
||||
|
||||
// !@bug aParam8 is undersized; getParam always writes 4 bytes, stomping the
|
||||
// 2 bytes past the buffer. Harmless on GC/Wii (MWCC stack layout absorbs it).
|
||||
#if AVOID_UB
|
||||
u8 aParam8[4];
|
||||
#else
|
||||
u8 aParam8[2];
|
||||
#endif
|
||||
getParam(aParam8, i_flowNode_p->params);
|
||||
|
||||
JUT_ASSERT(4509, (aParam8[0] >= 0 && aParam8[0] <= dSv_player_item_c::BOMB_BAG_MAX) || (aParam8[0] == 4));
|
||||
|
||||
@@ -70,7 +70,7 @@ dMsgScrnExplain_c::dMsgScrnExplain_c(STControl* i_stick, u8 param_1, bool i_isUs
|
||||
|
||||
mpTxScreen = JKR_NEW J2DScreen();
|
||||
JUT_ASSERT(102, mpTxScreen != NULL);
|
||||
field_0x48 = 608.0f;
|
||||
field_0x48 = FB_WIDTH_BASE;
|
||||
|
||||
if (param_1 == 1 || param_1 == 3) {
|
||||
#if PLATFORM_GCN
|
||||
@@ -309,7 +309,7 @@ void dMsgScrnExplain_c::draw(J2DOrthoGraph* i_graf) {
|
||||
}
|
||||
|
||||
if (mpBackTex != NULL) {
|
||||
mpBackTex->draw(0.0f, 0.0f, 608.0f, 448.0f, false, false, false);
|
||||
mpBackTex->draw(0.0f, 0.0f, FB_WIDTH_BASE, FB_HEIGHT_BASE, false, false, false);
|
||||
}
|
||||
|
||||
if (field_0x66 != 2 && field_0x66 != 3) {
|
||||
@@ -330,6 +330,9 @@ void dMsgScrnExplain_c::draw(J2DOrthoGraph* i_graf) {
|
||||
strcpy(((J2DTextBox*)mpTm_c[0]->getPanePtr())->getStringPtr(), string_buf);
|
||||
|
||||
if (mpSelect_c != NULL && (field_0x64 == 1 || field_0x64 == 2)) {
|
||||
// the magic numbers here are relative to the framebuffer size, but were likely
|
||||
// either chosen by hand or had multiple arithmetic operations applied which
|
||||
// cannot easily be reverse engineered
|
||||
f32 y_offset = 0.0f;
|
||||
if (field_0x66 == 2) {
|
||||
y_offset = -100.0f;
|
||||
@@ -385,7 +388,7 @@ void dMsgScrnExplain_c::open_request_proc() {
|
||||
|
||||
void dMsgScrnExplain_c::open_init() {
|
||||
field_0x5a = 0;
|
||||
field_0x48 = 608.0f;
|
||||
field_0x48 = FB_WIDTH_BASE;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpRoot_c[i]->setAlphaRate(0.0f);
|
||||
}
|
||||
@@ -403,7 +406,7 @@ void dMsgScrnExplain_c::open_proc() {
|
||||
}
|
||||
}
|
||||
|
||||
field_0x48 = 608.0f * getAlphaRatio();
|
||||
field_0x48 = FB_WIDTH_BASE * getAlphaRatio();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpRoot_c[i]->setAlphaRate(1.0f - getAlphaRatio());
|
||||
}
|
||||
@@ -583,7 +586,7 @@ void dMsgScrnExplain_c::close_proc() {
|
||||
}
|
||||
}
|
||||
|
||||
field_0x48 = 608.0f * getAlphaRatio();
|
||||
field_0x48 = FB_WIDTH_BASE * getAlphaRatio();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpRoot_c[i]->setAlphaRate(1.0f - getAlphaRatio());
|
||||
}
|
||||
|
||||
@@ -609,6 +609,9 @@ void dMsgScrnItem_c::fukiPosCalc(u8 param_1) {
|
||||
field_0x180 = 0.0f;
|
||||
field_0x19c = param_1;
|
||||
f32 yOffset;
|
||||
// the magic numbers here are correlated with the framebuffer size, but
|
||||
// were likely either chosen by hand or had multiple arithmetic
|
||||
// operations applied which cannot easily be reverse engineered
|
||||
switch(field_0x19c) {
|
||||
case 1:
|
||||
yOffset = g_MsgObject_HIO_c.mBoxPos[2][3];
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "JSystem/J2DGraph/J2DScreen.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "d/d_pane_class.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
|
||||
class dMsgScrnLight_HIO_c {
|
||||
public:
|
||||
@@ -202,10 +203,17 @@ void dMsgScrnLight_c::draw(f32* i_anmFrame, f32 i_posX, f32 i_posY, f32 i_scaleX
|
||||
}
|
||||
|
||||
if (mPlayAnim) {
|
||||
*i_anmFrame += 1.0f;
|
||||
if (*i_anmFrame >= mpBck->getFrameMax()) {
|
||||
*i_anmFrame = 0.0f;
|
||||
#ifdef TARGET_PC
|
||||
const u32 ui_advance_ticks = dusk::frame_interp::get_presentation_ui_advance_ticks();
|
||||
for (u32 i = 0; i < ui_advance_ticks; ++i) {
|
||||
#endif
|
||||
*i_anmFrame += 1.0f;
|
||||
if (*i_anmFrame >= mpBck->getFrameMax()) {
|
||||
*i_anmFrame = 0.0f;
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
|
||||
mBckFrame = *i_anmFrame;
|
||||
mBpkFrame = *i_anmFrame;
|
||||
@@ -220,11 +228,18 @@ void dMsgScrnLight_c::draw(f32* i_anmFrame, f32 i_posX, f32 i_posY, f32 i_scaleX
|
||||
mpParent_c->setBlackWhite(i_black, i_white);
|
||||
|
||||
if (mPlayAnim) {
|
||||
*i_anmFrame += i_anmRate;
|
||||
#ifdef TARGET_PC
|
||||
const u32 ui_advance_ticks = dusk::frame_interp::get_presentation_ui_advance_ticks();
|
||||
for (u32 i = 0; i < ui_advance_ticks; ++i) {
|
||||
#endif
|
||||
*i_anmFrame += i_anmRate;
|
||||
|
||||
if (*i_anmFrame >= mpBck->getFrameMax()) {
|
||||
*i_anmFrame = 0.0f;
|
||||
if (*i_anmFrame >= mpBck->getFrameMax()) {
|
||||
*i_anmFrame = 0.0f;
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
|
||||
mBckFrame = *i_anmFrame;
|
||||
mBpkFrame = *i_anmFrame;
|
||||
|
||||
@@ -454,11 +454,11 @@ void dMsgScrnTalk_c::fukiPosCalc(u8 param_1) {
|
||||
#if TARGET_PC
|
||||
mDoLib_project(&msgActor->pos, &local_70, {0, 0, FB_WIDTH, FB_HEIGHT});
|
||||
#else
|
||||
mDoLib_project(&msgActor->pos, &local_70,);
|
||||
mDoLib_project(&msgActor->pos, &local_70);
|
||||
#endif
|
||||
|
||||
if (local_70.x >= 0.0f && local_70.x <= 608.0f && local_70.y >= 0.0f &&
|
||||
local_70.y <= 448.0f)
|
||||
|
||||
if (local_70.x >= 0.0f && local_70.x <= FB_WIDTH_BASE && local_70.y >= 0.0f &&
|
||||
local_70.y <= FB_HEIGHT_BASE)
|
||||
{
|
||||
f3y = 0.5f * (cStack_7c.y + local_70.y);
|
||||
} else {
|
||||
@@ -493,6 +493,9 @@ void dMsgScrnTalk_c::fukiPosCalc(u8 param_1) {
|
||||
field_0xf0 = 0.0f;
|
||||
field_0x488 = param_1;
|
||||
f32 dVar15;
|
||||
// the magic numbers here are correlated with the framebuffer size, but
|
||||
// were likely either chosen by hand or had multiple arithmetic
|
||||
// operations applied which cannot easily be reverse engineered
|
||||
switch (field_0x488) {
|
||||
case 1:
|
||||
dVar15 = g_MsgObject_HIO_c.mBoxPos[2][0];
|
||||
|
||||
+6
-5
@@ -1176,19 +1176,20 @@ void dScnLogo_c::logoInitWii() {
|
||||
break;
|
||||
}
|
||||
|
||||
width = 608;
|
||||
height = 456;
|
||||
// this uses the standard width but the widescreen height?
|
||||
width = FB_WIDTH_BASE;
|
||||
height = FB_HEIGHT;
|
||||
}
|
||||
|
||||
JUT_ASSERT(2309, timg != NULL);
|
||||
mStrapImg = JKR_NEW dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255);
|
||||
mStrapImg = JKR_NEW dDlst_2D_c(timg, (FB_WIDTH_BASE / 2) - (width / 2), (FB_HEIGHT_BASE / 2) - (height / 2), width, height, 255);
|
||||
|
||||
#if VERSION == VERSION_SHIELD
|
||||
timg = (ResTIMG*)dComIfG_getObjectRes("LogoUsWii", 5);
|
||||
mNvLogo = JKR_NEW dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255);
|
||||
mNvLogo = JKR_NEW dDlst_2D_c(timg, (FB_WIDTH_BASE / 2) - (width / 2), (FB_HEIGHT_BASE / 2) - (height / 2), width, height, 255);
|
||||
|
||||
timg = (ResTIMG*)dComIfG_getObjectRes("LogoUsWii", 4);
|
||||
mMocImg = JKR_NEW dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255);
|
||||
mMocImg = JKR_NEW dDlst_2D_c(timg, (FB_WIDTH_BASE / 2) - (width / 2), (FB_HEIGHT_BASE / 2) - (height / 2), width, height, 255);
|
||||
#endif
|
||||
|
||||
OS_REPORT("\x1b[32m%d archiveHeap->getTotalFreeSize %08x\n\x1b[m", 2316, archiveHeap->getTotalFreeSize());
|
||||
|
||||
+11
-11
@@ -136,24 +136,24 @@ void dScope_c::draw() {
|
||||
u8 alpha = mAlpha * 255.0f;
|
||||
|
||||
if (dComIfGp_checkPlayerStatus0(0, 0x1000)) {
|
||||
J2DDrawLine(304.0f, mDoGph_gInf_c::getMinYF(), 304.0f, mDoGph_gInf_c::getMaxYF(),
|
||||
JUtility::TColor(255, 0, 0, alpha), 6);
|
||||
J2DDrawLine(mDoGph_gInf_c::getMinXF(), 224.0f, mDoGph_gInf_c::getMaxXF(), 224.0f,
|
||||
JUtility::TColor(255, 0, 0, alpha), 6);
|
||||
J2DDrawLine(FB_WIDTH_BASE / 2, mDoGph_gInf_c::getMinYF(), FB_WIDTH_BASE / 2,
|
||||
mDoGph_gInf_c::getMaxYF(), JUtility::TColor(255, 0, 0, alpha), 6);
|
||||
J2DDrawLine(mDoGph_gInf_c::getMinXF(), FB_HEIGHT_BASE / 2, mDoGph_gInf_c::getMaxXF(),
|
||||
FB_HEIGHT_BASE / 2, JUtility::TColor(255, 0, 0, alpha), 6);
|
||||
}
|
||||
|
||||
mpWipeTex->setAlpha(alpha);
|
||||
mpBlackTex->setAlpha(alpha);
|
||||
|
||||
f32 temp_f29 = 304.0f - temp_f31;
|
||||
f32 temp_f28 = 304.0f + temp_f31;
|
||||
f32 temp_f27 = 224.0f - temp_f30;
|
||||
f32 temp_f26 = 224.0f + temp_f30;
|
||||
f32 temp_f29 = FB_WIDTH_BASE / 2 - temp_f31;
|
||||
f32 temp_f28 = FB_WIDTH_BASE / 2 + temp_f31;
|
||||
f32 temp_f27 = FB_HEIGHT_BASE / 2 - temp_f30;
|
||||
f32 temp_f26 = FB_HEIGHT_BASE / 2 + temp_f30;
|
||||
|
||||
mpWipeTex->draw(temp_f29, temp_f27, temp_f31, temp_f30, false, false, false);
|
||||
mpWipeTex->draw(304.0f, temp_f27, temp_f31, temp_f30, true, false, false);
|
||||
mpWipeTex->draw(temp_f29, 224.0f, temp_f31, temp_f30, false, true, false);
|
||||
mpWipeTex->draw(304.0f, 224.0f, temp_f31, temp_f30, true, true, false);
|
||||
mpWipeTex->draw(FB_WIDTH_BASE / 2, temp_f27, temp_f31, temp_f30, true, false, false);
|
||||
mpWipeTex->draw(temp_f29, FB_HEIGHT_BASE / 2, temp_f31, temp_f30, false, true, false);
|
||||
mpWipeTex->draw(FB_WIDTH_BASE / 2, FB_HEIGHT_BASE / 2, temp_f31, temp_f30, true, true, false);
|
||||
|
||||
mpBlackTex->draw(mDoGph_gInf_c::getMinXF(), mDoGph_gInf_c::getMinYF(),
|
||||
mDoGph_gInf_c::getWidthF(), temp_f27 - mDoGph_gInf_c::getMinYF(), false, false,
|
||||
|
||||
+48
-19
@@ -5,6 +5,7 @@
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "JSystem/J2DGraph/J2DAnimation.h"
|
||||
#include "JSystem/J2DGraph/J2DAnmLoader.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include <cstring>
|
||||
|
||||
dSelect_cursorHIO_c::dSelect_cursorHIO_c() {
|
||||
@@ -270,15 +271,22 @@ void dSelect_cursor_c::update() {
|
||||
if (mUpdateFlag) {
|
||||
if (field_0x30) {
|
||||
if (chkPlayAnime(0)) {
|
||||
if (mNameIdx == 1) {
|
||||
field_0x44 += mpCursorHIO->field_0x8 * fVar1;
|
||||
} else {
|
||||
field_0x44 += fVar1;
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
const u32 ui_advance_ticks = dusk::frame_interp::get_presentation_ui_advance_ticks();
|
||||
for (u32 tick = 0; tick < ui_advance_ticks; ++tick) {
|
||||
#endif
|
||||
if (mNameIdx == 1) {
|
||||
field_0x44 += mpCursorHIO->field_0x8 * fVar1;
|
||||
} else {
|
||||
field_0x44 += fVar1;
|
||||
}
|
||||
|
||||
if (field_0x44 >= field_0x30->getFrameMax()) {
|
||||
field_0x44 -= field_0x30->getFrameMax();
|
||||
if (field_0x44 >= field_0x30->getFrameMax()) {
|
||||
field_0x44 -= field_0x30->getFrameMax();
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
|
||||
field_0x30->setFrame(field_0x44);
|
||||
setBpkAnimation(field_0x30);
|
||||
@@ -294,14 +302,21 @@ void dSelect_cursor_c::update() {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (field_0x34[i]) {
|
||||
if ((i == 0 && chkPlayAnime(2)) || (i == 1 && chkPlayAnime(3))) {
|
||||
if (mNameIdx == 1) {
|
||||
field_0x48[i] += mpCursorHIO->field_0x8 * fVar1;
|
||||
} else {
|
||||
field_0x48[i] += fVar1;
|
||||
}
|
||||
if (field_0x48[i] >= field_0x34[i]->getFrameMax()) {
|
||||
field_0x48[i] -= field_0x34[i]->getFrameMax();
|
||||
#ifdef TARGET_PC
|
||||
const u32 ui_advance_ticks = dusk::frame_interp::get_presentation_ui_advance_ticks();
|
||||
for (u32 tick = 0; tick < ui_advance_ticks; ++tick) {
|
||||
#endif
|
||||
if (mNameIdx == 1) {
|
||||
field_0x48[i] += mpCursorHIO->field_0x8 * fVar1;
|
||||
} else {
|
||||
field_0x48[i] += fVar1;
|
||||
}
|
||||
if (field_0x48[i] >= field_0x34[i]->getFrameMax()) {
|
||||
field_0x48[i] -= field_0x34[i]->getFrameMax();
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
|
||||
field_0x34[i]->setFrame(field_0x48[i]);
|
||||
}
|
||||
@@ -310,7 +325,11 @@ void dSelect_cursor_c::update() {
|
||||
}
|
||||
|
||||
if (field_0x2C && chkPlayAnime(1)) {
|
||||
if (mNameIdx == 1) {
|
||||
#ifdef TARGET_PC
|
||||
const u32 ui_advance_ticks = dusk::frame_interp::get_presentation_ui_advance_ticks();
|
||||
for (u32 tick = 0; tick < ui_advance_ticks; ++tick) {
|
||||
#endif
|
||||
if (mNameIdx == 1) {
|
||||
field_0x40 += mpCursorHIO->field_0x8 * fVar1;
|
||||
} else {
|
||||
field_0x40 += fVar1;
|
||||
@@ -318,14 +337,24 @@ void dSelect_cursor_c::update() {
|
||||
if (field_0x40 >= field_0x2C->getFrameMax()) {
|
||||
field_0x40 -= field_0x2C->getFrameMax();
|
||||
}
|
||||
|
||||
field_0x2C->setFrame(field_0x40);
|
||||
setBckAnimation(field_0x2C);
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
|
||||
field_0x2C->setFrame(field_0x40);
|
||||
setBckAnimation(field_0x2C);
|
||||
|
||||
}
|
||||
|
||||
if (chkPlayAnime(1) && mNameIdx == 0) {
|
||||
setCursorAnimation();
|
||||
#ifdef TARGET_PC
|
||||
const u32 ui_advance_ticks = dusk::frame_interp::get_presentation_ui_advance_ticks();
|
||||
for (u32 tick = 0; tick < ui_advance_ticks; ++tick) {
|
||||
#endif
|
||||
setCursorAnimation();
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
mpScreen->animation();
|
||||
|
||||
+18
-8
@@ -2,21 +2,31 @@
|
||||
|
||||
#include "d/d_select_icon.h"
|
||||
#include "JSystem/J2DGraph/J2DAnimation.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
|
||||
dSi_HIO_c::dSi_HIO_c() {}
|
||||
|
||||
void dSelect_icon_c::animation() {
|
||||
if (field_0x10->getAlpha() != 0) {
|
||||
field_0x20 += field_0x2c;
|
||||
if (field_0x20 >= field_0x1c->getFrameMax()) {
|
||||
field_0x20 = 0.0f;
|
||||
}
|
||||
field_0x1c->setFrame(field_0x20);
|
||||
#ifdef TARGET_PC
|
||||
const u32 ui_advance_ticks = dusk::frame_interp::get_presentation_ui_advance_ticks();
|
||||
for (u32 i = 0; i < ui_advance_ticks; ++i) {
|
||||
#endif
|
||||
field_0x20 += field_0x2c;
|
||||
if (field_0x20 >= field_0x1c->getFrameMax()) {
|
||||
field_0x20 = 0.0f;
|
||||
}
|
||||
field_0x1c->setFrame(field_0x20);
|
||||
|
||||
field_0x28 += field_0x2c;
|
||||
if (field_0x28 >= field_0x24->getFrameMax()) {
|
||||
field_0x28 = 0.0f;
|
||||
field_0x28 += field_0x2c;
|
||||
if (field_0x28 >= field_0x24->getFrameMax()) {
|
||||
field_0x28 = 0.0f;
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
// Set even if not advancing
|
||||
field_0x1c->setFrame(field_0x20);
|
||||
#endif
|
||||
|
||||
field_0x24->setFrame(field_0x28);
|
||||
field_0x8->animation();
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ using json = nlohmann::json;
|
||||
aurora::Module DuskConfigLog("dusk::config");
|
||||
|
||||
static absl::flat_hash_map<std::string_view, ConfigVarBase*> RegisteredConfigVars;
|
||||
static bool RegistrationDone;
|
||||
static bool RegistrationDone = false;
|
||||
|
||||
static std::string GetConfigJsonPath() {
|
||||
return fmt::format("{}{}", configPath, ConfigFileName);
|
||||
@@ -219,4 +219,4 @@ ConfigVarBase* dusk::config::GetConfigVar(std::string_view name) {
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,398 @@
|
||||
#include "dusk/frame_interpolation.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace {
|
||||
|
||||
enum class Op : uint8_t {
|
||||
OpenChild,
|
||||
FinalMtx,
|
||||
};
|
||||
|
||||
struct Label {
|
||||
const void* key = nullptr;
|
||||
int32_t id = 0;
|
||||
|
||||
bool operator==(const Label& other) const {
|
||||
return key == other.key && id == other.id;
|
||||
}
|
||||
};
|
||||
|
||||
struct Data {
|
||||
Label child_label{};
|
||||
size_t child_index = 0;
|
||||
Mtx matrix{};
|
||||
const Mtx* dest = nullptr;
|
||||
};
|
||||
|
||||
struct Path;
|
||||
|
||||
struct ChildBucket {
|
||||
Label label{};
|
||||
std::vector<std::unique_ptr<Path>> nodes;
|
||||
};
|
||||
|
||||
struct OpBucket {
|
||||
Op op = Op::OpenChild;
|
||||
std::vector<Data> values;
|
||||
};
|
||||
|
||||
struct Path {
|
||||
std::vector<ChildBucket> children;
|
||||
std::vector<OpBucket> ops;
|
||||
std::vector<std::pair<Op, size_t>> items;
|
||||
};
|
||||
|
||||
struct Recording {
|
||||
Path root;
|
||||
};
|
||||
|
||||
struct MatrixValue {
|
||||
Mtx value;
|
||||
};
|
||||
|
||||
using FinalMtxLookup = std::unordered_map<const Mtx*, const Data*>;
|
||||
|
||||
bool s_initialized = false;
|
||||
|
||||
bool g_enabled = false;
|
||||
bool g_recording = false;
|
||||
bool g_interpolating = false;
|
||||
float g_step = 0.0f;
|
||||
uint32_t g_pending_presentation_ui_ticks = 0;
|
||||
uint32_t g_current_presentation_ui_ticks = 0;
|
||||
|
||||
Recording g_current_recording;
|
||||
Recording g_previous_recording;
|
||||
std::vector<Path*> g_current_path;
|
||||
|
||||
std::unordered_map<const Mtx*, MatrixValue> g_replacements;
|
||||
|
||||
inline void copy_matrix(const Mtx src, Mtx dst) {
|
||||
MTXCopy(src, dst);
|
||||
}
|
||||
|
||||
inline void concat_matrix(const Mtx lhs, const Mtx rhs, Mtx out) {
|
||||
MTXConcat(lhs, rhs, out);
|
||||
}
|
||||
|
||||
inline void lerp_matrix(Mtx out, const Mtx lhs, const Mtx rhs, float step) {
|
||||
const float old_weight = 1.0f - step;
|
||||
for (size_t row = 0; row < 3; ++row) {
|
||||
for (size_t col = 0; col < 4; ++col) {
|
||||
out[row][col] = lhs[row][col] * old_weight + rhs[row][col] * step;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline bool matrix_differs(const Mtx lhs, const Mtx rhs, float epsilon = 0.0001f) {
|
||||
for (size_t row = 0; row < 3; ++row) {
|
||||
for (size_t col = 0; col < 4; ++col) {
|
||||
if (std::abs(lhs[row][col] - rhs[row][col]) > epsilon) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Data& append_op(Op op) {
|
||||
auto& items = g_current_path.back()->items;
|
||||
auto& buckets = g_current_path.back()->ops;
|
||||
auto it = std::find_if(buckets.begin(), buckets.end(),
|
||||
[op](const OpBucket& bucket) { return bucket.op == op; });
|
||||
if (it == buckets.end()) {
|
||||
buckets.push_back({op, {}});
|
||||
it = buckets.end() - 1;
|
||||
}
|
||||
items.emplace_back(op, it->values.size());
|
||||
return it->values.emplace_back();
|
||||
}
|
||||
|
||||
const Data* find_matching_data(const Path& path, Op op, size_t index) {
|
||||
auto it = std::find_if(path.ops.begin(), path.ops.end(),
|
||||
[op](const OpBucket& bucket) { return bucket.op == op; });
|
||||
if (it == path.ops.end() || index >= it->values.size()) {
|
||||
return nullptr;
|
||||
}
|
||||
return &it->values[index];
|
||||
}
|
||||
|
||||
const OpBucket* find_op_bucket(const Path& path, Op op) {
|
||||
auto it = std::find_if(path.ops.begin(), path.ops.end(),
|
||||
[op](const OpBucket& bucket) { return bucket.op == op; });
|
||||
if (it == path.ops.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return &*it;
|
||||
}
|
||||
|
||||
void build_final_mtx_lookup(const Path& path, FinalMtxLookup& lookup) {
|
||||
lookup.clear();
|
||||
|
||||
const OpBucket* bucket = find_op_bucket(path, Op::FinalMtx);
|
||||
if (bucket == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const Data& data : bucket->values) {
|
||||
if (data.dest == nullptr) {
|
||||
continue;
|
||||
}
|
||||
lookup[data.dest] = &data;
|
||||
}
|
||||
}
|
||||
|
||||
const Data* find_matching_final_mtx(const FinalMtxLookup& lookup, const Data& new_data) {
|
||||
if (new_data.dest == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto it = lookup.find(new_data.dest);
|
||||
if (it == lookup.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return it->second;
|
||||
}
|
||||
|
||||
ChildBucket& get_child_bucket(Path& path, const Label& label) {
|
||||
auto it = std::find_if(path.children.begin(), path.children.end(),
|
||||
[&label](const ChildBucket& bucket) { return bucket.label == label; });
|
||||
if (it == path.children.end()) {
|
||||
path.children.push_back({});
|
||||
it = path.children.end() - 1;
|
||||
it->label = label;
|
||||
}
|
||||
return *it;
|
||||
}
|
||||
|
||||
const ChildBucket* find_child_bucket(const Path& path, const Label& label) {
|
||||
auto it = std::find_if(path.children.begin(), path.children.end(),
|
||||
[&label](const ChildBucket& bucket) { return bucket.label == label; });
|
||||
if (it == path.children.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return &*it;
|
||||
}
|
||||
|
||||
void store_replacement(const Data& old_data, const Data& new_data, float step) {
|
||||
if (new_data.dest == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto& replacement = g_replacements[new_data.dest];
|
||||
lerp_matrix(replacement.value, old_data.matrix, new_data.matrix, step);
|
||||
}
|
||||
|
||||
void interpolate_branch(const Path& old_path, const Path& new_path, float step) {
|
||||
FinalMtxLookup old_final_mtx_lookup;
|
||||
build_final_mtx_lookup(old_path, old_final_mtx_lookup);
|
||||
|
||||
for (const auto& item : new_path.items) {
|
||||
const Op op = item.first;
|
||||
const size_t index = item.second;
|
||||
const Data* new_data = find_matching_data(new_path, op, index);
|
||||
if (new_data == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (op == Op::OpenChild) {
|
||||
const ChildBucket* new_children = find_child_bucket(new_path, new_data->child_label);
|
||||
if (new_children == nullptr || new_data->child_index >= new_children->nodes.size())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Path& new_child = *new_children->nodes[new_data->child_index];
|
||||
const ChildBucket* old_children = find_child_bucket(old_path, new_data->child_label);
|
||||
if (old_children != nullptr && new_data->child_index < old_children->nodes.size())
|
||||
{
|
||||
interpolate_branch(*old_children->nodes[new_data->child_index], new_child, step);
|
||||
} else {
|
||||
interpolate_branch(new_child, new_child, step);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
const Data* indexed_old_data = find_matching_data(old_path, op, index);
|
||||
const Data* old_data = op == Op::FinalMtx ? find_matching_final_mtx(old_final_mtx_lookup, *new_data) : indexed_old_data;
|
||||
if (op == Op::FinalMtx) {
|
||||
store_replacement(old_data != nullptr ? *old_data : *new_data, *new_data, step);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const Mtx* resolve_replacement(const Mtx* source, Mtx* scratch) {
|
||||
if (!g_interpolating || source == nullptr) {
|
||||
return source;
|
||||
}
|
||||
|
||||
auto it = g_replacements.find(source);
|
||||
if (it == g_replacements.end()) {
|
||||
return source;
|
||||
}
|
||||
|
||||
copy_matrix(it->second.value, *scratch);
|
||||
return scratch;
|
||||
}
|
||||
|
||||
bool has_recording_data(const Recording& recording) {
|
||||
return !recording.root.items.empty() || !recording.root.children.empty();
|
||||
}
|
||||
|
||||
void clear_replacements() {
|
||||
g_replacements.clear();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace dusk {
|
||||
namespace frame_interp {
|
||||
|
||||
void ensure_initialized() {
|
||||
g_enabled = getSettings().game.enableFrameInterpolation;
|
||||
s_initialized = true;
|
||||
}
|
||||
|
||||
void begin_record() {
|
||||
ensure_initialized();
|
||||
if (!g_enabled) {
|
||||
g_interpolating = false;
|
||||
g_previous_recording = {};
|
||||
g_current_recording = {};
|
||||
g_current_path.clear();
|
||||
clear_replacements();
|
||||
return;
|
||||
}
|
||||
|
||||
g_previous_recording = std::move(g_current_recording);
|
||||
g_current_recording = {};
|
||||
g_current_path.clear();
|
||||
g_current_path.push_back(&g_current_recording.root);
|
||||
g_recording = true;
|
||||
g_interpolating = false;
|
||||
clear_replacements();
|
||||
}
|
||||
|
||||
void end_record() {
|
||||
g_recording = false;
|
||||
}
|
||||
|
||||
void interpolate(float step) {
|
||||
ensure_initialized();
|
||||
clear_replacements();
|
||||
g_step = std::clamp(step, 0.0f, 1.0f);
|
||||
g_interpolating = g_enabled && !g_recording && has_recording_data(g_current_recording);
|
||||
if (!g_interpolating) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!has_recording_data(g_previous_recording)) {
|
||||
interpolate_branch(g_current_recording.root, g_current_recording.root, g_step);
|
||||
return;
|
||||
}
|
||||
|
||||
interpolate_branch(g_previous_recording.root, g_current_recording.root, g_step);
|
||||
}
|
||||
|
||||
void notify_sim_tick_complete() {
|
||||
ensure_initialized();
|
||||
g_pending_presentation_ui_ticks++;
|
||||
}
|
||||
|
||||
uint32_t begin_presentation_ui_pass() {
|
||||
ensure_initialized();
|
||||
g_current_presentation_ui_ticks = g_pending_presentation_ui_ticks;
|
||||
g_pending_presentation_ui_ticks = 0;
|
||||
return g_current_presentation_ui_ticks;
|
||||
}
|
||||
|
||||
uint32_t get_presentation_ui_advance_ticks() {
|
||||
if (!s_initialized) {
|
||||
return 0;
|
||||
}
|
||||
if (!g_enabled) {
|
||||
return 1;
|
||||
}
|
||||
return g_current_presentation_ui_ticks;
|
||||
}
|
||||
|
||||
void end_presentation_ui_pass() {
|
||||
if (!s_initialized) {
|
||||
return;
|
||||
}
|
||||
g_current_presentation_ui_ticks = 0;
|
||||
}
|
||||
|
||||
void open_child(const void* key, int32_t id) {
|
||||
if (!s_initialized || !g_recording) {
|
||||
return;
|
||||
}
|
||||
|
||||
Label label{key, id};
|
||||
auto& siblings = get_child_bucket(*g_current_path.back(), label).nodes;
|
||||
Data& data = append_op(Op::OpenChild);
|
||||
data.child_label = label;
|
||||
data.child_index = siblings.size();
|
||||
siblings.emplace_back(std::make_unique<Path>());
|
||||
g_current_path.push_back(siblings.back().get());
|
||||
}
|
||||
|
||||
void close_child() {
|
||||
if (!s_initialized || !g_recording || g_current_path.size() <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
g_current_path.pop_back();
|
||||
}
|
||||
|
||||
void record_final_mtx_raw(const Mtx* dest, const Mtx src) {
|
||||
if (!s_initialized || !g_recording || dest == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
Data& data = append_op(Op::FinalMtx);
|
||||
data.dest = dest;
|
||||
copy_matrix(src, data.matrix);
|
||||
}
|
||||
|
||||
bool lookup_replacement(const void* source, Mtx out) {
|
||||
if (!s_initialized || !g_interpolating || source == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto it = g_replacements.find(reinterpret_cast<const Mtx*>(source));
|
||||
if (it == g_replacements.end()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
copy_matrix(it->second.value, out);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool lookup_concat_replacement(const void* lhs, const void* rhs, Mtx out) {
|
||||
if (!s_initialized || !g_interpolating || lhs == nullptr || rhs == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Mtx lhs_scratch;
|
||||
Mtx rhs_scratch;
|
||||
const Mtx* resolved_lhs = resolve_replacement(reinterpret_cast<const Mtx*>(lhs), &lhs_scratch);
|
||||
const Mtx* resolved_rhs = resolve_replacement(reinterpret_cast<const Mtx*>(rhs), &rhs_scratch);
|
||||
if (resolved_lhs == reinterpret_cast<const Mtx*>(lhs) &&
|
||||
resolved_rhs == reinterpret_cast<const Mtx*>(rhs))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
concat_matrix(*resolved_lhs, *resolved_rhs, out);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace frame_interp
|
||||
} // namespace dusk
|
||||
@@ -253,3 +253,9 @@ void dusk::ImGuiMenuTools::ShowAudioDebug() {
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void dusk::ImGuiMenuTools::ShowSaveEditor() {
|
||||
if (m_showSaveEditor) {
|
||||
m_saveEditor.draw(m_showSaveEditor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace dusk {
|
||||
windowFlags |= ImGuiWindowFlags_NoMove;
|
||||
}
|
||||
|
||||
ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
// ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
|
||||
if (!ImGui::Begin("Camera Debug", nullptr, windowFlags)) {
|
||||
ImGui::End();
|
||||
|
||||
+113
-32
@@ -14,6 +14,7 @@
|
||||
#include "JSystem/JUtility/JUTGamePad.h"
|
||||
#include "SDL3/SDL_mouse.h"
|
||||
#include "dusk/config.hpp"
|
||||
#include "dusk/main.h"
|
||||
#include "dusk/settings.h"
|
||||
#include "dusk/audio/DuskAudioSystem.h"
|
||||
#include "dusk/dusk.h"
|
||||
@@ -35,6 +36,21 @@ namespace dusk {
|
||||
ImGui::TextUnformatted(text.data(), text.data() + text.size());
|
||||
}
|
||||
|
||||
void ImGuiTextCenter(std::string_view text) {
|
||||
ImGui::NewLine();
|
||||
float fontSize = ImGui::CalcTextSize(text.data(), text.data() + text.size()).x;
|
||||
ImGui::SameLine(ImGui::GetWindowSize().x / 2 - fontSize + fontSize / 2);
|
||||
ImGuiStringViewText(text);
|
||||
}
|
||||
|
||||
bool ImGuiButtonCenter(std::string_view text) {
|
||||
ImGui::NewLine();
|
||||
float fontSize = ImGui::CalcTextSize(text.data(), text.data() + text.size()).x;
|
||||
fontSize += ImGui::GetStyle().FramePadding.x;
|
||||
ImGui::SameLine(ImGui::GetWindowSize().x / 2 - fontSize + fontSize / 2);
|
||||
return ImGui::Button(text.data());
|
||||
}
|
||||
|
||||
std::string BytesToString(size_t bytes) {
|
||||
constexpr std::array suffixes{ "B"sv, "KB"sv, "MB"sv, "GB"sv, "TB"sv, "PB"sv, "EB"sv };
|
||||
uint32_t s = 0;
|
||||
@@ -184,33 +200,19 @@ namespace dusk {
|
||||
|
||||
ImGuiConsole::ImGuiConsole() {}
|
||||
|
||||
void ImGuiConsole::InitSettings() {
|
||||
bool lockAspect = getSettings().video.lockAspectRatio;
|
||||
if (lockAspect) {
|
||||
VILockAspectRatio(defaultAspectRatioW, defaultAspectRatioH);
|
||||
} else {
|
||||
VIUnlockAspectRatio();
|
||||
}
|
||||
|
||||
dusk::audio::SetMasterVolume(getSettings().audio.masterVolume / 100.0f);
|
||||
dusk::audio::SetEnableReverb(getSettings().audio.enableReverb);
|
||||
}
|
||||
|
||||
void ImGuiConsole::UpdateSettings() {
|
||||
getTransientSettings().skipFrameRateLimit = getSettings().game.enableTurboKeybind && ImGui::IsKeyDown(ImGuiKey_Tab);
|
||||
}
|
||||
|
||||
void ImGuiConsole::PreDraw() {
|
||||
ZoneScoped;
|
||||
if (!m_isLaunchInitialized) {
|
||||
InitSettings();
|
||||
|
||||
if (dusk::IsGameLaunched && !m_isLaunchInitialized) {
|
||||
m_toasts.emplace_back("Press F1 to toggle menu"s, 5.f);
|
||||
m_isLaunchInitialized = true;
|
||||
}
|
||||
|
||||
UpdateSettings();
|
||||
|
||||
|
||||
if ((ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) &&
|
||||
ImGui::IsKeyPressed(ImGuiKey_R))
|
||||
{
|
||||
@@ -221,24 +223,11 @@ namespace dusk {
|
||||
ImGuiMenuGame::ToggleFullscreen();
|
||||
}
|
||||
|
||||
if (CheckMenuViewToggle(ImGuiKey_F1, m_isHidden)) {
|
||||
ShowToasts();
|
||||
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange;
|
||||
SDL_HideCursor();
|
||||
return;
|
||||
}
|
||||
bool showMenu = !dusk::IsGameLaunched || !CheckMenuViewToggle(ImGuiKey_F1, m_isHidden);
|
||||
|
||||
ImGui::GetIO().ConfigFlags &= ~ImGuiConfigFlags_NoMouseCursorChange;
|
||||
// Imgui will re-show cursor.
|
||||
|
||||
// TODO: we need to be able to render the menu bar & any overlays separately
|
||||
// The code currently ties them all together, so hiding the menu hides all windows
|
||||
|
||||
if (ImGui::BeginMainMenuBar()) {
|
||||
if (showMenu && ImGui::BeginMainMenuBar()) {
|
||||
m_menuGame.draw();
|
||||
m_menuEnhancements.draw();
|
||||
|
||||
// Keep always last
|
||||
m_menuTools.draw();
|
||||
|
||||
ImGui::SetCursorPosX(ImGui::GetWindowWidth() - 80.0f * ImGuiScale());
|
||||
@@ -248,6 +237,34 @@ namespace dusk {
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
if (!dusk::IsGameLaunched) {
|
||||
m_preLaunchWindow.draw();
|
||||
}
|
||||
|
||||
m_menuGame.windowControllerConfig();
|
||||
m_menuGame.windowInputViewer();
|
||||
if (dusk::IsGameLaunched) {
|
||||
m_menuTools.ShowDebugOverlay();
|
||||
m_menuTools.ShowCameraOverlay();
|
||||
m_menuTools.ShowProcessManager();
|
||||
m_menuTools.ShowHeapOverlay();
|
||||
m_menuTools.ShowStubLog();
|
||||
m_menuTools.ShowMapLoader();
|
||||
m_menuTools.ShowPlayerInfo();
|
||||
m_menuTools.ShowAudioDebug();
|
||||
m_menuTools.ShowSaveEditor();
|
||||
}
|
||||
DuskDebugPad(); // temporary, remove later
|
||||
|
||||
// Only show cursor when menu or any windows are open
|
||||
if (showMenu || ImGui::GetIO().MetricsRenderWindows > 0) {
|
||||
ImGui::GetIO().ConfigFlags &= ~ImGuiConfigFlags_NoMouseCursorChange;
|
||||
// Imgui will re-show cursor.
|
||||
} else {
|
||||
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange;
|
||||
SDL_HideCursor();
|
||||
}
|
||||
|
||||
ShowToasts();
|
||||
}
|
||||
|
||||
@@ -287,6 +304,70 @@ namespace dusk {
|
||||
}
|
||||
}
|
||||
|
||||
std::string_view backend_id(AuroraBackend backend) {
|
||||
switch (backend) {
|
||||
default:
|
||||
return "auto"sv;
|
||||
case BACKEND_D3D12:
|
||||
return "d3d12"sv;
|
||||
case BACKEND_D3D11:
|
||||
return "d3d11"sv;
|
||||
case BACKEND_METAL:
|
||||
return "metal"sv;
|
||||
case BACKEND_VULKAN:
|
||||
return "vulkan"sv;
|
||||
case BACKEND_OPENGL:
|
||||
return "opengl"sv;
|
||||
case BACKEND_OPENGLES:
|
||||
return "opengles"sv;
|
||||
case BACKEND_WEBGPU:
|
||||
return "webgpu"sv;
|
||||
case BACKEND_NULL:
|
||||
return "null"sv;
|
||||
}
|
||||
}
|
||||
|
||||
bool try_parse_backend(std::string_view backend, AuroraBackend& outBackend) {
|
||||
if (backend == "auto") {
|
||||
outBackend = BACKEND_AUTO;
|
||||
return true;
|
||||
}
|
||||
if (backend == "d3d11") {
|
||||
outBackend = BACKEND_D3D11;
|
||||
return true;
|
||||
}
|
||||
if (backend == "d3d12") {
|
||||
outBackend = BACKEND_D3D12;
|
||||
return true;
|
||||
}
|
||||
if (backend == "metal") {
|
||||
outBackend = BACKEND_METAL;
|
||||
return true;
|
||||
}
|
||||
if (backend == "vulkan") {
|
||||
outBackend = BACKEND_VULKAN;
|
||||
return true;
|
||||
}
|
||||
if (backend == "opengl") {
|
||||
outBackend = BACKEND_OPENGL;
|
||||
return true;
|
||||
}
|
||||
if (backend == "opengles") {
|
||||
outBackend = BACKEND_OPENGLES;
|
||||
return true;
|
||||
}
|
||||
if (backend == "webgpu") {
|
||||
outBackend = BACKEND_WEBGPU;
|
||||
return true;
|
||||
}
|
||||
if (backend == "null") {
|
||||
outBackend = BACKEND_NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ImGuiConsole::ShowToasts() {
|
||||
if (m_toasts.empty()) {
|
||||
return;
|
||||
@@ -330,7 +411,7 @@ namespace dusk {
|
||||
void ImGuiConsole::ShowPipelineProgress() {
|
||||
const auto* stats = aurora_get_stats();
|
||||
const u32 queuedPipelines = stats->queuedPipelines;
|
||||
if (queuedPipelines == 0) {
|
||||
if (queuedPipelines == 0 || !getSettings().backend.showPipelineCompilation) {
|
||||
return;
|
||||
}
|
||||
const u32 createdPipelines = stats->createdPipelines;
|
||||
|
||||
@@ -4,17 +4,18 @@
|
||||
#include <aurora/aurora.h>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include "ImGuiMenuEnhancements.hpp"
|
||||
#include "ImGuiMenuGame.hpp"
|
||||
#include "ImGuiMenuTools.hpp"
|
||||
#include "ImGuiPreLaunchWindow.hpp"
|
||||
#include "imgui.h"
|
||||
|
||||
namespace dusk {
|
||||
class ImGuiConsole {
|
||||
public:
|
||||
ImGuiConsole();
|
||||
void InitSettings();
|
||||
void UpdateSettings();
|
||||
void PreDraw();
|
||||
void PostDraw();
|
||||
@@ -36,6 +37,7 @@ private:
|
||||
|
||||
ImGuiMenuGame m_menuGame;
|
||||
ImGuiMenuEnhancements m_menuEnhancements;
|
||||
ImGuiPreLaunchWindow m_preLaunchWindow;
|
||||
|
||||
// Keep always last
|
||||
ImGuiMenuTools m_menuTools;
|
||||
@@ -47,12 +49,16 @@ private:
|
||||
extern ImGuiConsole g_imguiConsole;
|
||||
|
||||
std::string_view backend_name(AuroraBackend backend);
|
||||
std::string_view backend_id(AuroraBackend backend);
|
||||
bool try_parse_backend(std::string_view backend, AuroraBackend& outBackend);
|
||||
std::string BytesToString(size_t bytes);
|
||||
void SetOverlayWindowLocation(int corner);
|
||||
bool ShowCornerContextMenu(int& corner, int avoidCorner);
|
||||
void ImGuiStringViewText(std::string_view text);
|
||||
void ImGuiBeginGroupPanel(const char* name, const ImVec2& size);
|
||||
void ImGuiEndGroupPanel();
|
||||
void ImGuiTextCenter(std::string_view text);
|
||||
bool ImGuiButtonCenter(std::string_view text);
|
||||
float ImGuiScale();
|
||||
} // namespace dusk
|
||||
|
||||
|
||||
@@ -6,13 +6,6 @@
|
||||
#include "ImGuiMenuGame.hpp"
|
||||
|
||||
namespace dusk {
|
||||
void TextCenter(const std::string& text) {
|
||||
float font_size = ImGui::GetFontSize() * text.size() / 2;
|
||||
ImGui::SameLine(ImGui::GetWindowSize().x / 2 - font_size + (font_size / 2));
|
||||
|
||||
ImGui::TextUnformatted(text.c_str());
|
||||
}
|
||||
|
||||
void ImGuiMenuGame::windowInputViewer() {
|
||||
if (!m_showInputViewer) {
|
||||
return;
|
||||
@@ -35,7 +28,7 @@ namespace dusk {
|
||||
if (ImGui::Begin("Input Viewer", nullptr, windowFlags)) {
|
||||
float scale = ImGuiScale();
|
||||
if (!m_controllerName.empty()) {
|
||||
TextCenter(m_controllerName);
|
||||
ImGuiTextCenter(m_controllerName);
|
||||
ImGui::Separator();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <aurora/imgui.h>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <fmt/format.h>
|
||||
#include <string>
|
||||
|
||||
#include "dusk/logging.h"
|
||||
@@ -32,66 +33,64 @@ bool AssetExists(const std::string& path) {
|
||||
|
||||
ImFont* ImGuiEngine::fontNormal;
|
||||
ImFont* ImGuiEngine::fontLarge;
|
||||
ImTextureID ImGuiEngine::duskIcon;
|
||||
ImFont* ImGuiEngine::fontExtraLarge;
|
||||
ImFont* ImGuiEngine::fontMono;
|
||||
ImTextureID ImGuiEngine::duskIcon = 0;
|
||||
|
||||
inline ImFont* CreateFont(float size, const std::string& fontPath, std::string_view fontName) {
|
||||
bool fontFileExists = !fontPath.empty() && AssetExists(fontPath);
|
||||
ImFontConfig fontConfig{};
|
||||
fontConfig.SizePixels = size;
|
||||
auto name = fmt::format_to_n(fontConfig.Name, sizeof(fontConfig.Name) - 1, "{}, {}px", fontName,
|
||||
static_cast<int>(fontConfig.SizePixels));
|
||||
*name.out = '\0';
|
||||
const ImGuiIO& io = ImGui::GetIO();
|
||||
ImFont* outFont =
|
||||
fontFileExists ?
|
||||
io.Fonts->AddFontFromFileTTF(fontPath.c_str(), fontConfig.SizePixels, &fontConfig) :
|
||||
nullptr;
|
||||
if (outFont == nullptr) {
|
||||
if (fontFileExists) {
|
||||
DuskLog.warn("Failed to load font '{}': {}", fontPath, SDL_GetError());
|
||||
}
|
||||
outFont = io.Fonts->AddFontDefault(&fontConfig);
|
||||
}
|
||||
return outFont;
|
||||
}
|
||||
|
||||
void ImGuiEngine_Initialize(float scale) {
|
||||
// Round font scale to nearest integer
|
||||
scale = std::ceilf(scale);
|
||||
|
||||
ImGui::GetCurrentContext();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.Fonts->Clear();
|
||||
io.FontGlobalScale = scale > 0.0f ? 1.0f / scale : 1.0f;
|
||||
|
||||
const std::string fontPath = GetAssetPath("NotoMono-Regular.ttf");
|
||||
const bool hasFontFile = AssetExists(fontPath);
|
||||
|
||||
ImFontConfig fontConfig{};
|
||||
fontConfig.SizePixels = std::floor(15.f * scale);
|
||||
snprintf(static_cast<char*>(fontConfig.Name), sizeof(fontConfig.Name),
|
||||
"Noto Mono Regular, %dpx", static_cast<int>(fontConfig.SizePixels));
|
||||
ImGuiEngine::fontNormal =
|
||||
hasFontFile ?
|
||||
io.Fonts->AddFontFromFileTTF(fontPath.c_str(), fontConfig.SizePixels, &fontConfig) :
|
||||
nullptr;
|
||||
if (ImGuiEngine::fontNormal == nullptr) {
|
||||
if (hasFontFile) {
|
||||
DuskLog.warn("Failed to load font '{}': {}", fontPath, SDL_GetError());
|
||||
}
|
||||
ImGuiEngine::fontNormal = io.Fonts->AddFontDefault(&fontConfig);
|
||||
}
|
||||
|
||||
fontConfig.SizePixels = std::floor(26.f * scale);
|
||||
#ifdef IMGUI_ENABLE_FREETYPE
|
||||
fontConfig.FontBuilderFlags |= ImGuiFreeTypeBuilderFlags_Bold;
|
||||
snprintf(static_cast<char*>(fontConfig.Name), sizeof(fontConfig.Name), "Noto Mono Bold, %dpx",
|
||||
static_cast<int>(fontConfig.SizePixels));
|
||||
#else
|
||||
snprintf(static_cast<char*>(fontConfig.Name), sizeof(fontConfig.Name),
|
||||
"Noto Mono Regular, %dpx", static_cast<int>(fontConfig.SizePixels));
|
||||
#endif
|
||||
CreateFont(std::floor(18.f * scale), GetAssetPath("Inter-Regular.ttf"), "Inter Regular");
|
||||
ImGuiEngine::fontLarge =
|
||||
hasFontFile ?
|
||||
io.Fonts->AddFontFromFileTTF(fontPath.c_str(), fontConfig.SizePixels, &fontConfig) :
|
||||
nullptr;
|
||||
if (ImGuiEngine::fontLarge == nullptr) {
|
||||
if (hasFontFile) {
|
||||
DuskLog.warn("Failed to load font '{}': {}", fontPath, SDL_GetError());
|
||||
}
|
||||
ImGuiEngine::fontLarge = io.Fonts->AddFontDefault(&fontConfig);
|
||||
}
|
||||
CreateFont(std::floor(26.f * scale), GetAssetPath("Inter-Regular.ttf"), "Inter Regular");
|
||||
ImGuiEngine::fontExtraLarge =
|
||||
CreateFont(std::floor(40.f * scale), GetAssetPath("Inter-Bold.ttf"), "Inter Bold");
|
||||
ImGuiEngine::fontMono =
|
||||
CreateFont(std::floor(16.f * scale), GetAssetPath("NotoMono-Regular.ttf"),
|
||||
"Noto Mono Regular");
|
||||
|
||||
auto& style = ImGui::GetStyle();
|
||||
style = {}; // Reset sizes
|
||||
style.WindowPadding = ImVec2(15, 15);
|
||||
style.WindowRounding = 5.0f;
|
||||
style.FrameBorderSize = 1.f;
|
||||
style.FramePadding = ImVec2(5, 5);
|
||||
style.FramePadding = ImVec2(8, 5);
|
||||
style.FrameRounding = 4.0f;
|
||||
style.ItemSpacing = ImVec2(12, 8);
|
||||
style.ItemInnerSpacing = ImVec2(8, 6);
|
||||
style.IndentSpacing = 25.0f;
|
||||
style.ScrollbarSize = 15.0f;
|
||||
style.ScrollbarRounding = 9.0f;
|
||||
style.GrabMinSize = 5.0f;
|
||||
style.GrabRounding = 3.0f;
|
||||
style.GrabMinSize = 20.0f;
|
||||
style.GrabRounding = 5.0f;
|
||||
style.PopupBorderSize = 1.f;
|
||||
style.PopupRounding = 7.0;
|
||||
style.TabBorderSize = 1.f;
|
||||
@@ -146,25 +145,23 @@ void ImGuiEngine_Initialize(float scale) {
|
||||
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
|
||||
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
|
||||
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f);
|
||||
|
||||
}
|
||||
|
||||
Icon GetIcon() {
|
||||
const std::string iconPath = GetAssetPath("icon.png");
|
||||
if (!AssetExists(iconPath)) {
|
||||
Image GetImage(const std::string& path) {
|
||||
if (!AssetExists(path)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
SDL_Surface* loadedSurface = SDL_LoadPNG(iconPath.c_str());
|
||||
SDL_Surface* loadedSurface = SDL_LoadPNG(path.c_str());
|
||||
if (loadedSurface == nullptr) {
|
||||
DuskLog.warn("Failed to load icon '{}': {}", iconPath, SDL_GetError());
|
||||
DuskLog.warn("Failed to load image '{}': {}", path, SDL_GetError());
|
||||
return {};
|
||||
}
|
||||
|
||||
SDL_Surface* rgbaSurface = SDL_ConvertSurface(loadedSurface, SDL_PIXELFORMAT_RGBA32);
|
||||
SDL_DestroySurface(loadedSurface);
|
||||
if (rgbaSurface == nullptr) {
|
||||
DuskLog.warn("Failed to convert icon '{}': {}", iconPath, SDL_GetError());
|
||||
DuskLog.warn("Failed to convert image '{}': {}", path, SDL_GetError());
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -181,7 +178,7 @@ Icon GetIcon() {
|
||||
}
|
||||
|
||||
SDL_DestroySurface(rgbaSurface);
|
||||
return Icon{
|
||||
return Image{
|
||||
std::move(ptr),
|
||||
size,
|
||||
iconWidth,
|
||||
@@ -190,12 +187,13 @@ Icon GetIcon() {
|
||||
}
|
||||
|
||||
void ImGuiEngine_AddTextures() {
|
||||
auto icon = GetIcon();
|
||||
if (icon.data == nullptr || icon.width == 0 || icon.height == 0) {
|
||||
ImGuiEngine::duskIcon = 0;
|
||||
return;
|
||||
if (ImGuiEngine::duskIcon == 0) {
|
||||
auto icon = GetImage(GetAssetPath("icon.png"));
|
||||
if (icon.data == nullptr || icon.width == 0 || icon.height == 0) {
|
||||
ImGuiEngine::duskIcon = 0;
|
||||
return;
|
||||
}
|
||||
ImGuiEngine::duskIcon = aurora_imgui_add_texture(icon.width, icon.height, icon.data.get());
|
||||
}
|
||||
|
||||
ImGuiEngine::duskIcon = aurora_imgui_add_texture(icon.width, icon.height, icon.data.get());
|
||||
}
|
||||
} // namespace dusk
|
||||
|
||||
@@ -9,17 +9,19 @@ class ImGuiEngine {
|
||||
public:
|
||||
static ImFont* fontNormal;
|
||||
static ImFont* fontLarge;
|
||||
static ImFont* fontExtraLarge;
|
||||
static ImFont* fontMono;
|
||||
static ImTextureID duskIcon;
|
||||
};
|
||||
|
||||
void ImGuiEngine_Initialize(float scale);
|
||||
void ImGuiEngine_AddTextures();
|
||||
|
||||
struct Icon {
|
||||
struct Image {
|
||||
std::unique_ptr<uint8_t[]> data;
|
||||
size_t size;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
};
|
||||
Icon GetIcon();
|
||||
Image GetImage(std::string_view path);
|
||||
} // namespace dusk
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace dusk {
|
||||
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_AlwaysAutoResize |
|
||||
ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
|
||||
|
||||
ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
// ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
|
||||
if (!ImGui::Begin("Map Loader", &m_showMapLoader, windowFlags)) {
|
||||
ImGui::End();
|
||||
|
||||
@@ -14,48 +14,48 @@ namespace dusk {
|
||||
|
||||
config::ImGuiCheckbox("Bigger Wallets", getSettings().game.biggerWallets);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Wallet sizes are like in the HD version (500, 1000, 2000)");
|
||||
ImGui::SetTooltip("Wallet sizes are like in the HD version. (500, 1000, 2000)");
|
||||
}
|
||||
|
||||
config::ImGuiCheckbox("No Rupee Returns", getSettings().game.noReturnRupees);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Always collect Rupees even if your Wallet is too full");
|
||||
ImGui::SetTooltip("Always collect Rupees even if your Wallet is too full.");
|
||||
}
|
||||
|
||||
config::ImGuiCheckbox("Disable Rupee Cutscenes", getSettings().game.disableRupeeCutscenes);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Rupees won't play cutscenes after you've collected them the first time");
|
||||
ImGui::SetTooltip("Rupees won't play cutscenes after you've collected them the first time.");
|
||||
}
|
||||
|
||||
config::ImGuiCheckbox("No Sword Recoil", getSettings().game.noSwordRecoil);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Link won't recoil when his sword hits walls");
|
||||
ImGui::SetTooltip("Link won't recoil when his sword hits walls.");
|
||||
}
|
||||
|
||||
config::ImGuiCheckbox("Faster Climbing", getSettings().game.fastClimbing);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Quicker climbing on ladders and vines like the HD version");
|
||||
ImGui::SetTooltip("Quicker climbing on ladders and vines like the HD version.");
|
||||
}
|
||||
|
||||
config::ImGuiCheckbox("No Climbing Miss Animation", getSettings().game.noMissClimbing);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Prevents Link from playing a struggle animation\n"
|
||||
"when using the Clawshot on vines at a weird angle");
|
||||
"when grabbing ledges or climbing on vines.");
|
||||
}
|
||||
|
||||
config::ImGuiCheckbox("Faster Tears of Light", getSettings().game.fastTears);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Tears of Light dropped by Shadow Insects pop out faster like the HD version");
|
||||
ImGui::SetTooltip("Tears of Light dropped by Shadow Insects pop out faster like the HD version.");
|
||||
}
|
||||
|
||||
config::ImGuiCheckbox("Hide TV Settings Screen", getSettings().game.hideTvSettingsScreen);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Hides the TV calibration screen shown when loading a save");
|
||||
ImGui::SetTooltip("Hides the TV calibration screen shown when loading a save.");
|
||||
}
|
||||
|
||||
|
||||
config::ImGuiCheckbox("Instant Saves", getSettings().game.instantSaves);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Skip the delay when writing to the Memory Card");
|
||||
ImGui::SetTooltip("Skip the delay when writing to the Memory Card.");
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
@@ -64,7 +64,7 @@ namespace dusk {
|
||||
if (ImGui::BeginMenu("Preferences")) {
|
||||
config::ImGuiCheckbox("Mirror Mode", getSettings().game.enableMirrorMode);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Mirrors the world, matching the Wii version of the game");
|
||||
ImGui::SetTooltip("Mirrors the world, matching the Wii version of the game.");
|
||||
}
|
||||
|
||||
config::ImGuiCheckbox("Invert Camera X Axis", getSettings().game.invertCameraXAxis);
|
||||
@@ -73,12 +73,16 @@ namespace dusk {
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("Graphics")) {
|
||||
config::ImGuiCheckbox("Native Bloom", getSettings().game.enableBloom);
|
||||
config::ImGuiCheckbox("Unlock Framerate", getSettings().game.enableFrameInterpolation);
|
||||
const bool frameInterpolationHovered = ImGui::IsItemHovered();
|
||||
|
||||
config::ImGuiCheckbox("Water Projection Offset", getSettings().game.useWaterProjectionOffset);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Adds GC-specific -0.01 transS offset\n"
|
||||
"that causes ~6px ghost artifacts in water reflections");
|
||||
ImGui::SameLine();
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.72f, 0.2f, 1.0f));
|
||||
ImGui::TextUnformatted("[EXPERIMENTAL]");
|
||||
ImGui::PopStyleColor();
|
||||
|
||||
if (frameInterpolationHovered || ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Uses inter-frame interpolation to enable higher frame rates.\nVisual artifacts, animation glitches, or instability may occur.");
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
@@ -87,12 +91,12 @@ namespace dusk {
|
||||
if (ImGui::BeginMenu("Audio")) {
|
||||
config::ImGuiCheckbox("No Low HP Sound", getSettings().game.noLowHpSound);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Disable the beeping sound when having low health");
|
||||
ImGui::SetTooltip("Disable the beeping sound when having low health.");
|
||||
}
|
||||
|
||||
config::ImGuiCheckbox("Non-Stop Midna's Lament", getSettings().game.midnasLamentNonStop);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Prevents enemy music while Midna's Lament is playing");
|
||||
ImGui::SetTooltip("Prevents enemy music while Midna's Lament is playing.");
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
@@ -103,7 +107,7 @@ namespace dusk {
|
||||
|
||||
config::ImGuiCheckbox("Can Transform Anywhere", getSettings().game.canTransformAnywhere);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Allows you to transform even if NPCs are looking");
|
||||
ImGui::SetTooltip("Allows you to transform even if NPCs are looking.");
|
||||
}
|
||||
|
||||
config::ImGuiCheckbox("Fast Spinner", getSettings().game.fastSpinner);
|
||||
@@ -124,7 +128,7 @@ namespace dusk {
|
||||
|
||||
config::ImGuiCheckbox("Instant Death", getSettings().game.instantDeath);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Any hit will instantly kill you");
|
||||
ImGui::SetTooltip("Any hit will instantly kill you.");
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
@@ -134,7 +138,7 @@ namespace dusk {
|
||||
config::ImGuiCheckbox("Restore Wii 1.0 Glitches", getSettings().game.restoreWiiGlitches);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Restores patched glitches from Wii USA 1.0,\n"
|
||||
"the first released version");
|
||||
"the first released version.");
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
@@ -142,6 +146,10 @@ namespace dusk {
|
||||
|
||||
if (ImGui::BeginMenu("Tools")) {
|
||||
config::ImGuiCheckbox("Enable Turbo Key", getSettings().game.enableTurboKeybind);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Holding TAB will speed up the game.\n"
|
||||
"This will not work with the \"Unlock Framerate\" enhancement.");
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include <aurora/gfx.h>
|
||||
#include <SDL3/SDL_gamepad.h>
|
||||
|
||||
#include "dusk/main.h"
|
||||
|
||||
namespace dusk {
|
||||
void ImGuiMenuGame::ToggleFullscreen() {
|
||||
getSettings().video.enableFullscreen.setValue(!getSettings().video.enableFullscreen);
|
||||
@@ -29,12 +31,6 @@ namespace dusk {
|
||||
|
||||
void ImGuiMenuGame::draw() {
|
||||
if (ImGui::BeginMenu("Game")) {
|
||||
if (ImGui::MenuItem("Reset", hotkeys::DO_RESET)) {
|
||||
JUTGamePad::C3ButtonReset::sResetSwitchPushing = true;
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::BeginMenu("Graphics")) {
|
||||
if (ImGui::MenuItem("Toggle Fullscreen", hotkeys::TOGGLE_FULLSCREEN)) {
|
||||
ToggleFullscreen();
|
||||
@@ -67,6 +63,14 @@ namespace dusk {
|
||||
config::Save();
|
||||
}
|
||||
|
||||
config::ImGuiCheckbox("Native Bloom", getSettings().game.enableBloom);
|
||||
|
||||
config::ImGuiCheckbox("Water Projection Offset", getSettings().game.useWaterProjectionOffset);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Adds GC-specific -0.01 transS offset\n"
|
||||
"that causes ~6px ghost artifacts in water reflections.");
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
@@ -108,11 +112,25 @@ namespace dusk {
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("Interface")) {
|
||||
config::ImGuiCheckbox("Skip Pre-Launch UI", getSettings().backend.skipPreLaunchUI);
|
||||
config::ImGuiCheckbox("Show Pipeline Compilation", getSettings().backend.showPipelineCompilation);
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::MenuItem("Reset", hotkeys::DO_RESET)) {
|
||||
JUTGamePad::C3ButtonReset::sResetSwitchPushing = true;
|
||||
}
|
||||
|
||||
if (ImGui::MenuItem("Exit")) {
|
||||
dusk::IsRunning = false;
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
windowInputViewer();
|
||||
windowControllerConfig();
|
||||
}
|
||||
|
||||
static void drawVirtualStick(const char* id, const ImVec2& stick) {
|
||||
@@ -293,7 +311,7 @@ namespace dusk {
|
||||
ImGuiWindowFlags_NoResize |
|
||||
ImGuiWindowFlags_AlwaysAutoResize;
|
||||
|
||||
ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
// ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
|
||||
if (!ImGui::Begin("Controller Config", &m_showControllerConfig, windowFlags)) {
|
||||
ImGui::End();
|
||||
@@ -376,6 +394,7 @@ namespace dusk {
|
||||
|
||||
// buttons panel
|
||||
const float uiButtonSize = 40 * scale;
|
||||
ImVec2 btnSize(110.0f * scale, 30.0f * scale);
|
||||
|
||||
ImGuiBeginGroupPanel("Buttons", ImVec2(150 * scale, 20 * scale));
|
||||
|
||||
@@ -399,10 +418,14 @@ namespace dusk {
|
||||
if (m_controllerConfig.m_isReading && m_controllerConfig.m_pendingButtonMapping == &btnMappingList[i]) {
|
||||
dispName = fmt::format("Press a Key...##{}", btnName);
|
||||
} else {
|
||||
dispName = fmt::format("{0}##-{1}", GetNameForGamepadButton(gamepad, btnMappingList[i].nativeButton), i);
|
||||
const char* nativeName = GetNameForGamepadButton(gamepad, btnMappingList[i].nativeButton);
|
||||
if (nativeName == nullptr) {
|
||||
nativeName = "[unbound]";
|
||||
}
|
||||
dispName = fmt::format("{0}##-{1}", nativeName, i);
|
||||
}
|
||||
bool pressed = ImGui::Button(dispName.c_str(),
|
||||
ImVec2(100.0f * scale, 20.0f * scale));
|
||||
btnSize);
|
||||
|
||||
if (pressed) {
|
||||
m_controllerConfig.m_isReading = true;
|
||||
@@ -442,7 +465,7 @@ namespace dusk {
|
||||
dispName = fmt::format("{0}##-{1}", PADGetNativeAxisName(axisMappingList[trigger].nativeAxis), trigger);
|
||||
}
|
||||
bool pressed = ImGui::Button(dispName.c_str(),
|
||||
ImVec2(100.0f * scale, 20.0f * scale));
|
||||
btnSize);
|
||||
|
||||
if (pressed) {
|
||||
m_controllerConfig.m_isReading = true;
|
||||
@@ -519,7 +542,7 @@ namespace dusk {
|
||||
dispName = fmt::format("{0}##-{1}", PADGetNativeButtonName(axisMappingList[axis].nativeButton), axis);
|
||||
}
|
||||
}
|
||||
bool pressed = ImGui::Button(dispName.c_str(), ImVec2(100.0f * scale, 20.0f * scale));
|
||||
bool pressed = ImGui::Button(dispName.c_str(), btnSize);
|
||||
|
||||
if (pressed) {
|
||||
m_controllerConfig.m_isReading = true;
|
||||
@@ -581,7 +604,7 @@ namespace dusk {
|
||||
dispName = fmt::format("{0}##-{1}", PADGetNativeButtonName(axisMappingList[axis].nativeButton), axis);
|
||||
}
|
||||
}
|
||||
bool pressed = ImGui::Button(fmt::format("{0}##sub{1}", dispName, label).c_str(), ImVec2(100.0f * scale, 20.0f * scale));
|
||||
bool pressed = ImGui::Button(fmt::format("{0}##sub{1}", dispName, label).c_str(), btnSize);
|
||||
|
||||
if (pressed) {
|
||||
m_controllerConfig.m_isReading = true;
|
||||
|
||||
@@ -7,21 +7,22 @@
|
||||
#include "ImGuiConsole.hpp"
|
||||
#include "ImGuiMenuTools.hpp"
|
||||
|
||||
#include "ImGuiEngine.hpp"
|
||||
#include "d/actor/d_a_alink.h"
|
||||
#include "d/actor/d_a_horse.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "dusk/dusk.h"
|
||||
#include "dusk/main.h"
|
||||
#include "m_Do/m_Do_main.h"
|
||||
|
||||
namespace dusk {
|
||||
ImGuiMenuTools::ImGuiMenuTools() {}
|
||||
|
||||
void ImGuiMenuTools::draw() {
|
||||
bool isToggleDevelopmentMode = false;
|
||||
|
||||
if (ImGui::BeginMenu("Debug")) {
|
||||
if (ImGui::Checkbox("Development Mode", &m_isDevelopmentMode)) {
|
||||
isToggleDevelopmentMode = true;
|
||||
bool developmentMode = mDoMain::developmentMode == 1;
|
||||
if (ImGui::Checkbox("Development Mode", &developmentMode)) {
|
||||
mDoMain::developmentMode = developmentMode ? 1 : -1;
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
@@ -40,6 +41,10 @@ namespace dusk {
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (!dusk::IsGameLaunched) {
|
||||
ImGui::BeginDisabled();
|
||||
}
|
||||
|
||||
ImGui::MenuItem("Process Management", hotkeys::SHOW_PROCESS_MANAGEMENT, &m_showProcessManagement);
|
||||
ImGui::MenuItem("Debug Overlay", hotkeys::SHOW_DEBUG_OVERLAY, &m_showDebugOverlay);
|
||||
ImGui::MenuItem("Heap Viewer", hotkeys::SHOW_HEAP_VIEWER, &m_showHeapOverlay);
|
||||
@@ -49,28 +54,14 @@ namespace dusk {
|
||||
ImGui::MenuItem("Player Info", nullptr, &m_showPlayerInfo);
|
||||
ImGui::MenuItem("Save Editor", nullptr, &m_showSaveEditor);
|
||||
ImGui::MenuItem("Audio Debug", hotkeys::SHOW_AUDIO_DEBUG, &m_showAudioDebug);
|
||||
|
||||
if (!dusk::IsGameLaunched) {
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
|
||||
ImGui::MenuItem("OSReport Force", nullptr, &OSReportReallyForceEnable);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (isToggleDevelopmentMode) {
|
||||
mDoMain::developmentMode = m_isDevelopmentMode ? 1 : -1;
|
||||
}
|
||||
|
||||
ShowDebugOverlay();
|
||||
ShowCameraOverlay();
|
||||
ShowProcessManager();
|
||||
ShowHeapOverlay();
|
||||
ShowStubLog();
|
||||
ShowMapLoader();
|
||||
ShowPlayerInfo();
|
||||
ShowAudioDebug();
|
||||
|
||||
if (m_showSaveEditor) {
|
||||
m_saveEditor.draw(m_showSaveEditor);
|
||||
}
|
||||
|
||||
DuskDebugPad(); // temporary, remove later
|
||||
}
|
||||
|
||||
void ImGuiMenuTools::ShowDebugOverlay() {
|
||||
@@ -78,6 +69,8 @@ namespace dusk {
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui::PushFont(ImGuiEngine::fontMono);
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration |
|
||||
ImGuiWindowFlags_AlwaysAutoResize |
|
||||
@@ -90,26 +83,14 @@ namespace dusk {
|
||||
|
||||
ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
if (ImGui::Begin("Debug Overlay", nullptr, windowFlags)) {
|
||||
bool hasPrevious = false;
|
||||
if (hasPrevious) {
|
||||
ImGui::Separator();
|
||||
}
|
||||
hasPrevious = true;
|
||||
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("FPS: {:.2f}\n"), io.Framerate));
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Frame usage: {:.1f}%\n"), frameUsagePct));
|
||||
|
||||
if (hasPrevious) {
|
||||
ImGui::Separator();
|
||||
}
|
||||
hasPrevious = true;
|
||||
ImGui::Separator();
|
||||
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Backend: {}\n"), backend_name(aurora_get_backend())));
|
||||
|
||||
if (hasPrevious) {
|
||||
ImGui::Separator();
|
||||
}
|
||||
hasPrevious = true;
|
||||
ImGui::Separator();
|
||||
|
||||
const auto& stats = lastFrameAuroraStats;
|
||||
|
||||
@@ -141,6 +122,8 @@ namespace dusk {
|
||||
ShowCornerContextMenu(m_debugOverlayCorner, m_cameraOverlayCorner);
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void ImGuiMenuTools::ShowPlayerInfo() {
|
||||
@@ -148,13 +131,20 @@ namespace dusk {
|
||||
return;
|
||||
}
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGuiWindowFlags windowFlags =
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize;
|
||||
ImGui::PushFont(ImGuiEngine::fontMono);
|
||||
|
||||
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration |
|
||||
ImGuiWindowFlags_AlwaysAutoResize |
|
||||
ImGuiWindowFlags_NoFocusOnAppearing |
|
||||
ImGuiWindowFlags_NoNav;
|
||||
if (m_playerInfoOverlayCorner != -1) {
|
||||
SetOverlayWindowLocation(m_playerInfoOverlayCorner);
|
||||
windowFlags |= ImGuiWindowFlags_NoMove;
|
||||
}
|
||||
|
||||
ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
|
||||
if (ImGui::Begin("Player Info", &m_showPlayerInfo, windowFlags)) {
|
||||
if (ImGui::Begin("Player Info", nullptr, windowFlags)) {
|
||||
daAlink_c* player = (daAlink_c*)dComIfGp_getPlayer(0);
|
||||
daHorse_c* horse = dComIfGp_getHorseActor();
|
||||
|
||||
@@ -196,8 +186,11 @@ namespace dusk {
|
||||
? fmt::format("Speed: {0}\n", horse->speedF)
|
||||
: "Speed: ?\n"
|
||||
);
|
||||
|
||||
ShowCornerContextMenu(m_playerInfoOverlayCorner, m_debugOverlayCorner);
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
ImGui::PopFont();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace dusk {
|
||||
void ShowMapLoader();
|
||||
void ShowPlayerInfo();
|
||||
void ShowAudioDebug();
|
||||
void ShowSaveEditor();
|
||||
|
||||
private:
|
||||
bool m_showDebugOverlay = false;
|
||||
@@ -51,8 +52,8 @@ namespace dusk {
|
||||
bool showInternalNames = false;
|
||||
} m_mapLoaderInfo;
|
||||
|
||||
bool m_isDevelopmentMode = false;
|
||||
bool m_showPlayerInfo = false;
|
||||
int m_playerInfoOverlayCorner = 1; // top-right
|
||||
|
||||
bool m_showSaveEditor = false;
|
||||
ImGuiSaveEditor m_saveEditor;
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
#include "imgui.h"
|
||||
|
||||
#include "ImGuiConfig.hpp"
|
||||
#include "ImGuiEngine.hpp"
|
||||
#include "ImGuiPreLaunchWindow.hpp"
|
||||
|
||||
#include "ImGuiConsole.hpp"
|
||||
#include "dusk/main.h"
|
||||
#include "dusk/settings.h"
|
||||
|
||||
#include <SDL3/SDL_dialog.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
#include <SDL3/SDL_filesystem.h>
|
||||
|
||||
#include "aurora/lib/internal.hpp"
|
||||
#include "aurora/lib/window.hpp"
|
||||
|
||||
namespace dusk {
|
||||
|
||||
typedef void (ImGuiPreLaunchWindow::*drawFunc)();
|
||||
|
||||
drawFunc drawTable[2] = {&ImGuiPreLaunchWindow::drawMainMenu, &ImGuiPreLaunchWindow::drawOptions};
|
||||
|
||||
static constexpr std::array<SDL_DialogFileFilter, 2> skGameDiscFileFilters{{
|
||||
{"Game Disc Images", "iso;gcm;ciso;gcz;nfs;rvz;wbfs;wia;tgc"},
|
||||
{"All Files", "*"},
|
||||
}};
|
||||
|
||||
void fileDialogCallback(void* userdata, const char* const* filelist, [[maybe_unused]] int filter) {
|
||||
auto* self = static_cast<ImGuiPreLaunchWindow*>(userdata);
|
||||
if (filelist != nullptr) {
|
||||
if (filelist[0] == nullptr) {
|
||||
// Cancelled
|
||||
self->m_selectedIsoPath.clear();
|
||||
} else {
|
||||
self->m_selectedIsoPath = filelist[0];
|
||||
getSettings().backend.isoPath.setValue(self->m_selectedIsoPath);
|
||||
config::Save();
|
||||
}
|
||||
} else {
|
||||
// Error occurred
|
||||
self->m_selectedIsoPath.clear();
|
||||
self->m_errorString = fmt::format("File dialog error: {}", SDL_GetError());
|
||||
}
|
||||
}
|
||||
|
||||
ImGuiPreLaunchWindow::ImGuiPreLaunchWindow() = default;
|
||||
|
||||
bool ImGuiPreLaunchWindow::isSelectedPathValid() const {
|
||||
return !m_selectedIsoPath.empty() && SDL_GetPathInfo(m_selectedIsoPath.c_str(), nullptr);
|
||||
}
|
||||
|
||||
void ImGuiPreLaunchWindow::draw() {
|
||||
if (m_IsFirstDraw) {
|
||||
m_selectedIsoPath = getSettings().backend.isoPath;
|
||||
m_initialGraphicsBackend = getSettings().backend.graphicsBackend;
|
||||
m_IsFirstDraw = false;
|
||||
}
|
||||
|
||||
if (isSelectedPathValid() && getSettings().backend.skipPreLaunchUI) {
|
||||
dusk::IsGameLaunched = true;
|
||||
return;
|
||||
}
|
||||
|
||||
auto& io = ImGui::GetIO();
|
||||
|
||||
ImGui::SetNextWindowSize(ImVec2(io.DisplaySize.x, io.DisplaySize.y));
|
||||
ImGui::SetNextWindowPos(ImVec2(0, 0));
|
||||
ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
|
||||
ImGui::Begin("Pre Launch Window", nullptr,
|
||||
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoResize |
|
||||
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing |
|
||||
ImGuiWindowFlags_NoBringToFrontOnFocus);
|
||||
|
||||
const auto& windowSize = ImGui::GetWindowSize();
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
ImGui::NewLine();
|
||||
|
||||
float iconSize = 150.f;
|
||||
ImGui::SameLine(windowSize.x / 2 - iconSize + (iconSize / 2));
|
||||
if (ImGuiEngine::duskIcon != 0)
|
||||
ImGui::Image(ImGuiEngine::duskIcon, ImVec2{iconSize, iconSize});
|
||||
ImGuiTextCenter("Twilit Realm presents");
|
||||
ImGui::PushFont(ImGuiEngine::fontExtraLarge);
|
||||
ImGuiTextCenter("Dusk");
|
||||
ImGui::PopFont();
|
||||
|
||||
(this->*drawTable[m_CurMenu])();
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void ImGuiPreLaunchWindow::drawMainMenu() {
|
||||
const auto& windowSize = ImGui::GetWindowSize();
|
||||
ImGui::SetCursorPosY(windowSize.y - 200);
|
||||
|
||||
ImGui::PushFont(ImGuiEngine::fontLarge);
|
||||
|
||||
if (m_selectedIsoPath.empty() || !SDL_GetPathInfo(m_selectedIsoPath.c_str(), nullptr)) {
|
||||
if (ImGuiButtonCenter("Select disc image...")) {
|
||||
SDL_ShowOpenFileDialog(&fileDialogCallback, this, aurora::window::get_sdl_window(),
|
||||
skGameDiscFileFilters.data(), int(skGameDiscFileFilters.size()),
|
||||
nullptr, false);
|
||||
}
|
||||
} else {
|
||||
if (ImGuiButtonCenter("Start game")) {
|
||||
dusk::IsGameLaunched = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGuiButtonCenter("Options")) {
|
||||
m_CurMenu = 1;
|
||||
}
|
||||
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void ImGuiPreLaunchWindow::drawOptions() {
|
||||
const auto& windowSize = ImGui::GetWindowSize();
|
||||
|
||||
ImGui::NewLine();
|
||||
|
||||
ImGui::PushFont(ImGuiEngine::fontLarge);
|
||||
ImGuiTextCenter("Options");
|
||||
ImGui::Separator();
|
||||
ImGui::PopFont();
|
||||
|
||||
auto cursorY = ImGui::GetCursorPosY();
|
||||
float endCursorY = windowSize.y - 100;
|
||||
|
||||
float childWidth = windowSize.x - 400;
|
||||
|
||||
ImGui::SetCursorPosX(windowSize.x / 2 - (childWidth / 2));
|
||||
if (ImGui::BeginChild("OptionsChild", ImVec2(childWidth, endCursorY - cursorY),
|
||||
ImGuiChildFlags_None, ImGuiWindowFlags_NoBackground))
|
||||
{
|
||||
ImGui::InputText("Game ISO Path", &m_selectedIsoPath, ImGuiInputTextFlags_ReadOnly);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Set")) {
|
||||
SDL_ShowOpenFileDialog(&fileDialogCallback, this, aurora::window::get_sdl_window(),
|
||||
skGameDiscFileFilters.data(), int(skGameDiscFileFilters.size()),
|
||||
nullptr, false);
|
||||
}
|
||||
|
||||
AuroraBackend configuredBackend = BACKEND_AUTO;
|
||||
const std::string& configuredBackendId = getSettings().backend.graphicsBackend;
|
||||
if (!try_parse_backend(configuredBackendId, configuredBackend)) {
|
||||
configuredBackend = BACKEND_AUTO;
|
||||
}
|
||||
|
||||
if (ImGui::BeginCombo("Graphics Backend", backend_name(configuredBackend).data())) {
|
||||
if (ImGui::Selectable("Auto", configuredBackend == BACKEND_AUTO)) {
|
||||
getSettings().backend.graphicsBackend.setValue("auto");
|
||||
config::Save();
|
||||
}
|
||||
|
||||
size_t backendCount = 0;
|
||||
const AuroraBackend* availableBackends = aurora_get_available_backends(&backendCount);
|
||||
for (size_t i = 0; i < backendCount; ++i) {
|
||||
const AuroraBackend backend = availableBackends[i];
|
||||
const bool isSelected = configuredBackend == backend;
|
||||
if (ImGui::Selectable(backend_name(backend).data(), isSelected)) {
|
||||
getSettings().backend.graphicsBackend.setValue(
|
||||
std::string(backend_id(backend)));
|
||||
config::Save();
|
||||
}
|
||||
if (isSelected) {
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
if (configuredBackendId != m_initialGraphicsBackend) {
|
||||
ImGui::TextDisabled("Restart Required");
|
||||
}
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
ImGui::SetCursorPosY(endCursorY);
|
||||
ImGui::NewLine();
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::PushFont(ImGuiEngine::fontLarge);
|
||||
if (ImGuiButtonCenter("Back")) {
|
||||
m_CurMenu = 0;
|
||||
}
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
} // namespace dusk
|
||||
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
namespace dusk {
|
||||
class ImGuiPreLaunchWindow {
|
||||
private:
|
||||
int m_CurMenu = 0;
|
||||
bool m_IsFirstDraw = true;
|
||||
std::string m_initialGraphicsBackend;
|
||||
|
||||
bool isSelectedPathValid() const;
|
||||
|
||||
public:
|
||||
ImGuiPreLaunchWindow();
|
||||
void draw();
|
||||
|
||||
void drawMainMenu();
|
||||
void drawOptions();
|
||||
|
||||
std::string m_selectedIsoPath;
|
||||
std::string m_errorString;
|
||||
};
|
||||
} // namespace dusk
|
||||
@@ -287,7 +287,7 @@ namespace dusk {
|
||||
ImGuiWindowFlags windowFlags =
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize;
|
||||
|
||||
ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
// ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
|
||||
if (ImGui::Begin("Save Editor", &open, windowFlags)) {
|
||||
if (ImGui::BeginTabBar("SaveEditorTabBar", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
|
||||
|
||||
@@ -41,6 +41,7 @@ UserSettings g_userSettings = {
|
||||
// Graphics
|
||||
.enableBloom {"game.enableBloom", true},
|
||||
.useWaterProjectionOffset {"game.useWaterProjectionOffset", false},
|
||||
.enableFrameInterpolation = {"game.enableFrameInterpolation", false},
|
||||
|
||||
// Audio
|
||||
.noLowHpSound {"game.noLowHpSound", false},
|
||||
@@ -58,6 +59,13 @@ UserSettings g_userSettings = {
|
||||
// Controls
|
||||
.enableTurboKeybind {"game.enableTurboKeybind", true},
|
||||
},
|
||||
|
||||
.backend = {
|
||||
.isoPath {"backend.isoPath", ""},
|
||||
.graphicsBackend {"backend.graphicsBackend", "auto"},
|
||||
.skipPreLaunchUI {"backend.skipPreLaunchUI", false},
|
||||
.showPipelineCompilation{"backend.showPipelineCompilation", false}
|
||||
}
|
||||
};
|
||||
|
||||
UserSettings& getSettings() {
|
||||
@@ -103,6 +111,12 @@ void registerSettings() {
|
||||
Register(g_userSettings.game.midnasLamentNonStop);
|
||||
Register(g_userSettings.game.enableTurboKeybind);
|
||||
Register(g_userSettings.game.fastSpinner);
|
||||
Register(g_userSettings.game.enableFrameInterpolation);
|
||||
|
||||
Register(g_userSettings.backend.isoPath);
|
||||
Register(g_userSettings.backend.graphicsBackend);
|
||||
Register(g_userSettings.backend.skipPreLaunchUI);
|
||||
Register(g_userSettings.backend.showPipelineCompilation);
|
||||
}
|
||||
|
||||
// Transient settings
|
||||
|
||||
+17
-1
@@ -14,6 +14,7 @@
|
||||
#include "d/actor/d_a_midna.h"
|
||||
#include "d/d_model.h"
|
||||
#include "d/d_tresure.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include "dusk/logging.h"
|
||||
#include "f_op/f_op_camera_mng.h"
|
||||
#include "f_op/f_op_draw_tag.h"
|
||||
@@ -722,6 +723,17 @@ void fapGm_After() {
|
||||
fopCamM_Management();
|
||||
}
|
||||
|
||||
#ifdef TARGET_PC
|
||||
static void fapGm_Before() {
|
||||
dusk::frame_interp::begin_record();
|
||||
}
|
||||
|
||||
static void fapGm_AfterRecord() {
|
||||
dusk::frame_interp::end_record();
|
||||
fapGm_After();
|
||||
}
|
||||
#endif
|
||||
|
||||
void fapGm_Execute() {
|
||||
ZoneScoped;
|
||||
static u32 sExecCount = 0;
|
||||
@@ -752,7 +764,11 @@ void fapGm_Execute() {
|
||||
}
|
||||
#endif
|
||||
|
||||
fpcM_Management(NULL, fapGm_After);
|
||||
#ifdef TARGET_PC
|
||||
fpcM_Management(fapGm_Before, fapGm_AfterRecord);
|
||||
#else
|
||||
fpcM_ManagementFunc(NULL, fapGm_After);
|
||||
#endif
|
||||
cCt_Counter(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "f_pc/f_pc_leaf.h"
|
||||
#include "f_pc/f_pc_node.h"
|
||||
#include "f_pc/f_pc_pause.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include <cstdio>
|
||||
#include "dusk/logging.h"
|
||||
|
||||
@@ -25,7 +26,13 @@ int fpcDw_Execute(base_process_class* i_proc) {
|
||||
}
|
||||
|
||||
fpcLy_SetCurrentLayer(i_proc->layer_tag.layer);
|
||||
#ifdef TARGET_PC
|
||||
dusk::frame_interp::open_child(i_proc, 0);
|
||||
#endif
|
||||
ret = draw_func(i_proc);
|
||||
#ifdef TARGET_PC
|
||||
dusk::frame_interp::close_child();
|
||||
#endif
|
||||
fpcLy_SetCurrentLayer(save_layer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "f_pc/f_pc_pause.h"
|
||||
#include "f_pc/f_pc_priority.h"
|
||||
#include "m_Do/m_Do_controller_pad.h"
|
||||
#include <cstdio>
|
||||
|
||||
#include "tracy/Tracy.hpp"
|
||||
|
||||
@@ -64,7 +63,14 @@ void fpcM_Management(fpcM_ManagementFunc i_preExecuteFn, fpcM_ManagementFunc i_p
|
||||
l_dvdError = false;
|
||||
}
|
||||
|
||||
cAPIGph_Painter();
|
||||
#ifdef TARGET_PC
|
||||
// Frame interpolation: call moved to m_Do_main
|
||||
if (!dusk::getSettings().game.enableFrameInterpolation) {
|
||||
#endif
|
||||
cAPIGph_Painter();
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!dPa_control_c::isStatus(1)) {
|
||||
fpcDt_Handler();
|
||||
@@ -153,4 +159,3 @@ void* fpcM_JudgeInLayer(fpc_ProcID i_layerID, fpcCtIt_JudgeFunc i_judgeFunc, voi
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
+118
-19
@@ -32,11 +32,14 @@
|
||||
#include "dusk/gx_helper.h"
|
||||
#include "dusk/logging.h"
|
||||
#include "f_ap/f_ap_game.h"
|
||||
#include "f_op/f_op_actor_mng.h"
|
||||
#include "f_op/f_op_camera_mng.h"
|
||||
#include "f_pc/f_pc_name.h"
|
||||
#include "m_Do/m_Do_controller_pad.h"
|
||||
#include "m_Do/m_Do_graphic.h"
|
||||
#include "m_Do/m_Do_machine.h"
|
||||
#include "m_Do/m_Do_main.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include "tracy/Tracy.hpp"
|
||||
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
@@ -465,6 +468,51 @@ void darwFilter(GXColor matColor) {
|
||||
GXEnd();
|
||||
}
|
||||
|
||||
#ifdef TARGET_PC
|
||||
static void mDoGph_AdvanceFadeState() {
|
||||
if (mDoGph_gInf_c::isFade() != 0) {
|
||||
f32 fade_rate = mDoGph_gInf_c::getFadeRate() + mDoGph_gInf_c::getFadeSpeed();
|
||||
|
||||
if (fade_rate < 0.0f) {
|
||||
fade_rate = 0.0f;
|
||||
mDoGph_gInf_c::offFade();
|
||||
} else if (fade_rate > 1.0f) {
|
||||
fade_rate = 1.0f;
|
||||
}
|
||||
|
||||
mDoGph_gInf_c::setFadeRate(fade_rate);
|
||||
mDoGph_gInf_c::getFadeColor().a = 255.0f * fade_rate;
|
||||
} else {
|
||||
GXColor& fade_color = mDoGph_gInf_c::getFadeColor();
|
||||
if (dComIfG_getBrightness() != 255) {
|
||||
fade_color.r = 0;
|
||||
fade_color.g = 0;
|
||||
fade_color.b = 0;
|
||||
fade_color.a = 255 - dComIfG_getBrightness();
|
||||
} else {
|
||||
fade_color.a = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void mDoGph_AdvanceFadeState(u32 tick_count) {
|
||||
for (u32 i = 0; i < tick_count; ++i) {
|
||||
mDoGph_AdvanceFadeState();
|
||||
}
|
||||
}
|
||||
|
||||
static void mDoGph_DrawStoredFade() {
|
||||
GXColor& fade_color = mDoGph_gInf_c::getFadeColor();
|
||||
if (fade_color.a != 0) {
|
||||
darwFilter(fade_color);
|
||||
}
|
||||
}
|
||||
|
||||
void mDoGph_gInf_c::calcFade() {
|
||||
mDoGph_AdvanceFadeState();
|
||||
mDoGph_DrawStoredFade();
|
||||
}
|
||||
#else
|
||||
void mDoGph_gInf_c::calcFade() {
|
||||
if (mDoGph_gInf_c::mFade != 0) {
|
||||
mFadeRate += mFadeSpeed;
|
||||
@@ -493,6 +541,7 @@ void mDoGph_gInf_c::calcFade() {
|
||||
darwFilter(mFadeColor);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
u32 mDoGph_gInf_c::csr_c::m_blurID;
|
||||
@@ -531,29 +580,29 @@ f32 mDoGph_gInf_c::m_scale = 1.0f;
|
||||
|
||||
f32 mDoGph_gInf_c::m_invScale = 1.0f;
|
||||
|
||||
int mDoGph_gInf_c::m_maxX = 608 - 1;
|
||||
int mDoGph_gInf_c::m_maxX = FB_WIDTH_BASE - 1;
|
||||
|
||||
int mDoGph_gInf_c::m_maxY = 448 - 1;
|
||||
int mDoGph_gInf_c::m_maxY = FB_HEIGHT_BASE - 1;
|
||||
|
||||
int mDoGph_gInf_c::m_width = 608;
|
||||
int mDoGph_gInf_c::m_width = FB_WIDTH_BASE;
|
||||
|
||||
int mDoGph_gInf_c::m_height = 448;
|
||||
int mDoGph_gInf_c::m_height = FB_HEIGHT_BASE;
|
||||
|
||||
f32 mDoGph_gInf_c::m_maxXF = 608.0f - 1;
|
||||
f32 mDoGph_gInf_c::m_maxXF = FB_WIDTH_BASE - 1;
|
||||
|
||||
f32 mDoGph_gInf_c::m_maxYF = 448.0f - 1;
|
||||
f32 mDoGph_gInf_c::m_maxYF = FB_HEIGHT_BASE - 1;
|
||||
|
||||
f32 mDoGph_gInf_c::m_widthF = 608.0f;
|
||||
f32 mDoGph_gInf_c::m_widthF = FB_WIDTH_BASE;
|
||||
|
||||
f32 mDoGph_gInf_c::m_heightF = 448.0f;
|
||||
f32 mDoGph_gInf_c::m_heightF = FB_HEIGHT_BASE;
|
||||
|
||||
struct tvSize {
|
||||
u16 width;
|
||||
u16 height;
|
||||
};
|
||||
const tvSize l_tvSize[2] = {
|
||||
{608, 448},
|
||||
{808, 448},
|
||||
{FB_WIDTH_BASE, FB_HEIGHT_BASE},
|
||||
{808, FB_HEIGHT_BASE},
|
||||
};
|
||||
|
||||
#if TARGET_PC
|
||||
@@ -569,8 +618,8 @@ void mDoGph_gInf_c::setTvSize() {
|
||||
|
||||
m_width = tvsize->width;
|
||||
m_height = tvsize->height;
|
||||
m_minX = -((m_width - 608) / 2);
|
||||
m_minY = -((m_height - 448) / 2);
|
||||
m_minX = -((m_width - FB_WIDTH_BASE) / 2);
|
||||
m_minY = -((m_height - FB_HEIGHT_BASE) / 2);
|
||||
m_maxX = m_minX + m_width;
|
||||
m_maxY = m_minY + m_height;
|
||||
|
||||
@@ -819,6 +868,9 @@ int mDoGph_AfterOfDraw() {
|
||||
|
||||
JUTVideo::getManager()->setRenderMode(mDoMch_render_c::getRenderModeObj());
|
||||
mDoGph_gInf_c::endFrame();
|
||||
#ifdef TARGET_PC
|
||||
dusk::frame_interp::notify_sim_tick_complete();
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1661,6 +1713,15 @@ static void captureScreenPerspDrawInfo(JPADrawInfo& info) {
|
||||
|
||||
static void drawItem3D() {
|
||||
ZoneScoped;
|
||||
#ifdef TARGET_PC
|
||||
// Frame interpolation: Title screen needs 0.0f while everything else that runs through this is -100.0f.
|
||||
// Running presentation faster than logic revealed the problem. Thanks, Nintendo.
|
||||
if (fopAcM_SearchByName(fpcNm_TITLE_e) != nullptr) {
|
||||
dMenu_Collect3D_c::setViewPortOffsetY(0.0f);
|
||||
} else {
|
||||
dMenu_Collect3D_c::setViewPortOffsetY(-100.0f);
|
||||
}
|
||||
#endif
|
||||
Mtx item_mtx;
|
||||
dMenu_Collect3D_c::setupItem3D(item_mtx);
|
||||
|
||||
@@ -1688,13 +1749,21 @@ int mDoGph_Painter() {
|
||||
|
||||
#if TARGET_PC
|
||||
dusk::g_imguiConsole.PreDraw();
|
||||
|
||||
const u32 pending_ui_ticks = dusk::frame_interp::begin_presentation_ui_pass();
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
drawHeapMap();
|
||||
#endif
|
||||
|
||||
dComIfGp_particle_calcMenu();
|
||||
#ifdef TARGET_PC
|
||||
for (u32 i = 0; i < pending_ui_ticks; ++i) {
|
||||
#endif
|
||||
dComIfGp_particle_calcMenu();
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
|
||||
JFWDisplay::getManager()->setFader(mDoGph_gInf_c::getFader());
|
||||
mDoGph_gInf_c::setClearColor(mDoGph_gInf_c::getBackColor());
|
||||
@@ -1780,7 +1849,13 @@ int mDoGph_Painter() {
|
||||
GXSetScissor(view_port->x_orig, view_port->y_orig, view_port->width,
|
||||
view_port->height);
|
||||
|
||||
#ifdef TARGET_PC
|
||||
// Frame interpolation: Call setViewMtx earlier so that it's interpolated in time for draw_info to use it
|
||||
j3dSys.setViewMtx(camera_p->view.viewMtx);
|
||||
JPADrawInfo draw_info(j3dSys.getViewMtx(), camera_p->view.fovy, camera_p->view.aspect);
|
||||
#else
|
||||
JPADrawInfo draw_info(camera_p->view.viewMtx, camera_p->view.fovy, camera_p->view.aspect);
|
||||
#endif
|
||||
|
||||
#if WIDESCREEN_SUPPORT
|
||||
if (mDoGph_gInf_c::isWideZoom()) {
|
||||
@@ -1818,7 +1893,9 @@ int mDoGph_Painter() {
|
||||
|
||||
PPCSync();
|
||||
|
||||
#ifndef TARGET_PC
|
||||
j3dSys.setViewMtx(camera_p->view.viewMtx);
|
||||
#endif
|
||||
dKy_setLight();
|
||||
GX_DEBUG_GROUP(dComIfGd_drawOpaListSky);
|
||||
GX_DEBUG_GROUP(dComIfGd_drawXluListSky);
|
||||
@@ -2138,7 +2215,7 @@ int mDoGph_Painter() {
|
||||
if (fapGmHIO_getParticle()) {
|
||||
#if WIDESCREEN_SUPPORT
|
||||
if (mDoGph_gInf_c::isWideZoom()) {
|
||||
ortho.setOrtho(0.0f, 0.0f, 608.0f, 448.0f, 100000.0f, -100000.0f);
|
||||
ortho.setOrtho(0.0f, 0.0f, FB_WIDTH_BASE, FB_HEIGHT_BASE, 100000.0f, -100000.0f);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
@@ -2149,8 +2226,8 @@ int mDoGph_Painter() {
|
||||
ortho.setPort();
|
||||
|
||||
Mtx m3;
|
||||
MTXTrans(m3, FB_WIDTH / 2, FB_HEIGHT / 2, 0.0f);
|
||||
JPADrawInfo draw_info2(m3, 0.0f, FB_HEIGHT, 0.0f, FB_WIDTH);
|
||||
MTXTrans(m3, FB_WIDTH_BASE / 2, FB_HEIGHT_BASE / 2, 0.0f);
|
||||
JPADrawInfo draw_info2(m3, 0.0f, FB_HEIGHT_BASE, 0.0f, FB_WIDTH_BASE);
|
||||
dComIfGp_particle_draw2Dgame(&draw_info2);
|
||||
}
|
||||
|
||||
@@ -2159,7 +2236,12 @@ int mDoGph_Painter() {
|
||||
if (strcmp(dComIfGp_getStartStageName(), "F_SP127") != 0 &&
|
||||
(mDoGph_gInf_c::isFade() & 0x80) == 0)
|
||||
{
|
||||
#ifdef TARGET_PC
|
||||
mDoGph_AdvanceFadeState(pending_ui_ticks);
|
||||
mDoGph_DrawStoredFade();
|
||||
#else
|
||||
mDoGph_gInf_c::calcFade();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
@@ -2224,7 +2306,13 @@ int mDoGph_Painter() {
|
||||
#endif
|
||||
|
||||
GXSetClipMode(GX_CLIP_ENABLE);
|
||||
dDlst_list_c::calcWipe();
|
||||
#ifdef TARGET_PC
|
||||
for (u32 i = 0; i < pending_ui_ticks; ++i) {
|
||||
#endif
|
||||
dDlst_list_c::calcWipe();
|
||||
#ifdef TARGET_PC
|
||||
}
|
||||
#endif
|
||||
j3dSys.reinitGX();
|
||||
|
||||
ortho.setOrtho(mDoGph_gInf_c::getMinXF(), mDoGph_gInf_c::getMinYF(),
|
||||
@@ -2241,9 +2329,9 @@ int mDoGph_Painter() {
|
||||
cMtx_copy(j3dSys.getViewMtx(), m4);
|
||||
|
||||
Mtx m5;
|
||||
MTXTrans(m5, FB_WIDTH / 2, FB_HEIGHT / 2, 0.0f);
|
||||
MTXTrans(m5, FB_WIDTH_BASE / 2, FB_HEIGHT_BASE / 2, 0.0f);
|
||||
|
||||
JPADrawInfo draw_info3(m5, 0.0f, FB_HEIGHT, 0.0f, FB_WIDTH);
|
||||
JPADrawInfo draw_info3(m5, 0.0f, FB_HEIGHT_BASE, 0.0f, FB_WIDTH_BASE);
|
||||
|
||||
if (!dComIfGp_isPauseFlag()) {
|
||||
GX_DEBUG_GROUP(dComIfGp_particle_draw2Dback, &draw_info3);
|
||||
@@ -2274,7 +2362,12 @@ int mDoGph_Painter() {
|
||||
|
||||
if (strcmp(dComIfGp_getStartStageName(), "F_SP127") == 0 || (mDoGph_gInf_c::isFade() & 0x80) != 0)
|
||||
{
|
||||
#ifdef TARGET_PC
|
||||
mDoGph_AdvanceFadeState(pending_ui_ticks);
|
||||
mDoGph_DrawStoredFade();
|
||||
#else
|
||||
mDoGph_gInf_c::calcFade();
|
||||
#endif
|
||||
}
|
||||
|
||||
GX_DEBUG_GROUP(dComIfGp_particle_draw2DmenuFore, &draw_info3);
|
||||
@@ -2307,10 +2400,16 @@ int mDoGph_Painter() {
|
||||
|
||||
#if TARGET_PC
|
||||
dusk::g_imguiConsole.PostDraw();
|
||||
|
||||
JFWDisplay::getManager()->setFaderSimSteps(pending_ui_ticks);
|
||||
#endif
|
||||
|
||||
mDoGph_gInf_c::endRender();
|
||||
|
||||
#ifdef TARGET_PC
|
||||
dusk::frame_interp::end_presentation_ui_pass();
|
||||
#endif
|
||||
|
||||
#if WIDESCREEN_SUPPORT
|
||||
mDoGph_gInf_c::offWideZoom();
|
||||
#endif
|
||||
|
||||
+170
-49
@@ -20,6 +20,7 @@
|
||||
#include "JSystem/JUtility/JUTProcBar.h"
|
||||
#include "JSystem/JUtility/JUTReport.h"
|
||||
#include "SSystem/SComponent/c_counter.h"
|
||||
#include "SSystem/SComponent/c_API_graphic.h"
|
||||
#include "Z2AudioLib/Z2WolfHowlMgr.h"
|
||||
#include "c/c_dylink.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
@@ -46,6 +47,7 @@
|
||||
#include "SSystem/SComponent/c_API.h"
|
||||
#include "dusk/app_info.hpp"
|
||||
#include "dusk/dusk.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include "dusk/imgui/ImGuiEngine.hpp"
|
||||
#include "dusk/logging.h"
|
||||
#include "dusk/main.h"
|
||||
@@ -61,7 +63,9 @@
|
||||
|
||||
#include "SDL3/SDL_filesystem.h"
|
||||
#include "cxxopts.hpp"
|
||||
#include "dusk/audio/DuskAudioSystem.h"
|
||||
#include "dusk/config.hpp"
|
||||
#include "dusk/imgui/ImGuiConsole.hpp"
|
||||
#include "tracy/Tracy.hpp"
|
||||
|
||||
// --- GLOBALS ---
|
||||
@@ -82,7 +86,9 @@ const int audioHeapSize = 0x14D800;
|
||||
#define COPYDATE_PATH "/str/Final/Release/COPYDATE"
|
||||
|
||||
#if TARGET_PC
|
||||
bool dusk::IsRunning = true;
|
||||
bool dusk::IsShuttingDown = false;
|
||||
bool dusk::IsGameLaunched = false;
|
||||
#endif
|
||||
|
||||
s32 LOAD_COPYDATE(void*) {
|
||||
@@ -117,6 +123,41 @@ 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();
|
||||
while (event != nullptr && event->type != AURORA_NONE) {
|
||||
switch (event->type) {
|
||||
case AURORA_WINDOW_RESIZED:
|
||||
preLaunchUIWindowSize = event->windowSize;
|
||||
break;
|
||||
case AURORA_DISPLAY_SCALE_CHANGED:
|
||||
dusk::ImGuiEngine_Initialize(event->windowSize.scale);
|
||||
break;
|
||||
case AURORA_EXIT:
|
||||
return false;
|
||||
}
|
||||
|
||||
event++;
|
||||
}
|
||||
|
||||
if (!aurora_begin_frame()) {
|
||||
DuskLog.debug("aurora_begin_frame returned false, skipping draw this frame");
|
||||
continue;
|
||||
}
|
||||
|
||||
dusk::g_imguiConsole.PreDraw();
|
||||
|
||||
dusk::g_imguiConsole.PostDraw();
|
||||
|
||||
aurora_end_frame();
|
||||
}
|
||||
|
||||
return dusk::IsRunning;
|
||||
}
|
||||
|
||||
void main01(void) {
|
||||
OS_REPORT("\x1b[m");
|
||||
|
||||
@@ -155,6 +196,13 @@ void main01(void) {
|
||||
|
||||
OSReport("Entering Main Loop (main01)...\n");
|
||||
|
||||
if (preLaunchUIWindowSize.width != 0)
|
||||
mDoGph_gInf_c::setWindowSize(preLaunchUIWindowSize);
|
||||
|
||||
using clock = std::chrono::steady_clock;
|
||||
constexpr double kSimStepSeconds = 1.0 / 30.0;
|
||||
auto previous_time = clock::now();
|
||||
double accumulator = kSimStepSeconds;
|
||||
|
||||
do {
|
||||
// 1. Update Window Events
|
||||
@@ -178,71 +226,97 @@ void main01(void) {
|
||||
|
||||
eventsDone:;
|
||||
|
||||
static u32 frame = 0;
|
||||
frame++;
|
||||
|
||||
// Game Inputs
|
||||
mDoCPd_c::read();
|
||||
auto current_time = clock::now();
|
||||
double frame_seconds = std::chrono::duration<double>(current_time - previous_time).count();
|
||||
previous_time = current_time;
|
||||
accumulator += frame_seconds;
|
||||
|
||||
VIWaitForRetrace();
|
||||
|
||||
#if TARGET_PC
|
||||
dusk::lastFrameAuroraStats = *aurora_get_stats();
|
||||
if (!aurora_begin_frame()) {
|
||||
DuskLog.debug("aurora_begin_frame returned false, skipping draw this frame");
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
// EXECUTE GAME LOGIC & RENDER
|
||||
// This calls mDoGph_Painter -> JFWDisplay -> GX Functions
|
||||
fapGm_Execute();
|
||||
if (dusk::getSettings().game.enableFrameInterpolation) {
|
||||
while (accumulator >= kSimStepSeconds) {
|
||||
mDoCPd_c::read();
|
||||
fapGm_Execute();
|
||||
mDoAud_Execute();
|
||||
accumulator -= kSimStepSeconds;
|
||||
}
|
||||
|
||||
mDoAud_Execute();
|
||||
float interp_alpha = static_cast<float>(accumulator / kSimStepSeconds);
|
||||
dusk::frame_interp::interpolate(interp_alpha);
|
||||
cAPIGph_Painter();
|
||||
} else {
|
||||
accumulator = 0.0;
|
||||
|
||||
// Game Inputs
|
||||
mDoCPd_c::read();
|
||||
|
||||
// EXECUTE GAME LOGIC & RENDER
|
||||
// This calls mDoGph_Painter -> JFWDisplay -> GX Functions
|
||||
fapGm_Execute();
|
||||
|
||||
mDoAud_Execute();
|
||||
}
|
||||
|
||||
aurora_end_frame();
|
||||
|
||||
FrameMark;
|
||||
} while (true);
|
||||
} while (dusk::IsRunning);
|
||||
|
||||
exit:;
|
||||
}
|
||||
|
||||
static AuroraBackend ParseAuroraBackend(const std::string& value) {
|
||||
if (value == "auto") {
|
||||
return BACKEND_AUTO;
|
||||
}
|
||||
if (value == "d3d11") {
|
||||
return BACKEND_D3D11;
|
||||
}
|
||||
if (value == "d3d12") {
|
||||
return BACKEND_D3D12;
|
||||
}
|
||||
if (value == "metal") {
|
||||
return BACKEND_METAL;
|
||||
}
|
||||
if (value == "vulkan") {
|
||||
return BACKEND_VULKAN;
|
||||
}
|
||||
if (value == "opengl") {
|
||||
return BACKEND_OPENGL;
|
||||
}
|
||||
if (value == "opengles") {
|
||||
return BACKEND_OPENGLES;
|
||||
}
|
||||
if (value == "webgpu") {
|
||||
return BACKEND_WEBGPU;
|
||||
}
|
||||
if (value == "null") {
|
||||
return BACKEND_NULL;
|
||||
static bool IsBackendAvailable(AuroraBackend backend) {
|
||||
if (backend == BACKEND_AUTO) {
|
||||
return true;
|
||||
}
|
||||
|
||||
fmt::print(stderr, "Unknown backend: {}", value);
|
||||
exit(1);
|
||||
size_t availableBackendCount = 0;
|
||||
const AuroraBackend* availableBackends = aurora_get_available_backends(&availableBackendCount);
|
||||
for (size_t i = 0; i < availableBackendCount; ++i) {
|
||||
if (availableBackends[i] == backend) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static AuroraBackend ResolveDesiredBackend(const cxxopts::ParseResult& parsedArgOptions) {
|
||||
AuroraBackend desiredBackend = BACKEND_AUTO;
|
||||
|
||||
if (parsedArgOptions.count("backend") != 0) {
|
||||
const std::string backendArg = parsedArgOptions["backend"].as<std::string>();
|
||||
if (!dusk::try_parse_backend(backendArg, desiredBackend)) {
|
||||
fmt::print(stderr, "Unknown backend: {}\n", backendArg);
|
||||
exit(1);
|
||||
}
|
||||
} else if (!dusk::try_parse_backend(
|
||||
static_cast<const std::string&>(dusk::getSettings().backend.graphicsBackend),
|
||||
desiredBackend))
|
||||
{
|
||||
DuskLog.warn("Unknown configured backend '{}', falling back to Auto",
|
||||
static_cast<const std::string&>(dusk::getSettings().backend.graphicsBackend));
|
||||
desiredBackend = BACKEND_AUTO;
|
||||
}
|
||||
|
||||
if (!IsBackendAvailable(desiredBackend)) {
|
||||
DuskLog.warn("Requested backend '{}' is unavailable, falling back to Auto",
|
||||
dusk::backend_name(desiredBackend));
|
||||
desiredBackend = BACKEND_AUTO;
|
||||
}
|
||||
|
||||
return desiredBackend;
|
||||
}
|
||||
|
||||
static void aurora_imgui_init_callback(const AuroraWindowSize* size) {
|
||||
dusk::ImGuiEngine_Initialize(size->scale);
|
||||
dusk::ImGuiEngine_AddTextures();
|
||||
}
|
||||
|
||||
static void ApplyCVarOverrides(const cxxopts::OptionValue& option) {
|
||||
@@ -314,10 +388,19 @@ static constexpr PADDefaultMapping defaultPadMapping = {
|
||||
},
|
||||
};
|
||||
|
||||
static bool mainCalled = false;
|
||||
|
||||
// =========================================================================
|
||||
// PC ENTRY POINT
|
||||
// =========================================================================
|
||||
int game_main(int argc, char* argv[]) {
|
||||
// On iOS, when connected to an external monitor, SDLUIKitSceneDelegate scene:willConnectToSession:
|
||||
// can call our main function again. Explicitly guard against this reinitialization.
|
||||
if (mainCalled) {
|
||||
return 0;
|
||||
}
|
||||
mainCalled = true;
|
||||
|
||||
dusk::registerSettings();
|
||||
dusk::config::FinishRegistration();
|
||||
|
||||
@@ -329,8 +412,8 @@ int game_main(int argc, char* argv[]) {
|
||||
arg_options.add_options()
|
||||
("l,log-level", "Log level from " + std::to_string(AuroraLogLevel::LOG_DEBUG) + " to " + std::to_string(AuroraLogLevel::LOG_FATAL), cxxopts::value<uint8_t>()->default_value("0"))
|
||||
("h,help", "Print usage")
|
||||
("dvd", "Path to DVD image file", cxxopts::value<std::string>()->default_value("game.iso"))
|
||||
("backend", "Graphics API backend to use (auto, d3d11, d3d12, metal, vulkan, opengl, opengles, webgpu, null)", cxxopts::value<std::string>()->default_value("auto"))
|
||||
("dvd", "Path to DVD image file", cxxopts::value<std::string>())
|
||||
("backend", "Graphics API backend to use (auto, d3d12, metal, vulkan, null)", cxxopts::value<std::string>())
|
||||
("cvar", "Override configuration variables without modifying config", cxxopts::value<std::vector<std::string>>());
|
||||
|
||||
arg_options.parse_positional({"dvd"});
|
||||
@@ -364,13 +447,15 @@ int game_main(int argc, char* argv[]) {
|
||||
config.windowPosY = -1;
|
||||
config.windowWidth = defaultWindowWidth * 2;
|
||||
config.windowHeight = defaultWindowHeight * 2;
|
||||
config.desiredBackend = ParseAuroraBackend(parsed_arg_options["backend"].as<std::string>());
|
||||
config.desiredBackend = ResolveDesiredBackend(parsed_arg_options);
|
||||
config.logCallback = &aurora_log_callback;
|
||||
config.logLevel = (AuroraLogLevel)parsed_arg_options["log-level"].as<uint8_t>();
|
||||
config.mem1Size = 256 * 1024 * 1024;
|
||||
config.mem2Size = 24 * 1024 * 1024;
|
||||
config.allowJoystickBackgroundEvents = true;
|
||||
config.imGuiInitCallback = &aurora_imgui_init_callback;
|
||||
config.allowTextureReplacements = true;
|
||||
config.allowTextureDumps = false;
|
||||
|
||||
PADSetDefaultMapping(&defaultPadMapping);
|
||||
|
||||
@@ -378,12 +463,48 @@ int game_main(int argc, char* argv[]) {
|
||||
|
||||
VISetWindowTitle(
|
||||
fmt::format("Dusk {} [{}]", DUSK_WC_DESCRIBE, dusk::backend_name(auroraInfo.backend))
|
||||
.c_str());
|
||||
.c_str());
|
||||
|
||||
const auto& dvd_path = parsed_arg_options["dvd"].as<std::string>();
|
||||
DuskLog.info("Loading DVD image: {}", dvd_path);
|
||||
if (!aurora_dvd_open(dvd_path.c_str())) {
|
||||
DuskLog.fatal("Failed to open DVD image: {}", dvd_path);
|
||||
if (dusk::getSettings().video.lockAspectRatio) {
|
||||
VILockAspectRatio(defaultAspectRatioW, defaultAspectRatioH);
|
||||
} else {
|
||||
VIUnlockAspectRatio();
|
||||
}
|
||||
|
||||
dusk::audio::SetMasterVolume(dusk::getSettings().audio.masterVolume / 100.0f);
|
||||
dusk::audio::SetEnableReverb(dusk::getSettings().audio.enableReverb);
|
||||
|
||||
std::string dvd_path;
|
||||
bool dvd_opened = false;
|
||||
if (parsed_arg_options.count("dvd")) {
|
||||
dvd_path = parsed_arg_options["dvd"].as<std::string>();
|
||||
DuskLog.info("Loading DVD image from command line: {}", dvd_path);
|
||||
dvd_opened = aurora_dvd_open(dvd_path.c_str());
|
||||
if (!dvd_opened) {
|
||||
DuskLog.warn("Failed to open DVD image from command line: {}, opening prelaunch UI", dvd_path);
|
||||
} else {
|
||||
dusk::getSettings().backend.isoPath.setValue(dvd_path);
|
||||
dusk::config::Save();
|
||||
dusk::IsGameLaunched = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!dvd_opened) {
|
||||
// pre game launch ui main loop
|
||||
if (!launchUILoop()) {
|
||||
aurora_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
||||
dvd_path = dusk::getSettings().backend.isoPath;
|
||||
|
||||
if (dvd_path.empty()) {
|
||||
DuskLog.fatal("No DVD image specified, unable to boot!");
|
||||
}
|
||||
DuskLog.info("Loading DVD image: {}", dvd_path);
|
||||
if (!aurora_dvd_open(dvd_path.c_str())) {
|
||||
DuskLog.fatal("Failed to open DVD image: {}", dvd_path);
|
||||
}
|
||||
}
|
||||
|
||||
OSInit();
|
||||
|
||||
Reference in New Issue
Block a user