Compare commits
1 Commits
cleanup/ip
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c963e70af2 |
@@ -53,9 +53,9 @@ Progress
|
||||
<!-- progress:start -->
|
||||
| Decompiled | Matched | Linked | Data |
|
||||
|:---:|:---:|:---:|:---:|
|
||||
| 92.68% | 81.48% | 57.21% | 88.99% |
|
||||
| 92.68% | 81.49% | 57.21% | 88.99% |
|
||||
|
||||
units 768/1027 complete, functions 11731/12563 matched.
|
||||
units 768/1027 complete, functions 11732/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 -->
|
||||
|
||||
@@ -558,6 +558,10 @@ static void kbdSendKey(KBDKeyEventData* event) {
|
||||
}
|
||||
}
|
||||
|
||||
static inline u32 kbdChannelFlags(u32 channel) {
|
||||
return kbdData[channel].flags;
|
||||
}
|
||||
|
||||
static void kbd_led_handler(BOOL success, void* callbackArg) {
|
||||
u32 index;
|
||||
u32 result;
|
||||
@@ -591,7 +595,7 @@ USBKBDErr KBDSetLedsAsync(u32 channel, u32 leds, USBKBDCmdLEDCallback callback,
|
||||
if (channel >= 4) {
|
||||
return 4;
|
||||
}
|
||||
if ((s32)kbdData[channel].flags == 1 || (s32)kbdData[channel].flags == 4) {
|
||||
if ((s32)kbdData[(u8)channel].flags == 1 || (s32)kbdData[(u8)channel].flags == 4) {
|
||||
return 5;
|
||||
}
|
||||
ledBits = leds;
|
||||
@@ -611,10 +615,12 @@ USBKBDErr KBDSetLedsAsync(u32 channel, u32 leds, USBKBDCmdLEDCallback callback,
|
||||
result = USBKBDSetLEDAsync((u32)kbdData[channel].device, ledBits,
|
||||
(USBKBDCmdLEDAsync*)&kbdCmdBuf[index],
|
||||
kbd_led_handler, (void*)index);
|
||||
if (result != 0) {
|
||||
switch (result) {
|
||||
case 0:
|
||||
return 0;
|
||||
default:
|
||||
return 7;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
USBKBDErr KBDSetLeds(u32 channel, u32 leds) {
|
||||
@@ -627,16 +633,18 @@ USBKBDErr KBDSetLeds(u32 channel, u32 leds) {
|
||||
if (channel >= 4) {
|
||||
return 4;
|
||||
}
|
||||
if ((s32)kbdData[channel].flags == 1 || (s32)kbdData[channel].flags == 4) {
|
||||
if ((s32)kbdChannelFlags(channel) == 1 || (s32)kbdChannelFlags(channel) == 4) {
|
||||
return 5;
|
||||
}
|
||||
leds &= 0xff;
|
||||
interrupts = OSDisableInterrupts();
|
||||
for (index = 0; index < 12; index++) {
|
||||
index = 0;
|
||||
while (index < 12) {
|
||||
if ((kbdCmdBuf + index)->device == 0) {
|
||||
kbdCmdBuf[index].device = (u32)kbdData[channel].device;
|
||||
break;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
OSRestoreInterrupts(interrupts);
|
||||
if (index == 12) {
|
||||
@@ -645,10 +653,12 @@ USBKBDErr KBDSetLeds(u32 channel, u32 leds) {
|
||||
result = USBKBDSetLED((u32)kbdData[channel].device, leds,
|
||||
(USBKBDCmdLED*)&kbdCmdBuf[index]);
|
||||
kbdCmdBuf[index].device = 0;
|
||||
if (result == 0) {
|
||||
switch (result) {
|
||||
default:
|
||||
return 7;
|
||||
case 0:
|
||||
return 0;
|
||||
}
|
||||
return 7;
|
||||
}
|
||||
|
||||
void kbdInitMap(u32 country, u8 codeCount, u8 flags, u16* keyMap, u16* modifierMap,
|
||||
@@ -846,11 +856,11 @@ u16 KBDTranslateHidCode(u32 keyCode, u32 modifiers, s32 country) {
|
||||
u16* table;
|
||||
u32 keyIndex;
|
||||
u16 entry;
|
||||
u32 mask;
|
||||
u32 offset;
|
||||
s32 mask;
|
||||
s32 offset;
|
||||
s32 group;
|
||||
u32 shiftFlag;
|
||||
u32 shift;
|
||||
u16 activeFlag;
|
||||
|
||||
if (kbdInitialized == FALSE) {
|
||||
return 0xFFFF;
|
||||
@@ -890,13 +900,13 @@ u16 KBDTranslateHidCode(u32 keyCode, u32 modifiers, s32 country) {
|
||||
group = 1;
|
||||
offset = 0;
|
||||
} else {
|
||||
if ((modifiers & 0x20) == 0x20 || (modifiers & 5) == 5) {
|
||||
if ((modifiers & 0x20) != 0 || (s32)(modifiers & 5) == 5) {
|
||||
group = map->altIndex;
|
||||
shiftFlag = 0x40;
|
||||
} else if ((modifiers & 0x40) == 0x40) {
|
||||
} else if ((modifiers & 0x40) != 0) {
|
||||
group = map->lockIndex;
|
||||
shiftFlag = 4;
|
||||
} else if ((modifiers & 0x80) == 0x80) {
|
||||
} else if ((modifiers & 0x80) != 0) {
|
||||
group = map->shiftIndex;
|
||||
shiftFlag = 0x10;
|
||||
} else {
|
||||
@@ -907,18 +917,19 @@ u16 KBDTranslateHidCode(u32 keyCode, u32 modifiers, s32 country) {
|
||||
if ((modifiers & 0x800) == 0 && (modifiers & 0x1D) != 0) {
|
||||
offset = 0;
|
||||
} else {
|
||||
shift = (modifiers >> 1) & 1;
|
||||
offset = (shiftFlag << shift) & 0xFFFF;
|
||||
offset = (modifiers >> 1) & 1;
|
||||
shiftFlag <<= offset;
|
||||
activeFlag = shiftFlag;
|
||||
|
||||
if (mask == 0 && (offset & entry) != 0) {
|
||||
offset = shift ^ ((modifiers >> 9) & 1);
|
||||
} else if (mask == 0x8000 && (offset & entry) != 0) {
|
||||
offset = 0;
|
||||
if ((modifiers & 0x100) != 0 && shift == 0) {
|
||||
offset = 1;
|
||||
if (mask == 0 && (entry & activeFlag) != 0) {
|
||||
offset = offset ^ ((modifiers >> 9) & 1);
|
||||
} else if (mask == 0x8000 && (entry & activeFlag) != 0) {
|
||||
u32 numLockShift = 0;
|
||||
if ((s32)(modifiers & 0x100) == 0x100 && offset == 0) {
|
||||
numLockShift = 1;
|
||||
}
|
||||
offset = numLockShift;
|
||||
} else {
|
||||
offset = shift;
|
||||
if (mask == 0x4000 && group == 1 && (modifiers & 0x200) != 0) {
|
||||
group = map->lockIndex;
|
||||
}
|
||||
@@ -949,6 +960,6 @@ u16 KBDTranslateHidCode(u32 keyCode, u32 modifiers, s32 country) {
|
||||
|
||||
}
|
||||
|
||||
return table[keyIndex + offset + group];
|
||||
return table[keyIndex + (offset + group)];
|
||||
|
||||
}
|
||||
|
||||
@@ -110,16 +110,15 @@ void __VISetRevolutionMode(void);
|
||||
void __VISetRevolutionModeSimple(void);
|
||||
void VISetMacrovision(s32 type);
|
||||
|
||||
#define COPY_ACP(dst, src) \
|
||||
do { \
|
||||
u32 copyIndex; \
|
||||
u8* destination = (dst); \
|
||||
const u8* source = (src); \
|
||||
destination[0] = 0x40; \
|
||||
for (copyIndex = 0; copyIndex < 0x1a; copyIndex++) { \
|
||||
destination[copyIndex + 1] = source[copyIndex]; \
|
||||
} \
|
||||
} while (0)
|
||||
static inline void VICopyACP(u8* destination, const u8* source) {
|
||||
u32 index;
|
||||
destination[0] = 0x40;
|
||||
for (index = 0; index < 0x1a; index++) {
|
||||
destination[index + 1] = source[index];
|
||||
}
|
||||
}
|
||||
|
||||
#define COPY_ACP(dst, src) VICopyACP((dst), (src))
|
||||
|
||||
static u8 __wd0 = 0xff;
|
||||
static u8 __wd1 = 0xff;
|
||||
|
||||
@@ -81,11 +81,10 @@ long MemoryCardManager::isSlotWrongDevice(u8 slot) {
|
||||
|
||||
void MemoryCardManager::sort_file_array(u8 slot) {
|
||||
CardDirectory* dirs = reinterpret_cast<CardDirectory*>(memorycard::getCardDirState());
|
||||
memorycard::FileInfo* directory = &dirs[slot][0];
|
||||
for (long file = 0; file < 0x7f; file++) {
|
||||
if (directory[file].fileNo != 0) {
|
||||
if (dirs[slot][file].fileNo != 0) {
|
||||
mFile[slot][file].fileNo = file;
|
||||
mFile[slot][file].sortKey = directory[file].key;
|
||||
mFile[slot][file].sortKey = dirs[slot][file].key;
|
||||
mFile[slot][file].unk_0x08 = 0;
|
||||
} else {
|
||||
mFile[slot][file].fileNo = file;
|
||||
@@ -376,7 +375,7 @@ GXTexObj* MemoryCardManager::_create_icon(u8 slot, s16 file, long start) {
|
||||
GXLoadTexObj(&mFileCell[slot][file].icon, GX_TEXMAP0);
|
||||
} else if ((int)icon->iconFmt[start] == GX_TF_C8) {
|
||||
GXInitTexObjCI(&mFileCell[slot][file].icon, reinterpret_cast<u8*>(icon) + icon->iconOffset[start], 0x20, 0x20, GX_TF_C8, GX_CLAMP, GX_CLAMP, GX_FALSE, GX_TLUT0);
|
||||
GXInitTlutObj(&mFileCell[slot][file].iconTlut, reinterpret_cast<u8*>(icon) + icon->iconTlutOffset, GX_TL_RGB5A3, 0x100);
|
||||
GXInitTlutObj(&mFileCell[slot][file].iconTlut, reinterpret_cast<u8*>(icon) + icons[slot][file].iconTlutOffset, GX_TL_RGB5A3, 0x100);
|
||||
GXLoadTlut(&mFileCell[slot][file].iconTlut, GX_TLUT0);
|
||||
GXLoadTexObj(&mFileCell[slot][file].icon, GX_TEXMAP0);
|
||||
} else {
|
||||
@@ -387,20 +386,20 @@ GXTexObj* MemoryCardManager::_create_icon(u8 slot, s16 file, long start) {
|
||||
|
||||
const wchar_t* MemoryCardManager::getComment(u8 slot, s16 index, int which) {
|
||||
int file = mFile[slot][index].fileNo;
|
||||
wchar_t* dest = mFileCell[slot][file].comment[which];
|
||||
wmemset(dest, 0, 0x40);
|
||||
wmemset(mFileCell[slot][file].comment[which], 0, 0x40);
|
||||
char comment[33] = {0};
|
||||
const char* comments = memorycard::getIconComment(slot, file);
|
||||
memcpy(comment, comments + which * 0x20, 0x20);
|
||||
char* end = comment + 0x1f;
|
||||
char* tail = end;
|
||||
const u8* encoded = reinterpret_cast<const u8*>(comment);
|
||||
char* tail = comment + 0x1f;
|
||||
char* end = tail;
|
||||
for (; *end == ' ' || *end == '\n' || *end == 0;) {
|
||||
*tail = 0;
|
||||
end--;
|
||||
tail--;
|
||||
}
|
||||
if (SCGetLanguage() == 0) {
|
||||
utility::CharacterCode::shiftJISToUTF16(dest, reinterpret_cast<const u8*>(comment), 0x20);
|
||||
utility::CharacterCode::shiftJISToUTF16(mFileCell[slot][file].comment[which], encoded, 0x20);
|
||||
for (int pos = 0x1f;
|
||||
mFileCell[slot][file].comment[which][pos] == 0x20 ||
|
||||
mFileCell[slot][file].comment[which][pos] == 0x3000 ||
|
||||
@@ -409,7 +408,7 @@ const wchar_t* MemoryCardManager::getComment(u8 slot, s16 index, int which) {
|
||||
mFileCell[slot][file].comment[which][pos--] = 0;
|
||||
}
|
||||
} else {
|
||||
utility::CharacterCode::ANSIToUTF16(dest, reinterpret_cast<const u8*>(comment), 0x20);
|
||||
utility::CharacterCode::ANSIToUTF16(mFileCell[slot][file].comment[which], encoded, 0x20);
|
||||
}
|
||||
bool found = false;
|
||||
int count = 0;
|
||||
@@ -429,10 +428,10 @@ GXTexObj* MemoryCardManager::create_banner(u8 slot, s16 index) {
|
||||
CardDirectory* dirs = reinterpret_cast<CardDirectory*>(memorycard::getCardDirState());
|
||||
CardIcons* icons = reinterpret_cast<CardIcons*>(memorycard::getIconStateArray());
|
||||
int file = mFile[slot][index].fileNo;
|
||||
memorycard::IconState* icon = &icons[slot][file];
|
||||
if (dirs[slot][file].fileNo == 0 || !icon->bannerEnable) {
|
||||
if (dirs[slot][file].fileNo == 0 || !icons[slot][file].bannerEnable) {
|
||||
return NULL;
|
||||
}
|
||||
memorycard::IconState* icon = &icons[slot][file];
|
||||
if ((int)icon->bannerType == GX_TF_RGB5A3) {
|
||||
GXInitTexObj(&mFileCell[slot][file].banner, reinterpret_cast<u8*>(icon) + icon->bannerOffset,
|
||||
0x60, 0x20, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
@@ -440,7 +439,7 @@ GXTexObj* MemoryCardManager::create_banner(u8 slot, s16 index) {
|
||||
} else if ((int)icon->bannerType == GX_TF_C8) {
|
||||
GXInitTexObjCI(&mFileCell[slot][file].banner, reinterpret_cast<u8*>(icon) + icon->bannerOffset,
|
||||
0x60, 0x20, GX_TF_C8, GX_CLAMP, GX_CLAMP, GX_FALSE, GX_TLUT0);
|
||||
GXInitTlutObj(&mFileCell[slot][file].bannerTlut, reinterpret_cast<u8*>(icon) + icon->bannerTlutOffset, GX_TL_RGB5A3, 0x100);
|
||||
GXInitTlutObj(&mFileCell[slot][file].bannerTlut, reinterpret_cast<u8*>(icon) + icons[slot][file].bannerTlutOffset, GX_TL_RGB5A3, 0x100);
|
||||
GXLoadTlut(&mFileCell[slot][file].bannerTlut, GX_TLUT0);
|
||||
GXLoadTexObj(&mFileCell[slot][file].banner, GX_TEXMAP0);
|
||||
}
|
||||
|
||||
@@ -171,3 +171,80 @@ Final instruction evidence:
|
||||
|
||||
A unit-only guarded u32 getBlocks return declaration was tested: same 25/25 instructions and nine epilogue-scheduling differences. Header and macro restored. No target or source data sections.
|
||||
No new instruction-exact functions yet; retained source experiments remain uncommitted pending an exact-function gain.
|
||||
|
||||
|
||||
# Continuation from e81a2616
|
||||
|
||||
## _create_icon__Q33ipl5scene17MemoryCardManagerFUcsl
|
||||
|
||||
1. recompute CI palette state from original array after GX initialization: 87.55%; `src 0x190 base 0x190 insns 100/100; diffs 37: [19, 20, 22, 23, 24, 34, 39, 40, 42, 44, 45, 46, 47, 48, 57, 59, 63, 64, 65, 66]`.
|
||||
2. array row texture view with recomputed palette field: 59.71%; `src 0x17c base 0x190 insns 95/100; --- replace mine 5:7 base 5:7`.
|
||||
3. branch result texture lifetime follows RGB and CI target joins: 85.3%; `src 0x194 base 0x190 insns 101/100; --- replace mine 5:9 base 5:9`.
|
||||
|
||||
## create_banner__Q33ipl5scene17MemoryCardManagerFUcs
|
||||
|
||||
1. reload CI palette offset from source array after initializer: 84.43396%; `src 0x1a8 base 0x1a8 insns 106/106; diffs 66: [9, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 32, 33, 34, 35, 36, 37, 38, 39]`.
|
||||
2. defer cached icon until directory and banner validity blocks: 90.42453%; `src 0x1a8 base 0x1a8 insns 106/106; diffs 70: [5, 6, 9, 11, 14, 16, 17, 18, 19, 23, 24, 25, 26, 27, 32, 33, 34, 35, 36, 37]`.
|
||||
3. row texture view and array palette reload: 58.31132%; `src 0x184 base 0x1a8 insns 97/106; --- replace mine 0:1 base 0:1`.
|
||||
|
||||
## getComment__Q33ipl5scene17MemoryCardManagerFUcsi
|
||||
|
||||
1. trim write pointer allocated before read pointer as target r4 then r3: 93.21138%; `src 0x1e8 base 0x1ec insns 122/123; --- replace mine 10:11 base 10:11`.
|
||||
2. retain encoded buffer pointer across language query and both converter blocks: 96.544716%; `src 0x1ec base 0x1ec insns 123/123; diffs 35: [10, 12, 13, 14, 19, 20, 21, 22, 23, 24, 35, 44, 45, 46, 47, 48, 49, 50, 51, 52]`.
|
||||
3. retain file cell base across conversion and final line truncation: 83.0813%; `src 0x1c4 base 0x1ec insns 113/123; --- replace mine 0:1 base 0:1`.
|
||||
4. encoded pointer established before ASCII trim block as target: 98.57723%; `src 0x1ec base 0x1ec insns 123/123; diffs 26: [10, 12, 13, 14, 19, 20, 21, 22, 23, 24, 35, 44, 45, 46, 48, 49, 51, 62, 63, 66]`.
|
||||
5. encoded pointer established before source copy: 95.56911%; `src 0x1ec base 0x1ec insns 123/123; diffs 31: [10, 12, 13, 14, 19, 20, 21, 22, 23, 24, 35, 38, 39, 41, 42, 43, 44, 45, 46, 48]`.
|
||||
6. encoded pointer established before SDK comment getter: 95.89431%; `src 0x1ec base 0x1ec insns 123/123; diffs 37: [10, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 34, 35, 36, 37, 38, 39, 40, 41]`.
|
||||
7. direct destination arrays for wide clear and both converters: 98.94309%; `src 0x1ec base 0x1ec insns 123/123; diffs 20: [10, 12, 14, 19, 20, 21, 23, 24, 45, 46, 48, 49, 51, 62, 66, 67, 86, 90, 91, 117]`.
|
||||
8. cell row view only for destination pointer creation: 98.57723%; `src 0x1ec base 0x1ec insns 123/123; diffs 26: [10, 12, 13, 14, 19, 20, 21, 22, 23, 24, 35, 44, 45, 46, 48, 49, 51, 62, 63, 66]`.
|
||||
9. unsigned file and read pointer initialized first: 98.455284%; `src 0x1ec base 0x1ec insns 123/123; diffs 27: [10, 12, 13, 14, 19, 20, 21, 22, 23, 24, 35, 44, 45, 46, 48, 49, 50, 51, 62, 63]`.
|
||||
|
||||
## update_icon_anm__Q33ipl5scene17MemoryCardManagerFv
|
||||
|
||||
1. compound counter store then reload for upper and lower bound blocks: 96.54762%; `src 0x14c base 0x150 insns 83/84; --- replace mine 10:11 base 10:11`.
|
||||
2. load signed frame before signed delta addition: 96.72619%; `src 0x14c base 0x150 insns 83/84; --- replace mine 10:11 base 10:11`.
|
||||
3. shared cell view for ping pong and wrap stores: 94.32143%; `src 0x150 base 0x150 insns 84/84; diffs 44: [10, 18, 19, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41]`.
|
||||
|
||||
## update_file_array__Q33ipl5scene17MemoryCardManagerFUc
|
||||
|
||||
1. command range predicate directly from member: 99.72222%; `src 0x168 base 0x168 insns 90/90; diffs 4: [15, 16, 17, 20]`.
|
||||
2. unsigned command temporary matching range comparison: 99.72222%; `src 0x168 base 0x168 insns 90/90; diffs 4: [15, 16, 17, 20]`.
|
||||
3. const manager view for range load: 99.72222%; `src 0x168 base 0x168 insns 90/90; diffs 4: [15, 16, 17, 20]`.
|
||||
|
||||
## sort_file_array__Q33ipl5scene17MemoryCardManagerFUc
|
||||
|
||||
1. direct slot directory indexing instead of row local: 100.0%; `src 0xcc base 0xcc insns 51/51; diffs 0: []`.
|
||||
|
||||
## isBannerEnable__Q33ipl5scene17MemoryCardManagerFUcs
|
||||
|
||||
1. return direct byte comparison: 92.30769%; `src 0x68 base 0x68 insns 26/26; diffs 8: [11, 12, 13, 14, 15, 16, 17, 18]`.
|
||||
2. explicit zero failure block and success return: 92.30769%; `src 0x68 base 0x68 insns 26/26; diffs 8: [11, 12, 13, 14, 15, 16, 17, 18]`.
|
||||
3. const state reference and conditional bool result: 92.30769%; `src 0x68 base 0x68 insns 26/26; diffs 8: [11, 12, 13, 14, 15, 16, 17, 18]`.
|
||||
|
||||
## getBlocks__Q33ipl5scene17MemoryCardManagerFUcs
|
||||
|
||||
1. signed file temporary before size load: 92.0%; `src 0x64 base 0x64 insns 25/25; diffs 9: [11, 12, 13, 14, 15, 16, 17, 18, 19]`.
|
||||
2. const directory row view for size lookup: 92.0%; `src 0x64 base 0x64 insns 25/25; diffs 9: [11, 12, 13, 14, 15, 16, 17, 18, 19]`.
|
||||
3. file reference and size result temporary: 91.0%; `src 0x64 base 0x64 insns 25/25; diffs 9: [11, 12, 13, 14, 15, 16, 17, 18, 19]`.
|
||||
|
||||
## create_icon__Q33ipl5scene17MemoryCardManagerFUcs
|
||||
|
||||
1. derive loop signed postincrement shift from target extsh and sraw: 86.05882%; `src 0xcc base 0xcc insns 51/51; diffs 20: [16, 17, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 34, 36, 37, 38, 39, 42]`.
|
||||
2. signed previous frame temporary retains 16 bit conversion: 86.05882%; `src 0xcc base 0xcc insns 51/51; diffs 20: [16, 17, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 34, 36, 37, 38, 39, 42]`.
|
||||
3. cache icon and counter outside loop, signed direct shift: 86.05882%; `src 0xcc base 0xcc insns 51/51; diffs 20: [16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 34, 36, 37, 38, 39, 42]`.
|
||||
|
||||
## isMoveEnable__Q33ipl5scene17MemoryCardManagerFUcUlPl
|
||||
|
||||
1. derive failure state initial value from card state instead of zero: 88.89831%; `src 0x1e4 base 0x1d8 insns 121/118; --- replace mine 7:8 base 7:8`.
|
||||
2. extend initialized failure state lifetime to entry: 88.72881%; `src 0x1dc base 0x1d8 insns 119/118; --- replace mine 13:14 base 13:14`.
|
||||
3. default unknown state and switch state failure blocks: 88.79661%; `src 0x1ec base 0x1d8 insns 123/118; --- insert mine 13:13 base 13:14`.
|
||||
|
||||
## isCopyEnable__Q33ipl5scene17MemoryCardManagerFUcUlPl
|
||||
|
||||
1. derive failure state initial value from card state instead of zero: 88.89831%; `src 0x1e4 base 0x1d8 insns 121/118; --- replace mine 7:8 base 7:8`.
|
||||
2. extend initialized failure state lifetime to entry: 88.72881%; `src 0x1dc base 0x1d8 insns 119/118; --- replace mine 13:14 base 13:14`.
|
||||
3. default unknown state and switch state failure blocks: 88.79661%; `src 0x1ec base 0x1d8 insns 123/118; --- insert mine 13:13 base 13:14`.
|
||||
|
||||
Target blocks were re-derived from iplMemoryCardManager.s: move/copy have a success predicate then repeated failure checks; initialized failure state adds two instructions. Icon frame selection performs signed frame extension before each duration shift. RGB and CI paths have separate texture lifetimes; the CI path reloads the palette field from the original state array after GX initialization. The banner validity block precedes caching the full icon entry. Comment conversion keeps the encoded buffer pointer live before trimming and across the language call.
|
||||
sort_file_array is now 51/51 instructions with zero differences; unused directory row local removed and the match rechecked. CI palette array reloads produce the exact 100- and 106-instruction counts for the icon and banner routines. All ten remaining functions have at least three distinct source attempts in this continuation.
|
||||
Neither original nor rebuilt object contains data, rodata, sdata, bss, vtables or an ASCII string pool. There is no unit data to reconstruct.
|
||||
|
||||
@@ -137,3 +137,73 @@ Place SDK version declaration after the region tables: matched data 3984/5296. R
|
||||
Explicit zero-initialization of real map and command workspaces reproduces target BSS order: key maps 0x000, command records 0x400, channel state 0x580, callback records 0xf20. No extra objects or placement directives.
|
||||
Using the existing SDK command type was also tested and produced identical function scores; the original private declaration was restored.
|
||||
No new instruction-exact functions yet; retained source experiments remain uncommitted pending an exact-function gain.
|
||||
|
||||
|
||||
# Continuation from e81a2616
|
||||
|
||||
## KBDTranslateHidCode
|
||||
|
||||
1. signed table mask follows cmpwi and addis comparison blocks: 92.92683%; `src 0x298 base 0x290 insns 166/164; --- replace mine 44:46 base 44:46`.
|
||||
2. single bit conditions and signed combined modifier comparisons: 95.97561%; `src 0x290 base 0x290 insns 164/164; diffs 44: [44, 45, 49, 50, 57, 58, 62, 63, 67, 68, 70, 71, 72, 74, 76, 78, 80, 81, 83, 86]`.
|
||||
3. shift flag assignment and group offset parenthesized final sum: 96.03658%; `src 0x290 base 0x290 insns 164/164; diffs 42: [44, 45, 46, 49, 50, 57, 62, 67, 70, 72, 74, 76, 78, 79, 80, 81, 83, 86, 88, 89]`.
|
||||
4. reuse shift as offset through all mask branches with num lock result temp: 99.32927%; `src 0x290 base 0x290 insns 164/164; diffs 16: [44, 45, 46, 58, 63, 68, 71, 79, 80, 81, 83, 88, 91, 102, 159, 160]`.
|
||||
5. separate narrowed active flag from live shifted flag: 99.481705%; `src 0x290 base 0x290 insns 164/164; diffs 11: [44, 45, 46, 79, 81, 83, 88, 91, 102, 159, 160]`.
|
||||
6. signed offset and unsigned group for final table address: 96.92073%; `src 0x290 base 0x290 insns 164/164; diffs 18: [44, 45, 46, 79, 81, 83, 88, 91, 102, 104, 112, 120, 128, 136, 144, 152, 159, 160]`.
|
||||
7. signed offset and signed group preserve inner final addition: 99.63415%; `src 0x290 base 0x290 insns 164/164; diffs 9: [44, 45, 46, 79, 81, 83, 88, 91, 102]`.
|
||||
8. word entry with signed offset and group: 99.63415%; `src 0x290 base 0x290 insns 164/164; diffs 9: [44, 45, 46, 79, 81, 83, 88, 91, 102]`.
|
||||
9. word active flag explicitly narrowed at assignment: 99.63415%; `src 0x290 base 0x290 insns 164/164; diffs 9: [44, 45, 46, 79, 81, 83, 88, 91, 102]`.
|
||||
|
||||
## kbdProcKey
|
||||
|
||||
1. derive getter destination from existing channel state before checked getter: 94.50581%; `src 0x2b4 base 0x2b0 insns 173/172; --- insert mine 5:5 base 5:7`.
|
||||
2. initialize complete event aggregate before getter and field stores: 95.75581%; `src 0x2c0 base 0x2b0 insns 176/172; --- delete mine 5:6 base 5:5`.
|
||||
3. stop processing on failed checked modifier getter: 94.09884%; `src 0x2d4 base 0x2b0 insns 181/172; --- replace mine 6:9 base 6:9`.
|
||||
|
||||
## kbdProcMod
|
||||
|
||||
1. derive whole word counter masks from neg or rlwimi target blocks: 75.97656%; `src 0x3c0 base 0x400 insns 240/256; --- replace mine 2:3 base 2:3`.
|
||||
2. whole word counter masks from boolean nonzero count: 75.97656%; `src 0x3c0 base 0x400 insns 240/256; --- replace mine 2:3 base 2:3`.
|
||||
3. pointer view for initialized modifier word across switch cases: 78.57422%; `src 0x3a4 base 0x400 insns 233/256; --- replace mine 2:3 base 2:3`.
|
||||
|
||||
## KBDSetModState
|
||||
|
||||
1. C89 channel table declaration before interrupt disable: 98.690475%; `src 0xa8 base 0xa8 insns 42/42; diffs 7: [26, 27, 29, 30, 31, 32, 33]`.
|
||||
2. C89 channel record declaration before interrupt disable: 98.690475%; `src 0xa8 base 0xa8 insns 42/42; diffs 7: [26, 27, 29, 30, 31, 32, 33]`.
|
||||
3. name channel table before modifier field view: build rejected (# Error: ^^^^^^^^^^).
|
||||
4. load old state before masking incoming state: 98.690475%; `src 0xa8 base 0xa8 insns 42/42; diffs 7: [26, 27, 29, 30, 31, 32, 33]`.
|
||||
5. use channel record view for old state and store: build rejected (# Error: ^^^^^^^^^^).
|
||||
|
||||
## kbdEventHandler
|
||||
|
||||
1. range classification uses report status byte local: 99.83871%; `src 0x2e8 base 0x2e8 insns 186/186; diffs 5: [35, 36, 38, 39, 42]`.
|
||||
2. selected channel pointer with reversed addition operands: 99.78494%; `src 0x2e8 base 0x2e8 insns 186/186; diffs 6: [35, 36, 37, 38, 39, 42]`.
|
||||
3. load word report status before channel base address: 99.83871%; `src 0x2e8 base 0x2e8 insns 186/186; diffs 5: [35, 36, 38, 39, 42]`.
|
||||
|
||||
## kbd_led_handler
|
||||
|
||||
1. derive callback positive guard as target trailing return block: 70.0%; `src 0x60 base 0x64 insns 24/25; --- replace mine 2:4 base 2:4`.
|
||||
2. positive callback guard with explicit success and error blocks: 39.36%; `src 0x58 base 0x64 insns 22/25; --- replace mine 2:4 base 2:4`.
|
||||
3. retain typed callback value after command release: 69.6%; `src 0x60 base 0x64 insns 24/25; --- insert mine 0:0 base 0:1`.
|
||||
|
||||
## KBDSetLedsAsync
|
||||
|
||||
1. inline flag lookup and default-first result switch: 83.80247%; `src 0x13c base 0x144 insns 79/81; --- replace mine 7:9 base 7:9`.
|
||||
2. scoped flag local read through inline accessor and default-first result switch: 83.80247%; `src 0x13c base 0x144 insns 79/81; --- replace mine 7:9 base 7:9`.
|
||||
3. scoped flag local; async LED and index declaration order reversed (synchronous source repeated): 83.55556%; `src 0x13c base 0x144 insns 79/81; --- replace mine 7:9 base 7:9`.
|
||||
4. narrow channel only at flag reads and case-zero-first result switch: 90.69136%; `src 0x150 base 0x144 insns 84/81; --- replace mine 14:15 base 14:15`.
|
||||
5. narrow channel only at device reads and case-zero-first result switch: 85.06173%; `src 0x154 base 0x144 insns 85/81; --- replace mine 14:15 base 14:15`.
|
||||
6. while command reservation loop and case-zero-first result switch: 82.48148%; `src 0x140 base 0x144 insns 80/81; --- replace mine 7:9 base 7:9`.
|
||||
|
||||
## KBDSetLeds
|
||||
|
||||
1. inline flag lookup and default-first result switch: 79.77215%; `src 0x138 base 0x13c insns 78/79; --- replace mine 4:5 base 4:5`.
|
||||
2. scoped flag local read through inline accessor and default-first result switch: 79.77215%; `src 0x138 base 0x13c insns 78/79; --- replace mine 4:5 base 4:5`.
|
||||
3. scoped flag local; async LED and index declaration order reversed (synchronous source repeated): 79.77215%; `src 0x138 base 0x13c insns 78/79; --- replace mine 4:5 base 4:5`.
|
||||
4. narrow channel only at flag reads and case-zero-first result switch: 78.05064%; `src 0x14c base 0x13c insns 83/79; --- replace mine 4:5 base 4:5`.
|
||||
5. narrow channel only at device reads and case-zero-first result switch: 75.94936%; `src 0x150 base 0x13c insns 84/79; --- replace mine 4:5 base 4:5`.
|
||||
6. while command reservation loop and case-zero-first result switch: 78.48101%; `src 0x13c base 0x13c insns 79/79; diffs 39: [4, 16, 19, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43]`.
|
||||
|
||||
Target blocks were re-derived from kbd_lib.s: LED checks precede interrupt exclusion; twelve command slots are probed and reserved while interrupts are disabled; the device is queried again for transfer; completion releases the marker before invoking the callback. The translation routine carries the shift bit as the final table offset, keeps the active entry mask separate, and computes group plus offset before the key index.
|
||||
kbdProcKey retains initialization of the getter destination. kbdProcMod retains initialization from channel state. The original getter may skip its output on invalid input; matching its missing initialization would introduce uninitialized reads and was rejected. Modifier counter cases were re-derived as separate counter, whole-word mask, and lock-toggle blocks.
|
||||
Data: .bss, .sbss and .sdata remain exact; the real map, command, channel, and callback workspaces retain original order. The first 0x490 data bytes, including the SDK version literal and both maps, match raw target bytes. The remaining .data differences are the compiler-generated switch table; the version text has an anonymous source symbol and a target lbl symbol, which is not recreated. No packed pool, manual jump table, address pins or section directives were introduced.
|
||||
KBDResetChannel remains objdiff 100% with identical raw instruction bytes. Its gate count discrepancy remains the documented CR1 branch-disassembly normalization issue; no tooling was modified.
|
||||
|
||||
@@ -49,3 +49,37 @@ String pools identical. Data 1512/1512 bytes in objdiff.
|
||||
|
||||
All data sections remain 100%; the ACP command-first assignment preserves pool contents and reaches 866/866 instructions, but allocation still differs.
|
||||
No new instruction-exact functions yet; retained source experiments remain uncommitted pending an exact-function gain.
|
||||
|
||||
|
||||
# Continuation from e81a2616
|
||||
|
||||
## VISetMacrovision
|
||||
|
||||
1. load type byte before first watchdog byte: 99.48529%; `src 0x110 base 0x110 insns 68/68; diffs 7: [8, 9, 11, 37, 39, 40, 46]`.
|
||||
2. combine volume mask expression before assigning new watchdog byte: 96.617645%; `src 0x110 base 0x110 insns 68/68; diffs 22: [5, 8, 9, 11, 21, 22, 24, 25, 26, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39]`.
|
||||
3. word mode temporary and reversed watchdog load order: 98.52941%; `src 0x110 base 0x110 insns 68/68; diffs 9: [8, 9, 10, 11, 37, 38, 39, 40, 46]`.
|
||||
|
||||
## __VISetMacrovision
|
||||
|
||||
1. inline packet copy with command first: 96.93187%; `src 0xd88 base 0xd88 insns 866/866; diffs 418: [31, 33, 35, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47, 49, 51, 53, 55, 57, 59, 60]`.
|
||||
2. inline packet copy with command after payload: 94.26905%; `src 0xd80 base 0xd88 insns 864/866; --- insert mine 8:8 base 8:9`.
|
||||
3. inline pointer walk command and payload copy: 96.77598%; `src 0xd88 base 0xd88 insns 866/866; diffs 435: [31, 33, 35, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47, 49, 51, 53, 55, 57, 59, 60]`.
|
||||
|
||||
## __VISetRevolutionModeSimple
|
||||
|
||||
1. derive ACP block as fixed size byte memcpy before prefix: 77.56929%; `src 0x354 base 0x42c insns 213/267; --- replace mine 8:9 base 8:12`.
|
||||
2. retain shared enable value across power clock and filter transfers: 97.05618%; `src 0x424 base 0x42c insns 265/267; --- delete mine 9:10 base 9:9`.
|
||||
3. typed ACP payload view before control transactions: build rejected (# Error: ^^^^^^^^^^).
|
||||
4. ACP payload pointer initialized after packet declarations: 97.05618%; `src 0x424 base 0x42c insns 265/267; --- delete mine 9:10 base 9:9`.
|
||||
|
||||
Target blocks were re-derived from vi3in1.s: each ACP packet has the command byte and 26 ascending byte copies, three unrolled groups of eight and two tail bytes. The simple-mode routine preserves power/clock enable across transfers before zeroing later command fields. The inline copy retains 866 instructions and reduces register differences from 435 to 418; other matched functions and data remain unchanged. Three public-mode variations and four simple-mode variations were evaluated.
|
||||
All extracted data sections remain exact. There are no ASCII pools or missing tables to insert.
|
||||
|
||||
## Additional packet-copy derivation attempts
|
||||
|
||||
1. command prefix before constant size memcpy: 13.75866%; source and objdiff evidence sol-low-r3-vi-macro-copy-1.source/.json in /tmp.
|
||||
2. constant size memcpy before command prefix: 19.581985%; source and objdiff evidence sol-low-r3-vi-macro-copy-2.source/.json in /tmp.
|
||||
3. initialize packet prefix then copy payload: 27.85104%; source and objdiff evidence sol-low-r3-vi-macro-copy-3.source/.json in /tmp.
|
||||
1. explicit eight byte groups with prefix before payload: 96.77598%; source and objdiff evidence sol-low-r3-vi-block-loop-1.source/.json in /tmp.
|
||||
2. explicit eight byte groups with prefix after payload: 94.26905%; source and objdiff evidence sol-low-r3-vi-block-loop-2.source/.json in /tmp.
|
||||
3. indexed pointer dereference byte loop: 96.77598%; source and objdiff evidence sol-low-r3-vi-block-loop-3.source/.json in /tmp.
|
||||
|
||||
Reference in New Issue
Block a user