From 08a4f2028bcf3429b3f37196b1af14e503387a42 Mon Sep 17 00:00:00 2001 From: SwareJonge Date: Mon, 6 Feb 2023 04:29:54 +0100 Subject: [PATCH] add orderstringsm for sdata2 strings --- config/dol_slices.yml | 4 +-- config/symbols.yml | 3 +- configure.py | 10 +++--- include/JSystem/JFramework/JFWDisplay.h | 7 ++++ src/JSystem/JKernel/JKRFileFinder.cpp | 1 - src/Osako/TARecord.cpp | 4 +-- src/Osako/system.cpp | 45 +++++++++++++------------ tools/ppcdis | 2 +- 8 files changed, 43 insertions(+), 33 deletions(-) diff --git a/config/dol_slices.yml b/config/dol_slices.yml index b58381f..6eecc4f 100644 --- a/config/dol_slices.yml +++ b/config/dol_slices.yml @@ -205,10 +205,10 @@ Osako/main.cpp: #Osako/system.cpp: #.text: [0x801feb10, 0x801ffe80] # exclude __sinit_system_cpp (801fff8c) - #.ctors: [0x8031637c, 0x80316380] + ##.ctors: [0x8031637c, 0x80316380] #.rodata: [0x8037d5e8, 0x8037d658] #.data: [0x8039cac0, 0x8039caf8] - #.bss: [0x803d08f0, 0x803d0920] + ##.bss: [0x803d08f0, 0x803d0920] #.sbss: [0x80416968, 0x80416998] #.sdata2: [0x8041b688, 0x8041b6e8] diff --git a/config/symbols.yml b/config/symbols.yml index b832bd7..d29983b 100644 --- a/config/symbols.yml +++ b/config/symbols.yml @@ -1100,8 +1100,9 @@ global: # GameAudioMain.cpp 0x8011b4a8: init__Q29GameAudio4MainFP12JKRSolidHeapUlPvPvUl 0x8011e540: startSystemSe__Q29GameAudio4MainFUl + 0x80416218: msBasic__Q29GameAudio4Main - # MotorManager.cpp + # MotorManager.cpp 0x80130e58: __ct__12MotorManagerFP7JKRHeap 0x80130ee0: __dt__12MotorManagerFv 0x80130f48: reset__12MotorManagerFv diff --git a/configure.py b/configure.py index 1a786c5..76d5d7b 100644 --- a/configure.py +++ b/configure.py @@ -299,12 +299,12 @@ class JumptableInclude(GeneratedInclude): return f"JumptableInclude({self.addr})" class StringInclude(GeneratedInclude): - REGEX = r'#include "orderstrings\/([0-9a-f]{8})_([0-9a-f]{8})\.inc"' + REGEX = r'#include "(orderstrings(m?))\/([0-9a-f]{8})_([0-9a-f]{8})\.inc"' def __init__(self, ctx: c.SourceContext, source_name: str, match: Tuple[str]): - self.start, self.end = match + folder, manual, self.start, self.end = match super().__init__(ctx, source_name, - f"{c.BUILD_INCDIR}/orderstrings/{self.start}_{self.end}.inc") + f"{c.BUILD_INCDIR}/{folder}/{self.start}_{self.end}.inc") def build(includes: List["StringInclude"]): # Skip empty list @@ -316,12 +316,14 @@ class StringInclude(GeneratedInclude): # Build for inc in includes: + sda = "--sda " if ctx.sdata2_threshold >= 4 else "" n.build( inc.path, rule="orderstrings", inputs=ctx.binary, variables={ - "addrs" : f"{inc.start} {inc.end}" + "addrs" : f"{inc.start} {inc.end}", + "flags" : f"{sda}" } ) diff --git a/include/JSystem/JFramework/JFWDisplay.h b/include/JSystem/JFramework/JFWDisplay.h index 6bf9eca..333411f 100644 --- a/include/JSystem/JFramework/JFWDisplay.h +++ b/include/JSystem/JFramework/JFWDisplay.h @@ -95,6 +95,13 @@ public: return JUTVideo::getManager()->getFbWidth(); } + JUTFader * getFader() const { return mFader; } + void setFader(JUTFader * fader) { mFader = fader; } + + void set_38(int val) { + _38 = val; + } + int startFadeOut(int param_0) { if (mFader != nullptr) { return mFader->startFadeOut(param_0); diff --git a/src/JSystem/JKernel/JKRFileFinder.cpp b/src/JSystem/JKernel/JKRFileFinder.cpp index 05323d8..b6e86b0 100644 --- a/src/JSystem/JKernel/JKRFileFinder.cpp +++ b/src/JSystem/JKernel/JKRFileFinder.cpp @@ -46,7 +46,6 @@ bool JKRDvdFinder::findNextFile() { mIsAvailable = DVDReadDir(&mFstEntry, &entry); if (mIsAvailable) { - u16 v1 = 1; mIsFileOrDir = (bool)entry.mNextEntryNum; mFileName = entry.mFileNameMaybe; mFileIndex = entry.mEntryNum; diff --git a/src/Osako/TARecord.cpp b/src/Osako/TARecord.cpp index a06004d..a7534f8 100644 --- a/src/Osako/TARecord.cpp +++ b/src/Osako/TARecord.cpp @@ -18,7 +18,7 @@ void TARecord::setStatus(u8 charId1, u8 charId2, u8 kartId, u8 courseId) { } void TARecord::setRaceTime(RaceTime raceTime) { - mTime = raceTime; // could also be just mTime = raceTime + mTime = raceTime; } void TARecord::set(u8 charId1, u8 charId2, u8 kartId, u8 courseId, const char * name, RaceTime raceTime) { @@ -34,5 +34,5 @@ bool TARecord::less(const TARecord & mRec) { if(mKartID == 0xff) return true; - return mRec.mTime.isLittle(mTime); + return mRec.getRaceTime().isLittle(mTime); } \ No newline at end of file diff --git a/src/Osako/system.cpp b/src/Osako/system.cpp index e15f9a3..bca2a45 100644 --- a/src/Osako/system.cpp +++ b/src/Osako/system.cpp @@ -16,7 +16,6 @@ static const float lbl_8037d5e8[4] = {0.0f, 0.0f, 0.0f, 1.0f}; #pragma force_active on DUMMY_POINTER(lbl_8037d5e8) #pragma pop -#include "orderstrings/8037d60c_8037d670.inc" namespace System { void startAudioTask(void* p1) { @@ -103,10 +102,14 @@ namespace System { }*/ } +#include "orderstrings/8037d60c_8037d670.inc" // .sdata2 -#include "orderstrings/8041b688_8041b6b4.inc" +#include "orderstringsm/8041b688_8041b6b4.inc" +/*const float lbl_8041b6b4 = -1.0f; +const float lbl_8041b6b8 = 1.0f; +const float lbl_8041b6bc = 0.0f;*/ #include "orderfloatsm/8041b6b4_8041b6c0.inc" -#include "orderstrings/8041b6c0_8041b6e8.inc" +#include "orderstringsm/8041b6c0_8041b6e8.inc" asm void System::init() { @@ -117,7 +120,7 @@ asm void System::init() namespace System { void reset() { - mspDisplay->_38 = 1; + mspDisplay->set_38(1); changeNormalRenderMode(); } @@ -134,14 +137,13 @@ namespace System { void changeProgressive() { switch (msRenderMode) + { case 0: - { - JUTVideo::getManager()->setRenderMode(SystemData::scNtscProg448Soft); + JUTVideo::getManager()->setRenderMode(&SystemData::scNtscProg448Soft); msRenderMode = 2; - } + break; case 1: - { - JUTVideo::getManager()->setRenderMode(SystemData::scNtscProg448); + JUTVideo::getManager()->setRenderMode(&SystemData::scNtscProg448); msRenderMode = 3; break; } @@ -149,15 +151,14 @@ namespace System { void changeMovieRenderMode() { - switch (msRenderMode) + switch (msRenderMode) + { case 0: - { - JUTVideo::getManager()->setRenderMode(SystemData::scNtscInt448); + JUTVideo::getManager()->setRenderMode(&SystemData::scNtscInt448); msRenderMode = 1; - } + break; case 2: - { - JUTVideo::getManager()->setRenderMode(SystemData::scNtscProg448); + JUTVideo::getManager()->setRenderMode(&SystemData::scNtscProg448); msRenderMode = 3; break; } @@ -166,14 +167,13 @@ namespace System { void changeNormalRenderMode() { switch (msRenderMode) + { case 1: - { - JUTVideo::getManager()->setRenderMode(SystemData::scNtscInt448Df); + JUTVideo::getManager()->setRenderMode(&SystemData::scNtscInt448Df); msRenderMode = 0; - } + break; case 3: - { - JUTVideo::getManager()->setRenderMode(SystemData::scNtscProg448Soft); + JUTVideo::getManager()->setRenderMode(&SystemData::scNtscProg448Soft); msRenderMode = 2; break; } @@ -182,9 +182,10 @@ namespace System { void callbackException(u16, OSContext *, u32, u32) { haltRumble(); - JUTFader *fader = mspDisplay->mFader; // getFader() or inline startfadeIn + mspDisplay->startFadeIn(0); + /*JUTFader *fader = mspDisplay->getFader(); // getFader() or inline startfadeIn if (fader) - fader->startFadeIn(0); + fader->startFadeIn(0);*/ } /*void haltRumble() { diff --git a/tools/ppcdis b/tools/ppcdis index 8326082..eca3f30 160000 --- a/tools/ppcdis +++ b/tools/ppcdis @@ -1 +1 @@ -Subproject commit 83260829c50f37dd9fe54889cf8971c8fe14c54e +Subproject commit eca3f3015a86bf0c78d1e415aeff2dda1851194f