From 8f96b488e24810988497f642b01ab6c53cdd918e Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Wed, 30 Sep 2026 06:23:03 +0000 Subject: [PATCH] eZiText round 2: zi8getc2 11/17 (worker 2384260a) --- README.md | 4 +- libs/RVLMiddleware/eZiText/src/clib/zi8dawg.c | 27 ++---- .../RVLMiddleware/eZiText/src/clib/zi8getc2.c | 92 +++++++++---------- .../RVLMiddleware/eZiText/src/clib/zikorean.c | 2 +- tools/decomp-assist/zi8dawg.attempts.md | 39 ++++++++ tools/decomp-assist/zi8getc2.attempts.md | 59 ++++++++++++ tools/decomp-assist/zi8match.attempts.md | 29 ++++++ tools/decomp-assist/zikorean.attempts.md | 15 +++ 8 files changed, 200 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index 698c1922..8bbdde80 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,9 @@ Progress | Decompiled | Matched | Linked | Data | |:---:|:---:|:---:|:---:| -| 91.59% | 80.73% | 56.95% | 88.75% | +| 91.60% | 80.76% | 56.95% | 88.75% | -units 758/1027 complete, functions 11608/12563 matched. +units 758/1027 complete, functions 11609/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 diff --git a/libs/RVLMiddleware/eZiText/src/clib/zi8dawg.c b/libs/RVLMiddleware/eZiText/src/clib/zi8dawg.c index d00aa87f..3283d646 100644 --- a/libs/RVLMiddleware/eZiText/src/clib/zi8dawg.c +++ b/libs/RVLMiddleware/eZiText/src/clib/zi8dawg.c @@ -20,7 +20,7 @@ ziU32 Zi8MatchROMdata0(ziWChar* elements, ziU32 count, ziU8 language, ziBool searching; ziS32 tableSize; ziU8* graph; - ziS16 key; + ziU16 key; ziU8 endOfWord; zi8DawgRec* current; ziU16 index; @@ -29,7 +29,7 @@ ziU32 Zi8MatchROMdata0(ziWChar* elements, ziU32 count, ziU8 language, ziU8 result = 0; ziU32 keyCount; ziU8* table; - ziS16 keys[3]; + ziU16 keys[3]; if (language != context->lang || graphTable != context->key) { records[0].key = 0; @@ -86,7 +86,7 @@ ziU32 Zi8MatchROMdata0(ziWChar* elements, ziU32 count, ziU8 language, keys[(ziU16)index] = 0; table = (ziU8*)Zi8GetTableAddress(language, keyTable, ZI_WORK); context->p14 = table + 2; - records[0].node = ZiDAWGGetGraphInfo(context, table + context->cap * 2 + 2, keys); + records[0].node = ZiDAWGGetGraphInfo(context, table + context->cap * 2 + 2, (ziS16*)keys); } records[0].key = 0; if (records[0].node == 0) goto finish_graph; @@ -300,15 +300,10 @@ search_segment: if ((ZI_WORK->dawgCtx.key == 0) && ((language & 0xff) == 10)) { for (result = 0; (result & 0xff) < (unsigned int)ZI_WORK->unk_0x17EA; result = result + 1) { character = ZI_WORK->unk_0x17F4[result & 0xff]; - if (character == 0x6f) { -select_vowel_table: + if (character == 0x61 || character == 0x6f || character == 0x75) { ZI_WORK->unk_0x141E = 0x10; break; } - if (character < 0x6f) { - if (character == 0x61) goto select_vowel_table; - } - else if (character == 0x75) goto select_vowel_table; } } goto search_segment; @@ -324,14 +319,12 @@ finish_segments: ziU8 Zi8MatchROMdata(ziWChar *elements, ziU8 count, ziU8 language, ziWChar *output, ziU16 capacity, ziU8 mode, ziU8 status, ziU8 reservedMode, ziU8 acceptPrefix, ziPtr __zi8_work_data) { - ziU16 *input; ziU8* group; int tableSize; ziU8 found; unsigned int elementCount; unsigned int result; - input = (ziU16 *)elements; elementCount = (unsigned int)count; result = 0; if ((capacity & 0xffff) < (elementCount & 0xff)) { @@ -352,12 +345,12 @@ ziU8 Zi8MatchROMdata(ziWChar *elements, ziU8 count, ziU8 language, ziWChar *outp } tableSize = Zi8GetTableSize(language & 0xff,0x1c,ZI_WORK); if (tableSize == 0) { - result = Zi8MatchROMdata2(input,elementCount & 0xff,language & 0xff,output,capacity & 0xffff, + result = Zi8MatchROMdata2(elements,elementCount & 0xff,language & 0xff,output,capacity & 0xffff, mode & 0xff,status & 0xff,reservedMode & 0xff,0,acceptPrefix,ZI_WORK); } else { while (((ZI_WORK->unk_0x17F0 != 0 && - (result = Zi8MatchROMdata2(input,elementCount & 0xff,language & 0xff,output,capacity & 0xffff, + (result = Zi8MatchROMdata2(elements,elementCount & 0xff,language & 0xff,output,capacity & 0xffff, mode & 0xff,status & 0xff,reservedMode & 0xff, (ziU8 *)ZI_WORK->unk_0x17F0,acceptPrefix,ZI_WORK), (result & 0xff) == 0)) && @@ -370,10 +363,10 @@ ziU8 Zi8MatchROMdata(ziWChar *elements, ziU8 count, ziU8 language, ziWChar *outp (((elementCount & 0xff) == 1 && ((capacity & 0xffff) != 0)))) { ZI_WORK->unk_0x17EC = 1; if (tableSize == 0) { - found = Zi8MatchROMdata2(input,elementCount & 0xff,language & 0xff,output,capacity & 0xffff,0, + found = Zi8MatchROMdata2(elements,elementCount & 0xff,language & 0xff,output,capacity & 0xffff,0, status & 0xff,reservedMode & 0xff,0,acceptPrefix,ZI_WORK); if (found != '\0') { - *output = *input; + *output = *elements; result = 1; } } @@ -381,11 +374,11 @@ ziU8 Zi8MatchROMdata(ziWChar *elements, ziU8 count, ziU8 language, ziWChar *outp group = NextDawgGroup(0,language & 0xff,ZI_WORK); ZI_WORK->unk_0x17F0 = group; while (ZI_WORK->unk_0x17F0 != 0) { - found = Zi8MatchROMdata2(input,elementCount & 0xff,language & 0xff,output,capacity & 0xffff,0, + found = Zi8MatchROMdata2(elements,elementCount & 0xff,language & 0xff,output,capacity & 0xffff,0, status & 0xff,reservedMode & 0xff,(ziU8 *)ZI_WORK->unk_0x17F0, acceptPrefix,ZI_WORK); if (found != '\0') { - *output = *input; + *output = *elements; result = 1; break; } diff --git a/libs/RVLMiddleware/eZiText/src/clib/zi8getc2.c b/libs/RVLMiddleware/eZiText/src/clib/zi8getc2.c index 20828518..0dd1046e 100644 --- a/libs/RVLMiddleware/eZiText/src/clib/zi8getc2.c +++ b/libs/RVLMiddleware/eZiText/src/clib/zi8getc2.c @@ -89,16 +89,15 @@ static ziU16 Zi8GetDataSignature(ziU8* destination, ziU16 capacity, ziU8 languag static ziU16 Zi8GetEngineSignature(ziU8* destination, ziPtr work) { ziU16 index = 0; - ziU16 major; - ziU16 minor; + struct { ziU16 minor; } version; ziU16 number; destination[index++] = 'v'; - major = (Zi8GetVersion(work) & 0xff00) >> 8; - minor = Zi8GetVersion(work) & 0xff; - destination[index++] = (ziU8)(major / 10 + '0'); - destination[index++] = (ziU8)(major % 10 + '0'); - destination[index++] = (ziU8)(minor / 10 + '0'); - destination[index++] = (ziU8)(minor % 10 + '0'); + number = (Zi8GetVersion(work) & 0xff00) >> 8; + version.minor = Zi8GetVersion(work) & 0xff; + destination[index++] = (ziU8)(number / 10 + '0'); + destination[index++] = (ziU8)(number % 10 + '0'); + destination[index++] = (ziU8)(version.minor / 10 + '0'); + destination[index++] = (ziU8)(version.minor % 10 + '0'); destination[index++] = 'o'; number = Zi8GetOEMID(work); destination[index++] = (ziU8)(number / 100 + '0'); @@ -119,7 +118,7 @@ static ziBool Zi8AlphaSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED ziU8* second; ziU8* first; ziU8 engine[32]; - ziU8 dictionary[56]; + ziU8 dictionary[32]; ziU16 length; ziU16 candidateCount; ziWChar* output = parameters->candidates; @@ -210,7 +209,7 @@ static ziBool Zi8ZhSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED_WO ziU8* current = 0; ziU16 copied; ziU8 engine[32]; - ziU8 dictionary[64]; + ziU8 dictionary[32]; ziU16 dataLength; ziU32 engineLength; ziU32 candidateCount; @@ -314,13 +313,13 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option ziU16 savedCharacter; ziWChar* savedElements; ziBool restoreCandidates; - char signatureFound; ziU8 elementCount; int error; unsigned int candidateCount; ziU8 savedOptions; ziWChar* savedCandidates; - ziU16 characterInfo [32]; + ziU16 characterInfo[16]; + ziU16 lastInfoCharacter; error = 0; savedOptions = 0; @@ -328,10 +327,10 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option restoreCandidates = 0; if (options->lookupMode == '\0') { if (((ZI_WORK->unk_0x00 == '\t') && (parameters->elementCount != 0)) && - ((((ziS16)parameters->elements[parameters->elementCount - 1] == -0x1008 && - (signatureFound = Zi8AlphaSignature(parameters,options->countOnly,ZI_WORK), signatureFound != '\0')) || - (((ziS16)parameters->elements[parameters->elementCount - 1] == -0x10fc && - (signatureFound = Zi8ZhSignature(parameters,options->countOnly,ZI_WORK), signatureFound != '\0')))))) { + (((parameters->elements[parameters->elementCount - 1] == 0xEFF8 && + ((ziU8)Zi8AlphaSignature(parameters,options->countOnly,ZI_WORK) != 0)) || + ((parameters->elements[parameters->elementCount - 1] == 0xEF04 && + ((ziU8)Zi8ZhSignature(parameters,options->countOnly,ZI_WORK) != 0)))))) { candidateCount = (unsigned int)parameters->letters; if (options->countOnly != '\0') { parameters->letters = 0; @@ -347,7 +346,7 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option if ((ZI_WORK->unk_0x00 == '\0') || (ZI_WORK->unk_0x01 == options->countOnly)) { switch(ZI_WORK->unk_0x00) { case '\0': - if ((ziS16)parameters->elements[0] == -0x10fc) { + if (parameters->elements[0] == 0xEF04) { ZI_WORK->unk_0x01 = options->countOnly; ZI_WORK->unk_0x00 = '\x01'; } @@ -356,7 +355,7 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option case '\x03': case '\x05': case '\a': - if ((ziS16)parameters->elements[0] == -0x10ff) { + if (parameters->elements[0] == 0xEF01) { ZI_WORK->unk_0x00 = ZI_WORK->unk_0x00 + '\x01'; } else { @@ -366,7 +365,7 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option case '\x02': case '\x04': case '\x06': - if ((ziS16)parameters->elements[0] == -0x10fc) { + if (parameters->elements[0] == 0xEF04) { ZI_WORK->unk_0x00 = ZI_WORK->unk_0x00 + '\x01'; } else { @@ -375,8 +374,8 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option break; case '\b': case '\t': - if (((ziS16)parameters->elements[0] == -0x10fc) && - (signatureFound = Zi8ZhSignature(parameters,options->countOnly,ZI_WORK), signatureFound != '\0')) { + if ((parameters->elements[0] == 0xEF04) && + ((ziU8)Zi8ZhSignature(parameters,options->countOnly,ZI_WORK) != 0)) { ZI_WORK->unk_0x00 = '\t'; candidateCount = (unsigned int)parameters->letters; if (options->countOnly != '\0') { @@ -388,7 +387,7 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option default: ZI_WORK->unk_0x00 = '\0'; } - if ((ZI_WORK->unk_0x00 == '\0') && ((ziS16)parameters->elements[0] == -0x10fc)) { + if ((ZI_WORK->unk_0x00 == '\0') && (parameters->elements[0] == 0xEF04)) { ZI_WORK->unk_0x00 = '\x01'; } } @@ -401,13 +400,13 @@ latinSequence: if ((ZI_WORK->unk_0x00 == '\0') || (ZI_WORK->unk_0x01 == options->countOnly)) { switch(ZI_WORK->unk_0x00) { case '\0': - if ((ziS16)parameters->elements[0] == -0x100e) { + if (parameters->elements[0] == 0xEFF2) { ZI_WORK->unk_0x01 = options->countOnly; ZI_WORK->unk_0x00 = '\x01'; } break; case '\x01': - if ((ziS16)parameters->elements[0] == -0x100d) { + if (parameters->elements[0] == 0xEFF3) { ZI_WORK->unk_0x00 = '\x02'; } else { @@ -415,7 +414,7 @@ latinSequence: } break; case '\x02': - if ((ziS16)parameters->elements[0] == -0x100b) { + if (parameters->elements[0] == 0xEFF5) { ZI_WORK->unk_0x00 = '\x03'; } else { @@ -423,7 +422,7 @@ latinSequence: } break; case '\x03': - if ((ziS16)parameters->elements[0] == -0x1009) { + if (parameters->elements[0] == 0xEFF7) { ZI_WORK->unk_0x00 = '\x04'; } else { @@ -431,7 +430,7 @@ latinSequence: } break; case '\x04': - if ((ziS16)parameters->elements[0] == -0x1008) { + if (parameters->elements[0] == 0xEFF8) { ZI_WORK->unk_0x00 = '\x05'; } else { @@ -439,7 +438,7 @@ latinSequence: } break; case '\x05': - if ((ziS16)parameters->elements[0] == -0x1007) { + if (parameters->elements[0] == 0xEFF9) { ZI_WORK->unk_0x00 = '\x06'; } else { @@ -447,7 +446,7 @@ latinSequence: } break; case '\x06': - if ((ziS16)parameters->elements[0] == -0x100e) { + if (parameters->elements[0] == 0xEFF2) { ZI_WORK->unk_0x00 = '\a'; } else { @@ -455,7 +454,7 @@ latinSequence: } break; case '\a': - if ((ziS16)parameters->elements[0] == -0x100b) { + if (parameters->elements[0] == 0xEFF5) { ZI_WORK->unk_0x00 = '\b'; } else { @@ -464,8 +463,8 @@ latinSequence: break; case '\b': case '\t': - if (((ziS16)parameters->elements[0] == -0x1008) && - (signatureFound = Zi8AlphaSignature(parameters,options->countOnly,ZI_WORK), signatureFound != '\0')) { + if ((parameters->elements[0] == 0xEFF8) && + ((ziU8)Zi8AlphaSignature(parameters,options->countOnly,ZI_WORK) != 0)) { ZI_WORK->unk_0x00 = '\t'; candidateCount = (unsigned int)parameters->letters; if (options->countOnly != '\0') { @@ -477,7 +476,7 @@ latinSequence: default: ZI_WORK->unk_0x00 = '\0'; } - if ((ZI_WORK->unk_0x00 == '\0') && ((ziS16)parameters->elements[0] == -0x100e)) { + if ((ZI_WORK->unk_0x00 == '\0') && (parameters->elements[0] == 0xEFF2)) { ZI_WORK->unk_0x00 = '\x01'; } } @@ -495,8 +494,7 @@ latinSequence: options->maxCount = ZI_WORK->unk_0x10; options->maxWordLength = ZI_WORK->unk_0x0A; ZI_WORK->unk_0x0A = -1; - signatureFound = Zi8LangSupported(parameters->language,ZI_WORK); - if (signatureFound == '\0') { + if ((ziU8)Zi8LangSupported(parameters->language,ZI_WORK) == 0) { Zi8LogError(0x163,ZI_WORK); candidateCount = 0; } @@ -519,7 +517,7 @@ latinSequence: } else if ((parameters->language == 1) && ((((parameters->getOptions & 0xbf) == 4 && (parameters->elementCount != 0)) && - (signatureFound = Zi8IsCharacter(parameters->elements[0],ZI_WORK), signatureFound != '\0')))) { + ((ziU8)Zi8IsCharacter(parameters->elements[0],ZI_WORK) != 0)))) { elementCount = Zi8GetCharInfo(parameters->elements[0],characterInfo,0x10,1,ZI_WORK); if (elementCount == 0) { parameters->unk_0x20 = 0; @@ -529,7 +527,8 @@ latinSequence: error = 900; } else { - if ((0xf330 < characterInfo[elementCount - 1]) && (characterInfo[elementCount - 1] < 0xf336)) { + lastInfoCharacter = characterInfo[elementCount - 1]; + if ((0xf330 < lastInfoCharacter) && (lastInfoCharacter < 0xf336)) { characterInfo[elementCount - 1] = 0xf360; } savedElements = parameters->elements; @@ -579,9 +578,9 @@ latinSequence: else if (parameters->language == 1) { candidateCount = Zi8GetChineseCandidates(parameters,options,ZI_WORK); if ((((candidateCount == 0) && ((parameters->getOptions & 0x20) == 0)) && ((parameters->getMode == 1 && (parameters->elementCount != 0)))) - && ((((ziS16)parameters->elements[parameters->elementCount - 1] == -0xc86 || - ((ziS16)parameters->elements[parameters->elementCount - 1] == -0xc9d)) || - ((ziS16)parameters->elements[parameters->elementCount - 1] == -0xc8d)))) { + && (((parameters->elements[parameters->elementCount - 1] == 0xF37A || + (parameters->elements[parameters->elementCount - 1] == 0xF363)) || + (parameters->elements[parameters->elementCount - 1] == 0xF373)))) { savedCharacter = parameters->elements[parameters->elementCount]; elementCount = parameters->elementCount; parameters->elements[elementCount] = 0xf368; @@ -636,10 +635,11 @@ void Zi8InitDupWordBuf(ziPtr __zi8_work_data) { } ziBool Zi8IsDupWChar(ziWChar character ZI_NEED_WORK) { - ziBool duplicate = 0; - ziU16* buffer = ZI_WORK->unk_0x57A; + ziBool duplicate; + ziU16* buffer; unsigned int index; - ziU16 position; + duplicate = 0; + buffer = ZI_WORK->unk_0x57A; if (ZI_WORK->unk_0x539 == 0) { buffer[0] = 2; buffer[1] = character; @@ -654,9 +654,7 @@ ziBool Zi8IsDupWChar(ziWChar character ZI_NEED_WORK) { } } ZI_WORK->unk_0x539++; - position = *buffer; - buffer[position] = character; - *buffer = ++position; + buffer[(*buffer)++] = character; if (*buffer > 100) { *buffer = 2; buffer[1] = character; @@ -668,7 +666,7 @@ ziBool Zi8IsDupWChar(ziWChar character ZI_NEED_WORK) { ziBool Zi8IsDupWordW(ziWChar* word, ziU8 length ZI_NEED_WORK) { ziU8 slot; - ziU32 duplicate = 0; + ziBool duplicate = 0; unsigned int position; int index; int character; diff --git a/libs/RVLMiddleware/eZiText/src/clib/zikorean.c b/libs/RVLMiddleware/eZiText/src/clib/zikorean.c index dfab9f19..889b4f25 100644 --- a/libs/RVLMiddleware/eZiText/src/clib/zikorean.c +++ b/libs/RVLMiddleware/eZiText/src/clib/zikorean.c @@ -45,7 +45,7 @@ ziU8 Zi8GetKoreanCandidates(ziGetParam* params, ziU8* argument, ziU8* table1; } state; ziU16 buffer[100]; - ziU8 result; + unsigned int result; ziU16 currentCharacter; ziU8* selectedTable; diff --git a/tools/decomp-assist/zi8dawg.attempts.md b/tools/decomp-assist/zi8dawg.attempts.md index 11d8cb01..8d0a2659 100644 --- a/tools/decomp-assist/zi8dawg.attempts.md +++ b/tools/decomp-assist/zi8dawg.attempts.md @@ -31,3 +31,42 @@ Zi8MatchROMdata: Retained the attempt 1 body. With the retained full-width segment-helper signature it measures 58.106598%, 237/197 instructions. Group iteration and fallback control flow differ. + +Continuation on merged baseline (2/6 exact, code 536/4868, data 0/120). + +Zi8MatchROMdata0 (baseline 45.16092%, 533/522): +1. Byte incoming count: 45.672413%, 532/522. +2. Unsigned converted key and key buffer: 47.754787%, 531/522. +3. Group capacity, status and result into traversal state: + 47.77203%, 534/522; first draft placed assignments before declarations and + did not compile, then corrected declaration order. +Retained unsigned keys. Target has no extsh operations, and Zi8ConvertWC2Key +returns ziWChar. Did not retain the traversal state for a negligible fuzzy gain +with three more instructions. Graph traversal and stack allocation still differ. + +Zi8MatchROMdata1 (baseline 99.765625%, 128/128, 5 differences): +1. Move group decrement to loop entry: 97.46094%, 129/128. +2. Typed table-address pointer: unchanged 99.765625%, 128/128. +3. Byte status parameter: 98.984375%, 129/128. +4. Group table address into table state: 96.671875%, 129/128. +Also tried an unsigned group parameter; rejected the compile failure caused by +existing char-pointer callers rather than changing other functions for the trial. +Retained baseline: r26/r27 assignments differ. + +Zi8MatchROMdata2 (baseline 249/236): +1. Signed remaining-output cursor: 249/236. +2. Byte status parameter: 253/236. +3. Direct a/o/u vowel condition: 245/236. +Retained direct vowel test. Objdiff omits this function's fuzzy percentage in all +these reports; it is not 100%. Segment loops, narrowing and allocation differ. + +Zi8MatchROMdata (baseline 58.106598%, 237/197): +1. U16 result: 55.055836%, 238/197. +2. Remove redundant input-pointer alias: 61.563454%, 234/197. +3. Unsigned table size: unchanged 58.106598%, 237/197. +Retained alias removal; fallback and group iteration branches differ. + +Data audit: no .data/.rodata/.sdata content or strings. Source and target have +48-byte .extab and 72-byte .extabindex sections. Their mismatches derive from +unmatched function frames/sizes; no fabricated metadata added. Gate confirms +identical empty pools (pool_diff itself expects a .data section and raises KeyError). diff --git a/tools/decomp-assist/zi8getc2.attempts.md b/tools/decomp-assist/zi8getc2.attempts.md index aa0ca26a..f91d6ac1 100644 --- a/tools/decomp-assist/zi8getc2.attempts.md +++ b/tools/decomp-assist/zi8getc2.attempts.md @@ -44,3 +44,62 @@ Zi8IsDupWordW: 2. Explicit loop break: 90.22302%, 140/139. 3. U8 cache position: 88.78417%, 142/139. Retained attempt 2; loop layout and cache index allocation differ. + +Continuation on merged baseline (10/17 exact, code 484/6888, data 24/332). + +Zi8GetDataSignature (baseline 99.347824%, 69/69, 9 differences): +1. Keep table address as U32 until memcpy: unchanged. +2. Generic destination parameter with typed output alias: 97.072464%, 70/69. +3. Successful length branch first with error fallthrough: 81.73913%, 69/69. +Retained baseline: saved register allocation only. + +Zi8GetEngineSignature: +1. Reuse numeric value for major, OEM and build: 96.02679%, 219/224. +2. Store minor version as a member of version state: 100%, 224/224, ctxdiff 0. +3. Two-component version array: 99.98661%, 224/224, 3 differences. +4. Unsigned output index: 87.52232%, 205/224. +Retained version state and reused number; this is the new instruction-exact function. + +Zi8AlphaSignature: +1. Dictionary buffer sized for the passed 32-byte capacity: 67.61275%, 188/204. +2. Group signature pointers, lengths and countOnly state: 59.32353%, 213/204. +3. Invert the dictionary eligibility branch with grouped state: + 62.656864%, 213/204. +Retained capacity-sized buffer; stack locals and branches still differ. + +Zi8ZhSignature: +1. Dictionary buffer sized for passed capacity: 29.225962%, 202/208. +2. U16 lengths/count and explicit presence increments: 26.26923%, 212/208. +3. Group countOnly and available state with U16 lengths/count: + 21.259615%, 214/208. +Retained capacity-sized buffer; promotions, stack state and loops differ. + +Zi8GetCandidatesOrCount: +1. Unsigned UTF16 sentinel comparisons and signature result: 81.198845%, 740/694. +2. Direct signature tests, sixteen-character info buffer: 84.46254%, 717/694. +3. Direct language/character helper tests: 85.65274%, 709/694. +4. Name and reuse final character-info character: 86.7536%, 707/694. +Retained these improvements; dispatch branches and saved stack state still differ. + +Zi8IsDupWChar: +1. U32 buffer position with U16 count/index conversions: 96.031746%, 65/63. +2. Unsigned position and direct count increment: 97.53968%, 64/63. +3. Append with buffer[(*buffer)++]: 99.36508%, 63/63, 8 differences. +4. Unsigned result flag: 98.492065%, 63/63, extra return narrowing. +5. Separate buffer/result declarations from initialization: unchanged 99.36508%. +Retained postincrement append and separate initialization; character/result +register assignments are swapped. + +Zi8IsDupWordW: +1. Unsigned loop indices: 87.84892%, 140/139. +2. Typed twenty-one-character cache records: 82.51798%, 141/139. +3. Boolean duplicate flag: 91.33813%, 141/139. +Retained boolean flag; cache loop layout and allocation remain different. + +Data audit: 16-byte search-order .rodata is identical. Both .data sections are +80-byte switch tables whose entries depend on unmatched dispatch branches. +Original .sdata2 is 8 bytes (4-byte fuzzy pair plus section-end zeros), source +4 bytes. Original zero fuzzy symbol/.sbss2 is 8 bytes, current header type and +source object are 4. Both section alignments are 8. The current shared headers +do not explain the extra trailing bytes; no fake padding or shared ABI edits. +Empty string pools remain identical. diff --git a/tools/decomp-assist/zi8match.attempts.md b/tools/decomp-assist/zi8match.attempts.md index 55ba6f66..68ccc2db 100644 --- a/tools/decomp-assist/zi8match.attempts.md +++ b/tools/decomp-assist/zi8match.attempts.md @@ -23,3 +23,32 @@ Retained 53/53, 99.245285%; r6/r7 allocation in result loads differs. Zi8GetBpmfPhonetic: 1. Deferred result initialization: 309/309, 99.23948%. 2. Unsigned result counter and direct text subtraction: 309/309, 100%, diffs 0. + +Continuation on merged baseline (7/10 exact, code 3720/8256, data 608/728). + +Zi8GetPyFinal (baseline 99.245285%, 53/53, 8 differences): +1. Reverse byte-pointer addition in final output access: unchanged. +2. Widen row to unsigned int, narrow output table index: 95.0%, 51/53. +3. Typed eight-byte final records with spelling/initial/final/flags fields: + 99.245285%, 53/53, same eight allocation differences; table remains 528 bytes. +4. Flat object byte indexing with row stride: 99.0566%, 53/53. +Retained baseline: only r6/r7 address-expression allocation differs. + +Zi8MatchPhonetic (baseline 77.66942%, 359/363): +1. Byte match/alternate flags and signed remaining count: 75.242424%, 362/363. +2. Group match flags and remaining count into semantic search state: + 72.7989%, 356/363. +3. Typed twelve-byte dictionary records rather than byte-stride indexing: + 77.694214%, 358/363. +Retained baseline: control flow, stack layout and instruction count differ. + +Zi8GetPyPhonetic (baseline 75.160164%, 726/718): +1. Integer partial flag and U32 result: 73.678276%, 727/718. +2. Structured letter/extension range checks: unchanged 75.160164%, 726/718. +3. Initialize converted count at declaration; allow worst-case separator expansion + in conversion buffer, narrow per-syllable buffer: 75.0%, 726/718. +Retained baseline: conversion branches, frame and allocation differ. + +Data audit: .rodata 528 bytes is identical; .extab 80 bytes is identical. +Remaining .extabindex differences follow unmatched function sizes. Empty pools +remain identical. No data-address objects or configuration changes added. diff --git a/tools/decomp-assist/zikorean.attempts.md b/tools/decomp-assist/zikorean.attempts.md index eb429692..756d5292 100644 --- a/tools/decomp-assist/zikorean.attempts.md +++ b/tools/decomp-assist/zikorean.attempts.md @@ -8,3 +8,18 @@ Zi8GetKoreanCandidates: 3. Typed three-byte character/sequence records: 66.96769%, 629/619. Retained attempt 1. The main routine still differs in stack state, loop structure and register allocation. No register/volatile keywords were retained. + +Continuation on merged baseline (2/3 exact, code 2712/5188, data 24/348). + +Zi8GetKoreanCandidates (baseline 68.13893%, 629/619): +1. Full-width candidate result: 68.76414%, 623/619. +2. Full-width character/loop cursor: 68.021%, 605/619. +3. Typed three-byte character mapping records: 67.266556%, 624/619. +Retained full-width result; candidate branches and stack/access allocation differ. + +Data audit: source contains the two natural 31-entry switch tables in function +order, 248 bytes. Original .data is 288 bytes; its final 40-byte table references +Zi8_81483118, owned by zkokeyp (.text 8148302C..8148447C), outside this unit. +This is a split ownership problem, not a missing Korean function. Changing splits +or manually placing that foreign table is outside this task. Remaining owned +table relocations depend on unmatched function branch offsets. Empty pools match. -- 2.49.1