diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/global.h | 9 | ||||
| -rw-r--r-- | include/librfu.h | 30 | ||||
| -rw-r--r-- | include/link.h | 17 | ||||
| -rw-r--r-- | include/link_rfu.h | 255 | ||||
| -rw-r--r-- | include/mystery_gift_menu.h | 1 | ||||
| -rw-r--r-- | include/overworld.h | 25 | ||||
| -rw-r--r-- | include/trade.h | 6 | ||||
| -rw-r--r-- | include/union_room.h | 4 | 
8 files changed, 308 insertions, 39 deletions
| 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; diff --git a/include/librfu.h b/include/librfu.h index cf409ca69..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  { @@ -616,7 +588,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.h b/include/link.h index d61152d8a..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 @@ -188,6 +201,7 @@ extern bool8 gLinkVSyncDisabled;  extern u8 gWirelessCommType;  extern u8 gShouldAdvanceLinkState; +extern u16 gLinkPartnersHeldKeys[6];  void Task_DestroySelf(u8);  void OpenLink(void); @@ -261,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 033f4c8d4..e6fb946a6 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -4,14 +4,231 @@  #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;  }; +struct UnkLinkRfuStruct_02022B2C +{ +    u8 unk_00; +    u8 unk_01; +    u16 unk_02; +    u8 unk_04; +    u16 unk_06; +    struct GFtgtGname *unk_08; +    u8 *unk_0c; +    u8 unk_10; +    u8 unk_11; +    u16 unk_12; +    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; +    /* 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[RFU_CHILD_MAX]; +    /* 0x030 */ u8 unk_30; +    // aligned +    /* 0x032 */ u16 unk_32; +    /* 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); +}; + +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]; +    /* 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; +}; + +struct UnkRfuStruct_2_Sub_c1c +{ +    /* 0x00 */ u8 unk_00[2][14]; +    /* 0x1c */ vu8 unk_1c; +    /* 0x1d */ vu8 unk_1d; +    /* 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); +    /* 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[RFU_CHILD_MAX][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[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[RFU_CHILD_MAX]; +    /* 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[RFU_CHILD_MAX]; +    /* 0x9a6 */ u8 unk_cee[RFU_CHILD_MAX]; +}; // 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); -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); @@ -29,8 +246,8 @@ bool32 IsSendingKeysToRfu(void);  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); +u8 LinkRfu_GetMultiplayerId(void); +bool32 Rfu_InitBlockSend(const u8 * src, size_t size);  bool8 sub_80FA0F8(u8 a0);  u8 Rfu_GetBlockReceivedStatus(void);  void Rfu_SetBlockReceivedFlag(u8 who); @@ -45,9 +262,39 @@ 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); +bool32 sub_80FBA00(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); +bool8 sub_80FC79C(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2); +bool8 sub_80FC888(struct UnkRfuStruct_2_Sub_c1c *q1, 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); +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 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[]; 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 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 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; | 
