Compare commits

..

1 Commits

Author SHA1 Message Date
coah
c403d9edcc cleanup(SettingButton): name deferred command ring buffer
Rename Unk/unk_* queue fields from usage as a circular command buffer:
- Unk → CmdEntry
- unk_0x64 → mCmdQueue
- unk_0x264 → mCmdCapacity
- unk_0x268 → mCmdCount
- unk_0x26C → mCmdReadIdx
- unk_0x270 → mCmdWriteIdx

Verified: SettingButton 100%/100%, build/43U/ok, DOL sha1
26116613f624061ba99c8d1a299aaa6efa85670d
2026-10-02 14:03:03 -05:00
39 changed files with 439 additions and 439 deletions

View File

@@ -18,11 +18,11 @@ namespace ipl {
class line_collision { class line_collision {
public: public:
line_collision() : mLeft(0.0f), mRight(0.0f), mY(0.0f) {} line_collision() : unk_0x00(0.0f), unk_0x04(0.0f), unk_0x08(0.0f) {}
f32 mLeft; f32 unk_0x00;
f32 mRight; f32 unk_0x04;
f32 mY; f32 unk_0x08;
nw4r::ut::Link mLinkList; // 0x0C nw4r::ut::Link mLinkList; // 0x0C
}; };
@@ -31,9 +31,9 @@ namespace ipl {
url_collision(); url_collision();
~url_collision(); ~url_collision();
int mTagNo; int unk_0x00;
wchar_t* mpStart; wchar_t* unk_0x04;
wchar_t* mpEnd; wchar_t* unk_0x08;
nw4r::ut::Link mLinkList; // 0x0C nw4r::ut::Link mLinkList; // 0x0C
nw4r::ut::List mLineCollisions; // 0x14 nw4r::ut::List mLineCollisions; // 0x14
}; };
@@ -53,19 +53,19 @@ namespace ipl {
void parse(nw4r::ut::PrintContext<wchar_t>* context); void parse(nw4r::ut::PrintContext<wchar_t>* context);
BOOL is_focused() const; BOOL is_focused() const;
void select(int tagNo); void select(int unk);
int get_focused_tagno(int chan) const; int get_focused_tagno(int chan) const;
url_collision* get_selected_col(); url_collision* get_selected_col();
void get_url(char* urlOut, u32 urlLen); void get_url(char* urlOut, u32 urlLen);
void setHitYOffset(f32 val) { mHitYOffset = val; } void setUnk_0x40(f32 val) { unk_0x40 = val; }
void setMemoTranslateY(f32 val) { mMemoTranslateY = val; } void setUnk_0x44(f32 val) { unk_0x44 = val; }
void setFocusEnabled(bool val) { mbFocusEnabled = val; } void setUnk_0x53(bool val) { unk_0x53 = val; }
u8 getColorPass() const { return mbColorPass; } u8 getUnk_0x50() const { return unk_0x50; }
void setColorPass(u8 val) { mbColorPass = val; } void setUnk_0x50(u8 val) { unk_0x50 = val; }
private: private:
typedef struct { typedef struct {
@@ -75,14 +75,14 @@ namespace ipl {
con_data mConData[WPAD_MAX_CONTROLLERS]; // 0x00 con_data mConData[WPAD_MAX_CONTROLLERS]; // 0x00
nw4r::ut::List mUrlCollisions; // 0x34 nw4r::ut::List mUrlCollisions; // 0x34
f32 mHitYOffset; f32 unk_0x40;
f32 mMemoTranslateY; f32 unk_0x44;
int mCurTagNo; int unk_0x48;
int mSelectedTagNo; int unk_0x4C;
u8 mbColorPass; u8 unk_0x50;
u8 mbInTag; u8 unk_0x51;
u8 mbHoverOffset; u8 unk_0x52;
u8 mbFocusEnabled; u8 unk_0x53;
}; };
} // namespace scene } // namespace scene
} // namespace ipl } // namespace ipl

View File

