Compare commits

...

1 Commits

12 changed files with 3717 additions and 7 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

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