Compare commits

...

36 Commits

Author SHA1 Message Date
Devin AI
73e4ac93c7 keyboard: rename lbl_/jumptable_ decls to plausible names
Owner rule: no address-suffixed identifiers, no volatile use-site
casts, no score-only objects. Renamed all lbl_*/jumptable_* decls and
refs in tiInputForm, tiCandidateBox, tiHwKeyboard, MyTiInputForm to
semantic names (emission-neutral; orig symtabs show dtk-anonymized
objects). Includes prior load-bearing header/impl edits.

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 21:28:08 +00:00
Devin AI
1a1641d4d8 tiCellPhone: Base decl order + sdata const fixes (.sdata/.sdata2/.rodata now exact)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 20:36:07 +00:00
Devin AI
1e63e2d6a3 tiString inputChar: u16 count + input[i++] reg-aligned tail
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 16:42:46 +00:00
Devin AI
f2176b0824 keyboard: MyTiManager pures -> trivial inline virtuals — Manager must be concrete (iplKeyboard instantiates MemoManager); restores full build
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 14:35:55 +00:00
Devin AI
48ccec19ea keyboard: tiHKBManager SetModifierState tmp-CSE form (12->10 diffs), GetModifierState/AttachCB/DetachCB/KeyEventCB verified; tiTextDrawer const-first fmuls order
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 14:33:10 +00:00
Devin AI
37c7ed66c9 keyboard: MyTiManager EditMemoState::updateInput — hoisted bool ret; decl binds r30 (0 diffs)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 10:22:32 +00:00
Devin AI
0d43428526 MyTiInputForm: drop out-of-line GUIManager::changeEventHandler def (header back to in-class after DOL regression fix)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 10:15:39 +00:00
Devin AI
9adb3e9996 keyboard: fix DOL regression — revert EventHandler decl-only (in-class is base model); decl-only InputForm setters + Manager::start/end with out-of-line defs in iplLetterWriter.cpp matching base GLOBAL emission
- tiGUIManager.h: restore in-class onEvent/setLatestEventCtrlNo/getLatestEventCtrlNo/changeEventHandler (base emits weak copies in linked TUs; decl-only refs resolved via base tiPcKeyboard.o broke -ipa codegen globally)
- MyTiInputForm.h: setNigaoeEventObserver declared-only (base: GLOBAL only in iplLetterWriter.o @0x50c)
- tiManager.h: start/end declared-only (base: GLOBAL only in iplLetterWriter.o @0x524/@0xc38)
- iplLetterWriter.cpp: out-of-line defs for memo::InputForm::setNigaoeEventObserver, letter::InputForm::setPhotoDraw/setType, Manager::start/end at base's exact emission positions; base .text identical through 0xf50
- tiPcKeyboard.cpp: drop EventHandler out-of-line defs (in-class model)
- DOL sha1 26116613 verified

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 10:14:27 +00:00
Devin AI
82c2972066 keyboard: EventHandler method TU-placement, HWKeyboard::csAninationFile shared table, inputChar/tiHKBManager variants; remove ifdef pure-virtual trick
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 09:45:42 +00:00
Devin AI
42beb56024 MyTiInputForm: move scroll-visible bools to base class, fix AnimPaneGroup List_Init, direct startAnm overload
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 09:32:28 +00:00
Devin AI
43f6f77c15 tiHwKeyboard: match 9/10 fns via named-reference getInstance binding
- init, updateShift, updateInput, updateRepeatKey_, updateTappingShift_,
  convertWCCode, setLanguage, __ct__ now identical (previously updateTriggerKey_
  alone was near; restoring 'LayoutGather &gather = getInstance()' local
  fixes the whole unit's instruction streams)
- scKeyRepeatData/scTriggerData already in .sdata2 like base
- Residuals: updateTriggerKey_ 405/405-insn callee-reg permutation
  (base binds this->r27/hkb->r28/mods->r29 + 3 loop locals r24-26);
  .bss node 12v16B (local-static chain); weak @GUARD/@LOCAL emission
  vs base UND-in-this-TU/GLOBAL-in-tiPcKeyboard

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 01:29:28 +00:00
Devin AI
3c4d73e4d1 tiCellPhone: bool mbLineFeed member + read-back idiom
setLineFeedButton/setPredictLanguageButton/updatePredictLanguage identical
via storing bool member then passing it to setVisible (MWCC emits
lbz+rlwinm canonicalize mask). onActive remains 4 stack-slot diffs.

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 01:04:00 +00:00
Devin AI
b0fc50b103 tiTextDrawer: shrink DrawInfo to 24 bytes (matches base frame)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 00:57:17 +00:00
Devin AI
6ec9f39ae7 keyboard tiHKBManager: head-first decl order for listener walks
- AttachCB/DetachCB/KeyEventCB: declare head before listener so MWCC
  binds listener to the lower callee reg (8->3 diffs, prologue-schedule
  tie remains)

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 00:33:04 +00:00
Devin AI
4865afc664 keyboard tiString: !=0 bool conversions + s32 mTranslateMode
- isDakuten/isHandaku/isSmall: explicit !=0 on util fn results emits
  neg/or/rlwinm idiom - all 3 identical
- mTranslateMode u32->s32: signed cmpw vs cmplw - setTranslateMode and
  inputString(PCw,mode) identical
- inputChar residual: base keeps live-index sthx stores in mode==3 arm
  (count not constant-foldable - tie-break)

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 00:28:13 +00:00
Devin AI
40856d3a48 keyboard: MyTiManager decl-only accessor virtuals + non-static state objects
- memo::Manager accessor virtuals setSaveData/getSaveData/getState/getConfigType
  decl-only in header (out-of-line defs live in consumer TUs like base) ->
  kills 4 weak-copy extras and fixes .data to 100%
- state objects sDisp/sEdit/sAppear/sDisappear non-static -> GLOBAL binds
  matching base symtab (.sbss/.bss placement identical)

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 00:18:37 +00:00
Devin AI
3d11c10ef1 keyboard: align ported headers with remote model; fix DOL regression
- tiGUIManager.{h,cpp}: use remote tip's consistent model (decl-only
  ~GUIComponent/getFlightDuration/setFlightDuration defined in cpp);
  main's inline-only variant + remote cpps moved weak-method emission
  out of base-expected TUs (wrong DOL hash)
- MyTiLetterForm.cpp: trigger -> field_0x0C (remote header naming)
- port headers for MyTiInputForm/MyTiLetterForm/tiInputForm/tiNw4rManager/
  tiSignWindow/tiString/tiTextDrawer into my ported units
Verified: full build, sha1 26116613f624061ba99c8d1a299aaa6efa85670d

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-30 22:39:58 +00:00
Devin AI
98574fffcc Merge remote leaf line: verified keyboard work (DOL-identical) onto latest main
Remote tip carries the authoritative leaf state (17 commits incl. tiHwKeyboard
scaffolding, vt-slot fixes, Sample dtor thunk order, tiManager->tiKeyboard
rename). Resolved 26 add/add+content conflicts taking the remote line; my
session edits kept as attempts-doc notes.

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-30 22:04:53 +00:00
Devin AI
9e56f9f587 keyboard: tiPcKeyboard setTranslateMode exact + tie-break documentation
setTranslateMode: uninitialized keyMode + 3-case switch (no default) preserves
the original UB register state — 105/105 diffs 0. updateInput/getControlKey/
onPressedShift documented as lazy-width/reg tie-breaks; tiString inputChar,
tiZiString clearCandidates/update, tiCandidateBox create loop strength-
reduction, MyTiInputForm vtable-order via IMPL guards.

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-30 21:59:01 +00:00
Devin AI
960e1306cb keyboard: fix vt slot targets — drop spurious Base overrides, add LbNW onKey/sign-page/close overrides
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 15:34:00 +00:00
Devin AI
b4a59ad689 tiHwKeyboard: guard-goto for mods&8, compound OR range check, updateTriggerKey_ ~99.5
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 14:52:20 +00:00
Devin AI
830ddafdcc keyboard: Sample dtor inline decls fix @N@ thunk order; DOL byte-identical
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 12:50:17 +00:00
Devin AI
9eb648ea69 keyboard phase-2: tiCellPhone impl + tiPcKeyboard/tiHKBManager/tiHwKeyboard iteration
- tiCellPhone: full unit implementation (Base/L/EventHandler), 69/86 fns at 100
- tiPcKeyboard: remaining-iteration, string pool identical 204/204
- tiHKBManager: GetModifierState unrolled state-mask merge
- tiHwKeyboard: updateTriggerKey_ residual tie-break
- MyTiManager: bg::Base defs placement, memo::Manager vtable verified (all virtuals present in orig)
- Remaining diffs are count-equal register/scheduling tie-breaks

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 12:50:17 +00:00
Devin AI
94e9a06c27 keyboard: tiHKBManager decomp iteration + header fixes
SetModifierState: evaluate LED-change as (old-new)|(new-old) value
GetVCode: compute state pointer inside switch cases, fold +0x14 into field offsets
SetLedCB: bit kept in callee reg, stack-layout residual tie
GetWChar: wchar_t local (u16 re-masking regressed)
Remaining diffs are count-equal register/scheduling ties

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 12:50:17 +00:00
Devin AI
3abff608be keyboard headers: layout fixes
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 12:50:17 +00:00
Devin AI
5f000e6f7d tiHKBManager/tiPcKeyboard: GetModifierState loop, SetLedCB arg local, init _VEC3 statics
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 12:50:17 +00:00
Devin AI
fb938ba39d keyboard: tiPcKeyboard decode — setABCFlag/isFocused/updateFromReceiver/setLineFeedButton fixes
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 12:50:17 +00:00
Devin AI
83f4b45d20 tiPcKeyboard: emitted-copy defs + Base field layout fix
- Remove spurious pctype::Base::mLanguage (orig uses inherited
  KeyboardBase::meLanguage @0x10) — fixes @68/@236 thunk offsets
- Add non-inline defs orig emits here: Manager getters, CommandSender::
  sendCommand, KeyboardBase::update/getLanguage, Layout/AnmPane helpers,
  candidatebox isActive, inputform canConvert, pctype::Base virtuals
  (getType/getState/inputCharCode/setLanguage/setLangKeyActive/onlyQwerty/
  updateFixMode/getABCInputMode/getAIUInputMode/~Base), EventHandler dtor,
  AnmPane::onAnmEvent base
- Rename KeyState::setABCFlag_/refreshText_ to orig names setABCFlag/
  refreshText
- Declare inputform::Base::getCurrentString(bool)

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 12:50:17 +00:00
Devin AI
c6909021b7 WIP: keyboard phase-2 headers + tiKeyboard/tiHKBManager/tiHwKeyboard progress
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 12:50:17 +00:00
Devin AI
78dbea9228 tiInputForm: type lbl_81698D1C as f32 per symbols.txt
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 12:50:17 +00:00
Devin AI
0b993824b3 tiInputForm: emit pooled literals + missing sbss object
- Replace extern-C string globals with emitPooledLiterals(): the original
  call sites (EventObserver::onOutOfLength, TextBox::GetTextColor's
  NW4R_ASSERT) live in asm transcriptions, so MWCC never pooled their
  literals; a real C++ call emits them at the correct .data position.
- Define lbl_81698D1C to restore the missing 4-byte .sbss object.

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 12:50:17 +00:00
Devin AI
a2f7638917 tiCandidateBox: reproduce .sdata layout (explicit_zero_data keeps zero wchar in .sdata)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 12:50:17 +00:00
Devin AI
b0767c5338 tiCandidateBox: fix pane-name blob stride (20-byte entries); drop onEvent decl-only
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 12:50:17 +00:00
Devin AI
f5a3ae1469 revert shared-header decl-only conversions that break the link; keep owned-unit edits
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 12:50:17 +00:00
Devin AI
82ad173f9a keyboard: match tiInputForm .text/.sdata/.sdata2/.rodata; decl-only shared accessor headers
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 12:50:17 +00:00
Devin AI
e1b6078625 tiCandidateBox: fix string pool/sdata layout, Draw scissor + Vec init order
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 12:50:17 +00:00
54 changed files with 19955 additions and 10289 deletions

View File

@@ -1054,7 +1054,7 @@ src/keyboard/tiNw4rManager.cpp:
.data start:0x8165F818 end:0x8165F8F0
.sdata2 start:0x81694E10 end:0x81694E28
src/keyboard/tiManager.cpp:
src/keyboard/tiKeyboard.cpp:
.text start:0x81437558 end:0x81439608
.ctors start:0x8160D208 end:0x8160D20C
.data start:0x8165F8F0 end:0x81660378

View File

