From f082eaad5ebb395fbf5d2d3b5522609d66472973 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Tue, 29 Sep 2026 19:28:39 +0000 Subject: [PATCH] Decompile MyTiManager to 84/91 functions (worker 8468d303) --- include/keyboard/MyTiBg.h | 8 + include/keyboard/MyTiInputForm.h | 29 + include/keyboard/MyTiLetterForm.h | 7 + include/keyboard/MyTiManager.h | 43 ++ include/keyboard/tiCellPhone.h | 81 ++- include/keyboard/tiHwKeyboard.h | 4 + include/keyboard/tiInputForm.h | 14 + include/keyboard/tiKeyboard.h | 4 + include/keyboard/tiManager.h | 27 + include/keyboard/tiPcKeyboard.h | 101 ++- include/keyboard/tiTextDrawer.h | 4 + src/keyboard/MyTiManager.cpp | 1130 +++++++++++++++++++++++++++++ 12 files changed, 1450 insertions(+), 2 deletions(-) create mode 100644 src/keyboard/MyTiManager.cpp diff --git a/include/keyboard/MyTiBg.h b/include/keyboard/MyTiBg.h index ac10c52d..aad892fe 100644 --- a/include/keyboard/MyTiBg.h +++ b/include/keyboard/MyTiBg.h @@ -14,7 +14,15 @@ namespace textinput { class LayoutByNW4R : public Base, public nw4rmanager::Layout { public: +#ifdef MYTIMANAGER_IMPLEMENTATION + LayoutByNW4R(nw4r::lyt::MultiArcResourceAccessor* multiArc, const char* layoutName, EventObserver* event) + : nw4rmanager::Layout(multiArc, layoutName, event) {} +#endif +#ifdef MYTIMANAGER_IMPLEMENTATION + virtual ~LayoutByNW4R(); +#else virtual ~LayoutByNW4R() {} +#endif virtual void create(MEMAllocator* allocator); virtual void init(); diff --git a/include/keyboard/MyTiInputForm.h b/include/keyboard/MyTiInputForm.h index 7191365b..0f427f0a 100644 --- a/include/keyboard/MyTiInputForm.h +++ b/include/keyboard/MyTiInputForm.h @@ -30,14 +30,32 @@ namespace textinput { EM_Last } EditMode; +#ifdef MYTIMANAGER_IMPLEMENTATION + InputForm(textinput::Manager* manager, nw4r::lyt::MultiArcResourceAccessor* multiArc, + const char* layoutName, EventObserver* event, const char* fontName) + : textinput::InputForm(manager, multiArc, layoutName, event, fontName), + unk_0x308(NULL), unk_0x30C(NULL), unk_0x310(NULL), unk_0x314(NULL), + mfScroll(0.0f), mfScrollFrom(0.0f), mfScrollTo(0.0f), mnLine(0), + mDrawRect(), mDefaultDrawSize(), mDefaultBoundSize(), mExScrollAnm(), + mpNigaoeObserver(NULL), mpDefaultNigaoe(NULL), mpSendString(NULL), + mbEdited(false), mbGoodBye(false), mbEditScrollUp(false), mbEditScrollDown(false), + mbCloseWithSend(false), mpScrollButton(NULL), mbScrollUp(false), mbScrollDown(false), + meEditMode(EM_Disp) {} +#endif + ~InputForm(); virtual void setScroll(f32 scroll); virtual void setAddScroll(f32 scroll, bool up, bool down); virtual f32 getScroll() { return mfScroll; } +#ifdef MYTIMANAGER_IMPLEMENTATION + virtual f32 getScrollFrom(); + virtual f32 getScrollTo(); +#else virtual f32 getScrollFrom() { return mfScrollFrom; } virtual f32 getScrollTo() { return mfScrollTo; } +#endif virtual void open(); virtual void close(); @@ -90,7 +108,11 @@ namespace textinput { void setEditScrollDown(bool editScrollDown) { mbEditScrollUp = editScrollDown; } void setCloseWithSend(bool closeWithSend) { mbCloseWithSend = closeWithSend; } +#ifdef MYTIMANAGER_IMPLEMENTATION + void setEditMode(EditMode editMode); +#else void setEditMode(EditMode editMode) { meEditMode = editMode; } +#endif bool isEdited() { return mbEdited; } bool isGoodBye() { return mbGoodBye; } @@ -103,6 +125,9 @@ namespace textinput { tistring::Decolated* getSendString() { return mpSendString; } private: +#ifdef MYTIMANAGER_IMPLEMENTATION + undefined4* unk_0x308; +#endif undefined4* unk_0x30C; undefined4* unk_0x310; undefined4* unk_0x314; @@ -117,7 +142,11 @@ namespace textinput { nw4r::lyt::Size mDefaultBoundSize; // 0x358 Mtx mDrawMtx; // 0x360 Mtx mBoundMtx; // 0x390 +#ifdef MYTIMANAGER_IMPLEMENTATION + util::Animation mExScrollAnm; // 0x3C0 +#else u8 /*todo*/ mExScrollAnm[32]; // 0x3C0 +#endif NigaoeEventObserver* mpNigaoeObserver; // 0x3E0 GXTexObj* mpDefaultNigaoe; // 0x3E4 tistring::Decolated* mpSendString; // 0x3E8 diff --git a/include/keyboard/MyTiLetterForm.h b/include/keyboard/MyTiLetterForm.h index cecf1066..9566906a 100644 --- a/include/keyboard/MyTiLetterForm.h +++ b/include/keyboard/MyTiLetterForm.h @@ -16,6 +16,13 @@ namespace textinput { T_Last, } Type; +#ifdef MYTIMANAGER_IMPLEMENTATION + InputForm(textinput::Manager* manager, nw4r::lyt::MultiArcResourceAccessor* multiArc, + const char* layoutName, EventObserver* event, const char* fontName) + : textinput::MemoInputForm(manager, multiArc, layoutName, event, fontName), + unk_0x400(0), mbPhotoDraw(false), meType(T_MailAddressSel) {} +#endif + virtual nw4r::lyt::Material* getPhotoPaneMaterial(); virtual void onPhotoTrig(); diff --git a/include/keyboard/MyTiManager.h b/include/keyboard/MyTiManager.h index 57d8b45c..584767c5 100644 --- a/include/keyboard/MyTiManager.h +++ b/include/keyboard/MyTiManager.h @@ -28,6 +28,9 @@ namespace textinput { CT_NumericWithSeparator, CT_NormalWithoutLineFeedWithSign, CT_PredictWithoutLineFeed, +#ifdef MYTIMANAGER_IMPLEMENTATION + CT_PredictBigText, +#endif CT_Last } ConfigType; @@ -78,7 +81,11 @@ namespace textinput { virtual void start(); virtual void end(); +#ifdef MYTIMANAGER_IMPLEMENTATION + virtual textinput::InputForm* createInputForm(); +#else virtual InputForm* createInputForm(); +#endif virtual void memoDraw(); @@ -93,8 +100,16 @@ namespace textinput { virtual ConfigType getConfigType() { return meConfigType; } +#ifdef MYTIMANAGER_IMPLEMENTATION + virtual void setSaveData(); +#else virtual void setSaveData_(); +#endif virtual void reflectSaveData(); +#ifdef MYTIMANAGER_IMPLEMENTATION + void reflectSaveDataRev1(); + void reflectSaveDataDefault(); +#endif virtual void configDefault(); virtual void configLetter(); @@ -111,10 +126,21 @@ namespace textinput { virtual void configNormalWithoutLineFeedWithSign(); virtual void configPredictWithoutLineFeed(); virtual void configPredictBigText(); +#ifdef MYTIMANAGER_IMPLEMENTATION + virtual textinput::MemoInputForm* createMemoInputForm(); + virtual textinput::LetterInputForm* createLetterInputForm(); + virtual textinput::InputForm* createBigTextInputForm(); + virtual void* createBG(); +#else virtual void createMemoInputForm(); virtual void createLetterInputForm(); virtual void createBigTextInputForm(); virtual void createBG(); +#endif + +#ifdef MYTIMANAGER_IMPLEMENTATION + void* getBackGround() const { return mpBackGround; } +#endif private: State* mpCurrentState; // 0x40 @@ -135,6 +161,11 @@ namespace textinput { class State { public: +#ifdef MYTIMANAGER_IMPLEMENTATION + State() : mpManager(NULL) {} + Manager* getManager() const { return mpManager; } + void setManager(Manager* manager) { mpManager = manager; } +#endif virtual ~State(); virtual Manager::StateType getStateType(); @@ -153,6 +184,18 @@ namespace textinput { virtual void start(); virtual void end(); +#ifdef MYTIMANAGER_IMPLEMENTATION + virtual InputForm* InputForm(); + virtual keyboard::hwkey::HWKeyboard* HWKeyboard(); + virtual keyboard::pctype::LayoutByNW4R* PCKeyboard(); + virtual keyboard::cellphonetype::LayoutByNW4R* CellPhoneKeyboard(); + virtual void* SignKeyboard(); + virtual candidatebox::LayoutByNW4R* CandidateBox(); + virtual toolbar::LayoutByNW4R* ToolBar(); + virtual void* PredictLanguageSelectDialog(); + virtual void* BG(); +#endif + private: Manager* mpManager; // 0x04 }; diff --git a/include/keyboard/tiCellPhone.h b/include/keyboard/tiCellPhone.h index c53e7c04..3f66728f 100644 --- a/include/keyboard/tiCellPhone.h +++ b/include/keyboard/tiCellPhone.h @@ -2,13 +2,57 @@ #define TEXTINPUT_CELL_PHONE_H #include "tiNw4rManager.h" +#ifdef MYTIMANAGER_IMPLEMENTATION +#include "tiKeyboard.h" +#endif namespace textinput { namespace keyboard { namespace cellphonetype { +#ifdef MYTIMANAGER_IMPLEMENTATION + class Base : public textinput::keyboard::KeyboardBase { +#else class Base { +#endif public: - // TODO +#ifdef MYTIMANAGER_IMPLEMENTATION + enum InputMode { + IM_00, + IM_01, + IM_02, + IM_03, + IM_04, + }; + + virtual ~Base(); + virtual void create(MEMAllocator* allocator) override; + virtual void init() override; + virtual void updateFromReceiver(u32, void*) override; + virtual void onKey(u32, void*) override; + virtual void getType() override; + virtual void onActive() override; + virtual void calc(); + virtual void draw(); + virtual InputMode getInputMode() const; + virtual bool isLocked() const; + virtual bool isNumeric() const; + virtual bool isNumericWithDot() const; + virtual bool isHoldingButton() const; + virtual void doNumericMode(bool); + virtual void changeInputMode(InputMode); + virtual bool isUpperCase(); + virtual void setInputMode(InputMode); + virtual void setUpperCaseJP(bool); + virtual void setLangKeyActive(bool); + virtual bool onClose(); + virtual void goSignInputMode(); + virtual void changePredictLanguage(); + virtual void setAbcMode(bool); + virtual bool isZiActive(); + virtual bool isAtokActive(); + virtual void doInput(); + virtual void updateFixMode(); +#else virtual void vt_0x08(); virtual void vt_0x0C(); virtual void vt_0x10(); @@ -30,7 +74,11 @@ namespace textinput { virtual void vt_0x4C(); virtual void vt_0x50(); +#ifdef MYTIMANAGER_IMPLEMENTATION + virtual void doNumericMode(bool); +#else virtual void vt_0x54(); +#endif virtual void vt_0x58(); virtual void vt_0x5C(); virtual void vt_0x60(); @@ -38,17 +86,48 @@ namespace textinput { virtual void vt_0x68(bool); virtual bool onClose(); +#endif // TODO enum? int getInputType() const; + +#ifdef MYTIMANAGER_IMPLEMENTATION + private: + u32 mPreviousInputMode; + u32 mCurrentInputMode; + bool mbInputModeLocked; + bool mbNumericMode; + bool mbNumericWithDotMode; + bool mbUpperCaseMode; + bool mbAbcMode; + bool mbLanguageKeyMode; + u32 mHoldingButton; + void* mpInputModeTable; + MEMAllocator* mpAllocator; + void* mpInputSettings; + u32 mInputState; +#endif }; class LayoutByNW4R : public Base, public nw4rmanager::Layout { public: +#ifdef MYTIMANAGER_IMPLEMENTATION + virtual void doNumericMode(bool); + virtual void setPredictLanguageDialog(void*); + virtual void setSignWindow(void*); + virtual void doNumericWithDotMode(bool); + virtual void setLineFeedButton(bool); + virtual void setPredictLanguageButton(bool); + virtual void setSignWindowButton(bool); +#endif virtual bool onClose(); void onPressedShift(bool shift); void onReleasedShift(); +#ifdef MYTIMANAGER_IMPLEMENTATION + virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data) override; + virtual bool updateInput(input::HKBManager& hkbManager) override; +#endif }; } // namespace cellphonetype diff --git a/include/keyboard/tiHwKeyboard.h b/include/keyboard/tiHwKeyboard.h index 8f672fb0..1d88ab7f 100644 --- a/include/keyboard/tiHwKeyboard.h +++ b/include/keyboard/tiHwKeyboard.h @@ -15,7 +15,11 @@ namespace textinput { virtual void init(); +#ifdef MYTIMANAGER_IMPLEMENTATION + void updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data); +#else virtual void updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data); +#endif virtual bool updateInput(input::HKBManager& hkbManager); private: diff --git a/include/keyboard/tiInputForm.h b/include/keyboard/tiInputForm.h index 75fbdde2..27145a54 100644 --- a/include/keyboard/tiInputForm.h +++ b/include/keyboard/tiInputForm.h @@ -17,6 +17,9 @@ namespace textinput { namespace inputform { class EditBuffer { public: +#ifdef MYTIMANAGER_IMPLEMENTATION + void create(MEMAllocator* allocator); +#endif ~EditBuffer(); private: @@ -167,6 +170,10 @@ namespace textinput { virtual void onSE(sound::SE seId); +#ifdef MYTIMANAGER_IMPLEMENTATION + void dirtyCacheAll(); +#endif + virtual void clear(); virtual u32 calcCursorPos(f32 x, f32 y); @@ -228,6 +235,9 @@ namespace textinput { class LayoutByNW4R : public Base, public nw4rmanager::Layout { public: +#ifdef MYTIMANAGER_IMPLEMENTATION + LayoutByNW4R(textinput::Manager*, nw4r::lyt::MultiArcResourceAccessor*, const char*, EventObserver*, const char*); +#endif ~LayoutByNW4R(); virtual void init(); @@ -255,7 +265,11 @@ namespace textinput { virtual void visibleSeparator(bool flag); private: +#ifdef MYTIMANAGER_IMPLEMENTATION + u8 unk_0x2C0[0x48]; +#else u8 unk_0x2C0[0x4C]; +#endif }; } typedef inputform::LayoutByNW4R InputForm; diff --git a/include/keyboard/tiKeyboard.h b/include/keyboard/tiKeyboard.h index eb101168..686879ee 100644 --- a/include/keyboard/tiKeyboard.h +++ b/include/keyboard/tiKeyboard.h @@ -14,7 +14,11 @@ namespace textinput { virtual void setCommandReceiver(CommandReceiver* receiver) override; virtual void sendCommand(u32 command, void*) override; virtual void updateFromReceiver(u32, void*) override; +#ifdef MYTIMANAGER_IMPLEMENTATION + virtual void onKey(u32, void*); +#else virtual void onKey(u32); +#endif virtual void getType(); virtual void setLanguage(Language language); virtual Language getLanguage() const; diff --git a/include/keyboard/tiManager.h b/include/keyboard/tiManager.h index c18b8c29..802f9cd1 100644 --- a/include/keyboard/tiManager.h +++ b/include/keyboard/tiManager.h @@ -56,6 +56,9 @@ namespace textinput { virtual void setLanguage(Language language); virtual Language getLanguage() const { return meLanguage; } +#ifdef MYTIMANAGER_IMPLEMENTATION + Language getLanguageForMemo() const { return meLanguage; } +#endif virtual void setDestination(Destination destination); @@ -66,6 +69,30 @@ namespace textinput { virtual void setAspectRatio(bool b4x3); +#ifdef MYTIMANAGER_IMPLEMENTATION + MEMAllocator* getAllocatorForMemo() const { return mpAllocator; } + inputform::EditBuffer* getEditBufferForMemo() const { return mpEditBuffer; } + void setEditBufferForMemo(inputform::EditBuffer* editBuffer) { mpEditBuffer = editBuffer; } + void setHWKeyboardForMemo(keyboard::hwkey::HWKeyboard* keyboard) { mpHWKeyboard = keyboard; } + nw4r::lyt::MultiArcResourceAccessor* getMultiArcForMemo() const { return mpMultiArcResourceAccessor; } + EventObserver* getEventObserverForMemo() const { return mpEventObserver; } + InputForm* getInputFormForMemo() const { return mpInputForm; } + void setInputFormForMemo(InputForm* inputForm) { mpInputForm = inputForm; } + toolbar::LayoutByNW4R* getToolBarForMemo() const { return mpToolBar; } + candidatebox::LayoutByNW4R* getCandidateBoxForMemo() const { return mpCandidateBox; } + void setPCKeyboardForMemo(keyboard::pctype::LayoutByNW4R* keyboard) { mpPCKeyboard = keyboard; } + void setCellPhoneKeyboardForMemo(keyboard::cellphonetype::LayoutByNW4R* keyboard) { mpCellPhoneKeyboard = keyboard; } + void setCandidateBoxForMemo(candidatebox::LayoutByNW4R* candidateBox) { mpCandidateBox = candidateBox; } + void setToolBarForMemo(toolbar::LayoutByNW4R* toolBar) { mpToolBar = toolBar; } + void setPredictLanguageDialogForMemo(void* dialog) { mpPredictLanguageDialog = dialog; } + void setSignWindowForMemo(void* signWindow) { mpSignWindow = signWindow; } + void* getSignWindowForMemo() const { return mpSignWindow; } + keyboard::pctype::LayoutByNW4R* getPCKeyboardForMemo() const { return mpPCKeyboard; } + keyboard::cellphonetype::LayoutByNW4R* getCellPhoneKeyboardForMemo() const { return mpCellPhoneKeyboard; } + Destination getDestinationForMemo() const { return meDestination; } + void initAspect(); +#endif + virtual void setSecretInputMode(bool secretInputMode) { mpInputForm->setSecretModeOn(secretInputMode); } #ifdef IPL_ADDRESS_EDIT_CPP void enableKSXFilter(bool compatibleFilter); diff --git a/include/keyboard/tiPcKeyboard.h b/include/keyboard/tiPcKeyboard.h index fa734021..19960c52 100644 --- a/include/keyboard/tiPcKeyboard.h +++ b/include/keyboard/tiPcKeyboard.h @@ -3,6 +3,9 @@ #include "tiNw4rManager.h" #include "tiTextInputBase.h" +#ifdef MYTIMANAGER_IMPLEMENTATION +#include "tiKeyboard.h" +#endif namespace textinput { class Manager; @@ -11,8 +14,22 @@ namespace textinput { namespace pctype { +#ifdef MYTIMANAGER_IMPLEMENTATION + class UIObj { + public: + class Listener { + public: + virtual void onEvent(UIObj*, u32, void*); + }; + }; +#endif + // TODO +#ifdef MYTIMANAGER_IMPLEMENTATION + class Base : public textinput::keyboard::KeyboardBase { +#else class Base : public CommandSender { +#endif public: enum TranslateMode { TM_00, @@ -26,6 +43,48 @@ namespace textinput { IT_04, }; +#ifdef MYTIMANAGER_IMPLEMENTATION + enum InputMode { + IM_00, + IM_01, + IM_02, + IM_03, + IM_04, + }; + + virtual ~Base(); + virtual void create(MEMAllocator* allocator) override; + virtual void init() override; + virtual void updateFromReceiver(u32, void*) override; + virtual void onKey(u32, void*) override; + virtual void getType() override; + virtual void setLanguage(Language) override; + virtual void onActive() override; + virtual void inputCharCode(u16); + virtual void getState(); + virtual bool isShiftOn() const; + virtual bool isCapsOn() const; + virtual bool isABC(); + virtual void setABC(bool); + virtual InputMode getABCInputMode() const; + virtual InputMode getAIUInputMode() const; + virtual TranslateMode getTranslateMode() const; + virtual void setTranslateMode(TranslateMode); + virtual void onlyQwerty(bool); + virtual void setLangKeyActive(bool); + virtual void setInputModeJP(bool, u32, u32); + virtual void setInputModeCK(u32); + virtual void refreshState(); + virtual void changeABCInputMode(InputMode); + virtual void changeAIUInputMode(InputMode); + virtual void onClose(); + virtual void getWCCode(char*); + virtual void getControlKey(char*); + virtual void sendInputWChar(u16, bool); + virtual void goSignInputMode(); + virtual void changePredictLanguage(); + virtual void updateFixMode(); +#else virtual ~Base(); virtual void create(MEMAllocator* allocator); virtual void init(); @@ -61,17 +120,57 @@ namespace textinput { virtual void goSignInputMode(); virtual void changePredictLanguage(); virtual void updateFixMode(); +#endif + +#ifdef MYTIMANAGER_IMPLEMENTATION + private: + u8 mKeyboardInputFlags[8]; + const void* mpKeyStateTable; + u32 mTranslateMode; + u32 mABCInputMode; + u32 mAIUInputMode; + u32 mCurrentInputType; + u32 mInputState; + const void* mpLanguageData; + bool mbOnlyQwerty; + bool mbLanguageKeyActive; + u16 mKeyboardFlags; + void* mpInputSettings; + void* mpCurrentKeyState; + + public: + u32 getTranslateModeForMemo() const { return mTranslateMode; } + u32 getABCInputModeForMemo() const { return mABCInputMode; } + u32 getAIUInputModeForMemo() const { return mAIUInputMode; } +#endif }; // TODO - class LayoutByNW4R : public Base, public nw4rmanager::Layout { + class LayoutByNW4R : public Base, public nw4rmanager::Layout +#ifdef MYTIMANAGER_IMPLEMENTATION + , public UIObj::Listener +#endif + { public: // TODO - ... +#ifdef MYTIMANAGER_IMPLEMENTATION + virtual void draw(); + virtual void calc(); + virtual void setPredictLanguageDialog(void*); + virtual void setSignWindow(void*); + virtual void setLineFeedButton(bool); + virtual void setPredictLanguageButton(bool); + virtual void setSignWindowButton(bool); +#endif virtual void onClose(); void onPressedShift(bool shift); void onReleasedShift(); +#ifdef MYTIMANAGER_IMPLEMENTATION + virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data) override; + virtual bool updateInput(input::HKBManager& hkbManager) override; +#endif }; } // namespace pctype diff --git a/include/keyboard/tiTextDrawer.h b/include/keyboard/tiTextDrawer.h index f54ea38b..a1e87d11 100644 --- a/include/keyboard/tiTextDrawer.h +++ b/include/keyboard/tiTextDrawer.h @@ -9,7 +9,11 @@ namespace textinput { namespace textdrawer { +#ifdef MYTIMANAGER_IMPLEMENTATION + class Base : public nw4r::ut::CharWriter { +#else class Base : nw4r::ut::CharWriter { +#endif public: typedef struct ViewPort { f32 xOrig; // 0x00 diff --git a/src/keyboard/MyTiManager.cpp b/src/keyboard/MyTiManager.cpp new file mode 100644 index 00000000..2bb03a87 --- /dev/null +++ b/src/keyboard/MyTiManager.cpp @@ -0,0 +1,1130 @@ +#define MYTIMANAGER_IMPLEMENTATION +#include "keyboard/MyTiManager.h" +#include "keyboard/MyTiBg.h" +#include "keyboard/tiLanguageIndependentData.h" +#include "keyboard/tiPredictLang.h" +#include "keyboard/tiUtil.h" + +#include + +namespace textinput { +namespace extend { +namespace memo { + +namespace { + +class SignWindowBase : public keyboard::KeyboardBase { +public: + virtual bool isLocked(); + virtual void setPage(u8); + virtual u8 getPage(); + virtual void movePrevSignPage(); + virtual void moveNextSignPage(); + virtual void close(); + +private: + u8 mLockPadding; + bool mbLocked; + u8 mPagePadding; + u8 mPage; + const u8* mpPageCount; + void* mpSignButton; + void* mpEventObserver; +}; + +class SignWindowLayout : public SignWindowBase, public nw4rmanager::Layout, public nw4rmanager::AnmObserver { +public: + virtual ~SignWindowLayout(); + virtual void create(MEMAllocator* allocator); + virtual void init(); + virtual void draw(); + virtual void open(keyboard::KeyboardBase*, bool); + virtual bool isActive(); + virtual void onChangeAnmState(nw4rmanager::AnmObserver::AnmEvent, nw4rmanager::AnmPane*, nw4rmanager::Anim*); + virtual bool updateInput(int, f32, f32, u32, u32, u32, void*); + virtual bool updateInput(input::HKBManager&); +}; + +} + +class DispMemoState : public State { +public: + Manager::StateType getStateType(); + void create(); + void init(); + void calc(); + void draw(); + void memoDraw(); + bool updateInput(int, f32, f32, u32, u32, u32); + bool updateInput(input::HKBManager&); + void start(); + void end(); +}; + +class AppearMemoState : public State { +public: + AppearMemoState() : mTime(0.0f) {} + Manager::StateType getStateType(); + void create(); + void init(); + void draw(); + void memoDraw(); + void calc(); + bool updateInput(int, f32, f32, u32, u32, u32); + bool updateInput(input::HKBManager&); + void start(); + void end(); + +private: + f32 mTime; +}; + +class EditMemoState : public State { +public: + Manager::StateType getStateType(); + void create(); + void init(); + void calc(); + void draw(); + bool updateInput(int, f32, f32, u32, u32, u32); + bool updateInput(input::HKBManager&); + void start(); + void memoDraw(); + void end(); +}; + +class DisappearMemoState : public State { +public: + DisappearMemoState() : mTime(0.0f) {} + Manager::StateType getStateType(); + void start(); + void calc(); + +private: + f32 mTime; +}; + +static DispMemoState sDispMemoState; +static EditMemoState sEditMemoState; +static AppearMemoState sAppearMemoState; +static DisappearMemoState sDisappearMemoState; + +struct MemoPosition { + f32 x; + f32 y; +}; + +static MemoPosition sHiddenMemoPosition = {-200.0f, 0.0f}; +static MemoPosition sAppearingMemoPosition = {0.0f, 255.0f}; +static MemoPosition sLetterMemoPosition = {0.0f, 145.0f}; + +Manager::~Manager() { + if (mpDefaultPCKeyboard != NULL) { + static_cast(mpDefaultPCKeyboard)->~LayoutByNW4R(); + MEMFreeToAllocator(getAllocatorForMemo(), mpDefaultPCKeyboard); + } + if (mpDefaultCellPhoneKeyboard != NULL) { + static_cast(mpDefaultCellPhoneKeyboard)->~LayoutByNW4R(); + MEMFreeToAllocator(getAllocatorForMemo(), mpDefaultCellPhoneKeyboard); + } + if (mpDefaultInputForm != NULL) { + mpDefaultInputForm->~InputForm(); + MEMFreeToAllocator(getAllocatorForMemo(), mpDefaultInputForm); + } + if (mpDefaultCandidateBox != NULL) { + static_cast(mpDefaultCandidateBox)->~LayoutByNW4R(); + MEMFreeToAllocator(getAllocatorForMemo(), mpDefaultCandidateBox); + } + if (mpDefaultToolBar != NULL) { + static_cast(mpDefaultToolBar)->~LayoutByNW4R(); + MEMFreeToAllocator(getAllocatorForMemo(), mpDefaultToolBar); + } + if (mpDefaultPredictLanguageDialog != NULL) { + static_cast(mpDefaultPredictLanguageDialog)->~LayoutByNW4R(); + MEMFreeToAllocator(getAllocatorForMemo(), mpDefaultPredictLanguageDialog); + } + if (mpDefaultSignWindow != NULL) { + static_cast(mpDefaultSignWindow)->~SignWindowLayout(); + MEMFreeToAllocator(getAllocatorForMemo(), mpDefaultSignWindow); + } + if (mpMemoInputForm != NULL) { + mpMemoInputForm->~MemoInputForm(); + MEMFreeToAllocator(getAllocatorForMemo(), mpMemoInputForm); + } + if (mpLetterInputForm != NULL) { + mpLetterInputForm->~LetterInputForm(); + MEMFreeToAllocator(getAllocatorForMemo(), mpLetterInputForm); + } + if (mpBigTextInputForm != NULL) { + mpBigTextInputForm->~InputForm(); + MEMFreeToAllocator(getAllocatorForMemo(), mpBigTextInputForm); + } + if (mpBackGround != NULL) { + static_cast(mpBackGround)->~LayoutByNW4R(); + MEMFreeToAllocator(getAllocatorForMemo(), mpBackGround); + } + + setPCKeyboardForMemo(NULL); + setCellPhoneKeyboardForMemo(NULL); + setInputFormForMemo(NULL); + setCandidateBoxForMemo(NULL); + setToolBarForMemo(NULL); + setPredictLanguageDialogForMemo(NULL); + setSignWindowForMemo(NULL); +} + +State::~State() {} + +void DispMemoState::create() {} + +void DispMemoState::init() { + getManager()->getConfigType(); +} + +void DispMemoState::start() { + switch (getManager()->getConfigType()) { + case Manager::CT_Letter: + case Manager::CT_PhotoLetter: + InputForm()->setEditMode(InputForm::EM_Disp); + InputForm()->getLayout()->GetRootPane()->SetTranslate( + nw4r::math::VEC3(sLetterMemoPosition.x, sLetterMemoPosition.y, 0.0f)); + break; + default: + break; + } +} + +void DispMemoState::calc() { + Manager::ConfigType configType = getManager()->getConfigType(); + switch (configType) { + case Manager::CT_Letter: + case Manager::CT_PhotoLetter: + InputForm()->calc(); + break; + default: + break; + } +} + +bool DispMemoState::updateInput(input::HKBManager& hkbManager) { + Manager::ConfigType configType = getManager()->getConfigType(); + switch (configType) { + case Manager::CT_Letter: + case Manager::CT_PhotoLetter: + InputForm(); + return InputForm()->updateInput(hkbManager); + default: + return false; + } +} + +bool DispMemoState::updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release) { + Manager::ConfigType configType = getManager()->getConfigType(); + switch (configType) { + case Manager::CT_Letter: + case Manager::CT_PhotoLetter: { + InputForm(); + struct InputParameters { + int chan; + f32 x; + f32 y; + u32 trig; + u32 hold; + u32 release; + } inputParameters = {chan, x, y, trig, hold, release}; + return InputForm()->updateInput(chan, x, y, trig, hold, release, &inputParameters); + } + default: + return false; + } +} + +void AppearMemoState::init() {} + +void AppearMemoState::calc() { + InputForm()->calc(); + if (ToolBar()->isQwerty()) { + PCKeyboard()->calc(); + } else { + static_cast(CellPhoneKeyboard())->calc(); + } + if (CandidateBox()->isActive()) { + CandidateBox()->calc(); + } + ToolBar()->calc(); + static_cast(BG())->calc(); + if (mTime >= 30.0f) { + getManager()->setState(Manager::ST_Appearing); + } + mTime += 1.0f; +} + +void AppearMemoState::draw() { + if (getManager()->getConfigType() != Manager::CT_Letter && + getManager()->getConfigType() != Manager::CT_PhotoLetter) { + static_cast(BG())->draw(); + } + ToolBar()->draw(); + if (getManager()->getConfigType() != Manager::CT_Letter && + getManager()->getConfigType() != Manager::CT_PhotoLetter) { + InputForm()->draw(); + } + if (CandidateBox()->isActive()) { + CandidateBox()->draw(); + } + if (ToolBar()->isQwerty()) { + PCKeyboard()->draw(); + } else { + static_cast(CellPhoneKeyboard())->draw(); + } +} + +void AppearMemoState::start() { + mTime = 0.0f; + Manager::ConfigType configType = getManager()->getConfigType(); + switch (configType) { + case Manager::CT_Letter: + case Manager::CT_PhotoLetter: + InputForm()->setEditMode(InputForm::EM_Appear); + break; + default: + break; + } +} + +bool AppearMemoState::updateInput(int, f32, f32, u32, u32, u32) { + return false; +} + +bool AppearMemoState::updateInput(input::HKBManager&) { + return false; +} + +void EditMemoState::create() {} + +void EditMemoState::init() {} + +void EditMemoState::calc() { + if (ToolBar()->isQwerty()) { + PCKeyboard()->calc(); + } else { + static_cast(CellPhoneKeyboard())->calc(); + } + ToolBar()->calc(); + if (CandidateBox()->isActive()) { + CandidateBox()->calc(); + } + InputForm()->calc(); + if (static_cast(PredictLanguageSelectDialog())->isActive()) { + static_cast(PredictLanguageSelectDialog())->calc(); + } + if (static_cast(SignKeyboard())->isActive()) { + SignWindowLayout& signWindow = *static_cast(SignKeyboard()); + static_cast(signWindow).calc(); + } + if (getManager()->getConfigType() != Manager::CT_Letter && + getManager()->getConfigType() != Manager::CT_PhotoLetter) { + static_cast(BG())->calc(); + } +} + +void EditMemoState::draw() { + GXSetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE); + if (getManager()->getConfigType() != Manager::CT_Letter && + getManager()->getConfigType() != Manager::CT_PhotoLetter) { + static_cast(BG())->draw(); + } + ToolBar()->draw(); + if (getManager()->getConfigType() != Manager::CT_Letter && + getManager()->getConfigType() != Manager::CT_PhotoLetter) { + InputForm()->draw(); + } + if (CandidateBox()->isActive()) { + CandidateBox()->draw(); + } + if (ToolBar()->isQwerty()) { + PCKeyboard()->draw(); + } else { + static_cast(CellPhoneKeyboard())->draw(); + } + if (static_cast(PredictLanguageSelectDialog())->isActive()) { + static_cast(PredictLanguageSelectDialog())->draw(); + } + if (static_cast(SignKeyboard())->isActive()) { + static_cast(SignKeyboard())->draw(); + } +} + +bool EditMemoState::updateInput(input::HKBManager& hkbManager) { + bool wasQwerty = ToolBar()->isQwerty(); + if (static_cast(PredictLanguageSelectDialog())->isActive()) { + return false; + } + HWKeyboard()->updateInput(hkbManager); + if (static_cast(SignKeyboard())->isActive()) { + return static_cast(SignKeyboard())->updateInput(hkbManager); + } + bool handled; + if (wasQwerty) { + handled = PCKeyboard()->updateInput(hkbManager); + } else { + handled = CellPhoneKeyboard()->updateInput(hkbManager); + } + if (wasQwerty != ToolBar()->isQwerty()) { + InputForm()->onCommand(static_cast(6), NULL); + CandidateBox()->checkValidation(); + if (ToolBar()->isQwerty()) { + PCKeyboard()->onActive(); + } else { + CellPhoneKeyboard()->onActive(); + } + } + return handled; +} + +void EditMemoState::start() { + switch (getManager()->getConfigType()) { + case Manager::CT_Letter: + case Manager::CT_PhotoLetter: + InputForm()->setEditMode(InputForm::EM_Edit); + InputForm()->getLayout()->GetRootPane()->SetTranslate( + nw4r::math::VEC3(sLetterMemoPosition.x, sLetterMemoPosition.y, 0.0f)); + break; + default: + break; + } +} + +bool EditMemoState::updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release) { + bool wasQwerty = ToolBar()->isQwerty(); + struct InputParameters { + int chan; + f32 x; + f32 y; + u32 trig; + u32 hold; + u32 release; + } inputParameters = {chan, x, y, trig, hold, release}; + HWKeyboard()->updateInput(chan, x, y, trig, hold, release, &inputParameters); + predictlang::LayoutByNW4R* predictDialog = + static_cast(PredictLanguageSelectDialog()); + if (predictDialog->isActive()) { + return predictDialog->updateInput(chan, x, y, trig, hold, release, &inputParameters); + } + bool inputHandled = InputForm()->updateInput(chan, x, y, trig, hold, release, &inputParameters); + if (static_cast(SignKeyboard())->isActive()) { + return static_cast(SignKeyboard())->updateInput( + chan, x, y, trig, hold, release, &inputParameters); + } + bool handled; + if (wasQwerty) { + handled = PCKeyboard()->updateInput(chan, x, y, trig, hold, release, &inputParameters); + } else { + handled = CellPhoneKeyboard()->updateInput(chan, x, y, trig, hold, release, &inputParameters); + } + bool toolbarHandled = ToolBar()->updateInput(chan, x, y, trig, hold, release, &inputParameters); + bool candidateHandled = false; + if (CandidateBox()->isActive()) { + candidateHandled = CandidateBox()->updateInput(chan, x, y, trig, hold, release, &inputParameters); + } + inputHandled = InputForm()->updateInput(chan, x, y, trig, hold, release, &inputParameters) || inputHandled; + if (wasQwerty != ToolBar()->isQwerty()) { + InputForm()->onCommand(static_cast(6), NULL); + CandidateBox()->checkValidation(); + if (ToolBar()->isQwerty()) { + PCKeyboard()->onActive(); + } else { + CellPhoneKeyboard()->onActive(); + } + } + return handled | candidateHandled | inputHandled | toolbarHandled; +} + +void Manager::create(MEMAllocator*) { + setEditBufferForMemo(createEditBuffer()); + getEditBufferForMemo()->create(getAllocatorForMemo()); + + setHWKeyboardForMemo(createHWKeyboard()); + + mpDefaultPCKeyboard = createPCTypeKeyboard(); + static_cast(mpDefaultPCKeyboard)->create(getAllocatorForMemo()); + + mpDefaultCellPhoneKeyboard = createCellPhoneTypeKeyboard(); + static_cast(mpDefaultCellPhoneKeyboard)->create(getAllocatorForMemo()); + + mpDefaultInputForm = createInputForm(); + mpDefaultInputForm->create(getAllocatorForMemo(), getEditBufferForMemo()); + + mpDefaultCandidateBox = createCandidateBox(); + static_cast(mpDefaultCandidateBox)->create(getAllocatorForMemo()); + + mpDefaultToolBar = createToolBar(); + static_cast(mpDefaultToolBar)->create(getAllocatorForMemo()); + + mpDefaultPredictLanguageDialog = createPredictLanguageDialog(); + static_cast(mpDefaultPredictLanguageDialog)->create(getAllocatorForMemo()); + + mpDefaultSignWindow = createSignWindow(); + static_cast(mpDefaultSignWindow)->create(getAllocatorForMemo()); + + mpMemoInputForm = createMemoInputForm(); + mpMemoInputForm->create(getAllocatorForMemo(), getEditBufferForMemo()); + + mpLetterInputForm = createLetterInputForm(); + mpLetterInputForm->create(getAllocatorForMemo(), getEditBufferForMemo()); + + mpBigTextInputForm = createBigTextInputForm(); + mpBigTextInputForm->create(getAllocatorForMemo(), getEditBufferForMemo()); + + mpBackGround = createBG(); + static_cast(mpBackGround)->create(getAllocatorForMemo()); + + configDefault(); + + sDispMemoState.setManager(this); + sEditMemoState.setManager(this); + sAppearMemoState.setManager(this); + sDisappearMemoState.setManager(this); + sDisappearMemoState.create(); + textinput::Manager::initAspect(); + + mMemoSetting.uRevisionAndType = 0xF0; + mMemoSetting.uRawData.val[0] = 0; + mMemoSetting.uRawData.val[1] = 0; + mMemoSetting.uRawData.val[2] = 0; + mMemoSetting.uRawData.val[3] = 0; + mMemoSetting.uRawData.val[4] = 0; + mMemoSetting.uRawData.val[5] = 0; + mMemoSetting.uRawData.val[6] = 0; + init(); +} + +void Manager::init() { + mpCurrentState = &sDispMemoState; + mpCurrentState->start(); + mpCurrentState->init(); + + static_cast(mpDefaultPCKeyboard) + ->getLayout()->GetRootPane()->SetInfluencedAlpha(true); + static_cast(mpDefaultCellPhoneKeyboard) + ->getLayout()->GetRootPane()->SetInfluencedAlpha(true); + mpDefaultInputForm->getLayout()->GetRootPane()->SetInfluencedAlpha(true); + mpMemoInputForm->getLayout()->GetRootPane()->SetInfluencedAlpha(true); + mpLetterInputForm->getLayout()->GetRootPane()->SetInfluencedAlpha(true); + mpBigTextInputForm->getLayout()->GetRootPane()->SetInfluencedAlpha(true); + static_cast(mpDefaultCandidateBox) + ->getLayout()->GetRootPane()->SetInfluencedAlpha(true); + static_cast(mpDefaultToolBar) + ->getLayout()->GetRootPane()->SetInfluencedAlpha(true); + static_cast(mpBackGround) + ->getLayout()->GetRootPane()->SetInfluencedAlpha(true); +} + +void Manager::calc() { + mpCurrentState->calc(); +} + +void Manager::draw() { + mpCurrentState->draw(); +} + +void Manager::memoDraw() { + mpCurrentState->memoDraw(); +} + +bool Manager::updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release) { + return mpCurrentState->updateInput(chan, x, y, trig, hold, release); +} + +bool Manager::updateInput(input::HKBManager& hkbManager) { + return mpCurrentState->updateInput(hkbManager); +} + +void Manager::changeState(StateTimeLine stateTimeLine) { + if (stateTimeLine == STL_Transition) { + setState(mpCurrentState->getStateType()); + } +} + +void Manager::setState(StateType stateType) { + switch (stateType) { + case ST_Hidden: + getEventObserverForMemo()->onSE(static_cast(27)); + mpCurrentState->end(); + mpCurrentState = &sAppearMemoState; + mpCurrentState->start(); + break; + case ST_Appearing: + getEventObserverForMemo()->onSE(static_cast(28)); + mpCurrentState->end(); + mpCurrentState = &sEditMemoState; + mpCurrentState->start(); + break; + case ST_Visible: + mpCurrentState->end(); + mpCurrentState = &sDisappearMemoState; + mpCurrentState->start(); + break; + case ST_Disappearing: + getEventObserverForMemo()->onSE(static_cast(29)); + mpCurrentState->end(); + mpCurrentState = &sDispMemoState; + mpCurrentState->start(); + break; + } +} + +textinput::MemoInputForm* Manager::createMemoInputForm() { + void* memory = MEMAllocFromAllocator(getAllocatorForMemo(), sizeof(textinput::MemoInputForm)); + return new (memory) textinput::MemoInputForm(this, getMultiArcForMemo(), "my_Memo_a.brlyt", + getEventObserverForMemo(), "WiiBitmapFontType2.brfnt"); +} + +textinput::LetterInputForm* Manager::createLetterInputForm() { + void* memory = MEMAllocFromAllocator(getAllocatorForMemo(), sizeof(textinput::LetterInputForm)); + return new (memory) textinput::LetterInputForm(this, getMultiArcForMemo(), "my_LetterL.brlyt", + getEventObserverForMemo(), "WiiBitmapFontType2.brfnt"); +} + +textinput::InputForm* Manager::createInputForm() { + return new (MEMAllocFromAllocator(getAllocatorForMemo(), sizeof(textinput::InputForm))) + textinput::InputForm(this, getMultiArcForMemo(), "fs_VK_textBox_a.brlyt", + getEventObserverForMemo(), "WiiBitmapFontType1.brfnt"); +} + +textinput::InputForm* Manager::createBigTextInputForm() { + return new (MEMAllocFromAllocator(getAllocatorForMemo(), sizeof(textinput::InputForm))) + textinput::InputForm(this, getMultiArcForMemo(), "fs_VK_textBox_b.brlyt", + getEventObserverForMemo(), "WiiBitmapFontType1.brfnt"); +} + +void* Manager::createBG() { + void* memory = MEMAllocFromAllocator(getAllocatorForMemo(), sizeof(bg::LayoutByNW4R)); + EventObserver* eventObserver; + return new (memory) bg::LayoutByNW4R((eventObserver = getEventObserverForMemo(), + getMultiArcForMemo()), + "fs_VK_bg_a.brlyt", eventObserver); +} + +void Manager::start() { + if (meConfigType >= CT_Numeric) return; + if (meConfigType < CT_Letter) return; + static_cast(getInputFormForMemo())->open(); +} + +void Manager::end() { + if (meConfigType >= CT_Numeric) return; + if (meConfigType < CT_Letter) return; + static_cast(getInputFormForMemo())->close(); +} + +InputForm* State::InputForm() { + return static_cast(getManager()->getInputForm()); +} + +f32 InputForm::getScrollFrom() { + return mfScrollFrom; +} + +f32 InputForm::getScrollTo() { + return mfScrollTo; +} + +keyboard::hwkey::HWKeyboard* State::HWKeyboard() { + return getManager()->getHWKeyboard(); +} + +keyboard::pctype::LayoutByNW4R* State::PCKeyboard() { + return getManager()->getPCKeyboard(); +} + +keyboard::cellphonetype::LayoutByNW4R* State::CellPhoneKeyboard() { + return getManager()->getCellPhoneKeyboard(); +} + +void* State::SignKeyboard() { + return getManager()->getSignKeyboard(); +} + +candidatebox::LayoutByNW4R* State::CandidateBox() { + return getManager()->getCandidateBox(); +} + +toolbar::LayoutByNW4R* State::ToolBar() { + return getManager()->getToolBar(); +} + +void* State::PredictLanguageSelectDialog() { + return getManager()->getPredictLanguageSelectDialog(); +} + +void* State::BG() { + return getManager()->getBackGround(); +} + +Manager::StateType DispMemoState::getStateType() { + return Manager::ST_Hidden; +} + +void DispMemoState::draw() {} + +void DispMemoState::memoDraw() { + if (getManager()->getConfigType() == Manager::CT_Letter || + getManager()->getConfigType() == Manager::CT_PhotoLetter) { + InputForm()->draw(); + } +} + +void DispMemoState::end() {} + +Manager::StateType AppearMemoState::getStateType() { + return Manager::ST_Appearing; +} + +void AppearMemoState::memoDraw() { + if (getManager()->getConfigType() == Manager::CT_Letter || + getManager()->getConfigType() == Manager::CT_PhotoLetter) { + InputForm()->draw(); + } +} + +void AppearMemoState::create() {} + +void AppearMemoState::end() {} + +Manager::StateType EditMemoState::getStateType() { + return Manager::ST_Visible; +} + +void EditMemoState::memoDraw() { + if (getManager()->getConfigType() == Manager::CT_Letter || + getManager()->getConfigType() == Manager::CT_PhotoLetter) { + InputForm()->draw(); + } +} + +void EditMemoState::end() {} + +Manager::StateType DisappearMemoState::getStateType() { + return Manager::ST_Disappearing; +} + +void DisappearMemoState::calc() { + if (mTime >= 30.0f) { + getManager()->setState(Manager::ST_Disappearing); + } + InputForm()->calc(); + if (ToolBar()->isQwerty()) { + PCKeyboard()->calc(); + } else { + static_cast(CellPhoneKeyboard())->calc(); + } + ToolBar()->calc(); + if (CandidateBox()->isActive()) { + CandidateBox()->calc(); + } + static_cast(BG())->calc(); + f32 slideX = util::hermiteInterporation( + mTime, 0.0f, 0.0f, 0.0f, 30.0f, sHiddenMemoPosition.x, 0.0f); + nw4r::lyt::Pane* keyboardPane = PCKeyboard()->getLayout()->GetRootPane(); + nw4r::math::VEC3 keyboardPosition = keyboardPane->GetTranslate(); + keyboardPosition.x = slideX; + keyboardPane->SetTranslate(keyboardPosition); + mTime += 1.0f; +} + +void DisappearMemoState::start() { + mTime = 0.0f; + Manager::ConfigType configType = getManager()->getConfigType(); + switch (configType) { + case Manager::CT_Letter: + case Manager::CT_PhotoLetter: + InputForm()->setEditMode(InputForm::EM_Disappear); + getManager()->setSaveData(); + break; + default: + InputForm()->onClose(); + break; + } +} + +void Manager::configNumericBigTextWithDot() { + configNumericWithDot(); + meConfigType = CT_NumericBigTextWithDot; +} + +void Manager::configDefault() { + meConfigType = CT_Default; + setPCKeyboardForMemo(static_cast(mpDefaultPCKeyboard)); + setCellPhoneKeyboardForMemo(static_cast(mpDefaultCellPhoneKeyboard)); + setInputFormForMemo(mpDefaultInputForm); + setCandidateBoxForMemo(static_cast(mpDefaultCandidateBox)); + setToolBarForMemo(static_cast(mpDefaultToolBar)); + setPredictLanguageDialogForMemo(mpDefaultPredictLanguageDialog); + setSignWindowForMemo(mpDefaultSignWindow); + textinput::Manager::init(); + + getToolBarForMemo()->setQwerty(true); + getInputFormForMemo()->enableSpaceByRight(false); + getInputFormForMemo()->doWordWrap(true); + if (getDestinationForMemo() != DST_US && getDestinationForMemo() != DST_EU) { + getInputFormForMemo()->doWordWrap(false); + } + getInputFormForMemo()->dirtyCacheAll(); +} + +void Manager::configNumeric() { + meConfigType = CT_Numeric; + setPCKeyboardForMemo(static_cast(mpDefaultPCKeyboard)); + setCellPhoneKeyboardForMemo(static_cast(mpDefaultCellPhoneKeyboard)); + setInputFormForMemo(mpBigTextInputForm); + setCandidateBoxForMemo(static_cast(mpDefaultCandidateBox)); + setToolBarForMemo(static_cast(mpDefaultToolBar)); + setPredictLanguageDialogForMemo(mpDefaultPredictLanguageDialog); + setSignWindowForMemo(mpDefaultSignWindow); + textinput::Manager::init(); + + getToolBarForMemo()->setQwerty(false); + getToolBarForMemo()->enableKeytopChange(false); + getCellPhoneKeyboardForMemo()->doNumericMode(true); + getCellPhoneKeyboardForMemo()->setLineFeedButton(false); + getCandidateBoxForMemo()->setActive(false); + getCellPhoneKeyboardForMemo()->setPredictLanguageButton(false); + getPCKeyboardForMemo()->setPredictLanguageButton(false); + getInputFormForMemo()->doWordWrap(false); + getInputFormForMemo()->enableSpaceByRight(false); + getInputFormForMemo()->dirtyCacheAll(); +} + +void Manager::configNumericWithSeparator() { + configNumeric(); + meConfigType = CT_NumericWithSeparator; + getInputFormForMemo()->visibleSeparator(true); +} + +void Manager::configLetter() { + meConfigType = CT_Letter; + setPCKeyboardForMemo(static_cast(mpDefaultPCKeyboard)); + setCellPhoneKeyboardForMemo(static_cast(mpDefaultCellPhoneKeyboard)); + setInputFormForMemo(mpMemoInputForm); + setCandidateBoxForMemo(static_cast(mpDefaultCandidateBox)); + setToolBarForMemo(static_cast(mpDefaultToolBar)); + setPredictLanguageDialogForMemo(mpDefaultPredictLanguageDialog); + setSignWindowForMemo(mpDefaultSignWindow); + textinput::Manager::init(); + + Language language = getToolBarForMemo()->getLanguage(); + const wchar_t* okCaption = langindependent::cLanguageIndependentString[langindependent::LANG_STRID_OK][language]; + const wchar_t* cancelCaption = langindependent::cLanguageIndependentString[langindependent::LANG_STRID_BACK][language]; + getToolBarForMemo()->setOKButtonVisible(true); + getToolBarForMemo()->setOKButtonCaption(okCaption); + getToolBarForMemo()->setCancelButtonCaption(cancelCaption); + + getInputFormForMemo()->doWordWrap(true); + getInputFormForMemo()->enableSpaceByRight(true); + if (getDestinationForMemo() != DST_US && getDestinationForMemo() != DST_EU) { + getInputFormForMemo()->doWordWrap(false); + } + + reflectSaveData(); + limitStringLength(0x100); + limitRowNum(0x10); + sLetterMemoPosition.y = 0.0f; + getInputFormForMemo()->dirtyCacheAll(); +} + +void Manager::configPhotoLetter() { + meConfigType = CT_PhotoLetter; + setPCKeyboardForMemo(static_cast(mpDefaultPCKeyboard)); + setCellPhoneKeyboardForMemo(static_cast(mpDefaultCellPhoneKeyboard)); + setInputFormForMemo(mpLetterInputForm); + setCandidateBoxForMemo(static_cast(mpDefaultCandidateBox)); + setToolBarForMemo(static_cast(mpDefaultToolBar)); + setPredictLanguageDialogForMemo(mpDefaultPredictLanguageDialog); + setSignWindowForMemo(mpDefaultSignWindow); + textinput::Manager::init(); + + getToolBarForMemo()->setOKButtonVisible(true); + const wchar_t* okCaption = langindependent::cLanguageIndependentString[ + langindependent::LANG_STRID_OK][getToolBarForMemo()->getLanguage()]; + getToolBarForMemo()->setOKButtonCaption(okCaption); + const wchar_t* cancelCaption = langindependent::cLanguageIndependentString[ + langindependent::LANG_STRID_BACK][getToolBarForMemo()->getLanguage()]; + getToolBarForMemo()->setCancelButtonCaption(cancelCaption); + + getInputFormForMemo()->doWordWrap(true); + getInputFormForMemo()->enableSpaceByRight(true); + if (getDestinationForMemo() != DST_US && getDestinationForMemo() != DST_EU) { + getInputFormForMemo()->doWordWrap(false); + } + + reflectSaveData(); + limitStringLength(0x100); + limitRowNum(0x10); + sLetterMemoPosition.y = 0.0f; + getInputFormForMemo()->dirtyCacheAll(); +} + +void Manager::configNormalWithoutLineFeed() { + configDefault(); + meConfigType = CT_NormalWithoutLineFeed; + getCellPhoneKeyboardForMemo()->setLineFeedButton(false); + getPCKeyboardForMemo()->setLineFeedButton(false); + getCandidateBoxForMemo()->setActive(false); + getCellPhoneKeyboardForMemo()->setPredictLanguageButton(false); + getPCKeyboardForMemo()->setPredictLanguageButton(false); + getCellPhoneKeyboardForMemo()->setSignWindowButton(false); + getPCKeyboardForMemo()->setSignWindowButton(false); + getInputFormForMemo()->doWordWrap(false); + getInputFormForMemo()->enableSpaceByRight(false); +} + +void Manager::configNormalBigTextWithoutLineFeed() { + configDefault(); + setInputFormForMemo(mpBigTextInputForm); + textinput::Manager::init(); + meConfigType = CT_NormalBigTextWithoutLineFeed; + getCellPhoneKeyboardForMemo()->setLineFeedButton(false); + getPCKeyboardForMemo()->setLineFeedButton(false); + getCandidateBoxForMemo()->setActive(false); + getCellPhoneKeyboardForMemo()->setPredictLanguageButton(false); + getPCKeyboardForMemo()->setPredictLanguageButton(false); + getToolBarForMemo()->enableKeytopChange(true); + getToolBarForMemo()->setQwerty(true); + getCellPhoneKeyboardForMemo()->setSignWindowButton(false); + getPCKeyboardForMemo()->setSignWindowButton(false); + getInputFormForMemo()->doWordWrap(false); + getInputFormForMemo()->enableSpaceByRight(false); + getInputFormForMemo()->dirtyCacheAll(); +} + +void Manager::configOnlyQwertyWithoutLineFeedAndSign() { + meConfigType = CT_OnlyQwertyWithoutLineFeedAndSign; + setPCKeyboardForMemo(static_cast(mpDefaultPCKeyboard)); + setCellPhoneKeyboardForMemo(static_cast(mpDefaultCellPhoneKeyboard)); + setInputFormForMemo(mpDefaultInputForm); + setCandidateBoxForMemo(static_cast(mpDefaultCandidateBox)); + setToolBarForMemo(static_cast(mpDefaultToolBar)); + setPredictLanguageDialogForMemo(mpDefaultPredictLanguageDialog); + setSignWindowForMemo(mpDefaultSignWindow); + textinput::Manager::init(); + + getToolBarForMemo()->setQwerty(true); + getPCKeyboardForMemo()->onlyQwerty(true); + getToolBarForMemo()->enableKeytopChange(false); + getPCKeyboardForMemo()->setLineFeedButton(false); + getCellPhoneKeyboardForMemo()->setLineFeedButton(false); + getCandidateBoxForMemo()->setActive(false); + getCellPhoneKeyboardForMemo()->setPredictLanguageButton(false); + getPCKeyboardForMemo()->setPredictLanguageButton(false); + getCellPhoneKeyboardForMemo()->setSignWindowButton(false); + getPCKeyboardForMemo()->setSignWindowButton(false); + getInputFormForMemo()->doWordWrap(false); + getInputFormForMemo()->enableSpaceByRight(false); + getInputFormForMemo()->dirtyCacheAll(); +} + +void Manager::configOnlyQwertyBigTextWithoutLineFeedAndSign() { + meConfigType = CT_OnlyQwertyBigTextWithoutLineFeedAndSign; + setPCKeyboardForMemo(static_cast(mpDefaultPCKeyboard)); + setCellPhoneKeyboardForMemo(static_cast(mpDefaultCellPhoneKeyboard)); + setInputFormForMemo(mpBigTextInputForm); + setCandidateBoxForMemo(static_cast(mpDefaultCandidateBox)); + setToolBarForMemo(static_cast(mpDefaultToolBar)); + setPredictLanguageDialogForMemo(mpDefaultPredictLanguageDialog); + setSignWindowForMemo(mpDefaultSignWindow); + textinput::Manager::init(); + + getToolBarForMemo()->setQwerty(true); + getPCKeyboardForMemo()->onlyQwerty(true); + getToolBarForMemo()->enableKeytopChange(false); + getPCKeyboardForMemo()->setLineFeedButton(false); + getCellPhoneKeyboardForMemo()->setLineFeedButton(false); + getCandidateBoxForMemo()->setActive(false); + getCellPhoneKeyboardForMemo()->setPredictLanguageButton(false); + getPCKeyboardForMemo()->setPredictLanguageButton(false); + getCellPhoneKeyboardForMemo()->setSignWindowButton(false); + getPCKeyboardForMemo()->setSignWindowButton(false); + getInputFormForMemo()->doWordWrap(false); + getInputFormForMemo()->enableSpaceByRight(false); + getInputFormForMemo()->dirtyCacheAll(); +} + +void Manager::configNormalBigTextWithoutLineFeedWithSign() { + configDefault(); + setInputFormForMemo(mpBigTextInputForm); + textinput::Manager::init(); + meConfigType = CT_NormalBigTextWithoutLineFeedWithSign; + getCellPhoneKeyboardForMemo()->setLineFeedButton(false); + getPCKeyboardForMemo()->setLineFeedButton(false); + getCandidateBoxForMemo()->setActive(false); + getCellPhoneKeyboardForMemo()->setPredictLanguageButton(false); + getPCKeyboardForMemo()->setPredictLanguageButton(false); + getToolBarForMemo()->enableKeytopChange(true); + getToolBarForMemo()->setQwerty(true); + getCellPhoneKeyboardForMemo()->setSignWindowButton(true); + getPCKeyboardForMemo()->setSignWindowButton(true); + getInputFormForMemo()->doWordWrap(false); + getInputFormForMemo()->enableSpaceByRight(false); + getInputFormForMemo()->dirtyCacheAll(); +} + +void Manager::configNormalWithoutLineFeedWithSign() { + configDefault(); + textinput::Manager::init(); + meConfigType = static_cast(10); + getCellPhoneKeyboardForMemo()->setLineFeedButton(false); + getPCKeyboardForMemo()->setLineFeedButton(false); + getCandidateBoxForMemo()->setActive(false); + getCellPhoneKeyboardForMemo()->setPredictLanguageButton(false); + getPCKeyboardForMemo()->setPredictLanguageButton(false); + getToolBarForMemo()->enableKeytopChange(true); + getToolBarForMemo()->setQwerty(true); + getCellPhoneKeyboardForMemo()->setSignWindowButton(true); + getPCKeyboardForMemo()->setSignWindowButton(true); + getInputFormForMemo()->doWordWrap(false); + getInputFormForMemo()->enableSpaceByRight(false); + getInputFormForMemo()->dirtyCacheAll(); +} + +void Manager::configNumericWithDot() { + configNumeric(); + meConfigType = CT_NumericWithDot; + getCellPhoneKeyboardForMemo()->doNumericWithDotMode(true); +} + +void Manager::configPredictWithoutLineFeed() { + configDefault(); + meConfigType = CT_PredictWithoutLineFeed; + getCellPhoneKeyboardForMemo()->setLineFeedButton(false); + getPCKeyboardForMemo()->setLineFeedButton(false); +} + +void Manager::configPredictBigText() { + configPredictWithoutLineFeed(); + meConfigType = CT_PredictBigText; + setInputFormForMemo(mpBigTextInputForm); + textinput::Manager::init(); +} + +void Manager::setSaveData() { + mMemoSetting.uRevisionAndType = getToolBarForMemo()->isQwerty() | 0x10; + mMemoSetting.uDictionary = getInputFormForMemo()->getPredictMode(); + mMemoSetting.uPredictOnOff = getCandidateBoxForMemo()->isOn(); + mMemoSetting.uSignPage = + static_cast(getSignWindowForMemo())->getPage(); + mMemoSetting.uRev0.uKeitaiUpperCaseJP = getCellPhoneKeyboardForMemo()->isUpperCase(); + mMemoSetting.uRev0.uKeitaiInputMode = getCellPhoneKeyboardForMemo()->getInputMode(); + mMemoSetting.uRev0.uQwertyABC = getPCKeyboardForMemo()->isABC(); + mMemoSetting.uReserve2 = 0; + mMemoSetting.uRev0.uABCInputMode = getPCKeyboardForMemo()->getTranslateModeForMemo(); + mMemoSetting.uRev0.uAIUInputMode = getPCKeyboardForMemo()->getAIUInputModeForMemo(); + mMemoSetting.uNumLockOff = !( + input::HKBManager::getInstance().GetModifierState() & 0x100); + mMemoSetting.uReserve3 = 0; + mMemoSetting.uReserve4 = 0; +} + +void Manager::reflectSaveData() { + s32 revision = (mMemoSetting.uRevisionAndType >> 4) & 0xF; + if (revision >= 1) { + if (revision <= 1) { + reflectSaveDataRev1(); + } else { + reflectSaveDataDefault(); + } + } else { + reflectSaveDataDefault(); + } +} + +void Manager::reflectSaveDataRev1() { + s32 qwertyMode = mMemoSetting.uRevisionAndType & 1; + if (qwertyMode == 1) { + getToolBarForMemo()->setQwerty(true); + } else { + getToolBarForMemo()->setQwerty(false); + } + static_cast(getSignWindowForMemo())->setPage(mMemoSetting.uSignPage); + if (mMemoSetting.uPredictOnOff == 0) { + getCandidateBoxForMemo()->turnOff(); + } else { + getCandidateBoxForMemo()->turnOn(); + } + if (mMemoSetting.uDictionary != 0xFA) { + getInputFormForMemo()->setPredictMode( + static_cast(mMemoSetting.uDictionary)); + } + Language language = getLanguageForMemo(); + if (language == JP) { + getPCKeyboardForMemo()->setInputModeJP( + mMemoSetting.uRev0.uQwertyABC, + mMemoSetting.uRev0.uABCInputMode, + mMemoSetting.uRev0.uAIUInputMode); + } else if (static_cast(language) - CN <= KR - CN) { + getPCKeyboardForMemo()->setInputModeCK(mMemoSetting.uRev0.uABCInputMode); + } + getCellPhoneKeyboardForMemo()->setUpperCaseJP(mMemoSetting.uRev0.uKeitaiUpperCaseJP); + getCellPhoneKeyboardForMemo()->setInputMode( + static_cast(mMemoSetting.uRev0.uKeitaiInputMode)); + getCandidateBoxForMemo()->checkValidation(); + u32 keyboardFlags = mMemoSetting.uRawData.val[3]; + u32 numLockOff = (keyboardFlags >> 1) & 1; + u32 zeroCount = __cntlzw(numLockOff); + u32 numLockBit = (zeroCount >> 5) & 1; + s32 modifierValue = -static_cast(numLockBit); + input::HKBManager::getInstance().SetModifierState( + modifierValue & 0x100, 0x100); +} + +void Manager::reflectSaveDataDefault() { + getToolBarForMemo()->setQwerty(true); + static_cast(getSignWindowForMemo())->setPage(0); + if (getLanguageForMemo() == JP) { + getCandidateBoxForMemo()->turnOn(); + } else { + getCandidateBoxForMemo()->turnOff(); + } + Language language = getLanguageForMemo(); + if (language == JP) { + getPCKeyboardForMemo()->setInputModeJP(false, 1, 0); + } else if (static_cast(language) - CN <= KR - CN) { + getPCKeyboardForMemo()->setInputModeCK(1); + } + getCellPhoneKeyboardForMemo()->setUpperCaseJP(true); + getCellPhoneKeyboardForMemo()->setInputMode( + static_cast(2)); + getCandidateBoxForMemo()->checkValidation(); + input::HKBManager::getInstance().SetModifierState(0x100, 0x100); +} + +void Manager::SetFont(nw4r::lyt::FontRefLink* fontLink) { + textinput::Manager::SetFont(fontLink); + const nw4r::ut::Font* font = fontLink->GetFont(); + textinput::InputForm* bigTextInputForm = mpBigTextInputForm; + if (bigTextInputForm != NULL) { + static_cast(*bigTextInputForm).SetFont(*font); + } + textinput::MemoInputForm* memoInputForm = mpMemoInputForm; + if (memoInputForm != NULL) { + static_cast(*memoInputForm).SetFont(*font); + } + textinput::LetterInputForm* letterInputForm = mpLetterInputForm; + if (letterInputForm != NULL) { + static_cast(*letterInputForm).SetFont(*font); + } +} + +void bg::Base::init() {} + +void bg::Base::create(MEMAllocator*) {} + +bg::LayoutByNW4R::~LayoutByNW4R() {} + +void bg::LayoutByNW4R::draw() { + nw4rmanager::Layout::draw(); +} + +} +} +} -- 2.49.1