Compare commits

..

11 Commits

66 changed files with 17114 additions and 4448 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

@@ -5126,8 +5126,8 @@ __ct__Q33ipl5scene10AOSSThreadFPQ23EGG4Heap = .text:0x813FCA0C; // type:function
destroy__Q33ipl5scene10AOSSThreadFi = .text:0x813FCAA0; // type:function size:0x84
__dt__Q33ipl5scene10AOSSThreadFv = .text:0x813FCB24; // type:function size:0x70
start__Q33ipl5scene10AOSSThreadFv = .text:0x813FCB94; // type:function size:0xF8
AOSSThread_813FCC8C__Q33ipl5scene10AOSSThreadFUll = .text:0x813FCC8C; // type:function size:0x58
AOSSThread_813FCCE4__Q33ipl5scene10AOSSThreadFUlPvl = .text:0x813FCCE4; // type:function size:0x50
AOSSThread_813FCC8C__Q33ipl5scene10AOSSThreadFv = .text:0x813FCC8C; // type:function size:0x58
AOSSThread_813FCCE4__Q33ipl5scene10AOSSThreadFv = .text:0x813FCCE4; // type:function size:0x50
Run__Q33ipl5scene10AOSSThreadFv = .text:0x813FCD34; // type:function size:0xEC
cancel__Q33ipl5scene10AOSSThreadFv = .text:0x813FCE20; // type:function size:0x50
finish__Q33ipl5scene10AOSSThreadFP13NCDAossConfigPi = .text:0x813FCE70; // type:function size:0x2FC
@@ -5146,7 +5146,7 @@ AOSSi_WLANConnect = .text:0x813FD72C; // type:function size:0x26C
AOSSi_Sleep = .text:0x813FD998; // type:function size:0x4
AOSSi_Status = .text:0x813FD99C; // type:function size:0x34
AOSS_SetCallback = .text:0x813FD9D0; // type:function size:0x34
RakuRakuThread_813FDA04__Q33ipl5scene14RakuRakuThreadFPUl = .text:0x813FDA04; // type:function size:0x6C scope:local
RakuRakuThread_813FDA04__Q33ipl5scene14RakuRakuThreadFv = .text:0x813FDA04; // type:function size:0x6C scope:local
__ct__Q33ipl5scene14RakuRakuThreadFPQ23EGG4Heap = .text:0x813FDA70; // type:function size:0xD8
__dt__Q33ipl5scene14RakuRakuThreadFv = .text:0x813FDB48; // type:function size:0xA4
destroy__Q33ipl5scene14RakuRakuThreadFv = .text:0x813FDBEC; // type:function size:0xD8
@@ -17078,7 +17078,7 @@ lbl_81657B18 = .data:0x81657B18; // type:object size:0x1A data:string
lbl_81657B32 = .data:0x81657B32; // type:object size:0x18 data:string
lbl_81657B4A = .data:0x81657B4A; // type:object size:0x16 data:string
__vt__Q33ipl5scene10AOSSThread = .data:0x81657B60; // type:object size:0x30
sRateTable = .data:0x81657B90; // type:object size:0x30
lbl_81657B90 = .data:0x81657B90; // type:object size:0x30
lbl_81657BC0 = .data:0x81657BC0; // type:object size:0x38 data:string
jumptable_81657BF8 = .data:0x81657BF8; // type:object size:0x20 scope:local
__vt__Q33ipl5scene14RakuRakuThread = .data:0x81657C18; // type:object size:0x30
@@ -23472,14 +23472,14 @@ lbl_81698C28 = .sbss:0x81698C28; // type:object size:0x4 data:4byte
lbl_81698C2C = .sbss:0x81698C2C; // type:object size:0x4 data:4byte
lbl_81698C30 = .sbss:0x81698C30; // type:object size:0x4 data:4byte
AOSSi_cancel_flag = .sbss:0x81698C38; // type:object size:0x4 data:4byte
AOSSi_ipAddr = .sbss:0x81698C3C; // type:object size:0x4
AOSSi_netmask = .sbss:0x81698C40; // type:object size:0x4
AOSSi_gateway = .sbss:0x81698C44; // type:object size:0x4
AOSSi_dns1 = .sbss:0x81698C48; // type:object size:0x4
AOSSi_dns2 = .sbss:0x81698C4C; // type:object size:0x4
AOSSi_alloc = .sbss:0x81698C50; // type:object size:0x4 data:4byte
AOSSi_free = .sbss:0x81698C54; // type:object size:0x4 data:4byte
AOSSi_callback = .sbss:0x81698C58; // type:object size:0x4 data:4byte
lbl_81698C3C = .sbss:0x81698C3C; // type:object size:0x4
lbl_81698C40 = .sbss:0x81698C40; // type:object size:0x4
lbl_81698C44 = .sbss:0x81698C44; // type:object size:0x4
lbl_81698C48 = .sbss:0x81698C48; // type:object size:0x4
lbl_81698C4C = .sbss:0x81698C4C; // type:object size:0x4
lbl_81698C50 = .sbss:0x81698C50; // type:object size:0x4 data:4byte
lbl_81698C54 = .sbss:0x81698C54; // type:object size:0x4 data:4byte
lbl_81698C58 = .sbss:0x81698C58; // type:object size:0x4 data:4byte
lbl_81698C60 = .sbss:0x81698C60; // type:object size:0x4 data:4byte
lbl_81698C64 = .sbss:0x81698C64; // type:object size:0x4 data:4byte
lbl_81698C68 = .sbss:0x81698C68; // type:object size:0x1 data:byte

View File

