cleanup: cleanup2-w6 (gotos, comma conditions, placeholders) #1349

Merged
coah80 merged 1 commits from agent/w0929/cleanup2-w6-land into main 2026-10-09 17:53:00 +00:00
7 changed files with 328 additions and 267 deletions

View File

@@ -308,36 +308,33 @@ BOOL BS2GetLockedTitles(ESTitleId *pTitleIds, u32 *count) {
return FALSE;
}
if (pTitleIds) {
goto getLockedTitles;
}
*count = 0;
PartitionCursor = (u32)PartitionInfoBuf;
for (i = 0; i < **(u32 **)&GameToc; i++) {
BS2Report("gamePartition ... 0x%08X\n", (u32)((DVDPartitionInfo *)PartitionCursor)->partition);
BS2Report("type ... 0x%08X\n", ((DVDPartitionInfo *)PartitionCursor)->partitionType);
if (((DVDPartitionInfo *)PartitionCursor)->partitionType & 0xFF000000) {
BS2Report(" count++\n");
(*count)++;
if (!pTitleIds) {
*count = 0;
PartitionCursor = (u32)PartitionInfoBuf;
for (i = 0; i < **(u32 **)&GameToc; i++) {
BS2Report("gamePartition ... 0x%08X\n", (u32)((DVDPartitionInfo *)PartitionCursor)->partition);
BS2Report("type ... 0x%08X\n", ((DVDPartitionInfo *)PartitionCursor)->partitionType);
if (((DVDPartitionInfo *)PartitionCursor)->partitionType & 0xFF000000) {
BS2Report(" count++\n");
(*count)++;
}
PartitionCursor += 8;
}
PartitionCursor += 8;
}
PartitionCursor = (u32)PartitionInfoBuf + 0x20;
for (i = 0; i < **(u32 **)&DataToc; i++) {
BS2Report("gamePartition ... 0x%08X\n", (u32)((DVDPartitionInfo *)PartitionCursor)->partition);
BS2Report("type ... 0x%08X\n", ((DVDPartitionInfo *)PartitionCursor)->partitionType);
if (((DVDPartitionInfo *)PartitionCursor)->partitionType & 0xFF000000) {
BS2Report(" count++\n");
(*count)++;
PartitionCursor = (u32)PartitionInfoBuf + 0x20;
for (i = 0; i < **(u32 **)&DataToc; i++) {
BS2Report("gamePartition ... 0x%08X\n", (u32)((DVDPartitionInfo *)PartitionCursor)->partition);
BS2Report("type ... 0x%08X\n", ((DVDPartitionInfo *)PartitionCursor)->partitionType);
if (((DVDPartitionInfo *)PartitionCursor)->partitionType & 0xFF000000) {
BS2Report(" count++\n");
(*count)++;
}
PartitionCursor += 8;
}
PartitionCursor += 8;
return TRUE;
}
return TRUE;
getLockedTitles:
titleCount = *count;
if (titleCount != 0) {
PartitionCursor = (u32)PartitionInfoBuf;
@@ -727,6 +724,7 @@ void BS2StartGame() {
}
status = LowReadResult;
// MWCC needs the shared fatal and completion exits below.
if (status != 2) {
if ((status >= 2) || (status < 1)) {
goto disk_fatal;
@@ -1479,6 +1477,7 @@ BS2State BS2Tick() {
if (bootDisc->rvlMagic == 0x5d1c9ea3) {
discTitle = (const char *)0x80000000;
status = strncmp(discTitle, "RAAE", 4);
// MWCC needs both 410 comparisons to preserve the instruction stream.
if (status == 0 || strncmp(discTitle, "408", 3) == 0 ||
strncmp(discTitle, "410", 3) == 0 ||
strncmp(discTitle, "410", 3) == 0)
@@ -1533,6 +1532,7 @@ BS2State BS2Tick() {
break;
discRegion = bi2.countryCode;
productRegion = SCGetProductGameRegion();
// MWCC needs the shared false-result paths in these region switches.
switch (productRegion) {
case 0:
if (discRegion != 0)

View File

@@ -49,6 +49,7 @@ char* getSuffix(const char* path) {
return suffix;
}
// MWCC needs the shared product-region result paths to preserve branch layout.
static inline u32 BS2SelectUpdateEntries(void) {
static u32 Flags0[BS2_UPDATE_ENTRY_COUNT];
BOOL missingFile;
@@ -141,11 +142,11 @@ product_region_checked:
strcat(updatePath, productArea);
if (DVDConvertPathToEntrynum(updatePath) < 0) {
switch (SCGetProductArea()) {
case 0:
case 1:
case 2:
case 6:
case 11:
case SC_PRODUCT_AREA_JPN:
case SC_PRODUCT_AREA_USA:
case SC_PRODUCT_AREA_EUR:
case SC_PRODUCT_AREA_KOR:
case SC_PRODUCT_AREA_CHN:
strcpy(updatePath, "__update.inf");
if (DVDConvertPathToEntrynum(updatePath) < 0) {
BS2Report("Error: update information file is not found.");
@@ -237,11 +238,11 @@ product_region_checked:
strcat(seatPath, productArea);
if (DVDConvertPathToEntrynum(seatPath) < 0) {
switch (SCGetProductArea()) {
case 0:
case 1:
case 2:
case 6:
case 11:
case SC_PRODUCT_AREA_JPN:
case SC_PRODUCT_AREA_USA:
case SC_PRODUCT_AREA_EUR:
case SC_PRODUCT_AREA_KOR:
case SC_PRODUCT_AREA_CHN:
strcpy(seatPath, "__seatholder.inf");
if (DVDConvertPathToEntrynum(seatPath) < 0) {
BS2Report("Error: update seatholder information file is not found.");

View File

@@ -115,99 +115,48 @@ extern const u8 controlKeys[];
u32 modifierFlag = modifierState & 0x8;
while (currentKeySet.IsValid()) {
for (; currentKeySet.IsValid(); currentKeySet = currentKeySet.GetNext()) {
int key = currentKeySet.GetKey();
u32 command;
if (key == 0x4c) {
goto sendCommand2;
}
if (key < 0x4c) {
if (key != 0x2b) {
if (key < 0x2b) {
if (key >= 0x2a) {
goto sendCommand1;
}
} else {
if (key >= 0x2d) {
goto nextRepeatedKey;
}
goto checkSpecialCommand;
}
// MWCC needs the navigation cases to share this command tail.
switch (key) {
case 0x4c:
sendCommand(2, NULL);
continue;
case 0x2a:
sendCommand(1, NULL);
continue;
case 0x4f:
command = 0x20;
goto sendNavigationCommand;
case 0x50:
command = 0x1f;
goto sendNavigationCommand;
case 0x51:
command = 0x1e;
goto sendNavigationCommand;
case 0x52:
command = 0x1d;
sendNavigationCommand:
{
u32 commandData[2];
commandData[0] = command;
commandData[1] = modifierState;
sendCommand(0x26, commandData);
}
goto nextRepeatedKey;
}
if (key == 0x51) {
goto setNavigationCommand1e;
}
if (key < 0x51) {
if (key == 0x4f) {
goto setNavigationCommand20;
} else if (key >= 0x4f) {
goto setNavigationCommand1f;
continue;
case 0x2c:
if ((mgr()->getToolBar()->isQwerty() ||
!mgr()->getCellPhoneKeyboard()->isNumeric()) && modifierFlag == 0) {
NavigationCommand commandData = {8, modifierState};
sendCommand(0x26, &commandData);
}
} else {
if (key >= 0x53) {
goto nextRepeatedKey;
}
goto setNavigationCommand1d;
continue;
case 0x2b:
default:
continue;
}
goto nextRepeatedKey;
sendCommand2:
sendCommand(2, NULL);
goto nextRepeatedKey;
sendCommand1:
sendCommand(1, NULL);
goto nextRepeatedKey;
setNavigationCommand20:
command = 0x20;
goto sendNavigationCommand;
setNavigationCommand1f:
command = 0x1f;
goto sendNavigationCommand;
setNavigationCommand1e:
command = 0x1e;
goto sendNavigationCommand;
setNavigationCommand1d:
command = 0x1d;
sendNavigationCommand:
{
u32 commandData[2];
commandData[0] = command;
commandData[1] = modifierState;
sendCommand(0x26, commandData);
}
goto nextRepeatedKey;
checkSpecialCommand:
if (mgr()->getToolBar()->isQwerty() ||
!mgr()->getCellPhoneKeyboard()->isNumeric()) {
if (modifierFlag == 0) {
goto sendSpecialCommand;
}
}
goto nextRepeatedKey;
sendSpecialCommand:
{
NavigationCommand commandData = {8, modifierState};
sendCommand(0x26, &commandData);
}
nextRepeatedKey:
currentKeySet = currentKeySet.GetNext();
}
return false;
@@ -250,29 +199,28 @@ extern const u8 controlKeys[];
bool sendCharacter = true;
if (!mgr()->getToolBar()->isQwerty() &&
mgr()->getCellPhoneKeyboard()->isNumeric()) {
if (static_cast<wchar_t>(character) == '/') {
goto suppressCharacter;
}
if (static_cast<wchar_t>(character) < '/') {
if (static_cast<wchar_t>(character) >= '.') {
goto checkNumericDot;
switch (static_cast<wchar_t>(character)) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
break;
case '.':
if (mgr()->getCellPhoneKeyboard()->isNumericWithDot()) {
break;
}
goto suppressCharacter;
case '/':
default:
sendCharacter = false;
break;
}
if (static_cast<wchar_t>(character) >= ':') {
goto suppressCharacter;
}
goto sendCharacterCheck;
checkNumericDot:
if (mgr()->getCellPhoneKeyboard()->isNumericWithDot()) {
goto sendCharacterCheck;
}
suppressCharacter:
sendCharacter = false;
}
goto sendCharacterCheck;
sendCharacterCheck:
if (sendCharacter) {
modifierState = 0;
if ((hkbManager.GetModifierState() & 0x2) != 0) {
@@ -287,7 +235,7 @@ extern const u8 controlKeys[];
}
character = convertWCCode(character);
KeyInputData keyInputData = {0, 0, 0, 1, 0, 0, 0};
KeyInputData keyInputData = {0, 0, 0, 1, 0, 0, 0};
keyInputData.character = character;
keyInputData.modifier = modifierState;
sendCommand(0, &keyInputData);
@@ -325,24 +273,21 @@ extern const u8 controlKeys[];
hkbManager.SetModifierState(capsLock ? 0x100 : 0, 0x100);
}
if (mgr()->getToolBar()->isQwerty() ||
!mgr()->getCellPhoneKeyboard()->isNumeric()) {
goto sendKeyCheck;
if (!mgr()->getToolBar()->isQwerty() &&
mgr()->getCellPhoneKeyboard()->isNumeric()) {
switch (translatedKey) {
case 0x15:
case 0x16:
case 0x1d:
case 0x1e:
case 0x1f:
case 0x20:
break;
default:
sendKey = false;
break;
}
}
switch (translatedKey) {
case 0x15:
case 0x16:
case 0x1d:
case 0x1e:
case 0x1f:
case 0x20:
break;
default:
sendKey = false;
break;
}
sendKeyCheck:
if (sendKey) {
u32 commandData[2] = {translatedKey, modifierState};
sendCommand(0x26, commandData);

View File

@@ -211,6 +211,7 @@ extern "C" char scT_title_textCHN[] = "T_title_textCHN";
bool DeadKeyStream::sbCompatibleFilterEnabled = true;
bool mbHyphen = true;
// MWCC needs the local compatibility table in .data.
#pragma push
#pragma section const_type ".data"
inline bool DeadKeyStream::isCompatible(wchar_t character) {
@@ -1456,46 +1457,22 @@ bool Base::findURL(u32* start, u32* end, const wchar_t* string, u32 from, u32 to
wordStart = true;
for (position = from; position < to; ++position) {
wchar_t character = string[position];
if (s32(character) < L'A') {
if (s32(character) == L'\r') goto separator;
if (s32(character) < L'\r') {
if (s32(character) == L'\n') goto separator;
if (s32(character) >= L'\n') goto punctuation;
if (!character) goto endString;
goto punctuation;
}
if (s32(character) < L'0') {
if (s32(character) == L' ') goto separator;
goto punctuation;
}
if (s32(character) >= L':') goto punctuation;
goto wordCharacter;
}
if (s32(character) == L'h') goto prefixStart;
if (s32(character) < L'h') {
if (s32(character) < L'[') {
if (s32(character) == L'H') goto prefixStart;
goto wordCharacter;
}
if (s32(character) >= L'a') goto wordCharacter;
goto punctuation;
}
if (s32(character) == 0x3000) goto separator;
if (s32(character) >= 0x3000) goto punctuation;
if (s32(character) >= L'{') goto punctuation;
goto wordCharacter;
endString:
if (found && end) *end = position;
return found;
separator: {
switch (s32(character)) {
case 0:
if (found && end) *end = position;
return found;
case L'\r':
case L'\n':
case L' ':
case 0x3000:
if (!found) wordStart = true;
else {
if (end) *end = position;
return true;
}
goto nextCharacter;
}
prefixStart: {
break;
case L'h':
case L'H':
if (wordStart && !found) {
prefix = prefixes;
current = &string[position];
@@ -1510,15 +1487,73 @@ bool Base::findURL(u32* start, u32* end, const wchar_t* string, u32 from, u32 to
}
}
}
goto nextCharacter;
break;
case L'0':
case L'1':
case L'2':
case L'3':
case L'4':
case L'5':
case L'6':
case L'7':
case L'8':
case L'9':
case L'A':
case L'B':
case L'C':
case L'D':
case L'E':
case L'F':
case L'G':
case L'I':
case L'J':
case L'K':
case L'L':
case L'M':
case L'N':
case L'O':
case L'P':
case L'Q':
case L'R':
case L'S':
case L'T':
case L'U':
case L'V':
case L'W':
case L'X':
case L'Y':
case L'Z':
case L'a':
case L'b':
case L'c':
case L'd':
case L'e':
case L'f':
case L'g':
case L'i':
case L'j':
case L'k':
case L'l':
case L'm':
case L'n':
case L'o':
case L'p':
case L'q':
case L'r':
case L's':
case L't':
case L'u':
case L'v':
case L'w':
case L'x':
case L'y':
case L'z':
wordStart = false;
break;
default:
wordStart = true;
break;
}
wordCharacter:
wordStart = false;
goto nextCharacter;
punctuation:
wordStart = true;
nextCharacter:
continue;
}
return found;
}
@@ -2742,6 +2777,7 @@ void Base::dirtyCacheAll() {
dirtyDrawCache();
}
// MWCC needs the direct-ABC path to join after the input-mode checks.
void Base::notifyChangeMode() {
if (mePredictMode == PM_Atok) {
if (mpManager->getToolBar()->isQwerty()) {

View File

@@ -141,6 +141,7 @@ wchar_t StringBase::getLastWChar() {
}
namespace {
// This build has no Hangul composer; syllable state stays empty and keys are committed as typed.
// MWCC needs these aggregate tests and dead stores for Hangul scheduling and count narrowing.
struct HangulSyllable {
u32 length;

View File

@@ -72,16 +72,14 @@ void WithZi::ChangeDictionaryLanguage(u8 language) {
}
if (entryIndex != -1) {
dictionaryEntry = reinterpret_cast<u32*>(dictionaryTable[entryIndex].table);
if (dictionaryEntry == NULL) goto noDictionary;
attached = EZTXAttachOEMDict(
(u8*)SearchOEMDictionary, *dictionaryEntry & 0xffff,
dictionaryEntry, mpDictionaryWork);
mOemDictionaryId = attached & 0xff;
goto dictionaryReady;
noDictionary:
mOemDictionaryId = 0;
dictionaryReady:
;
if (dictionaryEntry != NULL) {
attached = EZTXAttachOEMDict(
(u8*)SearchOEMDictionary, *dictionaryEntry & 0xffff,
dictionaryEntry, mpDictionaryWork);
mOemDictionaryId = attached & 0xff;
} else {
mOemDictionaryId = 0;
}
}
}
}
@@ -271,6 +269,7 @@ void WithZi::partialConfirmForKR() {
const wchar_t* letters;
wchar_t value = util::toWLower(CandidatesBuffer[mInputLength - 1]);
letters = kKoreanFinalLetters;
// MWCC needs the match flag assigned at the loop exits.
for (index = 0; index < 12; ++index) {
if (value == *letters) {
match = true;
@@ -280,17 +279,14 @@ void WithZi::partialConfirmForKR() {
}
match = false;
finalLetterChecked:
if (!match) goto keepLastLetter;
value = util::toWLower(CandidatesBuffer[mInputLength - 2]);
if (!IsKoreanLeadingLetter(value)) goto keepLastLetter;
CandidatesBuffer[0] = CandidatesBuffer[mInputLength - 2];
CandidatesBuffer[1] = CandidatesBuffer[mInputLength - 1];
mInputLength = 2;
goto confirmLetters;
keepLastLetter:
CandidatesBuffer[0] = CandidatesBuffer[mInputLength - 1];
mInputLength = 1;
confirmLetters:
if (match && IsKoreanLeadingLetter(util::toWLower(CandidatesBuffer[mInputLength - 2]))) {
CandidatesBuffer[0] = CandidatesBuffer[mInputLength - 2];
CandidatesBuffer[1] = CandidatesBuffer[mInputLength - 1];
mInputLength = 2;
} else {
CandidatesBuffer[0] = CandidatesBuffer[mInputLength - 1];
mInputLength = 1;
}
CandidatesBuffer[mInputLength] = 0;
update();
}
@@ -393,12 +389,14 @@ void WithZi::update() {
if (static_cast<s32>(count) > 0x28) {
count = 0x28;
}
if (getPredictLanguage() == ZI8_LANG_ZH && mbContextChanged != 0 &&
(mbContextChanged = 0, mSearch.count == 0)) {
copyLength = mCurrentWordLength;
CopyWordSuffix(LatestWord, copyLength);
mSearch.wordCharCount = wcslen((wchar_t*)LatestWord);
count = EZTXGetCandidates(&mSearch, mpDictionaryWork) & 0xff;
if (getPredictLanguage() == ZI8_LANG_ZH && mbContextChanged != 0) {
mbContextChanged = 0;
if (mSearch.count == 0) {
copyLength = mCurrentWordLength;
CopyWordSuffix(LatestWord, copyLength);
mSearch.wordCharCount = wcslen((wchar_t*)LatestWord);
count = EZTXGetCandidates(&mSearch, mpDictionaryWork) & 0xff;
}
}
if (count == 0) {
if (getPredictLanguage() != ZI8_LANG_ZH) {
@@ -415,6 +413,7 @@ void WithZi::update() {
if (elementCount != 0 || mSearch.wordCharCount != 0) {
source = reinterpret_cast<u16*>(mSearch.candidates);
destination = CandidatedWord;
// MWCC needs failed copies to join at the destination advance.
for (index = 0; index < static_cast<s32>(count); index++) {
if (getPredictLanguage() == ZI8_LANG_ZH) {
candidateLength = 0;
@@ -466,22 +465,17 @@ nextCandidate:
}
}
u32 WithZi::complementsCandidates_(s32) {
bool useSentinel;
static inline bool HasNumericElement(const u16* scan) {
u16 value;
u16* scan = ElementBuffer;
goto scanCheck;
scanBody:
if (0xeff1 <= value && value <= 0xeff9) {
useSentinel = true;
goto scanDone;
while ((value = *scan) != 0) {
if (0xeff1 <= value && value <= 0xeff9) return true;
++scan;
}
++scan;
scanCheck:
value = *scan;
if (value != 0) goto scanBody;
useSentinel = false;
scanDone:
return false;
}
u32 WithZi::complementsCandidates_(s32) {
bool useSentinel = HasNumericElement(ElementBuffer);
if (useSentinel) {
CandidatedWord[mInputLength - 1] = 0xfffe;
CandidatedWord[mInputLength] = 0;
@@ -497,31 +491,26 @@ scanDone:
character = source;
while (*source != 0) {
s32 mode = mLetterMode;
if (mode == 2) goto modeTwo;
if (mode >= 2) goto modeThree;
if (mode == 0) goto modeZero;
if (mode >= 0) goto modeOne;
goto modeDone;
modeThree:
if (mode >= 4) goto modeDone;
goto modeCopy;
modeOne:
*destination = util::toWLower(*character);
goto modeDone;
modeTwo:
*destination = util::toWUpper(*character);
goto modeDone;
modeZero:
if (length == 0) {
*destination = util::toWUpper(*character);
}
else {
switch (mode) {
case LM_1:
*destination = util::toWLower(*character);
break;
case LM_2:
*destination = util::toWUpper(*character);
break;
case LM_0:
if (length == 0) {
*destination = util::toWUpper(*character);
} else {
*destination = util::toWLower(*character);
}
break;
case LM_3:
*destination = *character;
break;
default:
break;
}
goto modeDone;
modeCopy:
*destination = *character;
modeDone:
++source;
++character;
++destination;

View File

@@ -0,0 +1,89 @@
# cleanup2-w6 attempts
Baseline 85d653b0dba14d81de4d9cf125a945d8c6ef57f7. Full 43U build passed before edits; all 1028 units linked and matched. DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. Existing untracked rx4/rx59/rx70 files are outside this task.
Read cleanup-common.md, including wave-2 guidance. Applied unslop and writing-for-agents to this log and final report. Queried the existing WithZi graph. Older memory reports describe pre-completion source trials; current built objects govern cleanup.
Every trial compares allocated section bytes, layout, and resolved relocations with the initial built object. A byte change or build failure restores the immediately preceding source and rebuilds it. Common error exits and required compiler forms remain when structured alternatives change bytes.
## Trials
- keyboard/tiString: restore Hangul composer explanation beside MWCC note: retained; allocated bytes, section layout, and resolved relocations identical.
- keyboard/tiZiString: ChangeDictionaryLanguage use if/else instead of dictionary gotos: retained; allocated bytes, section layout, and resolved relocations identical.
- keyboard/tiZiString: partialConfirmForKR replace final-letter goto with loop break: reverted; changed .text.
- keyboard/tiZiString: partialConfirmForKR use structured trailing-letter selection: reverted; changed .text.
- keyboard/tiZiString: update move context reset out of comma condition: retained; allocated bytes, section layout, and resolved relocations identical.
- keyboard/tiZiString: update replace candidate-skip goto with continue: reverted; changed .rela.data, .rela.text, .text.
- keyboard/tiZiString: complementsCandidates_ replace scan gotos with while and break: reverted; changed .text.
- keyboard/tiZiString: complementsCandidates_ replace mode gotos with enum switch: retained; allocated bytes, section layout, and resolved relocations identical.
- keyboard/tiZiString: setElementBuffer replace ElementInputView with related buffer pointers: reverted; changed .text.
- keyboard/tiHwKeyboard: updateTriggerKey_ structure numeric character filtering: reverted; changed .rela.data, .rela.text, .text.
- keyboard/tiHwKeyboard: updateTriggerKey_ structure numeric control-key filtering: retained; allocated bytes, section layout, and resolved relocations identical.
- keyboard/tiHwKeyboard: updateRepeatKey_ replace dispatch gotos with switch: reverted; changed .rela.data, .rela.text, .text.
- keyboard/tiHwKeyboard: align key-input initialization with surrounding statements: retained; allocated bytes, section layout, and resolved relocations identical.
- keyboard/tiInputForm: findURL replace character-dispatch gotos with character switch: retained; allocated bytes, section layout, and resolved relocations identical.
- keyboard/tiInputForm: notifyChangeMode replace checkInput jump with explicit mode-check flag: reverted; changed .rela.ctors, .rela.data, .rela.text, .text.
- keyboard/tiInputForm: remove DeadKeyStream const-section pragma with mutable local table: reverted; changed .data, .rela.data, .rela.text, .rodata, .text.
- BS2/BS2Update: BS2SelectUpdateEntries replace product-region jumps with if/else: reverted; changed .rela.data, .rela.text, .text.
- BS2/BS2Update: BS2SelectUpdateEntries use product-area enum names in fallback switches: retained; allocated bytes, section layout, and resolved relocations identical.
- BS2/BS2Mach: BS2GetLockedTitles replace entry jump with a null-output branch: retained; allocated bytes, section layout, and resolved relocations identical.
- BS2/BS2Mach: BS2Tick structure GameCube region selection: reverted; changed .rela.data, .rela.text, .text.
- BS2/BS2Mach: BS2Tick structure Wii region selection: reverted; changed .rela.data, .rela.text, .text.
- BS2/BS2Mach: BS2Tick structure title-prefix dispatch and universal-region case: reverted; build failed.
- BS2/BS2Mach: BS2Tick remove duplicate 410 title comparison: reverted; changed .rela.data, .rela.text, .text.
- keyboard/tiHwKeyboard: updateRepeatKey_ use for-loop dispatch with explicit Tab case: reverted; changed .rela.data, .rela.text, .text.
- keyboard/tiHwKeyboard: updateTriggerKey_ use explicit digit and punctuation switch: reverted; changed .rela.data, .rela.text, .text.
- BS2/BS2Mach: BS2Tick structure title-prefix dispatch with corrected scope: reverted; changed .rela.data, .rela.text, .text; functions BS2Tick: 849 changed instructions, 1939/1940.
- BS2/BS2Mach: BS2StartGame structure disk-error exits with a single attempt block: retained; allocated bytes, section layout, and resolved relocations identical.
- BS2/BS2Mach: BS2StartGame structure partition-error exits with a single attempt block: reverted; changed .rela.data, .rela.text, .text; functions BS2StartGame: 62 changed instructions, 392/393.
- BS2/BS2Update: BS2SelectUpdateEntries use an inline product-region validator: reverted; changed .rela.data, .rela.text, .text; functions UpdateThread: 830 changed instructions, 923/913.
- keyboard/tiZiString: partialConfirmForKR select trailing letters with a short-circuit leading-letter test: retained; allocated bytes, section layout, and resolved relocations identical.
- keyboard/tiZiString: partialConfirmForKR use a final-letter lookup matching the leading-letter helper: reverted; changed .text; functions partialConfirmForKR__Q39textinput8tistring6WithZiFv: 11 changed instructions, 147/147.
- keyboard/tiZiString: complementsCandidates_ use an inline numeric-element search: retained; allocated bytes, section layout, and resolved relocations identical.
- keyboard/tiZiString: update put candidate-success processing in a single-attempt block: retained; allocated bytes, section layout, and resolved relocations identical.
- keyboard/tiHwKeyboard: updateRepeatKey_ use for-loop dispatch with explicit Tab case: reverted; changed .rela.data, .rela.text, .text; functions updateRepeatKey___Q49textinput8keyboard5hwkey10HWKeyboardFRQ39textinput5input10HKBManager: 84 changed instructions, 181/180.
- keyboard/tiHwKeyboard: updateTriggerKey_ use explicit digit and punctuation switch: reverted; changed .rela.data, .rela.text, .text; functions updateTriggerKey___Q49textinput8keyboard5hwkey10HWKeyboardFRQ39textinput5input10HKBManager: 241 changed instructions, 409/405.
- keyboard/tiHwKeyboard: updateRepeatKey_ use direct switch arms sharing one navigation payload: reverted; changed .rela.data, .rela.text, .text; functions updateRepeatKey___Q49textinput8keyboard5hwkey10HWKeyboardFRQ39textinput5input10HKBManager: 202 changed instructions, 205/180.
- keyboard/tiHwKeyboard: updateTriggerKey_ place shared suppression after the numeric-dot case: retained; allocated bytes, section layout, and resolved relocations identical.
- keyboard/tiHwKeyboard: updateRepeatKey_ replace dispatch tree with switch while retaining shared navigation tail: retained; allocated bytes, section layout, and resolved relocations identical.
- keyboard/tiZiString: update use a copy-success condition instead of a single-attempt block: reverted; changed .rela.data, .rela.text, .text; functions update__Q39textinput8tistring6WithZiFv: 205 changed instructions, 450/446.
- BS2/BS2Mach: keep idiomatic disk fatal/completion exits instead of an empty-branch single-attempt block: retained; allocated bytes, section layout, and resolved relocations identical.
- keyboard/tiZiString: update retain the shared failed-copy exit instead of a synthetic single-attempt loop: retained; allocated bytes, section layout, and resolved relocations identical.
- keyboard/tiZiString: document remaining final-letter and candidate-copy branch requirements: retained; allocated bytes, section layout, and resolved relocations identical.
- BS2/BS2Mach: indent the locked-title branch and document remaining compiler paths: retained; allocated bytes, section layout, and resolved relocations identical.
- BS2/BS2Update: document shared region and optional-seat exits required by MWCC: retained; allocated bytes, section layout, and resolved relocations identical.
- keyboard/tiInputForm: document the required compatibility-table section and mode-check exit: retained; allocated bytes, section layout, and resolved relocations identical.
- keyboard/tiHwKeyboard: document the shared navigation tail required by MWCC: retained; allocated bytes, section layout, and resolved relocations identical.
## Retained result
- BS2/BS2Update: gotos 35 -> 35. Named both fallback product-area switches with existing enums. Shared product-region paths stay because if/else and an inline validator change UpdateThread bytes. Common selection and optional-seat exits remain idiomatic error paths.
- BS2/BS2Mach: gotos 25 -> 24. Removed the locked-title entry jump with a null-output branch. Region-result jumps, shared fatal exits, interrupt-shared definitions, and repeated 410 check stay. Region restructuring and duplicate-check removal change bytes. Discarded the exact single-attempt disk block because its empty branch reads worse than common exits.
- keyboard/tiHwKeyboard: gotos 27 -> 3. Used a switch and for-loop for repeated-key dispatch, a character switch for numeric input, and a guarded switch for control keys. Kept three navigation jumps to their shared command tail. A fully structured tail adds a branch; duplicated send arms add 25 instructions. Fixed key-input indentation.
- keyboard/tiInputForm: gotos 22 -> 1. Replaced findURL character dispatch with a structured switch. Kept notifyChangeMode's shared mode-check exit and the local .data table pragma. Explicit mode flags and a mutable table without the pragma change code or data. Earlier cleanup-c7 trials already prove the geometry and stripped-function forms; those families were not repeated.
- keyboard/tiZiString: gotos 20 -> 2. Structured dictionary selection, trailing Korean-letter selection, numeric-element scanning, and letter-mode dispatch. Removed the context-reset comma condition. Kept the final-letter match exit, failed-copy destination join, and related buffer view because alternatives change instructions. Discarded the exact single-attempt candidate block as needless loop structure.
- keyboard/tiString: gotos 5 -> 5. Restored the no-Hangul-composer explanation immediately above the MWCC note. Exactly two comment lines; all source behavior and object bytes unchanged.
## Final verification
Every allocated section byte, size, alignment, and resolved relocation in all six units equals the initial built object. Every owned reported code and data section is 100%; all six units remain Matching and fully linked.
- BS2/BS2Update: exact functions 10/10; code 4052/4052; data 10488/10488.
- BS2/BS2Mach: exact functions 29/29; code 16980/16980; data 158528/158528.
- keyboard/tiHwKeyboard: exact functions 10/10; code 4596/4596; data 504/504.
- keyboard/tiInputForm: exact functions 221/221; code 50656/50656; data 3772/3772.
- keyboard/tiZiString: exact functions 29/29; code 5504/5504; data 7680/7680.
- keyboard/tiString: exact functions 42/42; code 5176/5176; data 288/288.
Full 43U build and build/43U/ok passed. Refreshed build/43U/report.json; check_decomp_complete.py returned DECOMPLETE_OK. All 12563 functions are exact and all 1028 units linked. The aggregate fuzzy value remains the baseline 99.999886 despite the all-exact function measures.
GATE PASS: 0 regressions, 0 forbidden additions, 0 readability warnings. Gate output /tmp/cleanup2-w6-gate.txt. DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. Focused source review and git diff --check passed.
## Source commits
- 514b873f src/BS2/BS2Update.c
- 82c61d70 src/BS2/BS2Mach.c
- dbeee8f0 src/keyboard/tiHwKeyboard.cpp
- 80824034 src/keyboard/tiInputForm.cpp
- e2c90614 src/keyboard/tiZiString.cpp
- aa8f80aa src/keyboard/tiString.cpp