Mario Kart Wii Gecko Codes, Cheats, & Hacks
Set Wii To Shutdown After Specific Time [Vega] - Printable Version

+- Mario Kart Wii Gecko Codes, Cheats, & Hacks (https://mariokartwii.com)
+-- Forum: Cheat Codes (https://mariokartwii.com/forumdisplay.php?fid=51)
+--- Forum: Misc/Other (https://mariokartwii.com/forumdisplay.php?fid=55)
+--- Thread: Set Wii To Shutdown After Specific Time [Vega] (/showthread.php?tid=1009)



Set Wii To Shutdown After Specific Time [Vega] - Vega - 12-27-2018

Set Wii To Shutdown After Specific Time [Vega]

I always wanted to make a code where you could set a time limit for how long you can play MKWii after you first boot it. Well, here it is.

This code allows the user to set a specific time to force the Wii to shutdown regardless of what you are doing in the game. The shutdown is handled automatically.

NOTE: This code makes use of memory addresses 0x80001640 thru 0x80001643. Make sure no other codes are using those memory addresses.

NTSC-U
C21AA92C 00000007
3D808000 816C1640
396B0001 3880XXXX
A3CC1640 7C04F000
41A10014 3D80801A
618CB8C0 7D8803A6
4E800020 916C1640
7C7E1B78 00000000

PAL
C21AA9CC 00000007
3D808000 816C1640
396B0001 3880XXXX
A3CC1640 7C04F000
41A10014 3D80801A
618CB960 7D8803A6
4E800020 916C1640
7C7E1B78 00000000

NTSC-J
C21AA8EC 00000007
3D808000 816C1640
396B0001 3880XXXX
A3CC1640 7C04F000
41A10014 3D80801A
618CB880 7D8803A6
4E800020 916C1640
7C7E1B78 00000000

NTSC-K
C21AAD28 00000007
3D808000 816C1640
396B0001 3880XXXX
A3CC1640 7C04F000
41A10014 3D80801A
618CBCBC 7D8803A6
4E800020 916C1640
7C7E1B78 00000000

XXXX= Time Amount
0001 = Roughly 1 Minute and 10 seconds (70 seconds)
0005 = Roughly 5 Minutes and 50 seconds (350 seconds)
7FFF = Around 637 hours (lol)




Source (NTSC-K version):
#~~~~~~~~~~~~~~~~#
# START ASSEMBLY #
#~~~~~~~~~~~~~~~~#

#~~~~~~~~#
# NTSC-K #
#~~~~~~~~#

#

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Set Address (Load/Store) Reference #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lis r12, 0x8000 #Set upper 16 bits of r12 to 0x8000, lower 16 bits are cleared

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Load & Update Frame Counter #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lwz r11, 0x1640 (r12) #Load the word from address 0x80001640 into r11
addi r11, r11, 1 #Add one to r11, value at 0x80001640 will increase by one per every fram

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Set User's Shutoff Time Value #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

li r4, 0xXXXX #Load user's designated frame/time shutoff value

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Load Byte for Comparison Check #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

##Since the frame ammount plain word value can exceed a high amount##
##Load the haldword instead of the of word to prevent an overflow##

lhz r30, 0x1640 (r12) #Load byte from 0x80001641 into r30

#~~~~~~~~~~~~~~~~~~#
# Comparison Check #
#~~~~~~~~~~~~~~~~~~#

cmpw r4, r30 #Compare the value in r4 to value in r30
bgt+ dont_shutdown #If r4's value is greater than r30's value, jump to dont_shutdown label

#~~~~~~~~~~~~~~#
# Shutdown Wii #
#~~~~~~~~~~~~~~#

lis r12, 0x801A #Set upper 16 bits of r12 to 0x801A, lower 16 bits are cleared
ori r12, r12, 0xBCBC #Set lower 16 bits of r12 to 0xBCBC, r12 is now 0x801ABCBC
mtlr r12 #Copy value of r12 to the Link Register
blr #Branch to Link Register

#~~~~~~~~~~~~~~~~~~~~~#
# dont_shutdown Label #
#~~~~~~~~~~~~~~~~~~~~~#

dont_shutdown:
stw r11, 0x1640 (r12) #Store updated frame count (word of r11) to 0x80001640

#~~~~~~~~~~~~~#
# Default ASM #
#~~~~~~~~~~~~~#

mr r30, r3

#~~~~~~~~~~~~~~~~~~~~~~#
# Notes about r4 & r30 #
#~~~~~~~~~~~~~~~~~~~~~~#

##r30 is safe to use because it get's overwritten by the Default ASM##
##r4 is safe to use because after the BL function, it gets overwritten by a rlwinm function##

#

#~~~~~~~~~~~~~~#
# END ASSEMBLY #
#~~~~~~~~~~~~~~#




Code creator: Vega
Code credits: Megazig (OSSleepThread subroutine; _OSShutdownToSBY subroutine)