Compare commits
90 Commits
agent/data
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cdfa42f57b | ||
|
|
8f546b4127 | ||
|
|
47e2fca14d | ||
|
|
a7959ad5c6 | ||
|
|
a01b3eb034 | ||
|
|
59310eec2e | ||
|
|
5063340c0a | ||
|
|
5f700048d0 | ||
|
|
69575ef7b0 | ||
|
|
bce8e09407 | ||
|
|
c0ea9c8b5e | ||
|
|
da09f7459b | ||
|
|
668abf4b8f | ||
|
|
2ca72f20f7 | ||
|
|
0ba7888699 | ||
|
|
190b11df6b | ||
|
|
b946e40dda | ||
|
|
9f10bd3f0f | ||
|
|
e21d4626ea | ||
|
|
ca8fe833e4 | ||
|
|
243e914ab0 | ||
|
|
3611c932a1 | ||
|
|
c687c940fa | ||
|
|
aa05001ce6 | ||
|
|
96b8b71a6d | ||
|
|
cc5048eca1 | ||
|
|
0933fb4dab | ||
|
|
7050f7033e | ||
|
|
e4632c60d2 | ||
|
|
5877d598d9 | ||
|
|
4c2a6ef4e1 | ||
|
|
ff7155ea15 | ||
|
|
a1ad43a516 | ||
|
|
b484456d2b | ||
|
|
61032b94a8 | ||
|
|
679b249d0e | ||
|
|
9f68f59195 | ||
|
|
a496d77426 | ||
|
|
6754dcef5c | ||
|
|
5da9e5abdb | ||
|
|
5eebf39964 | ||
|
|
eb50f578f5 | ||
|
|
7c7b0569bf | ||
|
|
79a654a64b | ||
|
|
2e8d3579df | ||
|
|
4b035b954b | ||
|
|
eac956b1b6 | ||
|
|
332f58508f | ||
|
|
52576c6bc6 | ||
|
|
8e5787f568 | ||
|
|
3e5411f37d | ||
|
|
600048402a | ||
|
|
67ba5e3663 | ||
|
|
3f2af2a919 | ||
|
|
f57e48be09 | ||
|
|
728624da2a | ||
|
|
6deff4fdc0 | ||
|
|
a87c7b1ca1 | ||
|
|
d506be5a50 | ||
|
|
4f449d73be | ||
|
|
7f215a6261 | ||
|
|
43f2bc33d8 | ||
|
|
9bf797ecc7 | ||
|
|
9b3c98122d | ||
|
|
ed0a012a22 | ||
|
|
b00e235438 | ||
|
|
f99704f4d0 | ||
|
|
056ece032e | ||
|
|
be8eeb9d70 | ||
|
|
508f449ccc | ||
|
|
9ded6e6496 | ||
|
|
3e3bf3422e | ||
|
|
22e7459a57 | ||
|
|
20bffa1ec2 | ||
|
|
861a326a67 | ||
|
|
b20a59205a | ||
|
|
7dff4b031b | ||
|
|
9f06a5bb96 | ||
|
|
467cc7835f | ||
|
|
847a3f3e7d | ||
|
|
173e87526a | ||
|
|
93a4f33eb1 | ||
|
|
cd13dd9c59 | ||
|
|
28f7d5f62a | ||
|
|
51cc6bdba3 | ||
|
|
59a683f651 | ||
|
|
5b3bd9524e | ||
|
|
3a5249d356 | ||
|
|
af48f0a19f | ||
|
|
dd74a9d314 |
@@ -5126,8 +5126,8 @@ __ct__Q33ipl5scene10AOSSThreadFPQ23EGG4Heap = .text:0x813FCA0C; // type:function
|
||||
destroy__Q33ipl5scene10AOSSThreadFi = .text:0x813FCAA0; // type:function size:0x84
|
||||
__dt__Q33ipl5scene10AOSSThreadFv = .text:0x813FCB24; // type:function size:0x70
|
||||
start__Q33ipl5scene10AOSSThreadFv = .text:0x813FCB94; // type:function size:0xF8
|
||||
AOSSThread_813FCC8C__Q33ipl5scene10AOSSThreadFv = .text:0x813FCC8C; // type:function size:0x58
|
||||
AOSSThread_813FCCE4__Q33ipl5scene10AOSSThreadFv = .text:0x813FCCE4; // type:function size:0x50
|
||||
AOSSThread_813FCC8C__Q33ipl5scene10AOSSThreadFUll = .text:0x813FCC8C; // type:function size:0x58
|
||||
AOSSThread_813FCCE4__Q33ipl5scene10AOSSThreadFUlPvl = .text:0x813FCCE4; // type:function size:0x50
|
||||
Run__Q33ipl5scene10AOSSThreadFv = .text:0x813FCD34; // type:function size:0xEC
|
||||
cancel__Q33ipl5scene10AOSSThreadFv = .text:0x813FCE20; // type:function size:0x50
|
||||
finish__Q33ipl5scene10AOSSThreadFP13NCDAossConfigPi = .text:0x813FCE70; // type:function size:0x2FC
|
||||
@@ -5146,7 +5146,7 @@ AOSSi_WLANConnect = .text:0x813FD72C; // type:function size:0x26C
|
||||
AOSSi_Sleep = .text:0x813FD998; // type:function size:0x4
|
||||
AOSSi_Status = .text:0x813FD99C; // type:function size:0x34
|
||||
AOSS_SetCallback = .text:0x813FD9D0; // type:function size:0x34
|
||||
RakuRakuThread_813FDA04__Q33ipl5scene14RakuRakuThreadFv = .text:0x813FDA04; // type:function size:0x6C scope:local
|
||||
RakuRakuThread_813FDA04__Q33ipl5scene14RakuRakuThreadFPUl = .text:0x813FDA04; // type:function size:0x6C scope:local
|
||||
__ct__Q33ipl5scene14RakuRakuThreadFPQ23EGG4Heap = .text:0x813FDA70; // type:function size:0xD8
|
||||
__dt__Q33ipl5scene14RakuRakuThreadFv = .text:0x813FDB48; // type:function size:0xA4
|
||||
destroy__Q33ipl5scene14RakuRakuThreadFv = .text:0x813FDBEC; // type:function size:0xD8
|
||||
@@ -17078,7 +17078,7 @@ lbl_81657B18 = .data:0x81657B18; // type:object size:0x1A data:string
|
||||
lbl_81657B32 = .data:0x81657B32; // type:object size:0x18 data:string
|
||||
lbl_81657B4A = .data:0x81657B4A; // type:object size:0x16 data:string
|
||||
__vt__Q33ipl5scene10AOSSThread = .data:0x81657B60; // type:object size:0x30
|
||||
lbl_81657B90 = .data:0x81657B90; // type:object size:0x30
|
||||
sRateTable = .data:0x81657B90; // type:object size:0x30
|
||||
lbl_81657BC0 = .data:0x81657BC0; // type:object size:0x38 data:string
|
||||
jumptable_81657BF8 = .data:0x81657BF8; // type:object size:0x20 scope:local
|
||||
__vt__Q33ipl5scene14RakuRakuThread = .data:0x81657C18; // type:object size:0x30
|
||||
@@ -23472,14 +23472,14 @@ lbl_81698C28 = .sbss:0x81698C28; // type:object size:0x4 data:4byte
|
||||
lbl_81698C2C = .sbss:0x81698C2C; // type:object size:0x4 data:4byte
|
||||
lbl_81698C30 = .sbss:0x81698C30; // type:object size:0x4 data:4byte
|
||||
AOSSi_cancel_flag = .sbss:0x81698C38; // type:object size:0x4 data:4byte
|
||||
lbl_81698C3C = .sbss:0x81698C3C; // type:object size:0x4
|
||||
lbl_81698C40 = .sbss:0x81698C40; // type:object size:0x4
|
||||
lbl_81698C44 = .sbss:0x81698C44; // type:object size:0x4
|
||||
lbl_81698C48 = .sbss:0x81698C48; // type:object size:0x4
|
||||
lbl_81698C4C = .sbss:0x81698C4C; // type:object size:0x4
|
||||
lbl_81698C50 = .sbss:0x81698C50; // type:object size:0x4 data:4byte
|
||||
lbl_81698C54 = .sbss:0x81698C54; // type:object size:0x4 data:4byte
|
||||
lbl_81698C58 = .sbss:0x81698C58; // type:object size:0x4 data:4byte
|
||||
AOSSi_ipAddr = .sbss:0x81698C3C; // type:object size:0x4
|
||||
AOSSi_netmask = .sbss:0x81698C40; // type:object size:0x4
|
||||
AOSSi_gateway = .sbss:0x81698C44; // type:object size:0x4
|
||||
AOSSi_dns1 = .sbss:0x81698C48; // type:object size:0x4
|
||||
AOSSi_dns2 = .sbss:0x81698C4C; // type:object size:0x4
|
||||
AOSSi_alloc = .sbss:0x81698C50; // type:object size:0x4 data:4byte
|
||||
AOSSi_free = .sbss:0x81698C54; // type:object size:0x4 data:4byte
|
||||
AOSSi_callback = .sbss:0x81698C58; // type:object size:0x4 data:4byte
|
||||
lbl_81698C60 = .sbss:0x81698C60; // type:object size:0x4 data:4byte
|
||||
lbl_81698C64 = .sbss:0x81698C64; // type:object size:0x4 data:4byte
|
||||
lbl_81698C68 = .sbss:0x81698C68; // type:object size:0x1 data:byte
|
||||
|
||||
@@ -93,7 +93,11 @@ namespace textinput {
|
||||
void initAspect();
|
||||
#endif
|
||||
|
||||
#ifdef IPL_TI_MANAGER_OUT_OF_LINE
|
||||
virtual void setSecretInputMode(bool secretInputMode);
|
||||
#else
|
||||
virtual void setSecretInputMode(bool secretInputMode) { mpInputForm->setSecretModeOn(secretInputMode); }
|
||||
#endif
|
||||
#ifdef IPL_ADDRESS_EDIT_CPP
|
||||
void enableKSXFilter(bool compatibleFilter);
|
||||
#endif
|
||||
@@ -106,7 +110,11 @@ namespace textinput {
|
||||
virtual void start() {}
|
||||
virtual void end() {}
|
||||
|
||||
#ifdef IPL_TI_MANAGER_OUT_OF_LINE
|
||||
virtual InputForm* getInputForm();
|
||||
#else
|
||||
virtual InputForm* getInputForm() { return mpInputForm; }
|
||||
#endif
|
||||
virtual const InputForm* getInputForm() const { return mpInputForm; }
|
||||
|
||||
virtual keyboard::hwkey::HWKeyboard* getHWKeyboard() { return mpHWKeyboard; }
|
||||
|
||||
@@ -55,7 +55,11 @@ namespace textinput {
|
||||
|
||||
virtual nw4r::math::VEC2 getScale() const = 0;
|
||||
|
||||
#ifdef IPL_TI_TEXTDRAWER_OUT_OF_LINE
|
||||
virtual void setSecretModeOn(bool secretMode);
|
||||
#else
|
||||
virtual void setSecretModeOn(bool secretMode) { mbSecretMode = secretMode; }
|
||||
#endif
|
||||
|
||||
virtual void doBeforeDrawProcess(const wchar_t*, u32, const DrawInfo& drawInfo);
|
||||
virtual void doAfterDrawProcess(const wchar_t*, u32, const DrawInfo& drawInfo);
|
||||
|
||||
@@ -56,10 +56,16 @@ namespace gui {
|
||||
|
||||
virtual void onEvent(u32 compId, u32 event, void* data) {} // 0x08 (0x02)
|
||||
|
||||
#ifdef IPL_GUI_VIRTS_OUT_OF_LINE
|
||||
virtual void setManager(Manager* manager); // 0x0C (0x03)
|
||||
virtual void setLatestEventCtrlNo(int ctrlNo); // 0x10 (0x04)
|
||||
virtual int getLatestEventCtrlNo(); // 0x14 (0x05)
|
||||
#else
|
||||
virtual void setManager(Manager* manager) { mpManager = manager; } // 0x0C (0x03)
|
||||
|
||||
virtual void setLatestEventCtrlNo(int ctrlNo) { mLatestCtrlNum = ctrlNo; } // 0x10 (0x04)
|
||||
virtual int getLatestEventCtrlNo() { return mLatestCtrlNum; } // 0x14 (0x05)
|
||||
#endif
|
||||
|
||||
protected:
|
||||
Manager* mpManager; // 0x04
|
||||
@@ -85,7 +91,11 @@ namespace gui {
|
||||
virtual bool isPointed(int point) { return mbPointed[point]; } // 0x24 (0x09)
|
||||
virtual bool isDragging(int point) { return mbDragging[point]; } // 0x28 (0x0A)
|
||||
|
||||
#ifdef IPL_GUI_VIRTS_OUT_OF_LINE
|
||||
virtual void setPointed(int point, bool bEnable); // 0x2C (0x0B)
|
||||
#else
|
||||
virtual void setPointed(int point, bool bEnable) { mbPointed[point] = bEnable; } // 0x2C (0x0B)
|
||||
#endif
|
||||
|
||||
virtual void onPoint(int point) { mFlightDuration[point] = 0; } // 0x30 (0x0C)
|
||||
virtual void offPoint(int point) { mFlightDuration[point] = 0; } // 0x34 (0x0D)
|
||||
@@ -252,7 +262,11 @@ namespace gui {
|
||||
virtual bool contain(f32 x, f32 y); // 0x68 (0x1A)
|
||||
|
||||
virtual void setPane(nw4r::lyt::Pane* pane) { mpPane = pane; } // 0x6C (0x1B)
|
||||
#ifdef IPL_GUI_VIRTS_OUT_OF_LINE
|
||||
virtual nw4r::lyt::Pane* getPane(); // 0x70 (0x1C)
|
||||
#else
|
||||
virtual nw4r::lyt::Pane* getPane() { return mpPane; } // 0x70 (0x1C)
|
||||
#endif
|
||||
|
||||
private:
|
||||
nw4r::lyt::Pane* mpPane; // 0x88
|
||||
|
||||
@@ -31,6 +31,11 @@ namespace ipl {
|
||||
|
||||
virtual void calc();
|
||||
|
||||
#ifdef IPL_FADER_SCENE_BASE_VIRTS_OUT_OF_LINE
|
||||
virtual void initCalcNormal(); // 0x4C
|
||||
virtual void initCalcFadeout(); // 0x50
|
||||
virtual void calcCommon(); // 0x54
|
||||
#else
|
||||
virtual void initCalcNormal() {
|
||||
} // 0x4C
|
||||
virtual void initCalcFadeout() {
|
||||
@@ -38,6 +43,7 @@ namespace ipl {
|
||||
|
||||
virtual void calcCommon() {
|
||||
} // 0x54
|
||||
#endif
|
||||
|
||||
virtual FaderSceneCommand calcFadein() {
|
||||
return FADER_SCN_NEXT;
|
||||
@@ -49,8 +55,12 @@ namespace ipl {
|
||||
return FADER_SCN_NEXT;
|
||||
} // 0x60
|
||||
|
||||
#ifdef IPL_FADER_SCENE_BASE_VIRTS_OUT_OF_LINE
|
||||
virtual void calcCommonAfter(); // 0x64
|
||||
#else
|
||||
virtual void calcCommonAfter() {
|
||||
} // 0x64
|
||||
#endif
|
||||
|
||||
int getSceneFadeState() {
|
||||
return mScnFadeState;
|
||||
|
||||
@@ -62,14 +62,26 @@ namespace ipl {
|
||||
virtual ~Base();
|
||||
|
||||
/** @brief If the scene is ready */
|
||||
#ifdef IPL_SCENE_BASE_VIRTS_OUT_OF_LINE
|
||||
virtual BOOL isReady() const;
|
||||
#else
|
||||
virtual BOOL isReady() const { return FALSE; }
|
||||
#endif
|
||||
|
||||
/** @brief If the user can power off/reset the system */
|
||||
virtual BOOL isResetAcceptable() const { return TRUE; }
|
||||
/** @brief The scene running code when powering off/resetting the system */
|
||||
#ifdef IPL_SCENE_BASE_VIRTS_OUT_OF_LINE
|
||||
virtual void startResetting();
|
||||
#else
|
||||
virtual void startResetting() {}
|
||||
#endif
|
||||
/** @brief If the scene has finished its powering off/resetting task */
|
||||
#ifdef IPL_SCENE_BASE_VIRTS_OUT_OF_LINE
|
||||
virtual BOOL isResetProcessDone();
|
||||
#else
|
||||
virtual BOOL isResetProcessDone() { return TRUE; }
|
||||
#endif
|
||||
|
||||
/** @brief Prepare to create scene */
|
||||
virtual void prepare() {}
|
||||
@@ -82,10 +94,17 @@ namespace ipl {
|
||||
/** @brief Destroy the scene and clear from memory */
|
||||
virtual void destroy() {}
|
||||
|
||||
#ifdef IPL_SCENE_BASE_VIRTS_OUT_OF_LINE
|
||||
virtual Base* getParent();
|
||||
virtual Base* getChild();
|
||||
virtual Base* getNext();
|
||||
virtual Base* getPrev();
|
||||
#else
|
||||
virtual Base* getParent() { return (Base*)mpParent; }
|
||||
virtual Base* getChild() { return (Base*)mpChild; }
|
||||
virtual Base* getNext() { return (Base*)mpNext; }
|
||||
virtual Base* getPrev() { return (Base*)mpPrev; }
|
||||
#endif
|
||||
|
||||
/** @brief Check if scene has been created.*/
|
||||
bool isSceneCreated() const { return (mScnState & SCN_STATE_CREATED); }
|
||||
|
||||
@@ -28,16 +28,7 @@ namespace ipl {
|
||||
#ifdef IPL_SETTING_IMPLEMENTATION
|
||||
class Setting;
|
||||
class APScanThread;
|
||||
|
||||
class APEvent : public ::gui::EventHandler {
|
||||
public:
|
||||
APEvent(Setting* setting) : ::gui::EventHandler(), mpSetting(setting) {}
|
||||
|
||||
virtual void onEvent(u32 componentID, u32 event, void* data);
|
||||
|
||||
private:
|
||||
Setting* mpSetting;
|
||||
};
|
||||
class APEvent;
|
||||
|
||||
struct SettingAnimation {
|
||||
u8 unknown[0x14];
|
||||
@@ -116,7 +107,7 @@ namespace ipl {
|
||||
void initScroll();
|
||||
void updateScroll();
|
||||
void setAPDraw();
|
||||
int getRadioLevel(const WDBssDesc_* descriptor);
|
||||
u8 getRadioLevel(const WDBssDesc_* descriptor);
|
||||
void setUseEULA_Init_();
|
||||
void setUseEULA_Cancel_();
|
||||
void setUseEULA_Start_();
|
||||
@@ -158,12 +149,48 @@ namespace ipl {
|
||||
virtual void destroy();
|
||||
virtual void prepare();
|
||||
virtual void create();
|
||||
virtual void calc();
|
||||
virtual void draw();
|
||||
virtual FaderSceneCommand calcFadein();
|
||||
virtual FaderSceneCommand calcNormal();
|
||||
virtual FaderSceneCommand calcFadeout();
|
||||
virtual BOOL isResetAcceptable() const;
|
||||
virtual void unkv_0x68() = 0;
|
||||
virtual void unkv_0x6C() = 0;
|
||||
virtual void unkv_0x70() = 0;
|
||||
virtual void unkv_0x74() = 0;
|
||||
virtual void unkv_0x78() = 0;
|
||||
virtual void unkv_0x7C() = 0;
|
||||
virtual void unkv_0x80() = 0;
|
||||
virtual void unkv_0x84() = 0;
|
||||
virtual void unkv_0x88() = 0;
|
||||
virtual void unkv_0x8C() = 0;
|
||||
virtual void unkv_0x90() = 0;
|
||||
virtual void unkv_0x94() = 0;
|
||||
virtual void unkv_0x98() = 0;
|
||||
virtual void unkv_0x9C() = 0;
|
||||
virtual void unkv_0xA0() = 0;
|
||||
virtual void unkv_0xA4() = 0;
|
||||
virtual void unkv_0xA8() = 0;
|
||||
virtual void unkv_0xAC() = 0;
|
||||
virtual void unkv_0xB0() = 0;
|
||||
virtual void unkv_0xB4() = 0;
|
||||
virtual void unkv_0xB8() = 0;
|
||||
virtual void unkv_0xBC() = 0;
|
||||
virtual void unkv_0xC0() = 0;
|
||||
virtual void unkv_0xC4() = 0;
|
||||
virtual void unkv_0xC8() = 0;
|
||||
virtual void unkv_0xCC() = 0;
|
||||
virtual void unkv_0xD0() = 0;
|
||||
virtual void unkv_0xD4() = 0;
|
||||
virtual void unkv_0xD8() = 0;
|
||||
virtual void unkv_0xDC() = 0;
|
||||
virtual void unkv_0xE0() = 0;
|
||||
virtual void unkv_0xE4() = 0;
|
||||
virtual void unkv_0xE8() = 0;
|
||||
virtual void unkv_0xEC() = 0;
|
||||
virtual void unkv_0xF0() = 0;
|
||||
virtual void unkv_0xF4() = 0;
|
||||
virtual void unkv_0xF8() = 0;
|
||||
#endif
|
||||
|
||||
u16 getProfileID();
|
||||
@@ -262,6 +289,18 @@ namespace ipl {
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#ifdef IPL_SETTING_IMPLEMENTATION
|
||||
class APEvent : public ::gui::EventHandler {
|
||||
public:
|
||||
APEvent(Setting* setting) : ::gui::EventHandler(), mpSetting(setting) {}
|
||||
|
||||
virtual void onEvent(u32 componentID, u32 event, void* data);
|
||||
|
||||
private:
|
||||
Setting* mpSetting;
|
||||
};
|
||||
#endif
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
|
||||
|
||||
@@ -50,10 +50,17 @@ namespace ipl {
|
||||
} KeyboardType;
|
||||
|
||||
typedef struct KeyboardSetting {
|
||||
#ifdef IPL_SETTING_IMPLEMENTATION
|
||||
u32 rowLimit; // 0x00
|
||||
const wchar_t* wcString; // 0x04
|
||||
u32 stringLimit; // 0x08
|
||||
KeyboardType type; // 0x0C
|
||||
#else
|
||||
KeyboardType type; // 0x00
|
||||
const wchar_t* wcString; // 0x04
|
||||
u32 stringLimit; // 0x08
|
||||
u32 rowLimit; // 0x0C
|
||||
#endif
|
||||
#ifdef IPL_ADDRESS_EDIT_CPP
|
||||
KeyboardSetting(KeyboardType keyboardType, const wchar_t* value, u32 limit, u32 rows);
|
||||
#endif
|
||||
|
||||
@@ -15,9 +15,10 @@ namespace ipl {
|
||||
const wchar_t* getMessage(u32 id) const { return mpMessage->getMessage(id); }
|
||||
void setResource(u8* msgData) const { mpMessage->setResource(msgData); }
|
||||
|
||||
private:
|
||||
void initMessage();
|
||||
|
||||
private:
|
||||
|
||||
Message* mpMessage; // 0x00
|
||||
};
|
||||
} // namespace message
|
||||
|
||||
@@ -56,6 +56,7 @@ namespace ipl {
|
||||
void stop() { mState = ANIM_STATE_STOP; }
|
||||
|
||||
bool isPlaying() const { return mState == ANIM_STATE_PLAY; }
|
||||
bool isPlaying() const volatile { return mState == ANIM_STATE_PLAY; }
|
||||
|
||||
protected:
|
||||
f32 mMaxFrame; // 0x04
|
||||
|
||||
@@ -48,7 +48,12 @@ namespace nw4r {
|
||||
Pane(const res::Pane* pBlock);
|
||||
virtual ~Pane(); // 0x08
|
||||
|
||||
#ifdef IPL_LYT_PANE_RTTI_OUT_OF_LINE
|
||||
virtual const nw4r::ut::detail::RuntimeTypeInfo* GetRuntimeTypeInfo() const;
|
||||
static const nw4r::ut::detail::RuntimeTypeInfo typeInfo;
|
||||
#else
|
||||
NW4R_UT_RUNTIME_TYPEINFO;
|
||||
#endif
|
||||
|
||||
virtual void CalculateMtx(const DrawInfo& drawInfo); // 0x10
|
||||
|
||||
@@ -105,7 +110,11 @@ namespace nw4r {
|
||||
void SetSize(const Size& size) { mSize = size; }
|
||||
|
||||
bool IsVisible() { return detail::TestBit(mFlag, BIT_VISIBLE); };
|
||||
#ifdef IPL_LYT_PANE_SETVISIBLE_OUT_OF_LINE
|
||||
void SetVisible(bool visible);
|
||||
#else
|
||||
void SetVisible(bool visible) { detail::SetBit(&mFlag, BIT_VISIBLE, visible); };
|
||||
#endif
|
||||
|
||||
bool IsInfluencedAlpha() { return detail::TestBit(mFlag, BIT_INFLUENCED_ALPHA); };
|
||||
void SetInfluencedAlpha(bool visible) { detail::SetBit(&mFlag, BIT_INFLUENCED_ALPHA, visible); };
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
425
src/scene/setting/AOSSLink.c
Normal file
425
src/scene/setting/AOSSLink.c
Normal file
@@ -0,0 +1,425 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <revolution/types.h>
|
||||
#include <revolution/os.h>
|
||||
#include <revolution/soex.h>
|
||||
|
||||
void OSSetAlarm();
|
||||
|
||||
s32 NCDLockWirelessDriver(void);
|
||||
s32 NCDUnlockWirelessDriver(s32 id);
|
||||
s32 NCDSetIpConfig(void* ipConfig);
|
||||
s32 NCDSetIfConfig(void* ifConfig);
|
||||
BOOL NCDIsInterfaceDecided(void);
|
||||
|
||||
s32 WD_Startup(u32 flags);
|
||||
s32 WD_Cleanup(void);
|
||||
s32 WD_Scan(void* params, u8* buffer, u32 bufferLen);
|
||||
s32 WD_GetInfo(void* info);
|
||||
|
||||
static u8 sConf[352];
|
||||
static u8 sIpConfig[1992];
|
||||
|
||||
static void (*AOSSi_callback)(void);
|
||||
static void (*AOSSi_free)(u32 id, void* ptr, s32 size);
|
||||
static void* (*AOSSi_alloc)(u32 id, s32 size);
|
||||
static u32 AOSSi_dns2;
|
||||
static u32 AOSSi_dns1;
|
||||
static u32 AOSSi_gateway;
|
||||
static u32 AOSSi_netmask;
|
||||
static u32 AOSSi_ipAddr;
|
||||
static s32 AOSSi_cancel_flag;
|
||||
|
||||
static u16 sRateTable[12][2] = {
|
||||
{0x0001, 0x0200}, {0x0002, 0x0400}, {0x0004, 0x0B00},
|
||||
{0x0008, 0x0C00}, {0x0010, 0x1200}, {0x0020, 0x1600},
|
||||
{0x0040, 0x1800}, {0x0080, 0x2400}, {0x0100, 0x3000},
|
||||
{0x0200, 0x4800}, {0x0400, 0x6000}, {0x0800, 0x6C00},
|
||||
};
|
||||
|
||||
void AOSSi_Cancel(void) {
|
||||
AOSSi_cancel_flag = 1;
|
||||
}
|
||||
|
||||
static void AOSS_813FD17C(OSAlarm* alarm, OSContext* context) {
|
||||
OSSendMessage((OSMessageQueue*)alarm->tag, NULL, FALSE);
|
||||
}
|
||||
|
||||
static void AOSS_813FD18C(u32 ms) {
|
||||
OSMessage queueBuffer;
|
||||
OSMessage message;
|
||||
OSMessageQueue queue;
|
||||
OSAlarm alarm;
|
||||
|
||||
OSInitMessageQueue(&queue, &queueBuffer, 1);
|
||||
OSCreateAlarm(&alarm);
|
||||
OSSetAlarmTag(&alarm, (u32)&queue);
|
||||
OSSetAlarm(&alarm, *(u32*)0x800000F8 >> 2, 0, ms * (OS_TIMER_CLOCK / 1000), AOSS_813FD17C);
|
||||
OSReceiveMessage(&queue, &message, TRUE);
|
||||
}
|
||||
|
||||
typedef struct WD_Info_ {
|
||||
u8 MAC[6];
|
||||
u16 enableChannel;
|
||||
u16 NTRallowedChannel;
|
||||
u8 countryCode[4];
|
||||
u8 channel;
|
||||
u8 initialized;
|
||||
u8 version[80];
|
||||
u8 unk_0x60[0x30];
|
||||
} WD_Info;
|
||||
|
||||
typedef struct WDScanParam_ {
|
||||
u16 channelBit;
|
||||
u16 maxChannelTime;
|
||||
u8 bssid[6];
|
||||
u16 type;
|
||||
u16 ssidLength;
|
||||
u8 ssid[32];
|
||||
u8 ssidMask[32];
|
||||
} WDScanParam;
|
||||
|
||||
typedef struct WDBssDesc_ {
|
||||
u16 length;
|
||||
u16 rssi;
|
||||
u8 bssid[6];
|
||||
u16 ssidLength;
|
||||
u8 ssid[32];
|
||||
u16 capabilities;
|
||||
struct {
|
||||
u16 basic;
|
||||
u16 support;
|
||||
} rateSet;
|
||||
u16 beaconPeriod;
|
||||
u16 dtimPeriod;
|
||||
u16 channel;
|
||||
u16 cfPeriod;
|
||||
u16 cfMaxDuration;
|
||||
u16 ieLength;
|
||||
} WDBssDesc;
|
||||
|
||||
void* AOSSi_Alloc(s32 size) {
|
||||
if (AOSSi_alloc != NULL) {
|
||||
return AOSSi_alloc(0, size);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void AOSSi_Free(void* ptr) {
|
||||
if (AOSSi_free != NULL) {
|
||||
AOSSi_free(0, ptr, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void AOSS_813FD25C(u8* dst, u32 val) {
|
||||
int i;
|
||||
for (i = 0; i < 4; i++) {
|
||||
dst[i] = val >> ((3 - i) * 8);
|
||||
}
|
||||
}
|
||||
|
||||
s32 AOSSi_SetNCDIPAddr(u32 ip, u32 mask, u32 gateway, u32 dns1, u32 dns2) {
|
||||
AOSS_813FD25C((u8*)&AOSSi_ipAddr, ip);
|
||||
AOSS_813FD25C((u8*)&AOSSi_netmask, mask);
|
||||
AOSS_813FD25C((u8*)&AOSSi_gateway, gateway);
|
||||
AOSS_813FD25C((u8*)&AOSSi_dns1, dns1);
|
||||
AOSS_813FD25C((u8*)&AOSSi_dns2, dns2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 AOSSi_InitLocal(void* (*alloc)(u32 id, s32 size),
|
||||
void (*free_)(u32 id, void* ptr, s32 size)) {
|
||||
BOOL level;
|
||||
|
||||
if (alloc == NULL || free_ == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
level = OSDisableInterrupts();
|
||||
AOSSi_alloc = alloc;
|
||||
AOSSi_free = free_;
|
||||
AOSSi_cancel_flag = 0;
|
||||
OSRestoreInterrupts(level);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 AOSSi_EndLocal(void) {
|
||||
BOOL level;
|
||||
|
||||
level = OSDisableInterrupts();
|
||||
AOSSi_alloc = NULL;
|
||||
AOSSi_free = NULL;
|
||||
OSRestoreInterrupts(level);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 AOSSi_WLANGetBSSList(u32** out) {
|
||||
u8 mac[6];
|
||||
WDScanParam ATTRIBUTE_ALIGN(32) req;
|
||||
WD_Info ATTRIBUTE_ALIGN(32) info;
|
||||
u8* buf;
|
||||
u32* list;
|
||||
u8* src;
|
||||
u8* dst;
|
||||
int count;
|
||||
int i;
|
||||
int j;
|
||||
int n;
|
||||
s32 result = -1;
|
||||
int retry = 0;
|
||||
int uretry = 0;
|
||||
int cretry = 0;
|
||||
int rescan = 0;
|
||||
s32 lock;
|
||||
s32 err;
|
||||
|
||||
if (AOSSi_alloc == 0 || AOSSi_free == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
lock = NCDLockWirelessDriver();
|
||||
if (lock <= 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (WD_Startup(3) == 0) {
|
||||
break;
|
||||
}
|
||||
if (retry > 10) {
|
||||
goto unlock;
|
||||
}
|
||||
retry++;
|
||||
AOSS_813FD18C(10);
|
||||
}
|
||||
|
||||
if (WD_GetInfo(&info) == 0) {
|
||||
memcpy(mac, info.MAC, 6);
|
||||
}
|
||||
|
||||
buf = AOSSi_Alloc(0x3200);
|
||||
if (buf == 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
memset(buf, 0, 0x3200);
|
||||
|
||||
req.channelBit = info.enableChannel;
|
||||
req.maxChannelTime = 0x28;
|
||||
memset(req.bssid, 0xFF, 6);
|
||||
req.type = 0;
|
||||
req.ssidLength = 0;
|
||||
memset(req.ssid, 0, 0x20);
|
||||
memset(req.ssidMask, 0xFF, 0x20);
|
||||
|
||||
scan:
|
||||
err = WD_Scan(&req, buf, 0x3200);
|
||||
if (err != 0 && (u32)(err - 0x80000000) != 0x8004) {
|
||||
goto free;
|
||||
}
|
||||
|
||||
count = *(u16*)buf;
|
||||
if (count == 0) {
|
||||
goto rescan;
|
||||
}
|
||||
|
||||
list = AOSSi_Alloc((count - 1) * 0x54 + 0x58);
|
||||
if (list == 0) {
|
||||
result = -1;
|
||||
goto free;
|
||||
}
|
||||
list[0] = count;
|
||||
|
||||
src = buf + 2;
|
||||
dst = (u8*)list;
|
||||
for (i = 0; i < count; i++) {
|
||||
u32 off = i * 0x54;
|
||||
*(u32*)(dst + off + 4) = ((WDBssDesc*)src)->ssidLength;
|
||||
memcpy(dst + off + 8, ((WDBssDesc*)src)->ssid, 0x20);
|
||||
*(u32*)(dst + off + 0x28) = ((WDBssDesc*)src)->channel;
|
||||
memcpy(dst + off + 0x34, ((WDBssDesc*)src)->bssid, 6);
|
||||
|
||||
n = 0;
|
||||
for (j = 0; j < 12; j++) {
|
||||
if (((WDBssDesc*)src)->rateSet.support & sRateTable[j][0]) {
|
||||
dst[off + 0x40 + n] = ((u8*)sRateTable)[j * 4 + 2];
|
||||
if (((WDBssDesc*)src)->rateSet.basic & sRateTable[j][0]) {
|
||||
dst[off + 0x40 + n] |= 0x80;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
}
|
||||
*(u32*)(dst + off + 0x3C) = n;
|
||||
|
||||
*(u32*)(dst + off + 0x50) = ((WDBssDesc*)src)->beaconPeriod;
|
||||
if ((((WDBssDesc*)src)->capabilities & 3) == 1) {
|
||||
*(u32*)(dst + off + 0x54) = 1;
|
||||
}
|
||||
else if ((((WDBssDesc*)src)->capabilities & 3) == 2) {
|
||||
*(u32*)(dst + off + 0x54) = 2;
|
||||
}
|
||||
else {
|
||||
*(u32*)(dst + off + 0x54) = 0;
|
||||
}
|
||||
|
||||
src += ((WDBssDesc*)src)->length * 2;
|
||||
}
|
||||
|
||||
*out = list;
|
||||
result = 0;
|
||||
goto free;
|
||||
|
||||
rescan:
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
result = -1;
|
||||
goto free;
|
||||
}
|
||||
rescan++;
|
||||
if (rescan > 10) {
|
||||
list = AOSSi_Alloc(0x58);
|
||||
if (list == 0) {
|
||||
result = -1;
|
||||
goto free;
|
||||
}
|
||||
list[0] = 0;
|
||||
result = 0;
|
||||
*out = list;
|
||||
goto free;
|
||||
}
|
||||
AOSS_813FD18C(100);
|
||||
goto scan;
|
||||
|
||||
free:
|
||||
if (AOSSi_free != 0) {
|
||||
AOSSi_free(0, buf, 0);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
while (WD_Cleanup() != 0) {
|
||||
if (cretry > 10) {
|
||||
result = -1;
|
||||
break;
|
||||
}
|
||||
cretry++;
|
||||
AOSS_813FD18C(10);
|
||||
}
|
||||
|
||||
unlock:
|
||||
while (NCDUnlockWirelessDriver(lock) != 0) {
|
||||
if (uretry > 10) {
|
||||
result = -1;
|
||||
break;
|
||||
}
|
||||
uretry++;
|
||||
AOSS_813FD18C(10);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
s32 AOSSi_WLANConnect(u32* in, u32* out) {
|
||||
WD_Info ATTRIBUTE_ALIGN(32) info;
|
||||
int count = 0;
|
||||
int ret;
|
||||
u8* conf = sConf;
|
||||
u8* ipcfg;
|
||||
|
||||
memset(conf, 0, 0x15E);
|
||||
conf[0] = 1;
|
||||
*(u16*)(conf + 2) = 0;
|
||||
conf[4] = 0;
|
||||
|
||||
if (in[0x28 / 4] == 0) {
|
||||
*(u16*)(conf + 0x2A) = 0;
|
||||
}
|
||||
if (in[0x28 / 4] == 5) {
|
||||
*(u16*)(conf + 0x2A) = 1;
|
||||
*(u16*)(conf + 0x2E) = 0;
|
||||
memcpy(conf + 0x32, (u8*)in + 0x2C, in[0x28 / 4]);
|
||||
}
|
||||
else if (in[0x28 / 4] == 0xD) {
|
||||
*(u16*)(conf + 0x2A) = 2;
|
||||
*(u16*)(conf + 0x2E) = 0;
|
||||
memcpy(conf + 0x32, (u8*)in + 0x2C, in[0x28 / 4]);
|
||||
}
|
||||
else if (in[0x28 / 4] == 0x10) {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*(u16*)(conf + 0x26) = in[0] & 0xFF;
|
||||
memcpy(conf + 6, (u8*)in + 4, in[0]);
|
||||
|
||||
ipcfg = sIpConfig;
|
||||
ret = 0;
|
||||
memset(ipcfg, 0, 0x7C4);
|
||||
*(u32*)(ipcfg + 0x1C) = 0x514;
|
||||
*(u32*)(ipcfg + 0x20) = 0x64;
|
||||
*(u32*)(ipcfg + 0x24) = 4;
|
||||
*(u32*)(ipcfg + 0) = 0;
|
||||
*(u32*)(ipcfg + 4) = 0;
|
||||
memcpy(ipcfg + 8, &AOSSi_ipAddr, 4);
|
||||
memcpy(ipcfg + 0xC, &AOSSi_netmask, 4);
|
||||
memcpy(ipcfg + 0x10, &AOSSi_gateway, 4);
|
||||
memcpy(ipcfg + 0x14, &AOSSi_dns1, 4);
|
||||
memcpy(ipcfg + 0x18, &AOSSi_dns2, 4);
|
||||
|
||||
if (NCDSetIpConfig(sIpConfig) != 0) {
|
||||
ret = -1;
|
||||
}
|
||||
if (ret == 0 && NCDSetIfConfig(sConf) != 0) {
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
while (!NCDIsInterfaceDecided()) {
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
if (count > 0x258) {
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
AOSS_813FD18C(10);
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
out[0] = 1;
|
||||
if (WD_GetInfo(&info) == 0) {
|
||||
out[0x28 / 4] = info.channel;
|
||||
}
|
||||
{
|
||||
u32 len = *(u16*)(conf + 0x26);
|
||||
out[4 / 4] = len;
|
||||
memcpy((u8*)out + 8, conf + 6, len);
|
||||
}
|
||||
}
|
||||
else {
|
||||
out[0] = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void AOSSi_Sleep(u32 ms) {
|
||||
AOSS_813FD18C(ms);
|
||||
}
|
||||
|
||||
s32 AOSSi_Status(void) {
|
||||
if (AOSSi_callback != NULL) {
|
||||
AOSSi_callback();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AOSS_SetCallback(void (*callback)(void)) {
|
||||
BOOL level;
|
||||
|
||||
level = OSDisableInterrupts();
|
||||
AOSSi_callback = callback;
|
||||
OSRestoreInterrupts(level);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
361
src/scene/setting/iplRakuRakuThread.cpp
Normal file
361
src/scene/setting/iplRakuRakuThread.cpp
Normal file
@@ -0,0 +1,361 @@
|
||||
#include <revolution/os.h>
|
||||
#include <revolution/soex.h>
|
||||
#include <revolution/mem.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include <revolution/ncd/NCDTypes.h>
|
||||
|
||||
#include "utility/iplThread.h"
|
||||
#include "egg/core/eggHeap.h"
|
||||
|
||||
extern "C" {
|
||||
u32 ATERMi_ApConfigGetVersion(void);
|
||||
s32 ATERMi_ApConfigStart(s32 priority, u32 size, void (*callback)(u32* data),
|
||||
void* (*alloc)(u32 size), void (*free_)(u32 size),
|
||||
u32 stackSize);
|
||||
s32 ATERMi_ApConfigGetState(u32* state);
|
||||
s32 ATERMi_ApConfigEnd(void);
|
||||
s32 ATERMi_ApConfigGetResult(void* result);
|
||||
}
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
extern "C" {
|
||||
static void* RakuRakuThread_813FDEF0(u32 id, s32 size);
|
||||
static void RakuRakuThread_813FDEFC(u32 id, void* ptr, s32 align);
|
||||
static void* RakuRakuThread_813FDF08(u32 size);
|
||||
static void RakuRakuThread_813FDF18(u32 size);
|
||||
}
|
||||
|
||||
typedef struct ATERMResult {
|
||||
char ssid[0x20]; // 0x00
|
||||
s32 type; // 0x20
|
||||
u32 keyId; // 0x24
|
||||
u8 keys[4][0x20]; // 0x28
|
||||
char key[0x40]; // 0xA8
|
||||
} ATERMResult; // 0xE8
|
||||
|
||||
typedef struct RakuRakuWork {
|
||||
u32 state; // 0x00
|
||||
u32 unk_0x04; // 0x04
|
||||
s32 result; // 0x08
|
||||
ATERMResult data; // 0x0C
|
||||
} RakuRakuWork; // 0xF4
|
||||
|
||||
typedef struct QueueWork {
|
||||
OSMessageQueue queue; // 0x00
|
||||
OSMessage msg; // 0x20
|
||||
} QueueWork; // 0x24
|
||||
|
||||
MEMAllocator mAllocator;
|
||||
RakuRakuWork mWork;
|
||||
QueueWork mQueue;
|
||||
|
||||
static u32 sStartTimeHi;
|
||||
static u32 sStartTimeLo;
|
||||
static u8 sStarted;
|
||||
static OSMessage sMsgArray;
|
||||
static s32 sState = 1;
|
||||
|
||||
class RakuRakuThread : public utility::ut_thread {
|
||||
public:
|
||||
RakuRakuThread(EGG::Heap* heap);
|
||||
|
||||
virtual ~RakuRakuThread(); // 0x08
|
||||
virtual void* Run(); // 0x0C
|
||||
virtual void unk_0x2C() = 0; // 0x2C
|
||||
|
||||
static void RakuRakuThread_813FDA04(u32* data);
|
||||
|
||||
void destroy();
|
||||
int start();
|
||||
int getState();
|
||||
void cancel();
|
||||
int finish(NCDApConfig* config, int* result);
|
||||
void printInfo();
|
||||
|
||||
private:
|
||||
s32 mUnk_0x32C; // 0x32C
|
||||
s32 mEndFlag; // 0x330
|
||||
s32 mCreated; // 0x334
|
||||
s32 mThreadPriority; // 0x338
|
||||
u8* mpWorkBuffer; // 0x33C
|
||||
u8* mpStackBuffer; // 0x340
|
||||
MEMHeapHandle mpExpHeap; // 0x344
|
||||
};
|
||||
|
||||
void RakuRakuThread::RakuRakuThread_813FDA04(u32* data) {
|
||||
BOOL level = OSDisableInterrupts();
|
||||
mWork.state = data[0];
|
||||
mWork.unk_0x04 = data[1];
|
||||
mWork.result = data[2];
|
||||
OSTime t = OSGetTime();
|
||||
sStartTimeLo = (u32)t;
|
||||
sStartTimeHi = (u32)(t >> 32);
|
||||
OSRestoreInterrupts(level);
|
||||
}
|
||||
|
||||
RakuRakuThread::RakuRakuThread(EGG::Heap* heap) : utility::ut_thread() {
|
||||
u32 version = ATERMi_ApConfigGetVersion();
|
||||
|
||||
if ((((version >> 12) & 0xF) * 10 + ((version >> 8) & 0xF)) != 1) {
|
||||
mpWorkBuffer = NULL;
|
||||
}
|
||||
else {
|
||||
mpWorkBuffer = (u8*)heap->alloc(0x40000, 0x20);
|
||||
mpStackBuffer = (u8*)heap->alloc(0x1000, 0x20);
|
||||
}
|
||||
|
||||
mpExpHeap = NULL;
|
||||
sStarted = 0;
|
||||
mEndFlag = 0;
|
||||
mCreated = 0;
|
||||
OSInitMessageQueue(&mQueue.queue, &sMsgArray, 1);
|
||||
}
|
||||
|
||||
RakuRakuThread::~RakuRakuThread() {
|
||||
if (mCreated != 0) {
|
||||
OSJamMessage(&mQueue.queue, (OSMessage)2, TRUE);
|
||||
WaitForThreadExit();
|
||||
}
|
||||
destroy();
|
||||
}
|
||||
|
||||
void RakuRakuThread::destroy() {
|
||||
if (sStarted != 0) {
|
||||
OSSendMessage(&mQueue.queue, (OSMessage)1, FALSE);
|
||||
u32 tick = OSGetTick();
|
||||
while ((u32)(OSGetTick() - tick) / (OS_TIMER_CLOCK / 1000)
|
||||
< 0x7D0)
|
||||
{
|
||||
u32 state[4];
|
||||
if (ATERMi_ApConfigGetState(state) == 1 && (s32)state[0] == 7) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
SOFinish();
|
||||
sStarted = 0;
|
||||
}
|
||||
|
||||
if (mpExpHeap != NULL) {
|
||||
MEMDestroyExpHeap(mpExpHeap);
|
||||
memset(&mAllocator, 0, 0x10);
|
||||
mpExpHeap = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int RakuRakuThread::start() {
|
||||
SOLibraryConfig config;
|
||||
MEMAllocator* alloc = &mAllocator;
|
||||
|
||||
if (sStarted != 0 || mpWorkBuffer == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL level = OSDisableInterrupts();
|
||||
OSTime t = OSGetTime();
|
||||
sStartTimeLo = (u32)t;
|
||||
sStartTimeHi = (u32)(t >> 32);
|
||||
|
||||
mpExpHeap = MEMCreateExpHeapEx(mpWorkBuffer, 0x40000, 2);
|
||||
MEMInitAllocatorForExpHeap(&mAllocator, mpExpHeap, 0x20);
|
||||
|
||||
mThreadPriority = OSGetThreadPriority(OSGetCurrentThread()) - 1;
|
||||
|
||||
sStarted = 1;
|
||||
mEndFlag = 0;
|
||||
memset((u8*)alloc + 0x1C, 0, 0xE8);
|
||||
memset((u8*)alloc + 0x10, 0, 0xC);
|
||||
|
||||
config.alloc = RakuRakuThread_813FDEF0;
|
||||
config.free = RakuRakuThread_813FDEFC;
|
||||
SOInit(&config);
|
||||
|
||||
ATERMi_ApConfigStart(mThreadPriority, 0xC8,
|
||||
RakuRakuThread_813FDA04,
|
||||
RakuRakuThread_813FDF08,
|
||||
RakuRakuThread_813FDF18, 0x1000);
|
||||
|
||||
if (mCreated == 0) {
|
||||
mCreated = 1;
|
||||
memset(mpStackBuffer, 0, 4);
|
||||
Create(mpStackBuffer, 0x1000, mThreadPriority - 1, TRUE);
|
||||
OSReport("RakuRakuThread (for End function) start with prio(%d) \n",
|
||||
mThreadPriority);
|
||||
}
|
||||
|
||||
OSRestoreInterrupts(level);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void* RakuRakuThread::Run() {
|
||||
u32 magic = 0x97654321;
|
||||
OSMessage msg;
|
||||
|
||||
for (;;) {
|
||||
while (OSReceiveMessage(&mQueue.queue, &msg, FALSE) != FALSE) {
|
||||
if ((s32)msg == 2) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
OSReceiveMessage(&mQueue.queue, &msg, TRUE);
|
||||
if ((s32)msg == 2) {
|
||||
break;
|
||||
}
|
||||
*(u32*)(mpStackBuffer + 0x3FC0) = magic;
|
||||
ATERMi_ApConfigEnd();
|
||||
mEndFlag = 1;
|
||||
if (mCreated == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
static void* RakuRakuThread_813FDEF0(u32 id, s32 size) {
|
||||
return MEMAllocFromAllocator(&mAllocator, size);
|
||||
}
|
||||
|
||||
static void RakuRakuThread_813FDEFC(u32 id, void* ptr, s32 align) {
|
||||
MEMFreeToAllocator(&mAllocator, ptr);
|
||||
}
|
||||
|
||||
static void* RakuRakuThread_813FDF08(u32 size) {
|
||||
return MEMAllocFromAllocator(&mAllocator, size);
|
||||
}
|
||||
|
||||
static void RakuRakuThread_813FDF18(u32 size) {
|
||||
MEMFreeToAllocator(&mAllocator, (void*)size);
|
||||
}
|
||||
}
|
||||
|
||||
int RakuRakuThread::getState() {
|
||||
if (sStarted == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL level = OSDisableInterrupts();
|
||||
|
||||
switch (mWork.state) {
|
||||
case 1:
|
||||
sState = 1;
|
||||
break;
|
||||
case 2:
|
||||
sState = 2;
|
||||
break;
|
||||
case 3:
|
||||
sState = 2;
|
||||
break;
|
||||
case 4:
|
||||
sState = 4;
|
||||
break;
|
||||
case 5:
|
||||
sState = 5;
|
||||
break;
|
||||
case 6:
|
||||
sState = 6;
|
||||
break;
|
||||
case 7:
|
||||
sState = 7;
|
||||
break;
|
||||
default:
|
||||
sState = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (sState != 6 && sState != 7) {
|
||||
if (((u32)OSGetTime() - (u32)sStartTimeLo)
|
||||
/ (OS_TIMER_CLOCK / 1000)
|
||||
>= 90000)
|
||||
{
|
||||
OSSendMessage(&mQueue.queue, (OSMessage)1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
OSRestoreInterrupts(level);
|
||||
return sState;
|
||||
}
|
||||
|
||||
void RakuRakuThread::cancel() {
|
||||
OSSendMessage(&mQueue.queue, (OSMessage)1, FALSE);
|
||||
}
|
||||
|
||||
int RakuRakuThread::finish(NCDApConfig* config, int* result) {
|
||||
u8* ws = (u8*)&mAllocator;
|
||||
RakuRakuWork* wk = (RakuRakuWork*)(ws + 0x10);
|
||||
|
||||
if (sStarted == 0) {
|
||||
if (result != NULL) {
|
||||
*result = -0x63;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((u32)(wk->state - 6) <= 1) {
|
||||
if (mEndFlag == 0) {
|
||||
if ((s32)wk->state == 6) {
|
||||
ATERMi_ApConfigGetResult(&wk->data);
|
||||
printInfo();
|
||||
}
|
||||
OSSendMessage((OSMessageQueue*)(ws + 0x104), (OSMessage)1, FALSE);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
SOFinish();
|
||||
sStarted = 0;
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (config != NULL) {
|
||||
memcpy(config->ssid, wk->data.ssid, 0x20);
|
||||
config->ssidLength = strlen(wk->data.ssid);
|
||||
|
||||
ATERMResult* data = &wk->data;
|
||||
|
||||
if (data->type == 1) {
|
||||
config->privacy.mode = 1;
|
||||
config->privacy.wep40.keyId = data->keyId;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
memcpy(config->privacy.wep40.key[i],
|
||||
data->keys[i], 5);
|
||||
}
|
||||
}
|
||||
else if (data->type == 2) {
|
||||
config->privacy.mode = 2;
|
||||
config->privacy.wep104.keyId = data->keyId;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
memcpy(config->privacy.wep104.key[i],
|
||||
data->keys[i], 0xD);
|
||||
}
|
||||
}
|
||||
else if (data->type == 4) {
|
||||
config->privacy.mode = 4;
|
||||
memcpy(config->privacy.tkip.key, data->key, 0x40);
|
||||
config->privacy.tkip.keyLen = strlen(data->key);
|
||||
}
|
||||
else if (data->type == 5) {
|
||||
config->privacy.mode = 6;
|
||||
memcpy(config->privacy.aes.key, data->key, 0x40);
|
||||
config->privacy.aes.keyLen = strlen(data->key);
|
||||
}
|
||||
}
|
||||
|
||||
if (result != NULL) {
|
||||
*result = wk->result;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#pragma dont_inline on
|
||||
void RakuRakuThread::printInfo() {
|
||||
}
|
||||
#pragma dont_inline reset
|
||||
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
150
src/scene/setting/iplSensitivity.cpp
Normal file
150
src/scene/setting/iplSensitivity.cpp
Normal file
@@ -0,0 +1,150 @@
|
||||
#define IPL_CONTROLLER_TRIVIAL_RECT_DTOR
|
||||
#include <nw4r/ut/Rect.h>
|
||||
|
||||
extern "C" {
|
||||
#include <revolution/gx.h>
|
||||
#include <revolution/tpl.h>
|
||||
#include <revolution/wpad.h>
|
||||
}
|
||||
|
||||
#include <system/iplController.h>
|
||||
#include <system/iplNand.h>
|
||||
#include <system/iplSystem.h>
|
||||
#include <utility/iplGraphics.h>
|
||||
|
||||
extern "C" void* KPADGetWPADRingBuffer(s32 chan);
|
||||
extern "C" void* KPADGetWPADFSRingBuffer(s32 chan);
|
||||
extern "C" void* KPADGetWPADCLRingBuffer(s32 chan);
|
||||
|
||||
extern __declspec(section ".sdata2") u8 sFrameColorR;
|
||||
extern __declspec(section ".sdata2") u8 sFrameColorG;
|
||||
extern __declspec(section ".sdata2") u8 sFrameColorB;
|
||||
extern __declspec(section ".sdata2") u8 sFrameColorA;
|
||||
extern __declspec(section ".sdata2") u8 sPointColorR;
|
||||
extern __declspec(section ".sdata2") u8 sPointColorG;
|
||||
extern __declspec(section ".sdata2") u8 sPointColorB;
|
||||
extern __declspec(section ".sdata2") u8 sPointColorA;
|
||||
extern __declspec(section ".sdata2") const f32 sPosZero;
|
||||
extern __declspec(section ".sdata2") f32 sDpdOffsetY;
|
||||
extern __declspec(section ".sdata2") f32 sDpdScale;
|
||||
|
||||
namespace ipl {
|
||||
|
||||
typedef struct DPDObj {
|
||||
s16 x; // 0x0
|
||||
s16 y; // 0x2
|
||||
u16 size; // 0x4
|
||||
s16 id; // 0x6
|
||||
} DPDObj;
|
||||
|
||||
class SensitivityDrawing {
|
||||
public:
|
||||
static void draw(nand::File* file);
|
||||
};
|
||||
|
||||
void SensitivityDrawing::draw(nand::File* file) {
|
||||
GXRenderModeObj mode = *System::getRenderModeObj();
|
||||
|
||||
nw4r::ut::Rect rect(sPosZero, sPosZero, sPosZero, sPosZero);
|
||||
System::getProjectionRect(&rect);
|
||||
|
||||
GXColor frameColor = {sFrameColorR, sFrameColorG, sFrameColorB,
|
||||
sFrameColorA};
|
||||
u32 left;
|
||||
u32 top;
|
||||
u32 width;
|
||||
u32 height;
|
||||
GXGetScissor(&left, &top, &width, &height);
|
||||
|
||||
f32 fw2 = 0.5f * (rect.right - rect.left);
|
||||
f32 ys = (0.5f * (rect.bottom - rect.top)) / 768.0f;
|
||||
f32 xs = (0.5f * (rect.right - rect.left)) * 0.0009765625f;
|
||||
f32 ws = mode.fbWidth / (rect.right - rect.left);
|
||||
f32 hs = mode.efbHeight / (rect.bottom - rect.top);
|
||||
f32 fh2 = 0.5f * (rect.bottom - rect.top);
|
||||
|
||||
utility::Graphics::setDefaultOrtho(0);
|
||||
|
||||
GXSetScissor((u32)(ws * (0.5f * rect.left + fw2)),
|
||||
(u32)(hs * (0.5f * rect.top + fh2 + sDpdOffsetY)),
|
||||
(u32)(ws * ((rect.right - rect.left) * 0.5f)),
|
||||
(u32)(hs * ((rect.bottom - rect.top) * 0.5f)));
|
||||
|
||||
utility::Graphics::drawPolygon(rect, frameColor);
|
||||
|
||||
controller::Interface* controller = System::getYoungController();
|
||||
if (controller != NULL && controller->getKPADStatus() != NULL) {
|
||||
GXTexObj texObj;
|
||||
TPLGetGXTexObjFromPalette((TPLPalette*)file->getBuffer(), &texObj, 1);
|
||||
GXInitTexObjWrapMode(&texObj, GX_MIRROR, GX_MIRROR);
|
||||
|
||||
s32 index = WPADGetLatestIndexInBuf(controller->getChannel());
|
||||
|
||||
DPDObj* first;
|
||||
DPDObj* last;
|
||||
switch (controller->getType()) {
|
||||
case 0: {
|
||||
u8* base = (u8*)KPADGetWPADRingBuffer(
|
||||
controller->getChannel()) +
|
||||
index * 0x2A;
|
||||
last = (DPDObj*)(base + 0x20);
|
||||
first = (DPDObj*)(base + 8);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
u8* base = (u8*)KPADGetWPADFSRingBuffer(
|
||||
controller->getChannel()) +
|
||||
index * 0x32;
|
||||
last = (DPDObj*)(base + 0x20);
|
||||
first = (DPDObj*)(base + 8);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
u8* base = (u8*)KPADGetWPADCLRingBuffer(
|
||||
controller->getChannel()) +
|
||||
index * 0x36;
|
||||
last = (DPDObj*)(base + 0x20);
|
||||
first = (DPDObj*)(base + 8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DPDObj* obj = last;
|
||||
do {
|
||||
if (obj->size != 0) {
|
||||
s32 x = obj->x - 0x200;
|
||||
s32 y = obj->y - 0x180;
|
||||
f32 s = sDpdScale * (obj->size + 0x19);
|
||||
|
||||
nw4r::ut::Rect pos(sPosZero, sPosZero, sPosZero, sPosZero);
|
||||
f32 sx = xs * x;
|
||||
f32 sy = ys * y;
|
||||
pos.left = sx - s;
|
||||
pos.top = (-sy + s) - sDpdOffsetY;
|
||||
pos.right = sx + s;
|
||||
pos.bottom = (-sy - s) - sDpdOffsetY;
|
||||
|
||||
utility::Graphics::drawTexture(pos, texObj,
|
||||
*(GXColor*)&sPointColorR, 2,
|
||||
utility::Graphics::ORI_NONE);
|
||||
}
|
||||
obj--;
|
||||
} while (obj >= first);
|
||||
}
|
||||
|
||||
GXSetScissor(left, top, width, height);
|
||||
}
|
||||
|
||||
} // namespace ipl
|
||||
|
||||
extern __declspec(section ".sdata2") u8 sFrameColorR = 0x60;
|
||||
extern __declspec(section ".sdata2") u8 sFrameColorG = 0x60;
|
||||
extern __declspec(section ".sdata2") u8 sFrameColorB = 0x60;
|
||||
extern __declspec(section ".sdata2") u8 sFrameColorA = 0xC0;
|
||||
extern __declspec(section ".sdata2") u8 sPointColorR = 0xFF;
|
||||
extern __declspec(section ".sdata2") u8 sPointColorG = 0xFF;
|
||||
extern __declspec(section ".sdata2") u8 sPointColorB = 0xFF;
|
||||
extern __declspec(section ".sdata2") u8 sPointColorA = 0xFF;
|
||||
extern __declspec(section ".sdata2") const f32 sPosZero = 0.0f;
|
||||
extern __declspec(section ".sdata2") f32 sDpdOffsetY = -45.0f;
|
||||
extern __declspec(section ".sdata2") f32 sDpdScale = 0.15f;
|
||||
File diff suppressed because it is too large
Load Diff
190
src/scene/setting/iplUSBAP.cpp
Normal file
190
src/scene/setting/iplUSBAP.cpp
Normal file
@@ -0,0 +1,190 @@
|
||||
extern "C" {
|
||||
#include <private/wd.h>
|
||||
}
|
||||
|
||||
#include <revolution/os.h>
|
||||
#include <revolution/wd.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define USBAP_STACK_SIZE 0x1000
|
||||
#define USBAP_NICKNAME_LEN 0x14
|
||||
#define USBAP_MAC_TABLE_MAX 0x14
|
||||
#define USBAP_MAC_LENGTH 6
|
||||
#define USBAP_SSID "NWCUSBAP"
|
||||
#define USBAP_SSID_LENGTH 8
|
||||
|
||||
typedef void (*USBAPCallback)(int result);
|
||||
|
||||
static OSThread usbapThread;
|
||||
static u8 usbapStack[USBAP_STACK_SIZE];
|
||||
static OSMessageQueue usbapMessageQ;
|
||||
static u16 usbapNickname[12];
|
||||
|
||||
static OSMessage usbapMsg;
|
||||
static USBAPCallback usbapCallback;
|
||||
static s32 usbapUseNickname;
|
||||
static u16 usbapEnableChannel;
|
||||
static u8* usbapScanBuffer;
|
||||
static u8* usbapMacTable;
|
||||
u8* gUSBAPResult;
|
||||
|
||||
extern "C" void* DoRegistration(void* param);
|
||||
|
||||
extern "C" int USBAPStartRegistration(void* unused1, void* unused2,
|
||||
u32 priority, s32 useNickname, const u16* nickname,
|
||||
USBAPCallback callback, u8* scanBuffer, u8* macTable) {
|
||||
s32 level;
|
||||
|
||||
level = OSDisableInterrupts();
|
||||
usbapScanBuffer = scanBuffer;
|
||||
usbapMacTable = macTable;
|
||||
|
||||
if (usbapThread.state != 0 && !OSIsThreadTerminated(&usbapThread)) {
|
||||
OSRestoreInterrupts(level);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (priority > 0x1F || nickname == NULL || callback == NULL) {
|
||||
OSRestoreInterrupts(level);
|
||||
return 0;
|
||||
}
|
||||
|
||||
usbapUseNickname = useNickname;
|
||||
usbapCallback = callback;
|
||||
memcpy(usbapNickname, nickname, USBAP_NICKNAME_LEN);
|
||||
|
||||
OSInitMessageQueue(&usbapMessageQ, &usbapMsg, 1);
|
||||
|
||||
if (OSCreateThread(&usbapThread, DoRegistration, NULL,
|
||||
usbapStack + sizeof(usbapStack), sizeof(usbapStack), priority, 1)
|
||||
== 1)
|
||||
{
|
||||
OSRestoreInterrupts(level);
|
||||
while (OSResumeThread(&usbapThread) > 1) {
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
OSRestoreInterrupts(level);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" int USBAPCancelRegistration(void) {
|
||||
return OSSendMessage(&usbapMessageQ, NULL, 0);
|
||||
}
|
||||
|
||||
extern "C" int USBAPIsThreadTerminated(void) {
|
||||
return OSIsThreadTerminated(&usbapThread);
|
||||
}
|
||||
|
||||
extern "C" void* DoRegistration(void* param) {
|
||||
OSMessage msg;
|
||||
WDScanParam req;
|
||||
s32 ret;
|
||||
s32 result;
|
||||
BOOL found;
|
||||
BOOL empty;
|
||||
u16 count;
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 joff;
|
||||
WDBssDesc* entry;
|
||||
|
||||
if (WDCheckEnableChannel(&usbapEnableChannel) != 0) {
|
||||
ret = 0;
|
||||
if (usbapCallback != NULL) {
|
||||
usbapCallback(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (;;) {
|
||||
OSYieldThread();
|
||||
|
||||
if (OSReceiveMessage(&usbapMessageQ, &msg, 0) == TRUE) {
|
||||
ret = 0;
|
||||
if (usbapCallback != NULL) {
|
||||
usbapCallback(0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
result = 0;
|
||||
|
||||
req.channelBit = usbapEnableChannel;
|
||||
req.maxChannelTime = 0x64;
|
||||
memset(req.bssid, 0xFF, WD_BSSID_LENGTH);
|
||||
req.type = 0;
|
||||
req.ssidLength = 0x20;
|
||||
memcpy(req.ssid, USBAP_SSID, USBAP_SSID_LENGTH);
|
||||
req.ssid[8] = 0;
|
||||
req.ssid[9] = 1;
|
||||
|
||||
if (usbapUseNickname == 1) {
|
||||
req.ssid[9] |= 2;
|
||||
}
|
||||
req.ssid[10] = 1;
|
||||
req.ssid[11] = 0;
|
||||
memcpy(&req.ssid[12], usbapNickname, USBAP_NICKNAME_LEN);
|
||||
|
||||
memset(&req.ssidMask[0], 0, 8);
|
||||
memset(&req.ssidMask[8], 0xFF, 0x18);
|
||||
|
||||
if (WDScanOnce(usbapScanBuffer, 0x800, &req) == 0) {
|
||||
found = 0;
|
||||
empty = 0;
|
||||
count = *(u16*)usbapScanBuffer;
|
||||
entry = (WDBssDesc*)(usbapScanBuffer + 2);
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (entry->ssidLength == 0x20
|
||||
&& strncmp((char*)entry->ssid, USBAP_SSID,
|
||||
USBAP_SSID_LENGTH)
|
||||
== 0)
|
||||
{
|
||||
for (j = 0, joff = 0; j < USBAP_MAC_TABLE_MAX;
|
||||
j++, joff += USBAP_MAC_LENGTH)
|
||||
{
|
||||
if (memcmp(entry->bssid,
|
||||
&usbapMacTable[1 + joff],
|
||||
USBAP_MAC_LENGTH)
|
||||
== 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (j == USBAP_MAC_TABLE_MAX) {
|
||||
if (entry->ssid[9] == 1) {
|
||||
memcpy(&usbapMacTable[1 + usbapMacTable[0]
|
||||
* USBAP_MAC_LENGTH],
|
||||
entry->bssid, USBAP_MAC_LENGTH);
|
||||
usbapMacTable[0]++;
|
||||
found = 1;
|
||||
}
|
||||
else if (entry->ssid[9] == 0) {
|
||||
empty = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
entry = (WDBssDesc*)((u8*)entry + entry->length * 2);
|
||||
}
|
||||
|
||||
if (found) {
|
||||
result = empty ? 2 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (result != 0) {
|
||||
ret = result == 1;
|
||||
if (usbapCallback != NULL) {
|
||||
usbapCallback(ret);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (void*)(u32)ret;
|
||||
}
|
||||
71
src/scene/setting/iplUSBAPThread.cpp
Normal file
71
src/scene/setting/iplUSBAPThread.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
#include <revolution/os.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "utility/iplCharacterCode.h"
|
||||
|
||||
extern "C" int USBAPStartRegistration(void* arg1, void* arg2, s32 priority,
|
||||
void* arg4, void* arg5, void* callback, void* arg7, void* arg8);
|
||||
extern "C" int USBAPCancelRegistration(void);
|
||||
extern "C" int USBAPIsThreadTerminated(void);
|
||||
|
||||
extern u8* gUSBAPResult;
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
class USBAPThread {
|
||||
public:
|
||||
USBAPThread();
|
||||
void Init(u16* pData, u8* pBuf);
|
||||
void cancel();
|
||||
void is();
|
||||
void setData(const wchar_t* pData, u8* pBuf);
|
||||
void callback();
|
||||
|
||||
private:
|
||||
wchar_t mData[10];
|
||||
};
|
||||
|
||||
USBAPThread::USBAPThread() {
|
||||
}
|
||||
|
||||
void USBAPRegisterCallback(int result) {
|
||||
if (result == 1) {
|
||||
*gUSBAPResult = 1;
|
||||
OSReport("Registration completed !\n");
|
||||
}
|
||||
else {
|
||||
*gUSBAPResult = 2;
|
||||
OSReport("Registration failed...\n");
|
||||
}
|
||||
}
|
||||
|
||||
void USBAPThread::Init(u16* pData, u8* pBuf) {
|
||||
s32 priority = OSGetThreadPriority(OSGetCurrentThread()) + 1;
|
||||
s32 result = USBAPStartRegistration(NULL, NULL, priority, NULL, this,
|
||||
USBAPRegisterCallback, pData, pBuf);
|
||||
if (result == 1)
|
||||
{
|
||||
OSReport("Registration started\n");
|
||||
}
|
||||
}
|
||||
|
||||
void USBAPThread::cancel() {
|
||||
USBAPCancelRegistration();
|
||||
}
|
||||
|
||||
void USBAPThread::is() {
|
||||
USBAPIsThreadTerminated();
|
||||
}
|
||||
|
||||
void USBAPThread::setData(const wchar_t* pData, u8* pBuf) {
|
||||
gUSBAPResult = pBuf;
|
||||
std::memcpy(mData, pData, sizeof(mData));
|
||||
utility::CharacterCode::changeEndian(
|
||||
reinterpret_cast<wchar_t*>(mData), 0xA);
|
||||
}
|
||||
|
||||
void USBAPThread::callback() {
|
||||
}
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
@@ -1,10 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compact function diff with context: python ctxdiff.py <unit> <symbol> [--full]"""
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0, "/home/cole/projects/tests")
|
||||
from odiff import dis, sym
|
||||
import os
|
||||
import itertools
|
||||
|
||||
|
||||
|
||||
166
tools/decomp-assist/odiff.py
Normal file
166
tools/decomp-assist/odiff.py
Normal file
@@ -0,0 +1,166 @@
|
||||
#!/usr/bin/env python3
|
||||
"""odiff: symbol lookup + normalized disassembly for object files.
|
||||
|
||||
Recreated for this environment (original lived on the author's machine).
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
from capstone import CS_ARCH_PPC, CS_MODE_32, CS_MODE_BIG_ENDIAN, Cs
|
||||
from elftools.elf.elffile import ELFFile
|
||||
|
||||
_cache = {}
|
||||
|
||||
|
||||
def _load(path):
|
||||
if path in _cache:
|
||||
return _cache[path]
|
||||
with open(path, "rb") as f:
|
||||
e = ELFFile(f)
|
||||
st = e.get_section_by_name(".symtab")
|
||||
names = [s.name for s in st.iter_symbols()]
|
||||
syms = {s.name: (s["st_value"], s["st_size"]) for s in st.iter_symbols()}
|
||||
data = {}
|
||||
for sec in e.iter_sections():
|
||||
data[sec.name] = (sec["sh_offset"], sec.data())
|
||||
relocs = {}
|
||||
for sec in e.iter_sections():
|
||||
if sec.name.startswith(".rela"):
|
||||
target = sec.name[5:]
|
||||
for r in sec.iter_relocations():
|
||||
relocs[(target, r["r_offset"])] = names[r["r_info_sym"]]
|
||||
_cache[path] = (data, syms, relocs)
|
||||
return _cache[path]
|
||||
|
||||
|
||||
def sym(path, name):
|
||||
_, syms, _ = _load(path)
|
||||
return syms[name]
|
||||
|
||||
|
||||
_PS_ARITH = {
|
||||
40: "ps_sum0", 41: "ps_sum1", 20: "ps_sum0", 21: "ps_sum1",
|
||||
32: "ps_muls0", 33: "ps_muls1", 28: "ps_madds0", 29: "ps_madds1",
|
||||
12: "ps_mul", 14: "ps_div", 10: "ps_add", 11: "ps_sub",
|
||||
26: "ps_madd", 30: "ps_nmsub", 31: "ps_msub", 28 >> 2: "x",
|
||||
18: "ps_merge00", 528: "ps_merge00", 560: "ps_merge01",
|
||||
592: "ps_merge10", 624: "ps_merge11", 25: "ps_mul",
|
||||
}
|
||||
|
||||
|
||||
def _ps_decode(w):
|
||||
major = w >> 26
|
||||
if major in (56, 57, 60, 61): # psq_l psq_lu psq_st psq_stu
|
||||
names = {56: "psq_l", 57: "psq_lu", 60: "psq_st", 61: "psq_stu"}
|
||||
fd = (w >> 21) & 31
|
||||
ra = (w >> 16) & 31
|
||||
w_ = (w >> 15) & 1
|
||||
i = (w >> 12) & 7
|
||||
d = w & 0xFFF
|
||||
if d & 0x800:
|
||||
d -= 0x1000
|
||||
return "%s f%d, %d(r%d), %d, %d" % (names[major], fd, d, ra, w_, i)
|
||||
if major in (6, 7): # psq_lx psq_stx
|
||||
names = {6: "psq_lx", 7: "psq_stx"}
|
||||
fd = (w >> 21) & 31
|
||||
ra = (w >> 16) & 31
|
||||
rb = (w >> 11) & 31
|
||||
w_ = (w >> 10) & 1
|
||||
i = (w >> 7) & 7
|
||||
return "%s f%d, r%d, r%d, %d, %d" % (names[major], fd, ra, rb, w_, i)
|
||||
if major == 4: # ps_* arithmetic
|
||||
xo = (w >> 1) & 0x3FF
|
||||
rc = w & 1
|
||||
fd = (w >> 21) & 31
|
||||
fa = (w >> 16) & 31
|
||||
fb = (w >> 11) & 31
|
||||
fc = (w >> 6) & 31
|
||||
names = {18: "ps_div", 20: "ps_sub", 21: "ps_add", 23: "ps_sel",
|
||||
24: "ps_res", 25: "ps_mul", 26: "ps_rsqrte", 28: "ps_msub",
|
||||
29: "ps_madd", 30: "ps_nmsub", 31: "ps_nmadd", 10: "ps_sum0",
|
||||
11: "ps_sum1", 12: "ps_muls0", 13: "ps_muls1",
|
||||
14: "ps_madds0", 15: "ps_madds1", 16: "ps_cmpu0",
|
||||
32: "ps_cmpo0", 40: "ps_cmpu1", 48: "ps_cmpo1",
|
||||
66: "ps_neg", 34: "ps_mr", 136: "ps_nabs", 264: "ps_abs",
|
||||
528: "ps_merge00", 560: "ps_merge01", 592: "ps_merge10",
|
||||
624: "ps_merge11", 1014: "dcbz_l"}
|
||||
n = names.get(xo)
|
||||
if n is None:
|
||||
return None
|
||||
if xo in (34, 66, 136, 264):
|
||||
return "%s%s f%d, f%d" % (n, "." if rc else "", fd, fb)
|
||||
if xo in (528, 560, 592, 624):
|
||||
return "%s%s f%d, f%d, f%d" % (n, "." if rc else "", fd, fa, fb)
|
||||
if xo in (16, 32, 40, 48):
|
||||
return "%s cr%d, f%d, f%d" % (n, fd >> 2, fa, fb)
|
||||
if xo in (10, 11):
|
||||
return "%s%s f%d, f%d, f%d, f%d" % (n, "." if rc else "", fd, fc, fa, fb)
|
||||
return "%s%s f%d, f%d, f%d, f%d" % (n, "." if rc else "", fd, fa, fc, fb)
|
||||
return None
|
||||
|
||||
|
||||
def dis(path, off, size, section=".text"):
|
||||
data, syms, relocs = _load(path)
|
||||
sec_data = data[section][1]
|
||||
|
||||
# Word-granular disassembly: capstone with paired-single fallback.
|
||||
class _I:
|
||||
__slots__ = ("address", "mnemonic", "op_str")
|
||||
|
||||
def __init__(self, a, m, o):
|
||||
self.address = a
|
||||
self.mnemonic = m
|
||||
self.op_str = o
|
||||
|
||||
insns = []
|
||||
pos = off
|
||||
end = off + size
|
||||
md = Cs(CS_ARCH_PPC, CS_MODE_32 + CS_MODE_BIG_ENDIAN)
|
||||
while pos < end:
|
||||
w = int.from_bytes(sec_data[pos:pos + 4], "big")
|
||||
major = w >> 26
|
||||
is_ps = major in (4, 56, 57, 60, 61) or (
|
||||
major in (6, 7) and ((w >> 1) & 0x3FF) == 18)
|
||||
if is_ps:
|
||||
t = _ps_decode(w)
|
||||
if t is None:
|
||||
insns.append(_I(pos, ".long", hex(w)))
|
||||
else:
|
||||
parts = t.split(" ", 1)
|
||||
insns.append(_I(pos, parts[0], parts[1]))
|
||||
pos += 4
|
||||
continue
|
||||
chunk = sec_data[pos:end]
|
||||
done = False
|
||||
for i in md.disasm(chunk, pos):
|
||||
insns.append(i)
|
||||
done = True
|
||||
break
|
||||
if not done:
|
||||
w = int.from_bytes(sec_data[pos:pos + 4], "big")
|
||||
t = _ps_decode(w)
|
||||
if t is None:
|
||||
insns.append(_I(pos, ".long", hex(w)))
|
||||
else:
|
||||
parts = t.split(" ", 1)
|
||||
insns.append(_I(pos, parts[0], parts[1]))
|
||||
pos += 4
|
||||
|
||||
out = []
|
||||
for i in insns:
|
||||
text = i.mnemonic + " " + i.op_str
|
||||
m = re.search(r"0x[0-9a-fA-F]+", i.op_str)
|
||||
if (section, i.address) in relocs:
|
||||
# External reference: show the symbol, drop the raw addend
|
||||
text = i.mnemonic + " " + re.sub(r"0x[0-9a-fA-F]+",
|
||||
"<" + relocs[(section, i.address)] + ">",
|
||||
i.op_str)
|
||||
elif m and i.mnemonic.startswith("b"):
|
||||
val = int(m.group(0), 16)
|
||||
if off <= val < off + size:
|
||||
# Intra-function branch: normalize to function-relative
|
||||
text = i.mnemonic + " " + (i.op_str[:m.start()] +
|
||||
"+" + hex(val - off) +
|
||||
i.op_str[m.end():])
|
||||
out.append((i.address - off, text))
|
||||
return out
|
||||
Reference in New Issue
Block a user