From 1c3e5a0b1c62829d78960c4d99e4928ccf73625f Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Wed, 4 Jul 2012 23:14:52 -0500 Subject: Added Newer nullsubs for dynamic use, improved mapfile a little (mostly error output), updated newer and summer sun with nullsub fixes. --- SummerSun.yaml | 1 - bugfixes.yaml | 44 +++++++-------- poweruphax.yaml | 154 +++++++++++++++++++++++++------------------------- src/nullsub.S | 16 ++++++ summerhax.yaml | 61 +++++++++++--------- tools/mapfile_tool.py | 43 ++++++++------ 6 files changed, 172 insertions(+), 147 deletions(-) create mode 100644 src/nullsub.S diff --git a/SummerSun.yaml b/SummerSun.yaml index 227535c..654fb5b 100644 --- a/SummerSun.yaml +++ b/SummerSun.yaml @@ -3,5 +3,4 @@ code_address: 0x808D9000 modules: - processed/prolog.yaml - processed/summerhax.yaml - - processed/soundPlayer.yaml - processed/effectVideo.yaml diff --git a/bugfixes.yaml b/bugfixes.yaml index 1504dcd..b77111f 100644 --- a/bugfixes.yaml +++ b/bugfixes.yaml @@ -1,5 +1,5 @@ --- -source_files: [../src/randomcrap.S, ../src/music.S, ../src/fix38.S] +source_files: [../src/randomcrap.S, ../src/music.S, ../src/fix38.S, ../src/nullsub.S] hooks: - name: FixMemoryLeaks type: patch @@ -85,38 +85,32 @@ hooks: # src_addr_pal: 0x80081E34 # target_func: 'HeapChangeAttempt' - - name: EN_BIGPILEFix - type: patch - addr_pal: 0x8001F93C - data: '48000014' - - name: StarsDontKillSpikesUD - type: patch - addr_pal: 0x80AFF4D8 - data: '809A5490' + type: add_func_pointer + src_addr_pal: 0x80AFF4D8 + target_func: 'Return' - name: StarsDontKillSpikesD - type: patch - addr_pal: 0x80AFF784 - data: '809A5490' + type: add_func_pointer + src_addr_pal: 0x80AFF784 + target_func: 'Return' - name: StarsDontKillSpikesU - type: patch - addr_pal: 0x80AFFA30 - data: '809A5490' + type: add_func_pointer + src_addr_pal: 0x80AFFA30 + target_func: 'Return' - name: StarsDontKillSpikesLR - type: patch - addr_pal: 0x80AFFCDC - data: '809A5490' + type: add_func_pointer + src_addr_pal: 0x80AFFCDC + target_func: 'Return' - name: StarsDontKillSpikesR - type: patch - addr_pal: 0x80AFFF88 - data: '809A5490' + type: add_func_pointer + src_addr_pal: 0x80AFFF88 + target_func: 'Return' - name: StarsDontKillSpikesL - type: patch - addr_pal: 0x80B00234 - data: '809A5490' - + type: add_func_pointer + src_addr_pal: 0x80B00234 + target_func: 'Return' diff --git a/poweruphax.yaml b/poweruphax.yaml index 29f2636..9e12b10 100644 --- a/poweruphax.yaml +++ b/poweruphax.yaml @@ -398,24 +398,24 @@ hooks: # data: '00000047' # # - name: HammerClamNull -# type: patch -# addr_pal: 0x80AD5BF0 -# data: '80095C10' +# type: add_func_pointer +# src_addr_pal: 0x80AD5BF0 +# target_func: 'Return' - name: HammerGiantWigglerNull - type: patch - addr_pal: 0x80AD7FC8 - data: '80095C10' + type: add_func_pointer + src_addr_pal: 0x80AD7FC8 + target_func: 'Return' - name: HammerParabeetleNull - type: patch - addr_pal: 0x80B028D8 - data: '80095C10' + type: add_func_pointer + src_addr_pal: 0x80B028D8 + target_func: 'Return' - name: HammerGiantBuzzyNull - type: patch - addr_pal: 0x80AD8A10 - data: '80095C10' + type: add_func_pointer + src_addr_pal: 0x80AD8A10 + target_func: 'Return' - name: HammerGiantBuzzy type: patch @@ -438,9 +438,9 @@ hooks: data: '00088806' - name: HammerKingBillNull - type: patch - addr_pal: 0x80AF72A8 - data: '80095C10' + type: add_func_pointer + src_addr_pal: 0x80AF72A8 + target_func: 'Return' @@ -488,118 +488,118 @@ hooks: addr_pal: 0x80ACFD2C - name: IcicleNormalNoIceball - type: patch - data: "80095C10" - addr_pal: 0x80AEFFFC + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80AEFFFC # - name: IcicleFixationNoIceball # type: patch - # data: "80095C10" - # addr_pal: 0x80AE9DC0 + # target_func: 'Return' + # src_addr_pal: 0x80AE9DC0 - name: FuckinCastleLarryNull - type: patch - data: "80095C10" - addr_pal: 0x80B76C90 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B76C90 - name: FuckinLarryNull - type: patch - data: "80095C10" - addr_pal: 0x80B81F44 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B81F44 - name: FuckinCastleLemmyNull - type: patch - data: "80095C10" - addr_pal: 0x80B777A8 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B777A8 - name: FuckinLemmyNull - type: patch - data: "80095C10" - addr_pal: 0x80B82DF0 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B82DF0 - name: FuckinCastleWendyNull - type: patch - data: "80095C10" - addr_pal: 0x80B7AD70 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B7AD70 - name: FuckinWendyNull - type: patch - data: "80095C10" - addr_pal: 0x80B87644 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B87644 - name: FuckinCastleLudwigNull - type: patch - data: "80095C10" - addr_pal: 0x80B78380 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B78380 - name: FuckinLudwigNull - type: patch - data: "80095C10" - addr_pal: 0x80B840D8 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B840D8 - name: FuckinCastleIggyNull - type: patch - data: "80095C10" - addr_pal: 0x80B75F80 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B75F80 - name: FuckinIggyNull - type: patch - data: "80095C10" - addr_pal: 0x80B7BC28 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B7BC28 - name: FuckinCastleMortonNull - type: patch - data: "80095C10" - addr_pal: 0x80B79060 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B79060 - name: FuckinMortonNull - type: patch - data: "80095C10" - addr_pal: 0x80B853A8 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B853A8 - name: FuckinCastleRoyNull - type: patch - data: "80095C10" - addr_pal: 0x80B79DC8 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B79DC8 - name: FuckinRoyNull - type: patch - data: "80095C10" - addr_pal: 0x80B86410 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B86410 - name: FuckinKamekNull - type: patch - data: "80095C10" - addr_pal: 0x80B7CBDC + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B7CBDC - name: FuckinBowserNull - type: patch - data: "80095C10" - addr_pal: 0x80B7E800 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B7E800 - name: FuckinJrANull - type: patch - data: "80095C10" - addr_pal: 0x80B804B4 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B804B4 - name: FuckinJrBNull - type: patch - data: "80095C10" - addr_pal: 0x80B80BBC + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B80BBC - name: FuckinJrCNull - type: patch - data: "80095C10" - addr_pal: 0x80B81468 + type: add_func_pointer + target_func: 'Return' + src_addr_pal: 0x80B81468 diff --git a/src/nullsub.S b/src/nullsub.S new file mode 100644 index 0000000..afdeed9 --- /dev/null +++ b/src/nullsub.S @@ -0,0 +1,16 @@ +.text + +.global Return +Return: + blr + +.global ReturnTrue +ReturnTrue: + li r3, 1 + blr + +.global ReturnFalse +ReturnFalse: + li r3, 0 + blr + diff --git a/summerhax.yaml b/summerhax.yaml index a8875e3..2dfd60f 100644 --- a/summerhax.yaml +++ b/summerhax.yaml @@ -1,4 +1,4 @@ -source_files: [../src/summermodel.cpp, ../src/fix38.S] +source_files: [../src/summermodel.cpp, ../src/fix38.S, ../src/nullsub.S] hooks: - {name: RemoveTitleReplay, addr_pal: 0x80781FBC, type: patch, data: '60000000 60000000 60000000'} - {name: RemoveToadHouseMsg1, addr_pal: 0x808FB974, type: patch, data: '60000000'} @@ -12,9 +12,9 @@ hooks: target_func: 'fix38WithJumpCoin' - name: PreventW5Vine - type: patch - addr_pal: 0x809882A4 - data: '80004360' + type: add_func_pointer + src_addr_pal: 0x809882A4 + target_func: 'ReturnTrue' - name: PreventW5VineSound type: patch @@ -87,34 +87,34 @@ hooks: data: '48000014' - name: StarsDontKillSpikesUD - type: patch - addr_pal: 0x80AFF4D8 - data: '80004360' + type: add_func_pointer + src_addr_pal: 0x80AFF4D8 + target_func: 'Return' - name: StarsDontKillSpikesD - type: patch - addr_pal: 0x80AFF784 - data: '80004360' + type: add_func_pointer + src_addr_pal: 0x80AFF784 + target_func: 'Return' - name: StarsDontKillSpikesU - type: patch - addr_pal: 0x80AFFA30 - data: '80004360' + type: add_func_pointer + src_addr_pal: 0x80AFFA30 + target_func: 'Return' - name: StarsDontKillSpikesLR - type: patch - addr_pal: 0x80AFFCDC - data: '80004360' + type: add_func_pointer + src_addr_pal: 0x80AFFCDC + target_func: 'Return' - name: StarsDontKillSpikesR - type: patch - addr_pal: 0x80AFFF88 - data: '80004360' + type: add_func_pointer + src_addr_pal: 0x80AFFF88 + target_func: 'Return' - name: StarsDontKillSpikesL - type: patch - addr_pal: 0x80B00234 - data: '80004360' + type: add_func_pointer + src_addr_pal: 0x80B00234 + target_func: 'Return' - name: WaterEffectsWm_ob_sandpillar02 @@ -160,14 +160,19 @@ hooks: - name: UrchinDoNotDieFireIce - type: patch - addr_pal: 0x80B0CF38 - data: '8000436080004360' + type: add_func_pointer + src_addr_pal: 0x80B0CF38 + target_func: 'Return' + +- name: UrchinDoNotDieFireIceB + type: add_func_pointer + src_addr_pal: 0x80B0CF3C + target_func: 'Return' - name: UrchinDoNotDieStar - type: patch - addr_pal: 0x80B0CF38 - data: '80004360' + type: add_func_pointer + src_addr_pal: 0x80B0CF38 + target_func: 'Return' - name: UrchinDoNotTurn type: patch diff --git a/tools/mapfile_tool.py b/tools/mapfile_tool.py index 92e53ad..3556d0d 100755 --- a/tools/mapfile_tool.py +++ b/tools/mapfile_tool.py @@ -215,28 +215,39 @@ def do_mapfile(src, dest, fix_offset): def work_on_hook(hook, id, func): - #print 'doing %s (%s) for %s' % (hook['name'], hook['type'], id) + + try: + t = hook['type'] - t = hook['type'] + if t == 'patch': + error = 'missing addr' + + hook['addr_%s' % id] = func(hook['addr_%s' % original]) - if t == 'patch': - hook['addr_%s' % id] = func(hook['addr_%s' % original]) + elif t == 'branch_insn' or t == 'add_func_pointer': + error = 'missing src_addr' - elif t == 'branch_insn' or t == 'add_func_pointer': - hook['src_addr_%s' % id] = func(hook['src_addr_%s' % original]) + hook['src_addr_%s' % id] = func(hook['src_addr_%s' % original]) - if 'target_func_%s' % original in hook: - hook['target_func_%s' % id] = func(hook['target_func_%s' % original]) + if 'target_func_%s' % original in hook: + error = 'missing target_func' - elif t == 'nop_insn': - area = hook['area_%s' % original] - if isinstance(area, list): - start = func(area[0]) - new_area = [start, start + (area[1] - area[0])] - else: - new_area = func(area) + hook['target_func_%s' % id] = func(hook['target_func_%s' % original]) - hook['area_%s' % id] = new_area + elif t == 'nop_insn': + error = 'missing area' + + area = hook['area_%s' % original] + if isinstance(area, list): + start = func(area[0]) + new_area = [start, start + (area[1] - area[0])] + else: + new_area = func(area) + + hook['area_%s' % id] = new_area + + except: + print 'Key Error %s for %s (%s) for %s' % (error, hook['name'], hook['type'], id) #if hook['name'] == 'WM_onCreate': print hook -- cgit v1.2.3