@@ -69,10 +69,10 @@ namespace ipl {
CmdEntry mCmdQueue[64]; CmdEntry mCmdQueue[64];
int mQueueCapacity; int mCmdCapacity;
int mQueueCount; int mCmdCount;
int mQueueRead; int mCmdReadIdx;
int mQueueWrite; int mCmdWriteIdx;
int mSettingArg; // 0x274 int mSettingArg; // 0x274

View File

@@ -89,10 +89,10 @@ namespace ipl {
int mIPLState; // 0x04 int mIPLState; // 0x04
volatile BS2State mState; // 0x08 volatile BS2State mState; // 0x08
bool mbTickEnabled; // 0x0C bool unk_0x0C;
bool mbUpdateRequested; // 0x0D bool unk_0x0D;
bool mbAbortRequested; // 0x0E bool unk_0x0E;
bool mbRestartRequested; // 0x0F bool unk_0x0F;
bool mbIsDiagDisc; // 0x10 bool mbIsDiagDisc; // 0x10
bool mbIncludesSeatTitles; // 0x11 bool mbIncludesSeatTitles; // 0x11
u8* mpBannerBuffer; // 0x14 u8* mpBannerBuffer; // 0x14

View File

@@ -118,26 +118,26 @@ namespace ipl {
public: public:
Base(int chan, KPADStatus& status) { Base(int chan, KPADStatus& status) {
mButton = 0; mButton = 0;
mDecideHoldCount = 0; unk_0x08 = 0;
mLastRumbleTime = 0; mLastRumbleTime = 0;
mRumbleType = -1; mRumbleType = -1;
mChan = chan; mChan = chan;
mType = 2; mType = 2;
mbForceInvalid = 0; unk_0x1C = 0;
KPADEnableDPD(chan); KPADEnableDPD(chan);
mbPinch = 0; unk_0x1D = 0;
mbPrevPinch = 0; unk_0x1E = 0;
mpStatus = &status; unk_0x20 = &status;
} }
Base(int chan, int type, KPADStatus& status) { Base(int chan, int type, KPADStatus& status) {
mButton = 0; mButton = 0;
mDecideHoldCount = 0; unk_0x08 = 0;
mLastRumbleTime = 0; mLastRumbleTime = 0;
mRumbleType = -1; mRumbleType = -1;
mChan = chan; mChan = chan;
mType = type; mType = type;
mbForceInvalid = 0; unk_0x1C = 0;
KPADEnableDPD(chan); KPADEnableDPD(chan);
} }
@@ -152,15 +152,15 @@ namespace ipl {
protected: protected:
u8 mButton; u8 mButton;
u32 mDecideHoldCount; u32 unk_0x08;
OSTick mLastRumbleTime; OSTick mLastRumbleTime;
s32 mRumbleType; s32 mRumbleType;
u32 mChan; u32 mChan;
u32 mType; u32 mType;
u8 mbForceInvalid; u8 unk_0x1C;
u8 mbPinch; u8 unk_0x1D;
u8 mbPrevPinch; u8 unk_0x1E;
KPADStatus* mpStatus; KPADStatus* unk_0x20;
}; };
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 mClassicCursor; math::VEC2 unk_0x24;
int mClassicCursorTimer; int unk_0x2C;
}; };
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;
mDecideHoldCount = 0; unk_0x08 = 0;
mLastRumbleTime = 0; mLastRumbleTime = 0;
mRumbleType = -1; mRumbleType = -1;
mChan = chan; mChan = chan;
mType = 2; mType = 2;
mbForceInvalid = 0; unk_0x1C = 0;
KPADEnableDPD(chan); KPADEnableDPD(chan);
mbPinch = 0; unk_0x1D = 0;
mbPrevPinch = 0; unk_0x1E = 0;
mpStatus = &arg1; unk_0x20 = &arg1;
} }
virtual ~Base(); // 0x08 virtual ~Base(); // 0x08
@@ -326,15 +326,15 @@ namespace ipl {
// protected: // protected:
u8 mButton; // 0x4 u8 mButton; // 0x4
u32 mDecideHoldCount; // 0x8 u32 unk_0x08; // 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 mbForceInvalid; u8 unk_0x1C;
u8 mbPinch; // 0x1D u8 unk_0x1D; // 0x1D
u8 mbPrevPinch; // 0x1E u8 unk_0x1E; // 0x1E
KPADStatus* mpStatus; // 0x20 KPADStatus* unk_0x20; // 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 mClassicCursor; math::VEC2 unk_0x24;
int mClassicCursorTimer; int unk_0x2C;
}; };
class Manager { class Manager {

View File

@@ -60,9 +60,9 @@ namespace ipl {
int mMessageID; // 0x08 int mMessageID; // 0x08
int mArg2; int unk_0x0C;
int mArg3; int unk_0x10;
char mArg1[4]; char unk_0x14[4];
u8* mpArcData; // 0x18 u8* mpArcData; // 0x18
u32 mArcSize; // 0x1C u32 mArcSize; // 0x1C

View File

@@ -139,7 +139,7 @@ namespace ipl {
bool received() { return mbReviecedMsg; } bool received() { return mbReviecedMsg; }
void prepNextReceive() { mbReviecedMsg = false; } void prepNextReceive() { mbReviecedMsg = false; }
volatile bool isReceivingIdle() { return mbReceiving == false; } volatile bool isUnk0xA31() { return unk_0xA31 == false; }
BOOL isAppDlEnableLock(u32 appId) { BOOL isAppDlEnableLock(u32 appId) {
utility::autoMutexLock lock(mAutoLock); utility::autoMutexLock lock(mAutoLock);
@@ -175,9 +175,9 @@ namespace ipl {
OSMutex mAutoLock; // 0xA18 OSMutex mAutoLock; // 0xA18
bool mbReviecedMsg; bool mbReviecedMsg;
bool mbReceiving; bool unk_0xA31;
bool mbReceivePaused; // 0xA32 bool mbReceivePaused; // 0xA32
bool mbNewTitleTblReady; bool unk_0xA33;
static Arg smArg; static Arg smArg;

View File

@@ -63,7 +63,7 @@ typedef struct {
u8 mcuYRem; // 0x0F u8 mcuYRem; // 0x0F
u16 mcuYCount; // 0x10 u16 mcuYCount; // 0x10
u16 mcuXCount2; // 0x12 u16 mcuXCount2; // 0x12
u32 mcuTotal; // 0x14 u32 unk_0x14;
u8 remX; // 0x18 u8 remX; // 0x18
u8 remY; // 0x19 u8 remY; // 0x19
u8 compCount; // 0x1A u8 compCount; // 0x1A
@@ -142,7 +142,7 @@ struct TMCCJPEGDecWork_t {
u8 mcuYRem; // 0x17FF u8 mcuYRem; // 0x17FF
u16 mcuYCount; // 0x1800 u16 mcuYCount; // 0x1800
u16 mcuXCount2; // 0x1802 u16 mcuXCount2; // 0x1802
u32 mcuTotal; // 0x1804 u32 unk_0x1804;
u8 remX; // 0x1808 u8 remX; // 0x1808
u8 remY; // 0x1809 u8 remY; // 0x1809
u8 compCount; // 0x180A u8 compCount; // 0x180A

View File

@@ -51,7 +51,7 @@ s32 TMCJPEGDEC_Setsize(TMCCJPEGDecWork* work) {
} }
state->componentCount = work->componentCount; state->componentCount = work->componentCount;
state->result = work->mcuTotal; state->result = work->unk_0x1804;
state->maxX = work->mcuYCount; state->maxX = work->mcuYCount;
state->maxY = work->mcuXCount2; state->maxY = work->mcuXCount2;

View File

@@ -567,7 +567,7 @@ s32 TMCJPEGDEC_scan_varinit(TMCCJPEGDecWork* work) {
p->mcuYCount = p->mcuYCount + ((u8)remX != 0 ? 1 : 0); p->mcuYCount = p->mcuYCount + ((u8)remX != 0 ? 1 : 0);
p->mcuXCount2 = p->mcuXCount2 + ((u8)remY != 0 ? 1 : 0); p->mcuXCount2 = p->mcuXCount2 + ((u8)remY != 0 ? 1 : 0);
p->mcuTotal = (u32)p->mcuYCount * (u32)p->mcuXCount2; p->unk_0x14 = (u32)p->mcuYCount * (u32)p->mcuXCount2;
for (idx = 0; idx < (s32)p->scanCompCount; idx++) { for (idx = 0; idx < (s32)p->scanCompCount; idx++) {
u8 compId; u8 compId;
@@ -1929,7 +1929,7 @@ static s32 TMCJPEGDEC_parse_sof(TMCCJPEGDecWork* work) {
mcuCountY += yr; mcuCountY += yr;
frameInfo->mcuYCount = mcuCountX; frameInfo->mcuYCount = mcuCountX;
frameInfo->mcuXCount2 = mcuCountY; frameInfo->mcuXCount2 = mcuCountY;
work->mcuTotal = (u32)mcuCountX * (u32)mcuCountY; work->unk_0x1804 = (u32)mcuCountX * (u32)mcuCountY;
} }
compCount2 = frameInfo->compCount; compCount2 = frameInfo->compCount;

View File

@@ -205,12 +205,12 @@ typedef struct _ziUwdNode {
struct __zi8_work_data_s { struct __zi8_work_data_s {
ziU8 unk_0x00; ziU8 unk_0x00;
ziU8 countOnly; // 0x01 ziU8 unk_0x01;
ziU8 unk_0x02[2]; ziU8 unk_0x02[2];
ziLanguageEntry* langEntries; // 0x04 ziLanguageEntry* langEntries; // 0x04
ziU8 unk_0x08; ziU8 unk_0x08;
ziU8 unk_0x09; ziU8 unk_0x09;
ziU8 maxWordLength; ziU8 unk_0x0A;
ziU8 unk_0x0B; ziU8 unk_0x0B;
ziU32 unk_0x0C; ziU32 unk_0x0C;
ziU32 unk_0x10; ziU32 unk_0x10;
@@ -265,25 +265,25 @@ struct __zi8_work_data_s {
ziPtr unk_0x11FC; ziPtr unk_0x11FC;
ziPtr userKeys[0x83]; // 0x1200 ziPtr userKeys[0x83]; // 0x1200
ziU8 unk_0x140C[4]; ziU8 unk_0x140C[4];
ziU32 formats; // 0x1410 ziU32 unk_0x1410;
ziU8 unk_0x1414[4]; ziU8 unk_0x1414[4];
ziU8 formatCount; ziU8 unk_0x1418;
ziU8 unk_0x1419; ziU8 unk_0x1419;
ziU16 capacity; // 0x141A ziU16 unk_0x141A;
ziU8 unk_0x141C; ziU8 unk_0x141C;
ziU8 unk_0x141D; ziU8 unk_0x141D;
ziU8 graphTableId; // 0x141E ziU8 unk_0x141E;
ziU8 maxCnt; // 0x141F ziU8 unk_0x141F;
ziU8 unk_0x1420[4]; ziU8 unk_0x1420[4];
zi8DawgCtx dawgCtx; // 0x1424 zi8DawgCtx dawgCtx; // 0x1424
ziU8 unk_0x1760[4]; // 0x1760 ziU8 unk_0x1760[4]; // 0x1760
ziU8* groupPtr; // 0x1764 ziU8* unk_0x1764; // 0x1764
ziU8 unk_0x1768; ziU8 unk_0x1768;
ziU8 unk_0x1769[0x81]; ziU8 unk_0x1769[0x81];
ziU16 matchOffset; // 0x17EA ziU16 unk_0x17EA;
ziU8 unk_0x17EC; ziU8 unk_0x17EC;
ziU8 unk_0x17ED[3]; ziU8 unk_0x17ED[3];
ziU8* dawgGroup; // 0x17F0 ziU8* unk_0x17F0;
ziWChar unk_0x17F4[0x40]; // 0x17F4..0x1874 ziWChar unk_0x17F4[0x40]; // 0x17F4..0x1874
ziU16 unk_0x1874; ziU16 unk_0x1874;
ziU8 unk_0x1876; ziU8 unk_0x1876;

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->graphTableId != 0 && graphTable == 0xc && if (ZI_WORK->unk_0x141E != 0 && graphTable == 0xc &&
Zi8GetTableSize(language, ZI_WORK->graphTableId, ZI_WORK) != 0) { Zi8GetTableSize(language, ZI_WORK->unk_0x141E, ZI_WORK) != 0) {
graphData = (ziU8*)Zi8GetTableAddress(language, ZI_WORK->graphTableId, ZI_WORK); graphData = (ziU8*)Zi8GetTableAddress(language, ZI_WORK->unk_0x141E, ZI_WORK);
keyTable = ZI_WORK->graphTableId + 1; keyTable = ZI_WORK->unk_0x141E + 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);
@@ -136,7 +136,7 @@ descend:
records[context->cnt].node = ZiDAWGGetChild(records[context->cnt - 1].node); records[context->cnt].node = ZiDAWGGetChild(records[context->cnt - 1].node);
if (records[context->cnt].node == (ziU8*)0) goto next_sibling; if (records[context->cnt].node == (ziU8*)0) goto next_sibling;
context->cnt++; context->cnt++;
if (ZI_WORK->maxCnt < context->cnt) ZI_WORK->maxCnt = context->cnt; if (ZI_WORK->unk_0x141F < context->cnt) ZI_WORK->unk_0x141F = context->cnt;
goto update_current; goto update_current;
next_sibling: next_sibling:
while (context->cnt != 0) { while (context->cnt != 0) {
@@ -184,36 +184,36 @@ unsigned int Zi8MatchROMdata1(ziWChar *elements, ziU8 count, ziU8 language, ziWC
result = 0; result = 0;
if (status == 0) { if (status == 0) {
ZI_WORK->groupPtr = (ziU8*)group; ZI_WORK->unk_0x1764 = (ziU8*)group;
if (ZI_WORK->groupPtr == 0) { if (ZI_WORK->unk_0x1764 == 0) {
if (Zi8GetTableSize(language & 0xff,0xb,ZI_WORK) != 0) { if (Zi8GetTableSize(language & 0xff,0xb,ZI_WORK) != 0) {
ZI_WORK->groupPtr = (ziU8*)(tableAddress = Zi8GetTableAddress(language & 0xff,0xb,ZI_WORK)); ZI_WORK->unk_0x1764 = (ziU8*)(tableAddress = Zi8GetTableAddress(language & 0xff,0xb,ZI_WORK));
} }
} }
if (ZI_WORK->groupPtr != 0) { if (ZI_WORK->unk_0x1764 != 0) {
for (; (*ZI_WORK->groupPtr != 0xff && ((groupIndex & 0xff) != 0)); for (; (*ZI_WORK->unk_0x1764 != 0xff && ((groupIndex & 0xff) != 0));
groupIndex = groupIndex - 1) { groupIndex = groupIndex - 1) {
while (*ZI_WORK->groupPtr != 0xff) { while (*ZI_WORK->unk_0x1764 != 0xff) {
ZI_WORK->groupPtr += 2; ZI_WORK->unk_0x1764 += 2;
} }
ZI_WORK->groupPtr++; ZI_WORK->unk_0x1764++;
} }
} }
} }
if (ZI_WORK->groupPtr == 0) { if (ZI_WORK->unk_0x1764 == 0) {
result = Zi8MatchROMdata0(elements,count,language & 0xff,output,capacity & 0xffff, result = Zi8MatchROMdata0(elements,count,language & 0xff,output,capacity & 0xffff,
mode & 0xff,status & 0xff,0,1,acceptPrefix,0,&ZI_WORK->dawgCtx, mode & 0xff,status & 0xff,0,1,acceptPrefix,0,&ZI_WORK->dawgCtx,
ZI_WORK->unk_0x1760,ZI_WORK); ZI_WORK->unk_0x1760,ZI_WORK);
} }
else { else {
while (*ZI_WORK->groupPtr != 0xff) { while (*ZI_WORK->unk_0x1764 != 0xff) {
result = Zi8MatchROMdata0(elements,count,language & 0xff,output, result = Zi8MatchROMdata0(elements,count,language & 0xff,output,
capacity & 0xffff,mode & 0xff,status & 0xff, capacity & 0xffff,mode & 0xff,status & 0xff,
*ZI_WORK->groupPtr, *ZI_WORK->unk_0x1764,
ZI_WORK->groupPtr[1],acceptPrefix,0, ZI_WORK->unk_0x1764[1],acceptPrefix,0,
&ZI_WORK->dawgCtx,ZI_WORK->unk_0x1760,ZI_WORK); &ZI_WORK->dawgCtx,ZI_WORK->unk_0x1760,ZI_WORK);
if ((result & 0xff) != 0) break; if ((result & 0xff) != 0) break;
ZI_WORK->groupPtr += 2; ZI_WORK->unk_0x1764 += 2;
status = 0; status = 0;
} }
} }
@@ -230,31 +230,31 @@ unsigned int Zi8MatchROMdata2(ziWChar* elements, ziU8 count, ziU8 language,
if (reservedMode != 0) return 0; if (reservedMode != 0) return 0;
if (status == 0) { if (status == 0) {
ZI_WORK->unk_0x1768 = 0; ZI_WORK->unk_0x1768 = 0;
ZI_WORK->matchOffset = 0; ZI_WORK->unk_0x17EA = 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->graphTableId = 0x10; ZI_WORK->unk_0x141E = 0x10;
} else { } else {
ZI_WORK->graphTableId = 0; ZI_WORK->unk_0x141E = 0;
} }
} }
search_segment: search_segment:
ZI_WORK->maxCnt = 1; ZI_WORK->unk_0x141F = 1;
result = Zi8MatchROMdata1(elements + ZI_WORK->matchOffset, result = Zi8MatchROMdata1(elements + ZI_WORK->unk_0x17EA,
count - ZI_WORK->matchOffset, language, count - ZI_WORK->unk_0x17EA, language,
&ZI_WORK->unk_0x17F4[ZI_WORK->matchOffset], capacity, &ZI_WORK->unk_0x17F4[ZI_WORK->unk_0x17EA], capacity,
mode, status, ZI_WORK->unk_0x1768, (char*)group, mode, status, ZI_WORK->unk_0x1768, (char*)group,
acceptPrefix, ZI_WORK); acceptPrefix, ZI_WORK);
if ((ziU8)result != 0) { if ((ziU8)result != 0) {
for (index = (ziU8)(ZI_WORK->matchOffset + result); index != 0; index--) { for (index = (ziU8)(ZI_WORK->unk_0x17EA + result); index != 0; index--) {
output[index - 1] = ZI_WORK->unk_0x17F4[index - 1]; output[index - 1] = ZI_WORK->unk_0x17F4[index - 1];
} }
result = (ziU8)(result + ZI_WORK->matchOffset); result = (ziU8)(result + ZI_WORK->unk_0x17EA);
} else { } else {
if (status != 0 || count == 1) goto finish_segments; if (status != 0 || count == 1) goto finish_segments;
if (mode == 1 && ZI_WORK->unk_0x1768 == 0 && if (mode == 1 && ZI_WORK->unk_0x1768 == 0 &&
(ziU8)Zi8MatchROMdata1(elements + ZI_WORK->matchOffset, (ziU8)Zi8MatchROMdata1(elements + ZI_WORK->unk_0x17EA,
count - ZI_WORK->matchOffset, language, count - ZI_WORK->unk_0x17EA, language,
&ZI_WORK->unk_0x17F4[ZI_WORK->matchOffset], capacity, &ZI_WORK->unk_0x17F4[ZI_WORK->unk_0x17EA], capacity,
0, status, ZI_WORK->unk_0x1768, (char*)group, 0, status, ZI_WORK->unk_0x1768, (char*)group,
acceptPrefix, ZI_WORK) != 0) goto finish_segments; acceptPrefix, ZI_WORK) != 0) goto finish_segments;
if ((Zi8GetTableCount(language, 0x1f, ZI_WORK) & 4) == 0) { if ((Zi8GetTableCount(language, 0x1f, ZI_WORK) & 4) == 0) {
@@ -262,25 +262,25 @@ search_segment:
if (elements[index] == 0xeff1) goto finish_segments; if (elements[index] == 0xeff1) goto finish_segments;
} }
} }
if (ZI_WORK->maxCnt > capacity) goto finish_segments; if (ZI_WORK->unk_0x141F > capacity) goto finish_segments;
for (index = ZI_WORK->maxCnt; index != 0; index--) { for (index = ZI_WORK->unk_0x141F; index != 0; index--) {
result = Zi8MatchROMdata1(elements + ZI_WORK->matchOffset, index, language, result = Zi8MatchROMdata1(elements + ZI_WORK->unk_0x17EA, index, language,
&ZI_WORK->unk_0x17F4[ZI_WORK->matchOffset], capacity, &ZI_WORK->unk_0x17F4[ZI_WORK->unk_0x17EA], capacity,
1, 0, ZI_WORK->unk_0x1768, (char*)group, 1, 0, ZI_WORK->unk_0x1768, (char*)group,
acceptPrefix, ZI_WORK); acceptPrefix, ZI_WORK);
if ((ziU8)result != 0) { if ((ziU8)result != 0) {
ZI_WORK->matchOffset += (ziU8)result; ZI_WORK->unk_0x17EA += (ziU8)result;
if (ZI_WORK->matchOffset == count) return 0; if (ZI_WORK->unk_0x17EA == count) return 0;
ZI_WORK->unk_0x1768++; ZI_WORK->unk_0x1768++;
status = 0; status = 0;
ZI_WORK->graphTableId = 0; ZI_WORK->unk_0x141E = 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->unk_0x17EA; 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->graphTableId = 0x10; ZI_WORK->unk_0x141E = 0x10;
goto search_segment; goto search_segment;
} }
} }
@@ -306,7 +306,7 @@ ziU32 Zi8MatchROMdata(ziWChar* elements, ziU8 count, ziU8 language,
} else { } else {
if (status == 0) { if (status == 0) {
ZI_WORK->unk_0x17EC = 0; ZI_WORK->unk_0x17EC = 0;
ZI_WORK->dawgGroup = NextDawgGroup(0, language, ZI_WORK); ZI_WORK->unk_0x17F0 = NextDawgGroup(0, language, ZI_WORK);
} else if (ZI_WORK->unk_0x17EC != 0) { } else if (ZI_WORK->unk_0x17EC != 0) {
Zi8LogError(100, ZI_WORK); Zi8LogError(100, ZI_WORK);
goto finish_match; goto finish_match;
@@ -316,30 +316,30 @@ ziU32 Zi8MatchROMdata(ziWChar* elements, ziU8 count, ziU8 language,
result = Zi8MatchROMdata2(elements, count, language, output, capacity, result = Zi8MatchROMdata2(elements, count, language, output, capacity,
mode, status, reservedMode, 0, acceptPrefix, ZI_WORK); mode, status, reservedMode, 0, acceptPrefix, ZI_WORK);
} else { } else {
while (ZI_WORK->dawgGroup != 0) { while (ZI_WORK->unk_0x17F0 != 0) {
result = Zi8MatchROMdata2(elements, count, language, output, capacity, result = Zi8MatchROMdata2(elements, count, language, output, capacity,
mode, status, reservedMode, ZI_WORK->dawgGroup, mode, status, reservedMode, ZI_WORK->unk_0x17F0,
acceptPrefix, ZI_WORK); acceptPrefix, ZI_WORK);
if ((ziU8)result != 0) break; if ((ziU8)result != 0) break;
status = 0; status = 0;
if (count <= 1 && language == 0x36) break; if (count <= 1 && language == 0x36) break;
ZI_WORK->dawgGroup = NextDawgGroup(ZI_WORK->dawgGroup, language, ZI_WORK); ZI_WORK->unk_0x17F0 = NextDawgGroup(ZI_WORK->unk_0x17F0, language, ZI_WORK);
} }
} }
if ((ziU8)result == 0 && status == 0 && mode == 1 && count == 1 && capacity >= 1) { if ((ziU8)result == 0 && status == 0 && mode == 1 && count == 1 && capacity >= 1) {
mode = 0; mode = 0;
ZI_WORK->unk_0x17EC = 1; ZI_WORK->unk_0x17EC = 1;
if (tableSize != 0) { if (tableSize != 0) {
ZI_WORK->dawgGroup = NextDawgGroup(0, language, ZI_WORK); ZI_WORK->unk_0x17F0 = NextDawgGroup(0, language, ZI_WORK);
while (ZI_WORK->dawgGroup != 0) { while (ZI_WORK->unk_0x17F0 != 0) {
if ((ziU8)Zi8MatchROMdata2(elements, count, language, output, capacity, if ((ziU8)Zi8MatchROMdata2(elements, count, language, output, capacity,
mode, status, reservedMode, ZI_WORK->dawgGroup, mode, status, reservedMode, ZI_WORK->unk_0x17F0,
acceptPrefix, ZI_WORK) != 0) { acceptPrefix, ZI_WORK) != 0) {
*output = *elements; *output = *elements;
result = 1; result = 1;
break; break;
} }
ZI_WORK->dawgGroup = NextDawgGroup(ZI_WORK->dawgGroup, language, ZI_WORK); ZI_WORK->unk_0x17F0 = NextDawgGroup(ZI_WORK->unk_0x17F0, language, ZI_WORK);
} }
} else { } else {
if ((ziU8)Zi8MatchROMdata2(elements, count, language, output, capacity, if ((ziU8)Zi8MatchROMdata2(elements, count, language, output, capacity,

View File

@@ -50,11 +50,11 @@ ziBool Zi8ZHsetZYfuzzyPairs(ziFuzzyZYPairs pairs ZI_NEED_WORK) {
ziBool Zi8SetLatinSearchOrder(ziU8* searchArray, ziU8 searchSize ZI_NEED_WORK) { ziBool Zi8SetLatinSearchOrder(ziU8* searchArray, ziU8 searchSize ZI_NEED_WORK) {
if (searchArray == 0 || *searchArray == 0) { if (searchArray == 0 || *searchArray == 0) {
ZI_WORK->formats = (ziU32)Zi8SOdefaultArray; ZI_WORK->unk_0x1410 = (ziU32)Zi8SOdefaultArray;
ZI_WORK->formatCount = 9; ZI_WORK->unk_0x1418 = 9;
} else { } else {
ZI_WORK->formats = (ziU32)searchArray; ZI_WORK->unk_0x1410 = (ziU32)searchArray;
ZI_WORK->formatCount = searchSize; ZI_WORK->unk_0x1418 = searchSize;
} }
return 1; return 1;
} }
@@ -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->maxWordLength = 0xff; ZI_WORK->unk_0x0A = 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->maxWordLength) length = ZI_WORK->maxWordLength; if (length > ZI_WORK->unk_0x0A) length = ZI_WORK->unk_0x0A;
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->maxWordLength) length = ZI_WORK->maxWordLength; if (length > ZI_WORK->unk_0x0A) length = ZI_WORK->unk_0x0A;
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->maxWordLength = 0xff; ZI_WORK->unk_0x0A = 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->maxWordLength = 0xff; ZI_WORK->unk_0x0A = 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->capacity; options.capacity = ZI_WORK->unk_0x141A;
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->capacity; options.capacity = ZI_WORK->unk_0x141A;
options.flags = 1; options.flags = 1;
return Zi8GetCandidatesOrCount(parameters, &options, ZI_WORK); return Zi8GetCandidatesOrCount(parameters, &options, ZI_WORK);
} }
@@ -339,11 +339,11 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option
if ((parameters->elementCount == 1) && (parameters->firstCandidate == 0)) { if ((parameters->elementCount == 1) && (parameters->firstCandidate == 0)) {
switch (parameters->language) { switch (parameters->language) {
case 1: case 1:
if ((ZI_WORK->unk_0x00 == '\0') || (ZI_WORK->countOnly == options->countOnly)) { if ((ZI_WORK->unk_0x00 == '\0') || (ZI_WORK->unk_0x01 == options->countOnly)) {
switch(ZI_WORK->unk_0x00) { switch(ZI_WORK->unk_0x00) {
case '\0': case '\0':
if (parameters->elements[0] == 0xEF04) { if (parameters->elements[0] == 0xEF04) {
ZI_WORK->countOnly = options->countOnly; ZI_WORK->unk_0x01 = options->countOnly;
ZI_WORK->unk_0x00 = '\x01'; ZI_WORK->unk_0x00 = '\x01';
} }
break; break;
@@ -400,11 +400,11 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option
break; break;
case 0x11: case 0x11:
default: default:
if ((ZI_WORK->unk_0x00 == '\0') || (ZI_WORK->countOnly == options->countOnly)) { if ((ZI_WORK->unk_0x00 == '\0') || (ZI_WORK->unk_0x01 == options->countOnly)) {
switch(ZI_WORK->unk_0x00) { switch(ZI_WORK->unk_0x00) {
case '\0': case '\0':
if (parameters->elements[0] == 0xEFF2) { if (parameters->elements[0] == 0xEFF2) {
ZI_WORK->countOnly = options->countOnly; ZI_WORK->unk_0x01 = options->countOnly;
ZI_WORK->unk_0x00 = '\x01'; ZI_WORK->unk_0x00 = '\x01';
} }
break; break;
@@ -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->maxWordLength; options->maxWordLength = ZI_WORK->unk_0x0A;
ZI_WORK->maxWordLength = -1; ZI_WORK->unk_0x0A = -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->maxWordLength = length; ZI_WORK->unk_0x0A = 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->maxWordLength = 0xFF; ZI_WORK->unk_0x0A = 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->capacity = 0x100; ZI_WORK->unk_0x141A = 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

@@ -45,8 +45,8 @@ ziBool Zi8IsWordW(ziWChar* word, ziU8 language ZI_NEED_WORK) {
ziWChar* cursor; ziWChar* cursor;
ziU8* data; ziU8* data;
ziU8 formats[8] = {1, 5, 0, 0, 0, 0, 0, 0}; ziU8 formats[8] = {1, 5, 0, 0, 0, 0, 0, 0};
ziU32 savedFormats = ZI_WORK->formats; ziU32 savedFormats = ZI_WORK->unk_0x1410;
ziU8 savedCount = ZI_WORK->formatCount; ziU8 savedCount = ZI_WORK->unk_0x1418;
ziSearchState search = {0}; ziSearchState search = {0};
Zi8LogError(100, __zi8_work_data); Zi8LogError(100, __zi8_work_data);
if (word == 0 || *word == 0) { if (word == 0 || *word == 0) {
@@ -73,22 +73,22 @@ ziBool Zi8IsWordW(ziWChar* word, ziU8 language ZI_NEED_WORK) {
request.candidates = ordinals; request.candidates = ordinals;
request.maxCandidates = 1; request.maxCandidates = 1;
request.firstCandidate = 0; request.firstCandidate = 0;
ZI_WORK->formats = (ziU32)formats; ZI_WORK->unk_0x1410 = (ziU32)formats;
if (ZI_WORK->unk_0x1C[0] == 2) { if (ZI_WORK->unk_0x1C[0] == 2) {
ZI_WORK->formatCount = 0; ZI_WORK->unk_0x1418 = 0;
if (ZI_WORK->unk_0x09 & 1) formats[ZI_WORK->formatCount++] = 1; if (ZI_WORK->unk_0x09 & 1) formats[ZI_WORK->unk_0x1418++] = 1;
if (ZI_WORK->unk_0x09 & 4) formats[ZI_WORK->formatCount++] = 2; if (ZI_WORK->unk_0x09 & 4) formats[ZI_WORK->unk_0x1418++] = 2;
if (ZI_WORK->unk_0x09 & 2) formats[ZI_WORK->formatCount++] = 3; if (ZI_WORK->unk_0x09 & 2) formats[ZI_WORK->unk_0x1418++] = 3;
if (ZI_WORK->unk_0x09 & 8) formats[ZI_WORK->formatCount++] = 4; if (ZI_WORK->unk_0x09 & 8) formats[ZI_WORK->unk_0x1418++] = 4;
if (ZI_WORK->unk_0x09 & 1) formats[ZI_WORK->formatCount++] = 5; if (ZI_WORK->unk_0x09 & 1) formats[ZI_WORK->unk_0x1418++] = 5;
if (ZI_WORK->unk_0x09 & 4) formats[ZI_WORK->formatCount++] = 6; if (ZI_WORK->unk_0x09 & 4) formats[ZI_WORK->unk_0x1418++] = 6;
if (ZI_WORK->unk_0x09 & 2) formats[ZI_WORK->formatCount++] = 7; if (ZI_WORK->unk_0x09 & 2) formats[ZI_WORK->unk_0x1418++] = 7;
if (ZI_WORK->unk_0x09 & 8) formats[ZI_WORK->formatCount++] = 8; if (ZI_WORK->unk_0x09 & 8) formats[ZI_WORK->unk_0x1418++] = 8;
} else if (ZI_WORK->unk_0x1C[0] != 0) ZI_WORK->formatCount = 2; } else if (ZI_WORK->unk_0x1C[0] != 0) ZI_WORK->unk_0x1418 = 2;
else ZI_WORK->formatCount = 1; else ZI_WORK->unk_0x1418 = 1;
count = Zi8GetCandidatesOrCount(&request, &search, __zi8_work_data); count = Zi8GetCandidatesOrCount(&request, &search, __zi8_work_data);
ZI_WORK->formats = savedFormats; ZI_WORK->unk_0x1410 = savedFormats;
ZI_WORK->formatCount = savedCount; ZI_WORK->unk_0x1418 = savedCount;
if (count != 0) return 1; if (count != 0) return 1;
} }
if (language != 1) { if (language != 1) {

View File

@@ -242,8 +242,8 @@ typedef struct WPADCB {
WPADCallback getInfoCB; // 0x988 WPADCallback getInfoCB; // 0x988
u8 getInfoBusy; // 0x98C u8 getInfoBusy; // 0x98C
u8 encStatus; // 0x98D u8 unk_0x98D; // 0x98D
u8 continuous; // 0x98E u8 unk_0x98E; // 0x98E
u8 unk_0x98F[0x9A0 - 0x990]; u8 unk_0x98F[0x9A0 - 0x990];
} WPADCB; } WPADCB;
@@ -261,7 +261,7 @@ void WPADiExcludeButton(s32 chan);
void WPADiCopyOut(s32 chan); void WPADiCopyOut(s32 chan);
BOOL WPADiSendSetPort(WPADCommandQueue* pQueue, u8 port, WPADCallback pCallback); BOOL WPADiSendSetPort(WPADCommandQueue* pQueue, u8 port, WPADCallback pCallback);
BOOL WPADiSendSetReportType(WPADCommandQueue* pQueue, s32 format, BOOL continuous, WPADCallback pCallback); BOOL WPADiSendSetReportType(WPADCommandQueue* pQueue, s32 format, BOOL unk, WPADCallback pCallback);
BOOL WPADiSendEnableDPD(WPADCommandQueue* pQueue, BOOL enable, WPADCallback pCallback); BOOL WPADiSendEnableDPD(WPADCommandQueue* pQueue, BOOL enable, WPADCallback pCallback);
BOOL WPADiSendEnableSpeaker(WPADCommandQueue* pQueue, BOOL enable, WPADCallback pCallback); BOOL WPADiSendEnableSpeaker(WPADCommandQueue* pQueue, BOOL enable, WPADCallback pCallback);
BOOL WPADiSendGetContStat(WPADCommandQueue* pQueue, WPADInfo* pInfo, WPADCallback pCallback); BOOL WPADiSendGetContStat(WPADCommandQueue* pQueue, WPADInfo* pInfo, WPADCallback pCallback);

View File

@@ -24,7 +24,7 @@ typedef struct WPADMemBlock {
int unk_0x04; // 0x04 int unk_0x04; // 0x04
s16 unk_0x08; // 0x08 s16 unk_0x08; // 0x08
int unk_0x0C; // 0x0C int unk_0x0C; // 0x0C
WPADCallback callback; // 0x10 WPADCallback unk_0x10; // 0x10
} WPADMemBlock; } WPADMemBlock;
typedef struct WPADGameInfo { typedef struct WPADGameInfo {

View File

@@ -1283,7 +1283,7 @@ static void __ClearControlBlock(s32 chan) {
p->sleeping = TRUE; p->sleeping = TRUE;
p->getInfoBusy = FALSE; p->getInfoBusy = FALSE;
p->getInfoCB = NULL; p->getInfoCB = NULL;
p->continuous = 0; p->unk_0x98E = 0;
memset(&p->wpInfo, 0, sizeof(p->wpInfo)); memset(&p->wpInfo, 0, sizeof(p->wpInfo));
memset(&p->wmReadDataBuf, 0, sizeof(p->wmReadDataBuf)); memset(&p->wmReadDataBuf, 0, sizeof(p->wmReadDataBuf));
@@ -1315,7 +1315,7 @@ static void __ClearControlBlock(s32 chan) {
_wmb[chan].unk_0x04 = 0; _wmb[chan].unk_0x04 = 0;
_wmb[chan].unk_0x08 = 0; _wmb[chan].unk_0x08 = 0;
_wmb[chan].unk_0x0C = 0; _wmb[chan].unk_0x0C = 0;
_wmb[chan].callback = NULL; _wmb[chan].unk_0x10 = NULL;
_rumbleCnt[chan] = 0; _rumbleCnt[chan] = 0;
} }
@@ -1551,7 +1551,7 @@ static void firmwareCheckCallback(s32 chan, s32 status) {
DEBUGPrint(" ==>this error means that the firmware is for NDEV %s\n", p->configIndex != 0 ? "2.0" : "2.1 or later"); DEBUGPrint(" ==>this error means that the firmware is for NDEV %s\n", p->configIndex != 0 ? "2.0" : "2.1 or later");
WPADiSendSetReportType(&p->stdCmdQueue, WPAD_FMT_CORE_BTN, p->continuous, &abortConnCallback); WPADiSendSetReportType(&p->stdCmdQueue, WPAD_FMT_CORE_BTN, p->unk_0x98E, &abortConnCallback);
WPADiSendDPDCSB(&p->stdCmdQueue, FALSE, &abortConnCallback); WPADiSendDPDCSB(&p->stdCmdQueue, FALSE, &abortConnCallback);
WPADiSendSetPort(&p->stdCmdQueue, port, &abortConnCallback); WPADiSendSetPort(&p->stdCmdQueue, port, &abortConnCallback);
@@ -1626,7 +1626,7 @@ static void WPADiConnCallback(WUDDevInfo* devInfo, u8 open) {
p->status = WPAD_ERR_OK; p->status = WPAD_ERR_OK;
p->radioSensitivity = 100; p->radioSensitivity = 100;
p->sleeping = FALSE; p->sleeping = FALSE;
p->encStatus = FALSE; p->unk_0x98D = FALSE;
WPADiSendReadData(&p->stdCmdQueue, p->wmReadDataBuf, 1, WM_ADDR_MEM_1770, firmwareCheckCallback); WPADiSendReadData(&p->stdCmdQueue, p->wmReadDataBuf, 1, WM_ADDR_MEM_1770, firmwareCheckCallback);
@@ -1643,8 +1643,8 @@ static void WPADiConnCallback(WUDDevInfo* devInfo, u8 open) {
if (p->cmdBlkCB != NULL) { if (p->cmdBlkCB != NULL) {
p->cmdBlkCB(chan, WPAD_ERR_NO_CONTROLLER); p->cmdBlkCB(chan, WPAD_ERR_NO_CONTROLLER);
} else if (_wmb[chan].callback != NULL) { } else if (_wmb[chan].unk_0x10 != NULL) {
_wmb[chan].callback(chan, WPAD_ERR_NO_CONTROLLER); _wmb[chan].unk_0x10(chan, WPAD_ERR_NO_CONTROLLER);
} }
do { do {
@@ -1886,7 +1886,7 @@ s32 WPADSetDataFormat(s32 chan, u32 format) {
} }
if (currFormat != format) { if (currFormat != format) {
if (!WPADiSendSetReportType(&p->stdCmdQueue, format, p->continuous, NULL)) { if (!WPADiSendSetReportType(&p->stdCmdQueue, format, p->unk_0x98E, NULL)) {
status = WPAD_ERR_COMMUNICATION_ERROR; status = WPAD_ERR_COMMUNICATION_ERROR;
} else { } else {
enabled = OSDisableInterrupts(); enabled = OSDisableInterrupts();
@@ -2741,13 +2741,13 @@ BOOL WPADiSendSetPort(WPADCommandQueue* pQueue, u8 port, WPADCallback pCallback)
return success; return success;
} }
BOOL WPADiSendSetReportType(WPADCommandQueue* pQueue, s32 format, BOOL continuous, WPADCallback pCallback) { BOOL WPADiSendSetReportType(WPADCommandQueue* pQueue, s32 format, BOOL unk, WPADCallback pCallback) {
BOOL success; BOOL success;
WPADCommand command; WPADCommand command;
command.reportID = RPTID_SET_DATA_REPORT_MODE; command.reportID = RPTID_SET_DATA_REPORT_MODE;
command.dataLength = RPT12_SIZE; command.dataLength = RPT12_SIZE;
command.dataBuf[RPT12_CONT_REPORT] = continuous ? 0 : 4; // Always continuous reporting command.dataBuf[RPT12_CONT_REPORT] = unk ? 0 : 4; // Always continuous reporting
command.cmdCB = pCallback; command.cmdCB = pCallback;
switch (format) { switch (format) {

View File

@@ -111,8 +111,8 @@ static void initExtension(s32 chan) {
WPADiClearQueue(&p_wpd->extCmdQueue); WPADiClearQueue(&p_wpd->extCmdQueue);
WPADiSendSetReportType(&p_wpd->extCmdQueue, p_wpd->dataFormat, WPADiSendSetReportType(&p_wpd->extCmdQueue, p_wpd->dataFormat,
p_wpd->continuous, abortInitExtension); p_wpd->unk_0x98E, abortInitExtension);
p_wpd->encStatus = 1; p_wpd->unk_0x98D = 1;
WPADiSendWriteDataCmd(&p_wpd->extCmdQueue, 0x55, 0x04a400f0, WPADiSendWriteDataCmd(&p_wpd->extCmdQueue, 0x55, 0x04a400f0,
abortInitExtension); abortInitExtension);
WPADiSendWriteDataCmd(&p_wpd->extCmdQueue, 0, 0x04a400fb, WPADiSendWriteDataCmd(&p_wpd->extCmdQueue, 0, 0x04a400fb,
@@ -127,7 +127,7 @@ static void abortInitExtension(s32 chan, s32 result) {
if (result != WPAD_ERR_NONE) { if (result != WPAD_ERR_NONE) {
WPADiClearQueue(&p_wpd->extCmdQueue); WPADiClearQueue(&p_wpd->extCmdQueue);
p_wpd->encStatus = 0; p_wpd->unk_0x98D = 0;
if (result == WPAD_ERR_NO_CONTROLLER) { if (result == WPAD_ERR_NO_CONTROLLER) {
type = WPAD_DEV_NOT_FOUND; type = WPAD_DEV_NOT_FOUND;
} }
@@ -142,7 +142,7 @@ static void abortInitExtension(s32 chan, s32 result) {
else { else {
DEBUGPrint("detaching extension during initialization.\n"); DEBUGPrint("detaching extension during initialization.\n");
WPADiSendSetReportType(&p_wpd->extCmdQueue, p_wpd->dataFormat, p_wpd->continuous, NULL); WPADiSendSetReportType(&p_wpd->extCmdQueue, p_wpd->dataFormat, p_wpd->unk_0x98E, NULL);
return; return;
} }
p_wpd->devType = (u8)type; p_wpd->devType = (u8)type;
@@ -509,7 +509,7 @@ static void getExtType(s32 chan, s32 result) {
} }
} else { } else {
if (isExtEncMain(_devType[chan])) { if (isExtEncMain(_devType[chan])) {
p_wpd->encStatus = 2; p_wpd->unk_0x98D = 2;
WPADiSendWriteDataCmd(cmdq, 0xAA, 0x4A400F0, abortInitExtension); WPADiSendWriteDataCmd(cmdq, 0xAA, 0x4A400F0, abortInitExtension);
WPADiCreateKey(chan); WPADiCreateKey(chan);
WPADiSendWriteData(cmdq, p_wpd->encryptionKey, 6, 0x4A40040, abortInitExtension); WPADiSendWriteData(cmdq, p_wpd->encryptionKey, 6, 0x4A40040, abortInitExtension);
@@ -517,7 +517,7 @@ static void getExtType(s32 chan, s32 result) {
WPADiSendWriteData(cmdq, p_wpd->encryptionKey + 12, 4, 0x4A4004C, abortInitExtension); WPADiSendWriteData(cmdq, p_wpd->encryptionKey + 12, 4, 0x4A4004C, abortInitExtension);
WPADiSendReadData(cmdq, p_wpd->wmReadDataBuf, 32, 0x4A40020, p_wpd->extensionCB); WPADiSendReadData(cmdq, p_wpd->wmReadDataBuf, 32, 0x4A40020, p_wpd->extensionCB);
} else { } else {
p_wpd->encStatus = 3; p_wpd->unk_0x98D = 3;
WPADiSendWriteDataCmd(cmdq, 0xAA, 0x4A400F0, abortInitExtension); WPADiSendWriteDataCmd(cmdq, 0xAA, 0x4A400F0, abortInitExtension);
WPADiCreateKeyFor3rd(chan); WPADiCreateKeyFor3rd(chan);
WPADiSendWriteData(cmdq, p_wpd->encryptionKey, 6, 0x4A40040, abortInitExtension); WPADiSendWriteData(cmdq, p_wpd->encryptionKey, 6, 0x4A40040, abortInitExtension);
@@ -651,7 +651,7 @@ void __a1_20_status_report(u8 chan, u8* data) {
p_wpd->devMode = 0; p_wpd->devMode = 0;
WPADiClearQueue(&p_wpd->extCmdQueue); WPADiClearQueue(&p_wpd->extCmdQueue);
WPADiSendSetReportType(&p_wpd->extCmdQueue, p_wpd->dataFormat, p_wpd->continuous, NULL); WPADiSendSetReportType(&p_wpd->extCmdQueue, p_wpd->dataFormat, p_wpd->unk_0x98E, NULL);
if (attach) { if (attach) {
if (p_wpd->extensionCB) { if (p_wpd->extensionCB) {
@@ -741,11 +741,11 @@ void __a1_21_user_data(u8 chan, u8* data) {
DEBUGPrint("length : %d\n", p_wpd->wmReadLength); DEBUGPrint("length : %d\n", p_wpd->wmReadLength);
status = (p_wpd->wmReadHadError < 0) ? WPAD_ERR_TRANSFER : 0; status = (p_wpd->wmReadHadError < 0) ? WPAD_ERR_TRANSFER : 0;
DEBUGPrint("i2c = %04x\n", i2c); DEBUGPrint("i2c = %04x\n", i2c);
DEBUGPrint("enc = %d\n", p_wpd->encStatus); DEBUGPrint("enc = %d\n", p_wpd->unk_0x98D);
if (i2c == 0x04a4) { if (i2c == 0x04a4) {
DEBUGPrint("Access to extension register.\n"); DEBUGPrint("Access to extension register.\n");
if (p_wpd->encStatus == 2 || p_wpd->encStatus == 3) { if (p_wpd->unk_0x98D == 2 || p_wpd->unk_0x98D == 3) {
DEBUGPrint("Decode!!!!\n"); DEBUGPrint("Decode!!!!\n");
DEBUGPrint(" len = %d, addr = %04x\n", len, base); DEBUGPrint(" len = %d, addr = %04x\n", len, base);

View File

@@ -19,7 +19,7 @@ typedef struct _CDBRecordFile {
#else #else
u8 unk_0x00[0x1C - 0x00]; u8 unk_0x00[0x1C - 0x00];
#endif #endif
int allocFlag; // 0x1C int unk_0x1C;
CDBAttr attr; // 0x20 CDBAttr attr; // 0x20
CDBBridgeFile bridgeFile; // 0x42C CDBBridgeFile bridgeFile; // 0x42C
u8 unk_0x434[0x438 - 0x434]; u8 unk_0x434[0x438 - 0x434];

View File

@@ -24,7 +24,7 @@ typedef struct NWC24MsgObjPrivate {
#ifdef NWC24_MSG_READ #ifdef NWC24_MSG_READ
u32 headerSize; u32 headerSize;
#elif defined(NWC24_MBOX_CTRL) || defined(NWC24_MSG_COMMIT) #elif defined(NWC24_MBOX_CTRL) || defined(NWC24_MSG_COMMIT)
u32 headerSize; // 0x10 u32 unk_0x10;
#else #else
u8 unk_0x10[0x4]; u8 unk_0x10[0x4];
#endif #endif
@@ -46,8 +46,8 @@ typedef struct NWC24MsgObjPrivate {
#endif #endif
u32 date; // 0x28 u32 date; // 0x28
u32 receivedDate; // 0x2C u32 receivedDate; // 0x2C
NWC24Data fromData; // 0x30 NWC24Data unk_0x30;
NWC24Data toData; // 0x38 NWC24Data unk_0x38;
NWC24Data subject; // 0x40 NWC24Data subject; // 0x40
NWC24Data text; // 0x48 NWC24Data text; // 0x48
NWC24Data unk_0x50; NWC24Data unk_0x50;
@@ -73,7 +73,7 @@ typedef struct NWC24MsgObjPrivate {
}; };
u32 raw; u32 raw;
} msgBoardFlags; // 0xCC } msgBoardFlags; // 0xCC
NWC24Data extraData; // 0xD0 NWC24Data unk_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 sendMbcHeader[128]; // 0x1700 u8 unk_0x1700[128]; // 0x1700
u8 recvMbcHeader[128]; // 0x1780 u8 unk_0x1780[128]; // 0x1780
u8 mbcEntry[256]; // 0x1800 u8 unk_0x1800[256]; // 0x1800
u8 base64Work[256]; // 0x1900 u8 base64Work[256]; // 0x1900
u8 unk_0x1A00[4096]; // 0x1A00 u8 unk_0x1A00[4096]; // 0x1A00

View File

@@ -57,7 +57,7 @@ void CDBRecordInstanceInit(CDBRecordFile* recordFile, CDBRecord* record, int typ
OSLockMutex((OSMutex*)recordFile); OSLockMutex((OSMutex*)recordFile);
recordFile->used = 1; recordFile->used = 1;
OSUnlockMutex((OSMutex*)recordFile); OSUnlockMutex((OSMutex*)recordFile);
recordFile->allocFlag = type; recordFile->unk_0x1C = type;
recordFile->database = record->unk_0x00; recordFile->database = record->unk_0x00;
CDBAttrInit(&recordFile->attr); CDBAttrInit(&recordFile->attr);
CDBRecordKeyCopy(&recordFile->key, &record->key); CDBRecordKeyCopy(&recordFile->key, &record->key);
@@ -310,7 +310,7 @@ CDBErr CDBRecordWrite_(CDBRecord* record, void* buffer, u32 size) {
CDBReportError("can't write data in the record; the record is closed\n"); CDBReportError("can't write data in the record; the record is closed\n");
return CDB_ERROR_27; return CDB_ERROR_27;
} }
if ((recordFile->allocFlag & 2) == 0) { if ((recordFile->unk_0x1C & 2) == 0) {
CDBReportError("can't write data in the record; the record is opened as READONLY\n"); CDBReportError("can't write data in the record; the record is opened as READONLY\n");
return CDB_ERROR_27; return CDB_ERROR_27;
} }
@@ -687,7 +687,7 @@ CDBErr CDBRecordEncrypt(CDBRecord* record, void* buffer, CDBRecordKey* key, u32
if ((s32)recordFile == 0) { if ((s32)recordFile == 0) {
return CDB_ERROR_27; return CDB_ERROR_27;
} }
if (recordFile->allocFlag == 1) { if (recordFile->unk_0x1C == 1) {
return CDB_ERROR_26; return CDB_ERROR_26;
} }
if ((s32)buffer == 0) { if ((s32)buffer == 0) {
@@ -699,7 +699,7 @@ CDBErr CDBRecordEncrypt(CDBRecord* record, void* buffer, CDBRecordKey* key, u32
tempFile = record->file; tempFile = record->file;
if ((s32)tempFile == 0) { if ((s32)tempFile == 0) {
result = CDB_ERROR_27; result = CDB_ERROR_27;
} else if (tempFile->allocFlag == 1) { } else if (tempFile->unk_0x1C == 1) {
result = CDB_ERROR_26; result = CDB_ERROR_26;
} else { } else {
CDBAttrSetWiiId(&tempFile->attr, CDBGetWiiId()); CDBAttrSetWiiId(&tempFile->attr, CDBGetWiiId());
@@ -713,7 +713,7 @@ CDBErr CDBRecordEncrypt(CDBRecord* record, void* buffer, CDBRecordKey* key, u32
CDBErr result; CDBErr result;
if ((s32)record->file == 0) { if ((s32)record->file == 0) {
result = CDB_ERROR_27; result = CDB_ERROR_27;
} else if (((CDBRecordFile*)record->file)->allocFlag == 1) { } else if (((CDBRecordFile*)record->file)->unk_0x1C == 1) {
result = CDB_ERROR_26; result = CDB_ERROR_26;
} else { } else {
CDBAttrInitIV(&((CDBRecordFile*)record->file)->attr); CDBAttrInitIV(&((CDBRecordFile*)record->file)->attr);
@@ -727,7 +727,7 @@ CDBErr CDBRecordEncrypt(CDBRecord* record, void* buffer, CDBRecordKey* key, u32
CDBErr result; CDBErr result;
if ((s32)record->file == 0) { if ((s32)record->file == 0) {
result = CDB_ERROR_27; result = CDB_ERROR_27;
} else if (((CDBRecordFile*)record->file)->allocFlag == 1) { } else if (((CDBRecordFile*)record->file)->unk_0x1C == 1) {
result = CDB_ERROR_26; result = CDB_ERROR_26;
} else { } else {
CDBAttrSetKeyStr(&((CDBRecordFile*)record->file)->attr, key); CDBAttrSetKeyStr(&((CDBRecordFile*)record->file)->attr, key);

View File

@@ -265,7 +265,7 @@ CDBErr CDBRecordFree(CDBRecord* record) {
OSLockMutex((OSMutex*)recordFile); OSLockMutex((OSMutex*)recordFile);
*(u32*)&recordFile->unk_0x00[0x18] = 0; *(u32*)&recordFile->unk_0x00[0x18] = 0;
OSUnlockMutex((OSMutex*)recordFile); OSUnlockMutex((OSMutex*)recordFile);
recordFile->allocFlag = 0; recordFile->unk_0x1C = 0;
record->file = NULL; record->file = NULL;
OSUnlockMutex(&s_mutex); OSUnlockMutex(&s_mutex);
} }

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->mbcEntry; entry = (MBCEntry*)NWC24WorkP->unk_0x1800;
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->mbcEntry; entry = (MBCEntry*)NWC24WorkP->unk_0x1800;
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->sendMbcHeader, 0, 128); Mail_memset(NWC24WorkP->unk_0x1700, 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->recvMbcHeader, 0, 128); Mail_memset(NWC24WorkP->unk_0x1780, 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->sendMbcHeader, 0, 128); Mail_memset(NWC24WorkP->unk_0x1700, 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->recvMbcHeader, 0, 128); Mail_memset(NWC24WorkP->unk_0x1780, 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->mbcEntry; entry = (MBCEntry*)NWC24WorkP->unk_0x1800;
if (type == NWC24_MBOX_TYPE_SEND) if (type == NWC24_MBOX_TYPE_SEND)
header = (MBCHeader*)NWC24WorkP->sendMbcHeader; header = (MBCHeader*)NWC24WorkP->unk_0x1700;
else if (type == NWC24_MBOX_TYPE_RECV) else if (type == NWC24_MBOX_TYPE_RECV)
header = (MBCHeader*)NWC24WorkP->recvMbcHeader; header = (MBCHeader*)NWC24WorkP->unk_0x1780;
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->mbcEntry; entry = (MBCEntry*)NWC24WorkP->unk_0x1800;
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->mbcEntry; entry = (MBCEntry*)NWC24WorkP->unk_0x1800;
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;
@@ -783,7 +783,7 @@ static NWC24Err DuplicationCheck(MBCHeader* header, const NWC24MsgObjPrivate* ms
continue; continue;
} }
if (msg->unk_0x1C != 0 && entry->crc == msg->unk_0x1C && entry->type == msg->type && entry->length == msg->length && if (msg->unk_0x1C != 0 && entry->crc == msg->unk_0x1C && entry->type == msg->type && entry->length == msg->length &&
entry->flags == msg->headerSize && (s32)entry->date == (s32)msg->date) { entry->flags == msg->unk_0x10 && (s32)entry->date == (s32)msg->date) {
duplicateId = entry->msgId; duplicateId = entry->msgId;
duplicateOffset = offset; duplicateOffset = offset;
continue; continue;
@@ -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->sendMbcHeader; *header = (MBCHeader*)NWC24WorkP->unk_0x1700;
else if (type == NWC24_MBOX_TYPE_RECV) else if (type == NWC24_MBOX_TYPE_RECV)
*header = (MBCHeader*)NWC24WorkP->recvMbcHeader; *header = (MBCHeader*)NWC24WorkP->unk_0x1780;
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->mbcEntry; MBCEntry* entry = (MBCEntry*)NWC24WorkP->unk_0x1800;
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->mbcEntry; MBCEntry* entry = (MBCEntry*)NWC24WorkP->unk_0x1800;
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;
@@ -947,8 +947,8 @@ static NWC24Err MountVFMBox(NWC24MBoxType type) {
} }
static NWC24Err CopyMsgObjToMBCFmt(const NWC24MsgObjPrivate* msg, MBCEntry* entry) { static NWC24Err CopyMsgObjToMBCFmt(const NWC24MsgObjPrivate* msg, MBCEntry* entry) {
u32 field1 = ((u32)msg->fromData.ptr & 0xFFFFF) | (msg->fromData.size << 20); u32 field1 = ((u32)msg->unk_0x30.ptr & 0xFFFFF) | (msg->unk_0x30.size << 20);
u32 field2 = ((u32)msg->toData.ptr & 0xFFFFF) | (msg->toData.size << 20); u32 field2 = ((u32)msg->unk_0x38.ptr & 0xFFFFF) | (msg->unk_0x38.size << 20);
u32 field3 = ((u32)msg->subject.ptr & 0xFFFFF) | (msg->subject.size << 20); u32 field3 = ((u32)msg->subject.ptr & 0xFFFFF) | (msg->subject.size << 20);
u32 field4 = ((u32)msg->unk_0x50.ptr & 0xFFFFF) | (msg->unk_0x50.size << 20); u32 field4 = ((u32)msg->unk_0x50.ptr & 0xFFFFF) | (msg->unk_0x50.size << 20);
u32 field5 = ((u32)msg->unk_0x58.ptr & 0xFFFFF) | (msg->unk_0x58.size << 20); u32 field5 = ((u32)msg->unk_0x58.ptr & 0xFFFFF) | (msg->unk_0x58.size << 20);
@@ -956,7 +956,7 @@ static NWC24Err CopyMsgObjToMBCFmt(const NWC24MsgObjPrivate* msg, MBCEntry* entr
entry->type = msg->type; entry->type = msg->type;
entry->length = msg->length; entry->length = msg->length;
entry->appId = msg->appId; entry->appId = msg->appId;
entry->flags = msg->headerSize; entry->flags = msg->unk_0x10;
entry->tag = msg->tag; entry->tag = msg->tag;
entry->ledPattern = msg->ledPattern; entry->ledPattern = msg->ledPattern;
entry->crc = msg->unk_0x1C; entry->crc = msg->unk_0x1C;
@@ -1003,7 +1003,7 @@ static NWC24Err CopyMsgObjToPrvFmt(const MBCEntry* entry, NWC24MsgObjPrivate* ms
msg->type = entry->type; msg->type = entry->type;
msg->length = entry->length; msg->length = entry->length;
msg->appId = entry->appId; msg->appId = entry->appId;
msg->headerSize = entry->flags; msg->unk_0x10 = entry->flags;
msg->tag = entry->tag; msg->tag = entry->tag;
msg->ledPattern = entry->ledPattern; msg->ledPattern = entry->ledPattern;
msg->unk_0x1C = entry->crc; msg->unk_0x1C = entry->crc;
@@ -1019,10 +1019,10 @@ static NWC24Err CopyMsgObjToPrvFmt(const MBCEntry* entry, NWC24MsgObjPrivate* ms
msg->textSize = entry->textSize; msg->textSize = entry->textSize;
msg->dwcId = entry->dwcId; msg->dwcId = entry->dwcId;
msg->iconNew = entry->iconNew; msg->iconNew = entry->iconNew;
msg->fromData.ptr = (void*)offset1; msg->unk_0x30.ptr = (void*)offset1;
msg->fromData.size = size1; msg->unk_0x30.size = size1;
msg->toData.ptr = (void*)offset2; msg->unk_0x38.ptr = (void*)offset2;
msg->toData.size = size2; msg->unk_0x38.size = size2;
msg->subject.ptr = (void*)offset3; msg->subject.ptr = (void*)offset3;
msg->subject.size = size3; msg->subject.size = size3;
msg->unk_0x50.ptr = (void*)offset4; msg->unk_0x50.ptr = (void*)offset4;

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->extraData.size == 0) if (msg->unk_0xD0.size == 0)
return NWC24_OK; return NWC24_OK;
err = NWC24FWrite(msg->extraData.ptr, msg->extraData.size, m_pFile); err = NWC24FWrite(msg->unk_0xD0.ptr, msg->unk_0xD0.size, m_pFile);
if (err == NWC24_OK) if (err == NWC24_OK)
msg->length += msg->extraData.size; msg->length += msg->unk_0xD0.size;
return err; return err;
} }
@@ -330,7 +330,7 @@ static NWC24Err NWC24CommitMsgInternal(NWC24MsgObjPrivate* msg, NWC24MBoxType ty
} }
CHECK_WRITE(WriteString(msg, buffer)); CHECK_WRITE(WriteString(msg, buffer));
if (msg->type & 0x10000) { if (msg->type & 0x10000) {
msg->headerSize = msg->length; msg->unk_0x10 = msg->length;
buffer = NWC24WorkP->stringWork; buffer = NWC24WorkP->stringWork;
Mail_memset(buffer, 0, 1024); Mail_memset(buffer, 0, 1024);
Mail_sprintf(buffer, "\r\n--%s", MultiPartDivider); Mail_sprintf(buffer, "\r\n--%s", MultiPartDivider);
@@ -339,7 +339,7 @@ static NWC24Err NWC24CommitMsgInternal(NWC24MsgObjPrivate* msg, NWC24MBoxType ty
} }
CHECK_WRITE(WriteContentTypeField(msg)); CHECK_WRITE(WriteContentTypeField(msg));
if (!(msg->type & 0x10000)) if (!(msg->type & 0x10000))
msg->headerSize = msg->length; msg->unk_0x10 = msg->length;
text.ptr = (const void*)msg->length; text.ptr = (const void*)msg->length;
{ NWC24Err textResult = WritePlainText(msg); { NWC24Err textResult = WritePlainText(msg);
err = textResult == NWC24_ERR_NULL ? NWC24_OK : textResult; } err = textResult == NWC24_ERR_NULL ? NWC24_OK : textResult; }
@@ -577,7 +577,7 @@ static NWC24Err WriteFromField(NWC24MsgObjPrivate* msg) {
Mail_memset(buffer, 0, 1024); Mail_memset(buffer, 0, 1024);
Mail_strncat(buffer, "From: ", 1022); Mail_strncat(buffer, "From: ", 1022);
address = buffer + 6; address = buffer + 6;
msg->fromData.ptr = (const void*)(msg->length + 6); msg->unk_0x30.ptr = (const void*)(msg->length + 6);
type = 1; type = 1;
if (msg->type & 0x100000) if (msg->type & 0x100000)
type = 2; type = 2;
@@ -596,7 +596,7 @@ static NWC24Err WriteFromField(NWC24MsgObjPrivate* msg) {
err = NWC24FWrite(NWC24WorkP->stringWork, total, m_pFile); err = NWC24FWrite(NWC24WorkP->stringWork, total, m_pFile);
if (err == NWC24_OK) { if (err == NWC24_OK) {
msg->length += total; msg->length += total;
msg->fromData.size = msg->length - (u32)msg->fromData.ptr - 2; msg->unk_0x30.size = msg->length - (u32)msg->unk_0x30.ptr - 2;
} }
} }
return err; return err;
@@ -612,7 +612,7 @@ static NWC24Err WriteToField(NWC24MsgObjPrivate* msg) {
cursor += 4; cursor += 4;
index = 0; index = 0;
total = 4; total = 4;
msg->toData.ptr = (const void*)(msg->length + 4); msg->unk_0x38.ptr = (const void*)(msg->length + 4);
remaining = 1018; remaining = 1018;
for (; index < msg->numTo; ++index) { for (; index < msg->numTo; ++index) {
err = SynthesizeAddrStr(&msg->toAddrs[index], msg->type, cursor, remaining, &length); err = SynthesizeAddrStr(&msg->toAddrs[index], msg->type, cursor, remaining, &length);
@@ -641,7 +641,7 @@ static NWC24Err WriteToField(NWC24MsgObjPrivate* msg) {
err = NWC24FWrite(NWC24WorkP->stringWork, total + 2, m_pFile); err = NWC24FWrite(NWC24WorkP->stringWork, total + 2, m_pFile);
if (err == NWC24_OK) { if (err == NWC24_OK) {
msg->length += total + 2; msg->length += total + 2;
msg->toData.size = msg->length - (u32)msg->toData.ptr - 2; msg->unk_0x38.size = msg->length - (u32)msg->unk_0x38.ptr - 2;
} }
} }
return err; return err;

View File

@@ -73,11 +73,11 @@ NWC24Err NWC24InitMsgObj(NWC24MsgObj* msg, NWC24MsgType type) {
msgObj->attachedType[i] = NWC24_TEXT_PLAIN; msgObj->attachedType[i] = NWC24_TEXT_PLAIN;
} }
NWC24Data_Init(&msgObj->fromData); NWC24Data_Init(&msgObj->unk_0x30);
NWC24Data_Init(&msgObj->toData); NWC24Data_Init(&msgObj->unk_0x38);
NWC24Data_Init(&msgObj->unk_0x50); NWC24Data_Init(&msgObj->unk_0x50);
NWC24Data_Init(&msgObj->unk_0x58); NWC24Data_Init(&msgObj->unk_0x58);
NWC24Data_Init(&msgObj->extraData); NWC24Data_Init(&msgObj->unk_0xD0);
NWC24Data_Init(&msgObj->faceData); NWC24Data_Init(&msgObj->faceData);
NWC24Data_Init(&msgObj->altName); NWC24Data_Init(&msgObj->altName);

View File

@@ -289,7 +289,7 @@ NWC24Err NWC24ReadMsgFromAddr(const NWC24MsgObj* msg, char* address, u32 capacit
default: default:
return result; return result;
} }
if (privateMsg->fromData.size == 0) if (privateMsg->unk_0x30.size == 0)
return NWC24_ERR_NULL; return NWC24_ERR_NULL;
result = NWC24iMBoxOpenStoredMsg(type, privateMsg->msgId, &file); result = NWC24iMBoxOpenStoredMsg(type, privateMsg->msgId, &file);
switch (result) { switch (result) {
@@ -300,9 +300,9 @@ NWC24Err NWC24ReadMsgFromAddr(const NWC24MsgObj* msg, char* address, u32 capacit
} }
result = NWC24FStreamInit(&stream, &file, 0, privateMsg->length, buffer, 1024); result = NWC24FStreamInit(&stream, &file, 0, privateMsg->length, buffer, 1024);
if (result == NWC24_OK) { if (result == NWC24_OK) {
result = NWC24FStreamSeek(&stream, (u32)privateMsg->fromData.ptr); result = NWC24FStreamSeek(&stream, (u32)privateMsg->unk_0x30.ptr);
if (result == NWC24_OK) if (result == NWC24_OK)
result = NWC24iExtractAddrSpec(&stream, privateMsg->fromData.size, 0, address, capacity); result = NWC24iExtractAddrSpec(&stream, privateMsg->unk_0x30.size, 0, address, capacity);
} }
closeResult = NWC24iMBoxCloseMsg(&file); closeResult = NWC24iMBoxCloseMsg(&file);
if (result != NWC24_OK) if (result != NWC24_OK)

View File

@@ -930,13 +930,13 @@ namespace ipl {
math::VEC3 translate(mpLayout->FindPaneByName("N_Memo")->GetTranslate()); math::VEC3 translate(mpLayout->FindPaneByName("N_Memo")->GetTranslate());
mURLProc.clear_prev_drawing(); mURLProc.clear_prev_drawing();
mURLProc.setMemoTranslateY(translate.y); mURLProc.setUnk_0x44(translate.y);
bool result = false; bool result = false;
if (mState == STATE_NORMAL && mScroller.is_busy() == FALSE) { if (mState == STATE_NORMAL && mScroller.is_busy() == FALSE) {
result = true; result = true;
} }
mURLProc.setFocusEnabled(result); mURLProc.setUnk_0x53(result);
if (translate.y < 500.0f) { if (translate.y < 500.0f) {
mpLayout->draw("N_Header"); mpLayout->draw("N_Header");
@@ -983,8 +983,8 @@ namespace ipl {
mpLayout->draw("ReplyMask"); mpLayout->draw("ReplyMask");
} }
if (!mURLProc.getColorPass()) { if (!mURLProc.getUnk_0x50()) {
mURLProc.setColorPass(1); mURLProc.setUnk_0x50(1);
} }
} }
@@ -1512,7 +1512,7 @@ namespace ipl {
mURLProc.init(); mURLProc.init();
if (mpBoardObj->mLetterType == BoardObject::TYPE_MEMO) { if (mpBoardObj->mLetterType == BoardObject::TYPE_MEMO) {
mURLProc.setHitYOffset(8.0f); mURLProc.setUnk_0x40(8.0f);
} }
nw4r::lyt::Pane* pane = mpLayout->FindPaneByName("T_Letter"); nw4r::lyt::Pane* pane = mpLayout->FindPaneByName("T_Letter");

View File

@@ -15,16 +15,16 @@ namespace ipl {
} }
void UrlProcessor::init() { void UrlProcessor::init() {
mbHoverOffset = 0; unk_0x52 = 0;
mbInTag = 0; unk_0x51 = 0;
mbColorPass = 0; unk_0x50 = 0;
mbFocusEnabled = 1; unk_0x53 = 1;
mHitYOffset = 0.0f; unk_0x40 = 0.0f;
mMemoTranslateY = 0.0f; unk_0x44 = 0.0f;
mCurTagNo = 0; unk_0x48 = 0;
mSelectedTagNo = -1; unk_0x4C = -1;
for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) { for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) {
mConData[i].valid = false; mConData[i].valid = false;
@@ -60,14 +60,14 @@ namespace ipl {
} }
void UrlProcessor::clear_prev_drawing() { void UrlProcessor::clear_prev_drawing() {
mCurTagNo = 0; unk_0x48 = 0;
mbHoverOffset = 0; unk_0x52 = 0;
mbInTag = 0; unk_0x51 = 0;
} }
nw4r::ut::Operation UrlProcessor::Process(u16 code, nw4r::ut::PrintContext<wchar_t>* context) { nw4r::ut::Operation UrlProcessor::Process(u16 code, nw4r::ut::PrintContext<wchar_t>* context) {
if (code == SEPERATOR || code == (u16)'\n') { if (code == SEPERATOR || code == (u16)'\n') {
if (mbColorPass == 0) { if (unk_0x50 == 0) {
make_collision(context, code); make_collision(context, code);
} else if (code == SEPERATOR) { } else if (code == SEPERATOR) {
parse(context); parse(context);
@@ -78,42 +78,42 @@ namespace ipl {
void UrlProcessor::make_collision(nw4r::ut::PrintContext<wchar_t>* context, u16 code) { void UrlProcessor::make_collision(nw4r::ut::PrintContext<wchar_t>* context, u16 code) {
if (code == SEPERATOR) { if (code == SEPERATOR) {
if (mbInTag == 0) { if (unk_0x51 == 0) {
url_collision* const url_col = new (System::getMem2App(), 4) url_collision(); url_collision* const url_col = new (System::getMem2App(), 4) url_collision();
line_collision* const line_col = new (System::getMem2App(), 4) line_collision(); line_collision* const line_col = new (System::getMem2App(), 4) line_collision();
url_col->mTagNo = mCurTagNo; url_col->unk_0x00 = unk_0x48;
url_col->mpStart = (wchar_t*)context->str; url_col->unk_0x04 = (wchar_t*)context->str;
line_col->mLeft = context->writer->GetCursorX(); line_col->unk_0x00 = context->writer->GetCursorX();
nw4r::ut::List_Append(&url_col->mLineCollisions, line_col); nw4r::ut::List_Append(&url_col->mLineCollisions, line_col);
nw4r::ut::List_Append(&mUrlCollisions, url_col); nw4r::ut::List_Append(&mUrlCollisions, url_col);
mbInTag = 1; unk_0x51 = 1;
} else { } else {
void* url_col_raw = nw4r::ut::List_GetPrev(&mUrlCollisions, NULL); void* url_col_raw = nw4r::ut::List_GetPrev(&mUrlCollisions, NULL);
void* line_col_raw = nw4r::ut::List_GetPrev(&((url_collision*)url_col_raw)->mLineCollisions, NULL); void* line_col_raw = nw4r::ut::List_GetPrev(&((url_collision*)url_col_raw)->mLineCollisions, NULL);
url_collision* url_col = (url_collision*)url_col_raw; url_collision* url_col = (url_collision*)url_col_raw;
line_collision* line_col = (line_collision*)line_col_raw; line_collision* line_col = (line_collision*)line_col_raw;
line_col->mRight = context->writer->GetCursorX(); line_col->unk_0x04 = context->writer->GetCursorX();
line_col->mY = context->writer->GetCursorY(); line_col->unk_0x08 = context->writer->GetCursorY();
url_col->mpEnd = (wchar_t*)context->str; url_col->unk_0x08 = (wchar_t*)context->str;
mbInTag = 0; unk_0x51 = 0;
mCurTagNo++; unk_0x48++;
} }
} else { } else {
if (mbInTag != 0) { if (unk_0x51 != 0) {
url_collision* url_col = (url_collision*)nw4r::ut::List_GetPrev(&mUrlCollisions, NULL); url_collision* url_col = (url_collision*)nw4r::ut::List_GetPrev(&mUrlCollisions, NULL);
line_collision* line_col = (line_collision*)nw4r::ut::List_GetPrev(&url_col->mLineCollisions, NULL); line_collision* line_col = (line_collision*)nw4r::ut::List_GetPrev(&url_col->mLineCollisions, NULL);
line_col->mRight = context->writer->GetCursorX(); line_col->unk_0x04 = context->writer->GetCursorX();
line_col->mY = context->writer->GetCursorY(); line_col->unk_0x08 = context->writer->GetCursorY();
line_col = new (System::getMem2App(), 4) line_collision(); line_col = new (System::getMem2App(), 4) line_collision();
line_col->mLeft = -208.0f; line_col->unk_0x00 = -208.0f;
nw4r::ut::List_Append(&url_col->mLineCollisions, line_col); nw4r::ut::List_Append(&url_col->mLineCollisions, line_col);
} }
@@ -122,41 +122,41 @@ namespace ipl {
void UrlProcessor::parse(nw4r::ut::PrintContext<wchar_t>* context) { void UrlProcessor::parse(nw4r::ut::PrintContext<wchar_t>* context) {
f32 curY = context->writer->GetCursorY(); f32 curY = context->writer->GetCursorY();
if (mbInTag == 0) { if (unk_0x51 == 0) {
if (mSelectedTagNo == mCurTagNo) { if (unk_0x4C == unk_0x48) {
context->writer->SetTextColor(0xFFE664FF); context->writer->SetTextColor(0xFFE664FF);
} else if (mbFocusEnabled != 0 && is_focused()) { } else if (unk_0x53 != 0 && is_focused()) {
context->writer->SetCursorY(curY - 2.0f); context->writer->SetCursorY(curY - 2.0f);
context->writer->SetTextColor(0xF06E28FF); context->writer->SetTextColor(0xF06E28FF);
mbHoverOffset = 1; unk_0x52 = 1;
} else { } else {
context->writer->SetTextColor(0x34BEEDFF); context->writer->SetTextColor(0x34BEEDFF);
} }
mbInTag = 1; unk_0x51 = 1;
} else { } else {
if (mbHoverOffset != 0) { if (unk_0x52 != 0) {
context->writer->SetCursorY(2.0f + curY); context->writer->SetCursorY(2.0f + curY);
mbHoverOffset = 0; unk_0x52 = 0;
} }
context->writer->SetTextColor(0x646464FF); context->writer->SetTextColor(0x646464FF);
mbInTag = 0; unk_0x51 = 0;
mCurTagNo++; unk_0x48++;
} }
} }
BOOL UrlProcessor::is_focused() const { BOOL UrlProcessor::is_focused() const {
for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) { for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) {
if (mCurTagNo == get_focused_tagno(i)) { if (unk_0x48 == get_focused_tagno(i)) {
return TRUE; return TRUE;
} }
} }
return FALSE; return FALSE;
} }
void UrlProcessor::select(int tagNo) { void UrlProcessor::select(int unk) {
mSelectedTagNo = tagNo; unk_0x4C = unk;
} }
int UrlProcessor::get_focused_tagno(int chan) const { int UrlProcessor::get_focused_tagno(int chan) const {
@@ -174,13 +174,13 @@ namespace ipl {
while (url_col = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, url_col), url_col != NULL) { while (url_col = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, url_col), url_col != NULL) {
while (line_col = (line_collision*)nw4r::ut::List_GetNext(&url_col->mLineCollisions, line_col), line_col != NULL) { while (line_col = (line_collision*)nw4r::ut::List_GetNext(&url_col->mLineCollisions, line_col), line_col != NULL) {
f32 left = line_col->mLeft - var_f28; f32 left = line_col->unk_0x00 - var_f28;
f32 right = var_f28 + line_col->mRight; f32 right = var_f28 + line_col->unk_0x04;
f32 temp_f0 = ((mMemoTranslateY + mHitYOffset) - line_col->mY); f32 temp_f0 = ((unk_0x44 + unk_0x40) - line_col->unk_0x08);
f32 top = (var_f29 + temp_f0) - var_f28; f32 top = (var_f29 + temp_f0) - var_f28;
f32 bottom = var_f28 + (var_f30 + temp_f0); f32 bottom = var_f28 + (var_f30 + temp_f0);
if (left <= var_f31 && var_f31 <= right && top <= -pos.y && -pos.y <= bottom) { if (left <= var_f31 && var_f31 <= right && top <= -pos.y && -pos.y <= bottom) {
return url_col->mTagNo; return url_col->unk_0x00;
} }
} }
} }
@@ -194,7 +194,7 @@ namespace ipl {
url_collision* url_col = NULL; url_collision* url_col = NULL;
while (got = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, got), got != NULL) { while (got = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, got), got != NULL) {
if (got->mTagNo == mSelectedTagNo) { if (got->unk_0x00 == unk_0x4C) {
url_col = got; url_col = got;
break; break;
} }
@@ -210,10 +210,10 @@ namespace ipl {
int chIdx2 = 0; int chIdx2 = 0;
int chIdx = 0; int chIdx = 0;
u32 count = (u32)url_col->mpEnd - (u32)url_col->mpStart; u32 count = (u32)url_col->unk_0x08 - (u32)url_col->unk_0x04;
count >>= 1; count >>= 1;
for (u32 i = 0; i < count; i++) { for (u32 i = 0; i < count; i++) {
wchar_t wch = url_col->mpStart[i]; wchar_t wch = url_col->unk_0x04[i];
if (wch != SEPERATOR && chIdx2 < 0x200) { if (wch != SEPERATOR && chIdx2 < 0x200) {
url[chIdx2++] = wch; url[chIdx2++] = wch;
} }
@@ -226,9 +226,9 @@ namespace ipl {
} }
UrlProcessor::url_collision::url_collision() { UrlProcessor::url_collision::url_collision() {
mTagNo = 0; unk_0x00 = 0;
mpStart = NULL; unk_0x04 = NULL;
mpEnd = NULL; unk_0x08 = NULL;
nw4r::ut::List_Init(&mLineCollisions, offsetof(line_collision, mLinkList)); nw4r::ut::List_Init(&mLineCollisions, offsetof(line_collision, mLinkList));
} }

View File

@@ -648,7 +648,7 @@ namespace ipl {
} }
if (System::getFader()->getStatus() == EGG::Fader::PREPARE_IN && System::isReceiveScheduleStopped()) { if (System::getFader()->getStatus() == EGG::Fader::PREPARE_IN && System::isReceiveScheduleStopped()) {
if (System::getNwc24Manager() && !System::getNwc24Manager()->isReceivingIdle()) { if (System::getNwc24Manager() && !System::getNwc24Manager()->isUnk0xA31()) {
goto scn_continue; goto scn_continue;
} }

View File

@@ -25,16 +25,16 @@ typedef struct {
undefined4 result; undefined4 result;
undefined4 errCode; undefined4 errCode;
HTTPTestState httpTestState; HTTPTestState httpTestState;
undefined4 natState; undefined4 unk_0x030;
undefined4 gsAvailable; undefined4 unk_0x034;
undefined4 natTimedOut; undefined4 unk_0x038;
undefined4 natFailed; undefined4 unk_0x03c;
OSTime detectStartTime; OSTime detectStartTime;
NHTTPConnection httpConnection; NHTTPConnection httpConnection;
NHTTPRequest* httpRequest; NHTTPRequest* httpRequest;
NHTTPResponse* httpResponse; NHTTPResponse* httpResponse;
NCDProxyProfile proxy; NCDProxyProfile proxy;
void* httpBuf; void* unk_0x7f0;
NAT nat; NAT nat;
} StaticSession; } StaticSession;
@@ -64,14 +64,14 @@ void IPLContestInitialize(void* heapBuf, NCDProxyProfile* proxy) {
g_session.result = 0xFF00; g_session.result = 0xFF00;
g_session.errCode = 0; g_session.errCode = 0;
g_session.httpTestState = HTTP_TEST_NOT_STARTED; g_session.httpTestState = HTTP_TEST_NOT_STARTED;
g_session.natState = 0; g_session.unk_0x030 = 0;
g_session.detectStartTime = 0; g_session.detectStartTime = 0;
g_session.httpConnection = 0; g_session.httpConnection = 0;
g_session.httpRequest = 0; g_session.httpRequest = 0;
g_session.httpResponse = NULL; g_session.httpResponse = NULL;
g_session.gsAvailable = 0; g_session.unk_0x034 = 0;
g_session.natTimedOut = 0; g_session.unk_0x038 = 0;
g_session.natFailed = 1; g_session.unk_0x03c = 1;
g_session.proxy = *proxy; g_session.proxy = *proxy;
} }
@@ -100,7 +100,7 @@ int IPLContestProcess() {
g_session.errCode = g_session.errCode != 0 ? g_session.errCode : -52200; g_session.errCode = g_session.errCode != 0 ? g_session.errCode : -52200;
OSReport("[error] Failed to start up NHTTP.\n"); OSReport("[error] Failed to start up NHTTP.\n");
} else { } else {
g_session.httpBuf = IPLContestAlloc(0x400); g_session.unk_0x7f0 = IPLContestAlloc(0x400);
g_session.httpTestState = HTTP_TEST_STARTED; g_session.httpTestState = HTTP_TEST_STARTED;
OSReport("Starting HTTP conectting test.\n"); OSReport("Starting HTTP conectting test.\n");
} }
@@ -108,7 +108,7 @@ int IPLContestProcess() {
} }
case HTTP_TEST_STARTED: { case HTTP_TEST_STARTED: {
g_session.httpRequest = g_session.httpRequest =
NHTTPCreateRequest("http://conntest.nintendowifi.net/", 0, g_session.httpBuf, 0x400, sNHTTPReqCallback, 0); NHTTPCreateRequest("http://conntest.nintendowifi.net/", 0, g_session.unk_0x7f0, 0x400, sNHTTPReqCallback, 0);
if (g_session.httpRequest == 0) { if (g_session.httpRequest == 0) {
g_session.httpTestState = HTTP_TEST_RESPONSE_ERRORED; g_session.httpTestState = HTTP_TEST_RESPONSE_ERRORED;
g_session.result |= 4; g_session.result |= 4;
@@ -156,9 +156,9 @@ int IPLContestProcess() {
NHTTPDestroyResponse(g_session.httpResponse); NHTTPDestroyResponse(g_session.httpResponse);
g_session.httpResponse = NULL; g_session.httpResponse = NULL;
} }
if (g_session.httpBuf != NULL) { if (g_session.unk_0x7f0 != NULL) {
IPLContestFree(g_session.httpBuf, 0); IPLContestFree(g_session.unk_0x7f0, 0);
g_session.httpBuf = NULL; g_session.unk_0x7f0 = NULL;
} }
g_session.httpTestState = HTTP_TEST_DONE; g_session.httpTestState = HTTP_TEST_DONE;
NHTTPCleanupAsync(sNHTTPCleanupCallback); NHTTPCleanupAsync(sNHTTPCleanupCallback);
@@ -176,9 +176,9 @@ int IPLContestProcess() {
NHTTPDestroyResponse(g_session.httpResponse); NHTTPDestroyResponse(g_session.httpResponse);
g_session.httpResponse = NULL; g_session.httpResponse = NULL;
} }
if (g_session.httpBuf != NULL) { if (g_session.unk_0x7f0 != NULL) {
IPLContestFree(g_session.httpBuf, 0); IPLContestFree(g_session.unk_0x7f0, 0);
g_session.httpBuf = NULL; g_session.unk_0x7f0 = NULL;
} }
g_session.httpTestState = HTTP_TEST_DONE; g_session.httpTestState = HTTP_TEST_DONE;
NHTTPCleanupAsync(sNHTTPCleanupCallback); NHTTPCleanupAsync(sNHTTPCleanupCallback);
@@ -198,11 +198,11 @@ int IPLContestProcess() {
OSReport("Port mapping detectioning test has been skipped.\n"); OSReport("Port mapping detectioning test has been skipped.\n");
} else } else
switch (g_session.natState) { switch (g_session.unk_0x030) {
case 0: { case 0: {
gsiMemoryCallbacksSet(IPLContestGSMalloc, IPLContestGSFree, IPLContestGSRealloc, IPLContestGSMemalign); gsiMemoryCallbacksSet(IPLContestGSMalloc, IPLContestGSFree, IPLContestGSRealloc, IPLContestGSMemalign);
GSIStartAvailableCheckA("wiinat"); GSIStartAvailableCheckA("wiinat");
g_session.natState = 1; g_session.unk_0x030 = 1;
OSReport("Starting GameSpy available check.\n"); OSReport("Starting GameSpy available check.\n");
break; break;
} }
@@ -212,14 +212,14 @@ int IPLContestProcess() {
break; break;
} }
case GSIACAvailable: { case GSIACAvailable: {
g_session.gsAvailable = 1; g_session.unk_0x034 = 1;
g_session.natState = 2; g_session.unk_0x030 = 2;
OSReport("GameSpy server is currently available.\n"); OSReport("GameSpy server is currently available.\n");
break; break;
} }
default: { default: {
g_session.gsAvailable = 0; g_session.unk_0x034 = 0;
g_session.natState = 5; g_session.unk_0x030 = 5;
OSReport("GameSpy server is currently unavailable.\n"); OSReport("GameSpy server is currently unavailable.\n");
break; break;
} }
@@ -228,7 +228,7 @@ int IPLContestProcess() {
} }
case 2: { case 2: {
NNStartNatDetection(onNatDetectionDone); NNStartNatDetection(onNatDetectionDone);
g_session.natState = 3; g_session.unk_0x030 = 3;
OSReport("Port mapping detectioning test has been started.\n"); OSReport("Port mapping detectioning test has been started.\n");
g_session.detectStartTime = OSGetTime(); g_session.detectStartTime = OSGetTime();
break; break;
@@ -238,8 +238,8 @@ int IPLContestProcess() {
if (OSGetTime() - g_session.detectStartTime < OSMillisecondsToTicks((OSTime)90000)) { if (OSGetTime() - g_session.detectStartTime < OSMillisecondsToTicks((OSTime)90000)) {
break; break;
} }
g_session.natState = 5; g_session.unk_0x030 = 5;
g_session.natTimedOut = 1; g_session.unk_0x038 = 1;
OSReport("[error] NAT timeout.\n"); OSReport("[error] NAT timeout.\n");
break; break;
} }
@@ -289,10 +289,10 @@ int IPLGetNATSupportCode(int conntype) {
nat = g_session.nat; nat = g_session.nat;
if (g_session.gsAvailable != 0) { if (g_session.unk_0x034 != 0) {
if (g_session.natTimedOut != 0) { if (g_session.unk_0x038 != 0) {
code = 11180; code = 11180;
} else if (g_session.natFailed != 0) { } else if (g_session.unk_0x03c != 0) {
code = 11170; code = 11170;
} else { } else {
if (nat.mappingScheme == 0 && nat.mappings[2].publicPort == nat.mappings[1].publicPort * 2 - nat.mappings[0].publicPort) { if (nat.mappingScheme == 0 && nat.mappings[2].publicPort == nat.mappings[1].publicPort * 2 - nat.mappings[0].publicPort) {
@@ -464,10 +464,10 @@ void sNHTTPCleanupCallback() {
void onNatDetectionDone(gsi_bool success, NAT nat) { void onNatDetectionDone(gsi_bool success, NAT nat) {
if (success) { if (success) {
g_session.nat = nat; g_session.nat = nat;
g_session.natFailed = 0; g_session.unk_0x03c = 0;
} else { } else {
g_session.natFailed = 1; g_session.unk_0x03c = 1;
} }
g_session.natState = 4; g_session.unk_0x030 = 4;
return; return;
} }

View File

@@ -353,7 +353,7 @@ FaderSceneCommand SDChannelTitle::calcFadeout() {
mWpadStopTick = OSGetTick(); mWpadStopTick = OSGetTick();
} }
if (System::getFader()->getStatus() == EGG::Fader::PREPARE_IN && System::isReceiveScheduleStopped() && if (System::getFader()->getStatus() == EGG::Fader::PREPARE_IN && System::isReceiveScheduleStopped() &&
(!System::getNwc24Manager() || System::getNwc24Manager()->isReceivingIdle())) { (!System::getNwc24Manager() || System::getNwc24Manager()->isUnk0xA31())) {
OSReport("NWC24 Scheduler stopped.\n"); OSReport("NWC24 Scheduler stopped.\n");
NandSDWorker* worker = mpChannelSelect->getWorker(); NandSDWorker* worker = mpChannelSelect->getWorker();
if (mNextScene == 17) { if (mNextScene == 17) {

View File

@@ -15,10 +15,10 @@ namespace ipl {
// clang-format on // clang-format on
SettingButton::SettingButton(EGG::Heap* heap, int arg) : FaderSceneBase(heap), ::gui::EventHandler() { SettingButton::SettingButton(EGG::Heap* heap, int arg) : FaderSceneBase(heap), ::gui::EventHandler() {
mQueueCapacity = 64; mCmdCapacity = 64;
mQueueCount = 0; mCmdCount = 0;
mQueueRead = 0; mCmdReadIdx = 0;
mQueueWrite = 0; mCmdWriteIdx = 0;
mSettingArg = arg; mSettingArg = arg;
mpLayout = NULL; mpLayout = NULL;
mpLayoutFile = NULL; mpLayoutFile = NULL;
@@ -81,9 +81,9 @@ namespace ipl {
FaderSceneCommand SettingButton::calcNormal() { FaderSceneCommand SettingButton::calcNormal() {
if (!mpLayout->getAnim(ANIM_ALPHA_IN)->isPlaying() && !mpLayout->getAnim(ANIM_ALPHA_OUT)->isPlaying() && if (!mpLayout->getAnim(ANIM_ALPHA_IN)->isPlaying() && !mpLayout->getAnim(ANIM_ALPHA_OUT)->isPlaying() &&
!mpLayout->getAnim(ANIM_BTN_FLASH)->isPlaying() && mQueueCount != 0) { !mpLayout->getAnim(ANIM_BTN_FLASH)->isPlaying() && mCmdCount != 0) {
CmdEntry entry = mCmdQueue[mQueueRead]; CmdEntry unk = mCmdQueue[mCmdReadIdx];
switch (entry.command) { switch (unk.command) {
case CMD_SHOW_BTN: { case CMD_SHOW_BTN: {
showBtn(); showBtn();
break; break;
@@ -93,16 +93,16 @@ namespace ipl {
break; break;
} }
case CMD_SET_TEXT: { case CMD_SET_TEXT: {
setText(entry.msgID); setText(unk.msgID);
break; break;
} }
} }
if (mQueueCount != 0) { if (mCmdCount != 0) {
if (++mQueueRead >= mQueueCapacity) { if (++mCmdReadIdx >= mCmdCapacity) {
mQueueRead = 0; mCmdReadIdx = 0;
} }
mQueueCount--; mCmdCount--;
} }
} }
@@ -225,16 +225,16 @@ namespace ipl {
} }
void SettingButton::reserve(int command, u32 msgId) { void SettingButton::reserve(int command, u32 msgId) {
if (mQueueCapacity != mQueueCount) { if (mCmdCapacity != mCmdCount) {
int writeIdx = mQueueWrite; int unk = mCmdWriteIdx;
mCmdQueue[writeIdx].command = command; mCmdQueue[unk].command = command;
mCmdQueue[writeIdx].msgID = msgId; mCmdQueue[unk].msgID = msgId;
mQueueWrite++; mCmdWriteIdx++;
if (mQueueWrite >= mQueueCapacity) { if (mCmdWriteIdx >= mCmdCapacity) {
mQueueWrite = 0; mCmdWriteIdx = 0;
} }
mQueueCount++; mCmdCount++;
} }
} }

View File

@@ -14,7 +14,7 @@
namespace ipl { namespace ipl {
namespace bs2 { namespace bs2 {
Manager::Manager(EGG::Heap* pHeap) Manager::Manager(EGG::Heap* pHeap)
: mIPLState(IPL_STATE_NO_DISK), mState(BS2_STT_NO_DISK), mbTickEnabled(true), mbUpdateRequested(false), mbAbortRequested(false), mbRestartRequested(false), : mIPLState(IPL_STATE_NO_DISK), mState(BS2_STT_NO_DISK), unk_0x0C(true), unk_0x0D(false), unk_0x0E(false), unk_0x0F(false),
mbIsDiagDisc(false), mbIncludesSeatTitles(false), mbHasBanner(FALSE), mUnlockedState(BS2_STT_NO_DISK), mbStartUpdate(false), mbIsDiagDisc(false), mbIncludesSeatTitles(false), mbHasBanner(FALSE), mUnlockedState(BS2_STT_NO_DISK), mbStartUpdate(false),
mEntries(NULL), mEntrySize(1), mEntryOffset(0) { mEntries(NULL), mEntrySize(1), mEntryOffset(0) {
mpBannerBuffer = new (pHeap, DEFAULT_ALIGN) u8[BS2_DEFAULT_BANNER_SIZE]; mpBannerBuffer = new (pHeap, DEFAULT_ALIGN) u8[BS2_DEFAULT_BANNER_SIZE];
@@ -30,13 +30,13 @@ namespace ipl {
return mIPLState; return mIPLState;
} }
if (mbRestartRequested && !System::isNandFull()) { if (unk_0x0F && !System::isNandFull()) {
BS2RestartStateMachine(); BS2RestartStateMachine();
mbTickEnabled = true; unk_0x0C = true;
mIPLState = IPL_STATE_NO_DISK; mIPLState = IPL_STATE_NO_DISK;
mbRestartRequested = false; unk_0x0F = false;
} else if (mbTickEnabled) { } else if (unk_0x0C) {
BOOL old = OSDisableInterrupts(); BOOL old = OSDisableInterrupts();
mState = BS2Tick(); mState = BS2Tick();
@@ -51,7 +51,7 @@ namespace ipl {
if (mbIsDiagDisc && System::isRsrcLoaded()) { if (mbIsDiagDisc && System::isRsrcLoaded()) {
__WPADReconnect(TRUE); __WPADReconnect(TRUE);
mbTickEnabled = false; unk_0x0C = false;
bootNewSystem(); bootNewSystem();
} }
} }
@@ -65,7 +65,7 @@ namespace ipl {
} }
void Manager::startUpdate() { void Manager::startUpdate() {
mbUpdateRequested = true; unk_0x0D = true;
mbStartUpdate = true; mbStartUpdate = true;
mPrevEntry = 0; mPrevEntry = 0;
mPrevFound = 0; mPrevFound = 0;
@@ -88,11 +88,11 @@ namespace ipl {
} }
void Manager::reserveRVLGame() { void Manager::reserveRVLGame() {
mbTickEnabled = false; unk_0x0C = false;
} }
void Manager::reserveGCGame() { void Manager::reserveGCGame() {
mbTickEnabled = false; unk_0x0C = false;
} }
void Manager::startRVLGame() { void Manager::startRVLGame() {
@@ -103,13 +103,13 @@ namespace ipl {
} }
void Manager::abort() { void Manager::abort() {
mbAbortRequested = true; unk_0x0E = true;
mbRestartRequested = false; unk_0x0F = false;
} }
void Manager::restart() { void Manager::restart() {
mbAbortRequested = false; unk_0x0E = false;
mbRestartRequested = true; unk_0x0F = true;
System::checkNandOverFlowFlagAsync(); System::checkNandOverFlowFlagAsync();
} }
@@ -195,7 +195,7 @@ namespace ipl {
break; break;
} }
case BS2_STT_64: { case BS2_STT_64: {
mbTickEnabled = false; unk_0x0C = false;
mIPLState = IPL_STATE_8; mIPLState = IPL_STATE_8;
break; break;
} }
@@ -216,25 +216,25 @@ namespace ipl {
} }
void Manager::execTick(BS2State state) { void Manager::execTick(BS2State state) {
if (mbUpdateRequested) { if (unk_0x0D) {
if (state == BS2_STT_UPDATE_DISK) { if (state == BS2_STT_UPDATE_DISK) {
BS2StartUpdate(); BS2StartUpdate();
} else { } else {
mbStartUpdate = false; mbStartUpdate = false;
} }
} else if (mbAbortRequested) { } else if (unk_0x0E) {
if (state == BS2_STT_NO_DISK || state == BS2_STT_COVER_OPEN || state == BS2_STT_55 || state == BS2_STT_WRONG_DISK || if (state == BS2_STT_NO_DISK || state == BS2_STT_COVER_OPEN || state == BS2_STT_55 || state == BS2_STT_WRONG_DISK ||
state == BS2_STT_66 || state == BS2_STT_67 || state == BS2_STT_68 || state == BS2_STT_FATAL_ERROR || state == BS2_STT_66 || state == BS2_STT_67 || state == BS2_STT_68 || state == BS2_STT_FATAL_ERROR ||
state == BS2_STT_UPDATE_FAILED || state == BS2_STT_DIRTY_DISK) { state == BS2_STT_UPDATE_FAILED || state == BS2_STT_DIRTY_DISK) {
mbTickEnabled = false; unk_0x0C = false;
mIPLState = IPL_STATE_8; mIPLState = IPL_STATE_8;
} else { } else {
BS2AbortStateMachine(); BS2AbortStateMachine();
} }
} }
mbUpdateRequested = false; unk_0x0D = false;
mbAbortRequested = false; unk_0x0E = false;
} }
void Manager::updateTick() { void Manager::updateTick() {

View File

@@ -46,17 +46,17 @@ namespace ipl {
} }
if (mButton != 0) { if (mButton != 0) {
if (down(BTN_INTERACT)) { if (down(BTN_INTERACT)) {
mDecideHoldCount++; unk_0x08++;
} else { } else {
mDecideHoldCount = 0; unk_0x08 = 0;
mButton = 0; mButton = 0;
} }
} else { } else {
mDecideHoldCount = 0; unk_0x08 = 0;
} }
} else { } else {
mButton = 0; mButton = 0;
mDecideHoldCount = 0; unk_0x08 = 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 mDecideHoldCount == 5; return unk_0x08 == 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()) {
mpStatus->pos.y = 1.0f / 0.0f; unk_0x20->pos.y = 1.0f / 0.0f;
mpStatus->pos.x = 1.0f / 0.0f; unk_0x20->pos.x = 1.0f / 0.0f;
mpStatus->speed = 0.0f; unk_0x20->speed = 0.0f;
mpStatus->vec.y = 0.0f; unk_0x20->vec.y = 0.0f;
mpStatus->vec.x = 0.0f; unk_0x20->vec.x = 0.0f;
} }
mbPrevPinch = mbPinch; unk_0x1E = unk_0x1D;
if (isValidBtn()) { if (isValidBtn()) {
if (mbPrevPinch == 0) { if (unk_0x1E == 0) {
if (down(0x800) && down(0x400)) { if (down(0x800) && down(0x400)) {
mbPinch = 1; unk_0x1D = 1;
} }
} else if (!down(0x800) || !down(0x400)) { } else if (!down(0x800) || !down(0x400)) {
mbPinch = 0; unk_0x1D = 0;
} }
} else { } else {
mbPinch = 0; unk_0x1D = 0;
} }
Base::read(); Base::read();
} }
bool ipl::controller::Revolution::isValidDpd() const { bool ipl::controller::Revolution::isValidDpd() const {
if (mbForceInvalid != 0) { if (unk_0x1C != 0) {
return false; return false;
} }
return (mpStatus->wpad_err == 0 || mpStatus->wpad_err == -7) && mpStatus->dpd_valid_fg != 0; return (unk_0x20->wpad_err == 0 || unk_0x20->wpad_err == -7) && unk_0x20->dpd_valid_fg != 0;
} }
bool ipl::controller::Revolution::isValidBtn() const { bool ipl::controller::Revolution::isValidBtn() const {
u8 val = mpStatus->wpad_err; u8 val = unk_0x20->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 (mpStatus->hold & (mButton & 0xFFFF)) { if (unk_0x20->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 = {mpStatus->pos.x, mpStatus->pos.y}; Vec2 src = {unk_0x20->pos.x, unk_0x20->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) {
mClassicCursor.x = 0.01f; unk_0x24.x = 0.01f;
mClassicCursor.y = 0.01f; unk_0x24.y = 0.01f;
mClassicCursorTimer = 0; unk_0x2C = 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(mpStatus->ex_status.cl.lstick.x, mpStatus->ex_status.cl.lstick.y); math::VEC2 lstick(unk_0x20->ex_status.cl.lstick.x, unk_0x20->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) {
mClassicCursor.x = math::abs_clamp(mClassicCursor.x + mpStatus->ex_status.cl.lstick.x * 0.05f, 1.8f); unk_0x24.x = math::abs_clamp(unk_0x24.x + unk_0x20->ex_status.cl.lstick.x * 0.05f, 1.8f);
mClassicCursor.y = math::abs_clamp(mClassicCursor.y - mpStatus->ex_status.cl.lstick.y * 0.05f, 1.2f); unk_0x24.y = math::abs_clamp(unk_0x24.y - unk_0x20->ex_status.cl.lstick.y * 0.05f, 1.2f);
} }
math::VEC2 rstick = math::VEC2(mpStatus->ex_status.cl.rstick.x, mpStatus->ex_status.cl.rstick.y); math::VEC2 rstick = math::VEC2(unk_0x20->ex_status.cl.rstick.x, unk_0x20->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) {
mClassicCursorTimer = 180; unk_0x2C = 180;
} }
if (--mClassicCursorTimer < 0) { if (--unk_0x2C < 0) {
mClassicCursorTimer = 0; unk_0x2C = 0;
} }
} else { } else {
mClassicCursor.y = 0.01f; unk_0x24.y = 0.01f;
mClassicCursor.x = 0.01f; unk_0x24.x = 0.01f;
mClassicCursorTimer = 0; unk_0x2C = 0;
} }
Revolution::read(); Revolution::read();
} }
int ipl::controller::Classic::getClassicHoldFlag() const { int ipl::controller::Classic::getClassicHoldFlag() const {
return mpStatus->ex_status.cl.hold; return unk_0x20->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(mpStatus->horizon.x, mpStatus->horizon.y); ret.set(unk_0x20->horizon.x, unk_0x20->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(mpStatus->pos.x, mpStatus->pos.y); ret.set(unk_0x20->pos.x, unk_0x20->pos.y);
} else if (mClassicCursorTimer != 0) { } else if (unk_0x2C != 0) {
ret = mClassicCursor; ret = unk_0x24;
} 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(mpStatus->pos.x, mpStatus->pos.y); ret.set(unk_0x20->pos.x, unk_0x20->pos.y);
} else if (mClassicCursorTimer != 0) { } else if (unk_0x2C != 0) {
ret = mClassicCursor; ret = unk_0x24;
} 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) {
mbForceInvalid = flag; unk_0x1C = 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 mpStatus; return unk_0x20;
} }
f32 ipl::controller::Revolution::getDpdDistance() const { f32 ipl::controller::Revolution::getDpdDistance() const {
return mpStatus->dist; return unk_0x20->dist;
} }
int ipl::controller::Revolution::getReleaseFlag() const { int ipl::controller::Revolution::getReleaseFlag() const {
return mpStatus->release; return unk_0x20->release;
} }
int ipl::controller::Revolution::getTrigFlag() const { int ipl::controller::Revolution::getTrigFlag() const {
return mpStatus->trig; return unk_0x20->trig;
} }
int ipl::controller::Revolution::getHoldFlag() const { int ipl::controller::Revolution::getHoldFlag() const {
return mpStatus->hold; return unk_0x20->hold;
} }
int ipl::controller::Revolution::pinchOffTrg() const { int ipl::controller::Revolution::pinchOffTrg() const {
int ret = 0; int ret = 0;
if (isValidBtn() && mbPinch == 0 && mbPrevPinch != 0) { if (isValidBtn() && unk_0x1D == 0 && unk_0x1E != 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() && mbPinch != 0) { if (isValidBtn() && unk_0x1D != 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() && mbPinch != 0 && mbPrevPinch == 0) { if (isValidBtn() && unk_0x1D != 0 && unk_0x1E == 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) && (mpStatus->hold & 0x80000000) != 0; return down(button) && (unk_0x20->hold & 0x80000000) != 0;
} }
BOOL ipl::controller::Classic::isValidDpdClassic() const { BOOL ipl::controller::Classic::isValidDpdClassic() const {
return mClassicCursorTimer != 0; return unk_0x2C != 0;
} }
bool ipl::controller::Classic::isValidDpd() const { bool ipl::controller::Classic::isValidDpd() const {
if (mbForceInvalid != 0) { if (unk_0x1C != 0) {
return false; return false;
} }
return (Revolution::isValidDpd() != 0) || (mClassicCursorTimer != 0); return (Revolution::isValidDpd() != 0) || (unk_0x2C != 0);
} }
int ipl::controller::Classic::getClassicReleaseFlag() const { int ipl::controller::Classic::getClassicReleaseFlag() const {
return mpStatus->ex_status.cl.release; return unk_0x20->ex_status.cl.release;
} }
int ipl::controller::Classic::getClassicTrigFlag() const { int ipl::controller::Classic::getClassicTrigFlag() const {
return mpStatus->ex_status.cl.trig; return unk_0x20->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 = mpStatus; KPADStatus* status = unk_0x20;
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 = mpStatus; KPADStatus* status = unk_0x20;
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 ((mpStatus->hold & (button & 0xFFFF)) == 0) { if ((unk_0x20->hold & (button & 0xFFFF)) == 0) {
if ((mpStatus->ex_status.cl.hold & (button >> 16)) == 0) { if ((unk_0x20->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(mpStatus->horizon.x, mpStatus->horizon.y); return math::VEC2(unk_0x20->horizon.x, unk_0x20->horizon.y);
} }
ipl::math::VEC2 ipl::controller::Revolution::getDpdPos() const { ipl::math::VEC2 ipl::controller::Revolution::getDpdPos() const {
return math::VEC2(mpStatus->pos.x, mpStatus->pos.y); return math::VEC2(unk_0x20->pos.x, unk_0x20->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 (mpStatus->release & (button & 0xFFFF)) { if (unk_0x20->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 (mpStatus->trig & (button & 0xFFFF)) { if (unk_0x20->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) {
mbPinch = 0; unk_0x1D = 0;
mbPrevPinch = 0; unk_0x1E = 0;
mpStatus = &status; unk_0x20 = &status;
} }
Interface* Manager::getMasterController() { Interface* Manager::getMasterController() {

View File

@@ -43,13 +43,13 @@ namespace ipl {
mMessageID = msgId; mMessageID = msgId;
// Debug related? (seems to be incomplete; unused) // Debug related? (seems to be incomplete; unused)
mArg2 = arg2; unk_0x0C = arg2;
mArg3 = arg3; unk_0x10 = arg3;
if (arg1) { if (arg1) {
strncpy(mArg1, arg1, sizeof(mArg1)); strncpy(unk_0x14, arg1, sizeof(unk_0x14));
mArg1[sizeof(mArg1) - 1] = 0; unk_0x14[sizeof(unk_0x14) - 1] = 0;
} else { } else {
memset(mArg1, 0, sizeof(mArg1)); memset(unk_0x14, 0, sizeof(unk_0x14));
} }
curThread = OSGetCurrentThread(); curThread = OSGetCurrentThread();

View File

@@ -47,7 +47,7 @@ namespace ipl {
(((mLastError > NWC24_ERR_FILE_OPEN || mLastError < NWC24_ERR_FILE_OTHER) && mLastError != NWC24_ERR_NAND_CORRUPT) && \ (((mLastError > NWC24_ERR_FILE_OPEN || mLastError < NWC24_ERR_FILE_OTHER) && mLastError != NWC24_ERR_NAND_CORRUPT) && \
(mLastError != NWC24_ERR_FILE_EXISTS && mLastError != NWC24_ERR_INTERNAL_VF && mLastError != NWC24_ERR_FILE_BROKEN)) (mLastError != NWC24_ERR_FILE_EXISTS && mLastError != NWC24_ERR_INTERNAL_VF && mLastError != NWC24_ERR_FILE_BROKEN))
Manager::Manager(EGG::Heap* heap) : mbReviecedMsg(false), mbReceiving(false), mbReceivePaused(false), mbNewTitleTblReady(false) { Manager::Manager(EGG::Heap* heap) : mbReviecedMsg(false), unk_0xA31(false), mbReceivePaused(false), unk_0xA33(false) {
OSInitMutex(&mLock); OSInitMutex(&mLock);
OSInitMutex(&mAutoLock); OSInitMutex(&mAutoLock);
@@ -526,7 +526,7 @@ namespace ipl {
return; return;
} }
mbReceiving = true; unk_0xA31 = true;
NWC24UserId myUserId; NWC24UserId myUserId;
getMyUserId(&myUserId); getMyUserId(&myUserId);
@@ -910,8 +910,8 @@ namespace ipl {
close(); close();
mbNewTitleTblReady = true; unk_0xA33 = true;
mbReceiving = false; unk_0xA31 = false;
} }
void Manager::addDlTask() { void Manager::addDlTask() {
@@ -996,7 +996,7 @@ namespace ipl {
} }
BOOL Manager::getNewTitleTbl(u32* titleTbl) const { BOOL Manager::getNewTitleTbl(u32* titleTbl) const {
if (!mbNewTitleTblReady) { if (!unk_0xA33) {
return FALSE; return FALSE;
} }

View File

@@ -61,7 +61,7 @@ namespace ipl {
if (System::getPostmanManager()->IsUnknown() || if (System::getPostmanManager()->IsUnknown() ||
(System::getSceneManager() != NULL && System::getScene(SCENE_ADDRESS) != NULL)) { (System::getSceneManager() != NULL && System::getScene(SCENE_ADDRESS) != NULL)) {
if (System::getNwc24Manager() != NULL && !System::isNandFull()) { if (System::getNwc24Manager() != NULL && !System::isNandFull()) {
if (System::createdAfterAndLibMgr() && !System::getNwc24Manager()->isReceivingIdle()) { if (System::createdAfterAndLibMgr() && !System::getNwc24Manager()->isUnk0xA31()) {
return; return;
} }
} }