Compare commits

...

6 Commits

Author SHA1 Message Date
coah
9b8d11475d cleanup(Controller): name Base/Classic status and pinch fields
- unk_0x08 → mDecideHoldCount (decide() when == 5)
- unk_0x1C → mbForceInvalid (setForceInvalid)
- unk_0x1D/1E → mbPinch/mbPrevPinch (A+B pinch state)
- unk_0x20 → mpStatus
- Classic unk_0x24/2C → mClassicCursor/mClassicCursorTimer

Also update ControllerManager ctor that touches Base fields.

Verified: Controller/ControllerManager 100%/100%, build/43U/ok,
DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d
2026-10-02 14:18:39 -05:00
coah
413c779180 cleanup(eZiText): rename work unk_0x0A to maxWordLength (#886)
Copied to/from options->maxWordLength; assigned from length.
2026-10-02 14:18:33 -05:00
coah
f9ecefa6a2 cleanup(NWC24Work): rename MBox header/entry work buffers (#883)
sendMbcHeader/recvMbcHeader/mbcEntry for cached MBC structures.
2026-10-02 14:17:06 -05:00
coah
320700d49b cleanup(eZiText): rename work unk_0x141E to graphTableId (#882)
Passed to Zi8GetTableAddress / Zi8GetTableSize (often 0x10).
2026-10-02 14:16:39 -05:00
coah
c52153e9f7 cleanup(eZiText): rename work unk_0x141A to capacity (#880)
Copied into options.capacity in zi8getc2; init to 0x100.
2026-10-02 14:15:52 -05:00
coah
899438ff02 cleanup(NWC24MsgObj): rename unk_0xD0 to extraData (#879)
Written by WriteExtraFields during commit.
2026-10-02 14:15:25 -05:00
12 changed files with 139 additions and 139 deletions

View File

@@ -118,26 +118,26 @@ namespace ipl {
public: public:
Base(int chan, KPADStatus& status) { Base(int chan, KPADStatus& status) {
mButton = 0; mButton = 0;
unk_0x08 = 0; mDecideHoldCount = 0;
mLastRumbleTime = 0; mLastRumbleTime = 0;
mRumbleType = -1; mRumbleType = -1;
mChan = chan; mChan = chan;
mType = 2; mType = 2;
unk_0x1C = 0; mbForceInvalid = 0;
KPADEnableDPD(chan); KPADEnableDPD(chan);
unk_0x1D = 0; mbPinch = 0;
unk_0x1E = 0; mbPrevPinch = 0;
unk_0x20 = &status; mpStatus = &status;
} }
Base(int chan, int type, KPADStatus& status) { Base(int chan, int type, KPADStatus& status) {
mButton = 0; mButton = 0;
unk_0x08 = 0; mDecideHoldCount = 0;
mLastRumbleTime = 0; mLastRumbleTime = 0;
mRumbleType = -1; mRumbleType = -1;
mChan = chan; mChan = chan;
mType = type; mType = type;
unk_0x1C = 0; mbForceInvalid = 0;
KPADEnableDPD(chan); KPADEnableDPD(chan);
} }
@@ -152,15 +152,15 @@ namespace ipl {
protected: protected:
u8 mButton; u8 mButton;
u32 unk_0x08; u32 mDecideHoldCount;
OSTick mLastRumbleTime; OSTick mLastRumbleTime;
s32 mRumbleType; s32 mRumbleType;
u32 mChan; u32 mChan;
u32 mType; u32 mType;
u8 unk_0x1C; u8 mbForceInvalid;
u8 unk_0x1D; u8 mbPinch;
u8 unk_0x1E; u8 mbPrevPinch;
KPADStatus* unk_0x20; KPADStatus* mpStatus;
}; };
class Revolution : public Base { class Revolution : public Base {
@@ -206,8 +206,8 @@ namespace ipl {
virtual BOOL isValidDpdClassic() const; virtual BOOL isValidDpdClassic() const;
private: private:
math::VEC2 unk_0x24; math::VEC2 mClassicCursor;
int unk_0x2C; int mClassicCursorTimer;
}; };
class Master : public Interface { class Master : public Interface {
@@ -264,18 +264,18 @@ namespace ipl {
public: public:
Base(int chan, KPADStatus& arg1) { Base(int chan, KPADStatus& arg1) {
mButton = 0; mButton = 0;
unk_0x08 = 0; mDecideHoldCount = 0;
mLastRumbleTime = 0; mLastRumbleTime = 0;
mRumbleType = -1; mRumbleType = -1;
mChan = chan; mChan = chan;
mType = 2; mType = 2;
unk_0x1C = 0; mbForceInvalid = 0;
KPADEnableDPD(chan); KPADEnableDPD(chan);
unk_0x1D = 0; mbPinch = 0;
unk_0x1E = 0; mbPrevPinch = 0;
unk_0x20 = &arg1; mpStatus = &arg1;
} }
virtual ~Base(); // 0x08 virtual ~Base(); // 0x08
@@ -326,15 +326,15 @@ namespace ipl {
// protected: // protected:
u8 mButton; // 0x4 u8 mButton; // 0x4
u32 unk_0x08; // 0x8 u32 mDecideHoldCount; // 0x8
OSTick mLastRumbleTime; // 0xC OSTick mLastRumbleTime; // 0xC
s32 mRumbleType; // 0x10 s32 mRumbleType; // 0x10
u32 mChan; // 0x14 u32 mChan; // 0x14
u32 mType; // 0x18 u32 mType; // 0x18
u8 unk_0x1C; u8 mbForceInvalid;
u8 unk_0x1D; // 0x1D u8 mbPinch; // 0x1D
u8 unk_0x1E; // 0x1E u8 mbPrevPinch; // 0x1E
KPADStatus* unk_0x20; // 0x20 KPADStatus* mpStatus; // 0x20
}; };
class Interface : public Base { class Interface : public Base {
@@ -446,8 +446,8 @@ namespace ipl {
virtual BOOL isValidDpdClassic() const; // 0x8C virtual BOOL isValidDpdClassic() const; // 0x8C
private: private:
math::VEC2 unk_0x24; math::VEC2 mClassicCursor;
int unk_0x2C; int mClassicCursorTimer;
}; };
class Manager { class Manager {

View File

@@ -210,7 +210,7 @@ struct __zi8_work_data_s {
ziLanguageEntry* langEntries; // 0x04 ziLanguageEntry* langEntries; // 0x04
ziU8 unk_0x08; ziU8 unk_0x08;
ziU8 unk_0x09; ziU8 unk_0x09;
ziU8 unk_0x0A; ziU8 maxWordLength;
ziU8 unk_0x0B; ziU8 unk_0x0B;
ziU32 unk_0x0C; ziU32 unk_0x0C;
ziU32 unk_0x10; ziU32 unk_0x10;
@@ -269,10 +269,10 @@ struct __zi8_work_data_s {
ziU8 unk_0x1414[4]; ziU8 unk_0x1414[4];
ziU8 formatCount; ziU8 formatCount;
ziU8 unk_0x1419; ziU8 unk_0x1419;
ziU16 unk_0x141A; ziU16 capacity; // 0x141A
ziU8 unk_0x141C; ziU8 unk_0x141C;
ziU8 unk_0x141D; ziU8 unk_0x141D;
ziU8 unk_0x141E; ziU8 graphTableId; // 0x141E
ziU8 maxCnt; // 0x141F ziU8 maxCnt; // 0x141F
ziU8 unk_0x1420[4]; ziU8 unk_0x1420[4];
zi8DawgCtx dawgCtx; // 0x1424 zi8DawgCtx dawgCtx; // 0x1424

View File

@@ -39,10 +39,10 @@ ziU32 Zi8MatchROMdata0(ziWChar* elements, ziU8 count, ziU8 language,
} }
if (mode == 1) acceptPrefix = 0; if (mode == 1) acceptPrefix = 0;
} else { } else {
if (ZI_WORK->unk_0x141E != 0 && graphTable == 0xc && if (ZI_WORK->graphTableId != 0 && graphTable == 0xc &&
Zi8GetTableSize(language, ZI_WORK->unk_0x141E, ZI_WORK) != 0) { Zi8GetTableSize(language, ZI_WORK->graphTableId, ZI_WORK) != 0) {
graphData = (ziU8*)Zi8GetTableAddress(language, ZI_WORK->unk_0x141E, ZI_WORK); graphData = (ziU8*)Zi8GetTableAddress(language, ZI_WORK->graphTableId, ZI_WORK);
keyTable = ZI_WORK->unk_0x141E + 1; keyTable = ZI_WORK->graphTableId + 1;
} else { } else {
if (Zi8GetTableSize(language, graphTable, ZI_WORK) == 0) { if (Zi8GetTableSize(language, graphTable, ZI_WORK) == 0) {
Zi8LogError(0x961, ZI_WORK); Zi8LogError(0x961, ZI_WORK);
@@ -232,9 +232,9 @@ unsigned int Zi8MatchROMdata2(ziWChar* elements, ziU8 count, ziU8 language,
ZI_WORK->unk_0x1768 = 0; ZI_WORK->unk_0x1768 = 0;
ZI_WORK->matchOffset = 0; ZI_WORK->matchOffset = 0;
if (group != 0 && *group == 0xc && language == 10 && ZI_WORK->unk_0x141C != 0) { if (group != 0 && *group == 0xc && language == 10 && ZI_WORK->unk_0x141C != 0) {
ZI_WORK->unk_0x141E = 0x10; ZI_WORK->graphTableId = 0x10;
} else { } else {
ZI_WORK->unk_0x141E = 0; ZI_WORK->graphTableId = 0;
} }
} }
search_segment: search_segment:
@@ -273,14 +273,14 @@ search_segment:
if (ZI_WORK->matchOffset == count) return 0; if (ZI_WORK->matchOffset == count) return 0;
ZI_WORK->unk_0x1768++; ZI_WORK->unk_0x1768++;
status = 0; status = 0;
ZI_WORK->unk_0x141E = 0; ZI_WORK->graphTableId = 0;
if (ZI_WORK->dawgCtx.key == 0 && language == 10) { if (ZI_WORK->dawgCtx.key == 0 && language == 10) {
for (index = 0; index < ZI_WORK->matchOffset; index++) { for (index = 0; index < ZI_WORK->matchOffset; index++) {
switch (ZI_WORK->unk_0x17F4[index]) { switch (ZI_WORK->unk_0x17F4[index]) {
case 0x61: case 0x61:
case 0x6f: case 0x6f:
case 0x75: case 0x75:
ZI_WORK->unk_0x141E = 0x10; ZI_WORK->graphTableId = 0x10;
goto search_segment; goto search_segment;
} }
} }

View File

@@ -158,7 +158,7 @@ static ziBool Zi8AlphaSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED
length = length - parameters->firstCandidate; length = length - parameters->firstCandidate;
if (countOnly != 0) { if (countOnly != 0) {
parameters->letters = length; parameters->letters = length;
ZI_WORK->unk_0x0A = 0xff; ZI_WORK->maxWordLength = 0xff;
return 1; return 1;
} }
if (parameters->maxCandidates < length) length = parameters->maxCandidates; if (parameters->maxCandidates < length) length = parameters->maxCandidates;
@@ -175,7 +175,7 @@ static ziBool Zi8AlphaSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED
current = signatures.first; current = signatures.first;
length = signatures.length; length = signatures.length;
} }
if (length > ZI_WORK->unk_0x0A) length = ZI_WORK->unk_0x0A; if (length > ZI_WORK->maxWordLength) length = ZI_WORK->maxWordLength;
if ((parameters->elementCount < ZI_WORK->unk_0x140C[0] || if ((parameters->elementCount < ZI_WORK->unk_0x140C[0] ||
(parameters->getOptions & 0x7e) == 2) && length > parameters->elementCount) { (parameters->getOptions & 0x7e) == 2) && length > parameters->elementCount) {
length = parameters->elementCount; length = parameters->elementCount;
@@ -185,7 +185,7 @@ static ziBool Zi8AlphaSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED
if (parameters->letters == 2) { if (parameters->letters == 2) {
current = signatures.second; current = signatures.second;
length = secondLength; length = secondLength;
if (length > ZI_WORK->unk_0x0A) length = ZI_WORK->unk_0x0A; if (length > ZI_WORK->maxWordLength) length = ZI_WORK->maxWordLength;
if ((parameters->elementCount < ZI_WORK->unk_0x140C[0] || if ((parameters->elementCount < ZI_WORK->unk_0x140C[0] ||
(parameters->getOptions & 0x7e) == 2) && length > parameters->elementCount) { (parameters->getOptions & 0x7e) == 2) && length > parameters->elementCount) {
length = parameters->elementCount; length = parameters->elementCount;
@@ -194,7 +194,7 @@ static ziBool Zi8AlphaSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED
*output++ = 0; *output++ = 0;
} }
*output++ = 0; *output++ = 0;
ZI_WORK->unk_0x0A = 0xff; ZI_WORK->maxWordLength = 0xff;
return 1; return 1;
} }
@@ -226,7 +226,7 @@ static ziBool Zi8ZhSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED_WO
length = length - parameters->firstCandidate; length = length - parameters->firstCandidate;
if (countOnly != 0) { if (countOnly != 0) {
parameters->letters = length; parameters->letters = length;
ZI_WORK->unk_0x0A = 0xff; ZI_WORK->maxWordLength = 0xff;
return 1; return 1;
} }
if (parameters->maxCandidates < length) length = parameters->maxCandidates; if (parameters->maxCandidates < length) length = parameters->maxCandidates;
@@ -279,13 +279,13 @@ static ziBool Zi8ZhSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED_WO
ziU8 _Zi8GetCandidates(ziGetParam* parameters ZI_NEED_WORK) { ziU8 _Zi8GetCandidates(ziGetParam* parameters ZI_NEED_WORK) {
ZiCandidateOptions options = {0}; ZiCandidateOptions options = {0};
options.capacity = ZI_WORK->unk_0x141A; options.capacity = ZI_WORK->capacity;
return Zi8GetCandidatesOrCount(parameters, &options, ZI_WORK); return Zi8GetCandidatesOrCount(parameters, &options, ZI_WORK);
} }
ziU8 _Zi8CheckCandidates(ziGetParam* parameters ZI_NEED_WORK) { ziU8 _Zi8CheckCandidates(ziGetParam* parameters ZI_NEED_WORK) {
ZiCandidateOptions options = {0}; ZiCandidateOptions options = {0};
options.capacity = ZI_WORK->unk_0x141A; options.capacity = ZI_WORK->capacity;
options.flags = 1; options.flags = 1;
return Zi8GetCandidatesOrCount(parameters, &options, ZI_WORK); return Zi8GetCandidatesOrCount(parameters, &options, ZI_WORK);
} }
@@ -493,8 +493,8 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option
ZI_WORK->subLanguage = parameters->subLanguage; ZI_WORK->subLanguage = parameters->subLanguage;
ZI_WORK->cangjieEnabled = Zi8GetFormatVersion(1,ZI_WORK) & 2; ZI_WORK->cangjieEnabled = Zi8GetFormatVersion(1,ZI_WORK) & 2;
options->maxCount = ZI_WORK->unk_0x10; options->maxCount = ZI_WORK->unk_0x10;
options->maxWordLength = ZI_WORK->unk_0x0A; options->maxWordLength = ZI_WORK->maxWordLength;
ZI_WORK->unk_0x0A = -1; ZI_WORK->maxWordLength = -1;
if ((ziU8)Zi8LangSupported(parameters->language,ZI_WORK) == 0) { if ((ziU8)Zi8LangSupported(parameters->language,ZI_WORK) == 0) {
Zi8LogError(0x163,ZI_WORK); Zi8LogError(0x163,ZI_WORK);
return 0; return 0;
@@ -711,6 +711,6 @@ void Zi8Memcpy(ziU8* destination, ziU8* source, ziS32 count) {
} }
ziBool Zi8SetMaxWordLength(ziU8 length ZI_NEED_WORK) { ziBool Zi8SetMaxWordLength(ziU8 length ZI_NEED_WORK) {
ZI_WORK->unk_0x0A = length; ZI_WORK->maxWordLength = length;
return 1; return 1;
} }

View File

@@ -18,7 +18,7 @@ ziU8 Zi8InitializeDynamic(ziLanguageEntry* langEntries ZI_NEED_WORK) {
Zi8Memset(__zi8_work_data, 0, 0x1B44); Zi8Memset(__zi8_work_data, 0, 0x1B44);
ZI_WORK->unk_0x08 = 1; ZI_WORK->unk_0x08 = 1;
ZI_WORK->unk_0x09 = 1; ZI_WORK->unk_0x09 = 1;
ZI_WORK->unk_0x0A = 0xFF; ZI_WORK->maxWordLength = 0xFF;
ZI_WORK->unk_0x10 = 0x64; ZI_WORK->unk_0x10 = 0x64;
*(ziU16*)&ZI_WORK->unk_0x0C = 0xFFFF; *(ziU16*)&ZI_WORK->unk_0x0C = 0xFFFF;
ZI_WORK->separator = 0x20; ZI_WORK->separator = 0x20;
@@ -44,7 +44,7 @@ ziU8 Zi8InitializeDynamic(ziLanguageEntry* langEntries ZI_NEED_WORK) {
ZI_WORK->unk_0x1874 = 0x2D; ZI_WORK->unk_0x1874 = 0x2D;
ZI_WORK->language = 0; ZI_WORK->language = 0;
ZI_WORK->unk_0x1C[3] = 0; ZI_WORK->unk_0x1C[3] = 0;
ZI_WORK->unk_0x141A = 0x100; ZI_WORK->capacity = 0x100;
Zi8SetLatinSearchOrder(0, 0, ZI_WORK); Zi8SetLatinSearchOrder(0, 0, ZI_WORK);
ZADP_Zi8SetPDremoveOpt(1, ZI_WORK); ZADP_Zi8SetPDremoveOpt(1, ZI_WORK);
ZI_WORK->unk_0x17 = 5; ZI_WORK->unk_0x17 = 5;

View File

@@ -73,7 +73,7 @@ typedef struct NWC24MsgObjPrivate {
}; };
u32 raw; u32 raw;
} msgBoardFlags; // 0xCC } msgBoardFlags; // 0xCC
NWC24Data unk_0xD0; NWC24Data extraData; // 0xD0
NWC24Data faceData; // 0xD8 NWC24Data faceData; // 0xD8
NWC24Data altName; // 0xE0 NWC24Data altName; // 0xE0
u32 textSize; // 0xE4 u32 textSize; // 0xE4

View File

@@ -26,9 +26,9 @@ extern struct NWC24Work {
u8 configData[1024]; // 0x1300 u8 configData[1024]; // 0x1300
u8 unk_0x1700[128]; // 0x1700 u8 sendMbcHeader[128]; // 0x1700
u8 unk_0x1780[128]; // 0x1780 u8 recvMbcHeader[128]; // 0x1780
u8 unk_0x1800[256]; // 0x1800 u8 mbcEntry[256]; // 0x1800
u8 base64Work[256]; // 0x1900 u8 base64Work[256]; // 0x1900
u8 unk_0x1A00[4096]; // 0x1A00 u8 unk_0x1A00[4096]; // 0x1A00

View File

@@ -170,7 +170,7 @@ NWC24Err NWC24GetMsgObj(NWC24MsgObj* msg, NWC24MBoxType type, u32 id) {
u32 count = 0; u32 count = 0;
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
return NWC24_ERR_LIB_NOT_OPENED; return NWC24_ERR_LIB_NOT_OPENED;
entry = (MBCEntry*)NWC24WorkP->unk_0x1800; entry = (MBCEntry*)NWC24WorkP->mbcEntry;
memset(entry, 0, sizeof(*entry)); memset(entry, 0, sizeof(*entry));
if (id == 0) if (id == 0)
return NWC24_ERR_HIDDEN; return NWC24_ERR_HIDDEN;
@@ -251,7 +251,7 @@ NWC24Err NWC24GetMsgIdList(NWC24MBoxType type, u32* ids, u32 maxLength) {
MBCEntry* entry; MBCEntry* entry;
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
return NWC24_ERR_LIB_NOT_OPENED; return NWC24_ERR_LIB_NOT_OPENED;
entry = (MBCEntry*)NWC24WorkP->unk_0x1800; entry = (MBCEntry*)NWC24WorkP->mbcEntry;
err = GetCachedMBCHeader(type, &header); err = GetCachedMBCHeader(type, &header);
if (err != NWC24_OK) if (err != NWC24_OK)
return err; return err;
@@ -307,11 +307,11 @@ NWC24Err NWC24iOpenMBox(void) {
NWC24File recvFile, sendFile; NWC24File recvFile, sendFile;
char* path = NWC24WorkP->pathWork; char* path = NWC24WorkP->pathWork;
NWC24Err err; NWC24Err err;
Mail_memset(NWC24WorkP->unk_0x1700, 0, 128); Mail_memset(NWC24WorkP->sendMbcHeader, 0, 128);
err = GetCachedMBCHeader(NWC24_MBOX_TYPE_SEND, &header); err = GetCachedMBCHeader(NWC24_MBOX_TYPE_SEND, &header);
if (err != NWC24_OK) if (err != NWC24_OK)
return err; return err;
Mail_memset(NWC24WorkP->unk_0x1780, 0, 128); Mail_memset(NWC24WorkP->recvMbcHeader, 0, 128);
err = GetCachedMBCHeader(NWC24_MBOX_TYPE_RECV, &header); err = GetCachedMBCHeader(NWC24_MBOX_TYPE_RECV, &header);
if (err != NWC24_OK) if (err != NWC24_OK)
return err; return err;
@@ -340,11 +340,11 @@ NWC24Err NWC24iInitMBox(void) {
NWC24File recvFile, sendFile; NWC24File recvFile, sendFile;
NWC24Err recvResult, sendResult, err, sendStatus; NWC24Err recvResult, sendResult, err, sendStatus;
char* path = NWC24WorkP->pathWork; char* path = NWC24WorkP->pathWork;
Mail_memset(NWC24WorkP->unk_0x1700, 0, 128); Mail_memset(NWC24WorkP->sendMbcHeader, 0, 128);
sendResult = CreateCtrlFile(NWC24_MBOX_TYPE_SEND, FALSE); sendResult = CreateCtrlFile(NWC24_MBOX_TYPE_SEND, FALSE);
if (sendResult < 0) if (sendResult < 0)
return sendResult; return sendResult;
Mail_memset(NWC24WorkP->unk_0x1780, 0, 128); Mail_memset(NWC24WorkP->recvMbcHeader, 0, 128);
recvResult = CreateCtrlFile(NWC24_MBOX_TYPE_RECV, FALSE); recvResult = CreateCtrlFile(NWC24_MBOX_TYPE_RECV, FALSE);
if (recvResult < 0) if (recvResult < 0)
return recvResult; return recvResult;
@@ -616,11 +616,11 @@ static NWC24Err CreateCtrlFile(NWC24MBoxType type, BOOL force) {
err = MakeCtrlPath(path, type); err = MakeCtrlPath(path, type);
if (err != NWC24_OK) if (err != NWC24_OK)
return err; return err;
entry = (MBCEntry*)NWC24WorkP->unk_0x1800; entry = (MBCEntry*)NWC24WorkP->mbcEntry;
if (type == NWC24_MBOX_TYPE_SEND) if (type == NWC24_MBOX_TYPE_SEND)
header = (MBCHeader*)NWC24WorkP->unk_0x1700; header = (MBCHeader*)NWC24WorkP->sendMbcHeader;
else if (type == NWC24_MBOX_TYPE_RECV) else if (type == NWC24_MBOX_TYPE_RECV)
header = (MBCHeader*)NWC24WorkP->unk_0x1780; header = (MBCHeader*)NWC24WorkP->recvMbcHeader;
else else
return NWC24_ERR_INVALID_VALUE; return NWC24_ERR_INVALID_VALUE;
result = err; result = err;
@@ -676,7 +676,7 @@ static NWC24Err DeleteMsg(NWC24MBoxType type, u32 id, BOOL protect) {
NWC24Err err, deleteResult, closeResult; NWC24Err err, deleteResult, closeResult;
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
return NWC24_ERR_LIB_NOT_OPENED; return NWC24_ERR_LIB_NOT_OPENED;
entry = (MBCEntry*)NWC24WorkP->unk_0x1800; entry = (MBCEntry*)NWC24WorkP->mbcEntry;
err = GetCachedMBCHeader(type, &header); err = GetCachedMBCHeader(type, &header);
if (err != NWC24_OK) if (err != NWC24_OK)
return err; return err;
@@ -754,7 +754,7 @@ static NWC24Err DuplicationCheck(MBCHeader* header, const NWC24MsgObjPrivate* ms
NWC24Err clearResult, deleteResult; NWC24Err clearResult, deleteResult;
if (type == NWC24_MBOX_TYPE_SEND) if (type == NWC24_MBOX_TYPE_SEND)
return NWC24_OK; return NWC24_OK;
entry = (MBCEntry*)NWC24WorkP->unk_0x1800; entry = (MBCEntry*)NWC24WorkP->mbcEntry;
for (offset = 128; offset < header->fileSize; offset += 128) { for (offset = 128; offset < header->fileSize; offset += 128) {
if (count >= header->numMessages) if (count >= header->numMessages)
break; break;
@@ -809,9 +809,9 @@ static NWC24Err GetCachedMBCHeader(NWC24MBoxType type, MBCHeader** header) {
char* path; char* path;
NWC24Err err = NWC24_OK, closeResult; NWC24Err err = NWC24_OK, closeResult;
if (type == NWC24_MBOX_TYPE_SEND) if (type == NWC24_MBOX_TYPE_SEND)
*header = (MBCHeader*)NWC24WorkP->unk_0x1700; *header = (MBCHeader*)NWC24WorkP->sendMbcHeader;
else if (type == NWC24_MBOX_TYPE_RECV) else if (type == NWC24_MBOX_TYPE_RECV)
*header = (MBCHeader*)NWC24WorkP->unk_0x1780; *header = (MBCHeader*)NWC24WorkP->recvMbcHeader;
else { else {
*header = NULL; *header = NULL;
return NWC24_ERR_INVALID_VALUE; return NWC24_ERR_INVALID_VALUE;
@@ -874,7 +874,7 @@ static NWC24Err InitMBCHeader(MBCHeader* header, NWC24MBoxType type) {
static NWC24Err AddMBCEntry(MBCHeader* header, const NWC24MsgObjPrivate* msg, NWC24File* file) { static NWC24Err AddMBCEntry(MBCHeader* header, const NWC24MsgObjPrivate* msg, NWC24File* file) {
u32 offset = header->freeOffset; u32 offset = header->freeOffset;
MBCEntry* entry = (MBCEntry*)NWC24WorkP->unk_0x1800; MBCEntry* entry = (MBCEntry*)NWC24WorkP->mbcEntry;
u32 next; u32 next;
NWC24Err err; NWC24Err err;
if (offset == 0) if (offset == 0)
@@ -906,7 +906,7 @@ static NWC24Err AddMBCEntry(MBCHeader* header, const NWC24MsgObjPrivate* msg, NW
} }
static NWC24Err ClearMBCEntry(MBCHeader* header, NWC24File* file, u32 offset) { static NWC24Err ClearMBCEntry(MBCHeader* header, NWC24File* file, u32 offset) {
MBCEntry* entry = (MBCEntry*)NWC24WorkP->unk_0x1800; MBCEntry* entry = (MBCEntry*)NWC24WorkP->mbcEntry;
NWC24Err err = NWC24FSeek(file, offset, NWC24_SEEK_BEG); NWC24Err err = NWC24FSeek(file, offset, NWC24_SEEK_BEG);
if (err != NWC24_OK) if (err != NWC24_OK)
return err; return err;

View File

@@ -243,11 +243,11 @@ static inline NWC24Err WriteMBDelayField(NWC24MsgObjPrivate* msg) {
static inline NWC24Err WriteExtraFields(NWC24MsgObjPrivate* msg) { static inline NWC24Err WriteExtraFields(NWC24MsgObjPrivate* msg) {
NWC24Err err; NWC24Err err;
if (msg->unk_0xD0.size == 0) if (msg->extraData.size == 0)
return NWC24_OK; return NWC24_OK;
err = NWC24FWrite(msg->unk_0xD0.ptr, msg->unk_0xD0.size, m_pFile); err = NWC24FWrite(msg->extraData.ptr, msg->extraData.size, m_pFile);
if (err == NWC24_OK) if (err == NWC24_OK)
msg->length += msg->unk_0xD0.size; msg->length += msg->extraData.size;
return err; return err;
} }

View File

@@ -77,7 +77,7 @@ NWC24Err NWC24InitMsgObj(NWC24MsgObj* msg, NWC24MsgType type) {
NWC24Data_Init(&msgObj->toData); NWC24Data_Init(&msgObj->toData);
NWC24Data_Init(&msgObj->unk_0x50); NWC24Data_Init(&msgObj->unk_0x50);
NWC24Data_Init(&msgObj->unk_0x58); NWC24Data_Init(&msgObj->unk_0x58);
NWC24Data_Init(&msgObj->unk_0xD0); NWC24Data_Init(&msgObj->extraData);
NWC24Data_Init(&msgObj->faceData); NWC24Data_Init(&msgObj->faceData);
NWC24Data_Init(&msgObj->altName); NWC24Data_Init(&msgObj->altName);

View File

@@ -46,17 +46,17 @@ namespace ipl {
} }
if (mButton != 0) { if (mButton != 0) {
if (down(BTN_INTERACT)) { if (down(BTN_INTERACT)) {
unk_0x08++; mDecideHoldCount++;
} else { } else {
unk_0x08 = 0; mDecideHoldCount = 0;
mButton = 0; mButton = 0;
} }
} else { } else {
unk_0x08 = 0; mDecideHoldCount = 0;
} }
} else { } else {
mButton = 0; mButton = 0;
unk_0x08 = 0; mDecideHoldCount = 0;
} }
switch (mRumbleType) { switch (mRumbleType) {
@@ -109,7 +109,7 @@ namespace ipl {
return NULL; return NULL;
} }
int ipl::controller::Base::decide() const { int ipl::controller::Base::decide() const {
return unk_0x08 == 5; return mDecideHoldCount == 5;
} }
int ipl::controller::Base::rumble(int type) { int ipl::controller::Base::rumble(int type) {
int ret = FALSE; int ret = FALSE;
@@ -130,44 +130,44 @@ namespace ipl {
} }
void ipl::controller::Revolution::read() { void ipl::controller::Revolution::read() {
if (!isValidDpd()) { if (!isValidDpd()) {
unk_0x20->pos.y = 1.0f / 0.0f; mpStatus->pos.y = 1.0f / 0.0f;
unk_0x20->pos.x = 1.0f / 0.0f; mpStatus->pos.x = 1.0f / 0.0f;
unk_0x20->speed = 0.0f; mpStatus->speed = 0.0f;
unk_0x20->vec.y = 0.0f; mpStatus->vec.y = 0.0f;
unk_0x20->vec.x = 0.0f; mpStatus->vec.x = 0.0f;
} }
unk_0x1E = unk_0x1D; mbPrevPinch = mbPinch;
if (isValidBtn()) { if (isValidBtn()) {
if (unk_0x1E == 0) { if (mbPrevPinch == 0) {
if (down(0x800) && down(0x400)) { if (down(0x800) && down(0x400)) {
unk_0x1D = 1; mbPinch = 1;
} }
} else if (!down(0x800) || !down(0x400)) { } else if (!down(0x800) || !down(0x400)) {
unk_0x1D = 0; mbPinch = 0;
} }
} else { } else {
unk_0x1D = 0; mbPinch = 0;
} }
Base::read(); Base::read();
} }
bool ipl::controller::Revolution::isValidDpd() const { bool ipl::controller::Revolution::isValidDpd() const {
if (unk_0x1C != 0) { if (mbForceInvalid != 0) {
return false; return false;
} }
return (unk_0x20->wpad_err == 0 || unk_0x20->wpad_err == -7) && unk_0x20->dpd_valid_fg != 0; return (mpStatus->wpad_err == 0 || mpStatus->wpad_err == -7) && mpStatus->dpd_valid_fg != 0;
} }
bool ipl::controller::Revolution::isValidBtn() const { bool ipl::controller::Revolution::isValidBtn() const {
u8 val = unk_0x20->wpad_err; u8 val = mpStatus->wpad_err;
return (u8)(val + 7) <= 7 && ((1 << (val + 7)) & 0xA1) != 0; return (u8)(val + 7) <= 7 && ((1 << (val + 7)) & 0xA1) != 0;
} }
bool ipl::controller::Revolution::down(u32 mButton) const { bool ipl::controller::Revolution::down(u32 mButton) const {
bool ret = false; bool ret = false;
if (isValidBtn()) { if (isValidBtn()) {
if (unk_0x20->hold & (mButton & 0xFFFF)) { if (mpStatus->hold & (mButton & 0xFFFF)) {
ret = true; ret = true;
} }
} }
@@ -177,7 +177,7 @@ namespace ipl {
ipl::math::VEC2 ipl::controller::Revolution::getDpdProjectionPos() const { ipl::math::VEC2 ipl::controller::Revolution::getDpdProjectionPos() const {
math::VEC2 ret; math::VEC2 ret;
Vec2 dest; Vec2 dest;
Vec2 src = {unk_0x20->pos.x, unk_0x20->pos.y}; Vec2 src = {mpStatus->pos.x, mpStatus->pos.y};
nw4r::ut::Rect nw4r_rect; // constructor shouldn't be inlined nw4r::ut::Rect nw4r_rect; // constructor shouldn't be inlined
Rect kpad_rect; Rect kpad_rect;
@@ -216,9 +216,9 @@ namespace ipl {
y = fy; y = fy;
} }
ipl::controller::Classic::Classic(int arg0, KPADStatus& arg1) : Revolution(arg0, arg1) { ipl::controller::Classic::Classic(int arg0, KPADStatus& arg1) : Revolution(arg0, arg1) {
unk_0x24.x = 0.01f; mClassicCursor.x = 0.01f;
unk_0x24.y = 0.01f; mClassicCursor.y = 0.01f;
unk_0x2C = 0; mClassicCursorTimer = 0;
} }
ipl::controller::Base::~Base() { ipl::controller::Base::~Base() {
} }
@@ -230,32 +230,32 @@ namespace ipl {
} }
void ipl::controller::Classic::read() { void ipl::controller::Classic::read() {
if (!Revolution::isValidDpd()) { if (!Revolution::isValidDpd()) {
math::VEC2 lstick(unk_0x20->ex_status.cl.lstick.x, unk_0x20->ex_status.cl.lstick.y); math::VEC2 lstick(mpStatus->ex_status.cl.lstick.x, mpStatus->ex_status.cl.lstick.y);
if (lstick.x * lstick.x + lstick.y * lstick.y > 0.0036f) { if (lstick.x * lstick.x + lstick.y * lstick.y > 0.0036f) {
unk_0x24.x = math::abs_clamp(unk_0x24.x + unk_0x20->ex_status.cl.lstick.x * 0.05f, 1.8f); mClassicCursor.x = math::abs_clamp(mClassicCursor.x + mpStatus->ex_status.cl.lstick.x * 0.05f, 1.8f);
unk_0x24.y = math::abs_clamp(unk_0x24.y - unk_0x20->ex_status.cl.lstick.y * 0.05f, 1.2f); mClassicCursor.y = math::abs_clamp(mClassicCursor.y - mpStatus->ex_status.cl.lstick.y * 0.05f, 1.2f);
} }
math::VEC2 rstick = math::VEC2(unk_0x20->ex_status.cl.rstick.x, unk_0x20->ex_status.cl.rstick.y); math::VEC2 rstick = math::VEC2(mpStatus->ex_status.cl.rstick.x, mpStatus->ex_status.cl.rstick.y);
if (getClassicHoldFlag() != 0 || lstick.x * lstick.x + lstick.y * lstick.y > 0.0036f || if (getClassicHoldFlag() != 0 || lstick.x * lstick.x + lstick.y * lstick.y > 0.0036f ||
rstick.x * rstick.x + rstick.y * rstick.y > 0.0036f) { rstick.x * rstick.x + rstick.y * rstick.y > 0.0036f) {
unk_0x2C = 180; mClassicCursorTimer = 180;
} }
if (--unk_0x2C < 0) { if (--mClassicCursorTimer < 0) {
unk_0x2C = 0; mClassicCursorTimer = 0;
} }
} else { } else {
unk_0x24.y = 0.01f; mClassicCursor.y = 0.01f;
unk_0x24.x = 0.01f; mClassicCursor.x = 0.01f;
unk_0x2C = 0; mClassicCursorTimer = 0;
} }
Revolution::read(); Revolution::read();
} }
int ipl::controller::Classic::getClassicHoldFlag() const { int ipl::controller::Classic::getClassicHoldFlag() const {
return unk_0x20->ex_status.cl.hold; return mpStatus->ex_status.cl.hold;
} }
template <> template <>
f32 ipl::math::abs_clamp<f32>(const f32& x, const f32& y) { f32 ipl::math::abs_clamp<f32>(const f32& x, const f32& y) {
@@ -270,7 +270,7 @@ namespace ipl {
ipl::math::VEC2 ipl::controller::Classic::getHorizon() const { ipl::math::VEC2 ipl::controller::Classic::getHorizon() const {
math::VEC2 ret; math::VEC2 ret;
if (Revolution::isValidDpd()) { if (Revolution::isValidDpd()) {
ret.set(unk_0x20->horizon.x, unk_0x20->horizon.y); ret.set(mpStatus->horizon.x, mpStatus->horizon.y);
} else { } else {
ret.x = 1.0f; ret.x = 1.0f;
ret.y = -0.2679492f; ret.y = -0.2679492f;
@@ -280,9 +280,9 @@ namespace ipl {
ipl::math::VEC2 ipl::controller::Classic::getDpdPos() const { ipl::math::VEC2 ipl::controller::Classic::getDpdPos() const {
math::VEC2 ret; math::VEC2 ret;
if (Revolution::isValidDpd()) { if (Revolution::isValidDpd()) {
ret.set(unk_0x20->pos.x, unk_0x20->pos.y); ret.set(mpStatus->pos.x, mpStatus->pos.y);
} else if (unk_0x2C != 0) { } else if (mClassicCursorTimer != 0) {
ret = unk_0x24; ret = mClassicCursor;
} else { } else {
ret.x = (1.0f / 0.0f); ret.x = (1.0f / 0.0f);
ret.y = (1.0f / 0.0f); ret.y = (1.0f / 0.0f);
@@ -296,9 +296,9 @@ namespace ipl {
ipl::math::VEC2 ipl::controller::Classic::getDpdProjectionPos() const { ipl::math::VEC2 ipl::controller::Classic::getDpdProjectionPos() const {
math::VEC2 ret; math::VEC2 ret;
if (Revolution::isValidDpd()) { if (Revolution::isValidDpd()) {
ret.set(unk_0x20->pos.x, unk_0x20->pos.y); ret.set(mpStatus->pos.x, mpStatus->pos.y);
} else if (unk_0x2C != 0) { } else if (mClassicCursorTimer != 0) {
ret = unk_0x24; ret = mClassicCursor;
} else { } else {
ret.set(1.0f / 0.0f, 1.0f / 0.0f); ret.set(1.0f / 0.0f, 1.0f / 0.0f);
} }
@@ -454,7 +454,7 @@ void ipl::controller::Master::setForceInvalid(bool flag) {
return -1; return -1;
} }
void ipl::controller::Base::setForceInvalid(bool flag) { void ipl::controller::Base::setForceInvalid(bool flag) {
unk_0x1C = flag; mbForceInvalid = flag;
} }
int ipl::controller::Base::getType() const { int ipl::controller::Base::getType() const {
return mType; return mType;
@@ -463,65 +463,65 @@ void ipl::controller::Master::setForceInvalid(bool flag) {
return mChan; return mChan;
} }
KPADStatus* ipl::controller::Revolution::getKPADStatus() const { KPADStatus* ipl::controller::Revolution::getKPADStatus() const {
return unk_0x20; return mpStatus;
} }
f32 ipl::controller::Revolution::getDpdDistance() const { f32 ipl::controller::Revolution::getDpdDistance() const {
return unk_0x20->dist; return mpStatus->dist;
} }
int ipl::controller::Revolution::getReleaseFlag() const { int ipl::controller::Revolution::getReleaseFlag() const {
return unk_0x20->release; return mpStatus->release;
} }
int ipl::controller::Revolution::getTrigFlag() const { int ipl::controller::Revolution::getTrigFlag() const {
return unk_0x20->trig; return mpStatus->trig;
} }
int ipl::controller::Revolution::getHoldFlag() const { int ipl::controller::Revolution::getHoldFlag() const {
return unk_0x20->hold; return mpStatus->hold;
} }
int ipl::controller::Revolution::pinchOffTrg() const { int ipl::controller::Revolution::pinchOffTrg() const {
int ret = 0; int ret = 0;
if (isValidBtn() && unk_0x1D == 0 && unk_0x1E != 0) { if (isValidBtn() && mbPinch == 0 && mbPrevPinch != 0) {
ret = 1; ret = 1;
} }
return ret; return ret;
} }
int ipl::controller::Revolution::pinch() const { int ipl::controller::Revolution::pinch() const {
int ret = 0; int ret = 0;
if (isValidBtn() && unk_0x1D != 0) { if (isValidBtn() && mbPinch != 0) {
ret = 1; ret = 1;
} }
return ret; return ret;
} }
int ipl::controller::Revolution::pinchTrg() const { int ipl::controller::Revolution::pinchTrg() const {
int ret = 0; int ret = 0;
if (isValidBtn() && unk_0x1D != 0 && unk_0x1E == 0) { if (isValidBtn() && mbPinch != 0 && mbPrevPinch == 0) {
ret = 1; ret = 1;
} }
return ret; return ret;
} }
bool ipl::controller::Revolution::repeat(u32 button) const { bool ipl::controller::Revolution::repeat(u32 button) const {
return down(button) && (unk_0x20->hold & 0x80000000) != 0; return down(button) && (mpStatus->hold & 0x80000000) != 0;
} }
BOOL ipl::controller::Classic::isValidDpdClassic() const { BOOL ipl::controller::Classic::isValidDpdClassic() const {
return unk_0x2C != 0; return mClassicCursorTimer != 0;
} }
bool ipl::controller::Classic::isValidDpd() const { bool ipl::controller::Classic::isValidDpd() const {
if (unk_0x1C != 0) { if (mbForceInvalid != 0) {
return false; return false;
} }
return (Revolution::isValidDpd() != 0) || (unk_0x2C != 0); return (Revolution::isValidDpd() != 0) || (mClassicCursorTimer != 0);
} }
int ipl::controller::Classic::getClassicReleaseFlag() const { int ipl::controller::Classic::getClassicReleaseFlag() const {
return unk_0x20->ex_status.cl.release; return mpStatus->ex_status.cl.release;
} }
int ipl::controller::Classic::getClassicTrigFlag() const { int ipl::controller::Classic::getClassicTrigFlag() const {
return unk_0x20->ex_status.cl.trig; return mpStatus->ex_status.cl.trig;
} }
bool ipl::controller::Classic::upTrg(u32 button) const { bool ipl::controller::Classic::upTrg(u32 button) const {
bool ret = false; bool ret = false;
if (isValidBtn()) { if (isValidBtn()) {
bool pressed = true; bool pressed = true;
KPADStatus* status = unk_0x20; KPADStatus* status = mpStatus;
if ((status->release & (button & 0xFFFF)) == 0) { if ((status->release & (button & 0xFFFF)) == 0) {
if ((status->ex_status.cl.release & (button >> 16)) == 0) { if ((status->ex_status.cl.release & (button >> 16)) == 0) {
pressed = false; pressed = false;
@@ -537,7 +537,7 @@ void ipl::controller::Master::setForceInvalid(bool flag) {
bool ret = false; bool ret = false;
if (isValidBtn()) { if (isValidBtn()) {
bool pressed = true; bool pressed = true;
KPADStatus* status = unk_0x20; KPADStatus* status = mpStatus;
if ((status->trig & (button & 0xFFFF)) == 0) { if ((status->trig & (button & 0xFFFF)) == 0) {
if ((status->ex_status.cl.trig & (button >> 16)) == 0) { if ((status->ex_status.cl.trig & (button >> 16)) == 0) {
pressed = false; pressed = false;
@@ -553,8 +553,8 @@ void ipl::controller::Master::setForceInvalid(bool flag) {
bool ret = false; bool ret = false;
if (isValidBtn()) { if (isValidBtn()) {
bool pressed = true; bool pressed = true;
if ((unk_0x20->hold & (button & 0xFFFF)) == 0) { if ((mpStatus->hold & (button & 0xFFFF)) == 0) {
if ((unk_0x20->ex_status.cl.hold & (button >> 16)) == 0) { if ((mpStatus->ex_status.cl.hold & (button >> 16)) == 0) {
pressed = false; pressed = false;
} }
} }
@@ -565,15 +565,15 @@ void ipl::controller::Master::setForceInvalid(bool flag) {
return ret; return ret;
} }
ipl::math::VEC2 ipl::controller::Revolution::getHorizon() const { ipl::math::VEC2 ipl::controller::Revolution::getHorizon() const {
return math::VEC2(unk_0x20->horizon.x, unk_0x20->horizon.y); return math::VEC2(mpStatus->horizon.x, mpStatus->horizon.y);
} }
ipl::math::VEC2 ipl::controller::Revolution::getDpdPos() const { ipl::math::VEC2 ipl::controller::Revolution::getDpdPos() const {
return math::VEC2(unk_0x20->pos.x, unk_0x20->pos.y); return math::VEC2(mpStatus->pos.x, mpStatus->pos.y);
} }
bool ipl::controller::Revolution::upTrg(u32 button) const { bool ipl::controller::Revolution::upTrg(u32 button) const {
bool ret = false; bool ret = false;
if (isValidBtn()) { if (isValidBtn()) {
if (unk_0x20->release & (button & 0xFFFF)) { if (mpStatus->release & (button & 0xFFFF)) {
ret = true; ret = true;
} }
} }
@@ -582,7 +582,7 @@ void ipl::controller::Master::setForceInvalid(bool flag) {
bool ipl::controller::Revolution::downTrg(u32 button) const { bool ipl::controller::Revolution::downTrg(u32 button) const {
bool ret = false; bool ret = false;
if (isValidBtn()) { if (isValidBtn()) {
if (unk_0x20->trig & (button & 0xFFFF)) { if (mpStatus->trig & (button & 0xFFFF)) {
ret = true; ret = true;
} }
} }

View File

@@ -152,9 +152,9 @@ namespace ipl {
} }
Revolution::Revolution(int chan, int type, KPADStatus& status) : Base(chan, type, status) { Revolution::Revolution(int chan, int type, KPADStatus& status) : Base(chan, type, status) {
unk_0x1D = 0; mbPinch = 0;
unk_0x1E = 0; mbPrevPinch = 0;
unk_0x20 = &status; mpStatus = &status;
} }
Interface* Manager::getMasterController() { Interface* Manager::getMasterController() {