RtlUpdateSnesPatchForBugfix() had a bug

Also removed dup patch
This commit is contained in:
Snesrev
2023-03-11 14:15:54 +01:00
parent 80f565ec89
commit ff343e46c0
2 changed files with 3 additions and 5 deletions

View File

@@ -553,7 +553,7 @@ void RtlUpdateSnesPatchForBugfix() {
// Patch HandleMessageBoxInteraction logic
{ uint8 t[] = { 0x20, 0x50, 0x96, 0x60 }; PatchBytes(0x8584A3, t, sizeof(t)); }
// while ((bug_fix_counter < 1 ? joypad1_newkeys : joypad1_lastkeys) == 0);
{ uint8 t[] = { 0x20, 0x36, 0x81, 0x22, 0x59, 0x94, 0x80, 0xc2, 0x30, 0xa5, (bug_fix_counter < 1) ? 0x8f : 0x85, 0xf0, 0xf3, 0x60 }; PatchBytes(0x859650, t, sizeof(t)); }
{ uint8 t[] = { 0x20, 0x36, 0x81, 0x22, 0x59, 0x94, 0x80, 0xc2, 0x30, 0xa5, (bug_fix_counter < 1) ? 0x8f : 0x8b, 0xf0, 0xf3, 0x60 }; PatchBytes(0x859650, t, sizeof(t)); }
{ uint8 t[] = { 0x18, 0x18 }; PatchBytes(0x8584CC, t, sizeof(t)); } // Don't wait 2 loops
}
@@ -676,10 +676,6 @@ Snes *SnesInit(const char *filename) {
{ uint8 t[] = { 0x18, 0x18, 0x18 }; PatchBytes(0x858532, t, sizeof(t)); } // WaitForNMI_NoUpdate
{ uint8 t[] = { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }; PatchBytes(0x85856b, t, sizeof(t)); } // HandleMusicQueue etc.
// Remove WaitForLagFrame in various places
{ uint8 t[] = { 0x18, 0x18, 0x18 }; PatchBytes(0x85861C, t, sizeof(t)); } // RestorePpuForMessageBox
{ uint8 t[] = { 0x18, 0x18, 0x18 }; PatchBytes(0x858651, t, sizeof(t)); } // RestorePpuForMessageBox
// Patch DisplayMessageBox
{ uint8 t[] = { 0x18, 0x18, 0x18 }; PatchBytes(0x858096, t, sizeof(t)); } // Remove MsgBoxDelayFrames_2
{ uint8 t[] = { 0x18, 0x18, 0x18 }; PatchBytes(0x8580B4, t, sizeof(t)); } // Remove MsgBoxDelayFrames_2

View File

@@ -245,6 +245,8 @@ void StateRecorder_Load(StateRecorder *sr, FILE *f, bool replay_mode) {
if (!is_reset)
RtlRestoreMusicAfterLoad_Locked(false);
RtlUpdateSnesPatchForBugfix();
// Temporarily fix reset state
// if (g_snes->cpu->k == 0x82 && g_snes->cpu->pc == 0xf716)
// g_snes->cpu->pc = 0xf71c;