From b7d9c4fb65392cdb115b4004c28b4dc8a34e1d34 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Sat, 3 Oct 2026 01:01:35 -0500 Subject: [PATCH 1/2] match(ATERM 17/26) (ult15) (worker c46e48b5) (#1062) --- configure.py | 2 +- src/scene/setting/ATERM.c | 25 +- tools/decomp-assist/ult15.attempts.md | 415 ++++++++++++++++++++++++++ 3 files changed, 429 insertions(+), 13 deletions(-) create mode 100644 tools/decomp-assist/ult15.attempts.md diff --git a/configure.py b/configure.py index 3efbd75b..2f2d1d85 100644 --- a/configure.py +++ b/configure.py @@ -879,7 +879,7 @@ config.libs = [ Object(NonMatching, "scene/setting/AOSSLink.c"), Object(Matching, "scene/setting/iplRakuRakuThread.cpp"), Object(NonMatching, "scene/setting/AOSS.c", extra_cflags=["-O4,p", "-inline off"]), - Object(NonMatching, "scene/setting/ATERM.c", extra_cflags=["-O4,p", "-inline off"]), + Object(NonMatching, "scene/setting/ATERM.c", extra_cflags=["-O4,p", "-inline on"]), ] ), IPLSection("settingSelect", [ diff --git a/src/scene/setting/ATERM.c b/src/scene/setting/ATERM.c index 3dfb780e..c2bf6043 100644 --- a/src/scene/setting/ATERM.c +++ b/src/scene/setting/ATERM.c @@ -542,7 +542,7 @@ s32 gAtermState; void ATERMAlarmWakeQueue(OSAlarm* alarm, OSContext* context); s32 ATERMRunConfigProtocol(void); -void ATERMMd5Update(AtermMd5Context* context, void* input, u32 length); +void ATERMMd5Update(AtermMd5Context* context, u8* input, u32 length); extern u8 gAtermDigestFill[64]; extern u8* gAtermRequestOptions; int ATERMAesKeyWrap(u16* destination, u16* source, u32 length, void* key, u32 keyLength); @@ -1662,7 +1662,7 @@ s32 ATERMRunConfigProtocol(void) { digestContext.state[1] = 0xEFCDAB89; digestContext.state[2] = 0x98BADCFE; digestContext.state[3] = 0x10325476; - ATERMMd5Update(&digestContext, &authenticationTime, sizeof(authenticationTime)); + ATERMMd5Update(&digestContext, (u8*)&authenticationTime, sizeof(authenticationTime)); digestLength[0] = digestContext.bitCountLow; digestLength[1] = digestContext.bitCountLow >> 8; digestLength[2] = digestContext.bitCountLow >> 16; @@ -2312,12 +2312,17 @@ void ATERMAesDecryptBlock(const u32* expandedKey, u32 rounds, const u8* input, u void ATERMMd5Transform(u32 state[4], const u8 block[64]); -void ATERMMd5Update(AtermMd5Context* context, void* input, u32 length) { - u8* data = (u8*)input; +static inline void atermMd5Copy(void* output, const void* input, u32 length) { + u32 index; + for (index = 0; index < length; index++) { + ((u8*)output)[index] = ((const u8*)input)[index]; + } +} + +void ATERMMd5Update(AtermMd5Context* context, u8* input, u32 length) { u32 bufferIndex = (context->bitCountLow >> 3) & 0x3F; u32 bytesToFill; u32 copiedBytes; - u32 index; context->bitCountLow += length << 3; if (context->bitCountLow < (length << 3)) { @@ -2326,20 +2331,16 @@ void ATERMMd5Update(AtermMd5Context* context, void* input, u32 length) { context->bitCountHigh += length >> 29; bytesToFill = 64 - bufferIndex; if (length >= bytesToFill) { - for (copiedBytes = 0; copiedBytes < bytesToFill; copiedBytes++) { - context->buffer8[bufferIndex + copiedBytes] = data[copiedBytes]; - } + atermMd5Copy(&context->buffer8[bufferIndex], input, bytesToFill); ATERMMd5Transform(context->state, context->buffer8); for (copiedBytes = bytesToFill; copiedBytes + 63 < length; copiedBytes += 64) { - ATERMMd5Transform(context->state, data + copiedBytes); + ATERMMd5Transform(context->state, input + copiedBytes); } bufferIndex = 0; } else { copiedBytes = 0; } - for (index = 0; index < length - copiedBytes; index++) { - context->buffer8[bufferIndex + index] = data[copiedBytes + index]; - } + atermMd5Copy(&context->buffer8[bufferIndex], &input[copiedBytes], length - copiedBytes); } #define ATERM_MD5_STEP(A, B, C, D, WORD, CONSTANT, SHIFT, F) \ diff --git a/tools/decomp-assist/ult15.attempts.md b/tools/decomp-assist/ult15.attempts.md new file mode 100644 index 00000000..587e3cd8 --- /dev/null +++ b/tools/decomp-assist/ult15.attempts.md @@ -0,0 +1,415 @@ +# ult15 single-function structural matching + +Branch agent/w1003/sol-ult15-ultra; base 57ccda3883537a308568c03924af2cebf2d8a789. +All four initial pools identical. Existing untracked ult8b.attempts.md left untouched. + +## ATERMRunConfigProtocol target CFG and calls +Target 951/source958 instructions, frame0x180. Earlier ult1/fz20/data-d3 trials read; no reference-index entry. Addresses below are target object offsets. +0x170c Initialize protocol state1, response/packet/session views, socket0/result-5/retries0/failure0. +0x1778 Initialize alarm/message queue, wait500ms, dispatch state0..10. +0x17e4 Initialize alarm/message queue, wait500ms, dispatch state0..10. +0x180c case1 DiscoverAccessPoints; failure exits loop; progress state3 with deadline time; advance2. +0x1814 case1 DiscoverAccessPoints; failure exits loop; progress state3 with deadline time; advance2. +0x1834 case1 DiscoverAccessPoints; failure exits loop; progress state3 with deadline time; advance2. +0x183c case1 DiscoverAccessPoints; failure exits loop; progress state3 with deadline time; advance2. +0x1868 case1 DiscoverAccessPoints; failure exits loop; progress state3 with deadline time; advance2. +0x1888 case2 StartNetworkStack; failure exits loop; extend deadline to now+10000; advance3. +0x1898 case2 StartNetworkStack; failure exits loop; extend deadline to now+10000; advance3. +0x18a0 case2 StartNetworkStack; failure exits loop; extend deadline to now+10000; advance3. +0x18d0 case2 StartNetworkStack; failure exits loop; extend deadline to now+10000; advance3. +0x18f8 case2 StartNetworkStack; failure exits loop; extend deadline to now+10000; advance3. +0x1904 case3 create UDP socket; initialize sockaddr and bind; failure-2 or advance4. +0x1920 case3 create UDP socket; initialize sockaddr and bind; failure-2 or advance4. +0x192c case3 create UDP socket; initialize sockaddr and bind; failure-2 or advance4. +0x1970 case3 create UDP socket; initialize sockaddr and bind; failure-2 or advance4. +0x197c case3 create UDP socket; initialize sockaddr and bind; failure-2 or advance4. +0x1988 case4 deadline close/-3; build association request; receive/parse packet; progress4 and advance5. +0x19b4 case4 deadline close/-3; build association request; receive/parse packet; progress4 and advance5. +0x19c8 case4 deadline close/-3; build association request; receive/parse packet; progress4 and advance5. +0x19f8 case4 deadline close/-3; build association request; receive/parse packet; progress4 and advance5. +0x1a0c case4 deadline close/-3; build association request; receive/parse packet; progress4 and advance5. +0x1a58 case4 deadline close/-3; build association request; receive/parse packet; progress4 and advance5. +0x1a60 case4 deadline close/-3; build association request; receive/parse packet; progress4 and advance5. +0x1a8c case4 deadline close/-3; build association request; receive/parse packet; progress4 and advance5. +0x1aa8 case5 construct request options in order, send broadcast encrypted type2; set lastSendTime and advance6. +0x1b94 case5 construct request options in order, send broadcast encrypted type2; set lastSendTime and advance6. +0x1be0 case5 construct request options in order, send broadcast encrypted type2; set lastSendTime and advance6. +0x1c3c case5 construct request options in order, send broadcast encrypted type2; set lastSendTime and advance6. +0x1c8c case5 construct request options in order, send broadcast encrypted type2; set lastSendTime and advance6. +0x1d18 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1d44 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1d58 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1d78 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1dac case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1dbc case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1dc0 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1dd8 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e20 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e30 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e40 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e5c case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e60 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e68 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e70 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e7c case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e84 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e8c case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1ea8 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1eb4 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1ebc case6 read option length and first option type/length, preserve type across SONtoHs; require type0x101. +0x1ed8 case6 read option length and first option type/length, preserve type across SONtoHs; require type0x101. +0x1ee0 case6 read option length and first option type/length, preserve type across SONtoHs; require type0x101. +0x1efc case6 read option length and first option type/length, preserve type across SONtoHs; require type0x101. +0x1f08 case6 copy challenge, MD5 init/update(time), encode bit count, MD5 padding and count updates. +0x1fe0 case6 copy challenge, MD5 init/update(time), encode bit count, MD5 padding and count updates. +0x1fe4 case6 copy challenge, MD5 init/update(time), encode bit count, MD5 padding and count updates. +0x2084 case6 encode4 digest words to session key+8; clear88-byte digest context by byte loop. +0x20ac case6 advance7/progress5, disable deadline, reset retries, callback. +0x20ec case6 timeout after2000ms returns state5. +0x2118 case6 timeout after2000ms returns state5. +0x2124 case7 build0x102 response with digest8, send type4, timestamp and clear scan settings; advance8. +0x2220 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2240 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2274 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2284 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2288 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x22a0 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x22e8 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x22f8 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2308 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2324 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2328 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2330 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2338 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2344 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x234c case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2354 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2370 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x237c case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2388 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2398 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x23c4 case8 after1000ms increment retries; ten closes/-2, otherwise state7. +0x23f0 case8 after1000ms increment retries; ten closes/-2, otherwise state7. +0x23fc case8 after1000ms increment retries; ten closes/-2, otherwise state7. +0x2410 case8 after1000ms increment retries; ten closes/-2, otherwise state7. +0x241c case9 build mode option0x301, send type6 or bypass send if link status!=5; timestamp and state10. +0x24b0 case9 build mode option0x301, send type6 or bypass send if link status!=5; timestamp and state10. +0x24e0 case9 build mode option0x301, send type6 or bypass send if link status!=5; timestamp and state10. +0x2548 case10 after1000ms ten retries apply scan security and exit; otherwise state9. +0x2574 case10 after1000ms ten retries apply scan security and exit; otherwise state9. +0x2580 case10 after1000ms ten retries apply scan security and exit; otherwise state9. +0x2590 case10 after1000ms ten retries apply scan security and exit; otherwise state9. +0x2598 Loop if !failed&&!cancel. +0x25a0 Loop if !failed&&!cancel. +0x25ac Close nonzero socket, cancellation overrides result-8; restore and return. +0x25b4 Close nonzero socket, cancellation overrides result-8; restore and return. +0x25bc Close nonzero socket, cancellation overrides result-8; restore and return. +0x25c8 Close nonzero socket, cancellation overrides result-8; restore and return. +0x25cc Close nonzero socket, cancellation overrides result-8; restore and return. +Target calls in order: _savegpr_14, OSInitMessageQueue, OSCreateAlarm, OSSetAlarmTag, OSSetAlarm, OSReceiveMessage, ATERMDiscoverAccessPoints, OSGetTime, __div2i, ATERMStartNetworkStack, OSGetTime, __div2i, OSGetTime, __div2i, SOSocket, memset, SOHtoNs, SOBind, OSGetTime, __div2i, SOClose, ATERMBuildAssociationRequest, SORecvFrom, ATERMParsePacket, OSGetTime, __div2i, OSGetTime, __div2i, SOHtoNs, memset, SOHtoNs, SOHtoNs, memset, memcpy, memset, SOHtoNs, SOHtoNs, memset, memcpy, memset, SOHtoNs, SOHtoNs, memset, memcpy, memset, SOHtoNs, SOHtoNs, memset, memcpy, memset, SOHtoNs, SOHtoNs, memset, memcpy, ATERMBuildEncryptedMessage, SOHtoNs, SOSendTo, OSGetTime, __div2i, OSGetTime, __div2i, SOClose, SORecvFrom, SONtoHs, SONtoHs, SONtoHs, ATERMAesKeyUnwrap, memcpy, SONtoHs, SONtoHs, SONtoHs, OSGetTime, __div2i, memcpy, ATERMMd5Update, ATERMMd5Update, ATERMMd5Update, OSGetTime, __div2i, memset, memset, SOHtoNs, SOHtoNs, memset, memcpy, ATERMBuildEncryptedMessage, SOHtoNs, SOSendTo, OSGetTime, __div2i, memset, SORecvFrom, SONtoHs, SONtoHs, SONtoHs, ATERMAesKeyUnwrap, memcpy, ATERMParseAssociationResponse, OSGetTime, __div2i, SOClose, memset, memset, SOHtoNs, SOHtoNs, memset, memcpy, ATERMBuildEncryptedMessage, NCDGetLinkStatus, OSGetTime, __div2i, SOHtoNs, SOSendTo, OSGetTime, __div2i, OSGetTime, __div2i, ATERMApplyScanSecuritySettings, SOClose, _restgpr_14 + +## ATERMRunConfigProtocol target CFG and calls +Target 951/source958 instructions, frame0x180. Earlier ult1/fz20/data-d3 trials read; no reference-index entry. Addresses below are target object offsets. +0x170c Initialize protocol state1, response/packet/session views, socket0/result-5/retries0/failure0. +0x1778 Initialize alarm/message queue, wait500ms, dispatch state0..10. +0x17e4 Initialize alarm/message queue, wait500ms, dispatch state0..10. +0x180c case1 DiscoverAccessPoints; failure exits loop; progress state3 with deadline time; advance2. +0x1814 case1 DiscoverAccessPoints; failure exits loop; progress state3 with deadline time; advance2. +0x1834 case1 DiscoverAccessPoints; failure exits loop; progress state3 with deadline time; advance2. +0x183c case1 DiscoverAccessPoints; failure exits loop; progress state3 with deadline time; advance2. +0x1868 case1 DiscoverAccessPoints; failure exits loop; progress state3 with deadline time; advance2. +0x1888 case2 StartNetworkStack; failure exits loop; extend deadline to now+10000; advance3. +0x1898 case2 StartNetworkStack; failure exits loop; extend deadline to now+10000; advance3. +0x18a0 case2 StartNetworkStack; failure exits loop; extend deadline to now+10000; advance3. +0x18d0 case2 StartNetworkStack; failure exits loop; extend deadline to now+10000; advance3. +0x18f8 case2 StartNetworkStack; failure exits loop; extend deadline to now+10000; advance3. +0x1904 case3 create UDP socket; initialize sockaddr and bind; failure-2 or advance4. +0x1920 case3 create UDP socket; initialize sockaddr and bind; failure-2 or advance4. +0x192c case3 create UDP socket; initialize sockaddr and bind; failure-2 or advance4. +0x1970 case3 create UDP socket; initialize sockaddr and bind; failure-2 or advance4. +0x197c case3 create UDP socket; initialize sockaddr and bind; failure-2 or advance4. +0x1988 case4 deadline close/-3; build association request; receive/parse packet; progress4 and advance5. +0x19b4 case4 deadline close/-3; build association request; receive/parse packet; progress4 and advance5. +0x19c8 case4 deadline close/-3; build association request; receive/parse packet; progress4 and advance5. +0x19f8 case4 deadline close/-3; build association request; receive/parse packet; progress4 and advance5. +0x1a0c case4 deadline close/-3; build association request; receive/parse packet; progress4 and advance5. +0x1a58 case4 deadline close/-3; build association request; receive/parse packet; progress4 and advance5. +0x1a60 case4 deadline close/-3; build association request; receive/parse packet; progress4 and advance5. +0x1a8c case4 deadline close/-3; build association request; receive/parse packet; progress4 and advance5. +0x1aa8 case5 construct request options in order, send broadcast encrypted type2; set lastSendTime and advance6. +0x1b94 case5 construct request options in order, send broadcast encrypted type2; set lastSendTime and advance6. +0x1be0 case5 construct request options in order, send broadcast encrypted type2; set lastSendTime and advance6. +0x1c3c case5 construct request options in order, send broadcast encrypted type2; set lastSendTime and advance6. +0x1c8c case5 construct request options in order, send broadcast encrypted type2; set lastSendTime and advance6. +0x1d18 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1d44 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1d58 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1d78 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1dac case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1dbc case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1dc0 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1dd8 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e20 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e30 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e40 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e5c case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e60 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e68 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e70 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e7c case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e84 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1e8c case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1ea8 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1eb4 case6 deadline close/-4; receive, sequence3 and length, byte checksum; unwrap or copy payload; zero length leaves authentication. +0x1ebc case6 read option length and first option type/length, preserve type across SONtoHs; require type0x101. +0x1ed8 case6 read option length and first option type/length, preserve type across SONtoHs; require type0x101. +0x1ee0 case6 read option length and first option type/length, preserve type across SONtoHs; require type0x101. +0x1efc case6 read option length and first option type/length, preserve type across SONtoHs; require type0x101. +0x1f08 case6 copy challenge, MD5 init/update(time), encode bit count, MD5 padding and count updates. +0x1fe0 case6 copy challenge, MD5 init/update(time), encode bit count, MD5 padding and count updates. +0x1fe4 case6 copy challenge, MD5 init/update(time), encode bit count, MD5 padding and count updates. +0x2084 case6 encode4 digest words to session key+8; clear88-byte digest context by byte loop. +0x20ac case6 advance7/progress5, disable deadline, reset retries, callback. +0x20ec case6 timeout after2000ms returns state5. +0x2118 case6 timeout after2000ms returns state5. +0x2124 case7 build0x102 response with digest8, send type4, timestamp and clear scan settings; advance8. +0x2220 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2240 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2274 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2284 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2288 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x22a0 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x22e8 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x22f8 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2308 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2324 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2328 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2330 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2338 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2344 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x234c case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2354 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2370 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x237c case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2388 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x2398 case8 receive sequence5/checksum; unwrap session-key payload or copy; parse association; state9 and ssid-based mode. +0x23c4 case8 after1000ms increment retries; ten closes/-2, otherwise state7. +0x23f0 case8 after1000ms increment retries; ten closes/-2, otherwise state7. +0x23fc case8 after1000ms increment retries; ten closes/-2, otherwise state7. +0x2410 case8 after1000ms increment retries; ten closes/-2, otherwise state7. +0x241c case9 build mode option0x301, send type6 or bypass send if link status!=5; timestamp and state10. +0x24b0 case9 build mode option0x301, send type6 or bypass send if link status!=5; timestamp and state10. +0x24e0 case9 build mode option0x301, send type6 or bypass send if link status!=5; timestamp and state10. +0x2548 case10 after1000ms ten retries apply scan security and exit; otherwise state9. +0x2574 case10 after1000ms ten retries apply scan security and exit; otherwise state9. +0x2580 case10 after1000ms ten retries apply scan security and exit; otherwise state9. +0x2590 case10 after1000ms ten retries apply scan security and exit; otherwise state9. +0x2598 Loop if !failed&&!cancel. +0x25a0 Loop if !failed&&!cancel. +0x25ac Close nonzero socket, cancellation overrides result-8; restore and return. +0x25b4 Close nonzero socket, cancellation overrides result-8; restore and return. +0x25bc Close nonzero socket, cancellation overrides result-8; restore and return. +0x25c8 Close nonzero socket, cancellation overrides result-8; restore and return. +0x25cc Close nonzero socket, cancellation overrides result-8; restore and return. +Target calls in order: _savegpr_14, OSInitMessageQueue, OSCreateAlarm, OSSetAlarmTag, OSSetAlarm, OSReceiveMessage, ATERMDiscoverAccessPoints, OSGetTime, __div2i, ATERMStartNetworkStack, OSGetTime, __div2i, OSGetTime, __div2i, SOSocket, memset, SOHtoNs, SOBind, OSGetTime, __div2i, SOClose, ATERMBuildAssociationRequest, SORecvFrom, ATERMParsePacket, OSGetTime, __div2i, OSGetTime, __div2i, SOHtoNs, memset, SOHtoNs, SOHtoNs, memset, memcpy, memset, SOHtoNs, SOHtoNs, memset, memcpy, memset, SOHtoNs, SOHtoNs, memset, memcpy, memset, SOHtoNs, SOHtoNs, memset, memcpy, memset, SOHtoNs, SOHtoNs, memset, memcpy, ATERMBuildEncryptedMessage, SOHtoNs, SOSendTo, OSGetTime, __div2i, OSGetTime, __div2i, SOClose, SORecvFrom, SONtoHs, SONtoHs, SONtoHs, ATERMAesKeyUnwrap, memcpy, SONtoHs, SONtoHs, SONtoHs, OSGetTime, __div2i, memcpy, ATERMMd5Update, ATERMMd5Update, ATERMMd5Update, OSGetTime, __div2i, memset, memset, SOHtoNs, SOHtoNs, memset, memcpy, ATERMBuildEncryptedMessage, SOHtoNs, SOSendTo, OSGetTime, __div2i, memset, SORecvFrom, SONtoHs, SONtoHs, SONtoHs, ATERMAesKeyUnwrap, memcpy, ATERMParseAssociationResponse, OSGetTime, __div2i, SOClose, memset, memset, SOHtoNs, SOHtoNs, memset, memcpy, ATERMBuildEncryptedMessage, NCDGetLinkStatus, OSGetTime, __div2i, SOHtoNs, SOSendTo, OSGetTime, __div2i, OSGetTime, __div2i, ATERMApplyScanSecuritySettings, SOClose, _restgpr_14 + +ATTEMPT ATERMRunConfigProtocol | initialize response and session views after state1 | {"percent": 88.19559, "insns": [958, 951], "structural": 215, "diffs": 928, "pool": 0, "regress": [], "hash": "511fa936cdec"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMRunConfigProtocol | defined option type gates authentication after state-first views | {"percent": 88.07571, "insns": [955, 951], "structural": 205, "diffs": 935, "pool": 0, "regress": [], "hash": "b2c633616cbb"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMRunConfigProtocol | const response object view with session initialization after state1 | {"percent": 88.19559, "insns": [958, 951], "structural": 215, "diffs": 928, "pool": 0, "regress": [], "hash": "8cd30b63a572"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +## ATERMMd5Update target blocks +0x3910 countLow += length<<3 and carry to high; bufferIndex=countLow_old>>3&63. +0x3960 high += length>>29; fillLength=64-bufferIndex; length0x3a6c. +0x397c..0x3a38 inline bytecopy, independent destination/source/length locals, eight-byte unroll then byte remainder. Target destination is &context->buffer8[bufferIndex] as a formal copy view, not context+indexed field stores. +0x3a38 transform context buffer;0x3a48 full input blocks;0x3a58 test offset+631 and terminator then clears preview;0x80c direct literal;0x818 setCandidate0;0x830 getSelected;0x85c insert when selected start=end then cursor+=count;0x890 replace selection and cursor=start+count;0x8c4 copy start to end;0x8cc restore. Frame0x30,target136/current125. Target dead newline comparison has no branch; prior fz3 R5..R11 builders/newline-reset aliases failed. New trials test dispatch structure and meaningful shared literal-copy boundaries, never a no-op newline argument. + +ATTEMPT inputChar__Q39textinput8tistring9DecolatedFw | bounded single-character conversion with counted output loop | {"percent": 90.757355, "insns": [126, 136], "structural": 17, "diffs": 73, "pool": 0, "regress": [], "hash": "f7321d864f40"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT inputChar__Q39textinput8tistring9DecolatedFw | structured mode switch preserving Kana and literal converter paths | {"percent": 86.64706, "insns": [129, 136], "structural": 24, "diffs": 126, "pool": 0, "regress": [], "hash": "ced7330165ae"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT inputChar__Q39textinput8tistring9DecolatedFw | terminated literal pair copied as bounded UTF16 sequence | {"percent": 90.132355, "insns": [125, 136], "structural": 18, "diffs": 73, "pool": 0, "regress": [], "hash": "069a4900344f"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMRunConfigProtocol | decoded reply view plus actual session challenge and digest fields | {"percent": 85.872765, "insns": [968, 951], "structural": 268, "diffs": 944, "pool": 0, "regress": [], "hash": "752ce99014b1"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMRunConfigProtocol | configuration struct pointer owns reply and packet field views | {"percent": 88.19559, "insns": [958, 951], "structural": 215, "diffs": 928, "pool": 0, "regress": [], "hash": "03a9e0281617"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMRunConfigProtocol | byte reply storage with typed decoding only at packet boundaries | {"percent": 87.1346, "insns": [965, 951], "structural": 249, "diffs": 944, "pool": 0, "regress": [], "hash": "cc914ad7a7b9"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT _create_icon__Q33ipl5scene17MemoryCardManagerFUcsl | bounded icon row reference before frame format selection | {"percent": 87.55, "insns": [100, 100], "structural": 16, "diffs": 37, "pool": 0, "regress": [], "hash": "359dcec94cc8"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT _create_icon__Q33ipl5scene17MemoryCardManagerFUcsl | return each format texture through its post-initialization local | {"percent": 82.75, "insns": [101, 100], "structural": 23, "diffs": 69, "pool": 0, "regress": [], "hash": "63b2d32d4235"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT _create_icon__Q33ipl5scene17MemoryCardManagerFUcsl | writable destination manager reference separated from icon metadata | {"percent": 87.55, "insns": [100, 100], "structural": 16, "diffs": 37, "pool": 0, "regress": [], "hash": "7b24a74470f4"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT create_banner__Q33ipl5scene17MemoryCardManagerFUcs | bounded icon row reference before frame format selection | {"percent": 90.42453, "insns": [106, 106], "structural": 15, "diffs": 70, "pool": 0, "regress": [], "hash": "0c9b67da5e48"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT create_banner__Q33ipl5scene17MemoryCardManagerFUcs | return each format texture through its post-initialization local | {"percent": 79.99056, "insns": [110, 106], "structural": 30, "diffs": 96, "pool": 0, "regress": [], "hash": "ffdf0a10fa73"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT create_banner__Q33ipl5scene17MemoryCardManagerFUcs | writable destination manager reference separated from icon metadata | {"percent": 90.42453, "insns": [106, 106], "structural": 15, "diffs": 70, "pool": 0, "regress": [], "hash": "80e89eb4b927"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +## ATERM explicit inline-boundary audit +Build flags end with -inline off, which explains earlier helper-call results. Test only this unit configuration with explicit/auto inlining and the ordinary RFC-shaped byte copy helper; every other unit flag stays unchanged. A change can survive only if all other function scores and code/data measures do not drop. + +ATTEMPT ATERMMd5Update | ordinary byte copy helper with inline on | {"percent": 90.43056, "insns": [140, 144], "structural": 33, "diffs": 122, "pool": 0, "regress": [], "hash": "faaf1e4c49c4"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMMd5Update | ordinary byte copy helper with inline auto | {"percent": 90.43056, "insns": [140, 144], "structural": 33, "diffs": 122, "pool": 0, "regress": [], "hash": "faaf1e4c49c4"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMMd5Update | ordinary byte copy helper with inline smart | {"percent": 90.43056, "insns": [140, 144], "structural": 33, "diffs": 122, "pool": 0, "regress": [], "hash": "faaf1e4c49c4"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMMd5Update | mutable byte input RFC prototype under explicit inline | {"percent": 91.68056, "insns": [139, 144], "structural": 32, "diffs": 115, "pool": 0, "regress": [], "hash": "25c72e25014e"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMMd5Update | opaque void copy prototype with indexed byte views under explicit inline | {"percent": 97.84722, "insns": [144, 144], "structural": 2, "diffs": 19, "pool": 0, "regress": [], "hash": "5172686bc07f"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMMd5Update | opaque copy prototype with mutable input under explicit inline | {"percent": 97.84722, "insns": [144, 144], "structural": 2, "diffs": 19, "pool": 0, "regress": [], "hash": "9f8629f26ad5"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMMd5Update | opaque void copy prototype with typed local views under explicit inline | {"percent": 72.56944, "insns": [138, 144], "structural": 38, "diffs": 127, "pool": 0, "regress": [], "hash": "e97c4116d2f4"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMMd5Update | byte copy source formal precedes destination under explicit inline | {"percent": 90.43056, "insns": [140, 144], "structural": 33, "diffs": 122, "pool": 0, "regress": [], "hash": "0cc678ab6cdb"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMMd5Update | opaque copy source formal precedes destination under explicit inline | {"percent": 97.84722, "insns": [144, 144], "structural": 2, "diffs": 19, "pool": 0, "regress": [], "hash": "7e12456ee6d0"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMMd5Update | actual u8* input formal and opaque inline copy | {"percent": 100.0, "insns": [144, 144], "structural": 0, "diffs": 0, "pool": 0, "regress": [], "hash": "a0a1a0da6371"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMMd5Update | actual const u8* input formal and opaque inline copy | {"percent": 95.701385, "insns": [144, 144], "structural": 16, "diffs": 43, "pool": 0, "regress": [], "hash": "41b5e6eddc0e"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMMd5Update | actual const void* input formal and opaque inline copy | {"percent": 93.548615, "insns": [144, 144], "structural": 18, "diffs": 61, "pool": 0, "regress": [], "hash": "7e12f77bfc92"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMMd5Update | actual u8* input formal and opaque inline copy | {"percent": 100.0, "insns": [144, 144], "structural": 0, "diffs": 0, "pool": 0, "regress": [], "hash": "a0a1a0da6371"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +RETAIN exact ATERMMd5Update. 144/144 instructions, objdiff100 and diffs0. RFC byte copy uses opaque formals and mutable u8 input formal; explicit inlining required. No other function score dropped. All other trial sources restored before handoff. + +ATTEMPT _create_icon__Q33ipl5scene17MemoryCardManagerFUcsl | single GX object field array decay icon | {"percent": 87.55, "insns": [100, 100], "structural": 16, "diffs": 37, "pool": 0, "regress": [], "hash": "7fc379d6b1ff"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT _create_icon__Q33ipl5scene17MemoryCardManagerFUcsl | single GX object field array decay iconTlut | {"percent": 87.55, "insns": [100, 100], "structural": 16, "diffs": 37, "pool": 0, "regress": [], "hash": "242481a3e099"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT _create_icon__Q33ipl5scene17MemoryCardManagerFUcsl | single GX object field array decay icon,iconTlut | {"percent": 87.55, "insns": [100, 100], "structural": 16, "diffs": 37, "pool": 0, "regress": [], "hash": "dfffb5b7be9a"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT create_banner__Q33ipl5scene17MemoryCardManagerFUcs | single GX object field array decay banner | {"percent": 90.42453, "insns": [106, 106], "structural": 15, "diffs": 70, "pool": 0, "regress": [], "hash": "1fdfd74c6c6e"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT create_banner__Q33ipl5scene17MemoryCardManagerFUcs | single GX object field array decay bannerTlut | {"percent": 90.42453, "insns": [106, 106], "structural": 15, "diffs": 70, "pool": 0, "regress": [], "hash": "ec1eb10c3292"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT create_banner__Q33ipl5scene17MemoryCardManagerFUcs | single GX object field array decay banner,bannerTlut | {"percent": 90.42453, "insns": [106, 106], "structural": 15, "diffs": 70, "pool": 0, "regress": [], "hash": "8b67d38fcbcf"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +ATTEMPT ATERMMd5Update | readable readonly copy helper and removal of obsolete local | {"percent": 100.0, "insns": [144, 144], "structural": 0, "diffs": 0, "pool": 0, "regress": [], "hash": "404e45ea9e55"} | POOL IDENTICAL up to 0 (mine=0 base=0) + +## Data ownership audit +MemoryCardManager has no target data objects; tiString all288/288, tiZiString all7680/7680 exact. ATERM .bss8160,.rodata10280,.sbss80,.sdata56,.sdata2=8 all100%; .data280 remains92.14286%, eleven switch-table relocations into open RunConfigProtocol. All generated-table names already paired, and no extent/name correction is supported. No symbols.txt edits. +AUDIT ATERMRunConfigProtocol | 88.19559% | 6 distinct successfully built source attempts. +AUDIT ATERMMd5Update | 100.0% | 14 distinct successfully built source attempts. +AUDIT _create_icon__Q33ipl5scene17MemoryCardManagerFUcsl | 87.55% | 10 distinct successfully built source attempts. +AUDIT create_banner__Q33ipl5scene17MemoryCardManagerFUcs | 90.42453% | 10 distinct successfully built source attempts. +AUDIT inputChar__Q39textinput8tistring9DecolatedFw | 90.132355% | 3 distinct successfully built source attempts. +AUDIT setElementBuffer__Q39textinput8tistring6WithZiFv | 90.33846% | 3 distinct successfully built source attempts. +All rejected source/header/config trials restored. Retained only exact MD5 helper/signature and ATERM inline flag. Original untracked ult8b log untouched. No other unit function score dropped from current baseline. + +Independent original-source object compiled into /tmp with original -inline off flags: instruction-exact 16 -> 17; new ['ATERMMd5Update']; lost []. Worktree source and final build unmodified. + +## Final full non-quick gate +```text +full build: ok +main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d +[src/scene/setting/ATERM] pool: IDENTICAL +[src/scene/setting/ATERM] objdiff: code 11036/19204 data 18584/18864 functions 18/26 fuzzy 97.0367 linked code 0 +[src/scene/setting/ATERM] instruction-exact functions: 17/26 +[src/scene/setting/ATERM] section .bss size 8160 match 100.0 +[src/scene/setting/ATERM] section .data size 280 match 92.14286 +[src/scene/setting/ATERM] section .rodata size 10280 match 100.0 +[src/scene/setting/ATERM] section .sbss size 80 match 100.0 +[src/scene/setting/ATERM] section .sdata size 56 match 100.0 +[src/scene/setting/ATERM] section .sdata2 size 8 match 100.0 +[src/scene/setting/ATERM] section .text size 19204 match 97.03666 +[src/scene/setting/ATERM] below 100: ATERMStartNetworkStack 97.91558 +[src/scene/setting/ATERM] below 100: ATERMDiscoverAccessPoints 95.304184 +[src/scene/setting/ATERM] below 100: ATERMBuildEncryptedMessage 99.791664 +[src/scene/setting/ATERM] below 100: ATERMBuildAssociationRequest 93.44361 +[src/scene/setting/ATERM] below 100: ATERMParseAssociationResponse 99.56204 +[src/scene/setting/ATERM] below 100: ATERMRunConfigProtocol 88.19559 +[src/scene/setting/ATERM] below 100: ATERMi_AutoConfigThread 94.75 +[src/scene/setting/ATERM] below 100: ATERMAesExpandEncryptKey 98.94403 +[src/scene/setting/ATERM] baseline: code 10460/19204 data 18584 functions 17 fuzzy 96.7746 +[src/scene/memoryCard/iplMemoryCardManager] pool: IDENTICAL +[src/scene/memoryCard/iplMemoryCardManager] objdiff: code 2572/5396 data None/None functions 18/26 fuzzy 97.8836 linked code 0 +[src/scene/memoryCard/iplMemoryCardManager] instruction-exact functions: 18/26 +[src/scene/memoryCard/iplMemoryCardManager] section .text size 5396 match 97.88362 +[src/scene/memoryCard/iplMemoryCardManager] below 100: isMoveEnable__Q33ipl5scene17MemoryCardManagerFUcUlPl 99.830505 +[src/scene/memoryCard/iplMemoryCardManager] below 100: isCopyEnable__Q33ipl5scene17MemoryCardManagerFUcUlPl 99.830505 +[src/scene/memoryCard/iplMemoryCardManager] below 100: isBannerEnable__Q33ipl5scene17MemoryCardManagerFUcs 92.30769 +[src/scene/memoryCard/iplMemoryCardManager] below 100: update_file_array__Q33ipl5scene17MemoryCardManagerFUc 99.72222 +[src/scene/memoryCard/iplMemoryCardManager] below 100: _create_icon__Q33ipl5scene17MemoryCardManagerFUcsl 87.55 +[src/scene/memoryCard/iplMemoryCardManager] below 100: getComment__Q33ipl5scene17MemoryCardManagerFUcsi 98.94309 +[src/scene/memoryCard/iplMemoryCardManager] below 100: create_banner__Q33ipl5scene17MemoryCardManagerFUcs 90.42453 +[src/scene/memoryCard/iplMemoryCardManager] below 100: getBlocks__Q33ipl5scene17MemoryCardManagerFUcs 92.0 +[src/scene/memoryCard/iplMemoryCardManager] baseline: code 2572/5396 data None functions 18 fuzzy 97.8836 +[src/keyboard/tiString] pool: IDENTICAL +[src/keyboard/tiString] objdiff: code 4632/5176 data 288/288 functions 41/42 fuzzy 98.9629 linked code 0 +[src/keyboard/tiString] instruction-exact functions: 41/42 +[src/keyboard/tiString] section .data size 288 match 100.0 +[src/keyboard/tiString] section .text size 5176 match 98.962906 +[src/keyboard/tiString] below 100: inputChar__Q39textinput8tistring9DecolatedFw 90.132355 +[src/keyboard/tiString] baseline: code 4632/5176 data 288 functions 41 fuzzy 98.9629 +[src/keyboard/tiZiString] pool: IDENTICAL +[src/keyboard/tiZiString] objdiff: code 3136/5504 data 7680/7680 functions 26/29 fuzzy 98.2645 linked code 0 +[src/keyboard/tiZiString] instruction-exact functions: 26/29 +[src/keyboard/tiZiString] section .bss size 7296 match 100.0 +[src/keyboard/tiZiString] section .data size 328 match 100.0 +[src/keyboard/tiZiString] section .rodata size 56 match 100.0 +[src/keyboard/tiZiString] section .text size 5504 match 98.264534 +[src/keyboard/tiZiString] below 100: clearCandidates__Q39textinput8tistring6WithZiFv 93.28395 +[src/keyboard/tiZiString] below 100: update__Q39textinput8tistring6WithZiFv 97.273544 +[src/keyboard/tiZiString] below 100: setElementBuffer__Q39textinput8tistring6WithZiFv 90.33846 +[src/keyboard/tiZiString] baseline: code 3136/5504 data 7680 functions 26 fuzzy 98.2645 +regressions vs baseline: 0 +global matched_code_percent: 91.93089 -> 91.95013 +global fuzzy_match_percent: 99.71608 -> 99.71777 +global complete_code_percent: 74.84181 -> 74.84181 +global matched_data_percent: 99.77803 -> 99.77803 +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 +``` +Source review: only ATERMMd5Update byte-copy helper/signature, its RunConfigProtocol byte-view call, and the ATERM inline setting are retained. No other source/header/symbol edit remains. Exact MD5 objdiff100,144/144,diffs0; parent verification still required. -- 2.49.1 From a3e522c19bf33ef14b8bb307e773bc3f4f1da182 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Sat, 3 Oct 2026 01:01:51 -0500 Subject: [PATCH 2/2] decomp(nhttp): distinguish raw token bytes from signed folds --- libs/RevoEX/src/nhttp/NHTTP_stdlib_RVL.c | 4 +- ...llhands-nhttp-token-byte-roles.attempts.md | 75 +++++++++++++++++++ 2 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 tools/decomp-assist/allhands-nhttp-token-byte-roles.attempts.md diff --git a/libs/RevoEX/src/nhttp/NHTTP_stdlib_RVL.c b/libs/RevoEX/src/nhttp/NHTTP_stdlib_RVL.c index 9ac1e566..2cf78b50 100644 --- a/libs/RevoEX/src/nhttp/NHTTP_stdlib_RVL.c +++ b/libs/RevoEX/src/nhttp/NHTTP_stdlib_RVL.c @@ -126,8 +126,8 @@ s32 NHTTPi_intToStr(char* destination, u32 value) { } s32 NHTTPi_compareToken(const char* left, const char* right) { - u8 rawLeft; - while (LowerCase((s8)(rawLeft = *(const u8*)left)) == LowerCase(*right)) { + u32 rawLeft; + while (LowerCase((s8)(rawLeft = *(const u8*)left)) == LowerCase((s8)*(const u8*)right)) { if ((s8)rawLeft == 0 || (s8)rawLeft == ' ') { return 0; } diff --git a/tools/decomp-assist/allhands-nhttp-token-byte-roles.attempts.md b/tools/decomp-assist/allhands-nhttp-token-byte-roles.attempts.md new file mode 100644 index 00000000..a1015398 --- /dev/null +++ b/tools/decomp-assist/allhands-nhttp-token-byte-roles.attempts.md @@ -0,0 +1,75 @@ +# NHTTP token byte-role recovery, 2026-10-03 + +Base: `81ba2799`. One authorized two-line trial in +`libs/RevoEX/src/nhttp/NHTTP_stdlib_RVL.c`. No other function, shared helper, +header, compiler setting or linking configuration was changed. + +## Source roles and historical evidence + +NHTTPi_compareToken retains the raw left byte across its folded comparison, +then signs that raw value again for the matched NUL/space termination test. +The target loads the right byte and folds its signed value first, then loads +the left byte into a separate zero-extended word before signing/folding it. +The raw left word remains separate from both folded comparison results. + +Use u32 for that actual zero-extended raw-left value, and express the right +input through the same explicit u8-load/s8-conversion boundary as the left. +No extra local, helper, load, dummy use or register-forcing construct is added. +The shared LowerCase helper and literal termination tests are unchanged. +This is data-representation reconstruction, not a changed byte-domain contract. + +The perm2 attempt log had measured 99.51111% for the word-lived raw left byte +and 99.73333% with the right raw-byte conversion, but discarded both solely +because they were nonexact. Those old temporary sources are unavailable here; +the minimal form was independently reconstructed from current source and +original instructions. Only that one two-line form was compiled this round. + +## Byte, ordering and termination proof + +- All 256 byte values were checked against the target's actual carry-based + signed comparisons. Only ASCII A..Z gain 32; bytes 128..255 remain signed + negative values for comparison, preserving equality with the same raw byte. +- A private interpreter executes the original 45-instruction function on all + 65,536 byte pairs plus five multi-byte/high-bit/termination cases. Return + values and ordered byte-read traces agree with the proposed semantics. +- The compiled candidate differs from original only at two initial li + instructions: zero and 'Z' are initialized in the opposite order. They write + distinct registers before either value is used and do not change condition + state. After commuting those two independent instructions, all 45 match + literally, including right-before-left loads, both signed conversions, + folded comparisons, pointer advances and the saved raw-byte stop test. +- A matched NUL or literal space returns 0; every mismatch returns -1. Other + whitespace bytes are ordinary token data. The comparison still happens + before termination, and no new dereference or store is introduced. + +## Fresh gates + +- NHTTPi_compareToken: 98.844444 -> 99.73333%, 45/45 instructions, two residual + constant-scheduling differences. This is not an exact match. +- Unit: 99.88612 -> 99.9573%; exact functions 12/14 and code 1864/2248 preserved; + data 112/112 preserved. Linking unchanged. +- All 13 unrelated functions' instruction streams and resolved relocations are + identical to baseline, including the 12 exact functions. Every allocated data + byte and section extent is unchanged. Pool 1/1 identical. +- Literal-reference advisory: all 14 functions analyzed, no candidates, skips + or errors; this function has no string arguments at external calls. +- Full 1,027-unit reports show only compareToken improved, with no fuzzy, + exact-function, exact-code or data regression. Post-build final report equals + the candidate report. +- Production C: 75,536 exhaustive byte-pair and seeded token comparisons pass + against an independent ASCII-fold/literal-termination reference for both + baseline and candidate. +- ASan/UBSan: 95,504 byte-pair, seeded token, aliased and overlapping-input + comparisons pass; all input bytes remain unchanged. The harness extracts + actual production function/helper bodies and uses signed-char host settings. + Leak detection is disabled for ptrace; address/UB instrumentation is enabled. +- Full 43U build and build/43U/ok pass. DOL SHA1 remains + `26116613f624061ba99c8d1a299aaa6efa85670d`. git diff --check passes. + +Private evidence: `/tmp/nhttp-token-byte-roles/` contains source/object snapshots, +reports, host/sanitizer harnesses and results, pool/literal/ctxdiff and build logs. +The prior read-only byte proof and proposed diff are preserved separately in +`/tmp/nhttp-token-recovery-screen/`. Original assembly and objects remain private. + +GATE: passing two-line partial recovery, frozen for independent review. +No additional constant-order or register trial was attempted. -- 2.49.1