Item Timer [JoshuaMK]
#1
Item Timer [JoshuaMK]

This code will keep track (via Milliseconds in timer) of how long you have left before your timed item (Mega Mushroom, Golden Mushroom, or Star) runs out. Whenever you are not using any of these items, the timer will function normally.

Works in all modes, offline and online



(NTSC-U)
C27ED9F8 0000000A
A3840008 3D80809C
816CEE20 816B0014
834B00A8 2C1A0000
41810030 816CD110
816B0020 816B0000
816B0010 816B0010
A34B0194 2C1A0000
41810010 AB4B018A
2C1A0000 40A10008
7F5CD378 00000000

(PAL)
C27F84F8 0000000A
A3840008 3D80809C
816C3618 816B0014
834B00A8 2C1A0000
41810030 816C18F8
816B0020 816B0000
816B0010 816B0010
A34B0194 2C1A0000
41810010 AB4B018A
2C1A0000 40A10008
7F5CD378 00000000

(NTSC-J)
C27F7B64 0000000A
A3840008 3D80809C
816C2678 816B0014
834B00A8 2C1A0000
41810030 816C0958
816B0020 816B0000
816B0010 816B0010
A34B0194 2C1A0000
41810010 AB4B018A
2C1A0000 40A10008
7F5CD378 00000000

(NTSC-K)
C27E68B8 0000000A
A3840008 3D80809B
816C1C58 816B0014
834B00A8 2C1A0000
41810030 816CFF38
816B0020 816B0000
816B0010 816B0010
A34B0194 2C1A0000
41810010 AB4B018A
2C1A0000 40A10008
7F5CD378 00000000



.set region, ''

.if    (region == 'E' || region == 'e') # RMCE
        .set UPPER, 0x809C
        .set OFFSET, -0x2EF0
        .set GOLDEN_OFFSET, -0x11E0
.elseif (region == 'P' || region == 'p') # RMCP
        .set UPPER, 0x809C
        .set OFFSET, 0x18F8
        .set GOLDEN_OFFSET, 0x3618
.elseif (region == 'J' || region == 'j') # RMCJ
        .set UPPER, 0x809C
        .set OFFSET, 0x0958
        .set GOLDEN_OFFSET, 0x2678
.elseif (region == 'K' || region == 'k') # RMCK
        .set UPPER, 0x809B
        .set OFFSET, -0x00C8
        .set GOLDEN_OFFSET, 0x1C58
.else # Invalid Region
        .abort
.endif

#Golden mushroom
lhz r28, 0x8 (r4) #Default instruction
lis r12, UPPER
lwz r11, GOLDEN_OFFSET (r12)
lwz r11, 0x14 (r11)
lwz r26, 0xA8 (r11)
cmpwi r26, 0
bgt active

#Mega Mushroom
lwz r11, OFFSET (r12)
lwz r11, 0x20 (r11)
lwz r11, 0 (r11)
lwz r11, 0x10 (r11)
lwz r11, 0x10 (r11)
lhz r26, 0x194 (r11)
cmpwi r26, 0
bgt active

#Star
lha r26, 0x18A (r11)
cmpwi r26, 0
ble+ the_end

active:
mr r28, r26

the_end:



Code Creator: JoshuaMK
Code Contributors: Vega (Hook addresses to find pointers)
Super Mario Eclipse, what Super Mario Sunshine could've been.
Reply


Messages In This Thread
Item Timer [JoshuaMK] - by JoshuaMK - 03-18-2020, 04:02 AM
RE: Item Timer [JoshuaMK] - by Vega - 03-18-2020, 06:11 PM
RE: Item Timer [JoshuaMK] - by JoshuaMK - 03-18-2020, 07:36 PM
RE: Item Timer [JoshuaMK] - by Vega - 03-18-2020, 07:45 PM
RE: Item Timer [JoshuaMK] - by Unnamed - 03-19-2020, 01:43 PM
RE: Item Timer [JoshuaMK] - by Vega - 03-26-2020, 06:28 PM
RE: Item Timer [JoshuaMK] - by JoshuaMK - 03-26-2020, 08:29 PM
RE: Item Timer [JoshuaMK] - by Vega - 03-26-2020, 09:08 PM
RE: Item Timer [JoshuaMK] - by JoshuaMK - 03-26-2020, 09:44 PM
RE: Item Timer [JoshuaMK] - by Unnamed - 06-23-2020, 01:44 PM
RE: Item Timer [JoshuaMK] - by Unnamed - 08-31-2020, 06:23 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)