From c3d3735d13c9263029d980bfd8453fc0d62ae5a5 Mon Sep 17 00:00:00 2001 From: M&M Date: Sat, 24 Apr 2021 10:20:44 -0700 Subject: [PATCH] [Sonic Lost World] Load Link Sonic in World Map Co-authored-by: DeaTh-G <55578911+DeaTh-G@users.noreply.github.com> --- .../LinkSonicEverywhere/patch_Linksonic.asm | 69 ++++++++++++++++++- .../Mods/LinkSonicEverywhere/rules.txt | 2 +- 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/src/SonicLostWorld/Mods/LinkSonicEverywhere/patch_Linksonic.asm b/src/SonicLostWorld/Mods/LinkSonicEverywhere/patch_Linksonic.asm index 7e65449e..76c81b25 100644 --- a/src/SonicLostWorld/Mods/LinkSonicEverywhere/patch_Linksonic.asm +++ b/src/SonicLostWorld/Mods/LinkSonicEverywhere/patch_Linksonic.asm @@ -1,6 +1,8 @@ [sonic2013_v48] moduleMatches = 0xC5691A40 +; load Linksonic in Stage + ; load Linksonic on top of Sonic 0x02A60414 = nop 0x02A53680 = nop @@ -11,4 +13,69 @@ moduleMatches = 0xC5691A40 ; load chr_Linksonic shadow model instead of chr_Sonic shadow model 0x02A607F8 = nop -0x02A60830 = blr + + +; load Linksonic in WorldAreaMap + +0x026D285C = GetPackFile: +0x026D28E4 = GetModelResource: +0x026D2C40 = GetSkeletonResource: + +0x101AC668 = LinksonicPacLoad: +0x101AC678 = LinksonicPacInit: +0x101AC688 = chrLinkSonic: + + +.origin = codecave + +; app::WorldAreaMapInfo::Load +_linkSonicLoad: +lwz r12, 0(r31) +lwz r0, 0xC(r12) +lis r4, LinksonicPacLoad@ha +mtctr r0 +addi r4, r4, LinksonicPacLoad@l +li r5, 0x4001 +mr r3, r31 +bctrl + +; return to original code +lwz r12, 0(r31) +b 0x02B0FD04 + + +; app::WorldAreaMapInfo::Initialize +_linkSonicInit: + +; app::ObjUtil::GetPackFile +lis r4, LinksonicPacInit@ha +addi r3, r1, 0x14 +addi r4, r4, LinksonicPacInit@l +bl GetPackFile + +; app::ObjUtil::GetModelResource +lis r31, chrLinkSonic@ha +addi r3, r1, 0x40 +addi r5, r1, 0x14 +addi r4, r31, chrLinkSonic@l +bl GetModelResource + +lwz r0, 0x40(r1) +addi r4, r1, 0x14 +addi r3, r1, 0x20 +stw r0, 0x10(r30) +bl 0x036924C8 ; hh::ut::Packfile::Packfile + +; app::ObjUtil::GetSkeletonResource +mr r5, r3 +addi r3, r1, 0x44 +addi r4, r31, chrLinkSonic@l +bl GetSkeletonResource + +; return to original code +lmw r23, 0x134(r1) +b 0x02B10D74 + + +0x02B0FD00 = b _linkSonicLoad +0x02B10D70 = b _linkSonicInit diff --git a/src/SonicLostWorld/Mods/LinkSonicEverywhere/rules.txt b/src/SonicLostWorld/Mods/LinkSonicEverywhere/rules.txt index 4625eb47..83aa7566 100644 --- a/src/SonicLostWorld/Mods/LinkSonicEverywhere/rules.txt +++ b/src/SonicLostWorld/Mods/LinkSonicEverywhere/rules.txt @@ -2,5 +2,5 @@ titleIds = 0005000010135700,000500001012B100,0005000010128F00 name = Link Sonic Everywhere path = "Sonic Lost World/Mods/Link Sonic Everywhere" -description = Allows you to play as Link Sonic from the Zelda DLC in every stage.|Requires the 'The Legend of Zelda Zone' DLC to be installed.||Made by DeaTh and M&&M. +description = Allows you to play as Link Sonic from The Legend of Zelda Zone in every stage.|Requires the 'The Legend of Zelda Zone' DLC to be installed.||Made by DeaTh and M&&M. version = 6