From 7dc593579651b88b134372c428274e7168c8ce05 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Tue, 29 Oct 2024 17:12:23 -0700 Subject: [PATCH] Use CW 1.3 for MSL_C, fix runtime compiler configurations, and link TUs --- config/GM8E01_00/symbols.txt | 4 ++-- config/GM8E01_01/symbols.txt | 14 +++++++------- configure.py | 11 ++++++----- src/MetroidPrime/CModelData.cpp | 25 +++++++++++++++++++++++++ src/Runtime/__mem.c | 2 +- 5 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 src/MetroidPrime/CModelData.cpp diff --git a/config/GM8E01_00/symbols.txt b/config/GM8E01_00/symbols.txt index ceb02e76..d948e83d 100644 --- a/config/GM8E01_00/symbols.txt +++ b/config/GM8E01_00/symbols.txt @@ -21870,7 +21870,7 @@ lbl_805A9304 = .sbss:0x805A9304; // type:object size:0x4 data:4byte lbl_805A9308 = .sbss:0x805A9308; // type:object size:0x1 data:byte lbl_805A930C = .sbss:0x805A930C; // type:object size:0x4 data:4byte lbl_805A9310 = .sbss:0x805A9310; // type:object size:0x8 data:byte -lbl_805A9318 = .sbss:0x805A9318; // type:object size:0x8 data:4byte +sTotalSize__22CCharAnimMemoryMetrics = .sbss:0x805A9318; // type:object size:0x8 data:4byte lbl_805A9320 = .sbss:0x805A9320; // type:object size:0x1 data:byte lbl_805A9324 = .sbss:0x805A9324; // type:object size:0x1 data:byte lbl_805A9328 = .sbss:0x805A9328; // type:object size:0x1 data:byte @@ -27025,7 +27025,7 @@ lbl_805AF1B0 = .sdata2:0x805AF1B0; // type:object size:0x8 align:8 data:double @970 = .sdata2:0x805AF26C; // type:object size:0x4 scope:local data:float lbl_805AF270 = .sdata2:0x805AF270; // type:object size:0x4 data:float lbl_805AF278 = .sdata2:0x805AF278; // type:object size:0x8 align:8 data:double -lbl_805AF280 = .sdata2:0x805AF280; // type:object size:0x8 data:float +@287 = .sdata2:0x805AF280; // type:object size:0x4 scope:local data:float lbl_805AF288 = .sdata2:0x805AF288; // type:object size:0x4 data:float lbl_805AF28C = .sdata2:0x805AF28C; // type:object size:0x4 data:float lbl_805AF290 = .sdata2:0x805AF290; // type:object size:0x4 data:float diff --git a/config/GM8E01_01/symbols.txt b/config/GM8E01_01/symbols.txt index 66a50856..51c0e4b9 100644 --- a/config/GM8E01_01/symbols.txt +++ b/config/GM8E01_01/symbols.txt @@ -29,8 +29,8 @@ __as__12CSystemStateFRC12CSystemState = .text:0x800039CC; // type:function size: __as__Q24rstl63vector,Q24rstl17rmemory_allocator>FRCQ24rstl63vector,Q24rstl17rmemory_allocator> = .text:0x80003B8C; // type:function size:0xFC scope:global __as__Q24rstl24single_ptr<10CGameState>FP10CGameState = .text:0x80003C88; // type:function size:0x48 scope:global __dt__10CGameStateFv = .text:0x80003CD0; // type:function size:0x190 scope:global -fn_80003E60 = .text:0x80003E60; // type:function size:0x8C scope:global -fn_80003EEC = .text:0x80003EEC; // type:function size:0x98 scope:global +__dt__Q24rstl48vector<11CWorldState,Q24rstl17rmemory_allocator>Fv = .text:0x80003E60; // type:function size:0x8C scope:global +deallocate<11CWorldState>__Q24rstl17rmemory_allocatorFP11CWorldState = .text:0x80003EEC; // type:function size:0x98 scope:global __dt__12CGameOptionsFv = .text:0x80003F84; // type:function size:0xF0 scope:global __ct__12CGameOptionsFRC12CGameOptions = .text:0x80004074; // type:function size:0x164 scope:global __dt__12CSystemStateFv = .text:0x800041D8; // type:function size:0x14C scope:global @@ -38,7 +38,7 @@ __ct__12CSystemStateFRC12CSystemState = .text:0x80004324; // type:function size: StreamNewGameState__5CMainFR12CInputStreami = .text:0x800044A4; // type:function size:0xEC scope:global RefreshGameState__5CMainFv = .text:0x80004590; // type:function size:0x21C scope:global __dt__15CMemoryInStreamFv = .text:0x800047AC; // type:function size:0x60 scope:global -nullsub_2 = .text:0x8000480C; // type:function size:0x4 scope:global +fn_8000480C = .text:0x8000480C; // type:function size:0x4 scope:global EnsureWorldPaksReady__5CMainFv = .text:0x80004810; // type:function size:0x6C scope:global EnsureWorldPakReady__5CMainFUi = .text:0x8000487C; // type:function size:0x170 scope:global fn_800049EC = .text:0x800049EC; // type:function size:0xB0 scope:global @@ -18056,7 +18056,7 @@ gDigitalInputs__13ControlMapper = .data:0x803D93BC; // type:object size:0x114 sc @93 = .data:0x803D95CC; // type:object size:0xC scope:local gPressInputs__13ControlMapper = .data:0x803D95D8; // type:object size:0x114 scope:global data:4byte @310 = .data:0x803D96EC; // type:object size:0xF4 scope:local -@336 = .data:0x803D97E0; // type:object size:0x60 scope:local +@336 = .data:0x803D97E0; // type:object size:0x5C scope:local lbl_803D9660 = .data:0x803D9840; // type:object size:0x78 scope:global __vt__11CObjectList = .data:0x803D98B8; // type:object size:0xC scope:global __vt__7CPlayer = .data:0x803D98C8; // type:object size:0x88 scope:global @@ -19193,7 +19193,7 @@ skDoorVerts__15CMappableObject = .bss:0x8046C678; // type:object size:0x60 scope lbl_8046C4F8 = .bss:0x8046C6D8; // type:object size:0xC scope:local lbl_8046C504 = .bss:0x8046C6E4; // type:object size:0x1C scope:local data:4byte lbl_8046C520 = .bss:0x8046C700; // type:object size:0x18 scope:local data:4byte -skNullAdvance = .bss:0x8046C718; // type:object size:0x20 data:float scope:local +skNullAdvance = .bss:0x8046C718; // type:object size:0x20 scope:local data:float lbl_8046C558 = .bss:0x8046C738; // type:object size:0xC scope:local lbl_8046C564 = .bss:0x8046C744; // type:object size:0xC scope:local lbl_8046C570 = .bss:0x8046C750; // type:object size:0xA8 scope:local @@ -20169,7 +20169,7 @@ lbl_805A7548 = .sdata:0x805A7728; // type:object size:0x1 scope:global data:byte lbl_805A754C = .sdata:0x805A772C; // type:object size:0x4 scope:global data:4byte lbl_805A7550 = .sdata:0x805A7730; // type:object size:0x4 scope:global data:float lbl_805A7554 = .sdata:0x805A7734; // type:object size:0x4 scope:global data:4byte -@262 = .sdata:0x805A7738; // type:object size:0x4 data:float scope:local +@262 = .sdata:0x805A7738; // type:object size:0x4 scope:local data:float lbl_805A7560 = .sdata:0x805A7740; // type:object size:0x1 scope:global data:byte lbl_805A7564 = .sdata:0x805A7744; // type:object size:0x4 scope:global data:4byte lbl_805A7568 = .sdata:0x805A7748; // type:object size:0x4 scope:global data:4byte @@ -21803,7 +21803,7 @@ lbl_805A9128 = .sbss:0x805A9308; // type:object size:0x4 scope:global data:4byte lbl_805A912C = .sbss:0x805A930C; // type:object size:0x1 scope:global data:byte lbl_805A9130 = .sbss:0x805A9310; // type:object size:0x4 scope:global data:4byte lbl_805A9134 = .sbss:0x805A9314; // type:object size:0x4 scope:global data:4byte -lbl_805A9138 = .sbss:0x805A9318; // type:object size:0x4 scope:global data:4byte +sTotalSize__22CCharAnimMemoryMetrics = .sbss:0x805A9318; // type:object size:0x4 scope:global data:4byte lbl_805A913C = .sbss:0x805A931C; // type:object size:0x1 scope:global data:byte lbl_805A9140 = .sbss:0x805A9320; // type:object size:0x1 scope:global data:byte lbl_805A9144 = .sbss:0x805A9324; // type:object size:0x4 scope:global data:4byte diff --git a/configure.py b/configure.py index a4e48c22..4badff5b 100755 --- a/configure.py +++ b/configure.py @@ -219,6 +219,7 @@ cflags_runtime = [ "-str reuse,pool,readonly", "-gccinc", "-common off", + "-char signed", "-inline deferred,auto", ] @@ -1180,7 +1181,7 @@ config.libs = [ ), { "lib": "MSL_C.PPCEABI.bare.H", - "mw_version": "GC/1.3.2", + "mw_version": "GC/1.3", "cflags": cflags_runtime, "host": False, "progress_category": "sdk", @@ -1211,7 +1212,7 @@ config.libs = [ Object(Matching, "Runtime/mem_funcs.c"), Object(Matching, "Runtime/misc_io.c"), Object(NonMatching, "Runtime/printf.c"), - Object(NonMatching, "Runtime/qsort.c"), + Object(Matching, "Runtime/qsort.c"), Object(Matching, "Runtime/rand.c"), Object(Matching, "Runtime/sscanf.c"), Object(Matching, "Runtime/string.c"), @@ -1222,16 +1223,16 @@ config.libs = [ Object(Matching, "Runtime/e_acos.c"), Object(Matching, "Runtime/e_asin.c"), Object(Matching, "Runtime/e_atan2.c"), - Object(NonMatching, "Runtime/e_exp.c"), # CW 1.3.2 lib bug + Object(Matching, "Runtime/e_exp.c"), Object(Matching, "Runtime/e_fmod.c"), Object(Matching, "Runtime/e_log.c"), - Object(NonMatching, "Runtime/e_pow.c"), # CW 1.3.2 lib bug + Object(Matching, "Runtime/e_pow.c"), Object(Matching, "Runtime/e_rem_pio2.c"), Object(Matching, "Runtime/k_cos.c"), Object(Matching, "Runtime/k_rem_pio2.c"), Object(Matching, "Runtime/k_sin.c"), Object(Matching, "Runtime/k_tan.c"), - Object(NonMatching, "Runtime/s_atan.c"), # CW 1.3.2 lib bug + Object(Matching, "Runtime/s_atan.c"), Object(Matching, "Runtime/s_copysign.c"), Object(Matching, "Runtime/s_cos.c"), Object(Matching, "Runtime/s_floor.c"), diff --git a/src/MetroidPrime/CModelData.cpp b/src/MetroidPrime/CModelData.cpp new file mode 100644 index 00000000..a3c1e027 --- /dev/null +++ b/src/MetroidPrime/CModelData.cpp @@ -0,0 +1,25 @@ +#include "MetroidPrime/CAnimRes.hpp" +#include "MetroidPrime/Factories/CCharacterFactoryBuilder.hpp" +#include + +static const CAdvancementDeltas skNullAdvance(CVector3f::Zero(), CQuaternion::NoRotation()); + +CModelData::CModelData(const CStaticRes& res) +: x0_scale(res.GetScale()) +, x14_24_renderSorted(false) +, x14_25_sortThermal(false) +, x18_ambientColor(CColor::White()) +, x1c_normalModel(gpSimplePool->GetObj(SObjectTag('CMDL', res.GetId()))) {} + +CModelData::CModelData() +: x0_scale(1.f, 1.f, 1.f) +, x14_24_renderSorted(false) +, x14_25_sortThermal(false) +, x18_ambientColor(CColor::White()) {} + +CModelData::CModelData(const CAnimRes& res) +: x0_scale(res.GetScale()) +, x14_24_renderSorted(false) +, x14_25_sortThermal(false) +, x18_ambientColor(CColor::White()) { +} diff --git a/src/Runtime/__mem.c b/src/Runtime/__mem.c index a5ef6c12..23481da8 100644 --- a/src/Runtime/__mem.c +++ b/src/Runtime/__mem.c @@ -68,7 +68,7 @@ void __fill_mem(void* dst, int val, size_t n) { cpd = ((unsigned char*)(lpd + 1)) - 1; - n &= 3; + n &= (unsigned char)3; } if (n)