Compare commits
32 Commits
agent/read
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f572c47b3 | ||
|
|
0e4f2c726f | ||
|
|
620a8a6814 | ||
|
|
84972cb9f1 | ||
|
|
54d865f151 | ||
|
|
0e31a5b37c | ||
|
|
8b568557b0 | ||
|
|
19f6c82a98 | ||
|
|
3e81c24a0c | ||
|
|
5e0fbb88f0 | ||
|
|
32da26fae0 | ||
|
|
413e6c483b | ||
|
|
d76c36462f | ||
|
|
f1cc81a228 | ||
|
|
ca4339eece | ||
|
|
0107230f11 | ||
|
|
c77b866ed4 | ||
|
|
550c5f19c1 | ||
|
|
e00d7aefd6 | ||
|
|
92f10a65fa | ||
|
|
e858a9362d | ||
|
|
bd1885f9be | ||
|
|
42647c75c1 | ||
|
|
83a55a20a0 | ||
|
|
46f34f11f5 | ||
|
|
1bc8f49115 | ||
|
|
f055c43c22 | ||
|
|
985bae5d42 | ||
|
|
d4696caeaf | ||
|
|
2b4ed18122 | ||
|
|
02e50d2dc2 | ||
|
|
46d7abf8c0 |
62
.github/workflows/readme-progress.yml
vendored
Normal file
62
.github/workflows/readme-progress.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
name: README progress
|
||||
|
||||
# runs on the self-hosted runner on cole's server so it doesn't use hosted minutes.
|
||||
# only push/schedule/manual triggers, never pull_request, so fork PRs can't reach this machine.
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths-ignore: [README.md]
|
||||
schedule:
|
||||
- cron: "*/30 * * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: readme-progress
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
progress:
|
||||
runs-on: [self-hosted, wii-ipl-local]
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
ORIG_APP: /mnt/drive2/projects/wiichannels/wii-ipl/orig/43U/00000008.app
|
||||
TOOL_CACHE: /mnt/drive2/projects/wiichannels/wii-ipl/build
|
||||
NINJA: /home/cole/projects/tests/.venv/bin/ninja
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
mkdir -p build orig/43U
|
||||
cp "$ORIG_APP" orig/43U/00000008.app
|
||||
[ -d build/compilers ] || cp -a "$TOOL_CACHE/compilers" build/
|
||||
[ -d build/tools ] || cp -a "$TOOL_CACHE/tools" build/
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
python3 configure.py --version 43U
|
||||
"$NINJA"
|
||||
"$NINJA" build/43U/ok
|
||||
|
||||
- name: Report
|
||||
run: build/tools/objdiff-cli report generate -p . -o build/43U/report.json -f json
|
||||
|
||||
- name: Update README
|
||||
run: python3 tools/update_readme_progress.py build/43U/report.json README.md "$GITHUB_SHA"
|
||||
|
||||
- name: Commit
|
||||
run: |
|
||||
if git diff --quiet README.md; then exit 0; fi
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add README.md
|
||||
git commit -m "docs: update progress [skip ci]"
|
||||
git pull --rebase origin main || { git rebase --abort; echo "main moved, next run will update"; exit 0; }
|
||||
git push origin HEAD:main
|
||||
10
README.md
10
README.md
@@ -50,6 +50,16 @@ Supported versions:
|
||||
|
||||
Progress
|
||||
========
|
||||
<!-- progress:start -->
|
||||
| Decompiled | Matched | Linked | Data |
|
||||
|:---:|:---:|:---:|:---:|
|
||||
| 84.89% | 75.24% | 56.76% | 86.70% |
|
||||
|
||||
units 748/1027 complete, functions 10976/12563 matched.
|
||||
|
||||
decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data
|
||||
<!-- progress:end -->
|
||||
|
||||
| Version | Progress |
|
||||
|-----------------------|------------------------------------------------------------------------------|
|
||||
| [Wii Menu 4.3U][V43U] | [![FuncBadgeV43U]][V43U] [![DecompBadgeV43U]][V43U] [![LinkBadgeV43U]][V43U] |
|
||||
|
||||
@@ -61,7 +61,11 @@ namespace ipl {
|
||||
const char* getIconComment(u8 slot, s16 fileNo);
|
||||
|
||||
void initCardThread();
|
||||
#if defined(IPL_MEMORY_CARD_CPP) || defined(IPL_CARD_SEQUENCE_CPP)
|
||||
BOOL shutdownCardThread();
|
||||
#else
|
||||
bool shutdownCardThread();
|
||||
#endif
|
||||
} // namespace memorycard
|
||||
} // namespace ipl
|
||||
|
||||
|
||||
@@ -48,6 +48,9 @@ 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:
|
||||
@@ -74,6 +77,9 @@ 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) {}
|
||||
#endif
|
||||
virtual ~Base();
|
||||
virtual void create(MEMAllocator* allocator) override;
|
||||
virtual void init() override {}
|
||||
@@ -108,6 +114,9 @@ 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
|
||||
@@ -281,6 +290,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; }
|
||||
#endif
|
||||
virtual ~LayoutByNW4R();
|
||||
virtual void create(MEMAllocator* allocator) override;
|
||||
virtual void init() override;
|
||||
@@ -323,6 +339,9 @@ 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);
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
#define TEXTINPUT_CELL_PHONE_H
|
||||
|
||||
#include "tiNw4rManager.h"
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#include "tiKeyboard.h"
|
||||
#endif
|
||||
|
||||
namespace textinput {
|
||||
namespace keyboard {
|
||||
namespace cellphonetype {
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
class Base : public textinput::keyboard::KeyboardBase {
|
||||
#else
|
||||
class Base {
|
||||
#endif
|
||||
public:
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
enum InputMode {
|
||||
IM_00,
|
||||
IM_01,
|
||||
@@ -29,7 +29,12 @@ namespace textinput {
|
||||
virtual void init() override;
|
||||
virtual void updateFromReceiver(u32, void*) override;
|
||||
virtual void onKey(u32, void*) override;
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
Base(Manager* manager) : mpManager(manager) {}
|
||||
virtual int getType() override;
|
||||
#else
|
||||
virtual void getType() override;
|
||||
#endif
|
||||
virtual void onActive() override;
|
||||
virtual void calc();
|
||||
virtual void draw();
|
||||
@@ -74,7 +79,7 @@ namespace textinput {
|
||||
|
||||
virtual void vt_0x4C();
|
||||
virtual void vt_0x50();
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual void doNumericMode(bool);
|
||||
#else
|
||||
virtual void vt_0x54();
|
||||
@@ -90,8 +95,11 @@ namespace textinput {
|
||||
|
||||
// TODO enum?
|
||||
int getInputType() const;
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
void resetHoldingButton();
|
||||
#endif
|
||||
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
private:
|
||||
u32 mPreviousInputMode;
|
||||
u32 mCurrentInputMode;
|
||||
@@ -104,17 +112,47 @@ namespace textinput {
|
||||
u32 mHoldingButton;
|
||||
void* mpInputModeTable;
|
||||
MEMAllocator* mpAllocator;
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
Manager* mpManager;
|
||||
#else
|
||||
void* mpInputSettings;
|
||||
#endif
|
||||
u32 mInputState;
|
||||
#endif
|
||||
};
|
||||
|
||||
class LayoutByNW4R : public Base, public nw4rmanager::Layout {
|
||||
public:
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
|
||||
: Base(manager), nw4rmanager::Layout(accessor, layoutName, observer), mpEventHandler(NULL) {}
|
||||
virtual ~LayoutByNW4R();
|
||||
virtual void create(MEMAllocator* allocator);
|
||||
virtual void init();
|
||||
virtual void setCommandReceiver(CommandReceiver* receiver);
|
||||
virtual void updateFromReceiver(u32 command, void* data);
|
||||
virtual void onKey(u32 event, void* data);
|
||||
virtual void setLanguage(Language language);
|
||||
virtual void update();
|
||||
virtual void onActive();
|
||||
virtual void calc();
|
||||
virtual void draw();
|
||||
virtual void changeInputMode(InputMode mode);
|
||||
virtual void setInputMode(InputMode mode);
|
||||
virtual void setUpperCaseJP(bool upper);
|
||||
virtual void setLangKeyActive(bool active);
|
||||
virtual void goSignInputMode();
|
||||
virtual void changePredictLanguage();
|
||||
virtual void setAbcMode(bool abc);
|
||||
virtual void doNumericMode(bool);
|
||||
virtual void setPredictLanguageDialog(predictlang::LayoutByNW4R* dialog);
|
||||
virtual void setSignWindow(signwindow::LayoutByNW4R* window);
|
||||
#else
|
||||
virtual void doNumericMode(bool);
|
||||
virtual void setPredictLanguageDialog(void*);
|
||||
virtual void setSignWindow(void*);
|
||||
#endif
|
||||
virtual void doNumericWithDotMode(bool);
|
||||
virtual void setLineFeedButton(bool);
|
||||
virtual void setPredictLanguageButton(bool);
|
||||
@@ -124,9 +162,31 @@ namespace textinput {
|
||||
|
||||
void onPressedShift(bool shift);
|
||||
void onReleasedShift();
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
bool hasLineFeedButton() const { return mbLineFeedButton; }
|
||||
private:
|
||||
bool mbLineFeedButton;
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
GXTexObj mSpaceTexture;
|
||||
GXTexObj mSpaceTextureCN;
|
||||
GXTexObj mSpaceTextureKR;
|
||||
nw4rmanager::TiEventHandler* mpEventHandler;
|
||||
predictlang::LayoutByNW4R* mpPredictDialog;
|
||||
signwindow::LayoutByNW4R* mpSignWindow;
|
||||
#endif
|
||||
public:
|
||||
#endif
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_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
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
virtual nw4rmanager::AnmPane* getAnmPane(InputMode mode);
|
||||
virtual void throwReleaseForAll();
|
||||
virtual void changeAnimationAllToNormal();
|
||||
virtual void updatePredictLanguage(CommandReceiver::ChangePredictMode* mode);
|
||||
virtual void changeKeyTop(const struct PaneNameToCharCode* table);
|
||||
virtual void changeSpaceKeyTop(const struct PaneNameToCharCode* table);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -92,6 +92,9 @@ 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;
|
||||
@@ -100,6 +103,7 @@ namespace textinput {
|
||||
mFlightDuration[i] = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
GUIComponent(u32 id)
|
||||
: GUIInterface(), mbInitialize(false), mDraggingButton(0xFFFF), mID(id), mbTriggerTarget(false), mpManager(NULL), mpListener(NULL) {
|
||||
|
||||
@@ -11,6 +11,9 @@ namespace textinput {
|
||||
namespace input {
|
||||
class HKBManager {
|
||||
public:
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
void ClearState();
|
||||
#endif
|
||||
static HKBManager& getInstance() { return sInstance; }
|
||||
|
||||
void Initialize();
|
||||
@@ -19,13 +22,15 @@ namespace textinput {
|
||||
u32 GetModifierState() const;
|
||||
void SetModifierState(u32, u32);
|
||||
|
||||
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
class KeySet {
|
||||
public:
|
||||
u8 GetKey() const;
|
||||
wchar_t 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;
|
||||
|
||||
@@ -8,23 +8,37 @@ namespace textinput {
|
||||
class Manager;
|
||||
namespace keyboard {
|
||||
namespace hwkey {
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
class HWKeyboard : public CommandSender {
|
||||
#else
|
||||
class HWKeyboard : CommandSender {
|
||||
#endif
|
||||
public:
|
||||
HWKeyboard(Manager *);
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
inline ~HWKeyboard();
|
||||
#else
|
||||
~HWKeyboard();
|
||||
#endif
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
void setLanguage(Destination destination, Language language);
|
||||
#endif
|
||||
|
||||
virtual void init();
|
||||
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
|
||||
wchar_t convertWCCode(wchar_t code) const;
|
||||
#endif
|
||||
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#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:
|
||||
void updateShift(input::HKBManager& hkbManager);
|
||||
void controlKeyTriggeredHandler(input::HKBManager);
|
||||
@@ -33,8 +47,13 @@ namespace textinput {
|
||||
|
||||
Manager* mpManager; // 0x10
|
||||
u8 field_0x14; // 0x14
|
||||
#ifdef TIINPUTFORM_IMPLEMENTATION
|
||||
u8 mbSingleQuoteClosing;
|
||||
u8 mbDoubleQuoteClosing;
|
||||
#else
|
||||
u8 field_0x15; // 0x15
|
||||
u8 field_0x16; // 0x16
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -13,14 +13,43 @@
|
||||
#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:
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
void create(MEMAllocator* allocator);
|
||||
#endif
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual ~EditBuffer();
|
||||
#else
|
||||
~EditBuffer();
|
||||
#endif
|
||||
|
||||
private:
|
||||
void* mpString; // 0x04
|
||||
@@ -30,7 +59,24 @@ namespace textinput {
|
||||
};
|
||||
|
||||
class DeadKeyStream {
|
||||
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
|
||||
#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
|
||||
@@ -82,13 +128,52 @@ 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
|
||||
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, EditBuffer* editBuffer);
|
||||
|
||||
@@ -199,15 +284,17 @@ namespace textinput {
|
||||
|
||||
virtual void makeUpCursorPos(CursorPos* cursorPos, u32 pos, s32 startLine, s32 endLine);
|
||||
|
||||
#ifdef MYTIINPUTFORM_IMPLEMENTATION
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
protected:
|
||||
#if !defined(TIINPUTFORM_IMPLEMENTATION) && !defined(TIMANAGER_IMPLEMENTATION)
|
||||
void setCursorPos(tistring::Decolated* string, u32 pos);
|
||||
void resetRelation();
|
||||
void calcCursorTimer();
|
||||
#endif
|
||||
void resetRelation();
|
||||
#else
|
||||
private:
|
||||
#endif
|
||||
#ifdef MYTIINPUTFORM_IMPLEMENTATION
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
nw4r::ut::Rect mRect;
|
||||
#else
|
||||
Rect mRect;
|
||||
@@ -219,6 +306,9 @@ 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
|
||||
@@ -254,8 +344,12 @@ 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:
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
LayoutByNW4R(textinput::Manager*, nw4r::lyt::MultiArcResourceAccessor*, const char*, EventObserver*, const char*);
|
||||
#endif
|
||||
~LayoutByNW4R();
|
||||
@@ -272,6 +366,9 @@ 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);
|
||||
@@ -282,9 +379,13 @@ namespace textinput {
|
||||
virtual void setRootPaneScaleFor16x9();
|
||||
virtual void setRootPaneScaleFor4x3();
|
||||
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual void onSE(sound::SE seId);
|
||||
#endif
|
||||
|
||||
virtual void visibleSeparator(bool flag);
|
||||
|
||||
#ifdef MYTIINPUTFORM_IMPLEMENTATION
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
protected:
|
||||
const void* mpLayoutData;
|
||||
const void* mpLanguageData;
|
||||
|
||||
@@ -8,27 +8,36 @@ namespace textinput {
|
||||
|
||||
class KeyboardBase : public CommandSender {
|
||||
public:
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
KeyboardBase() : meLanguage(JP) {}
|
||||
#endif
|
||||
virtual ~KeyboardBase() {}
|
||||
#ifndef TI_PC_KEYBOARD_IMPLEMENTATION
|
||||
#if !defined(TI_PC_KEYBOARD_IMPLEMENTATION) && !defined(TIMANAGER_IMPLEMENTATION) && !defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
virtual void create(MEMAllocator* alloc) override;
|
||||
virtual void init() override;
|
||||
virtual void setCommandReceiver(CommandReceiver* receiver) override;
|
||||
virtual void sendCommand(u32 command, void*) override;
|
||||
#endif
|
||||
#if !defined(TIMANAGER_IMPLEMENTATION) && !defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
virtual void updateFromReceiver(u32, void*) override;
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TI_PC_KEYBOARD_IMPLEMENTATION)
|
||||
#endif
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
virtual void onKey(u32, void*);
|
||||
#else
|
||||
virtual void onKey(u32);
|
||||
#endif
|
||||
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
virtual int getType();
|
||||
#else
|
||||
virtual void getType();
|
||||
#endif
|
||||
virtual void setLanguage(Language language);
|
||||
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
#ifdef TISIGNWINDOW_IMPLEMENTATION
|
||||
virtual Language getLanguage() const;
|
||||
#else
|
||||
virtual Language getLanguage() const { return meLanguage; }
|
||||
#endif
|
||||
virtual void update() {}
|
||||
#else
|
||||
virtual Language getLanguage() const;
|
||||
|
||||
@@ -28,11 +28,20 @@ namespace textinput {
|
||||
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
|
||||
};
|
||||
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
namespace predictlang { class LayoutByNW4R; }
|
||||
#endif
|
||||
class Manager : public Base {
|
||||
public:
|
||||
Manager(MEMAllocator* allocator, nw4r::lyt::MultiArcResourceAccessor* multiArc, textinput::EventObserver* event);
|
||||
@@ -94,14 +103,19 @@ namespace textinput {
|
||||
#endif
|
||||
|
||||
virtual void setSecretInputMode(bool secretInputMode) { mpInputForm->setSecretModeOn(secretInputMode); }
|
||||
#ifdef IPL_ADDRESS_EDIT_CPP
|
||||
#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 start() {}
|
||||
virtual void end() {}
|
||||
@@ -146,6 +160,10 @@ namespace textinput {
|
||||
void enableCompatibleFilter(bool compatibleFilter);
|
||||
|
||||
bool isVacancy() const;
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
bool isPredictTurning() const;
|
||||
void startPredictTurnOn(bool enabled);
|
||||
#endif
|
||||
|
||||
private:
|
||||
MEMAllocator* mpAllocator; // 0x04
|
||||
@@ -159,9 +177,14 @@ 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
|
||||
|
||||
#endif
|
||||
EventObserver* mpEventObserver; // 0x30
|
||||
|
||||
Destination meDestination; // 0x34
|
||||
|
||||
@@ -14,12 +14,22 @@ namespace textinput {
|
||||
class TiEventHandler : public gui::EventHandler {
|
||||
public:
|
||||
typedef struct Input {
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_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
|
||||
} Input;
|
||||
|
||||
virtual void onEvent(gui::GUIComponent& comp, u32 event, void* data); // 0x0C
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef TEXTINPUT_PC_KEYBOARD_H
|
||||
#define TEXTINPUT_PC_KEYBOARD_H
|
||||
|
||||
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
#include "tiPcKeyboardImpl.h"
|
||||
#else
|
||||
|
||||
#include "tiNw4rManager.h"
|
||||
#include "tiTextInputBase.h"
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION)
|
||||
#include "tiKeyboard.h"
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace textinput {
|
||||
|
||||
namespace pctype {
|
||||
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION)
|
||||
class UIObj {
|
||||
public:
|
||||
class Listener {
|
||||
@@ -29,7 +29,7 @@ namespace textinput {
|
||||
#endif
|
||||
|
||||
// TODO
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION)
|
||||
class Base : public textinput::keyboard::KeyboardBase {
|
||||
#else
|
||||
class Base : public CommandSender {
|
||||
@@ -37,6 +37,10 @@ namespace textinput {
|
||||
public:
|
||||
enum TranslateMode {
|
||||
TM_00,
|
||||
#ifdef TIINPUTFORM_IMPLEMENTATION
|
||||
TM_Kana,
|
||||
TM_Roman,
|
||||
#endif
|
||||
};
|
||||
|
||||
enum InputType {
|
||||
@@ -47,7 +51,7 @@ namespace textinput {
|
||||
IT_04,
|
||||
};
|
||||
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION)
|
||||
enum InputMode {
|
||||
IM_00,
|
||||
IM_01,
|
||||
@@ -126,7 +130,7 @@ namespace textinput {
|
||||
virtual void updateFixMode();
|
||||
#endif
|
||||
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION)
|
||||
private:
|
||||
u8 mKeyboardInputFlags[8];
|
||||
const void* mpKeyStateTable;
|
||||
@@ -136,6 +140,9 @@ namespace textinput {
|
||||
u32 mCurrentInputType;
|
||||
u32 mInputState;
|
||||
const void* mpLanguageData;
|
||||
#ifdef TIINPUTFORM_IMPLEMENTATION
|
||||
MEMAllocator* mpAllocator;
|
||||
#endif
|
||||
bool mbOnlyQwerty;
|
||||
bool mbLanguageKeyActive;
|
||||
u16 mKeyboardFlags;
|
||||
@@ -143,6 +150,10 @@ namespace textinput {
|
||||
void* mpCurrentKeyState;
|
||||
|
||||
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; }
|
||||
@@ -151,14 +162,14 @@ namespace textinput {
|
||||
|
||||
// TODO
|
||||
class LayoutByNW4R : public Base, public nw4rmanager::Layout
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION)
|
||||
, public UIObj::Listener
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
// TODO - ...
|
||||
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION)
|
||||
virtual void draw();
|
||||
virtual void calc();
|
||||
virtual void setPredictLanguageDialog(void*);
|
||||
@@ -171,7 +182,15 @@ namespace textinput {
|
||||
|
||||
void onPressedShift(bool shift);
|
||||
void onReleasedShift();
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
#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
|
||||
|
||||
@@ -17,6 +17,62 @@ namespace textinput {
|
||||
}
|
||||
namespace keyboard {
|
||||
namespace signwindow {
|
||||
#ifndef TISIGNWINDOW_IMPLEMENTATION
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
struct LanguageDependencyData;
|
||||
class Base : public KeyboardBase {
|
||||
public:
|
||||
Base(Manager* manager) : mpAllocator(NULL), mpManager(manager) {}
|
||||
virtual ~Base();
|
||||
virtual void create(MEMAllocator* allocator);
|
||||
virtual void init();
|
||||
virtual int getType();
|
||||
virtual void setLanguage(Language language);
|
||||
virtual bool isLocked();
|
||||
virtual void setPage(u8 page);
|
||||
virtual u8 getPage();
|
||||
virtual void movePrevSignPage();
|
||||
virtual void moveNextSignPage();
|
||||
virtual void close();
|
||||
private:
|
||||
u32 mInputState;
|
||||
const LanguageDependencyData* mpLanguageData;
|
||||
MEMAllocator* mpAllocator;
|
||||
Manager* mpManager;
|
||||
};
|
||||
class EventHandler;
|
||||
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public nw4rmanager::AnmObserver {
|
||||
public:
|
||||
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
|
||||
: Base(manager), nw4rmanager::Layout(accessor, layoutName, observer), mbActive(false), mbInput(false), mpEventHandler(NULL), mpCaller(NULL) {}
|
||||
virtual ~LayoutByNW4R();
|
||||
virtual void create(MEMAllocator* allocator);
|
||||
virtual void init();
|
||||
virtual void onKey(u32 event, void* data);
|
||||
virtual void movePrevSignPage();
|
||||
virtual void moveNextSignPage();
|
||||
virtual void close();
|
||||
virtual void draw();
|
||||
virtual void open(KeyboardBase* keyboard, bool repeat);
|
||||
virtual bool isActive();
|
||||
virtual void onChangeAnmState(AnmEvent event, nw4rmanager::AnmPane* pane, nw4rmanager::Anim* animation);
|
||||
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data);
|
||||
virtual bool updateInput(input::HKBManager& hkb);
|
||||
virtual void throwReleaseForAll();
|
||||
virtual void resetAnmSignWindow();
|
||||
virtual void setSignKeyTop(u16 first, u16 count);
|
||||
virtual void setPageNumber(u16 page);
|
||||
virtual void endToClose();
|
||||
virtual void startToInput();
|
||||
virtual void movePrevSignWindow();
|
||||
virtual void moveNextSignWindow();
|
||||
private:
|
||||
bool mbActive;
|
||||
bool mbInput;
|
||||
EventHandler* mpEventHandler;
|
||||
KeyboardBase* mpCaller;
|
||||
};
|
||||
#else
|
||||
class Base : public KeyboardBase {
|
||||
public:
|
||||
virtual bool isLocked();
|
||||
@@ -32,7 +88,10 @@ namespace textinput {
|
||||
virtual void open(KeyboardBase* keyboard, bool repeat);
|
||||
virtual bool isActive();
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace pctype {
|
||||
|
||||
struct GridKey {
|
||||
@@ -94,8 +153,10 @@ namespace textinput {
|
||||
void refresh_();
|
||||
void refreshText(nw4r::lyt::Pane* root);
|
||||
void setABCFlag(u32 flags);
|
||||
u32 getABCFlag() const { return abcFlags & ~15; }
|
||||
u32 getABCMode() const { return abcFlags & 15; }
|
||||
wchar_t getWCCode(u32 index);
|
||||
wchar_t getWCCode(char* paneName);
|
||||
wchar_t getWCCode(char* paneName) NO_INLINE;
|
||||
void setABCMode(u32 mode) {
|
||||
if ((abcFlags & 15) != mode) {
|
||||
abcFlags = (abcFlags & ~15) | (mode & 15);
|
||||
@@ -115,9 +176,22 @@ namespace textinput {
|
||||
const LanguageData* data;
|
||||
Base* owner;
|
||||
};
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
Base(Manager* manager) {
|
||||
mKeyState.abcFlags = 0;
|
||||
mKeyState.inputType = 0;
|
||||
mKeyState.aiuFlags = 0;
|
||||
mKeyState.language = USA;
|
||||
mKeyState.data = NULL;
|
||||
mKeyState.owner = this;
|
||||
mpAllocator = NULL;
|
||||
mbOnlyQwerty = false;
|
||||
mpManager = manager;
|
||||
}
|
||||
#endif
|
||||
virtual ~Base();
|
||||
virtual void create(MEMAllocator* allocator);
|
||||
virtual void init();
|
||||
virtual inline void init();
|
||||
virtual void updateFromReceiver(u32 command, void* data);
|
||||
virtual void onKey(u32 event, void* data);
|
||||
virtual int getType();
|
||||
@@ -159,46 +233,15 @@ namespace textinput {
|
||||
};
|
||||
|
||||
class LayoutByNW4R;
|
||||
class AnmPane : public nw4rmanager::AnmPane {
|
||||
class AnmPane;
|
||||
class EventHandler : public nw4rmanager::TiEventHandler {
|
||||
public:
|
||||
AnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : nw4rmanager::AnmPane(pane, observer), mAnimation(0) {}
|
||||
virtual void init();
|
||||
virtual void changeAnimation(u32 animation);
|
||||
virtual ~AnmPane();
|
||||
virtual int getState() const { return mAnimation; }
|
||||
virtual int getKeyType() const { return mKeyType; }
|
||||
|
||||
protected:
|
||||
int mAnimation;
|
||||
int mKeyType;
|
||||
};
|
||||
class NormalButtonAnmPane : public AnmPane {
|
||||
public:
|
||||
NormalButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { mKeyType = 0; }
|
||||
virtual ~NormalButtonAnmPane();
|
||||
virtual void onAnmEvent(AnmPaneEvent event);
|
||||
};
|
||||
class ShiftCapsAnmPane : public AnmPane {
|
||||
public:
|
||||
ShiftCapsAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer), mbOn(false) { mKeyType = 1; }
|
||||
virtual ~ShiftCapsAnmPane();
|
||||
virtual void onAnmEvent(AnmPaneEvent event);
|
||||
bool isFocused() const;
|
||||
EventHandler(LayoutByNW4R* layout) : mpKeyboard(layout) {}
|
||||
virtual ~EventHandler();
|
||||
virtual void onTiEvent(gui::PaneComponent* component, u32 event, Input* input);
|
||||
|
||||
private:
|
||||
bool mbOn;
|
||||
};
|
||||
class ToggleButtonAnmPane : public AnmPane {
|
||||
public:
|
||||
ToggleButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { mKeyType = 2; }
|
||||
virtual ~ToggleButtonAnmPane();
|
||||
virtual void onAnmEvent(AnmPaneEvent event);
|
||||
};
|
||||
class OnOffButtonAnmPane : public AnmPane {
|
||||
public:
|
||||
OnOffButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { mKeyType = 3; }
|
||||
virtual ~OnOffButtonAnmPane();
|
||||
virtual void onAnmEvent(AnmPaneEvent event);
|
||||
LayoutByNW4R* mpKeyboard;
|
||||
};
|
||||
class UIObj : public gui::EventHandler {
|
||||
public:
|
||||
@@ -219,6 +262,8 @@ namespace textinput {
|
||||
class UIModifierButton : public UIObj {
|
||||
public:
|
||||
UIModifierButton(u32 id, LayoutByNW4R* layout, Listener* listener);
|
||||
inline void Create(nw4rmanager::Layout* layout, const char* pane, const char* bounding);
|
||||
inline void SetState(bool enabled, u32 inactiveAnimation);
|
||||
virtual ~UIModifierButton();
|
||||
virtual void onGUIEvent(gui::PaneComponent& component, u32 event, nw4rmanager::TiEventHandler::Input* input);
|
||||
gui::PaneComponent* mpPaneComponent;
|
||||
@@ -244,17 +289,13 @@ namespace textinput {
|
||||
GXTexObj mEnglishTexture;
|
||||
GXTexObj mHangulTexture;
|
||||
};
|
||||
class EventHandler : public nw4rmanager::TiEventHandler {
|
||||
public:
|
||||
EventHandler(LayoutByNW4R* layout) : mpKeyboard(layout) {}
|
||||
virtual ~EventHandler();
|
||||
virtual void onTiEvent(gui::PaneComponent* component, u32 event, Input* input);
|
||||
|
||||
private:
|
||||
LayoutByNW4R* mpKeyboard;
|
||||
};
|
||||
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public UIObj::Listener {
|
||||
public:
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
|
||||
: Base(manager), nw4rmanager::Layout(accessor, layoutName, observer), mpKeyboardEventHandler(NULL),
|
||||
mShiftButton(1, this, this), mCapsButton(0, this, this), mModePanel(2, this, this) {}
|
||||
#endif
|
||||
virtual ~LayoutByNW4R();
|
||||
virtual void create(MEMAllocator* allocator);
|
||||
virtual void init();
|
||||
@@ -305,6 +346,48 @@ namespace textinput {
|
||||
UIModePanel mModePanel;
|
||||
};
|
||||
|
||||
class AnmPane : public nw4rmanager::AnmPane {
|
||||
public:
|
||||
AnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : nw4rmanager::AnmPane(pane, observer), mAnimation(0) {}
|
||||
virtual void init();
|
||||
virtual void changeAnimation(u32 animation);
|
||||
virtual ~AnmPane();
|
||||
virtual int getState() const { return mAnimation; }
|
||||
virtual int getKeyType() const { return mKeyType; }
|
||||
|
||||
protected:
|
||||
int mAnimation;
|
||||
int mKeyType;
|
||||
};
|
||||
class NormalButtonAnmPane : public AnmPane {
|
||||
public:
|
||||
NormalButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { mKeyType = 0; }
|
||||
virtual ~NormalButtonAnmPane();
|
||||
virtual void onAnmEvent(AnmPaneEvent event);
|
||||
};
|
||||
class ShiftCapsAnmPane : public AnmPane {
|
||||
public:
|
||||
ShiftCapsAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer), mbOn(false) { mKeyType = 1; }
|
||||
virtual ~ShiftCapsAnmPane();
|
||||
virtual void onAnmEvent(AnmPaneEvent event);
|
||||
bool isFocused() const;
|
||||
|
||||
private:
|
||||
bool mbOn;
|
||||
};
|
||||
class ToggleButtonAnmPane : public AnmPane {
|
||||
public:
|
||||
ToggleButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { mKeyType = 2; }
|
||||
virtual ~ToggleButtonAnmPane();
|
||||
virtual void onAnmEvent(AnmPaneEvent event);
|
||||
};
|
||||
class OnOffButtonAnmPane : public AnmPane {
|
||||
public:
|
||||
OnOffButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { mKeyType = 3; }
|
||||
virtual ~OnOffButtonAnmPane();
|
||||
virtual void onAnmEvent(AnmPaneEvent event);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,17 @@ namespace textinput {
|
||||
|
||||
class Base : public CommandSender {
|
||||
public:
|
||||
#ifdef TI_PREDICTLANG_SAMPLE_CLASS
|
||||
#if defined(TI_PREDICTLANG_SAMPLE_CLASS) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
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 void create(MEMAllocator* allocator) override { mpAllocator = allocator; }
|
||||
#endif
|
||||
virtual void setPredictMode(inputform::Base::PredictMode mode) { mePredictMode = mode; }
|
||||
|
||||
protected:
|
||||
@@ -32,7 +38,11 @@ namespace textinput {
|
||||
|
||||
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public nw4rmanager::AnmObserver {
|
||||
public:
|
||||
#ifdef TI_PREDICTLANG_SAMPLE_CLASS
|
||||
#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),
|
||||
mpEventHandler(NULL), meDestination(DST_US), mpCaller(NULL) {}
|
||||
@@ -68,12 +78,21 @@ namespace textinput {
|
||||
keyboard::KeyboardBase* mpCaller; // 0xD4
|
||||
};
|
||||
|
||||
#ifdef TI_PREDICTLANG_SAMPLE_CLASS
|
||||
#if defined(TI_PREDICTLANG_SAMPLE_CLASS) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
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
|
||||
virtual ~Sample() {}
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
134
include/keyboard/tiSignWindow.h
Normal file
134
include/keyboard/tiSignWindow.h
Normal file
@@ -0,0 +1,134 @@
|
||||
#ifndef TEXTINPUT_SIGN_WINDOW_H
|
||||
#define TEXTINPUT_SIGN_WINDOW_H
|
||||
|
||||
#include "tiKeyboard.h"
|
||||
#include "tiNw4rManager.h"
|
||||
#include "tiSwData.h"
|
||||
|
||||
namespace textinput {
|
||||
class Manager;
|
||||
namespace keyboard {
|
||||
|
||||
namespace signwindow {
|
||||
|
||||
struct LanguageDependency {
|
||||
u8 count;
|
||||
const PaneNameToCharCodeInSignMode* keys;
|
||||
};
|
||||
|
||||
class Base : public KeyboardBase {
|
||||
public:
|
||||
virtual ~Base();
|
||||
virtual void create(MEMAllocator*) override;
|
||||
virtual void init() override;
|
||||
virtual void onKey(u32, void*) override;
|
||||
virtual bool isLocked();
|
||||
virtual void setPage(u8);
|
||||
virtual u8 getPage();
|
||||
virtual void movePrevSignPage();
|
||||
virtual void moveNextSignPage();
|
||||
virtual void close();
|
||||
virtual int getType() override;
|
||||
virtual void setLanguage(Language) override;
|
||||
|
||||
protected:
|
||||
u8 mInputFlags;
|
||||
bool mbLocked;
|
||||
bool mbRepeat;
|
||||
u8 muPage;
|
||||
const LanguageDependency* mpLanguageDependency;
|
||||
MEMAllocator* mpAllocator;
|
||||
Manager* mpManager;
|
||||
};
|
||||
|
||||
class EventHandler;
|
||||
|
||||
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public nw4rmanager::AnmObserver {
|
||||
public:
|
||||
virtual ~LayoutByNW4R();
|
||||
virtual void create(MEMAllocator*) override;
|
||||
virtual void init() override;
|
||||
virtual void onKey(u32, void*) override;
|
||||
virtual void movePrevSignPage() override;
|
||||
virtual void moveNextSignPage() override;
|
||||
virtual void close() override;
|
||||
virtual void draw() override;
|
||||
virtual void open(KeyboardBase*, bool);
|
||||
virtual bool isActive();
|
||||
virtual void onChangeAnmState(AnmEvent, nw4rmanager::AnmPane*, nw4rmanager::Anim*) override;
|
||||
virtual bool updateInput(int, f32, f32, u32, u32, u32, void*) override;
|
||||
virtual bool updateInput(input::HKBManager&) override;
|
||||
virtual void throwReleaseForAll();
|
||||
virtual void resetAnmSignWindow();
|
||||
virtual void setSignKeyTop(u16, u16);
|
||||
virtual void setPageNumber(u16);
|
||||
virtual void endToClose();
|
||||
virtual void startToInput();
|
||||
virtual void movePrevSignWindow();
|
||||
virtual void moveNextSignWindow();
|
||||
|
||||
bool mbActive;
|
||||
bool mbInput;
|
||||
EventHandler* mpEventHandler;
|
||||
KeyboardBase* mpKeyboard;
|
||||
};
|
||||
|
||||
class Sample : public LayoutByNW4R {
|
||||
public:
|
||||
virtual ~Sample();
|
||||
};
|
||||
|
||||
class EventHandler : public nw4rmanager::TiEventHandler {
|
||||
public:
|
||||
explicit EventHandler(LayoutByNW4R* layout) : mpLayoutByNW4R(layout) {}
|
||||
virtual ~EventHandler();
|
||||
virtual void onTiEvent(gui::PaneComponent*, u32, Input*) override;
|
||||
LayoutByNW4R* mpLayoutByNW4R;
|
||||
};
|
||||
|
||||
class AnmPane : public nw4rmanager::AnmPane {
|
||||
public:
|
||||
AnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
|
||||
: nw4rmanager::AnmPane(pane, observer), muAnimation(0) {}
|
||||
inline virtual ~AnmPane();
|
||||
virtual void init() override;
|
||||
virtual void changeAnimation(u32) override;
|
||||
virtual u32 getKeyType() const;
|
||||
|
||||
protected:
|
||||
s32 muAnimation;
|
||||
u32 muKeyType;
|
||||
};
|
||||
|
||||
class CellPhoneSignAllAnmPane : public AnmPane {
|
||||
public:
|
||||
CellPhoneSignAllAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
|
||||
: AnmPane(pane, observer) { muKeyType = 0; }
|
||||
virtual ~CellPhoneSignAllAnmPane();
|
||||
virtual void init() override;
|
||||
virtual void onAnmEvent(AnmPaneEvent) override;
|
||||
};
|
||||
|
||||
class CellPhoneSignScrollAnmPane : public AnmPane {
|
||||
public:
|
||||
CellPhoneSignScrollAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
|
||||
: AnmPane(pane, observer) { muKeyType = 1; }
|
||||
virtual ~CellPhoneSignScrollAnmPane();
|
||||
virtual void init() override;
|
||||
virtual void onAnmEvent(AnmPaneEvent) override;
|
||||
};
|
||||
|
||||
class CellPhoneSignButtonPane : public AnmPane {
|
||||
public:
|
||||
CellPhoneSignButtonPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
|
||||
: AnmPane(pane, observer) { muKeyType = 2; }
|
||||
virtual ~CellPhoneSignButtonPane();
|
||||
virtual void init() override;
|
||||
virtual void onAnmEvent(AnmPaneEvent) override;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -3,6 +3,9 @@
|
||||
|
||||
#include <revolution/types.h>
|
||||
#include <revolution/mem/allocator.h>
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#include <revolution/kpr.h>
|
||||
#endif
|
||||
|
||||
namespace textinput {
|
||||
namespace tistring {
|
||||
@@ -36,7 +39,11 @@ namespace textinput {
|
||||
virtual wchar_t* getWCString() const { return mpszString; }
|
||||
|
||||
virtual void setCandidate(wchar_t candidate) { mwcCandidate = candidate; }
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual wchar_t getCandidate() const { return mwcCandidate; }
|
||||
#else
|
||||
virtual wchar_t getCandidate() { return mwcCandidate; }
|
||||
#endif
|
||||
virtual bool hasCandidate() const;
|
||||
|
||||
virtual wchar_t getLastWChar();
|
||||
@@ -54,14 +61,71 @@ namespace textinput {
|
||||
};
|
||||
|
||||
class KanaStream {
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_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)
|
||||
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)
|
||||
virtual ~Decolated();
|
||||
enum TranslateMode { TM_Direct, TM_Kana, TM_Roman, TM_Hangul };
|
||||
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 deleteChar();
|
||||
virtual void backSpace();
|
||||
virtual void confirm(const wchar_t* string);
|
||||
virtual bool moveCursorRight();
|
||||
virtual bool moveCursorLeft();
|
||||
virtual void setCursorPos(u32 pos);
|
||||
virtual void onSustain();
|
||||
virtual void offSustain();
|
||||
virtual bool isOnSustain();
|
||||
virtual u32 getCursorPos() const;
|
||||
virtual void getCursorPos(u32* start, u32* end);
|
||||
virtual bool canBackSpace();
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual bool deleteForward();
|
||||
#else
|
||||
virtual void deleteForward();
|
||||
#endif
|
||||
virtual void getSelected(u32& start, u32& end);
|
||||
virtual wchar_t getWCharAtCursor();
|
||||
virtual void replaceAtCursor(wchar_t ch);
|
||||
virtual bool isDakuten();
|
||||
virtual void converDakuten();
|
||||
virtual bool isHandaku();
|
||||
virtual void converHandaku();
|
||||
virtual void convertAll();
|
||||
virtual bool isSmall();
|
||||
virtual void converSmall();
|
||||
virtual bool atTheBeginningOfASentence();
|
||||
virtual void initKanaConverter();
|
||||
virtual wchar_t* 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();
|
||||
@@ -95,15 +159,75 @@ namespace textinput {
|
||||
virtual void clearKana();
|
||||
virtual void EnableKSXFilter();
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
u32 mCursorStart;
|
||||
u32 mCursorEnd;
|
||||
bool mbSustain;
|
||||
u32 mTranslateMode;
|
||||
#else
|
||||
u32 field_0x18; // 0x18
|
||||
u32 field_0x1C; // 0x1C
|
||||
u8 field_0x20; // 0x20
|
||||
u32 field_0x24; // 0x24
|
||||
#endif
|
||||
KanaStream mKanaStream; // 0x28
|
||||
};
|
||||
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
class WithAtok : public Decolated {
|
||||
public:
|
||||
WithAtok(u16 maxLength) : Decolated(maxLength) {}
|
||||
virtual ~WithAtok();
|
||||
virtual void pushBack(wchar_t ch);
|
||||
virtual void popBack();
|
||||
virtual void inputChar(wchar_t ch);
|
||||
virtual void backSpace();
|
||||
virtual void confirm(const wchar_t* string);
|
||||
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 bool isFix();
|
||||
virtual void setFix(bool fix);
|
||||
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 isCandidateSelected();
|
||||
virtual s32 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 closeDictionary();
|
||||
virtual bool hasConfirmedString();
|
||||
virtual void enableConfirmedString(bool enable);
|
||||
virtual void startConverting();
|
||||
virtual bool isDictionaryOpened();
|
||||
virtual void changeKanaMode(bool kana);
|
||||
virtual wchar_t 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();
|
||||
};
|
||||
#else
|
||||
class WithAtok : public StringBase {};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,13 @@
|
||||
|
||||
#include <nw4r/ut/CharWriter.h>
|
||||
#include <nw4r/ut/Rect.h>
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
namespace textinput {
|
||||
namespace textdrawer {
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION)
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
class Base : public nw4r::ut::CharWriter {
|
||||
#else
|
||||
class Base : nw4r::ut::CharWriter {
|
||||
@@ -31,9 +34,23 @@ namespace textinput {
|
||||
} CursorPos;
|
||||
|
||||
typedef struct DrawInfo {
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
nw4r::ut::Rect rect;
|
||||
wchar_t character;
|
||||
#else
|
||||
u8 unk_0x00[32];
|
||||
#endif
|
||||
} 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();
|
||||
@@ -77,20 +94,73 @@ namespace textinput {
|
||||
virtual u32 getEndPos() const;
|
||||
|
||||
// todo
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_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)
|
||||
virtual bool isEnableCursorCache() const;
|
||||
#else
|
||||
virtual void isEnableCursorCache();
|
||||
#endif
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual u32 getDrawModifyStartLine() const;
|
||||
virtual u32 getDrawModifyEndLine() const;
|
||||
#else
|
||||
virtual void getDrawModifyStartLine();
|
||||
virtual void getDrawModifyEndLine();
|
||||
#endif
|
||||
virtual u32 getDrawCacheStartPos() const;
|
||||
virtual void dirtyDrawCache();
|
||||
virtual void dirtyCursorCache();
|
||||
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_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
|
||||
#ifdef MYTIINPUTFORM_IMPLEMENTATION
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_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;
|
||||
|
||||
@@ -39,6 +39,10 @@ namespace textinput {
|
||||
f32 y; // 0x08
|
||||
} Scroll;
|
||||
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
enum HVKCode { HVK_None = 0 };
|
||||
#endif
|
||||
|
||||
class Base {
|
||||
public :
|
||||
virtual ~Base() {}
|
||||
@@ -50,7 +54,11 @@ namespace textinput {
|
||||
class CommandSender;
|
||||
class CommandReceiver : public Base {
|
||||
public:
|
||||
#ifdef MYTIINPUTFORM_IMPLEMENTATION
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
CommandReceiver() { clearSender(); }
|
||||
virtual ~CommandReceiver();
|
||||
#endif
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
struct Scroll {
|
||||
bool absY;
|
||||
f32 x;
|
||||
@@ -62,7 +70,7 @@ namespace textinput {
|
||||
INPUT_COMMAND_37 = 37,
|
||||
} INPUT_COMMAND;
|
||||
|
||||
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
struct ChangePredictMode { u32 mode; bool enabled; };
|
||||
#endif
|
||||
virtual void clearSender();
|
||||
@@ -78,7 +86,7 @@ namespace textinput {
|
||||
CommandSender() : mpCommandReceiver(NULL) {}
|
||||
|
||||
virtual void setCommandReceiver(CommandReceiver* cmdRecv);
|
||||
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual void sendCommand(u32 command, void* data) {
|
||||
if (mpCommandReceiver != NULL) mpCommandReceiver->onCommand(static_cast<CommandReceiver::INPUT_COMMAND>(command), data);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace textinput {
|
||||
namespace toolbar {
|
||||
class Base {
|
||||
public:
|
||||
#ifdef TI_TOOLBAR_SAMPLE_CLASS
|
||||
#if defined(TI_TOOLBAR_SAMPLE_CLASS) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
Base(Manager* manager) : mQwerty(true), meLanguage(USA), mpAllocator(NULL), mpManager(manager) {}
|
||||
#endif
|
||||
|
||||
@@ -35,7 +35,11 @@ namespace textinput {
|
||||
|
||||
class LayoutByNW4R : public Base, public nw4rmanager::Layout {
|
||||
public:
|
||||
#ifdef TI_TOOLBAR_SAMPLE_CLASS
|
||||
#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),
|
||||
mbIsEnableQwertyChg(false) {}
|
||||
@@ -117,12 +121,21 @@ namespace textinput {
|
||||
KeyType meKeyType; // 0x30
|
||||
};
|
||||
|
||||
#ifdef TI_TOOLBAR_SAMPLE_CLASS
|
||||
#if defined(TI_TOOLBAR_SAMPLE_CLASS) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
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
|
||||
virtual ~Sample() {}
|
||||
#endif
|
||||
};
|
||||
#else
|
||||
class Sample {};
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
|
||||
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);
|
||||
|
||||
@@ -46,7 +49,11 @@ namespace textinput {
|
||||
public:
|
||||
Animation() : mfAnimationTime(0.0f), mbInAnimation(false), mbSE(false), mpAnimObserver(NULL) {}
|
||||
|
||||
virtual void startAnm(AnimObserver*, f32, f32, f32, void*); // 0x08
|
||||
#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 calc(); // 0x0C
|
||||
virtual f32 getValue(); // 0x10
|
||||
virtual bool isActive(); // 0x14
|
||||
|
||||
@@ -1,14 +1,71 @@
|
||||
#ifndef TEXTINPUT_ZI_STRING_H
|
||||
#define TEXTINPUT_ZI_STRING_H
|
||||
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#include "tiString.h"
|
||||
#include <eztx.h>
|
||||
#endif
|
||||
|
||||
namespace textinput {
|
||||
namespace tistring {
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
class WithZi : public Decolated {
|
||||
public:
|
||||
enum PredictLanguage { PL_Default };
|
||||
enum LetterMode { LM_Lower, LM_Normal, LM_Upper };
|
||||
WithZi(u16 maxLength) : Decolated(maxLength), mbDictionaryOpen(false), mbContextChanged(false),
|
||||
mCurrentWordLength(0), mpDictionaries(NULL), mpDictionaryWork(NULL), mInputLength(0),
|
||||
mCandidateCount(0), mOemDictionaryId(0), mDictionaryLanguage(0xff), mSelectedCandidate(0),
|
||||
mPredictLanguage(0), mLetterMode(2), mpHoldingKey(NULL), mbKoreanPartialConfirm(false) {}
|
||||
virtual ~WithZi();
|
||||
virtual void init();
|
||||
virtual void setInputting(wchar_t ch);
|
||||
virtual int getCurrentNumPredicted();
|
||||
virtual void getPredicted(int index, wchar_t* string);
|
||||
virtual const wchar_t* getCurrentSelected();
|
||||
virtual u16 getInputStringLength();
|
||||
virtual void setSelectedCandidate(s32 index);
|
||||
virtual bool isFix();
|
||||
virtual void setPredictLaunguage(PredictLanguage language);
|
||||
virtual void changeLetterMode(LetterMode mode);
|
||||
virtual void ChangeDictionaryLanguage(u8 language);
|
||||
virtual void setCellPhoneHoldingkey(void* key);
|
||||
virtual void setElementBuffer();
|
||||
virtual u8 getPredictLanguage();
|
||||
s32 getSelectedCandidateIndex() const { return mSelectedCandidate; }
|
||||
void openDictionary(void* ziDict, void* ziOemDict);
|
||||
void setCurrentWord(const wchar_t* string);
|
||||
void update();
|
||||
const wchar_t* getCurrentInput();
|
||||
s32 getCurrentInput(wchar_t* buffer, u32 length);
|
||||
void clearCandidates();
|
||||
void partialConfirmForKR();
|
||||
private:
|
||||
EZTXGetParam mSearch;
|
||||
u32 mSearchState;
|
||||
bool mbDictionaryOpen;
|
||||
bool mbContextChanged;
|
||||
u32 mCurrentWordLength;
|
||||
EZTXLanguageEntry* mpDictionaries;
|
||||
void* mpDictionaryWork;
|
||||
u16 mInputLength;
|
||||
s32 mCandidateCount;
|
||||
u32 mOemDictionaryId;
|
||||
u8 mDictionaryLanguage;
|
||||
s32 mSelectedCandidate;
|
||||
u32 mPredictLanguage;
|
||||
u32 mLetterMode;
|
||||
void* mpHoldingKey;
|
||||
bool mbKoreanPartialConfirm;
|
||||
};
|
||||
#else
|
||||
class WithZi {
|
||||
public:
|
||||
virtual ~WithZi();
|
||||
|
||||
void openDictionary(void* ziDict, void* ziOemDict);
|
||||
};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,9 +44,12 @@ namespace ipl {
|
||||
#ifdef IPL_GCW_INTP_CTOR_OUT_OF_LINE
|
||||
LinearIntp() NO_INLINE;
|
||||
#endif
|
||||
#ifdef IPL_BOARD_OBJECT_INLINE_INTERPOLATION_DTORS
|
||||
#if defined(IPL_BOARD_OBJECT_INLINE_INTERPOLATION_DTORS) || defined(IPL_GC_WINDOW_CPP)
|
||||
virtual ~LinearIntp();
|
||||
#endif
|
||||
#ifdef IPL_GC_WINDOW_CPP
|
||||
T get() const;
|
||||
#else
|
||||
T get() const {
|
||||
T r = mEnd * getCurrentFrame();
|
||||
T b = mStart * (mMaxFrame - mFrame);
|
||||
@@ -54,6 +57,7 @@ namespace ipl {
|
||||
return b * (f64)(1.0f / getMaxFrame());
|
||||
}
|
||||
|
||||
#endif
|
||||
T get2() const { return (((mStart * (mMaxFrame - mFrame)) + (mEnd * mFrame)) / mMaxFrame); }
|
||||
};
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace ipl {
|
||||
y = r.y;
|
||||
z = 0.0f;
|
||||
}
|
||||
#if defined(IPL_ADDRESS_EDIT_CPP) || defined(IPL_SD_CHANNEL_SELECT_CPP)
|
||||
#if defined(IPL_ADDRESS_EDIT_CPP) || defined(IPL_SD_CHANNEL_SELECT_CPP) || defined(IPL_GC_WINDOW_CPP)
|
||||
VEC3(f32 fx, f32 fy, f32 fz);
|
||||
#else
|
||||
VEC3(f32 fx, f32 fy, f32 fz) {
|
||||
|
||||
99
include/scene/memoryCard/iplGCWindow.h
Normal file
99
include/scene/memoryCard/iplGCWindow.h
Normal file
@@ -0,0 +1,99 @@
|
||||
#ifndef IPL_SCENE_GC_WINDOW_H
|
||||
#define IPL_SCENE_GC_WINDOW_H
|
||||
|
||||
#include "scene/memoryCard/iplMemoryCardBase.h"
|
||||
#include "scene/memoryCard/iplMemoryCardManager.h"
|
||||
#include "math/iplMathTypes.h"
|
||||
#include "math/iplInterporation.h"
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
class GCWindow : public MemoryBase, public MemCardEventHandler {
|
||||
#ifdef IPL_MEMORY_CARD_CPP
|
||||
friend class MemoryCard;
|
||||
#endif
|
||||
public:
|
||||
GCWindow(EGG::Heap*, nand::LayoutFile*, const char*, const char*);
|
||||
virtual ~GCWindow();
|
||||
void init(const math::VEC3&, MemoryCardManager*, u8, short);
|
||||
void calc();
|
||||
void draw();
|
||||
void destroy();
|
||||
void onPoint(const char*, controller::Interface*);
|
||||
void onLeft(const char*);
|
||||
void onTrig(const char*);
|
||||
private:
|
||||
void on_wait();
|
||||
void on_fadein();
|
||||
void on_normal();
|
||||
void on_fadeout1st();
|
||||
void on_fadeout_yes1st();
|
||||
void on_focus_move();
|
||||
void on_focus_copy();
|
||||
void on_focus_del();
|
||||
void on_select_out();
|
||||
void on_dialog();
|
||||
void on_error_message();
|
||||
void on_process();
|
||||
void on_error_message1st();
|
||||
void on_error_message2nd();
|
||||
void on_error_message3rd();
|
||||
void on_format1st();
|
||||
void on_format2nd();
|
||||
void on_format3rd();
|
||||
void on_format4th();
|
||||
void on_format_error();
|
||||
void change_textbox_doing();
|
||||
void change_textbox_done();
|
||||
void set_texture(const char*, const GXTexObj&);
|
||||
public:
|
||||
virtual void onMemEvent(long, u8);
|
||||
bool isProcess();
|
||||
void stop_wait_anim();
|
||||
|
||||
private:
|
||||
int mState;
|
||||
MemoryBaseEvent* mpEvent;
|
||||
MemoryCardManager* mpMemoryCardManager;
|
||||
math::LinearIntp<math::VEC3> mLinearInterp;
|
||||
math::VEC3 mTranslate;
|
||||
u8 mCardState;
|
||||
short mCardIndex;
|
||||
int mOperation;
|
||||
bool mActive;
|
||||
bool mWaiting;
|
||||
u8 mFlags0[2];
|
||||
u8 mFlags1[2];
|
||||
};
|
||||
|
||||
class SavedataEditWindow : public MemoryBase {
|
||||
public:
|
||||
SavedataEditWindow(EGG::Heap* heap, nand::LayoutFile* layoutFile, const char* directory, const char* fileName);
|
||||
virtual void init();
|
||||
virtual void calc();
|
||||
virtual void draw();
|
||||
virtual void destroy();
|
||||
|
||||
private:
|
||||
void add_animation(const char* fileName, const char* groupName) {
|
||||
AnmName animation = {fileName, groupName};
|
||||
MemoryBase::add_animation(&animation, 1);
|
||||
}
|
||||
void on_normal();
|
||||
void on_fadein();
|
||||
void on_fadeout1st();
|
||||
void on_focus_del();
|
||||
void on_select_out();
|
||||
void on_fadeout_yes1st();
|
||||
|
||||
int mState;
|
||||
MemoryBaseEvent* mpEvent;
|
||||
math::LinearIntp<math::VEC3> mLinearInterp;
|
||||
math::VEC3 mTranslate;
|
||||
bool mActive;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -59,6 +59,10 @@ namespace ipl {
|
||||
void start_errormessage_fadein();
|
||||
int update_slot();
|
||||
|
||||
#ifdef IPL_MEMORY_CARD_CPP
|
||||
bool can_scroll_r() const { return mIconCount > 30 && mState == 2; }
|
||||
bool can_scroll_l() const { return mIconIndex >= 0 && mState == 2; }
|
||||
#endif
|
||||
void show_arw();
|
||||
void show_capacity(u8 slot);
|
||||
|
||||
|
||||
@@ -85,8 +85,16 @@ namespace ipl {
|
||||
GXTexObj* _create_icon(u8 slot, s16 fileNo, long start);
|
||||
const wchar_t* getComment(u8 slot, s16 index, int which);
|
||||
GXTexObj* create_banner(u8 slot, s16 index);
|
||||
#ifdef IPL_GC_WINDOW_CPP
|
||||
u32 getBlocks(u8 slot, s16 index);
|
||||
#else
|
||||
u16 getBlocks(u8 slot, s16 index);
|
||||
#endif
|
||||
#ifdef IPL_MEMORY_CARD_CPP
|
||||
u32 getFreeBlocks(u8 slot);
|
||||
#else
|
||||
u16 getFreeBlocks(u8 slot);
|
||||
#endif
|
||||
|
||||
void setEventHandler(MemCardEventHandler* eventHandler) {
|
||||
mpEventHandler = eventHandler;
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace ipl {
|
||||
int getIndex() const { return mIndex; }
|
||||
nw4r::math::VEC3& getTranslate() const;
|
||||
|
||||
#ifdef IPL_SD_CHANNEL_TITLE_CPP
|
||||
#if defined(IPL_SD_CHANNEL_TITLE_CPP) || defined(IPL_SD_CHANNEL_OBJ_CPP)
|
||||
public:
|
||||
#else
|
||||
private:
|
||||
@@ -39,12 +39,20 @@ namespace ipl {
|
||||
EGG::ExpHeap* mpDialogHeap;
|
||||
EGG::ExpHeap* mpChannelHeap;
|
||||
EGG::Heap* mpHeap;
|
||||
#ifdef IPL_SD_CHANNEL_OBJ_CPP
|
||||
int mState;
|
||||
#else
|
||||
u32 mState;
|
||||
#endif
|
||||
int mPage;
|
||||
int mIndex;
|
||||
nand::LayoutFile* mpLayoutFile;
|
||||
nw4r::lyt::Pane* mpPane;
|
||||
#ifdef IPL_SD_CHANNEL_OBJ_CPP
|
||||
nand::File* mpPaneAnimator;
|
||||
#else
|
||||
layout::Animator* mpPaneAnimator;
|
||||
#endif
|
||||
layout::Object* mpBaseLayout;
|
||||
layout::Animator* mpBaseAnimator;
|
||||
layout::Object* mpPageLayout;
|
||||
@@ -58,7 +66,11 @@ namespace ipl {
|
||||
int mDialogTimer;
|
||||
int mAnimationState;
|
||||
nw4r::lyt::Group* mpNewMessageGroup;
|
||||
#ifdef IPL_SD_CHANNEL_OBJ_CPP
|
||||
layout::Animator* mpNewMessageAnimator;
|
||||
#else
|
||||
int mNewMessageCount;
|
||||
#endif
|
||||
u8 mbNewMessageGroupActive;
|
||||
int mNewMessageState;
|
||||
int mNewMessageFrame;
|
||||
@@ -176,7 +188,7 @@ namespace ipl {
|
||||
static const char* mscClockPaneNames[3];
|
||||
static const char* mscMaskPaneName;
|
||||
|
||||
#ifdef IPL_SD_CHANNEL_TITLE_CPP
|
||||
#if defined(IPL_SD_CHANNEL_TITLE_CPP) || defined(IPL_SD_CHANNEL_OBJ_CPP)
|
||||
public:
|
||||
#else
|
||||
private:
|
||||
|
||||
986
libs/RVL_SDK/src/fa/pf_cache.c
Normal file
986
libs/RVL_SDK/src/fa/pf_cache.c
Normal file
@@ -0,0 +1,986 @@
|
||||
#include <private/vf/PrFILE2/fatfs/pf_cache.h>
|
||||
|
||||
typedef struct PFCACHE_BPB {
|
||||
pf_u16 bytes_per_sector;
|
||||
pf_u16 num_reserved_sectors;
|
||||
pf_u16 num_root_dir_entries;
|
||||
pf_u8 sectors_per_cluster;
|
||||
pf_u8 num_FATs;
|
||||
pf_u32 total_sectors;
|
||||
pf_u32 sectors_per_FAT;
|
||||
pf_u32 root_dir_cluster;
|
||||
pf_u16 fs_info_sector;
|
||||
pf_u16 backup_boot_sector;
|
||||
pf_u16 ext_flags;
|
||||
pf_u8 media;
|
||||
pf_s32 fat_type;
|
||||
pf_u8 log2_bytes_per_sector;
|
||||
pf_u8 log2_sectors_per_cluster;
|
||||
pf_u8 num_active_FATs;
|
||||
pf_u16 num_root_dir_sectors;
|
||||
pf_u32 active_FAT_sector;
|
||||
pf_u32 first_root_dir_sector;
|
||||
pf_u32 first_data_sector;
|
||||
pf_u32 num_clusters;
|
||||
} PFCACHE_BPB;
|
||||
|
||||
struct PF_VOLUME {
|
||||
PFCACHE_BPB bpb;
|
||||
pf_u32 num_free_clusters;
|
||||
pf_u32 last_free_cluster;
|
||||
pf_u8 file_and_directory_state[0x1624 - 0x40];
|
||||
PF_SECTOR_CACHE cache;
|
||||
};
|
||||
|
||||
enum { FAT_32 = 2 };
|
||||
|
||||
extern void* pf_memcpy(void* dest, const void* src, pf_u32 size);
|
||||
extern void* pf_memset(void* dest, pf_s32 value, pf_u32 size);
|
||||
extern pf_s32 PFDRV_lread(PF_VOLUME* p_vol, pf_u8* buffer, pf_u32 sector, pf_u32 num_sector, pf_u32* p_num_success);
|
||||
extern pf_s32 PFDRV_lwrite(PF_VOLUME* p_vol, const pf_u8* buffer, pf_u32 sector, pf_u32 num_sector, pf_u32* p_num_success);
|
||||
pf_s32 PFCACHE_FlushAllCaches(PF_VOLUME* p_vol);
|
||||
|
||||
#pragma dont_inline on
|
||||
pf_s32 PFCACHE_InitPageList(PF_VOLUME* p_vol, PF_CACHE_PAGE** pp_head, PF_CACHE_PAGE* pages, PF_CACHE_BUFFER* buffers, pf_u32 num,
|
||||
pf_u32 size, pf_bool is_fat) {
|
||||
pf_u32 i;
|
||||
pf_u32 bps_per_buf;
|
||||
*pp_head = pages;
|
||||
bps_per_buf = (p_vol->bpb.bytes_per_sector >> 9) * size;
|
||||
if ((num / bps_per_buf) == 0) {
|
||||
return 30;
|
||||
}
|
||||
if ((num / bps_per_buf) == 1) {
|
||||
pages->p_prev = pages;
|
||||
pages->p_next = pages;
|
||||
pages->buffer = *buffers;
|
||||
pages->p_buf = *buffers;
|
||||
pages->p_mod_sbuf = PF_NULL;
|
||||
pages->p_mod_ebuf = PF_NULL;
|
||||
pages->size = size;
|
||||
pages->sector = 0xFFFFFFFF;
|
||||
pages->option = 0;
|
||||
pages->signature = PF_NULL;
|
||||
pages->stat &= ~(0x01 | 0x02);
|
||||
if (is_fat) {
|
||||
pages->stat |= 0x04;
|
||||
} else {
|
||||
pages->stat &= ~0x04;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
pages->p_prev = &pages[(num - (num % bps_per_buf)) - bps_per_buf];
|
||||
pages->p_next = &pages[bps_per_buf];
|
||||
pages->buffer = *buffers;
|
||||
pages->p_buf = *buffers;
|
||||
pages->p_mod_sbuf = PF_NULL;
|
||||
pages->p_mod_ebuf = PF_NULL;
|
||||
pages->size = size;
|
||||
pages->sector = 0xFFFFFFFF;
|
||||
pages->option = 0;
|
||||
pages->signature = PF_NULL;
|
||||
pages->stat &= ~(0x01 | 0x02);
|
||||
if (is_fat) {
|
||||
pages->stat |= 0x04;
|
||||
} else {
|
||||
pages->stat &= ~0x04;
|
||||
}
|
||||
for (i = bps_per_buf; i < (num - (num % bps_per_buf) - bps_per_buf); i += bps_per_buf) {
|
||||
pages[i].p_prev = &pages[i - bps_per_buf];
|
||||
pages[i].p_next = &pages[i + bps_per_buf];
|
||||
pages[i].buffer = buffers[i];
|
||||
pages[i].p_buf = buffers[i];
|
||||
pages[i].p_mod_sbuf = PF_NULL;
|
||||
pages[i].p_mod_ebuf = PF_NULL;
|
||||
pages[i].size = size;
|
||||
pages[i].sector = 0xFFFFFFFF;
|
||||
pages[i].option = 0;
|
||||
pages[i].signature = PF_NULL;
|
||||
pages[i].stat &= ~(0x01 | 0x02);
|
||||
if (is_fat) {
|
||||
pages[i].stat |= 0x04;
|
||||
} else {
|
||||
pages[i].stat &= ~0x04;
|
||||
}
|
||||
}
|
||||
pages[(num - (num % bps_per_buf)) - bps_per_buf].p_prev = &pages[((num - (num % bps_per_buf)) - bps_per_buf) - bps_per_buf];
|
||||
pages[(num - (num % bps_per_buf)) - bps_per_buf].p_next = pages;
|
||||
pages[(num - (num % bps_per_buf)) - bps_per_buf].buffer = buffers[(num - (num % bps_per_buf)) - bps_per_buf];
|
||||
pages[(num - (num % bps_per_buf)) - bps_per_buf].p_buf = buffers[(num - (num % bps_per_buf)) - bps_per_buf];
|
||||
pages[(num - (num % bps_per_buf)) - bps_per_buf].p_mod_sbuf = PF_NULL;
|
||||
pages[(num - (num % bps_per_buf)) - bps_per_buf].p_mod_ebuf = PF_NULL;
|
||||
pages[(num - (num % bps_per_buf)) - bps_per_buf].size = size;
|
||||
pages[(num - (num % bps_per_buf)) - bps_per_buf].sector = 0xFFFFFFFF;
|
||||
pages[(num - (num % bps_per_buf)) - bps_per_buf].option = 0;
|
||||
pages[(num - (num % bps_per_buf)) - bps_per_buf].signature = PF_NULL;
|
||||
pages[(num - (num % bps_per_buf)) - bps_per_buf].stat &= ~(0x01 | 0x02);
|
||||
if (is_fat) {
|
||||
pages[(num - (num % bps_per_buf)) - bps_per_buf].stat |= 0x04;
|
||||
} else {
|
||||
pages[(num - (num % bps_per_buf)) - bps_per_buf].stat &= ~0x04;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma dont_inline reset
|
||||
|
||||
#pragma dont_inline on
|
||||
PF_CACHE_PAGE* PFCACHE_SearchForPage(PF_VOLUME* p_vol, PF_CACHE_PAGE* p_head, pf_u32 sector) {
|
||||
PF_CACHE_PAGE* p_page;
|
||||
if (sector == 0xFFFFFFFF) {
|
||||
return PF_NULL;
|
||||
}
|
||||
if ((p_head->stat & 1) == 0) {
|
||||
return PF_NULL;
|
||||
}
|
||||
if (p_head->sector <= sector && p_head->sector + p_head->size - 1 >= sector) {
|
||||
p_head->p_buf = &p_head->buffer[(sector - p_head->sector) << p_vol->bpb.log2_bytes_per_sector];
|
||||
return p_head;
|
||||
}
|
||||
for (p_page = p_head->p_next; p_page != p_head; p_page = p_page->p_next) {
|
||||
if ((p_page->stat & 1) == 0) {
|
||||
return PF_NULL;
|
||||
}
|
||||
if (p_page->sector <= sector && p_page->sector + p_page->size - 1 >= sector) {
|
||||
p_page->p_buf = &p_page->buffer[(sector - p_page->sector) << p_vol->bpb.log2_bytes_per_sector];
|
||||
return p_page;
|
||||
}
|
||||
}
|
||||
return PF_NULL;
|
||||
}
|
||||
|
||||
#pragma dont_inline reset
|
||||
|
||||
#pragma dont_inline on
|
||||
pf_bool PFCACHE_SearchForFreePage(PF_CACHE_PAGE* p_head, PF_CACHE_PAGE** pp_page) {
|
||||
PF_CACHE_PAGE* p_page;
|
||||
for (p_page = p_head->p_prev; p_page != p_head; p_page = p_page->p_prev) {
|
||||
if ((p_page->stat & 1) == 0) {
|
||||
*pp_page = p_page;
|
||||
return PF_TRUE;
|
||||
}
|
||||
if (p_page->sector != 0xFFFFFFFF) {
|
||||
*pp_page = p_page;
|
||||
return PF_FALSE;
|
||||
}
|
||||
}
|
||||
if ((p_page->stat & 1) == 0) {
|
||||
*pp_page = p_page;
|
||||
return PF_TRUE;
|
||||
}
|
||||
if (p_page->sector != 0xFFFFFFFF) {
|
||||
*pp_page = p_page;
|
||||
return PF_FALSE;
|
||||
}
|
||||
*pp_page = PF_NULL;
|
||||
return PF_FALSE;
|
||||
}
|
||||
|
||||
#pragma dont_inline reset
|
||||
|
||||
#pragma dont_inline on
|
||||
pf_s32 PFCACHE_FlushPageIfNeeded(PF_VOLUME* p_vol, PF_CACHE_PAGE* p_page) {
|
||||
pf_s32 err;
|
||||
pf_u32 num_success;
|
||||
pf_u32 size;
|
||||
if (p_page != PF_NULL && (p_page->stat & 0x02) != 0 && p_page->sector != 0xFFFFFFFF) {
|
||||
if (p_page->p_mod_sbuf == PF_NULL) {
|
||||
size = p_page->size;
|
||||
err = PFDRV_lwrite(p_vol, p_page->buffer, p_page->sector, size, &num_success);
|
||||
} else {
|
||||
size = (((pf_u32)p_page->p_mod_ebuf >> p_vol->bpb.log2_bytes_per_sector) -
|
||||
((pf_u32)p_page->p_mod_sbuf >> p_vol->bpb.log2_bytes_per_sector)) + 1;
|
||||
err = PFDRV_lwrite(p_vol, p_page->p_mod_sbuf,
|
||||
p_page->sector + ((pf_u32)(p_page->p_mod_sbuf - p_page->buffer) >> p_vol->bpb.log2_bytes_per_sector),
|
||||
size, &num_success);
|
||||
}
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
if (num_success != size) {
|
||||
return 17;
|
||||
}
|
||||
p_page->p_mod_sbuf = NULL;
|
||||
p_page->p_mod_ebuf = NULL;
|
||||
p_page->stat &= ~2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma dont_inline reset
|
||||
|
||||
#pragma dont_inline on
|
||||
pf_s32 PFCACHE_DoAllocatePage(PF_VOLUME* p_vol, PF_CACHE_PAGE** pp_head, pf_u32 sector, PF_CACHE_PAGE** pp_page, pf_bool* p_is_hit) {
|
||||
pf_s32 err;
|
||||
*pp_page = PFCACHE_SearchForPage(p_vol, *pp_head, sector);
|
||||
if (*pp_page != PF_NULL) {
|
||||
*p_is_hit = PF_TRUE;
|
||||
} else {
|
||||
*p_is_hit = PF_FALSE;
|
||||
if (PFCACHE_SearchForFreePage(*pp_head, pp_page) == 0) {
|
||||
if (*pp_page == 0) {
|
||||
*pp_page = PF_NULL;
|
||||
return 30;
|
||||
}
|
||||
err = PFCACHE_FlushPageIfNeeded(p_vol, *pp_page);
|
||||
if (err != 0) {
|
||||
*pp_page = PF_NULL;
|
||||
return err;
|
||||
}
|
||||
(*pp_page)->p_mod_sbuf = NULL;
|
||||
(*pp_page)->p_mod_ebuf = NULL;
|
||||
}
|
||||
if (sector != 0xFFFFFFFF) {
|
||||
if (((*pp_page)->stat & 0x04) != 0) {
|
||||
(*pp_page)->sector = sector - (sector % (*pp_page)->size);
|
||||
(*pp_page)->p_buf = &(*pp_page)->buffer[(sector % (*pp_page)->size) << p_vol->bpb.log2_bytes_per_sector];
|
||||
} else {
|
||||
if (p_vol->bpb.fat_type == FAT_32 && (sector < p_vol->bpb.first_data_sector || sector >= p_vol->bpb.total_sectors)) {
|
||||
if (sector == p_vol->bpb.fs_info_sector) {
|
||||
(*pp_page)->size = 1;
|
||||
}
|
||||
}
|
||||
(*pp_page)->sector = sector - (sector % (*pp_page)->size);
|
||||
(*pp_page)->p_buf = &(*pp_page)->buffer[(sector % (*pp_page)->size) << p_vol->bpb.log2_bytes_per_sector];
|
||||
}
|
||||
} else {
|
||||
(*pp_page)->sector = sector;
|
||||
(*pp_page)->p_buf = (*pp_page)->buffer;
|
||||
}
|
||||
(*pp_page)->stat |= 0x01;
|
||||
}
|
||||
{
|
||||
PF_CACHE_PAGE* p_page = *pp_page;
|
||||
if (p_page != *pp_head) {
|
||||
if (p_page == (*pp_head)->p_prev) {
|
||||
*pp_head = p_page;
|
||||
} else {
|
||||
p_page->p_prev->p_next = p_page->p_next;
|
||||
p_page->p_next->p_prev = p_page->p_prev;
|
||||
p_page->p_next = *pp_head;
|
||||
p_page->p_prev = (*pp_head)->p_prev;
|
||||
p_page->p_next->p_prev = p_page;
|
||||
p_page->p_prev->p_next = p_page;
|
||||
*pp_head = p_page;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma dont_inline reset
|
||||
|
||||
#pragma dont_inline on
|
||||
pf_s32 PFCACHE_DoReadPage(PF_VOLUME* p_vol, PF_CACHE_PAGE** pp_head, pf_u32 sector, PF_CACHE_PAGE** pp_page, pf_bool set_sig) {
|
||||
pf_u32 num_success;
|
||||
pf_bool is_hit;
|
||||
pf_s32 err;
|
||||
err = PFCACHE_DoAllocatePage(p_vol, pp_head, sector, pp_page, &is_hit);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
if (!is_hit) {
|
||||
err = PFDRV_lread(p_vol, (*pp_page)->buffer, (*pp_page)->sector, (*pp_page)->size, &num_success);
|
||||
if (err != 0) {
|
||||
{
|
||||
PF_CACHE_PAGE* p_page = *pp_page;
|
||||
p_page->stat &= ~3;
|
||||
p_page->p_mod_sbuf = NULL;
|
||||
p_page->p_mod_ebuf = NULL;
|
||||
p_page->sector = 0xFFFFFFFF;
|
||||
p_page->signature = PF_NULL;
|
||||
if (p_page == *pp_head) {
|
||||
*pp_head = p_page->p_next;
|
||||
} else if (p_page != (*pp_head)->p_prev) {
|
||||
p_page->p_prev->p_next = p_page->p_next;
|
||||
p_page->p_next->p_prev = p_page->p_prev;
|
||||
p_page->p_next = *pp_head;
|
||||
p_page->p_prev = (*pp_head)->p_prev;
|
||||
p_page->p_next->p_prev = p_page;
|
||||
p_page->p_prev->p_next = p_page;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
if (num_success != (*pp_page)->size && p_vol->bpb.total_sectors != ((*pp_page)->sector + num_success)) {
|
||||
{
|
||||
PF_CACHE_PAGE* p_page = *pp_page;
|
||||
p_page->stat &= ~3;
|
||||
p_page->p_mod_sbuf = NULL;
|
||||
p_page->p_mod_ebuf = NULL;
|
||||
p_page->sector = 0xFFFFFFFF;
|
||||
p_page->signature = PF_NULL;
|
||||
if (p_page == *pp_head) {
|
||||
*pp_head = p_page->p_next;
|
||||
} else if (p_page != (*pp_head)->p_prev) {
|
||||
p_page->p_prev->p_next = p_page->p_next;
|
||||
p_page->p_next->p_prev = p_page->p_prev;
|
||||
p_page->p_next = *pp_head;
|
||||
p_page->p_prev = (*pp_head)->p_prev;
|
||||
p_page->p_next->p_prev = p_page;
|
||||
p_page->p_prev->p_next = p_page;
|
||||
}
|
||||
}
|
||||
return 17;
|
||||
}
|
||||
(*pp_page)->stat &= ~2;
|
||||
(*pp_page)->p_mod_sbuf = NULL;
|
||||
(*pp_page)->p_mod_ebuf = NULL;
|
||||
if (set_sig) {
|
||||
(*pp_page)->signature = p_vol->cache.signature;
|
||||
} else {
|
||||
(*pp_page)->signature = PF_NULL;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma dont_inline reset
|
||||
|
||||
#pragma dont_inline on
|
||||
pf_s32 PFCACHE_DoReadPageAndFlushIfNeeded(PF_VOLUME* p_vol, PF_CACHE_PAGE** pp_head, pf_u32 sector, PF_CACHE_PAGE** pp_page,
|
||||
pf_bool set_sig) {
|
||||
pf_u32 num_success;
|
||||
pf_bool is_hit;
|
||||
pf_s32 err;
|
||||
err = PFCACHE_DoAllocatePage(p_vol, pp_head, sector, pp_page, &is_hit);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
if (!is_hit) {
|
||||
err = PFDRV_lread(p_vol, (*pp_page)->buffer, (*pp_page)->sector, (*pp_page)->size, &num_success);
|
||||
if (err != 0) {
|
||||
{
|
||||
PF_CACHE_PAGE* p_page = *pp_page;
|
||||
p_page->stat &= ~3;
|
||||
p_page->p_mod_sbuf = NULL;
|
||||
p_page->p_mod_ebuf = NULL;
|
||||
p_page->sector = 0xFFFFFFFF;
|
||||
p_page->signature = PF_NULL;
|
||||
if (p_page == *pp_head) {
|
||||
*pp_head = p_page->p_next;
|
||||
} else if (p_page != (*pp_head)->p_prev) {
|
||||
p_page->p_prev->p_next = p_page->p_next;
|
||||
p_page->p_next->p_prev = p_page->p_prev;
|
||||
p_page->p_next = *pp_head;
|
||||
p_page->p_prev = (*pp_head)->p_prev;
|
||||
p_page->p_next->p_prev = p_page;
|
||||
p_page->p_prev->p_next = p_page;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
if (num_success != (*pp_page)->size && p_vol->bpb.total_sectors != ((*pp_page)->sector + num_success)) {
|
||||
{
|
||||
PF_CACHE_PAGE* p_page = *pp_page;
|
||||
p_page->stat &= ~3;
|
||||
p_page->p_mod_sbuf = NULL;
|
||||
p_page->p_mod_ebuf = NULL;
|
||||
p_page->sector = 0xFFFFFFFF;
|
||||
p_page->signature = PF_NULL;
|
||||
if (p_page == *pp_head) {
|
||||
*pp_head = p_page->p_next;
|
||||
} else if (p_page != (*pp_head)->p_prev) {
|
||||
p_page->p_prev->p_next = p_page->p_next;
|
||||
p_page->p_next->p_prev = p_page->p_prev;
|
||||
p_page->p_next = *pp_head;
|
||||
p_page->p_prev = (*pp_head)->p_prev;
|
||||
p_page->p_next->p_prev = p_page;
|
||||
p_page->p_prev->p_next = p_page;
|
||||
}
|
||||
}
|
||||
return 17;
|
||||
}
|
||||
(*pp_page)->stat &= ~2;
|
||||
(*pp_page)->p_mod_sbuf = NULL;
|
||||
(*pp_page)->p_mod_ebuf = NULL;
|
||||
if (set_sig) {
|
||||
(*pp_page)->signature = p_vol->cache.signature;
|
||||
} else {
|
||||
(*pp_page)->signature = PF_NULL;
|
||||
}
|
||||
} else if (set_sig && ((*pp_page)->stat & 0x02) != 0 && (p_vol->cache.mode & 0x02) != 0 && (*pp_page)->signature != p_vol->cache.signature) {
|
||||
err = PFCACHE_FlushPageIfNeeded(p_vol, *pp_page);
|
||||
if (err != 0) {
|
||||
*pp_page = PF_NULL;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma dont_inline reset
|
||||
|
||||
#pragma dont_inline on
|
||||
pf_s32 PFCACHE_DoReadNumSector(PF_VOLUME* p_vol, PF_CACHE_PAGE** pp_head, pf_u8* p_buf, pf_u32 sector, pf_u32 num_sector,
|
||||
pf_u32* p_num_success) {
|
||||
PF_CACHE_PAGE* p_page;
|
||||
pf_s32 err;
|
||||
pf_u32 num_rest_sector;
|
||||
pf_u32 num_success_sector;
|
||||
*p_num_success = 0;
|
||||
err = PFDRV_lread(p_vol, p_buf, sector, num_sector, p_num_success);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
p_page = PF_NULL;
|
||||
num_rest_sector = *p_num_success;
|
||||
num_success_sector = *p_num_success;
|
||||
do {
|
||||
if (p_page == PF_NULL) {
|
||||
p_page = *pp_head;
|
||||
} else {
|
||||
p_page = p_page->p_next;
|
||||
if (p_page == *pp_head) {
|
||||
p_page = PF_NULL;
|
||||
goto found_page;
|
||||
}
|
||||
}
|
||||
for (; (p_page->stat & 1) != 0; p_page = p_page->p_next) {
|
||||
if (p_page->sector != 0xFFFFFFFF) {
|
||||
p_page->p_buf = p_page->buffer;
|
||||
goto found_page;
|
||||
}
|
||||
}
|
||||
p_page = PF_NULL;
|
||||
found_page:
|
||||
if (p_page != PF_NULL && p_page->sector != 0xFFFFFFFF) {
|
||||
if (p_page->sector <= sector && p_page->sector + p_page->size >= sector + num_success_sector) {
|
||||
pf_memcpy(p_buf, &p_page->buffer[(sector - p_page->sector) << p_vol->bpb.log2_bytes_per_sector],
|
||||
num_success_sector << p_vol->bpb.log2_bytes_per_sector);
|
||||
num_rest_sector -= num_success_sector;
|
||||
} else if (p_page->sector >= sector && p_page->sector + p_page->size <= sector + num_success_sector) {
|
||||
pf_memcpy(&p_buf[(p_page->sector - sector) << p_vol->bpb.log2_bytes_per_sector], p_page->buffer,
|
||||
p_page->size << p_vol->bpb.log2_bytes_per_sector);
|
||||
num_rest_sector -= p_page->size;
|
||||
} else if (p_page->sector > sector && p_page->sector < sector + num_success_sector &&
|
||||
p_page->sector + p_page->size >= sector + num_success_sector) {
|
||||
pf_memcpy(&p_buf[(p_page->sector - sector) << p_vol->bpb.log2_bytes_per_sector], p_page->buffer,
|
||||
(p_page->size - (p_page->sector + p_page->size - (sector + num_success_sector))) << p_vol->bpb.log2_bytes_per_sector);
|
||||
num_rest_sector -= p_page->size - ((p_page->sector + p_page->size) - (sector + num_success_sector));
|
||||
} else if (p_page->sector < sector && (p_page->sector + p_page->size) > sector &&
|
||||
(p_page->sector + p_page->size) <= (sector + num_success_sector)) {
|
||||
pf_memcpy(p_buf, &p_page->buffer[(sector - p_page->sector) << p_vol->bpb.log2_bytes_per_sector],
|
||||
(p_page->size - (sector - p_page->sector)) << p_vol->bpb.log2_bytes_per_sector);
|
||||
num_rest_sector -= p_page->size - (sector - p_page->sector);
|
||||
}
|
||||
}
|
||||
} while (p_page != PF_NULL && num_rest_sector != 0);
|
||||
if (*p_num_success != num_sector && p_vol->bpb.total_sectors != (sector + *p_num_success)) {
|
||||
return 17;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma dont_inline reset
|
||||
|
||||
#pragma dont_inline on
|
||||
pf_s32 PFCACHE_DoWritePage(PF_VOLUME* p_vol, PF_CACHE_PAGE** pp_head, PF_CACHE_PAGE* p_page, pf_bool set_sig) {
|
||||
pf_s32 err;
|
||||
if (p_page != *pp_head) {
|
||||
if (p_page == (*pp_head)->p_prev) {
|
||||
*pp_head = p_page;
|
||||
} else {
|
||||
p_page->p_prev->p_next = p_page->p_next;
|
||||
p_page->p_next->p_prev = p_page->p_prev;
|
||||
p_page->p_next = *pp_head;
|
||||
p_page->p_prev = (*pp_head)->p_prev;
|
||||
p_page->p_next->p_prev = p_page;
|
||||
p_page->p_prev->p_next = p_page;
|
||||
*pp_head = p_page;
|
||||
}
|
||||
}
|
||||
p_page->stat |= 2;
|
||||
if (p_page->p_mod_sbuf == PF_NULL) {
|
||||
p_page->p_mod_sbuf = p_page->p_buf;
|
||||
p_page->p_mod_ebuf = p_page->p_buf;
|
||||
} else if (p_page->p_buf < p_page->p_mod_sbuf) {
|
||||
p_page->p_mod_sbuf = p_page->p_buf;
|
||||
} else if (p_page->p_buf > p_page->p_mod_ebuf) {
|
||||
p_page->p_mod_ebuf = p_page->p_buf;
|
||||
}
|
||||
if (set_sig) {
|
||||
p_page->signature = p_vol->cache.signature;
|
||||
} else {
|
||||
p_page->signature = PF_NULL;
|
||||
}
|
||||
if ((p_vol->cache.mode & 0x01) != 0 || ((p_vol->cache.mode & 0x04) != 0 && (p_page->stat & 0x04) != 0)) {
|
||||
err = PFCACHE_FlushPageIfNeeded(p_vol, p_page);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma dont_inline reset
|
||||
|
||||
#pragma dont_inline on
|
||||
pf_s32 PFCACHE_DoWriteSector(PF_VOLUME* p_vol, PF_CACHE_PAGE** pp_head, const pf_u8* p_buf, pf_u32 sector) {
|
||||
PF_CACHE_PAGE* p_page;
|
||||
pf_u32 num_success;
|
||||
pf_s32 err;
|
||||
p_page = PFCACHE_SearchForPage(p_vol, *pp_head, sector);
|
||||
if (p_page != PF_NULL) {
|
||||
pf_memcpy(p_page->p_buf, (pf_u8*)p_buf, p_vol->bpb.bytes_per_sector);
|
||||
p_page->stat |= 2;
|
||||
if (p_page->p_mod_sbuf == PF_NULL) {
|
||||
p_page->p_mod_sbuf = p_page->p_buf;
|
||||
p_page->p_mod_ebuf = p_page->p_buf;
|
||||
} else if (p_page->p_buf < p_page->p_mod_sbuf) {
|
||||
p_page->p_mod_sbuf = p_page->p_buf;
|
||||
} else if (p_page->p_buf > p_page->p_mod_ebuf) {
|
||||
p_page->p_mod_ebuf = p_page->p_buf;
|
||||
}
|
||||
err = PFCACHE_FlushPageIfNeeded(p_vol, p_page);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
err = PFDRV_lwrite(p_vol, p_buf, sector, 1, &num_success);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
if (num_success != 1) {
|
||||
return 17;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma dont_inline reset
|
||||
|
||||
#pragma dont_inline on
|
||||
pf_s32 PFCACHE_DoWriteNumSectorAndFreeIfNeeded(PF_VOLUME* p_vol, PF_CACHE_PAGE** pp_head, const pf_u8* p_buf, pf_u32 sector,
|
||||
pf_u32 num_sector, pf_u32* p_num_success) {
|
||||
PF_CACHE_PAGE* p_page = PF_NULL;
|
||||
pf_s32 err;
|
||||
pf_u32 num_rest_sector = num_sector;
|
||||
pf_u8* p_sbuf;
|
||||
pf_u8* p_ebuf;
|
||||
pf_u32 num_overlap;
|
||||
pf_u32 last_sector;
|
||||
*p_num_success = 0;
|
||||
do {
|
||||
if (p_page == PF_NULL) {
|
||||
p_page = *pp_head;
|
||||
} else {
|
||||
p_page = p_page->p_next;
|
||||
if (p_page == *pp_head) {
|
||||
p_page = PF_NULL;
|
||||
goto found_page;
|
||||
}
|
||||
}
|
||||
for (; (p_page->stat & 1) != 0; p_page = p_page->p_next) {
|
||||
if (p_page->sector != 0xFFFFFFFF) {
|
||||
p_page->p_buf = p_page->buffer;
|
||||
goto found_page;
|
||||
}
|
||||
}
|
||||
p_page = PF_NULL;
|
||||
found_page:
|
||||
if (p_page != PF_NULL && p_page->sector != 0xFFFFFFFF) {
|
||||
if (p_page->sector <= sector && (p_page->sector + p_page->size) >= (sector + num_sector)) {
|
||||
pf_memcpy(&p_page->buffer[(sector - p_page->sector) << p_vol->bpb.log2_bytes_per_sector], (pf_u8*)p_buf,
|
||||
num_sector << p_vol->bpb.log2_bytes_per_sector);
|
||||
*p_num_success += num_rest_sector;
|
||||
num_rest_sector = 0;
|
||||
p_page->stat |= 2;
|
||||
p_sbuf = &p_page->buffer[(sector - p_page->sector) << p_vol->bpb.log2_bytes_per_sector];
|
||||
p_ebuf = &(&p_page->buffer[(sector - p_page->sector) << p_vol->bpb.log2_bytes_per_sector])[(num_sector - 1)
|
||||
<< p_vol->bpb.log2_bytes_per_sector];
|
||||
if (p_page->p_mod_sbuf == NULL) {
|
||||
p_page->p_mod_sbuf = p_sbuf;
|
||||
p_page->p_mod_ebuf = p_ebuf;
|
||||
} else if (p_sbuf < p_page->p_mod_sbuf) {
|
||||
p_page->p_mod_sbuf = p_sbuf;
|
||||
} else if (p_page->p_mod_ebuf < p_ebuf) {
|
||||
p_page->p_mod_ebuf = p_ebuf;
|
||||
}
|
||||
} else if (p_page->sector >= sector && (p_page->sector + p_page->size) <= (sector + num_sector)) {
|
||||
pf_memcpy(p_page->buffer, (pf_u8*)&p_buf[(p_page->sector - sector) << p_vol->bpb.log2_bytes_per_sector],
|
||||
p_page->size << p_vol->bpb.log2_bytes_per_sector);
|
||||
num_rest_sector -= p_page->size;
|
||||
*p_num_success += p_page->size;
|
||||
p_page->stat |= 2;
|
||||
p_page->p_mod_sbuf = p_page->buffer;
|
||||
p_page->p_mod_ebuf = &p_page->buffer[(p_page->size - 1) << p_vol->bpb.log2_bytes_per_sector];
|
||||
} else if (p_page->sector > sector && p_page->sector < (sector + num_sector) &&
|
||||
(p_page->sector + p_page->size) >= (sector + num_sector)) {
|
||||
pf_memcpy(p_page->buffer, (pf_u8*)&p_buf[(p_page->sector - sector) << p_vol->bpb.log2_bytes_per_sector],
|
||||
(sector + num_sector - p_page->sector) << p_vol->bpb.log2_bytes_per_sector);
|
||||
num_overlap = p_page->size - ((p_page->sector + p_page->size) - (num_sector + sector));
|
||||
last_sector = p_page->sector + num_overlap - 1;
|
||||
*p_num_success += num_overlap;
|
||||
num_rest_sector -= num_overlap;
|
||||
p_page->stat |= 2;
|
||||
p_ebuf = &p_page->buffer[(last_sector - p_page->sector) << p_vol->bpb.log2_bytes_per_sector];
|
||||
p_page->p_mod_sbuf = p_page->buffer;
|
||||
if (p_page->p_mod_ebuf == NULL || p_page->p_mod_ebuf < p_ebuf) {
|
||||
p_page->p_mod_ebuf = p_ebuf;
|
||||
}
|
||||
} else if (p_page->sector < sector && (p_page->sector + p_page->size) > sector &&
|
||||
(p_page->sector + p_page->size) <= (sector + num_sector)) {
|
||||
pf_memcpy(&p_page->buffer[(sector - p_page->sector) << p_vol->bpb.log2_bytes_per_sector], (pf_u8*)p_buf,
|
||||
(p_page->size - (sector - p_page->sector)) << p_vol->bpb.log2_bytes_per_sector);
|
||||
num_rest_sector -= p_page->size - (sector - p_page->sector);
|
||||
*p_num_success += p_page->size - (sector - p_page->sector);
|
||||
p_page->stat |= 2;
|
||||
p_sbuf = &p_page->buffer[(p_page->size - (sector - p_page->sector) - 1) << p_vol->bpb.log2_bytes_per_sector];
|
||||
if (p_page->p_mod_sbuf == NULL || p_sbuf < p_page->p_mod_sbuf) {
|
||||
p_page->p_mod_sbuf = p_sbuf;
|
||||
}
|
||||
p_page->p_mod_ebuf = &p_page->buffer[(p_page->size - 1) << p_vol->bpb.log2_bytes_per_sector];
|
||||
}
|
||||
}
|
||||
} while (p_page != PF_NULL && num_rest_sector != 0);
|
||||
if (num_rest_sector != 0) {
|
||||
err = PFDRV_lwrite(p_vol, p_buf, sector, num_sector, p_num_success);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma dont_inline reset
|
||||
|
||||
#pragma dont_inline on
|
||||
pf_s32 PFCACHE_DoFlushCache(PF_VOLUME* p_vol, PF_CACHE_PAGE* p_head) {
|
||||
PF_CACHE_PAGE* p_page;
|
||||
pf_s32 err;
|
||||
pf_s32 first_err;
|
||||
first_err = 0;
|
||||
p_page = p_head;
|
||||
if ((p_page->stat & 0x01) == 0) {
|
||||
return 0;
|
||||
}
|
||||
if ((p_vol->cache.mode & 1) != 0 || ((p_vol->cache.mode & 4) != 0 && (p_page->stat & 4) != 0)) {
|
||||
return 0;
|
||||
}
|
||||
do {
|
||||
if ((p_page->stat & 0x01) == 0) {
|
||||
break;
|
||||
}
|
||||
err = PFCACHE_FlushPageIfNeeded(p_vol, p_page);
|
||||
if (err != 0 && first_err == 0) {
|
||||
first_err = err;
|
||||
}
|
||||
p_page = p_page->p_next;
|
||||
} while (p_page != p_head);
|
||||
return first_err;
|
||||
}
|
||||
|
||||
#pragma dont_inline reset
|
||||
|
||||
void PFCACHE_SetCache(PF_VOLUME* p_vol, PF_CACHE_PAGE* p_cache_page, PF_CACHE_BUFFER* p_cache_buf, pf_u16 num_fat_pages, pf_u16 num_data_pages) {
|
||||
p_vol->cache.pages = p_cache_page;
|
||||
p_vol->cache.buffers = p_cache_buf;
|
||||
p_vol->cache.num_fat_pages = num_fat_pages;
|
||||
p_vol->cache.num_data_pages = num_data_pages;
|
||||
}
|
||||
|
||||
void PFCACHE_SetFATBufferSize(PF_VOLUME* p_vol, pf_u32 size) {
|
||||
if (size != 0) {
|
||||
p_vol->cache.fat_buff_size = size;
|
||||
}
|
||||
}
|
||||
|
||||
void PFCACHE_SetDataBufferSize(PF_VOLUME* p_vol, pf_u32 size) {
|
||||
if (size != 0) {
|
||||
p_vol->cache.data_buff_size = size;
|
||||
}
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_InitCaches(PF_VOLUME* p_vol) {
|
||||
pf_s32 err;
|
||||
p_vol->cache.mode &= ~0x01;
|
||||
p_vol->cache.mode |= 0x02;
|
||||
p_vol->cache.mode &= ~0x04;
|
||||
pf_memset(p_vol->cache.buffers, 0, (p_vol->cache.num_fat_pages + p_vol->cache.num_data_pages) << 9);
|
||||
err = PFCACHE_InitPageList(p_vol, &p_vol->cache.p_current_fat, p_vol->cache.pages, p_vol->cache.buffers, p_vol->cache.num_fat_pages,
|
||||
p_vol->cache.fat_buff_size, PF_TRUE);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
err = PFCACHE_InitPageList(p_vol, &p_vol->cache.p_current_data, &p_vol->cache.pages[p_vol->cache.num_fat_pages],
|
||||
(PF_CACHE_BUFFER*)p_vol->cache.buffers[p_vol->cache.num_fat_pages], p_vol->cache.num_data_pages,
|
||||
p_vol->cache.data_buff_size, PF_FALSE);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_SetWriteThroughMode(PF_VOLUME* p_vol) {
|
||||
pf_s32 err = PFCACHE_FlushAllCaches(p_vol);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
p_vol->cache.mode |= 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_SetWriteBackMode(PF_VOLUME* p_vol) {
|
||||
p_vol->cache.mode &= ~1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_AllocateFATPage(PF_VOLUME* p_vol, pf_u32 sector, PF_CACHE_PAGE** pp_page, pf_bool* p_is_hit) {
|
||||
pf_s32 err;
|
||||
if (p_vol->cache.p_current_fat == 0) {
|
||||
p_vol->cache.pages->buffer = *p_vol->cache.buffers;
|
||||
p_vol->cache.pages->p_buf = *p_vol->cache.buffers;
|
||||
*pp_page = p_vol->cache.pages;
|
||||
return 0;
|
||||
}
|
||||
err = PFCACHE_DoAllocatePage(p_vol, &p_vol->cache.p_current_fat, sector, pp_page, p_is_hit);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_AllocateDataPage(PF_VOLUME* p_vol, pf_u32 sector, PF_CACHE_PAGE** pp_page, pf_bool* p_is_hit) {
|
||||
pf_s32 err;
|
||||
if (p_vol->cache.p_current_data == 0) {
|
||||
p_vol->cache.pages->buffer = *p_vol->cache.buffers;
|
||||
p_vol->cache.pages->p_buf = *p_vol->cache.buffers;
|
||||
*pp_page = p_vol->cache.pages;
|
||||
return 0;
|
||||
}
|
||||
err = PFCACHE_DoAllocatePage(p_vol, &p_vol->cache.p_current_data, sector, pp_page, p_is_hit);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PFCACHE_FreeFATPage(PF_VOLUME* p_vol, PF_CACHE_PAGE* p_page) {
|
||||
if (p_vol->cache.p_current_fat != 0) {
|
||||
p_page->p_mod_sbuf = NULL;
|
||||
p_page->stat &= ~3;
|
||||
p_page->p_mod_ebuf = NULL;
|
||||
p_page->sector = 0xFFFFFFFF;
|
||||
p_page->signature = PF_NULL;
|
||||
if (p_page == p_vol->cache.p_current_fat) {
|
||||
p_vol->cache.p_current_fat = p_page->p_next;
|
||||
} else if (p_page != (p_vol->cache.p_current_fat)->p_prev) {
|
||||
p_page->p_prev->p_next = p_page->p_next;
|
||||
p_page->p_next->p_prev = p_page->p_prev;
|
||||
p_page->p_next = p_vol->cache.p_current_fat;
|
||||
p_page->p_prev = (p_vol->cache.p_current_fat)->p_prev;
|
||||
p_page->p_next->p_prev = p_page;
|
||||
p_page->p_prev->p_next = p_page;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PFCACHE_FreeDataPage(PF_VOLUME* p_vol, PF_CACHE_PAGE* p_page) {
|
||||
if (p_vol->cache.p_current_data != 0) {
|
||||
p_page->p_mod_sbuf = NULL;
|
||||
p_page->stat &= ~3;
|
||||
p_page->p_mod_ebuf = NULL;
|
||||
p_page->sector = 0xFFFFFFFF;
|
||||
p_page->signature = PF_NULL;
|
||||
if (p_page == p_vol->cache.p_current_data) {
|
||||
p_vol->cache.p_current_data = p_page->p_next;
|
||||
} else if (p_page != (p_vol->cache.p_current_data)->p_prev) {
|
||||
p_page->p_prev->p_next = p_page->p_next;
|
||||
p_page->p_next->p_prev = p_page->p_prev;
|
||||
p_page->p_next = p_vol->cache.p_current_data;
|
||||
p_page->p_prev = (p_vol->cache.p_current_data)->p_prev;
|
||||
p_page->p_next->p_prev = p_page;
|
||||
p_page->p_prev->p_next = p_page;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_ReadFATPage(PF_VOLUME* p_vol, pf_u32 sector, PF_CACHE_PAGE** pp_page) {
|
||||
pf_s32 err;
|
||||
err = PFCACHE_DoReadPage(p_vol, &p_vol->cache.p_current_fat, sector, pp_page, 0U);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_ReadDataPage(PF_VOLUME* p_vol, pf_u32 sector, PF_CACHE_PAGE** pp_page, pf_bool set_sig) {
|
||||
pf_s32 err;
|
||||
err = PFCACHE_DoReadPage(p_vol, &p_vol->cache.p_current_data, sector, pp_page, set_sig);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_ReadDataPageAndFlushIfNeeded(PF_VOLUME* p_vol, pf_u32 sector, PF_CACHE_PAGE** pp_page, pf_bool set_sig) {
|
||||
pf_s32 err;
|
||||
err = PFCACHE_DoReadPageAndFlushIfNeeded(p_vol, &p_vol->cache.p_current_data, sector, pp_page, set_sig);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_ReadDataNumSector(PF_VOLUME* p_vol, pf_u8* p_buf, pf_u32 sector, pf_u32 num_sector, pf_u32* p_num_success) {
|
||||
pf_s32 err;
|
||||
if (sector >= p_vol->bpb.total_sectors) {
|
||||
return 16;
|
||||
}
|
||||
err = PFCACHE_DoReadNumSector(p_vol, &p_vol->cache.p_current_data, p_buf, sector, num_sector, p_num_success);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_WriteFATPage(PF_VOLUME* p_vol, PF_CACHE_PAGE* p_page) {
|
||||
pf_s32 err;
|
||||
err = PFCACHE_DoWritePage(p_vol, &p_vol->cache.p_current_fat, p_page, 0);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_WriteDataPage(PF_VOLUME* p_vol, PF_CACHE_PAGE* p_page, pf_bool set_sig) {
|
||||
pf_s32 err;
|
||||
err = PFCACHE_DoWritePage(p_vol, &p_vol->cache.p_current_data, p_page, set_sig);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_WriteFATSectorAndFreeIfNeeded(PF_VOLUME* p_vol, const pf_u8* p_buf, pf_u32 sector) {
|
||||
pf_s32 err;
|
||||
if (sector >= p_vol->bpb.total_sectors) {
|
||||
return 16;
|
||||
}
|
||||
err = PFCACHE_DoWriteSector(p_vol, &p_vol->cache.p_current_fat, p_buf, sector);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_WriteDataNumSectorAndFreeIfNeeded(PF_VOLUME* p_vol, const pf_u8* p_buf, pf_u32 sector, pf_u32 num_sector, pf_u32* p_num_success) {
|
||||
pf_s32 err;
|
||||
if (sector >= p_vol->bpb.total_sectors) {
|
||||
return 16;
|
||||
}
|
||||
err = PFCACHE_DoWriteNumSectorAndFreeIfNeeded(p_vol, &p_vol->cache.p_current_data, p_buf, sector, num_sector, p_num_success);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
PF_CACHE_PAGE* PFCACHE_SearchDataCache(PF_VOLUME* p_vol, pf_u32 sector) {
|
||||
return PFCACHE_SearchForPage(p_vol, p_vol->cache.p_current_data, sector);
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_FlushFATCache(PF_VOLUME* p_vol) {
|
||||
pf_s32 err;
|
||||
err = PFCACHE_DoFlushCache(p_vol, p_vol->cache.p_current_fat);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_FlushDataCache(PF_VOLUME* p_vol) {
|
||||
pf_s32 err;
|
||||
err = PFCACHE_DoFlushCache(p_vol, p_vol->cache.p_current_data);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_FlushDataCacheSpecific(PF_VOLUME* p_vol, void* signature) {
|
||||
pf_s32 err = 0;
|
||||
PF_CACHE_PAGE* p_head;
|
||||
PF_CACHE_PAGE* p_page;
|
||||
if ((p_vol->cache.mode & 7) != 0) {
|
||||
p_head = p_vol->cache.p_current_data;
|
||||
p_page = p_head;
|
||||
if (p_page->signature == PF_NULL || p_page->signature == signature) {
|
||||
err = PFCACHE_FlushPageIfNeeded(p_vol, p_page);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
for (p_page = p_page->p_next; p_page != p_head; p_page = p_page->p_next) {
|
||||
if (p_page->signature == PF_NULL || p_page->signature == signature) {
|
||||
err = PFCACHE_FlushPageIfNeeded(p_vol, p_page);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
pf_s32 PFCACHE_FlushAllCaches(PF_VOLUME* p_vol) {
|
||||
pf_s32 err;
|
||||
err = PFCACHE_DoFlushCache(p_vol, p_vol->cache.p_current_fat);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
err = PFCACHE_DoFlushCache(p_vol, p_vol->cache.p_current_data);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PFCACHE_FreeAllCaches(PF_VOLUME* p_vol) {
|
||||
while ((p_vol->cache.p_current_fat->stat & 0x01) != 0) {
|
||||
{
|
||||
PF_CACHE_PAGE* p_page = p_vol->cache.p_current_fat;
|
||||
if (p_vol->cache.p_current_fat != 0) {
|
||||
p_page->stat &= ~3;
|
||||
p_page->p_mod_sbuf = NULL;
|
||||
p_page->p_mod_ebuf = NULL;
|
||||
p_page->sector = 0xFFFFFFFF;
|
||||
p_page->signature = PF_NULL;
|
||||
if (p_page == p_vol->cache.p_current_fat) {
|
||||
p_vol->cache.p_current_fat = p_page->p_next;
|
||||
} else if (p_page != (p_vol->cache.p_current_fat)->p_prev) {
|
||||
p_page->p_prev->p_next = p_page->p_next;
|
||||
p_page->p_next->p_prev = p_page->p_prev;
|
||||
p_page->p_next = p_vol->cache.p_current_fat;
|
||||
p_page->p_prev = (p_vol->cache.p_current_fat)->p_prev;
|
||||
p_page->p_next->p_prev = p_page;
|
||||
p_page->p_prev->p_next = p_page;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while ((p_vol->cache.p_current_data->stat & 0x01) != 0) {
|
||||
{
|
||||
PF_CACHE_PAGE* p_page = p_vol->cache.p_current_data;
|
||||
if (p_vol->cache.p_current_data != 0) {
|
||||
p_page->stat &= ~3;
|
||||
p_page->p_mod_sbuf = NULL;
|
||||
p_page->p_mod_ebuf = NULL;
|
||||
p_page->sector = 0xFFFFFFFF;
|
||||
p_page->signature = PF_NULL;
|
||||
if (p_page == p_vol->cache.p_current_data) {
|
||||
p_vol->cache.p_current_data = p_page->p_next;
|
||||
} else if (p_page != (p_vol->cache.p_current_data)->p_prev) {
|
||||
p_page->p_prev->p_next = p_page->p_next;
|
||||
p_page->p_next->p_prev = p_page->p_prev;
|
||||
p_page->p_next = p_vol->cache.p_current_data;
|
||||
p_page->p_prev = (p_vol->cache.p_current_data)->p_prev;
|
||||
p_page->p_next->p_prev = p_page;
|
||||
p_page->p_prev->p_next = p_page;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
747
libs/RVL_SDK/src/fa/pf_entry_iterator.c
Normal file
747
libs/RVL_SDK/src/fa/pf_entry_iterator.c
Normal file
@@ -0,0 +1,747 @@
|
||||
#include <private/vf/PrFILE2/fatfs/pf_entry.h>
|
||||
|
||||
typedef struct PFITER_FAT_HINT {
|
||||
pf_u32 chain_index;
|
||||
pf_u32 cluster;
|
||||
pf_u32 previous_cluster;
|
||||
} PFITER_FAT_HINT;
|
||||
|
||||
typedef struct PFITER_FFD {
|
||||
pf_u32 start_cluster;
|
||||
pf_u32 current_start_cluster;
|
||||
pf_u32* p_start_cluster;
|
||||
PF_LAST_CLUSTER last_cluster;
|
||||
PF_FAT_LAST_ACCESS last_access_cluster;
|
||||
PF_CLUSTER_LINK cluster_link;
|
||||
PFITER_FAT_HINT* p_hint;
|
||||
PF_VOLUME* p_vol;
|
||||
} PFITER_FFD;
|
||||
|
||||
typedef struct PFITER_ENT_ITER {
|
||||
pf_u32 index;
|
||||
PF_VOLUME* p_vol;
|
||||
PFITER_FFD ffd;
|
||||
pf_u32 file_sector_index;
|
||||
pf_u32 sector;
|
||||
pf_u16 offset;
|
||||
pf_u16 offset_mask;
|
||||
pf_u8 buf[32];
|
||||
pf_u8 log2_entries_per_sector;
|
||||
} PFITER_ENT_ITER;
|
||||
|
||||
typedef struct PFITER_BPB {
|
||||
pf_u16 bytes_per_sector;
|
||||
pf_u16 num_reserved_sectors;
|
||||
pf_u16 num_root_dir_entries;
|
||||
pf_u8 sectors_per_cluster;
|
||||
pf_u8 num_FATs;
|
||||
pf_u32 total_sectors;
|
||||
pf_u32 sectors_per_FAT;
|
||||
pf_u32 root_dir_cluster;
|
||||
pf_u16 fs_info_sector;
|
||||
pf_u16 backup_boot_sector;
|
||||
pf_u16 ext_flags;
|
||||
pf_u8 media;
|
||||
pf_s32 fat_type;
|
||||
pf_u8 log2_bytes_per_sector;
|
||||
pf_u8 log2_sectors_per_cluster;
|
||||
pf_u8 num_active_FATs;
|
||||
pf_u16 num_root_dir_sectors;
|
||||
pf_u32 active_FAT_sector;
|
||||
pf_u32 first_root_dir_sector;
|
||||
pf_u32 first_data_sector;
|
||||
pf_u32 num_clusters;
|
||||
} PFITER_BPB;
|
||||
|
||||
struct PF_VOLUME {
|
||||
PFITER_BPB bpb;
|
||||
};
|
||||
|
||||
typedef struct PFITER_CONTEXT_VOLUME {
|
||||
pf_u32 stat;
|
||||
pf_s32 context_id;
|
||||
PF_VOLUME* p_vol;
|
||||
} PFITER_CONTEXT_VOLUME;
|
||||
|
||||
typedef struct PFITER_VOLUME_SET {
|
||||
pf_u32 flags;
|
||||
pf_u32 reserved;
|
||||
PF_VOLUME* current_volume;
|
||||
PFITER_CONTEXT_VOLUME context_volumes[3];
|
||||
pf_s32 num_attached;
|
||||
pf_s32 num_mounted;
|
||||
pf_u32 config;
|
||||
void* user_data;
|
||||
pf_s32 last_error;
|
||||
pf_s32 last_driver_error;
|
||||
void (*code_callbacks[6])(void);
|
||||
pf_u32 setting;
|
||||
} PFITER_VOLUME_SET;
|
||||
|
||||
extern PFITER_VOLUME_SET pf_vol_set;
|
||||
pf_s8* PFSTR_GetStrPos(PF_STR*, pf_u32);
|
||||
pf_u32 PFSTR_GetCodeMode(PF_STR* p_str);
|
||||
void PFSTR_MoveStrPos(PF_STR* p_str, pf_s16 num_char);
|
||||
pf_u16 PFSTR_StrLen(PF_STR* p_str);
|
||||
pf_u16 PFSTR_StrNumChar(PF_STR* p_str, pf_u32 target);
|
||||
pf_s32 PFSTR_StrCmp(const PF_STR* p_str, const pf_s8* s);
|
||||
pf_s32 PFSTR_StrNCmp(PF_STR* p_str, const pf_s8* s, pf_u32 target, pf_s16 offset, pf_u16 num);
|
||||
void* pf_memcpy(void* dst, void* src, pf_u32 length);
|
||||
void* pf_memset(void* dst, pf_s32 c, pf_u32 length);
|
||||
pf_s32 pf_strncmp(const pf_s8* s1, const pf_s8* s2, pf_u32 length);
|
||||
pf_u8 PFENT_CalcCheckSum(PF_DIR_ENT* p_ent);
|
||||
void PFENT_LoadShortNameFromBuf(PF_DIR_ENT* p_ent, const pf_u8* buf);
|
||||
void PFENT_loadEntryNumericFieldsFromBuf(PF_DIR_ENT* p_ent, const pf_u8* buf);
|
||||
pf_s32 PFENT_LoadLFNEntryFieldsFromBuf(PF_DIR_ENT* p_ent, const pf_u8* buf);
|
||||
pf_s32 PFENT_GetRootDir(PF_VOLUME* p_vol, PF_DIR_ENT* p_ent);
|
||||
pf_s32 PFFAT_GetSectorSpecified(PFITER_FFD* p_ffd, pf_u32 file_sector_index, pf_u32 may_allocate, pf_u32* p_sector);
|
||||
pf_s32 PFFAT_getBeforeChain(PF_VOLUME* p_vol, pf_u32 start_cluster, pf_u32 lActive, pf_u32* p_cluster);
|
||||
pf_s32 PFFAT_ResetFFD(PFITER_FFD* p_ffd, pf_u32* p_start_cluster);
|
||||
pf_s32 PFFAT_InitFFD(PFITER_FFD* p_ffd, PFITER_FAT_HINT* p_hint, PF_VOLUME* p_vol, pf_u32* p_start_cluster);
|
||||
void PFPATH_InitTokenOfPath(PF_STR* p_str, pf_s8* path, pf_u32 code_mode);
|
||||
pf_s32 PFPATH_GetNextTokenOfPath(PF_STR* p_str, pf_bool wildcard);
|
||||
pf_bool PFPATH_MatchFileNameWithPattern(const pf_s8* file_name, PF_STR* p_pattern, pf_bool is_long_name);
|
||||
void PFPATH_getLongNameformShortName(pf_s8* short_name, pf_s8* long_name, pf_u8 flag);
|
||||
pf_u32 PFPATH_GetLengthFromShortname(const pf_s8* sSrc);
|
||||
pf_u32 PFPATH_GetLengthFromUnicode(const pf_u16* sSrc);
|
||||
pf_s32 PFPATH_transformInUnicode(pf_u16* sDestStr, const pf_s8* sSrcStr);
|
||||
pf_bool PFPATH_GetExtShortNameIndex(PF_STR* p_str, pf_u32* p_index);
|
||||
pf_s32 PFSEC_ReadData(PF_VOLUME* p_vol, pf_u8* p_buf, pf_u32 sector, pf_u16 offset, pf_u32 size, pf_u32* p_success_size, pf_bool set_sig);
|
||||
pf_s32 PFSEC_WriteData(PF_VOLUME* p_vol, const pf_u8* p_buf, pf_u32 sector, pf_u16 offset, pf_u32 size, pf_u32* p_success_size, pf_bool set_sig);
|
||||
pf_s32 PFVOL_GetCurrentDir(PF_VOLUME*, PF_DIR_ENT*);
|
||||
pf_s32 PFCACHE_AllocateDataPage(PF_VOLUME*, pf_u32, PF_CACHE_PAGE**, pf_bool*);
|
||||
pf_s32 PFCACHE_FreeDataPage(PF_VOLUME*, PF_CACHE_PAGE*);
|
||||
pf_s32 PFENT_RecalcEntryIterator(PFITER_ENT_ITER*, pf_u32);
|
||||
pf_s32 PFENT_ITER_IteratorInitialize(PFITER_ENT_ITER*, pf_u32);
|
||||
pf_bool PFENT_ITER_IsAtLogicalEnd(PFITER_ENT_ITER*);
|
||||
pf_s32 PFENT_ITER_MoveTo(PFITER_ENT_ITER*, pf_u32, pf_u32);
|
||||
pf_s32 PFENT_ITER_Advance(PFITER_ENT_ITER*, pf_u32);
|
||||
pf_s32 PFENT_ITER_Retreat(PFITER_ENT_ITER*, pf_u32);
|
||||
pf_s32 PFENT_ITER_FindDirEntryFromCluster(PFITER_ENT_ITER*, PF_DIR_ENT*, pf_u32, pf_bool*);
|
||||
|
||||
#pragma dont_inline on
|
||||
pf_s32 PFENT_RecalcEntryIterator(PFITER_ENT_ITER* p_iter, pf_u32 may_allocate) {
|
||||
pf_u32 file_sector_index;
|
||||
pf_u32 previous_fsindex;
|
||||
pf_u32 sector_count;
|
||||
pf_s32 err;
|
||||
PF_CACHE_PAGE* page;
|
||||
pf_u32 success_size;
|
||||
pf_bool hit;
|
||||
file_sector_index = p_iter->index >> p_iter->log2_entries_per_sector;
|
||||
previous_fsindex = p_iter->file_sector_index;
|
||||
if (file_sector_index != p_iter->file_sector_index) {
|
||||
p_iter->file_sector_index = file_sector_index;
|
||||
err = PFFAT_GetSectorSpecified(&p_iter->ffd, file_sector_index, 0, &p_iter->sector);
|
||||
if (err != 0) return err;
|
||||
if (p_iter->sector == -1U && may_allocate != 0) {
|
||||
err = PFFAT_GetSectorSpecified(&p_iter->ffd, file_sector_index, 1, &p_iter->sector);
|
||||
if (err != 0) return err;
|
||||
if (p_iter->sector != -1U && previous_fsindex != -1U) {
|
||||
err = PFCACHE_AllocateDataPage(p_iter->p_vol, -1U, &page, &hit);
|
||||
if (err != 0) return err;
|
||||
pf_memset(page->p_buf, 0, p_iter->p_vol->bpb.bytes_per_sector);
|
||||
for (sector_count = 0; sector_count < p_iter->p_vol->bpb.sectors_per_cluster; ++sector_count) {
|
||||
err = PFSEC_WriteData(p_iter->p_vol, page->p_buf, p_iter->sector + sector_count, 0,
|
||||
p_iter->p_vol->bpb.bytes_per_sector, &success_size, 0);
|
||||
if (err != 0) {
|
||||
PFCACHE_FreeDataPage(p_iter->p_vol, page);
|
||||
return err;
|
||||
}
|
||||
if (success_size != p_iter->p_vol->bpb.bytes_per_sector) {
|
||||
PFCACHE_FreeDataPage(p_iter->p_vol, page);
|
||||
return 17;
|
||||
}
|
||||
}
|
||||
PFCACHE_FreeDataPage(p_iter->p_vol, page);
|
||||
}
|
||||
}
|
||||
}
|
||||
p_iter->offset = (p_iter->index & p_iter->offset_mask) * 32;
|
||||
return 0;
|
||||
}
|
||||
#pragma dont_inline reset
|
||||
|
||||
static inline pf_s32 PFENT_ITER_LoadEntry(PFITER_ENT_ITER* p_iter) {
|
||||
pf_u32 success_size;
|
||||
pf_s32 err;
|
||||
|
||||
if (p_iter->sector == -1) {
|
||||
return 16;
|
||||
}
|
||||
err = PFSEC_ReadData(p_iter->p_vol, p_iter->buf, p_iter->sector, p_iter->offset, 0x20U, &success_size, 0U);
|
||||
if (success_size != 0x20) {
|
||||
return 17;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static inline pf_s32 PFENT_ITER_DoMoveTo(PFITER_ENT_ITER* p_iter, pf_u32 index, pf_u32 may_allocate) {
|
||||
pf_u32 prev_index = p_iter->index;
|
||||
pf_s32 err;
|
||||
|
||||
p_iter->index = index;
|
||||
err = PFENT_RecalcEntryIterator(p_iter, may_allocate);
|
||||
if (err != 0) {
|
||||
p_iter->index = prev_index;
|
||||
PFENT_RecalcEntryIterator(p_iter, 0U);
|
||||
return err;
|
||||
}
|
||||
err = PFENT_ITER_LoadEntry(p_iter);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void PFENT_ITER_MakeLongFileName(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent) {
|
||||
pf_s32 lengthName;
|
||||
signed char filename[13];
|
||||
|
||||
lengthName = 0;
|
||||
PFPATH_getLongNameformShortName(p_ent->short_name, filename, p_iter->buf[0xC]);
|
||||
lengthName = PFPATH_transformInUnicode(p_ent->long_name, filename);
|
||||
p_ent->num_entry_LFNs = ((lengthName % 13) ? 1 : 0) + (lengthName / 13);
|
||||
p_ent->check_sum = PFENT_CalcCheckSum(p_ent);
|
||||
p_ent->ordinal = 1;
|
||||
}
|
||||
|
||||
static inline pf_s32 InitializeIterator(PFITER_ENT_ITER* p_iter, pf_u32 index) {
|
||||
p_iter->p_vol = p_iter->ffd.p_vol;
|
||||
p_iter->log2_entries_per_sector = p_iter->p_vol->bpb.log2_bytes_per_sector - 5;
|
||||
p_iter->offset_mask = (1 << p_iter->log2_entries_per_sector) - 1;
|
||||
p_iter->file_sector_index = -1U;
|
||||
return PFENT_ITER_DoMoveTo(p_iter, index, 0);
|
||||
}
|
||||
|
||||
static inline pf_s32 AdvanceIterator(PFITER_ENT_ITER* p_iter, pf_u32 may_allocate) {
|
||||
pf_s32 err = PFENT_ITER_DoMoveTo(p_iter, p_iter->index + 1, may_allocate);
|
||||
if (err != 0) return err;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void LoadNumericEntry(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent) {
|
||||
PFENT_loadEntryNumericFieldsFromBuf(p_ent, p_iter->buf);
|
||||
p_ent->entry_sector = p_iter->sector;
|
||||
p_ent->entry_offset = p_iter->offset;
|
||||
p_ent->p_vol = p_iter->ffd.p_vol;
|
||||
if ((p_ent->attr & 0x10) && p_ent->start_cluster == 0) p_ent->start_cluster = 1;
|
||||
}
|
||||
|
||||
pf_s32 PFENT_ITER_DoFindEntry(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent, PF_STR* p_pattern,
|
||||
pf_u32 attr_required, pf_u32 attr_forbidden, pf_bool* p_is_found) {
|
||||
pf_s32 err = 0;
|
||||
pf_u32 index_search_from;
|
||||
pf_u32 is_extsfn = 0;
|
||||
*p_is_found = 0;
|
||||
if (PFSTR_StrCmp(p_pattern, (pf_s8*)"..") == 0 && (p_ent->attr & 0x10) && p_ent->start_cluster == 1) return 2;
|
||||
if (PFSTR_StrCmp(p_pattern, (pf_s8*)".") == 0) {
|
||||
*p_is_found = 1;
|
||||
return 0;
|
||||
}
|
||||
p_ent->num_entry_LFNs = 0;
|
||||
p_ent->ordinal = 0;
|
||||
p_ent->check_sum = 0;
|
||||
p_ent->long_name[0] = 0;
|
||||
if ((pf_vol_set.setting & 2) == 2) is_extsfn = PFPATH_GetExtShortNameIndex(p_pattern, &index_search_from);
|
||||
if (is_extsfn == 1) {
|
||||
for (err = InitializeIterator(p_iter, index_search_from - 1);; err = PFENT_ITER_Retreat(p_iter, 0)) {
|
||||
pf_s32 attr;
|
||||
if (err != 0) return err;
|
||||
if ((p_iter->buf[11] & 15) == 15) {
|
||||
if (PFENT_LoadLFNEntryFieldsFromBuf(p_ent, p_iter->buf) != 0) return 3;
|
||||
if (!(p_iter->buf[0] & 0x40)) continue;
|
||||
} else return 0;
|
||||
err = InitializeIterator(p_iter, index_search_from);
|
||||
if (err != 0) return err;
|
||||
attr = p_iter->buf[11];
|
||||
if (attr == 0) attr = 0x40;
|
||||
if (attr_required & 0x80) {
|
||||
attr_required &= 0x7f;
|
||||
attr_forbidden &= 0x7f;
|
||||
if ((attr_required && (pf_s32)(attr_required & attr) != (pf_s32)attr_required) ||
|
||||
(attr_forbidden && (pf_s32)(attr_forbidden & attr) == (pf_s32)attr_forbidden)) err = -1;
|
||||
} else if (attr_required != 0x7f && attr != attr_required &&
|
||||
(!(attr & attr_required) || (attr & attr_forbidden))) err = -1;
|
||||
if (err == -1) return 0;
|
||||
if (attr & 8) return 3;
|
||||
PFENT_LoadShortNameFromBuf(p_ent, p_iter->buf);
|
||||
if (PFPATH_MatchFileNameWithPattern(p_ent->short_name, p_pattern, 0)) {
|
||||
LoadNumericEntry(p_iter, p_ent);
|
||||
*p_is_found = 1;
|
||||
return 0;
|
||||
}
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
for (; PFENT_ITER_IsAtLogicalEnd(p_iter) == PF_FALSE; err = AdvanceIterator(p_iter, 0)) {
|
||||
pf_s32 attr;
|
||||
if (err != 0) return err;
|
||||
if (p_iter->buf[0] == 0) break;
|
||||
if (p_iter->buf[0] == 0xe5) {
|
||||
p_ent->num_entry_LFNs = 0;
|
||||
p_ent->long_name[0] = 0;
|
||||
continue;
|
||||
}
|
||||
attr = p_iter->buf[11];
|
||||
if ((attr & 15) == 15) {
|
||||
if (PFENT_LoadLFNEntryFieldsFromBuf(p_ent, p_iter->buf) != 0) {
|
||||
p_ent->num_entry_LFNs = 0;
|
||||
p_ent->long_name[0] = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (attr == 0) attr = 0x40;
|
||||
if (attr_required & 0x80) {
|
||||
attr_required &= 0x7f;
|
||||
attr_forbidden &= 0x7f;
|
||||
if ((attr_required && (pf_s32)(attr_required & attr) != (pf_s32)attr_required) ||
|
||||
(attr_forbidden && (pf_s32)(attr_forbidden & attr) == (pf_s32)attr_forbidden)) err = -1;
|
||||
} else if ((pf_u8)attr_required != 0x7f && (pf_u32)attr != (pf_u8)attr_required &&
|
||||
(!(attr & (pf_u8)attr_required) || (attr & (pf_u8)attr_forbidden))) err = -1;
|
||||
if (err == -1) {
|
||||
p_ent->num_entry_LFNs = 0;
|
||||
p_ent->long_name[0] = 0;
|
||||
continue;
|
||||
}
|
||||
if (attr & 8) {
|
||||
p_ent->num_entry_LFNs = 0;
|
||||
p_ent->long_name[0] = 0;
|
||||
}
|
||||
PFENT_LoadShortNameFromBuf(p_ent, p_iter->buf);
|
||||
if (p_ent->num_entry_LFNs && p_ent->ordinal == 1 && p_ent->check_sum == PFENT_CalcCheckSum(p_ent) &&
|
||||
PFPATH_MatchFileNameWithPattern((pf_s8*)p_ent->long_name, p_pattern, 1)) {
|
||||
LoadNumericEntry(p_iter, p_ent);
|
||||
*p_is_found = 1;
|
||||
return 0;
|
||||
}
|
||||
if (PFPATH_MatchFileNameWithPattern(p_ent->short_name, p_pattern, 0)) {
|
||||
if (p_iter->buf[12] & 0x18) PFENT_ITER_MakeLongFileName(p_iter, p_ent);
|
||||
LoadNumericEntry(p_iter, p_ent);
|
||||
*p_is_found = 1;
|
||||
return 0;
|
||||
}
|
||||
p_ent->num_entry_LFNs = 0;
|
||||
p_ent->long_name[0] = 0;
|
||||
}
|
||||
finish:
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFENT_ITER_DoGetEntry(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent, PF_VOLUME* p_vol, PF_STR* p_path, pf_bool wildcard,
|
||||
pf_bool no_look_last_token) {
|
||||
pf_s8* p;
|
||||
PF_STR token;
|
||||
pf_bool is_found;
|
||||
PFITER_FAT_HINT hint;
|
||||
pf_u32 start_cluster;
|
||||
PF_DIR_ENT current_ent;
|
||||
pf_s32 err;
|
||||
pf_u32 code_mode;
|
||||
|
||||
if (PFSTR_StrNCmp(p_path, (pf_s8*)":", 1, 1, 1) == 0) {
|
||||
PFSTR_MoveStrPos(p_path, 2);
|
||||
}
|
||||
if ((PFSTR_StrNCmp(p_path, (pf_s8*)"\\", 1, 0, 1) == 0 || PFSTR_StrNCmp(p_path, (pf_s8*)"/", 1, 0, 1) == 0)) {
|
||||
err = PFENT_GetRootDir(p_vol, p_ent);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
if (PFSTR_StrNumChar(p_path, 1) == 1 && (PFSTR_StrNCmp(p_path, (pf_s8*)"\0", 2, 0, 1) == 0)) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
err = PFVOL_GetCurrentDir(p_vol, p_ent);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
p = PFSTR_GetStrPos(p_path, 1);
|
||||
PFFAT_InitFFD(&p_iter->ffd, &hint, p_vol, &p_iter->ffd.current_start_cluster);
|
||||
p_iter->ffd.current_start_cluster = p_ent->start_cluster;
|
||||
code_mode = PFSTR_GetCodeMode(p_path);
|
||||
PFPATH_InitTokenOfPath(&token, p, code_mode);
|
||||
|
||||
for (err = PFPATH_GetNextTokenOfPath(&token, wildcard); token.p_head != 0; err = PFPATH_GetNextTokenOfPath(&token, wildcard)) {
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
if (no_look_last_token != 0 && (PFSTR_StrNCmp(&token, (pf_s8*)"\0", 2, 0, 1) == 0)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ((p_ent->attr & 0x10) == 0) {
|
||||
return 2;
|
||||
}
|
||||
if (PFSTR_StrLen(&token) == 0) {
|
||||
return 2;
|
||||
}
|
||||
p_iter->ffd.current_start_cluster = p_ent->start_cluster;
|
||||
PFFAT_ResetFFD(&p_iter->ffd, &p_iter->ffd.current_start_cluster);
|
||||
err = InitializeIterator(p_iter, 0);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
start_cluster = *p_iter->ffd.p_start_cluster;
|
||||
err = PFENT_ITER_DoFindEntry(p_iter, p_ent, &token, 0x7F, 0, &is_found);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
if (!is_found) {
|
||||
err = PFPATH_GetNextTokenOfPath(&token, wildcard);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
return (token.p_head == PF_NULL) + 2;
|
||||
}
|
||||
if (!wildcard) {
|
||||
if ((p_ent->attr & 0x10) != 0 && p_ent->start_cluster == 1) {
|
||||
p_ent->path_len = 3;
|
||||
continue;
|
||||
}
|
||||
if ((p_ent->attr & 0x10) != 0 && p_ent->short_name[0] == '.' && p_ent->short_name[1] == '.') {
|
||||
PFFAT_ResetFFD(&p_iter->ffd, &p_ent->start_cluster);
|
||||
err = InitializeIterator(p_iter, 0);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
current_ent.attr = p_ent->attr;
|
||||
current_ent.start_cluster = p_ent->start_cluster;
|
||||
err = PFENT_ITER_FindDirEntryFromCluster(p_iter, ¤t_ent, start_cluster, &is_found);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
if (is_found == 0) {
|
||||
return 2;
|
||||
}
|
||||
if (current_ent.num_entry_LFNs != 0) {
|
||||
p_ent->path_len -= PFPATH_GetLengthFromUnicode(current_ent.long_name);
|
||||
} else {
|
||||
p_ent->path_len -= PFPATH_GetLengthFromShortname(¤t_ent.short_name[0]);
|
||||
}
|
||||
p_ent->path_len--;
|
||||
continue;
|
||||
}
|
||||
if ((p_ent->attr & 0x10) == 0 || p_ent->short_name[0] != '.') {
|
||||
p_ent->path_len = (PFSTR_StrNumChar(&token, 1) + 1) + p_ent->path_len;
|
||||
if ((PFSTR_StrNCmp(&token, (pf_s8*)"\0", 2, 0, 1) != 0)) {
|
||||
p_ent->path_len -= PFSTR_StrNumChar(&token, 2);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFENT_ITER_IteratorInitialize(PFITER_ENT_ITER* p_iter, pf_u32 index_start_from) {
|
||||
pf_s32 err;
|
||||
|
||||
p_iter->p_vol = p_iter->ffd.p_vol;
|
||||
p_iter->log2_entries_per_sector = p_iter->p_vol->bpb.log2_bytes_per_sector - 5;
|
||||
p_iter->offset_mask = (1 << p_iter->log2_entries_per_sector) - 1;
|
||||
p_iter->file_sector_index = -1;
|
||||
err = PFENT_ITER_DoMoveTo(p_iter, index_start_from, 0U);
|
||||
return err;
|
||||
}
|
||||
|
||||
pf_bool PFENT_ITER_IsAtLogicalEnd(PFITER_ENT_ITER* p_iter) {
|
||||
pf_s32 err;
|
||||
pf_u32 save_index;
|
||||
pf_u32 save_fsindex;
|
||||
|
||||
if (p_iter->sector == -1U || p_iter->buf[0] == 0 || p_iter->index >= (1000000 - 1)) {
|
||||
save_index = p_iter->index;
|
||||
save_fsindex = p_iter->file_sector_index;
|
||||
p_iter->index = (p_iter->file_sector_index + 1) << p_iter->log2_entries_per_sector;
|
||||
err = PFENT_RecalcEntryIterator(p_iter, PF_FALSE);
|
||||
if (err != 0) {
|
||||
p_iter->index = save_index;
|
||||
p_iter->file_sector_index = save_fsindex;
|
||||
return PF_TRUE;
|
||||
}
|
||||
if (p_iter->sector != -1) {
|
||||
err = PFENT_ITER_LoadEntry(p_iter);
|
||||
if (err != 0) {
|
||||
return PF_TRUE;
|
||||
}
|
||||
return PF_FALSE;
|
||||
}
|
||||
return PF_TRUE;
|
||||
}
|
||||
return PF_FALSE;
|
||||
}
|
||||
|
||||
pf_s32 PFENT_ITER_MoveTo(PFITER_ENT_ITER* p_iter, pf_u32 index, pf_u32 may_allocate) {
|
||||
pf_s32 err;
|
||||
|
||||
if (p_iter->index != index || p_iter->sector != -1U || may_allocate == PF_FALSE) {
|
||||
err = PFENT_ITER_DoMoveTo(p_iter, index, may_allocate);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFENT_ITER_Advance(PFITER_ENT_ITER* p_iter, pf_u32 may_allocate) {
|
||||
return PFENT_ITER_MoveTo(p_iter, p_iter->index + 1, may_allocate);
|
||||
}
|
||||
|
||||
pf_s32 PFENT_ITER_FindCluster(PF_DIR_ENT* p_ent, pf_u32 cluster, pf_bool* p_is_found) {
|
||||
PFITER_FAT_HINT hint;
|
||||
pf_u32 entries_per_sector;
|
||||
pf_u32 current_cluster;
|
||||
PFITER_ENT_ITER iter;
|
||||
pf_u32 sector_index;
|
||||
pf_s32 err;
|
||||
*p_is_found = 0;
|
||||
if (p_ent->entry_sector < p_ent->p_vol->bpb.first_data_sector) return 0;
|
||||
current_cluster = (p_ent->entry_sector - p_ent->p_vol->bpb.first_data_sector) >> p_ent->p_vol->bpb.log2_sectors_per_cluster;
|
||||
sector_index = (p_ent->p_vol->bpb.sectors_per_cluster - 1) & (p_ent->entry_sector - p_ent->p_vol->bpb.first_data_sector);
|
||||
if (current_cluster == cluster) {
|
||||
*p_is_found = 1;
|
||||
return 0;
|
||||
}
|
||||
iter.ffd.p_start_cluster = ¤t_cluster;
|
||||
iter.ffd.p_hint = &hint;
|
||||
iter.ffd.p_vol = p_ent->p_vol;
|
||||
iter.ffd.start_cluster = 1;
|
||||
iter.ffd.cluster_link.buffer = PF_NULL;
|
||||
iter.log2_entries_per_sector = p_ent->p_vol->bpb.log2_bytes_per_sector - 5;
|
||||
iter.file_sector_index = sector_index;
|
||||
entries_per_sector = 1 << iter.log2_entries_per_sector;
|
||||
iter.offset_mask = entries_per_sector - 1;
|
||||
iter.p_vol = p_ent->p_vol;
|
||||
iter.sector = p_ent->entry_sector;
|
||||
iter.offset = p_ent->entry_offset;
|
||||
iter.index = ((pf_u32)p_ent->entry_offset >> 5) + sector_index * entries_per_sector;
|
||||
hint.chain_index = 0;
|
||||
hint.cluster = current_cluster;
|
||||
hint.previous_cluster = 1;
|
||||
if (iter.index < 2) {
|
||||
hint.chain_index = 1;
|
||||
iter.file_sector_index += p_ent->p_vol->bpb.sectors_per_cluster;
|
||||
iter.index += entries_per_sector << p_ent->p_vol->bpb.log2_sectors_per_cluster;
|
||||
}
|
||||
while (iter.index != 0) {
|
||||
err = PFENT_ITER_LoadEntry(&iter);
|
||||
if (err != 0) return err;
|
||||
if (pf_strncmp((pf_s8*)iter.buf, (pf_s8*)"..", 2) == 0) break;
|
||||
err = PFENT_ITER_Retreat(&iter, 0);
|
||||
if (err != 0) return err;
|
||||
if (current_cluster == cluster) {
|
||||
*p_is_found = 1;
|
||||
return 0;
|
||||
}
|
||||
if (current_cluster <= 2) return 0;
|
||||
if (iter.index < 1) {
|
||||
++hint.chain_index;
|
||||
iter.file_sector_index += p_ent->p_vol->bpb.sectors_per_cluster;
|
||||
iter.index += (1 << iter.log2_entries_per_sector) << p_ent->p_vol->bpb.log2_sectors_per_cluster;
|
||||
}
|
||||
}
|
||||
current_cluster = (PF_SWAP_16(*(pf_u16*)&iter.buf[20]) << 16) | PF_SWAP_16(*(pf_u16*)&iter.buf[26]);
|
||||
hint.chain_index = 0;
|
||||
iter.file_sector_index = 0;
|
||||
hint.cluster = current_cluster;
|
||||
iter.sector = p_ent->p_vol->bpb.first_data_sector + ((current_cluster - 2) << p_ent->p_vol->bpb.log2_sectors_per_cluster);
|
||||
iter.offset = 32;
|
||||
iter.index = 1;
|
||||
while (current_cluster > 2) {
|
||||
err = PFENT_ITER_LoadEntry(&iter);
|
||||
if (err != 0) return err;
|
||||
if (pf_strncmp((pf_s8*)iter.buf, (pf_s8*)"..", 2) == 0) {
|
||||
if (current_cluster == cluster) {
|
||||
*p_is_found = 1;
|
||||
return 0;
|
||||
}
|
||||
current_cluster = (PF_SWAP_16(*(pf_u16*)&iter.buf[20]) << 16) | PF_SWAP_16(*(pf_u16*)&iter.buf[26]);
|
||||
hint.cluster = current_cluster;
|
||||
iter.sector = p_ent->p_vol->bpb.first_data_sector + ((current_cluster - 2) << p_ent->p_vol->bpb.log2_sectors_per_cluster);
|
||||
} else return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFENT_ITER_Retreat(PFITER_ENT_ITER* p_iter, pf_u32 may_allocate) {
|
||||
pf_u32 before_cluster;
|
||||
pf_u32 cur_cluster;
|
||||
pf_s32 err;
|
||||
|
||||
if (p_iter->index == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (p_iter->file_sector_index != ((p_iter->index - 1) >> p_iter->log2_entries_per_sector)) {
|
||||
cur_cluster = ((p_iter->sector - p_iter->p_vol->bpb.first_data_sector) >> p_iter->p_vol->bpb.log2_sectors_per_cluster) + 2;
|
||||
if ((p_iter->file_sector_index % p_iter->p_vol->bpb.sectors_per_cluster) == 0 || p_iter->p_vol->bpb.sectors_per_cluster == 1) {
|
||||
if (p_iter->p_vol->bpb.fat_type == FAT_32 ||
|
||||
(*p_iter->ffd.p_start_cluster > 1 && p_iter->p_vol->bpb.first_data_sector <= p_iter->sector)) {
|
||||
err = PFFAT_getBeforeChain(p_iter->p_vol, cur_cluster, cur_cluster, &before_cluster);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
if (before_cluster == -1) {
|
||||
return 14;
|
||||
}
|
||||
} else {
|
||||
before_cluster = *p_iter->ffd.p_start_cluster;
|
||||
}
|
||||
} else {
|
||||
before_cluster = cur_cluster;
|
||||
}
|
||||
p_iter->index--;
|
||||
p_iter->file_sector_index--;
|
||||
if (p_iter->p_vol->bpb.fat_type == FAT_32 || *p_iter->ffd.p_start_cluster > 1 && p_iter->p_vol->bpb.first_data_sector <= p_iter->sector) {
|
||||
p_iter->sector = (p_iter->p_vol->bpb.first_data_sector + ((before_cluster - 2) << p_iter->p_vol->bpb.log2_sectors_per_cluster)) +
|
||||
(p_iter->file_sector_index & (p_iter->p_vol->bpb.sectors_per_cluster - 1));
|
||||
} else {
|
||||
p_iter->sector--;
|
||||
}
|
||||
p_iter->offset = (p_iter->index & p_iter->offset_mask) * 0x20;
|
||||
return 0;
|
||||
}
|
||||
return PFENT_ITER_MoveTo(p_iter, p_iter->index - 1, may_allocate);
|
||||
}
|
||||
|
||||
pf_s32 PFENT_ITER_FindDirEntryFromCluster(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent, pf_u32 cluster, pf_bool* p_is_found) {
|
||||
pf_u8 attr;
|
||||
pf_s32 err = 0;
|
||||
|
||||
*p_is_found = PF_FALSE;
|
||||
p_ent->num_entry_LFNs = 0;
|
||||
p_ent->ordinal = 0;
|
||||
p_ent->check_sum = 0;
|
||||
if ((p_ent->attr & 0x10) && p_ent->start_cluster == 1) return 2;
|
||||
for (; PFENT_ITER_IsAtLogicalEnd(p_iter) == PF_FALSE; err = AdvanceIterator(p_iter, PF_FALSE)) {
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
if (p_iter->buf[0] == 0xE5) {
|
||||
p_ent->num_entry_LFNs = 0;
|
||||
p_ent->long_name[0] = 0;
|
||||
continue;
|
||||
}
|
||||
attr = p_iter->buf[0xB];
|
||||
if ((attr & (0x01 | 0x02 | 0x04 | 0x08)) == (0x01 | 0x02 | 0x04 | 0x08)) {
|
||||
err = PFENT_LoadLFNEntryFieldsFromBuf(p_ent, p_iter->buf);
|
||||
if (err != 0) {
|
||||
p_ent->num_entry_LFNs = 0;
|
||||
p_ent->long_name[0] = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ((attr & 0x08) != 0) {
|
||||
p_ent->num_entry_LFNs = 0;
|
||||
p_ent->long_name[0] = 0;
|
||||
continue;
|
||||
}
|
||||
if ((attr & 0x10) == 0) {
|
||||
p_ent->num_entry_LFNs = 0;
|
||||
p_ent->long_name[0] = 0;
|
||||
continue;
|
||||
}
|
||||
PFENT_LoadShortNameFromBuf(p_ent, p_iter->buf);
|
||||
if (p_ent->num_entry_LFNs != 0 && p_ent->ordinal == 1 && p_ent->check_sum == PFENT_CalcCheckSum(p_ent)) {
|
||||
PFENT_loadEntryNumericFieldsFromBuf(p_ent, p_iter->buf);
|
||||
p_ent->entry_sector = p_iter->sector;
|
||||
p_ent->entry_offset = p_iter->offset;
|
||||
p_ent->p_vol = p_iter->ffd.p_vol;
|
||||
if ((p_ent->attr & 0x10) != 0 && p_ent->start_cluster != cluster) {
|
||||
p_ent->num_entry_LFNs = 0;
|
||||
p_ent->long_name[0] = 0;
|
||||
continue;
|
||||
}
|
||||
if ((p_ent->attr & 0x10) != 0 && p_ent->start_cluster == 0) {
|
||||
p_ent->start_cluster = 1;
|
||||
}
|
||||
*p_is_found = 1;
|
||||
}
|
||||
if ((p_iter->buf[0xC] & (0x10 | 0x08)) != 0) {
|
||||
PFENT_ITER_MakeLongFileName(p_iter, p_ent);
|
||||
}
|
||||
PFENT_loadEntryNumericFieldsFromBuf(p_ent, p_iter->buf);
|
||||
p_ent->entry_sector = p_iter->sector;
|
||||
p_ent->entry_offset = p_iter->offset;
|
||||
p_ent->p_vol = p_iter->ffd.p_vol;
|
||||
|
||||
if ((p_ent->attr & 0x10) && p_ent->start_cluster != cluster) {
|
||||
p_ent->num_entry_LFNs = 0;
|
||||
p_ent->long_name[0] = 0;
|
||||
*p_is_found = 0;
|
||||
continue;
|
||||
}
|
||||
if ((p_ent->attr & 0x10) && p_ent->start_cluster == 0) p_ent->start_cluster = 1;
|
||||
*p_is_found = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFENT_ITER_FindEntry(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent, PF_STR* p_pattern,
|
||||
pf_u32 attr_required, pf_u32 attr_forbidden, pf_bool* p_is_found) {
|
||||
pf_s32 err;
|
||||
*p_is_found = 0;
|
||||
if (attr_required & attr_forbidden) return 10;
|
||||
if (PFSTR_StrNCmp(p_pattern, (pf_s8*)":", 1, 1, 1) == 0) PFSTR_MoveStrPos(p_pattern, 2);
|
||||
if (PFSTR_StrNCmp(p_pattern, (pf_s8*)"\\", 1, 0, 1) == 0 || PFSTR_StrNCmp(p_pattern, (pf_s8*)"/", 1, 0, 1) == 0) {
|
||||
err = PFENT_GetRootDir(p_iter->p_vol, p_ent);
|
||||
if (err != 0) return err;
|
||||
if (PFSTR_StrNumChar(p_pattern, 1) == 1 && PFSTR_StrNCmp(p_pattern, (pf_s8*)"\0", 2, 0, 1) == 0) return 0;
|
||||
} else {
|
||||
err = PFVOL_GetCurrentDir(p_iter->p_vol, p_ent);
|
||||
if (err != 0) return err;
|
||||
}
|
||||
err = PFENT_ITER_DoFindEntry(p_iter, p_ent, p_pattern, attr_required, attr_forbidden, p_is_found);
|
||||
if (err != 0) return err;
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFENT_ITER_FindEntryNoPathCheck(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent, PF_STR* p_pattern,
|
||||
pf_u32 attr_required, pf_u32 attr_forbidden, pf_bool* p_is_found) {
|
||||
pf_s32 err;
|
||||
*p_is_found = 0;
|
||||
if (attr_required & attr_forbidden) return 10;
|
||||
err = PFENT_ITER_DoFindEntry(p_iter, p_ent, p_pattern, attr_required, attr_forbidden, p_is_found);
|
||||
if (err != 0) return err;
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFENT_ITER_GetEntryOfPath(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent, PF_VOLUME* p_vol, PF_STR* p_path, pf_u32 no_look_last_token) {
|
||||
return PFENT_ITER_DoGetEntry(p_iter, p_ent, p_vol, p_path, 0, no_look_last_token);
|
||||
}
|
||||
|
||||
pf_s32 PFENT_ITER_GetEntryOfPattern(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent, PF_VOLUME* p_vol, PF_STR* p_path) {
|
||||
return PFENT_ITER_DoGetEntry(p_iter, p_ent, p_vol, p_path, 1, 1);
|
||||
}
|
||||
|
||||
pf_s32 PFENT_ITER_GetEntryOfIter(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent) {
|
||||
PFENT_LoadShortNameFromBuf(p_ent, p_iter->buf);
|
||||
PFENT_loadEntryNumericFieldsFromBuf(p_ent, p_iter->buf);
|
||||
p_ent->entry_sector = p_iter->sector;
|
||||
p_ent->entry_offset = p_iter->offset;
|
||||
p_ent->p_vol = p_iter->p_vol;
|
||||
return 0;
|
||||
}
|
||||
|
||||
pf_s32 PFENT_ITER_GetLFNEntryName(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent) {
|
||||
pf_u32 i;
|
||||
pf_s32 err;
|
||||
if (p_ent->num_entry_LFNs != 0 && !(p_ent->small_letter_flag & 0x18)) {
|
||||
for (i = 0; i < p_ent->num_entry_LFNs; ++i) {
|
||||
pf_u16* destination;
|
||||
err = PFENT_ITER_Retreat(p_iter, 0);
|
||||
if (err != 0) return err;
|
||||
err = PFENT_ITER_LoadEntry(p_iter);
|
||||
if (err != 0) return err;
|
||||
destination = &p_ent->long_name[(i * 26U) / 2U];
|
||||
pf_memcpy(destination, &p_iter->buf[1], 10);
|
||||
pf_memcpy(destination + 5, &p_iter->buf[14], 12);
|
||||
pf_memcpy(destination + 11, &p_iter->buf[28], 4);
|
||||
}
|
||||
p_ent->long_name[(p_ent->num_entry_LFNs * 26U) / 2U] = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -21,10 +21,27 @@ typedef struct NWC24MsgObjPrivate {
|
||||
u32 type; // 0x04
|
||||
u32 length; // 0x08
|
||||
u32 appId; // 0x0C
|
||||
#if defined(NWC24_MBOX_CTRL) || defined(NWC24_MSG_COMMIT)
|
||||
u32 unk_0x10;
|
||||
#else
|
||||
u8 unk_0x10[0x4];
|
||||
#endif
|
||||
u32 tag; // 0x14
|
||||
u32 ledPattern; // 0x18
|
||||
#if defined(NWC24_MBOX_CTRL) || defined(NWC24_MSG_COMMIT)
|
||||
u32 unk_0x1C;
|
||||
#endif
|
||||
#if defined(NWC24_MBOX_CTRL) || defined(NWC24_MSG_COMMIT)
|
||||
union {
|
||||
NWC24UserId fromId;
|
||||
#ifdef NWC24_MSG_COMMIT
|
||||
NWC24Data fromAddr;
|
||||
#endif
|
||||
struct { u32 fromIdHigh, fromIdLow; };
|
||||
};
|
||||
#else
|
||||
NWC24UserId fromId; // 0x20
|
||||
#endif
|
||||
u32 unk_0x28;
|
||||
u32 unk_0x2C;
|
||||
NWC24Data unk_0x30;
|
||||
|
||||
1049
libs/RevoEX/src/nwc24/NWC24MBoxCtrl.c
Normal file
1049
libs/RevoEX/src/nwc24/NWC24MBoxCtrl.c
Normal file
File diff suppressed because it is too large
Load Diff
906
libs/RevoEX/src/nwc24/NWC24MsgCommit.c
Normal file
906
libs/RevoEX/src/nwc24/NWC24MsgCommit.c
Normal file
@@ -0,0 +1,906 @@
|
||||
#define NWC24_MSG_COMMIT
|
||||
#include <private/nwc24.h>
|
||||
#include <revolution/net/NETMisc.h>
|
||||
#include <revolution/nwc24.h>
|
||||
|
||||
static char MultiPartDivider[64];
|
||||
BOOL LoopBackEnable = TRUE;
|
||||
static NWC24File* m_pFile;
|
||||
|
||||
static NWC24Err NWC24CommitMsgInternal(NWC24MsgObjPrivate* msg, NWC24MBoxType type);
|
||||
static NWC24Err CheckMsgObject(const NWC24MsgObjPrivate* msg);
|
||||
static NWC24Err CheckMsgBoxSpace(const NWC24MsgObjPrivate* msg, NWC24MBoxType type);
|
||||
static NWC24Err SynthesizeAddrStr(const NWC24Data* address, u32 type, char* dest, s32 capacity, u32* length);
|
||||
static NWC24Err WriteSMTP_MAILFROM(NWC24MsgObjPrivate* msg);
|
||||
static NWC24Err WriteSMTP_RCPTTO(NWC24MsgObjPrivate* msg);
|
||||
static NWC24Err WriteFromField(NWC24MsgObjPrivate* msg);
|
||||
static NWC24Err WriteToField(NWC24MsgObjPrivate* msg);
|
||||
static NWC24Err WriteDateField(NWC24MsgObjPrivate* msg);
|
||||
static NWC24Err WriteXWiiAppIdField(NWC24MsgObjPrivate* msg);
|
||||
static NWC24Err WriteXWiiFaceField(NWC24MsgObjPrivate* msg);
|
||||
static NWC24Err WriteXWiiAltNameField(NWC24MsgObjPrivate* msg);
|
||||
static NWC24Err WriteMIMEAttachHeader(NWC24MsgObjPrivate* msg, u32 index);
|
||||
static NWC24Err WriteContentTypeField(NWC24MsgObjPrivate* msg);
|
||||
static NWC24Err WritePlainText(NWC24MsgObjPrivate* msg);
|
||||
static NWC24Err WriteBase64Data(const u8* data, s32 size, u32* length);
|
||||
static NWC24Err WriteQPData(const u8* data, s32 size, u32* length);
|
||||
NWC24Err NWC24iMBoxOpenNewMsg(NWC24MBoxType type, NWC24File* file, u32* id);
|
||||
NWC24Err NWC24iMBoxCloseMsg(NWC24File* file);
|
||||
NWC24Err NWC24iMBoxAddMsgObj(NWC24MBoxType type, NWC24MsgObjPrivate* msg);
|
||||
NWC24Err NWC24iMBoxCancelMsg(NWC24File* file, NWC24MBoxType type, u32 id);
|
||||
NWC24Err NWC24iMBoxFlushHeader(NWC24MBoxType type);
|
||||
NWC24Err NWC24iMBoxCheck(NWC24MBoxType type, u32 size);
|
||||
NWC24Err NWC24iDateToMinutes(u32* minutes, const NWC24Date* date);
|
||||
NWC24Err NWC24iMinutesToDate(NWC24Date* date, u32 minutes);
|
||||
|
||||
static inline NWC24Err WriteString(NWC24MsgObjPrivate* msg, char* buffer) {
|
||||
s32 length = Mail_strlen(buffer);
|
||||
NWC24Err err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += length;
|
||||
return err;
|
||||
}
|
||||
|
||||
#define CHECK_WRITE(operation) \
|
||||
do { \
|
||||
err = (operation); \
|
||||
if (err != NWC24_OK) { \
|
||||
NWC24FClose(&file); \
|
||||
result = err; \
|
||||
goto finish; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static inline NWC24Err WriteSubjectField(NWC24MsgObjPrivate* msg) {
|
||||
char* buffer = NWC24WorkP->stringWork;
|
||||
s32 length;
|
||||
NWC24Err err;
|
||||
if (msg->subject.size == 0)
|
||||
return NWC24_ERR_NULL;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_strcpy(buffer, "Subject: ");
|
||||
Mail_strncat(buffer, msg->subject.ptr, 1021);
|
||||
Mail_strncat(buffer, "\r\n", 1024);
|
||||
length = STD_strnlen(buffer, 1024);
|
||||
err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += length;
|
||||
return err;
|
||||
}
|
||||
|
||||
static inline NWC24Err WriteSMTPData(NWC24MsgObjPrivate* msg, const char* text) {
|
||||
char* buffer = NWC24WorkP->stringWork;
|
||||
s32 length;
|
||||
NWC24Err err;
|
||||
Mail_strcpy(buffer, text);
|
||||
length = Mail_strlen(buffer);
|
||||
err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += 6;
|
||||
return err;
|
||||
}
|
||||
|
||||
static inline NWC24Err WriteCmdField(NWC24MsgObjPrivate* msg) {
|
||||
char* buffer = NWC24WorkP->stringWork;
|
||||
s32 length;
|
||||
NWC24Err err;
|
||||
if (msg->ledPattern == 0)
|
||||
return NWC24_OK;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_sprintf(buffer, "X-Wii-Cmd: %08X\r\n", msg->ledPattern);
|
||||
length = Mail_strlen(buffer);
|
||||
err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += length;
|
||||
return err;
|
||||
}
|
||||
|
||||
static inline NWC24Err WriteTagField(NWC24MsgObjPrivate* msg) {
|
||||
char* buffer = NWC24WorkP->stringWork;
|
||||
s32 length;
|
||||
NWC24Err err;
|
||||
if (msg->tag == 0)
|
||||
return NWC24_OK;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_sprintf(buffer, "X-Wii-Tag: %08X\r\n", msg->tag);
|
||||
length = Mail_strlen(buffer);
|
||||
err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += length;
|
||||
return err;
|
||||
}
|
||||
|
||||
static inline NWC24Err WriteDWCIdField(NWC24MsgObjPrivate* msg) {
|
||||
char* buffer = NWC24WorkP->stringWork;
|
||||
s32 length;
|
||||
NWC24Err err;
|
||||
if (!(msg->type & 0x2000))
|
||||
return NWC24_OK;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_sprintf(buffer, "X-Wii-DWCId: %08X\r\n", msg->dwcId);
|
||||
length = Mail_strlen(buffer);
|
||||
err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += length;
|
||||
return err;
|
||||
}
|
||||
|
||||
static inline NWC24Err WriteIconNewField(NWC24MsgObjPrivate* msg) {
|
||||
char* buffer = NWC24WorkP->stringWork;
|
||||
s32 length;
|
||||
NWC24Err err;
|
||||
if (msg->iconNew == 0 || msg->iconNew == 0x80000000)
|
||||
return NWC24_OK;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_sprintf(buffer, "X-Wii-IconNew: %08X\r\n", msg->iconNew);
|
||||
length = Mail_strlen(buffer);
|
||||
err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += length;
|
||||
return err;
|
||||
}
|
||||
|
||||
static inline NWC24Err WriteMessageIdField(NWC24MsgObjPrivate* msg) {
|
||||
char* buffer = NWC24WorkP->stringWork;
|
||||
const char* domain;
|
||||
NWC24UserId myId;
|
||||
char idText[32];
|
||||
s32 length;
|
||||
NWC24Err err;
|
||||
domain = NWC24GetAccountDomain();
|
||||
NWC24GetMyUserId(&myId);
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_strcpy(buffer, "Message-Id: <");
|
||||
Mail_memset(idText, 0, 32);
|
||||
Mail_sprintf(idText, "%05X%08X%08X%08X", msg->msgId, (u32)(myId >> 32), (u32)myId, msg->unk_0x28);
|
||||
Mail_strcat(buffer, idText);
|
||||
Mail_strcat(buffer, domain);
|
||||
Mail_strcat(buffer, ">\r\n");
|
||||
length = Mail_strlen(buffer);
|
||||
err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += length;
|
||||
return err;
|
||||
}
|
||||
|
||||
NWC24Err NWC24CommitMsg(NWC24MsgObj* object) {
|
||||
BOOL loopback = FALSE;
|
||||
NWC24MsgObjPrivate* msg = (NWC24MsgObjPrivate*)object;
|
||||
NWC24UserId myId;
|
||||
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
|
||||
return NWC24_ERR_LIB_NOT_OPENED;
|
||||
if (!(msg->type & 0x100) || (msg->type & 0x200))
|
||||
return NWC24_ERR_PROTECTED;
|
||||
if (LoopBackEnable && (msg->type & 1)) {
|
||||
NWC24GetMyUserId(&myId);
|
||||
if (msg->numTo == 1 && msg->toIds[0] == myId)
|
||||
loopback = TRUE;
|
||||
}
|
||||
return NWC24CommitMsgInternal(msg, loopback);
|
||||
}
|
||||
|
||||
static NWC24Err NWC24CommitMsgInternal(NWC24MsgObjPrivate* msg, NWC24MBoxType type) {
|
||||
NWC24File file;
|
||||
NWC24Data attached[2];
|
||||
NWC24Data subject;
|
||||
NWC24Data text;
|
||||
u32 id, encodedLength;
|
||||
s32 initIndex;
|
||||
u32 index;
|
||||
char* buffer;
|
||||
s32 length;
|
||||
NWC24Err result, err;
|
||||
NWC24Data_Init(&subject);
|
||||
NWC24Data_Init(&text);
|
||||
for (initIndex = 0; initIndex < 2; ++initIndex)
|
||||
NWC24Data_Init(&attached[initIndex]);
|
||||
NWC24iSetErrorCode(0);
|
||||
result = CheckMsgObject(msg);
|
||||
if (result != NWC24_OK)
|
||||
goto report;
|
||||
result = CheckMsgBoxSpace(msg, type);
|
||||
if (result != NWC24_OK)
|
||||
goto report;
|
||||
err = NWC24iMBoxOpenNewMsg(type, &file, &id);
|
||||
if (err != NWC24_OK) {
|
||||
result = err;
|
||||
goto finish;
|
||||
}
|
||||
{
|
||||
msg->msgId = id;
|
||||
msg->length = 0;
|
||||
m_pFile = &file;
|
||||
if (type == NWC24_MBOX_TYPE_SEND) {
|
||||
CHECK_WRITE(WriteSMTP_MAILFROM(msg));
|
||||
CHECK_WRITE(WriteSMTP_RCPTTO(msg));
|
||||
CHECK_WRITE(WriteSMTPData(msg, "DATA\r\n"));
|
||||
}
|
||||
CHECK_WRITE(WriteDateField(msg));
|
||||
CHECK_WRITE(WriteFromField(msg));
|
||||
CHECK_WRITE(WriteToField(msg));
|
||||
CHECK_WRITE(WriteMessageIdField(msg));
|
||||
subject.ptr = (const void*)(msg->length + 9);
|
||||
err = WriteSubjectField(msg);
|
||||
if (err == NWC24_OK)
|
||||
subject.size = msg->length - (u32)subject.ptr - 2;
|
||||
else if (err == NWC24_ERR_NULL) {
|
||||
err = NWC24_OK;
|
||||
subject.ptr = NULL;
|
||||
}
|
||||
if (err != NWC24_OK) {
|
||||
NWC24FClose(&file);
|
||||
result = err;
|
||||
goto finish;
|
||||
}
|
||||
if (msg->type & 1) {
|
||||
CHECK_WRITE(WriteXWiiAppIdField(msg));
|
||||
CHECK_WRITE(WriteCmdField(msg));
|
||||
CHECK_WRITE(WriteTagField(msg));
|
||||
CHECK_WRITE(WriteDWCIdField(msg));
|
||||
CHECK_WRITE(WriteXWiiAltNameField(msg));
|
||||
CHECK_WRITE(WriteXWiiFaceField(msg));
|
||||
CHECK_WRITE(WriteIconNewField(msg));
|
||||
if (msg->msgBoardFlags.raw != 0) {
|
||||
if (msg->msgBoardFlags.raw & 0x80000000) {
|
||||
buffer = NWC24WorkP->stringWork;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_strcpy(buffer, "X-Wii-MB-NoReply: -\r\n");
|
||||
err = NWC24FWrite(buffer, 21, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += 21;
|
||||
if (err != NWC24_OK) {
|
||||
NWC24FClose(&file);
|
||||
result = err;
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
if (msg->msgBoardFlags.raw & 0xFFFF) {
|
||||
buffer = NWC24WorkP->stringWork;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_sprintf(buffer, "X-Wii-MB-RegDate: %04X\r\n", msg->msgBoardFlags.raw & 0xFFFF);
|
||||
length = STD_strnlen(buffer, 1024);
|
||||
err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += length;
|
||||
if (err != NWC24_OK) {
|
||||
NWC24FClose(&file);
|
||||
result = err;
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
if (msg->msgBoardFlags.raw & 0xFF0000) {
|
||||
buffer = NWC24WorkP->stringWork;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_sprintf(buffer, "X-Wii-MB-Delay: %02X\r\n", (msg->msgBoardFlags.raw >> 16) & 0xFF);
|
||||
length = STD_strnlen(buffer, 1024);
|
||||
err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += length;
|
||||
if (err != NWC24_OK) {
|
||||
NWC24FClose(&file);
|
||||
result = err;
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (msg->unk_0xD0.size != 0) {
|
||||
err = NWC24FWrite(msg->unk_0xD0.ptr, msg->unk_0xD0.size, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += msg->unk_0xD0.size;
|
||||
if (err != NWC24_OK) {
|
||||
NWC24FClose(&file);
|
||||
result = err;
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
Mail_memset(MultiPartDivider, 0, 40);
|
||||
Mail_sprintf(MultiPartDivider, "Boundary-NWC24-%08X%05X", msg->unk_0x28, msg->msgId);
|
||||
buffer = NWC24WorkP->stringWork;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_strcpy(buffer, "MIME-Version: 1.0\r\n");
|
||||
if (msg->type & 0x10000) {
|
||||
Mail_strcat(buffer, "Content-Type: multipart/mixed;\r\n boundary=\"");
|
||||
Mail_strcat(buffer, MultiPartDivider);
|
||||
Mail_strcat(buffer, "\"\r\n");
|
||||
}
|
||||
CHECK_WRITE(WriteString(msg, buffer));
|
||||
if (msg->type & 0x10000) {
|
||||
msg->unk_0x10 = msg->length;
|
||||
buffer = NWC24WorkP->stringWork;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_sprintf(buffer, "\r\n--%s", MultiPartDivider);
|
||||
Mail_strcat(buffer, "\r\n");
|
||||
CHECK_WRITE(WriteString(msg, buffer));
|
||||
}
|
||||
CHECK_WRITE(WriteContentTypeField(msg));
|
||||
if (!(msg->type & 0x10000))
|
||||
msg->unk_0x10 = msg->length;
|
||||
text.ptr = (const void*)msg->length;
|
||||
err = WritePlainText(msg);
|
||||
if (err == NWC24_ERR_NULL)
|
||||
err = NWC24_OK;
|
||||
if (err != NWC24_OK) {
|
||||
NWC24FClose(&file);
|
||||
result = err;
|
||||
goto finish;
|
||||
}
|
||||
text.size = msg->length - (u32)text.ptr;
|
||||
for (index = 0; index < msg->numAttached; ++index) {
|
||||
buffer = NWC24WorkP->stringWork;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_sprintf(buffer, "\r\n--%s", MultiPartDivider);
|
||||
Mail_strcat(buffer, "\r\n");
|
||||
CHECK_WRITE(WriteString(msg, buffer));
|
||||
CHECK_WRITE(WriteMIMEAttachHeader(msg, index));
|
||||
attached[index].ptr = (const void*)msg->length;
|
||||
err = WriteBase64Data(msg->attached[index].ptr, msg->attached[index].size, &encodedLength);
|
||||
msg->length += encodedLength;
|
||||
if (err != NWC24_OK) {
|
||||
NWC24FClose(&file);
|
||||
result = err;
|
||||
goto finish;
|
||||
}
|
||||
attached[index].size = msg->length - (u32)attached[index].ptr;
|
||||
if (index == msg->numAttached - 1) {
|
||||
buffer = NWC24WorkP->stringWork;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_sprintf(buffer, "\r\n--%s", MultiPartDivider);
|
||||
Mail_strcat(buffer, "--\r\n");
|
||||
CHECK_WRITE(WriteString(msg, buffer));
|
||||
}
|
||||
}
|
||||
}
|
||||
finish:
|
||||
if (result == NWC24_OK) {
|
||||
NWC24iMBoxCloseMsg(&file);
|
||||
} else {
|
||||
NWC24iMBoxCancelMsg(&file, type, id);
|
||||
NWC24iMBoxFlushHeader(type);
|
||||
goto report;
|
||||
}
|
||||
{
|
||||
msg->subject = subject;
|
||||
msg->text = text;
|
||||
msg->attached[0] = attached[0];
|
||||
msg->attached[1] = attached[1];
|
||||
msg->type |= 0x200;
|
||||
if (type == NWC24_MBOX_TYPE_RECV)
|
||||
msg->type |= 0x20;
|
||||
else if (type == NWC24_MBOX_TYPE_SEND)
|
||||
msg->type |= 0x10;
|
||||
err = NWC24iMBoxAddMsgObj(type, msg);
|
||||
if (result != NWC24_OK)
|
||||
err = result;
|
||||
result = err;
|
||||
if (type == NWC24_MBOX_TYPE_RECV) {
|
||||
u32 flags = 1;
|
||||
if (msg->type & 8)
|
||||
flags |= 2;
|
||||
NWC24iSetNewMsgArrived(flags);
|
||||
}
|
||||
}
|
||||
report:
|
||||
if (result == NWC24_ERR_FULL || (result <= -16 && result >= -21) || result == -38 || result == -41 || result == -43 || result == -46)
|
||||
NWC24iSetErrorCode(result - 109300);
|
||||
return result;
|
||||
}
|
||||
|
||||
static NWC24Err CheckMsgObject(const NWC24MsgObjPrivate* msg) {
|
||||
const char* subject;
|
||||
if (msg->numTo == 0)
|
||||
return NWC24_ERR_NULL;
|
||||
if (msg->numTo > 8)
|
||||
return NWC24_ERR_INVALID_VALUE;
|
||||
subject = msg->subject.ptr;
|
||||
if (subject != NULL) {
|
||||
for (; *subject != '\0'; ++subject) {
|
||||
if (*subject == '\r' && subject[1] != '\n')
|
||||
return NWC24_ERR_FORMAT;
|
||||
if (*subject == '\n' && subject[1] != ' ')
|
||||
return NWC24_ERR_FORMAT;
|
||||
}
|
||||
}
|
||||
if (msg->numAttached > 2)
|
||||
return NWC24_ERR_INVALID_VALUE;
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
static NWC24Err CheckMsgBoxSpace(const NWC24MsgObjPrivate* msg, NWC24MBoxType type) {
|
||||
u32 total = 0;
|
||||
u32 textSize = 0;
|
||||
s32 index;
|
||||
NWC24Err err;
|
||||
for (index = 0; index < msg->numAttached; ++index) {
|
||||
u32 size = msg->attachedSize[index];
|
||||
total += (size * 4 + 2) / 3 + size / 57 * 2 + 4;
|
||||
}
|
||||
switch (msg->encoding) {
|
||||
case NWC24_ENC_7BIT:
|
||||
case NWC24_ENC_8BIT:
|
||||
textSize = msg->text.size;
|
||||
break;
|
||||
case NWC24_ENC_BASE64:
|
||||
textSize = (msg->text.size * 4 + 2) / 3 + msg->text.size / 57 * 2 + 4;
|
||||
break;
|
||||
case NWC24_ENC_QUOTED_PRINTABLE:
|
||||
textSize = msg->text.size * 4 / 3;
|
||||
break;
|
||||
default:
|
||||
textSize = 0;
|
||||
break;
|
||||
}
|
||||
total += textSize;
|
||||
if (total >= 0x31C00)
|
||||
return NWC24_ERR_OVERFLOW;
|
||||
err = NWC24iMBoxCheck(type, total + 1024);
|
||||
if (err != NWC24_OK)
|
||||
return err;
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
static NWC24Err SynthesizeAddrStr(const NWC24Data* address, u32 type, char* dest, s32 capacity, u32* length) {
|
||||
char id[32];
|
||||
NWC24Err err = NWC24_OK;
|
||||
const char* domain;
|
||||
s32 domainLength, written;
|
||||
if (type & 1) {
|
||||
domain = NWC24GetAccountDomain();
|
||||
domainLength = Mail_strlen(domain);
|
||||
if (domainLength <= 0)
|
||||
err = NWC24_ERR_CONFIG;
|
||||
else if (domainLength + 18 >= capacity)
|
||||
err = NWC24_ERR_NOMEM;
|
||||
else {
|
||||
NWC24iConvIdToStr(*(const NWC24UserId*)address, id);
|
||||
written = Mail_sprintf(dest, "%c%s%s", 'w', id, domain);
|
||||
if (written == 0)
|
||||
err = NWC24_ERR_FATAL;
|
||||
else
|
||||
*length = written;
|
||||
}
|
||||
} else if (type & 2) {
|
||||
if (address->size + 3 >= (u32)capacity)
|
||||
err = NWC24_ERR_NOMEM;
|
||||
else {
|
||||
written = Mail_sprintf(dest, "%s", address->ptr);
|
||||
if (written == 0)
|
||||
err = NWC24_ERR_FATAL;
|
||||
else
|
||||
*length = written;
|
||||
}
|
||||
} else
|
||||
err = NWC24_ERR_INVALID_VALUE;
|
||||
return err;
|
||||
}
|
||||
|
||||
static NWC24Err WriteSMTP_MAILFROM(NWC24MsgObjPrivate* msg) {
|
||||
char* buffer = NWC24WorkP->stringWork;
|
||||
char* address;
|
||||
u32 length;
|
||||
s32 total;
|
||||
u32 type;
|
||||
NWC24Err err;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_strncat(buffer, "MAIL FROM: ", 1022);
|
||||
address = buffer + 11;
|
||||
type = 1;
|
||||
if (msg->type & 0x100000)
|
||||
type = 2;
|
||||
err = SynthesizeAddrStr(&msg->fromAddr, type, address, 1009, &length);
|
||||
if (err != NWC24_OK)
|
||||
return err;
|
||||
{
|
||||
address += length;
|
||||
address[0] = '\r';
|
||||
address[1] = '\n';
|
||||
total = length + 13;
|
||||
if ((s32)(1009 - length) <= 0)
|
||||
return NWC24_ERR_NOMEM;
|
||||
}
|
||||
if (err == NWC24_OK) {
|
||||
err = NWC24FWrite(NWC24WorkP->stringWork, total, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += total;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static NWC24Err WriteSMTP_RCPTTO(NWC24MsgObjPrivate* msg) {
|
||||
char* cursor = NWC24WorkP->stringWork;
|
||||
u32 index;
|
||||
s32 total = 0, remaining;
|
||||
u32 length;
|
||||
NWC24Err err = NWC24_OK;
|
||||
Mail_memset(cursor, 0, 1024);
|
||||
remaining = 1022;
|
||||
for (index = 0; index < msg->numTo; ++index) {
|
||||
Mail_strncat(cursor, "RCPT TO: ", remaining);
|
||||
cursor += 9;
|
||||
remaining -= 11;
|
||||
err = SynthesizeAddrStr(&msg->toAddrs[index], msg->type, cursor, remaining, &length);
|
||||
if (err != NWC24_OK)
|
||||
break;
|
||||
cursor += length;
|
||||
cursor[0] = '\r';
|
||||
cursor[1] = '\n';
|
||||
cursor += 2;
|
||||
remaining -= length;
|
||||
total += length + 11;
|
||||
if (remaining <= 0) {
|
||||
err = NWC24_ERR_NOMEM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (err == NWC24_OK) {
|
||||
err = NWC24FWrite(NWC24WorkP->stringWork, total, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += total;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static NWC24Err WriteFromField(NWC24MsgObjPrivate* msg) {
|
||||
char* buffer = NWC24WorkP->stringWork;
|
||||
char* address;
|
||||
u32 length;
|
||||
s32 total;
|
||||
u32 type;
|
||||
NWC24Err err;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_strncat(buffer, "From: ", 1022);
|
||||
address = buffer + 6;
|
||||
msg->unk_0x30.ptr = (const void*)(msg->length + 6);
|
||||
type = 1;
|
||||
if (msg->type & 0x100000)
|
||||
type = 2;
|
||||
err = SynthesizeAddrStr(&msg->fromAddr, type, address, 1014, &length);
|
||||
if (err != NWC24_OK)
|
||||
return err;
|
||||
{
|
||||
address += length;
|
||||
address[0] = '\r';
|
||||
address[1] = '\n';
|
||||
total = length + 8;
|
||||
if ((s32)(1014 - length) <= 0)
|
||||
return NWC24_ERR_NOMEM;
|
||||
}
|
||||
if (err == NWC24_OK) {
|
||||
err = NWC24FWrite(NWC24WorkP->stringWork, total, m_pFile);
|
||||
if (err == NWC24_OK) {
|
||||
msg->length += total;
|
||||
msg->unk_0x30.size = msg->length - (u32)msg->unk_0x30.ptr - 2;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static NWC24Err WriteToField(NWC24MsgObjPrivate* msg) {
|
||||
char* buffer = NWC24WorkP->stringWork;
|
||||
char* cursor;
|
||||
s32 index, total, remaining;
|
||||
u32 length;
|
||||
NWC24Err err = NWC24_OK;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_strncat(buffer, "To: ", 1022);
|
||||
cursor = buffer + 4;
|
||||
index = 0;
|
||||
total = 4;
|
||||
msg->unk_0x38.ptr = (const void*)(msg->length + 4);
|
||||
remaining = 1018;
|
||||
for (; index < msg->numTo; ++index) {
|
||||
err = SynthesizeAddrStr(&msg->toAddrs[index], msg->type, cursor, remaining, &length);
|
||||
if (err != NWC24_OK)
|
||||
break;
|
||||
remaining -= length;
|
||||
cursor += length;
|
||||
total += length;
|
||||
if (remaining <= 4) {
|
||||
err = NWC24_ERR_NOMEM;
|
||||
break;
|
||||
}
|
||||
if (index < msg->numTo - 1) {
|
||||
cursor[0] = ',';
|
||||
cursor[1] = '\r';
|
||||
cursor[2] = '\n';
|
||||
cursor[3] = ' ';
|
||||
total += 4;
|
||||
remaining -= 4;
|
||||
cursor += 4;
|
||||
}
|
||||
}
|
||||
cursor[0] = '\r';
|
||||
cursor[1] = '\n';
|
||||
if (err == NWC24_OK) {
|
||||
err = NWC24FWrite(NWC24WorkP->stringWork, total + 2, m_pFile);
|
||||
if (err == NWC24_OK) {
|
||||
msg->length += total + 2;
|
||||
msg->unk_0x38.size = msg->length - (u32)msg->unk_0x38.ptr - 2;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static NWC24Err WriteDateField(NWC24MsgObjPrivate* msg) {
|
||||
static const char* months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
NWC24Date date;
|
||||
OSCalendarTime calendar;
|
||||
char* buffer;
|
||||
s32 length;
|
||||
NWC24Err err;
|
||||
NWC24Date_Init(&date);
|
||||
NETGetUniversalCalendar(&calendar);
|
||||
date.year = calendar.year;
|
||||
date.month = calendar.mon + 1;
|
||||
date.day = calendar.mday;
|
||||
date.hour = calendar.hour;
|
||||
date.min = calendar.min;
|
||||
date.sec = calendar.sec;
|
||||
if (date.month > 12)
|
||||
return NWC24_ERR_FORMAT;
|
||||
NWC24iDateToMinutes(&msg->unk_0x28, &date);
|
||||
if (msg->type & 0x1000000)
|
||||
NWC24iMinutesToDate(&date, msg->unk_0x2C);
|
||||
buffer = NWC24WorkP->stringWork;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_sprintf(buffer, "Date: %02d %s %d %02d:%02d:%02d -0000\r\n", date.day, months[date.month - 1], date.year, date.hour, date.min, date.sec);
|
||||
length = Mail_strlen(buffer);
|
||||
err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += length;
|
||||
return err;
|
||||
}
|
||||
|
||||
static NWC24Err WriteXWiiAppIdField(NWC24MsgObjPrivate* msg) {
|
||||
char* buffer = NWC24WorkP->stringWork;
|
||||
char appIdText[16];
|
||||
u32 type = 0;
|
||||
s32 length;
|
||||
NWC24Err err;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_strcpy(buffer, "X-Wii-AppId: ");
|
||||
if (!NWC24IsMsgLibOpenedByTool() && NWC24GetAppId() != 0x48414541 && msg->appId != 0x48414341)
|
||||
msg->appId = NWC24GetAppId();
|
||||
if (msg->type & 4)
|
||||
type |= 1;
|
||||
if (msg->type & 8)
|
||||
type |= 2;
|
||||
Mail_memset(appIdText, 0, 16);
|
||||
Mail_sprintf(appIdText, "%d-%08X-%04X\r\n", type, msg->appId, msg->groupId);
|
||||
Mail_strcat(buffer, appIdText);
|
||||
length = Mail_strlen(buffer);
|
||||
err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += length;
|
||||
return err;
|
||||
}
|
||||
|
||||
static NWC24Err WriteXWiiFaceField(NWC24MsgObjPrivate* msg) {
|
||||
char* buffer;
|
||||
const u8* data;
|
||||
s32 offset, remaining, chunk;
|
||||
u32 length;
|
||||
NWC24Err err;
|
||||
if (msg->faceData.size == 0)
|
||||
return NWC24_OK;
|
||||
buffer = NWC24WorkP->stringWork;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_strcpy(buffer, "X-WiiFace:");
|
||||
data = msg->faceData.ptr;
|
||||
offset = 10;
|
||||
for (remaining = msg->faceData.size; remaining > 0; remaining -= chunk) {
|
||||
buffer[offset++] = ' ';
|
||||
chunk = remaining;
|
||||
if (remaining > 42)
|
||||
chunk = 42;
|
||||
NWC24Base64Encode((u8*)data, chunk, (u8*)(buffer + offset), 76, &length);
|
||||
data += chunk;
|
||||
offset += length;
|
||||
buffer[offset++] = '\r';
|
||||
buffer[offset++] = '\n';
|
||||
}
|
||||
err = NWC24FWrite(buffer, offset, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += offset;
|
||||
return err;
|
||||
}
|
||||
|
||||
static NWC24Err WriteXWiiAltNameField(NWC24MsgObjPrivate* msg) {
|
||||
char* buffer;
|
||||
const u8* data;
|
||||
s32 offset, remaining, chunk;
|
||||
u32 length;
|
||||
NWC24Err err;
|
||||
if (msg->altName.size == 0)
|
||||
return NWC24_OK;
|
||||
buffer = NWC24WorkP->stringWork;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_strcpy(buffer, "X-Wii-AltName:");
|
||||
data = msg->altName.ptr;
|
||||
offset = 14;
|
||||
for (remaining = msg->altName.size; remaining > 0; remaining -= chunk) {
|
||||
buffer[offset++] = ' ';
|
||||
chunk = remaining;
|
||||
if (remaining > 42)
|
||||
chunk = 42;
|
||||
NWC24Base64Encode((u8*)data, chunk, (u8*)(buffer + offset), 76, &length);
|
||||
data += chunk;
|
||||
offset += length;
|
||||
buffer[offset++] = '\r';
|
||||
buffer[offset++] = '\n';
|
||||
}
|
||||
err = NWC24FWrite(buffer, offset, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += offset;
|
||||
return err;
|
||||
}
|
||||
|
||||
const char* ContentTypeA = "Content-Type: %s;\r\n name=%c%07d.%s\r\n";
|
||||
const char* ContentTxEncA = "Content-Transfer-Encoding: base64\r\n";
|
||||
const char* ContentDispA = "Content-Disposition: attachment;\r\n filename=%c%07d.%s\r\n\r\n";
|
||||
|
||||
static NWC24Err WriteMIMEAttachHeader(NWC24MsgObjPrivate* msg, u32 index) {
|
||||
char* buffer;
|
||||
const char* mime;
|
||||
const char* suffix;
|
||||
s32 typeLength, encodingLength, dispositionLength, mimeLength;
|
||||
s32 first, second, third, total;
|
||||
NWC24Err err;
|
||||
Mail_memset(NWC24WorkP->stringWork, 0, 1024);
|
||||
buffer = NWC24WorkP->stringWork;
|
||||
mime = NWC24GetMIMETypeStr(msg->attachedType[index]);
|
||||
suffix = NWC24iGetMIMETypeSuffix(msg->attachedType[index]);
|
||||
encodingLength = Mail_strlen(ContentTxEncA);
|
||||
typeLength = Mail_strlen(ContentTypeA);
|
||||
dispositionLength = Mail_strlen(ContentDispA);
|
||||
typeLength += encodingLength;
|
||||
mimeLength = Mail_strlen(mime);
|
||||
if (mimeLength + (dispositionLength + typeLength) + 4 >= 1024)
|
||||
return NWC24_ERR_NOMEM;
|
||||
first = Mail_sprintf(buffer, (char*)ContentTypeA, mime, (char)('a' + index), msg->msgId, suffix);
|
||||
if (first <= 0)
|
||||
return NWC24_ERR_FAILED;
|
||||
buffer += first;
|
||||
second = Mail_sprintf(buffer, (char*)ContentTxEncA);
|
||||
if (second <= 0)
|
||||
return NWC24_ERR_FAILED;
|
||||
buffer += second;
|
||||
total = first + second;
|
||||
third = Mail_sprintf(buffer, (char*)ContentDispA, (char)('a' + index), msg->msgId, suffix);
|
||||
if (third <= 0)
|
||||
return NWC24_ERR_FAILED;
|
||||
total += third;
|
||||
err = NWC24FWrite(NWC24WorkP->stringWork, total, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += total;
|
||||
return err;
|
||||
}
|
||||
|
||||
const char* ContentTypeTP = "Content-Type: text/plain; charset=%s\r\n";
|
||||
const char* ContentTxEncT = "Content-Transfer-Encoding: %s\r\n\r\n";
|
||||
|
||||
static NWC24Err WriteContentTypeField(NWC24MsgObjPrivate* msg) {
|
||||
char* buffer = NWC24WorkP->stringWork;
|
||||
const char* name;
|
||||
const char* encoding;
|
||||
s32 total = 0;
|
||||
NWC24Err err;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
name = NWC24GetCharsetStr(msg->charset);
|
||||
if (name != NULL) {
|
||||
Mail_sprintf(buffer, (char*)ContentTypeTP, name);
|
||||
msg->unk_0x50.ptr = (const void*)(msg->length + 34);
|
||||
msg->unk_0x50.size = Mail_strlen(name) + 1;
|
||||
total = Mail_strlen(buffer);
|
||||
buffer += total;
|
||||
}
|
||||
encoding = NWC24GetEncodingStr(msg->encoding);
|
||||
if (encoding != NULL) {
|
||||
Mail_sprintf(buffer, (char*)ContentTxEncT, encoding);
|
||||
msg->unk_0x58.ptr = (const void*)(total + msg->length + 27);
|
||||
msg->unk_0x58.size = Mail_strlen(encoding) + 1;
|
||||
total += Mail_strlen(buffer);
|
||||
}
|
||||
if (total == 0)
|
||||
return NWC24_OK;
|
||||
err = NWC24FWrite(NWC24WorkP->stringWork, total, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += total;
|
||||
return err;
|
||||
}
|
||||
|
||||
static NWC24Err WritePlainText(NWC24MsgObjPrivate* msg) {
|
||||
u32 length;
|
||||
NWC24Err err;
|
||||
if (msg->text.size == 0)
|
||||
return NWC24_ERR_NULL;
|
||||
switch (msg->encoding) {
|
||||
case NWC24_ENC_7BIT:
|
||||
case NWC24_ENC_8BIT:
|
||||
err = NWC24FWrite(msg->text.ptr, msg->text.size, m_pFile);
|
||||
length = msg->text.size;
|
||||
break;
|
||||
case NWC24_ENC_BASE64:
|
||||
err = WriteBase64Data(msg->text.ptr, msg->text.size, &length);
|
||||
break;
|
||||
case NWC24_ENC_QUOTED_PRINTABLE:
|
||||
err = WriteQPData(msg->text.ptr, msg->text.size, &length);
|
||||
break;
|
||||
default:
|
||||
err = NWC24_ERR_INVALID_VALUE;
|
||||
break;
|
||||
}
|
||||
if (err == NWC24_OK) {
|
||||
msg->textSize = msg->text.size;
|
||||
msg->length += length;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static NWC24Err WriteBase64Data(const u8* data, s32 size, u32* totalLength) {
|
||||
const u8* cursor = data;
|
||||
char* buffer = NWC24WorkP->stringWork;
|
||||
u32 length;
|
||||
u32 total = 0;
|
||||
NWC24Err err = NWC24_OK;
|
||||
while (size >= 57) {
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
err = NWC24Base64Encode((u8*)cursor, 57, (u8*)buffer, 76, &length);
|
||||
if (err != NWC24_OK)
|
||||
break;
|
||||
buffer[length++] = '\r';
|
||||
buffer[length++] = '\n';
|
||||
buffer[length] = '\0';
|
||||
err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err != NWC24_OK)
|
||||
break;
|
||||
cursor += 57;
|
||||
size -= 57;
|
||||
total += length;
|
||||
}
|
||||
if (err == NWC24_OK) {
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
err = NWC24Base64Encode((u8*)cursor, size, (u8*)buffer, 76, &length);
|
||||
if (err == NWC24_OK) {
|
||||
buffer[length++] = '\r';
|
||||
buffer[length++] = '\n';
|
||||
buffer[length++] = '\r';
|
||||
buffer[length++] = '\n';
|
||||
buffer[length] = '\0';
|
||||
err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
total += length;
|
||||
}
|
||||
}
|
||||
*totalLength = total;
|
||||
return err;
|
||||
}
|
||||
|
||||
static NWC24Err WriteQPData(const u8* data, s32 size, u32* totalLength) {
|
||||
char* buffer = NWC24WorkP->stringWork;
|
||||
const u8* cursor = data;
|
||||
s32 total = 0;
|
||||
s32 remaining = size;
|
||||
u32 consumed, length;
|
||||
NWC24Err err = NWC24_OK;
|
||||
for (; remaining > 0; remaining -= consumed) {
|
||||
if (total > 0) {
|
||||
Mail_memcpy(buffer, "=\r\n", 3);
|
||||
err = NWC24FWrite(buffer, 3, m_pFile);
|
||||
if (err != NWC24_OK)
|
||||
break;
|
||||
total += 3;
|
||||
}
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
err = NWC24EncodeQuotedPrintable(buffer, 1024, &length, (u8*)cursor, remaining, &consumed);
|
||||
if (err != NWC24_OK && err != NWC24_ERR_OVERFLOW)
|
||||
break;
|
||||
err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err != NWC24_OK)
|
||||
break;
|
||||
cursor += consumed;
|
||||
total += length;
|
||||
}
|
||||
*totalLength = total;
|
||||
return err;
|
||||
}
|
||||
@@ -23,7 +23,7 @@ static const void* NETGetSHA1Interface(void);
|
||||
static void NETHMACInit(NETHMACContext* ctx, const void* interface, const void* key, u32 keyLen);
|
||||
static void NETHMACUpdate(NETHMACContext* ctx, const void* data, u32 len);
|
||||
static void NETHMACGetDigest(NETHMACContext* ctx, void* digest);
|
||||
extern char lbl_81697583[];
|
||||
extern char VmReportFormat[];
|
||||
|
||||
#define CHANSVmDebugLength 1024
|
||||
#define VM_FRAME_ARENA_SIZE 8192
|
||||
@@ -66,7 +66,7 @@ void CHANSVmDebugPrintf(const vmString format, ...) {
|
||||
|
||||
str[CHANSVmDebugLength - 1] = str[CHANSVmDebugLength - 2] = 0;
|
||||
|
||||
OSReport(lbl_81697583, str);
|
||||
OSReport(VmReportFormat, str);
|
||||
}
|
||||
|
||||
#define CHANS_VM_PRINTF(line, msg, ...) \
|
||||
@@ -92,8 +92,8 @@ vmU16 CHANSVmGetSourceLine(CHANSVm* vm) {
|
||||
}
|
||||
}
|
||||
|
||||
if ((u8*)curEntry + lineOffset + 1 < (u8*)ctx->pDbg + ctx->pDbg->regionSize) {
|
||||
u8* lineData = (u8*)curEntry + lineOffset;
|
||||
if ((u8*)ctx->pDbg->pLineTbl + lineOffset + 1 < (u8*)ctx->pDbg + ctx->pDbg->regionSize) {
|
||||
u8* lineData = (u8*)ctx->pDbg->pLineTbl + lineOffset;
|
||||
return VM_READ_BE_U16(lineData, 0);
|
||||
}
|
||||
}
|
||||
@@ -347,7 +347,7 @@ vmPtr CHANSVmNewObjData(CHANSVm* vm, CHANSVmObjHdr* object, u32 length) {
|
||||
if (chunk == vmNull) {
|
||||
chunk = CHANSVmAlloc(vm, 0x4000);
|
||||
if (chunk == vmNull) {
|
||||
goto error;
|
||||
goto no_entry;
|
||||
}
|
||||
pVm->pChunks[chunkIdx] = chunk;
|
||||
}
|
||||
@@ -365,6 +365,7 @@ vmPtr CHANSVmNewObjData(CHANSVm* vm, CHANSVmObjHdr* object, u32 length) {
|
||||
chunkIdx++;
|
||||
u.off += 4;
|
||||
}
|
||||
no_entry:
|
||||
u.off = 0;
|
||||
goto check_entry;
|
||||
}
|
||||
@@ -397,7 +398,7 @@ error:
|
||||
return vmNull;
|
||||
}
|
||||
|
||||
extern const char CHANSVmConstStringDataEmpty[16];
|
||||
extern const CHANSVmObjHdr CHANSVmConstStringDataEmpty;
|
||||
|
||||
CHANSVmObjHdr* CHANSVmNewObject(CHANSVm* vm, vmBoolInt noAlloc, CHANSVmObjHdr* object, CHANSVmObjType type, vmSize len) {
|
||||
CHANSVmObjHdr* header;
|
||||
@@ -418,7 +419,7 @@ CHANSVmObjHdr* CHANSVmNewObject(CHANSVm* vm, vmBoolInt noAlloc, CHANSVmObjHdr* o
|
||||
}
|
||||
} else {
|
||||
if (type == 3UL) {
|
||||
object->value.ptr_v = (vmPtr)CHANSVmConstStringDataEmpty;
|
||||
object->value.ptr_v = (vmPtr)&CHANSVmConstStringDataEmpty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -509,15 +510,14 @@ CHANSVmErr CHANSVmPopObject(CHANSVm* vm, CHANSVmObjHdr* object) {
|
||||
|
||||
void CHANSVmStrCpyToU16FromU8(vmWString output, vmString input, vmSize length) {
|
||||
u8* src = (u8*)input + length;
|
||||
u32 offset = VM_STR_LENGTH(length);
|
||||
|
||||
while (length > 0) {
|
||||
u8 val;
|
||||
offset -= 2;
|
||||
u32 offset = VM_STR_LENGTH(--length);
|
||||
u8* dest = (u8*)output + offset;
|
||||
val = *--src;
|
||||
((u8*)output)[offset + 1] = val;
|
||||
((u8*)output)[offset] = 0;
|
||||
length--;
|
||||
dest[1] = val;
|
||||
dest[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -667,25 +667,25 @@ u8 lbl_81669094[19] = {0x00, '-', 0x00, 'I', 0x00, 'n', 0x00, 'f', 0x00, 'i', 0x
|
||||
|
||||
// clang-format off
|
||||
const CHANSVmObjHdr CHANSVmConstStringObjectUndefined = {{(wchar_t*)lbl_81669070, 18}, {0}, vmNull};
|
||||
const CHANSVmObjHdr lbl_81616C88 = {{L"NaN", 6}, {0}, vmNull};
|
||||
const CHANSVmObjHdr lbl_81616C88 = {{(wchar_t*)"\0N\0a\0N", 6}, {0}, vmNull};
|
||||
const CHANSVmObjHdr lbl_81616C98 = {{(wchar_t*)lbl_81669083, 16}, {0}, vmNull};
|
||||
const CHANSVmObjHdr lbl_81616CA8 = {{(wchar_t*)lbl_81669094, 18}, {0}, vmNull};
|
||||
const CHANSVmObjHdr lbl_81616CB8 = {{L",", 2}, {0}, vmNull};
|
||||
const char CHANSVmConstStringDataEmpty[16] = "";
|
||||
const CHANSVmObjHdr lbl_81616CB8 = {{(wchar_t*)"\0,", 2}, {0}, vmNull};
|
||||
const CHANSVmObjHdr CHANSVmConstStringDataEmpty = {{(wchar_t*)"", 0}, {0}, vmNull};
|
||||
const CHANSVmObjHdr CHANSVmConstStringObjectUndefined_[] = {{{(void*)&CHANSVmConstStringObjectUndefined, 0}, 0x03800100, vmNull},
|
||||
{{(void*)&lbl_81616C88, 0}, 0x03800100, vmNull},
|
||||
{{(void*)&lbl_81616C98, 0}, 0x03800100, vmNull},
|
||||
{{(void*)&lbl_81616CA8, 0}, 0x03800100, vmNull},
|
||||
{{(void*)&lbl_81616CB8, 0}, 0x00800000, vmNull}};
|
||||
char lbl_81697583[] = "%s";
|
||||
char lbl_8169758A[] = "%.16lg";
|
||||
{{vmNull, 0}, 0x00800000, vmNull}};
|
||||
char VmReportFormat[] = "%s";
|
||||
|
||||
const CHANSVmFloatConstantList lbl_81616D28[] = {
|
||||
{ "Infinity", (double*)&VmInf },
|
||||
{ "+Infinity", (double*)&VmInf },
|
||||
{ "-Infinity", (double*)&VmMinusInf },
|
||||
{ "Infinity", (double*)&VmNaN }
|
||||
{ "NaN", (double*)&VmNaN }
|
||||
};
|
||||
char lbl_8169758A[] = "%.16lg";
|
||||
// clang-format on
|
||||
|
||||
CHANSVmObjHdr* CHANSVm_8144B4D4(CHANSVm* vm, CHANSVmObjType type, CHANSVmObjHdr* object) {
|
||||
@@ -764,10 +764,10 @@ s32 CHANSVm_8144B62C(vmWString buf, u32 len, vmFloat val) NO_INLINE {
|
||||
return VM_STR_LENGTH(result);
|
||||
}
|
||||
|
||||
char lbl_81697591[] = "%lld";
|
||||
char VmIntegerFormat[] = "%lld";
|
||||
|
||||
static int VmToStrFromInt(vmWString output, vmSize length, vmInteger integer) {
|
||||
vmS32 len = snprintf((vmString)output, length, lbl_81697591, integer);
|
||||
vmS32 len = snprintf((vmString)output, length, VmIntegerFormat, integer);
|
||||
CHANSVmStrCpyToU16FromU8(output, (vmString)output, len);
|
||||
return len;
|
||||
}
|
||||
@@ -853,7 +853,7 @@ vmBoolInt CHANSVmGetEnumedType(CHANSVmObjType* eType, vmU32 iType) NO_INLINE {
|
||||
type = 4;
|
||||
break;
|
||||
}
|
||||
case CHANS_VM_TYPE_GLOBAL_REF:
|
||||
case CHANS_VM_TYPE_OBJECT:
|
||||
case CHANS_VM_TYPE_CLASS_REF:
|
||||
case CHANS_VM_TYPE_METHOD_REF: {
|
||||
type = 5;
|
||||
@@ -876,12 +876,13 @@ char lbl_81669128[] = "VmGetResultType";
|
||||
|
||||
// clang-format off
|
||||
const VmConvertEntry VmTypeConvertFuncTbl[] = {
|
||||
{CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError},
|
||||
{CHANSVm_8144B30C, CHANSVmConvertToIntFromStr, CHANSVmConvertToIntFromArray, CHANSVmConvertObjectTypeError, CHANSVm_8144B430, CHANSVm_8144B470},
|
||||
{CHANSVm_8144B4D4, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertToStrFromUndefined, CHANSVmConvertToStrFromInt, CHANSVm_8144B734},
|
||||
{CHANSVmConvertToStrFromArray, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError},
|
||||
{CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError},
|
||||
{CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError}};
|
||||
{vmNull, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError},
|
||||
{CHANSVmConvertObjectTypeError, vmNull, CHANSVm_8144B30C, CHANSVmConvertToIntFromStr, CHANSVmConvertToIntFromArray, CHANSVmConvertObjectTypeError},
|
||||
{CHANSVm_8144B430, CHANSVm_8144B470, vmNull, CHANSVm_8144B4D4, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError},
|
||||
{CHANSVmConvertToStrFromUndefined, CHANSVmConvertToStrFromInt, CHANSVm_8144B734, vmNull, CHANSVmConvertToStrFromArray, CHANSVmConvertObjectTypeError},
|
||||
{CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, vmNull, CHANSVmConvertObjectTypeError},
|
||||
{CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, vmNull},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// Each table is a 6x6 u8 matrix indexed [left_enumed][right_enumed].
|
||||
@@ -1533,8 +1534,8 @@ const char* vmErrorList[] = {
|
||||
"CHANS_VM_ERR_RESERVED_OPCODE", /* -923 */
|
||||
};
|
||||
|
||||
const char* vmNoError = "CHANS_VM_OK";
|
||||
const char* vmUnknownError = "(unknown)";
|
||||
char vmNoError[] = "CHANS_VM_OK";
|
||||
char vmUnknownError[] = "(unknown)";
|
||||
|
||||
CHANSVmNativeClass* CHANSVmFindNativeClass(CHANSVm* vm, const char* clsName) {
|
||||
CHANSVmPrivate* pVm = (CHANSVmPrivate*)vm;
|
||||
@@ -1920,15 +1921,15 @@ static CHANSVmErr VmArrayExpandCommon(CHANSVm* vm, CHANSVmObjHdr* obj, u32 start
|
||||
chunk->pNext = current;
|
||||
}
|
||||
|
||||
for (i = 0, allocSize = 0; i < total; i++, allocSize += sizeof(CHANSVmObjHdr)) {
|
||||
for (i = 0; i < total; i++) {
|
||||
if (fillFromArgs != 0 && i < ((CHANSVmPrivate*)vm)->pActiveCtx->argc && CHANSVmGetArg(vm, i) != vmNull) {
|
||||
CHANSVmObjHdr* arg = CHANSVmGetArg(vm, i);
|
||||
if (CHANSVmCopyObject(vm, (CHANSVmObjHdr*)((u8*)chunk + sizeof(ArrayChunk) + allocSize), arg) == vmNull) {
|
||||
if (CHANSVmCopyObject(vm, &chunk->elements[i], arg) == vmNull) {
|
||||
goto error;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
memset((u8*)chunk + sizeof(ArrayChunk) + allocSize, 0, sizeof(CHANSVmObjHdr));
|
||||
memset(&chunk->elements[i], 0, sizeof(CHANSVmObjHdr));
|
||||
}
|
||||
|
||||
return vmTrue;
|
||||
@@ -2146,7 +2147,7 @@ static u32 VmArrayJoinSub(CHANSVmObjHdr* obj, CHANSVmObjHdr* array, wchar_t* sep
|
||||
goto error;
|
||||
}
|
||||
strBuf = (vmString)(*obj->value.ptr_v) + offset;
|
||||
elemLen = snprintf(strBuf, 0x40, lbl_81697591, chunk->elements[countInChunk].value.int_v);
|
||||
elemLen = snprintf(strBuf, 0x40, VmIntegerFormat, chunk->elements[countInChunk].value.int_v);
|
||||
CHANSVmStrCpyToU16FromU8((vmWString)strBuf, strBuf, elemLen);
|
||||
elemLen = elemLen << 1;
|
||||
break;
|
||||
@@ -2631,10 +2632,8 @@ VmMethodDefine(Date, GetRTC) {
|
||||
u32 bias = SCGetCounterBias();
|
||||
s64 ticks = OSCalendarTimeToTicks(cal);
|
||||
u64 t = ticks / (__OSBusClock / 4 / 1000);
|
||||
u32 val;
|
||||
t = t / 1000;
|
||||
val = (u32)(t - (unsigned int)bias);
|
||||
return CHANSVmSetInteger(VmInst, VmReturnObj, val) == CHANS_VM_OK;
|
||||
t /= 1000;
|
||||
return CHANSVmSetInteger(VmInst, VmReturnObj, (t - bias) & 0xFFFFFFFFULL) == CHANS_VM_OK;
|
||||
}
|
||||
|
||||
const CHANSVmMethodList VmDateMethodTbl[] = {
|
||||
@@ -3167,13 +3166,13 @@ VmMethodDefine(String, Splice) {
|
||||
length = VmParentObj->value.string_v->len;
|
||||
|
||||
if (arg0 != vmNull) {
|
||||
s64 byteOffs0 = arg0->value.int_v * 2;
|
||||
if (byteOffs0 > length) {
|
||||
s64 startByteOffset = arg0->value.int_v * 2;
|
||||
if (startByteOffset > length) {
|
||||
start = length;
|
||||
} else {
|
||||
start = byteOffs0;
|
||||
if (byteOffs0 < 0) {
|
||||
s64 t0 = byteOffs0 + length;
|
||||
start = startByteOffset;
|
||||
if (startByteOffset < 0) {
|
||||
s64 t0 = startByteOffset + length;
|
||||
start = t0;
|
||||
if (t0 < 0) {
|
||||
start = 0;
|
||||
@@ -3200,7 +3199,7 @@ VmMethodDefine(String, Splice) {
|
||||
length = tempLen;
|
||||
}
|
||||
|
||||
newLen = length - start & ~-(s32)(start >= length);
|
||||
newLen = start >= length ? 0 : length - start;
|
||||
|
||||
if (CHANSVmNewObject(VmInst, vmFalse, VmReturnObj, CHANS_VM_OBJ_TYPE_STRING, newLen) != vmNull) {
|
||||
if (newLen != 0) {
|
||||
@@ -4163,23 +4162,21 @@ VmMethodDefine(Blob, CopyRangeFrom) {
|
||||
|
||||
if (CHANSVm_81450D14(destBlob, destOffObj->value.int_v, &destOff) != 0 && CHANSVm_81450D14(srcBlob, srcOffObj->value.int_v, &srcOff) != 0) {
|
||||
count = CHANSVm_81451314(srcBlob, countObj, srcOff);
|
||||
if ((s64)destBlob->size >= (s64)count) {
|
||||
u32 available = destBlob->size - destOff;
|
||||
if ((s64)count >= (s64)available) {
|
||||
{
|
||||
u32 destinationOffset = destOff;
|
||||
if ((s64)count >= 0 && (s64)(destBlob->size - destinationOffset) >= (s64)count) {
|
||||
okFlag = vmTrue;
|
||||
}
|
||||
}
|
||||
|
||||
if (okFlag) {
|
||||
okFlag = vmFalse;
|
||||
if ((s64)count >= 0) {
|
||||
u32 available = srcBlob->size - srcOff;
|
||||
if ((s64)count >= (s64)available) {
|
||||
okFlag = vmTrue;
|
||||
}
|
||||
vmBoolInt sourceValid = vmFalse;
|
||||
u32 sourceOffset = srcOff;
|
||||
if ((s64)count >= 0 && (s64)(srcBlob->size - sourceOffset) >= (s64)count) {
|
||||
sourceValid = vmTrue;
|
||||
}
|
||||
|
||||
if (okFlag) {
|
||||
if (sourceValid) {
|
||||
memmove(destBlob->pData + destOff, srcBlob->pData + srcOff, count);
|
||||
return CHANSVmSetInteger(VmInst, VmReturnObj, (vmInteger)(u64)count) == CHANS_VM_OK;
|
||||
}
|
||||
@@ -4383,14 +4380,14 @@ VmMethodDefine(Blob, CalcMD5Digest) {
|
||||
}
|
||||
|
||||
VmMethodDefine(Blob, CalcRangeMD5Digest) {
|
||||
u8* data;
|
||||
u8* digest;
|
||||
BlobHeader* blob = (BlobHeader*)VmGetStrFromObjHdr(VmParentObj);
|
||||
CHANSVmObjHdr* arg0 = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_INTEGER, CHANSVmGetArg(VmInst, 0));
|
||||
CHANSVmObjHdr* arg1 = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_INTEGER, CHANSVmGetArg(VmInst, 1));
|
||||
u32 offset = 0;
|
||||
u32 size;
|
||||
u8* data;
|
||||
NETMD5Context ctx;
|
||||
u8* digest;
|
||||
CHANSVmObjHdr* newObj;
|
||||
|
||||
if (blob == vmNull || arg0 == vmNull) {
|
||||
@@ -4531,6 +4528,8 @@ VmMethodDefine(Blob, CalcHMAC) {
|
||||
}
|
||||
|
||||
VmMethodDefine(Blob, CalcRangeHMAC) {
|
||||
u8* blobData;
|
||||
u8* digest;
|
||||
BlobHeader* blob = (BlobHeader*)VmGetStrFromObjHdr(VmParentObj);
|
||||
CHANSVmObjHdr* argKey = CHANSVmGetArg(VmInst, 0);
|
||||
BlobHeader* keyBlob;
|
||||
@@ -4557,9 +4556,7 @@ VmMethodDefine(Blob, CalcRangeHMAC) {
|
||||
off = offset;
|
||||
if (((s64)size >= 0LL && (s64)(blob->size - off) >= (s64)size) != vmFalse) {
|
||||
NETHMACContext ctx;
|
||||
u8* digest;
|
||||
CHANSVmObjHdr* newObj;
|
||||
u8* blobData;
|
||||
|
||||
newObj = VmBlobCreateDirect(VmInst, VmReturnObj, 20);
|
||||
digest = VmBlobGetDataBufferDirect(newObj);
|
||||
@@ -6107,7 +6104,7 @@ static vmBoolInt VmWinEmuWrite(CHANSVm* vm, CHANSVmObjHdr* parent, CHANSVmObjHdr
|
||||
if (result == 0) {
|
||||
buf[outLen] = 0;
|
||||
buf[outLen + 1] = 0;
|
||||
OSReport("%s", buf);
|
||||
OSReport(VmReportFormat, buf);
|
||||
} else {
|
||||
OSReport("document.write(): conversion error (%d)\n", result);
|
||||
break;
|
||||
@@ -6983,7 +6980,7 @@ static CHANSVmErr VmCallMethod(CHANSVm* vm, u32 instructionSize, u32 callType, u
|
||||
CHANSVmNativeClass* target;
|
||||
u32 pushEnd, headerCount;
|
||||
u32 newPc;
|
||||
void* pConstObj;
|
||||
const u8* instruction;
|
||||
CHANSVmObjHdr localBuf;
|
||||
u32 pushDepth;
|
||||
CHANSVmFunction funcPtr;
|
||||
@@ -7047,7 +7044,7 @@ static CHANSVmErr VmCallMethod(CHANSVm* vm, u32 instructionSize, u32 callType, u
|
||||
u32 pc = pVm->pActiveCtx->pc;
|
||||
|
||||
newPc = pc + instructionSize;
|
||||
pConstObj = (void*)(pVm->pActiveCtx->pDbg->pData + pc);
|
||||
instruction = pVm->pActiveCtx->pDbg->pData + pc;
|
||||
|
||||
if (newPc < pc || newPc > pVm->pActiveCtx->pDbg->codeSize) {
|
||||
return CHANS_VM_ERR_CODE_RANGE;
|
||||
@@ -7063,8 +7060,7 @@ static CHANSVmErr VmCallMethod(CHANSVm* vm, u32 instructionSize, u32 callType, u
|
||||
target = vmNull;
|
||||
} else {
|
||||
CHANSVmExecutionCtx* ec = pVm->pActiveCtx;
|
||||
// TODO: what's the actual type of the object here? avoid raw ptr access
|
||||
u32 methodId = *((u16*)pConstObj + 1);
|
||||
u32 methodId = VM_READ_BE_U16(instruction, 1);
|
||||
u32 methodCount;
|
||||
|
||||
if (ec->pDbg->pMethodTbl == vmNull) {
|
||||
@@ -7115,7 +7111,7 @@ static CHANSVmErr VmCallMethod(CHANSVm* vm, u32 instructionSize, u32 callType, u
|
||||
entry = entry->pNext;
|
||||
}
|
||||
} else {
|
||||
pushDepth = *((u8*)pConstObj + instructionSize - 1);
|
||||
pushDepth = instruction[instructionSize - 1];
|
||||
if (retVal != 0) {
|
||||
CHANSVmNativeMethod* node = target->pNativeMethods;
|
||||
|
||||
@@ -7411,7 +7407,7 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
|
||||
break;
|
||||
}
|
||||
case VM_OPKIND_EQ: {
|
||||
convTbl = (u8*)VmResultTypeTbl.arith;
|
||||
convTbl = (u8*)VmResultTypeTbl.eq;
|
||||
break;
|
||||
}
|
||||
case VM_OPKIND_BIT:
|
||||
@@ -7727,7 +7723,8 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
|
||||
return CHANS_VM_ERR_CODE_RANGE;
|
||||
}
|
||||
pAcc = &pVm->accumulator;
|
||||
if (CHANSVmDeleteObject(vm, pAcc) == CHANS_VM_OK) {
|
||||
result = CHANSVmDeleteObject(vm, pAcc);
|
||||
if (result == CHANS_VM_OK) {
|
||||
imm16Val = VM_READ_BE_U16(operandBuf, 0);
|
||||
ctx = pVm->pActiveCtx;
|
||||
dbg = ctx->pDbg;
|
||||
@@ -7741,10 +7738,9 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
|
||||
break;
|
||||
|
||||
load_str_ok:
|
||||
// result is not initialized in this code path?
|
||||
pAcc->type = CHANS_VM_OBJ_TYPE_STRING;
|
||||
pAcc->hasData = vmTrue;
|
||||
pAcc->value.wstring_v = (vmWStringObjVal*)&dbg->pStringTbl[imm16Val];
|
||||
pAcc->value.wstring_v = (vmWStringObjVal*)&ctx->pDbg->pStringTbl[imm16Val];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -7852,7 +7848,7 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
|
||||
CHANSVmObjHdr* hdr = CHANSVmNewObject(vm, vmFalse, &pVm->accumulator, CHANS_VM_OBJ_TYPE_STRING, VM_STRING_SIZE);
|
||||
if (hdr != vmNull) {
|
||||
char* s = pVm->accumulator.value.string_v->spData;
|
||||
s32 snpLen = snprintf(s, 0x40, "%lld", (u64)arrayIdx);
|
||||
s32 snpLen = snprintf(s, 0x40, VmIntegerFormat, (u64)arrayIdx);
|
||||
CHANSVmStrCpyToU16FromU8((wchar_t*)s, s, snpLen);
|
||||
pVm->accumulator.value.string_v->len = VM_STR_LENGTH(snpLen);
|
||||
} else {
|
||||
@@ -7889,37 +7885,30 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
|
||||
}
|
||||
|
||||
case CHANS_VM_OP_NEW_ARRAY: {
|
||||
CHANSVmObjHdr* accumulator;
|
||||
CHANSVmErr arrayResult;
|
||||
opSize = 3;
|
||||
operandBuf = VmGetOperand(vm, 1, 3);
|
||||
if (operandBuf == vmNull) {
|
||||
return CHANS_VM_ERR_CODE_RANGE;
|
||||
}
|
||||
imm16Val = VM_READ_BE_U16(operandBuf, 0);
|
||||
{
|
||||
CHANSVmObjHdr* pAcc = &pVm->accumulator;
|
||||
if (CHANSVmDeleteObject(vm, pAcc) != CHANS_VM_OK) {
|
||||
// result not initialized in this code path
|
||||
break;
|
||||
}
|
||||
if (VmPushFuncReturnInfo(vm, imm16Val, imm16Val, 0) != CHANS_VM_OK) {
|
||||
// result not initialized in this code path
|
||||
break;
|
||||
}
|
||||
|
||||
pAcc->type = CHANS_VM_TYPE_ARRAY;
|
||||
pAcc->parentCls = pVm->pArrayCls;
|
||||
|
||||
if (CHANSVmNewObjData(vm, pAcc, 0x18) != vmNull) {
|
||||
if (imm16Val != 0) {
|
||||
result = VmArrayExpandCommon(vm, pAcc, imm16Val, 0, vmTrue);
|
||||
accumulator = &pVm->accumulator;
|
||||
arrayResult = CHANSVmDeleteObject(vm, accumulator);
|
||||
if (arrayResult == CHANS_VM_OK) {
|
||||
arrayResult = VmPushFuncReturnInfo(vm, imm16Val, imm16Val, 0);
|
||||
if (arrayResult == CHANS_VM_OK) {
|
||||
accumulator->type = CHANS_VM_TYPE_ARRAY;
|
||||
accumulator->parentCls = pVm->pArrayCls;
|
||||
if (CHANSVmNewObjData(vm, accumulator, sizeof(ArrayChunk)) == vmNull ||
|
||||
(imm16Val != 0 && VmArrayExpandCommon(vm, accumulator, imm16Val, 0, vmTrue) == 0)) {
|
||||
arrayResult = CHANS_VM_ERR_CALL_NEW_ARRAY;
|
||||
} else {
|
||||
arrayResult = VmReturnWithValue(vm, 0);
|
||||
}
|
||||
} else {
|
||||
result = CHANS_VM_ERR_CALL_NEW_ARRAY;
|
||||
break;
|
||||
}
|
||||
|
||||
result = VmReturnWithValue(vm, 0);
|
||||
}
|
||||
result = arrayResult;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -7982,12 +7971,12 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
|
||||
}
|
||||
imm16Val = (opcodeVal << 8 | operandBuf[1]) & 0x1FFF;
|
||||
switch (opcodeVal & CHANS_VM_OP_SYMBOL_STORE) {
|
||||
case CHANS_VM_OP_SYMBOL_STORE: {
|
||||
case 0: {
|
||||
foundObj = CHANSVm_81455654(vm, imm16Val);
|
||||
result = VmStore(vm, &pVm->accumulator, foundObj);
|
||||
break;
|
||||
}
|
||||
case 0: {
|
||||
case CHANS_VM_OP_SYMBOL_STORE: {
|
||||
foundObj = CHANSVm_81455654(vm, imm16Val);
|
||||
result = VmStore(vm, foundObj, &pVm->accumulator);
|
||||
break;
|
||||
@@ -8011,10 +8000,6 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
|
||||
isTypeMatch = 0;
|
||||
if (pVm->accumulator.type == stackTop->type) {
|
||||
switch (stackTop->type) {
|
||||
case CHANS_VM_OBJ_TYPE_BLANK: {
|
||||
isTypeMatch = 1;
|
||||
goto end_branch_check;
|
||||
}
|
||||
case CHANS_VM_OBJ_TYPE_INTEGER: {
|
||||
u32 low1 = *(u32*)stackTop;
|
||||
u32 low2 = *(u32*)&pVm->accumulator;
|
||||
@@ -8034,21 +8019,14 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
|
||||
case CHANS_VM_OBJ_TYPE_STRING: {
|
||||
u32 len1, len2;
|
||||
CHANSVmObjHdr* stackObj = (CHANSVmObjHdr*)pVm->pObjStackTopBuf;
|
||||
s32 cmpResult;
|
||||
u32 strEqual;
|
||||
isTypeMatch = 0;
|
||||
len1 = stackObj->value.wstring_v->len;
|
||||
len2 = pVm->accumulator.value.wstring_v->len;
|
||||
if (len1 == len2) {
|
||||
strEqual = 0;
|
||||
if (len1 == 0) {
|
||||
if (len1 == 0 || memcmp(stackObj->value.wstring_v->spData, pVm->accumulator.value.wstring_v->spData, len1) == 0) {
|
||||
strEqual = 1;
|
||||
goto end_branch_check;
|
||||
} else {
|
||||
cmpResult = 0;
|
||||
cmpResult = memcmp(stackObj->value.wstring_v->spData, pVm->accumulator.value.wstring_v->spData, len1);
|
||||
if (cmpResult == 0) {
|
||||
strEqual = 1;
|
||||
}
|
||||
}
|
||||
if (strEqual) {
|
||||
isTypeMatch = 1;
|
||||
@@ -8056,6 +8034,10 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
|
||||
}
|
||||
goto end_branch_check;
|
||||
}
|
||||
case CHANS_VM_OBJ_TYPE_BLANK: {
|
||||
isTypeMatch = 1;
|
||||
goto end_branch_check;
|
||||
}
|
||||
case CHANS_VM_TYPE_ARRAY:
|
||||
case CHANS_VM_TYPE_CLASS_REF:
|
||||
case CHANS_VM_TYPE_OBJECT:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
327
src/keyboard/tiManager.cpp
Normal file
327
src/keyboard/tiManager.cpp
Normal file
@@ -0,0 +1,327 @@
|
||||
#define TIMANAGER_IMPLEMENTATION
|
||||
#include "keyboard/tiPcKeyboard.h"
|
||||
#include "keyboard/tiCellPhone.h"
|
||||
#include "keyboard/tiInputForm.h"
|
||||
#include <revolution/sc.h>
|
||||
#include <new>
|
||||
|
||||
namespace textinput {
|
||||
namespace keyboard {
|
||||
namespace pctype {
|
||||
class Sample : public LayoutByNW4R {
|
||||
public:
|
||||
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
|
||||
: LayoutByNW4R(manager, accessor, observer, layoutName) {}
|
||||
virtual ~Sample();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace textinput {
|
||||
namespace keyboard {
|
||||
namespace cellphonetype {
|
||||
class Sample : public LayoutByNW4R {
|
||||
public:
|
||||
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
|
||||
: LayoutByNW4R(manager, accessor, observer, layoutName) {}
|
||||
virtual ~Sample();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace textinput {
|
||||
namespace candidatebox {
|
||||
class Sample : public LayoutByNW4R {
|
||||
public:
|
||||
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
|
||||
: LayoutByNW4R(manager, accessor, observer, layoutName) {}
|
||||
virtual ~Sample();
|
||||
};
|
||||
}
|
||||
}
|
||||
namespace textinput {
|
||||
namespace inputform {
|
||||
class Sample : public LayoutByNW4R {
|
||||
public:
|
||||
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
|
||||
: LayoutByNW4R(manager, accessor, layoutName, observer, NULL) {}
|
||||
virtual ~Sample();
|
||||
};
|
||||
}
|
||||
}
|
||||
#include "keyboard/tiToolBar.h"
|
||||
#include "keyboard/tiPredictLang.h"
|
||||
namespace textinput { namespace keyboard {
|
||||
namespace signwindow {
|
||||
class Sample : public LayoutByNW4R {
|
||||
public:
|
||||
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
|
||||
: LayoutByNW4R(manager, accessor, observer, layoutName) {}
|
||||
virtual ~Sample();
|
||||
};
|
||||
}
|
||||
}}
|
||||
#include "keyboard/tiManager.h"
|
||||
namespace textinput {
|
||||
static EventObserver defaultEventObserver;
|
||||
|
||||
Manager::Manager(MEMAllocator* allocator, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer)
|
||||
: mpAllocator(allocator), mpMultiArcResourceAccessor(accessor), mpEditBuffer(NULL), mpHWKeyboard(NULL), mpPCKeyboard(NULL),
|
||||
mpCellPhoneKeyboard(NULL), mpInputForm(NULL), mpCandidateBox(NULL), mpToolBar(NULL), mpPredictLanguageDialog(NULL),
|
||||
mpSignWindow(NULL), mpEventObserver(observer), meDestination(DST_JP), meLanguage(JP), mbAspectRatio4x3(true) {
|
||||
if (observer == NULL) mpEventObserver = &defaultEventObserver;
|
||||
}
|
||||
|
||||
Manager::~Manager() {
|
||||
if (mpPCKeyboard) { mpPCKeyboard->~LayoutByNW4R(); MEMFreeToAllocator(mpAllocator, mpPCKeyboard); }
|
||||
if (mpCellPhoneKeyboard) { mpCellPhoneKeyboard->~LayoutByNW4R(); MEMFreeToAllocator(mpAllocator, mpCellPhoneKeyboard); }
|
||||
if (mpInputForm) { mpInputForm->~LayoutByNW4R(); MEMFreeToAllocator(mpAllocator, mpInputForm); }
|
||||
if (mpCandidateBox) { mpCandidateBox->~LayoutByNW4R(); MEMFreeToAllocator(mpAllocator, mpCandidateBox); }
|
||||
if (mpToolBar) { mpToolBar->~LayoutByNW4R(); MEMFreeToAllocator(mpAllocator, mpToolBar); }
|
||||
if (mpPredictLanguageDialog) { mpPredictLanguageDialog->~LayoutByNW4R(); MEMFreeToAllocator(mpAllocator, mpPredictLanguageDialog); }
|
||||
if (mpSignWindow) { mpSignWindow->~LayoutByNW4R(); MEMFreeToAllocator(mpAllocator, mpSignWindow); }
|
||||
if (mpHWKeyboard) { mpHWKeyboard->~HWKeyboard(); MEMFreeToAllocator(mpAllocator, mpHWKeyboard); }
|
||||
if (mpEditBuffer) { mpEditBuffer->~EditBuffer(); MEMFreeToAllocator(mpAllocator, mpEditBuffer); }
|
||||
|
||||
}
|
||||
|
||||
keyboard::hwkey::HWKeyboard::~HWKeyboard() {}
|
||||
|
||||
void Manager::create(MEMAllocator*) {
|
||||
mpEditBuffer = createEditBuffer();
|
||||
mpEditBuffer->create(mpAllocator);
|
||||
mpHWKeyboard = createHWKeyboard();
|
||||
mpPCKeyboard = static_cast<keyboard::pctype::LayoutByNW4R*>(createPCTypeKeyboard());
|
||||
mpPCKeyboard->create(mpAllocator);
|
||||
mpCellPhoneKeyboard = static_cast<keyboard::cellphonetype::LayoutByNW4R*>(createCellPhoneTypeKeyboard());
|
||||
mpCellPhoneKeyboard->create(mpAllocator);
|
||||
mpInputForm = createInputForm();
|
||||
mpInputForm->create(mpAllocator, mpEditBuffer);
|
||||
mpCandidateBox = static_cast<candidatebox::LayoutByNW4R*>(createCandidateBox());
|
||||
mpCandidateBox->create(mpAllocator);
|
||||
mpToolBar = static_cast<toolbar::LayoutByNW4R*>(createToolBar());
|
||||
mpToolBar->create(mpAllocator);
|
||||
mpPredictLanguageDialog = static_cast<predictlang::LayoutByNW4R*>(createPredictLanguageDialog());
|
||||
mpPredictLanguageDialog->create(mpAllocator);
|
||||
mpSignWindow = static_cast<keyboard::signwindow::LayoutByNW4R*>(createSignWindow());
|
||||
mpSignWindow->create(mpAllocator);
|
||||
if (SCGetAspectRatio() == 1) { setLayoutScaleFor16x9(); mbAspectRatio4x3 = false; }
|
||||
else { setLayoutScaleFor4x3(); mbAspectRatio4x3 = true; }
|
||||
init();
|
||||
}
|
||||
|
||||
void Manager::initAspect() {
|
||||
if (SCGetAspectRatio() == 1) { 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 count, const char** predictions) {
|
||||
static_cast<tistring::WithAtok*>(getInputForm()->getAtokString())->setFixPrediction(count, predictions);
|
||||
}
|
||||
|
||||
void Manager::calc() {
|
||||
if (mpToolBar->isQwerty()) mpPCKeyboard->calc();
|
||||
else mpCellPhoneKeyboard->calc();
|
||||
static_cast<nw4rmanager::Layout&>(*mpToolBar).calc();
|
||||
mpCandidateBox->calc();
|
||||
mpInputForm->calc();
|
||||
if (mpPredictLanguageDialog->isActive()) static_cast<nw4rmanager::Layout&>(*mpPredictLanguageDialog).calc();
|
||||
if (mpSignWindow->isActive()) static_cast<nw4rmanager::Layout&>(*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 channel, f32 x, f32 y, u32 trigger, u32 hold, u32 release) {
|
||||
bool wasQwerty = mpToolBar->isQwerty();
|
||||
nw4rmanager::TiEventHandler::Input input;
|
||||
input.controller = channel;
|
||||
input.x = x;
|
||||
input.y = y;
|
||||
input.trigger = trigger;
|
||||
input.hold = hold;
|
||||
input.release = release;
|
||||
mpHWKeyboard->updateInput(channel, x, y, trigger, hold, release, &input);
|
||||
bool handled;
|
||||
if (mpPredictLanguageDialog->isActive()) {
|
||||
return static_cast<nw4rmanager::Layout&>(*mpPredictLanguageDialog).updateInput(channel, x, y, trigger, hold, release, &input);
|
||||
}
|
||||
mpInputForm->updateInputCommon(channel, trigger, hold, release, &input);
|
||||
if (mpSignWindow->isActive()) {
|
||||
return mpSignWindow->updateInput(channel, x, y, trigger, hold, release, &input);
|
||||
} else {
|
||||
bool keyboardHandled;
|
||||
if (wasQwerty) keyboardHandled = mpPCKeyboard->updateInput(channel, x, y, trigger, hold, release, &input);
|
||||
else keyboardHandled = mpCellPhoneKeyboard->updateInput(channel, x, y, trigger, hold, release, &input);
|
||||
bool toolbarHandled = static_cast<nw4rmanager::Layout&>(*mpToolBar).updateInput(channel, x, y, trigger, hold, release, &input);
|
||||
bool candidateHandled = static_cast<nw4rmanager::Layout&>(*mpCandidateBox).updateInput(channel, x, y, trigger, hold, release, &input);
|
||||
bool formHandled = mpInputForm->updateInput(channel, x, y, trigger, hold, release, &input);
|
||||
handled = (keyboardHandled | candidateHandled) | (formHandled | toolbarHandled);
|
||||
}
|
||||
if (wasQwerty != mpToolBar->isQwerty()) {
|
||||
getInputForm()->onCommand(static_cast<CommandReceiver::INPUT_COMMAND>(6), NULL);
|
||||
mpCandidateBox->checkValidation();
|
||||
if (mpToolBar->isQwerty()) mpPCKeyboard->onActive();
|
||||
else mpCellPhoneKeyboard->onActive();
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
bool Manager::updateInput(input::HKBManager& keyboard) {
|
||||
bool wasQwerty = mpToolBar->isQwerty();
|
||||
bool handled;
|
||||
if (mpPredictLanguageDialog->isActive()) return static_cast<nw4rmanager::Layout&>(*mpPredictLanguageDialog).updateInput(keyboard);
|
||||
else if (mpSignWindow->isActive()) return mpSignWindow->updateInput(keyboard);
|
||||
else {
|
||||
bool keyboardHandled;
|
||||
if (wasQwerty) keyboardHandled = mpPCKeyboard->updateInput(keyboard);
|
||||
else keyboardHandled = mpCellPhoneKeyboard->updateInput(keyboard);
|
||||
bool toolbarHandled = static_cast<nw4rmanager::Layout&>(*mpToolBar).updateInput(keyboard);
|
||||
bool candidateHandled = static_cast<nw4rmanager::Layout&>(*mpCandidateBox).updateInput(keyboard);
|
||||
bool formHandled = mpInputForm->updateInput(keyboard);
|
||||
handled = (keyboardHandled | candidateHandled) | (formHandled | toolbarHandled);
|
||||
}
|
||||
if (wasQwerty != mpToolBar->isQwerty()) {
|
||||
getInputForm()->onCommand(static_cast<CommandReceiver::INPUT_COMMAND>(6), NULL);
|
||||
mpCandidateBox->checkValidation();
|
||||
if (mpToolBar->isQwerty()) mpPCKeyboard->onActive();
|
||||
else mpCellPhoneKeyboard->onActive();
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
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 length) { mpInputForm->limitStringLength(length); }
|
||||
void Manager::limitRowNum(u32 rows) { mpInputForm->limitRowNum(rows); }
|
||||
|
||||
void Manager::setAnimationOn(bool enabled) {
|
||||
static_cast<nw4rmanager::Layout&>(*mpPCKeyboard).setAnimOn(enabled);
|
||||
static_cast<nw4rmanager::Layout&>(*mpCellPhoneKeyboard).setAnimOn(enabled);
|
||||
static_cast<nw4rmanager::Layout&>(*mpInputForm).setAnimOn(enabled);
|
||||
static_cast<nw4rmanager::Layout&>(*mpCandidateBox).setAnimOn(enabled);
|
||||
static_cast<nw4rmanager::Layout&>(*mpToolBar).setAnimOn(enabled);
|
||||
static_cast<nw4rmanager::Layout&>(*mpPredictLanguageDialog).setAnimOn(enabled);
|
||||
static_cast<nw4rmanager::Layout&>(*mpSignWindow).setAnimOn(enabled);
|
||||
}
|
||||
void Manager::setAspectRatio(bool standard) {
|
||||
mbAspectRatio4x3 = standard;
|
||||
if (static_cast<u8>(standard) == true) setLayoutScaleFor4x3();
|
||||
else setLayoutScaleFor16x9();
|
||||
}
|
||||
void Manager::setTitleText(wchar_t* title) {
|
||||
nw4r::lyt::TextBox* text = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(static_cast<nw4rmanager::Layout&>(*mpInputForm).getPane("T_title_text"));
|
||||
if (text != NULL) text->SetString(title, 0);
|
||||
}
|
||||
void Manager::setLayoutScaleFor16x9() {
|
||||
static_cast<nw4rmanager::Layout&>(*mpPCKeyboard).setRootPaneScaleFor16x9();
|
||||
static_cast<nw4rmanager::Layout&>(*mpCellPhoneKeyboard).setRootPaneScaleFor16x9();
|
||||
mpInputForm->setRootPaneScaleFor16x9();
|
||||
mpCandidateBox->setRootPaneScaleFor16x9();
|
||||
static_cast<nw4rmanager::Layout&>(*mpToolBar).setRootPaneScaleFor16x9();
|
||||
static_cast<nw4rmanager::Layout&>(*mpPredictLanguageDialog).setRootPaneScaleFor16x9();
|
||||
static_cast<nw4rmanager::Layout&>(*mpSignWindow).setRootPaneScaleFor16x9();
|
||||
}
|
||||
void Manager::setLayoutScaleFor4x3() {
|
||||
static_cast<nw4rmanager::Layout&>(*mpPCKeyboard).setRootPaneScaleFor4x3();
|
||||
static_cast<nw4rmanager::Layout&>(*mpCellPhoneKeyboard).setRootPaneScaleFor4x3();
|
||||
mpInputForm->setRootPaneScaleFor4x3();
|
||||
mpCandidateBox->setRootPaneScaleFor4x3();
|
||||
static_cast<nw4rmanager::Layout&>(*mpToolBar).setRootPaneScaleFor4x3();
|
||||
static_cast<nw4rmanager::Layout&>(*mpPredictLanguageDialog).setRootPaneScaleFor4x3();
|
||||
static_cast<nw4rmanager::Layout&>(*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, mpEventObserver, "fs_VK_ascii_keytop_a.brlyt"); }
|
||||
void* Manager::createCellPhoneTypeKeyboard() { return new (MEMAllocFromAllocator(mpAllocator, sizeof(keyboard::cellphonetype::Sample))) keyboard::cellphonetype::Sample(this, mpMultiArcResourceAccessor, mpEventObserver, "fs_VK_cellPhone_a.brlyt"); }
|
||||
InputForm* Manager::createInputForm() { return new (MEMAllocFromAllocator(mpAllocator, sizeof(inputform::Sample))) inputform::Sample(this, mpMultiArcResourceAccessor, mpEventObserver, "fs_VK_textBox_a.brlyt"); }
|
||||
void* Manager::createCandidateBox() { return new (MEMAllocFromAllocator(mpAllocator, sizeof(candidatebox::Sample))) candidatebox::Sample(this, mpMultiArcResourceAccessor, mpEventObserver, "fs_VK_predictInput_a.brlyt"); }
|
||||
void* Manager::createToolBar() { return new (MEMAllocFromAllocator(mpAllocator, sizeof(toolbar::Sample))) toolbar::Sample(this, mpMultiArcResourceAccessor, mpEventObserver, "fs_VK_toolbar_a.brlyt"); }
|
||||
void* Manager::createPredictLanguageDialog() { return new (MEMAllocFromAllocator(mpAllocator, sizeof(predictlang::Sample))) predictlang::Sample(this, mpMultiArcResourceAccessor, mpEventObserver, "fs_prdicSelWidw_a.brlyt"); }
|
||||
predictlang::Base::~Base() {}
|
||||
void* Manager::createSignWindow() { return new (MEMAllocFromAllocator(mpAllocator, sizeof(keyboard::signwindow::Sample))) keyboard::signwindow::Sample(this, mpMultiArcResourceAccessor, mpEventObserver, "fs_signWindow_a.brlyt"); }
|
||||
void Manager::startPredictTurnOn(bool enabled) {
|
||||
if (getInputForm()->mbPredictOn != enabled) getCandidateBox()->startTurnOn(enabled);
|
||||
}
|
||||
bool Manager::isPredictTurning() const { return getCandidateBox()->getOnOffButton().IsTurning(); }
|
||||
void Manager::enableCompatibleFilter(bool enabled) { inputform::DeadKeyStream::sbCompatibleFilterEnabled = enabled; }
|
||||
void Manager::enableKSXFilter(bool enabled) {
|
||||
static_cast<tistring::Decolated*>(mpEditBuffer->mpString)->EnableKSXFilter(enabled);
|
||||
static_cast<tistring::Decolated*>(mpEditBuffer->mpZiString)->EnableKSXFilter(enabled);
|
||||
}
|
||||
bool Manager::isVacancy() const {
|
||||
if (!getInputForm() || !getToolBar()) return true;
|
||||
if (!getToolBar()->isQwerty() && getCellPhoneKeyboard()->isHoldingButton()) return false;
|
||||
return getInputForm()->inputform::Base::isVacancy();
|
||||
}
|
||||
void Manager::SetFont(nw4r::lyt::FontRefLink* link) {
|
||||
nw4r::ut::Font* font = link->GetFont();
|
||||
if (mpToolBar) static_cast<nw4rmanager::Layout&>(*mpToolBar).SetFontForce(font);
|
||||
if (mpPCKeyboard) static_cast<nw4rmanager::Layout&>(*mpPCKeyboard).SetFontForce(font);
|
||||
if (mpCandidateBox) static_cast<nw4rmanager::Layout&>(*mpCandidateBox).SetFontForce(font);
|
||||
if (mpSignWindow) static_cast<nw4rmanager::Layout&>(*mpSignWindow).SetFontForce(font);
|
||||
if (mpInputForm) mpInputForm->nw4r::ut::CharWriter::SetFont(*font);
|
||||
if (mpCellPhoneKeyboard) static_cast<nw4rmanager::Layout&>(*mpCellPhoneKeyboard).SetFontForce(font);
|
||||
}
|
||||
void Manager::setDefaultPredictionJP(int count, const char** predictions) {
|
||||
static_cast<tistring::WithAtok*>(getInputForm()->getAtokString())->setDefaultPrediction(count, predictions);
|
||||
}
|
||||
void predictlang::Base::init() {}
|
||||
void predictlang::Base::create(MEMAllocator* allocator) { mpAllocator = allocator; }
|
||||
keyboard::pctype::Sample::~Sample() {}
|
||||
keyboard::cellphonetype::Sample::~Sample() {}
|
||||
candidatebox::Sample::~Sample() {}
|
||||
inputform::Sample::~Sample() {}
|
||||
toolbar::Sample::~Sample() {}
|
||||
predictlang::Sample::~Sample() {}
|
||||
keyboard::signwindow::Sample::~Sample() {}
|
||||
}
|
||||
@@ -13,6 +13,12 @@
|
||||
namespace textinput {
|
||||
namespace keyboard {
|
||||
namespace pctype {
|
||||
struct SelectorPosition {
|
||||
f32 coordinates[3];
|
||||
};
|
||||
extern SelectorPosition chinesePosition;
|
||||
extern SelectorPosition koreanPosition;
|
||||
|
||||
static const wchar_t* PREDICT_CAPTIONS[] = {L"", L"", L"Eng", L"Fra", L"Esp", L"EN", L"DE", L"FR", L"ES", L"IT", L"NL", L"CN", L"KR"};
|
||||
|
||||
static const GridKey csGridKeyboard[] = {
|
||||
@@ -1534,8 +1540,8 @@ namespace textinput {
|
||||
u32 count;
|
||||
u32 type;
|
||||
};
|
||||
u32 flags = 0;
|
||||
mState.rejected = false;
|
||||
u32 flags = 0;
|
||||
if (mKeyState.abcFlags & 64)
|
||||
flags |= 2;
|
||||
if (mKeyState.abcFlags & 128)
|
||||
@@ -1557,7 +1563,7 @@ namespace textinput {
|
||||
if (code != util::KBD_ConvertSmall(code))
|
||||
conversions |= 128;
|
||||
if ((mKeyState.aiuFlags & ~15) != conversions) {
|
||||
mKeyState.aiuFlags = (mKeyState.aiuFlags & 15) | conversions;
|
||||
mKeyState.aiuFlags = (mKeyState.aiuFlags & 15) | (conversions & ~15);
|
||||
mKeyState.refresh_();
|
||||
}
|
||||
}
|
||||
@@ -1600,7 +1606,7 @@ namespace textinput {
|
||||
}
|
||||
|
||||
void Base::setTranslateMode(TranslateMode mode) {
|
||||
u32 keyMode;
|
||||
u32 keyMode = mode;
|
||||
switch (mode) {
|
||||
case TM_Direct:
|
||||
keyMode = 0;
|
||||
@@ -1612,7 +1618,7 @@ namespace textinput {
|
||||
keyMode = 2;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
if (keyMode != (mKeyState.abcFlags & 15)) {
|
||||
if (getLanguage() == KR || getLanguage() == CN)
|
||||
@@ -1646,7 +1652,7 @@ namespace textinput {
|
||||
abcFlags &= ~15;
|
||||
refresh_();
|
||||
}
|
||||
if (static_cast<u32>(language - CN) <= 1 && (abcFlags & 15) == 2) {
|
||||
if (static_cast<u32>(language - CN) <= 1 && getABCMode() == 2) {
|
||||
if ((abcFlags & 15) != 1) {
|
||||
abcFlags = (abcFlags & ~15) | 1;
|
||||
refresh_();
|
||||
@@ -1711,14 +1717,19 @@ namespace textinput {
|
||||
util::replaceChar(name, sizeof(name), data->ascii[i].szPaneName, 0, 'T');
|
||||
nw4r::lyt::TextBox* text = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(root->FindPaneByName(name, true));
|
||||
if (text != NULL) {
|
||||
wchar_t caption[2] = {getWCCode(i), 0};
|
||||
wchar_t caption[2];
|
||||
caption[0] = getWCCode(i);
|
||||
caption[1] = 0;
|
||||
if (language == KR && (abcFlags & 15) == 1) {
|
||||
if (owner->isCapsOn())
|
||||
caption[0] = util::reverseLetterCaseW(caption[0]);
|
||||
if (caption[0] >= L'a' && caption[0] <= L'z')
|
||||
caption[0] = KOREAN_LOWER[caption[0] - L'a'];
|
||||
else if (caption[0] >= L'A' && caption[0] <= L'Z')
|
||||
caption[0] = KOREAN_UPPER[caption[0] - L'A'];
|
||||
bool caps = owner->isCapsOn();
|
||||
u32 character = caption[0];
|
||||
if (caps)
|
||||
character = util::reverseLetterCaseW(character);
|
||||
if (character >= L'a' && character <= L'z')
|
||||
character = KOREAN_LOWER[static_cast<wchar_t>(character) - L'a'];
|
||||
else if (character >= L'A' && character <= L'Z')
|
||||
character = KOREAN_UPPER[static_cast<wchar_t>(character) - L'A'];
|
||||
caption[0] = character;
|
||||
}
|
||||
text->SetString(caption);
|
||||
}
|
||||
@@ -1728,7 +1739,9 @@ namespace textinput {
|
||||
util::replaceChar(name, sizeof(name), data->grid[i].paneName, 0, 'T');
|
||||
nw4r::lyt::TextBox* text = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(root->FindPaneByName(name, true));
|
||||
if (text != NULL) {
|
||||
wchar_t caption[2] = {data->grid[i].codes[3 - ((aiuFlags & 15) == 0)], 0};
|
||||
wchar_t caption[2];
|
||||
caption[0] = data->grid[i].codes[(aiuFlags & 15) == 0 ? 2 : 3];
|
||||
caption[1] = 0;
|
||||
text->SetString(caption);
|
||||
}
|
||||
}
|
||||
@@ -1750,7 +1763,7 @@ namespace textinput {
|
||||
if (abcFlags & 128)
|
||||
modifiers |= 2;
|
||||
wchar_t code = data->ascii[index].wc[modifiers];
|
||||
if (inputType == 0 && (abcFlags & 15) == 0) {
|
||||
if (inputType == 0 && getABCMode() == 0) {
|
||||
if (code == 0x3001)
|
||||
code = L',';
|
||||
else if (code == 0x3002)
|
||||
@@ -1761,7 +1774,7 @@ namespace textinput {
|
||||
code = L'[';
|
||||
else if (code == 0x300d)
|
||||
code = L']';
|
||||
} else if (owner->getLanguage() == CN && (abcFlags & 15) == 1) {
|
||||
} else if (owner->getLanguage() == CN && getABCMode() == 1) {
|
||||
if (code == L'[')
|
||||
code = 0x300a;
|
||||
else if (code == L']')
|
||||
@@ -1800,7 +1813,7 @@ namespace textinput {
|
||||
}
|
||||
for (u16 i = 0; i < 56; i++) {
|
||||
if (util::strcmp(data->grid[i].paneName, paneName))
|
||||
code = data->grid[i].codes[3 - ((aiuFlags & 15) == 0)];
|
||||
code = data->grid[i].codes[(aiuFlags & 15) == 0 ? 2 : 3];
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@@ -1855,6 +1868,14 @@ namespace textinput {
|
||||
EventHandler::~EventHandler() {
|
||||
}
|
||||
|
||||
inline void UIModifierButton::Create(nw4rmanager::Layout* layout, const char* pane, const char* bounding) {
|
||||
gui::PaneManager* manager = layout->getPaneManager();
|
||||
mpPaneComponent = manager->searchPaneComponent(pane);
|
||||
mpBoundingComponent = manager->searchPaneComponent(bounding);
|
||||
mpAnimation = static_cast<AnmPane*>(layout->searchAnmPane(pane));
|
||||
mpBoundingComponent->setListener(this);
|
||||
}
|
||||
|
||||
void LayoutByNW4R::create(MEMAllocator* allocator) {
|
||||
Base::create(allocator);
|
||||
void* storage = MEMAllocFromAllocator(allocator, sizeof(EventHandler));
|
||||
@@ -1863,22 +1884,9 @@ namespace textinput {
|
||||
mpPaneManager->setAllComponentTriggerTarget(false);
|
||||
mpPaneManager->setAllBoundingBoxComponentTriggerTarget(true);
|
||||
createAnmPane_(allocator);
|
||||
nw4rmanager::Layout* layout = this;
|
||||
gui::PaneManager* manager = layout->getPaneManager();
|
||||
const char* shiftBounding = "B_key_SHIFT";
|
||||
const char* shiftPane = "P_key_SHIFT";
|
||||
mShiftButton.mpPaneComponent = manager->searchPaneComponent(shiftPane);
|
||||
mShiftButton.mpBoundingComponent = manager->searchPaneComponent(shiftBounding);
|
||||
mShiftButton.mpAnimation = static_cast<AnmPane*>(layout->searchAnmPane(shiftPane));
|
||||
mShiftButton.mpBoundingComponent->setListener(&mShiftButton);
|
||||
manager = layout->getPaneManager();
|
||||
const char* capsBounding = "B_key_CAPS";
|
||||
const char* capsPane = "P_key_CAPS";
|
||||
mCapsButton.mpPaneComponent = manager->searchPaneComponent(capsPane);
|
||||
mCapsButton.mpBoundingComponent = manager->searchPaneComponent(capsBounding);
|
||||
mCapsButton.mpAnimation = static_cast<AnmPane*>(layout->searchAnmPane(capsPane));
|
||||
mCapsButton.mpBoundingComponent->setListener(&mCapsButton);
|
||||
mModePanel.Create(layout);
|
||||
mShiftButton.Create(this, "P_key_SHIFT", "B_key_SHIFT");
|
||||
mCapsButton.Create(this, "P_key_CAPS", "B_key_CAPS");
|
||||
mModePanel.Create(this);
|
||||
mShiftButton.mpBoundingComponent->setTriggerTarget(true);
|
||||
mCapsButton.mpBoundingComponent->setTriggerTarget(true);
|
||||
for (u32 i = 0; i < 5; i++)
|
||||
@@ -1889,6 +1897,7 @@ namespace textinput {
|
||||
}
|
||||
|
||||
void LayoutByNW4R::createAnmPane_(MEMAllocator* allocator) {
|
||||
const char* shared;
|
||||
for (u16 i = 0; i < 129; i++) {
|
||||
const PaneAnimation& entry = csPaneToAnimation[i];
|
||||
AnmPane* pane = NULL;
|
||||
@@ -1915,7 +1924,7 @@ namespace textinput {
|
||||
}
|
||||
}
|
||||
nw4r::ut::List_Append(&mAnmPanes, pane);
|
||||
const char* shared = entry.sharedPane;
|
||||
shared = entry.sharedPane;
|
||||
for (u16 j = 0; j < entry.count; j++) {
|
||||
void* resource = mpMultiArcResourceAccessor->GetResource(0, entry.animations[j]->fileName);
|
||||
AnimTransformPane* transform =
|
||||
@@ -1936,16 +1945,26 @@ namespace textinput {
|
||||
setLineFeedButton(true);
|
||||
setPredictLanguageButton(true);
|
||||
setSignWindowButton(true);
|
||||
const nw4r::math::VEC3 chinesePosition(-219.0f, -130.0f, 0.0f);
|
||||
const nw4r::math::VEC3 koreanPosition(-209.0f, -90.0f, 0.0f);
|
||||
nw4r::math::VEC3 koreanVector;
|
||||
nw4r::math::VEC3 chineseVector;
|
||||
SelectorPosition koreanTranslation;
|
||||
SelectorPosition chineseTranslation;
|
||||
chineseTranslation = chinesePosition;
|
||||
koreanTranslation = koreanPosition;
|
||||
if (meLanguage == CN) {
|
||||
mModePanel.mpEnglishText->GetMaterial()->SetTexture(0, mModePanel.mDirectTexture);
|
||||
mModePanel.mpHangulText->GetMaterial()->SetTexture(0, mModePanel.mPinyinTexture);
|
||||
mModePanel.mpModeSelect->SetTranslate(chinesePosition);
|
||||
chineseVector.x = chineseTranslation.coordinates[0];
|
||||
chineseVector.y = chineseTranslation.coordinates[1];
|
||||
chineseVector.z = chineseTranslation.coordinates[2];
|
||||
mModePanel.mpModeSelect->SetTranslate(chineseVector);
|
||||
} else if (meLanguage == KR) {
|
||||
mModePanel.mpEnglishText->GetMaterial()->SetTexture(0, mModePanel.mEnglishTexture);
|
||||
mModePanel.mpHangulText->GetMaterial()->SetTexture(0, mModePanel.mHangulTexture);
|
||||
mModePanel.mpModeSelect->SetTranslate(koreanPosition);
|
||||
koreanVector.x = koreanTranslation.coordinates[0];
|
||||
koreanVector.y = koreanTranslation.coordinates[1];
|
||||
koreanVector.z = koreanTranslation.coordinates[2];
|
||||
mModePanel.mpModeSelect->SetTranslate(koreanVector);
|
||||
}
|
||||
searchAnmPane("P_key_SHIFT")->changeAnimation(0);
|
||||
searchAnmPane("P_key_CAPS")->changeAnimation(0);
|
||||
@@ -2020,12 +2039,17 @@ namespace textinput {
|
||||
}
|
||||
}
|
||||
if (getLanguage() == KR || getLanguage() == CN) {
|
||||
if ((mKeyState.abcFlags & 15) == 0) {
|
||||
searchAnmPane("P_Mode_kr_eng")->changeAnimation(5);
|
||||
searchAnmPane("P_Mode_kr_han")->changeAnimation(0);
|
||||
} else {
|
||||
searchAnmPane("P_Mode_kr_eng")->changeAnimation(0);
|
||||
searchAnmPane("P_Mode_kr_han")->changeAnimation(5);
|
||||
switch (mKeyState.abcFlags & 15) {
|
||||
case 0: {
|
||||
searchAnmPane("P_Mode_kr_eng")->changeAnimation(5);
|
||||
searchAnmPane("P_Mode_kr_han")->changeAnimation(0);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
searchAnmPane("P_Mode_kr_eng")->changeAnimation(0);
|
||||
searchAnmPane("P_Mode_kr_han")->changeAnimation(5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
mpLayout->Animate(0);
|
||||
@@ -2071,24 +2095,31 @@ namespace textinput {
|
||||
gather.changeCapsLock(caps);
|
||||
mKeyState.abcFlags = ((mKeyState.abcFlags ^ 64) & 64) | (mKeyState.abcFlags & ~64);
|
||||
mKeyState.refresh_();
|
||||
mCapsButton.mbOn = (mKeyState.abcFlags >> 6) & 1;
|
||||
if (mCapsButton.mbOn)
|
||||
mCapsButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(10));
|
||||
else
|
||||
mCapsButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(11));
|
||||
mCapsButton.SetState((mKeyState.abcFlags >> 6) & 1, 11);
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(13));
|
||||
}
|
||||
|
||||
inline void UIModifierButton::SetState(bool enabled, u32 inactiveAnimation) {
|
||||
mbOn = enabled;
|
||||
if (mbOn)
|
||||
mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(10));
|
||||
else
|
||||
mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(inactiveAnimation));
|
||||
}
|
||||
|
||||
void LayoutByNW4R::onPressedShift(bool sound) {
|
||||
mKeyState.setABCFlag((mKeyState.abcFlags & ~15) | 128);
|
||||
mShiftButton.mbOn = true;
|
||||
mShiftButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(10));
|
||||
u32 flags = mKeyState.getABCFlag();
|
||||
flags |= 128;
|
||||
mKeyState.setABCFlag(flags);
|
||||
mShiftButton.SetState(true, 5);
|
||||
if (sound)
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(13));
|
||||
}
|
||||
|
||||
void LayoutByNW4R::onReleasedShift() {
|
||||
mKeyState.setABCFlag(mKeyState.abcFlags & ~143);
|
||||
u32 flags = mKeyState.getABCFlag();
|
||||
flags &= ~128;
|
||||
mKeyState.setABCFlag(flags);
|
||||
if (mShiftButton.mbOn) {
|
||||
mShiftButton.mbOn = false;
|
||||
mShiftButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(5));
|
||||
@@ -2099,13 +2130,33 @@ namespace textinput {
|
||||
getWCCode(static_cast<char*>(data));
|
||||
if (event == 4 && getWCCode(static_cast<char*>(data)) == 0) {
|
||||
switch (getControlKey(static_cast<char*>(data))) {
|
||||
case 0:
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(9));
|
||||
case 3: {
|
||||
LayoutGather& gather = LayoutGather::Singleton::getInstance();
|
||||
if (!gather.isHoldingShift()) {
|
||||
if (mKeyState.abcFlags & ~15) {
|
||||
mKeyState.abcFlags &= ~128;
|
||||
mKeyState.refresh_();
|
||||
}
|
||||
if (mShiftButton.mbOn) {
|
||||
mShiftButton.mbOn = false;
|
||||
mShiftButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(5));
|
||||
}
|
||||
}
|
||||
u8 caps = !gather.isCapsLock();
|
||||
gather.changeCapsLock(caps);
|
||||
mKeyState.abcFlags = ((mKeyState.abcFlags ^ 64) & 64) | (mKeyState.abcFlags & ~64);
|
||||
mKeyState.refresh_();
|
||||
mCapsButton.mbOn = (mKeyState.abcFlags >> 6) & 1;
|
||||
if (mCapsButton.mbOn)
|
||||
mCapsButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(10));
|
||||
else
|
||||
mCapsButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(11));
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(13));
|
||||
|
||||
break;
|
||||
case 3:
|
||||
onPressedCaps();
|
||||
break;
|
||||
case 4:
|
||||
}
|
||||
case 4: {
|
||||
LayoutGather& shiftGather = LayoutGather::Singleton::getInstance();
|
||||
if (mKeyState.abcFlags & ~15) {
|
||||
mKeyState.abcFlags &= ~64;
|
||||
mKeyState.refresh_();
|
||||
@@ -2114,17 +2165,21 @@ namespace textinput {
|
||||
mCapsButton.mbOn = false;
|
||||
mCapsButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(5));
|
||||
}
|
||||
if (!LayoutGather::Singleton::getInstance().isHoldingShift()) {
|
||||
if (!shiftGather.isHoldingShift()) {
|
||||
mKeyState.abcFlags = ((mKeyState.abcFlags ^ 128) & 128) | (mKeyState.abcFlags & ~128);
|
||||
mKeyState.refresh_();
|
||||
}
|
||||
mShiftButton.mbOn = (mKeyState.abcFlags >> 7) & 1;
|
||||
if (!mShiftButton.mbOn)
|
||||
mShiftButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(11));
|
||||
else
|
||||
if (mShiftButton.mbOn)
|
||||
mShiftButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(10));
|
||||
else
|
||||
mShiftButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(11));
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(13));
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(9));
|
||||
break;
|
||||
case 11:
|
||||
if (!isABC()) {
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(13));
|
||||
@@ -2137,6 +2192,18 @@ namespace textinput {
|
||||
searchAnmPane("W_JP_Chng_ABC")->changeAnimation(6);
|
||||
}
|
||||
break;
|
||||
case 18:
|
||||
if ((mKeyState.aiuFlags & 15) == 1) {
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(13));
|
||||
searchAnmPane("P_katakana")->changeAnimation(6);
|
||||
}
|
||||
break;
|
||||
case 19:
|
||||
if ((mKeyState.aiuFlags & 15) == 0) {
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(13));
|
||||
searchAnmPane("P_hiragana")->changeAnimation(6);
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
if ((mKeyState.abcFlags & 15) == 2)
|
||||
searchAnmPane("P_Mode_roma_kata")->changeAnimation(6);
|
||||
@@ -2159,18 +2226,6 @@ namespace textinput {
|
||||
if ((mKeyState.abcFlags & 15) == 1)
|
||||
searchAnmPane("P_Mode_roma_hira")->changeAnimation(6);
|
||||
break;
|
||||
case 18:
|
||||
if ((mKeyState.aiuFlags & 15) == 1) {
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(13));
|
||||
searchAnmPane("P_katakana")->changeAnimation(6);
|
||||
}
|
||||
break;
|
||||
case 19:
|
||||
if ((mKeyState.aiuFlags & 15) == 0) {
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(13));
|
||||
searchAnmPane("P_hiragana")->changeAnimation(6);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
Base::onKey(event, data);
|
||||
@@ -2303,10 +2358,12 @@ namespace textinput {
|
||||
}
|
||||
|
||||
void LayoutByNW4R::sendInputWChar(wchar_t code, bool repeat) {
|
||||
bool shift = (mKeyState.abcFlags & 128) != 0;
|
||||
bool shift = false;
|
||||
nw4r::lyt::Pane* last = NULL;
|
||||
if (shift)
|
||||
if (mKeyState.abcFlags & 128) {
|
||||
last = mAnmPaneFifo.getLast();
|
||||
shift = true;
|
||||
}
|
||||
Base::sendInputWChar(code, repeat);
|
||||
if (shift && last != NULL)
|
||||
setPaneLastDrawReceived(last);
|
||||
@@ -2390,13 +2447,15 @@ namespace textinput {
|
||||
mKeyState.setABCMode(abcMode);
|
||||
mKeyState.setAIUMode(aiuMode);
|
||||
switch (static_cast<int>(abcMode)) {
|
||||
case 1:
|
||||
case 2:
|
||||
mpInitialLanguageData = &csJapanKanaInput;
|
||||
break;
|
||||
case 0:
|
||||
mpInitialLanguageData = &csLanguageDependencyData[getLanguage()];
|
||||
break;
|
||||
case 1:
|
||||
mpInitialLanguageData = &csJapanKanaInput;
|
||||
break;
|
||||
case 2:
|
||||
mpInitialLanguageData = &csJapanKanaInput;
|
||||
break;
|
||||
}
|
||||
initLayout();
|
||||
sendCommand(41, NULL);
|
||||
@@ -2462,25 +2521,33 @@ namespace textinput {
|
||||
nw4rmanager::AnmPane* animation = NULL;
|
||||
u8 key = keys.GetKey();
|
||||
wchar_t code = keys.GetWChar();
|
||||
if (key != 0x2c) {
|
||||
if (key == 0x28 || key == 0x58) {
|
||||
switch (static_cast<int>(key)) {
|
||||
case 0x2c:
|
||||
break;
|
||||
case 0x28:
|
||||
case 0x58:
|
||||
if (!(hkb.GetModifierState() & 4))
|
||||
animation = searchAnmPane("P_key_LF");
|
||||
} else {
|
||||
break;
|
||||
default: {
|
||||
code = inputform::DeadKeyStream::ToIndependentClass(code);
|
||||
code = static_cast<const Manager*>(mpManager)->getHWKeyboard()->convertWCCode(code);
|
||||
if (static_cast<const Manager*>(mpManager)->getToolBar()->isQwerty()) {
|
||||
if (static_cast<const Manager*>(mpManager)->getPCKeyboard()->getTranslateMode() != TM_Direct &&
|
||||
mpManager->getLanguage() == KR) {
|
||||
if (isCapsOn())
|
||||
code = util::reverseLetterCaseW(code);
|
||||
if (code >= L'a' && code <= L'z')
|
||||
code = KOREAN_LOWER[code - L'a'];
|
||||
else if (code >= L'A' && code <= L'Z')
|
||||
code = KOREAN_UPPER[code - L'A'];
|
||||
bool caps = isCapsOn();
|
||||
u32 koreanCode = code;
|
||||
if (caps)
|
||||
koreanCode = util::reverseLetterCaseW(koreanCode);
|
||||
if (koreanCode >= L'a' && koreanCode <= L'z')
|
||||
koreanCode = KOREAN_LOWER[static_cast<u16>(koreanCode) - L'a'];
|
||||
else if (koreanCode >= L'A' && koreanCode <= L'Z')
|
||||
koreanCode = KOREAN_UPPER[static_cast<u16>(koreanCode) - L'A'];
|
||||
code = koreanCode;
|
||||
}
|
||||
}
|
||||
animation = searchAnmPane(code);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (animation != NULL)
|
||||
@@ -2492,14 +2559,18 @@ namespace textinput {
|
||||
nw4rmanager::AnmPane* animation = NULL;
|
||||
u8 key = keys.GetKey();
|
||||
keys.GetWChar();
|
||||
if (key < 0x2c) {
|
||||
if (key == 0x2a && !(hkb.GetModifierState() & 4))
|
||||
switch (static_cast<int>(key)) {
|
||||
case 0x2a:
|
||||
if (hkb.GetModifierState() & 4)
|
||||
break;
|
||||
case 0x4c:
|
||||
animation = searchAnmPane("P_key_DELETE");
|
||||
} else if (key == 0x2c) {
|
||||
if (!(hkb.GetModifierState() & 8))
|
||||
animation = searchAnmPane("P_key_SPACE");
|
||||
} else if (key == 0x4c)
|
||||
animation = searchAnmPane("P_key_DELETE");
|
||||
break;
|
||||
case 0x2c:
|
||||
if (!(hkb.GetModifierState() & 8))
|
||||
animation = searchAnmPane("P_key_SPACE");
|
||||
break;
|
||||
}
|
||||
if (animation != NULL)
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_0);
|
||||
keys = keys.GetNext();
|
||||
@@ -2559,8 +2630,7 @@ namespace textinput {
|
||||
mCapsButton.mbOn = false;
|
||||
mCapsButton.mpAnimation->onAnmEvent(static_cast<AnmPane::AnmPaneEvent>(5));
|
||||
}
|
||||
const u8 caps = 0;
|
||||
LayoutGather::Singleton::getInstance().changeCapsLock(caps);
|
||||
LayoutGather::Singleton::getInstance().changeCapsLock(0);
|
||||
}
|
||||
if (visible)
|
||||
initPaneLastDrawReceived();
|
||||
@@ -2578,44 +2648,52 @@ namespace textinput {
|
||||
void EventHandler::onTiEvent(gui::PaneComponent* component, u32 event, Input* input) {
|
||||
nw4r::lyt::Pane* pane = component->getPane();
|
||||
const char* name = pane->GetName();
|
||||
if (!util::strcmp("B_key_SHIFT", name) && !util::strcmp("B_key_CAPS", name) && name[0] == 'B') {
|
||||
char animationName[17];
|
||||
util::replaceChar(animationName, sizeof(animationName), name, 0, 'P');
|
||||
if (strncmp(name + 5, "Chng", 4) == 0 || strncmp(name + 7, "Chng", 4) == 0 || strncmp(name + 7, "prdc", 4) == 0) {
|
||||
util::replaceChar(animationName, sizeof(animationName), name, 0, 'W');
|
||||
}
|
||||
nw4rmanager::AnmPane* animation = mpKeyboard->searchAnmPane(animationName);
|
||||
switch (static_cast<int>(event)) {
|
||||
case 1:
|
||||
if (animation != NULL)
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_2);
|
||||
mpKeyboard->onKey(1, animationName);
|
||||
break;
|
||||
if (!util::strcmp("B_key_SHIFT", name)) {
|
||||
switch (util::strcmp("B_key_CAPS", name)) {
|
||||
case 0:
|
||||
if (animation != NULL) {
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(4));
|
||||
mpKeyboard->setPaneLastDrawReceived(animation->getPane());
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_1);
|
||||
if (name[0] == 'B') {
|
||||
char animationName[17];
|
||||
util::replaceChar(animationName, sizeof(animationName), name, 0, 'P');
|
||||
if (strncmp(name + 5, "Chng", 4) == 0 || strncmp(name + 7, "Chng", 4) == 0 || strncmp(name + 7, "prdc", 4) == 0) {
|
||||
util::replaceChar(animationName, sizeof(animationName), name, 0, 'W');
|
||||
}
|
||||
nw4rmanager::AnmPane* animation = mpKeyboard->searchAnmPane(animationName);
|
||||
switch (static_cast<int>(event)) {
|
||||
case 4:
|
||||
if (input->field_0x0C & 0x800) {
|
||||
if (animation != NULL)
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_0);
|
||||
mpKeyboard->onKey(4, animationName);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (animation != NULL)
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_2);
|
||||
mpKeyboard->onKey(1, animationName);
|
||||
break;
|
||||
case 0:
|
||||
if (animation != NULL) {
|
||||
mpEventObserver->onSE(static_cast<sound::SE>(4));
|
||||
mpKeyboard->setPaneLastDrawReceived(animation->getPane());
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (event == 2 && (input->field_0x10 & 0x800) && !(input->field_0x0C & 0x800) &&
|
||||
(util::strcmp("P_key_DELETE", animationName) || util::strcmp("P_Gkey_DELETE", animationName) ||
|
||||
util::strcmp("P_key_SPACE", animationName) || util::strcmp("P_Gkey_SPACE", animationName)) &&
|
||||
component->isDragging(input->field_0x00)) {
|
||||
u32 frames = mpKeyboard->getFlightDuration(input->field_0x00, name);
|
||||
if (frames >= 30 && frames % 9 == 0) {
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_0);
|
||||
mpKeyboard->onKey(4, animationName);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (input->field_0x0C & 0x800) {
|
||||
if (animation != NULL)
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_0);
|
||||
mpKeyboard->onKey(4, animationName);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (event == 2 && (input->field_0x10 & 0x800) && !(input->field_0x0C & 0x800) &&
|
||||
(util::strcmp("P_key_DELETE", animationName) || util::strcmp("P_Gkey_DELETE", animationName) ||
|
||||
util::strcmp("P_key_SPACE", animationName) || util::strcmp("P_Gkey_SPACE", animationName)) &&
|
||||
component->isDragging(input->field_0x00)) {
|
||||
u32 frames = mpKeyboard->getFlightDuration(input->field_0x00, name);
|
||||
if (frames > 29 && frames % 9 == 0) {
|
||||
animation->onAnmEvent(nw4rmanager::AnmPane::PE_0);
|
||||
mpKeyboard->onKey(4, animationName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3084,6 +3162,9 @@ namespace textinput {
|
||||
void Base::setInputModeJP(bool, u32, u32) {
|
||||
}
|
||||
|
||||
SelectorPosition chinesePosition = {{-219.0f, -130.0f, 0.0f}};
|
||||
SelectorPosition koreanPosition = {{-209.0f, -90.0f, 0.0f}};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
678
src/keyboard/tiSignWindow.cpp
Normal file
678
src/keyboard/tiSignWindow.cpp
Normal file
@@ -0,0 +1,678 @@
|
||||
#define TISIGNWINDOW_IMPLEMENTATION
|
||||
#include "keyboard/tiSignWindow.h"
|
||||
#include "keyboard/tiManager.h"
|
||||
#include "keyboard/tiLanguageIndependentData.h"
|
||||
#include "keyboard/tiUtil.h"
|
||||
|
||||
#include <new>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
|
||||
|
||||
namespace textinput {
|
||||
namespace keyboard {
|
||||
|
||||
namespace signwindow {
|
||||
|
||||
struct AnimationFile {
|
||||
u32 id;
|
||||
char name[64];
|
||||
};
|
||||
|
||||
struct PaneAnimation {
|
||||
s32 type;
|
||||
char paneName[20];
|
||||
u32 animationCount;
|
||||
const char* forceName;
|
||||
const AnimationFile* animations[8];
|
||||
};
|
||||
|
||||
struct PaneControlKey {
|
||||
char paneName[20];
|
||||
u32 key;
|
||||
};
|
||||
|
||||
const char* csSgnKeys[20] = {
|
||||
"P_SGNkey_00", "P_SGNkey_01", "P_SGNkey_02", "P_SGNkey_03", "P_SGNkey_04",
|
||||
"P_SGNkey_05", "P_SGNkey_06", "P_SGNkey_07", "P_SGNkey_08", "P_SGNkey_09",
|
||||
"P_SGNkey_10", "P_SGNkey_11", "P_SGNkey_12", "P_SGNkey_13", "P_SGNkey_14",
|
||||
"P_SGNkey_15", "P_SGNkey_16", "P_SGNkey_17", "P_SGNkey_18", "P_SGNkey_19",
|
||||
};
|
||||
|
||||
static const char* csSgnKeyBase = "P_SGNkey_00";
|
||||
static const char* csSgnKeyClose = "P_SGNkey_close";
|
||||
|
||||
const AnimationFile csAninationFileForSign[9] = {
|
||||
{0, "fs_signWindow_a_SGN_normal.brlan"},
|
||||
{1, "fs_signWindow_a_SGN_FADE-IN.brlan"},
|
||||
{8, "fs_signWindow_a_Scroll_FADE-OUT.brlan"},
|
||||
{2, "fs_signWindow_a_SGN_Focus-IN.brlan"},
|
||||
{6, "fs_signWindow_a_SGN_Focus-OUT.brlan"},
|
||||
{3, "fs_signWindow_a_SGN_Roll_over.brlan"},
|
||||
{4, "fs_signWindow_a_SGN_Pushed.brlan"},
|
||||
{7, "fs_signWindow_a_SGN_scroll_next.brlan"},
|
||||
{5, "fs_signWindow_a_SGN_scroll_prev.brlan"},
|
||||
};
|
||||
|
||||
static const PaneControlKey csPaneNameToControlKey[3] = {
|
||||
{"B_SGNkey_close", 0x18},
|
||||
{"B_SGNkey_prev", 0x1A},
|
||||
{"B_SGNkey_next", 0x19},
|
||||
};
|
||||
|
||||
static const LanguageDependency csLanguageDependencyData[10] = {
|
||||
{4, csSignKeyJP}, {10, csSignKeyUS}, {10, csSignKeyUK}, {10, csSignKeyFR}, {10, csSignKeyDE},
|
||||
{10, csSignKeyIT}, {10, csSignKeySP}, {10, csSignKeyNL}, {4, csSignKeyCN}, {4, csSignKeyKR},
|
||||
};
|
||||
|
||||
struct InputCharacter {
|
||||
wchar_t character;
|
||||
u16 type;
|
||||
bool repeat;
|
||||
u32 value;
|
||||
};
|
||||
static const InputCharacter inputCharacterTemplate = {0, 3, false, 0};
|
||||
|
||||
static PaneAnimation csPaneToAnimationInSign[25] = {
|
||||
{0, "N_SGNkeytop_all", 3, 0, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2]}},
|
||||
{1, "N_SGNkeyall", 3, 0, {&csAninationFileForSign[0], &csAninationFileForSign[7], &csAninationFileForSign[8]}},
|
||||
{2, "P_SGNkey_00", 7, 0, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_01", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_02", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_03", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_04", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_05", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_06", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_07", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_08", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_09", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_10", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_11", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_12", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_13", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_14", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_15", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_16", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_17", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_18", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_19", 7, csSgnKeyBase, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_prev", 7, csSgnKeyClose, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_next", 7, csSgnKeyClose, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
{2, "P_SGNkey_close", 7, 0, {&csAninationFileForSign[0], &csAninationFileForSign[1], &csAninationFileForSign[2], &csAninationFileForSign[3], &csAninationFileForSign[4], &csAninationFileForSign[5], &csAninationFileForSign[6]}},
|
||||
};
|
||||
|
||||
static inline s32 findControlKey(const char* paneName) {
|
||||
u32 index = 0;
|
||||
do {
|
||||
if (util::strcmp(csPaneNameToControlKey[index & 0xFFFF].paneName, paneName))
|
||||
return csPaneNameToControlKey[index & 0xFFFF].key;
|
||||
++index;
|
||||
} while (index < 3);
|
||||
return 0x1B;
|
||||
}
|
||||
|
||||
static inline wchar_t findSignCharacter(const PaneNameToCharCodeInSignMode* keys, u16 page, const char* paneName) {
|
||||
u32 index = 0;
|
||||
do {
|
||||
if (util::strcmp(keys[index & 0xFFFF].szPaneName, paneName))
|
||||
return keys[index & 0xFFFF].wc[page];
|
||||
++index;
|
||||
} while (index < 20);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Base::create(MEMAllocator*) {
|
||||
muPage = 0;
|
||||
mbLocked = 0;
|
||||
mbRepeat = 0;
|
||||
mpLanguageDependency = &csLanguageDependencyData[getLanguage()];
|
||||
}
|
||||
|
||||
void Base::init() {
|
||||
muPage = 0;
|
||||
mbLocked = 0;
|
||||
mbRepeat = 0;
|
||||
mpLanguageDependency = &csLanguageDependencyData[getLanguage()];
|
||||
}
|
||||
|
||||
void Base::onKey(u32 command, void* data) {
|
||||
s32 key;
|
||||
if (command != 4) {
|
||||
return;
|
||||
}
|
||||
|
||||
key = findControlKey(static_cast<const char*>(data));
|
||||
|
||||
if (key != 0x1B) {
|
||||
switch (key) {
|
||||
case 0x18:
|
||||
close();
|
||||
break;
|
||||
case 0x1A:
|
||||
movePrevSignPage();
|
||||
break;
|
||||
case 0x19:
|
||||
moveNextSignPage();
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
u16 code = findSignCharacter(mpLanguageDependency->keys, muPage, static_cast<const char*>(data));
|
||||
|
||||
if (code != 0) {
|
||||
InputCharacter input = inputCharacterTemplate;
|
||||
input.character = code;
|
||||
input.repeat = mbRepeat;
|
||||
if (mpManager->getInputForm()->isAtokActive()) {
|
||||
input.repeat = true;
|
||||
}
|
||||
if (meLanguage - 8U <= 1U) {
|
||||
input.repeat = 1;
|
||||
}
|
||||
sendCommand(5, &input);
|
||||
}
|
||||
}
|
||||
|
||||
void Base::close() {}
|
||||
|
||||
void Base::movePrevSignPage() {
|
||||
if (muPage == 0) {
|
||||
muPage = mpLanguageDependency->count - 1;
|
||||
return;
|
||||
}
|
||||
muPage = muPage - 1;
|
||||
return;
|
||||
}
|
||||
|
||||
void Base::moveNextSignPage() {
|
||||
u8 page = muPage + 1;
|
||||
muPage = page;
|
||||
if (page < mpLanguageDependency->count) {
|
||||
return;
|
||||
}
|
||||
muPage = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
LayoutByNW4R::~LayoutByNW4R() {
|
||||
mpEventHandler->~EventHandler();
|
||||
MEMFreeToAllocator(mpAllocator, mpEventHandler);
|
||||
AnmPane* pane = static_cast<AnmPane*>(nw4r::ut::List_GetNext(&mAnmPanes, NULL));
|
||||
while (pane != NULL) {
|
||||
nw4r::ut::List_Remove(&mAnmPanes, pane);
|
||||
pane->destroy(mpAllocator);
|
||||
pane = static_cast<AnmPane*>(nw4r::ut::List_GetNext(&mAnmPanes, NULL));
|
||||
}
|
||||
}
|
||||
|
||||
Base::~Base() {}
|
||||
|
||||
EventHandler::~EventHandler() {}
|
||||
|
||||
void LayoutByNW4R::create(MEMAllocator* allocator) {
|
||||
mpAllocator = allocator;
|
||||
Base::create(allocator);
|
||||
void* eventBuffer = MEMAllocFromAllocator(allocator, sizeof(EventHandler));
|
||||
mpEventHandler = new (eventBuffer) EventHandler(this);
|
||||
Layout::createWithEventHandler(allocator, mpEventHandler);
|
||||
mpPaneManager->setAllComponentTriggerTarget(false);
|
||||
mpPaneManager->setAllBoundingBoxComponentTriggerTarget(true);
|
||||
|
||||
const char* forceName;
|
||||
u32 animationCount;
|
||||
u32 paneIndex = 0;
|
||||
do {
|
||||
AnmPane* pane = NULL;
|
||||
const PaneAnimation& paneInfo = csPaneToAnimationInSign[paneIndex & 0xFFFF];
|
||||
switch (paneInfo.type) {
|
||||
case 2: {
|
||||
void* paneBuffer = MEMAllocFromAllocator(allocator, sizeof(CellPhoneSignButtonPane));
|
||||
pane = new (paneBuffer) CellPhoneSignButtonPane(getPane(paneInfo.paneName), this);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
void* paneBuffer = MEMAllocFromAllocator(allocator, sizeof(CellPhoneSignScrollAnmPane));
|
||||
pane = new (paneBuffer) CellPhoneSignScrollAnmPane(getPane(paneInfo.paneName), this);
|
||||
break;
|
||||
}
|
||||
case 0: {
|
||||
void* paneBuffer = MEMAllocFromAllocator(allocator, sizeof(CellPhoneSignAllAnmPane));
|
||||
pane = new (paneBuffer) CellPhoneSignAllAnmPane(getPane(paneInfo.paneName), this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
nw4r::ut::List_Append(&mAnmPanes, pane);
|
||||
forceName = paneInfo.forceName;
|
||||
animationCount = paneInfo.animationCount;
|
||||
u16 animationIndex = 0;
|
||||
while (animationIndex < animationCount) {
|
||||
void* resource = mpMultiArcResourceAccessor->GetResource(0, paneInfo.animations[animationIndex]->name);
|
||||
AnimTransformPane* transform = static_cast<AnimTransformPane*>(
|
||||
getLayout()->CreateAnimTransform(resource, mpMultiArcResourceAccessor));
|
||||
if (forceName != NULL) {
|
||||
pane->forceAddAnimation(allocator, paneInfo.animations[animationIndex]->id, transform, forceName, false, true);
|
||||
} else {
|
||||
pane->addAnimation(allocator, paneInfo.animations[animationIndex]->id, transform, false, true);
|
||||
}
|
||||
++animationIndex;
|
||||
}
|
||||
++paneIndex;
|
||||
} while (paneIndex < 25);
|
||||
init();
|
||||
}
|
||||
|
||||
AnmPane::~AnmPane() {}
|
||||
|
||||
void LayoutByNW4R::init() {
|
||||
Base::init();
|
||||
searchAnmPane("N_SGNkeytop_all")->changeAnimation(0);
|
||||
setVisible("N_SGNkeytop_all", true);
|
||||
searchAnmPane("P_SGNkey_prev")->changeAnimation(0);
|
||||
searchAnmPane("P_SGNkey_next")->changeAnimation(0);
|
||||
setSignKeyTop(muPage, muPage);
|
||||
setPageNumber(muPage);
|
||||
mpLayout->Animate(0);
|
||||
mpLayout->CalculateMtx(mDrawInfo);
|
||||
}
|
||||
|
||||
void LayoutByNW4R::onKey(u32 command, void* data) {
|
||||
Base::onKey(command, data);
|
||||
if (command == 4) {
|
||||
s32 key;
|
||||
const char* paneName = static_cast<const char*>(data);
|
||||
key = findControlKey(paneName);
|
||||
|
||||
if (key == 0x1B) {
|
||||
goto character;
|
||||
}
|
||||
switch (key) {
|
||||
case 0x18:
|
||||
mpEventObserver->onSE(sound::SE_CHAR_DECIDE);
|
||||
break;
|
||||
case 0x19:
|
||||
case 0x1A:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
|
||||
character:
|
||||
u16 code = findSignCharacter(mpLanguageDependency->keys, muPage, paneName);
|
||||
|
||||
if ((code != 0) && (mpKeyboard->getType() == 0)) {
|
||||
sendCommand(0x27, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutByNW4R::open(KeyboardBase* keyboard, bool input) {
|
||||
resetAnmSignWindow();
|
||||
throwReleaseForAll();
|
||||
getPaneManager()->init();
|
||||
if (meLanguage - 8U <= 1U) {
|
||||
sendCommand(6, NULL);
|
||||
}
|
||||
mbActive = 1;
|
||||
mbInput = 0;
|
||||
mpKeyboard = keyboard;
|
||||
initPaneLastDrawReceived();
|
||||
mbRepeat = input;
|
||||
setSignKeyTop(muPage, muPage);
|
||||
setPageNumber(muPage);
|
||||
searchAnmPane("N_SGNkeytop_all")->onAnmEvent(nw4rmanager::AnmPane::PE_6);
|
||||
mpEventObserver->onSE(sound::SE_SYMBOL_PAGE_OPEN);
|
||||
}
|
||||
|
||||
void LayoutByNW4R::close() {
|
||||
if (mpKeyboard->getType() == 0) {
|
||||
keyboard::pctype::LayoutByNW4R* keyboard = static_cast<keyboard::pctype::LayoutByNW4R*>(mpKeyboard);
|
||||
static_cast<nw4rmanager::Layout&>(*keyboard).getLayout()->GetRootPane()->SetVisible(true);
|
||||
}
|
||||
searchAnmPane("N_SGNkeytop_all")->onAnmEvent(nw4rmanager::AnmPane::PE_7);
|
||||
mbInput = 0;
|
||||
}
|
||||
|
||||
void LayoutByNW4R::endToClose() {
|
||||
if (mpKeyboard != NULL) {
|
||||
mpKeyboard->update();
|
||||
}
|
||||
mbActive = 0;
|
||||
setVisible("N_SGNkeytop_all", false);
|
||||
}
|
||||
|
||||
void LayoutByNW4R::startToInput() {
|
||||
mbInput = 1;
|
||||
if (mpKeyboard->getType() == 0) {
|
||||
keyboard::pctype::LayoutByNW4R* keyboard = static_cast<keyboard::pctype::LayoutByNW4R*>(mpKeyboard);
|
||||
static_cast<nw4rmanager::Layout&>(*keyboard).getLayout()->GetRootPane()->SetVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutByNW4R::onChangeAnmState(AnmEvent event, nw4rmanager::AnmPane* pane, nw4rmanager::Anim* anim) {
|
||||
if (util::strcmp("N_SGNkeyall", pane->getPane()->GetName()) &&
|
||||
((anim->muID == 7 || anim->muID == 5) && event == nw4rmanager::AnmObserver::E_1)) {
|
||||
setSignKeyTop(muPage, muPage);
|
||||
}
|
||||
if (util::strcmp("N_SGNkeytop_all", pane->getPane()->GetName())) {
|
||||
if ((anim->muID == 8) && (event == nw4rmanager::AnmObserver::E_1)) {
|
||||
endToClose();
|
||||
}
|
||||
if ((anim->muID == 1) && (event == nw4rmanager::AnmObserver::E_1)) {
|
||||
startToInput();
|
||||
}
|
||||
}
|
||||
if (anim->muID == 7 || anim->muID == 5) {
|
||||
if (event == nw4rmanager::AnmObserver::E_0) {
|
||||
mbLocked = 1;
|
||||
}
|
||||
if (event == nw4rmanager::AnmObserver::E_1) {
|
||||
mbLocked = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutByNW4R::throwReleaseForAll() {
|
||||
nw4rmanager::AnmPane* pane = static_cast<nw4rmanager::AnmPane*>(nw4r::ut::List_GetNext(&mAnmPanes, NULL));
|
||||
while (pane != NULL) {
|
||||
s32 keyType = static_cast<AnmPane*>(pane)->getKeyType();
|
||||
if (keyType == 2) {
|
||||
pane->onAnmEvent(nw4rmanager::AnmPane::PE_2);
|
||||
}
|
||||
pane = static_cast<nw4rmanager::AnmPane*>(nw4r::ut::List_GetNext(&mAnmPanes, pane));
|
||||
}
|
||||
}
|
||||
|
||||
u32 AnmPane::getKeyType() const {
|
||||
return muKeyType;
|
||||
}
|
||||
|
||||
void LayoutByNW4R::resetAnmSignWindow() {
|
||||
for (u16 i = 0; i < 25; i++) {
|
||||
searchAnmPane(csPaneToAnimationInSign[i].paneName)->init();
|
||||
}
|
||||
}
|
||||
|
||||
void AnmPane::init() {
|
||||
muAnimation = 0;
|
||||
}
|
||||
|
||||
void LayoutByNW4R::setSignKeyTop(u16 oldPage, u16 newPage) {
|
||||
char paneName[17];
|
||||
wchar_t oldCharacter[2];
|
||||
wchar_t newCharacter[2];
|
||||
for (u16 i = 0; i < 20; i++) {
|
||||
const char* sourcePaneName = mpLanguageDependency->keys[i].szPaneName;
|
||||
memset(paneName, 0, 0x11);
|
||||
strncpy(paneName, sourcePaneName, strlen(sourcePaneName));
|
||||
paneName[0] = 'T';
|
||||
oldCharacter[0] = mpLanguageDependency->keys[i].wc[oldPage];
|
||||
oldCharacter[1] = 0;
|
||||
const char* nextPaneName = mpLanguageDependency->keys[i].szNextPaneName;
|
||||
newCharacter[0] = mpLanguageDependency->keys[i].wc[newPage];
|
||||
newCharacter[1] = 0;
|
||||
nw4r::lyt::TextBox* textBox = static_cast<nw4r::lyt::TextBox*>(getPane(paneName));
|
||||
textBox->SetString(oldCharacter, 0);
|
||||
textBox = static_cast<nw4r::lyt::TextBox*>(getPane(nextPaneName));
|
||||
textBox->SetString(newCharacter, 0);
|
||||
}
|
||||
setString("T_SGNkey_prev", langindependent::cLanguageIndependentString[langindependent::LANG_STRID_PREV][getLanguage()]);
|
||||
setString("T_SGNkey_next", langindependent::cLanguageIndependentString[langindependent::LANG_STRID_NEXT][getLanguage()]);
|
||||
setString("T_SGNkey_close", langindependent::cLanguageIndependentString[langindependent::LANG_STRID_CLOSE][getLanguage()]);
|
||||
}
|
||||
|
||||
void LayoutByNW4R::setPageNumber(u16 page) {
|
||||
wchar_t text[17];
|
||||
swprintf(text, 0x11, L"%d/%d", page + 1, mpLanguageDependency->count);
|
||||
nw4r::lyt::TextBox* textBox = static_cast<nw4r::lyt::TextBox*>(getPane("T_SGN_pageNumber"));
|
||||
textBox->SetString(text, 0);
|
||||
}
|
||||
|
||||
void LayoutByNW4R::movePrevSignPage() {
|
||||
u8 oldPage = muPage;
|
||||
if (oldPage == 0) {
|
||||
muPage = mpLanguageDependency->count - 1;
|
||||
} else {
|
||||
muPage = oldPage - 1;
|
||||
}
|
||||
u8 newPage = muPage;
|
||||
setSignKeyTop(oldPage, newPage);
|
||||
setPageNumber(newPage);
|
||||
movePrevSignWindow();
|
||||
mpEventObserver->onSE(sound::SE_15);
|
||||
}
|
||||
|
||||
void LayoutByNW4R::moveNextSignPage() {
|
||||
u8 oldPage = muPage;
|
||||
u8 page = oldPage + 1;
|
||||
muPage = page;
|
||||
if (page >= mpLanguageDependency->count) {
|
||||
muPage = 0;
|
||||
}
|
||||
u8 newPage = muPage;
|
||||
setSignKeyTop(oldPage, newPage);
|
||||
setPageNumber(newPage);
|
||||
moveNextSignWindow();
|
||||
mpEventObserver->onSE(sound::SE_15);
|
||||
}
|
||||
|
||||
void LayoutByNW4R::movePrevSignWindow() {
|
||||
searchAnmPane("N_SGNkeyall")->onAnmEvent(static_cast<nw4rmanager::AnmPane::AnmPaneEvent>(8));
|
||||
}
|
||||
|
||||
void LayoutByNW4R::moveNextSignWindow() {
|
||||
searchAnmPane("N_SGNkeyall")->onAnmEvent(static_cast<nw4rmanager::AnmPane::AnmPaneEvent>(9));
|
||||
}
|
||||
|
||||
bool LayoutByNW4R::updateInput(int point, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data) {
|
||||
if (mbInput != 0) {
|
||||
return nw4rmanager::Layout::updateInput(point, x, y, trig, hold, release, data);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LayoutByNW4R::updateInput(input::HKBManager& manager) {
|
||||
if (mbInput == 0) {
|
||||
return false;
|
||||
}
|
||||
input::HKBManager::KeySet keySet = manager.GetTriggeredKeySet();
|
||||
if (keySet.IsValid()) {
|
||||
throwReleaseForAll();
|
||||
close();
|
||||
mpEventObserver->onSE(sound::SE_CHAR_DECIDE);
|
||||
return false;
|
||||
}
|
||||
return nw4rmanager::Layout::updateInput(manager);
|
||||
}
|
||||
|
||||
void EventHandler::onTiEvent(gui::PaneComponent* paneComponent, u32 event, Input* input) {
|
||||
s32 eventType = event;
|
||||
const char* name = paneComponent->getPane()->GetName();
|
||||
if (!mpLayoutByNW4R->isLocked() || event != 4) {
|
||||
if (event == 4 && (input->trigger & 0x800) != 0) {
|
||||
mpLayoutByNW4R->onKey(4, const_cast<char*>(name));
|
||||
}
|
||||
if (name[0] == 'B') {
|
||||
char paneName[24];
|
||||
memset(paneName, 0, 0x11);
|
||||
strncpy(paneName, name, strlen(name));
|
||||
paneName[0] = 'P';
|
||||
AnmPane* pane = static_cast<AnmPane*>(mpLayoutByNW4R->searchAnmPane(paneName));
|
||||
if (pane != NULL) {
|
||||
switch (eventType) {
|
||||
case 4:
|
||||
if ((input->trigger & 0x800) != 0) {
|
||||
pane->onAnmEvent(nw4rmanager::AnmPane::PE_0);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
pane->onAnmEvent(nw4rmanager::AnmPane::PE_2);
|
||||
break;
|
||||
case 0:
|
||||
mpEventObserver->onSE(sound::SE_SELECT);
|
||||
mpLayoutByNW4R->setPaneLastDrawReceived(pane->getPane());
|
||||
pane->onAnmEvent(nw4rmanager::AnmPane::PE_1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Base::isLocked() {
|
||||
return mbLocked;
|
||||
}
|
||||
|
||||
void CellPhoneSignAllAnmPane::onAnmEvent(AnmPaneEvent event) {
|
||||
if (event == 6) {
|
||||
getPane()->SetVisible(true);
|
||||
changeAnimation(1);
|
||||
return;
|
||||
}
|
||||
if (event == 7) {
|
||||
changeAnimation(8);
|
||||
return;
|
||||
}
|
||||
if (muAnimation != 8) {
|
||||
if (muAnimation >= 8) {
|
||||
return;
|
||||
}
|
||||
if (muAnimation != 1) {
|
||||
return;
|
||||
}
|
||||
if (event != 4) {
|
||||
return;
|
||||
}
|
||||
changeAnimation(0);
|
||||
return;
|
||||
}
|
||||
if (event == 4) {
|
||||
getPane()->SetVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void AnmPane::changeAnimation(u32 animation) {
|
||||
muAnimation = animation;
|
||||
nw4rmanager::AnmPane::changeAnimation(animation);
|
||||
}
|
||||
|
||||
void CellPhoneSignScrollAnmPane::onAnmEvent(AnmPaneEvent event) {
|
||||
switch (muAnimation) {
|
||||
case 0:
|
||||
if (event == 9) {
|
||||
changeAnimation(5);
|
||||
}
|
||||
if (event != 8) {
|
||||
return;
|
||||
}
|
||||
changeAnimation(7);
|
||||
return;
|
||||
case 5:
|
||||
case 7:
|
||||
if (event != 4) {
|
||||
return;
|
||||
}
|
||||
changeAnimation(0);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void CellPhoneSignButtonPane::onAnmEvent(AnmPaneEvent event) {
|
||||
if (event == 0) {
|
||||
changeAnimation(4);
|
||||
}
|
||||
switch (muAnimation) {
|
||||
case 0:
|
||||
if (event == 1) {
|
||||
changeAnimation(2);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (event == 4) {
|
||||
changeAnimation(3);
|
||||
}
|
||||
if (event == 2) {
|
||||
changeAnimation(6);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (event == 2) {
|
||||
changeAnimation(6);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (event == 4) {
|
||||
changeAnimation(0);
|
||||
}
|
||||
if (event == 1) {
|
||||
changeAnimation(2);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (event == 4) {
|
||||
changeAnimation(3);
|
||||
}
|
||||
if (event == 2) {
|
||||
changeAnimation(6);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutByNW4R::draw() {
|
||||
nw4rmanager::Layout::draw();
|
||||
}
|
||||
|
||||
}
|
||||
void KeyboardBase::onActive() {}
|
||||
namespace signwindow {
|
||||
|
||||
u8 Base::getPage() {
|
||||
return muPage;
|
||||
}
|
||||
|
||||
void Base::setPage(u8 page) {
|
||||
muPage = page;
|
||||
if (muPage < mpLanguageDependency->count) {
|
||||
return;
|
||||
}
|
||||
muPage = 0;
|
||||
}
|
||||
|
||||
void Base::setLanguage(Language language) {
|
||||
meLanguage = language;
|
||||
init();
|
||||
}
|
||||
|
||||
int Base::getType() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
bool LayoutByNW4R::isActive() {
|
||||
return mbActive;
|
||||
}
|
||||
|
||||
CellPhoneSignButtonPane::~CellPhoneSignButtonPane() {}
|
||||
|
||||
void CellPhoneSignButtonPane::init() {
|
||||
muAnimation = 0;
|
||||
}
|
||||
|
||||
void CellPhoneSignScrollAnmPane::init() {
|
||||
muAnimation = 0;
|
||||
}
|
||||
|
||||
CellPhoneSignAllAnmPane::~CellPhoneSignAllAnmPane() {}
|
||||
|
||||
void CellPhoneSignAllAnmPane::init() {
|
||||
muAnimation = 0;
|
||||
}
|
||||
|
||||
CellPhoneSignScrollAnmPane::~CellPhoneSignScrollAnmPane() {}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
1299
src/scene/cardSequence/iplCardSequence.cpp
Normal file
1299
src/scene/cardSequence/iplCardSequence.cpp
Normal file
File diff suppressed because it is too large
Load Diff
912
src/scene/memoryCard/iplGCWindow.cpp
Normal file
912
src/scene/memoryCard/iplGCWindow.cpp
Normal file
@@ -0,0 +1,912 @@
|
||||
#define IPL_MEMORYCARD_BASE_CTOR_OUT_OF_LINE
|
||||
#define IPL_MEMORYCARD_BASE_EVENT_OUT_OF_LINE
|
||||
#define IPL_GCW_PANEMANAGER_CTOR_OUT_OF_LINE
|
||||
#define IPL_GCW_INTP_CTOR_OUT_OF_LINE
|
||||
#define IPL_GC_WINDOW_CPP
|
||||
#include "scene/memoryCard/iplGCWindow.h"
|
||||
#include "scene/memoryCard/iplMemoryCard.h"
|
||||
#include "scene/settingSelect/iplSettingButton.h"
|
||||
#include "iplSound.h"
|
||||
#include "iplSystem.h"
|
||||
#include "system/iplDialogWindow.h"
|
||||
#include "system/iplHomeButton.h"
|
||||
#include <wchar.h>
|
||||
#include <cstring>
|
||||
|
||||
namespace ipl {
|
||||
namespace math {
|
||||
template <typename T>
|
||||
LinearIntp<T>::LinearIntp() {}
|
||||
}
|
||||
namespace scene {
|
||||
struct TextboxToMessageID {
|
||||
const char* name;
|
||||
u32 id;
|
||||
};
|
||||
|
||||
static const MemoryBase::AnmName scAnmName[16] = {
|
||||
{"it_CubeDetail_a_SeenIn.brlan", "G_Mask"},
|
||||
{"it_CubeDetail_a_SeenOut.brlan", "G_Mask"},
|
||||
{"it_CubeDetail_a_MoveFoucusIn.brlan", "G_Move"},
|
||||
{"it_CubeDetail_a_MoveFoucusOut.brlan", "G_Move"},
|
||||
{"it_CubeDetail_a_MoveFlash.brlan", "G_MoveFlash"},
|
||||
{"it_CubeDetail_a_CopyFoucusIn.brlan", "G_Copy"},
|
||||
{"it_CubeDetail_a_CopyFoucusOut.brlan", "G_Copy"},
|
||||
{"it_CubeDetail_a_CopyFlash.brlan", "G_CopyFlash"},
|
||||
{"it_CubeDetail_a_DelFoucusIn.brlan", "G_Del"},
|
||||
{"it_CubeDetail_a_DelFoucusOut.brlan", "G_Del"},
|
||||
{"it_CubeDetail_a_DelFlash.brlan", "G_DelFlash"},
|
||||
{"it_CubeDetail_a_SelectOut.brlan", "G_Select"},
|
||||
{"it_CubeDetail_a_SeenOutYes.brlan", "G_Mask"},
|
||||
{"it_CubeDetail_a_SeenOutYesOk.brlan", "G_Mask"},
|
||||
{"it_CubeDetail_a_SeenOutNo.brlan", "G_Mask"},
|
||||
{"it_CubeDetail_a_Wait.brlan", "G_Wait"},
|
||||
};
|
||||
|
||||
static const TextboxToMessageID scTextboxToMessageID[3] = {
|
||||
{"T_Move_00", 0xA7},
|
||||
{"T_Copy_00", 0xB2},
|
||||
{"T_Del_00", 0xBD},
|
||||
};
|
||||
|
||||
static const char* scButtonName[3] = {"B_Move_00", "B_Copy_00", "B_Del_00"};
|
||||
GCWindow::GCWindow(EGG::Heap* heap, nand::LayoutFile* layoutFile, const char* directory, const char* fileName)
|
||||
: MemoryBase(), MemCardEventHandler(), mState(0), mLinearInterp(), mCardState(0), mCardIndex(0), mOperation(0), mActive(false),
|
||||
mWaiting(false) {
|
||||
mpLayout = new layout::Object(heap, layoutFile, directory, fileName);
|
||||
add_animation(scAnmName, 0x10);
|
||||
mpLayout->finishBinding();
|
||||
set_visible("N_Wait", false);
|
||||
mpEvent = new MemoryBaseEvent(this);
|
||||
mpPaneManager = new gui::PaneManager(mpEvent, mpLayout->getDrawInfo(), NULL, NULL, true);
|
||||
mpPaneManager->createLayoutScene(*mpLayout->getNW4RLyt());
|
||||
mpPaneManager->setAllComponentTriggerTarget(false);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mpPaneManager->setTriggerTarget(mpLayout->getNW4RLyt()->GetRootPane()->FindPaneByName(scButtonName[i], true), true);
|
||||
}
|
||||
add_anmbutton(scButtonName[0], get_animation(2), get_animation(3), get_animation(4));
|
||||
add_anmbutton(scButtonName[1], get_animation(5), get_animation(6), get_animation(7));
|
||||
add_anmbutton(scButtonName[2], get_animation(8), get_animation(9), get_animation(10));
|
||||
for (int i = 0; i < 3; i++) {
|
||||
set_textbox(scTextboxToMessageID[i].name, scTextboxToMessageID[i].id);
|
||||
}
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mFlags0[i] = 0;
|
||||
mFlags1[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MemoryBase::MemoryBase() : mpLayout(NULL), unk_0x08(NULL) {
|
||||
nw4r::ut::List_Init(&mAnmList, offsetof(Anm, mLink));
|
||||
nw4r::ut::List_Init(&mButtonList, offsetof(Button, mLink));
|
||||
nw4r::ut::List_Init(&mAnmButtonList, offsetof(AnmButton, mLink));
|
||||
}
|
||||
|
||||
MemCardEventHandler::~MemCardEventHandler() {}
|
||||
|
||||
MemoryBaseEvent::MemoryBaseEvent(MemoryBase* memoryBase) : mpBase(memoryBase) {}
|
||||
|
||||
void GCWindow::init(const math::VEC3& translate, MemoryCardManager* manager, u8 cardState, short cardIndex) {
|
||||
mActive = true;
|
||||
mFlags1[cardState] = 0;
|
||||
set_visible("N_Banner", true);
|
||||
mpMemoryCardManager = manager;
|
||||
mpMemoryCardManager->setEventHandler(this);
|
||||
mCardState = cardState;
|
||||
mCardIndex = cardIndex;
|
||||
set_textbox("T_Title_00", mpMemoryCardManager->getComment(cardState, cardIndex, 0), 450.0f, 31.0f);
|
||||
set_textbox("T_Title_01", mpMemoryCardManager->getComment(cardState, cardIndex, 1), 450.0f, 31.0f);
|
||||
int i = 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
mpPaneManager->initPane(mpLayout->getNW4RLyt()->GetRootPane()->FindPaneByName(scButtonName[i], true));
|
||||
}
|
||||
int blocks = mpMemoryCardManager->getBlocks(cardState, cardIndex);
|
||||
wchar_t digits[10] = {L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7', L'8', L'9'};
|
||||
int blockCount = static_cast<u16>(blocks);
|
||||
wchar_t decimal[5] = {0};
|
||||
int skipCount = 0;
|
||||
wchar_t blockText[5] = {0};
|
||||
decimal[0] = digits[blockCount / 1000];
|
||||
decimal[1] = digits[(blockCount / 100) % 10];
|
||||
decimal[2] = digits[(blockCount / 10) % 10];
|
||||
decimal[3] = digits[blockCount % 10];
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (decimal[i] != L'0') {
|
||||
break;
|
||||
}
|
||||
skipCount++;
|
||||
}
|
||||
wcscpy(blockText, decimal + skipCount);
|
||||
set_textbox("T_Block_00", blockText);
|
||||
mTranslate = translate;
|
||||
math::VEC3 zero(0.0f, 0.0f, 0.0f);
|
||||
mLinearInterp.init(ANIM_TYPE_FORWARD, 12.0f, 0.0f, mTranslate, zero, 1.0f);
|
||||
mLinearInterp.initFrame();
|
||||
mLinearInterp.restart();
|
||||
math::VEC3 position = mLinearInterp.get();
|
||||
mpLayout->FindPaneByName("N_Window")->SetTranslate(position);
|
||||
do_animation(0);
|
||||
mState = 1;
|
||||
}
|
||||
|
||||
void GCWindow::calc() {
|
||||
mpLayout->calc();
|
||||
mpPaneManager->calc();
|
||||
void* button = NULL;
|
||||
while ((button = nw4r::ut::List_GetNext(&mAnmButtonList, button)) != NULL) {
|
||||
((MemoryBase::AnmButton*)button)->calc();
|
||||
}
|
||||
switch (mState) {
|
||||
case 0:
|
||||
on_wait();
|
||||
break;
|
||||
case 1:
|
||||
on_fadein();
|
||||
break;
|
||||
case 2:
|
||||
on_normal();
|
||||
break;
|
||||
case 3:
|
||||
on_fadeout1st();
|
||||
break;
|
||||
case 4:
|
||||
if (!is_animation(1)) {
|
||||
destroy();
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
on_fadeout_yes1st();
|
||||
break;
|
||||
case 6:
|
||||
if (!is_animation(0xd)) {
|
||||
destroy();
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if (!is_animation(0xe)) {
|
||||
destroy();
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
on_focus_move();
|
||||
break;
|
||||
case 9:
|
||||
on_focus_copy();
|
||||
break;
|
||||
case 10:
|
||||
on_focus_del();
|
||||
break;
|
||||
case 0xb:
|
||||
on_select_out();
|
||||
break;
|
||||
case 0xc:
|
||||
on_dialog();
|
||||
break;
|
||||
case 0xd:
|
||||
on_error_message();
|
||||
break;
|
||||
case 0xe:
|
||||
on_error_message1st();
|
||||
break;
|
||||
case 0xf:
|
||||
on_error_message2nd();
|
||||
break;
|
||||
case 0x10:
|
||||
on_error_message3rd();
|
||||
break;
|
||||
case 0x11:
|
||||
on_process();
|
||||
break;
|
||||
case 0x12:
|
||||
on_format1st();
|
||||
break;
|
||||
case 0x13:
|
||||
on_format2nd();
|
||||
break;
|
||||
case 0x14:
|
||||
on_format3rd();
|
||||
break;
|
||||
case 0x15:
|
||||
on_format4th();
|
||||
break;
|
||||
case 0x16:
|
||||
on_format_error();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::draw() {
|
||||
mpLayout->getNW4RLyt()->GetRootPane()->FindPaneByName("Banner_00", true)->SetVisible(false);
|
||||
mpLayout->getNW4RLyt()->GetRootPane()->FindPaneByName("Banner_01", true)->SetVisible(false);
|
||||
if (mpMemoryCardManager->isIconValidate(mCardState, mCardIndex)) {
|
||||
if (mpMemoryCardManager->isBannerEnable(mCardState, mCardIndex)) {
|
||||
const GXTexObj* banner = mpMemoryCardManager->create_banner(mCardState, mCardIndex);
|
||||
if (banner != NULL) {
|
||||
set_texture("Banner_00", *banner);
|
||||
mpLayout->getNW4RLyt()->GetRootPane()->FindPaneByName("Banner_00", true)->SetVisible(true);
|
||||
}
|
||||
} else {
|
||||
const GXTexObj* icon = mpMemoryCardManager->create_icon(mCardState, mCardIndex, 0);
|
||||
if (icon != NULL) {
|
||||
set_texture("Banner_01", *icon);
|
||||
mpLayout->getNW4RLyt()->GetRootPane()->FindPaneByName("Banner_01", true)->SetVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
mpLayout->draw();
|
||||
}
|
||||
|
||||
void GCWindow::destroy() {
|
||||
((MemoryCard*)System::getScene(0xe))->onRelease();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
clear_button(scButtonName[i]);
|
||||
}
|
||||
System::getHomeButtonMenu()->enable();
|
||||
mWaiting = false;
|
||||
show_button_return();
|
||||
mActive = false;
|
||||
mState = 0;
|
||||
}
|
||||
|
||||
void GCWindow::onPoint(const char* name, controller::Interface* controller) {
|
||||
MemoryBase::AnmButton* button = get_anmbutton(name);
|
||||
if (button != NULL) {
|
||||
if (button->unk_0x04 == 0) {
|
||||
button->onCmdRecv(1);
|
||||
snd::sSystem.startSE("WIPL_SE_BT_TARGETTING");
|
||||
if (controller != NULL) {
|
||||
controller->rumble(0);
|
||||
}
|
||||
}
|
||||
button->unk_0x04++;
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::onLeft(const char* name) {
|
||||
MemoryBase::AnmButton* button = get_anmbutton(name);
|
||||
if (button != NULL) {
|
||||
if (button->unk_0x04 == 1) {
|
||||
button->onCmdRecv(2);
|
||||
}
|
||||
button->unk_0x04--;
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::onTrig(const char* name) {
|
||||
MemoryBase::AnmButton* button = get_anmbutton(name);
|
||||
if (button != NULL) {
|
||||
if (strcmp(name, scButtonName[0]) == 0) {
|
||||
do_animation(4);
|
||||
mState = 8;
|
||||
} else if (strcmp(name, scButtonName[1]) == 0) {
|
||||
do_animation(7);
|
||||
mState = 9;
|
||||
} else if (strcmp(name, scButtonName[2]) == 0) {
|
||||
do_animation(10);
|
||||
set_textbox("T_Message_00", 0xf7);
|
||||
mState = 10;
|
||||
}
|
||||
snd::sSystem.startSE("WIPL_SE_DECIDE");
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_wait() {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (mFlags0[i] != 0) {
|
||||
((MemoryCard*)System::getScene(0xe))->onFocus(NULL);
|
||||
System::getDialog()->callBtn2(i == 0 ? 0xec : 0xed, 0x142, 0x141, true);
|
||||
mFlags0[i] = 0;
|
||||
mCardState = i;
|
||||
mState = 0x12;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_fadein() {
|
||||
mLinearInterp.calc();
|
||||
mpLayout->getNW4RLyt()->GetRootPane()->FindPaneByName("N_Window", true)->SetTranslate(mLinearInterp.get());
|
||||
if (!is_animation(0)) {
|
||||
mState = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_normal() {
|
||||
if (mActive) {
|
||||
if (get_setting_button()->update()) {
|
||||
change_button_text_return();
|
||||
mState = 3;
|
||||
} else {
|
||||
mpPaneManager->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_fadeout1st() {
|
||||
if (!get_setting_button()->isPlaying()) {
|
||||
math::VEC3 zero(0.0f, 0.0f, 0.0f);
|
||||
mLinearInterp.init(ANIM_TYPE_FORWARD, 20.0f, 0.0f, mTranslate, zero);
|
||||
mLinearInterp.setAnmType(ANIM_TYPE_BACKWARD);
|
||||
mLinearInterp.initFrame();
|
||||
mLinearInterp.restart();
|
||||
do_animation(1);
|
||||
mState = 4;
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_fadeout_yes1st() {
|
||||
change_textbox_done();
|
||||
if (!is_animation(0xc)) {
|
||||
math::VEC3 zero(0.0f, 0.0f, 0.0f);
|
||||
mLinearInterp.init(ANIM_TYPE_FORWARD, 20.0f, 0.0f, mTranslate, zero);
|
||||
mLinearInterp.setAnmType(ANIM_TYPE_BACKWARD);
|
||||
mLinearInterp.initFrame();
|
||||
mLinearInterp.restart();
|
||||
show_button_return();
|
||||
do_animation(0xd);
|
||||
mState = 6;
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_focus_move() {
|
||||
if (!is_animation(4)) {
|
||||
do_animation(0xb, false);
|
||||
long error;
|
||||
if (mpMemoryCardManager->isMoveEnable(mCardState, mCardIndex, &error)) {
|
||||
set_textbox("T_Message_00", mCardState == 0 ? 0xf5 : 0xf3);
|
||||
mOperation = 2;
|
||||
mState = 0xb;
|
||||
} else {
|
||||
switch (error) {
|
||||
case -26:
|
||||
set_textbox("T_Message_00", 0xcd);
|
||||
break;
|
||||
case -23:
|
||||
set_textbox("T_Message_00", 0xce + (mCardState == 0));
|
||||
break;
|
||||
case -28:
|
||||
case -22:
|
||||
set_textbox("T_Message_00", 0xd0 + (mCardState == 0));
|
||||
break;
|
||||
case -27:
|
||||
set_textbox("T_Message_00", 0xd4);
|
||||
break;
|
||||
case -24:
|
||||
set_textbox("T_Message_00", 0xd5);
|
||||
break;
|
||||
case -25:
|
||||
set_textbox("T_Message_00", 0xd6);
|
||||
break;
|
||||
}
|
||||
change_button_text_ok();
|
||||
mState = 0xf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_focus_copy() {
|
||||
if (!is_animation(7)) {
|
||||
do_animation(0xb, false);
|
||||
long error;
|
||||
if (mpMemoryCardManager->isCopyEnable(mCardState, mCardIndex, &error)) {
|
||||
set_textbox("T_Message_00", mCardState == 0 ? 0xf6 : 0xf4);
|
||||
mOperation = 1;
|
||||
mState = 0xb;
|
||||
} else {
|
||||
switch (error) {
|
||||
case -26:
|
||||
set_textbox("T_Message_00", 0xd9);
|
||||
break;
|
||||
case -23:
|
||||
set_textbox("T_Message_00", 0xda + (mCardState == 0));
|
||||
break;
|
||||
case -28:
|
||||
case -22:
|
||||
set_textbox("T_Message_00", 0xdc + (mCardState == 0));
|
||||
break;
|
||||
case -27:
|
||||
set_textbox("T_Message_00", 0xe0);
|
||||
break;
|
||||
case -24:
|
||||
set_textbox("T_Message_00", 0xe1);
|
||||
break;
|
||||
case -25:
|
||||
set_textbox("T_Message_00", 0xe2);
|
||||
break;
|
||||
}
|
||||
change_button_text_ok();
|
||||
mState = 0xf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_focus_del() {
|
||||
if (!is_animation(10)) {
|
||||
mOperation = 3;
|
||||
do_animation(0xb, false);
|
||||
mState = 0xb;
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_select_out() {
|
||||
if (!is_animation(0xb)) {
|
||||
System::getDialog()->callS2Btn2(0x142, 0x141, true);
|
||||
get_setting_button()->hideBtn();
|
||||
mState = 0xc;
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_dialog() {
|
||||
int result = System::getDialog()->getLastResult();
|
||||
long error;
|
||||
if (result != 2) {
|
||||
if (result < 2) {
|
||||
if (result < 1) {
|
||||
return;
|
||||
}
|
||||
} else if (result != 6) {
|
||||
return;
|
||||
}
|
||||
goto cancel_dialog;
|
||||
}
|
||||
{
|
||||
switch (mOperation) {
|
||||
case 1:
|
||||
if (mpMemoryCardManager->isCopyEnable(mCardState, mCardIndex, &error)) {
|
||||
set_visible("N_Wait", true);
|
||||
do_animation(0xf);
|
||||
snd::sSystem.startSE("WIPL_SE_COPYING");
|
||||
mpMemoryCardManager->sendCardCmdCopy(mCardState, mCardIndex);
|
||||
} else {
|
||||
switch (error) {
|
||||
case -26:
|
||||
set_textbox("T_Message_00", 0xd9);
|
||||
break;
|
||||
case -23:
|
||||
set_textbox("T_Message_00", 0xda + (mCardState == 0));
|
||||
break;
|
||||
case -28:
|
||||
case -22:
|
||||
set_textbox("T_Message_00", 0xdc + (mCardState == 0));
|
||||
break;
|
||||
case -27:
|
||||
set_textbox("T_Message_00", 0xe0);
|
||||
break;
|
||||
case -24:
|
||||
set_textbox("T_Message_00", 0xe1);
|
||||
break;
|
||||
case -25:
|
||||
set_textbox("T_Message_00", 0xe2);
|
||||
break;
|
||||
}
|
||||
change_button_text_ok();
|
||||
mState = 0xf;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
set_visible("N_Banner", false);
|
||||
mpMemoryCardManager->sendCardCmdDelete(mCardState, mCardIndex);
|
||||
break;
|
||||
case 2:
|
||||
if (mpMemoryCardManager->isMoveEnable(mCardState, mCardIndex, &error)) {
|
||||
set_visible("N_Banner", false);
|
||||
set_visible("N_Wait", true);
|
||||
do_animation(0xf);
|
||||
snd::sSystem.startSE("WIPL_SE_COPYING");
|
||||
mpMemoryCardManager->sendCardCmdMove(mCardState, mCardIndex);
|
||||
} else {
|
||||
switch (error) {
|
||||
case -26:
|
||||
set_textbox("T_Message_00", 0xcd);
|
||||
break;
|
||||
case -23:
|
||||
set_textbox("T_Message_00", 0xce + (mCardState == 0));
|
||||
break;
|
||||
case -28:
|
||||
case -22:
|
||||
set_textbox("T_Message_00", 0xd0 + (mCardState == 0));
|
||||
break;
|
||||
case -27:
|
||||
set_textbox("T_Message_00", 0xd4);
|
||||
break;
|
||||
case -24:
|
||||
set_textbox("T_Message_00", 0xd5);
|
||||
break;
|
||||
case -25:
|
||||
set_textbox("T_Message_00", 0xd6);
|
||||
break;
|
||||
}
|
||||
change_button_text_ok();
|
||||
mState = 0xf;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ((u32)mOperation - 1 <= 1) {
|
||||
do_animation(0xc);
|
||||
}
|
||||
System::getHomeButtonMenu()->disable();
|
||||
mWaiting = true;
|
||||
mState = 0x11;
|
||||
return;
|
||||
}
|
||||
|
||||
cancel_dialog:
|
||||
do_animation(0xb, true);
|
||||
mState = 2;
|
||||
get_setting_button()->showBtn();
|
||||
}
|
||||
|
||||
void GCWindow::on_error_message() {
|
||||
if (System::getDialog()->getLastResult() >= 0) {
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_process() {
|
||||
change_textbox_doing();
|
||||
if (!is_animation(0xc) && !mWaiting) {
|
||||
stop_wait_anim();
|
||||
System::getHomeButtonMenu()->enable();
|
||||
mWaiting = false;
|
||||
do_animation(0xc);
|
||||
mState = 5;
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_error_message1st() {
|
||||
if (!is_animation(0xb) && get_setting_button()->update()) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
clear_button(scButtonName[i]);
|
||||
}
|
||||
do_animation(0xb, true);
|
||||
mState = 0x10;
|
||||
change_button_text_close();
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_error_message2nd() {
|
||||
if (!is_animation(0xb) && get_setting_button()->update()) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
clear_button(scButtonName[i]);
|
||||
}
|
||||
do_animation(0xb, true);
|
||||
mState = 0x10;
|
||||
change_button_text_close();
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_error_message3rd() {
|
||||
if (mFlags1[mCardState] != 0) {
|
||||
goto fadeout;
|
||||
}
|
||||
if (mOperation != 2) {
|
||||
goto check_animation;
|
||||
}
|
||||
|
||||
fadeout:
|
||||
mState = 3;
|
||||
return;
|
||||
|
||||
check_animation:
|
||||
if (!is_animation(0xb)) {
|
||||
mState = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_format1st() {
|
||||
int result = System::getDialog()->getLastResult();
|
||||
switch (result) {
|
||||
case 1:
|
||||
case 6:
|
||||
destroy();
|
||||
break;
|
||||
case 2:
|
||||
System::getDialog()->callBtn2(0xee, 0x142, 0x141, true);
|
||||
mState = 0x13;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_format2nd() {
|
||||
int result = System::getDialog()->getLastResult();
|
||||
switch (result) {
|
||||
case 1:
|
||||
case 6:
|
||||
destroy();
|
||||
break;
|
||||
case 2:
|
||||
mOperation = 4;
|
||||
mpMemoryCardManager->sendCardCmdFormat(mCardState);
|
||||
System::getHomeButtonMenu()->disable();
|
||||
mWaiting = true;
|
||||
mState = 0x14;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_format3rd() {
|
||||
if (!mWaiting) {
|
||||
System::getDialog()->callBtn0(0xf0, 0xb4, false);
|
||||
mState = 0x15;
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_format4th() {
|
||||
if (System::getDialog()->getLastResult() >= 0) {
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::on_format_error() {
|
||||
if (System::getDialog()->getLastResult() >= 0) {
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::change_textbox_doing() {
|
||||
switch (mOperation) {
|
||||
case 2:
|
||||
set_textbox("T_Message_00", 0xfa, 0xc, 0x14);
|
||||
break;
|
||||
case 1:
|
||||
set_textbox("T_Message_00", 0xf9, 0xc, 0x14);
|
||||
break;
|
||||
case 3:
|
||||
set_textbox("T_Message_00", 0xfb, 0xc, 0x14);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::change_textbox_done() {
|
||||
switch (mOperation) {
|
||||
case 2:
|
||||
set_textbox("T_Message_00", 0x10d, 0xc, 0x14);
|
||||
break;
|
||||
case 1:
|
||||
set_textbox("T_Message_00", 0x107, 0xc, 0x14);
|
||||
break;
|
||||
case 3:
|
||||
set_textbox("T_Message_00", 0xf8, 0xc, 0x14);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GCWindow::set_texture(const char* name, const GXTexObj& texture) {
|
||||
nw4r::lyt::Pane* pane = mpLayout->getNW4RLyt()->GetRootPane()->FindPaneByName(name, true);
|
||||
nw4r::lyt::Material* material = pane->FindMaterialByName(name, true);
|
||||
material->SetTexture(0, texture);
|
||||
}
|
||||
|
||||
void GCWindow::onMemEvent(long event, u8 cardState) {
|
||||
if (event - 1U <= 3) {
|
||||
System::getHomeButtonMenu()->enable();
|
||||
mWaiting = false;
|
||||
} else if (event == 0) {
|
||||
mFlags0[cardState] = 1;
|
||||
} else if (event == 6) {
|
||||
mFlags1[cardState] = 1;
|
||||
mFlags0[cardState] = 0;
|
||||
switch (mState) {
|
||||
case 0xe:
|
||||
case 0xf:
|
||||
if (mCardState == cardState) {
|
||||
set_visible("N_Banner", false);
|
||||
}
|
||||
break;
|
||||
case 0x12:
|
||||
case 0x13:
|
||||
if (mCardState == cardState) {
|
||||
System::getDialog()->terminate();
|
||||
mState = 3;
|
||||
}
|
||||
break;
|
||||
case 0xc:
|
||||
if (mCardState == cardState) {
|
||||
System::getDialog()->terminate();
|
||||
mState = 3;
|
||||
} else if (mState - 1U <= 1) {
|
||||
System::getDialog()->terminate();
|
||||
set_textbox("T_Message_00", 0xda + (mCardState == 0));
|
||||
show_button_ok();
|
||||
mState = 0xe;
|
||||
}
|
||||
break;
|
||||
case 0x14:
|
||||
if (mCardState == cardState) {
|
||||
System::getDialog()->callBtn0(0xf1, 0xb4, false);
|
||||
mState = 0x16;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
if (mCardState == cardState) {
|
||||
mState = 3;
|
||||
}
|
||||
break;
|
||||
case 0x11:
|
||||
switch (mOperation) {
|
||||
case 2:
|
||||
stop_wait_anim();
|
||||
set_textbox("T_Message_00", 0xd7);
|
||||
break;
|
||||
case 1:
|
||||
stop_wait_anim();
|
||||
set_textbox("T_Message_00", 0xe3);
|
||||
break;
|
||||
case 3:
|
||||
if (mCardState != cardState) {
|
||||
return;
|
||||
}
|
||||
set_textbox("T_Message_00", 0xe5);
|
||||
break;
|
||||
}
|
||||
goto process_complete;
|
||||
case 0x15:
|
||||
return;
|
||||
|
||||
process_complete:
|
||||
System::getHomeButtonMenu()->enable();
|
||||
mWaiting = false;
|
||||
show_button_ok();
|
||||
mState = 0xe;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool GCWindow::isProcess() {
|
||||
return mWaiting;
|
||||
}
|
||||
|
||||
void GCWindow::stop_wait_anim() {
|
||||
set_visible("N_Wait", false);
|
||||
MemoryBase::Anm* animation = get_animation(0xf);
|
||||
animation->mAnim->stop();
|
||||
snd::sSystem.startSE("WIPL_SE_COPY_FINISH");
|
||||
}
|
||||
|
||||
SavedataEditWindow::SavedataEditWindow(EGG::Heap* heap, nand::LayoutFile* layoutFile,
|
||||
const char* directory, const char* fileName)
|
||||
: mState(0), mActive(false) {
|
||||
mpLayout = new layout::Object(heap, layoutFile, directory, fileName);
|
||||
add_animation("it_DataDetail_a_SeenIn.brlan", scAnmName[0].groupName);
|
||||
add_animation("it_DataDetail_a_SeenOut.brlan", scAnmName[0].groupName);
|
||||
add_animation("it_DataDetail_a_DelFoucusIn.brlan", scAnmName[8].groupName);
|
||||
add_animation("it_DataDetail_a_DelFoucusOut.brlan", scAnmName[8].groupName);
|
||||
add_animation("it_DataDetail_a_DelFlash.brlan", scAnmName[10].groupName);
|
||||
add_animation("it_DataDetail_a_SelectOut.brlan", scAnmName[11].groupName);
|
||||
add_animation("it_DataDetail_a_SeenOutYes.brlan", scAnmName[0].groupName);
|
||||
add_animation("it_DataDetail_a_SeenOutYesOk.brlan", scAnmName[0].groupName);
|
||||
add_animation("it_DataDetail_a_SeenOutNo.brlan", scAnmName[0].groupName);
|
||||
add_animation("it_DataDetail_a_Wait.brlan", scAnmName[15].groupName);
|
||||
mpLayout->finishBinding();
|
||||
set_visible("N_Wait", false);
|
||||
set_visible("T_Block_01", false);
|
||||
mpEvent = new MemoryBaseEvent(this);
|
||||
mpPaneManager = new gui::PaneManager(mpEvent, mpLayout->getDrawInfo(), NULL, NULL, true);
|
||||
mpPaneManager->setupScene(mpLayout);
|
||||
mpPaneManager->setAllComponentTriggerTarget(false);
|
||||
mpPaneManager->setTriggerTarget(mpLayout->FindPaneByName(scButtonName[2]), true);
|
||||
add_anmbutton(scButtonName[2], get_animation(2), get_animation(3), get_animation(4));
|
||||
set_textbox("T_Del_00", 0xbd);
|
||||
}
|
||||
|
||||
void SavedataEditWindow::calc() {
|
||||
mpLayout->calc();
|
||||
mpPaneManager->calc();
|
||||
void* button = NULL;
|
||||
while ((button = nw4r::ut::List_GetNext(&mAnmButtonList, button)) != NULL) {
|
||||
((MemoryBase::AnmButton*)button)->calc();
|
||||
}
|
||||
switch (mState) {
|
||||
case 0:
|
||||
on_normal();
|
||||
break;
|
||||
case 1:
|
||||
on_fadein();
|
||||
break;
|
||||
case 2:
|
||||
on_fadeout1st();
|
||||
break;
|
||||
case 3:
|
||||
if (!is_animation(1)) {
|
||||
destroy();
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
on_fadeout_yes1st();
|
||||
break;
|
||||
case 5:
|
||||
if (!is_animation(7)) {
|
||||
destroy();
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (!is_animation(8)) {
|
||||
destroy();
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
on_focus_del();
|
||||
break;
|
||||
case 8:
|
||||
on_select_out();
|
||||
break;
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SavedataEditWindow::on_normal() {
|
||||
if (mActive) {
|
||||
if (get_setting_button()->update()) {
|
||||
change_button_text_return();
|
||||
mState = 2;
|
||||
} else {
|
||||
mpPaneManager->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SavedataEditWindow::on_fadein() {
|
||||
mLinearInterp.calc();
|
||||
mpLayout->getNW4RLyt()->GetRootPane()->FindPaneByName("N_Window", true)->SetTranslate(mLinearInterp.get());
|
||||
if (!is_animation(0)) {
|
||||
mState = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void SavedataEditWindow::on_fadeout1st() {
|
||||
if (!get_setting_button()->isPlaying()) {
|
||||
math::VEC3 zero(0.0f, 0.0f, 0.0f);
|
||||
mLinearInterp.init(ANIM_TYPE_FORWARD, 20.0f, 0.0f, mTranslate, zero);
|
||||
mLinearInterp.setAnmType(ANIM_TYPE_BACKWARD);
|
||||
mLinearInterp.initFrame();
|
||||
mLinearInterp.restart();
|
||||
do_animation(1);
|
||||
mState = 3;
|
||||
}
|
||||
}
|
||||
|
||||
void SavedataEditWindow::on_focus_del() {
|
||||
if (!is_animation(4)) {
|
||||
do_animation(5, false);
|
||||
mState = 8;
|
||||
}
|
||||
}
|
||||
|
||||
void SavedataEditWindow::on_select_out() {
|
||||
if (!is_animation(5)) {
|
||||
System::getDialog()->callS2Btn2(0x142, 0x141, true);
|
||||
get_setting_button()->hideBtn();
|
||||
mState = 9;
|
||||
}
|
||||
}
|
||||
|
||||
void SavedataEditWindow::on_fadeout_yes1st() {
|
||||
set_textbox("T_Message_00", 0xf8, 6, 0x14);
|
||||
if (!is_animation(6)) {
|
||||
math::VEC3 zero(0.0f, 0.0f, 0.0f);
|
||||
mLinearInterp.init(ANIM_TYPE_FORWARD, 20.0f, 0.0f, mTranslate, zero);
|
||||
mLinearInterp.setAnmType(ANIM_TYPE_BACKWARD);
|
||||
mLinearInterp.initFrame();
|
||||
mLinearInterp.restart();
|
||||
get_setting_button()->setText(0x13b);
|
||||
get_setting_button()->showBtn();
|
||||
do_animation(7);
|
||||
mState = 5;
|
||||
}
|
||||
}
|
||||
|
||||
GCWindow::~GCWindow() {}
|
||||
|
||||
}
|
||||
}
|
||||
706
src/scene/memoryCard/iplMemoryCard.cpp
Normal file
706
src/scene/memoryCard/iplMemoryCard.cpp
Normal file
@@ -0,0 +1,706 @@
|
||||
#define IPL_MEMORY_CARD_CPP
|
||||
#define IPL_MEMORYCARD_BASE_OUT_OF_LINE
|
||||
#define IPL_CHANNEL_TITLE_NOVTABLE
|
||||
#include "scene/memoryCard/iplMemoryCard.h"
|
||||
#undef IPL_CHANNEL_TITLE_NOVTABLE
|
||||
|
||||
#include "scene/memoryCard/iplGCWindow.h"
|
||||
#include "scene/memoryCard/iplGCSaveData.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <cwchar>
|
||||
|
||||
#include "iplSystem.h"
|
||||
#include "scene/iplSceneCreator.h"
|
||||
#include "scene/settingSelect/iplSettingButton.h"
|
||||
#include "scene/settingSelect/iplSettingSelect.h"
|
||||
#include "scene/textBalloon/iplBalloon.h"
|
||||
#include "private/card.h"
|
||||
#include "sound/iplSound.h"
|
||||
#include "system/iplController.h"
|
||||
#include "system/iplNandManager.h"
|
||||
#include "utility/iplGraphics.h"
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
static const char* scSavedataPaneName[] = {
|
||||
"N_Data_a_00", "N_Data_a_01", "N_Data_a_02", "N_Data_a_03", "N_Data_a_04",
|
||||
"N_Data_a_05", "N_Data_a_06", "N_Data_a_07", "N_Data_a_08", "N_Data_a_09",
|
||||
"N_Data_a_10", "N_Data_a_11", "N_Data_a_12", "N_Data_a_13", "N_Data_a_14",
|
||||
"N_Data_b_00", "N_Data_b_01", "N_Data_b_02", "N_Data_b_03", "N_Data_b_04",
|
||||
"N_Data_b_05", "N_Data_b_06", "N_Data_b_07", "N_Data_b_08", "N_Data_b_09",
|
||||
"N_Data_b_10", "N_Data_b_11", "N_Data_b_12", "N_Data_b_13", "N_Data_b_14",
|
||||
"N_Data_c_00", "N_Data_c_01", "N_Data_c_02", "N_Data_c_03", "N_Data_c_04",
|
||||
"N_Data_c_05", "N_Data_c_06", "N_Data_c_07", "N_Data_c_08", "N_Data_c_09",
|
||||
"N_Data_c_10", "N_Data_c_11", "N_Data_c_12", "N_Data_c_13", "N_Data_c_14",
|
||||
};
|
||||
|
||||
static const MemoryBase::AnmName scAnmName[] = {
|
||||
{"it_ObjCubeEdit_a_CubeSwitch.brlan", "G_Switch"},
|
||||
{"it_ObjCubeEdit_a_DataIn.brlan", "G_DataAll"},
|
||||
{"it_ObjCubeEdit_a_SelectIn.brlan", "G_SelectWii"},
|
||||
{"it_ObjCubeEdit_a_SelectIn.brlan", "G_SelectSd"},
|
||||
{"it_ObjCubeEdit_a_DataOut.brlan", "G_DataAll"},
|
||||
{"it_ObjCubeEdit_a_SelectIn.brlan", "G_Select"},
|
||||
{"it_ObjCubeEdit_a_SelectWiiFoucusIn.brlan", "G_SelectWii"},
|
||||
{"it_ObjCubeEdit_a_SelectWiiFoucusOut.brlan", "G_SelectWii"},
|
||||
{"it_ObjCubeEdit_a_SelectWiiFlash.brlan", "G_Select"},
|
||||
{"it_ObjCubeEdit_a_SelectSdIn.brlan", "G_SelectSd"},
|
||||
{"it_ObjCubeEdit_a_SelectSdOut.brlan", "G_SelectSd"},
|
||||
{"it_ObjCubeEdit_a_SelectSdFlash.brlan", "G_Select"},
|
||||
{"it_ObjCubeEdit_a_ArwL1.brlan", "G_Arw"},
|
||||
{"it_ObjCubeEdit_a_AwrR1.brlan", "G_Arw"},
|
||||
{"it_ObjCubeEdit_a_Select.brlan", "G_ArwR_Ac"},
|
||||
{"it_ObjCubeEdit_a_Select.brlan", "G_ArwL_Ac"},
|
||||
{"it_ObjCubeEdit_a_FocusOn.brlan", "G_ArwR_Focus"},
|
||||
{"it_ObjCubeEdit_a_FocusOn.brlan", "G_ArwL_Focus"},
|
||||
{"it_ObjCubeEdit_a_FocusOff.brlan", "G_ArwR_Focus"},
|
||||
{"it_ObjCubeEdit_a_FocusOff.brlan", "G_ArwL_Focus"},
|
||||
{"it_ObjCubeEdit_a_Loop.brlan", "G_ArwRoop"},
|
||||
{"it_ObjCubeEdit_a_Appear.brlan", "G_ArwR_End"},
|
||||
{"it_ObjCubeEdit_a_Appear.brlan", "G_ArwL_End"},
|
||||
{"it_ObjCubeEdit_a_Lost.brlan", "G_ArwR_End"},
|
||||
{"it_ObjCubeEdit_a_Lost.brlan", "G_ArwL_End"},
|
||||
{"it_ObjCubeEdit_a_ErrorTxtIn.brlan", "G_ErrorTxt"},
|
||||
{"it_ObjCubeEdit_a_ErrorTxtOut.brlan", "G_ErrorTxt"},
|
||||
};
|
||||
|
||||
struct TextboxMessage {
|
||||
const char* paneName;
|
||||
u32 messageId;
|
||||
};
|
||||
|
||||
static const TextboxMessage scTextboxToMessageID[] = {
|
||||
{"T_SelectWii_00", 0x13F},
|
||||
{"T_SelectWii_01", 0x13F},
|
||||
{"T_SelectSd_00", 0x140},
|
||||
{"T_SelectSd_01", 0x140},
|
||||
{"T_Error_00", 0xE6},
|
||||
};
|
||||
|
||||
static const char* scTriggerPaneName[] = {
|
||||
"B_ArwR", "B_ArwL", "B_SelectWii_00", "B_SelectSd_00",
|
||||
};
|
||||
|
||||
MemoryCard::MemoryCard(EGG::Heap* heap)
|
||||
: Base(heap), MemoryBase(), mState(2), mPrevState(2), mSlot(0), mIconIndex(-15), mIconCount(0),
|
||||
mShowArwR(0), mShowArwL(0), mpEvent(NULL), mpFocusSaveData(NULL) {
|
||||
System::getMem2App()->dump();
|
||||
nw4r::ut::List_Init(&mSaveDataList, offsetof(GCSaveData, mLink));
|
||||
nw4r::ut::List_Init(&mBalloonList, 0);
|
||||
}
|
||||
|
||||
MemoryBase::~MemoryBase() {}
|
||||
|
||||
void MemoryCard::prepare() {
|
||||
System::getBS2Manager()->abort();
|
||||
unk_0x08 = System::getNandManager()->readLayoutAsync(getSceneHeap(), "gcMem.ash");
|
||||
mBalloonLayoutFile = System::getNandManager()->readLayoutAsync(getSceneHeap(), "balloon.ash");
|
||||
}
|
||||
|
||||
void MemoryCard::create() {
|
||||
u32 start = OSGetTick();
|
||||
while (System::getBS2Manager()->getIPLState() != 8) {
|
||||
System::getBS2Manager()->update();
|
||||
OSReport(" ... wait for bs2 abord\n");
|
||||
VIWaitForRetrace();
|
||||
}
|
||||
u32 end = OSGetTick();
|
||||
OSReport("*** BS2 abort costs: %dms\n", OSTicksToMilliseconds(end - start));
|
||||
ES_SetUid((u64(1) << 32) | 2);
|
||||
|
||||
mpLayout = new layout::Object(getSceneHeap(), unk_0x08, "arc", "it_ObjCubeEdit_a.brlyt");
|
||||
add_animation(scAnmName, 0x1B);
|
||||
get_animation(7)->mAnim->setAnmType(1);
|
||||
get_animation(10)->mAnim->setAnmType(1);
|
||||
mpLayout->finishBinding();
|
||||
do_animation(0);
|
||||
do_animation(1);
|
||||
do_animation(0x14);
|
||||
do_animation(0x17);
|
||||
do_animation(0x18);
|
||||
mPrevState = mState;
|
||||
mState = 0;
|
||||
mpLayout->FindPaneByName("N_ArwR")->SetVisible(false);
|
||||
mpLayout->FindPaneByName("N_ArwL")->SetVisible(false);
|
||||
|
||||
mpEvent = new MemoryBaseEvent(this);
|
||||
mpPaneManager = new gui::PaneManager(mpEvent, mpLayout->getDrawInfo(), NULL, NULL, true);
|
||||
mpPaneManager->setupScene(mpLayout);
|
||||
mpPaneManager->setAllComponentTriggerTarget(false);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
nw4r::lyt::Pane* pane = mpLayout->FindPaneByName(scTriggerPaneName[i]);
|
||||
mpPaneManager->setTriggerTarget(pane, true);
|
||||
}
|
||||
|
||||
add_anmbutton(scTriggerPaneName[2], get_animation(6), get_animation(7), get_animation(8));
|
||||
add_anmbutton(scTriggerPaneName[3], get_animation(9), get_animation(10), get_animation(11));
|
||||
add_anmbutton(scTriggerPaneName[0], get_animation(16), get_animation(18), get_animation(12));
|
||||
add_anmbutton(scTriggerPaneName[1], get_animation(17), get_animation(19), get_animation(13));
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
set_textbox(scTextboxToMessageID[i].paneName, scTextboxToMessageID[i].messageId);
|
||||
}
|
||||
|
||||
mpGCWindow = new GCWindow(getSceneHeap(), unk_0x08, "arc", "it_CubeDetail_a.brlyt");
|
||||
mpGCWindow->do_animation(0);
|
||||
|
||||
MemoryCardManager* manager = new MemoryCardManager();
|
||||
mpManager = manager;
|
||||
mpManager->setEventHandler(mpGCWindow);
|
||||
mpGCWindow->mpMemoryCardManager = mpManager;
|
||||
|
||||
for (int i = 0; i < 0x2D; i++) {
|
||||
nw4r::lyt::Pane* pane = mpLayout->FindPaneByName(scSavedataPaneName[i]);
|
||||
nw4r::math::VEC3 position(0.0f, 0.0f, 0.0f);
|
||||
PSMTXMultVec(pane->GetGlobalMtx(), reinterpret_cast<const Vec*>(&position), reinterpret_cast<Vec*>(&position));
|
||||
GCSaveData* saveData =
|
||||
new GCSaveData(getSceneHeap(), unk_0x08, "arc", "it_ObjCubeEdit_b.brlyt", position);
|
||||
saveData->set_visible("N_Data_00", false);
|
||||
nw4r::ut::List_Append(&mSaveDataList, saveData);
|
||||
if (i >= 0xF && i < 0x1E) {
|
||||
position.y -= 55.0f;
|
||||
TextBalloon* balloon =
|
||||
new TextBalloon(getSceneHeap(), mBalloonLayoutFile, "arc", "my_IplTopBalloon_a.brlyt",
|
||||
math::VEC3(position), 90.0f, 60.0f);
|
||||
nw4r::ut::List_Append(&mBalloonList, balloon);
|
||||
saveData->setBalloon(balloon);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mSlotState[i] = 0;
|
||||
}
|
||||
set_visible("N_Capa_00", false);
|
||||
set_visible("T_Error_00", false);
|
||||
}
|
||||
|
||||
void MemoryCard::calc() {
|
||||
mpManager->calc();
|
||||
if (is_fadein_enable()) {
|
||||
mpLayout->calc();
|
||||
mpPaneManager->calc();
|
||||
s16 index = mIconIndex;
|
||||
mIconCount = 0;
|
||||
GCSaveData* saveData = NULL;
|
||||
while ((saveData = static_cast<GCSaveData*>(nw4r::ut::List_GetNext(&mSaveDataList, saveData))) != NULL) {
|
||||
if (mpManager->isIconValidate(mSlot, index) || index < 0) {
|
||||
mIconCount++;
|
||||
}
|
||||
saveData->mSlot = mSlot;
|
||||
saveData->mIndex = index;
|
||||
saveData->calc();
|
||||
index++;
|
||||
}
|
||||
MemoryBase::AnmButton* button = NULL;
|
||||
while ((button = static_cast<MemoryBase::AnmButton*>(nw4r::ut::List_GetNext(&mAnmButtonList, button))) != NULL) {
|
||||
button->calc();
|
||||
}
|
||||
TextBalloon* balloon = NULL;
|
||||
while ((balloon = static_cast<TextBalloon*>(nw4r::ut::List_GetNext(&mBalloonList, balloon))) != NULL) {
|
||||
balloon->calc();
|
||||
}
|
||||
switch (mState) {
|
||||
case 0:
|
||||
on_fadein1st();
|
||||
break;
|
||||
case 1:
|
||||
on_fadein2nd();
|
||||
break;
|
||||
case 2:
|
||||
on_normal();
|
||||
break;
|
||||
case 3:
|
||||
on_scroll_r();
|
||||
break;
|
||||
case 4:
|
||||
on_scroll_l();
|
||||
break;
|
||||
case 5:
|
||||
on_change_tag1st();
|
||||
break;
|
||||
case 6:
|
||||
on_change_tag2nd();
|
||||
break;
|
||||
case 7:
|
||||
on_fadeout1st();
|
||||
break;
|
||||
case 8:
|
||||
on_fadeout2nd();
|
||||
break;
|
||||
case 9:
|
||||
mpGCWindow->calc();
|
||||
show_capacity(mSlot);
|
||||
break;
|
||||
case 10:
|
||||
on_error();
|
||||
break;
|
||||
case 11:
|
||||
on_insert_card();
|
||||
break;
|
||||
case 12:
|
||||
on_detach_card();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::on_fadein1st() {
|
||||
if (!is_animation(1)) {
|
||||
do_animation(5);
|
||||
mpLayout->FindPaneByName("N_ArwR")->SetVisible(true);
|
||||
mpLayout->FindPaneByName("N_ArwL")->SetVisible(true);
|
||||
if (mpManager->isSlotReady(mSlot)) {
|
||||
mSlotState[mSlot] = 1;
|
||||
start_savedata_fadein();
|
||||
mPrevState = mState;
|
||||
mState = 1;
|
||||
} else {
|
||||
start_errormessage_fadein();
|
||||
mPrevState = mState;
|
||||
mState = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::on_fadein2nd() {
|
||||
GCSaveData* saveData = static_cast<GCSaveData*>(nw4r::ut::List_GetNext(&mSaveDataList, NULL));
|
||||
if (!is_animation(5) && !saveData->is_animation(0)) {
|
||||
mPrevState = mState;
|
||||
mState = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::on_normal() {
|
||||
if (get_setting_button()->update()) {
|
||||
if (mPrevState == 10) {
|
||||
do_animation(0x1A);
|
||||
}
|
||||
mPrevState = mState;
|
||||
mState = 7;
|
||||
return;
|
||||
}
|
||||
show_arw();
|
||||
show_capacity(mSlot);
|
||||
if (!update_slot()) {
|
||||
mpPaneManager->update();
|
||||
GCSaveData* saveData = NULL;
|
||||
while ((saveData = static_cast<GCSaveData*>(nw4r::ut::List_GetNext(&mSaveDataList, saveData))) != NULL) {
|
||||
saveData->update();
|
||||
}
|
||||
mpGCWindow->calc();
|
||||
if (mIconCount <= 15) {
|
||||
bool canScroll = false;
|
||||
if (mIconIndex >= 0 && mState == 2) {
|
||||
canScroll = true;
|
||||
}
|
||||
if (canScroll) {
|
||||
start_scroll_l();
|
||||
return;
|
||||
}
|
||||
}
|
||||
controller::Interface* controller = System::getYoungController();
|
||||
if (controller != NULL) {
|
||||
if (controller->down(0x30001000)) {
|
||||
start_scroll_l();
|
||||
} else if (controller->down(0x06000010)) {
|
||||
start_scroll_r();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::on_scroll_r() {
|
||||
if (!is_animation(0xC)) {
|
||||
get_animation(0xC)->mAnim->initAnmFrame();
|
||||
mpLayout->calc();
|
||||
mState = 2;
|
||||
mIconIndex += 0xF;
|
||||
}
|
||||
scroll_common();
|
||||
}
|
||||
|
||||
void MemoryCard::on_scroll_l() {
|
||||
if (!is_animation(0xD)) {
|
||||
get_animation(0xC)->mAnim->initAnmFrame();
|
||||
mpLayout->calc();
|
||||
mState = 2;
|
||||
mIconIndex -= 0xF;
|
||||
}
|
||||
scroll_common();
|
||||
}
|
||||
|
||||
void MemoryCard::on_change_tag1st() {
|
||||
GCSaveData* first = static_cast<GCSaveData*>(nw4r::ut::List_GetNext(&mSaveDataList, NULL));
|
||||
if (!first->is_animation(1)) {
|
||||
GCSaveData* saveData = NULL;
|
||||
while ((saveData = static_cast<GCSaveData*>(nw4r::ut::List_GetNext(&mSaveDataList, saveData))) != NULL) {
|
||||
saveData->set_visible("N_Data_00", false);
|
||||
}
|
||||
mSlot ^= 1;
|
||||
mSlotState[mSlot] = 0;
|
||||
mIconIndex = -15;
|
||||
mPrevState = mState;
|
||||
mState = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::on_change_tag2nd() {
|
||||
GCSaveData* saveData = NULL;
|
||||
while ((saveData = static_cast<GCSaveData*>(nw4r::ut::List_GetNext(&mSaveDataList, saveData))) != NULL) {
|
||||
if (!saveData->is_animation(0)) {
|
||||
mState = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::on_fadeout1st() {
|
||||
if (!get_setting_button()->isPlaying()) {
|
||||
do_animation(4);
|
||||
GCSaveData* saveData = NULL;
|
||||
while ((saveData = static_cast<GCSaveData*>(nw4r::ut::List_GetNext(&mSaveDataList, saveData))) != NULL) {
|
||||
saveData->do_animation(1);
|
||||
}
|
||||
mState = 8;
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::on_fadeout2nd() {
|
||||
if (!is_animation(4)) {
|
||||
bool shutdown = memorycard::shutdownCardThread();
|
||||
if (shutdown) {
|
||||
requestSceneDestruction();
|
||||
System::getBS2Manager()->restart();
|
||||
OSReport(" ... bs2 manager restarted\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::on_error() {
|
||||
if (!is_animation(0x19)) {
|
||||
mPrevState = mState;
|
||||
mState = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::on_insert_card() {
|
||||
if (!is_animation(0x1A)) {
|
||||
start_savedata_fadein();
|
||||
mPrevState = mState;
|
||||
mState = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::on_detach_card() {
|
||||
GCSaveData* first = static_cast<GCSaveData*>(nw4r::ut::List_GetNext(&mSaveDataList, NULL));
|
||||
if (!first->is_animation(1)) {
|
||||
start_errormessage_fadein();
|
||||
mPrevState = mState;
|
||||
mState = 10;
|
||||
GCSaveData* saveData = NULL;
|
||||
while ((saveData = static_cast<GCSaveData*>(nw4r::ut::List_GetNext(&mSaveDataList, saveData))) != NULL) {
|
||||
saveData->set_visible("N_Data_00", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::start_savedata_fadein() {
|
||||
GCSaveData* saveData = NULL;
|
||||
while ((saveData = static_cast<GCSaveData*>(nw4r::ut::List_GetNext(&mSaveDataList, saveData))) != NULL) {
|
||||
saveData->set_visible("N_Data_00", true);
|
||||
saveData->do_animation(0);
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::start_savedata_fadeout() {
|
||||
GCSaveData* saveData = NULL;
|
||||
while ((saveData = static_cast<GCSaveData*>(nw4r::ut::List_GetNext(&mSaveDataList, saveData))) != NULL) {
|
||||
saveData->do_animation(1);
|
||||
}
|
||||
set_visible("N_Capa_00", false);
|
||||
}
|
||||
|
||||
void MemoryCard::start_errormessage_fadein() {
|
||||
if (mpManager->isSlotWrongDevice(mSlot) != 0) {
|
||||
mSlotState[mSlot] = 3;
|
||||
set_textbox("T_Error_00", mSlot == 0 ? 0xE8 : 0xE9);
|
||||
} else {
|
||||
mSlotState[mSlot] = 2;
|
||||
set_textbox("T_Error_00", mSlot == 0 ? 0xE6 : 0xE7);
|
||||
}
|
||||
set_visible("T_Error_00", true);
|
||||
do_animation(0x19);
|
||||
}
|
||||
|
||||
int MemoryCard::update_slot() {
|
||||
if (mSlotState[mSlot] != 1 && mpManager->isSlotReady(mSlot) != 0) {
|
||||
for (u16 i = 0xF; i < 0x1E; i++) {
|
||||
static_cast<GCSaveData*>(nw4r::ut::List_GetNth(&mSaveDataList, i))->init();
|
||||
}
|
||||
mSlotState[mSlot] = 1;
|
||||
if (mPrevState == 10) {
|
||||
do_animation(0x1A);
|
||||
}
|
||||
mPrevState = mState;
|
||||
mState = 0xB;
|
||||
return true;
|
||||
}
|
||||
if (mSlotState[mSlot] != 2 && mpManager->isSlotNoCard(mSlot) != 0) {
|
||||
for (u16 i = 0xF; i < 0x1E; i++) {
|
||||
static_cast<GCSaveData*>(nw4r::ut::List_GetNth(&mSaveDataList, i))->init();
|
||||
}
|
||||
mSlotState[mSlot] = 2;
|
||||
mIconIndex = -15;
|
||||
start_savedata_fadeout();
|
||||
mPrevState = mState;
|
||||
mState = 0xC;
|
||||
return true;
|
||||
}
|
||||
if ((mSlotState[mSlot] != 3 && mpManager->isSlotWrongDevice(mSlot) != 0) || mSlotState[mSlot] == 0) {
|
||||
for (u16 i = 0xF; i < 0x1E; i++) {
|
||||
static_cast<GCSaveData*>(nw4r::ut::List_GetNth(&mSaveDataList, i))->init();
|
||||
}
|
||||
mSlotState[mSlot] = 3;
|
||||
start_savedata_fadeout();
|
||||
mPrevState = mState;
|
||||
mState = 0xC;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void MemoryCard::show_arw() {
|
||||
if (mShowArwR == 0 && can_scroll_r()) {
|
||||
do_animation(0x15);
|
||||
do_animation(0x12);
|
||||
mShowArwR = 1;
|
||||
} else if (mShowArwR != 0 && !can_scroll_r()) {
|
||||
do_animation(0x17);
|
||||
mShowArwR = 0;
|
||||
}
|
||||
if (mShowArwL == 0 && can_scroll_l()) {
|
||||
do_animation(0x16);
|
||||
do_animation(0x13);
|
||||
mShowArwL = 1;
|
||||
} else if (mShowArwL != 0 && !can_scroll_l()) {
|
||||
do_animation(0x18);
|
||||
mShowArwL = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::show_capacity(u8 slot) {
|
||||
if (!mpManager->isSlotReady(slot)) {
|
||||
set_visible("N_Capa_00", false);
|
||||
return;
|
||||
}
|
||||
u32 freeBlocks = mpManager->getFreeBlocks(slot);
|
||||
wchar_t digits[5];
|
||||
wchar_t digitTable[10] = {L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7', L'8', L'9'};
|
||||
digits[0] = L'\0';
|
||||
digits[1] = L'\0';
|
||||
digits[2] = L'\0';
|
||||
digits[3] = L'\0';
|
||||
digits[4] = L'\0';
|
||||
wchar_t text[0x40] = L"";
|
||||
int blocks = static_cast<u16>(freeBlocks);
|
||||
digits[0] = digitTable[blocks / 1000];
|
||||
digits[1] = digitTable[blocks / 100 % 10];
|
||||
digits[2] = digitTable[blocks / 10 % 10];
|
||||
digits[3] = digitTable[blocks % 10];
|
||||
|
||||
int zeroOffset;
|
||||
for (zeroOffset = 0; zeroOffset < 3; zeroOffset++) {
|
||||
if (digits[zeroOffset] != L'0') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int blockOpenOffset = 0;
|
||||
const wchar_t* blockOpenMessage = System::getMessage(0x9C);
|
||||
const wchar_t* blankMessage = System::getMessage(0xF2);
|
||||
|
||||
while (true) {
|
||||
wchar_t chr = *blockOpenMessage++;
|
||||
text[blockOpenOffset++] = chr;
|
||||
if (chr == L'\0') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
text[--blockOpenOffset] = L' ';
|
||||
wcscpy(text + blockOpenOffset, digits + zeroOffset);
|
||||
wcscat(text, blankMessage);
|
||||
|
||||
set_textbox("T_Capa_00", text);
|
||||
set_visible("N_Capa_00", true);
|
||||
}
|
||||
|
||||
void MemoryCard::scroll_common() {
|
||||
for (u16 i = 0; i < 0x2D; i++) {
|
||||
nw4r::lyt::Pane* pane = mpLayout->FindPaneByName(scSavedataPaneName[i]);
|
||||
GCSaveData* saveData = static_cast<GCSaveData*>(nw4r::ut::List_GetNth(&mSaveDataList, i));
|
||||
nw4r::math::VEC3 position(0.0f, 0.0f, 0.0f);
|
||||
PSMTXMultVec(pane->GetGlobalMtx(), reinterpret_cast<const Vec*>(&position), reinterpret_cast<Vec*>(&position));
|
||||
saveData->setTranslate(position);
|
||||
saveData->init();
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::start_scroll_r() {
|
||||
bool canScroll = false;
|
||||
if (mIconCount > 0x1E && mState == 2) {
|
||||
canScroll = true;
|
||||
}
|
||||
if (canScroll) {
|
||||
do_animation(0xC);
|
||||
mState = 3;
|
||||
snd::getSystem()->startSE("WSD_SELECT");
|
||||
GCSaveData* saveData = NULL;
|
||||
while ((saveData = static_cast<GCSaveData*>(nw4r::ut::List_GetNext(&mSaveDataList, saveData))) != NULL) {
|
||||
saveData->init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::start_scroll_l() {
|
||||
bool canScroll = false;
|
||||
if (mIconIndex >= 0 && mState == 2) {
|
||||
canScroll = true;
|
||||
}
|
||||
if (canScroll) {
|
||||
do_animation(0xD);
|
||||
mState = 4;
|
||||
snd::getSystem()->startSE("WSD_SELECT");
|
||||
GCSaveData* saveData = NULL;
|
||||
while ((saveData = static_cast<GCSaveData*>(nw4r::ut::List_GetNext(&mSaveDataList, saveData))) != NULL) {
|
||||
saveData->init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::draw() {
|
||||
if (System::onDefaultDrawLayer()) {
|
||||
utility::Graphics::setOrtho(0);
|
||||
mpLayout->draw();
|
||||
GCSaveData* saveData = NULL;
|
||||
while ((saveData = static_cast<GCSaveData*>(nw4r::ut::List_GetNext(&mSaveDataList, saveData))) != NULL) {
|
||||
saveData->draw();
|
||||
}
|
||||
mpLayout->draw("N_ArwR");
|
||||
mpLayout->draw("N_ArwL");
|
||||
if (mpFocusSaveData != NULL) {
|
||||
mpGCWindow->draw();
|
||||
}
|
||||
if (mState == 2) {
|
||||
TextBalloon* balloon = NULL;
|
||||
while ((balloon = static_cast<TextBalloon*>(nw4r::ut::List_GetNext(&mBalloonList, balloon))) != NULL) {
|
||||
balloon->draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::onPoint(const char* paneName, controller::Interface* controller) {
|
||||
MemoryBase::AnmButton* button = get_anmbutton(paneName);
|
||||
if (button != NULL) {
|
||||
if (button->unk_0x04 == 0 &&
|
||||
(strcmp(paneName, scTriggerPaneName[2]) != 0 || mSlot != 0) &&
|
||||
(strcmp(paneName, scTriggerPaneName[3]) != 0 || mSlot != 1)) {
|
||||
button->onCmdRecv(1);
|
||||
snd::getSystem()->startSE("WIPL_SE_BT_TARGETTING");
|
||||
if (controller != NULL) {
|
||||
controller->rumble(0);
|
||||
}
|
||||
}
|
||||
button->unk_0x04++;
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::onLeft(const char* paneName) {
|
||||
MemoryBase::AnmButton* button = get_anmbutton(paneName);
|
||||
if (button != NULL) {
|
||||
if (button->unk_0x04 == 1 &&
|
||||
(strcmp(paneName, scTriggerPaneName[2]) != 0 || mSlot != 0) &&
|
||||
(strcmp(paneName, scTriggerPaneName[3]) != 0 || mSlot != 1)) {
|
||||
button->onCmdRecv(2);
|
||||
}
|
||||
button->unk_0x04--;
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::onTrig(const char* paneName) {
|
||||
if (mpFocusSaveData == NULL && get_anmbutton(paneName) != NULL) {
|
||||
if (strcmp(paneName, scTriggerPaneName[0]) == 0) {
|
||||
do_animation(0xE);
|
||||
start_scroll_r();
|
||||
} else if (strcmp(paneName, scTriggerPaneName[1]) == 0) {
|
||||
do_animation(0xF);
|
||||
start_scroll_l();
|
||||
} else if (strcmp(paneName, scTriggerPaneName[2]) == 0) {
|
||||
if (mSlot == 1) {
|
||||
do_animation(0xB);
|
||||
GCSaveData* saveData = NULL;
|
||||
while ((saveData = static_cast<GCSaveData*>(nw4r::ut::List_GetNext(&mSaveDataList, saveData))) != NULL) {
|
||||
saveData->do_animation(1);
|
||||
}
|
||||
if (mPrevState == 10) {
|
||||
do_animation(0x1A);
|
||||
}
|
||||
snd::getSystem()->startSE("WIPL_SE_BT_PUSH");
|
||||
mState = 5;
|
||||
}
|
||||
} else if (strcmp(paneName, scTriggerPaneName[3]) == 0) {
|
||||
if (mSlot == 0) {
|
||||
do_animation(8);
|
||||
GCSaveData* saveData = NULL;
|
||||
while ((saveData = static_cast<GCSaveData*>(nw4r::ut::List_GetNext(&mSaveDataList, saveData))) != NULL) {
|
||||
saveData->do_animation(1);
|
||||
}
|
||||
if (mPrevState == 10) {
|
||||
do_animation(0x1A);
|
||||
}
|
||||
snd::getSystem()->startSE("WIPL_SE_BT_PUSH");
|
||||
mState = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::onFocus(void* data) {
|
||||
if (mState == 2) {
|
||||
if (data != NULL) {
|
||||
snd::getSystem()->startSE("WIPL_SE_DECIDE");
|
||||
GCSaveData* saveData = static_cast<GCSaveData*>(data);
|
||||
mpFocusSaveData = saveData;
|
||||
mpGCWindow->init(math::VEC3(*saveData->getTranslate()), mpManager,
|
||||
saveData->mSlot,
|
||||
saveData->mIndex);
|
||||
change_button_text_close();
|
||||
}
|
||||
mState = 9;
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCard::onRelease() {
|
||||
if (mpFocusSaveData != NULL) {
|
||||
TextBalloon* balloon = mpFocusSaveData->mpBalloon;
|
||||
if (balloon != NULL) {
|
||||
balloon->terminate();
|
||||
}
|
||||
}
|
||||
mpFocusSaveData = NULL;
|
||||
mState = 2;
|
||||
}
|
||||
|
||||
BOOL MemoryCard::isResetAcceptable() const {
|
||||
return !mpGCWindow->isProcess();
|
||||
}
|
||||
|
||||
void MemoryBase::onMove(const char*) {}
|
||||
|
||||
MemoryCardManager::~MemoryCardManager() {}
|
||||
|
||||
MemoryCard::~MemoryCard() {}
|
||||
|
||||
}
|
||||
}
|
||||
804
src/scene/sdChannelSelect/iplSDChannelObj.cpp
Normal file
804
src/scene/sdChannelSelect/iplSDChannelObj.cpp
Normal file
@@ -0,0 +1,804 @@
|
||||
#define IPL_SD_CHANNEL_OBJ_CPP
|
||||
#include "scene/sdChannelSelect/iplSDChannelSelect.h"
|
||||
|
||||
#include "iplSound.h"
|
||||
#include "iplSystem.h"
|
||||
#include <private/es.h>
|
||||
#include <revolution/sc.h>
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
static const wchar_t scUnknownName[] = L"???";
|
||||
static const char* scCursur = "Cursur_a";
|
||||
static const char* scCursorAnims[] = {
|
||||
"my_IplTop_d_FocusOff.brlan",
|
||||
"my_IplTop_d_FocusOn.brlan",
|
||||
"my_IplTop_d_Select.brlan",
|
||||
};
|
||||
static const char* scBalloon = "T_Balloon";
|
||||
static const char* scBase = "W_Base";
|
||||
static const char* scShade = "W_Shade";
|
||||
static const char* scLangGroups[] = {"JPN", "ENG", "GER", "FRA", "SPA", "ITA", "NED", "CHN", "ENG", "KOR"};
|
||||
static const char* scRegionGroups[SC_PRODUCT_AREA_MAX][16] = {
|
||||
{"JPN"},
|
||||
{"ENG", "FRA", "SPA"},
|
||||
{"ENG", "FRA", "GER", "SPA", "ITA", "NED"},
|
||||
{NULL},
|
||||
{NULL},
|
||||
{NULL},
|
||||
{"KOR"},
|
||||
{NULL},
|
||||
{NULL},
|
||||
{NULL},
|
||||
{NULL},
|
||||
{"CHN"},
|
||||
};
|
||||
static const u32 scLangLookup[SC_PRODUCT_AREA_MAX][16] = {
|
||||
{SC_LANG_JAPANESE, -1},
|
||||
{SC_LANG_ENGLISH, SC_LANG_FRENCH, SC_LANG_SPANISH, -1},
|
||||
{SC_LANG_ENGLISH, SC_LANG_FRENCH, SC_LANG_GERMAN, SC_LANG_SPANISH, SC_LANG_ITALIAN, SC_LANG_DUTCH, -1},
|
||||
{-1},
|
||||
{-1},
|
||||
{-1},
|
||||
{SC_LANG_KOREAN, -1},
|
||||
{-1},
|
||||
{-1},
|
||||
{-1},
|
||||
{-1},
|
||||
{SC_PRODUCT_AREA_HKG, -1},
|
||||
};
|
||||
|
||||
static const f32 scThumbnailOffsets[][2] = {{64.0f, 48.0f}, {85.0f, 48.0f}};
|
||||
extern "C" void iplSDChannelObj_813E3104(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E311C(SDChannelObj* channel, EGG::ExpHeap* firstHeap,
|
||||
EGG::ExpHeap* secondHeap) NO_INLINE;
|
||||
extern "C" void* iplSDChannelObj_813E3128(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E3178(SDChannelObj* channel, nw4r::lyt::Pane* pane) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E3180(SDChannelObj* channel, nand::LayoutFile* layoutFile) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E322C(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E32C8(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E3304(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E330C(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" bool iplSDChannelObj_813E3330(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E3354(SDChannelObj* channel, int request) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E33EC(SDChannelObj* channel, int request) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E3480(SDChannelObj* channel, bool request) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E34E0(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E34E8(SDChannelObj* channel, int request) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E3534(SDChannelObj* channel, bool request) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E3580(const layout::Object* layout) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E3858(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" f32 iplSDChannelObj_813E3920(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" f32 iplSDChannelObj_813E3A84(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E3B1C(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E3BA0(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E3C58(SDChannelObj* channel, const nw4r::math::VEC3& vec) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E3C9C(SDChannelObj* channel, int request) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E3E38(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E3F28(SDChannelObj* channel, int request) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E3F74(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" const wchar_t* iplSDChannelObj_813E4060(SDChannelObj* channel, int index) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E413C(SDChannelObj* channel, const wchar_t* text) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E4410(SDChannelObj* channel, const nw4r::math::VEC3& vec) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E4558(SDChannelObj* channel, int request) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E4704(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E481C(SDChannelObj* channel, layout::Object* layout) NO_INLINE;
|
||||
extern "C" void iplSDChannelObj_813E49A8(SDChannelObj* channel) NO_INLINE;
|
||||
extern "C" BOOL iplSDChannelObj_813E4A54(SDChannelObj* channel) NO_INLINE;
|
||||
|
||||
SDChannelObj::SDChannelObj(EGG::Heap* heap, int page, int index)
|
||||
: mpHeap(heap), mpDialogHeap(NULL), mpChannelHeap(NULL), mState(0), mPage(page), mIndex(index),
|
||||
mpPane(NULL), mpBaseLayout(NULL), mpPageLayout(NULL), mPageAnimation(0), mPageAnimationFrame(0),
|
||||
mpDialogLayout(NULL), mDialogState(0), mDialogFrame(0), mDialogTimer(0), mAnimationState(0),
|
||||
mpNewMessageGroup(NULL), mpNewMessageAnimator(NULL), mbNewMessageGroupActive(false), mNewMessageState(0),
|
||||
mNewMessageFrame(0), mOffsetX(scThumbnailOffsets[SCGetAspectRatio()][0]),
|
||||
mOffsetY(scThumbnailOffsets[SCGetAspectRatio()][1]), mStateFlags(1), mpThumbnailData(NULL) {
|
||||
if (SCGetAspectRatio() == SC_ASPECT_RATIO_16x9) {
|
||||
nw4r::ut::Rect projection4x3;
|
||||
System::getProjectionRect4x3(&projection4x3);
|
||||
nw4r::ut::Rect projection16x9;
|
||||
System::getProjectionRect16x9(&projection16x9);
|
||||
mAspectRatioScale = projection16x9.GetWidth() / projection4x3.GetWidth();
|
||||
} else {
|
||||
mAspectRatioScale = 1.0f;
|
||||
}
|
||||
memset(&mAppMeta, 0, sizeof(mAppMeta));
|
||||
}
|
||||
SDChannelObj::~SDChannelObj() {
|
||||
if (mpBaseLayout != NULL)
|
||||
mpBaseLayout->destroyHeap();
|
||||
if (mpPageLayout != NULL)
|
||||
delete mpPageLayout;
|
||||
if (mpDialogLayout != NULL)
|
||||
delete mpDialogLayout;
|
||||
}
|
||||
extern "C" void iplSDChannelObj_813E3104(SDChannelObj* channel) {
|
||||
if (channel->mState == 0)
|
||||
channel->mState = 2;
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E311C(SDChannelObj* channel, EGG::ExpHeap* firstHeap,
|
||||
EGG::ExpHeap* secondHeap) {
|
||||
channel->mpDialogHeap = firstHeap;
|
||||
channel->mpChannelHeap = secondHeap;
|
||||
}
|
||||
|
||||
extern "C" void* iplSDChannelObj_813E3128(SDChannelObj* channel) {
|
||||
if (channel->mpThumbnailData == NULL)
|
||||
channel->mpThumbnailData = new (channel->mpHeap, 32) u8[0x19000];
|
||||
return channel->mpThumbnailData;
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E3178(SDChannelObj* channel, nw4r::lyt::Pane* pane) {
|
||||
channel->mpPane = pane;
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E3180(SDChannelObj* channel, nand::LayoutFile* layoutFile) {
|
||||
if (!SDChannelSelect::isChannelReady(channel)) {
|
||||
channel->mpLayoutFile = layoutFile;
|
||||
if (channel->mpPageLayout == NULL)
|
||||
iplSDChannelObj_813E3BA0(channel);
|
||||
if (channel->mpDialogLayout == NULL)
|
||||
iplSDChannelObj_813E3F74(channel);
|
||||
if (channel->mState == 2 || channel->mState == 1 && channel->mpPaneAnimator->isFinished()) {
|
||||
iplSDChannelObj_813E3858(channel);
|
||||
channel->mState = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E322C(SDChannelObj* channel) {
|
||||
switch (channel->mState) {
|
||||
case 0:
|
||||
channel->mState = 2;
|
||||
break;
|
||||
case 1:
|
||||
if (!channel->mpPaneAnimator->isFinished())
|
||||
break;
|
||||
channel->mState = 2;
|
||||
case 2:
|
||||
iplSDChannelObj_813E3858(channel);
|
||||
channel->mState = 3;
|
||||
break;
|
||||
case 3:
|
||||
iplSDChannelObj_813E3B1C(channel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E32C8(SDChannelObj* channel) {
|
||||
if (SDChannelSelect::isChannelReady(channel))
|
||||
channel->mpBaseLayout->draw();
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E3304(SDChannelObj* channel) {
|
||||
channel->mpPageLayout->draw();
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E330C(SDChannelObj* channel) {
|
||||
if (channel->mpDialogLayout != NULL)
|
||||
channel->mpDialogLayout->draw();
|
||||
}
|
||||
|
||||
nw4r::math::VEC3& SDChannelObj::getTranslate() const {
|
||||
return (nw4r::math::VEC3&)mpBaseLayout->GetRootPane()->GetTranslate();
|
||||
}
|
||||
|
||||
extern "C" bool iplSDChannelObj_813E3330(SDChannelObj* channel) {
|
||||
if (channel->mStateFlags == 0 || channel->mStateFlags == 3)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E3354(SDChannelObj* channel, int request) {
|
||||
if (request & 0x10000U) {
|
||||
channel->mAnimationState = 0;
|
||||
} else if (request & 0x20000U) {
|
||||
channel->mAnimationState = 1;
|
||||
} else if ((channel->mAnimationState += 1) > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(request & 1)) {
|
||||
iplSDChannelObj_813E3C9C(channel, 1);
|
||||
}
|
||||
if (!(request & 2)) {
|
||||
iplSDChannelObj_813E4558(channel, 1);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E33EC(SDChannelObj* channel, int request) {
|
||||
if (request & 0x10000U) {
|
||||
channel->mAnimationState = 0;
|
||||
} else if (request & 0x20000U) {
|
||||
channel->mAnimationState = 1;
|
||||
} else if ((channel->mAnimationState -= 1) > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(request & 1)) {
|
||||
iplSDChannelObj_813E3C9C(channel, 3);
|
||||
}
|
||||
if (!(request & 2)) {
|
||||
iplSDChannelObj_813E4558(channel, 4);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E3480(SDChannelObj* channel, bool request) {
|
||||
if (request) {
|
||||
iplSDChannelObj_813E3C9C(channel, 1);
|
||||
channel->mAnimationState = 1;
|
||||
} else {
|
||||
iplSDChannelObj_813E3C9C(channel, 0);
|
||||
channel->mAnimationState = 0;
|
||||
}
|
||||
|
||||
iplSDChannelObj_813E4558(channel, 0);
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E34E0(SDChannelObj* channel) {
|
||||
iplSDChannelObj_813E3C9C(channel, 4);
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E34E8(SDChannelObj* channel, int request) {
|
||||
iplSDChannelObj_813E3C9C(channel, 0);
|
||||
if (request) {
|
||||
channel->mAnimationState = 0;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E3534(SDChannelObj* channel, bool request) {
|
||||
iplSDChannelObj_813E4558(channel, 0);
|
||||
if (request) {
|
||||
channel->mAnimationState = 0;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E3580(const layout::Object* layout) {
|
||||
int lang = System::getLanguage();
|
||||
const char* langGroup = scLangGroups[lang];
|
||||
char availableLanguages[10][4] = {};
|
||||
|
||||
bool languageFound = false;
|
||||
|
||||
for (nw4r::lyt::GroupList::Iterator it = layout->GetGroupList().GetBeginIter();
|
||||
it != layout->GetGroupList().GetEndIter(); it++) {
|
||||
if (strcmp(it->GetName(), langGroup) == 0) {
|
||||
languageFound = true;
|
||||
} else {
|
||||
bool languageGroup = true;
|
||||
for (int i = 0; i < channel::MAX_ANIMS; i++) {
|
||||
char name[8];
|
||||
sprintf(name, "Rso%d", i);
|
||||
if (strncmp(it->GetName(), name, 5) == 0) {
|
||||
languageGroup = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (languageGroup) {
|
||||
for (nw4r::lyt::PaneLinkList::Iterator it2 = it->GetPaneList().GetBeginIter();
|
||||
it2 != it->GetPaneList().GetEndIter(); it2++) {
|
||||
it2->mTarget->SetVisible(false);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (strncmp(it->GetName(), scLangGroups[i], 3) == 0) {
|
||||
memcpy(availableLanguages[i], it->GetName(), 3);
|
||||
availableLanguages[i][3] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (languageFound) {
|
||||
nw4r::lyt::Group* group = layout->FindGroupByName(langGroup);
|
||||
for (nw4r::lyt::PaneLinkList::Iterator it = group->GetPaneList().GetBeginIter();
|
||||
it != group->GetPaneList().GetEndIter(); it++) {
|
||||
it->mTarget->SetVisible(true);
|
||||
}
|
||||
} else {
|
||||
s32 region = System::getRegion();
|
||||
for (int i = 0; i < channel::MAX_ANIMS; i++) {
|
||||
if (scRegionGroups[region][i] != NULL) {
|
||||
if (strcmp(scRegionGroups[region][i], availableLanguages[scLangLookup[region][i]]) == 0) {
|
||||
nw4r::lyt::Group* group = layout->FindGroupByName(scRegionGroups[region][i]);
|
||||
for (nw4r::lyt::PaneLinkList::Iterator it = group->GetPaneList().GetBeginIter();
|
||||
it != group->GetPaneList().GetEndIter(); it++) {
|
||||
it->mTarget->SetVisible(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E3858(SDChannelObj* channel) {
|
||||
bool adjust = false;
|
||||
if (channel->mpDialogLayout == NULL)
|
||||
iplSDChannelObj_813E3F74(channel);
|
||||
f32 frame;
|
||||
if (iplSDChannelObj_813E3330(channel))
|
||||
frame = iplSDChannelObj_813E3920(channel);
|
||||
else {
|
||||
frame = iplSDChannelObj_813E3A84(channel);
|
||||
adjust = true;
|
||||
}
|
||||
iplSDChannelObj_813E3B1C(channel);
|
||||
if (channel->mpBaseAnimator != NULL)
|
||||
channel->mpBaseAnimator->play();
|
||||
channel->mpBaseLayout->finishBinding();
|
||||
if (channel->mpBaseAnimator != NULL)
|
||||
channel->mpBaseAnimator->setCurrentFrame(frame);
|
||||
if (adjust)
|
||||
channel->mpBaseLayout->adjustHeap();
|
||||
}
|
||||
|
||||
extern "C" f32 iplSDChannelObj_813E3920(SDChannelObj* channel) {
|
||||
f32 frame = 0.0f;
|
||||
channel->mpBaseLayout =
|
||||
layout::Object::create(channel->mpHeap, 0x8000, channel->mpThumbnailData, "arc", "icon.brlyt");
|
||||
iplSDChannelObj_813E3580(channel->mpBaseLayout);
|
||||
if (channel->mpBaseLayout->searchFile("icon.brlan"))
|
||||
channel->mpBaseAnimator = channel->mpBaseLayout->bind("icon.brlan");
|
||||
else if (channel->mpBaseLayout->searchFile("icon_Whole.brlan"))
|
||||
channel->mpBaseAnimator = channel->mpBaseLayout->bind("icon_Whole.brlan");
|
||||
else
|
||||
channel->mpBaseAnimator = NULL;
|
||||
if (channel->mpBaseAnimator != NULL) {
|
||||
f32 minimum = channel->mpBaseAnimator->getMinFrame();
|
||||
f32 maximum = channel->mpBaseAnimator->getMaxFrame();
|
||||
frame = minimum + (System::getRndm()->get_u16() % (u16)(maximum - minimum));
|
||||
}
|
||||
if (channel->mStateFlags == 0) {
|
||||
iplSDChannelObj_813E481C(channel, channel->mpBaseLayout);
|
||||
channel->mNewMessageState = 1;
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
|
||||
extern "C" f32 iplSDChannelObj_813E3A84(SDChannelObj* channel) {
|
||||
channel->mpBaseLayout =
|
||||
layout::Object::create(channel->mpHeap, 0x8000, channel->mpLayoutFile, "arc", "mn_SdcardMenu_d.brlyt");
|
||||
channel->mpBaseAnimator = channel->mpBaseLayout->bind("mn_SdcardMenu_d.brlan");
|
||||
return System::getRndm()->get_u16() % 2000;
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E3B1C(SDChannelObj* channel) {
|
||||
iplSDChannelObj_813E49A8(channel);
|
||||
nw4r::math::VEC3 position(0, 0, 0);
|
||||
MTXMultVec(channel->mpPane->GetGlobalMtx(), position, position);
|
||||
channel->mpBaseLayout->GetRootPane()->SetTranslate(position);
|
||||
channel->mpBaseLayout->calc();
|
||||
iplSDChannelObj_813E3C58(channel, position);
|
||||
iplSDChannelObj_813E4410(channel, position);
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E3BA0(SDChannelObj* channel) {
|
||||
channel->mpPageLayout = new (channel->mpDialogHeap, 4)
|
||||
layout::Object(channel->mpDialogHeap, channel->mpLayoutFile, "arc", "my_IplTop_d.brlyt");
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
channel->mpPageAnimators[i] = channel->mpPageLayout->bind(scCursorAnims[i], scCursur, false);
|
||||
}
|
||||
|
||||
iplSDChannelObj_813E3C9C(channel, 0);
|
||||
channel->mpPageLayout->finishBinding();
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E3C58(SDChannelObj* channel, const nw4r::math::VEC3& vec) {
|
||||
channel->mpPageLayout->GetRootPane()->SetTranslate(vec);
|
||||
iplSDChannelObj_813E3E38(channel);
|
||||
channel->mpPageLayout->calc();
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E3C9C(SDChannelObj* channel, int request) {
|
||||
if (request == 0) {
|
||||
channel->mPageAnimation = 0;
|
||||
channel->mPageAnimationFrame = 0;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
channel->mpPageAnimators[i]->initFrame();
|
||||
}
|
||||
|
||||
channel->mpPageLayout->getAnim(1)->initAnmFrame();
|
||||
channel->mpPageLayout->GetRootPane()->SetVisible(false);
|
||||
} else if (request == 4) {
|
||||
channel->mPageAnimation = 4;
|
||||
channel->mPageAnimationFrame = 0;
|
||||
channel->mpPageLayout->GetRootPane()->SetVisible(true);
|
||||
iplSDChannelObj_813E3F28(channel, 2);
|
||||
} else {
|
||||
switch (channel->mPageAnimation) {
|
||||
case 0: {
|
||||
if (request == 1) {
|
||||
channel->mPageAnimation = 1;
|
||||
channel->mpPageLayout->GetRootPane()->SetVisible(true);
|
||||
iplSDChannelObj_813E3F28(channel, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
if (request == 2) {
|
||||
channel->mPageAnimation = 2;
|
||||
} else if (request == 3) {
|
||||
channel->mPageAnimationFrame = 3;
|
||||
} else if (request == 1) {
|
||||
channel->mPageAnimationFrame = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
if (request == 3) {
|
||||
channel->mPageAnimation = 3;
|
||||
iplSDChannelObj_813E3F28(channel, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
if (request == 1) {
|
||||
channel->mPageAnimationFrame = 1;
|
||||
} else if (request == 3) {
|
||||
channel->mPageAnimationFrame = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E3E38(SDChannelObj* channel) {
|
||||
switch (channel->mPageAnimation) {
|
||||
case 1: {
|
||||
if (!channel->mpPageAnimators[1]->isPlaying()) {
|
||||
int prev = channel->mPageAnimationFrame;
|
||||
switch (channel->mPageAnimation) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
channel->mPageAnimation = 2;
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (prev == 3) {
|
||||
iplSDChannelObj_813E3C9C(channel, 3);
|
||||
channel->mPageAnimationFrame = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
if (!channel->mpPageAnimators[0]->isPlaying()) {
|
||||
int prev = channel->mPageAnimationFrame;
|
||||
iplSDChannelObj_813E3C9C(channel, 0);
|
||||
if (prev == 1) {
|
||||
iplSDChannelObj_813E3C9C(channel, 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
if (!channel->mpPageAnimators[2]->isPlaying()) {
|
||||
iplSDChannelObj_813E3C9C(channel, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E3F28(SDChannelObj* channel, int request) {
|
||||
channel->mpPageAnimators[request]->setAnmType(ANIM_TYPE_FORWARD);
|
||||
channel->mpPageAnimators[request]->play();
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E3F74(SDChannelObj* channel) {
|
||||
if (!iplSDChannelObj_813E3330(channel)) {
|
||||
channel->mpDialogLayout = NULL;
|
||||
return;
|
||||
}
|
||||
channel->mpDialogLayout = new (channel->mpChannelHeap, 4)
|
||||
layout::Object(channel->mpChannelHeap, channel->mpLayoutFile, "arc", "my_IplTopBalloon_a.brlyt");
|
||||
if (channel->mStateFlags == 0)
|
||||
iplSDChannelObj_813E413C(channel, iplSDChannelObj_813E4060(channel, 0));
|
||||
else if (channel->mStateFlags == 3)
|
||||
iplSDChannelObj_813E413C(channel, scUnknownName);
|
||||
else
|
||||
iplSDChannelObj_813E413C(channel, L"");
|
||||
channel->mpDialogAnimator = channel->mpDialogLayout->bind("my_IplTopBalloon_a_BalloonInOut.brlan");
|
||||
iplSDChannelObj_813E4558(channel, 0);
|
||||
channel->mpDialogLayout->finishBinding();
|
||||
}
|
||||
|
||||
extern "C" const wchar_t* iplSDChannelObj_813E4060(SDChannelObj* channel, int index) {
|
||||
if (channel->mAppMeta.metaHdr.names[System::getLanguage()][index][0] != 0)
|
||||
return channel->mAppMeta.metaHdr.names[System::getLanguage()][index];
|
||||
const u32* languages = scLangLookup[System::getRegion()];
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
if (channel->mAppMeta.metaHdr.names[languages[i]][index][0] != 0)
|
||||
return channel->mAppMeta.metaHdr.names[languages[i]][index];
|
||||
if (languages[i] == -1)
|
||||
break;
|
||||
}
|
||||
return channel->mAppMeta.metaHdr.names[languages[0]][index];
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E413C(SDChannelObj* channel, const wchar_t* text) {
|
||||
nw4r::lyt::TextBox* textPane =
|
||||
nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(channel->mpDialogLayout->FindPaneByName(scBalloon));
|
||||
|
||||
wchar_t titleText[channel::META_CHANNEL_NAME_LENGTH + 3] = L"";
|
||||
u32 titleLength;
|
||||
|
||||
wcsncpy(titleText, text, channel::META_CHANNEL_NAME_LENGTH);
|
||||
titleLength = wcslen(titleText);
|
||||
|
||||
f32 ellipsisWidth = 0.0f;
|
||||
int ellipsisLength = 0;
|
||||
|
||||
if (titleLength == 0) {
|
||||
textPane->SetString(titleText, 0, 1);
|
||||
} else {
|
||||
for (u32 i = titleLength; i != 0; i--) {
|
||||
textPane->SetString(titleText, 0, i + ellipsisLength);
|
||||
textPane->CalculateMtx(*channel->mpDialogLayout->getDrawInfo());
|
||||
|
||||
nw4r::ut::Rect textRect = textPane->GetTextDrawRect(*channel->mpDialogLayout->getDrawInfo());
|
||||
if (textRect.GetWidth() <= ellipsisWidth + 391.5f) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (System::getRegion() == SC_PRODUCT_AREA_JPN) {
|
||||
titleText[i - 1] = NULL;
|
||||
titleText[i - 2] = L'…';
|
||||
} else {
|
||||
ellipsisWidth = -1.179962f;
|
||||
ellipsisLength = 2;
|
||||
titleText[i + 1] = NULL;
|
||||
titleText[i] = '.';
|
||||
titleText[i - 1] = '.';
|
||||
titleText[i - 2] = '.';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nw4r::ut::Rect textRect = textPane->GetTextDrawRect(*channel->mpDialogLayout->getDrawInfo());
|
||||
|
||||
nw4r::lyt::Size newSize(channel->mpDialogLayout->FindPaneByName(scBase)->GetSize());
|
||||
newSize.width = textRect.right - textRect.left + 40.0f;
|
||||
|
||||
if (newSize.width < channel->mAspectRatioScale * 160.0f) {
|
||||
newSize.width = channel->mAspectRatioScale * 160.0f;
|
||||
}
|
||||
|
||||
channel->mpDialogLayout->FindPaneByName(scShade)->SetSize(newSize);
|
||||
channel->mpDialogLayout->FindPaneByName(scBase)->SetSize(newSize);
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E4410(SDChannelObj* channel, const nw4r::math::VEC3& vec) {
|
||||
if (channel->mpDialogLayout != NULL) {
|
||||
nw4r::lyt::Size size;
|
||||
|
||||
size = channel->mpDialogLayout->FindPaneByName(scBase)->GetSize();
|
||||
|
||||
f32 verticalOffset = -2.0f + ((size.height / 2) + channel->mOffsetY);
|
||||
verticalOffset *= -1.0f;
|
||||
|
||||
nw4r::ut::Rect projRect;
|
||||
System::getProjectionRect(&projRect);
|
||||
|
||||
f32 centerX = vec.x;
|
||||
f32 halfWidth = size.width / 2;
|
||||
f32 horizontalOffset = 0.0f;
|
||||
f32 leftMargin = (centerX - halfWidth) - projRect.left;
|
||||
f32 rightMargin = projRect.right - (centerX + halfWidth);
|
||||
if (leftMargin < 60.0f) {
|
||||
horizontalOffset = 60.0f - leftMargin;
|
||||
} else if (rightMargin < 60.0f) {
|
||||
horizontalOffset = rightMargin - 60.0f;
|
||||
}
|
||||
|
||||
const nw4r::math::VEC3 pos(vec.x + horizontalOffset, vec.y + verticalOffset, 0.0f);
|
||||
channel->mpDialogLayout->GetRootPane()->SetTranslate(pos);
|
||||
|
||||
iplSDChannelObj_813E4704(channel);
|
||||
channel->mpDialogLayout->calc();
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E4558(SDChannelObj* channel, int request) {
|
||||
if (channel->mpDialogLayout != NULL) {
|
||||
if (request == 0) {
|
||||
channel->mDialogState = 0;
|
||||
channel->mDialogFrame = 0;
|
||||
|
||||
channel->mpDialogLayout->setMinFrame(0.0f);
|
||||
channel->mpDialogLayout->GetRootPane()->SetVisible(false);
|
||||
} else {
|
||||
switch (channel->mDialogState) {
|
||||
case 0: {
|
||||
if (request == 1) {
|
||||
channel->mDialogTimer = 0;
|
||||
channel->mDialogState = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
if (request == 2) {
|
||||
channel->mDialogState = 2;
|
||||
channel->mpDialogLayout->GetRootPane()->SetVisible(true);
|
||||
channel->mpDialogLayout->setAnmType(ANIM_TYPE_FORWARD);
|
||||
channel->mpDialogLayout->start();
|
||||
snd::getSystem()->startSE("WIPL_SE_BALLOON");
|
||||
} else if (request == 4) {
|
||||
channel->mDialogState = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
if (request == 3) {
|
||||
channel->mDialogState = 3;
|
||||
} else if (request == 4) {
|
||||
channel->mDialogFrame = 4;
|
||||
} else if (request == 1) {
|
||||
channel->mDialogFrame = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
if (request == 4) {
|
||||
channel->mDialogState = 4;
|
||||
channel->mpDialogLayout->setAnmType(ANIM_TYPE_BACKWARD);
|
||||
channel->mpDialogLayout->start();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
if (request == 1) {
|
||||
channel->mDialogFrame = 1;
|
||||
} else if (request == 4) {
|
||||
channel->mDialogFrame = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E4704(SDChannelObj* channel) {
|
||||
switch (channel->mDialogState) {
|
||||
case 1: {
|
||||
if ((reinterpret_cast<u32&>(channel->mDialogTimer) += 1) >= 20.0f) {
|
||||
iplSDChannelObj_813E4558(channel, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case 3: {
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
if (!channel->mpDialogLayout->isPlaying(0)) {
|
||||
int prev = channel->mDialogFrame;
|
||||
iplSDChannelObj_813E4558(channel, 3);
|
||||
if (prev == 4) {
|
||||
iplSDChannelObj_813E4558(channel, 4);
|
||||
channel->mDialogFrame = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
if (!channel->mpDialogLayout->isPlaying(0)) {
|
||||
int prev = channel->mDialogFrame;
|
||||
iplSDChannelObj_813E4558(channel, 0);
|
||||
if (prev == 1) {
|
||||
iplSDChannelObj_813E4558(channel, 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E481C(SDChannelObj* channel, layout::Object* layout) {
|
||||
char groupName[20];
|
||||
char** lookup;
|
||||
nw4r::lyt::Group* group;
|
||||
|
||||
group = layout->FindGroupByName("New");
|
||||
if (group != NULL) {
|
||||
channel->mpNewMessageGroup = group;
|
||||
} else {
|
||||
sprintf(groupName, "New_%s", scLangGroups[System::getLanguage()]);
|
||||
|
||||
group = layout->FindGroupByName(groupName);
|
||||
if (group != NULL) {
|
||||
channel->mpNewMessageGroup = group;
|
||||
} else {
|
||||
lookup = (char**)scRegionGroups[System::getRegion()];
|
||||
|
||||
for (int i = 0; lookup[i] != NULL; i++) {
|
||||
sprintf(groupName, "New_%s", lookup[i]);
|
||||
|
||||
group = layout->FindGroupByName(groupName);
|
||||
if (group != NULL) {
|
||||
channel->mpNewMessageGroup = group;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (group != NULL) {
|
||||
for (nw4r::lyt::PaneLinkList::Iterator it = group->GetPaneList().GetBeginIter();
|
||||
it != group->GetPaneList().GetEndIter(); it++) {
|
||||
it->mTarget->UnbindAllAnimation();
|
||||
}
|
||||
|
||||
if (layout->searchFile("icon_New.brlan")) {
|
||||
channel->mpNewMessageAnimator = layout->bindToGroup("icon_New.brlan", group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelObj_813E49A8(SDChannelObj* channel) {
|
||||
if (System::getNwc24Manager() != NULL) {
|
||||
switch (channel->mNewMessageState) {
|
||||
case 1: {
|
||||
if (iplSDChannelObj_813E4A54(channel)) {
|
||||
channel->mNewMessageState = 2;
|
||||
channel->mNewMessageFrame = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
if (++reinterpret_cast<u32&>(channel->mNewMessageFrame) >= 4200) {
|
||||
channel->mNewMessageState = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" BOOL iplSDChannelObj_813E4A54(SDChannelObj* channel) {
|
||||
if (System::getNwc24Manager() == NULL || !System::getNwc24Manager()->getNewTitleTbl(NULL)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u32 titleCode = ES_TITLE_CODE(channel->mAppMeta.titleId);
|
||||
if (!System::getNwc24Manager()->isNewMessageThere(titleCode)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!channel->mbNewMessageGroupActive) {
|
||||
if (channel->mpNewMessageGroup != NULL) {
|
||||
for (nw4r::lyt::PaneLinkList::Iterator it =
|
||||
channel->mpNewMessageGroup->GetPaneList().GetBeginIter();
|
||||
it != channel->mpNewMessageGroup->GetPaneList().GetEndIter(); it++) {
|
||||
it->mTarget->SetVisible(true);
|
||||
}
|
||||
|
||||
if (channel->mpNewMessageAnimator != NULL) {
|
||||
channel->mpNewMessageAnimator->play();
|
||||
}
|
||||
}
|
||||
|
||||
channel->mbNewMessageGroupActive = true;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
317
tools/decomp-assist/CHANSVm.attempts.md
Normal file
317
tools/decomp-assist/CHANSVm.attempts.md
Normal file
@@ -0,0 +1,317 @@
|
||||
# CHANSVm continuation attempt log
|
||||
|
||||
The live checkout started at 02e50d2d without the earlier CHANSVm source changes or its attempt log, despite the continuation description. The live gate baseline is used below. No branch, remote or worktree operations were performed.
|
||||
|
||||
## Final full gate
|
||||
|
||||
```text
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[src/channelScript/CHANSVm] pool: IDENTICAL
|
||||
[src/channelScript/CHANSVm] objdiff: code 31960/53564 data 800/6904 functions 205/233 fuzzy 98.3091 linked code 0
|
||||
[src/channelScript/CHANSVm] instruction-exact functions: 204/233
|
||||
[src/channelScript/CHANSVm] section .data size 4672 match 18.050066
|
||||
[src/channelScript/CHANSVm] section .rodata size 1432 match 97.2067
|
||||
[src/channelScript/CHANSVm] section .sbss size 16 match 100.0
|
||||
[src/channelScript/CHANSVm] section .sdata size 600 match 100.0
|
||||
[src/channelScript/CHANSVm] section .sdata2 size 184 match 100.0
|
||||
[src/channelScript/CHANSVm] section .text size 53564 match 98.30909
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmGetSourceLine 97.71739
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmNewObjData 99.375
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmStrCpyToU16FromU8 98.46154
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmParseInt 94.69388
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_8144B4D4 96.92771
|
||||
[src/channelScript/CHANSVm] below 100: VmArraySlice 96.2782
|
||||
[src/channelScript/CHANSVm] below 100: VmDateDtor 94.96703
|
||||
[src/channelScript/CHANSVm] below 100: VmStringFromCharCode 99.40678
|
||||
[src/channelScript/CHANSVm] below 100: VmStringReplace 97.106064
|
||||
[src/channelScript/CHANSVm] below 100: VmStringSplit 96.04955
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_8145049C 98.58237
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_81450D14 97.391304
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCopyRangeFrom 91.67647
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobGetHexString 98.71951
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcRangeSHA1Digest 96.484535
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcRangeMD5Digest 99.793816
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcHMAC 99.453125
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcRangeHMAC 99.72269
|
||||
[src/channelScript/CHANSVm] below 100: vmBlobParsePackFormatString 99.69827
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobPackCommon 92.603294
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobUnpack 92.083176
|
||||
[src/channelScript/CHANSVm] below 100: VmImageCtor 99.0
|
||||
[src/channelScript/CHANSVm] below 100: VmWinEmuWrite 99.62687
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmAddExe 99.1063
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_81455654 94.0
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmLinkModules 98.677246
|
||||
[src/channelScript/CHANSVm] below 100: VmCallMethod 96.565834
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmStep 94.7901
|
||||
[src/channelScript/CHANSVm] baseline: code 30984/53564 data 16 functions 202 fuzzy 98.2665
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 72.11085 -> 72.14343
|
||||
global fuzzy_match_percent: 80.97820 -> 80.97897
|
||||
global complete_code_percent: 56.76068 -> 56.76068
|
||||
global matched_data_percent: 86.15517 -> 86.19795
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
## Before and after
|
||||
|
||||
Instruction-exact functions: 201/233 -> 204/233. Objdiff-matched functions: 202/233 -> 205/233. Code bytes: 30984/53564 -> 31960/53564. Data bytes: 16/6904 -> 800/6904.
|
||||
|
||||
VmArrayExpandCommon: 85/85 instructions, diffs 0. VmDateGetRTC: 38/38 instructions, diffs 0. VmStringSplice: 121/121 instructions, diffs 0. The clock and slice fixes were reverified and reapplied because they were absent from the live checkout.
|
||||
|
||||
CHANSVmStrCpyToU16FromU8 improves from 97.30769% to 98.46154%; it remains non-matching, with three register differences.
|
||||
|
||||
## Data work
|
||||
|
||||
- UTF-16 NaN and comma literals use ordinary escaped string literals with the original single-byte terminator.
|
||||
- The empty string data is a real object header with an empty-string pointer, matching the original relocation at .rodata+0x50.
|
||||
- The fifth constant object has a null pointer, matching the absence of a target relocation at .rodata+0xa0.
|
||||
- The final floating constant keyword is NaN, rather than a duplicate Infinity. Its source position precedes the floating-point format string.
|
||||
- Error success and unknown messages are arrays, matching the original data symbols, rather than pointers.
|
||||
- Shared report and integer format arrays eliminate duplicate pooled literals in the document writer and interpreter.
|
||||
- .sdata, .sdata2 and .sbss score 100% in objdiff. .rodata improves from 85.50279% to 97.2067%. .data improves from 17.614084% to 18.050066%.
|
||||
|
||||
Raw bytes, before applying relocations, are identical for .data, .rodata and .sdata2. The .sdata source bytes match the target prefix; objdiff accepts the target trailing zero alignment and scores it 100%. Raw-byte identity does not establish relocation-exact data. No new labels, forced sections, dummy objects or measurement mappings were introduced.
|
||||
|
||||
## Remaining functions
|
||||
|
||||
CHANSVmGetSourceLine, 97.71739%, register allocation and line-data address operands.
|
||||
CHANSVmNewObjData, 99.375%, register allocation and allocation-failure branch destination.
|
||||
CHANSVmStrCpyToU16FromU8, 98.46154%, three register differences after the decrement-first rewrite.
|
||||
CHANSVmParseInt, 94.69388%, three instruction scheduling differences.
|
||||
CHANSVm_8144B4D4, 96.92771%, register allocation and parse-end initialization scheduling.
|
||||
VmArraySlice, 96.2782%, signed index clipping, branch layout and register allocation.
|
||||
VmDateDtor, 94.96703%, seven argument-load scheduling differences.
|
||||
VmStringFromCharCode, 99.40678%, six register differences.
|
||||
VmStringReplace, 97.106064%, string field-load scheduling and register allocation.
|
||||
VmStringSplit, 96.04955%, register allocation, scheduling and branch operands.
|
||||
CHANSVm_8145049C, 98.58237%, character and string formatting paths, scheduling and register allocation.
|
||||
CHANSVm_81450D14, 97.391304%, one missing instruction and branch layout.
|
||||
VmBlobFill, 100.0%, two raw conditional branch operands differ despite objdiff 100%.
|
||||
VmBlobCopyRangeFrom, 91.67647%, range-check control flow, 139/136 instructions.
|
||||
VmBlobGetHexString, 98.71951%, fourteen register differences.
|
||||
VmBlobCalcRangeSHA1Digest, 96.484535%, range-check scheduling and register allocation.
|
||||
VmBlobCalcRangeMD5Digest, 99.793816%, four register differences.
|
||||
VmBlobCalcHMAC, 99.453125%, seven register differences.
|
||||
VmBlobCalcRangeHMAC, 99.72269%, register allocation and hash context stack offset.
|
||||
vmBlobParsePackFormatString, 99.69827%, decimal accumulator register allocation.
|
||||
VmBlobPackCommon, 92.603294%, stack layout and control flow, 675/668 instructions.
|
||||
VmBlobUnpack, 92.083176%, control flow and register allocation, 531/517 instructions.
|
||||
VmImageCtor, 99.0%, four register differences.
|
||||
VmWinEmuWrite, 99.62687%, five register differences.
|
||||
CHANSVmAddExe, 99.1063%, register allocation, relocation loop scheduling and addition operands.
|
||||
CHANSVm_81455654, 94.0%, missing initial null-result instruction, 34/35 instructions.
|
||||
CHANSVmLinkModules, 98.677246%, register allocation and dispatch traversal scheduling.
|
||||
VmCallMethod, 96.565834%, control flow and register allocation, 279/281 instructions.
|
||||
CHANSVmStep, 94.7901%, stack layout and interpreter paths, 1249/1253 instructions.
|
||||
|
||||
## Attempts
|
||||
|
||||
Each compiling attempt rebuilt only CHANSVm.o, regenerated objdiff and compared raw instructions against the original. Every remaining function has at least three distinct compiling source-level attempts. Failed compiler experiments are recorded separately. Changes with regressions were restored. Exact variants retained during iteration were cleaned up before the final gate; the source diff is the authority for retained changes.
|
||||
|
||||
### VmBlobCalcRangeMD5Digest
|
||||
|
||||
- name the range validation boolean: 99.793816%; instructions 97/97, differing positions 4; restored.
|
||||
- test digest buffer before allocated object: 99.639175%; instructions 97/97, differing positions 7; restored.
|
||||
- load range pointer directly into update argument: 90.515465%; instructions 96/97, differing positions 26; restored.
|
||||
|
||||
### VmBlobCalcRangeHMAC
|
||||
|
||||
- declare hash context before pointer locals: 99.890755%; instructions 119/119, differing positions 5; restored.
|
||||
- check digest pointer before output object: 99.68067%; instructions 119/119, differing positions 10; restored.
|
||||
- write data argument directly in hash update: 85.411766%; instructions 118/119, differing positions 32; restored.
|
||||
|
||||
### vmBlobParsePackFormatString
|
||||
|
||||
- scope a signed numeric character beside accumulator: 98.01724%; instructions 117/116, differing positions 41; restored.
|
||||
- subtract ascii zero before adding decimal product: 99.69827%; instructions 116/116, differing positions 6; restored.
|
||||
- parameter loop with explicit position increment: 99.69827%; instructions 116/116, differing positions 6; restored.
|
||||
|
||||
### VmWinEmuWrite
|
||||
|
||||
- read string length before resetting offset: 99.62687%; instructions 67/67, differing positions 5; restored.
|
||||
- separate conversion input data pointer: 99.62687%; instructions 67/67, differing positions 5; restored.
|
||||
- two byte string terminators with memset: 89.31343%; instructions 68/67, differing positions 57; restored.
|
||||
|
||||
### VmBlobCalcHMAC
|
||||
|
||||
- check output buffer before header: 99.453125%; instructions 64/64, differing positions 7; restored.
|
||||
- explicit boolean native key test: 99.453125%; instructions 64/64, differing positions 7; restored.
|
||||
- load data before size at hash setup: 99.265625%; instructions 64/64, differing positions 11; restored.
|
||||
|
||||
### VmStringFromCharCode
|
||||
|
||||
- cache upper bound for code points: 99.40678%; instructions 59/59, differing positions 6; restored.
|
||||
- code point masking after low word load: 94.32204%; instructions 57/59, differing positions 45; restored.
|
||||
- assign byte offset before index counter: 99.32204%; instructions 59/59, differing positions 7; restored.
|
||||
|
||||
### CHANSVmNewObjData
|
||||
|
||||
- cache chunk slot as typed pointer: 99.375%; instructions 96/96, differing positions 11; restored.
|
||||
- invert allocation success branch within scan: 99.375%; instructions 96/96, differing positions 11; restored.
|
||||
- advance free entry pointer during entry scan: did not compile due to C89 declaration placement; restored and followed by a compiling variant.
|
||||
- pointer scan with declaration in function scope: 97.552086%; instructions 95/96, differing positions 65; restored.
|
||||
|
||||
### VmArrayExpandCommon
|
||||
|
||||
- derive element offset from index: 100.0%; instructions 85/85, differing positions 0; retained during iteration.
|
||||
- iterate element headers with typed pointer: 100.0%; instructions 85/85, differing positions 0; retained during iteration.
|
||||
- narrow allocation size lifetime to allocation block: 100.0%; instructions 85/85, differing positions 0; retained during iteration.
|
||||
- use array chunk element field for destinations: 100.0%; instructions 85/85, differing positions 0; retained during iteration.
|
||||
|
||||
### CHANSVmAddExe
|
||||
|
||||
- reverse initial typed module and context declarations: 99.1063%; instructions 254/254, differing positions 35; restored.
|
||||
- use module element fields instead of byte offset: 99.15354%; instructions 254/254, differing positions 34; restored.
|
||||
- test typed execution id using temporary: 99.1063%; instructions 254/254, differing positions 35; restored.
|
||||
|
||||
### VmImageCtor
|
||||
|
||||
- name data pointer inside callback branch: 99.0%; instructions 25/25, differing positions 4; restored.
|
||||
- store return object pointer in image lookup temporary: 99.0%; instructions 25/25, differing positions 4; restored.
|
||||
- use pointer truth test and retain size test: 99.0%; instructions 25/25, differing positions 4; restored.
|
||||
|
||||
### VmBlobGetHexString
|
||||
|
||||
- separate high and low nibble values: 98.71951%; instructions 82/82, differing positions 14; restored.
|
||||
- reverse nibble lookup operand order: 98.71951%; instructions 82/82, differing positions 14; restored.
|
||||
- signed destination byte count: 98.71951%; instructions 82/82, differing positions 14; restored.
|
||||
|
||||
### CHANSVm_8145049C
|
||||
|
||||
- use typed temporary string header: 98.58237%; instructions 431/431, differing positions 42; restored.
|
||||
- use typed character string buffer and retained buffer size: 98.58237%; instructions 431/431, differing positions 42; restored.
|
||||
- scope string output data before source data: 98.58237%; instructions 431/431, differing positions 42; restored.
|
||||
|
||||
### CHANSVmLinkModules
|
||||
|
||||
- load module count into loop bound: 95.544975%; instructions 189/189, differing positions 123; restored.
|
||||
- increment module index before loading next module: 98.677246%; instructions 189/189, differing positions 43; restored.
|
||||
- copy dispatch entry fields separately: did not compile due to C89 declaration placement; restored and followed by a compiling variant.
|
||||
- copy dispatch fields after local declarations: 92.53439%; instructions 197/189, differing positions 186; restored.
|
||||
|
||||
### CHANSVmGetSourceLine
|
||||
|
||||
- source offset relative to cached table start: 97.82609%; instructions 46/46, differing positions 16; restored.
|
||||
- byte-sized program offset loop bound: 98.04348%; instructions 46/46, differing positions 15; restored.
|
||||
- bit test with indexed table field: 89.021736%; instructions 45/46, differing positions 39; restored.
|
||||
|
||||
### VmStringSplice
|
||||
|
||||
- use conditional for clipped byte length: 100.0%; instructions 121/121, differing positions 0; retained during iteration.
|
||||
- calculate length only in positive range: 97.06612%; instructions 120/121, differing positions 29; restored.
|
||||
- name starting argument signed byte offset: 100.0%; instructions 121/121, differing positions 0; retained during iteration.
|
||||
|
||||
### CHANSVm_81450D14
|
||||
|
||||
- positive range early successful fallthrough: 89.565216%; instructions 50/46, differing positions 33; restored.
|
||||
- test negative value before negative size bound: 70.978264%; instructions 45/46, differing positions 29; restored.
|
||||
- cache unsigned blob size in signed scalar: 79.565216%; instructions 44/46, differing positions 40; restored.
|
||||
|
||||
### CHANSVmStrCpyToU16FromU8
|
||||
|
||||
- decrement count before byte offset calculation: 98.46154%; instructions 13/13, differing positions 3; restored.
|
||||
- input indexed by reverse character counter: 69.61539%; instructions 14/13, differing positions 14; restored.
|
||||
- byte output pointer scoped beside reverse input: 97.30769%; instructions 13/13, differing positions 5; restored.
|
||||
- inspect decrement-first offset variant: 98.46154%; instructions 13/13, differing positions 3; retained during iteration.
|
||||
- distinct remaining character counter: 98.46154%; instructions 13/13, differing positions 3; restored.
|
||||
- hold narrowed byte value as signed char: 98.46154%; instructions 13/13, differing positions 4; restored.
|
||||
- use byte load directly in low-byte store: 98.46154%; instructions 13/13, differing positions 4; restored.
|
||||
|
||||
### VmStringReplace
|
||||
|
||||
- cache all three string value structures in load order: 97.82576%; instructions 132/132, differing positions 47; restored.
|
||||
- convert replacement after search is validated: 94.11364%; instructions 132/132, differing positions 59; restored.
|
||||
- reverse initial argument declaration order: 97.106064%; instructions 132/132, differing positions 53; restored.
|
||||
|
||||
### CHANSVm_8144B4D4
|
||||
|
||||
- use ordinary typed parse end pointer: 96.92771%; instructions 83/83, differing positions 13; restored.
|
||||
- read string length before allocating converted object: 82.349396%; instructions 89/83, differing positions 84; restored.
|
||||
- local typed result pointer before floating store: did not compile due to C89 declaration placement; restored and followed by a compiling variant.
|
||||
- scoped typed result pointer after store label: 96.92771%; instructions 83/83, differing positions 13; restored.
|
||||
|
||||
### VmBlobCalcRangeSHA1Digest
|
||||
|
||||
- load range offset for both bounds and hash pointer: 98.09278%; instructions 96/97, differing positions 35; restored.
|
||||
- test output buffer before digest object: 96.329895%; instructions 97/97, differing positions 17; restored.
|
||||
- assign range validity to a named boolean: 96.484535%; instructions 97/97, differing positions 14; restored.
|
||||
|
||||
### VmArraySlice
|
||||
|
||||
- mutate signed indices before clipping to array length: 95.07519%; instructions 134/133, differing positions 100; restored.
|
||||
- assign end length before start range checks: 94.172935%; instructions 132/133, differing positions 93; restored.
|
||||
- array element source acquired before destination: 88.68421%; instructions 133/133, differing positions 60; restored.
|
||||
|
||||
### VmStringSplit
|
||||
|
||||
- cache string structures before loading lengths: 95.64414%; instructions 222/222, differing positions 101; restored.
|
||||
- derive empty-delimiter byte offset from character index: 96.04955%; instructions 222/222, differing positions 81; restored.
|
||||
- validate array before getting first created element: 92.58108%; instructions 223/222, differing positions 131; restored.
|
||||
|
||||
### VmDateDtor
|
||||
|
||||
- load both calendar name tables into pointers: 91.79121%; instructions 91/91, differing positions 63; restored.
|
||||
- read month before day and pass names as locals: 94.96703%; instructions 91/91, differing positions 7; restored.
|
||||
- use calendar object directly instead of calendar pointer: 89.14286%; instructions 90/91, differing positions 85; restored.
|
||||
|
||||
### CHANSVmParseInt
|
||||
|
||||
- group end pointer and input buffer into parse context: 94.69388%; instructions 49/49, differing positions 3; restored.
|
||||
- cache string value before type test: 94.69388%; instructions 49/49, differing positions 3; restored.
|
||||
- initialize parsing end pointer after string length load: 81.42857%; instructions 50/49, differing positions 41; restored.
|
||||
|
||||
### VmDateGetRTC
|
||||
|
||||
- apply unsigned 64-bit mask after bias subtraction: 100.0%; instructions 38/38, differing positions 0; retained during iteration.
|
||||
- name rtc seconds after division: 100.0%; instructions 38/38, differing positions 0; retained during iteration.
|
||||
- unsigned bias widened before subtraction: 100.0%; instructions 38/38, differing positions 0; retained during iteration.
|
||||
- remove experimental block around seconds calculation: 100.0%; instructions 38/38, differing positions 0; retained during iteration.
|
||||
|
||||
### CHANSVm_81455654
|
||||
|
||||
- assign result instead of returning through negative-index branch: 88.28571%; instructions 33/35, differing positions 18; restored.
|
||||
- separate argument table from return pointer: 94.0%; instructions 34/35, differing positions 35; restored.
|
||||
- initialize result after active context retrieval: 94.0%; instructions 34/35, differing positions 35; restored.
|
||||
|
||||
### VmCallMethod
|
||||
|
||||
- cache active module during operand range validation: 96.565834%; instructions 279/281, differing positions 228; restored.
|
||||
- cache native property method state as bool: 96.6726%; instructions 279/281, differing positions 228; restored.
|
||||
- separate argument count operand pointer: 96.565834%; instructions 279/281, differing positions 228; restored.
|
||||
|
||||
### CHANSVmStep
|
||||
|
||||
- named execution context for initial range validation: 94.56664%; instructions 1249/1253, differing positions 1172; restored.
|
||||
- signed opcode instead of unsigned dispatch scalar: 94.52673%; instructions 1249/1253, differing positions 1173; restored.
|
||||
- load float operand into double object directly: 94.7901%; instructions 1249/1253, differing positions 1173; restored.
|
||||
|
||||
### VmBlobPackCommon
|
||||
|
||||
- typed signed parser parameter address: 92.603294%; instructions 675/668, differing positions 642; restored.
|
||||
- derive format length with shift: 92.603294%; instructions 675/668, differing positions 642; restored.
|
||||
- validate parent only for pack operation: 92.61078%; instructions 675/668, differing positions 641; restored.
|
||||
|
||||
### VmBlobUnpack
|
||||
|
||||
- array buffer declared before scalar pointers: 92.083176%; instructions 531/517, differing positions 496; restored.
|
||||
- named constant parser defaults: 92.083176%; instructions 531/517, differing positions 496; restored.
|
||||
- signed count for unpacked elements: 92.083176%; instructions 531/517, differing positions 496; restored.
|
||||
|
||||
### VmBlobCopyRangeFrom
|
||||
|
||||
- target bounds checks with named availability: 91.52941%; instructions 139/136, differing positions 71; restored.
|
||||
- use existing range predicate for both blobs: 93.80882%; instructions 138/136, differing positions 50; restored.
|
||||
- load source and destination offsets after count conversion: 94.08088%; instructions 137/136, differing positions 73; restored.
|
||||
|
||||
### VmBlobFill
|
||||
|
||||
- name converted byte value before memset: 100.0%; instructions 63/63, differing positions 2; restored.
|
||||
- scope fill byte and destination pointer together: 100.0%; instructions 63/63, differing positions 2; restored.
|
||||
- advance offset before memory fill with original offset cached: 87.01588%; instructions 63/63, differing positions 12; restored. Regressions: VmBlobFill.
|
||||
|
||||
## Uncertainty
|
||||
|
||||
The reason for VmBlobFill raw branch differences remains unresolved. Register-only mismatches may be compiler tie-breaks; the attempts do not prove that no readable C variation can match them. Remaining .data/.rodata relocation and symbol comparisons are unresolved, so the unit is not complete.
|
||||
331
tools/decomp-assist/CHANSVm.wave3-attempts.md
Normal file
331
tools/decomp-assist/CHANSVm.wave3-attempts.md
Normal file
@@ -0,0 +1,331 @@
|
||||
# CHANSVm third continuation
|
||||
|
||||
Baseline: 46f34f11, instruction-exact 204/233, objdiff functions 205/233, code 31960/53564, data 800/6904.
|
||||
|
||||
Result: instruction-exact 205/233, objdiff functions 206/233, code 32348/53564, data 2232/6904.
|
||||
|
||||
## Retained changes
|
||||
|
||||
- VmBlobCalcRangeMD5Digest: declare byte input and digest before argument conversion. 97/97 instructions, diffs 0; raw 388 bytes identical.
|
||||
- VmBlobCalcRangeHMAC: the same declaration order removes all register differences, improving 99.72269% to 99.97479%. Three context stack addresses remain.
|
||||
- VmTypeConvertFuncTbl: restore the six diagonal null entries and converters to their actual destination/source cells. Size unchanged at 144 bytes. The .rodata score is now 100%; all 20 differing relocations are fixed.
|
||||
- CHANSVmGetEnumedType: classify native object instances with class/method references; global references fall through to invalid. The two incorrect switch relocations are fixed, with identical function instructions and raw bytes.
|
||||
|
||||
## Remaining functions
|
||||
|
||||
CHANSVmGetSourceLine, 97.71739%, register allocation and line-data address operands.
|
||||
CHANSVmNewObjData, 99.375%, register allocation and allocation-failure branch destination.
|
||||
CHANSVmStrCpyToU16FromU8, 98.46154%, three register differences after the decrement-first rewrite.
|
||||
CHANSVmParseInt, 94.69388%, three instruction scheduling differences.
|
||||
CHANSVm_8144B4D4, 96.92771%, register allocation and parse-end initialization scheduling.
|
||||
VmArraySlice, 96.2782%, signed index clipping, branch layout and register allocation.
|
||||
VmDateDtor, 94.96703%, seven argument-load scheduling differences.
|
||||
VmStringFromCharCode, 99.40678%, six register differences.
|
||||
VmStringReplace, 97.106064%, string field-load scheduling and register allocation.
|
||||
VmStringSplit, 96.04955%, register allocation, scheduling and branch operands.
|
||||
CHANSVm_8145049C, 98.58237%, character and string formatting paths, scheduling and register allocation.
|
||||
CHANSVm_81450D14, 97.391304%, one missing instruction and branch layout.
|
||||
VmBlobCopyRangeFrom, 91.67647%, range-check control flow, 139/136 instructions.
|
||||
VmBlobGetHexString, 98.71951%, fourteen register differences.
|
||||
VmBlobCalcRangeSHA1Digest, 96.484535%, range-check scheduling and register allocation.
|
||||
VmBlobCalcHMAC, 99.453125%, seven register differences.
|
||||
VmBlobCalcRangeHMAC, 99.97479%, three context-address differences: stack +0x0c versus +0x10; context layout remains unresolved.
|
||||
vmBlobParsePackFormatString, 99.69827%, decimal accumulator register allocation.
|
||||
VmBlobPackCommon, 92.603294%, stack layout and control flow, 675/668 instructions.
|
||||
VmBlobUnpack, 92.083176%, control flow and register allocation, 531/517 instructions.
|
||||
VmImageCtor, 99.0%, four register differences.
|
||||
VmWinEmuWrite, 99.62687%, five register differences.
|
||||
CHANSVmAddExe, 99.1063%, register allocation, relocation loop scheduling and addition operands.
|
||||
CHANSVm_81455654, 94.0%, missing initial null-result instruction, 34/35 instructions.
|
||||
CHANSVmLinkModules, 98.677246%, register allocation and dispatch traversal scheduling.
|
||||
VmCallMethod, 96.565834%, control flow and register allocation, 279/281 instructions.
|
||||
CHANSVmStep, 94.7901%, stack layout and interpreter paths, 1249/1253 instructions.
|
||||
VmBlobFill, 100.0%, objdiff 100%, raw 252 bytes identical; gate/ctxdiff report two CR1 branch address differences after normalization.
|
||||
|
||||
## Data audit and uncertainty
|
||||
|
||||
The string pool contains 125 identical strings in the same order. All raw .data and .rodata bytes match, including the automatic tables before relocation. .rodata, .sdata, .sdata2 and .sbss have objdiff scores of 100%. .data remains 18.050066%.
|
||||
|
||||
Relocations normalized to target section and symbol-relative offset leave 120 .data differences, all targeting CHANSVmStep switch blocks. The two CHANSVmGetEnumedType discrepancies and all .rodata discrepancies are resolved. Symbol-name aliases at the same section/offset were distinguished from these real differences; no symbol metadata was edited.
|
||||
|
||||
The source .sdata/.sbss section extents are 593/12 bytes versus target 600/16, with target trailing alignment zeros; objdiff scores both 100%. No padding was introduced.
|
||||
|
||||
VmBlobFill has identical raw bytes but gate/ctxdiff normalize two CR1 conditional branches to different absolute addresses. The tool result is reported unchanged; the authoritative gate count remains 205, while objdiff counts 206.
|
||||
|
||||
The HMAC context is an existing opaque byte buffer. Its precise type/layout is unknown; no alignment member, padding, register coercion or replacement structure was invented.
|
||||
|
||||
CHANSVmGetSourceLine still appears to resolve offsets from the selected entry instead of the table base. The table-base experiments did not reach an exact match and were restored. VmBlobCopyRangeFrom bounds also remain questionable; corrected-range experiments were restored because they did not match.
|
||||
|
||||
## Attempts
|
||||
|
||||
131 recorded experiments (six compiler failures). Every baseline non-matching function and VmBlobFill has at least three distinct compiling source-level variations. Failed C89 declaration placement and pointer-type experiments were restored. The temporary hex-loop variant that omitted cursor advancement, the signed conversion-length clamp and the signed snprintf-bound experiment were discarded and excluded from the three-attempt minimum. Exploratory whole-function rewrites were restored before the retained changes. An interrupted decimal-accumulation experiment was restored and rerun successfully.
|
||||
|
||||
### VmBlobCalcRangeMD5Digest
|
||||
|
||||
- derive input pointer at update call: 90.515465%; instructions 96/97, differing positions 26; restored.
|
||||
- scope result object and digest together: 99.793816%; instructions 97/97, differing positions 4; restored.
|
||||
- use signed size for range validation: 91.85567%; instructions 102/97, differing positions 76; restored.
|
||||
- declare and initialize result in success branch: 99.793816%; instructions 97/97, differing positions 4; restored.
|
||||
- scope digest with input pointer after range validation: 99.793816%; instructions 97/97, differing positions 4; restored.
|
||||
- remaining bytes as named unsigned bound: 99.793816%; instructions 97/97, differing positions 4; restored.
|
||||
- declare digest before range arguments: 99.793816%; instructions 97/97, differing positions 4; restored.
|
||||
- declare input data and digest before range arguments: 100.0%; instructions 97/97, differing positions 0; temporarily retained during iteration.
|
||||
|
||||
### VmBlobCalcRangeHMAC
|
||||
|
||||
- derive input pointer at update call: 85.411766%; instructions 118/119, differing positions 32; restored.
|
||||
- scope result object and digest together: 99.890755%; instructions 119/119, differing positions 5; restored.
|
||||
- use signed size for range validation: 93.0%; instructions 124/119, differing positions 88; restored.
|
||||
- hash context declared before range offset: 99.72269%; instructions 119/119, differing positions 9; restored.
|
||||
- digest declared after result object with outer hash context: 99.890755%; instructions 119/119, differing positions 5; restored.
|
||||
- declare digest after the data pointer: 99.890755%; instructions 119/119, differing positions 5; restored.
|
||||
- input and digest declared before range arguments: 99.97479%; instructions 119/119, differing positions 3; restored.
|
||||
- output object and digest before range arguments: 99.890755%; instructions 119/119, differing positions 5; restored.
|
||||
- declare context and offset in method scope: did not compile; restored.
|
||||
- retain input and digest declarations before conversions: 99.97479%; instructions 119/119, differing positions 3; temporarily retained during iteration.
|
||||
|
||||
### vmBlobParsePackFormatString
|
||||
|
||||
- decimal digit before accumulation: 99.69827%; instructions 116/116, differing positions 6; restored.
|
||||
- character-sized current character: 99.69827%; instructions 116/116, differing positions 6; restored.
|
||||
- decimal digit before accumulation: 99.69827%; instructions 116/116, differing positions 6; restored.
|
||||
- character-sized current character: 99.69827%; instructions 116/116, differing positions 6; restored.
|
||||
- accumulator multiply then add: 99.784485%; instructions 116/116, differing positions 5; restored.
|
||||
|
||||
### VmWinEmuWrite
|
||||
|
||||
- offset progression in loop clause: 99.62687%; instructions 67/67, differing positions 5; restored.
|
||||
- reverse declarations of conversion lengths: 99.55224%; instructions 67/67, differing positions 10; restored.
|
||||
- bounded input length assigned separately: 87.82089%; instructions 67/67, differing positions 13; restored.
|
||||
- clamp unsigned remaining count before division: 96.343285%; instructions 68/67, differing positions 41; restored.
|
||||
|
||||
### VmBlobCalcHMAC
|
||||
|
||||
- inline source size into update: 96.859375%; instructions 63/64, differing positions 31; restored.
|
||||
- order data load before size load: 99.265625%; instructions 64/64, differing positions 11; restored.
|
||||
- read input data directly at update: 96.953125%; instructions 63/64, differing positions 30; restored.
|
||||
- shorten native key object lifetime: 99.4375%; instructions 64/64, differing positions 12; restored.
|
||||
- declare output object beside key object: 99.609375%; instructions 64/64, differing positions 5; restored.
|
||||
- declare digest before initial key lookup: 99.4375%; instructions 64/64, differing positions 12; restored.
|
||||
- input and digest declared before native key lookup: 99.4375%; instructions 64/64, differing positions 12; restored.
|
||||
- output object then data declarations before key lookup: 99.046875%; instructions 64/64, differing positions 17; restored.
|
||||
- input size and digest declarations before key lookup: 99.4375%; instructions 64/64, differing positions 12; restored.
|
||||
|
||||
### VmStringFromCharCode
|
||||
|
||||
- increment character before byte offset: 99.40678%; instructions 59/59, differing positions 6; restored.
|
||||
- for-loop index progression: 99.40678%; instructions 59/59, differing positions 6; restored.
|
||||
- compute destination offset from character index: 95.0%; instructions 60/59, differing positions 39; restored.
|
||||
|
||||
### CHANSVmNewObjData
|
||||
|
||||
- explicit wrap branch: 84.114586%; instructions 98/96, differing positions 52; restored.
|
||||
- chunk number shift: 99.375%; instructions 96/96, differing positions 11; restored.
|
||||
- allocation byte count before chunk pointer: 99.375%; instructions 96/96, differing positions 11; restored.
|
||||
|
||||
### CHANSVmAddExe
|
||||
|
||||
- clear module memory in typed extent: 97.75197%; instructions 254/254, differing positions 44; restored.
|
||||
- advance free-executable pointer via module end: 97.68898%; instructions 253/254, differing positions 227; restored.
|
||||
- calculate aligned line table count with shift: 99.1063%; instructions 254/254, differing positions 35; restored.
|
||||
|
||||
### VmImageCtor
|
||||
|
||||
- name validated image data: 99.0%; instructions 25/25, differing positions 4; restored.
|
||||
- declare callback return after image: 99.0%; instructions 25/25, differing positions 4; restored.
|
||||
- return directly after validation: 61.4%; instructions 17/25, differing positions 25; restored.
|
||||
|
||||
### VmBlobGetHexString
|
||||
|
||||
- combine blob input address and cursor: 98.57317%; instructions 82/82, differing positions 16; restored.
|
||||
- write low hex nibble after first index: 92.86585%; instructions 78/82, differing positions 38; restored.
|
||||
- increment hex output cursor at loop end: 96.15854%; instructions 81/82, differing positions 34; restored.
|
||||
- increment hex cursor before source advance: 96.15854%; instructions 81/82, differing positions 34; restored.
|
||||
|
||||
### CHANSVmLinkModules
|
||||
|
||||
- dispatch entry by const pointer: did not compile; restored.
|
||||
- read dispatch entry fields through typed pointer: 94.25926%; instructions 189/189, differing positions 52; restored.
|
||||
- scope each native index loop: did not compile; restored.
|
||||
- explicit named table record fields: did not compile; restored.
|
||||
- move module index increment into while condition: 98.677246%; instructions 189/189, differing positions 43; restored.
|
||||
- copy dispatch record after local declarations: 98.677246%; instructions 189/189, differing positions 43; restored.
|
||||
|
||||
### CHANSVm_8145049C
|
||||
|
||||
- derive half work size from private VM: 97.65429%; instructions 431/431, differing positions 44; restored.
|
||||
- scope format pointer with its buffer: 98.58237%; instructions 431/431, differing positions 42; restored.
|
||||
- signed escaped flag: 98.58237%; instructions 431/431, differing positions 42; restored.
|
||||
|
||||
### CHANSVmStrCpyToU16FromU8
|
||||
|
||||
- promote loaded source character: 98.46154%; instructions 13/13, differing positions 3; restored.
|
||||
- load character before destination offset: 98.46154%; instructions 13/13, differing positions 3; restored.
|
||||
- use decrement in loop control: 98.46154%; instructions 13/13, differing positions 3; restored.
|
||||
- loaded character in function scope: 97.69231%; instructions 13/13, differing positions 4; restored.
|
||||
- destination offset in function scope: 98.46154%; instructions 13/13, differing positions 3; restored.
|
||||
- both character and destination offset in function scope: 97.69231%; instructions 13/13, differing positions 4; restored.
|
||||
|
||||
### CHANSVmGetSourceLine
|
||||
|
||||
- resolve line data from table origin: 97.82609%; instructions 46/46, differing positions 16; restored.
|
||||
- cache table origin for bounds and data: 97.82609%; instructions 46/46, differing positions 16; restored.
|
||||
- cache program offset for bit count: 97.82609%; instructions 46/46, differing positions 16; restored.
|
||||
- explicit module and table validation: 78.58696%; instructions 54/46, differing positions 52; temporarily retained during iteration.
|
||||
- compute byte loop bound before entry: 79.347824%; instructions 54/46, differing positions 52; temporarily retained during iteration.
|
||||
- unsigned base-line accumulator: 79.347824%; instructions 54/46, differing positions 52; temporarily retained during iteration.
|
||||
- chained validation with cached references: 96.847824%; instructions 46/46, differing positions 21; temporarily retained during iteration.
|
||||
|
||||
### CHANSVm_81450D14
|
||||
|
||||
- add size before signed value: 97.391304%; instructions 45/46, differing positions 29; restored.
|
||||
- negative range rejection first: 70.978264%; instructions 45/46, differing positions 29; restored.
|
||||
- positive range checked in nested branches: 97.391304%; instructions 45/46, differing positions 29; restored.
|
||||
- positive range jumps to common store: 97.391304%; instructions 45/46, differing positions 29; restored.
|
||||
- nested positive range reaches common store: 97.391304%; instructions 45/46, differing positions 29; restored.
|
||||
- signed low word adjusted for output: 97.391304%; instructions 45/46, differing positions 29; restored.
|
||||
|
||||
### VmStringReplace
|
||||
|
||||
- load parent pointer before parent length: 97.106064%; instructions 132/132, differing positions 53; restored.
|
||||
- cache argument conversion in nested call: 97.106064%; instructions 132/132, differing positions 53; restored.
|
||||
- count offsets as signed values: 97.106064%; instructions 132/132, differing positions 53; restored.
|
||||
|
||||
### CHANSVm_8144B4D4
|
||||
|
||||
- ordinary parsed end pointer: 96.92771%; instructions 83/83, differing positions 13; restored.
|
||||
- for-loop keyword lookup: 96.92771%; instructions 83/83, differing positions 13; restored.
|
||||
- unsigned keyword source type: 96.92771%; instructions 83/83, differing positions 13; restored.
|
||||
|
||||
### VmCallMethod
|
||||
|
||||
- initialize accumulator pointer at declaration: 96.565834%; instructions 279/281, differing positions 228; restored.
|
||||
- initialize native target before call state: 96.565834%; instructions 279/281, differing positions 228; restored.
|
||||
- declare stack sizes separately: 96.565834%; instructions 279/281, differing positions 228; restored.
|
||||
|
||||
### VmBlobCalcRangeSHA1Digest
|
||||
|
||||
- digest pointer declaration before context: 96.484535%; instructions 97/97, differing positions 14; restored.
|
||||
- derive update input directly: 87.206184%; instructions 96/97, differing positions 36; restored.
|
||||
- signed range size: 89.26804%; instructions 102/97, differing positions 76; restored.
|
||||
- input and digest declared before argument conversion: 96.69072%; instructions 97/97, differing positions 10; restored.
|
||||
|
||||
### VmArraySlice
|
||||
|
||||
- positive slice length conditional: 92.06767%; instructions 131/133, differing positions 106; restored.
|
||||
- cache negative start as signed offset: 96.2782%; instructions 133/133, differing positions 56; restored.
|
||||
- end clipping before start clipping: 96.2782%; instructions 133/133, differing positions 56; restored.
|
||||
|
||||
### VmStringSplit
|
||||
|
||||
- combined delimiter conversion: 96.04955%; instructions 222/222, differing positions 81; restored.
|
||||
- explicit boolean count result: 96.04955%; instructions 222/222, differing positions 81; restored.
|
||||
- signed output limit: 96.04955%; instructions 222/222, differing positions 81; restored.
|
||||
|
||||
### VmDateDtor
|
||||
|
||||
- direct calendar address instead of pointer: 94.96703%; instructions 91/91, differing positions 7; restored.
|
||||
- signed formatting return converted at bound: 94.30769%; instructions 91/91, differing positions 8; restored.
|
||||
- inline calendar field access: 89.14286%; instructions 90/91, differing positions 85; restored.
|
||||
- load calendar month before day at formatting: 94.96703%; instructions 91/91, differing positions 7; restored.
|
||||
- load calendar day separately: 94.96703%; instructions 91/91, differing positions 7; restored.
|
||||
- format result uses unsigned bound: 94.96703%; instructions 91/91, differing positions 7; restored.
|
||||
|
||||
### CHANSVmStep
|
||||
|
||||
- initialize interpreter private state at declaration: 94.7901%; instructions 1249/1253, differing positions 1173; restored.
|
||||
- use pointer indexing for opcode load: 94.7901%; instructions 1249/1253, differing positions 1173; restored.
|
||||
- use unsigned operation byte: 94.56265%; instructions 1249/1253, differing positions 1173; restored.
|
||||
|
||||
### CHANSVmParseInt
|
||||
|
||||
- buffer terminator through end pointer: 94.69388%; instructions 49/49, differing positions 3; restored.
|
||||
- separate end and result declarations: 94.69388%; instructions 49/49, differing positions 3; restored.
|
||||
- source length loaded after type validation: 94.69388%; instructions 49/49, differing positions 3; restored.
|
||||
- initialize parsed end before source type: 83.67347%; instructions 49/49, differing positions 5; restored.
|
||||
- assign cached source type after end initialization: 83.67347%; instructions 49/49, differing positions 5; restored.
|
||||
- null parse cursor initializer: 94.69388%; instructions 49/49, differing positions 3; restored.
|
||||
|
||||
### CHANSVm_81455654
|
||||
|
||||
- shared result across module local and argument branches: did not compile; restored.
|
||||
- argument branch before frame header branch: did not compile; restored.
|
||||
- extract signed frame displacement inline: 94.0%; instructions 34/35, differing positions 35; restored.
|
||||
- typed module lookup with shared return: 67.14286%; instructions 33/35, differing positions 23; restored.
|
||||
- typed lookup with argument branch before headers: 88.28571%; instructions 33/35, differing positions 18; restored.
|
||||
|
||||
### VmBlobPackCommon
|
||||
|
||||
- combine argument count and format start assignments: 92.588326%; instructions 675/668, differing positions 644; restored.
|
||||
- use shift for UTF16 format count: 92.603294%; instructions 675/668, differing positions 642; restored.
|
||||
- scope packed words before format return fields: 92.603294%; instructions 675/668, differing positions 642; restored.
|
||||
|
||||
### VmBlobUnpack
|
||||
|
||||
- remove redundant buffer base alias: 92.083176%; instructions 531/517, differing positions 496; restored.
|
||||
- scope format result declarations in storage order: 92.083176%; instructions 531/517, differing positions 496; restored.
|
||||
- unsigned output parameter flag type: 92.083176%; instructions 531/517, differing positions 496; restored.
|
||||
|
||||
### VmBlobCopyRangeFrom
|
||||
|
||||
- destination remaining validates count: 91.382355%; instructions 139/136, differing positions 71; restored.
|
||||
- validate upper bounds for both source and destination: 91.52941%; instructions 139/136, differing positions 71; restored.
|
||||
- separate available byte values and shared validation: 91.52941%; instructions 139/136, differing positions 71; restored.
|
||||
|
||||
### VmBlobFill
|
||||
|
||||
- explicit integer conversion type: 100.0%; instructions 63/63, differing positions 2; restored.
|
||||
- size type count declaration: 100.0%; instructions 63/63, differing positions 2; restored.
|
||||
- direct length after validated header: 91.74603%; instructions 60/63, differing positions 43; restored.
|
||||
|
||||
## Final full gate
|
||||
|
||||
```text
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[src/channelScript/CHANSVm] pool: IDENTICAL
|
||||
[src/channelScript/CHANSVm] objdiff: code 32348/53564 data 2232/6904 functions 206/233 fuzzy 98.3128 linked code 0
|
||||
[src/channelScript/CHANSVm] instruction-exact functions: 205/233
|
||||
[src/channelScript/CHANSVm] section .data size 4672 match 18.050066
|
||||
[src/channelScript/CHANSVm] section .rodata size 1432 match 100.0
|
||||
[src/channelScript/CHANSVm] section .sbss size 16 match 100.0
|
||||
[src/channelScript/CHANSVm] section .sdata size 600 match 100.0
|
||||
[src/channelScript/CHANSVm] section .sdata2 size 184 match 100.0
|
||||
[src/channelScript/CHANSVm] section .text size 53564 match 98.31282
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmGetSourceLine 97.71739
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmNewObjData 99.375
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmStrCpyToU16FromU8 98.46154
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmParseInt 94.69388
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_8144B4D4 96.92771
|
||||
[src/channelScript/CHANSVm] below 100: VmArraySlice 96.2782
|
||||
[src/channelScript/CHANSVm] below 100: VmDateDtor 94.96703
|
||||
[src/channelScript/CHANSVm] below 100: VmStringFromCharCode 99.40678
|
||||
[src/channelScript/CHANSVm] below 100: VmStringReplace 97.106064
|
||||
[src/channelScript/CHANSVm] below 100: VmStringSplit 96.04955
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_8145049C 98.58237
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_81450D14 97.391304
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCopyRangeFrom 91.67647
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobGetHexString 98.71951
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcRangeSHA1Digest 96.484535
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcHMAC 99.453125
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcRangeHMAC 99.97479
|
||||
[src/channelScript/CHANSVm] below 100: vmBlobParsePackFormatString 99.69827
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobPackCommon 92.603294
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobUnpack 92.083176
|
||||
[src/channelScript/CHANSVm] below 100: VmImageCtor 99.0
|
||||
[src/channelScript/CHANSVm] below 100: VmWinEmuWrite 99.62687
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmAddExe 99.1063
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_81455654 94.0
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmLinkModules 98.677246
|
||||
[src/channelScript/CHANSVm] below 100: VmCallMethod 96.565834
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmStep 94.7901
|
||||
[src/channelScript/CHANSVm] baseline: code 31960/53564 data 800 functions 205 fuzzy 98.3091
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 72.27324 -> 72.28620
|
||||
global fuzzy_match_percent: 81.01270 -> 81.01278
|
||||
global complete_code_percent: 56.76068 -> 56.76068
|
||||
global matched_data_percent: 86.19839 -> 86.27652
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
283
tools/decomp-assist/CHANSVm.wave4-attempts.md
Normal file
283
tools/decomp-assist/CHANSVm.wave4-attempts.md
Normal file
@@ -0,0 +1,283 @@
|
||||
# CHANSVm fourth continuation
|
||||
|
||||
Baseline: 42647c75, instruction-exact 205/233, objdiff functions 206/233, code 32348/53564, data 2232/6904.
|
||||
|
||||
Result: instruction-exact 206/233, objdiff functions 207/233, code 32400/53564, data 2232/6904.
|
||||
|
||||
## Retained changes
|
||||
|
||||
- CHANSVmStrCpyToU16FromU8: use a byte destination pointer for the two widening stores. 13/13 instructions, diffs 0.
|
||||
- CHANSVmGetSourceLine: decode line bytes relative to the line table, as in the target, rather than relative to the selected entry. 97.71739% to 97.82609%.
|
||||
- CHANSVmNewObjData: failed chunk allocation follows the target cleanup path through the zero offset. 99.375% to 99.427086%.
|
||||
- VmCallMethod: read method identifier from instruction bytes one and two with the existing big-endian helper. The old halfword access read bytes two and three. 96.565834% to 97.2242%; 279/281 to 281/281 instructions.
|
||||
- VmBlobCopyRangeFrom: require a nonnegative count and sufficient bytes remaining in each blob; retain distinct destination and source validation state. 91.67647% to 93.492645%.
|
||||
- CHANSVmStep: equality uses the equality conversion table; string deletion status and array creation status propagate through the target joins; failed array expansion returns its error. 94.7901% to 94.81804%; 1249/1253 to 1252/1253 instructions.
|
||||
|
||||
## Remaining functions
|
||||
|
||||
CHANSVmGetSourceLine, 97.82609%, line-table origin fixed; register allocation remains.
|
||||
CHANSVmNewObjData, 99.427086%, allocation-failure cleanup fixed; ten register differences remain.
|
||||
CHANSVmParseInt, 94.69388%, three instruction scheduling differences.
|
||||
CHANSVm_8144B4D4, 96.92771%, register allocation and parse-end initialization scheduling.
|
||||
VmArraySlice, 96.2782%, signed index clipping, branch layout and register allocation.
|
||||
VmDateDtor, 94.96703%, seven argument-load scheduling differences.
|
||||
VmStringFromCharCode, 99.40678%, six register differences.
|
||||
VmStringReplace, 97.106064%, string field-load scheduling and register allocation.
|
||||
VmStringSplit, 96.04955%, register allocation, scheduling and branch operands.
|
||||
CHANSVm_8145049C, 98.58237%, character/string formatting paths, scheduling and register allocation.
|
||||
CHANSVm_81450D14, 97.391304%, one missing branch and addition operand order; 45/46 instructions.
|
||||
VmBlobCopyRangeFrom, 93.492645%, range predicates fixed; register allocation and scheduling, 139/136 instructions.
|
||||
VmBlobGetHexString, 98.71951%, fourteen register differences.
|
||||
VmBlobCalcRangeSHA1Digest, 96.484535%, range-check scheduling and register allocation.
|
||||
VmBlobCalcHMAC, 99.453125%, seven register differences.
|
||||
VmBlobCalcRangeHMAC, 99.97479%, three context-address differences: stack +0x0c versus +0x10; context layout unresolved.
|
||||
vmBlobParsePackFormatString, 99.69827%, decimal accumulator register allocation.
|
||||
VmBlobPackCommon, 92.603294%, stack layout and control flow, 675/668 instructions.
|
||||
VmBlobUnpack, 92.083176%, control flow and register allocation, 531/517 instructions.
|
||||
VmImageCtor, 99.0%, four register differences.
|
||||
VmWinEmuWrite, 99.62687%, five register differences.
|
||||
CHANSVmAddExe, 99.1063%, register allocation, relocation-loop scheduling and addition operands.
|
||||
CHANSVm_81455654, 94.0%, missing initial null-result instruction, 34/35 instructions.
|
||||
CHANSVmLinkModules, 98.677246%, register allocation and dispatch traversal scheduling.
|
||||
VmCallMethod, 97.2242%, operand bytes fixed; register allocation and scheduling, 281/281 instructions.
|
||||
CHANSVmStep, 94.81804%, stack layout, register allocation and interpreter branches, 1252/1253 instructions.
|
||||
VmBlobFill, 100.0%, objdiff 100%, raw 252 bytes identical; ctxdiff/gate report two CR1 branch differences after address normalization.
|
||||
|
||||
## Data audit and uncertainty
|
||||
|
||||
Pool: all 125 strings identical and in target order. .rodata, .sdata, .sdata2 and .sbss score 100%. .data scores 18.050066%. Its 4672 raw bytes are identical, but 108 canonical relocation destinations still differ, all inside CHANSVmStep jump tables (120 at baseline). The retained interpreter changes fix twelve destinations naturally. No manual table addresses or padding were added.
|
||||
|
||||
.rodata has identical 1432 raw bytes and zero canonical relocation differences; .sdata2 has identical 184 raw bytes and zero canonical relocation differences. .sdata and .sbss have trailing target alignment space (593/600 and 12/16 raw bytes) and already score 100%; no dummy storage added. String-symbol aliases resolve to the same section offsets.
|
||||
|
||||
VmBlobCalcRangeHMAC context placement remains unresolved. VmBlobFill is byte-identical and scores 100% in objdiff, but two CR1 branch operands differ in the address-normalized instruction checker. Tooling was not changed and this function is not claimed instruction-exact.
|
||||
|
||||
## Attempt log
|
||||
|
||||
92 recorded trials: 87 compiled, five failed compilation and were restored. The unused-input trial noted below is excluded from the three-attempt minimum. Every remaining function has at least three distinct compiling source-level trials. Kept below means retained at that point in the experiment sequence; the retained-change list above describes the final source.
|
||||
|
||||
### VmBlobCalcRangeHMAC
|
||||
|
||||
- scope hash context next to checked range state: 99.97479%; 119/119 instructions; 3 positional diffs; restored.
|
||||
- declare range offset after context in method scope: 99.97479%; 119/119 instructions; 3 positional diffs; restored.
|
||||
- byte input declared after context and output: 99.72269%; 119/119 instructions; 9 positional diffs; restored.
|
||||
|
||||
### vmBlobParsePackFormatString
|
||||
|
||||
- scope current parameter character with numeric accumulator: 98.06035%; 117/116 instructions; 40 positional diffs; restored.
|
||||
- declare parameter accumulator before decoded character: 98.534485%; 116/116 instructions; 32 positional diffs; restored.
|
||||
- accumulate signed decoded decimal digit: 99.69827%; 116/116 instructions; 6 positional diffs; restored.
|
||||
|
||||
### VmWinEmuWrite
|
||||
|
||||
- declare lengths before string conversion result: 99.17911%; 67/67 instructions; 8 positional diffs; restored.
|
||||
- declare output buffer before string state: 99.62687%; 67/67 instructions; 5 positional diffs; restored.
|
||||
- decode string payload in local scope: 99.62687%; 67/67 instructions; 5 positional diffs; restored; unused input temporary, excluded from required attempts.
|
||||
- use named Unicode input pointer in conversion: 74.61194%; 67/67 instructions; 16 positional diffs; restored.
|
||||
|
||||
### VmBlobCalcHMAC
|
||||
|
||||
- scope output byte pointers before context: 99.140625%; 64/64 instructions; 11 positional diffs; restored.
|
||||
- output header declared before source blob: 99.90625%; 64/64 instructions; 6 positional diffs; restored.
|
||||
- context placed after result header and before input bytes: 99.609375%; 64/64 instructions; 5 positional diffs; restored.
|
||||
|
||||
### VmStringFromCharCode
|
||||
|
||||
- name character mask before loop counters: 99.40678%; 59/59 instructions; 6 positional diffs; restored.
|
||||
- declare index before byte cursor: 98.72881%; 59/59 instructions; 12 positional diffs; restored.
|
||||
- declare byte cursor before converted argument: 99.40678%; 59/59 instructions; 6 positional diffs; restored.
|
||||
|
||||
### CHANSVmNewObjData
|
||||
|
||||
- allocation failure shares exhausted-chunk cleanup: 99.427086%; 96/96 instructions; 10 positional diffs; kept at this point.
|
||||
- track chunk slot through typed pointer: 99.427086%; 96/96 instructions; 10 positional diffs; restored.
|
||||
- declare chunk scan index after entry cursor: 99.427086%; 96/96 instructions; 10 positional diffs; restored.
|
||||
|
||||
### CHANSVmAddExe
|
||||
|
||||
- use typed module element during initialization: 99.15354%; 254/254 instructions; 34 positional diffs; restored.
|
||||
- calculate dispatch string end with pointer addition: 97.86614%; 253/254 instructions; 89 positional diffs; restored.
|
||||
- use typed line-table entry size: 99.1063%; 254/254 instructions; 35 positional diffs; restored.
|
||||
|
||||
### VmImageCtor
|
||||
|
||||
- reference image header through local typed pointer: 99.0%; 25/25 instructions; 4 positional diffs; restored.
|
||||
- hold image data in condition initializer scope: 99.0%; 25/25 instructions; 4 positional diffs; restored.
|
||||
- return status through signed integer local: 99.0%; 25/25 instructions; 4 positional diffs; restored.
|
||||
|
||||
### VmBlobGetHexString
|
||||
|
||||
- declare byte input before destination pointer: compile failed; restored; # (10141) expression syntax error.
|
||||
- derive second output index from first output cursor: 98.71951%; 82/82 instructions; 14 positional diffs; restored.
|
||||
- name high nibble before output writes: 98.71951%; 82/82 instructions; 14 positional diffs; restored.
|
||||
- read byte input before extracting output payload: 94.560974%; 82/82 instructions; 27 positional diffs; restored.
|
||||
|
||||
### CHANSVmLinkModules
|
||||
|
||||
- retain dispatch pointer beside module iterator: 98.783066%; 189/189 instructions; 40 positional diffs; restored.
|
||||
- declare traversal pointers before pass result: 98.677246%; 189/189 instructions; 43 positional diffs; restored.
|
||||
- advance module traversal in for-loop increment: 98.677246%; 189/189 instructions; 43 positional diffs; restored.
|
||||
|
||||
### CHANSVm_8145049C
|
||||
|
||||
- format argument counter declared before formatting buffers: compile failed; restored; # (10333) object 'argIdxCounter' redefined.
|
||||
- output byte pointer declared before format buffers: 96.37819%; 431/431 instructions; 159 positional diffs; restored.
|
||||
- work byte pointer declared alongside VM state: 98.14153%; 431/431 instructions; 74 positional diffs; restored.
|
||||
- declare argument counter before format buffers without duplication: 98.28074%; 431/431 instructions; 63 positional diffs; restored.
|
||||
|
||||
### CHANSVmStrCpyToU16FromU8
|
||||
|
||||
- compute byte destination pointer for both stores: 100.0%; 13/13 instructions; 0 positional diffs; kept at this point.
|
||||
- advance byte destination from end to start: compile failed; restored; # (10141) expression syntax error.
|
||||
|
||||
### CHANSVmGetSourceLine
|
||||
|
||||
- use table origin and cached byte position bound: 97.391304%; 46/46 instructions; 20 positional diffs; kept at this point.
|
||||
- declare decoded line offset after byte bitmap pointer: 97.391304%; 46/46 instructions; 20 positional diffs; restored.
|
||||
- name bit mask and keep loop bound as unsigned word: 97.82609%; 46/46 instructions; 18 positional diffs; restored.
|
||||
- resolve table-relative line data without byte-bound temporary: 97.82609%; 46/46 instructions; 16 positional diffs; kept at this point.
|
||||
|
||||
### CHANSVm_81450D14
|
||||
|
||||
- explicit positive and negative normalization branches: 89.565216%; 50/46 instructions; 33 positional diffs; restored.
|
||||
- branch to validation result after nonnegative bounds: 97.391304%; 45/46 instructions; 29 positional diffs; restored.
|
||||
- use wider unsigned sum after relative offset validation: 97.391304%; 45/46 instructions; 29 positional diffs; restored.
|
||||
|
||||
### VmStringReplace
|
||||
|
||||
- declare destination string before source argument objects: 96.5%; 132/132 instructions; 64 positional diffs; restored.
|
||||
- use explicit source scan loop control: 97.106064%; 132/132 instructions; 53 positional diffs; restored.
|
||||
- use direct destination clipping with local size: 97.106064%; 132/132 instructions; 53 positional diffs; restored.
|
||||
|
||||
### CHANSVm_8144B4D4
|
||||
|
||||
- parsed end pointer in character pointer form: 96.92771%; 83/83 instructions; 13 positional diffs; restored.
|
||||
- declare parsed float before output object: 96.92771%; 83/83 instructions; 13 positional diffs; restored.
|
||||
- initialize keyword scan in loop clause: 96.92771%; 83/83 instructions; 13 positional diffs; restored.
|
||||
|
||||
### CHANSVmStep
|
||||
|
||||
- use equality conversion matrix for equality operators: 94.7901%; 1249/1253 instructions; 1173 positional diffs; kept at this point.
|
||||
- retain string deletion result and reload active module field: 94.79489%; 1251/1253 instructions; 1153 positional diffs; kept at this point.
|
||||
- check new-array expansion result before returning value: 94.603355%; 1256/1253 instructions; 1178 positional diffs; kept at this point.
|
||||
- new-array status joins helper results before opcode result: 94.81804%; 1252/1253 instructions; 1032 positional diffs; kept at this point.
|
||||
|
||||
### VmCallMethod
|
||||
|
||||
- decode method identifier from opcode bytes one and two: compile failed; restored; # (10140) undefined identifier 'pConstObj'.
|
||||
- declare native callback before context and return state: 96.33452%; 279/281 instructions; 230 positional diffs; restored.
|
||||
- declare argument frame counts before return status: 96.88612%; 279/281 instructions; 219 positional diffs; restored.
|
||||
- decode method identifier with typed instruction byte stream: 97.2242%; 281/281 instructions; 97 positional diffs; kept at this point.
|
||||
|
||||
### VmBlobCalcRangeSHA1Digest
|
||||
|
||||
- declare output header before range conversion state: 96.484535%; 97/97 instructions; 14 positional diffs; restored.
|
||||
- place byte pointers and header before input blob: 96.69072%; 97/97 instructions; 10 positional diffs; restored.
|
||||
- derive hash input before constructing output blob: 70.24742%; 97/97 instructions; 29 positional diffs; restored.
|
||||
|
||||
### VmArraySlice
|
||||
|
||||
- scope negative end relative to array length: 96.2782%; 133/133 instructions; 56 positional diffs; restored.
|
||||
- destination element declared after source element: 96.2782%; 133/133 instructions; 56 positional diffs; restored.
|
||||
- iterate array copy with remaining count: 94.586464%; 134/133 instructions; 84 positional diffs; restored.
|
||||
|
||||
### VmStringSplit
|
||||
|
||||
- array result declared before separator argument state: 96.04955%; 222/222 instructions; 81 positional diffs; restored.
|
||||
- declare source text next to source byte length: 95.98198%; 222/222 instructions; 84 positional diffs; restored.
|
||||
- split segment count declaration follows output count: 96.04955%; 222/222 instructions; 81 positional diffs; restored.
|
||||
|
||||
### VmDateDtor
|
||||
|
||||
- format month pointer declared after calendar fields: 94.96703%; 91/91 instructions; 7 positional diffs; restored.
|
||||
- declare calendar before text buffer: 94.96703%; 91/91 instructions; 7 positional diffs; restored.
|
||||
- use size type for formatted character count: 94.96703%; 91/91 instructions; 7 positional diffs; restored.
|
||||
|
||||
### CHANSVmParseInt
|
||||
|
||||
- initialize end pointer through buffer conversion scope: 78.44898%; 49/49 instructions; 33 positional diffs; restored.
|
||||
- declare parse output pointer before byte buffer: 94.69388%; 49/49 instructions; 3 positional diffs; restored.
|
||||
- normalize empty parse by conditional expression: 84.79592%; 50/49 instructions; 26 positional diffs; restored.
|
||||
|
||||
### VmBlobCopyRangeFrom
|
||||
|
||||
- validate both bounds with separate source validity result: 91.52941%; 139/136 instructions; 71 positional diffs; kept at this point.
|
||||
- combine each signed count and available range predicate: compile failed; restored; # (10141) expression syntax error.
|
||||
- declare copy result before requested byte count: 91.52941%; 139/136 instructions; 71 positional diffs; restored.
|
||||
- compute independent available counts before range predicates: 90.911766%; 138/136 instructions; 69 positional diffs; restored.
|
||||
- inline both predicates with cached range origins: 93.492645%; 139/136 instructions; 72 positional diffs; kept at this point.
|
||||
- range flags use logical comparisons directly: 85.84559%; 147/136 instructions; 80 positional diffs; restored.
|
||||
|
||||
### CHANSVm_81455654
|
||||
|
||||
- scope argument result pointer in argument branch: 94.0%; 34/35 instructions; 35 positional diffs; restored.
|
||||
- place result declaration after active module retrieval: 94.0%; 34/35 instructions; 35 positional diffs; restored.
|
||||
- read global result through typed module entry field: 91.71429%; 34/35 instructions; 35 positional diffs; restored.
|
||||
|
||||
### VmBlobPackCommon
|
||||
|
||||
- format and array objects declared before parent blob: 92.655685%; 675/668 instructions; 637 positional diffs; restored.
|
||||
- name argument count from active execution context: 91.949104%; 675/668 instructions; 642 positional diffs; restored.
|
||||
- initialize format result count after type and size: 92.59281%; 675/668 instructions; 644 positional diffs; restored.
|
||||
|
||||
### VmBlobUnpack
|
||||
|
||||
- declare word buffer before blob parse state: 92.083176%; 531/517 instructions; 496 positional diffs; restored.
|
||||
- decode UTF16 format count by division: 92.083176%; 531/517 instructions; 496 positional diffs; restored.
|
||||
- format decoder results initialized at declarations: 92.083176%; 531/517 instructions; 496 positional diffs; restored.
|
||||
|
||||
### VmBlobFill
|
||||
|
||||
- declare byte count before converted arguments: 100.0%; 63/63 instructions; 2 positional diffs; restored.
|
||||
- native fill value masked to one byte explicitly: 100.0%; 63/63 instructions; 2 positional diffs; restored.
|
||||
- scope actual write buffer beside fill operation: 100.0%; 63/63 instructions; 2 positional diffs; restored.
|
||||
|
||||
## Final full gate
|
||||
|
||||
```text
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[src/channelScript/CHANSVm] pool: IDENTICAL
|
||||
[src/channelScript/CHANSVm] objdiff: code 32400/53564 data 2232/6904 functions 207/233 fuzzy 98.3499 linked code 0
|
||||
[src/channelScript/CHANSVm] instruction-exact functions: 206/233
|
||||
[src/channelScript/CHANSVm] section .data size 4672 match 18.050066
|
||||
[src/channelScript/CHANSVm] section .rodata size 1432 match 100.0
|
||||
[src/channelScript/CHANSVm] section .sbss size 16 match 100.0
|
||||
[src/channelScript/CHANSVm] section .sdata size 600 match 100.0
|
||||
[src/channelScript/CHANSVm] section .sdata2 size 184 match 100.0
|
||||
[src/channelScript/CHANSVm] section .text size 53564 match 98.34994
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmGetSourceLine 97.82609
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmNewObjData 99.427086
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmParseInt 94.69388
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_8144B4D4 96.92771
|
||||
[src/channelScript/CHANSVm] below 100: VmArraySlice 96.2782
|
||||
[src/channelScript/CHANSVm] below 100: VmDateDtor 94.96703
|
||||
[src/channelScript/CHANSVm] below 100: VmStringFromCharCode 99.40678
|
||||
[src/channelScript/CHANSVm] below 100: VmStringReplace 97.106064
|
||||
[src/channelScript/CHANSVm] below 100: VmStringSplit 96.04955
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_8145049C 98.58237
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_81450D14 97.391304
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCopyRangeFrom 93.492645
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobGetHexString 98.71951
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcRangeSHA1Digest 96.484535
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcHMAC 99.453125
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcRangeHMAC 99.97479
|
||||
[src/channelScript/CHANSVm] below 100: vmBlobParsePackFormatString 99.69827
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobPackCommon 92.603294
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobUnpack 92.083176
|
||||
[src/channelScript/CHANSVm] below 100: VmImageCtor 99.0
|
||||
[src/channelScript/CHANSVm] below 100: VmWinEmuWrite 99.62687
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmAddExe 99.1063
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_81455654 94.0
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmLinkModules 98.677246
|
||||
[src/channelScript/CHANSVm] below 100: VmCallMethod 97.2242
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmStep 94.81804
|
||||
[src/channelScript/CHANSVm] baseline: code 32348/53564 data 2232 functions 206 fuzzy 98.3128
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 72.37634 -> 72.37808
|
||||
global fuzzy_match_percent: 81.02148 -> 81.02215
|
||||
global complete_code_percent: 56.76068 -> 56.76068
|
||||
global matched_data_percent: 86.27652 -> 86.27652
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
345
tools/decomp-assist/CHANSVm.wave5-attempts.md
Normal file
345
tools/decomp-assist/CHANSVm.wave5-attempts.md
Normal file
@@ -0,0 +1,345 @@
|
||||
# CHANSVm wave 5 attempts
|
||||
|
||||
Partial progress only. Instruction-exact functions remain 206/233; objdiff functions remain 207/233. Code remains 32400/53564 bytes and data remains 2232/6904 bytes. The instruction-exact gain required by the task was not achieved.
|
||||
|
||||
CHANSVmStep improves from 94.81804% to 95.172386% and from 1252/1253 to 1253/1253 instructions. The strict comparison blank case follows strings, empty and equal strings share the true tail, and symbol load/store labels follow the target. Canonical .data relocation differences fall from 108 to 98. All ten strict-comparison table entries at .data+0x105c through +0x1080 now match. No explicit table data or pinned addresses were added.
|
||||
|
||||
The pool remains identical. Objdiff still reports .data at 18.050066%; .rodata, .sbss, .sdata and .sdata2 remain 100%. The .data raw bytes agree; its remaining canonical relocation mismatches all point inside CHANSVmStep. The .rodata raw bytes and canonical relocations agree. Shorter raw .sdata and .sbss section lengths are existing trailing alignment differences; the gate reports both at 100%.
|
||||
|
||||
Only the selected switch changes remain in CHANSVm.c. Every other experiment was restored. A trial marked kept in the temporary JSON log was retained for the next experiment, not necessarily in the final source.
|
||||
|
||||
## Remaining functions
|
||||
|
||||
- CHANSVmGetSourceLine, 97.82609%, 46/46 instructions, 16 differing instructions. 16 register differences in module lookup and line-marker traversal.
|
||||
- CHANSVmNewObjData, 99.427086%, 96/96 instructions, 10 differing instructions. Ten register differences swap the chunk counter and slot address, and reuse the counter register for allocation size.
|
||||
- CHANSVmParseInt, 94.69388%, 49/49 instructions, 3 differing instructions. Three prologue scheduling differences place the parse endpoint store after argument copies.
|
||||
- CHANSVm_8144B4D4, 96.92771%, 83/83 instructions, 13 differing instructions. Register allocation and instruction scheduling differ in keyword conversion and strtod setup.
|
||||
- VmArraySlice, 96.2782%, 133/133 instructions, 56 differing instructions. Bounds clipping branches and element traversal registers differ.
|
||||
- VmDateDtor, 94.96703%, 91/91 instructions, 7 differing instructions. Seven differences in calendar argument loads and scheduling.
|
||||
- VmStringFromCharCode, 99.40678%, 59/59 instructions, 6 differing instructions. Six differences swap the byte cursor and UTF-16 mask registers.
|
||||
- VmStringReplace, 97.106064%, 132/132 instructions, 53 differing instructions. Replacement traversal registers and load scheduling differ.
|
||||
- VmStringSplit, 96.04955%, 222/222 instructions, 81 differing instructions. Delimiter traversal registers and scheduling differ.
|
||||
- CHANSVm_8145049C, 98.58237%, 431/431 instructions, 42 differing instructions. Format parsing registers and scheduling differ.
|
||||
- CHANSVm_81450D14, 97.391304%, 45/46 instructions, instruction alignment differs. One branch instruction is missing from the absolute/relative range join; addc operands are reversed.
|
||||
- VmBlobFill, 100.0%, 63/63 instructions, 2 differing instructions. Objdiff is 100% and the 252 instruction bytes are identical. ctxdiff reports two CR1 branch normalization differences because the preceding function is four bytes shorter.
|
||||
- VmBlobCopyRangeFrom, 93.492645%, 139/136 instructions, instruction alignment differs. Three extra instructions, range predicate branches, and register allocation differ.
|
||||
- VmBlobGetHexString, 98.71951%, 82/82 instructions, 14 differing instructions. Hex pair loop registers and store scheduling differ.
|
||||
- VmBlobCalcRangeSHA1Digest, 96.484535%, 97/97 instructions, 14 differing instructions. Digest setup registers and range-check scheduling differ.
|
||||
- VmBlobCalcHMAC, 99.453125%, 64/64 instructions, 7 differing instructions. Seven register differences in input pointer and length setup.
|
||||
- VmBlobCalcRangeHMAC, 99.97479%, 119/119 instructions, 3 differing instructions. Three HMAC context addresses use stack +0xc instead of +0x10. The opaque SDK context alignment remains unresolved.
|
||||
- vmBlobParsePackFormatString, 99.69827%, 116/116 instructions, 6 differing instructions. Six register differences in parameter digit decoding and multiplication.
|
||||
- VmBlobPackCommon, 92.603294%, 675/668 instructions, instruction alignment differs. Seven extra instructions; stack layout, integer packing, and case control flow differ.
|
||||
- VmBlobUnpack, 92.083176%, 531/517 instructions, instruction alignment differs. Fourteen extra instructions; unpacking control flow, stack layout, and registers differ.
|
||||
- VmImageCtor, 99.0%, 25/25 instructions, 4 differing instructions. Four differences use r4 for the image and r0 for its data instead of r6 and r4.
|
||||
- VmWinEmuWrite, 99.62687%, 67/67 instructions, 5 differing instructions. Five differences swap the converted string and aligned byte-length registers.
|
||||
- CHANSVmAddExe, 99.1063%, 254/254 instructions, 35 differing instructions. Module table loop registers and scheduling differ.
|
||||
- CHANSVm_81455654, 94.0%, 34/35 instructions, instruction alignment differs. One instruction missing; execution context/module registers and the negative-index return differ.
|
||||
- CHANSVmLinkModules, 98.677246%, 189/189 instructions, 43 differing instructions. Module traversal registers and scheduling differ.
|
||||
- VmCallMethod, 97.2242%, 281/281 instructions, 97 differing instructions. Call frame setup registers, stack accesses, and scheduling differ.
|
||||
- CHANSVmStep, 95.172386%, 1253/1253 instructions, 894 differing instructions. Instruction counts now agree, but stack layout, register allocation, constant-table base loads, and several opcode/error tails differ; 98 generated table relocations remain wrong.
|
||||
|
||||
## Compiling source attempts
|
||||
|
||||
Each function has at least three distinct compiling variants. Failed compilations are listed separately and do not count. The FromCharCode trial that introduced an unused offset is also excluded from the count. Declaration-order trials that compiled to the same instructions are recorded as plateaus.
|
||||
|
||||
### CHANSVmGetSourceLine
|
||||
|
||||
- cache module beside execution context for source line lookup: 97.391304%, 46/46 instructions, 17 differences.
|
||||
- scan line markers with a while loop: 97.82609%, 46/46 instructions, 16 differences.
|
||||
- scope the line byte address and range check together: 97.82609%, 46/46 instructions, 16 differences.
|
||||
|
||||
### CHANSVmNewObjData
|
||||
|
||||
- advance chunk byte offset before its index: 99.427086%, 96/96 instructions, 10 differences.
|
||||
- declare chunk pointer before chunk traversal counters: 99.427086%, 96/96 instructions, 10 differences.
|
||||
- scope aligned allocation size beside the allocation: 99.427086%, 96/96 instructions, 10 differences.
|
||||
- index chunk slots using the tracked table byte offset: 98.28125%, 97/96 instructions, 73 differences.
|
||||
- scope the current chunk slot around allocation and scan: 99.427086%, 96/96 instructions, 10 differences.
|
||||
- scan chunks with a post-tested loop: 99.427086%, 96/96 instructions, 10 differences.
|
||||
- scan chunks with a for loop increment: 99.427086%, 96/96 instructions, 10 differences.
|
||||
- use a typed chunk entry pointer instead of the traversal union: 99.114586%, 96/96 instructions, 16 differences.
|
||||
- declare the typed entry after the chunk counter and current chunk: 99.114586%, 96/96 instructions, 16 differences.
|
||||
|
||||
### CHANSVmParseInt
|
||||
|
||||
- initialize parse endpoint before reading object type: 83.67347%, 49/49 instructions, 5 differences.
|
||||
- initialize parse endpoint in its declaration: 94.69388%, 49/49 instructions, 3 differences.
|
||||
- declare initialized endpoint before the byte object type: 83.67347%, 49/49 instructions, 5 differences.
|
||||
- load object type after initializing the endpoint but before parsing: 83.67347%, 49/49 instructions, 5 differences.
|
||||
- set endpoint immediately before the string conversion call: 82.244896%, 51/49 instructions, 41 differences.
|
||||
- separate the type check with an early return: 90.408165%, 51/49 instructions, 43 differences.
|
||||
|
||||
### CHANSVm_8144B4D4
|
||||
|
||||
- initialize parse endpoint before converted output allocation: 94.518074%, 83/83 instructions, 20 differences.
|
||||
- derive string length before checking its type: 96.92771%, 83/83 instructions, 13 differences.
|
||||
- declare character count beside its input byte buffer: 96.92771%, 83/83 instructions, 13 differences.
|
||||
|
||||
### VmArraySlice
|
||||
|
||||
- derive slice length after testing start before end: 96.2782%, 133/133 instructions, 56 differences.
|
||||
- fetch parent length before resetting the default start: 95.827065%, 133/133 instructions, 59 differences.
|
||||
- load source element before destination element: 88.68421%, 133/133 instructions, 60 differences.
|
||||
|
||||
### VmDateDtor
|
||||
|
||||
- use calendar fields directly for the formatting arguments: 82.12088%, 97/91 instructions, 80 differences.
|
||||
- use a scoped calendar pointer initialized at declaration: 94.96703%, 91/91 instructions, 7 differences.
|
||||
- name calendar weekday and month before formatting: 94.96703%, 91/91 instructions, 7 differences.
|
||||
|
||||
### VmStringFromCharCode
|
||||
|
||||
- declare character count before its byte position: 99.15254%, 59/59 instructions, 9 differences.
|
||||
- name the UTF16 character mask before iterating: 99.40678%, 59/59 instructions, 6 differences.
|
||||
- increment character count before byte position: 99.40678%, 59/59 instructions, 6 differences.
|
||||
- iterate characters with a for loop and explicit byte position: 99.32204%, 59/59 instructions, 7 differences.
|
||||
- derive character index from the byte cursor: 91.94915%, 57/59 instructions, 44 differences.
|
||||
- scope the decoded character over its two byte stores: 99.40678%, 59/59 instructions, 6 differences.
|
||||
|
||||
### VmStringReplace
|
||||
|
||||
- load replacement length before parent string data: 97.106064%, 132/132 instructions, 53 differences.
|
||||
- declare replacement state before search state: 97.106064%, 132/132 instructions, 53 differences.
|
||||
- advance the output position before source position: 97.181816%, 132/132 instructions, 52 differences.
|
||||
|
||||
### VmStringSplit
|
||||
|
||||
- initialize default limit before delimiter conversion: 95.14414%, 222/222 instructions, 93 differences.
|
||||
- declare delimiter length before parent length: 95.95946%, 222/222 instructions, 84 differences.
|
||||
- scope the delimiter conversion argument at method entry: 96.04955%, 222/222 instructions, 81 differences.
|
||||
|
||||
### CHANSVm_8145049C
|
||||
|
||||
- declare format buffers after string state variables: 98.58237%, 431/431 instructions, 42 differences.
|
||||
- initialize formatting buffer pointer at declaration: 97.74014%, 431/431 instructions, 70 differences.
|
||||
- declare character buffer before temporary formatted output: 98.58237%, 431/431 instructions, 42 differences.
|
||||
|
||||
### CHANSVm_81450D14
|
||||
|
||||
- add blob size before the negative relative offset: 97.391304%, 45/46 instructions, 29 differences.
|
||||
- nest the negative check inside the relative range check: 92.934784%, 47/46 instructions, 30 differences.
|
||||
- join relative offset failures at a checked error label: 86.304344%, 44/46 instructions, 29 differences.
|
||||
- share relative range validation through the negative offset entry: 97.391304%, 45/46 instructions, 29 differences.
|
||||
- handle absolute offsets before sharing the relative validation tail: 97.391304%, 45/46 instructions, 29 differences.
|
||||
- route oversized absolute offsets into the negative offset branch: 97.391304%, 45/46 instructions, 29 differences.
|
||||
- join valid absolute and normalized relative offsets before output: 97.391304%, 45/46 instructions, 29 differences.
|
||||
- return checked absolute offsets before normalizing relative offsets: 89.565216%, 50/46 instructions, 33 differences.
|
||||
- dispatch relative offset normalization through a boolean switch with correct block scope: 92.934784%, 49/46 instructions, 32 differences.
|
||||
- name the absolute offset range predicate declared before normalization: 93.804344%, 48/46 instructions, 31 differences.
|
||||
- return checked absolute offsets before normalizing relative offsets: 89.565216%, 50/46 instructions, 33 differences.
|
||||
- inline the absolute offset range predicate: 93.804344%, 48/46 instructions, 31 differences.
|
||||
- inline positive absolute offset validation: 94.13043%, 48/46 instructions, 29 differences.
|
||||
- inline explicit relative offset predicate branches: 90.434784%, 48/46 instructions, 37 differences.
|
||||
- inline an absolute offset predicate with a shared true tail: 90.76087%, 50/46 instructions, 33 differences.
|
||||
|
||||
### VmBlobFill
|
||||
|
||||
- cache the blob offset for fill count conversion: 96.82539%, 63/63 instructions, 3 differences; rejected regression in VmBlobFill.
|
||||
- declare fill count before the blob header: 100.0%, 63/63 instructions, 2 differences.
|
||||
- scope the fill destination beside memset: 100.0%, 63/63 instructions, 2 differences.
|
||||
|
||||
### VmBlobCopyRangeFrom
|
||||
|
||||
- check source offset before destination offset: 93.33088%, 139/136 instructions, 78 differences.
|
||||
- scope converted size beside the checked source and destination: 93.492645%, 139/136 instructions, 72 differences.
|
||||
- declare destination state before source state: 93.492645%, 139/136 instructions, 72 differences.
|
||||
|
||||
### VmBlobGetHexString
|
||||
|
||||
- compute second output character from the destination cursor: 98.71951%, 82/82 instructions, 14 differences.
|
||||
- increment output count after writing the hex pair: 96.15854%, 81/82 instructions, 34 differences.
|
||||
- read the hex byte once for both output digits: 92.36585%, 81/82 instructions, 36 differences.
|
||||
|
||||
### VmBlobCalcRangeSHA1Digest
|
||||
|
||||
- declare digest output before the hashing context: 96.484535%, 97/97 instructions, 14 differences.
|
||||
- scope hashing context below the checked range: 96.484535%, 97/97 instructions, 14 differences.
|
||||
- cache available range before the signed predicate: 93.40206%, 97/97 instructions, 9 differences.
|
||||
|
||||
### VmBlobCalcHMAC
|
||||
|
||||
- name data and byte count before digest storage: 99.453125%, 64/64 instructions, 7 differences.
|
||||
- capture blob input before creating the output digest: 93.34375%, 64/64 instructions, 22 differences.
|
||||
- scope output and digest below native key conversion: 99.453125%, 64/64 instructions, 7 differences.
|
||||
|
||||
### VmBlobCalcRangeHMAC
|
||||
|
||||
- keep converted size next to digest context: 99.97479%, 119/119 instructions, 3 differences.
|
||||
- use the checked offset for digest input: 98.84034%, 118/119 instructions, 33 differences.
|
||||
- scope input pointer only over digest operations: 99.72269%, 119/119 instructions, 9 differences.
|
||||
|
||||
### vmBlobParsePackFormatString
|
||||
|
||||
- update the decimal accumulator in separate arithmetic statements: 99.655174%, 116/116 instructions, 6 differences.
|
||||
- add the decoded character before the decimal subtotal: 99.69827%, 116/116 instructions, 6 differences.
|
||||
- use a separate character for parameter scanning: 98.31896%, 117/116 instructions, 35 differences.
|
||||
- promote decoded Unicode character to an unsigned word: 99.69827%, 116/116 instructions, 6 differences.
|
||||
- accumulate decimal digits with unsigned arithmetic and signed overflow check: 99.69827%, 116/116 instructions, 6 differences.
|
||||
- subtract the digit base before adding it to the decimal subtotal: 99.69827%, 116/116 instructions, 6 differences.
|
||||
|
||||
### VmBlobPackCommon
|
||||
|
||||
- derive format length by shift after obtaining its string: 92.603294%, 675/668 instructions, 642 differences.
|
||||
- declare packed integer buffer before parse counters: 92.603294%, 675/668 instructions, 642 differences.
|
||||
- reset parameter count before output element size: 92.60479%, 675/668 instructions, 642 differences.
|
||||
|
||||
### VmBlobUnpack
|
||||
|
||||
- declare packed input words before the format state: 92.083176%, 531/517 instructions, 496 differences.
|
||||
- reset output parameter before decoded element type: 92.09284%, 531/517 instructions, 496 differences.
|
||||
- initialize input word pointer at declaration: 92.083176%, 531/517 instructions, 496 differences.
|
||||
|
||||
### VmImageCtor
|
||||
|
||||
- load image payload beside callback validation: 83.0%, 25/25 instructions, 7 differences.
|
||||
- return the constructor callback directly after image validation: 58.4%, 17/25 instructions, 25 differences.
|
||||
- retain typed image storage before its payload: 99.0%, 25/25 instructions, 4 differences.
|
||||
- name the image data tested after callback lookup: 99.0%, 25/25 instructions, 4 differences.
|
||||
- check image allocation through a named data pointer: 99.0%, 25/25 instructions, 4 differences.
|
||||
- use failure tests before invoking the constructor callback: 47.8%, 17/25 instructions, 25 differences.
|
||||
- scope callback and image validation together: 99.0%, 25/25 instructions, 4 differences.
|
||||
|
||||
### VmWinEmuWrite
|
||||
|
||||
- initialize the output loop offset in a for loop: 99.62687%, 67/67 instructions, 5 differences.
|
||||
- compute aligned string length before resetting offset: 99.62687%, 67/67 instructions, 5 differences.
|
||||
- declare the total length before converted string state: 99.17911%, 67/67 instructions, 8 differences.
|
||||
- move the aligned length calculation into the loop initializer: 99.62687%, 67/67 instructions, 5 differences.
|
||||
- scope the converted string over the conversion loop: 99.62687%, 67/67 instructions, 5 differences.
|
||||
- use a decrementing byte count for loop completion: 94.10448%, 66/67 instructions, 46 differences.
|
||||
|
||||
### CHANSVmAddExe
|
||||
|
||||
- initialize header block position at declaration: 99.1063%, 254/254 instructions, 35 differences.
|
||||
- use a typed module entry during zero initialization: 99.15354%, 254/254 instructions, 34 differences.
|
||||
- increment module table byte offset in the for loop: 99.15354%, 254/254 instructions, 34 differences.
|
||||
|
||||
### CHANSVm_81455654
|
||||
|
||||
- join local and argument lookups at the result return: 88.28571%, 33/35 instructions, 18 differences.
|
||||
- declare traversal locals before initializing the lookup result: 94.0%, 34/35 instructions, 35 differences.
|
||||
- separate the typed module entry from the initially null result: 94.0%, 34/35 instructions, 35 differences.
|
||||
- return the initially null result early for negative frame indices: 76.57143%, 36/35 instructions, 36 differences.
|
||||
- keep null lookup result across module and early frame returns: 76.57143%, 36/35 instructions, 36 differences.
|
||||
- test frame base before computing signed local displacement: 82.57143%, 38/35 instructions, 38 differences.
|
||||
- place local lookup in the module lookup else branch: 94.0%, 34/35 instructions, 35 differences.
|
||||
- initialize the return header between context and module reads: 94.0%, 34/35 instructions, 35 differences.
|
||||
- join the global dereference with the module entry return: 94.0%, 34/35 instructions, 35 differences.
|
||||
|
||||
### CHANSVmLinkModules
|
||||
|
||||
- declare dispatch table before pass result: 98.677246%, 189/189 instructions, 43 differences.
|
||||
- advance module count before traversing next module: 98.677246%, 189/189 instructions, 43 differences.
|
||||
- use a for loop for module traversal: 98.677246%, 189/189 instructions, 43 differences.
|
||||
|
||||
### VmCallMethod
|
||||
|
||||
- initialize the accumulator pointer with its declaration: 97.2242%, 281/281 instructions, 97 differences.
|
||||
- declare instruction before the new program counter: 97.2242%, 281/281 instructions, 97 differences.
|
||||
- derive instruction pointer before the next program counter: 97.2242%, 281/281 instructions, 97 differences.
|
||||
|
||||
### CHANSVmStep
|
||||
|
||||
- size the operand type array for two operands: 94.81804%, 1252/1253 instructions, 1032 differences.
|
||||
- use a separate local header for indirect stores: 94.21867%, 1250/1253 instructions, 1202 differences.
|
||||
- load indirect index from copied reference header: 94.068634%, 1247/1253 instructions, 1221 differences.
|
||||
- retain logical conversion error in the shared result: 93.98883%, 1248/1253 instructions, 1231 differences.
|
||||
- convert bit-not float operand to unsigned integer: 93.98883%, 1248/1253 instructions, 1231 differences.
|
||||
- place strict blank comparison after the string case: 94.52035%, 1248/1253 instructions, 1231 differences.
|
||||
- join empty and equal strings at the strict string success flag: 94.60016%, 1249/1253 instructions, 1230 differences.
|
||||
- select the left operand type with the nonzero iteration branch: 94.59617%, 1249/1253 instructions, 1230 differences.
|
||||
- give property enumeration one checked success and error tail: 94.96488%, 1254/1253 instructions, 1234 differences.
|
||||
- put symbol load before symbol store with the target argument directions: 94.97286%, 1254/1253 instructions, 1234 differences.
|
||||
- check the lower float index bound before the upper bound: 94.97286%, 1254/1253 instructions, 1234 differences.
|
||||
- evaluate float magnitude before its sign for bit-not: 94.57781%, 1258/1253 instructions, 1216 differences.
|
||||
- return directly when binary operand conversion fails: 94.58579%, 1258/1253 instructions, 1216 differences.
|
||||
- keep the result conversion loop in the interpreter with two type slots: 94.95371%, 1254/1253 instructions, 1234 differences.
|
||||
- extract property name enumeration as an inline helper with a checked found output: 94.800476%, 1255/1253 instructions, 1215 differences.
|
||||
- use separate copied index reference objects for indirect load and store: 94.049484%, 1247/1253 instructions, 1230 differences.
|
||||
- return the boolean conversion status and use unsigned float conversion for bit inversion: 93.96967%, 1248/1253 instructions, 1240 differences.
|
||||
- share strict string equality success and place the blank case after strings: 94.58101%, 1249/1253 instructions, 1239 differences.
|
||||
- give the symbol load and store cases their target labels and source order: 94.58899%, 1249/1253 instructions, 1239 differences.
|
||||
- check lower float index bound first and return immediately on operand conversion failure: 94.59697%, 1249/1253 instructions, 1239 differences.
|
||||
- independent layout: strict blank case after strings only: 95.080605%, 1252/1253 instructions, 1029 differences; 105 data relocation differences.
|
||||
- independent layout: strict string shared success tail only: 94.90183%, 1253/1253 instructions, 917 differences; 102 data relocation differences.
|
||||
- independent layout: strict blank order and string success together: 95.164406%, 1253/1253 instructions, 896 differences; 98 data relocation differences.
|
||||
- independent layout: correct symbol labels and order only: 94.82602%, 1252/1253 instructions, 1030 differences; 108 data relocation differences.
|
||||
- independent layout: unsigned bit-not conversion only: 94.81804%, 1252/1253 instructions, 1032 differences; 108 data relocation differences.
|
||||
- independent layout: logical status assignment only: 94.73823%, 1253/1253 instructions, 1106 differences; 115 data relocation differences.
|
||||
- independent layout: strict order with correct symbol cases: 95.088585%, 1252/1253 instructions, 1027 differences; 105 data relocation differences.
|
||||
- independent layout: strict order and unsigned inversion with symbol cases: 95.088585%, 1252/1253 instructions, 1027 differences; 105 data relocation differences.
|
||||
- independent layout: all strict equality fixes with symbol cases: 95.172386%, 1253/1253 instructions, 894 differences; 98 data relocation differences.
|
||||
- independent layout: strict equality and symbols with boolean status: 95.092575%, 1254/1253 instructions, 1201 differences; 121 data relocation differences.
|
||||
|
||||
## Additional table and context experiments
|
||||
|
||||
- Extracted VmGetResultType as a static inline helper with two type slots. Fully inlined; no extra function emitted. Intermediate Step result was 94.77414%, 1249/1253 instructions. Restored because later variants left 121 table relocation differences.
|
||||
- Made VmResultTypeTbl internal, then the undefined-string objects and result table internal together. Constant bases still loaded independently; no useful change. Restored.
|
||||
- Grouped existing string headers, constants, keywords, conversion functions and result matrices in a typed aggregate. Step reached 95.49242%, but aggregate tail alignment grew .rodata by four bytes and source token order moved the short NaN literal. The gate found nine regressions. Restored; no aggregate, artificial packing, or padding remains.
|
||||
- Changed the opaque HMAC context byte buffer to word storage after inspecting SDK word accesses. Range HMAC still had the same three stack-address differences, and full HMAC still had seven register differences. Restored. No alignment field was fabricated.
|
||||
- Reversing the bit-not magnitude/sign multiplication operands added four instructions and lowered Step to 94.57781%. Restored.
|
||||
- The excluded FromCharCode declaration trial added an unused offset and stayed at 99.40678%. It does not count toward the three-attempt requirement.
|
||||
|
||||
## Failed compilations
|
||||
|
||||
- VmImageCtor: retain image storage pointer before dereferencing it; illegal implicit conversion from 'void **' to; restored.
|
||||
- CHANSVm_81455654: use a separate module entry from the initially null result; illegal implicit conversion from 'struct ModuleEntry *' to; restored.
|
||||
- CHANSVmParseInt: declare initialized endpoint before object type; undefined identifier 'endPtr'; restored.
|
||||
- CHANSVmGetSourceLine: derive the line table byte address once at the range check; expression syntax error; restored.
|
||||
- CHANSVmParseInt: initialize endpoint before the object type declaration with matching type; undefined identifier 'endPtr'; restored.
|
||||
- CHANSVm_81450D14: dispatch relative offset normalization through a boolean switch; illegal use of keyword; restored.
|
||||
- CHANSVm_81450D14: name the absolute offset range predicate before normalization; expression syntax error; restored.
|
||||
- VmStringFromCharCode: name the string storage separately for each byte store; illegal implicit conversion from 'char *' to; restored.
|
||||
|
||||
## Validation
|
||||
|
||||
Focused object builds, ctxdiff, the string-pool check, and canonical ELF relocation audits were run. The selected quick gate passed with zero regressions, zero added forbidden patterns, and zero net readability warnings. The final full gate passed. Its output follows.
|
||||
|
||||
```text
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[src/channelScript/CHANSVm] pool: IDENTICAL
|
||||
[src/channelScript/CHANSVm] objdiff: code 32400/53564 data 2232/6904 functions 207/233 fuzzy 98.3831 linked code 0
|
||||
[src/channelScript/CHANSVm] instruction-exact functions: 206/233
|
||||
[src/channelScript/CHANSVm] section .data size 4672 match 18.050066
|
||||
[src/channelScript/CHANSVm] section .rodata size 1432 match 100.0
|
||||
[src/channelScript/CHANSVm] section .sbss size 16 match 100.0
|
||||
[src/channelScript/CHANSVm] section .sdata size 600 match 100.0
|
||||
[src/channelScript/CHANSVm] section .sdata2 size 184 match 100.0
|
||||
[src/channelScript/CHANSVm] section .text size 53564 match 98.383095
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmGetSourceLine 97.82609
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmNewObjData 99.427086
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmParseInt 94.69388
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_8144B4D4 96.92771
|
||||
[src/channelScript/CHANSVm] below 100: VmArraySlice 96.2782
|
||||
[src/channelScript/CHANSVm] below 100: VmDateDtor 94.96703
|
||||
[src/channelScript/CHANSVm] below 100: VmStringFromCharCode 99.40678
|
||||
[src/channelScript/CHANSVm] below 100: VmStringReplace 97.106064
|
||||
[src/channelScript/CHANSVm] below 100: VmStringSplit 96.04955
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_8145049C 98.58237
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_81450D14 97.391304
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCopyRangeFrom 93.492645
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobGetHexString 98.71951
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcRangeSHA1Digest 96.484535
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcHMAC 99.453125
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobCalcRangeHMAC 99.97479
|
||||
[src/channelScript/CHANSVm] below 100: vmBlobParsePackFormatString 99.69827
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobPackCommon 92.603294
|
||||
[src/channelScript/CHANSVm] below 100: VmBlobUnpack 92.083176
|
||||
[src/channelScript/CHANSVm] below 100: VmImageCtor 99.0
|
||||
[src/channelScript/CHANSVm] below 100: VmWinEmuWrite 99.62687
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmAddExe 99.1063
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVm_81455654 94.0
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmLinkModules 98.677246
|
||||
[src/channelScript/CHANSVm] below 100: VmCallMethod 97.2242
|
||||
[src/channelScript/CHANSVm] below 100: CHANSVmStep 95.172386
|
||||
[src/channelScript/CHANSVm] baseline: code 32400/53564 data 2232 functions 207 fuzzy 98.3499
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 72.81211 -> 72.81211
|
||||
global fuzzy_match_percent: 82.03284 -> 82.03342
|
||||
global complete_code_percent: 56.76068 -> 56.76068
|
||||
global matched_data_percent: 86.27674 -> 86.27674
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
89
tools/decomp-assist/NWC24MBoxCtrl.attempts.md
Normal file
89
tools/decomp-assist/NWC24MBoxCtrl.attempts.md
Normal file
@@ -0,0 +1,89 @@
|
||||
# NWC24MBoxCtrl matching attempts
|
||||
|
||||
Baseline: no source, 0/25 exact functions, 0/10604 matched code bytes.
|
||||
The implementation includes all 25 target functions and ordinary literals in target pool order.
|
||||
|
||||
## Remaining functions
|
||||
|
||||
- NWC24iIsMsgObjReadable: direct field checks, signed flags temporary, and explicit Boolean result each retain 57/57 instructions with five prologue scheduling differences. Nested validity checks produce ten differences. Best 92.98245%.
|
||||
- NWC24GetMsgIdList: separate call errors from the scan result restores 153/153 instructions. Moving path before entry leaves 28 differences. Moving the result before counters yields 36 differences. Counter/result/cursor/entry declaration ordering reduces this to 21 register differences. Best 99.24837%.
|
||||
- NWC24iMBoxCheck: switch to ordered if/else and precompute required capacity gives 68/68 instructions with 26 differences. A separate required-size temporary gives 66/68 instructions; the target retains an oldest-ID stack store and reload. Header/oldest declaration ordering and an output pointer temporary both retain the earlier 26 differences. Best 96.92647%.
|
||||
- DeleteMsg: the initial scan has 297/296 instructions. Separating seek/read errors from the persistent search result gives 291/296 and 76.73987%. Moving the matching-ID branch before oldest-ID selection gives 297/296 and 91.5304%. Reordering count/oldest/offset declarations leaves the initial score unchanged. Remaining differences include scan error flow, ID comparison scheduling, stack allocation, and registers.
|
||||
- DuplicationCheck: the initial predicate has 223/222 instructions and 88.95045%. Separating the application-ID predicate gives 220/222 and 90.32883%. A separate duplicate Boolean gives 251/222 and 75.38739%. Reordering counters retains the initial score. Remaining differences include candidate predicate branches and register allocation.
|
||||
|
||||
## Exact results
|
||||
|
||||
20/25 functions, 7420/10604 matched code bytes. Each exact function also has zero ctxdiff differences.
|
||||
Scalar assignments with explicit packed-field temporaries match both conversion functions. Splitting user-ID accesses into high/low words fixes their register ordering. The corresponding shared-header view is guarded by NWC24_MBOX_CTRL, defined only in this source.
|
||||
Cached-header lifetimes, file declaration order, explicit close-error returns, and separate send-file status resolve the control/header/open/close functions. Inline header-write and forced-unmount helpers reproduce the target lifetimes without assembly or uninitialized values.
|
||||
|
||||
The eight strings are identical in pool order. .data and .sdata are 100%; .sbss scores 50%. MountInfo is an eight-byte count/type structure, while the extracted target labels its first four bytes and leaves the second word unnamed. No symbol-size or placement edits were made.
|
||||
|
||||
## Continuation after the first merge
|
||||
|
||||
Starting point: 20/25 instruction-exact functions, 7420/10604 matched code bytes,
|
||||
184/192 matched data bytes. All five previously open functions received at least
|
||||
three distinct source-level attempts in this continuation.
|
||||
|
||||
### Newly exact functions
|
||||
|
||||
- NWC24GetMsgIdList: indexing the output by count replaces the explicit cursor
|
||||
and reduces register differences from 21 to 19. Separating offset/count
|
||||
declarations gives eight differences. Declaring the path before the errors
|
||||
gives four differences; putting it between the persistent result and the
|
||||
transient errors gives zero differences, 153/153 instructions, 100%.
|
||||
An inline open helper was also tried; it left five differences, including
|
||||
an error-branch destination, and was discarded.
|
||||
- DeleteMsg: keeping seek/read/protection failures in the persistent scan result
|
||||
corrects the scan's exit paths. Using the existing inline header writer for
|
||||
both recovery and final flush gives 296/296 instructions. Result/counter/entry
|
||||
declaration order then reduces 41 register differences to 25, 16, and 12.
|
||||
Reusing the consumed protection/type arguments for completion status and
|
||||
ordering the scan declarations gives zero differences, 100%. Named completion
|
||||
helpers were tried as alternatives: a header-value helper gives 78 differences,
|
||||
a header-reference helper gives eight, and a clear/delete helper gives ten.
|
||||
Separate named completion errors give nine differences. None was retained.
|
||||
- DuplicationCheck: explicit candidate initialization gives 94.27928%; separate
|
||||
tag/content duplicate branches give 91.927925%; putting the message-count
|
||||
limit inside the scan gives 93.07658%. Combining those changes gives
|
||||
98.62613%, 223/222 instructions. A positive final duplicate branch removes
|
||||
the extra instruction, giving 99.12162%, 222/222. Moving the error before
|
||||
counters and ordering offset/count/duplicate-ID/duplicate-offset/oldest/entry
|
||||
declarations then gives zero differences, 100%. Date comparisons use the
|
||||
signed comparison shown in the target.
|
||||
|
||||
### Functions still open
|
||||
|
||||
- NWC24iIsMsgObjReadable: an immutable message-pointer local, a separate
|
||||
private-message pointer view, and a copied entry parameter retain five
|
||||
prologue scheduling differences, 57/57 instructions, 92.98245%. A cached type
|
||||
scalar gives 58/57 instructions and 90.61404%. Combining type validity checks
|
||||
gives 55/57 and 89.29825%. A nested LED-validity body gives 57/57 but 41
|
||||
differences, 85.789474%. An inline readability helper retains the five
|
||||
differences. The target stores LR/r31 and copies the argument before loading
|
||||
type; MWCC schedules the load and mask among those prologue instructions.
|
||||
- NWC24iMBoxCheck: an oldest-ID wrapper, a one-element output array, and a
|
||||
returned output pointer retain 66/68 instructions and 96.92647%. Grouping
|
||||
the cached header and oldest ID in a mailbox local gives 67/68 instructions,
|
||||
98.382355%; reversing the fields gives 98.30882%. A direct oldest-ID
|
||||
assignment gives 96.92647%. Copying the ID through memcpy or Mail_memcpy
|
||||
gives 70/68 instructions and 90.867645%. The retained mailbox local restores
|
||||
the target's oldest-ID store and header stack offset, but MWCC forwards the
|
||||
stored value into r4 rather than emitting the target's subsequent load.
|
||||
|
||||
### Data verification
|
||||
|
||||
The eight strings remain identical in pool order. .data and .sdata each score
|
||||
100%. The compiler emits 166/12 bytes versus extracted 168/16 bytes respectively;
|
||||
the target's additional trailing bytes are alignment zeros. The eight .sbss
|
||||
bytes are byte-identical zeros. The sole MountInfo symbol has size eight in the
|
||||
compiled object, whereas the extraction labels only the first four bytes.
|
||||
Target instructions access the type using MountInfo plus its four-byte field
|
||||
position. Its real count/type structure therefore remains eight bytes; the
|
||||
extracted symbol boundary accounts for the 50% .sbss score. No symbol metadata,
|
||||
placement directive, extra object, or other unit was changed.
|
||||
|
||||
Current result: 23/25 instruction-exact functions, 10104/10604 matched code
|
||||
bytes, 184/192 matched data bytes. All 23 exact functions have zero ctxdiff
|
||||
differences. The two open functions and extracted MountInfo extent remain
|
||||
unresolved.
|
||||
99
tools/decomp-assist/NWC24MsgCommit.attempts.md
Normal file
99
tools/decomp-assist/NWC24MsgCommit.attempts.md
Normal file
@@ -0,0 +1,99 @@
|
||||
# NWC24MsgCommit matching attempts
|
||||
|
||||
Baseline: no source, 0/18 functions, 0/8532 code bytes, 0/904 data bytes.
|
||||
All 18 functions are implemented in target object order. The private header's
|
||||
additional mailbox/message views are guarded by NWC24_MSG_COMMIT, defined only
|
||||
in this source. NWC24_MBOX_CTRL retains its existing view.
|
||||
|
||||
## Remaining functions
|
||||
|
||||
- NWC24CommitMsgInternal: the initial implementation has 781/827 instructions,
|
||||
82.8549%. A signed initialization index, swapping subject/text declarations,
|
||||
and inclusive file-error bounds were tested separately. Separating the overall
|
||||
result from each write's status gives 812/827 instructions, 88.46554%. Generic
|
||||
optional field writers give 826/827, 90.1052%; individual command/tag/DWC/icon
|
||||
inline writers give 817/827, 92.53204%. Moving cancellation before object
|
||||
publication gives 818/827, 94.54534%. Combining unsigned attachment iteration,
|
||||
partial-write byte accounting, subject/text declaration order, and inclusive
|
||||
status bounds gives 94.71463%. A separate inline message-ID writer gives
|
||||
94.72672%, 818/827. Remaining differences involve write/error control flow,
|
||||
formatting temporaries, and register allocation.
|
||||
- CheckMsgBoxSpace: the initial estimate gives 223/223 instructions, 85.57399%.
|
||||
Splitting the base64 estimate into three accumulation statements gives
|
||||
78.098656%, 109 differences. Signed accumulation counters give 86.13453%,
|
||||
76 differences, but change the final unsigned capacity comparison. Moving
|
||||
the per-attachment size temporary outside the scan gives 85.57399%,
|
||||
75 differences. The final source keeps unsigned counters and the original
|
||||
unsigned overflow comparison. Remaining differences are chiefly scheduling
|
||||
and allocation in the compiler's eight-way unrolled attachment estimate.
|
||||
- WriteToField: deferring field-counter initialization gives 99.71111%,
|
||||
90/90 instructions, six differences. An inclusive capacity check reduces this
|
||||
to four differences, 99.77778%. Moving the cursor before the buffer, moving
|
||||
the buffer after the counters/length/error, and separating initialization
|
||||
from declaration retain those four differences. An explicit recipient
|
||||
pointer gives 98.977776%, 14 differences; moving the cursor declaration after
|
||||
the length gives 97.5%, 36 differences. The remaining four differences select
|
||||
r24 instead of r25 for the initial scratch buffer, before recipient iteration.
|
||||
- WriteMIMEAttachHeader: the initial form gives 92/92 instructions, 86.815216%,
|
||||
53 differences. Reloading the work buffer after clearing gives 92.41304%,
|
||||
25 differences. Nonpositive format-count checks give 87.01087%. Computing
|
||||
the first two formatted counts before the final format gives 91/92
|
||||
instructions. Advancing the cursor before that sum restores 92/92 and gives
|
||||
97.33696%, eight differences. Combining template lengths before reading the
|
||||
MIME-name length gives 99.45652%; grouping the final template sum gives
|
||||
99.51087%, seven differences. Reusing template-length temporaries for
|
||||
formatted lengths and reordering those declarations do not resolve them.
|
||||
Remaining differences are the template-sum schedule and register choices.
|
||||
- WriteQPData: the initial form gives 60/60 instructions, 98.333336%,
|
||||
19 differences. Signed total and reversed encoded/consumed-count declarations
|
||||
give 98.5%, 13 differences. An input cursor declared before the total gives
|
||||
98.833336%, ten differences. Separating the remaining-byte count gives 99%,
|
||||
nine differences. Moving the error/counters/output pointer and trying cursor
|
||||
declarations before/after those locals were also tested. The remaining nine
|
||||
differences are callee-saved register choices; instruction count matches.
|
||||
|
||||
## Exact objdiff results
|
||||
|
||||
13/18 functions, 3364/8532 code bytes. The exact functions are NWC24CommitMsg,
|
||||
CheckMsgObject, SynthesizeAddrStr, WriteSMTP_MAILFROM, WriteSMTP_RCPTTO,
|
||||
WriteFromField, WriteDateField, WriteXWiiAppIdField, WriteXWiiFaceField,
|
||||
WriteXWiiAltNameField, WriteContentTypeField, WritePlainText, and WriteBase64Data.
|
||||
|
||||
Declaration/lifetime changes resolve loopback, address synthesis, recipient
|
||||
iteration, application flags, folded base64 headers, and content headers.
|
||||
Advancing the synthesized-address cursor and caching the complete field length
|
||||
resolve the SMTP sender and From header. A while loop with explicit cursor and
|
||||
remaining-byte updates resolves the base64 writer. Inclusive validation bounds
|
||||
resolve message validation and the Date header.
|
||||
|
||||
The gate counts 11 instruction-exact functions. Its disassembler and ctxdiff
|
||||
misnormalize the two cr1 branches in each of WriteSMTP_MAILFROM and
|
||||
WriteFromField: odiff.dis reads operands[0].imm as the target even when the first
|
||||
operand is the condition-register field. These functions are at different unit
|
||||
positions while the preceding commit function remains short. Direct .text byte
|
||||
comparison confirms all 232/256 bytes respectively are identical to the target;
|
||||
objdiff reports both at 100%. No tool or target metadata was edited to bypass
|
||||
that count. All other eleven exact functions have zero ctxdiff differences.
|
||||
|
||||
## Data
|
||||
|
||||
pool_diff and the gate report identical pools. Every long string occupies its
|
||||
target .data offset, and the twelve-month table is at 0x140 in source order.
|
||||
The unrelocated .data bytes match the complete 678-byte source prefix of the
|
||||
680-byte target; the remaining target bytes are alignment zeros. The twelve
|
||||
month-pointer relocations are present in both objects. The target extraction
|
||||
combines the first thirteen strings into one 296-byte symbol, whereas MWCC
|
||||
emits individual literal symbols. The table's small-string destinations also
|
||||
retain the .sdata offset differences below. Objdiff does not score .data as
|
||||
matched despite the identical raw prefix; its relocations/symbol grouping
|
||||
remain open.
|
||||
|
||||
.bss MultiPartDivider is 64 bytes and matches 100%. .sbss m_pFile matches 100%.
|
||||
.sdata scores 18.765432%. Its first difference is byte four: the target's
|
||||
LoopBackEnable symbol includes a trailing zero word, whereas the source's
|
||||
ordinary BOOL definition is four bytes. The target also contains separate
|
||||
subject and multipart CRLF literals; MWCC pools the source literals together.
|
||||
The source .sdata is 140 bytes versus the target's 152 bytes, including trailing
|
||||
section alignment. No extra object, packed string blob, alignment directive,
|
||||
symbol-size change, or placement trick was introduced to cover these gaps.
|
||||
Total matched data is 72/904 bytes. These data-layout differences remain open.
|
||||
224
tools/decomp-assist/iplCardSequence.attempts.md
Normal file
224
tools/decomp-assist/iplCardSequence.attempts.md
Normal file
@@ -0,0 +1,224 @@
|
||||
# iplCardSequence matching attempts
|
||||
|
||||
Baseline: absent source, 0/30 exact functions, 0/9852 exact code bytes.
|
||||
Started from /tmp/iplCardSequence.candidate98.cpp and replaced all raw thread
|
||||
field offsets with CardThreadState members and ordinary array indexing.
|
||||
Reused FileInfo, CardState and IconState from iplMemoryCardLib.h. The inline
|
||||
request helpers use the existing public signatures. Only this CPP defines
|
||||
IPL_CARD_SEQUENCE_CPP; its guarded shutdown return declaration is BOOL.
|
||||
|
||||
CardThreadState models the actual queues, OS thread, stack, file handles,
|
||||
allocated buffers, per-file arrays and completion state. The embedded comment
|
||||
read buffer is aligned to 32 bytes for CARDRead, giving the original 0xDBE0
|
||||
allocation size without dummy members or explicit filler bytes.
|
||||
|
||||
Initial typed reconstruction: 23/30 exact functions, 3248/9852 exact code bytes.
|
||||
All 43 strings were identical on the first build. After subsequent ordinary
|
||||
code restructuring, every data section scores 100%: .data 1464, .bss 16,
|
||||
.sbss 8 and .sdata 8 bytes. No new address symbols or artificial data exist.
|
||||
|
||||
## sendCardCopyCmd / sendCardMoveCmd / sendCardDeleteCmd
|
||||
|
||||
Each experiment was applied to all three functions; they differ only in the
|
||||
command byte. All retained versions have 21/21 instructions, two differences:
|
||||
the ori into the message register and li r5,0 occur in the opposite order.
|
||||
|
||||
1. Initial packed high-byte message plus command at the send call: two differences.
|
||||
2. Included command in the initial message expression: eight differences,
|
||||
different packing instruction order and registers.
|
||||
3. Used the public void signature and a final send statement: two differences.
|
||||
4. Factored a real sendFileCommand inline helper: compiler emitted an out-of-line
|
||||
helper, reducing wrappers to three instructions; reverted.
|
||||
5. Packed file/slot/command with a union and bitfields: 22/21 instructions,
|
||||
rlwimi and a register copy instead of the original ori.
|
||||
6. Used addition of the command byte: 21/21, twelve differences, addi instead
|
||||
of ori and different registers; reverted.
|
||||
7. Separate final message |= command statement: same two differences.
|
||||
Retained this clear form. Each final function is 90.47619%.
|
||||
|
||||
## initCardThread
|
||||
|
||||
1. Typed arrays indexed by a signed byte index divided by four: 173/167
|
||||
instructions, 90.69461%; signed division introduced srawi/addze.
|
||||
2. Native array element index: 167/167, 27 differences. All differences are
|
||||
in the two pointer-array initialization loops.
|
||||
3. Ordinary ascending for loops and direct expressions in the second loop:
|
||||
167/167, 19 differences; second loop now matches.
|
||||
4. Computed both buffer pointers before either store: 166/167; commoned loads
|
||||
unlike the original; reverted the hoisting.
|
||||
5. Unsigned image offset, comment offset and array index: still 167/167,
|
||||
same 19 register differences in the first initialization loop.
|
||||
Final: 98.952095%; first-loop register allocation remains open.
|
||||
|
||||
## CardSequence_813D2C8C
|
||||
|
||||
1. Typed fields and a command | (validState << 8) response: 300/301 instructions,
|
||||
98.106316%; compiler folded the response into ori rather than rlwimi.
|
||||
2. Union response with an eight-bit validity field: 301/301, 78 differences.
|
||||
Remaining differences are saved registers and response assembly scheduling.
|
||||
3. Extracted sendValidityResponse as a real inline helper: identical 301/301
|
||||
result and 78 differences. Retained this readable packing helper.
|
||||
Final: 97.9402%; saved-register assignment and three response instructions differ.
|
||||
|
||||
## CardSequence_813D3424
|
||||
|
||||
1. Typed icon and pointer tables: 514/512 instructions, 87.08008%; signed
|
||||
conversion of the byte palette offset introduced extra arithmetic, plus
|
||||
different register allocation and image/comment error branches.
|
||||
2. Inverted the comment-range boundary checks into a normal nested success
|
||||
path: 509/512, 86.47461%; changed branch layout and error joins.
|
||||
3. Indexed iconOffset by the real iconCount rather than dividing a byte
|
||||
offset by four: 499/512, 87.23633%; removed the artificial signed-division
|
||||
work and retained direct struct fields. Original helper/error boundaries
|
||||
and register allocation still differ.
|
||||
Final: 87.23633%; 499/512 instructions. Original code appears to retain
|
||||
inlined helper return/error joins that this reconstruction optimizes away.
|
||||
|
||||
## CardSequence_813D3D14
|
||||
|
||||
1. Typed thread fields with the original nested stages: 608/608, 97.804276%;
|
||||
186 differences, mostly saved registers, plus metadata error joins,
|
||||
move-loop branch target and cleanup sign extensions.
|
||||
2. Full-width destinationFileNo until API calls: 606/608, 97.458885%;
|
||||
removed two original instructions and changed allocation; reverted.
|
||||
3. Structured nested sector-size checks instead of label-based checks:
|
||||
604/608, 96.43915%; eliminated additional original branches; reverted.
|
||||
Final: retained the first 608/608 version, 97.804276%.
|
||||
|
||||
No remaining function lacks three distinct source-level attempts. No other
|
||||
translation unit changes its output. Configure.py remains NonMatching.
|
||||
|
||||
## Continuation after the first merge
|
||||
|
||||
Baseline: 23/30 exact functions, 3248/9852 exact code bytes, all 1496 data
|
||||
bytes exact. Pool remains identical (43 strings). Every experiment below was
|
||||
built as the owned object and inspected with ctxdiff; discarded variants are
|
||||
absent from the final diff. Shared headers are unchanged in this continuation.
|
||||
|
||||
### initCardThread
|
||||
|
||||
1. Integer address temporaries for the allocated image/comment buffers:
|
||||
167/167 instructions, unchanged 19 register differences. Reverted casts.
|
||||
2. Descending remaining-count loop with a byte index divided by sizeof(pointer):
|
||||
168/167 instructions; added an index mask and changed allocation. Reverted.
|
||||
3. Named typed destination-entry pointers and reversed pointer-addition operands:
|
||||
167/167, unchanged 19 register differences. Reverted.
|
||||
4. Compute both buffer offsets directly from the native file index instead of
|
||||
maintaining two separate offset accumulators: 167/167, diffs 0. Retained.
|
||||
Both pointer-array loops now match and obsolete offset locals are removed.
|
||||
|
||||
### CardSequence_813D2C8C
|
||||
|
||||
1. Reused one file-index variable for the mount scan, listing and delete cases:
|
||||
301/301, 73 differences versus the baseline 78. Saved-register assignments
|
||||
and response assembly ordering still differ. Reverted for the focused diff.
|
||||
2. With the unified index, changed thread validity and exit flags to bool:
|
||||
301/301, same 73 differences. Reverted.
|
||||
3. Initialized the response union to zero, then assigned its command field:
|
||||
302/301, additional packing instruction. Reverted.
|
||||
|
||||
### CardSequence_813D3D14
|
||||
|
||||
1. Separate scoped result for the copy-metadata phase: 608/608, 185 differences
|
||||
versus baseline 186; still saved registers and branch destinations. Reverted.
|
||||
2. Copy-metadata phase as a single-iteration loop with explicit failure breaks
|
||||
and a common result check: 608/608, 182 differences. Pool identical. Reverted.
|
||||
3. Moved move-stage initialization after the CARDDir assignment in that variant:
|
||||
608/608, 189 differences. Reverted.
|
||||
|
||||
### sendCardCopyCmd / sendCardMoveCmd / sendCardDeleteCmd
|
||||
|
||||
All variants were applied to all three command functions.
|
||||
|
||||
1. Real inline makeFileRequest packing helper shared by the three wrappers:
|
||||
compiler kept it out of line; each wrapper became 29/21 instructions.
|
||||
Reverted. This helper is different from the earlier sendFileCommand helper:
|
||||
it only computes a packet and performs no shared-state writes or OS calls.
|
||||
2. Separate OSMessage request and BOOL nonblocking flags locals: 21/21,
|
||||
unchanged two instruction-order differences. Reverted.
|
||||
3. Union file/slot fields followed by OR into its value: 21/21, nine differences
|
||||
involving packing registers and the same ori/li ordering. Reverted.
|
||||
4. Template packet encoder specialized by command: inlined, 21/21, four
|
||||
differences (two packing instructions and the same ori/li ordering). Reverted.
|
||||
|
||||
### CardSequence_813D3424
|
||||
|
||||
1. Named IconState reference spanning the whole function: 362/512 instructions;
|
||||
compiler cached its address and eliminated many original global reloads.
|
||||
Reverted.
|
||||
2. Named IconState reference limited to the animation/format loops: 438/512;
|
||||
same address-caching issue within that region. Reverted.
|
||||
3. Extracted a real single-use inline readComment helper with sector-size and
|
||||
range checks, read, copy and error clearing: inlined to 499/512, different
|
||||
allocation/error boundaries. Reverted.
|
||||
|
||||
Retained only the instruction-exact initCardThread change. Every remaining
|
||||
function has three new distinct attempts in this continuation. All data
|
||||
sections and the complete pool remain exact; no DOL link investigation.
|
||||
|
||||
## Continuation after the second merge
|
||||
|
||||
Baseline: 24/30 exact functions, 3916/9852 exact code bytes, 1496/1496 data
|
||||
bytes. The pool is identical at 43 strings. The three long functions were
|
||||
examined in decreasing baseline score; command packing experiments followed.
|
||||
Every variant below was built as the owned object and inspected with ctxdiff.
|
||||
|
||||
### CardSequence_813D2C8C
|
||||
|
||||
1. Unified mount, listing and delete file indices and widened the slot local
|
||||
to u32: 301/301 instructions, 70 differences versus the baseline 78.
|
||||
Saved registers and validity-response scheduling still differ. Reverted.
|
||||
2. Reused the slot and result locals for the free-space scan rather than
|
||||
separate outerSlot/freeBlocks locals: 301/301, 69 differences. Reverted.
|
||||
3. Made the validity flag u8 and passed its value to the validity report:
|
||||
301/301, unchanged 78 differences. Reverted.
|
||||
|
||||
### CardSequence_813D3D14
|
||||
|
||||
1. Native bool flags for temporary creation, metadata completion and cancel:
|
||||
608/608 instructions, unchanged 186 differences. Reverted.
|
||||
2. Scoped permissionResult for the initial permission check, independent of
|
||||
the transfer result: 608/608, 177 differences. Initial saved-register
|
||||
assignments, metadata joins and cleanup conversions remain different.
|
||||
Reverted for the focused final diff.
|
||||
3. With the scoped permission result, used a full-width destination result,
|
||||
explicit s16 conversions when accepting the creation result and at file
|
||||
APIs: 608/608, same 177 differences. Reverted.
|
||||
|
||||
### sendCardCopyCmd / sendCardMoveCmd / sendCardDeleteCmd
|
||||
|
||||
Each variant was applied to all three commands. The final mask expression
|
||||
was checked independently for each symbol: 21/21 instructions, diffs 0.
|
||||
|
||||
1. Packed the slot first in a union value, then assigned its file byte:
|
||||
21/21, 11 differences in packing registers and instruction ordering.
|
||||
2. Shared inline sendFileRequest helper for the final OR and nonblocking
|
||||
queue send: inlined, 21/21, unchanged two scheduling differences.
|
||||
3. Signed message temporary: 21/21, unchanged two differences.
|
||||
4. Separate masked slot temporary: 21/21, eight packing/scheduling differences.
|
||||
5. Explicit file-byte temporary: 21/21, unchanged two differences.
|
||||
6. Separate initial slot assignment and OR of the shifted file byte:
|
||||
21/21, 11 differences. Reverted.
|
||||
7. Explicit unsigned file mask before shifting, replacing the narrowing byte
|
||||
cast: 21/21, diffs 0 for Copy, Move and Delete. Retained. Both express the
|
||||
same file-byte truncation; the mask produces the original li/ori order.
|
||||
|
||||
### CardSequence_813D3424
|
||||
|
||||
1. Corrected the eighth-icon palette destination to icons[slot][fileNo].
|
||||
The original at 813D384C adds the selected icon offset before storing
|
||||
iconTlutOffset at 813D385C. The previous icons[0][0] destination was wrong.
|
||||
499/512 instructions; objdiff improves from 87.23633% to 87.92969%.
|
||||
Retained this behavior correction.
|
||||
2. Moved iconCount and shift increments to the common bottom of the format
|
||||
loop: 499/512, objdiff improves further to 89.44531%. The source now
|
||||
expresses the shared loop continuation directly. Retained.
|
||||
3. Extracted the sector-size checks, image read/copy and invalid-image clearing
|
||||
into a real inline readCardImages helper: inlined to 480/512 instructions.
|
||||
Pool identical; more original error-path instructions were optimized away.
|
||||
Reverted.
|
||||
|
||||
The final diff retains three exact command functions and the palette destination
|
||||
correction and shared loop continuation. All remaining functions have at least
|
||||
three new distinct attempts.
|
||||
Shared headers and configure.py are unchanged. All data sections remain exact.
|
||||
64
tools/decomp-assist/iplGCWindow.attempts.md
Normal file
64
tools/decomp-assist/iplGCWindow.attempts.md
Normal file
@@ -0,0 +1,64 @@
|
||||
# GCWindow attempts
|
||||
|
||||
Baseline: no source, 0/48 matched functions, 0/9964 matched code bytes, 0/2032 matched data bytes.
|
||||
|
||||
## init
|
||||
|
||||
1. Recovered the constructor, state machine and initialization from original object disassembly and `/tmp/iplGCWindow.ghidra.txt`. Reused existing MemoryBase, MemoryCardManager and PaneManager headers. Initial initialization generated 197/198 instructions. The title dimensions and interpolation duration were restored to their original constants, 450, 31 and 12.
|
||||
2. Corrected the local getBlocks declaration to a full-width result under IPL_GC_WINDOW_CPP, moved decimal writes into thousands-to-units order and used a separate source expression for wcscpy. Generated 198/198 instructions, 87 differing positions. This declaration preserves the target caller's truncation after the digit-table copy.
|
||||
3. Split the packed working buffer into three named arrays and used memcpy plus explicit zeroing loops. Generated 199/198 instructions; memcpy remained a call and zeroing remained loops. Rejected.
|
||||
4. Initialized a local digit array with ordinary character literals and used aggregate zero initialization for the decimal/output arrays. Generated 199/198 instructions; all digit copying and decimal arithmetic operations appeared in target order, with register differences and one extra address instruction.
|
||||
5. Named the interpolated position before finding the pane. Generated 198/198 instructions, 48 differing positions. Differences are register allocation in decimal conversion and the exchanged stack slots of the zero and interpolated vectors. Kept this readable version.
|
||||
6. Separated the truncated block count and introduced a named thousands quotient. Neither changed allocation or instruction counts; removed the unnecessary quotient variable.
|
||||
|
||||
## onMemEvent
|
||||
|
||||
1. Literal event/state/operation switches generated 153/155 instructions. The target retains two additional unconditional branches just before the common process-completion block.
|
||||
2. Added an explicit outer default case. Same 153/155 instructions and missing branches; rejected.
|
||||
3. Separated process completion behind a named label, with the idle format-state case before that label. Same 153/155 instructions; rejected.
|
||||
4. Inverted the deletion-slot test into an early return and added an explicit inner default. Same 153/155 instructions; kept the early-return version for clarity.
|
||||
|
||||
## Data and declarations
|
||||
|
||||
The first 38 data-pool strings have the target order and offsets. The last 12 target strings belong to the unused SavedataEditWindow configuration: ten animation filenames, T_Block_01 and a second T_Del_00. The ordinary static animation table is present in source, but MWCC eliminates it and its strings because no surviving function references it. No retention trick or filler was added.
|
||||
|
||||
The GCWindow vtable is emitted naturally. Its original object symbol includes 32 trailing zero bytes; the MemCardEventHandler symbol includes further linker-discarded zero-filled weak artifacts. Those are not reproduced with padding. The other data sections match in objdiff.
|
||||
|
||||
SavedataEditWindow's virtual lifecycle names are inferred: init, calc, draw, destroy. The observed final lifecycle slot is 0x5c, and calc invokes it when fadeout completes; all seven surviving SavedataEditWindow functions match instruction-exactly. The initializer signature and unused lifecycle methods need confirmation before that class is instantiated. Its event pointer field is inferred from the corresponding memory-window layout.
|
||||
|
||||
No other unit is switched to Matching, no other source is changed, and shared-header declarations are guarded by IPL_GC_WINDOW_CPP, defined only by iplGCWindow.cpp.
|
||||
|
||||
## Continuation from c77b866e
|
||||
|
||||
Starting measurements: 46/48 instruction-exact functions, 8552/9964 code bytes, 248/2032 data bytes, 38/50 pool strings.
|
||||
|
||||
### Pool and constructor
|
||||
|
||||
The original object's .rela.text, .rela.rodata and .rela.data contain no references into the twelve trailing strings at .data offsets 0x444 through 0x597. The only reference to the encompassing lbl_81652C50 symbol is the preceding WIPL_SE_COPY_FINISH literal. Therefore no surviving target function uses the missing strings. The SavedataEditWindow layout uses the same deletion animation indices as those filenames imply; its constructor was stripped from the final DOL. The neighboring SavedataEdit constructor also disables T_Block_01 during layout initialization.
|
||||
|
||||
1. Reconstructed an inline SavedataEditWindow constructor using a local animation table and the same pane/event/button setup as GCWindow and GCSaveData. Because the constructor has no live callers, MWCC omitted it and the missing strings remained absent, 38/50.
|
||||
2. Compiled the ordinary constructor out of line. Its animation table and T_Block_01 appeared in exactly the target order and offsets. A direct B_Del_00 argument emitted an extra string; referencing the existing scButtonName[2] corrected the pool to 50/50. The local descriptor table added 80 rodata bytes, reducing that section to 88.37209%; rejected that table representation.
|
||||
3. Added a private name/group overload that creates one ordinary stack descriptor and calls MemoryBase::add_animation. Individual calls reproduced the original animation filenames. Literal group arguments duplicated G_DelFlash and G_Select, giving 52 strings and an sdata mismatch. Reusing the existing scAnmName groupName fields restored 50/50 pool strings and 100% rodata, sdata and sdata2. Kept this implementation.
|
||||
4. Tested guarded inline MemoryBaseEvent destructor/event-handler definitions recovered from the original iplMemoryCardBase assembly. The empty destructor alone emitted no additional vtable. Inlining the event handler emitted its real 28-byte vtable after MemCardEventHandler, rather than in the preceding 32-byte discarded range. It did not improve objdiff data measurements; reverted both changes.
|
||||
|
||||
The pool now matches all 50 strings with identical offsets. The raw data bytes are identical over the complete 0x678-byte candidate .data section. Original .data has 0x6f8 bytes, including linker-discarded weak-table ranges; the candidate naturally emits 100 bytes for the GCWindow vtable rather than the original symbol's 132-byte span and 16 bytes for MemCardEventHandler rather than its 168-byte span. No padding, retention directive or synthetic symbol was introduced. The reconstructed constructor's code cannot be instruction-verified because the original DOL has no surviving constructor symbol. Its intended behavior follows the existing scene setup, and this uncertainty remains explicit.
|
||||
|
||||
### onMemEvent
|
||||
|
||||
1. Changed the format-message state's terminal break into an early return. Still 153/155 instructions.
|
||||
2. Moved that early-return case immediately before the processing case. Generated 154/155 instructions, but the return branch appeared before the nested operation switch.
|
||||
3. Placed the format-message case after the operation switch and routed processing to the named process_complete block. Generated exactly 155/155 instructions with diffs 0. Exact-name objdiff reports 100%. Kept this arrangement.
|
||||
|
||||
### init
|
||||
|
||||
1. Reused the full-width blocks variable and explicitly masked it after the digit-array initialization, instead of introducing a separate truncated blockCount. Still 198/198 instructions with 48 differing positions.
|
||||
2. Bound the interpolated result to a const reference before finding the pane. Same 198/198 instructions, 48 differing positions and exchanged vector stack slots; rejected.
|
||||
3. Declared and initialized the blocks accumulator before the title calls and assigned the getter result later. Same 198/198 instructions and 48 differing positions; rejected. Restored the previously accepted initialization source.
|
||||
|
||||
The remaining init differences are register allocation in decimal conversion and the two vector stack slots. No further untried target functions remain.
|
||||
|
||||
### Validation baseline
|
||||
|
||||
The installed gate has no baseline-c77b866e.json. The final full gate therefore uses --base 550c5f19, the closest installed baseline. An additional fresh report was generated by rebuilding the unchanged c77b866e GCWindow source/header in this worktree and saved only to /tmp/sol-high-gcw-r2-current-main-baseline.json. The final report is also compared against that current-main snapshot across every unit and every previously exact function. Protected baseline files were neither edited nor created.
|
||||
|
||||
Final full gate with --base 550c5f19: GATE PASS. Pool IDENTICAL, 47/48 instruction-exact functions, 9172/9964 code bytes, 248/2032 data bytes. rodata, sdata and sdata2 each 100%; data 8.861147%. Fresh c77b866e comparison: zero regressions across all unit measures and previously exact functions. The complete 43U build passed with DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. Forbidden patterns and readability warnings: zero.
|
||||
62
tools/decomp-assist/iplMemoryCard.attempts.md
Normal file
62
tools/decomp-assist/iplMemoryCard.attempts.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# iplMemoryCard matching attempts
|
||||
|
||||
Baseline: missing source, 0/41 functions and 0/9264 exact code bytes.
|
||||
Reused the readable scene reconstruction saved in /tmp/iplMemoryCard.latest-baseline.cpp,
|
||||
replacing its local class imitations, raw field offsets and pinned double with
|
||||
existing MemoryCard, MemoryBase, GCWindow, GCSaveData and MemoryCardManager types.
|
||||
All 102 strings and the animation, pane and message tables match on the first build.
|
||||
The first build matched 38/41 functions; create matched all 520 instructions.
|
||||
|
||||
## on_fadeout2nd
|
||||
|
||||
1. Existing bool shutdownCardThread declaration produced 32/33 instructions;
|
||||
the target explicitly normalizes an integer return to bool.
|
||||
2. Guarded the return declaration as BOOL for this source. A bool local now
|
||||
emits addic/subfe., matching all 33 instructions.
|
||||
|
||||
## show_arw
|
||||
|
||||
1. Nested visibility tests followed by else-if produced 102/104 instructions;
|
||||
the compiler eliminated the second flag comparisons.
|
||||
2. Computing visibility before each flag test retained the wrong load ordering
|
||||
and 102/104 instructions.
|
||||
3. Short-circuit calls to real inline can_scroll_r/can_scroll_l members match
|
||||
the original load order, repeated flag comparisons and all 104 instructions.
|
||||
|
||||
## show_capacity
|
||||
|
||||
1. Original u16 getFreeBlocks declaration truncated the return before array
|
||||
initialization: 139/139 instructions, 58 differences, 88.431656%.
|
||||
2. Guarded u32 return declaration and explicit later u16 conversion reduced
|
||||
this to 19 differences, 94.85612%, still 139/139 instructions.
|
||||
3. Inlining the thousands expression changed no instructions.
|
||||
4. Separating freeBlocks from the converted blocks local and removing division
|
||||
temporaries changed no instructions: the remaining 19 differences involved
|
||||
decimal arithmetic scheduling and register allocation.
|
||||
5. Replaced the manual copy from a static number table with a normal local
|
||||
digitTable initializer. Decimal arithmetic now matched, but digits initialized
|
||||
before the table gave 140/139 instructions and different initialization order.
|
||||
6. Declared digits without initialization and zeroed them after digitTable.
|
||||
All 139 instructions now match. No pointer before an array is constructed.
|
||||
|
||||
## Data evidence
|
||||
|
||||
.rodata (280 bytes) and .sdata (40 bytes) match completely. Pool: 102/102,
|
||||
identical including offsets. The generated .data bytes match the original
|
||||
prefix exactly: 2252 bytes versus 2320. Original trailing 68 bytes are zero.
|
||||
At 0x870 the original MemoryCardManager vtable symbol includes 160 bytes,
|
||||
with only its destructor relocation at 0x878. The compiler generates the
|
||||
natural 12-byte manager vtable, followed by the 80-byte MemoryBase vtable
|
||||
with ordinary virtual-method relocations. These weak table relocations are
|
||||
absent in the extracted original; no artificial padding was added.
|
||||
|
||||
An experiment using the existing inline MemoryBase destructor rather than
|
||||
its explicit source definition kept its 16 instructions exact but worsened
|
||||
.data from 98.51269% to 96.70525%. Kept the explicit destructor in object order.
|
||||
|
||||
.sdata2 contains the correct first four floats (16 bytes). The original has
|
||||
an additional unreferenced eight-byte signed-integer conversion bias. No
|
||||
relocation in the original references it. Its originating discarded helper
|
||||
is unknown; no address-pinned constant or dummy conversion was added.
|
||||
|
||||
Final code: 41/41 instruction-exact functions. No open code functions.
|
||||
26
tools/decomp-assist/iplSDChannelObj.attempts.md
Normal file
26
tools/decomp-assist/iplSDChannelObj.attempts.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# SDChannelObj matching attempts
|
||||
|
||||
All 38 target functions are implemented in address order. No configure or symbol changes.
|
||||
The string pool is identical. The .data and .rodata sections match completely.
|
||||
|
||||
## iplSDChannelObj_813E3580
|
||||
|
||||
- Initial translation of ChannelObj::setLangPane: 182 instructions, 112 instruction diffs. Fixed language-name storage from flat byte indices to 10 four-byte entries and changed the Rso name buffer to eight bytes. This also fixes the fallback comparison to select a four-byte language entry.
|
||||
- Removed the cached fallback group-name local: 182 instructions, 37 diffs. Giving the region table external linkage did not change these diffs; restored internal linkage.
|
||||
- Explicit region-name and language-index pointer locals: 182 instructions, 40 diffs. Restored indexed table accesses.
|
||||
- Restored the target's breaks after selecting a fallback group and at its NULL terminator: 182 instructions, four diffs, only r27 versus r29 for the selected group.
|
||||
- One common Group pointer declared before the language scan: same four register diffs.
|
||||
- Reused that Group pointer while traversing the first list: 181 instructions and additional frame/register diffs. Restored iterator accesses and locally scoped Group pointers.
|
||||
- Final retained form: 182/182 instructions, four register-allocation differences at indices 103, 115, 149, 161. No artificial register coercion.
|
||||
|
||||
## Resolved functions
|
||||
|
||||
- iplSDChannelObj_813E4060: initial 54/55 instructions; changed the language sentinel to unsigned for the target addis/cmplwi pair. This left eight register diffs. Removed the language temporary and indexed the lookup directly: 55/55 instructions, zero diffs.
|
||||
- iplSDChannelObj_813E4A54: initial 90/90 instructions with ten scheduling diffs. Computed the title code before querying the NWC24 manager: 90/90 instructions, zero diffs.
|
||||
- The other functions matched on their first literal implementation from target assembly and corresponding ChannelObj routines.
|
||||
|
||||
## Measurement caveats
|
||||
|
||||
- iplSDChannelObj_813E3E38 is 100% in objdiff. Gate/ctxdiff reports three instruction differences because odiff.dis treats the first operand of a cr1 branch as its target and subtracts the function's object offset. The actual instruction words at indices 11, 21, 22 are identical: 41860014, 41860010, 40840014. Both objects have identical call relocation positions and targets. No tool changes were made.
|
||||
- .sdata2 was fixed by representing the unknown title as an ordinary const wchar_t array, rather than a pointer to a wide string literal.
|
||||
- Original .sdata additionally contains B_BtnA and B_BtnB beyond the New group literals. No owned text relocation references those two strings. Their source ownership is uncertain; they were not recreated as unreferenced data just to increase the section score.
|
||||
55
tools/decomp-assist/pf_cache.attempts.md
Normal file
55
tools/decomp-assist/pf_cache.attempts.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# RVL SDK fa cache matching
|
||||
|
||||
Unit: `libs/RVL_SDK/src/fa/pf_cache`, 43U only, still NonMatching.
|
||||
Starting report: 0 instruction-exact functions, 0/7396 matched code bytes.
|
||||
Source adapted from the Matching RevoEX `vf/fatfs/pf_cache.c`.
|
||||
|
||||
The SDK variant uses the cache at volume offset 0x1624, accepts one data page,
|
||||
passes the allocation-hit output through its public allocation functions,
|
||||
marks modified ranges inside writes, and handles whole-page flushing when the
|
||||
modified start pointer is null. Its bulk write does not perform the RevoEX
|
||||
write-through clearing pass. The target's left-overlap modified-start
|
||||
calculation is preserved, including its unusual endpoint arithmetic.
|
||||
|
||||
The existing compiler's `dont_inline` pragma preserves the target's calls
|
||||
between cache operations. List manipulation and used-page scans are written
|
||||
as ordinary C where the target embeds them. No shared headers were changed.
|
||||
|
||||
## Remaining function: PFCACHE_DoWriteNumSectorAndFreeIfNeeded
|
||||
|
||||
1. Retain the RevoEX range updater, then adapt dirty-pointer handling to the
|
||||
target branches. Changed the overlap branches and removed the write-through
|
||||
clearing pass. Result: 233/233 instructions, 185 instruction differences,
|
||||
95.77253% objdiff. Direct last-sector arithmetic was hoisted outside the
|
||||
loop and occupied another preserved register.
|
||||
2. Introduce an explicit last-sector temporary and increment successful
|
||||
sectors before decrementing remaining sectors. Result: 234/233 instructions;
|
||||
last-sector arithmetic still hoisted and aliasing forced a repeated load.
|
||||
3. Restore the full page-size overlap expression for the modified end pointer.
|
||||
Result: 236/233 instructions; an additional preserved end-sector temporary
|
||||
survived the memcpy call.
|
||||
4. Cache the overlap count once and derive its last sector from the page start.
|
||||
Result: 234/233 instructions; most instructions matched, but the complex
|
||||
memcpy-length expression retained a second end-sector register.
|
||||
5. Simplify the memcpy length and compute last sector directly from the request.
|
||||
Result: 232/233 instructions; last sector hoisted again, shifting registers.
|
||||
6. Keep the simple memcpy length, cache the overlap count, and derive last sector
|
||||
from page start plus overlap count. Result: 233/233 instructions, nine
|
||||
instruction differences, 98.21889% objdiff. All surviving differences are
|
||||
instructions 136-144 in the right-overlap count/last-sector calculation.
|
||||
7. Reverse operands in the overlap request-end expression. Result unchanged:
|
||||
233/233 instructions, the same nine differences, 98.21889% objdiff.
|
||||
|
||||
The retained version computes the same overlapping sector range. The compiler
|
||||
uses the request end already held in r31; the target recomputes the request end
|
||||
in r4 and schedules last-sector subtraction before updating success/remaining
|
||||
counts. No assembly, volatile values, or uninitialized values were introduced.
|
||||
|
||||
## Data and validation
|
||||
|
||||
Both original and candidate ELF objects have zero allocated non-code sections.
|
||||
There is no data or string pool in this unit. `pool_diff.py` raises KeyError
|
||||
because it assumes a .data section; the gate reports IDENTICAL empty pools.
|
||||
Final report: 35/36 instruction-exact functions, 6464/7396 matched code bytes,
|
||||
99.77555% fuzzy code, data None/None. Full gate reports zero regressions,
|
||||
zero forbidden patterns, zero readability warnings, and the target DOL SHA1.
|
||||
20
tools/decomp-assist/pf_entry_iterator.attempts.md
Normal file
20
tools/decomp-assist/pf_entry_iterator.attempts.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# fa/pf_entry_iterator attempts
|
||||
|
||||
The matching vf implementation supplied iterator movement, path traversal, and directory parsing. The fa object adds a word to FFD, extends the FAT hint, changes search attribute handling and entry-name matching, and replaces FindCluster with an ancestor search. All 16 target functions are implemented in object order; 14 are instruction-exact.
|
||||
|
||||
PFENT_ITER_FindCluster:
|
||||
- Initial ancestor traversal: 231/237 instructions; unused standalone chain counter disappeared.
|
||||
- Use hint.chain_index, correct cluster_link initialization, and unsigned entry-offset shift: 237/237; 48 differences, mostly register allocation.
|
||||
- Move hint before current_cluster and delay hint.chain_index initialization: 237/237; 11 register differences.
|
||||
- Swap sector-index/entries-per-sector declaration order: 237/237; 8 register differences. Retained.
|
||||
- Reverse sector-index bitwise operands: no change. Move entries declaration first: no change. Delay FFD start-cluster assignment: 16 differences; reverted.
|
||||
|
||||
PFENT_ITER_GetLFNEntryName:
|
||||
- Separate long_name expressions for each copy: 77/73 instructions; three independently advanced destination offsets.
|
||||
- Reuse one destination pointer: 78/73; fewer address calculations, but signed final division added correction instructions.
|
||||
- Unsigned final index and explicit byte-offset loop: 76/73; compiler advances destination pointer directly, unlike target's offset addition.
|
||||
- Signed loop counter: 76/73, adds signed comparison; reverted.
|
||||
- Destination index (i * 26U) / 2U: 74/73; one extra alignment-mask instruction and loop/destination register allocation. Retained.
|
||||
- Byte-pointer arithmetic, integer-address arithmetic, or three byte-pointer copy expressions: 76/73; same pointer induction. Reverted.
|
||||
|
||||
Data: ordinary literals occur in target order. Candidate .sdata is 22 bytes; target is 24 bytes. The common 22 bytes are identical; two trailing zero bytes remain unresolved. No padding or extra literals added. pool_diff.py requires .data and raises KeyError for this unit; the gate reports identical empty .data pools, so the explicit ELF .sdata comparison is the meaningful data check.
|
||||
492
tools/decomp-assist/tiInputForm.attempts.md
Normal file
492
tools/decomp-assist/tiInputForm.attempts.md
Normal file
@@ -0,0 +1,492 @@
|
||||
# tiInputForm attempts
|
||||
|
||||
Target: 4.3U, `src/keyboard/tiInputForm`. Initial gate: 175/221 instruction-exact, objdiff 176/221, code 19124/50656, data 864/3772. All shared-header changes use `TIINPUTFORM_IMPLEMENTATION`, defined only in this source file.
|
||||
|
||||
- `DeadKeyStream::ToCombineClass`: translated the original switch and per-language comparisons. First build: 69/69 instructions, zero differences. `ToIndependentClass` now uses its real static member declaration; 30/30, zero differences.
|
||||
- `RowInfoManager::init`: direct references produced 40/39 instructions. A cached last-row index and array pointer produced 38/39. Widening the index and narrowing only the array subscript retained 38/39. Restored the original asm to avoid regression. The remaining difference includes a repeated maximum-length load and indexing/store scheduling.
|
||||
- `Base::~Base`: restored the row-manager destructor and the real C++ destructor. First build: 29/29, zero differences. This also restores twelve exact inheritance thunks.
|
||||
- `LayoutByNW4R::~LayoutByNW4R`: used the sibling event handler and animation list, with explicit event-handler destruction and allocator release. First successful build: 77/77, zero differences. This restores ten additional exact inheritance thunks.
|
||||
- `Base::calcCursorTimer`, `dirtyCacheAll`, `setCursorPos`, `setAtokDictionary`, `closeAtokDictionary`, `isAtokDictionaryOpened`, `getCursorPos`, and `LayoutByNW4R::isAbleToUp`/`isAbleToDown`: converted existing asm into real members. Each first build was instruction-exact. `getCursorPos` is 27/27 instructions with zero differences.
|
||||
- `Base::isAtokActive`: early false return: 10/10 instructions, seven differences in branch direction/block order. A result variable: 10/10, eight differences. Positive conditional return: 10/10, seven differences. Boolean switch: 11/10. Restored the original asm to avoid regression.
|
||||
- `NormalButtonAnmPane::onAnmEvent`: added the missing state-machine member. Natural numeric case order gave 147/147 instructions with 23 differences in switch-block order. Ordering the cases as the target emits them gave 147/147, zero differences.
|
||||
- `Base::calcCursorPos`: direct translation with the empty-input recursion at the loop head gave 329/326 instructions and an oversized frame. Moving the empty-input handling after the loop gave 332/326. Reducing DrawInfo to its actual rectangle and character fields and introducing scalar scale components gave 323/326. Restoring aggregate scale and initializing line bottom beside line top gave 332/326. Qualifying recursive calls as Base calls and matching comparison operand direction gave 326/326, with 81 differences in floating-point allocation and scheduling. This implementation remains partial.
|
||||
- `LayoutByNW4R::updateInput`: direct translation gave 155/154 instructions. Inverting the midpoint branch gave 154/154 with five operand-order differences. Reordering commutative expressions did not change those five differences. Dividing the height by two and using separate bottom-position temporaries reduced this to three. Correcting the bottom expression to add height and origin before adding one gave 154/154, zero differences.
|
||||
|
||||
Every measured state retained the original 20-string pool. The first gate lacked its current merge-base baseline; the baseline became available during the run. Subsequent quick gates passed with zero regressions and zero forbidden/readability additions. The unit remains NonMatching.
|
||||
|
||||
- `Base::isOverRowLimit`: direct glyph/row walk gave 239/238 instructions. Separating scale construction from assignment and adding an explicit null pointer initialization gave 241/238. Restoring aggregate initialization and arranging the cursor/scale temporaries gave 236/238; the retained implementation has an undersized frame plus floating-point scheduling/register differences.
|
||||
- `LayoutByNW4R::onCommand`: translated the length trimming and row-limit handling. Reusing one limit variable, introducing a separate trim limit, then separating the excess position reached 251/251 instructions with 17 differences. Calling the existing inline observer method emitted an additional `OutOfLength` string. Declaring it out of line and placing its real definition at the existing string position emitted a vtable and an additional `Cancel!` string. Restored the original state; the candidate is not included because its pool did not pass.
|
||||
- `RowInfoManager::init`: a fourth attempt using a typed row accessor still gave 38/39 instructions. Restored the original asm.
|
||||
- `Animation::startAnm`, `getValue`, `isActive`, `setSEFlag`, `isSEFlag`, `stop`: translated into their real class members; each is instruction-exact. `Animation::calc`: reversing the commutative increment expression matches the original raw 33-instruction bytes. ctxdiff still prints two differing CR1 branch offsets; its disassembly normalization depends on each object's function offset. This is a tooling discrepancy, not an instruction-count claim.
|
||||
- Static colors: restored the seven actual color objects and their constructors. Their compiler-generated initializer is 83/87 instructions. The target also registers a real LayoutGather singleton in the still-missing command handler and dynamically initializes an animation table pointer. Those missing objects account for destructor-chain offsets and the final four instructions. No artificial placement was added.
|
||||
- `LayoutByNW4R::getScale`: root-pane lookup using the existing layout and pane headers. First build: 18/18 instructions, zero differences.
|
||||
- `WithAtok`: replaced 36 existing no-op/constant-return asm methods with C++ bodies reproducing the original disabled Atok implementation. Also converted the original no-op `Decolated::EnableKSXFilter` and `deleteChar`. Corrected the confirmed-string getter's const qualifier. The fresh gate retains 199/221 instruction-exact functions, with zero regressions; these conversions improve source quality rather than function counts.
|
||||
- `Base::checkHeadOfSentence`: translated the observer command, previous-character switch, cursor move and sentence check. First build: 71/71 instructions, zero differences.
|
||||
- `Base::isOverLine`: aggregate scale locals gave 55/51 instructions due to duplicate temporary copies. Scalar scale values gave 59/51 with four saved floating-point registers. A single return expression gave 43/51 by delaying width loads. Const references retained 55/51; separate scale assignments gave 59/51. Restored the existing exact asm body.
|
||||
|
||||
- `Base::isEditMode`: a direct Boolean range and tail return gave 13/22 instructions. Switching on the two direct-edit prediction modes and explicitly testing the Zi fix state gave 22/22, zero differences.
|
||||
- `Base::onPressUp` and `onPressDown`: literal translation gave 245/246 instructions. Reversing pointer comparison operands, preserving the current-string call result in a separate local, and making the prediction test positive reduced the differences to the final kana branch. An explicit common exit retained 245/246. Boolean switches with the false case first gave 247/246; the true case first gave 246/246 with only the comparison constant and branch polarity differing. A negated switch gave 247/246 and changed register allocation. Restored the readable 245/246 version; the target retains one extra unconditional branch. Guarded sibling headers expose actual Zi methods, candidate text area, and the hardware keyboard's single/double quote state.
|
||||
- `Base::onPressDownHWKB`: initial nested conversion-first handling gave 266/270 with large block-order differences. Putting the modifier-driven commit before candidate navigation retained 266/270 and aligned the blocks. Hoisting the selected index and splitting the kana/candidate tests retained 266/270. The retained partial has one conditional branch difference, selected-index register allocation, and an original trailing Zi comparison whose no-op body is not reconstructed.
|
||||
- `Base::onCursor`: literal candidate/kana drawing gave 475/473 instructions. Combining selection flags, ordering rectangle assignments and explicitly calculating box coordinates gave 473/473 with 22 differences. Reordering color branches and centering widths gave 473/473 with seven differences. Separate font-height temporaries regressed to 475/473. Using direct cursor-height call expressions restored 473/473 with five differences, confined to the centered-space calculation's floating-point registers and commutative operand order. Retained the best real C++ implementation, including genuine candidate/kana background colors and typed drawer fields.
|
||||
|
||||
- `Base::onPressLeftHWKB` and `onPressRightHWKB`: initial typed translation gave 263/264 and 274/275 instructions. Using the target's nonpositive candidate-count test and placing the active-conversion block first removed the remaining block-order differences. A true-case Boolean switch gave 264/264 and 275/275, each with two differences: compare-to-one/branch-equal instead of compare-to-zero/branch-not-equal. Retained this source variant. Zi's selected-candidate access uses the actual class state and the SDK's EZTXGetParam, guarded for this source; the selected field load agrees with the target at 0x98. The extra search-state word at 0x74 is present in the original 0x2c cleared parameter range but its precise semantics remain uncertain.
|
||||
|
||||
- `Base::toggleAtokMode_`: first typed translation gave 154/154 with 56 differences. Inverting the toolbar permission condition, placing active-candidate handling first, and putting mode-enable handling first gave 154/154, zero differences. The sibling PC header omitted its original allocator at 0x38; exposing that field only under this unit's macro places the original QWERTY/language flags at 0x3c/0x3d. Guarding KeyboardBase's existing two-argument onKey signature prevents an extra virtual slot.
|
||||
- `Base::onHKBCtrlCode`: numeric case order gave 375/375 with 314 differences. Reordering the cases to their original emitted order reduced this to two range-test differences. Writing the inclusive CN/KR range as an unsigned difference <= 1 gave 375/375, zero differences.
|
||||
|
||||
- `Base::inputCharZi_`: direct translation gave 163/166 instructions. Explicitly setting the direct-input Boolean, placing the Korean alphabet branch first, and reordering letter-mode cases gave 166/166 with seven block-order differences. Ordering letter-mode cases as lower, upper, default gave 166/166, zero differences.
|
||||
- `Base::confirmInputting_`: direct translation gave 345/346 instructions with the direct-input block emitted last. Moving that block first aligned the remaining code; inclusive input and prediction-length comparisons remove two comparison differences. Factoring an unconfirmed Boolean gave 349/346; two separate pointer predicates gave 347/346. Retaining the original else-if chain and its repeated unconfirmed-pointer predicate gave 346/346 and byte-identical raw text (1384 bytes). ctxdiff reports two CR1 offsets because of its disassembly normalization; objdiff is the authority for this function's score.
|
||||
|
||||
- `Base::inputCharDefault_`: literal C++ restored from asm: 135/135, 14 differences. Correct cursor-query calls, positive prediction branch, and local declaration order: 135/135, diffs 0.
|
||||
- `Base::onSpaceKeyHWKB`: literal C++ plus semantic dead-key compatibility filter: 592/603. Original candidate/body order, inline context reset, explicit Atok boolean, and bottom-tested input loops: 603/603, 21 differences. Active-string temporary and positive boolean branch: 603/603, seven differences. Boolean switch: 607/603. Retained 603/603; seven differences are the Atok boolean block order only. Pool identical; filter loop and both candidate cycling bodies are instruction exact.
|
||||
|
||||
- `LayoutByNW4R::init`: qualified Layout calls: 136/151. Virtual dispatch restored: 151/151, diffs 0; pool identical. Text-drawer fields reconstructed at original offsets with no sibling output changes.
|
||||
- `EventHandler::onTiEvent`: literal event dispatch: 423/419. Hoisted animation buffer and ordinary fallback literal: 420/419, but pool gains an extra `T_2l_TextBox`. Pane-name load before cursor initialization and existing base-pane field as fallback: 423/419, 96.10501%; pool identical. Remaining string-base addressing, register allocation, and fallback load differ; retained complete readable implementation.
|
||||
|
||||
- `LayoutByNW4R` constructor: real initializer list replaces asm: 46/46, diffs 0.
|
||||
- `LayoutByNW4R::setLanguage`: literal helper: 234/237, extra inline-helper string pool. Expanded queries: 240/237, cached base-subobject register. Const pane-query helper: 237/237, 22 scheduling differences. Conditional argument form: same 22. Fallback passed into a string helper: 237/237, 64 differences. Retained const pane-query helper with pool identical.
|
||||
- `EventHandler::onTiEvent`: ordinary fallback literal shared with restored constructor, pane-query reference, event-case order, inclusive repeat threshold: 419/419, five differences, all string offsets. Original table data before the second string group is still missing.
|
||||
- `LayoutByNW4R::create`: literal calls to Base create: 303/356. Inlined row-list allocation and selection, real animation records, font and event handler setup: 358/356. Correct EditBuffer virtual layout and full-width outer button loop: 359/356. Pool identical. Remaining register allocation, row-list scheduling and loop lowering; complete implementation retained. Corrected missing eighth animation file pointers in both actual button records. Removed legacy duplicate font/assert string objects; ordinary literals now emit them.
|
||||
|
||||
- `Base::onCommand`: complete C++ dispatcher, real command payloads and Zi/dead-key/context helpers: 2038/2053, 87.37506%. Correct boolean delete-forward result, initialized saved translation mode, explicit Atok predicate: 2053/2053. Cached fixed-string selection across commands: 2056/2053; retained with gate passing. Remaining stack-frame layout (0x280 vs 0x250), register allocation, predicate lowering and case scheduling. Moved the hardware-control dispatcher before layout strings; its real jump table plus the new command jump tables fix all five event-handler offsets (419/419, diffs 0).
|
||||
|
||||
- `LayoutByNW4R::onCommand`: after restoring the constructor/ordinary literal pool, removing its legacy duplicate OutOfLength object allows the existing observer method to emit the real string. The earlier complete candidate is now pool-identical (251/251, 17 differences). Scope the trim limit inside the default branch, compare length on the left, and initialize the row-limit payload before its nonzero test: 251/251, diffs 0.
|
||||
- `__sinit_\tiInputForm_cpp`: reconstructed the actual down-button binding target from the original final initializer store (table offset 0x4c): its animation files target the up-button pane. Using that real mutable target pointer in the down-button record emits the original dynamic initialization. 87/87, diffs 0. This object has a real runtime role, not a placement role.
|
||||
- Cursor-cache symbol: restored `textdrawer::Base::isEnableCursorCache() const` and `getStartPos() const` from actual typed state. The report names the former by concatenating its mangled name with the latter. Direct bool return: raw 8 bytes `886301044e800020`, identical to the malformed original entry. Positive branch: same 8 bytes. Comparison to false: 20 bytes. Retained direct return; exact-name gate still cannot pair it with the malformed report symbol. `getStartPos`: 2/2, diffs 0. No function/config aliases were added.
|
||||
|
||||
- Small accessor conversion: removed 22 asm bodies in favor of existing real header definitions or typed C++ members (StringBase, Decolated, WithZi, Manager, CandidateBox and text-drawer cache state). Fresh gate: 208/221 objdiff exact, 206/221 instruction-exact, zero baseline regressions. Draw-cache getter 8/8, dirty cache 3/3, Zi candidate-count getter 2/2, string length getter 2/2, all diffs 0. Reconstructed draw/cache fields from their original loads and preserved the nested CommandReceiver::Scroll signature under the unit macro.
|
||||
|
||||
- `Base::onCursor`: final centered-space variation initializes the real offset before width locals and puts scale/half-width operands first: 473/473, seven differences. Restored the five-difference version.
|
||||
|
||||
- Final clean full gate: GATE PASS; pool IDENTICAL; instruction-exact 206/221 (baseline 175/221); objdiff functions 208/221 (baseline 176/221); code 28300/50656 (baseline 19124/50656); data 868/3772 (baseline 864/3772); zero regressions, forbidden additions and readability warnings. Full build passes and DOL SHA1 is 26116613f624061ba99c8d1a299aaa6efa85670d. Partial result: 46 existing asm bodies remain and data is below 100%. Every remaining report-nonmatching entry has at least three logged source-level attempts.
|
||||
|
||||
## Continuation from merged main
|
||||
- Left/right HWKB guard: zero-case/default-break switch produces 265/264 and 276/275 with an extra branch; explicit if/else yields 263/264 and 274/275, dropping the required branch; integer switch with 0 and 1 cases adds five instructions; negated boolean switch adds boolean normalization and swaps registers; moving the body into default retains the extra branch. Restored the two-difference original.
|
||||
- Cursor centering continuation: reversed multiplication nesting retained five differences; half-width accumulator moved work before scale query, 17 differences; scale-first accumulator gave seven differences; declaring the offset before widths retained five. Restored best source.
|
||||
- Space-key Atok continuation: false-case switch gave 604/603 with one extra branch; false initializer plus positive assignment gave 602/603; explicit forward labels retained 603/603 and the same seven block-order differences. Restored best source.
|
||||
- Data reconstruction: replacing EditBuffer destructor asm with typed C++ is 61/61, diffs 0, and emits its real vtable. EventHandler declaration moved before animation classes restores all three animation/event vtable offsets. Decolated clear/set/setLength overrides and draw-cache method signatures corrected under the unit macro. Moving genuine candidate/kana color definitions to the table group, using ordinary Korean/Chinese pane literals, and restoring the original true hyphen initializer makes every .sdata byte identical. Quick gate passes with zero regressions.
|
||||
- Layout language continuation: separate name temporary retains 237/237 and 22 root-load scheduling differences; duplicating the pane query across explicit branches gives 252/237; reusing the existing text-name variable with separate if/else retains 237/237 and the same 22 differences. Restored original helper form.
|
||||
- Continuation void Base::onPressUp(): true case kana guard: src 0x3d8 base 0x3d8 insns 246/246; diffs 2:.
|
||||
- Continuation void Base::onPressUp(): zero case kana guard: src 0x3dc base 0x3d8 insns 247/246; 17 displayed differing instructions.
|
||||
- Continuation void Base::onPressUp(): loop kana guard: src 0x3dc base 0x3d8 insns 247/246; 19 displayed differing instructions.
|
||||
- Continuation void Base::onPressDown(): true case kana guard: src 0x3d8 base 0x3d8 insns 246/246; diffs 2:.
|
||||
- Continuation void Base::onPressDown(): zero case kana guard: src 0x3dc base 0x3d8 insns 247/246; 17 displayed differing instructions.
|
||||
- Continuation void Base::onPressDown(): loop kana guard: src 0x3dc base 0x3d8 insns 247/246; 19 displayed differing instructions.
|
||||
- Continuation void Base::onPressDownHWKB(): local selected index: src 0x428 base 0x438 insns 266/270; 36 displayed differing instructions.
|
||||
- Continuation void Base::onPressDownHWKB(): initialize selected index: src 0x428 base 0x438 insns 266/270; 36 displayed differing instructions.
|
||||
- Continuation void Base::onPressDownHWKB(): positive kana switch: src 0x42c base 0x438 insns 267/270; 37 displayed differing instructions.
|
||||
- Continuation u32 Base::calcCursorPos(: loop declaration: src 0x518 base 0x518 insns 326/326; diffs 81:.
|
||||
- Continuation u32 Base::calcCursorPos(: scale assignment: src 0x520 base 0x518 insns 328/326; 154 displayed differing instructions.
|
||||
- Continuation u32 Base::calcCursorPos(: defer vertical coordinate: src 0x51c base 0x518 insns 327/326; 145 displayed differing instructions.
|
||||
- Continuation u32 Base::isOverRowLimit(: scale assignment: src 0x3b4 base 0x3b8 insns 237/238; 223 displayed differing instructions.
|
||||
- Continuation u32 Base::isOverRowLimit(: defer scale width: src 0x3b0 base 0x3b8 insns 236/238; 220 displayed differing instructions.
|
||||
- Continuation u32 Base::isOverRowLimit(: glyph field initialization: src 0x3c0 base 0x3b8 insns 240/238; 196 displayed differing instructions.
|
||||
- Continuation void Base::onCommand(: fresh fixed string queries: src 0x2020 base 0x2014 insns 2056/2053; 1455 displayed differing instructions.
|
||||
- Continuation void Base::onCommand(: defer translate mode query: src 0x2020 base 0x2014 insns 2056/2053; 1455 displayed differing instructions.
|
||||
- Continuation void Base::onCommand(: uncached fixed predicate: src 0x2014 base 0x2014 insns 2053/2053; diffs 1985:.
|
||||
- Continuation void LayoutByNW4R::create(: cache row-list pointer: src 0x590 base 0x590 insns 356/356; diffs 205:.
|
||||
- Continuation LayoutByNW4R::create animation switch: first experiment failed to compile because its case scope was wrong; corrected and measured below.
|
||||
- Continuation void LayoutByNW4R::create(: query animation id from record: src 0x5a4 base 0x590 insns 361/356; 303 displayed differing instructions.
|
||||
- Animation-pane switch retried with corrected case scope: 357/356; original conditional retained. Cached row-list pointer is retained: 356/356, 205 differences, objdiff 88.91854% versus 88.11798%; no regressions. Removing explicit placement-allocation checks gave 354/356 and was restored.
|
||||
- Additional cursor experiments: reusing either box-edge variable as the marker offset gave seven differences; a real inline space-centering helper gave ten differences and changed stack temporary order. Restored the five-difference source.
|
||||
- Nine additional asm conversions are instruction-exact: initZiString 14/14, resetContextPredict_ 27/27, resetRelation 23/23, textinput Base init 1/1, drawer getLine 3/3, StringBase hasCandidate 5/5, inputform Base create allocator overload 1/1, Decolated set 19/19, Decolated clear 20/20. Layout onSE 5/5 and EditBuffer destructor 61/61 are also exact C++. The allocator overload and base initializer faithfully retain their original empty bodies.
|
||||
- Data limits: ordinary literal pool and .rodata/.sdata/.sdata2 are identical. Vtable relocation comparison now agrees except the reference cursor-cache concatenated symbol. EditBuffer vtable target size includes four trailing bytes and textinput Base vtable includes 28 trailing bytes without relocations; no padding was added. Other zero-filled weak data and anonymous jump-table differences remain.
|
||||
- Final clean full gate: GATE PASS, pool IDENTICAL, zero regressions/forbidden additions/readability warnings; instruction-exact 206/221 unchanged, objdiff exact 208/221 unchanged, code 28300/50656 unchanged, data 868 -> 908/3772, fuzzy 97.1980 -> 97.2205. Eleven existing asm bodies converted instruction-exact to C++; 41 asm bodies remain. Linking was not changed. The literal pane tables have 100% .rodata and .sdata.
|
||||
|
||||
## Third continuation: remaining asm
|
||||
- Kana buffer getter 2/2, VI width setter 2/2, command sender append 2/2, candidate scroll query 2/2, Decolated destructor 22/22, WithAtok destructor 23/23, CommandReceiver destructor 16/16: real C++ first builds, diffs 0. Original KanaStream layout is a KPRQueue, pending character and five-character output.
|
||||
- Decolated::isKanaFix: literal 19/19, one unsigned comparison difference; explicit signed translation-mode comparison gives diffs 0.
|
||||
- Base::moveCandidateToIdx: typed translation 104/104, one return-width difference; correcting the fixed prediction count to s32 gives diffs 0. Base::confirmInput_ 141/141, diffs 0 on first translation.
|
||||
- Base::init: literal 81/81, two wrong reconstructed members; original slot is enableSpaceByRight and the cursor-cache scroll offset is textdrawer 0xf0. Corrected guarded declarations give diffs 0. Base::deselectCandidate 13/13, diffs 0.
|
||||
- Layout calc: direct bool comparisons 132/137; initializing real up/down state before the pane query, positive separator branch and explicit comparisons give 137/137, diffs 0. Existing bar literal object replaced by the ordinary literal at its real source position; pool stays identical.
|
||||
- Layout draw: natural VEC2 initialization 114/114, 12 stack temporary differences; separate vector assignments 116/114; const references 114/114 with the same 12 offsets. Restored existing exact asm.
|
||||
- updateInputCommon__Q39textinput9inputform12LayoutByNW4RFiUlUlUlPv: typed repeat dispatch: src 0x5c base 0x5c insns 23/23; diffs 0: []; retained exact C++.
|
||||
- updateRepeatInput__Q39textinput9inputform12LayoutByNW4RFUlUl: typed directional repeat timers: src 0x11c base 0x11c insns 71/71; diffs 16: [20, 21, 22, 23, 34, 35, 36, 37, 48, 49, 50, 51, 62, 63, 64, 65]; restored prior body.
|
||||
- doLineFeed__Q39textinput9inputform4BaseFv: line height before cursor query: src 0x98 base 0x98 insns 38/38; diffs 1: [18]; restored prior body.
|
||||
- doScroll__Q39textinput9inputform4BaseFPQ39textinput15CommandReceiver6Scroll: absolute or animated scroll: src 0xc8 base 0xc8 insns 50/50; diffs 0: []; retained exact C++.
|
||||
- init__Q39textinput3gui12GUIComponentFv: guarded point initialization: src 0xd8 base 0xd8 insns 54/54; diffs 0: []; retained exact C++.
|
||||
- updateRepeatInput__Q39textinput9inputform12LayoutByNW4RFUlUl: reuse trigger mask: src 0x11c base 0x11c insns 71/71; diffs 0: []; retained exact C++.
|
||||
- doLineFeed__Q39textinput9inputform4BaseFv: height plus current cursor: src 0x98 base 0x98 insns 38/38; diffs 1: [18]; restored prior body.
|
||||
- doLineFeed__Q39textinput9inputform4BaseFv: cursor scalar addition: src 0x98 base 0x98 insns 38/38; diffs 0: []; retained exact C++.
|
||||
- drawFixString__Q39textinput9inputform4BaseFUl: cursor aggregate initializer: src 0xdc base 0xdc insns 55/55; diffs 7: [2, 3, 9, 10, 28, 35, 36]; restored prior body.
|
||||
- drawFixString__Q39textinput9inputform4BaseFUl: cursor fields first: src 0xdc base 0xdc insns 55/55; diffs 3: [28, 35, 36]; restored prior body.
|
||||
- drawFixString__Q39textinput9inputform4BaseFUl: cursor late position: src 0xdc base 0xdc insns 55/55; diffs 10: [7, 8, 9, 10, 11, 12, 13, 28, 35, 36]; restored prior body.
|
||||
- draw__Q39textinput9inputform4BaseFv: natural draw vectors: src 0x158 base 0x158 insns 86/86; diffs 0: []; retained exact C++.
|
||||
- doBeforeDrawProcess__Q39textinput9inputform4BaseFPCwUlRCQ49textinput10textdrawer4Base8DrawInfo: typed wrapping and selection rectangle: src 0x1cc base 0x1cc insns 115/115; diffs 2: [73, 74]; restored prior body.
|
||||
- doBeforeDrawProcess__Q39textinput9inputform4BaseFPCwUlRCQ49textinput10textdrawer4Base8DrawInfo: selection cursor first operands: src 0x1cc base 0x1cc insns 115/115; diffs 2: [73, 74]; restored prior body.
|
||||
- doBeforeDrawProcess__Q39textinput9inputform4BaseFPCwUlRCQ49textinput10textdrawer4Base8DrawInfo: selected range declaration order: src 0x1cc base 0x1cc insns 115/115; diffs 6: [66, 67, 72, 73, 74, 75]; restored prior body.
|
||||
- drawFixString__Q39textinput9inputform4BaseFUl: widen string length before draw call: src 0xdc base 0xdc insns 55/55; diffs 0: []; retained exact C++.
|
||||
- doBeforeDrawProcess__Q39textinput9inputform4BaseFPCwUlRCQ49textinput10textdrawer4Base8DrawInfo: position-first selected range compare: src 0x1cc base 0x1cc insns 115/115; diffs 0: []; retained exact C++.
|
||||
- getCurrentString__Q39textinput9inputform4BaseFb: typed current string selection: src 0x1bc base 0x1c0 insns 111/112; --- replace mine 11:12 base 11:12; restored prior body.
|
||||
- getCurrentString__Q39textinput9inputform4BaseFb: positive Korean keyboard branch: src 0x1bc base 0x1c0 insns 111/112; --- replace mine 11:12 base 11:12; restored prior body.
|
||||
- getCurrentString__Q39textinput9inputform4BaseFb: separate fix and input predicates: src 0x1cc base 0x1c0 insns 115/112; --- replace mine 11:12 base 11:12; restored prior body.
|
||||
- moveCursorUp__Q39textinput9inputform4BaseFv: typed upper row cursor: src 0x158 base 0x160 insns 86/88; --- replace mine 5:6 base 5:6; restored prior body.
|
||||
- moveCursorUp__Q39textinput9inputform4BaseFv: cursor upper operands: src 0x158 base 0x160 insns 86/88; --- replace mine 5:6 base 5:6; restored prior body.
|
||||
- moveCursorUp__Q39textinput9inputform4BaseFv: upper row index declaration: src 0x158 base 0x160 insns 86/88; --- replace mine 5:6 base 5:6; restored prior body.
|
||||
- moveCursorDown__Q39textinput9inputform4BaseFv: typed lower row cursor: src 0x184 base 0x180 insns 97/96; --- replace mine 5:41 base 5:12; restored prior body.
|
||||
- moveCursorDown__Q39textinput9inputform4BaseFv: cursor lower operands: src 0x184 base 0x180 insns 97/96; --- replace mine 5:41 base 5:12; restored prior body.
|
||||
- moveCursorDown__Q39textinput9inputform4BaseFv: lower row index declaration: src 0x184 base 0x180 insns 97/96; --- replace mine 5:41 base 5:12; restored prior body.
|
||||
- updateCandidateState___Q39textinput9inputform4BaseFv: typed candidate refresh: src 0x228 base 0x1e4 insns 138/121; --- replace mine 9:10 base 9:10; restored prior body.
|
||||
- updateCandidateState___Q39textinput9inputform4BaseFv: prediction buffer after suppress: src 0x228 base 0x1e4 insns 138/121; --- replace mine 9:10 base 9:10; restored prior body.
|
||||
- updateCandidateState___Q39textinput9inputform4BaseFv: bottom-tested candidate loops: src 0x228 base 0x1e4 insns 138/121; --- replace mine 9:10 base 9:10; restored prior body.
|
||||
- updateCandidateState___Q39textinput9inputform4BaseFv: qualified candidate caller methods: src 0x1e4 base 0x1e4 insns 121/121; diffs 0: []; retained exact C++.
|
||||
- moveCursorUp__Q39textinput9inputform4BaseFv: upper boundary emitted first: src 0x158 base 0x160 insns 86/88; --- replace mine 47:48 base 47:48; restored prior body.
|
||||
- moveCursorUp__Q39textinput9inputform4BaseFv: upper clamp ternary: src 0x160 base 0x160 insns 88/88; diffs 2: [58, 59]; restored prior body.
|
||||
- moveCursorUp__Q39textinput9inputform4BaseFv: upper cached coordinate clamp: src 0x158 base 0x160 insns 86/88; --- replace mine 47:48 base 47:48; restored prior body.
|
||||
- moveCursorDown__Q39textinput9inputform4BaseFv: lower boundary emitted first: src 0x180 base 0x180 insns 96/96; diffs 2: [67, 70]; restored prior body.
|
||||
- getCurrentString__Q39textinput9inputform4BaseFb: boolean switch for Atok fix guard: src 0x1c4 base 0x1c0 insns 113/112; --- replace mine 11:12 base 11:12; restored prior body.
|
||||
- moveCursorUp__Q39textinput9inputform4BaseFv: subtract line before virtual cursor setup: src 0x160 base 0x160 insns 88/88; diffs 3: [58, 59, 63]; restored prior body.
|
||||
- moveCursorDown__Q39textinput9inputform4BaseFv: add line before virtual cursor setup: src 0x180 base 0x180 insns 96/96; diffs 0: []; retained exact C++.
|
||||
- isVacancy__Q39textinput9inputform4BaseCFv: typed vacancy predicates: src 0x194 base 0x180 insns 101/96; --- replace mine 20:21 base 20:21; restored prior body.
|
||||
- isVacancy__Q39textinput9inputform4BaseCFv: vacancy signed character comparison: src 0x194 base 0x180 insns 101/96; --- replace mine 20:21 base 20:21; restored prior body.
|
||||
- isVacancy__Q39textinput9inputform4BaseCFv: vacancy positive mode branches: src 0x194 base 0x180 insns 101/96; --- replace mine 20:21 base 20:21; restored prior body.
|
||||
- notifyChangeMode__Q39textinput9inputform4BaseFv: typed keyboard mode notification: src 0x1bc base 0x1b0 insns 111/108; --- replace mine 4:6 base 4:5; restored prior body.
|
||||
- notifyChangeMode__Q39textinput9inputform4BaseFv: Korean predict mode ternary: src 0x1b0 base 0x1b0 insns 108/108; diffs 6: [85, 86, 87, 88, 89, 90]; restored prior body.
|
||||
- notifyChangeMode__Q39textinput9inputform4BaseFv: mode notification switch: src 0x1c8 base 0x1b0 insns 114/108; --- replace mine 4:6 base 4:5; restored prior body.
|
||||
- inputInputting___Q39textinput9inputform4BaseFw: typed inputting dispatch: src 0x280 base 0x284 insns 160/161; --- replace mine 10:11 base 10:11; restored prior body.
|
||||
- inputInputting___Q39textinput9inputform4BaseFw: explicit alphabet input branch: src 0x280 base 0x284 insns 160/161; --- replace mine 10:11 base 10:11; restored prior body.
|
||||
- inputInputting___Q39textinput9inputform4BaseFw: nonpositive prediction count: src 0x280 base 0x284 insns 160/161; --- replace mine 10:11 base 10:11; restored prior body.
|
||||
- isVacancy__Q39textinput9inputform4BaseCFv: if-chain modes and combined selection flags: src 0x180 base 0x180 insns 96/96; diffs 0: []; retained exact C++.
|
||||
- notifyChangeMode__Q39textinput9inputform4BaseFv: separate language assignment branches: src 0x1b0 base 0x1b0 insns 108/108; diffs 0: []; retained exact C++.
|
||||
- inputInputting___Q39textinput9inputform4BaseFw: original range expression and alphabet-first branch: src 0x284 base 0x284 insns 161/161; diffs 0: []; retained exact C++.
|
||||
- autoScroll__Q39textinput9inputform4BaseFv: typed automatic scrolling: src 0x260 base 0x258 insns 152/150; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- autoScroll__Q39textinput9inputform4BaseFv: auto scroll separate vector assignment: src 0x268 base 0x258 insns 154/150; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- autoScroll__Q39textinput9inputform4BaseFv: auto scroll scalar scale: src 0x268 base 0x258 insns 154/150; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- create__Q39textinput9inputform10EditBufferFP12MEMAllocator: typed placement construction: src 0x220 base 0x214 insns 136/133; --- replace mine 14:16 base 14:15; restored prior body.
|
||||
- create__Q39textinput9inputform10EditBufferFP12MEMAllocator: separate construction allocation temporaries: src 0x220 base 0x214 insns 136/133; --- replace mine 14:16 base 14:15; restored prior body.
|
||||
- create__Q39textinput9inputform10EditBufferFP12MEMAllocator: implicit placement null checks: src 0x214 base 0x214 insns 133/133; diffs 0: []; retained exact C++.
|
||||
- onPressLeft__Q39textinput9inputform4BaseFv: typed software left cursor: src 0x264 base 0x268 insns 153/154; --- replace mine 15:16 base 15:16; restored prior body.
|
||||
- onPressLeft__Q39textinput9inputform4BaseFv: left positive motion branch: src 0x264 base 0x268 insns 153/154; --- replace mine 15:16 base 15:16; restored prior body.
|
||||
- onPressLeft__Q39textinput9inputform4BaseFv: left positive prediction count: src 0x264 base 0x268 insns 153/154; --- replace mine 15:16 base 15:16; restored prior body.
|
||||
- onPressRight__Q39textinput9inputform4BaseFv: typed software right cursor: src 0x308 base 0x2e4 insns 194/185; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- onPressRight__Q39textinput9inputform4BaseFv: right nested space condition: src 0x308 base 0x2e4 insns 194/185; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- onPressRight__Q39textinput9inputform4BaseFv: right space initialized fields: src 0x308 base 0x2e4 insns 194/185; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- __ct__Q39textinput9inputform4BaseFPQ29textinput7Manager: typed input form constructor: src 0x218 base 0x210 insns 134/132; --- replace mine 6:7 base 6:7; restored prior body.
|
||||
- __ct__Q39textinput9inputform4BaseFPQ29textinput7Manager: constructor body pointer assignments: src 0x218 base 0x210 insns 134/132; --- replace mine 6:7 base 6:7; restored prior body.
|
||||
- __ct__Q39textinput9inputform4BaseFPQ29textinput7Manager: constructor explicit rectangle: src 0x218 base 0x210 insns 134/132; --- replace mine 6:7 base 6:7; restored prior body.
|
||||
- __ct__Q39textinput9inputform4BaseFPQ29textinput7Manager: correct sender reset and packed color: src 0x210 base 0x210 insns 132/132; diffs 0: []; retained exact C++.
|
||||
- init__Q49textinput9inputform4Base14RowInfoManagerFv: typed row sentinel initialization: src 0xbc base 0x9c insns 47/39; --- replace mine 16:18 base 16:21; restored prior body.
|
||||
- init__Q49textinput9inputform4Base14RowInfoManagerFv: row sentinel pointer temporary: src 0xac base 0x9c insns 43/39; --- replace mine 12:13 base 12:13; restored prior body.
|
||||
- init__Q49textinput9inputform4Base14RowInfoManagerFv: row unused sentinel pointer: src 0xb0 base 0x9c insns 44/39; --- replace mine 16:18 base 16:21; restored prior body.
|
||||
- create__Q39textinput9inputform4BaseFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: typed base row allocation: compile failed (10412 illegal access from 'textinput::inputform::EditBuffer' to); restored prior body.
|
||||
- create__Q39textinput9inputform4BaseFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: detached-row insertion guard: compile failed (10412 illegal access from 'textinput::inputform::EditBuffer' to); restored prior body.
|
||||
- create__Q39textinput9inputform4BaseFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: reload row-list after removal: compile failed (10412 illegal access from 'textinput::inputform::EditBuffer' to); restored prior body.
|
||||
- create__Q39textinput9inputform4BaseFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: typed base row allocation: compile failed (10412 illegal access from 'textinput::inputform::EditBuffer' to); restored prior body.
|
||||
- create__Q39textinput9inputform4BaseFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: detached-row insertion guard: compile failed (10412 illegal access from 'textinput::inputform::EditBuffer' to); restored prior body.
|
||||
- create__Q39textinput9inputform4BaseFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: reload row-list after removal: compile failed (10412 illegal access from 'textinput::inputform::EditBuffer' to); restored prior body.
|
||||
- create__Q39textinput9inputform4BaseFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: typed base row allocation: src 0x114 base 0x120 insns 69/72; --- replace mine 27:28 base 27:60; restored prior body.
|
||||
- create__Q39textinput9inputform4BaseFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: detached-row insertion guard: src 0x11c base 0x120 insns 71/72; --- replace mine 28:29 base 28:29; restored prior body.
|
||||
- create__Q39textinput9inputform4BaseFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: reload row-list after removal: src 0x118 base 0x120 insns 70/72; --- replace mine 27:28 base 27:60; restored prior body.
|
||||
- calc__Q39textinput9inputform4BaseFv: typed selection color animation: src 0x294 base 0x294 insns 165/165; diffs 13: [21, 53, 126, 127, 128, 129, 130, 131, 132, 151, 152, 153, 154]; restored prior body.
|
||||
- calc__Q39textinput9inputform4BaseFv: color green before red assignment: src 0x294 base 0x294 insns 165/165; diffs 17: [21, 53, 78, 79, 82, 83, 126, 127, 128, 129, 130, 131, 132, 151, 152, 153, 154]; restored prior body.
|
||||
- calc__Q39textinput9inputform4BaseFv: color time increment operand order: src 0x294 base 0x294 insns 165/165; diffs 12: [21, 53, 126, 127, 128, 129, 130, 131, 132, 152, 153, 154]; restored prior body.
|
||||
- findURL__Q39textinput9inputform4BaseFPUlPUlPCwUlUl: typed URL prefix scan: compile failed (10248 function call '[textinput::inputform::Base].wcsnicmp({lval} const); restored prior body.
|
||||
- findURL__Q39textinput9inputform4BaseFPUlPUlPCwUlUl: nested character range scan: compile failed (10248 function call '[textinput::inputform::Base].wcsnicmp({lval} const); restored prior body.
|
||||
- findURL__Q39textinput9inputform4BaseFPUlPUlPCwUlUl: pointer iterator URL prefix scan: compile failed (10248 function call '[textinput::inputform::Base].wcsnicmp({lval} const); restored prior body.
|
||||
- findURL__Q39textinput9inputform4BaseFPUlPUlPCwUlUl: typed URL prefix scan: src 0x190 base 0x1bc insns 100/111; --- insert mine 5:5 base 5:6; restored prior body.
|
||||
- findURL__Q39textinput9inputform4BaseFPUlPUlPCwUlUl: nested character range scan: src 0x190 base 0x1bc insns 100/111; --- insert mine 5:5 base 5:6; restored prior body.
|
||||
- findURL__Q39textinput9inputform4BaseFPUlPUlPCwUlUl: pointer iterator URL prefix scan: src 0x190 base 0x1bc insns 100/111; --- insert mine 5:5 base 5:6; restored prior body.
|
||||
- drawCursor__Q39textinput9inputform4BaseFff: typed blinking cursor line: src 0x11c base 0x118 insns 71/70; --- insert mine 48:48 base 48:57; restored prior body.
|
||||
- drawCursor__Q39textinput9inputform4BaseFff: cursor scalar opacity after coordinates: src 0x11c base 0x118 insns 71/70; --- insert mine 48:48 base 48:57; restored prior body.
|
||||
- drawCursor__Q39textinput9inputform4BaseFff: cursor explicit alpha accumulator: src 0x11c base 0x118 insns 71/70; --- replace mine 34:35 base 34:35; restored prior body.
|
||||
- isOverLine__Q39textinput9inputform4BaseFRCQ49textinput10textdrawer4Base8DrawInfo: typed line limit scales: src 0xdc base 0xcc insns 55/51; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- isOverLine__Q39textinput9inputform4BaseFRCQ49textinput10textdrawer4Base8DrawInfo: line limit scalar scale: src 0xec base 0xcc insns 59/51; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- isOverLine__Q39textinput9inputform4BaseFRCQ49textinput10textdrawer4Base8DrawInfo: line limit const vector references: src 0xdc base 0xcc insns 55/51; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- isAtokActive__Q39textinput9inputform4BaseCFv: explicit Atok boolean assignment: src 0x30 base 0x28 insns 12/10; --- delete mine 2:5 base 2:2; restored prior body.
|
||||
- isAtokActive__Q39textinput9inputform4BaseCFv: Atok boolean switch guard: src 0x28 base 0x28 insns 10/10; diffs 2: [1, 2]; restored prior body.
|
||||
- isAtokActive__Q39textinput9inputform4BaseCFv: Atok integer guard: src 0x28 base 0x28 insns 10/10; diffs 0: []; retained exact C++.
|
||||
- create__Q39textinput9inputform4BaseFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: detached row guard with fresh list pointer: src 0x120 base 0x120 insns 72/72; diffs 26: [28, 30, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 46, 49, 51, 53, 54, 55, 56]; restored prior body.
|
||||
- drawCursor__Q39textinput9inputform4BaseFff: font height in line endpoint argument: src 0x118 base 0x118 insns 70/70; diffs 2: [59, 61]; restored prior body.
|
||||
- onPressRightHWKB__Q39textinput9inputform4BaseFv: onPressRightHWKB integer zero switch: src 0x450 base 0x44c insns 276/275; --- replace mine 19:20 base 19:20; restored prior body.
|
||||
- onPressRightHWKB__Q39textinput9inputform4BaseFv: onPressRightHWKB integer one switch: src 0x44c base 0x44c insns 275/275; diffs 2: [93, 94]; restored prior body.
|
||||
- onPressRightHWKB__Q39textinput9inputform4BaseFv: onPressRightHWKB integer zero guard: src 0x448 base 0x44c insns 274/275; --- replace mine 19:20 base 19:20; restored prior body.
|
||||
- onPressLeftHWKB__Q39textinput9inputform4BaseFv: onPressLeftHWKB integer zero switch: src 0x424 base 0x420 insns 265/264; --- replace mine 19:20 base 19:20; restored prior body.
|
||||
- onPressLeftHWKB__Q39textinput9inputform4BaseFv: onPressLeftHWKB integer one switch: src 0x420 base 0x420 insns 264/264; diffs 2: [93, 94]; restored prior body.
|
||||
- onPressLeftHWKB__Q39textinput9inputform4BaseFv: onPressLeftHWKB integer zero guard: src 0x41c base 0x420 insns 263/264; --- replace mine 19:20 base 19:20; restored prior body.
|
||||
- onPressUp__Q39textinput9inputform4BaseFv: onPressUp integer zero switch: src 0x3dc base 0x3d8 insns 247/246; --- replace mine 11:12 base 11:12; restored prior body.
|
||||
- onPressUp__Q39textinput9inputform4BaseFv: onPressUp integer one switch: src 0x3d8 base 0x3d8 insns 246/246; diffs 2: [199, 200]; restored prior body.
|
||||
- onPressUp__Q39textinput9inputform4BaseFv: onPressUp integer zero guard: src 0x3d4 base 0x3d8 insns 245/246; --- replace mine 11:12 base 11:12; restored prior body.
|
||||
- onPressDown__Q39textinput9inputform4BaseFv: onPressDown integer zero switch: src 0x3dc base 0x3d8 insns 247/246; --- replace mine 11:12 base 11:12; restored prior body.
|
||||
- onPressDown__Q39textinput9inputform4BaseFv: onPressDown integer one switch: src 0x3d8 base 0x3d8 insns 246/246; diffs 2: [199, 200]; restored prior body.
|
||||
- onPressDown__Q39textinput9inputform4BaseFv: onPressDown integer zero guard: src 0x3d4 base 0x3d8 insns 245/246; --- replace mine 11:12 base 11:12; restored prior body.
|
||||
- calc__Q39textinput9inputform4BaseFv: real color phase and scrolling float assignment: compile failed (10140 undefined identifier 'sfColorPhase'); restored prior body.
|
||||
- calc__Q39textinput9inputform4BaseFv: pulse query beside blue interpolation: compile failed (10140 undefined identifier 'sfColorPhase'); restored prior body.
|
||||
- calc__Q39textinput9inputform4BaseFv: real color phase and scrolling float assignment: src 0x294 base 0x294 insns 165/165; diffs 11: [53, 126, 127, 128, 129, 130, 131, 132, 152, 153, 154]; restored prior body.
|
||||
- calc__Q39textinput9inputform4BaseFv: pulse query beside blue interpolation: src 0x294 base 0x294 insns 165/165; diffs 8: [53, 126, 128, 129, 130, 152, 153, 154]; restored prior body.
|
||||
- onCursor__Q39textinput9inputform4BaseFPQ49textinput10textdrawer4Base9CursorPos: cursor centered width subtraction: compile failed (33026 <string not found>); restored prior body.
|
||||
- onCursor__Q39textinput9inputform4BaseFPQ49textinput10textdrawer4Base9CursorPos: cursor scale first multiplication: compile failed (33026 <string not found>); restored prior body.
|
||||
- onCursor__Q39textinput9inputform4BaseFPQ49textinput10textdrawer4Base9CursorPos: cursor half-width local: compile failed (33026 <string not found>); restored prior body.
|
||||
- onPressDownHWKB__Q39textinput9inputform4BaseFv: down HWKB selected local scope: compile failed (33026 <string not found>); restored prior body.
|
||||
- onPressDownHWKB__Q39textinput9inputform4BaseFv: down HWKB selected initial value: compile failed (33026 <string not found>); restored prior body.
|
||||
- onPressDownHWKB__Q39textinput9inputform4BaseFv: down HWKB unsigned kana predicate: compile failed (33026 <string not found>); restored prior body.
|
||||
- onCursor__Q39textinput9inputform4BaseFPQ49textinput10textdrawer4Base9CursorPos: cursor centered width subtraction: src 0x764 base 0x764 insns 473/473; diffs 15: [265, 267, 268, 269, 271, 272, 273, 274, 275, 276, 277, 278, 280, 281, 283]; restored prior body.
|
||||
- onCursor__Q39textinput9inputform4BaseFPQ49textinput10textdrawer4Base9CursorPos: cursor scale first multiplication: src 0x764 base 0x764 insns 473/473; diffs 5: [271, 273, 276, 281, 283]; restored prior body.
|
||||
- onCursor__Q39textinput9inputform4BaseFPQ49textinput10textdrawer4Base9CursorPos: cursor half-width local: src 0x764 base 0x764 insns 473/473; diffs 17: [265, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 283]; restored prior body.
|
||||
- onPressDownHWKB__Q39textinput9inputform4BaseFv: down HWKB selected local scope: src 0x428 base 0x438 insns 266/270; --- replace mine 16:17 base 16:17; restored prior body.
|
||||
- onPressDownHWKB__Q39textinput9inputform4BaseFv: down HWKB selected initial value: src 0x428 base 0x438 insns 266/270; --- replace mine 16:17 base 16:17; restored prior body.
|
||||
- onPressDownHWKB__Q39textinput9inputform4BaseFv: down HWKB unsigned kana predicate: src 0x428 base 0x438 insns 266/270; --- replace mine 16:17 base 16:17; restored prior body.
|
||||
- onSpaceKeyHWKB__Q39textinput9inputform4BaseFUl: space-key prediction integer predicate: src 0x96c base 0x96c insns 603/603; diffs 7: [193, 194, 195, 196, 197, 198, 199]; restored prior body.
|
||||
- onSpaceKeyHWKB__Q39textinput9inputform4BaseFUl: space-key prediction initialization: src 0x96c base 0x96c insns 603/603; diffs 7: [193, 194, 195, 196, 197, 198, 199]; restored prior body.
|
||||
- onSpaceKeyHWKB__Q39textinput9inputform4BaseFUl: space-key positive prediction predicate: src 0x96c base 0x96c insns 603/603; diffs 11: [92, 93, 193, 194, 195, 196, 197, 198, 199, 410, 411]; restored prior body.
|
||||
- setLanguage__Q39textinput9inputform12LayoutByNW4RFQ29textinput8Language: language root query reference: src 0x3b8 base 0x3b4 insns 238/237; --- delete mine 52:53 base 52:52; restored prior body.
|
||||
- setLanguage__Q39textinput9inputform12LayoutByNW4RFQ29textinput8Language: language selected pane name temporary: src 0x3b4 base 0x3b4 insns 237/237; diffs 22: [57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 118, 119, 120, 121, 122, 123, 124, 125, 126]; restored prior body.
|
||||
- setLanguage__Q39textinput9inputform12LayoutByNW4RFQ29textinput8Language: language title pane declaration: src 0x3b4 base 0x3b4 insns 237/237; diffs 59: [57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 82, 83, 90, 91, 92, 95, 98]; restored prior body.
|
||||
- create__Q39textinput9inputform12LayoutByNW4RFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: layout detached row insertion guard: src 0x5a0 base 0x590 insns 360/356; --- replace mine 5:6 base 5:6; restored prior body.
|
||||
- create__Q39textinput9inputform12LayoutByNW4RFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: layout row list reload: src 0x594 base 0x590 insns 357/356; --- replace mine 5:6 base 5:6; restored prior body.
|
||||
- create__Q39textinput9inputform12LayoutByNW4RFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: layout narrow button counter: src 0x590 base 0x590 insns 356/356; diffs 205: [5, 7, 8, 10, 14, 15, 16, 20, 22, 23, 25, 26, 28, 29, 30, 31, 32, 33, 34, 35]; restored prior body.
|
||||
- calcCursorPos__Q39textinput9inputform4BaseFff: cursor position bottom-independent loop: src 0x518 base 0x518 insns 326/326; diffs 81: [28, 45, 49, 51, 58, 60, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 94]; restored prior body.
|
||||
- calcCursorPos__Q39textinput9inputform4BaseFff: cursor position separate scale assignment: src 0x520 base 0x518 insns 328/326; --- replace mine 28:29 base 28:29; restored prior body.
|
||||
- calcCursorPos__Q39textinput9inputform4BaseFff: cursor position string before scroll coordinate: src 0x51c base 0x518 insns 327/326; --- delete mine 22:23 base 22:22; restored prior body.
|
||||
- isOverRowLimit__Q39textinput9inputform4BaseFUlPCw: row limit separate scale assignment: src 0x3b4 base 0x3b8 insns 237/238; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- isOverRowLimit__Q39textinput9inputform4BaseFUlPCw: row limit defer scalar width: src 0x3b0 base 0x3b8 insns 236/238; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- isOverRowLimit__Q39textinput9inputform4BaseFUlPCw: row limit glyph rectangle constructor: src 0x3c0 base 0x3b8 insns 240/238; --- replace mine 14:15 base 14:15; restored prior body.
|
||||
- onCommand__Q39textinput9inputform4BaseFQ39textinput15CommandReceiver13INPUT_COMMANDPv: command fixed string predicate integer: src 0x2020 base 0x2014 insns 2056/2053; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- onCommand__Q39textinput9inputform4BaseFQ39textinput15CommandReceiver13INPUT_COMMANDPv: command uncached fixed string comparison: src 0x2020 base 0x2014 insns 2056/2053; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- onCommand__Q39textinput9inputform4BaseFQ39textinput15CommandReceiver13INPUT_COMMANDPv: command fixed string declaration after predicate: src 0x2020 base 0x2014 insns 2056/2053; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- isEnableCursorCache__Q39textinput10textdrawer4BaseCFv: cache bool ternary: ; restored prior body.
|
||||
- Cursor-cache cache bool ternary: 8/8 bytes; raw equal True. Original symbol remains malformed; no aliases/config changes.
|
||||
- isEnableCursorCache__Q39textinput10textdrawer4BaseCFv: cache positive branch: ; restored prior body.
|
||||
- Cursor-cache cache positive branch: 8/8 bytes; raw equal True. Original symbol remains malformed; no aliases/config changes.
|
||||
- isEnableCursorCache__Q39textinput10textdrawer4BaseCFv: cache byte predicate: ; restored prior body.
|
||||
- Cursor-cache cache byte predicate: 20/8 bytes; raw equal False. Original symbol remains malformed; no aliases/config changes.
|
||||
|
||||
## Third continuation handoff
|
||||
- Converted 29 existing asm bodies instruction-exact to C++; 41 -> 12 remain. All twelve remaining asm bodies and every report-nonmatching function have at least three distinct compiled source-level attempts logged, including the cursor-cache raw-byte audit. Failed preliminary builds are recorded separately.
|
||||
- Real data restored: UTF-16 URL prefix table uses ordinary wide literals; selection-color phase is an ordinary zero-initialized float replacing the inherited address-label extern. No explicit data placement was added. Pool remains identical, and .rodata/.sdata/.sdata2 remain 100%.
|
||||
- Data experiment: deferring the real singleton inline definition moves its weak guard/object after the color storage, but also moves its destructor registrar behind the colors, changing seven initializer offsets. Restored the original singleton definition. Real color state occupies offsets 0x08..0x24 in the compiled .sbss because the guard/object occupy the first eight bytes; the extracted target lacks these deduplicated weak objects. No padding, force-active, section changes or symbol aliases were added.
|
||||
- Weak Decolated and GUIComponent vtables appear after genuine constructors/init are restored. Their original deduplicated output is absent/zero-filled; extracted EditBuffer and textinput Base vtables also retain trailing zero gaps. Data is still incomplete. No linking-mode changes or DOL investigation.
|
||||
- The gate's character-plus-0xcf65 review note concerns a wchar_t numeric range test, not a pointer into a string blob. It reproduces the target addis/addi and inclusive range comparison.
|
||||
- Uncertain: the exact semantic name of WithZi's final flag at 0xa8, and some reconstructed drawer viewport/cache fields. Their offsets, sizes, zero initialization and instruction uses are verified; linking of weak data remains outside this phase.
|
||||
|
||||
### Remaining report-nonmatching functions
|
||||
Base::onCommand, 88.05163%, stack frame, register allocation and case scheduling.
|
||||
Base::onCursor, 99.915436%, five centered-space FP register/operand differences.
|
||||
Base::calcCursorPos, 90.671776%, FP scheduling and register allocation.
|
||||
Base::onPressUp, 99.55285%, one missing kana guard tail branch.
|
||||
Base::onPressDown, 99.55285%, one missing kana guard tail branch.
|
||||
Base::onPressDownHWKB, 98.35185%, candidate branches, index registers and trailing comparison.
|
||||
Base::onPressLeftHWKB, 99.97727%, two kana comparison/polarity instructions.
|
||||
Base::onPressRightHWKB, 99.97818%, two kana comparison/polarity instructions.
|
||||
Base::onSpaceKeyHWKB, 99.32007%, seven Atok Boolean block-order instructions.
|
||||
LayoutByNW4R::create, 88.91854%, row-list scheduling, registers and loops.
|
||||
LayoutByNW4R::setLanguage, 96.44726%, 22 root-load scheduling differences.
|
||||
Base::isOverRowLimit, 93.63866%, stack frame, FP scheduling and registers.
|
||||
textdrawer::Base::isEnableCursorCache, None%, original report symbol concatenates getStartPos; actual 8 bytes are exact.
|
||||
|
||||
### Exact asm bodies still requiring C++
|
||||
extern "C" asm void draw__Q39textinput9inputform12LayoutByNW4RFv(), objdiff 100%, 114/114 C++ instructions, twelve vector temporary offsets.
|
||||
extern "C" asm bool findURL__Q39textinput9inputform4BaseFPUlPUlPCwUlUl(), objdiff 100%, 100/111 C++ instructions, balanced character classification and registers.
|
||||
extern "C" asm void autoScroll__Q39textinput9inputform4BaseFv(), objdiff 100%, 152/150 C++ instructions, frame and FP scheduling.
|
||||
extern "C" asm void create__Q39textinput9inputform4BaseFP12MEMAllocatorPQ39textinput9inputform10EditBuffer(), objdiff 100%, 72/72 C++ instructions, 26 register differences.
|
||||
extern "C" asm void getCurrentString__Q39textinput9inputform4BaseFb(), objdiff 100%, 111/112 C++ instructions, Atok guard tail branch.
|
||||
extern "C" asm void moveCursorUp__Q39textinput9inputform4BaseFv(), objdiff 100%, 88/88 C++ instructions, two subtract/vtable scheduling differences.
|
||||
extern "C" asm void onPressLeft__Q39textinput9inputform4BaseFv(), objdiff 100%, 153/154 C++ instructions, kana guard and Boolean block order.
|
||||
extern "C" asm void onPressRight__Q39textinput9inputform4BaseFv(), objdiff 100%, 194/185 C++ instructions, space buffer copy and kana guard.
|
||||
extern "C" asm void calc__Q39textinput9inputform4BaseFv(), objdiff 100%, 165/165 C++ instructions, eight FP/store scheduling differences.
|
||||
extern "C" asm void init__Q49textinput9inputform4Base14RowInfoManagerFv(), objdiff 100%, 43/39 C++ instructions, sentinel pointer loads.
|
||||
asm bool Base::isOverLine(const DrawInfo& drawInfo), objdiff 100%, 55/51 C++ instructions, vector temporary copies.
|
||||
asm void Base::drawCursor(f32, f32), objdiff 100%, 70/70 C++ instructions, two linewidth result register differences.
|
||||
|
||||
### Final full gate
|
||||
```text
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[src/keyboard/tiInputForm] pool: IDENTICAL
|
||||
[src/keyboard/tiInputForm] objdiff: code 28300/50656 data 908/3772 functions 208/221 fuzzy 97.2205 linked code 0
|
||||
[src/keyboard/tiInputForm] instruction-exact functions: 206/221
|
||||
[src/keyboard/tiInputForm] section .bss size 96 match None
|
||||
[src/keyboard/tiInputForm] section .ctors size 4 match 100.0
|
||||
[src/keyboard/tiInputForm] section .data size 2736 match 65.53332
|
||||
[src/keyboard/tiInputForm] section .rodata size 760 match 100.0
|
||||
[src/keyboard/tiInputForm] section .sbss size 32 match 33.333336
|
||||
[src/keyboard/tiInputForm] section .sdata size 40 match 100.0
|
||||
[src/keyboard/tiInputForm] section .sdata2 size 104 match 100.0
|
||||
[src/keyboard/tiInputForm] section .text size 50656 match 97.22054
|
||||
[src/keyboard/tiInputForm] below 100: onCommand__Q39textinput9inputform4BaseFQ39textinput15CommandReceiver13INPUT_COMMANDPv 88.05163
|
||||
[src/keyboard/tiInputForm] below 100: onCursor__Q39textinput9inputform4BaseFPQ49textinput10textdrawer4Base9CursorPos 99.915436
|
||||
[src/keyboard/tiInputForm] below 100: calcCursorPos__Q39textinput9inputform4BaseFff 90.671776
|
||||
[src/keyboard/tiInputForm] below 100: onPressUp__Q39textinput9inputform4BaseFv 99.55285
|
||||
[src/keyboard/tiInputForm] below 100: onPressDown__Q39textinput9inputform4BaseFv 99.55285
|
||||
[src/keyboard/tiInputForm] below 100: onPressDownHWKB__Q39textinput9inputform4BaseFv 98.35185
|
||||
[src/keyboard/tiInputForm] below 100: onPressLeftHWKB__Q39textinput9inputform4BaseFv 99.97727
|
||||
[src/keyboard/tiInputForm] below 100: onPressRightHWKB__Q39textinput9inputform4BaseFv 99.97818
|
||||
[src/keyboard/tiInputForm] below 100: onSpaceKeyHWKB__Q39textinput9inputform4BaseFUl 99.32007
|
||||
[src/keyboard/tiInputForm] below 100: create__Q39textinput9inputform12LayoutByNW4RFP12MEMAllocatorPQ39textinput9inputform10EditBuffer 88.91854
|
||||
[src/keyboard/tiInputForm] below 100: setLanguage__Q39textinput9inputform12LayoutByNW4RFQ29textinput8Language 96.44726
|
||||
[src/keyboard/tiInputForm] below 100: isOverRowLimit__Q39textinput9inputform4BaseFUlPCw 93.63866
|
||||
[src/keyboard/tiInputForm] below 100: isEnableCursorCache__Q39textinput10textdrawer4BaseCFvgetStartPos__Q39textinput10textdrawer4BaseCFv None
|
||||
[src/keyboard/tiInputForm] baseline: code 28300/50656 data 908 functions 208 fuzzy 97.2205
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 72.81211 -> 72.81211
|
||||
global fuzzy_match_percent: 82.03321 -> 82.03321
|
||||
global complete_code_percent: 56.76068 -> 56.76068
|
||||
global matched_data_percent: 86.27892 -> 86.27892
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
review note: src/keyboard/tiInputForm.cpp: possible pointer+offset into a blob (orchestrator reviews) (+1 net), e.g. if (static_cast<u16>(character + 0xcf65) <= 1) {
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
## Fourth continuation
|
||||
- Baseline: 206/221 instruction-exact, 208/221 objdiff exact, code 28300/50656, data 908/3772; twelve exact asm bodies remain. Applying unslop to the attempt log and final handoff.
|
||||
- onPressLeftHWKB__Q39textinput9inputform4BaseFv: signed kana direct zero guard: src 0x41c base 0x420 insns 263/264; --- replace mine 19:20 base 19:20; restored prior body.
|
||||
- onPressLeftHWKB__Q39textinput9inputform4BaseFv: signed kana zero case switch: src 0x424 base 0x420 insns 265/264; --- replace mine 19:20 base 19:20; restored prior body.
|
||||
- onPressLeftHWKB__Q39textinput9inputform4BaseFv: signed kana result local: src 0x41c base 0x420 insns 263/264; --- replace mine 19:20 base 19:20; restored prior body.
|
||||
- onPressRightHWKB__Q39textinput9inputform4BaseFv: signed kana direct zero guard: src 0x448 base 0x44c insns 274/275; --- replace mine 19:20 base 19:20; restored prior body.
|
||||
- onPressRightHWKB__Q39textinput9inputform4BaseFv: signed kana zero case switch: src 0x450 base 0x44c insns 276/275; --- replace mine 19:20 base 19:20; restored prior body.
|
||||
- onPressRightHWKB__Q39textinput9inputform4BaseFv: signed kana result local: src 0x448 base 0x44c insns 274/275; --- replace mine 19:20 base 19:20; restored prior body.
|
||||
- isOverLine__Q39textinput9inputform4BaseFRCQ49textinput10textdrawer4Base8DrawInfo: plain scale aggregates: src 0xdc base 0xcc insns 55/51; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- isOverLine__Q39textinput9inputform4BaseFRCQ49textinput10textdrawer4Base8DrawInfo: scale assignment into declared vectors: src 0xec base 0xcc insns 59/51; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- isOverLine__Q39textinput9inputform4BaseFRCQ49textinput10textdrawer4Base8DrawInfo: plain scale aggregates width first: src 0xdc base 0xcc insns 55/51; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- draw__Q39textinput9inputform12LayoutByNW4RFv: clip declared before scale: src 0x1dc base 0x1c8 insns 119/114; --- insert mine 44:44 base 44:49; restored prior body.
|
||||
- draw__Q39textinput9inputform12LayoutByNW4RFv: global declared before scale: src 0x1c8 base 0x1c8 insns 114/114; diffs 14: [50, 56, 59, 60, 63, 64, 65, 66, 67, 68, 69, 70, 73, 75]; restored prior body.
|
||||
- draw__Q39textinput9inputform12LayoutByNW4RFv: plain global scale aggregates: src 0x1c8 base 0x1c8 insns 114/114; diffs 12: [50, 56, 59, 60, 63, 64, 65, 66, 67, 69, 73, 75]; restored prior body.
|
||||
- drawCursor__Q39textinput9inputform4BaseFff: cursor direct byte thickness: src 0x118 base 0x118 insns 70/70; diffs 0: []; retained exact C++.
|
||||
- Guarded signed isKanaFix return experiment: the callee stays 19/19 exact; HWKB direct zero guard loses one tail branch, zero-case switch adds one, result local loses one. Restored the original bool signature.
|
||||
- moveCursorUp__Q39textinput9inputform4BaseFv: upper row coordinate compound subtract: src 0x160 base 0x160 insns 88/88; diffs 3: [58, 59, 63]; restored prior body.
|
||||
- moveCursorUp__Q39textinput9inputform4BaseFv: upper row coordinate separate index: src 0x160 base 0x160 insns 88/88; diffs 0: []; retained exact C++.
|
||||
- isOverLine__Q39textinput9inputform4BaseFRCQ49textinput10textdrawer4Base8DrawInfo: line direct scale expressions: src 0xc0 base 0xcc insns 48/51; --- delete mine 7:8 base 7:7; restored prior body.
|
||||
- isOverLine__Q39textinput9inputform4BaseFRCQ49textinput10textdrawer4Base8DrawInfo: line intermediate field span: src 0xbc base 0xcc insns 47/51; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- isOverLine__Q39textinput9inputform4BaseFRCQ49textinput10textdrawer4Base8DrawInfo: line direct width expressions: src 0xac base 0xcc insns 43/51; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- getCurrentString__Q39textinput9inputform4BaseFb: current string prediction switch: src 0x1c0 base 0x1c0 insns 112/112; diffs 0: []; retained exact C++.
|
||||
- findURL__Q39textinput9inputform4BaseFPUlPUlPCwUlUl: URL switch with ASCII character classes: src 0x1b8 base 0x1bc insns 110/111; --- insert mine 5:5 base 5:6; restored prior body.
|
||||
- findURL__Q39textinput9inputform4BaseFPUlPUlPCwUlUl: URL switch reordered letter cases: src 0x1b4 base 0x1bc insns 109/111; --- insert mine 5:5 base 5:6; restored prior body.
|
||||
- findURL__Q39textinput9inputform4BaseFPUlPUlPCwUlUl: URL switch prefix pointer iteration: src 0x1b8 base 0x1bc insns 110/111; --- insert mine 5:5 base 5:6; restored prior body.
|
||||
- findURL__Q39textinput9inputform4BaseFPUlPUlPCwUlUl: URL prefix table cached before scan: src 0x1bc base 0x1bc insns 111/111; diffs 20: [5, 9, 10, 11, 15, 57, 66, 73, 74, 76, 79, 80, 82, 88, 89, 91, 93, 95, 101, 102]; restored prior body.
|
||||
- findURL__Q39textinput9inputform4BaseFPUlPUlPCwUlUl: URL cached prefix iterator: src 0x1bc base 0x1bc insns 111/111; diffs 36: [5, 9, 10, 11, 12, 13, 15, 53, 57, 58, 60, 62, 66, 69, 71, 73, 74, 75, 76, 77]; restored prior body.
|
||||
- findURL__Q39textinput9inputform4BaseFPUlPUlPCwUlUl: URL length before word pointer declaration: src 0x1bc base 0x1bc insns 111/111; diffs 31: [5, 9, 10, 11, 12, 13, 15, 53, 57, 58, 60, 62, 66, 69, 71, 73, 75, 76, 79, 82]; restored prior body.
|
||||
- onPressLeft__Q39textinput9inputform4BaseFv: left explicit kana cases: src 0x278 base 0x268 insns 158/154; --- replace mine 15:16 base 15:16; restored prior body.
|
||||
- onPressLeft__Q39textinput9inputform4BaseFv: left kana guard in loop: src 0x26c base 0x268 insns 155/154; --- replace mine 15:16 base 15:16; restored prior body.
|
||||
- onPressLeft__Q39textinput9inputform4BaseFv: left kana negative switch: src 0x274 base 0x268 insns 157/154; --- replace mine 15:16 base 15:16; restored prior body.
|
||||
- onPressRight__Q39textinput9inputform4BaseFv: right aggregate space then clear: src 0x308 base 0x2e4 insns 194/185; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- onPressRight__Q39textinput9inputform4BaseFv: right byte-copy ordinary wide literal: src 0x2cc base 0x2e4 insns 179/185; --- replace mine 15:16 base 15:16; restored prior body.
|
||||
- onPressRight__Q39textinput9inputform4BaseFv: right initialized space pair: src 0x2cc base 0x2e4 insns 179/185; --- replace mine 15:16 base 15:16; restored prior body.
|
||||
- autoScroll__Q39textinput9inputform4BaseFv: automatic scroll direct scale expression: src 0x26c base 0x258 insns 155/150; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- autoScroll__Q39textinput9inputform4BaseFv: automatic scroll inline row conversion: src 0x26c base 0x258 insns 155/150; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- autoScroll__Q39textinput9inputform4BaseFv: automatic scroll height-first scale expression: src 0x258 base 0x258 insns 150/150; diffs 25: [26, 50, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 118, 120, 122, 123, 124, 125, 126]; restored prior body.
|
||||
- init__Q49textinput9inputform4Base14RowInfoManagerFv: row sentinel full-width index: src 0xbc base 0x9c insns 47/39; --- replace mine 1:3 base 1:2; restored prior body.
|
||||
- init__Q49textinput9inputform4Base14RowInfoManagerFv: row end indices captured before stores: src 0xb8 base 0x9c insns 46/39; --- replace mine 12:13 base 12:13; restored prior body.
|
||||
- init__Q49textinput9inputform4Base14RowInfoManagerFv: row sentinel pair reference: src 0xa0 base 0x9c insns 40/39; --- replace mine 12:13 base 12:13; restored prior body.
|
||||
- init__Q49textinput9inputform4Base14RowInfoManagerFv: row end cached preceding index: src 0x9c base 0x9c insns 39/39; diffs 15: [12, 14, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]; restored prior body.
|
||||
- init__Q49textinput9inputform4Base14RowInfoManagerFv: row end pointer instead of reference: src 0x9c base 0x9c insns 39/39; diffs 15: [12, 14, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]; restored prior body.
|
||||
- init__Q49textinput9inputform4Base14RowInfoManagerFv: row end loop pair references: src 0x9c base 0x9c insns 39/39; diffs 15: [12, 14, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]; restored prior body.
|
||||
- calc__Q39textinput9inputform4BaseFv: color direct byte blue conversion: src 0x294 base 0x294 insns 165/165; diffs 8: [53, 126, 128, 129, 130, 152, 153, 154]; restored prior body.
|
||||
- calc__Q39textinput9inputform4BaseFv: color timer and phase locals before updates: src 0x294 base 0x294 insns 165/165; diffs 6: [53, 126, 128, 129, 130, 155]; restored prior body.
|
||||
- calc__Q39textinput9inputform4BaseFv: color direct byte channels: src 0x294 base 0x294 insns 165/165; diffs 8: [53, 126, 128, 129, 130, 152, 153, 154]; restored prior body.
|
||||
- create__Q39textinput9inputform4BaseFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: base row selected reference: compile failed build/43U/src/src/keyboard && "/usr/bin/python3" tools/transform_dep.py build/43U/src/src/keyboard/tiInputForm.d build/43U/src/src/keyboard/tiInputForm.d ### mwcceppc.exe Compiler: # File: src\keyboard\tiInputForm.cpp # ------------------------------------- # 1903: u16 previous = selected.Back; # Error: ^^^^ # (10141) expression syntax error # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. ; restored prior body.
|
||||
- create__Q39textinput9inputform4BaseFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: base row detached state captured: src 0x120 base 0x120 insns 72/72; diffs 26: [28, 30, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 46, 49, 51, 53, 54, 55, 56]; restored prior body.
|
||||
- create__Q39textinput9inputform4BaseFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: base row next preceding index order: src 0x120 base 0x120 insns 72/72; diffs 26: [28, 30, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 46, 49, 51, 53, 54, 55, 56]; restored prior body.
|
||||
- onPressRight__Q39textinput9inputform4BaseFv: right string buffer aggregate: src 0x308 base 0x2e4 insns 194/185; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- onPressRight__Q39textinput9inputform4BaseFv: right string buffer aggregate byte copy: src 0x328 base 0x2e4 insns 202/185; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- onPressRight__Q39textinput9inputform4BaseFv: right string buffer whole literal byte copy: src 0x2d0 base 0x2e4 insns 180/185; --- replace mine 15:16 base 15:16; restored prior body.
|
||||
- onSpaceKeyHWKB__Q39textinput9inputform4BaseFUl: space Atok integer enable guard: src 0x96c base 0x96c insns 603/603; diffs 0: []; retained exact C++.
|
||||
- onCursor__Q39textinput9inputform4BaseFPQ49textinput10textdrawer4Base9CursorPos: space marker scale final operand: src 0x764 base 0x764 insns 473/473; diffs 5: [271, 273, 276, 281, 283]; restored prior body.
|
||||
- onCursor__Q39textinput9inputform4BaseFPQ49textinput10textdrawer4Base9CursorPos: space marker factor after width locals: src 0x764 base 0x764 insns 473/473; diffs 9: [271, 273, 274, 275, 276, 277, 278, 281, 283]; restored prior body.
|
||||
- onCursor__Q39textinput9inputform4BaseFPQ49textinput10textdrawer4Base9CursorPos: space marker offset computed by compound steps: src 0x764 base 0x764 insns 473/473; diffs 17: [265, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 283]; restored prior body.
|
||||
- onPressLeftHWKB__Q39textinput9inputform4BaseFv: onPressLeftHWKB kana false case before default: src 0x424 base 0x420 insns 265/264; --- replace mine 19:20 base 19:20; restored prior body.
|
||||
- onPressLeftHWKB__Q39textinput9inputform4BaseFv: onPressLeftHWKB kana explicit false and true cases: src 0x430 base 0x420 insns 268/264; --- replace mine 19:20 base 19:20; restored prior body.
|
||||
- onPressLeftHWKB__Q39textinput9inputform4BaseFv: onPressLeftHWKB kana conditional positive block: src 0x41c base 0x420 insns 263/264; --- replace mine 19:20 base 19:20; restored prior body.
|
||||
- onPressRightHWKB__Q39textinput9inputform4BaseFv: onPressRightHWKB kana false case before default: src 0x450 base 0x44c insns 276/275; --- replace mine 19:20 base 19:20; restored prior body.
|
||||
- onPressRightHWKB__Q39textinput9inputform4BaseFv: onPressRightHWKB kana explicit false and true cases: src 0x45c base 0x44c insns 279/275; --- replace mine 19:20 base 19:20; restored prior body.
|
||||
- onPressRightHWKB__Q39textinput9inputform4BaseFv: onPressRightHWKB kana conditional positive block: src 0x448 base 0x44c insns 274/275; --- replace mine 19:20 base 19:20; restored prior body.
|
||||
- onPressUp__Q39textinput9inputform4BaseFv: onPressUp kana false case before default: src 0x3dc base 0x3d8 insns 247/246; --- replace mine 11:12 base 11:12; restored prior body.
|
||||
- onPressUp__Q39textinput9inputform4BaseFv: onPressUp kana explicit false and true cases: src 0x3e8 base 0x3d8 insns 250/246; --- replace mine 11:12 base 11:12; restored prior body.
|
||||
- onPressUp__Q39textinput9inputform4BaseFv: onPressUp kana conditional positive block: src 0x3d4 base 0x3d8 insns 245/246; --- replace mine 11:12 base 11:12; restored prior body.
|
||||
- onPressDown__Q39textinput9inputform4BaseFv: onPressDown kana false case before default: src 0x3dc base 0x3d8 insns 247/246; --- replace mine 11:12 base 11:12; restored prior body.
|
||||
- onPressDown__Q39textinput9inputform4BaseFv: onPressDown kana explicit false and true cases: src 0x3e8 base 0x3d8 insns 250/246; --- replace mine 11:12 base 11:12; restored prior body.
|
||||
- onPressDown__Q39textinput9inputform4BaseFv: onPressDown kana conditional positive block: src 0x3d4 base 0x3d8 insns 245/246; --- replace mine 11:12 base 11:12; restored prior body.
|
||||
- onPressDownHWKB__Q39textinput9inputform4BaseFv: down HWKB candidate decrement narrow type: src 0x428 base 0x438 insns 266/270; --- replace mine 16:17 base 16:17; restored prior body.
|
||||
- onPressDownHWKB__Q39textinput9inputform4BaseFv: down HWKB candidate count local: src 0x428 base 0x438 insns 266/270; --- replace mine 16:17 base 16:17; restored prior body.
|
||||
- onPressDownHWKB__Q39textinput9inputform4BaseFv: down HWKB explicit kana switch: src 0x42c base 0x438 insns 267/270; --- replace mine 97:98 base 97:98; restored prior body.
|
||||
- setLanguage__Q39textinput9inputform12LayoutByNW4RFQ29textinput8Language: language text pane name before root query: src 0x3b4 base 0x3b4 insns 237/237; diffs 22: [57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 118, 119, 120, 121, 122, 123, 124, 125, 126]; restored prior body.
|
||||
- setLanguage__Q39textinput9inputform12LayoutByNW4RFQ29textinput8Language: language repeated title query direct cast: src 0x3b4 base 0x3b4 insns 237/237; diffs 59: [57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 82, 83, 90, 91, 92, 95, 98]; restored prior body.
|
||||
- setLanguage__Q39textinput9inputform12LayoutByNW4RFQ29textinput8Language: language selected name conditional assignment: src 0x3b4 base 0x3b4 insns 237/237; diffs 22: [57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 118, 119, 120, 121, 122, 123, 124, 125, 126]; restored prior body.
|
||||
- create__Q39textinput9inputform12LayoutByNW4RFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: layout placement constructor implicit null check: src 0x584 base 0x590 insns 353/356; --- replace mine 5:6 base 5:6; restored prior body.
|
||||
- create__Q39textinput9inputform12LayoutByNW4RFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: layout row previous index widened: src 0x590 base 0x590 insns 356/356; diffs 205: [5, 7, 8, 10, 14, 15, 16, 20, 22, 23, 25, 26, 28, 29, 30, 31, 32, 33, 34, 35]; restored prior body.
|
||||
- create__Q39textinput9inputform12LayoutByNW4RFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: layout unused detached-state local, discarded: src 0x590 base 0x590 insns 356/356; diffs 205: [5, 7, 8, 10, 14, 15, 16, 20, 22, 23, 25, 26, 28, 29, 30, 31, 32, 33, 34, 35]; restored prior body.
|
||||
- calcCursorPos__Q39textinput9inputform4BaseFff: cursor coordinate scale operands reversed: src 0x518 base 0x518 insns 326/326; diffs 81: [28, 45, 49, 51, 58, 60, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 94]; restored prior body.
|
||||
- calcCursorPos__Q39textinput9inputform4BaseFff: cursor coordinate line bottom recomputed local: src 0x518 base 0x518 insns 326/326; diffs 81: [28, 45, 49, 51, 58, 60, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 94]; restored prior body.
|
||||
- calcCursorPos__Q39textinput9inputform4BaseFff: cursor coordinate draw info brace initialization: src 0x548 base 0x518 insns 338/326; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- isOverRowLimit__Q39textinput9inputform4BaseFUlPCw: row limit width from direct scale query: src 0x3a8 base 0x3b8 insns 234/238; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- isOverRowLimit__Q39textinput9inputform4BaseFUlPCw: row limit current iterator const local: src 0x3b0 base 0x3b8 insns 236/238; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- isOverRowLimit__Q39textinput9inputform4BaseFUlPCw: row limit field width operand reversed: src 0x3b0 base 0x3b8 insns 236/238; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- onCommand__Q39textinput9inputform4BaseFQ39textinput15CommandReceiver13INPUT_COMMANDPv: command fixed comparison positive ternary: src 0x2020 base 0x2014 insns 2056/2053; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- onCommand__Q39textinput9inputform4BaseFQ39textinput15CommandReceiver13INPUT_COMMANDPv: command active mode integer temporary: src 0x2020 base 0x2014 insns 2056/2053; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- onCommand__Q39textinput9inputform4BaseFQ39textinput15CommandReceiver13INPUT_COMMANDPv: command fixed pointer query after current: src 0x2020 base 0x2014 insns 2056/2053; --- replace mine 0:1 base 0:1; restored prior body.
|
||||
- create__Q39textinput9inputform4BaseFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: base row reference corrected declaration: src 0x120 base 0x120 insns 72/72; diffs 26: [28, 30, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 46, 49, 51, 53, 54, 55, 56]; restored prior body.
|
||||
- create__Q39textinput9inputform12LayoutByNW4RFP12MEMAllocatorPQ39textinput9inputform10EditBuffer: layout genuine detached-row guard: src 0x598 base 0x590 insns 358/356; --- replace mine 5:6 base 5:6; restored prior body.
|
||||
- isEnableCursorCache__Q39textinput10textdrawer4BaseCFv: cache bool conditional return: 8/8 bytes, raw equality True; restored prior body. Original concatenated symbol remains unchanged.
|
||||
- isEnableCursorCache__Q39textinput10textdrawer4BaseCFv: cache explicit positive branch: 8/8 bytes, raw equality True; restored prior body. Original concatenated symbol remains unchanged.
|
||||
- isEnableCursorCache__Q39textinput10textdrawer4BaseCFv: cache nonzero integer predicate: 20/8 bytes, raw equality False; restored prior body. Original concatenated symbol remains unchanged.
|
||||
|
||||
### Fourth continuation handoff
|
||||
- Three exact asm bodies converted to readable C++: getCurrentString 112/112, moveCursorUp 88/88, drawCursor 70/70. Remaining asm count is 12 -> 9. onSpaceKeyHWKB now matches 603/603, adding one instruction-exact function and 2412 exact code bytes.
|
||||
- Prediction-mode switch preserves getCurrentString's original extra branch. Separating the upper-row coordinate and cursor index matches moveCursorUp's virtual-call scheduling. Direct u8 thickness conversion matches drawCursor's two integer registers. The integer prediction-enabled local preserves onSpaceKeyHWKB's original Boolean block order.
|
||||
- Every remaining asm body has at least three fresh compiled source-level attempts this round. Every remaining report-nonmatching entry also has at least three fresh attempts. The malformed cursor-cache symbol was checked with three compiled implementations against its original eight bytes. Failed preliminary reference declarations were corrected and rebuilt before counting attempts.
|
||||
- Data: UEJ/KOR visibility tables now use their actual u16 counts and pane-name arrays; all three language tables use their actual visibility/separator/text/title fields. Binary contents, relocations, token order and section sizes remain unchanged. Chinese visibility storage still has its inherited trailing word; this round adds no padding or objects.
|
||||
- Fresh ELF audit: all main vtables through WithAtok retain the original offsets. Genuine Decolated/GUIComponent vtables occupy additional weak storage, whereas the extracted target omits these deduplicated objects. EditBuffer and textinput Base target vtable sizes include four and 28 trailing zero bytes. The singleton weak guard/object precede seven real colors, shifting their .sbss offsets by eight bytes. These differences remain unresolved without artificial data placement. No linking investigation or Matching status changes.
|
||||
- The literal pool is identical, and .rodata/.sdata/.sdata2 remain 100%. .data retains jump-table target differences from unmatched code and weak vtable differences; .sbss is below 100%. Full data completion is still open.
|
||||
- Uncertain: original spelling/types of some drawer fields, the intended source form of weak singleton/color storage, and the trailing Chinese visibility word. No shared headers are changed this round.
|
||||
|
||||
### Fourth continuation remaining report-nonmatching functions
|
||||
Base::onPressLeftHWKB, 99.97727%, two kana comparison/branch-polarity instructions; direct guard loses a tail branch, explicit cases add instructions.
|
||||
Base::onPressRightHWKB, 99.97818%, same two kana comparison/branch-polarity instructions.
|
||||
Base::onCursor, 99.915436%, five centered-space FP register/operand differences; compound offset evaluation worsens scheduling.
|
||||
Base::onPressUp, 99.55285%, missing kana tail branch; false/default switch adds one instruction, explicit cases add four.
|
||||
Base::onPressDown, 99.55285%, same missing kana tail branch.
|
||||
Base::onPressDownHWKB, 98.35185%, candidate index/branch scheduling and final comparison; three variants remain 266/270 or 267/270 instructions.
|
||||
LayoutByNW4R::setLanguage, 96.44726%, 22 root-query scheduling differences; name local and ternary retain those differences, title local worsens allocation.
|
||||
Base::isOverRowLimit, 93.63866%, stack frame and FP/register scheduling; direct scale removes four instructions, operand variants remain 236/238.
|
||||
Base::calcCursorPos, 90.671776%, FP/register scheduling; two variants retain 326/326 with 81 differences, aggregate glyph initialization adds instructions.
|
||||
LayoutByNW4R::create, 88.91854%, row-list allocation/register scheduling; narrow index unchanged, implicit placement constructor removes three instructions, detached guard adds two.
|
||||
Base::onCommand, 88.05163%, frame, case scheduling and register allocation; three variants retain 2056/2053 instructions.
|
||||
textdrawer::Base::isEnableCursorCache, None%, original report concatenates getStartPos; actual accessor remains eight exact bytes. No aliases or symbol edits.
|
||||
|
||||
### Fourth continuation remaining exact asm bodies
|
||||
LayoutByNW4R::draw, 100%, closest C++ 114/114 with twelve vector temporary stack offsets.
|
||||
Base::findURL, 100%, balanced ASCII switch and cached real prefix table produce 111/111; closest twenty register differences. Three later variants change allocation, without improving the closest result.
|
||||
Base::autoScroll, 100%, direct height/scale expression produces 150/150; twenty-five FP and instruction scheduling differences.
|
||||
Base::create(MEMAllocator*, EditBuffer*), 100%, typed detached-row guard and list reload produce 72/72; twenty-six register differences.
|
||||
Base::onPressLeft, 100%, kana guard and prediction Boolean block order remain; fresh case/loop variants 158/154, 155/154, 157/154.
|
||||
Base::onPressRight, 100%, wide space buffer uses halfword stores while target uses word copies; fresh ordinary aggregate/copy variants differ in counts and kana guard.
|
||||
Base::calc, 100%, closest C++ 165/165 with six FP/store scheduling differences after genuine timer/phase locals.
|
||||
Base::RowInfoManager::init, 100%, references and preceding-row index produce 39/39 with fifteen index-load/store scheduling/register differences.
|
||||
Base::isOverLine, 100%, named vectors copy four extra words; expression variants reduce to 48/51, 47/51, 43/51 by changing scale/width scheduling.
|
||||
|
||||
### Fourth continuation final full gate
|
||||
```text
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[src/keyboard/tiInputForm] pool: IDENTICAL
|
||||
[src/keyboard/tiInputForm] objdiff: code 30712/50656 data 908/3772 functions 209/221 fuzzy 97.2529 linked code 0
|
||||
[src/keyboard/tiInputForm] instruction-exact functions: 207/221
|
||||
[src/keyboard/tiInputForm] section .bss size 96 match None
|
||||
[src/keyboard/tiInputForm] section .ctors size 4 match 100.0
|
||||
[src/keyboard/tiInputForm] section .data size 2736 match 65.53332
|
||||
[src/keyboard/tiInputForm] section .rodata size 760 match 100.0
|
||||
[src/keyboard/tiInputForm] section .sbss size 32 match 33.333336
|
||||
[src/keyboard/tiInputForm] section .sdata size 40 match 100.0
|
||||
[src/keyboard/tiInputForm] section .sdata2 size 104 match 100.0
|
||||
[src/keyboard/tiInputForm] section .text size 50656 match 97.25292
|
||||
[src/keyboard/tiInputForm] below 100: onCommand__Q39textinput9inputform4BaseFQ39textinput15CommandReceiver13INPUT_COMMANDPv 88.05163
|
||||
[src/keyboard/tiInputForm] below 100: onCursor__Q39textinput9inputform4BaseFPQ49textinput10textdrawer4Base9CursorPos 99.915436
|
||||
[src/keyboard/tiInputForm] below 100: calcCursorPos__Q39textinput9inputform4BaseFff 90.671776
|
||||
[src/keyboard/tiInputForm] below 100: onPressUp__Q39textinput9inputform4BaseFv 99.55285
|
||||
[src/keyboard/tiInputForm] below 100: onPressDown__Q39textinput9inputform4BaseFv 99.55285
|
||||
[src/keyboard/tiInputForm] below 100: onPressDownHWKB__Q39textinput9inputform4BaseFv 98.35185
|
||||
[src/keyboard/tiInputForm] below 100: onPressLeftHWKB__Q39textinput9inputform4BaseFv 99.97727
|
||||
[src/keyboard/tiInputForm] below 100: onPressRightHWKB__Q39textinput9inputform4BaseFv 99.97818
|
||||
[src/keyboard/tiInputForm] below 100: create__Q39textinput9inputform12LayoutByNW4RFP12MEMAllocatorPQ39textinput9inputform10EditBuffer 88.91854
|
||||
[src/keyboard/tiInputForm] below 100: setLanguage__Q39textinput9inputform12LayoutByNW4RFQ29textinput8Language 96.44726
|
||||
[src/keyboard/tiInputForm] below 100: isOverRowLimit__Q39textinput9inputform4BaseFUlPCw 93.63866
|
||||
[src/keyboard/tiInputForm] below 100: isEnableCursorCache__Q39textinput10textdrawer4BaseCFvgetStartPos__Q39textinput10textdrawer4BaseCFv None
|
||||
[src/keyboard/tiInputForm] baseline: code 28300/50656 data 908 functions 208 fuzzy 97.2205
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 73.53608 -> 73.61661
|
||||
global fuzzy_match_percent: 82.99180 -> 82.99235
|
||||
global complete_code_percent: 56.76068 -> 56.76068
|
||||
global matched_data_percent: 86.39154 -> 86.39154
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
55
tools/decomp-assist/tiManager.attempts.md
Normal file
55
tools/decomp-assist/tiManager.attempts.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# tiManager matching attempts
|
||||
|
||||
Baseline: source absent; 0/62 functions, 0/8368 code bytes. The implementation uses only C++, existing keyboard interfaces, and constructors for the seven concrete Sample layouts. Shared declarations are enabled only by TIMANAGER_IMPLEMENTATION.
|
||||
|
||||
## Pool and data
|
||||
|
||||
1. Initial Sample constructors contained their layout literals. Deferred inline expansion placed these after the vtables and emitted them in constructor order. Pool diverged at string 1. Passing ordinary layout-name literals from the factories restored all eight strings and their offsets.
|
||||
2. Sample declarations initially followed input includes and the factory order. The vtable contents mostly matched but table addresses differed. Declaring the Samples in reverse emission order, with the manager header last, restored the target's table order.
|
||||
3. The out-of-line HWKeyboard destructor emitted a strong HWKeyboard vtable absent from the target. Declaring its C++ destructor inline made that table weak and restored every strong table's offset. The destructor still matches all 16 instructions.
|
||||
4. Enabled the actual inherited CommandReceiver::Scroll and inherited CommandSender::updateFromReceiver declarations for this unit. This corrected the inputform and signwindow vtable relocation names without affecting other units.
|
||||
|
||||
A word-by-word comparison of .data now finds exactly two relocation-name differences, at 0x520 and 0xa44. The original names are `isEnableCursorCache__Q39textinput10textdrawer4BaseCFvgetStartPos__Q39textinput10textdrawer4BaseCFv` and `@236@onEvent__Q49textinput8keyboard6pctype12LayoutByNW4RFPQ49textinput8keyboard6pctype5`. The compiler produces the ordinary complete C++ names. All other .data bytes and relocations agree within the target's 2696-byte extent. The compiler additionally emits 48 bytes of weak vtables for pctype::UIObj::Listener, nw4rmanager::AnmObserver, and gui::EventHandler; these are absent from the extracted target object. No symbol aliases, forced labels, or edits to target symbol names were attempted. Objdiff nevertheless reports .data below 100%; automatic string symbols, the weak tables, and those malformed target names remain unresolved.
|
||||
|
||||
## Functions
|
||||
|
||||
- Constructor, create, initAspect, draw, prediction wrappers, string/length wrappers, factories, filters, isVacancy, and Sample destructors matched from the first implementation or after correcting header types and string placement.
|
||||
- Destructor: initial implementation cleared seven members after freeing them (131 instructions versus 123). Removing those unsupported stores gave 123/123, zero diffs.
|
||||
- init: 209/209 with three diffs. Comparing the aspect flag to true corrected branch direction; calling setSecretInputMode(false), as the target slot 0x4c specifies, corrected the last virtual call. Zero diffs.
|
||||
- calc, setAnimationOn, scale functions, SetFont: pointer-to-secondary-base conversions added null checks. Casting dereferenced objects to Layout references removed those checks. All matched.
|
||||
- createPCTypeKeyboard: 82/82, nine ordering diffs. Initializing KeyState before allocator, qwerty flag, and manager in the Base constructor gave zero diffs.
|
||||
- updateInput(HKBManager&): initial 137/130 instructions. Returning immediately from modal dialog/window branches, selecting the keyboard using the saved qwerty state, and grouping the four boolean results as (keyboard | candidates) | (form | toolbar) produced 130/130, zero diffs.
|
||||
- updateInput(Wii): initial 206/206 with 25 diffs after the preceding changes. Moving updateInputCommon before the sign-window activity check reproduced the target's call order, 206/206, zero diffs.
|
||||
- setAspectRatio: initial 11/12 instructions; converting the bool to u8 before comparing with true restored the target's byte extension, 12/12, zero diffs.
|
||||
- setTitleText: a separate pane temporary followed by DynamicCast gave 49/49 with seven register differences. Nesting the getPane call directly in DynamicCast gave 49/49, zero diffs.
|
||||
|
||||
## Remaining generated initializer
|
||||
|
||||
`__sinit_\tiKeyboard_cpp` is not emitted under that name because the required source file is tiManager.cpp.
|
||||
|
||||
1. A namespace-scope static default observer with its implicit constructor emits `__sinit_\tiManager_cpp`, four instructions: lis, addi, stw, blr, matching the target initializer's instruction sequence.
|
||||
2. An anonymous-namespace default observer changes its object linkage name but still emits the same four instructions under the tiManager initializer name. Reverted for simpler source.
|
||||
3. An explicitly empty EventObserver constructor also emits the same four instructions and unchanged initializer name. Reverted because the implicit constructor suffices.
|
||||
|
||||
The name mismatch remains. No generated-function rename, assembler alias, or filename override was introduced.
|
||||
|
||||
## Changed files
|
||||
|
||||
- src/keyboard/tiManager.cpp
|
||||
- include/keyboard/tiCandidateBox.h
|
||||
- include/keyboard/tiCellPhone.h
|
||||
- include/keyboard/tiHKBManager.h
|
||||
- include/keyboard/tiHwKeyboard.h
|
||||
- include/keyboard/tiInputForm.h
|
||||
- include/keyboard/tiKeyboard.h
|
||||
- include/keyboard/tiManager.h
|
||||
- include/keyboard/tiNw4rManager.h
|
||||
- include/keyboard/tiPcKeyboard.h
|
||||
- include/keyboard/tiPcKeyboardImpl.h
|
||||
- include/keyboard/tiPredictLang.h
|
||||
- include/keyboard/tiString.h
|
||||
- include/keyboard/tiTextDrawer.h
|
||||
- include/keyboard/tiTextInputBase.h
|
||||
- include/keyboard/tiToolBar.h
|
||||
- include/keyboard/tiZiString.h
|
||||
- tools/decomp-assist/tiManager.attempts.md
|
||||
249
tools/decomp-assist/tiPcKeyboard.round2.md
Normal file
249
tools/decomp-assist/tiPcKeyboard.round2.md
Normal file
@@ -0,0 +1,249 @@
|
||||
# PC keyboard second pass
|
||||
|
||||
Baseline: 120/141 instruction-exact functions, 16240 code bytes, 5964 data bytes. Existing string pool and .rodata match. This pass changes code and data only; configure.py remains unchanged.
|
||||
|
||||
## LayoutByNW4R::initLayout
|
||||
Start: (99.71429, (384, 385, 66, 0.9934980494148244)); .data=12552, .bss=12, .sdata2=29, .rodata=5816.
|
||||
1. use a signed switch for the second language query and a common matrix-update join: (99.42857, (385, 385, 6, 0.9896103896103896)); .data=12552, .bss=12, .sdata2=29, .rodata=5816; pool identical; reverted.
|
||||
2. hold language-mode visibility in a boolean and switch on the second query: (97.42857, (392, 385, 80, 0.9781209781209781)); .data=12552, .bss=12, .sdata2=29, .rodata=5816; pool identical; reverted.
|
||||
3. hold each language query result in a named enum before dispatch: (99.42857, (385, 385, 6, 0.9896103896103896)); .data=12552, .bss=12, .sdata2=29, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (75.89773, (280, 352, 336, 0.7563291139240507)); .data=12552, .bss=12, .sdata2=29, .rodata=5816.
|
||||
1. make the two immutable mode-selector positions function-static: (73.62784, (299, 352, 346, 0.7158218125960062)); .data=12552, .bss=36, .sdata2=29, .rodata=5816; pool identical; reverted.
|
||||
2. use function-static mutable mode-selector vectors: (73.62784, (299, 352, 346, 0.7158218125960062)); .data=12552, .bss=36, .sdata2=29, .rodata=5816; pool identical; reverted.
|
||||
3. initialize ordinary function-static VEC3 positions as aggregates: compiler rejected; reverted. at, float)' # 'nw4r::math::VEC3::VEC3(const nw4r::math::VEC3 &)' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (75.89773, (280, 352, 336, 0.7563291139240507)); .data=12552, .bss=12, .sdata2=29, .rodata=5816.
|
||||
1. initialize the two local positions as ordinary float arrays consumed by VEC3: (81.963066, (289, 352, 338, 0.7956318252730109)); .data=12552, .bss=12, .sdata2=9, .rodata=5840; pool identical; retained.
|
||||
2. initialize positions as aggregate _VEC3 and construct the pane translation from its fields: (81.79261, (289, 352, 338, 0.7831513260530422)); .data=12552, .bss=12, .sdata2=9, .rodata=5840; pool identical; reverted.
|
||||
3. construct both local VEC3 positions from ordinary coordinate arrays before language dispatch: (75.03409, (295, 352, 341, 0.7666151468315301)); .data=12552, .bss=12, .sdata2=9, .rodata=5840; pool identical; reverted.
|
||||
|
||||
|
||||
## Vtable declaration order
|
||||
Reordered class declarations to Base, EventHandler, UIObj, modifier, mode panel, layout, animation base, normal, shift, toggle, on/off. Ordinary compiler vtables are emitted in reverse declaration order, matching the target. No code-exact functions lost. {'fuzzy_match_percent': 95.17947, 'total_code': '28484', 'matched_code': '16240', 'matched_code_percent': 57.014465, 'total_data': '18564', 'matched_data': '148', 'matched_data_percent': 0.79724205, 'total_functions': 141, 'matched_functions': 120, 'matched_functions_percent': 85.106384, 'total_units': 1}
|
||||
## LayoutByNW4R::initLayout
|
||||
Start: (99.42857, (385, 385, 6, 0.9896103896103896)); .data=12576, .bss=12, .sdata2=9, .rodata=5816.
|
||||
1. switch on mode flag with explicit default join: (100.0, (385, 385, 0, 1.0)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; retained.
|
||||
2. unsigned mode temporary before test: (99.71429, (384, 385, 66, 0.9934980494148244)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; reverted.
|
||||
3. explicit early join for nonzero mode: (99.71429, (384, 385, 66, 0.9934980494148244)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::createAnmPane_
|
||||
Start: (98.515625, (192, 192, 55, 0.7135416666666666)); .data=12576, .bss=12, .sdata2=9, .rodata=5816.
|
||||
1. declare the new pane before the animation table reference: (98.515625, (192, 192, 55, 0.7135416666666666)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; reverted.
|
||||
2. cache the shared pane before allocating the animation pane: (98.5625, (192, 192, 118, 0.9270833333333334)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; retained.
|
||||
3. use a full-width table index: (95.41146, (191, 192, 180, 0.6161879895561357)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::sendInputWChar
|
||||
Start: (98.24074, (107, 108, 104, 0.9488372093023256)); .data=12576, .bss=12, .sdata2=9, .rodata=5816.
|
||||
1. assign input fields separately after the modifier calculation: (91.07407, (103, 108, 102, 0.8341232227488151)); .data=12576, .bss=12, .sdata2=9, .rodata=5800; pool identical; reverted.
|
||||
2. compute conversion bits from named booleans: (93.05556, (110, 108, 106, 0.908256880733945)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; reverted.
|
||||
3. initialize the input structure before testing keyboard modifiers: (76.31481, (107, 108, 101, 0.8186046511627907)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::setTranslateMode
|
||||
Start: (98.0, (107, 105, 89, 0.9528301886792453)); .data=12576, .bss=12, .sdata2=9, .rodata=5816.
|
||||
1. initialize mode from its enum and preserve the named valid cases: (99.04762, (106, 105, 99, 0.995260663507109)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; retained.
|
||||
2. use the existing mode as the fallback for an unknown translation mode: (95.2381, (106, 105, 97, 0.976303317535545)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; reverted.
|
||||
3. convert valid translation modes directly after an unsigned range guard: (84.03809, (90, 105, 95, 0.6871794871794872)); .data=12576, .bss=12, .sdata2=9, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::getWCCode u32
|
||||
Start: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. compute modifier bits with conditional expressions: (80.024, (121, 125, 113, 0.8780487804878049)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. refer to the selected ASCII key before choosing its modifier: compiler rejected; reverted. ^ # (10224) 'const' or '&' variable needs initializer # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
3. use a named low mode for the Japanese punctuation condition: (97.56, (125, 125, 14, 0.92)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::refresh_
|
||||
Start: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. use the mode setter for the Chinese and Korean normalization: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. switch on the language for mode normalization: (96.899445, (179, 179, 12, 0.9385474860335196)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. give the nested normalized-mode test a named value: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::getWCCode char*
|
||||
Start: (96.14035, (56, 57, 18, 0.9203539823008849)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. use full-width indices in both name lookup loops: (83.68421, (56, 57, 52, 0.4424778761061947)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. write the ASCII lookup as a do-while loop: (94.29825, (57, 57, 21, 0.8771929824561403)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. cache the grid key before comparing its pane name: (86.82456, (54, 57, 37, 0.5045045045045045)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::getControlKey
|
||||
Start: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. write the control lookup with a do-while loop: (90.55556, (37, 36, 20, 0.7397260273972602)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. cache the control table before the loop: (75.833336, (33, 36, 32, 0.5797101449275363)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use a full-width control index: (85.138885, (37, 36, 29, 0.7397260273972602)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::getWCCode
|
||||
Start: (None, (56, 2, 56, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. take a named reference to the key state before forwarding: (None, (56, 2, 56, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. name the character returned by the key state: (None, (56, 2, 56, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. forward through a named key-state pointer: (None, (56, 2, 56, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onPressedShift
|
||||
Start: (90.81633, (45, 49, 42, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. hold the requested shift flags in a named local: (90.71429, (45, 49, 42, 0.8085106382978723)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. update the modifier state explicitly before refreshing: (89.591835, (45, 49, 41, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. isolate the key-state reference before setting shift: (90.81633, (45, 49, 42, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onReleasedShift
|
||||
Start: (89.871796, (38, 39, 36, 0.7532467532467533)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. name the cleared modifier bits before the setter: (90.0, (38, 39, 35, 0.7792207792207793)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. clear shift and mode bits in separate expressions: (89.871796, (38, 39, 36, 0.7532467532467533)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. update the key-state modifier explicitly before refreshing: (88.07692, (38, 39, 36, 0.7012987012987013)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::sendInputWChar
|
||||
Start: (93.97727, (42, 44, 35, 0.9302325581395349)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. keep the shift bit in an unsigned local: (95.22727, (42, 44, 35, 0.9302325581395349)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. extract shift through the state accessor: (81.09091, (47, 44, 39, 0.8571428571428571)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. select the last animation pane with a conditional expression: (91.34091, (43, 44, 35, 0.8275862068965517)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::setInputModeJP
|
||||
Start: (86.92208, (69, 77, 36, 0.8493150684931506)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. dispatch input mode using its unsigned type: (86.92208, (69, 77, 36, 0.8493150684931506)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. cache the key-state reference for both mode setters: (79.97403, (72, 77, 73, 0.5100671140939598)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. express the language-data selection with named mode tests: (83.68831, (69, 77, 36, 0.8356164383561644)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::updateInput int chan
|
||||
Start: (95.25, (135, 140, 92, 0.88)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. name the held-shift condition before dispatch: (95.25, (135, 140, 92, 0.88)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. query shift through a pointer to the gather singleton: (95.25, (135, 140, 92, 0.88)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. test release state in two nested conditions: (95.25, (135, 140, 92, 0.88)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::refreshText
|
||||
Start: (90.46154, (170, 169, 107, 0.8141592920353983)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. initialize captions through separate character assignments: (95.6213, (170, 169, 103, 0.8436578171091446)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. use full-width text table indices: (80.79881, (170, 169, 154, 0.5427728613569321)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. resolve each text pane before its dynamic cast: (89.27811, (170, 169, 123, 0.6194690265486725)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::create
|
||||
Start: (87.49367, (151, 158, 106, 0.7637540453074434)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. keep the event handler in a typed local before assigning its owner: (87.49367, (151, 158, 106, 0.7637540453074434)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. resolve each modifier animation before its pane components: (80.82912, (151, 158, 114, 0.7443365695792881)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use the direct layout member for modifier pane searches: (86.75949, (151, 158, 107, 0.7637540453074434)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onKey
|
||||
Start: (66.72967, (341, 418, 373, 0.6824769433465085)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. hold the control code before dispatching its cases: (66.72967, (341, 418, 373, 0.6824769433465085)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. dispatch the control code as a signed enum-sized value: (66.72967, (341, 418, 373, 0.6824769433465085)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. separate the key-release event and character checks: (66.72967, (341, 418, 373, 0.6824769433465085)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::updateInput HKBManager
|
||||
Start: (84.687225, (237, 227, 219, 0.6724137931034483)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare the repeated key set separately from triggered keys: (81.92951, (233, 227, 220, 0.6565217391304348)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. declare triggered character and key before its animation pointer: (84.4141, (237, 227, 217, 0.646551724137931)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use a switch for repeated hardware control keys: (89.07929, (239, 227, 230, 0.6952789699570815)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
|
||||
## EventHandler::onTiEvent
|
||||
Start: (88.83249, (196, 197, 176, 0.8600508905852418)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. dispatch the event with its unsigned parameter type: (88.83249, (196, 197, 176, 0.8600508905852418)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. write the repetition threshold with inclusive bounds: (88.862946, (196, 197, 176, 0.8702290076335878)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. split the initial modifier exclusions into early returns: (88.83249, (196, 197, 176, 0.8600508905852418)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onEvent
|
||||
Start: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. return early for non-sound listener events: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. dispatch the sound listener event with a switch: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. hold the listener sound value in its enum type: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::refreshText
|
||||
Start: (95.6213, (170, 169, 103, 0.8436578171091446)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. keep the converted ASCII character in a scalar until the text call: (94.30769, (170, 169, 105, 0.855457227138643)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. use a scalar caption and choose grid variants with a conditional index: (95.60947, (171, 169, 106, 0.8823529411764706)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. use a scalar caption and an explicit signed grid variant: (95.01183, (170, 169, 105, 0.8613569321533924)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::getControlKey
|
||||
Start: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare the control entry reference before the loop index: (81.77778, (34, 36, 26, 0.6571428571428571)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. use a signed index with a 16-bit table-index conversion: (91.80556, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. declare the index before a while loop and increment explicitly: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::refreshText
|
||||
Start: (95.60947, (171, 169, 106, 0.8823529411764706)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. load the scalar caption after the caps query and store it after conversion: (99.23077, (170, 169, 97, 0.9321533923303835)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. load the scalar caption after caps and use an explicit negated grid-mode integer: (98.15976, (169, 169, 80, 0.8816568047337278)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. load the scalar caption after caps and cast the computed grid selector to signed int: (97.92899, (169, 169, 78, 0.9053254437869822)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (74.650566, (279, 352, 339, 0.7385103011093502)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare the virtual base initializer inline in the owned implementation header: (92.639206, (342, 352, 261, 0.8645533141210374)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. declare the base initializer inline at its definition: (92.639206, (342, 352, 261, 0.8645533141210374)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. construct both local selector translations before selecting the language: (75.9375, (285, 352, 337, 0.750392464678179)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (92.639206, (342, 352, 261, 0.8645533141210374)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. construct both selector translations after the base initializer is declared inline: (93.09375, (348, 352, 265, 0.8742857142857143)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. copy selector positions into aggregate vectors before language dispatch: compiler rejected; reverted. at, float)' # 'nw4r::math::VEC3::VEC3(const nw4r::math::VEC3 &)' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
3. name both translations before the visibility setters: (89.161934, (348, 352, 282, 0.8742857142857143)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::refreshText
|
||||
Start: (99.23077, (170, 169, 97, 0.9321533923303835)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. use a full-width temporary for the converted caption: (99.28994, (169, 169, 2, 0.9881656804733728)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. use a signed full-width temporary for caption comparisons: (97.86982, (169, 169, 6, 0.9644970414201184)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. normalize the caption temporary once after the case conversion: (98.69823, (170, 169, 100, 0.9616519174041298)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (93.09375, (348, 352, 265, 0.8742857142857143)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. copy ordinary aggregate positions into the base of each VEC3 translation: (93.09375, (348, 352, 265, 0.8742857142857143)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. copy each vector position as an ordinary 12-byte record: (93.610794, (342, 352, 261, 0.8760806916426513)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. copy aggregate positions with both vectors declared together: (93.09375, (348, 352, 265, 0.8742857142857143)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::refreshText
|
||||
Start: (99.28994, (169, 169, 2, 0.9881656804733728)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. convert the scalar character back to wchar_t when indexing Korean maps: (100.0, (169, 169, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. convert the Korean map index to a 16-bit character difference: (96.86391, (169, 169, 6, 0.9644970414201184)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use a named 16-bit character for each Korean lookup: (100.0, (169, 169, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (93.610794, (342, 352, 261, 0.8760806916426513)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. copy coordinate records and construct the pane translation at the point of use: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. copy coordinate records with const local positions: compiler rejected; reverted. ::keyboard::pctype::Base::getTranslateMode() # const' redefined # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
3. copy coordinate records before visibility setters: compiler rejected; reverted. ::keyboard::pctype::Base::getTranslateMode() # const' redefined # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. make both local selector records immutable: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. declare the pane vectors before copying the selector records: (98.14773, (358, 352, 224, 0.8985915492957747)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. declare selector records at function entry and assign them before language dispatch: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onKey
|
||||
Start: (66.72967, (341, 418, 373, 0.6824769433465085)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. restore control case order from target jump-table destinations: (80.52631, (341, 418, 374, 0.8221343873517787)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. declare the caps-press handler inline while retaining target case order: (92.710526, (419, 418, 301, 0.9342891278375149)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. inline the caps-press body at its call site with target case order: (92.710526, (419, 418, 301, 0.9342891278375149)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
|
||||
## LayoutByNW4R::onKey
|
||||
Start: (92.710526, (419, 418, 301, 0.9342891278375149)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. cache the shift gather at entry to the shift-control case: (99.98325, (418, 418, 3, 0.992822966507177)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. cache the shift gather and order active-button animation first: (100.0, (418, 418, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. cache the shift gather and split modifier-state condition: (99.98325, (418, 418, 3, 0.992822966507177)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
|
||||
## Final source selection
|
||||
Reverted the early shared-pane load in createAnmPane_: its sequence-alignment score improved by shifting instructions, but the original candidate has the correct instruction order and only register differences. Reverted the named flags temporary in onPressedShift because it lowered the fuzzy score. All attempts above remain recorded.
|
||||
The second aggregate-position copy in the typed-copy batch repeated the first aggregate trial; it was not a distinct attempt. The next two full-source position transforms were inserted incorrectly by the trial harness and rejected; neither was retained. The following stack batch contains the actual distinct local-lifetime attempts.
|
||||
The inline onPressedCaps declaration trial was rejected because it removed the separately emitted real function. The explicit caps-control case retains that function and matches onKey. The case has its own scope.
|
||||
|
||||
## Final verification
|
||||
Full gate: GATE PASS; regressions 0, forbidden additions 0, readability warnings 0. Instruction-exact functions 120 -> 123/141. Objdiff code 16240 -> 20128/28484; data 5964 -> 5972/18564. New exact functions: initLayout (385 instructions), refreshText (169), onKey (418). Every remaining function has at least three distinct source-level attempts above.
|
||||
|
||||
Pool: 204/204 identical. .rodata, .sdata, .sdata2, .sbss, .ctors: 100%. Ordinary coordinate records now occupy the missing 24 bytes at the end of the string-bearing data. Owned vtables have identical target offsets after declaration reordering. Raw .data is byte-identical, 12576 bytes; all 1303 relocation sites coincide, and 1302 resolve to the same named function or section offset. The sole remaining normalized relocation-name difference is the truncated target onEvent thunk. The .data objdiff score remains 74.95624; why its anonymous-symbol alignment gives so little credit remains uncertain. .bss has 12 source bytes versus 16 target bytes, both zero; likely extraction alignment, not proven. No padding or dummy data was added.
|
||||
|
||||
The invalid TranslateMode fallback uses its supplied enum value; the target default appears to use an unset temporary, whose intended behavior is unknown. configure.py stays NonMatching, as requested.
|
||||
|
||||
Remaining functions:
|
||||
getWCCode__Q49textinput8keyboard6pctype4BaseFPc: None; Compiler inlines the key-state lookup into the forwarding wrapper; 56 versus 2 instructions.
|
||||
getControlKey__Q49textinput8keyboard6pctype4BaseFPc: 93.333336; Only loop-index and table-offset register allocation differs; 36/36 instructions, 8 differences.
|
||||
sendInputWChar__Q49textinput8keyboard6pctype4BaseFwb: 98.24074; Missing zero initialization instruction and cached flag loads; 107/108 instructions.
|
||||
setTranslateMode__Q49textinput8keyboard6pctype4BaseFQ59textinput8keyboard6pctype4Base13TranslateMode: 99.04762; One extra mode-register move, caused by defined fallback initialization; 106/105 instructions.
|
||||
refresh___Q59textinput8keyboard6pctype4Base8KeyStateFv: 98.77095; Compiler eliminates two mode reloads in normalization; 177/179 instructions.
|
||||
getWCCode__Q59textinput8keyboard6pctype4Base8KeyStateFUl: 98.8; Cached modifier load and register allocation; 124/125 instructions.
|
||||
getWCCode__Q59textinput8keyboard6pctype4Base8KeyStateFPc: 96.14035; Grid-mode expression loses one instruction; 56/57 instructions.
|
||||
create__Q49textinput8keyboard6pctype12LayoutByNW4RFP12MEMAllocator: 87.49367; Compiler removes nullable multiple-inheritance pointer adjustments; 151/158 instructions.
|
||||
createAnmPane___Q49textinput8keyboard6pctype12LayoutByNW4RFP12MEMAllocator: 98.515625; Only register allocation differs; 192/192 instructions, 55 differences.
|
||||
init__Q49textinput8keyboard6pctype12LayoutByNW4RFv: 99.94886; Only selector-record and VEC3 temporary stack offsets differ; 352/352 instructions, 18 differences.
|
||||
onPressedShift__Q49textinput8keyboard6pctype12LayoutByNW4RFb: 90.81633; Inlined setter removes repeated flag loads; 45/49 instructions.
|
||||
onReleasedShift__Q49textinput8keyboard6pctype12LayoutByNW4RFv: 90.0; Merged mask expression and eliminated flag reload; 38/39 instructions.
|
||||
sendInputWChar__Q49textinput8keyboard6pctype12LayoutByNW4RFwb: 95.22727; Shift-bit test and FIFO pointer handling; 42/44 instructions.
|
||||
setInputModeJP__Q49textinput8keyboard6pctype12LayoutByNW4RFbUlUl: 86.92208; Mode setters share conditions and remove repeated dispatch; 69/77 instructions.
|
||||
updateInput__Q49textinput8keyboard6pctype12LayoutByNW4RFiffUlUlUlPv: 95.25; Inlined shift setters remove repeated flag loads; 135/140 instructions.
|
||||
updateInput__Q49textinput8keyboard6pctype12LayoutByNW4RFRQ39textinput5input10HKBManager: 89.07929; KeySet aggregate stack allocation and control dispatch; 239/227 instructions.
|
||||
onTiEvent__Q49textinput8keyboard6pctype12EventHandlerFPQ39textinput3gui13PaneComponentUlPQ49textinput11nw4rmanager14TiEventHandler5Input: 88.862946; Event branching, one missing instruction, and register allocation; 196/197 instructions.
|
||||
@236@onEvent__Q49textinput8keyboard6pctype12LayoutByNW4RFPQ49textinput8keyboard6pctype5: None; Original symbol name is truncated; canonical compiler thunk has the same two instructions under its full signature.
|
||||
181
tools/decomp-assist/tiPcKeyboard.round3.md
Normal file
181
tools/decomp-assist/tiPcKeyboard.round3.md
Normal file
@@ -0,0 +1,181 @@
|
||||
# PC keyboard third pass
|
||||
|
||||
Baseline: 123/141 instruction-exact functions, 20128 code bytes, 5972 data bytes. Existing string pool and .rodata match. This pass changes code and data only; configure.py remains unchanged.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. group both coordinate records and pane vectors in a language-position structure: (98.14773, (358, 352, 224, 0.8985915492957747)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. copy selector records into one two-element position array: (97.619316, (359, 352, 239, 0.9310829817158931)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. scope language positions independently from the remaining layout initialization: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::getWCCode char*
|
||||
Start: (96.14035, (56, 57, 18, 0.9203539823008849)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. choose the grid variant with a conditional selector: (100.0, (57, 57, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. name the negative mode index before adding the grid variant base: (98.22807, (56, 57, 16, 0.9380530973451328)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. write the matched grid variant as explicit mode branches: (81.03509, (57, 57, 33, 0.43859649122807015)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::setTranslateMode
|
||||
Start: (99.04762, (106, 105, 99, 0.995260663507109)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. use direct as the initialized fallback mode: (99.04762, (106, 105, 101, 0.995260663507109)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. join the direct and fallback switch labels: (98.0, (103, 105, 96, 0.9519230769230769)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. keep the mode enum itself as the mutable switch result: (99.04762, (106, 105, 99, 0.995260663507109)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::sendInputWChar
|
||||
Start: (98.24074, (107, 108, 104, 0.9488372093023256)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. mask incoming conversion flags when merging them into the stored mode: (99.02778, (107, 108, 104, 0.986046511627907)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. clear rejection after modifier calculation and mask conversion flags: (92.59259, (108, 108, 18, 0.9722222222222222)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. clear rejection before declaring modifier flags and mask conversion flags: (100.0, (108, 108, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
|
||||
## Base::KeyState::getWCCode u32
|
||||
Start: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. scope modifier calculation separately from punctuation-mode evaluation: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. compute the character through a named ASCII record pointer: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. evaluate direct input mode before its punctuation mapping: (95.48, (128, 125, 116, 0.9011857707509882)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::refresh_
|
||||
Start: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. test the normalized mode before checking its language range: (97.994415, (177, 179, 156, 0.9550561797752809)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. select the language table through a single conditional expression: (91.480446, (174, 179, 148, 0.8781869688385269)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. compute normalized flags before assigning the stored mode: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::createAnmPane_
|
||||
Start: (98.515625, (192, 192, 55, 0.7135416666666666)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. use a typed table-row pointer instead of a reference: (98.515625, (192, 192, 55, 0.7135416666666666)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. declare shared-pane storage before the outer loop: (100.0, (192, 192, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. write the outer table traversal as a while loop: (98.515625, (192, 192, 55, 0.7135416666666666)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::getControlKey
|
||||
Start: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. name the comparison result before branching on a control: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. declare the table index outside the loop initialization: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use an explicit unsigned comparison for the name-match result: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::getWCCode
|
||||
Start: (None, (57, 2, 57, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. call the key-state lookup through its explicitly qualified class: (None, (57, 2, 57, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. hold the pane name in a local before forwarding: (None, (57, 2, 57, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use a member-function pointer to forward the lookup: (None, (18, 2, 18, 0.1)); .data=12584, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::setInputModeJP
|
||||
Start: (86.92208, (69, 77, 36, 0.8493150684931506)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. give the two kana input modes separate switch bodies: (79.09091, (77, 77, 21, 0.8571428571428571)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. restore direct, roman, kana switch body order: (100.0, (77, 77, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. restore switch body order with unsigned mode dispatch: (100.0, (77, 77, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::sendInputWChar
|
||||
Start: (95.22727, (42, 44, 35, 0.9302325581395349)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. record consumed shift state after retrieving its last pane: (100.0, (44, 44, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. record shift state before retrieving its last pane: (95.454544, (44, 44, 5, 0.9772727272727273)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use an integer shift-state result assigned in the active branch: (100.0, (44, 44, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## EventHandler::onTiEvent
|
||||
Start: (88.862946, (196, 197, 176, 0.8702290076335878)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. restore event switch body order to press, release, focus: (99.44163, (196, 197, 176, 0.9872773536895675)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. switch on bounding-pane prefix with the target event body order: (98.88325, (197, 197, 5, 0.9847715736040609)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. split the modifier exclusion tests before bounding-pane dispatch: compiler rejected; reverted. ^^^^^^^ # (10140) undefined identifier 'AnmPane' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
|
||||
## LayoutByNW4R::onPressedShift
|
||||
Start: (90.81633, (45, 49, 42, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare the modifier setter inline in the owned header: (90.81633, (45, 49, 42, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. select the pressed animation through the stored button state: (94.89796, (47, 49, 41, 0.8125)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. separate shift-mask construction from the lower mode nibble: (90.71429, (45, 49, 42, 0.8085106382978723)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onReleasedShift
|
||||
Start: (90.0, (38, 39, 35, 0.7792207792207793)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. clear mode then shift in two named modifier steps: (90.89744, (37, 39, 34, 0.7894736842105263)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. keep the cleared modifier in a const local: (90.0, (38, 39, 35, 0.7792207792207793)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. load button state before the modifier update and retain the later live check: (79.97436, (43, 39, 40, 0.6341463414634146)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## EventHandler::onTiEvent
|
||||
Start: (99.44163, (196, 197, 176, 0.9872773536895675)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. switch on the caps-exclusion result before testing the pane prefix: (100.0, (197, 197, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. name the caps-exclusion result before switch dispatch: (100.0, (197, 197, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. join failed exclusion checks through a shared function return: (100.0, (197, 197, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::getControlKey
|
||||
Start: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare a full-width control table index before the loop: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. use a 16-bit cached control index declared before the loop: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. name the control table index inside each iteration: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::create
|
||||
Start: (87.49367, (151, 158, 106, 0.7637540453074434)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare the pane manager before constructing the event handler: (87.49367, (151, 158, 106, 0.7637540453074434)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. retain a typed reference to each modifier while wiring its components: (87.49367, (151, 158, 106, 0.7637540453074434)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. name the listener pointers before attaching each bounding component: (87.49367, (151, 158, 106, 0.7637540453074434)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::updateInput int chan
|
||||
Start: (95.78571, (136, 140, 91, 0.855072463768116)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. cache the hardware keyboard manager before changing shift state: (90.10714, (134, 140, 105, 0.8102189781021898)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. branch on the held-shift mask through an integer switch: (94.28571, (138, 140, 65, 0.841726618705036)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. name the released shift state before invoking its handler: (92.77143, (136, 140, 91, 0.8115942028985508)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::updateInput HKBManager
|
||||
Start: (89.07929, (239, 227, 230, 0.6952789699570815)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. provide a memberwise KeySet copy constructor within the implementation-only guard: (91.18943, (233, 227, 211, 0.8304347826086956)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. dispatch triggered control keys through a signed switch: (91.21586, (242, 227, 234, 0.7249466950959488)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use a full-width converted character and 16-bit Korean map indices: (86.14978, (237, 227, 229, 0.6508620689655172)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onEvent
|
||||
Start: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. dispatch listener events through a signed integer switch: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. return early before converting the sound payload: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. forward a named sound identifier inside the handled-event scope: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::updateInput HKBManager
|
||||
Start: (91.18943, (233, 227, 211, 0.8304347826086956)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. combine copy elision with target triggered-key switch dispatch: (94.00881, (236, 227, 150, 0.8596112311015118)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. keep the Korean character scalar scoped to its conversion block: (93.37004, (232, 227, 208, 0.9019607843137255)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. combine target triggered-key dispatch with the scoped Korean scalar: (96.18943, (235, 227, 48, 0.9437229437229437)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
|
||||
## Base::getControlKey
|
||||
Start: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. join the found key and fallback through one return: (69.97222, (33, 36, 33, 0.37681159420289856)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. write the control traversal as an explicit infinite loop with a bound break: (90.55556, (37, 36, 20, 0.7397260273972602)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. hold the result in a local initialized at the match and exit through a label: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::updateInput HKBManager
|
||||
Start: (96.18943, (235, 227, 48, 0.9437229437229437)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. share the delete animation across repeated delete and backspace cases: (99.73568, (227, 227, 1, 0.9955947136563876)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. share repeated delete handling and explicitly narrow the converted Korean character: (99.73568, (227, 227, 1, 0.9955947136563876)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. share repeated delete handling and keep the outer character full-width until its final conversion: (95.66079, (227, 227, 38, 0.9118942731277533)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::getControlKey
|
||||
Start: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare the compared control pointer before the traversal while retaining the live result lookup: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. bind each compared control through a const reference: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. name the compared pane pointer before traversal and assign it per entry: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onReleasedShift
|
||||
Start: (90.89744, (37, 39, 34, 0.7894736842105263)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. return early when the live shift-button state is already off: (90.89744, (37, 39, 34, 0.7894736842105263)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
|
||||
The earlier wasOn trial was rejected and is not counted toward three valid attempts: a refresh callback could change the live button state. The early-return trial above preserves the live-state check and supplies the third valid alternative.
|
||||
|
||||
## Final source review
|
||||
Reverted the onPressedShift animation-state branch despite its fuzzy gain: the stored state was just assigned true, making its alternate animation branch redundant. The trial remains evidence of the target compiler artifact, not retained source progress. The instruction-exact count remains 129; this also returns controller updateInput to its previous flag-load differences.
|
||||
Reverted the two-step cleared-modifier temporary in onReleasedShift: its small local fuzzy gain made inlined controller updateInput worse, 95.25% -> 94.35714%. Both functions retain their baseline implementations; all new instruction-exact functions remain.
|
||||
|
||||
## Final verification
|
||||
Full non-quick gate: GATE PASS. Instruction-exact functions 123 -> 129/141; objdiff code 20128 -> 22828/28484; matched data 5972 -> 5972/18564. Fuzzy 98.4280 -> 99.3443. Regressions, forbidden additions, readability warnings: 0. Source remains NonMatching; configure.py was not edited.
|
||||
|
||||
New exact functions: Base::sendInputWChar, 108 instructions; KeyState::getWCCode(char*), 57; LayoutByNW4R::createAnmPane_, 192; LayoutByNW4R::sendInputWChar, 44; LayoutByNW4R::setInputModeJP, 77; EventHandler::onTiEvent, 197. Each was measured at 100% and identical instruction sequences.
|
||||
|
||||
Shared change: the KeySet copy constructor is inside TI_PC_KEYBOARD_IMPLEMENTATION, defined by this .cpp alone. It restores return-value copy elision and real memberwise copy semantics. Other translation units have zero output regressions. Files changed: src/keyboard/tiPcKeyboard.cpp, include/keyboard/tiHKBManager.h, tools/decomp-assist/tiPcKeyboard.round3.md.
|
||||
|
||||
Data audit: pool 204/204 identical. Raw .data is byte-identical, 12576 bytes; all 1303 relocation sites coincide. Resolving local symbols to section offsets leaves one relocation-name difference, the truncated onEvent thunk at 0x2fb8. Ordinary tables, coordinate records, and owned vtable order remain correct. .rodata, .sdata, .sdata2, .sbss and .ctors score 100%. The .data score remains 74.95624; anonymous-symbol attribution is still uncertain. .bss remains 12 versus 16 zero bytes; extraction alignment is plausible but unproven. No dummy bytes, padding objects or symbol-name fixes were added.
|
||||
|
||||
Every remaining function has at least three distinct valid source-level attempts recorded in this pass. Source transformations that failed to apply or compile were not retained. Remaining evidence:
|
||||
getWCCode__Q49textinput8keyboard6pctype4BaseFPc: None; The forwarding wrapper still inlines the now-exact key-state lookup: 57/2 instructions.
|
||||
getControlKey__Q49textinput8keyboard6pctype4BaseFPc: 93.333336; Loop-index and table-offset registers are swapped: 36/36 instructions, 8 differences.
|
||||
setTranslateMode__Q49textinput8keyboard6pctype4BaseFQ59textinput8keyboard6pctype4Base13TranslateMode: 99.04762; Defined fallback initialization adds a mode-register move: 106/105 instructions. Invalid-enum intent remains unknown.
|
||||
refresh___Q59textinput8keyboard6pctype4Base8KeyStateFv: 98.77095; Mode normalization eliminates two repeated flag loads: 177/179 instructions.
|
||||
getWCCode__Q59textinput8keyboard6pctype4Base8KeyStateFUl: 98.8; The first modifier load is reused across punctuation evaluation: 124/125 instructions; register differences remain.
|
||||
create__Q49textinput8keyboard6pctype12LayoutByNW4RFP12MEMAllocator: 87.49367; Nullable multiple-inheritance pointer adjustments disappear and temporaries are scheduled differently: 151/158 instructions.
|
||||
init__Q49textinput8keyboard6pctype12LayoutByNW4RFv: 99.94886; Selector records and their pane-vector temporaries occupy different stack slots: 352/352 instructions, 18 differences.
|
||||
onPressedShift__Q49textinput8keyboard6pctype12LayoutByNW4RFb: 90.81633; The modifier setter eliminates repeated flag loads; the target also contains a dead virtual-call branch artifact: 45/49 instructions.
|
||||
onReleasedShift__Q49textinput8keyboard6pctype12LayoutByNW4RFv: 90.0; Modifier masking and cached loads differ: 38/39 instructions.
|
||||
updateInput__Q49textinput8keyboard6pctype12LayoutByNW4RFiffUlUlUlPv: 95.25; Inlined shift setters eliminate repeated flag loads: 135/140 instructions.
|
||||
updateInput__Q49textinput8keyboard6pctype12LayoutByNW4RFRQ39textinput5input10HKBManager: 99.73568; One final character move should narrow to 16 bits: 227/227 instructions, source mr r26,r3 versus target clrlwi r26,r3,16.
|
||||
@236@onEvent__Q49textinput8keyboard6pctype12LayoutByNW4RFPQ49textinput8keyboard6pctype5: None; Target name is truncated; the canonical compiler thunk still has identical two-instruction code under its complete signature.
|
||||
154
tools/decomp-assist/tiPcKeyboard.round4.md
Normal file
154
tools/decomp-assist/tiPcKeyboard.round4.md
Normal file
@@ -0,0 +1,154 @@
|
||||
# PC keyboard fourth pass
|
||||
|
||||
Baseline: 129/141 instruction-exact functions, 22828 code bytes, 5972 data bytes. Existing string pool and .rodata match. This pass changes code and data only; configure.py remains unchanged.
|
||||
|
||||
## LayoutByNW4R::updateInput HKBManager
|
||||
Start: (99.73568, (227, 227, 1, 0.9955947136563876)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. signed scalar for Korean conversion: (98.67841, (227, 227, 5, 0.9779735682819384)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. 16-bit Korean scalar: (97.48898, (228, 227, 145, 0.8967032967032967)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. signed 16-bit conversion result: (99.73568, (227, 227, 1, 0.9955947136563876)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
4. declare Korean result before caps query: (97.9956, (227, 227, 26, 0.9383259911894273)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. name vector inside each language branch: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. bind each constructed vector to const reference: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. reverse copy declarations with original assignment order: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. populate named language vectors componentwise before SetTranslate: (99.96591, (352, 352, 12, 0.9659090909090909)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. declare language vectors in language order: (99.94886, (352, 352, 18, 0.9488636363636364)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::updateInput HKBManager
|
||||
Start: (99.73568, (227, 227, 1, 0.9955947136563876)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. extract Korean conversion as typed inline helper: (99.73568, (227, 227, 1, 0.9955947136563876)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::setTranslateMode
|
||||
Start: (99.04762, (106, 105, 99, 0.995260663507109)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. initialize fallback in default switch arm: (98.0, (107, 105, 89, 0.9528301886792453)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. switch signed translation mode: (99.04762, (106, 105, 99, 0.995260663507109)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. enum-typed translated key mode: (99.04762, (106, 105, 99, 0.995260663507109)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::getWCCode u32 index
|
||||
Start: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. load modifiers with combined shift expression: (81.624, (117, 125, 115, 0.9008264462809917)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. index character table through a named entry: compiler rejected; reverted. ^ # (10224) 'const' or '&' variable needs initializer # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
3. switch direct punctuation characters: (81.44, (129, 125, 110, 0.7795275590551181)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::refresh_
|
||||
Start: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. normalize kana mode with explicit language cases: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. assign normalized mode through inline setter: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. copy normalized mode into named flags value: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::init
|
||||
Start: (99.96591, (352, 352, 12, 0.9659090909090909)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. reverse record declarations after named vectors and preserve load order: (100.0, (352, 352, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
|
||||
## Base::getControlKey
|
||||
Start: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare control record reference through pointer before loop: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. declare table index before a while loop: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. compare named pane record outside condition: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::getWCCode
|
||||
Start: (None, (57, 2, 57, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. bind KeyState through owner pointer: (None, (57, 2, 57, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. name character result before returning: (None, (57, 2, 57, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. bind named KeyState reference: (None, (57, 2, 57, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::getWCCode u32 index
|
||||
Start: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. use named ASCII record with correct table type: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onPressedShift
|
||||
Start: (90.81633, (45, 49, 42, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. name requested shift flags: (90.71429, (45, 49, 42, 0.8085106382978723)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. bind shift button before changing flag state: compiler rejected; reverted. ^^^^^^^^^^^^^^ # (10140) undefined identifier 'ModifierButton' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
3. return when shift sound is disabled: (90.81633, (45, 49, 42, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onReleasedShift
|
||||
Start: (90.0, (38, 39, 35, 0.7792207792207793)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. bind modifier button then clear flag state: compiler rejected; reverted. ^^^^^^^^^^^^^^ # (10140) undefined identifier 'ModifierButton' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
2. early return for already released modifier: (90.0, (38, 39, 35, 0.7792207792207793)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. clear flags using named masks: (90.0, (38, 39, 35, 0.7792207792207793)); .data=12576, .bss=12, .sdata2=16, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::updateInput int chan
|
||||
Start: (95.25, (135, 140, 92, 0.88)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. make hardware shift condition unsigned explicit: (95.25, (135, 140, 92, 0.88)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. use conditional-return release test: (95.25, (135, 140, 92, 0.88)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. bind gather as pointer: (95.25, (135, 140, 92, 0.88)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::create
|
||||
Start: (87.49367, (151, 158, 106, 0.7637540453074434)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare modifier names before pane manager queries: (88.696205, (151, 158, 102, 0.7766990291262136)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. bind shift and caps button references: compiler rejected; reverted. ^^^^^^^^^^^^^^ # (10140) undefined identifier 'ModifierButton' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
3. store handler in typed local before member assignment: (87.49367, (151, 158, 106, 0.7637540453074434)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onEvent
|
||||
Start: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. signed event switch: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. early return for non-sound event: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. name sound identifier: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onPressedShift
|
||||
Start: (90.81633, (45, 49, 42, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. bind correctly typed shift button before state refresh: (90.81633, (45, 49, 42, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onReleasedShift
|
||||
Start: (90.0, (38, 39, 35, 0.7792207792207793)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. bind correctly typed modifier button across state refresh: (90.0, (38, 39, 35, 0.7792207792207793)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::create
|
||||
Start: (88.696205, (151, 158, 102, 0.7766990291262136)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. bind correctly typed shift and caps button references: (90.43671, (151, 158, 122, 0.6213592233009708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
Named onPressedShift flag temporary restored after review: fuzzy score fell 90.81633 to 90.71429, no instruction-count improvement. Compiler-rejected misspelled types do not count toward the three valid experiments.
|
||||
|
||||
## Base::getWCCode
|
||||
Start: (None, (57, 2, 57, 0.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. use existing NO_INLINE convention for real outlined KeyState name lookup: (100.0, (2, 2, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
|
||||
## LayoutByNW4R::create
|
||||
Start: (88.696205, (151, 158, 102, 0.7766990291262136)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. convert layout freshly for each modifier and mode panel: (96.582275, (158, 158, 29, 0.8227848101265823)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. scope each modifier layout binding independently: (94.01899, (158, 158, 34, 0.8037974683544303)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. extract modifier creation into reusable inline member: compiler rejected; reverted. ete struct/union/class # 'textinput::keyboard::pctype::AnmPane' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
|
||||
## LayoutByNW4R::create
|
||||
Start: (96.582275, (158, 158, 29, 0.8227848101265823)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare layout and manager bindings at function entry: (96.55064, (158, 158, 30, 0.8164556962025317)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. declare first modifier names before layout conversion: (99.082275, (158, 158, 27, 0.8291139240506329)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. declare all modifier name bindings before calls: (96.55064, (158, 158, 30, 0.8164556962025317)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::create
|
||||
Start: (99.082275, (158, 158, 27, 0.8291139240506329)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. reuse bounding name for both modifier setup blocks: (99.05064, (158, 158, 28, 0.8227848101265823)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. declare shared bounding name before allocator calls: (99.05064, (158, 158, 28, 0.8227848101265823)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. reuse pane and bounding names together: (97.341774, (158, 158, 32, 0.7911392405063291)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Data review
|
||||
|
||||
The string pool still matches all 204 entries. Raw .data matches all 12576 bytes, including pane-animation tables, jump tables, selector positions, and vtables in target order. Every one of the 1303 relocation sites coincides. After normalizing data symbols to section offsets and code symbols to demangled-equivalent names, 1302 relocation destinations agree. The remaining destination at .data+0x2fb8 is the compiler-generated LayoutByNW4R::onEvent thunk, whose target symbol name ends midway through its UIObj argument. Source thunk includes the complete UIObjUlPv suffix. Both thunks contain the same two instructions. No names or configuration were altered to hide this.
|
||||
|
||||
.rodata 5816 bytes, .sdata2 8 bytes, .sdata, .sbss, and .ctors remain 100% by objdiff. The source .bss has one 12-byte anonymous zero object; target has one 16-byte anonymous zero object. Both sections align to eight bytes. Source .sdata ends at 133 bytes and .sbss at five; target ends at 136 and eight. The trailing zero differences are consistent with extraction alignment, but their origin is unproven. No padding objects were introduced. .data fuzzy score remains 74.95624 despite identical raw bytes and nearly identical canonical relocations; objdiff symbol correspondence is a possible cause, not a proven fix.
|
||||
|
||||
## Final review
|
||||
|
||||
KeyState name lookup uses the existing repository NO_INLINE convention to preserve its real outlined call. Its standalone implementation remains exact. init declares two genuine translation vectors and populates all three components before either vector is read. No uninitialized values are used. Fresh base conversions in create preserve the nullable multiple-inheritance conversions present in the target. configure.py remains NonMatching and unchanged.
|
||||
|
||||
Final measures: {'fuzzy_match_percent': 99.63207, 'total_code': '28484', 'matched_code': '24244', 'matched_code_percent': 85.11445, 'total_data': '18564', 'matched_data': '5972', 'matched_data_percent': 32.169792, 'total_functions': 141, 'matched_functions': 131, 'matched_functions_percent': 92.90781, 'total_units': 1}
|
||||
|
||||
getControlKey__Q49textinput8keyboard6pctype4BaseFPc: 93.333336; (36, 36, 8, 0.8055555555555556)
|
||||
setTranslateMode__Q49textinput8keyboard6pctype4BaseFQ59textinput8keyboard6pctype4Base13TranslateMode: 99.04762; (106, 105, 99, 0.995260663507109)
|
||||
refresh___Q59textinput8keyboard6pctype4Base8KeyStateFv: 98.77095; (177, 179, 152, 0.9606741573033708)
|
||||
getWCCode__Q59textinput8keyboard6pctype4Base8KeyStateFUl: 98.8; (124, 125, 109, 0.9236947791164659)
|
||||
create__Q49textinput8keyboard6pctype12LayoutByNW4RFP12MEMAllocator: 99.082275; (158, 158, 27, 0.8291139240506329)
|
||||
onPressedShift__Q49textinput8keyboard6pctype12LayoutByNW4RFb: 90.81633; (45, 49, 42, 0.7872340425531915)
|
||||
onReleasedShift__Q49textinput8keyboard6pctype12LayoutByNW4RFv: 90.0; (38, 39, 35, 0.7792207792207793)
|
||||
updateInput__Q49textinput8keyboard6pctype12LayoutByNW4RFiffUlUlUlPv: 95.25; (135, 140, 92, 0.88)
|
||||
updateInput__Q49textinput8keyboard6pctype12LayoutByNW4RFRQ39textinput5input10HKBManager: 99.73568; (227, 227, 1, 0.9955947136563876)
|
||||
@236@onEvent__Q49textinput8keyboard6pctype12LayoutByNW4RFPQ49textinput8keyboard6pctype5: None; (0, 0, 100000, 0)
|
||||
|
||||
At least three compiling, distinct source-level experiments were run for each of the twelve functions unmatched at entry. Compiler-rejected experiments are retained as diagnostics and excluded from that count. Two functions are now instruction-exact. The remaining create differences are exclusively register assignments, with 158/158 instructions and matching operations. The remaining KeyState refresh/character lookup and modifier input differences include compiler-eliminated repeated flag loads. setTranslateMode still has one extra move from its defined fallback for invalid enum values; the target fallback behavior is uncertain.
|
||||
154
tools/decomp-assist/tiPcKeyboard.round5.md
Normal file
154
tools/decomp-assist/tiPcKeyboard.round5.md
Normal file
@@ -0,0 +1,154 @@
|
||||
# PC keyboard fifth pass
|
||||
|
||||
Baseline: 131/141 instruction-exact functions, 24244 code bytes, 5972 data bytes. Existing string pool and .rodata match. This pass changes code and data only; configure.py remains unchanged.
|
||||
|
||||
## LayoutByNW4R::updateInput HKBManager
|
||||
Start: (99.73568, (227, 227, 1, 0.9955947136563876)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. choose caps-normalized Korean scalar with conditional expression: (97.53304, (228, 227, 145, 0.9010989010989011)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. normalize letter case as a wchar before table conversion: (97.95154, (227, 227, 21, 0.9383259911894273)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. explicitly assign conversion in all letter mapping branches: (99.18502, (228, 227, 131, 0.9362637362637363)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::create
|
||||
Start: (99.082275, (158, 158, 27, 0.8291139240506329)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. extract repeated modifier setup into inline member with literals: (99.81013, (158, 158, 6, 0.9620253164556962)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool diverged; reverted.
|
||||
2. pass locally named modifier strings to inline member: (99.082275, (158, 158, 27, 0.8291139240506329)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. reuse locally named strings with inline member: (97.37342, (158, 158, 31, 0.7151898734177216)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::create
|
||||
Start: (99.082275, (158, 158, 27, 0.8291139240506329)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. inline setup takes layout, pane name, bounding name: (100.0, (158, 158, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. inline setup takes pane name, bounding name, layout: (94.93671, (158, 158, 13, 0.9746835443037974)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. inline setup takes pane name, layout, bounding name: (97.46835, (158, 158, 10, 0.9873417721518988)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::setTranslateMode
|
||||
Start: (99.04762, (106, 105, 99, 0.995260663507109)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. initialize fallback with a 16-bit enum conversion: (99.04762, (106, 105, 101, 0.995260663507109)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. switch with an unsigned scalar and preserve defined enum fallback: (99.04762, (106, 105, 99, 0.995260663507109)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. convert enum using explicit if chain: (90.209526, (103, 105, 99, 0.9038461538461539)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::getWCCode u32 index
|
||||
Start: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. bind modifier flags to const value before tests: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. declare character before calculating modifier bits: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. explicitly select table entry after input-type evaluation: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::refresh_
|
||||
Start: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. normalize invalid kana mode through named current and desired values: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=12, .rodata=5816; pool identical; reverted.
|
||||
2. select language data using a switch: (98.156425, (178, 179, 152, 0.9467787114845938)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. name input mode before dispatching commands: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::getControlKey
|
||||
Start: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. continue on an unmatched pane name before returning the key: (93.333336, (36, 36, 8, 0.8055555555555556)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. dispatch match Boolean through a switch: (90.388885, (37, 36, 25, 0.7123287671232876)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use signed 16-bit traversal index: (47.36111, (38, 36, 30, 0.7027027027027027)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onPressedShift
|
||||
Start: (90.81633, (45, 49, 42, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. share shift button state and animation in an inline member: (90.81633, (45, 49, 42, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. select shift animation event with conditional expression: (90.81633, (45, 49, 42, 0.7872340425531915)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. select shift animation using the stored button state: (94.89796, (47, 49, 41, 0.8125)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
|
||||
## LayoutByNW4R::onPressedShift
|
||||
Start: (94.89796, (47, 49, 41, 0.8125)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. obtain shift flags through const modifier getter: (99.081635, (49, 49, 9, 0.8163265306122449)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. obtain all flags through const getter then mask: (99.081635, (49, 49, 9, 0.8163265306122449)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. obtain shift flags through mutable modifier getter: (94.89796, (47, 49, 41, 0.8125)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onReleasedShift
|
||||
Start: (77.17949, (41, 39, 37, 0.7)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. name the shift button pointer before refreshing key flags: (77.17949, (41, 39, 37, 0.7)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. separate mode clearing from shift-bit clearing: (78.07692, (40, 39, 35, 0.7088607594936709)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. guard the released state with an early return: (77.17949, (41, 39, 37, 0.7)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::updateInput int chan
|
||||
Start: (93.89286, (141, 140, 43, 0.8754448398576512)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. declare retained handling result before invoking the layout: (93.89286, (141, 140, 43, 0.8754448398576512)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. name the held hardware shift bit before testing it: (93.89286, (141, 140, 43, 0.8754448398576512)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. use an early return after processing the held shift branch: (91.57143, (142, 140, 62, 0.8581560283687943)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onEvent
|
||||
Start: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. handle sound event using an unsigned switch: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. convert sound payload through a named integer: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. bind the event observer before calling its sound handler: (None, (0, 0, 100000, 0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onReleasedShift
|
||||
Start: (78.07692, (40, 39, 35, 0.7088607594936709)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. clear shift bit from flags returned by const getter: (79.23077, (42, 39, 31, 0.6419753086419753)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. name const getter result before clearing shift: (86.02564, (42, 39, 24, 0.7160493827160493)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. use const getter with direct released animation body: (92.051285, (39, 39, 15, 0.717948717948718)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
|
||||
## Base::KeyState::refresh_
|
||||
Start: (98.77095, (177, 179, 152, 0.9606741573033708)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. query ABC mode through const getter at every decision: compiler rejected; reverted. ^^^^^^^^^^ # (10114) '(' expected # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed.
|
||||
2. query ABC mode through const getter in normalization guard: (100.0, (179, 179, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
3. query ABC mode through const getter in normalized-state check: (99.88827, (179, 179, 4, 0.9776536312849162)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onPressedShift
|
||||
Start: (99.081635, (49, 49, 9, 0.8163265306122449)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. name complete pressed modifier flags before setter call: (99.081635, (49, 49, 8, 0.8367346938775511)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. update named getter result with shift bit separately: (99.081635, (49, 49, 8, 0.8367346938775511)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. bind complete pressed modifier flags to const local: (99.081635, (49, 49, 8, 0.8367346938775511)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Base::KeyState::getWCCode u32 index
|
||||
Start: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. query direct and Chinese ABC modes through const getter: (100.0, (125, 125, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. query only direct-input ABC mode through const getter: (100.0, (125, 125, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. query only Chinese ABC mode through const getter: (98.8, (124, 125, 109, 0.9236947791164659)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onPressedShift
|
||||
Start: (99.081635, (49, 49, 8, 0.8367346938775511)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. reuse modifier state helper for dynamic caps and shift with unsigned off animation: (99.081635, (49, 49, 8, 0.8367346938775511)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. reuse modifier state helper with signed off animation: (99.081635, (49, 49, 8, 0.8367346938775511)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. reuse modifier state helper with explicit on and off animations: (99.081635, (49, 49, 8, 0.8367346938775511)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
Source review retained the general SetState helper with an unsigned off-animation argument after rechecking all function percentages: no change to any function score, pool identical, onPressedCaps remains exact. The helper now also handles the real dynamic caps state, including both enabled and disabled values. The earlier trial runner reverted this equivalent improvement only because its instruction metric was unchanged.
|
||||
|
||||
## LayoutByNW4R::onPressedShift
|
||||
Start: (99.081635, (49, 49, 8, 0.8367346938775511)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. bind key state before querying pressed flags: (99.081635, (49, 49, 8, 0.8367346938775511)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. declare flags before querying and combining modifiers: (99.081635, (49, 49, 8, 0.8367346938775511)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. bind modifier animation button before updating flags: (99.081635, (49, 49, 8, 0.8367346938775511)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onReleasedShift
|
||||
Start: (92.051285, (39, 39, 15, 0.717948717948718)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. clear the shift bit in a separate statement after const getter: (98.84615, (39, 39, 8, 0.7948717948717948)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. clear shift using an explicitly unsigned mask: (92.051285, (39, 39, 15, 0.717948717948718)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. pass separately named getter flags directly to setter: (91.666664, (40, 39, 34, 0.6835443037974683)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::onPressedShift
|
||||
Start: (99.081635, (49, 49, 8, 0.8367346938775511)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. name full getter flags then mask before returning: (99.081635, (49, 49, 8, 0.8367346938775511)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
2. name masked getter flags before returning: (99.081635, (49, 49, 8, 0.8367346938775511)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. declare getter flags before assigning masked value: (99.081635, (49, 49, 8, 0.8367346938775511)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## LayoutByNW4R::updateInput int chan
|
||||
Start: (99.92857, (140, 140, 2, 0.9857142857142858)); .data=12576, .bss=12, .sdata2=8, .rodata=5816.
|
||||
1. keep getter flags and pressed bit assignment separate in inline handler: (100.0, (140, 140, 0, 1.0)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; retained.
|
||||
2. make inline pressed flags local const: (99.92857, (140, 140, 2, 0.9857142857142858)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
3. pass inline pressed getter flags directly to setter: (99.92857, (140, 140, 2, 0.9857142857142858)); .data=12576, .bss=12, .sdata2=8, .rodata=5816; pool identical; reverted.
|
||||
|
||||
## Final code and data review
|
||||
|
||||
New instruction-exact functions: LayoutByNW4R::create, 158 instructions; KeyState::refresh_, 179; KeyState::getWCCode(u32), 125; LayoutByNW4R::updateInput(int,...), 140. Each has 100% objdiff and ctxdiff reports zero differences. The const mode getter restores the independently inlined flag reads. Shared modifier creation preserves the target base conversions and original string pool. SetState is a general helper actually used by both the pressed shift and dynamic caps paths; the latter exercises both state values with its real off-animation value. onPressedCaps remains exact at 92 instructions. All exact functions at entry remain exact.
|
||||
|
||||
Every one of the ten functions unmatched at entry has at least three distinct compiling source-level attempts recorded this pass. Compiler failures and transformations that failed to apply are not counted. A final proposed inline-handler lifetime trial did not apply after the handler had already changed, was rejected before writing either source file, and is excluded.
|
||||
|
||||
Raw section audit checked ELF bytes directly. .data: 12576/12576 bytes, no differences. .rodata: 5816/5816 bytes, no differences. .sdata2: 8/8 bytes, no differences. .sdata: 133/136 bytes, equal common bytes and an all-zero three-byte target suffix. .bss: 12/16 bytes and .sbss: 5/8 bytes, with equal zero contents. Both versions align these sections to eight bytes. The string pool has 204 identical entries. Ordinary tables, positions, and vtable offsets remain in target order. Canonical .data relocation audit found equal sites for all 1303 relocations and equal destinations for 1302. The only destination-name difference remains .data+0x2fb8, the truncated onEvent thunk. No literal blobs, pinned addresses, extra data, or configuration changes were introduced.
|
||||
|
||||
.data objdiff remains 74.95624 despite raw byte equality; symbol correspondence is a possible cause, not a proven explanation. The anonymous twelve-byte .bss object is passed to __register_global_object from inlined LayoutGather::Singleton::getInstance. Runtime DestructorChain has three pointer fields, explaining its source size. The four-byte target suffix is consistent with section alignment, without establishing how extraction assigned those bytes.
|
||||
|
||||
The modified implementation header is included only through TI_PC_KEYBOARD_IMPLEMENTATION, defined by this .cpp alone. configure.py remains NonMatching and unchanged. Final object measures: {'fuzzy_match_percent': 99.90311, 'total_code': '28484', 'matched_code': '26652', 'matched_code_percent': 93.56832, 'total_data': '18564', 'matched_data': '5972', 'matched_data_percent': 32.169792, 'total_functions': 141, 'matched_functions': 135, 'matched_functions_percent': 95.74468, 'total_units': 1}
|
||||
|
||||
getControlKey__Q49textinput8keyboard6pctype4BaseFPc: 93.333336; (36, 36, 8, 0.8055555555555556)
|
||||
setTranslateMode__Q49textinput8keyboard6pctype4BaseFQ59textinput8keyboard6pctype4Base13TranslateMode: 99.04762; (106, 105, 99, 0.995260663507109)
|
||||
onPressedShift__Q49textinput8keyboard6pctype12LayoutByNW4RFb: 99.081635; (49, 49, 8, 0.8367346938775511)
|
||||
onReleasedShift__Q49textinput8keyboard6pctype12LayoutByNW4RFv: 98.84615; (39, 39, 8, 0.7948717948717948)
|
||||
updateInput__Q49textinput8keyboard6pctype12LayoutByNW4RFRQ39textinput5input10HKBManager: 99.73568; (227, 227, 1, 0.9955947136563876)
|
||||
@236@onEvent__Q49textinput8keyboard6pctype12LayoutByNW4RFPQ49textinput8keyboard6pctype5: None; (0, 0, 100000, 0)
|
||||
|
||||
Full final gate: GATE PASS. Zero other-unit output regressions, zero forbidden-pattern additions, zero readability warnings.
|
||||
[src/keyboard/tiPcKeyboard] objdiff: code 26652/28484 data 5972/18564 functions 135/141 fuzzy 99.9031 linked code 0
|
||||
[src/keyboard/tiPcKeyboard] instruction-exact functions: 135/141
|
||||
45
tools/decomp-assist/tiSignWindow.attempts.md
Normal file
45
tools/decomp-assist/tiSignWindow.attempts.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# tiSignWindow matching attempts
|
||||
|
||||
Baseline: absent source, 0/56 functions and 0/7184 code bytes. The source reconstructs the actual animation, pane, language, and key-name tables using ordinary literals and typed objects. Previous scratch C++ and the original-object Ghidra export were references. Their explicit padding, mangled free-function calls, manual vtable dispatch, and raw pointer offsets were removed before the first build.
|
||||
|
||||
## Data
|
||||
|
||||
The first build already had all 30 strings in the original pool order. The nine animation records occupy 612 bytes; the compiler supplies the following alignment naturally, without a padding record. InputCharacter is a real 12-byte command payload with ordinary aggregate initialization.
|
||||
|
||||
The first .data score was 83.582375%. Declaring the three concrete animation-pane classes in reverse vtable emission order restored their table order. Inheriting CommandSender::setCommandReceiver and sendCommand for this unit corrected the two Base/Layout vtables. All data sections subsequently reached 100% in objdiff: .data, .rodata, .sdata, and .ctors. A trial making the key-name table static caused the compiler to remove it and broke the pool; the table retains ordinary external linkage so the real target table is present.
|
||||
|
||||
## Matched functions
|
||||
|
||||
Most functions matched on the first readable implementation, including destruction, initialization, modal-window operations, character/page rendering, input handling, and animation callbacks.
|
||||
|
||||
- The input payload's repeat flag initially read an unsigned-byte member into bool and emitted three normalization instructions. Declaring the actual boolean repeat/locked/input/active fields restored the target loads and stores.
|
||||
- CellPhoneSignAllAnmPane::onAnmEvent had 39/39 instructions with two unsigned comparisons. Making the stored animation state signed restored both comparisons and gave zero diffs.
|
||||
- Base::onKey initially had 115/115 instructions with 13 differences. Moving counters into their respective scopes produced 19 differences; reversing the two counter declarations also produced 19; using an unsigned control-key result increased the count to 116. These variants were reverted.
|
||||
- A real inline control-key lookup reduced Base::onKey to ten differences and LayoutByNW4R::onKey to eight. A character lookup accepting LanguageDependency reduced the layout function to five differences. Swapping the helper's parameter order left five differences. Passing the actual key array to the character helper restored the target register allocation for both functions.
|
||||
- Base::onKey then showed two false ctxdiff differences on CR1 branches. Inspection found identical instruction bytes for both branches; the helper normalizes the CR operand as if it were a branch address when function offsets differ. Declaring the already-existing KeyboardBase::getLanguage externally in this unit avoided a duplicate weak inline body, restored the original function offset, and ctxdiff reported zero differences without any instruction changes to onKey.
|
||||
|
||||
## Remaining function: LayoutByNW4R::create
|
||||
|
||||
All variants use typed placement construction, real class sizes, and the same 221 instructions as the target. The remaining differences are callee-saved register allocation, including hoisted vtable addresses, animation count, and animation-record temporaries.
|
||||
|
||||
1. Initial scoped const forceName/animationCount variables: 61 differences.
|
||||
2. Declared forceName and animationCount outside the pane loop and assigned them after appending the pane: 34 differences.
|
||||
3. Declared the pane pointer before the pane-table reference: still 34 differences.
|
||||
4. Reversed the forceName/count declarations: 37 differences, reverted.
|
||||
5. Changed the outer for loop to a do/while loop with an explicit paneIndex: still 34 differences, retained.
|
||||
6. Kept forceName outside but made animationCount local and const: 59 differences, reverted.
|
||||
|
||||
The retained version has 221/221 instructions and 34 register differences. No artificial code or data placement was used.
|
||||
|
||||
## Changed files
|
||||
|
||||
- src/keyboard/tiSignWindow.cpp
|
||||
- include/keyboard/tiSignWindow.h
|
||||
- include/keyboard/tiHKBManager.h
|
||||
- include/keyboard/tiInputForm.h
|
||||
- include/keyboard/tiKeyboard.h
|
||||
- include/keyboard/tiNw4rManager.h
|
||||
- include/keyboard/tiPcKeyboard.h
|
||||
- include/keyboard/tiPcKeyboardImpl.h
|
||||
- include/keyboard/tiTextInputBase.h
|
||||
- tools/decomp-assist/tiSignWindow.attempts.md
|
||||
58
tools/update_readme_progress.py
Normal file
58
tools/update_readme_progress.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Rewrite the progress block in README.md from an objdiff report.
|
||||
|
||||
usage: update_readme_progress.py <report.json> <README.md> [commit]
|
||||
"""
|
||||
import datetime
|
||||
import json
|
||||
import sys
|
||||
|
||||
START = "<!-- progress:start -->"
|
||||
END = "<!-- progress:end -->"
|
||||
|
||||
|
||||
def pct(measures, key):
|
||||
return float(measures.get(key) or 0.0)
|
||||
|
||||
|
||||
def main():
|
||||
report_path, readme_path = sys.argv[1], sys.argv[2]
|
||||
commit = sys.argv[3][:8] if len(sys.argv) > 3 else ""
|
||||
m = json.load(open(report_path))["measures"]
|
||||
|
||||
stamp = datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d %H:%M UTC")
|
||||
block = "\n".join([
|
||||
START,
|
||||
"| Decompiled | Matched | Linked | Data |",
|
||||
"|:---:|:---:|:---:|:---:|",
|
||||
f"| {pct(m, 'fuzzy_match_percent'):.2f}% | {pct(m, 'matched_code_percent'):.2f}% "
|
||||
f"| {pct(m, 'complete_code_percent'):.2f}% | {pct(m, 'matched_data_percent'):.2f}% |",
|
||||
"",
|
||||
f"units {m.get('complete_units')}/{m.get('total_units')} complete, "
|
||||
f"functions {m.get('matched_functions')}/{m.get('total_functions')} matched.",
|
||||
"",
|
||||
"decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, "
|
||||
"linked = code actually linked into the DOL, data = byte-exact data",
|
||||
END,
|
||||
])
|
||||
|
||||
text = open(readme_path, encoding="utf-8").read()
|
||||
if START in text and END in text:
|
||||
head, rest = text.split(START, 1)
|
||||
_, tail = rest.split(END, 1)
|
||||
new = head + block + tail
|
||||
else:
|
||||
anchor = "Progress\n========\n"
|
||||
if anchor not in text:
|
||||
raise SystemExit("no progress anchor in README")
|
||||
new = text.replace(anchor, anchor + block + "\n\n", 1)
|
||||
|
||||
if new != text:
|
||||
open(readme_path, "w", encoding="utf-8").write(new)
|
||||
print("README progress updated")
|
||||
else:
|
||||
print("README progress unchanged")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user