Compare commits

...

10 Commits

Author SHA1 Message Date
coah
4e41a7ba9c fix controller manager readability 2026-09-28 23:23:30 +00:00
coah
d2d00f38ff split iplController into controller and manager units, decompile the asm 2026-09-28 23:23:30 +00:00
coah
33911687c7 decompile controller leaf destructors 2026-09-28 23:23:30 +00:00
coah
03bc324c97 model controller inheritance 2026-09-28 23:23:30 +00:00
coah
7e24906764 decompile controller asm bodies 2026-09-28 23:23:30 +00:00
coah
17a33b2d18 Decompile iplAddressEdit to 72/94 functions (#240)
* wip: salvaged iplAddressEdit (old luna, contains hacks to remove)

* decompile address edit

* convert address edit methods
2026-09-28 18:11:06 -05:00
coah
10bbb7b394 Decompile WPADHIDParser to 20/22 functions (#239)
* decompile wpad hid parser

* match extension retry callback

* match status report parser

* match user data buffer clearing

* match wpad ack report parser

* match wpad core report parser

* match wpad accel report parser

* match wpad extension report parser

* match wpad dpd report parser

* match wpad dpd extension report

* match wpad freestyle report parser

* match wpad simple dpd report

* match wpad extended data report

* match wpad extended infrared report

* match wpad second infrared report

* improve wpad ack status expression
2026-09-28 17:58:28 -05:00
coah
dcfa7b859d Link iplBoardObject properly, prep iplBoard (#238)
* match board angle constants

* align board helper emission

* link board object unit
2026-09-28 17:49:43 -05:00
coah
a255b91806 Link iplSaveDataManager, decompile 3 of its asm functions (#237)
* decompile savedata title list integration

* decompile savedata title cache lookup

* decompile savedata prior title update

* link savedata manager in object order
2026-09-28 16:53:03 -05:00
coah
9779363fb5 Decompile odh codec to 16/28 functions (#236)
* wip: salvage uncommitted luna worktree state

* continue odh matching

* name odh codec variables

* continue odh matching
2026-09-28 15:40:35 -05:00
23 changed files with 7994 additions and 2398 deletions

View File

@@ -37,11 +37,16 @@ src/system/iplSystem.cpp:
.sdata start:0x81696060 end:0x81696080
src/system/iplController.cpp:
.text start:0x81335CCC end:0x81337978
.text start:0x81335CCC end:0x81337318
.rodata start:0x8160D2C0 end:0x8160D2D0
.data start:0x816346A8 end:0x81634A28
.sdata2 start:0x81694440 end:0x81694490
.data start:0x816346A8 end:0x81634910
.sdata2 start:0x81694440 end:0x81694478
.sdata start:0x81696080 end:0x81696088
src/system/iplControllerManager.cpp:
.text start:0x81337318 end:0x81337978
.data start:0x81634910 end:0x81634A28
.sdata2 start:0x81694478 end:0x81694490
.sbss start:0x81698680 end:0x81698690
src/system/iplChannelManager.cpp:

View File

@@ -13835,8 +13835,8 @@ scAnmTable__10homebutton = .rodata:0x8160F378; // type:object size:0x60 scope:lo
scGroupAnmTable__10homebutton = .rodata:0x8160F3D8; // type:object size:0x250 scope:local data:4byte
__DVDErrorMessage = .rodata:0x8160F628; // type:object size:0x28
lbl_8160F650 = .rodata:0x8160F650; // type:object size:0x16 data:2byte
lbl_8160F668 = .rodata:0x8160F668; // type:object size:0xB data:byte
lbl_8160F673 = .rodata:0x8160F673; // type:object size:0xC data:byte
specials$18760 = .rodata:0x8160F668; // type:object size:0xB data:byte
@19145 = .rodata:0x8160F673; // type:object size:0xC data:byte
lbl_8160F67F = .rodata:0x8160F67F; // type:object size:0xD data:byte
lbl_8160F690 = .rodata:0x8160F690; // type:object size:0x18 data:2byte
scAnmFrame__Q23ipl5scene = .rodata:0x8160F6A8; // type:object size:0x20 scope:local
@@ -15435,26 +15435,46 @@ __vt__Q33ipl5scene7Address = .data:0x81647B70; // type:object size:0x120
@11177 = .data:0x81647D9A; // type:object size:0xF scope:local data:string
__vt__Q33ipl5scene18AddressAddSelEvent = .data:0x81647DAC; // type:object size:0x18
__vt__Q33ipl5scene13AddressAddSel = .data:0x81647DC4; // type:object size:0x88
lbl_81647EE0 = .data:0x81647EE0; // type:object size:0xD data:string
lbl_81647EED = .data:0x81647EED; // type:object size:0xD data:string
lbl_81647EFA = .data:0x81647EFA; // type:object size:0xD data:string
lbl_81647F07 = .data:0x81647F07; // type:object size:0xE data:string
lbl_81647F15 = .data:0x81647F15; // type:object size:0xC data:string
lbl_81647F24 = .data:0x81647F24; // type:object size:0x14
lbl_81647F38 = .data:0x81647F38; // type:object size:0xE data:string
lbl_81647F46 = .data:0x81647F46; // type:object size:0x83
lbl_81647FC9 = .data:0x81647FC9; // type:object size:0xC data:string
lbl_81647FD5 = .data:0x81647FD5; // type:object size:0x128
lbl_816480FD = .data:0x816480FD; // type:object size:0xE data:string
lbl_8164810B = .data:0x8164810B; // type:object size:0x1F5
jumptable_81648300 = .data:0x81648300; // type:object size:0xC0 scope:local
jumptable_816483C0 = .data:0x816483C0; // type:object size:0xC0 scope:local
lbl_8164848D = .data:0x8164848D; // type:object size:0x16 data:string
lbl_816484A3 = .data:0x816484A3; // type:object size:0xF data:string
jumptable_816484B4 = .data:0x816484B4; // type:object size:0x44 scope:local
jumptable_81648508 = .data:0x81648508; // type:object size:0x58 scope:local
jumptable_81648560 = .data:0x81648560; // type:object size:0x8C scope:local
lbl_816485EC = .data:0x816485EC; // type:object size:0xC data:wstring
@16959 = .data:0x81647EE0; // type:object size:0xD data:string
@16960 = .data:0x81647EED; // type:object size:0xD data:string
@16961 = .data:0x81647EFA; // type:object size:0xD data:string
@16962 = .data:0x81647F07; // type:object size:0xE data:string
@16963 = .data:0x81647F15; // type:object size:0xC data:string
sButtonPaneNames = .data:0x81647F24; // type:object size:0x14
@16964 = .data:0x81647F38; // type:object size:0xE data:string
@23886 = .data:0x81647F46; // type:object size:0xC data:string
@24207 = .data:0x81647F52; // type:object size:0x12 data:string
@24208 = .data:0x81647F64; // type:object size:0x1C data:string
@24209 = .data:0x81647F80; // type:object size:0xF data:string
@24210 = .data:0x81647F8F; // type:object size:0x19 data:string
@24211 = .data:0x81647FA8; // type:object size:0xB data:string
@24212 = .data:0x81647FB3; // type:object size:0xB data:string
@24213 = .data:0x81647FBE; // type:object size:0xB data:string
@24214 = .data:0x81647FC9; // type:object size:0xC data:string
@24215 = .data:0x81647FD5; // type:object size:0xE data:string
@24216 = .data:0x81647FE3; // type:object size:0x1A data:string
@24217 = .data:0x81647FFD; // type:object size:0x1A data:string
@24218 = .data:0x81648017; // type:object size:0x1D data:string
@24219 = .data:0x81648034; // type:object size:0x1E data:string
@24220 = .data:0x81648052; // type:object size:0xC data:string
@24221 = .data:0x8164805E; // type:object size:0x22 data:string
@24222 = .data:0x81648080; // type:object size:0x9 data:string
@24223 = .data:0x81648089; // type:object size:0x23 data:string
@24224 = .data:0x816480AC; // type:object size:0x1C data:string
@24225 = .data:0x816480C8; // type:object size:0xD data:string
@24226 = .data:0x816480D5; // type:object size:0xD data:string
@24227 = .data:0x816480E2; // type:object size:0xD data:string
@24228 = .data:0x816480EF; // type:object size:0xE data:string
@24229 = .data:0x816480FD; // type:object size:0xE data:string
@24231 = .data:0x8164810B; // type:object size:0x1F5
@25188 = .data:0x81648300; // type:object size:0xC0 scope:local
@25187 = .data:0x816483C0; // type:object size:0xC0 scope:local
@25711 = .data:0x8164848D; // type:object size:0x16 data:string
@25835 = .data:0x816484A3; // type:object size:0xF data:string
@25838 = .data:0x816484B4; // type:object size:0x44 scope:local
@26007 = .data:0x81648508; // type:object size:0x58 scope:local
@26006 = .data:0x81648560; // type:object size:0x8C scope:local
@26030 = .data:0x816485EC; // type:object size:0xC data:wstring
__vt__Q33ipl5scene17AddressInputEvent = .data:0x816485F8; // type:object size:0x18
__vt__Q33ipl5scene16AddressEditEvent = .data:0x81648610; // type:object size:0x18
__vt__Q33ipl5scene11AddressEdit = .data:0x81648628; // type:object size:0x120
@@ -21691,7 +21711,7 @@ lbl_816965C4 = .sdata:0x816965C4; // type:object size:0x6 data:string
lbl_816965CA = .sdata:0x816965CA; // type:object size:0x4
smButtonName__Q33ipl5scene13AddressAddSel = .sdata:0x816965D0; // type:object size:0x8
@10971 = .sdata:0x816965D8; // type:object size:0x4 scope:local data:string
lbl_816965E0 = .sdata:0x816965E0; // type:object size:0x4 data:4byte
sInputPaneName = .sdata:0x816965E0; // type:object size:0x4 data:4byte
lbl_816965E4 = .sdata:0x816965E4; // type:object size:0x4 data:string
lbl_816965E8 = .sdata:0x816965E8; // type:object size:0x2
lbl_816965EA = .sdata:0x816965EA; // type:object size:0x6 data:string

View File

@@ -625,6 +625,7 @@ config.libs = [
Object(Matching, "system/RIPL_BoardRecord.c"),
Object(Matching, "system/iplSystem.cpp"),
Object(NonMatching, "system/iplController.cpp"),
Object(NonMatching, "system/iplControllerManager.cpp"),
Object(Matching, "system/iplChannelManager.cpp"),
Object(Matching, "system/iplChannelScriptManager.cpp"),
Object(Matching, "system/iplNand.cpp"),
@@ -653,7 +654,7 @@ config.libs = [
Object(Matching, "system/iplWarningHandler.cpp"),
Object(Matching, "system/iplSocketSetting.cpp"),
Object(Matching, "system/iplPostmanManager.cpp"),
Object(NonMatching, "system/iplSaveDataManager.cpp"),
Object(Matching, "system/iplSaveDataManager.cpp"),
Object(Matching, "system/iplChannelRsoThread.cpp"),
Object(Matching, "system/RsoSystem.cpp"),
Object(Matching, "system/iplCdbBackup.cpp"),
@@ -738,7 +739,7 @@ config.libs = [
),
IPLSection("board", [
Object(Equivalent, "scene/board/iplBoard.cpp"),
Object(Equivalent, "scene/board/iplBoardObject.cpp"),
Object(Matching, "scene/board/iplBoardObject.cpp"),
Object(Matching, "scene/board/iplBoardSD.cpp"),
Object(Matching, "scene/board/iplUrlProcessor.cpp"),
Object(Equivalent, "scene/board/iplFocusObject.cpp"),

View File

@@ -67,6 +67,9 @@ namespace textinput {
virtual void setAspectRatio(bool b4x3);
virtual void setSecretInputMode(bool secretInputMode) { mpInputForm->setSecretModeOn(secretInputMode); }
#ifdef IPL_ADDRESS_EDIT_CPP
void enableKSXFilter(bool compatibleFilter);
#endif
virtual void setDefaultPredictionJP(int num, const char** predicts);
virtual void setFixedPredictionJP(int num, const char** predicts);

View File

@@ -12,6 +12,9 @@ namespace ipl {
template <typename T>
class Interporation : public utility::FrameController {
public:
#ifdef IPL_BOARD_OBJECT_INLINE_INTERPOLATION_DTORS
virtual ~Interporation();
#endif
void init(int playback, f32 maxFrame, f32 minFrame, const T& start, const T& end, f32 speed = 1.0f) {
mStart = start;
mEnd = end;
@@ -34,6 +37,9 @@ namespace ipl {
template <typename T>
class LinearIntp : public Interporation<T> {
public:
#ifdef IPL_BOARD_OBJECT_INLINE_INTERPOLATION_DTORS
virtual ~LinearIntp();
#endif
T get() const {
T r = mEnd * getCurrentFrame();
T b = mStart * (mMaxFrame - mFrame);

View File

@@ -35,6 +35,10 @@ namespace ipl {
return x;
}
}
#ifdef IPL_CONTROLLER_OUT_OF_LINE_ABS_CLAMP
template <>
f32 abs_clamp<f32>(const f32& x, const f32& y);
#endif
typedef struct MTX33 : public nw4r::math::MTX33 {
} MTX33;
@@ -55,19 +59,27 @@ namespace ipl {
x = r.x;
y = r.y;
}
#ifdef IPL_CONTROLLER_OUT_OF_LINE_VEC2
VEC2(f32 fx, f32 fy);
#else
VEC2(f32 fx, f32 fy) {
x = fx;
y = fy;
}
#endif
void operator=(const VEC2& r);
VEC2 operator*(f32 val) const { return VEC2(x * val, y * val); }
#ifdef IPL_CONTROLLER_OUT_OF_LINE_VEC2
void set(f32 fx, f32 fy);
#else
void set(f32 fx, f32 fy) {
x = fx;
y = fy;
}
#endif
void clear() {
y = 0;
@@ -91,11 +103,15 @@ namespace ipl {
y = r.y;
z = 0.0f;
}
#ifdef IPL_ADDRESS_EDIT_CPP
VEC3(f32 fx, f32 fy, f32 fz);
#else
VEC3(f32 fx, f32 fy, f32 fz) {
x = fx;
y = fy;
z = fz;
}
#endif
VEC3& operator+=(const VEC3& rhs) {
VEC3Add(this, this, &rhs);

View File

@@ -258,6 +258,9 @@ namespace ipl {
static const math::VEC2 smcPageOffset;
friend class AddressEvent;
#ifdef IPL_ADDRESS_EDIT_CPP
friend class AddressEdit;
#endif
};
class AddressEvent : public ::gui::EventHandler {

View File

@@ -2,22 +2,125 @@
#define IPL_SCENE_ADDRESS_EDIT_H
#include "iplSceneHeader.h"
#include "scene/button/iplButton.h"
#include <RFL_Types.h>
#include <revolution/nwc24.h>
namespace ipl {
namespace nigaoe {
class Object;
}
namespace scene {
FADER_SCENE_CLASS(AddressEdit) {
class AddressEditEvent;
class AddressInputEvent;
class FriendListCache;
FADER_SCENE_CLASS(AddressEdit), public ButtonEventHandlerBase {
public:
AddressEdit(EGG::Heap * heap, int friendCode);
virtual ~AddressEdit();
virtual void prepare();
virtual void create();
virtual void draw();
virtual void initCalcNormal();
virtual void initCalcFadeout();
virtual void calcCommonAfter();
virtual FaderSceneCommand calcFadein();
virtual FaderSceneCommand calcNormal();
virtual FaderSceneCommand calcFadeout();
virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con);
void stt_msg_code_add();
void stt_msg_code_edit();
void stt_msg_parental();
void stt_msg_nwc24_error();
void reset_gui();
void start_point_event(const char* paneName, controller::Interface* controller);
void start_left_event(const char* paneName);
void start_trig_event(const char* paneName);
void start_ipt_point_event(const char* paneName, int channel);
void start_ipt_left_event(const char* paneName, int channel);
void start_ipt_trig_event(const char* paneName, int channel);
int get_button_no(const char*);
void add_friendinfo();
void delete_friendinfo();
void set_textbox(nw4r::lyt::Pane*, const wchar_t*);
void setDefaultTitleText(const wchar_t*, bool);
static void wiiid_utf16(u64, wchar_t*);
static void nigaoe_create_callback_add(ipl::nigaoe::Object*, void*);
static void nigaoe_create_callback_edit(ipl::nigaoe::Object*, void*);
void set_err_msg(wchar_t*, u32, NWC24Err);
void get_friendinfo();
static u64 utf16_wiiid(const wchar_t*);
void stt_add_code_fadein();
void stt_add_code_fadeout();
void stt_add_code_input();
void stt_add_code_normal();
void stt_add_confirm_fadein();
void stt_add_confirm_fadeout();
void stt_add_confirm_normal();
void stt_add_mii_fadein();
void stt_add_mii_fadeout();
void stt_add_mii_input();
void stt_add_mii_normal();
void stt_add_name_fadein();
void stt_add_name_fadeout();
void stt_add_name_input();
void stt_add_name_normal();
void stt_ipt_input();
void stt_ipt_normal();
void stt_ipt_wait_fadein();
void stt_ipt_wait_fadeout();
void stt_msg_add_rlt();
void stt_msg_code_invalid();
void stt_msg_del_rlt();
void stt_msg_dup_email();
void stt_msg_dup_wii_no();
void stt_msg_my_wii_no();
void stt_msg_net();
void stt_msg_no_established();
void stt_msg_no_mii();
void stt_msg_no_mii_add();
void stt_msg_wc();
void stt_select_mii();
void stt_wait_btn_fadein();
void stt_wait_btn_fadeout();
void stt_wait_del_msg_fadein();
void stt_wait_del_msg_fadeout();
void stt_wait_del_msg_fadeout_to_rlt();
void stt_wait_delete();
void stt_wait_decide_anm_add();
void stt_wait_parental();
void stt_wait_parental_dst();
void stt_wait_parental_dst_wc();
void stt_wait_parental_wc();
void stt_normal();
void stt_wait_decide_anm();
void update_friendinfo();
void requestSceneChange(int sceneId, void* args) { reserveSceneChange(sceneId, args); }
u32 getPreviousScene() const { return getPrevSceneID(); }
EGG::Heap* getHeap() { return getSceneHeap(); }
::gui::Manager* getGuiManager() { return mpManager; }
class String {
public:
void clear();
const wchar_t* getDispCodeLong() const;
void setName(const wchar_t* value);
void setEMail(const wchar_t* value);
void setWiiNo(const wchar_t* value);
wchar_t mValue[0x102];
wchar_t mName[0x0c];
wchar_t mDisplayText[0x102];
bool mbValidMail;
bool mbNameNotEmpty;
bool mbHasWiiNo;
};
enum {
@@ -25,8 +128,28 @@ namespace ipl {
SCENE_ADD_EMAIL,
};
private:
u8 unk_0x58[0x498];
int mState;
layout::Object* mpCodeLayout;
AddressEditEvent* mpEditEvent;
gui::PaneManager* mpEditGui;
layout::Object* mpNameLayout;
AddressInputEvent* mpInputEvent;
gui::PaneManager* mpInputGui;
layout::Object* mpBackgroundLayout;
int mMode;
int mSelectedButton;
int mSubState;
s32 mPointCount[5];
u32 mSelectedFriend;
TextBalloon* mpBalloon;
nand::LayoutFile* mpBalloonFile;
String mString;
AddressEdit* mpCallbackOwner;
bool mbParentalOK;
nigaoe::Object* mpNigaoe;
RFLCreateID mCreateID;
int mNigaoeState;
FriendListCache* mpFriendCache;
};
} // namespace scene
} // namespace ipl

View File

@@ -19,6 +19,13 @@
namespace ipl {
namespace scene {
extern wchar_t scTextDateJpnFormat[];
extern wchar_t scTextDateKorFormat[];
extern wchar_t scTextDateGerFormat[];
extern wchar_t scTextDatePalengFormat[];
#ifdef IPL_BOARD_DATE_HELPERS_INLINE
extern const u32 scWeekMsgId[];
#endif
class focus_object;
SCENE_CLASS(Board), public ButtonEventHandlerBase {
public:
@@ -81,13 +88,57 @@ namespace ipl {
void set_text_date();
void set_text_date(const utility::Date& date, const char* paneName);
#ifdef IPL_BOARD_DATE_HELPERS_INLINE
void get_text_jpn(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
const wchar_t* sep1 = msgMgr->getMessage(MESG_CALENDAR_MONDAY);
const wchar_t* sep2 = msgMgr->getMessage(MESG_CALENDAR_MONDAY);
const wchar_t* weekStart = msgMgr->getMessage(MESG_CALENDAR_WEEK_START);
const wchar_t* weekEnd = msgMgr->getMessage(MESG_CALENDAR_WEEK_END);
swprintf(text, textLen, scTextDateJpnFormat, date.month, sep1, date.day, sep2, weekStart, week, weekEnd);
}
void get_text_kor(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
const wchar_t* sep1 = msgMgr->getMessage(MESG_CALENDAR_MONDAY);
const wchar_t* sep2 = msgMgr->getMessage(MESG_CALENDAR_MONDAY);
const wchar_t* weekStart = msgMgr->getMessage(MESG_CALENDAR_WEEK_START);
const wchar_t* weekEnd = msgMgr->getMessage(MESG_CALENDAR_WEEK_END);
swprintf(text, textLen, scTextDateKorFormat, date.month, sep1, date.day, sep2, weekStart, week, weekEnd);
}
#else
void get_text_jpn(const utility::Date& date, wchar_t* text, u32 textLen);
void get_text_kor(const utility::Date& date, wchar_t* text, u32 textLen);
#endif
void get_text_spa(const utility::Date& date, wchar_t* text, u32 textLen);
#ifdef IPL_BOARD_DATE_HELPERS_INLINE
void get_text_ger(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
const wchar_t* weekStart = msgMgr->getMessage(MESG_CALENDAR_WEEK_START);
const wchar_t* weekEnd = msgMgr->getMessage(MESG_CALENDAR_WEEK_END);
swprintf(text, textLen, scTextDateGerFormat, date.day, date.month, weekStart, week, weekEnd);
}
#else
void get_text_ger(const utility::Date& date, wchar_t* text, u32 textLen);
#endif
void get_text_usaeng(const utility::Date& date, wchar_t* text, u32 textLen);
void get_text_usafre(const utility::Date& date, wchar_t* text, u32 textLen);
#ifdef IPL_BOARD_DATE_HELPERS_INLINE
void get_text_paleng(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
swprintf(text, textLen, scTextDatePalengFormat, week, date.day, date.month);
}
#else
void get_text_paleng(const utility::Date& date, wchar_t* text, u32 textLen);
#endif
void show_ricon();
void hide_ricon();
@@ -226,8 +277,17 @@ namespace ipl {
STATE_DONE,
};
#ifdef IPL_BOARD_INLINE_GETTERS
static Button* get_button() {
return static_cast<Button*>(System::getScene(SCENE_BUTTON));
}
static Arrow* get_arrow() {
return static_cast<Arrow*>(System::getScene(SCENE_ARROW));
}
#else
static Button* get_button();
static Arrow* get_arrow();
#endif
static const int OBJECTS_ON_SCREEN = 10;

View File

@@ -62,6 +62,200 @@ namespace ipl {
};
// clang-format on
#ifdef IPL_CONTROLLER_NATIVE_HIERARCHY
#ifdef IPL_CONTROLLER_INLINE_INTERFACE
#define IPL_CONTROLLER_DEFAULT_VIRTUAL(signature, implementation) virtual signature implementation
#else
#define IPL_CONTROLLER_DEFAULT_VIRTUAL(signature, implementation) virtual signature;
#endif
class Interface {
public:
virtual ~Interface() = 0;
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getType() const, { return -1; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getChannel() const, { return -1; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(bool down(u32 button) const, { return false; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(bool downTrg(u32 button) const, { return false; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(bool upTrg(u32 button) const, { return false; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int pinch() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int pinchTrg() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int pinchOffTrg() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int decide() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(bool repeat(u32 button) const, { return false; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(BOOL rumble(int type = 0), { return FALSE; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(void cancelRumbling(), { })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getHoldFlag() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getTrigFlag() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getReleaseFlag() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getClassicHoldFlag() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getClassicTrigFlag() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getClassicReleaseFlag() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(math::VEC2 getDpdPos() const, { return math::VEC2(0.0f, 0.0f); })
IPL_CONTROLLER_DEFAULT_VIRTUAL(math::VEC2 getDpdProjectionPos() const, { return math::VEC2(0.0f, 0.0f); })
IPL_CONTROLLER_DEFAULT_VIRTUAL(math::VEC2 getHorizon() const, { return math::VEC2(0.0f, 0.0f); })
IPL_CONTROLLER_DEFAULT_VIRTUAL(f32 getDpdDistance() const, { return 0.0f; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(KPADStatus* getKPADStatus() const, { return NULL; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(PADStatus* getPADStatus() const, { return NULL; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(bool isValidBtn() const, { return false; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(bool isValidDpd() const, { return false; })
virtual void setForceInvalid(bool flag) = 0;
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getMainStickX() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getMainStickY() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getSubStickX() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getSubStickY() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(void read(), { })
};
#undef IPL_CONTROLLER_DEFAULT_VIRTUAL
#ifdef IPL_CONTROLLER_INLINE_INTERFACE
inline Interface::~Interface() {}
#endif
class Base : public Interface {
public:
Base(int chan, KPADStatus& status) {
mButton = 0;
unk_0x08 = 0;
mLastRumbleTime = 0;
mRumbleType = -1;
mChan = chan;
mType = 2;
unk_0x1C = 0;
KPADEnableDPD(chan);
unk_0x1D = 0;
unk_0x1E = 0;
unk_0x20 = &status;
}
Base(int chan, int type, KPADStatus& status) {
mButton = 0;
unk_0x08 = 0;
mLastRumbleTime = 0;
mRumbleType = -1;
mChan = chan;
mType = type;
unk_0x1C = 0;
KPADEnableDPD(chan);
}
virtual ~Base();
virtual int getType() const override;
virtual int getChannel() const override;
virtual int decide() const override;
virtual BOOL rumble(int timer = 0) override;
virtual void cancelRumbling() override;
virtual void setForceInvalid(bool flag) override;
virtual void read() override;
protected:
u8 mButton;
u32 unk_0x08;
OSTick mLastRumbleTime;
s32 mRumbleType;
u32 mChan;
u32 mType;
u8 unk_0x1C;
u8 unk_0x1D;
u8 unk_0x1E;
KPADStatus* unk_0x20;
};
class Revolution : public Base {
public:
Revolution(int chan, KPADStatus& status) : Base(chan, status) {}
Revolution(int chan, int type, KPADStatus& status);
virtual ~Revolution();
virtual bool down(u32 button) const override;
virtual bool downTrg(u32 button) const override;
virtual bool upTrg(u32 button) const override;
virtual int pinch() const override;
virtual int pinchTrg() const override;
virtual int pinchOffTrg() const override;
virtual bool repeat(u32 button) const override;
virtual f32 getDpdDistance() const override;
virtual KPADStatus* getKPADStatus() const override;
virtual int getReleaseFlag() const override;
virtual int getTrigFlag() const override;
virtual int getHoldFlag() const override;
virtual math::VEC2 getDpdPos() const override;
virtual math::VEC2 getDpdProjectionPos() const override;
virtual math::VEC2 getHorizon() const override;
virtual bool isValidBtn() const override;
virtual bool isValidDpd() const override;
virtual void read() override;
};
class Classic : public Revolution {
public:
Classic(int chan, KPADStatus& status);
virtual ~Classic();
virtual bool down(u32 button) const override;
virtual bool downTrg(u32 button) const override;
virtual bool upTrg(u32 button) const override;
virtual int getClassicHoldFlag() const override;
virtual int getClassicTrigFlag() const override;
virtual int getClassicReleaseFlag() const override;
virtual math::VEC2 getDpdPos() const override;
virtual math::VEC2 getDpdProjectionPos() const override;
virtual math::VEC2 getHorizon() const override;
virtual bool isValidDpd() const override;
virtual void read() override;
virtual BOOL isValidDpdClassic() const;
private:
math::VEC2 unk_0x24;
int unk_0x2C;
};
class Master : public Interface {
public:
Master(Interface** controllers) : mpControllers(controllers) {}
virtual ~Master();
virtual bool down(u32 button) const override;
virtual bool downTrg(u32 button) const override;
virtual bool upTrg(u32 button) const override;
virtual bool repeat(u32 button) const override;
virtual int decide() const override;
virtual void setForceInvalid(bool flag) override;
private:
bool call(u32 button, bool (Interface::*func)(u32) const) const;
Interface** mpControllers;
};
class Core : public Revolution {
public:
Core(int chan, int type, KPADStatus& status) : Revolution(chan, type, status) {}
virtual ~Core();
};
class FreeStyle : public Revolution {
public:
FreeStyle(int chan, int type, KPADStatus& status) : Revolution(chan, type, status) {}
virtual ~FreeStyle();
};
class Manager {
public:
Manager(EGG::Heap* heap);
void read();
Interface* getController(int chan);
Interface* getMasterController();
Interface* getYoungController();
static void* alloc(u32 size);
static int free(void* ptr);
private:
static void* mpBuf;
static EGG::Heap* mpParentHeap;
static EGG::ExpHeap* mpHeap;
static EGG::Allocator* mpAllocator;
Interface* mControllers[4];
u32 mControllerStorage[4][12];
Master mMaster;
KPADStatus mKPADStatus[4];
s32 mInvalidCount[4];
};
#else
class Base {
public:
Base(int chan, KPADStatus& arg1) {
@@ -118,11 +312,11 @@ namespace ipl {
virtual bool setForceInvalid(bool flag); // 0x74
virtual f32 getMainStickX() const; // 0x78
virtual f32 getMainStickY() const; // 0x7C
virtual int getMainStickX() const; // 0x78
virtual int getMainStickY() const; // 0x7C
virtual f32 getSubStickX() const; // 0x80
virtual f32 getSubStickY() const; // 0x84
virtual int getSubStickX() const; // 0x80
virtual int getSubStickY() const; // 0x84
virtual void read(); // 0x88
@@ -169,10 +363,10 @@ namespace ipl {
virtual math::VEC2 getDpdPos() const override;
virtual math::VEC2 getDpdProjectionPos() const override;
virtual math::VEC2 getHorizon() const override;
virtual f32 getMainStickX() const override;
virtual f32 getMainStickY() const override;
virtual f32 getSubStickX() const override;
virtual f32 getSubStickY() const override;
virtual int getMainStickX() const override;
virtual int getMainStickY() const override;
virtual int getSubStickX() const override;
virtual int getSubStickY() const override;
virtual BOOL rumble(int type = 0) override;
virtual void read() override;
};
@@ -228,6 +422,7 @@ namespace ipl {
class Classic : public Revolution {
public:
Classic(int arg0, KPADStatus& arg1);
virtual ~Classic();
virtual bool down(u32 button) const override;
virtual bool downTrg(u32 button) const override;
@@ -268,6 +463,7 @@ namespace ipl {
static EGG::Allocator* mpAllocator;
u8 dummy[0x2F8];
};
#endif
} // namespace controller
} // namespace ipl

View File

@@ -54,6 +54,9 @@ namespace ipl {
const wchar_t* wcString; // 0x04
u32 stringLimit; // 0x08
u32 rowLimit; // 0x0C
#ifdef IPL_ADDRESS_EDIT_CPP
KeyboardSetting(KeyboardType keyboardType, const wchar_t* value, u32 limit, u32 rows);
#endif
} KeyboardSetting;
typedef struct State {

View File

@@ -19,6 +19,8 @@ namespace ipl {
class Manager;
}
namespace savedata {
extern "C" BOOL iplSavedata_813597A0(void* manager, ESTitleId titleId);
class Manager {
public:
Manager(EGG::Heap* heap);
@@ -151,6 +153,7 @@ namespace ipl {
u8 unused_0x504[28];
friend class channel::Manager;
friend BOOL iplSavedata_813597A0(void* manager, ESTitleId titleId);
};
} // namespace savedata
} // namespace ipl

View File

@@ -20,7 +20,12 @@ namespace ipl {
Date() : year(MIN_YEAR), month(MIN_MONTH), day(MIN_DAY) {}
Date(int myYear, int myMonth, int myDay) : year(myYear), month(myMonth), day(myDay) {}
#ifdef IPL_BOARD_DATE_CTOR_OUT_OF_LINE
Date(const OSCalendarTime& cal);
#else
Date(const OSCalendarTime& cal) : year(cal.year), month(cal.mon + 1), day(cal.mday) {}
#endif
#line 24 "include/utility/iplCalendar.h"
Date(const Date& date) : year(date.year), month(date.month), day(date.day) {}
static Date getMaxDate() {
@@ -127,6 +132,9 @@ namespace ipl {
return days[month - 1];
}
#ifdef IPL_BOARD_WEEK_FUNCTION_OUT_OF_LINE
static int getWeek(const Date& date) NO_INLINE;
#else
static int getWeek(const Date& date) NO_INLINE {
int month, year, day;
month = date.month;
@@ -138,6 +146,8 @@ namespace ipl {
}
return (day + (((month * 13) + 8) / 5) + ((year / 400) + ((year + (year / 4)) - (year / 100)))) % 7;
}
#endif
#line 147 "include/utility/iplCalendar.h"
static int getWeek(int year, int month, int day) NO_INLINE {
if (month <= 2) {

View File

@@ -16,7 +16,9 @@ namespace nw4r {
#endif
Rect(f32 l, f32 t, f32 r, f32 b) : left(l), top(t), right(r), bottom(b) {}
#ifndef IPL_CONTROLLER_TRIVIAL_RECT_DTOR
~Rect() {}
#endif
void SetWidth(f32 width) { right = left + width; }
void SetHeight(f32 height) { bottom = top + height; }

View File

@@ -37,6 +37,9 @@ namespace nw4r {
} // namespace detail
template <typename TDerived, typename TBase>
#ifdef IPL_BOARD_OBJECT_EXTERNAL_DYNAMIC_CAST
TDerived DynamicCast(TBase* pPtr);
#else
inline TDerived DynamicCast(TBase* pPtr) {
const detail::RuntimeTypeInfo* pDerivedTypeInfo = detail::GetTypeInfoFromPtr_(static_cast<TDerived>(NULL));
if (pPtr->GetRuntimeTypeInfo()->IsDerivedFrom(pDerivedTypeInfo)) {
@@ -44,6 +47,7 @@ namespace nw4r {
}
return NULL;
}
#endif
} // namespace ut
} // namespace nw4r

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,15 @@
#define IPL_BOARD_DATE_CTOR_OUT_OF_LINE
#define IPL_BOARD_WEEK_FUNCTION_OUT_OF_LINE
#include "iplSceneUI.h"
#include "iplSystem.h"
#if defined(SYSMENU_REGION_USA)
#define IPL_BOARD_DATE_HELPERS_INLINE
#endif
#define IPL_BOARD_INLINE_GETTERS
#include "scene/board/iplBoard.h"
#include "scene/board/iplBoardObject.h"
@@ -13,8 +23,6 @@
#include "scene/setting/iplSetting.h"
#include "iplSystem.h"
#include "utility/iplRBRUtility.h"
#define RECORD_DATE_TO_CDB(x) (CDBMakeCDBDate((x).year, (x).month, (x).day, (x).hour, (x).min, (x).sec))
@@ -71,6 +79,11 @@ namespace ipl {
init_search_condition();
}
}
namespace utility {
Date::Date(const OSCalendarTime& cal) : year(cal.year), month(cal.mon + 1), day(cal.mday) {}
}
namespace scene {
void Board::prepare() {
System::checkNandOverFlowFlagAsync();
@@ -427,7 +440,13 @@ namespace ipl {
cdb::Manager* cdbManager = System::getCdbManager();
BOOL result = TRUE;
struct InterruptState {
BOOL first;
BOOL second;
BOOL third;
BOOL result;
} interrupts;
interrupts.result = TRUE;
char recordType[8] = "";
@@ -460,17 +479,17 @@ namespace ipl {
// Find any free space to put the object on screen
BOOL old = OSDisableInterrupts();
interrupts.first = OSDisableInterrupts();
BOOL exist = is_exist_diff_date();
BoardObject* obj = mObjList.getNextFree();
OSRestoreInterrupts(old);
OSRestoreInterrupts(interrupts.first);
if (obj == NULL && exist) {
while (obj == NULL) {
OSSleepMilliseconds((OSTime)1);
BOOL old2 = OSDisableInterrupts();
interrupts.second = OSDisableInterrupts();
obj = mObjList.getNextFree();
OSRestoreInterrupts(old2);
OSRestoreInterrupts(interrupts.second);
}
}
@@ -510,16 +529,16 @@ namespace ipl {
goto close;
}
result = TRUE;
interrupts.result = TRUE;
if (((RBRHeader*)rbrData)->magic == RBR_MAGIC && cdbManager->isValidHeader((RBRHeader*)rbrData)) {
BOOL old3 = OSDisableInterrupts();
interrupts.third = OSDisableInterrupts();
if (recordDate == mCurrentDate) {
if (mbReading == true && mSearchRecord_Prev.created) {
mbReading = false;
delete[] rbrData;
OSRestoreInterrupts(old3);
OSRestoreInterrupts(interrupts.third);
return FALSE;
}
@@ -537,11 +556,11 @@ namespace ipl {
memcpy(&mSearchRecord_Prev, &mSearchRecord_Next, sizeof(SearchRecord));
}
} else {
result = FALSE;
interrupts.result = FALSE;
delete[] rbrData;
}
OSRestoreInterrupts(old3);
OSRestoreInterrupts(interrupts.third);
} else {
delete[] rbrData;
}
@@ -565,13 +584,13 @@ namespace ipl {
show_ricon();
}
result = FALSE;
interrupts.result = FALSE;
goto out;
error:
result = FALSE;
interrupts.result = FALSE;
out:
return result;
return interrupts.result;
}
void Board::stt_wait_cdb_init() {
@@ -1390,10 +1409,11 @@ namespace ipl {
#undef TEXT_LENGTH
}
static const u32 scWeekMsgId[] = {MESG_CALENDAR_SUNDAY, MESG_CALENDAR_MONDAY, MESG_CALENDAR_TUESDAY, MESG_CALENDAR_WEDNESDAY,
MESG_CALENDAR_THURSDAY, MESG_CALENDAR_FRIDAY, MESG_CALENDAR_SATURDAY};
void Board::get_text_jpn(const utility::Date& date, wchar_t* text, u32 textLen) {
const u32 scWeekMsgId[] = {MESG_CALENDAR_SUNDAY, MESG_CALENDAR_MONDAY, MESG_CALENDAR_TUESDAY, MESG_CALENDAR_WEDNESDAY,
MESG_CALENDAR_THURSDAY, MESG_CALENDAR_FRIDAY, MESG_CALENDAR_SATURDAY};
wchar_t scTextDateJpnFormat[] = L"%d%ls%d%ls%ls%ls%ls";
#ifndef IPL_BOARD_DATE_HELPERS_INLINE
inline void Board::get_text_jpn(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
const wchar_t* sep1 = msgMgr->getMessage(MESG_CALENDAR_MONDAY);
@@ -1401,10 +1421,13 @@ namespace ipl {
const wchar_t* weekStart = msgMgr->getMessage(MESG_CALENDAR_WEEK_START);
const wchar_t* weekEnd = msgMgr->getMessage(MESG_CALENDAR_WEEK_END);
swprintf(text, textLen, L"%d%ls%d%ls%ls%ls%ls", date.month, sep1, date.day, sep2, weekStart, week, weekEnd);
swprintf(text, textLen, scTextDateJpnFormat, date.month, sep1, date.day, sep2, weekStart, week, weekEnd);
}
#endif
void Board::get_text_kor(const utility::Date& date, wchar_t* text, u32 textLen) {
wchar_t scTextDateKorFormat[] = L"%d%ls %d%ls%ls%ls%ls";
#ifndef IPL_BOARD_DATE_HELPERS_INLINE
inline void Board::get_text_kor(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
const wchar_t* sep1 = msgMgr->getMessage(MESG_CALENDAR_MONDAY);
@@ -1412,9 +1435,25 @@ namespace ipl {
const wchar_t* weekStart = msgMgr->getMessage(MESG_CALENDAR_WEEK_START);
const wchar_t* weekEnd = msgMgr->getMessage(MESG_CALENDAR_WEEK_END);
swprintf(text, textLen, L"%d%ls %d%ls%ls%ls%ls", date.month, sep1, date.day, sep2, weekStart, week, weekEnd);
swprintf(text, textLen, scTextDateKorFormat, date.month, sep1, date.day, sep2, weekStart, week, weekEnd);
}
#endif
}
namespace utility {
int Calendar::getWeek(const Date& date) NO_INLINE {
int month, year, day;
month = date.month;
day = date.day;
year = date.year;
if (month <= 2) {
year--;
month += MAX_MONTH;
}
return (day + (((month * 13) + 8) / 5) + ((year / 400) + ((year + (year / 4)) - (year / 100)))) % 7;
}
}
namespace scene {
void Board::get_text_spa(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
@@ -1422,14 +1461,17 @@ namespace ipl {
swprintf(text, textLen, L"%ls %02d-%02d", week, date.day, date.month);
}
void Board::get_text_ger(const utility::Date& date, wchar_t* text, u32 textLen) {
wchar_t scTextDateGerFormat[] = L"%02d.%02d.%ls%ls%ls";
#ifndef IPL_BOARD_DATE_HELPERS_INLINE
inline void Board::get_text_ger(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
const wchar_t* weekStart = msgMgr->getMessage(MESG_CALENDAR_WEEK_START);
const wchar_t* weekEnd = msgMgr->getMessage(MESG_CALENDAR_WEEK_END);
swprintf(text, textLen, L"%02d.%02d.%ls%ls%ls", date.day, date.month, weekStart, week, weekEnd);
swprintf(text, textLen, scTextDateGerFormat, date.day, date.month, weekStart, week, weekEnd);
}
#endif
void Board::get_text_usaeng(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
@@ -1445,12 +1487,15 @@ namespace ipl {
swprintf(text, textLen, L"%ls %02d-%02d", week, date.month, date.day);
}
void Board::get_text_paleng(const utility::Date& date, wchar_t* text, u32 textLen) {
wchar_t scTextDatePalengFormat[] = L"%ls %02d/%02d";
#ifndef IPL_BOARD_DATE_HELPERS_INLINE
inline void Board::get_text_paleng(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
swprintf(text, textLen, L"%ls %02d/%02d", week, date.day, date.month);
swprintf(text, textLen, scTextDatePalengFormat, week, date.day, date.month);
}
#endif
void Board::show_ricon() {
u8 prev = mbRIconEnable;
@@ -2030,6 +2075,7 @@ namespace ipl {
}
}
#ifndef IPL_BOARD_INLINE_GETTERS
Button* Board::get_button() {
return static_cast<Button*>(System::getScene(SCENE_BUTTON));
}
@@ -2037,5 +2083,6 @@ namespace ipl {
Arrow* Board::get_arrow() {
return static_cast<Arrow*>(System::getScene(SCENE_ARROW));
}
#endif
} // namespace scene
} // namespace ipl

View File

@@ -1,3 +1,6 @@
#define IPL_BOARD_OBJECT_EXTERNAL_DYNAMIC_CAST
#define IPL_BOARD_OBJECT_INLINE_INTERPOLATION_DTORS
#include "iplSceneUI.h"
#include "scene/board/iplBoard.h"
@@ -43,6 +46,10 @@ extern "C" void __ct__Q33ipl4math4VEC2Fff(ipl::math::VEC2*, f32, f32);
#define PICTURE_THUMB_HEIGHT 48
namespace ipl {
namespace math {
template <> inline LinearIntp<VEC2>::~LinearIntp() {}
template <> inline Interporation<VEC2>::~Interporation() {}
}
namespace scene {
// clang-format off
const char* BoardObject::mAnimNames[BoardObject::TYPE_MAX][1+BoardObject::ANIM_MAX] = {
@@ -478,8 +485,10 @@ namespace ipl {
}
void BoardObject::stt_stand() {
f32 dVar2 = nw4r::math::CosFIdx((0.7111111f * (mStandData.unk_0x0C * 30.0f + 30.0f)));
f32 dVar3 = nw4r::math::SinFIdx((0.7111111f * (mStandData.unk_0x0C * 30.0f + 30.0f)));
f32 degrees = mStandData.unk_0x0C * 30.0f + 30.0f;
f32 dVar2 = nw4r::math::CosFIdx(degrees * 0.7111111f);
degrees = mStandData.unk_0x0C * 30.0f + 30.0f;
f32 dVar3 = nw4r::math::SinFIdx(degrees * 0.7111111f);
math::VEC2 standPos;
__ct__Q33ipl4math4VEC2Fff(&standPos, dVar3 * 160.0f, dVar2 * 160.0f);
@@ -879,14 +888,5 @@ namespace ipl {
return result;
}
#ifndef NON_MATCHING
void forceWeakFunc(nw4r::math::VEC2& vec) {
nw4r::math::VEC2 end(vec / 10.0f);
}
#endif
void GenerateWEAK() {
nw4r::lyt::TextBox* textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(((nw4r::lyt::Pane*)NULL)->FindPaneByName(NULL));
}
} // namespace scene
} // namespace ipl

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,187 @@
#include <decomp/ide.h>
#include <math/iplMathTypes.h>
#define IPL_SOUND_RECT_OUT_OF_LINE
#include <nw4r/ut/Rect.h>
#undef IPL_SOUND_RECT_OUT_OF_LINE
#include <revolution/kpad.h>
#include <revolution/mtx/GeoTypes.h>
#include <revolution/os.h>
#include <revolution/os/OSTime.h>
#include <revolution/sc.h>
#include <revolution/wpad.h>
#define IPL_CONTROLLER_NATIVE_HIERARCHY
#include "system/iplController.h"
#undef IPL_CONTROLLER_NATIVE_HIERARCHY
#include "system/iplSystem.h"
extern "C" void _savegpr_16();
extern "C" void _restgpr_16();
extern "C" void _savegpr_29();
extern "C" void _restgpr_29();
extern "C" void _savegpr_27();
extern "C" void _restgpr_27();
extern "C" void _savegpr_28();
extern "C" void _restgpr_28();
namespace ipl {
namespace controller {
void* Manager::mpBuf;
EGG::Heap* Manager::mpParentHeap;
EGG::ExpHeap* Manager::mpHeap;
EGG::Allocator* Manager::mpAllocator;
void* Manager::alloc(u32 size) {
return mpAllocator->alloc(size);
}
int Manager::free(void* ptr) {
mpAllocator->free(ptr);
return TRUE;
}
Manager::Manager(EGG::Heap* heap) : mMaster(mControllers) {
memset(mKPADStatus, 0, sizeof(mKPADStatus));
memset(mControllers, 0, sizeof(mControllers));
u32 workSize = WPADGetWorkMemorySize() + 0x400;
if (mpBuf != NULL && mpParentHeap != NULL) {
mpParentHeap->free(mpBuf);
}
mpParentHeap = heap;
mpBuf = heap->alloc(workSize, 0x20);
if (mpHeap != NULL) {
mpHeap->destroy();
}
mpHeap = EGG::ExpHeap::create(mpBuf, workSize, 2);
if (mpAllocator != NULL) {
delete mpAllocator;
}
mpAllocator = new (heap, 4) EGG::Allocator(mpHeap, 4);
WPADRegisterAllocator(alloc, free);
KPADInit();
u32 sensitivity = SCGetBtDpdSensibility();
for (int i = 0; i < 4; i++) {
WPADSetDpdSensitivity(sensitivity);
KPADSetBtnRepeat(i, 0.5f, 0.1f);
}
read();
}
void Manager::read() {
for (int chan = 0; chan < 4; chan++) {
if (SCGetWpadSensorBarPosition() == 1) {
KPADSetSensorHeight(chan, 0.2f);
} else {
KPADSetSensorHeight(chan, -0.2f);
}
u32 deviceType;
s32 probe = WPADProbe(chan, &deviceType);
if (probe == -1) {
goto probe_invalid;
}
if (probe < -1) {
if (probe >= -3) {
goto probe_valid;
}
goto probe_invalid;
} else if (probe >= 1) {
goto probe_invalid;
}
probe_valid:
{
s32 read = KPADRead(chan, &mKPADStatus[chan], 1);
if (read > 0) {
if (mKPADStatus[chan].wpad_err == -4 || deviceType == 0xfd) {
goto store_null;
}
mInvalidCount[chan] = 0;
if (mKPADStatus[chan].wpad_err == -7 || deviceType == 0 || deviceType == 0xfb ||
deviceType == 0xfc || deviceType == 0xff) {
if (mControllers[chan] == NULL || mControllers[chan]->getType() != 0) {
mControllers[chan] = new (mControllerStorage[chan]) Core(chan, 0, mKPADStatus[chan]);
}
} else if (deviceType == 1) {
if (mControllers[chan] == NULL || mControllers[chan]->getType() != 1) {
mControllers[chan] = new (mControllerStorage[chan]) FreeStyle(chan, 1, mKPADStatus[chan]);
}
} else if (deviceType == 2) {
if (mControllers[chan] == NULL || mControllers[chan]->getType() != 2) {
mControllers[chan] = new (mControllerStorage[chan]) Classic(chan, mKPADStatus[chan]);
}
} else {
mControllers[chan] = NULL;
}
} else if (read == 0) {
mInvalidCount[chan]++;
if (mInvalidCount[chan] > 0x3c) {
mInvalidCount[chan] = 0x3c;
if (mControllers[chan] != NULL) {
WPADControlMotor(chan, 0);
}
mControllers[chan] = NULL;
}
} else {
goto store_null;
}
}
goto channel_done;
store_null:
mControllers[chan] = NULL;
goto channel_done;
probe_invalid:
KPADRead(chan, &mKPADStatus[chan], 1);
mControllers[chan] = NULL;
channel_done:
KPADSetPosParam(chan, 0.05f, 1.0f);
}
for (int chan = 0; chan < 4; chan++) {
if (mControllers[chan] != NULL) {
mControllers[chan]->read();
}
}
}
Revolution::Revolution(int chan, int type, KPADStatus& status) : Base(chan, type, status) {
unk_0x1D = 0;
unk_0x1E = 0;
unk_0x20 = &status;
}
Interface* Manager::getMasterController() {
return &mMaster;
}
Interface* Manager::getController(int chan) {
return ((Interface**)this)[chan];
}
Interface* Manager::getYoungController() {
Interface* ret = NULL;
for (int i = 0; i < 4; i++) {
Interface* controller = ((Interface**)this)[i];
if (controller != NULL) {
ret = controller;
break;
}
}
return ret;
}
Core::~Core() {}
FreeStyle::~FreeStyle() {}
}
}

View File

@@ -751,215 +751,13 @@ namespace ipl {
blr
}
asm void Manager::integrateTitleIDList(register ESTitleId* titleIdsOut, register ESTitleId* titleIdsIn, register u32 titleCount) {
nofralloc
stwu r1, -0x1d0(r1)
mflr r0
stw r0, 0x1d4(r1)
addi r11, r1, 0x1d0
bl _savegpr_28
li r0, 0x36
mr r28, r3
mr r29, r4
mr r30, r5
mr r31, r6
addi r4, r1, 4
li r3, 0
mtctr r0
integrateTitleIDList_L1:
stw r3, 4(r4)
stwu r3, 8(r4)
bdnz integrateTitleIDList_L1
mr r3, r28
mr r4, r29
li r5, 0x30
bl getAvailableNumInList__Q33ipl8savedata7ManagerFPCUxUl
cmpwi r3, 0
mr r5, r3
beq integrateTitleIDList_L2
mr r3, r28
mr r6, r30
mr r7, r31
addi r4, r1, 8
bl makeTmpList__Q33ipl8savedata7ManagerFPUxUlPUxUl
mr r3, r28
mr r4, r29
addi r5, r1, 8
bl moveTitleTmpToPrior__Q33ipl8savedata7ManagerFPUxPCUx
integrateTitleIDList_L2:
addi r11, r1, 0x1d0
bl _restgpr_28
lwz r0, 0x1d4(r1)
mtlr r0
addi r1, r1, 0x1d0
blr
}
asm BOOL Manager::doUpdateChanInfos(register ESTitleId* titleIds) {
nofralloc
stwu r1, -0x40(r1)
mflr r0
stw r0, 0x44(r1)
addi r11, r1, 0x40
bl _savegpr_20
mr r27, r3
mr r28, r4
li r3, 0
li r30, 0
li r26, 0
li r25, 0
li r20, 3
li r21, 0
li r22, 0xe
li r23, -1
doUpdateChanInfos_L1:
add r31, r27, r26
li r29, 0
li r24, 0
doUpdateChanInfos_L2:
add r4, r31, r24
lbz r0, 0x30(r4)
cmplwi r0, 1
beq doUpdateChanInfos_L5
add r0, r29, r25
lwz r9, 0x38(r4)
slwi r0, r0, 3
lwz r5, 0x3c(r4)
add r8, r28, r0
lwzx r6, r28, r0
lwz r7, 4(r8)
xor r0, r9, r6
xor r5, r5, r7
or. r0, r5, r0
beq doUpdateChanInfos_L5
or. r0, r7, r6
bne doUpdateChanInfos_L4
addi r3, r4, 0x30
li r4, 0
li r5, 0x10
bl memset
b doUpdateChanInfos_L6
doUpdateChanInfos_L4:
stb r20, 0x30(r4)
stb r21, 0x31(r4)
stb r21, 0x32(r4)
stb r21, 0x33(r4)
stw r22, 0x34(r4)
lwz r0, 0(r8)
and r0, r0, r23
stw r0, 0x38(r4)
lwz r0, 4(r8)
and r0, r0, r23
stw r0, 0x3c(r4)
doUpdateChanInfos_L6:
li r3, 1
doUpdateChanInfos_L5:
addi r29, r29, 1
addi r24, r24, 0x10
cmpwi r29, 0xc
blt doUpdateChanInfos_L2
addi r30, r30, 1
addi r25, r25, 0xc
cmpwi r30, 4
addi r26, r26, 0xc0
blt doUpdateChanInfos_L1
addi r11, r1, 0x40
bl _restgpr_20
lwz r0, 0x44(r1)
mtlr r0
addi r1, r1, 0x40
blr
}
asm void Manager::iplSavedata_813596B8(register ESTitleId titleId) {
nofralloc
lis r7, 0x4841
lis r4, 1
addi r0, r7, 0x5445
addi r8, r4, 1
xor r4, r6, r0
xor r0, r5, r8
or. r0, r4, r0
beqlr
addi r4, r7, 0x4445
xor r0, r5, r8
xor r4, r6, r4
or. r0, r4, r0
bne iplSavedata_813596B8_L1
blr
iplSavedata_813596B8_L1:
addis r0, r5, -1
cmplwi r0, 1
beq iplSavedata_813596B8_L2
cmplwi r0, 3
beq iplSavedata_813596B8_L2
cmplwi r0, 4
beq iplSavedata_813596B8_L2
cmplwi r0, 6
bnelr
iplSavedata_813596B8_L2:
li r0, 0x30
li r9, 0
li r4, 0
mtctr r0
iplSavedata_813596B8_L3:
add r7, r3, r4
lwz r0, 0x340(r7)
lwz r7, 0x344(r7)
xor r0, r5, r0
xor r7, r6, r7
or. r0, r7, r0
beq iplSavedata_813596B8_L4
addi r9, r9, 1
addi r4, r4, 8
bdnz iplSavedata_813596B8_L3
iplSavedata_813596B8_L4:
cmpwi r9, 0x30
bne iplSavedata_813596B8_L5
li r9, 0x2f
iplSavedata_813596B8_L5:
slwi r4, r9, 3
mtctr r9
cmpwi r9, 0
ble iplSavedata_813596B8_L6
iplSavedata_813596B8_L7:
addi r0, r9, -1
add r7, r3, r4
slwi r0, r0, 3
addi r9, r9, -1
add r8, r3, r0
addi r4, r4, -8
lwz r0, 0x340(r8)
lwz r8, 0x344(r8)
stw r8, 0x344(r7)
stw r0, 0x340(r7)
bdnz iplSavedata_813596B8_L7
iplSavedata_813596B8_L6:
stw r6, 0x344(r3)
stw r5, 0x340(r3)
blr
}
extern "C" asm BOOL iplSavedata_813597A0(register void* manager, register ESTitleId titleId) {
nofralloc
li r0, 0x30
li r4, 0
mtctr r0
iplSavedata_813597A0_L1:
add r7, r3, r4
lwz r0, 0x340(r7)
lwz r7, 0x344(r7)
xor r0, r5, r0
xor r7, r6, r7
or. r0, r7, r0
bne iplSavedata_813597A0_L2
li r3, 1
blr
iplSavedata_813597A0_L2:
addi r4, r4, 8
bdnz iplSavedata_813597A0_L1
li r3, 0
blr
void Manager::integrateTitleIDList(ESTitleId* titleIdsOut, ESTitleId* titleIdsIn, u32 titleCount) {
ESTitleId temporaryTitleIds[0x36] = {0};
int availableCount = getAvailableNumInList(titleIdsOut, 0x30);
if (availableCount != 0) {
makeTmpList(temporaryTitleIds, availableCount, titleIdsIn, titleCount);
moveTitleTmpToPrior(titleIdsOut, temporaryTitleIds);
}
}
asm void Manager::makeTmpList(register ESTitleId* titleIdsOut, register u32 availableCount, register ESTitleId* titleIdsIn, register u32 titleCount) {
@@ -1073,47 +871,91 @@ namespace ipl {
blr
}
asm void Manager::moveTitleTmpToPrior(register ESTitleId* titleIdsOut, register const ESTitleId* titleIdsIn) {
void Manager::moveTitleTmpToPrior(ESTitleId* titleIdsOut, const ESTitleId* titleIdsIn) {
for (int titleIndex = 0; titleIndex < 0x36; titleIndex++) {
if (titleIdsIn[titleIndex] != TITLE_NULL) {
int availableIndex = getAvailableInList(titleIdsOut, 0x30);
if (availableIndex == -1) {
return;
}
titleIdsOut[availableIndex] = titleIdsIn[titleIndex];
}
}
}
asm BOOL Manager::doUpdateChanInfos(register ESTitleId* titleIds) {
nofralloc
stwu r1, -0x20(r1)
stwu r1, -0x40(r1)
mflr r0
stw r0, 0x24(r1)
addi r11, r1, 0x20
bl _savegpr_26
mr r26, r3
mr r27, r4
mr r28, r5
stw r0, 0x44(r1)
addi r11, r1, 0x40
bl _savegpr_20
mr r27, r3
mr r28, r4
li r3, 0
li r30, 0
li r26, 0
li r25, 0
li r20, 3
li r21, 0
li r22, 0xe
li r23, -1
doUpdateChanInfos_L1:
add r31, r27, r26
li r29, 0
li r31, 0
moveTitleTmpToPrior_L1:
add r30, r28, r31
lwzx r0, r28, r31
lwz r3, 4(r30)
or. r0, r3, r0
beq moveTitleTmpToPrior_L2
mr r3, r26
mr r4, r27
li r5, 0x30
bl getAvailableInList__Q33ipl8savedata7ManagerFPCUxUl
cmpwi r3, -1
beq moveTitleTmpToPrior_L3
slwi r0, r3, 3
lwz r4, 4(r30)
add r3, r27, r0
lwz r0, 0(r30)
stw r4, 4(r3)
stw r0, 0(r3)
moveTitleTmpToPrior_L2:
li r24, 0
doUpdateChanInfos_L2:
add r4, r31, r24
lbz r0, 0x30(r4)
cmplwi r0, 1
beq doUpdateChanInfos_L5
add r0, r29, r25
lwz r9, 0x38(r4)
slwi r0, r0, 3
lwz r5, 0x3c(r4)
add r8, r28, r0
lwzx r6, r28, r0
lwz r7, 4(r8)
xor r0, r9, r6
xor r5, r5, r7
or. r0, r5, r0
beq doUpdateChanInfos_L5
or. r0, r7, r6
bne doUpdateChanInfos_L4
addi r3, r4, 0x30
li r4, 0
li r5, 0x10
bl memset
b doUpdateChanInfos_L6
doUpdateChanInfos_L4:
stb r20, 0x30(r4)
stb r21, 0x31(r4)
stb r21, 0x32(r4)
stb r21, 0x33(r4)
stw r22, 0x34(r4)
lwz r0, 0(r8)
and r0, r0, r23
stw r0, 0x38(r4)
lwz r0, 4(r8)
and r0, r0, r23
stw r0, 0x3c(r4)
doUpdateChanInfos_L6:
li r3, 1
doUpdateChanInfos_L5:
addi r29, r29, 1
addi r31, r31, 8
cmpwi r29, 0x36
blt moveTitleTmpToPrior_L1
moveTitleTmpToPrior_L3:
addi r11, r1, 0x20
bl _restgpr_26
lwz r0, 0x24(r1)
addi r24, r24, 0x10
cmpwi r29, 0xc
blt doUpdateChanInfos_L2
addi r30, r30, 1
addi r25, r25, 0xc
cmpwi r30, 4
addi r26, r26, 0xc0
blt doUpdateChanInfos_L1
addi r11, r1, 0x40
bl _restgpr_20
lwz r0, 0x44(r1)
mtlr r0
addi r1, r1, 0x20
addi r1, r1, 0x40
blr
}
#endif
@@ -1289,6 +1131,87 @@ namespace ipl {
mData.prevSDPage = 0;
}
#ifdef __MWERKS__
asm void Manager::iplSavedata_813596B8(register ESTitleId titleId) {
nofralloc
lis r7, 0x4841
lis r4, 1
addi r0, r7, 0x5445
addi r8, r4, 1
xor r4, r6, r0
xor r0, r5, r8
or. r0, r4, r0
beqlr
addi r4, r7, 0x4445
xor r0, r5, r8
xor r4, r6, r4
or. r0, r4, r0
bne iplSavedata_813596B8_L1
blr
iplSavedata_813596B8_L1:
addis r0, r5, -1
cmplwi r0, 1
beq iplSavedata_813596B8_L2
cmplwi r0, 3
beq iplSavedata_813596B8_L2
cmplwi r0, 4
beq iplSavedata_813596B8_L2
cmplwi r0, 6
bnelr
iplSavedata_813596B8_L2:
li r0, 0x30
li r9, 0
li r4, 0
mtctr r0
iplSavedata_813596B8_L3:
add r7, r3, r4
lwz r0, 0x340(r7)
lwz r7, 0x344(r7)
xor r0, r5, r0
xor r7, r6, r7
or. r0, r7, r0
beq iplSavedata_813596B8_L4
addi r9, r9, 1
addi r4, r4, 8
bdnz iplSavedata_813596B8_L3
iplSavedata_813596B8_L4:
cmpwi r9, 0x30
bne iplSavedata_813596B8_L5
li r9, 0x2f
iplSavedata_813596B8_L5:
slwi r4, r9, 3
mtctr r9
cmpwi r9, 0
ble iplSavedata_813596B8_L6
iplSavedata_813596B8_L7:
addi r0, r9, -1
add r7, r3, r4
slwi r0, r0, 3
addi r9, r9, -1
add r8, r3, r0
addi r4, r4, -8
lwz r0, 0x340(r8)
lwz r8, 0x344(r8)
stw r8, 0x344(r7)
stw r0, 0x340(r7)
bdnz iplSavedata_813596B8_L7
iplSavedata_813596B8_L6:
stw r6, 0x344(r3)
stw r5, 0x340(r3)
blr
}
extern "C" BOOL iplSavedata_813597A0(void* manager, ESTitleId titleId) {
Manager* savedataManager = static_cast<Manager*>(manager);
for (int index = 0; index < MAX_CHANNEL_TOTAL; index++) {
if (savedataManager->mData.titleCache[0][index] == titleId) {
return TRUE;
}
}
return FALSE;
}
#endif
BOOL Manager::nand_error_handling(int code) {
BOOL result = FALSE;

File diff suppressed because it is too large Load Diff