diff --git a/config/43E/splits.txt b/config/43E/splits.txt index cf705f36..935172da 100644 --- a/config/43E/splits.txt +++ b/config/43E/splits.txt @@ -705,13 +705,13 @@ src/scene/memoryCard/iplGCWindow.cpp: .sdata2 start:0x81696928 end:0x81696940 .sdata start:0x81698B50 end:0x81698B80 -src/scene/memoryCard/iplGCTextBalloon.cpp: +src/scene/textBalloon/iplBalloon.cpp: .text start:0x813D1508 end:0x813D2114 .data start:0x816531D8 end:0x81653228 .sdata2 start:0x81696940 end:0x81696960 .sdata start:0x81698B80 end:0x81698B98 -src/scene/memoryCard/CardSequence.cpp: +src/scene/cardSequence/CardSequence.cpp: .text start:0x813D2114 end:0x813D4790 .data start:0x81653228 end:0x816537E0 .sdata start:0x81698B98 end:0x81698BA0 diff --git a/config/43E/symbols.txt b/config/43E/symbols.txt index eee3e811..0e607b25 100644 --- a/config/43E/symbols.txt +++ b/config/43E/symbols.txt @@ -2352,7 +2352,7 @@ getPaneComponentByPane__Q23gui11PaneManagerFPQ34nw4r3lyt4Pane = .text:0x81369728 setAllBoundingBoxComponentTriggerTarget__Q23gui11PaneManagerFb = .text:0x81369798; // type:function size:0xAC contain__Q23gui13PaneComponentFff = .text:0x81369844; // type:function size:0x128 draw__Q23gui13PaneComponentFv = .text:0x8136996C; // type:function size:0x18C -is_visible__FPQ34nw4r3lyt4Pane = .text:0x81369AF8; // type:function size:0x30 scope:local +is_visible__Q13guiFPQ34nw4r3lyt4Pane = .text:0x81369AF8; // type:function size:0x30 scope:local isVisible__Q23gui13PaneComponentFv = .text:0x81369B28; // type:function size:0x8 setFlightDuration__Q23gui9ComponentFiUs = .text:0x81369B30; // type:function size:0x10 getFlightDuration__Q23gui9ComponentFi = .text:0x81369B40; // type:function size:0x10 @@ -13654,7 +13654,7 @@ strcpy = .text:0x8160255C; // type:function size:0xC0 scope:global strncpy = .text:0x8160261C; // type:function size:0x44 fn_81602660 = .text:0x81602660; // type:function size:0x2C strncat = .text:0x8160268C; // type:function size:0x4C -fn_816026D8 = .text:0x816026D8; // type:function size:0x11C +strcmp = .text:0x816026D8; // type:function size:0x11C fn_816027F4 = .text:0x816027F4; // type:function size:0x40 strchr = .text:0x81602834; // type:function size:0x30 scope:global fn_81602864 = .text:0x81602864; // type:function size:0x48 @@ -16062,8 +16062,7 @@ lbl_8165821E = .data:0x8165821E; // type:object size:0x112 lbl_81658330 = .data:0x81658330; // type:object size:0xC data:string lbl_8165833C = .data:0x8165833C; // type:object size:0x16 data:string lbl_81658352 = .data:0x81658352; // type:object size:0x6A -__vt__Q33ipl5scene13SettingButton = .data:0x816583BC; // type:object size:0x68 -lbl_81658424 = .data:0x81658424; // type:object size:0x54 +__vt__Q33ipl5scene13SettingButton = .data:0x816583BC; // type:object size:0x84 lbl_81658478 = .data:0x81658478; // type:object size:0x10 data:string lbl_81658488 = .data:0x81658488; // type:object size:0xD data:string lbl_81658495 = .data:0x81658495; // type:object size:0xE data:string diff --git a/config/43J/splits.txt b/config/43J/splits.txt index 2f88dcc1..8a8d47bf 100644 --- a/config/43J/splits.txt +++ b/config/43J/splits.txt @@ -705,13 +705,13 @@ src/scene/memoryCard/iplGCWindow.cpp: .sdata2 start:0x816C4188 end:0x816C41A0 .sdata start:0x816C63B0 end:0x816C63E0 -src/scene/memoryCard/iplGCTextBalloon.cpp: +src/scene/textBalloon/iplBalloon.cpp: .text start:0x813D075C end:0x813D1368 .data start:0x816837F8 end:0x81683848 .sdata2 start:0x816C41A0 end:0x816C41C0 .sdata start:0x816C63E0 end:0x816C63F8 -src/scene/memoryCard/CardSequence.cpp: +src/scene/cardSequence/CardSequence.cpp: .text start:0x813D1368 end:0x813D39E4 .data start:0x81683848 end:0x81683E00 .sdata start:0x816C63F8 end:0x816C6400 diff --git a/config/43J/symbols.txt b/config/43J/symbols.txt index bb36fca5..7bb8d13b 100644 --- a/config/43J/symbols.txt +++ b/config/43J/symbols.txt @@ -2125,7 +2125,7 @@ getPaneComponentByPane__Q23gui11PaneManagerFPQ34nw4r3lyt4Pane = .text:0x81368B34 setAllBoundingBoxComponentTriggerTarget__Q23gui11PaneManagerFb = .text:0x81368BA4; // type:function size:0xAC contain__Q23gui13PaneComponentFff = .text:0x81368C50; // type:function size:0x128 draw__Q23gui13PaneComponentFv = .text:0x81368D78; // type:function size:0x18C -is_visible__FPQ34nw4r3lyt4Pane = .text:0x81368F04; // type:function size:0x30 scope:local +is_visible__Q13guiFPQ34nw4r3lyt4Pane = .text:0x81368F04; // type:function size:0x30 scope:local isVisible__Q23gui13PaneComponentFv = .text:0x81368F34; // type:function size:0x8 setFlightDuration__Q23gui9ComponentFiUs = .text:0x81368F3C; // type:function size:0x10 getFlightDuration__Q23gui9ComponentFi = .text:0x81368F4C; // type:function size:0x10 @@ -16148,8 +16148,7 @@ lbl_8168883E = .data:0x8168883E; // type:object size:0x112 lbl_81688950 = .data:0x81688950; // type:object size:0xC data:string lbl_8168895C = .data:0x8168895C; // type:object size:0x16 data:string lbl_81688972 = .data:0x81688972; // type:object size:0x6A -__vt__Q33ipl5scene13SettingButton = .data:0x816889DC; // type:object size:0x68 -lbl_81688A44 = .data:0x81688A44; // type:object size:0x54 +__vt__Q33ipl5scene13SettingButton = .data:0x816889DC; // type:object size:0x84 lbl_81688A98 = .data:0x81688A98; // type:object size:0x10 data:string lbl_81688AA8 = .data:0x81688AA8; // type:object size:0xD data:string lbl_81688AB5 = .data:0x81688AB5; // type:object size:0xE data:string diff --git a/config/43K/splits.txt b/config/43K/splits.txt index 9fdcc3da..1d93a9de 100644 --- a/config/43K/splits.txt +++ b/config/43K/splits.txt @@ -706,13 +706,13 @@ src/scene/memoryCard/iplGCWindow.cpp: .sdata2 start:0x81669100 end:0x81669118 .sdata start:0x8166B2D0 end:0x8166B300 -src/scene/memoryCard/iplGCTextBalloon.cpp: +src/scene/textBalloon/iplBalloon.cpp: .text start:0x813D07C4 end:0x813D13D0 .data start:0x81627DF8 end:0x81627E48 .sdata2 start:0x81669118 end:0x81669138 .sdata start:0x8166B300 end:0x8166B318 -src/scene/memoryCard/CardSequence.cpp: +src/scene/cardSequence/CardSequence.cpp: .text start:0x813D13D0 end:0x813D3A4C .data start:0x81627E48 end:0x81628400 .sdata start:0x8166B318 end:0x8166B320 diff --git a/config/43K/symbols.txt b/config/43K/symbols.txt index 72b077f2..cc11ce71 100644 --- a/config/43K/symbols.txt +++ b/config/43K/symbols.txt @@ -2104,7 +2104,7 @@ getPaneComponentByPane__Q23gui11PaneManagerFPQ34nw4r3lyt4Pane = .text:0x81368A14 setAllBoundingBoxComponentTriggerTarget__Q23gui11PaneManagerFb = .text:0x81368A84; // type:function size:0xAC contain__Q23gui13PaneComponentFff = .text:0x81368B30; // type:function size:0x128 draw__Q23gui13PaneComponentFv = .text:0x81368C58; // type:function size:0x18C -is_visible__FPQ34nw4r3lyt4Pane = .text:0x81368DE4; // type:function size:0x30 scope:local +is_visible__Q13guiFPQ34nw4r3lyt4Pane = .text:0x81368DE4; // type:function size:0x30 scope:local isVisible__Q23gui13PaneComponentFv = .text:0x81368E14; // type:function size:0x8 setFlightDuration__Q23gui9ComponentFiUs = .text:0x81368E1C; // type:function size:0x10 getFlightDuration__Q23gui9ComponentFi = .text:0x81368E2C; // type:function size:0x10 @@ -15637,8 +15637,7 @@ lbl_8162CE46 = .data:0x8162CE46; // type:object size:0x112 lbl_8162CF58 = .data:0x8162CF58; // type:object size:0xC data:string lbl_8162CF64 = .data:0x8162CF64; // type:object size:0x16 data:string lbl_8162CF7A = .data:0x8162CF7A; // type:object size:0x6A -__vt__Q33ipl5scene13SettingButton = .data:0x8162CFE4; // type:object size:0x68 -lbl_8162D04C = .data:0x8162D04C; // type:object size:0x54 +__vt__Q33ipl5scene13SettingButton = .data:0x8162CFE4; // type:object size:0x84 lbl_8162D0A0 = .data:0x8162D0A0; // type:object size:0x10 data:string lbl_8162D0B0 = .data:0x8162D0B0; // type:object size:0xD data:string lbl_8162D0BD = .data:0x8162D0BD; // type:object size:0xE data:string diff --git a/config/43U/splits.txt b/config/43U/splits.txt index 527a8a3f..9553e814 100644 --- a/config/43U/splits.txt +++ b/config/43U/splits.txt @@ -705,13 +705,13 @@ src/scene/memoryCard/iplGCWindow.cpp: .sdata2 start:0x81694A88 end:0x81694AA0 .sdata start:0x81696CB0 end:0x81696CE0 -src/scene/memoryCard/iplGCTextBalloon.cpp: +src/scene/textBalloon/iplBalloon.cpp: .text start:0x813D140C end:0x813D2018 .data start:0x81652F18 end:0x81652F68 .sdata2 start:0x81694AA0 end:0x81694AC0 .sdata start:0x81696CE0 end:0x81696CF8 -src/scene/memoryCard/CardSequence.cpp: +src/scene/cardSequence/CardSequence.cpp: .text start:0x813D2018 end:0x813D4694 .data start:0x81652F68 end:0x81653520 .sdata start:0x81696CF8 end:0x81696D00 diff --git a/config/43U/symbols.txt b/config/43U/symbols.txt index 9461fa39..007872a7 100644 --- a/config/43U/symbols.txt +++ b/config/43U/symbols.txt @@ -2352,7 +2352,7 @@ getPaneComponentByPane__Q23gui11PaneManagerFPQ34nw4r3lyt4Pane = .text:0x81369680 setAllBoundingBoxComponentTriggerTarget__Q23gui11PaneManagerFb = .text:0x813696F0; // type:function size:0xAC contain__Q23gui13PaneComponentFff = .text:0x8136979C; // type:function size:0x128 draw__Q23gui13PaneComponentFv = .text:0x813698C4; // type:function size:0x18C -is_visible__FPQ34nw4r3lyt4Pane = .text:0x81369A50; // type:function size:0x30 scope:local +is_visible__Q13guiFPQ34nw4r3lyt4Pane = .text:0x81369A50; // type:function size:0x30 scope:local isVisible__Q23gui13PaneComponentFv = .text:0x81369A80; // type:function size:0x8 setFlightDuration__Q23gui9ComponentFiUs = .text:0x81369A88; // type:function size:0x10 getFlightDuration__Q23gui9ComponentFi = .text:0x81369A98; // type:function size:0x10 @@ -16062,8 +16062,7 @@ lbl_81657F5E = .data:0x81657F5E; // type:object size:0x112 lbl_81658070 = .data:0x81658070; // type:object size:0xC data:string lbl_8165807C = .data:0x8165807C; // type:object size:0x16 data:string lbl_81658092 = .data:0x81658092; // type:object size:0x6A -__vt__Q33ipl5scene13SettingButton = .data:0x816580FC; // type:object size:0x68 -lbl_81658166 = .data:0x81658164; // type:object size:0x54 +__vt__Q33ipl5scene13SettingButton = .data:0x816580FC; // type:object size:0x84 lbl_816581B8 = .data:0x816581B8; // type:object size:0x10 data:string lbl_816581C8 = .data:0x816581C8; // type:object size:0xD data:string lbl_816581D5 = .data:0x816581D5; // type:object size:0xE data:string diff --git a/configure.py b/configure.py index b4db4754..24375076 100644 --- a/configure.py +++ b/configure.py @@ -178,7 +178,7 @@ if not config.non_matching: config.binutils_tag = "2.42-1" config.compilers_tag = "latest" config.dtk_tag = "v1.3.0" -config.objdiff_tag = "v2.5.0" +config.objdiff_tag = "v2.7.1" config.sjiswrap_tag = "v1.2.0" config.wibo_tag = "0.6.16" config.bstool_tag = "v1.0.1" @@ -638,8 +638,16 @@ config.libs = [ Object(NonMatching, "scene/memoryCard/iplMemoryCardManager.cpp"), Object(NonMatching, "scene/memoryCard/iplGCSaveData.cpp"), Object(NonMatching, "scene/memoryCard/iplGCWindow.cpp"), - Object(NonMatching, "scene/memoryCard/iplGCTextBalloon.cpp"), - Object(NonMatching, "scene/memoryCard/CardSequence.cpp"), + ] + ), + IPLSection("textBalloon", + [ + Object(NonMatching, "scene/textBalloon/iplBalloon.cpp"), + ] + ), + IPLSection("cardSequence", + [ + Object(NonMatching, "scene/cardSequence/CardSequence.cpp"), ] ), IPLSection("nakamuraTest", @@ -707,7 +715,7 @@ config.libs = [ IPLSection("settingSelect", [ Object(Matching, "scene/settingSelect/iplSettingBg.cpp"), - Object(NonMatching, "scene/settingSelect/iplSettingButton.cpp"), + Object(Matching, "scene/settingSelect/iplSettingButton.cpp"), Object(NonMatching, "scene/settingSelect/iplSettingSelect.cpp"), ] ), diff --git a/include/layout/GUIManager.h b/include/layout/GUIManager.h index 5324e26a..2c46e0ee 100644 --- a/include/layout/GUIManager.h +++ b/include/layout/GUIManager.h @@ -263,4 +263,7 @@ namespace gui { }; } +#define USE_GUI_MANAGER namespace gui { class PaneManager; } +#define IPL_USE_GUI_MANAGER namespace ipl { USE_GUI_MANAGER } + #endif // GUI_MANAGER_H diff --git a/include/layout/iplGuiManager.h b/include/layout/iplGuiManager.h index 971f0046..ebbedb2a 100644 --- a/include/layout/iplGuiManager.h +++ b/include/layout/iplGuiManager.h @@ -5,6 +5,8 @@ #include +#include + namespace ipl { namespace gui { class PaneManager : public ::gui::PaneManager { diff --git a/include/scene/iplFaderSceneBase.h b/include/scene/iplFaderSceneBase.h index 2144d96b..e07416c8 100644 --- a/include/scene/iplFaderSceneBase.h +++ b/include/scene/iplFaderSceneBase.h @@ -37,10 +37,11 @@ namespace ipl { virtual SceneCommand calcFadein() { return SCENE_NEXT; } // 0x58 virtual SceneCommand calcNormal() { return SCENE_NEXT; } // 0x5C - virtual SceneCommand calcFadeout() { return SCENE_NEXT; } // 0x60 + virtual SceneCommand calcFadeout(); // 0x60 virtual void calcCommonAfter(); // 0x64 - + + protected: int getState() { return mState; } private: @@ -50,5 +51,3 @@ namespace ipl { } #endif // BASE_SCENE_FADER_H - - diff --git a/include/scene/settingSelect/iplSettingBg.h b/include/scene/settingSelect/iplSettingBg.h index 1c395638..edfe3e3e 100644 --- a/include/scene/settingSelect/iplSettingBg.h +++ b/include/scene/settingSelect/iplSettingBg.h @@ -7,7 +7,7 @@ namespace ipl { namespace scene { SCENE_CLASS(SettingBg) { public: - SettingBg(EGG::Heap* heap, int sceneID); + SettingBg(EGG::Heap* heap, int type); virtual ~SettingBg(); virtual void prepare(); @@ -16,7 +16,7 @@ namespace ipl { virtual void draw(); private: - int mSceneID; // 0x54 + int mSettingType; // 0x54 layout::Object* mpLayout; // 0x58 nand::LayoutFile* mpLayoutFile; // 0x5C @@ -25,5 +25,3 @@ namespace ipl { } #endif // IPL_SETTING_BG_H - - diff --git a/include/scene/settingSelect/iplSettingButton.h b/include/scene/settingSelect/iplSettingButton.h new file mode 100644 index 00000000..f8802986 --- /dev/null +++ b/include/scene/settingSelect/iplSettingButton.h @@ -0,0 +1,89 @@ +#ifndef IPL_SETTING_BUTTON_H +#define IPL_SETTING_BUTTON_H + +#include "scene/iplFaderSceneBase.h" + +#include "layout/GUIManager.h" + +namespace ipl { + USE_GUI_MANAGER + namespace scene { + FADER_SCENE_CLASS(SettingButton), public ::gui::EventHandler { + public: + enum { + CANCEL = 0, + DECIDE, + }; + + enum { + CMD_NONE = 0, + CMD_SHOW_BTN, + CMD_HIDE_BTN, + CMD_SET_TEXT, + }; + + SettingButton(EGG::Heap* heap, int type); + virtual ~SettingButton(); + + virtual void prepare(); + virtual void create(); + virtual void draw(); + + virtual SceneCommand calcFadein(); + virtual SceneCommand calcNormal(); + + virtual void calcCommonAfter(); + + virtual void onEvent(u32 compId, u32 event, void* data); + + bool update(); + + void reserve(int command, u32 msgId); + + bool isPlaying() const; + void setSoundType(int type) { mSoundType = type; } + + private: + void setText(u32 msgId); + + void showBtn(); + void hideBtn(); + + void showWii(); + void hideWii(); + + void start_point_event(const char* paneName, controller::Interface* controller); + void start_left_event(const char* paneName); + void start_trig_event(const char* paneName); + + typedef struct Unk { + int mCommand; // 0x00 + u32 mMsgID; // 0x04 + } Unk; + + Unk unk_0x64[64]; + + int unk_0x264; + int unk_0x268; + int unk_0x26C; + int unk_0x270; + + int mSettingType; // 0x274 + + layout::Object* mpLayout; + nand::LayoutFile* mpLayoutFile; + + gui::PaneManager* mpGuiManager; + + BOOL mBtnHovered; // 0x284 + + int mSoundType; // 0x288 + + bool mbShowBtn; // 0x28C + bool mbFadedIn; // 0x28D + bool mbTrigBtn; // 0x28E + }; + } +} + +#endif // IPL_SETTING_BUTTON_H diff --git a/include/system/MESGEntries.h b/include/system/MESGEntries.h index 0be00fe1..6b52c444 100644 --- a/include/system/MESGEntries.h +++ b/include/system/MESGEntries.h @@ -36,6 +36,10 @@ #define MESG_CHAN_SEL_SAFE_MODE 27 #define MESG_CHAN_SEL_NAND_FULL 154 +/* Settings */ + +#define MESG_SETTING_BTN_BACK 315 + /* Error Messages */ #define MESG_ERROR_CODE 400 @@ -51,5 +55,3 @@ #define MESG_ERROR_NCD_UNKNOWN 410 #endif // IPL_MESSAGE_ENTRIES_H - - diff --git a/include/system/iplController.h b/include/system/iplController.h index a3fb8c69..6a37fbe8 100644 --- a/include/system/iplController.h +++ b/include/system/iplController.h @@ -41,7 +41,7 @@ namespace ipl { virtual int pinchOffTrg() const; // 0x28 virtual int decide() const; // 0x2C virtual int repeat(u32 button) const; // 0x30 - virtual int rumble(int timer) const; // 0x34 + virtual int rumble(int timer = 0) const; // 0x34 virtual void cancelRumbling(); // 0x38 virtual int getHoldFlag() const; // 0x3C virtual int getTrigFlag() const; // 0x40 diff --git a/include/system/iplDialogWindow.h b/include/system/iplDialogWindow.h index f3decf88..1e939276 100644 --- a/include/system/iplDialogWindow.h +++ b/include/system/iplDialogWindow.h @@ -11,10 +11,7 @@ #include "layout/iplLayout.h" namespace ipl { - namespace gui { - class PaneManager; - } - + USE_GUI_MANAGER class DialogWindow : public ::gui::EventHandler { public: enum { @@ -178,6 +175,4 @@ namespace ipl { }; } -#include "layout/iplGuiManager.h" - #endif // IPL_DIALOG_WINDOW_H diff --git a/include/system/iplSystem.h b/include/system/iplSystem.h index 51a338ba..fdc24c6a 100644 --- a/include/system/iplSystem.h +++ b/include/system/iplSystem.h @@ -1,6 +1,7 @@ #ifndef IPL_SYSTEM_H #define IPL_SYSTEM_H +#include "bannerSound/BannerSoundPlayer.h" #include "config.h" #include @@ -26,9 +27,10 @@ #include "system/iplPostmanManager.h" #include "system/iplNigaoeManager.h" #include "system/iplBS2Manager.h" - #include "scene/iplSceneManager.h" +#include "sound/iplSound.h" + namespace ipl { class System { public: diff --git a/libs/MSL/include/cstring b/libs/MSL/include/cstring index c5c037d3..d83b031a 100644 --- a/libs/MSL/include/cstring +++ b/libs/MSL/include/cstring @@ -8,11 +8,13 @@ extern "C" { #endif -char* stricmp(char* dst, const char* src); +int strcmp(const char* dst, const char* src); + +int stricmp(const char* dst, const char* src); char* strncpy(char* dst, const char* src, size_t length); char* strncat(char* dst, const char* src, size_t length); -char* strncmp(char* dst, const char* src, size_t lengt); +int strncmp(const char* dst, const char* src, size_t length); size_t strlen(const char* str); diff --git a/libs/MSL/include/string.h b/libs/MSL/include/string.h index 86048f6a..3769d5fe 100644 --- a/libs/MSL/include/string.h +++ b/libs/MSL/include/string.h @@ -9,9 +9,14 @@ namespace std { // MSL/memory.h using ::memcpy; using ::memset; - + + using ::strcmp; using ::stricmp; + using ::strncpy; + using ::strncat; + using ::strncmp; + using ::strlen; using ::sprintf; @@ -20,6 +25,3 @@ namespace std { #endif #endif // MSL_STRING_H - - - diff --git a/libs/RVL_SDK/include/private/OSLaunchForSystem.h b/libs/RVL_SDK/include/private/OSLaunchForSystem.h new file mode 100644 index 00000000..6b92e8b9 --- /dev/null +++ b/libs/RVL_SDK/include/private/OSLaunchForSystem.h @@ -0,0 +1,17 @@ +#ifndef REVOLUTION_OS_LAUNCH_FOR_SYSTEM_H +#define REVOLUTION_OS_LAUNCH_FOR_SYSTEM_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void __OSLaunchTitlevForSystem(u64 titleId, u32 launchCode, char* const argv[]); +void __OSLaunchTitlelForSystem(u64 titleId, u32 launchCode, const char* arg, ...); + +#ifdef __cplusplus +} +#endif + +#endif // REVOLUTION_OS_LAUNCH_FOR_SYSTEM_H diff --git a/src/layout/GUIManager.cpp b/src/layout/GUIManager.cpp index eaa543c1..d928c9af 100644 --- a/src/layout/GUIManager.cpp +++ b/src/layout/GUIManager.cpp @@ -324,18 +324,18 @@ namespace gui { drawLine_(x - size.width / 2, y + size.height / 2, x - size.width / 2, y - size.height / 2, 0, 8, color); } } -} -static bool is_visible(nw4r::lyt::Pane* pane) { - if (!pane->IsVisible()) { - return false; + static bool is_visible(nw4r::lyt::Pane* pane) { + if (!pane->IsVisible()) { + return false; + } + if (pane->GetParent() == NULL) { + return true; + } + return is_visible(pane->GetParent()); } - if (pane->GetParent() == NULL) { - return true; + + bool PaneComponent::isVisible() { + return is_visible(mpPane); } - return is_visible(pane->GetParent()); -} - -bool gui::PaneComponent::isVisible() { - return is_visible(mpPane); } diff --git a/src/scene/settingSelect/iplSettingBg.cpp b/src/scene/settingSelect/iplSettingBg.cpp index 49e88308..d6d6e616 100644 --- a/src/scene/settingSelect/iplSettingBg.cpp +++ b/src/scene/settingSelect/iplSettingBg.cpp @@ -2,9 +2,9 @@ namespace ipl { namespace scene { - SettingBg::SettingBg(EGG::Heap* heap, int sceneID) : + SettingBg::SettingBg(EGG::Heap* heap, int type) : Base(heap), - mSceneID(sceneID), + mSettingType(type), mpLayout(NULL), mpLayoutFile(NULL) { mFlags = 3; @@ -18,8 +18,8 @@ namespace ipl { mpLayout = new layout::Object(mpHeap, mpLayoutFile, "arc", "it_BgSetUp_a.brlyt"); mpLayout->finishBinding(); - createChildScene(SCENE_SETTING_BUTTON, this, NULL, (void*)mSceneID); - createChildScene(SCENE_SETTING_SELECT, this, NULL, (void*)mSceneID); + createChildScene(SCENE_SETTING_BUTTON, this, NULL, (void*)mSettingType); + createChildScene(SCENE_SETTING_SELECT, this, NULL, (void*)mSettingType); System::getFader()->fadeIn(); } diff --git a/src/scene/settingSelect/iplSettingButton.cpp b/src/scene/settingSelect/iplSettingButton.cpp new file mode 100644 index 00000000..c5e839ba --- /dev/null +++ b/src/scene/settingSelect/iplSettingButton.cpp @@ -0,0 +1,269 @@ +#include "scene/settingSelect/iplSettingButton.h" + +#include "layout/iplGuiManager.h" + +// !!=================================!! +// !!FIXING: ORDER OF VTABLE FOR MATCH!! +// !!=================================!! + +static const char* lbl_81697258[2] = { + "WIPL_SE_CANCEL", + "WIPL_SE_DECIDE", +}; + +namespace ipl { + namespace scene { + enum { + ANIM_SEEN_IN = 0, + ANIM_BTN_FOCUS_IN, + ANIM_BTN_FOCUS_OUT, + ANIM_BTN_FLASH, + ANIM_WII_APPEAR, + ANIM_WII_LOST, + ANIM_ALPHA_IN, + ANIM_ALPHA_OUT, + }; + + SettingButton::SettingButton(EGG::Heap* heap, int type) : + FaderSceneBase(heap), + ::gui::EventHandler() { + unk_0x264 = 64; + unk_0x268 = 0; + unk_0x26C = 0; + unk_0x270 = 0; + mSettingType = type; + mpLayout = NULL; + mpLayoutFile = NULL; + mpGuiManager = NULL; + mBtnHovered = FALSE; + mSoundType = CANCEL; + mbShowBtn = true; + mbFadedIn = false; + mbTrigBtn = false; + } + + void SettingButton::prepare() { + mpLayoutFile = System::getNandManager()->readLayoutAsync(mpHeap, "setupBtn.ash"); + } + + void SettingButton::create() { + mpLayout = new layout::Object(mpHeap, mpLayoutFile, "arc", "it_Button_a.brlyt"); + + mpLayout->bindToGroup("it_Button_a_SeenIn.brlan", "G_BarIn", false); + mpLayout->bindToGroup("it_Button_a_BtnFoucusIn.brlan", "G_FocusBtnA", false, false); + mpLayout->bindToGroup("it_Button_a_BtnFoucusOut.brlan", "G_FocusBtnA", false, false); + mpLayout->bindToGroup("it_Button_a_BtnFlash.brlan", "G_SelectBtnA", false, false); + mpLayout->bindToGroup("it_Button_a_WiiAppear.brlan", "G_Wii", false, false); + mpLayout->bindToGroup("it_Button_a_WiiLost.brlan", "G_Wii", false); + mpLayout->bindToGroup("it_Button_a_AlphIn.brlan", "G_FocusBtnA", false, false); + mpLayout->bindToGroup("it_Button_a_AlphOut.brlan", "G_FocusBtnA", false, false); + mpLayout->finishBinding(); + + mpGuiManager = new gui::PaneManager(this, mpLayout->getDrawInfo(), NULL, NULL, true); + mpGuiManager->createLayoutScene(*mpLayout->getLayout()); + mpGuiManager->setAllComponentTriggerTarget(false); + mpGuiManager->setTriggerTarget(mpLayout->findPane("B_Button_00"), true); + + setText(MESG_SETTING_BTN_BACK); + + if (mSettingType == 1) { + mbShowBtn = false; + mpLayout->getAnim(ANIM_ALPHA_IN)->initAnmFrame(); + } + else { + mbShowBtn = true; + mpLayout->getAnim(ANIM_ALPHA_OUT)->initAnmFrame(); + } + } + + SceneCommand SettingButton::calcFadein() { + SceneCommand result = SCENE_CONTINUE; + if (!mbFadedIn) { + if (System::getFader()->getStatus() == EGG::Fader::STATUS_PREPARE_OUT) { + mbFadedIn = true; + mpLayout->getAnim(ANIM_SEEN_IN)->playAnmFrame(); + } + } + else { + if (!mpLayout->getAnim(ANIM_SEEN_IN)->isPlaying()) { + result = SCENE_NEXT; + } + } + + return result; + } + + SceneCommand SettingButton::calcNormal() { + if (!mpLayout->getAnim(ANIM_ALPHA_IN)->isPlaying() + && !mpLayout->getAnim(ANIM_ALPHA_OUT)->isPlaying() + && !mpLayout->getAnim(ANIM_BTN_FLASH)->isPlaying() + && unk_0x268 != 0) { + Unk unk = unk_0x64[unk_0x26C]; + switch (unk.mCommand) { + case CMD_SHOW_BTN: { + showBtn(); + break; + } + case CMD_HIDE_BTN: { + hideBtn(); + break; + } + case CMD_SET_TEXT: { + setText(unk.mMsgID); + break; + } + } + + if (unk_0x268 != 0) { + if (++unk_0x26C >= unk_0x264) { + unk_0x26C = 0; + } + unk_0x268--; + } + + } + + return SCENE_CONTINUE; + } + + void SettingButton::calcCommonAfter() { + mpLayout->calc(); + mpGuiManager->calc(); + } + + void SettingButton::draw() { + if (System::getSceneManager()->canDrawScene()) { + utility::Graphics::setOrtho(); + mpLayout->draw(); + } + } + + static bool isPane(const char* paneName, const char* findName) { + return strcmp(paneName, findName) == 0; + } + + void SettingButton::start_point_event(const char* paneName, controller::Interface* controller) { + if (isPane(paneName, "B_Button_00")) { + if (mBtnHovered == FALSE) { + snd::getSystem()->startSE("WIPL_SE_BT_TARGETTING"); + if (controller) { + controller->rumble(); + } + mpLayout->getAnim(ANIM_BTN_FOCUS_IN)->playAnmFrame(); + } + mBtnHovered++; + } + } + + void SettingButton::start_left_event(const char* paneName) { + if (isPane(paneName, "B_Button_00")) { + if (mBtnHovered == TRUE) { + mpLayout->getAnim(ANIM_BTN_FOCUS_OUT)->playAnmFrame(); + } + mBtnHovered--; + } + } + + void SettingButton::start_trig_event(const char* paneName) { + if (isPane(paneName, "B_Button_00")) { + snd::getSystem()->startSE(lbl_81697258[mSoundType]); + + mpLayout->getAnim(ANIM_BTN_FLASH)->playAnmFrame(); + + mbTrigBtn = true; + mpGuiManager->init(); + + mBtnHovered = FALSE; + } + } + + void SettingButton::onEvent(u32 compId, u32 event, void* data) { + ::gui::PaneComponent* component = (::gui::PaneComponent*)mpManager->getComponent(compId); + const char* paneName = component->getPane()->GetName(); + + controller::Interface* controller = static_cast(data); + + switch (event) { + case ::gui::EventHandler::ON_POINT: { + start_point_event(paneName, controller); + break; + } + case ::gui::EventHandler::ON_OFFPOINT: { + start_left_event(paneName); + break; + } + case ::gui::EventHandler::ON_TRIG: { + if (controller->downTrg(IPL_BUTTON_A)) { + start_trig_event(paneName); + } + break; + } + } + } + + bool SettingButton::update() { + bool result = false; + if (getState() == FADE_STATE_NORMAL && mbShowBtn + && !mpLayout->getAnim(ANIM_ALPHA_IN)->isPlaying()) { + mpGuiManager->update(); + + result = mbTrigBtn; + mbTrigBtn = false; + } + + return result; + } + + void SettingButton::showWii() { + mpLayout->getAnim(ANIM_WII_APPEAR)->playAnmFrame(); + } + + void SettingButton::hideWii() { + mpLayout->getAnim(ANIM_WII_LOST)->playAnmFrame(); + } + + void SettingButton::showBtn() { + if (mbShowBtn == false) { + mbShowBtn = true; + mpLayout->getAnim(ANIM_ALPHA_IN)->playAnmFrame(); + } + } + + void SettingButton::hideBtn() { + if (mbShowBtn == true) { + mbShowBtn = false; + mpLayout->getAnim(ANIM_ALPHA_OUT)->playAnmFrame(); + } + } + + void SettingButton::setText(u32 msgId) { + nw4r::lyt::Pane* pane = mpLayout->findPane("T_Button_00"); + nw4r::lyt::TextBox* textBox = nw4r::ut::DynamicCast(pane); + textBox->SetString(System::getMessage(msgId)); + } + + void SettingButton::reserve(int command, u32 msgId) { + if (unk_0x264 != unk_0x268) { + int unk = unk_0x270; + unk_0x64[unk].mCommand = command; + unk_0x64[unk].mMsgID = msgId; + unk_0x270++; + + if (unk_0x270 >= unk_0x264) { + unk_0x270 = 0; + } + unk_0x268++; + } + } + + bool SettingButton::isPlaying() const { + return mpLayout->getAnim(ANIM_BTN_FLASH)->isPlaying(); + } + + SceneCommand FaderSceneBase::calcFadeout() { + return SCENE_NEXT; + } + + SettingButton::~SettingButton() {} + } +} diff --git a/src/system/iplBS2Manager.cpp b/src/system/iplBS2Manager.cpp index d2cd1520..86bec7f8 100644 --- a/src/system/iplBS2Manager.cpp +++ b/src/system/iplBS2Manager.cpp @@ -5,8 +5,6 @@ #include "system/iplSystem.h" -#include "sound/iplSound.h" - #define MAX_ENTRIES 34 namespace ipl { diff --git a/src/system/iplChannelScriptManager.cpp b/src/system/iplChannelScriptManager.cpp index ac079dc5..63c0945e 100644 --- a/src/system/iplChannelScriptManager.cpp +++ b/src/system/iplChannelScriptManager.cpp @@ -1,9 +1,9 @@ #include "system/iplChannelScriptManager.h" -#include "sound/iplSound.h" - #include "channelScript/iplCSLibrary.h" +#include "sound/iplSound.h" + #include namespace ipl { diff --git a/src/system/iplDialogWindow.cpp b/src/system/iplDialogWindow.cpp index d03e164c..8d74a5e7 100644 --- a/src/system/iplDialogWindow.cpp +++ b/src/system/iplDialogWindow.cpp @@ -2,12 +2,12 @@ #include "utility/iplGraphics.h" -#include "sound/iplSound.h" - #include "system/iplSystem.h" +#include "layout/iplGuiManager.h" + #include -#pragma sym on + namespace ipl { /** * BtnB = Button 0 - Button on Btn1, Right button on Btn2, Top button on Btn3 @@ -190,13 +190,13 @@ namespace ipl { // Dialog with two buttons (alternative) mDialog[DIALOG_TYPE_BTN2B].mpLayout = new(heap, CLASS_HEAP) layout::Object(heap, mpLayoutFile, "arc", "my_DialogWindow_b.brlyt"); - mDialog[DIALOG_TYPE_BTN2B].mpLayout->bindToGroup("my_DialogWindow_b_DialogIn.brlan", "G_InOut", false); - mDialog[DIALOG_TYPE_BTN2B].mpLayout->bindToGroup("my_DialogWindow_b_DialogOut.brlan", "G_InOut", false, false); - mDialog[DIALOG_TYPE_BTN2B].mpLayout->bindToGroup("my_DialogWindow_b_FocusBtn_on.brlan", "G_FocusBtnB", false, false); - mDialog[DIALOG_TYPE_BTN2B].mpLayout->bindToGroup("my_DialogWindow_b_FocusBtn_off.brlan", "G_FocusBtnB", false, false); + mDialog[DIALOG_TYPE_BTN2B].mpLayout->bindToGroup("my_DialogWindow_b_DialogIn.brlan", "G_InOut", false); + mDialog[DIALOG_TYPE_BTN2B].mpLayout->bindToGroup("my_DialogWindow_b_DialogOut.brlan", "G_InOut", false, false); + mDialog[DIALOG_TYPE_BTN2B].mpLayout->bindToGroup("my_DialogWindow_b_FocusBtn_on.brlan", "G_FocusBtnB", false, false); + mDialog[DIALOG_TYPE_BTN2B].mpLayout->bindToGroup("my_DialogWindow_b_FocusBtn_off.brlan", "G_FocusBtnB", false, false); mDialog[DIALOG_TYPE_BTN2B].mpLayout->bindToGroup("my_DialogWindow_b_SelectBtn_Ac.brlan", "G_SelectBtnB", false, false); - mDialog[DIALOG_TYPE_BTN2B].mpLayout->bindToGroup("my_DialogWindow_b_FocusBtn_on.brlan", "G_FocusBtnA", false, false); - mDialog[DIALOG_TYPE_BTN2B].mpLayout->bindToGroup("my_DialogWindow_b_FocusBtn_off.brlan", "G_FocusBtnA", false, false); + mDialog[DIALOG_TYPE_BTN2B].mpLayout->bindToGroup("my_DialogWindow_b_FocusBtn_on.brlan", "G_FocusBtnA", false, false); + mDialog[DIALOG_TYPE_BTN2B].mpLayout->bindToGroup("my_DialogWindow_b_FocusBtn_off.brlan", "G_FocusBtnA", false, false); mDialog[DIALOG_TYPE_BTN2B].mpLayout->bindToGroup("my_DialogWindow_b_SelectBtn_Ac.brlan", "G_SelectBtnA", false, false); mDialog[DIALOG_TYPE_BTN2B].mpLayout->finishBinding(); mDialog[DIALOG_TYPE_BTN2B].mpGui = new(heap, CLASS_HEAP) gui::PaneManager(NULL, mDialog[DIALOG_TYPE_BTN2B].mpLayout->getDrawInfo(), NULL, allocator); @@ -1074,7 +1074,7 @@ namespace ipl { snd::getSystem()->startSE("WIPL_SE_BT_TARGETTING"); if (controller) { - controller->rumble(0); + controller->rumble(); } mpCurDialog->mpLayout->getAnim(animIdx)->playAnmFrame();