From 10d062c3acad0b65137e148df1dd0844b304883b Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 04:45:26 +0000 Subject: [PATCH 1/6] wip: salvage uncommitted luna worktree state --- include/scene/address/iplAddress.h | 33 +- src/scene/address/iplAddress.cpp | 2700 +++++++++++++++++++++++++++- 2 files changed, 2640 insertions(+), 93 deletions(-) diff --git a/include/scene/address/iplAddress.h b/include/scene/address/iplAddress.h index 284d67aa..98af9b23 100644 --- a/include/scene/address/iplAddress.h +++ b/include/scene/address/iplAddress.h @@ -2,10 +2,15 @@ #define IPL_SCENE_ADDRESS_H #include "iplSceneHeader.h" +#include "scene/button/iplButton.h" #include namespace ipl { + namespace layout { + class Object; + } + namespace scene { class FriendListCache { public: @@ -16,10 +21,13 @@ namespace ipl { NWC24FriendInfo mInfos[100]; }; - FADER_SCENE_CLASS(Address) { + FADER_SCENE_CLASS(Address), public ButtonEventHandlerBase { public: Address(EGG::Heap * heap, int); + virtual ~Address(); + virtual void create(); virtual void destroy() override; + virtual void draw(); enum { SCENE_ADD_WII = 1, @@ -34,9 +42,28 @@ namespace ipl { } private: - u8 unk_0x58[0x68]; + class MiiObj { + public: + u8 unk_0x0[0x20]; + void* unk_0x20; + void* unk_0x24; + }; + + u8 unk_0x64[0x28]; + ipl::layout::Object* mLayout; + u8 unk_0x90[0x0C]; + ipl::layout::Object* mPaneLayout; + ipl::layout::Object* mCursorLayout; + u8 unk_0xA4[8]; + int mState; + int mPage; + int mPageCount; + int mFriendCount; + int mSelectedButton; int unk_0xC0; - u8 unk_0xC4[0x1B0]; + u8 unk_0xC4[0x20]; + MiiObj mMiiObjA[5]; + MiiObj mMiiObjB[5]; FriendListCache* unk_0x274; u8 unk_0x278[0x28]; }; diff --git a/src/scene/address/iplAddress.cpp b/src/scene/address/iplAddress.cpp index 3499b980..e1e2a6cb 100644 --- a/src/scene/address/iplAddress.cpp +++ b/src/scene/address/iplAddress.cpp @@ -1,35 +1,87 @@ #include "scene/address/iplAddress.h" +#include "scene/letterWriter/iplLetterWriter.h" +#include "scene/mailAddSel/iplMailAddressSelect.h" +#include "scene/button/iplButton.h" +#include "sound/iplSound.h" +#include "system/iplController.h" #include "system/MESGEntries.h" #include "system/iplSystem.h" +#include "scene/setting/iplNCDSetting.h" +#include "layout/iplGuiManager.h" +#include "layout/iplLayout.h" +#include "utility/iplCharacterCode.h" +#include #include -extern "C" const char* sTextNameB[5] = { - "T_name_b_00", "T_name_b_01", "T_name_b_02", "T_name_b_03", "T_name_b_04", +extern "C" char lbl_81647538[] __attribute__((aligned(1))) = "T_name_b_00"; +extern "C" char lbl_81647544[] __attribute__((aligned(1))) = "T_name_b_01"; +extern "C" char lbl_81647550[] __attribute__((aligned(1))) = "T_name_b_02"; +extern "C" char lbl_8164755C[] __attribute__((aligned(1))) = "T_name_b_03"; +extern "C" char lbl_81647568[] __attribute__((aligned(1))) = "T_name_b_04"; +extern "C" const char* lbl_81647574[5] = { + lbl_81647538, lbl_81647544, lbl_81647550, lbl_8164755C, lbl_81647568, }; -extern "C" const char* sTextNameC[5] = { - "T_name_c_00", "T_name_c_01", "T_name_c_02", "T_name_c_03", "T_name_c_04", +extern "C" char lbl_81647588[] __attribute__((aligned(1))) = "T_name_c_00"; +extern "C" char lbl_81647594[] __attribute__((aligned(1))) = "T_name_c_01"; +extern "C" char lbl_816475A0[] __attribute__((aligned(1))) = "T_name_c_02"; +extern "C" char lbl_816475AC[] __attribute__((aligned(1))) = "T_name_c_03"; +struct TextNameCData { + char lastName[12]; + const char* names[5]; +}; +extern "C" TextNameCData lbl_816475B8 = { + "T_name_c_04", {lbl_81647588, lbl_81647594, lbl_816475A0, lbl_816475AC, + lbl_816475B8.lastName}, }; -extern "C" const char* sButtonNameB[5] = { - "B_name_b_00", "B_name_b_01", "B_name_b_02", "B_name_b_03", "B_name_b_04", +extern "C" char lbl_816475D8[] __attribute__((aligned(1))) = "B_name_b_00"; +extern "C" char lbl_816475E4[] __attribute__((aligned(1))) = "B_name_b_01"; +extern "C" char lbl_816475F0[] __attribute__((aligned(1))) = "B_name_b_02"; +extern "C" char lbl_816475FC[] __attribute__((aligned(1))) = "B_name_b_03"; +extern "C" char lbl_81647608[] __attribute__((aligned(1))) = "B_name_b_04"; +extern "C" const char* lbl_81647614[5] = { + lbl_816475D8, lbl_816475E4, lbl_816475F0, lbl_816475FC, lbl_81647608, }; -extern "C" const char* sButtonSpaceName[4] = { - "B_name_b_00_01", "B_name_b_01_02", "B_name_b_02_03", "B_name_b_03_04", +extern "C" char lbl_81647628[] __attribute__((aligned(1))) = "B_name_b_00_01"; +extern "C" char lbl_81647637[] __attribute__((aligned(1))) = "B_name_b_01_02"; +extern "C" char lbl_81647646[] __attribute__((aligned(1))) = "B_name_b_02_03"; +extern "C" char lbl_81647655[] __attribute__((aligned(1))) = "B_name_b_03_04"; +extern "C" const char* lbl_81647664[4] = { + lbl_81647628, lbl_81647637, lbl_81647646, lbl_81647655, }; -extern "C" const char* sNameB[5] = { - "name_b_00", "name_b_01", "name_b_02", "name_b_03", "name_b_04", +extern "C" char lbl_81647674[] __attribute__((aligned(1))) = "name_b_00"; +extern "C" char lbl_8164767E[] __attribute__((aligned(1))) = "name_b_01"; +extern "C" char lbl_81647688[] __attribute__((aligned(1))) = "name_b_02"; +extern "C" char lbl_81647692[] __attribute__((aligned(1))) = "name_b_03"; +struct NameBData { + char lastName[10]; + unsigned char alignment[2]; + const char* names[5]; +}; +extern "C" NameBData lbl_8164769C = { + "name_b_04", {0, 0}, {lbl_81647674, lbl_8164767E, lbl_81647688, lbl_81647692, + lbl_8164769C.lastName}, }; -extern "C" const char* sNameC[5] = { - "G_name_c_00", "G_name_c_01", "G_name_c_02", "G_name_c_03", "G_name_c_04", +extern "C" char lbl_816476BC[] __attribute__((aligned(1))) = "G_name_c_00"; +extern "C" char lbl_816476C8[] __attribute__((aligned(1))) = "G_name_c_01"; +extern "C" char lbl_816476D4[] __attribute__((aligned(1))) = "G_name_c_02"; +extern "C" char lbl_816476E0[] __attribute__((aligned(1))) = "G_name_c_03"; +#pragma pack(push, 1) +struct NameCData { + char lastName[12]; + const char* names[5]; + char pool[0x276]; }; - -extern "C" char sAddressStringPoolA[] = +#pragma pack(pop) +extern "C" NameCData lbl_816476EC = { + "G_name_c_04", + {lbl_816476BC, lbl_816476C8, lbl_816476D4, lbl_816476E0, lbl_816476EC.lastName}, "th_Adress_a.brlyt\0" "th_Adress_a_note_alp_in.brlan\0" "G_note_all\0" @@ -58,92 +110,137 @@ extern "C" char sAddressStringPoolA[] = "mii_b_%02d\0" "mii_c_%02d\0" "T_adrs_00\0" - "T_wii_msg\0" - "N_note_move\0" - "WIPL_SE_FL_PAGE_INC\0" - "\0"; - -extern "C" void calc__Q33ipl6layout6ObjectFv(); - -extern "C" void (*sAddressJumpTable[26])() = { - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, - calc__Q33ipl6layout6ObjectFv, + "T_wii_msg" }; - -extern "C" char sAddressStringPoolB[] = - "N_note_a\0" - "N_note_b\0" - "N_note_c\0" - "N_note_d\0" - "N_note_e\0" - "T_wii_name\0" - "T_nmbr_b\0" - "WIPL_SE_FL_PAGE_DEC\0" - "N_note_base\0" - "T_CalAdd_R\0" - "WIPL_SE_DECIDE\0" - "mii_move\0" - "WIPL_SE_CH_HOLD\0" - "WIPL_SE_CH_SET\0" - "WIPL_SE_CH_NOT_MOVE\0" - "WIPL_SE_BT_TARGETTING\0" - "WIPL_SE_CANCEL\0" - "T_nmbr_c\0" - "\0\0%" - "\0" - "0\0" - "6\0" - "d\0" - "\n\0\0" - "T_name_move\0" - "WIPL_SE_CH_DRAG\0" - "N_base_move\0" - "\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38" - "\x00\x39\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36" - "\x00\x00\x00\x25\x00\x30\x00\x31\x00\x36\x00\x6c\x00\x6c\x00\x64" - "\x00"; +extern "C" const wchar_t lbl_8160F650[] = L"0123456789"; +extern "C" const float lbl_816947D0[2] = {176.0f, -0.0f}; +extern "C" const float lbl_816947D8 = 0.0f; +extern "C" const float lbl_816947DC = 20.0f; +extern "C" const float lbl_816947E0 = 1.0f; +extern "C" const float lbl_816947E4 = 0.01f; +extern "C" float lbl_81698B50; +extern "C" float lbl_81698B54; +extern "C" float lbl_816947E8 __attribute__((section(".sdata2"), aligned(4))) = -1.0f; +extern "C" const u16 lbl_8160F666 __attribute__((section(".rodata"), aligned(1), used)) = 0; +static ipl::math::VEC2 sAddressVEC2(lbl_816947E8, lbl_816947E8); +extern "C" char lbl_81647982[] __attribute__((aligned(1))) = "N_note_move"; +extern "C" char lbl_8164798E[] __attribute__((aligned(1))) = "WIPL_SE_FL_PAGE_INC"; +extern "C" char sAddressStringPoolB[]; extern "C" char smArg__Q23ipl6System; extern "C" void checkUserId__Q33ipl5nwc247ManagerFUx(); extern "C" void getErrCode__Q33ipl5nwc247ManagerFv(); extern "C" void close__Q33ipl5nwc247ManagerFv(); +extern "C" int check__Q33ipl5nwc247ManagerFUl(void*, unsigned int); +extern "C" void initFrame__Q33ipl7utility15FrameControllerFv(void*); +extern "C" char lbl_81647AC3[]; +extern "C" char lbl_81647538[]; +extern "C" char lbl_81647982[]; extern "C" void deleteFriendInfo__Q33ipl5nwc247ManagerFUl(); extern "C" void getScene__Q33ipl5scene7ManagerFi(); extern "C" void setEventHandler__Q33ipl5scene6ButtonFPQ23gui12EventHandlerPQ23gui12EventHandler(); extern "C" void calc__Q33ipl6layout6ObjectFv(); extern "C" void __ct__Q33ipl4math4VEC2Fff(); extern "C" void __dt__Q33ipl6nigaoe6ObjectFv(); -extern "C" void __dl__FPv(); +extern "C" void __dl__FPv(void*); extern "C" void GetTexture__Q34nw4r3lyt8MaterialCFP9_GXTexObjUc(); extern "C" void SetTexture__Q34nw4r3lyt8MaterialFUcRC9_GXTexObj(); extern "C" void create__Q33ipl6nigaoe7ManagerFPQ23EGG4HeapiiiPFPQ33ipl6nigaoe6ObjectPvPv(); -extern "C" int init__Q33ipl5scene15FriendListCacheFv(void*); +extern "C" int init__Q33ipl5scene15FriendListCacheFv(ipl::scene::FriendListCache*); +extern "C" int check__Q33ipl5scene15FriendListCacheFv( + ipl::scene::FriendListCache*); extern "C" void onInitFriendList__Q33ipl5scene7AddressFv(void*); extern "C" void callBtn1__Q23ipl12DialogWindowFUlUl(void*, unsigned int, unsigned int); +extern "C" void* List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(const void*, unsigned short); +extern "C" void update__Q33ipl3gui11PaneManagerFv(void*); +extern "C" void changePage_onDrag__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void reset_gui__Q33ipl5scene7AddressFb(ipl::scene::Address* self, bool reset); +extern "C" void left_point_event__Q33ipl5scene7AddressFi(ipl::scene::Address* self, int index); +extern "C" void set_textbox__Q33ipl5scene7AddressFPCcPCw( + ipl::scene::Address* self, const char* paneName, const wchar_t* text); +extern "C" void set_page_text__Q33ipl5scene7AddressFPCci( + ipl::scene::Address* self, const char* paneName, int page); +extern "C" void add_translate__Q33ipl5scene7AddressFPQ34nw4r3lyt4PaneRCQ33ipl4math4VEC2( + void* self, nw4r::lyt::Pane* pane, const ipl::math::VEC2& offset); +extern "C" int get_button_no__Q33ipl5scene7AddressFPCc(void* self, const char* paneName); +extern "C" void on_point_event__Q33ipl5scene7AddressFiPQ33ipl10controller9Interface( + ipl::scene::Address* self, int index, void* controller); +extern "C" bool isReleasableArea__Q33ipl5scene7AddressFii(ipl::scene::Address* self, int page, + int index); +extern "C" void SetTranslate__Q34nw4r3lyt4PaneFRCQ34nw4r4math4VEC3( + nw4r::lyt::Pane* pane, const nw4r::math::VEC3* translate); +extern "C" void SetTranslate__Q34nw4r3lyt4PaneFRCQ34nw4r4math4VEC2( + nw4r::lyt::Pane* pane, const nw4r::math::VEC2* translate); +extern "C" void set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( + ipl::scene::Address* self, const char* paneName, unsigned int friendIndex, + unsigned int buttonIndex, void* miiObj, bool isDrag); +extern "C" void writeFriendInfo__Q33ipl5nwc247ManagerFPC15NWC24FriendInfoUl( + void* manager, const NWC24FriendInfo* info, unsigned int index); +extern "C" void updateFriendInfo__Q33ipl5nwc247ManagerFPC15NWC24FriendInfoUl( + void* manager, const NWC24FriendInfo* info, unsigned int index); +extern "C" void swapFriendInfo__Q33ipl5nwc247ManagerFUlUl( + void* manager, unsigned int first, unsigned int second); +extern "C" void swap__Q33ipl5scene15FriendListCacheFUlUl( + ipl::scene::FriendListCache* self, unsigned int first, unsigned int second); +extern "C" void entry_friend__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void reserveAllSceneDestruction__Q33ipl5scene4BaseFiPv( + void* self, int sceneId, void* args); +extern "C" void createChildScene__Q33ipl5scene4BaseFiPQ33ipl5scene4BasePQ33ipl5scene4BasePv( + void* self, int sceneId, void* parent, void* child, void* args); +extern "C" void __ct__Q43ipl5scene7Address6MiiObjFv(); +extern "C" void __dt__Q43ipl5scene7Address6MiiObjFv(); +extern "C" void init__Q43ipl5scene7Address6MiiObjFPQ34nw4r3lyt4Pane( + void*, nw4r::lyt::Pane*); +extern "C" void reset__Q43ipl5scene7Address6MiiObjFv(void*); +extern "C" void set__Q43ipl5scene7Address6MiiObjFUx(void*, unsigned long long); +extern "C" void __construct_array(void*, void (*)(), void (*)(), unsigned int, unsigned int); +extern "C" char __vt__Q33ipl5scene7Address[]; +extern "C" char __vt__Q33ipl5scene12AddressEvent[]; +extern "C" void* __nw__FUli(unsigned int, int); +extern "C" void* __nwa__FUl(unsigned int); +extern "C" void SetVisible__Q34nw4r3lyt4PaneFb(nw4r::lyt::Pane*, bool); +extern "C" void __destroy_arr(void*, void (*)(), unsigned int, unsigned int); + +ipl::scene::Address::Address(EGG::Heap* heap, int mode) : ipl::scene::FaderSceneBase(heap) { + char* address = reinterpret_cast(this); + *reinterpret_cast(address + 0x88) = mode; + *reinterpret_cast(address + 0x8c) = 0; + *reinterpret_cast(address + 0x90) = 0; + *reinterpret_cast(address + 0x94) = 0; + *reinterpret_cast(address + 0x98) = 0; + *reinterpret_cast(address + 0x9c) = 0; + *reinterpret_cast(address + 0xa4) = 1; + *reinterpret_cast(address + 0xa8) = 0; + *reinterpret_cast(address + 0xac) = 1; + *reinterpret_cast(address + 0xb0) = 0; + *reinterpret_cast(address + 0xb4) = 20; + *reinterpret_cast(address + 0xb8) = 0; + *reinterpret_cast(address + 0xbc) = 0; + *reinterpret_cast(address + 0xc0) = 0; + *reinterpret_cast(address + 0xe0) = 0; + __construct_array(&mMiiObjA[0], __ct__Q43ipl5scene7Address6MiiObjFv, + __dt__Q43ipl5scene7Address6MiiObjFv, 0x28, 5); + __construct_array(&mMiiObjB[0], __ct__Q43ipl5scene7Address6MiiObjFv, + __dt__Q43ipl5scene7Address6MiiObjFv, 0x28, 5); + *reinterpret_cast(address + 0x28) = 3; + for (int index = 0; index < 5; index++) { + reinterpret_cast(address + 0xcc)[index] = 0; + } + for (int index = 0; index < 5; index++) { + *reinterpret_cast(address + 0xc4 + index) = 0; + } + memset(address + 0x64, 0, 0x24); + *reinterpret_cast(address + 0x78) = -1; + *reinterpret_cast(address + 0x7c) = -1; +} + +ipl::scene::Address::~Address() { + if (unk_0x274 != NULL) { + __dl__FPv(unk_0x274); + } + __destroy_arr(&mMiiObjB[0], __dt__Q43ipl5scene7Address6MiiObjFv, 0x28, 5); + __destroy_arr(&mMiiObjA[0], __dt__Q43ipl5scene7Address6MiiObjFv, 0x28, 5); +} extern "C" asm void getChild__Q33ipl5scene4BaseFv() { nofralloc @@ -197,14 +294,368 @@ extern "C" asm void prepare__Q33ipl5scene7AddressFv() { blr } +typedef gui::EventHandler GUIEventHandler; + +struct AddressCreateFields { + char unk00[0x24]; + EGG::Heap* heap; + char unk28[0x64]; + ipl::layout::Object* mainLayout; + void* unk90; + gui::EventHandler* event; + ipl::gui::PaneManager* gui; + ipl::layout::Object* backLayout; + ipl::layout::Object* dialogLayout; +}; + +void ipl::scene::Address::create() { + const char* data = lbl_81647538; + ipl::scene::SceneObj* scene = ipl::System::getScene(4); + ipl::nand::LayoutFile* file = *reinterpret_cast(reinterpret_cast(scene) + 0xd20); + *reinterpret_cast(reinterpret_cast(this) + 0xe1) = 1; + *reinterpret_cast(reinterpret_cast(this) + 0x8c) = + new ipl::layout::Object(*reinterpret_cast(reinterpret_cast(this) + 0x24), + file, "arc", data + 0x1d4); + (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) + ->bindToGroup(data + 0x1e6, data + 0x204, false, true); + (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) + ->bindToGroup(data + 0x20f, data + 0x204, false, false); + (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) + ->bindToGroup(data + 0x22e, data + 0x204, false, false); + (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) + ->bindToGroup(data + 0x24d, data + 0x204, false, false); + (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) + ->bindToGroup(data + 0x26d, data + 0x28a, false, + *reinterpret_cast(reinterpret_cast(this) + 0xe1)); + (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) + ->bindToGroup(data + 0x297, data + 0x2b4, false, + !*reinterpret_cast(reinterpret_cast(this) + 0xe1)); + + { + const char* const* names = reinterpret_cast(data + 0x170); + for (int i = 0; i < 5; i++) { + (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) + ->bindToGroup(data + 0x2bf, names[i], false, false); + } + } + { + const char* const* names = reinterpret_cast(data + 0x170); + for (int i = 0; i < 5; i++) { + (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) + ->bindToGroup(data + 0x2d9, names[i], false, false); + } + } + { + const char* const* names = reinterpret_cast(data + 0x170); + for (int i = 0; i < 5; i++) { + (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) + ->bindToGroup(data + 0x2f4, names[i], false, false); + } + } + { + const char* const* names = reinterpret_cast(data + 0x170); + for (int i = 0; i < 5; i++) { + (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) + ->bindToGroup(data + 0x30f, names[i], false, false); + } + } + { + const char* const* names = reinterpret_cast(data + 0x170); + for (int i = 0; i < 5; i++) { + (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) + ->bindToGroup(data + 0x32d, names[i], false, false); + } + } + { + const char* const* names = reinterpret_cast(data + 0x170); + for (int i = 0; i < 5; i++) { + (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) + ->bindToGroup(data + 0x34c, names[i], false, false); + } + } + { + const char* const* names = reinterpret_cast(data + 0x1c0); + for (int i = 0; i < 5; i++) { + (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) + ->bindToGroup(data + 0x36b, names[i], false, false); + } + } + (*reinterpret_cast(reinterpret_cast(this) + 0x8c))->finishBinding(); + + *reinterpret_cast(reinterpret_cast(this) + 0x9c) = + new ipl::layout::Object(*reinterpret_cast(reinterpret_cast(this) + 0x24), + file, "arc", data + 0x388); + (*reinterpret_cast(reinterpret_cast(this) + 0x9c)) + ->bind(data + 0x398, data + 0x3ae, false, true); + (*reinterpret_cast(reinterpret_cast(this) + 0x9c)) + ->bind(data + 0x3b9, data + 0x3ae, false, false); + (*reinterpret_cast(reinterpret_cast(this) + 0x9c))->finishBinding(); + static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast( + reinterpret_cast(this) + 0x9c)) + 0x28c, 0))->initAnmFrame(); + + *reinterpret_cast(reinterpret_cast(this) + 0xa0) = + new ipl::layout::Object(*reinterpret_cast(reinterpret_cast(this) + 0x24), + file, "arc", data + 0x3ce); + (*reinterpret_cast(reinterpret_cast(this) + 0xa0)) + ->bind(data + 0x3e0, "N_Top", false, true); + (*reinterpret_cast(reinterpret_cast(this) + 0xa0)) + ->bind(data + 0x3fb, "N_Top", false, false); + (*reinterpret_cast(reinterpret_cast(this) + 0xa0))->finishBinding(); + nw4r::lyt::TextBox* dialog = nw4r::ut::DynamicCast( + (*reinterpret_cast(reinterpret_cast(this) + 0xa0)) + ->GetRootPane()->FindPaneByName(data + 0x417, true)); + dialog->SetString(ipl::System::getMessage(0x4e), 0); + + AddressCreateFields* fields = reinterpret_cast(this); + GUIEventHandler* event = reinterpret_cast(::operator new(0x14)); + if (event != NULL) { + *reinterpret_cast(reinterpret_cast(event) + 8) = 0; + *reinterpret_cast(event) = __vt__Q33ipl5scene12AddressEvent; + *reinterpret_cast(reinterpret_cast(event) + 0xc) = this; + } + fields->event = event; + + fields->gui = new ipl::gui::PaneManager( + fields->event, fields->mainLayout->getDrawInfo(), NULL, NULL); + fields->gui->setupScene(fields->mainLayout); + fields->gui->setAllComponentTriggerTarget(false); + + const char* const* buttons = reinterpret_cast(data + 0xdc); + for (int i = 0; i < 5; i++) { + fields->gui->setTriggerTarget( + (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) + ->GetRootPane()->FindPaneByName(buttons[i], true), true); + } + buttons = reinterpret_cast(data + 0x12c); + for (int i = 0; i < 4; i++) { + fields->gui->setTriggerTarget( + (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) + ->GetRootPane()->FindPaneByName(buttons[i], true), true); + } + + char paneNameC[16]; + char paneNameB[16]; + for (int i = 0; i < 5; i++) { + sprintf(paneNameC, data + 0x420, i); + void* pane = (*reinterpret_cast( + reinterpret_cast(this) + 0x8c))->GetRootPane()->FindPaneByName(paneNameC, true); + init__Q43ipl5scene7Address6MiiObjFPQ34nw4r3lyt4Pane( + reinterpret_cast(this) + 0xe4 + i * 0x28, + static_cast(pane)); + } + for (int i = 0; i < 5; i++) { + sprintf(paneNameB, data + 0x42b, i); + void* pane = (*reinterpret_cast( + reinterpret_cast(this) + 0x8c))->GetRootPane()->FindPaneByName(paneNameB, true); + init__Q43ipl5scene7Address6MiiObjFPQ34nw4r3lyt4Pane( + reinterpret_cast(this) + 0x1ac + i * 0x28, + static_cast(pane)); + } + + const char* paneName = data + 0x436; + set_textbox__Q33ipl5scene7AddressFPCcPCw(this, paneName, ipl::System::getMessage(0x86)); + paneName = data + 0x440; + set_textbox__Q33ipl5scene7AddressFPCcPCw(this, paneName, ipl::System::getMessage(0x42)); + + void* cache = __nw__FUli(0x9d80, 0x20); + if (cache != NULL) { + *reinterpret_cast(reinterpret_cast(cache) + 0x9d78) = 0; + } + *reinterpret_cast(reinterpret_cast(this) + 0x274) = cache; + if (init__Q33ipl5scene15FriendListCacheFv( + reinterpret_cast(cache))) { + onInitFriendList__Q33ipl5scene7AddressFv(this); + *reinterpret_cast(reinterpret_cast(this) + 0xa4) = 1; + } else { + *reinterpret_cast(reinterpret_cast(this) + 0xa4) = 0; + } + *reinterpret_cast(reinterpret_cast(this) + 0x298) = __nwa__FUl(0x2d20); + nw4r::lyt::Pane* pane = (*reinterpret_cast( + reinterpret_cast(this) + 0x8c))->GetRootPane()->FindPaneByName(data + 0x44a, true); + SetVisible__Q34nw4r3lyt4PaneFb(pane, false); +} + extern "C" asm void calcCommon__Q33ipl5scene14FaderSceneBaseFv() { nofralloc blr } +extern "C" void fistt_fadein__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void fistt_wait_open__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" char lbl_8164798E[]; +extern "C" void onNextPage__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void onPreviousPage__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_cover_normal__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_cover_forward__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_cover_backward__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_normal__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_forward__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_backward__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_loop_forward__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_loop_backward__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_decide__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_drag__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_release__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_wait_child_cst__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_wait_child_dst__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_wait_child_fadeout__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_msg_net__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_wait_parental__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_wait_parental_dst__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_msg_wc__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_wait_parental_wc__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_wait_parental_dst_wc__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_msg_nwc24_error__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_msg_fi_full__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_msg_parental__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_msg_open_failure__Q33ipl5scene7AddressFv(ipl::scene::Address* self); +extern "C" void stt_wait_dialog__Q33ipl5scene7AddressFv(ipl::scene::Address* self); + +extern "C" ipl::scene::FaderSceneCommand calcFadein__Q33ipl5scene7AddressFv( + ipl::scene::Address* self) { + int state = *reinterpret_cast(reinterpret_cast(self) + 0xa4); + switch (state) { + case 0: + fistt_wait_open__Q33ipl5scene7AddressFv(self); + break; + case 1: + fistt_fadein__Q33ipl5scene7AddressFv(self); + break; + } + return *reinterpret_cast(reinterpret_cast(self) + 0xa4) == 2 + ? ipl::scene::FADER_SCN_NEXT + : ipl::scene::FADER_SCN_CONTINUE; +} + +extern "C" void initCalcNormal__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + gui::EventHandler* event = reinterpret_cast(self); + if (event != NULL) { + event = reinterpret_cast(reinterpret_cast(event) + 0x58); + } + static_cast(ipl::System::getScene(5))->setEventHandler(event, NULL); +} + +extern "C" ipl::scene::FaderSceneCommand calcNormal__Q33ipl5scene7AddressFv( + ipl::scene::Address* self) { + int state = *reinterpret_cast(reinterpret_cast(self) + 0xac); + switch (state) { + case 0: + ipl::snd::sSystem.startSE(lbl_8164798E); + onNextPage__Q33ipl5scene7AddressFv(self); + break; + case 1: + stt_cover_normal__Q33ipl5scene7AddressFv(self); + break; + case 2: + stt_cover_forward__Q33ipl5scene7AddressFv(self); + break; + case 3: + stt_cover_backward__Q33ipl5scene7AddressFv(self); + break; + case 4: + stt_normal__Q33ipl5scene7AddressFv(self); + break; + case 5: + stt_forward__Q33ipl5scene7AddressFv(self); + break; + case 6: + stt_backward__Q33ipl5scene7AddressFv(self); + break; + case 7: + stt_loop_forward__Q33ipl5scene7AddressFv(self); + break; + case 8: + stt_loop_backward__Q33ipl5scene7AddressFv(self); + break; + case 9: + stt_decide__Q33ipl5scene7AddressFv(self); + break; + case 10: + stt_drag__Q33ipl5scene7AddressFv(self); + break; + case 11: + stt_release__Q33ipl5scene7AddressFv(self); + break; + case 12: + stt_wait_child_cst__Q33ipl5scene7AddressFv(self); + break; + case 13: + stt_wait_child_dst__Q33ipl5scene7AddressFv(self); + break; + case 14: + stt_wait_child_fadeout__Q33ipl5scene7AddressFv(self); + break; + case 15: + stt_msg_net__Q33ipl5scene7AddressFv(self); + break; + case 16: + stt_wait_parental__Q33ipl5scene7AddressFv(self); + break; + case 17: + stt_wait_parental_dst__Q33ipl5scene7AddressFv(self); + break; + case 18: + stt_msg_wc__Q33ipl5scene7AddressFv(self); + break; + case 19: + stt_wait_parental_wc__Q33ipl5scene7AddressFv(self); + break; + case 20: + stt_wait_parental_dst_wc__Q33ipl5scene7AddressFv(self); + break; + case 21: + stt_msg_nwc24_error__Q33ipl5scene7AddressFv(self); + break; + case 22: + stt_msg_fi_full__Q33ipl5scene7AddressFv(self); + break; + case 23: + stt_msg_parental__Q33ipl5scene7AddressFv(self); + break; + case 24: + stt_msg_open_failure__Q33ipl5scene7AddressFv(self); + break; + case 25: + stt_wait_dialog__Q33ipl5scene7AddressFv(self); + break; + } + return static_cast( + *reinterpret_cast(reinterpret_cast(self) + 0xac) == 0x1a); +} + +extern "C" char sAddressStringPoolBPrefix[0x41] __attribute__((aligned(1))) = + "N_note_a\0" + "N_note_b\0" + "N_note_c\0" + "N_note_d\0" + "N_note_e\0" + "T_wii_name\0" + "T_nmbr_b"; +extern "C" char lbl_81647A4D[0x14] __attribute__((aligned(1))) = "WIPL_SE_FL_PAGE_DEC"; +extern "C" char lbl_81647A61[0xc] __attribute__((aligned(1))) = "N_note_base"; +extern "C" char lbl_81647A6D[0xb] __attribute__((aligned(1))) = "T_CalAdd_R"; +extern "C" char lbl_81647A78[0x4b] __attribute__((aligned(1))) = + "WIPL_SE_DECIDE\0" + "mii_move\0" + "WIPL_SE_CH_HOLD\0" + "WIPL_SE_CH_SET\0" + "WIPL_SE_CH_NOT_MOVE"; +extern "C" char lbl_81647AC3[0x2f] __attribute__((aligned(1))) = + "WIPL_SE_BT_TARGETTING\0" + "WIPL_SE_CANCEL\0" + "T_nmbr_c\0"; +extern "C" wchar_t lbl_81647AF2[] = L"%06d\n"; +extern "C" char lbl_81647AFE[0x1c] __attribute__((aligned(1))) = + "T_name_move\0" + "WIPL_SE_CH_DRAG"; +extern "C" char lbl_81647B1A[0xc] __attribute__((aligned(1))) = "N_base_move"; +extern "C" wchar_t lbl_81647B26[] = L"1234567890123456"; +extern "C" wchar_t lbl_81647B48[] = L"%016lld"; extern "C" void fistt_wait_open__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { char* address = reinterpret_cast(self); - if (init__Q33ipl5scene15FriendListCacheFv(*reinterpret_cast(address + 0x274))) { + if (init__Q33ipl5scene15FriendListCacheFv( + *reinterpret_cast(address + 0x274))) { onInitFriendList__Q33ipl5scene7AddressFv(self); *reinterpret_cast(address + 0xa4) = 1; } else if (*reinterpret_cast(address + 0xa8) >= 300) { @@ -216,6 +667,901 @@ extern "C" void fistt_wait_open__Q33ipl5scene7AddressFv(ipl::scene::Address* sel *reinterpret_cast(address + 0xa8) += 1; } +extern "C" void fistt_fadein__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + if (*reinterpret_cast(static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 0)) + 0x14) != 1 && + *reinterpret_cast(static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 2)) + 0x14) != 1 && + *reinterpret_cast(static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0xa0)) + 0x28c, 0)) + 0x14) != 1) { + *reinterpret_cast(address + 0xa4) = 2; + } +} + +extern "C" void onInitFriendList__Q33ipl5scene7AddressFv(void* self) { + char* address = static_cast(self); + char* stringPool = lbl_81647538; + wchar_t wiiId[24]; + wchar_t displayName[24]; + memset(wiiId, 0, 0x30); + memset(displayName, 0, 0x30); + ipl::utility::CharacterCode::WiiIdToUTF16( + wiiId, + *reinterpret_cast(static_cast(*reinterpret_cast(address + 0x274)) + + 0x7d68)); + + int destinationIndex = 0; + int sourceIndex = 0; + for (int i = 0; i < 4; i++) { + displayName[destinationIndex++] = wiiId[sourceIndex++]; + } + displayName[destinationIndex++] = L' '; + sourceIndex = 4; + for (int i = 0; i < 4; i++) { + displayName[destinationIndex++] = wiiId[sourceIndex++]; + } + displayName[destinationIndex++] = L' '; + sourceIndex = 8; + for (int i = 0; i < 4; i++) { + displayName[destinationIndex++] = wiiId[sourceIndex++]; + } + displayName[destinationIndex++] = L' '; + sourceIndex = 12; + for (int i = 0; i < 4; i++) { + displayName[destinationIndex++] = wiiId[sourceIndex++]; + } + + set_textbox__Q33ipl5scene7AddressFPCcPCw( + static_cast(self), stringPool + 0x501, + displayName); + set_page_text__Q33ipl5scene7AddressFPCci(static_cast(self), + stringPool + 0x50c, + *reinterpret_cast(address + 0xb0) + 1); + + const char** friendNames = reinterpret_cast(stringPool + 0x3c); + unsigned int friendIndex = 0; + int objectOffset = 0; + do { + char* miiObject = address + objectOffset + 0xe4; + set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( + static_cast(self), friendNames[friendIndex], friendIndex, + friendIndex, miiObject, false); + if (*reinterpret_cast(address + friendIndex + 0xc4) != 0) { + static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, + friendIndex + 6)) + ->initAnmFrame(); + } else { + static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, + friendIndex + 0x15)) + ->initAnmFrame(); + } + friendIndex++; + objectOffset += 0x28; + } while (friendIndex < 5); + + *reinterpret_cast(address + 0xb0) = 0; + *reinterpret_cast(address + 0xb8) = 0; + *reinterpret_cast(address + 0xb4) = 20; + ipl::scene::Button* button = reinterpret_cast( + ipl::System::getScene(5)); + button->animation(0x17); + button->animation(0x18); + + if (*reinterpret_cast(address + 0x88) == 0) { + *reinterpret_cast(address + 0xac) = 1; + } else if (*reinterpret_cast(static_cast( + *reinterpret_cast(address + 0x274)) + + 0x7d70) == 0) { + *reinterpret_cast(address + 0xac) = 1; + } else { + *reinterpret_cast(address + 0xac) = 0; + } + + int mode = *reinterpret_cast(address + 0x88); + if (mode == 0) { + goto init_friend_list_mode_zero; + } + if (mode < 0) { + goto init_friend_list_mode_done; + } + if (mode >= 3) { + goto init_friend_list_mode_done; + } + goto init_friend_list_mode_other; + +init_friend_list_mode_zero: { + void* frame = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 0); + initFrame__Q33ipl7utility15FrameControllerFv(frame); + *reinterpret_cast(static_cast(frame) + 0x14) = 1; + } + goto init_friend_list_mode_done; + +init_friend_list_mode_other: { + void* frame = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 2); + initFrame__Q33ipl7utility15FrameControllerFv(frame); + *reinterpret_cast(static_cast(frame) + 0x14) = 1; + void* dialogLayout = *reinterpret_cast(address + 0xa0); + frame = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(dialogLayout) + 0x28c, 0); + initFrame__Q33ipl7utility15FrameControllerFv(frame); + *reinterpret_cast(static_cast(frame) + 0x14) = 1; + } + +init_friend_list_mode_done:; +} + +extern "C" void stt_cover_normal__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + if (*reinterpret_cast(address + 0x84) != 0) { + changePage_onDrag__Q33ipl5scene7AddressFv(self); + } else { + ipl::scene::Button* button = static_cast(ipl::System::getScene(5)); + if (button->isActive()) { + button->update(); + } + } + if (*reinterpret_cast(address + 0xac) == 1) { + if (ipl::System::getMasterController()->down(ipl::controller::BTN_NEXT_RIGHT)) { + ipl::snd::sSystem.startSE(lbl_8164798E); + onNextPage__Q33ipl5scene7AddressFv(self); + } else if (ipl::System::getMasterController()->down(ipl::controller::BTN_NEXT_LEFT)) { + ipl::snd::sSystem.startSE(lbl_81647A4D); + onPreviousPage__Q33ipl5scene7AddressFv(self); + } + } +} + +extern "C" void stt_cover_forward__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + void* layout = *reinterpret_cast(address + 0x8c); + void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(layout) + 0x28c, 4); + if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { + *reinterpret_cast(address + 0xe1) = 0; + if (*reinterpret_cast(address + 0x84) == 0) { + *reinterpret_cast(address + 0xac) = 4; + } else { + *reinterpret_cast(address + 0xac) = 10; + } + } else if (*reinterpret_cast(address + 0x84) != 0) { + changePage_onDrag__Q33ipl5scene7AddressFv(self); + } +} + +extern "C" void stt_cover_backward__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); + if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { + nw4r::math::_VEC2 offset = {-sAddressVEC2.x, -sAddressVEC2.y}; + ipl::math::VEC2 translate(offset); + nw4r::lyt::Pane* pane = reinterpret_cast( + *reinterpret_cast(address + 0x8c)) + ->GetRootPane() + ->FindPaneByName(lbl_81647A61, true); + add_translate__Q33ipl5scene7AddressFPQ34nw4r3lyt4PaneRCQ33ipl4math4VEC2(self, pane, + translate); + *reinterpret_cast(address + 0xe1) = 1; + *reinterpret_cast(address + 0xb4) += 1; + *reinterpret_cast(address + 0xac) = 1; + } else if (*reinterpret_cast(address + 0x84) != 0) { + changePage_onDrag__Q33ipl5scene7AddressFv(self); + } +} + +extern "C" void stt_normal__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + ipl::scene::Button* button = static_cast(ipl::System::getScene(5)); + if (button->isActive()) { + button->update(); + } + if (*reinterpret_cast(address + 0xac) == 4) { + update__Q33ipl3gui11PaneManagerFv(*reinterpret_cast(address + 0x98)); + if (ipl::System::getMasterController()->down(ipl::controller::BTN_NEXT_RIGHT)) { + ipl::snd::sSystem.startSE(lbl_8164798E); + onNextPage__Q33ipl5scene7AddressFv(self); + } else if (ipl::System::getMasterController()->down(ipl::controller::BTN_NEXT_LEFT)) { + ipl::snd::sSystem.startSE(lbl_81647A4D); + onPreviousPage__Q33ipl5scene7AddressFv(self); + } + } +} + +extern "C" void stt_forward__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + void* layout = *reinterpret_cast(address + 0x8c); + void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(layout) + 0x28c, 5); + if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { + *reinterpret_cast(address + 0xb8) += 1; + if (*reinterpret_cast(address + 0x84) == 0) { + *reinterpret_cast(address + 0xac) = 4; + } else { + *reinterpret_cast(address + 0xac) = 10; + } + } else if (*reinterpret_cast(address + 0x84) != 0) { + changePage_onDrag__Q33ipl5scene7AddressFv(self); + } +} + +extern "C" void stt_backward__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* data = lbl_81647538; + char* address = reinterpret_cast(self); + void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 5); + if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { + *reinterpret_cast(address + 0xb4) += 1; + ipl::math::VEC2 translate; + translate.y = -sAddressVEC2.y; + translate.x = -sAddressVEC2.x; + nw4r::lyt::Pane* pane = reinterpret_cast( + *reinterpret_cast(address + 0x8c)) + ->GetRootPane() + ->FindPaneByName(data + 0x529, true); + add_translate__Q33ipl5scene7AddressFPQ34nw4r3lyt4PaneRCQ33ipl4math4VEC2( + self, pane, translate); + set_page_text__Q33ipl5scene7AddressFPCci( + self, data + 0x50c, + *reinterpret_cast(address + 0xb0) + 1); + const char** names = reinterpret_cast(data + 0x3c); + unsigned int index = 0; + int objectOffset = 0; + int nameIndex = 0; + do { + set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( + self, names[nameIndex], + index + *reinterpret_cast(address + 0xb0) * 5, index, + address + objectOffset + 0xe4, false); + index++; + nameIndex++; + objectOffset += 0x28; + } while (index < 5); + if (*reinterpret_cast(address + 0x84) == 0) { + *reinterpret_cast(address + 0xac) = 4; + } else { + *reinterpret_cast(address + 0xac) = 10; + } + } else if (*reinterpret_cast(address + 0x84) != 0) { + changePage_onDrag__Q33ipl5scene7AddressFv(self); + } +} + +extern "C" void stt_loop_forward__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + void* layout = *reinterpret_cast(address + 0x8c); + void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(layout) + 0x28c, 4); + if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { + nw4r::math::VEC2 offset(-sAddressVEC2.x, -sAddressVEC2.y); + ipl::math::VEC2 translate(offset); + nw4r::lyt::Pane* pane = static_cast(layout) + ->GetRootPane() + ->FindPaneByName(lbl_81647A61, true); + add_translate__Q33ipl5scene7AddressFPQ34nw4r3lyt4PaneRCQ33ipl4math4VEC2( + self, pane, translate); + set_page_text__Q33ipl5scene7AddressFPCci( + self, lbl_81647538 + 0x50c, + *reinterpret_cast(address + 0xb0) + 1); + reset_gui__Q33ipl5scene7AddressFb(self, false); + unsigned int friendIndex = 0; + int objectOffset = 0; + int nameOffset = 0; + char* names = lbl_81647538 + 0x3c; + do { + set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( + self, *reinterpret_cast(names + nameOffset), + friendIndex + *reinterpret_cast(address + 0xb0) * 5, + friendIndex, address + objectOffset + 0xe4, false); + friendIndex++; + nameOffset += 4; + objectOffset += 0x28; + } while (friendIndex < 5); + *reinterpret_cast(address + 0xe1) = 1; + *reinterpret_cast(address + 0xb4) = 0x14; + *reinterpret_cast(address + 0xac) = 1; + } else if (*reinterpret_cast(address + 0x84) != 0) { + changePage_onDrag__Q33ipl5scene7AddressFv(self); + } +} + +extern "C" void stt_loop_backward__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + void* layout = *reinterpret_cast(address + 0x8c); + void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(layout) + 0x28c, 4); + if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { + *reinterpret_cast(address + 0xe1) = 0; + *reinterpret_cast(address + 0xb8) = 0x13; + if (*reinterpret_cast(address + 0x84) == 0) { + *reinterpret_cast(address + 0xac) = 4; + } else { + *reinterpret_cast(address + 0xac) = 10; + } + } else if (*reinterpret_cast(address + 0x84) != 0) { + changePage_onDrag__Q33ipl5scene7AddressFv(self); + } +} + +extern "C" void stt_decide__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + ipl::utility::FrameController* animator = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, + *reinterpret_cast(address + 0xbc) + 0x10)); + if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { + animator = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, + *reinterpret_cast(address + 0xbc) + 0x1f)); + if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { + reset_gui__Q33ipl5scene7AddressFb(self, true); + int mode = *reinterpret_cast(address + 0x88); + if (mode != 0) { + if (mode < 0) { + goto stt_decide_done; + } + if (mode >= 3) { + goto stt_decide_done; + } + goto set_friend_info; + } + { + createChildScene__Q33ipl5scene4BaseFiPQ33ipl5scene4BasePQ33ipl5scene4BasePv( + self, 0x17, self, NULL, NULL); + ipl::utility::FrameController* childAnimator = + static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x9c)) + 0x28c, + 0)); + childAnimator->play(); + *reinterpret_cast(address + 0xac) = 0xc; + } + goto stt_decide_done; + set_friend_info: + { + ipl::scene::LetterWriter* letterWriter = + static_cast( + ipl::System::getScene(ipl::SCENE_LETTER_WRITER)); + letterWriter->setFriendInfo( + (*reinterpret_cast(address + 0x274)) + ->getInfo(*reinterpret_cast(address + 0xc0))); + animator = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, + 3)); + animator->play(); + animator = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0xa0)) + 0x28c, + 1)); + animator->play(); + *reinterpret_cast(address + 0xac) = 0x1a; + } + } + } +stt_decide_done: + return; +} + +extern "C" void stt_release__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + static_cast(*reinterpret_cast(address + 0x98))->init(); + int counterOffset = 0; + int index = 0; + do { + if (*reinterpret_cast(address + index + 0xc4) != 0) { + ipl::layout::Animator* animator = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, + index + 6)); + animator->initAnmFrame(); + } else { + ipl::layout::Animator* animator = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, + index + 0x15)); + animator->initAnmFrame(); + } + *reinterpret_cast(address + counterOffset + 0xcc) = 0; + index++; + counterOffset += 4; + } while (index < 5); + ipl::layout::Object* layout = *reinterpret_cast(address + 0x8c); + SetVisible__Q34nw4r3lyt4PaneFb( + layout->GetRootPane()->FindPaneByName(lbl_81647982, true), false); + if (*reinterpret_cast(address + 0xe1) == 0) { + goto release_state_four; + } + *reinterpret_cast(address + 0xac) = 1; + goto release_state_done; +release_state_four: + *reinterpret_cast(address + 0xac) = 4; +release_state_done: + return; +} + +extern "C" void stt_wait_child_cst__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + if (self->getChild() != 0) { + ipl::layout::Object* layout = *reinterpret_cast(address + 0x9c); + void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(layout) + 0x28c, 0); + if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { + *reinterpret_cast(address + 0xac) = 13; + reset_gui__Q33ipl5scene7AddressFb(self, true); + for (int index = 0; index < 5; index++) { + *reinterpret_cast(address + 0xcc + index * 4) = 0; + } + } + } +} + +extern "C" void stt_wait_child_dst__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + if (self->getChild() == 0 && ipl::System::getSceneManager()->getReservedScene() == 0) { + ipl::layout::Object* layout = *reinterpret_cast(address + 0x9c); + void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(layout) + 0x28c, 1); + initFrame__Q33ipl7utility15FrameControllerFv(animator); + *reinterpret_cast(reinterpret_cast(animator) + 0x14) = 1; + gui::EventHandler* event = reinterpret_cast(self); + if (event != 0) { + event = reinterpret_cast(address + 0x58); + } + static_cast(ipl::System::getScene(5))->setEventHandler(event, 0); + *reinterpret_cast(address + 0xac) = 0xe; + } +} + +extern "C" void stt_wait_child_fadeout__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + ipl::layout::Object* layout = *reinterpret_cast(address + 0x9c); + void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(layout) + 0x28c, 1); + if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { + ipl::scene::Button* button = static_cast(ipl::System::getScene(5)); + button->setText(lbl_81647A6D, 0x29); + button->animation(0x17); + button->animation(0x18); + if (*reinterpret_cast(address + 0xe1) != 0) { + *reinterpret_cast(address + 0xac) = 1; + } else { + *reinterpret_cast(address + 0xac) = 4; + } + } +} + +extern "C" void stt_msg_net__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + int dialogState = *reinterpret_cast( + reinterpret_cast(ipl::System::getDialog()) + 0x24); + if (dialogState == 2) { + goto msg_net_complete; + } + if (dialogState >= 2) { + goto msg_net_done; + } + if (dialogState >= 1) { + goto msg_net_parental; + } + goto msg_net_done; +msg_net_complete: + if (*reinterpret_cast(address + 0xe1) == 0) { + goto msg_net_complete_flag_zero; + } + *reinterpret_cast(address + 0xac) = 1; + goto msg_net_complete_state_done; +msg_net_complete_flag_zero: + *reinterpret_cast(address + 0xac) = 4; +msg_net_complete_state_done: + static_cast(ipl::System::getScene(5))->animation(0x17); + static_cast(ipl::System::getScene(5))->animation(0x18); + goto msg_net_done; +msg_net_parental: { + SCParentalControlsInfo parental; + if (SCGetParentalControl(&parental) == 0) { + goto msg_net_parental_disabled; + } + if ((parental.enable & SC_PARENTAL_FLAG_ENABLED) == 0) { + goto msg_net_parental_disabled; + } + static_cast(ipl::System::getScene(5))->setEventHandler(0, 0); + static_cast(ipl::System::getScene(5))->animation(0x10); + createChildScene__Q33ipl5scene4BaseFiPQ33ipl5scene4BasePQ33ipl5scene4BasePv( + self, 0x1b, self, 0, reinterpret_cast(1)); + *reinterpret_cast(address + 0xe0) = 0; + *reinterpret_cast(address + 0xac) = 0x10; + goto msg_net_done; +msg_net_parental_disabled: + ipl::System::getFader()->fadeOut(); + reserveAllSceneDestruction__Q33ipl5scene4BaseFiPv(self, 0x12, + reinterpret_cast(1)); + *reinterpret_cast(address + 0xac) = 0x1a; +} +msg_net_done: + return; +} + +extern "C" void stt_wait_parental__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + void* dialog = ipl::System::getScene(0x1b); + if (dialog != 0) { + int state = *reinterpret_cast(reinterpret_cast(dialog) + 0x70); + if (state == 1) { + goto parental_confirmed; + } + if (state < 1) { + goto parental_done; + } + if (state >= 4) { + goto parental_done; + } + goto parental_rejected; +parental_confirmed: + *reinterpret_cast(address + 0xe0) = 1; + *reinterpret_cast(address + 0xac) = 0x11; + goto parental_done; +parental_rejected: + *reinterpret_cast(address + 0xe0) = 0; + *reinterpret_cast(address + 0xac) = 0x11; + } +parental_done: + return; +} + +extern "C" void stt_wait_parental_dst__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + if (self->getChild() == 0) { + if (*reinterpret_cast(address + 0xe0) != 0) { + ipl::System::getFader()->fadeOut(); + reserveAllSceneDestruction__Q33ipl5scene4BaseFiPv(self, 0x12, + reinterpret_cast(1)); + *reinterpret_cast(address + 0xac) = 0x1a; + } else { + static_cast(ipl::System::getScene(5))->animation(0xf); + gui::EventHandler* event = reinterpret_cast(self); + if (event != 0) { + event = reinterpret_cast(address + 0x58); + } + static_cast(ipl::System::getScene(5))->setEventHandler(event, 0); + if (*reinterpret_cast(address + 0xe1) != 0) { + *reinterpret_cast(address + 0xac) = 1; + } else { + *reinterpret_cast(address + 0xac) = 4; + } + static_cast(ipl::System::getScene(5))->animation(0x17); + static_cast(ipl::System::getScene(5))->animation(0x18); + } + } +} + +extern "C" void stt_msg_wc__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + int dialogState = *reinterpret_cast( + reinterpret_cast(ipl::System::getDialog()) + 0x24); + if (dialogState == 2) { + goto msg_wc_complete; + } + if (dialogState >= 2) { + goto msg_wc_done; + } + if (dialogState >= 1) { + goto msg_wc_parental; + } + goto msg_wc_done; +msg_wc_complete: + if (*reinterpret_cast(address + 0xe1) == 0) { + goto msg_wc_complete_flag_zero; + } + *reinterpret_cast(address + 0xac) = 1; + goto msg_wc_complete_state_done; +msg_wc_complete_flag_zero: + *reinterpret_cast(address + 0xac) = 4; +msg_wc_complete_state_done: + static_cast(ipl::System::getScene(5))->animation(0x17); + static_cast(ipl::System::getScene(5))->animation(0x18); + goto msg_wc_done; +msg_wc_parental: { + SCParentalControlsInfo parental; + if (SCGetParentalControl(&parental) == 0) { + goto msg_wc_parental_disabled; + } + if ((parental.enable & SC_PARENTAL_FLAG_ENABLED) == 0) { + goto msg_wc_parental_disabled; + } + static_cast(ipl::System::getScene(5))->setEventHandler(0, 0); + static_cast(ipl::System::getScene(5))->animation(0x10); + createChildScene__Q33ipl5scene4BaseFiPQ33ipl5scene4BasePQ33ipl5scene4BasePv( + self, 0x1b, self, 0, reinterpret_cast(1)); + *reinterpret_cast(address + 0xe0) = 0; + *reinterpret_cast(address + 0xac) = 0x13; + goto msg_wc_done; +msg_wc_parental_disabled: + ipl::System::getFader()->fadeOut(); + reserveAllSceneDestruction__Q33ipl5scene4BaseFiPv(self, 0x12, + reinterpret_cast(4)); + *reinterpret_cast(address + 0xac) = 0x1a; +} +msg_wc_done: + return; +} + +extern "C" void stt_wait_parental_wc__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + void* dialog = ipl::System::getScene(0x1b); + if (dialog != 0) { + int state = *reinterpret_cast(reinterpret_cast(dialog) + 0x70); + if (state == 1) { + goto parental_wc_confirmed; + } + if (state < 1) { + goto parental_wc_done; + } + if (state >= 4) { + goto parental_wc_done; + } + goto parental_wc_rejected; +parental_wc_confirmed: + *reinterpret_cast(address + 0xe0) = 1; + *reinterpret_cast(address + 0xac) = 0x14; + goto parental_wc_done; +parental_wc_rejected: + *reinterpret_cast(address + 0xe0) = 0; + *reinterpret_cast(address + 0xac) = 0x14; + } +parental_wc_done: + return; +} + +extern "C" void stt_wait_parental_dst_wc__Q33ipl5scene7AddressFv( + ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + if (self->getChild() == 0) { + if (*reinterpret_cast(address + 0xe0) != 0) { + ipl::System::getFader()->fadeOut(); + reserveAllSceneDestruction__Q33ipl5scene4BaseFiPv(self, 0x12, + reinterpret_cast(4)); + *reinterpret_cast(address + 0xac) = 0x1a; + } else { + static_cast(ipl::System::getScene(5))->animation(0xf); + gui::EventHandler* event = reinterpret_cast(self); + if (event != 0) { + event = reinterpret_cast(address + 0x58); + } + static_cast(ipl::System::getScene(5))->setEventHandler(event, 0); + if (*reinterpret_cast(address + 0xe1) != 0) { + *reinterpret_cast(address + 0xac) = 1; + } else { + *reinterpret_cast(address + 0xac) = 4; + } + static_cast(ipl::System::getScene(5))->animation(0x17); + static_cast(ipl::System::getScene(5))->animation(0x18); + } + } +} + +extern "C" void stt_msg_nwc24_error__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + int state = *reinterpret_cast(reinterpret_cast(ipl::System::getDialog()) + 0x24); + switch (state) { + case 1: + if (*reinterpret_cast(address + 0xe1) == 0) { + goto msg_nwc24_not_e1; + } + *reinterpret_cast(address + 0xac) = 1; + goto msg_nwc24_state_done; + msg_nwc24_not_e1: + *reinterpret_cast(address + 0xac) = 4; + msg_nwc24_state_done: + static_cast(ipl::System::getScene(5))->animation(0x17); + static_cast(ipl::System::getScene(5))->animation(0x18); + break; + } +} + +extern "C" void stt_msg_fi_full__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + int state = *reinterpret_cast(reinterpret_cast(ipl::System::getDialog()) + 0x24); + switch (state) { + case 1: + if (*reinterpret_cast(address + 0xe1) == 0) { + goto msg_fi_full_not_e1; + } + *reinterpret_cast(address + 0xac) = 1; + goto msg_fi_full_state_done; + msg_fi_full_not_e1: + *reinterpret_cast(address + 0xac) = 4; + msg_fi_full_state_done: + static_cast(ipl::System::getScene(5))->animation(0x17); + static_cast(ipl::System::getScene(5))->animation(0x18); + break; + } +} + +extern "C" void stt_msg_parental__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + int state = *reinterpret_cast(reinterpret_cast(ipl::System::getDialog()) + 0x24); + switch (state) { + case 1: + if (*reinterpret_cast(address + 0xe1) == 0) { + goto msg_parental_not_e1; + } + *reinterpret_cast(address + 0xac) = 1; + goto msg_parental_state_done; + msg_parental_not_e1: + *reinterpret_cast(address + 0xac) = 4; + msg_parental_state_done: + static_cast(ipl::System::getScene(5))->animation(0x17); + static_cast(ipl::System::getScene(5))->animation(0x18); + break; + } +} + +extern "C" void stt_msg_open_failure__Q33ipl5scene7AddressFv( + ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + int dialogState = + *reinterpret_cast(reinterpret_cast(ipl::System::getDialog()) + 0x24); + switch (dialogState) { + default: + goto open_failure_done; + case 1: { + ipl::scene::Button* button = + static_cast(ipl::System::getScene(5)); + ipl::scene::MailAddressSelect* mailAddressSelect = + static_cast(ipl::System::getScene(8)); + int mode = *reinterpret_cast(address + 0x88); + if (mode == 1) { + goto open_failure_mode_one; + } + if (mode >= 1) { + goto open_failure_positive; + } + if (mode >= 0) { + goto open_failure_mode_zero; + } + goto open_failure_finish; + open_failure_positive: + if (mode >= 3) { + goto open_failure_finish; + } + goto open_failure_mode_two; + open_failure_mode_zero: + if (mailAddressSelect != 0) { + mailAddressSelect->finishAddress(); + } + button->reserveAnm(0x10); + button->reserveAnm(0xb); + goto open_failure_finish; + open_failure_mode_one: + button->reserveAnm(0xc); + button->reserveAnm(0xb); + goto open_failure_finish; + open_failure_mode_two: + button->reserveAnm(0xc); + button->reserveText(0, 0x13b); + button->reserveText(1, 0x33); + button->reserveAnm(0xf); + open_failure_finish: + button->animation(0x19); + button->animation(0x1a); + *reinterpret_cast(address + 0xac) = 0x1a; + } + } +open_failure_done: + return; +} + +extern "C" void set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( + ipl::scene::Address* self, const char* paneName, unsigned int friendIndex, + unsigned int buttonIndex, void* miiObj, bool isDrag) { + bool showMii = false; + char* address = reinterpret_cast(self); + u16 emptyText[1]; + emptyText[0] = 0; + const wchar_t* text = reinterpret_cast(emptyText); + ipl::scene::FriendListCache* cache = + *reinterpret_cast(address + 0x274); + unsigned char* flags = reinterpret_cast(cache) + 0x7d00; + if (flags[friendIndex] != 0) { + const NWC24FriendInfo* info = &cache->getInfo(friendIndex); + text = reinterpret_cast(info->attr.name); + showMii = info->attr.status == 2; + if (*reinterpret_cast(address + 0x88) == 2) { + showMii = showMii & (info->attr.type == 1); + } + if (isDrag) { + if (showMii) { + ipl::layout::Animator* animator = + static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + + 0x28c, + static_cast(buttonIndex + 0x24))); + animator->initAnmFrame(lbl_816947D8); + } else { + ipl::layout::Animator* animator = + static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + + 0x28c, + static_cast(buttonIndex + 0x24))); + animator->initAnmFrame(lbl_816947E0); + } + } else { + if (showMii) { + ipl::layout::Animator* animator = + static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + + 0x28c, + static_cast(buttonIndex + 6))); + animator->initAnmFrame(); + } else { + ipl::layout::Animator* animator = + static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + + 0x28c, + static_cast(buttonIndex + 0x15))); + animator->initAnmFrame(); + } + *reinterpret_cast(address + buttonIndex + 0xc4) = showMii; + } + if (*reinterpret_cast(address + 0x84) == 0 || + friendIndex != static_cast( + *reinterpret_cast(address + 0x74) + + *reinterpret_cast(address + 0x70) * 5)) { + set__Q43ipl5scene7Address6MiiObjFUx(miiObj, info->attr.fdId); + } + } else { + if (isDrag) { + ipl::layout::Animator* animator = + static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, + static_cast(buttonIndex + 0x24))); + animator->initAnmFrame(lbl_816947D8); + } else { + *reinterpret_cast(address + buttonIndex + 0xc4) = 0; + ipl::layout::Animator* animator = + static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, + static_cast(buttonIndex + 0x15))); + animator->initAnmFrame(); + } + reset__Q43ipl5scene7Address6MiiObjFv(miiObj); + } + if (*reinterpret_cast(address + 0x84) == 0 || + friendIndex != static_cast( + *reinterpret_cast(address + 0x74) + + *reinterpret_cast(address + 0x70) * 5)) { + set_textbox__Q33ipl5scene7AddressFPCcPCw(self, paneName, text); + } else { + set_textbox__Q33ipl5scene7AddressFPCcPCw(self, paneName, L""); + reset__Q43ipl5scene7Address6MiiObjFv(miiObj); + } +} + +void ipl::scene::LetterWriter::setFriendInfo(const NWC24FriendInfo& info) { + mbToFriend = true; + mFriendInfo = info; +} + +extern "C" void stt_drag__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + update__Q33ipl3gui11PaneManagerFv(*reinterpret_cast(address + 0x98)); + if (*reinterpret_cast(address + 0xac) == 10) { + changePage_onDrag__Q33ipl5scene7AddressFv(self); + } +} + void ipl::scene::Address::destroy() { getFriendCache()->fin(); } @@ -312,6 +1658,39 @@ extern "C" asm void initCalcFadeout__Q33ipl5scene7AddressFv() { blr } +extern "C" ipl::scene::FaderSceneCommand calcFadeout__Q33ipl5scene7AddressFv( + ipl::scene::Address* self) { + bool animationsStopped; + int result; + if (ipl::System::getFader()->getStatus() == EGG::Fader::PREPARE_OUT) { + result = 0; + animationsStopped = false; + if (*reinterpret_cast(static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(reinterpret_cast(self) + 0x8c)) + + 0x28c, + 1)) + + 0x14) != 1 && + *reinterpret_cast(static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(reinterpret_cast(self) + 0x8c)) + + 0x28c, + 3)) + + 0x14) != 1) { + animationsStopped = true; + } + if (animationsStopped && + *reinterpret_cast(static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(reinterpret_cast(self) + 0xa0)) + + 0x28c, + 1)) + + 0x14) != 1) { + result = 1; + } + } else { + result = ipl::System::getFader()->getStatus() == EGG::Fader::PREPARE_IN; + } + return static_cast(result); +} + extern "C" asm void calcCommonAfter__Q33ipl5scene7AddressFv() { nofralloc stwu r1, -0x10(r1) @@ -332,6 +1711,103 @@ extern "C" asm void calcCommonAfter__Q33ipl5scene7AddressFv() { blr } +void ipl::scene::Address::draw() { + char* stringPool = lbl_81647538; + int drawLayer = *reinterpret_cast( + reinterpret_cast(ipl::System::getSceneManager()) + 0x100); + if (drawLayer == ipl::scene::DRAW_LAYER_2) { + ipl::utility::Graphics::setOrtho(0); + nw4r::lyt::Pane* pane = mLayout->getNW4RLyt()->GetRootPane()->FindPaneByName( + stringPool + 0x4d4, true); + for (int index = mPageCount; index >= 1; index--) { + ipl::math::VEC2 translate; + translate.y = sAddressVEC2.y * static_cast(index); + translate.x = sAddressVEC2.x * static_cast(index); + nw4r::math::VEC2 paneTranslate(reinterpret_cast(&translate)); + SetTranslate__Q34nw4r3lyt4PaneFRCQ34nw4r4math4VEC2(pane, &paneTranslate); + pane->CalculateMtx(*mLayout->getDrawInfo()); + mLayout->draw(pane); + } + mLayout->draw(stringPool + 0x4dd); + if (static_cast(mState - 5) <= 1) { + mLayout->draw(stringPool + 0x4e6); + } + int startIndex = 0; + int state = mState; + if (state == 4) { + goto start_index_done; + } + if (state < 4) { + if (state >= 2) { + goto start_index_set; + } + goto start_index_done; + } + if (state >= 7) { + goto start_index_done; + } + start_index_set: + startIndex = 1; + start_index_done: + pane = mLayout->getNW4RLyt()->GetRootPane()->FindPaneByName(stringPool + 0x4ef, true); + for (int index = startIndex; index < mFriendCount + startIndex; + index++) { + ipl::math::VEC2 translate = sAddressVEC2 * static_cast(-index); + SetTranslate__Q34nw4r3lyt4PaneFRCQ34nw4r4math4VEC2(pane, &translate); + pane->CalculateMtx(*mLayout->getDrawInfo()); + mLayout->draw(pane); + } + pane = mLayout->getNW4RLyt()->GetRootPane()->FindPaneByName(stringPool + 0x4f8, true); + state = mState; + if (state >= 9) { + goto draw_last_pane; + } + if (state >= 7) { + goto draw_repeated_panes; + } + goto draw_last_pane; + draw_repeated_panes: + for (int index = 1; index < 20; index++) { + pane->SetTranslate(sAddressVEC2 * static_cast(-index)); + pane->CalculateMtx(*mLayout->getDrawInfo()); + mLayout->draw(pane); + } + goto draw_panes_done; + draw_last_pane: + pane->SetTranslate(sAddressVEC2 * static_cast( + -(mFriendCount + startIndex))); + pane->CalculateMtx(*mLayout->getDrawInfo()); + mLayout->draw(stringPool + 0x4f8); + draw_panes_done: + mPaneLayout->draw(); + mCursorLayout->draw(); + } else if (drawLayer == ipl::scene::DRAW_LAYER_3) { + ipl::utility::Graphics::setOrtho(0); + int state = mState; + if (state == 9) { + goto no_text; + } + if (state < 9) { + if (state == 4) { + goto no_text; + } + if (state >= 4) { + goto draw_text; + } + if (state >= 1) { + goto draw_text; + } + goto no_text; + } + if (state >= 11) { + goto no_text; + } + draw_text: + mLayout->draw(stringPool + 0x44a); + no_text:; + } +} + extern "C" asm void __ct__Q43ipl5scene7Address6MiiObjFv() { nofralloc li r0, 0 @@ -369,7 +1845,8 @@ miio_dt_done: blr } -extern "C" asm void init__Q43ipl5scene7Address6MiiObjFPQ34nw4r3lyt4Pane() { +extern "C" asm void init__Q43ipl5scene7Address6MiiObjFPQ34nw4r3lyt4Pane( + void*, nw4r::lyt::Pane*) { stwu r1, -0x10(r1) mflr r0 stw r0, 0x14(r1) @@ -391,7 +1868,7 @@ extern "C" asm void init__Q43ipl5scene7Address6MiiObjFPQ34nw4r3lyt4Pane() { blr } -extern "C" asm void reset__Q43ipl5scene7Address6MiiObjFv() { +extern "C" asm void reset__Q43ipl5scene7Address6MiiObjFv(void* self) { stwu r1, -0x10(r1) mflr r0 stw r0, 0x14(r1) @@ -445,7 +1922,8 @@ miio_create_store: blr } -extern "C" asm void set__Q43ipl5scene7Address6MiiObjFUx() { +extern "C" asm void set__Q43ipl5scene7Address6MiiObjFUx(void* self, + unsigned long long id) { stwu r1, -0x30(r1) mflr r0 stw r0, 0x34(r1) @@ -488,7 +1966,7 @@ miio_set_done: extern "C" int get_button_no__Q33ipl5scene7AddressFPCc(void*, const char* paneName) { int result = -1; for (int i = 0; i < 5; i++) { - if (strcmp(sButtonNameB[i], paneName) == 0) { + if (strcmp(lbl_81647614[i], paneName) == 0) { result = i; break; } @@ -499,7 +1977,7 @@ extern "C" int get_button_no__Q33ipl5scene7AddressFPCc(void*, const char* paneNa extern "C" int get_button_space_no__Q33ipl5scene7AddressFPCc(void*, const char* paneName) { int result = -1; for (int i = 0; i < 4; i++) { - if (strcmp(sButtonSpaceName[i], paneName) == 0) { + if (strcmp(lbl_81647664[i], paneName) == 0) { result = i; break; } @@ -507,6 +1985,1047 @@ extern "C" int get_button_space_no__Q33ipl5scene7AddressFPCc(void*, const char* return result; } +extern "C" void reset_gui__Q33ipl5scene7AddressFb(ipl::scene::Address* self, bool reset) { + static_cast( + *reinterpret_cast(reinterpret_cast(self) + 0x98))->init(); + int friendOffset = 0; + int animationIndex = 0; + do { + ipl::layout::Animator* animator = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(*reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 6)); + animator->initAnmFrame(); + static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(*reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 6)) + ->calc(); + + animator = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(*reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0xb)); + animator->initAnmFrame(); + static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(*reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0xb)) + ->calc(); + + animator = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(*reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0x10)); + animator->initAnmFrame(); + static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0x10))->calc(); + + animator = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(*reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0x15)); + animator->initAnmFrame(); + static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0x15))->calc(); + + animator = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(*reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0x1a)); + animator->initAnmFrame(); + static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0x1a))->calc(); + + animator = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(*reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0x1f)); + animator->initAnmFrame(); + static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0x1f))->calc(); + + char* friendData = reinterpret_cast(self) + friendOffset; + if (*reinterpret_cast(friendData + 0xcc) != 0 && reset) { + if (*reinterpret_cast(reinterpret_cast(self) + animationIndex + 0xc4) != 0) { + ipl::utility::FrameController* frame = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, + animationIndex + 0xb)); + frame->initFrame(); + frame->restart(); + } else { + ipl::utility::FrameController* frame = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, + animationIndex + 0x1a)); + frame->initFrame(); + frame->restart(); + } + } else { + if (*reinterpret_cast(reinterpret_cast(self) + animationIndex + 0xc4) != 0) { + animator = static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, + animationIndex + 6)); + animator->initAnmFrame(); + static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, + animationIndex + 6))->calc(); + } else { + animator = static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, + animationIndex + 0x15)); + animator->initAnmFrame(); + static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, + animationIndex + 0x15))->calc(); + } + } + animationIndex++; + *reinterpret_cast(friendData + 0xcc) = 0; + friendOffset += 4; + } while (animationIndex < 5); +} + +extern "C" bool isReleasableArea__Q33ipl5scene7AddressFii(ipl::scene::Address* self, int page, + int index) { + char* address = reinterpret_cast(self); + if (page < 0 || page >= 20) { + return false; + } + if (reinterpret_cast(address)[0xe1] != 0) { + return false; + } + if (index < 0) { + goto address_invalid; + } + if (index < 5) { + goto address_valid; + } +address_invalid: + return false; +address_valid: + if (page == *reinterpret_cast(address + 0x70) && + index == *reinterpret_cast(address + 0x74)) { + return true; + } + unsigned char* cachedFriends = + *reinterpret_cast(address + 0x274); + if (cachedFriends[index + page * 5 + 32000] != 0) { + return false; + } + return static_cast(address[0x84]) == 1; +} + +extern "C" unsigned int is_selectable__Q33ipl5scene7AddressFUl(ipl::scene::Address* self, + unsigned int index) { + char* address = reinterpret_cast(self); + int mode = *reinterpret_cast(address + 0x88); + if (mode == 1) { + goto selectable_mode_one; + } + if (mode < 1) { + if (mode >= 0) { + goto selectable_mode_zero; + } + goto selectable_invalid; + } + if (mode >= 3) { + goto selectable_invalid; + } + goto selectable_mode_two; +selectable_mode_zero: + { + unsigned char* friends = *reinterpret_cast(address + 0x274); + return *(friends + index + 32000); + } +selectable_mode_one: + { + unsigned char* friends = *reinterpret_cast(address + 0x274); + if (*(friends + index + 32000) != 0) { + int* info = reinterpret_cast(friends + index * 0x140); + return static_cast(__cntlzw(info[1] - 2)) >> 5; + } + return 0; + } +selectable_mode_two: + { + unsigned char* friends = *reinterpret_cast(address + 0x274); + if (*(friends + index + 32000) != 0) { + unsigned int* info = reinterpret_cast(friends + index * 0x140); + unsigned int result = 0; + if (info[1] == 2U) { + if (info[0] == 1U) { + result = 1; + } + } + return result; + } + return 0; + } +selectable_invalid: + return 0; +} + +extern "C" void onEventDerived__Q33ipl5scene7AddressFUlUlPCQ33ipl10controller9Interface( + ipl::scene::Address* self, unsigned int componentId, int event, + const ipl::controller::Interface* controller) { + char* address = reinterpret_cast(self); + gui::Manager* manager = *reinterpret_cast(address + 0x5c); + gui::Component* component = manager->getComponent(componentId); + const char* paneName = + static_cast(component)->getPane()->GetName(); + + if (event == 1) { + goto address_drag_event; + } + if (event < 1) { + if (event >= 0) { + goto address_trig_event; + } + goto address_event_done; + } + if (event >= 3) { + goto address_event_done; + } + goto address_clear_drag; + +address_trig_event: + if (controller == NULL) { + goto address_event_done; + } + if (!controller->downTrg(0x00100800)) { + goto address_drag_event; + } + ipl::scene::Button* button = + static_cast(ipl::System::getScene(5)); + int state = *reinterpret_cast(address + 0xac); + if (state == 1 || state == 4) { + if (ipl::scene::Button::cmpButtonName(paneName, 5) == 0) { + ipl::scene::MailAddressSelect* mail = + static_cast(ipl::System::getScene(8)); + button->animation(0x1b); + int mode = *reinterpret_cast(address + 0x88); + ipl::utility::FrameController* frameZero; + ipl::utility::FrameController* frameMain; + if (mode == 1) { + goto address_mode_one; + } + if (mode >= 1) { + goto address_mode_two_check; + } + if (mode >= 0) { + goto address_mode_zero; + } + goto address_mode_common; + +address_mode_two_check: + if (mode >= 3) { + goto address_mode_common; + } + goto address_mode_two; + +address_mode_zero: + if (mail != NULL) { + mail->finishAddress(); + } + frameZero = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + + 0x28c, + 1)); + frameZero->initFrame(); + *reinterpret_cast(reinterpret_cast(frameZero) + 0x14) = 1; + button->reserveAnm(0x10); + button->reserveAnm(0xb); + goto address_mode_common; + +address_mode_one: + frameMain = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + + 0x28c, + 3)); + frameMain->initFrame(); + *reinterpret_cast(reinterpret_cast(frameMain) + 0x14) = 1; + frameMain = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0xa0)) + + 0x28c, + 1)); + frameMain->initFrame(); + *reinterpret_cast(reinterpret_cast(frameMain) + 0x14) = 1; + button->reserveAnm(0xc); + button->reserveAnm(0xb); + goto address_mode_common; + +address_mode_two: + frameMain = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + + 0x28c, + 3)); + frameMain->initFrame(); + *reinterpret_cast(reinterpret_cast(frameMain) + 0x14) = 1; + frameMain = static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0xa0)) + + 0x28c, + 1)); + frameMain->initFrame(); + *reinterpret_cast(reinterpret_cast(frameMain) + 0x14) = 1; + button->reserveAnm(0xc); + button->reserveText(0, 0x13b); + button->reserveText(1, 0x33); + button->reserveAnm(0xf); + +address_mode_common: + button->animation(0x19); + button->animation(0x1a); + ipl::snd::sSystem.startSE(lbl_81647538 + 0x5a1); + *reinterpret_cast(address + 0xac) = 0x1a; + } else if (ipl::scene::Button::cmpButtonName(paneName, 7) == 0) { + *reinterpret_cast(address + 0xc0) = -1; + entry_friend__Q33ipl5scene7AddressFv(self); + } else if (ipl::scene::Button::cmpButtonName(paneName, 9) == 0) { + button->animation(0x13); + ipl::snd::sSystem.startSE(lbl_8164798E); + onNextPage__Q33ipl5scene7AddressFv(self); + } else if (ipl::scene::Button::cmpButtonName(paneName, 10) == 0) { + button->animation(0x14); + ipl::snd::sSystem.startSE(lbl_81647A4D); + onPreviousPage__Q33ipl5scene7AddressFv(self); + } + } + +address_drag_event: + if (*reinterpret_cast(address + 0x84) != 0 && + (controller == NULL || + controller == ipl::System::getControllerManager()->getController( + *reinterpret_cast(address + 0x6c)))) { + if (ipl::scene::Button::cmpButtonName(paneName, 10) == 0) { + if (*reinterpret_cast(address + 0x7c) < 0) { + *reinterpret_cast(address + 0x7c) = 0; + } + } else if (ipl::scene::Button::cmpButtonName(paneName, 9) == 0 && + *reinterpret_cast(address + 0x78) < 0) { + *reinterpret_cast(address + 0x78) = 0; + } + } + goto address_event_done; + +address_clear_drag: + if (*reinterpret_cast(address + 0x84) != 0 && + (controller == NULL || + controller == ipl::System::getControllerManager()->getController( + *reinterpret_cast(address + 0x6c)))) { + if (ipl::scene::Button::cmpButtonName(paneName, 10) == 0) { + *reinterpret_cast(address + 0x7c) = -1; + } else if (ipl::scene::Button::cmpButtonName(paneName, 9) == 0) { + *reinterpret_cast(address + 0x78) = -1; + } + } + +address_event_done: + return; +} + +extern "C" void onNextPage__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + char* dataBase = lbl_81647538; + int state = *reinterpret_cast(address + 0xac); + if (state != 4) { + if (state < 4) { + if (state >= 2) { + goto on_next_page_done; + } + if (state >= 0) { + goto on_next_page_first; + } + goto on_next_page_done; + } + if (state == 10) { + goto on_next_page_normal; + } + goto on_next_page_done; + } + +on_next_page_normal: + if (*reinterpret_cast(address + 0xb0) < 0x13) { + *reinterpret_cast(address + 0xb0) += 1; + *reinterpret_cast(address + 0xb4) -= 1; + nw4r::lyt::Pane* pane = + static_cast(*reinterpret_cast(address + 0x8c)) + ->GetRootPane() + ->FindPaneByName(dataBase + 0x529, true); + add_translate__Q33ipl5scene7AddressFPQ34nw4r3lyt4PaneRCQ33ipl4math4VEC2( + self, pane, sAddressVEC2); + void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 5); + *reinterpret_cast(reinterpret_cast(animator) + 0x18) = 0; + animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 5); + initFrame__Q33ipl7utility15FrameControllerFv(animator); + *reinterpret_cast(reinterpret_cast(animator) + 0x14) = 1; + set_page_text__Q33ipl5scene7AddressFPCci( + self, dataBase + 0x50c, *reinterpret_cast(address + 0xb0) + 1); + set_page_text__Q33ipl5scene7AddressFPCci( + self, dataBase + 0x5b0, *reinterpret_cast(address + 0xb0)); + reset_gui__Q33ipl5scene7AddressFb(self, false); + + unsigned int index = 0; + const char* const* names = reinterpret_cast(dataBase + 0x3c); + const char* const* otherNames = reinterpret_cast(dataBase + 0x8c); + int objectOffset = 0; + do { + set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( + self, names[index], + index + *reinterpret_cast(address + 0xb0) * 5, index, + address + objectOffset + 0xe4, false); + set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( + self, otherNames[index], + index + (*reinterpret_cast(address + 0xb0) - 1) * 5, index, + address + objectOffset + 0x1ac, true); + index++; + objectOffset += 0x28; + } while (index < 5); + *reinterpret_cast(address + 0xac) = 5; + } else { + *reinterpret_cast(address + 0xb0) = 0; + *reinterpret_cast(address + 0xb8) = 0; + *reinterpret_cast(address + 0xe1) = 1; + void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); + *reinterpret_cast(reinterpret_cast(animator) + 0x18) = 1; + animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); + initFrame__Q33ipl7utility15FrameControllerFv(animator); + *reinterpret_cast(reinterpret_cast(animator) + 0x14) = 1; + reset_gui__Q33ipl5scene7AddressFb(self, true); + *reinterpret_cast(address + 0xac) = 7; + } + + goto on_next_page_done; + +on_next_page_first: + *reinterpret_cast(address + 0xb4) -= 1; + nw4r::lyt::Pane* pane = + static_cast(*reinterpret_cast(address + 0x8c)) + ->GetRootPane() + ->FindPaneByName(dataBase + 0x529, true); + add_translate__Q33ipl5scene7AddressFPQ34nw4r3lyt4PaneRCQ33ipl4math4VEC2( + self, pane, sAddressVEC2); + void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); + *reinterpret_cast(reinterpret_cast(animator) + 0x18) = 0; + animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); + initFrame__Q33ipl7utility15FrameControllerFv(animator); + *reinterpret_cast(reinterpret_cast(animator) + 0x14) = 1; + reset_gui__Q33ipl5scene7AddressFb(self, true); + + unsigned int index = 0; + const char* const* names = reinterpret_cast(dataBase + 0x3c); + int objectOffset = 0; + do { + set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( + self, names[index], + index + *reinterpret_cast(address + 0xb0) * 5, index, + address + objectOffset + 0xe4, false); + index++; + objectOffset += 0x28; + } while (index < 5); + *reinterpret_cast(address + 0xac) = 2; + +on_next_page_done: + return; +} + +extern "C" void onPreviousPage__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* dataBase = lbl_81647538; + char* address = reinterpret_cast(self); + int state = *reinterpret_cast(address + 0xac); + if (state != 4) { + if (state < 4) { + if (state == 1) { + goto on_previous_page_wrap; + } + goto on_previous_page_done; + } + if (state != 10) { + goto on_previous_page_done; + } + } + + if (*reinterpret_cast(address + 0xb0) < 1) { + void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); + *reinterpret_cast(reinterpret_cast(animator) + 0x18) = 1; + animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); + initFrame__Q33ipl7utility15FrameControllerFv(animator); + *reinterpret_cast(reinterpret_cast(animator) + 0x14) = 1; + reset_gui__Q33ipl5scene7AddressFb(self, true); + *reinterpret_cast(address + 0xac) = 3; + } else { + *reinterpret_cast(address + 0xb0) -= 1; + *reinterpret_cast(address + 0xb8) -= 1; + void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 5); + *reinterpret_cast(reinterpret_cast(animator) + 0x18) = 1; + animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 5); + initFrame__Q33ipl7utility15FrameControllerFv(animator); + *reinterpret_cast(reinterpret_cast(animator) + 0x14) = 1; + set_page_text__Q33ipl5scene7AddressFPCci( + self, dataBase + 0x5b0, *reinterpret_cast(address + 0xb0) + 1); + reset_gui__Q33ipl5scene7AddressFb(self, true); + + unsigned int index = 0; + const char* const* names = reinterpret_cast(dataBase + 0x8c); + int objectOffset = 0; + do { + set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( + self, names[index], + index + *reinterpret_cast(address + 0xb0) * 5, index, + address + objectOffset + 0x1ac, true); + index++; + objectOffset += 0x28; + } while (index < 5); + *reinterpret_cast(address + 0xac) = 6; + } + goto on_previous_page_done; + +on_previous_page_wrap: + *reinterpret_cast(address + 0xb0) = 0x13; + *reinterpret_cast(address + 0xb4) = 0; + *reinterpret_cast(address + 0xe1) = 0; + float scale = lbl_816947DC; + float* axes = &lbl_81698B50; + nw4r::math::_VEC2 rawOffset; + rawOffset.y = axes[1] * scale; + rawOffset.x = axes[0] * scale; + ipl::math::VEC2 offset(rawOffset); + nw4r::lyt::Pane* pane = + static_cast(*reinterpret_cast(address + 0x8c)) + ->GetRootPane() + ->FindPaneByName(dataBase + 0x529, true); + add_translate__Q33ipl5scene7AddressFPQ34nw4r3lyt4PaneRCQ33ipl4math4VEC2(self, pane, offset); + void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); + *reinterpret_cast(reinterpret_cast(animator) + 0x18) = 0; + animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); + initFrame__Q33ipl7utility15FrameControllerFv(animator); + *reinterpret_cast(reinterpret_cast(animator) + 0x14) = 1; + set_page_text__Q33ipl5scene7AddressFPCci( + self, dataBase + 0x50c, *reinterpret_cast(address + 0xb0) + 1); + reset_gui__Q33ipl5scene7AddressFb(self, false); + + unsigned int index = 0; + const char* const* names = reinterpret_cast(dataBase + 0x3c); + int objectOffset = 0; + do { + set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( + self, names[index], + index + *reinterpret_cast(address + 0xb0) * 5, index, + address + objectOffset + 0xe4, false); + index++; + objectOffset += 0x28; + } while (index < 5); + *reinterpret_cast(address + 0xac) = 8; + +on_previous_page_done: + return; +} + +extern "C" void set_err_msg__Q33ipl5scene7AddressFPwUl8NWC24Err( + ipl::scene::Address*, wchar_t* outErrMsg, unsigned int outErrMsgLen, int nwc24Err) { + memset(outErrMsg, 0, outErrMsgLen * sizeof(wchar_t)); + const wchar_t* message = ipl::System::getMessage(400); + wcsncat(outErrMsg, message, outErrMsgLen - wcslen(outErrMsg)); + + wchar_t nwc24ErrStr[32]; + memset(nwc24ErrStr, 0, sizeof(nwc24ErrStr)); + swprintf(nwc24ErrStr, sizeof(nwc24ErrStr) / sizeof(wchar_t), lbl_81647AF2, + ipl::System::getNwc24Manager()->getErrCode()); + wcsncat(outErrMsg, nwc24ErrStr, outErrMsgLen - wcslen(outErrMsg)); + + unsigned int errMsgId = 400; + if (nwc24Err == -31) { + errMsgId = 0x19a; + } else if (nwc24Err < -31) { + if (nwc24Err >= -32) { + errMsgId = 0x1c5; + } + } else if (nwc24Err == -6) { + errMsgId = 0x1c5; + } + wcsncat(outErrMsg, ipl::System::getMessage(errMsgId), + outErrMsgLen - wcslen(outErrMsg)); +} + +extern "C" void entry_friend__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + if (*reinterpret_cast(address + 0x88) == 0) { + ipl::scene::Button* button = + static_cast(ipl::System::getScene(5)); + SCParentalControlsInfo parental; + BOOL parentalInfoAvailable = SCGetParentalControl(&parental); + unsigned int registeredFriendCount = + *reinterpret_cast( + *reinterpret_cast(address + 0x274) + 0x7d70); + ipl::snd::sSystem.startSE(lbl_81647A78); + if (*reinterpret_cast(address + 0xc0) == 0xffffffffU) { + button->animation(0x1d); + } + if (!ipl::ncd::NCDSetting::getConnectEnableFlag()) { + ipl::System::getDialog()->callBtn2(0x145, 0x146, 0x25, false); + *reinterpret_cast(address + 0xac) = 0xf; + } else if ((SCGetWCFlags() & 1) == 0) { + ipl::System::getDialog()->callBtn2(0x17e, 0x146, 0x25, false); + *reinterpret_cast(address + 0xac) = 0x12; + } else if (parentalInfoAvailable && (parental.enable & SC_PARENTAL_FLAG_ENABLED) && + (SCGetNetContentRestrictions() & 2) != 0) { + ipl::System::getDialog()->callBtn1(0x14c, 0x2e); + *reinterpret_cast(address + 0xac) = 0x17; + } else { + int checkResult = check__Q33ipl5scene15FriendListCacheFv( + *reinterpret_cast(address + 0x274)); + if (checkResult == -31 || + *reinterpret_cast( + *reinterpret_cast(address + 0x274) + 0x9d74) == -32 || + *reinterpret_cast( + *reinterpret_cast(address + 0x274) + 0x9d74) == -6) { + wchar_t errorMessage[0x400] = {}; + set_err_msg__Q33ipl5scene7AddressFPwUl8NWC24Err( + self, errorMessage, 0x400, + *reinterpret_cast( + *reinterpret_cast(address + 0x274) + 0x9d74)); + ipl::System::getDialog()->callBtn1(errorMessage, 0x2e); + *reinterpret_cast(address + 0xac) = 0x15; + } else if (registeredFriendCount >= 100) { + ipl::System::getDialog()->callBtn1(0x50, 0x2e); + *reinterpret_cast(address + 0xac) = 0x16; + } else { + createChildScene__Q33ipl5scene4BaseFiPQ33ipl5scene4BasePQ33ipl5scene4BasePv( + self, 0x18, self, 0, 0); + button->reserveAnm(0x10); + button->reserveText(0, 0x13b); + button->reserveAnm(0xb); + button->setEventHandler(0, 0); + void* frame = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + *reinterpret_cast(address + 0x9c) + 0x28c, 0); + initFrame__Q33ipl7utility15FrameControllerFv(frame); + *reinterpret_cast(reinterpret_cast(frame) + 0x14) = 1; + *reinterpret_cast(address + 0xac) = 0xc; + } + } + button->animation(0x19); + button->animation(0x1a); + } +} + +extern "C" void add_translate__Q33ipl5scene7AddressFPQ34nw4r3lyt4PaneRCQ33ipl4math4VEC2( + void*, nw4r::lyt::Pane* pane, const ipl::math::VEC2& offset) { + nw4r::ut::Rect projection; + nw4r::ut::Rect projection4x3; + ipl::System::getProjectionRect(&projection); + ipl::System::getProjectionRect4x3(&projection4x3); + nw4r::math::VEC3 translate; + translate.x = pane->GetTranslate().x; + translate.y = pane->GetTranslate().y; + translate.z = pane->GetTranslate().z; + translate.x += offset.x * projection4x3.GetWidth() / projection.GetWidth(); + translate.y += offset.y; + SetTranslate__Q34nw4r3lyt4PaneFRCQ34nw4r4math4VEC3(pane, &translate); +} + +#pragma dont_inline on +extern "C" void set_page_text__Q33ipl5scene7AddressFPCci(ipl::scene::Address* self, + const char* paneName, int page) { + wchar_t digits[10]; + const wchar_t* digitSource = lbl_8160F650 - 1; + wchar_t* digitDest = digits - 1; + for (int i = 0; i < 5; i++) { + digitDest[1] = digitSource[1]; + digitDest[2] = digitSource[2]; + digitDest += 2; + digitSource += 2; + } + wchar_t text[6] = {}; + int textIndex = 0; + if (page >= 10) { + text[textIndex++] = digits[page / 10]; + } + text[textIndex++] = digits[page % 10]; + text[textIndex++] = '/'; + text[textIndex++] = digits[2]; + text[textIndex++] = digits[0]; + text[textIndex] = 0; + set_textbox__Q33ipl5scene7AddressFPCcPCw(self, paneName, text); +} +extern "C" void set_textbox__Q33ipl5scene7AddressFPCcPCw(ipl::scene::Address* self, + const char* paneName, + const wchar_t* text) { + char* address = reinterpret_cast(self); + void* layout = *reinterpret_cast(address + 0x8c); + nw4r::lyt::Pane* root = + *reinterpret_cast(reinterpret_cast(layout) + 0x14); + nw4r::lyt::TextBox* textBox = nw4r::ut::DynamicCast( + root->FindPaneByName(paneName, true)); + textBox->SetString(text, 0); +} +#pragma dont_inline reset + +extern "C" void reset_friend__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* address = reinterpret_cast(self); + int objectOffset = 0; + unsigned int buttonIndex = 0; + do { + unsigned int page = *reinterpret_cast(address + 0xb0); + unsigned int friendIndex = buttonIndex + page * 5; + const char* buttonName = lbl_81647614[buttonIndex]; + char* object = address + objectOffset + 0xe4; + set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( + self, buttonName, friendIndex, buttonIndex, object, false); + buttonIndex++; + objectOffset += 0x28; + } while (buttonIndex < 5); +} + +extern "C" void start_trig_event__Q33ipl5scene7AddressFPCc( + ipl::scene::Address* self, const char* paneName) { + char* address = reinterpret_cast(self); + ipl::scene::Button* button = + static_cast(ipl::System::getScene(5)); + int buttonNo = get_button_no__Q33ipl5scene7AddressFPCc(self, paneName); + if (*reinterpret_cast(address + 0xac) == 4) { + int mode = *reinterpret_cast(address + 0x88); + unsigned int page = *reinterpret_cast(address + 0xb0); + if (mode == 0) { + if (buttonNo == -1 || + is_selectable__Q33ipl5scene7AddressFUl(self, buttonNo + page * 5) == 0) { + if (buttonNo != -1) { + *reinterpret_cast(address + 0xbc) = buttonNo; + *reinterpret_cast(address + 0xc0) = buttonNo + page * 5; + entry_friend__Q33ipl5scene7AddressFv(self); + } + } else { + button->animation(0x19); + button->animation(0x1a); + button->animation(0x10); + button->reserveText(0, 0x13b); + button->reserveAnm(0xb); + button->setEventHandler(0, 0); + unsigned int animationIndex = + *reinterpret_cast(address + buttonNo + 0xc4) == 0 + ? buttonNo + 0x1f + : buttonNo + 0x10; + ipl::utility::FrameController* animator = + static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + + 0x28c, + animationIndex)); + animator->play(); + *reinterpret_cast(address + 0xbc) = buttonNo; + *reinterpret_cast(address + 0xc0) = buttonNo + page * 5; + ipl::snd::sSystem.startSE(lbl_81647A78); + *reinterpret_cast(address + buttonNo * 4 + 0xcc) += 1; + *reinterpret_cast(address + 0xac) = 9; + } + } else if (mode >= 0 && mode < 3) { + if (buttonNo == -1 || + is_selectable__Q33ipl5scene7AddressFUl(self, buttonNo + page * 5) == 0) { + if (buttonNo != -1) { + unsigned int friendIndex = buttonNo + page * 5; + ipl::scene::FriendListCache* cache = + *reinterpret_cast(address + 0x274); + if (*(reinterpret_cast(cache) + friendIndex + 32000) != 0) { + const NWC24FriendInfo& info = cache->getInfo(friendIndex); + if (mode == 1) { + callBtn1__Q23ipl12DialogWindowFUlUl(ipl::System::getDialog(), + 0x57, 0x2e); + } else if (info.attr.type == 1) { + callBtn1__Q23ipl12DialogWindowFUlUl(ipl::System::getDialog(), + 0x57, 0x2e); + } else { + callBtn1__Q23ipl12DialogWindowFUlUl(ipl::System::getDialog(), + 0x22, 0x2e); + } + *reinterpret_cast(address + 0xac) = 0x19; + } + } + } else { + button->animation(0xc); + button->reserveText(0, 0x25); + button->reserveText(1, 0x33); + button->reserveAnm(0xf); + button->animation(0x19); + button->animation(0x1a); + ipl::utility::FrameController* animator = + static_cast( + List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + static_cast(*reinterpret_cast(address + 0x8c)) + + 0x28c, + buttonNo + 0x10)); + animator->play(); + *reinterpret_cast(address + 0xbc) = buttonNo; + *reinterpret_cast(address + 0xc0) = buttonNo + page * 5; + ipl::snd::sSystem.startSE(lbl_81647A78); + *reinterpret_cast(address + 0xac) = 9; + } + } + } +} + +extern "C" void start_point_event__Q33ipl5scene7AddressFPCcPQ33ipl10controller9Interface( + ipl::scene::Address* self, const char* paneName, void* controller) { + char* address = reinterpret_cast(self); + int buttonNo = get_button_no__Q33ipl5scene7AddressFPCc(self, paneName); + if (buttonNo != -1) { + int mode = *reinterpret_cast(address + 0x88); + if (mode == 0 || + (mode == 1 && is_selectable__Q33ipl5scene7AddressFUl( + self, buttonNo + *reinterpret_cast(address + 0xb0) * 5))) { + on_point_event__Q33ipl5scene7AddressFiPQ33ipl10controller9Interface(self, buttonNo, + controller); + } + } +} + +extern "C" void start_left_event__Q33ipl5scene7AddressFPCc(ipl::scene::Address* self, + const char* paneName) { + char* address = reinterpret_cast(self); + int buttonNo = get_button_no__Q33ipl5scene7AddressFPCc(self, paneName); + if (buttonNo != -1) { + int mode = *reinterpret_cast(address + 0x88); + if (mode == 0 || + (mode == 1 && is_selectable__Q33ipl5scene7AddressFUl( + self, buttonNo + *reinterpret_cast(address + 0xb0) * 5))) { + left_point_event__Q33ipl5scene7AddressFi(self, buttonNo); + } + } +} + +extern "C" void start_drag_point_event__Q33ipl5scene7AddressFPCcPQ33ipl10controller9Interface( + ipl::scene::Address* self, const char* paneName, void* controller) { + int buttonNo = get_button_no__Q33ipl5scene7AddressFPCc(self, paneName); + if (buttonNo != -1 && + isReleasableArea__Q33ipl5scene7AddressFii( + self, *reinterpret_cast(reinterpret_cast(self) + 0xb0), buttonNo)) { + on_point_event__Q33ipl5scene7AddressFiPQ33ipl10controller9Interface(self, buttonNo, + controller); + *reinterpret_cast(reinterpret_cast(self) + 0x84) = 1; + } +} + +extern "C" void start_drag_left_event__Q33ipl5scene7AddressFPCc(ipl::scene::Address* self, + const char* paneName) { + int buttonNo = get_button_no__Q33ipl5scene7AddressFPCc(self, paneName); + if (buttonNo != -1) { + left_point_event__Q33ipl5scene7AddressFi(self, buttonNo); + *reinterpret_cast(reinterpret_cast(self) + 0x84) = 1; + } +} + +extern "C" void start_release_event__Q33ipl5scene7AddressFPCc(ipl::scene::Address* self, + const char* paneName) { + char* address = reinterpret_cast(self); + int buttonNo; + const char* dataBase = lbl_81647538; + ipl::System::getScene(5); + buttonNo = -1; + if (paneName != 0) { + buttonNo = get_button_no__Q33ipl5scene7AddressFPCc(self, paneName); + if (buttonNo == -1) { + buttonNo = get_button_space_no__Q33ipl5scene7AddressFPCc(self, paneName); + } + } + switch (*reinterpret_cast(address + 0x88)) { + case 0: { + if (isReleasableArea__Q33ipl5scene7AddressFii( + self, *reinterpret_cast(address + 0xb0), buttonNo)) { + *reinterpret_cast(address + 0xbc) = buttonNo; + unsigned int friendIndex = + buttonNo + *reinterpret_cast(address + 0xb0) * 5; + *reinterpret_cast(address + 0xc0) = friendIndex; + unsigned int selectedIndex = *reinterpret_cast(address + 0x74) + + *reinterpret_cast(address + 0x70) * 5; + if (friendIndex != selectedIndex) { + ipl::scene::FriendListCache* cache = + *reinterpret_cast(address + 0x274); + swap__Q33ipl5scene15FriendListCacheFUlUl(cache, friendIndex, selectedIndex); + } + ipl::snd::sSystem.startSEwithPos(dataBase + 0x568, + *reinterpret_cast(address + 0x64)); + } else { + ipl::snd::sSystem.startSEwithPos(dataBase + 0x577, + *reinterpret_cast(address + 0x64)); + } + ipl::System::getPointer()->changeType(*reinterpret_cast(address + 0x6c), 0); + static_cast(ipl::System::getScene(5))->enableBtn(); + void* layout = *reinterpret_cast(address + 0x8c); + nw4r::lyt::Pane* root = + *reinterpret_cast(reinterpret_cast(layout) + 0x14); + const char* const* buttonNames = + reinterpret_cast(dataBase + 0x3c); + const char* paneName = buttonNames[*reinterpret_cast(address + 0x74)]; + nw4r::lyt::Pane* pane = root->FindPaneByName(paneName, true); + SetVisible__Q34nw4r3lyt4PaneFb(pane, true); + *reinterpret_cast(address + 0x84) = 0; + *reinterpret_cast(address + 0xac) = 0xb; + reset_friend__Q33ipl5scene7AddressFv(self); + break; + } + default: + break; + } +} + +extern "C" void stt_wait_dialog__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { + char* dialog = reinterpret_cast(ipl::System::getDialog()); + if (*reinterpret_cast(dialog + 0x24) >= 0) { + reset_gui__Q33ipl5scene7AddressFb(self, true); + *reinterpret_cast(reinterpret_cast(self) + 0xac) = 4; + } +} + +extern "C" void on_point_event__Q33ipl5scene7AddressFiPQ33ipl10controller9Interface( + ipl::scene::Address* self, int index, void* controller) { + char* address = reinterpret_cast(self); + int* count = reinterpret_cast(address + index * 4 + 0xcc); + if (*count == 0) { + if (*(reinterpret_cast(address) + index + 0xc4) != 0) { + void* layout = *reinterpret_cast(address + 0x8c); + unsigned short animationIndex = index + 6; + void* frame = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(layout) + 0x28c, animationIndex); + initFrame__Q33ipl7utility15FrameControllerFv(frame); + *reinterpret_cast(reinterpret_cast(frame) + 0x14) = 1; + } else { + void* layout = *reinterpret_cast(address + 0x8c); + unsigned short animationIndex = index + 0x15; + void* frame = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(layout) + 0x28c, animationIndex); + initFrame__Q33ipl7utility15FrameControllerFv(frame); + *reinterpret_cast(reinterpret_cast(frame) + 0x14) = 1; + } + ipl::snd::sSystem.startSE(lbl_81647AC3); + static_cast(controller)->rumble(1); + } + *count += 1; +} + +extern "C" void left_point_event__Q33ipl5scene7AddressFi(ipl::scene::Address* self, int index) { + char* address = reinterpret_cast(self); + int* count = reinterpret_cast(address + index * 4 + 0xcc); + if (*count == 1) { + if (*(reinterpret_cast(address) + index + 0xc4) != 0) { + void* layout = *reinterpret_cast(address + 0x8c); + unsigned short animationIndex = index + 0xb; + void* frame = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(layout) + 0x28c, animationIndex); + initFrame__Q33ipl7utility15FrameControllerFv(frame); + *reinterpret_cast(reinterpret_cast(frame) + 0x14) = 1; + } else { + void* layout = *reinterpret_cast(address + 0x8c); + unsigned short animationIndex = index + 0x1a; + void* frame = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( + reinterpret_cast(layout) + 0x28c, animationIndex); + initFrame__Q33ipl7utility15FrameControllerFv(frame); + *reinterpret_cast(reinterpret_cast(frame) + 0x14) = 1; + } + } + if (*count > 0) { + *count = *count - 1; + } +} + +extern "C" bool isDupId__Q33ipl5scene15FriendListCacheFRCUx( + const ipl::scene::FriendListCache* self, const unsigned long long* id) { + const unsigned char* cache = reinterpret_cast(self); + for (int i = 0; i < 100; i++) { + if (cache[i + 32000] != 0 && self->getInfo(i).attr.type == 1) { + const NWC24FriendInfo& info = self->getInfo(i); + if (*id == info.addr.wiiId) { + return true; + } + } + } + return false; +} + +extern "C" int init__Q33ipl5scene15FriendListCacheFv(ipl::scene::FriendListCache* self) { + char* address = reinterpret_cast(self); + ipl::nwc24::Manager* manager = ipl::System::getNwc24Manager(); + if (!manager->open()) { + return 0; + } + manager->getMyUserId(reinterpret_cast(address + 0x7d68)); + u32 friendInfoCount; + manager->getNumFriendInfos(&friendInfoCount); + manager->getNumRegFriendInfos(reinterpret_cast(address + 0x7d70)); + u32 index = 0; + int infoOffset = 0; + for (; index < 100; index++, infoOffset += 0x140) { + unsigned char* flagAddress = reinterpret_cast(self) + index; + u8 there = manager->isFriendInfoThere(index); + flagAddress[0x7d00] = there; + if (there) { + manager->readFriendInfo(reinterpret_cast(address + infoOffset), index); + } + } + *reinterpret_cast(address + 0x9d74) = 0; + *reinterpret_cast(address + 0x9d78) = 1; + return 1; +} + +extern "C" void add__Q33ipl5scene15FriendListCacheFUlRC15NWC24FriendInfo( + ipl::scene::FriendListCache* self, unsigned int index, const NWC24FriendInfo* info) { + char* address = reinterpret_cast(self); + NWC24FriendInfo* records = reinterpret_cast(self); + memcpy(&records[index], info, 0x140); + *(reinterpret_cast(address) + index + 32000) = 1; + int* friendCount = reinterpret_cast(address + 0x7d70); + *friendCount += 1; + writeFriendInfo__Q33ipl5nwc247ManagerFPC15NWC24FriendInfoUl( + ipl::System::getNwc24Manager(), &records[index], index); +} + +extern "C" void update__Q33ipl5scene15FriendListCacheFUlPCwUx( + ipl::scene::FriendListCache* self, unsigned int index, const wchar_t* name, + unsigned long long id) { + reinterpret_cast(self)[index].attr.fdId = id; + memset(reinterpret_cast(self)[index].attr.name, 0, 0x18); + wcsncpy(reinterpret_cast(reinterpret_cast(self)[index].attr.name), + name, 10); + updateFriendInfo__Q33ipl5nwc247ManagerFPC15NWC24FriendInfoUl( + ipl::System::getNwc24Manager(), &reinterpret_cast(self)[index], index); +} + +extern "C" void swap__Q33ipl5scene15FriendListCacheFUlUl( + ipl::scene::FriendListCache* self, unsigned int first, unsigned int second) { + NWC24FriendInfo temp __attribute__((aligned(32))); + memcpy(&temp, &reinterpret_cast(self)[first], 0x140); + memcpy(&reinterpret_cast(self)[first], + &reinterpret_cast(self)[second], 0x140); + memcpy(&reinterpret_cast(self)[second], &temp, 0x140); + unsigned char flag = *(reinterpret_cast(self) + first + 32000); + *(reinterpret_cast(self) + first + 32000) = + *(reinterpret_cast(self) + second + 32000); + *(reinterpret_cast(self) + second + 32000) = flag; + swapFriendInfo__Q33ipl5nwc247ManagerFUlUl(ipl::System::getNwc24Manager(), first, second); +} + +extern "C" bool isDupMail__Q33ipl5scene15FriendListCacheFPCc(const void* self, + const char* mail) { + const unsigned char* cache = reinterpret_cast(self); + const NWC24FriendInfo* records = reinterpret_cast(self); + int infoOffset; + int flagOffset; + flagOffset = 0; + infoOffset = 0; + for (; flagOffset < 100; flagOffset++, infoOffset += 0x140) { + if (cache[flagOffset + 32000] != 0 && records[flagOffset].attr.type == 2 && + strcmp(records[flagOffset].addr.mailAddr, mail) == 0) { + return true; + } + } + return false; +} + +extern "C" int check__Q33ipl5scene15FriendListCacheFv(ipl::scene::FriendListCache* self) { + int result = check__Q33ipl5nwc247ManagerFUl(ipl::System::getNwc24Manager(), 1); + *reinterpret_cast(reinterpret_cast(self) + 0x9d74) = result; + return result; +} + extern "C" asm void __ml__Q33ipl4math4VEC2CFf() { stwu r1, -0x10(r1) mflr r0 @@ -528,7 +3047,8 @@ extern "C" asm void __ml__Q33ipl4math4VEC2CFf() { blr } -extern "C" asm void SetTranslate__Q34nw4r3lyt4PaneFRCQ34nw4r4math4VEC3() { +extern "C" asm void SetTranslate__Q34nw4r3lyt4PaneFRCQ34nw4r4math4VEC3( + nw4r::lyt::Pane* pane, const nw4r::math::VEC3* translate) { nofralloc lfs f2, 0(r4) lfs f1, 4(r4) -- 2.49.1 From 9c71b90b726f8b5f13273eeb19a515f7309fc641 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 19:15:07 +0000 Subject: [PATCH 2/6] continue address scene decompilation --- include/scene/address/iplAddress.h | 261 +- include/scene/letterWriter/iplLetterWriter.h | 7 + include/system/iplNigaoe.h | 3 + libs/NW4R/include/nw4r/math/arithmetic.h | 4 + libs/NW4R/include/nw4r/math/types.h | 8 + src/scene/address/iplAddress.cpp | 4883 +++++++----------- 6 files changed, 2158 insertions(+), 3008 deletions(-) diff --git a/include/scene/address/iplAddress.h b/include/scene/address/iplAddress.h index 98af9b23..5f1bbc77 100644 --- a/include/scene/address/iplAddress.h +++ b/include/scene/address/iplAddress.h @@ -1,71 +1,274 @@ #ifndef IPL_SCENE_ADDRESS_H #define IPL_SCENE_ADDRESS_H -#include "iplSceneHeader.h" +#include "iplSceneUIHeader.h" + #include "scene/button/iplButton.h" #include namespace ipl { - namespace layout { + namespace nigaoe { class Object; } namespace scene { + class AddressEvent; + class FriendListCache { public: + enum { + FRIEND_MAX = 100, + }; + + FriendListCache() : mbOpened(false) {} + + BOOL init(); void fin(); + + void add(u32 index, const NWC24FriendInfo& info); + void update(u32 index, const wchar_t* name, u64 fdId); + void del(u32 index); + void swap(u32 index1, u32 index2); + + BOOL isValidId(const NWC24UserId& userId); + BOOL isDupId(const NWC24UserId& userId); + BOOL isDupMail(const char* mailAddr); + + void sendRegisterMail(u32 index); + + s32 check(); + s32 getErrCode() const; + const NWC24FriendInfo& getInfo(int index) const { return mInfos[index]; } + bool isThere(u32 index) const { return mbThere[index]; } + u32 getRegFriendNum() const { return mRegFriendNum; } + NWC24UserId getMyUserId() const { return mMyUserId; } + s32 getLastErr() const { return mErrCode; } private: - NWC24FriendInfo mInfos[100]; + NWC24FriendInfo mInfos[FRIEND_MAX]; // 0x0000 + bool mbThere[FRIEND_MAX]; // 0x7D00 + NWC24UserId mMyUserId; // 0x7D68 + u32 mRegFriendNum; // 0x7D70 + u8 mSendWork[0x2000]; // 0x7D74 + s32 mErrCode; // 0x9D74 + bool mbOpened; // 0x9D78 }; FADER_SCENE_CLASS(Address), public ButtonEventHandlerBase { public: - Address(EGG::Heap * heap, int); + Address(EGG::Heap * heap, int mode); virtual ~Address(); + + virtual void prepare(); virtual void create(); - virtual void destroy() override; virtual void draw(); + virtual void destroy(); + + virtual FaderSceneCommand calcFadein(); + + virtual void initCalcNormal(); + virtual FaderSceneCommand calcNormal(); + + virtual void initCalcFadeout(); + virtual FaderSceneCommand calcFadeout(); + + virtual void calcCommonAfter(); + + virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); enum { SCENE_ADD_WII = 1, SCENE_ADD_EMAIL, }; + enum { + BTN_MAX = 5, + BTN_SPACE_MAX = BTN_MAX - 1, + PAGE_MAX = 20, + }; + int getChosenFriendIndex() { - return unk_0xC0; + return mChosenFriend; } FriendListCache* getFriendCache() { - return unk_0x274; + return mpFriendCache; } private: - class MiiObj { - public: - u8 unk_0x0[0x20]; - void* unk_0x20; - void* unk_0x24; + enum { + FADEIN_STATE_WAIT_OPEN = 0, + FADEIN_STATE_FADEIN, + FADEIN_STATE_DONE, }; - u8 unk_0x64[0x28]; - ipl::layout::Object* mLayout; - u8 unk_0x90[0x0C]; - ipl::layout::Object* mPaneLayout; - ipl::layout::Object* mCursorLayout; - u8 unk_0xA4[8]; - int mState; - int mPage; - int mPageCount; - int mFriendCount; - int mSelectedButton; - int unk_0xC0; - u8 unk_0xC4[0x20]; - MiiObj mMiiObjA[5]; - MiiObj mMiiObjB[5]; - FriendListCache* unk_0x274; - u8 unk_0x278[0x28]; + enum { + STATE_INIT = 0, + STATE_COVER_NORMAL, + STATE_COVER_FORWARD, + STATE_COVER_BACKWARD, + STATE_NORMAL, + STATE_FORWARD, + STATE_BACKWARD, + STATE_LOOP_FORWARD, + STATE_LOOP_BACKWARD, + STATE_DECIDE, + STATE_DRAG, + STATE_RELEASE, + STATE_WAIT_CHILD_CST, + STATE_WAIT_CHILD_DST, + STATE_WAIT_CHILD_FADEOUT, + STATE_MSG_NET, + STATE_WAIT_PARENTAL, + STATE_WAIT_PARENTAL_DST, + STATE_MSG_WC, + STATE_WAIT_PARENTAL_WC, + STATE_WAIT_PARENTAL_DST_WC, + STATE_MSG_NWC24_ERROR, + STATE_MSG_FI_FULL, + STATE_MSG_PARENTAL, + STATE_MSG_OPEN_FAILURE, + STATE_WAIT_DIALOG, + STATE_DONE, + }; + + class MiiObj { + public: + MiiObj(); + ~MiiObj(); + + void init(nw4r::lyt::Pane* pane); + void set(u64 fdId); + void reset(); + + static void create_callback(nigaoe::Object* object, void* work); + + GXTexObj mTexObj; // 0x00 + nigaoe::Object* mpNigaoe; // 0x20 + nw4r::lyt::Material* mpMaterial; // 0x24 + }; + + struct DragInfo { + nw4r::math::VEC2 mPos; // 0x00 + int mChan; // 0x08 + int mPage; // 0x0C + int mButton; // 0x10 + int mNextCount; // 0x14 + int mPrevCount; // 0x18 + int unk_0x1C; // 0x1C + bool mbDragging; // 0x20 + }; + + void fistt_wait_open(); + void fistt_fadein(); + + void onInitFriendList(); + + void stt_cover_normal(); + void stt_cover_forward(); + void stt_cover_backward(); + void stt_normal(); + void stt_forward(); + void stt_backward(); + void stt_loop_forward(); + void stt_loop_backward(); + void stt_decide(); + void stt_drag(); + void stt_release(); + void stt_wait_child_cst(); + void stt_wait_child_dst(); + void stt_wait_child_fadeout(); + void stt_msg_net(); + void stt_wait_parental(); + void stt_wait_parental_dst(); + void stt_msg_wc(); + void stt_wait_parental_wc(); + void stt_wait_parental_dst_wc(); + void stt_msg_nwc24_error(); + void stt_msg_fi_full(); + void stt_msg_parental(); + void stt_msg_open_failure(); + void stt_wait_dialog(); + + void add_translate(nw4r::lyt::Pane* pane, const math::VEC2& offset); + void set_friend(const char* paneName, u32 friendNo, u32 buttonNo, MiiObj& miiObj, bool bDrag); + void set_page_text(const char* paneName, int page); + void set_textbox(const char* paneName, const wchar_t* text); + void set_textbox(const char* paneName, u32 msgId); + void reset_friend(); + + void start_point_event(const char* paneName, controller::Interface* con); + void start_left_event(const char* paneName); + void start_trig_event(const char* paneName); + void start_drag_event(const char* paneName, const controller::Interface* con); + void start_drag_point_event(const char* paneName, controller::Interface* con); + void start_drag_left_event(const char* paneName); + void start_release_event(const char* paneName); + + void on_point_event(int buttonNo, controller::Interface* con); + void left_point_event(int buttonNo); + + int get_button_no(const char* paneName); + int get_button_space_no(const char* paneName); + + void reset_gui(bool bKeepPointed); + + BOOL is_selectable(u32 friendNo); + + void onNextPage(); + void onPreviousPage(); + + void set_err_msg(wchar_t* errMsg, u32 errMsgLen, NWC24Err err); + + void entry_friend(); + + bool isReleasableArea(int page, int buttonNo); + + void changePage_onDrag(); + void movePane_onDrag(); + + DragInfo mDrag; // 0x64 + int mMode; // 0x88 + layout::Object* mpLayout; // 0x8C + int unk_0x90; // 0x90 + AddressEvent* mpEvent; // 0x94 + gui::PaneManager* mpGui; // 0x98 + layout::Object* mpBackLayout; // 0x9C + layout::Object* mpDialogLayout; // 0xA0 + int mFadeinState; // 0xA4 + int mWaitOpenCount; // 0xA8 + int mState; // 0xAC + u32 mPage; // 0xB0 + int mNextPageNum; // 0xB4 + int mPrevPageNum; // 0xB8 + int mSelectedButton; // 0xBC + u32 mChosenFriend; // 0xC0 + bool mbFaceValid[BTN_MAX]; // 0xC4 + int mPointCount[BTN_MAX]; // 0xCC + bool mbParentalOK; // 0xE0 + bool mbCover; // 0xE1 + MiiObj mMiiObj[BTN_MAX]; // 0xE4 + MiiObj mNextMiiObj[BTN_MAX]; // 0x1AC + FriendListCache* mpFriendCache; // 0x274 + GXTexObj mDragTexObj; // 0x278 + u8* mpWork; // 0x298 + f32 mDragOffsetX; // 0x29C + + static const math::VEC2 smcPageOffset; + + friend class AddressEvent; + }; + + class AddressEvent : public ::gui::EventHandler { + public: + AddressEvent(Address* instance) : ::gui::EventHandler(), mpInstance(instance) {} + + virtual void onEvent(u32 compId, u32 event, void* data); + + private: + Address* mpInstance; // 0x0C + int mTrigChan; // 0x10 }; } // namespace scene } // namespace ipl diff --git a/include/scene/letterWriter/iplLetterWriter.h b/include/scene/letterWriter/iplLetterWriter.h index bac1a82a..3bbf834e 100644 --- a/include/scene/letterWriter/iplLetterWriter.h +++ b/include/scene/letterWriter/iplLetterWriter.h @@ -35,7 +35,14 @@ namespace ipl { virtual void onSend(); virtual int sendMessageByNWC24(NWC24UserId userId, const wchar_t* wcString); +#ifdef IPL_ADDRESS_MATCHING + virtual void setFriendInfo(const NWC24FriendInfo& info) { + mbToFriend = true; + mFriendInfo = info; + } +#else virtual void setFriendInfo(const NWC24FriendInfo& info); +#endif virtual void setPhoto(const GXTexObj& texObj); virtual int sendToWii(NWC24UserId userId, const wchar_t* wcString); diff --git a/include/system/iplNigaoe.h b/include/system/iplNigaoe.h index f86ba1f6..9bcf66f3 100644 --- a/include/system/iplNigaoe.h +++ b/include/system/iplNigaoe.h @@ -38,6 +38,9 @@ namespace ipl { } const GXTexObj& getIconTexture() const { return mFaceTexObj; } +#ifdef IPL_ADDRESS_MATCHING + u8* getIconImage() const { return mpIconTex; } +#endif u32 getIndex() const { return mFaceId; } BOOL created() const { return mbCreated; } diff --git a/libs/NW4R/include/nw4r/math/arithmetic.h b/libs/NW4R/include/nw4r/math/arithmetic.h index b469ab2b..2075515d 100644 --- a/libs/NW4R/include/nw4r/math/arithmetic.h +++ b/libs/NW4R/include/nw4r/math/arithmetic.h @@ -50,6 +50,10 @@ namespace nw4r { f32 FrSqrt(f32 x); u32 CntBit1(u32 x); + +#ifdef IPL_ADDRESS_MATCHING + inline f32 FSqrt(f32 x) { return (x <= 0.0f) ? 0.0f : x * FrSqrt(x); } +#endif } // namespace math } // namespace nw4r diff --git a/libs/NW4R/include/nw4r/math/types.h b/libs/NW4R/include/nw4r/math/types.h index a46f642d..08e9515f 100644 --- a/libs/NW4R/include/nw4r/math/types.h +++ b/libs/NW4R/include/nw4r/math/types.h @@ -118,6 +118,10 @@ namespace nw4r { return *this; } +#ifdef IPL_ADDRESS_MATCHING + VEC2 operator-() const { return VEC2(-x, -y); } +#endif + VEC2 operator+(const VEC2& rhs) const { return VEC2(x + rhs.x, y + rhs.y); } VEC2 operator-(const VEC2& rhs) const { return VEC2(x - rhs.x, y - rhs.y); } VEC2 operator*(f32 val) const { return VEC2(val * x, val * y); } @@ -130,6 +134,10 @@ namespace nw4r { bool operator!=(const VEC2& rhs) const { return x != rhs.x || y != rhs.y; } } VEC2; +#ifdef IPL_ADDRESS_MATCHING + inline f32 VEC2LenSq(const VEC2* p) { return p->x * p->x + p->y * p->y; } +#endif + typedef struct VEC3 VEC3; inline VEC3* VEC3Transform(VEC3* pOut, const MTX34* pMtx, const VEC3* pVec); diff --git a/src/scene/address/iplAddress.cpp b/src/scene/address/iplAddress.cpp index e1e2a6cb..242a4d91 100644 --- a/src/scene/address/iplAddress.cpp +++ b/src/scene/address/iplAddress.cpp @@ -1,3060 +1,1985 @@ +#define IPL_ADDRESS_MATCHING +#define IPL_SOUND_RECT_OUT_OF_LINE +#include +#undef IPL_SOUND_RECT_OUT_OF_LINE + #include "scene/address/iplAddress.h" + +#include "iplSceneUI.h" + +#include "scene/board/iplBoard.h" #include "scene/letterWriter/iplLetterWriter.h" #include "scene/mailAddSel/iplMailAddressSelect.h" -#include "scene/button/iplButton.h" -#include "sound/iplSound.h" +#include "scene/parentalDialog/iplParentalDialog.h" -#include "system/iplController.h" -#include "system/MESGEntries.h" -#include "system/iplSystem.h" #include "scene/setting/iplNCDSetting.h" -#include "layout/iplGuiManager.h" -#include "layout/iplLayout.h" + +#include "system/MESGEntries.h" +#include "system/iplNigaoe.h" +#include "system/iplNigaoeManager.h" +#include "system/iplSystem.h" #include "utility/iplCharacterCode.h" -#include #include +#include -extern "C" char lbl_81647538[] __attribute__((aligned(1))) = "T_name_b_00"; -extern "C" char lbl_81647544[] __attribute__((aligned(1))) = "T_name_b_01"; -extern "C" char lbl_81647550[] __attribute__((aligned(1))) = "T_name_b_02"; -extern "C" char lbl_8164755C[] __attribute__((aligned(1))) = "T_name_b_03"; -extern "C" char lbl_81647568[] __attribute__((aligned(1))) = "T_name_b_04"; -extern "C" const char* lbl_81647574[5] = { - lbl_81647538, lbl_81647544, lbl_81647550, lbl_8164755C, lbl_81647568, -}; +namespace ipl { + namespace scene { + static const char* sTextNameB[Address::BTN_MAX] = {"T_name_b_00", "T_name_b_01", "T_name_b_02", "T_name_b_03", "T_name_b_04"}; -extern "C" char lbl_81647588[] __attribute__((aligned(1))) = "T_name_c_00"; -extern "C" char lbl_81647594[] __attribute__((aligned(1))) = "T_name_c_01"; -extern "C" char lbl_816475A0[] __attribute__((aligned(1))) = "T_name_c_02"; -extern "C" char lbl_816475AC[] __attribute__((aligned(1))) = "T_name_c_03"; -struct TextNameCData { - char lastName[12]; - const char* names[5]; -}; -extern "C" TextNameCData lbl_816475B8 = { - "T_name_c_04", {lbl_81647588, lbl_81647594, lbl_816475A0, lbl_816475AC, - lbl_816475B8.lastName}, -}; + static const char* sTextNameC[Address::BTN_MAX] = {"T_name_c_00", "T_name_c_01", "T_name_c_02", "T_name_c_03", "T_name_c_04"}; -extern "C" char lbl_816475D8[] __attribute__((aligned(1))) = "B_name_b_00"; -extern "C" char lbl_816475E4[] __attribute__((aligned(1))) = "B_name_b_01"; -extern "C" char lbl_816475F0[] __attribute__((aligned(1))) = "B_name_b_02"; -extern "C" char lbl_816475FC[] __attribute__((aligned(1))) = "B_name_b_03"; -extern "C" char lbl_81647608[] __attribute__((aligned(1))) = "B_name_b_04"; -extern "C" const char* lbl_81647614[5] = { - lbl_816475D8, lbl_816475E4, lbl_816475F0, lbl_816475FC, lbl_81647608, -}; + static const char* sButtonName[Address::BTN_MAX] = {"B_name_b_00", "B_name_b_01", "B_name_b_02", "B_name_b_03", "B_name_b_04"}; -extern "C" char lbl_81647628[] __attribute__((aligned(1))) = "B_name_b_00_01"; -extern "C" char lbl_81647637[] __attribute__((aligned(1))) = "B_name_b_01_02"; -extern "C" char lbl_81647646[] __attribute__((aligned(1))) = "B_name_b_02_03"; -extern "C" char lbl_81647655[] __attribute__((aligned(1))) = "B_name_b_03_04"; -extern "C" const char* lbl_81647664[4] = { - lbl_81647628, lbl_81647637, lbl_81647646, lbl_81647655, -}; + static const char* sButtonSpaceName[Address::BTN_SPACE_MAX] = {"B_name_b_00_01", "B_name_b_01_02", "B_name_b_02_03", + "B_name_b_03_04"}; -extern "C" char lbl_81647674[] __attribute__((aligned(1))) = "name_b_00"; -extern "C" char lbl_8164767E[] __attribute__((aligned(1))) = "name_b_01"; -extern "C" char lbl_81647688[] __attribute__((aligned(1))) = "name_b_02"; -extern "C" char lbl_81647692[] __attribute__((aligned(1))) = "name_b_03"; -struct NameBData { - char lastName[10]; - unsigned char alignment[2]; - const char* names[5]; -}; -extern "C" NameBData lbl_8164769C = { - "name_b_04", {0, 0}, {lbl_81647674, lbl_8164767E, lbl_81647688, lbl_81647692, - lbl_8164769C.lastName}, -}; + static const char* sNameGroup[Address::BTN_MAX] = {"name_b_00", "name_b_01", "name_b_02", "name_b_03", "name_b_04"}; -extern "C" char lbl_816476BC[] __attribute__((aligned(1))) = "G_name_c_00"; -extern "C" char lbl_816476C8[] __attribute__((aligned(1))) = "G_name_c_01"; -extern "C" char lbl_816476D4[] __attribute__((aligned(1))) = "G_name_c_02"; -extern "C" char lbl_816476E0[] __attribute__((aligned(1))) = "G_name_c_03"; -#pragma pack(push, 1) -struct NameCData { - char lastName[12]; - const char* names[5]; - char pool[0x276]; -}; -#pragma pack(pop) -extern "C" NameCData lbl_816476EC = { - "G_name_c_04", - {lbl_816476BC, lbl_816476C8, lbl_816476D4, lbl_816476E0, lbl_816476EC.lastName}, - "th_Adress_a.brlyt\0" - "th_Adress_a_note_alp_in.brlan\0" - "G_note_all\0" - "th_Adress_a_note_alp_out.brlan\0" - "th_Adress_a_note_trns_in.brlan\0" - "th_Adress_a_note_trns_out.brlan\0" - "th_Adress_a_note_e_rtt.brlan\0" - "G_note_e_rtt\0" - "th_Adress_a_note_c_rtt.brlan\0" - "note_c_rtt\0" - "th_Adress_a_name_in.brlan\0" - "th_Adress_a_name_out.brlan\0" - "th_Adress_a_name_psh.brlan\0" - "th_Adress_a_gry_name_in.brlan\0" - "th_Adress_a_gry_name_out.brlan\0" - "th_Adress_a_gry_name_psh.brlan\0" - "th_Adress_a_name_c_gry.brlan\0" - "my_Back_a.brlyt\0" - "my_Back_a_Apear.brlan\0" - "Picture_00\0" - "my_Back_a_Lost.brlan\0" - "my_Dialog_a.brlyt\0" - "my_Dialog_a_DialogIn.brlan\0" - "my_Dialog_a_DialogOut.brlan\0" - "T_Dialog\0" - "mii_b_%02d\0" - "mii_c_%02d\0" - "T_adrs_00\0" - "T_wii_msg" -}; -extern "C" const wchar_t lbl_8160F650[] = L"0123456789"; -extern "C" const float lbl_816947D0[2] = {176.0f, -0.0f}; -extern "C" const float lbl_816947D8 = 0.0f; -extern "C" const float lbl_816947DC = 20.0f; -extern "C" const float lbl_816947E0 = 1.0f; -extern "C" const float lbl_816947E4 = 0.01f; -extern "C" float lbl_81698B50; -extern "C" float lbl_81698B54; -extern "C" float lbl_816947E8 __attribute__((section(".sdata2"), aligned(4))) = -1.0f; -extern "C" const u16 lbl_8160F666 __attribute__((section(".rodata"), aligned(1), used)) = 0; -static ipl::math::VEC2 sAddressVEC2(lbl_816947E8, lbl_816947E8); -extern "C" char lbl_81647982[] __attribute__((aligned(1))) = "N_note_move"; -extern "C" char lbl_8164798E[] __attribute__((aligned(1))) = "WIPL_SE_FL_PAGE_INC"; -extern "C" char sAddressStringPoolB[]; + static const char* sNameCGroup[Address::BTN_MAX] = {"G_name_c_00", "G_name_c_01", "G_name_c_02", "G_name_c_03", "G_name_c_04"}; -extern "C" char smArg__Q23ipl6System; -extern "C" void checkUserId__Q33ipl5nwc247ManagerFUx(); -extern "C" void getErrCode__Q33ipl5nwc247ManagerFv(); -extern "C" void close__Q33ipl5nwc247ManagerFv(); -extern "C" int check__Q33ipl5nwc247ManagerFUl(void*, unsigned int); -extern "C" void initFrame__Q33ipl7utility15FrameControllerFv(void*); -extern "C" char lbl_81647AC3[]; -extern "C" char lbl_81647538[]; -extern "C" char lbl_81647982[]; -extern "C" void deleteFriendInfo__Q33ipl5nwc247ManagerFUl(); -extern "C" void getScene__Q33ipl5scene7ManagerFi(); -extern "C" void setEventHandler__Q33ipl5scene6ButtonFPQ23gui12EventHandlerPQ23gui12EventHandler(); -extern "C" void calc__Q33ipl6layout6ObjectFv(); -extern "C" void __ct__Q33ipl4math4VEC2Fff(); -extern "C" void __dt__Q33ipl6nigaoe6ObjectFv(); -extern "C" void __dl__FPv(void*); -extern "C" void GetTexture__Q34nw4r3lyt8MaterialCFP9_GXTexObjUc(); -extern "C" void SetTexture__Q34nw4r3lyt8MaterialFUcRC9_GXTexObj(); -extern "C" void create__Q33ipl6nigaoe7ManagerFPQ23EGG4HeapiiiPFPQ33ipl6nigaoe6ObjectPvPv(); -extern "C" int init__Q33ipl5scene15FriendListCacheFv(ipl::scene::FriendListCache*); -extern "C" int check__Q33ipl5scene15FriendListCacheFv( - ipl::scene::FriendListCache*); -extern "C" void onInitFriendList__Q33ipl5scene7AddressFv(void*); -extern "C" void callBtn1__Q23ipl12DialogWindowFUlUl(void*, unsigned int, unsigned int); -extern "C" void* List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(const void*, unsigned short); -extern "C" void update__Q33ipl3gui11PaneManagerFv(void*); -extern "C" void changePage_onDrag__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void reset_gui__Q33ipl5scene7AddressFb(ipl::scene::Address* self, bool reset); -extern "C" void left_point_event__Q33ipl5scene7AddressFi(ipl::scene::Address* self, int index); -extern "C" void set_textbox__Q33ipl5scene7AddressFPCcPCw( - ipl::scene::Address* self, const char* paneName, const wchar_t* text); -extern "C" void set_page_text__Q33ipl5scene7AddressFPCci( - ipl::scene::Address* self, const char* paneName, int page); -extern "C" void add_translate__Q33ipl5scene7AddressFPQ34nw4r3lyt4PaneRCQ33ipl4math4VEC2( - void* self, nw4r::lyt::Pane* pane, const ipl::math::VEC2& offset); -extern "C" int get_button_no__Q33ipl5scene7AddressFPCc(void* self, const char* paneName); -extern "C" void on_point_event__Q33ipl5scene7AddressFiPQ33ipl10controller9Interface( - ipl::scene::Address* self, int index, void* controller); -extern "C" bool isReleasableArea__Q33ipl5scene7AddressFii(ipl::scene::Address* self, int page, - int index); -extern "C" void SetTranslate__Q34nw4r3lyt4PaneFRCQ34nw4r4math4VEC3( - nw4r::lyt::Pane* pane, const nw4r::math::VEC3* translate); -extern "C" void SetTranslate__Q34nw4r3lyt4PaneFRCQ34nw4r4math4VEC2( - nw4r::lyt::Pane* pane, const nw4r::math::VEC2* translate); -extern "C" void set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( - ipl::scene::Address* self, const char* paneName, unsigned int friendIndex, - unsigned int buttonIndex, void* miiObj, bool isDrag); -extern "C" void writeFriendInfo__Q33ipl5nwc247ManagerFPC15NWC24FriendInfoUl( - void* manager, const NWC24FriendInfo* info, unsigned int index); -extern "C" void updateFriendInfo__Q33ipl5nwc247ManagerFPC15NWC24FriendInfoUl( - void* manager, const NWC24FriendInfo* info, unsigned int index); -extern "C" void swapFriendInfo__Q33ipl5nwc247ManagerFUlUl( - void* manager, unsigned int first, unsigned int second); -extern "C" void swap__Q33ipl5scene15FriendListCacheFUlUl( - ipl::scene::FriendListCache* self, unsigned int first, unsigned int second); -extern "C" void entry_friend__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void reserveAllSceneDestruction__Q33ipl5scene4BaseFiPv( - void* self, int sceneId, void* args); -extern "C" void createChildScene__Q33ipl5scene4BaseFiPQ33ipl5scene4BasePQ33ipl5scene4BasePv( - void* self, int sceneId, void* parent, void* child, void* args); -extern "C" void __ct__Q43ipl5scene7Address6MiiObjFv(); -extern "C" void __dt__Q43ipl5scene7Address6MiiObjFv(); -extern "C" void init__Q43ipl5scene7Address6MiiObjFPQ34nw4r3lyt4Pane( - void*, nw4r::lyt::Pane*); -extern "C" void reset__Q43ipl5scene7Address6MiiObjFv(void*); -extern "C" void set__Q43ipl5scene7Address6MiiObjFUx(void*, unsigned long long); -extern "C" void __construct_array(void*, void (*)(), void (*)(), unsigned int, unsigned int); -extern "C" char __vt__Q33ipl5scene7Address[]; -extern "C" char __vt__Q33ipl5scene12AddressEvent[]; -extern "C" void* __nw__FUli(unsigned int, int); -extern "C" void* __nwa__FUl(unsigned int); -extern "C" void SetVisible__Q34nw4r3lyt4PaneFb(nw4r::lyt::Pane*, bool); -extern "C" void __destroy_arr(void*, void (*)(), unsigned int, unsigned int); + static math::VEC2 sPageOffset(-1.0f, -1.0f); -ipl::scene::Address::Address(EGG::Heap* heap, int mode) : ipl::scene::FaderSceneBase(heap) { - char* address = reinterpret_cast(this); - *reinterpret_cast(address + 0x88) = mode; - *reinterpret_cast(address + 0x8c) = 0; - *reinterpret_cast(address + 0x90) = 0; - *reinterpret_cast(address + 0x94) = 0; - *reinterpret_cast(address + 0x98) = 0; - *reinterpret_cast(address + 0x9c) = 0; - *reinterpret_cast(address + 0xa4) = 1; - *reinterpret_cast(address + 0xa8) = 0; - *reinterpret_cast(address + 0xac) = 1; - *reinterpret_cast(address + 0xb0) = 0; - *reinterpret_cast(address + 0xb4) = 20; - *reinterpret_cast(address + 0xb8) = 0; - *reinterpret_cast(address + 0xbc) = 0; - *reinterpret_cast(address + 0xc0) = 0; - *reinterpret_cast(address + 0xe0) = 0; - __construct_array(&mMiiObjA[0], __ct__Q43ipl5scene7Address6MiiObjFv, - __dt__Q43ipl5scene7Address6MiiObjFv, 0x28, 5); - __construct_array(&mMiiObjB[0], __ct__Q43ipl5scene7Address6MiiObjFv, - __dt__Q43ipl5scene7Address6MiiObjFv, 0x28, 5); - *reinterpret_cast(address + 0x28) = 3; - for (int index = 0; index < 5; index++) { - reinterpret_cast(address + 0xcc)[index] = 0; - } - for (int index = 0; index < 5; index++) { - *reinterpret_cast(address + 0xc4 + index) = 0; - } - memset(address + 0x64, 0, 0x24); - *reinterpret_cast(address + 0x78) = -1; - *reinterpret_cast(address + 0x7c) = -1; -} - -ipl::scene::Address::~Address() { - if (unk_0x274 != NULL) { - __dl__FPv(unk_0x274); - } - __destroy_arr(&mMiiObjB[0], __dt__Q43ipl5scene7Address6MiiObjFv, 0x28, 5); - __destroy_arr(&mMiiObjA[0], __dt__Q43ipl5scene7Address6MiiObjFv, 0x28, 5); -} - -extern "C" asm void getChild__Q33ipl5scene4BaseFv() { - nofralloc - lwz r3, 8(r3) - blr -} - -extern "C" asm void getPrev__Q33ipl5scene4BaseFv() { - nofralloc - lwz r3, 0x10(r3) - blr -} - -extern "C" asm void getNext__Q33ipl5scene4BaseFv() { - nofralloc - lwz r3, 0x0C(r3) - blr -} - -extern "C" asm void getParent__Q33ipl5scene4BaseFv() { - nofralloc - lwz r3, 4(r3) - blr -} - -extern "C" asm void startResetting__Q33ipl5scene4BaseFv() { - nofralloc - blr -} - -extern "C" asm void isResetProcessDone__Q33ipl5scene4BaseFv() { - nofralloc - li r3, 1 - blr -} - -extern "C" asm void isResetAcceptable__Q33ipl5scene4BaseCFv() { - nofralloc - li r3, 1 - blr -} - -extern "C" asm void isReady__Q33ipl5scene4BaseCFv() { - nofralloc - li r3, 0 - blr -} - -extern "C" asm void prepare__Q33ipl5scene7AddressFv() { - nofralloc - blr -} - -typedef gui::EventHandler GUIEventHandler; - -struct AddressCreateFields { - char unk00[0x24]; - EGG::Heap* heap; - char unk28[0x64]; - ipl::layout::Object* mainLayout; - void* unk90; - gui::EventHandler* event; - ipl::gui::PaneManager* gui; - ipl::layout::Object* backLayout; - ipl::layout::Object* dialogLayout; -}; - -void ipl::scene::Address::create() { - const char* data = lbl_81647538; - ipl::scene::SceneObj* scene = ipl::System::getScene(4); - ipl::nand::LayoutFile* file = *reinterpret_cast(reinterpret_cast(scene) + 0xd20); - *reinterpret_cast(reinterpret_cast(this) + 0xe1) = 1; - *reinterpret_cast(reinterpret_cast(this) + 0x8c) = - new ipl::layout::Object(*reinterpret_cast(reinterpret_cast(this) + 0x24), - file, "arc", data + 0x1d4); - (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) - ->bindToGroup(data + 0x1e6, data + 0x204, false, true); - (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) - ->bindToGroup(data + 0x20f, data + 0x204, false, false); - (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) - ->bindToGroup(data + 0x22e, data + 0x204, false, false); - (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) - ->bindToGroup(data + 0x24d, data + 0x204, false, false); - (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) - ->bindToGroup(data + 0x26d, data + 0x28a, false, - *reinterpret_cast(reinterpret_cast(this) + 0xe1)); - (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) - ->bindToGroup(data + 0x297, data + 0x2b4, false, - !*reinterpret_cast(reinterpret_cast(this) + 0xe1)); - - { - const char* const* names = reinterpret_cast(data + 0x170); - for (int i = 0; i < 5; i++) { - (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) - ->bindToGroup(data + 0x2bf, names[i], false, false); + inline void Address::set_textbox(const char* paneName, u32 msgId) { + set_textbox(paneName, System::getMessage(msgId)); } - } - { - const char* const* names = reinterpret_cast(data + 0x170); - for (int i = 0; i < 5; i++) { - (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) - ->bindToGroup(data + 0x2d9, names[i], false, false); - } - } - { - const char* const* names = reinterpret_cast(data + 0x170); - for (int i = 0; i < 5; i++) { - (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) - ->bindToGroup(data + 0x2f4, names[i], false, false); - } - } - { - const char* const* names = reinterpret_cast(data + 0x170); - for (int i = 0; i < 5; i++) { - (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) - ->bindToGroup(data + 0x30f, names[i], false, false); - } - } - { - const char* const* names = reinterpret_cast(data + 0x170); - for (int i = 0; i < 5; i++) { - (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) - ->bindToGroup(data + 0x32d, names[i], false, false); - } - } - { - const char* const* names = reinterpret_cast(data + 0x170); - for (int i = 0; i < 5; i++) { - (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) - ->bindToGroup(data + 0x34c, names[i], false, false); - } - } - { - const char* const* names = reinterpret_cast(data + 0x1c0); - for (int i = 0; i < 5; i++) { - (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) - ->bindToGroup(data + 0x36b, names[i], false, false); - } - } - (*reinterpret_cast(reinterpret_cast(this) + 0x8c))->finishBinding(); - *reinterpret_cast(reinterpret_cast(this) + 0x9c) = - new ipl::layout::Object(*reinterpret_cast(reinterpret_cast(this) + 0x24), - file, "arc", data + 0x388); - (*reinterpret_cast(reinterpret_cast(this) + 0x9c)) - ->bind(data + 0x398, data + 0x3ae, false, true); - (*reinterpret_cast(reinterpret_cast(this) + 0x9c)) - ->bind(data + 0x3b9, data + 0x3ae, false, false); - (*reinterpret_cast(reinterpret_cast(this) + 0x9c))->finishBinding(); - static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast( - reinterpret_cast(this) + 0x9c)) + 0x28c, 0))->initAnmFrame(); + Address::Address(EGG::Heap* heap, int mode) + : FaderSceneBase(heap), mMode(mode), mpLayout(NULL), unk_0x90(0), mpEvent(NULL), mpGui(NULL), mpBackLayout(NULL), + mFadeinState(FADEIN_STATE_FADEIN), mWaitOpenCount(0), mState(STATE_COVER_NORMAL), mPage(0), mNextPageNum(PAGE_MAX), + mPrevPageNum(0), mSelectedButton(0), mChosenFriend(0), mbParentalOK(false) { + setSceneParentFlags(SCN_PARENTFLAG_CALC | SCN_PARENTFLAG_DRAW); - *reinterpret_cast(reinterpret_cast(this) + 0xa0) = - new ipl::layout::Object(*reinterpret_cast(reinterpret_cast(this) + 0x24), - file, "arc", data + 0x3ce); - (*reinterpret_cast(reinterpret_cast(this) + 0xa0)) - ->bind(data + 0x3e0, "N_Top", false, true); - (*reinterpret_cast(reinterpret_cast(this) + 0xa0)) - ->bind(data + 0x3fb, "N_Top", false, false); - (*reinterpret_cast(reinterpret_cast(this) + 0xa0))->finishBinding(); - nw4r::lyt::TextBox* dialog = nw4r::ut::DynamicCast( - (*reinterpret_cast(reinterpret_cast(this) + 0xa0)) - ->GetRootPane()->FindPaneByName(data + 0x417, true)); - dialog->SetString(ipl::System::getMessage(0x4e), 0); - - AddressCreateFields* fields = reinterpret_cast(this); - GUIEventHandler* event = reinterpret_cast(::operator new(0x14)); - if (event != NULL) { - *reinterpret_cast(reinterpret_cast(event) + 8) = 0; - *reinterpret_cast(event) = __vt__Q33ipl5scene12AddressEvent; - *reinterpret_cast(reinterpret_cast(event) + 0xc) = this; - } - fields->event = event; - - fields->gui = new ipl::gui::PaneManager( - fields->event, fields->mainLayout->getDrawInfo(), NULL, NULL); - fields->gui->setupScene(fields->mainLayout); - fields->gui->setAllComponentTriggerTarget(false); - - const char* const* buttons = reinterpret_cast(data + 0xdc); - for (int i = 0; i < 5; i++) { - fields->gui->setTriggerTarget( - (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) - ->GetRootPane()->FindPaneByName(buttons[i], true), true); - } - buttons = reinterpret_cast(data + 0x12c); - for (int i = 0; i < 4; i++) { - fields->gui->setTriggerTarget( - (*reinterpret_cast(reinterpret_cast(this) + 0x8c)) - ->GetRootPane()->FindPaneByName(buttons[i], true), true); - } - - char paneNameC[16]; - char paneNameB[16]; - for (int i = 0; i < 5; i++) { - sprintf(paneNameC, data + 0x420, i); - void* pane = (*reinterpret_cast( - reinterpret_cast(this) + 0x8c))->GetRootPane()->FindPaneByName(paneNameC, true); - init__Q43ipl5scene7Address6MiiObjFPQ34nw4r3lyt4Pane( - reinterpret_cast(this) + 0xe4 + i * 0x28, - static_cast(pane)); - } - for (int i = 0; i < 5; i++) { - sprintf(paneNameB, data + 0x42b, i); - void* pane = (*reinterpret_cast( - reinterpret_cast(this) + 0x8c))->GetRootPane()->FindPaneByName(paneNameB, true); - init__Q43ipl5scene7Address6MiiObjFPQ34nw4r3lyt4Pane( - reinterpret_cast(this) + 0x1ac + i * 0x28, - static_cast(pane)); - } - - const char* paneName = data + 0x436; - set_textbox__Q33ipl5scene7AddressFPCcPCw(this, paneName, ipl::System::getMessage(0x86)); - paneName = data + 0x440; - set_textbox__Q33ipl5scene7AddressFPCcPCw(this, paneName, ipl::System::getMessage(0x42)); - - void* cache = __nw__FUli(0x9d80, 0x20); - if (cache != NULL) { - *reinterpret_cast(reinterpret_cast(cache) + 0x9d78) = 0; - } - *reinterpret_cast(reinterpret_cast(this) + 0x274) = cache; - if (init__Q33ipl5scene15FriendListCacheFv( - reinterpret_cast(cache))) { - onInitFriendList__Q33ipl5scene7AddressFv(this); - *reinterpret_cast(reinterpret_cast(this) + 0xa4) = 1; - } else { - *reinterpret_cast(reinterpret_cast(this) + 0xa4) = 0; - } - *reinterpret_cast(reinterpret_cast(this) + 0x298) = __nwa__FUl(0x2d20); - nw4r::lyt::Pane* pane = (*reinterpret_cast( - reinterpret_cast(this) + 0x8c))->GetRootPane()->FindPaneByName(data + 0x44a, true); - SetVisible__Q34nw4r3lyt4PaneFb(pane, false); -} - -extern "C" asm void calcCommon__Q33ipl5scene14FaderSceneBaseFv() { - nofralloc - blr -} - -extern "C" void fistt_fadein__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void fistt_wait_open__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" char lbl_8164798E[]; -extern "C" void onNextPage__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void onPreviousPage__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_cover_normal__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_cover_forward__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_cover_backward__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_normal__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_forward__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_backward__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_loop_forward__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_loop_backward__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_decide__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_drag__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_release__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_wait_child_cst__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_wait_child_dst__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_wait_child_fadeout__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_msg_net__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_wait_parental__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_wait_parental_dst__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_msg_wc__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_wait_parental_wc__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_wait_parental_dst_wc__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_msg_nwc24_error__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_msg_fi_full__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_msg_parental__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_msg_open_failure__Q33ipl5scene7AddressFv(ipl::scene::Address* self); -extern "C" void stt_wait_dialog__Q33ipl5scene7AddressFv(ipl::scene::Address* self); - -extern "C" ipl::scene::FaderSceneCommand calcFadein__Q33ipl5scene7AddressFv( - ipl::scene::Address* self) { - int state = *reinterpret_cast(reinterpret_cast(self) + 0xa4); - switch (state) { - case 0: - fistt_wait_open__Q33ipl5scene7AddressFv(self); - break; - case 1: - fistt_fadein__Q33ipl5scene7AddressFv(self); - break; - } - return *reinterpret_cast(reinterpret_cast(self) + 0xa4) == 2 - ? ipl::scene::FADER_SCN_NEXT - : ipl::scene::FADER_SCN_CONTINUE; -} - -extern "C" void initCalcNormal__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - gui::EventHandler* event = reinterpret_cast(self); - if (event != NULL) { - event = reinterpret_cast(reinterpret_cast(event) + 0x58); - } - static_cast(ipl::System::getScene(5))->setEventHandler(event, NULL); -} - -extern "C" ipl::scene::FaderSceneCommand calcNormal__Q33ipl5scene7AddressFv( - ipl::scene::Address* self) { - int state = *reinterpret_cast(reinterpret_cast(self) + 0xac); - switch (state) { - case 0: - ipl::snd::sSystem.startSE(lbl_8164798E); - onNextPage__Q33ipl5scene7AddressFv(self); - break; - case 1: - stt_cover_normal__Q33ipl5scene7AddressFv(self); - break; - case 2: - stt_cover_forward__Q33ipl5scene7AddressFv(self); - break; - case 3: - stt_cover_backward__Q33ipl5scene7AddressFv(self); - break; - case 4: - stt_normal__Q33ipl5scene7AddressFv(self); - break; - case 5: - stt_forward__Q33ipl5scene7AddressFv(self); - break; - case 6: - stt_backward__Q33ipl5scene7AddressFv(self); - break; - case 7: - stt_loop_forward__Q33ipl5scene7AddressFv(self); - break; - case 8: - stt_loop_backward__Q33ipl5scene7AddressFv(self); - break; - case 9: - stt_decide__Q33ipl5scene7AddressFv(self); - break; - case 10: - stt_drag__Q33ipl5scene7AddressFv(self); - break; - case 11: - stt_release__Q33ipl5scene7AddressFv(self); - break; - case 12: - stt_wait_child_cst__Q33ipl5scene7AddressFv(self); - break; - case 13: - stt_wait_child_dst__Q33ipl5scene7AddressFv(self); - break; - case 14: - stt_wait_child_fadeout__Q33ipl5scene7AddressFv(self); - break; - case 15: - stt_msg_net__Q33ipl5scene7AddressFv(self); - break; - case 16: - stt_wait_parental__Q33ipl5scene7AddressFv(self); - break; - case 17: - stt_wait_parental_dst__Q33ipl5scene7AddressFv(self); - break; - case 18: - stt_msg_wc__Q33ipl5scene7AddressFv(self); - break; - case 19: - stt_wait_parental_wc__Q33ipl5scene7AddressFv(self); - break; - case 20: - stt_wait_parental_dst_wc__Q33ipl5scene7AddressFv(self); - break; - case 21: - stt_msg_nwc24_error__Q33ipl5scene7AddressFv(self); - break; - case 22: - stt_msg_fi_full__Q33ipl5scene7AddressFv(self); - break; - case 23: - stt_msg_parental__Q33ipl5scene7AddressFv(self); - break; - case 24: - stt_msg_open_failure__Q33ipl5scene7AddressFv(self); - break; - case 25: - stt_wait_dialog__Q33ipl5scene7AddressFv(self); - break; - } - return static_cast( - *reinterpret_cast(reinterpret_cast(self) + 0xac) == 0x1a); -} - -extern "C" char sAddressStringPoolBPrefix[0x41] __attribute__((aligned(1))) = - "N_note_a\0" - "N_note_b\0" - "N_note_c\0" - "N_note_d\0" - "N_note_e\0" - "T_wii_name\0" - "T_nmbr_b"; -extern "C" char lbl_81647A4D[0x14] __attribute__((aligned(1))) = "WIPL_SE_FL_PAGE_DEC"; -extern "C" char lbl_81647A61[0xc] __attribute__((aligned(1))) = "N_note_base"; -extern "C" char lbl_81647A6D[0xb] __attribute__((aligned(1))) = "T_CalAdd_R"; -extern "C" char lbl_81647A78[0x4b] __attribute__((aligned(1))) = - "WIPL_SE_DECIDE\0" - "mii_move\0" - "WIPL_SE_CH_HOLD\0" - "WIPL_SE_CH_SET\0" - "WIPL_SE_CH_NOT_MOVE"; -extern "C" char lbl_81647AC3[0x2f] __attribute__((aligned(1))) = - "WIPL_SE_BT_TARGETTING\0" - "WIPL_SE_CANCEL\0" - "T_nmbr_c\0"; -extern "C" wchar_t lbl_81647AF2[] = L"%06d\n"; -extern "C" char lbl_81647AFE[0x1c] __attribute__((aligned(1))) = - "T_name_move\0" - "WIPL_SE_CH_DRAG"; -extern "C" char lbl_81647B1A[0xc] __attribute__((aligned(1))) = "N_base_move"; -extern "C" wchar_t lbl_81647B26[] = L"1234567890123456"; -extern "C" wchar_t lbl_81647B48[] = L"%016lld"; -extern "C" void fistt_wait_open__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - if (init__Q33ipl5scene15FriendListCacheFv( - *reinterpret_cast(address + 0x274))) { - onInitFriendList__Q33ipl5scene7AddressFv(self); - *reinterpret_cast(address + 0xa4) = 1; - } else if (*reinterpret_cast(address + 0xa8) >= 300) { - callBtn1__Q23ipl12DialogWindowFUlUl(ipl::System::getDialog(), MESG_ERROR_NWC24_FATAL, - MESG_CMN_OK); - *reinterpret_cast(address + 0xac) = 0x18; - *reinterpret_cast(address + 0xa4) = 2; - } - *reinterpret_cast(address + 0xa8) += 1; -} - -extern "C" void fistt_fadein__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - if (*reinterpret_cast(static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 0)) + 0x14) != 1 && - *reinterpret_cast(static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 2)) + 0x14) != 1 && - *reinterpret_cast(static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0xa0)) + 0x28c, 0)) + 0x14) != 1) { - *reinterpret_cast(address + 0xa4) = 2; - } -} - -extern "C" void onInitFriendList__Q33ipl5scene7AddressFv(void* self) { - char* address = static_cast(self); - char* stringPool = lbl_81647538; - wchar_t wiiId[24]; - wchar_t displayName[24]; - memset(wiiId, 0, 0x30); - memset(displayName, 0, 0x30); - ipl::utility::CharacterCode::WiiIdToUTF16( - wiiId, - *reinterpret_cast(static_cast(*reinterpret_cast(address + 0x274)) + - 0x7d68)); - - int destinationIndex = 0; - int sourceIndex = 0; - for (int i = 0; i < 4; i++) { - displayName[destinationIndex++] = wiiId[sourceIndex++]; - } - displayName[destinationIndex++] = L' '; - sourceIndex = 4; - for (int i = 0; i < 4; i++) { - displayName[destinationIndex++] = wiiId[sourceIndex++]; - } - displayName[destinationIndex++] = L' '; - sourceIndex = 8; - for (int i = 0; i < 4; i++) { - displayName[destinationIndex++] = wiiId[sourceIndex++]; - } - displayName[destinationIndex++] = L' '; - sourceIndex = 12; - for (int i = 0; i < 4; i++) { - displayName[destinationIndex++] = wiiId[sourceIndex++]; - } - - set_textbox__Q33ipl5scene7AddressFPCcPCw( - static_cast(self), stringPool + 0x501, - displayName); - set_page_text__Q33ipl5scene7AddressFPCci(static_cast(self), - stringPool + 0x50c, - *reinterpret_cast(address + 0xb0) + 1); - - const char** friendNames = reinterpret_cast(stringPool + 0x3c); - unsigned int friendIndex = 0; - int objectOffset = 0; - do { - char* miiObject = address + objectOffset + 0xe4; - set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( - static_cast(self), friendNames[friendIndex], friendIndex, - friendIndex, miiObject, false); - if (*reinterpret_cast(address + friendIndex + 0xc4) != 0) { - static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, - friendIndex + 6)) - ->initAnmFrame(); - } else { - static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, - friendIndex + 0x15)) - ->initAnmFrame(); - } - friendIndex++; - objectOffset += 0x28; - } while (friendIndex < 5); - - *reinterpret_cast(address + 0xb0) = 0; - *reinterpret_cast(address + 0xb8) = 0; - *reinterpret_cast(address + 0xb4) = 20; - ipl::scene::Button* button = reinterpret_cast( - ipl::System::getScene(5)); - button->animation(0x17); - button->animation(0x18); - - if (*reinterpret_cast(address + 0x88) == 0) { - *reinterpret_cast(address + 0xac) = 1; - } else if (*reinterpret_cast(static_cast( - *reinterpret_cast(address + 0x274)) + - 0x7d70) == 0) { - *reinterpret_cast(address + 0xac) = 1; - } else { - *reinterpret_cast(address + 0xac) = 0; - } - - int mode = *reinterpret_cast(address + 0x88); - if (mode == 0) { - goto init_friend_list_mode_zero; - } - if (mode < 0) { - goto init_friend_list_mode_done; - } - if (mode >= 3) { - goto init_friend_list_mode_done; - } - goto init_friend_list_mode_other; - -init_friend_list_mode_zero: { - void* frame = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 0); - initFrame__Q33ipl7utility15FrameControllerFv(frame); - *reinterpret_cast(static_cast(frame) + 0x14) = 1; - } - goto init_friend_list_mode_done; - -init_friend_list_mode_other: { - void* frame = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 2); - initFrame__Q33ipl7utility15FrameControllerFv(frame); - *reinterpret_cast(static_cast(frame) + 0x14) = 1; - void* dialogLayout = *reinterpret_cast(address + 0xa0); - frame = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(dialogLayout) + 0x28c, 0); - initFrame__Q33ipl7utility15FrameControllerFv(frame); - *reinterpret_cast(static_cast(frame) + 0x14) = 1; - } - -init_friend_list_mode_done:; -} - -extern "C" void stt_cover_normal__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - if (*reinterpret_cast(address + 0x84) != 0) { - changePage_onDrag__Q33ipl5scene7AddressFv(self); - } else { - ipl::scene::Button* button = static_cast(ipl::System::getScene(5)); - if (button->isActive()) { - button->update(); - } - } - if (*reinterpret_cast(address + 0xac) == 1) { - if (ipl::System::getMasterController()->down(ipl::controller::BTN_NEXT_RIGHT)) { - ipl::snd::sSystem.startSE(lbl_8164798E); - onNextPage__Q33ipl5scene7AddressFv(self); - } else if (ipl::System::getMasterController()->down(ipl::controller::BTN_NEXT_LEFT)) { - ipl::snd::sSystem.startSE(lbl_81647A4D); - onPreviousPage__Q33ipl5scene7AddressFv(self); - } - } -} - -extern "C" void stt_cover_forward__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - void* layout = *reinterpret_cast(address + 0x8c); - void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(layout) + 0x28c, 4); - if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { - *reinterpret_cast(address + 0xe1) = 0; - if (*reinterpret_cast(address + 0x84) == 0) { - *reinterpret_cast(address + 0xac) = 4; - } else { - *reinterpret_cast(address + 0xac) = 10; - } - } else if (*reinterpret_cast(address + 0x84) != 0) { - changePage_onDrag__Q33ipl5scene7AddressFv(self); - } -} - -extern "C" void stt_cover_backward__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); - if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { - nw4r::math::_VEC2 offset = {-sAddressVEC2.x, -sAddressVEC2.y}; - ipl::math::VEC2 translate(offset); - nw4r::lyt::Pane* pane = reinterpret_cast( - *reinterpret_cast(address + 0x8c)) - ->GetRootPane() - ->FindPaneByName(lbl_81647A61, true); - add_translate__Q33ipl5scene7AddressFPQ34nw4r3lyt4PaneRCQ33ipl4math4VEC2(self, pane, - translate); - *reinterpret_cast(address + 0xe1) = 1; - *reinterpret_cast(address + 0xb4) += 1; - *reinterpret_cast(address + 0xac) = 1; - } else if (*reinterpret_cast(address + 0x84) != 0) { - changePage_onDrag__Q33ipl5scene7AddressFv(self); - } -} - -extern "C" void stt_normal__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - ipl::scene::Button* button = static_cast(ipl::System::getScene(5)); - if (button->isActive()) { - button->update(); - } - if (*reinterpret_cast(address + 0xac) == 4) { - update__Q33ipl3gui11PaneManagerFv(*reinterpret_cast(address + 0x98)); - if (ipl::System::getMasterController()->down(ipl::controller::BTN_NEXT_RIGHT)) { - ipl::snd::sSystem.startSE(lbl_8164798E); - onNextPage__Q33ipl5scene7AddressFv(self); - } else if (ipl::System::getMasterController()->down(ipl::controller::BTN_NEXT_LEFT)) { - ipl::snd::sSystem.startSE(lbl_81647A4D); - onPreviousPage__Q33ipl5scene7AddressFv(self); - } - } -} - -extern "C" void stt_forward__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - void* layout = *reinterpret_cast(address + 0x8c); - void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(layout) + 0x28c, 5); - if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { - *reinterpret_cast(address + 0xb8) += 1; - if (*reinterpret_cast(address + 0x84) == 0) { - *reinterpret_cast(address + 0xac) = 4; - } else { - *reinterpret_cast(address + 0xac) = 10; - } - } else if (*reinterpret_cast(address + 0x84) != 0) { - changePage_onDrag__Q33ipl5scene7AddressFv(self); - } -} - -extern "C" void stt_backward__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* data = lbl_81647538; - char* address = reinterpret_cast(self); - void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 5); - if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { - *reinterpret_cast(address + 0xb4) += 1; - ipl::math::VEC2 translate; - translate.y = -sAddressVEC2.y; - translate.x = -sAddressVEC2.x; - nw4r::lyt::Pane* pane = reinterpret_cast( - *reinterpret_cast(address + 0x8c)) - ->GetRootPane() - ->FindPaneByName(data + 0x529, true); - add_translate__Q33ipl5scene7AddressFPQ34nw4r3lyt4PaneRCQ33ipl4math4VEC2( - self, pane, translate); - set_page_text__Q33ipl5scene7AddressFPCci( - self, data + 0x50c, - *reinterpret_cast(address + 0xb0) + 1); - const char** names = reinterpret_cast(data + 0x3c); - unsigned int index = 0; - int objectOffset = 0; - int nameIndex = 0; - do { - set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( - self, names[nameIndex], - index + *reinterpret_cast(address + 0xb0) * 5, index, - address + objectOffset + 0xe4, false); - index++; - nameIndex++; - objectOffset += 0x28; - } while (index < 5); - if (*reinterpret_cast(address + 0x84) == 0) { - *reinterpret_cast(address + 0xac) = 4; - } else { - *reinterpret_cast(address + 0xac) = 10; - } - } else if (*reinterpret_cast(address + 0x84) != 0) { - changePage_onDrag__Q33ipl5scene7AddressFv(self); - } -} - -extern "C" void stt_loop_forward__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - void* layout = *reinterpret_cast(address + 0x8c); - void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(layout) + 0x28c, 4); - if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { - nw4r::math::VEC2 offset(-sAddressVEC2.x, -sAddressVEC2.y); - ipl::math::VEC2 translate(offset); - nw4r::lyt::Pane* pane = static_cast(layout) - ->GetRootPane() - ->FindPaneByName(lbl_81647A61, true); - add_translate__Q33ipl5scene7AddressFPQ34nw4r3lyt4PaneRCQ33ipl4math4VEC2( - self, pane, translate); - set_page_text__Q33ipl5scene7AddressFPCci( - self, lbl_81647538 + 0x50c, - *reinterpret_cast(address + 0xb0) + 1); - reset_gui__Q33ipl5scene7AddressFb(self, false); - unsigned int friendIndex = 0; - int objectOffset = 0; - int nameOffset = 0; - char* names = lbl_81647538 + 0x3c; - do { - set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( - self, *reinterpret_cast(names + nameOffset), - friendIndex + *reinterpret_cast(address + 0xb0) * 5, - friendIndex, address + objectOffset + 0xe4, false); - friendIndex++; - nameOffset += 4; - objectOffset += 0x28; - } while (friendIndex < 5); - *reinterpret_cast(address + 0xe1) = 1; - *reinterpret_cast(address + 0xb4) = 0x14; - *reinterpret_cast(address + 0xac) = 1; - } else if (*reinterpret_cast(address + 0x84) != 0) { - changePage_onDrag__Q33ipl5scene7AddressFv(self); - } -} - -extern "C" void stt_loop_backward__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - void* layout = *reinterpret_cast(address + 0x8c); - void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(layout) + 0x28c, 4); - if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { - *reinterpret_cast(address + 0xe1) = 0; - *reinterpret_cast(address + 0xb8) = 0x13; - if (*reinterpret_cast(address + 0x84) == 0) { - *reinterpret_cast(address + 0xac) = 4; - } else { - *reinterpret_cast(address + 0xac) = 10; - } - } else if (*reinterpret_cast(address + 0x84) != 0) { - changePage_onDrag__Q33ipl5scene7AddressFv(self); - } -} - -extern "C" void stt_decide__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - ipl::utility::FrameController* animator = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, - *reinterpret_cast(address + 0xbc) + 0x10)); - if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { - animator = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, - *reinterpret_cast(address + 0xbc) + 0x1f)); - if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { - reset_gui__Q33ipl5scene7AddressFb(self, true); - int mode = *reinterpret_cast(address + 0x88); - if (mode != 0) { - if (mode < 0) { - goto stt_decide_done; - } - if (mode >= 3) { - goto stt_decide_done; - } - goto set_friend_info; + for (int i = 0; i < BTN_MAX; i++) { + mPointCount[i] = 0; } - { - createChildScene__Q33ipl5scene4BaseFiPQ33ipl5scene4BasePQ33ipl5scene4BasePv( - self, 0x17, self, NULL, NULL); - ipl::utility::FrameController* childAnimator = - static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x9c)) + 0x28c, - 0)); - childAnimator->play(); - *reinterpret_cast(address + 0xac) = 0xc; + + for (int i = 0; i < BTN_MAX; i++) { + mbFaceValid[i] = false; } - goto stt_decide_done; - set_friend_info: - { - ipl::scene::LetterWriter* letterWriter = - static_cast( - ipl::System::getScene(ipl::SCENE_LETTER_WRITER)); - letterWriter->setFriendInfo( - (*reinterpret_cast(address + 0x274)) - ->getInfo(*reinterpret_cast(address + 0xc0))); - animator = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, - 3)); - animator->play(); - animator = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0xa0)) + 0x28c, - 1)); - animator->play(); - *reinterpret_cast(address + 0xac) = 0x1a; + + memset(&mDrag, 0, sizeof(DragInfo)); + mDrag.mNextCount = -1; + mDrag.mPrevCount = -1; + } + + Address::~Address() { + if (mpFriendCache != NULL) { + delete mpFriendCache; } } - } -stt_decide_done: - return; -} -extern "C" void stt_release__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - static_cast(*reinterpret_cast(address + 0x98))->init(); - int counterOffset = 0; - int index = 0; - do { - if (*reinterpret_cast(address + index + 0xc4) != 0) { - ipl::layout::Animator* animator = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, - index + 6)); - animator->initAnmFrame(); - } else { - ipl::layout::Animator* animator = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, - index + 0x15)); - animator->initAnmFrame(); - } - *reinterpret_cast(address + counterOffset + 0xcc) = 0; - index++; - counterOffset += 4; - } while (index < 5); - ipl::layout::Object* layout = *reinterpret_cast(address + 0x8c); - SetVisible__Q34nw4r3lyt4PaneFb( - layout->GetRootPane()->FindPaneByName(lbl_81647982, true), false); - if (*reinterpret_cast(address + 0xe1) == 0) { - goto release_state_four; - } - *reinterpret_cast(address + 0xac) = 1; - goto release_state_done; -release_state_four: - *reinterpret_cast(address + 0xac) = 4; -release_state_done: - return; -} + void Address::prepare() {} -extern "C" void stt_wait_child_cst__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - if (self->getChild() != 0) { - ipl::layout::Object* layout = *reinterpret_cast(address + 0x9c); - void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(layout) + 0x28c, 0); - if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { - *reinterpret_cast(address + 0xac) = 13; - reset_gui__Q33ipl5scene7AddressFb(self, true); - for (int index = 0; index < 5; index++) { - *reinterpret_cast(address + 0xcc + index * 4) = 0; + void Address::create() { + nand::LayoutFile* layoutFile = static_cast(System::getScene(SCENE_BOARD))->getLayoutFile(); + + mbCover = true; + + // Main layout + mpLayout = new layout::Object(getSceneHeap(), layoutFile, "arc", "th_Adress_a.brlyt"); + mpLayout->bindToGroup("th_Adress_a_note_alp_in.brlan", "G_note_all", false, true); + mpLayout->bindToGroup("th_Adress_a_note_alp_out.brlan", "G_note_all", false, false); + mpLayout->bindToGroup("th_Adress_a_note_trns_in.brlan", "G_note_all", false, false); + mpLayout->bindToGroup("th_Adress_a_note_trns_out.brlan", "G_note_all", false, false); + mpLayout->bindToGroup("th_Adress_a_note_e_rtt.brlan", "G_note_e_rtt", false, mbCover); + mpLayout->bindToGroup("th_Adress_a_note_c_rtt.brlan", "note_c_rtt", false, !mbCover); + + for (int i = 0; i < BTN_MAX; i++) { + mpLayout->bindToGroup("th_Adress_a_name_in.brlan", sNameGroup[i], false, false); } - } - } -} - -extern "C" void stt_wait_child_dst__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - if (self->getChild() == 0 && ipl::System::getSceneManager()->getReservedScene() == 0) { - ipl::layout::Object* layout = *reinterpret_cast(address + 0x9c); - void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(layout) + 0x28c, 1); - initFrame__Q33ipl7utility15FrameControllerFv(animator); - *reinterpret_cast(reinterpret_cast(animator) + 0x14) = 1; - gui::EventHandler* event = reinterpret_cast(self); - if (event != 0) { - event = reinterpret_cast(address + 0x58); - } - static_cast(ipl::System::getScene(5))->setEventHandler(event, 0); - *reinterpret_cast(address + 0xac) = 0xe; - } -} - -extern "C" void stt_wait_child_fadeout__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - ipl::layout::Object* layout = *reinterpret_cast(address + 0x9c); - void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(layout) + 0x28c, 1); - if (*reinterpret_cast(reinterpret_cast(animator) + 0x14) != 1) { - ipl::scene::Button* button = static_cast(ipl::System::getScene(5)); - button->setText(lbl_81647A6D, 0x29); - button->animation(0x17); - button->animation(0x18); - if (*reinterpret_cast(address + 0xe1) != 0) { - *reinterpret_cast(address + 0xac) = 1; - } else { - *reinterpret_cast(address + 0xac) = 4; - } - } -} - -extern "C" void stt_msg_net__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - int dialogState = *reinterpret_cast( - reinterpret_cast(ipl::System::getDialog()) + 0x24); - if (dialogState == 2) { - goto msg_net_complete; - } - if (dialogState >= 2) { - goto msg_net_done; - } - if (dialogState >= 1) { - goto msg_net_parental; - } - goto msg_net_done; -msg_net_complete: - if (*reinterpret_cast(address + 0xe1) == 0) { - goto msg_net_complete_flag_zero; - } - *reinterpret_cast(address + 0xac) = 1; - goto msg_net_complete_state_done; -msg_net_complete_flag_zero: - *reinterpret_cast(address + 0xac) = 4; -msg_net_complete_state_done: - static_cast(ipl::System::getScene(5))->animation(0x17); - static_cast(ipl::System::getScene(5))->animation(0x18); - goto msg_net_done; -msg_net_parental: { - SCParentalControlsInfo parental; - if (SCGetParentalControl(&parental) == 0) { - goto msg_net_parental_disabled; - } - if ((parental.enable & SC_PARENTAL_FLAG_ENABLED) == 0) { - goto msg_net_parental_disabled; - } - static_cast(ipl::System::getScene(5))->setEventHandler(0, 0); - static_cast(ipl::System::getScene(5))->animation(0x10); - createChildScene__Q33ipl5scene4BaseFiPQ33ipl5scene4BasePQ33ipl5scene4BasePv( - self, 0x1b, self, 0, reinterpret_cast(1)); - *reinterpret_cast(address + 0xe0) = 0; - *reinterpret_cast(address + 0xac) = 0x10; - goto msg_net_done; -msg_net_parental_disabled: - ipl::System::getFader()->fadeOut(); - reserveAllSceneDestruction__Q33ipl5scene4BaseFiPv(self, 0x12, - reinterpret_cast(1)); - *reinterpret_cast(address + 0xac) = 0x1a; -} -msg_net_done: - return; -} - -extern "C" void stt_wait_parental__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - void* dialog = ipl::System::getScene(0x1b); - if (dialog != 0) { - int state = *reinterpret_cast(reinterpret_cast(dialog) + 0x70); - if (state == 1) { - goto parental_confirmed; - } - if (state < 1) { - goto parental_done; - } - if (state >= 4) { - goto parental_done; - } - goto parental_rejected; -parental_confirmed: - *reinterpret_cast(address + 0xe0) = 1; - *reinterpret_cast(address + 0xac) = 0x11; - goto parental_done; -parental_rejected: - *reinterpret_cast(address + 0xe0) = 0; - *reinterpret_cast(address + 0xac) = 0x11; - } -parental_done: - return; -} - -extern "C" void stt_wait_parental_dst__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - if (self->getChild() == 0) { - if (*reinterpret_cast(address + 0xe0) != 0) { - ipl::System::getFader()->fadeOut(); - reserveAllSceneDestruction__Q33ipl5scene4BaseFiPv(self, 0x12, - reinterpret_cast(1)); - *reinterpret_cast(address + 0xac) = 0x1a; - } else { - static_cast(ipl::System::getScene(5))->animation(0xf); - gui::EventHandler* event = reinterpret_cast(self); - if (event != 0) { - event = reinterpret_cast(address + 0x58); + for (int i = 0; i < BTN_MAX; i++) { + mpLayout->bindToGroup("th_Adress_a_name_out.brlan", sNameGroup[i], false, false); } - static_cast(ipl::System::getScene(5))->setEventHandler(event, 0); - if (*reinterpret_cast(address + 0xe1) != 0) { - *reinterpret_cast(address + 0xac) = 1; + for (int i = 0; i < BTN_MAX; i++) { + mpLayout->bindToGroup("th_Adress_a_name_psh.brlan", sNameGroup[i], false, false); + } + for (int i = 0; i < BTN_MAX; i++) { + mpLayout->bindToGroup("th_Adress_a_gry_name_in.brlan", sNameGroup[i], false, false); + } + for (int i = 0; i < BTN_MAX; i++) { + mpLayout->bindToGroup("th_Adress_a_gry_name_out.brlan", sNameGroup[i], false, false); + } + for (int i = 0; i < BTN_MAX; i++) { + mpLayout->bindToGroup("th_Adress_a_gry_name_psh.brlan", sNameGroup[i], false, false); + } + for (int i = 0; i < BTN_MAX; i++) { + mpLayout->bindToGroup("th_Adress_a_name_c_gry.brlan", sNameCGroup[i], false, false); + } + mpLayout->finishBinding(); + + // Background layout + mpBackLayout = new layout::Object(getSceneHeap(), layoutFile, "arc", "my_Back_a.brlyt"); + mpBackLayout->bind("my_Back_a_Apear.brlan", "Picture_00", false, true); + mpBackLayout->bind("my_Back_a_Lost.brlan", "Picture_00", false, false); + mpBackLayout->finishBinding(); + mpBackLayout->getAnim()->initAnmFrame(); + + // Dialog layout + mpDialogLayout = new layout::Object(getSceneHeap(), layoutFile, "arc", "my_Dialog_a.brlyt"); + mpDialogLayout->bind("my_Dialog_a_DialogIn.brlan", "N_Top", false, true); + mpDialogLayout->bind("my_Dialog_a_DialogOut.brlan", "N_Top", false, false); + mpDialogLayout->finishBinding(); + nw4r::lyt::TextBox* dialogText = nw4r::ut::DynamicCast(mpDialogLayout->FindPaneByName("T_Dialog")); + dialogText->SetString(System::getMessage(MESG_ADDRESS_CHOOSE), 0); + + // GUI + mpEvent = new AddressEvent(this); + mpGui = new gui::PaneManager(mpEvent, mpLayout->getDrawInfo(), NULL, NULL); + mpGui->setupScene(mpLayout); + mpGui->setAllComponentTriggerTarget(false); + for (int i = 0; i < BTN_MAX; i++) { + mpGui->setTriggerTarget(mpLayout->FindPaneByName(sButtonName[i]), true); + } + for (int i = 0; i < BTN_SPACE_MAX; i++) { + mpGui->setTriggerTarget(mpLayout->FindPaneByName(sButtonSpaceName[i]), true); + } + + // Mii panes + char miiName[16]; + for (int i = 0; i < BTN_MAX; i++) { + sprintf(miiName, "mii_b_%02d", i); + mMiiObj[i].init(mpLayout->FindPaneByName(miiName)); + } + char nextMiiName[16]; + for (int i = 0; i < BTN_MAX; i++) { + sprintf(nextMiiName, "mii_c_%02d", i); + mNextMiiObj[i].init(mpLayout->FindPaneByName(nextMiiName)); + } + + set_textbox("T_adrs_00", MESG_ADDRESS_TITLE); + set_textbox("T_wii_msg", MESG_ADDRESS_WII_ID); + + // Friend list + mpFriendCache = new (32) FriendListCache(); + if (mpFriendCache->init()) { + onInitFriendList(); + mFadeinState = FADEIN_STATE_FADEIN; } else { - *reinterpret_cast(address + 0xac) = 4; + mFadeinState = FADEIN_STATE_WAIT_OPEN; } - static_cast(ipl::System::getScene(5))->animation(0x17); - static_cast(ipl::System::getScene(5))->animation(0x18); - } - } -} -extern "C" void stt_msg_wc__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - int dialogState = *reinterpret_cast( - reinterpret_cast(ipl::System::getDialog()) + 0x24); - if (dialogState == 2) { - goto msg_wc_complete; - } - if (dialogState >= 2) { - goto msg_wc_done; - } - if (dialogState >= 1) { - goto msg_wc_parental; - } - goto msg_wc_done; -msg_wc_complete: - if (*reinterpret_cast(address + 0xe1) == 0) { - goto msg_wc_complete_flag_zero; - } - *reinterpret_cast(address + 0xac) = 1; - goto msg_wc_complete_state_done; -msg_wc_complete_flag_zero: - *reinterpret_cast(address + 0xac) = 4; -msg_wc_complete_state_done: - static_cast(ipl::System::getScene(5))->animation(0x17); - static_cast(ipl::System::getScene(5))->animation(0x18); - goto msg_wc_done; -msg_wc_parental: { - SCParentalControlsInfo parental; - if (SCGetParentalControl(&parental) == 0) { - goto msg_wc_parental_disabled; - } - if ((parental.enable & SC_PARENTAL_FLAG_ENABLED) == 0) { - goto msg_wc_parental_disabled; - } - static_cast(ipl::System::getScene(5))->setEventHandler(0, 0); - static_cast(ipl::System::getScene(5))->animation(0x10); - createChildScene__Q33ipl5scene4BaseFiPQ33ipl5scene4BasePQ33ipl5scene4BasePv( - self, 0x1b, self, 0, reinterpret_cast(1)); - *reinterpret_cast(address + 0xe0) = 0; - *reinterpret_cast(address + 0xac) = 0x13; - goto msg_wc_done; -msg_wc_parental_disabled: - ipl::System::getFader()->fadeOut(); - reserveAllSceneDestruction__Q33ipl5scene4BaseFiPv(self, 0x12, - reinterpret_cast(4)); - *reinterpret_cast(address + 0xac) = 0x1a; -} -msg_wc_done: - return; -} + mpWork = new u8[0x2D20]; -extern "C" void stt_wait_parental_wc__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - void* dialog = ipl::System::getScene(0x1b); - if (dialog != 0) { - int state = *reinterpret_cast(reinterpret_cast(dialog) + 0x70); - if (state == 1) { - goto parental_wc_confirmed; + mpLayout->FindPaneByName("N_note_move")->SetVisible(false); } - if (state < 1) { - goto parental_wc_done; - } - if (state >= 4) { - goto parental_wc_done; - } - goto parental_wc_rejected; -parental_wc_confirmed: - *reinterpret_cast(address + 0xe0) = 1; - *reinterpret_cast(address + 0xac) = 0x14; - goto parental_wc_done; -parental_wc_rejected: - *reinterpret_cast(address + 0xe0) = 0; - *reinterpret_cast(address + 0xac) = 0x14; - } -parental_wc_done: - return; -} -extern "C" void stt_wait_parental_dst_wc__Q33ipl5scene7AddressFv( - ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - if (self->getChild() == 0) { - if (*reinterpret_cast(address + 0xe0) != 0) { - ipl::System::getFader()->fadeOut(); - reserveAllSceneDestruction__Q33ipl5scene4BaseFiPv(self, 0x12, - reinterpret_cast(4)); - *reinterpret_cast(address + 0xac) = 0x1a; - } else { - static_cast(ipl::System::getScene(5))->animation(0xf); - gui::EventHandler* event = reinterpret_cast(self); - if (event != 0) { - event = reinterpret_cast(address + 0x58); - } - static_cast(ipl::System::getScene(5))->setEventHandler(event, 0); - if (*reinterpret_cast(address + 0xe1) != 0) { - *reinterpret_cast(address + 0xac) = 1; - } else { - *reinterpret_cast(address + 0xac) = 4; - } - static_cast(ipl::System::getScene(5))->animation(0x17); - static_cast(ipl::System::getScene(5))->animation(0x18); - } - } -} - -extern "C" void stt_msg_nwc24_error__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - int state = *reinterpret_cast(reinterpret_cast(ipl::System::getDialog()) + 0x24); - switch (state) { - case 1: - if (*reinterpret_cast(address + 0xe1) == 0) { - goto msg_nwc24_not_e1; - } - *reinterpret_cast(address + 0xac) = 1; - goto msg_nwc24_state_done; - msg_nwc24_not_e1: - *reinterpret_cast(address + 0xac) = 4; - msg_nwc24_state_done: - static_cast(ipl::System::getScene(5))->animation(0x17); - static_cast(ipl::System::getScene(5))->animation(0x18); - break; - } -} - -extern "C" void stt_msg_fi_full__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - int state = *reinterpret_cast(reinterpret_cast(ipl::System::getDialog()) + 0x24); - switch (state) { - case 1: - if (*reinterpret_cast(address + 0xe1) == 0) { - goto msg_fi_full_not_e1; - } - *reinterpret_cast(address + 0xac) = 1; - goto msg_fi_full_state_done; - msg_fi_full_not_e1: - *reinterpret_cast(address + 0xac) = 4; - msg_fi_full_state_done: - static_cast(ipl::System::getScene(5))->animation(0x17); - static_cast(ipl::System::getScene(5))->animation(0x18); - break; - } -} - -extern "C" void stt_msg_parental__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - int state = *reinterpret_cast(reinterpret_cast(ipl::System::getDialog()) + 0x24); - switch (state) { - case 1: - if (*reinterpret_cast(address + 0xe1) == 0) { - goto msg_parental_not_e1; - } - *reinterpret_cast(address + 0xac) = 1; - goto msg_parental_state_done; - msg_parental_not_e1: - *reinterpret_cast(address + 0xac) = 4; - msg_parental_state_done: - static_cast(ipl::System::getScene(5))->animation(0x17); - static_cast(ipl::System::getScene(5))->animation(0x18); - break; - } -} - -extern "C" void stt_msg_open_failure__Q33ipl5scene7AddressFv( - ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - int dialogState = - *reinterpret_cast(reinterpret_cast(ipl::System::getDialog()) + 0x24); - switch (dialogState) { - default: - goto open_failure_done; - case 1: { - ipl::scene::Button* button = - static_cast(ipl::System::getScene(5)); - ipl::scene::MailAddressSelect* mailAddressSelect = - static_cast(ipl::System::getScene(8)); - int mode = *reinterpret_cast(address + 0x88); - if (mode == 1) { - goto open_failure_mode_one; - } - if (mode >= 1) { - goto open_failure_positive; - } - if (mode >= 0) { - goto open_failure_mode_zero; - } - goto open_failure_finish; - open_failure_positive: - if (mode >= 3) { - goto open_failure_finish; - } - goto open_failure_mode_two; - open_failure_mode_zero: - if (mailAddressSelect != 0) { - mailAddressSelect->finishAddress(); - } - button->reserveAnm(0x10); - button->reserveAnm(0xb); - goto open_failure_finish; - open_failure_mode_one: - button->reserveAnm(0xc); - button->reserveAnm(0xb); - goto open_failure_finish; - open_failure_mode_two: - button->reserveAnm(0xc); - button->reserveText(0, 0x13b); - button->reserveText(1, 0x33); - button->reserveAnm(0xf); - open_failure_finish: - button->animation(0x19); - button->animation(0x1a); - *reinterpret_cast(address + 0xac) = 0x1a; - } - } -open_failure_done: - return; -} - -extern "C" void set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( - ipl::scene::Address* self, const char* paneName, unsigned int friendIndex, - unsigned int buttonIndex, void* miiObj, bool isDrag) { - bool showMii = false; - char* address = reinterpret_cast(self); - u16 emptyText[1]; - emptyText[0] = 0; - const wchar_t* text = reinterpret_cast(emptyText); - ipl::scene::FriendListCache* cache = - *reinterpret_cast(address + 0x274); - unsigned char* flags = reinterpret_cast(cache) + 0x7d00; - if (flags[friendIndex] != 0) { - const NWC24FriendInfo* info = &cache->getInfo(friendIndex); - text = reinterpret_cast(info->attr.name); - showMii = info->attr.status == 2; - if (*reinterpret_cast(address + 0x88) == 2) { - showMii = showMii & (info->attr.type == 1); - } - if (isDrag) { - if (showMii) { - ipl::layout::Animator* animator = - static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + - 0x28c, - static_cast(buttonIndex + 0x24))); - animator->initAnmFrame(lbl_816947D8); - } else { - ipl::layout::Animator* animator = - static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + - 0x28c, - static_cast(buttonIndex + 0x24))); - animator->initAnmFrame(lbl_816947E0); - } - } else { - if (showMii) { - ipl::layout::Animator* animator = - static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + - 0x28c, - static_cast(buttonIndex + 6))); - animator->initAnmFrame(); - } else { - ipl::layout::Animator* animator = - static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + - 0x28c, - static_cast(buttonIndex + 0x15))); - animator->initAnmFrame(); - } - *reinterpret_cast(address + buttonIndex + 0xc4) = showMii; - } - if (*reinterpret_cast(address + 0x84) == 0 || - friendIndex != static_cast( - *reinterpret_cast(address + 0x74) + - *reinterpret_cast(address + 0x70) * 5)) { - set__Q43ipl5scene7Address6MiiObjFUx(miiObj, info->attr.fdId); - } - } else { - if (isDrag) { - ipl::layout::Animator* animator = - static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, - static_cast(buttonIndex + 0x24))); - animator->initAnmFrame(lbl_816947D8); - } else { - *reinterpret_cast(address + buttonIndex + 0xc4) = 0; - ipl::layout::Animator* animator = - static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, - static_cast(buttonIndex + 0x15))); - animator->initAnmFrame(); - } - reset__Q43ipl5scene7Address6MiiObjFv(miiObj); - } - if (*reinterpret_cast(address + 0x84) == 0 || - friendIndex != static_cast( - *reinterpret_cast(address + 0x74) + - *reinterpret_cast(address + 0x70) * 5)) { - set_textbox__Q33ipl5scene7AddressFPCcPCw(self, paneName, text); - } else { - set_textbox__Q33ipl5scene7AddressFPCcPCw(self, paneName, L""); - reset__Q43ipl5scene7Address6MiiObjFv(miiObj); - } -} - -void ipl::scene::LetterWriter::setFriendInfo(const NWC24FriendInfo& info) { - mbToFriend = true; - mFriendInfo = info; -} - -extern "C" void stt_drag__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - update__Q33ipl3gui11PaneManagerFv(*reinterpret_cast(address + 0x98)); - if (*reinterpret_cast(address + 0xac) == 10) { - changePage_onDrag__Q33ipl5scene7AddressFv(self); - } -} - -void ipl::scene::Address::destroy() { - getFriendCache()->fin(); -} - -extern "C" asm void isValidId__Q33ipl5scene15FriendListCacheFRCUx() { - nofralloc - lis r3, smArg__Q23ipl6System@ha - addi r3, r3, smArg__Q23ipl6System@l - lbz r0, 0x2bc(r3) - cmpwi r0, 0 - beq isValidId_L1 - li r3, 0 - b isValidId_L2 -isValidId_L1: - lwz r3, 0x8c(r3) -isValidId_L2: - lwz r5, 0(r4) - lwz r6, 4(r4) - b checkUserId__Q33ipl5nwc247ManagerFUx -} - -extern "C" asm void getErrCode__Q33ipl5scene15FriendListCacheCFv() { - nofralloc - lis r3, smArg__Q23ipl6System@ha - addi r3, r3, smArg__Q23ipl6System@l - lbz r0, 0x2bc(r3) - cmpwi r0, 0 - beq getErrCode_L1 - li r3, 0 - b getErrCode_L2 -getErrCode_L1: - lwz r3, 0x8c(r3) -getErrCode_L2: - b getErrCode__Q33ipl5nwc247ManagerFv -} - -extern "C" asm void fin__Q33ipl5scene15FriendListCacheFv() { - nofralloc - addis r3, r3, 1 - lbz r0, -0x6288(r3) - cmpwi r0, 0 - beqlr - lis r3, smArg__Q23ipl6System@ha - addi r3, r3, smArg__Q23ipl6System@l - lbz r0, 0x2bc(r3) - cmpwi r0, 0 - beq fin_L1 - li r3, 0 - b fin_L2 -fin_L1: - lwz r3, 0x8c(r3) -fin_L2: - b close__Q33ipl5nwc247ManagerFv - blr -} - -extern "C" asm void del__Q33ipl5scene15FriendListCacheFUl() { - nofralloc - add r5, r3, r4 - li r0, 0 - stb r0, 0x7d00(r5) - lis r5, smArg__Q23ipl6System@ha - addi r5, r5, smArg__Q23ipl6System@l - lwz r6, 0x7d70(r3) - addi r0, r6, -1 - stw r0, 0x7d70(r3) - lbz r0, 0x2bc(r5) - cmpwi r0, 0 - beq del_L1 - li r3, 0 - b del_L2 -del_L1: - lwz r3, 0x8c(r5) -del_L2: - b deleteFriendInfo__Q33ipl5nwc247ManagerFUl -} - -extern "C" asm void initCalcFadeout__Q33ipl5scene7AddressFv() { - nofralloc - stwu r1, -0x10(r1) - mflr r0 - lis r3, smArg__Q23ipl6System@ha - li r4, 5 - stw r0, 0x14(r1) - addi r3, r3, smArg__Q23ipl6System@l - lwz r3, 0x64(r3) - bl getScene__Q33ipl5scene7ManagerFi - li r4, 0 - li r5, 0 - bl setEventHandler__Q33ipl5scene6ButtonFPQ23gui12EventHandlerPQ23gui12EventHandler - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr -} - -extern "C" ipl::scene::FaderSceneCommand calcFadeout__Q33ipl5scene7AddressFv( - ipl::scene::Address* self) { - bool animationsStopped; - int result; - if (ipl::System::getFader()->getStatus() == EGG::Fader::PREPARE_OUT) { - result = 0; - animationsStopped = false; - if (*reinterpret_cast(static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(reinterpret_cast(self) + 0x8c)) + - 0x28c, - 1)) + - 0x14) != 1 && - *reinterpret_cast(static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(reinterpret_cast(self) + 0x8c)) + - 0x28c, - 3)) + - 0x14) != 1) { - animationsStopped = true; - } - if (animationsStopped && - *reinterpret_cast(static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(reinterpret_cast(self) + 0xa0)) + - 0x28c, - 1)) + - 0x14) != 1) { - result = 1; - } - } else { - result = ipl::System::getFader()->getStatus() == EGG::Fader::PREPARE_IN; - } - return static_cast(result); -} - -extern "C" asm void calcCommonAfter__Q33ipl5scene7AddressFv() { - nofralloc - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r3 - lwz r3, 0x8c(r3) - bl calc__Q33ipl6layout6ObjectFv - lwz r3, 0x9c(r31) - bl calc__Q33ipl6layout6ObjectFv - lwz r3, 0xa0(r31) - bl calc__Q33ipl6layout6ObjectFv - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - mtlr r0 - addi r1, r1, 0x10 - blr -} - -void ipl::scene::Address::draw() { - char* stringPool = lbl_81647538; - int drawLayer = *reinterpret_cast( - reinterpret_cast(ipl::System::getSceneManager()) + 0x100); - if (drawLayer == ipl::scene::DRAW_LAYER_2) { - ipl::utility::Graphics::setOrtho(0); - nw4r::lyt::Pane* pane = mLayout->getNW4RLyt()->GetRootPane()->FindPaneByName( - stringPool + 0x4d4, true); - for (int index = mPageCount; index >= 1; index--) { - ipl::math::VEC2 translate; - translate.y = sAddressVEC2.y * static_cast(index); - translate.x = sAddressVEC2.x * static_cast(index); - nw4r::math::VEC2 paneTranslate(reinterpret_cast(&translate)); - SetTranslate__Q34nw4r3lyt4PaneFRCQ34nw4r4math4VEC2(pane, &paneTranslate); - pane->CalculateMtx(*mLayout->getDrawInfo()); - mLayout->draw(pane); - } - mLayout->draw(stringPool + 0x4dd); - if (static_cast(mState - 5) <= 1) { - mLayout->draw(stringPool + 0x4e6); - } - int startIndex = 0; - int state = mState; - if (state == 4) { - goto start_index_done; - } - if (state < 4) { - if (state >= 2) { - goto start_index_set; - } - goto start_index_done; - } - if (state >= 7) { - goto start_index_done; - } - start_index_set: - startIndex = 1; - start_index_done: - pane = mLayout->getNW4RLyt()->GetRootPane()->FindPaneByName(stringPool + 0x4ef, true); - for (int index = startIndex; index < mFriendCount + startIndex; - index++) { - ipl::math::VEC2 translate = sAddressVEC2 * static_cast(-index); - SetTranslate__Q34nw4r3lyt4PaneFRCQ34nw4r4math4VEC2(pane, &translate); - pane->CalculateMtx(*mLayout->getDrawInfo()); - mLayout->draw(pane); - } - pane = mLayout->getNW4RLyt()->GetRootPane()->FindPaneByName(stringPool + 0x4f8, true); - state = mState; - if (state >= 9) { - goto draw_last_pane; - } - if (state >= 7) { - goto draw_repeated_panes; - } - goto draw_last_pane; - draw_repeated_panes: - for (int index = 1; index < 20; index++) { - pane->SetTranslate(sAddressVEC2 * static_cast(-index)); - pane->CalculateMtx(*mLayout->getDrawInfo()); - mLayout->draw(pane); - } - goto draw_panes_done; - draw_last_pane: - pane->SetTranslate(sAddressVEC2 * static_cast( - -(mFriendCount + startIndex))); - pane->CalculateMtx(*mLayout->getDrawInfo()); - mLayout->draw(stringPool + 0x4f8); - draw_panes_done: - mPaneLayout->draw(); - mCursorLayout->draw(); - } else if (drawLayer == ipl::scene::DRAW_LAYER_3) { - ipl::utility::Graphics::setOrtho(0); - int state = mState; - if (state == 9) { - goto no_text; - } - if (state < 9) { - if (state == 4) { - goto no_text; - } - if (state >= 4) { - goto draw_text; - } - if (state >= 1) { - goto draw_text; - } - goto no_text; - } - if (state >= 11) { - goto no_text; - } - draw_text: - mLayout->draw(stringPool + 0x44a); - no_text:; - } -} - -extern "C" asm void __ct__Q43ipl5scene7Address6MiiObjFv() { - nofralloc - li r0, 0 - stw r0, 0x20(r3) - blr -} - -extern "C" asm void __dt__Q43ipl5scene7Address6MiiObjFv() { - stwu r1, -0x10(r1) - mflr r0 - cmpwi r3, 0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r4 - stw r30, 8(r1) - mr r30, r3 - beq miio_dt_done - lwz r3, 0x20(r3) - cmpwi r3, 0 - beq miio_dt_skip_object - li r4, 1 - bl __dt__Q33ipl6nigaoe6ObjectFv -miio_dt_skip_object: - cmpwi r31, 0 - ble miio_dt_done - mr r3, r30 - bl __dl__FPv -miio_dt_done: - mr r3, r30 - lwz r31, 0xc(r1) - lwz r30, 8(r1) - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr -} - -extern "C" asm void init__Q43ipl5scene7Address6MiiObjFPQ34nw4r3lyt4Pane( - void*, nw4r::lyt::Pane*) { - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r3 - mr r3, r4 - lwz r12, 0(r4) - lwz r12, 0x5c(r12) - mtctr r12 - bctrl - stw r3, 0x24(r31) - mr r4, r31 - li r5, 0 - bl GetTexture__Q34nw4r3lyt8MaterialCFP9_GXTexObjUc - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - mtlr r0 - addi r1, r1, 0x10 - blr -} - -extern "C" asm void reset__Q43ipl5scene7Address6MiiObjFv(void* self) { - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r3 - lwz r0, 0x20(r3) - cmpwi r0, 0 - beq miio_reset_done - lwz r3, 0x24(r3) - mr r5, r31 - li r4, 0 - bl SetTexture__Q34nw4r3lyt8MaterialFUcRC9_GXTexObj - lwz r3, 0x20(r31) - li r4, 1 - bl __dt__Q33ipl6nigaoe6ObjectFv - li r0, 0 - stw r0, 0x20(r31) -miio_reset_done: - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - mtlr r0 - addi r1, r1, 0x10 - blr -} - -extern "C" asm void create_callback__Q43ipl5scene7Address6MiiObjFPQ33ipl6nigaoe6ObjectPv() { - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r4 - stw r30, 8(r1) - mr r30, r3 - lwz r0, 0x20(r4) - cmpwi r0, 0 - beq miio_create_store - mr r3, r0 - li r4, 1 - bl __dt__Q33ipl6nigaoe6ObjectFv -miio_create_store: - stw r30, 0x20(r31) - addi r5, r30, 0x18 - lwz r3, 0x24(r31) - li r4, 0 - bl SetTexture__Q34nw4r3lyt8MaterialFUcRC9_GXTexObj - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - lwz r30, 8(r1) - mtlr r0 - addi r1, r1, 0x10 - blr -} - -extern "C" asm void set__Q43ipl5scene7Address6MiiObjFUx(void* self, - unsigned long long id) { - stwu r1, -0x30(r1) - mflr r0 - stw r0, 0x34(r1) - addi r4, r1, 8 - stw r31, 0x2c(r1) - mr r31, r3 - addi r3, r1, 0x12 - stw r5, 8(r1) - li r5, 8 - stw r6, 0xc(r1) - bl memcpy - addi r3, r1, 0x12 - addi r4, r1, 0x10 - bl RFLSearchOfficialData - cmpwi r3, 0 - beq miio_set_reset - lis r4, smArg__Q23ipl6System@ha - lis r8, create_callback__Q43ipl5scene7Address6MiiObjFPQ33ipl6nigaoe6ObjectPv@ha - addi r4, r4, smArg__Q23ipl6System@l - lha r7, 0x10(r1) - lwz r3, 0x70(r4) - mr r9, r31 - lwz r4, 0x28(r4) - addi r8, r8, create_callback__Q43ipl5scene7Address6MiiObjFPQ33ipl6nigaoe6ObjectPv@l - li r5, 0x4c - li r6, 0x4c - bl create__Q33ipl6nigaoe7ManagerFPQ23EGG4HeapiiiPFPQ33ipl6nigaoe6ObjectPvPv - b miio_set_done -miio_set_reset: - mr r3, r31 - bl reset__Q43ipl5scene7Address6MiiObjFv -miio_set_done: - lwz r0, 0x34(r1) - lwz r31, 0x2c(r1) - mtlr r0 - addi r1, r1, 0x30 - blr -} - -extern "C" int get_button_no__Q33ipl5scene7AddressFPCc(void*, const char* paneName) { - int result = -1; - for (int i = 0; i < 5; i++) { - if (strcmp(lbl_81647614[i], paneName) == 0) { - result = i; - break; - } - } - return result; -} - -extern "C" int get_button_space_no__Q33ipl5scene7AddressFPCc(void*, const char* paneName) { - int result = -1; - for (int i = 0; i < 4; i++) { - if (strcmp(lbl_81647664[i], paneName) == 0) { - result = i; - break; - } - } - return result; -} - -extern "C" void reset_gui__Q33ipl5scene7AddressFb(ipl::scene::Address* self, bool reset) { - static_cast( - *reinterpret_cast(reinterpret_cast(self) + 0x98))->init(); - int friendOffset = 0; - int animationIndex = 0; - do { - ipl::layout::Animator* animator = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(*reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 6)); - animator->initAnmFrame(); - static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(*reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 6)) - ->calc(); - - animator = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(*reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0xb)); - animator->initAnmFrame(); - static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(*reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0xb)) - ->calc(); - - animator = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(*reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0x10)); - animator->initAnmFrame(); - static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0x10))->calc(); - - animator = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(*reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0x15)); - animator->initAnmFrame(); - static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0x15))->calc(); - - animator = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(*reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0x1a)); - animator->initAnmFrame(); - static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0x1a))->calc(); - - animator = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs(*reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0x1f)); - animator->initAnmFrame(); - static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, animationIndex + 0x1f))->calc(); - - char* friendData = reinterpret_cast(self) + friendOffset; - if (*reinterpret_cast(friendData + 0xcc) != 0 && reset) { - if (*reinterpret_cast(reinterpret_cast(self) + animationIndex + 0xc4) != 0) { - ipl::utility::FrameController* frame = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, - animationIndex + 0xb)); - frame->initFrame(); - frame->restart(); - } else { - ipl::utility::FrameController* frame = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, - animationIndex + 0x1a)); - frame->initFrame(); - frame->restart(); - } - } else { - if (*reinterpret_cast(reinterpret_cast(self) + animationIndex + 0xc4) != 0) { - animator = static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, - animationIndex + 6)); - animator->initAnmFrame(); - static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, - animationIndex + 6))->calc(); - } else { - animator = static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, - animationIndex + 0x15)); - animator->initAnmFrame(); - static_cast(List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - *reinterpret_cast(reinterpret_cast(self) + 0x8c) + 0x28c, - animationIndex + 0x15))->calc(); - } - } - animationIndex++; - *reinterpret_cast(friendData + 0xcc) = 0; - friendOffset += 4; - } while (animationIndex < 5); -} - -extern "C" bool isReleasableArea__Q33ipl5scene7AddressFii(ipl::scene::Address* self, int page, - int index) { - char* address = reinterpret_cast(self); - if (page < 0 || page >= 20) { - return false; - } - if (reinterpret_cast(address)[0xe1] != 0) { - return false; - } - if (index < 0) { - goto address_invalid; - } - if (index < 5) { - goto address_valid; - } -address_invalid: - return false; -address_valid: - if (page == *reinterpret_cast(address + 0x70) && - index == *reinterpret_cast(address + 0x74)) { - return true; - } - unsigned char* cachedFriends = - *reinterpret_cast(address + 0x274); - if (cachedFriends[index + page * 5 + 32000] != 0) { - return false; - } - return static_cast(address[0x84]) == 1; -} - -extern "C" unsigned int is_selectable__Q33ipl5scene7AddressFUl(ipl::scene::Address* self, - unsigned int index) { - char* address = reinterpret_cast(self); - int mode = *reinterpret_cast(address + 0x88); - if (mode == 1) { - goto selectable_mode_one; - } - if (mode < 1) { - if (mode >= 0) { - goto selectable_mode_zero; - } - goto selectable_invalid; - } - if (mode >= 3) { - goto selectable_invalid; - } - goto selectable_mode_two; -selectable_mode_zero: - { - unsigned char* friends = *reinterpret_cast(address + 0x274); - return *(friends + index + 32000); - } -selectable_mode_one: - { - unsigned char* friends = *reinterpret_cast(address + 0x274); - if (*(friends + index + 32000) != 0) { - int* info = reinterpret_cast(friends + index * 0x140); - return static_cast(__cntlzw(info[1] - 2)) >> 5; - } - return 0; - } -selectable_mode_two: - { - unsigned char* friends = *reinterpret_cast(address + 0x274); - if (*(friends + index + 32000) != 0) { - unsigned int* info = reinterpret_cast(friends + index * 0x140); - unsigned int result = 0; - if (info[1] == 2U) { - if (info[0] == 1U) { - result = 1; + FaderSceneCommand Address::calcFadein() { + switch (mFadeinState) { + case FADEIN_STATE_WAIT_OPEN: { + fistt_wait_open(); + break; + } + case FADEIN_STATE_FADEIN: { + fistt_fadein(); + break; } } - return result; + + return mFadeinState == FADEIN_STATE_DONE ? FADER_SCN_NEXT : FADER_SCN_CONTINUE; } - return 0; - } -selectable_invalid: - return 0; -} -extern "C" void onEventDerived__Q33ipl5scene7AddressFUlUlPCQ33ipl10controller9Interface( - ipl::scene::Address* self, unsigned int componentId, int event, - const ipl::controller::Interface* controller) { - char* address = reinterpret_cast(self); - gui::Manager* manager = *reinterpret_cast(address + 0x5c); - gui::Component* component = manager->getComponent(componentId); - const char* paneName = - static_cast(component)->getPane()->GetName(); - - if (event == 1) { - goto address_drag_event; - } - if (event < 1) { - if (event >= 0) { - goto address_trig_event; + void Address::initCalcNormal() { + static_cast(System::getScene(SCENE_BUTTON))->setEventHandler(this); } - goto address_event_done; - } - if (event >= 3) { - goto address_event_done; - } - goto address_clear_drag; -address_trig_event: - if (controller == NULL) { - goto address_event_done; - } - if (!controller->downTrg(0x00100800)) { - goto address_drag_event; - } - ipl::scene::Button* button = - static_cast(ipl::System::getScene(5)); - int state = *reinterpret_cast(address + 0xac); - if (state == 1 || state == 4) { - if (ipl::scene::Button::cmpButtonName(paneName, 5) == 0) { - ipl::scene::MailAddressSelect* mail = - static_cast(ipl::System::getScene(8)); - button->animation(0x1b); - int mode = *reinterpret_cast(address + 0x88); - ipl::utility::FrameController* frameZero; - ipl::utility::FrameController* frameMain; - if (mode == 1) { - goto address_mode_one; + FaderSceneCommand Address::calcNormal() { + switch (mState) { + case STATE_INIT: { + snd::getSystem()->startSE("WIPL_SE_FL_PAGE_INC"); + onNextPage(); + break; } - if (mode >= 1) { - goto address_mode_two_check; + case STATE_COVER_NORMAL: { + stt_cover_normal(); + break; } - if (mode >= 0) { - goto address_mode_zero; + case STATE_COVER_FORWARD: { + stt_cover_forward(); + break; } - goto address_mode_common; - -address_mode_two_check: - if (mode >= 3) { - goto address_mode_common; + case STATE_COVER_BACKWARD: { + stt_cover_backward(); + break; } - goto address_mode_two; - -address_mode_zero: - if (mail != NULL) { - mail->finishAddress(); + case STATE_NORMAL: { + stt_normal(); + break; + } + case STATE_FORWARD: { + stt_forward(); + break; + } + case STATE_BACKWARD: { + stt_backward(); + break; + } + case STATE_LOOP_FORWARD: { + stt_loop_forward(); + break; + } + case STATE_LOOP_BACKWARD: { + stt_loop_backward(); + break; + } + case STATE_DECIDE: { + stt_decide(); + break; + } + case STATE_DRAG: { + stt_drag(); + break; + } + case STATE_RELEASE: { + stt_release(); + break; + } + case STATE_WAIT_CHILD_CST: { + stt_wait_child_cst(); + break; + } + case STATE_WAIT_CHILD_DST: { + stt_wait_child_dst(); + break; + } + case STATE_WAIT_CHILD_FADEOUT: { + stt_wait_child_fadeout(); + break; + } + case STATE_MSG_NET: { + stt_msg_net(); + break; + } + case STATE_WAIT_PARENTAL: { + stt_wait_parental(); + break; + } + case STATE_WAIT_PARENTAL_DST: { + stt_wait_parental_dst(); + break; + } + case STATE_MSG_WC: { + stt_msg_wc(); + break; + } + case STATE_WAIT_PARENTAL_WC: { + stt_wait_parental_wc(); + break; + } + case STATE_WAIT_PARENTAL_DST_WC: { + stt_wait_parental_dst_wc(); + break; + } + case STATE_MSG_NWC24_ERROR: { + stt_msg_nwc24_error(); + break; + } + case STATE_MSG_FI_FULL: { + stt_msg_fi_full(); + break; + } + case STATE_MSG_PARENTAL: { + stt_msg_parental(); + break; + } + case STATE_MSG_OPEN_FAILURE: { + stt_msg_open_failure(); + break; + } + case STATE_WAIT_DIALOG: { + stt_wait_dialog(); + break; } - frameZero = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + - 0x28c, - 1)); - frameZero->initFrame(); - *reinterpret_cast(reinterpret_cast(frameZero) + 0x14) = 1; - button->reserveAnm(0x10); - button->reserveAnm(0xb); - goto address_mode_common; - -address_mode_one: - frameMain = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + - 0x28c, - 3)); - frameMain->initFrame(); - *reinterpret_cast(reinterpret_cast(frameMain) + 0x14) = 1; - frameMain = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0xa0)) + - 0x28c, - 1)); - frameMain->initFrame(); - *reinterpret_cast(reinterpret_cast(frameMain) + 0x14) = 1; - button->reserveAnm(0xc); - button->reserveAnm(0xb); - goto address_mode_common; - -address_mode_two: - frameMain = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + - 0x28c, - 3)); - frameMain->initFrame(); - *reinterpret_cast(reinterpret_cast(frameMain) + 0x14) = 1; - frameMain = static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0xa0)) + - 0x28c, - 1)); - frameMain->initFrame(); - *reinterpret_cast(reinterpret_cast(frameMain) + 0x14) = 1; - button->reserveAnm(0xc); - button->reserveText(0, 0x13b); - button->reserveText(1, 0x33); - button->reserveAnm(0xf); - -address_mode_common: - button->animation(0x19); - button->animation(0x1a); - ipl::snd::sSystem.startSE(lbl_81647538 + 0x5a1); - *reinterpret_cast(address + 0xac) = 0x1a; - } else if (ipl::scene::Button::cmpButtonName(paneName, 7) == 0) { - *reinterpret_cast(address + 0xc0) = -1; - entry_friend__Q33ipl5scene7AddressFv(self); - } else if (ipl::scene::Button::cmpButtonName(paneName, 9) == 0) { - button->animation(0x13); - ipl::snd::sSystem.startSE(lbl_8164798E); - onNextPage__Q33ipl5scene7AddressFv(self); - } else if (ipl::scene::Button::cmpButtonName(paneName, 10) == 0) { - button->animation(0x14); - ipl::snd::sSystem.startSE(lbl_81647A4D); - onPreviousPage__Q33ipl5scene7AddressFv(self); } + + return mState == STATE_DONE ? FADER_SCN_NEXT : FADER_SCN_CONTINUE; } -address_drag_event: - if (*reinterpret_cast(address + 0x84) != 0 && - (controller == NULL || - controller == ipl::System::getControllerManager()->getController( - *reinterpret_cast(address + 0x6c)))) { - if (ipl::scene::Button::cmpButtonName(paneName, 10) == 0) { - if (*reinterpret_cast(address + 0x7c) < 0) { - *reinterpret_cast(address + 0x7c) = 0; - } - } else if (ipl::scene::Button::cmpButtonName(paneName, 9) == 0 && - *reinterpret_cast(address + 0x78) < 0) { - *reinterpret_cast(address + 0x78) = 0; + void Address::initCalcFadeout() { + static_cast(System::getScene(SCENE_BUTTON))->setEventHandler(NULL); } - } - goto address_event_done; -address_clear_drag: - if (*reinterpret_cast(address + 0x84) != 0 && - (controller == NULL || - controller == ipl::System::getControllerManager()->getController( - *reinterpret_cast(address + 0x6c)))) { - if (ipl::scene::Button::cmpButtonName(paneName, 10) == 0) { - *reinterpret_cast(address + 0x7c) = -1; - } else if (ipl::scene::Button::cmpButtonName(paneName, 9) == 0) { - *reinterpret_cast(address + 0x78) = -1; - } - } + FaderSceneCommand Address::calcFadeout() { + BOOL bAnimDone; + BOOL ret; -address_event_done: - return; -} + if (System::getFader()->getStatus() == EGG::Fader::PREPARE_OUT) { + ret = FALSE; -extern "C" void onNextPage__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - char* dataBase = lbl_81647538; - int state = *reinterpret_cast(address + 0xac); - if (state != 4) { - if (state < 4) { - if (state >= 2) { - goto on_next_page_done; - } - if (state >= 0) { - goto on_next_page_first; - } - goto on_next_page_done; - } - if (state == 10) { - goto on_next_page_normal; - } - goto on_next_page_done; - } + bAnimDone = FALSE; + if (!mpLayout->getAnim(1)->isPlaying() && !mpLayout->getAnim(3)->isPlaying()) { + bAnimDone = TRUE; + } -on_next_page_normal: - if (*reinterpret_cast(address + 0xb0) < 0x13) { - *reinterpret_cast(address + 0xb0) += 1; - *reinterpret_cast(address + 0xb4) -= 1; - nw4r::lyt::Pane* pane = - static_cast(*reinterpret_cast(address + 0x8c)) - ->GetRootPane() - ->FindPaneByName(dataBase + 0x529, true); - add_translate__Q33ipl5scene7AddressFPQ34nw4r3lyt4PaneRCQ33ipl4math4VEC2( - self, pane, sAddressVEC2); - void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 5); - *reinterpret_cast(reinterpret_cast(animator) + 0x18) = 0; - animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 5); - initFrame__Q33ipl7utility15FrameControllerFv(animator); - *reinterpret_cast(reinterpret_cast(animator) + 0x14) = 1; - set_page_text__Q33ipl5scene7AddressFPCci( - self, dataBase + 0x50c, *reinterpret_cast(address + 0xb0) + 1); - set_page_text__Q33ipl5scene7AddressFPCci( - self, dataBase + 0x5b0, *reinterpret_cast(address + 0xb0)); - reset_gui__Q33ipl5scene7AddressFb(self, false); - - unsigned int index = 0; - const char* const* names = reinterpret_cast(dataBase + 0x3c); - const char* const* otherNames = reinterpret_cast(dataBase + 0x8c); - int objectOffset = 0; - do { - set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( - self, names[index], - index + *reinterpret_cast(address + 0xb0) * 5, index, - address + objectOffset + 0xe4, false); - set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( - self, otherNames[index], - index + (*reinterpret_cast(address + 0xb0) - 1) * 5, index, - address + objectOffset + 0x1ac, true); - index++; - objectOffset += 0x28; - } while (index < 5); - *reinterpret_cast(address + 0xac) = 5; - } else { - *reinterpret_cast(address + 0xb0) = 0; - *reinterpret_cast(address + 0xb8) = 0; - *reinterpret_cast(address + 0xe1) = 1; - void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); - *reinterpret_cast(reinterpret_cast(animator) + 0x18) = 1; - animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); - initFrame__Q33ipl7utility15FrameControllerFv(animator); - *reinterpret_cast(reinterpret_cast(animator) + 0x14) = 1; - reset_gui__Q33ipl5scene7AddressFb(self, true); - *reinterpret_cast(address + 0xac) = 7; - } - - goto on_next_page_done; - -on_next_page_first: - *reinterpret_cast(address + 0xb4) -= 1; - nw4r::lyt::Pane* pane = - static_cast(*reinterpret_cast(address + 0x8c)) - ->GetRootPane() - ->FindPaneByName(dataBase + 0x529, true); - add_translate__Q33ipl5scene7AddressFPQ34nw4r3lyt4PaneRCQ33ipl4math4VEC2( - self, pane, sAddressVEC2); - void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); - *reinterpret_cast(reinterpret_cast(animator) + 0x18) = 0; - animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); - initFrame__Q33ipl7utility15FrameControllerFv(animator); - *reinterpret_cast(reinterpret_cast(animator) + 0x14) = 1; - reset_gui__Q33ipl5scene7AddressFb(self, true); - - unsigned int index = 0; - const char* const* names = reinterpret_cast(dataBase + 0x3c); - int objectOffset = 0; - do { - set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( - self, names[index], - index + *reinterpret_cast(address + 0xb0) * 5, index, - address + objectOffset + 0xe4, false); - index++; - objectOffset += 0x28; - } while (index < 5); - *reinterpret_cast(address + 0xac) = 2; - -on_next_page_done: - return; -} - -extern "C" void onPreviousPage__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* dataBase = lbl_81647538; - char* address = reinterpret_cast(self); - int state = *reinterpret_cast(address + 0xac); - if (state != 4) { - if (state < 4) { - if (state == 1) { - goto on_previous_page_wrap; - } - goto on_previous_page_done; - } - if (state != 10) { - goto on_previous_page_done; - } - } - - if (*reinterpret_cast(address + 0xb0) < 1) { - void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); - *reinterpret_cast(reinterpret_cast(animator) + 0x18) = 1; - animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); - initFrame__Q33ipl7utility15FrameControllerFv(animator); - *reinterpret_cast(reinterpret_cast(animator) + 0x14) = 1; - reset_gui__Q33ipl5scene7AddressFb(self, true); - *reinterpret_cast(address + 0xac) = 3; - } else { - *reinterpret_cast(address + 0xb0) -= 1; - *reinterpret_cast(address + 0xb8) -= 1; - void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 5); - *reinterpret_cast(reinterpret_cast(animator) + 0x18) = 1; - animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 5); - initFrame__Q33ipl7utility15FrameControllerFv(animator); - *reinterpret_cast(reinterpret_cast(animator) + 0x14) = 1; - set_page_text__Q33ipl5scene7AddressFPCci( - self, dataBase + 0x5b0, *reinterpret_cast(address + 0xb0) + 1); - reset_gui__Q33ipl5scene7AddressFb(self, true); - - unsigned int index = 0; - const char* const* names = reinterpret_cast(dataBase + 0x8c); - int objectOffset = 0; - do { - set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( - self, names[index], - index + *reinterpret_cast(address + 0xb0) * 5, index, - address + objectOffset + 0x1ac, true); - index++; - objectOffset += 0x28; - } while (index < 5); - *reinterpret_cast(address + 0xac) = 6; - } - goto on_previous_page_done; - -on_previous_page_wrap: - *reinterpret_cast(address + 0xb0) = 0x13; - *reinterpret_cast(address + 0xb4) = 0; - *reinterpret_cast(address + 0xe1) = 0; - float scale = lbl_816947DC; - float* axes = &lbl_81698B50; - nw4r::math::_VEC2 rawOffset; - rawOffset.y = axes[1] * scale; - rawOffset.x = axes[0] * scale; - ipl::math::VEC2 offset(rawOffset); - nw4r::lyt::Pane* pane = - static_cast(*reinterpret_cast(address + 0x8c)) - ->GetRootPane() - ->FindPaneByName(dataBase + 0x529, true); - add_translate__Q33ipl5scene7AddressFPQ34nw4r3lyt4PaneRCQ33ipl4math4VEC2(self, pane, offset); - void* animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); - *reinterpret_cast(reinterpret_cast(animator) + 0x18) = 0; - animator = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(*reinterpret_cast(address + 0x8c)) + 0x28c, 4); - initFrame__Q33ipl7utility15FrameControllerFv(animator); - *reinterpret_cast(reinterpret_cast(animator) + 0x14) = 1; - set_page_text__Q33ipl5scene7AddressFPCci( - self, dataBase + 0x50c, *reinterpret_cast(address + 0xb0) + 1); - reset_gui__Q33ipl5scene7AddressFb(self, false); - - unsigned int index = 0; - const char* const* names = reinterpret_cast(dataBase + 0x3c); - int objectOffset = 0; - do { - set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( - self, names[index], - index + *reinterpret_cast(address + 0xb0) * 5, index, - address + objectOffset + 0xe4, false); - index++; - objectOffset += 0x28; - } while (index < 5); - *reinterpret_cast(address + 0xac) = 8; - -on_previous_page_done: - return; -} - -extern "C" void set_err_msg__Q33ipl5scene7AddressFPwUl8NWC24Err( - ipl::scene::Address*, wchar_t* outErrMsg, unsigned int outErrMsgLen, int nwc24Err) { - memset(outErrMsg, 0, outErrMsgLen * sizeof(wchar_t)); - const wchar_t* message = ipl::System::getMessage(400); - wcsncat(outErrMsg, message, outErrMsgLen - wcslen(outErrMsg)); - - wchar_t nwc24ErrStr[32]; - memset(nwc24ErrStr, 0, sizeof(nwc24ErrStr)); - swprintf(nwc24ErrStr, sizeof(nwc24ErrStr) / sizeof(wchar_t), lbl_81647AF2, - ipl::System::getNwc24Manager()->getErrCode()); - wcsncat(outErrMsg, nwc24ErrStr, outErrMsgLen - wcslen(outErrMsg)); - - unsigned int errMsgId = 400; - if (nwc24Err == -31) { - errMsgId = 0x19a; - } else if (nwc24Err < -31) { - if (nwc24Err >= -32) { - errMsgId = 0x1c5; - } - } else if (nwc24Err == -6) { - errMsgId = 0x1c5; - } - wcsncat(outErrMsg, ipl::System::getMessage(errMsgId), - outErrMsgLen - wcslen(outErrMsg)); -} - -extern "C" void entry_friend__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - if (*reinterpret_cast(address + 0x88) == 0) { - ipl::scene::Button* button = - static_cast(ipl::System::getScene(5)); - SCParentalControlsInfo parental; - BOOL parentalInfoAvailable = SCGetParentalControl(&parental); - unsigned int registeredFriendCount = - *reinterpret_cast( - *reinterpret_cast(address + 0x274) + 0x7d70); - ipl::snd::sSystem.startSE(lbl_81647A78); - if (*reinterpret_cast(address + 0xc0) == 0xffffffffU) { - button->animation(0x1d); - } - if (!ipl::ncd::NCDSetting::getConnectEnableFlag()) { - ipl::System::getDialog()->callBtn2(0x145, 0x146, 0x25, false); - *reinterpret_cast(address + 0xac) = 0xf; - } else if ((SCGetWCFlags() & 1) == 0) { - ipl::System::getDialog()->callBtn2(0x17e, 0x146, 0x25, false); - *reinterpret_cast(address + 0xac) = 0x12; - } else if (parentalInfoAvailable && (parental.enable & SC_PARENTAL_FLAG_ENABLED) && - (SCGetNetContentRestrictions() & 2) != 0) { - ipl::System::getDialog()->callBtn1(0x14c, 0x2e); - *reinterpret_cast(address + 0xac) = 0x17; - } else { - int checkResult = check__Q33ipl5scene15FriendListCacheFv( - *reinterpret_cast(address + 0x274)); - if (checkResult == -31 || - *reinterpret_cast( - *reinterpret_cast(address + 0x274) + 0x9d74) == -32 || - *reinterpret_cast( - *reinterpret_cast(address + 0x274) + 0x9d74) == -6) { - wchar_t errorMessage[0x400] = {}; - set_err_msg__Q33ipl5scene7AddressFPwUl8NWC24Err( - self, errorMessage, 0x400, - *reinterpret_cast( - *reinterpret_cast(address + 0x274) + 0x9d74)); - ipl::System::getDialog()->callBtn1(errorMessage, 0x2e); - *reinterpret_cast(address + 0xac) = 0x15; - } else if (registeredFriendCount >= 100) { - ipl::System::getDialog()->callBtn1(0x50, 0x2e); - *reinterpret_cast(address + 0xac) = 0x16; - } else { - createChildScene__Q33ipl5scene4BaseFiPQ33ipl5scene4BasePQ33ipl5scene4BasePv( - self, 0x18, self, 0, 0); - button->reserveAnm(0x10); - button->reserveText(0, 0x13b); - button->reserveAnm(0xb); - button->setEventHandler(0, 0); - void* frame = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - *reinterpret_cast(address + 0x9c) + 0x28c, 0); - initFrame__Q33ipl7utility15FrameControllerFv(frame); - *reinterpret_cast(reinterpret_cast(frame) + 0x14) = 1; - *reinterpret_cast(address + 0xac) = 0xc; - } - } - button->animation(0x19); - button->animation(0x1a); - } -} - -extern "C" void add_translate__Q33ipl5scene7AddressFPQ34nw4r3lyt4PaneRCQ33ipl4math4VEC2( - void*, nw4r::lyt::Pane* pane, const ipl::math::VEC2& offset) { - nw4r::ut::Rect projection; - nw4r::ut::Rect projection4x3; - ipl::System::getProjectionRect(&projection); - ipl::System::getProjectionRect4x3(&projection4x3); - nw4r::math::VEC3 translate; - translate.x = pane->GetTranslate().x; - translate.y = pane->GetTranslate().y; - translate.z = pane->GetTranslate().z; - translate.x += offset.x * projection4x3.GetWidth() / projection.GetWidth(); - translate.y += offset.y; - SetTranslate__Q34nw4r3lyt4PaneFRCQ34nw4r4math4VEC3(pane, &translate); -} - -#pragma dont_inline on -extern "C" void set_page_text__Q33ipl5scene7AddressFPCci(ipl::scene::Address* self, - const char* paneName, int page) { - wchar_t digits[10]; - const wchar_t* digitSource = lbl_8160F650 - 1; - wchar_t* digitDest = digits - 1; - for (int i = 0; i < 5; i++) { - digitDest[1] = digitSource[1]; - digitDest[2] = digitSource[2]; - digitDest += 2; - digitSource += 2; - } - wchar_t text[6] = {}; - int textIndex = 0; - if (page >= 10) { - text[textIndex++] = digits[page / 10]; - } - text[textIndex++] = digits[page % 10]; - text[textIndex++] = '/'; - text[textIndex++] = digits[2]; - text[textIndex++] = digits[0]; - text[textIndex] = 0; - set_textbox__Q33ipl5scene7AddressFPCcPCw(self, paneName, text); -} -extern "C" void set_textbox__Q33ipl5scene7AddressFPCcPCw(ipl::scene::Address* self, - const char* paneName, - const wchar_t* text) { - char* address = reinterpret_cast(self); - void* layout = *reinterpret_cast(address + 0x8c); - nw4r::lyt::Pane* root = - *reinterpret_cast(reinterpret_cast(layout) + 0x14); - nw4r::lyt::TextBox* textBox = nw4r::ut::DynamicCast( - root->FindPaneByName(paneName, true)); - textBox->SetString(text, 0); -} -#pragma dont_inline reset - -extern "C" void reset_friend__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* address = reinterpret_cast(self); - int objectOffset = 0; - unsigned int buttonIndex = 0; - do { - unsigned int page = *reinterpret_cast(address + 0xb0); - unsigned int friendIndex = buttonIndex + page * 5; - const char* buttonName = lbl_81647614[buttonIndex]; - char* object = address + objectOffset + 0xe4; - set_friend__Q33ipl5scene7AddressFPCcUlUlRQ43ipl5scene7Address6MiiObjb( - self, buttonName, friendIndex, buttonIndex, object, false); - buttonIndex++; - objectOffset += 0x28; - } while (buttonIndex < 5); -} - -extern "C" void start_trig_event__Q33ipl5scene7AddressFPCc( - ipl::scene::Address* self, const char* paneName) { - char* address = reinterpret_cast(self); - ipl::scene::Button* button = - static_cast(ipl::System::getScene(5)); - int buttonNo = get_button_no__Q33ipl5scene7AddressFPCc(self, paneName); - if (*reinterpret_cast(address + 0xac) == 4) { - int mode = *reinterpret_cast(address + 0x88); - unsigned int page = *reinterpret_cast(address + 0xb0); - if (mode == 0) { - if (buttonNo == -1 || - is_selectable__Q33ipl5scene7AddressFUl(self, buttonNo + page * 5) == 0) { - if (buttonNo != -1) { - *reinterpret_cast(address + 0xbc) = buttonNo; - *reinterpret_cast(address + 0xc0) = buttonNo + page * 5; - entry_friend__Q33ipl5scene7AddressFv(self); + if (bAnimDone && !mpDialogLayout->getAnim(1)->isPlaying()) { + ret = TRUE; } } else { - button->animation(0x19); - button->animation(0x1a); - button->animation(0x10); - button->reserveText(0, 0x13b); - button->reserveAnm(0xb); - button->setEventHandler(0, 0); - unsigned int animationIndex = - *reinterpret_cast(address + buttonNo + 0xc4) == 0 - ? buttonNo + 0x1f - : buttonNo + 0x10; - ipl::utility::FrameController* animator = - static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + - 0x28c, - animationIndex)); - animator->play(); - *reinterpret_cast(address + 0xbc) = buttonNo; - *reinterpret_cast(address + 0xc0) = buttonNo + page * 5; - ipl::snd::sSystem.startSE(lbl_81647A78); - *reinterpret_cast(address + buttonNo * 4 + 0xcc) += 1; - *reinterpret_cast(address + 0xac) = 9; + ret = System::getFader()->getStatus() == EGG::Fader::PREPARE_IN; } - } else if (mode >= 0 && mode < 3) { - if (buttonNo == -1 || - is_selectable__Q33ipl5scene7AddressFUl(self, buttonNo + page * 5) == 0) { - if (buttonNo != -1) { - unsigned int friendIndex = buttonNo + page * 5; - ipl::scene::FriendListCache* cache = - *reinterpret_cast(address + 0x274); - if (*(reinterpret_cast(cache) + friendIndex + 32000) != 0) { - const NWC24FriendInfo& info = cache->getInfo(friendIndex); - if (mode == 1) { - callBtn1__Q23ipl12DialogWindowFUlUl(ipl::System::getDialog(), - 0x57, 0x2e); - } else if (info.attr.type == 1) { - callBtn1__Q23ipl12DialogWindowFUlUl(ipl::System::getDialog(), - 0x57, 0x2e); - } else { - callBtn1__Q23ipl12DialogWindowFUlUl(ipl::System::getDialog(), - 0x22, 0x2e); - } - *reinterpret_cast(address + 0xac) = 0x19; + + return (FaderSceneCommand)ret; + } + + void Address::calcCommonAfter() { + mpLayout->calc(); + mpBackLayout->calc(); + mpDialogLayout->calc(); + } + + void Address::draw() { + if (System::getSceneManager()->onDrawLayer(DRAW_LAYER_2)) { + utility::Graphics::setOrtho(0); + + nw4r::lyt::Pane* pane = mpLayout->FindPaneByName("N_note_a"); + for (int i = mNextPageNum; i >= 1; i--) { + math::VEC2 trans; + trans.y = sPageOffset.y * i; + trans.x = sPageOffset.x * i; + pane->SetTranslate(trans); + pane->CalculateMtx(*mpLayout->getDrawInfo()); + mpLayout->draw(pane); + } + + mpLayout->draw("N_note_b"); + + if (mState == STATE_FORWARD || mState == STATE_BACKWARD) { + mpLayout->draw("N_note_c"); + } + + int offset = 0; + switch (mState) { + case STATE_COVER_FORWARD: + case STATE_COVER_BACKWARD: + case STATE_FORWARD: + case STATE_BACKWARD: { + offset = 1; + break; } } + + pane = mpLayout->FindPaneByName("N_note_d"); + for (int i = offset; i < mPrevPageNum + offset; i++) { + math::VEC2 trans = sPageOffset * -i; + pane->SetTranslate(trans); + pane->CalculateMtx(*mpLayout->getDrawInfo()); + mpLayout->draw(pane); + } + + pane = mpLayout->FindPaneByName("N_note_e"); + switch (mState) { + case STATE_LOOP_FORWARD: + case STATE_LOOP_BACKWARD: { + for (int i = 1; i < PAGE_MAX; i++) { + math::VEC2 trans = sPageOffset * -i; + pane->SetTranslate(trans); + pane->CalculateMtx(*mpLayout->getDrawInfo()); + mpLayout->draw(pane); + } + break; + } + default: { + math::VEC2 trans = sPageOffset * -(mPrevPageNum + offset); + pane->SetTranslate(trans); + pane->CalculateMtx(*mpLayout->getDrawInfo()); + mpLayout->draw("N_note_e"); + break; + } + } + + mpBackLayout->draw(); + mpDialogLayout->draw(); + } else if (System::getSceneManager()->onDrawLayer(DRAW_LAYER_3)) { + utility::Graphics::setOrtho(0); + + switch (mState) { + case STATE_COVER_NORMAL: + case STATE_COVER_FORWARD: + case STATE_COVER_BACKWARD: + case STATE_FORWARD: + case STATE_BACKWARD: + case STATE_LOOP_FORWARD: + case STATE_LOOP_BACKWARD: + case STATE_DRAG: { + mpLayout->draw("N_note_move"); + break; + } + } + } + } + + void Address::destroy() { + mpFriendCache->fin(); + } + + void Address::fistt_wait_open() { + if (mpFriendCache->init()) { + onInitFriendList(); + mFadeinState = FADEIN_STATE_FADEIN; + } else if (mWaitOpenCount >= 300) { + System::getDialog()->callBtn1(MESG_ERROR_NWC24_FATAL, MESG_CMN_OK); + mState = STATE_MSG_OPEN_FAILURE; + mFadeinState = FADEIN_STATE_DONE; + } + + mWaitOpenCount++; + } + + void Address::fistt_fadein() { + if (!mpLayout->getAnim(0)->isPlaying() && !mpLayout->getAnim(2)->isPlaying() && !mpDialogLayout->getAnim(0)->isPlaying()) { + mFadeinState = FADEIN_STATE_DONE; + } + } + + void Address::onInitFriendList() { + Button* button; + wchar_t idStr[24]; + wchar_t text[24]; + + memset(idStr, 0, sizeof(idStr)); + memset(text, 0, sizeof(text)); + + utility::CharacterCode::WiiIdToUTF16(idStr, mpFriendCache->getMyUserId()); + + // Format the Wii number as "XXXX XXXX XXXX XXXX" + int textIdx = 0; + for (int i = 0; i < 4; i++) { + text[textIdx++] = idStr[i]; + } + text[textIdx++] = L' '; + for (int i = 4; i < 8; i++) { + text[textIdx++] = idStr[i]; + } + text[textIdx++] = L' '; + for (int i = 8; i < 12; i++) { + text[textIdx++] = idStr[i]; + } + text[textIdx++] = L' '; + for (int i = 12; i < 16; i++) { + text[textIdx++] = idStr[i]; + } + + set_textbox("T_wii_name", text); + set_page_text("T_nmbr_b", mPage + 1); + + for (u32 i = 0; i < BTN_MAX; i++) { + set_friend(sTextNameB[i], i, i, mMiiObj[i], false); + + if (mbFaceValid[i]) { + mpLayout->getAnim(i + 6)->initAnmFrame(); + } else { + mpLayout->getAnim(i + 21)->initAnmFrame(); + } + } + + mPage = 0; + mPrevPageNum = 0; + mNextPageNum = PAGE_MAX; + + button = static_cast(System::getScene(SCENE_BUTTON)); + button->animation(Button::IDANIM_ARROW_RIGHT_APPEAR); + button->animation(Button::IDANIM_ARROW_LEFT_APPEAR); + + if (mMode == 0) { + mState = STATE_COVER_NORMAL; + } else if (mpFriendCache->getRegFriendNum() == 0) { + mState = STATE_COVER_NORMAL; } else { - button->animation(0xc); - button->reserveText(0, 0x25); - button->reserveText(1, 0x33); - button->reserveAnm(0xf); - button->animation(0x19); - button->animation(0x1a); - ipl::utility::FrameController* animator = - static_cast( - List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - static_cast(*reinterpret_cast(address + 0x8c)) + - 0x28c, - buttonNo + 0x10)); - animator->play(); - *reinterpret_cast(address + 0xbc) = buttonNo; - *reinterpret_cast(address + 0xc0) = buttonNo + page * 5; - ipl::snd::sSystem.startSE(lbl_81647A78); - *reinterpret_cast(address + 0xac) = 9; + mState = STATE_INIT; + } + + switch (mMode) { + case 0: { + mpLayout->getAnim(0)->play(); + break; + } + case SCENE_ADD_WII: + case SCENE_ADD_EMAIL: { + mpLayout->getAnim(2)->play(); + mpDialogLayout->getAnim(0)->play(); + break; + } } } - } -} -extern "C" void start_point_event__Q33ipl5scene7AddressFPCcPQ33ipl10controller9Interface( - ipl::scene::Address* self, const char* paneName, void* controller) { - char* address = reinterpret_cast(self); - int buttonNo = get_button_no__Q33ipl5scene7AddressFPCc(self, paneName); - if (buttonNo != -1) { - int mode = *reinterpret_cast(address + 0x88); - if (mode == 0 || - (mode == 1 && is_selectable__Q33ipl5scene7AddressFUl( - self, buttonNo + *reinterpret_cast(address + 0xb0) * 5))) { - on_point_event__Q33ipl5scene7AddressFiPQ33ipl10controller9Interface(self, buttonNo, - controller); - } - } -} - -extern "C" void start_left_event__Q33ipl5scene7AddressFPCc(ipl::scene::Address* self, - const char* paneName) { - char* address = reinterpret_cast(self); - int buttonNo = get_button_no__Q33ipl5scene7AddressFPCc(self, paneName); - if (buttonNo != -1) { - int mode = *reinterpret_cast(address + 0x88); - if (mode == 0 || - (mode == 1 && is_selectable__Q33ipl5scene7AddressFUl( - self, buttonNo + *reinterpret_cast(address + 0xb0) * 5))) { - left_point_event__Q33ipl5scene7AddressFi(self, buttonNo); - } - } -} - -extern "C" void start_drag_point_event__Q33ipl5scene7AddressFPCcPQ33ipl10controller9Interface( - ipl::scene::Address* self, const char* paneName, void* controller) { - int buttonNo = get_button_no__Q33ipl5scene7AddressFPCc(self, paneName); - if (buttonNo != -1 && - isReleasableArea__Q33ipl5scene7AddressFii( - self, *reinterpret_cast(reinterpret_cast(self) + 0xb0), buttonNo)) { - on_point_event__Q33ipl5scene7AddressFiPQ33ipl10controller9Interface(self, buttonNo, - controller); - *reinterpret_cast(reinterpret_cast(self) + 0x84) = 1; - } -} - -extern "C" void start_drag_left_event__Q33ipl5scene7AddressFPCc(ipl::scene::Address* self, - const char* paneName) { - int buttonNo = get_button_no__Q33ipl5scene7AddressFPCc(self, paneName); - if (buttonNo != -1) { - left_point_event__Q33ipl5scene7AddressFi(self, buttonNo); - *reinterpret_cast(reinterpret_cast(self) + 0x84) = 1; - } -} - -extern "C" void start_release_event__Q33ipl5scene7AddressFPCc(ipl::scene::Address* self, - const char* paneName) { - char* address = reinterpret_cast(self); - int buttonNo; - const char* dataBase = lbl_81647538; - ipl::System::getScene(5); - buttonNo = -1; - if (paneName != 0) { - buttonNo = get_button_no__Q33ipl5scene7AddressFPCc(self, paneName); - if (buttonNo == -1) { - buttonNo = get_button_space_no__Q33ipl5scene7AddressFPCc(self, paneName); - } - } - switch (*reinterpret_cast(address + 0x88)) { - case 0: { - if (isReleasableArea__Q33ipl5scene7AddressFii( - self, *reinterpret_cast(address + 0xb0), buttonNo)) { - *reinterpret_cast(address + 0xbc) = buttonNo; - unsigned int friendIndex = - buttonNo + *reinterpret_cast(address + 0xb0) * 5; - *reinterpret_cast(address + 0xc0) = friendIndex; - unsigned int selectedIndex = *reinterpret_cast(address + 0x74) + - *reinterpret_cast(address + 0x70) * 5; - if (friendIndex != selectedIndex) { - ipl::scene::FriendListCache* cache = - *reinterpret_cast(address + 0x274); - swap__Q33ipl5scene15FriendListCacheFUlUl(cache, friendIndex, selectedIndex); + void Address::stt_cover_normal() { + if (mDrag.mbDragging) { + changePage_onDrag(); + } else { + Button* button = static_cast(System::getScene(SCENE_BUTTON)); + if (button->isActive()) { + button->update(); + } + } + + if (mState == STATE_COVER_NORMAL) { + if (System::getMasterController()->down(controller::BTN_NEXT_RIGHT)) { + snd::getSystem()->startSE("WIPL_SE_FL_PAGE_INC"); + onNextPage(); + } else if (System::getMasterController()->down(controller::BTN_NEXT_LEFT)) { + snd::getSystem()->startSE("WIPL_SE_FL_PAGE_DEC"); + onPreviousPage(); + } } - ipl::snd::sSystem.startSEwithPos(dataBase + 0x568, - *reinterpret_cast(address + 0x64)); - } else { - ipl::snd::sSystem.startSEwithPos(dataBase + 0x577, - *reinterpret_cast(address + 0x64)); } - ipl::System::getPointer()->changeType(*reinterpret_cast(address + 0x6c), 0); - static_cast(ipl::System::getScene(5))->enableBtn(); - void* layout = *reinterpret_cast(address + 0x8c); - nw4r::lyt::Pane* root = - *reinterpret_cast(reinterpret_cast(layout) + 0x14); - const char* const* buttonNames = - reinterpret_cast(dataBase + 0x3c); - const char* paneName = buttonNames[*reinterpret_cast(address + 0x74)]; - nw4r::lyt::Pane* pane = root->FindPaneByName(paneName, true); - SetVisible__Q34nw4r3lyt4PaneFb(pane, true); - *reinterpret_cast(address + 0x84) = 0; - *reinterpret_cast(address + 0xac) = 0xb; - reset_friend__Q33ipl5scene7AddressFv(self); - break; - } - default: - break; - } -} -extern "C" void stt_wait_dialog__Q33ipl5scene7AddressFv(ipl::scene::Address* self) { - char* dialog = reinterpret_cast(ipl::System::getDialog()); - if (*reinterpret_cast(dialog + 0x24) >= 0) { - reset_gui__Q33ipl5scene7AddressFb(self, true); - *reinterpret_cast(reinterpret_cast(self) + 0xac) = 4; - } -} - -extern "C" void on_point_event__Q33ipl5scene7AddressFiPQ33ipl10controller9Interface( - ipl::scene::Address* self, int index, void* controller) { - char* address = reinterpret_cast(self); - int* count = reinterpret_cast(address + index * 4 + 0xcc); - if (*count == 0) { - if (*(reinterpret_cast(address) + index + 0xc4) != 0) { - void* layout = *reinterpret_cast(address + 0x8c); - unsigned short animationIndex = index + 6; - void* frame = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(layout) + 0x28c, animationIndex); - initFrame__Q33ipl7utility15FrameControllerFv(frame); - *reinterpret_cast(reinterpret_cast(frame) + 0x14) = 1; - } else { - void* layout = *reinterpret_cast(address + 0x8c); - unsigned short animationIndex = index + 0x15; - void* frame = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(layout) + 0x28c, animationIndex); - initFrame__Q33ipl7utility15FrameControllerFv(frame); - *reinterpret_cast(reinterpret_cast(frame) + 0x14) = 1; + void Address::stt_cover_forward() { + if (!mpLayout->getAnim(4)->isPlaying()) { + mbCover = false; + if (!mDrag.mbDragging) { + mState = STATE_NORMAL; + } else { + mState = STATE_DRAG; + } + } else if (mDrag.mbDragging) { + changePage_onDrag(); + } } - ipl::snd::sSystem.startSE(lbl_81647AC3); - static_cast(controller)->rumble(1); - } - *count += 1; -} -extern "C" void left_point_event__Q33ipl5scene7AddressFi(ipl::scene::Address* self, int index) { - char* address = reinterpret_cast(self); - int* count = reinterpret_cast(address + index * 4 + 0xcc); - if (*count == 1) { - if (*(reinterpret_cast(address) + index + 0xc4) != 0) { - void* layout = *reinterpret_cast(address + 0x8c); - unsigned short animationIndex = index + 0xb; - void* frame = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(layout) + 0x28c, animationIndex); - initFrame__Q33ipl7utility15FrameControllerFv(frame); - *reinterpret_cast(reinterpret_cast(frame) + 0x14) = 1; - } else { - void* layout = *reinterpret_cast(address + 0x8c); - unsigned short animationIndex = index + 0x1a; - void* frame = List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs( - reinterpret_cast(layout) + 0x28c, animationIndex); - initFrame__Q33ipl7utility15FrameControllerFv(frame); - *reinterpret_cast(reinterpret_cast(frame) + 0x14) = 1; + void Address::stt_cover_backward() { + if (!mpLayout->getAnim(4)->isPlaying()) { + add_translate(mpLayout->FindPaneByName("N_note_base"), -sPageOffset); + mbCover = true; + mNextPageNum++; + mState = STATE_COVER_NORMAL; + } else if (mDrag.mbDragging) { + changePage_onDrag(); + } } - } - if (*count > 0) { - *count = *count - 1; - } -} -extern "C" bool isDupId__Q33ipl5scene15FriendListCacheFRCUx( - const ipl::scene::FriendListCache* self, const unsigned long long* id) { - const unsigned char* cache = reinterpret_cast(self); - for (int i = 0; i < 100; i++) { - if (cache[i + 32000] != 0 && self->getInfo(i).attr.type == 1) { - const NWC24FriendInfo& info = self->getInfo(i); - if (*id == info.addr.wiiId) { + void Address::stt_normal() { + Button* button = static_cast(System::getScene(SCENE_BUTTON)); + if (button->isActive()) { + button->update(); + } + + if (mState == STATE_NORMAL) { + mpGui->update(); + + if (System::getMasterController()->down(controller::BTN_NEXT_RIGHT)) { + snd::getSystem()->startSE("WIPL_SE_FL_PAGE_INC"); + onNextPage(); + } else if (System::getMasterController()->down(controller::BTN_NEXT_LEFT)) { + snd::getSystem()->startSE("WIPL_SE_FL_PAGE_DEC"); + onPreviousPage(); + } + } + } + + void Address::stt_forward() { + if (!mpLayout->getAnim(5)->isPlaying()) { + mPrevPageNum++; + if (!mDrag.mbDragging) { + mState = STATE_NORMAL; + } else { + mState = STATE_DRAG; + } + } else if (mDrag.mbDragging) { + changePage_onDrag(); + } + } + + void Address::stt_backward() { + if (!mpLayout->getAnim(5)->isPlaying()) { + mNextPageNum++; + add_translate(mpLayout->FindPaneByName("N_note_base"), -sPageOffset); + set_page_text("T_nmbr_b", mPage + 1); + + for (u32 i = 0; i < BTN_MAX; i++) { + set_friend(sTextNameB[i], i + mPage * BTN_MAX, i, mMiiObj[i], false); + } + + if (!mDrag.mbDragging) { + mState = STATE_NORMAL; + } else { + mState = STATE_DRAG; + } + } else if (mDrag.mbDragging) { + changePage_onDrag(); + } + } + + void Address::stt_loop_forward() { + if (!mpLayout->getAnim(4)->isPlaying()) { + add_translate(mpLayout->FindPaneByName("N_note_base"), -sPageOffset * PAGE_MAX); + set_page_text("T_nmbr_b", mPage + 1); + reset_gui(false); + + for (u32 i = 0; i < BTN_MAX; i++) { + set_friend(sTextNameB[i], i + mPage * BTN_MAX, i, mMiiObj[i], false); + } + + mbCover = true; + mNextPageNum = PAGE_MAX; + mState = STATE_COVER_NORMAL; + } else if (mDrag.mbDragging) { + changePage_onDrag(); + } + } + + void Address::stt_loop_backward() { + if (!mpLayout->getAnim(4)->isPlaying()) { + mbCover = false; + mPrevPageNum = PAGE_MAX - 1; + if (!mDrag.mbDragging) { + mState = STATE_NORMAL; + } else { + mState = STATE_DRAG; + } + } else if (mDrag.mbDragging) { + changePage_onDrag(); + } + } + + void Address::stt_decide() { + if (!mpLayout->getAnim(mSelectedButton + 16)->isPlaying() && !mpLayout->getAnim(mSelectedButton + 31)->isPlaying()) { + reset_gui(true); + + switch (mMode) { + case 0: { + createChildScene(SCENE_ADDRESS_EDIT, this, NULL, NULL); + mpBackLayout->getAnim(0)->play(); + mState = STATE_WAIT_CHILD_CST; + break; + } + case SCENE_ADD_WII: + case SCENE_ADD_EMAIL: { + LetterWriter* letterWriter = static_cast(System::getScene(SCENE_LETTER_WRITER)); + letterWriter->setFriendInfo(mpFriendCache->getInfo(mChosenFriend)); + mpLayout->getAnim(3)->play(); + mpDialogLayout->getAnim(1)->play(); + mState = STATE_DONE; + break; + } + } + } + } + + void Address::stt_drag() { + mpGui->update(); + if (mState == STATE_DRAG) { + changePage_onDrag(); + } + } + + void Address::stt_release() { + mpGui->init(); + + for (int i = 0; i < BTN_MAX; i++) { + if (mbFaceValid[i]) { + mpLayout->getAnim(i + 6)->initAnmFrame(); + } else { + mpLayout->getAnim(i + 21)->initAnmFrame(); + } + + mPointCount[i] = 0; + } + + mpLayout->FindPaneByName("N_note_move")->SetVisible(false); + + if (mbCover) { + mState = STATE_COVER_NORMAL; + } else { + mState = STATE_NORMAL; + } + } + + void Address::stt_wait_child_cst() { + if (getChild() != NULL && !mpBackLayout->getAnim(0)->isPlaying()) { + mState = STATE_WAIT_CHILD_DST; + reset_gui(true); + + for (int i = 0; i < BTN_MAX; i++) { + mPointCount[i] = 0; + } + } + } + + void Address::stt_wait_child_dst() { + if (getChild() == NULL && System::getReservedScene() == NULL) { + mpBackLayout->getAnim(1)->play(); + static_cast(System::getScene(SCENE_BUTTON))->setEventHandler(this); + mState = STATE_WAIT_CHILD_FADEOUT; + } + } + + void Address::stt_wait_child_fadeout() { + if (!mpBackLayout->getAnim(1)->isPlaying()) { + Button* button = static_cast(System::getScene(SCENE_BUTTON)); + button->setText("T_CalAdd_R", MESG_ADDRESS_REGISTER); + button->animation(Button::IDANIM_ARROW_RIGHT_APPEAR); + button->animation(Button::IDANIM_ARROW_LEFT_APPEAR); + + if (mbCover) { + mState = STATE_COVER_NORMAL; + } else { + mState = STATE_NORMAL; + } + } + } + + void Address::stt_msg_net() { + switch (System::getDialog()->getLastResult()) { + case DialogWindow::RESULT_LEFT_BUTTON: { + if (mbCover) { + mState = STATE_COVER_NORMAL; + } else { + mState = STATE_NORMAL; + } + + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_RIGHT_APPEAR); + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_LEFT_APPEAR); + break; + } + case DialogWindow::RESULT_RIGHT_BUTTON: { + SCParentalControlsInfo pcInfo; + if (SCGetParentalControl(&pcInfo) && (pcInfo.enable & SC_PARENTAL_FLAG_ENABLED)) { + static_cast(System::getScene(SCENE_BUTTON))->setEventHandler(NULL); + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_DISAPPEAR_LEFT_AND_RIGHT_BUTTON); + createChildScene(SCENE_PARENTAL_DIALOG, this, NULL, (void*)1); + mbParentalOK = false; + mState = STATE_WAIT_PARENTAL; + } else { + System::getFader()->fadeOut(); + reserveAllSceneDestruction(SCENE_SETTING, (void*)1); + mState = STATE_DONE; + } + break; + } + } + } + + void Address::stt_wait_parental() { + ParentalDialog* parental = static_cast(System::getScene(SCENE_PARENTAL_DIALOG)); + if (parental != NULL) { + switch (parental->getResult()) { + case ParentalDialog::RESULT_SUCCESS: { + mbParentalOK = true; + mState = STATE_WAIT_PARENTAL_DST; + break; + } + case ParentalDialog::RESULT_OVER_ATTEMPTS: + case ParentalDialog::RESULT_CANCELLED: { + mbParentalOK = false; + mState = STATE_WAIT_PARENTAL_DST; + break; + } + } + } + } + + void Address::stt_wait_parental_dst() { + if (getChild() == NULL) { + if (mbParentalOK) { + System::getFader()->fadeOut(); + reserveAllSceneDestruction(SCENE_SETTING, (void*)1); + mState = STATE_DONE; + } else { + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_APPEAR_LEFT_AND_RIGHT_BUTTON); + static_cast(System::getScene(SCENE_BUTTON))->setEventHandler(this); + + if (mbCover) { + mState = STATE_COVER_NORMAL; + } else { + mState = STATE_NORMAL; + } + + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_RIGHT_APPEAR); + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_LEFT_APPEAR); + } + } + } + + void Address::stt_msg_wc() { + switch (System::getDialog()->getLastResult()) { + case DialogWindow::RESULT_LEFT_BUTTON: { + if (mbCover) { + mState = STATE_COVER_NORMAL; + } else { + mState = STATE_NORMAL; + } + + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_RIGHT_APPEAR); + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_LEFT_APPEAR); + break; + } + case DialogWindow::RESULT_RIGHT_BUTTON: { + SCParentalControlsInfo pcInfo; + if (SCGetParentalControl(&pcInfo) && (pcInfo.enable & SC_PARENTAL_FLAG_ENABLED)) { + static_cast(System::getScene(SCENE_BUTTON))->setEventHandler(NULL); + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_DISAPPEAR_LEFT_AND_RIGHT_BUTTON); + createChildScene(SCENE_PARENTAL_DIALOG, this, NULL, (void*)1); + mbParentalOK = false; + mState = STATE_WAIT_PARENTAL_WC; + } else { + System::getFader()->fadeOut(); + reserveAllSceneDestruction(SCENE_SETTING, (void*)4); + mState = STATE_DONE; + } + break; + } + } + } + + void Address::stt_wait_parental_wc() { + ParentalDialog* parental = static_cast(System::getScene(SCENE_PARENTAL_DIALOG)); + if (parental != NULL) { + switch (parental->getResult()) { + case ParentalDialog::RESULT_SUCCESS: { + mbParentalOK = true; + mState = STATE_WAIT_PARENTAL_DST_WC; + break; + } + case ParentalDialog::RESULT_OVER_ATTEMPTS: + case ParentalDialog::RESULT_CANCELLED: { + mbParentalOK = false; + mState = STATE_WAIT_PARENTAL_DST_WC; + break; + } + } + } + } + + void Address::stt_wait_parental_dst_wc() { + if (getChild() == NULL) { + if (mbParentalOK) { + System::getFader()->fadeOut(); + reserveAllSceneDestruction(SCENE_SETTING, (void*)4); + mState = STATE_DONE; + } else { + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_APPEAR_LEFT_AND_RIGHT_BUTTON); + static_cast(System::getScene(SCENE_BUTTON))->setEventHandler(this); + + if (mbCover) { + mState = STATE_COVER_NORMAL; + } else { + mState = STATE_NORMAL; + } + + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_RIGHT_APPEAR); + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_LEFT_APPEAR); + } + } + } + + void Address::stt_msg_nwc24_error() { + switch (System::getDialog()->getLastResult()) { + case DialogWindow::RESULT_BUTTON: { + if (mbCover) { + mState = STATE_COVER_NORMAL; + } else { + mState = STATE_NORMAL; + } + + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_RIGHT_APPEAR); + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_LEFT_APPEAR); + break; + } + } + } + + void Address::stt_msg_fi_full() { + switch (System::getDialog()->getLastResult()) { + case DialogWindow::RESULT_BUTTON: { + if (mbCover) { + mState = STATE_COVER_NORMAL; + } else { + mState = STATE_NORMAL; + } + + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_RIGHT_APPEAR); + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_LEFT_APPEAR); + break; + } + } + } + + void Address::stt_msg_parental() { + switch (System::getDialog()->getLastResult()) { + case DialogWindow::RESULT_BUTTON: { + if (mbCover) { + mState = STATE_COVER_NORMAL; + } else { + mState = STATE_NORMAL; + } + + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_RIGHT_APPEAR); + static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_LEFT_APPEAR); + break; + } + } + } + + void Address::stt_msg_open_failure() { + switch (System::getDialog()->getLastResult()) { + case DialogWindow::RESULT_BUTTON: { + Button* button = static_cast(System::getScene(SCENE_BUTTON)); + MailAddressSelect* mailAddrSel = static_cast(System::getScene(SCENE_MAIL_ADDRESS_SELECT)); + + switch (mMode) { + case 0: { + if (mailAddrSel != NULL) { + mailAddrSel->finishAddress(); + } + button->reserveAnm(Button::IDANIM_DISAPPEAR_LEFT_AND_RIGHT_BUTTON); + button->reserveAnm(Button::IDANIM_APPEAR_LEFT_BUTTON); + break; + } + case SCENE_ADD_WII: { + button->reserveAnm(Button::IDANIM_DISAPPEAR_LEFT_BUTTON); + button->reserveAnm(Button::IDANIM_APPEAR_LEFT_BUTTON); + break; + } + case SCENE_ADD_EMAIL: { + button->reserveAnm(Button::IDANIM_DISAPPEAR_LEFT_BUTTON); + button->reserveText(0, MESG_CMN_BACK_ALT); + button->reserveText(1, 51); + button->reserveAnm(Button::IDANIM_APPEAR_LEFT_AND_RIGHT_BUTTON); + break; + } + } + + button->animation(Button::IDANIM_ARROW_RIGHT_DISAPPEAR); + button->animation(Button::IDANIM_ARROW_LEFT_DISAPPEAR); + mState = STATE_DONE; + break; + } + } + } + + void Address::stt_wait_dialog() { + if (System::getDialog()->getLastResult() >= DialogWindow::RESULT_WAIT) { + reset_gui(true); + mState = STATE_NORMAL; + } + } + + void Address::add_translate(nw4r::lyt::Pane* pane, const math::VEC2& offset) { + nw4r::ut::Rect rect; + nw4r::ut::Rect rect4x3; + + System::getProjectionRect(&rect); + System::getProjectionRect4x3(&rect4x3); + + nw4r::math::VEC3 trans; + trans.x = pane->GetTranslate().x; + trans.y = pane->GetTranslate().y; + trans.z = pane->GetTranslate().z; + trans.x += offset.x * rect4x3.GetWidth() / rect.GetWidth(); + trans.y += offset.y; + pane->SetTranslate(trans); + } + + void Address::set_friend(const char* paneName, u32 friendNo, u32 buttonNo, MiiObj& miiObj, bool bDrag) { + wchar_t blank[1]; + blank[0] = 0; + const wchar_t* name = blank; + + if (mpFriendCache->isThere(friendNo)) { + const NWC24FriendInfo& info = mpFriendCache->getInfo(friendNo); + name = (const wchar_t*)info.attr.name; + + bool bValid = info.attr.status == NWC24_FRIENDSTATUS_CONFIRMED; + if (mMode == SCENE_ADD_EMAIL) { + bValid = bValid & (info.attr.type == NWC24_FRIENDTYPE_WII); + } + + if (bDrag) { + if (bValid) { + mpLayout->getAnim(buttonNo + 36)->initAnmFrame(0.0f); + } else { + mpLayout->getAnim(buttonNo + 36)->initAnmFrame(1.0f); + } + } else { + if (bValid) { + mpLayout->getAnim(buttonNo + 6)->initAnmFrame(); + } else { + mpLayout->getAnim(buttonNo + 21)->initAnmFrame(); + } + mbFaceValid[buttonNo] = bValid; + } + + if (!mDrag.mbDragging || friendNo != mDrag.mButton + mDrag.mPage * BTN_MAX) { + miiObj.set(info.attr.fdId); + } + } else { + if (bDrag) { + mpLayout->getAnim(buttonNo + 36)->initAnmFrame(0.0f); + } else { + mbFaceValid[buttonNo] = false; + mpLayout->getAnim(buttonNo + 21)->initAnmFrame(); + } + + miiObj.reset(); + } + + if (!mDrag.mbDragging || friendNo != mDrag.mButton + mDrag.mPage * BTN_MAX) { + set_textbox(paneName, name); + } else { + set_textbox(paneName, L""); + miiObj.reset(); + } + } + + void Address::set_page_text(const char* paneName, int page) { + const wchar_t digits[10] = {L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7', L'8', L'9'}; + wchar_t text[6] = {0}; + + int i = 0; + if (page >= 10) { + text[i++] = digits[page / 10]; + } + text[i++] = digits[page % 10]; + text[i++] = L'/'; + text[i++] = digits[PAGE_MAX / 10]; + text[i++] = digits[PAGE_MAX % 10]; + text[i] = 0; + + set_textbox(paneName, text); + } + + void Address::set_textbox(const char* paneName, const wchar_t* text) { + nw4r::lyt::TextBox* textBox = nw4r::ut::DynamicCast(mpLayout->FindPaneByName(paneName)); + textBox->SetString(text, 0); + } + + void Address::reset_friend() { + for (u32 i = 0; i < BTN_MAX; i++) { + set_friend(sTextNameB[i], i + mPage * BTN_MAX, i, mMiiObj[i], false); + } + } + + void Address::start_point_event(const char* paneName, controller::Interface* con) { + int buttonNo = get_button_no(paneName); + if (buttonNo != -1) { + if (mMode == 0 || (mMode == SCENE_ADD_WII && is_selectable(buttonNo + mPage * BTN_MAX))) { + on_point_event(buttonNo, con); + } + } + } + + void Address::start_left_event(const char* paneName) { + int buttonNo = get_button_no(paneName); + if (buttonNo != -1) { + if (mMode == 0 || (mMode == SCENE_ADD_WII && is_selectable(buttonNo + mPage * BTN_MAX))) { + left_point_event(buttonNo); + } + } + } + + void Address::start_trig_event(const char* paneName) { + Button* button = static_cast(System::getScene(SCENE_BUTTON)); + int buttonNo = get_button_no(paneName); + + switch (mState) { + case STATE_NORMAL: { + switch (mMode) { + case 0: { + if (buttonNo != -1 && is_selectable(buttonNo + mPage * BTN_MAX)) { + button->animation(Button::IDANIM_ARROW_RIGHT_DISAPPEAR); + button->animation(Button::IDANIM_ARROW_LEFT_DISAPPEAR); + button->animation(Button::IDANIM_DISAPPEAR_LEFT_AND_RIGHT_BUTTON); + button->reserveText(Button::TEXT_LEFT_BUTTON, MESG_CMN_BACK_ALT); + button->reserveAnm(Button::IDANIM_APPEAR_LEFT_BUTTON); + button->setEventHandler(NULL); + + if (mbFaceValid[buttonNo]) { + mpLayout->getAnim(buttonNo + 16)->play(); + } else { + mpLayout->getAnim(buttonNo + 31)->play(); + } + + mSelectedButton = buttonNo; + mChosenFriend = buttonNo + mPage * BTN_MAX; + snd::getSystem()->startSE("WIPL_SE_DECIDE"); + mPointCount[buttonNo]++; + mState = STATE_DECIDE; + } else if (buttonNo != -1) { + mSelectedButton = buttonNo; + mChosenFriend = buttonNo + mPage * BTN_MAX; + entry_friend(); + } + break; + } + case SCENE_ADD_WII: + case SCENE_ADD_EMAIL: { + if (buttonNo != -1 && is_selectable(buttonNo + mPage * BTN_MAX)) { + button->animation(Button::IDANIM_DISAPPEAR_LEFT_BUTTON); + button->reserveText(Button::TEXT_LEFT_BUTTON, MESG_CMN_QUIT); + button->reserveText(Button::TEXT_RIGHT_BUTTON, 51); + button->reserveAnm(Button::IDANIM_APPEAR_LEFT_AND_RIGHT_BUTTON); + button->animation(Button::IDANIM_ARROW_RIGHT_DISAPPEAR); + button->animation(Button::IDANIM_ARROW_LEFT_DISAPPEAR); + + mpLayout->getAnim(buttonNo + 16)->play(); + + mSelectedButton = buttonNo; + mChosenFriend = buttonNo + mPage * BTN_MAX; + snd::getSystem()->startSE("WIPL_SE_DECIDE"); + mState = STATE_DECIDE; + } else if (buttonNo != -1) { + u32 friendNo = buttonNo + mPage * BTN_MAX; + if (mpFriendCache->isThere(friendNo)) { + if (mMode == SCENE_ADD_WII) { + System::getDialog()->callBtn1(87, MESG_CMN_OK); + } else if (mpFriendCache->getInfo(friendNo).attr.type == NWC24_FRIENDTYPE_WII) { + System::getDialog()->callBtn1(87, MESG_CMN_OK); + } else { + System::getDialog()->callBtn1(34, MESG_CMN_OK); + } + + mState = STATE_WAIT_DIALOG; + } + } + break; + } + } + break; + } + } + } + + void Address::start_drag_event(const char* paneName, const controller::Interface* con) { + int buttonNo = get_button_no(paneName); + if (buttonNo == -1 || con->getChannel() < 0) { + return; + } + + if (mState != STATE_NORMAL || mMode != 0) { + return; + } + + if (!mpFriendCache->isThere(buttonNo + mPage * BTN_MAX)) { + return; + } + + mDrag.mbDragging = true; + mDrag.mChan = con->getChannel(); + + if (con->isValidDpd()) { + mDrag.mPos = System::getControllerManager()->getController(mDrag.mChan)->getDpdProjectionPos(); + } else { + mDrag.mPos = nw4r::math::VEC2(0.0f, 0.0f); + } + + mDrag.mPage = mPage; + mDrag.mButton = buttonNo; + mDrag.mNextCount = -1; + mDrag.mPrevCount = -1; + mDrag.unk_0x1C = 0; + + System::getPointer()->changeType(con->getChannel(), 1); + static_cast(System::getScene(SCENE_BUTTON))->disableBtn(); + + wchar_t blank[2] = {0, 0}; + static_cast(mpLayout->FindPaneByName(sTextNameB[mDrag.mButton]))->SetString(blank, 0); + + nigaoe::Object* nigaoe = mMiiObj[buttonNo].mpNigaoe; + if (nigaoe != NULL) { + nw4r::lyt::Pane* miiPane = mpLayout->FindPaneByName("mii_move"); + miiPane->SetVisible(true); + + mDragTexObj = nigaoe->getIconTexture(); + memcpy(mpWork, nigaoe->getIconImage(), 0x2D20); + GXInitTexObj(&mDragTexObj, mpWork, 76, 76, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE); + miiPane->GetMaterial()->SetTexture(GX_TEXMAP0, mDragTexObj); + + mMiiObj[buttonNo].reset(); + } else { + mpLayout->FindPaneByName("mii_move")->SetVisible(false); + } + + mpGui->init(); + + for (int i = 0; i < BTN_MAX; i++) { + mPointCount[i] = 0; + + if (mbFaceValid[i]) { + mpLayout->getAnim(i + 6)->initAnmFrame(); + } else { + mpLayout->getAnim(i + 21)->initAnmFrame(); + } + } + + movePane_onDrag(); + + snd::getSystem()->startSEwithPos("WIPL_SE_CH_HOLD", mDrag.mPos.x); + + mState = STATE_DRAG; + } + + void Address::start_drag_point_event(const char* paneName, controller::Interface* con) { + int buttonNo = get_button_no(paneName); + if (buttonNo != -1 && isReleasableArea(mPage, buttonNo)) { + on_point_event(buttonNo, con); + mDrag.mbDragging = true; + } + } + + void Address::start_drag_left_event(const char* paneName) { + int buttonNo = get_button_no(paneName); + if (buttonNo != -1) { + left_point_event(buttonNo); + mDrag.mbDragging = true; + } + } + + void Address::start_release_event(const char* paneName) { + Button* button = static_cast(System::getScene(SCENE_BUTTON)); + + int buttonNo = -1; + if (paneName != NULL) { + buttonNo = get_button_no(paneName); + if (buttonNo == -1) { + buttonNo = get_button_space_no(paneName); + } + } + + switch (mMode) { + case 0: { + if (isReleasableArea(mPage, buttonNo)) { + u32 friendNo = buttonNo + mPage * BTN_MAX; + u32 dragFriendNo = mDrag.mButton + mDrag.mPage * BTN_MAX; + mSelectedButton = buttonNo; + mChosenFriend = friendNo; + if (friendNo != dragFriendNo) { + mpFriendCache->swap(friendNo, dragFriendNo); + } + snd::getSystem()->startSEwithPos("WIPL_SE_CH_SET", mDrag.mPos.x); + } else { + snd::getSystem()->startSEwithPos("WIPL_SE_CH_NOT_MOVE", mDrag.mPos.x); + } + + System::getPointer()->changeType(mDrag.mChan, 0); + static_cast(System::getScene(SCENE_BUTTON))->enableBtn(); + + mpLayout->FindPaneByName(sTextNameB[mDrag.mButton])->SetVisible(true); + + mDrag.mbDragging = false; + mState = STATE_RELEASE; + reset_friend(); + break; + } + } + } + + void Address::on_point_event(int buttonNo, controller::Interface* con) { + if (mPointCount[buttonNo] == 0) { + if (mbFaceValid[buttonNo]) { + mpLayout->getAnim(buttonNo + 6)->play(); + } else { + mpLayout->getAnim(buttonNo + 21)->play(); + } + + snd::getSystem()->startSE("WIPL_SE_BT_TARGETTING"); + con->rumble(1); + } + + mPointCount[buttonNo]++; + } + + void Address::left_point_event(int buttonNo) { + if (mPointCount[buttonNo] == 1) { + if (mbFaceValid[buttonNo]) { + mpLayout->getAnim(buttonNo + 11)->play(); + } else { + mpLayout->getAnim(buttonNo + 26)->play(); + } + } + + if (mPointCount[buttonNo] > 0) { + mPointCount[buttonNo]--; + } + } + + int Address::get_button_no(const char* paneName) { + int ret = -1; + for (int i = 0; i < BTN_MAX; i++) { + if (strcmp(sButtonName[i], paneName) == 0) { + ret = i; + break; + } + } + + return ret; + } + + int Address::get_button_space_no(const char* paneName) { + int ret = -1; + for (int i = 0; i < BTN_SPACE_MAX; i++) { + if (strcmp(sButtonSpaceName[i], paneName) == 0) { + ret = i; + break; + } + } + + return ret; + } + + void Address::reset_gui(bool bKeepPointed) { + mpGui->init(); + + for (int i = 0; i < BTN_MAX; i++) { + mpLayout->getAnim(i + 6)->initAnmFrame(); + mpLayout->getAnim(i + 6)->calc(); + mpLayout->getAnim(i + 11)->initAnmFrame(); + mpLayout->getAnim(i + 11)->calc(); + mpLayout->getAnim(i + 16)->initAnmFrame(); + mpLayout->getAnim(i + 16)->calc(); + mpLayout->getAnim(i + 21)->initAnmFrame(); + mpLayout->getAnim(i + 21)->calc(); + mpLayout->getAnim(i + 26)->initAnmFrame(); + mpLayout->getAnim(i + 26)->calc(); + mpLayout->getAnim(i + 31)->initAnmFrame(); + mpLayout->getAnim(i + 31)->calc(); + + if (mPointCount[i] != 0 && bKeepPointed) { + if (mbFaceValid[i]) { + mpLayout->getAnim(i + 11)->play(); + } else { + mpLayout->getAnim(i + 26)->play(); + } + } else { + if (mbFaceValid[i]) { + mpLayout->getAnim(i + 6)->initAnmFrame(); + mpLayout->getAnim(i + 6)->calc(); + } else { + mpLayout->getAnim(i + 21)->initAnmFrame(); + mpLayout->getAnim(i + 21)->calc(); + } + } + + mPointCount[i] = 0; + } + } + + BOOL Address::is_selectable(u32 friendNo) { + switch (mMode) { + case 0: { + return mpFriendCache->isThere(friendNo); + } + case SCENE_ADD_WII: { + if (mpFriendCache->isThere(friendNo)) { + return mpFriendCache->getInfo(friendNo).attr.status == NWC24_FRIENDSTATUS_CONFIRMED; + } + return FALSE; + } + case SCENE_ADD_EMAIL: { + if (mpFriendCache->isThere(friendNo)) { + const NWC24FriendInfo& info = mpFriendCache->getInfo(friendNo); + BOOL ret = FALSE; + if (info.attr.status == NWC24_FRIENDSTATUS_CONFIRMED && info.attr.type == NWC24_FRIENDTYPE_WII) { + ret = TRUE; + } + return ret; + } + return FALSE; + } + } + + return FALSE; + } + + void Address::onEventDerived(u32 compId, u32 event, const controller::Interface* con) { + const char* paneName = static_cast(mpManager->getComponent(compId))->getPane()->GetName(); + + switch (event) { + case ::gui::EventHandler::ON_TRIG: { + if (con == NULL) { + break; + } + + if (con->downTrg(controller::BTN_INTERACT)) { + Button* button = static_cast(System::getScene(SCENE_BUTTON)); + if (mState != STATE_COVER_NORMAL && mState != STATE_NORMAL) { + break; + } + + if (Button::cmpButtonName(paneName, Button::BTN_EXIT) == 0) { + MailAddressSelect* mailAddrSel = static_cast(System::getScene(SCENE_MAIL_ADDRESS_SELECT)); + button->animation(Button::IDANIM_SELECT_CALENDAR_EXIT); + + switch (mMode) { + case 0: { + if (mailAddrSel != NULL) { + mailAddrSel->finishAddress(); + } + mpLayout->getAnim(1)->play(); + button->reserveAnm(Button::IDANIM_DISAPPEAR_LEFT_AND_RIGHT_BUTTON); + button->reserveAnm(Button::IDANIM_APPEAR_LEFT_BUTTON); + break; + } + case SCENE_ADD_WII: { + mpLayout->getAnim(3)->play(); + mpDialogLayout->getAnim(1)->play(); + button->reserveAnm(Button::IDANIM_DISAPPEAR_LEFT_BUTTON); + button->reserveAnm(Button::IDANIM_APPEAR_LEFT_BUTTON); + break; + } + case SCENE_ADD_EMAIL: { + mpLayout->getAnim(3)->play(); + mpDialogLayout->getAnim(1)->play(); + button->reserveAnm(Button::IDANIM_DISAPPEAR_LEFT_BUTTON); + button->reserveText(Button::TEXT_LEFT_BUTTON, MESG_CMN_BACK_ALT); + button->reserveText(Button::TEXT_RIGHT_BUTTON, 51); + button->reserveAnm(Button::IDANIM_APPEAR_LEFT_AND_RIGHT_BUTTON); + break; + } + } + + button->animation(Button::IDANIM_ARROW_RIGHT_DISAPPEAR); + button->animation(Button::IDANIM_ARROW_LEFT_DISAPPEAR); + snd::getSystem()->startSE("WIPL_SE_CANCEL"); + mState = STATE_DONE; + } else if (Button::cmpButtonName(paneName, Button::BTN_CREATE_R_BUTTON) == 0) { + mChosenFriend = -1; + entry_friend(); + } else if (Button::cmpButtonName(paneName, Button::BTN_ARROW_RIGHT) == 0) { + button->animation(Button::IDANIM_ARROW_RIGHT_SELECT); + snd::getSystem()->startSE("WIPL_SE_FL_PAGE_INC"); + onNextPage(); + } else if (Button::cmpButtonName(paneName, Button::BTN_ARROW_LEFT) == 0) { + button->animation(Button::IDANIM_ARROW_LEFT_SELECT); + snd::getSystem()->startSE("WIPL_SE_FL_PAGE_DEC"); + onPreviousPage(); + } + break; + } + // fallthrough + } + case ::gui::EventHandler::ON_POINT: { + if (mDrag.mbDragging && (con == NULL || con == System::getControllerManager()->getController(mDrag.mChan))) { + if (Button::cmpButtonName(paneName, Button::BTN_ARROW_LEFT) == 0) { + if (mDrag.mPrevCount < 0) { + mDrag.mPrevCount = 0; + } + } else if (Button::cmpButtonName(paneName, Button::BTN_ARROW_RIGHT) == 0) { + if (mDrag.mNextCount < 0) { + mDrag.mNextCount = 0; + } + } + } + break; + } + case ::gui::EventHandler::ON_LEFT: { + if (mDrag.mbDragging && (con == NULL || con == System::getControllerManager()->getController(mDrag.mChan))) { + if (Button::cmpButtonName(paneName, Button::BTN_ARROW_LEFT) == 0) { + mDrag.mPrevCount = -1; + } else if (Button::cmpButtonName(paneName, Button::BTN_ARROW_RIGHT) == 0) { + mDrag.mNextCount = -1; + } + } + break; + } + } + } + + void Address::onNextPage() { + switch (mState) { + case STATE_INIT: + case STATE_COVER_NORMAL: { + mNextPageNum--; + add_translate(mpLayout->FindPaneByName("N_note_base"), sPageOffset); + mpLayout->getAnim(4)->setAnmType(0); + mpLayout->getAnim(4)->play(); + reset_gui(true); + + for (u32 i = 0; i < BTN_MAX; i++) { + set_friend(sTextNameB[i], i + mPage * BTN_MAX, i, mMiiObj[i], false); + } + + mState = STATE_COVER_FORWARD; + break; + } + case STATE_NORMAL: + case STATE_DRAG: { + if (mPage < PAGE_MAX - 1) { + mPage++; + mNextPageNum--; + add_translate(mpLayout->FindPaneByName("N_note_base"), sPageOffset); + mpLayout->getAnim(5)->setAnmType(0); + mpLayout->getAnim(5)->play(); + set_page_text("T_nmbr_b", mPage + 1); + set_page_text("T_nmbr_c", mPage); + reset_gui(false); + + for (u32 i = 0; i < BTN_MAX; i++) { + set_friend(sTextNameB[i], i + mPage * BTN_MAX, i, mMiiObj[i], false); + set_friend(sTextNameC[i], i + (mPage - 1) * BTN_MAX, i, mNextMiiObj[i], true); + } + + mState = STATE_FORWARD; + } else { + mPage = 0; + mPrevPageNum = 0; + mbCover = true; + mpLayout->getAnim(4)->setAnmType(1); + mpLayout->getAnim(4)->play(); + reset_gui(true); + mState = STATE_LOOP_FORWARD; + } + break; + } + } + } + + void Address::onPreviousPage() { + switch (mState) { + case STATE_COVER_NORMAL: { + mPage = PAGE_MAX - 1; + mNextPageNum = 0; + mbCover = false; + add_translate(mpLayout->FindPaneByName("N_note_base"), sPageOffset * PAGE_MAX); + mpLayout->getAnim(4)->setAnmType(0); + mpLayout->getAnim(4)->play(); + set_page_text("T_nmbr_b", mPage + 1); + reset_gui(false); + + for (u32 i = 0; i < BTN_MAX; i++) { + set_friend(sTextNameB[i], i + mPage * BTN_MAX, i, mMiiObj[i], false); + } + + mState = STATE_LOOP_BACKWARD; + break; + } + case STATE_NORMAL: + case STATE_DRAG: { + if (mPage > 0) { + mPage--; + mPrevPageNum--; + mpLayout->getAnim(5)->setAnmType(1); + mpLayout->getAnim(5)->play(); + set_page_text("T_nmbr_c", mPage + 1); + reset_gui(true); + + for (u32 i = 0; i < BTN_MAX; i++) { + set_friend(sTextNameC[i], i + mPage * BTN_MAX, i, mNextMiiObj[i], true); + } + + mState = STATE_BACKWARD; + } else { + mpLayout->getAnim(4)->setAnmType(1); + mpLayout->getAnim(4)->play(); + reset_gui(true); + mState = STATE_COVER_BACKWARD; + } + break; + } + } + } + + void Address::set_err_msg(wchar_t* errMsg, u32 errMsgLen, NWC24Err err) { + memset(errMsg, 0, errMsgLen * sizeof(wchar_t)); + wcsncat(errMsg, System::getMessage(MESG_ERROR_CODE), errMsgLen - wcslen(errMsg)); + + wchar_t errCode[32]; + memset(errCode, 0, sizeof(errCode)); + swprintf(errCode, ARRAY_LENGTH(errCode), L"%06d\n", System::getNwc24Manager()->getErrCode()); + wcsncat(errMsg, errCode, errMsgLen - wcslen(errMsg)); + + u32 msgId = MESG_ERROR_CODE; + switch (err) { + case NWC24_ERR_NETWORK: { + msgId = MESG_ERROR_NWC24_NETWORK; + break; + } + case NWC24_ERR_SERVER: + case NWC24_ERR_FULL: { + msgId = MESG_ERROR_NWC24_SERVER; + break; + } + } + + wcsncat(errMsg, System::getMessage(msgId), errMsgLen - wcslen(errMsg)); + } + + void Address::entry_friend() { + if (mMode != 0) { + return; + } + + Button* button = static_cast(System::getScene(SCENE_BUTTON)); + + SCParentalControlsInfo pcInfo; + BOOL bGotParental = SCGetParentalControl(&pcInfo); + u32 regFriendNum = mpFriendCache->getRegFriendNum(); + + snd::getSystem()->startSE("WIPL_SE_DECIDE"); + + if (mChosenFriend == -1) { + button->animation(Button::IDANIM_SELECT_CREATE_R); + } + + if (!ncd::NCDSetting::getConnectEnableFlag()) { + System::getDialog()->callBtn2(325, MESG_NETWORK_SETTINGS_BTN, MESG_CMN_QUIT); + mState = STATE_MSG_NET; + } else if (!(SCGetWCFlags() & SC_WC_FLAGS_ENABLED)) { + System::getDialog()->callBtn2(MESG_NETWORK_NO_WC24_CONFIG, MESG_NETWORK_SETTINGS_BTN, MESG_CMN_QUIT); + mState = STATE_MSG_WC; + } else if (bGotParental && (pcInfo.enable & SC_PARENTAL_FLAG_ENABLED) && (SCGetNetContentRestrictions() & 2)) { + System::getDialog()->callBtn1(MESG_NETWORK_PARENTAL_RESTRICT, MESG_CMN_OK); + mState = STATE_MSG_PARENTAL; + } else if (mpFriendCache->check() == NWC24_ERR_NETWORK || mpFriendCache->getLastErr() == NWC24_ERR_SERVER || + mpFriendCache->getLastErr() == NWC24_ERR_FULL) { + wchar_t errMsg[0x400] = {0}; + set_err_msg(errMsg, ARRAY_LENGTH(errMsg), (NWC24Err)mpFriendCache->getLastErr()); + System::getDialog()->callBtn1(errMsg, MESG_CMN_OK); + mState = STATE_MSG_NWC24_ERROR; + } else if (regFriendNum >= FriendListCache::FRIEND_MAX) { + System::getDialog()->callBtn1(80, MESG_CMN_OK); + mState = STATE_MSG_FI_FULL; + } else { + createChildScene(SCENE_ADDRESS_ADD_SELECT, this, NULL, NULL); + button->reserveAnm(Button::IDANIM_DISAPPEAR_LEFT_AND_RIGHT_BUTTON); + button->reserveText(Button::TEXT_LEFT_BUTTON, MESG_CMN_BACK_ALT); + button->reserveAnm(Button::IDANIM_APPEAR_LEFT_BUTTON); + button->setEventHandler(NULL); + mpBackLayout->getAnim(0)->play(); + mState = STATE_WAIT_CHILD_CST; + } + + button->animation(Button::IDANIM_ARROW_RIGHT_DISAPPEAR); + button->animation(Button::IDANIM_ARROW_LEFT_DISAPPEAR); + } + + bool Address::isReleasableArea(int page, int buttonNo) { + if (page < 0 || page >= PAGE_MAX) { + return false; + } + + if (mbCover) { + return false; + } + + if (buttonNo < 0 || buttonNo >= BTN_MAX) { + return false; + } + + if (page == mDrag.mPage && buttonNo == mDrag.mButton) { return true; } + + if (mpFriendCache->isThere(buttonNo + page * BTN_MAX)) { + return false; + } + + return mDrag.mbDragging == true; } - } - return false; -} -extern "C" int init__Q33ipl5scene15FriendListCacheFv(ipl::scene::FriendListCache* self) { - char* address = reinterpret_cast(self); - ipl::nwc24::Manager* manager = ipl::System::getNwc24Manager(); - if (!manager->open()) { - return 0; - } - manager->getMyUserId(reinterpret_cast(address + 0x7d68)); - u32 friendInfoCount; - manager->getNumFriendInfos(&friendInfoCount); - manager->getNumRegFriendInfos(reinterpret_cast(address + 0x7d70)); - u32 index = 0; - int infoOffset = 0; - for (; index < 100; index++, infoOffset += 0x140) { - unsigned char* flagAddress = reinterpret_cast(self) + index; - u8 there = manager->isFriendInfoThere(index); - flagAddress[0x7d00] = there; - if (there) { - manager->readFriendInfo(reinterpret_cast(address + infoOffset), index); + void Address::changePage_onDrag() { + Button* button = static_cast(System::getScene(SCENE_BUTTON)); + if (button->isActive()) { + button->update(); + } + + if (mState == STATE_DRAG || mState == STATE_COVER_NORMAL) { + if (System::getControllerManager()->getController(mDrag.mChan) == NULL || + !System::getControllerManager()->getController(mDrag.mChan)->pinch()) { + mDrag.mbDragging = true; + start_release_event(NULL); + return; + } + } + + set_textbox("T_name_move", (const wchar_t*)mpFriendCache->getInfo(mDrag.mButton + mDrag.mPage * BTN_MAX).attr.name); + + math::VEC2 pos = System::getControllerManager()->getController(mDrag.mChan)->getDpdProjectionPos(); + + if (System::getControllerManager()->getController(mDrag.mChan) != NULL && + System::getControllerManager()->getController(mDrag.mChan)->isValidDpd()) { + nw4r::math::VEC2 move(pos.x - mDrag.mPos.x, pos.y - mDrag.mPos.y); + snd::getSystem()->holdSEwithPosDis("WIPL_SE_CH_DRAG", pos.x, nw4r::math::FSqrt(nw4r::math::VEC2LenSq(&move))); + mDrag.mPos = pos; + } + + nw4r::ut::Rect rect; + nw4r::ut::Rect rect4x3; + System::getProjectionRect(&rect); + System::getProjectionRect4x3(&rect4x3); + + pos.x *= rect4x3.GetWidth() / rect.GetWidth(); + pos.x += mDragOffsetX; + pos.y = -pos.y; + + nw4r::lyt::Pane* movePane = mpLayout->FindPaneByName("N_note_move"); + movePane->SetTranslate(pos); + movePane->SetVisible(true); + + if (mDrag.mPrevCount >= 0) { + mDrag.mPrevCount++; + } + if (mDrag.mNextCount >= 0) { + mDrag.mNextCount++; + } + + if (mDrag.mPrevCount >= 30) { + button->animation(Button::IDANIM_ARROW_LEFT_SELECT); + snd::getSystem()->startSE("WIPL_SE_FL_PAGE_DEC"); + onPreviousPage(); + mDrag.mPrevCount = 0; + mDrag.mNextCount = -1; + } else if (mDrag.mNextCount >= 30) { + button->animation(Button::IDANIM_ARROW_RIGHT_SELECT); + snd::getSystem()->startSE("WIPL_SE_FL_PAGE_INC"); + onNextPage(); + mDrag.mPrevCount = -1; + mDrag.mNextCount = 0; + } } - } - *reinterpret_cast(address + 0x9d74) = 0; - *reinterpret_cast(address + 0x9d78) = 1; - return 1; -} -extern "C" void add__Q33ipl5scene15FriendListCacheFUlRC15NWC24FriendInfo( - ipl::scene::FriendListCache* self, unsigned int index, const NWC24FriendInfo* info) { - char* address = reinterpret_cast(self); - NWC24FriendInfo* records = reinterpret_cast(self); - memcpy(&records[index], info, 0x140); - *(reinterpret_cast(address) + index + 32000) = 1; - int* friendCount = reinterpret_cast(address + 0x7d70); - *friendCount += 1; - writeFriendInfo__Q33ipl5nwc247ManagerFPC15NWC24FriendInfoUl( - ipl::System::getNwc24Manager(), &records[index], index); -} + void Address::movePane_onDrag() { + nw4r::math::VEC3 baseTrans = mpLayout->FindPaneByName("N_base_move")->GetTranslate(); + math::VEC2 pos = System::getControllerManager()->getController(mDrag.mChan)->getDpdProjectionPos(); + nw4r::lyt::TextBox* textBox = static_cast(mpLayout->FindPaneByName("T_name_move")); + const u16* name = mpFriendCache->getInfo(mDrag.mButton + mDrag.mPage * BTN_MAX).attr.name; -extern "C" void update__Q33ipl5scene15FriendListCacheFUlPCwUx( - ipl::scene::FriendListCache* self, unsigned int index, const wchar_t* name, - unsigned long long id) { - reinterpret_cast(self)[index].attr.fdId = id; - memset(reinterpret_cast(self)[index].attr.name, 0, 0x18); - wcsncpy(reinterpret_cast(reinterpret_cast(self)[index].attr.name), - name, 10); - updateFriendInfo__Q33ipl5nwc247ManagerFPC15NWC24FriendInfoUl( - ipl::System::getNwc24Manager(), &reinterpret_cast(self)[index], index); -} + f32 width = 0.0f; + if (textBox != NULL && name != NULL) { + textBox->GetFont()->GetWidth(); + for (; *name != 0; name++) { + width += textBox->GetFont()->GetCharWidth(*name); + } + } + width += 0.01f; -extern "C" void swap__Q33ipl5scene15FriendListCacheFUlUl( - ipl::scene::FriendListCache* self, unsigned int first, unsigned int second) { - NWC24FriendInfo temp __attribute__((aligned(32))); - memcpy(&temp, &reinterpret_cast(self)[first], 0x140); - memcpy(&reinterpret_cast(self)[first], - &reinterpret_cast(self)[second], 0x140); - memcpy(&reinterpret_cast(self)[second], &temp, 0x140); - unsigned char flag = *(reinterpret_cast(self) + first + 32000); - *(reinterpret_cast(self) + first + 32000) = - *(reinterpret_cast(self) + second + 32000); - *(reinterpret_cast(self) + second + 32000) = flag; - swapFriendInfo__Q33ipl5nwc247ManagerFUlUl(ipl::System::getNwc24Manager(), first, second); -} + nw4r::ut::Rect rect; + nw4r::ut::Rect rect4x3; + System::getProjectionRect(&rect); + System::getProjectionRect4x3(&rect4x3); -extern "C" bool isDupMail__Q33ipl5scene15FriendListCacheFPCc(const void* self, - const char* mail) { - const unsigned char* cache = reinterpret_cast(self); - const NWC24FriendInfo* records = reinterpret_cast(self); - int infoOffset; - int flagOffset; - flagOffset = 0; - infoOffset = 0; - for (; flagOffset < 100; flagOffset++, infoOffset += 0x140) { - if (cache[flagOffset + 32000] != 0 && records[flagOffset].attr.type == 2 && - strcmp(records[flagOffset].addr.mailAddr, mail) == 0) { - return true; + if (baseTrans.x + width < pos.x) { + mDragOffsetX = -((baseTrans.x + width) * (rect4x3.GetWidth() / rect.GetWidth())); + } else { + pos.x *= rect4x3.GetWidth() / rect.GetWidth(); + mDragOffsetX = -pos.x; + mDragOffsetX += (mDrag.mPage * sPageOffset.x) * (rect4x3.GetWidth() / rect.GetWidth()); + } } - } - return false; -} -extern "C" int check__Q33ipl5scene15FriendListCacheFv(ipl::scene::FriendListCache* self) { - int result = check__Q33ipl5nwc247ManagerFUl(ipl::System::getNwc24Manager(), 1); - *reinterpret_cast(reinterpret_cast(self) + 0x9d74) = result; - return result; -} + Address::MiiObj::MiiObj() : mpNigaoe(NULL) {} -extern "C" asm void __ml__Q33ipl4math4VEC2CFf() { - stwu r1, -0x10(r1) - mflr r0 - mr r4, r3 - lfs f2, 0(r3) - fmr f3, f1 - lfs f0, 4(r4) - fmuls f1, f2, f1 - stw r0, 0x14(r1) - addi r3, r1, 8 - fmuls f2, f0, f3 - bl __ct__Q33ipl4math4VEC2Fff - lwz r0, 0x14(r1) - mr r4, r3 - lwz r3, 0(r3) - lwz r4, 4(r4) - mtlr r0 - addi r1, r1, 0x10 - blr -} + Address::MiiObj::~MiiObj() { + if (mpNigaoe != NULL) { + delete mpNigaoe; + } + } -extern "C" asm void SetTranslate__Q34nw4r3lyt4PaneFRCQ34nw4r4math4VEC3( - nw4r::lyt::Pane* pane, const nw4r::math::VEC3* translate) { - nofralloc - lfs f2, 0(r4) - lfs f1, 4(r4) - lfs f0, 8(r4) - stfs f2, 0x2c(r3) - stfs f1, 0x30(r3) - stfs f0, 0x34(r3) - blr -} + void Address::MiiObj::init(nw4r::lyt::Pane* pane) { + mpMaterial = pane->GetMaterial(); + mpMaterial->GetTexture(&mTexObj, GX_TEXMAP0); + } + + void Address::MiiObj::set(u64 fdId) { + RFLCreateID createId; + u16 index; + + memcpy(&createId, &fdId, sizeof(RFLCreateID)); + if (RFLSearchOfficialData(&createId, &index)) { + System::getMiiManager()->create(System::getMem2App(), 76, 76, (s16)index, create_callback, this); + } else { + reset(); + } + } + + void Address::MiiObj::reset() { + if (mpNigaoe != NULL) { + mpMaterial->SetTexture(GX_TEXMAP0, mTexObj); + delete mpNigaoe; + mpNigaoe = NULL; + } + } + + void Address::MiiObj::create_callback(nigaoe::Object* object, void* work) { + MiiObj* miiObj = static_cast(work); + + if (miiObj->mpNigaoe != NULL) { + delete miiObj->mpNigaoe; + } + + miiObj->mpNigaoe = object; + miiObj->mpMaterial->SetTexture(GX_TEXMAP0, object->getIconTexture()); + } + + void AddressEvent::onEvent(u32 compId, u32 event, void* data) { + const char* paneName = static_cast(mpManager->getComponent(compId))->getPane()->GetName(); + controller::Interface* con = static_cast(data); + + switch (event) { + case ::gui::EventHandler::ON_POINT: { + if (con != NULL) { + if (mpInstance->mDrag.mbDragging) { + if (con == NULL || con == System::getControllerManager()->getController(mpInstance->mDrag.mChan)) { + mpInstance->start_drag_point_event(paneName, con); + } + } else { + if (paneName[0] == 'B' && mTrigChan == con->getChannel()) { + mTrigChan = -1; + } + mpInstance->start_point_event(paneName, con); + } + } + break; + } + case ::gui::EventHandler::ON_LEFT: { + if (mpInstance->mDrag.mbDragging) { + if (con == NULL || con == System::getControllerManager()->getController(mpInstance->mDrag.mChan)) { + mpInstance->start_drag_left_event(paneName); + } + } else { + mpInstance->start_left_event(paneName); + } + break; + } + case ::gui::EventHandler::ON_DRAG: { + if (mpInstance->mState == Address::STATE_NORMAL && con != NULL && con->decide() && mTrigChan >= 0) { + mpInstance->start_trig_event(paneName); + } + break; + } + case ::gui::EventHandler::ON_TRIG: { + if (mpInstance->mState == Address::STATE_NORMAL && con != NULL) { + mTrigChan = con->getChannel(); + if (con->pinchTrg()) { + mpInstance->start_drag_event(paneName, con); + } + } + break; + } + case ::gui::EventHandler::ON_RELEASE: { + if (mpInstance->mDrag.mbDragging && + (con == NULL || con == System::getControllerManager()->getController(mpInstance->mDrag.mChan)) && !con->pinch()) { + mpInstance->start_release_event(paneName); + } + break; + } + } + } + + BOOL FriendListCache::init() { + nwc24::Manager* manager = System::getNwc24Manager(); + if (!manager->open()) { + return FALSE; + } + + manager->getMyUserId(&mMyUserId); + + u32 friendNum; + manager->getNumFriendInfos(&friendNum); + manager->getNumRegFriendInfos(&mRegFriendNum); + + for (u32 i = 0; i < FRIEND_MAX; i++) { + if ((mbThere[i] = manager->isFriendInfoThere(i))) { + manager->readFriendInfo(&mInfos[i], i); + } + } + + mErrCode = 0; + mbOpened = true; + + return TRUE; + } + + void FriendListCache::fin() { + if (mbOpened) { + System::getNwc24Manager()->close(); + } + } + + void FriendListCache::add(u32 index, const NWC24FriendInfo& info) { + memcpy(&mInfos[index], &info, sizeof(NWC24FriendInfo)); + mbThere[index] = true; + mRegFriendNum++; + System::getNwc24Manager()->writeFriendInfo(&mInfos[index], index); + } + + void FriendListCache::update(u32 index, const wchar_t* name, u64 fdId) { + mInfos[index].attr.fdId = fdId; + memset(mInfos[index].attr.name, 0, sizeof(mInfos[index].attr.name)); + wcsncpy((wchar_t*)mInfos[index].attr.name, name, 10); + System::getNwc24Manager()->updateFriendInfo(&mInfos[index], index); + } + + void FriendListCache::del(u32 index) { + mbThere[index] = false; + mRegFriendNum--; + System::getNwc24Manager()->deleteFriendInfo(index); + } + + void FriendListCache::swap(u32 index1, u32 index2) { + NWC24FriendInfo temp ATTRIBUTE_ALIGN(32); + + memcpy(&temp, &mInfos[index1], sizeof(NWC24FriendInfo)); + memcpy(&mInfos[index1], &mInfos[index2], sizeof(NWC24FriendInfo)); + memcpy(&mInfos[index2], &temp, sizeof(NWC24FriendInfo)); + + bool bThere = mbThere[index1]; + mbThere[index1] = mbThere[index2]; + mbThere[index2] = bThere; + + System::getNwc24Manager()->swapFriendInfo(index1, index2); + } + + BOOL FriendListCache::isValidId(const NWC24UserId& userId) { + return System::getNwc24Manager()->checkUserId(userId); + } + + BOOL FriendListCache::isDupId(const NWC24UserId& userId) { + for (int i = 0; i < FRIEND_MAX; i++) { + if (mbThere[i] && mInfos[i].attr.type == NWC24_FRIENDTYPE_WII && userId == mInfos[i].addr.wiiId) { + return TRUE; + } + } + + return FALSE; + } + + BOOL FriendListCache::isDupMail(const char* mailAddr) { + for (int i = 0; i < FRIEND_MAX; i++) { + if (mbThere[i] && mInfos[i].attr.type == NWC24_FRIENDTYPE_EMAIL && strcmp(mInfos[i].addr.mailAddr, mailAddr) == 0) { + return TRUE; + } + } + + return FALSE; + } + + void FriendListCache::sendRegisterMail(u32 index) { + const NWC24FriendInfo& info = mInfos[index]; + nwc24::Manager* manager = System::getNwc24Manager(); + + NWC24MsgObj msgObj; + manager->initMsgObj(&msgObj, NWC24_MSGTYPE_PUBLIC); + manager->setMsgToAddr(&msgObj, info.addr.mailAddr, strlen(info.addr.mailAddr)); + + const wchar_t* subject = System::getMessage(385); + + wchar_t text[0x400]; + wcscpy(text, System::getMessage(386)); + + if (mMyUserId != 1234567890123456ULL) { + wchar_t idStr[17]; + swprintf(idStr, ARRAY_LENGTH(idStr), L"%016lld", mMyUserId); + + wchar_t* pos; + while ((pos = wcsstr(text, L"1234567890123456")) != NULL) { + for (int i = 0; i < 16; i++) { + pos[i] = idStr[i]; + } + } + } + + memset(mSendWork, 0, sizeof(mSendWork)); + manager->setMsgSubjectAndTextPublic(&msgObj, (const u16*)subject, wcslen(subject), (const u16*)text, wcslen(text), mSendWork, + sizeof(mSendWork)); + manager->commitMsg(&msgObj); + } + + s32 FriendListCache::check() { + return mErrCode = System::getNwc24Manager()->check(1); + } + + s32 FriendListCache::getErrCode() const { + return System::getNwc24Manager()->getErrCode(); + } + } // namespace scene +} // namespace ipl -- 2.49.1 From 0610dd254d048932bac87c5a8b886a48e72410c7 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 19:28:23 +0000 Subject: [PATCH 3/6] match address page advance --- include/scene/address/iplAddress.h | 2 +- src/scene/address/iplAddress.cpp | 35 ++++++++++++++++-------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/include/scene/address/iplAddress.h b/include/scene/address/iplAddress.h index 5f1bbc77..9dd35f28 100644 --- a/include/scene/address/iplAddress.h +++ b/include/scene/address/iplAddress.h @@ -239,7 +239,7 @@ namespace ipl { int mFadeinState; // 0xA4 int mWaitOpenCount; // 0xA8 int mState; // 0xAC - u32 mPage; // 0xB0 + int mPage; // 0xB0 int mNextPageNum; // 0xB4 int mPrevPageNum; // 0xB8 int mSelectedButton; // 0xBC diff --git a/src/scene/address/iplAddress.cpp b/src/scene/address/iplAddress.cpp index 242a4d91..67b9cd1e 100644 --- a/src/scene/address/iplAddress.cpp +++ b/src/scene/address/iplAddress.cpp @@ -538,7 +538,10 @@ namespace ipl { void Address::stt_cover_backward() { if (!mpLayout->getAnim(4)->isPlaying()) { - add_translate(mpLayout->FindPaneByName("N_note_base"), -sPageOffset); + math::VEC2 offset = sPageOffset; + offset.y = -offset.y; + offset.x = -offset.x; + add_translate(mpLayout->FindPaneByName("N_note_base"), offset); mbCover = true; mNextPageNum++; mState = STATE_COVER_NORMAL; @@ -1476,21 +1479,6 @@ namespace ipl { void Address::onNextPage() { switch (mState) { - case STATE_INIT: - case STATE_COVER_NORMAL: { - mNextPageNum--; - add_translate(mpLayout->FindPaneByName("N_note_base"), sPageOffset); - mpLayout->getAnim(4)->setAnmType(0); - mpLayout->getAnim(4)->play(); - reset_gui(true); - - for (u32 i = 0; i < BTN_MAX; i++) { - set_friend(sTextNameB[i], i + mPage * BTN_MAX, i, mMiiObj[i], false); - } - - mState = STATE_COVER_FORWARD; - break; - } case STATE_NORMAL: case STATE_DRAG: { if (mPage < PAGE_MAX - 1) { @@ -1520,6 +1508,21 @@ namespace ipl { } break; } + case STATE_INIT: + case STATE_COVER_NORMAL: { + mNextPageNum--; + add_translate(mpLayout->FindPaneByName("N_note_base"), sPageOffset); + mpLayout->getAnim(4)->setAnmType(0); + mpLayout->getAnim(4)->play(); + reset_gui(true); + + for (u32 i = 0; i < BTN_MAX; i++) { + set_friend(sTextNameB[i], i + mPage * BTN_MAX, i, mMiiObj[i], false); + } + + mState = STATE_COVER_FORWARD; + break; + } } } -- 2.49.1 From 100753b3b7e6f9b2e629c646a2b2114f50f658b7 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 19:32:02 +0000 Subject: [PATCH 4/6] match address page rewind --- src/scene/address/iplAddress.cpp | 37 +++++++++++++++++--------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/scene/address/iplAddress.cpp b/src/scene/address/iplAddress.cpp index 67b9cd1e..3264fa37 100644 --- a/src/scene/address/iplAddress.cpp +++ b/src/scene/address/iplAddress.cpp @@ -1528,23 +1528,6 @@ namespace ipl { void Address::onPreviousPage() { switch (mState) { - case STATE_COVER_NORMAL: { - mPage = PAGE_MAX - 1; - mNextPageNum = 0; - mbCover = false; - add_translate(mpLayout->FindPaneByName("N_note_base"), sPageOffset * PAGE_MAX); - mpLayout->getAnim(4)->setAnmType(0); - mpLayout->getAnim(4)->play(); - set_page_text("T_nmbr_b", mPage + 1); - reset_gui(false); - - for (u32 i = 0; i < BTN_MAX; i++) { - set_friend(sTextNameB[i], i + mPage * BTN_MAX, i, mMiiObj[i], false); - } - - mState = STATE_LOOP_BACKWARD; - break; - } case STATE_NORMAL: case STATE_DRAG: { if (mPage > 0) { @@ -1568,6 +1551,26 @@ namespace ipl { } break; } + case STATE_COVER_NORMAL: { + mPage = PAGE_MAX - 1; + mNextPageNum = 0; + mbCover = false; + math::VEC2 offset; + offset.x = sPageOffset.x * PAGE_MAX; + offset.y = sPageOffset.y * PAGE_MAX; + add_translate(mpLayout->FindPaneByName("N_note_base"), offset); + mpLayout->getAnim(4)->setAnmType(0); + mpLayout->getAnim(4)->play(); + set_page_text("T_nmbr_b", mPage + 1); + reset_gui(false); + + for (u32 i = 0; i < BTN_MAX; i++) { + set_friend(sTextNameB[i], i + mPage * BTN_MAX, i, mMiiObj[i], false); + } + + mState = STATE_LOOP_BACKWARD; + break; + } } } -- 2.49.1 From 4f12963a32c718560855a317650314a96118b6fb Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 19:46:55 +0000 Subject: [PATCH 5/6] match address friend cache types --- include/scene/address/iplAddress.h | 4 ++-- src/scene/address/iplAddress.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/scene/address/iplAddress.h b/include/scene/address/iplAddress.h index 9dd35f28..8e767e17 100644 --- a/include/scene/address/iplAddress.h +++ b/include/scene/address/iplAddress.h @@ -41,14 +41,14 @@ namespace ipl { s32 getErrCode() const; const NWC24FriendInfo& getInfo(int index) const { return mInfos[index]; } - bool isThere(u32 index) const { return mbThere[index]; } + BOOL isThere(u32 index) const { return mbThere[index]; } u32 getRegFriendNum() const { return mRegFriendNum; } NWC24UserId getMyUserId() const { return mMyUserId; } s32 getLastErr() const { return mErrCode; } private: NWC24FriendInfo mInfos[FRIEND_MAX]; // 0x0000 - bool mbThere[FRIEND_MAX]; // 0x7D00 + u8 mbThere[FRIEND_MAX]; // 0x7D00 NWC24UserId mMyUserId; // 0x7D68 u32 mRegFriendNum; // 0x7D70 u8 mSendWork[0x2000]; // 0x7D74 diff --git a/src/scene/address/iplAddress.cpp b/src/scene/address/iplAddress.cpp index 3264fa37..89e8d6e5 100644 --- a/src/scene/address/iplAddress.cpp +++ b/src/scene/address/iplAddress.cpp @@ -1918,7 +1918,7 @@ namespace ipl { memcpy(&mInfos[index1], &mInfos[index2], sizeof(NWC24FriendInfo)); memcpy(&mInfos[index2], &temp, sizeof(NWC24FriendInfo)); - bool bThere = mbThere[index1]; + u8 bThere = mbThere[index1]; mbThere[index1] = mbThere[index2]; mbThere[index2] = bThere; @@ -1930,7 +1930,7 @@ namespace ipl { } BOOL FriendListCache::isDupId(const NWC24UserId& userId) { - for (int i = 0; i < FRIEND_MAX; i++) { + for (u32 i = 0; i < FRIEND_MAX; i++) { if (mbThere[i] && mInfos[i].attr.type == NWC24_FRIENDTYPE_WII && userId == mInfos[i].addr.wiiId) { return TRUE; } -- 2.49.1 From f58230e320a7dad9efb68818c0f1147964cd174d Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 19:50:34 +0000 Subject: [PATCH 6/6] match address error message codegen --- src/scene/address/iplAddress.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scene/address/iplAddress.cpp b/src/scene/address/iplAddress.cpp index 89e8d6e5..6eee598c 100644 --- a/src/scene/address/iplAddress.cpp +++ b/src/scene/address/iplAddress.cpp @@ -1577,13 +1577,13 @@ namespace ipl { void Address::set_err_msg(wchar_t* errMsg, u32 errMsgLen, NWC24Err err) { memset(errMsg, 0, errMsgLen * sizeof(wchar_t)); wcsncat(errMsg, System::getMessage(MESG_ERROR_CODE), errMsgLen - wcslen(errMsg)); + u32 msgId = MESG_ERROR_CODE; wchar_t errCode[32]; memset(errCode, 0, sizeof(errCode)); swprintf(errCode, ARRAY_LENGTH(errCode), L"%06d\n", System::getNwc24Manager()->getErrCode()); wcsncat(errMsg, errCode, errMsgLen - wcslen(errMsg)); - u32 msgId = MESG_ERROR_CODE; switch (err) { case NWC24_ERR_NETWORK: { msgId = MESG_ERROR_NWC24_NETWORK; -- 2.49.1