From 3de0e0bdf41fc05c15d21dfa67f267b0024ab4f0 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 7 Oct 2012 03:23:10 +0200 Subject: fixed the multiplayer pauses --- bugfixes.yaml | 14 ++++++++++++++ include/game.h | 2 +- kamek_pal.x | 5 +++++ src/randomcrap.S | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 1 deletion(-) diff --git a/bugfixes.yaml b/bugfixes.yaml index ce2efc1..a979a19 100644 --- a/bugfixes.yaml +++ b/bugfixes.yaml @@ -3,6 +3,20 @@ # yaml, hasn't it... source_files: [../src/randomcrap.S, ../src/music.cpp, ../src/fix38.S, ../src/nullsub.S, ../src/newer.cpp] hooks: + - name: MPPauseFix1 + type: branch_insn + branch_type: bl + target_func: 'mpPauseFix1' + src_addr_pal: 0x801410C4 + - name: MPPauseFix2 + type: branch_insn + branch_type: bl + target_func: 'mpPauseFix2' + src_addr_pal: 0x801410DC + - name: MPDeathPauseFix + type: nop_insn + area_pal: 0x8013DA70 + - name: FixMemoryLeaks type: patch addr_pal: 0x800E53E0 diff --git a/include/game.h b/include/game.h index 1e0c484..95eb4d1 100755 --- a/include/game.h +++ b/include/game.h @@ -1986,7 +1986,7 @@ public: u32 _37C, _380, _384, _388; u8 stageActorType; u8 which_player; // _38D - u8 enableFlag, currentLayerID; + u8 disableFlagMask, currentLayerID; u8 deleteForever; u8 _391, _392, _padding; diff --git a/kamek_pal.x b/kamek_pal.x index fa1273b..9d721ee 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -1,6 +1,10 @@ SECTIONS { /* Scrolling is annoying, clown car goes here! */ + continueFromMpPauseFix1 = 0x8004E050; + continueFromMpPauseFix2 = 0x801415A0; + CheckIfSinglePlayer = 0x800FCAD0; + TextWriterCrapContinue = 0x800E598C; StockWMInit_LoadEffects__FPv = 0x80926B10; @@ -1431,6 +1435,7 @@ SECTIONS { returnFromFlagObjCheck = 0x807EBC7C; Global5758 = 0x8042A228; + GlobalEnableFlag = 0x80429FDA; EggControllerClassPtrMaybe = 0x8042A230; diff --git a/src/randomcrap.S b/src/randomcrap.S index 0b76ad8..64e98c1 100644 --- a/src/randomcrap.S +++ b/src/randomcrap.S @@ -1,4 +1,45 @@ .text +.global mpPauseFix1 +.global mpPauseFix2 +.extern continueFromMpPauseFix1 +.extern continueFromMpPauseFix2 + +mpPauseFix1: + lis r5, continueFromMpPauseFix1@h + ori r5, r5, continueFromMpPauseFix1@l + b mpPauseFix +mpPauseFix2: + lis r5, continueFromMpPauseFix2@h + ori r5, r5, continueFromMpPauseFix2@l + b mpPauseFix + +.extern CheckIfSinglePlayer + +mpPauseFix: + stwu r1, -0x20(r1) + mflr r0 + stw r0, 0x24(r1) + stw r31, 0x1C(r1) + stw r30, 0x18(r1) + mr r31, r3 + mr r30, r4 + + bl CheckIfSinglePlayer + cmpwi r3, 1 + bne DontDoThis + mr r3, r31 + mr r4, r30 + mtctr r5 + bctrl +DontDoThis: + + lwz r30, 0x18(r1) + lwz r31, 0x1C(r1) + lwz r0, 0x24(r1) + mtlr r0 + addi r1, r1, 0x20 + blr + .global newClimbSounds .extern StagePtr newClimbSounds: -- cgit v1.2.3