From a1e732cd70c613a963a81833f571a6e520758464 Mon Sep 17 00:00:00 2001 From: FIX94 Date: Wed, 16 Nov 2016 05:55:00 +0100 Subject: [PATCH] -added super mario 64 ds port --- Makefile | 20 +++++++++++++++++--- README.md | 3 +++ sm64ds_defs.s | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 sm64ds_defs.s diff --git a/Makefile b/Makefile index fde8a81..6c7eba1 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ else ZIP = zip endif -all: setup brainage kirby mariokartds sfcommand yoshids zeldaph brainage.zip kirby.zip mariokartds.zip sfcommand.zip yoshids.zip zeldaph.zip +all: setup brainage kirby mariokartds sfcommand sm64ds yoshids zeldaph brainage.zip kirby.zip mariokartds.zip sfcommand.zip sm64ds.zip yoshids.zip zeldaph.zip brainage: setup_brainage brainage.nds @@ -16,6 +16,8 @@ mariokartds: setup_mariokartds mariokartds.nds sfcommand: setup_sfcommand sfcommand.nds +sm64ds: setup_sm64ds sm64ds.nds + yoshids: setup_yoshids yoshids.nds zeldaph: setup_zeldaph zeldaph.nds @@ -41,6 +43,10 @@ setup_sfcommand: @rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin @cp -f sfcommand_defs.s defines.s +setup_sm64ds: + @rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin + @cp -f sm64ds_defs.s defines.s + setup_yoshids: @rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin @cp -f yoshids_defs.s defines.s @@ -70,6 +76,11 @@ sfcommand.nds: @armips haxchi.s @mv rom.nds sfcommand.nds +sm64ds.nds: + @armips haxchi_rop.s + @armips haxchi.s + @mv rom.nds sm64ds.nds + yoshids.nds: @armips haxchi_rop.s @armips haxchi.s @@ -94,6 +105,9 @@ mariokartds.zip: sfcommand.zip: $(ZIP) -JXjq9 sfcommand.zip sfcommand.nds +sm64ds.zip: + $(ZIP) -JXjq9 sm64ds.zip sm64ds.nds + yoshids.zip: $(ZIP) -JXjq9 yoshids.zip yoshids.nds $(ZIP) -JXjq9 wwtouched.zip wwtouched.nds @@ -102,8 +116,8 @@ zeldaph.zip: $(ZIP) -JXjq9 zeldaph.zip zeldaph.nds clean: - @rm -f *.bin defines.s brainage.nds brainage.zip kirby.nds kirby.zip mariokartds.nds mariokartds.zip \ - newsmb.nds newsmb.zip sfcommand.nds sfcommand.zip wwtouched.nds wwtouched.zip yoshids.nds yoshids.zip zeldaph.nds zeldaph.zip + @rm -f *.bin defines.s brainage.nds brainage.zip kirby.nds kirby.zip mariokartds.nds mariokartds.zip newsmb.nds newsmb.zip \ + sfcommand.nds sfcommand.zip sm64ds.nds sm64ds.zip wwtouched.nds wwtouched.zip yoshids.nds yoshids.zip zeldaph.nds zeldaph.zip @cd option_select && make clean && cd .. @cd hbl_loader && make clean && cd .. @cd cfw_booter && make clean && cd .. diff --git a/README.md b/README.md index d66e08c..44f672b 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,9 @@ make sure to replace YOUR_GAME_TITLE_ID with one of the following: 101AC000 - JPN Star Fox Command 101AC100 - US Star Fox Command 101AC200 - PAL Star Fox Command +101C3300 - JPN Super Mario 64 DS +101C3400 - US Super Mario 64 DS +101C3500 - PAL Super Mario 64 DS 101C3600 - JPN Zelda Phantom Hourglass 101C3700 - US Zelda Phantom Hourglass 101C3800 - PAL Zelda Phantom Hourglass diff --git a/sm64ds_defs.s b/sm64ds_defs.s new file mode 100644 index 0000000..9bf6914 --- /dev/null +++ b/sm64ds_defs.s @@ -0,0 +1,39 @@ + +; game stack return address (note: not ideal here) +HAX_TARGET_ADDRESS equ (0x1079914C) +; application memory pointer +HACHI_APPLICATION_PTR equ (0x10C8F938) +; arm9 rom location address +ARM9_ROM_LOCATION equ (0x16443300) + +; constants for position calcs +RPX_OFFSET equ (0x01800000) +ARM7_ROM_MEM2_START equ (0xF0000000 - ARM9_ROM_LOCATION + 0x12000000) + +; rop-gadgets part 1 (used for all sorts of different things) +LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR equ (RPX_OFFSET + 0x02049628) +BCTRL equ (RPX_OFFSET + 0x0200415C) +MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR equ (RPX_OFFSET + 0x020A6E10) +LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR equ (RPX_OFFSET + 0x020A69E8) +LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x0200106C) +MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR equ (RPX_OFFSET + 0x0217C968) +LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR equ (RPX_OFFSET + 0x0227B400) + +; rop-gadgets part 2 (only used to set up core 0 thread stack) +LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x0201899C) +MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020B2250) +LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x0200F510) +LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x02085334) +LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR equ (RPX_OFFSET + 0x020596A4) +LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR equ (RPX_OFFSET + 0x02018A24) +LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR equ (RPX_OFFSET + 0x0214CAA4) +MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02024274) + +; functions used from game +NERD_CREATETHREAD equ (RPX_OFFSET + 0x02225208) +NERD_STARTTHREAD equ (RPX_OFFSET + 0x02225624) +NERD_JOINTHREAD equ (RPX_OFFSET + 0x022250B4) +HACHI_APPLICATION_SHUTDOWNANDDESTROY equ (RPX_OFFSET + 0x02006D30) +NERD_FASTWIIU_SHUTDOWN equ (RPX_OFFSET + 0x0201FC7C) +CORE_SHUTDOWN equ (RPX_OFFSET + 0x022247D8) +_START_EXIT equ (RPX_OFFSET + 0x02026908)