Compare commits

...

5 Commits

Author SHA1 Message Date
coah
df30ad321c Link matched NWC24 mailbox and message-commit routines 2026-10-02 12:34:27 -05:00
coah
1994d24f06 match(ZiDAWGGetSibling, Zi8IsWordW: 16-bit byte widening) (orchestrator + data-d11j) (worker 993402bc) (#838) 2026-10-02 12:28:01 -05:00
coah
0d9b038782 match(NWC24MsgCommit 18/18, Texture_MCUtoY8U8V8 12/13) (fz15g) (worker fed147c9) (#837) 2026-10-02 12:25:41 -05:00
coah
ff90063ef9 match(NWC24MBoxCtrl 25/25) (fz21d) (worker 710e3312) (#836) 2026-10-02 12:19:14 -05:00
devin-ai-integration[bot]
c1183780c2 eggAudioExpMgr: emit-gate headers for orig symbol set (stays Equivalent) (#835)
Split 2 of 2 from #815. Removes the invented 'Sample' class. The
EGG_AUDIO_EXPMGR_NO_INLINE_VIRTUALS gates (ArcPlayerMgr 9 virtuals,
SoundHeapMgr loadState/getCurrentLevel, nw4r AutoLock ct/dt) reproduce
orig's .o emit set exactly: same 8 .text symbols at the same offsets plus
__vt__ at .data+0/0x78.

Stays Equivalent: orig orders the secondary-vtable thunks
[@52@dt][@52@calc] while MWCC emits [@52@calc][@52@dt] here, and orig
emits them GLOBAL while ours are WEAK. Verified across 6 other orig
units that thunk order follows most-derived declared-virtual order; the
only lever found that flips it is a second ODR-used derived class's
vtable build - invented code, rejected. See
tools/decomp-assist/linkgap-audio.attempts.md.

Co-authored-by: devin <devin@cognition.ai>
Co-authored-by: coah80 <usernamecole7@gmail.com>
2026-10-02 12:07:38 -05:00
17 changed files with 4482 additions and 33 deletions

View File

@@ -53,9 +53,9 @@ Progress
<!-- progress:start -->
| Decompiled | Matched | Linked | Data |
|:---:|:---:|:---:|:---:|
| 99.57% | 90.47% | 70.31% | 99.37% |
| 99.57% | 90.62% | 70.31% | 99.37% |
units 952/1027 complete, functions 12350/12563 matched.
units 952/1027 complete, functions 12355/12563 matched.
decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data
<!-- progress:end -->

View File

@@ -1075,11 +1075,11 @@ config.libs = [
Object(Matching, "nwc24/NWC24Utils.c"),
Object(Matching, "nwc24/NWC24Manage.c"),
Object(Matching, "nwc24/NWC24MsgObj.c"),
Object(NonMatching, "nwc24/NWC24MBoxCtrl.c"),
Object(Matching, "nwc24/NWC24MBoxCtrl.c"),
Object(Matching, "nwc24/NWC24Mime.c"),
Object(Matching, "nwc24/NWC24Stream.c"),
Object(Matching, "nwc24/NWC24Parser.c"),
Object(NonMatching, "nwc24/NWC24MsgCommit.c"),
Object(Matching, "nwc24/NWC24MsgCommit.c"),
Object(Matching, "nwc24/NWC24MsgRead.c"),
Object(NonMatching, "nwc24/NWC24MsgSubject.c"),
Object(Matching, "nwc24/NWC24Schedule.c"),

View File

@@ -38,6 +38,19 @@ namespace EGG {
virtual void calc(); // 0x30
#ifdef EGG_AUDIO_EXPMGR_NO_INLINE_VIRTUALS
virtual bool startSound(nw4r::snd::SoundHandle* pHandle, u32 id); // 0x34
virtual bool startSound(nw4r::snd::SoundHandle* pHandle, unsigned int id); // 0x38
virtual bool startSound(nw4r::snd::SoundHandle* pHandle, const char* pName); // 0x3C
virtual bool prepareSound(nw4r::snd::SoundHandle* pHandle, u32 id); // 0x44
virtual bool prepareSound(nw4r::snd::SoundHandle* pHandle, unsigned int id); // 0x44
virtual bool prepareSound(nw4r::snd::SoundHandle* pHandle, const char* pName); // 0x48
virtual bool holdSound(nw4r::snd::SoundHandle* pHandle, u32 id); // 0x50
virtual bool holdSound(nw4r::snd::SoundHandle* pHandle, unsigned int id); // 0x50
virtual bool holdSound(nw4r::snd::SoundHandle* pHandle, const char* pName); // 0x58
#else
virtual bool startSound(nw4r::snd::SoundHandle* pHandle, u32 id) { return mSoundArchivePlayer.StartSound(pHandle, id); } // 0x34
virtual bool startSound(nw4r::snd::SoundHandle* pHandle, unsigned int id) { return mSoundArchivePlayer.StartSound(pHandle, id); } // 0x38
virtual bool startSound(nw4r::snd::SoundHandle* pHandle, const char* pName) NO_INLINE {
@@ -66,6 +79,7 @@ namespace EGG {
u32 id = changeNameToId(pName);
return mSoundArchivePlayer.HoldSound(pHandle, id);
} // 0x58
#endif
u32 changeNameToId(const char* pName) { return mpArchive->ConvertLabelStringToSoundId(pName); }
const char* changeIdToName(u32 id) { return mpArchive->GetSoundLabelString(id); }

View File

@@ -19,6 +19,10 @@ namespace EGG {
~SoundHeapMgr() { destroySoundHeap(); }
#ifdef EGG_AUDIO_EXPMGR_NO_INLINE_VIRTUALS
virtual bool loadState(s32 id); // 0x08
virtual s32 getCurrentLevel(); // 0x0C
#else
virtual bool loadState(s32 id) {
#ifdef IPL_SOUND_MATCHING
if (id > 0 && mHeap.GetCurrentLevel() >= id) {
@@ -35,6 +39,7 @@ namespace EGG {
} // 0x08
virtual s32 getCurrentLevel() { return mHeap.GetCurrentLevel(); } // 0x0C
#endif
s32 saveState() { return mHeap.SaveState(); }

View File

@@ -1,3 +1,5 @@
#define EGG_AUDIO_EXPMGR_NO_INLINE_VIRTUALS
#include <egg/core.h>
namespace EGG {

View File

@@ -19,8 +19,13 @@ namespace nw4r {
template <typename T>
class AutoLock : private NonCopyable {
public:
#ifdef EGG_AUDIO_EXPMGR_NO_INLINE_VIRTUALS
explicit AutoLock(T& rLockObj);
~AutoLock();
#else
explicit AutoLock(T& rLockObj) : mLockObj(rLockObj) { Lock(rLockObj); }
~AutoLock() { Unlock(mLockObj); }
#endif
private:
T& mLockObj; // 0x00

View File

@@ -303,9 +303,7 @@ static void TMCJPEG_814F0A58(TMCCJPEGDecWork* work, s32 x, s32 y) {
u8* lumaTexture;
u8* luminance;
s32 column;
s32 chromaXEnd;
s32 row;
u32 chromaTileWidth;
TMCCJPEGDecState* state;
s32 width;
s32 height;
@@ -316,7 +314,6 @@ static void TMCJPEG_814F0A58(TMCCJPEGDecWork* work, s32 x, s32 y) {
u8* cb;
u32 tileWidth;
u8* cr;
s32 chromaRowSkip;
row = y;
luminance = work->convBuf + 4;
@@ -341,18 +338,17 @@ static void TMCJPEG_814F0A58(TMCCJPEGDecWork* work, s32 x, s32 y) {
x = (u32)x >> 1;
width = 8 / state->scaleFactor;
height = 8 / state->scaleFactor;
chromaXEnd = x + width;
xEnd = x + width;
chromaYEnd = y + height;
chromaTileWidth = state->chromaWidth >> 3;
chromaRowSkip = 8 - width;
for (; y < chromaYEnd; y++) {
for (column = x; column < chromaXEnd; column += 1) {
(cbTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cb + 128;
tileWidth = state->chromaWidth >> 3;
for (row = y; row < chromaYEnd; row++) {
for (column = x; column < xEnd; column += 1) {
(cbTexture + ((row & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (row >> 2) * tileWidth) << 5)] = *cb + 128;
cb++;
(crTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cr + 128;
(crTexture + ((row & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (row >> 2) * tileWidth) << 5)] = *cr + 128;
cr++;
}
cb += chromaRowSkip;
cb += 8 - width;
cr += 8 - width;
}
}

View File

@@ -753,8 +753,7 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
if (!componentTable) {
componentCount = Zi8GetTableCount(1, 7, work);
componentOrdinals = (ziU8*)Zi8GetTableAddress(1, 7, work);
componentCursor = (ziU8*)Zi8GetTableAddress(1, 2, work);
componentTable = componentCursor;
componentTable = componentCursor = (ziU8*)Zi8GetTableAddress(1, 2, work);
componentCursor += 8;
--componentCount;
componentIndex = componentCount;

View File

@@ -41,7 +41,7 @@ ziBool Zi8_81480224(ziUserWord* word ZI_NEED_WORK) {
current = ZI_WORK->uwdList;
while (current != 0) {
candidate = (ziUserWord*)current->word;
if (ZI_WORK->unk_0x12E == 1 && word->priority > candidate->priority) break;
if (ZI_WORK->unk_0x12E == 1 && candidate->priority < word->priority) break;
if (candidate->length == length) {
position = 0;
while (position < length) {

View File

@@ -41,6 +41,13 @@ ziU32 ZiDAWGGetChild(ziU32 node) {
return node;
}
typedef struct ziDawgLongOffset {
ziU8 flags;
ziU8 middle;
ziU8 low;
} ziDawgLongOffset;
typedef char ziDawgLongOffsetSizeCheck[(sizeof(ziDawgLongOffset) == 3) ? 1 : -1];
ziU8* ZiDAWGGetSibling(ziU8* cursor) {
ziS32 depth;
ziU8* node;
@@ -70,14 +77,14 @@ ziU8* ZiDAWGGetSibling(ziU8* cursor) {
}
if ((*cursor & 0x80) != 0) {
node += (*cursor & 0x7f) * 0x10000 +
(((ziU32)cursor[1] << 8) + (ziU32)cursor[2]) + 0x8000;
node += (((const ziDawgLongOffset*)cursor)->flags & 0x7f) * 0x10000 +
(((ziU32)(ziU16)cursor[1] << 8) +
((const ziDawgLongOffset*)cursor)->low) + 0x8000;
} else {
node = cursor[1] + (node + (ziU16)*cursor * 0x100);
}
return node;
} else {
cursor = node;
do {
header = nodeHeaderTable[cursor[0] >> 4];
if ((cursor[0] & 0xf) == 0xf) {

View File

@@ -25,6 +25,12 @@ ziU8 Zi8GetFormatVersion(ziU8 ZI_NEED_WORK);
ziPtr Zi8GetTableAddress(ziU8, ziU8 ZI_NEED_WORK);
ziU16 Zi8Uni2Ord(ziWChar ZI_NEED_WORK);
typedef struct ziEncodedOrdinal {
ziU8 low;
ziU8 high;
} ziEncodedOrdinal;
typedef char ziEncodedOrdinalSizeCheck[(sizeof(ziEncodedOrdinal) == 2) ? 1 : -1];
ziBool Zi8IsWordW(ziWChar* word, ziU8 language ZI_NEED_WORK) {
ziChineseEntry* table = 0;
ziU8* baseData = 0;
@@ -134,10 +140,10 @@ ziBool Zi8IsWordW(ziWChar* word, ziU8 language ZI_NEED_WORK) {
countLeft = count;
cursor = ordinals;
while (countLeft > 0) {
value = (data[1] << 8) | data[0];
value = ((ziU32)(ziU16)data[1] << 8) |
((const ziEncodedOrdinal*)data)->low;
data += 2;
cursor++;
if (value != *cursor) break;
if (value != *++cursor) break;
countLeft--;
if (value & 0x8000) break;
}

View File

@@ -64,7 +64,7 @@ static NWC24Err ClearMBCEntry(MBCHeader* header, NWC24File* file, u32 offset);
static NWC24Err MountVFMBox(NWC24MBoxType type);
static NWC24Err CopyMsgObjToMBCFmt(const NWC24MsgObjPrivate* msg, MBCEntry* entry);
static NWC24Err CopyMsgObjToPrvFmt(const MBCEntry* entry, NWC24MsgObjPrivate* msg) NO_INLINE;
BOOL NWC24iIsMsgObjReadable(const MBCEntry* entry) NO_INLINE;
BOOL NWC24iIsMsgObjReadable(MBCEntry* entry) NO_INLINE;
NWC24Err NWC24CreateVF(const char* path, u32 size);
static inline NWC24Err MakeCtrlPath(char* path, NWC24MBoxType type) {
@@ -221,7 +221,7 @@ NWC24Err NWC24GetMsgObj(NWC24MsgObj* msg, NWC24MBoxType type, u32 id) {
return result;
}
BOOL NWC24iIsMsgObjReadable(const MBCEntry* entry) {
BOOL NWC24iIsMsgObjReadable(MBCEntry* entry) {
if (!(entry->type & 0x200000))
return FALSE;
if (entry->type & 0xFE000000)

View File

@@ -769,19 +769,14 @@ static NWC24Err WriteMIMEAttachHeader(NWC24MsgObjPrivate* msg, u32 index) {
char* buffer;
const char* mime;
const char* suffix;
s32 typeLength, encodingLength, dispositionLength, mimeLength;
int mimeLength;
s32 first, second, third, total;
NWC24Err err;
Mail_memset(NWC24WorkP->stringWork, 0, 1024);
buffer = NWC24WorkP->stringWork;
mime = NWC24GetMIMETypeStr(msg->attachedType[index]);
suffix = NWC24iGetMIMETypeSuffix(msg->attachedType[index]);
encodingLength = Mail_strlen(ContentTxEncA);
typeLength = Mail_strlen(ContentTypeA);
dispositionLength = Mail_strlen(ContentDispA);
typeLength += encodingLength;
mimeLength = Mail_strlen(mime);
mimeLength = (dispositionLength + typeLength) + mimeLength + 4;
mimeLength = (Mail_strlen(ContentTypeA) + Mail_strlen(ContentTxEncA)) + Mail_strlen(ContentDispA) + Mail_strlen(mime) + 4;
if (mimeLength >= 1024)
return NWC24_ERR_NOMEM;
first = Mail_sprintf(buffer, (char*)ContentTypeA, mime, (char)('a' + index), msg->msgId, suffix);

File diff suppressed because it is too large Load Diff

View File

@@ -3582,3 +3582,360 @@ KBDSetModState 99.40476%: modifier address versus old value r4/r5 allocation, fo
WriteMIMEAttachHeader 99.61957%: type versus disposition lengths and sum result coalescing, five operands.
Zi8PrepareMatch 96.319145%: local stack/code layout and component-presence stores without semantic reads, 939/940 instructions.
Uncertainty: original source construct responsible for the JPEG two-instruction schedule and zprepare dead component flag is unresolved. No unsupported volatility or dummy field retained. Current-round exact source commit: 7ea5a033.
# Xhigh continuation fz15g
Fresh branch agent/w1002/sol-fz15g-xhigh from bc303bc36e5ea826ef9da39d6e9c9ed9c79e4ba9. All four owned files identical to origin/main after fetch. All four pools identical before code tuning. Start exact counts NWC 17/18, JPEG 11/13, keyboard 15/21, zprepare 0/1. Previous helper match retained unchanged.
## fz15g WriteMIMEAttachHeader diagnosis
Origin body unchanged; current structural/exact (0, 5), 92/92 instructions. Frame 0x30, five differences at 25/28/30/32/33 map to measured prefix lengths. Library Mail_strlen returns int, while current locals use long typedef s32. No store/reload volatility proof. Test library result types and direct call-expression boundary before register search.
- WriteMIMEAttachHeader: strlen result locals use int return type: structural/exact (0, 5) instructions 92/92 first [(25, ('mr', 'r29, r3'), ('mr', 'r30, r3')), (28, ('mr', 'r30, r3'), ('mr', 'r29, r3')), (30, ('add', 'r28, r29, r28'), ('add', 'r30, r30, r28')), (32, ('add', 'r0, r3, r30'), ('add', 'r0, r29, r30'))]
- WriteMIMEAttachHeader: formatted byte counts use int return type: structural/exact (0, 5) instructions 92/92 first [(25, ('mr', 'r29, r3'), ('mr', 'r30, r3')), (28, ('mr', 'r30, r3'), ('mr', 'r29, r3')), (30, ('add', 'r28, r29, r28'), ('add', 'r30, r30, r28')), (32, ('add', 'r0, r3, r30'), ('add', 'r0, r29, r30'))]
- WriteMIMEAttachHeader: all library return values use int locals: structural/exact (0, 5) instructions 92/92 first [(25, ('mr', 'r29, r3'), ('mr', 'r30, r3')), (28, ('mr', 'r30, r3'), ('mr', 'r29, r3')), (30, ('add', 'r28, r29, r28'), ('add', 'r30, r30, r28')), (32, ('add', 'r0, r3, r30'), ('add', 'r0, r29, r30'))]
- WriteMIMEAttachHeader: nested library-call capacity tree 0: structural/exact (0, 0) instructions 92/92 first []
## fz15g TMCJPEGDEC_set_converterY8U8V8 diagnosis
Origin body unchanged; current structural/exact (41, 195), 195/196 instructions. Frame 0x10, 195/196 instructions; target early shared convBuf base r4 is folded into individual work addresses. Extent ends at immediate neighbour; no volatility proof. Test typed sample-block ownership, int dimensions and dimension helper boundary.
- TMCJPEGDEC_set_converterY8U8V8: decoder dimensions read through separate const view: structural/exact (41, 195) instructions 195/196
- TMCJPEGDEC_set_converterY8U8V8: component and dimensions use C int locals: structural/exact (41, 195) instructions 195/196
- TMCJPEGDEC_set_converterY8U8V8: texture dimensions owned by inline state helper: structural/exact (41, 195) instructions 195/196
- TMCJPEGDEC_set_converterY8U8V8: conversion sample buffer represented as typed block: structural/exact (41, 195) instructions 195/196
## fz15g WriteMIMEAttachHeader exact
The nested strlen call expression preserves the original evaluation boundary. MWCC evaluates the right operand of the first addition, ContentTxEncA, before ContentTypeA; the expression result now owns the target r30 length sum instead of the scalar encoding local. All five operand differences disappear: 92/92 instructions, ctxdiff diffs 0, identical 9-string pool. Quick full-build gate confirms NWC 18/18 functions, code 8532/8532, data 904/904, all sections 100, no regressions/forbidden/readability. Keep NonMatching classification for this phase as instructed.
## fz15g TMCJPEGDEC_set_converterY8U8V8 Address arithmetic uses a typed sample-word base, preserving all real buffer offsets and object layout. No loads through reinterpreted word types.
## fz15g kbdEventHandler diagnosis
Origin body unchanged; current structural/exact (0, 5), 186/186 instructions. Frame 0x20, 186/186 instructions. First differing instruction 35 loads report error into r3 versus r5 and then table base r30 versus r3. All later instructions identical; no adjacent stack reload evidence. Test report signedness, explicit enum and readonly pointer view.
- TMCJPEGDEC_set_converterY8U8V8: converter buffer viewed as 32-bit sample words: structural/exact (41, 195) instructions 195/196
- kbdEventHandler: read report as const char data with unsigned modifier view: structural/exact (22, 106) instructions 192/186
- TMCJPEGDEC_set_converterY8U8V8: converter buffer viewed as signed 32-bit sample words: structural/exact (41, 195) instructions 195/196
- kbdEventHandler: unsigned error status and signed channel index snapshot: structural/exact (0, 6) instructions 186/186 first [(35, ('lbz', 'r3, 2(r4)'), ('lbz', 'r5, 2(r4)')), (36, ('lis', 'r4, 0'), ('lis', 'r3, 0')), (37, ('mulli', 'r5, r31, 0x268'), ('mulli', 'r4, r31, 0x268')), (38, ('addi', 'r0, r3, 0xff'), ('addi', 'r0, r5, 0xff'))]
- kbdEventHandler: report uses readonly void-to-byte input view: structural/exact (0, 5) instructions 186/186 first [(35, ('lbz', 'r3, 2(r4)'), ('lbz', 'r5, 2(r4)')), (36, ('lis', 'r30, 0'), ('lis', 'r3, 0')), (38, ('addi', 'r0, r3, 0xff'), ('addi', 'r0, r5, 0xff')), (39, ('addi', 'r30, r30, 0'), ('addi', 'r3, r3, 0'))]
- TMCJPEGDEC_set_converterY8U8V8: converter buffer viewed as 16-bit sample pairs: structural/exact (41, 195) instructions 195/196
- kbdEventHandler: report status has explicit HID error enum type: structural/exact (0, 6) instructions 186/186 first [(35, ('lbz', 'r4, 2(r4)'), ('lbz', 'r5, 2(r4)')), (36, ('lis', 'r30, 0'), ('lis', 'r3, 0')), (37, ('mulli', 'r3, r31, 0x268'), ('mulli', 'r4, r31, 0x268')), (38, ('addi', 'r0, r4, 0xff'), ('addi', 'r0, r5, 0xff'))]
The first const-char report trial changed signed key comparisons and is excluded from the valid attempt count. Re-run with unsigned casts on every report-byte read to preserve HID values 0x80..0xff. No trial was retained.
## fz15g kbdEventHandler Correct unsigned HID key comparisons in report representation trial.
- kbdEventHandler: const char report view with every byte explicitly unsigned: structural/exact (0, 5) instructions 186/186 first [(35, ('lbz', 'r3, 2(r4)'), ('lbz', 'r5, 2(r4)')), (36, ('lis', 'r30, 0'), ('lis', 'r3, 0')), (38, ('addi', 'r0, r3, 0xff'), ('addi', 'r0, r5, 0xff')), (39, ('addi', 'r30, r30, 0'), ('addi', 'r3, r3, 0'))]
## fz15g kbdProcMod diagnosis
Origin body unchanged; current structural/exact (0, 4), 256/256 instructions. Frame 0x20, identical instruction counts. Address/result r4/r5 differ in physical field update. Test modifier union word type and real reserved/lock bit layout; no volatility proof.
- kbdProcMod: modifier union uses unsigned int storage and bitfields: structural/exact (0, 4) instructions 256/256 first [(245, ('add', 'r5, r4, r31'), ('add', 'r4, r4, r31')), (246, ('lwz', 'r4, 0x220(r5)'), ('lwz', 'r5, 0x220(r4)')), (247, ('rlwimi', 'r0, r4, 0, 0x1a, 0x1f'), ('rlwimi', 'r0, r5, 0, 0x1a, 0x1f')), (248, ('stw', 'r0, 0x220(r5)'), ('stw', 'r0, 0x220(r4)'))]
- kbdProcMod: logical modifier bits split from reserved high bits: structural/exact (0, 4) instructions 256/256 first [(245, ('add', 'r5, r4, r31'), ('add', 'r4, r4, r31')), (246, ('lwz', 'r4, 0x220(r5)'), ('lwz', 'r5, 0x220(r4)')), (247, ('rlwimi', 'r0, r4, 0, 0x1a, 0x1f'), ('rlwimi', 'r0, r5, 0, 0x1a, 0x1f')), (248, ('stw', 'r0, 0x220(r5)'), ('stw', 'r0, 0x220(r4)'))]
- kbdProcMod: modifier union scalar follows unsigned int word type: structural/exact (0, 4) instructions 256/256 first [(245, ('add', 'r5, r4, r31'), ('add', 'r4, r4, r31')), (246, ('lwz', 'r4, 0x220(r5)'), ('lwz', 'r5, 0x220(r4)')), (247, ('rlwimi', 'r0, r4, 0, 0x1a, 0x1f'), ('rlwimi', 'r0, r5, 0, 0x1a, 0x1f')), (248, ('stw', 'r0, 0x220(r5)'), ('stw', 'r0, 0x220(r4)'))]
- kbdProcMod: modifier union scalar uses signed word representation: structural/exact (0, 4) instructions 256/256 first [(245, ('add', 'r5, r4, r31'), ('add', 'r4, r4, r31')), (246, ('lwz', 'r4, 0x220(r5)'), ('lwz', 'r5, 0x220(r4)')), (247, ('rlwimi', 'r0, r4, 0, 0x1a, 0x1f'), ('rlwimi', 'r0, r5, 0, 0x1a, 0x1f')), (248, ('stw', 'r0, 0x220(r5)'), ('stw', 'r0, 0x220(r4)'))]
## fz15g TMCJPEG_814F0A58 diagnosis
Origin body unchanged; current structural/exact (0, 77), 475/475 instructions. Frame 0x60, 475/475 instructions. Earlier implicit chroma padding and phase-shared tileWidth/xEnd resolves all registers but leaves subfic r6 and generated bound-mask rlwinm exchanged. Test readonly count helper and expression result ownership, not declaration permutations.
- kbdProcMod: physical modifier read owned by readonly union helper: structural/exact (0, 4) instructions 256/256 first [(245, ('add', 'r5, r4, r31'), ('add', 'r4, r4, r31')), (246, ('lwz', 'r4, 0x220(r5)'), ('lwz', 'r5, 0x220(r4)')), (247, ('rlwimi', 'r0, r4, 0, 0x1a, 0x1f'), ('rlwimi', 'r0, r5, 0, 0x1a, 0x1f')), (248, ('stw', 'r0, 0x220(r5)'), ('stw', 'r0, 0x220(r4)'))]
## fz15g KBDSetModState diagnosis
Origin body unchanged; current structural/exact (0, 4), 42/42 instructions. Frame 0x10, identical instruction counts. Address/result r4/r5 differ in physical field update. Test modifier union word type and real reserved/lock bit layout; no volatility proof.
- TMCJPEG_814F0A58: readonly decoder helper owns chroma sample count: structural/exact (34, 283) instructions 474/475
- TMCJPEG_814F0A58: readonly scale factor byte helper owns sample count: structural/exact (34, 283) instructions 474/475
- KBDSetModState: modifier union uses unsigned int storage and bitfields: structural/exact (0, 4) instructions 42/42 first [(30, ('add', 'r5, r5, r4'), ('add', 'r4, r5, r4')), (31, ('lwz', 'r4, 0x220(r5)'), ('lwz', 'r5, 0x220(r4)')), (32, ('rlwimi', 'r0, r4, 0, 0x1a, 0x1f'), ('rlwimi', 'r0, r5, 0, 0x1a, 0x1f')), (33, ('stw', 'r0, 0x220(r5)'), ('stw', 'r0, 0x220(r4)'))]
- KBDSetModState: logical modifier bits split from reserved high bits: structural/exact (0, 4) instructions 42/42 first [(30, ('add', 'r5, r5, r4'), ('add', 'r4, r5, r4')), (31, ('lwz', 'r4, 0x220(r5)'), ('lwz', 'r5, 0x220(r4)')), (32, ('rlwimi', 'r0, r4, 0, 0x1a, 0x1f'), ('rlwimi', 'r0, r5, 0, 0x1a, 0x1f')), (33, ('stw', 'r0, 0x220(r5)'), ('stw', 'r0, 0x220(r4)'))]
- TMCJPEG_814F0A58: chroma width and height initialize from shared helper value: structural/exact (2, 2) instructions 475/475 first [(274, ('rlwinm', 'r0, r26, 0, 0, 0'), ('subfic', 'r6, r6, 8')), (275, ('subfic', 'r6, r6, 8'), ('rlwinm', 'r0, r26, 0, 0, 0'))]
- KBDSetModState: modifier union scalar follows unsigned int word type: structural/exact (0, 4) instructions 42/42 first [(30, ('add', 'r5, r5, r4'), ('add', 'r4, r5, r4')), (31, ('lwz', 'r4, 0x220(r5)'), ('lwz', 'r5, 0x220(r4)')), (32, ('rlwimi', 'r0, r4, 0, 0x1a, 0x1f'), ('rlwimi', 'r0, r5, 0, 0x1a, 0x1f')), (33, ('stw', 'r0, 0x220(r5)'), ('stw', 'r0, 0x220(r4)'))]
- KBDSetModState: modifier union scalar uses signed word representation: structural/exact (0, 4) instructions 42/42 first [(30, ('add', 'r5, r5, r4'), ('add', 'r4, r5, r4')), (31, ('lwz', 'r4, 0x220(r5)'), ('lwz', 'r5, 0x220(r4)')), (32, ('rlwimi', 'r0, r4, 0, 0x1a, 0x1f'), ('rlwimi', 'r0, r5, 0, 0x1a, 0x1f')), (33, ('stw', 'r0, 0x220(r5)'), ('stw', 'r0, 0x220(r4)'))]
- TMCJPEG_814F0A58: phase-shared variables use C int arithmetic: structural/exact (2, 2) instructions 475/475 first [(274, ('rlwinm', 'r0, r26, 0, 0, 0'), ('subfic', 'r6, r6, 8')), (275, ('subfic', 'r6, r6, 8'), ('rlwinm', 'r0, r26, 0, 0, 0'))]
- KBDSetModState: physical modifier read owned by readonly union helper: structural/exact (0, 4) instructions 42/42 first [(30, ('add', 'r5, r5, r4'), ('add', 'r4, r5, r4')), (31, ('lwz', 'r4, 0x220(r5)'), ('lwz', 'r5, 0x220(r4)')), (32, ('rlwimi', 'r0, r4, 0, 0x1a, 0x1f'), ('rlwimi', 'r0, r5, 0, 0x1a, 0x1f')), (33, ('stw', 'r0, 0x220(r5)'), ('stw', 'r0, 0x220(r4)'))]
- TMCJPEG_814F0A58: phase-shared tile width uses unsigned int arithmetic: structural/exact (2, 2) instructions 475/475 first [(274, ('rlwinm', 'r0, r26, 0, 0, 0'), ('subfic', 'r6, r6, 8')), (275, ('subfic', 'r6, r6, 8'), ('rlwinm', 'r0, r26, 0, 0, 0'))]
## fz15g kbd_led_handler diagnosis
Origin body unchanged; current structural/exact (13, 21), 24/25 instructions. Frame absent, 24/25 instructions. Target reads callback before device release, branches success-first and rematerializes callback index after result selection, then has a final blr. Test index lifetime and positive guard/helper boundaries.
- kbd_led_handler: success-first switch with callback index cast at each use: structural/exact (10, 18) instructions 25/25
- kbd_led_handler: success-first switch with signed int callback index: structural/exact (10, 18) instructions 25/25
- kbd_led_handler: callback completion enclosed by positive presence branch: structural/exact (10, 18) instructions 25/25
- kbd_led_handler: ordinary null callback guard with success-first switch: structural/exact (10, 18) instructions 25/25
- kbd_led_handler: original callback argument owns final callback lookup: structural/exact (2, 20) instructions 26/25
## fz15g TMCJPEG_814F0A58 Limit expression/readonly helper change to chroma so exact luma phase is unchanged. Test shared assignment value, nested vertical bound and real factor snapshot.
- kbd_led_handler: callback address snapshot before command release: structural/exact (10, 18) instructions 25/25
- kbd_led_handler: inline completion helper uses readonly callback argument: structural/exact (9, 19) instructions 26/25
- TMCJPEG_814F0A58: chroma count expression chained: structural/exact (2, 2) instructions 475/475 first [(274, ('rlwinm', 'r0, r26, 0, 0, 0'), ('subfic', 'r6, r6, 8')), (275, ('subfic', 'r6, r6, 8'), ('rlwinm', 'r0, r26, 0, 0, 0'))]
- TMCJPEG_814F0A58: chroma count expression directbounds: structural/exact (2, 2) instructions 475/475 first [(274, ('rlwinm', 'r0, r26, 0, 0, 0'), ('subfic', 'r6, r6, 8')), (275, ('subfic', 'r6, r6, 8'), ('rlwinm', 'r0, r26, 0, 0, 0'))]
- TMCJPEG_814F0A58: chroma count expression scale: structural/exact (2, 2) instructions 475/475 first [(274, ('rlwinm', 'r0, r26, 0, 0, 0'), ('subfic', 'r6, r6, 8')), (275, ('subfic', 'r6, r6, 8'), ('rlwinm', 'r0, r26, 0, 0, 0'))]
- TMCJPEG_814F0A58: chroma count expression scoped: structural/exact (2, 2) instructions 475/475 first [(274, ('rlwinm', 'r0, r26, 0, 0, 0'), ('subfic', 'r6, r6, 8')), (275, ('subfic', 'r6, r6, 8'), ('rlwinm', 'r0, r26, 0, 0, 0'))]
- TMCJPEG_814F0A58: chroma count expression helper: structural/exact (2, 2) instructions 475/475 first [(274, ('rlwinm', 'r0, r26, 0, 0, 0'), ('subfic', 'r6, r6, 8')), (275, ('subfic', 'r6, r6, 8'), ('rlwinm', 'r0, r26, 0, 0, 0'))]
- TMCJPEG_814F0A58: chroma count expression ptrhelper: structural/exact (2, 2) instructions 475/475 first [(274, ('rlwinm', 'r0, r26, 0, 0, 0'), ('subfic', 'r6, r6, 8')), (275, ('subfic', 'r6, r6, 8'), ('rlwinm', 'r0, r26, 0, 0, 0'))]
## fz15g kbd_led_handler Original-argument tail lookup improved structural distance to two, with 26/25 instructions. Test integer conversion type and distinct completion index scope without casts on memory accesses.
- kbd_led_handler: callback tail index representation unsignedint: structural/exact (2, 20) instructions 26/25
- kbd_led_handler: callback tail index representation signedint: structural/exact (2, 20) instructions 26/25
- kbd_led_handler: callback tail index representation ulong: structural/exact (2, 20) instructions 26/25
- kbd_led_handler: callback tail index representation constvoid: structural/exact (2, 20) instructions 26/25
- kbd_led_handler: callback tail index representation earlyint: structural/exact (2, 20) instructions 26/25
- kbd_led_handler: callback tail index representation scopedidx: structural/exact (2, 20) instructions 26/25
Best callback tail candidate disassembly pairs:
```
0 ('lis', 'r5, 0') | ('lis', 'r5, 0')
1 ('lis', 'r7, 0') | ('lis', 'r6, 0')
2 ('slwi', 'r0, r4, 3') | ('slwi', 'r0, r4, 3')
3 ('li', 'r6, 0') | ('li', 'r8, 0')
4 ('addi', 'r5, r5, 0') | ('addi', 'r5, r5, 0')
5 ('slwi', 'r8, r4, 5') | ('slwi', 'r7, r4, 5')
6 ('lwzx', 'r0, r5, r0') | ('lwzx', 'r0, r5, r0')
7 ('addi', 'r7, r7, 0') | ('addi', 'r6, r6, 0')
8 ('stwx', 'r6, r7, r8') | ('stwx', 'r8, r6, r7')
9 ('cmplw', 'r0, r6') | ('cmplw', 'r0, r8')
10 ('beqlr', '') | ('beqlr', '')
11 ('cmpwi', 'r3, 1') | ('cmpwi', 'r3, 1')
12 ('beq', '8') | ('bne', '12')
13 ('b', '12') | ('li', 'r3, 0')
14 ('li', 'r3, 0') | ('b', '8')
15 ('b', '8') | ('li', 'r3, 7')
16 ('li', 'r3, 7') | ('lis', 'r5, 0')
17 ('lis', 'r5, 0') | ('slwi', 'r0, r4, 3')
18 ('slwi', 'r0, r4, 3') | ('addi', 'r5, r5, 0')
19 ('addi', 'r5, r5, 0') | ('lwzx', 'r12, r5, r0')
20 ('lwzx', 'r12, r5, r0') | ('add', 'r4, r5, r0')
21 ('add', 'r4, r5, r0') | ('lwz', 'r4, 4(r4)')
22 ('lwz', 'r4, 4(r4)') | ('mtctr', 'r12')
23 ('mtctr', 'r12') | ('bctr', '')
24 ('bctr', '') | ('blr', '')
25 ('blr', '') | None
```
## fz15g Zi8PrepareMatch diagnosis
Origin body unchanged; current structural/exact (36, 889), 939/940 instructions. Target frame 0x70, source 939 versus target 940 instructions. First context-mask init register differs, and target stores component presence at byte 0xf without later reads. Existing -opt off explains stack reloads, so no unsupported volatile/dummy flag added. Test readonly table/request views and scalar expression boundary.
- Zi8PrepareMatch: all lookup table fields are readonly byte pointers: structural/exact (36, 897) instructions 938/940
- Zi8PrepareMatch: read fields use const input while request count remains writable: structural/exact (43, 692) instructions 944/940
- Zi8PrepareMatch: context mask stored as char with explicit unsigned view: structural/exact (37, 834) instructions 940/940
- Zi8PrepareMatch: element index advance separated from halfword fetch: structural/exact (44, 889) instructions 939/940
- Zi8PrepareMatch: component classifier uses direct boolean branch: structural/exact (36, 889) instructions 939/940
## fz15g KBDSetLedsAsync diagnosis
Origin body unchanged; current structural/exact (14, 70), 80/81 instructions. Target frame 0x20. Reservation loop uses unsigned ordinal and byte offset/CTR; source caches channel multiplication across interrupts and uses 80/81 instructions. Test readonly input helper boundary and typed slot loop, preserving all command record layout.
- KBDSetLedsAsync: slot helper rereads channel through const scalar pointer: structural/exact (20, 44) instructions 81/81
- KBDSetLedsAsync: slot helper receives channel scalar value: structural/exact (19, 73) instructions 79/81
- KBDSetLedsAsync: slot helper receives readonly channel object: structural/exact (19, 73) instructions 79/81
- KBDSetLedsAsync: unsigned indexed slot loop uses record device fields: structural/exact (19, 72) instructions 79/81
## fz15g KBDSetLeds diagnosis
Origin body unchanged; current structural/exact (19, 75), 75/79 instructions. Target frame 0x20. Reservation loop uses unsigned ordinal and byte offset/CTR; source caches channel multiplication across interrupts and uses 75/79 instructions. Test readonly input helper boundary and typed slot loop, preserving all command record layout.
- KBDSetLeds: slot helper rereads channel through const scalar pointer: structural/exact (48, 75) instructions 82/79
- KBDSetLeds: slot helper receives channel scalar value: structural/exact (19, 69) instructions 78/79
- KBDSetLeds: slot helper receives readonly channel object: structural/exact (19, 69) instructions 78/79
- KBDSetLeds: unsigned indexed slot loop uses record device fields: structural/exact (19, 68) instructions 78/79
## fz15g kbd_led_handler Combine target true-first if with original-argument index rematerialization. Previous isolated switch contains one extra unconditional branch; if should remove it while preserving final blr.
- kbd_led_handler: true-first if plus original-argument completion base: structural/exact (30, 23) instructions 23/25
- kbd_led_handler: true-first if plus original-argument completion null: structural/exact (30, 23) instructions 23/25
- kbd_led_handler: true-first if plus original-argument completion zero: structural/exact (30, 23) instructions 23/25
- kbd_led_handler: true-first if plus original-argument completion constzero: structural/exact (30, 23) instructions 23/25
## fz15g TMCJPEG_814F0A58 Test actual chroma sample signedness, source increment expression and pointer-add operand order at fixed chroma preheader dependency graph.
- kbd_led_handler: true-first if plus original-argument completion callint: structural/exact (30, 23) instructions 23/25
- kbd_led_handler: true-first if plus original-argument completion sdk: structural/exact (30, 23) instructions 23/25
- TMCJPEG_814F0A58: chroma output pointer initialization nestedstore: structural/exact (101, 408) instructions 473/475
- TMCJPEG_814F0A58: chroma output pointer initialization signedsample: structural/exact (2, 2) instructions 475/475 first [(274, ('rlwinm', 'r0, r26, 0, 0, 0'), ('subfic', 'r6, r6, 8')), (275, ('subfic', 'r6, r6, 8'), ('rlwinm', 'r0, r26, 0, 0, 0'))]
- TMCJPEG_814F0A58: chroma output pointer initialization paddingneg: structural/exact (2, 2) instructions 475/475 first [(274, ('rlwinm', 'r0, r26, 0, 0, 0'), ('subfic', 'r6, r6, 8')), (275, ('subfic', 'r6, r6, 8'), ('rlwinm', 'r0, r26, 0, 0, 0'))]
- TMCJPEG_814F0A58: chroma output pointer initialization pointeradd: structural/exact (2, 2) instructions 475/475 first [(274, ('rlwinm', 'r0, r26, 0, 0, 0'), ('subfic', 'r6, r6, 8')), (275, ('subfic', 'r6, r6, 8'), ('rlwinm', 'r0, r26, 0, 0, 0'))]
## fz15g TMCJPEG_814F0A58 Test signed-loop unroller boundary and explicit body/iterator forms at the two-instruction preheader plateau.
- TMCJPEG_814F0A58: chroma loop shape while: structural/exact (2, 2) instructions 475/475 first [(274, ('rlwinm', 'r0, r26, 0, 0, 0'), ('subfic', 'r6, r6, 8')), (275, ('subfic', 'r6, r6, 8'), ('rlwinm', 'r0, r26, 0, 0, 0'))]
- TMCJPEG_814F0A58: chroma loop shape do: structural/exact (204, 413) instructions 305/475
## fz15g kbd_led_handler Test callback BOOL result ownership and parameter mutation versus separate unsigned result; preserve original argument for final callback index.
- TMCJPEG_814F0A58: chroma loop shape commute: structural/exact (2, 2) instructions 475/475 first [(274, ('rlwinm', 'r0, r26, 0, 0, 0'), ('subfic', 'r6, r6, 8')), (275, ('subfic', 'r6, r6, 8'), ('rlwinm', 'r0, r26, 0, 0, 0'))]
- kbd_led_handler: completion result lifetime parameter: structural/exact (30, 23) instructions 23/25
- kbd_led_handler: completion result lifetime ternary: structural/exact (30, 23) instructions 23/25
- TMCJPEG_814F0A58: chroma loop shape ystepfirst: structural/exact (2, 2) instructions 475/475 first [(274, ('rlwinm', 'r0, r26, 0, 0, 0'), ('subfic', 'r6, r6, 8')), (275, ('subfic', 'r6, r6, 8'), ('rlwinm', 'r0, r26, 0, 0, 0'))]
- kbd_led_handler: completion result lifetime BOOL: structural/exact (5, 9) instructions 25/25 first [(1, ('lis', 'r7, 0'), ('lis', 'r6, 0')), (3, ('li', 'r6, 0'), ('li', 'r8, 0')), (5, ('slwi', 'r8, r4, 5'), ('slwi', 'r7, r4, 5')), (7, ('addi', 'r7, r7, 0'), ('addi', 'r6, r6, 0'))]
- kbd_led_handler: completion result lifetime switchsame: structural/exact (5, 9) instructions 25/25 first [(1, ('lis', 'r7, 0'), ('lis', 'r6, 0')), (3, ('li', 'r6, 0'), ('li', 'r8, 0')), (5, ('slwi', 'r8, r4, 5'), ('slwi', 'r7, r4, 5')), (7, ('addi', 'r7, r7, 0'), ('addi', 'r6, r6, 0'))]
- TMCJPEG_814F0A58: chroma loop shape finishcount: structural/exact (2, 2) instructions 475/475 first [(274, ('rlwinm', 'r0, r26, 0, 0, 0'), ('subfic', 'r6, r6, 8')), (275, ('subfic', 'r6, r6, 8'), ('rlwinm', 'r0, r26, 0, 0, 0'))]
- kbd_led_handler: completion result lifetime returnhelper: structural/exact (30, 23) instructions 23/25
## fz15g kbd_led_handler BOOL return representation removed the extra switch branch. Combine it with target positive-case layout, then vary command-address/zero ownership.
- kbd_led_handler: callback BOOL result and positive switch base: structural/exact (2, 20) instructions 26/25
- kbd_led_handler: callback BOOL result and positive switch null: structural/exact (9, 19) instructions 26/25
- kbd_led_handler: callback BOOL result and positive switch cmdptr: structural/exact (2, 20) instructions 26/25
- kbd_led_handler: callback BOOL result and positive switch earlyptr: structural/exact (2, 20) instructions 26/25
- kbd_led_handler: callback BOOL result and positive switch zero: structural/exact (9, 19) instructions 26/25
- kbd_led_handler: callback BOOL result and positive switch reloadguard: structural/exact (2, 20) instructions 26/25
- kbd_led_handler: callback BOOL result and positive switch signedidx: structural/exact (2, 20) instructions 26/25
- kbd_led_handler: callback BOOL result and positive switch param: structural/exact (2, 20) instructions 26/25
## fz15g kbd_led_handler The target retains final blr after tail call. Test a real shared exit and positive callback guard with direct if result selection.
- kbd_led_handler: callback single exit shape goto: structural/exact (30, 23) instructions 23/25
- kbd_led_handler: callback single exit shape positive: structural/exact (30, 23) instructions 23/25
- kbd_led_handler: callback single exit shape positiveNULL: structural/exact (30, 23) instructions 23/25
- kbd_led_handler: callback single exit shape dupcall: structural/exact (33, 23) instructions 26/25
## fz15g TMCJPEG_814F0A58 Reverse which source plane owns named row padding, and use the C int type rather than long. This distinguishes width use lifetime from explicit padding definition.
- TMCJPEG_814F0A58: named row padding int in cr plane: structural/exact (0, 62) instructions 475/475
- TMCJPEG_814F0A58: named row padding unsigned int in cr plane: structural/exact (0, 62) instructions 475/475
- TMCJPEG_814F0A58: named row padding s32 in cr plane: structural/exact (0, 62) instructions 475/475
- TMCJPEG_814F0A58: named row padding int in both plane: structural/exact (21, 220) instructions 475/475
- TMCJPEG_814F0A58: named row padding unsigned int in both plane: structural/exact (21, 220) instructions 475/475
- TMCJPEG_814F0A58: named row padding s32 in both plane: structural/exact (21, 220) instructions 475/475
## fz15g owned data and extents audit
JPEG has no owned data sections; NWC 904/904 and keyboard 5296/5296 data bytes already pair exactly. No symbol rename or extent change justified there.
target zprepare data relocations: 0->Zi8PrepareMatch+0x260, 4->Zi8PrepareMatch+0x1e4, 8->Zi8PrepareMatch+0x1f4, 12->Zi8PrepareMatch+0x204, 16->Zi8PrepareMatch+0x214, 20->Zi8PrepareMatch+0x224, 24->Zi8PrepareMatch+0x234, 28->Zi8PrepareMatch+0x244, 32->Zi8PrepareMatch+0x254, 36->Zi8PrepareMatch+0x260, 40->Zi8PrepareMatch+0x260, 44->Zi8PrepareMatch+0x204
source zprepare data relocations: 0->Zi8PrepareMatch+0x250, 4->Zi8PrepareMatch+0x1d4, 8->Zi8PrepareMatch+0x1e4, 12->Zi8PrepareMatch+0x1f4, 16->Zi8PrepareMatch+0x204, 20->Zi8PrepareMatch+0x214, 24->Zi8PrepareMatch+0x224, 28->Zi8PrepareMatch+0x234, 32->Zi8PrepareMatch+0x244, 36->Zi8PrepareMatch+0x250, 40->Zi8PrepareMatch+0x250, 44->Zi8PrepareMatch+0x1f4
Relocation proof: all twelve entries in target jumptable_8166B3D0 (48 bytes) point inside nonmatching Zi8PrepareMatch; source @230 is the corresponding compiler-generated switch table with different code offsets. This is a code-layout gap; @230 is not a stable real source object name, so no rename. Extab 8 bytes exact, extabindex 12 differs by nonmatching function extent; no data-type size correction.
Zi8PrepareMatch extent 0x814850fc..0x81485fac, next CDBInit 0x81485fac, overlap 0.
CheckMsgBoxSpace extent 0x814a731c..0x814a7698, next SynthesizeAddrStr 0x814a7698, overlap 0.
WriteMIMEAttachHeader extent 0x814a8064..0x814a81d4, next WriteContentTypeField 0x814a81d4, overlap 0.
TMCJPEGDEC_set_converterY8U8V8 extent 0x814efb9c..0x814efeac, next TMCJPEG_814EFEAC 0x814efeac, overlap 0.
TMCJPEG_814F0A58 extent 0x814f0a58..0x814f11c4, next TMCJPEG_814F11C4 0x814f11c4, overlap 0.
kbdEventHandler extent 0x815f34d8..0x815f37c0, next kbdRepeatHandler 0x815f37c0, overlap 0.
kbdProcMod extent 0x815f3aa4..0x815f3ea4, next kbdSendKey 0x815f3ea4, overlap 0.
kbd_led_handler extent 0x815f3fb4..0x815f4018, next KBDSetLedsAsync 0x815f4018, overlap 0.
KBDSetLedsAsync extent 0x815f4018..0x815f415c, next KBDSetLeds 0x815f415c, overlap 0.
KBDSetLeds extent 0x815f415c..0x815f4298, next kbdInitMap 0x815f4298, overlap 0.
KBDSetModState extent 0x815f4664..0x815f470c, next KBDTranslateHidCode 0x815f470c, overlap 0.
## fz15g TMCJPEG_814F0A58 Continue already diagnosed chroma preheader. Retire dimension locals after bound formation, reuse them for real source padding, or use the prior row induction local; no dummy values.
- TMCJPEG_814F0A58: chroma dimension lifetime widthpadding: structural/exact (21, 126) instructions 475/475
- TMCJPEG_814F0A58: chroma dimension lifetime heightpadding: structural/exact (21, 126) instructions 475/475
- TMCJPEG_814F0A58: chroma dimension lifetime reusebound: structural/exact (21, 140) instructions 475/475
- TMCJPEG_814F0A58: chroma dimension lifetime rowvariable: structural/exact (0, 0) instructions 475/475 first []
## fz15g TMCJPEG_814F0A58 exact candidate
Reusing the existing row induction variable for the chroma loop, rather than incrementing the incoming y parameter, resolves the last two preheader scheduling instructions after sharing xEnd/tileWidth and expressing source padding directly. Both loops use row=original y; y is not used after the chroma loop, so output semantics are unchanged. Raw source/target symbol bytes identical, 1900 bytes and 475/475 instructions; branch-correct declsearch score (0,0). ctxdiff still emits four false CR1-branch differences because its normalizer uses operand zero rather than the branch target, and the converter-setup function remains four bytes shorter. Existing tool bug also affects eleven pre-existing exact converters; no tool or symbol edits.
The queued last-stage keyboard declaration check was cancelled before modifying source: shared git-fetch lock was occupied by another worker fetch for several minutes. Those functions already received their required origin fetch/check and distinct structural trials earlier this round.
JPEG candidate quick full-build gate: GATE PASS, objdiff 12/13 functions and code 15164/15948 (before 11/13, 13264/15948), no regressions/forbidden/readability warnings, DOL hash correct. Gate instruction-exact remains 2/13 solely because of the unchanged CR1 normalizer issue documented above; raw bytes prove the new converter exact. NWC remains 18/18 and 8532/8532 with 904/904 data.
## fz15g kbdEventHandler final declaration search
Continue the function already fetched/diagnosed this round; its body still equals the fetched origin snapshot. Structural trials exhausted; test actual declaration block last.
Declaration-search output for kbdEventHandler:
```
declaration block:
KBDChannel* data;
u8* bytes;
u8 status;
start (0, 5)
best (0, 5) after 6 builds; source restored; best order was:
KBDChannel* data;
u8* bytes;
u8 status;
```
## fz15g kbdProcMod final declaration search
Continue the function already fetched/diagnosed this round; its body still equals the fetched origin snapshot. Structural trials exhausted; test actual declaration block last.
Declaration-search output for kbdProcMod:
```
declaration block:
KBDChannel* data;
u32 modState;
s32 delta;
u8 flags;
start (0, 4)
best (0, 4) after 13 builds; source restored; best order was:
KBDChannel* data;
u32 modState;
s32 delta;
u8 flags;
```
## fz15g KBDSetModState final declaration search
Continue the function already fetched/diagnosed this round; its body still equals the fetched origin snapshot. Structural trials exhausted; test actual declaration block last.
Declaration-search output for KBDSetModState:
```
declaration block:
BOOL interrupts;
KBDModifierState oldState;
KBDModifierState newState;
start (0, 4)
best (0, 4) after 6 builds; source restored; best order was:
BOOL interrupts;
KBDModifierState oldState;
KBDModifierState newState;
```
## fz15g TMCJPEGDEC_set_converterY8U8V8 Continue previously fetched and diagnosed converter setup. Test byte-buffer address ownership as integer SDK address arithmetic and readonly buffer view; every base remains the real convBuf member, without pinned labels or numeric work offsets.
- TMCJPEGDEC_set_converterY8U8V8: shared conversion address representation address: structural/exact (41, 195) instructions 195/196
- TMCJPEGDEC_set_converterY8U8V8: shared conversion address representation pointeraddress: structural/exact (41, 195) instructions 195/196
- TMCJPEGDEC_set_converterY8U8V8: shared conversion address representation constaddress: structural/exact (41, 195) instructions 195/196
## fz15g pre-final completeness audit
Only two source changes retained: exact WriteMIMEAttachHeader and TMCJPEG_814F0A58. All other source trials restored; no header/config/symbol changes. Every remaining function has at least three distinct valid compiled source trials this round. Count excludes the unsigned-HID bug in the first const-char trial and excludes compile failures.
Zi8PrepareMatch: 5 distinct valid current-round compiled source trials; remains open.
TMCJPEGDEC_set_converterY8U8V8: 10 distinct valid current-round compiled source trials; remains open.
kbdEventHandler: 4 distinct valid current-round compiled source trials; remains open.
kbdProcMod: 5 distinct valid current-round compiled source trials; remains open.
kbd_led_handler: 36 distinct valid current-round compiled source trials; remains open.
KBDSetLedsAsync: 4 distinct valid current-round compiled source trials; remains open.
KBDSetLeds: 4 distinct valid current-round compiled source trials; remains open.
KBDSetModState: 5 distinct valid current-round compiled source trials; remains open.
Gate keyboard count 14/21 versus objdiff 15/21 is also a normalization artifact: KBDResetChannel raw symbol bytes are identical; odiff misnormalizes CR1 bne/beq at 5/26 from instruction address, yielding 24-byte false differences because earlier unmatched LED functions differ in length. Correct last-operand branch normalization scores (0,0). No tool changes.
Commits so far: 36ff398b NWC header measurement expression; e4b0d291 JPEG row induction. Remote main advanced while other workers fetched; this branch remains on its authorized starting base, without rebase or unrelated changes.
## fz15g final full clean gate
```
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[libs/RevoEX/src/nwc24/NWC24MsgCommit] pool: IDENTICAL
[libs/RevoEX/src/nwc24/NWC24MsgCommit] objdiff: code 8532/8532 data 904/904 functions 18/18 fuzzy 100.0000 linked code 0
[libs/RevoEX/src/nwc24/NWC24MsgCommit] instruction-exact functions: 18/18
[libs/RevoEX/src/nwc24/NWC24MsgCommit] section .bss size 64 match 100.0
[libs/RevoEX/src/nwc24/NWC24MsgCommit] section .data size 680 match 100.0
[libs/RevoEX/src/nwc24/NWC24MsgCommit] section .sbss size 8 match 100.0
[libs/RevoEX/src/nwc24/NWC24MsgCommit] section .sdata size 152 match 100.0
[libs/RevoEX/src/nwc24/NWC24MsgCommit] section .text size 8532 match 100.0
[libs/RevoEX/src/nwc24/NWC24MsgCommit] baseline: code 8164/8532 data 904 functions 17 fuzzy 99.9836
[libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoY8U8V8] pool: IDENTICAL
[libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoY8U8V8] objdiff: code 15164/15948 data None/None functions 12/13 fuzzy 99.6453 linked code 0
[libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoY8U8V8] instruction-exact functions: 2/13
[libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoY8U8V8] section .text size 15948 match 99.64535
[libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoY8U8V8] below 100: TMCJPEGDEC_set_converterY8U8V8 92.78571
[libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoY8U8V8] baseline: code 13264/15948 data None functions 11 fuzzy 99.5275
[libs/RVL_SDK/src/kbd/kbd_lib] pool: IDENTICAL
[libs/RVL_SDK/src/kbd/kbd_lib] objdiff: code 3088/5764 data 5296/5296 functions 15/21 fuzzy 97.7044 linked code 0
[libs/RVL_SDK/src/kbd/kbd_lib] instruction-exact functions: 14/21
[libs/RVL_SDK/src/kbd/kbd_lib] section .bss size 3968 match 100.0
[libs/RVL_SDK/src/kbd/kbd_lib] section .data size 1304 match 100.0
[libs/RVL_SDK/src/kbd/kbd_lib] section .sbss size 16 match 100.0
[libs/RVL_SDK/src/kbd/kbd_lib] section .sdata size 8 match 100.0
[libs/RVL_SDK/src/kbd/kbd_lib] section .text size 5764 match 97.70437
[libs/RVL_SDK/src/kbd/kbd_lib] below 100: kbdEventHandler 99.83871
[libs/RVL_SDK/src/kbd/kbd_lib] below 100: kbdProcMod 99.90234
[libs/RVL_SDK/src/kbd/kbd_lib] below 100: kbd_led_handler 64.12
[libs/RVL_SDK/src/kbd/kbd_lib] below 100: KBDSetLedsAsync 86.234566
[libs/RVL_SDK/src/kbd/kbd_lib] below 100: KBDSetLeds 84.6076
[libs/RVL_SDK/src/kbd/kbd_lib] below 100: KBDSetModState 99.40476
[libs/RVL_SDK/src/kbd/kbd_lib] baseline: code 3088/5764 data 5296 functions 15 fuzzy 97.7044
[libs/RVLMiddleware/eZiText/src/clib/zprepare] pool: IDENTICAL
[libs/RVLMiddleware/eZiText/src/clib/zprepare] objdiff: code None/3760 data 8/68 functions 0/1 fuzzy 96.3191 linked code 0
[libs/RVLMiddleware/eZiText/src/clib/zprepare] instruction-exact functions: 0/1
[libs/RVLMiddleware/eZiText/src/clib/zprepare] section .data size 48 match None
[libs/RVLMiddleware/eZiText/src/clib/zprepare] section .text size 3760 match 96.319145
[libs/RVLMiddleware/eZiText/src/clib/zprepare] section extab size 8 match 100.0
[libs/RVLMiddleware/eZiText/src/clib/zprepare] section extabindex size 12 match 91.66667
[libs/RVLMiddleware/eZiText/src/clib/zprepare] below 100: Zi8PrepareMatch 96.319145
[libs/RVLMiddleware/eZiText/src/clib/zprepare] baseline: code None/3760 data 8 functions 0 fuzzy 96.3191
regressions vs baseline: 0
global matched_code_percent: 90.43582 -> 90.51154
global fuzzy_match_percent: 99.56486 -> 99.56554
global complete_code_percent: 70.30611 -> 70.30611
global matched_data_percent: 99.36596 -> 99.36596
forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
GATE PASS
```
## fz15g final per-unit before -> after
main/libs/RevoEX/src/nwc24/NWC24MsgCommit: objdiff exact functions 17 -> 18/18, code bytes 8164 -> 8532/8532, data bytes 904 -> 904/904.
main/libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoY8U8V8: objdiff exact functions 11 -> 12/13, code bytes 13264 -> 15164/15948, data bytes 0 -> 0/0.
main/libs/RVL_SDK/src/kbd/kbd_lib: objdiff exact functions 15 -> 15/21, code bytes 3088 -> 3088/5764, data bytes 5296 -> 5296/5296.
main/libs/RVLMiddleware/eZiText/src/clib/zprepare: objdiff exact functions 0 -> 0/1, code bytes 0 -> 0/3760, data bytes 8 -> 8/68.
Gate instruction-exact counts NWC 17 -> 18, JPEG 2 -> 2, keyboard 14 -> 14, zprepare 0 -> 0. Branch-correct instruction equality and objdiff confirm JPEG 11 -> 12 and keyboard 15 -> 15; raw-byte proof and the existing CR1 normalizer artifact are documented above.
## fz15g final open functions and attempt audit
TMCJPEGDEC_set_converterY8U8V8 92.78571%: shared convBuf address folded into case addresses, 195/196 instructions; dimension scheduling also differs; 10 distinct valid compiled current-round source trials.
kbdEventHandler 99.83871%: initial report status uses r3 and table base r30 instead of r5 and r3; five operand differences, 186/186 instructions; 4 distinct valid compiled current-round source trials.
kbdProcMod 99.90234%: inlined modifier setter address and old-state value swap r4/r5; four operands, 256/256 instructions; 5 distinct valid compiled current-round source trials.
kbd_led_handler 64.12%: callback-index rematerialization and success/default branch shape; retained source 24/25 instructions, best rejected BOOL trial 25/25 with nine differences; 36 distinct valid compiled current-round source trials.
KBDSetLedsAsync 86.234566%: channel-stride cached across interrupt calls and slot-loop address/ordinal form; retained source 80/81 instructions; 4 distinct valid compiled current-round source trials.
KBDSetLeds 84.6076%: channel-stride caching and command-slot loop pointer form; retained source 75/79 instructions; 4 distinct valid compiled current-round source trials.
KBDSetModState 99.40476%: modifier address and prior word swap r4/r5; four operand differences, 42/42 instructions; 5 distinct valid compiled current-round source trials.
Zi8PrepareMatch 96.319145%: target component branch stores a local flag absent in source, plus local/branch scheduling; retained source 939/940 instructions, switch relocations remain code-dependent; 5 distinct valid compiled current-round source trials.
Changed files: libs/RevoEX/src/nwc24/NWC24MsgCommit.c; libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoY8U8V8.c; tools/decomp-assist/fz15.attempts.md. Exact source commits: 36ff398b and e4b0d291. Final log-only commit follows this audit.
Uncertainty: original source forms for converter shared-base preservation, keyboard allocator/LED loop behavior, and the zprepare component branch remain unresolved. No unsupported volatile declaration or dummy component flag added. zprepare data remains 8/68 because the unpaired compiler table points into nonexact code, with no legitimate stable source-name rename or extent correction.

View File

@@ -455,3 +455,417 @@ GATE PASS
```
HIGH before -> after, instruction-exact/code/data bytes: zi8cgetc 5/4168/144 -> 5/4168/144; zmtkey 3/1488/60 -> 3/1488/60; zconvert 3/1380/112 -> 3/1380/112; tiPcKeyboard 140/28064/18548 -> 140/28064/18564. The gate passes, DOL SHA1 is exact, no regressions. The required instruction-exact count increase is still unmet. The retained data correction makes keyboard data 100% without changing section size or any code.
## MAX continuation, 2026-10-02
HEAD 5518cb16fda3091c727d974aacf477a2cf89b74a; fetched origin/main; owned sources and symbol config equal origin/main. No source changes carried from XHIGH. Parked zmtkey/zconvert/tiPcKeyboard excluded.
Baseline quick gate:
```
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] pool: IDENTICAL
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] objdiff: code 4168/47816 data 144/536 functions 5/8 fuzzy 96.4008 linked code 0
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] instruction-exact functions: 5/8
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section .data size 392 match None
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section .sbss2 size 8 match 100.0
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section .sdata2 size 16 match 100.0
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section .text size 47816 match 96.40079
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section extab size 48 match 100.0
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section extabindex size 72 match 100.0
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] below 100: ZiMatchZHSpelling 98.80165
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] below 100: zi8InternalGetZH 95.99054
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] below 100: Zi8GetElementCount 99.347824
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] baseline: code 4168/47816 data 144 functions 5 fuzzy 96.4008
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] pool: IDENTICAL
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] objdiff: code 10376/10604 data 192/192 functions 24/25 fuzzy 99.8491 linked code 0
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] instruction-exact functions: 24/25
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] section .data size 168 match 100.0
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] section .sbss size 8 match 100.0
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] section .sdata size 16 match 100.0
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] section .text size 10604 match 99.84911
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] below 100: NWC24iIsMsgObjReadable 92.98245
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] baseline: code 10376/10604 data 192 functions 24 fuzzy 99.8491
[libs/RVL_SDK/src/fa/pf_cache] pool: IDENTICAL
[libs/RVL_SDK/src/fa/pf_cache] objdiff: code 6464/7396 data None/None functions 35/36 fuzzy 99.7755 linked code 0
[libs/RVL_SDK/src/fa/pf_cache] instruction-exact functions: 35/36
[libs/RVL_SDK/src/fa/pf_cache] section .text size 7396 match 99.77555
[libs/RVL_SDK/src/fa/pf_cache] below 100: PFCACHE_DoWriteNumSectorAndFreeIfNeeded 98.21889
[libs/RVL_SDK/src/fa/pf_cache] baseline: code 6464/7396 data None functions 35 fuzzy 99.7755
regressions vs baseline: 0
global matched_code_percent: 90.40604 -> 90.40604
global fuzzy_match_percent: 99.56056 -> 99.56056
global complete_code_percent: 70.30611 -> 70.30611
global matched_data_percent: 99.36596 -> 99.36596
forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
GATE PASS
```
All three pools checked first: IDENTICAL (0/0, 8/8, 0/0).
MAX spelling diagnosis: 121/121 instructions, same 0x130 frame, array positions 0x88/0x8, branch operands and inline call boundaries. Only consistent coloring differs: candidate r27->r28, spelling r22->r23, length parameter r23->r24, work r28->r29, match r29->r27, candidateLength r24->r22. Function extent 0x1e4 ends exactly at next engine. No immediate stack store/reload; volatile unproven and excluded.
- MAX sM01 ZiMatchZHSpelling: keep candidate length as declared unsigned word returned by the counting helper; insns 121/121, structural/exact diffs (0, 29), fuzzy 98.80165, code 4168, data 144. Restored pending gates.
- MAX sM02 ZiMatchZHSpelling: keep prefix status as unsigned integer Boolean; insns 121/121, structural/exact diffs (0, 29), fuzzy 98.80165, code 4168, data 144. Restored pending gates.
- MAX sM03 ZiMatchZHSpelling: keep both prefix status and candidate count unsigned; insns 121/121, structural/exact diffs (0, 29), fuzzy 98.80165, code 4168, data 144. Restored pending gates.
- MAX sM04 ZiMatchZHSpelling: compute candidate length through a signed count conversion; insns 121/121, structural/exact diffs (0, 29), fuzzy 98.80165, code 4168, data 144. Restored pending gates.
- MAX sM05 ZiMatchZHSpelling: reuse prefix index as candidate length after prefix comparison; insns 122/121, structural/exact diffs (4, 92), fuzzy 97.31405, code 4168, data 72. Restored pending gates.
- MAX sM06 ZiMatchZHSpelling: initialize candidate cursor from incoming candidate before initial length call; insns 122/121, structural/exact diffs (1, 116), fuzzy 97.975204, code 4168, data 72. Restored pending gates.
- MAX sM07 ZiMatchZHSpelling: hold candidate length as signed long; insns 121/121, structural/exact diffs (0, 29), fuzzy 98.80165, code 4168, data 144. Restored pending gates.
- MAX sM08 ZiMatchZHSpelling: scope candidate length around both prefix and phonetic processing; insns 125/121, structural/exact diffs (16, 123), fuzzy 91.818184, code 4168, data 24. Restored pending gates.
- MAX sM09 ZiMatchZHSpelling: use caller-saved count result with a signed helper return declaration; insns 121/121, structural/exact diffs (0, 29), fuzzy 98.80165, code 4168, data 144. Restored pending gates.
- MAX sM10 ZiMatchZHSpelling: use a Boolean-byte prefix status with explicit full-word return; insns 122/121, structural/exact diffs (4, 98), fuzzy 97.06612, code 4168, data 72. Restored pending gates.
- MAX sM11 ZiMatchZHSpelling: use halfword candidate character count; insns 121/121, structural/exact diffs (1, 29), fuzzy 98.34711, code 4168, data 144. Restored pending gates.
- MAX sM12 ZiMatchZHSpelling: use narrow candidate character count matching space-helper argument; insns 121/121, structural/exact diffs (1, 29), fuzzy 98.34711, code 4168, data 144. Restored pending gates.
- MAX sM13 ZiMatchZHSpelling: reuse incoming candidate for phonetic traversal instead of a second pointer; insns 121/121, structural/exact diffs (0, 31), fuzzy 98.67769, code 4168, data 96. Restored pending gates.
- MAX sM14 ZiMatchZHSpelling: reuse incoming spelling for phonetic traversal instead of a second pointer; insns 121/121, structural/exact diffs (0, 34), fuzzy 98.59504, code 4168, data 96. Restored pending gates.
- MAX sM15 ZiMatchZHSpelling: derive prefix failure status from the compared candidate character; insns 134/121, structural/exact diffs (23, 122), fuzzy 87.181816, code 4168, data 24. Restored pending gates.
- MAX sM16 ZiMatchZHSpelling: scope candidate length to initial declaration and prefix status separately; insns 125/121, structural/exact diffs (16, 123), fuzzy 91.818184, code 4168, data 24. Restored pending gates.
MAX spelling declaration search after 16 source trials: declaration block: | ziWChar* candidateCursor; | ziWChar* spellingCursor; | int index; | int matches; | int candidateLength; | ziWChar spacedSpelling[64]; | ziWChar spacedCandidate[64]; | start (0, 29) | best (0, 29) after 52 builds; source restored; best order was: | ziWChar* candidateCursor; | ziWChar* spellingCursor; | int index; | int matches; | int candidateLength; | ziWChar spacedSpelling[64]; | ziWChar spacedCandidate[64]; |
MAX engine diagnosis: target/source 10676/10676 instructions, frame 0x4e0 and all local stack offsets identical. No neighbour overlap (0xa6d0 ends at Zi8NewMatchPhonetic). After branch-aware alignment and register normalization, the known residual structural stream comprises 12 extra and 10 missing return-register copies plus two missing halfword conversions. These are real code-generation differences; the four generated switch-table relocations refer into this inexact function, so their .data gap is code work. Prior width/cast correction alone grows by two instructions.
- MAX gM01 zi8InternalGetZH: spell traditional charset result as an explicit nonzero bit test; insns 10676/10676, structural/exact diffs (9080, 10068), fuzzy 95.99054, code 4168, data 144. Restored pending gates.
- MAX gM02 zi8InternalGetZH: invert traditional charset branch around the shared range reset; insns 10676/10676, structural/exact diffs (9080, 10068), fuzzy 95.99054, code 4168, data 144. Restored pending gates.
- MAX gM03 zi8InternalGetZH: perform traditional charset short-circuit through nested negative guard; insns 10676/10676, structural/exact diffs (9080, 10068), fuzzy 95.99054, code 4168, data 144. Restored pending gates.
- MAX gM04 zi8InternalGetZH: make component cursor a const pointer to const record data for read-only traversal; BUILD FAIL ext/src/clib/zi8cgetc.d build/43U/src/libs/RVLMiddleware/eZiText/src/clib/zi8cgetc.d ### mwcceppc.exe Compiler: # File: libs\RVLMiddleware\eZiText\src\clib\zi8cgetc.c # ------------------------------------------------------- # 757: componentTable = componentCursor; # Error: ^ # (10209) illegal implicit conversion from 'const unsigned char *' to # 'unsigned char *' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. . Restored pending gates.
- MAX gM05 zi8InternalGetZH: give component cursor definition volatile storage shown by immediate stack reload after assignment; BUILD FAIL ddleware/eZiText/src/clib/zi8cgetc.d ### mwcceppc.exe Compiler: # File: libs\RVLMiddleware\eZiText\src\clib\zi8cgetc.c # ------------------------------------------------------- # 2106: &componentIndex, &componentCursor, work)) { # Error: ^ # (10209) illegal implicit conversion from 'unsigned char *volatile *' to # 'unsigned char **' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. . Restored pending gates.
- MAX gM06 zi8InternalGetZH: give frequency cursor definition volatile storage shown by immediate stack reload after table call; insns 10676/10676, structural/exact diffs (9080, 10068), fuzzy 95.99054, code 4168, data 144. Restored pending gates.
- MAX gM07 zi8InternalGetZH: narrow paired code returns and order masks on the left; insns 10678/10676, structural/exact diffs (10222, 10519), fuzzy 96.090294, code 4168, data 72. Restored pending gates.
- MAX gM08 zi8InternalGetZH: consume counted table address through one assignment to both cursor and table; insns 10676/10676, structural/exact diffs (7556, 9311), fuzzy 96.27482, code 4168, data 144. Restored pending gates.
- MAX gM09 zi8InternalGetZH: emit context character after advancing the emitted-word count separately; insns 10673/10676, structural/exact diffs (9040, 10045), fuzzy 95.96759, code 4168, data 72. Restored pending gates.
- MAX gM11 zi8InternalGetZH: use signed full-word result for phonetic-code interface without changing casts; insns 10676/10676, structural/exact diffs (9080, 10068), fuzzy 95.99054, code 4168, data 144. Restored pending gates.
- MAX gM12 zi8InternalGetZH: declare phonetic and context record tables as const input arrays; BUILD FAIL are/eZiText/src/clib/zi8cgetc.d ### mwcceppc.exe Compiler: # File: libs\RVLMiddleware\eZiText\src\clib\zi8cgetc.c # ------------------------------------------------------- # 874: match.phon[0], match.phon2[0], charset, work)) candidateStatus = 1; # Error: ^ # (10209) illegal implicit conversion from 'const unsigned char *' to # 'void *' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. . Restored pending gates.
- MAX gM10 zi8InternalGetZH: keep options parameter read-only in engine and private phonetic helper; insns 10676/10676, structural/exact diffs (7556, 9311), fuzzy 96.27482, code 4168, data 144. Restored pending gates.
- MAX gM13 zi8InternalGetZH: group all match scalars at their first use through initialized local declarations; insns 10676/10676, structural/exact diffs (7830, 9407), fuzzy 96.202415, code 4168, data 144. Restored pending gates.
MAX retained gM08: combine cursor/table initialization into the natural chained assignment. The two pointers intentionally receive the same dictionary address. Engine fuzzy 95.99054 -> 96.27482, instruction count still 10676/10676; no new exact function. Quick authority gate PASS, all exact functions preserved, data 144/536 unchanged, pool identical, DOL exact, no regressions/forbidden/readability failures.
```
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] pool: IDENTICAL
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] objdiff: code 4168/47816 data 144/536 functions 5/8 fuzzy 96.6547 linked code 0
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] instruction-exact functions: 5/8
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section .data size 392 match None
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section .sbss2 size 8 match 100.0
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section .sdata2 size 16 match 100.0
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section .text size 47816 match 96.65468
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section extab size 48 match 100.0
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section extabindex size 72 match 100.0
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] below 100: ZiMatchZHSpelling 98.80165
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] below 100: zi8InternalGetZH 96.27482
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] below 100: Zi8GetElementCount 99.347824
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] baseline: code 4168/47816 data 144 functions 5 fuzzy 96.4008
regressions vs baseline: 0
global matched_code_percent: 90.40604 -> 90.40604
global fuzzy_match_percent: 99.56056 -> 99.56462
global complete_code_percent: 70.30611 -> 70.30611
global matched_data_percent: 99.36596 -> 99.36596
forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
GATE PASS
```
- MAX gM14 zi8InternalGetZH: on chained-table baseline, narrow both paired phonetic codes to target halfword width; insns 10678/10676, structural/exact diffs (8713, 9803), fuzzy 96.492134, code 4168, data 72. Restored pending gates.
- MAX gM15 zi8InternalGetZH: narrow paired codes and express simplified charset as separate branches; insns 10678/10676, structural/exact diffs (7258, 9196), fuzzy 96.048615, code 4168, data 72. Restored pending gates.
- MAX gM16 zi8InternalGetZH: narrow paired codes and express traditional charset as separate branches; insns 10678/10676, structural/exact diffs (7250, 9196), fuzzy 96.048615, code 4168, data 72. Restored pending gates.
- MAX gM17 zi8InternalGetZH: keep all table addresses as byte-pointer interface returns within this unit; BUILD FAIL zi8cgetc.d build/43U/src/libs/RVLMiddleware/eZiText/src/clib/zi8cgetc.d ### mwcceppc.exe Compiler: # File: libs\RVLMiddleware\eZiText\src\clib\zi8cgetc.c # ------------------------------------------------------- # 2648: phoneticOffsets = Zi8GetTableAddress(1, 13, work); # Error: ^ # (10209) illegal implicit conversion from 'unsigned char *' to # 'unsigned short *' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. . Restored pending gates.
- MAX gM18 zi8InternalGetZH: use native int return for secondary matcher while preserving byte truncation; insns 10676/10676, structural/exact diffs (7556, 9311), fuzzy 96.27482, code 4168, data 144. Restored pending gates.
- MAX gM19 zi8InternalGetZH: chained initialization of frequency table and its starting cursor; insns 10682/10676, structural/exact diffs (10304, 10644), fuzzy 95.96422, code 4168, data 24. Restored pending gates.
- MAX gM20 zi8InternalGetZH: replace phrase-pattern union integer member with native unsigned-long member; insns 10676/10676, structural/exact diffs (7556, 9311), fuzzy 96.27482, code 4168, data 144. Restored pending gates.
- MAX gM21 zi8InternalGetZH: correct phonetic-code return to ziU16 on chained table baseline; insns 10678/10676, structural/exact diffs (8713, 9803), fuzzy 96.492134, code 4168, data 72. Restored pending gates.
- MAX gM22 zi8InternalGetZH: use explicit narrow conversion at every returned format-version test; insns 10676/10676, structural/exact diffs (7556, 9311), fuzzy 96.27482, code 4168, data 144. Restored pending gates.
- MAX gM23 zi8InternalGetZH: split successful table presence and format-version conditions into nested checks; insns 10676/10676, structural/exact diffs (7556, 9311), fuzzy 96.27482, code 4168, data 144. Restored pending gates.
- MAX gM24 zi8InternalGetZH: spell primary matcher branch failure with an explicit byte comparison; insns 10676/10676, structural/exact diffs (7556, 9311), fuzzy 96.27482, code 4168, data 144. Restored pending gates.
- MAX gM25 zi8InternalGetZH: scope the option pointer as a read-only local view; BUILD FAIL ibs/RVLMiddleware/eZiText/src/clib/zi8cgetc.d ### mwcceppc.exe Compiler: # File: libs\RVLMiddleware\eZiText\src\clib\zi8cgetc.c # ------------------------------------------------------- # 2312: charsetFilter, output, work)) goto engine_finish; # Error: ^ # (10209) illegal implicit conversion from 'const struct *' to # 'struct *' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. . Restored pending gates.
- MAX gM04 zi8InternalGetZH: make component cursor a const pointer to const record data for read-only traversal; BUILD FAIL bs/RVLMiddleware/eZiText/src/clib/zi8cgetc.d ### mwcceppc.exe Compiler: # File: libs\RVLMiddleware\eZiText\src\clib\zi8cgetc.c # ------------------------------------------------------- # 756: tTable = componentCursor = (ziU8*)Zi8GetTableAddress(1, 2, work); # Error: ^ # (10209) illegal implicit conversion from 'const unsigned char *' to # 'unsigned char *' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. . Restored pending gates.
- MAX gM05 zi8InternalGetZH: give component cursor definition volatile storage shown by immediate stack reload after assignment; insns 10676/10676, structural/exact diffs (7556, 9311), fuzzy 96.27482, code 4168, data 144. Restored pending gates.
- MAX gM12 zi8InternalGetZH: declare phonetic and context record tables as const input arrays; BUILD FAIL eware/eZiText/src/clib/zi8cgetc.d ### mwcceppc.exe Compiler: # File: libs\RVLMiddleware\eZiText\src\clib\zi8cgetc.c # ------------------------------------------------------- # 1619: phraseOrdinal, &candidateOrdinal, 0, work)) continue; # Error: ^ # (10209) illegal implicit conversion from 'const unsigned char *' to # 'unsigned char *' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. . Restored pending gates.
MAX GetElementCount diagnosis: source/target 115/115 instructions, 0x230 frame and array/separator offsets identical, branch forms and all operand orders equal. Consistent count/elementCount r28/r27 swap gives 13 differences. No store followed immediately by reload at helper boundary (the saved separator reload follows a call), so no volatile. Extent 0x1cc reaches next symbol exactly. Prior return-elementIndex variation had one return-register difference, worth following with explicit count synchronization and initialization-order trials. Fetched origin/main again; still open.
- MAX cM01 Zi8GetElementCount: return the consumed-input index equivalent to the separately counted inputs; insns 115/115, structural/exact diffs (0, 1), fuzzy 99.95652, code 4168, data 144. Restored pending gates.
- MAX cM02 Zi8GetElementCount: synchronize consumed count from input index at return; insns 116/115, structural/exact diffs (3, 22), fuzzy 98.434784, code 4168, data 72. Restored pending gates.
- MAX cM03 Zi8GetElementCount: assign returned count from consumed index in the return expression; insns 116/115, structural/exact diffs (3, 22), fuzzy 98.434784, code 4168, data 72. Restored pending gates.
- MAX cM04 Zi8GetElementCount: initialize input traversal before result count in the chained zero assignment; insns 115/115, structural/exact diffs (0, 14), fuzzy 99.26087, code 4168, data 144. Restored pending gates.
- MAX cM05 Zi8GetElementCount: initialize result count last in source order of the chain; insns 115/115, structural/exact diffs (0, 14), fuzzy 99.21739, code 4168, data 144. Restored pending gates.
- MAX cM06 Zi8GetElementCount: start chained input indices at zero through result count assignment; insns 115/115, structural/exact diffs (0, 14), fuzzy 99.21739, code 4168, data 144. Restored pending gates.
- MAX cM07 Zi8GetElementCount: hold input element index as wider unsigned integer with explicit byte reads; insns 115/115, structural/exact diffs (1, 13), fuzzy 98.86957, code 4168, data 144. Restored pending gates.
- MAX cM08 Zi8GetElementCount: preserve incoming element limit as a const local byte; insns 116/115, structural/exact diffs (1, 108), fuzzy 98.478264, code 4168, data 24. Restored pending gates.
- MAX cM09 Zi8GetElementCount: derive count through consumed index only when the loop exits through its limit; insns 121/115, structural/exact diffs (9, 32), fuzzy 93.347824, code 4168, data 24. Restored pending gates.
- MAX cM10 Zi8GetElementCount: restore saved separator through an ordinary scalar instead of single-field state; insns 113/115, structural/exact diffs (8, 106), fuzzy 97.48695, code 4168, data 24. Restored pending gates.
- MAX cM11 Zi8GetElementCount: split the input-limit and character-remaining loop conditions without changing order; insns 115/115, structural/exact diffs (10, 56), fuzzy 92.17391, code 4168, data 144. Restored pending gates.
- MAX cM12 Zi8GetElementCount: return promoted consumed count through an enum-typed local; insns 115/115, structural/exact diffs (2, 13), fuzzy 98.391304, code 4168, data 144. Restored pending gates.
MAX GetElementCount declaration search: declaration block: | ziU8 spacedIndex; | ziU8 elementIndex; | ziU8 count; | ziWChar spacedElements[256]; | start (0, 13) | best (0, 13) after 13 builds; source restored; best order was: | ziU8 spacedIndex; | ziU8 elementIndex; | ziU8 count; | ziWChar spacedElements[256];
cM01 returns the equivalent elementIndex but leaves an unused count variable; rejected as an artificial partial improvement, not retained. Explicit synchronization adds an instruction and regresses exception data. All remaining candidates restored.
MAX NWC24iIsMsgObjReadable diagnosis: fetched origin/main, source unchanged there; open 92.98245%. 57/57 instructions, identical 0x10 frame, same branches, calls, field offsets and expression operands after prologue. Target saves LR/r31 and copies the input before loading type; source schedules the type load/mask through those three prologue operations. No immediate stack reload or neighbour overlap (0xe4 ends at next public function). Remaining unit data already 192/192 including corrected MountInfo extent; no data changes needed. Prior readonly views and full-body helper did not change this scheduling.
- MAX nM01 NWC24iIsMsgObjReadable: use an opaque constant input and explicit typed readonly mailbox view; insns 57/57, structural/exact diffs (4, 5), fuzzy 92.98245, code 10376, data 192. Restored pending gates.
- MAX nM02 NWC24iIsMsgObjReadable: use private message-object view for common type/app/LED header fields; insns 57/57, structural/exact diffs (4, 5), fuzzy 92.98245, code 10376, data 192. Restored pending gates.
- MAX nM03 NWC24iIsMsgObjReadable: use signed shift of readable type bit instead of mask predicate; insns 57/57, structural/exact diffs (4, 5), fuzzy 92.98245, code 10376, data 192. Restored pending gates.
- MAX nM04 NWC24iIsMsgObjReadable: scope read type and subsequent validation in explicit positive branch; insns 57/57, structural/exact diffs (15, 50), fuzzy 85.789474, code 10376, data 192. Restored pending gates.
- MAX nM05 NWC24iIsMsgObjReadable: make first type validity mask an enum-valued flag constant; insns 57/57, structural/exact diffs (4, 5), fuzzy 92.98245, code 10376, data 192. Restored pending gates.
- MAX nM06 NWC24iIsMsgObjReadable: use whole unsigned type word local for initial three type predicates only; insns 57/57, structural/exact diffs (4, 5), fuzzy 92.98245, code 10376, data 192. Restored pending gates.
- MAX nM07 NWC24iIsMsgObjReadable: return the Boolean app-mask comparison through an explicit local result; insns 57/57, structural/exact diffs (4, 5), fuzzy 92.98245, code 10376, data 192. Restored pending gates.
- MAX nM08 NWC24iIsMsgObjReadable: delay independent app/LED readonly view setup until after first type test; insns 57/57, structural/exact diffs (4, 5), fuzzy 92.98245, code 10376, data 192. Restored pending gates.
MAX PFCACHE_DoWriteNumSectorAndFreeIfNeeded diagnosis: fetched origin/main, still open 98.21889%. Both 233 instructions, same 0x30 frame, same saved GPRs and all branches. Only third overlap block differs at instructions 136-144: target reloads page start, recomputes num_sector+sector despite cached r31 request end, computes last_sector before success/remaining bookkeeping; source reuses r31 and reconstructs last sector from page start + overlap. No immediate stack store/reload for these scalars, so volatile is unproven. Extent 0x3a4 ends exactly at DoFlushCache. No data sections/pool in this unit. Try real signedness, input const qualification, transient-helper boundaries and range-variable structure before register search.
- MAX pM01 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: compute last sector using unsigned-int request operands rather than page cancellation; insns 232/233, structural/exact diffs (15, 228), fuzzy 95.40772, code 6464, data None. Restored pending gates.
- MAX pM02 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: compute last sector with reversed request addition and decrement grouped into count; insns 232/233, structural/exact diffs (15, 228), fuzzy 95.40772, code 6464, data None. Restored pending gates.
- MAX pM03 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: group last-sector decrement into starting sector; insns 232/233, structural/exact diffs (15, 228), fuzzy 95.40772, code 6464, data None. Restored pending gates.
- MAX pM04 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: make input head pointer read-only because this routine never replaces it; insns 233/233, structural/exact diffs (4, 9), fuzzy 98.21889, code 6464, data None. Restored pending gates.
- MAX pM05 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: preserve source buffer as const at every memory-copy call; insns 233/233, structural/exact diffs (4, 9), fuzzy 98.21889, code 6464, data None. Restored pending gates.
- MAX pM06 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: compute overlap and last sector using unsigned-int transient arithmetic; insns 232/233, structural/exact diffs (15, 228), fuzzy 95.53648, code 6464, data None. Restored pending gates.
- MAX pM07 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: derive last sector before overlap using the page-relative count expression; insns 232/233, structural/exact diffs (15, 228), fuzzy 95.40772, code 6464, data None. Restored pending gates.
- MAX pM08 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: declare half-open request end as a block-local named range value after memcpy; insns 232/233, structural/exact diffs (14, 106), fuzzy 98.62661, code 6464, data None. Restored pending gates.
- MAX pM09 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: reuse existing end-buffer arithmetic without a whole-sector last variable; insns 232/233, structural/exact diffs (14, 107), fuzzy 98.45493, code 6464, data None. Restored pending gates.
- MAX pM10 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: compute last sector from overlap before remainder-count mutation; insns 233/233, structural/exact diffs (4, 9), fuzzy 98.21889, code 6464, data None. Restored pending gates.
- MAX pM11 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: keep overlap count in a signed integer but convert at sector bookkeeping; insns 233/233, structural/exact diffs (4, 9), fuzzy 98.21889, code 6464, data None. Restored pending gates.
- MAX pM12 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: keep last-sector value in a signed integer but preserve sector subtraction; insns 233/233, structural/exact diffs (4, 9), fuzzy 98.21889, code 6464, data None. Restored pending gates.
- MAX pM13 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: read page sector through const page view for both overlap calculations; insns 233/233, structural/exact diffs (4, 9), fuzzy 98.21889, code 6464, data None. Restored pending gates.
- MAX pM14 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: order rest-sector update before success update in the right overlap; insns 233/233, structural/exact diffs (4, 9), fuzzy 98.21889, code 6464, data None. Restored pending gates.
- MAX pM15 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: calculate the last-sector buffer offset directly as overlap minus one; insns 230/233, structural/exact diffs (17, 107), fuzzy 97.48927, code 6464, data None. Restored pending gates.
- MAX pM16 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: keep overlap calculation inside a named range descriptor; insns 233/233, structural/exact diffs (4, 9), fuzzy 98.21889, code 6464, data None. Restored pending gates.
- MAX pM17 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: inline last-sector helper isolates request-end calculation from overlap arithmetic; insns 234/233, structural/exact diffs (17, 108), fuzzy 97.48927, code 6464, data None. Restored pending gates.
- MAX pM18 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: inline last-sector helper uses a named half-open end local; insns 234/233, structural/exact diffs (17, 108), fuzzy 97.48927, code 6464, data None. Restored pending gates.
- MAX pM19 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: inline last-sector helper keeps a signed 32-bit endpoint result; insns 234/233, structural/exact diffs (17, 108), fuzzy 97.48927, code 6464, data None. Restored pending gates.
- MAX pM20 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: inline last-sector helper groups count decrement before start; insns 234/233, structural/exact diffs (17, 108), fuzzy 97.48927, code 6464, data None. Restored pending gates.
- MAX pM21 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: inline last-sector helper combines with direct overlap-count expression; insns 234/233, structural/exact diffs (17, 108), fuzzy 97.48927, code 6464, data None. Restored pending gates.
- MAX pM22 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: inline last-sector helper receives page start and overlap instead of request input; insns 233/233, structural/exact diffs (5, 8), fuzzy 97.91846, code 6464, data None. Restored pending gates.
- MAX pM23 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: inline last-sector helper isolates request-end calculation from overlap arithmetic; allow normal helper inlining at this function boundary; insns 232/233, structural/exact diffs (15, 228), fuzzy 95.40772, code 6464, data None. Restored pending gates.
- MAX pM24 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: inline last-sector helper uses a named half-open end local; allow normal helper inlining at this function boundary; insns 232/233, structural/exact diffs (15, 228), fuzzy 95.40772, code 6464, data None. Restored pending gates.
- MAX pM25 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: inline last-sector helper keeps a signed 32-bit endpoint result; allow normal helper inlining at this function boundary; insns 232/233, structural/exact diffs (15, 228), fuzzy 95.40772, code 6464, data None. Restored pending gates.
- MAX pM26 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: inline last-sector helper groups count decrement before start; allow normal helper inlining at this function boundary; insns 232/233, structural/exact diffs (15, 228), fuzzy 95.40772, code 6464, data None. Restored pending gates.
- MAX pM27 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: inline last-sector helper combines with direct overlap-count expression; allow normal helper inlining at this function boundary; insns 232/233, structural/exact diffs (15, 228), fuzzy 95.40772, code 6464, data None. Restored pending gates.
- MAX pM28 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: inline last-sector helper receives page start and overlap instead of request input; allow normal helper inlining at this function boundary; insns 233/233, structural/exact diffs (4, 9), fuzzy 98.21889, code 6464, data None. Restored pending gates.
- MAX pM29 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: use natural equivalent sector-overlap expression num_sector - (p_page->sector - sector); insns 234/233, structural/exact diffs (15, 107), fuzzy 97.74678, code 6464, data None. Restored pending gates.
- MAX pM30 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: use natural equivalent sector-overlap expression (sector - p_page->sector) + num_sector; insns 234/233, structural/exact diffs (16, 107), fuzzy 97.6824, code 6464, data None. Restored pending gates.
- MAX pM31 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: use natural equivalent sector-overlap expression num_sector + (sector - p_page->sector); insns 234/233, structural/exact diffs (16, 107), fuzzy 97.6824, code 6464, data None. Restored pending gates.
- MAX pM32 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: use natural equivalent sector-overlap expression p_page->size - (p_page->sector + (p_page->size - num_sector) - sector); insns 233/233, structural/exact diffs (4, 9), fuzzy 98.21889, code 6464, data None. Restored pending gates.
- MAX pM33 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: use natural equivalent sector-overlap expression p_page->size + (num_sector + sector - (p_page->sector + p_page->size)); insns 234/233, structural/exact diffs (16, 107), fuzzy 97.6824, code 6464, data None. Restored pending gates.
- MAX pM34 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: use natural equivalent sector-overlap expression (num_sector + sector - (p_page->sector + p_page->size)) + p_page->size; insns 234/233, structural/exact diffs (16, 107), fuzzy 97.6824, code 6464, data None. Restored pending gates.
- MAX pM35 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: use natural equivalent sector-overlap expression num_sector - (p_page->sector + p_page->size - sector) + p_page->size; insns 234/233, structural/exact diffs (16, 107), fuzzy 97.6824, code 6464, data None. Restored pending gates.
- MAX pM36 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: use natural equivalent sector-overlap expression (num_sector - p_page->sector) + sector; insns 234/233, structural/exact diffs (16, 107), fuzzy 97.6824, code 6464, data None. Restored pending gates.
- MAX nM09 NWC24iIsMsgObjReadable: match a mutable mailbox-entry input view rather than the guessed const formal; insns 57/57, structural/exact diffs (0, 0), fuzzy 100.0, code 10604, data 192. Restored pending gates.
- MAX nM10 NWC24iIsMsgObjReadable: use a readonly pointer value to the mutable mailbox entry; insns 57/57, structural/exact diffs (0, 0), fuzzy 100.0, code 10604, data 192. Restored pending gates.
- MAX nM11 NWC24iIsMsgObjReadable: retain full entry constness while qualifying pointer value itself; insns 57/57, structural/exact diffs (4, 5), fuzzy 92.98245, code 10376, data 192. Restored pending gates.
- MAX nM12 NWC24iIsMsgObjReadable: introduce a common typed header view with the proven shared leading fields; insns 57/57, structural/exact diffs (4, 5), fuzzy 92.98245, code 10376, data 192. Restored pending gates.
- MAX nM13 NWC24iIsMsgObjReadable: use an inline common-header validation helper for the first readable type bit only; insns 57/57, structural/exact diffs (4, 5), fuzzy 92.98245, code 10376, data 192. Restored pending gates.
- MAX nM14 NWC24iIsMsgObjReadable: keep the app-id equality operation in its own inline read-only view helper; insns 57/57, structural/exact diffs (4, 5), fuzzy 92.98245, code 10376, data 192. Restored pending gates.
MAX exact nM09: NWC24iIsMsgObjReadable input was guessed pointer-to-const; the target was compiled with mutable MBCEntry*. Removing const only from this function declaration and definition moves the first type load/mask after LR/r31 saves exactly as target. 57/57 instructions, ctxdiff 0, 100% objdiff; whole unit 24/25 -> 25/25, code 10376/10604 -> 10604/10604, data unchanged 192/192. nM10 pointer-value const is also exact; use simpler nM09. All call sites already pass mutable MBCEntry*, no shared header change. Quick gate PASS, DOL exact, pools identical and zero regressions.
```
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] pool: IDENTICAL
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] objdiff: code 10604/10604 data 192/192 functions 25/25 fuzzy 100.0000 linked code 0
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] instruction-exact functions: 25/25
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] section .data size 168 match 100.0
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] section .sbss size 8 match 100.0
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] section .sdata size 16 match 100.0
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] section .text size 10604 match 100.0
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] baseline: code 10376/10604 data 192 functions 24 fuzzy 99.8491
regressions vs baseline: 0
global matched_code_percent: 90.40604 -> 90.41365
global fuzzy_match_percent: 99.56056 -> 99.56516
global complete_code_percent: 70.30611 -> 70.30611
global matched_data_percent: 99.36596 -> 99.36596
forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
GATE PASS
```
- MAX pM37 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: match a mutable source-buffer formal from the older cache API; insns 233/233, structural/exact diffs (4, 9), fuzzy 98.21889, code 6464, data None. Restored pending gates.
- MAX pM38 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: read volume geometry through a const formal and retain explicit mutable driver call; insns 233/233, structural/exact diffs (17, 62), fuzzy 92.44635, code 6464, data None. Restored pending gates.
- MAX pM39 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: model memory-copy source as a mutable opaque pointer in this unit only; insns 233/233, structural/exact diffs (4, 9), fuzzy 98.21889, code 6464, data None. Restored pending gates.
- MAX pM40 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: scope overlap and last-sector locals directly in the partial-page branch; BUILD FAIL "/usr/bin/python3" tools/transform_dep.py build/43U/src/libs/RVL_SDK/src/fa/pf_cache.d build/43U/src/libs/RVL_SDK/src/fa/pf_cache.d ### mwcceppc.exe Compiler: # File: libs\RVL_SDK\src\fa\pf_cache.c # --------------------------------------- # 610: pf_u32 num_overlap = p_page->size - ((p_page->sector + p_page->size) - (num_sector + sector)); # Error: ^^^^^^ # (10141) expression syntax error # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. . Restored pending gates.
- MAX pM40 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: scope overlap and last-sector locals directly in the partial-page branch; insns 233/233, structural/exact diffs (4, 9), fuzzy 98.21889, code 6464, data None. Restored pending gates.
- MAX pM41 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: scope an initialized last requested sector after the copy; insns 232/233, structural/exact diffs (15, 228), fuzzy 95.40772, code 6464, data None. Restored pending gates.
- MAX pM42 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: derive a half-open request endpoint with wide intermediate arithmetic; insns 235/233, structural/exact diffs (17, 229), fuzzy 94.356224, code 6464, data None. Restored pending gates.
- MAX pM43 PFCACHE_DoWriteNumSectorAndFreeIfNeeded: derive overlap and last sector from a wide request endpoint local; insns 237/233, structural/exact diffs (15, 235), fuzzy 93.042915, code 6464, data None. Restored pending gates.
- MAX sM17 ZiMatchZHSpelling: declare candidate input const at the function definition and convert only for legacy helpers; insns 121/121, structural/exact diffs (0, 29), fuzzy 98.80165, code 4168, data 144. Restored pending gates.
- MAX sM18 ZiMatchZHSpelling: declare spelling input const at the function definition and convert only for legacy helper; insns 121/121, structural/exact diffs (0, 29), fuzzy 98.80165, code 4168, data 144. Restored pending gates.
- MAX sM19 ZiMatchZHSpelling: declare both candidate and spelling input arrays readonly; insns 121/121, structural/exact diffs (0, 29), fuzzy 98.80165, code 4168, data 144. Restored pending gates.
- MAX sM20 ZiMatchZHSpelling: give count helper a readonly word prototype while keeping matching input mutable; insns 121/121, structural/exact diffs (0, 29), fuzzy 98.80165, code 4168, data 144. Restored pending gates.
- MAX sM21 ZiMatchZHSpelling: give readonly candidate and count helper consistent const-qualified word types; insns 121/121, structural/exact diffs (0, 29), fuzzy 98.80165, code 4168, data 144. Restored pending gates.
- MAX sM22 ZiMatchZHSpelling: declare initial candidate length immutable after its one assignment; insns 121/121, structural/exact diffs (2, 30), fuzzy 97.19009, code 4168, data 144. Restored pending gates.
MAX cache structural follow-up: 43 distinct natural source trials, plus compiler-rejected unscoped declaration attempt. Mutable-buffer and readonly-head views preserve 9 differences; readonly volume regresses allocation/scheduling (62 differences). The closest fuzzy alternative pM08 has 232/233 instructions and greater branch-aware structural distance (14 vs 4), so reject it rather than trade the target instruction structure for a percentage gain. Wider arithmetic adds real instructions and is rejected. All cache source trials restored. No stack proof permits volatile.
MAX spelling follow-up after mailbox input-qualifier match: formal const candidate/spelling, consistent readonly count-helper prototype, and initialized immutable candidate length were all compiled. Const views reproduce the same 29 register differences. Local count scope changes instruction structure. Source restored; no proven volatile local evidence.
MAX final data proof: zi8cgetc .data is exactly 392 bytes in both objects, four compiler-generated switch tables, all 98 relocations resolve inside zi8InternalGetZH. No ordinary data symbol needs a real-name rename; these remain code work. Exception sections and the 16-byte constants/8-byte zero object are exact. NWC24MBoxCtrl has byte-identical ordinary strings and real MountInfo extent, matched data192/192; extracted trailing alignment remains unowned in source sections. pf_cache has no allocated non-code sections. No config or shared-header changes made.
MAX cache declaration search after structural/type/helper trials: declaration block: | PF_CACHE_PAGE* p_page = PF_NULL; | pf_s32 err; | pf_u32 num_rest_sector = num_sector; | pf_u8* p_sbuf; | pf_u8* p_ebuf; | pf_u32 num_overlap; | pf_u32 last_sector; | start (4, 9) | best (4, 9) after 52 builds; source restored; best order was: | PF_CACHE_PAGE* p_page = PF_NULL; | pf_s32 err; | pf_u32 num_rest_sector = num_sector; | pf_u8* p_sbuf; | pf_u8* p_ebuf; | pf_u32 num_overlap; | pf_u32 last_sector;
MAX coverage ZiMatchZHSpelling: 22 distinct successfully compiled source trials.
MAX coverage zi8InternalGetZH: 21 distinct successfully compiled source trials.
MAX coverage Zi8GetElementCount: 12 distinct successfully compiled source trials.
MAX coverage NWC24iIsMsgObjReadable: 14 distinct successfully compiled source trials.
MAX coverage PFCACHE_DoWriteNumSectorAndFreeIfNeeded: 43 distinct successfully compiled source trials.
Coverage complete: no untried owned function. NWC24iIsMsgObjReadable is exact and committed; all other mailbox trials restored. pf_cache source byte-identical to its MAX start. Spelling/GetElementCount source unchanged. The sole retained engine change is one natural chained table/cursor assignment; the engine remains open, and structural return-copy/conversion differences are not labelled a pure register tie.
MAX final full (non-quick) gate, all three owned units:
```
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] pool: IDENTICAL
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] objdiff: code 4168/47816 data 144/536 functions 5/8 fuzzy 96.6547 linked code 0
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] instruction-exact functions: 5/8
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section .data size 392 match None
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section .sbss2 size 8 match 100.0
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section .sdata2 size 16 match 100.0
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section .text size 47816 match 96.65468
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section extab size 48 match 100.0
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] section extabindex size 72 match 100.0
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] below 100: ZiMatchZHSpelling 98.80165
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] below 100: zi8InternalGetZH 96.27482
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] below 100: Zi8GetElementCount 99.347824
[libs/RVLMiddleware/eZiText/src/clib/zi8cgetc] baseline: code 4168/47816 data 144 functions 5 fuzzy 96.4008
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] pool: IDENTICAL
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] objdiff: code 10604/10604 data 192/192 functions 25/25 fuzzy 100.0000 linked code 0
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] instruction-exact functions: 25/25
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] section .data size 168 match 100.0
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] section .sbss size 8 match 100.0
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] section .sdata size 16 match 100.0
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] section .text size 10604 match 100.0
[libs/RevoEX/src/nwc24/NWC24MBoxCtrl] baseline: code 10376/10604 data 192 functions 24 fuzzy 99.8491
[libs/RVL_SDK/src/fa/pf_cache] pool: IDENTICAL
[libs/RVL_SDK/src/fa/pf_cache] objdiff: code 6464/7396 data None/None functions 35/36 fuzzy 99.7755 linked code 0
[libs/RVL_SDK/src/fa/pf_cache] instruction-exact functions: 35/36
[libs/RVL_SDK/src/fa/pf_cache] section .text size 7396 match 99.77555
[libs/RVL_SDK/src/fa/pf_cache] below 100: PFCACHE_DoWriteNumSectorAndFreeIfNeeded 98.21889
[libs/RVL_SDK/src/fa/pf_cache] baseline: code 6464/7396 data None functions 35 fuzzy 99.7755
regressions vs baseline: 0
global matched_code_percent: 90.40604 -> 90.41365
global fuzzy_match_percent: 99.56056 -> 99.56516
global complete_code_percent: 70.30611 -> 70.30611
global matched_data_percent: 99.36596 -> 99.36596
forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
GATE PASS
```
MAX before -> after, instruction-exact/code/data bytes: zi8cgetc 5/4168/144 -> 5/4168/144 (engine fuzzy 95.99054 -> 96.27482); NWC24MBoxCtrl 24/10376/192 -> 25/10604/192; pf_cache 35/6464/0 -> 35/6464/0 (no data sections). Full GATE PASS, exact DOL SHA1, pools identical, zero regressions and forbidden/readability failures. Owned instruction-exact total 64/69 -> 65/69. Local source commits: 25fabf7b and 93e82b61.
Remaining open functions, with all source attempts exhausted this MAX round: ZiMatchZHSpelling98.80165% (29 register differences); zi8InternalGetZH96.27482% (return copies, missing halfword conversions, allocation); Zi8GetElementCount99.347824% (13 register differences); PFCACHE_DoWriteNumSectorAndFreeIfNeeded98.21889% (9 third-overlap arithmetic/scheduling differences). The correct engine temporary boundaries and paired phonetic-code interface widths remain uncertain. No new symbol rename/extent adjustment or linking investigation was needed.

View File

@@ -0,0 +1,99 @@
# linkgap-audio: eggAudioExpMgr — Equivalent-but-unlinkable analysis
Branch: agent/w1005/linkgap-audio. Unit stays **Equivalent**.
## Status
Per-symbol match is complete: all 8 .text fns + the 0x78 vtable match orig
(fuzzy 100.0 code+data, every fn individually 100). The .o emit set now
matches orig's exactly (see gates below).
**Remaining linker-visible diff: secondary-vt thunk emit order.**
- orig `.text` tail: `[@52@__dt__SimpleAudioMgrWithFx @+1fc][@52@calc__SimpleAudioMgr @+204]`
- mine: `[@52@calc @+1fc][@52@__dt__ @+204]` (swapped)
Both thunks are byte-identical bodies, so objdiff fn-level fuzzy is 100 for
each — but the .o's symbol order carries into the linked DOL, so flipping
Matching fails the DOL hash. This is the *only* blocker.
## Emit-set gates (kept)
`EGG_AUDIO_EXPMGR_NO_INLINE_VIRTUALS` is defined at the top of
eggAudioExpMgr.cpp and gates these headers (TU-local: other TUs are
unaffected since the macro is only defined in this .cpp):
- `libs/EGG/include/egg/core/eggAudioArcPlayerMgr.h` — 9 ArcPlayer virtuals
(openArchive/openDvd/openNand/setupMemory/close/loadGroup/startSound/
prepareSound/holdSound families) -> non-inline decls for this TU.
- `libs/EGG/include/egg/core/eggAudioHeapMgr.h` — SoundHeapMgr
`loadState`/`getCurrentLevel` -> decls.
- `libs/NW4R/include/nw4r/ut/Lock.h` — `detail::AutoLock<OSMutex>` ct/dt ->
decls.
Without the gates MWCC weak-emits 10 extra inline fns (ArcPlayer
hold/prepare/startSound x9 + NonCopyable/AutoLock/SoundHeap helpers) that
orig's .o does not contain. With gates the emit set is byte-for-byte orig:
same 8 .text syms at the same offsets/sizes + `__vt__` at .data+0x0/0x78.
Residual cosmetic diff (does not affect the link): orig's
`__ct__AudioFxMgrArg` and `SaveState` are STB_GLOBAL; mine STB_WEAK.
Both dedup/resolve identically at link.
## Thunk-order mechanism (decoded)
Surveyed every orig .o with >=2 `@N@` adjustor thunks; my compiler
reproduces orig's order in ALL of them (iplSound, iplGCWindow,
iplMemoryCard, MyTiBg, tiCellPhone, iplBoard, ...) EXCEPT this unit.
Best-fit model for orig's ordering: thunks emit in the order the
*overriding virtuals are declared in the most-derived class*, with
thunks for inherited overrides emitted after the class's own declared
virtuals:
- SimpleAudioMgrWithFx declares `[~dtor, initialize]` -> own dtor thunk
first, then the inherited `SimpleAudioMgr::calc` thunk -> [dt][calc] = orig
- ipl::snd::System declares `calc` before `~System` -> [calc][dt] = orig
- iplMemoryCard `[onTrig,onLeft,onPoint,~dt]` -> that order = orig
(NOT .text def order, which is [onPoint,onLeft,onTrig])
- tiCellPhone `[~dt,updateInput,calc,draw,init]` = orig
My build instead emits thunks in *reverse secondary-vt slot order*
(the .rela.data stream is written backward — observable on every unit;
extraction .os sort relocs so orig's real write order is unknowable).
The two orders coincide for every surveyed unit except this one — it is
the only unit where a derived-declared dtor and an ancestor-declared
override (`SimpleAudioMgr::calc`, declared in the base) disagree.
## What flips it (and why it was vetoed)
Adding ANY second polymorphic class whose vt is built in this TU and
*shares* the secondary base flips the pair to orig's [dt][calc]:
verified with `class Sample : public SimpleAudioMgrWithFx` (emit
`[dt_WithFx][calc][dt_Sample]` — the parent's set comes out in forward
slot order once WithFx's vt is built as a parent). An unrelated
polymorphic class (no shared base) does NOT flip it; a declared-but-
never-defined derived class does NOT flip it (vt never built).
Mechanistically: orig's TU very likely caused WithFx's vt to be built
*as a parent* (a second derived class whose vt anchored elsewhere —
e.g. EGG's real `ipl::snd::System`-style class compiled in another TU
is the only known retail derivee), which emits the parent's thunks in
forward slot order. Any such class is invented here -> owner veto
(not in retail symbols). Orig's .o emits exactly one vtable, so no
second polymorphic class was ODR-emitted in the real TU either — the
trigger lived in code we cannot see (or is a compiler-version artifact).
## Tried and rejected (all still [calc][dt])
- dtor declared after `initialize` in the class decl
- dtor DEFINITION moved before/after ctor in the .cpp
- unrelated polymorphic class (no shared secondary base)
- derived class declared but never defined (no vt build)
## What would close it
A legitimate source construct that causes a second vt-build sharing
the ArcPlayer secondary vtable in this TU, or a linker-level symbol
ordering mechanism (none exists: symbols.txt is label-only, linker lays
out .text in .o symbol order). Until then: Equivalent.