From d5773b93da82972bb186bad119603cddd69c6b80 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Fri, 17 Feb 2023 21:48:10 -0800 Subject: [PATCH] factor out Ep3 USA check in patches --- system/ppc/Ep3-Editors.patch.s | 11 ++--------- system/ppc/Ep3-VIPCard.patch.s | 9 +-------- system/ppc/Episode3USAOnly.inc.s | 7 +++++++ 3 files changed, 10 insertions(+), 17 deletions(-) create mode 100644 system/ppc/Episode3USAOnly.inc.s diff --git a/system/ppc/Ep3-Editors.patch.s b/system/ppc/Ep3-Editors.patch.s index fdb6c439..fd4c1149 100644 --- a/system/ppc/Ep3-Editors.patch.s +++ b/system/ppc/Ep3-Editors.patch.s @@ -22,6 +22,8 @@ start: # But we leave it in to be consistent with patches for Episodes 1&2. .include InitClearCaches + .include Episode3USAOnly + stwu [r1 - 0x20], r1 mflr r0 stw [r1 + 0x24], r0 @@ -29,15 +31,6 @@ start: stw [r1 + 0x0C], r30 stw [r1 + 0x08], r29 - # First, make sure this is actually Episode 3 USA; if not, do nothing - lis r4, 0x4750 - ori r4, r4, 0x5345 # 'GPSE' - lis r5, 0x8000 - lwz r5, [r5] - li r3, -1 - cmp r4, r5 - bne skip_all - # Write a short hook that updates our editors table when TEditor_destroy() is # called bl get_TEditor_destroy_hook_addr diff --git a/system/ppc/Ep3-VIPCard.patch.s b/system/ppc/Ep3-VIPCard.patch.s index 97f71506..b8c66a01 100644 --- a/system/ppc/Ep3-VIPCard.patch.s +++ b/system/ppc/Ep3-VIPCard.patch.s @@ -15,14 +15,7 @@ start: # But we leave it in to be consistent with patches for Episodes 1&2. .include InitClearCaches - # First, make sure this is actually Episode 3 USA; if not, do nothing - lis r4, 0x4750 - ori r4, r4, 0x5345 # 'GPSE' - lis r5, 0x8000 - lwz r5, [r5] - li r3, -1 - cmp r4, r5 - bnelr + .include Episode3USAOnly # Call seq_var_set(7000) - this gives the local player a VIP card li r3, 7000 diff --git a/system/ppc/Episode3USAOnly.inc.s b/system/ppc/Episode3USAOnly.inc.s new file mode 100644 index 00000000..9bae75bd --- /dev/null +++ b/system/ppc/Episode3USAOnly.inc.s @@ -0,0 +1,7 @@ + lis r4, 0x4750 + ori r4, r4, 0x5345 # 'GPSE' + lis r5, 0x8000 + lwz r5, [r5] + li r3, -1 + cmp r4, r5 + bnelr