mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-11 11:02:37 -04:00
Implement unlocked framerates via interpolation (#315)
* Disable waitForTick and waitBlanking * Initial frame interpolation implementation * Initial batch of speed fixes * Fix Iron Boots * Strip dead code once used for debugging * Interpolate shadows * Revert overzealous/redundant lookups * Fix JUTFader * Fix field map cursor * Fix various particle effects * Fix Midna when riding Wolf Link * Fix title logo * Title Logo 2: Electric Boogaloo * Fixed grass and flowers * "Unlock Framerate" config option (WIP) * Wrap more things in TARGET_PC * Finish wrapping things in TARGET_PC * Missed one * Disable dComIfGd_drawXluListInvisible when interpolating --------- Co-authored-by: Luke Street <luke@street.dev>
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;
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -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++;
|
||||
|
||||
Reference in New Issue
Block a user