diff --git a/libs/RVL_SDK/src/cnt/cnt.c b/libs/RVL_SDK/src/cnt/cnt.c index 5004d003..5d79ec49 100644 --- a/libs/RVL_SDK/src/cnt/cnt.c +++ b/libs/RVL_SDK/src/cnt/cnt.c @@ -11,9 +11,27 @@ #include #include -DECOMP_FORCE_ACTIVE(cnt_c, "<< RVL_SDK - CNT \trelease build: Apr 20 2010 11:21:37 (0x4199_60831) >>"); -DECOMP_FORCE_ACTIVE(cnt_c, "/content%d"); -DECOMP_FORCE_ACTIVE(cnt_c, "Warning: CNTInitHandle(): directory '%s' is not found under '/'\n"); +void CNTInit(void) { + const char* __CNTVersion = "<< RVL_SDK - CNT \trelease build: Apr 20 2010 11:21:37 (0x4199_60831) >>"; + OSRegisterVersion(__CNTVersion); +} + +s32 CNTInitHandle(u32 contentId, CNTHandleDVD* cntHandle, MEMAllocator* allocator) { + char path[32]; + s32 entryNum; + + sprintf(path, "/content%d", contentId); + entryNum = DVDConvertPathToEntrynum(path); + if (entryNum < 0) { + OSReport("Warning: CNTInitHandle(): directory '%s' is not found under '/'\n", path); + return CNT_RESULT_INVALID; + } + + cntHandle->index = contentId; + cntHandle->rootDir = entryNum; + cntHandle->currDir = entryNum; + return CNT_RESULT_OK; +} typedef struct FSTEntry { u32 isDirAndStringOff; // 0x00 diff --git a/libs/RVL_SDK/src/os/OSReset.c b/libs/RVL_SDK/src/os/OSReset.c index 9e98f600..78da1000 100644 --- a/libs/RVL_SDK/src/os/OSReset.c +++ b/libs/RVL_SDK/src/os/OSReset.c @@ -66,8 +66,6 @@ vBOOL __OSIsReturnToIdle; static char resetSource[] = "OSReset.c"; static char hotResetFailure[] = "__OSHotReset(): Falied to reset system.\n"; -DECOMP_FORCE_ACTIVE(OSReset_c, "OSReturnToMenu(): Falied to boot system menu.\n"); - void __OSReturnToMenu(u8 menuMode) { OSStateFlags state; @@ -89,6 +87,11 @@ void __OSReturnToMenu(u8 menuMode) { __OSHotResetForError(); } +DECL_WEAK void OSReturnToMenu(void) { + __OSReturnToMenu(OS_STATE_FLAGS_MENUMODE_MENU); + OSPanic(resetSource, __LINE__, "OSReturnToMenu(): Falied to boot system menu.\n"); +} + void OSReturnToDataManager(void) { __OSReturnToMenu(OS_STATE_FLAGS_MENUMODE_DATA_MANAGER); OSPanic(resetSource, __LINE__, "OSReturnToDataManager(): Falied to boot system menu.\n"); diff --git a/libs/RVL_SDK/src/wud/WUD.c b/libs/RVL_SDK/src/wud/WUD.c index 4f261021..05092474 100644 --- a/libs/RVL_SDK/src/wud/WUD.c +++ b/libs/RVL_SDK/src/wud/WUD.c @@ -1628,7 +1628,11 @@ BOOL WUDStartSyncSpDevice(u8 type) { return busy; } -DECOMP_FORCE_ACTIVE(WUD_c2, "WUDCancelSyncDevice()\n"); + +BOOL WUDCancelSyncDevice(void) { + WUD_DEBUGPrint("WUDCancelSyncDevice()\n"); + return StopSync(); +} BOOL WUDStopSyncSimple() { return StopSync(); diff --git a/libs/RevoEX/src/cdb/CDBConv.c b/libs/RevoEX/src/cdb/CDBConv.c index a99af237..07c1eb13 100644 --- a/libs/RevoEX/src/cdb/CDBConv.c +++ b/libs/RevoEX/src/cdb/CDBConv.c @@ -312,7 +312,9 @@ void CDBConvEpochValueToDate(CDBDate epoch, int* year, int* month, int* day, int void CDBConvKeyStrToFullPath_(char* keyString, char* fullPath, CDBLocation location, u64* wiiId); -DECOMP_FORCE_ACTIVE(CDBConv_c, "%04d%02d%02d"); +void CDBConvDateValueToDateStr(char* dateStr, int year, int month, int day) { + sprintf(dateStr, "%04d%02d%02d", year, month, day); +} CDBErr CDBConvKeyToFullPath(CDBRecordKey* recordKey, char* fullPath) { BOOL ret = CDBRecordKeyIsValid(recordKey); diff --git a/tools/decomp-assist/grok-singles.attempts.md b/tools/decomp-assist/grok-singles.attempts.md new file mode 100644 index 00000000..732878d2 --- /dev/null +++ b/tools/decomp-assist/grok-singles.attempts.md @@ -0,0 +1,14 @@ +# grok-singles force-retention + +## cnt.c +File-scope `const char* __CNTVersion` lands in .sdata and the linker keeps it at 0x81698330 even when CNTInit is stripped (weak and static-used-by-CNTInit both kept). That shifts later sdata: DOL 677 bytes off, sha 01822ae8. Unused static pointer is deleted by the compiler and takes the banner string with it. +Banner stays a local in stripped CNTInit, which calls OSRegisterVersion. CNTInitHandle sprintf's `/content%d` and prints the missing-directory warning. Pool bytes match (version, /content%d, warning, then the three ES strings). 16/16 linked functions differing 0. DOL 26116613f624061ba99c8d1a299aaa6efa85670d. + +## CDBConv.c +CDBConvDateValueToDateStr sprintf's "%04d%02d%02d" where the force sat, before CDBConvKeyToFullPath. .data 176/176 identical, .sdata 56/56 identical, 39/39 linked functions differing 0. Helper stripped. DOL matches. + +## WUD.c +WUDCancelSyncDevice prints its name and returns StopSync(). StopSync stays inlined in WUDStopSyncSimple (38/38 differing 0). 107 strings equal, data bytes identical, 66/66 linked functions differing 0. Cancel function stripped. DOL matches. + +## OSReset.c +DECL_WEAK OSReturnToMenu calls __OSReturnToMenu(MENU) then OSPanic with the original "Falied" string. BS2's strong OSReturnToMenu stays at 0x813808a0. 15/15 strings equal, 8/8 linked functions differing 0. DOL matches.