@@ -985,21 +985,21 @@ config.libs = [
Object(NonMatching, "clib/zconvert.c"),
Object(NonMatching, "clib/zi81key.c"),
Object(NonMatching, "clib/zi8alpha.c"),
Object(NonMatching, "clib/zi8alts.c"),
Object(Matching, "clib/zi8alts.c"),
Object(NonMatching, "clib/zi8cgetc.c"),
Object(NonMatching, "clib/zi8cinfo.c"),
Object(Matching, "clib/zi8copy.c"),
Object(NonMatching, "clib/zi8dawg.c"),
Object(NonMatching, "clib/zi8getc.c"),
Object(Matching, "clib/zi8getc.c"),
Object(NonMatching, "clib/zi8getc2.c"),
Object(NonMatching, "clib/zi8getSW.c"),
Object(NonMatching, "clib/zi8initd.c"),
Object(NonMatching, "clib/zi8is.c"),
Object(Matching, "clib/zi8getSW.c"),
Object(Matching, "clib/zi8initd.c"),
Object(Matching, "clib/zi8is.c"),
Object(NonMatching, "clib/zi8match.c"),
Object(NonMatching, "clib/zi8misc.c"),
Object(Matching, "clib/zi8misc.c"),
Object(NonMatching, "clib/zi8pud2.c"),
Object(NonMatching, "clib/Zi8punct.c"),
Object(NonMatching, "clib/zi8space.c"),
Object(Matching, "clib/Zi8punct.c"),
Object(Matching, "clib/zi8space.c"),
Object(NonMatching, "clib/zi8uwd.c"),
Object(Matching, "clib/zi8ver.c"),
Object(Matching, "clib/zi8ZHuwd.c"),

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

@@ -93,11 +93,7 @@ namespace textinput {
void initAspect();
#endif
#ifdef IPL_TI_MANAGER_OUT_OF_LINE
virtual void setSecretInputMode(bool secretInputMode);
#else
virtual void setSecretInputMode(bool secretInputMode) { mpInputForm->setSecretModeOn(secretInputMode); }
#endif
#ifdef IPL_ADDRESS_EDIT_CPP
void enableKSXFilter(bool compatibleFilter);
#endif
@@ -110,11 +106,7 @@ namespace textinput {
virtual void start() {}
virtual void end() {}
#ifdef IPL_TI_MANAGER_OUT_OF_LINE
virtual InputForm* getInputForm();
#else
virtual InputForm* getInputForm() { return mpInputForm; }
#endif
virtual const InputForm* getInputForm() const { return mpInputForm; }
virtual keyboard::hwkey::HWKeyboard* getHWKeyboard() { return mpHWKeyboard; }

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 {
@@ -55,11 +55,7 @@ namespace textinput {
virtual nw4r::math::VEC2 getScale() const = 0;
#ifdef IPL_TI_TEXTDRAWER_OUT_OF_LINE
virtual void setSecretModeOn(bool secretMode);
#else
virtual void setSecretModeOn(bool secretMode) { mbSecretMode = secretMode; }
#endif
virtual void doBeforeDrawProcess(const wchar_t*, u32, const DrawInfo& drawInfo);
virtual void doAfterDrawProcess(const wchar_t*, u32, const DrawInfo& drawInfo);
@@ -94,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

@@ -56,16 +56,10 @@ namespace gui {
virtual void onEvent(u32 compId, u32 event, void* data) {} // 0x08 (0x02)
#ifdef IPL_GUI_VIRTS_OUT_OF_LINE
virtual void setManager(Manager* manager); // 0x0C (0x03)
virtual void setLatestEventCtrlNo(int ctrlNo); // 0x10 (0x04)
virtual int getLatestEventCtrlNo(); // 0x14 (0x05)
#else
virtual void setManager(Manager* manager) { mpManager = manager; } // 0x0C (0x03)
virtual void setLatestEventCtrlNo(int ctrlNo) { mLatestCtrlNum = ctrlNo; } // 0x10 (0x04)
virtual int getLatestEventCtrlNo() { return mLatestCtrlNum; } // 0x14 (0x05)
#endif
protected:
Manager* mpManager; // 0x04
@@ -91,11 +85,7 @@ namespace gui {
virtual bool isPointed(int point) { return mbPointed[point]; } // 0x24 (0x09)
virtual bool isDragging(int point) { return mbDragging[point]; } // 0x28 (0x0A)
#ifdef IPL_GUI_VIRTS_OUT_OF_LINE
virtual void setPointed(int point, bool bEnable); // 0x2C (0x0B)
#else
virtual void setPointed(int point, bool bEnable) { mbPointed[point] = bEnable; } // 0x2C (0x0B)
#endif
virtual void onPoint(int point) { mFlightDuration[point] = 0; } // 0x30 (0x0C)
virtual void offPoint(int point) { mFlightDuration[point] = 0; } // 0x34 (0x0D)
@@ -262,11 +252,7 @@ namespace gui {
virtual bool contain(f32 x, f32 y); // 0x68 (0x1A)
virtual void setPane(nw4r::lyt::Pane* pane) { mpPane = pane; } // 0x6C (0x1B)
#ifdef IPL_GUI_VIRTS_OUT_OF_LINE
virtual nw4r::lyt::Pane* getPane(); // 0x70 (0x1C)
#else
virtual nw4r::lyt::Pane* getPane() { return mpPane; } // 0x70 (0x1C)
#endif
private:
nw4r::lyt::Pane* mpPane; // 0x88

View File

@@ -31,11 +31,6 @@ namespace ipl {
virtual void calc();
#ifdef IPL_FADER_SCENE_BASE_VIRTS_OUT_OF_LINE
virtual void initCalcNormal(); // 0x4C
virtual void initCalcFadeout(); // 0x50
virtual void calcCommon(); // 0x54
#else
virtual void initCalcNormal() {
} // 0x4C
virtual void initCalcFadeout() {
@@ -43,7 +38,6 @@ namespace ipl {
virtual void calcCommon() {
} // 0x54
#endif
virtual FaderSceneCommand calcFadein() {
return FADER_SCN_NEXT;
@@ -55,12 +49,8 @@ namespace ipl {
return FADER_SCN_NEXT;
} // 0x60
#ifdef IPL_FADER_SCENE_BASE_VIRTS_OUT_OF_LINE
virtual void calcCommonAfter(); // 0x64
#else
virtual void calcCommonAfter() {
} // 0x64
#endif
int getSceneFadeState() {
return mScnFadeState;

View File

@@ -62,26 +62,14 @@ namespace ipl {
virtual ~Base();
/** @brief If the scene is ready */
#ifdef IPL_SCENE_BASE_VIRTS_OUT_OF_LINE
virtual BOOL isReady() const;
#else
virtual BOOL isReady() const { return FALSE; }
#endif
/** @brief If the user can power off/reset the system */
virtual BOOL isResetAcceptable() const { return TRUE; }
/** @brief The scene running code when powering off/resetting the system */
#ifdef IPL_SCENE_BASE_VIRTS_OUT_OF_LINE
virtual void startResetting();
#else
virtual void startResetting() {}
#endif
/** @brief If the scene has finished its powering off/resetting task */
#ifdef IPL_SCENE_BASE_VIRTS_OUT_OF_LINE
virtual BOOL isResetProcessDone();
#else
virtual BOOL isResetProcessDone() { return TRUE; }
#endif
/** @brief Prepare to create scene */
virtual void prepare() {}
@@ -94,17 +82,10 @@ namespace ipl {
/** @brief Destroy the scene and clear from memory */
virtual void destroy() {}
#ifdef IPL_SCENE_BASE_VIRTS_OUT_OF_LINE
virtual Base* getParent();
virtual Base* getChild();
virtual Base* getNext();
virtual Base* getPrev();
#else
virtual Base* getParent() { return (Base*)mpParent; }
virtual Base* getChild() { return (Base*)mpChild; }
virtual Base* getNext() { return (Base*)mpNext; }
virtual Base* getPrev() { return (Base*)mpPrev; }
#endif
/** @brief Check if scene has been created.*/
bool isSceneCreated() const { return (mScnState & SCN_STATE_CREATED); }

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

@@ -28,7 +28,16 @@ namespace ipl {
#ifdef IPL_SETTING_IMPLEMENTATION
class Setting;
class APScanThread;
class APEvent;
class APEvent : public ::gui::EventHandler {
public:
APEvent(Setting* setting) : ::gui::EventHandler(), mpSetting(setting) {}
virtual void onEvent(u32 componentID, u32 event, void* data);
private:
Setting* mpSetting;
};
struct SettingAnimation {
u8 unknown[0x14];
@@ -107,7 +116,7 @@ namespace ipl {
void initScroll();
void updateScroll();
void setAPDraw();
u8 getRadioLevel(const WDBssDesc_* descriptor);
int getRadioLevel(const WDBssDesc_* descriptor);
void setUseEULA_Init_();
void setUseEULA_Cancel_();
void setUseEULA_Start_();
@@ -149,48 +158,12 @@ namespace ipl {
virtual void destroy();
virtual void prepare();
virtual void create();
virtual void calc();
virtual void draw();
virtual FaderSceneCommand calcFadein();
virtual FaderSceneCommand calcNormal();
virtual FaderSceneCommand calcFadeout();
virtual BOOL isResetAcceptable() const;
virtual void unkv_0x68() = 0;
virtual void unkv_0x6C() = 0;
virtual void unkv_0x70() = 0;
virtual void unkv_0x74() = 0;
virtual void unkv_0x78() = 0;
virtual void unkv_0x7C() = 0;
virtual void unkv_0x80() = 0;
virtual void unkv_0x84() = 0;
virtual void unkv_0x88() = 0;
virtual void unkv_0x8C() = 0;
virtual void unkv_0x90() = 0;
virtual void unkv_0x94() = 0;
virtual void unkv_0x98() = 0;
virtual void unkv_0x9C() = 0;
virtual void unkv_0xA0() = 0;
virtual void unkv_0xA4() = 0;
virtual void unkv_0xA8() = 0;
virtual void unkv_0xAC() = 0;
virtual void unkv_0xB0() = 0;
virtual void unkv_0xB4() = 0;
virtual void unkv_0xB8() = 0;
virtual void unkv_0xBC() = 0;
virtual void unkv_0xC0() = 0;
virtual void unkv_0xC4() = 0;
virtual void unkv_0xC8() = 0;
virtual void unkv_0xCC() = 0;
virtual void unkv_0xD0() = 0;
virtual void unkv_0xD4() = 0;
virtual void unkv_0xD8() = 0;
virtual void unkv_0xDC() = 0;
virtual void unkv_0xE0() = 0;
virtual void unkv_0xE4() = 0;
virtual void unkv_0xE8() = 0;
virtual void unkv_0xEC() = 0;
virtual void unkv_0xF0() = 0;
virtual void unkv_0xF4() = 0;
virtual void unkv_0xF8() = 0;
#endif
u16 getProfileID();
@@ -289,18 +262,6 @@ namespace ipl {
#endif
};
#ifdef IPL_SETTING_IMPLEMENTATION
class APEvent : public ::gui::EventHandler {
public:
APEvent(Setting* setting) : ::gui::EventHandler(), mpSetting(setting) {}
virtual void onEvent(u32 componentID, u32 event, void* data);
private:
Setting* mpSetting;
};
#endif
} // namespace scene
} // namespace ipl

View File

@@ -50,17 +50,10 @@ namespace ipl {
} KeyboardType;
typedef struct KeyboardSetting {
#ifdef IPL_SETTING_IMPLEMENTATION
u32 rowLimit; // 0x00
const wchar_t* wcString; // 0x04
u32 stringLimit; // 0x08
KeyboardType type; // 0x0C
#else
KeyboardType type; // 0x00
const wchar_t* wcString; // 0x04
u32 stringLimit; // 0x08
u32 rowLimit; // 0x0C
#endif
#ifdef IPL_ADDRESS_EDIT_CPP
KeyboardSetting(KeyboardType keyboardType, const wchar_t* value, u32 limit, u32 rows);
#endif

View File

@@ -15,9 +15,8 @@ namespace ipl {
const wchar_t* getMessage(u32 id) const { return mpMessage->getMessage(id); }
void setResource(u8* msgData) const { mpMessage->setResource(msgData); }
void initMessage();
private:
void initMessage();
Message* mpMessage; // 0x00
};

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

@@ -56,7 +56,6 @@ namespace ipl {
void stop() { mState = ANIM_STATE_STOP; }
bool isPlaying() const { return mState == ANIM_STATE_PLAY; }
bool isPlaying() const volatile { return mState == ANIM_STATE_PLAY; }
protected:
f32 mMaxFrame; // 0x04

View File

@@ -48,12 +48,7 @@ namespace nw4r {
Pane(const res::Pane* pBlock);
virtual ~Pane(); // 0x08
#ifdef IPL_LYT_PANE_RTTI_OUT_OF_LINE
virtual const nw4r::ut::detail::RuntimeTypeInfo* GetRuntimeTypeInfo() const;
static const nw4r::ut::detail::RuntimeTypeInfo typeInfo;
#else
NW4R_UT_RUNTIME_TYPEINFO;
#endif
virtual void CalculateMtx(const DrawInfo& drawInfo); // 0x10
@@ -110,11 +105,7 @@ namespace nw4r {
void SetSize(const Size& size) { mSize = size; }
bool IsVisible() { return detail::TestBit(mFlag, BIT_VISIBLE); };
#ifdef IPL_LYT_PANE_SETVISIBLE_OUT_OF_LINE
void SetVisible(bool visible);
#else
void SetVisible(bool visible) { detail::SetBit(&mFlag, BIT_VISIBLE, visible); };
#endif
bool IsInfluencedAlpha() { return detail::TestBit(mFlag, BIT_INFLUENCED_ALPHA); };
void SetInfluencedAlpha(bool visible) { detail::SetBit(&mFlag, BIT_INFLUENCED_ALPHA, visible); };

View File

@@ -160,11 +160,12 @@ typedef struct _ziGetParam {
ziWChar* candidates; // 0x18
ziU8 maxCandidates; // 0x1C
ziWChar firstCandidate; // 0x1E
ziU8 wordCandidates; // 0x1F
ziU8 unk_0x20; // 0x20
ziU8 count; // 0x20
ziU8 letters; // 0x21
ziU8* scratch; // 0x22
ziU8 count; // 0x22
ziU8* scratch; // 0x24
ziU32 unk_0x28; // 0x28
} ziGetParam;
typedef struct _ziLanguageEntry {
@@ -172,20 +173,195 @@ typedef struct _ziLanguageEntry {
ziU8* tableData; // 0x04
} ziLanguageEntry;
typedef struct _zi8DawgRec {
ziU8* node;
ziU32 attr;
ziU16 key;
ziU8 unk_0x0A[2];
ziU8* back;
} zi8DawgRec;
typedef struct _zi8DawgCtx {
ziU8 lang; // 0x00
ziU8 key; // 0x01
ziU16 cnt; // 0x02
ziU16 cap; // 0x04
ziU8 unk_0x06[2];
ziU8* p08; // 0x08
ziU8* p0C; // 0x0C
ziU8* table; // 0x10
ziU8* p14; // 0x14
zi8DawgRec recs[0x32]; // 0x18
ziU32 unk_0x338; // 0x338
} zi8DawgCtx;
typedef struct _ziUwdNode {
struct _ziUwdNode* next;
ziU8* word;
} ziUwdNode;
struct __zi8_work_data_s {
ziU8 unk_0x00;
ziU8 unk_0x01;
ziU8 unk_0x02[2];
ziLanguageEntry* langEntries; // 0x04
ziU32 unk_0x08;
ziU8 unk_0x08;
ziU8 unk_0x09;
ziU8 unk_0x0A;
ziU8 unk_0x0B;
ziU32 unk_0x0C;
ziU32 unk_0x10;
ziU32 unk_0x14;
ziU16 unk_0x14;
ziU8 unk_0x16;
ziU8 unk_0x17;
ziU8 unk_0x18;
ziU8 unk_0x1C[0x108];
ziU8 unk_0x19;
ziU16 unk_0x1A;
ziU8 unk_0x1C[3];
ziU8 unk_0x1F;
ziU16 unk_0x20[0x40];
ziU16 unk_0xA0[0x42];
ziU16* unk_0x124[1];
ziU8* unk_0x128;
ziU8 unk_0x12C;
ziU8 unk_0x12D;
ziU8 unk_0x12E;
ziU8 unk_0x12F;
ziPtr unk_0x130[2];
ziU8 unk_0x138;
ziU8 unk_0x139[3];
ziU32 unk_0x13C;
ziU8 unk_0x140;
ziU8 unk_0x141[0x43];
ziU8 unk_0x184[0x43];
ziU8 uwdCount; // 0x1C7
ziUwdNode uwdNodes[0x20]; // 0x1C8
ziUwdNode* uwdList; // 0x2C8
ziU32 pudTable[0x10]; // 0x2CC
ziU8 pudCount; // 0x30C
ziU8 unk_0x30D[3];
ziU32 unk_0x310;
ziU32 unk_0x314;
ziU32 unk_0x318;
ziU8 pdRemoveOpt; // 0x31C
ziU8 unk_0x31D;
ziU8 unk_0x31E;
ziU8 unk_0x31F;
ziU8 (*oemMatch)(ziU16 idx, ziWChar* buf, ziU8 len, ziPtr data); //0x320
ziU16 oemLen; //0x324
ziU8 unk_0x326[2];
ziU32 oemIdx; //0x328
ziPtr oemData; //0x32C
ziU8 unk_0x330[8];
ziU32 unk_0x338;
ziU8 unk_0x33C[0x1FC];
ziU8 unk_0x538;
ziU8 unk_0x539;
ziU8 unk_0x53A[0x40];
ziWChar unk_0x57A[0x641];
ziPtr unk_0x11FC;
ziPtr userKeys[0x83]; // 0x1200
ziU8 unk_0x140C[4];
ziU32 unk_0x1410;
ziU8 unk_0x1414[4];
ziU8 unk_0x1418;
ziU8 unk_0x1419;
ziU16 unk_0x141A;
ziU8 unk_0x141C;
ziU8 unk_0x141D;
ziU8 unk_0x141E;
ziU8 unk_0x141F;
ziU8 unk_0x1420[4];
zi8DawgCtx dawgCtx; // 0x1424
ziU8 unk_0x1760[4]; // 0x1760
ziU8* unk_0x1764; // 0x1764
ziU8 unk_0x1768;
ziU8 unk_0x1769[0x81];
ziU16 unk_0x17EA;
ziU8 unk_0x17EC;
ziU8 unk_0x17ED[3];
ziU8* unk_0x17F0;
ziWChar unk_0x17F4[0x40]; // 0x17F4..0x1874
ziU16 unk_0x1874;
ziU8 unk_0x1876;
ziU8 unk_0x1877;
ziU8 unk_0x1878;
ziU8 unk_0x1879;
ziWChar unk_0x187A[0x41];
ziU8 unk_0x18FC;
ziU8 unk_0x18FD;
ziWChar unk_0x18FE[0x41];
ziU8 unk_0x1980;
ziU8 unk_0x1981;
ziU8 unk_0x1982;
ziU8 unk_0x1983;
ziU8 unk_0x1984;
ziU8 unk_0x1985;
ziU8 unk_0x1986;
ziU8 unk_0x1987;
ziWChar unk_0x1988[0x41];
ziU8 unk_0x1A0A;
ziU8 unk_0x1A0B[0x85];
ziWChar unk_0x1A90;
ziWChar unk_0x1A92[0x41];
ziU8 unk_0x1B14;
ziU8 unk_0x1B15[3];
ziU16* unk_0x1B18;
ziU16 unk_0x1B1C;
ziU16 unk_0x1B1E;
ziU16 unk_0x1B20;
ziU16 unk_0x1B22;
ziU8 unk_0x1B24;
ziU8 unk_0x1B25[3];
union {
ziU32 word;
struct {
ziU32 msb : 1;
} bits;
} unk_0x1B28;
union {
ziU32 word;
struct {
ziU32 msb : 1;
} bits;
} unk_0x1B2C;
ziU8 unk_0x1B30;
ziU8 unk_0x1B31;
ziU16 unk_0x1B32;
ziU16 unk_0x1B34;
ziU16 unk_0x1B36;
ziU16 unk_0x1B38;
ziU8 unk_0x1B3A;
ziU8 unk_0x1B3B;
ziU8 unk_0x1B3C;
ziU8 unk_0x1B3D;
ziU8 unk_0x1B3E;
ziU8 unk_0x1B3F;
ziU16 unk_0x1B40;
ziU8 unk_0x1B42[2];
};
typedef struct ziMatchParam {
ziU8 count; // 0x00
ziU8 arr1[0xC]; // 0x01
ziU8 arrD[0xC]; // 0x0D
ziU8 arr19[4]; // 0x19
ziU8 arr1D[4]; // 0x1D
ziU8 pad_0x21; // 0x21
ziU16 field22; // 0x22
ziU8 length; // 0x24
ziU8 nCand; // 0x25
ziWChar phon[0x10]; // 0x26
ziWChar phon2[0x10]; // 0x46
ziWChar first; // 0x66
ziWChar first2; // 0x68
ziWChar comp; // 0x6A
ziU8 nSeg; // 0x6C
ziU8 segs1[0xC0]; // 0x6D
ziU8 segsD[0xC0]; // 0x12D
ziU8 pad_0x1ED; // 0x1ED
} ziMatchParam;
#define ZI_WORK ((struct __zi8_work_data_s*)__zi8_work_data)
#define ZI_NEED_WORK , ziPtr __zi8_work_data

View File

@@ -0,0 +1,49 @@
#include <zi8clib/zitypes.h>
const ziWChar Zi8PunctTable[40] = {
0xFF0C, 0x3002, 0x3001, 0xFF1A, 0xFF1F, 0xFF01, 0x3005, 0x2026,
0x2015, 0xFF1B, 0xFF0E, 0x30FB, 0x201C, 0x201D, 0xFF08, 0xFF09,
0x300C, 0x300D, 0xFF10, 0xFF11, 0xFF12, 0xFF13, 0xFF14, 0xFF15,
0xFF16, 0xFF17, 0xFF18, 0xFF19, 0xFF0F, 0xFF05, 0xFFE5, 0xFF04,
0xFFE1, 0x20AC, 0x203B, 0xFF20, 0x0000,
};
ziS32 Zi8Punctuation(ziGetParam* param ZI_NEED_WORK) {
ziS32 limit = ((ziU16*)__zi8_work_data)[8] - 1;
ziS32 count = 0;
ziU8 i = 0;
ziU16 fc = param->firstCandidate;
ziU16 j = 0;
for (;;) {
if (Zi8PunctTable[j] == 0) {
break;
}
if (fc == 0) {
count++;
if (ZI_WORK->unk_0x00 == 0) {
param->candidates[i++] = Zi8PunctTable[j];
if ((param->context & 0x10) != 0) {
param->candidates[i++] = 0x20;
if ((ziU8)i >= limit) {
break;
}
}
if (count >= param->maxCandidates) {
break;
}
} else {
if (count >= (ziS32)ZI_WORK->unk_0x0C) {
return count;
}
}
} else {
fc--;
}
j++;
}
if (ZI_WORK->unk_0x00 == 0) {
param->letters = count;
}
return count;
}

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,108 @@
#include <zi8clib/zitypes.h>
ziU16 Zi8MatchAltSound(ziU8* elements, ziU16 count, ziU8* table, ziU16 ch,
ziU32 mask, ziU16 target, ziU8 flags ZI_NEED_WORK) {
ziU8 hi;
ziU8 lo;
ziS32 i;
ziS32 j;
ziS32 mid;
ziU16 off;
ziU16 w;
hi = (ziU8)((ziU16)ch >> 8);
lo = (ziU8)ch;
flags = (ziU8)(flags >> 3);
if (count == 0) {
return 0;
}
j = 0;
i = count - 1;
if ((elements + i * 4)[1] == hi && (elements + i * 4)[0] == lo) {
j = i;
goto up;
}
if ((elements + j * 4)[1] == hi && (elements + j * 4)[0] == lo) {
goto up;
}
goto search;
up:
i = j;
body:
if (((elements + i * 4)[3] & 0xE) == 0 ||
((elements + i * 4)[3] & flags) != 0) {
off = (ziU16)(((ziU16)(elements + i * 4)[2] |
(((ziU16)(elements + i * 4)[3] & 1) << 8)) << 1);
w = (ziU16)((((ziU16)(elements + i * 4)[3] & 0xF0) >> 4) |
(table[off] | ((ziU16)table[off + 1] << 8)));
if (target == (w & (ziU16)mask)) {
return w;
}
}
i++;
if (i >= count) {
goto down_start;
}
if ((elements + i * 4)[1] == hi && (elements + i * 4)[0] == lo) {
goto body;
}
down_start:
i = j;
goto dec;
down_body:
if (((elements + i * 4)[3] & 0xE) == 0 ||
((elements + i * 4)[3] & flags) != 0) {
off = (ziU16)(((ziU16)(elements + i * 4)[2] |
(((ziU16)(elements + i * 4)[3] & 1) << 8)) << 1);
w = (ziU16)((((ziU16)(elements + i * 4)[3] & 0xF0) >> 4) |
(table[off] | ((ziU16)table[off + 1] << 8)));
if (target == (w & (ziU16)mask)) {
return w;
}
}
dec:
i--;
if (i < 0) {
goto fail;
}
if ((elements + i * 4)[1] == hi && (elements + i * 4)[0] == lo) {
goto down_body;
}
fail:
return 0;
search:
if ((elements + j * 4)[1] == hi && (elements + j * 4)[0] == lo) {
goto up;
}
if ((((ziU16)(elements + j * 4)[1] << 8) | (ziU16)(elements + j * 4)[0]) > ch) {
return 0;
}
mid = (j + i) / 2;
if (mid == j) {
return 0;
}
if ((((ziU16)(elements + mid * 4)[1] << 8) | (ziU16)(elements + mid * 4)[0]) >= ch) {
i = mid;
goto hi_check;
}
j = mid;
goto search;
hi_check:
if ((elements + i * 4)[1] == hi && (elements + i * 4)[0] == lo) {
j = i;
goto up;
}
if ((((ziU16)(elements + i * 4)[1] << 8) | (ziU16)(elements + i * 4)[0]) < ch) {
return 0;
}
mid = (j + i) / 2;
if (mid == j) {
return 0;
}
if ((((ziU16)(elements + mid * 4)[1] << 8) | (ziU16)(elements + mid * 4)[0]) >= ch) {
i = mid;
goto hi_check;
}
j = mid;
goto search;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,212 @@
#include <zi8clib/zierror.h>
extern ziU16 Zi8GetTableCount(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
extern ziU8 Zi8getKeyLayout(ziU8 lang, ziU16 key, ziWChar* layout, ziU8 mode ZI_NEED_WORK);
extern ziChar Zi8ConvertWC2UC(ziWChar ch, ziU8 language ZI_NEED_WORK);
extern ziU32 Zi8AlphaGetCandidates(ziGetParam* param, ziPtr sw ZI_NEED_WORK);
extern ziU8 Zi8SyllablesROMdata(ziWChar* keys, ziU8 count, ziU8 lang, ziWChar* out,
ziU16 a, ziU8 b, ziU8* cntOut, ziU8 c ZI_NEED_WORK);
typedef struct _ziSwParam {
ziU8 flag;
ziU8 unk_0x01[0xB];
ziS32 count;
ziU16 cap;
ziU8 unk_0x12[2];
} ziSwParam;
ziU32 Zi8GetSyllablesCandidates(ziGetParam* param, ziSwParam* sw ZI_NEED_WORK) {
ziWChar buf[0x40];
ziWChar buf2[0x32];
ziS32 rem;
ziS32 cur;
ziS32 firstCand;
ziS32 count;
ziWChar* pNext;
ziU16 err;
ziU8 flag14;
ziU8 flag13;
ziU8 flag12;
ziU8 flag11;
ziU8 sylCnt;
ziWChar* out;
ziU8* u28;
ziS32 i;
firstCand = param->firstCandidate;
count = 0;
u28 = 0;
pNext = 0;
flag14 = 1;
flag13 = 1;
flag12 = 0;
flag11 = 0;
sylCnt = 0;
err = 0x64;
if (param->currentWord != 0 && param->wordCharCount != 0 &&
param->currentWord[param->wordCharCount - 1] != 0x20) {
flag11 = 1;
}
if (param->elementCount == 0 || (param->elementCount == 1 && flag11 == 0)) {
count = Zi8AlphaGetCandidates(param, sw, ZI_WORK);
goto end;
}
if (sw->flag != 0 || (param->getOptions & 0xFD) != 0x81) {
out = buf;
rem = 0x40;
} else {
out = (ziWChar*)param->candidates;
rem = sw->cap - 1;
}
if ((param->getOptions & 0xFD) == 0x80) {
u28 = (ziU8*)param->candidates;
rem = sw->cap - 1;
}
if (rem <= param->elementCount) {
err = 0x168;
goto end;
}
if ((Zi8GetTableCount(param->language, 0x1F, ZI_WORK) & 8) != 0) {
flag14 = 0;
}
if (param->elements[0] == 0xEFF1 && param->elementCount > 1 && flag14 != 0) {
buf[0] = 0x2D;
} else {
Zi8getKeyLayout(param->language, param->elements[0], buf, 1, ZI_WORK);
}
out[0] = buf[0];
Zi8SyllablesROMdata(param->elements, param->elementCount, param->language, out,
(ziU16)rem, 0, &sylCnt, flag11, ZI_WORK);
if (sylCnt != 0) {
cur = sylCnt;
} else {
cur = 1;
}
if (cur == param->elementCount) goto L5dc;
if (firstCand != 0) {
firstCand--;
goto L5dc;
}
if (sw->flag != 0) {
if (++count >= sw->count) goto end;
goto L5dc;
}
for (i = cur; i < param->elementCount; i += sylCnt) {
if (param->elements[i] == 0xEFF1 && param->elementCount - i > 1 && flag14 != 0) {
buf2[0] = 0x2D;
} else {
Zi8getKeyLayout(param->language, param->elements[i], buf2, 1, ZI_WORK);
}
out[i] = buf2[0];
Zi8SyllablesROMdata(param->elements + i, param->elementCount - i, param->language,
out + i, (ziU16)rem, 0, &sylCnt, 1, ZI_WORK);
if (sylCnt == 0) {
sylCnt = 1;
}
}
if (u28 != 0) {
for (i = 0; i < param->elementCount; i++) {
u28[i] = Zi8ConvertWC2UC(out[i], param->language, ZI_WORK);
}
u28[i++] = 0;
u28[i] = 0;
u28 += i;
} else {
out[i++] = 0;
out[i] = 0;
out += i;
}
rem -= i;
if (++count >= param->maxCandidates) goto end;
if (rem > param->elementCount) goto L5dc;
goto end;
L5dc:
while (cur >= 1) {
flag12 = 0;
goto rom;
found:
flag12 = 1;
if (cur == 1) {
flag13 = 0;
}
L464:
if (out[0] >= 0xEFF1 && out[0] <= 0xF010) {
goto dec;
}
L464b:
if (firstCand != 0) {
firstCand--;
goto L560;
}
if (sw->flag != 0) {
if (++count >= sw->count) goto end;
goto L560;
}
if (u28 != 0) {
for (i = 0; i < cur; i++) {
u28[i] = Zi8ConvertWC2UC(out[i], param->language, ZI_WORK);
}
u28[i++] = 0;
u28[i] = 0;
u28 += i;
} else {
i = cur;
out[i++] = 0;
out[i] = 0;
out += i;
}
rem -= i;
if (++count >= param->maxCandidates) goto end;
if (rem <= cur) goto end;
L560:
if (pNext != 0) {
if (*pNext == 0) goto end;
out[0] = *pNext++;
goto L464b;
}
rom:
if (Zi8SyllablesROMdata(param->elements, (ziU8)cur, param->language, out,
(ziU16)rem, flag12, 0, flag11, ZI_WORK) != 0) {
goto found;
}
dec:
cur--;
}
if (flag13 == 0) goto end;
if (param->elements[0] == 0xEFF1 && param->elementCount > 1 && flag14 != 0) {
buf2[0] = 0x2D;
buf2[1] = 0;
Zi8getKeyLayout(param->language, param->elements[0], &buf2[1], 1, ZI_WORK);
for (i = 1; buf2[i] != 0; i++) {
if (buf2[i] == 0x2D) break;
}
while (buf2[i] != 0) {
buf2[i] = buf2[i + 1];
i++;
}
} else {
Zi8getKeyLayout(param->language, param->elements[0], buf2, 1, ZI_WORK);
}
cur = 1;
pNext = buf2;
goto L560;
end:
if (sw->flag != 0) {
param->letters = 0;
} else {
param->letters = (ziU8)count;
}
Zi8LogError(err, ZI_WORK);
return count;
}

View File

@@ -0,0 +1,15 @@
#include <zi8clib/zi8getc.h>
#include <zi8clib/zitypes.h>
extern ziU8 _Zi8GetCandidates(ziGetParam* getParam ZI_NEED_WORK);
ziU8 Zi8GetCandidates(ziGetParam* getParam ZI_NEED_WORK) {
ZI_WORK->unk_0x1B3A = 0;
ZI_WORK->unk_0x1B3C = 0;
ZI_WORK->unk_0x1B3B = 0;
ZI_WORK->unk_0x1B3D = 0;
ZI_WORK->unk_0x1B36 = 0;
ZI_WORK->unk_0x1B32 = 0;
ZI_WORK->unk_0x1B34 = 0;
return _Zi8GetCandidates(getParam, ZI_WORK);
}

View File

@@ -0,0 +1,75 @@
#include <zi8clib/zitypes.h>
#include <zi8clib/zierror.h>
extern void Zi8Memset(ziPtr p, ziU32 v, ziU32 len);
extern void Zi8SetLatinSearchOrder(ziU32 a, ziU8 b ZI_NEED_WORK);
extern void ZADP_Zi8SetPDremoveOpt(ziU8 a ZI_NEED_WORK);
extern ziU16 Zi8GetFormatVersion(ziU8 a ZI_NEED_WORK);
extern void Zi8ZHsetZYfuzzyPairs(ziU32* a ZI_NEED_WORK);
extern void Zi8ZHsetPYfuzzyPairs(ziU32* a ZI_NEED_WORK);
extern void Zi8SetParentalControls(ziU8 a ZI_NEED_WORK);
ziU8 Zi8InitializeDynamic(ziLanguageEntry* langEntries ZI_NEED_WORK) {
ziU32 zyFuzzy;
ziU32 pyFuzzy;
ziU32* pzyFuzzy;
ziU32* ppyFuzzy;
Zi8Memset(__zi8_work_data, 0, 0x1B44);
ZI_WORK->unk_0x08 = 1;
ZI_WORK->unk_0x09 = 1;
ZI_WORK->unk_0x0A = 0xFF;
ZI_WORK->unk_0x10 = 0x64;
*(ziU16*)&ZI_WORK->unk_0x0C = 0xFFFF;
ZI_WORK->unk_0x1A = 0x20;
ZI_WORK->unk_0x1C[2] = 0;
ZI_WORK->unk_0x1B30 = 0;
ZI_WORK->unk_0x1B3A = 0;
ZI_WORK->unk_0x1B36 = 0;
ZI_WORK->unk_0x1B32 = 0;
ZI_WORK->unk_0x1B34 = 0;
ZI_WORK->unk_0x1B3B = 0;
ZI_WORK->unk_0x1B3C = 0;
ZI_WORK->unk_0x1B40 = 0;
ZI_WORK->unk_0x1B38 = 0;
ZI_WORK->langEntries = langEntries;
if (ZI_WORK->langEntries == ZI8_NULL) {
Zi8LogError(0x578, ZI_WORK);
return 0;
}
if (ZI_WORK->langEntries->language == 0) {
Zi8LogError(0x582, ZI_WORK);
return 0;
}
ZI_WORK->unk_0x1874 = 0x2D;
ZI_WORK->unk_0x538 = 0;
ZI_WORK->unk_0x1C[3] = 0;
ZI_WORK->unk_0x141A = 0x100;
Zi8SetLatinSearchOrder(0, 0, ZI_WORK);
ZADP_Zi8SetPDremoveOpt(1, ZI_WORK);
ZI_WORK->unk_0x17 = 5;
ZI_WORK->unk_0x16 = Zi8GetFormatVersion(1, ZI_WORK) & 2;
ZI_WORK->unk_0x1B28.bits.msb = 1;
ZI_WORK->unk_0x1B2C.bits.msb = 1;
zyFuzzy = ZI_WORK->unk_0x1B2C.word;
pzyFuzzy = &zyFuzzy;
Zi8ZHsetZYfuzzyPairs(pzyFuzzy, ZI_WORK);
pyFuzzy = ZI_WORK->unk_0x1B28.word;
ppyFuzzy = &pyFuzzy;
Zi8ZHsetPYfuzzyPairs(ppyFuzzy, ZI_WORK);
Zi8SetParentalControls(2, ZI_WORK);
Zi8LogError(0x64, ZI_WORK);
return 1;
}
ziU8 Zi8IsZicorpSignature(ziU16* p, ziU16 len) {
if ((ziU16)len > 6 && p[0] == 0x7A && p[1] == 0x69 && p[2] == 0x63 &&
p[3] == 0x6F && p[4] == 0x72 && p[5] == 0x70) {
return 1;
}
if ((ziU16)len > 6 && p[0] == 0x39 && p[1] == 0x34 && p[2] == 0x32 &&
p[3] == 0x36 && p[4] == 0x37 && p[5] == 0x37) {
return 1;
}
return 0;
}

View File

@@ -0,0 +1,138 @@
#include <zi8clib/zi8is.h>
#include <zi8clib/zierror.h>
extern ziU8 Zi8LangSupported(ziU8 lang ZI_NEED_WORK);
extern ziU16 Zi8GetTableCount(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
extern ziU32 Zi8GetTableAddress(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
extern ziU8 _Zi8GetCandidates(ziGetParam* getParam ZI_NEED_WORK);
extern void Zi8Memset(ziPtr p, ziU32 v, ziU32 len);
ziU8 Zi8GetZHCharSet(ziPtr workData) {
ziU8 charSet = 0;
ziU8 bak;
ziU16 v0;
ziU16 v1;
ziU16 v2;
ziU32 addr;
ziU8* p;
ziWChar candBuf[0x10];
ziGetParam getParam;
Zi8LogError(0x64, workData);
if (Zi8LangSupported(1, workData) == 0) {
Zi8ReplaceLastError(0x26C, workData);
return 0;
}
if (Zi8GetTableCount(1, 10, workData) != 0) {
bak = ((struct __zi8_work_data_s*)workData)->unk_0x18;
((struct __zi8_work_data_s*)workData)->unk_0x18 = 1;
addr = Zi8GetTableAddress(1, 10, workData);
p = (ziU8*)addr;
v0 = (ziU16)((ziU16)p[0] | ((ziU16)p[1] << 8));
((struct __zi8_work_data_s*)workData)->unk_0x18 = 0;
addr = Zi8GetTableAddress(1, 10, workData);
p = (ziU8*)addr;
v1 = (ziU16)((ziU16)p[2] | ((ziU16)p[3] << 8));
v2 = (ziU16)((ziU16)p[4] | ((ziU16)p[5] << 8));
((struct __zi8_work_data_s*)workData)->unk_0x18 = bak;
if (v0 != 0) {
if (v0 > 0x4E20) {
charSet |= 8;
} else {
charSet |= 1;
}
}
if (v1 != 0) {
if (v1 > 0x2710) {
charSet |= 2;
} else {
charSet |= 0x10;
}
}
if (v2 != 0) {
charSet |= 4;
}
return charSet;
}
Zi8Memset(&getParam, 0, 0x2C);
getParam.language = 1;
getParam.context = 1;
getParam.getOptions = 0;
getParam.candidates = candBuf;
getParam.maxCandidates = 1;
getParam.subLanguage = 1;
retry:
getParam.getMode = 0;
if (_Zi8GetCandidates(&getParam, workData) != 0) {
charSet |= getParam.subLanguage;
goto next;
}
getParam.getMode = 1;
if (_Zi8GetCandidates(&getParam, workData) != 0) {
charSet |= getParam.subLanguage;
goto next;
}
getParam.getMode = 2;
if (_Zi8GetCandidates(&getParam, workData) != 0) {
charSet |= getParam.subLanguage;
}
next:
if (getParam.subLanguage == 1) {
getParam.subLanguage = 4;
goto retry;
}
if (getParam.subLanguage == 4) {
getParam.subLanguage = 2;
goto retry;
}
return charSet;
}
ziBool Zi8IsComponent(ziWChar ch ZI_NEED_WORK) {
if (ch >= 0xEF10 && ch < 0xF305) {
return 1;
}
return 0;
}
ziBool Zi8IsCharacter(ziWChar ch ZI_NEED_WORK) {
ziU16 count;
ziU8 hi;
ziU8 lo;
ziU32 addr;
ziU8* table;
ziU16 i;
if (ch >= 0x3105 && ch <= 0x3129) {
return 1;
}
switch (ch) {
case 0x2C7:
case 0x2C9:
case 0x2CA:
case 0x2CB:
case 0x2D9:
return 1;
}
switch (ch) {
case 0x3002:
case 0xFF01:
case 0xFF0C:
case 0xFF1F:
return 1;
}
hi = (ziU8)(((ziU16)ch >> 8) & 0xFF);
lo = (ziU8)ch;
count = Zi8GetTableCount(1, 0, ZI_WORK);
addr = Zi8GetTableAddress(1, 0, ZI_WORK);
table = (ziU8*)addr;
for (i = 0; i < count; i++) {
if (table[6] == hi && table[7] == lo) {
return 1;
}
table += 0xC;
}
return 0;
}

View File

@@ -0,0 +1,144 @@
#include <zi8clib/zitypes.h>
#include <zi8clib/zierror.h>
extern ziU16 Zi8GetTableCount(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
extern ziU32 Zi8GetTableAddress(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
typedef struct { ziU8 b[0xC]; } ziE12;
#define WORKP ((struct __zi8_work_data_s*)__zi8_work_data)
ziU16 Zi8Uni2Ptr(ziU16 ch, ziE12* buf ZI_NEED_WORK) {
ziU8 hi;
ziU8 lo;
ziU16 count;
ziU32 table;
ziU32 table2;
ziU16 i;
ziU8* e;
ziU8* p;
hi = (ziU8)(((ziU16)ch >> 8) & 0xFF);
lo = (ziU8)ch;
count = Zi8GetTableCount(1, 0, __zi8_work_data);
table = Zi8GetTableAddress(1, 0, __zi8_work_data);
table2 = Zi8GetTableAddress(1, 1, __zi8_work_data);
if (buf == ZI8_NULL) {
for (i = 0; i < 0x40; i++) {
if (ch == WORKP->unk_0x20[i]) {
i = WORKP->unk_0xA0[i];
e = (ziU8*)table + i * 0xC;
if (i >= count) {
break;
}
if (hi != e[6] || lo != e[7]) {
break;
}
p = (ziU8*)(table2 +
(((e[9] & 0xF) << 16) |
(e[0xB] | (e[0xA] << 8))));
if (WORKP->unk_0x16 != 0) {
switch (p[0] & 7) {
case 2:
p += 2;
break;
case 3:
case 4:
p += 3;
break;
case 5:
p += 4;
break;
default:
p += 1;
break;
}
}
if ((p[0] & 0x80) == 0) {
break;
}
if (buf != ZI8_NULL) {
*buf = *(ziE12*)e;
}
return i;
}
}
}
e = (ziU8*)table;
if (WORKP->unk_0x1B18 != ZI8_NULL && WORKP->unk_0x1B24 == WORKP->unk_0x18) {
if ((ziU16)ch >= WORKP->unk_0x1B1C && (ziU16)ch <= WORKP->unk_0x1B1E) {
i = (ziU16)(ch - WORKP->unk_0x1B1C);
goto map;
}
if ((ziU16)ch >= WORKP->unk_0x1B20 && (ziU16)ch <= WORKP->unk_0x1B22) {
i = (ziU16)(WORKP->unk_0x1B1E + (ch - WORKP->unk_0x1B20) -
WORKP->unk_0x1B1C + 1);
goto map;
}
return 0xFFFF;
map:
i = WORKP->unk_0x1B18[i];
if (i != 0xFFFF) {
e = (ziU8*)table + i * 0xC;
if (hi == e[6] && lo == e[7]) {
if (buf != ZI8_NULL) {
*buf = *(ziE12*)e;
}
return i;
}
}
return 0xFFFF;
}
i = 0;
while (i < count) {
if (lo == e[7] && hi == e[6]) {
if (buf != ZI8_NULL) {
*buf = *(ziE12*)e;
}
return i;
}
e += 0xC;
i++;
}
return 0xFFFF;
}
ziU16 Zi8Uni2Ord(ziU16 ch ZI_NEED_WORK) {
return Zi8Uni2Ptr(ch, ZI8_NULL, __zi8_work_data);
}
ziU16 Zi8Ord2Uni(ziU16 ord ZI_NEED_WORK) {
ziU8* p;
if ((ziU16)ord >= Zi8GetTableCount(1, 0, __zi8_work_data)) {
Zi8LogError(0x132, __zi8_work_data);
return 0;
}
p = (ziU8*)Zi8GetTableAddress(1, 0, __zi8_work_data);
p += ord * 0xC;
Zi8LogError(0x64, __zi8_work_data);
return (ziU16)(((ziU16)p[6] << 8) + p[7]);
}
ziU16 Zi8Ord2Ord(ziU16 ord ZI_NEED_WORK) {
ziU32 table;
ziU16 count;
ziU8* p;
count = Zi8GetTableCount(1, 0, __zi8_work_data);
table = Zi8GetTableAddress(1, 0, __zi8_work_data);
if (ord == 0 || (ziU16)ord >= count) {
Zi8LogError(0x132, __zi8_work_data);
return ord;
}
p = (ziU8*)table + (ord - 1) * 0xC;
while (ord != 0) {
if (p[6] != p[0x12] || p[7] != p[0x13]) {
break;
}
p -= 0xC;
ord--;
}
Zi8LogError(0x64, __zi8_work_data);
return ord;
}

View File

@@ -0,0 +1,99 @@
#include <zi8clib/zi8space.h>
#include <zi8clib/zierror.h>
#include <zi8clib/zitypes.h>
extern ziU8 Zi8GetPyPhonetic(ziWChar* src, ziU8 i, ziWChar* a, ziWChar* b, ziU8* c,
ziU16* d, ziU16* e ZI_NEED_WORK);
extern ziU8 Zi8GetBpmfPhonetic(ziWChar* src, ziU8 i, ziWChar* a, ziWChar* b,
ziU16* d, ziU16* e ZI_NEED_WORK);
ziU8 Zi8ZHaddSpace(ziWChar* src, ziU8 count, ziWChar* dst,
ziU16 maxLen ZI_NEED_WORK) {
ziWChar candBuf[0x10];
ziWChar pyBuf[0x10];
ziU16 m;
ziU16 vE;
ziU16 vC;
ziU8 n;
ziU8 flag;
ziU8 v9;
ziU8 isPy;
int i;
int k;
ziWChar* psrc;
ziWChar* pdst;
psrc = src;
n = count;
pdst = dst;
m = maxLen;
if (n == 0) {
Zi8LogError(0x137, ZI_WORK);
return 0;
}
if ((psrc[0] >= 0xF361 && psrc[0] <= 0xF37A) ||
(psrc[0] >= 0xF341 && psrc[0] <= 0xF35A)) {
isPy = 1;
} else if (psrc[0] >= 0xF305 && psrc[0] <= 0xF329) {
isPy = 0;
} else {
goto fail;
}
i = 2;
while (i <= n) {
if (isPy) {
flag = Zi8GetPyPhonetic(psrc, i, candBuf, pyBuf, &v9, &vE, &vC, ZI_WORK);
if (i == v9) {
i++;
continue;
}
} else {
if ((psrc[i - 1] == 0xF360 && psrc[i - 2] != 0xF360) ||
Zi8GetBpmfPhonetic(psrc, i, candBuf, pyBuf, &vE, &vC, ZI_WORK) !=
0) {
i++;
continue;
}
}
if (i-- >= m - 1) {
goto fail;
}
m -= i + 1;
for (k = 0; k < i; k++) {
pdst[k] = psrc[k];
}
if (pdst[k - 1] != 0xF360 &&
(pdst[k - 1] < 0xF331 || pdst[k - 1] > 0xF335)) {
pdst[k++] = ZI_WORK->unk_0x1A;
}
psrc += i;
n -= i;
pdst += k;
i = 2;
}
if (i-- > m) {
goto fail;
}
for (k = 0; k < i; k++) {
pdst[k] = psrc[k];
}
pdst[k] = 0;
Zi8LogError(0x64, ZI_WORK);
return 1;
fail:
if ((ziU8)count >= (ziU16)maxLen) {
count = (ziU8)(maxLen - 1);
}
for (i = 0; i < count; i++) {
dst[i] = src[i];
}
dst[i] = 0;
Zi8LogError(0x64, ZI_WORK);
return 1;
}

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

@@ -1010,11 +1010,13 @@ static BOOL NHTTPi_ThreadParseHeaderProc(NHTTPThreadContext* context)
static inline s32 NHTTPi_RecvChunkLine(void* mutex, NHTTPRequestInfo* request, s32 socket)
{
s32 total = 0;
u32 index = 0;
u32 index;
s32 total;
char recent[2];
recent[0] = 0;
recent[1] = 0;
total = 0;
recent[0] = total;
recent[1] = total;
index = 0;
while (recent[index & 1] != '\r' || recent[(index - 1) & 1] != '\n')
{
s32 received = NHTTPi_SocRecv(mutex, request, socket, &recent[index & 1], 1, 0);
@@ -1027,6 +1029,7 @@ static inline s32 NHTTPi_RecvChunkLine(void* mutex, NHTTPRequestInfo* request, s
static BOOL NHTTPi_ThreadRecvBodyProc(NHTTPThreadContext* context)
{
char* recentChars;
s32 remaining;
void* system = NHTTPi_GetSystemInfoP();
NHTTPRequestInfo* request = NHTTPi_GetReqInfoP(system)->reqQueue->request;
@@ -1080,8 +1083,9 @@ static BOOL NHTTPi_ThreadRecvBodyProc(NHTTPThreadContext* context)
{
char recent[2];
s32 received;
recent[0] = 0;
recent[1] = 0;
recentChars = recent;
recentChars[0] = 0;
recentChars[1] = 0;
context->recvLength = 0;
while (context->recvLength < 0x100)
{
@@ -1090,9 +1094,9 @@ static BOOL NHTTPi_ThreadRecvBodyProc(NHTTPThreadContext* context)
received = NHTTPi_SocRecv(mutex, request, info->socket, buffer + context->recvLength, 1, 0);
if (received < 0) return FALSE;
length = context->recvLength;
character = buffer[length];
recent[length & 1] = character;
if (character == ';' || (character == '\n' && recent[(length - 1) & 1] == '\r'))
recentChars[length & 1] = buffer[length];
character = recentChars[length & 1];
if (character == ';' || (character == '\n' && recentChars[(length - 1) & 1] == '\r'))
{
if (character == '\n') --length;
else

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,425 +0,0 @@
#include <string.h>
#include <revolution/types.h>
#include <revolution/os.h>
#include <revolution/soex.h>
void OSSetAlarm();
s32 NCDLockWirelessDriver(void);
s32 NCDUnlockWirelessDriver(s32 id);
s32 NCDSetIpConfig(void* ipConfig);
s32 NCDSetIfConfig(void* ifConfig);
BOOL NCDIsInterfaceDecided(void);
s32 WD_Startup(u32 flags);
s32 WD_Cleanup(void);
s32 WD_Scan(void* params, u8* buffer, u32 bufferLen);
s32 WD_GetInfo(void* info);
static u8 sConf[352];
static u8 sIpConfig[1992];
static void (*AOSSi_callback)(void);
static void (*AOSSi_free)(u32 id, void* ptr, s32 size);
static void* (*AOSSi_alloc)(u32 id, s32 size);
static u32 AOSSi_dns2;
static u32 AOSSi_dns1;
static u32 AOSSi_gateway;
static u32 AOSSi_netmask;
static u32 AOSSi_ipAddr;
static s32 AOSSi_cancel_flag;
static u16 sRateTable[12][2] = {
{0x0001, 0x0200}, {0x0002, 0x0400}, {0x0004, 0x0B00},
{0x0008, 0x0C00}, {0x0010, 0x1200}, {0x0020, 0x1600},
{0x0040, 0x1800}, {0x0080, 0x2400}, {0x0100, 0x3000},
{0x0200, 0x4800}, {0x0400, 0x6000}, {0x0800, 0x6C00},
};
void AOSSi_Cancel(void) {
AOSSi_cancel_flag = 1;
}
static void AOSS_813FD17C(OSAlarm* alarm, OSContext* context) {
OSSendMessage((OSMessageQueue*)alarm->tag, NULL, FALSE);
}
static void AOSS_813FD18C(u32 ms) {
OSMessage queueBuffer;
OSMessage message;
OSMessageQueue queue;
OSAlarm alarm;
OSInitMessageQueue(&queue, &queueBuffer, 1);
OSCreateAlarm(&alarm);
OSSetAlarmTag(&alarm, (u32)&queue);
OSSetAlarm(&alarm, *(u32*)0x800000F8 >> 2, 0, ms * (OS_TIMER_CLOCK / 1000), AOSS_813FD17C);
OSReceiveMessage(&queue, &message, TRUE);
}
typedef struct WD_Info_ {
u8 MAC[6];
u16 enableChannel;
u16 NTRallowedChannel;
u8 countryCode[4];
u8 channel;
u8 initialized;
u8 version[80];
u8 unk_0x60[0x30];
} WD_Info;
typedef struct WDScanParam_ {
u16 channelBit;
u16 maxChannelTime;
u8 bssid[6];
u16 type;
u16 ssidLength;
u8 ssid[32];
u8 ssidMask[32];
} WDScanParam;
typedef struct WDBssDesc_ {
u16 length;
u16 rssi;
u8 bssid[6];
u16 ssidLength;
u8 ssid[32];
u16 capabilities;
struct {
u16 basic;
u16 support;
} rateSet;
u16 beaconPeriod;
u16 dtimPeriod;
u16 channel;
u16 cfPeriod;
u16 cfMaxDuration;
u16 ieLength;
} WDBssDesc;
void* AOSSi_Alloc(s32 size) {
if (AOSSi_alloc != NULL) {
return AOSSi_alloc(0, size);
}
return NULL;
}
void AOSSi_Free(void* ptr) {
if (AOSSi_free != NULL) {
AOSSi_free(0, ptr, 0);
}
}
static void AOSS_813FD25C(u8* dst, u32 val) {
int i;
for (i = 0; i < 4; i++) {
dst[i] = val >> ((3 - i) * 8);
}
}
s32 AOSSi_SetNCDIPAddr(u32 ip, u32 mask, u32 gateway, u32 dns1, u32 dns2) {
AOSS_813FD25C((u8*)&AOSSi_ipAddr, ip);
AOSS_813FD25C((u8*)&AOSSi_netmask, mask);
AOSS_813FD25C((u8*)&AOSSi_gateway, gateway);
AOSS_813FD25C((u8*)&AOSSi_dns1, dns1);
AOSS_813FD25C((u8*)&AOSSi_dns2, dns2);
return 0;
}
s32 AOSSi_InitLocal(void* (*alloc)(u32 id, s32 size),
void (*free_)(u32 id, void* ptr, s32 size)) {
BOOL level;
if (alloc == NULL || free_ == NULL) {
return -1;
}
level = OSDisableInterrupts();
AOSSi_alloc = alloc;
AOSSi_free = free_;
AOSSi_cancel_flag = 0;
OSRestoreInterrupts(level);
return 0;
}
s32 AOSSi_EndLocal(void) {
BOOL level;
level = OSDisableInterrupts();
AOSSi_alloc = NULL;
AOSSi_free = NULL;
OSRestoreInterrupts(level);
return 0;
}
s32 AOSSi_WLANGetBSSList(u32** out) {
u8 mac[6];
WDScanParam ATTRIBUTE_ALIGN(32) req;
WD_Info ATTRIBUTE_ALIGN(32) info;
u8* buf;
u32* list;
u8* src;
u8* dst;
int count;
int i;
int j;
int n;
s32 result = -1;
int retry = 0;
int uretry = 0;
int cretry = 0;
int rescan = 0;
s32 lock;
s32 err;
if (AOSSi_alloc == 0 || AOSSi_free == 0) {
return -1;
}
lock = NCDLockWirelessDriver();
if (lock <= 0) {
return -1;
}
for (;;) {
if (WD_Startup(3) == 0) {
break;
}
if (retry > 10) {
goto unlock;
}
retry++;
AOSS_813FD18C(10);
}
if (WD_GetInfo(&info) == 0) {
memcpy(mac, info.MAC, 6);
}
buf = AOSSi_Alloc(0x3200);
if (buf == 0) {
goto cleanup;
}
memset(buf, 0, 0x3200);
req.channelBit = info.enableChannel;
req.maxChannelTime = 0x28;
memset(req.bssid, 0xFF, 6);
req.type = 0;
req.ssidLength = 0;
memset(req.ssid, 0, 0x20);
memset(req.ssidMask, 0xFF, 0x20);
scan:
err = WD_Scan(&req, buf, 0x3200);
if (err != 0 && (u32)(err - 0x80000000) != 0x8004) {
goto free;
}
count = *(u16*)buf;
if (count == 0) {
goto rescan;
}
list = AOSSi_Alloc((count - 1) * 0x54 + 0x58);
if (list == 0) {
result = -1;
goto free;
}
list[0] = count;
src = buf + 2;
dst = (u8*)list;
for (i = 0; i < count; i++) {
u32 off = i * 0x54;
*(u32*)(dst + off + 4) = ((WDBssDesc*)src)->ssidLength;
memcpy(dst + off + 8, ((WDBssDesc*)src)->ssid, 0x20);
*(u32*)(dst + off + 0x28) = ((WDBssDesc*)src)->channel;
memcpy(dst + off + 0x34, ((WDBssDesc*)src)->bssid, 6);
n = 0;
for (j = 0; j < 12; j++) {
if (((WDBssDesc*)src)->rateSet.support & sRateTable[j][0]) {
dst[off + 0x40 + n] = ((u8*)sRateTable)[j * 4 + 2];
if (((WDBssDesc*)src)->rateSet.basic & sRateTable[j][0]) {
dst[off + 0x40 + n] |= 0x80;
}
n++;
}
}
*(u32*)(dst + off + 0x3C) = n;
*(u32*)(dst + off + 0x50) = ((WDBssDesc*)src)->beaconPeriod;
if ((((WDBssDesc*)src)->capabilities & 3) == 1) {
*(u32*)(dst + off + 0x54) = 1;
}
else if ((((WDBssDesc*)src)->capabilities & 3) == 2) {
*(u32*)(dst + off + 0x54) = 2;
}
else {
*(u32*)(dst + off + 0x54) = 0;
}
src += ((WDBssDesc*)src)->length * 2;
}
*out = list;
result = 0;
goto free;
rescan:
if (AOSSi_cancel_flag == 1) {
result = -1;
goto free;
}
rescan++;
if (rescan > 10) {
list = AOSSi_Alloc(0x58);
if (list == 0) {
result = -1;
goto free;
}
list[0] = 0;
result = 0;
*out = list;
goto free;
}
AOSS_813FD18C(100);
goto scan;
free:
if (AOSSi_free != 0) {
AOSSi_free(0, buf, 0);
}
cleanup:
while (WD_Cleanup() != 0) {
if (cretry > 10) {
result = -1;
break;
}
cretry++;
AOSS_813FD18C(10);
}
unlock:
while (NCDUnlockWirelessDriver(lock) != 0) {
if (uretry > 10) {
result = -1;
break;
}
uretry++;
AOSS_813FD18C(10);
}
return result;
}
s32 AOSSi_WLANConnect(u32* in, u32* out) {
WD_Info ATTRIBUTE_ALIGN(32) info;
int count = 0;
int ret;
u8* conf = sConf;
u8* ipcfg;
memset(conf, 0, 0x15E);
conf[0] = 1;
*(u16*)(conf + 2) = 0;
conf[4] = 0;
if (in[0x28 / 4] == 0) {
*(u16*)(conf + 0x2A) = 0;
}
if (in[0x28 / 4] == 5) {
*(u16*)(conf + 0x2A) = 1;
*(u16*)(conf + 0x2E) = 0;
memcpy(conf + 0x32, (u8*)in + 0x2C, in[0x28 / 4]);
}
else if (in[0x28 / 4] == 0xD) {
*(u16*)(conf + 0x2A) = 2;
*(u16*)(conf + 0x2E) = 0;
memcpy(conf + 0x32, (u8*)in + 0x2C, in[0x28 / 4]);
}
else if (in[0x28 / 4] == 0x10) {
return -1;
}
else {
return -1;
}
*(u16*)(conf + 0x26) = in[0] & 0xFF;
memcpy(conf + 6, (u8*)in + 4, in[0]);
ipcfg = sIpConfig;
ret = 0;
memset(ipcfg, 0, 0x7C4);
*(u32*)(ipcfg + 0x1C) = 0x514;
*(u32*)(ipcfg + 0x20) = 0x64;
*(u32*)(ipcfg + 0x24) = 4;
*(u32*)(ipcfg + 0) = 0;
*(u32*)(ipcfg + 4) = 0;
memcpy(ipcfg + 8, &AOSSi_ipAddr, 4);
memcpy(ipcfg + 0xC, &AOSSi_netmask, 4);
memcpy(ipcfg + 0x10, &AOSSi_gateway, 4);
memcpy(ipcfg + 0x14, &AOSSi_dns1, 4);
memcpy(ipcfg + 0x18, &AOSSi_dns2, 4);
if (NCDSetIpConfig(sIpConfig) != 0) {
ret = -1;
}
if (ret == 0 && NCDSetIfConfig(sConf) != 0) {
ret = -1;
}
if (ret == 0) {
while (!NCDIsInterfaceDecided()) {
if (AOSSi_cancel_flag == 1) {
ret = -1;
break;
}
if (count > 0x258) {
ret = -1;
break;
}
count++;
AOSS_813FD18C(10);
}
}
if (ret == 0) {
out[0] = 1;
if (WD_GetInfo(&info) == 0) {
out[0x28 / 4] = info.channel;
}
{
u32 len = *(u16*)(conf + 0x26);
out[4 / 4] = len;
memcpy((u8*)out + 8, conf + 6, len);
}
}
else {
out[0] = 0;
}
return ret;
}
void AOSSi_Sleep(u32 ms) {
AOSS_813FD18C(ms);
}
s32 AOSSi_Status(void) {
if (AOSSi_callback != NULL) {
AOSSi_callback();
}
return 0;
}
void AOSS_SetCallback(void (*callback)(void)) {
BOOL level;
level = OSDisableInterrupts();
AOSSi_callback = callback;
OSRestoreInterrupts(level);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,361 +0,0 @@
#include <revolution/os.h>
#include <revolution/soex.h>
#include <revolution/mem.h>
#include <cstring>
#include <revolution/ncd/NCDTypes.h>
#include "utility/iplThread.h"
#include "egg/core/eggHeap.h"
extern "C" {
u32 ATERMi_ApConfigGetVersion(void);
s32 ATERMi_ApConfigStart(s32 priority, u32 size, void (*callback)(u32* data),
void* (*alloc)(u32 size), void (*free_)(u32 size),
u32 stackSize);
s32 ATERMi_ApConfigGetState(u32* state);
s32 ATERMi_ApConfigEnd(void);
s32 ATERMi_ApConfigGetResult(void* result);
}
namespace ipl {
namespace scene {
extern "C" {
static void* RakuRakuThread_813FDEF0(u32 id, s32 size);
static void RakuRakuThread_813FDEFC(u32 id, void* ptr, s32 align);
static void* RakuRakuThread_813FDF08(u32 size);
static void RakuRakuThread_813FDF18(u32 size);
}
typedef struct ATERMResult {
char ssid[0x20]; // 0x00
s32 type; // 0x20
u32 keyId; // 0x24
u8 keys[4][0x20]; // 0x28
char key[0x40]; // 0xA8
} ATERMResult; // 0xE8
typedef struct RakuRakuWork {
u32 state; // 0x00
u32 unk_0x04; // 0x04
s32 result; // 0x08
ATERMResult data; // 0x0C
} RakuRakuWork; // 0xF4
typedef struct QueueWork {
OSMessageQueue queue; // 0x00
OSMessage msg; // 0x20
} QueueWork; // 0x24
MEMAllocator mAllocator;
RakuRakuWork mWork;
QueueWork mQueue;
static u32 sStartTimeHi;
static u32 sStartTimeLo;
static u8 sStarted;
static OSMessage sMsgArray;
static s32 sState = 1;
class RakuRakuThread : public utility::ut_thread {
public:
RakuRakuThread(EGG::Heap* heap);
virtual ~RakuRakuThread(); // 0x08
virtual void* Run(); // 0x0C
virtual void unk_0x2C() = 0; // 0x2C
static void RakuRakuThread_813FDA04(u32* data);
void destroy();
int start();
int getState();
void cancel();
int finish(NCDApConfig* config, int* result);
void printInfo();
private:
s32 mUnk_0x32C; // 0x32C
s32 mEndFlag; // 0x330
s32 mCreated; // 0x334
s32 mThreadPriority; // 0x338
u8* mpWorkBuffer; // 0x33C
u8* mpStackBuffer; // 0x340
MEMHeapHandle mpExpHeap; // 0x344
};
void RakuRakuThread::RakuRakuThread_813FDA04(u32* data) {
BOOL level = OSDisableInterrupts();
mWork.state = data[0];
mWork.unk_0x04 = data[1];
mWork.result = data[2];
OSTime t = OSGetTime();
sStartTimeLo = (u32)t;
sStartTimeHi = (u32)(t >> 32);
OSRestoreInterrupts(level);
}
RakuRakuThread::RakuRakuThread(EGG::Heap* heap) : utility::ut_thread() {
u32 version = ATERMi_ApConfigGetVersion();
if ((((version >> 12) & 0xF) * 10 + ((version >> 8) & 0xF)) != 1) {
mpWorkBuffer = NULL;
}
else {
mpWorkBuffer = (u8*)heap->alloc(0x40000, 0x20);
mpStackBuffer = (u8*)heap->alloc(0x1000, 0x20);
}
mpExpHeap = NULL;
sStarted = 0;
mEndFlag = 0;
mCreated = 0;
OSInitMessageQueue(&mQueue.queue, &sMsgArray, 1);
}
RakuRakuThread::~RakuRakuThread() {
if (mCreated != 0) {
OSJamMessage(&mQueue.queue, (OSMessage)2, TRUE);
WaitForThreadExit();
}
destroy();
}
void RakuRakuThread::destroy() {
if (sStarted != 0) {
OSSendMessage(&mQueue.queue, (OSMessage)1, FALSE);
u32 tick = OSGetTick();
while ((u32)(OSGetTick() - tick) / (OS_TIMER_CLOCK / 1000)
< 0x7D0)
{
u32 state[4];
if (ATERMi_ApConfigGetState(state) == 1 && (s32)state[0] == 7) {
break;
}
}
SOFinish();
sStarted = 0;
}
if (mpExpHeap != NULL) {
MEMDestroyExpHeap(mpExpHeap);
memset(&mAllocator, 0, 0x10);
mpExpHeap = NULL;
}
}
int RakuRakuThread::start() {
SOLibraryConfig config;
MEMAllocator* alloc = &mAllocator;
if (sStarted != 0 || mpWorkBuffer == NULL) {
return 0;
}
BOOL level = OSDisableInterrupts();
OSTime t = OSGetTime();
sStartTimeLo = (u32)t;
sStartTimeHi = (u32)(t >> 32);
mpExpHeap = MEMCreateExpHeapEx(mpWorkBuffer, 0x40000, 2);
MEMInitAllocatorForExpHeap(&mAllocator, mpExpHeap, 0x20);
mThreadPriority = OSGetThreadPriority(OSGetCurrentThread()) - 1;
sStarted = 1;
mEndFlag = 0;
memset((u8*)alloc + 0x1C, 0, 0xE8);
memset((u8*)alloc + 0x10, 0, 0xC);
config.alloc = RakuRakuThread_813FDEF0;
config.free = RakuRakuThread_813FDEFC;
SOInit(&config);
ATERMi_ApConfigStart(mThreadPriority, 0xC8,
RakuRakuThread_813FDA04,
RakuRakuThread_813FDF08,
RakuRakuThread_813FDF18, 0x1000);
if (mCreated == 0) {
mCreated = 1;
memset(mpStackBuffer, 0, 4);
Create(mpStackBuffer, 0x1000, mThreadPriority - 1, TRUE);
OSReport("RakuRakuThread (for End function) start with prio(%d) \n",
mThreadPriority);
}
OSRestoreInterrupts(level);
return 1;
}
void* RakuRakuThread::Run() {
u32 magic = 0x97654321;
OSMessage msg;
for (;;) {
while (OSReceiveMessage(&mQueue.queue, &msg, FALSE) != FALSE) {
if ((s32)msg == 2) {
return this;
}
}
OSReceiveMessage(&mQueue.queue, &msg, TRUE);
if ((s32)msg == 2) {
break;
}
*(u32*)(mpStackBuffer + 0x3FC0) = magic;
ATERMi_ApConfigEnd();
mEndFlag = 1;
if (mCreated == 0) {
break;
}
}
return this;
}
extern "C" {
static void* RakuRakuThread_813FDEF0(u32 id, s32 size) {
return MEMAllocFromAllocator(&mAllocator, size);
}
static void RakuRakuThread_813FDEFC(u32 id, void* ptr, s32 align) {
MEMFreeToAllocator(&mAllocator, ptr);
}
static void* RakuRakuThread_813FDF08(u32 size) {
return MEMAllocFromAllocator(&mAllocator, size);
}
static void RakuRakuThread_813FDF18(u32 size) {
MEMFreeToAllocator(&mAllocator, (void*)size);
}
}
int RakuRakuThread::getState() {
if (sStarted == 0) {
return 0;
}
BOOL level = OSDisableInterrupts();
switch (mWork.state) {
case 1:
sState = 1;
break;
case 2:
sState = 2;
break;
case 3:
sState = 2;
break;
case 4:
sState = 4;
break;
case 5:
sState = 5;
break;
case 6:
sState = 6;
break;
case 7:
sState = 7;
break;
default:
sState = 1;
break;
}
if (sState != 6 && sState != 7) {
if (((u32)OSGetTime() - (u32)sStartTimeLo)
/ (OS_TIMER_CLOCK / 1000)
>= 90000)
{
OSSendMessage(&mQueue.queue, (OSMessage)1, FALSE);
}
}
OSRestoreInterrupts(level);
return sState;
}
void RakuRakuThread::cancel() {
OSSendMessage(&mQueue.queue, (OSMessage)1, FALSE);
}
int RakuRakuThread::finish(NCDApConfig* config, int* result) {
u8* ws = (u8*)&mAllocator;
RakuRakuWork* wk = (RakuRakuWork*)(ws + 0x10);
if (sStarted == 0) {
if (result != NULL) {
*result = -0x63;
}
return 1;
}
if ((u32)(wk->state - 6) <= 1) {
if (mEndFlag == 0) {
if ((s32)wk->state == 6) {
ATERMi_ApConfigGetResult(&wk->data);
printInfo();
}
OSSendMessage((OSMessageQueue*)(ws + 0x104), (OSMessage)1, FALSE);
return 0;
}
else {
SOFinish();
sStarted = 0;
destroy();
}
}
else {
return 0;
}
if (config != NULL) {
memcpy(config->ssid, wk->data.ssid, 0x20);
config->ssidLength = strlen(wk->data.ssid);
ATERMResult* data = &wk->data;
if (data->type == 1) {
config->privacy.mode = 1;
config->privacy.wep40.keyId = data->keyId;
for (int i = 0; i < 4; i++) {
memcpy(config->privacy.wep40.key[i],
data->keys[i], 5);
}
}
else if (data->type == 2) {
config->privacy.mode = 2;
config->privacy.wep104.keyId = data->keyId;
for (int i = 0; i < 4; i++) {
memcpy(config->privacy.wep104.key[i],
data->keys[i], 0xD);
}
}
else if (data->type == 4) {
config->privacy.mode = 4;
memcpy(config->privacy.tkip.key, data->key, 0x40);
config->privacy.tkip.keyLen = strlen(data->key);
}
else if (data->type == 5) {
config->privacy.mode = 6;
memcpy(config->privacy.aes.key, data->key, 0x40);
config->privacy.aes.keyLen = strlen(data->key);
}
}
if (result != NULL) {
*result = wk->result;
}
return 1;
}
#pragma dont_inline on
void RakuRakuThread::printInfo() {
}
#pragma dont_inline reset
} // namespace scene
} // namespace ipl

View File

@@ -1,150 +0,0 @@
#define IPL_CONTROLLER_TRIVIAL_RECT_DTOR
#include <nw4r/ut/Rect.h>
extern "C" {
#include <revolution/gx.h>
#include <revolution/tpl.h>
#include <revolution/wpad.h>
}
#include <system/iplController.h>
#include <system/iplNand.h>
#include <system/iplSystem.h>
#include <utility/iplGraphics.h>
extern "C" void* KPADGetWPADRingBuffer(s32 chan);
extern "C" void* KPADGetWPADFSRingBuffer(s32 chan);
extern "C" void* KPADGetWPADCLRingBuffer(s32 chan);
extern __declspec(section ".sdata2") u8 sFrameColorR;
extern __declspec(section ".sdata2") u8 sFrameColorG;
extern __declspec(section ".sdata2") u8 sFrameColorB;
extern __declspec(section ".sdata2") u8 sFrameColorA;
extern __declspec(section ".sdata2") u8 sPointColorR;
extern __declspec(section ".sdata2") u8 sPointColorG;
extern __declspec(section ".sdata2") u8 sPointColorB;
extern __declspec(section ".sdata2") u8 sPointColorA;
extern __declspec(section ".sdata2") const f32 sPosZero;
extern __declspec(section ".sdata2") f32 sDpdOffsetY;
extern __declspec(section ".sdata2") f32 sDpdScale;
namespace ipl {
typedef struct DPDObj {
s16 x; // 0x0
s16 y; // 0x2
u16 size; // 0x4
s16 id; // 0x6
} DPDObj;
class SensitivityDrawing {
public:
static void draw(nand::File* file);
};
void SensitivityDrawing::draw(nand::File* file) {
GXRenderModeObj mode = *System::getRenderModeObj();
nw4r::ut::Rect rect(sPosZero, sPosZero, sPosZero, sPosZero);
System::getProjectionRect(&rect);
GXColor frameColor = {sFrameColorR, sFrameColorG, sFrameColorB,
sFrameColorA};
u32 left;
u32 top;
u32 width;
u32 height;
GXGetScissor(&left, &top, &width, &height);
f32 fw2 = 0.5f * (rect.right - rect.left);
f32 ys = (0.5f * (rect.bottom - rect.top)) / 768.0f;
f32 xs = (0.5f * (rect.right - rect.left)) * 0.0009765625f;
f32 ws = mode.fbWidth / (rect.right - rect.left);
f32 hs = mode.efbHeight / (rect.bottom - rect.top);
f32 fh2 = 0.5f * (rect.bottom - rect.top);
utility::Graphics::setDefaultOrtho(0);
GXSetScissor((u32)(ws * (0.5f * rect.left + fw2)),
(u32)(hs * (0.5f * rect.top + fh2 + sDpdOffsetY)),
(u32)(ws * ((rect.right - rect.left) * 0.5f)),
(u32)(hs * ((rect.bottom - rect.top) * 0.5f)));
utility::Graphics::drawPolygon(rect, frameColor);
controller::Interface* controller = System::getYoungController();
if (controller != NULL && controller->getKPADStatus() != NULL) {
GXTexObj texObj;
TPLGetGXTexObjFromPalette((TPLPalette*)file->getBuffer(), &texObj, 1);
GXInitTexObjWrapMode(&texObj, GX_MIRROR, GX_MIRROR);
s32 index = WPADGetLatestIndexInBuf(controller->getChannel());
DPDObj* first;
DPDObj* last;
switch (controller->getType()) {
case 0: {
u8* base = (u8*)KPADGetWPADRingBuffer(
controller->getChannel()) +
index * 0x2A;
last = (DPDObj*)(base + 0x20);
first = (DPDObj*)(base + 8);
break;
}
case 1: {
u8* base = (u8*)KPADGetWPADFSRingBuffer(
controller->getChannel()) +
index * 0x32;
last = (DPDObj*)(base + 0x20);
first = (DPDObj*)(base + 8);
break;
}
case 2: {
u8* base = (u8*)KPADGetWPADCLRingBuffer(
controller->getChannel()) +
index * 0x36;
last = (DPDObj*)(base + 0x20);
first = (DPDObj*)(base + 8);
break;
}
}
DPDObj* obj = last;
do {
if (obj->size != 0) {
s32 x = obj->x - 0x200;
s32 y = obj->y - 0x180;
f32 s = sDpdScale * (obj->size + 0x19);
nw4r::ut::Rect pos(sPosZero, sPosZero, sPosZero, sPosZero);
f32 sx = xs * x;
f32 sy = ys * y;
pos.left = sx - s;
pos.top = (-sy + s) - sDpdOffsetY;
pos.right = sx + s;
pos.bottom = (-sy - s) - sDpdOffsetY;
utility::Graphics::drawTexture(pos, texObj,
*(GXColor*)&sPointColorR, 2,
utility::Graphics::ORI_NONE);
}
obj--;
} while (obj >= first);
}
GXSetScissor(left, top, width, height);
}
} // namespace ipl
extern __declspec(section ".sdata2") u8 sFrameColorR = 0x60;
extern __declspec(section ".sdata2") u8 sFrameColorG = 0x60;
extern __declspec(section ".sdata2") u8 sFrameColorB = 0x60;
extern __declspec(section ".sdata2") u8 sFrameColorA = 0xC0;
extern __declspec(section ".sdata2") u8 sPointColorR = 0xFF;
extern __declspec(section ".sdata2") u8 sPointColorG = 0xFF;
extern __declspec(section ".sdata2") u8 sPointColorB = 0xFF;
extern __declspec(section ".sdata2") u8 sPointColorA = 0xFF;
extern __declspec(section ".sdata2") const f32 sPosZero = 0.0f;
extern __declspec(section ".sdata2") f32 sDpdOffsetY = -45.0f;
extern __declspec(section ".sdata2") f32 sDpdScale = 0.15f;

File diff suppressed because it is too large Load Diff

View File

@@ -1,190 +0,0 @@
extern "C" {
#include <private/wd.h>
}
#include <revolution/os.h>
#include <revolution/wd.h>
#include <string.h>
#define USBAP_STACK_SIZE 0x1000
#define USBAP_NICKNAME_LEN 0x14
#define USBAP_MAC_TABLE_MAX 0x14
#define USBAP_MAC_LENGTH 6
#define USBAP_SSID "NWCUSBAP"
#define USBAP_SSID_LENGTH 8
typedef void (*USBAPCallback)(int result);
static OSThread usbapThread;
static u8 usbapStack[USBAP_STACK_SIZE];
static OSMessageQueue usbapMessageQ;
static u16 usbapNickname[12];
static OSMessage usbapMsg;
static USBAPCallback usbapCallback;
static s32 usbapUseNickname;
static u16 usbapEnableChannel;
static u8* usbapScanBuffer;
static u8* usbapMacTable;
u8* gUSBAPResult;
extern "C" void* DoRegistration(void* param);
extern "C" int USBAPStartRegistration(void* unused1, void* unused2,
u32 priority, s32 useNickname, const u16* nickname,
USBAPCallback callback, u8* scanBuffer, u8* macTable) {
s32 level;
level = OSDisableInterrupts();
usbapScanBuffer = scanBuffer;
usbapMacTable = macTable;
if (usbapThread.state != 0 && !OSIsThreadTerminated(&usbapThread)) {
OSRestoreInterrupts(level);
return 0;
}
if (priority > 0x1F || nickname == NULL || callback == NULL) {
OSRestoreInterrupts(level);
return 0;
}
usbapUseNickname = useNickname;
usbapCallback = callback;
memcpy(usbapNickname, nickname, USBAP_NICKNAME_LEN);
OSInitMessageQueue(&usbapMessageQ, &usbapMsg, 1);
if (OSCreateThread(&usbapThread, DoRegistration, NULL,
usbapStack + sizeof(usbapStack), sizeof(usbapStack), priority, 1)
== 1)
{
OSRestoreInterrupts(level);
while (OSResumeThread(&usbapThread) > 1) {
}
return 1;
}
OSRestoreInterrupts(level);
return 0;
}
extern "C" int USBAPCancelRegistration(void) {
return OSSendMessage(&usbapMessageQ, NULL, 0);
}
extern "C" int USBAPIsThreadTerminated(void) {
return OSIsThreadTerminated(&usbapThread);
}
extern "C" void* DoRegistration(void* param) {
OSMessage msg;
WDScanParam req;
s32 ret;
s32 result;
BOOL found;
BOOL empty;
u16 count;
s32 i;
s32 j;
s32 joff;
WDBssDesc* entry;
if (WDCheckEnableChannel(&usbapEnableChannel) != 0) {
ret = 0;
if (usbapCallback != NULL) {
usbapCallback(0);
}
}
else {
for (;;) {
OSYieldThread();
if (OSReceiveMessage(&usbapMessageQ, &msg, 0) == TRUE) {
ret = 0;
if (usbapCallback != NULL) {
usbapCallback(0);
}
break;
}
result = 0;
req.channelBit = usbapEnableChannel;
req.maxChannelTime = 0x64;
memset(req.bssid, 0xFF, WD_BSSID_LENGTH);
req.type = 0;
req.ssidLength = 0x20;
memcpy(req.ssid, USBAP_SSID, USBAP_SSID_LENGTH);
req.ssid[8] = 0;
req.ssid[9] = 1;
if (usbapUseNickname == 1) {
req.ssid[9] |= 2;
}
req.ssid[10] = 1;
req.ssid[11] = 0;
memcpy(&req.ssid[12], usbapNickname, USBAP_NICKNAME_LEN);
memset(&req.ssidMask[0], 0, 8);
memset(&req.ssidMask[8], 0xFF, 0x18);
if (WDScanOnce(usbapScanBuffer, 0x800, &req) == 0) {
found = 0;
empty = 0;
count = *(u16*)usbapScanBuffer;
entry = (WDBssDesc*)(usbapScanBuffer + 2);
for (i = 0; i < count; i++) {
if (entry->ssidLength == 0x20
&& strncmp((char*)entry->ssid, USBAP_SSID,
USBAP_SSID_LENGTH)
== 0)
{
for (j = 0, joff = 0; j < USBAP_MAC_TABLE_MAX;
j++, joff += USBAP_MAC_LENGTH)
{
if (memcmp(entry->bssid,
&usbapMacTable[1 + joff],
USBAP_MAC_LENGTH)
== 0)
{
break;
}
}
if (j == USBAP_MAC_TABLE_MAX) {
if (entry->ssid[9] == 1) {
memcpy(&usbapMacTable[1 + usbapMacTable[0]
* USBAP_MAC_LENGTH],
entry->bssid, USBAP_MAC_LENGTH);
usbapMacTable[0]++;
found = 1;
}
else if (entry->ssid[9] == 0) {
empty = 1;
}
}
}
entry = (WDBssDesc*)((u8*)entry + entry->length * 2);
}
if (found) {
result = empty ? 2 : 1;
}
}
if (result != 0) {
ret = result == 1;
if (usbapCallback != NULL) {
usbapCallback(ret);
}
break;
}
}
}
return (void*)(u32)ret;
}

View File

@@ -1,71 +0,0 @@
#include <revolution/os.h>
#include <cstring>
#include "utility/iplCharacterCode.h"
extern "C" int USBAPStartRegistration(void* arg1, void* arg2, s32 priority,
void* arg4, void* arg5, void* callback, void* arg7, void* arg8);
extern "C" int USBAPCancelRegistration(void);
extern "C" int USBAPIsThreadTerminated(void);
extern u8* gUSBAPResult;
namespace ipl {
namespace scene {
class USBAPThread {
public:
USBAPThread();
void Init(u16* pData, u8* pBuf);
void cancel();
void is();
void setData(const wchar_t* pData, u8* pBuf);
void callback();
private:
wchar_t mData[10];
};
USBAPThread::USBAPThread() {
}
void USBAPRegisterCallback(int result) {
if (result == 1) {
*gUSBAPResult = 1;
OSReport("Registration completed !\n");
}
else {
*gUSBAPResult = 2;
OSReport("Registration failed...\n");
}
}
void USBAPThread::Init(u16* pData, u8* pBuf) {
s32 priority = OSGetThreadPriority(OSGetCurrentThread()) + 1;
s32 result = USBAPStartRegistration(NULL, NULL, priority, NULL, this,
USBAPRegisterCallback, pData, pBuf);
if (result == 1)
{
OSReport("Registration started\n");
}
}
void USBAPThread::cancel() {
USBAPCancelRegistration();
}
void USBAPThread::is() {
USBAPIsThreadTerminated();
}
void USBAPThread::setData(const wchar_t* pData, u8* pBuf) {
gUSBAPResult = pBuf;
std::memcpy(mData, pData, sizeof(mData));
utility::CharacterCode::changeEndian(
reinterpret_cast<wchar_t*>(mData), 0xA);
}
void USBAPThread::callback() {
}
} // namespace scene
} // namespace ipl

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

@@ -1,11 +1,10 @@
#!/usr/bin/env python3
"""Compact function diff with context: python ctxdiff.py <unit> <symbol> [--full]"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, "/home/cole/projects/tests")
from odiff import dis, sym
import os
import itertools

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

@@ -1,166 +0,0 @@
#!/usr/bin/env python3
"""odiff: symbol lookup + normalized disassembly for object files.
Recreated for this environment (original lived on the author's machine).
"""
import re
from capstone import CS_ARCH_PPC, CS_MODE_32, CS_MODE_BIG_ENDIAN, Cs
from elftools.elf.elffile import ELFFile
_cache = {}
def _load(path):
if path in _cache:
return _cache[path]
with open(path, "rb") as f:
e = ELFFile(f)
st = e.get_section_by_name(".symtab")
names = [s.name for s in st.iter_symbols()]
syms = {s.name: (s["st_value"], s["st_size"]) for s in st.iter_symbols()}
data = {}
for sec in e.iter_sections():
data[sec.name] = (sec["sh_offset"], sec.data())
relocs = {}
for sec in e.iter_sections():
if sec.name.startswith(".rela"):
target = sec.name[5:]
for r in sec.iter_relocations():
relocs[(target, r["r_offset"])] = names[r["r_info_sym"]]
_cache[path] = (data, syms, relocs)
return _cache[path]
def sym(path, name):
_, syms, _ = _load(path)
return syms[name]
_PS_ARITH = {
40: "ps_sum0", 41: "ps_sum1", 20: "ps_sum0", 21: "ps_sum1",
32: "ps_muls0", 33: "ps_muls1", 28: "ps_madds0", 29: "ps_madds1",
12: "ps_mul", 14: "ps_div", 10: "ps_add", 11: "ps_sub",
26: "ps_madd", 30: "ps_nmsub", 31: "ps_msub", 28 >> 2: "x",
18: "ps_merge00", 528: "ps_merge00", 560: "ps_merge01",
592: "ps_merge10", 624: "ps_merge11", 25: "ps_mul",
}
def _ps_decode(w):
major = w >> 26
if major in (56, 57, 60, 61): # psq_l psq_lu psq_st psq_stu
names = {56: "psq_l", 57: "psq_lu", 60: "psq_st", 61: "psq_stu"}
fd = (w >> 21) & 31
ra = (w >> 16) & 31
w_ = (w >> 15) & 1
i = (w >> 12) & 7
d = w & 0xFFF
if d & 0x800:
d -= 0x1000
return "%s f%d, %d(r%d), %d, %d" % (names[major], fd, d, ra, w_, i)
if major in (6, 7): # psq_lx psq_stx
names = {6: "psq_lx", 7: "psq_stx"}
fd = (w >> 21) & 31
ra = (w >> 16) & 31
rb = (w >> 11) & 31
w_ = (w >> 10) & 1
i = (w >> 7) & 7
return "%s f%d, r%d, r%d, %d, %d" % (names[major], fd, ra, rb, w_, i)
if major == 4: # ps_* arithmetic
xo = (w >> 1) & 0x3FF
rc = w & 1
fd = (w >> 21) & 31
fa = (w >> 16) & 31
fb = (w >> 11) & 31
fc = (w >> 6) & 31
names = {18: "ps_div", 20: "ps_sub", 21: "ps_add", 23: "ps_sel",
24: "ps_res", 25: "ps_mul", 26: "ps_rsqrte", 28: "ps_msub",
29: "ps_madd", 30: "ps_nmsub", 31: "ps_nmadd", 10: "ps_sum0",
11: "ps_sum1", 12: "ps_muls0", 13: "ps_muls1",
14: "ps_madds0", 15: "ps_madds1", 16: "ps_cmpu0",
32: "ps_cmpo0", 40: "ps_cmpu1", 48: "ps_cmpo1",
66: "ps_neg", 34: "ps_mr", 136: "ps_nabs", 264: "ps_abs",
528: "ps_merge00", 560: "ps_merge01", 592: "ps_merge10",
624: "ps_merge11", 1014: "dcbz_l"}
n = names.get(xo)
if n is None:
return None
if xo in (34, 66, 136, 264):
return "%s%s f%d, f%d" % (n, "." if rc else "", fd, fb)
if xo in (528, 560, 592, 624):
return "%s%s f%d, f%d, f%d" % (n, "." if rc else "", fd, fa, fb)
if xo in (16, 32, 40, 48):
return "%s cr%d, f%d, f%d" % (n, fd >> 2, fa, fb)
if xo in (10, 11):
return "%s%s f%d, f%d, f%d, f%d" % (n, "." if rc else "", fd, fc, fa, fb)
return "%s%s f%d, f%d, f%d, f%d" % (n, "." if rc else "", fd, fa, fc, fb)
return None
def dis(path, off, size, section=".text"):
data, syms, relocs = _load(path)
sec_data = data[section][1]
# Word-granular disassembly: capstone with paired-single fallback.
class _I:
__slots__ = ("address", "mnemonic", "op_str")
def __init__(self, a, m, o):
self.address = a
self.mnemonic = m
self.op_str = o
insns = []
pos = off
end = off + size
md = Cs(CS_ARCH_PPC, CS_MODE_32 + CS_MODE_BIG_ENDIAN)
while pos < end:
w = int.from_bytes(sec_data[pos:pos + 4], "big")
major = w >> 26
is_ps = major in (4, 56, 57, 60, 61) or (
major in (6, 7) and ((w >> 1) & 0x3FF) == 18)
if is_ps:
t = _ps_decode(w)
if t is None:
insns.append(_I(pos, ".long", hex(w)))
else:
parts = t.split(" ", 1)
insns.append(_I(pos, parts[0], parts[1]))
pos += 4
continue
chunk = sec_data[pos:end]
done = False
for i in md.disasm(chunk, pos):
insns.append(i)
done = True
break
if not done:
w = int.from_bytes(sec_data[pos:pos + 4], "big")
t = _ps_decode(w)
if t is None:
insns.append(_I(pos, ".long", hex(w)))
else:
parts = t.split(" ", 1)
insns.append(_I(pos, parts[0], parts[1]))
pos += 4
out = []
for i in insns:
text = i.mnemonic + " " + i.op_str
m = re.search(r"0x[0-9a-fA-F]+", i.op_str)
if (section, i.address) in relocs:
# External reference: show the symbol, drop the raw addend
text = i.mnemonic + " " + re.sub(r"0x[0-9a-fA-F]+",
"<" + relocs[(section, i.address)] + ">",
i.op_str)
elif m and i.mnemonic.startswith("b"):
val = int(m.group(0), 16)
if off <= val < off + size:
# Intra-function branch: normalize to function-relative
text = i.mnemonic + " " + (i.op_str[:m.start()] +
"+" + hex(val - off) +
i.op_str[m.end():])
out.append((i.address - off, text))
return out

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,95 @@
# zi81key attempts
43U only. Baseline source absent; 0 of 9 exact functions, 0 of 21460 code bytes, 0 of 1388 data bytes.
Created the source from target assembly, the shared eZiText types, and prior decompiler scratch under /tmp. Removed the scratch source's volatile tone and parameter-storage padding. Replaced raw parameter/work offsets with local ABI structs, recovered readable local names, and retained all nine real functions in object order. Shared headers and other translation units were unchanged.
The local parameter ABI has result bytes at 0x20, 0x21, 0x22, scratch at 0x24, and a final workspace slot at 0x28. Unobserved work/options fields remain opaque. The shared ziGetParam differs from this observed ABI, so this unit uses its own struct.
Pool checked before compiler experiments: zero strings on either side, identical. All spelling tables and the search-order constant match their target data.
## Exact functions
Zi8IsMatch1Key: 97/97 instructions, diffs 0.
Zi8SetFindCand: 50/50 instructions, diffs 0.
ZiIsSupportedPhonetic: 81/81 instructions, diffs 0.
Zi8ZHCheckSpelling: initially 419/419 instructions with six frame-size differences. Restored the target's 64-character conversion buffer instead of the scratch source's 72-character array. Final 419/419 instructions, diffs 0.
## Remaining functions
Zi8SpellingZY | row pointer | src 0x1dc base 0x1ec insns 119/123 | --- replace mine 1:5 base 1:5
Zi8SpellingZY | reorder decoded components | src 0x1ec base 0x1ec insns 123/123 | diffs 6: [27, 28, 35, 36, 37, 38]
Zi8SpellingZY | typed length and key | src 0x21c base 0x1ec insns 135/123 | --- delete mine 7:8 base 7:7
Zi8SpellingPY | decode tone at use | src 0x268 base 0x274 insns 154/157 | --- insert mine 11:11 base 11:14
Zi8SpellingPY | byte length | src 0x2ac base 0x274 insns 171/157 | --- delete mine 4:5 base 4:4
Zi8SpellingPY | for spelling scans | src 0x278 base 0x274 insns 158/157 | --- delete mine 4:5 base 4:4
MatchAltSound1Key | short phonetic offset | src 0x564 base 0x554 insns 345/341 | --- replace mine 10:11 base 10:11
MatchAltSound1Key | unsigned record positions | src 0x53c base 0x554 insns 335/341 | --- replace mine 10:11 base 10:11
MatchAltSound1Key | signed key byte decode | src 0x54c base 0x554 insns 339/341 | --- replace mine 10:11 base 10:11
Zi8Get1KeyPressSpelling | reverse charset branch nesting | src 0x18bc base 0x1a90 insns 1583/1700 | --- replace mine 0:1 base 0:1
Zi8Get1KeyPressSpelling | return immediately on zero spelling limit | src 0x18e0 base 0x1a90 insns 1592/1700 | --- replace mine 0:1 base 0:1
Zi8Get1KeyPressSpelling | declare scan index before flags | src 0x18dc base 0x1a90 insns 1591/1700 | --- replace mine 0:1 base 0:1
Zi8Get1KeyPressCandidates | declare index before flags | src 0x2b7c base 0x2574 insns 2783/2397 | --- replace mine 0:1 base 0:1
Zi8Get1KeyPressCandidates | preserve signed character temporaries | src 0x2bac base 0x2574 insns 2795/2397 | --- replace mine 0:1 base 0:1
Zi8Get1KeyPressCandidates | postincrement initial input index | src 0x2b78 base 0x2574 insns 2782/2397 | --- replace mine 0:1 base 0:1
Zi8SpellingZY retains six register-choice differences at instructions 27, 28, 35, 36, 37, 38; its 123 instruction count is correct.
Zi8SpellingPY retains a register-held tone rather than the original stack tone, an extra saved register, and table-address register differences. Retained the ordinary non-volatile scalar rather than forcing a spill.
MatchAltSound1Key retains search/register and table-load ordering differences, 339/341 instructions. All three variants were rejected and the readable baseline was restored.
Zi8Get1KeyPressSpelling still differs in branch structure, automatic-variable allocation, and table access sequences. Fixed signedness of expansion count, subtype constants, and result byte offset after inspecting assembly. Final 1572/1700 instructions. No artificial register or stack constraints were used.
Zi8Get1KeyPressCandidates still differs in branch structure, automatic-variable allocation, and record access sequences. Recovered explicit includeTone/matchFull variables and the key-index decrement from assembly, corrected unsigned key comparisons, restored the target's 64-character word buffer, removed pointer/integer round trips, and retained the initial index postincrement variant. Final 2775/2397 instructions.
## Linking investigation
Temporarily switched only zi81key to Matching and built main.dol. It linked successfully but failed the required SHA1. Ran unitaudit.py, nm -n on both objects, and a full byte comparison with orig/43U/00000008.app.
Original/linked bytes: 3867904/3867904.
Linked SHA1: 003260ba28d079e13eab29ec2fce03bfd2c7d810.
First differing DOL byte: 0x5ba. Differing bytes: 2042540.
build/43U/obj/libs/RVLMiddleware/eZiText/src/clib/zi81key.o: text 0x53d4
Zi8IsMatch1Key: offset 0x460, size 0x184.
Zi8Get1KeyPressSpelling: offset 0xd44, size 0x1a90.
Zi8Get1KeyPressCandidates: offset 0x27d4, size 0x2574.
Zi8ZHCheckSpelling: offset 0x4d48, size 0x68c.
build/43U/src/libs/RVLMiddleware/eZiText/src/clib/zi81key.o: text 0x57b8
Zi8IsMatch1Key: offset 0x464, size 0x184.
Zi8Get1KeyPressSpelling: offset 0xd40, size 0x1890.
Zi8Get1KeyPressCandidates: offset 0x25d0, size 0x2b5c.
Zi8ZHCheckSpelling: offset 0x512c, size 0x68c.
Next unit Zi8SetParentalControls linked at 0x814655b0; target 0x814651cc; displacement +0x3e4.
INTERNAL .text 0x8145fdf8 libs/RVLMiddleware/eZiText/src/clib/zi81key.c {0: 2, 4: 2, -4: 2, -516: 1}
STEP .text 0x814651cc libs/RVLMiddleware/eZiText/src/clib/zi8alpha.c +0x0->+0x3e4 (prev unit libs/RVLMiddleware/eZiText/src/clib/zi81key.c)
The four exact functions do not make the whole unit linkable. Restored NonMatching in configure.py. The final full gate rebuilds the unlinked object and checks the original DOL hash, zero regressions, pool, forbidden patterns, and readability.
The meanings of opaque work/options members and the final workspace slot are not fully recovered. The large candidate/spelling routines remain a partial reconstruction; their fuzzy scores are not acceptance evidence.
## Final full gate
```text
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[libs/RVLMiddleware/eZiText/src/clib/zi81key] pool: IDENTICAL
[libs/RVLMiddleware/eZiText/src/clib/zi81key] objdiff: code 2588/21460 data 1160/1388 functions 4/9 fuzzy 66.2913 linked code 0
[libs/RVLMiddleware/eZiText/src/clib/zi81key] instruction-exact functions: 4/9
[libs/RVLMiddleware/eZiText/src/clib/zi81key] section .data size 48 match None
[libs/RVLMiddleware/eZiText/src/clib/zi81key] section .rodata size 1152 match 100.0
[libs/RVLMiddleware/eZiText/src/clib/zi81key] section .sdata2 size 8 match 100.0
[libs/RVLMiddleware/eZiText/src/clib/zi81key] section .text size 21460 match 66.291336
[libs/RVLMiddleware/eZiText/src/clib/zi81key] section extab size 72 match 97.22222
[libs/RVLMiddleware/eZiText/src/clib/zi81key] section extabindex size 108 match 95.37037
[libs/RVLMiddleware/eZiText/src/clib/zi81key] below 100: Zi8SpellingZY 99.756096
[libs/RVLMiddleware/eZiText/src/clib/zi81key] below 100: Zi8SpellingPY 97.038216
[libs/RVLMiddleware/eZiText/src/clib/zi81key] below 100: MatchAltSound1Key 95.60117
[libs/RVLMiddleware/eZiText/src/clib/zi81key] below 100: Zi8Get1KeyPressSpelling 59.97
[libs/RVLMiddleware/eZiText/src/clib/zi81key] below 100: Zi8Get1KeyPressCandidates 53.775135
[libs/RVLMiddleware/eZiText/src/clib/zi81key] baseline: code None/21460 data None functions 0 fuzzy 0.0000
regressions vs baseline: 0
global matched_code_percent: 69.56702 -> 69.65343
global fuzzy_match_percent: 77.05006 -> 77.52503
global complete_code_percent: 56.50306 -> 56.50306
global matched_data_percent: 85.57046 -> 85.63375
forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
GATE PASS
```

View File

@@ -0,0 +1,83 @@
# zi8alpha attempts
Target: Wii Menu 4.3U, libs/RVLMiddleware/eZiText/src/clib/zi8alpha.
Baseline: e265d966, the nearest ancestor with an existing gate baseline. The
worktree's initial 70970038 merge-base has no baseline file. No branch changes
or baseline edits were made.
Ten functions are instruction-exact. Both remaining functions have at least
three distinct source-level attempts. The unit remains NonMatching.
## Zi8ChangeWordCase
1. Typed workspace argument and integer case selector: 44/44 instructions,
11 differences, all register assignments involving the word and workspace.
2. Local word cursor copied from the input argument: 45/44 instructions,
with an extra input spill. Rejected.
3. Void workspace argument accessed through the workspace structure: 44/44
instructions, eight differences involving r29/r30 for the case selector
and workspace. Final objdiff 99.09091%.
4. Tried a local workspace pointer, byte/short/long case selector types, and
an explicit lower/upper case enum. None removed the remaining register
differences. Kept the enum and void workspace argument.
## Zi8AlphaGetCandidates
1. Recovered the complete control flow, workspace fields, dictionary selection,
candidate emission, prefix/suffix handling, case conversion, and punctuation
from object decompilation and target assembly. Named the locals and replaced
byte-offset memory accesses with structure fields and array indexing.
4436/3946 instructions, frame 0x340 versus 0x2B0, objdiff 41.21566%.
2. Corrected the byte/halfword flag types, unsigned punctuation comparisons,
and workspace/options argument handling. Initialized the dictionary index
used by the early punctuation exit. 4399/3946 instructions, frame 0x330,
objdiff 43.85555%.
3. Recovered typed external function declarations and return widths rather
than leaving calls with unspecified argument types. 4452/3946 instructions,
frame 0x330, objdiff 44.43614%.
4. Combined the punctuation character and its continuation storage into one
actual 48-character buffer so pointer iteration stays within an array.
4452/3946 instructions, final clean-build objdiff 44.43563%.
The remaining candidate-engine differences include stack layout, extra loads,
argument conversions, register allocation, and reconstructed branch structure.
This is not a compiler tie-break-only result. The recovered field names and
external declarations remain provisional, and engine behavior has not been
validated independently of the original assembly.
## Other iterations
- Workspace arguments accessed directly through a typed structure removed
redundant pointer spills in Zi8IsWordW2 and Zi8SetHighlightedWordW.
- Signed length/index variables, branch direction for the single-character
case, and postfix suffix indexing made ZiprocessHighlightedW exact.
- Shared true-result exits made Zi8IsVowel's switch trees exact.
- A generic beginning pointer with typed character indexing made both
exclusion functions exact after signed-length and declaration-order trials.
- Zi8DeTokenization progressed from 692 to 811 to exactly 814 instructions
after using postfix output indexing, recovered character/count widths,
a 64-character output buffer, explicit input casts, and direct length return.
## Linking trial
Temporarily changed only zi8alpha to Matching and built main.dol. Linking
succeeded, but the DOL SHA1 was f7c92fc7a6790ae104636294803a7959ea628ddf.
Both original and trial DOLs were 3867904 bytes. 2045708 common bytes differed,
from file offset 0x5BA through 0x369301.
Original Zi8AlphaGetCandidates: offset 0xA40, size 0x3DA8.
Built Zi8AlphaGetCandidates: offset 0xA40, size 0x4590.
Original Zi8DeTokenization: offset 0x47E8.
Built Zi8DeTokenization: offset 0x4FD0.
unitaudit.py found 11 text symbols at their original addresses and one shifted
by 2024 bytes. The following zi8alts unit moved by +0x7E8. Later text shifts
changed to +0x7E0, and the following rodata began at +0x7C0.
The recovered exclusion tables have 330 meaningful bytes. The original rodata
section has 336 bytes, including its trailing zero alignment. No artificial
padding was added. The original anonymous French table symbol was given the
source name FrenchExcludePairs.
Restored NonMatching, rebuilt main.dol, and confirmed SHA1
26116613f624061ba99c8d1a299aaa6efa85670d. configure.py has no final changes.

View File

@@ -0,0 +1,63 @@
# zi8cinfo attempts
Baseline source was absent. All ten functions are implemented in object order.
Nine functions have objdiff 100.0 and ctxdiff diffs 0. All 1,848 data bytes match.
No shared headers or other units were changed.
## Zi8GetSInfo, still open
- Separate count decrement followed by the zero store: 99.09775, 133/133 instructions. Only instructions 43 and 44 are swapped. Retained this version.
- Prefix decrement inside the output index: 98.42105, 131/133 instructions. Constant loading moves before the decrement, but extraCount moves from the stack to r25, removing its store/load pair.
- Assign count minus one inside the index: 98.270676 with an 8-bit count. Adds truncation of the assigned count and still moves extraCount into r25. With an int count: 98.42105.
- Post-decrement minus one inside the index: 96.729324, worse indexing and register allocation.
- Named last-index temporary: 97.89474, additional indexing/register differences.
- Changing local declaration order with prefix decrement, three orders: all 98.42105. Does not restore extraCount's stack allocation.
- Unsigned extraCount with a signed loop-bound cast: 98.42105. Same unwanted r25 allocation.
- Comma expression in the output index: 97.14286. Rejected.
- Store at count minus one, then decrement count: 99.172935, 134/133 instructions. Duplicates the decrement for address calculation and count maintenance. Rejected despite the higher fuzzy score.
The retained code emits `addi r30,r30,-1; li r3,0`, while the target emits
`li r3,0; addi r30,r30,-1`. No register, volatile, assembly, or pragma hints used.
## Functions resolved
- Zi8GetCJInfo: first reconstruction 99.888885 with two differences. Separating the initial shift caused 12 register differences. Keeping the packed assignment within its shift expression reached 100.0, 90/90 instructions. A later typed-work/separate-shift alternative produced 14 register differences and was rejected.
- Zi8GetPInfo: first reconstruction 67.7494. Using an int output count, ordinary indexed stores, post-increment for multi-character spellings, source-order initial cases, and a tone switch reached 100.0, 830/830 instructions.
- Zi8GetZInfo: initial reconstruction reached 100.0, 765/765 instructions.
- zi8StrokeCode: initial switch reached 100.0, 53/53 instructions.
- Zi81KeyPYinfo: initial switch reached 100.0, 120/120 instructions.
- Zi81KeyZYinfo: initial switch reached 100.0, 153/153 instructions.
- Zi8GetCharInfo: wrapper reached 100.0, 21/21 instructions.
- ZiCharInfo2: initial reconstruction 37.02924. Moving normalization ahead of the general lookup and reconstructing table operations reached 80.38596. Initializing the phonetic-table pointer gave 80.37622. Reconstructing the alternate-search loop, element loop, record fields, and shared normalization block gave 92.70565. Using the actual normalization switch cases and returning from that block gave 97.38012. Separating table lookup from Zi8GetPCode gave 99.48538 and the correct register allocation. Reordering real local declarations and correcting 16-bit byte promotions gave 100.0, 513/513 instructions.
- Zi8GetCharInfo2: initial reconstruction 97.9661. A word-sized result/return gave 98.98305 with only work/state registers swapped. Swapping local declarations and initializing the saved state at declaration left 98.98305. A separate work pointer gave 96.52542; a word-sized saved state gave 97.28814. Giving the work argument its real struct-pointer type resolved the allocation tie: 100.0, 59/59 instructions.
## Linking investigation
Temporarily changed only zi8cinfo to Matching and built main.dol. The result was
3,867,904 bytes, the same as the original. SHA1 was
e216152519ae06ed2d325eefaa60d96030dbf381.
Exactly eight bytes differed, all within Zi8GetSInfo:
| DOL file offset | Original word | Rebuilt word |
| --- | --- | --- |
| 0x1486d8 | 38600000 | 3bdeffff |
| 0x1486dc | 3bdeffff | 38600000 |
unitaudit.py reported no address steps or internal layout disagreements.
`nm -n` showed identical function offsets and jump-table offsets; only compiler
local-symbol names differed. Restored NonMatching because the DOL was not exact.
## Validation baseline and type notes
The default gate cannot pass because baseline-a620eec6.json is absent. Used
`--base 5cdca2e8`, the immediate ancestor with an existing immutable baseline.
This baseline records zero exact functions, zero matched code bytes, and zero
matched data bytes for this unit. No baseline files were written or modified.
The existing public header declares Zi8GetCharInfo2's result as ziU8. This unit
uses a word-sized internal declaration/definition, as required by the observed
untruncated return and callers inside this object. Results remain character
counts within the byte range; the shared public header remains unchanged.
ZiInfoWork names the accessed fields at 0x16 and 0x18; prefix-field names do not
claim that the full work-data structure has been independently decompiled.

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