Compare commits

...

4 Commits

20 changed files with 6017 additions and 115 deletions

62
.github/workflows/readme-progress.yml vendored Normal file
View 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

View File

@@ -50,6 +50,16 @@ Supported versions:
Progress
========
<!-- progress:start -->
| Decompiled | Matched | Linked | Data |
|:---:|:---:|:---:|:---:|
| 80.98% | 72.11% | 56.76% | 86.16% |
units 748/1027 complete, functions 10570/12563 matched. updated 2026-09-29 22:58 UTC from `test` by the self-hosted progress job
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] |

View File

@@ -309,7 +309,11 @@ namespace textinput {
virtual u16 getScroll() { return mTextArea.GetDispOffset(); } // 0x100
virtual bool isInScroll(); // 0x104
virtual void setActive(bool active); // 0x108
virtual bool isActive() const; // 0x10C
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual bool isActive() const { return mbActive; }
#else
virtual bool isActive() const;
#endif // 0x10C
virtual void setSelectedTextPane(int pane) { mTextArea.SetSelectedText(pane); } // 0x110
virtual void setFocusedTextPane(int pane) { mTextArea.SetFocusedText(pane); } // 0x114
virtual int getFocusedTextPane() { return mTextArea.GetFocusedText(); } // 0x118

View File

@@ -19,6 +19,24 @@ namespace textinput {
u32 GetModifierState() const;
void SetModifierState(u32, u32);
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
class KeySet {
public:
u8 GetKey() const;
wchar_t GetWChar() const;
bool IsValid() const;
KeySet GetNext() const;
private:
const HKBManager* mpManager;
u8 mKind;
s8 mIndex;
u8 mDevice;
u16 mCharacter;
};
KeySet GetTriggeredKeySet() const;
KeySet GetRepeatedKeySet() const;
void SetForceModifierState(u32 mask, u32 state);
#else
class KeySet {
private:
keyboard::cellphonetype::PaneNameToCharCode* pPaneNameToCharCode; // 0x00
@@ -27,6 +45,7 @@ namespace textinput {
u16 uType; // 0x28
};
#endif
private:
u8 unk_0x00[0xFC];

View File

@@ -14,6 +14,9 @@ namespace textinput {
~HWKeyboard();
virtual void init();
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
wchar_t convertWCCode(wchar_t code) const;
#endif
#ifdef MYTIMANAGER_IMPLEMENTATION
void updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data);

View File

@@ -30,6 +30,10 @@ namespace textinput {
};
class DeadKeyStream {
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
public:
static wchar_t ToIndependentClass(wchar_t code);
#endif
private:
KPRQueue mKPRQueue; // 0x00
};
@@ -140,7 +144,12 @@ namespace textinput {
virtual void enableSpaceByRight(bool rightWithSpace);
virtual void onClose();
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
tistring::WithAtok* getCurrentString(bool fixed);
virtual bool canConvert() { return getCurrentString(false) == mpUnfixString; }
#else
virtual bool canConvert();
#endif
virtual void setString(const wchar_t* string);

View File

@@ -9,20 +9,31 @@ namespace textinput {
class KeyboardBase : public CommandSender {
public:
virtual ~KeyboardBase() {}
#ifndef TI_PC_KEYBOARD_IMPLEMENTATION
virtual void create(MEMAllocator* alloc) override;
virtual void init() override;
virtual void setCommandReceiver(CommandReceiver* receiver) override;
virtual void sendCommand(u32 command, void*) override;
#endif
virtual void updateFromReceiver(u32, void*) override;
#ifdef MYTIMANAGER_IMPLEMENTATION
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TI_PC_KEYBOARD_IMPLEMENTATION)
virtual void onKey(u32, void*);
#else
virtual void onKey(u32);
#endif
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual int getType();
#else
virtual void getType();
#endif
virtual void setLanguage(Language language);
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual Language getLanguage() const { return meLanguage; }
virtual void update() {}
#else
virtual Language getLanguage() const;
virtual void update();
#endif
virtual void onActive();
protected:

View File

@@ -19,6 +19,10 @@ namespace textinput {
bool isHoldingShift() const {
return isHWPressedShift() || isPressedShiftB();
}
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
u8 isCapsLock() const { return mbCpasLock; }
void setPressedShiftB(bool pressed) { mbPressedShiftB = pressed; }
#endif
u8 isHWPressedShift() const { return mbPressedShift; }
u8 isPressedShiftB() const { return mbPressedShiftB; }
void setHWPressedShift(const u8& arg) { mbPressedShift = arg; }

View File

@@ -86,11 +86,29 @@ namespace textinput {
virtual void init() {} // 0x08
virtual void calc(); // 0x0C
virtual void onAnmEvent(AnmPaneEvent paneEvent); // 0x10
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual void onAnmEvent(AnmPaneEvent) {}
#else
virtual void onAnmEvent(AnmPaneEvent paneEvent);
#endif // 0x10
virtual void changeAnimation(u32 id); // 0x14
virtual bool isInAnimation(); // 0x18
virtual Anim* searchAnimation(u32 id); // 0x1C
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual bool isInAnimation() { return mpCurrentAnim != NULL; }
#else
virtual bool isInAnimation();
#endif // 0x18
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual Anim* searchAnimation(u32 id) {
for (Anim* animation = static_cast<Anim*>(nw4r::ut::List_GetNext(&mAnms, NULL)); animation != NULL;
animation = static_cast<Anim*>(nw4r::ut::List_GetNext(&mAnms, animation))) {
if (animation->muID == id) return animation;
}
return NULL;
}
#else
virtual Anim* searchAnimation(u32 id);
#endif // 0x1C
virtual ~AnmPane(); // 0x20
@@ -186,7 +204,11 @@ namespace textinput {
virtual nw4r::lyt::Pane* get(int i) { return mpaFifo[i]; } // 0x10
virtual nw4r::lyt::Pane* getLast() { // 0x14
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
for (int i = MAX_COUNT-1; i > -1; i--) {
#else
for (int i = MAX_COUNT-1; i > -1; i++) {
#endif
if (mpaFifo[i] != NULL) {
return mpaFifo[i];
}
@@ -231,8 +253,16 @@ namespace textinput {
virtual void setProjectionMtx(); // 0x48
virtual void setPaneLastDrawReceived(nw4r::lyt::Pane* paneLastDraw); // 0x4C
virtual void initPaneLastDrawReceived(); // 0x50
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual void setPaneLastDrawReceived(nw4r::lyt::Pane* pane) { mAnmPaneFifo.push(pane); }
#else
virtual void setPaneLastDrawReceived(nw4r::lyt::Pane* paneLastDraw);
#endif // 0x4C
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual void initPaneLastDrawReceived() { mAnmPaneFifo.init(); }
#else
virtual void initPaneLastDrawReceived();
#endif // 0x50
virtual void setVisible(const char* paneName, bool flag); // 0x54
virtual bool isVisible(const char* paneName, bool* result) const; // 0x58

View File

@@ -1,6 +1,10 @@
#ifndef TEXTINPUT_PC_KEYBOARD_H
#define TEXTINPUT_PC_KEYBOARD_H
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
#include "tiPcKeyboardImpl.h"
#else
#include "tiNw4rManager.h"
#include "tiTextInputBase.h"
#ifdef MYTIMANAGER_IMPLEMENTATION
@@ -179,4 +183,5 @@ namespace textinput {
} // namespace textinput
#endif
#endif // TEXTINPUT_HW_KEYBOARD_H

View File

@@ -0,0 +1,311 @@
#ifndef TEXTINPUT_PC_KEYBOARD_IMPL_H
#define TEXTINPUT_PC_KEYBOARD_IMPL_H
#include "tiKeyboard.h"
#include "tiNw4rManager.h"
#include "tiPkData.h"
namespace textinput {
class Manager;
namespace predictlang {
class LayoutByNW4R;
}
namespace keyboard {
namespace signwindow {
class LayoutByNW4R;
}
}
namespace keyboard {
namespace signwindow {
class Base : public KeyboardBase {
public:
virtual bool isLocked();
virtual void setPage(u8 page);
virtual u8 getPage();
virtual void movePrevSignPage();
virtual void moveNextSignPage();
virtual void close();
};
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public nw4rmanager::AnmObserver {
public:
virtual void draw();
virtual void open(KeyboardBase* keyboard, bool repeat);
virtual bool isActive();
};
}
namespace pctype {
struct GridKey {
char paneName[18];
wchar_t codes[4];
};
struct ControlKey {
char paneName[20];
u32 key;
};
struct VisiblePanes {
u16 visibleCount;
u16 hiddenCount;
const char* visible[24];
const char* hidden[24];
};
struct Ablaut {
wchar_t code;
wchar_t alternatives[7];
};
struct LanguageData {
const PaneNameToCharCodeWithModeAscii* ascii;
const GridKey* grid;
const ControlKey* controls;
const VisiblePanes* panes;
const Ablaut* ablaut;
};
class Base : public KeyboardBase {
public:
enum TranslateMode {
TM_Direct,
TM_Roman,
TM_Kana
};
enum InputMode {
IM_Direct,
IM_01,
IM_02,
IM_03,
IM_04,
IM_05,
IM_Hiragana,
IM_Katakana
};
enum InputType {
IT_00,
IT_01,
IT_02,
IT_03,
IT_04
};
struct State {
bool rejected;
u8 inputFlags[7];
};
class KeyState {
public:
void refresh_();
void refreshText(nw4r::lyt::Pane* root);
void setABCFlag(u32 flags);
wchar_t getWCCode(u32 index);
wchar_t getWCCode(char* paneName);
void setABCMode(u32 mode) {
if ((abcFlags & 15) != mode) {
abcFlags = (abcFlags & ~15) | (mode & 15);
refresh_();
}
}
void setAIUMode(u32 mode) {
if ((aiuFlags & 15) != mode) {
aiuFlags = (aiuFlags & ~15) | (mode & 15);
refresh_();
}
}
u32 abcFlags;
u32 inputType;
u32 aiuFlags;
Language language;
const LanguageData* data;
Base* owner;
};
virtual ~Base();
virtual void create(MEMAllocator* allocator);
virtual void init();
virtual void updateFromReceiver(u32 command, void* data);
virtual void onKey(u32 event, void* data);
virtual int getType();
virtual void setLanguage(Language language);
virtual void onActive();
virtual void inputCharCode(wchar_t code);
virtual State* getState();
virtual bool isShiftOn() const;
virtual bool isCapsOn() const;
virtual bool isABC();
virtual void setABC(bool abc);
virtual InputMode getABCInputMode() const;
virtual InputMode getAIUInputMode() const;
virtual TranslateMode getTranslateMode() const;
virtual void setTranslateMode(TranslateMode mode);
virtual void onlyQwerty(bool only);
virtual void setLangKeyActive(bool active);
virtual void setInputModeJP(bool, u32, u32);
virtual void setInputModeCK(u32);
virtual void refreshState();
virtual void changeABCInputMode(InputMode mode);
virtual void changeAIUInputMode(InputMode mode);
virtual void onClose();
virtual wchar_t getWCCode(char* paneName);
virtual u32 getControlKey(char* paneName);
virtual void sendInputWChar(wchar_t code, bool repeat);
virtual void goSignInputMode();
virtual void changePredictLanguage();
virtual void updateFixMode();
protected:
State mState;
const LanguageData* mpInitialLanguageData;
KeyState mKeyState;
MEMAllocator* mpAllocator;
bool mbOnlyQwerty;
bool mbLanguageKeyActive;
Manager* mpManager;
};
class LayoutByNW4R;
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);
};
class UIObj : public gui::EventHandler {
public:
class Listener {
public:
virtual void onEvent(UIObj*, u32, void*) = 0;
};
UIObj(u32 id, LayoutByNW4R* layout, Listener* listener) : mId(id), mpLayout(layout), mpListener(listener) {}
virtual ~UIObj();
virtual void onEvent(gui::GUIComponent& component, u32 event, void* data);
virtual void onGUIEvent(gui::PaneComponent& component, u32 event, nw4rmanager::TiEventHandler::Input* input);
protected:
u32 mId;
LayoutByNW4R* mpLayout;
Listener* mpListener;
};
class UIModifierButton : public UIObj {
public:
UIModifierButton(u32 id, LayoutByNW4R* layout, Listener* listener);
virtual ~UIModifierButton();
virtual void onGUIEvent(gui::PaneComponent& component, u32 event, nw4rmanager::TiEventHandler::Input* input);
gui::PaneComponent* mpPaneComponent;
gui::PaneComponent* mpBoundingComponent;
AnmPane* mpAnimation;
bool mbOn;
};
class UIModePanel : public UIObj {
public:
UIModePanel(u32 id, LayoutByNW4R* layout, Listener* listener);
virtual ~UIModePanel();
virtual void onGUIEvent(gui::PaneComponent& component, u32 event, nw4rmanager::TiEventHandler::Input* input);
void Create(nw4rmanager::Layout* layout);
u32 mMode;
gui::PaneComponent* mpPaneComponents[5];
gui::PaneComponent* mpBoundingComponents[5];
AnmPane* mpAnimations[5];
nw4r::lyt::Pane* mpEnglishText;
nw4r::lyt::Pane* mpHangulText;
nw4r::lyt::Pane* mpModeSelect;
GXTexObj mDirectTexture;
GXTexObj mPinyinTexture;
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();
virtual void create(MEMAllocator* allocator);
virtual void init();
virtual void updateFromReceiver(u32 command, void* data);
virtual void onKey(u32 event, void* data);
virtual void setLanguage(Language language);
virtual void onActive();
virtual void inputCharCode(wchar_t code);
virtual void setABC(bool abc);
virtual void setTranslateMode(TranslateMode mode);
virtual void onlyQwerty(bool only);
virtual void setLangKeyActive(bool active);
virtual void setInputModeJP(bool abc, u32 abcMode, u32 aiuMode);
virtual void setInputModeCK(u32 mode);
virtual void refreshState();
virtual void onClose();
virtual void sendInputWChar(wchar_t code, bool repeat);
virtual void goSignInputMode();
virtual void changePredictLanguage();
virtual void draw();
virtual void calc();
virtual void setPredictLanguageDialog(predictlang::LayoutByNW4R* dialog);
virtual void setSignWindow(signwindow::LayoutByNW4R* window);
virtual void setLineFeedButton(bool visible);
virtual void setPredictLanguageButton(bool visible);
virtual void setSignWindowButton(bool visible);
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data);
virtual bool updateInput(input::HKBManager& hkb);
virtual void changeAnimationAllToNormal();
virtual void throwReleaseForAll();
virtual void cancelStateFocusIn();
virtual void updatePredictLanguage(CommandReceiver::ChangePredictMode* mode);
virtual void updateDakuten();
virtual void initLayout();
virtual void onEvent(UIObj* object, u32 event, void* data);
void onPressedCaps();
void onPressedShift(bool shift);
void onReleasedShift();
void createAnmPane_(MEMAllocator* allocator);
private:
EventHandler* mpKeyboardEventHandler;
predictlang::LayoutByNW4R* mpPredictDialog;
signwindow::LayoutByNW4R* mpSignWindow;
bool mbLineFeed;
UIModifierButton mShiftButton;
UIModifierButton mCapsButton;
UIModePanel mModePanel;
};
}
}
}
#endif

View File

@@ -62,6 +62,9 @@ namespace textinput {
INPUT_COMMAND_37 = 37,
} INPUT_COMMAND;
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
struct ChangePredictMode { u32 mode; bool enabled; };
#endif
virtual void clearSender();
virtual void onCommand(INPUT_COMMAND command, void* data);
virtual void addSender(CommandSender* cmdSend);
@@ -75,7 +78,13 @@ namespace textinput {
CommandSender() : mpCommandReceiver(NULL) {}
virtual void setCommandReceiver(CommandReceiver* cmdRecv);
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual void sendCommand(u32 command, void* data) {
if (mpCommandReceiver != NULL) mpCommandReceiver->onCommand(static_cast<CommandReceiver::INPUT_COMMAND>(command), data);
}
#else
virtual void sendCommand(u32, void*);
#endif
virtual void updateFromReceiver(u32, void*) {}
nw4r::ut::Link mLink; // 0x00

View File

@@ -150,7 +150,11 @@ typedef struct DVDErrorInfo {
void DVDInit();
BOOL DVDReadAbsAsyncPrio(DVDCommandBlock* block, void* addr, s32 length, u32 offset, DVDCommandCallback callback, s32 prio);
#ifdef BS2_MACH_FIVE_ARG_READ
BOOL DVDReadAbsAsyncForBS(DVDCommandBlock* block, void* addr, s32 length, u32 offset, DVDCommandCallback callback);
#else
BOOL DVDReadAbsAsyncForBS(DVDCommandBlock* block, void* addr, s32 length, u32 offset, DVDCommandCallback callback, s32 prio);
#endif
BOOL DVDReadDiskID(DVDCommandBlock* block, DVDDiskID* diskID, DVDCommandCallback callback);
BOOL DVDCompareDiskID(const DVDDiskID* id1, const DVDDiskID* id2);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -81,6 +81,11 @@ extern "C" void iplSDChannelTitle_813E88CC(SDChannelTitle* scene, bool settings)
extern "C" void iplSDChannelTitle_813E8A20(SDChannelTitle* scene, int nextScene);
extern "C" SDMemory::TitleRange* iplSDChannelTitle_813E6FA0(SDMemory::TitleRange*, const SDMemory::TitleRange*);
static inline void setMemoryTitleLists(SDMemory* memory, SDMemory::TitleRange sdRange,
SDMemory::TitleRange nandRange) {
memory->setTitleLists(sdRange, nandRange);
}
static const int sCaptureSizes[2][2] = {{128, 96}, {176, 96}};
static const char* sButtonGroups[7] = {
@@ -760,7 +765,7 @@ extern "C" void iplSDChannelTitle_813E6E24(SDChannelTitle* scene) {
iplSDChannelTitle_813E6FA0(&nandRange, iplSDChannelTitle_813E6FA0(&sdRange, &scene->mTitleRange));
}
SDMemory* memory = &scene->mMemory;
memory->setTitleLists(SDMemory::TitleRange(sdRange), SDMemory::TitleRange(nandRange));
setMemoryTitleLists(memory, sdRange, nandRange);
scene->mMemory.calc();
scene->mbResetAcceptable = true;
System::getHomeButtonMenu()->enable();

View File

@@ -0,0 +1,171 @@
# BS2Mach attempts
Baseline: 16/29 instruction-exact functions, code 2500/16980 bytes,
data 155472/158528 bytes. The fresh branch baseline gate passes.
Only this unit is changed. No linking changes are made.
The assembly and the existing object decompiler exports under /tmp were read.
Older /tmp source candidates were used as reference and audited before adapting
individual bodies. Their assembly, force_active pragmas, register qualifiers,
volatile additions, packed string blobs, and raw structure offsets are excluded.
## Object-order implementation, first pass
- Run: C cache-block zero/flush loop followed by the entry call. The original
clears nearly all GPRs, replaces the stack, and branches through LR. C cannot
express that register contract. The report gives no function score.
- BS2ESGetTicketViews: separate aligned title/count buffers produced 72/71
instructions and a 0x180 frame versus 0x160. A single 256-byte IPC workspace
with typed title/count arrays and boolean null checks gives 71/71, diffs 0.
- BS2Reboot: ordinary aligned ticket, IOS workspace, state flags and vectors
initially gave 137/137, eight stack-offset diffs. Reordering descriptor and
count declarations gives 137/137, diffs 0. No fabricated padding is used.
- BS2StartGame: implemented boot-cache close, state flags, IOS launch, DVD
reopen, and loader handoff. First score 96.48855%. Target contains sync/isync
and polls callback results; no new assembly or volatile was introduced.
- BS2StartGCGame: implemented configuration, SRAM fields, clock and MIOS launch.
First score 95.26755%.
- CheckDVDCommandStatus: original switch/state transitions, 102/102, diffs 0.
- BS2NANDDivideCallback: transfer accounting before buffer advance, separate
full/final chunk branches, first score 85.03906%.
- BS2NANDDivideReadAsync: original request setup and chunk branches with ordinary
globals, first score 60.31915%, 45/47 instructions. Compiler removes reloads.
- BS2NANDDivideWriteAsync: corresponding write setup, first score 60.31915%.
- CheckBS2CommandStatus: cache-writing state switch, first score 79.655174%.
- BS2InquiryAsync: boot-cache/DVD unencrypted read branches, instruction-exact.
- BS2ReadDiskID: boot-cache/DVD read branches, instruction-exact.
- BS2Tick: implementation pending at this checkpoint.
String pool: the first 56 strings are identical in order; the remaining 35
orig strings belong to BS2Tick. Checkpoint: 21/29 exact, code 4052/16980,
zero regressions, zero forbidden additions, zero readability warnings.
## Complete state machine and data review
BS2Tick was implemented last, preserving object order. All 91 ordinary string
literals now occur in the original order and at the original .data offsets.
A separate offset comparison found zero differences across all 91 strings.
The small writable GameCube language mapping, /dev/es and disc prefixes produce
an instruction-independent .sdata match of 32/32 bytes. The larger .data section
still has no objdiff match score; strings alone do not establish a data match.
Semantic review corrected the cover command block reset, replaced an unsafe
four-byte memset of separate char locals with a four-byte title array, used
DVDFileInfo fields for banner position/length, and changed the newly implemented
loader code to use the target's __DVDLayoutFormat rather than BS2LastMode.
All partition/TMD/SRAM field accesses use their existing structure definitions.
The allocation rounds down then adds one cache line to select the next aligned
banner address, as the target does. This is buffer alignment, not data padding.
The ES stack workspace follows the SDK's 256-byte IPC work-area convention.
It holds typed aligned title and count buffers. The reboot launch workspace is
also the SDK's 256-byte IPC workspace. No objects were added to move .data.
The SDK declaration of DVDReadAbsAsyncForBS has a sixth priority parameter,
but the implementation ignores it and this IPL object passes five arguments.
BS2_MACH_FIVE_ARG_READ is defined only by BS2Mach.c and guards the declaration
in the shared header. Other units keep their original declaration and output.
The NAND callback now declares its real second callback parameter. Passing NULL
on direct error notifications restores the missing r4 argument setup without
changing the already exact callback body.
## Remaining-function attempt coverage
Every remaining function has at least three distinct source-level attempts.
Percentages are advisory objdiff scores from the quick gates; none is called an
exact match. Final instruction counts come from fresh ctxdiff calls.
### Run
1. Per-block do/while DCZeroRange/DCFlushRange, then entry call: 28/43
instructions; objdiff reports None.
2. Counted for loop over cache blocks: objdiff 0.88372093%; register clearing,
stack replacement and LR handoff are still absent.
3. Bulk cache zero/flush followed by entry: 25/43 instructions, score None.
Retained the per-block form to preserve the target's cache-operation order.
The GPR-clearing trampoline cannot be expressed as ordinary portable C.
### BS2StartGame
1. Target-shaped nested error branches with empty polling loops: 96.48855%,
387/393 instructions. The compiler hoists reads out of unqualified polls.
2. Switch dispatch for disk/partition results: 94.18575%, 396/393 instructions.
3. Restored nested branches, used DVDGetCommandBlockStatus for the cover wait
and interrupt synchronization in low-level callback waits: 93.178116%,
406/393 instructions. This keeps polling functional without new volatile.
Compiler __sync/__isync intrinsics restore the real loader barriers without
adding asm functions or blocks. Final NAND callback ABI correction gives
95.496185%, 401/393. Calls and register scheduling still differ.
### BS2StartGCGame
1. Configuration/SRAM/MIOS implementation: 95.26755%, 228/228 instructions.
2. Reverse multiplication operands and pass the MIOS title as a real 64-bit
vararg, rather than unrelated 32-bit arguments: 95.4386%, 227/228.
3. Separate seconds/timerFrequency locals and use the DVD status API for the
cover wait: 98.11404%, 227/228. Retained this functional form. Differences
include the polling call, the target's additional MMIO read, and scheduling.
### BS2NANDDivideCallback
1. Update transferred count, advance buffer, and retain separate full/final
chunk paths: 85.03906%.
2. Cache the remaining length in a local shared across the paths: 70.859375%,
119/128. This changes allocation and removes more of the target's reloads.
3. Use typed file/buffer/completion globals and advance buffer before account
update: 85.0%. Final form retains the typed state but restores accounting
before buffer advance: 85.03906%, 119/128. Nine target instructions remain
missing, chiefly global reloads and callback setup ordering.
### BS2NANDDivideReadAsync
1. Original request setup order plus a total-length temporary: 60.31915%,
45/47. Two target reload instructions are absent.
2. Compare the stored total directly, removing the temporary: 60.31915%,
45/47. No improvement; optimizer produces the same sequence.
3. Typed request globals and file/buffer/length-first initialization:
60.29787%, 45/47. Retained readable typed state. Reloads and register/setup
order remain different.
### BS2NANDDivideWriteAsync
1. Original write setup plus total-length temporary: 60.31915%, 45/47.
2. Direct stored-length comparison: 60.31915%, 45/47; no instruction change.
3. Typed globals and file/buffer/length-first initialization: 60.29787%,
45/47. Same missing reloads and initialization scheduling as the read path.
### CheckBS2CommandStatus
1. Per-state cache write paths with shared result/exit: 79.655174%, 382/406.
2. Direct returns instead of shared goto exit: 79.655174%, 382/406. No change.
3. Compute the partition chunk length once from DVDGameTOC fields:
78.94089%. Final correct two-argument NAND callback notifications yield
80.133%, 387/406. Target retains repeated cache-length reloads, and setup
scheduling remains different. No volatile was added to manufacture them.
### BS2Tick
1. Complete switch in source-token order, typed fields and signed time checks:
74.99381%, 1896/1940. All 91 string contents match.
2. Four-byte title array, real partition iteration, correct layout global and
cover-block reset: 75.79124%, 1904/1940. All string offsets also match.
3. Region dispatch as readable switches and a forward ticket-byte scan:
75.50567%, 1906/1940. Retained the simpler switches and typed scan. Final
callback ABI/state cleanup gives 74.78608%, 1905/1940. Register allocation,
branch scheduling, and remaining reloads differ across many states.
## Fresh exact-function verification
- BS2ESGetTicketViews: 71/71 instructions, diffs 0.
- BS2Reboot: 137/137 instructions, diffs 0.
- CheckDVDCommandStatus: 102/102 instructions, diffs 0.
- BS2InquiryAsync: 39/39 instructions, diffs 0.
- BS2ReadDiskID: 39/39 instructions, diffs 0.
The original 16 exact functions remain exact. Final quick gate: 21/29 exact,
4052/16980 code bytes, 155504/158528 data bytes, zero regressions, zero forbidden
additions and zero readability warnings. The unit remains NonMatching.
Final full, non-quick gate: GATE PASS. Full build succeeds, main.dol SHA1 is
26116613f624061ba99c8d1a299aaa6efa85670d, regressions 0, forbidden additions 0,
readability warnings 0. No function or unit is claimed complete below 100%.

View File

@@ -8,7 +8,7 @@ The default gate baseline `70970038` is absent from this checkout. Checks use th
available ancestor `e265d9664e73912f2dbf8dd02425f9dc64eac55b` through the gate's
supported `--base` option. Its unit baseline is zero instruction-exact functions.
## Remaining functions
## Initial remaining functions
| Function | Distinct source attempts | Final instruction evidence |
| --- | --- | --- |
@@ -55,3 +55,28 @@ no artificial data or force-active workaround was added.
The two notice APIs declare an ignored controller argument that the target callers do
not initialize. The source supplies zero rather than depending on an uninitialized value.
The title-range output pointer is passed as the fourth channel-notice argument.
## Continuation from merged main
Starting main: `fcb5be85f76b17b4341b6868b768f22ded14f8e7`.
Its gate baseline became available during this continuation, so the final check uses
ordinary `origin/main`, with 63/69 exact functions and 17064/18624 matched code bytes.
`813E6E24` now has 95/95 instructions and zero differences. An inline helper takes
both title ranges by value, preserving the copies while evaluating the memory receiver
before their loads. This changes no other translation unit and adds no out-of-line helper.
The string pool remains identical.
Fresh attempts for every function still open:
| Function | Attempt 1 | Attempt 2 | Attempt 3 | Retained result |
| --- | --- | --- | --- | --- |
| `813E8A20` | Cached save manager through the flush: 36/37 instructions, missing reload. | Named previous-page reference: 37/37, same six differences. | Read save heap before the page store: 37/37, reordered loads and six differences. | Original 37/37, six register/load-order differences. Also tried guarded direct field access and an inline save-page helper; neither improved it. |
| `calcFadein` | Scoped inline SDButton method body: 51/47, virtual call expanded. | Scoped inline body with NO_INLINE: 48/47, null callback argument remains. | Scoped inline body using a named gui-manager receiver: 51/47, same expanded virtual call. | Original 48/47; all header trials reverted. |
| `initCalcFadeout` | Scoped inline SDButton method body: 52/49, virtual call expanded. | Scoped inline body with NO_INLINE: 50/49, null callback argument remains. | Scoped inline body using a named gui-manager receiver: 52/49, same expanded virtual call. | Original 50/49; all header trials reverted. |
| `813E6CCC` | Inline notice wrapper with title ID and range parameters: 87/86, unchanged call setup. | Title-ID union with named words: 91/86, extra stores and loads. | Named enqueue result and failure early return: 87/86, result branches also differed. | Original 87/86; extra ignored-controller initialization and argument setup differences. |
| `813E7074` | Inline notice wrapper with title ID and state parameters: 77/76, unchanged. | Title-ID union with named words: 77/76, worse register and stack allocation. | Named enqueue result and failure early return: 77/76, result branches also differed. | Original 77/76; extra ignored-controller initialization and argument move order. |
All unsuccessful source and shared-header trials were reverted. The retained source
change is the by-value range helper and its call. The unit remains NonMatching because
five functions still differ; the condition for trying a Matching link has not been reached.

View File

@@ -0,0 +1,216 @@
# PC keyboard attempts
Target: 43U, src/keyboard/tiPcKeyboard. Initial baseline: no source, 0 instruction-exact functions, 0 code/data bytes.
All trials below rebuild only this object. The retained source uses ordinary literals; shared declarations are guarded by TI_PC_KEYBOARD_IMPLEMENTATION. NonMatching remains unchanged.
## textinput::keyboard::pctype::Base::onActive()
Initial: objdiff 82.42857, instructions (133, 119), differing positions 73.
1. use a named KeyState reference: objdiff 82.42857, instructions (133, 119), differing positions 73, pool identical; reverted.
2. separate local declarations and assignments: objdiff 82.42857, instructions (133, 119), differing positions 73, pool identical; reverted.
3. reverse the first if/else direction and exchange its bodies: objdiff 72.27731, instructions (133, 119), differing positions 90, pool identical; reverted.
## textinput::keyboard::pctype::Base::getWCCode(char*)
Initial: objdiff None, instructions (56, 2), differing positions 56.
1. use a named KeyState reference: objdiff None, instructions (56, 2), differing positions 56, pool identical; reverted.
2. hold the returned character in a named local: objdiff None, instructions (56, 2), differing positions 56, pool identical; reverted.
3. use a named KeyState pointer: objdiff None, instructions (56, 2), differing positions 56, pool identical; reverted.
## textinput::keyboard::pctype::Base::getControlKey(char*)
Initial: objdiff 93.333336, instructions (36, 36), differing positions 8.
1. use a named KeyState reference: objdiff 93.333336, instructions (36, 36), differing positions 8, pool identical; reverted.
2. rewrite the first for loop as while with explicit update: objdiff 93.333336, instructions (36, 36), differing positions 8, pool identical; reverted.
3. use a named KeyState pointer: objdiff 93.333336, instructions (36, 36), differing positions 8, pool identical; reverted.
## textinput::keyboard::pctype::Base::sendInputWChar(wchar_t, bool)
Initial: objdiff 98.24074, instructions (107, 108), differing positions 104.
1. use a named KeyState reference: objdiff 94.75, instructions (108, 108), differing positions 26, pool identical; reverted.
2. separate local declarations and assignments: objdiff 98.24074, instructions (107, 108), differing positions 104, pool identical; reverted.
3. use a named KeyState pointer: objdiff 94.75, instructions (108, 108), differing positions 26, pool identical; reverted.
## textinput::keyboard::pctype::Base::updateFixMode()
Initial: objdiff 98.166664, instructions (59, 60), differing positions 32.
1. use a named KeyState reference: objdiff 98.166664, instructions (59, 60), differing positions 32, pool identical; reverted.
2. separate local declarations and assignments: objdiff 98.166664, instructions (59, 60), differing positions 32, pool identical; reverted.
3. use a named KeyState pointer: objdiff 98.166664, instructions (59, 60), differing positions 32, pool identical; reverted.
## textinput::keyboard::pctype::Base::setTranslateMode(textinput::keyboard::pctype::Base::TranslateMode)
Initial: objdiff 98.0, instructions (107, 105), differing positions 89.
1. use a named KeyState reference: objdiff 93.190475, instructions (110, 105), differing positions 103, pool identical; reverted.
2. separate local declarations and assignments: objdiff 98.0, instructions (107, 105), differing positions 89, pool identical; reverted.
3. use a named KeyState pointer: objdiff 93.190475, instructions (110, 105), differing positions 103, pool identical; reverted.
## textinput::keyboard::pctype::Base::KeyState::refresh_()
Initial: objdiff 98.77095, instructions (177, 179), differing positions 152.
1. access members through a named owner pointer: objdiff 98.77095, instructions (177, 179), differing positions 152, pool identical; reverted.
2. reverse the first if/else direction and exchange its bodies: objdiff 84.03911, instructions (177, 179), differing positions 152, pool identical; reverted.
3. hold the switch selector in a named signed local: objdiff 98.77095, instructions (177, 179), differing positions 152, pool identical; reverted.
## textinput::keyboard::pctype::Base::KeyState::refreshText(nw4r::lyt::Pane*)
Initial: objdiff 90.46154, instructions (170, 169), differing positions 107.
1. access members through a named owner pointer: objdiff 90.46154, instructions (170, 169), differing positions 107, pool identical; reverted.
2. rewrite the first for loop as while with explicit update: objdiff 90.46154, instructions (170, 169), differing positions 107, pool identical; reverted.
3. use a 32-bit unsigned loop index: objdiff 83.83432, instructions (170, 169), differing positions 160, pool identical; reverted.
## textinput::keyboard::pctype::Base::KeyState::getWCCode(unsigned long)
Initial: objdiff 98.8, instructions (124, 125), differing positions 109.
1. access members through a named owner pointer: objdiff 98.8, instructions (124, 125), differing positions 109, pool identical; reverted.
2. separate local declarations and assignments: objdiff 98.8, instructions (124, 125), differing positions 109, pool identical; reverted.
3. hold the returned character in a named local: compiler rejected the variant; retained original.
## textinput::keyboard::pctype::Base::KeyState::getWCCode(char*)
Initial: objdiff 96.14035, instructions (56, 57), differing positions 18.
1. access members through a named owner pointer: objdiff 96.14035, instructions (56, 57), differing positions 18, pool identical; reverted.
2. separate local declarations and assignments: objdiff 96.14035, instructions (56, 57), differing positions 18, pool identical; reverted.
3. rewrite the first for loop as while with explicit update: objdiff 96.14035, instructions (56, 57), differing positions 18, pool identical; reverted.
## textinput::keyboard::pctype::LayoutByNW4R::create(MEMAllocator*)
Initial: objdiff 87.49367, instructions (151, 158), differing positions 106.
1. use a named KeyState reference: objdiff 87.49367, instructions (151, 158), differing positions 106, pool identical; reverted.
2. separate local declarations and assignments: objdiff 87.49367, instructions (151, 158), differing positions 106, pool identical; reverted.
3. use a named KeyState pointer: objdiff 87.49367, instructions (151, 158), differing positions 106, pool identical; reverted.
## textinput::keyboard::pctype::LayoutByNW4R::createAnmPane_(MEMAllocator*)
Initial: objdiff 98.515625, instructions (192, 192), differing positions 55.
1. access members through a named owner pointer: objdiff 98.515625, instructions (192, 192), differing positions 55, pool identical; reverted.
2. separate local declarations and assignments: objdiff 98.515625, instructions (192, 192), differing positions 55, pool identical; reverted.
3. rewrite the first for loop as while with explicit update: objdiff 98.515625, instructions (192, 192), differing positions 55, pool identical; reverted.
## textinput::keyboard::pctype::LayoutByNW4R::init()
Initial: objdiff 75.89773, instructions (280, 352), differing positions 336.
1. access members through a named owner pointer: objdiff 75.89773, instructions (280, 352), differing positions 336, pool identical; reverted.
2. use a 32-bit unsigned loop index: objdiff 72.02841, instructions (275, 352), differing positions 347, pool identical; reverted.
3. express a conditional call with a short circuit expression: compiler rejected the variant; retained original.
## textinput::keyboard::pctype::LayoutByNW4R::initLayout()
Initial: objdiff 99.71429, instructions (384, 385), differing positions 66.
1. use a named KeyState reference: objdiff 99.71429, instructions (384, 385), differing positions 66, pool identical; reverted.
2. reverse the first if/else direction and exchange its bodies: objdiff 99.69091, instructions (384, 385), differing positions 71, pool identical; reverted.
3. use a named KeyState pointer: objdiff 99.71429, instructions (384, 385), differing positions 66, pool identical; reverted.
## textinput::keyboard::pctype::LayoutByNW4R::onPressedShift(bool)
Initial: objdiff 90.81633, instructions (45, 49), differing positions 42.
1. use a named KeyState reference: objdiff 90.81633, instructions (45, 49), differing positions 42, pool identical; reverted.
2. use a named KeyState pointer: objdiff 90.81633, instructions (45, 49), differing positions 42, pool identical; reverted.
3. access state through a named Base view: compiler rejected the variant; retained original.
## textinput::keyboard::pctype::LayoutByNW4R::onReleasedShift()
Initial: objdiff 89.871796, instructions (38, 39), differing positions 36.
1. use a named KeyState reference: objdiff 89.871796, instructions (38, 39), differing positions 36, pool identical; reverted.
2. use a named KeyState pointer: objdiff 89.871796, instructions (38, 39), differing positions 36, pool identical; reverted.
3. access state through a named Base view: compiler rejected the variant; retained original.
## textinput::keyboard::pctype::LayoutByNW4R::onKey(unsigned long, void*)
Initial: objdiff 66.72967, instructions (341, 418), differing positions 373.
1. use a named KeyState reference: objdiff 63.64593, instructions (338, 418), differing positions 408, pool identical; reverted.
2. use a named KeyState pointer: objdiff 63.64593, instructions (338, 418), differing positions 408, pool identical; reverted.
3. hold the switch selector in a named signed local: objdiff 66.72967, instructions (341, 418), differing positions 373, pool identical; reverted.
## textinput::keyboard::pctype::LayoutByNW4R::updateFromReceiver(unsigned long, void*)
Initial: objdiff 94.51613, instructions (30, 31), differing positions 16.
## textinput::keyboard::pctype::LayoutByNW4R::cancelStateFocusIn()
Initial: objdiff 60.854168, instructions (144, 144), differing positions 69.
1. access members through a named owner pointer: objdiff 60.854168, instructions (144, 144), differing positions 69, pool identical; reverted.
2. rewrite the first for loop as while with explicit update: objdiff 60.854168, instructions (144, 144), differing positions 69, pool identical; reverted.
3. hold the switch selector in a named signed local: objdiff 60.854168, instructions (144, 144), differing positions 69, pool identical; reverted.
## textinput::keyboard::pctype::LayoutByNW4R::sendInputWChar(wchar_t, bool)
Initial: objdiff 93.97727, instructions (42, 44), differing positions 35.
1. use a named KeyState reference: objdiff 93.97727, instructions (42, 44), differing positions 35, pool identical; reverted.
2. separate local declarations and assignments: objdiff 93.97727, instructions (42, 44), differing positions 35, pool identical; reverted.
3. use a named KeyState pointer: objdiff 93.97727, instructions (42, 44), differing positions 35, pool identical; reverted.
## textinput::keyboard::pctype::LayoutByNW4R::setInputModeJP(bool, unsigned long, unsigned long)
Initial: objdiff 86.92208, instructions (69, 77), differing positions 36.
1. use a named KeyState reference: objdiff 79.96104, instructions (72, 77), differing positions 71, pool identical; reverted.
2. use a named KeyState pointer: objdiff 79.96104, instructions (72, 77), differing positions 71, pool identical; reverted.
3. hold the switch selector in a named signed local: objdiff 86.92208, instructions (69, 77), differing positions 36, pool identical; reverted.
## textinput::keyboard::pctype::LayoutByNW4R::updateInput(int, float, float, unsigned long, unsigned long, unsigned long, void*)
Initial: objdiff 60.17143, instructions (135, 140), differing positions 101.
1. separate local declarations and assignments: objdiff 60.17143, instructions (135, 140), differing positions 101, pool identical; reverted.
2. reverse the first if/else direction and exchange its bodies: objdiff 95.25, instructions (135, 140), differing positions 92, pool identical; retained.
3. express a conditional call with a short circuit expression: objdiff 88.96429, instructions (140, 140), differing positions 59, pool identical; reverted.
## textinput::keyboard::pctype::LayoutByNW4R::updateInput(textinput::input::HKBManager&)
Initial: objdiff 84.687225, instructions (237, 227), differing positions 219.
1. access members through a named owner pointer: objdiff 84.687225, instructions (237, 227), differing positions 219, pool identical; reverted.
2. separate local declarations and assignments: objdiff 84.687225, instructions (237, 227), differing positions 219, pool identical; reverted.
3. reverse the first if/else direction and exchange its bodies: objdiff 74.48458, instructions (237, 227), differing positions 219, pool identical; reverted.
## textinput::keyboard::pctype::EventHandler::onTiEvent(textinput::gui::PaneComponent*, unsigned long, textinput::nw4rmanager::TiEventHandler::Input*)
Initial: objdiff 88.83249, instructions (196, 197), differing positions 176.
1. access members through a named owner pointer: objdiff 88.83249, instructions (196, 197), differing positions 176, pool identical; reverted.
2. separate local declarations and assignments: objdiff 88.83249, instructions (196, 197), differing positions 176, pool identical; reverted.
3. hold the switch selector in a named signed local: objdiff 88.83249, instructions (196, 197), differing positions 176, pool identical; reverted.
## @236@onEvent__Q49textinput8keyboard6pctype12LayoutByNW4RFPQ49textinput8keyboard6pctype5
The extracted target thunk name is truncated; MWCC emits the complete canonical C++ name. Symbol metadata was left unchanged.
1. early return for unrelated events: objdiff None, canonical thunk instructions 2/2, differing positions 0; target name remains absent. Reverted.
2. signed switch for listener events: objdiff None, canonical thunk instructions 2/2, differing positions 0; target name remains absent. Reverted.
3. named sound identifier before dispatch: objdiff None, canonical thunk instructions 2/2, differing positions 0; target name remains absent. Reverted.
Additional trial for textinput::keyboard::pctype::Base::KeyState::getWCCode(unsigned long): copy the final mapped character into a distinct return local; objdiff 98.8, instructions (124, 125), differing positions 109; reverted.
Additional trial for textinput::keyboard::pctype::LayoutByNW4R::init(): use mutable local vectors for the mode-selector positions; objdiff 75.89773, instructions (280, 352), differing positions 336; reverted.
## Final evidence
Clean full gate: GATE PASS. DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d. Regressions, forbidden additions, readability warnings: 0. Pool: 204/204 identical.
Instruction-exact 0 -> 120/141; objdiff code 0 -> 16240/28484; data 0 -> 5964/18564. .rodata: 100%; unit remains NonMatching.
Additional retained refinements: merge address-taken boolean command values in Base::onActive using typed single-field command structs (119/119 instructions, diffs 0); use signed switch dispatch in updateFromReceiver and updateFixMode (31/31 and 60/60, diffs 0); restore cancelStateFocusIn switch case order (144/144, diffs 0); restore normal/shift/toggle/onoff creation order (192/192, register differences remain); put ordinary Korean lookup tables after animation data (.rodata 100%).
The protected default branch in Base::setTranslateMode returns for invalid enum values. The original appears to use an unset temporary outside 0..2; this implementation deliberately retains defined behavior.
textinput::keyboard::pctype::Base::getWCCode(char*): objdiff None; src 0xe0 base 0x8 insns 56/2 | --- replace mine 0:56 base 0:2 | M 0 stwu r1, -0x20(r1) | M 1 mflr r0
textinput::keyboard::pctype::Base::getControlKey(char*): objdiff 93.333336; src 0x90 base 0x90 insns 36/36 | diffs 8: [4, 5, 10, 12, 15, 21, 24, 25] | 4 M stw r30, 0x18(r1) | B li r31, 0
textinput::keyboard::pctype::Base::sendInputWChar(wchar_t, bool): objdiff 98.24074; src 0x1ac base 0x1b0 insns 107/108 | --- insert mine 4:4 base 4:5 | B 4 li r0, 0 | --- replace mine 10:11 base 11:12
textinput::keyboard::pctype::Base::setTranslateMode(textinput::keyboard::pctype::Base::TranslateMode): objdiff 98.0; src 0x1ac base 0x1a4 insns 107/105 | --- replace mine 13:14 base 13:14 | M 13 b 348 | B 13 b 36
textinput::keyboard::pctype::Base::KeyState::refresh_(): objdiff 98.77095; src 0x2c4 base 0x2cc insns 177/179 | --- replace mine 26:27 base 26:27 | M 26 bgt 48 | B 26 bgt 56
textinput::keyboard::pctype::Base::KeyState::refreshText(nw4r::lyt::Pane*): objdiff 90.46154; src 0x2a8 base 0x2a4 insns 170/169 | --- replace mine 50:52 base 50:51 | M 50 beq 192 | M 51 stw r25, 0xc(r1)
textinput::keyboard::pctype::Base::KeyState::getWCCode(unsigned long): objdiff 98.8; src 0x1f0 base 0x1f4 insns 124/125 | --- replace mine 2:3 base 2:3 | M 2 li r8, 0 | B 2 li r7, 0
textinput::keyboard::pctype::Base::KeyState::getWCCode(char*): objdiff 96.14035; src 0xe0 base 0xe4 insns 56/57 | --- replace mine 34:35 base 34:35 | M 34 beq 48 | B 34 beq 52
textinput::keyboard::pctype::LayoutByNW4R::create(MEMAllocator*): objdiff 87.49367; src 0x25c base 0x278 insns 151/158 | --- replace mine 42:43 base 42:45 | M 42 mr r29, r31 | B 42 mr r26, r31
textinput::keyboard::pctype::LayoutByNW4R::createAnmPane_(MEMAllocator*): objdiff 98.515625; src 0x300 base 0x300 insns 192/192 | diffs 55: [19, 22, 23, 24, 40, 44, 48, 50, 51, 52, 53, 55, 56, 57, 63, 67, 71, 73, 74, 75] | 19 M li r22, 0 | B li r21, 0
textinput::keyboard::pctype::LayoutByNW4R::init(): objdiff 75.89773; src 0x460 base 0x580 insns 280/352 | --- replace mine 0:1 base 0:1 | M 0 stwu r1, -0x40(r1) | B 0 stwu r1, -0x60(r1)
textinput::keyboard::pctype::LayoutByNW4R::initLayout(): objdiff 99.71429; src 0x600 base 0x604 insns 384/385 | --- replace mine 317:318 base 317:318 | M 317 bne 196 | B 317 bne 200
textinput::keyboard::pctype::LayoutByNW4R::onPressedShift(bool): objdiff 90.81633; src 0xb4 base 0xc4 insns 45/49 | --- insert mine 7:7 base 7:8 | B 7 lwz r0, 0x20(r3) | --- replace mine 8:11 base 9:13
textinput::keyboard::pctype::LayoutByNW4R::onReleasedShift(): objdiff 89.871796; src 0x98 base 0x9c insns 38/39 | --- delete mine 3:4 base 3:3 | M 3 li r0, -0x90 | --- replace mine 6:9 base 5:10
textinput::keyboard::pctype::LayoutByNW4R::onKey(unsigned long, void*): objdiff 66.72967; src 0x554 base 0x688 insns 341/418 | --- replace mine 18:19 base 18:19 | M 18 bne 1244 | B 18 bne 1552
textinput::keyboard::pctype::LayoutByNW4R::sendInputWChar(wchar_t, bool): objdiff 93.97727; src 0xa8 base 0xb0 insns 42/44 | --- replace mine 9:10 base 9:11 | M 9 rlwinm. r31, r0, 0x19, 0x1f, 0x1f | B 9 rlwinm. r0, r0, 0, 0x18, 0x18
textinput::keyboard::pctype::LayoutByNW4R::setInputModeJP(bool, unsigned long, unsigned long): objdiff 86.92208; src 0x114 base 0x134 insns 69/77 | --- insert mine 31:31 base 31:34 | B 31 cmpwi r30, 1 | B 32 beq 76
textinput::keyboard::pctype::LayoutByNW4R::updateInput(int, float, float, unsigned long, unsigned long, unsigned long, void*): objdiff 95.25; src 0x21c base 0x230 insns 135/140 | --- replace mine 33:34 base 33:34 | M 33 beq 196 | B 33 beq 212
textinput::keyboard::pctype::LayoutByNW4R::updateInput(textinput::input::HKBManager&): objdiff 84.687225; src 0x3b4 base 0x38c insns 237/227 | --- replace mine 0:1 base 0:1 | M 0 stwu r1, -0x70(r1) | B 0 stwu r1, -0x60(r1)
textinput::keyboard::pctype::EventHandler::onTiEvent(textinput::gui::PaneComponent*, unsigned long, textinput::nw4rmanager::TiEventHandler::Input*): objdiff 88.83249; src 0x310 base 0x314 insns 196/197 | --- replace mine 17:18 base 17:18 | M 17 bne 692 | B 17 bne 696
@236@onEvent__Q49textinput8keyboard6pctype12LayoutByNW4RFPQ49textinput8keyboard6pctype5: objdiff None; target name absent; canonical thunk name differs

View File

@@ -0,0 +1,59 @@
#!/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. "
f"updated {stamp}" + (f" from `{commit}`" if commit else "") + " by the self-hosted progress job",
"",
"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()