.include "SM64Functions.txt" // Re-organize Mario's behavior .org 0x21CCC0 hex { 00 00 00 00 10 05 00 00 11 01 01 00 11 03 00 01 23 00 00 00 00 25 00 A0 08 00 00 00 0C 00 00 00 80 29 CA 58 0C 00 00 00 80 2C B2 64 0C 00 00 00 80 3F 00 00 09 00 00 00 } // Overwriting part of the top levelscript. .org 0x108A18 hex { 11 08 00 00 80 2C B1 C0 } // Function that will copy data from the ROM to the RAM .org 0x861C0 ADDIU SP, SP, $FFE8 SW RA, $0014 (SP) SW A0, $0010 (SP) // lvl cmd 0x11 safeguard // Do not remove these following 4 instructions JAL @osViBlack // 0x80323340 MOV A0, R0 LUI T0, 0x8039 SW R0, 0xBE24(T0) // Set level accumulator to 0 LUI T0, 0x803F ORI A0, T0, 0x0000 // Writing to RAM address 0x803F0000 LUI T1, 0x011F ORI A1, T1, 0x0000 // Start copying from ROM address at 0x11F0000 JAL @DmaCopy // 0x80278504 ORI A2, T1, 0x1000 // Stop copying from ROM address at 0x11F1000 LW V0, $0010 (SP) // lvl cmd 0x11 safeguard LW RA, $0014 (SP) JR RA ADDIU SP, SP, $0018 .org 0x11F0000 // Custom Mario loop function (0x803F0000) ADDIU SP, SP, 0xFFE8 SW RA, 0x14 (SP) LUI A0, 0x8034 LW T0, 0xAFA0(A0) ANDI AT, T0, 0x20 BEQZ AT, 803F0000_end // Check L button, and branch if false NOP LB T1, 0xFFFF(A0) // Load byte at 0x8033FFFFF XORI T1, T1, 0x01 // Switch byte (either 0 or 1) SB T1, 0xFFFF(A0) // Store new value 803F0000_end: LW RA, 0x14 (SP) JR RA ADDIU SP, SP, 0x18 .org 0x11F0800 // Custom switch function (0x803F0800) ADDIU SP, SP, 0xFFE8 SW RA, 0x14 (SP) SW A2, 0x20 (SP) // You want to store A2 0x8 bytes above the stack pointer. //A1 = pointer to graph node. You must store the switch value to offset 0x1E LUI T0, 0x8034 LB T0, 0xFFFF(T0) SH T0, 0x1E(A1) // Store our byte at 0x8033FFFFF as the switch value. MOV V0, R0 // put return value at zero. LW RA, 0x14 (SP) JR RA ADDIU SP, SP, 0x18 /* Note: You cannot add any more bytes here without breaking Mario's geo layout. If you want more than 2 options, then you will need to move some of the geo layout code elsewhere. */ .org 0x12A7AC hex { 0E 00 00 00 80 3F 08 00 04 00 00 00 02 01 00 00 17 00 2C E0 02 01 00 00 17 00 2D 48 05 00 00 00 }