Compare commits
9 Commits
agent/read
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9461ee1e6 | ||
|
|
46f34f11f5 | ||
|
|
1bc8f49115 | ||
|
|
f055c43c22 | ||
|
|
985bae5d42 | ||
|
|
d4696caeaf | ||
|
|
2b4ed18122 | ||
|
|
02e50d2dc2 | ||
|
|
46d7abf8c0 |
62
.github/workflows/readme-progress.yml
vendored
Normal file
62
.github/workflows/readme-progress.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
name: README progress
|
||||
|
||||
# runs on the self-hosted runner on cole's server so it doesn't use hosted minutes.
|
||||
# only push/schedule/manual triggers, never pull_request, so fork PRs can't reach this machine.
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths-ignore: [README.md]
|
||||
schedule:
|
||||
- cron: "*/30 * * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: readme-progress
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
progress:
|
||||
runs-on: [self-hosted, wii-ipl-local]
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
ORIG_APP: /mnt/drive2/projects/wiichannels/wii-ipl/orig/43U/00000008.app
|
||||
TOOL_CACHE: /mnt/drive2/projects/wiichannels/wii-ipl/build
|
||||
NINJA: /home/cole/projects/tests/.venv/bin/ninja
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
mkdir -p build orig/43U
|
||||
cp "$ORIG_APP" orig/43U/00000008.app
|
||||
[ -d build/compilers ] || cp -a "$TOOL_CACHE/compilers" build/
|
||||
[ -d build/tools ] || cp -a "$TOOL_CACHE/tools" build/
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
python3 configure.py --version 43U
|
||||
"$NINJA"
|
||||
"$NINJA" build/43U/ok
|
||||
|
||||
- name: Report
|
||||
run: build/tools/objdiff-cli report generate -p . -o build/43U/report.json -f json
|
||||
|
||||
- name: Update README
|
||||
run: python3 tools/update_readme_progress.py build/43U/report.json README.md "$GITHUB_SHA"
|
||||
|
||||
- name: Commit
|
||||
run: |
|
||||
if git diff --quiet README.md; then exit 0; fi
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add README.md
|
||||
git commit -m "docs: update progress [skip ci]"
|
||||
git pull --rebase origin main || { git rebase --abort; echo "main moved, next run will update"; exit 0; }
|
||||
git push origin HEAD:main
|
||||
10
README.md
10
README.md
@@ -50,6 +50,16 @@ Supported versions:
|
||||
|
||||
Progress
|
||||
========
|
||||
<!-- progress:start -->
|
||||
| Decompiled | Matched | Linked | Data |
|
||||
|:---:|:---:|:---:|:---:|
|
||||
| 81.02% | 72.36% | 56.76% | 86.20% |
|
||||
|
||||
units 748/1027 complete, functions 10582/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 -->
|
||||
|
||||
| Version | Progress |
|
||||
|-----------------------|------------------------------------------------------------------------------|
|
||||
| [Wii Menu 4.3U][V43U] | [![FuncBadgeV43U]][V43U] [![DecompBadgeV43U]][V43U] [![LinkBadgeV43U]][V43U] |
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace textinput {
|
||||
wchar_t GetWChar() const;
|
||||
bool IsValid() const;
|
||||
KeySet GetNext() const;
|
||||
KeySet(const KeySet& other)
|
||||
: mpManager(other.mpManager), mKind(other.mKind), mIndex(other.mIndex), mDevice(other.mDevice), mCharacter(other.mCharacter) {}
|
||||
private:
|
||||
const HKBManager* mpManager;
|
||||
u8 mKind;
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace textinput {
|
||||
};
|
||||
virtual ~Base();
|
||||
virtual void create(MEMAllocator* allocator);
|
||||
virtual void init();
|
||||
virtual inline void init();
|
||||
virtual void updateFromReceiver(u32 command, void* data);
|
||||
virtual void onKey(u32 event, void* data);
|
||||
virtual int getType();
|
||||
@@ -159,46 +159,15 @@ namespace textinput {
|
||||
};
|
||||
|
||||
class LayoutByNW4R;
|
||||
class AnmPane : public nw4rmanager::AnmPane {
|
||||
class AnmPane;
|
||||
class EventHandler : public nw4rmanager::TiEventHandler {
|
||||
public:
|
||||
AnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : nw4rmanager::AnmPane(pane, observer), mAnimation(0) {}
|
||||
virtual void init();
|
||||
virtual void changeAnimation(u32 animation);
|
||||
virtual ~AnmPane();
|
||||
virtual int getState() const { return mAnimation; }
|
||||
virtual int getKeyType() const { return mKeyType; }
|
||||
|
||||
protected:
|
||||
int mAnimation;
|
||||
int mKeyType;
|
||||
};
|
||||
class NormalButtonAnmPane : public AnmPane {
|
||||
public:
|
||||
NormalButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { mKeyType = 0; }
|
||||
virtual ~NormalButtonAnmPane();
|
||||
virtual void onAnmEvent(AnmPaneEvent event);
|
||||
};
|
||||
class ShiftCapsAnmPane : public AnmPane {
|
||||
public:
|
||||
ShiftCapsAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer), mbOn(false) { mKeyType = 1; }
|
||||
virtual ~ShiftCapsAnmPane();
|
||||
virtual void onAnmEvent(AnmPaneEvent event);
|
||||
bool isFocused() const;
|
||||
EventHandler(LayoutByNW4R* layout) : mpKeyboard(layout) {}
|
||||
virtual ~EventHandler();
|
||||
virtual void onTiEvent(gui::PaneComponent* component, u32 event, Input* input);
|
||||
|
||||
private:
|
||||
bool mbOn;
|
||||
};
|
||||
class ToggleButtonAnmPane : public AnmPane {
|
||||
public:
|
||||
ToggleButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { mKeyType = 2; }
|
||||
virtual ~ToggleButtonAnmPane();
|
||||
virtual void onAnmEvent(AnmPaneEvent event);
|
||||
};
|
||||
class OnOffButtonAnmPane : public AnmPane {
|
||||
public:
|
||||
OnOffButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { mKeyType = 3; }
|
||||
virtual ~OnOffButtonAnmPane();
|
||||
virtual void onAnmEvent(AnmPaneEvent event);
|
||||
LayoutByNW4R* mpKeyboard;
|
||||
};
|
||||
class UIObj : public gui::EventHandler {
|
||||
public:
|
||||
@@ -244,15 +213,6 @@ namespace textinput {
|
||||
GXTexObj mEnglishTexture;
|
||||
GXTexObj mHangulTexture;
|
||||
};
|
||||
class EventHandler : public nw4rmanager::TiEventHandler {
|
||||
public:
|
||||
EventHandler(LayoutByNW4R* layout) : mpKeyboard(layout) {}
|
||||
virtual ~EventHandler();
|
||||
virtual void onTiEvent(gui::PaneComponent* component, u32 event, Input* input);
|
||||
|
||||
private:
|
||||
LayoutByNW4R* mpKeyboard;
|
||||
};
|
||||
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public UIObj::Listener {
|
||||
public:
|
||||
virtual ~LayoutByNW4R();
|
||||
@@ -305,6 +265,48 @@ namespace textinput {
|
||||
UIModePanel mModePanel;
|
||||
};
|
||||
|
||||
class AnmPane : public nw4rmanager::AnmPane {
|
||||
public:
|
||||
AnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : nw4rmanager::AnmPane(pane, observer), mAnimation(0) {}
|
||||
virtual void init();
|
||||
virtual void changeAnimation(u32 animation);
|
||||
virtual ~AnmPane();
|
||||
virtual int getState() const { return mAnimation; }
|
||||
virtual int getKeyType() const { return mKeyType; }
|
||||
|
||||
protected:
|
||||
int mAnimation;
|
||||
int mKeyType;
|
||||
};
|
||||
class NormalButtonAnmPane : public AnmPane {
|
||||
public:
|
||||
NormalButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { mKeyType = 0; }
|
||||
virtual ~NormalButtonAnmPane();
|
||||
virtual void onAnmEvent(AnmPaneEvent event);
|
||||
};
|
||||
class ShiftCapsAnmPane : public AnmPane {
|
||||
public:
|
||||
ShiftCapsAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer), mbOn(false) { mKeyType = 1; }
|
||||
virtual ~ShiftCapsAnmPane();
|
||||
virtual void onAnmEvent(AnmPaneEvent event);
|
||||
bool isFocused() const;
|
||||
|
||||
private:
|
||||
bool mbOn;
|
||||
};
|
||||
class ToggleButtonAnmPane : public AnmPane {
|
||||
public:
|
||||
ToggleButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { mKeyType = 2; }
|
||||
virtual ~ToggleButtonAnmPane();
|
||||
virtual void onAnmEvent(AnmPaneEvent event);
|
||||
};
|
||||
class OnOffButtonAnmPane : public AnmPane {
|
||||
public:
|
||||
OnOffButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { mKeyType = 3; }
|
||||
virtual ~OnOffButtonAnmPane();
|
||||
virtual void onAnmEvent(AnmPaneEvent event);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ static const void* NETGetSHA1Interface(void);
|
||||
static void NETHMACInit(NETHMACContext* ctx, const void* interface, const void* key, u32 keyLen);
|
||||
static void NETHMACUpdate(NETHMACContext* ctx, const void* data, u32 len);
|
||||
static void NETHMACGetDigest(NETHMACContext* ctx, void* digest);
|
||||
extern char lbl_81697583[];
|
||||
extern char VmReportFormat[];
|
||||
|
||||
#define CHANSVmDebugLength 1024
|
||||
#define VM_FRAME_ARENA_SIZE 8192
|
||||
@@ -66,7 +66,7 @@ void CHANSVmDebugPrintf(const vmString format, ...) {
|
||||
|
||||
str[CHANSVmDebugLength - 1] = str[CHANSVmDebugLength - 2] = 0;
|
||||
|
||||
OSReport(lbl_81697583, str);
|
||||
OSReport(VmReportFormat, str);
|
||||
}
|
||||
|
||||
#define CHANS_VM_PRINTF(line, msg, ...) \
|
||||
@@ -397,7 +397,7 @@ error:
|
||||
return vmNull;
|
||||
}
|
||||
|
||||
extern const char CHANSVmConstStringDataEmpty[16];
|
||||
extern const CHANSVmObjHdr CHANSVmConstStringDataEmpty;
|
||||
|
||||
CHANSVmObjHdr* CHANSVmNewObject(CHANSVm* vm, vmBoolInt noAlloc, CHANSVmObjHdr* object, CHANSVmObjType type, vmSize len) {
|
||||
CHANSVmObjHdr* header;
|
||||
@@ -418,7 +418,7 @@ CHANSVmObjHdr* CHANSVmNewObject(CHANSVm* vm, vmBoolInt noAlloc, CHANSVmObjHdr* o
|
||||
}
|
||||
} else {
|
||||
if (type == 3UL) {
|
||||
object->value.ptr_v = (vmPtr)CHANSVmConstStringDataEmpty;
|
||||
object->value.ptr_v = (vmPtr)&CHANSVmConstStringDataEmpty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -509,15 +509,13 @@ CHANSVmErr CHANSVmPopObject(CHANSVm* vm, CHANSVmObjHdr* object) {
|
||||
|
||||
void CHANSVmStrCpyToU16FromU8(vmWString output, vmString input, vmSize length) {
|
||||
u8* src = (u8*)input + length;
|
||||
u32 offset = VM_STR_LENGTH(length);
|
||||
|
||||
while (length > 0) {
|
||||
u8 val;
|
||||
offset -= 2;
|
||||
u32 offset = VM_STR_LENGTH(--length);
|
||||
val = *--src;
|
||||
((u8*)output)[offset + 1] = val;
|
||||
((u8*)output)[offset] = 0;
|
||||
length--;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -667,25 +665,25 @@ u8 lbl_81669094[19] = {0x00, '-', 0x00, 'I', 0x00, 'n', 0x00, 'f', 0x00, 'i', 0x
|
||||
|
||||
// clang-format off
|
||||
const CHANSVmObjHdr CHANSVmConstStringObjectUndefined = {{(wchar_t*)lbl_81669070, 18}, {0}, vmNull};
|
||||
const CHANSVmObjHdr lbl_81616C88 = {{L"NaN", 6}, {0}, vmNull};
|
||||
const CHANSVmObjHdr lbl_81616C88 = {{(wchar_t*)"\0N\0a\0N", 6}, {0}, vmNull};
|
||||
const CHANSVmObjHdr lbl_81616C98 = {{(wchar_t*)lbl_81669083, 16}, {0}, vmNull};
|
||||
const CHANSVmObjHdr lbl_81616CA8 = {{(wchar_t*)lbl_81669094, 18}, {0}, vmNull};
|
||||
const CHANSVmObjHdr lbl_81616CB8 = {{L",", 2}, {0}, vmNull};
|
||||
const char CHANSVmConstStringDataEmpty[16] = "";
|
||||
const CHANSVmObjHdr lbl_81616CB8 = {{(wchar_t*)"\0,", 2}, {0}, vmNull};
|
||||
const CHANSVmObjHdr CHANSVmConstStringDataEmpty = {{(wchar_t*)"", 0}, {0}, vmNull};
|
||||
const CHANSVmObjHdr CHANSVmConstStringObjectUndefined_[] = {{{(void*)&CHANSVmConstStringObjectUndefined, 0}, 0x03800100, vmNull},
|
||||
{{(void*)&lbl_81616C88, 0}, 0x03800100, vmNull},
|
||||
{{(void*)&lbl_81616C98, 0}, 0x03800100, vmNull},
|
||||
{{(void*)&lbl_81616CA8, 0}, 0x03800100, vmNull},
|
||||
{{(void*)&lbl_81616CB8, 0}, 0x00800000, vmNull}};
|
||||
char lbl_81697583[] = "%s";
|
||||
char lbl_8169758A[] = "%.16lg";
|
||||
{{vmNull, 0}, 0x00800000, vmNull}};
|
||||
char VmReportFormat[] = "%s";
|
||||
|
||||
const CHANSVmFloatConstantList lbl_81616D28[] = {
|
||||
{ "Infinity", (double*)&VmInf },
|
||||
{ "+Infinity", (double*)&VmInf },
|
||||
{ "-Infinity", (double*)&VmMinusInf },
|
||||
{ "Infinity", (double*)&VmNaN }
|
||||
{ "NaN", (double*)&VmNaN }
|
||||
};
|
||||
char lbl_8169758A[] = "%.16lg";
|
||||
// clang-format on
|
||||
|
||||
CHANSVmObjHdr* CHANSVm_8144B4D4(CHANSVm* vm, CHANSVmObjType type, CHANSVmObjHdr* object) {
|
||||
@@ -764,10 +762,10 @@ s32 CHANSVm_8144B62C(vmWString buf, u32 len, vmFloat val) NO_INLINE {
|
||||
return VM_STR_LENGTH(result);
|
||||
}
|
||||
|
||||
char lbl_81697591[] = "%lld";
|
||||
char VmIntegerFormat[] = "%lld";
|
||||
|
||||
static int VmToStrFromInt(vmWString output, vmSize length, vmInteger integer) {
|
||||
vmS32 len = snprintf((vmString)output, length, lbl_81697591, integer);
|
||||
vmS32 len = snprintf((vmString)output, length, VmIntegerFormat, integer);
|
||||
CHANSVmStrCpyToU16FromU8(output, (vmString)output, len);
|
||||
return len;
|
||||
}
|
||||
@@ -1533,8 +1531,8 @@ const char* vmErrorList[] = {
|
||||
"CHANS_VM_ERR_RESERVED_OPCODE", /* -923 */
|
||||
};
|
||||
|
||||
const char* vmNoError = "CHANS_VM_OK";
|
||||
const char* vmUnknownError = "(unknown)";
|
||||
char vmNoError[] = "CHANS_VM_OK";
|
||||
char vmUnknownError[] = "(unknown)";
|
||||
|
||||
CHANSVmNativeClass* CHANSVmFindNativeClass(CHANSVm* vm, const char* clsName) {
|
||||
CHANSVmPrivate* pVm = (CHANSVmPrivate*)vm;
|
||||
@@ -1920,15 +1918,15 @@ static CHANSVmErr VmArrayExpandCommon(CHANSVm* vm, CHANSVmObjHdr* obj, u32 start
|
||||
chunk->pNext = current;
|
||||
}
|
||||
|
||||
for (i = 0, allocSize = 0; i < total; i++, allocSize += sizeof(CHANSVmObjHdr)) {
|
||||
for (i = 0; i < total; i++) {
|
||||
if (fillFromArgs != 0 && i < ((CHANSVmPrivate*)vm)->pActiveCtx->argc && CHANSVmGetArg(vm, i) != vmNull) {
|
||||
CHANSVmObjHdr* arg = CHANSVmGetArg(vm, i);
|
||||
if (CHANSVmCopyObject(vm, (CHANSVmObjHdr*)((u8*)chunk + sizeof(ArrayChunk) + allocSize), arg) == vmNull) {
|
||||
if (CHANSVmCopyObject(vm, &chunk->elements[i], arg) == vmNull) {
|
||||
goto error;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
memset((u8*)chunk + sizeof(ArrayChunk) + allocSize, 0, sizeof(CHANSVmObjHdr));
|
||||
memset(&chunk->elements[i], 0, sizeof(CHANSVmObjHdr));
|
||||
}
|
||||
|
||||
return vmTrue;
|
||||
@@ -2146,7 +2144,7 @@ static u32 VmArrayJoinSub(CHANSVmObjHdr* obj, CHANSVmObjHdr* array, wchar_t* sep
|
||||
goto error;
|
||||
}
|
||||
strBuf = (vmString)(*obj->value.ptr_v) + offset;
|
||||
elemLen = snprintf(strBuf, 0x40, lbl_81697591, chunk->elements[countInChunk].value.int_v);
|
||||
elemLen = snprintf(strBuf, 0x40, VmIntegerFormat, chunk->elements[countInChunk].value.int_v);
|
||||
CHANSVmStrCpyToU16FromU8((vmWString)strBuf, strBuf, elemLen);
|
||||
elemLen = elemLen << 1;
|
||||
break;
|
||||
@@ -2631,10 +2629,8 @@ VmMethodDefine(Date, GetRTC) {
|
||||
u32 bias = SCGetCounterBias();
|
||||
s64 ticks = OSCalendarTimeToTicks(cal);
|
||||
u64 t = ticks / (__OSBusClock / 4 / 1000);
|
||||
u32 val;
|
||||
t = t / 1000;
|
||||
val = (u32)(t - (unsigned int)bias);
|
||||
return CHANSVmSetInteger(VmInst, VmReturnObj, val) == CHANS_VM_OK;
|
||||
t /= 1000;
|
||||
return CHANSVmSetInteger(VmInst, VmReturnObj, (t - bias) & 0xFFFFFFFFULL) == CHANS_VM_OK;
|
||||
}
|
||||
|
||||
const CHANSVmMethodList VmDateMethodTbl[] = {
|
||||
@@ -3167,13 +3163,13 @@ VmMethodDefine(String, Splice) {
|
||||
length = VmParentObj->value.string_v->len;
|
||||
|
||||
if (arg0 != vmNull) {
|
||||
s64 byteOffs0 = arg0->value.int_v * 2;
|
||||
if (byteOffs0 > length) {
|
||||
s64 startByteOffset = arg0->value.int_v * 2;
|
||||
if (startByteOffset > length) {
|
||||
start = length;
|
||||
} else {
|
||||
start = byteOffs0;
|
||||
if (byteOffs0 < 0) {
|
||||
s64 t0 = byteOffs0 + length;
|
||||
start = startByteOffset;
|
||||
if (startByteOffset < 0) {
|
||||
s64 t0 = startByteOffset + length;
|
||||
start = t0;
|
||||
if (t0 < 0) {
|
||||
start = 0;
|
||||
@@ -3200,7 +3196,7 @@ VmMethodDefine(String, Splice) {
|
||||
length = tempLen;
|
||||
}
|
||||
|
||||
newLen = length - start & ~-(s32)(start >= length);
|
||||
newLen = start >= length ? 0 : length - start;
|
||||
|
||||
if (CHANSVmNewObject(VmInst, vmFalse, VmReturnObj, CHANS_VM_OBJ_TYPE_STRING, newLen) != vmNull) {
|
||||
if (newLen != 0) {
|
||||
@@ -6107,7 +6103,7 @@ static vmBoolInt VmWinEmuWrite(CHANSVm* vm, CHANSVmObjHdr* parent, CHANSVmObjHdr
|
||||
if (result == 0) {
|
||||
buf[outLen] = 0;
|
||||
buf[outLen + 1] = 0;
|
||||
OSReport("%s", buf);
|
||||
OSReport(VmReportFormat, buf);
|
||||
} else {
|
||||
OSReport("document.write(): conversion error (%d)\n", result);
|
||||
break;
|
||||
@@ -7852,7 +7848,7 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
|
||||
CHANSVmObjHdr* hdr = CHANSVmNewObject(vm, vmFalse, &pVm->accumulator, CHANS_VM_OBJ_TYPE_STRING, VM_STRING_SIZE);
|
||||
if (hdr != vmNull) {
|
||||
char* s = pVm->accumulator.value.string_v->spData;
|
||||
s32 snpLen = snprintf(s, 0x40, "%lld", (u64)arrayIdx);
|
||||
s32 snpLen = snprintf(s, 0x40, VmIntegerFormat, (u64)arrayIdx);
|
||||
CHANSVmStrCpyToU16FromU8((wchar_t*)s, s, snpLen);
|
||||
pVm->accumulator.value.string_v->len = VM_STR_LENGTH(snpLen);
|
||||
} else {
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
namespace textinput {
|
||||
namespace keyboard {
|
||||
namespace pctype {
|
||||
struct SelectorPosition {
|
||||
f32 coordinates[3];
|
||||
};
|
||||
extern SelectorPosition chinesePosition;
|
||||
extern SelectorPosition koreanPosition;
|
||||
|
||||
static const wchar_t* PREDICT_CAPTIONS[] = {L"", L"", L"Eng", L"Fra", L"Esp", L"EN", L"DE", L"FR", L"ES", L"IT", L"NL", L"CN", L"KR"};
|
||||
|
||||
static const GridKey csGridKeyboard[] = {
|
||||
@@ -1534,8 +1540,8 @@ namespace textinput {
|
||||
u32 count;
|
||||
u32 type;
|
||||
};
|
||||
u32 flags = 0;
|
||||
mState.rejected = false;
|
||||
u32 flags = 0;
|
||||
if (mKeyState.abcFlags & 64)
|
||||
flags |= 2;
|
||||
if (mKeyState.abcFlags & 128)
|
||||
@@ -1557,7 +1563,7 @@ namespace textinput {
|
||||
if (code != util::KBD_ConvertSmall(code))
|
||||
conversions |= 128;
|
||||
if ((mKeyState.aiuFlags & ~15) != conversions) {
|
||||
mKeyState.aiuFlags = (mKeyState.aiuFlags & 15) | conversions;
|
||||
mKeyState.aiuFlags = (mKeyState.aiuFlags & 15) | (conversions & ~15);
|
||||
mKeyState.refresh_();
|
||||
}
|
||||
}
|
||||
@@ -1600,7 +1606,7 @@ namespace textinput {
|
||||
}
|
||||
|
||||
void Base::setTranslateMode(TranslateMode mode) {
|
||||
u32 keyMode;
|
||||
u32 keyMode = mode;
|
||||
switch (mode) {
|
||||
case TM_Direct:
|
||||
keyMode = 0;
|
||||
@@ -1612,7 +1618,7 @@ namespace textinput {
|
||||
keyMode = 2;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
if (keyMode != (mKeyState.abcFlags & 15)) {
|
||||
if (getLanguage() == KR || getLanguage() == CN)
|
||||
@@ -1711,14 +1717,19 @@ namespace textinput {
|
||||
util::replaceChar(name, sizeof(name), data->ascii[i].szPaneName, 0, 'T');
|
||||
nw4r::lyt::TextBox* text = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(root->FindPaneByName(name, true));
|
||||
if (text != NULL) {
|
||||
wchar_t caption[2] = {getWCCode(i), 0};
|
||||
wchar_t caption[2];
|
||||
caption[0] = getWCCode(i);
|
||||
caption[1] = 0;
|
||||
if (language == KR && (abcFlags & 15) == 1) {
|
||||
if (owner->isCapsOn())
|
||||
caption[0] = util::reverseLetterCaseW(caption[0]);
|
||||
if (caption[0] >= L'a' && caption[0] <= L'z')
|
||||
caption[0] = KOREAN_LOWER[caption[0] - L'a'];
|
||||
else if (caption[0] >= L'A' && caption[0] <= L'Z')
|
||||
caption[0] = KOREAN_UPPER[caption[0] - L'A'];
|
||||
bool caps = owner->isCapsOn();
|
||||
u32 character = caption[0];
|
||||
if (caps)
|
||||
character = util::reverseLetterCaseW(character);
|
||||
if (character >= L'a' && character <= L'z')
|
||||
character = KOREAN_LOWER[static_cast<wchar_t>(character) - L'a'];
|
||||
else if (character >= L'A' && character <= L'Z')
|
||||
character = KOREAN_UPPER[static_cast<wchar_t>(character) - L'A'];
|
||||
caption[0] = character;
|
||||
}
|
||||
text->SetString(caption);
|
||||
}
|
||||
@@ -1728,7 +1739,9 @@ namespace textinput {
|
||||
util::replaceChar(name, sizeof(name), data->grid[i].paneName, 0, 'T');
|
||||
nw4r::lyt::TextBox* text = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(root->FindPaneByName(name, true));
|
||||
if (text != NULL) {
|
||||
wchar_t caption[2] = {data->grid[i].codes[3 - ((aiuFlags & 15) == 0)], 0};
|
||||
wchar_t caption[2];
|
||||
caption[0] = data->grid[i].codes[(aiuFlags & 15) == 0 ? 2 : 3];
|
||||
caption[1] = 0;
|
||||
text->SetString(caption);
|
||||
}
|
||||
}
|
||||
@@ -1800,7 +1813,7 @@ namespace textinput {
|
||||
}
|
||||
for (u16 i = 0; i < 56; i++) {
|
||||
if (util::strcmp(data->grid[i].paneName, paneName))
|
||||
code = data->grid[i].codes[3 - ((aiuFlags & 15) == 0)];
|
||||
code = data->grid[i].codes[(aiuFlags & 15) == 0 ? 2 : 3];
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@@ -1889,6 +1902,7 @@ namespace textinput {
|
||||
}
|
||||
|
||||
void LayoutByNW4R::createAnmPane_(MEMAllocator* allocator) {
|
||||
const char* shared;
|
||||
for (u16 i = 0; i < 129; i++) {
|
||||
const PaneAnimation& entry = csPaneToAnimation[i];
|
||||
AnmPane* pane = NULL;
|
||||
@@ -1915,7 +1929,7 @@ namespace textinput {
|
||||
}
|
||||
}
|
||||
nw4r::ut::List_Append(&mAnmPanes, pane);
|
||||
const char* shared = entry.sharedPane;
|
||||
shared = entry.sharedPane;
|
||||
for (u16 j = 0; j < entry.count; j++) {
|
||||
void* resource = mpMultiArcResourceAccessor->GetResource(0, entry.animations[j]->fileName);
|
||||
AnimTransformPane* transform =
|
||||
@@ -1936,16 +1950,16 @@ namespace textinput {
|
||||
setLineFeedButton(true);
|
||||
setPredictLanguageButton(true);
|
||||
setSignWindowButton(true);
|
||||
const nw4r::math::VEC3 chinesePosition(-219.0f, -130.0f, 0.0f);
|
||||
const nw4r::math::VEC3 koreanPosition(-209.0f, -90.0f, 0.0f);
|
||||
SelectorPosition chineseTranslation = chinesePosition;
|
||||
SelectorPosition koreanTranslation = koreanPosition;
|
||||
if (meLanguage == CN) {
|
||||
mModePanel.mpEnglishText->GetMaterial()->SetTexture(0, mModePanel.mDirectTexture);
|
||||
mModePanel.mpHangulText->GetMaterial()->SetTexture(0, mModePanel.mPinyinTexture);
|
||||
mModePanel.mpModeSelect->SetTranslate(chinesePosition);
|
||||
mModePanel.mpModeSelect->SetTranslate(nw4r::math::VEC3(chineseTranslation.coordinates));
|
||||
} else if (meLanguage == KR) {
|
||||
mModePanel.mpEnglishText->GetMaterial()->SetTexture(0, mModePanel.mEnglishTexture);
|
||||
mModePanel.mpHangulText->GetMaterial()->SetTexture(0, mModePanel.mHangulTexture);
|
||||
mModePanel.mpModeSelect->SetTranslate(koreanPosition);
|
||||
mModePanel.mpModeSelect->SetTranslate(nw4r::math::VEC3(koreanTranslation.coordinates));
|
||||
}
|
||||
searchAnmPane("P_key_SHIFT")->changeAnimation(0);
|
||||
searchAnmPane("P_key_CAPS")->changeAnimation(0);
|
||||
@@ -2020,12 +2034,17 @@ namespace textinput {
|
||||
}
|
||||
}
|
||||
if (getLanguage() == KR || getLanguage() == CN) {
|
||||
if ((mKeyState.abcFlags & 15) == 0) {
|
||||
searchAnmPane("P_Mode_kr_eng")->changeAnimation(5);
|
||||
searchAnmPane("P_Mode_kr_han")->changeAnimation(0);
|
||||
} else {
|
||||
searchAnmPane("P_Mode_kr_eng")->changeAnimation(0);
|
||||
searchAnmPane("P_Mode_kr_han")->changeAnimation(5);
|
||||
switch (mKeyState.abcFlags & 15) {
|
||||
case 0: {
|
||||
searchAnmPane("P_Mode_kr_eng")->changeAnimation(5);
|
||||
searchAnmPane("P_Mode_kr_han")->changeAnimation(0);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
searchAnmPane("P_Mode_kr_eng")->changeAnimation(0);
|
||||
searchAnmPane("P_Mode_kr_han")->changeAnimation(5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
mpLayout->Animate(0);
|
||||
@@ -2088,7 +2107,8 @@ namespace textinput {
|
||||
}
|
||||
|
||||
void LayoutByNW4R::onReleasedShift() {
|
||||
mKeyState.setABCFlag(mKeyState.abcFlags & ~143);
|
||||
u32 flags = mKeyState.abcFlags & ~143;
|
||||
mKeyState.setABCFlag(flags);
|
||||
if (mShiftButton.mbOn) {
|
||||
mShiftButton.mbOn = false;
|
||||
mShiftButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(5));
|
||||
@@ -2099,13 +2119,33 @@ namespace textinput {
|
||||
getWCCode(static_cast<char*>(data));
|
||||
if (event == 4 && getWCCode(static_cast<char*>(data)) == 0) {
|
||||
switch (getControlKey(static_cast<char*>(data))) {
|
||||
case 0:
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(9));
|
||||
case 3: {
|
||||
LayoutGather& gather = LayoutGather::Singleton::getInstance();
|
||||
if (!gather.isHoldingShift()) {
|
||||
if (mKeyState.abcFlags & ~15) {
|
||||
mKeyState.abcFlags &= ~128;
|
||||
mKeyState.refresh_();
|
||||
}
|
||||
if (mShiftButton.mbOn) {
|
||||
mShiftButton.mbOn = false;
|
||||
mShiftButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(5));
|
||||
}
|
||||
}
|
||||
u8 caps = !gather.isCapsLock();
|
||||
gather.changeCapsLock(caps);
|
||||
mKeyState.abcFlags = ((mKeyState.abcFlags ^ 64) & 64) | (mKeyState.abcFlags & ~64);
|
||||
mKeyState.refresh_();
|
||||
mCapsButton.mbOn = (mKeyState.abcFlags >> 6) & 1;
|
||||
if (mCapsButton.mbOn)
|
||||
mCapsButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(10));
|
||||
else
|
||||
mCapsButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(11));
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(13));
|
||||
|
||||
break;
|
||||
case 3:
|
||||
onPressedCaps();
|
||||
break;
|
||||
case 4:
|
||||
}
|
||||
case 4: {
|
||||
LayoutGather& shiftGather = LayoutGather::Singleton::getInstance();
|
||||
if (mKeyState.abcFlags & ~15) {
|
||||
mKeyState.abcFlags &= ~64;
|
||||
mKeyState.refresh_();
|
||||
@@ -2114,17 +2154,21 @@ namespace textinput {
|
||||
mCapsButton.mbOn = false;
|
||||
mCapsButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(5));
|
||||
}
|
||||
if (!LayoutGather::Singleton::getInstance().isHoldingShift()) {
|
||||
if (!shiftGather.isHoldingShift()) {
|
||||
mKeyState.abcFlags = ((mKeyState.abcFlags ^ 128) & 128) | (mKeyState.abcFlags & ~128);
|
||||
mKeyState.refresh_();
|
||||
}
|
||||
mShiftButton.mbOn = (mKeyState.abcFlags >> 7) & 1;
|
||||
if (!mShiftButton.mbOn)
|
||||
mShiftButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(11));
|
||||
else
|
||||
if (mShiftButton.mbOn)
|
||||
mShiftButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(10));
|
||||
else
|
||||
mShiftButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(11));
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(13));
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(9));
|
||||
break;
|
||||
case 11:
|
||||
if (!isABC()) {
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(13));
|
||||
@@ -2137,6 +2181,18 @@ namespace textinput {
|
||||
searchAnmPane("W_JP_Chng_ABC")->changeAnimation(6);
|
||||
}
|
||||
break;
|
||||
case 18:
|
||||
if ((mKeyState.aiuFlags & 15) == 1) {
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(13));
|
||||
searchAnmPane("P_katakana")->changeAnimation(6);
|
||||
}
|
||||
break;
|
||||
case 19:
|
||||
if ((mKeyState.aiuFlags & 15) == 0) {
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(13));
|
||||
searchAnmPane("P_hiragana")->changeAnimation(6);
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
if ((mKeyState.abcFlags & 15) == 2)
|
||||
searchAnmPane("P_Mode_roma_kata")->changeAnimation(6);
|
||||
@@ -2159,18 +2215,6 @@ namespace textinput {
|
||||
if ((mKeyState.abcFlags & 15) == 1)
|
||||
searchAnmPane("P_Mode_roma_hira")->changeAnimation(6);
|
||||
break;
|
||||
case 18:
|
||||
if ((mKeyState.aiuFlags & 15) == 1) {
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(13));
|
||||
searchAnmPane("P_katakana")->changeAnimation(6);
|
||||
}
|
||||
break;
|
||||
case 19:
|
||||
if ((mKeyState.aiuFlags & 15) == 0) {
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(13));
|
||||
searchAnmPane("P_hiragana")->changeAnimation(6);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
Base::onKey(event, data);
|
||||
@@ -2303,10 +2347,12 @@ namespace textinput {
|
||||
}
|
||||
|
||||
void LayoutByNW4R::sendInputWChar(wchar_t code, bool repeat) {
|
||||
bool shift = (mKeyState.abcFlags & 128) != 0;
|
||||
bool shift = false;
|
||||
nw4r::lyt::Pane* last = NULL;
|
||||
if (shift)
|
||||
if (mKeyState.abcFlags & 128) {
|
||||
last = mAnmPaneFifo.getLast();
|
||||
shift = true;
|
||||
}
|
||||
Base::sendInputWChar(code, repeat);
|
||||
if (shift && last != NULL)
|
||||
setPaneLastDrawReceived(last);
|
||||
@@ -2390,13 +2436,15 @@ namespace textinput {
|
||||
mKeyState.setABCMode(abcMode);
|
||||
mKeyState.setAIUMode(aiuMode);
|
||||
switch (static_cast<int>(abcMode)) {
|
||||
case 1:
|
||||
case 2:
|
||||
mpInitialLanguageData = &csJapanKanaInput;
|
||||
break;
|
||||
case 0:
|
||||
mpInitialLanguageData = &csLanguageDependencyData[getLanguage()];
|
||||
break;
|
||||
case 1:
|
||||
mpInitialLanguageData = &csJapanKanaInput;
|
||||
break;
|
||||
case 2:
|
||||
mpInitialLanguageData = &csJapanKanaInput;
|
||||
break;
|
||||
}
|
||||
initLayout();
|
||||
sendCommand(41, NULL);
|
||||
@@ -2462,25 +2510,33 @@ namespace textinput {
|
||||
nw4rmanager::AnmPane* animation = NULL;
|
||||
u8 key = keys.GetKey();
|
||||
wchar_t code = keys.GetWChar();
|
||||
if (key != 0x2c) {
|
||||
if (key == 0x28 || key == 0x58) {
|
||||
switch (static_cast<int>(key)) {
|
||||
case 0x2c:
|
||||
break;
|
||||
case 0x28:
|
||||
case 0x58:
|
||||
if (!(hkb.GetModifierState() & 4))
|
||||
animation = searchAnmPane("P_key_LF");
|
||||
} else {
|
||||
break;
|
||||
default: {
|
||||
code = inputform::DeadKeyStream::ToIndependentClass(code);
|
||||
code = static_cast<const Manager*>(mpManager)->getHWKeyboard()->convertWCCode(code);
|
||||
if (static_cast<const Manager*>(mpManager)->getToolBar()->isQwerty()) {
|
||||
if (static_cast<const Manager*>(mpManager)->getPCKeyboard()->getTranslateMode() != TM_Direct &&
|
||||
mpManager->getLanguage() == KR) {
|
||||
if (isCapsOn())
|
||||
code = util::reverseLetterCaseW(code);
|
||||
if (code >= L'a' && code <= L'z')
|
||||
code = KOREAN_LOWER[code - L'a'];
|
||||
else if (code >= L'A' && code <= L'Z')
|
||||
code = KOREAN_UPPER[code - L'A'];
|
||||
bool caps = isCapsOn();
|
||||
u32 koreanCode = code;
|
||||
if (caps)
|
||||
koreanCode = util::reverseLetterCaseW(koreanCode);
|
||||
if (koreanCode >= L'a' && koreanCode <= L'z')
|
||||
koreanCode = KOREAN_LOWER[static_cast<u16>(koreanCode) - L'a'];
|
||||
else if (koreanCode >= L'A' && koreanCode <= L'Z')
|
||||
koreanCode = KOREAN_UPPER[static_cast<u16>(koreanCode) - L'A'];
|
||||
code = koreanCode;
|
||||
}
|
||||
}
|
||||
animation = searchAnmPane(code);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (animation != NULL)
|
||||
@@ -2492,14 +2548,18 @@ namespace textinput {
|
||||
nw4rmanager::AnmPane* animation = NULL;
|
||||
u8 key = keys.GetKey();
|
||||
keys.GetWChar();
|
||||
if (key < 0x2c) {
|
||||
if (key == 0x2a && !(hkb.GetModifierState() & 4))
|
||||
switch (static_cast<int>(key)) {
|
||||
case 0x2a:
|
||||
if (hkb.GetModifierState() & 4)
|
||||
break;
|
||||
case 0x4c:
|
||||
animation = searchAnmPane("P_key_DELETE");
|
||||
} else if (key == 0x2c) {
|
||||
if (!(hkb.GetModifierState() & 8))
|
||||
animation = searchAnmPane("P_key_SPACE");
|
||||
} else if (key == 0x4c)
|
||||
animation = searchAnmPane("P_key_DELETE");
|
||||
break;
|
||||
case 0x2c:
|
||||
if (!(hkb.GetModifierState() & 8))
|
||||
animation = searchAnmPane("P_key_SPACE");
|
||||
break;
|
||||
}
|
||||
if (animation != NULL)
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_0);
|
||||
keys = keys.GetNext();
|
||||
@@ -2559,8 +2619,7 @@ namespace textinput {
|
||||
mCapsButton.mbOn = false;
|
||||
mCapsButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(5));
|
||||
}
|
||||
const u8 caps = 0;
|
||||
LayoutGather::Singleton::getInstance().changeCapsLock(caps);
|
||||
LayoutGather::Singleton::getInstance().changeCapsLock(0);
|
||||
}
|
||||
if (visible)
|
||||
initPaneLastDrawReceived();
|
||||
@@ -2578,44 +2637,52 @@ namespace textinput {
|
||||
void EventHandler::onTiEvent(gui::PaneComponent* component, u32 event, Input* input) {
|
||||
nw4r::lyt::Pane* pane = component->getPane();
|
||||
const char* name = pane->GetName();
|
||||
if (!util::strcmp("B_key_SHIFT", name) && !util::strcmp("B_key_CAPS", name) && name[0] == 'B') {
|
||||
char animationName[17];
|
||||
util::replaceChar(animationName, sizeof(animationName), name, 0, 'P');
|
||||
if (strncmp(name + 5, "Chng", 4) == 0 || strncmp(name + 7, "Chng", 4) == 0 || strncmp(name + 7, "prdc", 4) == 0) {
|
||||
util::replaceChar(animationName, sizeof(animationName), name, 0, 'W');
|
||||
}
|
||||
nw4rmanager::AnmPane* animation = mpKeyboard->searchAnmPane(animationName);
|
||||
switch (static_cast<int>(event)) {
|
||||
case 1:
|
||||
if (animation != NULL)
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_2);
|
||||
mpKeyboard->onKey(1, animationName);
|
||||
break;
|
||||
if (!util::strcmp("B_key_SHIFT", name)) {
|
||||
switch (util::strcmp("B_key_CAPS", name)) {
|
||||
case 0:
|
||||
if (animation != NULL) {
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(4));
|
||||
mpKeyboard->setPaneLastDrawReceived(animation->getPane());
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_1);
|
||||
if (name[0] == 'B') {
|
||||
char animationName[17];
|
||||
util::replaceChar(animationName, sizeof(animationName), name, 0, 'P');
|
||||
if (strncmp(name + 5, "Chng", 4) == 0 || strncmp(name + 7, "Chng", 4) == 0 || strncmp(name + 7, "prdc", 4) == 0) {
|
||||
util::replaceChar(animationName, sizeof(animationName), name, 0, 'W');
|
||||
}
|
||||
nw4rmanager::AnmPane* animation = mpKeyboard->searchAnmPane(animationName);
|
||||
switch (static_cast<int>(event)) {
|
||||
case 4:
|
||||
if (input->field_0x0C & 0x800) {
|
||||
if (animation != NULL)
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_0);
|
||||
mpKeyboard->onKey(4, animationName);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (animation != NULL)
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_2);
|
||||
mpKeyboard->onKey(1, animationName);
|
||||
break;
|
||||
case 0:
|
||||
if (animation != NULL) {
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(4));
|
||||
mpKeyboard->setPaneLastDrawReceived(animation->getPane());
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (event == 2 && (input->field_0x10 & 0x800) && !(input->field_0x0C & 0x800) &&
|
||||
(util::strcmp("P_key_DELETE", animationName) || util::strcmp("P_Gkey_DELETE", animationName) ||
|
||||
util::strcmp("P_key_SPACE", animationName) || util::strcmp("P_Gkey_SPACE", animationName)) &&
|
||||
component->isDragging(input->field_0x00)) {
|
||||
u32 frames = mpKeyboard->getFlightDuration(input->field_0x00, name);
|
||||
if (frames >= 30 && frames % 9 == 0) {
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_0);
|
||||
mpKeyboard->onKey(4, animationName);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (input->field_0x0C & 0x800) {
|
||||
if (animation != NULL)
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_0);
|
||||
mpKeyboard->onKey(4, animationName);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (event == 2 && (input->field_0x10 & 0x800) && !(input->field_0x0C & 0x800) &&
|
||||
(util::strcmp("P_key_DELETE", animationName) || util::strcmp("P_Gkey_DELETE", animationName) ||
|
||||
util::strcmp("P_key_SPACE", animationName) || util::strcmp("P_Gkey_SPACE", animationName)) &&
|
||||
component->isDragging(input->field_0x00)) {
|
||||
u32 frames = mpKeyboard->getFlightDuration(input->field_0x00, name);
|
||||
if (frames > 29 && frames % 9 == 0) {
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_0);
|
||||
mpKeyboard->onKey(4, animationName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3084,6 +3151,9 @@ namespace textinput {
|
||||
void Base::setInputModeJP(bool, u32, u32) {
|
||||
}
|
||||
|
||||
SelectorPosition chinesePosition = {{-219.0f, -130.0f, 0.0f}};
|
||||
SelectorPosition koreanPosition = {{-209.0f, -90.0f, 0.0f}};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
317
tools/decomp-assist/CHANSVm.attempts.md
Normal file
317
tools/decomp-assist/CHANSVm.attempts.md
Normal file
@@ -0,0 +1,317 @@
|
||||
# CHANSVm continuation attempt log
|
||||
|
||||
The live checkout started at 02e50d2d without the earlier CHANSVm source changes or its attempt log, despite the continuation description. The live gate baseline is used below. No branch, remote or worktree operations were performed.
|
||||
|
||||
## Final full gate
|
||||
|
||||
```text
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[src/channelScript/CHANSVm] pool: IDENTICAL
|
||||
[src/channelScript/CHANSVm] objdiff: code 31960/53564 data 800/6904 functions 205/233 fuzzy 98.3091 linked code 0
|
||||
[src/channelScript/CHANSVm] instruction-exact functions: 204/233
|
||||
[src/channelScript/CHANSVm] section .data size 4672 match 18.050066
|
||||
[src/channelScript/CHANSVm] section .rodata size 1432 match 97.2067
|
||||
[src/channelScript/CHANSVm] section .sbss size 16 match 100.0
|
||||
[src/channelScript/CHANSVm] section .sdata size 600 match 100.0
|
||||
[src/channelScript/CHANSVm] section .sdata2 size 184 match 100.0
|
||||
[src/channelScript/CHANSVm] section .text size 53564 match 98.30909
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmGetSourceLine 97.71739
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmNewObjData 99.375
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmStrCpyToU16FromU8 98.46154
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmParseInt 94.69388
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_8144B4D4 96.92771
|
||||
[src/channelScript/CHANSVm] below 100: VmArraySlice 96.2782
|
||||
[src/channelScript/CHANSVm] below 100: VmDateDtor 94.96703
|
||||
[src/channelScript/CHANSVm] below 100: VmStringFromCharCode 99.40678
|
||||
[src/channelScript/CHANSVm] below 100: VmStringReplace 97.106064
|
||||
[src/channelScript/CHANSVm] below 100: VmStringSplit 96.04955
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_8145049C 98.58237
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_81450D14 97.391304
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCopyRangeFrom 91.67647
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobGetHexString 98.71951
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcRangeSHA1Digest 96.484535
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcRangeMD5Digest 99.793816
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcHMAC 99.453125
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcRangeHMAC 99.72269
|
||||
[src/channelScript/CHANSVm] below 100: vmBlobParsePackFormatString 99.69827
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobPackCommon 92.603294
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobUnpack 92.083176
|
||||
[src/channelScript/CHANSVm] below 100: VmImageCtor 99.0
|
||||
[src/channelScript/CHANSVm] below 100: VmWinEmuWrite 99.62687
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmAddExe 99.1063
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_81455654 94.0
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmLinkModules 98.677246
|
||||
[src/channelScript/CHANSVm] below 100: VmCallMethod 96.565834
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmStep 94.7901
|
||||
[src/channelScript/CHANSVm] baseline: code 30984/53564 data 16 functions 202 fuzzy 98.2665
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 72.11085 -> 72.14343
|
||||
global fuzzy_match_percent: 80.97820 -> 80.97897
|
||||
global complete_code_percent: 56.76068 -> 56.76068
|
||||
global matched_data_percent: 86.15517 -> 86.19795
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
## Before and after
|
||||
|
||||
Instruction-exact functions: 201/233 -> 204/233. Objdiff-matched functions: 202/233 -> 205/233. Code bytes: 30984/53564 -> 31960/53564. Data bytes: 16/6904 -> 800/6904.
|
||||
|
||||
VmArrayExpandCommon: 85/85 instructions, diffs 0. VmDateGetRTC: 38/38 instructions, diffs 0. VmStringSplice: 121/121 instructions, diffs 0. The clock and slice fixes were reverified and reapplied because they were absent from the live checkout.
|
||||
|
||||
CHANSVmStrCpyToU16FromU8 improves from 97.30769% to 98.46154%; it remains non-matching, with three register differences.
|
||||
|
||||
## Data work
|
||||
|
||||
- UTF-16 NaN and comma literals use ordinary escaped string literals with the original single-byte terminator.
|
||||
- The empty string data is a real object header with an empty-string pointer, matching the original relocation at .rodata+0x50.
|
||||
- The fifth constant object has a null pointer, matching the absence of a target relocation at .rodata+0xa0.
|
||||
- The final floating constant keyword is NaN, rather than a duplicate Infinity. Its source position precedes the floating-point format string.
|
||||
- Error success and unknown messages are arrays, matching the original data symbols, rather than pointers.
|
||||
- Shared report and integer format arrays eliminate duplicate pooled literals in the document writer and interpreter.
|
||||
- .sdata, .sdata2 and .sbss score 100% in objdiff. .rodata improves from 85.50279% to 97.2067%. .data improves from 17.614084% to 18.050066%.
|
||||
|
||||
Raw bytes, before applying relocations, are identical for .data, .rodata and .sdata2. The .sdata source bytes match the target prefix; objdiff accepts the target trailing zero alignment and scores it 100%. Raw-byte identity does not establish relocation-exact data. No new labels, forced sections, dummy objects or measurement mappings were introduced.
|
||||
|
||||
## Remaining functions
|
||||
|
||||
CHANSVmGetSourceLine, 97.71739%, register allocation and line-data address operands.
|
||||
CHANSVmNewObjData, 99.375%, register allocation and allocation-failure branch destination.
|
||||
CHANSVmStrCpyToU16FromU8, 98.46154%, three register differences after the decrement-first rewrite.
|
||||
CHANSVmParseInt, 94.69388%, three instruction scheduling differences.
|
||||
CHANSVm_8144B4D4, 96.92771%, register allocation and parse-end initialization scheduling.
|
||||
VmArraySlice, 96.2782%, signed index clipping, branch layout and register allocation.
|
||||
VmDateDtor, 94.96703%, seven argument-load scheduling differences.
|
||||
VmStringFromCharCode, 99.40678%, six register differences.
|
||||
VmStringReplace, 97.106064%, string field-load scheduling and register allocation.
|
||||
VmStringSplit, 96.04955%, register allocation, scheduling and branch operands.
|
||||
CHANSVm_8145049C, 98.58237%, character and string formatting paths, scheduling and register allocation.
|
||||
CHANSVm_81450D14, 97.391304%, one missing instruction and branch layout.
|
||||
VmBlobFill, 100.0%, two raw conditional branch operands differ despite objdiff 100%.
|
||||
VmBlobCopyRangeFrom, 91.67647%, range-check control flow, 139/136 instructions.
|
||||
VmBlobGetHexString, 98.71951%, fourteen register differences.
|
||||
VmBlobCalcRangeSHA1Digest, 96.484535%, range-check scheduling and register allocation.
|
||||
VmBlobCalcRangeMD5Digest, 99.793816%, four register differences.
|
||||
VmBlobCalcHMAC, 99.453125%, seven register differences.
|
||||
VmBlobCalcRangeHMAC, 99.72269%, register allocation and hash context stack offset.
|
||||
vmBlobParsePackFormatString, 99.69827%, decimal accumulator register allocation.
|
||||
VmBlobPackCommon, 92.603294%, stack layout and control flow, 675/668 instructions.
|
||||
VmBlobUnpack, 92.083176%, control flow and register allocation, 531/517 instructions.
|
||||
VmImageCtor, 99.0%, four register differences.
|
||||
VmWinEmuWrite, 99.62687%, five register differences.
|
||||
CHANSVmAddExe, 99.1063%, register allocation, relocation loop scheduling and addition operands.
|
||||
CHANSVm_81455654, 94.0%, missing initial null-result instruction, 34/35 instructions.
|
||||
CHANSVmLinkModules, 98.677246%, register allocation and dispatch traversal scheduling.
|
||||
VmCallMethod, 96.565834%, control flow and register allocation, 279/281 instructions.
|
||||
CHANSVmStep, 94.7901%, stack layout and interpreter paths, 1249/1253 instructions.
|
||||
|
||||
## Attempts
|
||||
|
||||
Each compiling attempt rebuilt only CHANSVm.o, regenerated objdiff and compared raw instructions against the original. Every remaining function has at least three distinct compiling source-level attempts. Failed compiler experiments are recorded separately. Changes with regressions were restored. Exact variants retained during iteration were cleaned up before the final gate; the source diff is the authority for retained changes.
|
||||
|
||||
### VmBlobCalcRangeMD5Digest
|
||||
|
||||
- name the range validation boolean: 99.793816%; instructions 97/97, differing positions 4; restored.
|
||||
- test digest buffer before allocated object: 99.639175%; instructions 97/97, differing positions 7; restored.
|
||||
- load range pointer directly into update argument: 90.515465%; instructions 96/97, differing positions 26; restored.
|
||||
|
||||
### VmBlobCalcRangeHMAC
|
||||
|
||||
- declare hash context before pointer locals: 99.890755%; instructions 119/119, differing positions 5; restored.
|
||||
- check digest pointer before output object: 99.68067%; instructions 119/119, differing positions 10; restored.
|
||||
- write data argument directly in hash update: 85.411766%; instructions 118/119, differing positions 32; restored.
|
||||
|
||||
### vmBlobParsePackFormatString
|
||||
|
||||
- scope a signed numeric character beside accumulator: 98.01724%; instructions 117/116, differing positions 41; restored.
|
||||
- subtract ascii zero before adding decimal product: 99.69827%; instructions 116/116, differing positions 6; restored.
|
||||
- parameter loop with explicit position increment: 99.69827%; instructions 116/116, differing positions 6; restored.
|
||||
|
||||
### VmWinEmuWrite
|
||||
|
||||
- read string length before resetting offset: 99.62687%; instructions 67/67, differing positions 5; restored.
|
||||
- separate conversion input data pointer: 99.62687%; instructions 67/67, differing positions 5; restored.
|
||||
- two byte string terminators with memset: 89.31343%; instructions 68/67, differing positions 57; restored.
|
||||
|
||||
### VmBlobCalcHMAC
|
||||
|
||||
- check output buffer before header: 99.453125%; instructions 64/64, differing positions 7; restored.
|
||||
- explicit boolean native key test: 99.453125%; instructions 64/64, differing positions 7; restored.
|
||||
- load data before size at hash setup: 99.265625%; instructions 64/64, differing positions 11; restored.
|
||||
|
||||
### VmStringFromCharCode
|
||||
|
||||
- cache upper bound for code points: 99.40678%; instructions 59/59, differing positions 6; restored.
|
||||
- code point masking after low word load: 94.32204%; instructions 57/59, differing positions 45; restored.
|
||||
- assign byte offset before index counter: 99.32204%; instructions 59/59, differing positions 7; restored.
|
||||
|
||||
### CHANSVmNewObjData
|
||||
|
||||
- cache chunk slot as typed pointer: 99.375%; instructions 96/96, differing positions 11; restored.
|
||||
- invert allocation success branch within scan: 99.375%; instructions 96/96, differing positions 11; restored.
|
||||
- advance free entry pointer during entry scan: did not compile due to C89 declaration placement; restored and followed by a compiling variant.
|
||||
- pointer scan with declaration in function scope: 97.552086%; instructions 95/96, differing positions 65; restored.
|
||||
|
||||
### VmArrayExpandCommon
|
||||
|
||||
- derive element offset from index: 100.0%; instructions 85/85, differing positions 0; retained during iteration.
|
||||
- iterate element headers with typed pointer: 100.0%; instructions 85/85, differing positions 0; retained during iteration.
|
||||
- narrow allocation size lifetime to allocation block: 100.0%; instructions 85/85, differing positions 0; retained during iteration.
|
||||
- use array chunk element field for destinations: 100.0%; instructions 85/85, differing positions 0; retained during iteration.
|
||||
|
||||
### CHANSVmAddExe
|
||||
|
||||
- reverse initial typed module and context declarations: 99.1063%; instructions 254/254, differing positions 35; restored.
|
||||
- use module element fields instead of byte offset: 99.15354%; instructions 254/254, differing positions 34; restored.
|
||||
- test typed execution id using temporary: 99.1063%; instructions 254/254, differing positions 35; restored.
|
||||
|
||||
### VmImageCtor
|
||||
|
||||
- name data pointer inside callback branch: 99.0%; instructions 25/25, differing positions 4; restored.
|
||||
- store return object pointer in image lookup temporary: 99.0%; instructions 25/25, differing positions 4; restored.
|
||||
- use pointer truth test and retain size test: 99.0%; instructions 25/25, differing positions 4; restored.
|
||||
|
||||
### VmBlobGetHexString
|
||||
|
||||
- separate high and low nibble values: 98.71951%; instructions 82/82, differing positions 14; restored.
|
||||
- reverse nibble lookup operand order: 98.71951%; instructions 82/82, differing positions 14; restored.
|
||||
- signed destination byte count: 98.71951%; instructions 82/82, differing positions 14; restored.
|
||||
|
||||
### CHANSVm_8145049C
|
||||
|
||||
- use typed temporary string header: 98.58237%; instructions 431/431, differing positions 42; restored.
|
||||
- use typed character string buffer and retained buffer size: 98.58237%; instructions 431/431, differing positions 42; restored.
|
||||
- scope string output data before source data: 98.58237%; instructions 431/431, differing positions 42; restored.
|
||||
|
||||
### CHANSVmLinkModules
|
||||
|
||||
- load module count into loop bound: 95.544975%; instructions 189/189, differing positions 123; restored.
|
||||
- increment module index before loading next module: 98.677246%; instructions 189/189, differing positions 43; restored.
|
||||
- copy dispatch entry fields separately: did not compile due to C89 declaration placement; restored and followed by a compiling variant.
|
||||
- copy dispatch fields after local declarations: 92.53439%; instructions 197/189, differing positions 186; restored.
|
||||
|
||||
### CHANSVmGetSourceLine
|
||||
|
||||
- source offset relative to cached table start: 97.82609%; instructions 46/46, differing positions 16; restored.
|
||||
- byte-sized program offset loop bound: 98.04348%; instructions 46/46, differing positions 15; restored.
|
||||
- bit test with indexed table field: 89.021736%; instructions 45/46, differing positions 39; restored.
|
||||
|
||||
### VmStringSplice
|
||||
|
||||
- use conditional for clipped byte length: 100.0%; instructions 121/121, differing positions 0; retained during iteration.
|
||||
- calculate length only in positive range: 97.06612%; instructions 120/121, differing positions 29; restored.
|
||||
- name starting argument signed byte offset: 100.0%; instructions 121/121, differing positions 0; retained during iteration.
|
||||
|
||||
### CHANSVm_81450D14
|
||||
|
||||
- positive range early successful fallthrough: 89.565216%; instructions 50/46, differing positions 33; restored.
|
||||
- test negative value before negative size bound: 70.978264%; instructions 45/46, differing positions 29; restored.
|
||||
- cache unsigned blob size in signed scalar: 79.565216%; instructions 44/46, differing positions 40; restored.
|
||||
|
||||
### CHANSVmStrCpyToU16FromU8
|
||||
|
||||
- decrement count before byte offset calculation: 98.46154%; instructions 13/13, differing positions 3; restored.
|
||||
- input indexed by reverse character counter: 69.61539%; instructions 14/13, differing positions 14; restored.
|
||||
- byte output pointer scoped beside reverse input: 97.30769%; instructions 13/13, differing positions 5; restored.
|
||||
- inspect decrement-first offset variant: 98.46154%; instructions 13/13, differing positions 3; retained during iteration.
|
||||
- distinct remaining character counter: 98.46154%; instructions 13/13, differing positions 3; restored.
|
||||
- hold narrowed byte value as signed char: 98.46154%; instructions 13/13, differing positions 4; restored.
|
||||
- use byte load directly in low-byte store: 98.46154%; instructions 13/13, differing positions 4; restored.
|
||||
|
||||
### VmStringReplace
|
||||
|
||||
- cache all three string value structures in load order: 97.82576%; instructions 132/132, differing positions 47; restored.
|
||||
- convert replacement after search is validated: 94.11364%; instructions 132/132, differing positions 59; restored.
|
||||
- reverse initial argument declaration order: 97.106064%; instructions 132/132, differing positions 53; restored.
|
||||
|
||||
### CHANSVm_8144B4D4
|
||||
|
||||
- use ordinary typed parse end pointer: 96.92771%; instructions 83/83, differing positions 13; restored.
|
||||
- read string length before allocating converted object: 82.349396%; instructions 89/83, differing positions 84; restored.
|
||||
- local typed result pointer before floating store: did not compile due to C89 declaration placement; restored and followed by a compiling variant.
|
||||
- scoped typed result pointer after store label: 96.92771%; instructions 83/83, differing positions 13; restored.
|
||||
|
||||
### VmBlobCalcRangeSHA1Digest
|
||||
|
||||
- load range offset for both bounds and hash pointer: 98.09278%; instructions 96/97, differing positions 35; restored.
|
||||
- test output buffer before digest object: 96.329895%; instructions 97/97, differing positions 17; restored.
|
||||
- assign range validity to a named boolean: 96.484535%; instructions 97/97, differing positions 14; restored.
|
||||
|
||||
### VmArraySlice
|
||||
|
||||
- mutate signed indices before clipping to array length: 95.07519%; instructions 134/133, differing positions 100; restored.
|
||||
- assign end length before start range checks: 94.172935%; instructions 132/133, differing positions 93; restored.
|
||||
- array element source acquired before destination: 88.68421%; instructions 133/133, differing positions 60; restored.
|
||||
|
||||
### VmStringSplit
|
||||
|
||||
- cache string structures before loading lengths: 95.64414%; instructions 222/222, differing positions 101; restored.
|
||||
- derive empty-delimiter byte offset from character index: 96.04955%; instructions 222/222, differing positions 81; restored.
|
||||
- validate array before getting first created element: 92.58108%; instructions 223/222, differing positions 131; restored.
|
||||
|
||||
### VmDateDtor
|
||||
|
||||
- load both calendar name tables into pointers: 91.79121%; instructions 91/91, differing positions 63; restored.
|
||||
- read month before day and pass names as locals: 94.96703%; instructions 91/91, differing positions 7; restored.
|
||||
- use calendar object directly instead of calendar pointer: 89.14286%; instructions 90/91, differing positions 85; restored.
|
||||
|
||||
### CHANSVmParseInt
|
||||
|
||||
- group end pointer and input buffer into parse context: 94.69388%; instructions 49/49, differing positions 3; restored.
|
||||
- cache string value before type test: 94.69388%; instructions 49/49, differing positions 3; restored.
|
||||
- initialize parsing end pointer after string length load: 81.42857%; instructions 50/49, differing positions 41; restored.
|
||||
|
||||
### VmDateGetRTC
|
||||
|
||||
- apply unsigned 64-bit mask after bias subtraction: 100.0%; instructions 38/38, differing positions 0; retained during iteration.
|
||||
- name rtc seconds after division: 100.0%; instructions 38/38, differing positions 0; retained during iteration.
|
||||
- unsigned bias widened before subtraction: 100.0%; instructions 38/38, differing positions 0; retained during iteration.
|
||||
- remove experimental block around seconds calculation: 100.0%; instructions 38/38, differing positions 0; retained during iteration.
|
||||
|
||||
### CHANSVm_81455654
|
||||
|
||||
- assign result instead of returning through negative-index branch: 88.28571%; instructions 33/35, differing positions 18; restored.
|
||||
- separate argument table from return pointer: 94.0%; instructions 34/35, differing positions 35; restored.
|
||||
- initialize result after active context retrieval: 94.0%; instructions 34/35, differing positions 35; restored.
|
||||
|
||||
### VmCallMethod
|
||||
|
||||
- cache active module during operand range validation: 96.565834%; instructions 279/281, differing positions 228; restored.
|
||||
- cache native property method state as bool: 96.6726%; instructions 279/281, differing positions 228; restored.
|
||||
- separate argument count operand pointer: 96.565834%; instructions 279/281, differing positions 228; restored.
|
||||
|
||||
### CHANSVmStep
|
||||
|
||||
- named execution context for initial range validation: 94.56664%; instructions 1249/1253, differing positions 1172; restored.
|
||||
- signed opcode instead of unsigned dispatch scalar: 94.52673%; instructions 1249/1253, differing positions 1173; restored.
|
||||
- load float operand into double object directly: 94.7901%; instructions 1249/1253, differing positions 1173; restored.
|
||||
|
||||
### VmBlobPackCommon
|
||||
|
||||
- typed signed parser parameter address: 92.603294%; instructions 675/668, differing positions 642; restored.
|
||||
- derive format length with shift: 92.603294%; instructions 675/668, differing positions 642; restored.
|
||||
- validate parent only for pack operation: 92.61078%; instructions 675/668, differing positions 641; restored.
|
||||
|
||||
### VmBlobUnpack
|
||||
|
||||
- array buffer declared before scalar pointers: 92.083176%; instructions 531/517, differing positions 496; restored.
|
||||
- named constant parser defaults: 92.083176%; instructions 531/517, differing positions 496; restored.
|
||||
- signed count for unpacked elements: 92.083176%; instructions 531/517, differing positions 496; restored.
|
||||
|
||||
### VmBlobCopyRangeFrom
|
||||
|
||||
- target bounds checks with named availability: 91.52941%; instructions 139/136, differing positions 71; restored.
|
||||
- use existing range predicate for both blobs: 93.80882%; instructions 138/136, differing positions 50; restored.
|
||||
- load source and destination offsets after count conversion: 94.08088%; instructions 137/136, differing positions 73; restored.
|
||||
|
||||
### VmBlobFill
|
||||
|
||||
- name converted byte value before memset: 100.0%; instructions 63/63, differing positions 2; restored.
|
||||
- scope fill byte and destination pointer together: 100.0%; instructions 63/63, differing positions 2; restored.
|
||||
- advance offset before memory fill with original offset cached: 87.01588%; instructions 63/63, differing positions 12; restored. Regressions: VmBlobFill.
|
||||
|
||||
## Uncertainty
|
||||
|
||||
The reason for VmBlobFill raw branch differences remains unresolved. Register-only mismatches may be compiler tie-breaks; the attempts do not prove that no readable C variation can match them. Remaining .data/.rodata relocation and symbol comparisons are unresolved, so the unit is not complete.
|
||||
249
tools/decomp-assist/tiPcKeyboard.round2.md
Normal file
249
tools/decomp-assist/tiPcKeyboard.round2.md
Normal file
@@ -0,0 +1,249 @@
|
||||
# PC keyboard second pass
|
||||
|
||||
Baseline: 120/141 instruction-exact functions, 16240 code bytes, 5964 data bytes. Existing string pool and .rodata match. This pass changes code and data only; configure.py remains unchanged.
|
||||
|
||||
## LayoutByNW4R::initLayout
|
||||
Start: (99.71429, (384, 385, 66, 0.9934980494148244)); .data=12552, .bss=12, .sdata2=29, .rodata=5816.
|
||||
1. use a signed switch for the second language query and a common matrix-update join: (99.42857, (385, 385, 6, 0.9896103896103896)); .data=12552, .bss=12, .sdata2=29, .rodata=5816; pool identical; reverted.
|
||||
2. hold language-mode visibility in a boolean and switch on the second query: (97.42857, (392, 385, 80, 0.9781209781209781)); .data=12552, .bss=12, .sdata2=29, .rodata=5816; pool identical; reverted.
|
||||
3. hold each language query result in a named enum before dispatch: (99.42857, (385, 385, 6, 0.9896103896103896)); .data=12552, .bss=12, .sdata2=29, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (75.89773, (280, 352, 336, 0.7563291139240507)); .data=12552, .bss=12, .sdata2=29, .rodata=5816.
|
||||
1. make the two immutable mode-selector positions function-static: (73.62784, (299, 352, 346, 0.7158218125960062)); .data=12552, .bss=36, .sdata2=29, .rodata=5816; pool identical; reverted.
|
||||
2. use function-static mutable mode-selector vectors: (73.62784, (299, 352, 346, 0.7158218125960062)); .data=12552, .bss=36, .sdata2=29, .rodata=5816; pool identical; reverted.
|
||||
3. initialize ordinary function-static VEC3 positions as aggregates: compiler rejected; reverted. at, float)' # 'nw4r::math::VEC3::VEC3(const nw4r::math::VEC3 &)' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (75.89773, (280, 352, 336, 0.7563291139240507)); .data=12552, .bss=12, .sdata2=29, .rodata=5816.
|
||||
1. initialize the two local positions as ordinary float arrays consumed by VEC3: (81.963066, (289, 352, 338, 0.7956318252730109)); .data=12552, .bss=12, .sdata2=9, .rodata=5840; pool identical; retained.
|
||||
2. initialize positions as aggregate _VEC3 and construct the pane translation from its fields: (81.79261, (289, 352, 338, 0.7831513260530422)); .data=12552, .bss=12, .sdata2=9, .rodata=5840; pool identical; reverted.
|
||||
3. construct both local VEC3 positions from ordinary coordinate arrays before language dispatch: (75.03409, (295, 352, 341, 0.7666151468315301)); .data=12552, .bss=12, .sdata2=9, .rodata=5840; pool identical; reverted.
|
||||
|
||||
|
||||
## Vtable declaration order
|
||||
Reordered class declarations to Base, EventHandler, UIObj, modifier, mode panel, layout, animation base, normal, shift, toggle, on/off. Ordinary compiler vtables are emitted in reverse declaration order, matching the target. No code-exact functions lost. {'fuzzy_match_percent': 95.17947, 'total_code': '28484', 'matched_code': '16240', 'matched_code_percent': 57.014465, 'total_data': '18564', 'matched_data': '148', 'matched_data_percent': 0.79724205, 'total_functions': 141, 'matched_functions': 120, 'matched_functions_percent': 85.106384, 'total_units': 1}
|
||||
## LayoutByNW4R::initLayout
|
||||
Start: (99.42857, (385, 385, 6, 0.9896103896103896)); .data=12576, .bss=12, .sdata2=9, .rodata=5816.
|
||||
1. switch on mode flag with explicit default join: (100.0, (385, 385, 0, 1.0)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; retained.
|
||||
2. unsigned mode temporary before test: (99.71429, (384, 385, 66, 0.9934980494148244)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; reverted.
|
||||
3. explicit early join for nonzero mode: (99.71429, (384, 385, 66, 0.9934980494148244)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::createAnmPane_
|
||||
Start: (98.515625, (192, 192, 55, 0.7135416666666666)); .data=12576, .bss=12, .sdata2=9, .rodata=5816.
|
||||
1. declare the new pane before the animation table reference: (98.515625, (192, 192, 55, 0.7135416666666666)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; reverted.
|
||||
2. cache the shared pane before allocating the animation pane: (98.5625, (192, 192, 118, 0.9270833333333334)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; retained.
|
||||
3. use a full-width table index: (95.41146, (191, 192, 180, 0.6161879895561357)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::sendInputWChar
|
||||
Start: (98.24074, (107, 108, 104, 0.9488372093023256)); .data=12576, .bss=12, .sdata2=9, .rodata=5816.
|
||||
1. assign input fields separately after the modifier calculation: (91.07407, (103, 108, 102, 0.8341232227488151)); .data=12576, .bss=12, .sdata2=9, .rodata=5800; pool identical; reverted.
|
||||
2. compute conversion bits from named booleans: (93.05556, (110, 108, 106, 0.908256880733945)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; reverted.
|
||||
3. initialize the input structure before testing keyboard modifiers: (76.31481, (107, 108, 101, 0.8186046511627907)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::setTranslateMode
|
||||
Start: (98.0, (107, 105, 89, 0.9528301886792453)); .data=12576, .bss=12, .sdata2=9, .rodata=5816.
|
||||
1. initialize mode from its enum and preserve the named valid cases: (99.04762, (106, 105, 99, 0.995260663507109)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; retained.
|
||||
2. use the existing mode as the fallback for an unknown translation mode: (95.2381, (106, 105, 97, 0.976303317535545)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; reverted.
|
||||
3. convert valid translation modes directly after an unsigned range guard: (84.03809, (90, 105, 95, 0.6871794871794872)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::getWCCode u32
|
||||
Start: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. compute modifier bits with conditional expressions: (80.024, (121, 125, 113, 0.8780487804878049)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. refer to the selected ASCII key before choosing its modifier: compiler rejected; reverted. ^ # (10224) 'const' or '&' variable needs initializer # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
3. use a named low mode for the Japanese punctuation condition: (97.56, (125, 125, 14, 0.92)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::refresh_
|
||||
Start: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. use the mode setter for the Chinese and Korean normalization: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. switch on the language for mode normalization: (96.899445, (179, 179, 12, 0.9385474860335196)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. give the nested normalized-mode test a named value: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::getWCCode char*
|
||||
Start: (96.14035, (56, 57, 18, 0.9203539823008849)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. use full-width indices in both name lookup loops: (83.68421, (56, 57, 52, 0.4424778761061947)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. write the ASCII lookup as a do-while loop: (94.29825, (57, 57, 21, 0.8771929824561403)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. cache the grid key before comparing its pane name: (86.82456, (54, 57, 37, 0.5045045045045045)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::getControlKey
|
||||
Start: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. write the control lookup with a do-while loop: (90.55556, (37, 36, 20, 0.7397260273972602)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. cache the control table before the loop: (75.833336, (33, 36, 32, 0.5797101449275363)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use a full-width control index: (85.138885, (37, 36, 29, 0.7397260273972602)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::getWCCode
|
||||
Start: (None, (56, 2, 56, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. take a named reference to the key state before forwarding: (None, (56, 2, 56, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. name the character returned by the key state: (None, (56, 2, 56, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. forward through a named key-state pointer: (None, (56, 2, 56, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onPressedShift
|
||||
Start: (90.81633, (45, 49, 42, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. hold the requested shift flags in a named local: (90.71429, (45, 49, 42, 0.8085106382978723)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. update the modifier state explicitly before refreshing: (89.591835, (45, 49, 41, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. isolate the key-state reference before setting shift: (90.81633, (45, 49, 42, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onReleasedShift
|
||||
Start: (89.871796, (38, 39, 36, 0.7532467532467533)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. name the cleared modifier bits before the setter: (90.0, (38, 39, 35, 0.7792207792207793)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. clear shift and mode bits in separate expressions: (89.871796, (38, 39, 36, 0.7532467532467533)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. update the key-state modifier explicitly before refreshing: (88.07692, (38, 39, 36, 0.7012987012987013)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::sendInputWChar
|
||||
Start: (93.97727, (42, 44, 35, 0.9302325581395349)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. keep the shift bit in an unsigned local: (95.22727, (42, 44, 35, 0.9302325581395349)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. extract shift through the state accessor: (81.09091, (47, 44, 39, 0.8571428571428571)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. select the last animation pane with a conditional expression: (91.34091, (43, 44, 35, 0.8275862068965517)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::setInputModeJP
|
||||
Start: (86.92208, (69, 77, 36, 0.8493150684931506)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. dispatch input mode using its unsigned type: (86.92208, (69, 77, 36, 0.8493150684931506)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. cache the key-state reference for both mode setters: (79.97403, (72, 77, 73, 0.5100671140939598)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. express the language-data selection with named mode tests: (83.68831, (69, 77, 36, 0.8356164383561644)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::updateInput int chan
|
||||
Start: (95.25, (135, 140, 92, 0.88)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. name the held-shift condition before dispatch: (95.25, (135, 140, 92, 0.88)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. query shift through a pointer to the gather singleton: (95.25, (135, 140, 92, 0.88)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. test release state in two nested conditions: (95.25, (135, 140, 92, 0.88)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::refreshText
|
||||
Start: (90.46154, (170, 169, 107, 0.8141592920353983)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. initialize captions through separate character assignments: (95.6213, (170, 169, 103, 0.8436578171091446)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. use full-width text table indices: (80.79881, (170, 169, 154, 0.5427728613569321)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. resolve each text pane before its dynamic cast: (89.27811, (170, 169, 123, 0.6194690265486725)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::create
|
||||
Start: (87.49367, (151, 158, 106, 0.7637540453074434)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. keep the event handler in a typed local before assigning its owner: (87.49367, (151, 158, 106, 0.7637540453074434)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. resolve each modifier animation before its pane components: (80.82912, (151, 158, 114, 0.7443365695792881)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use the direct layout member for modifier pane searches: (86.75949, (151, 158, 107, 0.7637540453074434)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onKey
|
||||
Start: (66.72967, (341, 418, 373, 0.6824769433465085)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. hold the control code before dispatching its cases: (66.72967, (341, 418, 373, 0.6824769433465085)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. dispatch the control code as a signed enum-sized value: (66.72967, (341, 418, 373, 0.6824769433465085)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. separate the key-release event and character checks: (66.72967, (341, 418, 373, 0.6824769433465085)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::updateInput HKBManager
|
||||
Start: (84.687225, (237, 227, 219, 0.6724137931034483)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare the repeated key set separately from triggered keys: (81.92951, (233, 227, 220, 0.6565217391304348)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. declare triggered character and key before its animation pointer: (84.4141, (237, 227, 217, 0.646551724137931)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use a switch for repeated hardware control keys: (89.07929, (239, 227, 230, 0.6952789699570815)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
|
||||
## EventHandler::onTiEvent
|
||||
Start: (88.83249, (196, 197, 176, 0.8600508905852418)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. dispatch the event with its unsigned parameter type: (88.83249, (196, 197, 176, 0.8600508905852418)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. write the repetition threshold with inclusive bounds: (88.862946, (196, 197, 176, 0.8702290076335878)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. split the initial modifier exclusions into early returns: (88.83249, (196, 197, 176, 0.8600508905852418)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onEvent
|
||||
Start: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. return early for non-sound listener events: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. dispatch the sound listener event with a switch: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. hold the listener sound value in its enum type: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::refreshText
|
||||
Start: (95.6213, (170, 169, 103, 0.8436578171091446)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. keep the converted ASCII character in a scalar until the text call: (94.30769, (170, 169, 105, 0.855457227138643)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. use a scalar caption and choose grid variants with a conditional index: (95.60947, (171, 169, 106, 0.8823529411764706)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. use a scalar caption and an explicit signed grid variant: (95.01183, (170, 169, 105, 0.8613569321533924)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::getControlKey
|
||||
Start: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare the control entry reference before the loop index: (81.77778, (34, 36, 26, 0.6571428571428571)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. use a signed index with a 16-bit table-index conversion: (91.80556, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. declare the index before a while loop and increment explicitly: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::refreshText
|
||||
Start: (95.60947, (171, 169, 106, 0.8823529411764706)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. load the scalar caption after the caps query and store it after conversion: (99.23077, (170, 169, 97, 0.9321533923303835)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. load the scalar caption after caps and use an explicit negated grid-mode integer: (98.15976, (169, 169, 80, 0.8816568047337278)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. load the scalar caption after caps and cast the computed grid selector to signed int: (97.92899, (169, 169, 78, 0.9053254437869822)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (74.650566, (279, 352, 339, 0.7385103011093502)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare the virtual base initializer inline in the owned implementation header: (92.639206, (342, 352, 261, 0.8645533141210374)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. declare the base initializer inline at its definition: (92.639206, (342, 352, 261, 0.8645533141210374)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. construct both local selector translations before selecting the language: (75.9375, (285, 352, 337, 0.750392464678179)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (92.639206, (342, 352, 261, 0.8645533141210374)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. construct both selector translations after the base initializer is declared inline: (93.09375, (348, 352, 265, 0.8742857142857143)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. copy selector positions into aggregate vectors before language dispatch: compiler rejected; reverted. at, float)' # 'nw4r::math::VEC3::VEC3(const nw4r::math::VEC3 &)' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
3. name both translations before the visibility setters: (89.161934, (348, 352, 282, 0.8742857142857143)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::refreshText
|
||||
Start: (99.23077, (170, 169, 97, 0.9321533923303835)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. use a full-width temporary for the converted caption: (99.28994, (169, 169, 2, 0.9881656804733728)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. use a signed full-width temporary for caption comparisons: (97.86982, (169, 169, 6, 0.9644970414201184)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. normalize the caption temporary once after the case conversion: (98.69823, (170, 169, 100, 0.9616519174041298)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (93.09375, (348, 352, 265, 0.8742857142857143)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. copy ordinary aggregate positions into the base of each VEC3 translation: (93.09375, (348, 352, 265, 0.8742857142857143)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. copy each vector position as an ordinary 12-byte record: (93.610794, (342, 352, 261, 0.8760806916426513)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. copy aggregate positions with both vectors declared together: (93.09375, (348, 352, 265, 0.8742857142857143)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::refreshText
|
||||
Start: (99.28994, (169, 169, 2, 0.9881656804733728)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. convert the scalar character back to wchar_t when indexing Korean maps: (100.0, (169, 169, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. convert the Korean map index to a 16-bit character difference: (96.86391, (169, 169, 6, 0.9644970414201184)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use a named 16-bit character for each Korean lookup: (100.0, (169, 169, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (93.610794, (342, 352, 261, 0.8760806916426513)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. copy coordinate records and construct the pane translation at the point of use: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. copy coordinate records with const local positions: compiler rejected; reverted. ::keyboard::pctype::Base::getTranslateMode() # const' redefined # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
3. copy coordinate records before visibility setters: compiler rejected; reverted. ::keyboard::pctype::Base::getTranslateMode() # const' redefined # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. make both local selector records immutable: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. declare the pane vectors before copying the selector records: (98.14773, (358, 352, 224, 0.8985915492957747)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. declare selector records at function entry and assign them before language dispatch: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onKey
|
||||
Start: (66.72967, (341, 418, 373, 0.6824769433465085)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. restore control case order from target jump-table destinations: (80.52631, (341, 418, 374, 0.8221343873517787)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. declare the caps-press handler inline while retaining target case order: (92.710526, (419, 418, 301, 0.9342891278375149)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. inline the caps-press body at its call site with target case order: (92.710526, (419, 418, 301, 0.9342891278375149)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
|
||||
## LayoutByNW4R::onKey
|
||||
Start: (92.710526, (419, 418, 301, 0.9342891278375149)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. cache the shift gather at entry to the shift-control case: (99.98325, (418, 418, 3, 0.992822966507177)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. cache the shift gather and order active-button animation first: (100.0, (418, 418, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. cache the shift gather and split modifier-state condition: (99.98325, (418, 418, 3, 0.992822966507177)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
|
||||
## Final source selection
|
||||
Reverted the early shared-pane load in createAnmPane_: its sequence-alignment score improved by shifting instructions, but the original candidate has the correct instruction order and only register differences. Reverted the named flags temporary in onPressedShift because it lowered the fuzzy score. All attempts above remain recorded.
|
||||
The second aggregate-position copy in the typed-copy batch repeated the first aggregate trial; it was not a distinct attempt. The next two full-source position transforms were inserted incorrectly by the trial harness and rejected; neither was retained. The following stack batch contains the actual distinct local-lifetime attempts.
|
||||
The inline onPressedCaps declaration trial was rejected because it removed the separately emitted real function. The explicit caps-control case retains that function and matches onKey. The case has its own scope.
|
||||
|
||||
## Final verification
|
||||
Full gate: GATE PASS; regressions 0, forbidden additions 0, readability warnings 0. Instruction-exact functions 120 -> 123/141. Objdiff code 16240 -> 20128/28484; data 5964 -> 5972/18564. New exact functions: initLayout (385 instructions), refreshText (169), onKey (418). Every remaining function has at least three distinct source-level attempts above.
|
||||
|
||||
Pool: 204/204 identical. .rodata, .sdata, .sdata2, .sbss, .ctors: 100%. Ordinary coordinate records now occupy the missing 24 bytes at the end of the string-bearing data. Owned vtables have identical target offsets after declaration reordering. Raw .data is byte-identical, 12576 bytes; all 1303 relocation sites coincide, and 1302 resolve to the same named function or section offset. The sole remaining normalized relocation-name difference is the truncated target onEvent thunk. The .data objdiff score remains 74.95624; why its anonymous-symbol alignment gives so little credit remains uncertain. .bss has 12 source bytes versus 16 target bytes, both zero; likely extraction alignment, not proven. No padding or dummy data was added.
|
||||
|
||||
The invalid TranslateMode fallback uses its supplied enum value; the target default appears to use an unset temporary, whose intended behavior is unknown. configure.py stays NonMatching, as requested.
|
||||
|
||||
Remaining functions:
|
||||
getWCCode__Q49textinput8keyboard6pctype4BaseFPc: None; Compiler inlines the key-state lookup into the forwarding wrapper; 56 versus 2 instructions.
|
||||
getControlKey__Q49textinput8keyboard6pctype4BaseFPc: 93.333336; Only loop-index and table-offset register allocation differs; 36/36 instructions, 8 differences.
|
||||
sendInputWChar__Q49textinput8keyboard6pctype4BaseFwb: 98.24074; Missing zero initialization instruction and cached flag loads; 107/108 instructions.
|
||||
setTranslateMode__Q49textinput8keyboard6pctype4BaseFQ59textinput8keyboard6pctype4Base13TranslateMode: 99.04762; One extra mode-register move, caused by defined fallback initialization; 106/105 instructions.
|
||||
refresh___Q59textinput8keyboard6pctype4Base8KeyStateFv: 98.77095; Compiler eliminates two mode reloads in normalization; 177/179 instructions.
|
||||
getWCCode__Q59textinput8keyboard6pctype4Base8KeyStateFUl: 98.8; Cached modifier load and register allocation; 124/125 instructions.
|
||||
getWCCode__Q59textinput8keyboard6pctype4Base8KeyStateFPc: 96.14035; Grid-mode expression loses one instruction; 56/57 instructions.
|
||||
create__Q49textinput8keyboard6pctype12LayoutByNW4RFP12MEMAllocator: 87.49367; Compiler removes nullable multiple-inheritance pointer adjustments; 151/158 instructions.
|
||||
createAnmPane___Q49textinput8keyboard6pctype12LayoutByNW4RFP12MEMAllocator: 98.515625; Only register allocation differs; 192/192 instructions, 55 differences.
|
||||
init__Q49textinput8keyboard6pctype12LayoutByNW4RFv: 99.94886; Only selector-record and VEC3 temporary stack offsets differ; 352/352 instructions, 18 differences.
|
||||
onPressedShift__Q49textinput8keyboard6pctype12LayoutByNW4RFb: 90.81633; Inlined setter removes repeated flag loads; 45/49 instructions.
|
||||
onReleasedShift__Q49textinput8keyboard6pctype12LayoutByNW4RFv: 90.0; Merged mask expression and eliminated flag reload; 38/39 instructions.
|
||||
sendInputWChar__Q49textinput8keyboard6pctype12LayoutByNW4RFwb: 95.22727; Shift-bit test and FIFO pointer handling; 42/44 instructions.
|
||||
setInputModeJP__Q49textinput8keyboard6pctype12LayoutByNW4RFbUlUl: 86.92208; Mode setters share conditions and remove repeated dispatch; 69/77 instructions.
|
||||
updateInput__Q49textinput8keyboard6pctype12LayoutByNW4RFiffUlUlUlPv: 95.25; Inlined shift setters remove repeated flag loads; 135/140 instructions.
|
||||
updateInput__Q49textinput8keyboard6pctype12LayoutByNW4RFRQ39textinput5input10HKBManager: 89.07929; KeySet aggregate stack allocation and control dispatch; 239/227 instructions.
|
||||
onTiEvent__Q49textinput8keyboard6pctype12EventHandlerFPQ39textinput3gui13PaneComponentUlPQ49textinput11nw4rmanager14TiEventHandler5Input: 88.862946; Event branching, one missing instruction, and register allocation; 196/197 instructions.
|
||||
@236@onEvent__Q49textinput8keyboard6pctype12LayoutByNW4RFPQ49textinput8keyboard6pctype5: None; Original symbol name is truncated; canonical compiler thunk has the same two instructions under its full signature.
|
||||
181
tools/decomp-assist/tiPcKeyboard.round3.md
Normal file
181
tools/decomp-assist/tiPcKeyboard.round3.md
Normal file
@@ -0,0 +1,181 @@
|
||||
# PC keyboard third pass
|
||||
|
||||
Baseline: 123/141 instruction-exact functions, 20128 code bytes, 5972 data bytes. Existing string pool and .rodata match. This pass changes code and data only; configure.py remains unchanged.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. group both coordinate records and pane vectors in a language-position structure: (98.14773, (358, 352, 224, 0.8985915492957747)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. copy selector records into one two-element position array: (97.619316, (359, 352, 239, 0.9310829817158931)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. scope language positions independently from the remaining layout initialization: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::getWCCode char*
|
||||
Start: (96.14035, (56, 57, 18, 0.9203539823008849)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. choose the grid variant with a conditional selector: (100.0, (57, 57, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. name the negative mode index before adding the grid variant base: (98.22807, (56, 57, 16, 0.9380530973451328)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. write the matched grid variant as explicit mode branches: (81.03509, (57, 57, 33, 0.43859649122807015)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::setTranslateMode
|
||||
Start: (99.04762, (106, 105, 99, 0.995260663507109)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. use direct as the initialized fallback mode: (99.04762, (106, 105, 101, 0.995260663507109)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. join the direct and fallback switch labels: (98.0, (103, 105, 96, 0.9519230769230769)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. keep the mode enum itself as the mutable switch result: (99.04762, (106, 105, 99, 0.995260663507109)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::sendInputWChar
|
||||
Start: (98.24074, (107, 108, 104, 0.9488372093023256)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. mask incoming conversion flags when merging them into the stored mode: (99.02778, (107, 108, 104, 0.986046511627907)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. clear rejection after modifier calculation and mask conversion flags: (92.59259, (108, 108, 18, 0.9722222222222222)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. clear rejection before declaring modifier flags and mask conversion flags: (100.0, (108, 108, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
|
||||
## Base::KeyState::getWCCode u32
|
||||
Start: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. scope modifier calculation separately from punctuation-mode evaluation: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. compute the character through a named ASCII record pointer: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. evaluate direct input mode before its punctuation mapping: (95.48, (128, 125, 116, 0.9011857707509882)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::refresh_
|
||||
Start: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. test the normalized mode before checking its language range: (97.994415, (177, 179, 156, 0.9550561797752809)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. select the language table through a single conditional expression: (91.480446, (174, 179, 148, 0.8781869688385269)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. compute normalized flags before assigning the stored mode: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::createAnmPane_
|
||||
Start: (98.515625, (192, 192, 55, 0.7135416666666666)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. use a typed table-row pointer instead of a reference: (98.515625, (192, 192, 55, 0.7135416666666666)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. declare shared-pane storage before the outer loop: (100.0, (192, 192, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. write the outer table traversal as a while loop: (98.515625, (192, 192, 55, 0.7135416666666666)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::getControlKey
|
||||
Start: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. name the comparison result before branching on a control: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. declare the table index outside the loop initialization: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use an explicit unsigned comparison for the name-match result: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::getWCCode
|
||||
Start: (None, (57, 2, 57, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. call the key-state lookup through its explicitly qualified class: (None, (57, 2, 57, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. hold the pane name in a local before forwarding: (None, (57, 2, 57, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use a member-function pointer to forward the lookup: (None, (18, 2, 18, 0.1)); .data=12584, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::setInputModeJP
|
||||
Start: (86.92208, (69, 77, 36, 0.8493150684931506)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. give the two kana input modes separate switch bodies: (79.09091, (77, 77, 21, 0.8571428571428571)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. restore direct, roman, kana switch body order: (100.0, (77, 77, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. restore switch body order with unsigned mode dispatch: (100.0, (77, 77, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::sendInputWChar
|
||||
Start: (95.22727, (42, 44, 35, 0.9302325581395349)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. record consumed shift state after retrieving its last pane: (100.0, (44, 44, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. record shift state before retrieving its last pane: (95.454544, (44, 44, 5, 0.9772727272727273)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use an integer shift-state result assigned in the active branch: (100.0, (44, 44, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## EventHandler::onTiEvent
|
||||
Start: (88.862946, (196, 197, 176, 0.8702290076335878)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. restore event switch body order to press, release, focus: (99.44163, (196, 197, 176, 0.9872773536895675)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. switch on bounding-pane prefix with the target event body order: (98.88325, (197, 197, 5, 0.9847715736040609)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. split the modifier exclusion tests before bounding-pane dispatch: compiler rejected; reverted. ^^^^^^^ # (10140) undefined identifier 'AnmPane' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
|
||||
## LayoutByNW4R::onPressedShift
|
||||
Start: (90.81633, (45, 49, 42, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare the modifier setter inline in the owned header: (90.81633, (45, 49, 42, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. select the pressed animation through the stored button state: (94.89796, (47, 49, 41, 0.8125)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. separate shift-mask construction from the lower mode nibble: (90.71429, (45, 49, 42, 0.8085106382978723)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onReleasedShift
|
||||
Start: (90.0, (38, 39, 35, 0.7792207792207793)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. clear mode then shift in two named modifier steps: (90.89744, (37, 39, 34, 0.7894736842105263)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. keep the cleared modifier in a const local: (90.0, (38, 39, 35, 0.7792207792207793)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. load button state before the modifier update and retain the later live check: (79.97436, (43, 39, 40, 0.6341463414634146)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## EventHandler::onTiEvent
|
||||
Start: (99.44163, (196, 197, 176, 0.9872773536895675)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. switch on the caps-exclusion result before testing the pane prefix: (100.0, (197, 197, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. name the caps-exclusion result before switch dispatch: (100.0, (197, 197, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. join failed exclusion checks through a shared function return: (100.0, (197, 197, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::getControlKey
|
||||
Start: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare a full-width control table index before the loop: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. use a 16-bit cached control index declared before the loop: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. name the control table index inside each iteration: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::create
|
||||
Start: (87.49367, (151, 158, 106, 0.7637540453074434)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare the pane manager before constructing the event handler: (87.49367, (151, 158, 106, 0.7637540453074434)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. retain a typed reference to each modifier while wiring its components: (87.49367, (151, 158, 106, 0.7637540453074434)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. name the listener pointers before attaching each bounding component: (87.49367, (151, 158, 106, 0.7637540453074434)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::updateInput int chan
|
||||
Start: (95.78571, (136, 140, 91, 0.855072463768116)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. cache the hardware keyboard manager before changing shift state: (90.10714, (134, 140, 105, 0.8102189781021898)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. branch on the held-shift mask through an integer switch: (94.28571, (138, 140, 65, 0.841726618705036)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. name the released shift state before invoking its handler: (92.77143, (136, 140, 91, 0.8115942028985508)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::updateInput HKBManager
|
||||
Start: (89.07929, (239, 227, 230, 0.6952789699570815)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. provide a memberwise KeySet copy constructor within the implementation-only guard: (91.18943, (233, 227, 211, 0.8304347826086956)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. dispatch triggered control keys through a signed switch: (91.21586, (242, 227, 234, 0.7249466950959488)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use a full-width converted character and 16-bit Korean map indices: (86.14978, (237, 227, 229, 0.6508620689655172)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onEvent
|
||||
Start: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. dispatch listener events through a signed integer switch: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. return early before converting the sound payload: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. forward a named sound identifier inside the handled-event scope: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::updateInput HKBManager
|
||||
Start: (91.18943, (233, 227, 211, 0.8304347826086956)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. combine copy elision with target triggered-key switch dispatch: (94.00881, (236, 227, 150, 0.8596112311015118)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. keep the Korean character scalar scoped to its conversion block: (93.37004, (232, 227, 208, 0.9019607843137255)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. combine target triggered-key dispatch with the scoped Korean scalar: (96.18943, (235, 227, 48, 0.9437229437229437)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
|
||||
## Base::getControlKey
|
||||
Start: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. join the found key and fallback through one return: (69.97222, (33, 36, 33, 0.37681159420289856)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. write the control traversal as an explicit infinite loop with a bound break: (90.55556, (37, 36, 20, 0.7397260273972602)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. hold the result in a local initialized at the match and exit through a label: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::updateInput HKBManager
|
||||
Start: (96.18943, (235, 227, 48, 0.9437229437229437)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. share the delete animation across repeated delete and backspace cases: (99.73568, (227, 227, 1, 0.9955947136563876)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. share repeated delete handling and explicitly narrow the converted Korean character: (99.73568, (227, 227, 1, 0.9955947136563876)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. share repeated delete handling and keep the outer character full-width until its final conversion: (95.66079, (227, 227, 38, 0.9118942731277533)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::getControlKey
|
||||
Start: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare the compared control pointer before the traversal while retaining the live result lookup: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. bind each compared control through a const reference: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. name the compared pane pointer before traversal and assign it per entry: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onReleasedShift
|
||||
Start: (90.89744, (37, 39, 34, 0.7894736842105263)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. return early when the live shift-button state is already off: (90.89744, (37, 39, 34, 0.7894736842105263)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
|
||||
The earlier wasOn trial was rejected and is not counted toward three valid attempts: a refresh callback could change the live button state. The early-return trial above preserves the live-state check and supplies the third valid alternative.
|
||||
|
||||
## Final source review
|
||||
Reverted the onPressedShift animation-state branch despite its fuzzy gain: the stored state was just assigned true, making its alternate animation branch redundant. The trial remains evidence of the target compiler artifact, not retained source progress. The instruction-exact count remains 129; this also returns controller updateInput to its previous flag-load differences.
|
||||
Reverted the two-step cleared-modifier temporary in onReleasedShift: its small local fuzzy gain made inlined controller updateInput worse, 95.25% -> 94.35714%. Both functions retain their baseline implementations; all new instruction-exact functions remain.
|
||||
|
||||
## Final verification
|
||||
Full non-quick gate: GATE PASS. Instruction-exact functions 123 -> 129/141; objdiff code 20128 -> 22828/28484; matched data 5972 -> 5972/18564. Fuzzy 98.4280 -> 99.3443. Regressions, forbidden additions, readability warnings: 0. Source remains NonMatching; configure.py was not edited.
|
||||
|
||||
New exact functions: Base::sendInputWChar, 108 instructions; KeyState::getWCCode(char*), 57; LayoutByNW4R::createAnmPane_, 192; LayoutByNW4R::sendInputWChar, 44; LayoutByNW4R::setInputModeJP, 77; EventHandler::onTiEvent, 197. Each was measured at 100% and identical instruction sequences.
|
||||
|
||||
Shared change: the KeySet copy constructor is inside TI_PC_KEYBOARD_IMPLEMENTATION, defined by this .cpp alone. It restores return-value copy elision and real memberwise copy semantics. Other translation units have zero output regressions. Files changed: src/keyboard/tiPcKeyboard.cpp, include/keyboard/tiHKBManager.h, tools/decomp-assist/tiPcKeyboard.round3.md.
|
||||
|
||||
Data audit: pool 204/204 identical. Raw .data is byte-identical, 12576 bytes; all 1303 relocation sites coincide. Resolving local symbols to section offsets leaves one relocation-name difference, the truncated onEvent thunk at 0x2fb8. Ordinary tables, coordinate records, and owned vtable order remain correct. .rodata, .sdata, .sdata2, .sbss and .ctors score 100%. The .data score remains 74.95624; anonymous-symbol attribution is still uncertain. .bss remains 12 versus 16 zero bytes; extraction alignment is plausible but unproven. No dummy bytes, padding objects or symbol-name fixes were added.
|
||||
|
||||
Every remaining function has at least three distinct valid source-level attempts recorded in this pass. Source transformations that failed to apply or compile were not retained. Remaining evidence:
|
||||
getWCCode__Q49textinput8keyboard6pctype4BaseFPc: None; The forwarding wrapper still inlines the now-exact key-state lookup: 57/2 instructions.
|
||||
getControlKey__Q49textinput8keyboard6pctype4BaseFPc: 93.333336; Loop-index and table-offset registers are swapped: 36/36 instructions, 8 differences.
|
||||
setTranslateMode__Q49textinput8keyboard6pctype4BaseFQ59textinput8keyboard6pctype4Base13TranslateMode: 99.04762; Defined fallback initialization adds a mode-register move: 106/105 instructions. Invalid-enum intent remains unknown.
|
||||
refresh___Q59textinput8keyboard6pctype4Base8KeyStateFv: 98.77095; Mode normalization eliminates two repeated flag loads: 177/179 instructions.
|
||||
getWCCode__Q59textinput8keyboard6pctype4Base8KeyStateFUl: 98.8; The first modifier load is reused across punctuation evaluation: 124/125 instructions; register differences remain.
|
||||
create__Q49textinput8keyboard6pctype12LayoutByNW4RFP12MEMAllocator: 87.49367; Nullable multiple-inheritance pointer adjustments disappear and temporaries are scheduled differently: 151/158 instructions.
|
||||
init__Q49textinput8keyboard6pctype12LayoutByNW4RFv: 99.94886; Selector records and their pane-vector temporaries occupy different stack slots: 352/352 instructions, 18 differences.
|
||||
onPressedShift__Q49textinput8keyboard6pctype12LayoutByNW4RFb: 90.81633; The modifier setter eliminates repeated flag loads; the target also contains a dead virtual-call branch artifact: 45/49 instructions.
|
||||
onReleasedShift__Q49textinput8keyboard6pctype12LayoutByNW4RFv: 90.0; Modifier masking and cached loads differ: 38/39 instructions.
|
||||
updateInput__Q49textinput8keyboard6pctype12LayoutByNW4RFiffUlUlUlPv: 95.25; Inlined shift setters eliminate repeated flag loads: 135/140 instructions.
|
||||
updateInput__Q49textinput8keyboard6pctype12LayoutByNW4RFRQ39textinput5input10HKBManager: 99.73568; One final character move should narrow to 16 bits: 227/227 instructions, source mr r26,r3 versus target clrlwi r26,r3,16.
|
||||
@236@onEvent__Q49textinput8keyboard6pctype12LayoutByNW4RFPQ49textinput8keyboard6pctype5: None; Target name is truncated; the canonical compiler thunk still has identical two-instruction code under its complete signature.
|
||||
58
tools/update_readme_progress.py
Normal file
58
tools/update_readme_progress.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Rewrite the progress block in README.md from an objdiff report.
|
||||
|
||||
usage: update_readme_progress.py <report.json> <README.md> [commit]
|
||||
"""
|
||||
import datetime
|
||||
import json
|
||||
import sys
|
||||
|
||||
START = "<!-- progress:start -->"
|
||||
END = "<!-- progress:end -->"
|
||||
|
||||
|
||||
def pct(measures, key):
|
||||
return float(measures.get(key) or 0.0)
|
||||
|
||||
|
||||
def main():
|
||||
report_path, readme_path = sys.argv[1], sys.argv[2]
|
||||
commit = sys.argv[3][:8] if len(sys.argv) > 3 else ""
|
||||
m = json.load(open(report_path))["measures"]
|
||||
|
||||
stamp = datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d %H:%M UTC")
|
||||
block = "\n".join([
|
||||
START,
|
||||
"| Decompiled | Matched | Linked | Data |",
|
||||
"|:---:|:---:|:---:|:---:|",
|
||||
f"| {pct(m, 'fuzzy_match_percent'):.2f}% | {pct(m, 'matched_code_percent'):.2f}% "
|
||||
f"| {pct(m, 'complete_code_percent'):.2f}% | {pct(m, 'matched_data_percent'):.2f}% |",
|
||||
"",
|
||||
f"units {m.get('complete_units')}/{m.get('total_units')} complete, "
|
||||
f"functions {m.get('matched_functions')}/{m.get('total_functions')} 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",
|
||||
END,
|
||||
])
|
||||
|
||||
text = open(readme_path, encoding="utf-8").read()
|
||||
if START in text and END in text:
|
||||
head, rest = text.split(START, 1)
|
||||
_, tail = rest.split(END, 1)
|
||||
new = head + block + tail
|
||||
else:
|
||||
anchor = "Progress\n========\n"
|
||||
if anchor not in text:
|
||||
raise SystemExit("no progress anchor in README")
|
||||
new = text.replace(anchor, anchor + block + "\n\n", 1)
|
||||
|
||||
if new != text:
|
||||
open(readme_path, "w", encoding="utf-8").write(new)
|
||||
print("README progress updated")
|
||||
else:
|
||||
print("README progress unchanged")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user