@@ -920,7 +920,7 @@ config.libs = [
Object(NonMatching, "keyboard/tiZiString.cpp", extra_cflags=["-O4,p"]), # for 4.3U and 4.3E
Object(NonMatching, "keyboard/tiTextDrawer.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiNw4rManager.cpp", extra_cflags=["-O4,p"]),
Object(NonMatching, "keyboard/tiManager.cpp", extra_cflags=["-O4,p"]),
Object(NonMatching, "keyboard/tiKeyboard.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiUtil.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiCpData.cpp", extra_cflags=["-O4,p"], shift_jis=False),
Object(Matching, "keyboard/tiSwData.cpp", extra_cflags=["-O4,p"], shift_jis=False),

View File

@@ -14,17 +14,11 @@ 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
#if defined(MYTIMANAGER_MATCHING)
LayoutByNW4R(nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* layoutBinName,
EventObserver* event)
: nw4rmanager::Layout(resAccessor, layoutBinName, event) {}
virtual ~LayoutByNW4R() {}
#elif defined(MYTIMANAGER_IMPLEMENTATION)
virtual ~LayoutByNW4R();
#else
virtual ~LayoutByNW4R() {}
#endif
virtual void create(MEMAllocator* allocator);
virtual void init();

View File

@@ -3,6 +3,7 @@
#include "tiInputForm.h"
#include "tiString.h"
#include "tiUtil.h"
#include <nw4r/lyt/pane.h>
@@ -20,9 +21,7 @@ namespace textinput {
virtual void moveNigaoeButton() {}
};
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
class ScrollButton;
#endif
class InputForm : public textinput::InputForm {
public:
@@ -34,51 +33,24 @@ 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),
InputForm(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* arcName,
EventObserver* observer, const char* subName)
: textinput::InputForm(manager, resAccessor, arcName, observer, subName),
mpMemoPane(NULL), mpMemoRootPane(NULL), mpBoundPane(NULL), mpDrawPane(NULL),
mfScroll(0.0f), mfScrollFrom(0.0f), mfScrollTo(0.0f), mnLine(0),
mDrawRect(), mDefaultDrawSize(), mDefaultBoundSize(), mExScrollAnm(),
mDrawRect(0.0f, 0.0f, 0.0f, 0.0f), mDefaultDrawSize(0.0f, 0.0f), mDefaultBoundSize(0.0f, 0.0f),
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
mbEdited(false), mbGoodBye(false), mbEditScrollUp(false), mbEditScrollDown(false), mbCloseWithSend(false),
mpScrollButton(NULL), mbScrollUp(false), mbScrollDown(false), meEditMode(EM_Disp) {}
~InputForm();
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
virtual void moveCursorUp();
virtual void moveCursorDown();
virtual void onCommand(INPUT_COMMAND command, void* data);
virtual void create(MEMAllocator* allocator, inputform::EditBuffer* editBuffer);
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data);
virtual bool updateInput(input::HKBManager& hkbManager);
virtual void init();
virtual void draw();
virtual void calc();
virtual void doScroll(Scroll* scroll);
virtual u32 calcCursorPos(f32 x, f32 y);
virtual void drawCursor(f32 x, f32 y);
virtual nw4r::math::VEC2 getScale() const;
virtual void preDraw(u32 pos);
virtual void doLineFeed();
virtual void finishDraw(u32 pos);
virtual bool isInScroll();
#endif
virtual void setScroll(f32 scroll);
virtual void setAddScroll(f32 scroll, bool up, bool down);
virtual f32 getScroll() { return mfScroll; }
#ifdef MYTIMANAGER_IMPLEMENTATION
virtual f32 getScrollFrom();
virtual f32 getScrollTo();
#else
virtual f32 getScroll() { return mfScroll; }
virtual f32 getScrollFrom() { return mfScrollFrom; }
virtual f32 getScrollTo() { return mfScrollTo; }
#endif
virtual f32 getScrollTo() { return mfScrollTo; }
virtual void open();
virtual void close();
@@ -100,7 +72,7 @@ namespace textinput {
virtual void onArrowRTrig();
virtual void onArrowLTrig();
virtual void setNigaoeEventObserver(NigaoeEventObserver* nigaoeObserver) { mpNigaoeObserver = nigaoeObserver; }
virtual void setNigaoeEventObserver(NigaoeEventObserver* nigaoeObserver);
virtual nw4r::lyt::Pane* getNigaoePane();
virtual nw4r::lyt::Material* getNigaoePaneMaterial();
@@ -122,6 +94,33 @@ namespace textinput {
virtual void onCommandOnEditMode(INPUT_COMMAND command, void* arg);
virtual void doAutoScroll();
#ifdef MYTIINPUTFORM_IMPLEMENTATION
virtual void pure_0() = 0;
virtual void pure_1() = 0;
virtual void pure_2() = 0;
virtual void pure_3() = 0;
virtual void pure_4() = 0;
virtual void pure_5() = 0;
#endif
virtual void create(MEMAllocator* allocator, inputform::EditBuffer* editBuffer);
virtual void moveCursorUp();
virtual void moveCursorDown();
virtual void onCommand(CommandReceiver::INPUT_COMMAND command, void* arg);
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data);
virtual bool updateInput(textinput::input::HKBManager& hkbManager);
virtual void init();
virtual void draw();
virtual void calc();
virtual void doScroll(CommandReceiver::Scroll* scroll);
virtual u32 calcCursorPos(f32 x, f32 y);
virtual void drawCursor(f32 x, f32 y);
virtual nw4r::math::VEC2 getScale() const;
virtual void preDraw(u32);
virtual void doLineFeed();
virtual void finishDraw(u32);
virtual bool isInScroll();
/* For letter writing */
@@ -131,11 +130,7 @@ namespace textinput {
void setEditScrollDown(bool editScrollDown) { mbEditScrollUp = editScrollDown; }
void setCloseWithSend(bool closeWithSend) { mbCloseWithSend = closeWithSend; }
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
void setEditMode(EditMode editMode);
#else
void setEditMode(EditMode editMode) { meEditMode = editMode; }
#endif
bool isEdited() { return mbEdited; }
bool isGoodBye() { return mbGoodBye; }
@@ -147,24 +142,11 @@ namespace textinput {
tistring::Decolated* getSendString() { return mpSendString; }
#ifdef MYTILETTERFORM_IMPLEMENTATION
protected:
#else
private:
#endif
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
nw4r::lyt::Pane* mpMemoPane;
nw4r::lyt::Pane* mpMemoRootPane;
nw4r::lyt::Pane* mpBoundPane;
nw4r::lyt::Pane* mpDrawPane;
#else
#ifdef MYTIMANAGER_IMPLEMENTATION
undefined4* unk_0x308;
#endif
undefined4* unk_0x30C;
undefined4* unk_0x310;
undefined4* unk_0x314;
#endif
nw4r::lyt::Pane* mpMemoPane; // 0x308
nw4r::lyt::Pane* mpMemoRootPane; // 0x30C
nw4r::lyt::Pane* mpBoundPane; // 0x310
nw4r::lyt::Pane* mpDrawPane; // 0x314
f32 mfScroll; // 0x318
f32 mfScrollFrom; // 0x31C
f32 mfScrollTo; // 0x320
@@ -176,11 +158,7 @@ namespace textinput {
nw4r::lyt::Size mDefaultBoundSize; // 0x358
Mtx mDrawMtx; // 0x360
Mtx mBoundMtx; // 0x390
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
util::Animation mExScrollAnm; // 0x3C0
#else
u8 /*todo*/ mExScrollAnm[32]; // 0x3C0
#endif
NigaoeEventObserver* mpNigaoeObserver; // 0x3E0
GXTexObj* mpDefaultNigaoe; // 0x3E4
tistring::Decolated* mpSendString; // 0x3E8
@@ -190,13 +168,10 @@ namespace textinput {
bool mbEditScrollDown; // 0x3EF
bool mbCloseWithSend; // 0x3F0
u8 padding[3]; // 0x3F1
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
ScrollButton* mpScrollButton;
#else
undefined4* mpScrollButton;
#endif
ScrollButton* mpScrollButton; // 0x3F4
bool mbScrollUp; // 0x3F8
bool mbScrollDown; // 0x3F9
u8 padding2[2]; // 0x3FA
EditMode meEditMode; // 0x3FC
};
}

View File

@@ -16,42 +16,36 @@ 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
InputForm(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* arcName,
EventObserver* observer, const char* subName)
: MemoInputForm(manager, resAccessor, arcName, observer, subName),
mbPhotoScaledUp(false), mbPhotoDraw(false), meType(T_MailAddressSel) {}
~InputForm();
virtual void create(MEMAllocator* allocator, inputform::EditBuffer* editBuffer);
virtual void drawBody();
virtual void drawFooter();
virtual void open();
virtual void close();
virtual bool isWholePaneInAnimation();
#ifdef MYTILETTERFORM_IMPLEMENTATION
virtual ~InputForm();
virtual void create(MEMAllocator*, inputform::EditBuffer*);
virtual void drawBody();
virtual void drawFooter();
virtual void open();
virtual void close();
virtual bool isWholePaneInAnimation();
#endif
virtual nw4r::lyt::Material* getPhotoPaneMaterial();
virtual void onPhotoTrig();
virtual void onPhotoPoint();
virtual void onPhotoLeft();
virtual bool isPhotoScaledUp();
virtual void setPhotoDraw(bool photoDraw) { mbPhotoDraw = photoDraw; }
virtual void setPhotoDraw(bool photoDraw);
virtual void setType(Type type) { meType = type; }
virtual void setType(Type type);
virtual void setSendOutMessage(const wchar_t* sendOutMessage);
void resizePhotoPane(f32 width, f32 height);
private:
#ifdef MYTILETTERFORM_IMPLEMENTATION
bool mbPhotoScaledUp;
#else
u8 unk_0x400;
#endif
bool mbPhotoScaledUp; // 0x400
bool mbPhotoDraw; // 0x401
Type meType; // 0x404
};

View File

@@ -8,6 +8,10 @@
namespace textinput {
namespace extend {
namespace bg {
class LayoutByNW4R;
}
namespace memo {
class State;
@@ -28,9 +32,7 @@ namespace textinput {
CT_NumericWithSeparator,
CT_NormalWithoutLineFeedWithSign,
CT_PredictWithoutLineFeed,
#ifdef MYTIMANAGER_IMPLEMENTATION
CT_PredictBigText,
#endif
CT_Last
} ConfigType;
@@ -81,35 +83,21 @@ namespace textinput {
virtual void start();
virtual void end();
#ifdef MYTIMANAGER_IMPLEMENTATION
virtual textinput::InputForm* createInputForm();
#else
virtual InputForm* createInputForm();
#endif
virtual textinput::InputForm* createInputForm();
virtual void memoDraw();
virtual void setSaveData(savedata::MemoSetting memoSetting) {
mMemoSetting = memoSetting;
}
virtual savedata::MemoSetting getSaveData() { return mMemoSetting; }
virtual void setSaveData(savedata::MemoSetting memoSetting);
virtual savedata::MemoSetting getSaveData();
virtual void changeState(StateTimeLine stateTimeLine);
virtual State* getState() { return mpCurrentState; }
virtual State* getState();
virtual void setState(StateType stateType);
virtual ConfigType getConfigType() { return meConfigType; }
virtual ConfigType getConfigType();
#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();
@@ -126,21 +114,24 @@ 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
virtual InputForm* createMemoInputForm();
virtual letter::InputForm* createLetterInputForm();
virtual textinput::InputForm* createBigTextInputForm();
virtual bg::LayoutByNW4R* createBG();
#ifdef MYTIMANAGER_IMPLEMENTATION
void* getBackGround() const { return mpBackGround; }
#endif
virtual void pure_0() {}
virtual void pure_1() {}
virtual void pure_2() {}
virtual void pure_3() {}
virtual void pure_4() {}
virtual void pure_5() {}
virtual void pure_6() {}
virtual void pure_7() {}
virtual void pure_8() {}
virtual void pure_9() {}
void reflectSaveDataRev1();
void reflectSaveDataDefault();
private:
State* mpCurrentState; // 0x40
@@ -149,25 +140,22 @@ namespace textinput {
MemoInputForm* mpMemoInputForm; // 0x50
LetterInputForm* mpLetterInputForm; // 0x54
textinput::InputForm* mpBigTextInputForm; // 0x58
void* mpDefaultPCKeyboard; // 0x5C
void* mpDefaultCellPhoneKeyboard; // 0x60
keyboard::pctype::LayoutByNW4R* mpDefaultPCKeyboard; // 0x5C
keyboard::cellphonetype::LayoutByNW4R* mpDefaultCellPhoneKeyboard; // 0x60
textinput::InputForm* mpDefaultInputForm; // 0x64
void* mpDefaultCandidateBox; // 0x68
void* mpDefaultToolBar; // 0x6C
void* mpDefaultPredictLanguageDialog; // 0x70
void* mpDefaultSignWindow; // 0x74
void* mpBackGround; // 0x78
candidatebox::LayoutByNW4R* mpDefaultCandidateBox; // 0x68
toolbar::LayoutByNW4R* mpDefaultToolBar; // 0x6C
predictlang::LayoutByNW4R* mpDefaultPredictLanguageDialog; // 0x70
keyboard::signwindow::LayoutByNW4R* mpDefaultSignWindow; // 0x74
bg::LayoutByNW4R* mpBackGround; // 0x78
friend class State;
};
class State {
public:
#ifdef MYTIMANAGER_IMPLEMENTATION
State() : mpManager(NULL) {}
Manager* getManager() const { return mpManager; }
void setManager(Manager* manager) { mpManager = manager; }
#endif
virtual ~State();
#ifdef MYTIMANAGER_MATCHING
virtual Manager::StateType getStateType() = 0;
virtual void create() = 0;
@@ -185,11 +173,49 @@ namespace textinput {
virtual void start() = 0;
virtual void end() = 0;
#else
virtual InputForm* InputForm();
virtual keyboard::hwkey::HWKeyboard* HWKeyboard();
virtual keyboard::pctype::LayoutByNW4R* PCKeyboard();
virtual keyboard::cellphonetype::LayoutByNW4R* CellPhoneKeyboard();
virtual keyboard::signwindow::LayoutByNW4R* SignKeyboard();
virtual candidatebox::LayoutByNW4R* CandidateBox();
virtual toolbar::LayoutByNW4R* ToolBar();
virtual predictlang::LayoutByNW4R* PredictLanguageSelectDialog();
virtual bg::LayoutByNW4R* BG();
protected:
Manager* mpManager; // 0x04
friend class Manager;
};
class DispMemoState : public State {
public:
virtual ~DispMemoState();
virtual Manager::StateType getStateType();
virtual void create();
virtual void init();
virtual void draw();
virtual void memoDraw();
virtual void calc();
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release);
virtual bool updateInput(input::HKBManager& hkbManager);
virtual void start();
virtual void end();
};
class AppearMemoState : public State {
public:
AppearMemoState() : mfAnim(0.0f) {}
virtual ~AppearMemoState();
virtual Manager::StateType getStateType();
virtual void create();
virtual void init();
virtual void draw();
@@ -203,25 +229,44 @@ namespace textinput {
virtual void start();
virtual void end();
#endif
#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
protected:
f32 mfAnim; // 0x08
};
private:
Manager* mpManager; // 0x04
class EditMemoState : public State {
public:
virtual ~EditMemoState();
virtual Manager::StateType getStateType();
virtual void create();
virtual void init();
virtual void draw();
virtual void memoDraw();
virtual void calc();
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release);
virtual bool updateInput(input::HKBManager& hkbManager);
virtual void start();
virtual void end();
};
class DisappearMemoState : public AppearMemoState {
public:
virtual ~DisappearMemoState();
virtual Manager::StateType getStateType();
virtual void calc();
virtual void start();
};
}
}
typedef extend::memo::Manager MemoManager;
}
#include "MyTiBg.h"
#endif // TEXTINPUT_MY_MANAGER_H

View File

@@ -48,9 +48,6 @@ namespace textinput {
class CandidateBoxCaller {
public:
#ifdef TIINPUTFORM_IMPLEMENTATION
CandidateBoxCaller() : mpCandidateBox(NULL) {}
#endif
// This candidate thing is a bit different from the dwarf
class Candidates {
public:
@@ -77,9 +74,11 @@ namespace textinput {
class Base : public CommandSender {
public:
#ifdef TIMANAGER_IMPLEMENTATION
Base(Manager* manager) : mpCandidates(NULL), mpAllocator(NULL), mbOn(false), mbInvalid(true), meLanguage(USA), mpManager(manager) {}
#ifdef TI_CANDIDATEBOX_SAMPLE_CLASS
Base(Manager* manager)
: mpCandidates(NULL), mpAllocator(NULL), mbOn(false), mbInvalid(true), meLanguage(USA), mpManager(manager) {}
#endif
virtual ~Base();
virtual void create(MEMAllocator* allocator) override;
virtual void init() override {}
@@ -114,9 +113,8 @@ namespace textinput {
class EventHandler : public nw4rmanager::TiEventHandler {
public:
#ifdef TIMANAGER_IMPLEMENTATION
EventHandler(LayoutByNW4R* layout) : mpLayoutByNW4R(layout) {}
#endif
virtual void onTiEvent(gui::PaneComponent* paneComponent, u32 event, Input* input) override; // 0x18
LayoutByNW4R* mpLayoutByNW4R; // 0xC
@@ -290,13 +288,13 @@ namespace textinput {
// TODO
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public UIObj::Listener {
public:
#ifdef TIMANAGER_IMPLEMENTATION
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
: Base(manager), nw4rmanager::Layout(accessor, layoutName, observer), mEventHandler(this), mpTiString(NULL),
mTextArea(0, this, this), mLeftScroll(1, this, this), mRightScroll(2, this, this), mOnOffButton(3, this, this),
mTextWindow(4, this, this), mbActive(true) {}
const UIOnOffButton& getOnOffButton() const { return mOnOffButton; }
#ifdef TI_CANDIDATEBOX_SAMPLE_CLASS
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* arcName, EventObserver* observer)
: Base(manager), nw4rmanager::Layout(resAccessor, arcName, observer), mEventHandler(this),
mpTiString(NULL), mTextArea(0, this, this), mLeftScroll(1, this, this), mRightScroll(2, this, this),
mOnOffButton(3, this, this), mTextWindow(4, this, this), mbActive(true) {}
#endif
virtual ~LayoutByNW4R();
virtual void create(MEMAllocator* allocator) override;
virtual void init() override;
@@ -325,11 +323,7 @@ namespace textinput {
virtual u16 getScroll() { return mTextArea.GetDispOffset(); } // 0x100
virtual bool isInScroll(); // 0x104
virtual void setActive(bool active); // 0x108
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual bool isActive() const { return mbActive; }
#else
virtual bool isActive() const;
#endif // 0x10C
virtual bool isActive() const; // 0x10C
virtual void setSelectedTextPane(int pane) { mTextArea.SetSelectedText(pane); } // 0x110
virtual void setFocusedTextPane(int pane) { mTextArea.SetFocusedText(pane); } // 0x114
virtual int getFocusedTextPane() { return mTextArea.GetFocusedText(); } // 0x118
@@ -339,13 +333,13 @@ namespace textinput {
virtual void cancelStateFocusIn(); // 0x128
virtual void onEvent(UIObj*, u32, void*) override; // 0x12C
#ifdef TIINPUTFORM_IMPLEMENTATION
UITextArea& getTextArea() { return mTextArea; }
#endif
void onPressedShift(bool shift);
void onReleasedShift();
void startTurnOn(bool);
UIOnOffButton& getOnOffButton() { return mOnOffButton; }
const UIOnOffButton& getOnOffButton() const { return mOnOffButton; }
private:
void createAnmPane_(MEMAllocator* allocator);
@@ -408,6 +402,17 @@ namespace textinput {
virtual void onAnmEvent(AnmPaneEvent paneEvent) override; // 0x10
};
#ifdef TI_CANDIDATEBOX_SAMPLE_CLASS
class Sample : public LayoutByNW4R {
public:
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* arcName, EventObserver* observer)
: LayoutByNW4R(manager, resAccessor, arcName, observer) {}
virtual ~Sample();
};
#else
class Sample {};
#endif
} // namespace candidatebox
} // namespace textinput

View File

@@ -1,273 +1,226 @@
#ifndef TEXTINPUT_CELL_PHONE_H
#define TEXTINPUT_CELL_PHONE_H
#include "tiNw4rManager.h"
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
#include "tiKeyboard.h"
#endif
#include "tiNw4rManager.h"
#ifdef TI_CELLPHONE_IMPLEMENTATION
#include <revolution/gx.h>
#endif
namespace textinput {
class Manager;
#ifdef TI_CELLPHONE_SAMPLE_CLASS
class EventObserver;
#endif
namespace predictlang {
class LayoutByNW4R;
}
namespace keyboard {
#ifdef TI_CELLPHONE_IMPLEMENTATION
enum VKeyCode {
VK_LINE_FEED = 0,
VK_DELETE = 1,
VK_SIGN_INPUT = 9,
VK_PREDICT_LANGUAGE = 10,
VK_INPUT_MODE_02 = 11,
VK_INPUT_MODE_03 = 13,
VK_INPUT_MODE_00 = 18,
VK_INPUT_MODE_01 = 19,
VK_TOGGLE_ABC_MODE = 23,
};
#endif
namespace signwindow {
class LayoutByNW4R;
}
}
namespace keyboard {
class KeyboardBase;
typedef enum VKeyCode {
VK_LF = 0,
VK_DELETE = 1,
VK_SPACE = 2,
VK_OTHERS = 9,
VK_PRDC = 0xA,
VK_TAG_02 = 0xB,
VK_TAG_03 = 0xD,
VK_UNKNOWN_11 = 0x11,
VK_TAG_00 = 0x12,
VK_TAG_01 = 0x13,
VK_SML_CPT = 0x17,
VK_NONE = 0x1B,
} VKeyCode;
namespace cellphonetype {
class EventHandler;
#ifdef TI_CELLPHONE_IMPLEMENTATION
class CellPhoneAnmPane;
struct PaneNameToCharCode;
#endif
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
class Base : public textinput::keyboard::KeyboardBase {
#else
class Base {
#endif
struct KeySet;
struct LanguageDependency;
class LayoutByNW4R;
class Base : public KeyboardBase {
public:
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
#if defined(MYTIMANAGER_IMPLEMENTATION) && defined(TI_CELLPHONE_SAMPLE_CLASS)
Base(Manager* manager) : mPreviousInputMode(0), mCurrentInputMode(0), mpManager(manager) {}
#endif
enum InputMode {
typedef enum InputMode {
IM_00,
IM_01,
IM_02,
IM_03,
IM_04,
};
IM_05,
} InputMode;
virtual ~Base();
virtual void create(MEMAllocator* allocator) override;
virtual void init() override;
virtual void updateFromReceiver(u32, void*) override;
virtual void onKey(u32, void*) override;
#ifdef TIMANAGER_IMPLEMENTATION
#ifdef TI_CELLPHONE_SAMPLE_CLASS
Base(Manager* manager) : mpManager(manager) {}
#endif
#if defined(TI_CELLPHONE_IMPLEMENTATION)
virtual u32 getType() override;
#elif defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
virtual int getType() override;
#elif defined(TIHWKEYBOARD_IMPLEMENTATION)
virtual int getType() override;
#else
virtual void getType() override;
#endif
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();
#ifdef TI_CELLPHONE_IMPLEMENTATION
wchar_t convertToZiCellphoneInput_(wchar_t value);
#endif
#else
virtual void vt_0x08();
virtual void vt_0x0C();
virtual void vt_0x10();
virtual void vt_0x14();
virtual void vt_0x18();
virtual void vt_0x1C();
virtual void vt_0x20();
virtual void vt_0x24();
virtual void vt_0x28();
virtual void vt_0x2C();
virtual void vt_0x30();
virtual void vt_0x34();
virtual void vt_0x38();
virtual void vt_0x3C();
virtual void vt_0x40();
virtual void vt_0x44();
virtual bool isNumeric() const;
virtual void create(MEMAllocator* allocator) override; // 0x0C
virtual void init() override; // 0x10
virtual void setCommandReceiver(CommandReceiver* receiver) override; // 0x14
virtual void sendCommand(u32, void*) override; // 0x18
virtual void updateFromReceiver(u32, void*) override; // 0x1C
virtual void onKey(u32, void*); // 0x20
virtual int getType(); // 0x24
virtual void setLanguage(Language language) override; // 0x28
virtual Language getLanguage() const override; // 0x2C
virtual void onActive() override; // 0x34
virtual void calc(); // 0x38
virtual void draw(); // 0x3C
virtual int getInputMode() const; // 0x40
virtual bool isLocked() const; // 0x44
virtual bool isNumeric() const; // 0x48
virtual bool isNumericWithDot() const; // 0x4C
virtual bool isHoldingButton() const; // 0x50
virtual void doNumericMode(bool); // 0x54
virtual void changeInputMode(InputMode mode); // 0x58
virtual bool isUpperCase(); // 0x5C
virtual void setInputMode(InputMode mode); // 0x60
virtual void setUpperCaseJP(bool); // 0x64
virtual void setLangKeyActive(bool); // 0x68
virtual void onClose(); // 0x6C
virtual void goSignInputMode(); // 0x70
virtual void changePredictLanguage(); // 0x74
virtual void setAbcMode(bool); // 0x78
virtual bool isZiActive(); // 0x7C
virtual bool isAtokActive(); // 0x80
virtual void doInput(); // 0x84
virtual void updateFixMode(); // 0x88
virtual void vt_0x4C();
virtual void vt_0x50();
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
virtual void doNumericMode(bool);
#else
virtual void vt_0x54();
#endif
virtual void vt_0x58();
virtual void vt_0x5C();
virtual void vt_0x60();
virtual void vt_0x64();
virtual void vt_0x68(bool);
void onCtrlKey_(VKeyCode code);
wchar_t convertToZiCellphoneInput_(wchar_t wc);
virtual bool onClose();
#endif
// TODO enum?
int getInputType() const;
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
void resetHoldingButton();
#endif
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
#if defined(MYTIMANAGER_IMPLEMENTATION) && defined(TI_CELLPHONE_IMPLEMENTATION)
protected:
#else
private:
#endif
u32 mPreviousInputMode;
u32 mCurrentInputMode;
bool mbInputModeLocked;
bool mbNumericMode;
bool mbNumericWithDotMode;
bool mbUpperCaseMode;
bool mbAbcMode;
bool mbLanguageKeyMode;
#ifdef TI_CELLPHONE_IMPLEMENTATION
const PaneNameToCharCode* mHoldingButton;
#else
u32 mHoldingButton;
#endif
void* mpInputModeTable;
MEMAllocator* mpAllocator;
#ifdef TI_CELLPHONE_IMPLEMENTATION
Manager* mpManager;
bool mInputState;
#elif defined(TIMANAGER_IMPLEMENTATION)
Manager* mpManager;
u32 mInputState;
#else
void* mpInputSettings;
u32 mInputState;
#endif
#ifdef TI_CELLPHONE_IMPLEMENTATION
void onCtrlKey_(VKeyCode keyCode);
#endif
#endif
Manager* mgr() { return mpManager; }
s32 mTapIndex; // 0x14
s32 mInputMode; // 0x18
u8 mbLocked; // 0x1C
u8 mbNumeric; // 0x1D
u8 mbNumericWithDot; // 0x1E
u8 mbUpperCase; // 0x1F
u8 mbShiftHeld; // 0x20
u8 unk_0x21; // 0x21
const PaneNameToCharCode* mpHoldingPane; // 0x24
const LanguageDependency* mpLanguageDep; // 0x28
MEMAllocator* mpAllocator; // 0x2C
Manager* mpManager; // 0x30
u8 mbLangKeyActive; // 0x34
u8 unk_0x35[3]; // 0x35
};
#ifndef TI_CELLPHONE_MATCH_LAYOUT
#include "tiCellPhoneLayout.h"
#else
class LayoutByNW4R;
#endif
#ifdef TI_CELLPHONE_IMPLEMENTATION
enum Animation {
ANM_Normal,
ANM_FocusIn,
ANM_FocusOut,
ANM_RollOver,
ANM_Pushed,
ANM_05,
ANM_06,
ANM_ToggleOff,
ANM_Last,
};
enum KeyType {
KT_NormalButton,
KT_ControlButton,
};
#ifdef TI_CELLPHONE_MATCH_LAYOUT
class EventHandler : public nw4rmanager::TiEventHandler {
public:
EventHandler(LayoutByNW4R* layout) : mpLayoutByNW4R(layout) {}
virtual ~EventHandler();
virtual void onTiEvent(gui::PaneComponent* pane, u32 event, Input* input) override;
EventHandler(LayoutByNW4R* layout) : mpLayout(layout) {}
virtual void onTiEvent(gui::PaneComponent* paneComponent, u32 event, TiEventHandler::Input* input); // 0x18
private:
LayoutByNW4R* mpLayoutByNW4R;
LayoutByNW4R* mpLayout; // 0x0C
};
#endif
class CellPhoneAnmPane : public nw4rmanager::AnmPane {
public:
CellPhoneAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
#ifdef TI_CELLPHONE_MATCH_LAYOUT
: nw4rmanager::AnmPane(pane, observer), meState(ANM_Normal), meKeyType(KT_NormalButton) {
CellPhoneAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer, u32 keyType)
: nw4rmanager::AnmPane(pane, observer) {
mState = 0;
mKeyType = keyType;
init();
changeAnimation(meState);
changeAnimation(mState);
}
#else
: nw4rmanager::AnmPane(pane, observer), meState(ANM_Normal), meKeyType(KT_NormalButton) {}
#endif
virtual void init() override;
virtual void onAnmEvent(AnmPaneEvent event) override;
virtual void changeAnimation(u32 id) override;
virtual KeyType getKeyType() const;
u32 getAnimationState() const { return meState; }
virtual ~CellPhoneAnmPane();
virtual void init(); // 0x08
virtual void onAnmEvent(AnmPaneEvent paneEvent); // 0x10
virtual void changeAnimation(u32 id); // 0x14
virtual u32 getKeyType() const; // 0x24
protected:
Animation meState;
KeyType meKeyType;
s32 mState; // 0x2C
u32 mKeyType; // 0x30
};
class CellPhoneControlAnmPane : public CellPhoneAnmPane {
public:
CellPhoneControlAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
: CellPhoneAnmPane(pane, observer) { meKeyType = KT_ControlButton; }
CellPhoneControlAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer, u32 keyType)
: CellPhoneAnmPane(pane, observer, 0) {
mKeyType = keyType;
}
virtual void onAnmEvent(AnmPaneEvent event) override;
virtual ~CellPhoneControlAnmPane();
virtual void onAnmEvent(AnmPaneEvent paneEvent); // 0x10
};
#ifndef TI_CELLPHONE_MATCH_LAYOUT
class EventHandler : public nw4rmanager::TiEventHandler {
class LayoutByNW4R : public Base, public nw4rmanager::Layout {
public:
EventHandler(LayoutByNW4R* layout) : mpLayoutByNW4R(layout) {}
virtual ~EventHandler();
virtual void onTiEvent(gui::PaneComponent* pane, u32 event, Input* input) override;
#ifdef TI_CELLPHONE_SAMPLE_CLASS
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* arcName, EventObserver* observer)
: Base(manager), nw4rmanager::Layout(resAccessor, arcName, observer),
mpEventHandler(NULL) {}
#endif
virtual ~LayoutByNW4R();
virtual void create(MEMAllocator* allocator) override;
virtual void init() override;
virtual void setCommandReceiver(CommandReceiver* receiver) override;
virtual void updateFromReceiver(u32, void*) override;
virtual void onKey(u32, void*) override;
virtual void setLanguage(Language language) override;
virtual void update() override;
virtual void onActive() override;
virtual void calc() override;
virtual void draw() override;
virtual void doNumericMode(bool) override;
virtual void changeInputMode(InputMode mode) override;
virtual void setInputMode(InputMode mode) override;
virtual void setUpperCaseJP(bool) override;
virtual void setLangKeyActive(bool) override;
virtual void onClose() override;
virtual void goSignInputMode() override;
virtual void changePredictLanguage() override;
virtual void setAbcMode(bool) override;
virtual void setPredictLanguageDialog(predictlang::LayoutByNW4R*); // 0x104
virtual void setSignWindow(signwindow::LayoutByNW4R*); // 0x108
virtual void doNumericWithDotMode(bool); // 0x10C
virtual void setLineFeedButton(bool); // 0x110
virtual void setPredictLanguageButton(bool); // 0x114
virtual void setSignWindowButton(bool); // 0x118
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data); // 0x11C
virtual bool updateInput(textinput::input::HKBManager& hkbManager); // 0x120
virtual nw4rmanager::AnmPane* getAnmPane(InputMode mode); // 0x124
virtual void throwReleaseForAll(); // 0x128
virtual void changeAnimationAllToNormal(); // 0x12C
virtual void updatePredictLanguage(CommandReceiver::ChangePredictMode* mode); // 0x130
virtual void changeKeyTop(const PaneNameToCharCode* table); // 0x134
virtual void changeSpaceKeyTop(const PaneNameToCharCode* table); // 0x138
void onPressedShift(bool shift);
void onReleasedShift();
void resetHoldingButton();
private:
LayoutByNW4R* mpLayoutByNW4R;
bool mbLineFeed; // 0xE0
u8 unk_0xE1[3]; // 0xE1
GXTexObj mSpaceTexObjJP; // 0xE4
GXTexObj mSpaceTexObjCN; // 0x104
GXTexObj mSpaceTexObjKR; // 0x124
EventHandler* mpEventHandler; // 0x144
predictlang::LayoutByNW4R* mpPredictLanguageDialog; // 0x148
signwindow::LayoutByNW4R* mpSignWindow; // 0x14C
};
#endif
#endif
#ifdef TI_CELLPHONE_MATCH_LAYOUT
#include "tiCellPhoneLayout.h"
#ifdef TI_CELLPHONE_SAMPLE_CLASS
class Sample : public LayoutByNW4R {
public:
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* arcName, EventObserver* observer)
: LayoutByNW4R(manager, resAccessor, arcName, observer) {}
virtual ~Sample();
};
#else
class Sample {};
#endif
} // namespace cellphonetype

View File

@@ -72,10 +72,10 @@ namespace textinput {
virtual ~EventHandler() {} // 0x08
virtual void onEvent(GUIComponent& comp, u32 event, void* data) {} // 0x0C
virtual void onEvent(GUIComponent& comp, u32 event, void* data); // 0x0C
virtual void setLatestEventCtrlNo(int ctrlNo) { muLatestEventCtrlNo = ctrlNo; } // 0x10
virtual int getLatestEventCtrlNo() { return muLatestEventCtrlNo; } // 0x14
virtual void setLatestEventCtrlNo(int ctrlNo); // 0x10
virtual int getLatestEventCtrlNo(); // 0x14
protected:
int muLatestEventCtrlNo; // 0x04
@@ -92,9 +92,6 @@ namespace textinput {
EVENT_RELEASE
};
#ifdef TIINPUTFORM_IMPLEMENTATION
virtual void init();
#else
virtual void init() { // 0x10
for (int i = 0; i < GUI_POINTS_MAX; i++) {
mbPointed[i] = false;
@@ -103,20 +100,19 @@ namespace textinput {
mFlightDuration[i] = 0;
}
}
#endif
GUIComponent(u32 id)
: GUIInterface(), mbInitialize(false), mDraggingButton(0xFFFF), mID(id), mbTriggerTarget(false), mpManager(NULL), mpListener(NULL) {
init();
}
virtual ~GUIComponent() {} // 0x08
virtual ~GUIComponent(); // 0x08
virtual u32 getID() { return mID; } // 0x20
virtual u32 getID(); // 0x20
virtual bool isPointed(int point) { return mbPointed[point]; } // 0x24
virtual bool isDragging(int point) { return mbDragging[point]; } // 0x28
virtual bool isPointed(int point); // 0x24
virtual bool isDragging(int point); // 0x28
virtual void setPointed(int point, bool bEnable) { mbPointed[point] = bEnable; } // 0x2C
virtual void setPointed(int point, bool bEnable); // 0x2C
void onEvent(u32 event, void* data) {
if (mpListener) {
@@ -124,39 +120,30 @@ namespace textinput {
}
}
virtual void onPointIn(int point) { mFlightDuration[point] = 0; } // 0x30
virtual void onPointOut(int point) { mFlightDuration[point] = 0; } // 0x34
virtual void onPointIn(int point); // 0x30
virtual void onPointOut(int point); // 0x34
virtual void onDrag(f32 x, f32 y) {}
virtual void onMove(int point, f32 x, f32 y) { mFlightDuration[point]++; } // 0x38
virtual void onTrig(int point, u32 trig, Vec& dragPos) {
if (trig & mDraggingButton) {
mDraggingPos[point] = dragPos;
mbDragging[point] = true;
mFlightDuration[point] = 0;
}
}
virtual void onDrag(f32 x, f32 y);
virtual void onMove(int point, f32 x, f32 y); // 0x38
virtual void onTrig(int point, u32 trig, Vec& dragPos);
virtual void setDraggingButton(u32 dragBtn) { mDraggingButton = dragBtn; } // 0x3C
virtual void setDraggingButton(u32 dragBtn); // 0x3C
virtual u32 updatePointer(const GUIPointer& pointer) { return updatePointerImpl(pointer); } // 0x40
virtual u32 updatePointer(int point, f32 x, f32 y, u32 trig, u32 hold, u32 release) { // 0x44
GUIPointer pointer(point, x, y, hold, trig, release);
return updatePointerImpl(pointer);
}
virtual u32 updatePointer(const GUIPointer& pointer); // 0x48
virtual u32 updatePointer(int point, f32 x, f32 y, u32 trig, u32 hold, u32 release); // 0x4C
virtual bool isTriggerTarget() { return mbTriggerTarget; } // 0x48
virtual void setTriggerTarget(bool bEnable) { mbTriggerTarget = bEnable; } // 0x4C
virtual bool isTriggerTarget(); // 0x50
virtual void setTriggerTarget(bool bEnable); // 0x54
void setParentManager(GUIManager* manager) { mpManager = manager; }
GUIManager* getParentManager() { return mpManager; }
virtual bool isVisible() { return true; } // 0x50
virtual bool isVisible(); // 0x58
virtual u16 getFlightDuration(int point) { return mFlightDuration[point]; } // 0x54
virtual void setFlightDuration(int point, u16 flightDir) { mFlightDuration[point] = flightDir; } // 0x58
virtual u16 getFlightDuration(int point); // 0x5C
virtual void setFlightDuration(int point, u16 flightDir); // 0x60
virtual bool contain(f32 x, f32 y) = 0; // 0x5C
virtual bool contain(f32 x, f32 y) = 0; // 0x64
void setListener(EventHandler* listener) { mpListener = listener; }
@@ -167,9 +154,9 @@ namespace textinput {
bool mbInitialize; // 0x04
bool mbPointed[GUI_POINTS_MAX]; // 0x08
bool mbPointed[GUI_POINTS_MAX]; // 0x05
bool mbDragging[GUI_POINTS_MAX]; // 0x10
bool mbDragging[GUI_POINTS_MAX]; // 0x0D
Vec mDraggingPos[GUI_POINTS_MAX]; // 0x18
int mDraggingButton; // 0x78
@@ -177,10 +164,10 @@ namespace textinput {
u16 mFlightDuration[GUI_POINTS_MAX]; // 0x80
bool mbTriggerTarget; // 0x8A
bool mbTriggerTarget; // 0x90
GUIManager* mpManager; // 0x8C
EventHandler* mpListener; // 0x90
GUIManager* mpManager; // 0x94
EventHandler* mpListener; // 0x98
};
class GUIManager : public GUIInterface {
@@ -200,27 +187,15 @@ namespace textinput {
virtual GUIComponent* getComponent(u32 id); // 0x24
virtual GUIComponent* getComponent(u32 id) const; // 0x28
virtual bool update(int point, const KPADStatus* kpad, f32, f32, void* data) { return false; } // 0x2C
virtual bool update(int point, const KPADStatus* kpad, f32, f32, void* data); // 0x2C
virtual bool update(int point, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data); // 0x30
virtual void onEvent(GUIComponent& comp, u32 event, int point, void* data) { // 0x34
if (mpEventHandler) {
mpEventHandler->setLatestEventCtrlNo(point);
mpEventHandler->onEvent(comp, event, data);
}
comp.onEvent(event, data);
}
virtual void onEvent(GUIComponent& comp, u32 event, int point, void* data); // 0x34
virtual void setAllComponentTriggerTarget(bool bEnable); // 0x38
virtual void setEventHandler(EventHandler* eventHandler) { // 0x3C
mpEventHandler = eventHandler;
}
virtual EventHandler* changeEventHandler(EventHandler* eventHandler) { // 0x40
EventHandler* prevHandler = mpEventHandler;
mpEventHandler = eventHandler;
return prevHandler;
}
virtual void setEventHandler(EventHandler* eventHandler); // 0x3C
virtual EventHandler* changeEventHandler(EventHandler* eventHandler); // 0x40
virtual void setDraggingButton(u32 dragBtn); // 0x44
@@ -259,7 +234,7 @@ namespace textinput {
virtual PaneComponent* getPaneComponentByPane(nw4r::lyt::Pane* pane); // 0x4C
virtual const nw4r::lyt::DrawInfo* getDrawInfo() { return mpDrawInfo; } // 0x50
virtual const nw4r::lyt::DrawInfo* getDrawInfo(); // 0x50
virtual void setDrawInfo(const nw4r::lyt::DrawInfo* drawInfo) { mpDrawInfo = drawInfo; } // 0x54
virtual void setAllBoundingBoxComponentTriggerTarget(bool bEnable); // 0x58
@@ -298,11 +273,11 @@ namespace textinput {
virtual void draw(); // 0x1C
virtual bool isVisible(); // 0x50
virtual bool isVisible(); // 0x58
virtual bool contain(f32 x, f32 y); // 0x5C
virtual bool contain(f32 x, f32 y); // 0x64
virtual void setPane(nw4r::lyt::Pane* pane) { mpPane = pane; } // 0x60
virtual void setPane(nw4r::lyt::Pane* pane); // 0x68
nw4r::lyt::Pane* getPane() { return mpPane; }
nw4r::lyt::TextBox* getTextPane() { return static_cast<nw4r::lyt::TextBox*>(mpPane); }

View File

@@ -4,232 +4,158 @@
#include <revolution/types.h>
#include <revolution/mem/allocator.h>
#include <revolution/os.h>
#include "keyboard/tiCpData.h"
#ifdef TIHKBMANAGER_IMPLEMENTATION
#include <revolution/kbd.h>
enum _KBDEc { KBD_EC_BUSY = 7 };
#endif
typedef enum _KBDEc {
KBD_EC_0 = 0,
KBD_EC_1,
KBD_EC_2,
KBD_EC_3,
KBD_EC_4,
KBD_EC_5,
KBD_EC_6,
KBD_EC_OK,
} KBDEc;
typedef struct _KBDDevEvent {
u8 chan;
u8 unk_0x01[0x1F];
} KBDDevEvent;
typedef struct _KBDKeyEvent {
u8 chan;
u8 key;
u8 unk_0x02[2];
u32 mods;
} KBDKeyEvent;
extern "C" {
void KBDInitRegionUS(void);
void KBDInit(void);
void KBDSetAttachCallback(void (*cb)(KBDDevEvent*));
void KBDSetDetachCallback(void (*cb)(KBDDevEvent*));
void KBDSetKeyCallback(void (*cb)(KBDKeyEvent*));
int KBDSetLedsAsync(u8 chan, u8 leds, void (*cb)(KBDEc, void*), void* arg);
int KBDSetLeds(u8 chan, u8 leds);
int KBDSetModState(u8 chan, u32 mods);
int KBDSetCountry(u8 chan, u32 country);
int KBDSetLockProcessing(u8 chan, int lock);
u16 KBDTranslateHidCode(u8 key, u32 country);
}
namespace textinput {
namespace input {
#ifdef TIHKBMANAGER_IMPLEMENTATION
class HKBManager {
public:
class KeyState_ {
public:
void NotifyEvent(u8 down, u8 code);
void Update();
void UpdateModState_();
void Clear() {
held = 0;
triggered = 0;
released = 0;
repeated = 0;
current = 0;
pending = 0;
modifiers &= 0x700;
forceMask = 0;
forceState = 0;
retryLeds = 0;
}
void Initialize(u8 channel) {
held = 0;
triggered = 0;
released = 0;
repeated = 0;
current = 0;
pending = 0;
forceMask = 0;
forceState = 0;
retryLeds = 0;
device = channel;
country = 0xf;
modifiers = 0;
}
u8 device;
u32 held, triggered, released, repeated;
u32 previous, current, pending;
u32 modifiers, forceState, forceMask;
s32 country;
u8 retryLeds;
u8 previousKeys[8], currentKeys[8], pendingKeys[8];
u32 repeatDelay[8];
};
HKBManager();
~HKBManager();
static HKBManager& getInstance() { return sInstance; }
void Initialize();
void Update();
u32 GetModifierState() const;
void SetModifierState(u32 state, u32 mask);
void SetForceModifierState(u32 state, u32 mask);
void SetCountry(u8 country);
void ClearState();
class KeySet {
public:
KeySet() {}
KeySet(const HKBManager* owner, u8 kind)
: manager(owner), type(kind), index(-1), device(0), vcode(0) {}
u8 GetKey() const;
u32 GetWChar() const;
u32 GetVCode() const;
u32 IsValid() const;
bool CheckValidity() const {
if (!manager) return false;
s8 keyIndex = index;
if (keyIndex < 0 || keyIndex >= 8) return false;
u8 keyDevice = device;
if (keyDevice >= 2) return false;
switch (type) {
case 0: return (manager->states[keyDevice].held & (1 << keyIndex)) != 0;
case 1: return (manager->states[keyDevice].triggered & (1 << keyIndex)) != 0;
case 2: return (manager->states[keyDevice].released & (1 << keyIndex)) != 0;
case 3: return (manager->states[keyDevice].repeated & (1 << keyIndex)) != 0;
}
return false;
}
KeySet GetNext() const;
const HKBManager* manager;
u8 type;
s8 index;
u8 device;
mutable u16 vcode;
KeySet(const HKBManager* manager, u8 type) :
mpManager(manager), mType(type),
mIndex(-1), mSubIndex(0), mVCode(0) {}
u8 GetKey() const;
wchar_t GetWChar() const;
wchar_t GetVCode() const;
bool IsValid() const;
KeySet GetNext() const;
const HKBManager* mpManager; // 0x00
u8 mType; // 0x04
s8 mIndex; // 0x05
u8 mSubIndex; // 0x06
mutable u16 mVCode; // 0x08
};
class KBDListenerOwn;
class KBDListenerLinks {
KeySet GetTriggeredKeySet() const;
KeySet GetReleasedKeySet() const;
KeySet GetRepeatedKeySet() const;
private:
class KeyState_ {
public:
KBDListenerLinks() : previous(0), next(0) {}
virtual ~KBDListenerLinks() {}
virtual void OnAttach(KBDDevEvent*) = 0;
virtual void OnDetach(KBDDevEvent*) = 0;
virtual void OnKeyEvent(KBDKeyEvent*) = 0;
KBDListenerOwn* previous;
KBDListenerOwn* next;
void NotifyEvent(u8 type, u8 key);
void Update();
void UpdateModState_();
u8 mKbdChan; // 0x00
u8 pad_0x01[3];
u32 mMaskWork; // 0x04
u32 mTrigMask; // 0x08
u32 mRelMask; // 0x0C
u32 mRepMask; // 0x10
u32 mPrevMask; // 0x14
u32 mCurMask; // 0x18
u32 mInputMask; // 0x1C
u32 mModState; // 0x20
u32 mForceMod; // 0x24
u32 mForceMask; // 0x28
s32 mCountry; // 0x2C
u8 mLedOK; // 0x30
u8 mReleasedKeys[8]; // 0x31
u8 mPrevKeys[8]; // 0x39
u8 mCurKeys[8]; // 0x41
u8 pad_0x49[3];
u32 mRepeatCtr[8]; // 0x4C
};
class KBDListenerOwn : public KBDListenerLinks {
class KBDListener {
public:
KBDListenerOwn(HKBManager* owner) : manager(owner) {}
virtual ~KBDListenerOwn();
KBDListener() : unk_0x04(0), mpNext(NULL) {}
virtual ~KBDListener() {}
virtual void OnAttach(KBDDevEvent* event);
virtual void OnDetach(KBDDevEvent* event);
virtual void OnKeyEvent(KBDKeyEvent* event);
HKBManager* manager;
u32 unk_0x04;
KBDListener* mpNext;
};
HKBManager() __attribute__((never_inline));
~HKBManager();
static HKBManager& getInstance() { return sInstance; }
void Initialize();
void ClearState();
u32 GetModifierState() const;
void SetCountry(u8 country);
void SetModifierState(u32 state, u32 mask);
void SetForceModifierState(u32 state, u32 mask);
void Update();
KeySet GetTriggeredKeySet() const;
KeySet GetReleasedKeySet() const;
KeySet GetRepeatedKeySet() const;
#ifdef TIHWKEYBOARD_IMPLEMENTATION
KeySet GetReleasedKeySet() const;
#endif
static void SetLedCB(_KBDEc result, void* userData);
class KBDListenerOwn : public KBDListener {
public:
KBDListenerOwn(HKBManager* manager) : mpManager(manager) {}
virtual void OnAttach(KBDDevEvent* event);
virtual void OnDetach(KBDDevEvent* event);
virtual void OnKeyEvent(KBDKeyEvent* event);
HKBManager* mpManager; // 0x0C
};
static void SetLedCB(KBDEc result, void* arg);
static void AttachCB(KBDDevEvent* event);
static void DetachCB(KBDDevEvent* event);
static void KeyEventCB(KBDKeyEvent* event);
private:
u8 initialized;
u8 attached[2];
u32 lockState;
u32 retryDevices;
const wchar_t* allowedCharacters;
u32 allowedCharacterCount;
KeyState_ states[2];
KBDListenerOwn listener;
static HKBManager sInstance;
};
#else
class HKBManager {
public:
#ifdef TIMANAGER_IMPLEMENTATION
void ClearState();
#endif
static HKBManager& getInstance() { return sInstance; }
void Initialize();
void Update();
u32 GetModifierState() const;
void SetModifierState(u32, u32);
#if defined(TI_CELLPHONE_HKB_KEYSET)
class KeySet {
public:
u8 GetKey() const;
u32 GetWChar() const;
bool IsValid() const;
KeySet GetNext() const;
KeySet(const KeySet& other)
: mpManager(other.mpManager), mKind(other.mKind), mIndex(other.mIndex),
mDevice(other.mDevice), mCharacter(other.mCharacter) {}
private:
const HKBManager* mpManager;
u8 mKind;
s8 mIndex;
u8 mDevice;
u16 mCharacter;
};
KeySet GetTriggeredKeySet() const;
KeySet GetRepeatedKeySet() const;
#else
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION)
class KeySet {
public:
u8 GetKey() const;
#ifdef TIHWKEYBOARD_IMPLEMENTATION
u32 GetWChar() const;
#else
wchar_t GetWChar() const;
#endif
bool IsValid() const;
KeySet GetNext() const;
KeySet(const KeySet& other)
: mpManager(other.mpManager), mKind(other.mKind), mIndex(other.mIndex), mDevice(other.mDevice), mCharacter(other.mCharacter) {}
#ifdef TIHWKEYBOARD_IMPLEMENTATION
KeySet() : mpManager(NULL), mKind(0), mIndex(-1), mDevice(0), mCharacter(0) {}
#endif
private:
const HKBManager* mpManager;
u8 mKind;
s8 mIndex;
u8 mDevice;
u16 mCharacter;
};
KeySet GetTriggeredKeySet() const;
KeySet GetRepeatedKeySet() const;
#ifdef TIHWKEYBOARD_IMPLEMENTATION
KeySet GetReleasedKeySet() const;
#endif
void SetForceModifierState(u32 mask, u32 state);
#else
class KeySet {
private:
keyboard::cellphonetype::PaneNameToCharCode* pPaneNameToCharCode; // 0x00
wchar_t szKeySetName[17]; // 0x04
u16 uNum; // 0x26
u16 uType; // 0x28
#ifdef TI_CELLPHONE_IMPLEMENTATION
public:
bool IsValid() const;
u32 GetKey() const;
wchar_t GetWChar() const;
KeySet GetNext() const;
#endif
};
#ifdef TI_CELLPHONE_IMPLEMENTATION
KeySet GetTriggeredKeySet() const;
KeySet GetRepeatedKeySet() const;
#endif
#endif
#endif
private:
u8 unk_0x00[0xFC];
u8 mInitialized; // 0x00
u8 mAttached[2]; // 0x01
u8 pad_0x03;
u32 mModState; // 0x04
u32 mPendingLeds; // 0x08
const wchar_t* mpKeyTable; // 0x0C
u32 mKeyTableNum; // 0x10
KeyState_ mKeyStates[2]; // 0x14
KBDListenerOwn mListener; // 0xEC
static HKBManager sInstance;
};
#endif
} // namespace input
} // namespace textinput

View File

@@ -8,62 +8,39 @@ namespace textinput {
class Manager;
namespace keyboard {
namespace hwkey {
#ifdef TIMANAGER_IMPLEMENTATION
class HWKeyboard : public CommandSender {
#else
class HWKeyboard : CommandSender {
#endif
public:
struct AnimationFile {
u32 mAnimationNo;
char mFileName[0x40];
};
static const AnimationFile csAninationFile[8];
HWKeyboard(Manager *);
#ifdef TIMANAGER_IMPLEMENTATION
inline ~HWKeyboard();
#else
~HWKeyboard();
#endif
#ifdef TIMANAGER_IMPLEMENTATION
void setLanguage(Destination destination, Language language);
#endif
virtual void init();
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION)
wchar_t convertWCCode(wchar_t code) const;
#endif
virtual ~HWKeyboard();
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIMANAGER_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);
#ifdef TIINPUTFORM_IMPLEMENTATION
void resetQuoteState() { mbSingleQuoteClosing = 0; mbDoubleQuoteClosing = 0; }
#endif
private:
#ifdef TIHWKEYBOARD_IMPLEMENTATION
bool updateRepeatKey_(input::HKBManager&);
bool updateTriggerKey_(input::HKBManager&);
bool updateTappingShift_(input::HKBManager&);
#endif
void updateShift(input::HKBManager& hkbManager);
bool updateRepeatKey_(input::HKBManager& hkbManager);
bool updateTriggerKey_(input::HKBManager& hkbManager);
bool updateTappingShift_(input::HKBManager& hkbManager);
public:
u16 convertWCCode(wchar_t wc) const;
void setLanguage(Destination destination, Language language);
private:
void controlKeyTriggeredHandler(input::HKBManager);
Manager *mgr() { return mpManager; }
Manager* mpManager; // 0x10
u8 field_0x14; // 0x14
#ifdef TIINPUTFORM_IMPLEMENTATION
u8 mbSingleQuoteClosing;
u8 mbDoubleQuoteClosing;
#else
#ifdef TIHWKEYBOARD_IMPLEMENTATION
bool field_0x15;
bool field_0x16;
#else
u8 field_0x15; // 0x15
u8 field_0x16; // 0x16
#endif
#endif
bool field_0x15; // 0x15
bool field_0x16; // 0x16
};

View File

@@ -13,43 +13,17 @@
#include "tiZiString.h"
#include "tiSEId.h"
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
extern "C" wchar_t KPRGetChar(KPRQueue* queue);
extern "C" void KPRPutChar(KPRQueue* queue, wchar_t character);
extern "C" void KPRClearQueue(KPRQueue* queue);
extern "C" void KPRInitRegionUS();
extern "C" u8 KPRLookAhead(KPRQueue* queue, wchar_t* character, wchar_t* combining);
#endif
namespace textinput {
#ifdef TIMANAGER_IMPLEMENTATION
class Manager;
#endif
namespace inputform {
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
class Base;
class EventHandler;
class LayoutByNW4R;
#endif
class EditBuffer {
#ifdef TIMANAGER_IMPLEMENTATION
friend class textinput::Manager;
public:
EditBuffer() : mpString(NULL), mpUnfixString(NULL), mpZiString(NULL), mpAllocator(NULL) {}
#endif
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
friend class LayoutByNW4R;
friend class Base;
#endif
public:
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
void create(MEMAllocator* allocator);
#endif
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
EditBuffer() : mpString(NULL), mpUnfixString(NULL), mpZiString(NULL), mpAllocator(NULL) {}
virtual ~EditBuffer();
#else
~EditBuffer();
#endif
virtual void create(MEMAllocator* allocator);
void* getString() const { return mpString; }
void* getZiString() const { return mpZiString; }
private:
void* mpString; // 0x04
@@ -59,27 +33,10 @@ namespace textinput {
};
class DeadKeyStream {
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
public:
DeadKeyStream() { KPRInitRegionUS(); init(); }
static wchar_t ToCombineClass(Language language, wchar_t code);
static wchar_t ToIndependentClass(wchar_t code);
inline wchar_t getChar();
void init();
u8 lookAhead() { return KPRLookAhead(&mKPRQueue, NULL, NULL); }
void putChar(wchar_t character) { KPRPutChar(&mKPRQueue, character); }
bool isEmpty() const { return mKPRQueue.oCount == 0; }
void clear() { KPRClearQueue(&mKPRQueue); }
private:
#ifdef TIMANAGER_IMPLEMENTATION
friend class textinput::Manager;
#endif
static bool sbCompatibleFilterEnabled;
static inline bool isCompatible(wchar_t character);
#elif defined(TI_PC_KEYBOARD_IMPLEMENTATION)
public:
static wchar_t ToIndependentClass(wchar_t code);
#endif
static wchar_t ToIndependentClass(wchar_t wc);
private:
KPRQueue mKPRQueue; // 0x00
};
@@ -128,57 +85,17 @@ namespace textinput {
// TODO - location
class RowInfoManager {
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
friend class LayoutByNW4R;
friend class Base;
public:
RowInfoManager(u16 maxLength) : mpInfo(NULL), mMaxLength(maxLength), mpAllocator(NULL) {}
void init();
~RowInfoManager();
#endif
private:
Info_* mpInfo; // 0x00
u16 mMaxLength; // 0x04
MEMAllocator* mpAllocator; // 0x08
};
#ifdef TISIGNWINDOW_IMPLEMENTATION
bool isAtokActive() const;
#endif
#ifdef MYTILETTERFORM_IMPLEMENTATION
virtual void create(MEMAllocator* allocator);
virtual void init();
virtual void onCommand(INPUT_COMMAND command, void* data);
#endif
virtual ~Base();
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
Base(Manager* manager);
virtual void create(MEMAllocator* allocator);
virtual void init();
virtual void onCommand(INPUT_COMMAND command, void* data);
void setCursorPos(tistring::Decolated* string, u32 pos);
void calcCursorTimer();
bool isAtokActive() const;
bool isVacancy() const;
void dirtyCacheAll();
tistring::Decolated* getCurrentString(bool inputting);
void moveCandidateToIdx(s32 index);
void onPressDownHWKB();
void onPressLeftHWKB();
void onPressRightHWKB();
void toggleAtokMode_(u8 operation);
void onSpaceKeyHWKB(u32 modifiers);
void onHKBCtrlCode(HVKCode code, u32 modifiers);
void confirmInput_();
void confirmInputting_(wchar_t character, bool direct, u16 letterMode, bool confirmOnly, void* holdingKey);
void inputCharZi_(wchar_t character, u32 modifiers);
void inputCharDefault_(wchar_t character, u32 modifiers);
void inputInputting_(wchar_t character);
inline bool hasZiPredictions() const;
inline bool usesZiPrediction() const;
inline void resetPredictionContext();
inline void resetInputRelation();
#endif
virtual void create(MEMAllocator* allocator);
virtual void init();
virtual void onCommand(INPUT_COMMAND command, void* data);
virtual void create(MEMAllocator* allocator, EditBuffer* editBuffer);
@@ -217,6 +134,7 @@ namespace textinput {
virtual void setAtokDictionary(void* atokDict, int atokDictSize, void* apotDict, int apotDictSize, void* nintendoDict, int nintendoDictSize);
virtual void closeAtokDictionary();
virtual bool isAtokDictionaryOpened();
bool isAtokActive() const;
void setZiDictionary(void* ziOemDict, void* ziDict) {
mpZiString->openDictionary(ziDict, ziOemDict);
@@ -226,6 +144,7 @@ namespace textinput {
void initZiString();
void resetContextPredict_();
void dirtyCacheAll();
void notifyChangeMode();
@@ -234,12 +153,9 @@ namespace textinput {
virtual void enableSpaceByRight(bool rightWithSpace);
virtual void onClose();
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
tistring::WithAtok* getCurrentString(bool fixed);
virtual bool canConvert() { return getCurrentString(false) == mpUnfixString; }
#else
virtual bool canConvert();
#endif
void* getCurrentString(bool flag);
virtual void setString(const wchar_t* string);
@@ -269,10 +185,6 @@ namespace textinput {
virtual void onSE(sound::SE seId);
#ifdef MYTIMANAGER_IMPLEMENTATION
void dirtyCacheAll();
#endif
virtual void clear();
virtual u32 calcCursorPos(f32 x, f32 y);
@@ -289,21 +201,15 @@ namespace textinput {
virtual void makeUpCursorPos(CursorPos* cursorPos, u32 pos, s32 startLine, s32 endLine);
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
bool isVacancy() const;
bool isPredictOn() const { return mbPredictOn; }
protected:
#if !defined(TIINPUTFORM_IMPLEMENTATION) && !defined(TIMANAGER_IMPLEMENTATION)
void setCursorPos(tistring::Decolated* string, u32 pos);
void calcCursorTimer();
#endif
void resetRelation();
#else
private:
#endif
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
nw4r::ut::Rect mRect;
#else
Rect mRect;
#endif
nw4r::ut::Rect mRect; // 0x120
nw4r::math::MTX34 mMtx; // 0x130
Destination meDestination; // 0x160
tistring::Decolated* mpString; // 0x164
@@ -311,9 +217,6 @@ namespace textinput {
tistring::WithZi* mpZiString; // 0x16C
InputMode meInputMode; // 0x170
PredictMode mePredictMode; // 0x174
#ifdef TIMANAGER_IMPLEMENTATION
friend class textinput::Manager;
#endif
bool mbPredictOn; // 0x178
bool mbDoWordWrap; // 0x179
bool mbRightWithSpace; // 0x17A
@@ -349,18 +252,14 @@ namespace textinput {
};
class LayoutByNW4R : public Base, public nw4rmanager::Layout {
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
friend class EventHandler;
inline const nw4r::lyt::Pane* getLanguageTextPane() const;
#endif
public:
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
LayoutByNW4R(textinput::Manager*, nw4r::lyt::MultiArcResourceAccessor*, const char*, EventObserver*, const char*);
#endif
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* arcName,
EventObserver* observer, const char* subName);
~LayoutByNW4R();
virtual void init();
virtual void onCommand(INPUT_COMMAND command, void* data);
virtual void onSE(sound::SE seId);
virtual void create(MEMAllocator* allocator, EditBuffer* editBuffer);
@@ -371,9 +270,6 @@ namespace textinput {
virtual nw4r::math::VEC2 getScale() const;
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
void updateRepeatInput(u32 trig, u32 hold);
#endif
virtual void updateInputCommon(int chan, u32 trig, u32 hold, u32 release, void* data);
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data);
virtual bool updateInput(textinput::input::HKBManager& hkbManager);
@@ -384,38 +280,27 @@ namespace textinput {
virtual void setRootPaneScaleFor16x9();
virtual void setRootPaneScaleFor4x3();
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
virtual void onSE(sound::SE seId);
#endif
virtual void visibleSeparator(bool flag);
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
protected:
const void* mpLayoutData;
const void* mpLanguageData;
const char* mpFontName;
bool mbUpVisible;
bool mbDownVisible;
bool mbRepeat;
nw4rmanager::TiEventHandler* mpInputEventHandler;
nw4r::ut::ResFont mFont;
int mUpRepeat;
int mDownRepeat;
int mLeftRepeat;
int mRightRepeat;
int mDeleteRepeat;
int mConfirmRepeat;
u32 mRepeatButtons;
#else
private:
#ifdef MYTIMANAGER_IMPLEMENTATION
u8 unk_0x2C0[0x48];
#else
u8 unk_0x2C0[0x4C];
#endif
#endif
u8 unk_0x2C0[0x0C];
bool mbAbleToUp; // 0x2CC
bool mbAbleToDown; // 0x2CD
bool mbSeparator; // 0x2CE
u8 unk_0x2CF;
nw4rmanager::TiEventHandler* mpInputEventHandler; // 0x2D0
u8 unk_0x2D4[0x34];
};
#ifdef TI_INPUTFORM_SAMPLE_CLASS
class Sample : public LayoutByNW4R {
public:
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* arcName,
EventObserver* observer, const char* subName)
: LayoutByNW4R(manager, resAccessor, arcName, observer, subName) {}
virtual ~Sample();
};
#endif
}
typedef inputform::LayoutByNW4R InputForm;
typedef inputform::Base InputFormBase;

View File

@@ -8,50 +8,16 @@ namespace textinput {
class KeyboardBase : public CommandSender {
public:
#ifdef TIMANAGER_IMPLEMENTATION
KeyboardBase() : meLanguage(JP) {}
#endif
virtual ~KeyboardBase() {}
#if !(defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION)) && !defined(TIMANAGER_IMPLEMENTATION) && !defined(TISIGNWINDOW_IMPLEMENTATION)
virtual void create(MEMAllocator* alloc) override;
virtual void init() override;
#ifndef TI_CELLPHONE_MATCH_LAYOUT
virtual void setCommandReceiver(CommandReceiver* receiver) override;
virtual void sendCommand(u32 command, void*) override;
#endif
#endif
#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(TIHWKEYBOARD_IMPLEMENTATION)) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
virtual void onKey(u32, void*);
#else
virtual void onKey(u32);
#endif
#ifdef TI_CELLPHONE_IMPLEMENTATION
virtual u32 getType();
#elif (defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION)) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
virtual int getType();
#else
virtual void getType();
#endif
#ifdef TI_CELLPHONE_IMPLEMENTATION
virtual void setLanguage(Language language) { meLanguage = language; }
#else
virtual void setLanguage(Language language);
#endif
#if (defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIHWKEYBOARD_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;
virtual void update();
#endif
virtual void onActive();
protected:

View File

@@ -19,13 +19,12 @@ namespace textinput {
bool isHoldingShift() const {
return isHWPressedShift() || isPressedShiftB();
}
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
u8 isCapsLock() const { return mbCpasLock; }
void setPressedShiftB(bool pressed) { mbPressedShiftB = pressed; }
#endif
u8 isHWPressedShift() const { return mbPressedShift; }
u8 isPressedShiftB() const { return mbPressedShiftB; }
void setHWPressedShift(const u8& arg) { mbPressedShift = arg; }
void setHWPressedShift(u8 arg) { mbPressedShift = arg; }
void setPressedShiftB(u8 arg) { mbPressedShiftB = arg; }
void clearPressedShift() { mbPressedShift = 0; mbPressedShiftB = 0; }
class Singleton {
public:

View File

@@ -9,6 +9,8 @@
#include "tiToolBar.h"
#include "tiPcKeyboard.h"
#include "tiCellPhone.h"
#include "tiPredictLang.h"
#include "tiSignWindow.h"
#include <nw4r/lyt/pane.h>
#include <nw4r/lyt/arcResourceAccessor.h>
@@ -23,25 +25,16 @@
namespace textinput {
class EventObserver {
public:
virtual void onInput(CommandReceiver::INPUT_COMMAND command, void* data) {} // 0x08
virtual void onCommand(CommandReceiver::INPUT_COMMAND command, void* data) {} // 0x0C
virtual void onEvent(nw4r::lyt::Pane* pane, u32 event) {} // 0x10
virtual void onInput(CommandReceiver::INPUT_COMMAND command, void* data); // 0x08
virtual void onCommand(CommandReceiver::INPUT_COMMAND command, void* data); // 0x0C
virtual void onEvent(nw4r::lyt::Pane* pane, u32 event); // 0x10
virtual void onSE(sound::SE seId) {}
#ifdef TIMANAGER_IMPLEMENTATION
virtual void onOK();
virtual void onCancel();
virtual void onOutOfLength();
#else
virtual void onOK() { printf("OK!\n"); }
virtual void onCancel() { printf("Cancel!\n"); }
virtual void onOutOfLength() { printf("OutOfLength\n"); }
#endif
virtual void onSE(sound::SE seId);
virtual void onOK();
virtual void onCancel();
virtual void onOutOfLength();
};
#ifdef TIMANAGER_IMPLEMENTATION
namespace predictlang { class LayoutByNW4R; }
#endif
class Manager : public Base {
public:
Manager(MEMAllocator* allocator, nw4r::lyt::MultiArcResourceAccessor* multiArc, textinput::EventObserver* event);
@@ -64,10 +57,7 @@ namespace textinput {
virtual void setWCString(const wchar_t* string);
virtual void setLanguage(Language language);
virtual Language getLanguage() const { return meLanguage; }
#ifdef MYTIMANAGER_IMPLEMENTATION
Language getLanguageForMemo() const { return meLanguage; }
#endif
virtual Language getLanguage() const;
virtual void setDestination(Destination destination);
@@ -78,74 +68,49 @@ 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); }
#if defined(IPL_ADDRESS_EDIT_CPP) || defined(TIMANAGER_IMPLEMENTATION)
void enableKSXFilter(bool compatibleFilter);
#endif
virtual void setDefaultPredictionJP(int num, const char** predicts);
virtual void setFixedPredictionJP(int num, const char** predicts);
#ifdef TIMANAGER_IMPLEMENTATION
virtual void setTitleText(wchar_t* titleText);
void initAspect();
#else
virtual void setTitleText(const wchar_t* titleText);
#endif
virtual void setTitleText(wchar_t* titleText);
virtual void start() {}
virtual void end() {}
void setTitleText(const wchar_t* titleText) {
nw4r::lyt::Pane* pane = mpInputForm->getPane("T_title_text");
nw4r::lyt::TextBox* textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(pane);
if (textBox != NULL) {
textBox->SetString(titleText, 0);
}
}
virtual void start();
virtual void end();
#ifdef TIHWKEYBOARD_IMPLEMENTATION
EventObserver* getEventObserverForHardware() const { return mpEventObserver; }
#endif
virtual InputForm* getInputForm() { return mpInputForm; }
virtual const InputForm* getInputForm() const { return mpInputForm; }
virtual const InputForm* getInputForm() const;
virtual keyboard::hwkey::HWKeyboard* getHWKeyboard() { return mpHWKeyboard; }
virtual const keyboard::hwkey::HWKeyboard* getHWKeyboard() const { return mpHWKeyboard; }
virtual const keyboard::hwkey::HWKeyboard* getHWKeyboard() const;
virtual keyboard::pctype::LayoutByNW4R* getPCKeyboard() { return mpPCKeyboard; }
virtual const keyboard::pctype::LayoutByNW4R* getPCKeyboard() const { return mpPCKeyboard; }
virtual keyboard::pctype::LayoutByNW4R* getPCKeyboard();
virtual const keyboard::pctype::LayoutByNW4R* getPCKeyboard() const;
virtual keyboard::cellphonetype::LayoutByNW4R* getCellPhoneKeyboard() { return mpCellPhoneKeyboard; }
virtual const keyboard::cellphonetype::LayoutByNW4R* getCellPhoneKeyboard() const { return mpCellPhoneKeyboard; }
virtual const keyboard::cellphonetype::LayoutByNW4R* getCellPhoneKeyboard() const;
virtual void* getSignKeyboard() { return mpSignWindow; }
virtual const void* getSignKeyboard() const { return mpSignWindow; }
virtual void* getSignKeyboard();
virtual const void* getSignKeyboard() const;
virtual candidatebox::LayoutByNW4R* getCandidateBox() { return mpCandidateBox; }
virtual candidatebox::LayoutByNW4R* getCandidateBox();
virtual const candidatebox::LayoutByNW4R* getCandidateBox() const { return mpCandidateBox; }
virtual toolbar::LayoutByNW4R* getToolBar() { return mpToolBar; }
virtual const toolbar::LayoutByNW4R* getToolBar() const { return mpToolBar; }
virtual toolbar::LayoutByNW4R* getToolBar();
virtual const toolbar::LayoutByNW4R* getToolBar() const;
virtual void* getPredictLanguageSelectDialog() { return mpPredictLanguageDialog; }
virtual const void* getPredictLanguageSelectDialog() const { return mpPredictLanguageDialog; }
virtual void* getPredictLanguageSelectDialog();
virtual const void* getPredictLanguageSelectDialog() const;
EventObserver* getEventObserver() { return mpEventObserver; }
virtual inputform::EditBuffer* createEditBuffer();
virtual keyboard::hwkey::HWKeyboard* createHWKeyboard();
@@ -161,14 +126,17 @@ namespace textinput {
virtual void setLayoutScaleFor4x3();
void enableCompatibleFilter(bool compatibleFilter);
void enableKSXFilter(bool flag);
void startPredictTurnOn(bool flag);
bool isPredictTurning() const;
bool isVacancy() const;
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
bool isPredictTurning() const;
void startPredictTurnOn(bool enabled);
#endif
private:
protected:
void initAspect();
protected:
MEMAllocator* mpAllocator; // 0x04
nw4r::lyt::MultiArcResourceAccessor* mpMultiArcResourceAccessor; // 0x08
@@ -180,14 +148,9 @@ namespace textinput {
InputForm* mpInputForm; // 0x1C
candidatebox::LayoutByNW4R* mpCandidateBox; // 0x20
toolbar::LayoutByNW4R* mpToolBar; // 0x24
#ifdef TIMANAGER_IMPLEMENTATION
predictlang::LayoutByNW4R* mpPredictLanguageDialog;
keyboard::signwindow::LayoutByNW4R* mpSignWindow;
#else
void* mpPredictLanguageDialog; // 0x28
void* mpSignWindow; // 0x2C
predictlang::LayoutByNW4R* mpPredictLanguageDialog; // 0x28
keyboard::signwindow::LayoutByNW4R* mpSignWindow; // 0x2C
#endif
EventObserver* mpEventObserver; // 0x30
Destination meDestination; // 0x34

View File

@@ -14,29 +14,20 @@ namespace textinput {
class TiEventHandler : public gui::EventHandler {
public:
typedef struct Input {
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
u32 controller;
f32 x;
f32 y;
u32 trigger;
u32 hold;
u32 release;
u8 remaining[8];
#else
// todo
u32 field_0x00; // 0x00
u8 dummy[8];
u32 field_0x0C; // 0x0C
u32 field_0x10; // 0x10
u8 dummy2[12];
#endif
u32 field_0x00; // 0x00 chan
f32 mfX; // 0x04
f32 mfY; // 0x08
u32 field_0x0C; // 0x0C trigger
u32 field_0x10; // 0x10 hold
u32 field_0x14; // 0x14 release
u8 dummy[8]; // 0x18
} Input;
virtual void onEvent(gui::GUIComponent& comp, u32 event, void* data); // 0x0C
virtual void onTiEvent(gui::PaneComponent* paneComponent, u32 event, Input* input) = 0; // 0x18
virtual void setEventObserver(EventObserver *event) { mpEventObserver = event; } // 0x1C
virtual void setEventObserver(EventObserver *event); // 0x1C
protected:
EventObserver* mpEventObserver; // 0x08
@@ -90,35 +81,21 @@ namespace textinput {
PE_5,
PE_6,
PE_7,
PE_8,
PE_9,
PE_10,
PE_11,
PE_Last,
} AnmPaneEvent;
virtual void init() {} // 0x08
virtual void calc(); // 0x0C
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual void onAnmEvent(AnmPaneEvent) {}
#else
virtual void onAnmEvent(AnmPaneEvent paneEvent);
#endif // 0x10
virtual void onAnmEvent(AnmPaneEvent paneEvent); // 0x10
virtual void changeAnimation(u32 id); // 0x14
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual bool isInAnimation() { return mpCurrentAnim != NULL; }
#else
virtual bool isInAnimation();
#endif // 0x18
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual Anim* searchAnimation(u32 id) {
for (Anim* animation = static_cast<Anim*>(nw4r::ut::List_GetNext(&mAnms, NULL)); animation != NULL;
animation = static_cast<Anim*>(nw4r::ut::List_GetNext(&mAnms, animation))) {
if (animation->muID == id) return animation;
}
return NULL;
}
#else
virtual Anim* searchAnimation(u32 id);
#endif // 0x1C
virtual bool isInAnimation(); // 0x18
virtual Anim* searchAnimation(u32 id); // 0x1C
virtual ~AnmPane(); // 0x20
@@ -156,11 +133,11 @@ namespace textinput {
class AnimPaneGroup {
public:
#ifdef MYTIINPUTFORM_IMPLEMENTATION
AnimPaneGroup() {}
AnimPaneGroup(nw4r::lyt::Group* group) : mpGroup(group) {
nw4r::ut::List_Init(&mAnmPaneList, offsetof(AnmPane, mGroupLink));
}
#endif
virtual void create() {} // 0x08
virtual void init() {} // 0x0C
@@ -214,11 +191,7 @@ namespace textinput {
virtual nw4r::lyt::Pane* get(int i) { return mpaFifo[i]; } // 0x10
virtual nw4r::lyt::Pane* getLast() { // 0x14
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
for (int i = MAX_COUNT-1; i > -1; i--) {
#else
for (int i = MAX_COUNT-1; i > -1; i++) {
#endif
if (mpaFifo[i] != NULL) {
return mpaFifo[i];
}
@@ -247,14 +220,14 @@ namespace textinput {
virtual bool updateInput(int point, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data); // 0x20
virtual bool updateInput(input::HKBManager& hkbManager); // 0x24
virtual TiLayout* getLayout() { return mpLayout; } // 0x28
virtual TiLayout* getLayout(); // 0x28
virtual nw4r::lyt::Pane* getPane(const char* paneName); // 0x2C
virtual const nw4r::lyt::Pane* getPane(const char* paneName) const; // 0x30
virtual u32 getFlightDuration(int point, const char* paneName); // 0x34
virtual void setAnimOn(bool flag) { mbAnimOn = flag; } // 0x38
virtual void setAnimOn(bool flag); // 0x38
virtual void drawPane(const char* paneName); // 0x3C
@@ -263,16 +236,8 @@ namespace textinput {
virtual void setProjectionMtx(); // 0x48
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual void setPaneLastDrawReceived(nw4r::lyt::Pane* pane) { mAnmPaneFifo.push(pane); }
#else
virtual void setPaneLastDrawReceived(nw4r::lyt::Pane* paneLastDraw);
#endif // 0x4C
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual void initPaneLastDrawReceived() { mAnmPaneFifo.init(); }
#else
virtual void initPaneLastDrawReceived();
#endif // 0x50
virtual void setPaneLastDrawReceived(nw4r::lyt::Pane* paneLastDraw); // 0x4C
virtual void initPaneLastDrawReceived(); // 0x50
virtual void setVisible(const char* paneName, bool flag); // 0x54
virtual bool isVisible(const char* paneName, bool* result) const; // 0x58
@@ -282,8 +247,8 @@ namespace textinput {
virtual AnmPane* searchAnmPane(const char* paneName); // 0x60
virtual AnmPane* searchAnmPane(wchar_t ch); // 0x64
virtual nw4r::ut::List& getAnmPaneList() { return mAnmPanes; } // 0x68
virtual gui::PaneManager* getPaneManager() { return mpPaneManager; } // 0x6C
virtual nw4r::ut::List& getAnmPaneList(); // 0x68
virtual gui::PaneManager* getPaneManager(); // 0x6C
virtual void AdjustPaneMtx(Mtx& mtx, const nw4r::lyt::DrawInfo& drawInfo, const nw4r::math::MTX34& mGlobalMtx); // 0x70

View File

@@ -1,210 +1,340 @@
#ifndef TEXTINPUT_PC_KEYBOARD_H
#define TEXTINPUT_PC_KEYBOARD_H
#if (defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION)) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
#include "tiPcKeyboardImpl.h"
#else
#include "tiNw4rManager.h"
#include "tiTextInputBase.h"
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION)
#include "tiKeyboard.h"
#endif
#include "tiNw4rManager.h"
#include "tiGUIManager.h"
namespace textinput {
class Manager;
namespace predictlang {
class LayoutByNW4R;
}
namespace keyboard {
namespace signwindow {
class LayoutByNW4R;
}
namespace pctype {
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION)
class UIObj {
class LayoutByNW4R;
class AnmPane;
class UIObj : public gui::EventHandler {
public:
class Listener {
public:
virtual void onEvent(UIObj*, u32, void*);
virtual void onEvent(UIObj* uiObj, u32, void*) = 0; // 0x08
};
UIObj(u32 ctrlNo, LayoutByNW4R* layout, Listener* listener) : mCtrlNo(ctrlNo), mpLayout(layout) {
mpListener = listener;
}
virtual ~UIObj(); // 0x08
virtual void onEvent(gui::GUIComponent& comp, u32 event, void* data); // 0x0C
virtual void onGUIEvent(gui::PaneComponent& pane, u32 event, nw4rmanager::TiEventHandler::Input* input); // 0x18
protected:
u32 mCtrlNo; // 0x08
LayoutByNW4R* mpLayout; // 0x0C
Listener* mpListener; // 0x10
};
#endif
// TODO
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION)
class Base : public textinput::keyboard::KeyboardBase {
#else
class Base : public CommandSender {
#endif
class UIModifierButton : public UIObj {
friend class LayoutByNW4R;
public:
enum TranslateMode {
UIModifierButton(u32 ctrlNo, LayoutByNW4R* layout, Listener* listener);
virtual ~UIModifierButton();
virtual void onGUIEvent(gui::PaneComponent& pane, u32 event, nw4rmanager::TiEventHandler::Input* input);
private:
gui::PaneComponent* mpPaneComp1; // 0x14
gui::PaneComponent* mpPaneComp2; // 0x18
nw4rmanager::AnmPane* mpAnmPane; // 0x1C
u8 mbFocused; // 0x20
};
class UIModePanel : public UIObj {
friend class LayoutByNW4R;
public:
UIModePanel(u32 ctrlNo, LayoutByNW4R* layout, Listener* listener);
virtual ~UIModePanel();
virtual void onGUIEvent(gui::PaneComponent& pane, u32 event, nw4rmanager::TiEventHandler::Input* input);
void Create(nw4rmanager::Layout* layout);
private:
u32 unk_0x14; // 0x14
gui::PaneComponent* mpComps1[5]; // 0x18
gui::PaneComponent* mpComps2[5]; // 0x2C
nw4rmanager::AnmPane* mpAnmPanes[5]; // 0x40
nw4r::lyt::Pane* mExtraPanes[3]; // 0x54
GXTexObj mTexObjs[4]; // 0x60
};
class AnmPane : public nw4rmanager::AnmPane {
public:
AnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
: nw4rmanager::AnmPane(pane, observer) {
mState = 0;
}
virtual void init(); // 0x08
virtual void changeAnimation(u32 id); // 0x14
virtual ~AnmPane(); // 0x20
virtual u32 getState() const { return mState; } // 0x24
virtual u32 getKeyType() const { return mKeyType; } // 0x28
protected:
s32 mState; // 0x2C
u32 mKeyType; // 0x30
};
class NormalButtonAnmPane : public AnmPane {
public:
NormalButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) {
mKeyType = 0;
}
virtual void onAnmEvent(AnmPaneEvent paneEvent); // 0x10
virtual ~NormalButtonAnmPane();
};
class ShiftCapsAnmPane : public AnmPane {
public:
ShiftCapsAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) {
mKeyType = 1;
mbFocused = false;
}
virtual void onAnmEvent(AnmPaneEvent paneEvent); // 0x10
virtual ~ShiftCapsAnmPane();
virtual bool isFocused() const; // 0x2C
private:
u8 mbFocused; // 0x34
};
class ToggleButtonAnmPane : public AnmPane {
public:
ToggleButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) {
mKeyType = 2;
}
virtual void onAnmEvent(AnmPaneEvent paneEvent); // 0x10
virtual ~ToggleButtonAnmPane();
};
class OnOffButtonAnmPane : public AnmPane {
public:
OnOffButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) {
mKeyType = 3;
}
virtual void onAnmEvent(AnmPaneEvent paneEvent); // 0x10
virtual ~OnOffButtonAnmPane();
};
class EventHandler : public nw4rmanager::TiEventHandler {
public:
EventHandler(LayoutByNW4R* layout) : mpLayout(layout) {}
virtual ~EventHandler(); // 0x08
virtual void onTiEvent(gui::PaneComponent* paneComponent, u32 event, TiEventHandler::Input* input); // 0x18
private:
LayoutByNW4R* mpLayout; // 0x0C
};
class Base : public KeyboardBase {
public:
typedef enum TranslateMode {
TM_00,
#ifdef TIINPUTFORM_IMPLEMENTATION
TM_Kana,
TM_Roman,
#endif
};
TM_01,
TM_02,
TM_03,
} TranslateMode;
enum InputType {
IT_00,
IT_01,
IT_02,
IT_03,
IT_04,
};
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION)
enum InputMode {
typedef enum InputMode {
IM_00,
IM_01,
IM_02,
IM_03,
IM_04,
IM_05,
IM_06,
IM_07,
IM_08,
} InputMode;
typedef enum InputType {
IT_00,
IT_01,
IT_02,
IT_03,
IT_04,
} InputType;
struct KeyState {
#ifdef TI_PCTYPE_SAMPLE_CLASS
KeyState() : mFlags(0), mIsABC(0), mAIUFlags(0), mLanguage((Language)1) {}
#endif
void refresh_();
void refreshText(nw4r::lyt::Pane* pane);
void setABCFlag(u32 flag);
wchar_t getWCCode(u32 keyType);
wchar_t getWCCode(char* out);
u32 mFlags; // 0x00
u32 mIsABC; // 0x04
u32 mAIUFlags; // 0x08
Language mLanguage; // 0x0C
const void* mpLanguageDep; // 0x10
Base* mpBase; // 0x14
};
#ifdef TI_PCTYPE_SAMPLE_CLASS
Base(Manager* manager) {
mKeyState.mpLanguageDep = NULL;
mKeyState.mpBase = this;
mpAllocator = NULL;
mbOnlyQwerty = false;
mpManager = manager;
}
#endif
virtual ~Base();
virtual void create(MEMAllocator* allocator) override; // 0x0C
virtual void init() override; // 0x10
virtual void updateFromReceiver(u32, void*) override; // 0x1C
virtual void onKey(u32, void*); // 0x20
virtual int getType(); // 0x24
virtual void setLanguage(Language language) override; // 0x28
virtual void onActive() override; // 0x34
virtual void inputCharCode(wchar_t wc); // 0x38
virtual void* getState(); // 0x3C
virtual bool isShiftOn() const; // 0x40
virtual bool isCapsOn() const; // 0x44
virtual bool isABC(); // 0x48
virtual void setABC(bool); // 0x4C
virtual int getABCInputMode() const; // 0x50
virtual int getAIUInputMode() const; // 0x54
virtual TranslateMode getTranslateMode() const; // 0x58
virtual void setTranslateMode(TranslateMode mode); // 0x5C
virtual void onlyQwerty(bool); // 0x60
virtual void setLangKeyActive(bool); // 0x64
virtual void setInputModeJP(bool, u32, u32); // 0x68
virtual void setInputModeCK(u32); // 0x6C
virtual void refreshState(); // 0x70
virtual void changeABCInputMode(InputMode mode); // 0x74
virtual void changeAIUInputMode(InputMode mode); // 0x78
virtual void onClose(); // 0x7C
virtual wchar_t getWCCode(char* out); // 0x80
virtual u32 getControlKey(char* out); // 0x84
virtual void sendInputWChar(wchar_t wc, bool flag); // 0x88
virtual void goSignInputMode(); // 0x8C
virtual void changePredictLanguage(); // 0x90
virtual void updateFixMode(); // 0x94
protected:
Manager* mgr() { return mpManager; }
public:
u8 unk_0x14; // 0x14
u8 unk_0x15[3]; // 0x15
u32 unk_0x18; // 0x18
const void* mpLanguageDep; // 0x1C
KeyState mKeyState; // 0x20
MEMAllocator* mpAllocator; // 0x38
u8 mbOnlyQwerty; // 0x3C
u8 mbLangKeyActive; // 0x3D
u8 unk_0x3E[2]; // 0x3E
Manager* mpManager; // 0x40
};
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public UIObj::Listener {
public:
#ifdef TI_PCTYPE_SAMPLE_CLASS
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* arcName, EventObserver* observer)
: Base(manager), nw4rmanager::Layout(resAccessor, arcName, observer), mpEventHandler(NULL),
mShiftButton(1, this, this), mCapsButton(0, this, this), mModePanel(2, this, this) {}
#endif
virtual ~LayoutByNW4R();
virtual void create(MEMAllocator* allocator) override;
virtual void init() override;
virtual void updateFromReceiver(u32, void*) override;
virtual void onKey(u32, void*) override;
#ifdef TI_CELLPHONE_IMPLEMENTATION
virtual u32 getType() override;
#else
virtual void getType() override;
#endif
virtual void setLanguage(Language) override;
virtual void setLanguage(Language 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();
virtual void setCommandReceiver(textinput::CommandReceiver*);
virtual void updateFromReceiver(u32, void*);
virtual void onKey();
virtual void getType();
virtual void setLanguage();
virtual void getLanguage();
virtual void update();
virtual void onActive();
virtual void inputCharCode();
virtual void getState();
virtual void isShiftOn();
virtual void isCapsOn();
virtual void isABC();
virtual void setABC();
virtual void getABCInputMode();
virtual void getAIUInputMode();
virtual TranslateMode getTranslateMode();
virtual void setTranslateMode(TranslateMode);
virtual void onlyQwerty();
virtual void setLangKeyActive(bool);
virtual void setInputModeJP();
virtual void setInputModeCK();
virtual void refreshState();
virtual void changeABCInputMode();
virtual void changeAIUInputMode();
virtual void onClose();
virtual void getWCCode();
virtual void getControlKey();
virtual void sendInputWChar();
virtual void goSignInputMode();
virtual void changePredictLanguage();
virtual void updateFixMode();
#endif
virtual void inputCharCode(wchar_t wc) override;
virtual void setABC(bool) override;
virtual void setTranslateMode(TranslateMode mode) override;
virtual void onlyQwerty(bool) override;
virtual void setLangKeyActive(bool) override;
virtual void setInputModeJP(bool, u32, u32) override;
virtual void setInputModeCK(u32) override;
virtual void refreshState() override;
virtual void onClose() override;
virtual void sendInputWChar(wchar_t wc, bool flag) override;
virtual void goSignInputMode() override;
virtual void changePredictLanguage() override;
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION)
private:
u8 mKeyboardInputFlags[8];
const void* mpKeyStateTable;
u32 mTranslateMode;
u32 mABCInputMode;
u32 mAIUInputMode;
u32 mCurrentInputType;
u32 mInputState;
const void* mpLanguageData;
#ifdef TIINPUTFORM_IMPLEMENTATION
MEMAllocator* mpAllocator;
#endif
bool mbOnlyQwerty;
bool mbLanguageKeyActive;
u16 mKeyboardFlags;
void* mpInputSettings;
void* mpCurrentKeyState;
virtual void draw(); // 0x11C
virtual void calc(); // 0x120
virtual void setPredictLanguageDialog(predictlang::LayoutByNW4R* dialog); // 0x124
virtual void setSignWindow(signwindow::LayoutByNW4R* window); // 0x128
virtual void setLineFeedButton(bool); // 0x12C
virtual void setPredictLanguageButton(bool); // 0x130
virtual void setSignWindowButton(bool); // 0x134
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data); // 0x138
virtual bool updateInput(textinput::input::HKBManager& hkbManager); // 0x13C
virtual void changeAnimationAllToNormal(); // 0x140
virtual void throwReleaseForAll(); // 0x144
virtual void cancelStateFocusIn(); // 0x148
virtual void updatePredictLanguage(CommandReceiver::ChangePredictMode* mode); // 0x14C
virtual void updateDakuten(); // 0x150
virtual void initLayout(); // 0x154
virtual void onEvent(UIObj* uiObj, u32, void*); // 0x158
public:
#ifdef TIINPUTFORM_IMPLEMENTATION
bool isQwertyOnly() const { return mbOnlyQwerty; }
bool isLanguageKeyActive() const { return mbLanguageKeyActive; }
#endif
u32 getTranslateModeForMemo() const { return mTranslateMode; }
u32 getABCInputModeForMemo() const { return mABCInputMode; }
u32 getAIUInputModeForMemo() const { return mAIUInputMode; }
#endif
};
// TODO
class LayoutByNW4R : public Base, public nw4rmanager::Layout
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION)
, public UIObj::Listener
#endif
{
public:
// TODO - ...
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_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 createAnmPane_(MEMAllocator* allocator);
void onPressedCaps();
void onPressedShift(bool);
void onReleasedShift();
#ifdef TIINPUTFORM_IMPLEMENTATION
bool hasLineFeedButton() const { return mbLineFeedButton; }
private:
void* mpPredictLanguageDialog;
void* mpSignWindow;
bool mbLineFeedButton;
public:
#endif
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_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
EventHandler* mpEventHandler; // 0xF0
predictlang::LayoutByNW4R* mpPredictLanguageDialog; // 0xF4
signwindow::LayoutByNW4R* mpSignWindow; // 0xF8
bool mbLineFeed; // 0xFC
u8 unk_0xFD[3]; // 0xFD
UIModifierButton mShiftButton; // 0x100
UIModifierButton mCapsButton; // 0x124
UIModePanel mModePanel; // 0x148
};
#ifdef TI_PCTYPE_SAMPLE_CLASS
class Sample : public LayoutByNW4R {
public:
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* arcName, EventObserver* observer)
: LayoutByNW4R(manager, resAccessor, arcName, observer) {}
virtual ~Sample();
};
#else
class Sample {};
#endif
} // namespace pctype
} // namespace keyboard
} // namespace textinput
#endif
#endif // TEXTINPUT_HW_KEYBOARD_H
#endif // TEXTINPUT_PC_KEYBOARD_H

View File

@@ -14,17 +14,13 @@ namespace textinput {
class Base : public CommandSender {
public:
#if defined(TI_PREDICTLANG_SAMPLE_CLASS) || defined(TIMANAGER_IMPLEMENTATION)
#ifdef TI_PREDICTLANG_SAMPLE_CLASS
Base(Manager* manager) : mePredictMode(inputform::Base::PM_USEn), mpAllocator(NULL), mpManager(manager) {}
#endif
#ifdef TIMANAGER_IMPLEMENTATION
virtual ~Base();
virtual void init();
virtual void create(MEMAllocator* allocator) override;
#else
virtual ~Base() {}
virtual void create(MEMAllocator* allocator) override { mpAllocator = allocator; }
#endif
virtual void init();
virtual void setPredictMode(inputform::Base::PredictMode mode) { mePredictMode = mode; }
protected:
@@ -38,20 +34,16 @@ namespace textinput {
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public nw4rmanager::AnmObserver {
public:
#ifdef TIMANAGER_IMPLEMENTATION
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, EventObserver* observer, const char* layoutName)
: Base(manager), nw4rmanager::Layout(resAccessor, layoutName, observer), mbActive(false), mbInput(false),
mpEventHandler(NULL), meDestination(DST_US), mpCaller(NULL) {}
#elif defined(TI_PREDICTLANG_SAMPLE_CLASS)
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, EventObserver* observer)
: Base(manager), nw4rmanager::Layout(resAccessor, "fs_prdicSelWidw_a.brlyt", observer), mbActive(false), mbInput(false),
#ifdef TI_PREDICTLANG_SAMPLE_CLASS
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* arcName, EventObserver* observer)
: Base(manager), nw4rmanager::Layout(resAccessor, arcName, observer), mbActive(false), mbInput(false),
mpEventHandler(NULL), meDestination(DST_US), mpCaller(NULL) {}
#endif
virtual ~LayoutByNW4R();
virtual void create(MEMAllocator* allocator) override;
virtual void init() override;
virtual void draw() override;
virtual void init() override;
virtual void open(inputform::Base::PredictMode predictMode, keyboard::KeyboardBase* keyboard);
virtual void endToOpen();
@@ -78,21 +70,12 @@ namespace textinput {
keyboard::KeyboardBase* mpCaller; // 0xD4
};
#if defined(TI_PREDICTLANG_SAMPLE_CLASS) || defined(TIMANAGER_IMPLEMENTATION)
#ifdef TI_PREDICTLANG_SAMPLE_CLASS
class Sample : public LayoutByNW4R {
public:
#ifdef TIMANAGER_IMPLEMENTATION
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, EventObserver* observer, const char* layoutName)
: LayoutByNW4R(manager, resAccessor, observer, layoutName) {}
#else
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, EventObserver* observer)
: LayoutByNW4R(manager, resAccessor, observer) {}
#endif
#ifdef TIMANAGER_IMPLEMENTATION
virtual ~Sample();
#else
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* arcName, EventObserver* observer)
: LayoutByNW4R(manager, resAccessor, arcName, observer) {}
virtual ~Sample() {}
#endif
};
#endif

View File

@@ -7,7 +7,13 @@ namespace textinput {
namespace extend {
namespace savedata {
typedef struct MemoSetting {
u8 uRevisionAndType; // 0x00
union {
u8 uRevisionAndType; // 0x00
struct {
u8 uType : 4; // 0x00:11110000
u8 uRevision : 4; // 0x00:00001111
};
};
union {
struct {

View File

@@ -3,132 +3,152 @@
#include "tiKeyboard.h"
#include "tiNw4rManager.h"
#include "tiTextInputBase.h"
#include "tiSwData.h"
namespace textinput {
class Manager;
namespace keyboard {
class Manager;
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;
};
}
}
}
namespace keyboard {
namespace signwindow {
struct LanguageDependency {
u8 count;
const PaneNameToCharCodeInSignMode* keys;
};
class Base : public KeyboardBase {
public:
#ifdef TI_SIGNWINDOW_SAMPLE_CLASS
Base(Manager* manager) : mpAllocator(NULL), mpManager(manager) {}
#endif
virtual ~Base();
virtual void create(MEMAllocator* allocator) override;
virtual void init() override;
virtual void onKey(u32, void*);
virtual int getType();
virtual void setLanguage(Language language) override;
virtual bool isLocked(); // 0x38
virtual void setPage(u8 page); // 0x3C
virtual u8 getPage(); // 0x40
virtual void movePrevSignPage(); // 0x44
virtual void moveNextSignPage(); // 0x48
virtual void close(); // 0x4C
protected:
u8 mInputFlags; // 0x14
bool mbLocked; // 0x15
bool mbRepeat; // 0x16
u8 muPage; // 0x17
const LanguageDependency* mpLanguageDependency; // 0x18
MEMAllocator* mpAllocator; // 0x1C
Manager* mpManager; // 0x20
};
class AnmPane;
class EventHandler;
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public nw4rmanager::AnmObserver {
public:
#ifdef TI_SIGNWINDOW_SAMPLE_CLASS
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* arcName, EventObserver* observer)
: Base(manager), nw4rmanager::Layout(resAccessor, arcName, observer), mbActive(false), mbInput(false),
mpEventHandler(NULL), mpKeyboard(NULL) {}
#endif
virtual ~LayoutByNW4R();
virtual void create(MEMAllocator* allocator) override;
virtual void init() override;
virtual void onKey(u32, void*) override;
virtual void movePrevSignPage() override; // 0x44
virtual void moveNextSignPage() override; // 0x48
virtual void close() override; // 0x4C
virtual void draw(); // 0xD4
virtual void open(KeyboardBase* keyboard, bool flag); // 0xD8
virtual bool isActive(); // 0xDC
virtual void onChangeAnmState(nw4rmanager::AnmObserver::AnmEvent anmEvent,
nw4rmanager::AnmPane* anmPane, nw4rmanager::Anim* anim); // 0xE0
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data); // 0xE4
virtual bool updateInput(textinput::input::HKBManager& hkbManager); // 0xE8
virtual void throwReleaseForAll(); // 0xEC
virtual void resetAnmSignWindow(); // 0xF0
virtual void setSignKeyTop(u16, u16); // 0xF4
virtual void setPageNumber(u16); // 0xF8
virtual void endToClose(); // 0xFC
virtual void startToInput(); // 0x100
virtual void movePrevSignWindow(); // 0x104
virtual void moveNextSignWindow(); // 0x108
private:
bool mbActive; // 0xD0
bool mbInput; // 0xD1
EventHandler* mpEventHandler; // 0xD4
KeyboardBase* mpKeyboard; // 0xD8
};
#ifdef TI_SIGNWINDOW_SAMPLE_CLASS
class Sample : public LayoutByNW4R {
public:
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* arcName, EventObserver* observer)
: LayoutByNW4R(manager, resAccessor, arcName, observer) {}
virtual ~Sample();
};
#else
class Sample {};
#endif
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;
};
} // namespace signwindow
} // namespace keyboard
} // namespace textinput
#endif // TEXTINPUT_SIGN_WINDOW_H

View File

@@ -3,9 +3,7 @@
#include <revolution/types.h>
#include <revolution/mem/allocator.h>
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
#include <revolution/kpr.h>
#endif
namespace textinput {
namespace tistring {
@@ -36,23 +34,15 @@ namespace textinput {
virtual void setLength(u16);
virtual wchar_t* getWCString() const { return mpszString; }
virtual wchar_t* getWCString() const;
virtual void setCandidate(wchar_t candidate) { mwcCandidate = candidate; }
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
virtual wchar_t getCandidate() const { return mwcCandidate; }
#else
virtual wchar_t getCandidate() { return mwcCandidate; }
#endif
virtual bool hasCandidate() const;
virtual wchar_t getLastWChar();
#if defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
protected:
#else
private:
#endif
u16 muMaxLength; // 0x04
u16 muLength; // 0x06
@@ -65,56 +55,41 @@ namespace textinput {
};
class KanaStream {
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
public:
KPRQueue mQueue;
wchar_t mPending;
wchar_t mOutput[5];
#else
private:
u8 field_0x00[0x24];
#endif
};
class Decolated : public StringBase {
public:
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
Decolated(u16 maxLen) : StringBase(maxLen), mCursorStart(0), mCursorEnd(0), mbSustain(false), mTranslateMode(0) { initKanaConverter(); }
#else
Decolated(u16 maxLen) : StringBase(maxLen), field_0x18(0), field_0x1C(0), field_0x20(0), field_0x24(0) { initKanaConverter(); }
#endif
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
virtual ~Decolated();
enum TranslateMode { TM_Direct, TM_Kana, TM_Roman, TM_Hangul };
Decolated(u16 maxLen) : StringBase(maxLen), mCursorStart(0), mCursorEnd(0), mbSustain(false), mTranslateMode(0) { initKanaConverter(); }
virtual ~Decolated();
virtual void clear();
virtual void set(const wchar_t* string);
virtual void setLength(u16 length);
void setTranslateMode(TranslateMode mode);
TranslateMode getTranslateMode() const { return static_cast<TranslateMode>(mTranslateMode); }
void inputString(const wchar_t* string, TranslateMode mode);
virtual void inputChar(wchar_t ch);
virtual void inputString(const wchar_t* string);
virtual void setLength(u16);
virtual void inputChar(wchar_t);
virtual void inputString(const wchar_t*);
virtual void deleteChar();
virtual void backSpace();
virtual void confirm(const wchar_t* string);
virtual void confirm(const wchar_t*);
virtual bool moveCursorRight();
virtual bool moveCursorLeft();
virtual void setCursorPos(u32 pos);
virtual void setCursorPos(u32);
virtual void onSustain();
virtual void offSustain();
virtual bool isOnSustain();
virtual u32 getCursorPos() const;
virtual void getCursorPos(u32* start, u32* end);
virtual void getCursorPos(u32*, u32*);
virtual bool canBackSpace();
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
virtual bool deleteForward();
#else
virtual void deleteForward();
#endif
virtual void getSelected(u32& start, u32& end);
virtual void getSelected(u32&, u32&);
virtual wchar_t getWCharAtCursor();
virtual void replaceAtCursor(wchar_t ch);
virtual void replaceAtCursor(wchar_t);
virtual bool isDakuten();
virtual void converDakuten();
virtual bool isHandaku();
@@ -124,123 +99,68 @@ namespace textinput {
virtual void converSmall();
virtual bool atTheBeginningOfASentence();
virtual void initKanaConverter();
virtual wchar_t* getKanaBuffer();
virtual void* getKanaBuffer();
virtual bool isKanaFix() const;
virtual void confirmKana();
virtual void clearKana();
virtual void EnableKSXFilter(bool enable);
#else
virtual void inputChar();
virtual void inputString();
virtual void deleteChar();
virtual void backSpace();
virtual void confirm();
virtual void moveCursorRight();
virtual void moveCursorLeft();
virtual void setCursorPos();
virtual void onSustain();
virtual void offSustain();
virtual void isOnSustain();
virtual void getCursorPos();
virtual void getCursorPos(u32*, u32*);
virtual void canBackSpace();
virtual void deleteForward();
virtual void getSelected();
virtual void getWCharAtCursor();
virtual void replaceAtCursor();
virtual void isDakuten();
virtual void converDakuten();
virtual void isHandaku();
virtual void converHandaku();
virtual void convertAll();
virtual void isSmall();
virtual void converSmall();
virtual bool atTheBeginningOfASentence();
virtual void initKanaConverter();
virtual void getKanaBuffer();
virtual void isKanaFix();
virtual void confirmKana();
virtual void clearKana();
virtual void EnableKSXFilter();
virtual void EnableKSXFilter(bool);
#endif
void setTranslateMode(TranslateMode mode);
TranslateMode getTranslateMode() const { return static_cast<TranslateMode>(mTranslateMode); }
void inputString(const wchar_t* string, TranslateMode mode);
#if defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
protected:
#else
private:
#endif
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
u32 mCursorStart;
u32 mCursorEnd;
#if defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
u8 mbSustain;
s32 mTranslateMode;
#else
bool mbSustain;
u32 mTranslateMode;
#endif
#else
u32 field_0x18; // 0x18
u32 field_0x1C; // 0x1C
u8 field_0x20; // 0x20
u32 field_0x24; // 0x24
#endif
u32 mCursorStart; // 0x18
u32 mCursorEnd; // 0x1C
u8 mbSustain; // 0x20
s32 mTranslateMode; // 0x24
KanaStream mKanaStream; // 0x28
};
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
class WithAtok : public Decolated {
public:
WithAtok(u16 maxLength) : Decolated(maxLength) {}
virtual ~WithAtok();
struct DrawInfo;
~WithAtok();
virtual void pushBack(wchar_t ch);
virtual void popBack();
virtual void inputChar(wchar_t ch);
virtual void inputChar(wchar_t);
virtual void backSpace();
virtual void confirm(const wchar_t* string);
virtual void confirm(const wchar_t*);
virtual bool moveCursorRight();
virtual bool moveCursorLeft();
virtual void getCursorPos(u32* start, u32* end);
struct DrawInfo {
const wchar_t* string;
u32 start;
u32 end;
u32 selectedStart;
u32 selectedEnd;
};
virtual void getCursorPos(u32*, u32*);
virtual bool isFix();
virtual void setFix(bool fix);
virtual void setFix(bool);
virtual void initConverting();
virtual bool isConverting();
virtual wchar_t* getConfirmedWCString() const;
virtual int getCurrentNumPredicted();
virtual void getPredicted(int index, wchar_t* string);
virtual void commitPredicted(int index);
virtual void setSelectedCandidate(s32 index);
virtual bool getPredicted(int, wchar_t*);
virtual void commitPredicted(int);
virtual void setSelectedCandidate(long);
virtual bool isCandidateSelected();
virtual s32 getSelectedCandidate();
virtual int getSelectedCandidate();
virtual void init();
virtual void setInputting(wchar_t ch);
virtual void getDrawString(DrawInfo& info);
virtual void openDictionary(void* atok, int atokSize, void* apot, int apotSize, void* nintendo, int nintendoSize);
virtual void setInputting(wchar_t);
virtual void getDrawString(DrawInfo&);
virtual void openDictionary(void*, int, void*, int, void*, int);
virtual void closeDictionary();
virtual bool hasConfirmedString();
virtual void enableConfirmedString(bool enable);
virtual void enableConfirmedString(bool);
virtual void startConverting();
virtual bool isDictionaryOpened();
virtual void changeKanaMode(bool kana);
virtual wchar_t getInputStringLength();
virtual void changeKanaMode(bool);
virtual int getInputStringLength();
virtual void resetRelation();
virtual void setFixMode(bool fixed);
virtual void setFixPrediction(int count, const char** predictions);
virtual void setDefaultPrediction(int count, const char** predictions);
virtual s16 getSelectedConverting();
virtual s32 getFixedPredictionNum();
virtual void setFixMode(bool);
virtual void setFixPrediction(int, const char* const*);
virtual void setDefaultPrediction(int, const char* const*);
virtual int getSelectedConverting();
virtual int getFixedPredictionNum();
};
#else
class WithAtok : public StringBase {};
#endif
}
}

View File

@@ -6,17 +6,10 @@
#include <nw4r/ut/CharWriter.h>
#include <nw4r/ut/Rect.h>
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TITEXTDRAWER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
#include <string.h>
#endif
namespace textinput {
namespace textdrawer {
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TITEXTDRAWER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
class Base : public nw4r::ut::CharWriter {
#else
class Base : nw4r::ut::CharWriter {
#endif
public:
typedef struct ViewPort {
f32 xOrig; // 0x00
@@ -34,23 +27,11 @@ namespace textinput {
} CursorPos;
typedef struct DrawInfo {
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TITEXTDRAWER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
nw4r::ut::Rect rect;
wchar_t character;
#else
u8 unk_0x00[32];
#endif
nw4r::ut::Rect rect; // 0x00
wchar_t character; // 0x10
u8 unk_0x12[6]; // 0x12
} DrawInfo;
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
Base() : mpDrawAllocator(NULL), mfViewX(0.0f), mfViewY(0.0f), mfViewWidth(0.0f), mfViewHeight(0.0f),
mfVIWidth(640.0f), mbAspect4x3(false), mbDrawClipped(false), muLine(0), mfLineSpacing(0.0f),
mfCharacterSpacing(0.0f), mfFontWidth(0.0f), mfFontHeight(0.0f), mfModifyStartY(0.0f), mfMinScrollY(0.0f),
muDrawStartPos(0), muDrawEndPos(65535), mbSecretMode(false), muDrawModifyStartLine(0), muDrawModifyEndLine(0),
muDrawModifyStartPos(0), muDrawModifyEndPos(0), muCachedStartPos(0), muCachedEndPos(0), mbDrawCache(false),
mfCachedCursorX(0.0f), mfCachedCursorY(0.0f), mfDrawScrollY(0.0f), muCachedCursorPosition(0),
mbCursorCache(false), mbMaintainCursorCache(true) { memset(&mCachedCursor, 0, sizeof(mCachedCursor)); }
#endif
virtual void create(MEMAllocator* allocator);
virtual void draw(CursorPos* cursorPos);
virtual void draw();
@@ -72,7 +53,7 @@ namespace textinput {
virtual nw4r::math::VEC2 getScale() const = 0;
virtual void setSecretModeOn(bool secretMode) { mbSecretMode = secretMode; }
virtual void setSecretModeOn(bool secretMode);
virtual void doBeforeDrawProcess(const wchar_t*, u32, const DrawInfo& drawInfo);
virtual void doAfterDrawProcess(const wchar_t*, u32, const DrawInfo& drawInfo);
@@ -94,116 +75,49 @@ namespace textinput {
virtual u32 getEndPos() const;
// todo
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TITEXTDRAWER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
virtual void setDrawModifyScopeLine(s32 startLine, s32 endLine);
virtual void setDrawCacheScopeLine(s32 startLine, s32 endLine);
virtual void modifyCursorCache(s32 line, u32 position, f32 x, f32 y, f32 width, f32 height);
#else
virtual void setDrawModifyScopeLine();
virtual void setDrawCacheScopeLine();
virtual void modifyCursorCache();
#endif
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TITEXTDRAWER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
virtual void setDrawModifyScopeLine(s32, s32);
virtual void setDrawCacheScopeLine(s32, s32);
virtual void modifyCursorCache(s32, u32, f32, f32, f32, f32);
virtual bool isEnableCursorCache() const;
#else
virtual void isEnableCursorCache();
#endif
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TITEXTDRAWER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
virtual u32 getDrawModifyStartLine() const;
virtual u32 getDrawModifyEndLine() const;
#else
virtual void getDrawModifyStartLine();
virtual void getDrawModifyEndLine();
#endif
virtual s32 getDrawModifyStartLine() const;
virtual s32 getDrawModifyEndLine() const;
virtual u32 getDrawCacheStartPos() const;
virtual void dirtyDrawCache();
virtual void dirtyCursorCache();
#ifdef TITEXTDRAWER_IMPLEMENTATION
protected:
const wchar_t* mpDrawString;
ViewPort mSavedViewport;
f32 mSavedProjection[7];
nw4r::ut::Rect mProjectionRect;
f32 mfVIWidth;
bool mbAspect4x3;
bool mbDrawClipped;
s32 muLine;
f32 mfLineSpacing;
f32 mfCharacterSpacing;
f32 mfFontWidth;
f32 mfFontHeight;
f32 mfModifyStartY;
f32 mfMinScrollY;
u32 muDrawStartPos;
u32 muDrawEndPos;
u32 muDrawCacheStartPos;
bool mbSecretMode;
s32 muDrawModifyStartLine;
s32 muDrawModifyEndLine;
s32 muDrawModifyStartPos;
s32 muDrawModifyEndPos;
u32 muCachedStartPos;
u32 muCachedEndPos;
bool mbDrawCache;
f32 mfCachedCursorX;
f32 mfCachedCursorY;
f32 mfDrawScrollY;
s32 mnCachedCursorLine;
CursorPos mCachedCursor;
bool mbCursorCache;
bool mbMaintainCursorCache;
#else
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TITEXTDRAWER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
protected:
MEMAllocator* mpDrawAllocator;
u8 mDrawConfiguration[0x34];
f32 mfViewX;
f32 mfViewY;
f32 mfViewWidth;
f32 mfViewHeight;
f32 mfVIWidth;
bool mbAspect4x3;
bool mbDrawClipped;
u32 muLine;
f32 mfLineSpacing;
f32 mfCharacterSpacing;
f32 mfFontWidth;
f32 mfFontHeight;
f32 mfModifyStartY;
f32 mfMinScrollY;
u32 muDrawStartPos;
u32 muDrawEndPos;
u32 muDrawCacheStartPos;
#else
private:
u8 unk_0x50[0x78];
#endif
bool mbSecretMode; // 0xC8
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TITEXTDRAWER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
u32 muDrawModifyStartLine;
u32 muDrawModifyEndLine;
u32 muDrawModifyStartPos;
u32 muDrawModifyEndPos;
u32 muCachedStartPos;
u32 muCachedEndPos;
bool mbDrawCache;
f32 mfCachedCursorX;
f32 mfCachedCursorY;
f32 mfDrawScrollY;
u32 muCachedCursorPosition;
CursorPos mCachedCursor;
bool mbCursorCache;
bool mbMaintainCursorCache;
#elif defined(MYTIINPUTFORM_IMPLEMENTATION)
protected:
u8 mDrawState[0x27];
f32 mfDrawScrollY;
u8 mDrawCacheState[0x14];
#else
u8 unk_0xCC[0x3C];
#endif
#endif
const wchar_t* mpDrawString; // 0x50
ViewPort mSavedViewport; // 0x54
f32 mSavedProjection[7]; // 0x6C
nw4r::ut::Rect mProjectionRect; // 0x88
f32 mfVIWidth; // 0x98
bool mbAspect4x3; // 0x9C
bool mbDrawClipped; // 0x9D
s32 muLine; // 0xA0
f32 mfLineSpacing; // 0xA4
f32 mfCharacterSpacing; // 0xA8
f32 mfFontWidth; // 0xAC
f32 mfFontHeight; // 0xB0
f32 mfModifyStartY; // 0xB4
f32 mfMinScrollY; // 0xB8
u32 muDrawStartPos; // 0xBC
u32 muDrawEndPos; // 0xC0
u32 muDrawCacheStartPos; // 0xC4
bool mbSecretMode; // 0xC8
s32 muDrawModifyStartLine; // 0xCC
s32 muDrawModifyEndLine; // 0xD0
s32 muDrawModifyStartPos; // 0xD4
s32 muDrawModifyEndPos; // 0xD8
u32 muCachedStartPos; // 0xDC
u32 muCachedEndPos; // 0xE0
bool mbDrawCache; // 0xE4
f32 mfCachedCursorX; // 0xE8
f32 mfCachedCursorY; // 0xEC
f32 mfDrawScrollY; // 0xF0
s32 mnCachedCursorLine; // 0xF4
CursorPos mCachedCursor; // 0xF8
bool mbCursorCache; // 0x104
bool mbMaintainCursorCache; // 0x105
};
}
}

View File

@@ -39,10 +39,6 @@ namespace textinput {
f32 y; // 0x08
} Scroll;
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
enum HVKCode { HVK_None = 0 };
#endif
class Base {
public :
virtual ~Base() {}
@@ -54,28 +50,23 @@ namespace textinput {
class CommandSender;
class CommandReceiver : public Base {
public:
#ifdef TI_CELLPHONE_IMPLEMENTATION
struct ChangePredictMode;
#endif
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
CommandReceiver() { clearSender(); }
virtual ~CommandReceiver();
#endif
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
struct Scroll {
bool absY;
f32 x;
f32 y;
};
#endif
typedef enum INPUT_COMMAND {
IC_TRANSLATE_MODE = 6,
INPUT_COMMAND_0 = 0,
INPUT_COMMAND_37 = 37,
} INPUT_COMMAND;
#if (defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION)) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
struct ChangePredictMode { u32 mode; bool enabled; };
#endif
typedef struct Scroll {
bool absY; // 0x00
f32 x; // 0x04
f32 y; // 0x08
} Scroll;
typedef struct ChangePredictMode {
u32 muLanguage; // 0x00
u8 mbPredictOn; // 0x04
} ChangePredictMode;
virtual void clearSender();
virtual void onCommand(INPUT_COMMAND command, void* data);
virtual void addSender(CommandSender* cmdSend);
@@ -89,13 +80,7 @@ namespace textinput {
CommandSender() : mpCommandReceiver(NULL) {}
virtual void setCommandReceiver(CommandReceiver* cmdRecv);
#if (defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION)) || defined(TIMANAGER_IMPLEMENTATION)
virtual void sendCommand(u32 command, void* data) {
if (mpCommandReceiver != NULL) mpCommandReceiver->onCommand(static_cast<CommandReceiver::INPUT_COMMAND>(command), data);
}
#else
virtual void sendCommand(u32, void*);
#endif
virtual void updateFromReceiver(u32, void*) {}
nw4r::ut::Link mLink; // 0x00

View File

@@ -10,7 +10,7 @@ namespace textinput {
namespace toolbar {
class Base {
public:
#if defined(TI_TOOLBAR_SAMPLE_CLASS) || defined(TIMANAGER_IMPLEMENTATION)
#ifdef TI_TOOLBAR_SAMPLE_CLASS
Base(Manager* manager) : mQwerty(true), meLanguage(USA), mpAllocator(NULL), mpManager(manager) {}
#endif
@@ -35,20 +35,16 @@ namespace textinput {
class LayoutByNW4R : public Base, public nw4rmanager::Layout {
public:
#ifdef TIMANAGER_IMPLEMENTATION
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, EventObserver* observer, const char* layoutName)
: Base(manager), nw4rmanager::Layout(resAccessor, layoutName, observer), mpEventHandler(NULL),
mbIsEnableQwertyChg(false) {}
#elif defined(TI_TOOLBAR_SAMPLE_CLASS)
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, EventObserver* observer)
: Base(manager), nw4rmanager::Layout(resAccessor, "fs_VK_toolbar_a.brlyt", observer), mpEventHandler(NULL),
#ifdef TI_TOOLBAR_SAMPLE_CLASS
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* arcName, EventObserver* observer)
: Base(manager), nw4rmanager::Layout(resAccessor, arcName, observer), mpEventHandler(NULL),
mbIsEnableQwertyChg(false) {}
#endif
virtual ~LayoutByNW4R();
virtual void create(MEMAllocator* allocator) override;
virtual void init() override;
virtual void draw() override;
virtual void init() override;
virtual void setQwerty(bool qwerty) override;
virtual void setLanguage(Language language) override;
@@ -56,19 +52,10 @@ namespace textinput {
virtual void onOK();
virtual void onCancel();
virtual void setQwertyWithSE(bool qwerty);
#ifdef TI_CELLPHONE_IMPLEMENTATION
virtual bool isEnableKeytopChange() const { return mbIsEnableQwertyChg; }
#else
virtual bool isEnableKeytopChange() const;
#endif
virtual void enableKeytopChange(bool enable);
#ifdef MYTIMANAGER_MATCHING
virtual nw4r::lyt::Pane* getDownArea();
virtual nw4r::lyt::Pane* getUpArea();
#else
virtual nw4r::lyt::Pane* getUpArea();
virtual nw4r::lyt::Pane* getDownArea();
#endif
virtual void setOKButtonVisible(bool visible);
virtual void setCancelButtonVisible(bool visible);
virtual void setOKButtonCaption(const wchar_t* caption);
@@ -130,21 +117,12 @@ namespace textinput {
KeyType meKeyType; // 0x30
};
#if defined(TI_TOOLBAR_SAMPLE_CLASS) || defined(TIMANAGER_IMPLEMENTATION)
#ifdef TI_TOOLBAR_SAMPLE_CLASS
class Sample : public LayoutByNW4R {
public:
#ifdef TIMANAGER_IMPLEMENTATION
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, EventObserver* observer, const char* layoutName)
: LayoutByNW4R(manager, resAccessor, observer, layoutName) {}
#else
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, EventObserver* observer)
: LayoutByNW4R(manager, resAccessor, observer) {}
#endif
#ifdef TIMANAGER_IMPLEMENTATION
virtual ~Sample();
#else
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* arcName, EventObserver* observer)
: LayoutByNW4R(manager, resAccessor, arcName, observer) {}
virtual ~Sample() {}
#endif
};
#else
class Sample {};

View File

@@ -7,9 +7,6 @@
namespace textinput {
namespace util {
#ifdef TIINPUTFORM_IMPLEMENTATION
wchar_t HankakuToZenkaku(wchar_t ch);
#endif
wchar_t toWLower(wchar_t ch);
wchar_t toWUpper(wchar_t ch);
@@ -20,15 +17,9 @@ namespace textinput {
wchar_t KBD_ConvertSmall(wchar_t ch);
wchar_t KBD_ConvertAll(wchar_t ch);
#ifdef TISTRING_IMPLEMENTATION
u32 KBD_IsDakuten(wchar_t ch);
u32 KBD_IsHandaku(wchar_t ch);
u32 KBD_IsSmall(wchar_t ch);
#else
bool KBD_IsDakuten(wchar_t ch);
bool KBD_IsHandaku(wchar_t ch);
bool KBD_IsSmall(wchar_t ch);
#endif
bool strcmp(const char* s1, const char* s2);
void replaceChar(char* dest, u32 destLen, const char* src, int replaceIdx, char newCh);
@@ -55,11 +46,10 @@ namespace textinput {
public:
Animation() : mfAnimationTime(0.0f), mbInAnimation(false), mbSE(false), mpAnimObserver(NULL) {}
#ifdef TIINPUTFORM_IMPLEMENTATION
virtual void startAnm(f32 start, f32 end, f32 duration, AnimObserver* observer, void* data);
#else
virtual void startAnm(AnimObserver*, f32, f32, f32, void*);
#endif // 0x08
virtual void startAnm(f32, f32, f32, AnimObserver*, void*); // 0x08
void startAnm(AnimObserver* observer, f32 start, f32 end, f32 frame, void* arg) {
startAnm(start, end, frame, observer, arg);
}
virtual void calc(); // 0x0C
virtual f32 getValue(); // 0x10
virtual bool isActive(); // 0x14

View File

@@ -16,7 +16,7 @@ namespace ipl {
virtual void onSE(textinput::sound::SE seId);
virtual void onOK();
virtual void onCancel();
virtual void setManager(Manager* manager) { mpKeyboardMgr = manager; }
virtual void setManager(Manager* manager);
private:
Manager* mpKeyboardMgr; // 0x04

View File

@@ -17,6 +17,7 @@ namespace nw4r {
class FontRefLink {
public:
FontRefLink();
~FontRefLink();
void Set(const char* name, ut::Font* pFont);

1
report.json Normal file

File diff suppressed because one or more lines are too long

View File

@@ -20,6 +20,15 @@ protected:
namespace extend {
namespace memo {
class EventHandler : public inputform::EventHandler {
public:
EventHandler(InputForm* form) : inputform::EventHandler(form), mpMemoForm(form) {}
virtual ~EventHandler();
virtual void onTiEvent(gui::PaneComponent*, u32, Input*);
private:
InputForm* mpMemoForm;
};
class AnmPane : public nw4rmanager::AnmPane {
protected:
AnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
@@ -28,8 +37,8 @@ public:
virtual ~AnmPane();
virtual void init();
virtual void changeAnimation(u32 id);
virtual u32 getState();
virtual u32 getKeyType() const;
virtual u32 getState();
protected:
u32 meState;
u32 meKeyType;
@@ -38,25 +47,17 @@ protected:
class WholePane : public AnmPane {
public:
WholePane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { meKeyType = 0; }
virtual ~WholePane() {}
virtual ~WholePane();
virtual void onAnmEvent(AnmPaneEvent event);
};
class NigaoePane : public AnmPane {
public:
NigaoePane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { meKeyType = 1; }
virtual ~NigaoePane() {}
virtual ~NigaoePane();
virtual void onAnmEvent(AnmPaneEvent event);
};
class SimpleAnmPane : public nw4rmanager::AnmPane {
public:
SimpleAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : nw4rmanager::AnmPane(pane, observer) {}
virtual ~SimpleAnmPane() {}
virtual void init();
virtual void changeAnimation(u32 id);
};
class ScrollButton {
public:
ScrollButton(TiLayout* layout) : muGroup(0), muAnimation(0), mpLayout(layout), mbLeftPressed(false), mbRightPressed(false) {}
@@ -74,13 +75,12 @@ private:
bool mbRightPressed;
};
class EventHandler : public inputform::EventHandler {
class SimpleAnmPane : public nw4rmanager::AnmPane {
public:
EventHandler(InputForm* form) : inputform::EventHandler(form), mpMemoForm(form) {}
virtual ~EventHandler() {}
virtual void onTiEvent(gui::PaneComponent*, u32, Input*);
private:
InputForm* mpMemoForm;
SimpleAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : nw4rmanager::AnmPane(pane, observer) {}
virtual ~SimpleAnmPane();
virtual void init();
virtual void changeAnimation(u32 id);
};
static const char* scPaneName[] = {
@@ -279,6 +279,12 @@ void InputForm::create(MEMAllocator* allocator, inputform::EditBuffer* editBuffe
mpScrollButton->create(allocator, mpMultiArcResourceAccessor);
}
} // namespace memo
} // namespace extend
namespace extend {
namespace memo {
void InputForm::createAnimation(MEMAllocator* allocator) {
for (u16 i = 0; i < 2; i++) {
const PaneAnimations& entry = csPaneToAnimation[i];
@@ -305,6 +311,9 @@ void InputForm::createAnimation(MEMAllocator* allocator) {
}
AnmPane::~AnmPane() {}
WholePane::~WholePane() {}
NigaoePane::~NigaoePane() {}
SimpleAnmPane::~SimpleAnmPane() {}
static const char* csGroupName[] = {
"G_ArwRoop", "G_ArwR_Focus", "G_ArwL_Focus", "G_ArwR_Ac", "G_ArwL_Ac",
@@ -399,7 +408,7 @@ void InputForm::onArrowRTrig() {
mpScrollButton->changeAnimation(false, 6);
f32 scroll = mfScroll - 3.0f * getLineHeight();
if (scroll <= getScrollMin()) scroll = getScrollMin();
mExScrollAnm.startAnm(NULL, mfScroll, scroll, 15.0f, NULL);
mExScrollAnm.startAnm(mfScroll, scroll, 15.0f, (util::AnimObserver*)NULL, NULL);
onSE(sound::SE_LINE_SCROLL);
}
}
@@ -408,7 +417,7 @@ void InputForm::onArrowLTrig() {
mpScrollButton->changeAnimation(true, 6);
f32 scroll = mfScroll + 3.0f * getLineHeight();
if (scroll >= getScrollMax()) scroll = getScrollMax();
mExScrollAnm.startAnm(NULL, mfScroll, scroll, 15.0f, NULL);
mExScrollAnm.startAnm(mfScroll, scroll, 15.0f, (util::AnimObserver*)NULL, NULL);
onSE(sound::SE_LINE_SCROLL);
}
}
@@ -446,8 +455,8 @@ bool InputForm::updateInput(input::HKBManager& hkbManager) {
void InputForm::init() {
if (mpBoundPane != NULL) mCharColor.Set(20, 20, 20, 255);
mbUpVisible = false;
mbDownVisible = false;
mbAbleToUp = false;
mbAbleToDown = false;
searchAnmPane("P_txtScrll_UP")->changeAnimation(7);
searchAnmPane("P_txtScrll_DOWN")->changeAnimation(7);
mbGoodBye = false;
@@ -483,6 +492,8 @@ void InputForm::setScroll(f32 scroll) {
mfDrawScrollY = meEditMode == EM_Edit ? -mfScroll : 0.0f;
}
extern "C" __declspec(section ".sdata") const f32 csfDrawScrollZero = 0.0f;
static nw4r::math::VEC2 transformedOrigin(const nw4r::ut::Rect& rect, const Mtx& matrix) {
nw4r::math::VEC3 position;
position.x = rect.left;
@@ -519,7 +530,7 @@ void InputForm::calc() {
if (meEditMode == EM_Edit) {
height = 2.0f * getLineHeight();
boundY = (mDefaultBoundTrans.y - (height - mDefaultBoundSize.height) / 2.0f) - mfScroll;
} else mfDrawScrollY = 0.0f;
} else mfDrawScrollY = csfDrawScrollZero;
mpBoundPane->SetSize(nw4r::lyt::Size(mpBoundPane->GetSize().width, height));
mpBoundPane->SetTranslate(nw4r::math::VEC2(mDefaultBoundTrans.x, boundY));
mpBoundPane->CalculateMtx(mDrawInfo);
@@ -536,14 +547,14 @@ void InputForm::calc() {
f32 halfLine = getLineHeight();
halfLine *= 0.5f;
if (mfScroll - halfLine > 0.0f) {
if (!mbUpVisible) {
if (!mbAbleToUp) {
searchAnmPane("P_txtScrll_UP")->changeAnimation(5);
mpPaneManager->getPaneComponentByPane(getPane("B_txtScrll_UP"))->init();
}
mbUpVisible = true;
mbAbleToUp = true;
} else {
if (mbUpVisible) searchAnmPane("P_txtScrll_UP")->changeAnimation(6);
mbUpVisible = false;
if (mbAbleToUp) searchAnmPane("P_txtScrll_UP")->changeAnimation(6);
mbAbleToUp = false;
}
f32 textHeight = getLine() * getLineHeight();
f32 lowerHalfLine = getLineHeight();
@@ -551,19 +562,19 @@ void InputForm::calc() {
f32 lowerEdge = mfScroll + height;
lowerEdge += lowerHalfLine;
if (lowerEdge < textHeight) {
if (!mbDownVisible) {
if (!mbAbleToDown) {
searchAnmPane("P_txtScrll_DOWN")->changeAnimation(5);
mpPaneManager->getPaneComponentByPane(getPane("B_txtScrll_DOWN"))->init();
}
mbDownVisible = true;
mbAbleToDown = true;
} else {
if (mbDownVisible) searchAnmPane("P_txtScrll_DOWN")->changeAnimation(6);
mbDownVisible = false;
if (mbAbleToDown) searchAnmPane("P_txtScrll_DOWN")->changeAnimation(6);
mbAbleToDown = false;
}
}
} else {
mbUpVisible = false;
mbDownVisible = false;
mbAbleToUp = false;
mbAbleToDown = false;
searchAnmPane("P_txtScrll_UP")->changeAnimation(7);
searchAnmPane("P_txtScrll_DOWN")->changeAnimation(7);
getPane("N_txt_scrl")->Animate(0);
@@ -757,6 +768,7 @@ void InputForm::finishDraw(u32) {
}
void WholePane::onAnmEvent(AnmPaneEvent) {}
EventHandler::~EventHandler() {}
void EventHandler::onTiEvent(gui::PaneComponent* component, u32 event, Input* input) {
inputform::EventHandler::onTiEvent(component, event, input);
const char* name = component->getPane()->GetName();
@@ -791,6 +803,12 @@ void AnmPane::init() { meState = 0; }
void NigaoePane::onAnmEvent(AnmPaneEvent) {}
bool InputForm::isInScroll() { return mExScrollAnm.isActive(); }
gui::EventHandler* gui::GUIManager::changeEventHandler(gui::EventHandler* eventHandler) {
gui::EventHandler* prevHandler = mpEventHandler;
mpEventHandler = eventHandler;
return prevHandler;
}
}
}
}

View File

@@ -1,5 +1,5 @@
#define MYTILETTERFORM_IMPLEMENTATION
#include "keyboard/MyTiLetterForm.h"
#include "keyboard/tiHwKeyboard.h"
#include "keyboard/tiUtil.h"
#include <nw4r/lyt/textbox.h>
#include <new>
@@ -69,8 +69,8 @@ static const char* paneNames[] = {
"N_Header", "N_Body", "B_Body", "N_Footer", "Nigaoe",
"T_Nigaoe", "B_Nigaoe", "T_Letter", "T_TouchLetter"
};
struct AnimationFile { u32 id; char fileName[64]; };
static const AnimationFile animationFiles[] = {
typedef keyboard::hwkey::HWKeyboard::AnimationFile AnimationFile;
const AnimationFile keyboard::hwkey::HWKeyboard::csAninationFile[8] = {
{0, "my_LetterL_PicFocusIn.brlan"},
{1, "my_LetterL_SelectPic.brlan"},
{2, "my_LetterL_ExitPic.brlan"},
@@ -86,12 +86,26 @@ struct PaneToAnimationGroup {
u32 count;
const AnimationFile* animations[12];
};
static const PaneToAnimationGroup animationGroups[] = {
{0, "N_MemoRoot", 4, {&animationFiles[4], &animationFiles[5], &animationFiles[6], &animationFiles[7]}},
{0, "SendPic", 4, {&animationFiles[4], &animationFiles[5], &animationFiles[6], &animationFiles[7]}},
{1, "N_Pic", 5, {&animationFiles[0], &animationFiles[1], &animationFiles[2], &animationFiles[3], &animationFiles[4]}},
{0, "N_SendMes", 1, {&animationFiles[5]}}
static const PaneToAnimationGroup animationGroups[2] = {
{0, "N_MemoRoot", 4, {&keyboard::hwkey::HWKeyboard::csAninationFile[4], &keyboard::hwkey::HWKeyboard::csAninationFile[5], &keyboard::hwkey::HWKeyboard::csAninationFile[6], &keyboard::hwkey::HWKeyboard::csAninationFile[7]}},
{0, "SendPic", 4, {&keyboard::hwkey::HWKeyboard::csAninationFile[4], &keyboard::hwkey::HWKeyboard::csAninationFile[5], &keyboard::hwkey::HWKeyboard::csAninationFile[6], &keyboard::hwkey::HWKeyboard::csAninationFile[7]}}
};
struct PaneToAnimationGroup2 {
s32 type;
const char* paneName;
u32 count;
const AnimationFile* animations[11];
};
static const PaneToAnimationGroup2 groupN_Pic = {
1, "N_Pic", 5, {&keyboard::hwkey::HWKeyboard::csAninationFile[0], &keyboard::hwkey::HWKeyboard::csAninationFile[1], &keyboard::hwkey::HWKeyboard::csAninationFile[2], &keyboard::hwkey::HWKeyboard::csAninationFile[3], &keyboard::hwkey::HWKeyboard::csAninationFile[4]}
};
char scN_SendMes[0xC] = "N_SendMes";
char scT_TouchLetter[0x10] = "T_TouchLetter";
char scN_SendMes2[0xC] = "N_SendMes";
char scN_txt_scrl[0xC] = "N_txt_scrl";
char scN_MemoRoot[0xC] = "N_MemoRoot";
char scT_SendMes[0xA] = "T_SendMes";
static const wchar_t* scEmptyPane = L"\0\0";
void InputForm::create(MEMAllocator* allocator, textinput::inputform::EditBuffer* editBuffer) {
memo::InputForm::create(allocator, editBuffer);
MEMFreeToAllocator(allocator, mpInputEventHandler);
@@ -99,6 +113,7 @@ void InputForm::create(MEMAllocator* allocator, textinput::inputform::EditBuffer
mpInputEventHandler->setEventObserver(mpEventObserver);
mpPaneManager->changeEventHandler(mpInputEventHandler);
(void)&groupN_Pic;
for (u16 i = 0; i < 4; i++) {
const PaneToAnimationGroup* group = &animationGroups[i];
AnmPane* pane = NULL;
@@ -115,10 +130,10 @@ void InputForm::create(MEMAllocator* allocator, textinput::inputform::EditBuffer
nw4r::ut::List_Append(&mAnmPanes, pane);
for (u16 j = 0; j < group->count; j++) {
void* resource = mpMultiArcResourceAccessor->GetResource(0, group->animations[j]->fileName);
void* resource = mpMultiArcResourceAccessor->GetResource(0, group->animations[j]->mFileName);
AnimTransformPane* transform = static_cast<AnimTransformPane*>(
getLayout()->CreateAnimTransform(resource, mpMultiArcResourceAccessor));
pane->addAnimation(allocator, group->animations[j]->id, transform, false, true);
pane->addAnimation(allocator, group->animations[j]->mAnimationNo, transform, false, true);
}
}
@@ -143,14 +158,14 @@ void InputForm::drawBody() {
}
if (!mbEdited) {
getPane("T_TouchLetter")->Draw(mDrawInfo);
getPane(scT_TouchLetter)->Draw(mDrawInfo);
}
getPane("SendPic")->Draw(mDrawInfo);
getPane("N_SendMes")->Draw(mDrawInfo);
getPane(scN_SendMes2)->Draw(mDrawInfo);
nw4r::lyt::Pane* scrollPane = getPane("N_txt_scrl");
nw4r::lyt::Pane* scrollPane = getPane(scN_txt_scrl);
f32 x = scrollPane->GetTranslate().x;
getPane("N_txt_scrl")->SetTranslate(nw4r::math::VEC2(x, -6.0f));
getPane(scN_txt_scrl)->SetTranslate(nw4r::math::VEC2(x, -6.0f));
}
void InputForm::drawFooter() {
@@ -193,13 +208,13 @@ void InputForm::open() {
memo::InputForm::open();
switch (meType) {
case T_MailAddressSel:
searchAnmPane("N_MemoRoot")->changeAnimation(6);
searchAnmPane(scN_MemoRoot)->changeAnimation(6);
break;
case T_Address:
case T_Picture:
case T_Reply:
default:
searchAnmPane("N_MemoRoot")->changeAnimation(4);
searchAnmPane(scN_MemoRoot)->changeAnimation(4);
break;
}
}
@@ -207,17 +222,17 @@ void InputForm::open() {
void InputForm::close() {
memo::InputForm::close();
if (mbCloseWithSend) {
searchAnmPane("N_MemoRoot")->changeAnimation(5);
searchAnmPane(scN_MemoRoot)->changeAnimation(5);
searchAnmPane("SendPic")->changeAnimation(5);
searchAnmPane("N_SendMes")->changeAnimation(5);
searchAnmPane(scN_SendMes2)->changeAnimation(5);
} else {
searchAnmPane("N_MemoRoot")->changeAnimation(7);
searchAnmPane(scN_MemoRoot)->changeAnimation(7);
searchAnmPane("SendPic")->changeAnimation(7);
}
}
bool InputForm::isWholePaneInAnimation() {
return searchAnmPane("N_MemoRoot")->isInAnimation();
return searchAnmPane(scN_MemoRoot)->isInAnimation();
}
void InputForm::resizePhotoPane(f32 width, f32 height) {
@@ -249,7 +264,7 @@ void InputForm::resizePhotoPane(f32 width, f32 height) {
void InputForm::setSendOutMessage(const wchar_t* sendOutMessage) {
nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(
mpLayout->GetRootPane()->FindPaneByName("T_SendMes", true))->SetString(sendOutMessage);
mpLayout->GetRootPane()->FindPaneByName(scT_SendMes, true))->SetString(sendOutMessage);
}
void EventHandler::onTiEvent(gui::PaneComponent* paneComponent, u32 event, Input* input) {
@@ -259,7 +274,7 @@ void EventHandler::onTiEvent(gui::PaneComponent* paneComponent, u32 event, Input
nw4r::lyt::Pane* pane = paneComponent->getPane();
const char* paneName = pane->GetName();
if (paneName[0] == 'B') {
if (event == gui::GUIComponent::EVENT_TRIG && (input->trigger & 0x800) &&
if (event == gui::GUIComponent::EVENT_TRIG && (input->field_0x0C & 0x800) &&
util::strcmp("B_Pic", paneName)) {
static_cast<InputForm*>(mpMemoForm)->onPhotoTrig();
}

File diff suppressed because it is too large Load Diff

View File

@@ -4,13 +4,13 @@
#include <new>
extern "C" const f32 lbl_81694D90;
extern "C" const f32 lbl_81694DA8;
extern "C" const f32 lbl_81694DAC;
extern "C" const f32 lbl_81694DB0;
extern "C" const f32 lbl_81694DB4;
extern "C" const f32 lbl_81694DBC;
extern "C" const double lbl_81694DC8;
extern "C" const f32 csfCandidate0;
extern "C" const f32 csfCandidate1;
extern "C" const f32 csfCandidate2;
extern "C" const f32 csfCandidate3;
extern "C" const f32 csfCandidate4;
extern "C" const f32 csfCandidate5;
extern "C" const double csdCandidate0;
extern "C" void _savegpr_24();
extern "C" void _restgpr_24();
extern "C" void GetFont__Q34nw4r3lyt8TextBoxCFv();
@@ -20,22 +20,25 @@ namespace textinput {
#pragma push
#pragma section const_type ".data"
extern "C" const char lbl_8165D2D0[15] = "T_prdc_Text_00";
extern "C" const char lbl_8165D2E0[17] = "P_prdc_scrl_Left";
extern "C" const char csTextPaneName[15] = "T_prdc_Text_00";
extern "C" const char csScrollLeftName[17] = "P_prdc_scrl_Left";
#pragma pop
#pragma push
#pragma section data_type ".sdata"
#pragma explicit_zero_data on
extern "C" const char* csCommonTextAnim = csTextPaneName;
extern "C" const char* csCommonScrollAnim = csScrollLeftName;
extern "C" wchar_t scEmptyWText[4] = {0, 0, 0, 0};
#pragma pop
#pragma push
#pragma section sconst_type ".sdata"
extern "C" const char* lbl_816973C0 = lbl_8165D2D0;
extern "C" const char* lbl_816973C4 = lbl_8165D2E0;
extern "C" const wchar_t lbl_816973C8[4] = {0, 0, 0, 1};
extern "C" const char lbl_816973D0[8] = "P_OnBtn";
extern "C" const char lbl_816973D8[8] = "B_OnBtn";
extern "C" const char csOnBtnPaneName[8] = "P_OnBtn";
extern "C" const char csOnBoundName[8] = "B_OnBtn";
#pragma pop
#define COMMON_TEXT_ANIM lbl_816973C0
#define COMMON_SCROLL_ANIM lbl_816973C4
#define COMMON_TEXT_ANIM csCommonTextAnim
#define COMMON_SCROLL_ANIM csCommonScrollAnim
// name made up, no dwarf (?)
struct AnimationFile {
@@ -76,7 +79,7 @@ namespace textinput {
char tail[12];
};
extern "C" const CandidatePaneData lbl_8165D2F8 __attribute__((aligned(8))) = {{
extern "C" const CandidatePaneData csCandidatePaneData __attribute__((aligned(8))) = {{
{KT_CandidateText, "N_predictInput", 1, NULL, {&csAninationFile[0]}},
{KT_ScrollButton,
"P_prdc_scrl_Left",
@@ -211,20 +214,19 @@ namespace textinput {
#pragma push
#pragma section const_type ".data"
extern "C" const char lbl_8165D984[132] =
"B_OffBtn\0\0\0"
"P_JPOffBtn\0"
"P_CNOffBtn\0"
"P_CNOnBtn\0\0"
"B_prdc_scrl_Left\0\0\0"
"P_prdc_scrl_Left\0\0\0"
"B_prdc_scrl_Rght\0\0\0"
"P_prdc_scrl_Rght\0\0\0"
"\0\0\0";
extern "C" char lbl_8165DA08[16] = "W_predictWindow";
extern "C" const char lbl_8165DA18[15] = "N_predictInput";
extern "C" const char lbl_8165DA28[13] = "W_OnOff_Area";
extern "C" const char lbl_8165DA38[13] = "N_prdc_Texts";
extern "C" const char csOffBtnPaneName[132] =
"B_OffBtn\0\0\0\0"
"P_JPOffBtn\0\0"
"P_CNOffBtn\0\0"
"P_CNOnBtn\0\0\0"
"B_prdc_scrl_Left\0\0\0\0"
"P_prdc_scrl_Left\0\0\0\0"
"B_prdc_scrl_Rght\0\0\0\0"
"P_prdc_scrl_Rght\0\0\0\0";
extern "C" char csPredictWindowName[16] = "W_predictWindow";
extern "C" const char csPredictScrllName[15] = "N_predictInput";
extern "C" const char csPredictTextName[13] = "W_OnOff_Area";
extern "C" const char csPredictIconName[13] = "N_prdc_Texts";
#pragma pop
void CandidateBoxCaller::Candidates::addCandidate(const wchar_t* wcString) {
@@ -397,19 +399,19 @@ namespace textinput {
mTextArea.Init();
mOnOffButton.Create(this);
mOnOffButton.Init();
const char* paneNames = lbl_8165D984;
const char* paneNames = csOffBtnPaneName;
mLeftScroll.Create(this, paneNames + 68, paneNames + 48);
mRightScroll.Create(this, paneNames + 108, paneNames + 88);
mLeftScroll.Init();
mRightScroll.Init();
mTextWindow.Create(this, lbl_8165DA08);
mTextWindow.Create(this, csPredictWindowName);
init();
}
void LayoutByNW4R::createAnmPane_(MEMAllocator* allocator) {
for (u16 i = 0; i < ARRAY_LENGTH(lbl_8165D2F8.panes); i++) {
for (u16 i = 0; i < ARRAY_LENGTH(csCandidatePaneData.panes); i++) {
CandidateTextAnmPane* pane = NULL;
const PaneToAnimation& p = lbl_8165D2F8.panes[i];
const PaneToAnimation& p = csCandidatePaneData.panes[i];
switch (p.type) {
case KT_ScrollButton: {
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(CandidateScrollAnmPane));
@@ -452,7 +454,7 @@ namespace textinput {
}
void LayoutByNW4R::init() {
searchAnmPane(lbl_8165DA18)->changeAnimation(ANM_Normal);
searchAnmPane(csPredictScrllName)->changeAnimation(ANM_Normal);
Base::setInvalid(false);
setActive(true);
setOnOff(false);
@@ -465,7 +467,7 @@ namespace textinput {
mpLayout->CalculateMtx(mDrawInfo);
if (meLanguage == KR) {
mTextWindow.SetVisible(false);
getPane(lbl_8165DA28)->SetVisible(false);
getPane(csPredictTextName)->SetVisible(false);
} else if (meLanguage == CN) {
setOnOff(true);
mTextWindow.SetVisible(true);
@@ -475,16 +477,16 @@ namespace textinput {
} else {
mTextWindow.ChangeAnimation(ANM_Normal);
}
getPane(lbl_8165DA28)->SetVisible(false);
getPane(csPredictTextName)->SetVisible(false);
} else {
getPane(lbl_8165DA28)->SetVisible(true);
getPane(csPredictTextName)->SetVisible(true);
}
}
void LayoutByNW4R::draw() {
getPane(lbl_8165DA38)->SetVisible(false);
getPane(csPredictIconName)->SetVisible(false);
nw4rmanager::Layout::draw();
getPane(lbl_8165DA38)->SetVisible(true);
getPane(csPredictIconName)->SetVisible(true);
if (!isInvalid()) {
mTextArea.Draw(mDrawInfo);
}
@@ -494,8 +496,8 @@ namespace textinput {
nw4rmanager::Layout::calc();
mTextArea.Calc();
if (mbAnimOn) {
getPane(lbl_8165DA38)->Animate(0);
getPane(lbl_8165DA38)->CalculateMtx(mDrawInfo);
getPane(csPredictIconName)->Animate(0);
getPane(csPredictIconName)->CalculateMtx(mDrawInfo);
}
}
@@ -503,7 +505,7 @@ namespace textinput {
Base::setLanguage(language);
init();
// Maybe inlines, maybe not
nw4r::math::VEC3 pos = searchAnmPane(lbl_8165DA08)->getPane()->GetTranslate();
nw4r::math::VEC3 pos = searchAnmPane(csPredictWindowName)->getPane()->GetTranslate();
if (meLanguage == CN || meLanguage == KR) {
Base::checkValidation();
// Potentially an inline
@@ -518,7 +520,7 @@ namespace textinput {
pos.x = 202.0f;
}
searchAnmPane(lbl_8165DA08)->getPane()->SetTranslate(pos);
searchAnmPane(csPredictWindowName)->getPane()->SetTranslate(pos);
if (meLanguage == CN) {
mTextArea.ApplyFontScale(1.2f);
} else if (meLanguage == KR) {
@@ -529,10 +531,10 @@ namespace textinput {
}
void LayoutByNW4R::onOnOffButton(bool arg) {
const char* base = lbl_8165D2D0;
const char* base = csTextPaneName;
mTextWindow.TurnOnOff(!isOn());
if (isOn()) {
searchAnmPane(lbl_816973D0)->onAnmEvent(nw4rmanager::AnmPane::PE_0);
searchAnmPane(csOnBtnPaneName)->onAnmEvent(nw4rmanager::AnmPane::PE_0);
if (arg) {
mpEventObserver->onSE(sound::SE_PREDICT_OFF);
}
@@ -586,7 +588,7 @@ namespace textinput {
}
void LayoutByNW4R::startTurnOn(bool on) {
const char* base = lbl_8165D2D0;
const char* base = csTextPaneName;
if (isInScroll()) {
return;
}
@@ -594,7 +596,7 @@ namespace textinput {
mTextWindow.TurnOnOff(on);
if (!on) {
searchAnmPane(lbl_816973D0)->onAnmEvent(nw4rmanager::AnmPane::PE_0);
searchAnmPane(csOnBtnPaneName)->onAnmEvent(nw4rmanager::AnmPane::PE_0);
mpEventObserver->onSE(sound::SE_PREDICT_OFF);
} else {
searchAnmPane(base + 0x6a8)->onAnmEvent(nw4rmanager::AnmPane::PE_0);
@@ -635,7 +637,7 @@ namespace textinput {
current = reinterpret_cast<CandidateBoxCaller::Candidates*>(reinterpret_cast<u8*>(current) + sizeof(current->szwcPredicted[0]));
}
}
gui::PaneComponent* p = mpPaneManager->searchPaneComponent(isOn() ? lbl_816973D8 : lbl_8165D984);
gui::PaneComponent* p = mpPaneManager->searchPaneComponent(isOn() ? csOnBoundName : csOffBtnPaneName);
if (p != NULL) {
p->lockInitialize(true);
}
@@ -704,8 +706,8 @@ namespace textinput {
}
void LayoutByNW4R::cancelStateFocusIn() {
const PaneToAnimation* pane = lbl_8165D2F8.panes;
for (int i = 0; i < ARRAY_LENGTH(lbl_8165D2F8.panes); i++) {
const PaneToAnimation* pane = csCandidatePaneData.panes;
for (int i = 0; i < ARRAY_LENGTH(csCandidatePaneData.panes); i++) {
CandidateTextAnmPane* p = static_cast<CandidateTextAnmPane*>(searchAnmPane(pane->paneName));
if (p != NULL) {
switch (p->getKeyType()) {
@@ -758,12 +760,12 @@ namespace textinput {
mbActive = active;
if (meLanguage == CN || meLanguage == KR) {
mpManager->getPCKeyboard()->setLangKeyActive(active);
mpManager->getCellPhoneKeyboard()->vt_0x68(active);
mpManager->getCellPhoneKeyboard()->setLangKeyActive(active);
}
}
void LayoutByNW4R::onEvent(UIObj* obj, u32 id, void* data) {
const char* base = lbl_8165D2D0;
const char* base = csTextPaneName;
int tmp;
switch (id) {
@@ -994,7 +996,7 @@ namespace textinput {
void UITextArea::Create(nw4rmanager::Layout* layout) {
// These could have been static...
const char* textPanes[NUM_PANES] = {
lbl_8165D2D0, "T_prdc_Text_01", "T_prdc_Text_02", "T_prdc_Text_03", "T_prdc_Text_04", "T_prdc_Text_05", "T_prdc_Text_06",
csTextPaneName, "T_prdc_Text_01", "T_prdc_Text_02", "T_prdc_Text_03", "T_prdc_Text_04", "T_prdc_Text_05", "T_prdc_Text_06",
"T_prdc_Text_07", "T_prdc_Text_08", "T_prdc_Text_09", "T_prdc_Text_10", "T_prdc_Text_11", "T_prdc_Text_12", "T_prdc_Text_13",
"T_prdc_Text_14", "T_prdc_Text_15", "T_prdc_Text_16", "T_prdc_Text_17", "T_prdc_Text_18", "T_prdc_Text_19",
};
@@ -1013,7 +1015,7 @@ namespace textinput {
mpBoundingPane[i]->setListener(this);
}
mpTextAreaPane = mgr->searchPaneComponent("N_prdcTextArea");
mpTextsPane = mgr->searchPaneComponent(lbl_8165DA38);
mpTextsPane = mgr->searchPaneComponent(csPredictIconName);
mSize = mpTextBoxPane[0]->getTextPane()->GetFontSize();
mpTextAreaPane->setListener(this);
}
@@ -1021,7 +1023,7 @@ namespace textinput {
void UITextArea::Init() {
for (u32 i = 0; i < NUM_PANES; i++) {
mpTextBoxPane[i]->getTextPane()->SetString(const_cast<const wchar_t*>(lbl_816973C8), 0);
mpTextBoxPane[i]->getTextPane()->SetString(scEmptyWText, 0);
mpBoundingPane[i]->setTriggerTarget(true);
}
mfTextWidth = 0.0f;
@@ -1083,7 +1085,7 @@ namespace textinput {
nw4r::lyt::TextBox* textPane = mpTextBoxPane[i]->getTextPane();
nw4r::lyt::Bounding* boundPane = mpBoundingPane[i]->getBoundPane();
nw4r::lyt::Size sz1 = textPane->GetSize();
textPane->SetString(L"");
textPane->SetString(scEmptyWText);
textPane->SetVisible(false);
boundPane->SetSize(nw4r::lyt::Size(0.0f, sz1.height));
}
@@ -1206,7 +1208,7 @@ namespace textinput {
void UITextArea::Clear() {
for (u32 i = 0; i < NUM_PANES; i++) {
mpTextBoxPane[i]->getTextPane()->SetString(const_cast<const wchar_t*>(lbl_816973C8), 0);
mpTextBoxPane[i]->getTextPane()->SetString(scEmptyWText, 0);
}
}
@@ -1249,14 +1251,18 @@ namespace textinput {
struct {
f32 left;
f32 top;
f32 width;
f32 height;
f32 x;
f32 y;
} scissor;
nw4r::ut::Rect r = mpTextAreaPane->getPane()->GetPaneRect(drawInfo);
// TODO - These vectors are zero-initialized using GPRs first...
Vec v1 = {0, 0, 0};
Vec v2 = {0, 0, 0};
v1.x = r.left;
v1.y = r.top;
Vec v2 = {0, 0, 0};
v2.x = r.right;
v2.y = r.bottom;
MTXMultVec(mpTextAreaPane->getTextPane()->GetGlobalMtx(), &v1, &v1);
@@ -1307,27 +1313,27 @@ namespace textinput {
psq_st f23, 0x38(r1), 0, 0
addi r11, r1, 0x30
bl _savegpr_24
lfs f0, lbl_81694DA8(r2)
lfs f0, csfCandidate1(r2)
mr r24, r3
lfs f1, 0x1fc(r3)
mr r25, r4
lwz r5, 0xd8(r3)
fdivs f25, f0, f1
lfs f0, lbl_81694DB4(r2)
lfs f0, csfCandidate4(r2)
lwz r5, 0x9c(r5)
lwz r3, 0x38(r3)
lfs f31, 0x4c(r5)
lwz r27, 0x9c(r3)
fcmpo cr0, f1, f0
ble GetNextPageIdx_L1
lfs f28, lbl_81694DAC(r2)
lfs f28, csfCandidate2(r2)
b GetNextPageIdx_L2
GetNextPageIdx_L1:
lfs f28, lbl_81694DB0(r2)
lfs f28, csfCandidate3(r2)
GetNextPageIdx_L2:
fneg f23, f28
lfd f29, lbl_81694DC8(r2)
lfs f30, lbl_81694DBC(r2)
lfd f29, csdCandidate0(r2)
lfs f30, csfCandidate5(r2)
mr r26, r25
slwi r28, r4, 7
lis r31, 0x4330
@@ -1343,7 +1349,7 @@ namespace textinput {
add r0, r0, r28
addic. r30, r0, 4
bne GetNextPageIdx_L7
lfs f0, lbl_81694D90(r2)
lfs f0, csfCandidate0(r2)
b GetNextPageIdx_L8
GetNextPageIdx_L7:
mr r3, r27
@@ -1351,7 +1357,7 @@ namespace textinput {
lfs f26, 0xe4(r27)
mr r29, r3
lfs f24, 0xf0(r27)
lfs f27, lbl_81694D90(r2)
lfs f27, csfCandidate0(r2)
b GetNextPageIdx_L9
GetNextPageIdx_L10:
lwz r12, 0(r29)
@@ -1620,7 +1626,7 @@ namespace textinput {
if (mgr()->isInScroll() && event != 1 && event != 0) {
return;
}
if (!mgr()->searchAnmPane(lbl_8165DA08)->isInAnimation() || event == 1) {
if (!mgr()->searchAnmPane(csPredictWindowName)->isInAnimation() || event == 1) {
if (!mgr()->isInvalid()) {
switch (event) {
case 4:
@@ -1772,7 +1778,7 @@ namespace textinput {
if (mgr()->isInScroll() && event != 1 && event != 0) {
return;
}
if (!mgr()->searchAnmPane(lbl_8165DA08)->isInAnimation() || event == 1) {
if (!mgr()->searchAnmPane(csPredictWindowName)->isInAnimation() || event == 1) {
if (!mgr()->isInvalid()) {
switch (event) {
case 4:
@@ -1808,6 +1814,10 @@ namespace textinput {
}
}
u16 gui::GUIComponent::getFlightDuration(int point) {
return mFlightDuration[point];
}
UIOnOffButton::UIOnOffButton(u32 id, LayoutByNW4R* layout, UIObj::Listener* listener)
: UIObj(id, layout, listener), mpOnPictPane(NULL), mpOnBoundPane(NULL), mpOffPictPane(NULL), mpOffBoundPane(NULL), mpOnAnmPane(NULL),
mpOffAnmPane(NULL) {
@@ -1815,18 +1825,18 @@ namespace textinput {
void UIOnOffButton::Create(nw4rmanager::Layout* layout) {
gui::PaneManager* mgr = layout->getPaneManager();
mpOnPictPane = mgr->searchPaneComponent("P_OnBtn");
mpOnBoundPane = mgr->searchPaneComponent("B_OnBtn");
mpOnAnmPane = static_cast<OnOffAnmPane*>(layout->searchAnmPane("P_OnBtn"));
mpOffPictPane = mgr->searchPaneComponent(lbl_8165D2F8.tail);
mpOffBoundPane = mgr->searchPaneComponent(lbl_8165D984);
mpOffAnmPane = static_cast<OnOffAnmPane*>(layout->searchAnmPane(lbl_8165D2F8.tail));
mpOnPictPane = mgr->searchPaneComponent(csOnBtnPaneName);
mpOnBoundPane = mgr->searchPaneComponent(csOnBoundName);
mpOnAnmPane = static_cast<OnOffAnmPane*>(layout->searchAnmPane(csOnBtnPaneName));
mpOffPictPane = mgr->searchPaneComponent(csCandidatePaneData.tail);
mpOffBoundPane = mgr->searchPaneComponent(csOffBtnPaneName);
mpOffAnmPane = static_cast<OnOffAnmPane*>(layout->searchAnmPane(csCandidatePaneData.tail));
layout->getLayout()->GetRootPane()->FindPaneByName(lbl_8165D2F8.tail)->GetMaterial()->GetTexture(&mOffTexDefault, 0);
layout->getLayout()->GetRootPane()->FindPaneByName(lbl_8165D984 + 12)->GetMaterial()->GetTexture(&mOffTexJP, 0);
layout->getLayout()->GetRootPane()->FindPaneByName(lbl_8165D984 + 24)->GetMaterial()->GetTexture(&mOffTexCN, 0);
layout->getLayout()->GetRootPane()->FindPaneByName(lbl_816973D0)->GetMaterial()->GetTexture(&mOnTexDefault, 0);
layout->getLayout()->GetRootPane()->FindPaneByName(lbl_8165D984 + 36)->GetMaterial()->GetTexture(&mOnTexCN, 0);
layout->getLayout()->GetRootPane()->FindPaneByName(csCandidatePaneData.tail)->GetMaterial()->GetTexture(&mOffTexDefault, 0);
layout->getLayout()->GetRootPane()->FindPaneByName(csOffBtnPaneName + 12)->GetMaterial()->GetTexture(&mOffTexJP, 0);
layout->getLayout()->GetRootPane()->FindPaneByName(csOffBtnPaneName + 24)->GetMaterial()->GetTexture(&mOffTexCN, 0);
layout->getLayout()->GetRootPane()->FindPaneByName(csOnBtnPaneName)->GetMaterial()->GetTexture(&mOnTexDefault, 0);
layout->getLayout()->GetRootPane()->FindPaneByName(csOffBtnPaneName + 36)->GetMaterial()->GetTexture(&mOnTexCN, 0);
mpOffBoundPane->setListener(this);
mpOnBoundPane->setListener(this);
@@ -1883,7 +1893,7 @@ namespace textinput {
if (mgr()->isInScroll() && event != 1 && event != 0) {
return;
}
if (!mgr()->searchAnmPane(lbl_8165DA08)->isInAnimation() || event == 1) {
if (!mgr()->searchAnmPane(csPredictWindowName)->isInAnimation() || event == 1) {
OnOffAnmPane* p;
if (&component == mpOnBoundPane) {
p = mpOnAnmPane;

File diff suppressed because it is too large Load Diff

View File

@@ -88,6 +88,20 @@ namespace textinput {
return event;
}
bool GUIComponent::isVisible() { return true; }
bool GUIComponent::isPointed(int point) { return mbPointed[point]; }
void GUIComponent::onMove(int point, f32 x, f32 y) { mFlightDuration[point]++; }
void GUIComponent::setPointed(int point, bool bEnable) { mbPointed[point] = bEnable; }
void GUIComponent::onPointIn(int point) { mFlightDuration[point] = 0; }
void GUIComponent::onPointOut(int point) { mFlightDuration[point] = 0; }
void GUIComponent::onDrag(f32 x, f32 y) {}
GUIManager::~GUIManager() {
IDToComponent* p = static_cast<IDToComponent*>(nw4r::ut::List_GetFirst(&mComponents));
while (p != NULL) {
@@ -125,6 +139,8 @@ namespace textinput {
}
}
u32 GUIComponent::getID() { return mID; }
GUIComponent* GUIManager::getComponent(u32 id) {
IDToComponent* p = static_cast<IDToComponent*>(nw4r::ut::List_GetNth(&mComponents, (u16)id));
return p->mpComponent;
@@ -192,6 +208,29 @@ namespace textinput {
return touched;
}
u32 GUIComponent::updatePointer(int point, f32 x, f32 y, u32 trig, u32 hold, u32 release) {
GUIPointer pointer(point, x, y, hold, trig, release);
return updatePointerImpl(pointer);
}
void GUIManager::onEvent(GUIComponent& comp, u32 event, int point, void* data) {
if (mpEventHandler) {
mpEventHandler->setLatestEventCtrlNo(point);
mpEventHandler->onEvent(comp, event, data);
}
comp.onEvent(event, data);
}
bool GUIComponent::isTriggerTarget() { return mbTriggerTarget; }
void GUIComponent::onTrig(int point, u32 trig, Vec& dragPos) {
if (trig & mDraggingButton) {
mDraggingPos[point] = dragPos;
mbDragging[point] = true;
mFlightDuration[point] = 0;
}
}
void GUIManager::calc() {
for (IDToComponent* p = static_cast<IDToComponent*>(nw4r::ut::List_GetFirst(&mComponents)); p != NULL;
p = static_cast<IDToComponent*>(nw4r::ut::List_GetNext(&mComponents, p))) {
@@ -220,6 +259,8 @@ namespace textinput {
}
}
void GUIComponent::setDraggingButton(u32 dragBtn) { mDraggingButton = dragBtn; }
PaneManager::~PaneManager() {
PaneToComponent* p = static_cast<PaneToComponent*>(nw4r::ut::List_GetFirst(&mPaneComponents));
while (p) {
@@ -243,6 +284,8 @@ namespace textinput {
PaneComponent::~PaneComponent() {}
GUIComponent::~GUIComponent() {}
void PaneManager::createLayoutScene(const nw4r::lyt::Layout& layout) {
mIDCounter = 0;
walkInChildren(layout.GetRootPane()->GetChildList());
@@ -288,6 +331,8 @@ namespace textinput {
addComponent(pComponent);
}
void PaneComponent::setPane(nw4r::lyt::Pane* pane) { mpPane = pane; }
PaneComponent* PaneManager::searchPaneComponent(const char* name) {
for (u32 i = 0; i < nw4r::ut::List_GetSize(&mPaneComponents); i++) {
PaneToComponent* p = static_cast<PaneToComponent*>(nw4r::ut::List_GetNth(&mPaneComponents, (u16)i));
@@ -354,6 +399,8 @@ namespace textinput {
extern "C" const u8 lbl_81694EEE = 0x00;
extern "C" const u8 lbl_81694EEF = 0xFF;
extern "C" const f32 lbl_81694EF0 = 0.5f;
const nw4r::lyt::DrawInfo* PaneManager::getDrawInfo() { return mpDrawInfo; }
#pragma pop
extern "C" asm void draw__Q39textinput3gui13PaneComponentFv() {
@@ -489,5 +536,13 @@ namespace textinput {
}
return true;
}
u32 GUIComponent::updatePointer(const GUIPointer& pointer) { return updatePointerImpl(pointer); }
void GUIManager::setEventHandler(EventHandler* eventHandler) {
mpEventHandler = eventHandler;
}
bool GUIManager::update(int point, const KPADStatus* kpad, f32, f32, void* data) { return false; }
} // namespace gui
} // namespace textinput

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,45 @@
#define TIHWKEYBOARD_IMPLEMENTATION
#include "keyboard/tiHwKeyboard.h"
#include "keyboard/tiManager.h"
#include "keyboard/tiHKBManager.h"
#include "keyboard/tiLayoutGather.h"
extern const u8 lbl_81616BD8[] = {0x0f, 0x21, 0x20, 0x08, 0x09, 0x0e, 0x19, 0x00, 0x21, 0x21, 0x00, 0x00};
extern const u8 lbl_81616BE4[] = {0x0f, 0x21, 0x20, 0x04, 0x09, 0x0e, 0x11, 0x00, 0x21, 0x21, 0x00, 0x00};
extern "C" const u8 scHwScrlKeyMap[];
extern "C" const u8 csAninationFile[];
struct HWKeyboardScrlData {
u32 field_0x00;
u32 field_0x04;
const u8* field_0x08;
u32 field_0x0c;
const u8* field_0x10;
u32 field_0x14[11];
};
extern const HWKeyboardScrlData scHwScrlData = {
0, 0, scHwScrlKeyMap, 1, csAninationFile + 0x154, {0},
};
extern const u32 scHwSendPacket[4] = {0, 0, 0x01000000, 0};
extern const u8 scHwInitSeq0[] = {0x0f, 0x21, 0x20, 0x08, 0x09, 0x0e, 0x19, 0x00, 0x21, 0x21, 0x00, 0x00};
extern const u8 scHwInitSeq1[] = {0x0f, 0x21, 0x20, 0x04, 0x09, 0x0e, 0x11, 0x00, 0x21, 0x21, 0x00, 0x00};
const u8 scKeyMap[136] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x01, 0x0a, 0x03, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x19, 0x1a, 0x1b, 0x13, 0x15, 0x17, 0x14, 0x16, 0x18, 0x00,
0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x0f, 0x0e, 0x00, 0x00, 0x00, 0x00,
0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x05, 0x07, 0x0b, 0x06, 0x05, 0x07, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
extern const u32 scKeyRepeatData[2];
extern const u32 scTriggerData[1];
#pragma push
#pragma section data_type ".sdata" ".sdata"
u8 sbShiftInit = 0;
u8 sbShiftOn = 1;
u8 sbShiftOff = 0;
#pragma pop
extern "C" void SetCountry__Q39textinput5input10HKBManagerFUc();
extern "C" textinput::input::HKBManager sInstance__Q39textinput5input10HKBManager;
extern "C" void convertWCCode__Q49textinput8keyboard5hwkey10HWKeyboardCFw();
@@ -21,7 +54,7 @@ extern "C" void updateFromReceiver__Q29textinput13CommandSenderFUlPv();
#pragma push
#pragma section const_type ".data"
typedef void (*KeyboardDataFunction)();
extern "C" KeyboardDataFunction const jumptable_81668EF8[0x3f] = {
extern "C" KeyboardDataFunction const scHwKeyFuncTable[0x3f] = {
reinterpret_cast<KeyboardDataFunction>(reinterpret_cast<u32>(convertWCCode__Q49textinput8keyboard5hwkey10HWKeyboardCFw) + 0x00000158),
reinterpret_cast<KeyboardDataFunction>(reinterpret_cast<u32>(convertWCCode__Q49textinput8keyboard5hwkey10HWKeyboardCFw) + 0x000001d8),
reinterpret_cast<KeyboardDataFunction>(reinterpret_cast<u32>(convertWCCode__Q49textinput8keyboard5hwkey10HWKeyboardCFw) + 0x000001f0),
@@ -104,11 +137,245 @@ namespace textinput {
namespace keyboard {
namespace hwkey {
struct Packet {
u16 code;
u16 unk_02;
u32 flags;
u32 unk_08;
u32 unk_0C;
};
extern "C" void GetTriggeredKeySet__Q39textinput5input10HKBManagerCFv();
extern "C" void IsValid__Q49textinput5input10HKBManager6KeySetCFv();
extern "C" void GetKey__Q49textinput5input10HKBManager6KeySetCFv();
extern "C" void GetNext__Q49textinput5input10HKBManager6KeySetCFv();
extern "C" void GetModifierState__Q39textinput5input10HKBManagerCFv();
bool HWKeyboard::updateRepeatKey_(input::HKBManager& hkbManager) {
s32 mods = hkbManager.GetModifierState();
input::HKBManager::KeySet keySet(NULL, 0);
keySet = hkbManager.GetRepeatedKeySet();
if (!keySet.IsValid()) {
return false;
}
if (!mgr()->getToolBar()->isQwerty() && mgr()->getToolBar()->isEnableKeytopChange()) {
return true;
}
u32 shift = mods & 0x8;
while (keySet.IsValid()) {
u8 key = keySet.GetKey();
u32 v;
switch (key) {
case 0x4C:
sendCommand(2, NULL);
break;
case 0x2A:
sendCommand(1, NULL);
break;
case 0x4F: v = 0x20; goto send_arrow;
case 0x50: v = 0x1F; goto send_arrow;
case 0x51: v = 0x1E; goto send_arrow;
case 0x52: v = 0x1D;
send_arrow: {
u32 data[2] = {v, mods};
sendCommand(0x26, data);
break;
}
case 0x2C:
if ((mgr()->getToolBar()->isQwerty() != 0 ||
mgr()->getCellPhoneKeyboard()->isNumeric() == 0) && shift == 0) {
u32 data[2] = {const_cast<u32*>(scKeyRepeatData)[0], mods};
sendCommand(0x26, data);
}
break;
}
keySet = keySet.GetNext();
}
return false;
}
bool HWKeyboard::updateTriggerKey_(input::HKBManager& hkbManager) {
s32 mods = hkbManager.GetModifierState();
input::HKBManager::KeySet keySet(NULL, 0);
keySet = hkbManager.GetTriggeredKeySet();
if (!keySet.IsValid()) {
return false;
}
if (mgr()->getToolBar()->isQwerty() == 0 &&
mgr()->getToolBar()->isEnableKeytopChange() != 0) {
return true;
}
if (mgr()->getPCKeyboard()->isABC() == 0) {
if (mgr()->getToolBar()->isQwerty() != 0 && mgr()->getEventObserver() != 0) {
mgr()->getEventObserver()->onSE((sound::SE)0xD);
}
mgr()->getPCKeyboard()->setABC(true);
}
while (keySet.IsValid()) {
wchar_t wc = keySet.GetWChar();
u8 key = keySet.GetKey();
const u8* keyMap = scKeyMap;
if (wc == 0x20) {
if (!(mods & 0x8)) {
goto check_caps;
}
u32 data[2] = {const_cast<u32*>(scTriggerData)[0], mods};
sendCommand(0x26, data);
}
else if (wc != 0) {
bool send = true;
if (mgr()->getToolBar()->isQwerty() == 0 &&
mgr()->getCellPhoneKeyboard()->isNumeric() != 0) {
if ((int)wc == 0x2F) {
goto bad_wc;
}
else if ((int)wc < 0x2F) {
if ((int)wc >= 0x2E) {
goto dot_wc;
}
goto bad_wc;
}
else {
if ((int)wc >= 0x3A) {
goto bad_wc;
}
goto ok_wc;
}
dot_wc:
if (mgr()->getCellPhoneKeyboard()->isNumericWithDot() != 0) {
goto ok_wc;
}
bad_wc:
send = false;
ok_wc:;
}
if (send) {
mods = 0;
if (hkbManager.GetModifierState() & 0x2) {
mods |= 1;
}
if (hkbManager.GetModifierState() & 0x200) {
mods |= 2;
}
if (!(mods & 1)) {
pctype::LayoutByNW4R* pcKbd = mgr()->getPCKeyboard();
pcKbd->mKeyState.setABCFlag(pcKbd->mKeyState.mFlags & ~0x8F);
}
wc = convertWCCode(wc);
Packet packet = *(const Packet*)scHwSendPacket;
packet.code = wc;
packet.flags = mods;
sendCommand(0, &packet);
if (mgr()->getLanguage() == 8) {
u32 shifted = wc + 0x10000;
if ((u16)(shifted - 0x201C) <= 1) {
field_0x16 = !field_0x16;
}
else if ((u16)(shifted - 0x2018) <= 1) {
field_0x15 = !field_0x15;
}
}
}
}
else {
bool send = true;
int code;
if (key < 0x20) {
code = 0;
}
else if (key < 0x98) {
code = keyMap[key - 0x20];
}
else if (key < 0xE0) {
code = 0;
}
else if (key < 0xF0) {
code = keyMap[key - 0x68];
}
else {
code = 0;
}
if (code == 0x1C) {
u32 m = !(hkbManager.GetModifierState() & 0x100);
if (mgr()->getToolBar()->isQwerty() == 0 &&
mgr()->getCellPhoneKeyboard()->isNumeric() != 0) {
m = 1;
}
hkbManager.SetModifierState(m ? 0x100 : 0, 0x100);
}
if (mgr()->getToolBar()->isQwerty() == 0 &&
mgr()->getCellPhoneKeyboard()->isNumeric() != 0) {
if (code < 0x1D) {
if (code >= 0x17 || code < 0x15) {
goto bad_code;
}
}
else {
if (code >= 0x21) {
goto bad_code;
}
goto ok_code;
bad_code:
send = false;
}
ok_code:;
}
if (send) {
u32 data[2] = {code, mods};
sendCommand(0x26, data);
}
}
check_caps:
switch ((int)keySet.GetKey()) {
case 0x39:
if (mgr()->getToolBar()->isQwerty() != 0 ||
mgr()->getToolBar()->isEnableKeytopChange() != 0) {
mgr()->getPCKeyboard()->onPressedCaps();
}
break;
}
keySet = keySet.GetNext();
}
return false;
}
bool HWKeyboard::updateTappingShift_(input::HKBManager& hkbManager) {
hkbManager.GetModifierState();
input::HKBManager::KeySet keySet(NULL, 0);
keySet = hkbManager.GetTriggeredKeySet();
while (keySet.IsValid()) {
switch (keySet.GetKey()) {
case 0xE1:
case 0xE5:
field_0x14 = 1;
return false;
default:
field_0x14 = 0;
keySet = keySet.GetNext();
break;
}
}
if (field_0x14 == 0) {
return false;
}
keySet = hkbManager.GetReleasedKeySet();
while (keySet.IsValid()) {
switch (keySet.GetKey()) {
case 0xE1:
case 0xE5:
field_0x14 = 0;
if (mgr()->getToolBar()->isQwerty() != 0 &&
mgr()->getPCKeyboard()->mbLangKeyActive != 0) {
sendCommand(0x2E, NULL);
}
return false;
default:
keySet = keySet.GetNext();
break;
}
}
return false;
}
extern "C" bool updateRepeatKey___Q49textinput8keyboard5hwkey10HWKeyboardFRQ39textinput5input10HKBManager();
extern "C" bool updateTriggerKey___Q49textinput8keyboard5hwkey10HWKeyboardFRQ39textinput5input10HKBManager();
extern "C" bool updateTappingShift___Q49textinput8keyboard5hwkey10HWKeyboardFRQ39textinput5input10HKBManager();
@@ -248,354 +515,11 @@ namespace textinput {
blr
}
struct NavigationCommand { u32 command; u32 modifiers; };
struct KeyInputData {
wchar_t character;
u16 flags;
u32 modifier;
u8 direct;
u8 repeated;
u16 reserved;
u32 data;
};
extern const u8 controlKeys[];
bool HWKeyboard::updateRepeatKey_(input::HKBManager& hkbManager) {
u32 modifierState = hkbManager.GetModifierState();
input::HKBManager::KeySet currentKeySet;
currentKeySet = hkbManager.GetRepeatedKeySet();
if (!currentKeySet.IsValid()) {
return false;
}
if (!mgr()->getToolBar()->isQwerty()) {
if (mgr()->getToolBar()->isEnableKeytopChange()) {
return true;
}
}
u32 modifierFlag = modifierState & 0x8;
while (currentKeySet.IsValid()) {
int key = currentKeySet.GetKey();
u32 command;
if (key == 0x4c) {
goto sendCommand2;
}
if (key < 0x4c) {
if (key != 0x2b) {
if (key < 0x2b) {
if (key >= 0x2a) {
goto sendCommand1;
}
} else {
if (key >= 0x2d) {
goto nextRepeatedKey;
}
goto checkSpecialCommand;
}
}
goto nextRepeatedKey;
}
if (key == 0x51) {
goto setNavigationCommand1e;
}
if (key < 0x51) {
if (key == 0x4f) {
goto setNavigationCommand20;
} else if (key >= 0x4f) {
goto setNavigationCommand1f;
}
} else {
if (key >= 0x53) {
goto nextRepeatedKey;
}
goto setNavigationCommand1d;
}
goto nextRepeatedKey;
sendCommand2:
sendCommand(2, NULL);
goto nextRepeatedKey;
sendCommand1:
sendCommand(1, NULL);
goto nextRepeatedKey;
setNavigationCommand20:
command = 0x20;
goto sendNavigationCommand;
setNavigationCommand1f:
command = 0x1f;
goto sendNavigationCommand;
setNavigationCommand1e:
command = 0x1e;
goto sendNavigationCommand;
setNavigationCommand1d:
command = 0x1d;
sendNavigationCommand:
{
u32 commandData[2];
commandData[0] = command;
commandData[1] = modifierState;
sendCommand(0x26, commandData);
}
goto nextRepeatedKey;
checkSpecialCommand:
if (mgr()->getToolBar()->isQwerty() ||
!mgr()->getCellPhoneKeyboard()->isNumeric()) {
if (modifierFlag == 0) {
goto sendSpecialCommand;
}
}
goto nextRepeatedKey;
sendSpecialCommand:
{
NavigationCommand commandData = {8, modifierState};
sendCommand(0x26, &commandData);
}
nextRepeatedKey:
currentKeySet = currentKeySet.GetNext();
}
return false;
}
bool HWKeyboard::updateTriggerKey_(input::HKBManager& hkbManager) {
u32 modifierState = hkbManager.GetModifierState();
input::HKBManager::KeySet currentKeySet;
currentKeySet = hkbManager.GetTriggeredKeySet();
if (!currentKeySet.IsValid()) {
return false;
}
if (!mgr()->getToolBar()->isQwerty() &&
mgr()->getToolBar()->isEnableKeytopChange()) {
return true;
}
if (!mgr()->getPCKeyboard()->isABC()) {
if (mgr()->getToolBar()->isQwerty()) {
EventObserver* eventObserver = mgr()->getEventObserverForHardware();
if (eventObserver != NULL) {
eventObserver->onSE(sound::SE_KETAI_MODE_SWITCHING);
}
}
mgr()->getPCKeyboard()->setABC(true);
}
while (currentKeySet.IsValid()) {
u32 character = currentKeySet.GetWChar();
u8 key = currentKeySet.GetKey();
if (static_cast<wchar_t>(character) == 0x20) {
if ((modifierState & 0x8) != 0) {
NavigationCommand commandData = {8, modifierState};
sendCommand(0x26, &commandData);
}
} else if (static_cast<wchar_t>(character) != 0) {
bool sendCharacter = true;
if (!mgr()->getToolBar()->isQwerty() &&
mgr()->getCellPhoneKeyboard()->isNumeric()) {
if (static_cast<wchar_t>(character) == '/') {
goto suppressCharacter;
}
if (static_cast<wchar_t>(character) < '/') {
if (static_cast<wchar_t>(character) >= '.') {
goto checkNumericDot;
}
goto suppressCharacter;
}
if (static_cast<wchar_t>(character) >= ':') {
goto suppressCharacter;
}
goto sendCharacterCheck;
checkNumericDot:
if (mgr()->getCellPhoneKeyboard()->isNumericWithDot()) {
goto sendCharacterCheck;
}
suppressCharacter:
sendCharacter = false;
}
goto sendCharacterCheck;
sendCharacterCheck:
if (sendCharacter) {
modifierState = 0;
if ((hkbManager.GetModifierState() & 0x2) != 0) {
modifierState |= 1;
}
if ((hkbManager.GetModifierState() & 0x200) != 0) {
modifierState |= 2;
}
if ((modifierState & 1) == 0) {
keyboard::pctype::Base::KeyState& keyState = mgr()->getPCKeyboard()->hardwareKeyState();
keyState.setABCFlag(keyState.abcFlags & 0xffffff70);
}
character = convertWCCode(character);
KeyInputData keyInputData = {0, 0, 0, 1, 0, 0, 0};
keyInputData.character = character;
keyInputData.modifier = modifierState;
sendCommand(0, &keyInputData);
if (mgr()->getLanguage() == CN) {
if (static_cast<wchar_t>(character + (0x10000 - 0x201c)) <= 1) {
field_0x16 = !field_0x16;
} else if (static_cast<wchar_t>(character + (0x10000 - 0x2018)) <= 1) {
field_0x15 = !field_0x15;
}
}
}
} else {
bool sendKey = true;
int translatedKey;
if (key < 0x20) {
translatedKey = 0;
} else if (key < 0x98) {
translatedKey = controlKeys[key - 0x20];
} else if (key < 0xe0) {
translatedKey = 0;
} else if (key < 0xf0) {
translatedKey = controlKeys[key - 0x68];
} else {
translatedKey = 0;
}
if (translatedKey == 0x1c) {
bool capsLock = !(hkbManager.GetModifierState() & 0x100);
if (!mgr()->getToolBar()->isQwerty() &&
mgr()->getCellPhoneKeyboard()->isNumeric()) {
capsLock = true;
}
hkbManager.SetModifierState(capsLock ? 0x100 : 0, 0x100);
}
if (mgr()->getToolBar()->isQwerty() ||
!mgr()->getCellPhoneKeyboard()->isNumeric()) {
goto sendKeyCheck;
}
switch (translatedKey) {
case 0x15:
case 0x16:
case 0x1d:
case 0x1e:
case 0x1f:
case 0x20:
break;
default:
sendKey = false;
break;
}
sendKeyCheck:
if (sendKey) {
u32 commandData[2] = {translatedKey, modifierState};
sendCommand(0x26, commandData);
}
}
int capsKey = currentKeySet.GetKey();
switch (capsKey) {
case 0x39:
if (mgr()->getToolBar()->isQwerty() ||
mgr()->getToolBar()->isEnableKeytopChange()) {
mgr()->getPCKeyboard()->onPressedCaps();
}
break;
default:
break;
}
currentKeySet = currentKeySet.GetNext();
}
return false;
}
const u8 controlKeys[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x01, 0x0a, 0x03,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
0x00, 0x04, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
0x2b, 0x2c, 0x19, 0x1a, 0x1b, 0x13, 0x15, 0x17, 0x14, 0x16, 0x18, 0x00,
0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x0f, 0x0e,
0x00, 0x00, 0x00, 0x00,
0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x05, 0x07, 0x0b,
0x06, 0x05, 0x07, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
bool HWKeyboard::updateTappingShift_(input::HKBManager& hkbManager) {
hkbManager.GetModifierState();
input::HKBManager::KeySet currentKeySet;
input::HKBManager::KeySet triggeredKeySet;
input::HKBManager::KeySet releasedKeySet;
input::HKBManager::KeySet releasedNextKeySet;
triggeredKeySet = hkbManager.GetTriggeredKeySet();
currentKeySet = triggeredKeySet;
while (currentKeySet.IsValid()) {
int key = currentKeySet.GetKey();
switch (key) {
case 0xe5:
case 0xe1:
field_0x14 = 1;
return false;
default:
field_0x14 = 0;
currentKeySet = currentKeySet.GetNext();
break;
}
}
if (field_0x14 == 0) {
return false;
}
releasedKeySet = hkbManager.GetReleasedKeySet();
currentKeySet = releasedKeySet;
while (currentKeySet.IsValid()) {
int key = currentKeySet.GetKey();
switch (key) {
case 0xe5:
case 0xe1:
field_0x14 = 0;
if (mgr()->getToolBar()->isQwerty() &&
mgr()->getPCKeyboard()->hardwareLanguageKeyActive()) {
sendCommand(0x2e, NULL);
}
return false;
default:
currentKeySet = currentKeySet.GetNext();
break;
}
}
return false;
}
HWKeyboard::HWKeyboard(Manager* manager) : mpManager(manager), field_0x14(0), field_0x15(0), field_0x16(0) {
}
void HWKeyboard::init() {
LayoutGather::Singleton::getInstance().setHWPressedShift(false);
LayoutGather::Singleton::getInstance().setHWPressedShift(sbShiftInit);
u32 state = input::HKBManager::getInstance().GetModifierState();
input::HKBManager::getInstance().SetModifierState(state | 0x100, 0x700);
@@ -621,12 +545,12 @@ const u8 controlKeys[] = {
bool previousShift = gather.isHoldingShift();
if (state & 0x2) {
gather.setHWPressedShift(true);
gather.setHWPressedShift(sbShiftOn);
if (!previousShift) {
mgr()->getPCKeyboard()->onPressedShift(true);
}
} else {
gather.setHWPressedShift(false);
gather.setHWPressedShift(sbShiftOff);
if (previousShift) {
if (!gather.isHoldingShift()) {
mgr()->getPCKeyboard()->onReleasedShift();
@@ -639,16 +563,16 @@ const u8 controlKeys[] = {
nofralloc
cmpwi r4, 2
bne setLanguage_L1
lis r4, lbl_81616BD8@ha
lis r4, scHwInitSeq0@ha
lis r3, sInstance__Q39textinput5input10HKBManager@ha
addi r4, r4, lbl_81616BD8@l
addi r4, r4, scHwInitSeq0@l
lbzx r4, r4, r5
addi r3, r3, sInstance__Q39textinput5input10HKBManager@l
b SetCountry__Q39textinput5input10HKBManagerFUc
setLanguage_L1:
lis r4, lbl_81616BE4@ha
lis r4, scHwInitSeq1@ha
lis r3, sInstance__Q39textinput5input10HKBManager@ha
addi r4, r4, lbl_81616BE4@l
addi r4, r4, scHwInitSeq1@l
lbzx r4, r4, r5
addi r3, r3, sInstance__Q39textinput5input10HKBManager@l
b SetCountry__Q39textinput5input10HKBManagerFUc
@@ -735,9 +659,9 @@ const u8 controlKeys[] = {
addi r0, r31, -0x21
cmplwi r0, 0x3e
bgt convertWCCode_HWKeyboard_L1
lis r3, jumptable_81668EF8@ha
lis r3, scHwKeyFuncTable@ha
slwi r0, r0, 2
addi r3, r3, jumptable_81668EF8@l
addi r3, r3, scHwKeyFuncTable@l
lwzx r3, r3, r0
mtctr r3
bctr
@@ -819,3 +743,5 @@ const u8 controlKeys[] = {
} // namespace textinput
const u32 scKeyRepeatData[2] = {8, 0};
const u32 scTriggerData[1] = {8};

File diff suppressed because it is too large Load Diff

494
src/keyboard/tiKeyboard.cpp Normal file
View File

@@ -0,0 +1,494 @@
#define TI_PCTYPE_SAMPLE_CLASS
#define TI_CELLPHONE_SAMPLE_CLASS
#define TI_INPUTFORM_SAMPLE_CLASS
#define TI_CANDIDATEBOX_SAMPLE_CLASS
#define TI_TOOLBAR_SAMPLE_CLASS
#define TI_PREDICTLANG_SAMPLE_CLASS
#define TI_SIGNWINDOW_SAMPLE_CLASS
#include "keyboard/tiPcKeyboard.h"
#include "keyboard/tiCellPhone.h"
#include "keyboard/tiCandidateBox.h"
#include "keyboard/tiInputForm.h"
#include "keyboard/tiToolBar.h"
#include "keyboard/tiPredictLang.h"
#include "keyboard/tiSignWindow.h"
#include "keyboard/tiManager.h"
#include "keyboard/tiCandidateBox.h"
#include "keyboard/tiPredictLang.h"
#include "keyboard/tiSignWindow.h"
#include <revolution/gx.h>
#include <revolution/sc.h>
#include <new>
namespace textinput {
static EventObserver sDefaultObserver;
Manager::Manager(MEMAllocator* allocator, nw4r::lyt::MultiArcResourceAccessor* multiArc,
textinput::EventObserver* event)
: mpAllocator(allocator), mpMultiArcResourceAccessor(multiArc), mpEditBuffer(NULL), mpHWKeyboard(NULL),
mpPCKeyboard(NULL), mpCellPhoneKeyboard(NULL), mpInputForm(NULL), mpCandidateBox(NULL), mpToolBar(NULL),
mpPredictLanguageDialog(NULL), mpSignWindow(NULL), mpEventObserver(event),
meDestination(DST_JP), meLanguage(JP), mbAspectRatio4x3(true) {
if (event == NULL) {
mpEventObserver = &sDefaultObserver;
}
}
Manager::~Manager() {
if (mpPCKeyboard != NULL) {
mpPCKeyboard->~LayoutByNW4R();
MEMFreeToAllocator(mpAllocator, mpPCKeyboard);
}
if (mpCellPhoneKeyboard != NULL) {
mpCellPhoneKeyboard->~LayoutByNW4R();
MEMFreeToAllocator(mpAllocator, mpCellPhoneKeyboard);
}
if (mpInputForm != NULL) {
mpInputForm->~LayoutByNW4R();
MEMFreeToAllocator(mpAllocator, mpInputForm);
}
if (mpCandidateBox != NULL) {
mpCandidateBox->~LayoutByNW4R();
MEMFreeToAllocator(mpAllocator, mpCandidateBox);
}
if (mpToolBar != NULL) {
mpToolBar->~LayoutByNW4R();
MEMFreeToAllocator(mpAllocator, mpToolBar);
}
if (mpPredictLanguageDialog != NULL) {
mpPredictLanguageDialog->~LayoutByNW4R();
MEMFreeToAllocator(mpAllocator, mpPredictLanguageDialog);
}
if (mpSignWindow != NULL) {
mpSignWindow->~LayoutByNW4R();
MEMFreeToAllocator(mpAllocator, mpSignWindow);
}
if (mpHWKeyboard != NULL) {
mpHWKeyboard->~HWKeyboard();
MEMFreeToAllocator(mpAllocator, mpHWKeyboard);
}
if (mpEditBuffer != NULL) {
mpEditBuffer->~EditBuffer();
MEMFreeToAllocator(mpAllocator, mpEditBuffer);
}
}
keyboard::hwkey::HWKeyboard::~HWKeyboard() {}
void Manager::create(MEMAllocator* allocator) {
mpEditBuffer = createEditBuffer();
mpEditBuffer->inputform::EditBuffer::create(mpAllocator);
mpHWKeyboard = createHWKeyboard();
mpPCKeyboard = (keyboard::pctype::LayoutByNW4R*)createPCTypeKeyboard();
mpPCKeyboard->create(mpAllocator);
mpCellPhoneKeyboard = (keyboard::cellphonetype::LayoutByNW4R*)createCellPhoneTypeKeyboard();
mpCellPhoneKeyboard->create(mpAllocator);
mpInputForm = createInputForm();
mpInputForm->create(mpAllocator, mpEditBuffer);
mpCandidateBox = (candidatebox::LayoutByNW4R*)createCandidateBox();
mpCandidateBox->create(mpAllocator);
mpToolBar = (toolbar::LayoutByNW4R*)createToolBar();
mpToolBar->create(mpAllocator);
mpPredictLanguageDialog = (predictlang::LayoutByNW4R*)createPredictLanguageDialog();
mpPredictLanguageDialog->create(mpAllocator);
mpSignWindow = (keyboard::signwindow::LayoutByNW4R*)createSignWindow();
mpSignWindow->create(mpAllocator);
initAspect();
init();
}
void Manager::initAspect() {
if (SCGetAspectRatio() == SC_ASPECT_RATIO_16x9) {
setLayoutScaleFor16x9();
mbAspectRatio4x3 = false;
} else {
setLayoutScaleFor4x3();
mbAspectRatio4x3 = true;
}
}
void Manager::init() {
input::HKBManager::getInstance().ClearState();
mpInputForm->clearSender();
mpHWKeyboard->setCommandReceiver(mpInputForm);
mpPCKeyboard->setCommandReceiver(mpInputForm);
mpCellPhoneKeyboard->setCommandReceiver(mpInputForm);
mpCandidateBox->setCommandReceiver(mpInputForm);
mpPredictLanguageDialog->setCommandReceiver(mpInputForm);
mpSignWindow->setCommandReceiver(mpInputForm);
mpInputForm->setCandidateBox(mpCandidateBox);
mpPCKeyboard->setPredictLanguageDialog(mpPredictLanguageDialog);
mpPCKeyboard->setSignWindow(mpSignWindow);
mpCellPhoneKeyboard->setPredictLanguageDialog(mpPredictLanguageDialog);
mpCellPhoneKeyboard->setSignWindow(mpSignWindow);
if (mbAspectRatio4x3 == true) {
setLayoutScaleFor4x3();
} else {
setLayoutScaleFor16x9();
}
mpPredictLanguageDialog->setDestination(meDestination);
mpInputForm->setDestination(meDestination);
mpInputForm->setLanguage(meLanguage);
mpPCKeyboard->setLanguage(meLanguage);
mpCellPhoneKeyboard->setLanguage(meLanguage);
mpSignWindow->setLanguage(meLanguage);
mpCandidateBox->setLanguage(meLanguage);
mpToolBar->setLanguage(meLanguage);
mpPredictLanguageDialog->setLanguage(meLanguage);
mpHWKeyboard->setLanguage(meDestination, meLanguage);
mpHWKeyboard->init();
mpPCKeyboard->init();
mpCellPhoneKeyboard->init();
mpInputForm->init();
mpCandidateBox->init();
mpToolBar->init();
mpPredictLanguageDialog->init();
mpSignWindow->init();
setFixedPredictionJP(0, NULL);
setSecretInputMode(false);
}
void Manager::setFixedPredictionJP(int num, const char** predicts) {
static_cast<tistring::WithAtok*>(getInputForm()->getAtokString())->setFixPrediction(num, predicts);
}
void Manager::calc() {
if (mpToolBar->isQwerty()) {
mpPCKeyboard->calc();
} else {
mpCellPhoneKeyboard->calc();
}
mpToolBar->calc();
mpCandidateBox->calc();
mpInputForm->calc();
if (mpPredictLanguageDialog->isActive()) {
mpPredictLanguageDialog->calc();
}
if (mpSignWindow->isActive()) {
mpSignWindow->calc();
}
}
void Manager::draw() {
GXSetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
mpToolBar->draw();
mpInputForm->draw();
if (mpToolBar->isQwerty()) {
mpPCKeyboard->draw();
} else {
mpCellPhoneKeyboard->draw();
}
mpCandidateBox->draw();
if (mpPredictLanguageDialog->isActive()) {
mpPredictLanguageDialog->draw();
}
if (mpSignWindow->isActive()) {
mpSignWindow->draw();
}
}
bool Manager::updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release) {
bool qwerty = mpToolBar->isQwerty();
nw4rmanager::TiEventHandler::Input input;
input.field_0x00 = chan;
input.mfX = x;
input.mfY = y;
input.field_0x0C = trig;
input.field_0x10 = hold;
input.field_0x14 = release;
mpHWKeyboard->keyboard::hwkey::HWKeyboard::updateInput(chan, x, y, trig, hold, release, &input);
if (mpPredictLanguageDialog->isActive()) {
return mpPredictLanguageDialog
->updateInput(chan, x, y, trig, hold, release, &input);
}
mpInputForm->updateInputCommon(chan, trig, hold, release, &input);
if (mpSignWindow->isActive()) {
return mpSignWindow
->updateInput(chan, x, y, trig, hold, release, &input);
}
bool updatedKeyboard;
if (qwerty) {
updatedKeyboard = mpPCKeyboard->updateInput(chan, x, y, trig, hold, release, &input);
} else {
updatedKeyboard = mpCellPhoneKeyboard->updateInput(chan, x, y, trig, hold, release, &input);
}
bool updatedToolBar =
mpToolBar->updateInput(chan, x, y, trig, hold, release, &input);
bool updatedCandBox =
mpCandidateBox->updateInput(chan, x, y, trig, hold, release, &input);
bool updatedInputForm = mpInputForm->updateInput(chan, x, y, trig, hold, release, &input);
bool result = (updatedKeyboard | updatedToolBar | updatedCandBox | updatedInputForm) != 0;
if (mpToolBar->isQwerty() != qwerty) {
getInputForm()->onCommand((CommandReceiver::INPUT_COMMAND)6, NULL);
mpCandidateBox->checkValidation();
if (mpToolBar->isQwerty()) {
mpPCKeyboard->onActive();
} else {
mpCellPhoneKeyboard->onActive();
}
}
return result;
}
bool Manager::updateInput(input::HKBManager& hkbManager) {
bool qwerty = mpToolBar->isQwerty();
if (mpPredictLanguageDialog->isActive()) {
return mpPredictLanguageDialog
->updateInput(hkbManager);
}
if (mpSignWindow->isActive()) {
return mpSignWindow->updateInput(hkbManager);
}
bool updatedKeyboard;
if (qwerty) {
updatedKeyboard = mpPCKeyboard->updateInput(hkbManager);
} else {
updatedKeyboard = mpCellPhoneKeyboard->updateInput(hkbManager);
}
bool updatedToolBar = mpToolBar->updateInput(hkbManager);
bool updatedCandBox = mpCandidateBox->updateInput(hkbManager);
bool updatedInputForm = mpInputForm->updateInput(hkbManager);
bool result = (updatedKeyboard | updatedToolBar | updatedCandBox | updatedInputForm) != 0;
if (mpToolBar->isQwerty() != qwerty) {
getInputForm()->onCommand((CommandReceiver::INPUT_COMMAND)6, NULL);
mpCandidateBox->checkValidation();
if (mpToolBar->isQwerty()) {
mpPCKeyboard->onActive();
} else {
mpCellPhoneKeyboard->onActive();
}
}
return result;
}
wchar_t* Manager::getWCString() const {
return mpInputForm->getWCString();
}
void Manager::setWCString(const wchar_t* string) {
mpInputForm->inputform::Base::setString(string);
}
void Manager::setLanguage(Language language) {
meLanguage = language;
}
void Manager::setDestination(Destination destination) {
meDestination = destination;
}
void Manager::limitStringLength(u32 limitStringLength) {
mpInputForm->limitStringLength(limitStringLength);
}
void Manager::limitRowNum(u32 limitRowNum) {
mpInputForm->limitRowNum(limitRowNum);
}
void Manager::setAnimationOn(bool flag) {
mpPCKeyboard->setAnimOn(flag);
mpCellPhoneKeyboard->setAnimOn(flag);
mpInputForm->setAnimOn(flag);
mpCandidateBox->setAnimOn(flag);
mpToolBar->setAnimOn(flag);
mpPredictLanguageDialog
->setAnimOn(flag);
mpSignWindow
->setAnimOn(flag);
}
void Manager::setAspectRatio(bool b4x3) {
mbAspectRatio4x3 = b4x3;
if (mbAspectRatio4x3 == true) {
setLayoutScaleFor4x3();
} else {
setLayoutScaleFor16x9();
}
}
void Manager::setTitleText(wchar_t* titleText) {
nw4r::lyt::Pane* pane = mpInputForm->getPane("T_title_text");
nw4r::lyt::TextBox* textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(pane);
if (textBox != NULL) {
textBox->SetString(titleText, 0);
}
}
void Manager::setLayoutScaleFor16x9() {
mpPCKeyboard->setRootPaneScaleFor16x9();
mpCellPhoneKeyboard->setRootPaneScaleFor16x9();
mpInputForm->setRootPaneScaleFor16x9();
mpCandidateBox->setRootPaneScaleFor16x9();
mpToolBar->setRootPaneScaleFor16x9();
mpPredictLanguageDialog
->setRootPaneScaleFor16x9();
mpSignWindow
->setRootPaneScaleFor16x9();
}
void Manager::setLayoutScaleFor4x3() {
mpPCKeyboard->setRootPaneScaleFor4x3();
mpCellPhoneKeyboard->setRootPaneScaleFor4x3();
mpInputForm->setRootPaneScaleFor4x3();
mpCandidateBox->setRootPaneScaleFor4x3();
mpToolBar->setRootPaneScaleFor4x3();
mpPredictLanguageDialog
->setRootPaneScaleFor4x3();
mpSignWindow
->setRootPaneScaleFor4x3();
}
inputform::EditBuffer* Manager::createEditBuffer() {
return new (MEMAllocFromAllocator(mpAllocator, sizeof(inputform::EditBuffer))) inputform::EditBuffer();
}
keyboard::hwkey::HWKeyboard* Manager::createHWKeyboard() {
return new (MEMAllocFromAllocator(mpAllocator, sizeof(keyboard::hwkey::HWKeyboard))) keyboard::hwkey::HWKeyboard(this);
}
void* Manager::createPCTypeKeyboard() {
return new (MEMAllocFromAllocator(mpAllocator, sizeof(keyboard::pctype::Sample))) keyboard::pctype::Sample(this, mpMultiArcResourceAccessor, "fs_VK_ascii_keytop_a.brlyt", mpEventObserver);
}
void* Manager::createCellPhoneTypeKeyboard() {
return new (MEMAllocFromAllocator(mpAllocator, sizeof(keyboard::cellphonetype::Sample))) keyboard::cellphonetype::Sample(this, mpMultiArcResourceAccessor, "fs_VK_cellPhone_a.brlyt", mpEventObserver);
}
InputForm* Manager::createInputForm() {
return new (MEMAllocFromAllocator(mpAllocator, sizeof(inputform::Sample)))
inputform::Sample(this, mpMultiArcResourceAccessor, "fs_VK_textBox_a.brlyt", mpEventObserver, NULL);
}
void* Manager::createCandidateBox() {
return new (MEMAllocFromAllocator(mpAllocator, sizeof(candidatebox::Sample))) candidatebox::Sample(this, mpMultiArcResourceAccessor, "fs_VK_predictInput_a.brlyt", mpEventObserver);
}
void* Manager::createToolBar() {
return new (MEMAllocFromAllocator(mpAllocator, sizeof(toolbar::Sample))) toolbar::Sample(this, mpMultiArcResourceAccessor, "fs_VK_toolbar_a.brlyt", mpEventObserver);
}
void* Manager::createPredictLanguageDialog() {
return new (MEMAllocFromAllocator(mpAllocator, sizeof(predictlang::Sample))) predictlang::Sample(this, mpMultiArcResourceAccessor, "fs_prdicSelWidw_a.brlyt", mpEventObserver);
}
void* Manager::createSignWindow() {
return new (MEMAllocFromAllocator(mpAllocator, sizeof(keyboard::signwindow::Sample))) keyboard::signwindow::Sample(this, mpMultiArcResourceAccessor, "fs_signWindow_a.brlyt", mpEventObserver);
}
void Manager::startPredictTurnOn(bool flag) {
if (getInputForm()->isPredictOn() != flag) {
getCandidateBox()->startTurnOn(flag);
}
}
bool Manager::isPredictTurning() const {
return getCandidateBox()->getOnOffButton().IsTurning();
}
void Manager::enableCompatibleFilter(bool compatibleFilter) {
inputform::DeadKeyStream::sbCompatibleFilterEnabled = compatibleFilter;
}
void Manager::enableKSXFilter(bool flag) {
static_cast<tistring::Decolated*>(mpEditBuffer->getString())->EnableKSXFilter(flag);
static_cast<tistring::Decolated*>(mpEditBuffer->getZiString())->EnableKSXFilter(flag);
}
bool Manager::isVacancy() const {
if (getInputForm() == NULL || getToolBar() == NULL) {
return true;
}
if (!getToolBar()->isQwerty()) {
if (getCellPhoneKeyboard()->isHoldingButton()) {
return false;
}
}
return getInputForm()->inputform::Base::isVacancy();
}
const InputForm* Manager::getInputForm() const {
return mpInputForm;
}
const keyboard::cellphonetype::LayoutByNW4R* Manager::getCellPhoneKeyboard() const {
return mpCellPhoneKeyboard;
}
void Manager::SetFont(nw4r::lyt::FontRefLink* fontLink) {
nw4r::ut::Font* font = fontLink->GetFont();
if (mpToolBar != NULL) {
mpToolBar->SetFontForce(font);
}
if (mpPCKeyboard != NULL) {
mpPCKeyboard->SetFontForce(font);
}
if (mpCandidateBox != NULL) {
mpCandidateBox->SetFontForce(font);
}
if (mpSignWindow != NULL) {
mpSignWindow
->SetFontForce(font);
}
if (mpInputForm != NULL) {
((nw4r::ut::CharWriter*)((char*)mpInputForm + 0x10))->SetFont(*font);
}
if (mpCellPhoneKeyboard != NULL) {
mpCellPhoneKeyboard->SetFontForce(font);
}
}
void* Manager::getPredictLanguageSelectDialog() {
return mpPredictLanguageDialog;
}
const void* Manager::getPredictLanguageSelectDialog() const {
return mpPredictLanguageDialog;
}
void* Manager::getSignKeyboard() {
return mpSignWindow;
}
const void* Manager::getSignKeyboard() const {
return mpSignWindow;
}
void Manager::setDefaultPredictionJP(int num, const char** predicts) {
static_cast<tistring::WithAtok*>(getInputForm()->getAtokString())->setDefaultPrediction(num, predicts);
}
void predictlang::Base::init() {}
keyboard::pctype::Sample::~Sample() {}
keyboard::cellphonetype::Sample::~Sample() {}
candidatebox::Sample::~Sample() {}
inputform::Sample::~Sample() {}
keyboard::signwindow::Sample::~Sample() {}
} // namespace textinput

File diff suppressed because it is too large Load Diff

View File

@@ -490,7 +490,7 @@ void EventHandler::onTiEvent(gui::PaneComponent* paneComponent, u32 event, Input
s32 eventType = event;
const char* name = paneComponent->getPane()->GetName();
if (!mpLayoutByNW4R->isLocked() || event != 4) {
if (event == 4 && (input->trigger & 0x800) != 0) {
if (event == 4 && (input->field_0x0C & 0x800) != 0) {
mpLayoutByNW4R->onKey(4, const_cast<char*>(name));
}
if (name[0] == 'B') {
@@ -502,7 +502,7 @@ void EventHandler::onTiEvent(gui::PaneComponent* paneComponent, u32 event, Input
if (pane != NULL) {
switch (eventType) {
case 4:
if ((input->trigger & 0x800) != 0) {
if ((input->field_0x0C & 0x800) != 0) {
pane->onAnmEvent(nw4rmanager::AnmPane::PE_0);
}
break;

View File

@@ -1,6 +1,7 @@
#define TISTRING_IMPLEMENTATION
#include "keyboard/tiString.h"
#include "keyboard/tiUtil.h"
#include <revolution/kpr.h>
#include <wchar.h>
extern "C" {
@@ -144,12 +145,12 @@ wchar_t StringBase::getLastWChar() {
void Decolated::inputChar(wchar_t ch) {
if (ch != 0xfffe) {
wchar_t input[8];
u16 count;
input[4] = 0;
input[3] = 0;
input[2] = 0;
input[1] = 0;
input[0] = 0;
u16 count;
if (static_cast<u32>(mTranslateMode) - 1 > 1) {
goto nonKana;
}
@@ -172,15 +173,21 @@ void Decolated::inputChar(wchar_t ch) {
goto inputReady;
}
nonKana:
if (mTranslateMode == 3) {
input[0] = ch;
input[1] = 0;
count = 1;
if ((s32)mTranslateMode == 3) {
int i = 0;
input[i] = 0;
if (ch == 10) {
i = 0;
}
input[i++] = ch;
count = i;
input[i] = 0;
mKanaStream.mOutput[0] = 0;
} else {
count = 1;
input[0] = ch;
input[1] = 0;
count = 0;
input[count] = ch;
count++;
input[count] = 0;
}
inputReady:
setCandidate(0);
@@ -389,7 +396,7 @@ void Decolated::replaceAtCursor(wchar_t ch) {
}
bool Decolated::isDakuten() {
return util::KBD_IsDakuten(getWCharAtCursor());
return util::KBD_IsDakuten(getWCharAtCursor()) != 0;
}
void Decolated::converDakuten() {
@@ -398,7 +405,7 @@ void Decolated::converDakuten() {
}
bool Decolated::isHandaku() {
return util::KBD_IsHandaku(getWCharAtCursor());
return util::KBD_IsHandaku(getWCharAtCursor()) != 0;
}
void Decolated::converHandaku() {
@@ -412,7 +419,7 @@ void Decolated::convertAll() {
}
bool Decolated::isSmall() {
return util::KBD_IsSmall(getWCharAtCursor());
return util::KBD_IsSmall(getWCharAtCursor()) != 0;
}
void Decolated::converSmall() {

View File

@@ -273,8 +273,8 @@ namespace textinput {
f32 xOffset = left;
xOffset *= scale - 1.0f;
viewport[0] = left + xOffset;
f32 height = (mProjectionRect.bottom -
mProjectionRect.top) * 0.5f;
f32 height = 0.5f * (mProjectionRect.bottom -
mProjectionRect.top);
viewport[1] = rect.bottom + height;
viewport[2] = scale * (100.0f + (rect.right - rect.left));
viewport[3] = rect.top - rect.bottom;

View File

@@ -115,8 +115,8 @@ void WithZi::clearCandidates() {
mCandidateCount = 0;
memset(ElementBuffer, 0, 0x1fe);
memset(CandidatesBuffer, 0, 0x200);
memset(CandidatesBuffer + 0x100, 0, 0x1fe);
memset(CandidatesBuffer + 0x200, 0, 0x200);
memset(&CandidatesBuffer[0x100], 0, 0x1fe);
memset(&CandidatesBuffer[0x200], 0, 0x200);
memset(CandidatedWord, 0, 0x1400);
memset(&mSearch, 0, sizeof(mSearch) + sizeof(mSearchState));
mSearch.language = getPredictLanguage();

View File

@@ -98,6 +98,21 @@ namespace ipl {
getLetterInputForm()->setSendOutMessage(System::getMessage(MESG_LETTERWRITER_SENDING));
}
void textinput::extend::memo::InputForm::setNigaoeEventObserver(NigaoeEventObserver* nigaoeObserver) {
mpNigaoeObserver = nigaoeObserver;
}
void textinput::extend::letter::InputForm::setPhotoDraw(bool photoDraw) {
mbPhotoDraw = photoDraw;
}
void textinput::extend::letter::InputForm::setType(Type type) {
meType = type;
}
void textinput::Manager::start() {
}
FaderSceneCommand LetterWriter::calcFadein() {
return TextWriter::calcFadein();
}
@@ -202,6 +217,10 @@ namespace ipl {
return mpCaptionString->getWCString();
}
wchar_t* textinput::tistring::StringBase::getWCString() const {
return mpszString;
}
FaderSceneCommand LetterWriter::calcNormal() {
const wchar_t* caption;
@@ -291,6 +310,9 @@ namespace ipl {
System::getKeyboard()->endMgr();
}
void textinput::Manager::end() {
}
FaderSceneCommand LetterWriter::calcFadeout() {
return TextWriter::calcFadeout();
}

View File

@@ -14,6 +14,10 @@
namespace ipl {
namespace scene {
inline void textinput::textdrawer::Base::setSecretModeOn(bool secretMode) {
mbSecretMode = secretMode;
}
// clang-format off
const char* ParentalDialog::smButtonName[ParentalDialog::BTN_MAX] = {
"B_BtnA",
@@ -166,9 +170,9 @@ namespace ipl {
case keyboard::Manager::STATE_APPEARING: {
if (state->wcString != NULL) {
if (*state->wcString == 0) {
System::getKeyboard()->memoMgr()->setTitleText(System::getMessage(MESG_PARENTAL_DLG_NO_PIN));
System::getKeyboard()->memoMgr()->setTitleText(const_cast<wchar_t*>(System::getMessage(MESG_PARENTAL_DLG_NO_PIN)));
} else {
System::getKeyboard()->memoMgr()->setTitleText(L"");
System::getKeyboard()->memoMgr()->setTitleText(const_cast<wchar_t*>(L""));
}
}
break;
@@ -316,7 +320,7 @@ namespace ipl {
System::getKeyboard()->start(chan, setting);
System::getKeyboard()->memoMgr()->setSecretInputMode(true);
System::getKeyboard()->memoMgr()->setTitleText(System::getMessage(MESG_PARENTAL_DLG_NO_PIN));
System::getKeyboard()->memoMgr()->setTitleText(const_cast<wchar_t*>(System::getMessage(MESG_PARENTAL_DLG_NO_PIN)));
mState = STATE_WAIT_INPUT;

View File

@@ -13,7 +13,9 @@
#undef IPL_SOUND_RECT_OUT_OF_LINE
extern "C" ipl::System::Arg smArg__Q23ipl6System;
extern "C" void __as__Q49textinput6extend8savedata11MemoSettingFRCQ49textinput6extend8savedata11MemoSetting();
extern "C" void __as__Q49textinput6extend8savedata11MemoSettingFRCQ49textinput6extend8savedata11MemoSetting(
textinput::extend::savedata::MemoSetting* dst,
const textinput::extend::savedata::MemoSetting* src);
extern "C" void setMemoSetting__Q33ipl8savedata7ManagerFRCQ49textinput6extend8savedata11MemoSetting();
extern "C" void flushAsync__Q33ipl8savedata7ManagerFPQ23EGG4Heap();
@@ -235,7 +237,7 @@ namespace ipl {
textinput::extend::savedata::MemoSetting memoSetting;
memoSetting = System::getSaveData()->getMemoSetting();
memoSettingCopy = memoSetting;
mSaveData = memoSettingCopy;
__as__Q49textinput6extend8savedata11MemoSettingFRCQ49textinput6extend8savedata11MemoSetting(&mSaveData, &memoSettingCopy);
// Memo manager
mpManager = new (heap, 4) textinput::MemoManager(allocator, multiArc, &mEvent);
@@ -280,7 +282,48 @@ namespace ipl {
mpManager->setLanguage(textinput::JP);
#endif // JAPANESE_BUILD
}
} // namespace keyboard
} // namespace ipl
extern "C" void __as__Q49textinput6extend8savedata11MemoSettingFRCQ49textinput6extend8savedata11MemoSetting(
textinput::extend::savedata::MemoSetting* dst,
const textinput::extend::savedata::MemoSetting* src) {
dst->uRevisionAndType = src->uRevisionAndType;
dst->uRawData.val[0] = src->uRawData.val[0];
dst->uRawData.val[1] = src->uRawData.val[1];
dst->uRawData.val[2] = src->uRawData.val[2];
dst->uRawData.val[3] = src->uRawData.val[3];
dst->uRawData.val[4] = src->uRawData.val[4];
dst->uRawData.val[5] = src->uRawData.val[5];
dst->uRawData.val[6] = src->uRawData.val[6];
}
namespace textinput {
namespace extend {
namespace memo {
void Manager::setSaveData(savedata::MemoSetting memoSetting) {
__as__Q49textinput6extend8savedata11MemoSettingFRCQ49textinput6extend8savedata11MemoSetting(&mMemoSetting, &memoSetting);
}
}
}
}
namespace ipl {
namespace keyboard {
void EventObserver::setManager(Manager* manager) {
mpKeyboardMgr = manager;
}
}
}
namespace nw4r {
namespace lyt {
FontRefLink::~FontRefLink() {}
}
}
namespace ipl {
namespace keyboard {
void Manager::init() {
mpManager->init();
@@ -438,7 +481,21 @@ namespace ipl {
}
}
}
} // namespace keyboard
} // namespace ipl
namespace textinput {
namespace extend {
namespace memo {
State* Manager::getState() {
return mpCurrentState;
}
}
}
}
namespace ipl {
namespace keyboard {
void Manager::draw() {
mpManager->draw();
GXSetZMode(GX_TRUE, GX_ALWAYS, GX_TRUE);
@@ -464,7 +521,7 @@ namespace ipl {
}
mpManager->limitStringLength(setting.stringLimit);
mpManager->limitRowNum(setting.rowLimit);
mpManager->setTitleText(L"");
mpManager->setTitleText(const_cast<wchar_t*>(L""));
mpManager->changeState(textinput::extend::memo::Manager::STL_Transition);
// Open!
@@ -482,7 +539,21 @@ namespace ipl {
doSave();
}
}
} // namespace keyboard
} // namespace ipl
namespace textinput {
namespace extend {
namespace memo {
Manager::ConfigType Manager::getConfigType() {
return meConfigType;
}
}
}
}
namespace ipl {
namespace keyboard {
void Manager::cancel() {
mState.pressOK = false;
mpManager->changeState(textinput::extend::memo::Manager::STL_Transition);
@@ -721,7 +792,21 @@ namespace ipl {
addi r1, r1, 0x30
blr
}
} // namespace keyboard
} // namespace ipl
namespace textinput {
namespace extend {
namespace memo {
savedata::MemoSetting Manager::getSaveData() {
return mMemoSetting;
}
}
}
}
namespace ipl {
namespace keyboard {
void Manager::touchFormInDisp(int unused) {
mpManager->changeState(textinput::extend::memo::Manager::STL_Transition);
snd::getSystem()->startSE("WIPL_SE_SK_OPEN");

View File

@@ -1514,6 +1514,16 @@ namespace ipl {
}
} // namespace ipl
namespace textinput {
void EventObserver::onOutOfLength() { printf("OutOfLength\n"); }
void EventObserver::onCancel() { printf("Cancel!\n"); }
void EventObserver::onOK() { printf("OK!\n"); }
void EventObserver::onSE(sound::SE seId) {}
void EventObserver::onEvent(nw4r::lyt::Pane* pane, u32 event) {}
void EventObserver::onCommand(CommandReceiver::INPUT_COMMAND command, void* data) {}
void EventObserver::onInput(CommandReceiver::INPUT_COMMAND command, void* data) {}
} // namespace textinput
#ifdef __MWERKS__
#pragma force_active on
extern "C" const f32 lbl_81694424 = -304.0f;

View File

@@ -25,3 +25,25 @@ The initial source had 42 instruction-exact functions. Correcting the guarded ba
The unit remains `NonMatching`. All original code functions match; data has separate unresolved differences and no linking claim is made. All shared-header changes are guarded by `MYTIINPUTFORM_IMPLEMENTATION`, defined only in this source file.
The default gate merge-base is `112e4e1a`, for which the supplied tools have no baseline report. Gates use the available parent snapshot explicitly: `--base 0aca3c76`. No supplied baseline or tool was edited. Regression checks against that snapshot remain zero.
## Final state (second pass)
All 84 target functions at objdiff 100.0; `.text`/`.rodata`/`.sdata`/`.sdata2` all 100%; `.data` content byte-identical (0 diffs, 1616B) but scores 69.06% — the remaining 31% is symbol-name pairing only: base `.data` carries extraction-generated `lbl_8166xxxx`/`jumptable_8166xxxx` names while MWCC emits anonymous `@NNNN` labels for literal strings/jump tables; the same residual family documented for tiManager (.data 92.998%).
Mechanisms verified this pass:
- MWCC weak-vtable emission = reverse class-declaration order within a TU; reordering memo's local class decls landed all 7 vtables at byte-identical addresses.
- `gui::EventHandler` model: `~EventHandler` inline `{}` in every TU (base dtor folds to 16 insns); the other three virtuals decl-only everywhere with the single out-of-line impls in tiPcKeyboard.cpp.
- InputForm's six trailing zero vtable slots = six impl-guarded pure photo hooks (`getPhotoPaneMaterial`/`onPhotoTrig`/`onPhotoPoint`/`onPhotoLeft`/`isPhotoScaledUp`/`setPhotoDraw`), proven by letter::InputForm's vtable overriding the inherited slots with real impls at identical positions.
- MWCC emits `@N@fn` adjustor thunks WEAK in every TU whose emitted vtable references them (scratch-tested); the base .o shows them UNDEF because the linker attributes each weak thunk to one object — unfixable .o-level divergence, identical to the fused-name artifact at symbols.txt:5832.
- 32 extra weak fn defs in our .o vs base (thunks + inline virtuals) are not counted by objdiff; the unit's function/code metrics are unaffected.
AnmPane's 48B extraction label vs 44B real extent: the trailing 4B "zero" is an unlabeled adjacent object merged into the extraction extent, not a vtable slot (subclass vts are 44B without it). Content already identical.
## Session w0929-2: unit code 100% (84/84 fns)
- BREAKTHROUGH: `mbAbleToUp`/`mbAbleToDown`/`mbSeparator` are BASE-class members of `inputform::LayoutByNW4R` at 0x2CC/0x2CD/0x2CE (inside former `unk_0x2C0[0x10]` tail), not derived-class fields. Moving them fixed `init`+`calc` (both -> diffs 0). Derived `MyTiInputForm` writes via inherited names.
- Pane dtor linkage: in-class `virtual ~X() {}` -> WEAK; `virtual ~X();` + out-of-line `X::~X(){}` in same TU -> GLOBAL. Applied to WholePane/NigaoePane/SimpleAnmPane.
- `AnimPaneGroup(group)` ctor must inline `List_Init(&mAnmPaneList, offsetof(AnmPane, mGroupLink))` (arg 0x24) — added to tiNw4rManager.h ctor. Fixed `create__ScrollButton` (was missing the call -> 4-insn hole).
- `mExScrollAnm.startAnm(NULL, mfScroll, scroll, 15.0f, NULL)` (inline wrapper) vs direct virtual overload `startAnm(mfScroll, scroll, 15.0f, observer, arg)` — base uses the direct form (int-args emitted before floats). Fixed onArrowRTrig/onArrowLTrig.
- `AnimationFile` = `{u32 id; char name[0x40]}` (0x44, embedded names) — base .rodata confirms.
- Data: ALL sections byte-identical except .sdata tail — base 0x48 (8-aligned end), mine 0x43: last string "B_ArwL" padded to char[12]-equivalent in base (5 trailing zeros). No relocs into pad; likely section-end pad artifact or last-string emitted via char[12] member. Also base emits .sdata2 BEFORE .sdata in section order; mine reversed.

View File

@@ -2,7 +2,7 @@
"""Compact function diff with context: python ctxdiff.py <unit> <symbol> [--full]"""
import sys
sys.path.insert(0, "/home/cole/projects/tests")
sys.path.insert(0, "/home/ubuntu/decomp")
from odiff import dis, sym
import os
import itertools

View File

@@ -0,0 +1,34 @@
#!/usr/bin/env python3
"""Local ctxdiff: compare a function in my .o vs orig .o.
usage: ldiff.py <unit> <symbol> [unit2] — unit like keyboard/tiCellPhone"""
import sys, subprocess, re
def disasm(obj, sym):
out = subprocess.check_output(['powerpc-eabi-objdump', '-dr', obj],
stderr=subprocess.DEVNULL).decode('latin1')
lines = out.splitlines()
res, cur = [], None
for l in lines:
m = re.match(r'^[0-9a-f]+ <([^>]+)>:', l)
if m:
cur = m.group(1)
if cur == sym:
im = re.match(r'^\s*([0-9a-f]+):\s+([0-9a-f ]+)\s+(\S+)(.*)$', l)
if im:
res.append((im.group(3), im.group(4).strip()))
if res and l.strip() == '':
break
return res
def main():
unit, name = sys.argv[1], sys.argv[2]
mine = disasm(f'build/43U/src/src/{unit}.o', name)
base = disasm(f'build/43U/obj/src/{unit}.o', name)
print(f'insns mine={len(mine)} base={len(base)}')
import difflib
a = [f'{m} {o}' for m, o in mine]
b = [f'{m} {o}' for m, o in base]
for d in difflib.unified_diff(b, a, 'base', 'mine', lineterm='', n=3):
print(d)
main()

View File

@@ -39,3 +39,12 @@ Measured trials:
- static initializer attempt 1: src 0x64 base 0x64 insns 25/25; diffs 0: []
- static initializer attempt 2: src 0x64 base 0x64 insns 25/25; diffs 22: [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]
- static initializer attempt 3: src 0x64 base 0x64 insns 25/25; diffs 0: []
## LayoutByNW4R::create — session 3
The inlined UITextArea::Init loop: base carries `this+i*4` as an incremented
pointer (mr r26,r31; lwz 0x11c(r26); r26+=4) covering both adjacent arrays via
+0x50; mine recomputes `add r3,r31,r30` per iter. Tried explicit pointer-walk
(`p = mpTextBoxPane; p != end; ++p`, `p[NUM_PANES]` for bounding, two-pointer
p+e) — MWCC materializes both array bases instead; index form is the least
bad. Strength-reduction tie; create stays 351v352.

View File

@@ -214,3 +214,18 @@ textinput::keyboard::pctype::LayoutByNW4R::updateInput(textinput::input::HKBMana
textinput::keyboard::pctype::EventHandler::onTiEvent(textinput::gui::PaneComponent*, unsigned long, textinput::nw4rmanager::TiEventHandler::Input*): objdiff 88.83249; src 0x310 base 0x314 insns 196/197 | --- replace mine 17:18 base 17:18 | M 17 bne 692 | B 17 bne 696
@236@onEvent__Q49textinput8keyboard6pctype12LayoutByNW4RFPQ49textinput8keyboard6pctype5: objdiff None; target name absent; canonical thunk name differs
## Third pass (setTranslateMode solved, updateInput narrowing)
- setTranslateMode: SOLVED 105/105 diffs 0 — `u32 keyMode;` declared UNINITIALIZED with 3-case
switch and NO default: invalid-mode paths reach the compare with stale r31 (original UB).
- updateInput(HKBManager&): 227/227 insns, 1 diff @109 — base clrlwi r26,r3 (s16->u16
conversion materialized) vs mine mr; MWCC lazy-width elides the mask since the lha value
is already provably 16-bit. Tried: wchar_t/u16/int/u16-code/&0xFFFF/(u16) casts —
all elided or regressed. Documented lazy-width tie-break.
- @236@onEvent thunk: present in mine (8B, addi+b) but base symtab name is TRUNCATED
mid-mangle ("...pctype5" ~87 chars, no UIObjUlPv tail) — extraction name cap,
unmatchable by name. Same family as fused-name artifact.
- Data: .rodata/.data/.sdata2 byte-identical; .sdata/.bss/.sbss differ only by trailing
zero pads (name/pad family). matched_data 32% is a name-pairing artifact.
- Unit state: 136/141 fns 100; getControlKey/onPressedShift/onReleasedShift remain
documented reg-permutation tie-breaks (5+ forms each).

View File

@@ -15,3 +15,16 @@ Initial reconstruction uses the sibling tiString and tiUtil headers, real member
## character predicates
The sibling util declarations return bool, while target callers normalize an integer result. Guarded u32 declarations preserve every other translation unit and make all three predicates 16/16 with zero differences.
## inputChar mode==3 block — session 3
Base emits `input[0]=0` direct store, dead `cmplwi ch,0xa`, then `input[i]=ch`
via indexed `sthx` with i=0 in a reg, `i++`, `input[i]=0`, `count=i`,
`mOutput[0]=0`. For the indexed stores to survive, the index must be a variable
MWCC cannot constant-fold yet provably zero. Tried and ALL fold to direct
stores: u16/int/u32 index locals, `i++`/`++i` mutation, if/else identical arms,
`(ch==10)?10:ch` ternary (keeps compare but adds select insns), function-scope
shared `inputIndex` across the goto boundary, `static_cast<u8>` index casts,
`input[i&0xff]`, do-while(0) loop form. MWCC const-props through all of them.
The dead `cmplwi` + indexed-store pair has no reachable source form; retained
the readable direct-store version (125v136 insns).

View File

@@ -43,3 +43,17 @@ Remaining: pooled buffer base setup and callee-saved register assignments, with
3. Unsigned source/destination indices, store via length - 1: 56/56, same differences.
4. Remove the now-unused destination index: retained readable implementation; no output change.
Remaining: copy-loop address strength reduction, scheduling and caller-register assignments; 86.69643%.
## clearCandidates — session 3
Base binds the first static array (ElementBuffer) to r31 via lis/addi and
recomputes every memset arg as `addi r3,r31,off`; mine CSEs the
CandidatesBuffer base into a 4th callee reg (addi r31,r29,0x200). Tried:
`&arr[i]` vs `arr+i` args, cast forms, memset reorder — all invariant.
Same reverse-bind family: base binds globals high, this low.
## update — session 3
446v448, same family: base binds this->r28, global->r31 (savegpr_24 both);
mine rotates this->r29+ and gains 2 body insns. All-diff regions are pure
reg-name permutations; no structural gap found.