Compare commits
1 Commits
cleanup/se
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00b8463f2c |
@@ -53,9 +53,9 @@ Progress
|
||||
<!-- progress:start -->
|
||||
| Decompiled | Matched | Linked | Data |
|
||||
|:---:|:---:|:---:|:---:|
|
||||
| 84.12% | 74.70% | 56.76% | 86.51% |
|
||||
| 84.36% | 74.91% | 56.76% | 86.70% |
|
||||
|
||||
units 748/1027 complete, functions 10894/12563 matched.
|
||||
units 748/1027 complete, functions 10949/12563 matched.
|
||||
|
||||
decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data
|
||||
<!-- progress:end -->
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace textinput {
|
||||
u32 GetModifierState() const;
|
||||
void SetModifierState(u32, u32);
|
||||
|
||||
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
class KeySet {
|
||||
public:
|
||||
u8 GetKey() const;
|
||||
|
||||
@@ -142,6 +142,9 @@ namespace textinput {
|
||||
MEMAllocator* mpAllocator; // 0x08
|
||||
};
|
||||
|
||||
#ifdef TISIGNWINDOW_IMPLEMENTATION
|
||||
bool isAtokActive() const;
|
||||
#endif
|
||||
virtual ~Base();
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
Base(Manager* manager);
|
||||
|
||||
@@ -12,28 +12,32 @@ namespace textinput {
|
||||
KeyboardBase() : meLanguage(JP) {}
|
||||
#endif
|
||||
virtual ~KeyboardBase() {}
|
||||
#if !defined(TI_PC_KEYBOARD_IMPLEMENTATION) && !defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if !defined(TI_PC_KEYBOARD_IMPLEMENTATION) && !defined(TIMANAGER_IMPLEMENTATION) && !defined(TISIGNWINDOW_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
|
||||
#ifndef TIMANAGER_IMPLEMENTATION
|
||||
#if !defined(TIMANAGER_IMPLEMENTATION) && !defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
virtual void updateFromReceiver(u32, void*) override;
|
||||
#endif
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
virtual void onKey(u32, void*);
|
||||
#else
|
||||
virtual void onKey(u32);
|
||||
#endif
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
virtual int getType();
|
||||
#else
|
||||
virtual void getType();
|
||||
#endif
|
||||
virtual void setLanguage(Language language);
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
#ifdef TISIGNWINDOW_IMPLEMENTATION
|
||||
virtual Language getLanguage() const;
|
||||
#else
|
||||
virtual Language getLanguage() const { return meLanguage; }
|
||||
#endif
|
||||
virtual void update() {}
|
||||
#else
|
||||
virtual Language getLanguage() const;
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace textinput {
|
||||
class TiEventHandler : public gui::EventHandler {
|
||||
public:
|
||||
typedef struct Input {
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
u32 controller;
|
||||
f32 x;
|
||||
f32 y;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef TEXTINPUT_PC_KEYBOARD_H
|
||||
#define TEXTINPUT_PC_KEYBOARD_H
|
||||
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
#include "tiPcKeyboardImpl.h"
|
||||
#else
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace textinput {
|
||||
}
|
||||
namespace keyboard {
|
||||
namespace signwindow {
|
||||
#ifndef TISIGNWINDOW_IMPLEMENTATION
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
struct LanguageDependencyData;
|
||||
class Base : public KeyboardBase {
|
||||
@@ -87,6 +88,7 @@ namespace textinput {
|
||||
virtual void open(KeyboardBase* keyboard, bool repeat);
|
||||
virtual bool isActive();
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
134
include/keyboard/tiSignWindow.h
Normal file
134
include/keyboard/tiSignWindow.h
Normal file
@@ -0,0 +1,134 @@
|
||||
#ifndef TEXTINPUT_SIGN_WINDOW_H
|
||||
#define TEXTINPUT_SIGN_WINDOW_H
|
||||
|
||||
#include "tiKeyboard.h"
|
||||
#include "tiNw4rManager.h"
|
||||
#include "tiSwData.h"
|
||||
|
||||
namespace textinput {
|
||||
class Manager;
|
||||
namespace keyboard {
|
||||
|
||||
namespace signwindow {
|
||||
|
||||
struct LanguageDependency {
|
||||
u8 count;
|
||||
const PaneNameToCharCodeInSignMode* keys;
|
||||
};
|
||||
|
||||
class Base : public KeyboardBase {
|
||||
public:
|
||||
virtual ~Base();
|
||||
virtual void create(MEMAllocator*) override;
|
||||
virtual void init() override;
|
||||
virtual void onKey(u32, void*) override;
|
||||
virtual bool isLocked();
|
||||
virtual void setPage(u8);
|
||||
virtual u8 getPage();
|
||||
virtual void movePrevSignPage();
|
||||
virtual void moveNextSignPage();
|
||||
virtual void close();
|
||||
virtual int getType() override;
|
||||
virtual void setLanguage(Language) override;
|
||||
|
||||
protected:
|
||||
u8 mInputFlags;
|
||||
bool mbLocked;
|
||||
bool mbRepeat;
|
||||
u8 muPage;
|
||||
const LanguageDependency* mpLanguageDependency;
|
||||
MEMAllocator* mpAllocator;
|
||||
Manager* mpManager;
|
||||
};
|
||||
|
||||
class EventHandler;
|
||||
|
||||
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public nw4rmanager::AnmObserver {
|
||||
public:
|
||||
virtual ~LayoutByNW4R();
|
||||
virtual void create(MEMAllocator*) override;
|
||||
virtual void init() override;
|
||||
virtual void onKey(u32, void*) override;
|
||||
virtual void movePrevSignPage() override;
|
||||
virtual void moveNextSignPage() override;
|
||||
virtual void close() override;
|
||||
virtual void draw() override;
|
||||
virtual void open(KeyboardBase*, bool);
|
||||
virtual bool isActive();
|
||||
virtual void onChangeAnmState(AnmEvent, nw4rmanager::AnmPane*, nw4rmanager::Anim*) override;
|
||||
virtual bool updateInput(int, f32, f32, u32, u32, u32, void*) override;
|
||||
virtual bool updateInput(input::HKBManager&) override;
|
||||
virtual void throwReleaseForAll();
|
||||
virtual void resetAnmSignWindow();
|
||||
virtual void setSignKeyTop(u16, u16);
|
||||
virtual void setPageNumber(u16);
|
||||
virtual void endToClose();
|
||||
virtual void startToInput();
|
||||
virtual void movePrevSignWindow();
|
||||
virtual void moveNextSignWindow();
|
||||
|
||||
bool mbActive;
|
||||
bool mbInput;
|
||||
EventHandler* mpEventHandler;
|
||||
KeyboardBase* mpKeyboard;
|
||||
};
|
||||
|
||||
class Sample : public LayoutByNW4R {
|
||||
public:
|
||||
virtual ~Sample();
|
||||
};
|
||||
|
||||
class EventHandler : public nw4rmanager::TiEventHandler {
|
||||
public:
|
||||
explicit EventHandler(LayoutByNW4R* layout) : mpLayoutByNW4R(layout) {}
|
||||
virtual ~EventHandler();
|
||||
virtual void onTiEvent(gui::PaneComponent*, u32, Input*) override;
|
||||
LayoutByNW4R* mpLayoutByNW4R;
|
||||
};
|
||||
|
||||
class AnmPane : public nw4rmanager::AnmPane {
|
||||
public:
|
||||
AnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
|
||||
: nw4rmanager::AnmPane(pane, observer), muAnimation(0) {}
|
||||
inline virtual ~AnmPane();
|
||||
virtual void init() override;
|
||||
virtual void changeAnimation(u32) override;
|
||||
virtual u32 getKeyType() const;
|
||||
|
||||
protected:
|
||||
s32 muAnimation;
|
||||
u32 muKeyType;
|
||||
};
|
||||
|
||||
class CellPhoneSignAllAnmPane : public AnmPane {
|
||||
public:
|
||||
CellPhoneSignAllAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
|
||||
: AnmPane(pane, observer) { muKeyType = 0; }
|
||||
virtual ~CellPhoneSignAllAnmPane();
|
||||
virtual void init() override;
|
||||
virtual void onAnmEvent(AnmPaneEvent) override;
|
||||
};
|
||||
|
||||
class CellPhoneSignScrollAnmPane : public AnmPane {
|
||||
public:
|
||||
CellPhoneSignScrollAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
|
||||
: AnmPane(pane, observer) { muKeyType = 1; }
|
||||
virtual ~CellPhoneSignScrollAnmPane();
|
||||
virtual void init() override;
|
||||
virtual void onAnmEvent(AnmPaneEvent) override;
|
||||
};
|
||||
|
||||
class CellPhoneSignButtonPane : public AnmPane {
|
||||
public:
|
||||
CellPhoneSignButtonPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
|
||||
: AnmPane(pane, observer) { muKeyType = 2; }
|
||||
virtual ~CellPhoneSignButtonPane();
|
||||
virtual void init() override;
|
||||
virtual void onAnmEvent(AnmPaneEvent) override;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -70,7 +70,7 @@ namespace textinput {
|
||||
INPUT_COMMAND_37 = 37,
|
||||
} INPUT_COMMAND;
|
||||
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
struct ChangePredictMode { u32 mode; bool enabled; };
|
||||
#endif
|
||||
virtual void clearSender();
|
||||
|
||||
678
src/keyboard/tiSignWindow.cpp
Normal file
678
src/keyboard/tiSignWindow.cpp
Normal file
@@ -0,0 +1,678 @@
|
||||
#define TISIGNWINDOW_IMPLEMENTATION
|
||||
#include "keyboard/tiSignWindow.h"
|
||||
#include "keyboard/tiManager.h"
|
||||
#include "keyboard/tiLanguageIndependentData.h"
|
||||
#include "keyboard/tiUtil.h"
|
||||
|
||||
#include <new>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
|
||||
|
||||
namespace textinput {
|
||||
namespace keyboard {
|
||||
|
||||
namespace signwindow {
|
||||
|
||||
struct AnimationFile {
|
||||
u32 id;
|
||||
char name[64];
|
||||
};
|
||||
|
||||
struct PaneAnimation {
|
||||
s32 type;
|
||||
char paneName[20];
|
||||
u32 animationCount;
|
||||
const char* forceName;
|
||||
const AnimationFile* animations[8];
|
||||
};
|
||||
|
||||
struct PaneControlKey {
|
||||
char paneName[20];
|
||||
u32 key;
|
||||
};
|
||||
|
||||
const char* csSgnKeys[20] = {
|
||||
"P_SGNkey_00", "P_SGNkey_01", "P_SGNkey_02", "P_SGNkey_03", "P_SGNkey_04",
|
||||
"P_SGNkey_05", "P_SGNkey_06", "P_SGNkey_07", "P_SGNkey_08", "P_SGNkey_09",
|
||||
"P_SGNkey_10", "P_SGNkey_11", "P_SGNkey_12", "P_SGNkey_13", "P_SGNkey_14",
|
||||
"P_SGNkey_15", "P_SGNkey_16", "P_SGNkey_17", "P_SGNkey_18", "P_SGNkey_19",
|
||||
};
|
||||
|
||||
static const char* csSgnKeyBase = "P_SGNkey_00";
|
||||
static const char* csSgnKeyClose = "P_SGNkey_close";
|
||||
|
||||
const AnimationFile csAninationFileForSign[9] = {
|
||||
{0, "fs_signWindow_a_SGN_normal.brlan"},
|
||||
{1, "fs_signWindow_a_SGN_FADE-IN.brlan"},
|
||||
{8, "fs_signWindow_a_Scroll_FADE-OUT.brlan"},
|
||||
{2, "fs_signWindow_a_SGN_Focus-IN.brlan"},
|
||||
{6, "fs_signWindow_a_SGN_Focus-OUT.brlan"},
|
||||
{3, "fs_signWindow_a_SGN_Roll_over.brlan"},
|
||||
{4, "fs_signWindow_a_SGN_Pushed.brlan"},
|
||||
{7, "fs_signWindow_a_SGN_scroll_next.brlan"},
|
||||
{5, "fs_signWindow_a_SGN_scroll_prev.brlan"},
|
||||
};
|
||||
|
||||
static const PaneControlKey csPaneNameToControlKey[3] = {
|
||||
{"B_SGNkey_close", 0x18},
|
||||
{"B_SGNkey_prev", 0x1A},
|
||||
{"B_SGNkey_next", 0x19},
|
||||
};
|
||||
|
||||
static const LanguageDependency csLanguageDependencyData[10] = {
|
||||
{4, csSignKeyJP}, {10, csSignKeyUS}, {10, csSignKeyUK}, {10, csSignKeyFR}, {10, csSignKeyDE},
|
||||
{10, csSignKeyIT}, {10, csSignKeySP}, {10, csSignKeyNL}, {4, csSignKeyCN}, {4, csSignKeyKR},
|
||||
};
|
||||
|
||||
struct InputCharacter {
|
||||
wchar_t character;
|
||||
u16 type;
|
||||
bool repeat;
|
||||
u32 value;
|
||||
};
|
||||
static const InputCharacter inputCharacterTemplate = {0, 3, false, 0};
|
||||
|
||||
static PaneAnimation csPaneToAnimationInSign[25] = {
|
||||
{0, "N_SGNkeytop_all", 3, 0, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2]}},
|
||||
{1, "N_SGNkeyall", 3, 0, {&csAninationFileForSign[0], &csAninationFileForSign[7], &csAninationFileForSign[8]}},
|
||||
{2, "P_SGNkey_00", 7, 0, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_01", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_02", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_03", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_04", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_05", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_06", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_07", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_08", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_09", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_10", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_11", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_12", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_13", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_14", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_15", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_16", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_17", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_18", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_19", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_prev", 7, csSgnKeyClose, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_next", 7, csSgnKeyClose, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_close", 7, 0, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
};
|
||||
|
||||
static inline s32 findControlKey(const char* paneName) {
|
||||
u32 index = 0;
|
||||
do {
|
||||
if (util::strcmp(csPaneNameToControlKey[index & 0xFFFF].paneName, paneName))
|
||||
return csPaneNameToControlKey[index & 0xFFFF].key;
|
||||
++index;
|
||||
} while (index < 3);
|
||||
return 0x1B;
|
||||
}
|
||||
|
||||
static inline wchar_t findSignCharacter(const PaneNameToCharCodeInSignMode* keys, u16 page, const char* paneName) {
|
||||
u32 index = 0;
|
||||
do {
|
||||
if (util::strcmp(keys[index & 0xFFFF].szPaneName, paneName))
|
||||
return keys[index & 0xFFFF].wc[page];
|
||||
++index;
|
||||
} while (index < 20);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Base::create(MEMAllocator*) {
|
||||
muPage = 0;
|
||||
mbLocked = 0;
|
||||
mbRepeat = 0;
|
||||
mpLanguageDependency = &csLanguageDependencyData[getLanguage()];
|
||||
}
|
||||
|
||||
void Base::init() {
|
||||
muPage = 0;
|
||||
mbLocked = 0;
|
||||
mbRepeat = 0;
|
||||
mpLanguageDependency = &csLanguageDependencyData[getLanguage()];
|
||||
}
|
||||
|
||||
void Base::onKey(u32 command, void* data) {
|
||||
s32 key;
|
||||
if (command != 4) {
|
||||
return;
|
||||
}
|
||||
|
||||
key = findControlKey(static_cast<const char*>(data));
|
||||
|
||||
if (key != 0x1B) {
|
||||
switch (key) {
|
||||
case 0x18:
|
||||
close();
|
||||
break;
|
||||
case 0x1A:
|
||||
movePrevSignPage();
|
||||
break;
|
||||
case 0x19:
|
||||
moveNextSignPage();
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
u16 code = findSignCharacter(mpLanguageDependency->keys, muPage, static_cast<const char*>(data));
|
||||
|
||||
if (code != 0) {
|
||||
InputCharacter input = inputCharacterTemplate;
|
||||
input.character = code;
|
||||
input.repeat = mbRepeat;
|
||||
if (mpManager->getInputForm()->isAtokActive()) {
|
||||
input.repeat = true;
|
||||
}
|
||||
if (meLanguage - 8U <= 1U) {
|
||||
input.repeat = 1;
|
||||
}
|
||||
sendCommand(5, &input);
|
||||
}
|
||||
}
|
||||
|
||||
void Base::close() {}
|
||||
|
||||
void Base::movePrevSignPage() {
|
||||
if (muPage == 0) {
|
||||
muPage = mpLanguageDependency->count - 1;
|
||||
return;
|
||||
}
|
||||
muPage = muPage - 1;
|
||||
return;
|
||||
}
|
||||
|
||||
void Base::moveNextSignPage() {
|
||||
u8 page = muPage + 1;
|
||||
muPage = page;
|
||||
if (page < mpLanguageDependency->count) {
|
||||
return;
|
||||
}
|
||||
muPage = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
LayoutByNW4R::~LayoutByNW4R() {
|
||||
mpEventHandler->~EventHandler();
|
||||
MEMFreeToAllocator(mpAllocator, mpEventHandler);
|
||||
AnmPane* pane = static_cast<AnmPane*>(nw4r::ut::List_GetNext(&mAnmPanes, NULL));
|
||||
while (pane != NULL) {
|
||||
nw4r::ut::List_Remove(&mAnmPanes, pane);
|
||||
pane->destroy(mpAllocator);
|
||||
pane = static_cast<AnmPane*>(nw4r::ut::List_GetNext(&mAnmPanes, NULL));
|
||||
}
|
||||
}
|
||||
|
||||
Base::~Base() {}
|
||||
|
||||
EventHandler::~EventHandler() {}
|
||||
|
||||
void LayoutByNW4R::create(MEMAllocator* allocator) {
|
||||
mpAllocator = allocator;
|
||||
Base::create(allocator);
|
||||
void* eventBuffer = MEMAllocFromAllocator(allocator, sizeof(EventHandler));
|
||||
mpEventHandler = new (eventBuffer) EventHandler(this);
|
||||
Layout::createWithEventHandler(allocator, mpEventHandler);
|
||||
mpPaneManager->setAllComponentTriggerTarget(false);
|
||||
mpPaneManager->setAllBoundingBoxComponentTriggerTarget(true);
|
||||
|
||||
const char* forceName;
|
||||
u32 animationCount;
|
||||
u32 paneIndex = 0;
|
||||
do {
|
||||
AnmPane* pane = NULL;
|
||||
const PaneAnimation& paneInfo = csPaneToAnimationInSign[paneIndex & 0xFFFF];
|
||||
switch (paneInfo.type) {
|
||||
case 2: {
|
||||
void* paneBuffer = MEMAllocFromAllocator(allocator, sizeof(CellPhoneSignButtonPane));
|
||||
pane = new (paneBuffer) CellPhoneSignButtonPane(getPane(paneInfo.paneName), this);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
void* paneBuffer = MEMAllocFromAllocator(allocator, sizeof(CellPhoneSignScrollAnmPane));
|
||||
pane = new (paneBuffer) CellPhoneSignScrollAnmPane(getPane(paneInfo.paneName), this);
|
||||
break;
|
||||
}
|
||||
case 0: {
|
||||
void* paneBuffer = MEMAllocFromAllocator(allocator, sizeof(CellPhoneSignAllAnmPane));
|
||||
pane = new (paneBuffer) CellPhoneSignAllAnmPane(getPane(paneInfo.paneName), this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
nw4r::ut::List_Append(&mAnmPanes, pane);
|
||||
forceName = paneInfo.forceName;
|
||||
animationCount = paneInfo.animationCount;
|
||||
u16 animationIndex = 0;
|
||||
while (animationIndex < animationCount) {
|
||||
void* resource = mpMultiArcResourceAccessor->GetResource(0, paneInfo.animations[animationIndex]->name);
|
||||
AnimTransformPane* transform = static_cast<AnimTransformPane*>(
|
||||
getLayout()->CreateAnimTransform(resource, mpMultiArcResourceAccessor));
|
||||
if (forceName != NULL) {
|
||||
pane->forceAddAnimation(allocator, paneInfo.animations[animationIndex]->id, transform, forceName, false, true);
|
||||
} else {
|
||||
pane->addAnimation(allocator, paneInfo.animations[animationIndex]->id, transform, false, true);
|
||||
}
|
||||
++animationIndex;
|
||||
}
|
||||
++paneIndex;
|
||||
} while (paneIndex < 25);
|
||||
init();
|
||||
}
|
||||
|
||||
AnmPane::~AnmPane() {}
|
||||
|
||||
void LayoutByNW4R::init() {
|
||||
Base::init();
|
||||
searchAnmPane("N_SGNkeytop_all")->changeAnimation(0);
|
||||
setVisible("N_SGNkeytop_all", true);
|
||||
searchAnmPane("P_SGNkey_prev")->changeAnimation(0);
|
||||
searchAnmPane("P_SGNkey_next")->changeAnimation(0);
|
||||
setSignKeyTop(muPage, muPage);
|
||||
setPageNumber(muPage);
|
||||
mpLayout->Animate(0);
|
||||
mpLayout->CalculateMtx(mDrawInfo);
|
||||
}
|
||||
|
||||
void LayoutByNW4R::onKey(u32 command, void* data) {
|
||||
Base::onKey(command, data);
|
||||
if (command == 4) {
|
||||
s32 key;
|
||||
const char* paneName = static_cast<const char*>(data);
|
||||
key = findControlKey(paneName);
|
||||
|
||||
if (key == 0x1B) {
|
||||
goto character;
|
||||
}
|
||||
switch (key) {
|
||||
case 0x18:
|
||||
mpEventObserver->onSE(sound::SE_CHAR_DECIDE);
|
||||
break;
|
||||
case 0x19:
|
||||
case 0x1A:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
|
||||
character:
|
||||
u16 code = findSignCharacter(mpLanguageDependency->keys, muPage, paneName);
|
||||
|
||||
if ((code != 0) && (mpKeyboard->getType() == 0)) {
|
||||
sendCommand(0x27, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutByNW4R::open(KeyboardBase* keyboard, bool input) {
|
||||
resetAnmSignWindow();
|
||||
throwReleaseForAll();
|
||||
getPaneManager()->init();
|
||||
if (meLanguage - 8U <= 1U) {
|
||||
sendCommand(6, NULL);
|
||||
}
|
||||
mbActive = 1;
|
||||
mbInput = 0;
|
||||
mpKeyboard = keyboard;
|
||||
initPaneLastDrawReceived();
|
||||
mbRepeat = input;
|
||||
setSignKeyTop(muPage, muPage);
|
||||
setPageNumber(muPage);
|
||||
searchAnmPane("N_SGNkeytop_all")->onAnmEvent(nw4rmanager::AnmPane::PE_6);
|
||||
mpEventObserver->onSE(sound::SE_SYMBOL_PAGE_OPEN);
|
||||
}
|
||||
|
||||
void LayoutByNW4R::close() {
|
||||
if (mpKeyboard->getType() == 0) {
|
||||
keyboard::pctype::LayoutByNW4R* keyboard = static_cast<keyboard::pctype::LayoutByNW4R*>(mpKeyboard);
|
||||
static_cast<nw4rmanager::Layout&>(*keyboard).getLayout()->GetRootPane()->SetVisible(true);
|
||||
}
|
||||
searchAnmPane("N_SGNkeytop_all")->onAnmEvent(nw4rmanager::AnmPane::PE_7);
|
||||
mbInput = 0;
|
||||
}
|
||||
|
||||
void LayoutByNW4R::endToClose() {
|
||||
if (mpKeyboard != NULL) {
|
||||
mpKeyboard->update();
|
||||
}
|
||||
mbActive = 0;
|
||||
setVisible("N_SGNkeytop_all", false);
|
||||
}
|
||||
|
||||
void LayoutByNW4R::startToInput() {
|
||||
mbInput = 1;
|
||||
if (mpKeyboard->getType() == 0) {
|
||||
keyboard::pctype::LayoutByNW4R* keyboard = static_cast<keyboard::pctype::LayoutByNW4R*>(mpKeyboard);
|
||||
static_cast<nw4rmanager::Layout&>(*keyboard).getLayout()->GetRootPane()->SetVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutByNW4R::onChangeAnmState(AnmEvent event, nw4rmanager::AnmPane* pane, nw4rmanager::Anim* anim) {
|
||||
if (util::strcmp("N_SGNkeyall", pane->getPane()->GetName()) &&
|
||||
((anim->muID == 7 || anim->muID == 5) && event == nw4rmanager::AnmObserver::E_1)) {
|
||||
setSignKeyTop(muPage, muPage);
|
||||
}
|
||||
if (util::strcmp("N_SGNkeytop_all", pane->getPane()->GetName())) {
|
||||
if ((anim->muID == 8) && (event == nw4rmanager::AnmObserver::E_1)) {
|
||||
endToClose();
|
||||
}
|
||||
if ((anim->muID == 1) && (event == nw4rmanager::AnmObserver::E_1)) {
|
||||
startToInput();
|
||||
}
|
||||
}
|
||||
if (anim->muID == 7 || anim->muID == 5) {
|
||||
if (event == nw4rmanager::AnmObserver::E_0) {
|
||||
mbLocked = 1;
|
||||
}
|
||||
if (event == nw4rmanager::AnmObserver::E_1) {
|
||||
mbLocked = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutByNW4R::throwReleaseForAll() {
|
||||
nw4rmanager::AnmPane* pane = static_cast<nw4rmanager::AnmPane*>(nw4r::ut::List_GetNext(&mAnmPanes, NULL));
|
||||
while (pane != NULL) {
|
||||
s32 keyType = static_cast<AnmPane*>(pane)->getKeyType();
|
||||
if (keyType == 2) {
|
||||
pane->onAnmEvent(nw4rmanager::AnmPane::PE_2);
|
||||
}
|
||||
pane = static_cast<nw4rmanager::AnmPane*>(nw4r::ut::List_GetNext(&mAnmPanes, pane));
|
||||
}
|
||||
}
|
||||
|
||||
u32 AnmPane::getKeyType() const {
|
||||
return muKeyType;
|
||||
}
|
||||
|
||||
void LayoutByNW4R::resetAnmSignWindow() {
|
||||
for (u16 i = 0; i < 25; i++) {
|
||||
searchAnmPane(csPaneToAnimationInSign[i].paneName)->init();
|
||||
}
|
||||
}
|
||||
|
||||
void AnmPane::init() {
|
||||
muAnimation = 0;
|
||||
}
|
||||
|
||||
void LayoutByNW4R::setSignKeyTop(u16 oldPage, u16 newPage) {
|
||||
char paneName[17];
|
||||
wchar_t oldCharacter[2];
|
||||
wchar_t newCharacter[2];
|
||||
for (u16 i = 0; i < 20; i++) {
|
||||
const char* sourcePaneName = mpLanguageDependency->keys[i].szPaneName;
|
||||
memset(paneName, 0, 0x11);
|
||||
strncpy(paneName, sourcePaneName, strlen(sourcePaneName));
|
||||
paneName[0] = 'T';
|
||||
oldCharacter[0] = mpLanguageDependency->keys[i].wc[oldPage];
|
||||
oldCharacter[1] = 0;
|
||||
const char* nextPaneName = mpLanguageDependency->keys[i].szNextPaneName;
|
||||
newCharacter[0] = mpLanguageDependency->keys[i].wc[newPage];
|
||||
newCharacter[1] = 0;
|
||||
nw4r::lyt::TextBox* textBox = static_cast<nw4r::lyt::TextBox*>(getPane(paneName));
|
||||
textBox->SetString(oldCharacter, 0);
|
||||
textBox = static_cast<nw4r::lyt::TextBox*>(getPane(nextPaneName));
|
||||
textBox->SetString(newCharacter, 0);
|
||||
}
|
||||
setString("T_SGNkey_prev", langindependent::cLanguageIndependentString[langindependent::LANG_STRID_PREV][getLanguage()]);
|
||||
setString("T_SGNkey_next", langindependent::cLanguageIndependentString[langindependent::LANG_STRID_NEXT][getLanguage()]);
|
||||
setString("T_SGNkey_close", langindependent::cLanguageIndependentString[langindependent::LANG_STRID_CLOSE][getLanguage()]);
|
||||
}
|
||||
|
||||
void LayoutByNW4R::setPageNumber(u16 page) {
|
||||
wchar_t text[17];
|
||||
swprintf(text, 0x11, L"%d/%d", page + 1, mpLanguageDependency->count);
|
||||
nw4r::lyt::TextBox* textBox = static_cast<nw4r::lyt::TextBox*>(getPane("T_SGN_pageNumber"));
|
||||
textBox->SetString(text, 0);
|
||||
}
|
||||
|
||||
void LayoutByNW4R::movePrevSignPage() {
|
||||
u8 oldPage = muPage;
|
||||
if (oldPage == 0) {
|
||||
muPage = mpLanguageDependency->count - 1;
|
||||
} else {
|
||||
muPage = oldPage - 1;
|
||||
}
|
||||
u8 newPage = muPage;
|
||||
setSignKeyTop(oldPage, newPage);
|
||||
setPageNumber(newPage);
|
||||
movePrevSignWindow();
|
||||
mpEventObserver->onSE(sound::SE_15);
|
||||
}
|
||||
|
||||
void LayoutByNW4R::moveNextSignPage() {
|
||||
u8 oldPage = muPage;
|
||||
u8 page = oldPage + 1;
|
||||
muPage = page;
|
||||
if (page >= mpLanguageDependency->count) {
|
||||
muPage = 0;
|
||||
}
|
||||
u8 newPage = muPage;
|
||||
setSignKeyTop(oldPage, newPage);
|
||||
setPageNumber(newPage);
|
||||
moveNextSignWindow();
|
||||
mpEventObserver->onSE(sound::SE_15);
|
||||
}
|
||||
|
||||
void LayoutByNW4R::movePrevSignWindow() {
|
||||
searchAnmPane("N_SGNkeyall")->onAnmEvent(static_cast<nw4rmanager::AnmPane::AnmPaneEvent>(8));
|
||||
}
|
||||
|
||||
void LayoutByNW4R::moveNextSignWindow() {
|
||||
searchAnmPane("N_SGNkeyall")->onAnmEvent(static_cast<nw4rmanager::AnmPane::AnmPaneEvent>(9));
|
||||
}
|
||||
|
||||
bool LayoutByNW4R::updateInput(int point, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data) {
|
||||
if (mbInput != 0) {
|
||||
return nw4rmanager::Layout::updateInput(point, x, y, trig, hold, release, data);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LayoutByNW4R::updateInput(input::HKBManager& manager) {
|
||||
if (mbInput == 0) {
|
||||
return false;
|
||||
}
|
||||
input::HKBManager::KeySet keySet = manager.GetTriggeredKeySet();
|
||||
if (keySet.IsValid()) {
|
||||
throwReleaseForAll();
|
||||
close();
|
||||
mpEventObserver->onSE(sound::SE_CHAR_DECIDE);
|
||||
return false;
|
||||
}
|
||||
return nw4rmanager::Layout::updateInput(manager);
|
||||
}
|
||||
|
||||
void EventHandler::onTiEvent(gui::PaneComponent* paneComponent, u32 event, Input* input) {
|
||||
s32 eventType = event;
|
||||
const char* name = paneComponent->getPane()->GetName();
|
||||
if (!mpLayoutByNW4R->isLocked() || event != 4) {
|
||||
if (event == 4 && (input->trigger & 0x800) != 0) {
|
||||
mpLayoutByNW4R->onKey(4, const_cast<char*>(name));
|
||||
}
|
||||
if (name[0] == 'B') {
|
||||
char paneName[24];
|
||||
memset(paneName, 0, 0x11);
|
||||
strncpy(paneName, name, strlen(name));
|
||||
paneName[0] = 'P';
|
||||
AnmPane* pane = static_cast<AnmPane*>(mpLayoutByNW4R->searchAnmPane(paneName));
|
||||
if (pane != NULL) {
|
||||
switch (eventType) {
|
||||
case 4:
|
||||
if ((input->trigger & 0x800) != 0) {
|
||||
pane->onAnmEvent(nw4rmanager::AnmPane::PE_0);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
pane->onAnmEvent(nw4rmanager::AnmPane::PE_2);
|
||||
break;
|
||||
case 0:
|
||||
mpEventObserver->onSE(sound::SE_SELECT);
|
||||
mpLayoutByNW4R->setPaneLastDrawReceived(pane->getPane());
|
||||
pane->onAnmEvent(nw4rmanager::AnmPane::PE_1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Base::isLocked() {
|
||||
return mbLocked;
|
||||
}
|
||||
|
||||
void CellPhoneSignAllAnmPane::onAnmEvent(AnmPaneEvent event) {
|
||||
if (event == 6) {
|
||||
getPane()->SetVisible(true);
|
||||
changeAnimation(1);
|
||||
return;
|
||||
}
|
||||
if (event == 7) {
|
||||
changeAnimation(8);
|
||||
return;
|
||||
}
|
||||
if (muAnimation != 8) {
|
||||
if (muAnimation >= 8) {
|
||||
return;
|
||||
}
|
||||
if (muAnimation != 1) {
|
||||
return;
|
||||
}
|
||||
if (event != 4) {
|
||||
return;
|
||||
}
|
||||
changeAnimation(0);
|
||||
return;
|
||||
}
|
||||
if (event == 4) {
|
||||
getPane()->SetVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void AnmPane::changeAnimation(u32 animation) {
|
||||
muAnimation = animation;
|
||||
nw4rmanager::AnmPane::changeAnimation(animation);
|
||||
}
|
||||
|
||||
void CellPhoneSignScrollAnmPane::onAnmEvent(AnmPaneEvent event) {
|
||||
switch (muAnimation) {
|
||||
case 0:
|
||||
if (event == 9) {
|
||||
changeAnimation(5);
|
||||
}
|
||||
if (event != 8) {
|
||||
return;
|
||||
}
|
||||
changeAnimation(7);
|
||||
return;
|
||||
case 5:
|
||||
case 7:
|
||||
if (event != 4) {
|
||||
return;
|
||||
}
|
||||
changeAnimation(0);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void CellPhoneSignButtonPane::onAnmEvent(AnmPaneEvent event) {
|
||||
if (event == 0) {
|
||||
changeAnimation(4);
|
||||
}
|
||||
switch (muAnimation) {
|
||||
case 0:
|
||||
if (event == 1) {
|
||||
changeAnimation(2);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (event == 4) {
|
||||
changeAnimation(3);
|
||||
}
|
||||
if (event == 2) {
|
||||
changeAnimation(6);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (event == 2) {
|
||||
changeAnimation(6);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (event == 4) {
|
||||
changeAnimation(0);
|
||||
}
|
||||
if (event == 1) {
|
||||
changeAnimation(2);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (event == 4) {
|
||||
changeAnimation(3);
|
||||
}
|
||||
if (event == 2) {
|
||||
changeAnimation(6);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutByNW4R::draw() {
|
||||
nw4rmanager::Layout::draw();
|
||||
}
|
||||
|
||||
}
|
||||
void KeyboardBase::onActive() {}
|
||||
namespace signwindow {
|
||||
|
||||
u8 Base::getPage() {
|
||||
return muPage;
|
||||
}
|
||||
|
||||
void Base::setPage(u8 page) {
|
||||
muPage = page;
|
||||
if (muPage < mpLanguageDependency->count) {
|
||||
return;
|
||||
}
|
||||
muPage = 0;
|
||||
}
|
||||
|
||||
void Base::setLanguage(Language language) {
|
||||
meLanguage = language;
|
||||
init();
|
||||
}
|
||||
|
||||
int Base::getType() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
bool LayoutByNW4R::isActive() {
|
||||
return mbActive;
|
||||
}
|
||||
|
||||
CellPhoneSignButtonPane::~CellPhoneSignButtonPane() {}
|
||||
|
||||
void CellPhoneSignButtonPane::init() {
|
||||
muAnimation = 0;
|
||||
}
|
||||
|
||||
void CellPhoneSignScrollAnmPane::init() {
|
||||
muAnimation = 0;
|
||||
}
|
||||
|
||||
CellPhoneSignAllAnmPane::~CellPhoneSignAllAnmPane() {}
|
||||
|
||||
void CellPhoneSignAllAnmPane::init() {
|
||||
muAnimation = 0;
|
||||
}
|
||||
|
||||
CellPhoneSignScrollAnmPane::~CellPhoneSignScrollAnmPane() {}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
45
tools/decomp-assist/tiSignWindow.attempts.md
Normal file
45
tools/decomp-assist/tiSignWindow.attempts.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# tiSignWindow matching attempts
|
||||
|
||||
Baseline: absent source, 0/56 functions and 0/7184 code bytes. The source reconstructs the actual animation, pane, language, and key-name tables using ordinary literals and typed objects. Previous scratch C++ and the original-object Ghidra export were references. Their explicit padding, mangled free-function calls, manual vtable dispatch, and raw pointer offsets were removed before the first build.
|
||||
|
||||
## Data
|
||||
|
||||
The first build already had all 30 strings in the original pool order. The nine animation records occupy 612 bytes; the compiler supplies the following alignment naturally, without a padding record. InputCharacter is a real 12-byte command payload with ordinary aggregate initialization.
|
||||
|
||||
The first .data score was 83.582375%. Declaring the three concrete animation-pane classes in reverse vtable emission order restored their table order. Inheriting CommandSender::setCommandReceiver and sendCommand for this unit corrected the two Base/Layout vtables. All data sections subsequently reached 100% in objdiff: .data, .rodata, .sdata, and .ctors. A trial making the key-name table static caused the compiler to remove it and broke the pool; the table retains ordinary external linkage so the real target table is present.
|
||||
|
||||
## Matched functions
|
||||
|
||||
Most functions matched on the first readable implementation, including destruction, initialization, modal-window operations, character/page rendering, input handling, and animation callbacks.
|
||||
|
||||
- The input payload's repeat flag initially read an unsigned-byte member into bool and emitted three normalization instructions. Declaring the actual boolean repeat/locked/input/active fields restored the target loads and stores.
|
||||
- CellPhoneSignAllAnmPane::onAnmEvent had 39/39 instructions with two unsigned comparisons. Making the stored animation state signed restored both comparisons and gave zero diffs.
|
||||
- Base::onKey initially had 115/115 instructions with 13 differences. Moving counters into their respective scopes produced 19 differences; reversing the two counter declarations also produced 19; using an unsigned control-key result increased the count to 116. These variants were reverted.
|
||||
- A real inline control-key lookup reduced Base::onKey to ten differences and LayoutByNW4R::onKey to eight. A character lookup accepting LanguageDependency reduced the layout function to five differences. Swapping the helper's parameter order left five differences. Passing the actual key array to the character helper restored the target register allocation for both functions.
|
||||
- Base::onKey then showed two false ctxdiff differences on CR1 branches. Inspection found identical instruction bytes for both branches; the helper normalizes the CR operand as if it were a branch address when function offsets differ. Declaring the already-existing KeyboardBase::getLanguage externally in this unit avoided a duplicate weak inline body, restored the original function offset, and ctxdiff reported zero differences without any instruction changes to onKey.
|
||||
|
||||
## Remaining function: LayoutByNW4R::create
|
||||
|
||||
All variants use typed placement construction, real class sizes, and the same 221 instructions as the target. The remaining differences are callee-saved register allocation, including hoisted vtable addresses, animation count, and animation-record temporaries.
|
||||
|
||||
1. Initial scoped const forceName/animationCount variables: 61 differences.
|
||||
2. Declared forceName and animationCount outside the pane loop and assigned them after appending the pane: 34 differences.
|
||||
3. Declared the pane pointer before the pane-table reference: still 34 differences.
|
||||
4. Reversed the forceName/count declarations: 37 differences, reverted.
|
||||
5. Changed the outer for loop to a do/while loop with an explicit paneIndex: still 34 differences, retained.
|
||||
6. Kept forceName outside but made animationCount local and const: 59 differences, reverted.
|
||||
|
||||
The retained version has 221/221 instructions and 34 register differences. No artificial code or data placement was used.
|
||||
|
||||
## Changed files
|
||||
|
||||
- src/keyboard/tiSignWindow.cpp
|
||||
- include/keyboard/tiSignWindow.h
|
||||
- include/keyboard/tiHKBManager.h
|
||||
- include/keyboard/tiInputForm.h
|
||||
- include/keyboard/tiKeyboard.h
|
||||
- include/keyboard/tiNw4rManager.h
|
||||
- include/keyboard/tiPcKeyboard.h
|
||||
- include/keyboard/tiPcKeyboardImpl.h
|
||||
- include/keyboard/tiTextInputBase.h
|
||||
- tools/decomp-assist/tiSignWindow.attempts.md
|
||||
Reference in New Issue
Block a user