Compare commits

..

29 Commits

Author SHA1 Message Date
devin
574ebe9452 AOSS_Init_old: (int)-cast signed-immediate NULL check + declsearch order
(int)s_accessPointConfig == 0 produces orig's cmpwi r3,0 at the
wait_for_packet alloc check (0x154c); same form kept at 0xc94 where the
pinned-zero web is still live. declsearch round 2 (800 evals) converged to
round-1 order. Init_old 96.70 -> 96.78. WLANConnect cross-block-use copy
refuted: NCDSetIpConfig use is same-block as copy birth, all dual-web and
typed-view forms fold in COpt pre-phase.

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 08:41:45 +00:00
devin
6a71232197 settingstruct: declsearch'd Init_old decl order + WLANConnect marshal refutation
Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 08:20:34 +00:00
coah
a19380ae3e decomp(chansvm): VmWinEmuWrite, VmBlobGetHexString, VmBlobPackCommon (worker 8b58ab2f) (#1315) 2026-10-09 08:20:34 +00:00
coah
fe17055a57 decomp(aosslink): match AOSSi_WLANGetBSSList (worker 0f859ab6) (#1314) 2026-10-09 08:20:34 +00:00
coah
4e469fa6aa decomp(sdmemory): match drawTransferTitles and link iplSDMemory; loadCardFileIcons 213 -> 126 (worker 76898382) (#1313) 2026-10-09 08:20:34 +00:00
coah
a7fe51469a decomp(mcm): match _create_icon and link iplMemoryCardManager; pdm MBR reads (worker a7a698b7) (#1312) 2026-10-09 08:20:34 +00:00
coah
62416538d4 decomp(aes): match AESiEncryptBlock and AESiDecryptBlock, link aes; idct dataflow (worker 33aab024) (#1311) 2026-10-09 08:20:34 +00:00
coah
eb055e0751 decomp(aterm): match DiscoverAccessPoints, BuildAssociationRequest, RunConfigProtocol (worker 228733c3) (#1310) 2026-10-09 08:20:34 +00:00
coah
5811b98eb2 decomp(bs2): match BS2Tick and link BS2Mach (per-use volatile DVDCommandBlock state, Dolphin SDK idiom) (worker 5aba8e21) (#1309) 2026-10-09 08:20:34 +00:00
coah
198e76f235 decomp(bs2): match CheckBS2CommandStatus, BS2Tick 57 -> 4 (local statics, u64 globals, proven volatile flags) (worker dc077f2a) (#1308) 2026-10-09 08:20:34 +00:00
devin
def2f7a924 settingstruct: Init_old u32 deref decode - cmplwi parity at *config==1 wait-loop sites
Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 04:53:43 +00:00
devin
144e69c5da settingstruct: Init_old pinned-zero/op-diff decode + scoped-local/const attempts documented
Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 04:24:50 +00:00
coah
a543d4461d fix(chansvm): use compatible const converter callback types (#1307) 2026-10-09 04:24:50 +00:00
coah
1bfa5a573e decomp(aterm): GC/3.0a5 build, AutoConfigThread and AES key expansion exact (worker b7300afa) (#1306) 2026-10-09 04:24:50 +00:00
coah
1b4ed24c8c decomp(sdmemory): drawTransferTitles via MSL wcsstr overload and TextBox::SetTextColor (363->50) (worker 9b634499) (#1305) 2026-10-09 04:24:50 +00:00
coah
dcf9db3972 decomp(chansvm): ConvertToFloatFromStr const source, VmDateDtor scoped tables (worker db63d910) (#1304) 2026-10-09 04:24:50 +00:00
coah
75c27c1500 decomp(aoss): match AOSSXorBufferWithKey (worker 8c6b3076) (#1303) 2026-10-09 04:24:50 +00:00
coah
46baf9b6e8 fix(odh): preserve unsigned refills and defer planar addressing (#1302) 2026-10-09 04:24:50 +00:00
coah
aae707a35a decomp(odh): match LineConv11 and huffmanDecoder, link odh (worker 9b2c5837) (#1301) 2026-10-09 04:24:50 +00:00
coah
99d2a15e2d decomp(candidatebox): match createAnmPane_ and link tiCandidateBox (worker 6dca7c84) (#1300) 2026-10-09 04:24:50 +00:00
coah
4630f24f89 decomp(bs2): match UpdateThread and link BS2Update (Flags0 as function-local static) (worker 85186112) (#1299) 2026-10-09 04:24:50 +00:00
coah
0d918086b9 decomp(kbd): match kbdProcMod and link kbd_lib (worker 86bbfe55) (#1298) 2026-10-09 04:24:50 +00:00
coah
e8b6a4e1a9 decomp(chansvm): VmBlobPackCommon per-phase locals (230 -> 47) (worker 69c0cd0d) (#1297) 2026-10-09 04:24:50 +00:00
devin
b1cd6ccdb4 settingstruct: fn-local static + pragma-combo levers refuted on AES/AOSS - identical op multisets
Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 02:34:04 +00:00
devin
635627fea8 settingstruct: structural/cflag decode attempts on AES block fns - all regress fuzzy, documented
Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 01:24:50 +00:00
devin
06cbb45542 settingstruct: MWCC scheduling-pragma sweep on aes.c/AOSS fns - all harmful or no-op, documented
Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 00:59:59 +00:00
devin
4359557455 settingstruct: document aes.c + AOSS IRO attempts (rebased post-#1277)
aes.c: IRO 0/1 harmful on both block fns (Encrypt 183->195 diffs,
Decrypt 78.96->70.07 fuzzy); nextState/state array forms scalarize
identically. Table-load issue-order wall documented.
create keeps ppc_iro_level 1 at 98.73 (only AddressEdit residual after
owner's #1277 merge of get/update_friendinfo).

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 00:53:18 +00:00
devin
70ac2abb86 settingstruct: get_friendinfo 100% via ppc_iro_level 0 + named text locals
The text-ptr pin wall cracked: a named local's def site births the
mString.mName web early and IRO-0 blocks the remat-to-marshal. create
also gains 97.56->98.73 under ppc_iro_level 1. Failed pragma attempts
on the remaining fns are documented in the attempts log.

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 00:53:18 +00:00
devin
c2bbf076cb settingstruct: document tie-wall attempts (no new 100% fns)
Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 00:53:10 +00:00
26 changed files with 1115 additions and 18575 deletions

View File

@@ -878,7 +878,7 @@ config.libs = [
Object(Matching, "scene/setting/iplAOSSThread.cpp"),
Object(NonMatching, "scene/setting/AOSSLink.c"),
Object(Matching, "scene/setting/iplRakuRakuThread.cpp"),
Object(NonMatching, "scene/setting/AOSS.c", extra_cflags=["-O4,p", "-inline on,noauto"]),
Object(NonMatching, "scene/setting/AOSS.c", extra_cflags=["-O4,p", "-inline off"]),
Object(Matching, "scene/setting/AOSSData.c"),
Object(NonMatching, "scene/setting/ATERM.c", mw_version="GC/3.0a5", extra_cflags=["-O4,p", "-inline on"]),
]
@@ -1202,7 +1202,7 @@ config.libs = [
Object(Matching, "buffer/mkhdec3.c"),
Object(Matching, "buffer/buffer_system.c"),
Object(Matching, "buffer/getcode.c"),
Object(Matching, "buffer/idct_block_var.c"),
Object(NonMatching, "buffer/idct_block_var.c"),
Object(Matching, "api/decapi.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(Matching, "fa/pdm_partition.c"),
Object(NonMatching, "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(Matching, "nup/nup.cpp"),
Object(NonMatching, "nup/nup.cpp"),
Object(Matching, "nup/nup_nhttp.cpp"),
Object(Matching, "nup/nup_mem.cpp"),
]

View File

@@ -30,7 +30,6 @@ namespace textinput {
class Base;
class EventHandler;
class LayoutByNW4R;
struct InputFormAnimationFile;
#endif
class EditBuffer {
#ifdef TIMANAGER_IMPLEMENTATION
@@ -357,7 +356,6 @@ namespace textinput {
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
friend class EventHandler;
inline const nw4r::lyt::Pane* getLanguageTextPane() const;
inline void addButtonAnimation(MEMAllocator*, nw4rmanager::AnmPane*, const InputFormAnimationFile* const&, const char*);
#endif
public:
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)

View File

@@ -22,11 +22,7 @@ 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);
@@ -43,12 +39,4 @@ 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

@@ -10,7 +10,10 @@ static s32 clampU8(s32 value) {
if (inRange) {
return value;
}
return value < 0 ? 0 : 255;
if (value < 0) {
return 0;
}
return 255;
}
static s32 clampS8(s32 value) {
@@ -28,157 +31,116 @@ 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 pitch2;
s32* dst;
s32 rowOddOutput1;
int columnAcBits;
s32 column;
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 workspace[64];
s32 pitch4;
s32* dst;
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 pitch6;
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;
s32 pitch2;
s32 processed;
s32 column;
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;
s32 c1;
s32 c2;
int acBits;
s32 c7;
s32 c5;
s32 c4;
s32 c3;
s32 c6;
c4 = block[4];
c6 = block[6];
c2 = block[2];
c1 = block[1];
c7 = block[7];
c5 = block[5];
c3 = block[3];
acBits = c4 | c6;
acBits = c2 | acBits;
acBits = c1 | acBits;
acBits = c7 | acBits;
acBits = c5 | acBits;
acBits = c3 | acBits;
if (acBits == 0) {
s32 dc = block[0];
dst[7] = dc;
dst[6] = dc;
dst[5] = dc;
dst[4] = dc;
dst[3] = dc;
dst[2] = dc;
dst[1] = dc;
dst[0] = dc;
} else {
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;
s32 dc;
s32 evenSum;
s32 oddSumRotation;
s32 oddOutput0;
s32 evenRotationSum;
s32 evenRotation;
s32 oddLowDifference;
s32 oddDifferenceRotation;
s32 evenOutput3;
s32 oddOutput1;
s32 oddHighSum;
s32 oddOutput2;
s32 evenBaseSum;
s32 evenOutput0;
s32 oddDifferenceSum;
s32 evenOutput2;
s32 oddMix;
s32 oddLowRotation;
s32 oddOutput3;
s32 evenOutput1;
s32 oddHighRotation;
s32 oddLowSum;
s32 oddSumDifference;
s32 evenBaseDifference;
s32 oddHighDifference;
oddHighSum = c1 + c7;
dc = block[0];
evenSum = c6 + c2;
oddLowDifference = c5 - c3;
oddHighDifference = c1 - c7;
evenRotation = c2 - c6;
c2 = evenRotation * 0xB5 >> 8;
evenBaseDifference = dc - c4;
oddLowSum = c5 + c3;
oddSumDifference = oddHighSum - oddLowSum;
oddSumRotation = oddSumDifference * 0xB5 >> 8;
oddDifferenceSum = oddLowDifference + oddHighDifference;
oddDifferenceRotation = oddDifferenceSum * 0x62 >> 8;
oddLowRotation = oddLowDifference * 0x8B;
oddHighRotation = oddHighDifference * 0x14E >> 8;
evenRotationSum = c2 + evenSum;
evenOutput1 = evenBaseDifference + c2;
oddLowRotation >>= 8;
evenBaseSum = dc + c4;
oddMix = oddHighRotation - oddDifferenceRotation;
evenOutput2 = evenBaseDifference - c2;
oddOutput1 = oddSumRotation + oddMix;
evenOutput3 = evenBaseSum - evenRotationSum;
oddLowSum += oddMix;
evenOutput0 = evenBaseSum + evenRotationSum;
oddOutput0 = oddHighSum + oddLowSum;
oddOutput3 = oddDifferenceRotation + oddLowRotation;
oddOutput2 = oddOutput3 + oddSumRotation;
dst[0] = evenOutput0 + oddOutput0;
dst[7] = evenOutput0 - oddOutput0;
dst[1] = evenOutput1 + oddOutput1;
dst[6] = evenOutput1 - oddOutput1;
dst[2] = evenOutput2 + oddOutput2;
dst[5] = evenOutput2 - oddOutput2;
dst[3] = evenOutput3 + oddOutput3;
dst[4] = evenOutput3 - oddOutput3;
}
block += 8;
dst += 8;
@@ -198,169 +160,117 @@ void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigz
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;
s32 c1;
s32 c2;
s32 c5;
s32 c3;
s32 c6;
s32 c4;
s32 c7;
int acBits;
u8* output;
c4 = src[32];
c6 = src[48];
c2 = src[16];
c1 = src[8];
c7 = src[56];
c5 = src[40];
c3 = src[24];
acBits = c4 | c6;
acBits = c2 | acBits;
acBits = c1 | acBits;
acBits = c7 | acBits;
acBits = c5 | acBits;
acBits = c3 | acBits;
output = conv_row_ptr + column;
if (acBits == 0) {
u8 sample = clampU8((*src >> 11) + 0x80);
output[pitch7] = sample;
output[pitch6] = sample;
output[pitch5] = sample;
output[pitch4] = sample;
output[pitch3] = sample;
output[pitch2] = sample;
output[pitch] = sample;
output[0] = sample;
} 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);
s32 oddDifferenceSum;
s32 oddSumRotation;
s32 evenBaseSum;
s32 evenOutput2;
s32 dc;
s32 evenBaseDifference;
s32 evenOutput0;
s32 evenOutput1;
s32 evenOutput3;
s32 oddHighRotation;
s32 oddMix;
s32 oddHighDifference;
s32 oddLowSum;
s32 oddLowRotation;
s32 evenRotation;
s32 oddLowDifference;
s32 oddSumDifference;
s32 oddHighSum;
s32 evenRotationSum;
s32 oddOutput0;
s32 evenSum;
s32 oddOutput2;
s32 oddDifferenceRotation;
s32 oddOutput1;
s32 oddOutput3;
evenSum = c6 + c2;
evenRotation = c2 - c6;
oddLowSum = c5 + c3;
oddHighDifference = c1 - c7;
oddLowDifference = c5 - c3;
oddHighSum = c1 + c7;
c2 = evenRotation * 0xB5 >> 8;
dc = *src + 0x40000;
oddDifferenceSum = oddLowDifference + oddHighDifference;
oddSumDifference = oddHighSum - oddLowSum;
oddSumRotation = oddSumDifference * 0xB5 >> 8;
evenBaseSum = dc + c4;
oddDifferenceRotation = oddDifferenceSum * 0x62 >> 8;
oddHighRotation = oddHighDifference * 0x14E >> 8;
evenRotationSum = c2 + evenSum;
oddMix = oddHighRotation - oddDifferenceRotation;
oddLowSum += oddMix;
evenOutput0 = evenBaseSum + evenRotationSum;
evenBaseDifference = dc - c4;
evenOutput3 = evenBaseSum - evenRotationSum;
evenOutput1 = evenBaseDifference + c2;
oddOutput0 = oddHighSum + oddLowSum;
oddLowRotation = oddLowDifference * 0x8B >> 8;
oddOutput3 = oddDifferenceRotation + oddLowRotation;
evenOutput2 = evenBaseDifference - c2;
oddOutput2 = oddOutput3 + oddSumRotation;
oddOutput1 = oddSumRotation + oddMix;
output[0] = scalingClampU8(evenOutput0 + oddOutput0);
output[pitch7] = scalingClampU8(evenOutput0 - oddOutput0);
output[pitch] = scalingClampU8(evenOutput1 + oddOutput1);
output[pitch6] = scalingClampU8(evenOutput1 - oddOutput1);
output[pitch2] = scalingClampU8(evenOutput2 + oddOutput2);
output[pitch5] = scalingClampU8(evenOutput2 - oddOutput2);
output[pitch3] = scalingClampU8(evenOutput3 + oddOutput3);
output[pitch4] = scalingClampU8(evenOutput3 - oddOutput3);
}
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 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 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;
s32* src;
s32 column;
s32 rowCount;
s32 processed;
s32* dst;
if (zigzag == 0x11) {
flatDc = block[0];
rowSample = clampS8(flatDc >> 11);
memset(conv_row_ptr, (s8)rowSample, 64);
s32 dc = block[0];
s32 sample = clampS8(dc >> 11);
memset(conv_row_ptr, (s8)sample, 64);
return;
}
@@ -368,22 +278,30 @@ void TMCJPEGDEC_IdctBlock_Col(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigza
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;
s32 mid;
s32 odd;
s32 outer;
s32 dc;
s32 inner;
s32 rotation;
s32 lowRotation;
s32 mix;
odd = block[1];
rotation = odd * 0xB5 >> 8;
lowRotation = odd * 0x62 >> 8;
dc = block[0];
mix = (odd * 0x14E >> 8) - lowRotation;
outer = odd + mix;
dst[0] = dc + outer;
inner = rotation + mix;
dst[7] = dc - outer;
dst[1] = dc + inner;
mid = lowRotation + rotation;
dst[6] = dc - inner;
dst[2] = dc + mid;
dst[5] = dc - mid;
dst[3] = dc + lowRotation;
dst[4] = dc - lowRotation;
dst += 8;
block += 8;
}
@@ -395,65 +313,99 @@ void TMCJPEGDEC_IdctBlock_Col(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigza
} 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;
s32 c2;
s32 c7;
s32 c3;
s32 c5;
s32 c1;
s32 c6;
int acBits;
s32 c4;
c4 = block[4];
c6 = block[6];
c2 = block[2];
c1 = block[1];
c7 = block[7];
c5 = block[5];
c3 = block[3];
acBits = c4 | c6;
acBits = c2 | acBits;
acBits = c1 | acBits;
acBits = c7 | acBits;
acBits = c5 | acBits;
acBits = c3 | acBits;
if (acBits == 0) {
s32 dc = block[0];
dst[7] = dc;
dst[6] = dc;
dst[5] = dc;
dst[4] = dc;
dst[3] = dc;
dst[2] = dc;
dst[1] = dc;
dst[0] = dc;
} else {
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;
s32 evenBaseDifference;
s32 oddOutput3;
s32 oddMix;
s32 evenOutput1;
s32 evenOutput2;
s32 oddDifferenceRotation;
s32 oddLowRotation;
s32 oddDifferenceSum;
s32 evenSum;
s32 oddLowSum;
s32 dc;
s32 oddSumDifference;
s32 oddLowDifference;
s32 evenBaseSum;
s32 oddSumRotation;
s32 evenRotationSum;
s32 evenRotation;
s32 evenOutput0;
s32 oddOutput1;
s32 oddHighDifference;
s32 oddOutput0;
s32 evenOutput3;
s32 oddHighSum;
s32 oddOutput2;
s32 oddHighRotation;
oddHighDifference = c1 - c7;
oddLowSum = c5 + c3;
evenSum = c6 + c2;
oddHighSum = c1 + c7;
evenRotation = c2 - c6;
dc = block[0];
evenBaseDifference = dc - c4;
c2 = evenRotation * 0xB5 >> 8;
oddSumDifference = oddHighSum - oddLowSum;
oddLowDifference = c5 - c3;
oddSumRotation = oddSumDifference * 0xB5 >> 8;
evenBaseSum = dc + c4;
oddHighRotation = oddHighDifference * 0x14E >> 8;
oddDifferenceSum = oddLowDifference + oddHighDifference;
oddDifferenceRotation = oddDifferenceSum * 0x62 >> 8;
evenRotationSum = c2 + evenSum;
oddMix = oddHighRotation - oddDifferenceRotation;
oddOutput1 = oddSumRotation + oddMix;
evenOutput1 = evenBaseDifference + c2;
oddLowRotation = oddLowDifference * 0x8B;
oddLowSum += oddMix;
evenOutput3 = evenBaseSum - evenRotationSum;
evenOutput0 = evenBaseSum + evenRotationSum;
oddLowRotation >>= 8;
oddOutput3 = oddDifferenceRotation + oddLowRotation;
evenOutput2 = evenBaseDifference - c2;
oddOutput0 = oddHighSum + oddLowSum;
dst[0] = evenOutput0 + oddOutput0;
dst[7] = evenOutput0 - oddOutput0;
dst[1] = evenOutput1 + oddOutput1;
oddOutput2 = oddOutput3 + oddSumRotation;
dst[6] = evenOutput1 - oddOutput1;
dst[2] = evenOutput2 + oddOutput2;
dst[5] = evenOutput2 - oddOutput2;
dst[3] = evenOutput3 + oddOutput3;
dst[4] = evenOutput3 - oddOutput3;
}
block += 8;
dst += 8;
@@ -467,66 +419,100 @@ void TMCJPEGDEC_IdctBlock_Col(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigza
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;
s32 c1;
s32 c3;
int acBits;
s32 c7;
s32 c2;
s32 c5;
u8* output;
s32 c6;
s32 c4;
c4 = src[32];
output = conv_row_ptr + column;
c6 = src[48];
c2 = src[16];
c1 = src[8];
c7 = src[56];
c5 = src[40];
c3 = src[24];
acBits = c4 | c6;
acBits = c2 | acBits;
acBits = c1 | acBits;
acBits = c7 | acBits;
acBits = c5 | acBits;
acBits = c3 | acBits;
if (acBits == 0) {
s32 sample = clampS8(*src >> 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 {
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);
s32 evenSum;
s32 evenOutput2;
s32 oddOutput0;
s32 oddMix;
s32 evenBaseSum;
s32 oddHighRotation;
s32 evenRotationSum;
s32 oddSumDifference;
s32 evenOutput1;
s32 oddHighSum;
s32 evenOutput0;
s32 oddOutput1;
s32 oddDifferenceSum;
s32 oddLowSum;
s32 oddOutput3;
s32 evenBaseDifference;
s32 oddHighDifference;
s32 oddOutput2;
s32 dc;
s32 oddLowDifference;
s32 evenOutput3;
s32 oddDifferenceRotation;
s32 oddLowRotation;
s32 evenRotation;
s32 oddSumRotation;
oddHighSum = c1 + c7;
evenRotation = c2 - c6;
oddLowSum = c5 + c3;
oddSumDifference = oddHighSum - oddLowSum;
evenSum = c6 + c2;
oddLowDifference = c5 - c3;
c2 = evenRotation * 0xB5 >> 8;
oddHighDifference = c1 - c7;
dc = *src;
evenRotationSum = c2 + evenSum;
oddSumRotation = oddSumDifference * 0xB5 >> 8;
oddDifferenceSum = oddLowDifference + oddHighDifference;
oddDifferenceRotation = oddDifferenceSum * 0x62 >> 8;
evenBaseDifference = dc - c4;
evenBaseSum = dc + c4;
oddHighRotation = oddHighDifference * 0x14E >> 8;
oddMix = oddHighRotation - oddDifferenceRotation;
evenOutput3 = evenBaseSum - evenRotationSum;
evenOutput1 = evenBaseDifference + c2;
evenOutput2 = evenBaseDifference - c2;
evenOutput0 = evenBaseSum + evenRotationSum;
oddLowRotation = oddLowDifference * 0x8B >> 8;
oddOutput3 = oddDifferenceRotation + oddLowRotation;
oddLowSum += oddMix;
oddOutput1 = oddSumRotation + oddMix;
oddOutput0 = oddHighSum + oddLowSum;
oddOutput2 = oddOutput3 + oddSumRotation;
output[0] = (u8)clampS8((evenOutput0 + oddOutput0) >> 11);
output[56] = (u8)clampS8((evenOutput0 - oddOutput0) >> 11);
output[8] = (u8)clampS8((evenOutput1 + oddOutput1) >> 11);
output[48] = (u8)clampS8((evenOutput1 - 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);
}
src--;
}

View File

@@ -8,7 +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]);
}
pf_s32 pdm_part_is_master_boot_sector(volatile pf_u8* buf, pf_u32 total, pf_bool* p_is_mbr) {
pf_s32 pdm_part_is_master_boot_sector(pf_u8* buf, pf_u32 total, pf_bool* p_is_mbr) {
pf_u32* p_start;
pf_u32* p_count;
pf_s16 index;

View File

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

View File

@@ -700,11 +700,11 @@ const CHANSVmObjHdr CHANSVmConstStringObjectInfinity = {{(wchar_t*)scInfinityUtf
const CHANSVmObjHdr CHANSVmConstStringObjectMinusInfinity = {{(wchar_t*)scMinusInfinityUtf16, 18}, {0}, vmNull};
const CHANSVmObjHdr CHANSVmConstStringObjectComma = {{(wchar_t*)"\0,", 2}, {0}, vmNull};
const CHANSVmObjHdr CHANSVmConstStringDataEmpty = {{(wchar_t*)"", 0}, {0}, vmNull};
const CHANSVmObjHdr VmUndefinedStringObj = {{(void*)&CHANSVmConstStringObjectUndefined, 0}, 0x03800100, vmNull};
const CHANSVmObjHdr VmNaNStringObj = {{(void*)&CHANSVmConstStringObjectNaN, 0}, 0x03800100, vmNull};
const CHANSVmObjHdr VmInfinityStringObj = {{(void*)&CHANSVmConstStringObjectInfinity, 0}, 0x03800100, vmNull};
const CHANSVmObjHdr VmMinusInfinityStringObj = {{(void*)&CHANSVmConstStringObjectMinusInfinity, 0}, 0x03800100, vmNull};
const CHANSVmObjHdr VmUndefinedObj = {{vmNull, 0}, 0x00800000, vmNull};
const CHANSVmObjHdr CHANSVmConstStringObjectUndefined_[] = {{{(void*)&CHANSVmConstStringObjectUndefined, 0}, 0x03800100, vmNull},
{{(void*)&CHANSVmConstStringObjectNaN, 0}, 0x03800100, vmNull},
{{(void*)&CHANSVmConstStringObjectInfinity, 0}, 0x03800100, vmNull},
{{(void*)&CHANSVmConstStringObjectMinusInfinity, 0}, 0x03800100, vmNull},
{{vmNull, 0}, 0x00800000, vmNull}};
char VmReportFormat[] = "%s";
const CHANSVmFloatConstantList scFloatConstantList[] = {
@@ -779,7 +779,7 @@ CHANSVmObjHdr* CHANSVmConvertToFloatFromStr(CHANSVm* vm, CHANSVmObjType type, co
}
CHANSVmObjHdr* CHANSVmConvertToStrFromUndefined(CHANSVm* vm, CHANSVmObjType type, const CHANSVmObjHdr* object) {
return (CHANSVmObjHdr*)&VmUndefinedStringObj;
return (CHANSVmObjHdr*)CHANSVmConstStringObjectUndefined_;
}
s32 CHANSVmFloatToWString(vmWString buf, u32 len, vmFloat val) NO_INLINE {
@@ -813,17 +813,21 @@ error:
}
CHANSVmObjHdr* CHANSVmConvertToStrFromFloat(CHANSVm* vm, CHANSVmObjType type, const CHANSVmObjHdr* value) {
const CHANSVmObjHdr* base;
CHANSVmObjHdr* newObj;
s32 result;
// TODO: This data access needs to be fixed
// Accessing the CHANSVmConstStringObjectUndefined_ array properly breaks the match
base = &CHANSVmConstStringObjectUndefined; // .rodata@0x0
if (VmIsNan(value->value.float_v)) {
return (CHANSVmObjHdr*)&VmNaNStringObj;
return (CHANSVmObjHdr*)&base[7]; // .rodata@0x70 (refers to CHANSVmConstStringObjectUndefined_[1])
}
if (value->value.float_v == VM_INF) {
return (CHANSVmObjHdr*)&VmInfinityStringObj;
return (CHANSVmObjHdr*)&base[8]; // .rodata@0x80 (refers to CHANSVmConstStringObjectUndefined_[2])
}
if (value->value.float_v == VM_NEG_INF) {
return (CHANSVmObjHdr*)&VmMinusInfinityStringObj;
return (CHANSVmObjHdr*)&base[9]; // .rodata@0x90 (refers to CHANSVmConstStringObjectUndefined_[3])
}
newObj = CHANSVmNewObject(vm, vmFalse, vmNull, CHANS_VM_OBJ_TYPE_STRING, VM_STRING_SIZE);
@@ -910,46 +914,60 @@ const VmConvertEntry VmTypeConvertFuncTbl[] = {
// The table value determines to the type of the result of an operation with two operands.
typedef u8 VmResultTypeMatrix[6][6];
typedef struct {
VmResultTypeMatrix add; // 0x00
VmResultTypeMatrix arith; // 0x24
VmResultTypeMatrix cmp; // 0x48
VmResultTypeMatrix eq; // 0x6C
VmResultTypeMatrix bitShift; // 0x90
} VmResultTypeData;
// clang-format off
static const VmResultTypeMatrix scVmResultTypeAdd = {
0x00, 0x02, 0x02, 0x03, 0x00, 0x00,
0x02, 0x01, 0x02, 0x03, 0x03, 0x00,
0x02, 0x02, 0x02, 0x03, 0x03, 0x00,
0x03, 0x03, 0x03, 0x03, 0x03, 0x00,
0x00, 0x03, 0x03, 0x03, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const VmResultTypeMatrix scVmResultTypeArith = {
0x00, 0x02, 0x02, 0x02, 0x00, 0x00,
0x02, 0x01, 0x02, 0x02, 0x00, 0x00,
0x02, 0x02, 0x02, 0x02, 0x00, 0x00,
0x02, 0x02, 0x02, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const VmResultTypeMatrix scVmResultTypeCmp = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x02, 0x02, 0x00, 0x00,
0x00, 0x02, 0x02, 0x02, 0x00, 0x00,
0x00, 0x02, 0x02, 0x03, 0x03, 0x00,
0x00, 0x00, 0x00, 0x03, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const VmResultTypeMatrix scVmResultTypeEq = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x02, 0x02, 0x00, 0x00,
0x00, 0x02, 0x02, 0x02, 0x00, 0x00,
0x00, 0x02, 0x02, 0x03, 0x03, 0x00,
0x00, 0x00, 0x00, 0x03, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const VmResultTypeMatrix scVmResultTypeBitShift = {
0x00, 0x01, 0x01, 0x01, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
const VmResultTypeData VmResultTypeTbl = {
/* add[6][6] = */ {
0x00, 0x02, 0x02, 0x03, 0x00, 0x00,
0x02, 0x01, 0x02, 0x03, 0x03, 0x00,
0x02, 0x02, 0x02, 0x03, 0x03, 0x00,
0x03, 0x03, 0x03, 0x03, 0x03, 0x00,
0x00, 0x03, 0x03, 0x03, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
/* arith[6][6] = */
{
0x00, 0x02, 0x02, 0x02, 0x00, 0x00,
0x02, 0x01, 0x02, 0x02, 0x00, 0x00,
0x02, 0x02, 0x02, 0x02, 0x00, 0x00,
0x02, 0x02, 0x02, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
/* cmp[6][6] = */
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x02, 0x02, 0x00, 0x00,
0x00, 0x02, 0x02, 0x02, 0x00, 0x00,
0x00, 0x02, 0x02, 0x03, 0x03, 0x00,
0x00, 0x00, 0x00, 0x03, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
/* eq[6][6] = */
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x02, 0x02, 0x00, 0x00,
0x00, 0x02, 0x02, 0x02, 0x00, 0x00,
0x00, 0x02, 0x02, 0x03, 0x03, 0x00,
0x00, 0x00, 0x00, 0x03, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
/* bitShift[6][6] = */
{
0x00, 0x01, 0x01, 0x01, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
};
// clang-format on
@@ -7086,92 +7104,49 @@ void CHANSVmSetSignal(CHANSVm* vm, vmBool* signal) {
pVm->bSignalUpdated = vmTrue;
}
#pragma push
#pragma opt_lifetimes off
typedef union {
u32 raw;
struct {
u32 reserved : 24;
u32 instructionClass : 2;
u32 payload : 6;
} fields;
} VmInstruction;
CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
u64 maxIndex = 0xFFFFFFFEULL;
CHANSVmObjHdr* pAccLogNot;
const vmWStringObjVal* accumulatorString;
CHANSVmErr booleanResult;
const VmResultTypeData* resultTypes = &VmResultTypeTbl;
CHANSVmPrivate* pVm;
s32 cmpHigh;
u32 cmpLow;
CHANSVmObjHdr operand;
CHANSVmObjHdr load;
u32 leftTypeByte;
CHANSVmObjHdr refObj;
CHANSVmObjHdr* loadPtr;
CHANSVmObjHdr indexObj;
CHANSVmObjHdr copies[2];
double floatLiteral;
CHANSVmObjType operandTypes[2];
CHANSVmObjHdr* pAccLoadStringConst;
u32 rightTypeByte;
u32 foundEntry;
CHANSVmErr loadResult;
CHANSVmErr result;
CHANSVmModule* dbg;
u32 typeIdx;
const vmWStringObjVal* stackString;
s32 parseOk;
u32 isTypeMatch;
u32 arrayIdx;
vmBoolInt shouldBranch;
CHANSVmObjHdr* refPtr;
CHANSVmObjHdr* stackPtr;
CHANSVmErr caseResult;
CHANSVmObjHdr* pAccLoadIndirect;
u32 propertyOffset;
CHANSVmErr deleteResult;
u32 arraySize;
s32 snpLen;
CHANSVmObjHdr* accumulatorSetIndex;
CHANSVmErr arrayResult;
CHANSVmObjHdr* hdr;
u64 invertedVal;
u32 computedAddr;
vmBoolInt bResult;
u32 remaining;
s32 boolVal;
u32 len;
u32 callMode;
CHANSVmObjHdr* accumulatorGetPropertyName;
u32 idx;
vmBoolInt caseMatch;
CHANSVmObjHdr* foundObj;
u32 instruction;
u32 opKind;
char* s;
s64 fullVal;
u64 parsedIndex;
double stackFloat;
u32 stackStringLen, accumulatorStringLen;
const u8 (*convTbl)[6];
u32 imm16Val;
u32 strEqual;
CHANSVmObjHdr* accumulatorDeleteIndirect;
CHANSVmPrivate* pVm;
u32 newPos;
u32 propertyIndex;
u8* pOpData;
u32 strIndex;
s32 opSize;
CHANSVmOpFunction opFunc;
u8* operandBuf;
u32 convTypeIdx;
CHANSVmObjHdr* resultObj;
CHANSVmObjHdr* leftOp;
CHANSVmObjHdr* rightOp;
CHANSVmObjHdr* pAccStoreIndirect;
CHANSVmObjHdr* copyResult;
CHANSVmObjHdr* accumulator;
CHANSVmObjHdr* stackTop;
pVm = (CHANSVmPrivate*)vm;
if (stepCount == 0) {
stepCount = 1;
}
stepCount += (stepCount == 0);
memset(&operand, 0, sizeof(operand));
stackPtr = &indexObj;
stackPtr = copies;
cmpHigh = 0;
cmpLow = -2;
do {
s32 opSize;
VmInstruction instruction;
u8* operandBuf;
u32 arrayIdx;
u32 imm16Val;
u32 computedAddr;
CHANSVmObjHdr* copyResult;
CHANSVmObjHdr* foundObj;
CHANSVmErr result;
u32 newPos;
u32 isTypeMatch;
vmBoolInt shouldBranch;
while (stepCount-- != 0) {
if (pVm->bSignalUpdated != vmFalse && pVm->bSignalBlocked == vmFalse) {
pVm->bSignalUpdated = vmFalse;
return CHANS_VM_ERR_SIGNAL;
@@ -7186,14 +7161,23 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
return CHANS_VM_ERR_HEAP_RANGE;
}
instruction = pVm->pActiveCtx->pDbg->pData[pVm->pActiveCtx->pc];
instruction.raw = pVm->pActiveCtx->pDbg->pData[pVm->pActiveCtx->pc];
if (pVm->bSuspendStep != vmFalse) {
instruction = 0;
instruction.raw = 0;
}
if ((instruction & 0xC0) == 0) {
if (instruction.fields.instructionClass == 0) {
u32 typeIdx;
CHANSVmObjHdr* rightOp;
u32 opKind;
CHANSVmObjType* enumedType;
CHANSVmOpFunction opFunc;
u32 leftTypeByte;
u32 rightTypeByte;
u32 convTypeIdx;
CHANSVmObjHdr* leftOp;
opSize = 1;
switch (instruction) {
switch (instruction.raw) {
case CHANS_VM_OP_LOAD_IMM_1: {
result = 1;
goto shared_load_imm;
@@ -7305,37 +7289,41 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
}
rightTypeByte = rightOp->type;
typeIdx = 0;
leftTypeByte = leftOp->type;
for (typeIdx = 0; typeIdx < 2; typeIdx++) {
if (CHANSVmGetEnumedType(&operandTypes[typeIdx], (s32)(typeIdx == 0 ? leftTypeByte : rightTypeByte)) == 0) {
enumedType = operandTypes;
for (; typeIdx < 2; typeIdx++, enumedType++) {
if (CHANSVmGetEnumedType(enumedType, (s32)(typeIdx == 0 ? rightTypeByte : leftTypeByte)) ==
0) {
goto error_setter;
}
}
{
const u8 (*convTbl)[6];
switch (opKind) {
case VM_OPKIND_ADD: {
convTbl = scVmResultTypeAdd;
convTbl = resultTypes->add;
break;
}
case VM_OPKIND_MOD:
case VM_OPKIND_MUL:
case VM_OPKIND_SUB:
case VM_OPKIND_DIV: {
convTbl = scVmResultTypeArith;
convTbl = resultTypes->arith;
break;
}
case VM_OPKIND_CMP: {
convTbl = scVmResultTypeCmp;
convTbl = resultTypes->cmp;
break;
}
case VM_OPKIND_EQ: {
convTbl = scVmResultTypeEq;
convTbl = resultTypes->eq;
break;
}
case VM_OPKIND_BIT:
case VM_OPKIND_SHIFT: {
convTbl = scVmResultTypeBitShift;
convTbl = resultTypes->bitShift;
break;
}
default: {
@@ -7372,12 +7360,12 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
if (result == CHANS_VM_OK) {
result = CHANSVmDeleteObject(vm, &operand);
if (result == CHANS_VM_OK && leftOp != &pVm->accumulator && leftOp != &operand && (leftOp->flags.raw & CHANSVM_OBJ_FLAG_READONLY) == 0 &&
(result = CHANSVmDeleteObject(vm, leftOp)) == CHANS_VM_OK) {
(result = CHANSVmDeleteObject(vm, leftOp), result == CHANS_VM_OK)) {
// TODO: find the correct sizeof(...) expression
CHANSVmFree(vm, leftOp, 0x20);
}
if (result == CHANS_VM_OK && rightOp != &pVm->accumulator && rightOp != &operand && (rightOp->flags.raw & CHANSVM_OBJ_FLAG_READONLY) == 0 &&
(result = CHANSVmDeleteObject(vm, rightOp)) == CHANS_VM_OK) {
(result = CHANSVmDeleteObject(vm, rightOp), result == CHANS_VM_OK)) {
// TODO: find the correct sizeof(...) expression
CHANSVmFree(vm, rightOp, 0x20);
}
@@ -7386,11 +7374,13 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
break;
case CHANS_VM_OP_PUSH: {
CHANSVmObjHdr* resultObj;
resultObj = vmNull;
// This comparison is odd... it does improve the match though
if (pVm->pActiveCtx->stackDepth < (u32)-1) {
resultObj = CHANSVmNewObjHdr(vm, vmTrue);
if (resultObj != vmNull) {
resultObj = CHANSVmCopyObject(vm, resultObj, &pVm->accumulator);
CHANSVmObjHdr* hdr = CHANSVmNewObjHdr(vm, vmTrue);
if (hdr != vmNull) {
resultObj = CHANSVmCopyObject(vm, hdr, &pVm->accumulator);
if (resultObj != vmNull) {
pVm->pActiveCtx->stackDepth++;
}
@@ -7489,14 +7479,14 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
opFunc = VmCmpGeq;
}
binary_pop:
leftOp = &operand;
rightOp = &pVm->accumulator;
result = CHANSVmPopObject(vm, &operand);
if (result != CHANS_VM_OK) {
break;
}
goto binary_typecheck;
binary_pop:
leftOp = &operand;
rightOp = &pVm->accumulator;
result = CHANSVmPopObject(vm, &operand);
if (result != CHANS_VM_OK) {
break;
}
goto binary_typecheck;
case CHANS_VM_OP_RETURN: {
result = CHANSVmDeleteObject(vm, &pVm->accumulator);
@@ -7514,19 +7504,19 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
}
case CHANS_VM_OP_BIT_NOT: {
accumulator = &pVm->accumulator;
switch (accumulator->type) {
CHANSVmObjHdr* pAcc = &pVm->accumulator;
u64 invertedVal;
switch (pAcc->type) {
case CHANS_VM_OBJ_TYPE_INTEGER: {
invertedVal = accumulator->value.int_v;
invertedVal = pAcc->value.int_v;
break;
}
case CHANS_VM_OBJ_TYPE_FLOAT: {
invertedVal = (s64)(CHANSVmFloatSign(accumulator->value.float_v) * floor(fabs(accumulator->value.float_v)));
invertedVal = (s64)(CHANSVmFloatSign(pAcc->value.float_v) * floor(fabs(pAcc->value.float_v)));
break;
}
case CHANS_VM_OBJ_TYPE_STRING: {
parseOk = CHANSVmParseInt(accumulator, 0, &invertedVal);
s32 parseOk = CHANSVmParseInt(pAcc, 0, &invertedVal);
if (parseOk == 0) {
invertedVal = 0;
}
@@ -7538,31 +7528,30 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
break;
}
}
result = CHANSVmSetInteger(vm, accumulator, (vmInteger)~invertedVal);
result = CHANSVmSetInteger(vm, pAcc, (vmInteger)~invertedVal);
break;
}
case CHANS_VM_OP_LOG_NOT: {
pAccLogNot = &pVm->accumulator;
booleanResult = CHANSVmGetBoolean(&bResult, pAccLogNot);
CHANSVmObjHdr* pAcc = &pVm->accumulator;
vmBoolInt bResult;
CHANSVmErr booleanResult = CHANSVmGetBoolean(&bResult, pAcc);
if (booleanResult == CHANS_VM_OK) {
boolVal = bResult ? 0 : 1;
booleanResult = CHANSVmSetInteger(vm, pAccLogNot, boolVal);
s32 boolVal = bResult ? 0 : 1;
booleanResult = CHANSVmSetInteger(vm, pAcc, boolVal);
}
result = booleanResult;
break;
}
case CHANS_VM_OP_LOAD_INDIRECT: {
loadPtr = &load;
pAccLoadIndirect = &pVm->accumulator;
CHANSVmObjHdr* pAcc = &pVm->accumulator;
result = CHANS_VM_ERR_LOAD_INDIRECT;
if (pAccLoadIndirect->type == CHANS_VM_TYPE_INDEX_REF) {
copyResult = CHANSVmCopyObject(vm, loadPtr, pAccLoadIndirect);
if (pAcc->type == CHANS_VM_TYPE_INDEX_REF) {
copyResult = CHANSVmCopyObject(vm, &load, pAcc);
if (copyResult != vmNull) {
foundObj = VmGetArrayElement(vm, &load, load.value.data.len, vmFalse);
result = VmStore(vm, pAccLoadIndirect, foundObj);
result = VmStore(vm, pAcc, foundObj);
if (result == CHANS_VM_OK) {
result = CHANSVmDeleteObject(vm, &load);
}
@@ -7604,29 +7593,29 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
case CHANS_VM_OP_PROP_GET:
case CHANS_VM_OP_PROP_SET: {
u32 callMode;
operandBuf = VmGetOperand(vm, 1, 3);
if (operandBuf == vmNull) {
return CHANS_VM_ERR_CODE_RANGE;
}
callMode = instruction == CHANS_VM_OP_PROP_GET ? CHANS_VM_CALL_TYPE_PROP_GET : CHANS_VM_CALL_TYPE_PROP_SET;
callMode = instruction.raw == CHANS_VM_OP_PROP_GET ? CHANS_VM_CALL_TYPE_PROP_GET : CHANS_VM_CALL_TYPE_PROP_SET;
result = VmCallMethod(vm, 3, callMode, vmFalse);
opSize = 0;
break;
}
case CHANS_VM_OP_STORE_INDIRECT: {
refPtr = &refObj;
pAccStoreIndirect = &pVm->accumulator;
CHANSVmObjHdr* pAcc = &pVm->accumulator;
result = CHANS_VM_ERR_STORE_INDIRECT;
if (pAccStoreIndirect->type == CHANS_VM_TYPE_INDEX_REF) {
copyResult = CHANSVmCopyObject(vm, refPtr, pAccStoreIndirect);
if (pAcc->type == CHANS_VM_TYPE_INDEX_REF) {
copyResult = CHANSVmCopyObject(vm, stackPtr + 1, pAcc);
if (copyResult != 0) {
result = CHANSVmPopObject(vm, pAccStoreIndirect);
result = CHANSVmPopObject(vm, pAcc);
if (result == CHANS_VM_OK) {
foundObj = VmGetArrayElement(vm, &refObj, refObj.value.data.len, vmTrue);
result = VmStore(vm, foundObj, pAccStoreIndirect);
foundObj = VmGetArrayElement(vm, stackPtr + 1, (stackPtr + 1)->value.data.len, vmTrue);
result = VmStore(vm, foundObj, pAcc);
if (result == CHANS_VM_OK) {
result = CHANSVmDeleteObject(vm, &refObj);
result = CHANSVmDeleteObject(vm, stackPtr + 1);
}
}
}
@@ -7635,22 +7624,27 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
}
case CHANS_VM_OP_LOAD_STRING_CONST: {
CHANSVmObjHdr* pAcc;
CHANSVmExecutionCtx* ctx;
CHANSVmModule* dbg;
CHANSVmErr loadResult;
opSize = 3;
operandBuf = VmGetOperand(vm, 1, 3);
if (operandBuf == vmNull) {
return CHANS_VM_ERR_CODE_RANGE;
}
pAccLoadStringConst = &pVm->accumulator;
loadResult = CHANSVmDeleteObject(vm, pAccLoadStringConst);
pAcc = &pVm->accumulator;
loadResult = CHANSVmDeleteObject(vm, pAcc);
if (loadResult == CHANS_VM_OK) {
strIndex = VM_READ_BE_U16(operandBuf, 0);
dbg = pVm->pActiveCtx->pDbg;
if (strIndex >= dbg->stringCount || dbg->pStringTbl[strIndex].pStringData == vmNull) {
imm16Val = VM_READ_BE_U16(operandBuf, 0);
ctx = pVm->pActiveCtx;
dbg = ctx->pDbg;
if (imm16Val >= dbg->stringCount || dbg->pStringTbl[imm16Val].pStringData == vmNull) {
loadResult = CHANS_VM_ERR_LOAD_STRING_CONST;
} else {
pAccLoadStringConst->type = CHANS_VM_OBJ_TYPE_STRING;
pAccLoadStringConst->hasData = vmTrue;
pAccLoadStringConst->value.wstring_v = (vmWStringObjVal*)&pVm->pActiveCtx->pDbg->pStringTbl[strIndex];
pAcc->type = CHANS_VM_OBJ_TYPE_STRING;
pAcc->hasData = vmTrue;
pAcc->value.wstring_v = (vmWStringObjVal*)&ctx->pDbg->pStringTbl[imm16Val];
}
}
result = loadResult;
@@ -7658,30 +7652,35 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
}
case CHANS_VM_OP_SET_INDEX: {
accumulatorSetIndex = &pVm->accumulator;
CHANSVmObjHdr* accumulator = &pVm->accumulator;
u64 cmpVal;
s64 fullVal;
u64 parsedIndex;
result = CHANS_VM_ERR_SET_INDEX;
copyResult = CHANSVmCopyObject(vm, stackPtr, accumulatorSetIndex);
copyResult = CHANSVmCopyObject(vm, stackPtr, accumulator);
if (copyResult == 0) {
goto set_index_ok;
}
result = CHANSVmPopObject(vm, accumulatorSetIndex);
result = CHANSVmPopObject(vm, accumulator);
if (result != CHANS_VM_OK) {
goto set_index_ok;
}
if (accumulatorSetIndex->type == CHANS_VM_TYPE_ARRAY) {
if (accumulator->type == CHANS_VM_TYPE_ARRAY) {
int typeByte = stackPtr->type;
switch (typeByte) {
case CHANS_VM_OBJ_TYPE_INTEGER:
cmpHigh = 0;
cmpLow = -2;
cmpVal = VM_MAKE_U64(cmpHigh, cmpLow);
fullVal = stackPtr->value.int_v;
if ((u64)fullVal > maxIndex) {
if ((u64)fullVal > cmpVal) {
goto set_index_error;
}
arrayIdx = (u32)stackPtr->value.int_v;
goto set_index_ok;
case CHANS_VM_OBJ_TYPE_FLOAT: {
stackFloat = stackPtr->value.float_v;
double stackFloat = stackPtr->value.float_v;
if (stackFloat >= 0.0 && stackFloat <= 4294967294.0) {
arrayIdx = (u32)stackFloat;
goto set_index_ok;
@@ -7690,7 +7689,10 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
}
case CHANS_VM_OBJ_TYPE_STRING:
if (CHANSVmParseInt(stackPtr, 10, &parsedIndex)) {
if (parsedIndex <= maxIndex) {
cmpHigh = 0;
cmpLow = -2;
cmpVal = VM_MAKE_U64(cmpHigh, cmpLow);
if (parsedIndex <= cmpVal) {
arrayIdx = (u32)parsedIndex;
goto set_index_ok;
}
@@ -7705,88 +7707,88 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
if (result != CHANS_VM_OK) {
break;
}
accumulatorSetIndex->value.data.len = arrayIdx;
accumulatorSetIndex->type = CHANS_VM_TYPE_INDEX_REF;
accumulator->value.data.len = arrayIdx;
accumulator->type = CHANS_VM_TYPE_INDEX_REF;
result = CHANSVmDeleteObject(vm, stackPtr);
break;
}
case CHANS_VM_OP_GET_PROPERTY_NAME: {
u32 foundEntry;
CHANSVmObjHdr* accumulator;
opSize = 5;
operandBuf = VmGetOperand(vm, 1, 5);
if (operandBuf == vmNull) {
return CHANS_VM_ERR_CODE_RANGE;
}
result = CHANS_VM_ERR_GET_PROPERTY_NAME;
foundEntry = 0;
arrayIdx = 0;
imm16Val = VM_READ_BE_U16(operandBuf, 0);
foundObj = CHANSVmLookupScopedObject(vm, imm16Val);
accumulatorGetPropertyName = &pVm->accumulator;
if (foundObj != vmNull && accumulatorGetPropertyName->type == CHANS_VM_OBJ_TYPE_INTEGER) {
propertyIndex = accumulatorGetPropertyName->value.data.len;
if ((u64)accumulatorGetPropertyName->value.int_v <= maxIndex) {
switch (foundObj->type) {
case CHANS_VM_TYPE_ARRAY: {
len = VmArrayGetLengthInternal(foundObj);
remaining = propertyIndex;
idx = 0;
while (idx < len) {
copyResult = CHANSVmGetArrayElement(vm, foundObj, idx);
if (copyResult == vmNull) {
break;
}
if (copyResult->type != CHANS_VM_OBJ_TYPE_BLANK) {
if (remaining == 0) {
propertyIndex = idx;
goto found_entry;
} else {
remaining--;
}
}
idx++;
accumulator = &pVm->accumulator;
if (foundObj != vmNull && accumulator->type == CHANS_VM_OBJ_TYPE_INTEGER &&
(computedAddr = accumulator->value.data.len, (u64)accumulator->value.int_v <= ~1U)) {
if ((s32)foundObj->type != CHANS_VM_TYPE_ARRAY) {
foundEntry = 0;
} else {
u32 idx;
u32 remaining;
u32 len = VmArrayGetLengthInternal(foundObj);
remaining = computedAddr;
idx = 0;
while (idx < len) {
copyResult = CHANSVmGetArrayElement(vm, foundObj, idx);
if (copyResult == vmNull) {
break;
}
if (copyResult->type != CHANS_VM_OBJ_TYPE_BLANK) {
if (remaining == 0) {
computedAddr = idx;
goto found_entry;
} else {
remaining--;
}
copyResult = vmNull;
found_entry:
if (copyResult != vmNull) {
foundEntry = 1;
if (CHANSVmDeleteObject(vm, accumulatorGetPropertyName) == CHANS_VM_OK) {
hdr = CHANSVmNewObject(vm, vmFalse, accumulatorGetPropertyName, CHANS_VM_OBJ_TYPE_STRING, VM_STRING_SIZE);
if (hdr != vmNull) {
s = accumulatorGetPropertyName->value.string_v->spData;
snpLen = snprintf(s, 0x40, VmIntegerFormat, (u64)propertyIndex);
CHANSVmStrCpyToU16FromU8((wchar_t*)s, s, snpLen);
accumulatorGetPropertyName->value.string_v->len = VM_STR_LENGTH(snpLen);
if (accumulatorGetPropertyName->value.string_v->len == 0) {
goto property_error;
}
} else {
goto property_error;
}
} else {
}
idx++;
}
copyResult = vmNull;
found_entry:
if (copyResult != vmNull) {
foundEntry = 1;
if (CHANSVmDeleteObject(vm, accumulator) == CHANS_VM_OK) {
CHANSVmObjHdr* hdr = CHANSVmNewObject(vm, vmFalse, accumulator, CHANS_VM_OBJ_TYPE_STRING, VM_STRING_SIZE);
if (hdr != vmNull) {
char* s = accumulator->value.string_v->spData;
s32 snpLen = snprintf(s, 0x40, VmIntegerFormat, (u64)computedAddr);
CHANSVmStrCpyToU16FromU8((wchar_t*)s, s, snpLen);
accumulator->value.string_v->len = VM_STR_LENGTH(snpLen);
if (accumulator->value.string_v->len == 0) {
goto property_error;
}
} else {
foundEntry = 0;
goto property_error;
}
break;
} else {
goto property_error;
}
} else {
foundEntry = 0;
}
shouldBranch = foundEntry;
result = CHANS_VM_OK;
}
result = CHANS_VM_OK;
arrayIdx = 0;
}
goto property_done;
property_error:
result = CHANS_VM_ERR_GET_PROPERTY_NAME;
property_done:
if (result == CHANS_VM_OK && shouldBranch == 0) {
pOpData = operandBuf;
propertyOffset = (VM_READ_BE_U16(pOpData, 2)) & CHANS_VM_OP_BRANCH_OFFSET_BIAS;
if (result == CHANS_VM_OK && foundEntry == 0) {
u8* pOpData = operandBuf;
computedAddr = (VM_READ_BE_U16(pOpData, 2)) & CHANS_VM_OP_BRANCH_OFFSET_BIAS;
if ((VM_READ_BE_U16(pOpData, 2)) & CHANS_VM_OP_BRANCH_OFFSET_SIGN) {
computedAddr = propertyOffset + pVm->pActiveCtx->pc - CHANS_VM_OP_BRANCH_OFFSET_BIAS_5;
computedAddr = computedAddr + pVm->pActiveCtx->pc - CHANS_VM_OP_BRANCH_OFFSET_BIAS_5;
} else {
computedAddr = propertyOffset + pVm->pActiveCtx->pc + 5;
computedAddr += pVm->pActiveCtx->pc + 5;
}
if (computedAddr < 1 || computedAddr >= pVm->pActiveCtx->pDbg->codeSize) {
return CHANS_VM_ERR_CODE_RANGE;
@@ -7798,21 +7800,23 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
}
case CHANS_VM_OP_NEW_ARRAY: {
CHANSVmObjHdr* accumulator;
CHANSVmErr arrayResult;
opSize = 3;
operandBuf = VmGetOperand(vm, 1, 3);
if (operandBuf == vmNull) {
return CHANS_VM_ERR_CODE_RANGE;
}
arraySize = VM_READ_BE_U16(operandBuf, 0);
imm16Val = VM_READ_BE_U16(operandBuf, 0);
accumulator = &pVm->accumulator;
arrayResult = CHANSVmDeleteObject(vm, accumulator);
if (arrayResult == CHANS_VM_OK) {
arrayResult = VmPushFuncReturnInfo(vm, arraySize, arraySize, 0);
arrayResult = VmPushFuncReturnInfo(vm, imm16Val, imm16Val, 0);
if (arrayResult == CHANS_VM_OK) {
accumulator->type = CHANS_VM_TYPE_ARRAY;
accumulator->parentCls = pVm->pArrayCls;
if (CHANSVmNewObjData(vm, accumulator, sizeof(ArrayChunk)) == vmNull ||
(arraySize != 0 && VmArrayExpandCommon(vm, accumulator, arraySize, 0, vmTrue) == 0)) {
(imm16Val != 0 && VmArrayExpandCommon(vm, accumulator, imm16Val, 0, vmTrue) == 0)) {
arrayResult = CHANS_VM_ERR_CALL_NEW_ARRAY;
} else {
arrayResult = VmReturnWithValue(vm, 0);
@@ -7844,7 +7848,7 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
}
case CHANS_VM_OP_STORE_UNDEFINED: {
result = VmStore(vm, &pVm->accumulator, (CHANSVmObjHdr*)&VmUndefinedObj);
result = VmStore(vm, &pVm->accumulator, (CHANSVmObjHdr*)&CHANSVmConstStringObjectUndefined_[4]);
break;
}
@@ -7860,11 +7864,10 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
}
case CHANS_VM_OP_DELETE_INDIRECT: {
accumulatorDeleteIndirect = &pVm->accumulator;
deleteResult = CHANS_VM_ERR_DELETE_INDIRECT;
if (accumulatorDeleteIndirect->type == CHANS_VM_TYPE_INDEX_REF) {
foundObj = VmGetArrayElement(vm, accumulatorDeleteIndirect, accumulatorDeleteIndirect->value.data.len, vmFalse);
CHANSVmObjHdr* accumulator = &pVm->accumulator;
CHANSVmErr deleteResult = CHANS_VM_ERR_DELETE_INDIRECT;
if (accumulator->type == CHANS_VM_TYPE_INDEX_REF) {
foundObj = VmGetArrayElement(vm, accumulator, accumulator->value.data.len, vmFalse);
deleteResult = VmDeleteCommon(vm, foundObj);
}
result = deleteResult;
@@ -7876,14 +7879,14 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
break;
}
}
} else if ((instruction & 0xC0) == 0x40) {
} else if (instruction.fields.instructionClass == 1) {
opSize = 2;
operandBuf = VmGetOperand(vm, 0, 2);
if (operandBuf == vmNull) {
return CHANS_VM_ERR_CODE_RANGE;
}
imm16Val = (instruction << 8 | operandBuf[1]) & 0x1FFF;
switch (instruction & CHANS_VM_OP_SYMBOL_STORE) {
imm16Val = (instruction.raw << 8 | operandBuf[1]) & 0x1FFF;
switch (instruction.raw & CHANS_VM_OP_SYMBOL_STORE) {
case 0: {
foundObj = CHANSVmLookupScopedObject(vm, imm16Val);
result = VmStore(vm, &pVm->accumulator, foundObj);
@@ -7905,12 +7908,11 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
if (operandBuf == vmNull) {
return CHANS_VM_ERR_CODE_RANGE;
}
switch ((int)instruction & CHANS_VM_OP_BRANCH_COND_MASK) {
switch ((int)instruction.raw & CHANS_VM_OP_BRANCH_COND_MASK) {
case CHANS_VM_OP_BRANCH_CASE: {
caseResult = CHANS_VM_ERR_CASE;
stackTop = (CHANSVmObjHdr*)pVm->pObjStackTopBuf;
if (pVm->pActiveCtx->stackDepth != 0 && (u8*)stackTop + sizeof(CHANSVmObjHdr) <= pVm->pHeapEnd) {
result = CHANS_VM_ERR_CASE;
if (pVm->pActiveCtx->stackDepth != 0 && pVm->pObjStackTopBuf + sizeof(CHANSVmObjHdr) <= pVm->pHeapEnd) {
CHANSVmObjHdr* stackTop = (CHANSVmObjHdr*)pVm->pObjStackTopBuf;
isTypeMatch = 0;
if (stackTop->type == pVm->accumulator.type) {
switch (stackTop->type) {
@@ -7923,10 +7925,10 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
goto end_branch_check;
}
case CHANS_VM_OBJ_TYPE_STRING: {
accumulatorString = pVm->accumulator.value.wstring_v;
stackString = stackTop->value.wstring_v;
u32 stackStringLen, accumulatorStringLen;
const vmWStringObjVal* accumulatorString = pVm->accumulator.value.wstring_v;
const vmWStringObjVal* stackString = stackTop->value.wstring_v;
u32 strEqual;
isTypeMatch = 0;
stackStringLen = stackString->len;
accumulatorStringLen = accumulatorString->len;
@@ -7957,23 +7959,19 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
goto end_branch_check;
}
default: {
caseResult = CHANS_VM_ERR_CHECK_STRICT_EQUALITY;
result = CHANS_VM_ERR_CHECK_STRICT_EQUALITY;
goto done_with_switch;
}
}
}
end_branch_check:
caseMatch = isTypeMatch;
caseResult = CHANS_VM_OK;
shouldBranch = isTypeMatch;
result = CHANS_VM_OK;
done_with_switch:
if (caseResult == CHANS_VM_OK) {
if (caseMatch != 0) {
caseResult = CHANSVmPopObject(vm, vmNull);
}
shouldBranch = caseMatch;
if (result == CHANS_VM_OK && shouldBranch != 0) {
result = CHANSVmPopObject(vm, vmNull);
}
}
result = caseResult;
break;
}
case CHANS_VM_OP_BRANCH_FALSE: {
@@ -7998,8 +7996,8 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
}
if (result == CHANS_VM_OK && shouldBranch != 0) {
computedAddr = (instruction << 8 | operandBuf[1]) & CHANS_VM_OP_BRANCH_OFFSET_BIAS;
if ((instruction << 8 | operandBuf[1]) & CHANS_VM_OP_BRANCH_OFFSET_SIGN) {
computedAddr = (instruction.raw << 8 | operandBuf[1]) & CHANS_VM_OP_BRANCH_OFFSET_BIAS;
if ((instruction.raw << 8 | operandBuf[1]) & CHANS_VM_OP_BRANCH_OFFSET_SIGN) {
computedAddr = computedAddr + pVm->pActiveCtx->pc - CHANS_VM_OP_BRANCH_OFFSET_BIAS;
} else {
computedAddr += pVm->pActiveCtx->pc + 2;
@@ -8022,9 +8020,7 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
return CHANS_VM_ERR_CODE_RANGE;
}
pVm->pActiveCtx->pc = newPos;
}
} while (stepCount-- != 1);
return CHANS_VM_OK;
}
#pragma pop

View File

@@ -412,19 +412,18 @@ extern "C" char scP_txtScrll_DOWN[] = "P_txtScrll_DOWN";
struct ButtonAnimations {
KeyType type;
const char* paneName;
u16 _pad_0;
u16 count;
u32 count;
const char* bindingName;
const InputFormAnimationFile* files[12];
};
ButtonAnimations csButtonAnimations[] = {
{KT_NormalButton, scP_txtScrll_UP, 0, 8, NULL, {
{KT_NormalButton, scP_txtScrll_UP, 8, NULL, {
&csAninationFile__Q29textinput9inputform[0], &csAninationFile__Q29textinput9inputform[1],
&csAninationFile__Q29textinput9inputform[2], &csAninationFile__Q29textinput9inputform[3],
&csAninationFile__Q29textinput9inputform[4], &csAninationFile__Q29textinput9inputform[5],
&csAninationFile__Q29textinput9inputform[6], &csAninationFile__Q29textinput9inputform[7]}},
{KT_NormalButton, scP_txtScrll_DOWN, 0, 8, csScrollButtonAnimationTarget, {
{KT_NormalButton, scP_txtScrll_DOWN, 8, csScrollButtonAnimationTarget, {
&csAninationFile__Q29textinput9inputform[0], &csAninationFile__Q29textinput9inputform[1],
&csAninationFile__Q29textinput9inputform[2], &csAninationFile__Q29textinput9inputform[3],
&csAninationFile__Q29textinput9inputform[4], &csAninationFile__Q29textinput9inputform[5],
@@ -1109,36 +1108,7 @@ LayoutByNW4R::LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor
mpLanguageData(&csLanguageDependencyDataUEJ__Q29textinput9inputform), mpFontName(fontName),
mbUpVisible(false), mbDownVisible(false), mbRepeat(false), mpInputEventHandler(NULL) {}
static inline const char* selectInputTextName(const nw4rmanager::Layout& layout, const void* const& languageData) {
if (layout.getPane(static_cast<const LanguagePaneData*>(languageData)->textBox)) {
return static_cast<const LanguagePaneData*>(languageData)->textBox;
}
return "T_2l_TextBox";
}
inline void LayoutByNW4R::addButtonAnimation(MEMAllocator* allocator, nw4rmanager::AnmPane* animationPane, const InputFormAnimationFile* const& file, const char* bindingName) {
void* resource = mpMultiArcResourceAccessor->GetResource(0, file->fileName, NULL);
AnimTransformPane* transform = static_cast<AnimTransformPane*>(getLayout()->CreateAnimTransform(resource, mpMultiArcResourceAccessor));
if (!bindingName) animationPane->addAnimation(allocator, file->id, transform, false, true);
else animationPane->forceAddAnimation(allocator, file->id, transform, bindingName, false, true);
}
void LayoutByNW4R::create(MEMAllocator* allocator, EditBuffer* editBuffer) {
const char* bindingName;
void* handlerMemory;
void* memory;
nw4r::lyt::Pane* pane;
u32 buttonIndex;
u16 next;
Info_* rows;
u16 previous;
u16 count;
u16 animationIndex;
Info_* selected;
nw4rmanager::AnmPane* animationPane;
nw4r::lyt::TextBox* textBox;
u16 selectedIndex;
Info_* listEnd;
mpAllocator = allocator;
textdrawer::Base::create(allocator);
mpString = static_cast<tistring::Decolated*>(editBuffer->mpString);
@@ -1147,18 +1117,18 @@ void LayoutByNW4R::create(MEMAllocator* allocator, EditBuffer* editBuffer) {
mriManager.mpAllocator = allocator;
mriManager.mpInfo = static_cast<Info_*>(MEMAllocFromAllocator(allocator, (mriManager.mMaxLength + 2) * sizeof(Info_)));
mriManager.init();
rows = mriManager.mpInfo;
selected = &rows[rows[mriManager.mMaxLength].Next];
previous = selected->Back;
next = selected->Next;
selectedIndex = rows[next].Back;
Info_* rows = mriManager.mpInfo;
Info_* selected = &rows[rows[mriManager.mMaxLength].Next];
u16 previous = selected->Back;
u16 next = selected->Next;
u16 selectedIndex = rows[next].Back;
rows[next].Back = previous;
rows[previous].Next = next;
selected->Back = selectedIndex;
selected->Next = selectedIndex;
Info_* listEnd = &mriManager.mpInfo[mriManager.mpInfo[static_cast<u16>(mriManager.mMaxLength + 1)].Back];
rows = mriManager.mpInfo;
listEnd = &mriManager.mpInfo[mriManager.mpInfo[static_cast<u16>(mriManager.mMaxLength + 1)].Back];
if (selected->Next == selected->Back) {
if (selected->Back == selected->Next) {
next = listEnd->Next;
selected->Back = rows[next].Back;
selected->Next = next;
@@ -1168,7 +1138,7 @@ void LayoutByNW4R::create(MEMAllocator* allocator, EditBuffer* editBuffer) {
selected->StrCount = 0;
selected->DispRowCount = 1;
mpCursorLine = selected;
handlerMemory = MEMAllocFromAllocator(allocator, sizeof(EventHandler));
void* handlerMemory = MEMAllocFromAllocator(allocator, sizeof(EventHandler));
mpInputEventHandler = new (handlerMemory) EventHandler(this);
nw4rmanager::Layout::createWithEventHandler(allocator, mpInputEventHandler);
if (!mpFontName) {
@@ -1180,7 +1150,7 @@ void LayoutByNW4R::create(MEMAllocator* allocator, EditBuffer* editBuffer) {
mpMultiArcResourceAccessor->GetFont(mpFontName)->SetAlternateChar(0xe06b);
setFont(*mpMultiArcResourceAccessor->GetFont(mpFontName));
}
textBox = static_cast<nw4r::lyt::TextBox*>(mpLayout->GetRootPane()->FindPaneByName(static_cast<const char*>(mpLayoutData), true));
nw4r::lyt::TextBox* textBox = static_cast<nw4r::lyt::TextBox*>(mpLayout->GetRootPane()->FindPaneByName(static_cast<const char*>(mpLayoutData), true));
textBox->SetString(L"", 0);
mfCharacterSpacing = textBox->GetCharSpace();
mfLineSpacing = textBox->GetLineSpace();
@@ -1192,24 +1162,29 @@ void LayoutByNW4R::create(MEMAllocator* allocator, EditBuffer* editBuffer) {
setVisible("N_2line", true);
mpPaneManager->setAllComponentTriggerTarget(false);
mpPaneManager->setAllBoundingBoxComponentTriggerTarget(true);
pane = mpLayout->GetRootPane()->FindPaneByName(static_cast<const LanguagePaneData*>(mpLanguageData)->textBox, true);
if (!pane) pane = mpLayout->GetRootPane()->FindPaneByName(selectInputTextName(*this, mpLanguageData), true);
nw4r::lyt::Pane* pane = mpLayout->GetRootPane()->FindPaneByName(static_cast<const LanguagePaneData*>(mpLanguageData)->textBox, true);
if (!pane) pane = mpLayout->GetRootPane()->FindPaneByName(getLanguageTextPane() ? static_cast<const LanguagePaneData*>(mpLanguageData)->textBox : "T_2l_TextBox", true);
mpPaneManager->getPaneComponentByPane(pane)->setTriggerTarget(true);
for (buttonIndex = 0; buttonIndex < 2; ++buttonIndex) {
for (u32 buttonIndex = 0; buttonIndex < 2; ++buttonIndex) {
const ButtonAnimations& button = csButtonAnimations[static_cast<u16>(buttonIndex)];
animationPane = NULL;
nw4rmanager::AnmPane* animationPane = NULL;
switch (button.type) {
case KT_NormalButton: {
memory = MEMAllocFromAllocator(allocator, sizeof(NormalButtonAnmPane));
void* memory = MEMAllocFromAllocator(allocator, sizeof(NormalButtonAnmPane));
animationPane = new (memory) NormalButtonAnmPane(getPane(button.paneName), NULL);
break;
}
}
nw4r::ut::List_Append(&mAnmPanes, animationPane);
bindingName = button.bindingName;
u32 count;
const char* bindingName = button.bindingName;
count = button.count;
for (animationIndex = 0; animationIndex < count; ++animationIndex) {
addButtonAnimation(allocator, animationPane, button.files[animationIndex], bindingName);
for (u16 animationIndex = 0; animationIndex < count; ++animationIndex) {
const InputFormAnimationFile* const& file = button.files[animationIndex];
void* resource = mpMultiArcResourceAccessor->GetResource(0, file->fileName, NULL);
AnimTransformPane* transform = static_cast<AnimTransformPane*>(getLayout()->CreateAnimTransform(resource, mpMultiArcResourceAccessor));
if (!bindingName) animationPane->addAnimation(allocator, file->id, transform, false, true);
else animationPane->forceAddAnimation(allocator, file->id, transform, bindingName, false, true);
}
}
init();
@@ -1272,6 +1247,12 @@ void LayoutByNW4R::calc() {
}
}
}
static inline const char* selectInputTextName(const nw4rmanager::Layout& layout, const void* const& languageData) {
if (layout.getPane(static_cast<const LanguagePaneData*>(languageData)->textBox)) {
return static_cast<const LanguagePaneData*>(languageData)->textBox;
}
return "T_2l_TextBox";
}
void LayoutByNW4R::setLanguage(Language language) {
Base::setLanguage(language);
@@ -3132,18 +3113,7 @@ bool Base::onCursor(CursorPos* cursor) {
return positioned;
}
static inline f32 scaledExtent(f32 scale, f32 start, f32 end) {
f32 extent = end - start;
return scale * extent;
}
static inline f32 glyphBottom(f32 origin, const Base::DrawInfo& glyph, const nw4r::math::VEC2& scale) {
f32 extent = glyph.rect.GetHeight();
return origin + scale.y * extent;
}
u32 Base::calcCursorPos(f32 x, f32 y) {
f32 zero;
f32 cursorX;
f32 lineTop;
f32 lineBottom;
@@ -3157,17 +3127,16 @@ u32 Base::calcCursorPos(f32 x, f32 y) {
u32 pos = 0;
muWordWrapCounter = 0;
mbHyphen = false;
zero = 0.0f;
while (*string) {
DrawInfo info;
info.rect.left = zero;
info.rect.top = zero;
info.rect.right = zero;
info.rect.bottom = zero;
info.rect.left = 0.0f;
info.rect.top = 0.0f;
info.rect.right = 0.0f;
info.rect.bottom = 0.0f;
info.character = *string;
calcRect(info);
lineBottom = glyphBottom(lineTop, info, scale);
f32 right = cursorX + scaledExtent(scale.x, info.rect.left, info.rect.right);
lineBottom = lineTop + scale.y * (info.rect.bottom - info.rect.top);
f32 right = cursorX + scale.x * info.rect.GetWidth();
if (doWordWrap(mpString->getWCString(), pos, cursorX)) {
if (localY >= lineTop && localY <= lineBottom) {
if (pos != 0) return pos - 1;
@@ -3175,35 +3144,35 @@ u32 Base::calcCursorPos(f32 x, f32 y) {
}
lineTop += scale.y * getLineHeight();
cursorX = getScale().x;
lineBottom = glyphBottom(lineTop, info, scale);
right = cursorX + scaledExtent(scale.x, info.rect.left, info.rect.right);
lineBottom = lineTop + scale.y * (info.rect.bottom - info.rect.top);
right = cursorX + scale.x * info.rect.GetWidth();
}
if (right >= scaledExtent(scale.x, mRect.left, mRect.right)) {
if (right >= scale.x * mRect.GetWidth()) {
if (localY >= lineTop && localY <= lineBottom) return pos;
lineTop += scale.y * getLineHeight();
cursorX = getScale().x;
lineBottom = glyphBottom(lineTop, info, scale);
right = cursorX + scaledExtent(scale.x, info.rect.left, info.rect.right);
lineBottom = lineTop + scale.y * (info.rect.bottom - info.rect.top);
right = cursorX + scale.x * info.rect.GetWidth();
}
if (x <= info.rect.left && localY >= lineTop && localY <= lineBottom) return pos;
if (*string == L'\n') {
if (localY >= lineTop && localY <= lineBottom) return pos;
lineTop += scale.y * getLineHeight();
cursorX = getScale().x;
lineBottom = glyphBottom(lineTop, info, scale);
lineBottom = lineTop + scale.y * (info.rect.bottom - info.rect.top);
if (!string[1] && localY >= lineTop && localY <= lineBottom) return pos + 1;
} else {
if (x >= cursorX && x < right && localY >= lineTop && localY < lineBottom) {
if (cursorX + (right - cursorX) / 2.0f > x) return pos;
if (cursorX + 0.5f * (right - cursorX) > x) return pos;
return pos + 1;
}
cursorX += scaledExtent(scale.x, info.rect.left, info.rect.right);
cursorX += scale.x * info.rect.GetWidth();
}
++string;
++pos;
if (!*string && localY >= lineTop && localY <= lineBottom) return pos;
}
if (lineTop + (lineBottom - lineTop) / 2.0f <= localY) {
if (lineTop + (lineBottom - lineTop) * 0.5f <= localY) {
return Base::calcCursorPos(x, 1.0f + lineTop + mfScrollY);
}
return Base::calcCursorPos(x, 1.0f);

View File

@@ -149,9 +149,6 @@ public:
}
void append(wchar_t ch) {
if (ch == L'\n') {
mCount = 0;
}
mpOutput[mCount++] = ch;
}
@@ -162,7 +159,7 @@ public:
private:
wchar_t* mpOutput;
u16 mCount;
u32 mCount;
};
}
@@ -198,11 +195,9 @@ void Decolated::inputChar(wchar_t ch) {
}
nonKana:
if (mTranslateMode == 3) {
count = mTranslateMode - 3;
input[count] = 0;
input[count] = ch;
count++;
input[count] = 0;
CharacterOutput output(input);
output.append(ch);
count = output.finish();
mKanaStream.mOutput[0] = 0;
} else {
count = 1;

View File

@@ -403,8 +403,8 @@ static inline void sendValidityResponse(u32 command, u32 valid) {
u32 value;
struct { u32 upper : 16; u32 valid : 8; u32 command : 8; } fields;
} reply;
reply.value = command;
reply.fields.valid = valid;
reply.value = valid << 8;
reply.fields.command = command;
OSSendMessage(&sThread->responses, (OSMessage)reply.value, OS_MESSAGE_BLOCK);
}
@@ -708,8 +708,9 @@ extern "C" void clearAllCardFileEntries(s32 slot) {
}
static inline s32 readCardImages(s32 slot, s32 fileNo, CARDDir* dir, CARDFileInfo* fileInfo,
u32 address, s32 offset, s32 imageSize, u32 transferSize) {
u32 address, s32 offset, s32 imageSize) {
s32 sectorSize;
u32 transferSize = (imageSize + offset + 0x1FF) & 0xFFFFFE00;
if (CARDGetSectorSize(slot, (u32*)&sectorSize) < CARD_RESULT_READY) {
sThread->icons[slot][fileNo].bannerEnable = 0;
sThread->icons[slot][fileNo].unk_0x01 = 0;
@@ -740,24 +741,18 @@ static inline s32 readCardImages(s32 slot, s32 fileNo, CARDDir* dir, CARDFileInf
}
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;
u32 address = dir->commentAddr;
u32 base = address & 0xFFFFFE00;
s32 offset = address - base;
s32 readSize = ((address + 0x23F) & 0xFFFFFE00) - base;
s32 sectorSize;
address = dir->commentAddr;
base = address & 0xFFFFFE00;
offset = address - base;
readSize = ((address + 0x23F) & 0xFFFFFE00) - base;
result = CARDGetSectorSize(slot, (u32*)&sectorSize);
s32 result = CARDGetSectorSize(slot, (u32*)&sectorSize);
if (result >= CARD_RESULT_READY) {
u32 fileSize;
if ((s32)base < 0 || base > (fileSize = (u32)dir->length * sectorSize)) {
result = 0;
} else {
end = base + readSize;
u32 end = base + readSize;
if ((s32)end < 0 || end > fileSize) {
result = 0;
} else {
@@ -777,11 +772,9 @@ static inline s32 readCardComment(s32 slot, s32 fileNo, CARDDir* dir, CARDFileIn
}
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;
u32 transferSize;
s32 iconAddressOffset = iconAddress - (iconAddress & 0xFFFFFE00);
switch (format) {
@@ -819,17 +812,15 @@ static inline s32 loadCardIconImages(s32 slot, s32 fileNo, CARDDir* dir, CARDFil
}
}
s32 iconImageSize;
s32 paletteSize;
s32 icon;
BOOL hasTlut;
s32 iconCount;
s32 shift;
BOOL hasTlut;
s32 iconImageSize;
s32 icon;
s32 iconCount;
shift = 0;
iconCount = 0;
hasTlut = FALSE;
iconImageSize = 0;
iconCount = 0;
sThread->icons[slot][fileNo].unk_0x02 = 0;
sThread->icons[slot][fileNo].anmMax = 0;
sThread->icons[slot][fileNo].anmFrameBits = dir->iconSpeed;
@@ -837,7 +828,7 @@ static inline s32 loadCardIconImages(s32 slot, s32 fileNo, CARDDir* dir, CARDFil
for (icon = 0; icon < CARD_ICON_MAX; ++icon) {
s32 iconSpeed = (dir->iconSpeed >> shift) & CARD_STAT_SPEED_MASK;
if (iconSpeed != 0) {
sThread->icons[slot][fileNo].anmMax += iconSpeed << 2;
sThread->icons[slot][fileNo].anmMax = sThread->icons[slot][fileNo].anmMax + (iconSpeed << 2);
} else {
sThread->icons[slot][fileNo].unk_0x07 =
(u8)(((dir->iconSpeed >> ((iconCount - 1) * 2)) << 2) & 0xC);
@@ -852,9 +843,12 @@ animationDone:
sThread->icons[slot][fileNo].unk_0x01 = 0;
iconImageSize = 0;
} else {
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;
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;
switch (iconFormat) {
case CARD_STAT_ICON_C8:
paletteSize = 0x400;
@@ -874,8 +868,6 @@ animationDone:
default:
break;
}
u32* iconOffsets = &sThread->icons[slot][fileNo].iconOffset[0];
s32 nextIcon = iconCount + 1;
if (iconCount < 7) {
sThread->icons[slot][fileNo].iconOffset[(u32)(iconCount + 1)] =
paletteSize + sThread->icons[slot][fileNo].iconOffset[iconCount];
@@ -891,6 +883,8 @@ animationDone:
sThread->icons[slot][fileNo].iconOffset[iconCount];
break;
}
++iconCount;
shift += 2;
}
if (hasTlut) {
iconImageSize += 0x200;
@@ -900,10 +894,8 @@ animationDone:
sThread->icons[slot][fileNo].anmDelta = 1;
}
imageSize = bannerImageSize + iconImageSize;
transferSize = (imageSize + iconAddressOffset + 0x1FF) & 0xFFFFFE00;
return readCardImages(slot, fileNo, dir, fileInfo, iconAddress & 0xFFFFFE00, iconAddressOffset,
imageSize, transferSize);
bannerImageSize + iconImageSize);
}
extern "C" s32 loadCardFileIcons(s32 slot, s32 fileNo, CARDDir* dir) {

View File

@@ -262,10 +262,6 @@ static char s_manufacturer[] = "MELCO";
static s32 s_operationState = -1;
static const u8 s_messageId[8] = { 9, 8, 0, 0, 0, 0, 0, 0 };
static u8 s_responseTypeByState[8] = { 9, 8, 0, 0, 0, 0, 0, 0 };
typedef struct AOSSWaitDefaults {
u16 connection;
u16 response;
} AOSSWaitDefaults;
static const u16 s_defaultOptions[4] = { 0xffff, 0xffff, 0, 0 };
static void* s_responseBuffer;
@@ -273,7 +269,7 @@ static s32 s_socketStarted;
static u32 s_errorCode;
static u32 s_connectionState;
static u8 s_accessPointName[8];
static u32* s_accessPointConfig;
static int* s_accessPointConfig;
static void* s_accessPointList;
extern int AOSSi_cancel_flag;
@@ -390,17 +386,9 @@ cleanup_done:
}
static inline void* AOSSCopyManufacturer(AOSSNetworkSettings* settings) {
settings->manufacturerLength = strlen(s_manufacturer);
if (settings->manufacturerLength > 0xd) {
return NULL;
}
return memcpy(settings->manufacturer, s_manufacturer, settings->manufacturerLength);
}
int AOSS_Init_old(AOSSInitInput* input)
{
s16 initialWait;
short waitAttempt;
AOSSReceiveBuffer* packetBuffer;
AOSSPacketHeader* packetWords;
u32 initialSleep;
@@ -408,7 +396,7 @@ int AOSS_Init_old(AOSSInitInput* input)
u32 resultCode;
u32 flags;
int state;
int protocolState;
int timeoutMilliseconds;
u32 retryWait;
u16 retryDelay;
u32 delayStep;
@@ -417,34 +405,35 @@ int AOSS_Init_old(AOSSInitInput* input)
int requestResult;
size_t manufacturerLength;
int timeoutSeconds;
int timeoutMilliseconds;
int protocolState;
int protocolResult;
OSTime timeoutTicks;
int initializationResult;
int socketOptionResult;
u8 requestMessageType;
u8 replyAddressLength;
short attemptCount;
u16 remainingWait;
short waitAttempt;
s16 initialWait;
u16 defaultConnection;
u16 defaultResponse;
union {
struct { s16 connection; s16 response; } limits;
AOSSWaitDefaults defaults;
struct { u16 connection; u16 response; } defaults;
} waitIntervals;
AOSSWaitSettings waitSettings;
int receivedPackets;
u8 failureStatus;
AOSSNetworkSettings settings;
AOSSRequestRecords requestRecords;
AOSSSocketAddress receivedAddress;
struct { int seconds; int microseconds; } pollTime;
__declspec(align(32)) AOSSSocketAddress socketAddress;
u8 messageIdentity[8];
AOSSSocketAddress replyAddress;
u8 messageIdentity[8];
__declspec(align(32)) AOSSSocketAddress socketAddress;
struct { int seconds; int microseconds; } pollTime;
u32 networkAddresses[5];
AOSSPollDescriptor pollArguments[2];
waitIntervals.defaults = *(const AOSSWaitDefaults*)s_defaultOptions;
defaultConnection = s_defaultOptions[0];
defaultResponse = s_defaultOptions[1];
waitIntervals.defaults.connection = defaultConnection;
waitIntervals.defaults.response = defaultResponse;
waitSettings.value = 0;
receivedPackets = 0;
protocolState = 0;
@@ -485,7 +474,7 @@ int AOSS_Init_old(AOSSInitInput* input)
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -509,7 +498,7 @@ int AOSS_Init_old(AOSSInitInput* input)
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -522,7 +511,7 @@ int AOSS_Init_old(AOSSInitInput* input)
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -536,7 +525,7 @@ int AOSS_Init_old(AOSSInitInput* input)
input->status = 2;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -550,7 +539,7 @@ int AOSS_Init_old(AOSSInitInput* input)
input->status = 1;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -565,7 +554,7 @@ int AOSS_Init_old(AOSSInitInput* input)
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -601,7 +590,10 @@ int AOSS_Init_old(AOSSInitInput* input)
settings.networkNameLength = strlen("ESSID-AOSS");
memcpy(settings.networkName,"ESSID-AOSS",settings.networkNameLength);
settings.useManufacturer = 1;
AOSSCopyManufacturer(&settings);
settings.manufacturerLength = strlen(s_manufacturer);
if (settings.manufacturerLength <= 0xd) {
memcpy(settings.manufacturer,s_manufacturer,settings.manufacturerLength);
}
initializationResult = AOSSi_SetNCDIPAddr(0xc0a80b65,0xffffff00,0xc0a80b01,0,0);
state = initializationResult;
if (state != 0) {
@@ -609,7 +601,7 @@ int AOSS_Init_old(AOSSInitInput* input)
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -631,12 +623,12 @@ int AOSS_Init_old(AOSSInitInput* input)
resultCode = 0xffffffff;
goto finish_initialization;
}
s_accessPointConfig = (u32 *)AOSSi_Alloc(0x58);
if (s_accessPointConfig == 0) {
s_accessPointConfig = (int *)AOSSi_Alloc(0x58);
if ((int)s_accessPointConfig == 0) {
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -656,7 +648,7 @@ int AOSS_Init_old(AOSSInitInput* input)
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -671,7 +663,7 @@ wait_for_initial_link:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -680,14 +672,14 @@ wait_for_initial_link:
resultCode = 0xffffffff;
goto finish_initialization;
}
if ((state == 0) && (*s_accessPointConfig == 1)) goto handle_initial_link;
if ((state == 0) && (*s_accessPointConfig == 1u)) goto handle_initial_link;
remainingWait = (u16)waitIntervals.limits.response;
for (; remainingWait != 0; remainingWait = (u16)(remainingWait - nextSleep)) {
if (AOSSi_cancel_flag == 1) {
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -704,7 +696,7 @@ wait_for_initial_link:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -721,7 +713,7 @@ handle_initial_link:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -732,7 +724,7 @@ handle_initial_link:
else {
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -740,14 +732,11 @@ handle_initial_link:
}
{
int recordIndex;
int sequence;
u16* transactionId;
for (recordIndex = 0; recordIndex < 3; recordIndex++) {
memcpy(requestRecords.records[recordIndex].address, input->optionData, 6);
sequence = rand();
transactionId = &requestRecords.records[recordIndex].transactionId;
*transactionId = sequence;
*transactionId = SOHtoNs(*transactionId);
requestRecords.records[recordIndex].transactionId = rand();
requestRecords.records[recordIndex].transactionId =
SOHtoNs(requestRecords.records[recordIndex].transactionId);
}
}
s_socket = SOSocket(2,2,0);
@@ -755,7 +744,7 @@ handle_initial_link:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -763,12 +752,12 @@ handle_initial_link:
}
resultCode = 0xffffffff;
}
else if (socketOptionResult < 0) {
else if (initializationResult < 0) {
s_errorCode = 0xb;
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -797,8 +786,6 @@ handle_initial_link:
goto finish_initialization;
}
{
requestMessageType = 0x11;
replyAddressLength = sizeof(replyAddress);
attemptCount = waitSettings.halfwords.high;
settings.gatewayAddress = 0xc0a80b65;
settings.ipAddress = 0xc0a80b01;
@@ -827,7 +814,7 @@ request_socket_cleanup_complete:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -850,7 +837,7 @@ request_socket_cleanup_complete:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -860,12 +847,12 @@ request_socket_cleanup_complete:
goto finish_initialization;
}
s_runtime.active = '\x01';
s_accessPointConfig = (u32 *)AOSSi_Alloc(0x58);
if (s_accessPointConfig == 0) {
s_accessPointConfig = (int *)AOSSi_Alloc(0x58);
if (s_accessPointConfig == (int *)0x0) {
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -882,7 +869,7 @@ request_socket_cleanup_complete:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -891,14 +878,14 @@ request_socket_cleanup_complete:
resultCode = 0xffffffff;
goto finish_initialization;
}
if ((requestResult == 0) && (*s_accessPointConfig == 1)) break;
if ((requestResult == 0) && ((u32)*s_accessPointConfig == 1u)) break;
remainingWait = waitIntervals.limits.response;
for (; remainingWait != 0; remainingWait -= initialSleep) {
if (AOSSi_cancel_flag == 1) {
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -915,7 +902,7 @@ request_socket_cleanup_complete:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -930,7 +917,7 @@ request_socket_cleanup_complete:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -949,7 +936,7 @@ request_socket_cleanup_complete:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -997,7 +984,7 @@ request_socket_cleanup_complete:
packetWords->finalLength = SOHtoNs(0);
packetWords->finalSequence = SOHtoNs(0);
packetWords->reserved = 0;
packetWords->messageType = requestMessageType;
packetWords->messageType = 0x11;
memcpy(packetWords->messageIdentity,messageIdentity,8);
memset(&replyAddress,0,8);
replyAddress.family = 2;
@@ -1006,7 +993,7 @@ request_socket_cleanup_complete:
if ((s8)s_runtime.active == 0) {
replyAddress.address = 0xffffffff;
}
replyAddress.length = replyAddressLength;
replyAddress.length = 8;
SOSendTo(requestSocket,packetWords,0x18,0,&replyAddress);
sendResult = 0;
@@ -1020,7 +1007,7 @@ request_socket_cleanup_complete:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1062,7 +1049,7 @@ request_socket_cleanup_complete:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1079,7 +1066,7 @@ request_socket_cleanup_complete:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1093,7 +1080,7 @@ request_socket_cleanup_complete:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1105,6 +1092,7 @@ request_socket_cleanup_complete:
goto finish_initialization;
process_received_packet:
{
AOSSSocketAddress receivedAddress;
u8 addressLength = sizeof(receivedAddress);
receivedAddress.length = addressLength;
receivedLength = SORecvFrom(s_socket,&packetBuffer->message,0x5dc,0,&receivedAddress);
@@ -1140,7 +1128,7 @@ wait_for_packet:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1162,7 +1150,7 @@ wait_for_packet:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1175,7 +1163,7 @@ wait_for_packet:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1189,7 +1177,7 @@ wait_for_packet:
input->status = 2;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1202,7 +1190,7 @@ wait_for_packet:
input->status = 1;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1211,12 +1199,12 @@ wait_for_packet:
resultCode = 0xffffffff;
goto finish_initialization;
}
s_accessPointConfig = (u32 *)AOSSi_Alloc(0x58);
if (s_accessPointConfig == 0) {
s_accessPointConfig = (int *)AOSSi_Alloc(0x58);
if ((int)s_accessPointConfig == 0) {
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1233,7 +1221,7 @@ wait_for_packet:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1242,14 +1230,14 @@ wait_for_packet:
resultCode = 0xffffffff;
goto finish_initialization;
}
if ((state == 0) && (*s_accessPointConfig == 1)) break;
if ((state == 0) && ((u32)*s_accessPointConfig == 1u)) break;
remainingWait = waitIntervals.limits.response;
for (; remainingWait != 0; remainingWait -= initialSleep) {
if (AOSSi_cancel_flag == 1) {
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1266,7 +1254,7 @@ wait_for_packet:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1278,7 +1266,7 @@ wait_for_packet:
}
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1289,7 +1277,7 @@ wait_for_packet:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1308,7 +1296,7 @@ wait_for_packet:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1339,7 +1327,7 @@ advance_protocol_state:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1356,7 +1344,7 @@ advance_protocol_state:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1386,7 +1374,7 @@ protocol_socket_cleanup_complete:
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1407,7 +1395,7 @@ protocol_socket_cleanup_complete:
input->status = failureStatus;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
@@ -1422,7 +1410,7 @@ protocol_socket_cleanup_complete:
input->status = 6;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);

View File

@@ -1,285 +0,0 @@
# 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

@@ -1,222 +0,0 @@
# 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

@@ -1,109 +0,0 @@
# 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

@@ -1,108 +0,0 @@
# 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

@@ -222,117 +222,3 @@ The final diff retains three exact command functions and the palette destination
correction and shared loop continuation. All remaining functions have at least
three new distinct attempts.
Shared headers and configure.py are unchanged. All data sections remain exact.
## w1011/struct2 probes
- cardThreadMain (301v301): pure reg-perms + one merge-order tie — base `mr r4,r19; rlwimi r4,r25,8` vs mine `rlwimi r23,r29,8; mr r4,r23`. Same count, ordering only.
- loadCardFileIcons (508v512, -4): base emits per-path `li r?,0; stb` zero-init pairs (dead zero-webs on each switch-case path — `bannerEnable=0` etc. re-materialize the zero instead of sharing), plus split `addis/addi` addr materialization + `lbz -1(r); stb 0(r)` adjacent-field copy where mine fuses. Structural decode incomplete.
- runCardMoveOrCopy (608v608?): not yet diffed.
## w1011/struct2 wave 2 (loadCardFileIcons 508->511/512)
- WIN: `s32 icon = 0` decl-init materializes a missing zero-web (+1).
- WIN: `u32* iconOffsets = &...iconOffset[0]` + `s32 nextIcon = iconCount + 1` → base's `slwi r,2; lwzx`/`stwx` indexed addressing (+2). Direct member index `iconOffset[iconCount+1]` folds to immediate-offset lwz/stw.
- Tried/reverted: `(u16)` index cast (513), `iconFmt[iconCount]=iconFmt[iconCount-1]` direct (510), u16* iconOffsets.
- Residual -1 + ~92 reg/order diffs: base materializes `&iconFmt[iconCount]` in one reg with `lbz -1(r); stb 0(r)` where every source form folds to `lbz -0x6fb5/stb -0x6fb4` field offsets (remat-vs-pin family).
## loadCardFileIcons residual -1 insn + coloring
- runCardMoveOrCopy (608v608): normalized-identical, pure coloring tie.
- loadCardFileIcons -1 = pinned-result phi: mine emits `mr r24,r3` (callee-pinned result web) after CARDGetSectorSize, base keeps result in r3-arrival and remats `li r3,0` in the error path. Same phi-coalescing tie family as attach_mount (pfrest) — no source lever found.
## w1011/struct2 wave-2 — web-birth decode (loadCardFileIcons SOLVED -1)
- `s32 iconCount; ... iconCount = 0;` — UNINIT DECL + SEPARATE ASSIGN
splits the zero web's birth so MWCC rematerializes a second `li 0` for
the icon-init stores (base's exact remat pattern). Applied in BOTH
updateCardIconAnimation and loadCardFileIcons: 511 -> 512 insns,
residual now 26 pure callee-renaming diffs (r31/r26 sThread,
r7/r4+r10/r6 record ptrs — coloring family).
NB: `static s32 iconCount` also produced 512 but emits dead object
`iconCount$16368` (forbidden, PR #973) — the lever is web-birth
timing, not storage class. Static variant rejected.
- cardThreadMain sendValidityResponse: `reply.value = command;
reply.fields.valid = valid;` produces base's `mr` + `rlwimi @0xFF00`
byte-insert order (vs `reply.value = valid<<8; fields.command=command`
which folds to `li 0x100 + rlwimi`). Residual 2 lines: in-place
`rlwimi r19` vs base `mr r4,r19; rlwimi r4` — same coalescer
dst-operand wall as the or-chain. `|=` folds to ori; bitfield-order
emits 2 rlwimi + stw.
## w1011/struct2 wave-3 — structural probes (icon-record intermediates)
- `IconState* rec = &sThread->icons[slot][fileNo]` + member accesses:
collapses fn to 408 insns — MWCC pins the pointer, kills the
per-use rematted add chains. The sThread->icons[slot][fileNo]
spelled-out form is load-bearing for the remat structure.
- `IconState (*icons)[CARD_MAX_FILE] = sThread->icons` array pointer:
collapses to 424 for the same reason. Named intermediates can't
reproduce base's pinned-products + remat-adds split.
- The 26 residual diffs are a pure callee-window swap: base pins the
icon-record PRODUCTS (slot*0x1FC0->r29, fileNo<<6->r30, masked addr
->r31) and params->r24-r26; mine pins params high. Chaitin color
ordering — documented tie.
- cardThreadMain: `OSMessage msg` arg-coalescing local, packed
`command | (valid<<8)` single expr (folds, 300), mask+or
`(v & ~0xFF00)|(valid<<8)` (rlwinm+ori split) — the mr+rlwimi
copy-vs-inplace residual (2 lines) is the coalescer dst-operand wall.
## w1011/struct2 wave-4 — mr+rlwimi mechanism PROVEN, no free source form
- `sThread->lastCommand = command;` after sendValidityResponse makes
command's web survive the pack → emits base's EXACT `mr r4,r19;
rlwimi r4,r25,8` (copy+insert, not in-place). Mechanism confirmed:
the rlwimi dst binds to a surviving operand's copy — but the store
costs +3 insns and base has no such store. Verified base's r19 dies
at the same point (reborn at 0xd58 case-0 reassign).
- `command & 0xFF` extract: folds (command provably masked) → in-place.
- `command | (valid<<8)`: single-expr fold to li/ori (300, -1).
- `(reply.value & ~0xFF00)|(valid<<8)`: rlwinm+ori split.
- Residual 2 lines = coalescer dst-operand choice with no source
lever that preserves insn count.
## w1011/struct2 wave-5 (post-rebase 10146c1b) — aoss/chansvm levers exhausted
- mr-cross-block mechanism (o2-aoss): copy survives iff its uses are in
other blocks. Verified base CFG: send block (0xd30) reached only from
case-10; `command` (r19) dies there, reborn in case-0 block at 0xd58.
No other case reads command → no legitimate later-block use exists;
all survival variants add insns. ~28 cumulative forms; wall stands.
- declsearch.py: 120 decl-orderings of cardThreadMain's decl block —
no improvement ((2,3) floor); operand-dst selection unaffected by
vreg numbering.
- New levers tried: __rlwinm identity (folds), int-union-member,
pointer-param pack helper, packValidity return-value, u8 params,
separate `response` temp, second reply.value use (+stw). All fold.
## cardThreadMain sendValidityResponse pack (wave-6)
Base: `mr r4,r19; rlwimi r4,r25,8,0x10,0x17` = `reply.value = command`
(copy into reply's own web, homed in arg-reg r4) then `reply.fields.valid =
valid` (bitfield-insert sourcing validState's own `li r25,1` web).
Ours: `rlwimi r19,r29,8,0x10,0x17; mr r4,r19` — MWCC coalesced reply.value
onto command's web (in-place insert on r19, sourced shared-1 r29) then copies
out. 2-line residual, same dst-operand/home-choice family as the or-chain
wall. Tried: `OSMessage reply = command | (valid<<8)` (folds to `ori` —
plain `|` canonicalizes, only bitfield-write emits rlwimi), fields-only
writes (3-insert chain), fn-scope reply union (still coalesces), comma/select
forms. `sThread->lastCommand = command` post-send DOES force `mr`+`rlwimi`
(making command's web survive) but costs +3 insns — mechanism proven, no
free source lever. Extra base `li r22,0` at 0x1040 = another remat-position
diff, same family.
## w1011/struct2 wave-7 — optimization_level pragma sweep (negative)
Per-fn `#pragma push` + `#pragma optimization_level N` + `#pragma pop`
(g-idct lever: Lumi was O3 inside an O4 unit) swept on cardThreadMain:
O1/O2/O3 all emit the identical 302-insn object — `rlwimi r19,r29` in-place
+ `mr r4,r19`. The coalescer's dst-operand fold is opt-level-invariant;
orig was built at the same -O4,p as ours. Mixed-opt is NOT the explanation
for the 2-line residual.
- wave-8 (opt_propagation): `#pragma opt_propagation off` scoped to
sendValidityResponse emitted `rlwimi r19,r29; mr` (same shape, operand
web shifted); scoped to cardThreadMain `rlwimi r19,r25; mr` (valid-web
operand now matches base) — but the union web still ALIASES to command's
dying web, so the insert stays in-place and the mr lands after. The
pragma does not touch union-storage aliasing (not copy-prop).
- Plain-u32 probe (`u32 reply = command; reply |= valid << 8`): folds to
`ori`, 300v301 — worse. Union form remains best (301v301, 2-line wall).

View File

@@ -1,61 +0,0 @@
# 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

@@ -1,71 +0,0 @@
# 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).

View File

@@ -1,59 +0,0 @@
# 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

@@ -1,8 +0,0 @@
## w1011/struct2 wave-2 verification
- is_master_boot_sector residual re-decoded: both objects emit the SAME
add tree ((b0 + b2<<16) + (b1<<8 + b3<<24)) for read_partition_u32 —
the + macro form is correct. All 7 residual lines are the load/shift
INTERLEAVE order (base loads b3,b2,b0 then shifts; mine b3,b2,b1).
Pure scheduler tie — scheduling pragmas previously probed, no lever.

View File

@@ -0,0 +1,267 @@
# settingstruct leaf — attempt log
Scope: src/scene/setting/AOSS.c, src/scene/setting/AOSSLink.c, src/scene/address/iplAddressEdit.cpp
Base: origin/main@9321a926. Lane-clear vs open PRs (only #1156 touches ATERM.c — dropped per orchestrator).
Tools: ~/tools/fndiff.py (capstone normalized diff, register-renaming by first-appearance order; `--raw` = literal).
## Baseline
- iplAddressEdit 99.55 — create 97.56 (3280B), get_friendinfo 88.04, update_friendinfo 99.42
- AOSSLink 99.01 — AOSSi_WLANGetBSSList 98.48 (908B), AOSSi_WLANConnect 98.71 (620B)
- AOSS 98.42 — AOSS_Init_old 96.19 (6336B), AOSSApplyAuthOptions 98.77 (456B), AOSSXorBufferWithKey 98.61
- iplAOSSThread 100, AOSSData 100
## get_friendinfo (88.04, 584B) — text-ptr early-pin wall
Orig materializes `addi r29,r28,0x2b4` (mName) and later `addi r29,r28,0x2cc` (mDisplayText)
EARLY — inside the FindPaneByName marshal window of each `set_textbox` call — pinning the
text-ptr web in callee reg r29 across `bctrl`. Mine remats `addi r5` at the marshal point.
Same pattern appears in `create` (r25 pin before `stw` field store + FindPaneByName chain).
FAILED variants (5+, all documented): `const wchar_t* name` local (MWCC forwards
single-use locals to marshal), `pane`+`name` locals, pane-only local, reused `text` local
with statement-level assignment, text decl before setName. MWCC remats cheap `this+const`
expressions regardless of def site; orig's early materialization requires the web's DAG
birth to precede the pane-chain eval — no source lever found.
## update_friendinfo (99.42) — 2-insn marshal-order swap
38=38 insns; only diff: orig marshals `addi r4,r30,0x2b4` (src) before `addi r3,r31,8`
(dst) in the wcsncpy marshal; mine dst then src. Named-local and early-birth variants
failed — MWCC emits marshal webs in its own ready order.
## create (97.56, 3280B) — 2 missing insns + pin/rotation
808 vs 810 insns. Marshal shape identical L-to-R (`mr r3; addi r4; addi r5; li r6; li r7; bl`).
Residual: same text-ptr pin (addi r25,r29,0x2b4 before `stw r0,0x14(r27)` and inside
marshal windows) + wholesale callee-window rotation (r30↔r31 const-table vs boardFile
pin, deep r25-r31 webs).
## AOSSi_WLANGetBSSList (98.48, 908B) — sth placement + IV rotation
227=227 insns. Two-loop IV web-home rotation (r26/r20 swap) + one `sth r5,0x40(r1)`
placement bound to the `lhz` operand web home. Retry webs all init'd (no uninit signature).
## AOSSi_WLANConnect (98.71, 620B) — single li-placement
155=155 insns. Only diff: `li r5,0x7c4` hoisted one slot before `mr r3,r27` in the memset
marshal (const-li vs move emission order). `u32 ifConfigSize` named local REGRESSED (4 diffs);
reverted. r28/r31 webs verified init'd — no uninit-read signature.
## AOSSApplyAuthOptions (98.77, 456B) — arg-save order + rotation
Two arg-web home swaps (r5-arg→r24 vs orig arg1→r27 first — emission order of `mr` saves
at fn entry) + cursor/literal-base swap (r29↔r31). Also `s_responseTypeByState` symbol
shows as orig `lbl_81697210` — naming artifact, reloc target identical.
## AOSSXorBufferWithKey (98.61) — XOR-loop pointer web swap
147=147 insns. Loop webs swapped: mine `add r4,r28,r3`/`add r5,r26,r3` vs orig r26/r28;
`xor r6` vs `xor r0` result reg. Decl-order swap of `temporaryHalf`/`packetHalf`
REGRESSED (moved temp-pointer web homes); reverted.
## AOSS_Init_old (96.19, 6336B) — deep wall
1581 vs 1584 insns (~3 short), 1213 normalized diffs — mass web rotation across the whole
fn (different callee layout → different numbering). Per-site: prologue `sth r4,0x28`/li
placement, a free-check block ordering (`cmpwi;beq;bl Free;stw` on two globals), one
`bne` vs `lwz+cmplwi+beq` shape. No source lever found; prior wave documented the same.
## uninit-read lever (PR #1270) — checked, N/A
Verified orig stores every compared callee reg before use on all paths: WLANConnect
`li r28,0`/`li r28,-1` stores before each `cmpwi r28,0`; GetBSSList retry webs init'd;
create/AddressEdit inits all present. No fn emits an extra init orig lacks or reaches a
compare with a path-unset reg.
## ppc_iro_level results (post-#1276 lever)
- **get_friendinfo → 100%**: `#pragma push` + `ppc_iro_level 0` + named text locals
(`const wchar_t* name = mString.mName;`, `text = mString.mDisplayText;`). The named
local's def site births the text-ptr web early; IRO-0 blocks the remat that previously
folded it to the marshal — orig's `addi r29,r28,0x2b4` early-pin reproduces
(`_savegpr_28`/`_restgpr_28` match; residual = bare `bl` reloc offsets). Neither the
local alone (forwarded) nor IRO-0 alone (still remat) sufficed — both needed.
- **create 97.56 → 98.73** with `ppc_iro_level 1` (friendText locals already present).
Levels 0 and 1 produce identical output here. Residual = callee-window rotation.
- FAILED: AOSSi_WLANConnect (identical at 1/2, explodes to 219 at 0 — marshal swap
unaffected), AOSSi_WLANGetBSSList (46 diffs at 0/1 = baseline), AOSSApplyAuthOptions
(IRO-1 drops fuzzy 98.77→97.94 despite fewer normalized diffs — reverted),
AOSSXorBufferWithKey (61→154 at IRO — reverted), AOSS_Init_old (1213 diffs at 0/1 =
baseline — pragma no effect), update_friendinfo (IRO regresses 2→11 — reverted).
## Status
**get_friendinfo is a NEW 100% fn** — owner PR bar (≥1 new 100% + zero regressions) met
for a source-only PR. create improved to 98.73. Remaining fns stay at documented ties;
units stay NonMatching.
## Post-#1277 rebase (origin/main@c723136f)
Owner merged get_friendinfo+update_friendinfo via #1277 (IRO-1 + named locals — same
decode). Branch now keeps only create's `ppc_iro_level 1` (98.73) + this log.
## libs/RevoEX/src/net/aes.c (added to leaf)
- AESiEncryptBlock 65.81 (158=158 insns): whole-body table-load issue-order interleave.
Orig hoists all 16 byte-extract rlwinm webs to the loop top then interleaves
lwzx/rotlwi/xor; next-round key loads land mid-body. TRIED: IRO-0 (195 diffs, worse
than 183 baseline), IRO-1 (same 195), `nextState[4]` array (183 = scalarized
identical), `state[4]`+`nextState[4]` arrays (180), fused key-XOR into nextState
assignments (192, savegpr_20). All reverted — issue-order wall, no lever.
- AESiDecryptBlock 78.96 (246=246 insns): IRO-0/IRO-1 both drop fuzzy to ~70 (+7 insns,
266 normalized diffs vs 290 baseline — normalized counts mislead again). Reverted.
Allhands exhaustive-decl-order docs predate IRO but the pragma is verified harmful
here — remaining residual is the same table-load scheduler family.
## MWCC scheduling-pragmas sweep (post-#1296 orchestrator hint)
Target: AESiEncryptBlock/DecryptBlock table-load interleave (orig hoists ~11 rlwinm
extracts before first lwzx; ours issues loads after ~4).
Per-fn pragma results (normalized diffs -> objdiff fuzzy):
- `#pragma scheduling off` EncryptBlock 183->178 norm, fuzzy 65.81->36.20 (revert)
- `#pragma scheduling once` EncryptBlock 183->179 norm, fuzzy ->40.54 (revert)
- `#pragma scheduling twice` EncryptBlock 183 (no change), DecryptBlock 290 (no change)
- `#pragma scheduling 600` rejected by MWCC 3.0a5.2 (CPU names only)
- `#pragma scheduling 750`/`gekko` 183 (=default), `603`/`generic` 237 (worse)
- `#pragma schedule_twice on`/`scheduling on`/`twice` 183 (no-ops)
- `-opt schedule_twice` cflag: not a valid -opt for 3.0a5.2 (opts: prop,strength,dead,peep,schedule,display|dump)
- `-schedule twice|twice,750|=twice` cflag: all rejected by 3.0a5.2 arg parser
- `-opt schedule` cflag: 183 (no change)
Source restructures (all reverted, fuzzy-measured):
- 16 named table-value temps (t0..t15): 149 norm but fuzzy 65.81->58.99
- named index vars i0..i15 + 16 loads: 149 norm (index vars forwarded/CSE'd), fuzzy also down
- column-order extraction (all >>24, then >>16, >>8, &255): 228 norm (worse)
Cross-check on AOSS fns:
- AOSSi_WLANConnect `scheduling twice`: norm 28->2 (li r5,0x7c4/mr r3,r27 pair only)
BUT fuzzy unchanged 98.71 - remaining residual is the same marshal-order operand tie.
- AOSSi_WLANGetBSSList `once` 46->43 norm, fuzzy 98.48->93.53 (harmful); `twice` no-op; `off` 69
- AOSSXorBufferWithKey `twice` 61 (no-op); `off` 142 (worse)
- AOSS_Init_old `twice` 1263 (no-op)
Conclusion: the AES interleave is NOT a scheduling-pragma wall - MWCC's default
gekko scheduler already matches orig's pass config; the residual is allocator
web-lifetime/ready-set structure with no known source lever. `scheduling twice`
is a real lever ONLY for instruction-issue-order residuals (marshal pairs), and
even there fixes ordering without moving objdiff fuzzy.
## Round 2: structural decode attempts on AESiEncryptBlock (orchestrator hint)
Baseline macro form remains best (183 norm, fuzzy 65.81). All reverted:
- key as `const u32 (*key)[4]` pointer-to-row (+key++): identical 183
- state[4]/nextState[4] with strided (i+k)&3 indices + for-loops: 230
- fused `nextStateN = ENCRYPT(...) ^ key[N]` (states assigned at end): 231
- state copied to t0..t3 temps at loop top: 183 (CSE folds)
- two-phase combines (all rotated-halves then all tail-halves): 231
- xor tree rebalance `(A^B)^(C^D)` and raw-term-first reorder: 175 norm, fuzzy 60.0/60.3
- TU cflags -O4,s: 263 norm (worse); -O3: 177 norm, fuzzy 60.3/70.2 (worse)
- prologue emits `srwi` extract before the input xors complete in BOTH objects;
158=158 insns, all residuals are regname + issue-order inside an identical op set
- AOSSi_WLANConnect residual is 2 diffs (mr r3,r27 / li r5,0x7c4 marshal order);
pointer-local decl moved adjacent to memset: no change (baseline was already 2);
direct-global &AOSSi_NcdIfConfig form: 163 (the local web is required)
Conclusion: the AES loop-body interleave is an allocator ready-set artifact;
the register-lifetime shape that produces orig's ordering is not expressible
through these source levers. No scheduling/-O lever improves fuzzy.
## Round 3: fn-local static lever (swarm #1299 hint) + pragma combos
Refuted for this leaf:
- Op-multiset check: EncryptBlock and DecryptBlock emit IDENTICAL opcode
histograms vs orig (158=158, same op counts) — residual is pure
issue-order + regname. Any memory-backed intermediate (static buffer)
ADDS lwz/stw ops orig provably lacks.
- No SDA/r13/r2-relative accesses in orig AESi*Block, WLANConnect,
WLANGetBSSList, AOSS_Init_old — globals go through lis+addi.
- `static u32 sbuf[4]/nbuf[4]` state buffers: 305 norm diffs (lwz/stw
traffic), reverted.
- Pragma combos: iro1+sched-twice 195, iro0+sched-twice 195, iro2+sched-twice
177 (all worse than 183 baseline or no better), iro1 alone 195.
- mw_version lever reported dead by orchestrator (swept, identical/worse).
Standing wall: AESiEncryptBlock/DecryptBlock = allocator ready-set ordering
inside an identical instruction multiset. No scheduling/IRO/O-level/cflag/
static/source-structure lever changes it in the right direction.
AOSSi_WLANConnect: 2-insn marshal-order pair (mr r3,r27 vs li r5,0x7c4);
all decl/static/source forms tried.
## Round 4: const-source + scoped-table hint (#1304) + Init_old op-diff decode
Post-#1296 rebase state: AOSSXorBufferWithKey landed by swarm (100). Remaining
in leaf: AOSS_Init_old 96.62, AOSSi_WLANGetBSSList 98.48,
AOSSi_WLANConnect 98.71, AESi*Block (stays as-is per orchestrator).
AOSS_Init_old op-histogram diffs (M=mine vs orig): add +1, b -1, bgt +1,
ble -1, bne -3, cmplw +2, cmplwi -2, li -1, mr +1 — real structural gap:
- Mine emits `cmplw r3,r27` at the two AOSSi_Alloc NULL checks (0xc94/0x154c)
where orig emits `cmpwi r3,0` — the classic pinned-zero wall: MWCC shared
one zero web in r27 across the fn's many li 0/cmpwi sites; orig
rematerializes. All 4 pragma variants (iro 0/1/2, iro1+sched-twice) no-op.
- Orig keeps 3 more `bne` and 2 more `cmplwi r0,1` (0xd60/0x1620 = likely
AOSSi_cancel_flag==1 sites where mine fused differently).
Scoped-retry-counter attempt (move unlockRetries/cleanupRetries/scanRetries
to uninit decls + assign before each loop — births webs later per the scoped-
locals hint): GetBSSList 46->167 diffs, reverted.
WLANConnect memset(&AOSSi_NcdIfConfig) direct-global + memsetTarget alias
forms: both still forward to the r27 web, 2 diffs unchanged.
const-table analysis: ipAddress/etc are non-const .data (written by
AOSS_SetStaticIpConfig) — can't be const; supportedRates is .data non-const
matching orig's sections (no .rodata in orig .o) — const would break data.
## Round 5: Init_old u32-deref decode (orchestrator's missing-checks lead)
Orchestrator hypothesized missing cancel_flag reads — refuted: 14 lwz
AOSSi_cancel_flag sites in BOTH objects. Orig's extra cmplwi r0,1 at
0xd60/0x1620 are `*s_accessPointConfig == 1` compares: MWCC emits cmplwi
(unsigned) vs my cmpwi (signed) keyed off the COMPARE OPERAND's type —
s_accessPointConfig stays `int*` (file is full of (int*)0x0 literal casts)
but the deref needs an unsigned compare: `(u32)*s_accessPointConfig == 1u`
at the two wait-loop break sites (lines 881/1233) matching line 675's
existing pattern. All 3 sites now cmplwi r0,1; cmplwi count 17=17.
Init_old 96.62 -> 96.69; fn now 1581 vs orig 1584 insns.
Remaining real gaps: pinned-zero cmplw r3,r27 at both AOSSi_Alloc NULL
checks vs orig cmpwi r3,0 (all pragma forms no-op); bgt-vs-ble+b layout at
the manufacturerLength<=0xd memcpy guard (goto form folds back to bgt —
orig's 2-branch layout implies a merge/region structure source can't
reproduce); net -3 insns somewhere in mass-rotation noise.
## Round 6: #1311 levers (declsearch, inline-helper, marshal forms) post-#1314
Post-rebase scope: GetBSSList matched by swarm #1314; aes Matching #1311
(object rebuilds identical). Remaining: AOSS_Init_old 96.70,
AOSSi_WLANConnect 98.71.
WLANConnect 2-insn marshal swap (li r5,0x7c4 vs mr r3,r27 order) refuted
with ALL new levers: (void*)ipConfig, sizeof(AOSSi_NcdIpConfig), folded
`memset(ipConfig = &...,...)` assignment form, and static-inline
pointer-param helper AOSSi_ClearIpConfig — every form keeps the r27 web and
MWCC emits mr-first. Pure marshal-order tie; declsearch found only the 2
leading decls (no improvement).
Init_old: declsearch.py --lines 391 435 (45-decl block, 100 evals) found a
marginally better order (waitAttempt front, initialWait later): kept,
96.69 -> 96.70. Pinned-zero root located: `li r27,0`@0xb34 — ONE shared
zero web pinned fn-wide (stw/sth stores + addc/adde + 2 cmplw) where orig
pins `input` in r27 (addi r27,r4,0) and remats zero per-site. Orig's
pinned-input vs pinned-zero callee choice is an allocator web-priority
decision; source can't declare which constant webs win a callee reg.
## Round 7: cross-block-use copies (o2-aoss doc), Init_old pinned-zero crack
o2-aoss.attempts.md methodology applied. WLANConnect second-memset marshal:
cross-block-use copy is refuted structurally — the ONLY post-copy use of an
ipConfig alias is NCDSetIpConfig, which sits in the SAME block as the copy
birth (the if-test IS the block terminator) — block-local copy forwarding
(0x596850) kills it. Verified: configMem-as-takeover (all later uses),
configMem-as-parallel-web (NCDSetIpConfig only), configMem = &AOSSi_NcdIpConfig
(second materialization — CSE'd into r27 web), (u8*) typed view, void* view —
all 2 diffs. No other-block use exists in the fn (field writes + call all in
the memset block). Doc's alternatives already covered: struct-wrap gives
right order +1 insn (addi r27,r3,0x160).
Init_old pinned-zero pair cracked for ONE site: `(int)s_accessPointConfig == 0`
at line ~1203 gives orig's `cmpwi r3,0` at 0x154c (the pinned r27-zero web is
not live there). Same cast at line 627 site (0xc94) stays `cmplw r3,r27` —
the r27 web (born 0xb34) is live at that point so MWCC prefers reg-compare;
named `allocCheck` local folds via VN canonicalization. 0xc18 `cmplw r3,r4`
vs `r3,r0` is the u64 bound-check idiom, pure operand-name drift.
Allocator analysis: orig splits input's web (r15 early -> addi r27,r4,0 re-home
at 0xb1c for the 0x14/0x10/0x18 field reads) and remats `li r0,0` at ~25 sites.
Mine keeps input in r15 fn-wide and fuses all zeroes into the r27 web.
The re-home is a backend web-split, not a source copy (copies die in COpt
pre-phase). Remaining levers exhausted: declsearch r2 pending.

View File

@@ -39,19 +39,3 @@ Measured trials:
- static initializer attempt 1: src 0x64 base 0x64 insns 25/25; diffs 0: []
- static initializer attempt 2: src 0x64 base 0x64 insns 25/25; diffs 22: [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]
- static initializer attempt 3: src 0x64 base 0x64 insns 25/25; diffs 0: []
## w1011/struct2 continuation (createAnmPane_)
- WIN: `const PaneToAnimation* p = &scCandidatePaneData.panes[i]` (pointer, not ref) → 215v216→216v216, fuzzy 92.89→98.91. Base reloads `p->pAnims[j]` through the array slot (lwz 0x20(r23)) per use; ref-form folded the element into a pinned reg.
- Regressions reverted: forceAddName moved into loop scope (118 ops), u32 j (86), int i (236), inline p->pAnims[j] at both uses (220), uninit-decl forms.
- Residual ~77 reg-name ops = pure coloring: base homes `p+j*4` slot web in r23, panes-base in r24, zero-web in r26; mine r30/r23/r25. Birth-order levers exhausted.
- `create` (352v352): insn-identical modulo branch targets; only `lfs f0,0(x)` anonymous .rodata ref offset differs (ties to .data granularity: mine names scPaneNameTable/scW_*/scN_* strings, base emits @9934-@9943 anonymous locals + base lacks mine's `__vt__textinput::gui::GUIComponent` weak emission; scCandidatePaneData 1676 vs 1664B).
- `CalcPaneLocate_` (435v435): byte-identical modulo relocs.
- loadCardFileIcons (iplCardSequence): 508v512 (-4): base emits extra `li r?,0; stb` zero-init pairs (per-path dead zero-webs) + separate addis/addi addr materialization where mine fuses; untreated structural gap.
## struct2 wave — structural decode probe
- `const AnimationFile* animation` (pointer) vs `const&` reference: 50->45
diff lines — pointer form closer (matches the p->pAnims[j] slot reload
idiom used for p itself). Committed.
- Hoisted `const AnimationFile* const* anims = p->pAnims` — no change (45).
- Remaining residual = callee-web coloring (same tie family).

View File

@@ -490,77 +490,3 @@ forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
GATE PASS
```
## w1011/struct2 probes (drawCursor/calcCursorPos)
- calcCursorPos (326 insns): already byte-identical modulo branch targets — report fuzzy 91.59 was reloc-scoring, no real residual.
- drawCursor (70v70): eval-order tie. Base completes `opacity = f32(muGlobalAlpha)/255.0f` fsubs+fdivs BEFORE loading GXColor R/G/B bytes; mine hoists the lbz loads above the fdivs. Moving `GXColor color` decl later regressed 68v70 (splits the loads differently). Kept baseline form; documented sched-order tie.
## struct2 wave 3 — extern "C" const architecture decoded
MWCC const-fold vs SDA rule for `extern "C" const` objects:
- Source ref folds to anonymous @NNNN pool object when the DEF (with init) is
VISIBLE at the use. Ref emits named SDA only when use sees extern decl and
def is later (defs at EOF + decls up top) => all value-uses named.
- Generated conversion magics (u32/s32->f32/f64) dedup into same-valued named
objects INCONSISTENTLY (autoScroll signed conv deduped to
scInputFormF32ConvertMagic; init + drawCursor unsigned convs did NOT) —
appears tied to .sdata2 emission order (anon pools emit in fn order; defs
at EOF emit last). Unresolved: how orig got every generated magic named.
- .sdata2 layout = emission order = DEF ORDER when defs precede fns.
Base order: ZeroF,640F,F32ConvertMagic(8B),OneF,HalfF,DegToFIdxF,150F,30F,
50F,10F,52F,TwoF,140F,90F,253F,20F,ColorR/G/B/A u8s,255F,127F,14592F,
[4B pad],F64ConvertMagic(8B),15F,[pad] — copied verbatim to EOF def block.
- ALL inline float literals in the file's fn bodies were swapped to named
refs (150F/30F/50F/10F/52F/140F/90F/253F/20F/15F/640F/255F/127F/14592F/
DegToFIdxF/OneF/HalfF/TwoF/ZeroF + Color*u8). Mass .sdata2 184->124B.
- Out-of-namespace uses (fns defined qualified-style at global scope) need
textinput::inputform:: qualification (~97 sites).
- drawCursor: plain static_cast<f32>(u8/u32) emits the right
lis/lbz/stw/stw/lfd/fsubs seq; residual = magic operand @NNNN vs named +
eval-order (~11 diff lines). Union-pun form (u32[2]+f64, subtract named
magic) gives named operand but fsub+frsp instead of fsubs — WORSE.
- autoScroll: orig used `* scInputFormHalfF` not `/ scInputFormTwoF`.
- textdrawer::Base() header ctor literals (mfVIWidth 640 etc) — named-const
via header gate tried+reverted (orig likely defines ctor in cpp; also
regressed sdata2). ctor anon pair {0,640} + GetTextColor {ffffff00,0}
remain anonymous.
- REMAINING: init @13881 (signed magic dedup didn't fire), ctor pair,
GetTextColor pair, drawCursor operand/scheduling, then 'create'.
Post-rebase states: Base::create(73i) normalized-identical (branch-target
artifacts only). LayoutByNW4R::create(357i) residual = callee-web rotation
(mine r20/r21/r28 vs base r23/r24/r30) + anonymous 0-operand pools; pure
coloring. Unit fuzzy 99.54, data 100.
## create residual wave (w1011 round 2) — 120 -> 88 normalized diffs
- `u16` ButtonAnimations::count field + `u16 count` local lands count in base's r22
home (late allocator pin). u32/int/s32/short all keep the early pin (~150). Mechanism
is likely the u16 narrowing producing a secondary codegen-ordered temp.
- Remaining 1 structural diff: `lhz` vs base `lwz` at the count load — orig's web is
u32-typed (lwz) yet allocator-late. u32-field+u16-local adds a clrlwi (worse).
- declsearch on the 15-local decl block: moving `Info_* selected` up (2nd) and
`void* memory` down (11th) fixed 3 renames; converged after 80 evals.
- Pointer-param `addButtonAnimations` helper (count load as IRO temp): lands r30
(IRO temps number reverse-creation — late inline = LOW temp no. = early pin).
`button->count` bound inside helper reloads per-iter (fIsPtrOp, no LICM hoist).
- bindingName/count direct member uses, comma decl, split-web `count=0;count=...`,
stmt-order swaps on previous/next/selectedIndex: all no-ops or worse.
- Residual ~86 renames: mriManager rows/selected/previous/next expression-temp band
(r4-r8 volatile order) + residual saved-reg permutations — same tie family.
- REVERTED: the u16-field form shrinks csButtonAnimations .data bytes (00 08 vs
00 00 00 08) — unit matched_data 100 -> 27.5. u32 field + u16 local emits
lhz+clrlwi (171). declsearch order alone scored worse under normalized diff
(147 vs 150 baseline). Net: create restored to upstream baseline; the
u16-numbering mechanism is documented but no usable form found — count's web
must be u32-typed AND allocator-late, unproducible so far.
- SOLVED (partial): count as `u16` field in the LOW half of the u32 slot
(`u16 _pad_0; u16 count;` + `0, 8` initializers) — identical .data bytes,
u16 web lands at base r22. + declsearch order = 73 normalized diffs.
`#pragma opt_propagation off` scoped to create: 176 (regresses).
Shared `memory` var across the two allocs: 150 (no-op — single-use defs
forward-substitute either way). Residual: rows-copy loop expression-temp
orderings (r5-r8 numbering) + callee-home perms (r18/r20 vs r25/r27) —
same volatile-temp tie family as before.

View File

@@ -28,53 +28,3 @@ call result, or a non-foldable form). Dead `cmplwi r4,0xa` matches the documente
dead-compare-fossil family (both-branch merge). Also: count lands in r29 via
clrlwi (u16) — count is i.
Unresolved: what source produces symbolic-index stores + dead compare.
# tiString attempts
## inputChar mode-3 indexed block (upstream main @10146c1b)
- Base emits `li r6,0; sth r6,0x10; slwi r0,r6,1; addi r5,r1,0x10;
sthx r4,r5,r0; addi r6,r6,1; mr r4,r5; li r5,0; slwi r0,r6,1;
clrlwi r29,r6; sthx r5,r4,r0; sth r5,0x42` — input[count] INDEXED
stores with count a register-born (li+addi) SYMBOLIC web. MWCC folds
the FIRST store to immediate offset (count=0 proven) but keeps later
stores indexed — index var must be non-const-folded.
- Decode: orig's mode-3 path is NOT CharacterOutput (inlines to folded
immediates). It's `count=0; input[count]=0; input[count++]=ch;
input[count]=0; count` — semantics confirmed; the wall is making
count's web symbolic.
- ~13 forms: u16/u32/int index locals (all const-propped), struct-with-
inline-buffer member index (stays MEMORY: real stw/lwz — too far),
CharacterOutput direct + pointer-call (fully promotes + folds),
post-inc index (folds). Register-born symbolic web needs phi/call/
member-load provenance — none found that emits base's li-born shape.
## inputChar mode-3 wave-2 (fuzzy 90.8 -> 94.34, still <100)
PROVEN mechanism — the symbolic index web: base's `slwi r0,r6,1` reads a web
with NO definition instruction anywhere in the function. An UNINITIALIZED local
(`s32 idx;`) produces exactly that shape: MWCC emits indexed `slwi`+`sthx`
reading the undef web's assigned register — the #1270 retail-uninit-read
exception applies (the `li r6,0` writes a DIFFERENT web — the store operand).
Committed form uses `count = mTranslateMode - 3` instead (fuzzy 94.34, better
than undef-idx 92.61 — the undef web homes to r3 and breaks coloring; with
`u32 inputIndex` shared with the kana loop it pins r28 = worse). Undef-idx
variants give the most faithful structure: `sth`-first-store + indexed sthx +
`clrlwi r29,idx-web,0x10` tail all match; only reg home (r3 vs r6) and
in-place `addi r6,r6,1` vs new-web `addi r5,r3,1` differ.
Wall boundary (~30 forms): `li`-born + symbolic is unproduced —
`x-x`, `x&0`, `ch-ch`, `input-input`, `x*0`, comma-exprs, `?:`, empty-ifs,
phi arms all either fold to `cmpwi`-path or emit real insns (addi/subf/xori).
Dead `cmplwi r4,0xa` unproduced (comma/`||`/empty-if all drop it). `mr r4,r5`
ptr copy + `li r5,0` zero web = same coalescer home-choice family as
cardThreadMain. BEST KEPT: `count = mTranslateMode - 3; input[count] = 0;
input[count] = ch; count++; input[count] = 0;` with `u16 count` (94.34).
## wave-3 — optimization_level pragma sweep (negative)
Per-fn `#pragma optimization_level 2|3` and whole-unit `-O2,p` probed on
inputChar (g-idct lever): per-fn O2 → 134 insns, O3 → 133 (base 137);
unit-level O2 → 133 insns / 91 opcode diffs (vs 57 at O4). Lower opt
emits the same symbolic-index structure, just worse — orig is -O4,p.
The undef-web birth (`slwi r0,r6,1` on a def-less web) is not an
opt-level artifact.

View File

@@ -644,46 +644,3 @@ forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
GATE PASS
```
## struct2 wave — idct_block_var (buffer/)
- IRO probe (directive): ppc_iro_level 0/1/2 all REGRESS Lumi (IRO-0 emits
branchy clamp tails — +29 insns 286v257). Reverted. This fn needs the
DEFAULT level: its residual was fold-canonicalization, not over-folding.
- clampU8 tail: `if (v<0) return 0; return 255;` (2 stmts) emits branchy
cmpwi/bge/li/b/li; single `return v<0?0:255;` emits base's mask fold
(srawi .1f + andc 0xff). Single-ternary decode: Lumi 258->257 (exact),
_Col 455->454 (exact). Both insn counts now match.
- Residual: or-chain operand order `or ACC,ACC,NEW` vs base `or ACC,NEW,ACC`
— coalescer canonicalizes operand order regardless of source order
(reversed `x | acBits` tried, unchanged) — allocator-side coalescing
choice, not source-reachable (same wall as texturecvtr or-chains).
Remaining diffs are pure reg-renaming in the IDCT butterfly.
## Scheduling/opt pragma probes (directive wave)
- MWCC scheduling pragmas probed per-fn via push/pop on the or-chain /
scheduling-interleave / coloring residuals:
- idct Lumi: `scheduling off` 38->33 diff lines but 257 insns kept and
serializes loads (not closer per-insn); `scheduling 601/602/603` 35;
`schedule_twice` 38; `peephole off` 18 lines BUT +23 insns (280v257,
breaks rlwinm. fusion) — all net regressions or ties.
- pdm is_master_boot_sector: baseline 7; `schedule_twice` 7 (same);
`scheduling 601` 16; `scheduling off` 31; `peephole off` 22 — all worse.
- cardSequence loadCardFileIcons (-1 phi tie): `scheduling off`,
`schedule_twice`, `peephole off` all 511 insns unchanged — pragma does
not reach pinned-result phi-coalescing.
- tiCandidateBox createAnmPane_: baseline 50; `schedule_twice` 50;
`scheduling off` 66; `peephole off` 54 — coloring tie stands.
- CONCLUSION: or-operand order (or ACC,NEW,ACC vs ACC,ACC,NEW) is set by
the coalescer's dst-operand choice, upstream of the scheduler; phi
ties are upstream of both. No MWCC scheduling/peephole pragma reaches
these — source-level and pragma levers exhausted on these walls.
## w1011/struct2 wave-3 — or-chain serial probes
- `acBits = acBits | x` (explicit self-assign) produces a SERIAL
or-chain (was pairs-tree) — but operand order still canonicalizes
to `or ACC,ACC,NEW` regardless of textual `x | acBits` vs
`acBits | x`. Normalized diff unchanged (25). Committed `|=`
kept — identical score, cleaner source.