Compare commits

...

67 Commits

Author SHA1 Message Date
coah
a788f2bdc0 decomp: pair array destructor, name StandData, real Queue push/pop (section scores 100%) (worker 674f53ed) 2026-10-09 14:26:35 +00:00
coah
f1d824acd9 refactor(tistring): structured mode dispatch in inputChar (bytes identical) (worker 475dbc53) (#1334) 2026-10-09 09:21:12 -05:00
coah
f393788bb9 decomp(inputform): anonymous .sdata2 literal symbols (tiInputForm data 100%) (worker 73353bfe) (#1333) 2026-10-09 09:09:12 -05:00
coah
da26714711 decomp(inputform): link tiInputForm (target definition order, vtable ownership, Sample class, dead-stripped helper stand-in) (worker c64933ad) (#1332) 2026-10-09 08:55:57 -05:00
coah
5d4b208246 decomp(aosslink): match AOSSi_WLANConnect and link AOSSLink (worker 00db7515) (#1331) 2026-10-09 08:51:57 -05:00
coah
0cffbfe4bf decomp(aoss): match AOSS_Init_old and link AOSS (worker 314d14fa) (#1330) 2026-10-09 07:40:50 -05:00
coah
12e857a9e2 decomp(inputform): match LayoutByNW4R::create (tiInputForm 221/221 exact) (worker f17f914e) (#1329) 2026-10-09 07:38:59 -05:00
coah
a8ac234de8 decomp(aterm): match ATERMBuildEncryptedMessage and link ATERM (worker 9fa262e0) (#1328) 2026-10-09 07:11:31 -05:00
coah
60febe20c3 decomp(cardseq): match cardThreadMain and loadCardFileIcons, link iplCardSequence (worker 08b78368) (#1327) 2026-10-09 06:45:58 -05:00
coah
b275eb2d99 decomp(chansvm): match CHANSVmStep and link CHANSVm (worker 8450a30c) (#1326) 2026-10-09 06:24:49 -05:00
coah
e47a8e949d decomp(inputform): match calcCursorPos (worker 1e6320d6) (#1325) 2026-10-09 06:20:46 -05:00
coah
fa7f4c26e8 decomp(jpeg): match IdctBlock_Lumi and IdctBlock_Col, link idct_block_var (worker 913878d1) (#1324) 2026-10-09 06:05:24 -05:00
coah
239334ba8d decomp: match pdm_part_is_master_boot_sector and __nupParseServerInfo, link pdm_partition and nup (worker d1576e7c) (#1323) 2026-10-09 05:45:45 -05:00
coah
179cd4e3c3 decomp(jpeg): idct Lumi 97.5 -> 99.7, Col 96.4 -> 97.9 (worker 6ed06b9b) (#1322) 2026-10-09 05:10:49 -05:00
coah
09fc62528e decomp(chansvm): CHANSVmStep structure (262 -> 2 diffs) (worker eb0b9287) (#1321) 2026-10-09 05:00:28 -05:00
coah
dbbdc3dd98 decomp(aoss): AOSS_Init_old 97.39 -> 97.60 (worker af8da67d) (#1320) 2026-10-09 04:21:52 -05:00
coah
4789b7c32f decomp(tistring): inputChar output builder newline handling (73 -> 13) (worker 05e02e12) (#1319) 2026-10-09 04:20:27 -05:00
coah
ad5b9deae3 decomp(cardseq): loadCardFileIcons structure (126 -> 2 diffs) (worker 0deb8cbb) (#1318) 2026-10-09 03:51:54 -05:00
coah
5046adc6da decomp(inputform): calcCursorPos and create structure (93.05 -> 99.88, 96.40 -> 98.16) (worker 00d2d4a1) (#1317) 2026-10-09 03:49:47 -05:00
coah
87214ff944 decomp(aoss): AOSS_Init_old defaults and config structure (96.62 -> 97.39) (worker 43bb6fd6) (#1316) 2026-10-09 03:36:36 -05:00
coah
54ca052b41 decomp(chansvm): VmWinEmuWrite, VmBlobGetHexString, VmBlobPackCommon (worker 8b58ab2f) (#1315) 2026-10-09 03:16:32 -05:00
coah
2ce8487681 decomp(aosslink): match AOSSi_WLANGetBSSList (worker 0f859ab6) (#1314) 2026-10-09 03:15:16 -05:00
coah
47fe453260 decomp(sdmemory): match drawTransferTitles and link iplSDMemory; loadCardFileIcons 213 -> 126 (worker 76898382) (#1313) 2026-10-09 03:14:07 -05:00
coah
2d4cfa7094 decomp(mcm): match _create_icon and link iplMemoryCardManager; pdm MBR reads (worker a7a698b7) (#1312) 2026-10-09 03:12:24 -05:00
coah
e27d9e090a decomp(aes): match AESiEncryptBlock and AESiDecryptBlock, link aes; idct dataflow (worker 33aab024) (#1311) 2026-10-09 03:11:17 -05:00
coah
983a6a2448 decomp(aterm): match DiscoverAccessPoints, BuildAssociationRequest, RunConfigProtocol (worker 228733c3) (#1310) 2026-10-09 01:00:02 -05:00
coah
c1e1157d8b decomp(bs2): match BS2Tick and link BS2Mach (per-use volatile DVDCommandBlock state, Dolphin SDK idiom) (worker 5aba8e21) (#1309) 2026-10-09 00:51:31 -05:00
coah
005d3734f0 decomp(bs2): match CheckBS2CommandStatus, BS2Tick 57 -> 4 (local statics, u64 globals, proven volatile flags) (worker dc077f2a) (#1308) 2026-10-09 00:09:20 -05:00
coah
55891734ae fix(chansvm): use compatible const converter callback types (#1307) 2026-10-08 22:46:39 -05:00
coah
20cf9f9f25 decomp(aterm): GC/3.0a5 build, AutoConfigThread and AES key expansion exact (worker b7300afa) (#1306) 2026-10-08 22:25:25 -05:00
coah
2a7cc791b1 decomp(sdmemory): drawTransferTitles via MSL wcsstr overload and TextBox::SetTextColor (363->50) (worker 9b634499) (#1305) 2026-10-08 22:23:33 -05:00
coah
b2c43f5a66 decomp(chansvm): ConvertToFloatFromStr const source, VmDateDtor scoped tables (worker db63d910) (#1304) 2026-10-08 22:22:23 -05:00
coah
d9b8013644 decomp(aoss): match AOSSXorBufferWithKey (worker 8c6b3076) (#1303) 2026-10-08 22:20:46 -05:00
coah
40b87edd73 fix(odh): preserve unsigned refills and defer planar addressing (#1302) 2026-10-08 21:45:46 -05:00
coah
3d7e767cf7 decomp(odh): match LineConv11 and huffmanDecoder, link odh (worker 9b2c5837) (#1301) 2026-10-08 21:32:36 -05:00
coah
10146c1b5f decomp(candidatebox): match createAnmPane_ and link tiCandidateBox (worker 6dca7c84) (#1300) 2026-10-08 21:23:21 -05:00
coah
82783c6edb decomp(bs2): match UpdateThread and link BS2Update (Flags0 as function-local static) (worker 85186112) (#1299) 2026-10-08 21:19:40 -05:00
coah
72e9c8d658 decomp(kbd): match kbdProcMod and link kbd_lib (worker 86bbfe55) (#1298) 2026-10-08 20:55:10 -05:00
coah
0062d65a27 decomp(chansvm): VmBlobPackCommon per-phase locals (230 -> 47) (worker 69c0cd0d) (#1297) 2026-10-08 20:01:19 -05:00
coah
f67d537e0b decomp(aoss): AOSS_Init_old poll timeout, IPv4 retry and receive setup (worker a98a7fb9) (#1296) 2026-10-08 19:38:50 -05:00
coah
2d169c59cf decomp(bs2): BS2Tick data TOC and banner locals (71 -> 57) (worker 3aedfb87) (#1295) 2026-10-08 19:32:30 -05:00
coah
bbd98e1e4a decomp(cardseq): loadCardFileIcons shift declaration order (219 -> 213) (worker a86634fb) (#1294) 2026-10-08 19:25:17 -05:00
coah
838b6cb941 decomp(aterm): typed progress record and recovered AES/Discovery/Protocol structure (worker 5a9a04c6) (#1293) 2026-10-08 19:23:50 -05:00
coah
9936f0a9ed decomp(sdmemory): drawTransferTitles loop and color structure (93.5% -> 97.4%) (worker 98663b5c) (#1292) 2026-10-08 19:16:09 -05:00
coah
a0659667d9 decomp: replace FAT12 and WAD carrier structs with real structure (worker 08e4cf26) (#1291) 2026-10-08 19:13:50 -05:00
coah
e6837211c1 decomp(cardseq): cardThreadMain stack layout and loadCardFileIcons structure (13->2, 436->219) (worker a52643c9) (#1290) 2026-10-08 19:01:16 -05:00
coah
ebf00fbce2 decomp: remove seven carrier structs (integrity audit) (worker 6bb740cf) (#1289) 2026-10-08 18:52:25 -05:00
coah
a2bc1d564a decomp(candidatebox): createAnmPane_ animation count local (41 -> 6 diffs) (worker 23edcd69) (#1288) 2026-10-08 18:49:24 -05:00
coah
da1c3b7ff8 decomp(address): link iplAddressEdit (definition order, get_button_no table) (worker d1e93825) (#1287) 2026-10-08 18:45:56 -05:00
coah
710174c707 decomp(aoss): match AOSSApplyAuthOptions (worker ee283116) (#1286) 2026-10-08 18:43:52 -05:00
coah
b66bd1ed67 decomp(cardseq): replace loadCardFileIcons carrier struct with ordinary locals (worker 875b5945) (#1285) 2026-10-08 18:41:38 -05:00
coah
ca6529e656 decomp(tmc_jpeg): match YUV411toRGBA8 and link Texture_MCUtoRGBA8 (worker 8b4ebb68) (#1284) 2026-10-08 18:39:40 -05:00
coah
44dea2d510 decomp(chansvm): replace CHANSVmStep scratch carrier with ordinary locals (worker a5c7fcf7) (#1283) 2026-10-08 18:36:34 -05:00
coah
f034087510 decomp(kbd): match KBDSetModState (worker ccab9f40) (#1282) 2026-10-08 18:34:41 -05:00
coah
fa8632368e decomp: replace balloon margin comma-expression hack with TextBalloon::getDefaultMargin getters (worker 383d17df) (#1281) 2026-10-08 18:28:39 -05:00
coah
dc7725eb2d decomp(address): match AddressEdit::create (worker 68baf5e3) (#1280) 2026-10-08 18:26:09 -05:00
coah
0b67e647ba decomp(cardseq): replace cardThreadMain carrier struct with ordinary locals (worker f9bdf29a) (#1279) 2026-10-08 18:23:29 -05:00
coah
b1e911808f decomp(bs2): replace UpdateThread scratch carrier with ordinary locals (worker 7af05191) (#1278) 2026-10-08 18:18:28 -05:00
coah
c723136fb4 decomp(address): match AddressEdit get_friendinfo and update_friendinfo (IRO level 1) (worker f6d94897) (#1277) 2026-10-08 17:58:52 -05:00
coah
a65cd4cb73 decomp(kbd): match kbd_led_handler (IRO level 0) (worker 429bb2a5) (#1276) 2026-10-08 17:44:05 -05:00
coah
2ca94fe4d3 decomp(www): match wiisetting Getter_ and link www_wiisetting (worker 16251338) (#1275) 2026-10-08 17:38:39 -05:00
coah
d558bb14ca decomp(bs2): match BS2StartGame with a typed reset-register view (worker afeef983) (#1274) 2026-10-08 17:31:16 -05:00
coah
6604f7319c decomp(tmc_jpeg): match texture converter setters (optimization_level 1); link RGB565 and Y8U8V8 (worker dd13a763) (#1273) 2026-10-08 17:24:13 -05:00
coah
426c03386e decomp(sdmemory): match SDMemory::create (IRO level 1, cached-title count helper) (worker dc9faaab) (#1272) 2026-10-08 17:23:15 -05:00
coah
7152b04d83 refactor(aterm): write the AutoConfigThread state select as a plain conditional (worker 8747dfc5) (#1271) 2026-10-08 17:07:23 -05:00
devin-ai-integration[bot]
0155de3e71 match(tiPcKeyboard): Base::setTranslateMode byte-identical (#1270)
keyMode must be uninitialized: for mode outside {0,1,2} the switch
leaves it unset and retail provably reads the uninitialized register
(cmplw r31,r0 at 0xd6c executes with r31 never stored). Initializing
keyMode = mode changes the dispatch to an extra branch. Same accepted
uninitialized-read pattern as set_err_msg.

Also documents two probe results in tools/decomp-assist attempts files
(iplSetting scanAP inlined-bool materialization wall; tiString inputChar
indexed-store/dead-compare fossil).

Co-authored-by: devin <devin@cognition.ai>
Co-authored-by: coah80 <usernamecole7@gmail.com>
2026-10-08 17:06:00 -05:00
coah
9321a926cf fix: account for AOSSData in strict completion unit count (#1269) 2026-10-08 16:18:19 -05:00
123 changed files with 35767 additions and 7464 deletions

View File

@@ -42,7 +42,7 @@ AppLoaderHdr = .bss:0x810ABF40; // type:object size:0x20 align:32 data:4byte
bi2 = .bss:0x810ABF60; // type:object size:0x2000 align:32 data:4byte
UpdateDiskID = .bss:0x810ADF60; // type:object size:0x20 align:32 data:4byte
TicketViewsBuf = .bss:0x810ADF80; // type:object size:0x3600 scope:local align:32
Flags0 = .bss:0x810B1580; // type:object size:0x800 scope:local
Flags0$1129 = .bss:0x810B1580; // type:object size:0x800 scope:local
Flags1 = .bss:0x810B1D80; // type:object size:0x800 scope:local
Thread = .bss:0x810B2580; // type:object size:0x318 scope:local
UpdateHeader0 = .bss:0x810B38A0; // type:object size:0x20 scope:local
@@ -2524,7 +2524,7 @@ __ct__Q33ipl3snd10tagSSeInfoFv = .text:0x8136C63C; // type:function size:0x30
__ct__Q34nw4r3snd11SoundHandleFv = .text:0x8136C66C; // type:function size:0xC
__dt__Q34nw4r3snd11SoundHandleFv = .text:0x8136C678; // type:function size:0x54
__dt__Q33ipl3snd10tagSSeInfoFv = .text:0x8136C6CC; // type:function size:0x58
__dt__Q33ipl3snd6UnkClsFv = .text:0x8136C724; // type:function size:0x1C scope:local
__arraydtor$15982 = .text:0x8136C724; // type:function size:0x1C scope:local
__ct__Q33ipl3snd11tagSBgmInfoFv = .text:0x8136C740; // type:function size:0x30 scope:local
__dt__Q33ipl3snd11tagSBgmInfoFv = .text:0x8136C770; // type:function size:0x58
__ct__Q33ipl3snd6SystemFv = .text:0x8136C7C8; // type:function size:0x4C
@@ -3223,7 +3223,7 @@ __dt__Q33ipl5scene5BoardFv = .text:0x81393CA4; // type:function size:0x68
__ct__Q33ipl5scene11BoardObjectFv = .text:0x81393D1C; // type:function size:0x140
__dt__Q33ipl4math28LinearIntp<Q33ipl4math4VEC2>Fv = .text:0x81393E5C; // type:function size:0x40
__dt__Q33ipl4math31Interporation<Q33ipl4math4VEC2>Fv = .text:0x81393E9C; // type:function size:0x40
init__Q43ipl5scene11BoardObject29@class$8157iplBoardObject_cppFv = .text:0x81393EDC; // type:function size:0x18
init__Q43ipl5scene11BoardObject9StandDataFv = .text:0x81393EDC; // type:function size:0x18
make_icon_cb___Q23ipl5sceneFPQ33ipl6nigaoe6ObjectPv = .text:0x81393EF4; // type:function size:0x80
create__Q33ipl5scene11BoardObjectFPQ33ipl4nand10LayoutFilePUcUlRC6_CDBIdRC13_CDBRecordKeyRCQ33ipl7utility4Date = .text:0x81393F74; // type:function size:0x84
init__Q33ipl5scene11BoardObjectFv = .text:0x81393FF8; // type:function size:0xA4
@@ -4584,11 +4584,11 @@ enqueueLoadNotice__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB308; // type:f
enqueuePageNotice__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB364; // type:function size:0x5C
enqueueResultNotice__Q33ipl5scene15SDChannelSelectFUl = .text:0x813DB3C0; // type:function size:0x5C
enqueueChannelNotice__Q33ipl5scene15SDChannelSelectFUxUl = .text:0x813DB41C; // type:function size:0x5C
enqueueMoveNotice__Q33ipl5scene15SDChannelSelectFUlUlUl = .text:0x813DB478; // type:function size:0x5C
enqueueMoveNotice__Q33ipl5scene15SDChannelSelectFUx = .text:0x813DB478; // type:function size:0x5C
enqueueStateNotice__Q33ipl5scene15SDChannelSelectFUxUl = .text:0x813DB4D4; // type:function size:0x5C
enqueueErrorNotice__Q33ipl5scene15SDChannelSelectFUlUl = .text:0x813DB530; // type:function size:0x5C
enqueueCommandNotice__Q33ipl5scene15SDChannelSelectFUlUlUl = .text:0x813DB58C; // type:function size:0x60
enqueueDeleteNotice__Q33ipl5scene15SDChannelSelectFUlUlUl = .text:0x813DB5EC; // type:function size:0x60
enqueueErrorNotice__Q33ipl5scene15SDChannelSelectFPQ33ipl12NandSDWorker11TitleIdListPQ33ipl12NandSDWorker11TitleIdList = .text:0x813DB530; // type:function size:0x5C
enqueueCommandNotice__Q33ipl5scene15SDChannelSelectFPQ33ipl12NandSDWorker11TitleIdListPQ33ipl12NandSDWorker11TitleIdListPQ33ipl12NandSDWorker11TitleIdList = .text:0x813DB58C; // type:function size:0x60
enqueueDeleteNotice__Q33ipl5scene15SDChannelSelectFUx = .text:0x813DB5EC; // type:function size:0x60
clearCommandQueue__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB64C; // type:function size:0x40
clearNoticeQueue__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB68C; // type:function size:0x40
processWorkerCommands__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB6CC; // type:function size:0x518
@@ -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__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
collectTitlesByUsage__Q33ipl5scene15SDChannelSelectFPlPlPUxPA21_wPUl = .text:0x813DD0AC; // type:function size:0x194
collectTitlesFromNandUsage__Q33ipl5scene15SDChannelSelectFPlPlPUxPA21_wPUl = .text:0x813DD240; // type:function size:0x198
collectTitlesByChannelOrder__Q33ipl5scene15SDChannelSelectFPlPlPUxPA21_wPUl = .text:0x813DD3D8; // type:function size:0x1F8
collectTitlesBySpecialChannels__Q33ipl5scene15SDChannelSelectFPlPlPUxPA21_wPUl = .text:0x813DD5D0; // type:function size:0x5A4
collectTitlesForMode__Q33ipl5scene15SDChannelSelectFPlPlPUxPA21_wPUli = .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
@@ -4762,7 +4762,7 @@ iplSDChannelTitle_updateParentalResult = .text:0x813E69B4; // type:function size
iplSDChannelTitle_updateDialogResult = .text:0x813E6B88; // type:function size:0x144
iplSDChannelTitle_startCopyProgress = .text:0x813E6CCC; // type:function size:0x158
iplSDChannelTitle_updateCopyPrepare = .text:0x813E6E24; // type:function size:0x17C
iplSDChannelTitle_copyTitleRange = .text:0x813E6FA0; // type:function size:0x14
__as__Q43ipl5scene8SDMemory10TitleRangeFRCQ43ipl5scene8SDMemory10TitleRange = .text:0x813E6FA0; // type:function size:0x14 scope:weak
iplSDChannelTitle_updateMemoryCalc = .text:0x813E6FB4; // type:function size:0xC0
iplSDChannelTitle_updateCopyStart = .text:0x813E7074; // type:function size:0x130
iplSDChannelTitle_updateAfterClearTmp = .text:0x813E71A4; // type:function size:0xA8
@@ -4900,8 +4900,8 @@ onDialogState23__Q33ipl5scene8SDMemoryFv = .text:0x813EEDF8; // type:function si
onDialogState24__Q33ipl5scene8SDMemoryFv = .text:0x813EEE70; // type:function size:0xC0
draw__Q33ipl5scene8SDMemoryFv = .text:0x813EEF30; // type:function size:0x88
drawTransferTitles__Q33ipl5scene8SDMemoryFv = .text:0x813EEFB8; // type:function size:0x70C
writeFourFlagBytes__Q23ipl5sceneFPUcUcUcUcUc = .text:0x813EF6C4; // type:function size:0x14
setTitleRowColors__Q23ipl5sceneFPQ34nw4r3lyt7TextBoxRCQ34nw4r2ut5ColorRCQ34nw4r2ut5Color = .text:0x813EF6D8; // type:function size:0x48
__ct__Q34nw4r2ut5ColorFiiii = .text:0x813EF6C4; // type:function size:0x14
SetTextColor__Q34nw4r3lyt7TextBoxFQ34nw4r2ut5ColorQ34nw4r2ut5Color = .text:0x813EF6D8; // type:function size:0x48
GetBeginIter__Q34nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>Fv = .text:0x813EF720; // type:function size:0x8
GetEndIter__Q34nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>Fv = .text:0x813EF728; // type:function size:0x8
__ne__Q24nw4r2utFQ44nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>8IteratorQ44nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>8Iterator = .text:0x813EF730; // type:function size:0x18
@@ -17727,7 +17727,7 @@ __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:0x680
csPaneToAnimation__Q29textinput12candidatebox = .data:0x8165D2F8; // type:object size:0x680 scope:local
@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
@@ -20933,31 +20933,28 @@ lbl_81694D18 = .sdata2:0x81694D18; // type:object size:0x4 data:4byte
lbl_81694D1C = .sdata2:0x81694D1C; // type:object size:0x4 data:4byte
lbl_81694D20 = .sdata2:0x81694D20; // type:object size:0x1 data:byte
lbl_81694D24 = .sdata2:0x81694D24; // type:object size:0x1 data:byte
scInputFormZeroF = .sdata2:0x81694D28; // type:object size:0x4 align:4 data:float
scInputForm640F = .sdata2:0x81694D2C; // type:object size:0x4 align:4 data:float
scInputFormF32ConvertMagic = .sdata2:0x81694D30; // type:object size:0x8 align:8 data:double
scInputFormOneF = .sdata2:0x81694D38; // type:object size:0x4 align:4 data:float
scInputFormHalfF = .sdata2:0x81694D3C; // type:object size:0x4 align:4 data:float
scInputFormDegToFIdxF = .sdata2:0x81694D40; // type:object size:0x4 align:4 data:float
scInputForm150F = .sdata2:0x81694D44; // type:object size:0x4 align:4 data:float
scInputForm30F = .sdata2:0x81694D48; // type:object size:0x4 align:4 data:float
scInputForm50F = .sdata2:0x81694D4C; // type:object size:0x4 align:4 data:float
scInputForm10F = .sdata2:0x81694D50; // type:object size:0x4 align:4 data:float
scInputForm52F = .sdata2:0x81694D54; // type:object size:0x4 align:4 data:float
scInputFormTwoF = .sdata2:0x81694D58; // type:object size:0x4 align:4 data:float
scInputForm140F = .sdata2:0x81694D5C; // type:object size:0x4 align:4 data:float
scInputForm90F = .sdata2:0x81694D60; // type:object size:0x4 align:4 data:float
scInputForm253F = .sdata2:0x81694D64; // type:object size:0x4 align:4 data:float
scInputForm20F = .sdata2:0x81694D68; // type:object size:0x4 align:4 data:float
scInputFormColorRU8 = .sdata2:0x81694D6C; // type:object size:0x1 data:byte
scInputFormColorGU8 = .sdata2:0x81694D6D; // type:object size:0x1 data:byte
scInputFormColorBU8 = .sdata2:0x81694D6E; // type:object size:0x1 data:byte
scInputFormColorAU8 = .sdata2:0x81694D6F; // type:object size:0x1 data:byte
scInputForm255F = .sdata2:0x81694D70; // type:object size:0x4 align:4 data:float
scInputForm127F = .sdata2:0x81694D74; // type:object size:0x4 align:4 data:float
scInputForm14592F = .sdata2:0x81694D78; // type:object size:0x4 align:4 data:float
scInputFormF64ConvertMagic = .sdata2:0x81694D80; // type:object size:0x8 align:8 data:double
scInputForm15F = .sdata2:0x81694D88; // type:object size:0x4 align:4 data:float
@13326 = .sdata2:0x81694D28; // type:object size:0x4 scope:local align:4 data:float
@13327 = .sdata2:0x81694D2C; // type:object size:0x4 scope:local align:4 data:float
@13360 = .sdata2:0x81694D30; // type:object size:0x8 scope:local align:8 data:double
@13767 = .sdata2:0x81694D38; // type:object size:0x4 scope:local align:4 data:float
@13772 = .sdata2:0x81694D3C; // type:object size:0x4 scope:local align:4 data:float
@13804 = .sdata2:0x81694D40; // type:object size:0x4 scope:local align:4 data:float
@13805 = .sdata2:0x81694D44; // type:object size:0x4 scope:local align:4 data:float
@13806 = .sdata2:0x81694D48; // type:object size:0x4 scope:local align:4 data:float
@13807 = .sdata2:0x81694D4C; // type:object size:0x4 scope:local align:4 data:float
@13808 = .sdata2:0x81694D50; // type:object size:0x4 scope:local align:4 data:float
@13809 = .sdata2:0x81694D54; // type:object size:0x4 scope:local align:4 data:float
@13810 = .sdata2:0x81694D58; // type:object size:0x4 scope:local align:4 data:float
@13811 = .sdata2:0x81694D5C; // type:object size:0x4 scope:local align:4 data:float
@13812 = .sdata2:0x81694D60; // type:object size:0x4 scope:local align:4 data:float
@13813 = .sdata2:0x81694D64; // type:object size:0x4 scope:local align:4 data:float
@13814 = .sdata2:0x81694D68; // type:object size:0x4 scope:local align:4 data:float
@8131 = .sdata2:0x81694D6C; // type:object size:0x4 scope:local data:byte
@14016 = .sdata2:0x81694D70; // type:object size:0x4 scope:local align:4 data:float
@14017 = .sdata2:0x81694D74; // type:object size:0x4 scope:local align:4 data:float
@14018 = .sdata2:0x81694D78; // type:object size:0x4 scope:local align:4 data:float
@14021 = .sdata2:0x81694D80; // type:object size:0x8 scope:local align:8 data:double
@14117 = .sdata2:0x81694D88; // type:object size:0x4 scope:local align:4 data:float
lbl_81694D90 = .sdata2:0x81694D90; // type:object size:0x4 align:4 data:float
lbl_81694D94 = .sdata2:0x81694D94; // type:object size:0x4 align:4 data:float
lbl_81694D98 = .sdata2:0x81694D98; // type:object size:0x4 align:4 data:float
@@ -23681,8 +23678,8 @@ RegionValid = .sbss:0x81698A48; // type:object size:0x4 data:4byte
NandPending = .sbss:0x81698A4C; // type:object size:0x4 scope:local data:4byte
CancelNand = .sbss:0x81698A50; // type:object size:0x4 scope:local data:4byte
LowReadResult = .sbss:0x81698A54; // type:object size:0x4 scope:local data:4byte
CacheCommandComplete = .sbss:0x81698A58; // type:object size:0x4 scope:local data:4byte
AudioBufferUnconfigured = .sbss:0x81698A5C; // type:object size:0x4 scope:local data:4byte
CacheCommandComplete$1963 = .sbss:0x81698A58; // type:object size:0x4 scope:local data:4byte
AudioBufferUnconfigured$2065 = .sbss:0x81698A5C; // type:object size:0x4 scope:local data:4byte
ResetTime = .sbss:0x81698A60; // type:object size:0x8 scope:local data:4byte
SpinupDeadline = .sbss:0x81698A68; // type:object size:0x8 scope:local data:4byte
CoverPollTime = .sbss:0x81698A70; // type:object size:0x8 data:4byte
@@ -23690,15 +23687,13 @@ DriveWasReset = .sbss:0x81698A78; // type:object size:0x4 data:4byte
TitleTicketView = .sbss:0x81698A7C; // type:object size:0x4 scope:local data:4byte
CurrentTmd = .sbss:0x81698A80; // type:object size:0x4 scope:local data:4byte
TitleCode = .sbss:0x81698A84; // type:object size:0x4 data:4byte
RequiredIosHigh = .sbss:0x81698A88; // type:object size:0x4 data:4byte
RequiredIosLow = .sbss:0x81698A8C; // type:object size:0x4 data:4byte
RequiredIos = .sbss:0x81698A88; // type:object size:0x8 data:4byte
GamePartition = .sbss:0x81698A90; // type:object size:0x4 data:4byte
UpdatePartition = .sbss:0x81698A94; // type:object size:0x4 data:4byte
PartitionCursor = .sbss:0x81698A98; // type:object size:0x4 data:4byte
DataToc = .sbss:0x81698A9C; // type:object size:0x4 data:4byte
GameToc = .sbss:0x81698AA0; // type:object size:0x8 data:4byte
CoverOpenTimeHigh = .sbss:0x81698AA8; // type:object size:0x4 data:4byte
CoverOpenTimeLow = .sbss:0x81698AAC; // type:object size:0x4 data:4byte
CoverOpenTime = .sbss:0x81698AA8; // type:object size:0x8 data:4byte
NandTransferred = .sbss:0x81698AB0; // type:object size:0x4 data:4byte
NandLength = .sbss:0x81698AB4; // type:object size:0x4 data:4byte
NandBuffer = .sbss:0x81698AB8; // type:object size:0x4 data:4byte

View File

@@ -658,7 +658,7 @@ config.libs = [
Object(Matching, "system/iplChannelRsoThread.cpp"),
Object(Matching, "system/RsoSystem.cpp"),
Object(Matching, "system/iplCdbBackup.cpp"),
Object(NonMatching, "system/odh.cpp"),
Object(Matching, "system/odh.cpp"),
Object(Matching, "system/iplSDVFWorker.cpp"),
Object(Matching, "system/iplNandWrapper.cpp"),
Object(Matching, "system/main.cpp"),
@@ -700,7 +700,7 @@ config.libs = [
Object(Matching, "iplwww/www_print.cpp"),
Object(Matching, "iplwww/www_window.cpp"),
Object(Matching, "iplwww/www_trasition.cpp"),
Object(Equivalent, "iplwww/www_wiisetting.cpp"),
Object(Matching, "iplwww/www_wiisetting.cpp"),
Object(Matching, "iplwww/www_arcreader.cpp"),
]
),
@@ -718,8 +718,8 @@ config.libs = [
Object(Matching, "BS2/BS2Entry.c"),
Object(Matching, "BS2/BS2.c"),
Object(Matching, "BS2/BS2Init.c"),
Object(NonMatching, "BS2/BS2Mach.c"),
Object(NonMatching, "BS2/BS2Update.c"),
Object(Matching, "BS2/BS2Mach.c"),
Object(Matching, "BS2/BS2Update.c"),
Object(Matching, "BS2/BS2ParentalControl.c"),
Object(Matching, "BS2/BS2BringUp.c"),
Object(Matching, "BS2/BS2Reset.c"),
@@ -729,7 +729,7 @@ config.libs = [
IPLSection("address", [
Object(Matching, "scene/address/iplAddress.cpp"),
Object(Matching, "scene/address/iplAddressAddSel.cpp"),
Object(NonMatching, "scene/address/iplAddressEdit.cpp"),
Object(Matching, "scene/address/iplAddressEdit.cpp"),
]
),
IPLSection("backMenu", [
@@ -814,7 +814,7 @@ config.libs = [
IPLSection("memoryCard", [
Object(Matching, "scene/memoryCard/iplMemoryCard.cpp"),
Object(Matching, "scene/memoryCard/iplMemoryCardBase.cpp"),
Object(NonMatching, "scene/memoryCard/iplMemoryCardManager.cpp"),
Object(Matching, "scene/memoryCard/iplMemoryCardManager.cpp"),
Object(Matching, "scene/memoryCard/iplGCSaveData.cpp"),
Object(Matching, "scene/memoryCard/iplGCWindow.cpp"),
]
@@ -824,7 +824,7 @@ config.libs = [
]
),
IPLSection("cardSequence", [
Object(NonMatching, "scene/cardSequence/iplCardSequence.cpp"),
Object(Matching, "scene/cardSequence/iplCardSequence.cpp"),
]
),
IPLSection("nakamuraTest", [
@@ -864,7 +864,7 @@ config.libs = [
]
),
IPLSection("sdChannelMemory", [
Object(NonMatching, "scene/sdChannelMemory/iplSDMemory.cpp"),
Object(Matching, "scene/sdChannelMemory/iplSDMemory.cpp"),
]
),
IPLSection("setting", [
@@ -876,11 +876,11 @@ config.libs = [
Object(Matching, "scene/setting/iplUSBAP.cpp"),
Object(Matching, "scene/setting/iplUSBAPThread.cpp"),
Object(Matching, "scene/setting/iplAOSSThread.cpp"),
Object(NonMatching, "scene/setting/AOSSLink.c"),
Object(Matching, "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/AOSS.c", extra_cflags=["-O4,p", "-inline on,noauto"]),
Object(Matching, "scene/setting/AOSSData.c"),
Object(NonMatching, "scene/setting/ATERM.c", extra_cflags=["-O4,p", "-inline on"]),
Object(Matching, "scene/setting/ATERM.c", mw_version="GC/3.0a5", extra_cflags=["-O4,p", "-inline on"]),
]
),
IPLSection("settingSelect", [
@@ -911,8 +911,8 @@ config.libs = [
IPLSection("keyboard", [
Object(Matching, "keyboard/tiPcKeyboard.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiCellPhone.cpp", extra_cflags=["-O4,p"]),
Object(NonMatching, "keyboard/tiInputForm.cpp", extra_cflags=["-O4,p"]),
Object(NonMatching, "keyboard/tiCandidateBox.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiInputForm.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiCandidateBox.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiToolBar.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiPredictLang.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiSignWindow.cpp", extra_cflags=["-O4,p"]),
@@ -942,7 +942,7 @@ config.libs = [
]
),
IPLSection("channelScript", [
Object(NonMatching, "channelScript/CHANSVm.c"),
Object(Matching, "channelScript/CHANSVm.c"),
Object(Matching, "channelScript/systemmenu/VmSystem.c"),
Object(Matching, "channelScript/systemmenu/iplCSSystem.cpp"),
Object(Matching, "channelScript/systemmenu/iplCSLayout.cpp"),
@@ -1049,7 +1049,7 @@ config.libs = [
Object(Matching, "net/hmac.c"),
Object(Matching, "net/neterrorcode.c"),
Object(Matching, "net/NETVersion.c"),
Object(NonMatching, "net/aes.c"),
Object(Matching, "net/aes.c"),
Object(Matching, "net/wireless_macaddr.c"),
]
),
@@ -1202,7 +1202,7 @@ config.libs = [
Object(Matching, "buffer/mkhdec3.c"),
Object(Matching, "buffer/buffer_system.c"),
Object(Matching, "buffer/getcode.c"),
Object(NonMatching, "buffer/idct_block_var.c"),
Object(Matching, "buffer/idct_block_var.c"),
Object(Matching, "api/decapi.c"),
@@ -1215,9 +1215,9 @@ config.libs = [
Object(Matching, "reschange/iqdec_resolution_change_a3.c"),
Object(Matching, "reschange/idct_resolution_change_var.c"),
Object(NonMatching, "texturecvtr/Texture_MCUtoY8U8V8.c"),
Object(NonMatching, "texturecvtr/Texture_MCUtoRGB565.c"),
Object(NonMatching, "texturecvtr/Texture_MCUtoRGBA8.c"),
Object(Matching, "texturecvtr/Texture_MCUtoY8U8V8.c"),
Object(Matching, "texturecvtr/Texture_MCUtoRGB565.c"),
Object(Matching, "texturecvtr/Texture_MCUtoRGBA8.c"),
Object(Matching, "b65/iqdec_b65_frv32.c"),
]
@@ -1691,7 +1691,7 @@ config.libs = [
Object(Matching, "fa/pdm_api.c"),
Object(Matching, "fa/pdm_bpb.c"),
Object(Matching, "fa/pdm_disk.c"),
Object(NonMatching, "fa/pdm_partition.c"),
Object(Matching, "fa/pdm_partition.c"),
Object(Matching, "fa/pf_cache.c"),
Object(Matching, "fa/pf_cluster.c"),
Object(Matching, "fa/pf_dir.c"),
@@ -1869,7 +1869,7 @@ config.libs = [
]
),
RVLSDKLib("nup", [
Object(NonMatching, "nup/nup.cpp"),
Object(Matching, "nup/nup.cpp"),
Object(Matching, "nup/nup_nhttp.cpp"),
Object(Matching, "nup/nup_mem.cpp"),
]
@@ -1886,7 +1886,7 @@ config.libs = [
]
),
RVLSDKLib("kbd", [
Object(NonMatching, "kbd/kbd_lib.c"),
Object(Matching, "kbd/kbd_lib.c"),
Object(NonMatching, "kbd/kbd_lib_map_jp.c"),
Object(Matching, "kbd/kbd_lib_map_us.c"),
Object(NonMatching, "kbd/kbd_lib_map_eu.c"),

View File

@@ -7,7 +7,7 @@
extern "C" {
#endif
typedef CHANSVmObjHdr* (*VmConvertFunc)(CHANSVm*, CHANSVmObjType, CHANSVmObjHdr*);
typedef CHANSVmObjHdr* (*VmConvertFunc)(CHANSVm*, CHANSVmObjType, const CHANSVmObjHdr*);
typedef struct VmConvertEntry {
VmConvertFunc convFunc[6]; // 0x00

View File

@@ -12,6 +12,7 @@ extern void __sync();
extern unsigned int __cntlzw(unsigned int value);
extern void __memclr(void* buffer, int len);
extern unsigned int __rlwimi(unsigned int a, unsigned int b, unsigned int c, unsigned int d, unsigned int e);
extern unsigned int __rlwinm(unsigned int value, unsigned int shift, unsigned int maskBegin, unsigned int maskEnd);
extern void* __alloca(unsigned int blockSize);
extern int __abs(int n);

View File

@@ -77,7 +77,7 @@ namespace textinput {
class Base : public CommandSender {
public:
#ifdef TIMANAGER_IMPLEMENTATION
#if defined(TIMANAGER_IMPLEMENTATION) || defined(TI_CANDIDATEBOX_SAMPLE_CLASS)
Base(Manager* manager) : mpCandidates(NULL), mpAllocator(NULL), mbOn(false), mbInvalid(true), meLanguage(USA), mpManager(manager) {}
#endif
virtual ~Base();
@@ -114,7 +114,7 @@ namespace textinput {
class EventHandler : public nw4rmanager::TiEventHandler {
public:
#ifdef TIMANAGER_IMPLEMENTATION
#if defined(TIMANAGER_IMPLEMENTATION) || defined(TI_CANDIDATEBOX_SAMPLE_CLASS)
EventHandler(LayoutByNW4R* layout) : mpLayoutByNW4R(layout) {}
#endif
virtual void onTiEvent(gui::PaneComponent* paneComponent, u32 event, Input* input) override; // 0x18
@@ -302,7 +302,7 @@ namespace textinput {
// TODO
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public UIObj::Listener {
public:
#ifdef TIMANAGER_IMPLEMENTATION
#if defined(TIMANAGER_IMPLEMENTATION) || defined(TI_CANDIDATEBOX_SAMPLE_CLASS)
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
: Base(manager), nw4rmanager::Layout(accessor, layoutName, observer), mEventHandler(this), mpTiString(NULL),
mTextArea(0, this, this), mLeftScroll(1, this, this), mRightScroll(2, this, this), mOnOffButton(3, this, this),
@@ -371,6 +371,15 @@ namespace textinput {
bool mbActive;
};
#ifdef TI_CANDIDATEBOX_SAMPLE_CLASS
class Sample : public LayoutByNW4R {
public:
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
: LayoutByNW4R(manager, accessor, observer, layoutName) {}
virtual ~Sample() {}
};
#endif
class CandidateTextAnmPane : public nw4rmanager::AnmPane {
public:
CandidateTextAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)

View File

@@ -178,8 +178,14 @@ namespace textinput {
void inputCharZi_(wchar_t character, u32 modifiers);
void inputCharDefault_(wchar_t character, u32 modifiers);
void inputInputting_(wchar_t character);
inline bool hasZiPredictions() const;
inline bool usesZiPrediction() const;
bool hasZiPredictions() const;
bool usesZiPrediction() const;
#ifdef TIINPUTFORM_IMPLEMENTATION
void checkUnfixConverting_();
void setAtokMode_(bool fixMode, bool kanaMode);
void trimString_(u32 length);
void startConverting_();
#endif
inline void resetPredictionContext();
inline void resetInputRelation();
#endif
@@ -356,6 +362,7 @@ namespace textinput {
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
friend class EventHandler;
inline const nw4r::lyt::Pane* getLanguageTextPane() const;
inline nw4r::lyt::TextBox* getTextBox() const;
#endif
public:
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)

View File

@@ -129,7 +129,7 @@ namespace textinput {
#ifdef TIHWKEYBOARD_IMPLEMENTATION
EventObserver* getEventObserverForHardware() const { return mpEventObserver; }
#endif
#ifdef TISIGNWINDOW_IMPLEMENTATION
#if defined(TISIGNWINDOW_IMPLEMENTATION) || defined(IPL_ADDRESS_EDIT_CPP)
virtual InputForm* getInputForm();
#else
virtual InputForm* getInputForm() { return mpInputForm; }

View File

@@ -85,10 +85,30 @@ namespace textinput {
#endif
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
#ifdef TIINPUTFORM_IMPLEMENTATION
virtual ~Decolated() {}
#else
virtual ~Decolated();
#endif
enum TranslateMode { TM_Direct, TM_Kana, TM_Roman, TM_Hangul };
#ifdef TIINPUTFORM_IMPLEMENTATION
virtual void clear() {
StringBase::clear();
mCursorStart = 0;
mCursorEnd = 0;
mbSustain = false;
initKanaConverter();
}
virtual void set(const wchar_t* string) {
StringBase::set(string);
u32 length = getLength();
mCursorStart = length;
mCursorEnd = length;
}
#else
virtual void clear();
virtual void set(const wchar_t* string);
#endif
virtual void setLength(u16 length);
void setTranslateMode(TranslateMode mode);
TranslateMode getTranslateMode() const { return static_cast<TranslateMode>(mTranslateMode); }
@@ -194,6 +214,9 @@ namespace textinput {
public:
WithAtok(u16 maxLength) : Decolated(maxLength) {}
virtual ~WithAtok();
virtual bool isFix();
virtual void setFix(bool fix);
virtual void initConverting();
virtual void pushBack(wchar_t ch);
virtual void popBack();
virtual void inputChar(wchar_t ch);
@@ -209,9 +232,6 @@ namespace textinput {
u32 selectedStart;
u32 selectedEnd;
};
virtual bool isFix();
virtual void setFix(bool fix);
virtual void initConverting();
virtual bool isConverting();
virtual wchar_t* getConfirmedWCString() const;
virtual int getCurrentNumPredicted();

View File

@@ -47,8 +47,13 @@ namespace textinput {
public :
virtual ~Base() {}
#ifdef TIINPUTFORM_IMPLEMENTATION
virtual void create(MEMAllocator* allocator) {}
virtual void init() {}
#else
virtual void create(MEMAllocator* allocator);
virtual void init();
#endif
};
class CommandSender;
@@ -59,8 +64,12 @@ namespace textinput {
#endif
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
CommandReceiver() { clearSender(); }
#ifdef TIINPUTFORM_IMPLEMENTATION
virtual ~CommandReceiver() {}
#else
virtual ~CommandReceiver();
#endif
#endif
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
struct Scroll {
bool absY;

View File

@@ -50,6 +50,7 @@ namespace ipl {
void add_friendinfo();
void delete_friendinfo();
void set_textbox(nw4r::lyt::Pane*, const wchar_t*);
void set_textbox(nw4r::lyt::Pane* pane, u32 msgId);
void setDefaultTitleText(const wchar_t*, bool);
static void wiiid_utf16(u64, wchar_t*);
static void nigaoe_create_callback_add(ipl::nigaoe::Object*, void*);

View File

@@ -159,7 +159,7 @@ namespace ipl {
RBRRecordType mRecordType; // 0xDC
u32 mOptOutFlag; // 0xE0
class {
class StandData {
public:
void init() {
mAngleIdx = -1;

View File

@@ -12,7 +12,6 @@
namespace ipl {
namespace scene {
extern "C" BOOL push_button_queue(void*, const void*);
class ButtonEventHandlerBase;
class OptOutButtonEventHandlerBase;
class SDMenuEventHandlerBase;
@@ -315,7 +314,6 @@ namespace ipl {
}
protected:
friend BOOL push_button_queue(void*, const void*);
typedef struct Command {
enum {
TYPE_ANIM = 0,

View File

@@ -166,11 +166,11 @@ namespace ipl {
void update_file_array(u8 slot);
void update_change_cardstate(u8 slot);
GXTexObj* create_icon(u8 slot, s16 index);
GXTexObj* create_icon(u8 slot, s16 index, long start);
GXTexObj* _create_icon(u8 slot, s16 fileNo, long start);
const GXTexObj* create_icon(u8 slot, s16 index);
const GXTexObj* create_icon(u8 slot, s16 index, long start);
const GXTexObj* _create_icon(u8 slot, s16 fileNo, long start);
const wchar_t* getComment(u8 slot, s16 index, int which);
GXTexObj* create_banner(u8 slot, s16 index);
const GXTexObj* create_banner(u8 slot, s16 index);
#ifdef IPL_GC_WINDOW_CPP
u32 getBlocks(u8 slot, s16 index);
#else
@@ -187,7 +187,7 @@ namespace ipl {
}
private:
GXTexObj* initBannerTexture(u8 slot, s32 file, void* data) {
const GXTexObj* initBannerTexture(u8 slot, s32 file, void* data) {
GXInitTexObj(&mFileCell[slot][file].banner, data, CARD_BANNER_WIDTH, CARD_BANNER_HEIGHT,
GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE);
return &mFileCell[slot][file].banner;
@@ -203,6 +203,22 @@ namespace ipl {
return &mFileCell[slot][file].bannerTlut;
}
const GXTexObj* initIconTexture(u8 slot, s32 file, void* data) {
GXInitTexObj(&mFileCell[slot][file].icon, data, CARD_ICON_WIDTH, CARD_ICON_HEIGHT,
GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE);
return &mFileCell[slot][file].icon;
}
void initIconTextureCI(u8 slot, s32 file, void* data) {
GXInitTexObjCI(&mFileCell[slot][file].icon, data, CARD_ICON_WIDTH, CARD_ICON_HEIGHT,
GX_TF_C8, GX_CLAMP, GX_CLAMP, GX_FALSE, GX_TLUT0);
}
GXTlutObj* initIconPalette(u8 slot, s32 file, void* data) {
GXInitTlutObj(&mFileCell[slot][file].iconTlut, data, GX_TL_RGB5A3, 0x100);
return &mFileCell[slot][file].iconTlut;
}
u32 reserved; // 0x00004
MCFile mFile[2][CARD_MAX_FILE]; // 0x00008
MCFileCell mFileCell[2][CARD_MAX_FILE]; // 0x00FE8

View File

@@ -142,14 +142,9 @@ namespace ipl {
u32 mTransferStatus;
u64 mTransferStartTime;
s32 mTransferFrame;
struct TitleListState {
ESTitleId* mpTitles;
u32 mCount;
ESTitleId* mpSecondaryTitles;
u32 mSecondaryCount;
ESTitleId* mpNames;
u32 mNameCount;
} mTitleListState;
NandSDWorker::TitleIdList mTitleList;
NandSDWorker::TitleIdList mNandTitleList;
NandSDWorker::TitleIdList mSDTitleList;
scroller mScroller;
s32 mButtonState;
u8 mControllerFlags[4];

View File

@@ -178,7 +178,7 @@ namespace ipl {
BOOL onEventDerived(const char* paneName, u32 event,
controller::Interface* controller);
bool collectTitlesByUsage(s32* firstUsage, s32* secondUsage,
ESTitleId* titleIds, char* titleNames,
ESTitleId* titleIds, wchar_t (*titleNames)[21],
u32* titleCount);
static const char* mscChannelPaneNames[PAGE_COUNT][MAX_CHANNEL_INDEX];
@@ -197,6 +197,8 @@ namespace ipl {
friend class SDChannelSelectEventHandler;
friend class SDChannelSelectButtonEventHandler;
#endif
friend class SDMemory;
void enqueueStartNotice();
bool enqueueFinishNotice();
bool enqueueNotice(u32 highTitleId, u32 lowTitleId, u32 result);
@@ -204,11 +206,14 @@ namespace ipl {
bool enqueuePageNotice();
bool enqueueResultNotice(u32 result);
bool enqueueChannelNotice(u64 titleId, u32 value);
bool enqueueMoveNotice(u32 controller, u32 page, u32 index);
bool enqueueMoveNotice(ESTitleId titleId);
bool enqueueStateNotice(u64 titleId, u32 state);
bool enqueueErrorNotice(u32 page, u32 index);
bool enqueueCommandNotice(u32 page, u32 index, u32 command);
bool enqueueDeleteNotice(u32 controller, u32 page, u32 index);
bool enqueueErrorNotice(NandSDWorker::TitleIdList* newTitles,
NandSDWorker::TitleIdList* replacingTitles);
bool enqueueCommandNotice(NandSDWorker::TitleIdList* titles,
NandSDWorker::TitleIdList* foundTitles,
NandSDWorker::TitleIdList* badTitles);
bool enqueueDeleteNotice(ESTitleId titleId);
void clearCommandQueue();
void clearNoticeQueue();
void calcChannelObjects();
@@ -233,16 +238,16 @@ namespace ipl {
bool isCurrentTitleUsageEnough(const s32* usage) const;
void getCurrentTitleUsage(s32* bytes, s32* blocks) const;
bool collectTitlesByChannelOrder(s32* firstUsage, s32* secondUsage,
ESTitleId* titleIds, char* titleNames,
ESTitleId* titleIds, wchar_t (*titleNames)[21],
u32* titleCount);
bool collectTitlesFromNandUsage(s32* firstUsage, s32* secondUsage,
ESTitleId* titleIds, char* titleNames,
ESTitleId* titleIds, wchar_t (*titleNames)[21],
u32* titleCount);
bool collectTitlesBySpecialChannels(s32* firstUsage, s32* secondUsage,
ESTitleId* titleIds, char* titleNames,
ESTitleId* titleIds, wchar_t (*titleNames)[21],
u32* titleCount);
bool collectTitlesForMode(s32* firstUsage, s32* secondUsage,
ESTitleId* titleIds, char* titleNames,
ESTitleId* titleIds, wchar_t (*titleNames)[21],
u32* titleCount, int searchMode);
bool findAdjacentChannel(int direction, int* page, int* index) const;
void setStateAndPlaySelectSound(int state) NO_INLINE;

View File

@@ -18,6 +18,15 @@ namespace ipl {
f32 margin16x9 = 120.0f, f32 margin4x3 = 30.0f);
~TextBalloon();
static f32 getDefaultMargin16x9() {
f32 margin = 120.0f;
return margin;
}
static f32 getDefaultMargin4x3() {
f32 margin = 30.0f;
return margin;
}
void calc();
void draw();

View File

@@ -15,7 +15,7 @@ namespace ipl {
Manager(EGG::Heap* heap);
/** @return The message data in use. */
const wchar_t* getMessage(u32 id) const { return mpMessage->getMessage(id); }
wchar_t* getMessage(u32 id) const { return mpMessage->getMessage(id); }
void setResource(u8* msgData) const { mpMessage->setResource(msgData); }
private:

View File

@@ -302,7 +302,7 @@ namespace ipl {
}
/** @return The Message ID as a Wide-string. */
static const wchar_t* getMessage(u32 id) { return smArg.mpMessageMgr->getMessage(id); }
static wchar_t* getMessage(u32 id) { return smArg.mpMessageMgr->getMessage(id); }
static message::Manager* getMessageManager() { return smArg.mpMessageMgr; }
static void* getFont();

View File

@@ -10,31 +10,9 @@ namespace ipl {
public:
inline Queue<T, c>() : count(c), current(0), popped(0), pushed(0) {}
BOOL push(const T& item) {
if (count == current) {
return FALSE;
}
items[pushed] = item;
if (++pushed >= count) {
pushed = 0;
}
current++;
return TRUE;
}
BOOL push(const T& item);
BOOL pop() {
BOOL result = TRUE;
if (current == 0) {
result = FALSE;
goto done;
}
if (++popped >= count) {
popped = 0;
}
current--;
done:
return result;
}
BOOL pop();
int get_current_index() { return current; }
T& get_current_item() { return items[get_current_index()]; }
@@ -55,6 +33,34 @@ namespace ipl {
int current; // (sizeof(items) * count) + 0x04
int popped, pushed; // (sizeof(items) * count) + 0x08
};
template <typename T, int c>
BOOL Queue<T, c>::push(const T& item) {
if (count == current) {
return FALSE;
}
items[pushed] = item;
if (++pushed >= count) {
pushed = 0;
}
current++;
return TRUE;
}
template <typename T, int c>
BOOL Queue<T, c>::pop() {
BOOL result = TRUE;
if (current == 0) {
result = FALSE;
goto done;
}
if (++popped >= count) {
popped = 0;
}
current--;
done:
return result;
}
} // namespace utility
} // namespace ipl

View File

@@ -22,7 +22,11 @@ int strcmp(const char* s1, const char* s2);
char* strpbrk(const char* s1, const char* s2);
size_t strspn(const char* s1, const char* s2);
char* strtok(char* str, const char* delimiters);
#ifdef __cplusplus
const char* strstr(const char* str, const char* pat);
#else
char* strstr(const char* str, const char* pat);
#endif
char* strncpy(char* dst, const char* src, size_t length);
char* strncat(char* dst, const char* src, size_t length);
@@ -39,4 +43,12 @@ int strcmpi(const char* s1, const char* s2);
}
#endif
#ifdef __cplusplus
extern "C++" {
inline char* strstr(char* str, const char* pat) {
return const_cast<char*>(strstr(static_cast<const char*>(str), pat));
}
}
#endif
#endif // MSL_STRING_H

View File

@@ -27,7 +27,11 @@ wchar_t* wcscat(wchar_t* dest, const wchar_t* src);
wchar_t* wcsncat(wchar_t* dest, const wchar_t* src, size_t num);
int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t num);
wchar_t* wcschr(wchar_t* ws, wchar_t wc);
#ifndef __cplusplus
wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
#else
const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
#endif
int swprintf(wchar_t* ws, size_t len, const wchar_t* format, ...);
int vswprintf(wchar_t* ws, size_t len, const wchar_t* format, va_list arg);
@@ -36,6 +40,12 @@ int wcsnicmp(const char* dst, const char* src, size_t num);
#ifdef __cplusplus
}
extern "C++" {
inline wchar_t* wcsstr(wchar_t* s1, const wchar_t* s2) {
return const_cast<wchar_t*>(wcsstr(static_cast<const wchar_t*>(s1), s2));
}
}
#endif
#endif // MSL_WCHAR_H

View File

@@ -123,7 +123,7 @@ namespace nw4r {
const math::MTX34& GetMtx() const { return mMtx; }
void SetMtx(const math::MTX34& mtx) { mMtx = mtx; }
u8 GetAlpha() { return mAlpha; }
u8 GetAlpha() const { return mAlpha; }
void SetAlpha(u8 alpha) { mAlpha = alpha; }
const char* GetName() const { return mName; }

View File

@@ -55,16 +55,14 @@ namespace nw4r {
NW4R_ASSERT(type < TEXTCOLOR_MAX);
return mTextColors[type];
}
#ifdef IPL_SDMEMORY_SET_TEXT_COLORS
void SetTextColors(const ut::Color& first, const ut::Color& second) {
mTextColors[0] = first;
mTextColors[1] = second;
}
#endif
void SetTextColor(u32 type, ut::Color value) {
NW4R_ASSERT(type < TEXTCOLOR_MAX);
mTextColors[type] = value;
}
void SetTextColor(ut::Color top, ut::Color bottom) {
mTextColors[0] = top;
mTextColors[1] = bottom;
}
void SetTextPositionH(u8 pos) { detail::SetHorizontalPosition(&mTextPosition, pos); }
void SetTextPositionV(u8 pos) { detail::SetVerticalPosition(&mTextPosition, pos); }

View File

@@ -31,444 +31,507 @@ static s32 scalingClampU8(s32 value) {
return value < 0 ? 0 : 255;
}
static s32 clampLumaDc(s32 coefficient) {
return clampU8((coefficient >> 11) + 0x80);
}
void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigzag) {
s32 workspace[64];
s32* workspaceCursor;
s32 evenBaseSum;
s32 evenRotation;
s32 pitch2;
s32* dst;
s32 rowOddOutput1;
int columnAcBits;
s32 column;
s32 evenOutput3;
s32 coefficient2;
s32 coefficient1;
s32 coefficient4;
s32 coefficient5;
s32 coefficient6;
s32 coefficient7;
s32 oddOutput0;
s32 m;
s32 evenBaseDifference;
s32 processedCoefficients;
s32 z;
s32 evenOutput1;
s32 oddOutput3;
s32 oddLowRotation;
s32 oddHighRotation;
s32 evenRotationSum;
s32 r;
s32 oddOutput1;
s32 oddSumRotation;
s32 oddSumDifference;
s32 oddDifferenceSum;
s32 columnsRemaining;
s32 oddOutput2;
s32 evenOutput0;
s32 evenOutput2;
s32 coefficient3;
s32 rowEvenOutput0;
s32 columnC6;
s32 columnC4;
s32 columnOddSumRotation;
s32 rowDc;
s32 rowEvenOutput1;
s32 columnC1;
s32 columnEvenBaseDifference;
s32 columnEvenOutput0;
s32 columnC2;
s32 columnScaledEvenRotation;
s32 columnEvenOutput1;
s32 columnC5;
s32 rowC4;
s32 rowOddSumRotation;
s32 columnEvenOutput3;
s32 columnOddLowSum;
s32 columnOddLowDifference;
s32 columnOddHighSum;
s32 columnC7;
s32 columnC3;
s32 columnEvenBaseSum;
s32 rowEvenBaseDifference;
s32 rowEvenOutput2;
s32 rowOddOutput0;
s32 rowC1;
s32 columnOddHighDifference;
s32 columnDc;
s32 columnOddDifferenceRotation;
s32 columnOddOutput1;
s32 rowScaledEvenRotation;
s32 columnEvenOutput2;
s32 columnOddMix;
int rowAcBits;
s32 columnEvenRotationSum;
s32 rowEvenBaseSum;
s32 rowC2;
s32 rowEvenRotationSum;
s32 rowEvenOutput3;
s32 rowOddLowDifference;
s32 columnOddOutput0;
u8* columnOutput;
s32 pitch4;
s32* src;
s32 rowC3;
s32 rowOddHighDifference;
s32 rowOddHighSum;
s32 rowOddOutput3;
s32 pitch7;
s32 pitch6;
s32 rowC6;
s32 columnOddOutput2;
u8 columnSample;
s32 processed;
s32 rowOddLowSum;
s32 rowOddDifferenceRotation;
s32 columnOddOutput3;
s32 rowC5;
s32 rowOddMix;
s32 rowSampleDc;
s32 rowOddOutput2;
s32 rowC7;
s32 rowCount;
s32 pitch5;
s32 pitch3;
s32 workspace[64];
s32 rowEvenSum;
s32 rowOddLowRotation;
s32 rowEvenRotation;
s32 rowOddDifferenceSum;
s32 rowOddHighRotation;
s32 rowOddSumDifference;
s32 columnOddDifferenceSum;
s32 columnOddHighRotation;
s32 columnOddLowRotation;
s32 columnEvenRotation;
s32 columnOddSumDifference;
int columnEvenSum;
r = (zigzag >> 4) * 8;
workspaceCursor = workspace;
processedCoefficients = 0;
{
for (; processedCoefficients < r; processedCoefficients += 8) {
u32 acBits;
coefficient4 = block[4];
coefficient6 = block[6];
coefficient2 = block[2];
coefficient1 = block[1];
coefficient7 = block[7];
coefficient5 = block[5];
coefficient3 = block[3];
acBits = (u32)coefficient4;
acBits |= (u32)coefficient6;
acBits |= (u32)coefficient2;
acBits |= (u32)coefficient1;
acBits |= (u32)coefficient7;
acBits |= (u32)coefficient5;
acBits |= (u32)coefficient3;
if (acBits == 0) {
s32 sample = block[0];
workspaceCursor[7] = sample;
workspaceCursor[6] = sample;
workspaceCursor[5] = sample;
workspaceCursor[4] = sample;
workspaceCursor[3] = sample;
workspaceCursor[2] = sample;
workspaceCursor[1] = sample;
workspaceCursor[0] = sample;
} else {
s32 oddLowSum;
s32 oddHighSum;
s32 oddLowDifference;
s32 oddHighDifference;
s32 dcValue;
evenRotation = coefficient2 - coefficient6;
oddLowSum = coefficient5 + coefficient3;
oddLowDifference = coefficient5 - coefficient3;
oddHighSum = coefficient1 + coefficient7;
oddHighDifference = coefficient1 - coefficient7;
evenRotationSum = coefficient6 + coefficient2;
evenRotation = evenRotation * 0xB5 >> 8;
oddSumDifference = oddHighSum - oddLowSum;
oddDifferenceSum = oddLowDifference + oddHighDifference;
dcValue = block[0];
evenBaseDifference = dcValue - coefficient4;
oddSumRotation = oddSumDifference * 0xB5 >> 8;
evenBaseSum = dcValue + coefficient4;
evenRotationSum = evenRotation + evenRotationSum;
evenOutput1 = evenBaseDifference + evenRotation;
z = oddDifferenceSum * 0x62 >> 8;
evenOutput0 = evenBaseSum + evenRotationSum;
evenOutput3 = evenBaseSum - evenRotationSum;
oddHighRotation = oddHighDifference * 0x14E >> 8;
evenOutput2 = evenBaseDifference - evenRotation;
m = oddHighRotation - z;
oddLowSum += m;
oddOutput0 = oddHighSum + oddLowSum;
oddOutput1 = oddSumRotation + m;
workspaceCursor[0] = evenOutput0 + oddOutput0;
oddLowRotation = oddLowDifference * 0x8B;
workspaceCursor[7] = evenOutput0 - oddOutput0;
oddLowRotation >>= 8;
workspaceCursor[1] = evenOutput1 + oddOutput1;
oddOutput3 = z + oddLowRotation;
oddOutput2 = oddOutput3 + oddSumRotation;
workspaceCursor[6] = evenOutput1 - oddOutput1;
workspaceCursor[2] = evenOutput2 + oddOutput2;
workspaceCursor[5] = evenOutput2 - oddOutput2;
workspaceCursor[3] = evenOutput3 + oddOutput3;
workspaceCursor[4] = evenOutput3 - oddOutput3;
}
block += 8;
workspaceCursor += 8;
}
}
workspaceCursor = workspace + processedCoefficients;
for (; processedCoefficients <= 0x38; processedCoefficients += 8) {
memset(workspaceCursor, 0, 0x20);
workspaceCursor += 8;
}
r = pitch * 8 - pitch;
z = pitch * 4;
m = pitch * 2;
workspaceCursor = workspace + 7;
for (columnsRemaining = 8, column = 7; columnsRemaining > 0; columnsRemaining--, column--) {
u32 acBits;
u8* output;
coefficient4 = workspaceCursor[0x20];
coefficient6 = workspaceCursor[0x30];
coefficient2 = workspaceCursor[0x10];
coefficient1 = workspaceCursor[8];
coefficient7 = workspaceCursor[0x38];
coefficient5 = workspaceCursor[0x28];
coefficient3 = workspaceCursor[0x18];
acBits = (u32)coefficient4;
acBits |= (u32)coefficient6;
acBits |= (u32)coefficient2;
acBits |= (u32)coefficient1;
acBits |= (u32)coefficient7;
acBits |= (u32)coefficient5;
acBits |= (u32)coefficient3;
output = conv_row_ptr + column;
if (acBits == 0) {
u8 sample = clampU8((*workspaceCursor >> 11) + 0x80);
output[r] = sample;
output[pitch * 6] = sample;
output[z + pitch] = sample;
output[z] = sample;
output[z - pitch] = sample;
output[m] = sample;
output[pitch] = sample;
output[0] = sample;
rowCount = (zigzag >> 4) * 8;
dst = workspace;
for (processed = 0; processed < rowCount; processed += 8) {
rowC4 = block[4];
rowC6 = block[6];
rowC2 = block[2];
rowC1 = block[1];
rowC7 = block[7];
rowC5 = block[5];
rowC3 = block[3];
rowAcBits = rowC4 | rowC6;
rowAcBits = rowC2 | rowAcBits;
rowAcBits = rowC1 | rowAcBits;
rowAcBits = rowC7 | rowAcBits;
rowAcBits = rowC5 | rowAcBits;
rowAcBits = rowC3 | rowAcBits;
if (rowAcBits == 0) {
rowSampleDc = block[0];
dst[7] = rowSampleDc;
dst[6] = rowSampleDc;
dst[5] = rowSampleDc;
dst[4] = rowSampleDc;
dst[3] = rowSampleDc;
dst[2] = rowSampleDc;
dst[1] = rowSampleDc;
dst[0] = rowSampleDc;
} else {
s32 oddLowSum;
s32 oddHighSum;
s32 dcValue;
evenRotation = coefficient2 - coefficient6;
oddLowSum = coefficient5 + coefficient3;
coefficient5 = coefficient5 - coefficient3;
oddHighSum = coefficient1 + coefficient7;
coefficient1 = coefficient1 - coefficient7;
evenRotationSum = coefficient6 + coefficient2;
coefficient2 = evenRotation * 0xB5 >> 8;
oddSumDifference = oddHighSum - oddLowSum;
oddDifferenceSum = coefficient5 + coefficient1;
dcValue = *workspaceCursor + 0x40000;
evenBaseDifference = dcValue - coefficient4;
oddSumRotation = oddSumDifference * 0xB5 >> 8;
evenBaseSum = dcValue + coefficient4;
evenRotationSum = coefficient2 + evenRotationSum;
evenOutput1 = evenBaseDifference + coefficient2;
oddDifferenceSum = oddDifferenceSum * 0x62 >> 8;
evenOutput0 = evenBaseSum + evenRotationSum;
evenOutput3 = evenBaseSum - evenRotationSum;
oddHighRotation = coefficient1 * 0x14E >> 8;
evenOutput2 = evenBaseDifference - coefficient2;
oddHighRotation = oddHighRotation - oddDifferenceSum;
oddLowSum += oddHighRotation;
oddOutput0 = oddHighSum + oddLowSum;
oddOutput1 = oddSumRotation + oddHighRotation;
oddLowRotation = coefficient5 * 0x8B >> 8;
oddOutput3 = oddDifferenceSum + oddLowRotation;
oddOutput2 = oddOutput3 + oddSumRotation;
output[0] = scalingClampU8(evenOutput0 + oddOutput0);
output[r] = scalingClampU8(evenOutput0 - oddOutput0);
output[pitch] = scalingClampU8(evenOutput1 + oddOutput1);
output[pitch * 6] = scalingClampU8(evenOutput1 - oddOutput1);
output[m] = scalingClampU8(evenOutput2 + oddOutput2);
output[z + pitch] = scalingClampU8(evenOutput2 - oddOutput2);
output[z - pitch] = scalingClampU8(evenOutput3 + oddOutput3);
output[z] = scalingClampU8(evenOutput3 - oddOutput3);
rowDc = block[0];
rowEvenRotation = rowC2 - rowC6;
rowEvenSum = rowC2 + rowC6;
rowEvenBaseSum = rowDc + rowC4;
rowEvenBaseDifference = rowDc - rowC4;
rowScaledEvenRotation = rowEvenRotation * 0xB5 >> 8;
rowEvenRotationSum = rowScaledEvenRotation + rowEvenSum;
rowEvenOutput0 = rowEvenBaseSum + rowEvenRotationSum;
rowEvenOutput1 = rowEvenBaseDifference + rowScaledEvenRotation;
rowEvenOutput2 = rowEvenBaseDifference - rowScaledEvenRotation;
rowEvenOutput3 = rowEvenBaseSum - rowEvenRotationSum;
rowOddHighSum = rowC1 + rowC7;
rowOddHighDifference = rowC1 - rowC7;
rowOddLowSum = rowC5 + rowC3;
rowOddLowDifference = rowC5 - rowC3;
rowOddSumDifference = rowOddHighSum - rowOddLowSum;
rowOddDifferenceSum = rowOddLowDifference + rowOddHighDifference;
rowOddSumRotation = rowOddSumDifference * 0xB5 >> 8;
rowOddDifferenceRotation = rowOddDifferenceSum * 0x62 >> 8;
rowOddHighRotation = rowOddHighDifference * 0x14E >> 8;
rowOddLowRotation = rowOddLowDifference * 0x8B >> 8;
rowOddMix = rowOddHighRotation - rowOddDifferenceRotation;
rowOddLowSum += rowOddMix;
rowOddOutput0 = rowOddHighSum + rowOddLowSum;
rowOddOutput1 = rowOddSumRotation + rowOddMix;
rowOddOutput3 = rowOddDifferenceRotation + rowOddLowRotation;
rowOddOutput2 = rowOddOutput3 + rowOddSumRotation;
dst[0] = rowEvenOutput0 + rowOddOutput0;
dst[7] = rowEvenOutput0 - rowOddOutput0;
dst[1] = rowEvenOutput1 + rowOddOutput1;
dst[6] = rowEvenOutput1 - rowOddOutput1;
dst[2] = rowEvenOutput2 + rowOddOutput2;
dst[5] = rowEvenOutput2 - rowOddOutput2;
dst[3] = rowEvenOutput3 + rowOddOutput3;
dst[4] = rowEvenOutput3 - rowOddOutput3;
}
workspaceCursor--;
block += 8;
dst += 8;
}
dst = workspace + processed;
for (; processed <= 56; processed += 8) {
memset(dst, 0, 32);
dst += 8;
}
src = workspace + 7;
pitch4 = pitch * 4;
pitch5 = pitch4 + pitch;
pitch3 = pitch4 - pitch;
pitch2 = pitch * 2;
pitch6 = pitch * 6;
pitch7 = pitch * 8 - pitch;
for (column = 7; column >= 0; column--) {
columnC4 = src[32];
columnC6 = src[48];
columnC2 = src[16];
columnC1 = src[8];
columnC7 = src[56];
columnC5 = src[40];
columnC3 = src[24];
columnAcBits = columnC4 | columnC6;
columnAcBits = columnC2 | columnAcBits;
columnAcBits = columnC1 | columnAcBits;
columnAcBits = columnC7 | columnAcBits;
columnAcBits = columnC5 | columnAcBits;
columnAcBits = columnC3 | columnAcBits;
columnOutput = conv_row_ptr + column;
if (columnAcBits == 0) {
columnSample = clampLumaDc(*src);
columnOutput[pitch7] = columnSample;
columnOutput[pitch6] = columnSample;
columnOutput[pitch5] = columnSample;
columnOutput[pitch4] = columnSample;
columnOutput[pitch3] = columnSample;
columnOutput[pitch2] = columnSample;
columnOutput[pitch] = columnSample;
columnOutput[0] = columnSample;
} else {
columnEvenSum = columnC6 + columnC2;
columnEvenRotation = columnC2 - columnC6;
columnOddLowSum = columnC5 + columnC3;
columnOddHighDifference = columnC1 - columnC7;
columnOddLowDifference = columnC5 - columnC3;
columnOddHighSum = columnC1 + columnC7;
columnScaledEvenRotation = columnEvenRotation * 0xB5 >> 8;
columnDc = *src + 0x40000;
columnOddDifferenceSum = columnOddLowDifference + columnOddHighDifference;
columnOddSumDifference = columnOddHighSum - columnOddLowSum;
columnOddSumRotation = columnOddSumDifference * 0xB5 >> 8;
columnEvenBaseSum = columnDc + columnC4;
columnOddDifferenceRotation = columnOddDifferenceSum * 0x62 >> 8;
columnOddHighRotation = columnOddHighDifference * 0x14E >> 8;
columnEvenRotationSum = columnScaledEvenRotation + columnEvenSum;
columnOddMix = columnOddHighRotation - columnOddDifferenceRotation;
columnOddLowSum += columnOddMix;
columnEvenOutput0 = columnEvenBaseSum + columnEvenRotationSum;
columnEvenBaseDifference = columnDc - columnC4;
columnEvenOutput3 = columnEvenBaseSum - columnEvenRotationSum;
columnEvenOutput1 = columnEvenBaseDifference + columnScaledEvenRotation;
columnOddOutput0 = columnOddHighSum + columnOddLowSum;
columnOddLowRotation = columnOddLowDifference * 0x8B >> 8;
columnOddOutput3 = columnOddDifferenceRotation + columnOddLowRotation;
columnEvenOutput2 = columnEvenBaseDifference - columnScaledEvenRotation;
columnOddOutput2 = columnOddOutput3 + columnOddSumRotation;
columnOddOutput1 = columnOddSumRotation + columnOddMix;
columnOutput[0] = scalingClampU8(columnEvenOutput0 + columnOddOutput0);
columnOutput[pitch7] = scalingClampU8(columnEvenOutput0 - columnOddOutput0);
columnOutput[pitch] = scalingClampU8(columnEvenOutput1 + columnOddOutput1);
columnOutput[pitch6] = scalingClampU8(columnEvenOutput1 - columnOddOutput1);
columnOutput[pitch2] = scalingClampU8(columnEvenOutput2 + columnOddOutput2);
columnOutput[pitch5] = scalingClampU8(columnEvenOutput2 - columnOddOutput2);
columnOutput[pitch3] = scalingClampU8(columnEvenOutput3 + columnOddOutput3);
columnOutput[pitch4] = scalingClampU8(columnEvenOutput3 - columnOddOutput3);
}
src--;
}
}
static s32 clampChromaDc(s32 value) {
return clampS8(value >> 11);
}
void TMCJPEGDEC_IdctBlock_Col(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigzag) {
s32 workspace[64];
s32* workspaceCursor;
s32 evenBaseDifference;
s32 columnsRemaining;
s32 evenBaseSum;
s32 coefficient1;
s32 coefficient2;
s32 coefficient3;
s32 coefficient4;
s32 coefficient5;
s32 coefficient6;
s32 coefficient7;
s32 v;
s32 rowCoefficientCount;
s32 processedCoefficients;
s32 rowCount;
s32 columnOddSumRotation;
s32 rowOddOutput1;
s32 columnC1;
int rowAcBits;
s32 columnEvenBaseDifference;
s32 columnC7;
s32 rowDc;
s32 rowOddSumRotation;
s32 rowEvenBaseSum;
s32 columnOddDifferenceRotation;
s32 columnEvenRotationSum;
s32* dst;
s32 columnOddOutput2;
s32 sparseDc;
s32 rowOddDifferenceRotation;
s32 columnOddOutput1;
s32 rowOddOutput2;
s32 columnDc;
s32 columnEvenBaseSum;
s32* src;
s32 rowOuter;
s32 processed;
s32 columnC6;
s32 rowOdd;
s32 column;
s32 m;
s32 n;
s32 oddOutput1;
s32 oddSumRotation;
s32 oddOutput2;
s32 evenOutput2;
s32 u;
s32 evenOutput0;
s32 oddOutput3;
s32 rotation45;
s32 z;
s32 oddSumDifference;
s32 oddDifferenceSum;
s32 oddHighRotation;
s32 oddLowRotation;
s32 evenOutput3;
s32 columnOddOutput3;
s32 rowSampleDc;
s32 rowOddOutput0;
s32 rowC3;
s32 columnScaledEvenRotation;
s32 rowRotation;
s32 rowEvenOutput2;
s32 rowC2;
s32 rowEvenBaseDifference;
s32 columnC5;
s32 rowEvenRotationSum;
s32 columnOddOutput0;
s32 rowC1;
int columnAcBits;
s32 columnC4;
s32 columnOddMix;
s32 columnOddLowSum;
s32 rowEvenOutput1;
s32 rowLowRotation;
s32 columnC3;
s32 rowOddHighDifference;
s32 rowC5;
s32 columnEvenOutput0;
s32 rowEvenOutput0;
s32 rowOddMix;
s32 rowEvenOutput3;
s32 rowC4;
s32 rowInner;
s32 rowC6;
s32 columnEvenOutput1;
s32 rowScaledEvenRotation;
s32 rowOddLowDifference;
s32 rowC7;
s32 rowOddOutput3;
s32 columnEvenOutput3;
s32 rowMid;
s32 columnOddHighDifference;
s32 columnEvenOutput2;
s32 columnC2;
s32 columnOddLowDifference;
s32 columnOddHighSum;
s32 rowOddHighSum;
s32 rowOddLowSum;
u8* columnOutput;
s32 columnOddLowRotation;
s32 rowEvenSum;
s32 flatDc;
s32 columnEvenRotation;
s32 rowOddDifferenceSum;
s32 rowOddSumDifference;
s32 columnSample;
s32 columnOddDifferenceSum;
int columnEvenSum;
s32 rowOddHighRotation;
s32 workspace[64];
s32 rowOddLowRotation;
s32 rowSample;
s32 rowEvenRotation;
s32 columnOddHighRotation;
s32 columnOddSumDifference;
s32 rowMix;
if (zigzag == 0x11) {
s32 sample;
sample = clampS8(block[0] >> 11);
memset(conv_row_ptr, (s8)sample, 0x40);
flatDc = block[0];
rowSample = clampS8(flatDc >> 11);
memset(conv_row_ptr, (s8)rowSample, 64);
return;
}
rowCoefficientCount = (zigzag >> 4) * 8;
if ((zigzag & 0xF) > 2) {
goto fullRowTransform;
}
workspaceCursor = workspace;
processedCoefficients = 0;
for (; processedCoefficients < rowCoefficientCount; processedCoefficients += 8) {
s32 dcValue;
s32 oddCoefficient;
oddCoefficient = block[1];
dcValue = block[0];
rotation45 = oddCoefficient * 0xB5 >> 8;
v = oddCoefficient * 0x62 >> 8;
u = v + rotation45;
z = (oddCoefficient * 0x14E >> 8) - v;
m = oddCoefficient + z;
n = rotation45 + z;
workspaceCursor[0] = dcValue + m;
workspaceCursor[7] = dcValue - m;
workspaceCursor[1] = dcValue + n;
workspaceCursor[6] = dcValue - n;
workspaceCursor[2] = dcValue + u;
workspaceCursor[5] = dcValue - u;
workspaceCursor[3] = dcValue + v;
workspaceCursor[4] = dcValue - v;
workspaceCursor += 8;
block += 8;
}
workspaceCursor = workspace + processedCoefficients;
for (; processedCoefficients <= 0x38; processedCoefficients += 8) {
memset(workspaceCursor, 0, 0x20);
workspaceCursor += 8;
}
goto columnTransform;
fullRowTransform:
workspaceCursor = workspace;
processedCoefficients = 0;
for (; processedCoefficients < rowCoefficientCount; processedCoefficients += 8) {
u32 acBits;
coefficient4 = block[4];
coefficient6 = block[6];
coefficient2 = block[2];
coefficient1 = block[1];
coefficient7 = block[7];
coefficient5 = block[5];
coefficient3 = block[3];
acBits = (u32)coefficient4;
acBits |= (u32)coefficient6;
acBits |= (u32)coefficient2;
acBits |= (u32)coefficient1;
acBits |= (u32)coefficient7;
acBits |= (u32)coefficient5;
acBits |= (u32)coefficient3;
if (acBits == 0) {
s32 sample;
sample = block[0];
workspaceCursor[7] = sample;
workspaceCursor[6] = sample;
workspaceCursor[5] = sample;
workspaceCursor[4] = sample;
workspaceCursor[3] = sample;
workspaceCursor[2] = sample;
workspaceCursor[1] = sample;
workspaceCursor[0] = sample;
rowCount = (zigzag >> 4) * 8;
if ((zigzag & 0xF) <= 2) {
dst = workspace;
for (processed = 0; processed < rowCount; processed += 8) {
rowOdd = block[1];
rowRotation = rowOdd * 0xB5 >> 8;
rowLowRotation = rowOdd * 0x62 >> 8;
sparseDc = block[0];
rowMix = (rowOdd * 0x14E >> 8) - rowLowRotation;
rowOuter = rowOdd + rowMix;
dst[0] = sparseDc + rowOuter;
rowInner = rowRotation + rowMix;
dst[7] = sparseDc - rowOuter;
dst[1] = sparseDc + rowInner;
rowMid = rowLowRotation + rowRotation;
dst[6] = sparseDc - rowInner;
dst[2] = sparseDc + rowMid;
dst[5] = sparseDc - rowMid;
dst[3] = sparseDc + rowLowRotation;
dst[4] = sparseDc - rowLowRotation;
dst += 8;
block += 8;
}
dst = workspace + processed;
for (; processed <= 56; processed += 8) {
memset(dst, 0, 32);
dst += 8;
}
} else {
dst = workspace;
for (processed = 0; processed < rowCount; processed += 8) {
rowC4 = block[4];
rowC6 = block[6];
rowC2 = block[2];
rowC1 = block[1];
rowC7 = block[7];
rowC5 = block[5];
rowC3 = block[3];
rowAcBits = rowC4 | rowC6;
rowAcBits = rowC2 | rowAcBits;
rowAcBits = rowC1 | rowAcBits;
rowAcBits = rowC7 | rowAcBits;
rowAcBits = rowC5 | rowAcBits;
rowAcBits = rowC3 | rowAcBits;
if (rowAcBits == 0) {
rowSampleDc = block[0];
dst[7] = rowSampleDc;
dst[6] = rowSampleDc;
dst[5] = rowSampleDc;
dst[4] = rowSampleDc;
dst[3] = rowSampleDc;
dst[2] = rowSampleDc;
dst[1] = rowSampleDc;
dst[0] = rowSampleDc;
} else {
s32 oddLowSum;
s32 oddLowDifference;
s32 oddHighSum;
s32 oddHighDifference;
s32 dcValue;
rotation45 = coefficient2 - coefficient6;
oddLowSum = coefficient5 + coefficient3;
oddLowDifference = coefficient5 - coefficient3;
oddHighSum = coefficient1 + coefficient7;
oddHighDifference = coefficient1 - coefficient7;
u = coefficient6 + coefficient2;
rotation45 = rotation45 * 0xB5 >> 8;
oddSumDifference = oddHighSum - oddLowSum;
oddDifferenceSum = oddLowDifference + oddHighDifference;
dcValue = block[0];
evenBaseDifference = dcValue - coefficient4;
oddSumRotation = oddSumDifference * 0xB5 >> 8;
evenBaseSum = dcValue + coefficient4;
u = rotation45 + u;
v = evenBaseDifference + rotation45;
z = oddDifferenceSum * 0x62 >> 8;
evenOutput0 = evenBaseSum + u;
evenOutput3 = evenBaseSum - u;
oddHighRotation = oddHighDifference * 0x14E >> 8;
evenOutput2 = evenBaseDifference - rotation45;
m = oddHighRotation - z;
oddLowSum += m;
n = oddHighSum + oddLowSum;
oddOutput1 = oddSumRotation + m;
workspaceCursor[0] = evenOutput0 + n;
oddLowRotation = oddLowDifference * 0x8B;
workspaceCursor[7] = evenOutput0 - n;
oddLowRotation >>= 8;
workspaceCursor[1] = v + oddOutput1;
oddOutput3 = z + oddLowRotation;
oddOutput2 = oddOutput3 + oddSumRotation;
workspaceCursor[6] = v - oddOutput1;
workspaceCursor[2] = evenOutput2 + oddOutput2;
workspaceCursor[5] = evenOutput2 - oddOutput2;
workspaceCursor[3] = evenOutput3 + oddOutput3;
workspaceCursor[4] = evenOutput3 - oddOutput3;
rowDc = block[0];
rowEvenRotation = rowC2 - rowC6;
rowEvenSum = rowC2 + rowC6;
rowEvenBaseSum = rowDc + rowC4;
rowEvenBaseDifference = rowDc - rowC4;
rowScaledEvenRotation = rowEvenRotation * 0xB5 >> 8;
rowEvenRotationSum = rowScaledEvenRotation + rowEvenSum;
rowEvenOutput0 = rowEvenBaseSum + rowEvenRotationSum;
rowEvenOutput1 = rowEvenBaseDifference + rowScaledEvenRotation;
rowEvenOutput2 = rowEvenBaseDifference - rowScaledEvenRotation;
rowEvenOutput3 = rowEvenBaseSum - rowEvenRotationSum;
rowOddHighSum = rowC1 + rowC7;
rowOddHighDifference = rowC1 - rowC7;
rowOddLowSum = rowC5 + rowC3;
rowOddLowDifference = rowC5 - rowC3;
rowOddSumDifference = rowOddHighSum - rowOddLowSum;
rowOddDifferenceSum = rowOddLowDifference + rowOddHighDifference;
rowOddSumRotation = rowOddSumDifference * 0xB5 >> 8;
rowOddDifferenceRotation = rowOddDifferenceSum * 0x62 >> 8;
rowOddHighRotation = rowOddHighDifference * 0x14E >> 8;
rowOddLowRotation = rowOddLowDifference * 0x8B >> 8;
rowOddMix = rowOddHighRotation - rowOddDifferenceRotation;
rowOddLowSum += rowOddMix;
rowOddOutput0 = rowOddHighSum + rowOddLowSum;
rowOddOutput1 = rowOddSumRotation + rowOddMix;
rowOddOutput3 = rowOddDifferenceRotation + rowOddLowRotation;
rowOddOutput2 = rowOddOutput3 + rowOddSumRotation;
dst[0] = rowEvenOutput0 + rowOddOutput0;
dst[7] = rowEvenOutput0 - rowOddOutput0;
dst[1] = rowEvenOutput1 + rowOddOutput1;
dst[6] = rowEvenOutput1 - rowOddOutput1;
dst[2] = rowEvenOutput2 + rowOddOutput2;
dst[5] = rowEvenOutput2 - rowOddOutput2;
dst[3] = rowEvenOutput3 + rowOddOutput3;
dst[4] = rowEvenOutput3 - rowOddOutput3;
}
block += 8;
workspaceCursor += 8;
}
workspaceCursor = workspace + processedCoefficients;
for (; processedCoefficients <= 0x38; processedCoefficients += 8) {
memset(workspaceCursor, 0, 0x20);
workspaceCursor += 8;
}
columnTransform:
workspaceCursor = workspace + 7;
for (columnsRemaining = 8, column = 7; columnsRemaining > 0; columnsRemaining--, column--) {
u32 acBits;
u8* output;
coefficient4 = workspaceCursor[0x20];
output = conv_row_ptr + column;
coefficient6 = workspaceCursor[0x30];
coefficient2 = workspaceCursor[0x10];
coefficient1 = workspaceCursor[8];
coefficient7 = workspaceCursor[0x38];
coefficient5 = workspaceCursor[0x28];
coefficient3 = workspaceCursor[0x18];
acBits = (u32)coefficient4;
acBits |= (u32)coefficient6;
acBits |= (u32)coefficient2;
acBits |= (u32)coefficient1;
acBits |= (u32)coefficient7;
acBits |= (u32)coefficient5;
acBits |= (u32)coefficient3;
if (acBits == 0) {
s32 sample;
sample = clampS8(*workspaceCursor >> 11);
output[56] = (u8)sample;
output[48] = (u8)sample;
output[40] = (u8)sample;
output[32] = (u8)sample;
output[24] = (u8)sample;
output[16] = (u8)sample;
output[8] = (u8)sample;
output[0] = (u8)sample;
} else {
s32 oddLowSum;
s32 oddLowDifference;
s32 oddHighSum;
s32 oddHighDifference;
s32 dcValue;
rotation45 = coefficient2 - coefficient6;
oddLowSum = coefficient5 + coefficient3;
oddLowDifference = coefficient5 - coefficient3;
oddHighSum = coefficient1 + coefficient7;
oddHighDifference = coefficient1 - coefficient7;
u = coefficient6 + coefficient2;
rotation45 = rotation45 * 0xB5 >> 8;
oddSumDifference = oddHighSum - oddLowSum;
oddDifferenceSum = oddLowDifference + oddHighDifference;
dcValue = *workspaceCursor;
evenBaseDifference = dcValue - coefficient4;
oddSumRotation = oddSumDifference * 0xB5 >> 8;
evenBaseSum = dcValue + coefficient4;
u = rotation45 + u;
v = evenBaseDifference + rotation45;
z = oddDifferenceSum * 0x62 >> 8;
evenOutput0 = evenBaseSum + u;
evenOutput3 = evenBaseSum - u;
oddHighRotation = oddHighDifference * 0x14E >> 8;
evenOutput2 = evenBaseDifference - rotation45;
m = oddHighRotation - z;
oddLowSum += m;
n = oddHighSum + oddLowSum;
oddOutput1 = oddSumRotation + m;
oddLowRotation = oddLowDifference * 0x8B >> 8;
oddOutput3 = z + oddLowRotation;
oddOutput2 = oddOutput3 + oddSumRotation;
output[0] = (u8)clampS8((evenOutput0 + n) >> 11);
output[56] = (u8)clampS8((evenOutput0 - n) >> 11);
output[8] = (u8)clampS8((v + oddOutput1) >> 11);
output[48] = (u8)clampS8((v - oddOutput1) >> 11);
output[16] = (u8)clampS8((evenOutput2 + oddOutput2) >> 11);
output[40] = (u8)clampS8((evenOutput2 - oddOutput2) >> 11);
output[24] = (u8)clampS8((evenOutput3 + oddOutput3) >> 11);
output[32] = (u8)clampS8((evenOutput3 - oddOutput3) >> 11);
dst += 8;
}
workspaceCursor--;
dst = workspace + processed;
for (; processed <= 56; processed += 8) {
memset(dst, 0, 32);
dst += 8;
}
}
src = workspace + 7;
for (column = 7; column >= 0; column--) {
columnC4 = src[32];
columnOutput = conv_row_ptr + column;
columnC6 = src[48];
columnC2 = src[16];
columnC1 = src[8];
columnC7 = src[56];
columnC5 = src[40];
columnC3 = src[24];
columnAcBits = columnC4 | columnC6;
columnAcBits = columnC2 | columnAcBits;
columnAcBits = columnC1 | columnAcBits;
columnAcBits = columnC7 | columnAcBits;
columnAcBits = columnC5 | columnAcBits;
columnAcBits = columnC3 | columnAcBits;
if (columnAcBits == 0) {
columnSample = clampChromaDc(*src);
columnOutput[56] = (u8)columnSample;
columnOutput[48] = (u8)columnSample;
columnOutput[40] = (u8)columnSample;
columnOutput[32] = (u8)columnSample;
columnOutput[24] = (u8)columnSample;
columnOutput[16] = (u8)columnSample;
columnOutput[8] = (u8)columnSample;
columnOutput[0] = (u8)columnSample;
} else {
columnOddHighSum = columnC1 + columnC7;
columnEvenRotation = columnC2 - columnC6;
columnOddLowSum = columnC5 + columnC3;
columnOddSumDifference = columnOddHighSum - columnOddLowSum;
columnEvenSum = columnC6 + columnC2;
columnOddLowDifference = columnC5 - columnC3;
columnScaledEvenRotation = columnEvenRotation * 0xB5 >> 8;
columnOddHighDifference = columnC1 - columnC7;
columnDc = *src;
columnEvenRotationSum = columnScaledEvenRotation + columnEvenSum;
columnOddSumRotation = columnOddSumDifference * 0xB5 >> 8;
columnOddDifferenceSum = columnOddLowDifference + columnOddHighDifference;
columnOddDifferenceRotation = columnOddDifferenceSum * 0x62 >> 8;
columnEvenBaseDifference = columnDc - columnC4;
columnEvenBaseSum = columnDc + columnC4;
columnOddHighRotation = columnOddHighDifference * 0x14E >> 8;
columnOddMix = columnOddHighRotation - columnOddDifferenceRotation;
columnEvenOutput3 = columnEvenBaseSum - columnEvenRotationSum;
columnEvenOutput1 = columnEvenBaseDifference + columnScaledEvenRotation;
columnEvenOutput2 = columnEvenBaseDifference - columnScaledEvenRotation;
columnEvenOutput0 = columnEvenBaseSum + columnEvenRotationSum;
columnOddLowRotation = columnOddLowDifference * 0x8B >> 8;
columnOddOutput3 = columnOddDifferenceRotation + columnOddLowRotation;
columnOddLowSum += columnOddMix;
columnOddOutput1 = columnOddSumRotation + columnOddMix;
columnOddOutput0 = columnOddHighSum + columnOddLowSum;
columnOddOutput2 = columnOddOutput3 + columnOddSumRotation;
columnOutput[0] = (u8)clampS8((columnEvenOutput0 + columnOddOutput0) >> 11);
columnOutput[56] = (u8)clampS8((columnEvenOutput0 - columnOddOutput0) >> 11);
columnOutput[8] = (u8)clampS8((columnEvenOutput1 + columnOddOutput1) >> 11);
columnOutput[48] = (u8)clampS8((columnEvenOutput1 - columnOddOutput1) >> 11);
columnOutput[16] = (u8)clampS8((columnEvenOutput2 + columnOddOutput2) >> 11);
columnOutput[40] = (u8)clampS8((columnEvenOutput2 - columnOddOutput2) >> 11);
columnOutput[24] = (u8)clampS8((columnEvenOutput3 + columnOddOutput3) >> 11);
columnOutput[32] = (u8)clampS8((columnEvenOutput3 - columnOddOutput3) >> 11);
}
src--;
}
}

View File

@@ -14,7 +14,37 @@ static void TMCJPEGDEC_converterYUV444toRGB565edge(TMCCJPEGDecWork*, s32, s32);
static void TMCJPEGDEC_converterYUV400toRGB565(TMCCJPEGDecWork*, s32, s32);
static void TMCJPEGDEC_converterYUV400toRGB565edge(TMCCJPEGDecWork*, s32, s32);
#pragma push
#pragma optimization_level 1
s32 TMCJPEGDEC_set_converterRGB565(TMCCJPEGDecWork* work) {
u8 mode411;
u8* crBlock411;
u8* cbBlock411;
u8* fourthRow411;
u8* thirdRow411;
u8* secondRow411;
u8* firstRow411;
TMCConverterFunc* edgeConverter411;
TMCConverterFunc* converter411;
u8 mode422;
u8* crBlock422;
u8* cbBlock422;
u8* secondRow422;
u8* firstRow422;
TMCConverterFunc* edgeConverter422;
TMCConverterFunc* converter422;
u8 mode420;
u8* crBlock420;
u8* cbBlock420;
u8* fourthRow420;
u8* thirdRow420;
u8* secondRow420;
u8* firstRow420;
TMCConverterFunc* edgeConverter420;
TMCConverterFunc* converter420;
u8* buffer;
s32 componentCount;
TMCCJPEGDecState* state;
@@ -25,97 +55,84 @@ s32 TMCJPEGDEC_set_converterRGB565(TMCCJPEGDecWork* work) {
switch (componentCount) {
case 0: {
u8 mode;
u8* firstRow;
u8* secondRow;
u8* thirdRow;
u8* fourthRow;
u8* cbBlock;
u8* crBlock;
mode = work->idctMode;
firstRow = buffer + 4;
work->pConverterFunc = TMCJPEGDEC_converterYUV411toRGB565;
work->pConverterFuncEdge = TMCJPEGDEC_converterYUV411toRGB565edge;
secondRow = firstRow + mode;
thirdRow = secondRow + mode;
fourthRow = thirdRow + mode;
cbBlock = buffer + 260;
crBlock = buffer + 324;
work->pConvRowPtrs[0] = firstRow;
work->pConvRowPtrs[1] = secondRow;
work->pConvRowPtrs[2] = thirdRow;
work->pConvRowPtrs[3] = fourthRow;
work->pConvRowPtrs[5] = cbBlock;
work->pConvRowPtrs[6] = crBlock;
mode411 = work->idctMode;
firstRow411 = buffer + 4;
converter411 = TMCJPEGDEC_converterYUV411toRGB565;
edgeConverter411 = TMCJPEGDEC_converterYUV411toRGB565edge;
secondRow411 = firstRow411 + mode411;
thirdRow411 = secondRow411 + mode411;
fourthRow411 = thirdRow411 + mode411;
cbBlock411 = buffer + 260;
crBlock411 = buffer + 324;
work->pConverterFunc = converter411;
work->pConverterFuncEdge = edgeConverter411;
work->pConvRowPtrs[0] = firstRow411;
work->pConvRowPtrs[1] = secondRow411;
work->pConvRowPtrs[2] = thirdRow411;
work->pConvRowPtrs[3] = fourthRow411;
work->pConvRowPtrs[5] = cbBlock411;
work->pConvRowPtrs[6] = crBlock411;
work->pitch = 32;
work->converterFlags = 0;
break;
}
case 1: {
u8 mode;
u8* firstRow;
u8* secondRow;
u8* cbBlock;
u8* crBlock;
mode = work->idctMode;
firstRow = buffer + 4;
work->pConverterFunc = TMCJPEGDEC_converterYUV422toRGB565;
work->pConverterFuncEdge = TMCJPEGDEC_converterYUV422toRGB565edge;
secondRow = firstRow + mode;
cbBlock = buffer + 132;
crBlock = buffer + 196;
work->pConvRowPtrs[0] = firstRow;
work->pConvRowPtrs[1] = secondRow;
work->pConvRowPtrs[5] = cbBlock;
work->pConvRowPtrs[6] = crBlock;
mode422 = work->idctMode;
firstRow422 = buffer + 4;
converter422 = TMCJPEGDEC_converterYUV422toRGB565;
edgeConverter422 = TMCJPEGDEC_converterYUV422toRGB565edge;
secondRow422 = firstRow422 + mode422;
cbBlock422 = buffer + 132;
crBlock422 = buffer + 196;
work->pConverterFunc = converter422;
work->pConverterFuncEdge = edgeConverter422;
work->pConvRowPtrs[0] = firstRow422;
work->pConvRowPtrs[1] = secondRow422;
work->pConvRowPtrs[5] = cbBlock422;
work->pConvRowPtrs[6] = crBlock422;
work->pitch = 16;
work->converterFlags = 0;
break;
}
case 2: {
u8 mode;
u8* firstRow;
u8* secondRow;
u8* thirdRow;
u8* fourthRow;
u8* cbBlock;
u8* crBlock;
mode = work->idctMode;
firstRow = buffer + 4;
work->pConverterFunc = TMCJPEGDEC_converterYUV420toRGB565;
work->pConverterFuncEdge = TMCJPEGDEC_converterYUV420toRGB565edge;
secondRow = firstRow + mode;
thirdRow = firstRow + mode * 16;
fourthRow = thirdRow + mode;
cbBlock = buffer + 260;
crBlock = buffer + 324;
work->pConvRowPtrs[0] = firstRow;
work->pConvRowPtrs[1] = secondRow;
work->pConvRowPtrs[2] = thirdRow;
work->pConvRowPtrs[3] = fourthRow;
work->pConvRowPtrs[5] = cbBlock;
work->pConvRowPtrs[6] = crBlock;
mode420 = work->idctMode;
firstRow420 = buffer + 4;
converter420 = TMCJPEGDEC_converterYUV420toRGB565;
edgeConverter420 = TMCJPEGDEC_converterYUV420toRGB565edge;
secondRow420 = firstRow420 + mode420;
thirdRow420 = firstRow420 + mode420 * 16;
fourthRow420 = thirdRow420 + mode420;
cbBlock420 = buffer + 260;
crBlock420 = buffer + 324;
work->pConverterFunc = converter420;
work->pConverterFuncEdge = edgeConverter420;
work->pConvRowPtrs[0] = firstRow420;
work->pConvRowPtrs[1] = secondRow420;
work->pConvRowPtrs[2] = thirdRow420;
work->pConvRowPtrs[3] = fourthRow420;
work->pConvRowPtrs[5] = cbBlock420;
work->pConvRowPtrs[6] = crBlock420;
work->pitch = 16;
work->converterFlags = 0;
break;
}
case 3: {
u8 mode;
u8* firstRow;
u8* secondRow;
u8* cbBlock;
u32 mode;
u8* crBlock;
u8* cbBlock;
u8* secondRow;
u8* firstRow;
TMCConverterFunc* edgeConverter;
TMCConverterFunc* converter;
mode = work->idctMode;
firstRow = buffer + 4;
work->pConverterFunc = TMCJPEGDEC_converterYUV211toRGB565;
work->pConverterFuncEdge = TMCJPEGDEC_converterYUV211toRGB565edge;
converter = TMCJPEGDEC_converterYUV211toRGB565;
edgeConverter = TMCJPEGDEC_converterYUV211toRGB565edge;
secondRow = firstRow + mode * 8;
cbBlock = buffer + 132;
crBlock = buffer + 196;
work->pConverterFunc = converter;
work->pConverterFuncEdge = edgeConverter;
work->pConvRowPtrs[0] = firstRow;
work->pConvRowPtrs[1] = secondRow;
work->pConvRowPtrs[5] = cbBlock;
@@ -125,27 +142,27 @@ s32 TMCJPEGDEC_set_converterRGB565(TMCCJPEGDecWork* work) {
break;
}
case 4: {
TMCConverterFunc* converter;
TMCConverterFunc* edgeConverter;
TMCConverterFunc* converter;
converter = TMCJPEGDEC_converterYUV444toRGB565;
edgeConverter = TMCJPEGDEC_converterYUV444toRGB565edge;
work->pConverterFunc = converter;
work->pConverterFuncEdge = edgeConverter;
work->pConvRowPtrs[0] = buffer + 4;
work->pConvRowPtrs[5] = buffer + 0x44;
work->pConvRowPtrs[6] = buffer + 0x84;
work->pConverterFunc = converter;
work->pConverterFuncEdge = edgeConverter;
work->pitch = 0x08;
work->converterFlags = 0;
break;
}
case 5: {
TMCConverterFunc* converter;
TMCConverterFunc* edgeConverter;
TMCConverterFunc* converter;
converter = TMCJPEGDEC_converterYUV400toRGB565;
edgeConverter = TMCJPEGDEC_converterYUV400toRGB565edge;
work->pConvRowPtrs[0] = buffer + 4;
work->pConverterFunc = converter;
work->pConverterFuncEdge = edgeConverter;
work->pConvRowPtrs[0] = buffer + 4;
work->pitch = 0x08;
work->converterFlags = 0;
break;
@@ -158,13 +175,19 @@ s32 TMCJPEGDEC_set_converterRGB565(TMCCJPEGDecWork* work) {
{
s32 width = state->jpegWidth;
s32 height = state->jpegHeight;
state->convWidth = ((u32)width / 4 + (width % 4 != 0)) * 4;
state->convHeight = ((u32)height / 4 + (height % 4 != 0)) * 4;
s32 roundedWidth;
s32 heightPadding;
roundedWidth = (u32)width / 4 + (width % 4 != 0);
heightPadding = height % 4 != 0;
state->convWidth = roundedWidth * 4;
state->convHeight = ((u32)height / 4 + heightPadding) * 4;
}
return 0;
}
#pragma pop
static void TMCJPEGDEC_converterYUV411toRGB565(TMCCJPEGDecWork* work, s32 x, s32 y) {
s32 tileColumn;
s32 red;

View File

@@ -14,7 +14,37 @@ static void TMCJPEGDEC_converterYUV444toRGBA8edge(TMCCJPEGDecWork*, s32, s32);
static void TMCJPEGDEC_converterYUV400toRGBA8(TMCCJPEGDecWork*, s32, s32);
static void TMCJPEGDEC_converterYUV400toRGBA8edge(TMCCJPEGDecWork*, s32, s32);
#pragma push
#pragma optimization_level 1
s32 TMCJPEGDEC_set_converterRGBA8(TMCCJPEGDecWork* work) {
u8 mode411;
u8* crBlock411;
u8* cbBlock411;
u8* fourthRow411;
u8* thirdRow411;
u8* secondRow411;
u8* firstRow411;
TMCConverterFunc* edgeConverter411;
TMCConverterFunc* converter411;
u8 mode422;
u8* crBlock422;
u8* cbBlock422;
u8* secondRow422;
u8* firstRow422;
TMCConverterFunc* edgeConverter422;
TMCConverterFunc* converter422;
u8 mode420;
u8* crBlock420;
u8* cbBlock420;
u8* fourthRow420;
u8* thirdRow420;
u8* secondRow420;
u8* firstRow420;
TMCConverterFunc* edgeConverter420;
TMCConverterFunc* converter420;
u8* buffer;
s32 componentCount;
TMCCJPEGDecState* state;
@@ -25,97 +55,84 @@ s32 TMCJPEGDEC_set_converterRGBA8(TMCCJPEGDecWork* work) {
switch (componentCount) {
case 0: {
u8 mode;
u8* firstRow;
u8* secondRow;
u8* thirdRow;
u8* fourthRow;
u8* cbBlock;
u8* crBlock;
mode = work->idctMode;
firstRow = buffer + 4;
work->pConverterFunc = TMCJPEGDEC_converterYUV411toRGBA8;
work->pConverterFuncEdge = TMCJPEGDEC_converterYUV411toRGBA8edge;
secondRow = firstRow + mode;
thirdRow = secondRow + mode;
fourthRow = thirdRow + mode;
cbBlock = buffer + 260;
crBlock = buffer + 324;
work->pConvRowPtrs[0] = firstRow;
work->pConvRowPtrs[1] = secondRow;
work->pConvRowPtrs[2] = thirdRow;
work->pConvRowPtrs[3] = fourthRow;
work->pConvRowPtrs[5] = cbBlock;
work->pConvRowPtrs[6] = crBlock;
mode411 = work->idctMode;
firstRow411 = buffer + 4;
converter411 = TMCJPEGDEC_converterYUV411toRGBA8;
edgeConverter411 = TMCJPEGDEC_converterYUV411toRGBA8edge;
secondRow411 = firstRow411 + mode411;
thirdRow411 = secondRow411 + mode411;
fourthRow411 = thirdRow411 + mode411;
cbBlock411 = buffer + 260;
crBlock411 = buffer + 324;
work->pConverterFunc = converter411;
work->pConverterFuncEdge = edgeConverter411;
work->pConvRowPtrs[0] = firstRow411;
work->pConvRowPtrs[1] = secondRow411;
work->pConvRowPtrs[2] = thirdRow411;
work->pConvRowPtrs[3] = fourthRow411;
work->pConvRowPtrs[5] = cbBlock411;
work->pConvRowPtrs[6] = crBlock411;
work->pitch = 32;
work->converterFlags = 0;
break;
}
case 1: {
u8 mode;
u8* firstRow;
u8* secondRow;
u8* cbBlock;
u8* crBlock;
mode = work->idctMode;
firstRow = buffer + 4;
work->pConverterFunc = TMCJPEGDEC_converterYUV422toRGBA8;
work->pConverterFuncEdge = TMCJPEGDEC_converterYUV422toRGBA8edge;
secondRow = firstRow + mode;
cbBlock = buffer + 132;
crBlock = buffer + 196;
work->pConvRowPtrs[0] = firstRow;
work->pConvRowPtrs[1] = secondRow;
work->pConvRowPtrs[5] = cbBlock;
work->pConvRowPtrs[6] = crBlock;
mode422 = work->idctMode;
firstRow422 = buffer + 4;
converter422 = TMCJPEGDEC_converterYUV422toRGBA8;
edgeConverter422 = TMCJPEGDEC_converterYUV422toRGBA8edge;
secondRow422 = firstRow422 + mode422;
cbBlock422 = buffer + 132;
crBlock422 = buffer + 196;
work->pConverterFunc = converter422;
work->pConverterFuncEdge = edgeConverter422;
work->pConvRowPtrs[0] = firstRow422;
work->pConvRowPtrs[1] = secondRow422;
work->pConvRowPtrs[5] = cbBlock422;
work->pConvRowPtrs[6] = crBlock422;
work->pitch = 16;
work->converterFlags = 0;
break;
}
case 2: {
u8 mode;
u8* firstRow;
u8* secondRow;
u8* thirdRow;
u8* fourthRow;
u8* cbBlock;
u8* crBlock;
mode = work->idctMode;
firstRow = buffer + 4;
work->pConverterFunc = TMCJPEGDEC_converterYUV420toRGBA8;
work->pConverterFuncEdge = TMCJPEGDEC_converterYUV420toRGBA8edge;
secondRow = firstRow + mode;
thirdRow = firstRow + mode * 16;
fourthRow = thirdRow + mode;
cbBlock = buffer + 260;
crBlock = buffer + 324;
work->pConvRowPtrs[0] = firstRow;
work->pConvRowPtrs[1] = secondRow;
work->pConvRowPtrs[2] = thirdRow;
work->pConvRowPtrs[3] = fourthRow;
work->pConvRowPtrs[5] = cbBlock;
work->pConvRowPtrs[6] = crBlock;
mode420 = work->idctMode;
firstRow420 = buffer + 4;
converter420 = TMCJPEGDEC_converterYUV420toRGBA8;
edgeConverter420 = TMCJPEGDEC_converterYUV420toRGBA8edge;
secondRow420 = firstRow420 + mode420;
thirdRow420 = firstRow420 + mode420 * 16;
fourthRow420 = thirdRow420 + mode420;
cbBlock420 = buffer + 260;
crBlock420 = buffer + 324;
work->pConverterFunc = converter420;
work->pConverterFuncEdge = edgeConverter420;
work->pConvRowPtrs[0] = firstRow420;
work->pConvRowPtrs[1] = secondRow420;
work->pConvRowPtrs[2] = thirdRow420;
work->pConvRowPtrs[3] = fourthRow420;
work->pConvRowPtrs[5] = cbBlock420;
work->pConvRowPtrs[6] = crBlock420;
work->pitch = 16;
work->converterFlags = 0;
break;
}
case 3: {
u8 mode;
u8* firstRow;
u8* secondRow;
u8* cbBlock;
u32 mode;
u8* crBlock;
u8* cbBlock;
u8* secondRow;
u8* firstRow;
TMCConverterFunc* edgeConverter;
TMCConverterFunc* converter;
mode = work->idctMode;
firstRow = buffer + 4;
work->pConverterFunc = TMCJPEGDEC_converterYUV211toRGBA8;
work->pConverterFuncEdge = TMCJPEGDEC_converterYUV211toRGBA8edge;
converter = TMCJPEGDEC_converterYUV211toRGBA8;
edgeConverter = TMCJPEGDEC_converterYUV211toRGBA8edge;
secondRow = firstRow + mode * 8;
cbBlock = buffer + 132;
crBlock = buffer + 196;
work->pConverterFunc = converter;
work->pConverterFuncEdge = edgeConverter;
work->pConvRowPtrs[0] = firstRow;
work->pConvRowPtrs[1] = secondRow;
work->pConvRowPtrs[5] = cbBlock;
@@ -125,27 +142,27 @@ s32 TMCJPEGDEC_set_converterRGBA8(TMCCJPEGDecWork* work) {
break;
}
case 4: {
TMCConverterFunc* converter;
TMCConverterFunc* edgeConverter;
TMCConverterFunc* converter;
converter = TMCJPEGDEC_converterYUV444toRGBA8;
edgeConverter = TMCJPEGDEC_converterYUV444toRGBA8edge;
work->pConverterFunc = converter;
work->pConverterFuncEdge = edgeConverter;
work->pConvRowPtrs[0] = buffer + 4;
work->pConvRowPtrs[5] = buffer + 0x44;
work->pConvRowPtrs[6] = buffer + 0x84;
work->pConverterFunc = converter;
work->pConverterFuncEdge = edgeConverter;
work->pitch = 0x08;
work->converterFlags = 0;
break;
}
case 5: {
TMCConverterFunc* converter;
TMCConverterFunc* edgeConverter;
TMCConverterFunc* converter;
converter = TMCJPEGDEC_converterYUV400toRGBA8;
edgeConverter = TMCJPEGDEC_converterYUV400toRGBA8edge;
work->pConvRowPtrs[0] = buffer + 4;
work->pConverterFunc = converter;
work->pConverterFuncEdge = edgeConverter;
work->pConvRowPtrs[0] = buffer + 4;
work->pitch = 0x08;
work->converterFlags = 0;
break;
@@ -158,129 +175,127 @@ s32 TMCJPEGDEC_set_converterRGBA8(TMCCJPEGDecWork* work) {
{
s32 width = state->jpegWidth;
s32 height = state->jpegHeight;
state->convWidth = ((u32)width / 4 + (width % 4 != 0)) * 4;
state->convHeight = ((u32)height / 4 + (height % 4 != 0)) * 4;
s32 roundedWidth;
s32 heightPadding;
roundedWidth = (u32)width / 4 + (width % 4 != 0);
heightPadding = height % 4 != 0;
state->convWidth = roundedWidth * 4;
state->convHeight = ((u32)height / 4 + heightPadding) * 4;
}
return 0;
}
#pragma pop
static void TMCJPEGDEC_converterYUV411toRGBA8(TMCCJPEGDecWork* work, s32 x, s32 y) {
u16* output;
s32 tileRow;
s32 secondGreen;
s32 thirdGreen;
s32 fourthBlue;
s32 columnInTile;
s32 secondColumnInTile;
s32 thirdColumnInTile;
s32 fourthColumnInTile;
s32 red;
s32 secondBlue;
s32 thirdBlue;
s32 fourthGreen;
s32 green;
s32 secondRed;
s32 thirdRed;
s32 fourthRed;
u8* texture;
u8* luminance;
u8* cb;
u8* cr;
TMCCJPEGDecState* state;
u8* texture;
s32 height;
s32 column;
s32 xEnd;
s32 green;
s32 yEnd;
s32 tileWidth;
s32 blueOffset;
s32 greenOffset;
s32 tileRow;
s32 lumaSkip;
s8 crValue;
s32 chromaSkip;
s32 width;
s32 cbValue;
u8 value;
s32 row;
u16* output;
s32 redOffset;
s32 greenOffset;
s32 blueOffset;
s32 blue;
s32 value;
TMCCJPEGDecState* state;
s32 width;
s32 height;
s8 crValue;
s32 cbValue;
luminance = work->convBuf + 4;
cb = work->convBuf + 260;
cr = work->convBuf + 324;
cb = &work->convBuf[260];
cr = &work->convBuf[324];
state = work->pState;
tileWidth = (state->convWidth >> 2) << 1;
texture = state->pTexBuffer;
width = 32 / state->scaleFactor;
height = 8 / state->scaleFactor;
{
yEnd = y + height;
xEnd = x + width;
lumaSkip = 32 - width;
chromaSkip = lumaSkip >> 2;
for (row = y; row < yEnd; row++) {
output = (u16*)(texture + ((row & 3) << 3));
tileRow = (row >> 2) * tileWidth;
for (column = x; column < xEnd; column += 4) {
{
cbValue = (s8)*cb++;
crValue = (s8)*cr++;
redOffset = (crValue * 359) >> 8;
greenOffset = -(crValue * 183 + cbValue * 88) >> 8;
blueOffset = (cbValue * 454) >> 8;
}
{
value = *luminance++;
green = value + greenOffset;
red = value + redOffset;
blue = value + blueOffset;
if ((red | green | blue) >> 8) {
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
green = green > 255 ? 255 : green < 0 ? 0 : green;
red = red > 255 ? 255 : red < 0 ? 0 : red;
}
red = (u8)red + 0x10000 - 0x100;
output[(column & 3) + (((((column) >> 2) << 1) + tileRow) << 4)] = red;
output[(column & 3) + (((((column) >> 2) << 1) + tileRow + 1) << 4)] = ((green & 255) << 8) + (blue & 255);
}
{
value = *luminance++;
green = value + greenOffset;
red = value + redOffset;
blue = value + blueOffset;
if ((red | green | blue) >> 8) {
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
green = green > 255 ? 255 : green < 0 ? 0 : green;
red = red > 255 ? 255 : red < 0 ? 0 : red;
}
red = (u8)red + 0x10000 - 0x100;
output[(column + 1 & 3) + (((((column + 1) >> 2) << 1) + tileRow) << 4)] = red;
output[(column + 1 & 3) + (((((column + 1) >> 2) << 1) + tileRow + 1) << 4)] = ((green & 255) << 8) + (blue & 255);
}
{
value = *luminance++;
green = value + greenOffset;
red = value + redOffset;
blue = value + blueOffset;
if ((red | green | blue) >> 8) {
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
green = green > 255 ? 255 : green < 0 ? 0 : green;
red = red > 255 ? 255 : red < 0 ? 0 : red;
}
red = (u8)red + 0x10000 - 0x100;
output[(column + 2 & 3) + (((((column + 2) >> 2) << 1) + tileRow) << 4)] = red;
output[(column + 2 & 3) + (((((column + 2) >> 2) << 1) + tileRow + 1) << 4)] = ((green & 255) << 8) + (blue & 255);
}
{
value = *luminance++;
green = value + greenOffset;
red = value + redOffset;
blue = value + blueOffset;
if ((red | green | blue) >> 8) {
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
green = green > 255 ? 255 : green < 0 ? 0 : green;
red = red > 255 ? 255 : red < 0 ? 0 : red;
}
red = (u8)red + 0x10000 - 0x100;
output[(column + 3 & 3) + (((((column + 3) >> 2) << 1) + tileRow) << 4)] = red;
output[(column + 3 & 3) + (((((column + 3) >> 2) << 1) + tileRow + 1) << 4)] = ((green & 255) << 8) + (blue & 255);
}
xEnd = x + width;
yEnd = y + height;
for (; y < yEnd; y++) {
for (column = x; column < xEnd; column += 4) {
cbValue = (s8)*cb++;
crValue = (s8)*cr++;
redOffset = (crValue * 359) >> 8;
greenOffset = -(cbValue * 88 + crValue * 183) >> 8;
blueOffset = (cbValue * 454) >> 8;
value = *luminance++;
green = value + greenOffset;
red = value + redOffset;
blue = value + blueOffset;
if ((red | green | blue) >> 8) {
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
green = green > 255 ? 255 : green < 0 ? 0 : green;
red = red > 255 ? 255 : red < 0 ? 0 : red;
}
luminance += lumaSkip;
cb += chromaSkip;
cr += chromaSkip;
columnInTile = column & 3;
(output = (u16*)(texture + ((y & 3) << 3)))[
columnInTile + ((((column >> 2) << 1) +
(tileRow = (y >> 2) * tileWidth)) << 4)] = (u8)red + 0x10000 - 0x100;
output[columnInTile + ((((column >> 2) << 1) + (tileRow + 1)) << 4)] = ((green & 255) << 8) + (blue & 255);
value = *luminance++;
secondGreen = value + greenOffset;
secondRed = value + redOffset;
secondBlue = value + blueOffset;
if ((secondRed | secondGreen | secondBlue) >> 8) {
secondBlue = secondBlue > 255 ? 255 : secondBlue < 0 ? 0 : secondBlue;
secondGreen = secondGreen > 255 ? 255 : secondGreen < 0 ? 0 : secondGreen;
secondRed = secondRed > 255 ? 255 : secondRed < 0 ? 0 : secondRed;
}
secondColumnInTile = (column + 1) & 3;
output[secondColumnInTile + (((((column + 1) >> 2) << 1) + tileRow) << 4)] = (u8)secondRed + 0x10000 - 0x100;
output[secondColumnInTile + (((((column + 1) >> 2) << 1) + (tileRow + 1)) << 4)] = ((secondGreen & 255) << 8) + (secondBlue & 255);
value = *luminance++;
thirdGreen = value + greenOffset;
thirdRed = value + redOffset;
thirdBlue = value + blueOffset;
if ((thirdRed | thirdGreen | thirdBlue) >> 8) {
thirdBlue = thirdBlue > 255 ? 255 : thirdBlue < 0 ? 0 : thirdBlue;
thirdGreen = thirdGreen > 255 ? 255 : thirdGreen < 0 ? 0 : thirdGreen;
thirdRed = thirdRed > 255 ? 255 : thirdRed < 0 ? 0 : thirdRed;
}
thirdColumnInTile = (column + 2) & 3;
output[thirdColumnInTile + (((((column + 2) >> 2) << 1) + tileRow) << 4)] = (u8)thirdRed + 0x10000 - 0x100;
output[thirdColumnInTile + (((((column + 2) >> 2) << 1) + (tileRow + 1)) << 4)] = ((thirdGreen & 255) << 8) + (thirdBlue & 255);
value = *luminance++;
fourthGreen = value + greenOffset;
fourthRed = value + redOffset;
fourthBlue = value + blueOffset;
if ((fourthRed | fourthGreen | fourthBlue) >> 8) {
fourthBlue = fourthBlue > 255 ? 255 : fourthBlue < 0 ? 0 : fourthBlue;
fourthGreen = fourthGreen > 255 ? 255 : fourthGreen < 0 ? 0 : fourthGreen;
fourthRed = fourthRed > 255 ? 255 : fourthRed < 0 ? 0 : fourthRed;
}
fourthColumnInTile = (column + 3) & 3;
output[fourthColumnInTile + (((((column + 3) >> 2) << 1) + tileRow) << 4)] = (u8)fourthRed + 0x10000 - 0x100;
output[fourthColumnInTile + (((((column + 3) >> 2) << 1) + (tileRow + 1)) << 4)] = ((fourthGreen & 255) << 8) + (fourthBlue & 255);
}
luminance += (32 - width);
cb += ((32 - width) >> 2);
cr += ((32 - width) >> 2);
}
}

View File

@@ -14,7 +14,37 @@ static void TMCJPEG_814F32E4(TMCCJPEGDecWork*, s32, s32);
static void TMCJPEG_814F34A4(TMCCJPEGDecWork*, s32, s32);
static void TMCJPEG_814F372C(TMCCJPEGDecWork*, s32, s32);
#pragma push
#pragma optimization_level 1
s32 TMCJPEGDEC_set_converterY8U8V8(TMCCJPEGDecWork* work) {
u8 mode411;
u8* crBlock411;
u8* cbBlock411;
u8* fourthRow411;
u8* thirdRow411;
u8* secondRow411;
u8* firstRow411;
TMCConverterFunc* edgeConverter411;
TMCConverterFunc* converter411;
u8 mode422;
u8* crBlock422;
u8* cbBlock422;
u8* secondRow422;
u8* firstRow422;
TMCConverterFunc* edgeConverter422;
TMCConverterFunc* converter422;
u8 mode420;
u8* crBlock420;
u8* cbBlock420;
u8* fourthRow420;
u8* thirdRow420;
u8* secondRow420;
u8* firstRow420;
TMCConverterFunc* edgeConverter420;
TMCConverterFunc* converter420;
u8* buffer;
s32 componentCount;
TMCCJPEGDecState* state;
@@ -25,97 +55,84 @@ s32 TMCJPEGDEC_set_converterY8U8V8(TMCCJPEGDecWork* work) {
switch (componentCount) {
case 0: {
u8 mode;
u8* firstRow;
u8* secondRow;
u8* thirdRow;
u8* fourthRow;
u8* cbBlock;
u8* crBlock;
mode = work->idctMode;
firstRow = buffer + 4;
work->pConverterFunc = TMCJPEG_814EFEAC;
work->pConverterFuncEdge = TMCJPEG_814F043C;
secondRow = firstRow + mode;
thirdRow = secondRow + mode;
fourthRow = thirdRow + mode;
cbBlock = buffer + 260;
crBlock = buffer + 324;
work->pConvRowPtrs[0] = firstRow;
work->pConvRowPtrs[1] = secondRow;
work->pConvRowPtrs[2] = thirdRow;
work->pConvRowPtrs[3] = fourthRow;
work->pConvRowPtrs[5] = cbBlock;
work->pConvRowPtrs[6] = crBlock;
mode411 = work->idctMode;
firstRow411 = buffer + 4;
converter411 = TMCJPEG_814EFEAC;
edgeConverter411 = TMCJPEG_814F043C;
secondRow411 = firstRow411 + mode411;
thirdRow411 = secondRow411 + mode411;
fourthRow411 = thirdRow411 + mode411;
cbBlock411 = buffer + 260;
crBlock411 = buffer + 324;
work->pConverterFunc = converter411;
work->pConverterFuncEdge = edgeConverter411;
work->pConvRowPtrs[0] = firstRow411;
work->pConvRowPtrs[1] = secondRow411;
work->pConvRowPtrs[2] = thirdRow411;
work->pConvRowPtrs[3] = fourthRow411;
work->pConvRowPtrs[5] = cbBlock411;
work->pConvRowPtrs[6] = crBlock411;
work->pitch = 32;
work->converterFlags = 0;
break;
}
case 1: {
u8 mode;
u8* firstRow;
u8* secondRow;
u8* cbBlock;
u8* crBlock;
mode = work->idctMode;
firstRow = buffer + 4;
work->pConverterFunc = TMCJPEG_814F0A58;
work->pConverterFuncEdge = TMCJPEG_814F11C4;
secondRow = firstRow + mode;
cbBlock = buffer + 132;
crBlock = buffer + 196;
work->pConvRowPtrs[0] = firstRow;
work->pConvRowPtrs[1] = secondRow;
work->pConvRowPtrs[5] = cbBlock;
work->pConvRowPtrs[6] = crBlock;
mode422 = work->idctMode;
firstRow422 = buffer + 4;
converter422 = TMCJPEG_814F0A58;
edgeConverter422 = TMCJPEG_814F11C4;
secondRow422 = firstRow422 + mode422;
cbBlock422 = buffer + 132;
crBlock422 = buffer + 196;
work->pConverterFunc = converter422;
work->pConverterFuncEdge = edgeConverter422;
work->pConvRowPtrs[0] = firstRow422;
work->pConvRowPtrs[1] = secondRow422;
work->pConvRowPtrs[5] = cbBlock422;
work->pConvRowPtrs[6] = crBlock422;
work->pitch = 16;
work->converterFlags = 0;
break;
}
case 2: {
u8 mode;
u8* firstRow;
u8* secondRow;
u8* thirdRow;
u8* fourthRow;
u8* cbBlock;
u8* crBlock;
mode = work->idctMode;
firstRow = buffer + 4;
work->pConverterFunc = TMCJPEG_814F17E0;
work->pConverterFuncEdge = TMCJPEG_814F1F48;
secondRow = firstRow + mode;
thirdRow = firstRow + mode * 16;
fourthRow = thirdRow + mode;
cbBlock = buffer + 260;
crBlock = buffer + 324;
work->pConvRowPtrs[0] = firstRow;
work->pConvRowPtrs[1] = secondRow;
work->pConvRowPtrs[2] = thirdRow;
work->pConvRowPtrs[3] = fourthRow;
work->pConvRowPtrs[5] = cbBlock;
work->pConvRowPtrs[6] = crBlock;
mode420 = work->idctMode;
firstRow420 = buffer + 4;
converter420 = TMCJPEG_814F17E0;
edgeConverter420 = TMCJPEG_814F1F48;
secondRow420 = firstRow420 + mode420;
thirdRow420 = firstRow420 + mode420 * 16;
fourthRow420 = thirdRow420 + mode420;
cbBlock420 = buffer + 260;
crBlock420 = buffer + 324;
work->pConverterFunc = converter420;
work->pConverterFuncEdge = edgeConverter420;
work->pConvRowPtrs[0] = firstRow420;
work->pConvRowPtrs[1] = secondRow420;
work->pConvRowPtrs[2] = thirdRow420;
work->pConvRowPtrs[3] = fourthRow420;
work->pConvRowPtrs[5] = cbBlock420;
work->pConvRowPtrs[6] = crBlock420;
work->pitch = 16;
work->converterFlags = 0;
break;
}
case 3: {
u8 mode;
u8* firstRow;
u8* secondRow;
u8* cbBlock;
u32 mode;
u8* crBlock;
u8* cbBlock;
u8* secondRow;
u8* firstRow;
TMCConverterFunc* edgeConverter;
TMCConverterFunc* converter;
mode = work->idctMode;
firstRow = buffer + 4;
work->pConverterFunc = TMCJPEG_814F2570;
work->pConverterFuncEdge = TMCJPEG_814F2B50;
converter = TMCJPEG_814F2570;
edgeConverter = TMCJPEG_814F2B50;
secondRow = firstRow + mode * 8;
cbBlock = buffer + 132;
crBlock = buffer + 196;
work->pConverterFunc = converter;
work->pConverterFuncEdge = edgeConverter;
work->pConvRowPtrs[0] = firstRow;
work->pConvRowPtrs[1] = secondRow;
work->pConvRowPtrs[5] = cbBlock;
@@ -125,27 +142,27 @@ s32 TMCJPEGDEC_set_converterY8U8V8(TMCCJPEGDecWork* work) {
break;
}
case 4: {
TMCConverterFunc* converter;
TMCConverterFunc* edgeConverter;
TMCConverterFunc* converter;
converter = TMCJPEG_814F3158;
edgeConverter = TMCJPEG_814F32E4;
work->pConverterFunc = converter;
work->pConverterFuncEdge = edgeConverter;
work->pConvRowPtrs[0] = buffer + 4;
work->pConvRowPtrs[5] = buffer + 0x44;
work->pConvRowPtrs[6] = buffer + 0x84;
work->pConverterFunc = converter;
work->pConverterFuncEdge = edgeConverter;
work->pitch = 0x08;
work->converterFlags = 0;
break;
}
case 5: {
TMCConverterFunc* converter;
TMCConverterFunc* edgeConverter;
TMCConverterFunc* converter;
converter = TMCJPEG_814F34A4;
edgeConverter = TMCJPEG_814F372C;
work->pConvRowPtrs[0] = buffer + 4;
work->pConverterFunc = converter;
work->pConverterFuncEdge = edgeConverter;
work->pConvRowPtrs[0] = buffer + 4;
work->pitch = 0x08;
work->converterFlags = 0;
break;
@@ -158,16 +175,25 @@ s32 TMCJPEGDEC_set_converterY8U8V8(TMCCJPEGDecWork* work) {
{
s32 width = state->jpegWidth;
s32 height = state->jpegHeight;
state->convWidth = ((u32)width / 8 + (width % 8 != 0)) * 8;
state->convHeight = ((u32)height / 4 + (height % 4 != 0)) * 4;
s32 roundedWidth;
s32 heightPadding;
roundedWidth = (u32)width / 8 + (width % 8 != 0);
heightPadding = height % 4 != 0;
state->convWidth = roundedWidth * 8;
state->convHeight = ((u32)height / 4 + heightPadding) * 4;
width = state->outputWidth;
height = state->outputHeight;
state->chromaWidth = ((u32)width / 8 + (width % 8 != 0)) * 8;
state->chromaHeight = ((u32)height / 4 + (height % 4 != 0)) * 4;
roundedWidth = (u32)width / 8 + (width % 8 != 0);
heightPadding = height % 4 != 0;
state->chromaWidth = roundedWidth * 8;
state->chromaHeight = ((u32)height / 4 + heightPadding) * 4;
}
return 0;
}
#pragma pop
static void TMCJPEG_814EFEAC(TMCCJPEGDecWork* work, s32 x, s32 y) {
s32 rowSkip;
u8* output;

View File

@@ -113,18 +113,16 @@ ziU32 Zi8SecMatchChar(ziU8* nodeAddress, ziU8* dictionaryAddress, ziMatchParam*
ziU16 matchCode;
ziU8* data;
ziU8 value;
struct {
ziU8 remaining;
ziU8 dataIndex;
ziU16 targetCode;
} state;
ziU16 targetCode;
ziU8 dataIndex;
ziU8 remaining;
if (match->componentIndex != 0) {
state.targetCode = match->componentIndex;
targetCode = match->componentIndex;
matchCode = ((ziU16)(nodeAddress[4] & 3) << 8) | nodeAddress[5];
value = 0;
while (value++ < 6) {
if (state.targetCode == matchCode) {
if (targetCode == matchCode) {
break;
}
matchCode = ((ziU16)(*(dictionaryAddress + matchCode * 8 + 6) & 3) << 8) | *(dictionaryAddress + matchCode * 8 + 7);
@@ -132,7 +130,7 @@ ziU32 Zi8SecMatchChar(ziU8* nodeAddress, ziU8* dictionaryAddress, ziMatchParam*
break;
}
}
if (state.targetCode != matchCode) {
if (targetCode != matchCode) {
return 0;
}
}
@@ -206,9 +204,9 @@ ziU32 Zi8SecMatchChar(ziU8* nodeAddress, ziU8* dictionaryAddress, ziMatchParam*
}
}
state.dataIndex = 4;
state.remaining = ((match->length + 1) >> 1) - 4;
if ((value + 1) < state.remaining) {
dataIndex = 4;
remaining = ((match->length + 1) >> 1) - 4;
if ((value + 1) < remaining) {
return 0;
}
if ((match->length & 1) != 0) {
@@ -221,12 +219,12 @@ ziU32 Zi8SecMatchChar(ziU8* nodeAddress, ziU8* dictionaryAddress, ziMatchParam*
}
}
if (match->count == 0) {
while (state.remaining != 0) {
if ((data[0] & match->recordMasks[state.dataIndex]) != match->recordValues[state.dataIndex]) {
while (remaining != 0) {
if ((data[0] & match->recordMasks[dataIndex]) != match->recordValues[dataIndex]) {
return 0;
}
state.dataIndex++;
state.remaining--;
dataIndex++;
remaining--;
data++;
}
}
@@ -290,17 +288,15 @@ extern ziU16 Zi8MatchAltSound(ziPtr soundTable, ziU16 soundCode, ziPtr pCodeTabl
ziU16 Zi8GetPCode(ziU8* table, ziU8* node);
ziBool Zi8MatchPhonetic(ziU8* pCodeTable, ziU8* dictionary, ziPtr soundTable, ziU16 soundCode, ziU32 tableAddress, ziU8* node, ziU16* masks, ziU16* values, ziU16* count, ziU8** resultNode, ziU8** stringOffset, ziU8 partialMode, ziU8 strictMode, ziU8 numParts, ziU16 partMask, ziU16 partValue, ziU8 flag, ziU8 altMode, ziU16 initialCode, ziU16* resultCode, ziU8 lastMode ZI_NEED_WORK) {
struct {
ziBool hasString;
ziU8 partIndex;
ziU8 partCount;
ziU8 nextCode;
ziU8 matchedParts;
ziU16 dictionaryIndex;
ziU16 soundIndex;
ziU16 remaining;
ziU16 code;
} traversal;
ziU16 code;
ziU16 remaining;
ziU16 soundIndex;
ziU16 dictionaryIndex;
ziU8 matchedParts;
ziU8 nextCode;
ziU8 partCount;
ziU8 partIndex;
ziBool hasString;
ziU8* sound;
typedef struct {
ziU8 header;
@@ -308,42 +304,42 @@ ziBool Zi8MatchPhonetic(ziU8* pCodeTable, ziU8* dictionary, ziPtr soundTable, zi
} DictionaryNode;
if (*stringOffset != 0) {
traversal.hasString = 1;
hasString = 1;
} else {
traversal.hasString = 0;
hasString = 0;
}
if (*count != 0) {
traversal.remaining = *count;
remaining = *count;
} else {
traversal.remaining = 1;
remaining = 1;
}
traversal.matchedParts = 0;
matchedParts = 0;
if ((lastMode != 0) && (numParts > 1)) {
altMode = 1;
}
while (traversal.remaining-- != 0) {
while (remaining-- != 0) {
if ((node[0] & flag) != 0) goto decode_node;
next_node:
node += 0xC;
continue;
decode_node:
traversal.code = Zi8GetPCode(pCodeTable, node);
if ((*values != (traversal.code & *masks)) && (altMode == 0) && ((node[0] & 0x80) != 0)) {
code = Zi8GetPCode(pCodeTable, node);
if ((*values != (code & *masks)) && (altMode == 0) && ((node[0] & 0x80) != 0)) {
if (*count != 0) {
traversal.soundIndex = (initialCode - traversal.remaining) - 1;
soundIndex = (initialCode - remaining) - 1;
} else {
traversal.soundIndex = initialCode;
soundIndex = initialCode;
}
traversal.code = Zi8MatchAltSound(soundTable, soundCode, pCodeTable, traversal.soundIndex, *masks, *values, flag, ZI_WORK);
code = Zi8MatchAltSound(soundTable, soundCode, pCodeTable, soundIndex, *masks, *values, flag, ZI_WORK);
}
goto check_code;
match_code:
if (partValue == (traversal.code & partMask)) goto next_node;
traversal.matchedParts = 1;
if (partValue == (code & partMask)) goto next_node;
matchedParts = 1;
if (*count != 0) {
traversal.soundIndex = (initialCode - traversal.remaining) - 1;
soundIndex = (initialCode - remaining) - 1;
} else {
traversal.soundIndex = initialCode;
soundIndex = initialCode;
}
sound = (ziU8*)(tableAddress + ((node[9] & 0xF) * 0x10000 + (node[0xB] + node[0xA] * 0x100)));
if (ZI_WORK->cangjieEnabled != 0) {
@@ -368,46 +364,46 @@ match_code:
} else if (numParts > 1) {
goto next_node;
}
if (((ziU8)traversal.matchedParts == numParts) || (numParts == 0)) {
if (((ziU8)matchedParts == numParts) || (numParts == 0)) {
*resultNode = node;
*resultCode = ((ziU16)node[6] << 8) + node[7];
*count = traversal.remaining;
*count = remaining;
return 1;
}
next_group:
{
traversal.nextCode = *sound++;
traversal.partCount = traversal.nextCode & 0xF;
if ((traversal.nextCode & flag) == 0) {
for (; traversal.partCount != 0; traversal.partCount--) {
nextCode = *sound++;
partCount = nextCode & 0xF;
if ((nextCode & flag) == 0) {
for (; partCount != 0; partCount--) {
for (sound++; (*sound & 0x80) == 0; sound += 2) {
}
sound++;
}
}
for (; traversal.partCount != 0; traversal.partCount--) {
traversal.partIndex = 1;
if (traversal.hasString && (sound > *stringOffset)) {
traversal.hasString = 0;
for (; partCount != 0; partCount--) {
partIndex = 1;
if (hasString && (sound > *stringOffset)) {
hasString = 0;
}
if (!traversal.hasString) {
if (!hasString) {
*stringOffset = sound;
}
do {
traversal.dictionaryIndex = sound[0] | ((ziU16)sound[1] << 8);
dictionaryIndex = sound[0] | ((ziU16)sound[1] << 8);
sound += 2;
if (traversal.hasString) {
if (hasString) {
goto phonetic_skip;
}
traversal.code = Zi8GetPCode(pCodeTable, dictionary + (traversal.dictionaryIndex & 0x7FFF) * sizeof(DictionaryNode));
if (((traversal.code & masks[traversal.partIndex]) != values[traversal.partIndex]) && (altMode == 0) && (dictionary[(traversal.dictionaryIndex & 0x7FFF) * sizeof(DictionaryNode)] & 0x80) != 0) {
traversal.code = Zi8MatchAltSound(soundTable, soundCode, pCodeTable, traversal.dictionaryIndex & 0x7FFF, masks[traversal.partIndex], values[traversal.partIndex], flag, ZI_WORK);
code = Zi8GetPCode(pCodeTable, dictionary + (dictionaryIndex & 0x7FFF) * sizeof(DictionaryNode));
if (((code & masks[partIndex]) != values[partIndex]) && (altMode == 0) && (dictionary[(dictionaryIndex & 0x7FFF) * sizeof(DictionaryNode)] & 0x80) != 0) {
code = Zi8MatchAltSound(soundTable, soundCode, pCodeTable, dictionaryIndex & 0x7FFF, masks[partIndex], values[partIndex], flag, ZI_WORK);
}
if ((traversal.code & masks[traversal.partIndex]) == values[traversal.partIndex]) {
if ((code & masks[partIndex]) == values[partIndex]) {
goto phonetic_matched;
}
phonetic_skip:
if ((traversal.dictionaryIndex & 0x8000) == 0) {
if ((dictionaryIndex & 0x8000) == 0) {
sound++;
while ((*sound & 0x80) == 0) {
sound += 2;
@@ -416,23 +412,23 @@ phonetic_skip:
}
break;
phonetic_matched:
if (++traversal.partIndex == numParts) {
if (++partIndex == numParts) {
if (partialMode != 0) {
if (strictMode == 0 && (traversal.dictionaryIndex & 0x8000) != 0) goto phonetic_skip;
if (strictMode != 0 && (traversal.dictionaryIndex & 0x8000) == 0) goto phonetic_skip;
if (strictMode == 0 && (dictionaryIndex & 0x8000) != 0) goto phonetic_skip;
if (strictMode != 0 && (dictionaryIndex & 0x8000) == 0) goto phonetic_skip;
}
*resultNode = node;
*resultCode = ((ziU16)node[6] << 8) + node[7];
*count = traversal.remaining;
*count = remaining;
return 1;
}
} while ((traversal.dictionaryIndex & 0x8000) == 0);
} while ((dictionaryIndex & 0x8000) == 0);
}
}
if ((traversal.nextCode & 0x80) != 0) goto next_node;
if ((nextCode & 0x80) != 0) goto next_node;
goto next_group;
check_code:
if (*values == (traversal.code & *masks)) goto match_code;
if (*values == (code & *masks)) goto match_code;
goto next_node;
}
return 0;

View File

@@ -27,31 +27,29 @@ ziU8 Zi8MatchKoreanSequence(ziU16* resultIndex, ziU16* input, ziU8 type, ziU16 c
ziU32 Zi8GetKoreanCandidates(ziGetParam* params, ziU8* argument,
struct __zi8_work_data_s* workData) {
struct {
ziU8 characterIndex;
ziU8 matched;
ziU8 elementIndex;
ziU16 index;
ziU16 currentCandidate;
ziU16 inputIndex;
ziU16 nextIndex;
ziU16 tableCount31;
ziU16 tableCount6;
ziU16 tableCount3;
ziU16 tableCount0;
ziU8* table31;
ziU8* table2;
ziU8* table1;
} state;
ziU8* table1;
ziU8* table2;
ziU8* table31;
ziU16 tableCount0;
ziU16 tableCount3;
ziU16 tableCount6;
ziU16 tableCount31;
ziU16 nextIndex;
ziU16 inputIndex;
ziU16 currentCandidate;
ziU16 index;
ziU8 elementIndex;
ziU8 matched;
ziU8 characterIndex;
ziU16 buffer[100];
ziU8 result;
ziU16 currentCharacter;
ziU8* selectedTable;
state.nextIndex = 0;
nextIndex = 0;
result = 0;
state.characterIndex = 0xFF;
state.currentCandidate = params->firstCandidate;
characterIndex = 0xFF;
currentCandidate = params->firstCandidate;
params->letters = params->completion = params->count = 0;
if ((argument != 0) && (*argument != 0)) {
Zi8LogError(0x7D0, workData);
@@ -63,31 +61,31 @@ ziU32 Zi8GetKoreanCandidates(ziGetParam* params, ziU8* argument,
}
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 4, workData);
state.table1 = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 1, workData);
state.table2 = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 2, workData);
state.table31 = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x31, workData);
state.tableCount0 = Zi8GetTableCount(ZI8_LANG_KO, 0, workData);
state.tableCount3 = Zi8GetTableCount(ZI8_LANG_KO, 3, workData);
state.tableCount6 = Zi8GetTableCount(ZI8_LANG_KO, 6, workData);
state.tableCount31 = Zi8GetTableCount(ZI8_LANG_KO, 0x31, workData);
table1 = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 1, workData);
table2 = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 2, workData);
table31 = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x31, workData);
tableCount0 = Zi8GetTableCount(ZI8_LANG_KO, 0, workData);
tableCount3 = Zi8GetTableCount(ZI8_LANG_KO, 3, workData);
tableCount6 = Zi8GetTableCount(ZI8_LANG_KO, 6, workData);
tableCount31 = Zi8GetTableCount(ZI8_LANG_KO, 0x31, workData);
for (state.elementIndex = 0; state.elementIndex < params->elementCount;
state.elementIndex++) {
currentCharacter = params->elements[state.elementIndex];
for (elementIndex = 0; elementIndex < params->elementCount;
elementIndex++) {
currentCharacter = params->elements[elementIndex];
if ((currentCharacter >= 0x61) && (currentCharacter <= 0x7A)) {
buffer[state.elementIndex] = state.table1[(currentCharacter - 0x61) * 2];
buffer[elementIndex] = table1[(currentCharacter - 0x61) * 2];
} else if ((currentCharacter >= 0x41) && (currentCharacter <= 0x5A)) {
buffer[state.elementIndex] = (state.table1 + (currentCharacter - 0x41) * 2)[1];
buffer[elementIndex] = (table1 + (currentCharacter - 0x41) * 2)[1];
} else {
state.matched = 0;
for (; state.table2[state.matched * 3] != 0; state.matched++) {
if (currentCharacter == state.table2[state.matched * 3]) break;
matched = 0;
for (; table2[matched * 3] != 0; matched++) {
if (currentCharacter == table2[matched * 3]) break;
}
if (state.table2[state.matched * 3] != 0) {
buffer[state.elementIndex] =
((ziU16)(state.table2 + state.matched * 3)[1] << 8) |
(state.table2 + state.matched * 3)[2];
if (table2[matched * 3] != 0) {
buffer[elementIndex] =
((ziU16)(table2 + matched * 3)[1] << 8) |
(table2 + matched * 3)[2];
} else {
Zi8LogError(0x161, workData);
return 0;
@@ -96,16 +94,16 @@ ziU32 Zi8GetKoreanCandidates(ziGetParam* params, ziU8* argument,
}
result = 0;
for (currentCharacter = 0; currentCharacter < state.elementIndex; currentCharacter++) {
if (Zi8LookupKoreanChar(buffer[currentCharacter], &state.characterIndex,
&state.inputIndex, workData) != 0) {
state.matched = Zi8MatchKoreanSequence(&state.nextIndex,
for (currentCharacter = 0; currentCharacter < elementIndex; currentCharacter++) {
if (Zi8LookupKoreanChar(buffer[currentCharacter], &characterIndex,
&inputIndex, workData) != 0) {
matched = Zi8MatchKoreanSequence(&nextIndex,
buffer + currentCharacter + 1,
state.characterIndex,
(state.elementIndex - currentCharacter) - 1,
characterIndex,
(elementIndex - currentCharacter) - 1,
workData);
if (workData->koAltTables == 1) {
switch (state.characterIndex) {
switch (characterIndex) {
case 1:
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x1E, workData);
break;
@@ -168,59 +166,59 @@ ziU32 Zi8GetKoreanCandidates(ziGetParam* params, ziU8* argument,
}
}
} else {
state.matched = 0;
matched = 0;
}
if (state.matched != 0) {
if (state.tableCount6 == 0) {
state.nextIndex += state.inputIndex * state.tableCount3;
if (matched != 0) {
if (tableCount6 == 0) {
nextIndex += inputIndex * tableCount3;
}
if (state.currentCandidate != 0) {
state.currentCandidate--;
if (currentCandidate != 0) {
currentCandidate--;
} else {
params->candidates[result] =
((ziU16)selectedTable[state.nextIndex * 2] << 8) | (selectedTable + state.nextIndex * 2)[1];
if ((state.tableCount6 != 0) && (workData->koAltTables == 0)) {
params->candidates[result] += state.inputIndex * state.tableCount3;
((ziU16)selectedTable[nextIndex * 2] << 8) | (selectedTable + nextIndex * 2)[1];
if ((tableCount6 != 0) && (workData->koAltTables == 0)) {
params->candidates[result] += inputIndex * tableCount3;
}
result++;
}
if (currentCharacter == 0) {
params->completion = state.matched + 1;
params->completion = matched + 1;
}
currentCharacter += state.matched;
currentCharacter += matched;
} else {
if (state.currentCandidate != 0) {
state.index = 0;
for (; state.index < state.tableCount31; state.index++) {
if (state.table31[state.index * 3] == buffer[currentCharacter] &&
(state.table31 + state.index * 3)[1] == buffer[currentCharacter + 1]) break;
if (currentCandidate != 0) {
index = 0;
for (; index < tableCount31; index++) {
if (table31[index * 3] == buffer[currentCharacter] &&
(table31 + index * 3)[1] == buffer[currentCharacter + 1]) break;
}
if (state.index == state.tableCount31) {
state.currentCandidate--;
if (index == tableCount31) {
currentCandidate--;
}
if (currentCharacter == 0) {
params->completion = 1;
}
} else {
for (state.index = 0; state.index < state.tableCount31; state.index++) {
if ((state.table31[(state.index * 3)] == buffer[currentCharacter]) &&
((state.table31 + state.index * 3)[1] == buffer[currentCharacter + 1])) {
for (index = 0; index < tableCount31; index++) {
if ((table31[(index * 3)] == buffer[currentCharacter]) &&
((table31 + index * 3)[1] == buffer[currentCharacter + 1])) {
if (currentCharacter == 0) {
params->completion = 1;
}
params->candidates[result] =
state.tableCount0 + (state.table31 + state.index * 3)[2];
tableCount0 + (table31 + index * 3)[2];
result++;
currentCharacter++;
break;
}
}
if (state.index == state.tableCount31) {
if (index == tableCount31) {
if ((params->candidates[result] = buffer[currentCharacter]) < 0xFF) {
if (currentCharacter == 0) {
params->completion = 1;
}
params->candidates[result] += state.tableCount0;
params->candidates[result] += tableCount0;
result++;
}
}

View File

@@ -72,7 +72,7 @@ struct DVDCommandBlock {
DVDCommandBlock* prev; // 0x04
u32 command; // 0x08
volatile s32 state;
s32 state; // 0x0C
u32 offset; // 0x10
u32 length; // 0x14

View File

@@ -14,7 +14,7 @@ typedef GXTlutRegion* (*GXTlutRegionCallback)(u32 idx);
u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, u8 mipmap, u8 max_lod);
void GXInitTexObj(const GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t,
void GXInitTexObj(GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t,
u8 mipmap);
void GXInitTexObjCI(GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXCITexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t, u8 mipmap,
u32 tlut_name);

View File

@@ -1894,7 +1894,7 @@ s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block) {
if (block->state == DVD_STATE_COVER_CLOSED) {
retVal = DVD_STATE_BUSY;
} else if (block->state == DVD_STATE_COVER_OPENED) {
} else if (((volatile DVDCommandBlock*)block)->state == DVD_STATE_COVER_OPENED) {
retVal = DVD_STATE_NO_DISK;
} else if (executing == &__DVDStopMotorCommandBlock) {
next = __DVDGetNextWaitingQueue();
@@ -1912,7 +1912,7 @@ s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block) {
}
}
} else {
retVal = block->state;
retVal = ((volatile DVDCommandBlock*)block)->state;
}
OSRestoreInterrupts(enabled);

View File

@@ -8,12 +8,7 @@ static inline pf_u16 read_boot_u16(pf_u8* buf, pf_u32 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 (((pf_u32)buf[offset + 2] << 16) + buf[offset]) +
(((pf_u32)buf[offset + 3] << 24) + ((pf_u32)buf[offset + 1] << 8));
}
pf_s32 pdm_part_is_master_boot_sector(pf_u8* buf, pf_u32 total, pf_bool* p_is_mbr) {
pf_s32 pdm_part_is_master_boot_sector(volatile pf_u8* buf, pf_u32 total, pf_bool* p_is_mbr) {
pf_u32* p_start;
pf_u32* p_count;
pf_s16 index;
@@ -25,8 +20,8 @@ pf_s32 pdm_part_is_master_boot_sector(pf_u8* buf, pf_u32 total, pf_bool* p_is_mb
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);
*p_start = MBR_WORD(buf, 454);
*p_count = MBR_WORD(buf, 458);
if (*p_start != 0 && *p_count != 0) {
if (index == 0) { *p_is_mbr = 1; }
} else {
@@ -36,15 +31,11 @@ pf_s32 pdm_part_is_master_boot_sector(pf_u8* buf, pf_u32 total, pf_bool* p_is_mb
p_count++;
buf += 16;
}
p_start = start;
p_count = count;
for (index = 0; index < 4; index++) {
if (*p_start + *p_count > total) {
if (start[index] + count[index] > total) {
if (index == 0) { *p_is_mbr = 0; }
return 2;
}
p_start++;
p_count++;
}
return 0;
}

View File

@@ -173,72 +173,77 @@ pf_s32 PFFAT12_WriteFATEntryWithBuf(PF_VOLUME* p_vol, pf_s16 cluster, pf_u16 val
#undef FLUSH_FAT_BUFFER
}
pf_s32 PFFAT12_ReadFATEntryWithBuf(PF_VOLUME* p_vol , pf_u16 cluster , pf_u32* p_value ,
PF_CACHE_PAGE* p_page ) {
struct {
pf_u32 sector;
pf_u32 current_fat;
pf_s32 err;
pf_u32 offset;
} state;
static inline pf_s32 ReadFAT12WordWithBuf(PF_VOLUME* p_vol, pf_u32 offset, pf_u32* p_value, PF_CACHE_PAGE* p_page) {
pf_u32 current_fat;
pf_u32 sector;
pf_s32 err;
pf_s32 result;
#define LOAD_FAT_SECTOR(next_sector) \
if (p_page->sector != state.sector + (next_sector)) { \
if (p_page->sector != sector + (next_sector)) { \
if (p_page->option == 1) { \
for (state.err = 0; (pf_u16)state.err < p_vol->bpb.num_active_FATs; state.err++) { \
VFiPFSEC_WriteFAT(p_vol, p_page->p_buf, p_page->sector + (pf_u16)state.err * p_vol->bpb.sectors_per_FAT, 0, p_vol->bpb.bytes_per_sector); \
for (err = 0; (pf_u16)err < p_vol->bpb.num_active_FATs; err++) { \
VFiPFSEC_WriteFAT(p_vol, p_page->p_buf, p_page->sector + (pf_u16)err * p_vol->bpb.sectors_per_FAT, 0, p_vol->bpb.bytes_per_sector); \
} \
} \
state.err = VFiPFSEC_ReadFAT(p_vol, p_page->p_buf, state.sector + (next_sector), 0, p_vol->bpb.bytes_per_sector); \
if (state.err != 0) { continue; } \
p_page->sector = state.sector + (next_sector); \
err = VFiPFSEC_ReadFAT(p_vol, p_page->p_buf, sector + (next_sector), 0, p_vol->bpb.bytes_per_sector); \
if (err != 0) { continue; } \
p_page->sector = sector + (next_sector); \
}
state.offset = (pf_u16)(cluster + (cluster >> 1));
state.sector = p_vol->bpb.active_FAT_sector + (state.offset >> p_vol->bpb.log2_bytes_per_sector) & 0xFFFF;
sector = p_vol->bpb.active_FAT_sector + (offset >> p_vol->bpb.log2_bytes_per_sector) & 0xFFFF;
if ((p_vol->bpb.ext_flags & 0x80) != 0) {
state.current_fat = p_vol->bpb.ext_flags & (0x01 | 0x02 | 0x04);
current_fat = p_vol->bpb.ext_flags & (0x01 | 0x02 | 0x04);
} else {
state.current_fat = 1;
current_fat = 1;
}
state.err = 0;
err = 0;
while (PF_TRUE) {
if (state.err == 0x1000 && p_vol->p_callback != PF_NULL) {
if (err == 0x1000 && p_vol->p_callback != PF_NULL) {
result = ((PF_VOLUME_CB)p_vol->p_callback)(p_vol->last_driver_error);
if (result == 0) {
state.err = 0;
err = 0;
continue;
}
if (result == 1 && p_vol->bpb.num_active_FATs >= 2 && state.current_fat < p_vol->bpb.num_active_FATs) {
state.current_fat++;
state.sector += p_vol->bpb.sectors_per_FAT;
state.err = 0;
if (result == 1 && p_vol->bpb.num_active_FATs >= 2 && current_fat < p_vol->bpb.num_active_FATs) {
current_fat++;
sector += p_vol->bpb.sectors_per_FAT;
err = 0;
continue;
}
} else {
LOAD_FAT_SECTOR(0);
state.offset &= p_vol->bpb.bytes_per_sector - 1;
if (state.offset == (p_vol->bpb.bytes_per_sector - 1)) {
*p_value = p_page->p_buf[state.offset];
offset &= p_vol->bpb.bytes_per_sector - 1;
if (offset == (p_vol->bpb.bytes_per_sector - 1)) {
*p_value = p_page->p_buf[offset];
if (p_page->option == 1) {
for (state.err = 0; (pf_u16)state.err < p_vol->bpb.num_active_FATs; state.err++) {
VFiPFSEC_WriteFAT(p_vol, p_page->p_buf, p_page->sector + (pf_u16)state.err * p_vol->bpb.sectors_per_FAT, 0, p_vol->bpb.bytes_per_sector);
for (err = 0; (pf_u16)err < p_vol->bpb.num_active_FATs; err++) {
VFiPFSEC_WriteFAT(p_vol, p_page->p_buf, p_page->sector + (pf_u16)err * p_vol->bpb.sectors_per_FAT, 0, p_vol->bpb.bytes_per_sector);
}
}
state.err = VFiPFSEC_ReadFAT(p_vol, p_page->p_buf, state.sector + 1, 0, p_vol->bpb.bytes_per_sector);
if (state.err != 0) { continue; }
p_page->sector = state.sector + 1;
err = VFiPFSEC_ReadFAT(p_vol, p_page->p_buf, sector + 1, 0, p_vol->bpb.bytes_per_sector);
if (err != 0) { continue; }
p_page->sector = sector + 1;
*p_value += (pf_u16)(*p_page->p_buf) << 8;
} else {
*p_value = ((pf_u16)p_page->p_buf[state.offset + 1] << 8) + p_page->p_buf[state.offset];
*p_value = ((pf_u16)p_page->p_buf[offset + 1] << 8) + p_page->p_buf[offset];
}
}
break;
}
if (state.err != 0) {
return err;
#undef LOAD_FAT_SECTOR
}
pf_s32 PFFAT12_ReadFATEntryWithBuf(PF_VOLUME* p_vol, pf_u16 cluster, pf_u32* p_value,
PF_CACHE_PAGE* p_page) {
pf_s32 err;
err = ReadFAT12WordWithBuf(p_vol, (pf_u16)(cluster + (cluster >> 1)), p_value, p_page);
if (err != 0) {
*p_value = -1;
return state.err;
return err;
}
if ((cluster & 0x01) != 0) {
*p_value = *p_value >> 4;
@@ -246,6 +251,4 @@ pf_s32 PFFAT12_ReadFATEntryWithBuf(PF_VOLUME* p_vol , pf_u16 cluster , pf_u32* p
*p_value &= 0xFFF;
}
return 0;
#undef LOAD_FAT_SECTOR
}

View File

@@ -1873,10 +1873,7 @@ pf_s32 PFFILE_fappend(PFFILE_FILE* file, pf_u32 size, pf_u32* size_appended) {
pf_s32 PFFILE_fadjust(PFFILE_FILE* file) {
PF_VOLUME* volume = file == PF_NULL ? PF_NULL : file->p_sfd->dir_entry.p_vol;
PFFILE_CURSOR saved_cursor;
struct {
PF_FAT_HINT hint;
pf_u32 last_access_chain_index;
} saved_hint;
PFFILE_FAT_HINT saved_hint;
pf_u16 access_time;
pf_s32 error;
@@ -1894,8 +1891,7 @@ pf_s32 PFFILE_fadjust(PFFILE_FILE* file) {
}
((PFFILE_VOLUME_DIRS*)volume)->cache_signature = file;
saved_cursor = file->cursor;
saved_hint.hint = file->hint;
saved_hint.last_access_chain_index = file->last_access_data.last_access.chain_index;
saved_hint = *(PFFILE_FAT_HINT*)&file->hint;
if ((file->open_mode & 8) == 0 && (file->open_mode & 2) != 0) {
error = 0x0A;
} else if ((file->p_sfd->lock.mode & 3) != 0 &&
@@ -1907,8 +1903,7 @@ pf_s32 PFFILE_fadjust(PFFILE_FILE* file) {
error &= (-error | error) >> 31;
}
file->cursor = saved_cursor;
file->hint = saved_hint.hint;
file->last_access_data.last_access.chain_index = saved_hint.last_access_chain_index;
*(PFFILE_FAT_HINT*)&file->hint = saved_hint;
((PFFILE_VOLUME_DIRS*)volume)->cache_signature = PF_NULL;
if (error != 0) {
pf_vol_set.last_error = error;
@@ -1923,10 +1918,7 @@ pf_s32 PFFILE_fadjust(PFFILE_FILE* file) {
pf_s32 PFFILE_finfo(PFFILE_FILE* file, PF_INFO* info) {
PF_VOLUME* volume = file == PF_NULL ? PF_NULL : file->p_sfd->dir_entry.p_vol;
PFFILE_CURSOR saved_cursor;
struct {
PF_FAT_HINT hint;
pf_u32 last_access_chain_index;
} saved_hint;
PFFILE_FAT_HINT saved_hint;
pf_s32 error;
error = PFVOL_CheckForRead(volume);
@@ -1943,12 +1935,10 @@ pf_s32 PFFILE_finfo(PFFILE_FILE* file, PF_INFO* info) {
}
((PFFILE_VOLUME_DIRS*)volume)->cache_signature = file;
saved_cursor = file->cursor;
saved_hint.hint = file->hint;
saved_hint.last_access_chain_index = file->last_access_data.last_access.chain_index;
saved_hint = *(PFFILE_FAT_HINT*)&file->hint;
error = PFFILE_p_finfo(file, info);
file->cursor = saved_cursor;
file->hint = saved_hint.hint;
file->last_access_data.last_access.chain_index = saved_hint.last_access_chain_index;
*(PFFILE_FAT_HINT*)&file->hint = saved_hint;
((PFFILE_VOLUME_DIRS*)volume)->cache_signature = PF_NULL;
if (error != 0) {
pf_vol_set.last_error = error;

View File

@@ -418,15 +418,13 @@ pf_s32 PFPATH_cmpNameUni(const pf_u16* name, PF_STR* pattern) {
}
pf_s32 PFPATH_cmpName(const pf_s8* short_name, PF_STR* pattern, pf_u32 short_search) {
struct {
pf_u32 matched_end;
pf_s8 name[0x10];
} work;
pf_s8* name = work.name;
pf_s8 name_buffer[13];
pf_u32 matched_end;
pf_s8* name = name_buffer;
pf_s8* name_end;
const pf_s8* pattern_text;
work.matched_end = 0;
matched_end = 0;
pattern_text = PFSTR_GetStrPos(pattern, 3);
pf_strcpy(name, short_name);
if ((pf_vol_set.setting & 2) == 2 && PFSTR_GetCodeMode(pattern) == 2 && pf_strcmp(name, (const pf_s8*)".") != 0 &&
@@ -450,7 +448,7 @@ pf_s32 PFPATH_cmpName(const pf_s8* short_name, PF_STR* pattern, pf_u32 short_sea
return 1;
}
}
return PFPATH_cmpNameImpl(work.name, pattern_text, &work.matched_end);
return PFPATH_cmpNameImpl(name_buffer, pattern_text, &matched_end);
}
pf_s32 PFPATH_cmpTailSFN(const pf_s8* sfn_name, const pf_s8* pattern) {

View File

@@ -124,7 +124,7 @@ void __GetImageTileCount(GXTexFmt fmt, u16 wd, u16 ht, u32* rowTiles, u32* colTi
*cmpTiles = (fmt == GX_TF_RGBA8 || fmt == GX_TF_Z24X8) ? 2 : 1;
}
void GXInitTexObj(const GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t,
void GXInitTexObj(GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t,
GXBool mipmap) {
u32 imageBase;
u32 maxLOD;

View File

@@ -396,6 +396,8 @@ static void kbdProcKey(u32 key, u32 pressed, u32 channel) {
kbdSendKey(&event);
}
#pragma push
#pragma opt_propagation off
static void kbdProcMod(u32 key, u32 pressed, u32 channel) {
KBDChannel* data;
u32 modState;
@@ -524,6 +526,7 @@ static void kbdProcMod(u32 key, u32 pressed, u32 channel) {
finalState = modState | 0x1000;
KBDSetModState(channel, finalState);
}
#pragma pop
static void kbdSendKey(KBDKeyEventData* event) {
KBDChannel* data;
@@ -554,26 +557,24 @@ static void kbdSendKey(KBDKeyEventData* event) {
}
}
#pragma push
#pragma ppc_iro_level 0
static void kbd_led_handler(BOOL success, void* callbackArg) {
const KBDLEDCallbackData* callback;
s32 index;
u32 err;
index = (s32)callbackArg;
callback = &kbdLCBuf[index];
u32 index;
USBKBDErr err;
index = (u32)callbackArg;
kbdCmdBuf[index].device = 0;
if (callback->callbackAddress == (USBKBDCmdLEDCallback)(u32)kbdCmdBuf[(u32)callbackArg].device) {
if (kbdLCBuf[index].callbackAddress == NULL) {
return;
}
switch (success) {
default:
err = 7;
break;
case TRUE:
if (success == TRUE) {
err = 0;
break;
} else {
err = 7;
}
kbdLCBuf[(u32)callbackArg].callbackAddress(err, kbdLCBuf[(u32)callbackArg].callbackArg);
kbdLCBuf[index].callbackAddress(err, kbdLCBuf[index].callbackArg);
}
#pragma pop
USBKBDErr KBDSetLedsAsync(u32 channel, u32 leds, USBKBDCmdLEDCallback callback, void* callbackArg) {
u8 ledBits;
@@ -823,6 +824,8 @@ USBKBDErr KBDSetLockProcessing(u32 channel, u32 value) {
return 0;
}
#pragma push
#pragma ppc_iro_level 1
USBKBDErr KBDSetModState(u32 channel, u32 value) {
if (!kbdInitialized) {
return 2;
@@ -839,12 +842,13 @@ USBKBDErr KBDSetModState(u32 channel, u32 value) {
interrupts = OSDisableInterrupts();
newState.value = value & 0xfc0;
oldState.value = kbdData[channel].modState;
newState.bits.physical = oldState.bits.physical;
newState.bits.physical = oldState.value;
kbdData[channel].modState = newState.value;
OSRestoreInterrupts(interrupts);
}
return 0;
}
#pragma pop
u16 KBDTranslateHidCode(u32 keyCode, u32 modifiers, s32 country) {
s32 mask;

View File

@@ -175,7 +175,8 @@ static inline char* __nupFindTag(char* response, const char* startTag, const cha
}
*value = start + strlen(startTag);
*length = end - *value;
return end + strlen(endTag);
end += strlen(endTag);
return end;
}
static s32 __nupParseServerInfo(NUPContextInfo* context, char* response, char* messageId,

View File

@@ -83,8 +83,10 @@ typedef struct WADFileHeader {
u8 reserved_0x60[0x20];
} WADFileHeader;
typedef struct WADBootImportParts {
s32 headerInfo[2];
typedef struct WADImportParts {
s32 type;
u16 cidxMode;
u16 version;
u32 certificateSize;
void* certificates;
u32 crlSize;
@@ -93,7 +95,7 @@ typedef struct WADBootImportParts {
void* ticket;
u32 titleMetaSize;
void* titleMeta;
} WADBootImportParts;
} WADImportParts;
typedef struct WADBackupFileHeader {
u32 magic;
@@ -3397,7 +3399,7 @@ static s32 _WADCleanTmpDir(MEMAllocator* allocator) {
s32 WADImportDVDForBS(const char* path, void* buffer, u32 bufferSize) {
DVDFileInfo fileInfo;
WADBootImportParts parts;
WADImportParts parts;
WADHeader* header;
u8* readBuffer;
BOOL fileOpened = FALSE;
@@ -3433,14 +3435,14 @@ s32 WADImportDVDForBS(const char* path, void* buffer, u32 bufferSize) {
memset(&parts, 0, sizeof(parts));
header = (WADHeader*)readBuffer;
result = WAD_815C2F44(header, parts.headerInfo);
result = WAD_815C2F44(header, &parts.type);
if (result != 2) {
OSReport("%s:%d Format should be iRD format: %s\n", __func__, 0x17D2,
path);
result = -3000;
goto cleanup;
}
if (parts.headerInfo[0] == 3) {
if (parts.type == 3) {
sectionOffset = (header->hdrSize + 0x3F) & ~0x3F;
if (header->certSize != 0) {
parts.certificateSize = header->certSize;
@@ -3496,19 +3498,7 @@ cleanup:
s32 WADImportDVDExForBS(const char* path, void* buffer, u32 bufferSize) {
WADHeader header ALIGN32;
DVDFileInfo fileInfo;
struct {
s32 type;
u16 cidxMode;
u16 version;
u32 certificateSize;
void* certificates;
u32 crlSize;
void* crls;
u32 ticketSize;
void* ticket;
u32 titleMetaSize;
void* titleMeta;
} parts;
WADImportParts parts;
BOOL fileOpened = FALSE;
s32 result;
u8* contentBuffer;

View File

@@ -168,72 +168,86 @@ static const u32 AESiDecryptTable[] = {
0xa8017139, 0xcb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0
};
#define ROTATE(x,n) (((x) << (n)) | ((x) >> (32 - (n))))
#define ENCRYPT(state0,state1,state2,state3) (((ROTATE(AESiEncryptTable[((state1)>>16)&255],16) ^ ROTATE(AESiEncryptTable[(state0)>>24],24)) ^ AESiEncryptTable[(state3)&255]) ^ ROTATE(AESiEncryptTable[((state2)>>8)&255],8))
#define DECRYPT(state0,state1,state2,state3) (((ROTATE(AESiDecryptTable[((state1)>>16)&255],16) ^ AESiDecryptTable[(state3)&255]) ^ ROTATE(AESiDecryptTable[(state0)>>24],24)) ^ ROTATE(AESiDecryptTable[((state2)>>8)&255],8))
#define SUBSTITUTE(table,state0,state1,state2,state3) ((((u32)table[(state0)>>24]<<24) | table[(state3)&255]) | (((u32)table[((state1)>>16)&255]<<16) | ((u32)table[((state2)>>8)&255]<<8)))
#define DECRYPT_FINAL(table,state0,state1,state2,state3,key) ((table[(state3)&255] ^ ((u32)table[((state2)>>8)&255]<<8)) ^ (((u32)table[((state1)>>16)&255]<<16) ^ ((key) ^ ((u32)table[(state0)>>24]<<24))))
#define ROTATE(x, n) __rlwinm((x), (n), 0, 31)
#define ROUND_WORD(table, a, b, c, d) (ROTATE(table[(a) >> 24], 24) ^ ROTATE(table[((b) >> 16) & 255], 16) ^ ROTATE(table[((c) >> 8) & 255], 8) ^ table[(d) & 255])
#define SUBSTITUTE_WORD(table, a, b, c, d) (((u32)table[(a) >> 24] << 24) | ((u32)table[((b) >> 16) & 255] << 16) | ((u32)table[((c) >> 8) & 255] << 8) | table[(d) & 255])
#define DOUBLE_BYTES(x) ((((x) & 0x7f7f7f7f) << 1) ^ ((((x) & 0x80808080) >> 7) * 0x1b))
void AESiEncryptBlock(AESContext* context, u32* output, const u32* input) {
const u32* key = context->keys;
u32 rounds = context->rounds;
const u32* key = context->keys + 4;
u32 state0=input[0]^context->keys[0], state1=input[1]^context->keys[1], state2=input[2]^context->keys[2], state3=input[3]^context->keys[3];
u32 state0 = input[0];
u32 state1 = input[1];
u32 state2 = input[2];
u32 state3 = input[3];
state0 ^= key[0];
state1 ^= key[1];
state2 ^= key[2];
state3 ^= key[3];
key += 4;
while (--rounds != 0) {
u32 nextState0=ENCRYPT(state0,state1,state2,state3);
u32 nextState1=ENCRYPT(state1,state2,state3,state0);
u32 nextState2=ENCRYPT(state2,state3,state0,state1);
u32 nextState3=ENCRYPT(state3,state0,state1,state2);
state0=nextState0^key[0]; state1=nextState1^key[1]; state2=nextState2^key[2]; state3=nextState3^key[3];
u32 next0 = ROUND_WORD(AESiEncryptTable, state0, state1, state2, state3);
u32 next1 = ROUND_WORD(AESiEncryptTable, state1, state2, state3, state0);
u32 next2 = ROUND_WORD(AESiEncryptTable, state2, state3, state0, state1);
u32 next3 = ROUND_WORD(AESiEncryptTable, state3, state0, state1, state2);
state0 = next0 ^ key[0];
state1 = next1 ^ key[1];
state2 = next2 ^ key[2];
state3 = next3 ^ key[3];
key += 4;
}
output[0] = SUBSTITUTE(AESiSubShiftTable,state0,state1,state2,state3)^key[0];
output[1] = SUBSTITUTE(AESiSubShiftTable,state1,state2,state3,state0)^key[1];
output[2] = SUBSTITUTE(AESiSubShiftTable,state2,state3,state0,state1)^key[2];
output[3] = SUBSTITUTE(AESiSubShiftTable,state3,state0,state1,state2)^key[3];
output[0] = SUBSTITUTE_WORD(AESiSubShiftTable, state0, state1, state2, state3) ^ key[0];
output[1] = SUBSTITUTE_WORD(AESiSubShiftTable, state1, state2, state3, state0) ^ key[1];
output[2] = SUBSTITUTE_WORD(AESiSubShiftTable, state2, state3, state0, state1) ^ key[2];
output[3] = SUBSTITUTE_WORD(AESiSubShiftTable, state3, state0, state1, state2) ^ key[3];
}
#define DOUBLE_BYTES(x) ((((x)&0x7f7f7f7f)<<1) ^ ((((x)&0x80808080)>>7)*0x1b))
static inline void AESiInvMixColumn(u32* word) {
u32 value = *word;
u32 timesTwo = DOUBLE_BYTES(value);
u32 timesFour = DOUBLE_BYTES(timesTwo);
u32 mixed = DOUBLE_BYTES(timesFour) ^ value;
mixed ^= timesFour ^ ROTATE(mixed, 8);
mixed ^= timesTwo ^ ROTATE(mixed, 8);
mixed ^= value ^ ROTATE(mixed, 8);
*word = mixed;
}
void AESiDecryptBlock(AESContext* context, u32* output, const u32* input) {
u32 rounds=context->rounds;
u32* key=context->keys;
u32 state1;
u32 state0;
u32 state2;
u32 state3;
key += rounds*4;
u32* key = context->keys;
u32 rounds = context->rounds;
u32 state0, state1, state2, state3;
key += rounds * 4;
if (context->needsTransform) {
u32 round;
for (round=1; round<context->rounds; ++round) {
for (round = 1; round < context->rounds; round++) {
u32 word;
for (word=0; word<4; ++word) {
u32 value=context->keys[round*4 + word];
u32 timesTwo=DOUBLE_BYTES(value);
u32 timesFour=DOUBLE_BYTES(timesTwo);
u32 timesNine=DOUBLE_BYTES(timesFour)^value;
u32 mixed=(ROTATE(timesNine,8) ^ (timesNine ^ timesFour));
mixed=(ROTATE(mixed,8) ^ (mixed ^ timesTwo));
mixed=(ROTATE(mixed,8) ^ (mixed ^ value));
context->keys[round*4 + word]=mixed;
for (word = 0; word < 4; word++) {
AESiInvMixColumn(&context->keys[round * 4 + word]);
}
}
context->needsTransform=0;
context->needsTransform = 0;
}
state0=input[0]^key[0]; state1=input[1]^key[1]; state2=input[2]^key[2]; state3=input[3]^key[3];
key-=4;
state0 = input[0] ^ key[0];
state1 = input[1] ^ key[1];
state2 = input[2] ^ key[2];
state3 = input[3] ^ key[3];
key -= 4;
while (--rounds != 0) {
u32 nextState0=DECRYPT(state0,state3,state2,state1);
u32 nextState1=DECRYPT(state1,state0,state3,state2);
u32 nextState2=DECRYPT(state2,state1,state0,state3);
u32 nextState3=DECRYPT(state3,state2,state1,state0);
state0=nextState0^key[0]; state1=nextState1^key[1]; state2=nextState2^key[2]; state3=nextState3^key[3];
key-=4;
u32 next0 = ROUND_WORD(AESiDecryptTable, state0, state3, state2, state1);
u32 next1 = ROUND_WORD(AESiDecryptTable, state1, state0, state3, state2);
u32 next2 = ROUND_WORD(AESiDecryptTable, state2, state1, state0, state3);
u32 next3 = ROUND_WORD(AESiDecryptTable, state3, state2, state1, state0);
state0 = next0 ^ key[0];
state1 = next1 ^ key[1];
state2 = next2 ^ key[2];
state3 = next3 ^ key[3];
key -= 4;
}
output[0]=DECRYPT_FINAL(AESiInvSubShiftTable,state0,state3,state2,state1,key[0]);
output[1]=DECRYPT_FINAL(AESiInvSubShiftTable,state1,state0,state3,state2,key[1]);
output[2]=DECRYPT_FINAL(AESiInvSubShiftTable,state2,state1,state0,state3,key[2]);
output[3]=DECRYPT_FINAL(AESiInvSubShiftTable,state3,state2,state1,state0,key[3]);
output[0] = key[0] ^ ((u32)AESiInvSubShiftTable[state0 >> 24] << 24) ^ ((u32)AESiInvSubShiftTable[(state3 >> 16) & 255] << 16) ^ ((u32)AESiInvSubShiftTable[(state2 >> 8) & 255] << 8) ^ AESiInvSubShiftTable[state1 & 255];
output[1] = key[1] ^ ((u32)AESiInvSubShiftTable[state1 >> 24] << 24) ^ ((u32)AESiInvSubShiftTable[(state0 >> 16) & 255] << 16) ^ ((u32)AESiInvSubShiftTable[(state3 >> 8) & 255] << 8) ^ AESiInvSubShiftTable[state2 & 255];
output[2] = key[2] ^ ((u32)AESiInvSubShiftTable[state2 >> 24] << 24) ^ ((u32)AESiInvSubShiftTable[(state1 >> 16) & 255] << 16) ^ ((u32)AESiInvSubShiftTable[(state0 >> 8) & 255] << 8) ^ AESiInvSubShiftTable[state3 & 255];
output[3] = key[3] ^ ((u32)AESiInvSubShiftTable[state3 >> 24] << 24) ^ ((u32)AESiInvSubShiftTable[(state2 >> 16) & 255] << 16) ^ ((u32)AESiInvSubShiftTable[(state1 >> 8) & 255] << 8) ^ AESiInvSubShiftTable[state0 & 255];
}
BOOL NETAESCreateEx(AESContext* context, const void* key, u32 keyLength, const void* iv, const AESBlockMode* mode) {

View File

@@ -54,54 +54,50 @@ 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 vu32 RestartRequested = 0;
static vu32 PartitionOpen = 0;
static u32 CacheSeekComplete = 0;
static u32 LoadingTitle = 0;
BOOL FatalErrorFlag = FALSE;
static vu32 LoadingTitle = 0;
volatile BOOL FatalErrorFlag = FALSE;
BOOL RetryErrorFlag = FALSE;
BOOL UpdateErrorFlag = FALSE;
BOOL AbortFlag = FALSE;
volatile BOOL AbortFlag = FALSE;
volatile int CacheFailed = 0;
volatile int RegionValid = 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;
static u32 TitleTicketView = 0;
static u32 CurrentTmd = 0;
u32 TitleCode = 0;
u32 RequiredIosHigh = 0;
u32 RequiredIosLow = 0;
u32 GamePartition = 0;
u32 UpdatePartition = 0;
u32 PartitionCursor = 0;
u32 DataToc = 0;
u64 GameToc = 0;
u32 CoverOpenTimeHigh = 0;
u32 CoverOpenTimeLow = 0;
vu32 NandTransferred = 0;
vu32 NandLength = 0;
u8 *NandBuffer = NULL;
NANDFileInfo *NandFile = NULL;
vu32 NandOperation = 0;
volatile NANDCallback NandCompletion = NULL;
u32 LoaderOffset = 0;
vu32 LoaderLength = 0;
u32 LoaderAddress = 0;
vu32 CacheLength = 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;
static u32 LoaderInit;
static u32 LoaderMain;
static u32 LoaderClose;
static u32 *DvdProgress;
static vu32 DvdTransferred;
static vu32 DvdTransferLength;
static vu32 BannerLength;
vu32 CacheLength;
u32 LoaderAddress;
vu32 LoaderLength;
u32 LoaderOffset;
volatile NANDCallback NandCompletion;
vu32 NandOperation;
NANDFileInfo *NandFile;
u8 *NandBuffer;
vu32 NandLength;
vu32 NandTransferred;
OSTime CoverOpenTime;
u64 GameToc;
u32 DataToc;
u32 PartitionCursor;
u32 UpdatePartition;
u32 GamePartition;
u64 RequiredIos;
u32 TitleCode;
static u32 CurrentTmd;
static u32 TitleTicketView;
u32 DriveWasReset;
u64 CoverPollTime;
static u64 SpinupDeadline;
static u64 ResetTime;
void BS2Report(const char *msg, ...) {
@@ -623,7 +619,7 @@ void BS2StartGame() {
u32 (*entry)(void);
StartingGame = TRUE;
while (CoverBlock.state != DVD_STATE_IDLE) {
while (((volatile DVDCommandBlock *)&CoverBlock)->state != DVD_STATE_IDLE) {
}
BS2Report("BS2StartGame(1)\n");
@@ -667,8 +663,8 @@ void BS2StartGame() {
__OSWriteStateFlags(&stateFlags);
__OSClearRTCFlags();
titleType = RequiredIosHigh;
titleCode = RequiredIosLow;
titleType = (u32)(RequiredIos >> 32);
titleCode = (u32)RequiredIos;
ticketCount = 1;
ticketViews = TicketViews;
if ((titleCode | titleType) == 0) {
@@ -806,16 +802,25 @@ partition_fatal:
partition_done:
BS2Report("DVDLowOpenPartition done\n");
if (*(u8 *)0x8000315D != 0x80) {
u32 diBits;
u32 diValue;
typedef union {
u32 value;
struct {
u32 reserved : 29;
u32 bit2 : 1;
u32 bit1 : 1;
u32 bit0 : 1;
} bits;
} DIControl;
DIControl diBits;
DIControl diValue;
u32 *diAddr;
diAddr = (u32 *)0xCC003024;
diBits = 2;
diBits |= 4;
diValue = *diAddr;
diValue |= 1;
*diAddr = diValue | diBits;
diValue.value = *diAddr;
diValue.bits.bit0 = 1;
diBits.value = 2;
diBits.bits.bit2 = 1;
*diAddr = diValue.value | diBits.value;
enableLegacyDI();
}
oldInterrupts = OSDisableInterrupts();
@@ -845,7 +850,7 @@ void BS2StartGCGame() {
OSTime time;
StartingGame = TRUE;
while (CoverBlock.state != DVD_STATE_IDLE) {
while (((volatile DVDCommandBlock *)&CoverBlock)->state != DVD_STATE_IDLE) {
}
soundMode = SCGetSoundMode();
@@ -973,9 +978,7 @@ static BOOL CheckDVDCommandStatus(DVDCommandBlock *block) {
case 4:
case 5:
if (State == 7 || State == 9 || State == 10) {
u64 systemTime = __OSGetSystemTime();
CoverOpenTimeLow = (u32)systemTime;
CoverOpenTimeHigh = (u32)(systemTime >> 32);
CoverOpenTime = __OSGetSystemTime();
State = BS2_STT_66;
} else {
State = BS2_STT_NO_DISK;
@@ -1090,6 +1093,8 @@ static void BS2NANDDivideWriteAsync(NANDFileInfo *info, const void *buffer, u32
}
static BOOL CheckBS2CommandStatus() {
static u32 CacheCommandComplete = 0;
if (CheckDVDCommandStatus(&Block) == 0) {
BS2Report("DVD command is issuing\n");
return 0;
@@ -1172,8 +1177,8 @@ static BOOL CheckBS2CommandStatus() {
if (BS2BootCaching != 0) {
BS2Report("Write partition ifno\n");
NandPending = 1;
CacheLength += OSRoundUp32B(((DVDGameTOC *)DataToc)->partitionCount * sizeof(DVDPartitionInfo)) + 32;
CacheCommandComplete = 1;
CacheLength += OSRoundUp32B(((DVDGameTOC *)DataToc)->partitionCount * sizeof(DVDPartitionInfo)) + 32;
if ((unsigned int)CacheLength > 0xb00000) {
BS2NANDCallback(-1, NULL);
return 1;
@@ -1315,25 +1320,24 @@ static void BS2ReadDiskID(void *buffer, s32 length, u32 offset) {
}
BS2State BS2Tick() {
static u32 AudioBufferUnconfigured;
u32 interruptsEnabled = OSDisableInterrupts();
u32 loaderAddress;
u32 loaderLength;
u32 loaderOffset;
u32 titleCode;
s32 titlePrefix;
u8 titleCharacters[4];
struct {
u32 offset;
u32 length;
u32 address;
} loaderRead;
DVDFileInfo bannerFile;
u32 bannerAddress;
u32 discRegion;
s32 status;
u64 currentTime;
BOOL regionMatches;
char productRegion;
u32 iosHigh;
char *ticketByte;
u32 entryCount;
u32 readInterruptsEnabled;
DVDGameTOC *dataToc;
u32 readAddress;
const char *discTitle;
const DVDDiskID *bootDisc;
@@ -1343,17 +1347,16 @@ BS2State BS2Tick() {
BS2Report("Drive Reset : %d\n", BS2DriveReset);
BS2Report("Wait Spinup : %d\n", BS2WaitSpinup);
BS2Report("Boot From Cache : %d\n", BS2BootFromCache);
DvdProgress = (u32 *)&(*(u32 *)0x800030d4);
DvdProgress = (u32 *)0x800030d4;
PartitionParams.numTmdBytes = 0;
PartitionParams.numCertBytes = 0;
PartitionParams.dataWordOffset = 0;
(*(u32 *)0x800030d4) = 0;
*DvdProgress = 0;
DvdTransferred = 0;
DvdTransferLength = 0;
status = BS2NoDisk;
AudioBufferUnconfigured = 1;
CoverBlock.state = 0;
if (status != 0)
if (BS2NoDisk != 0)
State = BS2_STT_NO_DISK;
else if (BS2DriveReset != 0)
State = BS2_STT_2;
@@ -1432,13 +1435,14 @@ BS2State BS2Tick() {
case 5:
status = CheckBS2CommandStatus();
if (status != 0) {
if ((((const OSBootInfo *)0x80000000)->consoleType & 0xf0000000) == 0) {
OSBootInfo *bootInfo = (OSBootInfo *)OSPhysicalToCached(OS_ADDR_BOOT_INFO);
if ((bootInfo->consoleType & 0xf0000000) == 0) {
__OSDeviceCode = 0x8002;
State = BS2_STT_8;
} else {
__OSDeviceCode = DriveInfo.deviceCode | 0x8000;
State = BS2_STT_8;
}
State = BS2_STT_8;
}
break;
case 6:
@@ -1565,8 +1569,9 @@ invalidGcRegion:
BS2Report("length ... 0x%08X\n", 0x20);
BS2Report("numGamePartitions ... 0x%08X\n", (*(DVDGameTOC **)&GameToc)->partitionCount);
BS2Report("partitionInfos ... 0x%08X\n", (u32)(*(DVDGameTOC **)&GameToc)->partitionInfo);
DataToc = (u32)((DVDGameTOC *)GameTOCBuf + 1);
BS2Report("numGamePartitions ... 0x%08X\n", ((DVDGameTOC *)GameTOCBuf)[1].partitionCount);
dataToc = (DVDGameTOC *)GameTOCBuf + 1;
DataToc = (u32)dataToc;
BS2Report("numGamePartitions ... 0x%08X\n", dataToc->partitionCount);
BS2Report("partitionInfos ... 0x%08X\n", ((DVDGameTOC *)DataToc)->partitionInfo);
State = BS2_STT_17;
case 0x11:
@@ -1723,21 +1728,23 @@ invalidRvlRegion:
((void (*)(void *))((*(void **)&LoaderInit)))((void *)BS2Report);
BS2Report("\nApploader Initialized\n");
State = BS2_STT_29;
case 0x1d:
status = ((int (*)(u32 *, u32 *, u32 *))((*(void **)&LoaderMain)))(&loaderRead.address, &loaderRead.length, &loaderRead.offset);
case 0x1d: {
u32 readInterruptsEnabled;
status = ((int (*)(u32 *, u32 *, u32 *))((*(void **)&LoaderMain)))(&loaderAddress, &loaderLength, &loaderOffset);
if (status != 0) {
BS2Report("Addr [0x%x] length [0x%x] offset [0x%x]\n", loaderRead.address, loaderRead.length, loaderRead.offset);
BS2Report("Addr [0x%x] length [0x%x] offset [0x%x]\n", loaderAddress, loaderLength, loaderOffset);
readInterruptsEnabled = OSDisableInterrupts();
DVDReadAbsAsyncForBS(&Block, (void *)loaderRead.address, loaderRead.length, loaderRead.offset >> __DVDLayoutFormat, BS2DVDCallback);
DVDReadAbsAsyncForBS(&Block, (void *)loaderAddress, loaderLength, loaderOffset >> __DVDLayoutFormat, BS2DVDCallback);
if (*(s32 *)DvdProgress != 0) {
DvdReadPending = 1;
DvdTransferLength = loaderRead.length;
DvdTransferLength = loaderLength;
}
OSRestoreInterrupts(readInterruptsEnabled);
State = BS2_STT_30;
} else
State = BS2_STT_31;
break;
}
case 0x1e:
status = CheckDVDCommandStatus(&Block);
if (status != 0)
@@ -1871,9 +1878,7 @@ invalidRvlRegion:
(u32)((ESTitleMeta *)CurrentTmd)->head.sysVersion);
BS2Report("Title ID ... 0x%08X%08X\n", (u32)(((ESTitleMeta *)CurrentTmd)->head.titleId >> 32),
(u32)((ESTitleMeta *)CurrentTmd)->head.titleId);
iosHigh = (u32)(((ESTitleMeta *)CurrentTmd)->head.sysVersion >> 32);
RequiredIosLow = (u32)((ESTitleMeta *)CurrentTmd)->head.sysVersion;
RequiredIosHigh = iosHigh;
RequiredIos = ((ESTitleMeta *)CurrentTmd)->head.sysVersion;
titleCode = (u32)((ESTitleMeta *)CurrentTmd)->head.titleId;
TitleCode = titleCode;
if (((ESTitleMeta *)CurrentTmd)->head.sysVersion == 0x0000000100000010ULL) {
@@ -2011,25 +2016,27 @@ invalidRvlRegion:
((void (*)(void *))((*(void **)&LoaderInit)))((void *)OSReport);
BS2Report("\nApploader Initialized\n");
State = BS2_STT_43;
case 0x2b:
status = ((int (*)(u32 *, u32 *, u32 *))((*(void **)&LoaderMain)))(&loaderRead.address, &loaderRead.length, &loaderRead.offset);
case 0x2b: {
u32 readInterruptsEnabled;
status = ((int (*)(u32 *, u32 *, u32 *))((*(void **)&LoaderMain)))(&loaderAddress, &loaderLength, &loaderOffset);
if (status != 0) {
BS2Report("Addr [0x%x] length [0x%x] offset [0x%x]\n", loaderRead.address, loaderRead.length, loaderRead.offset);
BS2Report("Addr [0x%x] length [0x%x] offset [0x%x]\n", loaderAddress, loaderLength, loaderOffset);
readInterruptsEnabled = OSDisableInterrupts();
BS2ReadDiskID((void *)loaderRead.address, loaderRead.length, loaderRead.offset >> __DVDLayoutFormat);
readAddress = loaderRead.address;
LoaderLength = loaderRead.length;
BS2ReadDiskID((void *)loaderAddress, loaderLength, loaderOffset >> __DVDLayoutFormat);
readAddress = loaderAddress;
LoaderLength = loaderLength;
LoaderAddress = readAddress;
LoaderOffset = loaderRead.offset;
LoaderOffset = loaderOffset;
if ((*(s32 *)DvdProgress != 0) && (BS2BootFromCache == 0)) {
DvdReadPending = 1;
DvdTransferLength = loaderRead.length;
DvdTransferLength = loaderLength;
}
OSRestoreInterrupts(readInterruptsEnabled);
State = BS2_STT_44;
} else
State = BS2_STT_45;
break;
}
case 0x2c:
status = CheckBS2CommandStatus();
if (status != 0)
@@ -2052,13 +2059,15 @@ invalidRvlRegion:
BannerAllocation = status;
if (status == 0)
OSPanic("BS2Mach.c", 0x12c8, "BS2 ERROR >>> Cannnot alloc 0x%08x from MEMAllocator", bannerFile.length);
bannerAddress = BannerAllocation + 32 - BannerAllocation % 32;
BannerLength = bannerFile.length;
BannerBuffer = BannerAllocation + 32 - BannerAllocation % 32;
BannerBuffer = bannerAddress;
BS2Report("BannerBufferAddr : %08X\n", BannerBuffer);
} else {
if ((BannerBuffer != 0) && (BannerLength != 0)) {
if (BannerLength < ((bannerFile.length + 0x1fU) & 0xffffffe0))
OSPanic("BS2Mach.c", 0x12d3, "BS2 ERROR >>> Banner buffer is not enough to load banner file (0x%08x)");
OSPanic("BS2Mach.c", 0x12d3, "BS2 ERROR >>> Banner buffer is not enough to load banner file (0x%08x)",
bannerFile.length);
BS2Report("BannerBufferAddr : %08X\n", BannerBuffer);
} else
OSPanic("BS2Mach.c", 0x12da, "BS2 ERROR >>> MEMAllocator and banner buffer is not set");
@@ -2162,7 +2171,7 @@ invalidRvlRegion:
BS2BootFromCache = 0;
BS2BootCaching = 1;
LoadingTitle = 0;
switch (Block.state) {
switch (((volatile DVDCommandBlock *)&Block)->state) {
case 4:
case 5:
CheckDVDCommandStatus(&Block);
@@ -2307,7 +2316,7 @@ invalidRvlRegion:
break;
case 0x42:
currentTime = __OSGetSystemTime();
if ((OSTime)(currentTime - (((u64)CoverOpenTimeHigh << 32) | CoverOpenTimeLow)) < OSMillisecondsToTicks((OSTime)350))
if ((OSTime)(currentTime - CoverOpenTime) < OSMillisecondsToTicks((OSTime)350))
break;
currentTime = __OSGetSystemTime();
CoverPollTime = currentTime;

View File

@@ -9,14 +9,13 @@
#include <string.h>
static u32 Flags0[BS2_UPDATE_ENTRY_COUNT] = {0};
static u32 Flags1[BS2_UPDATE_ENTRY_COUNT] = {0};
static OSThread Thread = {0};
static u8 ThreadStack[4096] = {0};
static BS2UpdateHeader UpdateHeader0 ALIGN32 = {0};
static BS2UpdateHeader UpdateHeader1 ALIGN32 = {0};
static u32 Flags1[BS2_UPDATE_ENTRY_COUNT];
static OSThread Thread;
static u8 ThreadStack[4096];
static BS2UpdateHeader UpdateHeader0 ALIGN32;
static BS2UpdateHeader UpdateHeader1 ALIGN32;
#define UPDATE_DISC_ENTRIES ((BS2UpdateEntry*)0x80480000)
BS2UpdateEntry DiscEntries[BS2_UPDATE_ENTRY_COUNT] ADDRESS(0x80480000);
s32 WADCheckImport(u64 titleId, u16 titleVersion);
s32 WADImportDVDForBS(const char* path, void* buffer, u32 length);
@@ -32,8 +31,8 @@ static u32 RebootRequired = 0;
static BOOL ContainsSeatTitles = 0;
static u32 UpdateImportState = 0;
static u32 UpdateImportResult = 0;
u32 StartUpdate = 0;
u32 CancelUpdate = 0;
volatile u32 StartUpdate = 0;
volatile u32 CancelUpdate = 0;
static u32 UpdateProgress = 0;
static volatile s32 rc = 0;
static u64 VersionIOS = 0;
@@ -50,71 +49,44 @@ char* getSuffix(const char* path) {
return suffix;
}
static void* UpdateThread(void* argument);
void BS2UpdateInit(void* allocator) {
BS2Report("initialize BS2Update\n");
ConsoleType = OSGetConsoleType();
VersionES = __OSGetHollywoodRev();
VersionMEM2 = OSGetPhysicalMem2Size();
__OSGetIOSRev((OSIOSRev*)&VersionIOS);
BS2Report("Console Type : %08X\n", ConsoleType);
BS2Report("Hollywood Rev : %08X\n", VersionES);
BS2Report("MEM2 Size : %08X\n", VersionMEM2);
MemAllocator = allocator;
State = 0;
CurrentEntry = NULL;
pEntries = NULL;
EntriesCount = 0;
memset(UPDATE_DISC_ENTRIES, 0, 0x40000);
memset(EntriesToImport, 0, 0x40000);
memset(Flags1, 0, sizeof(Flags1));
BS2Report("Create update thread\n");
OSCreateThread(&Thread, UpdateThread, NULL, ThreadStack + sizeof(ThreadStack),
sizeof(ThreadStack), 31, OS_THREAD_ATTR_DETACH);
OSResumeThread(&Thread);
}
static inline u32 BS2SelectUpdateEntries(void) {
static u32 Flags0[BS2_UPDATE_ENTRY_COUNT];
BOOL missingFile;
u32 index;
u32 selectedCount;
u32 requiredBytes;
u32 requiredInodes;
u32 channelCount;
u32 index;
BS2UpdateEntry* seatEntries;
BS2UpdateEntry* selectedSeats;
u32 selectedSeatCount;
BOOL regionValid;
u32 titleRegion;
struct {
u32 freeChannels;
u32 freeBlocks;
u32 freeInodes;
u32 ticketCount;
char productArea[8];
u64 titleId;
char updatePath[32];
char seatPath[32];
DVDFileInfo file;
} scratch;
u32 freeChannels;
u32 freeBlocks;
u32 freeInodes;
u32 ticketCount;
char productArea[8];
u64 titleId;
char updatePath[32];
char seatPath[32];
DVDFileInfo file;
missingFile = FALSE;
selectedCount = 0;
requiredBytes = 0;
requiredInodes = 0;
channelCount = 0;
scratch.freeChannels = 0;
scratch.freeBlocks = 0;
scratch.freeInodes = 0;
freeChannels = 0;
freeBlocks = 0;
freeInodes = 0;
selectedSeatCount = 0;
State = 0;
ContainsSeatTitles = FALSE;
if (ES_GetTitleId(&scratch.titleId) != ES_ERR_OK) {
if (ES_GetTitleId(&titleId) != ES_ERR_OK) {
regionValid = FALSE;
} else {
titleRegion = (u8)scratch.titleId;
titleRegion = (u8)titleId;
switch (SCGetProductArea()) {
case SC_PRODUCT_AREA_JPN:
case SC_PRODUCT_AREA_TWN:
@@ -159,23 +131,23 @@ product_region_checked:
selectedCount = 0;
goto selection_complete;
}
if (!SCGetProductAreaString(scratch.productArea, sizeof(scratch.productArea))) {
if (!SCGetProductAreaString(productArea, sizeof(productArea))) {
BS2Report("Error: failed to get product information.");
selectedCount = 0;
goto selection_complete;
}
strcpy(scratch.updatePath, "__update.inf");
strcat(scratch.updatePath, ".");
strcat(scratch.updatePath, scratch.productArea);
if (DVDConvertPathToEntrynum(scratch.updatePath) < 0) {
strcpy(updatePath, "__update.inf");
strcat(updatePath, ".");
strcat(updatePath, productArea);
if (DVDConvertPathToEntrynum(updatePath) < 0) {
switch (SCGetProductArea()) {
case 0:
case 1:
case 2:
case 6:
case 11:
strcpy(scratch.updatePath, "__update.inf");
if (DVDConvertPathToEntrynum(scratch.updatePath) < 0) {
strcpy(updatePath, "__update.inf");
if (DVDConvertPathToEntrynum(updatePath) < 0) {
BS2Report("Error: update information file is not found.");
selectedCount = 0;
goto selection_complete;
@@ -187,13 +159,13 @@ product_region_checked:
goto selection_complete;
}
}
BS2Report("%s is found.\n", scratch.updatePath);
if (!DVDOpen(scratch.updatePath, &scratch.file)) {
BS2Report("%s is found.\n", updatePath);
if (!DVDOpen(updatePath, &file)) {
BS2Report("Error: failed to open update information file.");
selectedCount = 0;
goto selection_complete;
}
if (DVDReadPrio(&scratch.file, &UpdateHeader0, sizeof(UpdateHeader0), 0, 2) < 0) {
if (DVDReadPrio(&file, &UpdateHeader0, sizeof(UpdateHeader0), 0, 2) < 0) {
BS2Report("Error: failed to read update information header.");
selectedCount = 0;
goto selection_complete;
@@ -214,25 +186,24 @@ product_region_checked:
selectedCount = 0;
goto selection_complete;
}
if (DVDReadPrio(&scratch.file, UPDATE_DISC_ENTRIES, UpdateHeader0.wadCount * sizeof(BS2UpdateEntry), 32, 2) < 0) {
if (DVDReadPrio(&file, DiscEntries, UpdateHeader0.wadCount * sizeof(BS2UpdateEntry), 32, 2) < 0) {
BS2Report("Error: failed to read update information.");
selectedCount = 0;
goto selection_complete;
}
{
BS2UpdateEntry *discEntries = UPDATE_DISC_ENTRIES;
for (index = 0; index < UpdateHeader0.wadCount; index++) {
if ((discEntries[index].attr & 1) == 0) {
if ((DiscEntries[index].attr & 1) == 0) {
continue;
}
switch (OSGetPhysicalMem2Size()) {
case 0x4000000:
if ((discEntries[index].depend & 1) == 0) {
if ((DiscEntries[index].depend & 1) == 0) {
continue;
}
break;
case 0x8000000:
if ((discEntries[index].depend & 2) == 0) {
if ((DiscEntries[index].depend & 2) == 0) {
continue;
}
break;
@@ -242,37 +213,37 @@ product_region_checked:
selectedCount = 0;
goto selection_complete;
}
if (DVDOpen(discEntries[index].path, &scratch.file) < 0) {
BS2Report("%s is not found\n", discEntries[index].path);
if (DVDOpen(DiscEntries[index].path, &file) < 0) {
BS2Report("%s is not found\n", DiscEntries[index].path);
missingFile = TRUE;
continue;
}
discEntries[index].size = scratch.file.length;
if (discEntries[index].type == 0) {
DiscEntries[index].size = file.length;
if (DiscEntries[index].type == 0) {
selectedCount++;
} else if (WADCheckImport(discEntries[index].titleId, discEntries[index].titleVersion) == 0) {
BS2Report("%s is already installed\n", discEntries[index].path);
} else if (WADCheckImport(DiscEntries[index].titleId, DiscEntries[index].titleVersion) == 0) {
BS2Report("%s is already installed\n", DiscEntries[index].path);
Flags1[index] = 0;
} else {
BS2Report("%s\n", discEntries[index].path);
memcpy(&EntriesToImport[selectedCount], &discEntries[index], sizeof(BS2UpdateEntry));
BS2Report("%s\n", DiscEntries[index].path);
memcpy(&EntriesToImport[selectedCount], &DiscEntries[index], sizeof(BS2UpdateEntry));
selectedCount++;
Flags1[index] = 1;
}
}
}
strcpy(scratch.seatPath, "__seatholder.inf");
strcat(scratch.seatPath, ".");
strcat(scratch.seatPath, scratch.productArea);
if (DVDConvertPathToEntrynum(scratch.seatPath) < 0) {
strcpy(seatPath, "__seatholder.inf");
strcat(seatPath, ".");
strcat(seatPath, productArea);
if (DVDConvertPathToEntrynum(seatPath) < 0) {
switch (SCGetProductArea()) {
case 0:
case 1:
case 2:
case 6:
case 11:
strcpy(scratch.seatPath, "__seatholder.inf");
if (DVDConvertPathToEntrynum(scratch.seatPath) < 0) {
strcpy(seatPath, "__seatholder.inf");
if (DVDConvertPathToEntrynum(seatPath) < 0) {
BS2Report("Error: update seatholder information file is not found.");
goto seats_done;
}
@@ -282,12 +253,12 @@ product_region_checked:
goto seats_done;
}
}
BS2Report("%s is found.\n", scratch.seatPath);
if (!DVDOpen(scratch.seatPath, &scratch.file)) {
BS2Report("%s is found.\n", seatPath);
if (!DVDOpen(seatPath, &file)) {
BS2Report("Error: failed to open update information file.");
goto seats_done;
}
if (DVDReadPrio(&scratch.file, &UpdateHeader1, sizeof(UpdateHeader1), 0, 2) < 0) {
if (DVDReadPrio(&file, &UpdateHeader1, sizeof(UpdateHeader1), 0, 2) < 0) {
BS2Report("Error: failed to read update information header.");
goto seats_done;
}
@@ -300,11 +271,9 @@ product_region_checked:
BS2Report("Error: found too many extra entries.");
goto seats_done;
}
seatEntries = UPDATE_DISC_ENTRIES;
seatEntries += UpdateHeader0.wadCount;
selectedSeats = EntriesToImport;
selectedSeats += selectedCount;
if (DVDReadPrio(&scratch.file, seatEntries, UpdateHeader1.wadCount * sizeof(BS2UpdateEntry), 32, 2) < 0) {
seatEntries = DiscEntries + UpdateHeader0.wadCount;
selectedSeats = EntriesToImport + selectedCount;
if (DVDReadPrio(&file, seatEntries, UpdateHeader1.wadCount * sizeof(BS2UpdateEntry), 32, 2) < 0) {
BS2Report("Error: failed to read update information.");
goto seats_done;
}
@@ -337,7 +306,7 @@ product_region_checked:
State = 5;
goto seats_done;
}
if (DVDOpen(seatEntries[index].path, &scratch.file) < 0) {
if (DVDOpen(seatEntries[index].path, &file) < 0) {
BS2Report("%s is not found\n", seatEntries[index].path);
missingFile = TRUE;
continue;
@@ -345,11 +314,11 @@ product_region_checked:
if (seatEntries[index].type != 7) {
continue;
}
if (ES_GetTicketViews(seatEntries[index].titleId, NULL, &scratch.ticketCount) != ES_ERR_OK) {
if (ES_GetTicketViews(seatEntries[index].titleId, NULL, &ticketCount) != ES_ERR_OK) {
BS2Report("Faild to get eTicket views.\n");
continue;
}
if (scratch.ticketCount != 0) {
if (ticketCount != 0) {
continue;
}
if (SCGetWwwRestriction() && ((u32)(seatEntries[index].titleId & 0xFFFFFFFFULL) & 0xFFFFFF00) == 0x48414400) {
@@ -372,23 +341,23 @@ product_region_checked:
requiredInodes += seatEntries[index].inodes;
}
if (channelCount != 0) {
if (!SCGetFreeChannelAppCount(&scratch.freeChannels)) {
if (!SCGetFreeChannelAppCount(&freeChannels)) {
BS2Report("Error: cannot get channel count.");
goto seats_done;
}
if (NANDSecretGetUserAvailableArea(&scratch.freeBlocks, &scratch.freeInodes) != NAND_RESULT_OK) {
if (NANDSecretGetUserAvailableArea(&freeBlocks, &freeInodes) != NAND_RESULT_OK) {
BS2Report("Error: cannot get free user blocks.");
goto seats_done;
}
if ((scratch.freeBlocks << 14) < 0x1004000 || requiredBytes > (scratch.freeBlocks << 14) - 0x1004000) {
if ((freeBlocks << 14) < 0x1004000 || requiredBytes > (freeBlocks << 14) - 0x1004000) {
BS2Report("Sufficient user blocks doesn't exist.");
goto seats_done;
}
if (scratch.freeInodes < requiredInodes + 36) {
if (freeInodes < requiredInodes + 36) {
BS2Report("Sufficient user inodes doesn't exist.");
goto seats_done;
}
if (channelCount > scratch.freeChannels) {
if (channelCount > freeChannels) {
BS2Report("No enough blank channel.");
goto seats_done;
}
@@ -410,14 +379,13 @@ seats_done:
pEntries = EntriesToImport;
pFlags = Flags1;
{
BS2UpdateEntry *discEntries = UPDATE_DISC_ENTRIES;
for (index = 0; index < UpdateHeader0.wadCount; index++) {
if (Flags1[index] == 1) {
BS2Report("File: %s\n", discEntries[index].path);
BS2Report("Name: %s\n", discEntries[index].dataName);
BS2Report("Info: %s\n", discEntries[index].dataMeta);
BS2Report("Attr: %s\n", (discEntries[index].attr & 1) ? "Critical" : "Non critical");
BS2Report(" %s\n", (discEntries[index].attr & 2) ? "Reboot" : "Not reboot");
BS2Report("File: %s\n", DiscEntries[index].path);
BS2Report("Name: %s\n", DiscEntries[index].dataName);
BS2Report("Info: %s\n", DiscEntries[index].dataMeta);
BS2Report("Attr: %s\n", (DiscEntries[index].attr & 1) ? "Critical" : "Non critical");
BS2Report(" %s\n", (DiscEntries[index].attr & 2) ? "Reboot" : "Not reboot");
}
}
}
@@ -425,6 +393,31 @@ selection_complete:
return selectedCount;
}
static void* UpdateThread(void* argument);
void BS2UpdateInit(void* allocator) {
BS2Report("initialize BS2Update\n");
ConsoleType = OSGetConsoleType();
VersionES = __OSGetHollywoodRev();
VersionMEM2 = OSGetPhysicalMem2Size();
__OSGetIOSRev((OSIOSRev*)&VersionIOS);
BS2Report("Console Type : %08X\n", ConsoleType);
BS2Report("Hollywood Rev : %08X\n", VersionES);
BS2Report("MEM2 Size : %08X\n", VersionMEM2);
MemAllocator = allocator;
State = 0;
CurrentEntry = NULL;
pEntries = NULL;
EntriesCount = 0;
memset(DiscEntries, 0, 0x40000);
memset(EntriesToImport, 0, 0x40000);
memset(Flags1, 0, sizeof(Flags1));
BS2Report("Create update thread\n");
OSCreateThread(&Thread, UpdateThread, NULL, ThreadStack + sizeof(ThreadStack),
sizeof(ThreadStack), 31, OS_THREAD_ATTR_DETACH);
OSResumeThread(&Thread);
}
static void* UpdateThread(void* argument) {
u32 index;
s32 importResult;
@@ -442,25 +435,24 @@ static void* UpdateThread(void* argument) {
State = 1;
UpdateProgress = 0;
{
BS2UpdateEntry *discEntries = UPDATE_DISC_ENTRIES;
for (;;) {
if (StartUpdate != 0) {
if (UpdateProgress < UpdateHeader0.wadCount) {
BS2Report("Progress : %d\n", UpdateProgress);
if (Flags1[UpdateProgress] == 1) {
const char* path = discEntries[UpdateProgress].path;
const char* path = DiscEntries[UpdateProgress].path;
BS2Report("Import : %s\n", path);
State = 2;
CurrentEntry = &discEntries[UpdateProgress];
if (discEntries[UpdateProgress].type == 0) {
CurrentEntry = &DiscEntries[UpdateProgress];
if (DiscEntries[UpdateProgress].type == 0) {
UpdateProgress++;
continue;
}
if (((const BS2UpdateEntry *)discEntries)[UpdateProgress].type == 1) {
if (((const BS2UpdateEntry *)DiscEntries)[UpdateProgress].type == 1) {
BS2Report("BS2WADImportDVD : ");
index = UpdateProgress;
if (strcmp(getSuffix(discEntries[index].path), "wad") == 0) {
importResult = WADImportDVDForBS(discEntries[index].path, (void*)BS2_UPDATE_ADDRESS, 0x80000);
if (strcmp(getSuffix(DiscEntries[index].path), "wad") == 0) {
importResult = WADImportDVDForBS(DiscEntries[index].path, (void*)BS2_UPDATE_ADDRESS, 0x80000);
} else {
importResult = 0;
}
@@ -468,20 +460,20 @@ static void* UpdateThread(void* argument) {
BS2Report("rc = %d\n", rc);
if (rc != 0) {
NANDLoggingAddMessageAsync(NULL, "BS2 error. [%d] titleID: 0x%016llx %s line: %d",
rc, discEntries[UpdateProgress].titleId, "BS2Update.c", 0x3F5);
rc, DiscEntries[UpdateProgress].titleId, "BS2Update.c", 0x3F5);
State = 5;
UpdateProgress = UpdateHeader0.wadCount + 1;
break;
}
if ((discEntries[UpdateProgress].attr & 2) != 0) {
if ((DiscEntries[UpdateProgress].attr & 2) != 0) {
RebootRequired = 1;
}
UpdateProgress++;
} else {
BS2Report("BS2WADImportDVDEx : ");
index = UpdateProgress;
if (strcmp(getSuffix(discEntries[index].path), "wad") == 0) {
importResult = WADImportDVDExForBS(discEntries[index].path, (void*)BS2_UPDATE_ADDRESS, 0x80000);
if (strcmp(getSuffix(DiscEntries[index].path), "wad") == 0) {
importResult = WADImportDVDExForBS(DiscEntries[index].path, (void*)BS2_UPDATE_ADDRESS, 0x80000);
} else {
importResult = 0;
}
@@ -489,18 +481,18 @@ static void* UpdateThread(void* argument) {
BS2Report("rc = %d\n", rc);
if (rc != 0) {
NANDLoggingAddMessageAsync(NULL, "BS2 error. [%d] titleID: 0x%016llx %s line: %d",
rc, discEntries[UpdateProgress].titleId, "BS2Update.c", 0x40F);
rc, DiscEntries[UpdateProgress].titleId, "BS2Update.c", 0x40F);
State = 5;
UpdateProgress = UpdateHeader0.wadCount + 1;
break;
}
if ((discEntries[UpdateProgress].attr & 2) != 0) {
if ((DiscEntries[UpdateProgress].attr & 2) != 0) {
RebootRequired = 1;
}
UpdateProgress++;
}
} else {
const char* path = discEntries[UpdateProgress].path;
const char* path = DiscEntries[UpdateProgress].path;
BS2Report("Not import : %s\n", path);
UpdateProgress++;
}

View File

@@ -5,7 +5,7 @@
#include <revolution/sc.h>
VoiceInfo Voices[AX_VOICE_MAX];
u8 sZeroMem[0x100];
u8 sZeroMem[0x100] ATTRIBUTE_ALIGN(32);
void* zeroBuffer;
bool AxAdpcmSimplePlayer::sSysInit;

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,5 @@
int gDpdWaitFrm = 0;
#include "iplwww/www_wiisetting.h"
#include <string.h>
@@ -9,16 +11,18 @@
#include "iplwww/www_browser.h"
int gDpdWaitFrm = 0;
BOOL gEnableDpd = TRUE;
namespace www {
namespace wiisetting {
static const char emptyString[] = "";
char MSG_TICK_TIMER_TAG[12] = "[TickTimer]";
char MSG_WARNING_TAG[10] = "[Warning]";
char MSG_EVENT_TAG[10] = "[[Event]]";
const char* Message[] = {NULL, NULL, NULL, NULL, emptyString, NULL};
struct ReportInfo {
char tickTimerTag[12];
char warningTag[10];
char eventTag[10];
const char* MessageArr[6];
};
ReportInfo reportInfo = {"[TickTimer]", "[Warning]", "[[Event]]", {NULL, NULL, NULL, NULL, NULL, NULL}};
const u8 kbLangUsaLUT[][0x30] = {
{
@@ -150,8 +154,8 @@ namespace www {
extern const char* strProps[FORM_ID_MAX];
int getStringPropertyIdx(const char* targetStr) {
const char* names[ARRAY_LENGTH(strProps)];
const char** destinationName = names - 1;
const char* const* sourceName = strProps - 1;
const char** destinationName = names - 1;
for (int i = 0; i < (ARRAY_LENGTH(names) >> 1); i++) {
*(++destinationName) = *(++sourceName);
*(++destinationName) = *(++sourceName);
@@ -169,9 +173,19 @@ namespace www {
return -1;
}
static inline int getSettingProperty(const char* str, WWWJSPluginValue* val);
static inline void selectEuropeanKeyboardLanguage(u32& kbLang) {
int i;
for (i = 0; i < 0x3b; i++) {
if (sWiiData.data[WB_ID_COUNTRY] == kbLangEurLUT[ipl::System::getLanguage() - 1][i] + 0x40) {
kbLang = (u8)(i + 0x40);
break;
}
}
}
int Getter_(WWWJSPluginObj* obj, const char* str, WWWJSPluginValue* val) {
int retVal;
int strPropIdx;
if (strcmp(str, "CallOSReport") == 0) {
int data;
if (opera_callbacks->globalGet(obj, 0, 0, wiiOSReport, wiiOSReport, "", 0, (WWWJSPluginValueData*)&data) < 0) {
@@ -191,6 +205,15 @@ namespace www {
return 7;
}
}
return getSettingProperty(str, val);
}
static inline int getSettingProperty(const char* str, WWWJSPluginValue* val) {
int privacyIndex;
int retVal;
SetStringBuf* strBuf;
int maskLength;
int strPropIdx;
if (!(writeBackID == WB_ID_PROGRESSIVE || writeBackID == WB_ID_PAL || writeBackID == WB_ID_COUNTRY || writeBackID == WB_ID_LIGHT ||
writeBackID == WB_ID_LANGUAGE || writeBackID == WB_ID_RATE)) {
writeBackID = WB_ID_RESET;
@@ -281,14 +304,13 @@ namespace www {
memset(pString->asterisks, 0, sizeof(pString->asterisks));
OSReport("mode %d %d\n", saveData, (u16)ipl::ncd::NCDSetting::getPrivacyMode());
if (saveData == (u16)ipl::ncd::NCDSetting::getPrivacyMode()) {
int i;
OSReport("len ::: %d\n", ipl::ncd::NCDSetting::getPrivacyLen());
for (i = 0; i < ipl::ncd::NCDSetting::getPrivacyLen(); i++) {
pString->asterisks[i] = '*';
for (privacyIndex = 0; privacyIndex < ipl::ncd::NCDSetting::getPrivacyLen(); privacyIndex++) {
pString->asterisks[privacyIndex] = '*';
}
if (0x20 < i) {
if (0x20 < privacyIndex) {
pString->asterisks[0x20] = '\n';
pString->asterisks[i] = '*';
pString->asterisks[privacyIndex] = '*';
}
} else {
memset(pString->securityKey, 0, sizeof(pString->securityKey));
@@ -298,13 +320,11 @@ namespace www {
}
case FORM_ID_DUMMY_SECURITY_KEY: {
memset(pString->asterisks, 0, sizeof(pString->asterisks));
SetStringBuf* strBuf;
int i;
for (i = 0; i < strlen((strBuf = pString)->securityKey); strBuf->asterisks[i++] = '*') {
for (maskLength = 0; maskLength < strlen((strBuf = pString)->securityKey); strBuf->asterisks[maskLength++] = '*') {
}
if (i > 0x20) {
if (maskLength > 0x20) {
pString->asterisks[0x20] = '\n';
pString->asterisks[i] = '*';
pString->asterisks[maskLength] = '*';
}
val->data.jsStr = pString->asterisks;
break;
@@ -522,12 +542,7 @@ namespace www {
}
}
} else if ((u32)ipl::System::getRegion() == SC_PRODUCT_AREA_EUR) {
for (int i = 0; i < 0x3b; i++) {
if (sWiiData.data[WB_ID_COUNTRY] == kbLangEurLUT[ipl::System::getLanguage() - 1][i] + 0x40) {
kbLang = (u8)(i + 0x40);
break;
}
}
selectEuropeanKeyboardLanguage(kbLang);
}
val->data.jsDouble = (u8)kbLang;
}

View File

@@ -1,5 +1,7 @@
#define TI_CANDIDATEBOX_IMPLEMENTATION
#define TI_CANDIDATEBOX_SAMPLE_CLASS
#include "keyboard/tiCandidateBox.h"
#undef TI_CANDIDATEBOX_SAMPLE_CLASS
#include "keyboard/tiManager.h"
@@ -60,11 +62,7 @@ namespace textinput {
{ANM_InvalidOff, "fs_VK_predictInput_a_invalidMode_OFF.brlan"},
};
struct CandidatePaneData {
PaneToAnimation panes[26];
};
extern "C" const CandidatePaneData scCandidatePaneData __attribute__((aligned(8))) = {{
static const PaneToAnimation csPaneToAnimation[] = {
{KT_CandidateText, "N_predictInput", 1, NULL, {&csAninationFile[0]}},
{KT_ScrollButton,
"P_prdc_scrl_Left",
@@ -195,7 +193,7 @@ namespace textinput {
6,
NULL,
{&csAninationFile[0], &csAninationFile[8], &csAninationFile[9], &csAninationFile[10], &csAninationFile[11], &csAninationFile[12]}},
}};
};
void CandidateBoxCaller::Candidates::addCandidate(const wchar_t* wcString) {
wcsncpy(szwcPredicted[mNumCandidate], wcString, ARRAY_LENGTH(szwcPredicted[0]));
@@ -376,48 +374,44 @@ namespace textinput {
}
void LayoutByNW4R::createAnmPane_(MEMAllocator* allocator) {
const char* forceAddName;
u16 i;
for (i = 0; i < ARRAY_LENGTH(scCandidatePaneData.panes); i++) {
const PaneToAnimation& p = scCandidatePaneData.panes[i];
for (u16 i = 0; i < ARRAY_LENGTH(csPaneToAnimation); i++) {
const PaneToAnimation& paneAnimations = csPaneToAnimation[i];
CandidateTextAnmPane* pane = NULL;
switch (p.type) {
switch (paneAnimations.type) {
case KT_ScrollButton: {
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(CandidateScrollAnmPane));
pane = new (pBtnBuf) CandidateScrollAnmPane(getPane(p.paneName), NULL);
pane = new (pBtnBuf) CandidateScrollAnmPane(getPane(paneAnimations.paneName), NULL);
break;
}
case KT_CandidateText: {
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(CandidateTextAnmPane));
pane = new (pBtnBuf) CandidateTextAnmPane(getPane(p.paneName), NULL);
pane = new (pBtnBuf) CandidateTextAnmPane(getPane(paneAnimations.paneName), NULL);
break;
}
case KT_OnOffButton: {
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(OnOffAnmPane));
pane = new (pBtnBuf) OnOffAnmPane(getPane(p.paneName), &mOnOffButton);
pane = new (pBtnBuf) OnOffAnmPane(getPane(paneAnimations.paneName), &mOnOffButton);
break;
}
case KT_Window: {
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(PredictWindow));
pane = new (pBtnBuf) PredictWindow(getPane(p.paneName), &mTextWindow);
pane = new (pBtnBuf) PredictWindow(getPane(paneAnimations.paneName), &mTextWindow);
break;
}
}
nw4r::ut::List_Append(&mAnmPanes, pane);
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);
for (u16 j = 0; j < paneAnimations.count; j++) {
void* pResource = mpMultiArcResourceAccessor->GetResource(0, paneAnimations.pAnims[j]->fileName);
AnimTransformPane* transform =
static_cast<AnimTransformPane*>(getLayout()->CreateAnimTransform(pResource, mpMultiArcResourceAccessor));
if (forceAddName == NULL) {
pane->addAnimation(allocator, animation->id, transform, false, true);
if (paneAnimations.forceAddName == NULL) {
pane->addAnimation(allocator, paneAnimations.pAnims[j]->id, transform, false, true);
} else {
pane->forceAddAnimation(allocator, animation->id, transform, forceAddName, false, true);
pane->forceAddAnimation(allocator, paneAnimations.pAnims[j]->id, transform, paneAnimations.forceAddName, false, true);
}
}
}
@@ -676,8 +670,8 @@ namespace textinput {
}
void LayoutByNW4R::cancelStateFocusIn() {
const PaneToAnimation* pane = scCandidatePaneData.panes;
for (int i = 0; i < ARRAY_LENGTH(scCandidatePaneData.panes); i++) {
const PaneToAnimation* pane = csPaneToAnimation;
for (int i = 0; i < ARRAY_LENGTH(csPaneToAnimation); i++) {
CandidateTextAnmPane* p = static_cast<CandidateTextAnmPane*>(searchAnmPane(pane->paneName));
if (p != NULL) {
switch (p->getKeyType()) {
@@ -1764,3 +1758,48 @@ namespace textinput {
} // namespace candidatebox
} // namespace textinput
inline void textinput::util::Animation::startAnm(AnimObserver* observer, f32 start, f32 end, f32 duration, void* data) {
mfStartPoint = start;
mfEndPoint = end;
mfAnimationTime = duration;
mfCurrentFrame = 0.0f;
mbInAnimation = true;
mpAnimObserver = observer;
mpData = data;
mbSE = false;
if (observer) observer->onAnmEvent(AnimObserver::AE_0, data);
}
inline void textinput::util::Animation::calc() {
if (mbInAnimation) {
if (mfCurrentFrame < mfAnimationTime) {
mfCurrentFrame = 1.0f + mfCurrentFrame;
} else {
if (mbInAnimation && mpAnimObserver) {
mpAnimObserver->onAnmEvent(AnimObserver::AE_1, mpData);
}
mbInAnimation = false;
}
}
}
inline f32 textinput::util::Animation::getValue() {
return hermiteInterporation(mfCurrentFrame, 0.0f, mfStartPoint, 0.0f, mfAnimationTime, mfEndPoint, 0.0f);
}
inline bool textinput::util::Animation::isActive() {
return mbInAnimation;
}
inline void textinput::util::Animation::setSEFlag(bool flag) {
mbSE = flag;
}
inline bool textinput::util::Animation::isSEFlag() {
return mbSE;
}
inline void textinput::util::Animation::stop() {
mbInAnimation = false;
}

File diff suppressed because it is too large Load Diff

View File

@@ -149,6 +149,9 @@ public:
}
void append(wchar_t ch) {
if (ch == L'\n') {
mCount = 0;
}
mpOutput[mCount++] = ch;
}
@@ -159,7 +162,7 @@ public:
private:
wchar_t* mpOutput;
u32 mCount;
u16 mCount;
};
}
@@ -172,10 +175,7 @@ void Decolated::inputChar(wchar_t ch) {
input[1] = 0;
input[0] = 0;
u16 count;
if (static_cast<u32>(mTranslateMode) - 1 > 1) {
goto nonKana;
}
{
if (mTranslateMode == TM_Kana || mTranslateMode == TM_Roman) {
mKanaStream.mOutput[4] = 0;
mKanaStream.mOutput[3] = 0;
mKanaStream.mOutput[2] = 0;
@@ -191,10 +191,7 @@ void Decolated::inputChar(wchar_t ch) {
input[static_cast<u8>(inputIndex)] = KPRGetChar(&mKanaStream.mQueue);
}
KPRLookAhead(&mKanaStream.mQueue, mKanaStream.mOutput, 5);
goto inputReady;
}
nonKana:
if (mTranslateMode == 3) {
} else if (mTranslateMode == TM_Hangul) {
CharacterOutput output(input);
output.append(ch);
count = output.finish();
@@ -204,7 +201,6 @@ nonKana:
input[0] = ch;
input[1] = 0;
}
inputReady:
setCandidate(0);
u32 start;
u32 end;

File diff suppressed because it is too large Load Diff

View File

@@ -9,7 +9,6 @@
extern char scPaneName_B_Stop[7];
extern char scPaneName_T_Stop[];
extern "C" BOOL push_button_queue(void*, const void*);
namespace ipl {
namespace scene {
@@ -828,7 +827,7 @@ namespace ipl {
Command command;
command.type = Command::TYPE_ANIM;
command.animId = animId;
push_button_queue(&mReservedCmd, &command);
mReservedCmd.push(command);
}
void Button::reserveText(int paneId, u32 msgId) {
@@ -836,7 +835,7 @@ namespace ipl {
command.type = Command::TYPE_TEXT;
command.paneId = paneId;
command.msgId = msgId;
push_button_queue(&mReservedCmd, &command);
mReservedCmd.push(command);
}
/* ============== */
@@ -968,22 +967,6 @@ namespace ipl {
void OptOutButtonEventHandlerBase::onEventDerived(u32 compId, u32 event, const controller::Interface* con) {
}
extern "C" BOOL push_button_queue(void* storage, const void* item) {
typedef utility::Queue<Button::Command, 8> CommandQueue;
CommandQueue* queue = static_cast<CommandQueue*>(storage);
const Button::Command* command = static_cast<const Button::Command*>(item);
if (queue->count == queue->current) {
return FALSE;
}
queue->items[queue->pushed] = *command;
if (++queue->pushed >= queue->count) {
queue->pushed = 0;
}
queue->current++;
return TRUE;
}
} // namespace scene
} // namespace ipl

View File

@@ -398,200 +398,203 @@ extern "C" void clearAllCardFileEntries(s32 slot);
extern "C" s32 loadCardFileIcons(s32 slot, s32 fileNo, CARDDir* dir);
extern "C" void runCardMoveOrCopy(u8 slot, s16 fileNo, s32 command);
static inline void sendValidityResponse(u32 command, u32 valid) {
union {
u32 value;
struct { u32 upper : 16; u32 valid : 8; u32 command : 8; } fields;
} reply;
reply.value = command;
reply.fields.valid = valid;
OSSendMessage(&sThread->responses, (OSMessage)reply.value, OS_MESSAGE_BLOCK);
static inline u8 getCardCommandSlot(u32 message) {
u8 slot = message >> 16;
slot &= 1;
return slot;
}
extern "C" void* cardThreadMain(void*) {
struct CardThreadLocals {
u8 compareName[6];
u32 message;
CARDDir freeDir;
CARDDir mountDir;
CARDDir listingDir;
char fileName[33];
} local;
BOOL brokenFile;
BOOL exitThread = FALSE;
u32 validState = TRUE;
u32 command;
s16 fileNo;
u8 slot;
static inline s32 countCardTitleBlocks(s32 slot, CARDDir* dir) {
s32 fileNo;
s32 result;
s32 blocks;
blocks = 0;
for (fileNo = 0; fileNo < CARD_MAX_FILE; ++fileNo) {
result = __CARDGetStatusEx(slot, fileNo, dir);
if (result < CARD_RESULT_READY && result != CARD_RESULT_NOFILE) {
blocks = -1;
break;
}
if (result == CARD_RESULT_READY &&
memcmp(dir->gameName, (void*)0x80000000, 4) == 0 &&
memcmp(dir->company, (void*)0x80000004, 2) == 0) {
blocks += dir->length;
}
}
return blocks;
}
static inline void listCardFiles(u8 slot, CARDDir& dir, char* fileName) {
u32 fileNo;
for (fileNo = 0; fileNo < CARD_MAX_FILE; ++fileNo) {
if (__CARDGetStatusEx(slot, (u16)fileNo, &dir) == CARD_RESULT_READY) {
memcpy(fileName, dir.fileName, CARD_FILENAME_MAX);
fileName[CARD_FILENAME_MAX] = 0;
OSReport("%d - %s: %d blocks\n", (u16)fileNo, fileName, dir.length);
}
}
}
static inline void deleteCardFile(u8 slot, s16 fileNo) {
s32 result = CARDFastDelete(slot, fileNo);
if (result < CARD_RESULT_READY) {
reportCardThreadError(slot, 4, result);
} else {
clearCardFileEntry(slot, fileNo);
refreshCardSlotInfo(slot);
sendCardSlotState(slot, 4, (u8)fileNo);
}
}
static inline void formatCardSlot(u8 slot) {
s32 result = CARDFormat(slot);
if (result < CARD_RESULT_READY) {
reportCardThreadError(slot, 1, result);
} else {
sThread->mounted[slot] = 1;
refreshCardSlotInfo(slot);
sendCardSlotState(slot, 1, 0);
}
}
static inline void mountCardSlot(u8 slot, CARDDir& mountDir, CARDDir& listingDir, char* fileName) {
s32 result;
s32 file;
u32 listingFile;
BOOL brokenFile;
result = CARDMount(slot, sThread->mountBuffers[slot], 0);
if (result < CARD_RESULT_READY) {
result = handleCardMountResult(slot, result);
if (result != CARD_RESULT_READY) {
goto scanFiles;
}
return;
}
result = CARDCheck(slot);
if (result < CARD_RESULT_READY) {
goto mountError;
}
scanFiles:
clearAllCardFileEntries(slot);
for (file = 0; file < CARD_MAX_FILE; ++file) {
result = __CARDGetStatusEx(slot, (s16)file, &mountDir);
if (result < CARD_RESULT_READY) {
result = handleCardMountResult(slot, result);
if (result != CARD_RESULT_READY) {
continue;
}
return;
} else {
u8 company[2];
u8 gameName[4];
company[0] = 0;
company[1] = 0;
gameName[0] = 0;
gameName[1] = 0;
gameName[2] = 0;
gameName[3] = 0;
if (strncmp((const char*)mountDir.fileName, "Broken File", 0xB) == 0 &&
memcmp(mountDir.gameName, gameName, 4) == 0 &&
memcmp(mountDir.company, company, 2) == 0) {
brokenFile = TRUE;
} else {
brokenFile = FALSE;
}
if (brokenFile) {
result = CARDFastDelete(slot, (s16)file);
if (result < CARD_RESULT_READY) {
goto mountError;
}
} else {
result = loadCardFileIcons(slot, (s16)file, &mountDir);
if (result < CARD_RESULT_READY) {
goto mountError;
}
}
}
}
refreshCardSlotInfo(slot);
sThread->mounted[slot] = 1;
sendCardSlotState(slot, 0, 0);
OSReport("Slot %c\n", sCardSlotName[slot]);
listCardFiles(slot, listingDir, fileName);
return;
mountError:
OSReport("MountError\n");
reportCardThreadError(slot, 0, result);
}
#pragma push
#pragma opt_propagation off
extern "C" void* cardThreadMain(void*) {
char fileName[33];
CARDDir listingDir;
CARDDir mountDir;
CARDDir freeDir;
u32 message;
s32 outerSlot;
s32 freeFile;
s32 freeBlocks;
u32 command;
u8 validState = TRUE;
BOOL exitThread = FALSE;
sThread->mounted[0] = 0;
sThread->mounted[1] = 0;
goto loopCheck;
loopStart:
OSReceiveMessage(&sThread->requests, (OSMessage*)&local.message, OS_MESSAGE_BLOCK);
OSReport("CARD THREAD: Message received %d\n", (s8)(u8)local.message);
while (!exitThread) {
OSReceiveMessage(&sThread->requests, (OSMessage*)&message, OS_MESSAGE_BLOCK);
OSReport("CARD THREAD: Message received %d\n", (s8)(u8)message);
if (validState != TRUE) {
goto loopCheck;
continue;
}
command = local.message & 0xFF;
command = message & 0xFF;
switch ((s8)command) {
case 10:
validState = TRUE;
OSReport("card thread valid state changed:%d\n", 1);
sendValidityResponse(command, validState);
OSSendMessage(&sThread->responses, (OSMessage)((validState << 8) | (u8)command), OS_MESSAGE_BLOCK);
break;
case 11:
exitThread = TRUE;
break;
case 0: {
slot = (local.message >> 16) & 1;
command = (local.message >> 14) & 4;
result = CARDMount(slot, sThread->mountBuffers[command / 4], 0);
if (result < CARD_RESULT_READY) {
result = handleCardMountResult(slot, result);
if (result != CARD_RESULT_READY) {
goto mountContinue;
}
break;
}
result = CARDCheck(slot);
if (result < CARD_RESULT_READY) {
goto mountError;
}
mountContinue:
clearAllCardFileEntries(slot);
for (file = 0; file < CARD_MAX_FILE; ++file) {
result = __CARDGetStatusEx(slot, (s16)file, &local.mountDir);
if (result < CARD_RESULT_READY) {
result = handleCardMountResult(slot, result);
if (result != CARD_RESULT_READY) {
continue;
}
goto loopCheck;
} else {
local.compareName[0] = 0;
local.compareName[1] = 0;
local.compareName[2] = 0;
local.compareName[3] = 0;
local.compareName[4] = 0;
local.compareName[5] = 0;
if (strncmp((const char*)local.mountDir.fileName, "Broken File", 0xB) == 0 &&
memcmp(local.mountDir.gameName, local.compareName + 2, 4) == 0 &&
memcmp(local.mountDir.company, local.compareName, 2) == 0) {
brokenFile = TRUE;
} else {
brokenFile = FALSE;
}
if (brokenFile) {
result = CARDFastDelete(slot, (s16)file);
if (result < CARD_RESULT_READY) {
goto mountError;
}
} else {
result = loadCardFileIcons(slot, (s16)file, &local.mountDir);
if (result < CARD_RESULT_READY) {
goto mountError;
}
}
}
}
refreshCardSlotInfo(slot);
sThread->mounted[command / 4] = 1;
sendCardSlotState(slot, 0, 0);
OSReport("Slot %c\n", sCardSlotName[slot]);
for (listingFile = 0; listingFile < CARD_MAX_FILE; ++listingFile) {
if (__CARDGetStatusEx(slot, (u16)listingFile, &local.listingDir) == CARD_RESULT_READY) {
memcpy(local.fileName, local.listingDir.fileName, CARD_FILENAME_MAX);
local.fileName[CARD_FILENAME_MAX] = 0;
OSReport("%d - %s: %d blocks\n", (u16)listingFile, local.fileName,
local.listingDir.length);
}
}
case 0:
mountCardSlot(getCardCommandSlot(message), mountDir, listingDir, fileName);
break;
mountError:
OSReport("MountError\n");
reportCardThreadError(slot, 0, result);
break;
}
case 9:
reportCardThreadError((local.message >> 16) & 1, 9, CARD_RESULT_NOCARD);
reportCardThreadError(getCardCommandSlot(message), 9, CARD_RESULT_NOCARD);
break;
case 1: {
slot = (local.message >> 16) & 1;
result = CARDFormat(slot);
if (result < CARD_RESULT_READY) {
reportCardThreadError(slot, 1, result);
} else {
sThread->mounted[slot] = 1;
refreshCardSlotInfo(slot);
sendCardSlotState(slot, 1, 0);
}
case 1:
formatCardSlot(getCardCommandSlot(message));
break;
}
case 2:
runCardMoveOrCopy((local.message >> 16) & 1,
(s16)(u8)(local.message >> 24), (s8)command);
runCardMoveOrCopy(getCardCommandSlot(message), (s16)(u8)(message >> 24), (s8)command);
break;
case 3:
runCardMoveOrCopy((local.message >> 16) & 1,
(s16)(u8)(local.message >> 24), (s8)command);
runCardMoveOrCopy(getCardCommandSlot(message), (s16)(u8)(message >> 24), (s8)command);
break;
case 4: {
slot = (local.message >> 16) & 1;
fileNo = (s16)(local.message >> 24);
result = CARDFastDelete(slot, fileNo);
if (result < CARD_RESULT_READY) {
reportCardThreadError(slot, 4, result);
} else {
clearCardFileEntry(slot, fileNo);
refreshCardSlotInfo(slot);
sendCardSlotState(slot, 4, (u8)fileNo);
}
case 4:
deleteCardFile(getCardCommandSlot(message), (s16)(message >> 24));
break;
}
case 12:
outerSlot = 0;
do {
if (sThread->mounted[outerSlot] != 0) {
freeBlocks = 0;
for (freeFile = 0; freeFile < CARD_MAX_FILE; ++freeFile) {
result = __CARDGetStatusEx(outerSlot, freeFile, &local.freeDir);
if (result < CARD_RESULT_READY && result != CARD_RESULT_NOFILE) {
freeBlocks = -1;
break;
}
if (result == CARD_RESULT_READY &&
memcmp(local.freeDir.gameName, (void*)0x80000000, 4) == 0 &&
memcmp(local.freeDir.company, (void*)0x80000004, 2) == 0) {
freeBlocks += local.freeDir.length;
}
}
freeBlocks = countCardTitleBlocks(outerSlot, &freeDir);
sThread->slots[outerSlot].unk_0x12 = freeBlocks;
}
++outerSlot;
} while (outerSlot < 2);
sendCardSlotState(0, 0xC, 0);
break;
default:
break;
}
loopCheck:
if (!exitThread) {
goto loopStart;
}
return 0;
}
#pragma pop
extern "C" s32 checkCardFileDuplicate(s32 slot, s16 fileNo);
@@ -691,25 +694,82 @@ extern "C" void clearAllCardFileEntries(s32 slot) {
} while (file < CARD_MAX_FILE);
}
extern "C" s32 loadCardFileIcons(s32 slot, s32 fileNo, CARDDir* dir) {
struct CardSequenceFileData {
s32 commentSectorSize;
s32 sectorSize;
CARDFileInfo fileInfo;
} local;
s32 iconAddressOffset;
u32 iconAddressBase;
s32 result;
result = CARDFastOpen(slot, fileNo, &local.fileInfo);
if (result < CARD_RESULT_READY) {
return result;
static inline s32 readCardImages(s32 slot, s32 fileNo, CARDDir* dir, CARDFileInfo* fileInfo,
u32 address, s32 offset, s32 imageSize, u32 transferSize) {
s32 sectorSize;
if (CARDGetSectorSize(slot, (u32*)&sectorSize) < CARD_RESULT_READY) {
sThread->icons[slot][fileNo].bannerEnable = 0;
sThread->icons[slot][fileNo].unk_0x01 = 0;
return 0;
}
u32 fileSize = (u32)dir->length * sectorSize;
if (address > fileSize) {
sThread->icons[slot][fileNo].bannerEnable = 0;
sThread->icons[slot][fileNo].unk_0x01 = 0;
return 0;
}
if (address + transferSize > fileSize) {
sThread->icons[slot][fileNo].bannerEnable = 0;
sThread->icons[slot][fileNo].unk_0x01 = 0;
return 0;
}
if (imageSize > 0) {
s32 result = CARDRead(fileInfo, sThread->imageReadBuffer, transferSize, address);
if (result < CARD_RESULT_READY) {
return result;
}
memcpy(sThread->images[slot][fileNo], sThread->imageReadBuffer + offset, imageSize);
DCStoreRange(sThread->images[slot][fileNo], transferSize);
}
return 0;
}
static inline s32 readCardComment(s32 slot, s32 fileNo, CARDDir* dir, CARDFileInfo* fileInfo) {
u32 address;
s32 result;
u32 base;
s32 readSize;
u32 end;
u32 fileSize;
s32 offset;
s32 sectorSize;
address = dir->commentAddr;
base = address & 0xFFFFFE00;
offset = address - base;
readSize = ((address + 0x23F) & 0xFFFFFE00) - base;
result = CARDGetSectorSize(slot, (u32*)&sectorSize);
if (result >= CARD_RESULT_READY) {
if ((s32)base < 0 || base > (fileSize = (u32)dir->length * sectorSize)) {
result = 0;
} else {
end = base + readSize;
if ((s32)end < 0 || end > fileSize) {
result = 0;
} else {
result = CARDRead(fileInfo, sThread->commentBuffer, readSize, base);
if (result >= CARD_RESULT_READY) {
memset(sThread->comments[slot][fileNo], 0, CARD_COMMENT_SIZE);
memcpy(sThread->comments[slot][fileNo], sThread->commentBuffer + offset,
CARD_COMMENT_SIZE);
return 0;
}
}
}
}
memset(sThread->comments[slot][fileNo], 0, CARD_COMMENT_SIZE);
return result;
}
static inline s32 loadCardIconImages(s32 slot, s32 fileNo, CARDDir* dir, CARDFileInfo* fileInfo) {
s32 imageSize;
s32 bannerImageSize = 0;
u8 format = dir->bannerFormat & CARD_STAT_BANNER_MASK;
u32 iconAddress = dir->iconAddr;
iconAddressBase = iconAddress & 0xFFFFFE00;
iconAddressOffset = iconAddress - iconAddressBase;
u32 transferSize;
s32 iconAddressOffset = iconAddress - (iconAddress & 0xFFFFFE00);
switch (format) {
case CARD_STAT_BANNER_C8: {
@@ -746,43 +806,41 @@ extern "C" s32 loadCardFileIcons(s32 slot, s32 fileNo, CARDDir* dir) {
}
}
s32 shift = 0;
s32 iconImageSize = 0;
s32 iconCount = 0;
s32 iconImageSize;
s32 paletteSize;
s32 icon;
BOOL hasTlut;
s32 iconCount;
s32 shift;
shift = 0;
hasTlut = FALSE;
iconImageSize = 0;
sThread->icons[slot][fileNo].unk_0x02 = 0;
sThread->icons[slot][fileNo].anmMax = 0;
sThread->icons[slot][fileNo].anmFrameBits = dir->iconSpeed;
sThread->icons[slot][fileNo].unk_0x06 =
(dir->iconSpeed & CARD_STAT_SPEED_MASK) << 2;
for (icon = 0; icon < CARD_ICON_MAX; ++icon) {
sThread->icons[slot][fileNo].unk_0x06 = (dir->iconSpeed & CARD_STAT_SPEED_MASK) << 2;
for (iconCount = icon = 0; icon < CARD_ICON_MAX; ++icon) {
s32 iconSpeed = (dir->iconSpeed >> shift) & CARD_STAT_SPEED_MASK;
if (iconSpeed != 0) {
sThread->icons[slot][fileNo].anmMax =
sThread->icons[slot][fileNo].anmMax + (iconSpeed << 2);
sThread->icons[slot][fileNo].anmMax += iconSpeed << 2;
} else {
sThread->icons[slot][fileNo].unk_0x07 =
(u8)(((dir->iconSpeed >> ((iconCount - 1) * 2)) << 2) & 0xC);
goto iconSpeedDone;
goto animationDone;
}
iconCount = iconCount + 1;
shift = shift + 2;
}
sThread->icons[slot][fileNo].unk_0x07 =
(dir->iconSpeed >> 0xC) & 0xC;
iconSpeedDone:
sThread->icons[slot][fileNo].unk_0x07 = (dir->iconSpeed >> 0xC) & 0xC;
animationDone:
if ((dir->iconSpeed & CARD_STAT_SPEED_MASK) == 0 || (dir->iconFormat & CARD_STAT_ICON_MASK) == 0) {
iconImageSize = 0;
sThread->icons[slot][fileNo].unk_0x01 = 0;
iconImageSize = 0;
} else {
BOOL hasTlut = FALSE;
iconCount = 0;
shift = 0;
for (icon = 0; icon < CARD_ICON_MAX; ++icon) {
if (((dir->iconSpeed >> shift) & CARD_STAT_SPEED_MASK) != 0) {
s32 iconFormat = (dir->iconFormat >> shift) & CARD_STAT_ICON_MASK;
s32 paletteSize;
for (iconCount = 0; iconCount < CARD_ICON_MAX; ++iconCount) {
if (((dir->iconSpeed >> (iconCount * 2)) & CARD_STAT_SPEED_MASK) != 0) {
s32 iconFormat = (dir->iconFormat >> (iconCount * 2)) & CARD_STAT_ICON_MASK;
switch (iconFormat) {
case CARD_STAT_ICON_C8:
paletteSize = 0x400;
@@ -795,17 +853,15 @@ iconSpeedDone:
break;
case CARD_STAT_ICON_NONE: {
paletteSize = 0;
u8* iconPalette =
&sThread->icons[slot][fileNo].iconFmt[iconCount];
*iconPalette = iconPalette[-1];
u8* previous = &sThread->icons[slot][fileNo].iconFmt[iconCount - 1];
sThread->icons[slot][fileNo].iconFmt[iconCount] = *previous;
break;
}
default:
paletteSize = 0;
break;
}
if (iconCount < 7) {
sThread->icons[slot][fileNo].iconOffset[iconCount + 1] =
sThread->icons[slot][fileNo].iconOffset[(u32)(iconCount + 1)] =
paletteSize + sThread->icons[slot][fileNo].iconOffset[iconCount];
} else {
sThread->icons[slot][fileNo].iconTlutOffset =
@@ -819,8 +875,6 @@ iconSpeedDone:
sThread->icons[slot][fileNo].iconOffset[iconCount];
break;
}
++iconCount;
shift += 2;
}
if (hasTlut) {
iconImageSize += 0x200;
@@ -830,85 +884,30 @@ iconSpeedDone:
sThread->icons[slot][fileNo].anmDelta = 1;
}
s32 totalImageSize = iconImageSize + bannerImageSize;
u32 transferSize = (totalImageSize + iconAddressOffset + 0x1FF) & 0xFFFFFE00;
result = CARDGetSectorSize(slot, (u32*)&local.sectorSize);
imageSize = bannerImageSize + iconImageSize;
transferSize = (imageSize + iconAddressOffset + 0x1FF) & 0xFFFFFE00;
return readCardImages(slot, fileNo, dir, fileInfo, iconAddress & 0xFFFFFE00, iconAddressOffset,
imageSize, transferSize);
}
extern "C" s32 loadCardFileIcons(s32 slot, s32 fileNo, CARDDir* dir) {
CARDFileInfo fileInfo;
s32 result = CARDFastOpen(slot, fileNo, &fileInfo);
if (result < CARD_RESULT_READY) {
result = 0;
sThread->icons[slot][fileNo].bannerEnable = 0;
sThread->icons[slot][fileNo].unk_0x01 = 0;
} else {
u32 fileSize = (u32)dir->length * local.sectorSize;
if (iconAddressBase > fileSize) {
result = 0;
sThread->icons[slot][fileNo].bannerEnable = 0;
sThread->icons[slot][fileNo].unk_0x01 = 0;
} else if (iconAddressBase + transferSize > fileSize) {
result = 0;
sThread->icons[slot][fileNo].bannerEnable = 0;
sThread->icons[slot][fileNo].unk_0x01 = 0;
} else if (totalImageSize > 0) {
result = CARDRead(&local.fileInfo, sThread->imageReadBuffer,
transferSize, iconAddressBase);
if (result < CARD_RESULT_READY) {
goto closeFile;
}
memcpy(sThread->images[slot][fileNo],
sThread->imageReadBuffer + iconAddressOffset,
totalImageSize);
DCStoreRange(sThread->images[slot][fileNo], transferSize);
result = 0;
}
return result;
}
result = loadCardIconImages(slot, fileNo, dir, &fileInfo);
if (result < CARD_RESULT_READY) {
goto closeFile;
return result;
}
iconAddress = dir->commentAddr;
iconAddressBase = iconAddress & 0xFFFFFE00;
s32 commentDataOffset = iconAddress - iconAddressBase;
s32 imageSize = ((iconAddress + 0x23F) & 0xFFFFFE00) - iconAddressBase;
result = CARDGetSectorSize(slot, (u32*)&local.commentSectorSize);
result = readCardComment(slot, fileNo, dir, &fileInfo);
if (result < CARD_RESULT_READY) {
goto clearComment;
}
{
u32 fileSize;
if ((s32)iconAddressBase < 0 ||
iconAddressBase > (fileSize = (u32)dir->length * local.commentSectorSize)) {
result = 0;
} else {
u32 endOffset = iconAddressBase + imageSize;
if ((s32)endOffset < 0 || endOffset > fileSize) {
result = 0;
goto clearComment;
}
result = CARDRead(&local.fileInfo, sThread->commentBuffer, imageSize,
iconAddressBase);
if (result < CARD_RESULT_READY) {
goto clearComment;
}
memset(sThread->comments[slot][fileNo], 0, CARD_COMMENT_SIZE);
memcpy(sThread->comments[slot][fileNo],
sThread->commentBuffer + commentDataOffset, CARD_COMMENT_SIZE);
result = 0;
goto commentDone;
}
return result;
}
clearComment:
memset(sThread->comments[slot][fileNo], 0, CARD_COMMENT_SIZE);
commentDone:
if (result >= CARD_RESULT_READY) {
goto closeFileSuccess;
}
closeFile:
return result;
closeFileSuccess:
result = CARDClose(&local.fileInfo);
result = CARDClose(&fileInfo);
if (result < CARD_RESULT_READY) {
return result;
}

View File

@@ -3,9 +3,6 @@
#include "titledb.h"
// actually needed to match.
#pragma sym on
namespace ipl {
namespace scene {
#define COMMAND_FN(FUNCTION_HEADER, TAG, APP_BOX, SAVE_BOX, WII_TITLE_ID, SD_TITLE_ID) \

View File

@@ -87,11 +87,9 @@ namespace ipl {
mNwc24ErrCountdown2 = 0;
// Text balloon for Mii face
f32 f0 = 30.0f;
f32 f1 = 120.0f;
mpNigaoeBalloon =
new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt",
math::VEC3(0.0f, (f1 = 120.0f, 0.0f), (f0 = 30.0f, 0.0f)), f1, f0);
new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f),
TextBalloon::getDefaultMargin16x9(), TextBalloon::getDefaultMargin4x3());
// Scroller
mpScroller = new utility::YoungBScroller();
@@ -196,7 +194,8 @@ namespace ipl {
mpCaptionString->clear();
mpCaptionString->set(System::getMessage(MESG_LETTERWRITER_LETTER_HEADER));
wchar_t* namePlaceholder = wcsstr(mpCaptionString->getWCString(), L"xxxxxxxxxx");
wchar_t* caption = mpCaptionString->getWCString();
wchar_t* namePlaceholder = wcsstr(caption, L"xxxxxxxxxx");
mpCaptionString->replace((namePlaceholder - mpCaptionString->getWCString()), RFL_NAME_LENGTH, headerCaption);
return mpCaptionString->getWCString();

View File

@@ -341,7 +341,7 @@ void MemoryCardManager::update_change_cardstate(u8 slot) {
}
}
GXTexObj* MemoryCardManager::create_icon(u8 slot, s16 index) {
const GXTexObj* MemoryCardManager::create_icon(u8 slot, s16 index) {
memorycard::IconState (*icons)[CARD_MAX_FILE] = reinterpret_cast<memorycard::IconState(*)[CARD_MAX_FILE]>(memorycard::getIconStateArray());
int total = 0;
s16 frame = 0;
@@ -355,26 +355,24 @@ GXTexObj* MemoryCardManager::create_icon(u8 slot, s16 index) {
return _create_icon(slot, file, frame - 1);
}
GXTexObj* MemoryCardManager::create_icon(u8 slot, s16 index, long start) {
const GXTexObj* MemoryCardManager::create_icon(u8 slot, s16 index, long start) {
memorycard::getIconStateArray();
u32 file = mFile[slot][index].fileNo;
return _create_icon(slot, file, 0);
}
GXTexObj* MemoryCardManager::_create_icon(u8 slot, s16 file, long start) {
const GXTexObj* MemoryCardManager::_create_icon(u8 slot, s16 file, long start) {
CardDirectory* dirs = reinterpret_cast<CardDirectory*>(memorycard::getCardDirState());
if (dirs[slot][file].fileNo == 0) {
return NULL;
}
CardIcons* icons = reinterpret_cast<CardIcons*>(memorycard::getIconStateArray());
memorycard::IconState* icon = &icons[slot][file];
if ((int)icon->iconFmt[start] == GX_TF_RGB5A3) {
GXInitTexObj(&mFileCell[slot][file].icon, reinterpret_cast<u8*>(icon) + icon->iconOffset[start], CARD_ICON_WIDTH, CARD_ICON_HEIGHT, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE);
GXLoadTexObj(&mFileCell[slot][file].icon, GX_TEXMAP0);
} else if ((int)icon->iconFmt[start] == GX_TF_C8) {
GXInitTexObjCI(&mFileCell[slot][file].icon, reinterpret_cast<u8*>(icon) + icon->iconOffset[start], CARD_ICON_WIDTH, CARD_ICON_HEIGHT, GX_TF_C8, GX_CLAMP, GX_CLAMP, GX_FALSE, GX_TLUT0);
GXInitTlutObj(&mFileCell[slot][file].iconTlut, reinterpret_cast<u8*>(icon) + icons[slot][file].iconTlutOffset, GX_TL_RGB5A3, 0x100);
GXLoadTlut(&mFileCell[slot][file].iconTlut, GX_TLUT0);
if ((int)icons[slot][file].iconFmt[start] == GX_TF_RGB5A3) {
GXLoadTexObj(initIconTexture(slot, file, reinterpret_cast<u8*>(&icons[slot][file]) + icons[slot][file].iconOffset[start]), GX_TEXMAP0);
} else if ((int)icons[slot][file].iconFmt[start] == GX_TF_C8) {
initIconTextureCI(slot, file, reinterpret_cast<u8*>(&icons[slot][file]) + icons[slot][file].iconOffset[start]);
GXTlutObj* tlut = initIconPalette(slot, file, reinterpret_cast<u8*>(&icons[slot][file]) + icons[slot][file].iconTlutOffset);
GXLoadTlut(tlut, GX_TLUT0);
GXLoadTexObj(&mFileCell[slot][file].icon, GX_TEXMAP0);
} else {
return NULL;
@@ -424,7 +422,7 @@ const wchar_t* MemoryCardManager::getComment(u8 slot, s16 index, int which) {
return mFileCell[slot][file].comment[which];
}
GXTexObj* MemoryCardManager::create_banner(u8 slot, s16 index) {
const GXTexObj* MemoryCardManager::create_banner(u8 slot, s16 index) {
CardDirectory* dirs = reinterpret_cast<CardDirectory*>(memorycard::getCardDirState());
CardIcons* icons = reinterpret_cast<CardIcons*>(memorycard::getIconStateArray());
u32 file = mFile[slot][index].fileNo;
@@ -432,7 +430,7 @@ GXTexObj* MemoryCardManager::create_banner(u8 slot, s16 index) {
return NULL;
}
if ((int)icons[slot][file].bannerType == GX_TF_RGB5A3) {
GXTexObj* banner = initBannerTexture(slot, file,
const GXTexObj* banner = initBannerTexture(slot, file,
reinterpret_cast<u8*>(&icons[slot][file]) + icons[slot][file].bannerOffset);
GXLoadTexObj(banner, GX_TEXMAP0);
} else if ((int)icons[slot][file].bannerType == GX_TF_C8) {

View File

@@ -7,13 +7,11 @@
#define IPL_SDMEMORY_SD_CHANNEL_SELECT_LAYOUT
#define IPL_SDMEMORY_COMPLETION_PCT_ACCESSOR
#define IPL_SDMEMORY_DIALOG_PROGRESS_FRAME_ACCESSOR
#define IPL_SDMEMORY_SET_TEXT_COLORS
#define IPL_SDMEMORY_SCROLLER_STATE_ACCESSOR
#include "system/iplDialogWindow.h"
#undef IPL_SDMEMORY_DIALOG_PROGRESS_FRAME_ACCESSOR
#include "scene/sdChannelMemory/iplSDMemory.h"
#include "scene/sdChannelSelect/iplSDChannelSelect.h"
#undef IPL_SDMEMORY_SET_TEXT_COLORS
#undef IPL_SDMEMORY_SCROLLER_STATE_ACCESSOR
#undef IPL_SDMEMORY_DIALOG_STATE_ACCESSOR
#undef IPL_SDMEMORY_SET_TRANSLATE_OUT_OF_LINE
@@ -28,34 +26,12 @@
#include "utility/iplLayout.h"
#include <revolution/os/OSTime.h>
extern "C" bool iplSDChannelSelect_813DDB74(ipl::scene::SDChannelSelect* channelSelect,
ipl::scene::SDMemory::TitleRange* nandTitles,
ipl::scene::SDMemory::TitleRange* sdTitles,
ESTitleId* titleIds, wchar_t* titleNames, u32* titleCount,
s32 state);
extern "C" bool iplSDChannelSelect_813DB5EC(ipl::scene::SDChannelSelect* channelSelect,
ESTitleId titleId);
extern "C" bool iplSDChannelSelect_813DB4D4(ipl::scene::SDChannelSelect* channelSelect,
ESTitleId titleId, u32 flags);
extern "C" bool iplSDChannelSelect_813DB530(ipl::scene::SDChannelSelect* channelSelect,
ESTitleId** titleNames, ESTitleId** secondaryTitles);
extern "C" bool iplSDChannelSelect_813DB478(ipl::scene::SDChannelSelect* channelSelect,
ESTitleId titleId);
extern "C" bool iplSDChannelSelect_813DB58C(ipl::scene::SDChannelSelect* channelSelect,
ESTitleId** titles, ESTitleId** secondaryTitles,
ESTitleId** names);
namespace ipl {
namespace scene {
typedef ::gui::Component GuiComponent;
typedef ::gui::PaneComponent GuiPaneComponent;
typedef controller::Interface ControllerInterface;
void writeFourFlagBytes(u8* flags, u8 first, u8 second, u8 third, u8 fourth);
void setTitleRowColors(nw4r::lyt::TextBox* textBox, const nw4r::ut::Color& first,
const nw4r::ut::Color& second) NO_INLINE;
static const char* sControlPaneNames[] = {
"A", "B", "B_BtnA",
};
@@ -68,6 +44,19 @@ namespace ipl {
SDMemory::~SDMemory() {}
static inline s32 countCachedTitles(const savedata::Manager* saveData) {
s32 count = 0;
for (s32 i = 0; i < 48; ++i) {
if (saveData->getTitleCacheEntry(i) == 0) {
break;
}
++count;
}
return count;
}
#pragma push
#pragma ppc_iro_level 1
void SDMemory::create(EGG::Heap* heap, nand::LayoutFile* layoutFile, SDChannelSelect* channelSelect) {
s32 cachedTitleCount;
const savedata::Manager* saveData;
@@ -151,13 +140,7 @@ namespace ipl {
textBox->SetString(System::getMessage(0xBA));
saveData = System::getSaveData();
cachedTitleCount = 0;
for (s32 i = 0; i < 48; ++i) {
if (saveData->getTitleCacheEntry(i) == 0) {
break;
}
++cachedTitleCount;
}
cachedTitleCount = countCachedTitles(saveData);
if (cachedTitleCount >= 5) {
mpTitleLayout->FindPaneByName("N_Btn_3")->SetVisible(false);
nw4r::lyt::Pane* expandedButton = mpTitleLayout->FindPaneByName("N_Btn_4");
@@ -253,6 +236,8 @@ namespace ipl {
mTransferFlags[0] = 1;
}
#pragma pop
void SDMemory::setTitleLists(const TitleRange& nandTitles, const TitleRange& sdTitles) {
mNandTitleRange = nandTitles;
mSDTitleRange = sdTitles;
@@ -723,8 +708,8 @@ namespace ipl {
if (!mpMainLayout->isPlaying(-1)) {
switch (mProcessState) {
case 0:
if (iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
mTitleIds, &mTitleNames[0][0], &mTitleCount, 2)) {
if (mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
mTitleIds, mTitleNames, &mTitleCount, 2)) {
mDialogState = 4;
mpTitleLayout->getAnim(0)->initAnmFrame();
mpTitleLayout->getAnim(0)->play();
@@ -807,8 +792,8 @@ namespace ipl {
if (System::getDialog()->getLastResult() != -1) {
if (mpSDChannelSelect->getWorker()->get_async_result() == NandSDWorker::RESULT_OK) {
mNandTitleCount = mTitleListState.mSecondaryCount;
mTitleNameCount = mTitleListState.mNameCount;
mNandTitleCount = mNandTitleList.count;
mTitleNameCount = mSDTitleList.count;
} else {
mNandTitleCount = 0;
mTitleNameCount = 0;
@@ -922,8 +907,7 @@ namespace ipl {
return;
}
if (iplSDChannelSelect_813DB530(mpSDChannelSelect, &mTitleListState.mpNames,
&mTitleListState.mpSecondaryTitles)) {
if (mpSDChannelSelect->enqueueErrorNotice(&mSDTitleList, &mNandTitleList)) {
mDialogState = 19;
mCurrentTitleName[0] = L'\0';
mCurrentTitle = 0;
@@ -996,7 +980,7 @@ namespace ipl {
if (iplSDMemory_containsTitleId(this, mTitleIds[mCurrentTitle], mSDTitleIds, mTitleNameCount) ||
iplSDMemory_containsTitleId(this, mTitleIds[mCurrentTitle], mNandTitleIds, mNandTitleCount)) {
ESTitleId titleId = mTitleIds[mCurrentTitle];
if (iplSDChannelSelect_813DB478(mpSDChannelSelect, titleId)) {
if (mpSDChannelSelect->enqueueMoveNotice(titleId)) {
mDialogState = 14;
} else {
System::getDialog()->terminate();
@@ -1046,7 +1030,7 @@ namespace ipl {
void SDMemory::onDialogState16() {
if (mTitleCount > mCurrentTitle && System::isReceiveScheduleStopped()) {
if (iplSDChannelSelect_813DB4D4(mpSDChannelSelect, mTitleIds[mCurrentTitle], 0)) {
if (mpSDChannelSelect->enqueueStateNotice(mTitleIds[mCurrentTitle], 0)) {
mDialogState = 16;
} else {
System::getDialog()->terminate();
@@ -1101,7 +1085,7 @@ namespace ipl {
System::getDialog()->setTitleForSDMemory(mCurrentTitleName);
const ESTitleId titleId = mTitleIds[mCurrentTitle];
if (iplSDChannelSelect_813DB5EC(mpSDChannelSelect, titleId)) {
if (mpSDChannelSelect->enqueueDeleteNotice(titleId)) {
mDialogState = 18;
} else {
System::getDialog()->terminate();
@@ -1261,19 +1245,41 @@ namespace ipl {
}
void SDMemory::drawTransferTitles() {
f32 rowY;
f32 rowTop;
f32 backgroundOffset;
f32 titleOffset;
f32 rowHeight;
f32 messageOffset;
f32 bodyHeight;
f32 bodyY;
u8 alpha;
nw4r::lyt::Pane* bodyPane;
nw4r::lyt::Pane* titleSizePane;
nw4r::lyt::TextBox* titleText;
nw4r::lyt::Pane* footerPane;
u32 nandTitleIndex;
u32 titleIndex;
wchar_t* messageForCount;
s32 lineCount;
wchar_t* messageLine;
nw4r::lyt::TextBox* messageText;
s32 lineIndex;
wchar_t* lineEnd;
u32 lineLength;
const nw4r::math::VEC3& translation = mpDialogLayout->FindPaneByName("N_Memo")->GetTranslate();
nw4r::math::VEC3 memoPosition;
memoPosition.x = translation.x;
memoPosition.y = translation.y;
memoPosition.z = translation.z;
f32 bodyY = memoPosition.y;
bodyY = memoPosition.y;
mpDialogLayout->FindPaneByName("header_header");
nw4r::lyt::Pane* bodyPane = mpDialogLayout->FindPaneByName("header_body");
bodyPane = mpDialogLayout->FindPaneByName("header_body");
if (bodyY < 500.0f) {
mpDialogLayout->draw("header_header");
}
u8 alpha = mpDialogLayout->FindPaneByName("N_Memo")->GetAlpha();
alpha = mpDialogLayout->FindPaneByName("N_Memo")->GetAlpha();
nw4r::ut::LinkList<nw4r::lyt::Pane, offsetof(nw4r::lyt::detail::PaneBase, mLink)>::Iterator child =
bodyPane->GetChildList().GetBeginIter();
while (child != bodyPane->GetChildList().GetEndIter()) {
@@ -1281,29 +1287,26 @@ namespace ipl {
++child;
}
f32 messageOffset = 0.0f;
f32 bodyHeight = bodyPane->GetSize().height;
messageOffset = 0.0f;
bodyHeight = bodyPane->GetSize().height;
if (mNandTitleCount != 0) {
const wchar_t* messageForCount = System::getMessage(0xCB);
s32 lineCount = 0;
const wchar_t* newline = wcsstr(messageForCount, L"\n");
messageForCount = System::getMessage(0xCB);
lineCount = 0;
wchar_t* newline = wcsstr(messageForCount, L"\n");
while (newline != NULL) {
++lineCount;
newline = wcsstr(newline + 1, L"\n");
}
const wchar_t* messageLine = System::getMessage(0xCB);
nw4r::lyt::TextBox* messageText = static_cast<nw4r::lyt::TextBox*>(
messageLine = System::getMessage(0xCB);
messageText = static_cast<nw4r::lyt::TextBox*>(
mpDialogLayout->FindPaneByName("T_Header_body"));
s32 totalLines = lineCount + 1;
s32 lineIndex = 0;
if (lineIndex < totalLines) {
do {
const wchar_t* lineEnd = wcsstr(messageLine, L"\n");
for (lineIndex = 0; lineIndex < lineCount + 1; ++lineIndex) {
lineEnd = wcsstr(messageLine, L"\n");
if (lineEnd == NULL) {
utility::layout::set_string(messageText, messageLine);
} else {
u32 lineLength = static_cast<u32>(lineEnd - messageLine);
lineLength = static_cast<u32>(lineEnd - messageLine);
wcsncpy(mCurrentTitleName, messageLine, lineLength);
mCurrentTitleName[lineLength] = L'\0';
utility::layout::set_string(messageText, mCurrentTitleName);
@@ -1318,52 +1321,42 @@ namespace ipl {
}
messageOffset -= bodyHeight;
++lineIndex;
} while (lineIndex < totalLines);
}
}
messageOffset += bodyHeight;
f32 backgroundOffset = 40.0f + messageOffset;
f32 titleOffset = 79.5f + messageOffset;
backgroundOffset = 40.0f + messageOffset;
titleOffset = 79.5f + messageOffset;
nw4r::lyt::Pane* titleSizePane = mpDialogLayout->FindPaneByName("N_Body");
f32 rowHeight = titleSizePane->GetSize().height;
nw4r::lyt::PaneList::Iterator titleChild = titleSizePane->GetChildList().GetBeginIter();
while (titleChild != titleSizePane->GetChildList().GetEndIter()) {
titleChild->SetAlpha(alpha);
++titleChild;
titleSizePane = mpDialogLayout->FindPaneByName("N_Body");
rowHeight = titleSizePane->GetSize().height;
nw4r::lyt::PaneList::Iterator bodyChild = titleSizePane->GetChildList().GetBeginIter();
while (bodyChild != titleSizePane->GetChildList().GetEndIter()) {
bodyChild->SetAlpha(alpha);
++bodyChild;
}
nw4r::lyt::TextBox* titleText = static_cast<nw4r::lyt::TextBox*>(
titleText = static_cast<nw4r::lyt::TextBox*>(
mpDialogLayout->FindPaneByName("T_Letter"));
titleText->SetAlpha(alpha);
u32 nandTitleIndex = 0;
for (u32 titleIndex = 0; titleIndex < mTitleCount; ++titleIndex) {
nandTitleIndex = 0;
for (titleIndex = 0; titleIndex < mTitleCount; ++titleIndex) {
utility::layout::set_string(titleText, mTitleNames[titleIndex]);
if (nandTitleIndex < mNandTitleCount && mTitleIds[titleIndex] == mNandTitleIds[nandTitleIndex]) {
GXColor gxActive;
writeFourFlagBytes(&gxActive.r, 0x34, 0xBE, 0xED, 0xFF);
++nandTitleIndex;
nw4r::ut::Color active0 = *reinterpret_cast<const nw4r::ut::Color*>(&gxActive);
setTitleRowColors(titleText,
nw4r::ut::Color(*reinterpret_cast<const nw4r::ut::Color*>(&gxActive)),
nw4r::ut::Color(*reinterpret_cast<const nw4r::ut::Color*>(&gxActive)));
nw4r::ut::Color color(0x34, 0xBE, 0xED, 0xFF);
titleText->SetTextColor(color, color);
} else {
GXColor gxInactive;
writeFourFlagBytes(&gxInactive.r, 0x64, 0x64, 0x64, 0xFF);
nw4r::ut::Color inactive0 = *reinterpret_cast<const nw4r::ut::Color*>(&gxInactive);
setTitleRowColors(titleText,
nw4r::ut::Color(*reinterpret_cast<const nw4r::ut::Color*>(&gxInactive)),
nw4r::ut::Color(*reinterpret_cast<const nw4r::ut::Color*>(&gxInactive)));
nw4r::ut::Color color(0x64, 0x64, 0x64, 0xFF);
titleText->SetTextColor(color, color);
}
nw4r::ut::Rect textRect = mpDialogLayout->getTextDrawRect("T_Letter");
f32 rowTop = textRect.bottom - textRect.top;
rowTop = textRect.bottom - textRect.top;
s32 visibleRows = static_cast<s32>(static_cast<f32>(ceil(-rowTop / titleSizePane->GetSize().height)));
for (s32 row = 0; row < visibleRows; ++row) {
f32 rowY = bodyY + backgroundOffset;
rowY = bodyY + backgroundOffset;
if (-500.0f < rowY && rowY < 500.0f) {
nw4r::math::VEC2 translation(0.0f, backgroundOffset);
titleSizePane->SetTranslate(translation);
@@ -1378,11 +1371,11 @@ namespace ipl {
titleText->CalculateMtx(*mpDialogLayout->getDrawInfo());
mpDialogLayout->draw(titleText);
}
titleOffset -= rowHeight * static_cast<f32>(visibleRows);
titleOffset -= visibleRows * rowHeight;
}
backgroundOffset += rowHeight;
nw4r::lyt::Pane* footerPane = mpDialogLayout->FindPaneByName("N_Footer");
footerPane = mpDialogLayout->FindPaneByName("N_Footer");
nw4r::lyt::PaneList::Iterator footerChild = footerPane->GetChildList().GetBeginIter();
while (footerChild != footerPane->GetChildList().GetEndIter()) {
footerChild->SetAlpha(alpha);
@@ -1401,18 +1394,6 @@ namespace ipl {
mpDialogLayout->draw("N_Move");
}
void writeFourFlagBytes(u8* flags, u8 first, u8 second, u8 third, u8 fourth) {
flags[0] = first;
flags[1] = second;
flags[2] = third;
flags[3] = fourth;
}
void setTitleRowColors(nw4r::lyt::TextBox* textBox, const nw4r::ut::Color& first,
const nw4r::ut::Color& second) NO_INLINE {
textBox->SetTextColors(first, second);
}
s32 SDMemory::getControlPaneIndex(const char* paneName) {
s32 paneIndex = -1;
for (s32 i = 0; i < 3; i++) {
@@ -1636,23 +1617,23 @@ namespace ipl {
switch (paneIndex) {
case 0:
animator = mpTitleLayout->getAnim(7);
iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
mTitleIds, &mTitleNames[0][0], &mTitleCount, 0);
mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
mTitleIds, mTitleNames, &mTitleCount, 0);
break;
case 1:
animator = mpTitleLayout->getAnim(10);
iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
mTitleIds, &mTitleNames[0][0], &mTitleCount, 1);
mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
mTitleIds, mTitleNames, &mTitleCount, 1);
break;
case 2:
animator = mpTitleLayout->getAnim(13);
iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
mTitleIds, &mTitleNames[0][0], &mTitleCount, 2);
mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
mTitleIds, mTitleNames, &mTitleCount, 2);
break;
case 3:
animator = mpTitleLayout->getAnim(16);
iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
mTitleIds, &mTitleNames[0][0], &mTitleCount, 3);
mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
mTitleIds, mTitleNames, &mTitleCount, 3);
break;
case 4:
animator = mpTitleLayout->getAnim(4);
@@ -1672,16 +1653,13 @@ namespace ipl {
memset(mSDTitleIds, 0, sizeof(mSDTitleIds));
mNandTitleCount = 0;
mTitleNameCount = 0;
mTitleListState.mpTitles = mTitleIds;
mTitleListState.mCount = mTitleCount;
mTitleListState.mpSecondaryTitles = mNandTitleIds;
mTitleListState.mSecondaryCount = 0;
mTitleListState.mpNames = mSDTitleIds;
mTitleListState.mNameCount = 0;
iplSDChannelSelect_813DB58C(mpSDChannelSelect,
&mTitleListState.mpTitles,
&mTitleListState.mpSecondaryTitles,
&mTitleListState.mpNames);
mTitleList.titleIds = mTitleIds;
mTitleList.count = mTitleCount;
mNandTitleList.titleIds = mNandTitleIds;
mNandTitleList.count = 0;
mSDTitleList.titleIds = mSDTitleIds;
mSDTitleList.count = 0;
mpSDChannelSelect->enqueueCommandNotice(&mTitleList, &mNandTitleList, &mSDTitleList);
}
if (paneIndex == 4) {

View File

@@ -352,7 +352,7 @@ namespace ipl {
return true;
}
bool SDChannelSelect::enqueueMoveNotice(u32 controller, u32 page, u32 index) {
bool SDChannelSelect::enqueueMoveNotice(ESTitleId titleId) {
if (mCurrentSDState != 6) {
return false;
}
@@ -361,7 +361,7 @@ namespace ipl {
command.type = 6;
command.arguments.values[0] = 0;
command.arguments.values[1] = 0;
command.titleId = ((u64)page << 32) | index;
command.titleId = titleId;
mCommandQueue.push(command);
return true;
}
@@ -380,36 +380,39 @@ namespace ipl {
return true;
}
bool SDChannelSelect::enqueueErrorNotice(u32 page, u32 index) {
bool SDChannelSelect::enqueueErrorNotice(NandSDWorker::TitleIdList* newTitles,
NandSDWorker::TitleIdList* replacingTitles) {
if (mCurrentSDState != 6) {
return false;
}
SDChannelSelectCommand command;
command.type = 11;
command.arguments.values[0] = page;
command.arguments.values[1] = index;
command.arguments.titleLists[0] = newTitles;
command.arguments.titleLists[1] = replacingTitles;
command.titleId = 0;
mCommandQueue.push(command);
return true;
}
bool SDChannelSelect::enqueueCommandNotice(u32 page, u32 index, u32 commandType) {
bool SDChannelSelect::enqueueCommandNotice(NandSDWorker::TitleIdList* titles,
NandSDWorker::TitleIdList* foundTitles,
NandSDWorker::TitleIdList* badTitles) {
if (mCurrentSDState != 6) {
return false;
}
SDChannelSelectCommand command;
command.arguments.values[0] = page;
command.arguments.titleLists[0] = titles;
command.type = 12;
command.arguments.values[1] = index;
command.arguments.values[2] = commandType;
command.arguments.titleLists[1] = foundTitles;
command.arguments.titleLists[2] = badTitles;
command.titleId = 0;
mCommandQueue.push(command);
return true;
}
bool SDChannelSelect::enqueueDeleteNotice(u32 controller, u32 page, u32 index) {
bool SDChannelSelect::enqueueDeleteNotice(ESTitleId titleId) {
if (mCurrentSDState != 6) {
return false;
}
@@ -419,7 +422,7 @@ namespace ipl {
command.arguments.values[0] = 0;
command.arguments.values[1] = 0;
command.arguments.values[2] = 0;
command.titleId = ((u64)page << 32) | index;
command.titleId = titleId;
mCommandQueue.push(command);
return true;
}
@@ -1326,7 +1329,7 @@ namespace ipl {
bool SDChannelSelect::collectTitlesByUsage(
s32* firstUsage, s32* secondUsage, ESTitleId* titleIds,
char* titleNames, u32* titleCount) {
wchar_t (*titleNames)[21], u32* titleCount) {
s32 bytes;
s32 blocks;
getCurrentTitleUsage(&bytes, &blocks);
@@ -1343,7 +1346,7 @@ namespace ipl {
titleIds[*titleCount] = mpNandTitleInfo[index].curTitleId;
wchar_t* titleName = System::getChannelManager()->getTitleName(
page, channelIndex, 0);
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
++*titleCount;
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
@@ -1361,7 +1364,7 @@ namespace ipl {
bool SDChannelSelect::collectTitlesFromNandUsage(
s32* firstUsage, s32* secondUsage,
ESTitleId* titleIds, char* titleNames, u32* titleCount) {
ESTitleId* titleIds, wchar_t (*titleNames)[21], u32* titleCount) {
s32 bytes;
s32 blocks;
getCurrentTitleUsage(&bytes, &blocks);
@@ -1384,7 +1387,7 @@ namespace ipl {
titleIds[*titleCount] = mpNandTitleInfo[index].curTitleId;
wchar_t* titleName = System::getChannelManager()->getTitleName(
page, channelIndex, 0);
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
++*titleCount;
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
@@ -1400,7 +1403,7 @@ namespace ipl {
bool SDChannelSelect::collectTitlesByChannelOrder(
s32* firstUsage, s32* secondUsage, ESTitleId* titleIds,
char* titleNames, u32* titleCount) {
wchar_t (*titleNames)[21], u32* titleCount) {
static const int channelOrder[MAX_CHANNEL_INDEX] = {
11, 7, 3, 10, 6, 2, 9, 5, 1, 8, 4, 0,
};
@@ -1427,7 +1430,7 @@ namespace ipl {
titleIds[*titleCount] = mpNandTitleInfo[usageIndex].curTitleId;
wchar_t* titleName =
System::getChannelManager()->getTitleName(page, channelOrder[order], 0);
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
++*titleCount;
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
@@ -1445,7 +1448,7 @@ namespace ipl {
bool SDChannelSelect::collectTitlesBySpecialChannels(
s32* firstUsage, s32* secondUsage, ESTitleId* titleIds,
char* titleNames, u32* titleCount) {
wchar_t (*titleNames)[21], u32* titleCount) {
s32 bytes;
s32 blocks;
getCurrentTitleUsage(&bytes, &blocks);
@@ -1502,7 +1505,7 @@ namespace ipl {
titleIds[*titleCount] = mpNandTitleInfo[usageIndex].curTitleId;
wchar_t* titleName = System::getChannelManager()->getTitleName(
page, channelIndex, 0);
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
++*titleCount;
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
@@ -1528,7 +1531,7 @@ namespace ipl {
titleIds[*titleCount] = mpNandTitleInfo[usageIndex].curTitleId;
wchar_t* titleName = System::getChannelManager()->getTitleName(
page, channelIndex, 0);
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
++*titleCount;
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
@@ -1544,7 +1547,7 @@ namespace ipl {
wchar_t* titleName =
System::getChannelManager()->getTitleName(
hadePage, hadeChannelIndex, 0);
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
++*titleCount;
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
@@ -1559,7 +1562,7 @@ namespace ipl {
wchar_t* titleName =
System::getChannelManager()->getTitleName(
hatePage, hateChannelIndex, 0);
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
++*titleCount;
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
@@ -1575,7 +1578,7 @@ namespace ipl {
bool SDChannelSelect::collectTitlesForMode(
s32* requiredBytes, s32* requiredBlocks,
ESTitleId* titleIds, char* titleNames, u32* titleCount, int searchMode) {
ESTitleId* titleIds, wchar_t (*titleNames)[21], u32* titleCount, int searchMode) {
switch (searchMode) {
case 0:
return collectTitlesBySpecialChannels(

View File

@@ -83,7 +83,6 @@ extern "C" void iplSDChannelTitle_setPageAndIndex(SDChannelTitle* scene, int pag
extern "C" void iplSDChannelTitle_cleanupAndLeave(SDChannelTitle* scene);
extern "C" void iplSDChannelTitle_confirmLeaveToSettings(SDChannelTitle* scene, bool settings);
extern "C" void iplSDChannelTitle_flushSaveBeforeExit(SDChannelTitle* scene, int nextScene);
extern "C" SDMemory::TitleRange* iplSDChannelTitle_copyTitleRange(SDMemory::TitleRange*, const SDMemory::TitleRange*);
static inline void setMemoryTitleLists(SDMemory* memory, SDMemory::TitleRange sdRange,
SDMemory::TitleRange nandRange) {
@@ -764,9 +763,9 @@ extern "C" void iplSDChannelTitle_updateCopyPrepare(SDChannelTitle* scene) {
if (static_cast<u32>(scene->mTitleRange.mByteSize) < 0x3800000) {
nandRange.mByteSize = 0x3800000;
nandRange.mCount = scene->mTitleRange.mCount;
iplSDChannelTitle_copyTitleRange(&sdRange, &scene->mTitleRange);
sdRange = scene->mTitleRange;
} else {
iplSDChannelTitle_copyTitleRange(&nandRange, iplSDChannelTitle_copyTitleRange(&sdRange, &scene->mTitleRange));
nandRange = sdRange = scene->mTitleRange;
}
SDMemory* memory = &scene->mMemory;
setMemoryTitleLists(memory, sdRange, nandRange);
@@ -788,14 +787,6 @@ extern "C" void iplSDChannelTitle_updateCopyPrepare(SDChannelTitle* scene) {
}
}
extern "C" SDMemory::TitleRange* iplSDChannelTitle_copyTitleRange(
SDMemory::TitleRange* target, const SDMemory::TitleRange* source) {
s32 bytes = source->mByteSize;
target->mCount = source->mCount;
target->mByteSize = bytes;
return target;
}
extern "C" void iplSDChannelTitle_updateMemoryCalc(SDChannelTitle* scene) {
if (!scene->mMemory.calc()) {
return;

File diff suppressed because it is too large Load Diff

View File

@@ -127,15 +127,23 @@ int AOSSi_EndLocal(void) {
}
int AOSSi_WLANGetBSSList(void** output) {
int index;
int driver;
void* buffer;
u8* scanBuffer;
WDBssDesc* descriptor;
int count;
struct AOSSAccessPointList* list;
int rate;
int rateCount;
int scanResult;
int result = -1;
int startupRetries = 0;
int scanRetries = 0;
int cleanupRetries = 0;
int unlockRetries = 0;
WDScanParam scan ATTRIBUTE_ALIGN(32);
WD_Info info ATTRIBUTE_ALIGN(32);
int unlockRetries = 0;
int driver;
u8* buffer;
int cleanupRetries = 0;
int scanRetries = 0;
u8 macAddress[6];
if (!allocateMemory || !releaseMemory) {
return -1;
@@ -159,6 +167,7 @@ startup:
buffer = AOSSi_Alloc(0x3200);
if (buffer) {
memset(buffer, 0, 0x3200);
scanBuffer = (u8*)buffer;
scan.channelBit = info.enableChannel;
scan.maxChannelTime = 40;
memset(scan.bssid, 255, 6);
@@ -167,15 +176,11 @@ startup:
memset(scan.ssid, 0, 32);
memset(scan.ssidMask, 255, 32);
while (1) {
int scanResult = WD_Scan(&scan, buffer, 0x3200);
int count;
struct AOSSAccessPointList* list;
WDBssDesc* descriptor;
int index;
scanResult = WD_Scan(&scan, scanBuffer, 0x3200);
if (scanResult != 0 && scanResult != WD_INTERNAL_ERR_4) {
break;
}
count = *(u16*)buffer;
count = *(u16*)scanBuffer;
if (count != 0) {
list = AOSSi_Alloc(sizeof(*list) + (count - 1) * sizeof(struct AOSSAccessPoint));
if (!list) {
@@ -183,10 +188,8 @@ startup:
break;
}
list->count = count;
descriptor = (WDBssDesc*)&buffer[2];
descriptor = (WDBssDesc*)&scanBuffer[2];
for (index = 0; index < count; ++index) {
int rate;
int rateCount;
list->accessPoints[index].ssidLength = descriptor->ssidLength;
memcpy(list->accessPoints[index].ssid, descriptor->ssid, 32);
list->accessPoints[index].channel = descriptor->channel;
@@ -287,20 +290,22 @@ int AOSSi_WLANConnect(struct AOSSConnection* connection, struct AOSSConnectionSt
interfaceConfig->netif.wireless.config.manual.ssidLength = (u8)connection->ssidLength;
memcpy(interfaceConfig->netif.wireless.config.manual.ssid, connection->ssid, connection->ssidLength);
result = 0;
ipConfig = &AOSSi_NcdIpConfig;
memset(ipConfig, 0, sizeof(*ipConfig));
ipConfig->adjust.maxTransferUnit = 1300;
ipConfig->adjust.tcpRetransTimeout = 100;
ipConfig->adjust.dhcpRetransCount = 4;
ipConfig->useDhcp = 0;
ipConfig->useProxy = 0;
memcpy(ipConfig->ip.addr, ipAddress, 4);
memcpy(ipConfig->ip.netmask, ipNetmask, 4);
memcpy(ipConfig->ip.gateway, ipGateway, 4);
memcpy(ipConfig->ip.dns1, primaryDns, 4);
memcpy(ipConfig->ip.dns2, secondaryDns, 4);
if (NCDSetIpConfig(ipConfig) != 0) {
result = -1;
if (result == 0) {
ipConfig = &AOSSi_NcdIpConfig;
memset(ipConfig, 0, sizeof(*ipConfig));
ipConfig->adjust.maxTransferUnit = 1300;
ipConfig->adjust.tcpRetransTimeout = 100;
ipConfig->adjust.dhcpRetransCount = 4;
ipConfig->useDhcp = 0;
ipConfig->useProxy = 0;
memcpy(ipConfig->ip.addr, ipAddress, 4);
memcpy(ipConfig->ip.netmask, ipNetmask, 4);
memcpy(ipConfig->ip.gateway, ipGateway, 4);
memcpy(ipConfig->ip.dns1, primaryDns, 4);
memcpy(ipConfig->ip.dns2, secondaryDns, 4);
if (NCDSetIpConfig(ipConfig) != 0) {
result = -1;
}
}
if (result == 0 && NCDSetIfConfig(&AOSSi_NcdIfConfig) != 0) {
result = -1;

File diff suppressed because it is too large Load Diff

View File

@@ -91,10 +91,8 @@ namespace ipl {
mNwc24ErrCountdown = 0;
// Text balloon for Mii face
f32 f0 = 30.0f;
f32 f1 = 120.0f;
mpNigaoeBalloon = new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt",
math::VEC3(0.0f, (f1 = 120.0f, 0.0f), (f0 = 30.0f, 0.0f)), f1, f0);
mpNigaoeBalloon = new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f),
TextBalloon::getDefaultMargin16x9(), TextBalloon::getDefaultMargin4x3());
// Scroller
mpScroller = new utility::YoungBScroller();

View File

@@ -527,11 +527,9 @@ namespace ipl {
// Default values for initial setup
if (!SCGetConfigDoneFlag() && !SCGetConfigDoneFlag2()) {
struct BlankNameStorage {
SCOwnerNickname blankName;
} blankNameStorage;
memset(&blankNameStorage.blankName, 0, sizeof(blankNameStorage.blankName));
SCSetOwnerNickName(&blankNameStorage.blankName);
SCOwnerNickname blankName;
memset(&blankName, 0, sizeof(blankName));
SCSetOwnerNickName(&blankName);
SCSetAspectRatio(SC_ASPECT_RATIO_4x3);

View File

@@ -892,68 +892,62 @@ s32 CArGBAOdh::cdj_c_colorConv(SArCDJ_OdhMaster* master, u8* sourceData, int for
void CArGBAOdh::LineConv11(u8* source, u8* lumaOutput, u8* cbOutput, u8* crOutput, u16 width, u16 height,
const long* conversionTable, int format) {
u32 planeSize = (u32)width * (u32)height;
const s32* table = conversionTable;
u32 pixelIndex = 0;
for (int i = 0; i < width; i++) {
s32 red;
s32 green;
s32 blue;
s32 red;
s32 green;
s32 blue;
s32 cbValue;
s32 crValue;
if (format == ODH_FORMAT_RGB565) {
u8* pixelSource = source + (pixelIndex & 0x1FFFFFFC) * 8 + (pixelIndex & 3) * 2;
u16 pixel = pixelSource[1];
pixel |= (u16)pixelSource[0] << 8;
red = (pixel >> 11) & 0x1F;
green = (pixel >> 6) & 0x1F;
blue = pixel & 0x1F;
} else if (format == ODH_FORMAT_RGBA8) {
int blueOrPixelOffset = (pixelIndex & 0xFFFFFFFC) * 0x10 + (pixelIndex & 3) * 2;
u8* pixel = source + blueOrPixelOffset;
red = pixel[1] >> 3;
green = pixel[0x20] >> 3;
blue = pixel[0x21] >> 3;
} else {
int sourceOffset = (pixelIndex & 7) + (pixelIndex & 0x3FFFFFF8) * 4;
float y = (float)source[sourceOffset] - colorConvert16;
float cb = (float)source[planeSize + sourceOffset] - colorConvert128;
float cr = (float)source[planeSize * 2 + sourceOffset] - colorConvert128;
red = (int)(colorConvertY * y + colorConvertR * cr);
green = (int)(colorConvertY * y - colorConvertG1 * cb - colorConvertG2 * cr);
blue = (int)(colorConvertY * y + colorConvertB * cb);
if (red < 0) {
red = 0;
}
if (0xFF < red) {
red = 0xFF;
}
if (green < 0) {
green = 0;
}
if (0xFF < green) {
green = 0xFF;
}
if (blue < 0) {
blue = 0;
}
if (0xFF < blue) {
blue = 0xFF;
}
red >>= 3;
green >>= 3;
blue >>= 3;
if (format == ODH_FORMAT_RGB565) {
int offset = (i & ~3) * 8 + (i & 3) * 2;
u16 pixel = source[offset];
pixel <<= 8;
pixel |= source[offset + 1];
red = (pixel >> 11) & 0x1F;
green = (pixel >> 6) & 0x1F;
blue = pixel & 0x1F;
} else if (format == ODH_FORMAT_RGBA8) {
int offset = (i & ~3) * 16 + (i & 3) * 2;
red = source[offset + 1] >> 3;
green = source[offset + 0x20] >> 3;
blue = source[offset + 0x21] >> 3;
} else {
int offset = (i & 7) + (i & ~7) * 4;
float y = source[offset] - colorConvert16;
float cb = source[planeSize + offset] - colorConvert128;
float cr = source[planeSize * 2 + offset] - colorConvert128;
red = colorConvertY * y + colorConvertR * cr;
green = colorConvertY * y - colorConvertG1 * cb - colorConvertG2 * cr;
blue = colorConvertY * y + colorConvertB * cb;
if (red < 0) {
red = 0;
}
if (red > 0xFF) {
red = 0xFF;
}
if (green < 0) {
green = 0;
}
if (green > 0xFF) {
green = 0xFF;
}
if (blue < 0) {
blue = 0;
}
if (blue > 0xFF) {
blue = 0xFF;
}
red >>= 3;
green >>= 3;
blue >>= 3;
}
int cbValue = (table[red + 0x60] + table[green + 0x80] + table[blue + 0xA0]) >> 16;
int crValue = (table[red + 0xC0] + table[green + 0xE0] + table[blue + 0x100]) >> 16;
int luma = (table[red + 0] + table[green + 0x20] + table[blue + 0x40]) >> 16;
*lumaOutput++ = (u8)luma;
*cbOutput++ = (u8)cbValue;
*crOutput++ = (u8)crValue;
pixelIndex++;
cbValue = (conversionTable[red + 0x60] + conversionTable[green + 0x80] + conversionTable[blue + 0xA0]) >> 16;
crValue = (conversionTable[red + 0xC0] + conversionTable[green + 0xE0] + conversionTable[blue + 0x100]) >> 16;
*lumaOutput++ = (conversionTable[red] + conversionTable[green + 0x20] + conversionTable[blue + 0x40]) >> 16;
*cbOutput++ = cbValue;
*crOutput++ = crValue;
}
}
void CArGBAOdh::fdct_fast(u32* coefficients, u8* samples, u32 stride, u32* quantizationTable) {
@@ -2007,208 +2001,206 @@ void CArGBAOdh::LineDeconv22(u8* dest, u8* y, u8* cb, u8* cr, u16 width, u16 hei
}
s32 CArGBAOdh::huffmanDecoder(u32* coefficientOutput, SArCDJ_HuffmanRequest* request, u16** huffmanTables, int component, u32 sourceLimit) {
u32 bitBuffer;
u32 tableCount;
s32 decodeResult;
int bitIndex;
s32 maximumBitLength;
int maxHuffmanBits;
u16 tableEntry;
s32 valueCategory;
u32 tableIndex;
u32 magnitudeMask;
int bytesConsumed;
u8* sourceCursor;
u32 decodedSymbol;
u32 bitCountAndMask;
u32 bitOffset;
int coefficient;
s32 category;
int bytesConsumed;
u32 bitBuffer;
int length;
u32 tableIndex;
int maxLength;
u32 value;
u32 mask;
u32 leafIndex;
u32 run;
u32 i;
bytesConsumed = request->bytesConsumed;
sourceCursor = request->bitstream;
u32 bitOffset = *request->bitCount;
bitOffset = *request->bitCount;
if ((u32)(bytesConsumed + 4) > sourceLimit) {
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
} else {
maximumBitLength = 0xB;
bitBuffer = ((u32)*sourceCursor << 0x18) | ((u32)sourceCursor[1] << 0x10) | ((u32)sourceCursor[2] << 8) | sourceCursor[3];
bitBuffer <<= bitOffset;
if (component == 0) {
maximumBitLength = 9;
}
bitIndex = 1;
tableIndex = 0;
maxHuffmanBits = (int)maximumBitLength;
for (; bitIndex <= maxHuffmanBits; bitIndex++) {
tableEntry = huffmanTables[0][tableIndex];
decodedSymbol = (u32)tableEntry & 0x3FFF;
if (((bitBuffer >> (0x20U - bitIndex)) & 1) == 0) {
if ((tableEntry & 0x8000) != 0) {
valueCategory = huffmanTables[0][tableIndex + decodedSymbol];
break;
}
tableIndex = tableIndex + decodedSymbol;
} else {
if ((tableEntry & 0x4000) != 0) {
u32 leafIndex = tableIndex + decodedSymbol + 1;
valueCategory = huffmanTables[0][leafIndex];
break;
}
tableIndex = tableIndex + decodedSymbol + 1;
}
}
if (bitIndex > maxHuffmanBits) {
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
return ODH_ERROR_INVALID_BITSTREAM;
}
bitBuffer = ((u32)sourceCursor[0] << 24 | (u32)sourceCursor[1] << 16 | (u32)sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
maxLength = component == 0 ? 9 : 11;
length = 1;
tableIndex = 0;
for (; length <= maxLength; length++) {
u32 branch;
u16 node;
node = huffmanTables[0][tableIndex];
branch = node & 0x3FFF;
if (((bitBuffer >> (32 - length)) & 1) == 0) {
if (node & 0x8000) {
category = huffmanTables[0][tableIndex + branch];
break;
}
tableIndex += branch;
} else {
if (valueCategory > 0) {
bitCountAndMask = (1 << (valueCategory)) - 1;
bitBuffer = bitCountAndMask & (bitBuffer >> ((0x20 - bitIndex) - valueCategory));
if ((bitBuffer & (1 << (valueCategory - 1))) == 0) {
bitBuffer = bitBuffer + 1 | ~bitCountAndMask;
}
} else {
bitBuffer = 0;
if (node & 0x4000) {
leafIndex = tableIndex + branch + 1;
category = huffmanTables[0][leafIndex];
break;
}
u32** predictors = request->predictors;
u32* predictor = predictors[component >> 1];
bitCountAndMask = bitOffset + bitIndex + valueCategory;
tableIndex = (bitCountAndMask >> 3);
decodedSymbol = 1;
bitIndex = (int)bitBuffer + *predictor;
*coefficientOutput = bitIndex;
*predictors[component >> 1] = bitIndex;
while (bitCountAndMask >= 8) {
sourceCursor++;
bytesConsumed++;
bitCountAndMask -= 8;
}
do {
if ((u32)(bytesConsumed + 4) > sourceLimit) {
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
goto finishDecode;
}
bitIndex = 1;
tableIndex = 0;
bitBuffer = ((u32)*sourceCursor << 0x18) | ((u32)sourceCursor[1] << 0x10) | ((u32)sourceCursor[2] << 8) | sourceCursor[3];
bitBuffer <<= bitCountAndMask;
maximumBitLength = 6;
for (; maximumBitLength != 0; maximumBitLength--) {
tableEntry = huffmanTables[1][tableIndex];
tableCount = (u32)tableEntry & 0x3FFF;
if (((bitBuffer >> (0x20U - bitIndex)) & 1) == 0) {
if ((tableEntry & 0x8000) != 0) {
valueCategory = huffmanTables[1][tableIndex + tableCount];
break;
}
tableIndex = tableIndex + tableCount;
} else {
if ((tableEntry & 0x4000) != 0) {
valueCategory = huffmanTables[1][tableIndex + tableCount + 1];
break;
}
tableIndex = tableIndex + tableCount + 1;
}
bitIndex++;
}
if (bitIndex > 6) {
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
goto finishDecode;
}
if (valueCategory == 7) {
bitCountAndMask += bitIndex;
tableIndex = (bitCountAndMask >> 3);
while (bitCountAndMask >= 8) {
sourceCursor++;
bytesConsumed++;
bitCountAndMask -= 8;
}
break;
}
if (valueCategory > 0) {
tableIndex = (u32)(1 << (valueCategory)) - 1 &
(bitBuffer >> ((0x20 - bitIndex) - valueCategory));
if ((tableIndex & (u32)(1 << (valueCategory - 1))) == 0) {
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
goto finishDecode;
}
} else {
tableIndex = 0;
}
for (u32 zeroIndex = 0; zeroIndex < tableIndex; zeroIndex++) {
coefficientOutput[decodedSymbol] = 0;
decodedSymbol++;
}
bitCountAndMask = bitCountAndMask + bitIndex + valueCategory;
tableIndex = (bitCountAndMask >> 3);
while (bitCountAndMask >= 8) {
sourceCursor++;
bytesConsumed++;
bitCountAndMask -= 8;
}
if ((u32)(bytesConsumed + 4) > sourceLimit) {
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
goto finishDecode;
}
maximumBitLength = 0xB;
bitBuffer = ((u32)*sourceCursor << 0x18) | ((u32)sourceCursor[1] << 0x10) | ((u32)sourceCursor[2] << 8) | sourceCursor[3];
bitBuffer <<= bitCountAndMask;
if (component == 0) {
maximumBitLength = 9;
}
bitIndex = 1;
tableIndex = 0;
maxHuffmanBits = (int)maximumBitLength;
for (; bitIndex <= maxHuffmanBits; bitIndex++) {
tableEntry = huffmanTables[0][tableIndex];
tableCount = (u32)tableEntry & 0x3FFF;
if (((bitBuffer >> (0x20U - bitIndex)) & 1) == 0) {
if ((tableEntry & 0x8000) != 0) {
valueCategory = huffmanTables[0][tableIndex + tableCount];
break;
}
tableIndex = tableIndex + tableCount;
} else {
if ((tableEntry & 0x4000) != 0) {
valueCategory = huffmanTables[0][tableIndex + tableCount + 1];
break;
}
tableIndex = tableIndex + tableCount + 1;
}
}
if (bitIndex > maxHuffmanBits) {
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
goto finishDecode;
}
if (valueCategory > 0) {
magnitudeMask = (1 << (valueCategory)) - 1;
bitBuffer = magnitudeMask & (bitBuffer >> ((0x20 - bitIndex) - valueCategory));
if ((bitBuffer & (1 << (valueCategory - 1))) == 0) {
bitBuffer = bitBuffer + 1 | ~magnitudeMask;
}
} else {
bitBuffer = 0;
}
bitCountAndMask = bitCountAndMask + bitIndex + valueCategory;
coefficientOutput[decodedSymbol] = bitBuffer;
tableIndex = (bitCountAndMask >> 3);
decodedSymbol = decodedSymbol + 1;
while (bitCountAndMask >= 8) {
sourceCursor++;
bytesConsumed++;
bitCountAndMask -= 8;
}
} while ((int)decodedSymbol < 0x40);
for (; (int)decodedSymbol < 0x40; decodedSymbol++) {
coefficientOutput[decodedSymbol] = 0;
}
request->bytesConsumed = bytesConsumed;
decodeResult = 0;
request->bitstream = sourceCursor;
*request->bitCount = bitCountAndMask;
tableIndex += branch + 1;
}
}
finishDecode:
return decodeResult;
}
if (length > maxLength) {
return ODH_ERROR_INVALID_BITSTREAM;
}
if (category > 0) {
mask = (1 << category) - 1;
value = mask & (bitBuffer >> (32 - length - category));
if ((value & (1 << (category - 1))) == 0) {
value = (value + 1) | ~mask;
}
} else {
value = 0;
}
bitOffset += length + category;
coefficient = 1;
coefficientOutput[0] = value + *request->predictors[component >> 1];
*request->predictors[component >> 1] = coefficientOutput[0];
while (bitOffset >= 8) {
sourceCursor++;
bytesConsumed++;
bitOffset -= 8;
}
do {
if ((u32)(bytesConsumed + 4) > sourceLimit) {
return ODH_ERROR_INVALID_BITSTREAM;
}
bitBuffer = ((u32)sourceCursor[0] << 24 | (u32)sourceCursor[1] << 16 | (u32)sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
length = 1;
tableIndex = 0;
for (; length <= 6; length++) {
u32 branch;
u16 node;
node = huffmanTables[1][tableIndex];
branch = node & 0x3FFF;
if (((bitBuffer >> (32 - length)) & 1) == 0) {
if (node & 0x8000) {
category = huffmanTables[1][tableIndex + branch];
break;
}
tableIndex += branch;
} else {
if (node & 0x4000) {
category = huffmanTables[1][tableIndex + branch + 1];
break;
}
tableIndex += branch + 1;
}
}
if (length > 6) {
return ODH_ERROR_INVALID_BITSTREAM;
}
if (category == 7) {
bitOffset += length;
while (bitOffset >= 8) {
sourceCursor++;
bytesConsumed++;
bitOffset -= 8;
}
break;
}
if (category > 0) {
run = ((1 << category) - 1) & (bitBuffer >> (32 - length - category));
if ((run & (1 << (category - 1))) == 0) {
return ODH_ERROR_INVALID_BITSTREAM;
}
} else {
run = 0;
}
for (i = 0; i < run; i++) {
coefficientOutput[coefficient] = 0;
coefficient++;
}
bitOffset += length + category;
while (bitOffset >= 8) {
sourceCursor++;
bytesConsumed++;
bitOffset -= 8;
}
if ((u32)(bytesConsumed + 4) > sourceLimit) {
return ODH_ERROR_INVALID_BITSTREAM;
}
bitBuffer = ((u32)sourceCursor[0] << 24 | (u32)sourceCursor[1] << 16 | (u32)sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
maxLength = component == 0 ? 9 : 11;
length = 1;
tableIndex = 0;
for (; length <= maxLength; length++) {
u32 branch;
u16 node;
node = huffmanTables[0][tableIndex];
branch = node & 0x3FFF;
if (((bitBuffer >> (32 - length)) & 1) == 0) {
if (node & 0x8000) {
category = huffmanTables[0][tableIndex + branch];
break;
}
tableIndex += branch;
} else {
if (node & 0x4000) {
category = huffmanTables[0][tableIndex + branch + 1];
break;
}
tableIndex += branch + 1;
}
}
if (length > maxLength) {
return ODH_ERROR_INVALID_BITSTREAM;
}
if (category > 0) {
mask = (1 << category) - 1;
value = mask & (bitBuffer >> (32 - length - category));
if ((value & (1 << (category - 1))) == 0) {
value = (value + 1) | ~mask;
}
} else {
value = 0;
}
coefficientOutput[coefficient++] = value;
bitOffset += length + category;
while (bitOffset >= 8) {
sourceCursor++;
bytesConsumed++;
bitOffset -= 8;
}
} while (coefficient < 64);
for (; coefficient < 64; coefficient++) {
coefficientOutput[coefficient] = 0;
}
request->bytesConsumed = bytesConsumed;
request->bitstream = sourceCursor;
*request->bitCount = bitOffset;
return 0;
}
void CArGBAOdh::idct_fast(const u8* rangeLimitTable, u32* coefficients, u32* quantizationTable, u8* destination, u32 stride) {
int evenPart0, evenPart1, evenPart2, evenPart3, oddPart3, oddPart2, oddPart1, oddPart0;
int butterflyTerm0, butterflyTerm1, butterflyTerm2, evenInnerSum;

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,58 @@
# CHANSVm converter input types
Base: `20cf9f9f25b13b8cd6910e07cc5eb71558845d4e`, target 43U only.
## Change and source review
`CHANSVmConvertToFloatFromStr` took a pointer-to-const source header while
`VmConvertFunc` specified a mutable source header. The conversion table cast
hid that incompatible function-pointer type at the indirect call.
Give all 11 converters and the callback typedef the same pointer-to-const
source-header type, and remove the callback cast. All converters either read
source values, ignore the source, or pass it through the read-only array-join
path. They write only newly allocated result objects. Propagate the input type
through `VmArrayJoinCommon`, `VmArrayJoinEstimateStrSize`, `VmArrayJoinSub`, and
`VmArraySeekTop`, including the forward declaration. These helpers only read
the source header; the join routines write the destination string and local
state. `VmArraySeekTop` still returns a mutable chunk pointer because header
constness is shallow and other callers can mutate array elements. No cast is
needed at the array-join boundary.
The public `CHANSVmConvertObjectType` input remains mutable: its same-type fast
path returns the original mutable object. Passing it to a const-source
converter is valid. No executable expressions, flags, data or layout changed.
## Fresh leaf verification
Configured using the restored `wii-source-tools/build-43U.sh` tool paths and
flags, with commands run in the isolated leaf instead of that script's fixed
main directory. Baseline object was freshly compiled before editing.
- Entire CHANSVm object is byte-identical to that baseline, SHA256
`11fa48261cd93668d133d5ef73efbf3c9109181730b21409153b78316189e063`.
All 233 sibling function spans, allocated sections and relocations unchanged.
- All 15 emitted converter/dispatch/join functions: exact-name objdiff 100.0,
raw target function bytes and normalized relocation targets identical
(86 code relocations). VmArraySeekTop is inlined.
- All target data sections match including alignment padding: `.rodata` 1432,
`.data` 4672, `.sdata2` 184, `.sdata` 600, `.sbss` 16 bytes;
all 614 data relocations match by resolved section/function target.
- Pool: 125/125 strings identical. Dispatch ctxdiff: 47/47 instructions, 0 diffs.
FloatFromStr: 83/83 instructions, one textual symbol-alias difference
(`VmNaN` versus `lbl_81694F08`); raw bytes and resolved relocation target are
identical. This is not represented as a literal ctxdiff-zero result.
- Fresh full 43U build, report and `build/43U/ok` pass. DOL SHA1:
`26116613f624061ba99c8d1a299aaa6efa85670d`.
- All 1028 unit measures/functions/sections and overall report measures are
unchanged against the saved base report. All 22 workflow guards pass with
no skips. `git diff --check` passes.
This is a binary-neutral type correction, not a new matching/linking gain.
CHANSVm remains 229/233 exact, 45284/53564 exact code bytes, 6904/6904 matching
data bytes, and unlinked. The completion assertion still fails on the existing
project-wide incomplete code/link totals; no full-completion claim is made.
Local evidence: `../vm-converter-const-evidence/` contains baseline/candidate
build logs, original baseline object/report, verification script/results,
full-build/report/ok logs, pool and ctxdiff results, guards and completion logs.

View File

@@ -0,0 +1,285 @@
# g-aoss attempts, 2026-10-09
Assigned worktree data-d1, branch agent/w1009/g-aoss, base 54ca052b. Scope AOSS_Init_old and AOSSi_WLANConnect. Read opus-common.md, AGENTS.md, unslop, prior AOSS logs and 509c4f11. Preserve rx67c.attempts.md. No pushes, PRs, merges, rebases, other-worktree edits or subagents.
Initial full 43U build passed. Target AOSS .sdata2 contains ffffffff00000000, 8 bytes with section alignment 8. Opus replay emits four bytes, ffffffff; objdiff rejects the entire 8-byte section, accounting for DATA DROP 2800 -> 2792. Both main and Opus emit 364 bytes in .data versus target 368, because the split includes final section alignment. This .data extent alone is not the reported regression.
## Attempts
- opus-replay: 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 4}. Replay 509c4f11 without changing its source.
- defaults-array-typed-view: 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Preserve the existing four halfword option defaults and read its connection/response pair as a struct.
- defaults-array-pairs: 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Preserve the existing four halfword option defaults and read its connection/response pair as a struct.
- defaults-union-view: 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Preserve the existing four halfword option defaults and read its connection/response pair as a struct.
- connect-alias-void: 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Typed config view survives into the later NCD call; target has one coalesced config pointer.
- connect-alias-typed: 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Typed config view survives into the later NCD call; target has one coalesced config pointer.
- connect-alias-bytes: 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Typed config view survives into the later NCD call; target has one coalesced config pointer.
- connect-local-static-ip: 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Local static config limits alias edges, lever 35; trial only until data/order verification.
- connect-local-static-both: 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Local static config limits alias edges, lever 35; trial only until data/order verification.
- connect-memset-result: 14/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Consume the memset return value as the typed config pointer.
- connect-success-value: 105/155 positional diffs, 154/155 instructions; sections {'.data': 48}. Use the current initialization success value in related zero stores and memset.
- connect-pointer-at-entry: 79/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Initialize the real config pointer at declaration, before wireless setup.
Full single/pairwise optimizer sweep: AOSS_Init_old best 1264 positional differences; WLANConnect best 2. No pragma hit. Fixed defaults array with typed struct view restores AOSS data 2800/2800 and preserves Opus Init score 97.33775%, 20/21 exact.
The first Init source-search selected its earlier prototype and found no mutations. This was not Init coverage. Local script now selects the definition.
- connect-helper-return-pointer: 24/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Factor the complete IPv4 initialization into a real inline helper; no dummy or identity operation.
- connect-helper-parameter: 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Factor the complete IPv4 initialization into a real inline helper; no dummy or identity operation.
- connect-helper-return-result: 24/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Factor the complete IPv4 initialization into a real inline helper; no dummy or identity operation.
- connect-helper-return-void-pointer: 24/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Factor the complete IPv4 initialization into a real inline helper; no dummy or identity operation.
- connect-helper-return-pointer-scoped: 24/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Factor the complete IPv4 initialization into a real inline helper; no dummy or identity operation.
- init-message-type-u8: objdiff 97.34406%, exact 20, data 2800; 1410/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
- init-address-length-u8: objdiff 97.09659%, exact 20, data 2800; 1410/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
- init-both-u8: objdiff 97.119316%, exact 20, data 2800; 1344/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
- init-message-type-u32: objdiff 97.34406%, exact 20, data 2800; 1410/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
- init-address-length-u32: objdiff 97.09659%, exact 20, data 2800; 1410/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
- init-both-u32: objdiff 97.119316%, exact 20, data 2800; 1344/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
- init-message-type-int: objdiff 97.34406%, exact 20, data 2800; 1410/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
- init-address-length-int: objdiff 97.09659%, exact 20, data 2800; 1410/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
- init-both-int: objdiff 97.119316%, exact 20, data 2800; 1344/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
- init-poll-named-products: objdiff 97.3125%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Keep native OSTime addition and the existing u32 product truncation; give real products separate names.
- init-poll-separate-components: objdiff 97.3125%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Keep native OSTime addition and the existing u32 product truncation; give real products separate names.
- init-manufacturer-single-pass-guard: objdiff 97.33775%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Express the observed bounded manufacturer copy with a structured exit; same bytes and call count.
- init-manufacturer-bounded-copy-loop: objdiff 97.08839%, exact 20, data 2800; 1154/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Express the observed bounded manufacturer copy with a structured exit; same bytes and call count.
- init-manufacturer-bounded-copy-for: objdiff 97.08839%, exact 20, data 2800; 1154/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Express the observed bounded manufacturer copy with a structured exit; same bytes and call count.
- init-manufacturer-switch-length-range: objdiff 96.98737%, exact 20, data 2800; 1305/1585 positional diffs, 1585/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Express the observed bounded manufacturer copy with a structured exit; same bytes and call count.
- init-manufacturer-positive-branch-label: objdiff 97.33775%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Express the observed bounded manufacturer copy with a structured exit; same bytes and call count.
- init-retry-switch-result: objdiff 97.27146%, exact 20, data 2800; 1314/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Natural result dispatch with a single state-success test and the existing config test.
- init-retry-nested-success: objdiff 97.33775%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Natural result dispatch with a single state-success test and the existing config test.
- init-retry-continue-then-success: objdiff 97.33775%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Natural result dispatch with a single state-success test and the existing config test.
- init-preheader-type-u8: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
- init-preheader-identity-length-u8: objdiff 97.33775%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
- init-preheader-both-u8: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
- init-preheader-type-u32: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
- init-preheader-identity-length-u32: objdiff 97.33775%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
- init-preheader-both-u32: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
- init-preheader-type-int: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
- init-preheader-identity-length-int: objdiff 97.33775%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
- init-preheader-both-int: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
- compiler-AOSSLink-3.0a5: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
- compiler-AOSSLink-3.0a3.4: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
- compiler-AOSSLink-3.0a3.3: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
- compiler-AOSSLink-2.7: compile failed. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
- compiler-AOSSLink-2.6: compile failed. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
- compiler-AOSS-3.0a5: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
- compiler-AOSS-3.0a3.4: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
- compiler-AOSS-3.0a3.3: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
- compiler-AOSS-2.7: compile failed. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
- compiler-AOSS-2.6: compile failed. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
## Evidence and retained source
- AOSS target .sdata2 is 8 bytes, ffffffff00000000. The original two symbols cover offsets 0..2 and 2..8. Preserve the existing u16[4] defaults and read its first pair through AOSSWaitDefaults. All three reconstructed array/union views emit the same eight bytes; retained form keeps the original four halfword initializer.
- The target reads r14 at Init instruction 509, relative offset 0x7f4, with cmpwi r14,0. No earlier instruction names r14. Its first write is instruction 576, li r14,0x11. _savegpr_14 stores incoming registers without changing r14. This verifies the saved Opus unassigned socketOptionResult against the target and follows user-approved lever 10. No new undefined-value trick was invented.
- Keep requestMessageType initialized to 0x11 after the socket-option guard and successful SOBind, in the real protocol preheader. This moves the protocol constant to the target region and improves objdiff 97.33775 -> 97.39141 without changing instruction count or any exact sibling. The earlier function-entry initializer trials are rejected: they write r14 before the target's unassigned guard.
- Source-search: WLANConnect 959 trials in 180 seconds, no gain. Corrected Init definition search 723 trials in 240 seconds, no gain. No automatic mutation is retained. Searches used separate /tmp/g-aoss-* source and object files.
- Neighboring GC/3.0a5, 3.0a3.4 and 3.0a3.3 compilers produce identical remaining scores. GC/2.7 and 2.6 reject -ipa file. Compiler configuration is unchanged.
- WLANConnect still differs only at instructions 66 and 67. Target sets r5 to 0x7c4 before copying r27 to r3; source performs that copy first. Its 13 exact siblings and 2432 bytes of data are unchanged. Local-static, cross-use alias, return-pointer and real initialization-helper trials did not resolve this scheduler tie. AOSSLink.c is unchanged.
- Init remains 1578/1584 instructions. Missing target structure includes the manufacturer ble plus unconditional branch, three consecutive same-compare bne pairs, and protocol constant materialization. The DS implementation has the same bne pairs. No redundant source condition or artificial branch was added to reproduce them. Both owned units remain NonMatching because neither is fully exact.
Final gate and independent current-object checks follow.
```text
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[src/scene/setting/AOSS] pool: IDENTICAL
[src/scene/setting/AOSS] objdiff: code 9856/16192 data 2800/2800 functions 20/21 fuzzy 98.9792 linked code 0
[src/scene/setting/AOSS] instruction-exact functions: 20/21
[src/scene/setting/AOSS] section .bss size 2368 match 100.0
[src/scene/setting/AOSS] section .data size 368 match 100.0
[src/scene/setting/AOSS] section .sbss size 32 match 100.0
[src/scene/setting/AOSS] section .sdata size 24 match 100.0
[src/scene/setting/AOSS] section .sdata2 size 8 match 100.0
[src/scene/setting/AOSS] section .text size 16192 match 98.97925
[src/scene/setting/AOSS] below 100: AOSS_Init_old 97.39141
[src/scene/setting/AOSS] baseline: code 9856/16192 data 2800 functions 20 fuzzy 98.6781
[src/scene/setting/AOSSLink] pool: IDENTICAL
[src/scene/setting/AOSSLink] objdiff: code 1576/2196 data 2432/2432 functions 13/14 fuzzy 99.6357 linked code 0
[src/scene/setting/AOSSLink] instruction-exact functions: 13/14
[src/scene/setting/AOSSLink] section .bss size 2344 match 100.0
[src/scene/setting/AOSSLink] section .data size 48 match 100.0
[src/scene/setting/AOSSLink] section .sbss size 40 match 100.0
[src/scene/setting/AOSSLink] section .text size 2196 match 99.635704
[src/scene/setting/AOSSLink] below 100: AOSSi_WLANConnect 98.70968
[src/scene/setting/AOSSLink] baseline: code 1576/2196 data 2432 functions 13 fuzzy 99.6357
regressions vs baseline: 0
global matched_code_percent: 99.20325 -> 99.20325
global fuzzy_match_percent: 99.97473 -> 99.97636
global complete_code_percent: 94.18519 -> 94.18519
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
GATE PASS
```
Independent focused checks: AOSS pool 1/1 strings identical, AOSSLink 0/0 identical; WLANConnect odiff/ctxdiff 2/155, equal 0x26c sizes. Init odiff/ctxdiff 1263 differences, 1578/1584 instructions, sizes 0x18a8/0x18c0. No new exact functions. The data regression is fully repaired; both units remain unlinked. All experimental AOSSLink and compiler changes were discarded. Retained paths are AOSS.c and this attempts log.
## Round b, MAX, 2026-10-09
Branch agent/w1009/g2-aoss, HEAD and fresh origin/main 87214ff9. Full 43U build and both pools passed. Preserve the pre-existing untracked rx67c.attempts.md. Read opus-common.md and round-a source and trial history. Both single/pairwise pragma sweeps were already run on this baseline; repeating unchanged sweeps adds no coverage.
Register-normalized sequence alignment locates the six missing instructions precisely: manufacturer ble plus b versus bgt, one extra bne after each of the three connection-success comparisons, the preheader address-length 8 materialization, and a fresh zero before the packet reserved byte store. All other count differences in the alignment are instruction movement. Target duplicate branches are at object offsets 0x7f8/0x7fc, 0xd50/0xd54, and 0x1610/0x1614. Source control-flow trials will use one meaningful status predicate rather than introducing duplicate guards.
- b-init-socklen-u8: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
- b-init-socklen-mem-u8: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
- b-init-socklen-mem-xor-u8: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
- b-init-socklen-u16: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
- b-init-socklen-mem-u16: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
- b-init-socklen-mem-xor-u16: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
- b-init-socklen-u32: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
- b-init-socklen-mem-u32: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
- b-init-socklen-mem-xor-u32: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
- b-init-socklen-int: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
- b-init-socklen-mem-int: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
- b-init-socklen-mem-xor-int: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
- b-connect-ip-late-pointer: compile failed. Limit config-object scope and preserve target IfConfig-before-IpConfig allocation; use the actual config directly or retain the pointer at its first use.
- b-connect-ip-late-direct: compile failed. Limit config-object scope and preserve target IfConfig-before-IpConfig allocation; use the actual config directly or retain the pointer at its first use.
- b-connect-both-target-order-direct: objdiff 96.019356%, exact 13, data 2432; 35/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Limit config-object scope and preserve target IfConfig-before-IpConfig allocation; use the actual config directly or retain the pointer at its first use.
- b-connect-both-target-order-pointer: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Limit config-object scope and preserve target IfConfig-before-IpConfig allocation; use the actual config directly or retain the pointer at its first use.
- b-connect-both-ipblock-direct: objdiff 96.019356%, exact 13, data 2432; 35/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Limit config-object scope and preserve target IfConfig-before-IpConfig allocation; use the actual config directly or retain the pointer at its first use.
- b-connect-ip-scope-pointer: objdiff 98.70968%, exact 13, data 88; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. C89-valid phase block for the local static IP config; its lifetime spans all initialization and the NCDSetIpConfig call.
- b-connect-ip-scope-direct: objdiff 96.019356%, exact 13, data 88; 35/155 positional diffs, 155/155 instructions; sections {'.data': 48}. C89-valid phase block for the local static IP config; its lifetime spans all initialization and the NCDSetIpConfig call.
- b-connect-ip-scope-const-pointer: objdiff 98.70968%, exact 13, data 88; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. C89-valid phase block for the local static IP config; its lifetime spans all initialization and the NCDSetIpConfig call.
- b-connect-cpp: compile failed. Test a real C++ translation with C linkage and explicit allocation casts to compare frontend call-argument generation; retain only whole-unit exact output.
- b-connect-cpp-ipa-off: compile failed. Test a real C++ translation with C linkage and explicit allocation casts to compare frontend call-argument generation; retain only whole-unit exact output.
- b-connect-cpp-inline-off: compile failed. Test a real C++ translation with C linkage and explicit allocation casts to compare frontend call-argument generation; retain only whole-unit exact output.
- b-init-switch-default-first: objdiff 97.32513%, exact 20, data 2800; 1317/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Dispatch one real connection-success state without repeating a condition, or use an explicit manufacturer default case; compare block counts before register work.
- b-init-switch-all: objdiff 97.36301%, exact 20, data 2800; 1325/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Dispatch one real connection-success state without repeating a condition, or use an explicit manufacturer default case; compare block counts before register work.
- b-init-switch-all-default-first: objdiff 97.36301%, exact 20, data 2800; 1325/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Dispatch one real connection-success state without repeating a condition, or use an explicit manufacturer default case; compare block counts before register work.
- b-init-switch-narrow: objdiff 96.98485%, exact 20, data 2800; 1325/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Dispatch one real connection-success state without repeating a condition, or use an explicit manufacturer default case; compare block counts before register work.
- b-init-switch-enum: objdiff 97.36301%, exact 20, data 2800; 1325/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Dispatch one real connection-success state without repeating a condition, or use an explicit manufacturer default case; compare block counts before register work.
- b-init-switch-manufacturer-default-first: objdiff 97.04104%, exact 20, data 2800; 1306/1585 positional diffs, 1585/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Dispatch one real connection-success state without repeating a condition, or use an explicit manufacturer default case; compare block counts before register work.
- b-init-switch-manufacturer-reverse: objdiff 97.23043%, exact 20, data 2800; 1180/1584 positional diffs, 1582/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Dispatch one real connection-success state without repeating a condition, or use an explicit manufacturer default case; compare block counts before register work.
- b-connect-cpp-fixed: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Replace the existing language option rather than appending it; real C++ source, C linkage, and allocation casts.
- b-connect-cpp-fixed-ipa-off: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Replace the existing language option rather than appending it; real C++ source, C linkage, and allocation casts.
- b-connect-cpp-fixed-inline-off: objdiff 98.70968%, exact 12, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Replace the existing language option rather than appending it; real C++ source, C linkage, and allocation casts.
- b-connect-proc-750: compile failed. Processor scheduling model test from compiler help; compare all 14 function scores and unchanged sections before accepting any flag.
- b-connect-proc-740: compile failed. Processor scheduling model test from compiler help; compare all 14 function scores and unchanged sections before accepting any flag.
- b-connect-proc-603e: compile failed. Processor scheduling model test from compiler help; compare all 14 function scores and unchanged sections before accepting any flag.
- b-connect-proc-604e: compile failed. Processor scheduling model test from compiler help; compare all 14 function scores and unchanged sections before accepting any flag.
- b-connect-proc-601: compile failed. Processor scheduling model test from compiler help; compare all 14 function scores and unchanged sections before accepting any flag.
- b-connect-proc-602: compile failed. Processor scheduling model test from compiler help; compare all 14 function scores and unchanged sections before accepting any flag.
- b-connect-proc-7400: compile failed. Processor scheduling model test from compiler help; compare all 14 function scores and unchanged sections before accepting any flag.
- b-connect-proc-7450: compile failed. Processor scheduling model test from compiler help; compare all 14 function scores and unchanged sections before accepting any flag.
- b-init-inline-manufacturer-void: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real reusable manufacturer-copy or connection-status helper, explicit inline-only mode; no duplicate guard or artificial dependency.
- b-init-inline-manufacturer-status: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real reusable manufacturer-copy or connection-status helper, explicit inline-only mode; no duplicate guard or artificial dependency.
- b-init-inline-link-conjunction: objdiff 96.28661%, exact 20, data 2800; 1266/1590 positional diffs, 1590/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real reusable manufacturer-copy or connection-status helper, explicit inline-only mode; no duplicate guard or artificial dependency.
- b-init-inline-link-early-return: objdiff 96.41288%, exact 20, data 2800; 1307/1593 positional diffs, 1593/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real reusable manufacturer-copy or connection-status helper, explicit inline-only mode; no duplicate guard or artificial dependency.
- b-init-inline-link-value: objdiff 96.984215%, exact 20, data 2800; 695/1584 positional diffs, 1584/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real reusable manufacturer-copy or connection-status helper, explicit inline-only mode; no duplicate guard or artificial dependency.
- b-connect-storage-byte-buffer: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Use a complete aligned config buffer with a typed record view; no offset cast or extra storage, and clear its real bytes.
- b-connect-storage-word-buffer: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Use a complete aligned config buffer with a typed record view; no offset cast or extra storage, and clear its real bytes.
- b-connect-storage-record-array: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Use a complete aligned config buffer with a typed record view; no offset cast or extra storage, and clear its real bytes.
- b-connect-storage-union-buffer: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Use a complete aligned config buffer with a typed record view; no offset cast or extra storage, and clear its real bytes.
- b-init-helper-pending-result: objdiff 95.847855%, exact 20, data 2800; 1326/1597 positional diffs, 1597/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real helper combines the call result and config connected flag into an attempt result; callers consume it once, with no duplicate source condition.
- b-init-helper-pending-result-if: objdiff 95.847855%, exact 20, data 2800; 1326/1597 positional diffs, 1597/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real helper combines the call result and config connected flag into an attempt result; callers consume it once, with no duplicate source condition.
- b-init-helper-connected-result: objdiff 96.236115%, exact 20, data 2800; 1324/1591 positional diffs, 1591/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real helper combines the call result and config connected flag into an attempt result; callers consume it once, with no duplicate source condition.
- b-init-helper-connected-result-early: objdiff 96.18561%, exact 20, data 2800; 1258/1594 positional diffs, 1594/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real helper combines the call result and config connected flag into an attempt result; callers consume it once, with no duplicate source condition.
- b-init-helper-connected-status: objdiff 96.008835%, exact 20, data 2800; 1259/1594 positional diffs, 1594/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real helper combines the call result and config connected flag into an attempt result; callers consume it once, with no duplicate source condition.
- b-init-helper-pending-negation: objdiff 96.28661%, exact 20, data 2800; 1266/1590 positional diffs, 1590/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real helper combines the call result and config connected flag into an attempt result; callers consume it once, with no duplicate source condition.
- b-init-manufacturer-void-opt_dead_code-off: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Apply the allowed optimizer setting only to a natural early-return bounded-copy helper; leave Init and siblings at their existing settings.
- b-init-manufacturer-void-opt_common_subs-off: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Apply the allowed optimizer setting only to a natural early-return bounded-copy helper; leave Init and siblings at their existing settings.
- b-connect-narrow-proc-gekko: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
- b-init-manufacturer-void-opt_propagation-off: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Apply the allowed optimizer setting only to a natural early-return bounded-copy helper; leave Init and siblings at their existing settings.
- b-connect-narrow-proc-750: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
- b-init-manufacturer-void-ppc_iro_level-0: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Apply the allowed optimizer setting only to a natural early-return bounded-copy helper; leave Init and siblings at their existing settings.
- b-connect-narrow-proc-740: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
- b-init-manufacturer-void-optimization_level-1: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Apply the allowed optimizer setting only to a natural early-return bounded-copy helper; leave Init and siblings at their existing settings.
- b-connect-narrow-proc-603e: objdiff 83.08387%, exact 6, data 2432; 31/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
- b-connect-narrow-proc-604e: objdiff 95.16129%, exact 9, data 2432; 14/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
- b-init-manufacturer-void-optimization_level-2: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Apply the allowed optimizer setting only to a natural early-return bounded-copy helper; leave Init and siblings at their existing settings.
- b-connect-narrow-proc-601: objdiff 80.47097%, exact 7, data 2432; 39/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
- b-init-manufacturer-void-optimization_level-3: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Apply the allowed optimizer setting only to a natural early-return bounded-copy helper; leave Init and siblings at their existing settings.
- b-connect-narrow-proc-602: objdiff 87.05161%, exact 8, data 2432; 28/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
- b-init-manufacturer-pointer: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Bounded manufacturer copy returns its actual destination or copied byte count, with an error return for oversized input.
- b-connect-narrow-proc-7400: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
- b-init-manufacturer-length: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Bounded manufacturer copy returns its actual destination or copied byte count, with an error return for oversized input.
- b-connect-narrow-proc-7450: objdiff 95.96774%, exact 11, data 2432; 11/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
- b-init-packet-header-void: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Factor the complete final-message header construction into a real typed inline helper; compare the target fresh reserved-byte zero materialization.
- b-init-packet-header-packet: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Factor the complete final-message header construction into a real typed inline helper; compare the target fresh reserved-byte zero materialization.
- b-connect-size-early: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Name the actual initialized config length at its phase boundary; compare the PCode argument setup and preserve one complete clear.
- b-connect-size-phase: objdiff 98.6%, exact 13, data 2432; 4/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Name the actual initialized config length at its phase boundary; compare the PCode argument setup and preserve one complete clear.
- b-connect-ushort-phase: objdiff 98.6%, exact 13, data 2432; 4/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Name the actual initialized config length at its phase boundary; compare the PCode argument setup and preserve one complete clear.
- b-connect-ulong-phase: objdiff 98.6%, exact 13, data 2432; 4/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Name the actual initialized config length at its phase boundary; compare the PCode argument setup and preserve one complete clear.
- b-connect-size-late: objdiff 98.632256%, exact 13, data 2432; 3/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Name the actual initialized config length at its phase boundary; compare the PCode argument setup and preserve one complete clear.
- b-init-byte-reply-signed-length: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare genuine byte-field type choices and the distinct reply-address length lifetime; preserve field widths, offsets, values, and all siblings.
- b-init-byte-reply-plain-length: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare genuine byte-field type choices and the distinct reply-address length lifetime; preserve field widths, offsets, values, and all siblings.
- b-init-byte-reserved-signed: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare genuine byte-field type choices and the distinct reply-address length lifetime; preserve field widths, offsets, values, and all siblings.
- b-init-byte-reserved-plain: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare genuine byte-field type choices and the distinct reply-address length lifetime; preserve field widths, offsets, values, and all siblings.
- b-init-byte-reply-reserved-signed: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare genuine byte-field type choices and the distinct reply-address length lifetime; preserve field widths, offsets, values, and all siblings.
- b-init-byte-reply-only-named-length: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare genuine byte-field type choices and the distinct reply-address length lifetime; preserve field widths, offsets, values, and all siblings.
- b-init-attempt-ready-zero: objdiff 94.22349%, exact 20, data 2800; 1240/1606 positional diffs, 1606/1584 instructions; sections {'.data': 364, '.sdata2': 8}. A real inline connection attempt calls the exact existing connection routine and classifies its error, ready, or pending state once.
- b-init-attempt-preserve-result: objdiff 94.98043%, exact 20, data 2800; 1190/1594 positional diffs, 1594/1584 instructions; sections {'.data': 364, '.sdata2': 8}. A real inline connection attempt calls the exact existing connection routine and classifies its error, ready, or pending state once.
- b-init-attempt-early-ready: objdiff 94.416664%, exact 20, data 2800; 1228/1603 positional diffs, 1603/1584 instructions; sections {'.data': 364, '.sdata2': 8}. A real inline connection attempt calls the exact existing connection routine and classifies its error, ready, or pending state once.
- b-init-header-control-u8-preheader: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the zero control words of the outgoing packet separately from its reserved byte, at a real protocol or message boundary.
- b-init-header-control-u8-message: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the zero control words of the outgoing packet separately from its reserved byte, at a real protocol or message boundary.
- b-init-header-control-u16-preheader: objdiff 97.429924%, exact 20, data 2800; 1232/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the zero control words of the outgoing packet separately from its reserved byte, at a real protocol or message boundary.
- b-init-header-control-u16-message: objdiff 97.429924%, exact 20, data 2800; 1232/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the zero control words of the outgoing packet separately from its reserved byte, at a real protocol or message boundary.
- b-init-header-control-u32-preheader: objdiff 97.429924%, exact 20, data 2800; 1232/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the zero control words of the outgoing packet separately from its reserved byte, at a real protocol or message boundary.
- b-init-header-control-u32-message: objdiff 97.429924%, exact 20, data 2800; 1232/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the zero control words of the outgoing packet separately from its reserved byte, at a real protocol or message boundary.
- b-init-header-control-int-preheader: objdiff 97.429924%, exact 20, data 2800; 1232/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the zero control words of the outgoing packet separately from its reserved byte, at a real protocol or message boundary.
- b-init-header-control-int-message: objdiff 97.429924%, exact 20, data 2800; 1232/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the zero control words of the outgoing packet separately from its reserved byte, at a real protocol or message boundary.
- b-init-phase-protocol-limit: objdiff 97.558716%, exact 20, data 2800; 1244/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Give scan attempts and the protocol retry limit their own meaningful lifetimes; retain the same signed limits, arithmetic, and cleanup paths.
- b-init-phase-scan-count: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Give scan attempts and the protocol retry limit their own meaningful lifetimes; retain the same signed limits, arithmetic, and cleanup paths.
- b-init-phase-both: objdiff 97.58712%, exact 20, data 2800; 1236/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Give scan attempts and the protocol retry limit their own meaningful lifetimes; retain the same signed limits, arithmetic, and cleanup paths.
- b-init-phase-protocol-limit-int: objdiff 97.558716%, exact 20, data 2800; 1244/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Give scan attempts and the protocol retry limit their own meaningful lifetimes; retain the same signed limits, arithmetic, and cleanup paths.
- b-init-cache-replyAddressLength-u16: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare the scalar type of the actual named packet/address byte while retaining both distinct protocol fields and all uses.
- b-init-cache-replyAddressLength-u32: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare the scalar type of the actual named packet/address byte while retaining both distinct protocol fields and all uses.
- b-init-cache-replyAddressLength-int: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare the scalar type of the actual named packet/address byte while retaining both distinct protocol fields and all uses.
- b-init-cache-requestMessageType-u16: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare the scalar type of the actual named packet/address byte while retaining both distinct protocol fields and all uses.
- b-init-cache-requestMessageType-u32: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare the scalar type of the actual named packet/address byte while retaining both distinct protocol fields and all uses.
- b-init-cache-requestMessageType-int: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare the scalar type of the actual named packet/address byte while retaining both distinct protocol fields and all uses.
### Round-b retained result and rejected paths
- Retain the bounded manufacturer-copy helper returning the actual memcpy destination or NULL on oversized input. The whole operation has the original strlen, length store, bounds predicate and memcpy side effects. Its inlined return path produces the target ble plus unconditional branch exactly, recovering one instruction. The void-return control collapses to the earlier bgt and is rejected. No explicit status constant or additional source guard is retained.
- Enable explicit inlining with `-inline on,noauto` for AOSS only. The helper leaves no standalone function in the object; all 20 exact siblings and all 2800 data bytes stay exact. No auto-inlining change is applied to other units.
- Give the outgoing reply-address length its own protocol-preheader value, `sizeof(replyAddress)`, and use it only for the outgoing address byte. The target caches this outgoing length separately from the bound socket address and materializes the received-address length at SORecvFrom. Sharing one named length across outgoing and received addresses is worse and was rejected. The retained source reaches 1580/1584 instructions and objdiff 97.602905%, from 1578/1584 and 97.39141%.
- Remaining Init count/control-flow gaps are the three duplicate target bne pairs and a preheader constant-cache difference. In the retained source, the preheader caches outgoing length 8 and rematerializes message type 0x11 inside case 2; the target caches both and freshly materializes reserved-byte zero in case 2. The target's repeated success branches remain absent. Switch dispatch, actual connection-result helpers, packet-header helpers, field signedness, phase-specific attempt limits and scoped helper pragmas did not reproduce those blocks without regressions or extra instructions. No repeated guard is added.
- The existing unassigned socketOptionResult guard is preserved from main and round-a evidence. This round adds no uninitialized local or use-site volatile access.
- The correct function-local static order is IfConfig before IpConfig. It emits `AOSSi_NcdIfConfig$546` at .bss offset 0, size 350, and `AOSSi_NcdIpConfig$547` at .bss offset 352, size 1988. Its code still has the same 2/155 WLANConnect differences, so neither the static conversion nor symbols.txt renames are retained. A one-object scoped conversion moves BSS ownership and drops mini-report data to 88; reject it. Direct-object forms have 35 differences.
- Fresh baseline WLANConnect mwdbg output is byte-identical to its native object, SHA256 d7bd88764fe0389c06b8152702db15765d5bbc8209385b0988b65acfffd3af83. The differing argument order is present in backend-01 before register allocation and stays unchanged in backend-03 and backend-04. It is not created by final scheduling. Capture is `/tmp/g-aoss-b-mwdbg/connect`.
- Typed byte/word/union config buffers, named actual clear lengths, C++ with C linkage, and Gekko/750/740/7400 scheduling models leave WLANConnect at 2 differences. Other processor models regress exact siblings and are rejected. No AOSSLink, SDK header, buffer-layout, compiler-version or processor change is retained.
- Re-ran the complete single/pairwise optimizer sweep on both new manufacturer-helper and outgoing-length shapes. Best positional results are their defaults, 1224 and 1235 respectively. No exact hit. Saved sweep output is `/tmp/g-aoss-b-sweep.log` and `/tmp/g-aoss-b-sweep-final.log`.
- The first C++ trials appended an existing global language option and remained C, so their compiler failures are not coverage; the corrected trials replace the option. Two late static-declaration forms failed C89 parsing, then compiled in a corrected phase block. These failures are recorded separately.
- Target objects are side effects of the DTK split rule, not individual Ninja outputs. An attempted forced rebuild removed the two cached target objects and exposed this rule boundary. `build/tools/dtk dol split config/43U/config.yml build/43U` restored and freshly extracted all 1028 target objects. Final report and gate run after the split completed.
Round-b coverage: 95 successful compiler trials, 13 compiler failures, 85 distinct successfully compiled source texts, plus two full 121-setting optimizer sweeps. Equivalent source and assembly variants are controls rather than new levers. Both units remain NonMatching.
### Round-b final verification
```text
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[src/scene/setting/AOSS] pool: IDENTICAL
[src/scene/setting/AOSS] objdiff: code 9856/16192 data 2800/2800 functions 20/21 fuzzy 99.0620 linked code 0
[src/scene/setting/AOSS] instruction-exact functions: 20/21
[src/scene/setting/AOSS] section .bss size 2368 match 100.0
[src/scene/setting/AOSS] section .data size 368 match 100.0
[src/scene/setting/AOSS] section .sbss size 32 match 100.0
[src/scene/setting/AOSS] section .sdata size 24 match 100.0
[src/scene/setting/AOSS] section .sdata2 size 8 match 100.0
[src/scene/setting/AOSS] section .text size 16192 match 99.062004
[src/scene/setting/AOSS] below 100: AOSS_Init_old 97.602905
[src/scene/setting/AOSS] baseline: code 9856/16192 data 2800 functions 20 fuzzy 98.9792
[src/scene/setting/AOSSLink] pool: IDENTICAL
[src/scene/setting/AOSSLink] objdiff: code 1576/2196 data 2432/2432 functions 13/14 fuzzy 99.6357 linked code 0
[src/scene/setting/AOSSLink] instruction-exact functions: 13/14
[src/scene/setting/AOSSLink] section .bss size 2344 match 100.0
[src/scene/setting/AOSSLink] section .data size 48 match 100.0
[src/scene/setting/AOSSLink] section .sbss size 40 match 100.0
[src/scene/setting/AOSSLink] section .text size 2196 match 99.635704
[src/scene/setting/AOSSLink] below 100: AOSSi_WLANConnect 98.70968
[src/scene/setting/AOSSLink] baseline: code 1576/2196 data 2432 functions 13 fuzzy 99.6357
regressions vs baseline: 0
global matched_code_percent: 99.20325 -> 99.20325
global fuzzy_match_percent: 99.97636 -> 99.97681
global complete_code_percent: 94.18519 -> 94.18519
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
```
Focused fresh checks: AOSS pool 1/1 identical; AOSSLink 0/0 identical. Init ctxdiff: src 0x18b0 base 0x18c0 insns 1580/1584; positional odiff 1235/1584. WLANConnect ctxdiff and odiff: 2/155, equal 0x26c sizes. Full report comparison against the fresh 87214ff9 baseline has zero dropped metrics or exact functions. AOSS source object has 21 functions and no standalone manufacturer helper; its SHA256 is 2ba93d96290eb40486ca6bcdd366b473316f0351c9957cedc5211aebe471dbcd. Target SHA256 is 18f927be300389e255324bc1ee9e797788502a837b6eb54dd17cab780b0c3247.
Retained paths: src/scene/setting/AOSS.c, configure.py, tools/decomp-assist/g-aoss.attempts.md. No new exact function. AOSS remains 20/21 exact with 2800/2800 data; AOSSLink remains 13/14 with 2432/2432. Both units stay NonMatching and unlinked. The source change is a validated partial improvement, not an exact match or completion. Existing rx67c.attempts.md remains untracked and untouched.

View File

@@ -0,0 +1,222 @@
# g-cardseq attempts
Assigned sol-med, agent/w1009/g-cardseq, HEAD 54ca052b, identical to fetched origin/main at start. Existing untracked perm5 and swe2ifd0 logs remain untouched. Read opus-common fully before repository work, local AGENTS.md, unslop, writing-for-agents, relevant sol-x3 rounds and o2-cardseq-sdmem histories. Used graphify read-only to locate the thread's calls; live source and target object establish all measurements.
Acceptance requires both owned functions to have equal size, zero instruction differences and exact-name objdiff 100%, identical pool/data and no sibling regression. Flip configure.py only after the entire unit is exact, then require the target DOL SHA1 and final quick gate. Retain readable source, scoped optimizer pragmas or compiler intrinsics only when verified. The assigned task forbids carrier structs.
Fresh full 43U build passed and DOL checker passed. Baseline report has 28/30 exact functions, cardThreadMain 99.73422%, loadCardFileIcons 97.31445%, data 1496/1496. Pool identical at all 43 entries. Early single/pair optimizer sweep output is in /tmp/g-cardseq-combosweep.log. Trials compile private source/object files under /tmp/g-cardseq-trials using the live unit flags and check both owned functions, all 28 exact siblings and the pool including literal offsets.
The first five trial lines report raw allocated-data byte equality, which is false even on the unchanged baseline. These sections contain relocations and are not a valid direct retail-data comparison. Later trials explicitly check pool equality. The final objdiff report independently verifies every owned data section at 100%.
## Compiled trials
- baseline: thread 2/301, icons 126/512; exact siblings lost []; data equal False.
- reply-intrinsic-direct: thread 3/301, icons 126/512; exact siblings lost []; data equal False.
- reply-intrinsic-named: thread 3/301, icons 126/512; exact siblings lost []; data equal False.
- reply-intrinsic-assign: thread 3/301, icons 126/512; exact siblings lost []; data equal False.
- reply-intrinsic-shift-mask: thread 256/300, icons 126/512; exact siblings lost []; data equal False.
- intrinsic-opt_propagation-off: thread 32/301, icons 126/512; exact siblings lost []; pool equal True.
- intrinsic-opt_lifetimes-off: thread 124/302, icons 126/512; exact siblings lost []; pool equal True.
- intrinsic-opt_dead_code-off: thread 3/301, icons 126/512; exact siblings lost []; pool equal True.
- intrinsic-opt_dead_assignments-off: thread 3/301, icons 126/512; exact siblings lost []; pool equal True.
- intrinsic-ppc_iro_level-1: thread 197/303, icons 126/512; exact siblings lost []; pool equal True.
- intrinsic-opt_common_subs-off: thread 175/302, icons 126/512; exact siblings lost []; pool equal True.
- command-packet-opt_propagation-off: thread 32/301, icons 126/512; exact siblings lost []; pool equal True.
- command-packet-opt_lifetimes-off: thread 124/302, icons 126/512; exact siblings lost []; pool equal True.
- command-packet-opt_dead_code-off: thread 3/301, icons 126/512; exact siblings lost []; pool equal True.
- command-packet-opt_dead_assignments-off: thread 3/301, icons 126/512; exact siblings lost []; pool equal True.
- command-packet-ppc_iro_level-1: thread 197/303, icons 126/512; exact siblings lost []; pool equal True.
- command-packet-opt_common_subs-off: thread 175/302, icons 126/512; exact siblings lost []; pool equal True.
- image-transfer-before-sector: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
- image-transfer-top-declared: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
- image-transfer-after-sector-declared: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
- comment-order-address-base-offset-readSize-sectorSize-result: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
- comment-order-result-sectorSize-readSize-offset-base-address: thread 2/301, icons 119/512; exact siblings lost []; pool equal True.
- comment-order-sectorSize-readSize-offset-base-address-result: thread 2/301, icons 123/512; exact siblings lost []; pool equal True.
- comment-order-offset-readSize-base-address-sectorSize-result: thread 2/301, icons 123/512; exact siblings lost []; pool equal True.
- offset-unsigned: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
- offset-mask: thread 2/301, icons 477/511; exact siblings lost []; pool equal True.
- offset-split: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
- offset-after-format: thread 2/301, icons 249/512; exact siblings lost []; pool equal True.
- inline-body-readCardImages: compile failed, see /tmp/g-cardseq-trials/inline-body-readCardImages.compile.txt
- inline-body-readCardComment: compile failed, see /tmp/g-cardseq-trials/inline-body-readCardComment.compile.txt
- inline-body-loadCardIconImages: thread 2/301, icons 241/512; exact siblings lost []; pool equal True.
- comment-seven-address-result-base-readSize-end-fileSize-offset: thread 2/301, icons 108/512; exact siblings lost []; pool equal True.
- comment-seven-offset-fileSize-end-readSize-base-result-address: thread 2/301, icons 123/512; exact siblings lost []; pool equal True.
- comment-seven-result-offset-readSize-base-address-fileSize-end: thread 2/301, icons 119/512; exact siblings lost []; pool equal True.
- comment-seven-result-end-fileSize-readSize-offset-base-address: thread 2/301, icons 117/512; exact siblings lost []; pool equal True.
- image-transfer-parent-top: thread 2/301, icons 117/512; exact siblings lost []; pool equal True.
- image-transfer-parent-before-offset: thread 2/301, icons 117/512; exact siblings lost []; pool equal True.
- image-transfer-parent-after-offset: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
- comment-exact-transfer-parent: thread 2/301, icons 99/512; exact siblings lost []; pool equal True.
- reply-new-assign-arg: thread 3/301, icons 126/512; exact siblings lost []; pool equal True.
- image-order-iconImageSize-hasTlut-icon-iconCount-shift: thread 2/301, icons 86/512; exact siblings lost []; pool equal True.
- reply-new-compound-mask: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
- image-order-iconImageSize-icon-hasTlut-iconCount-shift: thread 2/301, icons 86/512; exact siblings lost []; pool equal True.
- reply-new-const-packet: thread 3/301, icons 126/512; exact siblings lost []; pool equal True.
- image-order-iconImageSize-paletteSize-icon-hasTlut-iconCount-shift: thread 2/301, icons 29/512; exact siblings lost []; pool equal True.
- reply-new-inline-union: thread 3/301, icons 126/512; exact siblings lost []; pool equal True.
- image-order-iconImageSize-paletteSize-hasTlut-icon-iconCount-shift: thread 2/301, icons 29/512; exact siblings lost []; pool equal True.
- image-order-iconCount-shift-hasTlut-iconImageSize-icon: thread 2/301, icons 93/512; exact siblings lost []; pool equal True.
- image-order-shift-iconCount-hasTlut-iconImageSize-icon: thread 2/301, icons 99/512; exact siblings lost []; pool equal True.
- image-29-order-iconImageSize-paletteSize-icon-hasTlut-shift-iconCount: thread 2/301, icons 40/512; exact siblings lost []; pool equal True.
- image-29-order-iconImageSize-paletteSize-icon-iconCount-hasTlut-shift: thread 2/301, icons 73/512; exact siblings lost []; pool equal True.
- image-29-order-iconImageSize-paletteSize-hasTlut-shift-iconCount-icon: thread 2/301, icons 40/512; exact siblings lost []; pool equal True.
- image-29-order-paletteSize-iconImageSize-icon-hasTlut-iconCount-shift: thread 2/301, icons 38/512; exact siblings lost []; pool equal True.
- image-29-order-iconImageSize-icon-paletteSize-hasTlut-iconCount-shift: thread 2/301, icons 29/512; exact siblings lost []; pool equal True.
- image-29-transfer-sum-parentheses: thread 2/301, icons 29/512; exact siblings lost []; pool equal True.
- image-29-transfer-offset-first: thread 2/301, icons 29/512; exact siblings lost []; pool equal True.
- image-29-icon-init-shift-first: thread 2/301, icons 26/512; exact siblings lost []; pool equal True.
- image-29-icon-increment-shift-first: thread 2/301, icons 29/512; exact siblings lost []; pool equal True.
- image-29-animation-speed-assignment: thread 2/301, icons 29/512; exact siblings lost []; pool equal True.
- image-29-animation-max-compound: thread 2/301, icons 24/512; exact siblings lost []; pool equal True.
- image-29-init-iconCount-hasTlut-iconImageSize: thread 2/301, icons 29/512; exact siblings lost []; pool equal True.
- image-29-init-iconCount-iconImageSize-hasTlut: thread 2/301, icons 28/512; exact siblings lost []; pool equal True.
- image-29-init-hasTlut-iconCount-iconImageSize: thread 2/301, icons 27/512; exact siblings lost []; pool equal True.
- image-29-init-hasTlut-iconImageSize-iconCount: thread 2/301, icons 24/512; exact siblings lost []; pool equal True.
- image-29-init-iconImageSize-iconCount-hasTlut: thread 2/301, icons 28/512; exact siblings lost []; pool equal True.
- image-29-init-iconImageSize-hasTlut-iconCount: thread 2/301, icons 26/512; exact siblings lost []; pool equal True.
- image-29-second-named-count-first: thread 2/301, icons 211/512; exact siblings lost []; pool equal True.
- image-29-second-named-shift-first: thread 2/301, icons 210/512; exact siblings lost []; pool equal True.
- image-29-second-named-top: thread 2/301, icons 211/512; exact siblings lost []; pool equal True.
- image-combined-init-max: thread 2/301, icons 19/512; exact siblings lost []; pool equal True.
- image-combined-count-control: thread 2/301, icons 16/512; exact siblings lost []; pool equal True.
- image-combined-shift-control: thread 2/301, icons 19/512; exact siblings lost []; pool equal True.
- image-combined-while-count: thread 2/301, icons 19/512; exact siblings lost []; pool equal True.
- image-combined-while-shift: thread 2/301, icons 19/512; exact siblings lost []; pool equal True.
- image-combined-step-plain: thread 2/301, icons 19/512; exact siblings lost []; pool equal True.
- image-combined-init-and-step-shift-first: thread 2/301, icons 16/512; exact siblings lost []; pool equal True.
- image-combined-image-total-early: thread 2/301, icons 18/512; exact siblings lost []; pool equal True.
- image-combined-image-total-late: thread 2/301, icons 39/512; exact siblings lost []; pool equal True.
- compiler-GC-3.0a5: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
- compiler-GC-3.0a3.4: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
- compiler-GC-3.0a3.3: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
- compiler-GC-3.0a3.2: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
- compiler-GC-2.7: compile failed, see /tmp/g-cardseq-trials/compiler-GC-2.7.compile.txt
- flags--inline-deferred: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
- flags--inline-noauto: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
- flags--O3-s: thread 297/303, icons 493/527; exact siblings lost ['sendCardCopyCmd__Q23ipl10memorycardFUcs', 'sendCardMoveCmd__Q23ipl10memorycardFUcs', 'sendCardDeleteCmd__Q23ipl10memorycardFUcs', 'pollCardSlot']; pool equal True.
- flags--O3-p: thread 1077/1081, icons 463/528; exact siblings lost ['sendCardCopyCmd__Q23ipl10memorycardFUcs', 'sendCardMoveCmd__Q23ipl10memorycardFUcs', 'sendCardDeleteCmd__Q23ipl10memorycardFUcs', 'sendCardThreadStopCmd__Q23ipl10memorycardFv', 'pollCardSlot', 'probeCard__Q23ipl10memorycardFv', 'initCardThread__Q23ipl10memorycardFv', 'refreshCardSlotInfo', 'markAllCardFilesDirty', 'handleCardMountResult', 'reportCardThreadError', 'sendCardSlotState', 'clearAllCardFileEntries', 'runCardMoveOrCopy']; pool equal False.
- flags--O4-p: thread 919/926, icons 349/513; exact siblings lost ['sendCardThreadStopCmd__Q23ipl10memorycardFv', 'pollCardSlot', 'probeCard__Q23ipl10memorycardFv', 'initCardThread__Q23ipl10memorycardFv', 'refreshCardSlotInfo', 'markAllCardFilesDirty', 'handleCardMountResult', 'reportCardThreadError', 'sendCardSlotState', 'clearAllCardFileEntries', 'runCardMoveOrCopy']; pool equal False.
- image-18-derived-shift: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-18-derived-shift-control-count: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-18-derived-count: thread 2/301, icons 317/520; exact siblings lost []; pool equal True.
- image-18-count-control-early-size: thread 2/301, icons 15/512; exact siblings lost []; pool equal True.
- image-18-second-step-init-early-size: thread 2/301, icons 15/512; exact siblings lost []; pool equal True.
- image-18-count-step-for: thread 2/301, icons 18/512; exact siblings lost []; pool equal True.
- image-18-shift-step-for: thread 2/301, icons 18/512; exact siblings lost []; pool equal True.
- image-2-count-after-first-store: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-count-before-animation-loop: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-count-first-loop-control: thread 2/301, icons 4/512; exact siblings lost []; pool equal True.
- image-2-count-first-uninitialized-decl: thread 2/301, icons 16/512; exact siblings lost []; pool equal True.
- image-2-count-store: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-index-store-reference: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-index-store-pointer: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-index-store-whole-reference: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-clear-animation-helper: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-lifetime-count-after-second-store: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-lifetime-count-from-dir-before-loop: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-lifetime-count-after-first-three-stores: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-first-index-only: thread 2/301, icons 51/512; exact siblings lost []; pool equal True.
- image-2-first-index-decl-top: thread 2/301, icons 51/512; exact siblings lost []; pool equal True.
- image-2-first-index-decl-loop: thread 2/301, icons 63/512; exact siblings lost []; pool equal True.
- image-2-animation-increment-shift-before-count: thread 2/301, icons 4/512; exact siblings lost []; pool equal True.
- image-2-animation-increment-postfix: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-animation-shift-derived: thread 2/301, icons 82/512; exact siblings lost []; pool equal True.
- image-2-type-iconCount-u32: thread 2/301, icons 302/508; exact siblings lost []; pool equal True.
- image-2-type-iconCount-long: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-type-shift-u32: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-type-shift-long: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-type-icon-u32: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-type-icon-long: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-type-imageSize-u32: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-type-imageSize-long: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-type-paletteSize-u32: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-type-paletteSize-long: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-type-iconImageSize-u32: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-type-iconImageSize-long: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-type-bannerImageSize-u32: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-type-bannerImageSize-long: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-index-row-local: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-index-array-local: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-index-array-reference: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-index-store-helper: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-stores-before-counter-inits: thread 2/301, icons 383/513; exact siblings lost []; pool equal True.
- image-2-first-store-after-shift: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-first-store-after-tlut: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-both-stores-before-count: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-count-object-pointer: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-count-object-reference: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-count-state-and-counter: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-count-state-and-counter-ref: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-animation-helper-iconCount-shift-icon: thread 2/301, icons 65/512; exact siblings lost []; pool equal True.
- image-2-tlut-init-with-decl: thread 2/301, icons 7/512; exact siblings lost []; pool equal True.
- image-2-animation-helper-shift-iconCount-icon: thread 2/301, icons 56/512; exact siblings lost []; pool equal True.
- image-2-image-init-with-decl: thread 2/301, icons 8/512; exact siblings lost []; pool equal True.
- image-2-animation-helper-icon-iconCount-shift: thread 2/301, icons 65/512; exact siblings lost []; pool equal True.
- image-2-count-init-with-decl: thread 2/301, icons 10/512; exact siblings lost []; pool equal True.
- image-2-shift-init-with-decl: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- reply-intrinsic-valid-type-u8: thread 3/301, icons 2/512; exact siblings lost []; pool equal True.
- reply-intrinsic-valid-type-s32: thread 3/301, icons 2/512; exact siblings lost []; pool equal True.
- reply-intrinsic-valid-type-BOOL: thread 3/301, icons 2/512; exact siblings lost []; pool equal True.
- reply-intrinsic-valid-assignment-after-report: thread 9/301, icons 2/512; exact siblings lost []; pool equal True.
- reply-intrinsic-valid-report-variable: thread 3/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-chain-count-then-store: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-chain-store-then-count: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-chain-shift-then-store: thread 2/301, icons 10/512; exact siblings lost []; pool equal True.
- image-2-chain-store-then-shift: thread 2/301, icons 10/512; exact siblings lost []; pool equal True.
- image-2-chain-size-then-store: thread 2/301, icons 5/512; exact siblings lost []; pool equal True.
- image-2-chain-store-then-size: thread 2/301, icons 5/512; exact siblings lost []; pool equal True.
- image-2-first-count-while: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
- image-2-first-count-for-assignment: thread 2/301, icons 4/512; exact siblings lost []; pool equal True.
- image-2-first-count-shift-begin: thread 2/301, icons 24/512; exact siblings lost []; pool equal True.
- image-2-first-count-shift-middle: thread 2/301, icons 21/512; exact siblings lost []; pool equal True.
- image-2-first-count-shift-end: thread 2/301, icons 21/512; exact siblings lost []; pool equal True.
## Retained source and remaining differences
Retained loadCardFileIcons is 512/512 instructions, 2 differences, exact-name objdiff 99.98047%, up from 126 differences and 97.31445%. cardThreadMain is unchanged at 301/301 instructions, 2 differences and 99.73422%. The unit remains 28/30 exact, code 6600/9852, data 1496/1496, fuzzy 99.96346%. No exact function or linked-byte gain is claimed. configure.py remains NonMatching.
The comment read now declares its real address, result, base, read size, end, file size and offset together before their original assignments. A replay of the fresh allocator capture found the necessary local order, and the compiled source matches the entire comment region. The image read's aligned transfer size is calculated by its caller and passed to readCardImages. Naming the total image size preserves the target addition order. Animation locals and zero initializers follow the measured order, and the frame-duration update uses compound assignment. The icon-format loop uses iconCount directly and derives its bit shift from iconCount * 2, eliminating the second loop's extra source counter. The overwritten initialization immediately before the for initializer was removed; the object remains byte-identical to the winning compiled trial.
The existing target-proven reserved-format palette path is preserved. Moving paletteSize out of the per-iteration scope gives the target's persistent register value across frames. No initializer or alternate reserved-format behavior was introduced. The original target proof and previously merged implementation are recorded in o2-cardseq-sdmem.attempts.md.
Fresh captures live under /tmp/g-cardseq-mwdbg/runs/icons-fresh, icons-29 and icons-2. The private launcher uses the previous Opus transport on port 9137, with the same unmodified compiler and real unit flags. Its outputs remain under /tmp/g-cardseq-mwdbg. Baseline regsim reproduces 375/375 virtual registers. Every allocated and relocation section of icons-2/unit.o equals the final independently built Ninja object.
Remaining icon differences are instruction 135 add r10,r4,r30 instead of add r4,r4,r30 and instruction 136 stb using that address register. In the final capture the first-store address v188 interferes with animation counter v84, whose required target color is r4. Moving initializers, field pointer/reference views, actual count-reset helpers, first-loop forms and chained assignments did not remove this overlap. Reordering the existing declarations cannot assign both interfering values r4. A new source shape must change this edge; the capture does not prove that such a shape is impossible.
The thread still differs at instructions 48 and 49. Its existing valid-first packet folds to li r4,256 followed by inserting command r19. Command-first bitfields and __rlwimi produce insertion into command r19 using the hoisted constant-one register, then copy to r4. Scoped propagation-off preserves the wanted validity r25 operand but leaves copy coalescing and other differences. Compiler versions GC/3.0a5 and 3.0a3.2 through 3.0a3.4 produce the same baseline; alternative inline modes do too. Lower optimization levels introduce regressions and were discarded. No thread edit or compiler setting is retained.
159 successfully compiled source/flag candidates were saved and scored. Two missing-helper diagnostic variants and the GC/2.7 trial failed compilation and were discarded. Each of two optimizer sweeps compiled the baseline, 15 single settings and 105 pairs; neither improves its seed. The second sweep's seed already has 2 icon differences. Two loop-update comma variants were diagnostics only and are excluded by the source policy. Every retained change is ordinary C++ with no carrier, assembly, dummy data, volatile cast, added code comment or unrelated edit.
Fresh pool comparison including literal offsets is identical at all 43 strings. ctxdiff independently confirms both remaining 2-difference streams. All four data sections are 100% in the live objdiff report. A separate whole-report comparison against the frozen beginning-of-run report finds zero code, data, function or link drops and no lost exact function. origin/main advanced during the run; this leaf stays on its assigned 54ca052b baseline without rebase or merge. Parent integration must repeat the gates on its current main.
## Final gate
The required final quick gate ran once and passed. The full 43U build succeeds, the DOL SHA1 is independently verified, baseline drops are zero, and the source scan reports zero forbidden additions and zero readability warnings. Final allocator replay reproduces 375/375 virtual registers. The report and object checks still show two nonexact functions; no Matching flip is justified.
```text
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[src/scene/cardSequence/iplCardSequence] pool: IDENTICAL
[src/scene/cardSequence/iplCardSequence] objdiff: code 6600/9852 data 1496/1496 functions 28/30 fuzzy 99.9635 linked code 0
[src/scene/cardSequence/iplCardSequence] instruction-exact functions: 28/30
[src/scene/cardSequence/iplCardSequence] section .bss size 16 match 100.0
[src/scene/cardSequence/iplCardSequence] section .data size 1464 match 100.0
[src/scene/cardSequence/iplCardSequence] section .sbss size 8 match 100.0
[src/scene/cardSequence/iplCardSequence] section .sdata size 8 match 100.0
[src/scene/cardSequence/iplCardSequence] section .text size 9852 match 99.96346
[src/scene/cardSequence/iplCardSequence] below 100: cardThreadMain 99.73422
[src/scene/cardSequence/iplCardSequence] below 100: loadCardFileIcons 99.98047
[src/scene/cardSequence/iplCardSequence] baseline: code 6600/9852 data 1496 functions 28 fuzzy 99.4093
regressions vs baseline: 0
global matched_code_percent: 99.20325 -> 99.20325
global fuzzy_match_percent: 99.97473 -> 99.97657
global complete_code_percent: 94.18519 -> 94.18519
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
GATE PASS
```
Only src/scene/cardSequence/iplCardSequence.cpp and this attempts log are retained for a local commit. Existing untracked perm5 and swe2ifd0 logs remain untouched. No push, PR, merge, rebase, subagent or other-worktree edit.

View File

@@ -0,0 +1,109 @@
# g-chansvm CHANSVmStep
Base 54ca052b, branch agent/w1009/g-chansvm, worktree data-d2.
Baseline CHANSVmStep 5012 bytes, odiff 262/1253 differing, objdiff 97.23%.
Pool identical, 125 entries. Unit has one non-exact function.
Recovered o2 structural findings from /tmp/o2-chansvm/sstr1.c, preserving current
const-correct conversion signatures and exact helper implementations.
Split five result matrices and five constant objects, replace cross-object
base indexing, restore loop/stack object/case-local structure.
Recovered build: odiff 299/1253, equal 5012-byte size, register-masked diffs 6
from scheduling at 511, 598, 836. All 232 other functions exact; pool identical.
Early single/pair pragma sweep: best 299, no improvement.
Allocator capture CHANSVmStep-20261009-082339 reproduces 478/478 GPRs.
Centralizing and uniquely naming scalar locals preserves 299/1253 exactly.
C++ replay of regsim searched 100000 declaration permutations, seed 11,
35 -> 5 saved-register mismatches. Compiled source 299 -> 44 differing.
Target enum traversal starts with the left operand; correcting it gives 42.
Explicit load/ref object pointers restore CopyObject argument scheduling,
42 -> 38, 5012 bytes; one 2-instruction scheduling tie remains.
Trials on declaration-order source: u16/s16 arraySize, separate byte
assignments, widened shift/add forms change instruction count and were rejected.
s32/u64/s64 index, split byte temporaries, simple read helpers and property
operand/object locals preserve codegen. Separate property index gives 46.
Property status/flag assignment order and inline array helper preserve 38.
String load: direct pVm->pActiveCtx accesses eliminate the ctx/index swap,
38 -> 29. A distinct decoded propertyOffset separates it from the absolute
program counter and allows in-place masking, 29 -> 26. Remaining 26:
GET_PROPERTY_NAME operand/object/index register cycle (12), NEW_ARRAY
accumulator/size register swap (12), status/flag scheduling (2).
Whole Step inline helper: equal size but 321 differences, rejected.
Lookup/read/array helper wrappers: unchanged. Scoped property variables:
unchanged or worse. Signed/widened array size: unchanged or extra instructions.
Earlier array accumulator lifetime: 36 differences, 14 masked, rejected.
Scoped opt_lifetimes off: equal size, 44 differences, same 2 masked ties;
other tested optimizer/scheduling pragmas worsen instruction structure.
Lifetime trials: off + separate propertyIndex scores 25, equal size and two
masked scheduling differences. Captures 085030 and 090247 replay exactly
(458/458 and 459/459), but each has two GPR passes. Final-pass-only
declaration search finds two simulated misses (array accumulator/size),
yet compiling its full permutation changes the first-pass rematerialization
choices and scores 123. Treat the final-pass graph as insufficient here;
freeze high-degree loop values when searching. Default pragma source at 26
remains the retained candidate until a full compiler replay improves it.
Intrinsic rlwimi forms, array helpers under lifetime-off, output-argument
lookup/decode, property symbol locals, and flag output pointers preserve
codegen. Direct array header accesses lose one instruction; early/success-only
accumulator pointers alter scheduling and were rejected.
Freezing degree >= 100 locals preserves the first-pass spill/rematerialization
choices. Final-pass search seed 62 (100000 permutations) improves 25 -> 14
in the full compiler, with all other 232 functions still exact. Retain the
function-scoped opt_lifetimes off setting and this declaration order.
Use a shared u64 maxIndex = 0xFFFFFFFEULL for the three integer bounds instead
of repeated split high/low temporaries; this preserves the 14-diff output.
Remove obsolete instruction union, unused ctx and comma expressions.
Sharing the accumulator pointer between BIT_NOT and NEW_ARRAY gives 14 -> 2.
The shared value's interference graph now selects r14 for the array pointer
and r17 for the decoded array size, as in the target. Sharing it with the
LOAD_STRING_CONST pointer independently reaches the same 2 differences;
other accumulator and size-local merges fail to improve or regress.
Latest capture: CHANSVmStep-20261009-093935 in
/mnt/drive2/projects/wii-ipl-workers/_mwdbg/runs/.
Reduced source build/g-chansvm/twoflagfirst.c reproduces the full function.
Regsim reproduces all 458/458 virtual registers. This variant writes status
before the flag in C; backend-00-initial-code B261 has li before stw, but
backend-01-before-regalloc already moves stw ahead of li. Reversing the two
C assignments does not change the final object.
Remaining exact ctxdiff, 5012 bytes and 1253/1253 instructions:
836 source stw r26,0xc(r1); target li r14,0
837 source li r14,0; target stw r26,0xc(r1)
All registers and all other instructions, including relocations, agree.
Final tie trials, all rejected: status/flag assignment order; negative
property guards; status locals and merged error temporaries; status assigned
from DeleteObject; status hoisted ahead of the switch or set in each arm;
separate property flag; address-based flag access; flag integer widths and
boolean normalization; const/static-const status values; inline flag setter
and full property-enumeration helper. Moving result or foundEntry through
every scalar declaration position never fixes the scheduling pair.
A complete single/pair pragma sweep on the 2-diff source retains 2 as best;
explicit scheduling/peephole on also retains 2. Numeric scheduling pragmas
are rejected by MWCC. GC/3.0a5 and every available 3.0a3 variant also retain
2; 2.7/2.6 reject the unit's ipa option. No compiler-version change retained.
Fresh final unit report: CHANSVmStep 97.23 -> 99.840385 percent; odiff and
relocation-aware ctxdiff 262 -> 2. Exactly 232/233 functions, unchanged.
Data 6904/6904 (100 percent), pool identical across 125 strings.
Matching flip is withheld because CHANSVmStep is not exact.
Final gate command:
python3 /mnt/drive2/projects/wii-ipl-workers/_restore0928-tools/gate.py src/channelScript/CHANSVm --quick
GATE PASS: full 43U build, 0 regressions, 0 forbidden patterns, 0 readability
warnings, identical pool, all five data sections 100 percent.
DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d.
Unit remains NonMatching and linked code remains 0; the verified DOL still
uses the original CHANSVm object. This is an improvement, not an exact handoff.
The pragma's address/lifetime effects are documented in captures 085030,
090247 and 093935: ref/load/index frame slots and address recomputation stay
at the target locations, while high-degree roots must remain fixed to avoid
changing the first-pass rematerialization choice.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,108 @@
# g-keyboard attempts
Worktree data-d4; branch agent/w1009/g-keyboard; base 54ca052b.
Read opus-common.md in full. No pushes, PRs, rebases, or cross-worktree edits.
Initial full 43U build passed; DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d.
Baseline odiff: calcCursorPos 43/326, create 153/356, inputChar 73/136.
Two InputForm saved diffs are byte-identical and omit addButtonAnimation declaration.
Unrelated preexisting untracked files preserved.
o2-keyboard.wip.diff: original build fails for missing member declaration. Repaired declaration: pool identical, calcCursorPos 39/326, create 128/356, equal sizes. opus-inputform.wip.diff SHA identical; same source/build/measurement.
opus-tistring.wip.diff: compiled, pool identical, 70/136 differing, size 0x210 vs 0x220. Rejected: append tests an always-zero buffer slot and alters generic newline behavior. Restored baseline for honest trials.
## Compiled trials
Single/pair pragma sweep on saved InputForm + original tiString: no exact hits or gains.
32 direct rectangle-reference/copy/size-vector forms: best 39, copies worse.
28 consistent geometry helper forms: best 50.
208 helper-scope pragmas/newline reset variants for inputChar: best 60; none exact.
90 chain/temporary/ref-return/clear variants: best 59, none exact.
GC versions 3.0a3 through 3.0a5.2: tiString unchanged; older InputForm versions regress 5 functions. GC 2.6/2.7 reject ipa.
Create: existing selectInputTextName reuse gives 120 differences; complete scoped declarations 135-138; constrained regsim reaches only 8/15 requested assignments.
Read-only prior scratch has a fully consistent calcCursorPos geometry-helper form, reproduced at 8/326. All surviving differences swap the zero constant f29/f30 with scale.x. Prior 20-difference inconsistent-helper forms excluded.
Initializer/declaration trials: best stays 8. Malformed generated named-zero-top trials used a self initializer; excluded from all results and never retained.
Further calc trials: 36 helper order/body forms, 48 scalar-reference forms, 150 scoped single/pair pragma combinations, 14 corrected constant/declaration variants, 30 local-math bodies, 18 glyphBottom signature/definition-order forms. Best remains 8; no exact.
Further create trials: 24 free animation-helper forms best 120; 16 whole animation-loop helpers best 106 but runtime count reload changes the target instruction shape. 16 row-helper forms best 117.
Fresh allocator trace saved in /tmp/g-keyboard-calc8trace. FPR zero = v89/f30, scale.x = v82/f29, scale.y = v95/f31. Simulator proves moving scale.x beyond v89 or zero below v82 fixes all colors, but the tested readable expressions do not produce that numbering.
## Retained source
Consistent glyphBottom and scaledExtent use at every glyph calculation; no mixed direct/helper forms. Reuse existing selectInputTextName in create and the saved substantial animation-resource helper with its missing header declaration. No optimization pragmas retained.
Fresh own-object report: calcCursorPos 93.05215 -> 99.877304, odiff 43 -> 8, 0x518 both; create 96.40169 -> 98.16011, odiff 153 -> 120, 0x590 both. Unit exact functions stay 219/221; data stays 3772/3772.
inputChar unchanged, 90.757355%, odiff 73/136; exact functions stay 41/42, data 288/288.
No fully exact unit; Matching flips are prohibited for this result.
24 glyph-initialization helper and 12 grouped geometry/output helper forms did not beat 8. Compiler tie remains: f29/f30 swap between zero and scale.x. InputChar reset/chain helpers retain a real conditional block or fold the indexed writes; no honest form reproduced the branchless dead compare.
Final review extended scaledExtent to the input-form width bound as well as every glyph width. It preserves the same 8 differences. Chaining the height helper through scaledExtent was measured separately.
Initial gate after retained changes: GATE PASS, zero regressions, zero forbidden patterns, zero readability warnings. Full build and DOL SHA1 passed. A final gate after the width-bound consistency edit follows.
Final GATE PASS: full 43U build ok; DOL 26116613f624061ba99c8d1a299aaa6efa85670d; identical pools; all owned data sections 100%; 0 regressions; 0 forbidden-pattern additions; 0 readability warnings. No exact function gains. Units remain NonMatching.
Height helper chaining gave 81 differences and was rejected. Final instruction counts remain calcCursorPos 8/326, create 120/356, inputChar 73/136.
## Round b, MAX, 2026-10-09
Assigned worktree data-d4, branch agent/w1009/g2-keyboard, HEAD 5046adc6.
Read opus-common.md and this log again. Preserved preexisting untracked files.
Fetched origin under /tmp/wii-git.lock; origin/main moved to ad5b9dea during setup.
Round-a source remains the starting point. Fresh full 43U build passed with DOL
26116613f624061ba99c8d1a299aaa6efa85670d. Both owned pools are identical.
Baseline report: tiInputForm 219/221 exact, data 3772/3772; tiString 41/42 exact,
data 288/288. calcCursorPos has 8/326 differences, all f29/f30 swapping scale.x
and the glyph zero constant. create has 120/356; inputChar has 73/136.
Reviewed the prior single/pair pragma sweep rather than repeating its unchanged
source candidates. Read the original-object Ghidra bodies, prior allocator trace,
levers, and saved inputChar diffs. Used graphify only to check cursor callers;
current source and object measurements remain the matching evidence.
calcCursorPos: 240 new compiled forms covered rectangle-based width helpers,
scale-vector parameter forms, a nested axis-scaling helper, and explicit zero
arguments for glyph initialization. The best stays 8/326. Vector parameters put
the zero constant in f29, but swap scale.x/scale.y in f30/f31 and alter scheduling
at wrap transitions, leaving at least 25 differences. Explicit zero arguments
preserve the eight-difference baseline. None retained.
create: 32 new detached-row and normal-button construction helper forms compiled.
The best remains 120/356; detached-row forms give 123, and copying button data
regresses code generation. None retained. Private compiler source paths rename
__sinit_\tiInputForm_cpp; that name-only difference was excluded from the private
regression counter. Final measurement uses the real source path.
calcCursorPos: 32 additional value-returning glyph initialization helper trials;
30 compile and change stack placement/instruction count. Two harness-invalid
named-zero aggregate forms are excluded. None retained.
inputChar: the saved R1 diff remeasures at 61/136 and 0x21c, not the historic 12,
on the current source. A real CharacterOutput::clear loop plus a u16 member count
reaches 13/136 with equal 0x220 size and no other function drops. It clears prior
buffer characters before resetting the count when a newline is appended. The
caller appends one character to a fresh output, so its observable output is the
same as the baseline. This is a lead under review, not an exact match.
The clearing loop is unnecessary for the 13-difference result. Removed it and
kept only newline reset in the existing append method and a u16 member count.
This minimal form independently rebuilds to 0x220, 136/136 instructions, 13 diffs.
It reconstructs the newline test proved by target instruction 68, cmplwi r4,0xa.
The target has no consuming branch; our remaining bne/li and counter allocation
are explicitly unresolved. All 13 differences are at instructions 66-78. Both
cursor-add paths now match without extra helpers. The caller constructs an empty
output and appends one character; resetting its count on newline preserves the
output for every character, including newline and the ignored 0xfffe sentinel.
The count is bounded by the 8-element buffer and is narrowed in the target.
32 finish/count/index forms, 48 cursor-advance forms, 24 further real clear-loop
forms, 48 output-write helper forms, and 180 scoped single/pair pragma forms do
not beat 13. No loops, output-write helpers, cursor helpers, or pragmas retained.
48 coupled scale-vector/height-helper forms do not beat calcCursorPos 8; their
best is 25. Every rejected source/header experiment stays outside the worktree.
Private trial records: 712 attempts, 710 compiled. Two named-zero aggregate factory trials fail to compile and are excluded. Raw records are in /tmp/g-keyboard-b-results.jsonl.
Final round-b verification: GATE PASS, full 43U build ok, DOL SHA1
26116613f624061ba99c8d1a299aaa6efa85670d. Pools identical; all owned data sections
100%; 0 regressions; 0 forbidden-pattern additions; 0 readability warnings.
Gate output: /tmp/g-keyboard-b-final-gate.txt.
Fresh exact-name objdiff: calcCursorPos 99.877304%, create 98.16011%, inputChar
90.757355% -> 93.55882%. odiff/ctxdiff inputChar 73 -> 13, size 0x220 both,
136/136 instructions. tiInputForm stays 219/221 exact and tiString stays 41/42.
No new exact functions. Both units remain NonMatching; no Matching flip is valid.
Retained changes: src/keyboard/tiString.cpp and this log only. No push, PR, merge,
rebase, other-worktree edit, or modification of preexisting untracked files.

View File

@@ -0,0 +1,14 @@
## scanAP (w1010 revisit) — inlined-bool materialization wall
Orig inlines `Animator::isPlaying()` (`mState == 1` at +0x14) 3x but always as a
MATERIALIZED bool: `lwz rX,0x14; addi r0,rX,-1; cntlzw r0,r0; rlwinm. r0,r0,27,5,31; bne`.
Ours fuses to `lwz r0,0x14; cmpwi r0,1; beq` — 6 insns shorter overall (272 vs 266).
Tried and rejected (MWCC normalizes/folds all of them):
- `isPlaying() == false` at the call site
- `bool playing = anim->isPlaying(); if (!playing)` named local (fuses; eggColorFader's
fadeOut materializes only because `success` is also RETURNED — a second value-use)
- `int isPlaying()` return type — still fuses
- `return !(mState != ANIM_STATE_PLAY)` in the header — still fuses
Conclusion: orig's bool crosses a real value-boundary (2nd use, or a different inlined
shape we haven't identified). Same family as the fused-compare fossil in CHANSVm.
Also tried: convertRevIP untouched (98.7, 292B).

View File

@@ -0,0 +1,83 @@
# o-ifl attempts: link src/keyboard/tiInputForm
Worktree data-d4, branch agent/w1009/o-ifl, base 12e857a9. Start: 221/221 exact, code and data 100%,
NonMatching. A Matching flip failed with multiply-defined `Decolated` and `CommandReceiver` vtables;
37/221 functions were in target order.
## How MWCC (GC/3.0a5.2, -ipa file) lays out this TU
Measured with small test files and the real unit:
- Non-inline definitions are emitted in source order.
- An inline function is emitted right after the definition that first "touches" it, if anything needs
an out-of-line copy (a non-inlined call, a virtual call, a vtable). A touch is any call in the source,
even one that is inlined and leaves no code, and an unused result still counts.
- When a non-inline function is inlined into a caller, its touches stay with its own definition. When an
inline-only helper is inlined, its touches go to the caller.
- Virtual calls touch the statically resolved function (no relocation, so dtk shows them as UNREF).
- A constructor touches the destructors of its bases.
- The key function is the first virtual declared in the class without a body. Defined non-inline here:
strong vtable. Defined `inline` out of class: weak vtable when referenced. Declared `inline` or with a
body in the class: skipped, the next one becomes the key.
- `.data` vtables are emitted in reverse class-definition order. The vtable tail (inline virtuals only a
vtable needs) follows the same order; per class: overrides with thunks first, then inherited inlines per
base in reverse slot order, then the class's own inlines in reverse declaration order. A class whose
vtable is never emitted (`Sample`) still runs this and re-touches inherited thunks.
- `.sdata2` constants follow emission order. Weak `.data` objects keep their space when the object's
`.data` is referenced section-relative (`...data.0`); weak `.sbss` and unreferenced `.sdata2` objects are
dropped by the linker.
## Changes (all 221 functions stay exact; every other object is byte-identical)
1. Vtable ownership. In this TU's view (TIINPUTFORM guards): `textinput::Base` is all inline and its weak
vtable is emitted here; `~Decolated`, `clear`, `set` and `~CommandReceiver` have bodies in the class, so
their key functions stay in tiString/tiTextInputBase. `GUIComponent::init` and the other header helpers
are `inline` in the .cpp. Decolated, CommandReceiver and GUIComponent vtables are no longer emitted.
2. Header classes' small functions (WithAtok stubs, Decolated/WithZi/StringBase/textdrawer/Animation
getters, candidatebox, `~RowInfoManager`) are inline instead of strong definitions here.
3. Definitions in target order. Base's small virtuals that the target emits from the vtable tail or after
their first caller are inline; `textinput::Base::init` is touched by an inlined
`CommandReceiver::init()` in `Base::init`.
4. Touch order inside `onCommand`/onPress*: the original factored some blocks into non-inline helpers
(inlined everywhere, then dead-stripped). Recovered as `usesZiPrediction`, `hasZiPredictions`,
`checkUnfixConverting_`, `setAtokMode_`, `trimString_`, `startConverting_`, `resetRelation()` calls,
and `int selected` before `commitPredicted`. Each one is inlined to the same code.
5. Include `tiUtil.h`/`tiGUIManager.h` first (target `.data` vtable order), the real `inputform::Sample`
(as in tiKeyboard.cpp) after the local classes (tail and thunk order, nothing emitted for it),
WithAtok declares `isFix/setFix/initConverting` before its overrides (tail order, same vtable).
6. Removed the `scInputForm*` dummy constants (nothing referenced them) and the unused
`extern "C" asm` declarations; `sbCompatibleFilterEnabled` now precedes `mbHyphen` in `.sdata`
(both were 0x01, objdiff could not see the swap).
Result: 219/221 in target order; `.data`, `.rodata`, `.sdata`, `.sbss`, `.bss` and thunk order match.
## The remaining two: a dead-stripped function after makeUpCursorPos
Target emits `getDrawModifyEndLine` and `getEndPos` right after `makeUpCursorPos`, and `0.5f` right after
`getScale`'s `1.0f` in `.sdata2`, before `calc`'s constants. No code in the target calls the two getters,
and an unused virtual call is never removed. Skyward Sword's software keyboard REL (zeldaret/ss,
`d_SoftwareKeyboardNP` symbols, read-only) has the same `makeUpCursorPos` (0x44) followed by
`StringBase::getWCString`, `getDrawModifyEndLine`, `getEndPos`, `drawFixString`. So the original file had a
function here that touched those three and first used 0.5f, and the linker stripped it as unreferenced.
Its body is not recoverable.
Proof: an external stand-in between `makeUpCursorPos` and `drawFixString` that calls the two getters and
returns 0.5f gives 221/221 in order and, with tiInputForm Matching, DOL SHA1
26116613f624061ba99c8d1a299aaa6efa85670d, 0 differing bytes. An unused `static` stand-in fixes the
function order but not the constant (unused statics are not compiled).
This stand-in is an uncalled function, so it is kept in a separate commit for the owner to accept or drop.
## objdiff `.sdata2` artifact
objdiff now scores `.sdata2` 92% (clean commit) / 96% (linked commit): the weak `GetTextColor` copy brings
the `NW4R_ASSERT` color constant `{255,255,255,0}` into `.sdata2`; the linker strips it, the original
object had it too (its `@STRING@GetTextColor` survives in `.data`). The old 100% came from the dummy
`scInputForm*` names. With the link, complete data is 3772/3772.
## Dead ends
- `s16` local before `commitPredicted`: extra `mr` (onCommand 99.84%); `int` is exact.
- Making AnmPane strong or NormalButtonAnmPane weak, moving the local classes: no effect on the tail.
- Removing `#pragma section const_type ".data"` (non-const local array): template moves to `.rodata`,
three functions change. Left as it was.

View File

@@ -0,0 +1,37 @@
# o-ifl2 attempts: tiInputForm `.sdata2` data match
Worktree data-d4, branch agent/w1009/o-ifl2, base da267147 (tiInputForm linked, #1332).
Start: `.sdata2` 96.15%, unit data 3668/3772, global matched data 99.99432%.
## What the stripped constant is
- The original TU compiled `nw4r::lyt::TextBox::GetTextColor` (inline, `NW4R_ASSERT` -> OSFatal):
`LayoutByNW4R::create` calls it out of line (target reloc at .text 0x9ef0), and its weak
`@STRING@GetTextColor__Q34nw4r3lyt7TextBoxCFUl` (the Error#004 message, 0x41) sits in this unit's
`.data` at 0x8165D28C. The linker kept RsoSystem's copy (0x8135A4C0, earlier in link order) and
dropped this one along with its `{255,255,255,0}` front-color literal in `.sdata2`.
- So the weak instantiation is correct. Removing it would drop 0x41 bytes from `.data`.
- dtk 1.7.5 `stripped` cannot describe it: the flag exists for common-BSS matching, and stripped
symbols "don't actually exist at the address" and are filtered out of splits. The split `.sdata2`
is the 104 DOL bytes; nothing can add the 4 stripped bytes.
## Why objdiff scored 96%
objdiff 3.4.5 `diff_data_section` takes the better of a byte diff of the section (100 vs 108 bytes
here: the extra literal plus 4 bytes of double alignment -> 200/208 = 96.15%) and symbol pairing.
Compiler literals (`@N`) pair by value. The target's `.sdata2` symbols were the invented
`scInputForm*` names from #626 (they matched dummy named constants that #1332 removed), so nothing
paired and the byte diff decided. RsoSystem's object also carries an extra literal (`@17197`, 0.0f,
ahead of `scRsoZeroF`) and scores 100% the same way: its target symbol pairs.
## Fix
`config/43U/symbols.txt` 0x81694D28-0x81694D90: the 25 `scInputForm*` entries become the 22
anonymous literals the source emits (`@N`, `scope:local`, project convention for 655 `.sdata2`
entries). The four one-byte `scInputFormColor*U8` entries are one 4-byte object: `drawCursor`'s
`GXColor color = {255, 50, 50, 0}` initializer (4 lbz at +0..+3). Numbers are from the current
compile. objdiff ignores them for pairing.
Result: `.sdata2` 100%, unit data 3772/3772, 221/221 exact, DOL SHA1
26116613f624061ba99c8d1a299aaa6efa85670d, gate PASS with 0 regressions, global matched data 100%.
No source change.

View File

@@ -0,0 +1,71 @@
# o-sections: linked units with .text section below 100%
Task: `check_decomp_complete.py` failed on three linked units whose functions were
all 100% but whose `.text` section score was not: iplSound 99.49785,
iplBoardObject 99.73868, iplButton 98.53095.
## Cause
objdiff 3.4.5 scores a code section as the size-weighted mean of the target
symbols' match percent, with an unpaired target symbol counted as 0
(`diff_generic_section` in objdiff-core/src/diff/data.rs). The per-function list
in the report hides this: for a `complete` unit, `report.rs` falls back to 100%
when a target symbol has no partner. Pairing is by exact name, plus
`name$<digits>` against `name$<digits>` (`symbol_name_matches`). The report
ignores objdiff.json `symbol_mappings` (it uses `MappingConfig::default()`).
Each unit had exactly one unpaired target function, equal to the missing bytes:
| unit | target symbol | built symbol | bytes |
|------|---------------|--------------|-------|
| iplSound | `__dt__Q33ipl3snd6UnkClsFv` | `__arraydtor$15981` | 0x1c |
| iplBoardObject | `init__Q43ipl5scene11BoardObject29@class$8157iplBoardObject_cppFv` | `...30@class$12470...` | 0x18 |
| iplButton | `push__Q33ipl7utility36Queue<Q43ipl5scene6Button7Command,8>FRCQ43ipl5scene6Button7Command` | `push_button_queue` | 0x70 |
Extra weak or dead-stripped functions in the built objects do not affect the
score (only target symbols count).
## Fixes
- iplSound: the target function is `__destroy_arr(_seBlk, ~tagSSeInfo, 0xc, 16)`,
the compiler's array destructor for `tagSSeInfo _seBlk[16]`; `UnkCls` was a
placeholder. Renamed in symbols.txt to `__arraydtor$15982`. The `$<digits>`
rule pairs it with any number, so header churn cannot break it.
- iplBoardObject: the `@class$NNNN<file>` id is a TU-wide counter that moves
with any earlier header change (30039 -> 8157 upstream, now 12470; my
iplQueue.h change alone moved it to 12471). objdiff cannot pair it unless the
number is exact, so a symbols.txt resync would go stale on the next header
edit. Named the class `StandData` (identical code) and renamed the symbol to
`init__Q43ipl5scene11BoardObject9StandDataFv`.
- iplButton: `push_button_queue` was an extern "C" stand-in (first asm, then C)
for `mReservedCmd.push(command)`, added because the in-class `Queue::push`
instance is emitted right after `reserveAnm` (DOL mismatch). In the target,
`push` is the last function before the `@20@` dtor thunk, and in
NandSDCardManager all Queue instances sit at the end of the TU in first-use
order (push<Thumb,15>, pop<Thumb,15>, push<Command,4>), with single-caller
pop<Command,4> inlined. That is deferred template instantiation: `push` and
`pop` were defined outside the class. Moved both out of class in
`utility/iplQueue.h` and restored `mReservedCmd.push(command)`.
- iplNandSDCardManager: its `#pragma sym on` ("actually needed to match") was
the old workaround for the same placement. With out-of-class push/pop the
pragma splits three ordinary functions into a second `.text`; without it the
layout matches the target. Removed it. Same 72 functions, identical bytes.
## Results
- `.text`: iplSound 100, iplBoardObject 100, iplButton 100; NandSDCardManager,
iplBoard and iplSceneManager still 100 in every section.
- Pools identical in all five touched units; DOL SHA1 unchanged.
- check_decomp_complete.py: only remaining failure is main/src/keyboard/tiString
(`inputChar__Q39textinput8tistring9DecolatedFw` 93.55882, unit not linked).
## Tried and rejected
- Template `push` in-class (da7 queue-01): exact bytes but placed after
reserveAnm, DOL changes.
- Out-of-class push with `#pragma sym on` kept in NandSDCardManager:
on_get_thumbnail, clean_command_queue and getAsyncResult move into the
second `.text`; layout breaks.
- Out-of-class push only (pop in-class), no sym pragma: push instances at the
end but pop<Thumb,15> stays mid-file; target needs it between the pushes.
- symbols.txt resync to `@class$12470`: works now, breaks on the next header edit.

View File

@@ -0,0 +1,69 @@
# o-tistr attempts (tiString Decolated::inputChar)
Worktree data-d5, branch agent/w1009/o-tistr, base 12e857a9. inputChar 13/136 at start and at end.
Scratch: /tmp/o-tistr (bf/run.py variant runner, sched/schedsim.py scheduler model, cap/ per-pass captures
with extra pre-RA hooks 0x4695dd/0x4695ee/0x469602 and global-optimizer start/end hooks).
## Kept
The dispatch is now `if (mode == TM_Kana || mode == TM_Roman) ... else if (mode == TM_Hangul) ... else`
instead of the two gotos and labels. .text and .data are byte-identical to the goto form; inputChar stays 13.
## Why the target's Hangul block is not reachable from any single-block shape
Target: `li r6,0; sth r6,0x10(r1); cmplwi r4,0xa; slwi r0,r6,1; ...`.
1. The scheduler cannot produce `li; sth; cmplwi` from one block. A block {li P; sth P; cmpli; bf} always
comes out `li; cmpli; sth` (v013 compiles it that way, and the MWCC list-scheduler model with 750 latencies
li 1, sth 2, cmpli 3 reproduces it: cmpli fills the second IU slot in cycle 0). Without the branch the result
is the same. GC3's Scheduler_Schedule (0x5995c0) has no "already scheduled" check, and the final call is
force=1, so every block with more than 2 instructions is rescheduled after RA. The only things removed after
the final schedule are branches to the next instruction (optimize_branches at emission).
So in the original, `[li; sth]` and `[cmplwi]` were separate blocks at the final schedule.
2. MergeAdjacentBlocks (0x596960, run in the global optimizer, before RA and after RA) merges a block into
its successor when the edge is the only successor and the only predecessor. The cmplwi block must therefore
have had two predecessors (or the `[li; sth]` block two successors) at every merge. This is how the
dead compare in WADImportDVDExForBS survives in its own block: it is the join block of the previous
`if (header.tmdSize != 0)`.
3. The split before the cmplwi block must be invisible in the final code. Every compare in the target uses cr0,
so the entry 0xfffe compare and the kana range compare cannot be reused (a reused cr would get another
field). Only the mode compare of the `else if` can be reused. Verified: with a function-scope
`s32 mode = mTranslateMode;` (all other code unchanged, still 13) an inner `if (mode == TM_Hangul)` is
not folded by IRO and the backend VN reuses the compare: `li r6,0; sth r6,0x10(r1); bne; ...; cmplwi r4,0xa`
(variant ml1, 72 diffs because both then-blocks keep `li r6,0`). A reloaded member test or a bool computed
at the top does not work (reload, or a materialized bool).
4. Both then-blocks must be empty by emission, and the index still needs two reaching definitions at both
constant-propagation passes (otherwise `input[n] = ch` folds to `sth r4,0x10(r1)`).
- GC3 value numbering never deletes or replaces a redundant `li` of a named local. Even with the
function-start zero record killed by a call, `n = 0` in the then-block survives (variant callbreak).
It deletes only temporaries and array-to-register vregs (the o3 LinePosition mechanism).
- The store's literal zero only lands in the counter's register when the counter is a named local whose
2-operand `li` comes first in that block (VN pass 1 merges within the block). A temp or an a2r field is
replaced by the function-start zero (r5) instead.
These two facts contradict each other for a single counter, and every shape that empties the then-blocks
either loses the store register (p1, poc1, poc2, bf1, bf2) or keeps a `li` (ml1, base). A struct-reset
then-block also makes IRO drop the inner mode test (bf1, m1, m2, modeloc1).
5. count: the use-site `clrlwi r0,r29,0x10` survives only if count's Hangul definition at the first
constant-propagation pass is not an extension. `lhz` is not treated as extended (probe p3 f1), a `rlwinm`
is (v001-v003 lose it).
## Other measured shapes (diffs)
switch on mode 120; switch on ch 60 (signed cmpwi); if/else with equal arms folded 73; do/while(false),
goto label, for(;;) break, while(ch=='\n') break 61-72; `((void)0)` then-block folded 73; volatile store 62
(not a barrier); bool flag before the store 72; aggregate-initialized buffers emit stw; empty ifs and single-def
index with opt_dead_code / opt_propagation / opt_common_subs / opt_dead_assignments / opt_lifetimes off: no
change (73); scheduling off 61; peephole off 137-140; optimization_level 0-3 127-151.
Next idea not finished: a then-block whose definition is a copy `n = m` with `m` copied from `n` in the
newline block after a join (const-prop cannot fold it, VN deletes it). It needs a second join before the
copy, so the same contradiction comes back.
## Closest structural lead (40 diffs, not kept)
With the function-scope `mode` local, `LinePosition position; position.index = 0; input[0] = position.index;`
then `if (mode == TM_Hangul) { position.index = 0; }` and `u32 n = position.index;` gives the target's first
block exactly (`li r6,0; sth r6,0x10(r1)`, then a `bne` on the reused cr0). Two things still differ: the inner
then-block keeps `li r6,0` (IRO scalarizes the field into a named local, which VN never deletes), and IRO's
dead-store pass removes a newline then-block that only resets the position, so the `cmplwi` disappears.
The gate for this round passed with the dispatch cleanup only (0 regressions, DOL hash unchanged).

View File

@@ -0,0 +1,75 @@
# o2-aes-idct attempts
Worktree data-d11, branch agent/w1009/o2-aes-idct (from origin/main 20cf9f9f). 43U only.
## Unit-level checks
- Compiler sweep (all GC and Wii compilers; `-ipa file` dropped for GC < 3.0): aes GC/3.0a3 .. 3.0a5.2
identical (7/9), older or Wii compilers worse. idct_block_var GC/3.0a3 .. 3.0a5.2 identical (0/2).
Version is not the lever for either unit.
- combosweep (single + pairwise pragmas): aes best 137 -> 135 (opt_propagation off), no lead.
## net/aes: AESiEncryptBlock 137 -> 0, AESiDecryptBlock 215 -> 0 (unit Matching, DOL OK)
Tooling: `tree.py` symbolically executes a function and compares the expression tree of every
store against the target, independent of registers and scheduling. That separated "wrong
dataflow" from "wrong allocation", which earlier rounds had mixed together.
Findings, in order:
1. The target round is plain rijndael-fst order `hi ^ m16 ^ m8 ^ lo`, then `^ key`. The target
tree is `(lo ^ (m8 ^ (hi ^ m16))) ^ key`. At -O3/-O4 MWCC rebalances any 4-leaf XOR chain
(tree height reduction): every one of the 120 shapes tried compiled to `(x^y)^(z^w)`. At
optimization_level 2 it is not rebalanced, but level 2 cannot unroll the decrypt key loop,
which the target does (mtctr 2), so the unit is O4.
2. With the rotate written as the `__rlwinm(x, n, 0, 31)` intrinsic instead of the shift/or
macro, O4 leaves the chain alone (intrinsic calls are not reassociated), and the natural
expression gives exactly the target tree. It also removes the CSE temporaries the shift/or
macro created for the table loads (x used twice), which is what had kept the allocation off.
3. Final round: encrypt `(hi<<24 | m16<<16 | m8<<8 | lo) ^ key[i]`; decrypt is XOR-based with the
key first, `key[i] ^ hi<<24 ^ m16<<16 ^ m8<<8 ^ lo` (O4 rebalances it the target way).
4. Encrypt init: `state = input[i]; ... state ^= key[i]` with `key = context->keys` walked by
`key += 4` (single-expression init put keys[i] in the state register; 9 diffs).
5. Decrypt: `key = context->keys; key += rounds * 4;` (the one-expression form folds +16 into
the loads). InvMixColumn as `static inline void AESiInvMixColumn(u32* word)` (pointer
parameter) fixes the last r7/r8 swap between value and timesTwo; value-parameter helpers and
all local declaration orders left 26+ diffs.
Rejected along the way: optimization_level 2 pragma (correct tree, wrong key loop), int/long
casts between XOR stages (blocks rebalancing but unnatural).
`include/global/decomp/ide.h`: declared `__rlwinm` for non-MWCC tooling (guarded by
`#ifndef __MWERKS__`, no build effect).
## buffer/idct_block_var: Lumi and Col (in progress)
Dataflow first (path-based symbolic execution of both objects, `ptree.py`):
1. Even part: the target computes `rot + (c6 + c2)` into a fresh variable. `x = rot + x` is
rewritten by MWCC to `x += rot` (operand order `sum + rot`), and a single-use `evenSum`
gets forward-substituted and reassociated (`c2 + (rot + c6)`). Fix: `evenSum = c6 + c2;
c2 = evenRotation * 0xB5 >> 8; evenRotationSum = c2 + evenSum;` (the c2 reassignment
blocks the substitution). Same in both passes of both functions.
2. AC test: the target ORs leaf-first (`c2 | acc`). `acc |= c` or `acc = c | acc` with a u32/s32
accumulator is canonicalised to acc-first, a single 7-way expression is rebalanced at O4.
An `int` accumulator over `s32` coefficients (`acBits = c2 | acBits;`) keeps leaf-first
(the long->int conversion stops the `|=` rewrite).
3. Level 2 or 1 cannot be it: no CTR row loop at level 2 (274 vs 257 insns).
With 1-2, all store/call trees of Lumi (3 paths) and Col (4 paths) equal the target and the
frame sizes match. Remaining differences are allocation and scheduling only.
Allocation findings (mwdbg + regsim, `wantmap.py` maps candidate vregs to target registers by
symbolic value):
- Named locals are numbered per block in reverse declaration order, blocks top-down (function
scope first), forward-substituted locals take no number; split webs and inline locals become
`@` temps numbered after all named locals.
- Column setup now matches exactly: `pitch4/7/6/5/3/2` as named locals assigned before the
loop, a separate column cursor (`src`, not a split web of the row cursor), and
`for (column = 7; column >= 0; column--)` (CTR trip count becomes a temp colored first).
- Declaration-order search inside blocks on the captured graph tops out at 113/153 target
registers, and a greedy order-feasibility check stalls on callee-saved claim order, so the
column AC block still has a different pre-RA schedule (live ranges).
- objdiff fuzzy is the gate metric and disagrees with positional diff counts; searches now
score candidates with objdiff itself (`odfuzzy.py`, one-unit objdiff project per slot).

View File

@@ -0,0 +1,84 @@
# o2-aoss attempts (2026-10-09)
Worktree data-d1, branch agent/w1009/o2-aoss at origin/main 20cf9f9f.
Scratch compiles in /tmp/o2-aoss (same flags as ninja, ~0.2 s per unit).
## Findings that apply to both AOSSLink functions
- IRO is skipped for AOSSi_WLANGetBSSList and AOSSi_WLANConnect. Enabling
MWCC's own IRO dump (flag byte 0x725e5c, log opened by 0x5ed500 in
GC/3.0a5.2) shows both stop after IRO_BuildflowGraph. The cause is the
check at 0x5bd060/0x5bd150: any EOBJREF to an object whose qualifiers carry
alignment bits (0x1f000000) disables IRO for the whole function. Here that
is `WD_Info info ATTRIBUTE_ALIGN(32)` (and `scan`). Removing the attribute
makes IRO run, but it also drops the 32-byte frame alignment the target
has. Type-level `ATTRIBUTE_ALIGN(32)` on the WD structs is ignored by this
compiler (sizeof/alignof unchanged, no aligned frame), so the target also
ran without IRO. Source shape maps almost 1:1 to PCode in these functions.
- Ported MWCC's pre-RA list scheduler and the 750 machine model to Python
(/tmp/o2-aoss/sched.py). It reproduces our B1/B14 of WLANConnect, the
target B1, and our B19 of GetBSSList exactly. Facts it needed: stores to
the same local at different offsets are independent; a store cannot issue
while another store sits in LSU stage 2; ties go count -> height -> opcode
rank (MR 0 < STH 1 < ADDI 2 < LHZ 3 < LI 4) -> program order.
- With mwdbg extended with dump points before/after pre-RA scheduling and
after each COptimizer level-4 pass (private copy, /tmp/o2-aoss/mwdbg2):
the scheduler input for both blocks equals our final code minus nothing.
Both target orders need one extra instruction in the block at scheduling
time that is gone later (RA coalescing or post-schedule cleanup).
## AOSSi_WLANGetBSSList: 25 -> 3
regsim with the parameter pinned (/tmp/o2-aoss/ordanneal.py) found 1500
declaration orders reaching all 11 target registers. Common constraints:
index < driver < buffer < descriptor < count < cleanupRetries < unlockRetries
and result < startupRetries < scanRetries. Declared C89-style at the top in
that order (block-scoped declarations moved up): 25 -> 3, pool identical.
Remaining 3: block after `memset(buffer, 0, 0x3200)`, target issues
`sth channelBit` before `li r5, 6` (so the lhz temp can be r5). Simulator:
any one extra instruction in that block at scheduling time gives the target
(dead VN copy, extra addi, ...). Tried, all still 3: `&scan.bssid`, scan
pointer local, inline scan-param initializers (2 shapes), inline memset
wrappers (void and returning), statement order permutations, unpacked WD
structs (header override).
## AOSSi_WLANConnect: 2 (unchanged)
Second memset: target `li r4; li r5; mr r3, r27`, ours `li r4; mr r3; li r5`.
Simulator: only an extra instruction on the address chain
(lis -> addi -> X -> mr r3, X later coalesced) reproduces the target; no
reordering of the block's inputs does, and a dead side copy does not.
Explicit copies through a second local (i6, n3), inline helpers with a
param or a cast local (m0/m1 x void/int x global/var), getter inline,
NULL-initialised pointer, extern/global/static/struct-wrapped configs
(struct gives `addi r27, r3, 0x160`: right order but one extra insn),
array decay, casts: all removed by the COptimizer "pre" phase (peephole 0 +
DCE) before scheduling, or by VN. 2 unchanged.
## AOSSi_WLANGetBSSList: 3 -> 0 (EXACT)
The missing instruction is a copy that lives until pre-RA scheduling and is
coalesced by the allocator afterwards. A copy into a named local survives the
COptimizer when its uses are in other blocks (the block-local peephole cannot
rewrite them). A typed view of the scan buffer does exactly that:
`void* buffer` for alloc/memset/free, `u8* scanBuffer = (u8*)buffer;` right
after the memset, used by WD_Scan, the BSS count and the first descriptor.
The copy sits in the scan-parameter block at scheduling time, so `sth` of
channelBit issues before `li r5, 6` (target), then r24 holds both names.
Variants that did not work: alias for the count pointer only (3), alias
assigned before the memset (3).
## AOSSi_WLANConnect: more evidence (still 2)
- Pass tracing (dump after every COptimizer level-4 call): the in-block copy
chain `addi vB; mr vC, vB; mr r3, vC` is collapsed by 0x596850 (block-local
copy forwarding + DCE, pre phase); copies created later by value numbering
(0x5976e0) get their uses canonicalised to the first holder. So a chain
copy in the memset block cannot come from a plain second local.
- Simulator searches: no input order, no 1-2 dead extra instructions
(return copy, li, mr, addi, lis), no 1-2 side copies reproduce the target.
Only (a) a copy on the address chain or (b) r4 and r5 both coming from
register copies at scheduling time do.
- Pragma sweep (15 single + all pairs, unit-wide, diagnostic): best is
baseline 2; `peephole off` 11, `scheduling off` 50.

View File

@@ -0,0 +1,105 @@
# o2-aterm attempts (ATERM, 2026-10-09)
Start (a6e74ad2): ATERM 22/26 exact; open: DiscoverAccessPoints 7, BuildEncryptedMessage 2,
BuildAssociationRequest 28, RunConfigProtocol 294.
End (2882435b): 25/26 exact; BuildEncryptedMessage 2 (scheduler tie-break, below). ATERM stays
NonMatching.
## Prior art: the DS build of the same library
The DS DWC library ships the same NEC "AtermStation" code with its real static names
(CacaBueno64/ie3ogres `lib/TwlDWC_dl/asm/util/atermset.s`, read-only). Name map:
ScanAP = DiscoverAccessPoints, CheckAccessPoint = FindChangedApRecord, GetMacEncKey =
BuildAssociationRequest, GetWLanSetElement = ParseAssociationResponse, AsciiToHex = ParseHexBytes,
StoreNetParam = ApplyScanSecuritySettings, AutoConfigThreadEx = RunConfigProtocol,
keywrap_encrypt/decrypt = AesKeyWrap/Unwrap, rijndael* = Aes*, MY_MD5Update = Md5Update,
PutHex/PutMac = the hex and MAC formatters (non-inlined on DS, so their bodies are visible).
## MAC formatter (DiscoverAccessPoints 7 -> 0, BuildAssociationRequest 28 -> 0)
Cause: the register swap was input pointer r9 vs r5 and low nibble r5 vs r9. With the
`nibbles[2]` array helper both nibbles are codegen temps, which are numbered above every inline
variable and therefore colored first, so the low nibble always took r5 (array element types,
declaration orders, 400 sampled formatter shapes, pragmas and compiler versions: no change).
The DS PutHex keeps one nibble variable and rotates it: `h = (c & 0xF0) >> 4; for (2) { emit h;
h = c & 0xF; }`. On MWCC the loop-invariant `c & 0xF` becomes an IR temp numbered below the
inline locals, so it is colored last (r9), and PutMac's `*mac++` parameter takes r5. Both
functions exact; ParseAssociationResponse (GetWLanSetElement calls PutHex on DS) stays exact with
the same helper (`key += atermFormatHexByte(key, *optionValue++)`), so the separate straight-line
atermEncodeHexByte is gone.
## Readability: scan buffer header
`(u16*)scanBuffer + 1` replaced by `((AtermScanBuffer*)scanBuffer)->descriptorWords`
(count, then the descriptor word stream): 0 diffs. Typing the scanBuffer local itself as
AtermScanBuffer* changes the alignment arithmetic (98 diffs, size 0x418).
## RunConfigProtocol (294 -> 2) = DS AutoConfigThreadEx
Rebuilt from the DS layout instead of the hand-inlined body: GetTickCount, Sleep (alarm), SendNotify,
SendFrame -> SendBroadcast -> SendFrameViaInterface, GetFrameData/GetCommandElement,
GetElementData/GetFirstElement, SetElementData/SetSingleElement/SetSearchRes, RFC 1321 MD5
Init/Encode/Final/memset as static inlines, globals used directly (no request/packet/response/session
pointer locals). Findings, each measured:
- .bss order follows the first reference in the function IR. Passing a cast global address
(`(u8*)&gAtermDecodedResponse`, `(u16*)buf`) into a static inline hoists it to the function entry
and moves it first. The element buffer is a plain `u8[0x800]` in the original (like FrameData), so
it is now one, with an AtermElementHeader view; that keeps the target order without pointer locals.
- Inline helper uses of a global address get a hoisted register (r25/r31/r15) while direct call
arguments rematerialize `addi rN, base, off`. This is plain MWCC behaviour, matching the target.
- MD5: the exact RFC 1321 Encode/MD5_memset text (`unsigned int` lengths, `unsigned char` masks)
keeps IRO from unrolling the Encode loops, so the PCode unroller produces the target's
load/store order (u32 types: 35 diffs; RFC types: 0).
- SetElementData must advance its own cursor parameter (`cursor += recordSize; return cursor;`)
for the r16/r17 alternation; the value pointer as `cursor + sizeof(AtermOptionHeader)`.
- GetFrameData returns `frame + sizeof(AtermFrameHeader)` (not `packet->payload`), declares
`end` before `cursor` (inline locals number in reverse order); SetSingleElement writes through a
header pointer local.
Remaining 2 at 23addcb1: SetSearchRes' second element folds its value pointer to the first
element's base (`addi r3, r16, 0xc`, target `addi r3, r17, 4`).
## RunConfigProtocol (2 -> 0): the DS SetElementData body with an int pad size
Found with IRO dumps. The compiler prints them once two dump flags are set: gdb breaks at
0x5ed507 (log open) and writes 0x725e5c, then toggles 0x725e5c/0x70f24d per function at
0x577716. That is o2-keyboard's /tmp/o2-keyboard/irodump1_gdb.py; the log is `<source>.log`. A
copy that keeps its temporary source in this worktree is /tmp/o2-aterm/irod/run.sh. It drops
the AES tables and the bodies after RunConfigProtocol, which leaves the function's code identical
and takes about a minute.
- Elements 1 and 2 share one IRO block. Block-local expression propagation chains element 2's
cursor copies back to element 1's cursor temp, so element 2's `cursor + 4` reads element 1's
temp. IRO_PropagateSelfAssignments (inc/dec propagation, 0x5f2150) then folds element 1's
`+= 8` into it, giving base1 + 0xc. Elements 5 and 4 sit in their own blocks: global copy
propagation reaches them one step at a time, so they fold onto the previous element's base,
which is what the target does.
- Inc/dec propagation is all-or-nothing per `+=` def. Every reached use must have that def as its
only reaching definition. More than one use needs the helper at 0x5f24e0, which builds
`var op const` and asks a backend predicate (0x56ac90).
- The DS SetElementData does `p += sizeof(header); memset(p, 0, pad); memcpy(p, data, len);
return p + pad`. A mid-body `+= 4` kills the copy before element 2's value uses. With
`cursor += paddedLength; return cursor;` and an `int` (or unsigned int, u16, short) pad size, the
first PropagateSelfAssignments round leaves those incs alone. Element 1's `+= 8` therefore
reaches element 2's cursor copy (`@c2 = @c1 + 8`, no longer a copy) before any copy
propagation reaches the value uses, and they stay `base2 + 4`. With `s32`/`u32` (long) pad
sizes, the first round merges the `+= 4`. Second-pass copy propagation then rewrites the
value uses to element 1's temp, and the fold comes back (2 diffs). A mini repro with `int`
typedefs behaves like the `int` case, which is how the type dependence showed up. Measured
variants: E4 (`+= pad; return cursor`) int/unsigned/u16/short: 0. E4 s32/u32: 2. E1 any type: 2.
E3 (`return cursor + pad`) any type: 661.
- Bisecting the full function (other switch cases, the loop condition, atermSleep, the
epilogue) changed nothing. Only the helper text matters.
## BuildEncryptedMessage (2, unchanged): entry-block scheduler order
Target `mr r27,r5; mr r30,r3; mr r26,r4; mr r28,r6; mr r3,r27; mr r29,r7`; ours puts
`mr r29,r7` before `mr r3,r27`. The mwdbg capture shows the entry block is list-scheduled before
register allocation, with the program order r3..r7 parameter moves, `li checksum`, `mr r3,payload`,
`li r4`, `li r5`, `bl memset`. The 750 model gives the memset call latency 0, and the GPR
anti-dependency edges have latency 0. The call's operand list also clobbers r6 and r7. So the r6
copy and the r7 copy have identical dependencies, unlocked-successor counts, heights,
criticality and rank. Program order then always places both before `mr r3,payload`, but the
target puts r6 before it and r7 after. Not reachable by:
- K&R parameter declaration orders
- every `#pragma scheduling` model (740/750/7400/altivec/on/reset: 2; others: 12-40)
- key copies, extra param copies and inline wrappers (the earlier session)
Recorded as a scheduler tie-break.

View File

@@ -0,0 +1,112 @@
# o2-bs2mach attempts (BS2Mach: CheckBS2CommandStatus, BS2Tick)
Worktree data-d7, branch agent/w1009/o2-bs2mach, base 20cf9f9f (origin/main).
Start: 27/29 exact, CheckBS2CommandStatus 2/406, BS2Tick 57/1940, data 158528/158528, pool 91/91.
## CheckBS2CommandStatus (lever 35)
Target case 0x12 issues `lwz count; stw CacheCommandComplete; slwi`: the completion
store fills the load-latency slot, so it has no edge to the partition-count load
through `DataToc`. A file-scope static may alias that pointer load, a
function-local static whose address is never taken may not.
1. `static u32 CacheCommandComplete = 0;` inside CheckBS2CommandStatus (it is the
only user), completion stored before the length update as in every other case:
CheckBS2CommandStatus 0/406. Every other function unchanged, pool identical.
The static lands at the end of .sbss (after LoaderInit) instead of 0x50.
2. Compiler probe (same flags): initialized objects and function statics are
emitted in parse order, tentative definitions after them in reverse definition
order (`I1 I2 L$4 I3 T4 T3 T2 T1`).
3. AudioBufferUnconfigured..LoaderInit made tentative (initializers dropped) and
listed in reverse: .sbss order and offsets identical to the target, 28/29
exact, data 158528/158528. Target symbol renamed `CacheCommandComplete$1964`
in config/43U/symbols.txt (project convention for function statics).
## BS2Tick (57 at start)
4. Same lever in case 0: the target schedules `li 1` first and keeps the
`AudioBufferUnconfigured = 1` store free of the absolute `*(u32 *)0x800030d4`
store (unknown storage aliases every file-scope object, not a function static).
AudioBufferUnconfigured, ResetTime and SpinupDeadline are only used by BS2Tick
and sit right after CacheCommandComplete in .sbss. All three as BS2Tick
statics: 57 -> 52; only AudioBufferUnconfigured as a static gives the same 52,
so ResetTime/SpinupDeadline stay file-scope tentatives. Symbol renamed
`AudioBufferUnconfigured$2066`. .sbss order identical.
5. Store-before-load pairs the target keeps and we hoist (case 0x30
`PartitionOpen = 0; if (RegionValid == 0)`, case 0x34/0x35
`LoadingTitle = 0; switch (Block.state)`, case 0x40 `AbortFlag = 0;
if (RestartRequested == 0)` and `RestartRequested = 0; if (FatalErrorFlag)`).
Compiler probe with the unit's flags (/tmp/o2-bs2mach/probe/t2.c, t3.c): a
store to one global followed by a load of another keeps its order only when
BOTH are volatile; non-volatile/volatile, volatile/non-volatile, extern and
address-taken globals are all reordered. So the target proves PartitionOpen,
LoadingTitle, AbortFlag, RestartRequested and FatalErrorFlag volatile
(RegionValid and DVDCommandBlock.state already are). AbortFlag is also read in
BS2DVDCallback (interrupt context); RestartRequested/AbortFlag writers disable
interrupts. One-at-a-time sweeps could not see the case-0x40 chain because it
needs all three together. All five: 52 -> 42, other 28 functions unchanged.
6. Device-code block (case 5): the initial PCode has a separate `lis 0x8000` per
branch and backend value numbering merges them into the consoleType base. Per
the MWCC decomp (ValueNumbering.c), `li`/`lis` are only value-numbered when the
destination is a temporary inside the coalesce window; named locals never are.
Reading consoleType through a named `OSBootInfo *bootInfo` and sharing the
`State = BS2_STT_8` tail: 42 -> 28, block exact.
7. Case 0: `DvdProgress = (u32 *)0x800030d4; ... *DvdProgress = 0;` (as case 2
writes it) and testing `BS2NoDisk` directly: 28 -> 24 -> 12 together with 8.
8. CoverOpenTimeHigh/Low are one 8-aligned big-endian OSTime: a single
`OSTime CoverOpenTime` keeps CheckDVDCommandStatus exact (u64 store is low word
first, as in the target) and makes the case-0x42 zero high word a later temp,
fixing that whole register cluster (24 -> 14 at the time).
9. Banner check: the target loads bannerFile.length straight into r6 because it is
the 4th OSPanic argument; the format string has `(0x%08x)` and our call had no
argument. Passing bannerFile.length fixes the cluster.
10. RequiredIosHigh/Low are likewise one 8-aligned u64 (BS2StartGame reads it as a
title ID with the `== 0 -> 1:3` default). `u64 RequiredIos` gives the target
pair coloring (hi r0, lo r3, TMD r4) and keeps BS2StartGame exact.
symbols.txt: CoverOpenTime and RequiredIos as size-8 objects (only BS2Mach
referenced the halves; every relocation resolves to the same address).
BS2Tick 4/1940 left: case 0 `CoverBlock.state = 0` is ordered before the
volatile BS2NoDisk load (target: after).
### Volatile flags: per-flag evidence (current source, BS2Tick 4 diffs)
Target pairs a store to one global with a later load of another and keeps that
order; MWCC only does so when both are volatile (probe t2/t3: non-volatile,
one-sided, extern and address-taken pairs are all reordered).
- 0x3b04 case 0x30: `stw PartitionOpen; lwz RegionValid` (RegionValid volatile).
- 0x3d68 case 0x34/0x35: `stw LoadingTitle; lwz Block.state` (state volatile).
- 0x40a0 case 0x40: `stw AbortFlag; lwz RestartRequested`, then
`stw RestartRequested; lwz FatalErrorFlag`.
Dropping any single flag: PartitionOpen 4->7, LoadingTitle 4->6, AbortFlag 4->7,
RestartRequested 4->9, FatalErrorFlag 4->6; no other function changes.
### Last 4 diffs: case 0 `CoverBlock.state = 0` vs the BS2NoDisk test
Target: `lwz r0,BS2NoDisk; stw r4,AUC; cmpwi r0,0; stw r27,0xc(r3); beq`.
Ours: the CoverBlock store precedes the load. Everything else in the block,
including every register, already matches.
- BS2NoDisk, DvdTransferred and DvdTransferLength are volatile (non-volatile
BS2NoDisk hoists the load above both DvdTransfer stores; non-volatile
DvdTransferred breaks BS2DVDCallback's order against DvdReadPending).
- DVDCommandBlock.state reads are volatile in the target (BS2StartGame and
BS2StartGCGame poll it with a re-read every iteration; case 0x34 above). With
`state` non-volatile case 0 becomes exact but those break.
- So the source reads BS2NoDisk before the store. Holding it in any variable
(named, block-scoped, inline parameter/local, any same-width type) makes it a
named/`@` local, numbered below statement temps and colored after the constant
1: registers rotate (1 r0, BS2NoDisk r4, &PP r4, &0x800030d4 r5), 10 diffs.
mwdbg capture o2-bs2mach-st + regsim what-if: coloring that holder first gives
exactly the target (only those 4 nodes change). Narrow holders (u8/s8/u16/s16)
force a statement temp and get everything right except `clrlwi.` vs `cmpwi`
(1 diff). A 64-bit round trip is folded away.
- Diagnostic only, both exact 29/29, both forbidden, not committed:
`if ((BS2NoDisk | (CoverBlock.state = 0)) != 0)` (read then store in one
expression) and `*(s32 *)&CoverBlock.state = 0;` (non-volatile store).
No natural spelling found: hoisting a common leading store out of all three
branches doesn't happen (size grows); statement order grid (84 builds),
inline helpers, casts and holder types all stay at 4-10.
- Pragma sweep (combosweep, single + pairwise): BS2Tick 4 -> 4.
### Tooling note
`#pragma push / ppc_iro_level 0 / pop` tightly around BS2Tick (the last function
in the file) leaves it byte-identical, which earlier rounds read as "IRO does not
run on BS2Tick". A file-level `#pragma ppc_iro_level 0` changes BS2Tick in 1910
instructions, so IRO does run; only the scoped placement is not honored for it.

View File

@@ -0,0 +1,110 @@
# o2-cardseq-sdmem attempts
Branch `agent/w1009/o2-cardseq-sdmem` from `20cf9f9f`.
## iplSDMemory: SDMemory::drawTransferTitles (50 -> 0), unit linked
Start: 50/451 differing, register-only. Earlier Opus run (data-d9 `9b634499`) had brought it
363 -> 50 with the MSL `wcsstr` overload and `TextBox::SetTextColor`.
### Diagnosis with mwdbg + regsim
Target vs ours, GPRs only:
- alpha r31 / string-pool base r30 / bodyPane, titleSizePane r29; ours r29 / r31 / r30.
- line loop: lineCount r22, totalLines r23, `L"\n"` r24, messageLine r26, messageText r27,
lineIndex r28; ours r19 / r19 / r23 / r20 / r26 / r24.
The capture shows vreg numbering = `this`, named locals (reverse declaration order), frontend
temps (reverse creation order), then codegen vregs (string base r70 first). Coloring is reverse
simplify order and picks the lowest free register, requesting saved registers from r31 down.
Replaying the capture with relabelled vregs (`/tmp` wrapper around `regsim.simulate/color`)
reproduced the whole target when:
1. alpha lives in a codegen vreg created after the string base (any number 71..150),
2. totalLines sits between the third wcsstr's `s2` temp (v62) and lineEnd (v106/107),
3. row and visibleRows are numbered below every line-loop local,
4. messageText is numbered above lineIndex.
### Source changes that produce it
1. `nw4r::lyt::Pane::GetAlpha()` is `const` in real NW4R. With the const member the inline's
result is a codegen value, not a frontend temp, and alpha moves above the string base.
(An explicit `static_cast<u8>` around the call did the same; the const accessor is the real
declaration, so that is what landed.) 50 -> 20.
2. `visibleRows` / `row` declared in the title loop body (`s32 visibleRows = ...; for (s32 row = 0; ...)`). 20 -> 18.
3. `messageText` declared before `lineIndex`. With 2: 13.
4. No `totalLines` local: `for (lineIndex = 0; lineIndex < lineCount + 1; ++lineIndex)`.
With 1-3: 0 differing.
Types of alpha tried first (u32, s32, int, u16): no change; s8/char: worse. A named
`memoPane` local: no change.
### Linking the unit (Matching flip)
Flipping the unit failed to link: the source called six SDChannelSelect members through
`extern "C" iplSDChannelSelect_813D....` placeholders. A temporary link with the existing
mangled names linked but changed the DOL: one weak function survived dedup,
`SDMemory::TitleRange::operator=`, because SDChannelTitle hand-wrote the same compiler-generated
function as `extern "C" iplSDChannelTitle_copyTitleRange`. Fixes (all byte-identical where noted):
- SDChannelTitle: `sdRange = scene->mTitleRange;` / `nandRange = sdRange = scene->mTitleRange;`
instead of the hand-written copy; symbols.txt names 0x813E6FA0
`__as__Q43ipl5scene8SDMemory10TitleRangeFRCQ43ipl5scene8SDMemory10TitleRange` (scope:weak).
The compiler emits it at the same place. Unit stays 69/69.
- SDChannelSelect, real parameter types from the command dispatch and NandSDWorker:
`enqueueMoveNotice(ESTitleId)` (type 6 -> copy_nand_app_to_sd_async), `enqueueDeleteNotice(ESTitleId)`
(type 13), `enqueueErrorNotice(TitleIdList*, TitleIdList*)` (type 11 -> check_backup_fits_async),
`enqueueCommandNotice(TitleIdList* x3)` (type 12; the worker casts paramA-C to TitleIdList*),
collect* `titleNames` as `wchar_t (*)[21]`. Object bytes identical, only symbol names change
(symbols.txt updated for the nine functions). `friend class SDMemory;` for the private members.
- SDMemory: `TitleListState` was three `NandSDWorker::TitleIdList`s; it is now
`mTitleList / mNandTitleList / mSDTitleList`, and the calls are member calls. Still 66/66.
Full build: DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d with iplSDMemory Matching.
gate.py (SDMemory, SDChannelSelect, SDChannelTitle) --quick: 0 regressions, GATE PASS.
## iplCardSequence: loadCardFileIcons (213 -> 135, equal size)
Kept (all functions of the unit otherwise unchanged, pool identical):
- Format-3 palette left uninitialized (lever 10). Asm proof: in the target icon loop r6 is
paletteSize; its only writes are `li r6,0x400` (case 1), `li r6,0x800` (case 2) and `li r6,0`
(case 0). Case 3 branches (`cmpwi r4,3; bge`) straight to the iconOffset update that reads r6
(`add r22,r6,r22` / `add r21,r6,r21`) and `add r7,r7,r6`; no instruction writes r6 between
function entry and the loop. Case 0 sets paletteSize to 0 itself. 213 -> 387 (511 insns) with
the array form, -> 192 (512/512) with the existing `u8* iconPalette` pointer form.
- Image read as `static inline s32 readCardImages(...)`: the target's CARDRead failure is
`bge +8; b <check>` into the shared `if (result < 0)` test, the shape of an inlined early
`return` (a goto folds to `blt`, a top-level return branches to the epilogue).
- Comment read as `static inline s32 readCardComment(...)`: with only the image helper the two
sector-size slots swapped (0x8/0xC); as a second inline its `sectorSize` gets 0x8 again, and
its early `return 0` / final `return result` give the target's comment flow.
- Banner/icon setup + image read as `loadCardIconImages(...)`, and the block base/offset split
as `getCardBlockAddress(address, &offset)`: 231 -> 135, slot/fileNo/dir get r24/r25/r26.
Allocator analysis (mwdbg + regsim, a want-map derived by aligning backend-01/04 PCode with the
target): remaining diffs are register-only. Target colors iconAddressBase r31, then the four
CSE multipliers (fileNo*64 r30, slot*8128 r29, fileNo*4 r28, slot*508 r27), dir r26, fileNo r25,
slot r24, iconAddressOffset r23; comment base r23 / offset r21 / readSize r22 / result r29.
In the current capture iconAddressOffset sits in the last simplify scan (colored first, r31)
and iconAddressBase leaves one scan earlier; no numbering of the existing temps fixes both.
### loadCardFileIcons 135 -> 126
- NONE case as `u8* previous = &...iconFmt[iconCount - 1]; ...iconFmt[iconCount] = *previous;`:
gives the target's `add; lwz; addis; subi; add; lbz -1(p); stb 0(p)` shape (134). The array
form and `p[-1]` forms keep the -0x6fb4 in the displacement instead.
- Animation setup written in place with the icon loop's own `iconCount`/`shift`/`icon`, initialized
`shift, iconCount, hasTlut, iconImageSize` in that order, early exit by `goto animationDone`.
PCode value numbering reuses the first `li 0` of the block for the two zero stores; the target
reuses the animation shift (r3), which only happens when shift is the first zero in that block.
With the old helper the stores reused hasTlut. Anim region instruction order now matches.
- Block base as the common subexpression `iconAddress & 0xFFFFFE00` (IRO CSE temp, numbered just
above the CSE multipliers, as the simulator requires); offset `iconAddress - (iconAddress & ~0x1FF)`.
Base, params and the four multipliers now get the target registers (126).
Tooling: private mwdbg copy on gdb port 9137 (/tmp/o2-cardseq-sdmem-mwdbg, retrowin32 rebuilt with
the port patched) because the shared port queue timed out; IRO log via the known 2-byte patch of a
/tmp copy of GC/3.0a5.2 (diagnosis only). Remaining in the simulator: transferSize must be numbered
below the image offset, the comment base/offset/readSize above every other temp, result low.

View File

@@ -0,0 +1,111 @@
# o2-chansvm: CHANSVm round 2 (WinEmuWrite, BlobGetHexString, BlobPackCommon, Step)
Worktree data-d2, branch agent/w1009/o2-chansvm, base 20cf9f9f. Start: WinEmuWrite 5, BlobGetHexString 14,
BlobPackCommon 47, CHANSVmStep 262 (odiff differing instructions).
Scratch: /tmp/o2-chansvm (score.py = whole-unit compile + per-function diff; t/ = one-function harness
that reproduces the unit's codegen in under a second; tmw.sh = mwdbg on a harness file, ~8 s).
## VmWinEmuWrite: 5 -> 0 (exact)
Diff: strObj and totalLength swap r27/r29. mwdbg: every node is low-degree, so the color order is plain
descending vreg number. Named locals are numbered first (reverse declaration order), then IR temps and
inline locals (forward order), then codegen temps. The strObj value survived as the codegen temp of the
call result (`mr r40, r3; mr r37, r40` -> r37 propagated away), so it always had the highest number of
the loop values and took r29 first.
Copy-propagation probes on small functions (X1-X12 in t/x*.c): the backend replaces a named local by
the call-result temp unless the named local has a copy use (`mr rX, local`). Load-base and compare uses
do not block it; a copy use does (X8 vs X7). IRO removes plain `p = o` copies and inline parameters
before the backend sees them (X11, X12).
`strObj = CHANSVmGetArgString(vm, 0)` (the real exported helper, inlined) leaves the inline's return
temp (@1501, IR class) with a copy use, so that temp survives instead of the codegen temp. Moving the
loop into a static inline helper numbers its locals after that temp, which gives the target order.
| attempt | Win | others |
|---|---|---|
| strObj assigned twice (GetArg, then Convert), 3 declaration orders | 5 / 8 / 8 | - |
| for loop, guard clause, no `remaining`, if/else inLen, assign-in-if, nested if | 5 .. 54 | - |
| GetArgString only | 5 | - |
| loop in inline helper only (prior run) | 10 / 13 | - |
| GetArgString + inline helper, locals offset, totalLength, buf, outLen, inLen | 5 (outLen/inLen slots swapped) | - |
| GetArgString + inline helper, locals offset, totalLength, buf, inLen, outLen | 0 | no change, pool identical |
## VmBlobGetHexString: 14 -> 0 (exact)
Diff: loop registers. Target colors IV4 (byte offset +4) r4, the +2 counter r5, src r6, digit chain r7,
hexTbl r8; ours had the counter and the digit chain swapped. The digit chain is codegen temps, so the
counter and src must be numbered above it: both have to be strength-reduction IVs, created in the order
src, counter, IV4.
Per-pass PCode dumps (private copy of mwdbg with a breakpoint after every pass call in the -O4 driver at
0x5964c0, /tmp/o2-chansvm/mwdbgp) showed what each form does:
- pass 10 (0x62be80) is strength reduction; pass 14 (0x62e8d0) the CTR conversion.
- `src[byteIndex]` makes src an SR IV; `dest[byteIndex * 2]` gives IV4.
- A separate +1 counter for the low index (`lowDigitIndex = i * 2 + 1; i++`) gives the target coloring,
but SR rewrites i as `mr i, byteIndex`, which keeps byteIndex alive past the CTR conversion: two extra
instructions (n=84).
- `lowDigitIndex = byteIndex * 2 + 1` with matching signedness is folded by the front end into a
displacement (`sth 2(rX)`, n=79).
- A signed index variable fed from the unsigned counter blocks that fold: the low index stays
`(cnt + 1) << 1` with cnt = SR(byteIndex << 1), created between src and IV4.
| attempt | Hex |
|---|---|
| 16 combinations of src (ptr/index) x high (destOff/byteIndex*2/i) x low index | 16 .. 48 |
| byteIndex*2+1 low index forms (a1-a7), digitIndex++ forms (q1-q5), dest[j++] x2 (j1-j6) | 38 (n=79) |
| separate +1 counter for the low index (m2, n1-n6, 24 declaration orders) | 50 (n=84) |
| u32 counter, int/s32 low index (t_u32_int, c1, c5, c6) | 0 |
| int highDigitIndex/lowDigitIndex from u32 byteIndex (c7, kept) | 0, no change elsewhere, pool identical |
## VmBlobPackCommon: 47 -> 0 (exact)
Diff: argArr (ours r23, target r18) and argCount/writeArgCount (ours r18, target r23). The allocator
needs three simplify sweeps here, so sweep membership matters, not only numbering. A graph simulator
(/tmp/o2-chansvm/packsim.py, built on regsim) traced remaining degrees per sweep:
- Swapping the argArr/writeArgCount declaration slots alone fails: argArr reaches its sweep-2 scan
with degree 29, one over the limit, and drags fmtLen/fmtStr/parentBlob into sweep 3.
- With argArr one neighbour lighter at that point, the swap plus argCount declared between fmtPos and
totalSize reproduces every target register.
- Searching single-node renumberings found the neighbour: @10858, the `dataSize` local of the
VmBlobCopyPadded inline. Inline locals are numbered after all declared locals; the target needs it
in the declared range (ids 36..45), i.e. a local of PackCommon itself. srcOff and dest may sit
anywhere (3855/4000 sampled placements hit).
Kept: the copy code written out in case 4 with writeBlobSrcOff/DataSize/Dest locals of the function,
argArr and writeArgCount declarations swapped, argCount declared between fmtPos and totalSize.
VmBlobCopyPadded (only used here) removed. Pool identical, no other function changed.
| attempt | Pack |
|---|---|
| shared argCount for both passes (merged node), all placements in the simulator | >= 28 misses |
| shared counter, restricted declaration-order annealing (6 seeds) | 7 misses best |
| simulator: swap only / swap + one edge cut / swap + merged loop constants | 3 / 2 / 0 misses |
| simulator: swap + argCount slot + @10858 in declared range | 0 misses |
| source: inline copy code with function-scope locals + two declaration moves | 0 |
## CHANSVmStep (in progress)
Structure first (opcode stream with registers masked, difflib-aligned; /tmp/o2-chansvm/opdiff.py),
then allocation. Findings, each checked against the target object:
- The target addresses VmResultTypeTbl and the constant objects off one .rodata base (r28 = .rodata+0,
offsets 0x160.. and 0xa0). MWCC pools a section base only when a function references three or more
distinct objects in it (/tmp/o2-chansvm/pool/p3.c: two objects never pool, three always do, global or
static). VmResultTypeTbl (0xB4) has no relocation anywhere in the target: it is a dtk-inferred
aggregate of five 6x6 tables (lever 13). Five separate tables give the pooled base.
- `&CHANSVmConstStringObjectUndefined_[4]` takes two addis (array, then element); the target takes one
(`addi r5, r28, 0xa0`), so those five 16-byte objects were separate too. With names, the `base[7]`
hack in CHANSVmConvertToStrFromFloat goes away and that function stays exact.
- `if (stepCount == 0) stepCount = 1;` plus `while (stepCount-- != 0)` (target enters the loop with a
branch to the test at the bottom).
- Stack: target 0x30 = object behind stackPtr (SET_INDEX), 0x40 = STORE_INDIRECT object, 0x50 load,
0x60 operand. MWCC orders frame slots by size, ties in reverse declaration order (pool/s2.c), so
`copies[2]` was two separate objects.
- operandTypes filled through `&operandTypes[typeIdx]` (target keeps a +4 byte IV), not a walker.
- BRANCH_CASE computes into a case-local result (target `li r3, ..` then `mr r14, r3` at the join)
and stores the flag only on the OK path after the pop.
- GET_PROPERTY_NAME: `foundEntry = 0` before the lookup, a one-case `switch (foundObj->type)` (target
`beq +8; b far`), `shouldBranch = foundEntry` before `result = OK`, check reads shouldBranch.
- BRANCH_CASE reads pObjStackTopBuf into stackTop before the stackDepth test.
With these the opcode stream matches except three scheduling ties (511, 598, 836) that depend on
registers; 297 register differences remain.

View File

@@ -0,0 +1,67 @@
# o2-small attempts (2026-10-09)
Worktree `sol-low`, branch `agent/w1009/o2-mcm-pdm-nup`, base `20cf9f9f` (origin/main). Full build OK, DOL SHA1 `26116613…`.
## Compiler version check (all three units)
`/tmp/o2-small/ccsweep.py` compiles the unit with every GC and Wii compiler using the unit's exact flags (`-ipa file` dropped for GC/1.x-2.x, `NO_INLINE` stripped where those can't parse it) and counts instruction-exact functions.
| Unit | GC/1.x-2.7 | GC/3.0a3 … 3.0a5 | GC/3.0a5.2 | Wii 1.x |
|---|---|---|---|---|
| fa/pdm_partition | 5-7/20 | 19/20 (3.0a3 17/20 without NO_INLINE) | 19/20 | 15/20 |
| nup/nup | 0/23 | 20-21/23 (GetAuditData 12) | 22/23 | 9-10/23 |
| iplMemoryCardManager | does not compile | 25/26 (_create_icon 41) | 25/26 (_create_icon 37) | 22/26 |
All three stay on GC/3.0a5.2. `-proc` sweep for pdm (gekko, 750, 740, 7400, 7450, 603e, 604e, generic, 8xx, e300 …): gekko/750/740/7400 identical (19/20), every other model breaks other functions.
## Tooling built this round (all under /tmp/o2-small, not committed)
- `mwdbg/`: private copy of `_mwdbg` (shared lock) with extra PCode dump points: after backend optimizer (0x469383), around 0x596960(func,0) (0x4693a2/0x4693af, a no-op for scheduling), after the real first scheduling pass 0x5995c0(0) (0x4695dd), after 0x59a030 (store→load forwarding, 0x4695ee), before the second pass (0x469548).
- `sim/sched750.py` + `model2.py`: the tw2004 (mitsevox/tw2004 tools/matching/sched750.py) GC/2.6 750 scheduler model, fixed for virtual CR fields (`cr10+` were not parsed) and record forms (`add. rD,…,cr0` defines cr0). GC/3.0a5.2's pick function (0x599920) and DAG builder (0x599ac0) were read from the binary: same rules as GC/2.6, except memory edges use the PCode alias objects (+0x1c, `0x5a0150`). Approximating that with "same base register" reproduces both scheduling passes of the pdm loop block exactly and 49/55 blocks over four pdm functions (the misses are blocks where one object is reached through two different base registers).
## libs/RVL_SDK/src/fa/pdm_partition: pdm_part_is_master_boot_sector (84/86 in repo)
- Plain-sum LE32 (`b0 + (b1<<8) + (b2<<16) + (b3<<24)`, same as the exact sibling's MBR_WORD) + indexed second loop: 21, equal size, exact add tree and loop 2. Only the first loop's byte-load schedule/registers differ.
- First scheduling pass (0x5995c0(0)) input = initial code (the `*p_start` reload is still a `lwz`; 0x59a030 turns it into `mr` after the pass). Model reproduces our pass exactly: `s1` is picked over `s0` at cycle 2 because its shift makes one more successor ready.
- Target register sharing (`s3`/`s1` in r9, `s0`/`s1<<8` in r11) needs a pre-allocation order with `s0` loaded before `s1` and `add (s2<<16)+s0` before `s1<<8`. Annealing over all register-consistent pre-allocation orders under the post-RA model: best 10 ('base' alias) / 8 (all memory ops ordered), never 0. Both residual spots are the same pattern: target issues the low byte load before a shift that frees the next load through an anti-dependence. So with these 24 instructions the target is unreachable; the original block had a different DAG (extra node or different alias edges).
- Model experiments: an extra copy/zero-extend on `b0` in the first pass gives exactly the target load order (s3,s2,s0,s1 / c3,c2,c0,c1) but breaks the r11 sharing; keeping it through both passes (removed after) best 11.
- Source variants tried this round (all 21 or worse): `& 0xFF`, `(pf_u8)`/`(pf_u16)` casts, `<< 0`, byte_at() helper, b0 local, u8-param make_u32 helper (all forms), u8 locals, pointer cursor, array-indexed first loop (24, same first-pass input), accumulator (43).
## libs/RVL_SDK/src/nup/nup: __nupParseServerInfo (66)
- Allocator: coloring order is descending vreg for these low-degree nodes; colour = lowest already-claimed callee-saved register that is free, else claim downward from r31 (regsim reproduces 162/162).
- Per `__nupFindTag` expansion the vregs are: `start` = base, `endTag` = base+2, `startTag` = base+3, ret = base+4; `end` becomes a late temp (114, 120, …) because the backend copy propagation (0x596400) keeps the `strstr` result temp instead of the named `end` (declaring `end` first does not change that: it still becomes the temp).
- Want-list for all 34 FindTag values built from the target. Arbitrary renumbering reaches 34/34 in regsim; constrained to in-block numbering also 34/34, but per-block orders differ: blocks 1-2 need (end < start < endTag < startTag), blocks 3-7 need (end < endTag < startTag < start). No single uniform order gets more than 26/34. Target block 2 claims r18 (end2) before blocks 3-7 reuse it.
- Variants: end declared first 66, separate if-statements 469 (size).
## src/scene/memoryCard/iplMemoryCardManager: _create_icon (37)
- Callers (iplGCWindow) store the result in `const GXTexObj*`, and GXLoadTexObj takes `const GXTexObj*`. Declaring `create_icon`/`_create_icon` as returning `const GXTexObj*` (return type is not in the mangled name) with the banner-style helpers (`initIconTexture` returning `&cell.icon`, `initIconTextureCI`, `initIconPalette` with direct `&mFileCell[slot][file].iconTlut`) gives 11 with no casts. Address shapes all match; the only diff is the C8-path rotation slot*S r28/file*T r26/cellbase r27 (target r26/r27/r28).
- regsim on the captured graph: either swapping the vreg numbers of the two IRO temps (file*T @2824 → r44, slot*S @2826 → r43) or adding the slot↔file*T interference that a `mulli`-before-`mullw` pre-allocation order would create gives the exact target colours.
- IroCSE.c (rayanht/mwcc) shows temps are created in linear-IR order of each expression's first redundant occurrence (second loop of IRO_CommonSubs). Here that is the palette helper's address, where file*T is reached first. sol-r11's `cells` local fixes the order (3 diffs) but changes the TLUT address shape.
- Variants tried (all ≥11): non-const `GXTexObj*` local 44, texture assigned before the palette 21, tlut local in helper 34, helper param types (u8/u16/u32/int/s16 × s32/u32/s16/u16/long) 11-91, `GXLoadTlut(initIconPalette(...))` 11, getter for the icon 44, `&(mFileCell[slot] + file)->…` 11 (same IR).
## Round 2 findings (same day)
### Landed locally
- `6b6aeb4d` _create_icon 37 → 3: icon helpers mirroring the banner ones (palette helper walks `mFileCell[slot]`), `create_icon`/`_create_icon` return `const GXTexObj*` (iplGCWindow already stores the result as const; GXLoadTexObj takes const). No casts. Caller objects differ only in `.strtab`; DOL unchanged.
- `7086ed4c` pdm_part_is_master_boot_sector 84 → 21: entries read with the file's existing `MBR_WORD` (same add tree as the exact pdm_part_get_start_sector), extent check indexed. Equal size; only the first loop's byte-load schedule differs.
### MWCC internals used (GC/3.0a5.2)
- IRO dump: setting byte `[0x725e5c]` when the log is opened (bp at 0x5ed500) makes the compiler write `<source>.log` next to the source; also setting `[0x70f24d]` dumps the full linear IR after every IRO pass. Private mwdbg copy with its own gdb port (LD_PRELOAD bind remap) in /tmp/o2-small/mwdbg; run with `MWDBG_IRODUMP=full`. Delete the `.log` from the worktree afterwards.
- IRO lowering order (rayanht/mwcc IrOptimizer.c): for a binary node the operand with the higher cost is lowered first, ties lower the RIGHT operand first; MUL behaves like cost+2. `&mFileCell[slot][file].x` becomes `((this + C) + slot*S) + file*T`, so file*T is serialized before slot*S.
- IRO_CommonSubs mints a temp at the first redundant occurrence in that serialized order (IroCSE.c), and the backend numbers @temps in reverse creation order (earlier temp = higher vreg = coloured first).
- IRO_SplitLifetimes renames a temp that is assigned on two exclusive paths: the later path's copy gets a new, late @temp (low vreg, coloured last).
- PCode copy propagation (CopyPropagation.c) keeps a copy into a variable only if the variable is in the caller's initial named-object range or one of its uses is itself a move. This is why nup's helper `start` survives (`mr r3, start` feeds the second strstr) while `end` collapses into the late call-result temp.
### _create_icon status
- The C8 rotation (slot*S r26 / file*T r27 / cellbase r28) needs slot*S coloured before file*T. Two sources were found that give it, neither complete:
- `R2C2T2`: `GXLoadTexObj(initIconTexture(...))`, C8 `GXLoadTexObj(&mFileCell[slot][file].icon)`, `return &mFileCell[slot][file].icon` after the if/else. The join return makes the RGB and C8 file*T/cellbase temps one object; IRO_SplitLifetimes renames the C8 copies late → C8 exact. But the same join group merges the RGB GXInitTexObj argument with the post-call address (address kept across the call, r26), 8 diffs.
- Row-pointer local in the palette helper (committed form): slot*S is minted first, but the TLUT address becomes `(row + file*T) + 0x112c` instead of `(row + 0x112c) + file*T`, 3 diffs.
- Type experiments: with the original non-const return type, the RGB path recomputes after the call like the target (the const conversion of the GXInitTexObj argument keeps it out of the join group) but the C8 GXInitTexObjCI argument (non-const prototype) joins the group, 30. Making both GXInit prototypes match the real SDK (non-const) or both const: 27/33/46. SDK header restored each time; not changed.
- Tiny-file probes (/tmp/o2-small/t): inner-index multiply is always minted first unless an earlier statement uses the bare row `cells[slot]`.
- Function-scoped pragmas around _create_icon: wrapping alone changes size (+4), nothing below 34.
### nup
- Pragma sweep (16 singles + all pairs, function-scoped) on __nupParseServerInfo: nothing below 66.
- Literal-tag macro form: tag addresses are rematerialised each time (target keeps them in r22/r25-style registers), size 0x76c; per-block value/length locals: size 0x708. FindTag variants (end first, nested, result var, end+=, param order): 66 or worse.

View File

@@ -0,0 +1,180 @@
# o3-aoss attempts (2026-10-09)
Worktree data-d1, branch agent/w1009/o3-aoss, base origin/main dbbdc3dd.
Scope: AOSS_Init_old (src/scene/setting/AOSS.c) and AOSSi_WLANConnect
(src/scene/setting/AOSSLink.c). Scratch in /tmp/o3-aoss.
## AOSS_Init_old
Start: 1235/1584 differing, 1580/1584 instructions (97.60%).
Evidence used: the DS build of the same library (/tmp/o2-aoss/ds-aoss.s)
keeps the helper names the Wii build inlines (aoss_release, aoss_set_error,
AOSS_Disconnect, SendMessage, AstsRestartReq, SetPacketHeader(buf, 0x3000,
0, 0, 0, 0x11, seq), SendPacketUDP, aoss_IP_sta).
1. Three missing instructions: after each AOSSConnectAndAwaitHost call the
target has `cmpwi r3,0; bne wait; bne done; lwz; lwz; cmplwi 1; beq done`.
The DS build has the same double branch. MWCC emits exactly this for
`state != 0 || (state == 0 && *config != 1)` (second compare CSE'd, its
branch kept). Written as `if (failed or not linked) { wait } else break`
in all three loops: 1580 -> 1583 instructions, 1240 -> 1061 diffs.
2. IPv4 local address: target computes the broadcast address before the
local one (orc before or, same rank, program order). Named
`broadcastAddress` first (aoss_IP_sta shape): orc/or order fixed.
3. Register pressure: the reconnect path reused `requestResult` for the
SOCleanup result, which put it in a callee-saved register across the
loop and pushed the 0x11 message type out (rematerialized `li r0,0x11`).
The target keeps that result in r0 (DS: AOSS_Disconnect()). Static
inline AOSSCloseSocket() at all three close sites: 1061 -> 794 diffs,
0x11 now lives in r14 like the target.
4. Last instruction: target stores the reserved byte from a fresh
`li r0,0` instead of the shared zero register (it is SetPacketHeader's
separate reserved argument). A named `requestReserved = 0` next to
`requestMessageType = 0x11`, declared before it: 1584/1584, 147 diffs.
Declared after requestMessageType: 149 (r14 swaps to the reserved byte).
Tried without effect: inline SetPacketHeader with char parameters (the
inliner substitutes constant arguments; same code as literals),
requestMessageType placement/type (u8/int/char, function entry, case 2,
loop head), pointer views for the send-address copy.
Checkpoint 1 (77895344): 147/1584 differing, 1584/1584 instructions, pool identical,
other 20 AOSS functions unchanged. Remaining: callee-saved register order
(attemptCount r31 vs r18, connection limit, reply length, protocolState),
preheader scheduling, networkAddresses load/store order, poll block order.
5. Hoisted loads: the target's r31 (retry limit) and the connect-loop
limits are loop-invariant loads of the wait-settings fields, numbered at
their codegen position. Comparing against `waitSettings.halfwords.high`
and `waitIntervals.limits.connection` directly instead of copying them
into `attemptCount`/`initialWait` puts r22..r31 in target order:
147 -> 123.
6. Declaration order: hill-climb over Init_old's scalar declarations with
the real compiler (/tmp/o3-aoss/dsearch.py, 6 seeds x 1500): 123 -> 97.
7. Poll block: the bus-clock read is a pointer load ordered against the
descriptor array stores, so its position fixes the statement order:
descriptor 0, tick computation (from locals), descriptor 1, then the
timeval stores: 97 -> 78.
Scheduler model: /tmp/o3-aoss/sched2.py + blk.py port MWCC's list
scheduler and 750 pipeline; with GC/3.0a5.2 memory rules found empirically
(same-object struct fields at different offsets are independent, array
elements are not; pointer accesses alias globals and arrays but not local
structs; store->store memory edges have no latency) it reproduces 228/231
pre-RA scheduled blocks of the capture.
Checkpoint 2: 78/1584 differing, 1584/1584 instructions, pool identical.
Remaining: preheader order (target reuses r0 for the gateway and IP
constants, so gateway is stored before IP is formed), the send-address copy
(lwz/stw/lwz/stw in source order: looks like an unscheduled <=2-instruction
block, lever 36), callee-saved order in the scan and connect loops, and one
in-cycle store swap in the poll block.
8. Separate countdowns: the target gives the wait countdown a different
register in each of the four wait loops (scan r21, connect-1 r17,
connect-2 r16, connect-3 r17), so they are separate variables. Block-
scoped countdowns: 78 -> 64. Block-scoped locals are numbered before
function-scope ones, in reverse order of appearance (capture o3-bw1).
9. vmap2.py (capture vreg -> target register) left the scan/connect-1
rotation: attemptCount spans both loops (degree 37) and is colored before
the loop temps. A separate scan counter (scanAttempt): 64 -> 50.
10. Connect-1 countdown declared at function scope before attemptCount
(numbered above it): 50 -> 38. Declaring it after attemptCount: 50.
11. packetWords block-scoped in case 2 (numbered below requestSocket):
38 -> 21.
Checkpoint 3: 21/1584 differing, pool identical. Remaining: preheader
(gateway/IP constants share r0 in the target; li order 0x11, 0, 8), the
send-address copy, IPv4 mask/andc registers, poll store swap.
12. IPv4: the andc temp was colored before the mask (temps are colored
before named locals) and took r3. A named host part declared between
mask and network (aoss_IP_sta has the same three values): 21 -> 16.
Declared after network: 23; mask as direct field reads: 22; inline
helper with parameters: 21.
13. Preheader constants: LICM hoists loop-invariant `li` (named variables
included) in loop block order, and constant propagation turns hoisted
literal constants into copies of a dominating temp with the same value
(a literal reply length 8 merges with the bind length r23 and loses an
instruction). The target's reply length is a named value hoisted from
case 2 between the header zero and the broadcast -1: setting
replyAddressLength in case 2 and using it for the memset size too gives
li order 0x11, 0, 8, -1, 1: 16 -> 14. Placed right before SOSendTo or
after the address store: 16 (hoisted after the -1).
14. Scheduler model fixed (now 231/231 pre-RA blocks on five captures, post-RA
all but a peephole block and one rematerialized-li block): an instruction
issued to IU2 cannot take an operand forwarded from an integer-unit result
in the same cycle, a store cannot take a value forwarded from IU2, and the
ready-successor count only counts register edges (/tmp/o3-aoss/sched11.py).
With it no ordering of the preheader could put the gateway store before the
IP addi, which is what the target's shared r0 needs.
15. 0xf4/0xf8 are spill slots, not settings fields: the DS build stores the two
constants straight into networkAddresses. Writing them in the loop lets LICM
hoist the lis/addi pairs; RA spills them (an addi is not rematerialized) and
reloads through r0 before each store, which is the target's
`addi r0; stw r0, 0xf4` / `lwz r0, 0xf4; stw r0, 0x98` pattern. The fake
gatewayAddress/ipAddress fields are gone (AOSSNetworkSettings is 0x3c, the
size the memset clears): 14 -> 2.
16. Poll block: the DS build fills an fd set and AOSS_Select copies it into
its own pollfd, passing one entry to SOPoll. So the two descriptors are
separate objects, not a 2-element array: a one-element pollDescriptors
array passed to SOPoll (an array, so the bus-clock pointer load stays
ordered after its stores) and a separate readSet struct written after the
tick computation (returnedEvents first): 2 -> 0. AOSS_Init_old exact.
## AOSSi_WLANConnect
Start: 2/155 (second memset `li r4; li r5; mr r3` in target).
Scheduler port (/tmp/o2-aoss/sched.py, matches MWCC Scheduler.c) shows the
target order needs either a third instruction on the address chain at
pre-RA scheduling time (removed after) or r4/r5 coming from copies emitted
before the r3 copy. Traced (mwdbg2): the pre-phase peephole retargets
single-use defs into copies, and GC/3.0a5.2 value numbering rewrites uses
of copies to the first holder, so every source-level copy collapses.
Tried, all 2 diffs: ipConfig declared/initialized in a nested block, at
the top (79), memset(&global), duplicate address computations (VN copy),
two live pointers, explicit copy variables, assignment in the argument,
casts and member-address forms of the first argument, scoped pragmas
(opt_propagation/common_subs/dead_code/lifetimes/dead_assignments/
loop_invariants/strength_reduction off, optimization_level 1-3,
ppc_iro_level 0/1) on copy variants, non-static/extern/aligned statics,
unpacked NCD types, unit flag variants (-O4,p / -O3 / inline modes).
IRO is genuinely off in the target (removing the aligned WD_Info local
makes IRO run and gives 155 diffs).
Session 2 (scheduler model and AOSSLink):
- AOSSLink is built -O4,s. Its pre-RA scheduler breaks ties by the number of
non-call uses of the defined value before the ready-successor count
(/tmp/o3-aoss/sched13.py reproduces all 17 pre-RA blocks of the
WLANConnect captures; the same rule breaks four AOSS blocks, so it is
-O4,s specific). The post-RA pass leaves almost every AOSSLink block as is.
- With that model no order of the memset block's own instructions gives the
target `li r4; li r5; mr r3`: mr r3 always wins cycle 2 (rank 0). The
target needs one more link on the address chain at scheduling time. A
struct holding both NCD configs (`&s.ipConfig`) puts li r5 before mr r3 as
predicted, but its +0x160 addi is not folded (156 instructions, 94 diffs).
An extra copy of the address issued in cycle 2 also does it in the model
(the second mr then sits in IU2 behind a forwarded operand), and RA would
coalesce the copy away.
- Function-local statics (lever 35): both 2 diffs (fl1), IpConfig first or
only IpConfig local: 8 (bss order).
- Why source copies never reach the scheduler (captures o3-as1, o3-d4,
o3-d1w, o3-d6): the first VN pass (stage 07) turns a second computation of
the address into `mr copy, first` and rewrites every use of the copy to the
first holder, in later blocks and in moves too; copy propagation (stage 09)
then deletes it. A copy only survives when its source is physical: with the
address used by memset alone, the pre-phase retargets it into r3, VN's copy
`mr r35, r3` survives and li r5 does move behind it (d1), but RA then keeps
the address in r3 and the copy in r27 (`mr r27, r3`), the reverse of the
target. Copies made by the second VN (stage 22/23, after LICM) do survive,
but this block is not a loop preheader.
- Also 2 diffs: second pointer used for fields or only as the NCDSetIpConfig
argument (c1-c4, d2-d8), inline fill helper (h1, h3), result = 0 before the
memset or in its argument (r1, r3, r4). Passing the global straight to an
inline setup helper rematerializes the address at each use (38).

View File

@@ -0,0 +1,102 @@
# o3-cardseq attempts
Worktree sol-med, branch agent/w1009/o3-cardseq, started at origin/main dbbdc3dd.
Unit src/scene/cardSequence/iplCardSequence: loadCardFileIcons and cardThreadMain,
each 2 instructions off at the start. Both are now exact, the unit is flipped to
Matching, and the DOL hash is unchanged.
## loadCardFileIcons: exact
Start: instructions 135-136 differ (`add r10, r4, r30` / `stb r3, -0x6fba(r10)` where the
target uses r4).
Cause, from a per-pass PCode dump (/tmp/o2-chansvm/mwdbgp gc3p.py, copied privately):
the block holding the first icon store reaches the pre-allocation list scheduler as
li shift, 0 / li hasTlut, 0 / li iconImageSize, 0 / li iconCount, 0
lwz sThread / addis / add / add / stb (unk_0x02 = 0) ...
li icon, 0 (dead after the CTR conversion) / add offset / li 8 / mtctr
The address chain leaves six free issue slots before the first `stb`. Six fillers compete
for them (shift's zero, the CTR count, the hoisted offset, and the three zero inits), so
`li iconCount, 0` lands at cycle 4, before the store. iconCount then interferes with the
store address, which cannot take r4.
The scheduler breaks ties by input order. When the dead loop-counter init `icon = 0` comes
before `iconCount = 0` in the IR, it takes the cycle-4 slot, `li iconCount, 0` moves
after the store, and the address gets r4. The dead `li` is removed before allocation, which
is why the target shows an empty slot there.
Fix: `for (iconCount = icon = 0; icon < CARD_ICON_MAX; ++icon)`. The chained assignment
evaluates `icon = 0` first. Exact spellings found:
- `for (iconCount = icon = 0; ...)` (kept).
- `iconCount = icon = 0;` or `icon = 0; iconCount = 0;` before an empty for-init.
- a while loop with `icon = 0; iconCount = 0;` before it.
- `for (icon = 0, iconCount = 0; ...)` (comma operator, not used).
Not exact: `icon = 0;` before `shift = 0` (383 diffs); moving `shift = 0` down with the
counters (10 diffs).
A srcsearch run (4 seeds, 40 minutes, --own loadCardIconImages) found nothing before this.
## cardThreadMain: exact
Start: case 10 builds the reply as `li r4, 0x100; rlwimi r4, r19, 0, 24, 31`. The
target has `mr r4, r19; rlwimi r4, r25, 8, 16, 23`: it inserts validState's own register
(r25) into a copy of command.
### Why the target needs a scoped `opt_propagation off`
- The backend cannot fold a constant into an `rlwimi` operand. The backend's own constant
propagation still folds `(v << 8) | x` to `ori 0x100` when it is not an insert.
So r25 in the insert means the IR handed to the backend still read `validState`.
- The 3.0a5.2 IR copy/constant propagation (`mwcceppc.exe` 0x5f4810, disassembled; GC 1.x
source in rayanht/mwcc IroPropagate.c for comparison) replaces every plain read whose
reaching definition is a constant. Its only use-side guards are the Assigned flag, a
sibling-assignment check (0x5f5480) and a size-compatible type check (0x5b7980). Calls
kill only address-taken or global candidates. Unlike GC 1.x, 3.0 propagates into call
arguments too (h2 test: `ori r4, r44, 256` already in backend-00).
- More than 600 earlier trials and about 60 here tried plain locals of every integer type,
enum, bool, unions, one-element arrays, pointer and reference helpers, intrinsics, and
assignment placement. Every one is propagated. A diagnostic `opt_propagation off` gives
the target insert with the natural spelling.
The same function-scoped pragma also reproduces the rest of the target allocation without
the old workarounds. The `command = (message >> 14) & 4` reuse in case 0 and the
`sendValidityResponse` union are both gone.
### Source shape that matches under the pragma
- Reply: `(OSMessage)((validState << 8) | (u8)command)` with `u8 validState` and
`u32 command`. The `(u8)` cast tells the backend that bits 8-15 are clear, which makes
the `mr` + `rlwimi` form. Without the cast, or with `u8 command`, there are 3 diffs.
- One inline helper per command: `mountCardSlot` (case 0), `formatCardSlot` (case 1),
`deleteCardFile` (case 4), `countCardTitleBlocks` (case 12) and `listCardFiles`. Under the
pragma, mwdbg traces show inline-helper locals are coloured first, in reverse creation
order, and named locals last. The target needs case 0's slot, file and listing counter
early, and the long-lived error result late.
- `mountCardSlot` uses one `result` variable for every call. Lifetime analysis splits off
the long-lived error web as a late temp, which gets r20 like the target. A separate
`scanResult` local in the helper gets r26 (4 diffs).
- `mountCardSlot` takes `mountDir`, `listingDir` and `fileName` by reference.
Declaring them inside the helper moves them on the stack (15 diffs).
Progress: 2 diffs -> 29 (natural rewrite under the pragma) -> 11 (declaration order) ->
5 (formatCardSlot) -> 4 (mountCardSlot) -> 0 (single `result`).
## Harness note
`wibo sjiswrap.exe mwcceppc.exe` silently writes no object (exit 0) for some source file
names (`D1.cpp`, `W1.cpp`, `X1.cpp`, ...). The same text under another name compiles.
Early "compile failures" in this log were this, not the compiler.
## Final state
- cardThreadMain 301/301 and loadCardFileIcons 512/512, 0 differing; ctxdiff diffs 0.
- Pool identical (43); unit 30/30 instruction-exact; objdiff code 9852/9852, data
1496/1496; every section at 100.
- configure.py: iplCardSequence NonMatching -> Matching. Full build ok, unit linked,
main.dol SHA1 26116613f624061ba99c8d1a299aaa6efa85670d.
- `gate.py src/scene/cardSequence/iplCardSequence --quick`: GATE PASS, 0 regressions,
0 forbidden patterns, 0 readability warnings.

View File

@@ -0,0 +1,56 @@
# o3-chansvm: CHANSVmStep li/stw scheduling pair
Worktree data-d2, branch agent/w1009/o3-chansvm, base 239334ba. Start: CHANSVmStep 2 differing
instructions (836 `li r14, 0` / 837 `stw r26, 0xc(r1)` swapped), unit 232/233 exact, NonMatching.
Scratch: /tmp/o3-chansvm (score.py = whole-unit compile + per-function compare, 0.6 s; t/ = a
40-line reproduction of the GET_PROPERTY_NAME control flow, 0.3 s per compile).
## Why the scheduler always put the store first
Scheduler model from rayanht/mwcc `Scheduler.c` and `MachineSimulation750.c`, checked against our
captures (B261 in backend-00/01 of _mwdbg/runs/o3-chansvm-base):
- On the 750 model `li` has latency 1 and `stw` latency 2. Each node without successors gets a
latency-0 edge to the block's branch, so height(stw) = 2 and height(li) = 1.
- `select_ready_coloring_node` prefers the node whose latest cycle has been reached. At cycle 0 the
store is urgent and the li is not, so the store is issued first whatever the source order. That is
why every statement order, type and status-local variant in g/g2-chansvm kept the same pair.
- `Scheduler_Schedule` only schedules blocks with more than two instructions. A two-instruction
block keeps source order in both passes (harness: li stays first when the block falls through).
## What the target block really was
The target's three early exits (`beq/bne 0xcac8` at 759/762/769) and the `b 0xcac8` after the store
fit this layout before assembly:
- B261 = `li result; stw shouldBranch` (two instructions, never scheduled, source order).
- X = `mr result, <status>; b property_done`, reached by B261's fallthrough and by the three early
exits, so MergeAdjacentBlocks cannot merge it into B261.
- The allocator coalesces the status with `result` (both r14) and deletes the copy, leaving X as a
lone `b`. `optimize_branches` in PCodeAssembly then threads the early exits through X to
property_done, so the final code shows no trace of X.
In C this is a case-local status for GET_PROPERTY_NAME, like the case-local results the other cases
already use (booleanResult, loadResult, arrayResult, deleteResult, caseResult), copied into `result`
after the property block, with the OK assignment written before the flag store. IRO cannot fold the
copy: the status is ERR on the early-exit paths and OK after the enumeration.
## Attempts
| attempt | Step diffs | others |
|---|---|---|
| harness: flag/status order, u8/s8/u16/s16 flag, inline setter, pointer to the flag, opt_propagation off | stw first | - |
| harness: do/while(0) breaks, goto early exits, extra end label, else branch | stw first | - |
| harness: B261 falling straight into property_done (error block moved) | li first | layout differs from target |
| harness: case-local status, OK before flag store, `result = status` after the if | li first, target layout | - |
| harness: same with the flag store first | stw first | - |
| CHANSVmStep: `propertyResult`, declared in each of the 74 local slots | 0 in 57 slots, 115 in slots 43-59 | all 232 others exact |
| kept: declared after `result` | 0 | pool identical, 233/233 |
## Result
CHANSVmStep 2 -> 0 (1253/1253, 5012 bytes). CHANSVm 233/233 exact, flipped to Matching.
Full build links build/43U/src/src/channelScript/CHANSVm.o; main.dol SHA1
26116613f624061ba99c8d1a299aaa6efa85670d. Unit report: code 53564/53564, data 6904/6904, complete
code and data 100%.
`gate.py src/channelScript/CHANSVm --quick`: GATE PASS, 0 regressions, 0 forbidden patterns,
0 readability warnings, all six sections 100%. Global complete code 94.67 -> 96.46 percent.

View File

@@ -0,0 +1,61 @@
# o3-idct attempts
Worktree data-d11, branch agent/w1009/o3-idct (from origin/main 179cd4e3). 43U only.
Unit: `libs/RVLMiddleware/TMC_JPEG/src/buffer/idct_block_var`.
Start: Lumi 11 diffs (O3 pragma), Col 51 diffs.
## What was wrong (Lumi)
- Post-RA scheduler model (`/tmp/opus-idct-sched/sched.py`, reproduces all 61 captured blocks)
applied to our pre-RA order with only four values recoloured (scaled even rotation and odd
difference rotation to r20, even sum and first even output to r10) gives the target order
exactly. So the 11 diffs were pure colouring; no schedule or dataflow change was needed.
- The retained source made the scaled rotation a split web of `rowC2` (`rowC2 = rot * 0xB5 >> 8`).
MWCC's lifetime splitter (`fn_00459420` in the rayanht GC/1.x decomp) turns every web but the
first-defined one into an `@` temp numbered after all named locals, so it is coloured early and
takes r10. Named locals are numbered in reverse declaration order; single-use locals are forward
substituted and become codegen temps numbered in statement order at their use.
- regsim on that capture: no declaration order and no single renumbering reaches the target.
With a named rotation, the even-sum temp has to be numbered between the rotation temps and the
named locals (it must be created before the odd-part temps).
## The fix (Lumi exact, no pragma)
- Natural row pass in the 4x4 sibling's shape: even part first (`evenRotation = c2 - c6;
evenSum = c2 + c6; ... scaled = evenRotation * 0xB5 >> 8; evenRotationSum = scaled + evenSum;`),
then the odd part. Single-use `evenSum` is substituted and MWCC emits `add c6, c2`, as in the
target; no reassociation (that came from the old statement order, not from the types).
- mwdbg capture of that source (`runs/o3-idct-nat1`), vmap to the target, then an anneal over the
order of named locals with regsim: cost 0. Declaring the locals in the solved order compiles
to an exact Lumi at O3 and at the unit's O4, so the scoped `optimization_level 3` was dropped.
## Col (exact)
- Same natural row pass: 51 -> 28 diffs (dataflow now matches; the old source reassociated the
even sum to `c2 + (rot + c6)`).
- Compiler-in-the-loop declaration climb: 28 -> 13.
- mwdbg capture of the climbed source (`runs/o3-idct-natcol1c1`): regsim reproduced it with only
4 wrong registers; the declaration anneal reached cost 0 on four of five seeds and the solved
order compiles to an exact Col. A duplicated `rowOddOutput2` statement left over from the splice
was removed (still exact).
## Result
- Lumi 11 -> 0 diffs, Col 51 -> 0 diffs; `.text` byte-identical, pool identical, symorder ORDER OK.
- Unit flipped to `Matching`; full build passes, main.dol SHA1 26116613f624061ba99c8d1a299aaa6efa85670d.
- No pragmas left in the file (the scoped `optimization_level 3` from #1322 is gone).
- Gate: `GATE PASS`, code 2844/2844, functions 2/2, linked code 2844, 0 regressions.
## Method worth reusing
1. Make the source natural first and check the dataflow (here: copy the sibling 4x4 butterfly).
2. Capture once with mwdbg, map every vreg to the target register (`/tmp/o3-idct/sched/vmap.py`,
a copy of the opus-idct one with `andi.` added).
3. Anneal the order of named locals with regsim against the full want map
(`/tmp/o3-idct/sim/declsearch2.py <capture> <vmap.json> '{}' <seed> <steps>`), then write the
declarations in that order. If temps are among the mismatches, no declaration order can fix it:
change which values are named or where single-use values are consumed, and recapture.
Tools tried and not needed: per-function pragma sweep (no lead), grouping row/column declarations
(breaks the match; the solved interleaving is required).

View File

@@ -0,0 +1,125 @@
# o3-keyboard attempts (tiInputForm calcCursorPos / LayoutByNW4R::create, tiString inputChar)
Worktree data-d4, branch agent/w1009/o3-keyboard, base 4789b7c3. Full build at base: DOL SHA1
26116613f624061ba99c8d1a299aaa6efa85670d. Baselines: calcCursorPos 8/326, create 120/356, inputChar 13/136.
## calcCursorPos: EXACT
The 8 differences were f29/f30 swapped between the glyph-rect zero and scale.x. Target order of the three
loop-invariant FPRs is zero < scale.x < scale.y by virtual register number.
What decides it (verified with mwdbg traces and a per-pass capture, /tmp/o2-keyboard/cap-o3direct):
- FPR numbering: named locals first (reverse declaration order), then IRO temps (reverse creation order:
late @149xx return temps below early @98xx inline params), then codegen temps in codegen order.
- In the helper form scale.x is the scaledExtent parameter temp @9875 (IRO), scale.y is a codegen load in
the loop head, and the zero is a codegen load in the loop top. Codegen beats IRO, so zero lands above scale.x.
- Computing `right` before `lineBottom` (scale.x loaded first) fixes the registers but breaks the loop-head
schedule. A port of MWCC's list scheduler + 750 pipeline model (/tmp/o3-keyboard/schedsim.py, reproduces
the direct, helper and width-first schedules exactly) shows the target schedule needs the height chain
first with one copy into lineBottom (the helper form), or width-first with two chained copies after the
height add. Backend VN (pass 0x5976e0) flattens copy chains inside the block, so the second option is
impossible.
- Fix: keep the helper form and hold the rect reset value in a named float local declared first. IRO does not
propagate a constant into a deeper loop, so the local survives; declared first, it gets the highest
named-local number, which colors it right after the two temps (f29). Assigned right before the loop.
Trials that did not work: 128 helper/direct mixes (best 8), width-first + named-local/chained/struct/array
intermediates (7-8, structs 282+), nested inline height helper (7), per-function single/pair pragmas on
width-first forms (opt_propagation off: 304, others unchanged), zero via named const global (folded, 8),
inline returning 0.0f (propagated, 8), zero local declared inside the loop or right after scale (45),
initialized at declaration (35), const local (propagated, 8).
Result: calcCursorPos 8 -> 0 differing, pool identical, tiInputForm 219 -> 220/221 exact.
## LayoutByNW4R::create: not exact (120)
All 120 differences are GPR renames. Target saved-register roles (verified instruction by instruction):
r31 AnmPane vtable, r30 table base, r29 bindingName, r28 buttonIndex, r27 button, r26 animationPane,
r25 animationIndex, r24 allocator, r23 this, r22 count, r21 NormalButtonAnmPane vtable,
r20 zero/textBox/early zero, r19 file pointer (@13697), r18 resource (@10823)/editBuffer.
Coloring takes the lowest free register in the pool and adds new saved registers from r31 down, so this forces
the coloring order ... allocator, this, count, NBAP-vtable, zero, textBox, file, resource. Simplify removes
nodes in ascending vreg order per pass (regsim reproduces 137/137), so count must be removed right before
`this` and right after the NBAP vtable temp (r164). Parameters are always r32-r34, named locals next (reverse
declaration order), IRO temps next, codegen temps last. Scan degrees (/tmp/o3-keyboard/scans.py): count starts
at 30 against K=29; `this` cannot stay >= 29 into pass 2 without spills. So count has to be a codegen temp
numbered above r164, i.e. a hoisted load. It cannot be one: csButtonAnimations is global .data (STB_GLOBAL in
the original object), loads through `button` are fIsPtrOp and CodeMotion never hoists those, and the inner
loop calls functions. Unresolved contradiction; the target graph must differ in a way not found.
regsim: declaration order alone (params pinned) reaches 6/12; with count free as a high temp plus resource and
file placed among named locals, 12/12. Tried: count removed (button.count in the condition: reloaded each
iteration, 106), count in for-init / block / loop scope (133), const-ref inline helper owning the inner loop
(106, still reloaded), addButtonAnimation body written into create with named file/resource (139, moved the
vtable temps). Header experiment reverted.
## inputChar: not exact (13)
Per-pass capture (/tmp/o2-keyboard/cap-o3ic0) of the current source: the then-block `li mCount, 0` survives
every pass. Findings that constrain the original:
- GC3 VN records every li but only replaces li whose destination is a codegen temp (coalesce window); VN
flattens copy chains to the first holder and deletes `mr d,s` when d already holds s; VN removes
overwritten stores in the block.
- The first indexed store keeps `slwi/sthx` with r6, so the index had two reaching definitions during both
const-prop runs (0x622a20 at passes 02 and 15), and the second definition vanished afterwards (VN 19/25,
DCE 20, coalescing, or post-regalloc VN). Only a copy or a window-temp li can vanish that late.
- A named `wchar_t* out = input` for the terminator reproduces the target's separate second-store base
(post-regalloc VN turns its addi into `mr r4,r5`), u32 index with `clrlwi` count: 60 diffs, only the
then-block li left (rb2 in /tmp/o3-keyboard/ic2.txt).
- Read-back then-blocks (n = out[n], n = *out, length scan) and ternary index/arms fold in IRO because IRO
knows the buffer and n are zero (60-74). switch on u32 still compares with cmpwi (60-73).
## Round b (worktree data-d4, branch agent/w1009/o3b-keyboard, base e47a8e94)
### LayoutByNW4R::create: EXACT (120 -> 0)
Three structural changes, each found with mwdbg captures, regsim, and a positional vreg-to-target-register map
(/tmp/o3-keyboard/cr/posmap.py: aligns backend-04 with the object and reads the target register at each def):
1. Loop. `csButtonAnimations` is `const` in the original. It sits in .data only because entry 1's bindingName
is filled by the dynamic initializer (the target's slot is zero with no relocation; __sinit stores it). With a
const table, `button.count` and `button.bindingName` read directly in the loop are hoisted by the backend, so
count becomes the late codegen temp that round a predicted. The loop body is written out as in tiToolBar's
matched create; the addButtonAnimation helper is gone.
2. textBox. It must be numbered above the `&button.files[i]` CSE temp, so it is an inline local: an inline
`getTextBox()` getter that returns a local, used by create and init. The L"" literal has to stay in the
callers. Inside an inline member it becomes a weak @STRING@ object and .sdata grows from 40 to 46 bytes.
3. Row list. Base::create's code is duplicated in create, not inlined: inlining reverses the relative numbering
of the inline's locals (inline locals are keyed by declaration order, named locals by reverse declaration
order). Both functions now use the same code: C89 declarations rows, row, next, previous, selectedIndex,
listEnd, info. `row` is reused (`row = &rows[max]; row = &rows[row->Next];`) so the selected row is a split
IRO temp. The second mpInfo load goes into `info`, declared after listEnd. The head index is a block-scoped
`head`. Base::create stays exact and loses the RowCursor carrier struct.
Dead ends: Base::create auto-inlined (bl, too big), `inline Base::create` (27, reversed row registers), a
RowInfoManager::newLine() helper (reloads mpInfo, 74 insns), a setupTextBox() helper holding SetString (exact
code, but .sdata changes).
### Decolated::inputChar: not exact (13)
Mechanism behind the target's vanished '\n' then-block, from per-pass PCode captures on GC3:
- VN (0x5976e0) merges li's within a block at pass 01 and across single-predecessor chains at passes 19/24.
A redundant li disappears only if it matches a value-number record whose holder is the same register with the
same index. Records are keyed by opcode, flags and operand count. Li's created by const-prop have 3 operands,
so they form their own record chain.
- The function-start zeroing (`input[4..0] = 0`) owns the 2-operand `li 0` record in the mode-3 block's chain,
so any 2-operand `n = 0` reset survives. That covers main's CharacterOutput and every class, inline, ternary,
switch, reference, pointer and read-back form tried.
- A POD struct with a constant initializer (`LinePosition position = {0}; ... position = LinePosition();`) stays
in memory through both const-prop passes. Array-to-register (pass 07) gives it a new vreg, const-prop (pass 17)
turns its defs into 3-operand li's, and VN at pass 24 deletes the then-block def. This reproduces the dead
`cmplwi` with no branch (tiny tests struct1/tc, real-function variants p1/z2).
- Remaining blocker for that family: the input[0] store's zero then belongs to the struct init's codegen li,
which pass 24 replaces with the function-start zero. The result is `sth r5` instead of `li r6,0; sth r6`, and
the `mr r4,r5` before the second store is lost (133 insns, 73 diffs). The target needs the store and n to share
one register whose li comes first in the block and whose then-block def is deleted. None of about 120 variants
reached that (/tmp/o3-keyboard/{t,t2,ic,grid}). combosweep: 13 -> 13.
### tiInputForm link (not flipped)
The unit is 221/221 exact with code and data at 100%, but a trial Matching flip fails to link: the vtables for
Decolated (tiString.o) and CommandReceiver (tiTextInputBase.o) are multiply defined, and GUIComponent's is also
emitted here. There are also about 96 extra bytes of anonymous .sdata2 floats, Base::RowInfoManager::~RowInfoManager
is emitted as a global (the target inlines it into ~Base), and only 37 of the 221 functions are in target order.
Flip reverted; the DOL is unchanged.

View File

@@ -0,0 +1,59 @@
# o3-small attempts (2026-10-09)
Worktree `sol-low`, branch `agent/w1009/o3-small`, base `ad5b9dea` (origin/main). Full build OK and
DOL SHA1 `26116613f624061ba99c8d1a299aaa6efa85670d` before, after nup, and after pdm (both units linked).
## libs/RVL_SDK/src/nup/nup: __nupParseServerInfo 66 -> 0 (unit flipped to Matching)
Root cause: the target colors every `__nupFindTag` strstr result as if it were an IRO temp created after
inlining, in source order (start_1, end_1, start_2, end_2, ...). Our source had `start` as an inline
local (inline object band) and `end` collapsed into the backend call-result temp (numbered last).
How it was found:
- `/tmp/o3-small/nup/vmap2.py` maps every virtual register of an mwdbg capture to the target's
physical register (final code aligned by PCode instruction address), giving a want map (92 vregs).
- regsim relabel experiments (`/tmp/o3-small/nup/t5`-`t11.py`): no per-expansion order of the 4 values works
(matches o2-small), but one band of all start/end values below the inline tag objects, ordered
s1 > e1 > s2 > e2 ... (temps created in source order after inlining) gives 0/92 mismatches.
- MWCC decomp (rayanht/mwcc): only `CInline.c:InlineWrapResult` creates `EFORCELOAD` (result of an
expression-inlined call that contains a load or call), and IRO lowering turns it into a fresh temp.
So both strstr calls must go through an expression-inlined function.
- Prior art: Petari's MSL `cstring` (SMGCommunity/Petari libs/MSL_C/include/cstring) declares, for C++,
`const char* strstr(const char*, const char*)` plus the const-correct overload
`extern "C++" inline char* strstr(char*, const char*)`. NUP is C++ and passes `char*`.
- Backend copy propagation (`CopyPropagation.c`) still folds `end` into the call-result temp unless a use
block kills the copy; `end += strlen(endTag); return end;` does that (wrapper alone: 83, both: 0).
Change: `libs/MSL/include/string.h` gets the MSL C++ overload (C declaration unchanged for C), and
`__nupFindTag` ends with `end += strlen(endTag); return end;`. Other C++ users of strstr
(nup_nhttp, iplSetting, iplNandSDWorker, ut_ArchiveFontBase) only change `.strtab`/debug metadata;
their code/data sections are byte-identical. nup: 23/23 exact, pool 28/28, symbol order differs only in
label names (lbl_ vs @n, `pad$` vs `fillByte$` static name).
Tried first (all worse, reduced file `/tmp/o3-small/nup/red_base.cpp` scored registers only):
value-first helpers (204/477), ternary helpers (478+), shared caller tagStart/tagEnd via pointers (89),
call inside the if condition (66), non-inline helper (66), strstr wrapper on one call only (66/83).
## libs/RVL_SDK/src/fa/pdm_partition: pdm_part_is_master_boot_sector 21 -> 0 (unit flipped to Matching)
Root cause: the eight MBR byte loads are volatile in the target. Change: the parameter is
`volatile pf_u8* buf` (C function, symbol unchanged; no prototype elsewhere; all reads go through it).
Proof that the target needs ordered (volatile) loads:
- Pass-2 scheduler model (`/tmp/o2-small/sim/sched750.py` + `model2.py`) checked against the GC/3.0a5.2
binary: pick 0x599920, DAG builder 0x599ac0, add_dependency 0x599e90, 750 can_issue 0x63c880,
timing table built at 0x63c1b0 (record forms +2 latency via flags2 0x100000). It reproduces
5875/6036 blocks of every mwdbg capture in `_mwdbg/runs` (failures are alias-object cases).
- With the final 24 instructions and registers, no pass-2 input order reaches the target (random
topological search: best 10 base alias, 8 all alias; every load/store alias subset: best 6;
block-split partitions only at unnatural points). The blocker is cycle 2: `slwi r30,r9,24` frees
`lbz r9,0x1c7` (WAR) while `lbz r11,0x1c6` frees nothing, so the slwi must issue first.
- Adding 0-latency load->load ordering edges (what GC3 adds for PCode flag 0x80 at 0x599b5b)
makes the target a fixed point. mwdbg on the volatile build shows LBZ flags 0xa2 (0x22|0x80).
- Compiled: `volatile pf_u8* buf` gives 20/20 exact; use-site cast form also exact (not used).
The buffer is filled by the disk driver (pdm_disk_physical_read) outside this function.
Tried first (all 19-85): 120 add-tree shapes (`/tmp/o3-small/v2.py`, reassociation pairs
((A+B)+C)+D -> (C+A)+(D+B)), LE32 inline helpers (21), byte loops (43-97), `#pragma scheduling`
once/twice/off and every processor model (21-83), Wii/1.x compilers (17-20, siblings break).
`#pragma scheduling once` (pass 2 only) exists in GC3 and was never in the combosweep list.

View File

@@ -0,0 +1,78 @@
# o4-aosslink attempts (AOSSi_WLANConnect, 2026-10-09)
Worktree data-d1, branch agent/w1009/o4-aosslink at 0cffbfe4. Start: AOSSLink 13/14 exact,
AOSSi_WLANConnect 2/155 (second memset: target `li r4,0; li r5,0x7c4; mr r3,r27`, ours
`li r4,0; mr r3,r27; li r5,0x7c4`), NonMatching.
End: 14/14 exact, AOSSLink flipped to Matching, main.dol SHA1 26116613f624061ba99c8d1a299aaa6efa85670d,
`gate.py src/scene/setting/AOSSLink --quick`: GATE PASS, 0 regressions, 0 forbidden, 0 readability.
Scratch: /tmp/o4-aosslink (cc.sh/cmp.py/try.py variant harness, sim.py + xenum*.py scheduler
enumeration on o3's sched13.py, blk.py stage tracer). Stage captures: /tmp/o2-aoss/mwdbg2/runs/o4-*
(per-pass PCode dumps); /tmp/o2-aoss/mwdbg3 adds a dump of the VN range globals.
## Source change
The IP-config step is guarded like every later step of the function:
result = 0;
if (result == 0) {
ipConfig = &AOSSi_NcdIpConfig;
memset(ipConfig, 0, sizeof(*ipConfig));
...
if (NCDSetIpConfig(ipConfig) != 0) {
result = -1;
}
}
if (result == 0 && NCDSetIfConfig(&AOSSi_NcdIfConfig) != 0) {
For review: the first guard is always true where it stands (result was just set). It is the
function's uniform step-guard style (`if (result == 0 && NCDSetIfConfig...)`, `if (result == 0)
{ wait loop }`, `if (result == 0) { status }`), and it is the only structure found that
reproduces the target (see below). `if (!result)` and a fully nested chain for NCDSetIfConfig
are also exact.
## Why it works (stage dumps, capture o4-p4)
1. Pass 1 schedules each block on its own, with the opcode-rank tie-break (mr 0 < li 4). With
`result = 0` in the memset block, cycle 2 has `mr r3` and `li r5` both critical and `mr r3`
wins (baseline o4-base).
2. With the guard, `li result,0; cmpi; bf` is its own block at pass 1 (B14) and the memset block
(B15) is `lis; addi; mr r3; li r4; li r5`, scheduled `lis, li r4, addi, li r5, mr r3`.
3. The post-scheduling peephole folds the constant compare (stage 28 -> 29), the two blocks
merge, and pass 2 (no rank tie-break, list order, IU2 forwarding rule) emits
`lis, li r28, addi, li r4, li r5, mr r3`: the target.
## Why the copy routes in o3's notes cannot work here
- 3.0a5.2's value numbering canonicalizes operands at the start of every instruction
(0x5979ca): a use of a copy's destination is rewritten to the copy's source when the source
is virtual and unchanged, everywhere in the extended basic block (B13..B22 here). Copy
propagation mode 0 then unlinks the dead copy (0x621e70). Copies of parameters survive
(physical canon, lever 37/ATERM); nothing in B14 has one.
- VN2 numbers `li` only for temps (dest in [0x710768], [0x7100fc] = r39..r80 here), so it
cannot copy `result`'s zero; mode-1 copy propagation never unlinks a dead copy (0x621d40),
which is why VN2 copies reach pass 1.
- Proof of the copy mechanism (e1): a copy of ipConfig used only after an artificial merge
reaches pass 1 (`li r4; mr copy; li r5; mr r3`), RA coalesces it and pass 2 emits the target
order. Not usable: the target has no ipConfig use after B20.
- Scheduler enumeration (sim.py/xenum.py): one transient `mr` reading the address, the result
zero or the lis temp, listed before `mr r3`, also gives the target; a block boundary between
`result = 0` and the memset is the natural source form of the same effect.
## Attempts
| attempt | WLANConnect diffs |
|---|---|
| baseline | 2 |
| copy `config = ipConfig` + opt_propagation/common_subs/dead_code/lifetimes/dead_assignments off | 2 (VN1 rewrites, stage 09 deletes) |
| same + peephole off | 11 |
| same + optimization_level 2/3 | 2; level 0/1: 139+ |
| typed sub-struct pointer `adjust = &ipConfig->adjust` before memset | 2 (add propagation removes it at stage 10) |
| typed sub-struct pointer `ip = &ipConfig->ip` | 97-103 |
| result copied from a zero variable (same block) | 2 (pre-phase retarget folds it at stage 05) |
| while (1) { ... break; } / do { ... } while (0) around the step | 2 |
| combosweep single + pairwise pragmas | 2 |
| unit flags (-O4,p, -O3, inline modes, -ipa function, -opt variants) | 2 or much worse |
| GC/3.0a3 .. 3.0a5.2 | 2; Wii/1.x: 134+ |
| no string.h prototype | 2 |
| `if (result == 0) { ip-config step }` | 0, kept |

View File

@@ -0,0 +1,85 @@
# o5-aterm attempts (ATERMBuildEncryptedMessage, 2026-10-09)
Worktree data-d3, branch agent/w1009/o5-aterm at b275eb2d. Start: ATERM 25/26 exact,
ATERMBuildEncryptedMessage 2/96 differing (target `mr r3,r27; mr r29,r7`, ours swapped), NonMatching.
End: 26/26 exact, ATERM flipped to Matching, main.dol SHA1 26116613f624061ba99c8d1a299aaa6efa85670d.
Scratch: /tmp/o5-aterm (sched.py = scheduler port, brute.py, t/ = standalone function + try.sh/dbg.sh).
mwdbg captures: _mwdbg/runs/o5-aterm-base, o5-v2, o5-v5, o5-v9 (3.0a5.2 gives the same code as 3.0a5
for this function; trace with `--sjiswrap on` and an explicit `--args` command).
## What the source change is
The function now writes the frame and element headers through typed header pointers, like
atermSetSingleElement and atermSetElementData already do in this file:
AtermFrameHeader* header = (AtermFrameHeader*)messageBuffer;
AtermElementHeader* element = (AtermElementHeader*)payload;
memset(element, 0, sizeof(*element));
element->length = SOHtoNs(payloadLength - sizeof(*element));
...
memset(header, 0, sizeof(*header));
header->command = SOHtoNs(sequence);
header->length = SOHtoNs(payloadLength);
end = (u8*)(header + 1);
end += payloadLength;
Same values, same stores, same calls. `for (cursor = (u8*)header; ...)` breaks B1 again (4 diffs), so the
checksum still walks `messageBuffer`; `end = (u8*)(header + 1) + payloadLength` in one statement swaps
the add order (4 diffs).
## Why it works (from the backend dumps)
1. The cast copies are not IRO copy candidates (the right side is a cast, not a plain object ref), so
`mr v41,v32` (header) and `mr v40,v34` (element) reach PCode in B1. With `element` used twice
(memset, ->length) local expression propagation does not fold it either.
2. Pass-1 scheduling sees the chain p5 -> element copy -> memset arg -> bl and the header copy after
p3, which gives the order p5, p3, element copy, p4, p6, p7, header copy, ...
3. The forward peephole folds the element copy into memset's argument move (`mr r3,r34` lands in the
element copy's slot) and clears B1's scheduled flag (backend-01 B1 flags 0x4, not 0xc).
4. The allocator coalesces the header copy into msg (r30) and deletes it.
5. Pass 2 (after allocation, physical registers, no opcode-rank tie-break) reschedules B1 because its
flag was cleared, and emits p5, p3, p4, p6, `mr r3,r27`, `mr r29,r7`, li, li, li, bl: the target.
General lesson (proposed lever 37): any copy the allocator or the forward peephole deletes from a block
clears that block's "scheduled" flag (0x8), and the block is scheduled again after register allocation
from its pass-1 order, with physical-register dependencies and ties broken by list order instead of
opcode rank. o4's model scheduled B1 only once, which is why it found no C shape. Seen in the captures:
v2 (inline helper with a modified length param: copy deleted, B1 flags 0xc -> 0x4 -> rescheduled) and v5.
## Scheduler port
/tmp/o5-aterm/sched.py ports schedule_block/select_ready_coloring_node (750 model). It reproduces pass 1
and pass 2 of base, v2 and v5 and pass 1 of v9. For v9's pass 2 it predicts `p4, arg, p6` where 3.0a5.2
emits `p4, p6, arg`, so the GC/3 pass-2 tie-break differs from the 1.x reference in at least that case.
brute.py (extra vanishing copies x RA outcomes x statement orders) found the payload/len/msg copy family
first; the struct-pointer style was the natural C for it.
## Attempts
| attempt | Encrypted diffs |
|---|---|
| goto/label boundary after param copies | 2 (folded away) |
| inline wrap helper (payload, length, key), modified length | 2 (length copy deleted, B1 rescheduled, same order) |
| inline helper with early return | 13 |
| AtermFrameHeader* header only (v5) | 2 (header copy reaches B1, deleted, B1 rescheduled) |
| header + element pointers, memset(element), element->length (v6/v7) | 0 |
| v7 + header->command/length, header + 1 (v9) | 0, kept |
| v9 with checksum over header | 4 |
| v9 with one-statement end | 4 |
## Link fix (AxAdpcmPlayer)
Flipping ATERM to Matching first gave main.dol 035744a9..., with 1104 runs of r13/.bss displacements
off by 0x10. ATERM's .bss objects match one for one (last object AtermThread ends at 0x810C0C70), but
the original AxAdpcmPlayer .bss starts at 0x810C0C80. The linker only pads before a section for its
alignment, so the original AxAdpcmPlayer.o .bss was 32-aligned; the built one was 8-aligned, which
the dtk ATERM object (size 0x1FE0 to the next unit) had been hiding. `u8 sZeroMem[0x100]` is the DSP
zero buffer (zeroBuffer -> convertDSPAddr), so it gets `ATTRIBUTE_ALIGN(32)`. AxAdpcmPlayer.o is
otherwise byte-identical (same .text/.data, .bss offsets and size), 13/13 exact.
## Result
ATERMBuildEncryptedMessage 2 -> 0 (96/96). ATERM 26/26 exact, all seven sections 100%, Matching.
Full build OK, main.dol 26116613f624061ba99c8d1a299aaa6efa85670d.
`gate.py src/scene/setting/ATERM src/bannerSound/AxAdpcmPlayer --quick`: GATE PASS, 0 regressions,
0 forbidden patterns, 0 readability warnings; complete code 96.55193 -> 97.19308.

View File

@@ -0,0 +1,47 @@
# ODH source-integrity checks
Base: 3d7e767cf729de96ac1cd88ddbf5c18eaa08187d (43U only).
- Restored unsigned arithmetic in all three huffmanDecoder word refills by
casting the shifted bytes to u32. The combined word and its bitOffset shift
now remain unsigned, including input words with the high bit set.
- Restored unsigned planeSize indexing in LineConv11. Chroma source pointers
are only formed by accesses in the planar-format branch. The RGB565 caller
passes a row-offset pointer into Capture's GXGetTexBufferSize allocation;
for tile-aligned dimensions that allocation is exactly width*height*2 bytes.
Unconditionally adding two planes to a nonzero row pointer could therefore
form an out-of-bounds pointer even though RGB565 never dereferences it.
- Reviewed the full huffmanDecoder rewrite against its preceding source.
Other category shifts and caller/table preconditions were already present;
no additional newly introduced arithmetic issue was identified in this pass.
One candidate, no compiler flags or other source changes. No debugger, compiler
memory access, forced registers, assembly, uninitialized values, or online source
references were used. Retail objects and disassembly remained local.
Validation:
- All allocated source-object sections, function spans, and resolved relocations
are identical to the unmodified base object (debug metadata differs).
- All 28 retail function spans are raw-byte exact: 14,684 bytes, with all 203
relocations identical after resolving local symbols to actual section offsets
and code symbols to function-relative targets.
- Data matches: .rodata 5,856, .data 464, .sdata2 40 bytes. The source .data is
459 bytes plus five zero alignment bytes in the split/link target.
- Pool identical, 10/10 strings. huffmanDecoder ctxdiff: 306/306, zero diffs.
LineConv11: 146/146; the strict-name local helper prints eight pre-existing
label-name differences. Exact bytes, resolved relocation destinations, and
referenced data independently match; none were ignored without resolution.
- Official objdiff: ODH 28/28 functions; code, data, fuzzy and link all 100%.
- Every measure, function and section in all 1,028 report units, plus all global
measures, is unchanged from the base report.
- Full 43U build and build/43U/ok pass. DOL SHA1:
26116613f624061ba99c8d1a299aaa6efa85670d.
- All 22 workflow-guard tests pass. A host UBSan refill test passes 524,288
cases against a 64-bit oracle (every high byte, offsets 0..7).
- The global completion checker still fails on pre-existing incomplete units;
this change does not claim repository-wide completion.
Local reproducible evidence: ../odh-unsigned-refills-evidence/verify.py,
verification.log, full-build.log, pool.log, guards.log, refill-test.cpp/log,
completion.log, status.json and dol.sha1. No publication or merge performed.

View File

@@ -109,3 +109,35 @@ AOSS_Init_old 1306/1584, AOSSApplyAuthOptions 22/114, AOSSXorBufferWithKey 34/14
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.
# opus-aoss round 3 (2026-10-09): AOSSXorBufferWithKey, AOSS_Init_old
Worktree data-d1, branch agent/w1009/o-aoss at origin/main 72e9c8d6. Scratch
compiles in /tmp/opus-aoss (same flags as ninja, 0.2 s per unit).
## AOSSXorBufferWithKey: 34 -> 0
mwdbg on the old forms (base, compound `^=`, `P = P ^ K`, `output` pointer)
showed what decides the unrolled-loop registers. The second loop's index is
an IRO temp split late, so it is numbered below the IRO CSE cursors
(`packetHalf + index`, `keyMask + index`). With three per-copy values the
cursors are high-degree and colored before the index, so the index never got
r3. A function-scope `output` pointer (used for load and store) is a named
local and survives; a single-use `mask` pointer inside only the second loop
is propagated back into a CSE temp.
The fix is the same `mask` pointer used in both loops (the first loop writes
the mask byte through it twice). Then both cursors stay named locals, the
index temp is colored first (r3), mask (declared first) gets r4 and output
r5, and `mask =` before `output =` gives the target add order.
| trial | differing |
|---|---|
| 14 loop-body spellings (compound, P^K, K^P, temps u8/u32/int, casts) | 37-57 |
| 256-form sweep (P/K spellings x 16 bodies x shared/new index) | best 24 (`u8* output = &packetHalf[index]`) |
| scoped pragma x every form above (15 pragmas) | best 24 |
| `output`/`mask` function-scope, `mask` only in loop 2 | 24 |
| `mask` in both loops, `output =` before `mask =` | 2 (add order) |
| `mask` in both loops, `mask =` before `output =` | **0** |
Unit after: 20/21 exact, pool identical.

View File

@@ -0,0 +1,52 @@
# opus-aterm attempts (ATERM, 2026-10-09)
Baseline 72e9c8d6: ATERM 20/26 exact; open: BuildEncryptedMessage 2, AutoConfigThread 3,
AesExpandEncryptKey 6, DiscoverAccessPoints 17, BuildAssociationRequest 28, RunConfigProtocol 294.
## Pragma sweep (combosweep, GC/3.0a5.2)
Single and pairwise pragmas: no function improves (BEST = base for all six).
## Compiler version (new finding)
Compiled the unchanged ATERM.c with every GC/Wii compiler that accepts the unit's flags:
| compiler | exact | total diffs | AutoConfigThread |
| --- | ---: | ---: | ---: |
| GC/3.0a3, 3.0a3.2, 3.0a3.3, 3.0a3.4, 3.0a5 | 21/26 | 347 | 0 |
| GC/3.0a5.2 (previous) | 20/26 | 350 | 3 |
| Wii/* | 7/26 | 1590+ | 5 |
GC/3.0a5 makes ATERMi_AutoConfigThread exact with no other function changing; pool identical,
data 100%. The other third-party middleware in this project (Zi Corp eZiText, NHTTP, bte) is already
built with GC/3.0a5. Set `mw_version="GC/3.0a5"` on ATERM.c.
## ATERMBuildEncryptedMessage (2: entry `mr r29,r7` / `mr r3,r27` swapped)
Read MWCC's scheduler (rayanht/mwcc decomp: Scheduler.c, MachineSimulation750.c) and wrote a model
(/tmp/opus-aterm-sched/sim.py). It reproduces our entry block and six micro-tests exactly (count of
unlocked successors, then height, then opcode rank mr < li, then program order; 2 IU slots).
The entry block is scheduled once, before register allocation (block flag 8 stops the post-RA pass).
Exhaustive search over that model: no order of the same ten PCode instructions with the parameter
copies first gives the target, and no single extra/deleted instruction does either. The target order
needs the copy of r7 to come after memset's first-argument move in the scheduler input.
## ATERMAesExpandEncryptKey (6 -> 0, EXACT)
The function is rijndaelKeySetupEnc from the public reference rijndael-alg-fst.c (Te4 = the
substitution table, rcon = the round constants). Earlier forms (initialKey[] array + copy loop,
hand-reassociated XOR trees) left the second key word's two XOR halves scheduled in the other order.
Trials (all GC/3.0a5): array/scalar/direct stores x seven XOR associations: 9..268; reference
GETU32 + reference loops verbatim: 3 (only cmplwi vs cmpwi); with the reference `int keyBits`: 0.
## ATERMDiscoverAccessPoints (17 -> 7)
mwdbg: callee-saved colors go r31 downward in decreasing vreg number. The three strength-reduced
record pointers (entries[i].ssid, entries[i] base, entries[i].bssid) are compiler temps created in
first-use order, so the target's increment order (ssid, base, bssid) means all three were indexed
accesses, not named cursors. The descriptor start (scan buffer + 2) has r27 above them, so it is a
loop-invariant expression hoisted after strength reduction, not a named local set before the loop.
- indexed record fields, named firstDescriptor: 22 (increment order fixed, firstDescriptor r24)
- descriptorWords = (u16*)scanBuffer + 1 inside the loop: 7; &((u16*)scanBuffer)[1]: 7;
(u16*)(scanBuffer + 2) and (u16*)(scanBuffer + sizeof(u16)): 105 (size changes)
Remaining 7: MAC formatter input pointer r9 vs target r5, low nibble r5 vs r9.

View File

@@ -0,0 +1,44 @@
# opus-bs2update UpdateThread attempts
Worktree data-d10, branch agent/w1009/o-bs2update, base 72e9c8d6 (origin/main). Owned `src/BS2/BS2Update.c`; the fix also needs a one-line rename in `config/43U/symbols.txt` and the Matching flip in `configure.py`. Read opus-common, levers, the effort-policy entries, sol-x8, sol-y3 (`git show 4925fde2`) and sol-z1.
Start: UpdateThread 6/913 differing, equal size 0xe44. The other nine functions are exact. The remaining diffs are the three seat-loop scheduling swaps described by sol-x8, sol-y3 and sol-z1.
combosweep (single and pairwise allowed pragmas): `BEST src/BS2/BS2Update UpdateThread base 6 -> 6 []`. No pragma moves it.
## Diagnosis
The decompiled 1.2.5 scheduler (rayanht/mwcc `src/backend/Scheduler.c`, inspiredrobot/mwcc `docs/SCHEDULER.md`) adds a store-to-later-load edge for every memory pair the alias test cannot separate, with the store's latency. sol-y3's capture already showed that the seat loads carry a worst-case alias set that contains Flags0's bit, so `Flags0[index] = 0` wins the height race against the seat address `add`. The target schedules the `add` first. That is the order you get when no such edge exists.
I tested small probe functions with the unit's exact compiler flags: a loop that stores `FlagsX[i] = 0` and then tests `p[i].attr & 1`. The results:
| Seat entries come from | Flag array | Edge (store first)? |
| --- | --- | --- |
| absolute `T a[] : addr` (array, struct, single entry, const, static) | file-scope static | yes |
| integer cast `(T*)0x80480000 + n` (folds to `addis`, wrong form anyway) | file-scope static | yes |
| pointer parameter | file-scope static | yes |
| normal relocated global array | file-scope static | no, but needs `lis/addi` with relocs (wrong form) |
| absolute array (target's `lis r0,0x8048; add` form) | file-scope static, initialized or tentative, extern | yes |
| absolute array | **function-local static** | **no** |
| absolute array | global scalar / local stack array | no |
An unknown pointer (absolute storage counts as unknown) may alias every file-scope object, but not a function-local static whose address is never taken. The target keeps the absolute `lis r0, 0x8048; add` form and has no edge. So Flags0 was a function-local static of the selection code.
## .bss order
The target order is Flags0, Flags1, Thread, ThreadStack, UpdateHeader0, UpdateHeader1. Probes on the same compiler show the emission rules:
- initialized objects are emitted where they are defined;
- tentative definitions are emitted at their first use;
- a function static is emitted when its function is parsed.
So the static has to come from a function parsed before BS2UpdateInit, and the other five arrays have to be tentative definitions. Init first uses Flags1, Thread and ThreadStack, and the inlined selection code first uses UpdateHeader0 and UpdateHeader1. That gives exactly the target order.
## Trials
1. `seatEntries = (BS2UpdateEntry*)0x80480000 + wadCount`: 549/912 (address folds into `addis`; the swaps stay). Rejected.
2. `static u32 Flags0[...] = {0};` inside BS2SelectUpdateEntries, everything else unchanged: 18/913. All three swaps gone; the 18 left are .bss offsets because Flags0 lands after UpdateHeader1. Init 4 diffs from the same shift.
3. As 2, but the Flags1/Thread/ThreadStack/UpdateHeader0/UpdateHeader1 definitions are tentative (the `= {0}` initializers dropped) and BS2SelectUpdateEntries is defined before BS2UpdateInit: **UpdateThread 0/913, all 10 functions exact**. .bss layout identical to the target, pool 55/55 identical.
4. Rename the target symbol `Flags0` to the compiler's local-static name `Flags0$1129` in config/43U/symbols.txt. This is the project convention for function statics (144 `name$N` entries). Report: code 4052/4052, data 10488/10488, every section 100%, functions 10/10.
5. Flip BS2Update to Matching and run the full build: DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. build.ninja links build/43U/src/src/BS2/BS2Update.o.
No pragma, asm, volatile change, carrier, padding or dummy is added. The source change is: the selection helper moves above BS2UpdateInit, Flags0 becomes its function static, and five `= {0}` initializers are removed.

View File

@@ -0,0 +1,61 @@
# opus-candbox attempts
Worktree `sol-high`, branch `agent/w1009/o-candbox`, base `72e9c8d6`. Unit `src/keyboard/tiCandidateBox`, last open function `LayoutByNW4R::createAnmPane_` (6/216, count r23 and slot r31 swapped). Read opus-common.md, levers.md, effort-policy entries, sol-x9 log, sol-m4 log (branch `agent/w1009/candbox-max`), saved sol-r12/sol-y11 diffs.
Baseline: full build OK, DOL `26116613...`, odiff 6/216, pool identical 57/57. combosweep (single and pairwise pragmas): `base 6 -> 6`, no hit.
## Root cause
`tiPredictLang::create` is already exact and has the same inner loop with the same struct (`char paneName[20]`, `count`, `forceAddName`, `pAnims[8]`). Its target has count r31 and slot r23, which is what createAnmPane_ needs.
A private mwdbg trace of `tiPredictLang::create` (port 19931 copy of the launcher, shared tool unchanged) shows why. The slot base `p + j*4` is IRO CSE temp `@7026` (vreg r45) and forceAddName is IRO temp `@7028` (r44). Both are numbered after the named locals and before the hoisted constructor constants, so they simplify before the constants and color after them (slot r23). Count is a late anonymous load hoisted out of the loop condition (r131), so it colors first (r31).
The same natural loop inside tiCandidateBox (`j < paneAnimations.count`, `paneAnimations.pAnims[j]->` three times) gives 220 insns. No IRO temps are created, the slot is recomputed in each branch, and constant `2` survives pass-1 spilling.
Table declaration trials with that loop:
| trial | table | result |
| --- | --- | --- |
| 01 | `extern "C" const CandidatePaneData scCandidatePaneData` (struct wrapper, aligned(8)) | 158/220 |
| 02 | `static const CandidatePaneData` (struct wrapper) | 158/220 |
| 03 | `extern "C" const PaneToAnimation[]` (plain array) | 158/220 |
| 04 | `static const PaneToAnimation[]` (plain array, no aligned) | **0/216** |
IRO only CSEs the table loads and addresses when the table is a static plain array, which is how every sibling unit declares it (`csPaneToAnimation`). The `CandidatePaneData` wrapper and `extern "C"` were decomp scaffolding. Without `aligned(8)` the table still lands at .data 0x28, size 0x680.
## Source changes
- Table: `static const PaneToAnimation csPaneToAnimation[]`, same name as tiToolBar/tiPredictLang/pctype. Removed the unused `CandidatePaneData` struct.
- `createAnmPane_`: the tiPredictLang/tiToolBar loop form, with no count/forceAddName/animation locals.
- symbols.txt: `scCandidatePaneData` -> `csPaneToAnimation__Q29textinput12candidatebox` (scope:local). Same address and size. Only tiCandidateBox referenced the old name.
Unit after this: 112/112 functions, code 100%, data 100%, all sections 100%, pool identical.
## Link (Matching flip)
First flip: DOL `8d444a7b...`. Two causes, both checked against the original objects:
1. Thunk order. Target `@36@__dt__` comes before `@36@setRootPaneScaleFor4x3..init`; ours put it last (already true on the old baseline). This is the "move to end on touch" thunk list (eggAudioExpMgr, lever 12). tiPredictLang/tiToolBar/tiCellPhone fix it with a header `Sample : public LayoutByNW4R` behind a `*_SAMPLE_CLASS` macro, and `__vt__Q39textinput12candidatebox6Sample` exists in the DOL. A Sample with only `virtual ~Sample() {}` does not move the thunks. It needs the inline constructor, so the Base/EventHandler/LayoutByNW4R constructor guards also accept `TI_CANDIDATEBOX_SAMPLE_CLASS`, as tiPredictLang.h does. After that, all 112 common functions are in target order. Proof it is required: removing it leaves the wrong thunk order and DOL `5507fb9e...`.
2. Weak vtable hole. The target has 0x40 zero bytes between `__vt__...AnmObserver` (0xd48) and `__vt__Q39textinput4util12AnimObserver` (0xd94). Ours left only the deduplicated gui::EventHandler copy (0x18), so everything after shifted by -0x20/-0x24. util::Animation methods were inline in the original: they sit as scattered weak functions in tiInputForm's .text, and MyTiManager.cpp already defines them `inline`. UITextArea has a `util::Animation` member, so the original object also emitted a weak `__vt__Q39textinput4util9Animation` (0x24, kept from tiInputForm). EventHandler 0x18 at 0xd58 + Animation 0x24 at 0xd70 ends at 0xd94. I added the same inline definitions as MyTiManager.cpp at the end of tiCandidateBox.cpp, with startAnm in this TU's declared parameter order. Only virtual calls exist, so no code changes. .data is now 0xda0, the target size.
Flip with both: full build OK, `build/43U/main.dol` SHA1 `26116613f624061ba99c8d1a299aaa6efa85670d`.
Trial snapshots: `/tmp/opus-candbox/trials/`. Captures: `/tmp/opus-candbox-cap-predictlang`, `/tmp/opus-candbox-cap-f01`.
## Gate
```text
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[src/keyboard/tiCandidateBox] pool: IDENTICAL
[src/keyboard/tiCandidateBox] objdiff: code 24000/24000 data 4652/4652 functions 112/112 fuzzy 100.0000 linked code 24000
[src/keyboard/tiCandidateBox] instruction-exact functions: 112/112
regressions vs baseline: 0
global matched_code_percent: 98.14728 -> 98.17613
global complete_code_percent: 91.22256 -> 92.02384
forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
GATE PASS
```
origin/main moved to `82783c6e` during the run (BS2Update lines in configure.py/symbols.txt only, no overlap). Not rebased.

View File

@@ -0,0 +1,47 @@
# opus-chansvm: CHANSVm round (ConvertToFloatFromStr, WinEmuWrite, DateDtor, BlobGetHexString, BlobPackCommon, Step)
Worktree data-d2, branch agent/w1009/o-chansvm, base 72e9c8d6. Start: 227/233 exact.
Scratch harness: /tmp/opus-chansvm (score.py compiles the unit with the Ninja flags and diffs every function).
## combosweep (single + pairwise pragmas, whole unit)
No setting improves any of the six functions (Float 2, Win 5, Date 7, Hex 14, Pack 47, Step 262).
## CHANSVmConvertToFloatFromStr: 2 -> 0 (exact)
Diff: target `lbz type; li 0; stw endPtr; cmplwi`, ours `... cmplwi; stw`.
Scheduler RE (mwcceppc 0x599ac0 builds the block graph bottom-up; 0x5a0150/0x5a0170 is Alias.c may_alias):
a load gets an edge to every later store it may alias, with the load latency as delay. The `obj->type`
load had the worst_case alias set, which contains the escaped local endPtr, so LBZ -> STW had delay 2
and the compare won the cycle-2 tie. A load whose base register comes from a pointer-to-const (or
restrict) variable gets a private pseudo-object alias instead (see zcanann/FFCC-Decomp
tools/patch_compiler_rw.py notes), so the edge disappears and the store issues at cycle 1.
The inlined parser's `const` parameter is copy-propagated into the caller's `object`, so the const has
to be on the caller's parameter. Small-harness check: const/restrict on the inline parameter alone keeps
the old order; on the caller parameter it gives the target order.
| attempt | Float | others |
|---|---|---|
| `const CHANSVmObjHdr* object` on ConvertToFloatFromStr, `(VmConvertFunc)` cast at its table slot | 0 | no change |
| VmConvertFunc typedef and all 11 converters take const, cast in StrFromArray | 0 | no change |
| `#pragma opt_pointer_analysis on` (diagnostic) | compiler segfaults | - |
Kept the first (minimal) form. Same lever as CHANSVmParseInt (`const CHANSVmObjHdr* obj`).
## VmDateDtor: 7 -> 0 (exact)
Diff: target loads `MonthTbl[mon]` before the outgoing `year` stack-argument store; ours after it.
Same mechanism: the stack-argument stores carry the worst_case alias, and global tables are members of
it, so every store -> table-load edge had delay 2. The target object has no symbols for the two tables
(0xb34, 0xb50 are unnamed local data), so they were never globals.
| attempt | Date | others |
|---|---|---|
| file-scope `static` on both tables | 7 | no change |
| file-scope `static` on one table (each) | 7 | no change |
| both tables as function-scope `static` inside VmDateDtor | 0 | no change, .data bytes identical |
| plus direct `date.x` access instead of `datePtr` | 84 | - |
Kept function-scope statics with the datePtr form.

View File

@@ -0,0 +1,68 @@
# opus-odh attempts (src/system/odh)
Worktree data-d6, branch agent/w1009/o-odh from origin/main 72e9c8d6. Read opus-common.md, sol-r4 and
sol-m2 logs, effort-policy entries, levers.md, the mwdbg README and the allocator reference.
Baseline: LineConv11 12/146, huffmanDecoder 171/306, unit 26/28 exact, pool identical.
## combosweep (run first)
- main source: LineConv11 12 -> 12, huffmanDecoder 171 -> 166 (opt_propagation off). No exact.
- sol-m2 seed: LineConv11 6 -> 6, huffmanDecoder 114 -> 114. No exact.
## LineConv11: EXACT
mwdbg capture of the seed: inside the loop r8 is the only free volatile GPR, so every other temp takes a
saved register and the lowest claimed one wins. The packed RGB565 word (v68) was colored before the
high byte (v66) and took r8. The target needs the high byte on r8, the pointer on r29, and the packed word
colored after cbValue claims r25. So the packed word has to be a named local numbered below cbValue.
Petari's matching SMG source (SMGCommunity/Petari src/Game/Screen/odh.cpp, read-only) does exactly that:
cbValue/crValue are declared with red/green/blue before the format chain, and `pixel` is built high byte
first (`pixel = src[o]; pixel <<= 8; pixel |= src[o + 1];`) inside the RGB565 block. Ported as-is with
this file's names: LineConv11 0/146, ctxdiff diffs 0, pool identical, no other function changes.
Lever isolation (each from the exact version):
- cbValue/crValue declared at their assignment instead: 5 diffs.
- pixel low byte first (`pixel = src[o + 1]; pixel |= src[o] << 8`): 6 diffs.
- pixel as one expression `(src[o] << 8) | src[o + 1]`: 6 diffs.
- planeSize indexing instead of cbSource/crSource pointers: 0 (either form works).
## huffmanDecoder: EXACT
Started from a fresh natural rewrite (early returns, `length`/`tableIndex`/`category` names, Petari-style
tree walks) instead of the Ghidra-shaped seed: 170 diffs, same 306 instructions. Structural fixes first:
- `coefficient = 1` before the first refill loop (the target sets it in the DC block): 163.
- DC leaf through a named `leafIndex` (target keeps `(idx + off + 1) * 2` + lhzx only in the DC walk).
- `length = 1;` before `tableIndex = 0;` in every walk (li order): 139, 0 structural left.
Then allocator work with mwdbg + a per-vreg want list built by aligning backend-04 PCode with the target
object (/tmp/opus-odh-want.py), and an annealer over the numbering (/tmp/opus-odh-anneal.py):
- A full renumbering (temps included) reached 1 miss and showed both maxLength values must be colored
after their walk temps, i.e. behave as codegen temps. `maxLength = component == 0 ? 9 : 11;` gets
copy-propagated into the ternary temp: 139 -> 80.
- `dc` must be colored before the predictor-index temp, so no named `dc`:
`coefficientOutput[0] = value + *pred; *pred = coefficientOutput[0];` (store forwarded, no reload): 68.
- AC tail: target creates the store address before `length + category`:
`coefficientOutput[coefficient++] = value; bitOffset += length + category;`: 66.
- Remaining misses were named-local order only. Simulator: declare sourceCursor, bitOffset, coefficient,
category before bytesConsumed (sourceCursor colors first and takes r12, bitOffset claims r31, then
coefficient r30, category r29, bytesConsumed r28). C89 declarations at the top of the function: 9.
- Last 9: the run walk needs `branch` numbered above `node` (declared first). Per-walk C89 blocks
`u32 branch; u16 node;` then assignments: 0. Only the run walk needs it; using it in all three walks
is also exact, so the final source is uniform.
Checked and rejected along the way: function-scope shared node/branch (always 9, any position);
`value += *pred` (80); chained assignment for the predictor works (68) but the two-statement form reads
better. maxLength/value/mask/leafIndex/run/i can sit anywhere in the top declaration list.
Final: huffmanDecoder 0/306, ctxdiff diffs 0, pool identical, unit 28/28, code 14684/14684, data 6360/6360.
## Link
Flipped system/odh.cpp to Matching. ODHEncodeRGBA8/ODHEncodeY8U8V8/ODHDecodeY8U8V8 are in the source but
not in the split target (unreferenced, dead-stripped); the link output is unchanged.
Full build: main.dol SHA1 26116613f624061ba99c8d1a299aaa6efa85670d, "system/odh.cpp: linked True".
Gate (`gate.py src/system/odh --quick`): GATE PASS, 28/28 instruction-exact, linked code 14684,
0 regressions, 0 forbidden patterns, 0 readability warnings. Global matched code 98.14728 -> 98.20765.

View File

@@ -0,0 +1,53 @@
# opus-sdmem attempts: SDMemory::drawTransferTitles
Unit `src/scene/sdChannelMemory/iplSDMemory`, branch `agent/w1009/o-sdmem` from `72e9c8d6`.
Start: 363/451 differing, 447/451 instructions, 97.4102%. combosweep: no setting beats 363.
## Header loops: MSL's C++ `wcsstr` overload
The target's two guarded loops (`cmpwi; beq` / `addic.; ble`, then a preheader with
`li rX, "\n"@sda21`, then `b test`) come from MWCC's `IRO_PullOutInvariantAssignments`
(string `IRO_CopyLoopTestToLoopPreheaderAndBranchToSuccNode` in mwcceppc.exe). The pass
needs a loop-invariant *assignment* inside the loop. A plain `wcsstr(p, L"\n")` has none,
so no loop form, pragma, IRO level or `-O4,p` reproduces it in isolated tests.
Real MSL (`MSL_C/wstring.h`, see RushRE/SonicRushAdventure-Decomp tools/cw/include) declares,
for non-embedded C++, `const wchar_t* wcsstr(const wchar_t*, const wchar_t*)` plus
`inline wchar_t* wcsstr(wchar_t* s1, const wchar_t* s2)` calling the const one. Calling it
with a `wchar_t*` inlines the wrapper; its parameter assignment `s2 = L"\n"` is the
invariant assignment the IRO pass pulls into a guarded preheader. Isolated test reproduces
the target sequence instruction for instruction.
`message::Message::getMessage` already returns `wchar_t*`; the `Manager`/`System` wrappers
now return `wchar_t*` too, so message pointers in this function are non-const and use the
overload. The scoped `ppc_iro_level 1` is removed (it suppresses the pass) and the newline
counter is a plain `while` loop.
Result: 88/451 differing, 451/451 instructions, 99.28603%.
Side effect: `LetterWriter::makeHeaderCaption` passed a call result straight to `wcsstr`;
with the overload the literal is evaluated before the virtual call (100 -> 94%). A named
`caption` local restores the target order (three spellings tested, all exact). Full report
otherwise unchanged vs `72e9c8d6`, DOL SHA1 unchanged.
## Title colors: real NW4R `TextBox::SetTextColor(ut::Color top, ut::Color bottom)`
The two helpers after drawTransferTitles were invented names (`iplSDMemory_813EF6C4/6D8`
before #254). Their bodies and placement fit weak header inlines that this large function
did not inline: `nw4r::ut::Color::Color(int, int, int, int)` (four `stb`) and NW4R's
`TextBox::SetTextColor(ut::Color top, ut::Color bottom)` (by-value colors, two calls to the
weak `Color::operator=`; same inline in hotlandsoftware/wii-news-channel, declared in Petari).
By-value arguments explain the retail stack: the named color sits with the other named
locals, the two argument copies are temporaries in source order, the snapshot comes last.
`textBox.h` now has that overload instead of the `IPL_SDMEMORY_SET_TEXT_COLORS` hack, the
source is `nw4r::ut::Color color(...); titleText->SetTextColor(color, color);`, and
symbols.txt names the two functions `__ct__Q34nw4r2ut5ColorFiiii` and
`SetTextColor__Q34nw4r3lyt7TextBoxFQ34nw4r2ut5ColorQ34nw4r2ut5Color` (both 100%).
The N_Body alpha loop is written in place like the header/footer loops: through the
`setChildrenAlpha` inline its iterator temporaries were allocated after the footer's
(inline expansion runs after parsing), retail has them in source order.
`titleOffset -= visibleRows * rowHeight` fixes the `fmuls` operand order.
Result: 50/451 differing, register-blind identical apart from the renamed call targets,
99.39024%. Pool and .data/.sdata/.sdata2 identical; full report unchanged otherwise; DOL OK.

View File

@@ -0,0 +1,486 @@
# sol-audit integrity audit
Worktree `data-d12`, branch `agent/w1009/data-d12-audit`, baseline `c723136f`.
The first full 43U build passed. DOL SHA1 was
`26116613f624061ba99c8d1a299aaa6efa85670d`.
Each retained edit must preserve every allocated section and resolved relocation
against the starting object, exact-name objdiff scores, instruction comparisons,
string pools, the full DOL hash, and the final gate. Existing non-exact functions
in BS2Mach and CHANSVm must preserve their starting bytes.
Audited 21 variables: 11 carriers and 10 legitimate aggregates. Removed seven
carriers and expressed two legitimate FAT-hint snapshots with their existing
type. Four carriers remain unchanged after unsuccessful trials: Board, FAT12,
WAD import and PUD matching. Their remaining compiler differences are recorded
below. No excluded function range was edited.
## Candidate verdicts
Locations refer to the starting source scan. Each function-local aggregate is
judged by its actual uses and receiving interfaces.
| Location and variable | Verdict | Action | Result |
| --- | --- | --- | --- |
| `src/scene/board/iplBoard.cpp:432 state` | carrier | Restore after 40 declaration orders and allocator capture | Blocked: ordinary interrupt states become r24 instead of SP+8/+0x10/+0x14; frame 0x90 instead of 0xA0 |
| `libs/RVLMiddleware/eZiText/src/clib/zikorean.c:30 state` | carrier | Replace with reverse-order ordinary locals | Exact 619/619 instructions, diffs 0; whole object unchanged |
| `libs/RVLMiddleware/eZiText/src/clib/zi8match.c:116 state` | carrier | Replace with reverse-order ordinary locals | Exact 311/311 instructions, diffs 0; whole object unchanged |
| `libs/RVLMiddleware/eZiText/src/clib/zi8match.c:293 traversal` | carrier | Replace with reverse-order ordinary locals | Exact 363/363 instructions, diffs 0; whole object unchanged |
| `libs/RVLMiddleware/eZiText/src/clib/zi8pud2.c:60 match` | carrier | Restore after rejecting an exact but unread local copy | Blocked: SP+0x24 is a dead workspace-pointer store; honest removal produces 353/354 instructions |
| `libs/RVL_SDK/src/fa/pf_fat12.c:178 state` | carrier | Restore after 49 compiled trials and allocator capture | Blocked: target offset=r31/error=r28, ordinary locals offset=r28/error=r31; best 23 differences in 155/155 instructions |
| `libs/RVL_SDK/src/fa/pf_path.c:421 work` | carrier | Use actual 13-byte SFN buffer and separate matched_end | Exact 87/87 instructions, diffs 0; whole object unchanged |
| `libs/RVL_SDK/src/fa/pf_file.c:1876 saved_hint` | legit | Use existing three-word PFFILE_FAT_HINT | Real state passed to PFFAT APIs; exact fadjust 115/115 instructions, diffs 0 |
| `libs/RVL_SDK/src/fa/pf_file.c:1926 saved_hint` | legit | Use existing three-word PFFILE_FAT_HINT | Same real hint state; exact finfo 91/91 instructions, diffs 0 |
| `libs/RVL_SDK/src/fa/pf_file.c:101 last_access_data` | legit | Retain | Nested member of the real file type, shared FAT-hint/error-state storage |
| `libs/RVL_SDK/src/fa/pf_dir.c:104 volume_state` | legit | Retain | Nested member of global volume state, typed current-volume array view |
| `src/BS2/BS2Mach.c:1331 loaderRead` | carrier | Separate address/length/offset before titleCode | Whole object unchanged; BS2Tick retains its pre-existing 71 instruction differences, 1940/1940 instructions |
| `src/keyboard/tiCandidateBox.cpp:296 predictionState` | legit | Retain | Actual mode/enabled command record; tiInputForm commands 29 and 31 consume and populate both fields |
| `src/system/iplSystem.cpp:530 blankNameStorage` | carrier | Use ordinary SCOwnerNickname | Exact init 689/689 instructions, diffs 0; whole object unchanged |
| `libs/RVL_SDK/src/kpad/KPAD.c:72 dpdState` | legit | Retain | Nested member of KPADInside holding actual sensor objects and candidate pairs |
| `libs/RVL_SDK/src/fs/fs.c:64 args` | legit | Retain | Nested tagged callback payload union used by asynchronous FS operations |
| `libs/RVL_SDK/src/wad/wad.c:3499 parts` | carrier | Restore after 40 declaration orders | Blocked: target clears 0x28 bytes at SP+0x40; independent scalar objects cannot reproduce that contiguous clear safely |
| `libs/RVL_SDK/src/wad/wad.c:1937 fields` | legit | Retain | Nested file-info view overlaying actual FAFileInfo storage |
| `src/channelScript/CHANSVm.c:5503 unpackBuf` | legit | Retain | Single 64-bit value viewed as two words during blob decoding |
| `src/channelScript/CHANSVm.c:347 u` | carrier | Separate chunk offset and result pointer | CHANSVmNewObjData exact 96/96 instructions, diffs 0; every caller and partial function unchanged |
| `src/system/TVRC.cpp:38 commands` | legit | Retain | Nested command-offset table in the real TVRC database file format |
## Prior evidence
Read sol-common.md, brief-v2.md and all levers. Consulted existing attempts for
the affected units before editing. The current integrity rule overrides older
logs that accepted carriers as search state.
Board: rx65 and grok-board already tested both flat declaration directions,
reference aliases, invented one-field wrappers, inline out-parameter guards,
real interrupt guards and single-interrupt-state reuse. These do not reproduce
the three target stack homes. Do not repeat them as new ideas. grok-board's
volatile diagnostic matched but was rejected because the target has no repeated
volatile read.
PUD: allhands-ezitext-pud-packed-header established that the incoming work
pointer store at SP+0x24 is never read or passed onward. Plain reverse-order
locals also reproduce that store, but the resulting workspace local is unread.
That initial exact edit was rejected and reverted under sol-common.md rule 4.
FAT12: fz3 had exhaustively tested the five flat-local permutations, callback
scopes, offset typing and a FAT-flush helper. Its current carrier matched a
register-allocation tie; new trials must explore additional source shapes.
## Retained source and type evidence
eZiText scalar declarations in reverse field order reproduce the target stack
homes without aggregate storage. Korean, secondary character and phonetic
matching retain all instruction bytes and data. The PUD exception is discussed
below and is not part of the retained changes.
PFPATH_cmpName uses a genuine SFN buffer. PF_DIR_ENT.short_name is declared as
13 bytes in libs/RevoEX/include/private/vf/PrFILE2/fatfs/pf_entry.h:15, and
pf_entry/pf_dir callers pass that field. An 8.3 name contains at most 12 bytes
plus its terminator. Appending a dot to a name without one also fits; the longest
volume-label name is 11 bytes. A standalone 16-byte buffer lands at SP+0x10,
three instruction operands away from the target SP+0xC. The actual 13-byte
capacity puts the buffer at SP+0xC and matched_end at SP+8, without alignment
attributes or padding.
The two saved_hint variables are snapshots of one real FAT-hint value. The
existing PFFILE_FAT_HINT at pf_file.c:9 and PFFAT_HINT at pf_fat.c:80 both have
chain_index, cluster and previous_cluster. PFFAT_InitHint at pf_fat.c:1907 clears
all three words; PFFAT_InitFFD consumes previous_cluster. pf_file.c passes
&file->hint to these APIs and places it in ffd.p_hint. The imported PF_FAT_HINT
view declares only two words, so its third word is viewed through
last_access_data.last_access.chain_index. Using the already-defined
PFFILE_FAT_HINT makes this single three-word API state explicit. fadjust keeps
the hint at SP+0xC/+0x10/+0x14 and cursor at SP+0x18 through SP+0x24 in a 0x30
frame; finfo keeps its hint at SP+8/+0xC/+0x10 and cursor at SP+0x18 through
SP+0x24 in a 0x40 frame. No shared type or field layout changed.
BS2Tick's address, length and offset are separate Apploader output parameters.
Moving the reverse-order declarations immediately after interruptsEnabled
preserves their starting offsets and the entire original source object. BS2Tick
was already partial and remains partial; this audit does not claim a new match.
VmReserveChunkEntry's offset and returned ChunkEntry pointer have independent
lifetimes. Their old union was storage reuse, not type punning of one value.
Separate chunkOffset and entry locals, with entry declared after chunkIdx,
preserve every inline expansion. The exhaustion path now assigns vmNull to
entry directly instead of constructing it by writing the integer union member.
blankNameStorage wraps a single SCOwnerNickname without a separate interface or
meaning. The ordinary SCOwnerNickname local gives identical init code.
## Carriers retained after failed removal
### Board::appendRecord
Forty compiled declaration orders and a fresh confirmation produced a best
44 differing instructions, with 283/283 instructions. The ordinary-local frame
is 0x90; the target is 0xA0. The target stores recordInterrupts at SP+8,
waitInterrupts at SP+0x10 and slotInterrupts at SP+0x14. Other target homes are
dataSize SP+0xC, times SP+0x18/+0x1C/+0x20, gameCode SP+0x24, id SP+0x28,
type SP+0x30, date SP+0x38 and key SP+0x48.
The best ordinary-local allocator capture assigns all three non-overlapping
interrupt states to r24: virtual r38 slotInterrupts (18 neighbors), r39
recordInterrupts (23 neighbors), and r40 waitInterrupts (19 neighbors). Each is
simplified and colored without spilling. Declaration permutations do not force
their three target stack homes. Prior scoped/reference/guard variants were
already unsuccessful or forbidden. Restored the original source and object.
Diagnostic diff: /mnt/drive2/projects/wii-ipl-workers/_luna-runs/best/sol-audit.iplBoard.diff.
Capture: /tmp/sol-audit-board-capture; its emitted allocated sections agree with
the ordinary compiler build of the captured source.
### PFFAT12_ReadFATEntryWithBuf
Forty-nine compiled trials covered separate locals, real FAT-sector and
read-sector helpers, scoped copy-loop counters, 31 combinations of named actual
mask/sector/callback values, and error-value lifetime/type variants. The best
has 23 differences in 155/155 instructions and the correct 0x30 frame. The
remaining problem is register ordering, not stack offsets: target offset=r31,
err=r28, current_fat=r29, sector=r30; flat offset=r28, err=r31, with the latter
two unchanged.
The captured graph maps virtual r37 offset to r28, r38 err to r31, r39
current_fat to r29 and r40 sector to r30. Compiler-created @692/r41 and
@690/r42 also use r31 at other lifetimes. Regsim reproduces all 84 captured
assignments. A search constrained to the five source locals reaches only two
of four desired colors; a nominal four-of-four search requires permuting
parameters and compiler-created temporaries, which source declaration order
cannot do. Real source-shape changes either retain the 23 differences or add
instructions. Restored the carrier rather than use volatile casts, register
keywords or artificial storage.
Diagnostic diff: /mnt/drive2/projects/wii-ipl-workers/_luna-runs/best/sol-audit.pf_fat12.diff.
Capture: /tmp/sol-audit-fat12-capture; constrained simulator:
/tmp/sol-audit-regsim.py.
### WADImportDVDExForBS
Forty successfully compiled declaration orders and a fresh confirmation have
262/263 instructions, 223 differences and a 0xE0 frame instead of target 0x100.
An initial batch failed because of a field-prefix substitution error; those
failures do not count as compiled effort.
The target clears a contiguous 0x28-byte region at SP+0x40. Its field homes are
type 0x40, cidxMode 0x44, version 0x46, certSize 0x48, certificates 0x4C,
crlSize 0x50, crls 0x54, ticketSize 0x58, ticket 0x5C, tmdSize 0x60 and tmd
0x64. Header is at SP+0x20 and fileInfo at SP+0x68. Flat metadata values
become registers r31/r30/r29/r28/r27/r26/r22; type is at SP+0x20, header at
SP+0x40 and fileInfo at SP+0x60. Their independent object sizes cannot safely
support the target's one 40-byte memset. Per-object initialization also exposes
cidxMode=0 and folds the target's conditional mask branches. A diagnostic
memset through &type cannot justify a retained change because it writes past
that scalar object. Restored the entire original WAD source and object.
Diagnostic diff: /mnt/drive2/projects/wii-ipl-workers/_luna-runs/best/sol-audit.wad.diff.
### Zi8MatchPUDdata_ZHS
The target instruction at function offset 0x3C is stw r31,0x24(r1). SP+0x24
is never read or passed out; the working pointer remains r31, and fallback is
at SP+0x20. Reverse-order plain locals reproduce all 354 instructions only
by retaining an unread workspace copy. That candidate was initially committed
as 80d7290c, then rejected and reverted in 5b0f57b6.
Four subsequent compiled trials removed the dead copy, used a live void-pointer
alias throughout, used a live typed alias throughout, or scoped a live typed
alias to the language-table lookup. Removing the copy gives 353/354 instructions
and omits the required store. Live aliases give 385/354 or 366/354 instructions
because they change the actual workspace loads and stack homes. No acceptable
use was found for the target's unread SP+0x24 word. Restored the carrier and
every original object byte; no replacement dead local is retained.
Best source without the dead copy:
/mnt/drive2/projects/wii-ipl-workers/_luna-runs/best/sol-audit.zi8pud2.diff.
## Compiled trials
Counts below are differing instructions against the target, with equal size
required for exactness. An additional comparison covers every allocated section
and resolved relocation against the starting object.
| Trial | Change or reason | Measurement |
| --- | --- | --- |
| PFPATH_cmpName-flat-reverse | Separate ordinary locals; reverse declaration order | PFPATH_cmpName: 3/87, insns 87/87; baseline sections and relocations different |
| PFPATH_cmpName-flat-field | Separate ordinary locals; original field order | PFPATH_cmpName: 3/87, insns 87/87; baseline sections and relocations different |
| BS2Tick-flat-reverse | Separate ordinary locals; reverse declaration order | BS2Tick: 105/1940, insns 1940/1940; baseline sections and relocations different |
| BS2Tick-flat-field | Separate ordinary locals; original field order | BS2Tick: 105/1940, insns 1940/1940; baseline sections and relocations different |
| init__Q23ipl6SystemFiPPc-flat-reverse | Separate ordinary locals; reverse declaration order | init__Q23ipl6SystemFiPPc: 0/689, insns 689/689; baseline sections and relocations identical |
| PFFILE_fadjust-flat-reverse | Separate ordinary locals; reverse declaration order | PFFILE_fadjust: 87/115, insns 115/115; baseline sections and relocations different |
| PFFILE_fadjust-flat-field | Separate ordinary locals; original field order | PFFILE_fadjust: 87/115, insns 115/115; baseline sections and relocations different |
| PFFILE_finfo-flat-reverse | Separate ordinary locals; reverse declaration order | PFFILE_finfo: 58/91, insns 89/91; baseline sections and relocations different |
| PFFILE_finfo-flat-field | Separate ordinary locals; original field order | PFFILE_finfo: 58/91, insns 89/91; baseline sections and relocations different |
| Zi8GetKoreanCandidates-flat-reverse | Flat scalar confirmation; existing target has memory-backed aggregate members | Zi8GetKoreanCandidates: 0/619, insns 619/619; baseline sections and relocations identical |
| Zi8SecMatchChar-flat-reverse | Flat scalar confirmation; existing target has memory-backed aggregate members | Zi8SecMatchChar: 0/311, insns 311/311; baseline sections and relocations identical |
| Zi8MatchPhonetic-flat-reverse | Flat scalar confirmation; existing target has memory-backed aggregate members | Zi8MatchPhonetic: 0/363, insns 363/363; baseline sections and relocations identical |
| Zi8MatchPUDdata_ZHS-flat-reverse | Flat scalar confirmation; existing target has memory-backed aggregate members | Zi8MatchPUDdata_ZHS: 0/354, insns 354/354; baseline sections and relocations identical |
| PFFAT12_ReadFATEntryWithBuf-flat-reverse | Flat scalar confirmation; existing target has memory-backed aggregate members | PFFAT12_ReadFATEntryWithBuf: 30/155, insns 155/155; baseline sections and relocations different |
| PFFAT12_ReadFATEntryWithBuf-flat-field | Flat scalar confirmation; existing target has memory-backed aggregate members | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155; baseline sections and relocations different |
| VmReserveChunkEntry-separate | Use separate offset and result pointer, preserving the NULL return on exhaustion | CHANSVmNewObjData: 11/96, insns 96/96; baseline sections and relocations different |
| PFPATH_cmpName-array-align4 | Natural byte buffer layout without aggregate padding | BUILD FAIL |
| PFPATH_cmpName-array-align1 | Natural byte buffer layout without aggregate padding | BUILD FAIL |
| PFPATH_cmpName-array-align2 | Natural byte buffer layout without aggregate padding | BUILD FAIL |
| PFPATH_cmpName-array-near-copy | Natural byte buffer layout without aggregate padding | BUILD FAIL |
| PFPATH_cmpName-byte-array-align1 | Inspect target byte-array alignment and declaration scope | PFPATH_cmpName: 33/87, insns 88/87; baseline sections and relocations different |
| PFPATH_cmpName-byte-array-align2 | Inspect target byte-array alignment and declaration scope | PFPATH_cmpName: 33/87, insns 88/87; baseline sections and relocations different |
| PFPATH_cmpName-byte-array-align4 | Inspect target byte-array alignment and declaration scope | PFPATH_cmpName: 33/87, insns 88/87; baseline sections and relocations different |
| PFPATH_cmpName-byte-array-align8 | Inspect target byte-array alignment and declaration scope | PFPATH_cmpName: 33/87, insns 88/87; baseline sections and relocations different |
| PFPATH_cmpName-short-name-buffer13 | Inspect target byte-array alignment and declaration scope | PFPATH_cmpName: 0/87, insns 87/87; baseline sections and relocations identical |
| fat12-flat-for-mwdbg | Capture the actual flat scalar allocator tie before selecting source shapes | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155; baseline sections and relocations different |
| VmReserveChunkEntry-order-0 | Separate search offset and actual return pointer; declaration order u32 idx;,u32 chunkOffset;,ChunkEntry* entry;,ChunkEntry* chunk;,u32 chunkIdx; | CHANSVmNewObjData: 11/96, insns 96/96; baseline sections and relocations different |
| VmReserveChunkEntry-order-1 | Separate search offset and actual return pointer; declaration order u32 idx;,u32 chunkOffset;,ChunkEntry* entry;,u32 chunkIdx;,ChunkEntry* chunk; | CHANSVmNewObjData: 11/96, insns 96/96; baseline sections and relocations different |
| VmReserveChunkEntry-order-2 | Separate search offset and actual return pointer; declaration order u32 idx;,u32 chunkOffset;,ChunkEntry* chunk;,ChunkEntry* entry;,u32 chunkIdx; | CHANSVmNewObjData: 11/96, insns 96/96; baseline sections and relocations different |
| VmReserveChunkEntry-order-3 | Separate search offset and actual return pointer; declaration order u32 idx;,u32 chunkOffset;,ChunkEntry* chunk;,u32 chunkIdx;,ChunkEntry* entry; | CHANSVmNewObjData: 0/96, insns 96/96; baseline sections and relocations identical |
| PFFILE_fadjust-copy-chain | Ordinary state snapshots copied independently through standard memcpy | PFFILE_fadjust: 118/115, insns 122/115, baseline differences 118; baseline sections and relocations different |
| PFFILE_fadjust-copy-both | Ordinary state snapshots copied independently through standard memcpy | PFFILE_fadjust: 119/115, insns 122/115, baseline differences 119; baseline sections and relocations different |
| PFFILE_fadjust-copy-chain-save | Ordinary state snapshots copied independently through standard memcpy | PFFILE_fadjust: 81/115, insns 117/115, baseline differences 81; baseline sections and relocations different |
| PFFILE_fadjust-copy-chain-restore | Ordinary state snapshots copied independently through standard memcpy | PFFILE_fadjust: 116/115, insns 120/115, baseline differences 116; baseline sections and relocations different |
| PFFILE_finfo-copy-chain | Ordinary state snapshots copied independently through standard memcpy | PFFILE_finfo: 55/91, insns 97/91, baseline differences 55; baseline sections and relocations different |
| PFFILE_finfo-copy-both | Ordinary state snapshots copied independently through standard memcpy | PFFILE_finfo: 69/91, insns 97/91, baseline differences 69; baseline sections and relocations different |
| PFFILE_finfo-copy-chain-save | Ordinary state snapshots copied independently through standard memcpy | PFFILE_finfo: 51/91, insns 93/91, baseline differences 51; baseline sections and relocations different |
| PFFILE_finfo-copy-chain-restore | Ordinary state snapshots copied independently through standard memcpy | PFFILE_finfo: 40/91, insns 95/91, baseline differences 40; baseline sections and relocations different |
| BS2Tick-baseline-offsets | Measure changed stack offsets against starting bytes, independently of existing target mismatch | BS2Tick: 105/1940, insns 1940/1940, baseline differences 34; baseline sections and relocations different |
| BS2Tick-locals-0 | Plain loader output order offset,length,address before u32 titleCode; | BS2Tick: 85/1940, insns 1940/1940, baseline differences 14; baseline sections and relocations different |
| BS2Tick-locals-1 | Plain loader output order offset,length,address before u8 titleCharacters[4]; | BS2Tick: 85/1940, insns 1940/1940, baseline differences 14; baseline sections and relocations different |
| BS2Tick-locals-2 | Plain loader output order offset,length,address before DVDFileInfo bannerFile; | BS2Tick: 105/1940, insns 1940/1940, baseline differences 34; baseline sections and relocations different |
| BS2Tick-locals-3 | Plain loader output order offset,length,address before s32 status; | BS2Tick: 105/1940, insns 1940/1940, baseline differences 34; baseline sections and relocations different |
| BS2Tick-locals-4 | Plain loader output order offset,length,address before switch (State) { | BS2Tick: 105/1940, insns 1940/1940, baseline differences 34; baseline sections and relocations different |
| BS2Tick-locals-5 | Plain loader output order offset,address,length before u32 titleCode; | BS2Tick: 93/1940, insns 1940/1940, baseline differences 22; baseline sections and relocations different |
| BS2Tick-locals-6 | Plain loader output order offset,address,length before u8 titleCharacters[4]; | BS2Tick: 93/1940, insns 1940/1940, baseline differences 22; baseline sections and relocations different |
| BS2Tick-locals-7 | Plain loader output order offset,address,length before DVDFileInfo bannerFile; | BS2Tick: 105/1940, insns 1940/1940, baseline differences 34; baseline sections and relocations different |
| BS2Tick-locals-8 | Plain loader output order offset,address,length before s32 status; | BS2Tick: 105/1940, insns 1940/1940, baseline differences 34; baseline sections and relocations different |
| BS2Tick-locals-9 | Plain loader output order offset,address,length before switch (State) { | BS2Tick: 105/1940, insns 1940/1940, baseline differences 34; baseline sections and relocations different |
| BS2Tick-locals-10 | Plain loader output order length,offset,address before u32 titleCode; | BS2Tick: 93/1940, insns 1940/1940, baseline differences 22; baseline sections and relocations different |
| BS2Tick-locals-11 | Plain loader output order length,offset,address before u8 titleCharacters[4]; | BS2Tick: 93/1940, insns 1940/1940, baseline differences 22; baseline sections and relocations different |
| BS2Tick-locals-12 | Plain loader output order length,offset,address before DVDFileInfo bannerFile; | BS2Tick: 90/1940, insns 1940/1940, baseline differences 19; baseline sections and relocations different |
| BS2Tick-locals-13 | Plain loader output order length,offset,address before s32 status; | BS2Tick: 90/1940, insns 1940/1940, baseline differences 19; baseline sections and relocations different |
| BS2Tick-locals-14 | Plain loader output order length,offset,address before switch (State) { | BS2Tick: 90/1940, insns 1940/1940, baseline differences 19; baseline sections and relocations different |
| BS2Tick-locals-15 | Plain loader output order length,address,offset before u32 titleCode; | BS2Tick: 86/1940, insns 1940/1940, baseline differences 15; baseline sections and relocations different |
| BS2Tick-locals-16 | Plain loader output order length,address,offset before u8 titleCharacters[4]; | BS2Tick: 86/1940, insns 1940/1940, baseline differences 15; baseline sections and relocations different |
| BS2Tick-locals-17 | Plain loader output order length,address,offset before DVDFileInfo bannerFile; | BS2Tick: 97/1940, insns 1940/1940, baseline differences 26; baseline sections and relocations different |
| BS2Tick-locals-18 | Plain loader output order length,address,offset before s32 status; | BS2Tick: 97/1940, insns 1940/1940, baseline differences 26; baseline sections and relocations different |
| BS2Tick-locals-19 | Plain loader output order length,address,offset before switch (State) { | BS2Tick: 97/1940, insns 1940/1940, baseline differences 26; baseline sections and relocations different |
| BS2Tick-locals-20 | Plain loader output order address,offset,length before u32 titleCode; | BS2Tick: 86/1940, insns 1940/1940, baseline differences 15; baseline sections and relocations different |
| BS2Tick-locals-21 | Plain loader output order address,offset,length before u8 titleCharacters[4]; | BS2Tick: 86/1940, insns 1940/1940, baseline differences 15; baseline sections and relocations different |
| BS2Tick-locals-22 | Plain loader output order address,offset,length before DVDFileInfo bannerFile; | BS2Tick: 98/1940, insns 1940/1940, baseline differences 27; baseline sections and relocations different |
| BS2Tick-locals-23 | Plain loader output order address,offset,length before s32 status; | BS2Tick: 98/1940, insns 1940/1940, baseline differences 27; baseline sections and relocations different |
| BS2Tick-locals-24 | Plain loader output order address,offset,length before switch (State) { | BS2Tick: 98/1940, insns 1940/1940, baseline differences 27; baseline sections and relocations different |
| BS2Tick-locals-25 | Plain loader output order address,length,offset before u32 titleCode; | BS2Tick: 71/1940, insns 1940/1940, baseline differences 0; baseline sections and relocations identical |
| PFFILE_fadjust-real-fat-hint | The FAT implementation actually accepts a three-word chain_index/cluster/previous_cluster hint at &file->hint | PFFILE_fadjust: 0/115, insns 115/115, baseline differences 0; baseline sections and relocations identical |
| PFFILE_finfo-real-fat-hint | The FAT implementation actually accepts a three-word chain_index/cluster/previous_cluster hint at &file->hint | PFFILE_finfo: 0/91, insns 91/91, baseline differences 0; baseline sections and relocations identical |
| Board-flat-order-0 | Ordinary record and interrupt locals; declaration order recordInterrupts,recordDate,recordSecond,slotInterrupts,waitInterrupts,recordKey,recordGC,cdbId,recordMin,dataSize,recordType[8],recordHour | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 53/283, insns 283/283, baseline differences 53; baseline sections and relocations different |
| Board-flat-order-1 | Ordinary record and interrupt locals; declaration order recordInterrupts,recordDate,recordHour,recordGC,recordMin,recordKey,dataSize,recordSecond,recordType[8],cdbId,waitInterrupts,slotInterrupts | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 54/283, insns 283/283, baseline differences 54; baseline sections and relocations different |
| Board-flat-order-2 | Ordinary record and interrupt locals; declaration order recordGC,recordKey,recordType[8],dataSize,slotInterrupts,recordDate,recordInterrupts,recordHour,recordSecond,recordMin,cdbId,waitInterrupts | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 58/283, insns 283/283, baseline differences 58; baseline sections and relocations different |
| Board-flat-order-3 | Ordinary record and interrupt locals; declaration order recordType[8],recordInterrupts,waitInterrupts,recordMin,recordDate,recordHour,recordKey,cdbId,recordGC,slotInterrupts,dataSize,recordSecond | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 54/283, insns 283/283, baseline differences 54; baseline sections and relocations different |
| Board-flat-order-4 | Ordinary record and interrupt locals; declaration order recordGC,recordMin,waitInterrupts,dataSize,recordHour,recordDate,recordSecond,recordType[8],recordInterrupts,cdbId,recordKey,slotInterrupts | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-5 | Ordinary record and interrupt locals; declaration order recordGC,recordSecond,cdbId,recordDate,recordType[8],recordKey,waitInterrupts,recordMin,recordHour,dataSize,recordInterrupts,slotInterrupts | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-6 | Ordinary record and interrupt locals; declaration order dataSize,recordHour,recordSecond,recordGC,waitInterrupts,recordMin,recordDate,slotInterrupts,cdbId,recordKey,recordType[8],recordInterrupts | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-7 | Ordinary record and interrupt locals; declaration order recordType[8],recordDate,recordMin,recordSecond,cdbId,recordInterrupts,waitInterrupts,recordKey,recordHour,dataSize,slotInterrupts,recordGC | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 54/283, insns 283/283, baseline differences 54; baseline sections and relocations different |
| Board-flat-order-8 | Ordinary record and interrupt locals; declaration order recordInterrupts,slotInterrupts,recordKey,cdbId,recordType[8],recordSecond,recordDate,waitInterrupts,recordMin,recordHour,recordGC,dataSize | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 57/283, insns 283/283, baseline differences 57; baseline sections and relocations different |
| Board-flat-order-9 | Ordinary record and interrupt locals; declaration order dataSize,recordSecond,recordKey,recordMin,recordDate,recordInterrupts,recordHour,recordGC,slotInterrupts,recordType[8],waitInterrupts,cdbId | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 58/283, insns 283/283, baseline differences 58; baseline sections and relocations different |
| Board-flat-order-10 | Ordinary record and interrupt locals; declaration order recordGC,recordKey,recordMin,slotInterrupts,cdbId,recordDate,recordSecond,dataSize,waitInterrupts,recordHour,recordInterrupts,recordType[8] | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 45/283, insns 283/283, baseline differences 45; baseline sections and relocations different |
| Board-flat-order-11 | Ordinary record and interrupt locals; declaration order recordKey,slotInterrupts,recordHour,recordDate,cdbId,dataSize,recordType[8],recordGC,recordInterrupts,recordSecond,recordMin,waitInterrupts | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 58/283, insns 283/283, baseline differences 58; baseline sections and relocations different |
| Board-flat-order-12 | Ordinary record and interrupt locals; declaration order dataSize,recordSecond,cdbId,waitInterrupts,recordGC,recordHour,recordMin,slotInterrupts,recordDate,recordType[8],recordInterrupts,recordKey | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-13 | Ordinary record and interrupt locals; declaration order recordMin,recordKey,waitInterrupts,cdbId,recordHour,recordSecond,recordGC,recordType[8],slotInterrupts,recordInterrupts,recordDate,dataSize | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-14 | Ordinary record and interrupt locals; declaration order recordMin,dataSize,recordSecond,recordType[8],recordKey,recordDate,cdbId,waitInterrupts,recordHour,recordGC,recordInterrupts,slotInterrupts | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-15 | Ordinary record and interrupt locals; declaration order cdbId,recordGC,recordHour,dataSize,slotInterrupts,recordMin,recordDate,recordInterrupts,waitInterrupts,recordKey,recordSecond,recordType[8] | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 58/283, insns 283/283, baseline differences 58; baseline sections and relocations different |
| Board-flat-order-16 | Ordinary record and interrupt locals; declaration order recordHour,recordType[8],waitInterrupts,recordDate,cdbId,recordMin,recordSecond,recordKey,recordGC,recordInterrupts,slotInterrupts,dataSize | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-17 | Ordinary record and interrupt locals; declaration order waitInterrupts,slotInterrupts,recordHour,cdbId,recordSecond,recordGC,dataSize,recordInterrupts,recordDate,recordMin,recordKey,recordType[8] | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 45/283, insns 283/283, baseline differences 45; baseline sections and relocations different |
| Board-flat-order-18 | Ordinary record and interrupt locals; declaration order recordDate,waitInterrupts,recordType[8],recordSecond,recordMin,recordInterrupts,recordHour,dataSize,recordGC,recordKey,cdbId,slotInterrupts | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 44/283, insns 283/283, baseline differences 44; baseline sections and relocations different |
| Board-flat-order-19 | Ordinary record and interrupt locals; declaration order recordHour,recordSecond,slotInterrupts,recordType[8],recordInterrupts,recordDate,dataSize,recordKey,waitInterrupts,recordMin,cdbId,recordGC | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 58/283, insns 283/283, baseline differences 58; baseline sections and relocations different |
| Board-flat-order-20 | Ordinary record and interrupt locals; declaration order recordType[8],recordInterrupts,slotInterrupts,recordDate,recordGC,recordHour,waitInterrupts,recordMin,recordSecond,recordKey,cdbId,dataSize | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 58/283, insns 283/283, baseline differences 58; baseline sections and relocations different |
| Board-flat-order-21 | Ordinary record and interrupt locals; declaration order recordDate,recordInterrupts,recordMin,dataSize,recordSecond,recordKey,recordHour,recordGC,cdbId,slotInterrupts,recordType[8],waitInterrupts | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 58/283, insns 283/283, baseline differences 58; baseline sections and relocations different |
| Board-flat-order-22 | Ordinary record and interrupt locals; declaration order dataSize,recordGC,recordDate,recordType[8],slotInterrupts,cdbId,waitInterrupts,recordHour,recordKey,recordSecond,recordInterrupts,recordMin | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-23 | Ordinary record and interrupt locals; declaration order dataSize,recordGC,cdbId,recordMin,recordDate,recordInterrupts,recordSecond,recordKey,recordHour,waitInterrupts,slotInterrupts,recordType[8] | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 58/283, insns 283/283, baseline differences 58; baseline sections and relocations different |
| Board-flat-order-24 | Ordinary record and interrupt locals; declaration order cdbId,slotInterrupts,recordType[8],recordDate,recordHour,recordSecond,waitInterrupts,dataSize,recordInterrupts,recordKey,recordGC,recordMin | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-25 | Ordinary record and interrupt locals; declaration order cdbId,recordGC,recordKey,slotInterrupts,dataSize,recordSecond,recordHour,recordDate,recordMin,recordType[8],waitInterrupts,recordInterrupts | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-26 | Ordinary record and interrupt locals; declaration order dataSize,waitInterrupts,recordDate,recordInterrupts,recordType[8],recordGC,slotInterrupts,recordHour,recordSecond,recordMin,cdbId,recordKey | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-27 | Ordinary record and interrupt locals; declaration order recordMin,slotInterrupts,waitInterrupts,recordHour,recordType[8],recordKey,recordDate,dataSize,recordSecond,cdbId,recordGC,recordInterrupts | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-28 | Ordinary record and interrupt locals; declaration order recordMin,recordType[8],cdbId,dataSize,recordHour,waitInterrupts,recordSecond,recordGC,recordDate,slotInterrupts,recordInterrupts,recordKey | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-29 | Ordinary record and interrupt locals; declaration order dataSize,cdbId,waitInterrupts,recordInterrupts,recordKey,recordDate,recordMin,recordGC,recordSecond,recordHour,slotInterrupts,recordType[8] | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-30 | Ordinary record and interrupt locals; declaration order recordHour,waitInterrupts,cdbId,recordInterrupts,recordDate,recordSecond,recordGC,recordKey,slotInterrupts,recordType[8],recordMin,dataSize | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-31 | Ordinary record and interrupt locals; declaration order recordKey,waitInterrupts,recordGC,dataSize,slotInterrupts,recordSecond,recordType[8],recordInterrupts,recordMin,recordHour,cdbId,recordDate | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| fat12-sector-helper-base | Natural FAT sector/flush operation and local scopes, without a carrier | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-sector-helper-offset-initialized | Natural FAT sector/flush operation and local scopes, without a carrier | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-sector-helper-sector-const | Natural FAT sector/flush operation and local scopes, without a carrier | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-sector-helper-typed-sector | Natural FAT sector/flush operation and local scopes, without a carrier | PFFAT12_ReadFATEntryWithBuf: 122/155, insns 156/155, baseline differences 122; baseline sections and relocations different |
| fat12-read-sector-helper-base | Natural FAT sector/flush operation and local scopes, without a carrier | PFFAT12_ReadFATEntryWithBuf: 101/155, insns 159/155, baseline differences 101; baseline sections and relocations different |
| fat12-read-sector-helper-offset-initialized | Natural FAT sector/flush operation and local scopes, without a carrier | PFFAT12_ReadFATEntryWithBuf: 101/155, insns 159/155, baseline differences 101; baseline sections and relocations different |
| fat12-read-sector-helper-sector-const | Natural FAT sector/flush operation and local scopes, without a carrier | PFFAT12_ReadFATEntryWithBuf: 101/155, insns 159/155, baseline differences 101; baseline sections and relocations different |
| fat12-read-sector-helper-typed-sector | Natural FAT sector/flush operation and local scopes, without a carrier | PFFAT12_ReadFATEntryWithBuf: 130/155, insns 160/155, baseline differences 130; baseline sections and relocations different |
| Board-flat-order-32 | Ordinary record and interrupt locals; declaration order slotInterrupts,recordKey,cdbId,waitInterrupts,recordMin,recordGC,recordType[8],dataSize,recordHour,recordDate,recordInterrupts,recordSecond | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| fat12-block-copy-counters-base | Natural FAT sector/flush operation and local scopes, without a carrier | PFFAT12_ReadFATEntryWithBuf: 34/155, insns 155/155, baseline differences 34; baseline sections and relocations different |
| fat12-block-copy-counters-offset-initialized | Natural FAT sector/flush operation and local scopes, without a carrier | PFFAT12_ReadFATEntryWithBuf: 34/155, insns 155/155, baseline differences 34; baseline sections and relocations different |
| fat12-block-copy-counters-sector-const | Natural FAT sector/flush operation and local scopes, without a carrier | PFFAT12_ReadFATEntryWithBuf: 34/155, insns 155/155, baseline differences 34; baseline sections and relocations different |
| fat12-block-copy-counters-typed-sector | Natural FAT sector/flush operation and local scopes, without a carrier | PFFAT12_ReadFATEntryWithBuf: 127/155, insns 156/155, baseline differences 127; baseline sections and relocations different |
| Board-flat-order-33 | Ordinary record and interrupt locals; declaration order recordInterrupts,recordSecond,recordKey,cdbId,recordGC,recordDate,recordHour,waitInterrupts,slotInterrupts,recordType[8],recordMin,dataSize | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 57/283, insns 283/283, baseline differences 57; baseline sections and relocations different |
| Board-flat-order-34 | Ordinary record and interrupt locals; declaration order recordGC,slotInterrupts,recordHour,recordSecond,waitInterrupts,dataSize,recordInterrupts,recordMin,recordKey,cdbId,recordType[8],recordDate | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 45/283, insns 283/283, baseline differences 45; baseline sections and relocations different |
| Board-flat-order-35 | Ordinary record and interrupt locals; declaration order recordType[8],slotInterrupts,recordDate,recordHour,recordInterrupts,cdbId,waitInterrupts,recordMin,dataSize,recordKey,recordGC,recordSecond | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 58/283, insns 283/283, baseline differences 58; baseline sections and relocations different |
| Board-flat-order-36 | Ordinary record and interrupt locals; declaration order recordKey,waitInterrupts,recordHour,recordType[8],recordMin,slotInterrupts,dataSize,recordInterrupts,recordSecond,cdbId,recordDate,recordGC | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-37 | Ordinary record and interrupt locals; declaration order recordType[8],cdbId,recordMin,recordKey,waitInterrupts,recordGC,dataSize,recordHour,slotInterrupts,recordInterrupts,recordSecond,recordDate | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| Board-flat-order-38 | Ordinary record and interrupt locals; declaration order recordMin,cdbId,recordKey,recordDate,dataSize,recordSecond,recordType[8],slotInterrupts,recordGC,recordHour,recordInterrupts,waitInterrupts | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 58/283, insns 283/283, baseline differences 58; baseline sections and relocations different |
| Board-flat-order-39 | Ordinary record and interrupt locals; declaration order slotInterrupts,dataSize,waitInterrupts,recordSecond,recordMin,recordDate,recordHour,cdbId,recordInterrupts,recordGC,recordKey,recordType[8] | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 49/283, insns 283/283, baseline differences 49; baseline sections and relocations different |
| WADImportDVDExForBS-locals-0 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-1 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
The initial WAD batch failed before code generation because the temporary field
rewriter replaced the prefix of `titleMetaSize`. All 40 failed variants were
restored and excluded from compiled-trial counts; the rewriter now matches whole
field names. Raw failure output remains in `/tmp/sol-audit-trials.jsonl`.
| WADImportDVDExForBS-locals-2 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-3 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-4 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-5 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-6 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-7 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-8 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-9 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-10 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-11 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-12 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-13 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-14 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-15 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-16 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-17 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-18 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-19 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-20 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-21 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-22 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-23 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-24 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-25 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-26 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-27 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-28 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-29 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-30 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-31 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-32 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-33 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-34 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-35 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-36 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-37 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-38 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| WADImportDVDExForBS-locals-39 | Ordinary initialized size/pointer locals; scalar mode makes the existing mask branch unreachable | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| fat12-values-1 | Name actual call/mask/sector values in their original evaluation order: offset-mask | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-2 | Name actual call/mask/sector values in their original evaluation order: next-sector | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-3 | Name actual call/mask/sector values in their original evaluation order: offset-mask,next-sector | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-4 | Name actual call/mask/sector values in their original evaluation order: driver-error | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-5 | Name actual call/mask/sector values in their original evaluation order: offset-mask,driver-error | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-6 | Name actual call/mask/sector values in their original evaluation order: next-sector,driver-error | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-7 | Name actual call/mask/sector values in their original evaluation order: offset-mask,next-sector,driver-error | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-8 | Name actual call/mask/sector values in their original evaluation order: callback-pointer | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-9 | Name actual call/mask/sector values in their original evaluation order: offset-mask,callback-pointer | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-10 | Name actual call/mask/sector values in their original evaluation order: next-sector,callback-pointer | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-11 | Name actual call/mask/sector values in their original evaluation order: offset-mask,next-sector,callback-pointer | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-12 | Name actual call/mask/sector values in their original evaluation order: driver-error,callback-pointer | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-13 | Name actual call/mask/sector values in their original evaluation order: offset-mask,driver-error,callback-pointer | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-14 | Name actual call/mask/sector values in their original evaluation order: next-sector,driver-error,callback-pointer | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-15 | Name actual call/mask/sector values in their original evaluation order: offset-mask,next-sector,driver-error,callback-pointer | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-16 | Name actual call/mask/sector values in their original evaluation order: fat-sector-base | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-17 | Name actual call/mask/sector values in their original evaluation order: offset-mask,fat-sector-base | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-18 | Name actual call/mask/sector values in their original evaluation order: next-sector,fat-sector-base | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-19 | Name actual call/mask/sector values in their original evaluation order: offset-mask,next-sector,fat-sector-base | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-20 | Name actual call/mask/sector values in their original evaluation order: driver-error,fat-sector-base | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-21 | Name actual call/mask/sector values in their original evaluation order: offset-mask,driver-error,fat-sector-base | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-22 | Name actual call/mask/sector values in their original evaluation order: next-sector,driver-error,fat-sector-base | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-23 | Name actual call/mask/sector values in their original evaluation order: offset-mask,next-sector,driver-error,fat-sector-base | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-24 | Name actual call/mask/sector values in their original evaluation order: callback-pointer,fat-sector-base | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-25 | Name actual call/mask/sector values in their original evaluation order: offset-mask,callback-pointer,fat-sector-base | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-26 | Name actual call/mask/sector values in their original evaluation order: next-sector,callback-pointer,fat-sector-base | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-27 | Name actual call/mask/sector values in their original evaluation order: offset-mask,next-sector,callback-pointer,fat-sector-base | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-28 | Name actual call/mask/sector values in their original evaluation order: driver-error,callback-pointer,fat-sector-base | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-29 | Name actual call/mask/sector values in their original evaluation order: offset-mask,driver-error,callback-pointer,fat-sector-base | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-30 | Name actual call/mask/sector values in their original evaluation order: next-sector,driver-error,callback-pointer,fat-sector-base | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-values-31 | Name actual call/mask/sector values in their original evaluation order: offset-mask,next-sector,driver-error,callback-pointer,fat-sector-base | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-final-unsigned-error | Actual status/value lifetime or representation; no forced storage | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-final-callback-result-init | Actual status/value lifetime or representation; no forced storage | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| fat12-final-error-block | Actual status/value lifetime or representation; no forced storage | BUILD FAIL |
| fat12-final-read-status-scope | Actual status/value lifetime or representation; no forced storage | PFFAT12_ReadFATEntryWithBuf: 23/155, insns 155/155, baseline differences 23; baseline sections and relocations different |
| Board-best-confirm | Fresh best flat-local confirmation before allocator capture | appendRecord__Q33ipl5scene5BoardFP10_CDBRecord: 44/283, insns 283/283, baseline differences 44; baseline sections and relocations different |
| WADImportDVDExForBS-offset-proof | Fresh ordinary-local code for stack-home and memset comparison | WADImportDVDExForBS: 223/263, insns 262/263, baseline differences 223; baseline sections and relocations different |
| pud-without-dead-copy | Remove the unread workspace snapshot; preserve only fallback and actual matching values | Zi8MatchPUDdata_ZHS: 339/354, insns 353/354, baseline differences 339; baseline sections and relocations different |
| pud-live-workspace-alias | Use the workspace alias for every actual workspace access and helper argument | Zi8MatchPUDdata_ZHS: 373/354, insns 385/354, baseline differences 373; baseline sections and relocations different |
| pud-live-typed-workspace | Use a typed working pointer for every actual workspace access and helper argument | Zi8MatchPUDdata_ZHS: 373/354, insns 385/354, baseline differences 373; baseline sections and relocations different |
| pud-scoped-table-workspace | Scope a live typed workspace alias to the language-table lookup rather than keeping an unread snapshot | Zi8MatchPUDdata_ZHS: 353/354, insns 366/354, baseline differences 353; baseline sections and relocations different |
## Final independent verification
Final allocated-section bytes and resolved relocation targets equal the starting
source objects for all 16 audited units. This covers .text, data, zero-initialized
sections, exception tables and inline callers, including the pre-existing
non-exact BS2Mach and CHANSVm code. The restored Board, FAT12, WAD and PUD
objects also equal their starting objects.
Fresh ctxdiff checks give diffs 0 and equal instruction counts for Korean
(619), secondary character matching (311), phonetic matching (363), cmpName
(87), fadjust (115), finfo (91), System::init (689) and CHANSVmNewObjData
(96). BS2Tick remains 1940/1940 instructions with its original 71 differences;
its source-object bytes are identical to the original local baseline.
| Changed unit | Exact functions before | Exact functions after | Code/data result |
| --- | --- | --- | --- |
| `libs/RVLMiddleware/eZiText/src/clib/zikorean` | 3/3 | 3/3 | 100%; every section unchanged |
| `libs/RVLMiddleware/eZiText/src/clib/zi8match` | 10/10 | 10/10 | 100%; every section unchanged |
| `libs/RVL_SDK/src/fa/pf_path` | 27/27 | 27/27 | 100%; every section unchanged |
| `libs/RVL_SDK/src/fa/pf_file` | 45/45 | 45/45 | 100%; every section unchanged |
| `src/BS2/BS2Mach` | 27/29 | 27/29 | Existing partial code unchanged; data 100% |
| `src/system/iplSystem` | 63/63 | 63/63 | 100%; every section unchanged |
| `src/channelScript/CHANSVm` | 227/233 | 227/233 | Existing partial code unchanged; data 100% |
Ran the requested final gate once over all seven changed units and the four
restored carrier units:
```sh
python3 /mnt/drive2/projects/wii-ipl-workers/_restore0928-tools/gate.py \
src/scene/board/iplBoard \
libs/RVLMiddleware/eZiText/src/clib/zikorean \
libs/RVLMiddleware/eZiText/src/clib/zi8match \
libs/RVLMiddleware/eZiText/src/clib/zi8pud2 \
libs/RVL_SDK/src/fa/pf_fat12 \
libs/RVL_SDK/src/fa/pf_path \
libs/RVL_SDK/src/fa/pf_file \
src/BS2/BS2Mach src/system/iplSystem \
libs/RVL_SDK/src/wad/wad src/channelScript/CHANSVm --quick
```
```text
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
regressions vs baseline: 0
forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
GATE PASS
```
All 11 gate-unit pools are identical. Regenerated the live report with
`ninja progress build/43U/report.json build/43U/ok`. Compared every unit's
measures, function scores and section sizes/scores against the initial full
report: zero differences across all 1028 units. Global exact-function count
remains 12523/12563, matched code 2933788/2995176 and matched data
1832684/1832684. Linked code/data measures also remain unchanged.
Raw final outputs: /tmp/sol-audit-gate.log,
/tmp/sol-audit-final-ctxdiff.log and /tmp/sol-audit-final-evidence.json.
Focused source diff passes git diff --check. No build configuration, shared
header, assembly, pragma or source comment was added or changed.
## Retained per-file commits
| Commit | File |
| --- | --- |
| `f8a2e625` | `src/system/iplSystem.cpp` |
| `3118dc23` | `libs/RVLMiddleware/eZiText/src/clib/zikorean.c` |
| `60c64eef` | `libs/RVLMiddleware/eZiText/src/clib/zi8match.c` |
| `4bbe8e23` | `libs/RVL_SDK/src/fa/pf_path.c` |
| `69be5311` | `src/channelScript/CHANSVm.c` |
| `97ee91e9` | `src/BS2/BS2Mach.c` |
| `6c837a8c` | `libs/RVL_SDK/src/fa/pf_file.c` |
PUD trial commit `80d7290c` is canceled by `5b0f57b6`; the net PUD source diff
is empty. Land only the complete audited branch or its net diff, not the
rejected PUD commit alone.

Some files were not shown because too many files have changed in this diff Show More