Compare commits

..

18 Commits

Author SHA1 Message Date
coah
9d5a629567 fix: account for AOSSData in strict completion unit count 2026-10-08 16:17:25 -05:00
coah
22e6bbed24 decomp(channel): getTitleName in C (worker 423b68a9) (#1268) 2026-10-08 16:09:07 -05:00
coah
f49f337c6b decomp(aoss): match AOSSSendHelloRequest; move packet state and CRC table into AOSSData.c (proven .bss ownership) (worker 1df7b1d6) (#1267) 2026-10-08 14:52:49 -05:00
coah
c3cad09b66 decomp: match WithZi::update and DeleteUnauthorizedData; link tiZiString and iplESMisc (worker adf0d9ee) (#1266) 2026-10-08 14:46:36 -05:00
coah
11dd7f505a decomp(fa): match sd_drv init/finalize/FAT32 BPB builder and link sd_drv (worker 240c60b4) (#1265) 2026-10-08 14:45:00 -05:00
coah
52c9ea4b70 decomp(keyboard): match CandidateBox LayoutByNW4R::create with real string literals (worker c644f875) (#1264) 2026-10-08 14:39:22 -05:00
coah
eef15925f4 decomp(bs2): match BS2StartGCGame; make target-local BS2Mach symbols static (worker 0dc04259) (#1263) 2026-10-08 14:37:59 -05:00
coah
46baf56e38 docs: mwdbg unblock notes and regsim verdicts for three ties (worker 87a1fd59) (#1262) 2026-10-08 14:29:18 -05:00
coah
23b77a337c decomp(lyt): match Window::DrawFrame and link lyt_window (HBM prior art) (worker 9bd9bdeb) (#1261) 2026-10-08 14:09:03 -05:00
coah
77cf359837 decomp(nhttp): link NHTTP_stdlib_RVL and NHTTP_recvbuf (mscharged prior art, GC/3.0a5) (worker 1fcdff13) (#1260) 2026-10-08 13:51:49 -05:00
coah
af7146a850 decomp: SDChannelSelect collectTitles functions exact; link iplSDChannelSelect (worker 654f9547) (#1259) 2026-10-08 13:45:52 -05:00
coah
16023905ce decomp(nwc24): getUnScrambleId in C (Petari prior art) (worker 0291759e) (#1258) 2026-10-08 13:37:22 -05:00
coah
f9ebd2f4cc refactor: drop per-unit novtable switches that change no object (worker 94d1c9c8) (#1257) 2026-10-08 13:33:40 -05:00
coah
ca98b14ad6 decomp(cntcache): _CNTCACHEIsTitleRemovable and _CNTCACHEDeleteContent in C (worker 34601405) (#1256) 2026-10-08 13:22:56 -05:00
coah
58a1da1cb3 decomp: link iplSDChannelTitle (emit weak LangFile/LayoutFile vtables like iplChannelTitle) (worker ad9dcf3f) (#1255) 2026-10-08 13:12:13 -05:00
coah
8a0436a92f decomp: IRO-off functions in SDChannelSelect, SDChannelTitle, Setting, doUpdateChanInfos; link iplSetting (worker 37ea5c0f) (#1254) 2026-10-08 13:06:57 -05:00
coah
52f4e19325 decomp: makePriorTitleIDList in C (IRO off) (worker f76f9983) (#1253) 2026-10-08 12:57:16 -05:00
coah
77314b30e0 refactor: remove section pragmas, declspecs and padding objects from five units (worker 3edef6a5) (#1252) 2026-10-08 12:37:03 -05:00
51 changed files with 3067 additions and 1155 deletions

View File

@@ -897,13 +897,16 @@ src/scene/setting/iplRakuRakuThread.cpp:
.sbss start:0x81698C60 end:0x81698C70
src/scene/setting/AOSS.c:
.bss start:0x810BDEF8 end:0x810BECA0
.bss start:0x810BDEF8 end:0x810BE838
.text start:0x813FE27C end:0x814021BC
.data start:0x81657C48 end:0x81657DB8
.sdata2 start:0x81694C78 end:0x81694C80
.sdata start:0x81697200 end:0x81697218
.sbss start:0x81698C70 end:0x81698C90
src/scene/setting/AOSSData.c:
.bss start:0x810BE838 end:0x810BECA0
src/scene/setting/ATERM.c:
.bss start:0x810BECA0 end:0x810C0C80
.text start:0x814021BC end:0x81406CC0

View File

@@ -93,8 +93,8 @@ sRakuMsgQueue = .bss:0x810BDED4; // type:object size:0x20
AOSS_810BDEF8 = .bss:0x810BDEF8; // type:object size:0x20 data:4byte
AOSS_810BDF18 = .bss:0x810BDF18; // type:object size:0x6A0
AOSS_810BE5B8 = .bss:0x810BE5B8; // type:object size:0x280
AOSS_810BE838 = .bss:0x810BE838; // type:object size:0x68
AOSS_810BE8A0 = .bss:0x810BE8A0; // type:object size:0x400
s_packetState = .bss:0x810BE838; // type:object size:0x68
s_crcTable = .bss:0x810BE8A0; // type:object size:0x400
gAtermIpConfig = .bss:0x810BECA0; // type:object size:0x7C4 data:4byte
gAtermIfConfig = .bss:0x810BF464; // type:object size:0x15E
ATERM_810BF5C4 = .bss:0x810BF5C4; // type:object size:0x24
@@ -4617,11 +4617,11 @@ updateDialogAnimation__Q33ipl5scene15SDChannelSelectFv = .text:0x813DCAC4; // ty
setDialogMessage__Q33ipl5scene15SDChannelSelectFUlUl = .text:0x813DCEF0; // type:function size:0x24
isCurrentTitleUsageEnough__Q33ipl5scene15SDChannelSelectCFPCl = .text:0x813DCF14; // type:function size:0xCC
getCurrentTitleUsage__Q33ipl5scene15SDChannelSelectCFPlPl = .text:0x813DCFE0; // type:function size:0xCC
collectTitlesByUsage__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl = .text:0x813DD0AC; // type:function size:0x194
collectTitlesFromNandUsage__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl = .text:0x813DD240; // type:function size:0x198
collectTitlesByChannelOrder__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl = .text:0x813DD3D8; // type:function size:0x1F8
collectTitlesBySpecialChannels__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl = .text:0x813DD5D0; // type:function size:0x5A4
collectTitlesForMode__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUli = .text:0x813DDB74; // type:function size:0x40
collectTitlesByUsage__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUl = .text:0x813DD0AC; // type:function size:0x194
collectTitlesFromNandUsage__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUl = .text:0x813DD240; // type:function size:0x198
collectTitlesByChannelOrder__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUl = .text:0x813DD3D8; // type:function size:0x1F8
collectTitlesBySpecialChannels__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUl = .text:0x813DD5D0; // type:function size:0x5A4
collectTitlesForMode__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUli = .text:0x813DDB74; // type:function size:0x40
findAdjacentChannel__Q33ipl5scene15SDChannelSelectCFiPiPi = .text:0x813DDBB4; // type:function size:0xB4
setCurrentPageAndRefresh__Q33ipl5scene15SDChannelSelectFiiPQ33ipl5scene12SDChannelObj = .text:0x813DDC68; // type:function size:0x18
handleFourPageDialog__Q33ipl5scene15SDChannelSelectFv = .text:0x813DDC80; // type:function size:0x58
@@ -17727,12 +17727,20 @@ __vt__Q39textinput4util9Animation = .data:0x8165D258; // type:object size:0x24
@STRING@GetTextColor__Q34nw4r3lyt7TextBoxCFUl = .data:0x8165D28C; // type:object size:0x41 data:string
scT_prdc_Text_00 = .data:0x8165D2D0; // type:object size:0xF data:string
scP_prdc_scrl_Left = .data:0x8165D2E0; // type:object size:0x11 data:string
scCandidatePaneData = .data:0x8165D2F8; // type:object size:0x68C
scPaneNameTable = .data:0x8165D984; // type:object size:0x84
scW_predictWindow = .data:0x8165DA08; // type:object size:0x10 data:string
scN_predictInput = .data:0x8165DA18; // type:object size:0xF data:string
scW_OnOff_Area = .data:0x8165DA28; // type:object size:0xD data:string
scN_prdc_Texts = .data:0x8165DA38; // type:object size:0xD data:string
scCandidatePaneData = .data:0x8165D2F8; // type:object size:0x680
@9934 = .data:0x8165D978; // type:object size:0x9 scope:local data:string
@9935 = .data:0x8165D984; // type:object size:0x9 scope:local data:string
@9936 = .data:0x8165D990; // type:object size:0xB scope:local data:string
@9937 = .data:0x8165D99C; // type:object size:0xB scope:local data:string
@9938 = .data:0x8165D9A8; // type:object size:0xA scope:local data:string
@9939 = .data:0x8165D9B4; // type:object size:0x11 scope:local data:string
@9940 = .data:0x8165D9C8; // type:object size:0x11 scope:local data:string
@9941 = .data:0x8165D9DC; // type:object size:0x11 scope:local data:string
@9942 = .data:0x8165D9F0; // type:object size:0x11 scope:local data:string
@9943 = .data:0x8165DA08; // type:object size:0x10 scope:local data:string
@10036 = .data:0x8165DA18; // type:object size:0xF scope:local data:string
@10037 = .data:0x8165DA28; // type:object size:0xD scope:local data:string
@10041 = .data:0x8165DA38; // type:object size:0xD scope:local data:string
@10530 = .data:0x8165DA48; // type:object size:0x1C scope:local
@6761 = .data:0x8165DA64; // type:object size:0xF scope:local data:string
@6762 = .data:0x8165DA74; // type:object size:0xF scope:local data:string

View File

@@ -678,7 +678,7 @@ config.libs = [
Object(Matching, "utility/iplThread.cpp"),
Object(Matching, "utility/iplMessageBase.cpp"),
Object(Matching, "utility/iplJpegDecoder.cpp"),
Object(NonMatching, "utility/iplESMisc.cpp"),
Object(Matching, "utility/iplESMisc.cpp"),
Object(Matching, "utility/iplCSFlags.cpp"),
]
),
@@ -849,12 +849,12 @@ config.libs = [
]
),
IPLSection("sdChannelSelect", [
Object(NonMatching, "scene/sdChannelSelect/iplSDChannelSelect.cpp"),
Object(Matching, "scene/sdChannelSelect/iplSDChannelSelect.cpp"),
Object(Matching, "scene/sdChannelSelect/iplSDChannelObj.cpp"),
]
),
IPLSection("sdChannelTitle", [
Object(NonMatching, "scene/sdChannelTitle/iplSDChannelTitle.cpp"),
Object(Matching, "scene/sdChannelTitle/iplSDChannelTitle.cpp"),
]
),
IPLSection("sdButton", [
@@ -868,7 +868,7 @@ config.libs = [
]
),
IPLSection("setting", [
Object(NonMatching, "scene/setting/iplSetting.cpp"),
Object(Matching, "scene/setting/iplSetting.cpp"),
Object(Matching, "scene/setting/iplSensitivity.cpp"),
Object(Matching, "scene/setting/iplNCDSetting.cpp"),
Object(Matching, "scene/setting/iplParental.cpp"),
@@ -879,6 +879,7 @@ config.libs = [
Object(NonMatching, "scene/setting/AOSSLink.c"),
Object(Matching, "scene/setting/iplRakuRakuThread.cpp"),
Object(NonMatching, "scene/setting/AOSS.c", extra_cflags=["-O4,p", "-inline off"]),
Object(Matching, "scene/setting/AOSSData.c"),
Object(NonMatching, "scene/setting/ATERM.c", extra_cflags=["-O4,p", "-inline on"]),
]
),
@@ -917,7 +918,7 @@ config.libs = [
Object(Matching, "keyboard/tiSignWindow.cpp", extra_cflags=["-O4,p"]),
Object(NonMatching, "keyboard/tiString.cpp", extra_cflags=["-O4,p"]),
Object(NonMatching, "keyboard/tiAtokString.cpp", extra_cflags=["-O4,p"]), # for 4.3J
Object(NonMatching, "keyboard/tiZiString.cpp", extra_cflags=["-O4,p"]), # for 4.3U and 4.3E
Object(Matching, "keyboard/tiZiString.cpp", extra_cflags=["-O4,p"]), # for 4.3U and 4.3E
Object(Matching, "keyboard/tiTextDrawer.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiNw4rManager.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiKeyboard.cpp", extra_cflags=["-O4,p"]),
@@ -1057,11 +1058,11 @@ config.libs = [
Object(Matching, "nhttp/NHTTP_control.c"),
Object(Matching, "nhttp/NHTTP_list.c"),
Object(Matching, "nhttp/NHTTP_os_RVL.c"),
Object(NonMatching, "nhttp/NHTTP_recvbuf.c"),
Object(Matching, "nhttp/NHTTP_recvbuf.c", mw_version="GC/3.0a5"),
Object(Matching, "nhttp/NHTTP_request.c"),
Object(Matching, "nhttp/NHTTP_response.c"),
Object(Matching, "nhttp/NHTTP_socket_RVL.c"),
Object(NonMatching, "nhttp/NHTTP_stdlib_RVL.c"),
Object(Matching, "nhttp/NHTTP_stdlib_RVL.c", mw_version="GC/3.0a5"),
Object(Matching, "nhttp/NHTTP_thread.c"),
Object(Matching, "nhttp/d_nhttp_private.c"),
Object(Matching, "nhttp/d_nhttp.c"),
@@ -1323,7 +1324,7 @@ config.libs = [
Object(Matching, "lyt/lyt_layout.cpp"),
Object(Matching, "lyt/lyt_picture.cpp"),
Object(Matching, "lyt/lyt_textBox.cpp"),
Object(Equivalent, "lyt/lyt_window.cpp"),
Object(Matching, "lyt/lyt_window.cpp"),
Object(Matching, "lyt/lyt_bounding.cpp"),
Object(Matching, "lyt/lyt_material.cpp"),
Object(Matching, "lyt/lyt_drawinfo.cpp"),
@@ -1854,7 +1855,7 @@ config.libs = [
Object(Matching, "fa/kernel/pfk_api.c"),
Object(Matching, "fa/driver/nand_drv.c"),
Object(NonMatching, "fa/driver/sd_drv.c"),
Object(Matching, "fa/driver/sd_drv.c"),
Object(Matching, "fa/driver/pfd_cmn.c"),
Object(Matching, "fa/driver/msc_drv.c"),

View File

@@ -1,7 +1,7 @@
# Assembly inventory
4.3U, 2026-10-05. 173 functions contain 175 assembly
bodies/blocks: 162 ORIGINAL functions and 10 PLACEHOLDER functions.
4.3U, 2026-10-08. 166 functions contain 168 assembly
bodies/blocks: 162 ORIGINAL functions and 4 PLACEHOLDER functions.
Run `python3 tools/check_asm_inventory.py`. Completion requires exit 0, complete
coverage and zero placeholders. The checker also rejects stale/duplicate rows,
@@ -88,9 +88,7 @@ found. Historical logs absent from this branch have commit IDs and excerpts in
| `libs/RVL_SDK/src/base/PPCArch.c` | `PPCSetFpIEEEMode` | ORIGINAL | Special-register or synchronization operation: `mtfsb0 FPSCR_NI_BIT`. |
| `libs/RVL_SDK/src/base/PPCArch.c` | `PPCSetFpNonIEEEMode` | ORIGINAL | Special-register or synchronization operation: `mtfsb1 FPSCR_NI_BIT`. |
| `libs/RVL_SDK/src/base/PPCArch.c` | `PPCMthid4` | ORIGINAL | Both branches write HID4 with mtspr; the fallback preserves the Broadway H4A bit. |
| `libs/RVL_SDK/src/cntcache/cntcache.c` | `CNTCACHEClear` | PLACEHOLDER | NAND/token logic; best C 93.364235%, 147/151 instructions, four missing pool literals, [rx30][rx30]. |
| `libs/RVL_SDK/src/cntcache/cntcache.c` | `_CNTCACHEIsTitleRemovable` | PLACEHOLDER | NAND/TMD checks; best diagnostic C 93.70731%, 82/82 instructions, status-register interference, [rx18][rx18]. |
| `libs/RVL_SDK/src/cntcache/cntcache.c` | `_CNTCACHEDeleteContent` | PLACEHOLDER | Token parsing and ES deletion; best C 95.793106%, 143/145 instructions, missing reload/copy, [rx18][rx18]. |
| `libs/RVL_SDK/src/cntcache/cntcache.c` | `CNTCACHEClear` | PLACEHOLDER | NAND/token logic; best C 47/151 differing, 149/151 instructions; pool solved with stripped writer literals, two post-delete compares missing, [rx30][rx30], [opus-cntc](../tools/decomp-assist/opus-cntc.attempts.md). |
| `libs/RVL_SDK/src/db/db.c` | `__DBExceptionDestination` | ORIGINAL | mfmsr/mtmsr enable address translation before the exception-handler tail branch. |
| `libs/RVL_SDK/src/gx/GXLight.c` | `PushLight` | ORIGINAL | psq_l/psq_st transfers paired-single values for the GX command stream. |
| `libs/RVL_SDK/src/gx/GXTransform.c` | `WriteProjPS` | ORIGINAL | psq_l/psq_st transfers paired-single values for the GX command stream. |
@@ -162,7 +160,6 @@ found. Historical logs absent from this branch have commit IDs and excerpts in
| `libs/RVL_SDK/src/os/__ppc_eabi_init.cpp` | `__init_hardware` | ORIGINAL | Before normal C startup, mfmsr/mtmsr enables the FPU and r31 holds LR across init calls. |
| `libs/RVL_SDK/src/os/__ppc_eabi_init.cpp` | `__flush_cache` | ORIGINAL | dcbst/sync/icbi/isync make freshly initialized code visible to instruction fetch. |
| `libs/RVL_SDK/src/os/__ppc_eabi_init.cpp` | `__init_user` | ORIGINAL | fralloc/bl __init_cpp/frfree/blr matches the public [SDK startup assembly][sdk-init]. |
| `libs/RevoEX/src/nwc24/NWC24UserId.c` | `getUnScrambleId` | PLACEHOLDER | Integer byte permutation; best C 76.27329%, 161/161 instructions, 97 register/scheduling differences, [rx30][rx30]. |
| `libs/Runtime/src/Gecko_setjmp.c` | `__setjmp` | ORIGINAL | Saves or restores caller GPRs/FPRs, LR, CR, and stack state across nonlocal returns. |
| `libs/Runtime/src/Gecko_setjmp.c` | `longjmp` | ORIGINAL | Saves or restores caller GPRs/FPRs, LR, CR, and stack state across nonlocal returns. |
| `libs/Runtime/src/__init_cpp_exceptions.cpp` | `__exception_info_constants` | ORIGINAL | Reads the caller ABI TOC register r2 directly for exception registration. |
@@ -189,10 +186,7 @@ found. Historical logs absent from this branch have commit IDs and excerpts in
| `src/BS2/BS2Start.c` | `__start` | ORIGINAL | Runs before the C stack and ABI registers exist; constructs the initial stack. |
| `src/BS2/BS2Start.c` | `__init_registers` | ORIGINAL | Initializes GPRs, r1, r2, and r13 for the C runtime. |
| `src/scene/nakamuraTest/gamespy/common/gsPlatformUtil.c` | `GetTicks` | ORIGINAL | Inactive PS2 branch reads the CP0 Count register with mfc0 $9. |
| `src/system/iplChannelManager.cpp` | `getTitleName__Q33ipl7channel7ManagerCFiii` | PLACEHOLDER | Channel-name copying; best C 99.57746%, 71/71 instructions, four address-order differences, [rx17][rx17]. |
| `src/system/iplSaveDataManager.cpp` | `Manager::hasChannel` | PLACEHOLDER | Title-slot search; best C 98.87324%, 71/71 instructions, 14 mask/base register differences, [rx30][rx30]. |
| `src/system/iplSaveDataManager.cpp` | `Manager::makePriorTitleIDList` | PLACEHOLDER | Title filtering; best recorded C 80.22556%, 124/133 instructions, address CSE, [da1](../tools/decomp-assist/da1.attempts.md); newer [rx17][rx17] 79.827065%. |
| `src/system/iplSaveDataManager.cpp` | `Manager::doUpdateChanInfos` | PLACEHOLDER | Channel metadata updates; best C 93.35821%, 68/67 instructions, extra memset base, [rx17][rx17]. |
| `src/system/iplSaveDataManager.cpp` | `Manager::hasChannel` | PLACEHOLDER | Title-slot search; best C 71/71 instructions, 12 mask/base register differences, [sol-ph1](../tools/decomp-assist/sol-ph1.attempts.md). |
| `src/system/iplSystem.cpp` | `System::warning_run` | PLACEHOLDER | Scene/render calls; best C 98.66477%, 176/176 instructions, 47 saved-register differences, [rx17][rx17]. |
| `src/system/rvl_dec.c` | `Rvl_decode` | ORIGINAL | Direct beq decoder entries preserve r3/r4 and LR; lis/ori builds the format signatures. |
| `src/system/rvl_dec.c` | `Rvl_decode_szs` | ORIGINAL | Original SZS decoder convention: nofralloc, r0 retains output length, fixed r3..r10/CTR byte-copy pipeline. |
@@ -200,7 +194,6 @@ found. Historical logs absent from this branch have commit IDs and excerpts in
| `src/system/rvl_dec.c` | `Rvl_decode_asr` | ORIGINAL | nofralloc hand-built 0x40 frame saves r21..31 with stmw; work address uses lis @h/ori @l. |
[rx17]: ../tools/decomp-assist/rx36.attempts.md#rx17
[rx18]: ../tools/decomp-assist/rx36.attempts.md#rx18
[rx24]: ../tools/decomp-assist/rx36.attempts.md#rx24
[rx30]: ../tools/decomp-assist/rx36.attempts.md#rx30
[rx36-osinit]: ../tools/decomp-assist/rx36.attempts.md#osinit

View File

@@ -105,7 +105,7 @@ namespace ipl {
#ifdef IPL_CHANNEL_TITLE_NOVTABLE
template <typename T>
class __declspec(novtable) HermiteIntp : public utility::FrameController {
class HermiteIntp : public utility::FrameController {
public:
HermiteIntp() {}
virtual ~HermiteIntp();
@@ -296,45 +296,6 @@ namespace ipl {
};
#endif
#ifdef IPL_SD_CHANNEL_SELECT_CPP
} // namespace math
} // namespace ipl
#include "math/iplMathTypes.h"
namespace ipl {
namespace math {
template <>
class HermiteIntp<VEC3> : public utility::FrameController {
public:
HermiteIntp() {}
virtual ~HermiteIntp();
void init(const VEC3& start, const VEC3& end, f32 maxFrame, f32 startTangent, f32 endTangent, int playback = ANIM_TYPE_FORWARD, f32 speed = 1.0f);
VEC3 get() const {
f32 frame = mFrame;
f32 inverseDuration = 1.0f / mMaxFrame;
VEC3 result =
(mStart * (1.0f + (inverseDuration * (inverseDuration *
(inverseDuration * (frame * (2.0f * frame * frame)))) -
inverseDuration * (inverseDuration * (3.0f * frame * frame))))) -
(mEnd * (inverseDuration * (inverseDuration *
(inverseDuration * (frame * (2.0f * frame * frame)))) -
inverseDuration * (inverseDuration * (3.0f * frame * frame))));
f32 frameSquared = frame * frame;
f32 cubic = inverseDuration * (inverseDuration * (frame * frameSquared));
f32 tangent = mStartTangent * (frame + (cubic -
inverseDuration * (2.0f * frame * frame))) +
mEndTangent * (cubic - inverseDuration * frameSquared);
result.x += tangent;
result.y += tangent;
result.z += tangent;
return result;
}
protected:
VEC3 mStart;
VEC3 mEnd;
f32 mStartTangent;
f32 mEndTangent;
};
#endif
} // namespace math
} // namespace ipl

View File

@@ -35,11 +35,7 @@ namespace ipl {
MemoryBase* mpBase; // 0x0C
};
#ifdef IPL_CHANNEL_TITLE_NOVTABLE
class __declspec(novtable) MemoryBase {
#else
class MemoryBase {
#endif
public:
class Anm {
public:

View File

@@ -177,7 +177,7 @@ namespace ipl {
const controller::Interface* controller);
BOOL onEventDerived(const char* paneName, u32 event,
controller::Interface* controller);
bool collectTitlesByUsage(const s32* firstUsage, const s32* secondUsage,
bool collectTitlesByUsage(s32* firstUsage, s32* secondUsage,
ESTitleId* titleIds, char* titleNames,
u32* titleCount);
@@ -221,7 +221,7 @@ namespace ipl {
int getCenterChannelIndex(const char* paneName) const;
nw4r::lyt::Pane* getCenterChannelPane(int index) const;
nw4r::lyt::Pane* getChannelPane(int index) const;
static math::VEC3 getChannelPanePosition(SDChannelSelect* scene, int index);
static nw4r::math::VEC3 getChannelPanePosition(SDChannelSelect* scene, int index);
void calcPageAnimations();
void processNormalInput();
void updateArrowVisibility();
@@ -232,16 +232,16 @@ namespace ipl {
void setChannelScissor(const SDChannelObj* channel) const;
bool isCurrentTitleUsageEnough(const s32* usage) const;
void getCurrentTitleUsage(s32* bytes, s32* blocks) const;
bool collectTitlesByChannelOrder(const s32* firstUsage, const s32* secondUsage,
bool collectTitlesByChannelOrder(s32* firstUsage, s32* secondUsage,
ESTitleId* titleIds, char* titleNames,
u32* titleCount);
bool collectTitlesFromNandUsage(const s32* firstUsage, const s32* secondUsage,
bool collectTitlesFromNandUsage(s32* firstUsage, s32* secondUsage,
ESTitleId* titleIds, char* titleNames,
u32* titleCount);
bool collectTitlesBySpecialChannels(const s32* firstUsage, const s32* secondUsage,
bool collectTitlesBySpecialChannels(s32* firstUsage, s32* secondUsage,
ESTitleId* titleIds, char* titleNames,
u32* titleCount);
bool collectTitlesForMode(const s32* firstUsage, const s32* secondUsage,
bool collectTitlesForMode(s32* firstUsage, s32* secondUsage,
ESTitleId* titleIds, char* titleNames,
u32* titleCount, int searchMode);
bool findAdjacentChannel(int direction, int* page, int* index) const;

View File

@@ -20,6 +20,19 @@ typedef struct AOSSInitInput {
u8 result[0x154];
} AOSSInitInput;
typedef struct AOSSKeyMaterial {
u8 nonce[2];
u8 address[8];
} AOSSKeyMaterial;
typedef struct AOSSPacketState {
AOSSKeyMaterial key;
u8 payload[0x5e];
} AOSSPacketState;
extern AOSSPacketState s_packetState;
extern u32 s_crcTable[0x100];
int AOSSi_Init(AOSSInitInput* input);
int AOSS_Init_old(AOSSInitInput* input);
void* AOSSi_Alloc(u32 size);

View File

@@ -277,6 +277,9 @@ namespace ipl {
/* SEntry */
bool hasLoadedBnr(int page, int index) const { return mChannels[page][index].loadedBnr; }
int getSceneID(int page, int index) const { return mChannels[page][index].loadedBnr ? mChannels[page][index].info.sceneID : 0; }
ESTitleId getEntryTitleID(int page, int index) const {
return mChannels[page][index].loadedBnr ? ES_TITLE_ID(mChannels[page][index].info.titleType, mChannels[page][index].info.titleCode) : 0;
}
/* SMetaBlockHeader */
u32 getIconRSOIdx(int page, int index) const {

View File

@@ -1,10 +1,21 @@
#include <nw4r/db/assert.h>
#include <nw4r/lyt/window.h>
#include <nw4r/lyt/common.h>
#include <nw4r/lyt/layout.h>
#include <nw4r/lyt/resources.h>
#include <nw4r/lyt/types.h>
#include <nw4r/math.h>
#include <new>
extern "C" const u8 scLytFatalColorR;
extern "C" const u8 scLytFatalColorG;
extern "C" const u8 scLytFatalColorB;
extern "C" const u8 scLytFatalColorA;
extern "C" char scLytFatalMsg[] = "Error#004\nAn error has occurred.\nThe system files are corrupted.";
extern "C" char scLytFatalMsg[];
#undef NW4R_ASSERT
#define NW4R_GLOBAL_ASSERT(x) \
@@ -26,18 +37,6 @@ extern "C" char scLytFatalMsg[] = "Error#004\nAn error has occurred.\nThe system
} \
}
#include <nw4r/lyt/window.h>
#include <nw4r/lyt/common.h>
#include <nw4r/lyt/layout.h>
#include <nw4r/lyt/resources.h>
#include <nw4r/lyt/types.h>
#include <nw4r/math.h>
#include <new>
namespace nw4r {
namespace lyt {
NW4R_UT_GET_DERIVED_RUNTIME_TYPEINFO(Window, Pane);
@@ -174,8 +173,22 @@ namespace {
flipInfo.coords[VERTEXCOLOR_RB][iy] +
polSize.height / ((flipInfo.coords[VERTEXCOLOR_RT][iy] - flipInfo.coords[VERTEXCOLOR_RB][iy]) * tSz[iy]);
}
inline void SetFrameTexOrigin(math::VEC2* texCds, int corner, int ix, int iy, u8 originX, u8 originY) {
texCds[corner][ix] = texCds[corner ^ 2][ix] = originX;
texCds[corner][iy] = texCds[corner ^ 1][iy] = originY;
}
inline void SetFrameTexExtent(math::VEC2* texCds, const Size& polSize, const Size& texSize, const TextureFlipInfo& flipInfo, int corner, int ix,
int iy, u8 originX, u8 originY) {
const math::VEC2 tSz(texSize.width, texSize.height);
texCds[corner ^ 3][ix] = texCds[corner ^ 1][ix] = originX + polSize.width / ((flipInfo.coords[corner ^ 1][ix] - originX) * tSz[ix]);
texCds[corner ^ 3][iy] = texCds[corner ^ 2][iy] = originY + polSize.height / ((flipInfo.coords[corner ^ 2][iy] - originY) * tSz[iy]);
}
} // namespace
extern "C" char scLytFatalMsg[] = "Error#004\nAn error has occurred.\nThe system files are corrupted.";
namespace nw4r {
namespace lyt {
Window::Window(const res::Window* pBlock, const ResBlockSet& resBlockSet) : Pane(pBlock) {
@@ -388,7 +401,17 @@ namespace nw4r {
detail::DrawQuad(polPt, polSize, GX_TEXMAP1, texCds, bUseVtxCol ? vtxColors : NULL, alpha); \
}
DRAW_QUAD_FOR_FRAME_1(LT, TEXTUREFLIP_NONE);
GetLTFrameSize(&polPt, &polSize, basePt, mSize, frameSize);
{
TextureFlipInfo& flipInfo = GetTexutreFlipInfo(TEXTUREFLIP_NONE);
int iy = flipInfo.idx[FLIPINDEX_Y];
int ix = flipInfo.idx[FLIPINDEX_X];
const u8 originX = flipInfo.coords[VERTEXCOLOR_LT][ix];
const u8 originY = flipInfo.coords[VERTEXCOLOR_LT][iy];
SetFrameTexOrigin(*texCds, VERTEXCOLOR_LT, ix, iy, originX, originY);
SetFrameTexExtent(*texCds, polSize, texSize, flipInfo, VERTEXCOLOR_LT, ix, iy, originX, originY);
}
detail::DrawQuad(polPt, polSize, GX_TEXMAP1, texCds, bUseVtxCol ? vtxColors : NULL, alpha);
DRAW_QUAD_FOR_FRAME_1(RT, TEXTUREFLIP_H);
DRAW_QUAD_FOR_FRAME_1(RB, TEXTUREFLIP_180);
DRAW_QUAD_FOR_FRAME_1(LB, TEXTUREFLIP_V);

View File

@@ -31,8 +31,6 @@ char scCntCacheSpaceNl[3] = {0x20, 0x0a, 0x00};
extern void _savegpr_23();
extern void _restgpr_23();
extern void _savegpr_26();
extern void _restgpr_26();
OSMutex _CNTCACHEMutex;
long long _CNTCACHEUnused816997A8;
@@ -263,254 +261,102 @@ void _CNTCACHEDeleteTitle() {
}
}
asm int _CNTCACHEIsTitleRemovable(ESTitleId titleId) {
clrlwi r11, r1, 0x1b
mr r12, r1
subfic r11, r11, -0x2100
stwux r1, r1, r11
mflr r0
lis r5, scCntCacheTitleDataFmt@ha
stw r0, 4(r12)
li r0, 1
addi r5, r5, scCntCacheTitleDataFmt@l
stw r31, -4(r12)
stw r30, -8(r12)
mr r30, r3
addi r3, r1, 0x40
stw r29, -0xc(r12)
mr r29, r4
li r4, -1
stw r0, 0x20(r1)
and r6, r30, r4
and r7, r29, r4
li r4, 0x40
stw r0, 0x24(r1)
crclr 4*cr1+eq
bl snprintf
addi r3, r1, 0x40
addi r4, r1, 0x20
addi r5, r1, 0x24
bl NANDSecretGetUsage
cmpwi r3, -0xc
mr r4, r3
bne L_418
li r4, 2
b L_444
L_418:
cmpwi r3, 0
blt L_444
lwz r0, 0x24(r1)
cmplwi r0, 1
bne L_440
lwz r0, 0x20(r1)
cmpwi r0, 0
bne L_440
li r4, 1
b L_444
L_440:
li r4, 0
L_444:
cmpwi r4, 1
bne L_4bc
mr r4, r29
mr r3, r30
addi r31, r1, 0x80
addi r6, r1, 0x28
li r5, 0
bl ES_GetTmdView
cmpwi r3, 0
beq L_470
b L_4c0
L_470:
lwz r0, 0x28(r1)
cmplwi r0, 0x2060
ble L_484
li r3, -0x400
b L_4c0
L_484:
mr r4, r29
mr r3, r30
mr r5, r31
addi r6, r1, 0x28
bl ES_GetTmdView
cmpwi r3, 0
beq L_4a4
b L_4c0
L_4a4:
lhz r0, 0xd8(r1)
rlwinm. r0, r0, 0x18, 0x18, 0x1f
bne L_4b8
li r4, 1
b L_4bc
L_4b8:
li r4, 0
L_4bc:
mr r3, r4
L_4c0:
lwz r10, 0(r1)
lwz r0, 4(r10)
lwz r31, -4(r10)
lwz r30, -8(r10)
lwz r29, -0xc(r10)
mtlr r0
mr r1, r10
blr
static s32 GetSaveDataUsage(ESTitleId titleId) {
s32 ret = -1;
char nandPath[64] ALIGN32;
u32 usedBlocks = 1;
u32 usedINodes = 1;
snprintf(nandPath, (int)sizeof(nandPath), scCntCacheTitleDataFmt, NANDTitleIdHi(titleId), NANDTitleIdLo(titleId));
ret = NANDSecretGetUsage(nandPath, &usedBlocks, &usedINodes);
if (ret == NAND_RESULT_NOEXISTS) {
ret = 2;
} else if (ret >= NAND_RESULT_OK) {
if (usedINodes == 1 && usedBlocks == 0) {
ret = 1;
} else {
ret = 0;
}
}
return ret;
}
asm void _CNTCACHEDeleteContent() {
clrlwi r11, r1, 0x1b
mr r12, r1
subfic r11, r11, -0x2100
stwux r1, r1, r11
mflr r0
mr r11, r12
stw r0, 4(r12)
bl _savegpr_26
li r3, 0
la r4, scCntCacheSpaceNl
bl strtok
li r31, 0
li r4, 0
stw r31, errno(r0)
li r5, 0x10
bl strtoull
lwz r0, errno(r0)
mr r29, r4
mr r30, r3
cmpwi r0, 0
bne L_708
li r0, -1
and r5, r3, r0
addis r0, r5, -1
cmplwi r0, 5
bne L_708
addi r28, r1, 0x80
addi r6, r1, 0x28
li r5, 0
bl ES_GetTmdView
cmpwi r3, -0x6a
beq L_708
cmpwi r3, 0
bne L_708
mr r4, r29
mr r3, r30
mr r5, r28
addi r6, r1, 0x28
bl ES_GetTmdView
cmpwi r3, 0
bne L_708
lwz r3, 0x94(r1)
rlwinm. r0, r3, 0, 0x1c, 0x1c
beq L_6f0
rlwinm. r0, r3, 0, 0x1b, 0x1b
beq L_6f0
li r3, 0
la r4, scCntCacheSpaceNl
bl strtok
li r26, 1
lis r27, scCntCacheTitleDataFmt@ha
b L_6e8
L_5b0:
stw r31, errno(r0)
li r4, 0
li r5, 0xa
bl strtoul
lwz r0, errno(r0)
cmpwi r0, 0
bne L_6dc
cmplwi r3, 0x1fe
bgt L_6dc
lhz r0, 0xda(r1)
li r4, 0
mtctr r0
cmplwi r0, 0
ble L_6dc
L_5e8:
add r5, r28, r4
lhz r0, 0x60(r5)
cmplw r3, r0
bne L_6d4
lhz r0, 0x62(r5)
rlwinm. r0, r0, 0, 0x10, 0x10
bne L_6dc
lwz r5, 0x5c(r5)
mr r4, r29
mr r3, r30
bl ES_DeleteContent
cmpwi r3, 0
bne L_6dc
mr r4, r29
mr r3, r30
addi r6, r1, 0x2c
li r5, 0
bl ES_ListTitleContentsOnCard
cmpwi r3, 0
bne L_6dc
lwz r0, 0x2c(r1)
cmpwi r0, 0
bne L_6dc
li r0, -1
stw r26, 0x20(r1)
addi r3, r1, 0x40
addi r5, r27, scCntCacheTitleDataFmt@l
stw r26, 0x24(r1)
and r6, r30, r0
and r7, r29, r0
li r4, 0x40
crclr 4*cr1+eq
bl snprintf
addi r3, r1, 0x40
addi r4, r1, 0x20
addi r5, r1, 0x24
bl NANDSecretGetUsage
cmpwi r3, -0xc
mr r0, r3
bne L_690
li r0, 2
b L_6bc
L_690:
cmpwi r3, 0
blt L_6bc
lwz r0, 0x24(r1)
cmplwi r0, 1
bne L_6b8
lwz r0, 0x20(r1)
cmpwi r0, 0
bne L_6b8
li r0, 1
b L_6bc
L_6b8:
li r0, 0
L_6bc:
cmpwi r0, 1
bne L_6dc
mr r4, r29
mr r3, r30
bl ES_DeleteTitle
b L_6dc
L_6d4:
addi r4, r4, 0x10
bdnz L_5e8
L_6dc:
li r3, 0
la r4, scCntCacheSpaceNl
bl strtok
L_6e8:
cmpwi r3, 0
bne L_5b0
L_6f0:
lwz r5, 0x28(r1)
addi r3, r1, 0x80
li r4, 0
addi r0, r5, 0x1f
rlwinm r5, r0, 0, 0, 0x1a
bl memset
L_708:
lwz r10, 0(r1)
mr r11, r10
bl _restgpr_26
lwz r0, 4(r10)
mtlr r0
mr r1, r10
blr
BOOL _CNTCACHEIsTitleRemovable(ESTitleId titleId) {
u8 tmdBuf[OSRoundUp32B(sizeof(ESTmdView))] ALIGN32;
u32 tmdSize;
ESTmdView* tmd;
s32 ret;
ret = GetSaveDataUsage(titleId);
if (ret == 1) {
tmd = (ESTmdView*)tmdBuf;
ret = ES_GetTmdView(titleId, NULL, &tmdSize);
if (ret != ES_ERR_OK) {
return ret;
}
if (tmdSize > sizeof(tmdBuf)) {
return ES_ERR_MEMORY_ERROR;
}
ret = ES_GetTmdView(titleId, tmd, &tmdSize);
if (ret != ES_ERR_OK) {
return ret;
}
if (((tmd->head.titleVersion >> 8) & 0xFF) == 0) {
ret = 1;
} else {
ret = 0;
}
}
return ret;
}
void _CNTCACHEDeleteContent() {
u8 buf[OSRoundUp32B(sizeof(ESTmdView))] ALIGN32;
u32 numOnCard;
u32 size;
ESTitleId titleId;
ESTmdView* tmd;
ESError result;
char* token;
token = strtok(NULL, scCntCacheSpaceNl);
errno = 0;
titleId = strtoull(token, NULL, 16);
if (errno == 0 && NANDTitleIdHi(titleId) == 0x00010005) {
tmd = (ESTmdView*)buf;
result = ES_GetTmdView(titleId, NULL, &size);
if (result == ES_ERR_DONT_EXISTS) {
return;
}
if (result == ES_ERR_OK && ES_GetTmdView(titleId, tmd, &size) == ES_ERR_OK) {
if ((tmd->head.titleType & 8) && (tmd->head.titleType & 0x10)) {
token = strtok(NULL, scCntCacheSpaceNl);
while (token) {
u32 index;
u32 i;
errno = 0;
index = strtoul(token, NULL, 10);
if (errno == 0 && index <= 510) {
for (i = 0; i < tmd->head.numContents; i++) {
if (index == tmd->contents[i].index) {
if (!(tmd->contents[i].type & 0x8000) &&
ES_DeleteContent(titleId, tmd->contents[i].cid) == ES_ERR_OK &&
ES_ListTitleContentsOnCard(titleId, NULL, &numOnCard) == ES_ERR_OK &&
numOnCard == 0 && GetSaveDataUsage(titleId) == 1) {
ES_DeleteTitle(titleId);
}
break;
}
}
}
token = strtok(NULL, scCntCacheSpaceNl);
}
}
memset(buf, 0, OSRoundUp32B(size));
}
}
}

View File

@@ -29,13 +29,13 @@ typedef struct PFD_SDDRV_FORMAT_DATA {
u32 total_sectors;
} PFD_SDDRV_FORMAT_DATA;
PFD_SDDRV_INFO g_pfd_sddrv_info;
PFD_SDDEV_STORAGE g_pfd_sddev;
volatile PFD_SDDRV_INFO g_pfd_sddrv_info;
PFD_SDDEV_STORAGE g_pfd_sddev ATTRIBUTE_ALIGN(32);
u8 g_pfd_sddrv_buf[0x200];
static FAInsertCallback g_attach_func = 0;
static FAEjectCallback g_detach_func = 0;
u32 g_event;
u32 g_event ATTRIBUTE_ALIGN(32);
extern u8 pfd_get_media_drv_char(FADisk*, s8*, u32);
extern void pdm_disk_notify_media_insert(FADisk*);
@@ -243,39 +243,23 @@ static inline void clear_mount_flag(void) {
g_pfd_sddrv_info.flags &= ~2;
}
static inline u32 pfd_sddrv_flags(const PFD_SDDRV_INFO* info) {
return info->flags;
}
static inline SDDev* pfd_sddrv_device(const PFD_SDDRV_INFO* info) {
return info->device;
}
static inline FADisk* pfd_sddrv_disk(const PFD_SDDRV_INFO* info) {
return info->disk;
}
static inline s8 pfd_sddrv_drive(const PFD_SDDRV_INFO* info) {
return info->drive;
}
s32 pfd_st_inter_callback(s32 status, void* data) {
s32 result;
if ((status & 1) != 1) {
return 0;
}
if (pfd_sddrv_device(&g_pfd_sddrv_info) != 0) {
if (g_pfd_sddrv_info.device != 0) {
g_event = 2;
result = ISD_RegisterDeviceIntrHandler(g_pfd_sddrv_info.device, (SDDevIntrCallback)pfd_st_removal_callback, &g_event);
if (result != 0) {
OSReport("ERR:Failed to regist intr handler. pfd_st_inter_callback()\n");
}
}
if (pfd_sddrv_disk(&g_pfd_sddrv_info) != 0) {
if (g_pfd_sddrv_info.disk != 0) {
update_media_drive();
pdm_disk_notify_media_insert(g_pfd_sddrv_info.disk);
if (pfd_sddrv_drive(&g_pfd_sddrv_info) != 0 && g_attach_func != 0) {
if (g_pfd_sddrv_info.drive != 0 && g_attach_func != 0) {
g_attach_func(g_pfd_sddrv_info.drive);
}
}
@@ -291,36 +275,39 @@ s32 pfd_st_removal_callback(s32 status, void* data) {
return 0;
}
g_pfd_sddrv_info.media_inserted = 0;
if (g_pfd_sddrv_info.media_inserted == 0 && pfd_sddrv_device(&g_pfd_sddrv_info) != 0) {
if (g_pfd_sddrv_info.device != 0) {
g_event = 1;
result = ISD_RegisterDeviceIntrHandler(g_pfd_sddrv_info.device, (SDDevIntrCallback)pfd_st_inter_callback, &g_event);
if (result != 0) {
OSReport("ERR:Failed to regist intr handler. pfd_st_removal_callback()\n");
}
}
if (pfd_sddrv_disk(&g_pfd_sddrv_info) != 0) {
if (g_pfd_sddrv_info.disk != 0) {
update_media_drive();
pdm_disk_notify_media_eject(g_pfd_sddrv_info.disk);
if (pfd_sddrv_drive(&g_pfd_sddrv_info) != 0 && g_detach_func != 0) {
if (g_pfd_sddrv_info.drive != 0 && g_detach_func != 0) {
g_detach_func(g_pfd_sddrv_info.drive);
}
}
return 0;
}
#pragma push
#pragma ppc_iro_level 0
s32 pfd_sddrv_init(FADisk* disk) {
s32 sd_result;
SDDev* device;
u32 status;
if (disk == 0) {
if (disk == NULL) {
return -30;
}
if ((pfd_sddrv_flags(&g_pfd_sddrv_info) & 1) != 0) {
if ((g_pfd_sddrv_info.flags & 1) != 0) {
OSReport("INFO SD Card driver is already initialize. pfd_sddrv_init()\n");
if (disk != g_pfd_sddrv_info.disk) {
return -44;
}
return 0;
} else {
if ((g_pfd_sddrv_info.flags & 4) == 0) {
g_pfd_sddrv_info.bytes_per_sector = 0x200;
@@ -372,6 +359,7 @@ s32 pfd_sddrv_init(FADisk* disk) {
}
return 0;
}
#pragma pop
s32 pfd_sddrv_mount(FADisk* disk) {
s32 result;
@@ -473,7 +461,7 @@ s32 pfd_sddrv_unmount(FADisk* disk) {
if (disk == 0) {
return -30;
}
if ((pfd_sddrv_flags(&g_pfd_sddrv_info) & 2) != 0) {
if ((g_pfd_sddrv_info.flags & 2) != 0) {
clear_mount_flag();
}
return 0;
@@ -485,7 +473,7 @@ s32 pfd_sddrv_finalize(FADisk* disk) {
if (disk == 0) {
return -30;
}
if ((pfd_sddrv_flags(&g_pfd_sddrv_info) & 2) != 0) {
if ((g_pfd_sddrv_info.flags & 2) != 0) {
clear_mount_flag();
}
if ((g_pfd_sddrv_info.flags & 1) != 0) {
@@ -1371,22 +1359,24 @@ s32 pfd_sddrv_store_fat32_bpb_buf(PFD_SDDRV_FORMAT_DATA* format_data, u8* sector
static s32 pfd_sddrv_store_fat32_reserved_buf(u8* sector_buffer) {
PFD_SDDRV_RESERVED_BOOT_SECTOR* reserved_boot_sector;
s32 result = -30;
if (sector_buffer != 0) {
pf_memset(sector_buffer, 0, 0x200);
reserved_boot_sector = (PFD_SDDRV_RESERVED_BOOT_SECTOR*)sector_buffer;
if (((u32)reserved_boot_sector->signature.bytes & 1) != 0) {
reserved_boot_sector->signature.bytes[0] = 0x55;
reserved_boot_sector->signature.bytes[1] = 0xaa;
} else {
reserved_boot_sector->signature.value = 0x55aa;
}
result = 0;
pf_memset(sector_buffer, 0, 0x200);
reserved_boot_sector = (PFD_SDDRV_RESERVED_BOOT_SECTOR*)sector_buffer;
if (((u32)reserved_boot_sector->signature.bytes & 1) != 0) {
reserved_boot_sector->signature.bytes[0] = 0x55;
reserved_boot_sector->signature.bytes[1] = 0xaa;
} else {
reserved_boot_sector->signature.value = 0x55aa;
}
return result;
return 0;
}
static inline s32 pfd_sddrv_write_sector(u32 sector) {
return ISD_WriteBlock(g_pfd_sddrv_info.device, sector, g_pfd_sddrv_buf, 1);
}
#pragma push
#pragma ppc_iro_level 0
s32 pfd_sddrv_build_fat32_mbr_bpb(u32 total_sectors) {
PFD_SDDRV_FORMAT_DATA format_data;
s32 result;
@@ -1408,12 +1398,12 @@ s32 pfd_sddrv_build_fat32_mbr_bpb(u32 total_sectors) {
if (g_pfd_sddrv_info.media_ejected != 0) {
return -33;
}
result = ISD_WriteBlock(g_pfd_sddrv_info.device, format_data.partition_start_sector, g_pfd_sddrv_buf, 1);
result = pfd_sddrv_write_sector(format_data.partition_start_sector);
if (result != 0) {
OSReport("ERR Failed to write BPB fields. ISD_WriteBlock()\n");
return -36;
}
result = ISD_WriteBlock(g_pfd_sddrv_info.device, format_data.partition_start_sector + 6, g_pfd_sddrv_buf, 1);
result = pfd_sddrv_write_sector(format_data.partition_start_sector + 6);
if (result != 0) {
OSReport("ERR Failed to write BPB fields. ISD_WriteBlock()\n");
return -36;
@@ -1429,12 +1419,12 @@ s32 pfd_sddrv_build_fat32_mbr_bpb(u32 total_sectors) {
if (g_pfd_sddrv_info.media_ejected != 0) {
return -33;
}
result = ISD_WriteBlock(g_pfd_sddrv_info.device, format_data.partition_start_sector + 1, g_pfd_sddrv_buf, 1);
result = pfd_sddrv_write_sector(format_data.partition_start_sector + 1);
if (result != 0) {
OSReport("ERR Failed to write BPB fields. ISD_WriteBlock()\n");
return -36;
}
result = ISD_WriteBlock(g_pfd_sddrv_info.device, format_data.partition_start_sector + 7, g_pfd_sddrv_buf, 1);
result = pfd_sddrv_write_sector(format_data.partition_start_sector + 7);
if (result != 0) {
OSReport("ERR Failed to write BPB fields. ISD_WriteBlock()\n");
return -36;
@@ -1451,12 +1441,12 @@ s32 pfd_sddrv_build_fat32_mbr_bpb(u32 total_sectors) {
if (g_pfd_sddrv_info.media_ejected != 0) {
return -33;
}
result = ISD_WriteBlock(g_pfd_sddrv_info.device, format_data.partition_start_sector + 2, g_pfd_sddrv_buf, 1);
result = pfd_sddrv_write_sector(format_data.partition_start_sector + 2);
if (result != 0) {
OSReport("ERR Failed to write BPB fields. ISD_WriteBlock()\n");
return -36;
}
result = ISD_WriteBlock(g_pfd_sddrv_info.device, format_data.partition_start_sector + 8, g_pfd_sddrv_buf, 1);
result = pfd_sddrv_write_sector(format_data.partition_start_sector + 8);
if (result != 0) {
OSReport("ERR Failed to write BPB fields. ISD_WriteBlock()\n");
return -36;
@@ -1472,13 +1462,14 @@ s32 pfd_sddrv_build_fat32_mbr_bpb(u32 total_sectors) {
if (g_pfd_sddrv_info.media_ejected != 0) {
return -33;
}
result = ISD_WriteBlock(g_pfd_sddrv_info.device, 0, g_pfd_sddrv_buf, 1);
result = pfd_sddrv_write_sector(0);
if (result != 0) {
OSReport("ERR Failed to write MBR fields. ISD_WriteBlock()\n");
return -36;
}
return 0;
}
#pragma pop
s32 pfd_sddrv_full_format(void) {
FADiskInfo geometry;

View File

@@ -3,6 +3,8 @@
void* NHTTPi_memcpy(void*, const void*, u32);
s32 NHTTPi_SocRecv(void*, NHTTPRequestInfo*, s32, void*, s32, s32);
#define NHTTPi_TOLOWER(c) ((((c) >= 'A') & ((c) <= 'Z')) ? (c) + ('a' - 'A') : (c))
static void FindHeaderBlock(const NHTTPResponseInfo* response, s32 position, NHTTPi_HDRBUFLIST** block, s32* offset) {
if(position<NHTTP_HDRRECVBUF_INILEN) { *offset=position; *block=NULL; }
else {
@@ -22,10 +24,6 @@ static int ReadHeaderChar(const NHTTPResponseInfo* response, NHTTPi_HDRBUFLIST**
return (*block)->block[(*offset)++];
}
static int LowerCase(int character) {
return ((character >= 'A') & (character <= 'Z')) ? character + ('a' - 'A') : character;
}
s32 NHTTPi_findNextLineHdrRecvBuf(const NHTTPResponseInfo* response, s32 position, s32 limit, s32* colon, s32* newlineLength) {
NHTTPi_HDRBUFLIST* block;
s32 offset;
@@ -75,16 +73,48 @@ s32 NHTTPi_skipSpaceHdrRecvBuf(const NHTTPResponseInfo* response, s32 position,
s32 NHTTPi_compareTokenN_HdrRecvBuf(const NHTTPResponseInfo* response, s32 position, s32 limit, const char* token, s8 delimiter) {
NHTTPi_HDRBUFLIST* block;
s32 offset;
int character;
s32 i;
s32 tokenChar;
s32 character;
if (position < limit) {
FindHeaderBlock(response, position, &block, &offset);
character = ReadHeaderChar(response, &block, &offset);
while (LowerCase((s8)character) == LowerCase(*token)) {
if (*token == 0 || *token == ' ' || *token == delimiter || position == limit - 1) return 0;
character = ReadHeaderChar(response, &block, &offset);
++position;
++token;
if (block == NULL) {
if (offset < NHTTP_HDRRECVBUF_INILEN) {
character = (s8)response->hdrBufFirst[offset++];
goto compare_characters;
}
block = response->hdrBufBlock_p;
offset = 0;
} else if (offset == NHTTP_HDRRECVBUF_BLOCKLEN) {
offset = 0;
block = block->next_p;
}
character = block->block[offset++];
compare_characters:
i = position;
while (NHTTPi_TOLOWER((s8)character) == NHTTPi_TOLOWER((s8)*token)) {
tokenChar = (s8)*token;
if (tokenChar == '\0' || tokenChar == ' ' || tokenChar == delimiter || i == limit - 1) return 0;
if (block == NULL) {
if (offset < NHTTP_HDRRECVBUF_INILEN) {
character = (s8)response->hdrBufFirst[offset++];
goto advance_token;
}
block = response->hdrBufBlock_p;
offset = 0;
} else if (offset == NHTTP_HDRRECVBUF_BLOCKLEN) {
offset = 0;
block = block->next_p;
}
character = block->block[offset++];
advance_token:
i++;
token++;
}
}
return -1;

View File

@@ -1,6 +1,8 @@
#include <revolution/types.h>
#include <string.h>
#define NHTTPi_TOLOWER(c) ((((c) >= 'A') & ((c) <= 'Z')) ? (c) + ('a' - 'A') : (c))
void* NHTTPi_memcpy(void* destination, const void* source, u32 size)
{
return memcpy(destination, source, size);
@@ -26,28 +28,33 @@ static int LowerCase(int character)
return ((character >= 'A') & (character <= 'Z')) ? character + 32 : character;
}
s32 NHTTPi_strnicmp(const char* left, const char* right, s32 length)
s32 NHTTPi_strnicmp(const char* left, const char* right, s32 size)
{
while (length > 0)
char leftChar;
char rightChar;
while (size > 0)
{
int a = *left++, b = *right++;
if (a == 0 || b == 0)
leftChar = *left++;
rightChar = *right++;
if (leftChar == '\0' || rightChar == '\0')
{
if (a == 0 && b == 0)
if (leftChar == '\0' && rightChar == '\0')
{
length = 0;
size = 0;
break;
}
}
b = LowerCase(b);
a = LowerCase(a);
if (a != b)
if (NHTTPi_TOLOWER(leftChar) != NHTTPi_TOLOWER(rightChar))
{
break;
}
--length;
size--;
}
return length;
return size;
}
static BOOL UrlPlain(int character)
@@ -237,18 +244,18 @@ s32 NHTTPi_intToStr(char* destination, u32 value)
return length + 1;
}
s32 NHTTPi_compareToken(const char* left, const char* right)
s32 NHTTPi_compareToken(const char* string, const char* token)
{
u32 rawLeft;
while (LowerCase((s8)(rawLeft = *(const u8*)left)) == LowerCase((s8)*(const u8*)right))
while (NHTTPi_TOLOWER(*string) == NHTTPi_TOLOWER(*token))
{
if ((s8)rawLeft == 0 || (s8)rawLeft == ' ')
if (*string == '\0' || *string == ' ')
{
return 0;
}
++left;
++right;
string++;
token++;
}
return -1;
}

View File

@@ -2,6 +2,7 @@
#include <revolution/nwc24.h>
static const u8 TtableInv[] = {13, 5, 9, 7, 0, 15, 10, 2, 12, 3, 14, 1, 8, 6, 11, 4};
static const u8 ExcTable[] = {1, 5, 0, 4, 2, 3, 6, 7};
extern void _savegpr_27(void);
extern void _restgpr_27(void);
extern void __shr2u(void);
@@ -53,166 +54,34 @@ NWC24Err NWC24iCheckUserIdCRC(NWC24UserId id) {
return NWC24_OK;
}
static asm NWC24UserId getUnScrambleId(register NWC24UserId id) {
li r9,-1
lis r7,0x20
lis r6,0x5e5e
stwu r1,-0x20(r1)
subi r7,r7,1
and r8,r4,r9
addi r0,r6,0x5e5e
stw r31,0x1c(r1)
and r3,r3,r7
lis r5,-1
xor r8,r8,r0
stw r30,0x18(r1)
and r8,r8,r9
xori r3,r3,0x5e5e
rlwinm r0,r8,0x15,0xa,0xa
li r6,-0x100
and r3,r3,r7
rlwinm r8,r8,0x1f,0,0x1f
or r3,r3,r0
stw r29,0x14(r1)
rlwimi r8,r3,0x1f,0,0
lis r4,-0xff
rlwinm r7,r3,0x1f,1,0x1f
addi r5,r5,0xff
rlwinm r30,r8,0x18,0,0x1f
rlwinm r29,r3,0x17,0x18,0x1f
and r12,r7,r9
li r0,0
rlwimi r30,r3,0x17,0,7
and r31,r8,r6
rlwimi r31,r30,0,0x18,0x1f
rlwinm r11,r3,0x1f,0x10,0x17
and r30,r31,r5
and r12,r12,r9
rlwimi r0,r29,8,0x18,0x1f
subi r4,r4,1
or r12,r12,r0
or r11,r30,r11
and r30,r11,r4
rlwinm r31,r8,0,0x18,0x1f
li r0,0
rlwinm r11,r8,0x10,8,0xf
lis r10,0x100
and r12,r12,r9
rlwimi r0,r31,0x10,0x10,0x1f
or r30,r30,r11
or r29,r12,r0
rlwinm r12,r3,0x1f,0x18,0x1f
subi r0,r10,1
li r10,0
rlwimi r10,r12,0x18,8,0x1f
and r11,r29,r9
and r12,r30,r0
rlwinm r3,r3,0x17,0,7
or r3,r12,r3
or r12,r11,r10
and r10,r3,r9
lis r3,TtableInv@ha
and r31,r10,r9
rlwinm r30,r8,0x10,0,0x1f
rlwinm r11,r31,0x1c,0x1c,0x1f
addi r3,r3,TtableInv@l
rlwimi r30,r7,0x10,0,0xf
rlwinm r10,r31,0,0x1c,0x1f
and r29,r12,r6
rlwinm r12,r8,8,0,0x1f
lbzx r11,r3,r11
rlwimi r12,r7,8,0,0x17
lbzx r7,r3,r10
rlwimi r29,r30,0,0x18,0x1f
rlwinm r8,r11,4,0,0x1b
rlwinm r10,r12,8,0x10,0x17
and r11,r29,r5
or r10,r11,r10
or r7,r8,r7
and r11,r31,r6
li r8,0
rlwimi r11,r7,0,0x18,0x1f
and r12,r10,r9
rlwinm r10,r11,0x18,0,0x1f
li r7,0
rlwimi r10,r12,0x18,0,7
and r31,r11,r5
rlwinm r11,r10,0x1c,0x1c,0x1f
and r12,r12,r9
rlwinm r10,r10,0,0x1c,0x1f
lbzx r11,r3,r11
lbzx r10,r3,r10
rlwinm r11,r11,4,0,0x1b
or r10,r11,r10
rlwinm r11,r10,0,0x18,0x1f
rlwinm r10,r10,8,0x10,0x17
rlwimi r8,r11,8,0x18,0x1f
or r10,r31,r10
or r8,r12,r8
rlwinm r12,r10,0x10,0,0x1f
and r11,r10,r4
rlwimi r12,r8,0x10,0,0xf
and r10,r8,r9
rlwinm r8,r12,0x1c,0x1c,0x1f
rlwinm r4,r12,0,0x1c,0x1f
lbzx r8,r3,r8
lbzx r4,r3,r4
rlwinm r8,r8,4,0,0x1b
or r4,r8,r4
rlwinm r8,r4,0,0x18,0x1f
rlwinm r4,r4,0x10,8,0xf
or r29,r11,r4
rlwimi r7,r8,0x10,0x10,0x1f
or r11,r10,r7
lis r4,1
rlwinm r8,r29,8,0,0x1f
and r31,r29,r0
rlwimi r8,r11,8,0,0x17
and r12,r11,r9
rlwinm r10,r8,0x1c,0x1c,0x1f
subi r0,r4,0x4c4d
lbzx r11,r3,r10
rlwinm r8,r8,0,0x1c,0x1f
lbzx r10,r3,r8
li r8,0
rlwinm r11,r11,4,0,0x1b
lis r7,-0x4c4c
or r11,r11,r10
rlwinm r10,r11,0,0x18,0x1f
subi r7,r7,0x4c4d
rlwimi r8,r10,0x18,8,0x1f
rlwinm r4,r11,0x18,0,7
or r10,r12,r8
rlwinm r8,r10,0x1c,0x1c,0x1f
or r12,r31,r4
rlwinm r4,r10,0,0x1c,0x1f
lbzx r8,r3,r8
and r11,r10,r6
lbzx r4,r3,r4
rlwinm r6,r8,4,0,0x1b
and r8,r12,r9
or r4,r6,r4
rlwimi r11,r4,0,0x18,0x1f
and r10,r8,r9
rlwinm r6,r11,0x14,0x1c,0x1f
rlwinm r4,r11,0x18,0x1c,0x1f
lbzx r6,r3,r6
lbzx r3,r3,r4
and r8,r11,r5
rlwinm r5,r6,4,0,0x1b
and r4,r10,r9
or r3,r5,r3
rlwinm r3,r3,8,0x10,0x17
or r3,r8,r3
rlwinm r5,r3,0xa,0xb,0x15
rlwinm r3,r3,0x15,0x16,0x1f
rlwimi r5,r4,0xa,0x16,0x1f
rlwimi r3,r4,0xa,0,0x15
xor r4,r3,r7
xor r3,r5,r0
lwz r31,0x1c(r1)
lwz r30,0x18(r1)
lwz r29,0x14(r1)
addi r1,r1,0x20
blr
static u8 getByte(u64 value, u8 index) {
return (value >> (index * 8)) & 0xFF;
}
static u64 setByte(u64 value, u8 index, u8 byte) {
return (value & ~(0xFFULL << ((u64)8 * index))) | ((u64)byte << ((u64)8 * index));
}
static NWC24UserId getUnScrambleId(NWC24UserId id) {
u64 copy;
u8 i;
id &= 0x001FFFFFFFFFFFFFULL;
id ^= 0x00005E5E5E5E5E5EULL;
id &= 0x001FFFFFFFFFFFFFULL;
id |= (((id & 0xFF) << 5) & 0x20) << 48;
id >>= 1;
copy = id;
for (i = 0; i < 6; ++i) {
id = setByte(id, i, getByte(copy, ExcTable[i]));
}
for (i = 0; i < 6; ++i) {
id = setByte(id, i, (TtableInv[(getByte(id, i) >> 4) & 0xF] << 4) | TtableInv[getByte(id, i) & 0xF]);
}
id = ((id & 0x7FFFFFFFFFFULL) << 10) | ((id >> 43) & 0x3FF);
id ^= 0x0000B3B3B3B3B3B3ULL;
return id;
}

View File

@@ -31,7 +31,7 @@ typedef struct AppLoaderHeader {
u8 pad_0x1C[4];
} AppLoaderHeader;
u8 TicketViewsBuf[OSRoundUp32B(sizeof(ESTicketView) * 64)] ALIGN32;
static u8 TicketViewsBuf[OSRoundUp32B(sizeof(ESTicketView) * 64)] ALIGN32;
ESTicketView *TicketViews = (ESTicketView *)TicketViewsBuf;
DVDDiskID UpdateDiskID ALIGN32;
OSBootInfo2 bi2 ALIGN32;
@@ -39,42 +39,42 @@ AppLoaderHeader AppLoaderHdr ALIGN32;
OSBootInfo3 bi3 ALIGN32;
u8 GameTOCBuf[OSRoundUp32B(sizeof(DVDGameTOC))] ALIGN32;
DVDDriveInfo DriveInfo ALIGN32;
DVDDiskID DiskID ALIGN32;
DVDPartitionParams PartitionParams ALIGN32;
static DVDDiskID DiskID ALIGN32;
static DVDPartitionParams PartitionParams ALIGN32;
NANDCommandBlock BS2NandBlock;
NANDFileInfo BS2CacheFileInfo;
DVDCommandBlock CoverBlock;
u8 PartitionInfoBuf[OSRoundUp32B(sizeof(DVDPartitionInfo) * 256)] ALIGN32;
DVDCommandBlock Block;
BS2State State = BS2_STT_BEGIN;
vu32 DvdReadPending = 0;
u32 BannerAllocation = 0;
u32 BannerBuffer = 0;
u32 BannerAvailable = 0;
u32 Allocator = 0;
BOOL StartingGame = FALSE;
u32 RestartRequested = 0;
u32 PartitionOpen = 0;
u32 CacheSeekComplete = 0;
u32 LoadingTitle = 0;
static BS2State State = BS2_STT_BEGIN;
static vu32 DvdReadPending = 0;
static u32 BannerAllocation = 0;
static u32 BannerBuffer = 0;
static u32 BannerAvailable = 0;
static u32 Allocator = 0;
volatile BOOL StartingGame = FALSE;
static u32 RestartRequested = 0;
static u32 PartitionOpen = 0;
static u32 CacheSeekComplete = 0;
static u32 LoadingTitle = 0;
BOOL FatalErrorFlag = FALSE;
BOOL RetryErrorFlag = FALSE;
BOOL UpdateErrorFlag = FALSE;
BOOL AbortFlag = FALSE;
volatile int CacheFailed = 0;
volatile int RegionValid = 0;
volatile int NandPending = 0;
vu32 CancelNand = 0;
vu32 LowReadResult = 0;
u32 CacheCommandComplete = 0;
u32 AudioBufferUnconfigured = 0;
u64 ResetTime = 0;
u64 SpinupDeadline = 0;
static volatile int NandPending = 0;
static vu32 CancelNand = 0;
static vu32 LowReadResult = 0;
static u32 CacheCommandComplete = 0;
static u32 AudioBufferUnconfigured = 0;
static u64 ResetTime = 0;
static u64 SpinupDeadline = 0;
u64 CoverPollTime = 0;
u32 DriveWasReset = 0;
u32 TitleTicketView = 0;
u32 CurrentTmd = 0;
static u32 TitleTicketView = 0;
static u32 CurrentTmd = 0;
u32 TitleCode = 0;
u32 RequiredIosHigh = 0;
u32 RequiredIosLow = 0;
@@ -95,13 +95,13 @@ u32 LoaderOffset = 0;
vu32 LoaderLength = 0;
u32 LoaderAddress = 0;
vu32 CacheLength = 0;
vu32 BannerLength = 0;
vu32 DvdTransferLength = 0;
vu32 DvdTransferred = 0;
u32 *DvdProgress = 0;
u32 LoaderClose = 0;
u32 LoaderMain = 0;
u32 LoaderInit = 0;
static vu32 BannerLength = 0;
static vu32 DvdTransferLength = 0;
static vu32 DvdTransferred = 0;
static u32 *DvdProgress = 0;
static u32 LoaderClose = 0;
static u32 LoaderMain = 0;
static u32 LoaderInit = 0;
void BS2Report(const char *msg, ...) {
@@ -243,7 +243,7 @@ BOOL BS2IsDiagDisc() { return (u8)(*(u8 *)OSPhysicalToCached(OS_ADDR_BOOT_INFO)
extern vu32 BS2VideoMode;
extern vu32 __DVDLayoutFormat;
asm void Run(u32 entryPoint, void *start, u32 blockCount, u32 argument) {
static asm void Run(u32 entryPoint, void *start, u32 blockCount, u32 argument) {
// clang-format off
#ifdef __MWERKS__
nofralloc
@@ -491,7 +491,7 @@ BOOL BS2StartLoadingTitle(ESTitleId titleId, ESTicketView *pTicketView) {
static void callback(u32 result) { LowReadResult = result; }
ESError BS2ESGetTicketViews(IOSFd *descriptor, ESTitleId titleId, ESTicketView *views, u32 *count) {
static ESError BS2ESGetTicketViews(IOSFd *descriptor, ESTitleId titleId, ESTicketView *views, u32 *count) {
u8 work[256] ALIGN32;
IOSIoVector vectors[4] ALIGN32;
ESError result;
@@ -529,7 +529,7 @@ ESError BS2ESGetTicketViews(IOSFd *descriptor, ESTitleId titleId, ESTicketView *
request[2].length = *count * sizeof(*views);
return IOS_Ioctlv(*descriptor, 0x13, 2, 1, request);
}
void BS2Reboot(void) {
static void BS2Reboot(void) {
ESTicketView ticket ALIGN32;
u8 work[256] ALIGN32;
OSStateFlags flags ALIGN32;
@@ -834,9 +834,6 @@ void BS2StartGCGame() {
static u8 gameCubeLanguages[] = {0, 0, 1, 2, 3, 4, 5};
s32 ret;
u32 rtc;
u32 counterBias;
u32 seconds;
u32 timerFrequency;
u32 soundMode;
s8 productVideoMode;
u8 progressiveMode;
@@ -878,10 +875,7 @@ void BS2StartGCGame() {
}
__OSGetRTC(&rtc);
counterBias = SCGetCounterBias();
seconds = rtc + counterBias;
timerFrequency = OS_BUS_CLOCK >> 2;
time = (OSTime)seconds * timerFrequency;
time = OS_TIMER_CLOCK * (OSTime)(rtc + SCGetCounterBias());
__OSSetTime(time);
sram = __OSLockSram();
@@ -955,7 +949,7 @@ void BS2StartGCGame() {
}
}
BOOL CheckDVDCommandStatus(DVDCommandBlock *block) {
static BOOL CheckDVDCommandStatus(DVDCommandBlock *block) {
if (State == 0x3A) {
return TRUE;
}
@@ -1018,11 +1012,11 @@ BOOL CheckDVDCommandStatus(DVDCommandBlock *block) {
return FALSE;
}
void BS2NANDDivideCallback(s32 result, NANDCommandBlock *block);
void BS2NANDDivideReadAsync(NANDFileInfo *info, void *buffer, u32 length, NANDCallback callback, NANDCommandBlock *block);
void BS2NANDDivideWriteAsync(NANDFileInfo *info, const void *buffer, u32 length, NANDCallback callback, NANDCommandBlock *block);
static void BS2NANDDivideCallback(s32 result, NANDCommandBlock *block);
static void BS2NANDDivideReadAsync(NANDFileInfo *info, void *buffer, u32 length, NANDCallback callback, NANDCommandBlock *block);
static void BS2NANDDivideWriteAsync(NANDFileInfo *info, const void *buffer, u32 length, NANDCallback callback, NANDCommandBlock *block);
void BS2NANDDivideCallback(s32 result, NANDCommandBlock *block) {
static void BS2NANDDivideCallback(s32 result, NANDCommandBlock *block) {
s32 ret;
if (CancelNand != 0) {
@@ -1063,7 +1057,7 @@ void BS2NANDDivideCallback(s32 result, NANDCommandBlock *block) {
}
}
void BS2NANDDivideReadAsync(NANDFileInfo *info, void *buffer, u32 length, NANDCallback callback, NANDCommandBlock *block) {
static void BS2NANDDivideReadAsync(NANDFileInfo *info, void *buffer, u32 length, NANDCallback callback, NANDCommandBlock *block) {
NandCompletion = callback;
NandOperation = 2;
NandLength = length;
@@ -1079,7 +1073,7 @@ void BS2NANDDivideReadAsync(NANDFileInfo *info, void *buffer, u32 length, NANDCa
}
}
void BS2NANDDivideWriteAsync(NANDFileInfo *info, const void *buffer, u32 length, NANDCallback callback, NANDCommandBlock *block) {
static void BS2NANDDivideWriteAsync(NANDFileInfo *info, const void *buffer, u32 length, NANDCallback callback, NANDCommandBlock *block) {
NandCompletion = callback;
NandOperation = 1;
NandLength = length;
@@ -1095,7 +1089,7 @@ void BS2NANDDivideWriteAsync(NANDFileInfo *info, const void *buffer, u32 length,
}
}
BOOL CheckBS2CommandStatus() {
static BOOL CheckBS2CommandStatus() {
if (CheckDVDCommandStatus(&Block) == 0) {
BS2Report("DVD command is issuing\n");
return 0;
@@ -1299,7 +1293,7 @@ BOOL CheckBS2CommandStatus() {
return TRUE;
}
void BS2InquiryAsync(void *buffer, s32 length, u32 offset) {
static void BS2InquiryAsync(void *buffer, s32 length, u32 offset) {
if (BS2BootFromCache) {
BS2Report("Unencrypted read from cache.dat\n");
NandPending = 1;
@@ -1309,7 +1303,7 @@ void BS2InquiryAsync(void *buffer, s32 length, u32 offset) {
}
}
void BS2ReadDiskID(void *buffer, s32 length, u32 offset) {
static void BS2ReadDiskID(void *buffer, s32 length, u32 offset) {
if (BS2BootFromCache) {
BS2Report("Read from cache.dat\n");
NandPending = 1;

View File

@@ -62,7 +62,6 @@ namespace textinput {
struct CandidatePaneData {
PaneToAnimation panes[26];
char tail[12];
};
extern "C" const CandidatePaneData scCandidatePaneData __attribute__((aligned(8))) = {{
@@ -196,22 +195,7 @@ namespace textinput {
6,
NULL,
{&csAninationFile[0], &csAninationFile[8], &csAninationFile[9], &csAninationFile[10], &csAninationFile[11], &csAninationFile[12]}},
}, {"P_OffBtn"}};
extern "C" char scPaneNameTable[132] =
"B_OffBtn\0\0\0\0"
"P_JPOffBtn\0\0"
"P_CNOffBtn\0\0"
"P_CNOnBtn\0\0\0"
"B_prdc_scrl_Left\0\0\0\0"
"P_prdc_scrl_Left\0\0\0\0"
"B_prdc_scrl_Rght\0\0\0\0"
"P_prdc_scrl_Rght\0\0\0\0"
"\0\0\0";
extern "C" char scW_predictWindow[16] = "W_predictWindow";
extern "C" char scN_predictInput[15] = "N_predictInput";
extern "C" char scW_OnOff_Area[13] = "W_OnOff_Area";
extern "C" char scN_prdc_Texts[13] = "N_prdc_Texts";
}};
void CandidateBoxCaller::Candidates::addCandidate(const wchar_t* wcString) {
wcsncpy(szwcPredicted[mNumCandidate], wcString, ARRAY_LENGTH(szwcPredicted[0]));
@@ -383,27 +367,20 @@ namespace textinput {
mTextArea.Init();
mOnOffButton.Create(this);
mOnOffButton.Init();
const char* paneNames = scPaneNameTable;
const char* leftScrollBoundName = paneNames + 48;
const char* leftScrollPaneName = paneNames + 68;
mLeftScroll.Create(this, leftScrollPaneName, leftScrollBoundName);
const char* rightScrollBoundName = paneNames + 88;
const char* rightScrollPaneName = paneNames + 108;
mRightScroll.Create(this, rightScrollPaneName, rightScrollBoundName);
mLeftScroll.Create(this, "P_prdc_scrl_Left", "B_prdc_scrl_Left");
mRightScroll.Create(this, "P_prdc_scrl_Rght", "B_prdc_scrl_Rght");
mLeftScroll.Init();
mRightScroll.Init();
const char* windowName = scW_predictWindow;
mTextWindow.Create(this, windowName);
mTextWindow.Create(this, "W_predictWindow");
init();
}
void LayoutByNW4R::createAnmPane_(MEMAllocator* allocator) {
CandidateTextAnmPane* pane;
u16 j;
const char* forceAddName;
u16 i;
for (i = 0; i < ARRAY_LENGTH(scCandidatePaneData.panes); i++) {
pane = NULL;
const PaneToAnimation& p = scCandidatePaneData.panes[i];
CandidateTextAnmPane* pane = NULL;
switch (p.type) {
case KT_ScrollButton: {
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(CandidateScrollAnmPane));
@@ -430,9 +407,8 @@ namespace textinput {
nw4r::ut::List_Append(&mAnmPanes, pane);
const char* forceAddName = p.forceAddName;
u32 animationCount = p.count;
for (j = 0; j < animationCount; j++) {
forceAddName = p.forceAddName;
for (u16 j = 0; j < p.count; j++) {
const AnimationFile* const& animation = p.pAnims[j];
void* pResource = mpMultiArcResourceAccessor->GetResource(0, animation->fileName);
AnimTransformPane* transform =
@@ -448,7 +424,7 @@ namespace textinput {
}
void LayoutByNW4R::init() {
searchAnmPane(scN_predictInput)->changeAnimation(ANM_Normal);
searchAnmPane("N_predictInput")->changeAnimation(ANM_Normal);
Base::setInvalid(false);
setActive(true);
setOnOff(false);
@@ -461,7 +437,7 @@ namespace textinput {
mpLayout->CalculateMtx(mDrawInfo);
if (meLanguage == KR) {
mTextWindow.SetVisible(false);
getPane(scW_OnOff_Area)->SetVisible(false);
getPane("W_OnOff_Area")->SetVisible(false);
} else if (meLanguage == CN) {
setOnOff(true);
mTextWindow.SetVisible(true);
@@ -471,16 +447,16 @@ namespace textinput {
} else {
mTextWindow.ChangeAnimation(ANM_Normal);
}
getPane(scW_OnOff_Area)->SetVisible(false);
getPane("W_OnOff_Area")->SetVisible(false);
} else {
getPane(scW_OnOff_Area)->SetVisible(true);
getPane("W_OnOff_Area")->SetVisible(true);
}
}
void LayoutByNW4R::draw() {
getPane(scN_prdc_Texts)->SetVisible(false);
getPane("N_prdc_Texts")->SetVisible(false);
nw4rmanager::Layout::draw();
getPane(scN_prdc_Texts)->SetVisible(true);
getPane("N_prdc_Texts")->SetVisible(true);
if (!isInvalid()) {
mTextArea.Draw(mDrawInfo);
}
@@ -490,8 +466,8 @@ namespace textinput {
nw4rmanager::Layout::calc();
mTextArea.Calc();
if (mbAnimOn) {
getPane(scN_prdc_Texts)->Animate(0);
getPane(scN_prdc_Texts)->CalculateMtx(mDrawInfo);
getPane("N_prdc_Texts")->Animate(0);
getPane("N_prdc_Texts")->CalculateMtx(mDrawInfo);
}
}
@@ -499,7 +475,7 @@ namespace textinput {
Base::setLanguage(language);
init();
// Maybe inlines, maybe not
nw4r::math::VEC3 pos = searchAnmPane(scW_predictWindow)->getPane()->GetTranslate();
nw4r::math::VEC3 pos = searchAnmPane("W_predictWindow")->getPane()->GetTranslate();
if (meLanguage == CN || meLanguage == KR) {
Base::checkValidation();
// Potentially an inline
@@ -514,7 +490,7 @@ namespace textinput {
pos.x = 202.0f;
}
searchAnmPane(scW_predictWindow)->getPane()->SetTranslate(pos);
searchAnmPane("W_predictWindow")->getPane()->SetTranslate(pos);
if (meLanguage == CN) {
mTextArea.ApplyFontScale(1.2f);
} else if (meLanguage == KR) {
@@ -631,7 +607,7 @@ namespace textinput {
current = reinterpret_cast<CandidateBoxCaller::Candidates*>(reinterpret_cast<u8*>(current) + sizeof(current->szwcPredicted[0]));
}
}
gui::PaneComponent* p = mpPaneManager->searchPaneComponent(isOn() ? scB_OnBtn : scPaneNameTable);
gui::PaneComponent* p = mpPaneManager->searchPaneComponent(isOn() ? scB_OnBtn : "B_OffBtn");
if (p != NULL) {
p->lockInitialize(true);
}
@@ -1009,7 +985,7 @@ namespace textinput {
mpBoundingPane[i]->setListener(this);
}
mpTextAreaPane = mgr->searchPaneComponent("N_prdcTextArea");
mpTextsPane = mgr->searchPaneComponent(scN_prdc_Texts);
mpTextsPane = mgr->searchPaneComponent("N_prdc_Texts");
mSize = mpTextBoxPane[0]->getTextPane()->GetFontSize();
mpTextAreaPane->setListener(this);
}
@@ -1494,7 +1470,7 @@ namespace textinput {
if (mgr()->isInScroll() && event != gui::EventHandler::ON_LEFT && event != gui::EventHandler::ON_POINT) {
return;
}
if (!mgr()->searchAnmPane(scW_predictWindow)->isInAnimation() || event == gui::EventHandler::ON_LEFT) {
if (!mgr()->searchAnmPane("W_predictWindow")->isInAnimation() || event == gui::EventHandler::ON_LEFT) {
if (!mgr()->isInvalid()) {
switch (event) {
case gui::EventHandler::ON_TRIG:
@@ -1645,7 +1621,7 @@ namespace textinput {
if (mgr()->isInScroll() && event != gui::EventHandler::ON_LEFT && event != gui::EventHandler::ON_POINT) {
return;
}
if (!mgr()->searchAnmPane(scW_predictWindow)->isInAnimation() || event == gui::EventHandler::ON_LEFT) {
if (!mgr()->searchAnmPane("W_predictWindow")->isInAnimation() || event == gui::EventHandler::ON_LEFT) {
if (!mgr()->isInvalid()) {
switch (event) {
case gui::EventHandler::ON_TRIG:
@@ -1691,15 +1667,15 @@ namespace textinput {
mpOnPictPane = mgr->searchPaneComponent(scP_OnBtn);
mpOnBoundPane = mgr->searchPaneComponent(scB_OnBtn);
mpOnAnmPane = static_cast<OnOffAnmPane*>(layout->searchAnmPane(scP_OnBtn));
mpOffPictPane = mgr->searchPaneComponent(scCandidatePaneData.tail);
mpOffBoundPane = mgr->searchPaneComponent(scPaneNameTable);
mpOffAnmPane = static_cast<OnOffAnmPane*>(layout->searchAnmPane(scCandidatePaneData.tail));
mpOffPictPane = mgr->searchPaneComponent("P_OffBtn");
mpOffBoundPane = mgr->searchPaneComponent("B_OffBtn");
mpOffAnmPane = static_cast<OnOffAnmPane*>(layout->searchAnmPane("P_OffBtn"));
layout->getLayout()->GetRootPane()->FindPaneByName(scCandidatePaneData.tail)->GetMaterial()->GetTexture(&mOffTexDefault, 0);
layout->getLayout()->GetRootPane()->FindPaneByName(scPaneNameTable + 12)->GetMaterial()->GetTexture(&mOffTexJP, 0);
layout->getLayout()->GetRootPane()->FindPaneByName(scPaneNameTable + 24)->GetMaterial()->GetTexture(&mOffTexCN, 0);
layout->getLayout()->GetRootPane()->FindPaneByName("P_OffBtn")->GetMaterial()->GetTexture(&mOffTexDefault, 0);
layout->getLayout()->GetRootPane()->FindPaneByName("P_JPOffBtn")->GetMaterial()->GetTexture(&mOffTexJP, 0);
layout->getLayout()->GetRootPane()->FindPaneByName("P_CNOffBtn")->GetMaterial()->GetTexture(&mOffTexCN, 0);
layout->getLayout()->GetRootPane()->FindPaneByName(scP_OnBtn)->GetMaterial()->GetTexture(&mOnTexDefault, 0);
layout->getLayout()->GetRootPane()->FindPaneByName(scPaneNameTable + 36)->GetMaterial()->GetTexture(&mOnTexCN, 0);
layout->getLayout()->GetRootPane()->FindPaneByName("P_CNOnBtn")->GetMaterial()->GetTexture(&mOnTexCN, 0);
mpOffBoundPane->setListener(this);
mpOnBoundPane->setListener(this);
@@ -1755,7 +1731,7 @@ namespace textinput {
if (mgr()->isInScroll() && event != gui::EventHandler::ON_LEFT && event != gui::EventHandler::ON_POINT) {
return;
}
if (!mgr()->searchAnmPane(scW_predictWindow)->isInAnimation() || event == gui::EventHandler::ON_LEFT) {
if (!mgr()->searchAnmPane("W_predictWindow")->isInAnimation() || event == gui::EventHandler::ON_LEFT) {
OnOffAnmPane* p;
if (&component == mpOnBoundPane) {
p = mpOnAnmPane;

View File

@@ -295,13 +295,40 @@ confirmLetters:
update();
}
static inline void CopyWordSuffix(u16* word, u32 length) {
u32 wordLength;
u32 copied;
wordLength = wcslen((wchar_t*)word) & 0xff;
for (copied = 0; copied < length; ++copied) {
word[copied] = word[(wordLength - length) + copied];
}
word[copied] = 0;
}
void WithZi::update() {
u16* koreanOutput;
u16* keyOutput;
wchar_t* candidateOutput;
u16* destination;
u32 copyLength;
u16 keyCharacter;
u16* wordOutput;
u16* letter;
u32 count;
s32 elementCount;
u16* source;
s32 keyIndex;
s32 position;
s32 candidateLength;
u16 character;
s32 index;
if (mbDictionaryOpen == 0) {
return;
}
mSelectedCandidate = 0;
s32 elementCount = static_cast<u16>(setElementBuffer());
elementCount = static_cast<u16>(setElementBuffer());
mSearch.language = getPredictLanguage();
mSearch.subLanguage = 7;
mSearch.getMode = 0;
@@ -339,24 +366,23 @@ void WithZi::update() {
CandidatedWord[0] = L'>';
CandidatedWord[1] = 0;
mCandidateCount = 1;
u16* output = CandidatedWord + 0x40;
for (s32 keyIndex = 1; keyIndex < 16; ++keyIndex) {
u16 candidate = static_cast<keyboard::cellphonetype::PaneNameToCharCode*>(mpHoldingKey)->wc[keyIndex - 1];
if (candidate != 0) {
output[0] = candidate;
output[1] = 0;
keyOutput = CandidatedWord;
for (keyIndex = 1; keyIndex < 16; ++keyIndex) {
keyCharacter = static_cast<keyboard::cellphonetype::PaneNameToCharCode*>(mpHoldingKey)->wc[keyIndex - 1];
if (keyCharacter != 0) {
keyOutput[keyIndex * 0x40] = keyCharacter;
keyOutput[keyIndex * 0x40 + 1] = 0;
++mCandidateCount;
}
output += 0x40;
}
EZTXGetCandidates(&mSearch, mpDictionaryWork);
}
else {
memcpy(PredictionBuffer, CandidatesBuffer, 0x200);
ChangeDictionaryLanguage(getPredictLanguage());
u32 count = EZTXGetCandidates(&mSearch, mpDictionaryWork) & 0xff;
count = EZTXGetCandidates(&mSearch, mpDictionaryWork) & 0xff;
if (getPredictLanguage() == ZI8_LANG_ZH && count == 0x61) {
wchar_t* candidateOutput = reinterpret_cast<wchar_t*>(PredictionBuffer);
candidateOutput = reinterpret_cast<wchar_t*>(PredictionBuffer);
mSearch.firstCandidate = 0x61;
mSearch.candidates = candidateOutput + 0xC2;
mSearch.maxCandidates = 199;
@@ -369,13 +395,8 @@ void WithZi::update() {
}
if (getPredictLanguage() == ZI8_LANG_ZH && mbContextChanged != 0 &&
(mbContextChanged = 0, mSearch.count == 0)) {
u32 length = mCurrentWordLength;
u32 wordLength = wcslen((wchar_t*)LatestWord) & 0xff;
u32 copied;
for (copied = 0; copied < length; ++copied) {
LatestWord[copied] = LatestWord[(wordLength - length) + copied];
}
LatestWord[copied] = 0;
copyLength = mCurrentWordLength;
CopyWordSuffix(LatestWord, copyLength);
mSearch.wordCharCount = wcslen((wchar_t*)LatestWord);
count = EZTXGetCandidates(&mSearch, mpDictionaryWork) & 0xff;
}
@@ -392,28 +413,25 @@ void WithZi::update() {
memset(CandidatedWord, 0, 0x1400);
mCandidateCount = 0;
if (elementCount != 0 || mSearch.wordCharCount != 0) {
u16* source = reinterpret_cast<u16*>(mSearch.candidates);
u16* destination = CandidatedWord;
for (s32 index = 0; index < static_cast<s32>(count); index++) {
source = reinterpret_cast<u16*>(mSearch.candidates);
destination = CandidatedWord;
for (index = 0; index < static_cast<s32>(count); index++) {
if (getPredictLanguage() == ZI8_LANG_ZH) {
u16* output;
s32 length;
length = 0;
output = destination;
candidateLength = 0;
wordOutput = destination;
for (; *source != L' ' && *source != 0; source++) {
*output++ = *source;
++length;
*wordOutput++ = *source;
++candidateLength;
}
++source;
destination[length] = 0;
destination[candidateLength] = 0;
} else if (mPredictLanguage == PL_11) {
*destination = *source++;
destination[1] = 0;
} else if (getPredictLanguage() == ZI8_LANG_KO) {
u16* output = destination;
u16 character;
koreanOutput = destination;
while ((character = *source) >= 0x100) {
*output++ = character;
*koreanOutput++ = character;
++source;
}
} else if (EZTXCopy(reinterpret_cast<wchar_t*>(destination), &mSearch, index & 0xff, mpDictionaryWork) == 0) {
@@ -421,20 +439,18 @@ void WithZi::update() {
}
++mCandidateCount;
{
u16* candidate;
s32 position;
position = 0;
for (candidate = destination; *candidate != 0; ++candidate, ++position) {
for (letter = destination; *letter != 0; ++letter, ++position) {
switch (mLetterMode) {
case LM_1:
*candidate = util::toWLower(*candidate);
*letter = util::toWLower(*letter);
break;
case LM_2:
*candidate = util::toWUpper(*candidate);
*letter = util::toWUpper(*letter);
break;
case LM_0:
if (position == 0) *candidate = util::toWUpper(*candidate);
else *candidate = util::toWLower(*candidate);
if (position == 0) *letter = util::toWUpper(*letter);
else *letter = util::toWLower(*letter);
break;
case LM_3:
break;

View File

@@ -212,6 +212,8 @@ namespace ipl {
}
}
#pragma push
#pragma ppc_iro_level 0
void SDChannelSelect::create() {
mpSDWorker = new (System::getMem2App(), 4) NandSDWorker();
mpWorkerHeap = (EGG::Heap*)System::getMem2App()->alloc(0x3EA60, 0x40);
@@ -253,6 +255,7 @@ namespace ipl {
utility::CSFlags::UpdateFlagsFile();
}
#pragma pop
void SDChannelSelect::enqueueStartNotice() {
SDChannelSelectCommand command;
command.type = 1;
@@ -1322,7 +1325,7 @@ namespace ipl {
}
bool SDChannelSelect::collectTitlesByUsage(
const s32* firstUsage, const s32* secondUsage, ESTitleId* titleIds,
s32* firstUsage, s32* secondUsage, ESTitleId* titleIds,
char* titleNames, u32* titleCount) {
s32 bytes;
s32 blocks;
@@ -1357,7 +1360,7 @@ namespace ipl {
}
bool SDChannelSelect::collectTitlesFromNandUsage(
const s32* firstUsage, const s32* secondUsage,
s32* firstUsage, s32* secondUsage,
ESTitleId* titleIds, char* titleNames, u32* titleCount) {
s32 bytes;
s32 blocks;
@@ -1396,7 +1399,7 @@ namespace ipl {
}
bool SDChannelSelect::collectTitlesByChannelOrder(
const s32* firstUsage, const s32* secondUsage, ESTitleId* titleIds,
s32* firstUsage, s32* secondUsage, ESTitleId* titleIds,
char* titleNames, u32* titleCount) {
static const int channelOrder[MAX_CHANNEL_INDEX] = {
11, 7, 3, 10, 6, 2, 9, 5, 1, 8, 4, 0,
@@ -1406,17 +1409,10 @@ namespace ipl {
getCurrentTitleUsage(&bytes, &blocks);
*titleCount = 0;
ESTitleId titleId;
for (int page = MAX_CHANNEL_PAGE - 1; page >= 0; --page) {
for (int order = 0; order < MAX_CHANNEL_INDEX; ++order) {
int channelIndex = channelOrder[order];
const channel::SEntry& channelInfo =
System::getChannelManager()->mChannels[page][channelIndex];
if (channelInfo.loadedBnr) {
titleId = ES_TITLE_ID(channelInfo.info.titleType, channelInfo.info.titleCode);
} else {
titleId = 0;
}
ESTitleId titleId =
System::getChannelManager()->getEntryTitleID(page, channelOrder[order]);
if (titleId == 0 || titleId == 0x48415A41) {
continue;
}
@@ -1448,7 +1444,7 @@ namespace ipl {
}
bool SDChannelSelect::collectTitlesBySpecialChannels(
const s32* firstUsage, const s32* secondUsage, ESTitleId* titleIds,
s32* firstUsage, s32* secondUsage, ESTitleId* titleIds,
char* titleNames, u32* titleCount) {
s32 bytes;
s32 blocks;
@@ -1578,7 +1574,7 @@ namespace ipl {
}
bool SDChannelSelect::collectTitlesForMode(
const s32* requiredBytes, const s32* requiredBlocks,
s32* requiredBytes, s32* requiredBlocks,
ESTitleId* titleIds, char* titleNames, u32* titleCount, int searchMode) {
switch (searchMode) {
case 0:
@@ -1647,6 +1643,8 @@ namespace ipl {
}
}
#pragma push
#pragma ppc_iro_level 0
void SDChannelSelect::flushSaveDataAndMountSD() {
if (System::getDialog()->getLastResult() != DialogWindow::RESULT_NONE) {
mpPointerLayout->getAnim(0)->initAnmFrame();
@@ -1658,6 +1656,7 @@ namespace ipl {
}
}
#pragma pop
void SDChannelSelect::handleThreePageDialog() {
if (System::getDialog()->callBtn2Multi(sThreePageDialogPages, 3, 10)) {
mState = 27;
@@ -1902,7 +1901,7 @@ namespace ipl {
pageText->SetString(pageNumber, 0);
nw4r::lyt::Pane* clockPane = mpLayout->FindPaneByName(mscClockPaneNames[page]);
nw4r::math::MTX34 paneMatrix = clockPane->GetGlobalMtx();
nw4r::math::VEC3 position(0.0f, 0.0f, 0.0f);
math::VEC3 position(0.0f, 0.0f, 0.0f);
PSMTXMultVec(paneMatrix, position, position);
mpDialogLayout->GetRootPane()->SetTranslate(position);
mpDialogLayout->calcMtx();
@@ -2699,8 +2698,8 @@ namespace ipl {
return mpLayout->FindPaneByName(mscChannelPaneNames[2][index]);
}
math::VEC3 SDChannelSelect::getChannelPanePosition(SDChannelSelect* scene, int index) {
math::VEC3 position(0.0f, 0.0f, 0.0f);
nw4r::math::VEC3 SDChannelSelect::getChannelPanePosition(SDChannelSelect* scene, int index) {
nw4r::math::VEC3 position(0.0f, 0.0f, 0.0f);
MTXMultVec(scene->getCenterChannelPane(index)->GetGlobalMtx(), position, position);
return position;
}

View File

@@ -5,9 +5,9 @@
#define IPL_CHANNEL_TITLE_NOVTABLE
#include "math/iplInterporation.h"
#undef IPL_CHANNEL_TITLE_NOVTABLE
#include "scene/sdChannelTitle/iplSDChannelTitle.h"
#undef IPL_CHANNEL_TITLE_NOVTABLE
#include "scene/sdChannelSelect/iplSDChannelSelect.h"
#include "system/iplSystem.h"
#include "sound/iplSound.h"
@@ -1351,6 +1351,8 @@ extern "C" void iplSDChannelTitle_prepareSceneExit(SDChannelTitle* scene, int ne
}
}
#pragma push
#pragma ppc_iro_level 0
extern "C" void iplSDChannelTitle_flushSaveBeforeExit(SDChannelTitle* scene, int nextScene) {
int page;
int index;
@@ -1358,10 +1360,10 @@ extern "C" void iplSDChannelTitle_flushSaveBeforeExit(SDChannelTitle* scene, int
System::getSaveData()->pushTitleCache(scene->mTitleId);
}
System::getSaveData()->getSDPrevPage() = scene->mPage;
EGG::Heap* saveHeap = System::getMem2App();
scene->mpSaveFile = System::getSaveData()->flushAsync(saveHeap);
scene->mpSaveFile = System::getSaveData()->flushAsync(System::getMem2App());
__WPADReconnect(TRUE);
}
#pragma pop
extern "C" void iplSDChannelTitle_rebootSystem(SDChannelTitle*) {
snd::getSystem()->stopAllSound(0);

View File

@@ -167,11 +167,6 @@ typedef struct AOSSKeySchedule {
u32 length;
} AOSSKeySchedule;
typedef struct AOSSKeyMaterial {
u8 nonce[2];
u8 address[8];
} AOSSKeyMaterial;
typedef struct AOSSReceiveBuffer {
s32 socket;
u32 length;
@@ -261,11 +256,6 @@ typedef struct AOSSConfigData {
static AOSSRuntimeState s_runtime;
static AOSSConfigData s_configData;
static u8 s_networkBuffer[0x280];
static struct {
AOSSKeyMaterial key;
u8 payload[0x5e];
} s_packetState;
static u32 s_crcTable[0x100];
static s32 s_socket = -1;
static char s_manufacturer[] = "MELCO";
@@ -2324,16 +2314,16 @@ int AOSSSendDiscoveryRequest(void* packet, AOSSRequestRecords* request, int sock
}
int AOSSSendHelloRequest(void* packet, void* request, int socket) {
AOSSHelloPacket* response = (AOSSHelloPacket*)s_responseBuffer;
AOSSHelloPayload* payload;
AOSSRequestRecords* requestRecords = (AOSSRequestRecords*)request;
struct {
AOSSSocketAddress destination;
AOSSHelloRecord hello;
u8 accessPointName[8];
AOSSKeySchedule schedule;
} construction;
u32 checksum;
AOSSRequestRecords* requestRecords = (AOSSRequestRecords*)request;
u8 accessPointName[8];
AOSSHelloRecord hello;
AOSSSocketAddress destination;
AOSSKeySchedule schedule;
int sequence;
u32 crc;
AOSSHelloPacket* response = (AOSSHelloPacket*)s_responseBuffer;
u16 nonce;
u32 stateLength;
u32 index;
@@ -2341,72 +2331,68 @@ int AOSSSendHelloRequest(void* packet, void* request, int socket) {
u32 firstByte;
u32 secondIndex;
u8* state;
u32 i;
const u8* input;
u8 value;
u8 swap;
s16 responseLength;
s16 sendLength;
int sequence;
int encryptionResult;
checksum = 0;
sequence = 0;
memset(&construction.hello, 0, sizeof(construction.hello));
memset(&hello, 0, sizeof(hello));
memset(response, 0, 0x5dc);
payload = &response->payload;
construction.hello.data.fields.type = 2;
construction.hello.data.fields.reserved01 = 0;
construction.hello.data.fields.length = SOHtoNs(4);
construction.hello.data.fields.supportedModes = s_runtime.flags;
construction.hello.data.fields.supportedModes = SOHtoNl(construction.hello.data.fields.supportedModes);
hello.data.fields.type = 2;
hello.data.fields.reserved01 = 0;
hello.data.fields.length = SOHtoNs(4);
hello.data.fields.supportedModes = s_runtime.flags;
hello.data.fields.supportedModes = SOHtoNl(hello.data.fields.supportedModes);
responseLength = 8;
if ((s32)s_connectionState == 1) {
const u32* crcTable;
sequence = 1;
checksum = 0xffffffff;
crc = 0xffffffff;
AOSSInitCrc32Table(0, s_crcTable);
crcTable = s_crcTable;
{
u32 part;
for (part = 0; part < 4; part++) {
for (index = 0; index < 2; index++) {
checksum = (checksum >> 8) ^ crcTable[(checksum ^ construction.hello.data.bytes[part * 2 + index]) & 0xff];
}
}
index = 0;
while (index < 8) {
crc = (crc >> 8) ^ s_crcTable[(crc ^ hello.data.bytes[index++]) & 0xff];
}
checksum = (checksum ^ 0xffffffff) & 0xff;
checksum = (crc ^ 0xffffffff) & 0xff;
construction.schedule.bytes = (u8*)AOSSi_Alloc(8);
if (construction.schedule.bytes != 0) {
schedule.bytes = (u8*)AOSSi_Alloc(8);
if (schedule.bytes != 0) {
nonce = (u16)rand();
memcpy(&payload->encrypted.key.nonce, &nonce, 2);
memcpy(s_packetState.key.nonce, payload->encrypted.key.nonceBytes, 2);
memcpy(s_packetState.key.address, s_accessPointName, 8);
AOSSInitKeySchedule(&construction.schedule, (const u8*)&s_packetState.key, sizeof(s_packetState.key), 8);
for (index = 0; index < 8; index++) {
state = construction.schedule.bytes;
firstIndex = (construction.schedule.i + 1) % construction.schedule.length & 0xff;
AOSSInitKeySchedule(&schedule, (const u8*)&s_packetState.key, sizeof(s_packetState.key), 8);
input = hello.data.bytes;
for (i = 0; i < 8; i++) {
state = schedule.bytes;
firstIndex = (schedule.i + 1) % schedule.length & 0xff;
firstByte = state[firstIndex];
secondIndex = (firstByte + construction.schedule.j) % construction.schedule.length & 0xff;
secondIndex = (firstByte + schedule.j) % schedule.length & 0xff;
swap = state[secondIndex];
stateLength = firstByte + swap;
construction.schedule.i = firstIndex;
construction.schedule.j = secondIndex;
schedule.i = firstIndex;
schedule.j = secondIndex;
state[secondIndex] = (u8)firstByte;
state[firstIndex] = swap;
value = state[stateLength % construction.schedule.length] ^ construction.hello.data.bytes[index];
payload->bytes[index + 4] = value;
value = state[stateLength % schedule.length];
payload->bytes[i + 4] = value ^ *input++;
}
AOSSi_Free(construction.schedule.bytes);
AOSSi_Free(schedule.bytes);
}
payload->encrypted.length = SOHtoNs(8);
responseLength = 0x0c;
} else {
memcpy(payload->bytes, &construction.hello, 8);
memcpy(payload->bytes, &hello, 8);
}
memcpy(construction.accessPointName, &requestRecords->records[1], 8);
encryptionResult = AOSSXorBufferWithKey(construction.accessPointName, 8, s_manufacturer, 6);
memcpy(accessPointName, &requestRecords->records[1], 8);
encryptionResult = AOSSXorBufferWithKey(accessPointName, 8, s_manufacturer, 6);
if (encryptionResult != 0) {
s_errorCode = 2;
return -1;
@@ -2421,17 +2407,17 @@ int AOSSSendHelloRequest(void* packet, void* request, int socket) {
response->header.finalSequence = SOHtoNs(sequence);
response->header.reserved = checksum;
response->header.messageType = 0x11;
memcpy(response->header.messageIdentity, construction.accessPointName, 8);
memcpy(response->header.messageIdentity, accessPointName, 8);
sendLength = (s16)(responseLength + 0x18);
memset(&construction.destination, 0, sizeof(construction.destination));
construction.destination.family = 2;
construction.destination.port = SOHtoNs(0x5790);
construction.destination.address = SOHtoNl(s_runtime.ipAddress);
memset(&destination, 0, sizeof(destination));
destination.family = 2;
destination.port = SOHtoNs(0x5790);
destination.address = SOHtoNl(s_runtime.ipAddress);
if ((s8)s_runtime.active == 0) {
construction.destination.address = 0xffffffff;
destination.address = 0xffffffff;
}
construction.destination.length = 8;
SOSendTo(socket, response, sendLength, 0, &construction.destination);
destination.length = 8;
SOSendTo(socket, response, sendLength, 0, &destination);
return 0;
}

View File

@@ -0,0 +1,4 @@
#include "scene/setting/AOSS.h"
u32 s_crcTable[0x100];
AOSSPacketState s_packetState;

View File

@@ -2705,6 +2705,8 @@ namespace ipl {
mUiStatus[2] = 0;
}
#pragma push
#pragma ppc_iro_level 1
void Setting::scanAP() {
BOOL playing = FALSE;
switch (mAPScanState) {
@@ -2753,9 +2755,8 @@ namespace ipl {
mpPaneManager->update();
break;
case 6: {
int animationIndex = mAPAnimationIndex;
mInputDelayFrame = 1;
playing |= mpMainLayout->getAnim(animationIndex)->isPlaying();
playing |= mpMainLayout->getAnim(mAPAnimationIndex)->isPlaying();
if (!playing) {
mAPScanState = 5;
setAPDraw();
@@ -2780,9 +2781,8 @@ namespace ipl {
break;
}
case 7: {
int animationIndex = mAPAnimationIndex;
mInputDelayFrame = 1;
playing |= mpMainLayout->getAnim(animationIndex)->isPlaying();
playing |= mpMainLayout->getAnim(mAPAnimationIndex)->isPlaying();
if (!playing) {
updateScroll();
mAPScanState = 6;
@@ -2806,6 +2806,7 @@ namespace ipl {
break;
}
}
#pragma pop
void Setting::initScroll() {
if (mUiStatus[2] == 0) {

View File

@@ -16,11 +16,6 @@
#include <cstring>
#include <cwchar>
extern "C" void _savegpr_27();
extern "C" void _restgpr_27();
extern "C" void getLanguage__Q23ipl6SystemFv();
extern "C" void getRegion__Q23ipl6SystemFv();
namespace ipl {
namespace channel {
u32 Manager::mNumFinished;
@@ -469,85 +464,34 @@ namespace ipl {
System::getSaveData()->setChanInfo(page1, index1, blankInfo);
}
extern "C" asm void getTitleName__Q33ipl7channel7ManagerCFiii() {
nofralloc
stwu r1, -0x20(r1)
mflr r0
stw r0, 0x24(r1)
addi r11, r1, 0x20
bl _savegpr_27
mulli r28, r4, 0x540
mr r27, r3
mulli r29, r5, 0x70
add r0, r3, r28
add r31, r0, r29
lbz r0, 0x24(r31)
cmpwi r0, 0
bne getTitleName_L1
li r3, 0
b getTitleName_L8
getTitleName_L1:
mulli r30, r6, 0x2a
bl getLanguage__Q23ipl6SystemFv
mulli r0, r3, 0x54
lwz r3, 0x10(r31)
add r0, r30, r0
add r3, r3, r0
lhz r0, 0x5c(r3)
cmpwi r0, 0
beq getTitleName_L3
bl getLanguage__Q23ipl6SystemFv
mulli r3, r3, 0x54
lwz r0, 0x10(r31)
add r0, r0, r3
add r3, r0, r30
addi r3, r3, 0x5c
b getTitleName_L8
getTitleName_L3:
bl getRegion__Q23ipl6SystemFv
lis r5, scLangLookup__Q23ipl7channel@ha
add r4, r27, r28
slwi r3, r3, 6
li r0, 0x10
addi r5, r5, scLangLookup__Q23ipl7channel@l
add r6, r29, r4
add r8, r5, r3
li r3, 0
mtctr r0
getTitleName_L4:
lwzx r7, r8, r3
lwz r0, 0x10(r6)
mulli r5, r7, 0x54
add r0, r0, r30
add r4, r5, r0
lhz r0, 0x5c(r4)
cmpwi r0, 0
beq getTitleName_L6
lwz r0, 0x10(r31)
add r0, r0, r5
add r3, r0, r30
addi r3, r3, 0x5c
b getTitleName_L8
getTitleName_L6:
addis r0, r7, 1
cmplwi r0, 0xffff
beq getTitleName_L7
addi r3, r3, 4
bdnz getTitleName_L4
getTitleName_L7:
lwz r0, 0(r8)
lwz r3, 0x10(r31)
mulli r0, r0, 0x54
add r0, r3, r0
add r3, r0, r30
addi r3, r3, 0x5c
getTitleName_L8:
addi r11, r1, 0x20
bl _restgpr_27
lwz r0, 0x24(r1)
mtlr r0
addi r1, r1, 0x20
blr
wchar_t* Manager::getTitleName(int page, int index, int nameIndex) const {
u32 language;
const u32* languages;
if (!mChannels[page][index].loadedBnr) {
return NULL;
}
const wchar_t* preferredName = (const wchar_t*)(
(const u8*)mChannels[page][index].metaHdr +
(nameIndex * (s32)sizeof(mChannels[page][index].metaHdr->names[0][0]) +
System::getLanguage() * sizeof(mChannels[page][index].metaHdr->names[0])) +
offsetof(SChanMgrMetaHeader, names));
if (preferredName[0]) {
return mChannels[page][index].metaHdr->names[System::getLanguage()][nameIndex];
}
languages = scLangLookup[System::getRegion()];
for (int i = 0; i < 16; i++) {
language = languages[i];
if (mChannels[page][index].metaHdr->names[(int)language][nameIndex][0]) {
return mChannels[page][index].metaHdr->names[language][nameIndex];
}
if (language == -1) {
break;
}
}
return mChannels[page][index].metaHdr->names[languages[0]][nameIndex];
}
BOOL Manager::checkNeedUpdate(int page, int index) const {

View File

@@ -596,155 +596,47 @@ namespace ipl {
extern "C" void makeTmpList__Q33ipl8savedata7ManagerFPUxUlPUxUl();
extern "C" void moveTitleTmpToPrior__Q33ipl8savedata7ManagerFPUxPCUx();
asm void Manager::makePriorTitleIDList(register ESTitleId* titleIdsOut, register ESTitleId* titleIdsIn, register u32 titleCount) {
nofralloc
stwu r1, -0x50(r1)
mflr r0
stw r0, 0x54(r1)
addi r11, r1, 0x50
bl _savegpr_14
mr r15, r3
mr r16, r4
mr r17, r5
mr r18, r6
li r23, 0
li r31, 0
li r30, 0
lis r26, 0x4841
li r14, -0x100
li r27, 0
makePriorTitleIDList_L1:
add r25, r15, r31
li r22, 0
li r29, 0
makePriorTitleIDList_L2:
add r3, r25, r29
lbz r0, 0x30(r3)
cmplwi r0, 3
bne makePriorTitleIDList_L8
lwz r21, 0x38(r3)
add r24, r22, r30
lwz r20, 0x3c(r3)
li r19, 0
li r28, 0
b makePriorTitleIDList_L7C
makePriorTitleIDList_L3:
add r3, r17, r28
lwzx r0, r17, r28
lwz r3, 4(r3)
or. r0, r3, r0
beq makePriorTitleIDList_L7
slwi r0, r24, 3
add r4, r16, r0
lwzx r3, r16, r0
lwz r4, 4(r4)
or. r0, r4, r3
beq makePriorTitleIDList_L4
mr r21, r3
mr r20, r4
b makePriorTitleIDList_L6
makePriorTitleIDList_L4:
li r0, -1
lis r4, 1
and r3, r20, r14
addi r5, r26, 0x4100
and r0, r21, r0
addi r6, r4, 2
xor r5, r3, r5
xor r4, r0, r6
or. r4, r5, r4
beq makePriorTitleIDList_L5
addi r5, r26, 0x5900
xor r4, r0, r6
xor r5, r3, r5
or. r4, r5, r4
beq makePriorTitleIDList_L5
addi r5, r26, 0x5a00
xoris r4, r0, 1
xor r5, r3, r5
or. r4, r5, r4
bne makePriorTitleIDList_L6
makePriorTitleIDList_L5:
lwz r4, 0x4f8(r15)
lwz r5, 0x4fc(r15)
xor r0, r0, r4
xor r3, r3, r5
or. r0, r3, r0
beq makePriorTitleIDList_L6
ori r20, r5, 0x41
mr r21, r4
makePriorTitleIDList_L6:
add r4, r17, r28
lwzx r7, r17, r28
lwz r8, 4(r4)
mr r3, r15
mr r6, r20
mr r5, r21
bl isEqualChannel__Q33ipl8savedata7ManagerFUxUx
cmpwi r3, -2
beq makePriorTitleIDList_L6A
cmpwi r3, 0
bne makePriorTitleIDList_L6B
makePriorTitleIDList_L6A:
mr r3, r15
mr r6, r20
mr r5, r21
bl checkValidApp__Q33ipl8savedata7ManagerFUx
cmpwi r3, 0
beq makePriorTitleIDList_L6C
slwi r0, r24, 3
add r3, r16, r0
stw r20, 4(r3)
stwx r21, r16, r0
makePriorTitleIDList_L6C:
add r3, r17, r28
stw r27, 4(r3)
stwx r27, r17, r28
b makePriorTitleIDList_L7
makePriorTitleIDList_L6B:
cmpwi r3, 1
bne makePriorTitleIDList_L7
add r4, r17, r28
lwzx r5, r17, r28
lwz r6, 4(r4)
mr r3, r15
bl checkValidApp__Q33ipl8savedata7ManagerFUx
cmpwi r3, 0
beq makePriorTitleIDList_L6D
slwi r0, r24, 3
add r5, r17, r28
add r3, r16, r0
lwzx r4, r17, r28
lwz r0, 4(r5)
stw r0, 4(r3)
stw r4, 0(r3)
makePriorTitleIDList_L6D:
add r3, r17, r28
stw r27, 4(r3)
stwx r27, r17, r28
makePriorTitleIDList_L7:
addi r19, r19, 1
addi r28, r28, 8
makePriorTitleIDList_L7C:
cmplw r19, r18
blt makePriorTitleIDList_L3
makePriorTitleIDList_L8:
addi r22, r22, 1
addi r29, r29, 0x10
cmpwi r22, 0xc
blt makePriorTitleIDList_L2
addi r23, r23, 1
addi r30, r30, 0xc
cmpwi r23, 4
addi r31, r31, 0xc0
blt makePriorTitleIDList_L1
addi r11, r1, 0x50
bl _restgpr_14
lwz r0, 0x54(r1)
mtlr r0
addi r1, r1, 0x50
blr
#pragma push
#pragma ppc_iro_level 0
void Manager::makePriorTitleIDList(ESTitleId* titleIdsOut, ESTitleId* titleIdsIn, u32 titleCount) {
int outputIndex;
for (int page = 0; page < MAX_CHANNEL_PAGE; page++) {
for (int index = 0; index < MAX_CHANNEL_INDEX; index++) {
if (mData.chanInfo[page][index].primaryType == channel::PRIMARY_TYPE_CHANNEL) {
outputIndex = index + page * MAX_CHANNEL_INDEX;
ESTitleId titleId = ES_TITLE_ID(mData.chanInfo[page][index].titleType, mData.chanInfo[page][index].titleCode);
for (u32 inputIndex = 0; inputIndex < titleCount; inputIndex++) {
if (titleIdsIn[inputIndex] == TITLE_NULL) {
continue;
}
if (titleIdsOut[outputIndex] != TITLE_NULL) {
titleId = titleIdsOut[outputIndex];
} else {
ESTitleId titleCode = TITLE_NO_REGION(titleId);
if (titleCode == TITLE_PHOTO || titleCode == TITLE_PHOTO_2 || titleCode == TITLE_PHOTO_2_CHECK) {
if (titleCode != mPhotoId) {
titleId = mPhotoId | TITLE_REGION_ALL;
}
}
}
int match = isEqualChannel(titleId, titleIdsIn[inputIndex]);
if (match == -2 || match == 0) {
if (checkValidApp(titleId)) {
titleIdsOut[outputIndex] = titleId;
}
titleIdsIn[inputIndex] = TITLE_NULL;
} else if (match == 1) {
if (checkValidApp(titleIdsIn[inputIndex])) {
titleIdsOut[outputIndex] = titleIdsIn[inputIndex];
}
titleIdsIn[inputIndex] = TITLE_NULL;
}
}
}
}
}
}
#pragma pop
void Manager::integrateTitleIDList(ESTitleId* titleIdsOut, ESTitleId* titleIdsIn, u32 titleCount) {
ESTitleId temporaryTitleIds[0x36] = {0};
@@ -804,81 +696,35 @@ namespace ipl {
}
}
asm BOOL Manager::doUpdateChanInfos(register ESTitleId* titleIds) {
nofralloc
stwu r1, -0x40(r1)
mflr r0
stw r0, 0x44(r1)
addi r11, r1, 0x40
bl _savegpr_20
mr r27, r3
mr r28, r4
li r3, 0
li r30, 0
li r26, 0
li r25, 0
li r20, 3
li r21, 0
li r22, 0xe
li r23, -1
doUpdateChanInfos_L1:
add r31, r27, r26
li r29, 0
li r24, 0
doUpdateChanInfos_L2:
add r4, r31, r24
lbz r0, 0x30(r4)
cmplwi r0, 1
beq doUpdateChanInfos_L5
add r0, r29, r25
lwz r9, 0x38(r4)
slwi r0, r0, 3
lwz r5, 0x3c(r4)
add r8, r28, r0
lwzx r6, r28, r0
lwz r7, 4(r8)
xor r0, r9, r6
xor r5, r5, r7
or. r0, r5, r0
beq doUpdateChanInfos_L5
or. r0, r7, r6
bne doUpdateChanInfos_L4
addi r3, r4, 0x30
li r4, 0
li r5, 0x10
bl memset
b doUpdateChanInfos_L6
doUpdateChanInfos_L4:
stb r20, 0x30(r4)
stb r21, 0x31(r4)
stb r21, 0x32(r4)
stb r21, 0x33(r4)
stw r22, 0x34(r4)
lwz r0, 0(r8)
and r0, r0, r23
stw r0, 0x38(r4)
lwz r0, 4(r8)
and r0, r0, r23
stw r0, 0x3c(r4)
doUpdateChanInfos_L6:
li r3, 1
doUpdateChanInfos_L5:
addi r29, r29, 1
addi r24, r24, 0x10
cmpwi r29, 0xc
blt doUpdateChanInfos_L2
addi r30, r30, 1
addi r25, r25, 0xc
cmpwi r30, 4
addi r26, r26, 0xc0
blt doUpdateChanInfos_L1
addi r11, r1, 0x40
bl _restgpr_20
lwz r0, 0x44(r1)
mtlr r0
addi r1, r1, 0x40
blr
#pragma push
#pragma ppc_iro_level 0
BOOL Manager::doUpdateChanInfos(ESTitleId* titleIds) {
BOOL changed = FALSE;
for (int page = 0; page < MAX_CHANNEL_PAGE; page++) {
for (int index = 0; index < MAX_CHANNEL_INDEX; index++) {
if (mData.chanInfo[page][index].primaryType != channel::PRIMARY_TYPE_DISK) {
ESTitleId titleId = ES_TITLE_ID(mData.chanInfo[page][index].titleType, mData.chanInfo[page][index].titleCode);
int n = index + page * MAX_CHANNEL_INDEX;
if (titleId != titleIds[n]) {
if (titleIds[n] == TITLE_NULL) {
memset(&mData.chanInfo[page][index], 0, sizeof(channel::SInfo));
} else {
mData.chanInfo[page][index].primaryType = channel::PRIMARY_TYPE_CHANNEL;
mData.chanInfo[page][index].secondaryType = channel::SECONARY_TYPE_NORMAL;
mData.chanInfo[page][index].reserved[0] = 0;
mData.chanInfo[page][index].reserved[1] = 0;
mData.chanInfo[page][index].sceneID = SCENE_NORMAL_CHANNEL;
mData.chanInfo[page][index].titleType = ES_TITLE_TYPE(titleIds[n]);
mData.chanInfo[page][index].titleCode = ES_TITLE_CODE(titleIds[n]);
}
changed = TRUE;
}
}
}
}
return changed;
}
#pragma pop
#endif
BOOL Manager::checkValidApp(ESTitleId titleId) {

View File

@@ -998,12 +998,24 @@ namespace ipl {
return ret;
}
static inline void verifySavedataZD(EGG::Heap* heap, ESTitleId titleId, NANDFileInfo* fileInfo) {
char path[NAND_MAX_PATH];
static inline void verifySavedataZD(EGG::Heap* heap, ESTitleId requestedTitleId, NANDFileInfo* fileInfo) {
ESTitleId titleId;
u32 offset;
u32 j;
BOOL valid;
BOOL fileOpen;
u8* firstBlock;
u8* secondBlock;
BOOL deleteSaveData;
s32 ret;
u8* saveData = NULL;
BOOL fileOpen = FALSE;
BOOL deleteSaveData = FALSE;
u8* saveData;
titleId = requestedTitleId;
char path[NAND_MAX_PATH];
saveData = NULL;
fileOpen = FALSE;
deleteSaveData = FALSE;
sprintf(path, "/title/%08x/%08x/data/%s", (u32)((titleId & 0x00FFFFFFFFFFFFFFULL) >> 32), (u32)(titleId & 0x00FFFFFFFFFFFFFFULL), "zeldaTp.dat");
if (!ESMisc::ChangeUid(titleId)) {
@@ -1030,17 +1042,17 @@ namespace ipl {
OSReport("%s::%s: File size is not correct: %d\n", __FILE__, __FUNCTION__, ret);
deleteSaveData = TRUE;
} else {
u32 offset = 8;
u32 j = 0;
BOOL valid = FALSE;
offset = 8;
valid = FALSE;
j = 0;
while (j < 3) {
u8* block = saveData + offset;
if (!checkForNullTermination((char*)block + 0x4e, 8) ||
!checkForNullTermination((char*)block + 0x58, 8) ||
!checkForNullTermination((char*)block + 0x72, 8) ||
!checkForNullTermination((char*)block + 0x8e, 8) ||
!checkForNullTermination((char*)block + 0x1b4, 0x11) ||
!checkForNullTermination((char*)block + 0x1c5, 0x11)) {
firstBlock = saveData + offset;
if (!checkForNullTermination((char*)firstBlock + 0x4e, 8) ||
!checkForNullTermination((char*)firstBlock + 0x58, 8) ||
!checkForNullTermination((char*)firstBlock + 0x72, 8) ||
!checkForNullTermination((char*)firstBlock + 0x8e, 8) ||
!checkForNullTermination((char*)firstBlock + 0x1b4, 0x11) ||
!checkForNullTermination((char*)firstBlock + 0x1c5, 0x11)) {
goto verify_failed;
}
j++;
@@ -1050,13 +1062,13 @@ namespace ipl {
offset = 0x2008;
j = 0;
while (j < 3) {
u8* block = saveData + offset;
if (!checkForNullTermination((char*)block + 0x4e, 8) ||
!checkForNullTermination((char*)block + 0x58, 8) ||
!checkForNullTermination((char*)block + 0x72, 8) ||
!checkForNullTermination((char*)block + 0x8e, 8) ||
!checkForNullTermination((char*)block + 0x1b4, 0x11) ||
!checkForNullTermination((char*)block + 0x1c5, 0x11)) {
secondBlock = saveData + offset;
if (!checkForNullTermination((char*)secondBlock + 0x4e, 8) ||
!checkForNullTermination((char*)secondBlock + 0x58, 8) ||
!checkForNullTermination((char*)secondBlock + 0x72, 8) ||
!checkForNullTermination((char*)secondBlock + 0x8e, 8) ||
!checkForNullTermination((char*)secondBlock + 0x1b4, 0x11) ||
!checkForNullTermination((char*)secondBlock + 0x1c5, 0x11)) {
goto verify_failed;
}
j++;
@@ -1093,8 +1105,11 @@ namespace ipl {
}
static inline s32 DeleteTicketsForce(EGG::Heap* heap, ESTitleId titleId, u8* ticketViews, u32* ticketViewCount) {
ESTicketView* ticketViewList = NULL;
s32 ret;
u32 j;
ESTicketView* ticketViewList;
ticketViewList = NULL;
memset(ticketViews, 0, OSRoundUp32B(sizeof(ESTicketView)));
ret = ES_GetTicketViews(titleId, NULL, ticketViewCount);
if (ret != ES_ERR_OK) {
@@ -1110,7 +1125,7 @@ namespace ipl {
OSReport("%s::%s: ES_GetTicketViews failed: %d for %016llx\n", __FILE__, __FUNCTION__, ret, titleId);
goto cleanup;
}
for (u32 j = 0; j < *ticketViewCount; j++) {
for (j = 0; j < *ticketViewCount; j++) {
memcpy(ticketViews, &ticketViewList[j], sizeof(ESTicketView));
ret = ES_DeleteTicket((ESTicketView*)ticketViews);
if (ret != ES_ERR_OK) {
@@ -1126,12 +1141,16 @@ namespace ipl {
}
static inline s32 InitSavedata(EGG::Heap* heap) {
u32 i;
s32 ret;
ESTitleId* titleIds;
u8* ticketScratch;
u8 ticketViews[OSRoundUp32B(sizeof(ESTicketView))] ALIGN32;
NANDFileInfo fileInfo ALIGN32;
u32 ticketViewCount;
ESTitleId* titleIds = NULL;
titleIds = NULL;
u32 titleCount = 0;
s32 ret = ES_ListTitlesOnCard(NULL, &titleCount);
ret = ES_ListTitlesOnCard(NULL, &titleCount);
if (ret != ES_ERR_OK) {
OSReport("%s::%s: Failed to ES_ListTitlesOnCard1: %d\n", __FILE__, __FUNCTION__, ret);
@@ -1151,8 +1170,8 @@ namespace ipl {
}
{
u8* ticketScratch = ticketViews;
for (u32 i = 0; i < titleCount; i++) {
ticketScratch = ticketViews;
for (i = 0; i < titleCount; i++) {
if ((titleIds[i] & 0xFFFFFFFFFFFFFF00ULL) == 0x00010000525A4400ULL) {
verifySavedataZD(heap, titleIds[i], &fileInfo);
continue;
@@ -1177,10 +1196,6 @@ namespace ipl {
return ret;
}
s32 ESMisc::DeleteUnauthorizedData(EGG::Heap* heap) {
return InitSavedata(heap);
}
BOOL checkForNullTermination(char* str, u32 len) {
for (u32 i = 0; i < len; i++) {
if (*str == 0) {
@@ -1191,6 +1206,10 @@ namespace ipl {
return FALSE;
}
s32 ESMisc::DeleteUnauthorizedData(EGG::Heap* heap) {
return InitSavedata(heap);
}
TMDFile::TMDFile(EGG::Heap* heap) : mpHeap(heap), mbFileOpen(FALSE), mFileLength(0) {
memset(&mFile, 0, sizeof(mFile));
}

View File

@@ -9,7 +9,7 @@ from pathlib import Path
EXPECTED_DOL_SHA1 = "26116613f624061ba99c8d1a299aaa6efa85670d"
EXPECTED_TOTAL_UNITS = 1027
EXPECTED_TOTAL_UNITS = 1028
EXPECTED_TOTAL_CODE = 2995176
EXPECTED_TOTAL_DATA = 1832684
EXPECTED_TOTAL_FUNCTIONS = 12563

View File

@@ -0,0 +1,111 @@
# opus-aoss: AOSS.c .bss ownership (s_packetState, s_crcTable)
## Evidence
Target relocations (pyelftools over build/43U/obj/src/scene/setting/*.o):
- `AOSS_810BE838` (0x68) and `AOSS_810BE8A0` (0x400) are referenced only by
`AOSSDecryptMessage` (0x81400830) and `AOSSSendHelloRequest` (0x81401778).
No other object in build/43U/obj references them (grep over every .o).
- Those two functions are not contiguous in .text (7 functions between them,
4 after), so (a) "split AOSS.c into a CRC/packet TU with its own functions"
is ruled out: there is no function tail that moves with the objects.
- ATERM.c never references them, so (b) "they are ATERM's" has no support.
- (c) common/tentative: MWLD puts SHN_COMMON blocks after all other .bss of the
link, but ATERM.c's .bss follows these objects, so they are not commons.
Addressing-pattern experiments (AOSS.o, -O4,p -inline off), SendHello differing
lines out of 273 (odiff.py), every other function checked each time:
| AOSS.c form of the two objects | SendHello | other effect |
|---|---|---|
| `static`, defined before the functions (main) | 254 (size 0x43c vs 0x444) | - |
| non-static, defined before the functions | 254 | none |
| `extern` decl at top, definition at end of AOSS.c | 254 | none |
| `extern`, not defined in AOSS.c | 97 (size 0x444) | none |
| all five .bss objects `extern` | 97 | HandleAuthReply 0 -> 103 |
| s_configData + s_networkBuffer also `extern` | 97 | HandleAuthReply 0 -> 103 |
Any definition inside AOSS.c (static, global, early, late) makes MWCC share one
`...bss.0` base register across s_runtime / s_packetState / s_crcTable in
SendHello. The target forms a separate `lis/addi` per object (two for
s_runtime alone), which this compiler only produces when the symbol is
undefined in the TU. Meanwhile s_runtime, s_configData, s_networkBuffer must
stay defined in AOSS.c, or HandleAuthReply loses its exact match. So the two
objects are defined in a different TU that the linker places right after
AOSS.c, with no .text of its own.
## Applied split
- New data-only TU `src/scene/setting/AOSSData.c` (Matching), linked between
AOSS.c and ATERM.c; splits.txt `.bss 0x810BE838..0x810BECA0`.
- They're tentative definitions, so MWCC emits them in reverse order: the
source declares `s_crcTable` and then `s_packetState` (first try in forward
order gave the wrong order and a wrong DOL hash).
- symbols.txt: `AOSS_810BE838` -> `s_packetState`, `AOSS_810BE8A0` -> `s_crcTable`
(needed so the retail AOSS.o asm links against the new definitions).
- `AOSSKeyMaterial`, `AOSSPacketState` and the extern declarations moved to
include/scene/setting/AOSS.h (only AOSS.c includes it).
- Full build: DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d; symorder
AOSSData ORDER OK. All 17 exact AOSS functions are still exact.
## SendHello follow-up (254 -> 58)
| attempt | differing |
|---|---|
| split only, existing source | 97 |
| drop `crcTable` alias local | 97 |
| decl order permutations of response/payload/checksum/sequence (24) | best 82 |
| flat `for (index < 8)` / int index / pointer / sizeof bound / operand swap | 237 (first iteration constant-folded) |
| 2x4 nested loop | 82 |
| `index = 0; while (index < 8) ... bytes[index++]` | 58 |
| decl permutations on top of the while loop | best 58 |
| swap `sequence = 0` / `checksum = 0` | 59 |
| `payload = &response->payload` earlier / at declaration | 69 / 82 |
Remaining in SendHello: checksum r31 vs r30 and payload r30 vs r31 (decl order
can't reach it), and the RC4 loop addresses `construction` from its base
(r1+0x10, offsets 8/9) where the target holds a pointer to `hello.data.bytes`
(r1+0x18, offsets 0/1). The second points at the `construction` carrier struct:
the target probably has `hello` as its own local. That's the next lever.
## Gate (AOSS AOSSData ATERM --quick)
`GATE FAIL: 1 regressions vs main`. The only one is `AOSS: matched_data 3928 -> 2800`,
which is exactly the 1128 bytes now in AOSSData (1128/1128, linked). Global
matched data stays 100%, global fuzzy goes 99.88565 -> 99.88798, no forbidden or
readability findings, DOL SHA1 OK. AOSS is 17/21 exact (unchanged), ATERM 20/26 (unchanged).
## Round 2: alternatives to the data-only TU
| alternative | result |
|---|---|
| definitions in ATERM.c (AOSSData removed, ATERM .bss split moved to 0x810BE838, `AOSSPacketState s_packetState; u32 s_crcTable[0x100];` placed before `gAtermIpConfig`) | built ATERM.o puts them at .bss offsets 8144/9168, i.e. after every ATERM object (unreferenced in the TU, emitted last in reverse order); target needs offset 0/104. MWCC emits a TU's .bss referenced-first, so ATERM can't own the start of its .bss with objects it never uses. Rejected. |
| function-local `static` arrays in SendHello (shadowing the externs) | SendHello 58 -> 231; local statics join the TU's shared `...bss.0` base exactly like file statics. Also ruled out by relocations: AOSSDecryptMessage references both objects directly, so neither function can own them as locals. |
| AOSSLink.c / iplRakuRakuThread.cpp | earlier in link order, their .bss sits before AOSS.c's, can't hold 0x810BE838. Not tried. |
Data-only AOSSData.c remains the only form that gives a separate lis/addi per object.
## Round 2: AOSSSendHelloRequest 58 -> 0
| attempt | differing |
|---|---|
| carrier struct `construction` removed, four plain locals in old order | 84 (hello now addressed at r1+0x18 directly; stack order wrong) |
| 24 permutations of the four locals | best 74: `accessPointName, hello, destination, schedule` (schedule position irrelevant); stack layout now matches |
| RC4 loop reads `*input++` from `input = hello.data.bytes`, as AOSSDecryptMessage does | 57 |
| single-line moves of every declaration (460 builds) | none below 57 |
| no `payload` local (`response->payload.` everywhere) | 261, rejected |
| mwdbg capture (first two runs crashed in the emulator before the function, third worked): `@2964` = checksum's {0, final} web, a split compiler temp numbered above all locals, so it's colored first and takes r31 before `payload`; `@2966` = the reused `index` split for the RC4 loop, colored before `state` and takes r3 | - |
| separate `crc` accumulator for the CRC loop, `checksum = (crc ^ 0xffffffff) & 0xff` | 55 |
| + `checksum` declared right after `payload` (move search) | 23 (r30/r31 fixed) |
| + RC4 loop gets its own counter `i` instead of reusing `index`, declared after `state` | **0**, size 0x444 = 0x444 |
AOSS after: 18/21 exact (was 17). AOSSDecryptMessage still 0/321. Unchanged non-exact:
AOSS_Init_old 1306/1584, AOSSApplyAuthOptions 22/114, AOSSXorBufferWithKey 34/147. Pool identical.
## Gate round 2 (AOSS AOSSData ATERM --quick)
`GATE FAIL: 1 regressions vs main`, again only `AOSS: matched_data 3928 -> 2800` (the 1128 bytes now in
AOSSData, 1128/1128). AOSS 18/21 exact (17 -> 18), code 7720 -> 8812/16192, ATERM 20/26 unchanged, pools
identical, global matched code 97.12163 -> 97.15810, fuzzy 99.88565 -> 99.88839, data 100%, 0 forbidden, 0
readability, DOL SHA1 OK.

View File

@@ -0,0 +1,29 @@
# opus-art: prior-art port attempts (library units)
| unit | symbol | sources found | result |
|------|--------|---------------|--------|
| libs/RevoEX/src/nhttp/NHTTP_stdlib_RVL | NHTTPi_strnicmp | yannicksuter/mscharged-decomp src/RVL_SDK/nhttp/NHTTP_stdlib_RVL.c (+ configure note: NHTTP exact under GC/3.0a5 only); InusualZ/mhtri-decomp src/NHTTP/d_nhttp.c (non-matching there) | 2 -> 0. mscharged source alone stays at 2 under 3.0a5.2; our old int-helper source stays at 2 under 3.0a5; mscharged source + `mw_version="GC/3.0a5"` = exact. |
| libs/RevoEX/src/nhttp/NHTTP_stdlib_RVL | NHTTPi_compareToken | same | 2 -> 0, same fix. Unit fully exact, flipped to Matching, DOL SHA1 unchanged. Using a `LowerCase()` helper instead of the literal ternaries regresses (2 / 17 differing). |
| libs/RevoEX/src/net/aes | AESiEncryptBlock | none (searched AESiEncryptBlock, NETiAESEncryptoBlock, AESiRoundKeyRcon0, NET_AES_BLOCK_MODE_CBC, NETAESCreate: only symbol maps in riptl/wii-symbols and a WiiLink patch header) | no change; GC/3.0a5, 3.0a3.4, 3.0a3 give the same score |
| libs/RevoEX/src/net/aes | AESiDecryptBlock | none (same searches) | no change; same compiler sweep |
| libs/RVL_SDK/src/kbd/kbd_lib | kbdProcMod | headers only (DarkRTA/rb3 kbd.h, galaxymaster2007/THPConv kbd.h); robojumper/sdk_2009-12-11 has kpr_lib.c but no kbd_lib.c | no change (4 differing); compiler sweep no effect |
| libs/RVL_SDK/src/kbd/kbd_lib | kbd_led_handler | same | 3 differing; if/else, `err = 7; if (success == TRUE)`, reordered switch cases give 13-23 (worse); compiler sweep no effect |
| libs/RVL_SDK/src/kbd/kbd_lib | KBDSetModState | same | no change (4 differing) |
| libs/RVL_SDK/src/fa/driver/sd_drv | pfd_sddrv_init / pfd_sddrv_finalize / pfd_sddrv_build_fat32_mbr_bpb | ACreTeam/cf-decomp has only sd_drv.h (VF variant) and nand_drv.c (nanddrv_init/finalize: different body, saved to _refs/prior) | no portable code; compiler sweep no effect |
| libs/RVLMiddleware/TMC_JPEG/src/buffer/idct_block_var | TMCJPEGDEC_IdctBlock_Lumi / _Col | none outside upstream | no change; compiler sweep no effect |
| libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoRGBA8 | TMCJPEGDEC_set_converterRGBA8 / TMCJPEGDEC_converterYUV411toRGBA8 | none outside upstream | no change; compiler sweep no effect |
| libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main | TMCJPEGDEC_err_restart (asm PLACEHOLDER) | none outside upstream | still asm |
| libs/RVL_SDK/src/cntcache/cntcache | CNTCACHEClear (asm PLACEHOLDER) | bgsamm/pbr-dtk cntcache.h (header only, saved); pret/pokerevo has asm only | still asm |
Note for the NHTTP_recvbuf owner: mscharged-decomp builds all of NHTTP with GC/3.0a5 ("retail code keeps the older compiler's constant order and saved-register zeros ... exact under GC/3.0a5 only"). That is what fixed NHTTP_stdlib_RVL here, so NHTTPi_compareTokenN_HdrRecvBuf is worth trying with `mw_version="GC/3.0a5"` and mscharged's NHTTP_recvbuf.c (already in _refs/prior).
## Round 2: readability
- NHTTP_stdlib_RVL: replaced the four inline tolower ternaries with `NHTTPi_TOLOWER(c)` macro. 14/14 exact, pool identical, DOL SHA1 26116613. `LowerCase()` kept (still used by NHTTPi_strToHex).
## Round 2: NHTTP_recvbuf
- mw_version GC/3.0a5 alone: 6/7, compareTokenN still 5/124.
- Reference compareTokenN control flow (prior/yannicksuter_mscharged-decomp__NHTTP_recvbuf.c), with NHTTPi_TOLOWER macro: 0/124, 7/7.
- Same, without the gotos (if/else reads): 86/128. Rejected; goto form kept.
- Locate step through the existing FindHeaderBlock() helper: still 0/124. Kept.
- Removed the unused static LowerCase(): still 7/7, pool identical, ctxdiff diffs 0.
- Flipped to Matching: DOL SHA1 26116613.

View File

@@ -0,0 +1,62 @@
# opus-bs2 attempts (BS2Mach 4 non-exact, BS2Update UpdateThread)
Base 16023905. Start: BS2StartGame 10/393, BS2StartGCGame 9/228, CheckBS2CommandStatus 2/406, BS2Tick 71/1940, UpdateThread 335/913.
Tooling notes:
- mwdbg crashes the emulator (WRITE_UNMAPPED @47e090) whenever `-enc SJIS` is on the command line; drop that flag for tracing (BS2Mach is ASCII). Pass the command via `--args`.
- /tmp/var.py belongs to another worker; my scratch lives in /tmp/opusbs2/.
## Lever 26 IRO off
1. `#pragma ppc_iro_level 0` around each of the four BS2Mach functions, one at a time: StartGame 10->10, StartGCGame 9->145, CheckBS2CommandStatus 2->2, BS2Tick 71->71. Rejected.
## Symbol binding (found via readelf, target LOCAL vs ours GLOBAL)
2. Target has 39 BS2Mach symbols LOCAL (State, NandPending, CacheCommandComplete, CacheSeekComplete, Run, CheckBS2CommandStatus, BS2NANDDivide*, LoaderInit/Main/Close, ...). Made them `static`. Bindings now match; no function changed score (codegen identical). Kept as a link-correctness fix.
## CheckBS2CommandStatus (case 0x12: target `lwz count; stw CacheCommandComplete; slwi`, ours `slwi; stw`)
3. NP; CCC; CacheLength += expr -> 4 (store hoisted before count load).
4. `sizeof * count` operand order -> 2. 5. `CacheLength = CacheLength + expr` -> 9. 6. `= expr + CacheLength + 32` -> 9. 7. `+= 32 + round` -> 2. 8. `* 8` -> 2. 9. `**(u32 **)&DataToc` -> 2.
10. const DVDGameTOC* cast, CCC before -> 4; CCC after -> 2 (lever 27, no effect).
11. (u32) cast on sum -> 3. 12. TRUE -> 2. 13. 0x20 -> 2. 14. `*(DVDGameTOC **)&DataToc` -> 2. 15. open-coded round -> 2.
16. static inline WriteCacheData(buf,size) helper for case 0x12 -> 241 (size becomes temp; target recomputes in else branch, so no helper).
17. mwdbg: the order comes from the pre-RA scheduler (backend-00 -> 01); post-RA scheduler leaves it. Input order has CCC store after the CacheLength store.
18. CacheCommandComplete type BOOL/int/s32 -> 2; volatile -> 46.
19. With static globals: NP;CCC;CL+= -> 4; CL = CL + (expr) after CCC -> 4.
## BS2StartGame / BS2StartGCGame shared prologue (`li r0,1` must precede the base `lis` pair)
20. mwdbg: B1 holds the bss/data base pairs, li/stw StartingGame and the hoisted `&CoverBlock` addi; height of the bss chain wins over li.
21. do-while cover loop -> 10; `for(;;) if break` -> 10; `(&CoverBlock)->state` -> 10; `while (CoverBlock.state)` -> 10; StartingGame = 1 / state != 0 -> 10.
22. `DVDGetCommandBlockStatus(&CoverBlock)` call -> 8 (prologue fixed but loop becomes bl; rejected, evidence that the stw needs a successor/priority).
23. static inline WaitForCoverCommand() / WaitCommandIdle(block) helpers -> 10/9.
24. StartingGame after the loop -> 368 (wrong).
25. `volatile BOOL StartingGame` -> StartGame 10->5, StartGCGame 9->4, every other BS2Mach function unchanged (report: 25/29 exact, data 100%). StartingGame is the cross-thread "game is starting" flag read by BS2Tick, like the other volatile flags (CacheFailed, RegionValid, NandPending). KEPT.
## BS2StartGame DI write (0xCC003024): target addr r4 / value r3, ours addr r3 / value r4 (5 diffs)
26. Declaration permutations of diBits/diValue/diAddr (5 orders) -> 5 or 7.
27. `__PIRegs[9]` instead of raw pointer, value/bits named -> 5 (same tie). regsim (want diValue=r3): structural, 0/1.
28. regsim on three-named form (want diValue=r3,diAddr=r4,diBits=r0): best 1/3, structural. The address is always a lis temp (r196); the value must be a temp numbered after it to be colored first.
29. `*diAddr = (*diAddr | 1) | diBits` (u32/vu32, 1U, no parens) -> registers right but `ori 4`+`ori 1` merge into `ori 5`: 24, size -4.
30. `diBits | (*diAddr | 1)` -> 7 (ori 1 moves after the or). `(u32)(...) | diBits` -> 7. `diValue = *diAddr | 1` -> 7. `__PIRegs[9] | 1` into named -> 7.
## BS2StartGCGame 64-bit multiply (target mulhwu(freq r5, seconds r7); ours mulhwu(seconds, freq))
31. Declaration permutations of rtc/counterBias/seconds/timerFrequency x two operand orders (48 builds) -> all 8 (freq*sec) / 4; named values are forwarded, decl order irrelevant.
32. freq*sec forms: `(OSTime)freq * sec`, `freq * (OSTime)sec`, both cast, `(u64)` (145, size change), OS_TIMER_CLOCK*, `(OS_BUS_CLOCK >> 2)` / `/ 4` inline -> 8: operand order fixes the multiply but evaluation order follows it, so registers swap.
33. sec*freq forms: OSSecondsToTicks, `time = rtc + bias; time *= clock`, `time = CLOCK * time` (operands get swapped back to time first!), OSTime-typed seconds and/or timerFrequency -> 4.
34. freq computed before seconds statement -> 4/8; `time = freq; time *= sec` -> 9.
35. OSTime-typed timerFrequency x four freq*sec forms -> 8.
36. Put the SCGetCounterBias() call inside the right operand: `time = OS_TIMER_CLOCK * (OSTime)(rtc + SCGetCounterBias());` -> 0/228 EXACT. The call makes the seconds operand heavier, so it is evaluated first (lower vreg -> r7) while the clock stays the left operand. Also exact: `(OSTime)OS_TIMER_CLOCK * (rtc + SCGetCounterBias())`, `(OSTime)(OS_BUS_CLOCK >> 2) * (...)`. Unused locals counterBias/seconds/timerFrequency removed. Pool identical (91/91), BS2Mach 26/29, data 100%.
## BS2Tick (71 at start of this round)
37. IRO off -> 71 (attempt 1).
38. Move `AudioBufferUnconfigured = 1` to each of 10 positions in case 0 -> 71/72. volatile AudioBufferUnconfigured -> 71.
39. Definition-level volatile sweep, one global at a time (36 globals): PartitionOpen 71->68, LoadingTitle 71->69, all others same or worse (State 76, ResetTime 91, CoverPollTime 166, CurrentTmd 1314, ...).
40. `static vu32 PartitionOpen` + `static vu32 LoadingTitle` -> BS2Tick 66; every other BS2Mach function unchanged (26/29, data 100%). LoadingTitle is set by BS2StartLoadingTitle from the menu thread and polled by BS2Tick; PartitionOpen is likewise a cross-call state flag. KEPT.
41. Second single-volatile sweep on top of 40 -> nothing below 66.
42. Device-code block (target 0x27d4): target shares one `State = BS2_STT_8` after the if/else; ours duplicates it. Merging fixes the tail but target also re-materializes `lis 0x8000` in each branch, ours reuses the consoleType base -> 8 bytes short, 1703 diffs. Tried consoleType as `(OSBootInfo *)`, `OSPhysicalToCached(0x2C)`, `*(u32 *)0x8000002C`, `OS_ADDR_BOOT_INFO`, `!(...)`, `OSGetConsoleType()` (adds bl), and `*(u16 *)OSPhysicalToCached(0x30E6)` for the store: all 1701-1703. Restored the duplicated State (66).
43. `#pragma ppc_iro_level 0` around BS2Tick with merged State -> identical output; IRO evidently does not run on BS2Tick (or StartGame) at all, so the lis sharing comes from the backend.
## BS2Update
44. readelf: target has rc/VersionIOS/VersionMEM2/VersionES/ConsoleType GLOBAL and getSuffix LOCAL (ours the opposite). Fixed the bindings: UpdateThread 335/913 unchanged (codegen identical).
45. Logging-call `titleId` via UPDATE_DISC_ENTRIES macro instead of discEntries (target re-materializes `lis 0x8048` there) -> 335. Dropping the discEntries local entirely -> 382. Remaining diff is an extra callee-saved register in target (r14..r31) shifting every allocation; not pursued further this round.
Final gate (BS2Mach + BS2Update, --quick): GATE PASS, 0 regressions, BS2Mach 26/29 exact (BS2StartGCGame new), BS2Update 9/10.
Best non-exact sources: opus-bs2.best.c (BS2Tick 66, volatile PartitionOpen/LoadingTitle), opus-bs2.best.BS2Update.c (binding fixes, UpdateThread 335).

View File

@@ -0,0 +1,87 @@
# opus-cntc attempts (cntcache.c)
## _CNTCACHEDeleteContent (start: asm placeholder; prior best C 95.79%, 143/145)
1. Flat early-return C, typed `ESTmdView view` local: 80/145 differing, frame 0x2120.
2. `u8 buf[sizeof(ESTmdView)]` + `ESTmdView* tmd` pointer, size/count decl order swapped: 118 (frame fixed, pointer r28 appears).
3. Helper with multiple returns: 90 (worse branch shape in helper, `bge; b`).
4. Helper with `usage` var + if/else chain: 90.
5. `usage = result;` before chain: 118 (coalesced anyway).
6. Type check via `ES_TITLE_TYPE` (u32 cast and 64-bit): -1 still CSE'd into r31.
7. `(titleId & 0xFFFFFFFF00000000) != 0x0001000500000000`: 96, xor form.
8. Nested-if structure (single exit, memset inside): 90/145, 143/145 insns; only diffs are the
missing `li r0,-1` reload before snprintf (CSE/LICM keeps -1 in r31) and missing `mr r0,r3`
(helper result coalesced into r3); everything else is register renumbering from those.
9. Diagnostic: type check without mask -> li -1 hoisted to outer token-loop preheader (LICM).
10. 32-bit masks `(u32)(x>>32) & 0xFFFFFFFF`: masks fold away, 82 but wrong (no `and`).
11. Mask variants `(u32)(t>>32),(u32)(t&0xFFFFFFFF)` etc.: 89-90, -1 still hoisted.
12. Helper `static` (auto-inline) instead of `static inline`: 90, no change.
## _CNTCACHEIsTitleRemovable (start: asm placeholder; prior best C 93.71%)
Upstream koopthekoopa/wii-ipl has a non-matching C sketch (GetSavePath/GetTmdView helpers, `ret = -1`, goto out); read only.
1. Typed flat version with my usage helper: 69/82.
2. Upstream structure (GetSavePath + GetTmdView helpers, `s32 ret = -1`, goto out): 72.
3. GetTmdView takes `u32* tmdSize` from caller: frame offsets right, 72.
4. Usage code written directly in the caller (no GetSavePath): `mr r4,r3` copy appears in target position.
5. + `u8 tmdBuf[OSRoundUp32B(sizeof(ESTmdView))]` with `ESTmdView* tmd` pointer: 5/82.
6. `(u8)(titleVersion >> 8)`: no change (srawi.); `((v >> 8) & 0xFF)`: 4/82.
7. Back to GetSavePath helper with those fixes: 18 (copy coalesced on the wrong side).
8. `result`/`ret` split in helper: 18. `static inline`/`s32` helper: 18. Drop `= -1` init: 69.
## _CNTCACHEDeleteContent (cont.)
13. Usage code written directly (no helper): no copy, 90.
14. Function-wide `ret` reused for every status (typical SDK style): 94, no copy.
15. Shared `static s32 GetSaveDataUsage` helper written like the matched inline code
(`s32 ret = -1;`, separate `usedBlocks = 1; usedINodes = 1;` stores, if/else chain):
21/145. Swapping usedBlocks/usedINodes declaration order: 15. Declaring `titleId` before
`tmd`: **0/145 (exact)**. The dead `ret = -1` init is load-bearing (without it: 90).
16. IsTitleRemovable switched to the same helper with caller `s32 ret;` (no init): **0/82**.
(With caller `ret = -1` init: 16/82.)
## CNTCACHEClear (start: asm placeholder; prior best C 93.36%, 147/151)
1. Replaced the hex blob with real literals (SDKDefineVersion, path/command literals,
`" \n"`, `"/title/%08x/%08x/data"`). Clear in C with `FindLineEnd` static helper: 162/180;
`_CNTCACHEDeleteTitle` got auto-inlined into Clear (target calls it).
2. `(void)` prototypes, no prototypes (compile error), `-ipa function` / no ipa (no change, or
header static inlines emitted): DeleteTitle still inlined / unusable.
3. Diagnostic `#pragma inline_max_auto_size(k)`: DeleteTitle's auto-inline size is 15 and the
default limit is 15, so the original DeleteTitle must score >= 16.
while->for, nested ifs, result assignments: still 15. switch: breaks DeleteTitle.
4. DeleteTitle as a `for` loop with `if (errno != 0 || type == 1) continue;`: size 16, not
inlined, DeleteTitle still 0/50. Clear: 126/151, size 147/151.
5. Error exits: `goto close`, else-goto, switch, do/while(0)+break all give `bne close`; micro-tests
show only `return` gives the target `beq +8; b close`. Helper `ExecuteCacheFile(info, result)`
with returns: 151/151 (not inlined, auto size); `static inline`: 68/151, 149 insns, branch
layout matches.
6. `s32 readLength` + `> sizeof(buf)` clamp: cmpw/bgt/cmplwi as target, 67.
Swapping compare operands: no effect. `!lineEnd` / `if (command)`: immediate compares, 64.
7. Stripped writers `CNTCACHEAddDeleteTitle` / `CNTCACHEAddDeleteContent` (+ static Read/Write
helpers using /shared2/cntcache.txt, /tmp/cntcache.txt, NANDPrivateMove to /shared2):
.data and .sdata bytes identical to target, Clear string offsets match.
8. Brute-force local order: Clear's own decls have no effect; helper decls reversed
(lineLength, line, readLength, offset): 47/151 (helper r23..r26 match).
9. Lone `cmpwi r3,0` after each NANDPrivateDelete: empty if, `;`, `(void)(x == 0)`, empty inline
call, dead store, inline void/return helpers all remove it. Micro-test: kept only when
the body copies between two coalesced variables (`r = res; if (g()) { r = res; }`).
`opened = FALSE` in body: 49/155. `result = result;`: keeps only the second compare, 47/151 at 150 insns.
Not found; stopped here.
Result: CNTCACHEClear not exact (best 47/151, 149/151 insns). Best C plus required companion
changes in [opus-cntc.best.c](opus-cntc.best.c); the asm placeholder and original data arrays stay.
## Final state
- `_CNTCACHEIsTitleRemovable` 0/82, `_CNTCACHEDeleteContent` 0/145 (C, shared GetSaveDataUsage).
- `CNTCACHEInit` 0/29, `_CNTCACHEDeleteTitle` 0/50, `CNTCACHEClear` 0/151 (asm) unchanged.
- pool_diff: identical (9/9).
- Note: in DeleteContent, `result != ES_ERR_DONT_EXISTS && result == ES_ERR_OK` keeps the
target's separate -106 compare; this is redundant but not impossible.
## Round 2: _CNTCACHEDeleteContent without the redundant test
1. Replaced `result != ES_ERR_DONT_EXISTS && result == ES_ERR_OK && ...` with an early
`if (result == ES_ERR_DONT_EXISTS) { return; }` followed by `if (result == ES_ERR_OK && ...)`:
0/145, equal size. IsTitleRemovable still 0/82, pool identical (9/9).
check_asm_inventory: FAIL before and after (same 8 pre-existing placeholders incl. parked CNTCACHEClear).

View File

@@ -0,0 +1,259 @@
/*
* opus-cntc best C for CNTCACHEClear: 47/151 differing, 149/151 instructions
* (odiff libs/RVL_SDK/src/cntcache/cntcache CNTCACHEClear). Not exact; the retail
* assembly placeholder stays in cntcache.c.
*
* Needed alongside this text (all verified in the trial build):
* - Replace the scCntCacheStrs/scCntCacheTitleDataFmt/scCntCacheSpaceNl byte arrays with
* real literals: SDKDefineVersion(CNTCACHE, "Apr 20 2010", "14:15:28"), " \n",
* "/title/%08x/%08x/data". The writer functions below (stripped from the DOL) own
* "DeleteTitle ", "%016llx ", "/shared2" and "DeleteContent " and put them before
* Clear's literals; with them .data/.sdata bytes are identical to the target.
* - _CNTCACHEDeleteTitle must be the for/continue form below. The while form has auto-inline
* size 15 (= the -inline auto limit) and gets inlined into Clear; the target calls it.
* The for/continue form still matches DeleteTitle 0/50 and is not inlined.
* - ExecuteCacheFile must be `static inline` with `return`s: that is what produces the
* target's `beq +8; b close` exits (goto produces `bne close`).
* - Helper locals declared in reverse (lineLength, line, readLength, offset) give the
* target's r23..r26. Clear's own local order has no effect.
*
* Remaining: the target has a lone `cmpwi r3,0` after each NANDPrivateDelete. MWCC keeps
* such a compare when the if-body is a copy between two coalesced variables (micro-test:
* `r = res; if (g() != 0) { r = res; }`). An empty if-body or ignored return removes it, and
* `result = result;` keeps only the second one. The caller-side registers (base r30, opened
* r29, result r28, locked r27, zero r31) are still off, probably because of that missing copy.
*/
#define CNTCACHE_READ_SIZE 0x400
#define CNTCACHE_LINE_SIZE 0x40
#define CNTCACHE_RESULT_READ_ERROR (-5299)
static s32 ReadCacheFile(char* buf, u32 bufSize, u32* length) {
NANDFileInfo info;
s32 result;
*length = 0;
result = NANDPrivateOpen("/shared2/cntcache.txt", &info, NAND_ACCESS_READ);
if (result == NAND_RESULT_NOEXISTS) {
return NAND_RESULT_OK;
}
if (result != NAND_RESULT_OK) {
return result;
}
result = NANDGetLength(&info, length);
if (result == NAND_RESULT_OK && *length > bufSize) {
result = NAND_RESULT_MAXBLOCKS;
}
if (result == NAND_RESULT_OK && NANDRead(&info, buf, OSRoundUp32B(*length)) != *length) {
result = CNTCACHE_RESULT_READ_ERROR;
}
NANDClose(&info);
return result;
}
static s32 WriteCacheFile(const char* buf, u32 length);
s32 CNTCACHEAddDeleteTitle(ESTitleId titleId) {
char buf[CNTCACHE_READ_SIZE + CNTCACHE_LINE_SIZE] ALIGN32;
u32 length;
s32 result;
OSLockMutex(&_CNTCACHEMutex);
result = ReadCacheFile(buf, CNTCACHE_READ_SIZE, &length);
if (result == NAND_RESULT_OK) {
strcpy(buf + length, "DeleteTitle ");
length += strlen(buf + length);
length += sprintf(buf + length, "%016llx ", titleId);
buf[length++] = '\n';
result = WriteCacheFile(buf, length);
}
OSUnlockMutex(&_CNTCACHEMutex);
return result;
}
static s32 WriteCacheFile(const char* buf, u32 length) {
NANDFileInfo info;
s32 result;
NANDPrivateDelete("/tmp/cntcache.txt");
result = NANDPrivateCreate("/tmp/cntcache.txt", NAND_PERM_USER | NAND_PERM_GROUP, 0);
if (result != NAND_RESULT_OK) {
return result;
}
result = NANDPrivateOpen("/tmp/cntcache.txt", &info, NAND_ACCESS_WRITE);
if (result != NAND_RESULT_OK) {
return result;
}
if (NANDWrite(&info, buf, length) != length) {
result = CNTCACHE_RESULT_READ_ERROR;
}
NANDClose(&info);
if (result != NAND_RESULT_OK) {
return result;
}
return NANDPrivateMove("/tmp/cntcache.txt", "/shared2");
}
s32 CNTCACHEAddDeleteContent(ESTitleId titleId, const char* indices) {
char buf[CNTCACHE_READ_SIZE + CNTCACHE_LINE_SIZE] ALIGN32;
u32 length;
s32 result;
if (strlen(indices) > CNTCACHE_LINE_SIZE / 2) {
return NAND_RESULT_INVALID;
}
OSLockMutex(&_CNTCACHEMutex);
result = ReadCacheFile(buf, CNTCACHE_READ_SIZE, &length);
if (result == NAND_RESULT_OK) {
strcpy(buf + length, "DeleteContent ");
length += strlen(buf + length);
length += sprintf(buf + length, "%016llx ", titleId);
strcpy(buf + length, indices);
length += strlen(buf + length);
buf[length++] = '\n';
result = WriteCacheFile(buf, length);
}
OSUnlockMutex(&_CNTCACHEMutex);
return result;
}
static char* FindLineEnd(char* str, u32 length) {
u32 i;
for (i = 0; i < length; i++) {
if (*str == '\n') {
return str;
}
str++;
}
return NULL;
}
static inline s32 ExecuteCacheFile(NANDFileInfo* info, s32 result) {
u32 fileLength;
u8 buf[CNTCACHE_READ_SIZE] ALIGN32;
u32 lineLength;
char* line;
s32 readLength;
u32 offset;
char* lineEnd;
char* command;
if (result != NAND_RESULT_OK) {
return result;
}
result = NANDGetLength(info, &fileLength);
if (result != NAND_RESULT_OK) {
return result;
}
offset = 0;
while (fileLength != 0) {
readLength = fileLength;
if (readLength > sizeof(buf)) {
readLength = sizeof(buf);
}
line = (char*)buf;
if (NANDRead(info, buf, OSRoundUp32B(readLength)) != readLength) {
return CNTCACHE_RESULT_READ_ERROR;
}
result = NAND_RESULT_OK;
lineEnd = FindLineEnd(line, readLength);
if (!lineEnd) {
return NAND_RESULT_OK;
}
while (readLength > 0) {
*lineEnd = '\0';
lineLength = lineEnd - line;
command = strtok(line, " \n");
if (command) {
if (strcmp(command, "DeleteTitle") == 0) {
_CNTCACHEDeleteTitle();
} else if (strcmp(command, "DeleteContent") == 0) {
_CNTCACHEDeleteContent();
}
}
lineLength++;
line += lineLength;
fileLength -= lineLength;
readLength -= lineLength;
offset += lineLength;
lineEnd = FindLineEnd(line, readLength);
if (!lineEnd) {
break;
}
}
if (fileLength != 0) {
if (NANDSeek(info, offset, NAND_SEEK_BEG) != offset) {
return CNTCACHE_RESULT_READ_ERROR;
}
result = NAND_RESULT_OK;
}
}
return result;
}
s32 CNTCACHEClear(void) {
NANDFileInfo info;
BOOL opened = FALSE;
BOOL locked;
s32 result;
OSLockMutex(&_CNTCACHEMutex);
locked = TRUE;
result = NANDPrivateOpen("/shared2/cntcache.txt", &info, NAND_ACCESS_RW);
if (result == NAND_RESULT_NOEXISTS) {
result = NAND_RESULT_OK;
goto end;
}
result = ExecuteCacheFile(&info, result);
NANDClose(&info);
opened = FALSE;
if (NANDPrivateDelete("/shared2/cntcache.txt") != NAND_RESULT_OK) {
}
if (NANDPrivateDelete("/tmp/cntcache.txt") != NAND_RESULT_OK) {
}
end:
if (opened) {
NANDClose(&info);
}
if (locked) {
OSUnlockMutex(&_CNTCACHEMutex);
}
return result;
}
void _CNTCACHEDeleteTitle() {
char* token;
for (token = strtok(NULL, " \n"); token != NULL; token = strtok(NULL, " \n")) {
ESTitleId titleId;
int removable;
errno = 0;
titleId = strtoull(token, NULL, 16);
if (errno != 0 || (u32)ES_TITLE_TYPE(titleId) == 1) {
continue;
}
removable = _CNTCACHEIsTitleRemovable(titleId);
if (removable == 1) {
ES_DeleteTitle(titleId);
} else if (removable == 0) {
ES_DeleteTitleContent(titleId);
}
}
}

View File

@@ -0,0 +1,33 @@
# opus-fa attempts
## libs/RVL_SDK/src/fa/driver/sd_drv (23/26 -> 26/26, linked)
### pfd_sddrv_finalize (4 -> 0)
- Evidence for volatile: target reloads `flags` straight after testing it (`lwz; rlwinm.; beq; lwz` with no store in between) and keeps the final state stores in source order. The previous rounds faked the reloads with const-pointer accessors.
- Fix: `volatile PFD_SDDRV_INFO g_pfd_sddrv_info;` (definition-level, lever 19: the struct is written from the SD insert/remove interrupt callbacks). The fake accessors `pfd_sddrv_flags/device/disk/drive` are removed and the fields read directly. The removal callback loses its `media_inserted == 0 &&` re-check, which only existed to force a reload. Every other function stays exact.
### pfd_sddrv_init (142 -> 0)
- Explicit `return 0;` in the already-initialized branch: 142 -> 26. MWCC then turned `disk != info.disk ? -44 : 0` into a branchless select. The target branches instead.
- if/else/eq/goto spellings of the same return: still branchless (26).
- `#pragma ppc_iro_level 0` around the function (lever 26): 26 -> 1. Only the null test was left: target `li r0,0; cmplw r3,r0`.
- `disk == NULL` (NULL is `((void*)0)`) under IRO 0: 1 -> 0. Without IRO 0, NULL gives cmpwi.
- Diagnostic only: optimization_level 1/2/3 and iro 1/2 did not help.
### pfd_sddrv_build_fat32_mbr_bpb (122 -> 0)
- Target leaves an unreachable `bl OSReport` without its argument after the inlined reserved-sector writer, and has no null check of the buffer. A mini test shows this exact remnant comes from an inline helper with no null check that returns 0, compiled under IRO 0.
- The reserved-sector helper is now written like its sibling `pfd_sddrv_store_fat32_fsi_buf` (no null check, `return 0`). The only caller passes `g_pfd_sddrv_buf`, so behaviour is unchanged. With IRO 0 around build_fat32: 122 -> 2.
- Last 2: the first write loads the sector before the device. A local `partition_start_sector` like the FAT16 builder: 14. `+ 0`, casts: 2. Fix: `static inline s32 pfd_sddrv_write_sector(u32 sector)` wrapping `ISD_WriteBlock(device, sector, g_pfd_sddrv_buf, 1)`, so the argument is evaluated before the device load: 0.
### Link
- Flipped to Matching. The first DOL had `addi r27/r28` swapped in physical_read/write. The cause was `ATTRIBUTE_ALIGN(32)` on `g_pfd_sddrv_buf`, which changes codegen, so it was dropped.
- Without a 32-aligned .bss object, every `g_pfd_sddrv_info` access moved by 0x10. The fix is `ATTRIBUTE_ALIGN(32)` on `g_pfd_sddev` (the IPC device storage) and on `g_event` (the IPC event word, which the target places at .sbss+0x20).
- DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d OK.
## libs/RVL_SDK/src/fa/pdm_partition: pdm_part_is_master_boot_sector (start 84 in repo / 21 in opus-vf best -> best 19, not exact)
Remaining difference: the byte-load schedule of the inlined LE32 read. The target builds the tree (b2<<16 + b0) + (b3<<24 + b1<<8) and loads b3, b2, b0, b1. Ours loads b3, b2, b1, b0.
- mwdbg: our pre-RA scheduler already emits b1 before b0, so b1 has a higher priority. In the target, b1 shares b3's register, which proves its load comes after the b3 shift in the pre-RA order. So the target DAG or the initial order differs, and it is not a register tie.
- Mini-file study (/tmp/opus-fa/perm*.py): MWCC reassociates a 4-term add chain into pairs (L0+L2),(L1+L3) in source operand order. No permutation or parenthesization of the 4 terms gives the target pairing together with the target load order. All 120 tried in the real function: best 19 (e.g. `b1<<8 + b0 + b2<<16 + b3<<24`). Saved as opus-fa.best.pdm_partition.c.
- Unrolled byte loops (+=, |=, Horner): 43-69. Loads before the zero store: 73 (the zero store is DCE'd). Reusing a local for start/count: 21. Removing the zero store: 73. Count read first: 88.
- buf indexing instead of `buf += 16`: 90-91. Partition-entry pointer: 69.
- Helper boundaries (local for b0, u8/u32 parameter helper, two u16 halves, pointer to the field): 20-21.
- Pragmas (diagnostic): iro 0/1: 37 (25 with pointer loop 2, best 23 over all 120 sum shapes). scheduling off: 77. IRO is not the lever here.

View File

@@ -0,0 +1,96 @@
# opus-game attempts (worktree sol-high, base origin/main 77cf3598)
Units: iplCardSequence, odh, tiInputForm, tiCandidateBox. Diff counts are odiff.py (differing / total).
## tiCandidateBox
### create (278/356, size 0x590 vs 0x580) -> EXACT 0/352
Evidence: target addresses every pane-name string directly off the .data base
(r30+0x6a8, +0x6b4, +0x6c0, ...). Ours CSE'd `scPaneNameTable` and
`&scCandidatePaneData` into sub-bases (+0x28, +0x6b4). In the inlined
UIButton::Create the target holds both name args in saved registers instead of
rematerializing the address, which is how MWCC treats string-literal args.
1. Pass scroll/window names directly, no paneNames locals: 268/353.
2. Split scPaneNameTable into separate char arrays: 278/352 (equal size, sub-bases remain).
3. Names as string literals (B_OffBtn ... P_prdc_scrl_Rght): literals emitted after the
named globals, in the target's order; 287/354.
4. Also W_predictWindow, N_predictInput, W_OnOff_Area, N_prdc_Texts and the
"P_OffBtn" tail of scCandidatePaneData as literals: 0/352, .data bytes identical.
symbols.txt: scCandidatePaneData size 0x68C -> 0x680; scPaneNameTable and the four
named strings replaced by local literal labels at the same addresses. Total data
unchanged; unit data 100%; DOL SHA1 unchanged.
### createAnmPane_ (64/216)
mwdbg trace + regsim (127/127 reproduced). Named locals colored in reverse
declaration order; `animationCount` cannot reach r31 by order (regsim 0/1).
1. Loop bound `j < p.count` (count becomes a compiler temp -> r31): 86/216 but count now r31.
2. Declare forceAddName, i at top; p, pane in loop; j in for: 41/216. All named locals match;
left: animation-address temp r30 vs r23 and the hoisted constant temps shifted by one.
3. `p.pAnims[j]` at each use instead of the reference: 149/220 (reloads). Reverted.
4. forceAddName declared in the loop: 82/216. Reverted.
5. Pointer to slot `const AnimationFile* const* animation = &p.pAnims[j]`: 41 (no change). Reverted.
6. `animations = p.pAnims` hoisted, `animations[j]`: 86. Reverted.
Retrace after step 2: named locals all match; the only mismatch is the unnamed
animation-address temp (ours r30, target r23), numbered after the LICM constant temps.
Declaration order cannot move it. Kept steps 1-2 (64 -> 41) in the create commit.
## tiInputForm (best: opus-game.best.tiInputForm.diff, apply with patch -p0)
### create (153/356)
Register-blind diff showed one structural spot: target evaluates the
`getLanguageTextPane() ? textBox : "T_2l_TextBox"` name before loading mpLayout.
1. Name hoisted into a local before FindPaneByName: 153 (MWCC still loads mpLayout first).
2. Use the existing `selectInputTextName(*this, mpLanguageData)` helper (moved above create):
146/356, now register-only (register-blind diff identical). Unit still 219/221, data 100%.
3. Drop `count` local (loop bound `button.count`): 179, count not hoisted here. Reverted.
mwdbg + regsim on step 2: reproduces 138/138; best 7/10 wanted registers with named
locals only and 7/10 even with temps. Structural: target puts LICM constants (li 0, lis
vtable) in r20/r21/r31 between named locals. Not fixable by declaration order.
### calcCursorPos (43/326)
FPR tie plus scheduling. scale.x/scale.y FPRs swapped (ours x=f31, target x=f30); the
SRA'd fields are numbered by first use.
1. GetHeight() instead of bottom-top: 43 (no change).
2. Compute `right` before `lineBottom`: 41, scale FPRs match, but schedule order flips
(target computes the height product first) and fuzzy drops 93.05 -> 93.03. Not kept.
3. Named scaleX/scaleY locals: 235. Reverted.
## iplCardSequence (best: opus-game.best.iplCardSequence.diff, apply with patch -p0)
### loadCardFileIcons (436/512, 0x7f4 vs 0x800) -> best 406/512 (91.34% -> 93.34%)
Register-blind structural diff lines 41 -> 28.
1. `hasTlut = FALSE` initialized with the other counters before the speed loop: 419.
2. No-icon branch: store unk_0x01 before `iconImageSize = 0`: 408.
3. iconCount declared after the unk_0x02 store: 408 (struct 36).
4. `goto closeFile` -> `return result` (target's `bge; b epilogue` pairs, result stays in r3): 406, struct 28.
5. Tail `if (result < 0) return result;` instead of closeFile/closeFileSuccess labels: 406 (same, cleaner).
Tried without gain: iconCount u32/int, icon u32, `iconOffset[icon + 1]` (worse),
NONE-case spellings (array copy with [iconCount - 1], `(&...)[-1]`, `+ iconCount`, paletteSize after pointer).
Evidence for the rest: the target never sets paletteSize on the switch default path (r6 is
not initialized before the loop; default jumps straight to the iconCount < 7 test), so the
original read a stale paletteSize for format 3. Dropping the default assignment gives 404
and size 508, but that is an uninitialized read, so not kept. Remaining structure: NONE case
pointer formed as sThread + (iconCount + slot/file offset + 0x10000 - 0x6fb4), and
iconOffset[iconCount + 1] computed as ((iconCount + 1) << 2) without folding into +4.
### cardThreadMain (78/301)
mwdbg + regsim: reproduces 109/109; 9/9 wanted only with @-temps interleaved, 7/9 with
named locals only. One structural spot: the validity reply. Target copies command (mr r4, r19)
then rlwimi from validState (r25); ours coalesces the reply with command and inserts the
hoisted constant 1 (r29). PCode: `mr r72, r40; rlwimi r72, r71` with r71 the hoisted const;
r40 -> r72 coalesced because command dies there.
Tried: OR-expression reply (const-folds to ori 0x100: 261), mask-and-or (77), named
OSMessage local (78), validState BOOL/u8 (79/78), helper param u8/BOOL, command u8 (78).
## odh
### LineConv11 (12/146)
mwdbg + regsim: 77/77 reproduced; best 6/10 wanted (pixelSource r29, hi byte r8,
pixel r25, RGBA8 pointer r30) -> structural register tie. Plus lfs f7 / lis 0x4330 order.
Tried: split pointer add (15), &source[...] (12), operand order of the pointer sum (12),
pixel assembled from [0] first (12).
### huffmanDecoder (171/306)
Traced only. Target keeps sourceCursor in a volatile reg (r12) and bitOffset in r31; ours
the reverse, from the decomp's reuse of bitIndex/tableIndex/bitCountAndMask for several
values. Not attempted further this round.

View File

@@ -0,0 +1,36 @@
# opus-iro attempts
## Part A: function-scoped ppc_iro_level
| unit | function | before | change | after |
|------|----------|--------|--------|-------|
| sdChannelSelect/iplSDChannelSelect | create | 39/146 | `ppc_iro_level 0` around the function | 0/146 |
| sdChannelSelect/iplSDChannelSelect | flushSaveDataAndMountSD | 2/35 | `ppc_iro_level 0` | 0/35 |
| sdChannelTitle/iplSDChannelTitle | iplSDChannelTitle_flushSaveBeforeExit | 6/37 | `ppc_iro_level 0`; dropped the `saveHeap` temporary | 0/37 |
| setting/iplSetting | scanAP | 4/272 | `ppc_iro_level 1` (level 0 not exact per sweep); dropped `animationIndex` temporaries in cases 6/7 | 0/272 |
Other functions in each unit unchanged (per-function diff before/after). Pools identical.
- iplSetting: every function exact; flipped to Matching, full build DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d.
- iplSDChannelTitle: every .text function exact, but flipping to Matching breaks the DOL (0x40 shift).
Object .text is 0x4b48 vs target 0x48c0 and .data 0x65c vs 0x6a0, so the unit emits extra code and
misses data that objdiff's per-symbol view does not show. Left NonMatching.
- iplSDChannelSelect: 4 functions still non-exact; stays NonMatching.
## Part B: asm placeholders under ppc_iro_level
| function | candidate | default (3) | level 0 | level 1 | level 2 |
|----------|-----------|-------------|---------|---------|---------|
| Manager::doUpdateChanInfos | plain `mData.chanInfo[page][index]` form, `n` local | 62/68 | 7/67 | 7/67 | 66/71 |
| Manager::doUpdateChanInfos | swap `!=` operands | - | 7/67 | | |
| Manager::doUpdateChanInfos | inline `titleIds[index + page * 12]`, no `n` | - | 7/67 | | |
| Manager::doUpdateChanInfos | `int n` hoisted to function scope | - | 7/67 | | |
| Manager::doUpdateChanInfos | `ESTitleId* titleId = &titleIds[n]` | - | 7/67 | | |
| Manager::doUpdateChanInfos | `ESTitleId titleId = titleIds[n]` value local | - | 48/67 | | |
| Manager::doUpdateChanInfos | `ESTitleId titleId = ES_TITLE_ID(stored)` before `n` (same shape as makePriorTitleIDList) | - | **0/67** | | |
| Manager::hasChannel | rx30 has-00 (best C) | 14/71 | 29/71 | 29/71 | 29/71 |
| getTitleName | grok-title best C | 4/71 | 82/88 | 82/88 | 56/71 |
doUpdateChanInfos converted to C under `ppc_iro_level 0`; the remaining 7 register diffs came from the order the
stored title and the input title were evaluated. hasChannel and getTitleName have strength-reduced, hoisted
IRO-on codegen in the target (mtctr loop, hoisted name stride), so lowering IRO makes them worse; both stay asm.

View File

@@ -0,0 +1,41 @@
# opus-mwdbg: unblocking mwdbg for large C++ units, and regsim verdicts (base d9d33ca0)
These are tool changes only. No source file in this worktree was edited. The tool changes are in `_mwdbg` (see its README section "Emulator limits, sjiswrap, and the socket stub").
## Why mwdbg stopped (follow-up to opus-ties.attempts.md)
1. The 1 MB stack overflowed. The emulator now reads `RETROWIN32_MEMORY_MB` and `RETROWIN32_MIN_STACK_MB`, and mwdbg.py sets them to 1024 and 32 by default (`--memory-mb`, `--stack-mb`).
2. `ws2_32!send` was missing. I added a builtin ws2_32 that logs every call to `<capture>/socket.log`. With that log, the message turned out to be `(10430) system does not support converting from 'SHIFT-JIS', treating as ASCII`. Afterwards the compiler longjmps through an empty jmp_buf (`WRITE_UNMAPPED @40495a`, esp 0).
3. The cause of that message: mwdbg drops `wibo sjiswrap.exe` from the Ninja command, so the compiler read UTF-8 sources directly and could not convert them. retrowin32 now emulates sjiswrap when `RETROWIN32_SJISWRAP=1`, and mwdbg.py turns it on automatically when the Ninja command uses sjiswrap. The emulation re-encodes source files to Shift JIS, makes `GetACP` return 932, has `IsValidCodePage(932)` succeed, and decodes code pages 0 and 932 in MultiByteToWideChar.
4. Then iplESMisc failed with `(10151) the file 'nw4r/lyt/textbox.h' cannot be opened`. The file on disk is `textBox.h`, and wibo matches paths case-insensitively. retrowin32 now falls back to a case-insensitive match when the exact path is missing.
5. regsim reproduced the iplESMisc capture only 157/161. The capture needed a second pass with a spill candidate, and regsim picked the spill node by maximum degree. MWCC picks by minimum `cost/degree`, with ties going to the later node in scan order. After fixing that, the capture reproduces 161/161, and `examples/pressure` goes from 108/126 to 126/126. None of the other 76 stored runs changed.
## Validation (data-d4, build/43U objects rebuilt before comparing)
| capture | regsim | unit.o vs ninja object |
|---|---|---|
| kbd_lib / kbdProcMod | 156/156 | identical (sha256 6a85c207…) |
| iplESMisc / DeleteUnauthorizedData__Q33ipl7utility6ESMiscFPQ23EGG4Heap | 161/161 (2 GPR passes) | identical (8a31efdb…) |
| tiZiString / update__Q39textinput8tistring6WithZiFv | 161/161 | identical (da68c526…) |
| www_wiisetting / Getter___Q23www10wiisettingFP14WWWJSPluginObjPCcP16WWWJSPluginValue | 312/312 | identical (ff8f136d…) |
## Verdicts
Method: `_mwdbg/scratch_opusmwdbg/vmap2.py` builds the want-list. It aligns the scheduled PCode with our object using difflib, because opus-ties.vmap.py's index alignment drifted and left 210 operand mismatches on tiZiString. Each want is keyed by virtual number, since names such as `candidate`, `output` and `i` repeat. A virtual is kept when at least 75% of its uses agree on one target register. `_mwdbg/scratch_opusmwdbg/regsim_locals.py` then anneals over the numbering of real source locals only, leaving `@` temps, parameters and unnamed values in place. For www_wiisetting I enumerated every ordering of its 8 locals instead.
| function | wants | as built | best with source locals reordered | best with `@` values reordered too | verdict |
|---|---|---|---|---|---|
| DeleteUnauthorizedData | 64 | 54 | 60 | 64 | structural |
| WithZi::update | 98 | 83 | 92 | 98 | structural (callee-saved part fixable by order) |
| wiisetting::Getter_ | 159 | 156 | 156 (exhaustive, 8! orders) | not needed | structural |
- **DeleteUnauthorizedData** is `return InitSavedata(heap);`. Every mismatched value is a local of an inlined function, which is why they all have `@` names.
- InitSavedata: v33 `titleIds`, v34 `ret`, v35 `ticketScratch`, v36 `i`.
- verifySavedataZD: v37/38 `titleId` parameter (hi/lo), v39/40 `block`, v41 `valid`, v42 `j`, v43 `offset`, v44 `deleteSaveData`, v45 `fileOpen`, v46 `saveData`, v47 `ret`.
- DeleteTicketsForce: v49/50 `titleId`, v51 `j`, v52 `ret`, v53 `ticketViewList`.
Reordering locals inside each inlinee reaches 60/64. That search was exhaustive over InitSavedata × DeleteTicketsForce and annealed over verifySavedataZD. The four misses are `titleId` v37/v38 (wants r19/r20) against `saveData`/`deleteSaveData` (want r30/r31). Reaching 64/64 requires numbering the inlined `titleId` parameter after verifySavedataZD's locals, and declaration order can't do that. A possible lever, still untested: copy `titleId` into a local in verifySavedataZD that is declared last, or change how titleId is passed.
- **WithZi::update**: reordering locals fixes the 9 callee-saved mismatches (index, destination, source, length v44, count, elementCount, v64, v70, v175). The order regsim found, lowest number first: index, character, length(v37), position, keyIndex, source, copied, wordLength, elementCount, count, candidate(v34), output(v38), candidate(v47), length(v44), destination, candidateOutput, output(v49), output(v36). It is untested and may conflict with nested scopes.
Six volatile-register misses remain: copied r4→r5, wordLength r7→r4, @1343 r6→r7, @1338 r5→r4, @1330 r5→r6, v148 r5→r4. @1343/@1341, @1338/@1336 and @1349 are the induction pointers of the 8-way unrolled copy loop, and @1330 is `length-8`. All of these are optimizer temps. They reach 98/98 only when the temps are renumbered, so this is structural, and it needs a loop shape that makes the unroller create its temps in a different order.
- **wiisetting::Getter_**: no ordering of the 8 locals (str, val, i ×3, kbLang, staIdx, retVal) improves on 156/159. The misses are `i`(v35) r25→r31, `i`(v38) r25→r26 and temp `@17419`(v42) r26→r25. This confirms opus-ties' result that swapping `strBuf`/`i` changes nothing, so the function is structural.

View File

@@ -0,0 +1,41 @@
# opus-novt: per-TU novtable switches
Method: full `ninja`, then SHA1 of all 1027 `build/43U/src/**/*.o` compared with a
baseline from origin/main ca98b14a, plus the DOL SHA1. A variant is kept only if
no object changes.
| # | Change | Result |
|---|--------|--------|
| 1 | `LangFile`/`LayoutFile`: out-of-line virtuals for everyone | iplChannelTitle.o, iplSDChannelTitle.o change, DOL changes. Both TUs need weak copies of `~LangFile` (88), `read` (4), `checkData` (8), `isFinished` (8), `isFatalError` (8), `~LayoutFile` (92) and weak `__vt__LangFile`/`__vt__LayoutFile`. |
| 2 | `LangFile`/`LayoutFile`: inline stub virtuals for everyone | iplNand.cpp fails (redefinition of the real bodies); 46 other objects gain weak copies. |
| 3 | `MemoryBase`: drop the `IPL_CHANNEL_TITLE_NOVTABLE` novtable switch | no object changes. **Kept.** |
| 4 | primary `HermiteIntp` under the macro: drop `__declspec(novtable)` | no object changes. **Kept.** |
| 5 | `HermiteIntp` macro block disabled for everyone (`#if 0`) | iplChannelTitle.o, iplSDChannelTitle.o change. |
| 6 | `HermiteIntp` macro block enabled for everyone (`#if 1`) | ~50 objects change. |
| 7 | `gui::Interface` novtable for everyone | ~20 objects change (saveDataEdit, sdButton, setting, dialog window, ...). |
| 8 | `gui::Interface` never novtable | iplGCSaveData.o, iplMemoryCard.o gain an unused UNDEF `__vt__Q23gui9Interface` (code/data bytes same). |
| 9 | `~gui::Interface` always inline | iplGCSaveData.o, iplMemoryCard.o gain a weak 64-byte `~Interface`. |
| 10 | `gui::EventHandler` never novtable | iplGCSaveData.o, iplGCWindow.o, iplMemoryCard.o change, DOL changes. |
| 11 | `gui::EventHandler` always novtable | ~20 objects change. |
| 12 | `ipl::gui::PaneManager` dtor always inline | iplGCSaveData.o, iplMemoryCard.o change, DOL changes. |
| 13 | `MemCardEventListener`: drop its (already unconditional) novtable | iplGCWindow.o changes. Already consistent; left as is. |
## Result
Removed the two dead pieces (3, 4). All 1027 objects and the DOL are unchanged.
Switches that stay, and why:
- `IPL_CHANNEL_TITLE_NOVTABLE` in `iplNand.h`: the channel-title TUs must emit
weak stub copies of the `LangFile`/`LayoutFile` virtuals, which have real
out-of-line bodies in iplNand.cpp. No single declaration gives both (1, 2).
The macro no longer adds any `novtable`; its name is historical.
- `IPL_CHANNEL_TITLE_NOVTABLE` in `iplInterporation.h`: it selects a different
`HermiteIntp` primary template (FrameController base, out-of-line `init`,
`HermiteIntp<f32>` specialization, `dont_instantiate`). The same header also
has `IPL_CHANNEL_SELECT_CPP` / `IPL_SD_CHANNEL_SELECT_CPP` /
`IPL_SD_CHANNEL_TITLE_CPP` variants, so untangling it is a separate job (5, 6).
- `IPL_GC_SAVEDATA_NOVTABLE` / `IPL_MEMORY_CARD_NOVTABLE` / `IPL_GC_WINDOW_NOVTABLE`
in `GUIManager.h` and `iplGuiManager.h`: the memory-card TUs need novtable
`Interface`/`EventHandler` and out-of-line `~Interface`/`~PaneManager`, while
every other GUI user needs the opposite (7-12).

View File

@@ -0,0 +1,116 @@
# opus-ph attempts
Branch agent/w1008/data-d3-c. Measure: `odiff.py <unit> <symbol>` differing count.
## TMCJPEGDEC_err_restart
Start: rx5b finishRestart candidate (114/115 insns, odiff 73 differing because of the 1-insn shift).
Key finding: mwdbg backend-00 shows the marker test is already folded (`bt gt -> loop`) in the
initial PCode, so the target's `ble found; b loop` is decided before the backend. In matched
code (`__OSInitNet`) the same unfolded shape comes from `if (a || b) return;`, i.e. a jump the
IR folder does not treat as a goto.
- v0 rx5b baseline: 73/115 (114 insns).
- A `if (m>=D0 && m<=D7) break;` + finish after loop: 73.
- B `if (m>=D0 && m<=D7) return finish;`: 73.
- C `if (m<D0 || m>D7) continue; return finish;`: 73.
- E nested `if (m>=D0) { if (m<=D7) return finish; }`: 73.
- H `goto found` after loop: 73.
- I empty-then / else return: 73.
- D1 `{ result = 0; continue; }`: 73. D2 else-arm assignment: 73. D3 continue/else break: 73.
- W1 do/while(byte<D0||byte>D7) using byte: 73. W2 byte instead of marker: 73.
- W3 marker as loop-carried while condition: 98/118.
- E1 else-if chain: 73. E2 inverted D9 test: 81. E3 inverted D9 inner test + break: 76.
- G1 `goto retry` label before inner while: 73.
- P1/P2/P3 isRestartMarker inline predicate (3 shapes x 2 uses): 76-78, 118-119 insns.
- S1 `switch (marker) { case 0xD0..0xD7: return finish; }`: 21/115, size equal. Switch
lowering emits the unfolded `bge case; b default`, but as signed `cmpwi d8; bge; cmpwi d0`
instead of target `cmplwi d0; blt; cmplwi d7; ble; b`. Marker lands in r4 not r6.
- S2 switch on (u32): 21. S3 default: continue: 21. S4 default: break: 21.
- S5/S6/S7 marker as u32/s32/u16 with switch: 21 (switch compares stay signed).
Result: not exact. Best is S1 (equal size, 21 differing). Remaining: switch compares are signed
and use a different tree (hi+1 then lo); marker gets r4 instead of r6, which shifts the finish
block's temporaries. Next lever: a construct whose jump the IR folder leaves alone (like the
`return` in `__OSInitNet`) but keeps the unsigned `cmplwi d0 / blt / cmplwi d7 / ble` order.
## getUnScrambleId
Start: rx30 id-08 (loop + inline helpers). That source is now auto-inlined into both C callers
(target keeps it out of line), so loop forms are out; the function must be written unrolled.
Metric below is (insns, exact positional, opcode positional) out of 161.
- u1 unrolled inline get/set/unscramble helpers: 156 differing.
- m1 macros GET_BYTE/SET_BYTE/UNSCRAMBLE, lazy permutation: 159 differing; multiset differs
only by two rlwimi shift-combines (b2/b3 read from rotated hi in target).
- x1 read all six bytes into b0..b5 first, then set: 111 differing.
- x1 extraction orders (4) / declaration order: 111-112.
- xf/xg `(x >> 1) | ((x & 1) << 52)` rotation: b2/b3 match but b1/b4/b5 stop combining; 113.
- greedy over GET/SET/UNSCRAMBLE/rotation/mask/permutation/substitution/final forms (24 builds):
best r2 (`mixId |= (mixId & 1) << 53; mixId >>= 1;`) + t2 (substitution via `b` temp): 69.
- p3 copy + `b = GET_BYTE(copy, k); mixId = SET_BYTE(mixId, i, b);`: 68 (prologue and rotation
now exact; b3 combine matches).
- greedy from p3 over all dims + declaration orders (≈30 builds): no gain.
- SET split into &=/|= (3 variants): 162-166 insns. inline get/set helpers: 161-163, ≤93 exact.
- b as u32/int/u16/s32: 164-175 insns. GET without cast / const shift / u64 cast: unchanged.
- SET mask spellings, (u8) value cast, assignment-macro, block-scoped/const copy: unchanged.
- per-pair inline GET in SET for subsets of the six moves: worse.
- distinct b0..b5 lazily: 156. separate perm/subst temps: 163 insns.
- 160 spellings of the mask/xor/rotate statements: all identical (IR canonicalizes).
Finding: mwdbg backend-00 shows MWCC splits this straight-line function into ~100-instruction
blocks at statement ends (B1 ends after `b = GET_BYTE(copy, 2)` at 103; before it 97). Combines
and scheduling are block-local. The target splits one statement earlier (b2/b3 both read the
uncombined rotated hi), so the original has 1-6 more initial PCode instructions before set 3.
No natural spelling found that adds them without changing final code.
Best: 161/161, 68 differing (93 exact positional), saved in opus-ph.best.c.
## Round 2 (higher effort)
### getUnScrambleId: exact
- u1 substitution as a `for (i = 0; i < 6; i++)` loop over GET/SET: 68 (identical to the unrolled form;
MWCC fully unrolls it, so loop source is fine as long as the function stays out of line).
- final step spellings: `return (rot) ^ B3` 61 (tail exact), operand swap 67, copy temp 68, split 80.
- copies/temps at the start (id_direct, copyfirst, idcopy, block-scoped inst temp): 68, IR propagates them.
- inline u8 getByte for the permutation only: 156 (different prologue allocation).
- permutation statement orders (source order, reversed): 148-159.
- prior art: `gh search code getUnScrambleId` found SMGCommunity/Petari src/RVL_SDK/nwc24/NWC24UserId.c
(same SDK, same 0x284 size in SMG). Its shape: static `getbyte`/`setbyte` helpers (auto-inlined), a
`static const u8 ExcTable[8] = {1, 5, 0, 4, 2, 3, 6, 7}` permutation table read in a `u8 i` loop,
a second loop for the TtableInv substitution, rotation spelled `v |= (((v & 0xFF) << 5) & 0x20) << 48`.
Compiled as is: 0/161. Unrolling the ExcTable loop by hand gives 159/163, so the table loop is what
shapes the PCode blocks. ExcTable lands in .sdata2 of the object (constant-folded after unrolling,
never referenced) and the linker dead-strips it: main.dol SHA1 unchanged, gate data 16/16.
- Final: renamed to repo style (getByte/setByte/copy/id), still 0/161; NWC24CheckUserId and
NWC24iCheckUserIdCRC stay 0. gate.py --quick: GATE PASS.
### TMCJPEGDEC_err_restart: not exact (best stays S1, 21/115, equal size)
Standalone harness (/tmp, same flags, `-ipa file`) to test the range-test shape. Target wants
`cmplwi d0; blt test; cmplwi d7; ble F; b test` (unsigned, unfolded).
- switch lowering is always signed and hi-first (`cmpwi hi+1; bge def; cmpwi lo; bge case; b def`),
for u8, u32, `unsigned long`, `(u32)` casts, `m - 0xD0` with cases 0..7, `(u8)(m - 0xD0)`, and even
case values >= 0x80000000. So the target is not a switch.
- if-forms all fold to `bgt test` (≈45 shapes): &&/|| in either direction, continue/break/goto
found/goto label, do-while with `||` or `!(&&)`, else-if chains, nested ifs, empty then, else
continue, flag loops (`found`, `keepGoing` style as in parse_para), ternary conditions,
`(u32)(m - 0xD0) <= 7`, `(m & 0xF8) == 0xD0`, the whole loop inside a static inline.
- `{ r = 0; continue; }`, `{ m = 0; continue; }`, `{ nop(); continue; }`, `{ (void)0; continue; }`:
still folded (IR removes the dead statement before folding).
- IRO 0 around the function (levers.md 26): no change (21 / 73). Target shows no IRO-off symptoms.
- inline predicates with `return` (`if (m < D0 || m > D7) return 0; return 1;`) give the unfolded
`ble` but materialize a bool (`li r0,0/1; cmpwi; beq`) that the target lacks.
- Scan of all compiled C objects: unfolded backward `bc +8; b back` appears only in switch lowering
(NHTTP) and inline-function exits (VF Advance/MoveTo); in retail, err_restart is the only
`cmplwi lo; blt; cmplwi hi; ble +8; b back` in the DOL.
- Mechanism found (t13): a then-arm with a surviving non-jump statement, e.g.
`if (m < 0xD0 || m > 0xD7) { last = r; continue; }`, gives exactly `blt X; cmplwi d7; ble F;
X: mr; b top`. The target matches this if that statement is a register copy that coalesces away
after the IR fold (same as tolower's empty ternary arm in MSL stricmp). No natural loop-carried
register variable exists in this function to carry such a copy (byte is address-taken, result/
marker are dead on that path), so not adopted.
- upstream koopthekoopa C (read-only) is the same nonmatching shape as our #else branch.
Next lever: find what loop-carried value the original kept in a register on the "other marker" path
(the copy that vanished), e.g. a marker/previous-marker variable or a result carried to the EOI return.

View File

@@ -0,0 +1,143 @@
/* opus-ph best C. Not exact; the retail asm stays in the source. */
/* libs/RevoEX/src/nwc24/NWC24UserId.c getUnScrambleId: 161/161 insns, odiff 68 differing (prior best 97). */
#define GET_BYTE(id, n) ((u8)((id) >> ((n) * 8)))
#define SET_BYTE(id, n, b) (((id) & ~((u64)0xFF << ((n) * 8))) | ((u64)(b) << ((n) * 8)))
#define UNSCRAMBLE(b) ((u8)((TtableInv[(b) >> 4] << 4) | TtableInv[(b) & 0xF]))
static NWC24UserId getUnScrambleId(NWC24UserId id) {
u64 mixId;
u64 copy;
u8 b;
mixId = id;
mixId &= 0x001FFFFFFFFFFFFFULL;
mixId ^= 0x00005E5E5E5E5E5EULL;
mixId &= 0x001FFFFFFFFFFFFFULL;
mixId |= (mixId & 1) << 53;
mixId >>= 1;
copy = mixId;
b = GET_BYTE(copy, 1);
mixId = SET_BYTE(mixId, 0, b);
b = GET_BYTE(copy, 5);
mixId = SET_BYTE(mixId, 1, b);
b = GET_BYTE(copy, 0);
mixId = SET_BYTE(mixId, 2, b);
b = GET_BYTE(copy, 4);
mixId = SET_BYTE(mixId, 3, b);
b = GET_BYTE(copy, 2);
mixId = SET_BYTE(mixId, 4, b);
b = GET_BYTE(copy, 3);
mixId = SET_BYTE(mixId, 5, b);
b = GET_BYTE(mixId, 0);
mixId = SET_BYTE(mixId, 0, UNSCRAMBLE(b));
b = GET_BYTE(mixId, 1);
mixId = SET_BYTE(mixId, 1, UNSCRAMBLE(b));
b = GET_BYTE(mixId, 2);
mixId = SET_BYTE(mixId, 2, UNSCRAMBLE(b));
b = GET_BYTE(mixId, 3);
mixId = SET_BYTE(mixId, 3, UNSCRAMBLE(b));
b = GET_BYTE(mixId, 4);
mixId = SET_BYTE(mixId, 4, UNSCRAMBLE(b));
b = GET_BYTE(mixId, 5);
mixId = SET_BYTE(mixId, 5, UNSCRAMBLE(b));
mixId = ((mixId & 0x7FFFFFFFFFFULL) << 10) | ((mixId >> 43) & 0x3FF);
mixId ^= 0x0000B3B3B3B3B3B3ULL;
return mixId;
}
/* libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main.c TMCJPEGDEC_err_restart: 115/115 insns, odiff 21 differing (prior 114/115). */
static inline s32 finishRestart(TMCCJPEGDecWork* work, TMCCJPEGDecState* state, u8 marker) {
u8 restartDistance;
s32 result;
s32 next;
u8 skipped;
s32 quotient;
s32 remainder;
u16 y;
u16 x;
u16 pitch;
u16 interval;
u32 position;
restartDistance = marker + 8 - (work->rstMarkerIdx + 0xCF);
if (marker > work->rstMarkerIdx + 0xCF) {
restartDistance = marker - (work->rstMarkerIdx + 0xCF);
}
pitch = state->maxX;
interval = work->restartInterval;
skipped = restartDistance * interval;
work->rstMarkerIdx = (marker + 1) & 7;
position = work->mcuPos;
next = (u8)position * pitch + (skipped + (position >> 16));
quotient = next / pitch;
remainder = next - quotient * pitch;
y = quotient;
work->mcuPos = ((u32)remainder << 16) + y;
x = remainder;
work->components.dcPredict[0] = 0;
work->components.dcPredict[1] = 0;
work->components.dcPredict[2] = 0;
work->components.dcPredict[3] = 0;
work->restartCnt = 0;
result = TMCJPEGDEC_init_buff(work);
if (result < 0) {
return result;
}
state->posX = x;
state->posY = y;
state->position = TMCJPEGDEC_get_position(work);
return state->result - state->posY * state->maxX - state->posX;
}
s32 TMCJPEGDEC_err_restart(TMCCJPEGDecWork* work) {
u8 byte;
TMCCJPEGDecState* state;
s32 result;
u8 marker;
state = work->pState;
if (work->scanCount == 1) {
state->decodeResult = 0;
return 0;
}
result = TMCJPEGDEC_rewind_ptr(work);
if (result < 0) {
return result;
}
byte = *work->pBufCur;
for (;;) {
while (byte != 0xFF) {
result = TMCJPEGDEC_get_byte(&byte, work);
if (result < 0) {
return result;
}
}
result = TMCJPEGDEC_get_byte(&byte, work);
marker = byte;
if (marker == 0xD9) {
if (result < 0 && result != TMCC_ERROR_UNDERFLOW) {
return result;
}
return 0;
}
if (result < 0) {
return result;
}
switch (marker) {
case 0xD0:
case 0xD1:
case 0xD2:
case 0xD3:
case 0xD4:
case 0xD5:
case 0xD6:
case 0xD7:
return finishRestart(work, state, marker);
}
}
}

View File

@@ -0,0 +1,47 @@
# opus-prior: makePriorTitleIDList__Q33ipl8savedata7ManagerFPUxPUxUl
Start: opus-sdm best (p1 below), 96 differing / 133, 122 instructions.
Measured with odiff (differing / total). Harness spliced each trial over the asm block.
## Cause
The target is exactly MWCC's code with IRO (the front-end optimizer) disabled for this function.
No CSE of `&titleIdsIn[i]` / `&titleIdsOut[outputIndex]`, no LICM of `outputIndex << 3`, and the
backend alone strength-reduces and hoists the constants. That's why every C spelling caches the addresses.
| # | Change | odiff |
|---|---|---|
| p1 | opus-sdm best | 96 |
| h1 | `*&titleId` in isEqualChannel | 96 |
| h2 | assign through pointer helper | 97 |
| h3 | titleId written through a local pointer | 96 |
| b | match handled by switch (-2/0, 1) | 95 |
| a | goto instead of continue | 96 |
| d1 | diag `#pragma opt_common_subs off` | 64 |
| d2 | diag `#pragma opt_loop_invariants off` | 120 |
| d3 | diag both | 24 |
| d4 | diag `#pragma global_optimizer off` | 148/150 |
| d5 | diag `#pragma ppc_iro_level 0` (or 1) | 24, 133 insns, register names only |
| t1 | diag statement `asm { nop }` in body (IRO DisableDueToAsm) | same shape as d5 + nop |
| q1 | d5 + outputIndex declared before titleId | 10 |
| **q2** | d5 + `int outputIndex;` at function top, assigned per slot | **0 (exact)** |
| s1 | no pragma, function-local static | 116 |
| s2 | no pragma, try/catch | build error (exceptions off) |
| s3 | no pragma, inlined nw4r::math::FAbs (asm inline) | 119 |
## Result
Exact only with `#pragma push / #pragma ppc_iro_level 0 / #pragma pop` around the function (q2, saved in
opus-prior.best.cpp). The brief forbids `#pragma`, so this is not landed. Upstream uses the same pragma for
the same symptom (`// uhh` before iplChannelManager.cpp loadMetaHeaderAsync, iplUtility.cpp
BScroller::set_arw_param; koopthekoopa ff68d54a / 25f93e26). No natural construct found that disables IRO
(MWCC disables it for functions containing an asm statement; none fits here). Orchestrator call: allow the
upstream-precedent pragma for this function, or park it.
## Round 2 (landing)
Orchestrator accepted the function-scoped `ppc_iro_level 0` push/pop as an exception (same convention as
iplChannelManager.cpp, iplUtility.cpp, iplBoard.cpp, iplChannelTitle.cpp). q2 replaces the asm placeholder;
odiff 0 / 133, size 0x214 both; all 35 functions in the unit 0 differing; pool identical. Inventory row
removed (checker flagged it stale once the asm was gone); header counts 171/173/162/9. opus-prior.best.cpp
deleted as obsolete. Gate: only forbidden pattern is the pragma (push, ppc_iro_level 0, pop).

View File

@@ -0,0 +1,37 @@
# opus-sdcs: iplSDChannelSelect collectTitles* (2026-10-08)
Start: ByUsage 4/101, FromNandUsage 4/102, ByChannelOrder 7/126, BySpecialChannels 16/361.
Shared diff: `lwz secondUsage[0]` scheduled above `stw ++*titleCount` in ours, after it in target.
- `*titleCount += 1`, `(*titleCount)++`, `titleCount[0]++`, `= *titleCount + 1`: no change (4).
- `!(a < b || c < d)`, nested ifs: no change. static inline usage predicate: 40 diffs.
- function-scoped IRO 0 / IRO 1: no change.
- casts `(s32*)secondUsage`, `const_cast`, `(s32*)(u32)`, local non-const copy (also under IRO 0): no change.
- mwdbg on a standalone repro: the load is hoisted before regalloc; loads through a pointer-to-const
PARAMETER are treated as unaffected by any store (casts do not remove it). Only a non-const
`s32*` parameter keeps source order: repro then matched the target byte for byte.
- The `PClPClPUxPcPUl` mangling was decomp-assigned (symbols.txt names were invented), so the
params become `s32*` and the 5 symbols are renamed to `FPlPlPUxPcPUl`.
=> ByUsage 0, FromNandUsage 0, BySpecialChannels 0, ByChannelOrder 3.
ByChannelOrder residual: `mulli r0/add r3,r17,r3` vs target `mulli r4/add r0,r17,r3`.
- if/else vs ternary, `getChannel`, `hasLoadedBnr`, row pointer, ref/ptr locals, idx/manager locals
in either order, inverted branch: 3-8 diffs.
- regsim: declaration order cannot reach (0/2), IRO temps @162/@164 for mgr/sum get low vreg numbers.
- inline Manager member with getTitleID's body (`getEntryTitleID(page, channelOrder[order])`): exact.
Result: 129/129 exact, gate PASS.
## Link (configure.py -> Matching)
First link: DOL SHA1 798af348..., .data 0x20 short and two swapped calls.
- objdiff missed that `draw` calls `ipl::math::VEC3(f,f,f)` and `getChannelPanePosition` calls
`nw4r::math::VEC3(f,f,f)`, because the two weak bodies are identical. Fixed the local in draw
and made getChannelPanePosition return `nw4r::math::VEC3` (NRVO builds it in the return slot,
and callers only read .x/.y).
- Target .data has 0x20 zero bytes (deduped weak vtables) before the anonymous handler vtables.
iplChannelSelect emits `HermiteIntp<VEC3>` and `Interporation<VEC3>` weak vtables at the same
spot. Dropped the SD-only full `HermiteIntp<VEC3>` specialization in iplInterporation.h so the
generic template (with the SD `get()` already there) is used: .data 0xab0, as in the target.
- Removing the unreferenced handleDeleteComplete/handleStorageCheckComplete: no DOL change (they
get dead-stripped), so I reverted it.
Result: DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d, gate PASS, linked code 33828.

View File

@@ -0,0 +1,6 @@
# opus-sdct: link iplSDChannelTitle
Target .data is 0x6a0 with 0xd8 zero bytes after the SDChannelTitle vtable (deduped weak vtables); built emitted 0x94 (PaneManager, EventHandler, Interface). Text extras are weak and get deduped, so they're fine.
1. Dropped IPL_CHANNEL_TITLE_NOVTABLE entirely: adds HermiteIntp<f>/Interporation<f> weak vtables, data 0x67c, text/sdata2 grow. Rejected (HermiteIntp<f> vtable is global elsewhere; Interporation<f> never exists in the DOL).
2. Kept IPL_CHANNEL_TITLE_NOVTABLE defined across iplSDChannelTitle.h too (same as iplChannelTitle.cpp does), so the inline LangFile/LayoutFile path from iplNand.h is used: adds LayoutFile + LangFile weak vtables (0x40), data 0x69c = target content. 69/69 exact, flip to Matching, DOL SHA1 OK, gate PASS.

View File

@@ -0,0 +1,61 @@
# opus-sdm: iplSaveDataManager asm -> C
Branch agent/w1008/data-d6-b, base a3f8fc27. Scored with odiff (differing / total) and objdiff fuzzy.
Pool identical (3/3) for every compiled trial. doUpdateChanInfos untouched. Best text: opus-sdm.best.cpp.
## hasChannel__Q33ipl8savedata7ManagerCFUxPiPi (start 14 diffs / 98.87%)
| # | Change | odiff |
|---|---|---|
| h1 | channel::Manager::hasChannel shape on mData.chanInfo, for/for loops, TITLE_REGION test | 54 |
| h2 | `(u8)titleId == 'A'` region test | 62 |
| h3 | h1 with outer do/while page loop | 54 |
| h40 | h3 + `(ESTitleId)(u8)titleId == TITLE_REGION_ALL` | 47 |
| h41-43 | u8 / u64 / casted constant spellings of the region test | 62 / 47 / 47 |
| h50 | `TITLE_NO_REGION(tId & mask) == TITLE_NO_REGION(titleId & mask)` | 53 |
| h51 | code mask inlined in the comparison | 47 |
| **h52** | code mask `titleCode` declared inside the primaryType block (stops the titleId & titleCode hoist) | **12 (99.014%)** |
| h6a | h52 with for page loop | 16 |
| h6b | mask via if/else (!= 0 first) | 12 |
| h6c | mask via if/else (== 0 first): swaps full/code mask registers | 13 |
| h6d | ternary == 0 first | 13 |
| h6e | `titleCodeRegion & ~0xFFULL` | 12 |
| h6f | no titleCode local | 47 |
| h6g | page declared then assigned | 12 |
| h7b1-b5 | const titleCode, function-scope titleCode, after tId, top of index loop, const full mask | 12 each |
| h7c1-c4 | same four on the == 0 if/else | 13 each |
| h8t/i0-6 | ternary and if/else for: bare ES_TITLE_TYPE, !type, >>32, & hi mask !=/== 0, > / <= 0xFFFFFFFF | 12-70 |
| h9r/p | slot reference / pointer | 59 |
| h9d | inner do/while | 61 |
| h9x | index declared at top | 19 |
| h9q | while page loop | 16 |
| hAt/u | tId declared at function / page scope | 22 / 18 |
| hAv | full mask declared after page | 18 |
| hAw | `continue` on non-channel slot | 12 |
| hB1-6 | operand order of both comparisons | 12 / 16 |
Stuck at 12: full mask lo/hi in r9/r0 (target r10/r9), mask constants r10/r4 (target r4/r0), row base r10 (target r0).
The == 0 if/else puts row base on r0 but then gives the full mask r12/r11 and the code mask r10/r9 (reversed).
Kept asm.
## makePriorTitleIDList__Q33ipl8savedata7ManagerFPUxPUxUl (start 80.2%, 124/133)
| # | Change | odiff |
|---|---|---|
| p1 | page/index loops, outputIndex local, u32 input loop with continue, photo replacement nested if | 96 (75.53%, 122/133) |
| pda1 | da1 prior-4 text, for reference | 118 |
| p2 | nested if instead of continue | 96 |
| p3 | output index expression at each use | 123 (spills) |
| p4 | int input counter | 96 |
| p5 | inline isNullTitle(const ESTitleId&) helper | 97 |
| p6 | `!x` / `x` null tests | 96 |
| p7 | outputIndex computed after the input null check | 118 |
| p8 | while input loop | 105 |
| p9 | output title read into a local | 96 |
| pa | photo replacement as static inline helper | 115 |
| pb | TITLE_NO_REGION repeated per comparison | 96 |
| pc | photo test and mPhotoId test in one condition | 96 |
Blocker: the target never CSEs &titleIdsIn[i] or &titleIdsOut[outputIndex] (recomputes add/slwi at every use, even
inside one block) and reloads titleIdsIn[i] for isEqualChannel, while hoisting -0x100 and 0x48410000 into r14/r26.
Every C spelling tried caches both addresses and leaves -0x100 unhoisted, so 122 vs 133 instructions. Kept asm.

View File

@@ -0,0 +1,73 @@
// opus-sdm best C for src/system/iplSaveDataManager.cpp (not exact; the asm placeholders stay in the source).
// Drop each body in place of its asm block.
// Manager::hasChannel: odiff 12 differing / 71, objdiff 99.014084%, 71/71 instructions, pool identical.
// Remaining: the full mask gets r9/r0 (target r10/r9), the 0xFFFFFFFFFFFFFF00 halves get r10/r4 (target r4/r0),
// and the row base gets r10 (target r0). Code-only mask in r12/r11 matches.
ESTitleId Manager::hasChannel(ESTitleId titleId, int* outIndex, int* outPage) const {
ESTitleId titleCodeRegion = ES_TITLE_TYPE(titleId) != 0 ? 0xFFFFFFFFFFFFFFFF : 0x00000000FFFFFFFF;
int page = 0;
do {
for (int index = 0; index < MAX_CHANNEL_INDEX; index++) {
if (mData.chanInfo[page][index].primaryType == channel::PRIMARY_TYPE_CHANNEL) {
ESTitleId titleCode = TITLE_NO_REGION(titleCodeRegion);
ESTitleId tId = ES_TITLE_ID(mData.chanInfo[page][index].titleType, mData.chanInfo[page][index].titleCode);
if (titleId == (tId & titleCodeRegion) ||
(tId & titleCode) == (titleId & titleCode) && (ESTitleId)(u8)titleId == TITLE_REGION_ALL) {
if (outIndex) {
*outIndex = page;
}
if (outPage) {
*outPage = index;
}
return tId;
}
}
}
page++;
} while (page < MAX_CHANNEL_PAGE);
return 0;
}
// Manager::makePriorTitleIDList: odiff 96 differing / 133, objdiff 75.53384%, 122/133 instructions, pool identical.
// The da1 prior-search candidate keeps the higher objdiff score (80.22556%, 124/133) but 118 differing.
// Blocker: the target recomputes &titleIdsIn[i] and &titleIdsOut[outputIndex] (slwi/add) at every use and
// reloads titleIdsIn[i] for isEqualChannel; MWCC CSEs/hoists both addresses here and keeps -0x100 unhoisted.
void Manager::makePriorTitleIDList(ESTitleId* titleIdsOut, ESTitleId* titleIdsIn, u32 titleCount) {
for (int page = 0; page < MAX_CHANNEL_PAGE; page++) {
for (int index = 0; index < MAX_CHANNEL_INDEX; index++) {
if (mData.chanInfo[page][index].primaryType == channel::PRIMARY_TYPE_CHANNEL) {
ESTitleId titleId = ES_TITLE_ID(mData.chanInfo[page][index].titleType, mData.chanInfo[page][index].titleCode);
int outputIndex = index + page * MAX_CHANNEL_INDEX;
for (u32 inputIndex = 0; inputIndex < titleCount; inputIndex++) {
if (titleIdsIn[inputIndex] == TITLE_NULL) {
continue;
}
if (titleIdsOut[outputIndex] != TITLE_NULL) {
titleId = titleIdsOut[outputIndex];
} else {
ESTitleId titleCode = TITLE_NO_REGION(titleId);
if (titleCode == TITLE_PHOTO || titleCode == TITLE_PHOTO_2 || titleCode == TITLE_PHOTO_2_CHECK) {
if (titleCode != mPhotoId) {
titleId = mPhotoId | TITLE_REGION_ALL;
}
}
}
int match = isEqualChannel(titleId, titleIdsIn[inputIndex]);
if (match == -2 || match == 0) {
if (checkValidApp(titleId)) {
titleIdsOut[outputIndex] = titleId;
}
titleIdsIn[inputIndex] = TITLE_NULL;
} else if (match == 1) {
if (checkValidApp(titleIdsIn[inputIndex])) {
titleIdsOut[outputIndex] = titleIdsIn[inputIndex];
}
titleIdsIn[inputIndex] = TITLE_NULL;
}
}
}
}
}
}

View File

@@ -0,0 +1,31 @@
# opus-ties: one-function-from-linking triage (base f9ebd2f4)
Full build at base: DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. Diff counts are from `odiff.py` (differing / total).
Result: no new exact function, and no source changes kept.
| unit | function | diff | class | regsim verdict | result |
|---|---|---|---|---|---|
| src/utility/iplESMisc | DeleteUnauthorizedData | 74/449 | GPR register-only | n.a. (trace blocked, see below) | unchanged |
| src/iplwww/www_wiisetting | Getter_ | 14/609 | GPR register-only (two named loop counters: `i`/`strBuf` in DUMMY_SECURITY_KEY, `i` in EUR 0x3b loop -> r31) | n.a. (trace blocked) | swapping `strBuf`/`i` declarations: no change (14) |
| src/keyboard/tiZiString | WithZi::update | 85/446 | GPR register-only plus 2 dependent swaps (163/164, 291/292) | n.a. (trace blocked) | unchanged |
| libs/RVL_SDK/src/nup/nup | __nupParseServerInfo | 66/452 | GPR register-only | structural: every named local already matches; all mismatches are @-temps of the inlined `__nupFindTag`/`strlen` (@1858,@1852,@1849,@1807,@1805,@1804,@1798,@1795 + unnamed r114/r120/r128/r134/r140/r150/r158/r166/r170). Best 7/8 needs @-temps interleaved with named locals | swapping `start`/`end` in `__nupFindTag`: no change (66) |
| libs/NW4R/src/lyt/lyt_window | Window::DrawFrame | 119/376 | GPR + FPR register | structural: unnamed temp v92 (`lis/addi` table base, wants r21 instead of r31) shifts this/basePt/frameSize/alpha/bUseVtxCol and v95..v124 up by one; regsim best 4/11; FPR diffs also | unchanged |
| src/scene/memoryCard/iplMemoryCardManager | _create_icon | 37/100 | scheduling + register (same count) | n.a. | target recomputes `&mFileCell[slot][file].icon` / `.iconTlut` adds after each GX call (keeps row base and index*0x15c in separate registers); ours CSEs the full address. `texObj` local assigned before GXLoadTexObj: 61/101 (worse) |
| src/keyboard/tiString | Decolated::inputChar | 73/136 (0x1f8 vs 0x220) | instruction count | n.a. | first diff: mode-3 (`CharacterOutput`) path; target keeps a runtime index (`sthx` at count*2, dead `cmplwi ch,10`, `clrlwi` count), ours folds to constant stores. Not attempted again (see tiString.attempts.md) |
| libs/RevoEX/src/nhttp/NHTTP_recvbuf | NHTTPi_compareTokenN_HdrRecvBuf | 5/124 | scheduling only (same registers) | n.a. | loop-preheader order: target `li 0x41, li 0x5a, extsb delim, addi limit-1, li 0`, ours `extsb, addi, li 0x41, li 0, li 0x5a`. Tried: for(;;)+break 63, swap LowerCase operands 40, `<= 'Z'` first 34, constants on the left 5, if/return form 40, `inline` 5, macro 5, s8 param 5 |
| libs/RVLMiddleware/TMC_JPEG/.../Texture_MCUtoY8U8V8 | TMCJPEGDEC_set_converterY8U8V8 | 195/196 (0x30c vs 0x310) | instruction count | n.a. | target materializes `work->convBuf` (`addi r4,r3,0x1858`) at entry and adds row offsets to it; ours folds into each offset. Already covered by tex1/g5/fz15; IRO and pragma sweep (irosweep --all): no hit |
| libs/RVLMiddleware/TMC_JPEG/.../Texture_MCUtoRGB565 | TMCJPEGDEC_set_converterRGB565 | 169/170 (0x2a4 vs 0x2a8) | instruction count | n.a. | same as Y8U8V8 (convBuf base kept at entry); irosweep --all: no hit |
| libs/RVL_SDK/src/fa/pdm_partition | pdm_part_is_master_boot_sector | 84/86 (0x158 vs 0x150) | scheduling + register pressure (extra saved r29 -> frame 0x40) | n.a. | byte loads of `read_partition_u32` scheduled differently, so one more live value; perm8/perm8d already tried 4950 permutations. irosweep --all: no hit |
## mwdbg on the three blocked units
`mwdbg.py` fails before reaching the function for iplESMisc, tiZiString and www_wiisetting (also with the stock tool):
1. Stock retrowin32: `WRITE_UNMAPPED @47e090` / `READ_UNMAPPED @46da46` with esp near 0xf18. The emulated compiler overflows its 1 MB stack (the PE's SizeOfStackReserve is 0x100000).
2. A private copy (`/tmp/ot/rw32`) with the stack raised to 32 MB and memory to 1 GB (`win32/src/pe/loader.rs` stack_size max(32<<20); `machine_unicorn.rs` MemImpl::new(1024<<20)) gets further. The compiler then calls its `UCBReportMessage` callback, which goes through `ws2_32!send` (ordinal 19, the call at 0x42c8b1), and retrowin32 has no ws2_32 shim.
3. The message is not the iplTree.h "return value expected" warning. Adding `-w off`, or an include override that fixes the warning, compiles silently under wibo but still hits `send` under the emulator.
The shared `_mwdbg` tool was not modified. To unblock these units, the next step is either a ws2_32 `send` shim that writes to stderr (to read the message) or a fix for whatever emulator difference triggers it.
nup and lyt_window traced fine; regsim reproduced 162/162 and 197/197.
`tools/decomp-assist/opus-ties.vmap.py <capdir> <unit> <symbol>` maps each traced virtual register to our physical register and the target's, by aligning backend-04 with after-color PCode and the two objects. That gives the `--want` list.

View File

@@ -0,0 +1,86 @@
#!/usr/bin/env python3
"""vmap.py <capdir> <unit> <symbol> [--project DIR]: map each GPR virtual to (our phys, target phys)."""
import json, re, sys, collections
sys.path.insert(0, '/home/cole/projects/tests')
from capstone import Cs, CS_ARCH_PPC, CS_MODE_32, CS_MODE_BIG_ENDIAN
from elftools.elf.elffile import ELFFile
cap, unit, sym = sys.argv[1:4]
proj = '/mnt/drive2/projects/wii-ipl-workers/data-d4'
if '--project' in sys.argv: proj = sys.argv[sys.argv.index('--project') + 1]
def fn_insns(path):
with open(path, 'rb') as f:
e = ELFFile(f)
st = e.get_section_by_name('.symtab')
s = [x for x in st.iter_symbols() if x.name == sym][0]
sec = e.get_section(s['st_shndx'])
data = sec.data()[s['st_value']:s['st_value'] + s['st_size']]
md = Cs(CS_ARCH_PPC, CS_MODE_32 + CS_MODE_BIG_ENDIAN)
out = []
for i in range(0, len(data), 4):
l = list(md.disasm(data[i:i+4], i))
out.append((l[0].mnemonic, re.findall(r'\br(\d+)\b', l[0].op_str)) if l else ('?', []))
return out
ours = fn_insns(f'{proj}/build/43U/src/{unit}.o')
targ = fn_insns(f'{proj}/build/43U/obj/{unit}.o')
assert len(ours) == len(targ), (len(ours), len(targ))
def gprs(ins):
return [o['reg'] for o in ins['operands'] if o.get('kind') == 0 and o.get('reg_class') == 4]
bc = json.load(open(f'{cap}/regalloc-gpr-pass-1-before-color.json'))
ac = json.load(open(f'{cap}/regalloc-gpr-pass-1-after-color.json'))
# use last successful pass if present
import glob
passes = sorted(glob.glob(f'{cap}/regalloc-gpr-pass-*-before-color.json'))
bc = json.load(open(passes[-1])); ac = json.load(open(passes[-1].replace('before', 'after')))
b4 = json.load(open(f'{cap}/backend-04-after-scheduling.json'))
names = {}
for line in open(passes[-1].replace('before-color.json', 'all.txt')):
m = re.match(r'r(\d+) -> r(\d+) (\S*)', line)
if m: names[int(m.group(1))] = m.group(3)
# per block: list of (key, virtual regs) from after-color/before-color
blk = {}
for B, A in zip(bc, ac):
lst = []
for ib, ia in zip(B['instructions'], A['instructions']):
lst.append([ia['mnemonic'], gprs(ia), gprs(ib), False])
blk[A['index']] = lst
seq = [] # final instruction order: list of virtual-reg lists (or None)
for B in b4:
pool = blk.get(B['index'], [])
for ins in B['instructions']:
key = (ins['mnemonic'], gprs(ins))
hit = None
for c in pool:
if not c[3] and c[0] == key[0] and c[1] == key[1]:
hit = c; break
if hit:
hit[3] = True; seq.append((ins['mnemonic'], hit[2], key[1]))
else:
seq.append((ins['mnemonic'], None, key[1]))
# align seq with ours by mnemonic order
res = collections.defaultdict(lambda: collections.Counter())
ourp = {}
j = 0
mis = 0
for mn, virt, phys in seq:
if j >= len(ours): break
# skip pcode pseudo instructions that don't emit
if virt is None and mn.lower() not in [o[0].rstrip('.') for o in ours[j:j+1]]:
pass
o = ours[j]; t = targ[j]; j += 1
if virt is None: continue
# register operands only compare if counts match
if [int(x) for x in o[1]] != phys[:len(o[1])] and [int(x) for x in o[1]] != phys:
mis += 1; continue
for k, v in enumerate(virt[:len(o[1])]):
if v >= 32 and k < len(t[1]):
res[v][int(t[1][k])] += 1
ourp[v] = int(o[1][k])
print(f'# aligned {len(seq)} pcode vs {len(ours)} insns, operand mismatches {mis}')
for v in sorted(res):
tgt = res[v].most_common()
flag = '' if len(tgt) == 1 and tgt[0][0] == ourp[v] else ' *'
print(f'r{v} {names.get(v, "?")} ours=r{ourp[v]} target={",".join(f"r{r}x{c}" for r, c in tgt)}{flag}')

View File

@@ -0,0 +1,28 @@
# opus-vf attempts (lead: yannicksuter/mscharged-decomp)
Refs saved to /mnt/drive2/projects/wii-ipl-workers/_refs/prior/yannicksuter_mscharged-decomp__{sd_drv.c,sd_drv.h,pdm_partition.c,pdm_partition.h,lyt_window.cpp}.
## libs/NW4R/src/lyt/lyt_window (20/21, DrawFrame 119/376 differing, Equivalent)
1. Ported their HBM DrawFrame shape: LT quad expanded with GetTexutreFlipInfo(NONE) + inline SetFrameTexOrigin/SetFrameTexExtent (kept our GetTextureNum early-out). DrawFrame 0/376; all 21 functions exact, no mw_version change needed.
2. Flipped to Matching: DOL wrong. .data order flipInfos/scLytFatalMsg swapped -> moved scLytFatalMsg definition below the anonymous namespace (extern decl at top). Order fixed.
3. DOL still off by 4 bytes: Get/SetVtxColorElement inlines (lyt/common.h) used the local NW4R_ASSERT redefinition (scLytFatalMsg) instead of the header's own weak @STRING@ literal. Moved the lyt includes above the macro redefinition. DOL 26116613... OK.
## libs/RVL_SDK/src/fa/driver/sd_drv (23/26)
- Their src/RVL_SDK/vf/sd_drv.c is a 5-line stub (VFi_InitSDWrok only). No prior art for pfd_sddrv_init/finalize/build_fat32_mbr_bpb.
- mw_version="GC/3.0a5": object byte-identical to 3.0a5.2 (md5 ccd9f660...). No change. Not pursued further (no lead).
## libs/RVL_SDK/src/fa/pdm_partition (19/20, pdm_part_is_master_boot_sector 84/86)
- Their pdm_partition.c is the newer VF version (VFipdm_mbr_get_mbr_part_table); no pdm_part_is_master_boot_sector. Dead lead.
- mw_version="GC/3.0a5": object byte-identical (md5 a1dd0b38...). No change.
- Hand attempts on the function:
1. read_partition_u32 = b0 + b1<<8 + b2<<16 + b3<<24 (plain sum): 25/84 (size now right).
2. loop 2 pointer order swapped: 25. `*p_count + *p_start`: 23. p_count++ first: 27. for-header increments: 25.
3. loop 2 as start[index] + count[index]: 21/84 (best).
4. sum trees ((b2<<16)+b0)+((b3<<24)+(b1<<8)): 84/86; reversed sum: 85/86; casts / unsigned int / no casts / b0+b2+b1+b3: 21; OR form: 78-82.
5. pointer p=buf+offset, MBR_WORD macro, buf+4 for count, &buf[454]: all 21. Accumulating local: 43.
6. store count before start: 88. int index: 28. all 120 local declaration orders: best 21.
7. loop 1 with arrays: 24. inverted if/else: 60.
Remaining: 21 instructions in the inlined byte-assembly schedule (target loads b3,b2,b0 then b1; ours b3,b2,b1,b0). Best copy: tools/decomp-assist/opus-vf.best.pdm_partition.c.
## Step 3
All other fa/ (RVLSDKLib "fa") and vf/ Objects are Matching; nothing else to try.

View File

@@ -0,0 +1,307 @@
#include <private/fa/pdm.h>
#include <revolution/types.h>
#define MBR_WORD(buf, offset) \
((pf_u32)(buf)[offset] + ((pf_u32)(buf)[(offset) + 1] << 8) + \
((pf_u32)(buf)[(offset) + 2] << 16) + ((pf_u32)(buf)[(offset) + 3] << 24))
static inline pf_u16 read_boot_u16(pf_u8* buf, pf_u32 offset) {
if ((pf_u32)&buf[offset] & 1) { return (buf[offset + 1] << 8) | buf[offset]; }
return PF_SWAP_16(*(pf_u16*)&buf[(offset + 1) & ~1]);
}
static inline pf_u32 read_partition_u32(const pf_u8* buf, pf_u32 offset) {
return buf[offset] + ((pf_u32)buf[offset + 1] << 8) + ((pf_u32)buf[offset + 2] << 16) + ((pf_u32)buf[offset + 3] << 24);
}
pf_s32 pdm_part_is_master_boot_sector(pf_u8* buf, pf_u32 total, pf_bool* p_is_mbr) {
pf_u32* p_start;
pf_u32* p_count;
pf_s16 index;
pf_u32 start[4];
pf_u32 count[4];
*p_is_mbr = 0;
if (buf[510] != 0x55 || buf[511] != 0xAA) { return 2; }
p_start = start;
p_count = count;
for (index = 0; index < 4; index++) {
*p_start = 0;
*p_start = read_partition_u32(buf, 454);
*p_count = read_partition_u32(buf, 458);
if (*p_start != 0 && *p_count != 0) {
if (index == 0) { *p_is_mbr = 1; }
} else {
if (index == 0) { return 2; }
}
p_start++;
p_count++;
buf += 16;
}
for (index = 0; index < 4; index++) {
if (start[index] + count[index] > total) {
if (index == 0) { *p_is_mbr = 0; }
return 2;
}
}
return 0;
}
pf_bool pdm_part_is_boot_sector(pf_u8* buf) {
pf_u16 byte_per_sector;
pf_u16 sector_per_cluster;
pf_u8 media;
pf_bool is_boot;
is_boot = PF_TRUE;
if ((buf[0x00] != 0xEB || buf[0x2] != 0x90) && buf[0x0] != 0xE9) {
is_boot = PF_FALSE;
}
if (buf[0x1FE] != 0x55 || buf[0x1FF] != 0xAA) {
is_boot = PF_FALSE;
}
byte_per_sector = read_boot_u16(buf, 0xB);
if (byte_per_sector != 0x200 && byte_per_sector != 0x400 && byte_per_sector != 0x800 && byte_per_sector != 0x1000) {
is_boot = PF_FALSE;
}
sector_per_cluster = buf[0xD];
if (sector_per_cluster != 1 && sector_per_cluster != 2 && sector_per_cluster != 4 && sector_per_cluster != 8 && sector_per_cluster != 0x10 &&
sector_per_cluster != 0x20 && sector_per_cluster != 0x40 && sector_per_cluster != 0x80) {
is_boot = PF_FALSE;
}
media = buf[0x15];
if (media != 0xF0 && media != 0xF8 && media != 0xF9 && media != 0xFA && media != 0xFB && media != 0xFC && media != 0xFD && media != 0xFE &&
media != 0xFF) {
is_boot = PF_FALSE;
}
return is_boot;
}
static inline pf_u32 read_relative_start_sector(pf_u32 base, const pf_u8* buf, pf_u32 offset) {
return base + (buf[offset] + ((unsigned int)buf[offset + 1] << 8) +
((unsigned int)buf[offset + 2] << 16) + ((unsigned int)buf[offset + 3] << 24));
}
pf_s32 pdm_part_get_start_sector(PDM_PARTITION* p_part) {
pf_u32 requested = p_part->part_id;
pf_u32 start[4];
pf_u32 count[4];
pf_u32 part_index = 0;
pf_u32 sector;
pf_u32 base;
pf_u16 index;
pf_u16 extended_index;
pf_u32 length;
pf_bool is_mbr;
pf_u32 success;
pf_s32 err;
pf_u8 buf[512] __attribute__((aligned(32)));
p_part->start_sector = 0;
p_part->total_sector = p_part->p_disk->disk_info.total_sectors;
err = pdm_disk_physical_read(p_part->p_disk, buf, 0, 1, 512, &success);
if (err != 0) { return err; }
pdm_part_is_master_boot_sector(buf, p_part->p_disk->disk_info.total_sectors, &is_mbr);
if (is_mbr) {
start[0] = MBR_WORD(buf, 454);
start[1] = MBR_WORD(buf, 470);
start[2] = MBR_WORD(buf, 486);
start[3] = MBR_WORD(buf, 502);
count[0] = MBR_WORD(buf, 458);
count[1] = MBR_WORD(buf, 474);
count[2] = MBR_WORD(buf, 490);
count[3] = MBR_WORD(buf, 506);
part_index = 0;
for (index = 0; index < 4; index++) {
sector = start[index];
length = count[index];
if (sector == 0 || length == 0) { return 7; }
err = pdm_disk_physical_read(p_part->p_disk, buf, sector, 1, 512, &success);
if (err != 0) { return err; }
pdm_part_is_master_boot_sector(buf, p_part->p_disk->disk_info.total_sectors, &is_mbr);
if (is_mbr) {
base = start[index];
sector = base;
for (extended_index = 0; extended_index < 2; extended_index++) {
if (extended_index == 0) {
sector = read_relative_start_sector(sector, buf, 454);
length = MBR_WORD(buf, 458);
err = pdm_disk_physical_read(p_part->p_disk, buf, sector, 1, 512, &success);
if (err != 0) { return err; }
if (requested == part_index) { p_part->start_sector = sector; p_part->total_sector = length; return 0; }
part_index++;
} else {
sector = read_relative_start_sector(base, buf, 470);
length = MBR_WORD(buf, 474);
if (sector == 0 || length == 0) { break; }
err = pdm_disk_physical_read(p_part->p_disk, buf, sector, 1, 512, &success);
if (err != 0) { return err; }
pdm_part_is_master_boot_sector(buf, p_part->p_disk->disk_info.total_sectors, &is_mbr);
if (!is_mbr) { break; }
extended_index = 0;
}
}
} else {
if (requested == part_index) { p_part->start_sector = sector; p_part->total_sector = length; break; }
part_index++;
}
}
} else {
if (requested >= 2) { return 7; }
p_part->start_sector = part_index;
p_part->total_sector = p_part->p_disk->disk_info.total_sectors;
}
return 0;
}
static inline pf_u32 partition_physical_sector(PDM_PARTITION* p_part, pf_u32 sector, pf_u32 bps) {
pf_u16 media_bps;
pf_u32 ratio;
pf_u32 start;
pdm_disk_get_media_bps(p_part->p_disk, &media_bps);
if (bps == media_bps) { return sector + p_part->start_sector; }
start = p_part->start_sector;
ratio = media_bps >> 9;
if (ratio == 2) { start <<= 1; }
else if (ratio == 4) { start <<= 2; }
else if (ratio == 8) { start <<= 3; }
ratio = (pf_u16)bps >> 9;
if (ratio == 2) { start >>= 1; }
else if (ratio == 4) { start >>= 2; }
else if (ratio == 8) { start >>= 3; }
return sector + start;
}
pf_u32 pdm_part_chg_ltop(PDM_PARTITION* p_part, pf_u32 sector, pf_u32 bps) NO_INLINE {
return partition_physical_sector(p_part, sector, bps);
}
pf_s32 pdm_part_get_partition(PDM_DISK* p_disk, pf_u32 id, PDM_PARTITION** pp_part) {
pf_s32 err;
pf_u16 index;
*pp_part = PF_NULL;
if (pdm_disk_set.num_partition >= PDM_DRIVE_COUNT) { return 10; }
for (index = 0; index < PDM_DRIVE_COUNT; index++) {
if (!(pdm_disk_set.partition[index].status & 1)) { break; }
}
if (index == PDM_DRIVE_COUNT) { return 10; }
err = pdm_disk_set_disk(p_disk, &pdm_disk_set.partition[index]);
if (err != 0) { return err; }
pdm_disk_set.num_partition++;
pdm_disk_set.partition[index].status |= 1;
pdm_disk_set.partition[index].p_disk = p_disk;
pdm_disk_set.partition[index].part_id = id;
*pp_part = &pdm_disk_set.partition[index];
return 0;
}
pf_s32 pdm_part_release_partition(PDM_PARTITION* p_part) {
p_part->status &= ~1;
pdm_disk_set.num_partition--;
return 0;
}
pf_bool pdm_part_is_attached_partition(PDM_PARTITION* p_part) { return (p_part->status >> 2) & 1; }
void pdm_part_set_driver_error_code(PDM_PARTITION* p_part, pf_s32 err) { p_part->driver_last_error = err; }
pf_s32 pdm_part_get_driver_error_code(PDM_PARTITION* p_part) { return p_part->driver_last_error; }
pf_s32 pdm_part_get_media_attribute(PDM_PARTITION* p_part, PDM_DISK_INFO* p_info) {
pf_s32 err = pdm_disk_get_media_attribute(p_part->p_disk, p_info);
if (err != 0) { return err; }
return 0;
}
pf_s32 pdm_part_init(PDM_PARTITION* p_part) {
pf_s32 err;
if (!(p_part->status & 4)) {
err = pdm_disk_set_disk(p_part->p_disk, p_part);
if (err != 0) { return err; }
err = pdm_disk_init(p_part->p_disk);
if (err != 0) { return err; }
} else { return 11; }
p_part->status |= 4;
return 0;
}
pf_s32 pdm_part_mount(PDM_PARTITION* p_part) {
pf_s32 err;
if (!(p_part->status & 8)) {
err = pdm_disk_set_disk(p_part->p_disk, p_part);
if (err != 0) { return err; }
err = pdm_disk_mount(p_part->p_disk);
if (err != 0) { return err; }
err = pdm_part_get_start_sector(p_part);
if (err != 0) { pdm_disk_unmount(p_part->p_disk, 0); return err; }
} else { return 12; }
p_part->status &= ~2;
p_part->status |= 8;
return 0;
}
pf_s32 pdm_part_format(PDM_PARTITION* p_part, const pf_u8* param) {
pf_s32 err;
err = pdm_disk_set_disk(p_part->p_disk, p_part);
if (err != 0) { return err; }
err = pdm_disk_format(p_part->p_disk, param);
if (err != 0) { return err; }
return 0;
}
pf_s32 pdm_part_logical_read(PDM_PARTITION* p_part, pf_u8* buf, pf_u32 sector, pf_u32 count, pf_u32 bps, pf_u32* p_success) {
pf_s32 err;
pf_u32 physical_sector;
if ((p_part->status & 8) != 8 || (p_part->status & 2) == 2) { return 15; }
err = pdm_disk_set_disk(p_part->p_disk, p_part);
if (err != 0) { return err; }
if (p_part->total_sector <= sector) { return 18; }
if (p_part->total_sector < sector + count) { count -= (sector + count) - p_part->total_sector; }
physical_sector = pdm_part_chg_ltop(p_part, sector, bps);
err = pdm_disk_physical_read(p_part->p_disk, buf, physical_sector, count, bps, p_success);
if (err != 0) { return err; }
return 0;
}
pf_s32 pdm_part_logical_write(PDM_PARTITION* p_part, const pf_u8* buf, pf_u32 sector, pf_u32 count, pf_u32 bps, pf_u32* p_success) {
pf_s32 err;
pf_u32 physical_sector;
if ((p_part->status & 8) != 8 || (p_part->status & 2) == 2) { return 15; }
err = pdm_disk_set_disk(p_part->p_disk, p_part);
if (err != 0) { return err; }
if (p_part->total_sector <= sector) { return 18; }
if (p_part->total_sector < sector + count) { count -= (sector + count) - p_part->total_sector; }
physical_sector = pdm_part_chg_ltop(p_part, sector, bps);
err = pdm_disk_physical_write(p_part->p_disk, buf, physical_sector, count, bps, p_success);
if (err != 0) { return err; }
return 0;
}
pf_s32 pdm_part_unmount(PDM_PARTITION* p_part, pf_u32 mode) {
pf_s32 err;
pf_s32 result = 0;
if (p_part->status & 8) {
err = pdm_disk_set_disk(p_part->p_disk, p_part);
if (err != 0) { return err; }
err = pdm_disk_unmount(p_part->p_disk, mode);
if (err != 0) { result = err; }
} else { result = 14; }
if (result == 0 || mode == 1) { p_part->status &= ~2; p_part->status &= ~8; }
return result;
}
pf_s32 pdm_part_finalize(PDM_PARTITION* p_part) {
pf_s32 err;
if (p_part->status & 4) {
err = pdm_disk_set_disk(p_part->p_disk, p_part);
if (err != 0) { return err; }
err = pdm_disk_finalize(p_part->p_disk);
if (err != 0) { return err; }
} else { return 13; }
p_part->status &= ~4;
return 0;
}
pf_s32 pdm_part_register_callback(PDM_PARTITION* p_part, PDM_CALLBACK* callbacks) {
p_part->callbacks.insert = callbacks->insert;
p_part->callbacks.eject = callbacks->eject;
return 0;
}
pf_s32 pdm_part_unregister_callback(PDM_PARTITION* p_part) {
p_part->callbacks.insert = PF_NULL;
p_part->callbacks.eject = PF_NULL;
return 0;
}
void pdm_part_set_change_media_state(PDM_DISK* p_disk, pf_bool is_inserted) {
pf_u16 index;
for (index = 0; index < PDM_DRIVE_COUNT; index++) {
if ((pdm_disk_set.partition[index].status & 1) && pdm_disk_set.partition[index].p_disk == p_disk) {
PDM_PARTITION* p_part = &pdm_disk_set.partition[index];
p_part->status |= 2;
if (is_inserted == 0 && pdm_disk_set.partition[index].callbacks.eject != PF_NULL) {
pdm_disk_set.partition[index].callbacks.eject(p_part);
} else if (pdm_disk_set.partition[index].callbacks.insert != PF_NULL) {
pdm_disk_set.partition[index].callbacks.insert(p_part);
}
}
}
}

View File

@@ -0,0 +1,264 @@
# sol-ph1 attempts
Worktree data-d6; branch agent/w1008/data-d6-h; initial HEAD f49f337c.
Initial requested object build passed. Existing untracked rx63 evidence left untouched.
Only zero differing instructions with equal size qualify. No pushes, PRs, rebases or other-worktree edits.
Read prior opus-sdm, opus-iro, rx2b, rx36 and rx63 notes; target Ghidra exports and levers 25-29.
- has-00-seed: {"tag": "has-00-seed", "diffs": 54, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Reproduce h52 with titleCode declared in primary-type block.
- title-00-seed: {"tag": "title-00-seed", "diffs": 4, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Reproduce signed predicate best C.
- has-01-h52: {"tag": "has-01-h52", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Use target-proven 64-bit region comparison, avoids byte extraction hoist.
- title-01-helper-0: {"tag": "title-01-helper-0", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preferred-name lookup inside real inline helper; metadata pointer/ref, argument ordering, const and language call boundaries.
- title-01-helper-1: {"tag": "title-01-helper-1", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preferred-name lookup inside real inline helper; metadata pointer/ref, argument ordering, const and language call boundaries.
- title-01-helper-2: {"tag": "title-01-helper-2", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preferred-name lookup inside real inline helper; metadata pointer/ref, argument ordering, const and language call boundaries.
- title-01-helper-3: {"tag": "title-01-helper-3", "diffs": 67, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preferred-name lookup inside real inline helper; metadata pointer/ref, argument ordering, const and language call boundaries.
- title-01-helper-4: {"tag": "title-01-helper-4", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preferred-name lookup inside real inline helper; metadata pointer/ref, argument ordering, const and language call boundaries.
- title-01-helper-5: {"tag": "title-01-helper-5", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preferred-name lookup inside real inline helper; metadata pointer/ref, argument ordering, const and language call boundaries.
- title-01-helper-6: {"tag": "title-01-helper-6", "diffs": 67, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preferred-name lookup inside real inline helper; metadata pointer/ref, argument ordering, const and language call boundaries.
- title-01-helper-7: {"tag": "title-01-helper-7", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preferred-name lookup inside real inline helper; metadata pointer/ref, argument ordering, const and language call boundaries.
- title-02-index-0: {"tag": "title-02-index-0", "diffs": 4, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Equivalent multidimensional-array addressing grouped by selected name/language.
- title-02-index-1: {"tag": "title-02-index-1", "diffs": 4, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Equivalent multidimensional-array addressing grouped by selected name/language.
- title-02-index-2: {"tag": "title-02-index-2", "diffs": 67, "insns": [75, 71], "sizes": [300, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Equivalent multidimensional-array addressing grouped by selected name/language.
- title-02-index-3: {"tag": "title-02-index-3", "diffs": 4, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Equivalent multidimensional-array addressing grouped by selected name/language.
- title-02-index-4: {"tag": "title-02-index-4", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Equivalent multidimensional-array addressing grouped by selected name/language.
- title-02-index-5: {"tag": "title-02-index-5", "diffs": 67, "insns": [75, 71], "sizes": [300, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Equivalent multidimensional-array addressing grouped by selected name/language.
- title-03-entry-helper-0: {"tag": "title-03-entry-helper-0", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Entry-based preferred-name helper delays metadata pointer read until after language call.
- title-03-entry-helper-1: {"tag": "title-03-entry-helper-1", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Entry-based preferred-name helper delays metadata pointer read until after language call.
- title-03-entry-helper-2: {"tag": "title-03-entry-helper-2", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Entry-based preferred-name helper delays metadata pointer read until after language call.
- title-03-entry-helper-3: {"tag": "title-03-entry-helper-3", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Entry-based preferred-name helper delays metadata pointer read until after language call.
- title-03-entry-helper-4: {"tag": "title-03-entry-helper-4", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Entry-based preferred-name helper delays metadata pointer read until after language call.
- title-03-entry-helper-5: {"tag": "title-03-entry-helper-5", "diffs": 69, "insns": [77, 71], "sizes": [308, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Entry-based preferred-name helper delays metadata pointer read until after language call.
- title-03-entry-helper-6: {"tag": "title-03-entry-helper-6", "diffs": 67, "insns": [75, 71], "sizes": [300, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Entry-based preferred-name helper delays metadata pointer read until after language call.
- title-03-entry-helper-7: {"tag": "title-03-entry-helper-7", "diffs": 69, "insns": [77, 71], "sizes": [308, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Entry-based preferred-name helper delays metadata pointer read until after language call.
- title-04-c89-0: {"tag": "title-04-c89-0", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Initial-language/name/entry locals declared at top; separate initialization.
- title-04-c89-1: {"tag": "title-04-c89-1", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Initial-language/name/entry locals declared at top; separate initialization.
- title-04-c89-2: {"tag": "title-04-c89-2", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Initial-language/name/entry locals declared at top; separate initialization.
- title-04-c89-3: {"tag": "title-04-c89-3", "diffs": 69, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Initial-language/name/entry locals declared at top; separate initialization.
- title-04-c89-4: {"tag": "title-04-c89-4", "diffs": 4, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Initial-language/name/entry locals declared at top; separate initialization.
- title-04-c89-5: {"tag": "title-04-c89-5", "diffs": 4, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Initial-language/name/entry locals declared at top; separate initialization.
- title-04-c89-6: {"tag": "title-04-c89-6", "diffs": 4, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Initial-language/name/entry locals declared at top; separate initialization.
- title-04-c89-7: {"tag": "title-04-c89-7", "diffs": 65, "insns": [77, 71], "sizes": [308, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Initial-language/name/entry locals declared at top; separate initialization.
- title-04-c89-8: {"tag": "title-04-c89-8", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Initial-language/name/entry locals declared at top; separate initialization.
- title-04-c89-9: {"tag": "title-04-c89-9", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Initial-language/name/entry locals declared at top; separate initialization.
- title-05-byte-group-0: {"tag": "title-05-byte-group-0", "diffs": 65, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Flatten named name array with explicit element/byte stride grouping; no fixed metadata offset.
- title-05-byte-group-1: {"tag": "title-05-byte-group-1", "diffs": 65, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Flatten named name array with explicit element/byte stride grouping; no fixed metadata offset.
- title-05-byte-group-2: {"tag": "title-05-byte-group-2", "diffs": 65, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Flatten named name array with explicit element/byte stride grouping; no fixed metadata offset.
- title-05-byte-group-3: {"tag": "title-05-byte-group-3", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Flatten named name array with explicit element/byte stride grouping; no fixed metadata offset.
- title-05-byte-group-4: {"tag": "title-05-byte-group-4", "diffs": 67, "insns": [75, 71], "sizes": [300, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Flatten named name array with explicit element/byte stride grouping; no fixed metadata offset.
- title-05-byte-group-5: {"tag": "title-05-byte-group-5", "diffs": 67, "insns": [75, 71], "sizes": [300, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Flatten named name array with explicit element/byte stride grouping; no fixed metadata offset.
- title-05-byte-group-6: {"tag": "title-05-byte-group-6", "diffs": 67, "insns": [75, 71], "sizes": [300, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Flatten named name array with explicit element/byte stride grouping; no fixed metadata offset.
- title-05-byte-group-7: {"tag": "title-05-byte-group-7", "diffs": 67, "insns": [75, 71], "sizes": [300, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Flatten named name array with explicit element/byte stride grouping; no fixed metadata offset.
- has-02-c89-0: {"tag": "has-02-c89-0", "diffs": 22, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; All real locals at function top with separate initialization; order follows mask/loop/title roles.
- has-02-c89-1: {"tag": "has-02-c89-1", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; All real locals at function top with separate initialization; order follows mask/loop/title roles.
- has-02-c89-2: {"tag": "has-02-c89-2", "diffs": 19, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; All real locals at function top with separate initialization; order follows mask/loop/title roles.
- has-02-c89-3: {"tag": "has-02-c89-3", "diffs": 19, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; All real locals at function top with separate initialization; order follows mask/loop/title roles.
- has-02-c89-4: {"tag": "has-02-c89-4", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; All real locals at function top with separate initialization; order follows mask/loop/title roles.
- has-02-c89-5: {"tag": "has-02-c89-5", "diffs": 18, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; All real locals at function top with separate initialization; order follows mask/loop/title roles.
- has-02-c89-6: {"tag": "has-02-c89-6", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; All real locals at function top with separate initialization; order follows mask/loop/title roles.
- has-02-c89-7: {"tag": "has-02-c89-7", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; All real locals at function top with separate initialization; order follows mask/loop/title roles.
- has-03-mask-helper-0: {"tag": "has-03-mask-helper-0", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Construct full 64-bit title matching mask in real inline helper.
- has-03-mask-helper-1: {"tag": "has-03-mask-helper-1", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Construct full 64-bit title matching mask in real inline helper.
- has-03-mask-helper-2: {"tag": "has-03-mask-helper-2", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Construct full 64-bit title matching mask in real inline helper.
- has-03-mask-helper-3: {"tag": "has-03-mask-helper-3", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Construct full 64-bit title matching mask in real inline helper.
- has-03-mask-helper-4: {"tag": "has-03-mask-helper-4", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Construct full 64-bit title matching mask in real inline helper.
- has-03-mask-helper-5: {"tag": "has-03-mask-helper-5", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Construct full 64-bit title matching mask in real inline helper.
- has-04-slot-helper-0: {"tag": "has-04-slot-helper-0", "diffs": 25, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real title construction, region stripping or region predicate helper.
- has-04-slot-helper-1: {"tag": "has-04-slot-helper-1", "diffs": 25, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real title construction, region stripping or region predicate helper.
- has-04-slot-helper-2: {"tag": "has-04-slot-helper-2", "diffs": 25, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real title construction, region stripping or region predicate helper.
- has-04-slot-helper-3: {"tag": "has-04-slot-helper-3", "diffs": 22, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real title construction, region stripping or region predicate helper.
- has-04-slot-helper-4: {"tag": "has-04-slot-helper-4", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real title construction, region stripping or region predicate helper.
- has-04-slot-helper-5: {"tag": "has-04-slot-helper-5", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real title construction, region stripping or region predicate helper.
- has-05-access-0: {"tag": "has-05-access-0", "diffs": 59, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Row/slot pointers, parameter copy, or page-scoped index with separate initialization.
- has-05-access-1: {"tag": "has-05-access-1", "diffs": 59, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Row/slot pointers, parameter copy, or page-scoped index with separate initialization.
- has-05-access-2: {"tag": "has-05-access-2", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Row/slot pointers, parameter copy, or page-scoped index with separate initialization.
- has-05-access-3: {"tag": "has-05-access-3", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Row/slot pointers, parameter copy, or page-scoped index with separate initialization.
- title-06-member-0: {"tag": "title-06-member-0", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata/channel-entry inline name accessor; pointer dereference stays inside member.
- title-06-member-1: {"tag": "title-06-member-1", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata/channel-entry inline name accessor; pointer dereference stays inside member.
- title-06-member-2: {"tag": "title-06-member-2", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata/channel-entry inline name accessor; pointer dereference stays inside member.
- title-06-member-3: {"tag": "title-06-member-3", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata/channel-entry inline name accessor; pointer dereference stays inside member.
- title-06-member-4: {"tag": "title-06-member-4", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata/channel-entry inline name accessor; pointer dereference stays inside member.
- title-06-member-5: {"tag": "title-06-member-5", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata/channel-entry inline name accessor; pointer dereference stays inside member.
- title-06-member-6: {"tag": "title-06-member-6", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata/channel-entry inline name accessor; pointer dereference stays inside member.
- title-06-member-7: {"tag": "title-06-member-7", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata/channel-entry inline name accessor; pointer dereference stays inside member.
- title-07-language-cast-0: {"tag": "title-07-language-cast-0", "diffs": 4, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preferred-language index signedness changes address association without a named local.
- title-07-language-cast-1: {"tag": "title-07-language-cast-1", "diffs": 4, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preferred-language index signedness changes address association without a named local.
- title-07-language-cast-2: {"tag": "title-07-language-cast-2", "diffs": 4, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preferred-language index signedness changes address association without a named local.
- title-07-language-cast-3: {"tag": "title-07-language-cast-3", "diffs": 4, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preferred-language index signedness changes address association without a named local.
- title-07-language-cast-4: {"tag": "title-07-language-cast-4", "diffs": 56, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preferred-language index signedness changes address association without a named local.
- title-07-language-cast-5: {"tag": "title-07-language-cast-5", "diffs": 4, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preferred-language index signedness changes address association without a named local.
- has-06-accessor-0: {"tag": "has-06-accessor-0", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real const manager accessor or slot title-ID accessor, rather than temporary view types.
- has-06-accessor-1: {"tag": "has-06-accessor-1", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real const manager accessor or slot title-ID accessor, rather than temporary view types.
- has-06-accessor-2: {"tag": "has-06-accessor-2", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real const manager accessor or slot title-ID accessor, rather than temporary view types.
- has-06-accessor-3: {"tag": "has-06-accessor-3", "diffs": 25, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real const manager accessor or slot title-ID accessor, rather than temporary view types.
- has-06-accessor-4: {"tag": "has-06-accessor-4", "diffs": 22, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real const manager accessor or slot title-ID accessor, rather than temporary view types.
- has-06-accessor-5: {"tag": "has-06-accessor-5", "diffs": 25, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real const manager accessor or slot title-ID accessor, rather than temporary view types.
- has-07-match-shape-0: {"tag": "has-07-match-shape-0", "diffs": 63, "insns": [75, 71], "sizes": [300, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real inline masked-title comparator, or separate high/low mask construction.
- has-07-match-shape-1: {"tag": "has-07-match-shape-1", "diffs": 63, "insns": [75, 71], "sizes": [300, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real inline masked-title comparator, or separate high/low mask construction.
- has-07-match-shape-2: {"tag": "has-07-match-shape-2", "diffs": 63, "insns": [75, 71], "sizes": [300, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real inline masked-title comparator, or separate high/low mask construction.
- has-07-match-shape-3: {"tag": "has-07-match-shape-3", "diffs": 69, "insns": [75, 71], "sizes": [300, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real inline masked-title comparator, or separate high/low mask construction.
- has-07-match-shape-4: {"tag": "has-07-match-shape-4", "diffs": 54, "insns": [77, 71], "sizes": [308, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real inline masked-title comparator, or separate high/low mask construction.
- has-07-match-shape-5: {"tag": "has-07-match-shape-5", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real inline masked-title comparator, or separate high/low mask construction.
- has-07-match-shape-6: {"tag": "has-07-match-shape-6", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real inline masked-title comparator, or separate high/low mask construction.
- has-07-match-shape-7: {"tag": "has-07-match-shape-7", "diffs": 66, "insns": [69, 71], "sizes": [276, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real inline masked-title comparator, or separate high/low mask construction.
- has-07-match-shape-8: {"tag": "has-07-match-shape-8", "diffs": 67, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real inline masked-title comparator, or separate high/low mask construction.
- has-07-match-shape-9: {"tag": "has-07-match-shape-9", "diffs": 65, "insns": [69, 71], "sizes": [276, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Real inline masked-title comparator, or separate high/low mask construction.
- has-08-loop-0: {"tag": "has-08-loop-0", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Equivalent counted-loop spelling/bounds local or 64-bit title construction.
- has-08-loop-1: {"tag": "has-08-loop-1", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Equivalent counted-loop spelling/bounds local or 64-bit title construction.
- has-08-loop-2: {"tag": "has-08-loop-2", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Equivalent counted-loop spelling/bounds local or 64-bit title construction.
- has-08-loop-3: {"tag": "has-08-loop-3", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Equivalent counted-loop spelling/bounds local or 64-bit title construction.
- has-08-loop-4: {"tag": "has-08-loop-4", "diffs": 13, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Equivalent counted-loop spelling/bounds local or 64-bit title construction.
- has-08-loop-5: {"tag": "has-08-loop-5", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Equivalent counted-loop spelling/bounds local or 64-bit title construction.
- has-08-loop-6: {"tag": "has-08-loop-6", "diffs": 12, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Equivalent counted-loop spelling/bounds local or 64-bit title construction.
- has-08-loop-7: {"tag": "has-08-loop-7", "diffs": 61, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 3 (mine=3 base=3)"}; Equivalent counted-loop spelling/bounds local or 64-bit title construction.
- title-08-signed-byte-0: {"tag": "title-08-signed-byte-0", "diffs": 65, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Signed byte-stride arithmetic retains CSE with the original signed name-index multiplication; explicit offset local variants.
- title-08-signed-byte-1: {"tag": "title-08-signed-byte-1", "diffs": 65, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Signed byte-stride arithmetic retains CSE with the original signed name-index multiplication; explicit offset local variants.
- title-08-signed-byte-2: {"tag": "title-08-signed-byte-2", "diffs": 65, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Signed byte-stride arithmetic retains CSE with the original signed name-index multiplication; explicit offset local variants.
- title-08-signed-byte-3: {"tag": "title-08-signed-byte-3", "diffs": 65, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Signed byte-stride arithmetic retains CSE with the original signed name-index multiplication; explicit offset local variants.
- title-08-signed-byte-4: {"tag": "title-08-signed-byte-4", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Signed byte-stride arithmetic retains CSE with the original signed name-index multiplication; explicit offset local variants.
- title-08-signed-byte-5: {"tag": "title-08-signed-byte-5", "diffs": 65, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Signed byte-stride arithmetic retains CSE with the original signed name-index multiplication; explicit offset local variants.
- title-08-signed-byte-6: {"tag": "title-08-signed-byte-6", "diffs": 65, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Signed byte-stride arithmetic retains CSE with the original signed name-index multiplication; explicit offset local variants.
- title-08-signed-byte-7: {"tag": "title-08-signed-byte-7", "diffs": 65, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Signed byte-stride arithmetic retains CSE with the original signed name-index multiplication; explicit offset local variants.
- title-08-signed-byte-8: {"tag": "title-08-signed-byte-8", "diffs": 47, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Signed byte-stride arithmetic retains CSE with the original signed name-index multiplication; explicit offset local variants.
- title-08-signed-byte-9: {"tag": "title-08-signed-byte-9", "diffs": 47, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Signed byte-stride arithmetic retains CSE with the original signed name-index multiplication; explicit offset local variants.
## Allocator evidence
hasChannel capture: `/mnt/drive2/projects/wii-ipl-workers/_mwdbg/runs/hasChannel__Q33ipl8savedata7ManagerCFUxPiPi-20261008-204333`. Simulator reproduces 53/53 virtual registers. Baseline full-mask low/high are r46/r47 -> r9/r0; target r10/r9. Row-base r45 -> r10; target r0. Region-mask constants r58/r59 -> r10/r4; target r4/r0. All other target assignments agree.
The shared vmap2 helper emitted numeric --want entries, but installed regsim only accepted names. A temporary copy `/tmp/sol-ph1-regsim.py` added numeric identifiers. With all 29 mapped operands wanted, it found 29/29 after reordering named nodes including compiler-generated temporaries. That is a diagnostic possible coloring, not an implementable local-declaration recipe: @17329/@17332 are generated full-mask/row-base temporaries. Inline accessors, C89 declarations, parameter copies and comparison helpers did not realize that numbering. Tool source was untouched.
getTitleName debugger attempt was queued behind the shared debugger lock for more than 100 seconds. Only this worker own queued process was terminated before it started compiling; no other process was touched. Target Ghidra and odiff evidence were available locally. The four baseline differences at instructions 17-20 come from C forming metadata + language stride before adding name stride; target combines name + language strides before metadata. The signed-byte-4 trial reduced this to one difference and is under further investigation. The fallback loop and all returns match.
- title-09-one-add-0: {"tag": "title-09-one-add-0", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preserve signed name byte stride and unsigned language byte stride; reverse pointer-add operands or use conventional casts.
- title-09-one-add-1: {"tag": "title-09-one-add-1", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preserve signed name byte stride and unsigned language byte stride; reverse pointer-add operands or use conventional casts.
- title-09-one-add-2: {"tag": "title-09-one-add-2", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preserve signed name byte stride and unsigned language byte stride; reverse pointer-add operands or use conventional casts.
- title-09-one-add-3: {"tag": "title-09-one-add-3", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preserve signed name byte stride and unsigned language byte stride; reverse pointer-add operands or use conventional casts.
- title-09-one-add-4: {"tag": "title-09-one-add-4", "diffs": 5, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preserve signed name byte stride and unsigned language byte stride; reverse pointer-add operands or use conventional casts.
- title-09-one-add-5: {"tag": "title-09-one-add-5", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preserve signed name byte stride and unsigned language byte stride; reverse pointer-add operands or use conventional casts.
- title-09-one-add-6: {"tag": "title-09-one-add-6", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preserve signed name byte stride and unsigned language byte stride; reverse pointer-add operands or use conventional casts.
- title-09-one-add-7: {"tag": "title-09-one-add-7", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preserve signed name byte stride and unsigned language byte stride; reverse pointer-add operands or use conventional casts.
- title-09-one-add-8: {"tag": "title-09-one-add-8", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preserve signed name byte stride and unsigned language byte stride; reverse pointer-add operands or use conventional casts.
- title-09-one-add-9: {"tag": "title-09-one-add-9", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Preserve signed name byte stride and unsigned language byte stride; reverse pointer-add operands or use conventional casts.
- title-10-one-local-0: {"tag": "title-10-one-local-0", "diffs": 9, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Named pointer/combined stride local or byte-array indexing preserves the single grouped address expression.
- title-10-one-local-1: {"tag": "title-10-one-local-1", "diffs": 59, "insns": [73, 71], "sizes": [292, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Named pointer/combined stride local or byte-array indexing preserves the single grouped address expression.
- title-10-one-local-2: {"tag": "title-10-one-local-2", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Named pointer/combined stride local or byte-array indexing preserves the single grouped address expression.
- title-10-one-local-3: {"tag": "title-10-one-local-3", "diffs": 7, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Named pointer/combined stride local or byte-array indexing preserves the single grouped address expression.
- title-10-one-local-4: {"tag": "title-10-one-local-4", "diffs": 59, "insns": [73, 71], "sizes": [292, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Named pointer/combined stride local or byte-array indexing preserves the single grouped address expression.
- title-10-one-local-5: {"tag": "title-10-one-local-5", "diffs": 59, "insns": [73, 71], "sizes": [292, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Named pointer/combined stride local or byte-array indexing preserves the single grouped address expression.
- title-10-one-local-6: {"tag": "title-10-one-local-6", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Named pointer/combined stride local or byte-array indexing preserves the single grouped address expression.
- title-10-one-local-7: {"tag": "title-10-one-local-7", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Named pointer/combined stride local or byte-array indexing preserves the single grouped address expression.
- title-10-one-local-8: {"tag": "title-10-one-local-8", "diffs": 56, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Named pointer/combined stride local or byte-array indexing preserves the single grouped address expression.
- title-10-one-local-9: {"tag": "title-10-one-local-9", "diffs": 56, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Named pointer/combined stride local or byte-array indexing preserves the single grouped address expression.
- title-10-one-local-10: {"tag": "title-10-one-local-10", "diffs": 56, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Named pointer/combined stride local or byte-array indexing preserves the single grouped address expression.
- title-10-one-local-11: {"tag": "title-10-one-local-11", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Named pointer/combined stride local or byte-array indexing preserves the single grouped address expression.
- title-10-one-local-12: {"tag": "title-10-one-local-12", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Named pointer/combined stride local or byte-array indexing preserves the single grouped address expression.
- title-10-one-local-13: {"tag": "title-10-one-local-13", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Named pointer/combined stride local or byte-array indexing preserves the single grouped address expression.
- title-11-one-helper-0: {"tag": "title-11-one-helper-0", "diffs": 53, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata-name predicate or serialized-name byte-stride helper using mixed signed name/unsigned language arithmetic.
- title-11-one-helper-1: {"tag": "title-11-one-helper-1", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata-name predicate or serialized-name byte-stride helper using mixed signed name/unsigned language arithmetic.
- title-11-one-helper-2: {"tag": "title-11-one-helper-2", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata-name predicate or serialized-name byte-stride helper using mixed signed name/unsigned language arithmetic.
- title-11-one-helper-3: {"tag": "title-11-one-helper-3", "diffs": 63, "insns": [73, 71], "sizes": [292, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata-name predicate or serialized-name byte-stride helper using mixed signed name/unsigned language arithmetic.
- title-11-one-helper-4: {"tag": "title-11-one-helper-4", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata-name predicate or serialized-name byte-stride helper using mixed signed name/unsigned language arithmetic.
- title-11-one-helper-5: {"tag": "title-11-one-helper-5", "diffs": 53, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata-name predicate or serialized-name byte-stride helper using mixed signed name/unsigned language arithmetic.
- title-11-one-helper-6: {"tag": "title-11-one-helper-6", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata-name predicate or serialized-name byte-stride helper using mixed signed name/unsigned language arithmetic.
- title-11-one-helper-7: {"tag": "title-11-one-helper-7", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata-name predicate or serialized-name byte-stride helper using mixed signed name/unsigned language arithmetic.
- title-11-one-helper-8: {"tag": "title-11-one-helper-8", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata-name predicate or serialized-name byte-stride helper using mixed signed name/unsigned language arithmetic.
- title-11-one-helper-9: {"tag": "title-11-one-helper-9", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata-name predicate or serialized-name byte-stride helper using mixed signed name/unsigned language arithmetic.
- title-11-one-helper-10: {"tag": "title-11-one-helper-10", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata-name predicate or serialized-name byte-stride helper using mixed signed name/unsigned language arithmetic.
- title-11-one-helper-11: {"tag": "title-11-one-helper-11", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Real metadata-name predicate or serialized-name byte-stride helper using mixed signed name/unsigned language arithmetic.
- title-12-layout-0: {"tag": "title-12-layout-0", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Diagnostic explicit serialized field layout or integer-address addition; retain only if readable source review passes.
- title-12-layout-1: {"tag": "title-12-layout-1", "diffs": 3, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Diagnostic explicit serialized field layout or integer-address addition; retain only if readable source review passes.
- title-12-layout-2: {"tag": "title-12-layout-2", "diffs": 1, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Diagnostic explicit serialized field layout or integer-address addition; retain only if readable source review passes.
- title-12-layout-3: {"tag": "title-12-layout-3", "diffs": 0, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Diagnostic explicit serialized field layout or integer-address addition; retain only if readable source review passes.
- title-13-cast-0: {"tag": "title-13-cast-0", "diffs": 0, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Pointer element/cast spelling, constness or signed-name-to-unsigned-offset conversion on the one-difference expression.
- title-14-clean-0: {"tag": "title-14-clean-0", "diffs": 2, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Readable preferred-name pointer or named array dimension constants; preserve byte-identical grouped offsets.
- title-14-clean-1: {"tag": "title-14-clean-1", "diffs": 0, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Readable preferred-name pointer or named array dimension constants; preserve byte-identical grouped offsets.
- title-14-clean-2: {"tag": "title-14-clean-2", "diffs": 0, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Readable preferred-name pointer or named array dimension constants; preserve byte-identical grouped offsets.
- title-14-clean-3: {"tag": "title-14-clean-3", "diffs": 0, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Readable preferred-name pointer or named array dimension constants; preserve byte-identical grouped offsets.
- title-14-clean-4: {"tag": "title-14-clean-4", "diffs": 0, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Readable preferred-name pointer or named array dimension constants; preserve byte-identical grouped offsets.
- title-14-clean-5: {"tag": "title-14-clean-5", "diffs": 0, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Readable preferred-name pointer or named array dimension constants; preserve byte-identical grouped offsets.
- title-14-clean-6: {"tag": "title-14-clean-6", "diffs": 65, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Readable preferred-name pointer or named array dimension constants; preserve byte-identical grouped offsets.
- title-14-clean-7: {"tag": "title-14-clean-7", "diffs": 0, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Readable preferred-name pointer or named array dimension constants; preserve byte-identical grouped offsets.
- title-14-clean-8: {"tag": "title-14-clean-8", "diffs": 0, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Readable preferred-name pointer or named array dimension constants; preserve byte-identical grouped offsets.
- title-14-clean-9: {"tag": "title-14-clean-9", "diffs": 0, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Readable preferred-name pointer or named array dimension constants; preserve byte-identical grouped offsets.
- title-15-final-readable: {"tag": "title-15-final-readable", "diffs": 0, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; Named preferred-name pointer with sizeof/offsetof of actual metadata fields, no numeric byte offsets or casts in the condition.
## Candidate retained
getTitleName: baseline C 4/71 -> 1/71 with signed name byte stride and unsigned language byte stride. Addressing the metadata header plus combined strides, then adding offsetof(SChanMgrMetaHeader, names), removed the final operand-order difference. Exact 0/71, 284/284 bytes. A real preferredName pointer local allowed conventional readable C casts while keeping exact output. Array extents and field offset come directly from the existing metadata declaration; no numeric layout constants, extra storage, dummy values, assembly or pragmas added. The lookup uses the same first character and returns the same original language/name pointer.
hasChannel: 50 compiled trials; best remains 12/71, 284/284 bytes. Saved `/mnt/drive2/projects/wii-ipl-workers/_luna-runs/best/sol-ph1.iplSaveDataManager.diff`; original asm restored byte-for-byte. No non-exact C retained. All temporary header accessors restored. Existing rx63 untracked files were left untouched.
Removed the getTitleName placeholder inventory row and decremented function/block/placeholder counts by one; refreshed the retained hasChannel evidence to the measured 12-difference C. Removed four asm-only external declarations from iplChannelManager.cpp.
## Final verification
Second getTitleName debugger run completed from an immutable `/tmp/sol-ph1-title-capture.cpp` at the one-difference candidate. Capture: `/mnt/drive2/projects/wii-ipl-workers/_mwdbg/runs/getTitleName__Q33ipl7channel7ManagerCFiii-20261008-205431`; sizes 284/284; only instruction 20 differs, `add r3,r0,r3` versus target `add r3,r3,r0`. The subsequent offsetof-after-strides form fixed the emitted operand order.
Inventory checker: expected FAIL solely for four remaining placeholders; coverage/counts are 166 functions, 168 bodies/blocks, 162 ORIGINAL, 4 PLACEHOLDER. No stale/duplicate/missing rows. getTitleName row is gone; hasChannel asm remains inventoried.
Final quick gate: PASS, full 43U build passed, DOL SHA1 `26116613f624061ba99c8d1a299aaa6efa85670d`. Zero regressions, zero net forbidden additions, zero readability warnings.
- iplChannelManager: 74/74 exact functions before and after; code 12552/12552, data 1080/1080, linked code 12552. Every owned section is 100%. getTitleName C++ replaces one retail-asm placeholder, 0/71 instructions differing, size 284/284.
- iplSaveDataManager: 35/35 exact functions before and after; code 7172/7172, data 968/968, linked code 7172. Every owned section is 100%. Original asm hasChannel remains unchanged.
- Gate output: `/tmp/sol-ph1-gate.txt`; inventory output: `/tmp/sol-ph1-inventory.txt`. Live gate report: `build/43U/report.json`.
After final formatting and removal of asm-only declarations: rebuilt `build/43U/ok` passed. Fresh odiff 0/71, size 284/284; ctxdiff diffs 0 with 71/71 instructions. Pools identical 9/9 and 3/3. DOL SHA1 remains correct. Fresh full objdiff report `/tmp/sol-ph1-finalreport.json` gives exact-name getTitleName fuzzy_match_percent 100.0, size 284.
GATE PASS
## Readability revision, HEAD 11bde428
Replace the rejected byte-offset lookup with ordinary typed indexing or a real accessor. Keep the asm inventory removal and all other functions exact. Each entry records a fresh object build, pool check, instruction diff, and sizes.
- readable-direct: {"tag": "direct", "diffs": 4, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t* preferredName = mChannels[page][index].metaHdr->names[System::getLanguage()][nameIndex];
- readable-row: {"tag": "row", "diffs": 64, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t (*row)[META_CHANNEL_NAME_LENGTH + 1] = mChannels[page][index].metaHdr->names[System::getLanguage()]; const wchar_t* preferredName = row[nameIndex];
- readable-row-language: {"tag": "row-language", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; int preferredLanguage = System::getLanguage(); const wchar_t (*row)[META_CHANNEL_NAME_LENGTH + 1] = mChannels[page][index].metaHdr->names[preferredLanguage]; const wchar_t* preferredName = row[nameIndex];
- readable-table: {"tag": "table", "diffs": 9, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; typedef wchar_t NameTable[SC_LANG_MAX][NAME_INDEX_MAX][META_CHANNEL_NAME_LENGTH + 1]; const NameTable* names = &mChannels[page][index].metaHdr->names; const wchar_t* preferredName = (*names)[System::getLanguage()][nameIndex];
- readable-table-after-language: {"tag": "table-after-language", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; typedef wchar_t NameTable[SC_LANG_MAX][NAME_INDEX_MAX][META_CHANNEL_NAME_LENGTH + 1]; int preferredLanguage = System::getLanguage(); const NameTable* names = &mChannels[page][index].metaHdr->names; const wchar_t* preferredName = (*names)[preferredLanguage][nameIndex];
- readable-table-ref: {"tag": "table-ref", "diffs": 9, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t (&names)[SC_LANG_MAX][NAME_INDEX_MAX][META_CHANNEL_NAME_LENGTH + 1] = mChannels[page][index].metaHdr->names; const wchar_t* preferredName = names[System::getLanguage()][nameIndex];
- readable-table-language-ref: {"tag": "table-language-ref", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; int preferredLanguage = System::getLanguage(); const wchar_t (&names)[SC_LANG_MAX][NAME_INDEX_MAX][META_CHANNEL_NAME_LENGTH + 1] = mChannels[page][index].metaHdr->names; const wchar_t* preferredName = names[preferredLanguage][nameIndex];
- readable-meta: {"tag": "meta", "diffs": 8, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const SChanMgrMetaHeader* meta = mChannels[page][index].metaHdr; const wchar_t* preferredName = meta->names[System::getLanguage()][nameIndex];
- readable-meta-after-language: {"tag": "meta-after-language", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; int preferredLanguage = System::getLanguage(); const SChanMgrMetaHeader* meta = mChannels[page][index].metaHdr; const wchar_t* preferredName = meta->names[preferredLanguage][nameIndex];
- readable-unsigned-language: {"tag": "unsigned-language", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; u32 preferredLanguage = System::getLanguage(); const wchar_t* preferredName = mChannels[page][index].metaHdr->names[preferredLanguage][nameIndex];
- readable-row-add: {"tag": "row-add", "diffs": 64, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t (*row)[META_CHANNEL_NAME_LENGTH + 1] = mChannels[page][index].metaHdr->names[System::getLanguage()]; const wchar_t* preferredName = *(nameIndex + row);
- readable-table-add: {"tag": "table-add", "diffs": 9, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t (*names)[NAME_INDEX_MAX][META_CHANNEL_NAME_LENGTH + 1] = mChannels[page][index].metaHdr->names; const wchar_t* preferredName = (*(System::getLanguage() + names))[nameIndex];
- readable-member-const-name-first: {"tag": "member-const-name-first", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t* preferredName = mChannels[page][index].metaHdr->getName(nameIndex, System::getLanguage());
- readable-member-const-lang-first: {"tag": "member-const-lang-first", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t* preferredName = mChannels[page][index].metaHdr->getName(System::getLanguage(), nameIndex);
- readable-member-name-ref: {"tag": "member-name-ref", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t* preferredName = mChannels[page][index].metaHdr->getName(nameIndex, System::getLanguage());
- readable-member-preferred: {"tag": "member-preferred", "compile": "FAIL"}; const wchar_t* preferredName = mChannels[page][index].metaHdr->getName(nameIndex);
- readable-member-unsigned-name: {"tag": "member-unsigned-name", "diffs": 68, "insns": [76, 71], "sizes": [304, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t* preferredName = mChannels[page][index].metaHdr->getName(nameIndex, System::getLanguage());
- readable-member-row: {"tag": "member-row", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t* preferredName = mChannels[page][index].metaHdr->getNames(System::getLanguage())[nameIndex];
- readable-entry-preferred: {"tag": "entry-preferred", "compile": "FAIL"}; const wchar_t* preferredName = mChannels[page][index].getName(nameIndex);
- readable-entry-ref-name-first: {"tag": "entry-ref-name-first", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t* preferredName = mChannels[page][index].getName(nameIndex, System::getLanguage());
- readable-entry-ref-lang-first: {"tag": "entry-ref-lang-first", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t* preferredName = mChannels[page][index].getName(System::getLanguage(), nameIndex);
- readable-reuse-language: {"tag": "reuse-language", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; language = System::getLanguage(); const wchar_t* preferredName = mChannels[page][index].metaHdr->names[language][nameIndex];
- readable-reuse-signed-language: {"tag": "reuse-signed-language", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; language = System::getLanguage(); const wchar_t* preferredName = mChannels[page][index].metaHdr->names[(int)language][nameIndex];
- readable-row-ref: {"tag": "row-ref", "diffs": 64, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t (&row)[NAME_INDEX_MAX][META_CHANNEL_NAME_LENGTH + 1] = mChannels[page][index].metaHdr->names[System::getLanguage()]; const wchar_t* preferredName = row[nameIndex];
- readable-meta-reference: {"tag": "meta-reference", "diffs": 7, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const SChanMgrMetaHeader& meta = *mChannels[page][index].metaHdr; const wchar_t* preferredName = meta.names[System::getLanguage()][nameIndex];
- readable-all-entry: {"tag": "all-entry", "compile": "FAIL"}; const wchar_t* preferredName = channel.metaHdr->names[System::getLanguage()][nameIndex];
- readable-predicate-direct: {"tag": "predicate-direct", "diffs": 4, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"};
- readable-reuse-predicate-direct: {"tag": "reuse-predicate-direct", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; language = System::getLanguage();
- readable-array-name-ref: {"tag": "array-name-ref", "diffs": 4, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t (&preferredName)[META_CHANNEL_NAME_LENGTH + 1] = mChannels[page][index].metaHdr->names[System::getLanguage()][nameIndex];
- readable-unsigned-name: {"tag": "unsigned-name", "diffs": 65, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t* preferredName = mChannels[page][index].metaHdr->names[System::getLanguage()][(u32)nameIndex];
- readable-member-preferred-cpp: {"tag": "member-preferred-cpp", "diffs": 13, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t* preferredName = mChannels[page][index].metaHdr->getName(nameIndex);
- readable-entry-preferred-cpp: {"tag": "entry-preferred-cpp", "diffs": 4, "insns": [71, 71], "sizes": [284, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t* preferredName = mChannels[page][index].getName(nameIndex);
- readable-entry-scoped: {"tag": "entry-scoped", "diffs": 70, "insns": [67, 71], "sizes": [268, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t* preferredName = channel.metaHdr->names[System::getLanguage()][nameIndex];
- readable-all-accessor-int-wchar_tptr: {"tag": "all-accessor-int-wchar_tptr", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t* preferredName = mChannels[page][index].metaHdr->names[System::getLanguage()][nameIndex];
- readable-all-accessor-u32-wchar_tptr: {"tag": "all-accessor-u32-wchar_tptr", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t* preferredName = mChannels[page][index].metaHdr->names[System::getLanguage()][nameIndex];
- readable-typed-flat-group: {"tag": "typed-flat-group", "diffs": 67, "insns": [75, 71], "sizes": [300, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t* preferredName = &mChannels[page][index].metaHdr->names[0][0][0] + (nameIndex * (META_CHANNEL_NAME_LENGTH + 1) + System::getLanguage() * NAME_INDEX_MAX * (META_CHANNEL_NAME_LENGTH + 1));
- readable-typed-flat-reversed: {"tag": "typed-flat-reversed", "diffs": 67, "insns": [75, 71], "sizes": [300, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t* preferredName = (nameIndex * (META_CHANNEL_NAME_LENGTH + 1) + System::getLanguage() * NAME_INDEX_MAX * (META_CHANNEL_NAME_LENGTH + 1)) + &mChannels[page][index].metaHdr->names[0][0][0];
- readable-row-signed-language: {"tag": "row-signed-language", "diffs": 64, "insns": [72, 71], "sizes": [288, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; const wchar_t (*row)[META_CHANNEL_NAME_LENGTH + 1] = mChannels[page][index].metaHdr->names[(int)System::getLanguage()]; const wchar_t* preferredName = row[nameIndex];
- readable-meta-reuse-language: {"tag": "meta-reuse-language", "diffs": 66, "insns": [74, 71], "sizes": [296, 284], "pool": "POOL IDENTICAL up to 9 (mine=9 base=9)"}; language = System::getLanguage(); const SChanMgrMetaHeader* meta = mChannels[page][index].metaHdr; const wchar_t* preferredName = meta->names[language][nameIndex];
### Readability revision outcome
39 trials; 36 compiled candidates; none exact. All successful builds retained identical pools, 9/9. Best normal array lookup remains 4/71 differing instructions, equal 284-byte size. Pointer-to-table, row, metadata, language local, shared language local, name reference, metadata accessor and entry accessor forms were tested. Inline accessor parameter ordering, signedness, reference returns, current-language accessors defined in the C++ file, and accessor use in all returns did not fix the association.
Best normal lookup: `const wchar_t* preferredName = mChannels[page][index].metaHdr->names[System::getLanguage()][nameIndex];`. Differences are instructions 17-20: language multiply destination r3 instead of r0, metadata load destination r0 instead of r3, base-plus-language before name offset, and resulting final add operands. Best source diff: `/tmp/sol-ph1-getTitleName-readable-best.diff`. Each full instruction diff is `/tmp/sol-ph1-readable-<tag>.txt`.
Restored the HEAD 11bde428 source and header exactly. The existing 0/71 byte-offset candidate and its asm inventory removal remain pending the orchestrator decision; this round found no accepted readable replacement. Header accessor experiments leave no changes in other units. Pre-existing untracked rx63 evidence remains untouched.
### Gate on restored exact candidate
Requested `gate.py src/system/iplChannelManager --quick`: GATE PASS. Full 43U build passed; DOL SHA1 `26116613f624061ba99c8d1a299aaa6efa85670d`. Unit unchanged at 74/74 instruction-exact functions, 12552/12552 code bytes, 1080/1080 data bytes, and all owned sections 100%. Zero regressions, net forbidden additions, and automatic readability warnings. The automated scan does not overturn the orchestrator rejection of the retained byte-offset expression. Fresh odiff 0/71, size 284/284; ctxdiff diffs 0, instructions 71/71; pool identical 9/9. Gate output `/tmp/sol-ph1-readable-gate.txt`. Commit only this log; no readable source candidate was accepted.

View File

@@ -0,0 +1,360 @@
# sol-ties attempts
Base 23b77a33, branch agent/w1008/rx1. No source edits initially.
Baseline: update 85/446, DeleteUnauthorizedData 74/449, equal sizes.
Both string pools identical. Tracer requires output beneath _mwdbg; first local-output attempt rejected before compilation.
ZI1 lift declarations in reverse requested virtual order: 32 differing. src size 0x6f8 base size 0x6f8
ZI2 u32 LatestWord[copied] = LatestWord[copied + (wordLength - copyLength)];: 32 differing. src size 0x6f8 base size 0x6f8
ZI3 u32 *(LatestWord + copied) = *(LatestWord + wordLength - copyLength + copied);: 215 differing. src size 0x700 base size 0x6f8
ZI4 u32 LatestWord[copied] = LatestWord[wordLength + copied - copyLength];: 233 differing. src size 0x744 base size 0x6f8
ZI5 u32 LatestWord[copied] = LatestWord[copied - copyLength + wordLength];: 232 differing. src size 0x748 base size 0x6f8
ZI6 s32 LatestWord[copied] = LatestWord[copied + (wordLength - copyLength)];: 216 differing. src size 0x6dc base size 0x6f8
ZI7 s32 *(LatestWord + copied) = *(LatestWord + wordLength - copyLength + copied);: 216 differing. src size 0x6c0 base size 0x6f8
ZI8 s32 LatestWord[copied] = LatestWord[wordLength + copied - copyLength];: 232 differing. src size 0x740 base size 0x6f8
ZI9 s32 LatestWord[copied] = LatestWord[copied - copyLength + wordLength];: 226 differing. src size 0x71c base size 0x6f8
ZI10 u16 LatestWord[copied] = LatestWord[copied + (wordLength - copyLength)];: 215 differing. src size 0x65c base size 0x6f8
ZI11 u16 *(LatestWord + copied) = *(LatestWord + wordLength - copyLength + copied);: 215 differing. src size 0x65c base size 0x6f8
ZI12 u16 LatestWord[copied] = LatestWord[wordLength + copied - copyLength];: 217 differing. src size 0x660 base size 0x6f8
ZI13 u16 LatestWord[copied] = LatestWord[copied - copyLength + wordLength];: 217 differing. src size 0x660 base size 0x6f8
ZI14 int LatestWord[copied] = LatestWord[copied + (wordLength - copyLength)];: 216 differing. src size 0x6dc base size 0x6f8
ZI15 int *(LatestWord + copied) = *(LatestWord + wordLength - copyLength + copied);: 216 differing. src size 0x6c0 base size 0x6f8
ZI16 int LatestWord[copied] = LatestWord[wordLength + copied - copyLength];: 232 differing. src size 0x740 base size 0x6f8
ZI17 int LatestWord[copied] = LatestWord[copied - copyLength + wordLength];: 226 differing. src size 0x71c base size 0x6f8
ZI18 copied != copyLength copied++: 216 differing. src size 0x6c0 base size 0x6f8
ZI19 copied != copyLength copied += 1: 216 differing. src size 0x6c0 base size 0x6f8
ZI20 copied != copyLength copied = copied + 1: 216 differing. src size 0x6c0 base size 0x6f8
ZI21 copyLength > copied copied++: 32 differing. src size 0x6f8 base size 0x6f8
ZI22 copyLength > copied copied += 1: 32 differing. src size 0x6f8 base size 0x6f8
ZI23 copyLength > copied copied = copied + 1: 32 differing. src size 0x6f8 base size 0x6f8
ZI24 pointer copy before ++source; ++destination; ++copied: 299 differing. src size 0x6d4 base size 0x6f8
ZI25 pointer copy before ++copied; ++destination; ++source: 299 differing. src size 0x6d4 base size 0x6f8
ZI26 pointer copy before ++destination; ++source; ++copied: 299 differing. src size 0x6d4 base size 0x6f8
ZI27 pointer copy after ++source; ++destination; ++copied: 299 differing. src size 0x6d4 base size 0x6f8
ZI28 pointer copy after ++copied; ++destination; ++source: 299 differing. src size 0x6d4 base size 0x6f8
ZI29 pointer copy after ++destination; ++source; ++copied: 299 differing. src size 0x6d4 base size 0x6f8
ZI30 element type (wchar_t*)LatestWord: 32 differing. src size 0x6f8 base size 0x6f8
ZI31 element type (unsigned short*)LatestWord: 32 differing. src size 0x6f8 base size 0x6f8
ZI32 swap wordLength copied: 32 differing. src size 0x6f8 base size 0x6f8
ZI33 swap copyLength wordLength: 32 differing. src size 0x6f8 base size 0x6f8
ZI34 swap copied copyLength: 32 differing. src size 0x6f8 base size 0x6f8
ZI35 while copy: 32 differing. src size 0x6f8 base size 0x6f8
ZI36 precompute offset: 201 differing. src size 0x6f4 base size 0x6f8
ZI37 source base indexing: 216 differing. src size 0x6f0 base size 0x6f8
ZI38 typed character temporary u16: 32 differing. src size 0x6f8 base size 0x6f8
ZI39 typed character temporary wchar_t: 32 differing. src size 0x6f8 base size 0x6f8
ZI40 inline suffix helper u16* word, u32 length, u32 wordLength u32: 19 differing. src size 0x6f8 base size 0x6f8
ZI41 inline suffix helper u16* word, u32 length, u32 wordLength void: 19 differing. src size 0x6f8 base size 0x6f8
ZI42 inline suffix helper u16* word, u32 wordLength, u32 length u32: 19 differing. src size 0x6f8 base size 0x6f8
ZI43 inline suffix helper u16* word, u32 wordLength, u32 length void: 19 differing. src size 0x6f8 base size 0x6f8
ZI44 parameter order ('u16* word', 'u32 length', 'u32 wordLength'): 19 differing. src size 0x6f8 base size 0x6f8
ZI45 parameter order ('u16* word', 'u32 wordLength', 'u32 length'): 19 differing. src size 0x6f8 base size 0x6f8
ZI46 parameter order ('u32 length', 'u16* word', 'u32 wordLength'): 19 differing. src size 0x6f8 base size 0x6f8
ZI47 parameter order ('u32 length', 'u32 wordLength', 'u16* word'): 19 differing. src size 0x6f8 base size 0x6f8
ZI48 parameter order ('u32 wordLength', 'u16* word', 'u32 length'): 19 differing. src size 0x6f8 base size 0x6f8
ZI49 parameter order ('u32 wordLength', 'u32 length', 'u16* word'): 19 differing. src size 0x6f8 base size 0x6f8
ZI50 helper copies ('wordLength',): 19 differing. src size 0x6f8 base size 0x6f8
ZI51 helper copies ('length',): 19 differing. src size 0x6f8 base size 0x6f8
ZI52 helper copies ('word',): 214 differing. src size 0x6f4 base size 0x6f8
ZI53 helper copies ('wordLength', 'length'): 19 differing. src size 0x6f8 base size 0x6f8
ZI54 helper copies ('length', 'wordLength'): 19 differing. src size 0x6f8 base size 0x6f8
ZI55 helper copies ('word', 'wordLength', 'length'): 218 differing. src size 0x6f4 base size 0x6f8
ZI56 helper copies ('length', 'word', 'wordLength'): 218 differing. src size 0x6f4 base size 0x6f8
ZI57 source/destination helper source[copied] order 0: 19 differing. src size 0x6f8 base size 0x6f8
ZI58 source/destination helper source[copied] order 1: 19 differing. src size 0x6f8 base size 0x6f8
ZI59 source/destination helper *(source + copied) order 0: 19 differing. src size 0x6f8 base size 0x6f8
ZI60 source/destination helper *(source + copied) order 1: 19 differing. src size 0x6f8 base size 0x6f8
ZI61 source/destination helper source[offset + copied] order 0: 19 differing. src size 0x6f8 base size 0x6f8
ZI62 source/destination helper source[offset + copied] order 1: 19 differing. src size 0x6f8 base size 0x6f8
ZI63 source/destination helper const source[copied] order 0: 19 differing. src size 0x6f8 base size 0x6f8
ZI64 source/destination helper const source[copied] order 1: 19 differing. src size 0x6f8 base size 0x6f8
ZI65 source/destination helper const *(source + copied) order 0: 19 differing. src size 0x6f8 base size 0x6f8
ZI66 source/destination helper const *(source + copied) order 1: 19 differing. src size 0x6f8 base size 0x6f8
ZI67 source/destination helper const source[offset + copied] order 0: 19 differing. src size 0x6f8 base size 0x6f8
ZI68 source/destination helper const source[offset + copied] order 1: 19 differing. src size 0x6f8 base size 0x6f8
ES1 titleId received by value and copied into last local: 116 differing. src size 0x704 base size 0x704
ZI69 helper offset before wordLength - length: 186 differing. src size 0x6f4 base size 0x6f8
ZI70 helper offset before wordLength + -length: 186 differing. src size 0x6f4 base size 0x6f8
ZI71 helper offset after wordLength - length: 186 differing. src size 0x6f4 base size 0x6f8
ZI72 helper offset after wordLength + -length: 186 differing. src size 0x6f4 base size 0x6f8
ZI73 helper expression word[copied + (wordLength - length)]: 19 differing. src size 0x6f8 base size 0x6f8
ZI74 helper expression word[wordLength + copied - length]: 232 differing. src size 0x744 base size 0x6f8
ZI75 helper expression *(word + (wordLength - length) + copied): 19 differing. src size 0x6f8 base size 0x6f8
ZI76 helper loop u32 remaining = length;: 216 differing. src size 0x6c4 base size 0x6f8
ZI77 helper loop u32 copied = 0;: 19 differing. src size 0x6f8 base size 0x6f8
ES2 reverse paired desired locals: 34 differing. src size 0x704 base size 0x704
ES3 forward paired desired locals: 158 differing. src size 0x704 base size 0x704
ES4 reverse paired desired by ref: 403 differing. src size 0x70c base size 0x704
ES5 forward paired desired by ref: 412 differing. src size 0x70c base size 0x704
ES6 reverse paired desired by pointer: 34 differing. src size 0x704 base size 0x704
ES7 forward paired desired by pointer: 158 differing. src size 0x704 base size 0x704
ES8 InitSavedata declarations ('titleIds', 'ret', 'ticketScratch', 'i'): 34 differing. src size 0x704 base size 0x704
ES9 Init declarations ('titleIds', 'ret', 'ticketScratch', 'i') and ticket order: 20 differing. src size 0x704 base size 0x704
ES10 InitSavedata declarations ('titleIds', 'ret', 'i', 'ticketScratch'): 30 differing. src size 0x704 base size 0x704
ES11 Init declarations ('titleIds', 'ret', 'i', 'ticketScratch') and ticket order: 16 differing. src size 0x704 base size 0x704
ES12 InitSavedata declarations ('titleIds', 'ticketScratch', 'ret', 'i'): 39 differing. src size 0x704 base size 0x704
ES13 Init declarations ('titleIds', 'ticketScratch', 'ret', 'i') and ticket order: 25 differing. src size 0x704 base size 0x704
ES14 InitSavedata declarations ('titleIds', 'ticketScratch', 'i', 'ret'): 39 differing. src size 0x704 base size 0x704
ES15 Init declarations ('titleIds', 'ticketScratch', 'i', 'ret') and ticket order: 25 differing. src size 0x704 base size 0x704
ES16 InitSavedata declarations ('titleIds', 'i', 'ret', 'ticketScratch'): 35 differing. src size 0x704 base size 0x704
ES17 Init declarations ('titleIds', 'i', 'ret', 'ticketScratch') and ticket order: 21 differing. src size 0x704 base size 0x704
ES18 InitSavedata declarations ('titleIds', 'i', 'ticketScratch', 'ret'): 39 differing. src size 0x704 base size 0x704
ES19 Init declarations ('titleIds', 'i', 'ticketScratch', 'ret') and ticket order: 25 differing. src size 0x704 base size 0x704
ES20 InitSavedata declarations ('ret', 'titleIds', 'ticketScratch', 'i'): 39 differing. src size 0x704 base size 0x704
ES21 Init declarations ('ret', 'titleIds', 'ticketScratch', 'i') and ticket order: 25 differing. src size 0x704 base size 0x704
ES22 InitSavedata declarations ('ret', 'titleIds', 'i', 'ticketScratch'): 35 differing. src size 0x704 base size 0x704
ES23 Init declarations ('ret', 'titleIds', 'i', 'ticketScratch') and ticket order: 21 differing. src size 0x704 base size 0x704
ES24 InitSavedata declarations ('ret', 'ticketScratch', 'titleIds', 'i'): 28 differing. src size 0x704 base size 0x704
ZI78 helper computes word length, local order 0 u16* word, u32 length: 2 differing. src size 0x6f8 base size 0x6f8
ZI79 helper computes word length, local order 0 u32 length, u16* word: 2 differing. src size 0x6f8 base size 0x6f8
ZI80 helper computes word length, local order 1 u16* word, u32 length: 2 differing. src size 0x6f8 base size 0x6f8
ZI81 helper computes word length, local order 1 u32 length, u16* word: 2 differing. src size 0x6f8 base size 0x6f8
ES25 Init declarations ('ret', 'ticketScratch', 'titleIds', 'i') and ticket order: 14 differing. src size 0x704 base size 0x704
ES26 InitSavedata declarations ('ret', 'ticketScratch', 'i', 'titleIds'): 39 differing. src size 0x704 base size 0x704
ES27 Init declarations ('ret', 'ticketScratch', 'i', 'titleIds') and ticket order: 25 differing. src size 0x704 base size 0x704
ES28 InitSavedata declarations ('ret', 'i', 'titleIds', 'ticketScratch'): 24 differing. src size 0x704 base size 0x704
ES29 Init declarations ('ret', 'i', 'titleIds', 'ticketScratch') and ticket order: 10 differing. src size 0x704 base size 0x704
ES30 InitSavedata declarations ('ret', 'i', 'ticketScratch', 'titleIds'): 39 differing. src size 0x704 base size 0x704
ES31 Init declarations ('ret', 'i', 'ticketScratch', 'titleIds') and ticket order: 25 differing. src size 0x704 base size 0x704
ES32 InitSavedata declarations ('ticketScratch', 'titleIds', 'ret', 'i'): 39 differing. src size 0x704 base size 0x704
ES33 Init declarations ('ticketScratch', 'titleIds', 'ret', 'i') and ticket order: 25 differing. src size 0x704 base size 0x704
ES34 InitSavedata declarations ('ticketScratch', 'titleIds', 'i', 'ret'): 39 differing. src size 0x704 base size 0x704
ES35 Init declarations ('ticketScratch', 'titleIds', 'i', 'ret') and ticket order: 25 differing. src size 0x704 base size 0x704
ES36 InitSavedata declarations ('ticketScratch', 'ret', 'titleIds', 'i'): 23 differing. src size 0x704 base size 0x704
ZI82 key copy loop iteration ++keyIndex, keyOutput += 0x40: 2 differing. src size 0x6f8 base size 0x6f8
ZI83 key copy loop iteration keyOutput += 0x40, ++keyIndex: 2 differing. src size 0x6f8 base size 0x6f8
ZI84 key copy loop body index then output: 2 differing. src size 0x6f8 base size 0x6f8
ES37 Init declarations ('ticketScratch', 'ret', 'titleIds', 'i') and ticket order: 9 differing. src size 0x704 base size 0x704
ES38 InitSavedata declarations ('ticketScratch', 'ret', 'i', 'titleIds'): 34 differing. src size 0x704 base size 0x704
ES39 Init declarations ('ticketScratch', 'ret', 'i', 'titleIds') and ticket order: 20 differing. src size 0x704 base size 0x704
ES40 InitSavedata declarations ('ticketScratch', 'i', 'titleIds', 'ret'): 28 differing. src size 0x704 base size 0x704
ES41 Init declarations ('ticketScratch', 'i', 'titleIds', 'ret') and ticket order: 14 differing. src size 0x704 base size 0x704
ES42 InitSavedata declarations ('ticketScratch', 'i', 'ret', 'titleIds'): 39 differing. src size 0x704 base size 0x704
ES43 Init declarations ('ticketScratch', 'i', 'ret', 'titleIds') and ticket order: 25 differing. src size 0x704 base size 0x704
ES44 InitSavedata declarations ('i', 'titleIds', 'ret', 'ticketScratch'): 32 differing. src size 0x704 base size 0x704
ES45 Init declarations ('i', 'titleIds', 'ret', 'ticketScratch') and ticket order: 18 differing. src size 0x704 base size 0x704
ES46 InitSavedata declarations ('i', 'titleIds', 'ticketScratch', 'ret'): 36 differing. src size 0x704 base size 0x704
ES47 Init declarations ('i', 'titleIds', 'ticketScratch', 'ret') and ticket order: 22 differing. src size 0x704 base size 0x704
ES48 InitSavedata declarations ('i', 'ret', 'titleIds', 'ticketScratch'): 16 differing. src size 0x704 base size 0x704
ES49 Init declarations ('i', 'ret', 'titleIds', 'ticketScratch') and ticket order: 2 differing. src size 0x704 base size 0x704
ES50 InitSavedata declarations ('i', 'ret', 'ticketScratch', 'titleIds'): 31 differing. src size 0x704 base size 0x704
ES51 Init declarations ('i', 'ret', 'ticketScratch', 'titleIds') and ticket order: 17 differing. src size 0x704 base size 0x704
ES52 InitSavedata declarations ('i', 'ticketScratch', 'titleIds', 'ret'): 25 differing. src size 0x704 base size 0x704
ES53 Init declarations ('i', 'ticketScratch', 'titleIds', 'ret') and ticket order: 11 differing. src size 0x704 base size 0x704
ES54 InitSavedata declarations ('i', 'ticketScratch', 'ret', 'titleIds'): 36 differing. src size 0x704 base size 0x704
ES55 Init declarations ('i', 'ticketScratch', 'ret', 'titleIds') and ticket order: 22 differing. src size 0x704 base size 0x704
ES56 initialize valid before j: 0 differing. src size 0x704 base size 0x704
ZI85 key source expression *(static_cast<keyboard::cellphonetype::PaneNameToCharCode*>(mpHoldingKey)->wc + keyIndex - 1): 2 differing. src size 0x6f8 base size 0x6f8
ZI86 key source expression static_cast<keyboard::cellphonetype::PaneNameToCharCode*>(mpHoldingKey)->wc[-1 + keyIndex]: 2 differing. src size 0x6f8 base size 0x6f8
ZI87 key source expression (static_cast<keyboard::cellphonetype::PaneNameToCharCode*>(mpHoldingKey)->wc - 1)[keyIndex]: 2 differing. src size 0x6f8 base size 0x6f8
ZI88 key source expression static_cast<keyboard::cellphonetype::PaneNameToCharCode*>(mpHoldingKey)->wc[keyIndex + -1]: 2 differing. src size 0x6f8 base size 0x6f8
ZI89 swap keyOutput declaration with keyIndex: 15 differing. src size 0x6f8 base size 0x6f8
ZI90 swap keyOutput declaration with keyCharacter: 2 differing. src size 0x6f8 base size 0x6f8
ZI91 swap keyOutput declaration with koreanOutput: 2 differing. src size 0x6f8 base size 0x6f8
ZI92 swap keyOutput declaration with index: 35 differing. src size 0x6f8 base size 0x6f8
ZI93 swap keyOutput declaration with source: 30 differing. src size 0x6f8 base size 0x6f8
ZI94 swap keyOutput declaration with elementCount: 44 differing. src size 0x6f8 base size 0x6f8
ZI95 key destination increment keyOutput = keyOutput + 0x40: 2 differing. src size 0x6f8 base size 0x6f8
ZI96 key destination increment keyOutput = 0x40 + keyOutput: 2 differing. src size 0x6f8 base size 0x6f8
ZI97 key destination increment keyOutput += 64: 2 differing. src size 0x6f8 base size 0x6f8
ZI98 preincrement key destination: 347 differing. src size 0x6f4 base size 0x6f8
ZI99 key destination base plus indexed offset: 353 differing. src size 0x6f4 base size 0x6f8
ZI100 key destination indexed by keyIndex: 0 differing. src size 0x6f8 base size 0x6f8
Both requested functions reached zero differing with equal size. ZI100 also indexes the key output by keyIndex, removing the final induction-update scheduling pair. ES56 initializes valid before j, removing its final scheduling pair. No configure status change yet; unit-wide checks follow.
Unit-wide objdiff after the exact source edits: tiZiString 29/29 functions, 5504/5504 code, 7680/7680 data, every section 100%; iplESMisc 31/31 functions, 11200/11200 code, 4416/4416 data, every section 100%. Pools identical; ctxdiff update 446/446 instructions, diffs 0; DeleteUnauthorizedData 449/449 instructions, diffs 0. Both configure entries changed to Matching.
Initial full gate failed despite all owned code/data exact: DOL a9c0db300b393a94c498af7a6ef5a710f804edcb. Isolating configure entries showed tiZiString linking preserves the failure hash; both NonMatching restore the target hash. dtk dol diff proved checkForNullTermination and DeleteUnauthorizedData were emitted in reverse object order. Reordered these two definitions to symbols.txt order without changing their bodies.
Final gate after definition-order repair:
```text
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[src/keyboard/tiZiString] pool: IDENTICAL
[src/keyboard/tiZiString] objdiff: code 5504/5504 data 7680/7680 functions 29/29 fuzzy 100.0000 linked code 5504
[src/keyboard/tiZiString] instruction-exact functions: 29/29
[src/keyboard/tiZiString] section .bss size 7296 match 100.0
[src/keyboard/tiZiString] section .data size 328 match 100.0
[src/keyboard/tiZiString] section .rodata size 56 match 100.0
[src/keyboard/tiZiString] section .text size 5504 match 100.0
[src/keyboard/tiZiString] baseline: code 3720/5504 data 7680 functions 28 fuzzy 99.4717
[src/utility/iplESMisc] pool: IDENTICAL
[src/utility/iplESMisc] objdiff: code 11200/11200 data 4416/4416 functions 31/31 fuzzy 100.0000 linked code 11200
[src/utility/iplESMisc] instruction-exact functions: 31/31
[src/utility/iplESMisc] section .data size 4384 match 100.0
[src/utility/iplESMisc] section .sdata size 32 match 100.0
[src/utility/iplESMisc] section .text size 11200 match 100.0
[src/utility/iplESMisc] baseline: code 9404/11200 data 4416 functions 30 fuzzy 99.8625
regressions vs baseline: 0
global matched_code_percent: 97.29338 -> 97.41291
global fuzzy_match_percent: 99.88914 -> 99.89063
global complete_code_percent: 88.00925 -> 88.56695
global matched_data_percent: 100.00000 -> 100.00000
forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
note: config touched: configure.py (orchestrator reviews every config/symbols change)
GATE PASS
```
Final ctxdiff: update 446/446, diffs 0; DeleteUnauthorizedData 449/449, diffs 0. Both exact and linked.
Allocator captures: baseline tiZiString `_mwdbg/runs/update__Q39textinput8tistring6WithZiFv-20261008-193010`; ordered locals `...-20261008-193122`; baseline iplESMisc `_mwdbg/runs/DeleteUnauthorizedData__Q33ipl7utility6ESMiscFPQ23EGG4Heap-20261008-193201`; titleId-copy `...-20261008-193510`. Baseline regsim reproduces 161/161. Paired titleId constrained simulation found 64/64 wants. Generated trial scripts, reports and raw logs are retained locally under build/sol-ties.
ES exact implementation and its Matching entry committed as 0b3c7842. tiZiString exact implementation and its Matching entry follow in a separate commit. The final gate above covers the combined tree.

View File

@@ -182,12 +182,10 @@ class WorkflowGuardTests(unittest.TestCase):
failures = check_report(report)
self.assertFalse(any("enc_dummy section .sbss" in failure for failure in failures))
@unittest.skipUnless(
(Path(__file__).resolve().parents[1] / "build/43U/report.json").is_file(),
"generated 43U report is not available",
)
def test_complete_report_schema_passes(self):
def complete_report(self):
report_path = Path(__file__).resolve().parents[1] / "build/43U/report.json"
if not report_path.is_file():
self.skipTest("generated 43U report is not available")
report = copy.deepcopy(json.loads(report_path.read_text(encoding="utf-8")))
def fill(measures):
@@ -230,7 +228,36 @@ class WorkflowGuardTests(unittest.TestCase):
function["fuzzy_match_percent"] = 100.0
for category in report["categories"]:
fill(category["measures"])
self.assertEqual(check_report(report), [])
return report
def test_complete_report_schema_passes(self):
self.assertEqual(check_report(self.complete_report()), [])
def test_missing_or_extra_unit_fails(self):
for total_units in (1027, 1029):
with self.subTest(total_units=total_units):
report = self.complete_report()
if total_units == 1027:
report["units"].pop()
else:
extra = copy.deepcopy(report["units"][-1])
extra["name"] += "/extra"
report["units"].append(extra)
failures = check_report(report)
self.assertIn(f"unit report length: {total_units}", failures)
self.assertIn(f"unit aggregate total_units: {total_units} != 1028", failures)
def test_wrong_unit_totals_fail(self):
for total_units in (1027, 1029):
with self.subTest(total_units=total_units):
report = self.complete_report()
delta = total_units - 1028
for field in ("total_units", "complete_units"):
report["measures"][field] = total_units
report["categories"][0]["measures"][field] += delta
failures = check_report(report)
self.assertIn(f"overall total_units: {total_units} != 1028", failures)
self.assertIn(f"category total_units: {total_units} != 1028", failures)
@unittest.skipUnless(
(Path(__file__).resolve().parents[1] / "build/43U/report.json").is_file(),