From 11fd159ae811866fcbfdeb7ec558b5809dda9c50 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Jan 2020 11:17:38 -0500 Subject: Port link_rfu from Emerald --- include/link_rfu.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'include') diff --git a/include/link_rfu.h b/include/link_rfu.h index 033f4c8d4..602d7fa64 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -9,6 +9,65 @@ struct Padded_U8 u8 value; }; +struct UnkLinkRfuStruct_02022B2C +{ + u8 unk_00; + u8 unk_01; + u16 unk_02; + u8 unk_04; + u16 unk_06; + struct UnkLinkRfuStruct_02022B14 *unk_08; + u8 *unk_0c; + u8 unk_10; + u8 unk_11; + u16 unk_12; + u16 unk_14; +}; + +struct UnkRfuStruct_1 +{ + /* 0x000 */ u8 unk_00; + /* 0x001 */ u8 unk_01; + /* 0x002 */ vu8 unk_02; + /* 0x003 */ vu8 unk_03; + /* 0x004 */ u8 unk_04; + /* 0x005 */ u8 unk_05; + /* 0x006 */ u8 unk_06; + /* 0x007 */ u8 unk_07; + /* 0x008 */ u8 unk_08; + /* 0x009 */ u8 unk_09; + /* 0x00a */ u8 unk_0a; + /* 0x00b */ u8 unk_0b; + /* 0x00c */ u8 unk_0c; + /* 0x00d */ u8 unk_0d; + /* 0x00e */ u8 unk_0e; + /* 0x00f */ u8 unk_0f; + /* 0x010 */ u8 unk_10; + /* 0x011 */ u8 unk_11; + /* 0x012 */ u8 unk_12; + // aligned + /* 0x014 */ u16 unk_14; + /* 0x016 */ u16 unk_16; + /* 0x018 */ u16 unk_18; + /* 0x01a */ u16 unk_1a; + /* 0x01c */ u16 unk_1c; + /* 0x01e */ u16 unk_1e; + /* 0x020 */ const u16 *unk_20; + /* 0x024 */ u8 unk_24; + /* 0x026 */ u16 unk_26; + /* 0x028 */ u16 unk_28[4]; + /* 0x030 */ u8 unk_30; + // aligned + /* 0x032 */ u16 unk_32; + /* 0x034 */ u16 unk_34[4]; + /* 0x03c */ const struct UnkLinkRfuStruct_02022B2C *unk_3c; + /* 0x040 */ void (*unk_40)(u8, u8); + /* 0x044 */ void (*unk_44)(u16); + /* 0x048 */ u8 filler_48[8]; + /* 0x050 */ u32 unk_50[0x399]; + /* 0xeb4 */ u8 filler_e64[12]; +}; + void AddTextPrinterToWindow1(const u8 *str); bool32 MG_PrintTextOnWindow1AndWaitButton(u8 * cmdPtr, const u8 * src); void sub_80FA190(void); -- cgit v1.2.3 From ce60043a58c4c480850fde2e40961cf2d064adbe Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Jan 2020 11:20:35 -0500 Subject: link_rfu COMMON syms --- include/link_rfu.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/link_rfu.h b/include/link_rfu.h index 602d7fa64..05e8a69a0 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -64,8 +64,6 @@ struct UnkRfuStruct_1 /* 0x040 */ void (*unk_40)(u8, u8); /* 0x044 */ void (*unk_44)(u16); /* 0x048 */ u8 filler_48[8]; - /* 0x050 */ u32 unk_50[0x399]; - /* 0xeb4 */ u8 filler_e64[12]; }; void AddTextPrinterToWindow1(const u8 *str); -- cgit v1.2.3 From 28a2bb7c934893cdc22cc617f83dcef033875801 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Jan 2020 11:21:55 -0500 Subject: Remove unneeded filler --- include/link_rfu.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/link_rfu.h b/include/link_rfu.h index 05e8a69a0..f83a33a65 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -63,7 +63,6 @@ struct UnkRfuStruct_1 /* 0x03c */ const struct UnkLinkRfuStruct_02022B2C *unk_3c; /* 0x040 */ void (*unk_40)(u8, u8); /* 0x044 */ void (*unk_44)(u16); - /* 0x048 */ u8 filler_48[8]; }; void AddTextPrinterToWindow1(const u8 *str); -- cgit v1.2.3 From 6daa05332016d1410036f465f317ce463c5a3ac6 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Jan 2020 11:25:42 -0500 Subject: Static syms --- include/link_rfu.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/link_rfu.h b/include/link_rfu.h index f83a33a65..e3b2243b9 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -104,6 +104,7 @@ void var_800D_set_xB(void); struct UnkLinkRfuStruct_02022B14 *sub_80F9800(void); void sub_80FCF34(void); void InitRFU(void); +void sub_80FEB14(void); #include "mevent_server.h" extern const struct mevent_server_cmd gMEventSrvScript_OtherTrainerCanceled[]; -- cgit v1.2.3 From 2a5cde336bd55fdc07cf0293d36fb854c2313811 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Jan 2020 14:04:02 -0500 Subject: Address review comments --- include/librfu.h | 2 +- include/link_rfu.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/librfu.h b/include/librfu.h index cf409ca69..1b8e6573f 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -616,7 +616,7 @@ u16 rfu_changeSendTarget(u8 connType, u8 slotStatusIndex, u8 bmNewTgtSlot); // Functions for sending/receiving data to RFU // Data transmission -void rfu_REQ_sendData(u8 clockChangeFlag); +void rfu_REQ_sendData(bool8 clockChangeFlag); // Used only by parent device. Resend previous sent data (packet) void rfu_REQ_PARENT_resumeRetransmitAndChange(void); // Read receive data diff --git a/include/link_rfu.h b/include/link_rfu.h index e3b2243b9..8ee7674cf 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -55,11 +55,11 @@ struct UnkRfuStruct_1 /* 0x020 */ const u16 *unk_20; /* 0x024 */ u8 unk_24; /* 0x026 */ u16 unk_26; - /* 0x028 */ u16 unk_28[4]; + /* 0x028 */ u16 unk_28[RFU_CHILD_MAX]; /* 0x030 */ u8 unk_30; // aligned /* 0x032 */ u16 unk_32; - /* 0x034 */ u16 unk_34[4]; + /* 0x034 */ u16 unk_34[RFU_CHILD_MAX]; /* 0x03c */ const struct UnkLinkRfuStruct_02022B2C *unk_3c; /* 0x040 */ void (*unk_40)(u8, u8); /* 0x044 */ void (*unk_44)(u16); -- cgit v1.2.3 From eec9e0d914f79683957127158be914b719e9a7d0 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Jan 2020 17:03:36 -0500 Subject: Split link_rfu_2 --- include/global.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/global.h b/include/global.h index d8ea62d5c..6386071c4 100644 --- a/include/global.h +++ b/include/global.h @@ -712,6 +712,12 @@ struct TrainerRematchState u8 rematches[100]; }; +struct TrainerNameRecord +{ + u32 trainerId; + u8 trainerName[PLAYER_NAME_LENGTH]; +}; + struct SaveBlock1 { /*0x0000*/ struct Coords16 pos; @@ -766,7 +772,8 @@ struct SaveBlock1 /*0x3A18*/ u8 seen2[DEX_FLAGS_NO]; /*0x3A4C*/ u8 rivalName[PLAYER_NAME_LENGTH]; /*0x3A54*/ struct FameCheckerSaveData fameChecker[NUM_FAMECHECKER_PERSONS]; - /*0x3A94*/ u8 filler3A94[0x204]; + /*0x3A94*/ u8 filler3A94[0x114]; + /*0x3BA8*/ struct TrainerNameRecord trainerNameRecords[20]; /*0x3C98*/ struct DaycareMon route5DayCareMon; /*0x3D24*/ u8 filler3D24[0x10]; /*0x3D34*/ u32 unkArrayIdx; -- cgit v1.2.3 From 36306a82d131eee74c48e0ca6e66fff97dcffac2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Jan 2020 20:40:47 -0500 Subject: link_rfu_2 through sub_80F8F5C --- include/link_rfu.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'include') diff --git a/include/link_rfu.h b/include/link_rfu.h index 8ee7674cf..7f695ebe2 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -24,6 +24,20 @@ struct UnkLinkRfuStruct_02022B2C u16 unk_14; }; +struct UnkLinkRfuStruct_02022B44 +{ + u8 fill_00[6]; + u16 unk_06; + u8 fill_08[6]; + vu8 unk_0e; + u8 unk_0f; + u8 fill_10[0x54]; + u16 unk_64; + u8 fill_66[0x1d]; + u8 unk_83; + u8 fill_84[0x58]; +}; + struct UnkRfuStruct_1 { /* 0x000 */ u8 unk_00; @@ -65,6 +79,26 @@ struct UnkRfuStruct_1 /* 0x044 */ void (*unk_44)(u16); }; +struct UnkRfuStruct_2_Sub_124 +{ + /* 0x000 */ u8 unk_00[20][70]; + /* 0x578 */ vu8 unk_8c0; + /* 0x579 */ vu8 unk_8c1; + /* 0x57a */ vu8 unk_8c2; + /* 0x57b */ vu8 unk_8c3; +}; + +struct UnkRfuStruct_2_Sub_9e8 +{ + /* 0x000 */ u8 unk_00[40][14]; + /* 0x230 */ vu8 unk_230; + /* 0x231 */ vu8 unk_231; + /* 0x232 */ vu8 unk_232; + /* 0x233 */ vu8 unk_233; +}; + +extern struct UnkRfuStruct_1 gUnknown_3005E10; + void AddTextPrinterToWindow1(const u8 *str); bool32 MG_PrintTextOnWindow1AndWaitButton(u8 * cmdPtr, const u8 * src); void sub_80FA190(void); @@ -106,6 +140,20 @@ void sub_80FCF34(void); void InitRFU(void); void sub_80FEB14(void); +void sub_80FC478(struct UnkRfuStruct_2_Sub_124 *ptr); +void sub_80FC4D4(struct UnkRfuStruct_2_Sub_9e8 *ptr); + +void sub_80FD4B0(const struct UnkLinkRfuStruct_02022B2C *unk0); +u8 sub_80FD538(u8 r5, u16 r7, u16 r8, const u16 *r6); +void sub_80FD760(bool8 a0); +void sub_80FEA10(void (*func)(u16)); +void sub_80FB9E4(u8 a0, u16 a1); +u8 sub_80FB9F4(void); +void LinkRfu_REQ_SendData_HandleParentRelationship(bool8 clockChangeFlag); +void sub_80FC588(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2); +void sub_80FD52C(void); +u8 sub_80FD610(u16 parentId, u16 unk_1a); + #include "mevent_server.h" extern const struct mevent_server_cmd gMEventSrvScript_OtherTrainerCanceled[]; -- cgit v1.2.3 From d9ea5a08159ededd81fc0d8c33b0270b925081b6 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Jan 2020 22:08:11 -0500 Subject: link_rfu_2 through rfufunc_80FA020 --- include/link.h | 1 + include/link_rfu.h | 16 +++++++++++++++- include/overworld.h | 25 +++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/link.h b/include/link.h index d61152d8a..bb3ffbb2f 100644 --- a/include/link.h +++ b/include/link.h @@ -188,6 +188,7 @@ extern bool8 gLinkVSyncDisabled; extern u8 gWirelessCommType; extern u8 gShouldAdvanceLinkState; +extern u16 gLinkPartnersHeldKeys[6]; void Task_DestroySelf(u8); void OpenLink(void); diff --git a/include/link_rfu.h b/include/link_rfu.h index 7f695ebe2..cb315f31d 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -97,6 +97,14 @@ struct UnkRfuStruct_2_Sub_9e8 /* 0x233 */ vu8 unk_233; }; +struct UnkRfuStruct_2_Sub_c1c +{ + /* 0x00 */ u8 unk_00[2][14]; + /* 0x1c */ vu8 unk_1c; + /* 0x1d */ vu8 unk_1d; + /* 0x1e */ vu8 unk_1e; +}; + extern struct UnkRfuStruct_1 gUnknown_3005E10; void AddTextPrinterToWindow1(const u8 *str); @@ -120,7 +128,7 @@ void Rfu_set_zero(void); u8 GetRfuPlayerCount(void); void sub_80F9828(void); u8 rfu_get_multiplayer_id(void); -bool8 Rfu_InitBlockSend(const void * src, u16 size); +bool32 Rfu_InitBlockSend(const u8 * src, size_t size); bool8 sub_80FA0F8(u8 a0); u8 Rfu_GetBlockReceivedStatus(void); void Rfu_SetBlockReceivedFlag(u8 who); @@ -139,6 +147,7 @@ struct UnkLinkRfuStruct_02022B14 *sub_80F9800(void); void sub_80FCF34(void); void InitRFU(void); void sub_80FEB14(void); +bool32 sub_80FBA00(void); void sub_80FC478(struct UnkRfuStruct_2_Sub_124 *ptr); void sub_80FC4D4(struct UnkRfuStruct_2_Sub_9e8 *ptr); @@ -153,6 +162,11 @@ void LinkRfu_REQ_SendData_HandleParentRelationship(bool8 clockChangeFlag); void sub_80FC588(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2); void sub_80FD52C(void); u8 sub_80FD610(u16 parentId, u16 unk_1a); +bool8 sub_80FC79C(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2); +bool8 sub_80FC888(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2); +bool8 sub_80FC828(struct UnkRfuStruct_2_Sub_c1c *q1, const u8 *q2); +bool8 sub_80FC6E8(struct UnkRfuStruct_2_Sub_124 * a0, u8 *a1); +bool8 sub_80FC63C(struct UnkRfuStruct_2_Sub_9e8 * a0, u8 *a1); #include "mevent_server.h" extern const struct mevent_server_cmd gMEventSrvScript_OtherTrainerCanceled[]; diff --git a/include/overworld.h b/include/overworld.h index 69c1e964f..c24b63cf9 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -4,6 +4,29 @@ #include "global.h" #include "main.h" +#define LINK_KEY_CODE_NULL 0x00 +#define LINK_KEY_CODE_EMPTY 0x11 +#define LINK_KEY_CODE_DPAD_DOWN 0x12 +#define LINK_KEY_CODE_DPAD_UP 0x13 +#define LINK_KEY_CODE_DPAD_LEFT 0x14 +#define LINK_KEY_CODE_DPAD_RIGHT 0x15 +#define LINK_KEY_CODE_UNK_2 0x16 +#define LINK_KEY_CODE_EXIT_ROOM 0x17 +#define LINK_KEY_CODE_START_BUTTON 0x18 +#define LINK_KEY_CODE_A_BUTTON 0x19 +#define LINK_KEY_CODE_UNK_4 0x1A // I'd guess this is the B button? + +// These two are a hack to stop user input until link stuff can be +// resolved. +#define LINK_KEY_CODE_HANDLE_RECV_QUEUE 0x1B +#define LINK_KEY_CODE_HANDLE_SEND_QUEUE 0x1C +#define LINK_KEY_CODE_UNK_7 0x1D +#define LINK_KEY_CODE_UNK_8 0x1E + +#define MOVEMENT_MODE_FREE 0 +#define MOVEMENT_MODE_FROZEN 1 +#define MOVEMENT_MODE_SCRIPTED 2 + struct UnkPlayerStruct { u8 player_field_0; @@ -153,4 +176,6 @@ void sub_805546C(u8 a0); bool32 sub_80582E0(void); bool32 sub_8058274(void); +extern u16 gHeldKeyCodeToSend; + #endif //GUARD_OVERWORLD_H -- cgit v1.2.3 From b76b38c257e36ce13b32f95ed726175efddb1478 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 14 Jan 2020 12:27:56 -0500 Subject: Finish porting link_rfu_2 --- include/link.h | 16 ++++++++++++++++ include/link_rfu.h | 9 ++++++++- include/mystery_gift_menu.h | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/link.h b/include/link.h index bb3ffbb2f..4175ac97f 100644 --- a/include/link.h +++ b/include/link.h @@ -65,6 +65,19 @@ #define LINKCMD_SEND_HELD_KEYS_2 0xCAFE #define LINKCMD_0xCCCC 0xCCCC +#define LINKTYPE_0x1111 0x1111 // trade +#define LINKTYPE_0x1122 0x1122 // trade +#define LINKTYPE_0x1133 0x1133 // trade +#define LINKTYPE_0x1144 0x1144 // trade +#define LINKTYPE_BATTLE 0x2211 +#define LINKTYPE_0x2222 0x2222 // unused battle? +#define LINKTYPE_SINGLE_BATTLE 0x2233 +#define LINKTYPE_DOUBLE_BATTLE 0x2244 +#define LINKTYPE_MULTI_BATTLE 0x2255 +#define LINKTYPE_BATTLE_TOWER_50 0x2266 +#define LINKTYPE_BATTLE_TOWER_OPEN 0x2277 +#define LINKTYPE_BATTLE_TOWER 0x2288 + #define MASTER_HANDSHAKE 0x8FFF #define SLAVE_HANDSHAKE 0xB9A0 @@ -262,5 +275,8 @@ bool8 IsWirelessAdapterConnected(void); bool8 sub_800A474(u8 a0); void LinkVSync(void); bool8 HandleLinkConnection(void); +void sub_800B0B4(void); +void sub_800B110(u32 who); +void sub_800ACBC(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, u8 unk_06); #endif // GUARD_LINK_H diff --git a/include/link_rfu.h b/include/link_rfu.h index cb315f31d..a5c60fd52 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -109,7 +109,7 @@ extern struct UnkRfuStruct_1 gUnknown_3005E10; void AddTextPrinterToWindow1(const u8 *str); bool32 MG_PrintTextOnWindow1AndWaitButton(u8 * cmdPtr, const u8 * src); -void sub_80FA190(void); +void LinkRfu_FatalError(void); void MG_DrawCheckerboardPattern(void); void task_add_05_task_del_08FA224_when_no_RfuFunc(void); bool8 IsLinkRfuTaskFinished(void); @@ -167,6 +167,13 @@ bool8 sub_80FC888(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2); bool8 sub_80FC828(struct UnkRfuStruct_2_Sub_c1c *q1, const u8 *q2); bool8 sub_80FC6E8(struct UnkRfuStruct_2_Sub_124 * a0, u8 *a1); bool8 sub_80FC63C(struct UnkRfuStruct_2_Sub_9e8 * a0, u8 *a1); +u8 sub_80FEA34(u8 a0, u16 a1); +void sub_80FDA30(u32 a0); +void sub_80FCB54(struct UnkLinkRfuStruct_02022B14 *data, u8 r9, bool32 r2, s32 r3); +void rfu_syncVBlank_(void); +s32 sub_80FD430(void (*func1)(u8, u8), void (*func2)(u16)); +void sub_80FEB3C(void); +void sub_80FAFE0(u8 a0); #include "mevent_server.h" extern const struct mevent_server_cmd gMEventSrvScript_OtherTrainerCanceled[]; diff --git a/include/mystery_gift_menu.h b/include/mystery_gift_menu.h index 6fed52119..32624d602 100644 --- a/include/mystery_gift_menu.h +++ b/include/mystery_gift_menu.h @@ -6,5 +6,6 @@ extern bool8 gGiftIsFromEReader; void MainCB_FreeAllBuffersAndReturnToInitTitleScreen(void); void PrintMysteryGiftOrEReaderTopMenu(bool8, bool32); void c2_mystery_gift(void); +void c2_mystery_gift_e_reader_run(void); #endif //GUARD_MYSTERY_GIFT_MENU_H -- cgit v1.2.3 From 246e3461c78b8d6fb74cfadcfb9c72690b070069 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 14 Jan 2020 12:41:43 -0500 Subject: Move GFtgtGname out of librfu.h --- include/librfu.h | 28 ---------------------------- include/link_rfu.h | 34 +++++++++++++++++++++++++++++++--- include/trade.h | 6 +++--- include/union_room.h | 4 ++-- 4 files changed, 36 insertions(+), 36 deletions(-) (limited to 'include') diff --git a/include/librfu.h b/include/librfu.h index 1b8e6573f..97fd8044e 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -275,34 +275,6 @@ // Status data for UNI-type communication (refer to gRfuSlotStatusUNI[x]->send.state) #define SLOT_STATE_SEND_UNI (SLOT_BUSY_FLAG | SLOT_SEND_FLAG | LCOM_UNI) // Transmitting -// TODO: move the 2 structs to some other header as they're declared by GF -struct UnkLinkRfuStruct_02022B14Substruct -{ - u16 unk_00_0:4; - u16 unk_00_4:1; - u16 unk_00_5:1; - u16 unk_00_6:1; - u16 isChampion:1; - u16 hasNationalDex:1; - u16 gameClear:1; - u16 unk_01_2:4; - u16 unk_01_6:2; - u8 playerTrainerId[2]; -}; - -struct __attribute__((packed, aligned(2))) UnkLinkRfuStruct_02022B14 -{ - struct UnkLinkRfuStruct_02022B14Substruct unk_00; - u8 unk_04[4]; - u16 species:10; - u16 type:6; - u8 unk_0a_0:7; - u8 unk_0a_7:1; - u8 playerGender:1; - u8 level:7; - u8 unk_0c; -}; - // the following structs are not documented in SDK struct RfuPacket8 { diff --git a/include/link_rfu.h b/include/link_rfu.h index a5c60fd52..b7321b025 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -4,6 +4,34 @@ #include "global.h" #include "librfu.h" +// RfuTgtData.gname is read as these structs. +struct GFtgtGnameSub +{ + u16 unk_00_0:4; + u16 unk_00_4:1; + u16 unk_00_5:1; + u16 unk_00_6:1; + u16 isChampion:1; + u16 hasNationalDex:1; + u16 gameClear:1; + u16 unk_01_2:4; + u16 unk_01_6:2; + u8 playerTrainerId[2]; +}; + +struct __attribute__((packed, aligned(2))) GFtgtGname +{ + struct GFtgtGnameSub unk_00; + u8 unk_04[4]; + u16 species:10; + u16 type:6; + u8 unk_0a_0:7; + u8 unk_0a_7:1; + u8 playerGender:1; + u8 level:7; + u8 unk_0c; +}; + struct Padded_U8 { u8 value; @@ -16,7 +44,7 @@ struct UnkLinkRfuStruct_02022B2C u16 unk_02; u8 unk_04; u16 unk_06; - struct UnkLinkRfuStruct_02022B14 *unk_08; + struct GFtgtGname *unk_08; u8 *unk_0c; u8 unk_10; u8 unk_11; @@ -143,7 +171,7 @@ void sub_80F8DC0(void); void sub_80FBB20(void); bool8 sub_80FA484(bool32 a0); void var_800D_set_xB(void); -struct UnkLinkRfuStruct_02022B14 *sub_80F9800(void); +struct GFtgtGname *sub_80F9800(void); void sub_80FCF34(void); void InitRFU(void); void sub_80FEB14(void); @@ -169,7 +197,7 @@ bool8 sub_80FC6E8(struct UnkRfuStruct_2_Sub_124 * a0, u8 *a1); bool8 sub_80FC63C(struct UnkRfuStruct_2_Sub_9e8 * a0, u8 *a1); u8 sub_80FEA34(u8 a0, u16 a1); void sub_80FDA30(u32 a0); -void sub_80FCB54(struct UnkLinkRfuStruct_02022B14 *data, u8 r9, bool32 r2, s32 r3); +void sub_80FCB54(struct GFtgtGname *data, u8 r9, bool32 r2, s32 r3); void rfu_syncVBlank_(void); s32 sub_80FD430(void (*func1)(u8, u8), void (*func2)(u16)); void sub_80FEB3C(void); diff --git a/include/trade.h b/include/trade.h index 030a03a83..d5106b172 100644 --- a/include/trade.h +++ b/include/trade.h @@ -2,7 +2,7 @@ #define GUARD_TRADE_H #include "global.h" -#include "librfu.h" +#include "link_rfu.h" #include "constants/trade.h" extern struct MailStruct gLinkPartnerMail[6]; @@ -11,7 +11,7 @@ extern u8 gSelectedTradeMonPositions[2]; extern const u16 gUnknown_826601C[]; void CB2_ReturnFromLinkTrade(void); s32 sub_804FB34(void); -s32 CanRegisterMonForTradingBoard(struct UnkLinkRfuStruct_02022B14Substruct rfuPlayer, u16 species2, u16 species, u8 isObedientBitSet); -s32 GetUnionRoomTradeMessageId(struct UnkLinkRfuStruct_02022B14Substruct rfuPlayer, struct UnkLinkRfuStruct_02022B14Substruct rfuPartner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, u8 isObedientBitSet); +s32 CanRegisterMonForTradingBoard(struct GFtgtGnameSub rfuPlayer, u16 species2, u16 species, u8 isObedientBitSet); +s32 GetUnionRoomTradeMessageId(struct GFtgtGnameSub rfuPlayer, struct GFtgtGnameSub rfuPartner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, u8 isObedientBitSet); #endif //GUARD_TRADE_H diff --git a/include/union_room.h b/include/union_room.h index 03628441b..d57683a8a 100644 --- a/include/union_room.h +++ b/include/union_room.h @@ -6,7 +6,7 @@ struct UnkStruct_Shared { - struct UnkLinkRfuStruct_02022B14 field_0; + struct GFtgtGname field_0; u8 ALIGNED(4) playerName[PLAYER_NAME_LENGTH]; }; @@ -149,7 +149,7 @@ struct TradeUnkStruct u32 personality; }; -extern struct UnkLinkRfuStruct_02022B14Substruct gUnknown_203B064; +extern struct GFtgtGnameSub gUnknown_203B064; extern u16 gUnionRoomOfferedSpecies; extern u8 gUnionRoomRequestedMonType; -- cgit v1.2.3 From 0d5f88f49696d695aa934c76c500ffff4db36f4a Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 14 Jan 2020 12:45:33 -0500 Subject: Move UnkRfuStruct_2 to link_rfu.h where it belongs --- include/link_rfu.h | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) (limited to 'include') diff --git a/include/link_rfu.h b/include/link_rfu.h index b7321b025..bc3fa6b70 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -107,6 +107,18 @@ struct UnkRfuStruct_1 /* 0x044 */ void (*unk_44)(u16); }; +struct UnkRfuStruct_2_Sub_6c +{ + /* 0x00 */ u16 unk_00; + /* 0x02 */ u16 unk_02; + /* 0x04 */ const u8 *unk_04; + /* 0x08 */ u32 unk_08; + /* 0x0c */ u32 unk_0c; + /* 0x10 */ u8 unk_10; + /* 0x11 */ u8 unk_11; + /* 0x12 */ u8 unk_12; +}; + struct UnkRfuStruct_2_Sub_124 { /* 0x000 */ u8 unk_00[20][70]; @@ -133,6 +145,74 @@ struct UnkRfuStruct_2_Sub_c1c /* 0x1e */ vu8 unk_1e; }; +struct UnkRfuStruct_2 +{ + /* 0x000 */ void (*RfuFunc)(void); + /* 0x004 */ u16 unk_04; + /* 0x006 */ u8 filler_06[4]; + /* 0x00a */ u16 unk_0a; + /* 0x00c */ u8 unk_0c; // parentChildMode? + /* 0x00d */ u8 playerCount; + /* 0x00e */ u8 unk_0e; + /* 0x00f */ u8 unk_0f; + /* 0x010 */ u16 unk_10; + /* 0x012 */ u16 unk_12; + /* 0x014 */ u8 unk_14[4][14]; + /* 0x04c */ u8 unk_4c[14]; + /* 0x05a */ u8 unk_5a; + /* 0x05b */ u8 unk_5b; + /* 0x05c */ u8 unk_5c[5]; + /* 0x061 */ u8 unk_61[5]; + /* 0x066 */ u8 unk_66; + /* 0x067 */ u8 unk_67; + /* 0x068 */ u8 filler_68[4]; + /* 0x06c */ struct UnkRfuStruct_2_Sub_6c unk_6c; + /* 0x080 */ struct UnkRfuStruct_2_Sub_6c unk_80[5]; + /* 0x0e4 */ u8 unk_e4[5]; + /* 0x0e9 */ u8 unk_e9[5]; + /* 0x0ee */ vu8 unk_ee; + /* 0x0ef */ u8 unk_ef; + /* 0x0f0 */ u8 unk_f0; + /* 0x0f1 */ u8 unk_f1; + /* 0x0f2 */ u16 unk_f2[6]; + /* 0x0fe */ u16 unk_fe; + /* 0x100 */ u16 unk_100; + /* 0x102 */ u8 unk_102; + /* 0x104 */ struct RfuTgtData unk_104; + /* 0x124 */ struct UnkRfuStruct_2_Sub_124 unk_124; + /* 0x6a0 */ struct UnkRfuStruct_2_Sub_9e8 unk_9e8; + /* 0x8d4 */ struct UnkRfuStruct_2_Sub_c1c unk_c1c; + /* 0x8f4 */ vu8 unk_c3c; + /* 0x8f5 */ u8 unk_c3d; + /* 0x8f6 */ vu8 unk_c3e; + /* 0x8f7 */ u8 unk_c3f[70]; + /* 0x93d */ u8 unk_c85; + /* 0x93e */ u8 unk_c86; + /* 0x93f */ u8 unk_c87[5][7][2]; + /* 0x985 */ u8 unk_ccd; + /* 0x986 */ u8 unk_cce; // childId + /* 0x987 */ u8 unk_ccf; + /* 0x988 */ vu8 unk_cd0; + /* 0x989 */ u8 unk_cd1[4]; + /* 0x98d */ u8 unk_cd5[4]; + /* 0x991 */ u8 unk_cd9; + /* 0x992 */ u8 unk_cda; + /* 0x993 */ vu8 unk_cdb; + /* 0x994 */ vu8 unk_cdc; + /* 0x995 */ u8 unk_cdd; + /* 0x996 */ u8 unk_cde[4]; + /* 0x99a */ u8 unk_ce2; + /* 0x99b */ u8 unk_ce3; + /* 0x99c */ u8 unk_ce4; + /* 0x99d */ u8 unk_ce5; + /* 0x99e */ u8 unk_ce6; + /* 0x99f */ u8 unk_ce7; + /* 0x9a0 */ u8 unk_ce8; + /* 0x9a1 */ u8 unk_ce9; + /* 0x9a2 */ u8 unk_cea[4]; + /* 0x9a6 */ u8 unk_cee[4]; +}; // size: 0x9AC + extern struct UnkRfuStruct_1 gUnknown_3005E10; void AddTextPrinterToWindow1(const u8 *str); -- cgit v1.2.3 From 5ef7bf7bf4208f806214c781a2367d4129732461 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 14 Jan 2020 12:50:49 -0500 Subject: data/link_rfu.s --> data/easy_chat_2.s --- include/link_rfu.h | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/link_rfu.h b/include/link_rfu.h index bc3fa6b70..f23d1d95e 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -145,6 +145,15 @@ struct UnkRfuStruct_2_Sub_c1c /* 0x1e */ vu8 unk_1e; }; +struct UnkRfuStruct_Sub_Unused +{ + /* 0x000 */ u8 unk_00[2][256]; + /* 0x200 */ vu8 unk_200; + /* 0x201 */ vu8 unk_201; + /* 0x202 */ vu8 unk_202; + /* 0x203 */ vu8 unk_203; +}; + struct UnkRfuStruct_2 { /* 0x000 */ void (*RfuFunc)(void); @@ -157,7 +166,7 @@ struct UnkRfuStruct_2 /* 0x00f */ u8 unk_0f; /* 0x010 */ u16 unk_10; /* 0x012 */ u16 unk_12; - /* 0x014 */ u8 unk_14[4][14]; + /* 0x014 */ u8 unk_14[RFU_CHILD_MAX][14]; /* 0x04c */ u8 unk_4c[14]; /* 0x05a */ u8 unk_5a; /* 0x05b */ u8 unk_5b; @@ -193,14 +202,14 @@ struct UnkRfuStruct_2 /* 0x986 */ u8 unk_cce; // childId /* 0x987 */ u8 unk_ccf; /* 0x988 */ vu8 unk_cd0; - /* 0x989 */ u8 unk_cd1[4]; - /* 0x98d */ u8 unk_cd5[4]; + /* 0x989 */ u8 unk_cd1[RFU_CHILD_MAX]; + /* 0x98d */ u8 unk_cd5[RFU_CHILD_MAX]; /* 0x991 */ u8 unk_cd9; /* 0x992 */ u8 unk_cda; /* 0x993 */ vu8 unk_cdb; /* 0x994 */ vu8 unk_cdc; /* 0x995 */ u8 unk_cdd; - /* 0x996 */ u8 unk_cde[4]; + /* 0x996 */ u8 unk_cde[RFU_CHILD_MAX]; /* 0x99a */ u8 unk_ce2; /* 0x99b */ u8 unk_ce3; /* 0x99c */ u8 unk_ce4; @@ -209,8 +218,8 @@ struct UnkRfuStruct_2 /* 0x99f */ u8 unk_ce7; /* 0x9a0 */ u8 unk_ce8; /* 0x9a1 */ u8 unk_ce9; - /* 0x9a2 */ u8 unk_cea[4]; - /* 0x9a6 */ u8 unk_cee[4]; + /* 0x9a2 */ u8 unk_cea[RFU_CHILD_MAX]; + /* 0x9a6 */ u8 unk_cee[RFU_CHILD_MAX]; }; // size: 0x9AC extern struct UnkRfuStruct_1 gUnknown_3005E10; @@ -235,7 +244,7 @@ bool32 IsSendingKeysToRfu(void); void Rfu_set_zero(void); u8 GetRfuPlayerCount(void); void sub_80F9828(void); -u8 rfu_get_multiplayer_id(void); +u8 LinkRfu_GetMultiplayerId(void); bool32 Rfu_InitBlockSend(const u8 * src, size_t size); bool8 sub_80FA0F8(u8 a0); u8 Rfu_GetBlockReceivedStatus(void); @@ -272,13 +281,13 @@ void sub_80FD52C(void); u8 sub_80FD610(u16 parentId, u16 unk_1a); bool8 sub_80FC79C(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2); bool8 sub_80FC888(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2); -bool8 sub_80FC828(struct UnkRfuStruct_2_Sub_c1c *q1, const u8 *q2); +void sub_80FC828(struct UnkRfuStruct_2_Sub_c1c *q1, const u8 *q2); bool8 sub_80FC6E8(struct UnkRfuStruct_2_Sub_124 * a0, u8 *a1); -bool8 sub_80FC63C(struct UnkRfuStruct_2_Sub_9e8 * a0, u8 *a1); +void sub_80FC63C(struct UnkRfuStruct_2_Sub_9e8 * a0, u8 *a1); u8 sub_80FEA34(u8 a0, u16 a1); void sub_80FDA30(u32 a0); void sub_80FCB54(struct GFtgtGname *data, u8 r9, bool32 r2, s32 r3); -void rfu_syncVBlank_(void); +void LinkRfu_syncVBlank_(void); s32 sub_80FD430(void (*func1)(u8, u8), void (*func2)(u16)); void sub_80FEB3C(void); void sub_80FAFE0(u8 a0); -- cgit v1.2.3 From de939451d7ee99749a1a26870ce27d88cd47a41b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 14 Jan 2020 17:07:43 -0500 Subject: link_rfu_4 mostly --- include/link_rfu.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/link_rfu.h b/include/link_rfu.h index f23d1d95e..e6fb946a6 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -223,6 +223,8 @@ struct UnkRfuStruct_2 }; // size: 0x9AC extern struct UnkRfuStruct_1 gUnknown_3005E10; +extern struct GFtgtGname gUnknown_3005440; +extern u8 gUnknown_3005E00[]; void AddTextPrinterToWindow1(const u8 *str); bool32 MG_PrintTextOnWindow1AndWaitButton(u8 * cmdPtr, const u8 * src); @@ -291,6 +293,8 @@ void LinkRfu_syncVBlank_(void); s32 sub_80FD430(void (*func1)(u8, u8), void (*func2)(u16)); void sub_80FEB3C(void); void sub_80FAFE0(u8 a0); +bool32 sub_80FA44C(u32 a0); +bool8 sub_80FC1B0(void); #include "mevent_server.h" extern const struct mevent_server_cmd gMEventSrvScript_OtherTrainerCanceled[]; -- cgit v1.2.3