Compare commits

..

6 Commits

32 changed files with 8659 additions and 1651 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

@@ -20,6 +20,10 @@ namespace textinput {
virtual void moveNigaoeButton() {}
};
#ifdef MYTIINPUTFORM_IMPLEMENTATION
class ScrollButton;
#endif
class InputForm : public textinput::InputForm {
public:
typedef enum EditMode {
@@ -44,6 +48,25 @@ namespace textinput {
#endif
~InputForm();
#ifdef MYTIINPUTFORM_IMPLEMENTATION
virtual void moveCursorUp();
virtual void moveCursorDown();
virtual void onCommand(INPUT_COMMAND command, void* data);
virtual void create(MEMAllocator* allocator, inputform::EditBuffer* editBuffer);
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data);
virtual bool updateInput(input::HKBManager& hkbManager);
virtual void init();
virtual void draw();
virtual void calc();
virtual void doScroll(Scroll* scroll);
virtual u32 calcCursorPos(f32 x, f32 y);
virtual void drawCursor(f32 x, f32 y);
virtual nw4r::math::VEC2 getScale() const;
virtual void preDraw(u32 pos);
virtual void doLineFeed();
virtual void finishDraw(u32 pos);
virtual bool isInScroll();
#endif
virtual void setScroll(f32 scroll);
virtual void setAddScroll(f32 scroll, bool up, bool down);
@@ -108,7 +131,7 @@ namespace textinput {
void setEditScrollDown(bool editScrollDown) { mbEditScrollUp = editScrollDown; }
void setCloseWithSend(bool closeWithSend) { mbCloseWithSend = closeWithSend; }
#ifdef MYTIMANAGER_IMPLEMENTATION
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION)
void setEditMode(EditMode editMode);
#else
void setEditMode(EditMode editMode) { meEditMode = editMode; }
@@ -125,12 +148,19 @@ namespace textinput {
tistring::Decolated* getSendString() { return mpSendString; }
private:
#ifdef MYTIINPUTFORM_IMPLEMENTATION
nw4r::lyt::Pane* mpMemoPane;
nw4r::lyt::Pane* mpMemoRootPane;
nw4r::lyt::Pane* mpBoundPane;
nw4r::lyt::Pane* mpDrawPane;
#else
#ifdef MYTIMANAGER_IMPLEMENTATION
undefined4* unk_0x308;
#endif
undefined4* unk_0x30C;
undefined4* unk_0x310;
undefined4* unk_0x314;
#endif
f32 mfScroll; // 0x318
f32 mfScrollFrom; // 0x31C
f32 mfScrollTo; // 0x320
@@ -142,7 +172,7 @@ namespace textinput {
nw4r::lyt::Size mDefaultBoundSize; // 0x358
Mtx mDrawMtx; // 0x360
Mtx mBoundMtx; // 0x390
#ifdef MYTIMANAGER_IMPLEMENTATION
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION)
util::Animation mExScrollAnm; // 0x3C0
#else
u8 /*todo*/ mExScrollAnm[32]; // 0x3C0
@@ -156,7 +186,11 @@ namespace textinput {
bool mbEditScrollDown; // 0x3EF
bool mbCloseWithSend; // 0x3F0
u8 padding[3]; // 0x3F1
undefined4* mpScrollButton; // 0x3F4
#ifdef MYTIINPUTFORM_IMPLEMENTATION
ScrollButton* mpScrollButton;
#else
undefined4* mpScrollButton;
#endif
bool mbScrollUp; // 0x3F8
bool mbScrollDown; // 0x3F9
EditMode meEditMode; // 0x3FC

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);
@@ -190,8 +199,19 @@ namespace textinput {
virtual void makeUpCursorPos(CursorPos* cursorPos, u32 pos, s32 startLine, s32 endLine);
#ifdef MYTIINPUTFORM_IMPLEMENTATION
protected:
void setCursorPos(tistring::Decolated* string, u32 pos);
void resetRelation();
void calcCursorTimer();
#else
private:
Rect mRect; // 0x120
#endif
#ifdef MYTIINPUTFORM_IMPLEMENTATION
nw4r::ut::Rect mRect;
#else
Rect mRect;
#endif
nw4r::math::MTX34 mMtx; // 0x130
Destination meDestination; // 0x160
tistring::Decolated* mpString; // 0x164
@@ -264,11 +284,30 @@ namespace textinput {
virtual void visibleSeparator(bool flag);
#ifdef MYTIINPUTFORM_IMPLEMENTATION
protected:
const void* mpLayoutData;
const void* mpLanguageData;
const char* mpFontName;
bool mbUpVisible;
bool mbDownVisible;
bool mbRepeat;
nw4rmanager::TiEventHandler* mpInputEventHandler;
nw4r::ut::ResFont mFont;
int mUpRepeat;
int mDownRepeat;
int mLeftRepeat;
int mRightRepeat;
int mDeleteRepeat;
int mConfirmRepeat;
u32 mRepeatButtons;
#else
private:
#ifdef MYTIMANAGER_IMPLEMENTATION
u8 unk_0x2C0[0x48];
#else
u8 unk_0x2C0[0x4C];
#endif
#endif
};
}

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
@@ -128,6 +146,11 @@ namespace textinput {
class AnimPaneGroup {
public:
#ifdef MYTIINPUTFORM_IMPLEMENTATION
AnimPaneGroup(nw4r::lyt::Group* group) : mpGroup(group) {
nw4r::ut::List_Init(&mAnmPaneList, offsetof(AnmPane, mGroupLink));
}
#endif
virtual void create() {} // 0x08
virtual void init() {} // 0x0C
@@ -181,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];
}
@@ -226,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

@@ -9,7 +9,7 @@
namespace textinput {
namespace textdrawer {
#ifdef MYTIMANAGER_IMPLEMENTATION
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION)
class Base : public nw4r::ut::CharWriter {
#else
class Base : nw4r::ut::CharWriter {
@@ -90,7 +90,14 @@ namespace textinput {
private:
u8 unk_0x50[0x78];
bool mbSecretMode; // 0xC8
#ifdef MYTIINPUTFORM_IMPLEMENTATION
protected:
u8 mDrawState[0x27];
f32 mfDrawScrollY;
u8 mDrawCacheState[0x14];
#else
u8 unk_0xCC[0x3C];
#endif
};
}
}

View File

@@ -50,11 +50,21 @@ namespace textinput {
class CommandSender;
class CommandReceiver : public Base {
public:
#ifdef MYTIINPUTFORM_IMPLEMENTATION
struct Scroll {
bool absY;
f32 x;
f32 y;
};
#endif
typedef enum INPUT_COMMAND {
INPUT_COMMAND_0 = 0,
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);
@@ -68,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

@@ -97,6 +97,10 @@ namespace ipl {
void startLeftEvent(const char* paneName);
bool isActive() const;
#ifdef IPL_SD_CHANNEL_TITLE_CPP
bool isLeftArrowVisible() const { return mbArrowVisible[ARROW_BTN_LEFT]; }
static const char* getButtonName(int button) { return smButtonName[button]; }
#endif
#ifdef IPL_SD_CHANNEL_SELECT_CPP
void setEventHandler(::gui::EventHandler * event,

View File

@@ -39,7 +39,11 @@ namespace ipl {
void hideLeftArrow();
void hideRightArrow();
#ifdef IPL_SD_CHANNEL_TITLE_CPP
public:
#else
private:
#endif
s32 updateState();
void drawTransferTitles();
void onDialogState0();
@@ -149,8 +153,10 @@ namespace ipl {
scroller mScroller;
s32 mButtonState;
u8 mControllerFlags[4];
#ifndef IPL_SD_CHANNEL_TITLE_CPP
u32 mFinalState[3];
u8 mFinalFlags[4];
#endif
};
} // namespace scene
} // namespace ipl

View File

@@ -28,7 +28,11 @@ namespace ipl {
int getIndex() const { return mIndex; }
nw4r::math::VEC3& getTranslate() const;
#ifdef IPL_SD_CHANNEL_TITLE_CPP
public:
#else
private:
#endif
friend class SDChannelSelect;
nw4r::ut::Link mListLink;
@@ -172,7 +176,11 @@ namespace ipl {
static const char* mscClockPaneNames[3];
static const char* mscMaskPaneName;
#ifdef IPL_SD_CHANNEL_TITLE_CPP
public:
#else
private:
#endif
#ifdef IPL_SD_CHANNEL_SELECT_CPP
friend class SDChannelSelectEventHandler;
friend class SDChannelSelectButtonEventHandler;

View File

@@ -3,15 +3,104 @@
#include "iplSceneHeader.h"
#ifdef IPL_SD_CHANNEL_TITLE_CPP
#include "math/iplInterporation.h"
#include "scene/sdChannelMemory/iplSDMemory.h"
#include "system/iplChannelRsoThread.h"
#include "utility/iplCapture.h"
#include <private/es.h>
#include <nw4r/snd/SoundHandle.h>
#endif
namespace ipl {
namespace scene {
class SDChannelSelect;
class SDButtonEventHandlerBase;
FADER_SCENE_CLASS(SDChannelTitle) {
public:
SDChannelTitle(EGG::Heap * heap, SDChannelSelect * chanSel);
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual ~SDChannelTitle();
virtual void prepare();
virtual void create();
virtual void calcCommon();
virtual FaderSceneCommand calcFadein();
virtual FaderSceneCommand calcNormal();
virtual void initCalcFadeout();
virtual FaderSceneCommand calcFadeout();
virtual void draw();
virtual void destroy();
BOOL isResetAcceptable();
virtual void startResetting();
using Base::reserveAllSceneDestruction;
using Base::createChildScene;
s32 mState;
EGG::ExpHeap* mpBannerHeap;
EGG::ExpHeap* mpCaptureHeap;
s32 mPage;
s32 mIndex;
s32 mPageCount;
s32 mNextScene;
s32 mParentalResult;
math::VEC3 mPosition;
u32 mLaunchFrame;
s32 mStartButtonState;
bool mbBannerStarting;
layout::Animator* mpButtonAnimations[7][6];
math::HermiteIntp<f32>* mpFade;
SDChannelSelect* mpChannelSelect;
nand::LayoutFile* mpLayoutFile;
layout::Object* mpLayout;
gui::PaneManager* mpPaneManager;
layout::Object* mpIconLayout;
EGG::ExpHeap* mpIconHeap;
layout::Object* mpProgressLayout;
s32 mLoadedIndex;
nand::LayoutFile* mpBannerFiles[2];
nand::File* mpSoundFiles[2];
layout::Object* mpBannerLayout;
layout::Animator* mpBannerAnimations[3];
nw4r::snd::SoundHandle* mpSoundHandle;
nand::File* mpSaveFile;
u32 mWpadStopTick;
s32 mHoverCounts[2];
SDButtonEventHandlerBase* mpButtonEventHandler;
utility::Capture* mpScreenCapture;
utility::Capture* mpBannerCapture;
ESTmdView* mpTmd;
u8 mbTmdReady;
u8 mTitleFlags;
u16 mMakerCode;
u8 mbStartAnimation;
s32 mScriptState;
s32 mScriptEnabled;
bool mbStopScript;
u32 mScriptFrame;
u32 mScriptDuration;
nand::File* mpScriptFile;
EGG::ExpHeap* mpScriptHeaps[2];
s32 mScriptHeapIndex;
channel::RsoThread* mpRsoThread;
EGG::ExpHeap* mpRsoHeap;
layout::Animator* mpScriptAnimations[16];
bool mbScriptFailed;
EGG::ExpHeap* mpScriptHeap;
ESTitleId mTitleId;
SDMemory::TitleRange mTitleRange;
u8 mUnknownTitleWork[0x800];
SDMemory mMemory;
u32 mErrorMessage;
s32 mChangeFrame;
u8 mbCopiedTitle;
u8 mbResetAcceptable;
nw4r::snd::SoundHandle* mpCopySound;
#else
private:
u8 unk_0x58[0x3460];
#endif
};
} // namespace scene
} // namespace ipl

View File

@@ -34,6 +34,9 @@ namespace ipl {
void initManager();
void setPrevPage(int prevPage);
#ifdef IPL_SD_CHANNEL_TITLE_CPP
int& getSDPrevPage() { return mData.prevSDPage; }
#endif
void setChanInfo(int page, int index, const channel::SInfo& chanInfo);
void setMemoSetting(const textinput::extend::savedata::MemoSetting& memoSetting);

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);

View File

@@ -3,7 +3,6 @@
#include <private/cdb/CDBAttr.h>
#include <private/cdb/CDBBridge.h>
#include <revolution/os.h>
#include <revolution/types.h>
#ifdef __cplusplus
@@ -11,20 +10,13 @@ extern "C" {
#endif // __cplusplus
typedef struct _CDBRecordFile {
union {
u8 unk_0x00[0x1C - 0x00];
struct {
OSMutex mutex; // 0x00
BOOL used; // 0x18
};
};
int unk_0x1C; // 0x1C
u8 unk_0x00[0x1C - 0x00];
int unk_0x1C;
CDBAttr attr; // 0x20
CDBBridgeFile bridgeFile; // 0x42C
u8 unk_0x434[0x438 - 0x434];
CDBRecordKey key; // 0x438
u32 unk_0x468;
u8 unk_0x46C[0x480 - 0x46C];
u8 unk_0x468[0x480 - 0x468];
} CDBRecordFile;
enum {

View File

@@ -1,224 +0,0 @@
#include <private/cdb.h>
#include <revolution/cdb.h>
#include <string.h>
typedef struct _CDBIntArray {
int* records;
int capacity;
int size;
int reverse;
} CDBIntArray;
void CDBIntCopy(int* i1, const int* i2) {
*i1 = *i2;
}
int CDBIntCompare(int* i1, int* i2) {
if (*i1 < *i2) {
return -1;
}
return *i1 != *i2;
}
void CDBIntArrayInit(CDBIntArray* recordArray, int* records, int capacity) {
recordArray->size = 0;
recordArray->reverse = 1;
recordArray->capacity = capacity;
recordArray->records = records;
}
void CDBIntArraySetReverse(CDBIntArray* recordArray) {
recordArray->reverse = -1;
}
int CDBIntArraySize(CDBIntArray* recordArray) {
return recordArray->size;
}
int* CDBIntArrayAt(CDBIntArray* recordArray, int index) {
return recordArray->records + index;
}
BOOL CDBIntArrayEmpty(CDBIntArray* recordArray) {
return recordArray->size == 0;
}
BOOL CDBIntArrayFull(CDBIntArray* recordArray) {
return recordArray->capacity <= recordArray->size;
}
int* CDBIntArrayEnd(CDBIntArray* recordArray) {
return recordArray->records + recordArray->size;
}
int CDBIntArrayDicInsertR(CDBIntArray* recordArray, int* record, int first, int last) {
int index;
int result;
if (first == last || first == last - 1) {
result = CDBIntCompare(record, recordArray->records + first);
if (result < 0) {
return first;
}
result = CDBIntCompare(record, recordArray->records + last);
if (result >= 0) {
result = last + 1;
} else {
result = last;
}
return result;
}
index = first + (last - first) / 2;
result = CDBIntCompare(record, recordArray->records + index);
if (result < 0) {
return CDBIntArrayDicInsertR(recordArray, record, first, index);
}
if (result > 0) {
return CDBIntArrayDicInsertR(recordArray, record, index, last);
}
return index;
}
int* CDBIntArrayDicInsert(CDBIntArray* recordArray, int* record) {
register int* elem;
int size = recordArray->size;
int index;
int moveCount;
if (size == 0) {
if (size < recordArray->capacity) {
elem = recordArray->records + size;
CDBIntCopy(elem, record);
recordArray->size++;
}
return record;
}
if (recordArray->capacity <= size) {
if (recordArray->reverse == 1) {
if (size != 0) {
elem = recordArray->records + (size - 1);
} else {
elem = recordArray->records;
}
if (CDBIntCompare(elem, record) < 0) {
return elem;
}
recordArray->size--;
index = CDBIntArrayDicInsertR(recordArray, record, 0, recordArray->size - 1);
moveCount = (recordArray->size - index) * sizeof(int);
if (recordArray->capacity <= recordArray->size) {
moveCount -= sizeof(int);
}
if (moveCount > 0) {
memmove(recordArray->records + (index + 1), recordArray->records + index, moveCount);
}
CDBIntCopy(recordArray->records + index, record);
if (recordArray->size < recordArray->capacity) {
recordArray->size++;
}
return recordArray->records + index;
}
elem = recordArray->records;
if (CDBIntCompare(record, elem) < 0) {
return elem;
}
recordArray->size--;
if (recordArray->size >= 0 && recordArray->capacity - 1 >= 0) {
memmove(recordArray->records, recordArray->records + 1, recordArray->size * sizeof(int));
}
index = CDBIntArrayDicInsertR(recordArray, record, 0, recordArray->size - 1);
moveCount = (recordArray->size - index) * sizeof(int);
if (recordArray->capacity <= recordArray->size) {
moveCount -= sizeof(int);
}
if (moveCount > 0) {
memmove(recordArray->records + (index + 1), recordArray->records + index, moveCount);
}
CDBIntCopy(recordArray->records + index, record);
if (recordArray->size < recordArray->capacity) {
recordArray->size++;
}
return recordArray->records + index;
}
index = CDBIntArrayDicInsertR(recordArray, record, 0, recordArray->size - 1);
moveCount = (recordArray->size - index) * sizeof(int);
if (recordArray->capacity <= recordArray->size) {
moveCount -= sizeof(int);
}
if (moveCount > 0) {
memmove(recordArray->records + (index + 1), recordArray->records + index, moveCount);
}
CDBIntCopy(recordArray->records + index, record);
if (recordArray->size < recordArray->capacity) {
recordArray->size++;
}
return recordArray->records + index;
}
int CDBIntArrayDicFindR(CDBIntArray* recordArray, int* record, int first, int last) {
int index;
int result;
if (first == last || first == last - 1) {
result = CDBIntCompare(record, recordArray->records + first);
if (result == 0) {
return first;
}
result = CDBIntCompare(record, recordArray->records + last);
if (result != 0) {
result = -1;
} else {
result = last;
}
return result;
}
index = first + (last - first) / 2;
result = CDBIntCompare(record, recordArray->records + index);
if (result < 0) {
return CDBIntArrayDicFindR(recordArray, record, first, index);
}
if (result > 0) {
return CDBIntArrayDicFindR(recordArray, record, index, last);
}
return index;
}
int* CDBIntArrayDicFind(CDBIntArray* recordArray, int* record) {
int size = recordArray->size;
int index;
if (size == 0) {
return recordArray->records + size;
}
index = CDBIntArrayDicFindR(recordArray, record, 0, size - 1);
if (index != -1) {
return recordArray->records + index;
}
return recordArray->records + recordArray->size;
}
static void CDBDeadTest1(void) {
CDBReportError("TESTSTRING1 static-fn\n");
}
void CDBDeadTest2(void) {
if (0) {
CDBReportError("TESTSTRING2 if0\n");
}
(void)"TESTSTRING3 voidexpr\n";
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,796 @@
#define MYTIINPUTFORM_IMPLEMENTATION
#include "keyboard/MyTiInputForm.h"
#include "keyboard/tiUtil.h"
#include <nw4r/lyt/group.h>
#include <nw4r/lyt/material.h>
#include <nw4r/lyt/textbox.h>
#include <new>
namespace textinput {
namespace inputform {
class EventHandler : public nw4rmanager::TiEventHandler {
public:
EventHandler(textinput::InputForm* form) : mpInputForm(form) {}
virtual ~EventHandler() {}
virtual void onTiEvent(gui::PaneComponent*, u32, Input*);
protected:
textinput::InputForm* mpInputForm;
};
}
namespace extend {
namespace memo {
class AnmPane : public nw4rmanager::AnmPane {
protected:
AnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
: nw4rmanager::AnmPane(pane, observer), meState(0) {}
public:
virtual ~AnmPane();
virtual void init();
virtual void changeAnimation(u32 id);
virtual u32 getState();
virtual u32 getKeyType() const;
protected:
u32 meState;
u32 meKeyType;
};
class WholePane : public AnmPane {
public:
WholePane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { meKeyType = 0; }
virtual ~WholePane() {}
virtual void onAnmEvent(AnmPaneEvent event);
};
class NigaoePane : public AnmPane {
public:
NigaoePane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { meKeyType = 1; }
virtual ~NigaoePane() {}
virtual void onAnmEvent(AnmPaneEvent event);
};
class SimpleAnmPane : public nw4rmanager::AnmPane {
public:
SimpleAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : nw4rmanager::AnmPane(pane, observer) {}
virtual ~SimpleAnmPane() {}
virtual void init();
virtual void changeAnimation(u32 id);
};
class ScrollButton {
public:
ScrollButton(TiLayout* layout) : muGroup(0), muAnimation(0), mpLayout(layout), mbLeftPressed(false), mbRightPressed(false) {}
virtual void create(MEMAllocator*, nw4r::lyt::MultiArcResourceAccessor*);
virtual void init();
virtual void calc();
virtual void changeAnimation(bool left, u32 id);
private:
u32 muGroup;
u32 muAnimation;
TiLayout* mpLayout;
nw4rmanager::AnimPaneGroup* mGroups[9];
bool mbGroupChanged[9];
bool mbLeftPressed;
bool mbRightPressed;
};
class EventHandler : public inputform::EventHandler {
public:
EventHandler(InputForm* form) : inputform::EventHandler(form), mpMemoForm(form) {}
virtual ~EventHandler() {}
virtual void onTiEvent(gui::PaneComponent*, u32, Input*);
private:
InputForm* mpMemoForm;
};
static const char* scPaneName[] = {
"N_Header", "N_Body", "B_Body", "N_Footer", "Nigaoe",
"T_Nigaoe", "B_Nigaoe", "T_Letter", "T_TouchLetter"
};
struct AnimationFile {
u32 id;
char name[64];
};
static const AnimationFile csAninationFile[] = {
{0, "my_Memo_a_normal.brlan"},
{1, "my_Memo_a_MailIn.brlan"},
{2, "my_Memo_a_MailOut.brlan"},
{3, "my_Memo_a_SendOut.brlan"},
{4, "my_Memo_a_NigaoeFoucusIn.brlan"},
{5, "my_Memo_a_NigaoeFoucusOut.brlan"}
};
struct PaneAnimations {
u32 type;
const char* paneName;
u32 count;
const AnimationFile* animations[12];
};
static const PaneAnimations csPaneToAnimation[] = {
{0, "N_Memo", 4, {&csAninationFile[0], &csAninationFile[1], &csAninationFile[2], &csAninationFile[3]}},
{1, "Nigaoe", 2, {&csAninationFile[4], &csAninationFile[5]}}
};
static const AnimationFile csGroupAninationFile[] = {
{0, "my_Memo_a_Off.brlan"},
{1, "my_Memo_a_Appear.brlan"},
{2, "my_Memo_a_Lost.brlan"},
{3, "my_Memo_a_HDActionEnd.brlan"},
{4, "my_Memo_a_HDActionStart.brlan"},
{5, "my_Memo_a_Loop.brlan"},
{6, "my_Memo_a_Select.brlan"},
{7, "my_Memo_a_FocusOff.brlan"},
{8, "my_Memo_a_FocusOn.brlan"}
};
struct GroupAnimations {
u32 group;
u32 animations[3];
};
static const GroupAnimations csGroupToAnimation[] = {
{0, {5, 9, 9}}, {1, {8, 7, 9}}, {2, {8, 7, 9}},
{3, {6, 9, 9}}, {4, {6, 9, 9}}, {5, {2, 1, 9}},
{6, {2, 1, 9}}, {7, {4, 3, 9}}, {8, {4, 3, 9}}
};
InputForm::~InputForm() {
mpSendString->~Decolated();
MEMFreeToAllocator(mpAllocator, mpSendString);
MEMFreeToAllocator(mpAllocator, mpDefaultNigaoe);
}
void InputForm::setAddScroll(f32 scroll, bool up, bool down) {
setScroll(mfScroll + scroll);
if (up && !mbScrollUp) {
mpScrollButton->changeAnimation(false, 4);
} else if (down && !mbScrollDown) {
mpScrollButton->changeAnimation(true, 4);
}
if (!up && mbScrollUp) {
mpScrollButton->changeAnimation(false, 3);
} else if (!down && mbScrollDown) {
mpScrollButton->changeAnimation(true, 3);
}
mbScrollUp = up;
mbScrollDown = down;
}
void InputForm::moveCursorUp() {
f32 y = 1.0f + (mfCursorY - getLineHeight());
if (y <= 0.0f) {
u32 start, end;
mpString->getCursorPos(&start, &end);
if (start == 0 && end == 0) onSE(sound::SE_CHAR_CURSOR_FIX);
else onSE(sound::SE_CHAR_CURSOR);
setCursorPos(mpString, 0);
} else {
setCursorPos(mpString, calcCursorPos(mfCursorX, y - mfScroll));
onSE(sound::SE_CHAR_CURSOR);
}
meScrollFlag = SF_ScrollOn;
}
void InputForm::moveCursorDown() {
f32 y = 1.0f + (mfCursorY + getLineHeight());
if (y / getLineHeight() >= getLine()) {
u32 start, end;
mpString->getCursorPos(&start, &end);
if (start == mpString->getLength() && end == mpString->getLength()) onSE(sound::SE_CHAR_CURSOR_FIX);
else onSE(sound::SE_CHAR_CURSOR);
setCursorPos(mpString, mpString->getLength());
} else {
setCursorPos(mpString, calcCursorPos(mfCursorX, y - mfScroll));
onSE(sound::SE_CHAR_CURSOR);
}
meScrollFlag = SF_ScrollOn;
}
void InputForm::onCommand(INPUT_COMMAND command, void* data) {
if (meEditMode == EM_Edit) onCommandOnEditMode(command, data);
else if (meEditMode == EM_Disp) onCommandOnDispMode(command, data);
else {
switch (command) {
case 6: case 21: case 29: case 31:
textinput::InputForm::onCommand(command, data);
break;
case 7: case 8: case 9: case 10: case 11: case 12: case 13:
case 14: case 15: case 16: case 17: case 18: case 19: case 20:
case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 30:
break;
}
}
}
void InputForm::onCommandOnEditMode(INPUT_COMMAND command, void* data) {
switch (command) {
case 24:
if (!mExScrollAnm.isActive()) {
if (static_cast<Scroll*>(data)->y < 0.0f)
mExScrollAnm.startAnm(NULL, mfScroll, mfScroll + getLineHeight(), 15.0f, NULL);
else
mExScrollAnm.startAnm(NULL, mfScroll, mfScroll - getLineHeight(), 15.0f, NULL);
onSE(sound::SE_LINE_SCROLL);
}
break;
default:
textinput::InputForm::onCommand(command, data);
break;
}
}
void InputForm::onCommandOnDispMode(INPUT_COMMAND command, void* data) {
switch (command) {
case 14: {
nw4r::math::VEC2 position = getGlobalLeftTopPos();
nw4r::math::VEC2* point = static_cast<nw4r::math::VEC2*>(data);
int line = (point->y - position.y) / getLineHeight();
if (line > getLine() - 1) line = getLine() - 1;
if (getLine() > 1 && line >= getLine() - 1) line = getLine() - 2;
mfScrollFrom = mfScroll;
mfScrollTo = line * getLineHeight();
nw4r::math::VEC2 editPoint;
editPoint.x = point->x;
editPoint.y = point->y - mfScroll;
textinput::InputForm::onCommand(static_cast<INPUT_COMMAND>(14), &editPoint);
int relationLine = line;
struct Relation { int type; int* line; } relation = {0, &relationLine};
textinput::InputForm::onCommand(INPUT_COMMAND_37, &relation);
mbEdited = true;
candidatebox::CandidateBoxCaller::resetCandidate();
candidatebox::CandidateBoxCaller::makeEmptyCandidate();
break;
}
case 29: case 31: case 41:
textinput::InputForm::onCommand(command, data);
break;
}
}
void InputForm::create(MEMAllocator* allocator, inputform::EditBuffer* editBuffer) {
textinput::InputForm::create(allocator, editBuffer);
void* stringMemory = MEMAllocFromAllocator(allocator, sizeof(tistring::Decolated));
mpSendString = new (stringMemory) tistring::Decolated(1024);
mpSendString->create(allocator);
MEMFreeToAllocator(allocator, mpInputEventHandler);
void* handlerMemory = MEMAllocFromAllocator(allocator, sizeof(EventHandler));
mpInputEventHandler = new (handlerMemory) EventHandler(this);
mpInputEventHandler->setEventObserver(mpEventObserver);
mpPaneManager->changeEventHandler(mpInputEventHandler);
mpDefaultNigaoe = static_cast<GXTexObj*>(MEMAllocFromAllocator(allocator, sizeof(GXTexObj)));
getNigaoePaneMaterial()->GetTexture(mpDefaultNigaoe, 0);
setVisible("P_2l_TextBox", true);
mpBoundPane = mpLayout->GetRootPane()->FindPaneByName("T_2l_TextBox", true);
mDefaultBoundTrans = mpBoundPane->GetTranslate();
mDefaultBoundSize = mpBoundPane->GetSize();
mpDrawPane = mpLayout->GetRootPane()->FindPaneByName("B_2l_TextBox", true);
mpPaneManager->getPaneComponentByPane(mpDrawPane)->setTriggerTarget(false);
mDrawRect = mpDrawPane->GetPaneRect(mDrawInfo);
mDefaultDrawTrans = mpDrawPane->GetTranslate();
mDefaultDrawSize = mpDrawPane->GetSize();
mpMemoPane = mpLayout->GetRootPane()->FindPaneByName("N_Memo", true);
mpMemoRootPane = mpLayout->GetRootPane()->FindPaneByName("N_MemoRoot", true);
setScroll(0.0f);
mnLine = 1;
mfScrollFrom = 0.0f;
mfScrollTo = 0.0f;
PSMTXIdentity(mDrawMtx);
PSMTXIdentity(mBoundMtx);
createAnimation(allocator);
void* scrollMemory = MEMAllocFromAllocator(allocator, sizeof(ScrollButton));
mpScrollButton = new (scrollMemory) ScrollButton(mpLayout);
mpScrollButton->create(allocator, mpMultiArcResourceAccessor);
}
void InputForm::createAnimation(MEMAllocator* allocator) {
for (u16 i = 0; i < 2; i++) {
const PaneAnimations& entry = csPaneToAnimation[i];
AnmPane* pane = NULL;
switch (entry.type) {
case 0: {
void* memory = MEMAllocFromAllocator(allocator, sizeof(WholePane));
pane = new (memory) WholePane(getPane(entry.paneName), NULL);
break;
}
case 1: {
void* memory = MEMAllocFromAllocator(allocator, sizeof(NigaoePane));
pane = new (memory) NigaoePane(getPane(entry.paneName), NULL);
break;
}
}
nw4r::ut::List_Append(&mAnmPanes, pane);
for (u16 j = 0; j < entry.count; j++) {
const void* resource = mpMultiArcResourceAccessor->GetResource(0, entry.animations[j]->name, NULL);
AnimTransformPane* transform = static_cast<AnimTransformPane*>(getLayout()->CreateAnimTransform(resource, mpMultiArcResourceAccessor));
pane->addAnimation(allocator, entry.animations[j]->id, transform, false, true);
}
}
}
AnmPane::~AnmPane() {}
static const char* csGroupName[] = {
"G_ArwRoop", "G_ArwR_Focus", "G_ArwL_Focus", "G_ArwR_Ac", "G_ArwL_Ac",
"G_ArwL_End", "G_ArwR_End", "G_ArwL_HDAc", "G_ArwR_HDAc"
};
void ScrollButton::create(MEMAllocator* allocator, nw4r::lyt::MultiArcResourceAccessor* accessor) {
for (int i = 0; i < 9; i++) {
mbGroupChanged[i] = false;
nw4r::lyt::Group* group = mpLayout->GetGroupContainer()->FindGroupByName(csGroupName[i]);
void* groupMemory = MEMAllocFromAllocator(allocator, sizeof(nw4rmanager::AnimPaneGroup));
mGroups[i] = new (groupMemory) nw4rmanager::AnimPaneGroup(group);
nw4r::lyt::PaneLinkList& panes = group->GetPaneList();
for (nw4r::lyt::PaneLinkList::Iterator it = panes.GetBeginIter(); it != panes.GetEndIter(); ++it) {
void* memory = MEMAllocFromAllocator(allocator, sizeof(SimpleAnmPane));
SimpleAnmPane* pane = new (memory) SimpleAnmPane(it->mTarget, NULL);
for (u16 j = 0; j < 3; j++) {
int id = csGroupToAnimation[i].animations[j];
if (id != 9) {
const void* resource = accessor->GetResource(0, csGroupAninationFile[id].name, NULL);
AnimTransformPane* transform = static_cast<AnimTransformPane*>(mpLayout->CreateAnimTransform(resource, accessor));
bool loop = false;
if (id == 5) loop = true;
pane->addAnimation(allocator, id, transform, loop, false);
}
}
mGroups[i]->addAnimPane(pane);
}
}
changeAnimation(true, 5);
changeAnimation(false, 5);
changeAnimation(true, 2);
changeAnimation(false, 2);
for (int i = 0; i < 10; i++) calc();
}
void ScrollButton::calc() {
for (int i = 0; i < 9; i++) mGroups[i]->calc();
}
void ScrollButton::changeAnimation(bool left, u32 id) {
muAnimation = id;
if (left) {
switch (id) {
case 0: muGroup = 0; break;
case 1: muGroup = 5; break;
case 2: muGroup = 5; break;
case 3: if (!mbLeftPressed) return; muGroup = 8; mbLeftPressed = false; break;
case 4: if (mbLeftPressed) return; muGroup = 8; mbLeftPressed = true; break;
case 5: muGroup = 0; break;
case 6: muGroup = 4; break;
case 7: muGroup = 2; break;
case 8: muGroup = 2; break;
}
} else {
switch (id) {
case 0: muGroup = 0; break;
case 1: muGroup = 6; break;
case 2: muGroup = 6; break;
case 3: if (!mbRightPressed) return; muGroup = 7; mbRightPressed = false; break;
case 4: if (mbRightPressed) return; muGroup = 7; mbRightPressed = true; break;
case 5: muGroup = 0; break;
case 6: muGroup = 3; break;
case 7: muGroup = 1; break;
case 8: muGroup = 1; break;
}
}
mbGroupChanged[muGroup] = true;
mGroups[muGroup]->changeAnimation(id);
}
void InputForm::onArrowRPoint() {
if (meEditMode == EM_Disp) {
mpScrollButton->changeAnimation(false, 8);
onSE(sound::SE_BT_TARGETTING);
}
}
void InputForm::onArrowRLeft() {
if (meEditMode == EM_Disp) mpScrollButton->changeAnimation(false, 7);
}
void InputForm::onArrowLPoint() {
if (meEditMode == EM_Disp) {
mpScrollButton->changeAnimation(true, 8);
onSE(sound::SE_BT_TARGETTING);
}
}
void InputForm::onArrowLLeft() {
if (meEditMode == EM_Disp) mpScrollButton->changeAnimation(true, 7);
}
void InputForm::onArrowRTrig() {
if (meEditMode == EM_Disp && !mExScrollAnm.isActive()) {
mpScrollButton->changeAnimation(false, 6);
f32 scroll = mfScroll - 3.0f * getLineHeight();
if (scroll <= getScrollMin()) scroll = getScrollMin();
mExScrollAnm.startAnm(NULL, mfScroll, scroll, 15.0f, NULL);
onSE(sound::SE_LINE_SCROLL);
}
}
void InputForm::onArrowLTrig() {
if (meEditMode == EM_Disp && !mExScrollAnm.isActive()) {
mpScrollButton->changeAnimation(true, 6);
f32 scroll = mfScroll + 3.0f * getLineHeight();
if (scroll >= getScrollMax()) scroll = getScrollMax();
mExScrollAnm.startAnm(NULL, mfScroll, scroll, 15.0f, NULL);
onSE(sound::SE_LINE_SCROLL);
}
}
bool InputForm::updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data) {
if (meEditMode == EM_Disp) {
if (hold & 0x400) return textinput::InputForm::updateInput(chan, 0.0f, 0.0f, 0, 0, 0, data);
if (trig & 8) mpScrollButton->changeAnimation(false, 4);
if (release & 8) mpScrollButton->changeAnimation(false, 3);
if (trig & 4) mpScrollButton->changeAnimation(true, 4);
if (release & 4) mpScrollButton->changeAnimation(true, 3);
if (hold & 8) {
if (getScrollMin() <= mfScroll) {
setScroll(mfScroll - 3.5f);
if (mfScroll <= getScrollMin()) setScroll(getScrollMin());
else onSE(sound::SE_MESSAGE_SCROLL);
}
mpScrollButton->changeAnimation(false, 4);
} else mpScrollButton->changeAnimation(false, 3);
if (hold & 4) {
if (getScrollMax() >= mfScroll) {
setScroll(3.5f + mfScroll);
if (mfScroll >= getScrollMax()) setScroll(getScrollMax());
else onSE(sound::SE_MESSAGE_SCROLL);
}
mpScrollButton->changeAnimation(true, 4);
} else mpScrollButton->changeAnimation(true, 3);
}
return textinput::InputForm::updateInput(chan, x, y, trig, hold, release, data);
}
bool InputForm::updateInput(input::HKBManager& hkbManager) {
return textinput::InputForm::updateInput(hkbManager);
}
void InputForm::init() {
if (mpBoundPane != NULL) mCharColor.Set(20, 20, 20, 255);
mbUpVisible = false;
mbDownVisible = false;
searchAnmPane("P_txtScrll_UP")->changeAnimation(7);
searchAnmPane("P_txtScrll_DOWN")->changeAnimation(7);
mbGoodBye = false;
mbEditScrollUp = false;
mbEditScrollDown = false;
setScroll(0.0f);
mfScrollFrom = 0.0f;
mfScrollTo = 0.0f;
resetRelation();
updateCandidateState_();
setLineDrawInfo(true, 10);
}
void InputForm::draw() {
setProjectionMtx();
drawHeader();
drawBody();
drawFooter();
if (meEditMode == EM_Edit) getPane("N_txt_scrl")->Draw(mDrawInfo);
inputform::Base::draw();
if (meEditMode == EM_Disp) {
setProjectionMtx();
getPane("N_TopBtn_00")->Animate(0);
getPane("N_TopBtn_00")->CalculateMtx(mDrawInfo);
getPane("N_TopBtn_00")->Draw(mDrawInfo);
}
mnLine = getLine();
if (mnLine <= 4) mnLine = 4;
}
void InputForm::setScroll(f32 scroll) {
mfScroll = scroll;
mfDrawScrollY = meEditMode == EM_Edit ? -mfScroll : 0.0f;
}
static nw4r::math::VEC2 transformedOrigin(const nw4r::ut::Rect& rect, const Mtx& matrix) {
nw4r::math::VEC3 position;
position.x = rect.left;
position.y = rect.bottom;
position.z = 0.0f;
PSMTXMultVec(matrix, reinterpret_cast<const Vec*>(&position), reinterpret_cast<Vec*>(&position));
return nw4r::math::VEC2(position.x, -position.y);
}
void InputForm::calc() {
nw4rmanager::Layout::calc();
muGlobalAlpha = getLayout()->GetRootPane()->GetAlpha();
mpLayout->Animate(0);
mpLayout->CalculateMtx(mDrawInfo);
mpLayout->GetRootPane()->FindPaneByName("N_Memo", true)->SetTranslate(nw4r::math::VEC2(0.0f, mfScroll));
f32 height = mnLine * getLineHeight();
f32 drawY = mDefaultDrawTrans.y - (height - mDefaultDrawSize.height) / 2.0f;
mpDrawPane->SetSize(nw4r::lyt::Size(mpDrawPane->GetSize().width, height));
mpDrawPane->SetTranslate(nw4r::math::VEC2(mDefaultDrawTrans.x, drawY));
mpDrawPane->CalculateMtx(mDrawInfo);
AdjustPaneMtx(mDrawMtx, mDrawInfo, mpDrawPane->GetGlobalMtx());
nw4r::ut::Rect rect;
rect = mpDrawPane->GetPaneRect(mDrawInfo);
nw4r::math::VEC2 scale(getScale().x, 1.0f);
nw4r::math::VEC2 position = transformedOrigin(rect, mDrawMtx);
mDrawRect.left = position.x;
mDrawRect.bottom = position.y;
mDrawRect.right = position.x + scale.x * (rect.right - rect.left);
mDrawRect.top = position.y + scale.y * (rect.top - rect.bottom);
height = mnLine * getLineHeight();
f32 halfHeight = height - mDefaultBoundSize.height;
halfHeight *= 0.5f;
f32 boundY = mDefaultBoundTrans.y - halfHeight;
if (meEditMode == EM_Edit) {
height = 2.0f * getLineHeight();
boundY = (mDefaultBoundTrans.y - (height - mDefaultBoundSize.height) / 2.0f) - mfScroll;
} else mfDrawScrollY = 0.0f;
mpBoundPane->SetSize(nw4r::lyt::Size(mpBoundPane->GetSize().width, height));
mpBoundPane->SetTranslate(nw4r::math::VEC2(mDefaultBoundTrans.x, boundY));
mpBoundPane->CalculateMtx(mDrawInfo);
AdjustPaneMtx(mBoundMtx, mDrawInfo, mpBoundPane->GetGlobalMtx());
AdjustPaneMtx(mMtx.m, mDrawInfo, mpBoundPane->GetGlobalMtx());
mRect = mpBoundPane->GetPaneRect(mDrawInfo);
muGlobalAlpha = mpBoundPane->GetAlpha();
mExScrollAnm.calc();
if (mExScrollAnm.isActive()) {
setScroll(mExScrollAnm.getValue());
} else if (meEditMode == EM_Edit) {
doAutoScroll();
if (!mExScrollAnm.isActive()) {
f32 halfLine = getLineHeight();
halfLine *= 0.5f;
if (mfScroll - halfLine > 0.0f) {
if (!mbUpVisible) {
searchAnmPane("P_txtScrll_UP")->changeAnimation(5);
mpPaneManager->getPaneComponentByPane(getPane("B_txtScrll_UP"))->init();
}
mbUpVisible = true;
} else {
if (mbUpVisible) searchAnmPane("P_txtScrll_UP")->changeAnimation(6);
mbUpVisible = false;
}
f32 textHeight = getLine() * getLineHeight();
f32 lowerHalfLine = getLineHeight();
lowerHalfLine *= 0.5f;
f32 lowerEdge = mfScroll + height;
lowerEdge += lowerHalfLine;
if (lowerEdge < textHeight) {
if (!mbDownVisible) {
searchAnmPane("P_txtScrll_DOWN")->changeAnimation(5);
mpPaneManager->getPaneComponentByPane(getPane("B_txtScrll_DOWN"))->init();
}
mbDownVisible = true;
} else {
if (mbDownVisible) searchAnmPane("P_txtScrll_DOWN")->changeAnimation(6);
mbDownVisible = false;
}
}
} else {
mbUpVisible = false;
mbDownVisible = false;
searchAnmPane("P_txtScrll_UP")->changeAnimation(7);
searchAnmPane("P_txtScrll_DOWN")->changeAnimation(7);
getPane("N_txt_scrl")->Animate(0);
getPane("N_txt_scrl")->CalculateMtx(mDrawInfo);
}
nw4r::lyt::Pane* scrollPane = getPane("N_txt_scrl");
scrollPane->SetTranslate(nw4r::math::VEC2(scrollPane->GetTranslate().x, 0.0f));
if (meEditMode == EM_Disp) {
mpScrollButton->calc();
if (!mbGoodBye) {
if (mbEditScrollUp && getScrollMin() >= mfScroll) {
mbEditScrollUp = false;
mpScrollButton->changeAnimation(false, 2);
} else if (!mbEditScrollUp && getScrollMin() < mfScroll) {
mbEditScrollUp = true;
mpScrollButton->changeAnimation(false, 1);
}
if (mbEditScrollDown && getScrollMax() <= mfScroll) {
mbEditScrollDown = false;
mpScrollButton->changeAnimation(true, 2);
}
if (!mbEditScrollDown && getScrollMax() > mfScroll) {
mbEditScrollDown = true;
mpScrollButton->changeAnimation(true, 1);
}
if (mpNigaoeObserver != NULL) mpNigaoeObserver->moveNigaoeButton();
}
}
calcCursorTimer();
}
void InputForm::doAutoScroll() {
if (!mExScrollAnm.isActive() && (meScrollFlag == SF_ScrollOn || meScrollFlag == SF_ScrollByBS)) {
if (meEditMode == EM_Edit) {
f32 lineHeight = getLineHeight();
lineHeight *= 0.5f;
f32 cursorBottom = mfCursorY + lineHeight;
if (mfScroll > cursorBottom) {
int lines = (mfScroll - mfCursorY) / getLineHeight();
mExScrollAnm.startAnm(NULL, mfScroll, mfScroll - lines * getLineHeight(), 15.0f, NULL);
onSE(sound::SE_LINE_SCROLL);
}
if (mfScroll + 2.0f * getLineHeight() < cursorBottom) {
f32 lineHeight = getLineHeight();
int lines = static_cast<int>((cursorBottom - (mfScroll + 2.0f * getLineHeight())) / lineHeight) + 1;
mExScrollAnm.startAnm(NULL, mfScroll, mfScroll + lines * getLineHeight(), 15.0f, NULL);
onSE(sound::SE_LINE_SCROLL);
}
}
meScrollFlag = SF_NoScroll;
}
}
void InputForm::beginDraw(const nw4r::ut::Rect&) {
if (mDrawRect.left == mDrawRect.right) mDrawRect.right += 0.1f;
if (mDrawRect.top == mDrawRect.bottom) mDrawRect.top += 0.1f;
textdrawer::Base::beginDraw(mDrawRect);
}
void InputForm::doScroll(Scroll*) {}
u32 InputForm::calcCursorPos(f32 x, f32 y) {
u32 lines = getLine();
if (lines > muLimitRowNum) lines = muLimitRowNum;
f32 lineHeight = getLineHeight();
f32 cursorY = y + mfScroll;
if (cursorY > lines * lineHeight) return inputform::Base::calcCursorPos(x, lines * getLineHeight());
return inputform::Base::calcCursorPos(x, cursorY);
}
void InputForm::drawCursor(f32 x, f32 y) {
if (meEditMode != EM_Disp) inputform::Base::drawCursor(x, y);
}
nw4r::math::VEC2 InputForm::getScale() const {
if (mpMemoRootPane == NULL) return nw4r::math::VEC2(1.0f, 1.0f);
return mpMemoRootPane->GetScale();
}
void InputForm::drawHeader() {
getPane(scPaneName[0])->Draw(mDrawInfo);
getPane("Nigaoe")->Draw(mDrawInfo);
getPane("T_Nigaoe")->Draw(mDrawInfo);
}
void InputForm::drawBody() {
nw4r::lyt::Pane* body = getPane(scPaneName[1]);
f32 y = 0.0f;
for (int i = 0; i < mnLine; i++) {
body->SetTranslate(nw4r::math::VEC2(0.0f, y));
body->CalculateMtx(mDrawInfo);
body->Draw(mDrawInfo);
y -= body->GetSize().height;
}
if (!mbEdited) getPane("T_TouchLetter")->Draw(mDrawInfo);
}
void InputForm::drawFooter() {
f32 y = (mnLine - 1) * (-1.0f * getPane(scPaneName[1])->GetSize().height);
nw4r::lyt::Pane* footer = getPane(scPaneName[3]);
footer->SetTranslate(nw4r::math::VEC2(0.0f, y));
footer->CalculateMtx(mDrawInfo);
footer->Draw(mDrawInfo);
}
void InputForm::open() {
setScroll(0.0f);
mfScrollFrom = 0.0f;
mfScrollTo = 0.0f;
mpLayout->GetRootPane()->SetTranslate(nw4r::math::VEC2(0.0f, 0.0f));
searchAnmPane("N_Memo")->changeAnimation(1);
searchAnmPane("P_txtScrll_UP")->changeAnimation(7);
searchAnmPane("P_txtScrll_DOWN")->changeAnimation(7);
}
void InputForm::close() {
if (!mbCloseWithSend) searchAnmPane("N_Memo")->changeAnimation(2);
else searchAnmPane("N_Memo")->changeAnimation(3);
if (mbEditScrollUp) {
mpScrollButton->changeAnimation(false, 2);
mbEditScrollUp = false;
}
if (mbEditScrollDown) {
mpScrollButton->changeAnimation(true, 2);
mbEditScrollDown = false;
}
mbGoodBye = true;
}
bool InputForm::isWholePaneInAnimation() {
return searchAnmPane("N_Memo")->isInAnimation();
}
void InputForm::setHeaderCaption(const wchar_t* caption) {
static_cast<nw4r::lyt::TextBox*>(mpLayout->GetRootPane()->FindPaneByName("T_Header", true))->SetString(caption, 0);
}
void InputForm::setMiiName(const wchar_t* name) {
static_cast<nw4r::lyt::TextBox*>(mpLayout->GetRootPane()->FindPaneByName("T_Nigaoe", true))->SetString(name, 0);
}
void InputForm::setTouchLetterCaption(const wchar_t* caption) {
static_cast<nw4r::lyt::TextBox*>(mpLayout->GetRootPane()->FindPaneByName("T_TouchLetter", true))->SetString(caption, 0);
mbEdited = false;
}
nw4r::lyt::Pane* InputForm::getNigaoePane() {
return getPane("Nigaoe");
}
nw4r::lyt::Material* InputForm::getNigaoePaneMaterial() {
return getPane("Nigaoe")->FindMaterialByName("Nigaoe", true);
}
f32 InputForm::getScrollMin() { return 0.0f; }
f32 InputForm::getScrollMax() { return getDrawBoxHeight() - 100.0f; }
f32 InputForm::getDrawBoxHeight() { return mnLine * getLineHeight(); }
void InputForm::onNigaoeButtonTrig() {
if (meEditMode == EM_Disp && mpNigaoeObserver != NULL && mpNigaoeObserver->onNigaoeButton()) onSE(sound::SE_DECIDE);
}
void InputForm::onNigaoeButtonPoint() {
if (meEditMode == EM_Disp) {
searchAnmPane("Nigaoe")->changeAnimation(4);
if (mpNigaoeObserver != NULL) mpNigaoeObserver->pointNigaoeButton();
onSE(sound::SE_BT_TARGETTING);
}
}
void InputForm::onNigaoeButtonLeft() {
if (meEditMode == EM_Disp) {
if (mpNigaoeObserver != NULL) mpNigaoeObserver->leftNigaoeButton();
searchAnmPane("Nigaoe")->changeAnimation(5);
}
}
void InputForm::setDefaultNigaoe() {
getNigaoePaneMaterial()->SetTexture(0, *mpDefaultNigaoe);
}
void InputForm::setEditMode(EditMode mode) {
meEditMode = mode;
switch (mode) {
case EM_Disp: getPane("N_txt_scrl")->SetVisible(false); break;
case EM_Edit: getPane("N_txt_scrl")->SetVisible(true); break;
case EM_Disappear:
onCommand(static_cast<INPUT_COMMAND>(6), NULL);
candidatebox::CandidateBoxCaller::resetCandidate();
candidatebox::CandidateBoxCaller::makeEmptyCandidate();
break;
}
}
void InputForm::preDraw(u32 pos) {
if (meEditMode == EM_Disp) mpSendString->clear();
inputform::Base::preDraw(pos);
}
void InputForm::doLineFeed() {
if (meEditMode == EM_Disp) mpSendString->pushBack(L'\n');
inputform::Base::doLineFeed();
}
void InputForm::put(wchar_t ch) {
if (meEditMode == EM_Disp) mpSendString->pushBack(ch);
textdrawer::Base::put(ch);
}
void InputForm::finishDraw(u32) {
if (meEditMode == EM_Disp) mpSendString->pushBack(0);
}
void WholePane::onAnmEvent(AnmPaneEvent) {}
void EventHandler::onTiEvent(gui::PaneComponent* component, u32 event, Input* input) {
inputform::EventHandler::onTiEvent(component, event, input);
const char* name = component->getPane()->GetName();
if (name[0] == 'B') {
if (event == 4 && (input->field_0x0C & 0x800)) {
if (util::strcmp("B_Nigaoe", name)) mpMemoForm->onNigaoeButtonTrig();
if (util::strcmp("B_ArwR", name)) mpMemoForm->onArrowRTrig();
if (util::strcmp("B_ArwL", name)) mpMemoForm->onArrowLTrig();
}
if (event == 0) {
if (util::strcmp("B_Nigaoe", name)) mpMemoForm->onNigaoeButtonPoint();
if (util::strcmp("B_ArwR", name)) mpMemoForm->onArrowRPoint();
if (util::strcmp("B_ArwL", name)) mpMemoForm->onArrowLPoint();
}
if (event == 1) {
if (util::strcmp("B_Nigaoe", name)) mpMemoForm->onNigaoeButtonLeft();
if (util::strcmp("B_ArwR", name)) mpMemoForm->onArrowRLeft();
if (util::strcmp("B_ArwL", name)) mpMemoForm->onArrowLLeft();
}
}
}
void SimpleAnmPane::changeAnimation(u32 id) { nw4rmanager::AnmPane::changeAnimation(id); }
void SimpleAnmPane::init() {}
void ScrollButton::init() {}
u32 AnmPane::getState() { return meState; }
void AnmPane::changeAnimation(u32 id) {
meState = id;
nw4rmanager::AnmPane::changeAnimation(id);
}
u32 AnmPane::getKeyType() const { return meKeyType; }
void AnmPane::init() { meState = 0; }
void NigaoePane::onAnmEvent(AnmPaneEvent) {}
bool InputForm::isInScroll() { return mExScrollAnm.isActive(); }
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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

@@ -0,0 +1,27 @@
# MyTiInputForm attempts
Unit: `src/keyboard/MyTiInputForm`, 4.3U only.
Implemented all 84 target functions, including the compiler-generated inheritance thunks, in object order. The original `ghidra_decomp.txt` contains no functions from this unit; implementation followed the extracted assembly and sibling headers.
The initial source had 42 instruction-exact functions. Correcting the guarded base layout with the existing font and six repeat counters brought objdiff to 73 functions. Ordinary string literals and the original animation records produced identical 29-string pools from the first build.
## Functions that required iteration
- `onCommandOnDispMode`: initially 143/130 instructions. Keeping the cursor line in a separate scalar until constructing the relation argument, qualifying the candidate calls, and passing command 14 directly reduced this to 130/130. Assigning the edit point fields individually removed the final floating-point scheduling differences. Exact.
- `InputForm::create`: initially 229/220 instructions. Removing redundant checks around placement new reduced this to 220/220. Correcting the GUI call to `setTriggerTarget(false)` fixed the last virtual-slot difference. Exact.
- `createAnimation`: initially 129/124 instructions with a cached animation pointer. Ordinary placement new reduced this to 123/124. Reloading the animation record through its table entry restored 124/124 with 22 differences. Moving the count variable outside the loop worsened allocation to 49 differences. Keeping the loop bound as `entry.count` and initializing each concrete pane's key type in its constructor produced zero differences. The base constructor is protected; both concrete constructors initialize the key type before use. Exact.
- `ScrollButton::create`: initially 160/154 instructions. Ordinary placement new and a signed animation ID corrected allocation checks and comparison instructions. Exact.
- `init`: initial fields were at wrong guarded layout offsets. After restoring the repeat fields, separate boolean and float assignments corrected store order; `updateCandidateState_()` corrected the virtual slot. Exact.
- `setScroll`: initially 9/10 instructions. Reading the stored scroll field when negating it preserved the original float rounding instruction. Exact.
- `calcCursorPos`: initially 69/68 instructions. Computing line height before the adjusted cursor Y removed the extra saved floating-point move. Exact.
- `open`: separate scroll-from and scroll-to stores fixed the last two differences. Exact.
- `setEditMode`: initially 57/51 instructions. Qualified candidate calls removed the extra virtual dispatch. Exact.
- `doAutoScroll`: initially 153/152 instructions. Casting the quotient to int before adding one restored the original conversion order and 152/152 instructions. Multiplication operand reversal and a named half-line value left one difference. Multiplying the line-height temporary in place removed it. Exact.
- `calc`: initial 624/629 instructions and a different frame layout. Explicit draw-size/position temporaries and VEC3 construction gave 626/629. A helper returning the transformed origin, with separate coordinate assignments, restored the packed VEC2 return and 629/629. Computing draw Y before setting pane size and expressing half-height separately reduced this to 14 differences. Guarding the rectangle member with its NW4R type and assigning the returned rectangle directly corrected ten stack offsets. Several half-height multiplication temporaries altered allocation without reaching exactness. Dividing the centered height differences by 2 and computing the lower edge in a named scalar removed every remaining difference. Exact: 629/629 instructions, diffs 0.
## Validation scope
The unit remains `NonMatching`. All original code functions match; data has separate unresolved differences and no linking claim is made. All shared-header changes are guarded by `MYTIINPUTFORM_IMPLEMENTATION`, defined only in this source file.
The default gate merge-base is `112e4e1a`, for which the supplied tools have no baseline report. Gates use the available parent snapshot explicitly: `--base 0aca3c76`. No supplied baseline or tool was edited. Regression checks against that snapshot remain zero.

View File

@@ -0,0 +1,82 @@
# SDChannelTitle attempts
Unit: `src/scene/sdChannelTitle/iplSDChannelTitle`, Wii Menu 4.3U.
All 69 original functions have C++ definitions. The source follows original object order;
the 55-string pool is identical. The unit remains NonMatching.
The default gate baseline `70970038` is absent from this checkout. Checks use the
available ancestor `e265d9664e73912f2dbf8dd02425f9dc64eac55b` through the gate's
supported `--base` option. Its unit baseline is zero instruction-exact functions.
## Initial remaining functions
| Function | Distinct source attempts | Final instruction evidence |
| --- | --- | --- |
| `calcFadein` | Reversed fade-playing branch; cached event-handler pointer; explicitly typed null callback; named fade-playing condition. The latter three all kept 48/47 instructions. | One extra `li r5,0` for the declared unused second `SDButton::setEventHandler` argument. |
| `initCalcFadeout` | Cached empty handler (50/49); explicitly typed null arguments (50/49); reloaded SDButton directly at cleanup (54/49, reverted). | One extra `li r5,0` for the same unused argument. |
| `813E6CCC` | Combined positive early-return guards corrected the final animation branch; passed the actual title-range output pointer; cached title halves (89/86); cached selector (88/86); named enqueue result (87/86). Reverted the latter three. | 87/86; explicit ignored controller argument adds `li r4,0`; call setup also schedules differently. |
| `813E6E24` | Explicit range copies replaced reference-only arguments; reversed usage-enough branch; combined positive early-return guards; named copied ranges and cached memory receiver; reversed copy declaration order and original range declaration order. Named copies produced 6, 8, or 9 differing instructions; restored temporary copies. | 95/95; five differences in copy-load register selection and receiver/argument setup order. |
| `813E7074` | Reversed title comparison operands and copied-title branch; cached title halves (77/76); cached selector (77/76); named enqueue result (77/76). Reverted the latter three. | 77/76; explicit ignored controller argument adds `li r4,0`, with argument-move ordering differing. |
| `813E8A20` | Supplied page/index output locals to `hasChannel`; stored the SD previous page through a scoped inline setter; evaluated save heap separately; used a scoped reference accessor instead of the setter. | 37/37; six register/load-order differences around save-manager and heap access. |
## Resolved iterations
Constructor, destructor/thunk, layout creation, common calculation, normal calculation,
fadeout calculation, drawing, destruction, reset checks and most state handlers now
match instruction-exactly. Notable successful source changes were:
- Original function order and event-case order restored all pooled strings.
- Explicit nullable-file checks reproduced virtual-destructor branches.
- Dialog last-result access corrected offset 0x24.
- Arrow visibility access used the real byte at offset 0x81.
- Text-pane names used a normal pointer table instead of direct literals.
- Named pane-handler and text-box temporaries restored allocation/call order.
- Script-data aggregate initialization and a real low-title-ID mask restored 120/120 instructions.
- Script-state heap-index temporary restored register selection.
- Separate result switch cases preserved the original dispatch tree.
- Event switches and a hover-count reference restored both event handlers.
- Combined positive early-return scene-state checks restored script calculation (66/66).
- Named capture-dimension table restored the full .rodata section.
- Fadeout used two-byte maker-code access and separately timed vector construction.
## Layout and interface uncertainties
The 0x800 bytes following the title-range output are preserved as opaque scene work
storage; their internal type is not recovered. This is instance layout, not linker padding.
The embedded SDMemory's original following-member offset requires size 0x2a78; its
existing header's unused 16-byte tail is excluded only for this translation unit.
The original nonconst `isResetAcceptable` symbol differs from Base's existing const
virtual declaration. This needs review before linking. The event handler classes use
ordinary forwarding virtual methods, whose weak metadata may differ from the original.
The original extracted object's weak data can be zero-filled after linker deduplication;
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()