From d143cbb4618e38d13ad2356e46ab02b1e88bddc9 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sun, 12 Oct 2025 09:45:26 -0700 Subject: [PATCH] document GC RareItemNotifications patch --- .../RareDropNotifications.3___.patch.s | 91 ++++++++++++------- system/client-functions/notes.txt | 3 +- 2 files changed, 60 insertions(+), 34 deletions(-) diff --git a/system/client-functions/RareDropNotifications/RareDropNotifications.3___.patch.s b/system/client-functions/RareDropNotifications/RareDropNotifications.3___.patch.s index 05c9a3c2..da1e4f58 100644 --- a/system/client-functions/RareDropNotifications/RareDropNotifications.3___.patch.s +++ b/system/client-functions/RareDropNotifications/RareDropNotifications.3___.patch.s @@ -4,7 +4,7 @@ # https://www.gc-forever.com/forums/viewtopic.php?t=2050 # https://www.gc-forever.com/forums/viewtopic.php?t=2049 -.versions 3OE0 3OE1 3OE2 3OJ2 3OJ3 3OJ4 3OJ5 3OP0 +.versions 3OJ2 3OJ3 3OJ4 3OJ5 3OE0 3OE1 3OE2 3OP0 entry_ptr: reloc0: @@ -12,40 +12,67 @@ reloc0: start: .include WriteCodeBlocksGC - .data 0x8000C660 - .data 0x00000028 - .data 0x881F00EF - .data 0x28000004 - .data 0x40820018 - .data 0x387F0038 - .data 0x3C80FFFF - .data 0x38A00001 - .data 0x38C00000 - .data - .data 0x7FE3FB78 - .data + .label hook_code, 0x8000C660 - .data 0x8000C690 - .data 0x0000002C - .data 0x28030000 - .data 0x41820020 - .data 0x880300EF - .data 0x28000004 - .data 0x40820014 - .data 0x3C600005 - .data 0x60632813 - .data 0x38800000 - .data - .data 0x80010024 - .data - .data - .data 0x00000004 - .data - .data - .data 0x00000004 - .data + # Called from TItem::update in the case when the item is on the ground + .label minimap_hook_call, + .label minimap_hook_ret, + .label minimap_render_dot, + + .data hook_code + .deltaof hooks_start, hooks_end + .address hook_code +hooks_start: +minimap_hook: + lbz r0, [r31 + 0x00EF] + cmplwi r0, 4 + bne minimap_hook_skip_render # if (item->box_type != ItemBoxType::RARE) return; + addi r3, r31, 0x0038 + lis r4, 0xFFFF + li r5, 0x0001 + li r6, 0x0000 + bl minimap_render_dot # minimap_render_dot(&item->location, RED_COLOR, 1, 0); +minimap_hook_skip_render: + mr r3, r31 + b minimap_hook_ret + + + + # Called from handle_6x5F immediately after the item is constructed + .label sound_hook_call, + .label sound_hook_ret, + .label play_sound_at_location, + +sound_hook: + cmplwi r3, 0 + beq sound_hook_skip_play # if (item == nullptr) return; + lbz r0, [r3 + 0x00EF] + cmplwi r0, 4 + bne sound_hook_skip_play # if (item->box_type != ItemBoxType::RARE) return; + lis r3, 0x0005 + ori r3, r3, 0x2813 + li r4, 0x0000 + bl play_sound_at_location # play_sound_at_location(RARE_JINGLE, nullptr); +sound_hook_skip_play: + lwz r0, [r1 + 0x0024] + b sound_hook_ret +hooks_end: + + + + .data minimap_hook_call + .data 4 + .address minimap_hook_call + b minimap_hook + + .data sound_hook_call + .data 4 + .address sound_hook_call + b sound_hook + + .data 0x00000000 .data 0x00000000 diff --git a/system/client-functions/notes.txt b/system/client-functions/notes.txt index 6c8a0a9b..a98c69c2 100644 --- a/system/client-functions/notes.txt +++ b/system/client-functions/notes.txt @@ -16,8 +16,7 @@ Used regions in PSO GC: 8000BF30-8000BF5C (002C) HungryMagSound 8000C3F8-8000C474 (007C) BugFixes 8000C640-8000C654 (0014) BugFixes -8000C660-8000C688 (0028) RareDropNotifications -8000C690-8000C6BC (002C) RareDropNotifications +8000C660-8000C6B4 (0054) RareDropNotifications 8000C6D0-8000C6F0 (0020) BugFixes 8000C8A0-8000C8B4 (0014) BugFixes 8000C8C0-8000C8D0 (0010) BugFixes