diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/agb_flash.h | 12 | ||||
-rw-r--r-- | include/crt0.h | 11 | ||||
-rw-r--r-- | include/decompress.h | 1 | ||||
-rw-r--r-- | include/gba/io_reg.h | 17 | ||||
-rw-r--r-- | include/global.h | 11 | ||||
-rw-r--r-- | include/intro.h | 11 | ||||
-rw-r--r-- | include/item_menu.h | 2 | ||||
-rw-r--r-- | include/librfu.h | 143 | ||||
-rw-r--r-- | include/link.h | 165 | ||||
-rw-r--r-- | include/link_rfu.h | 235 | ||||
-rw-r--r-- | include/load_save.h | 3 | ||||
-rw-r--r-- | include/m4a.h | 5 | ||||
-rw-r--r-- | include/main.h | 16 | ||||
-rw-r--r-- | include/malloc.h | 1 | ||||
-rw-r--r-- | include/menu.h | 1 | ||||
-rw-r--r-- | include/new_menu_helpers.h | 2 | ||||
-rw-r--r-- | include/overworld.h | 6 | ||||
-rw-r--r-- | include/reset_save_heap.h | 12 | ||||
-rw-r--r-- | include/rom_8011DC0.h | 12 | ||||
-rw-r--r-- | include/strings.h | 5 | ||||
-rw-r--r-- | include/trade.h | 12 |
21 files changed, 638 insertions, 45 deletions
diff --git a/include/agb_flash.h b/include/agb_flash.h new file mode 100644 index 000000000..27e45e8fa --- /dev/null +++ b/include/agb_flash.h @@ -0,0 +1,12 @@ +#ifndef GUARD_AGB_FLASH_H +#define GUARD_AGB_FLASH_H + +// Exported type declarations + +// Exported RAM declarations + +// Exported ROM declarations + +u16 SetFlashTimerIntr(u8 timerNum, void (**intrFunc)(void)); + +#endif //GUARD_AGB_FLASH_H diff --git a/include/crt0.h b/include/crt0.h new file mode 100644 index 000000000..3121eeaed --- /dev/null +++ b/include/crt0.h @@ -0,0 +1,11 @@ +#ifndef GUARD_CRT0_H +#define GUARD_CRT0_H + +// Exported type declarations + +// Exported RAM declarations + +// Exported ROM declarations +extern u32 IntrMain[]; + +#endif //GUARD_CRT0_H diff --git a/include/decompress.h b/include/decompress.h index 34a678cda..b7515250a 100644 --- a/include/decompress.h +++ b/include/decompress.h @@ -28,6 +28,7 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32 void LoadSpecialPokePic_2(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic); void LoadSpecialPokePic_DontHandleDeoxys(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic); +extern u8 gDecompressionBuffer[]; u32 sub_8034974(const u8 *ptr); #endif // GUARD_DECOMPRESS_H diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h index 0364c38bc..1847b688f 100644 --- a/include/gba/io_reg.h +++ b/include/gba/io_reg.h @@ -623,6 +623,23 @@ #define TIMER_INTR_ENABLE 0x40 #define TIMER_ENABLE 0x80 +// BGCNT +#define BGCNT_PRIORITY(n) (n) // Values 0 - 3. Lower priority BGs will be drawn on top of higher priority BGs. +#define BGCNT_CHARBASE(n) ((n) << 2) // Values 0 - 3. Base block for tile pixel data. +#define BGCNT_MOSAIC 0x0040 +#define BGCNT_16COLOR 0x0000 // 4 bits per pixel +#define BGCNT_256COLOR 0x0080 // 8 bits per pixel +#define BGCNT_SCREENBASE(n) ((n) << 8) // Values 0 - 31. Base block for tile map. +#define BGCNT_WRAP 0x2000 // Only affects affine BGs. Text BGs wrap by default. +#define BGCNT_TXT256x256 0x0000 // Internal screen size size of text mode BG in pixels. +#define BGCNT_TXT512x256 0x4000 +#define BGCNT_TXT256x512 0x8000 +#define BGCNT_TXT512x512 0xC000 +#define BGCNT_AFF128x128 0x0000 // Internal screen size size of affine mode BG in pixels. +#define BGCNT_AFF256x256 0x4000 +#define BGCNT_AFF512x512 0x8000 +#define BGCNT_AFF1024x1024 0xC000 + // serial #define SIO_ID 0x0030 // Communication ID diff --git a/include/global.h b/include/global.h index f358dafe7..7a892c5bd 100644 --- a/include/global.h +++ b/include/global.h @@ -11,6 +11,7 @@ // to help in decompiling #define asm_comment(x) asm volatile("@ -- " x " -- ") #define asm_unified(x) asm(".syntax unified\n" x "\n.syntax divided") +#define ASM_DIRECT __attribute__((naked)) // IDE support #if defined (__APPLE__) || defined (__CYGWIN__) @@ -85,6 +86,7 @@ enum LanguageId LANGUAGE_SPANISH = 7, }; +#define GAME_VERSION (VERSION_EMERALD) #define GAME_LANGUAGE (LANGUAGE_ENGLISH) enum @@ -598,6 +600,11 @@ struct WaldaPhrase bool8 patternUnlocked; }; +struct UnkSaveSubstruct_3b98 { + u32 trainerId; + u8 trainerName[8]; +}; + struct SaveBlock1 { /*0x00*/ struct Coords16 pos; @@ -682,7 +689,9 @@ struct SaveBlock1 /*0x3B14*/ struct RecordMixingGift recordMixingGift; /*0x3B24*/ u8 seen2[52]; /*0x3B58*/ LilycoveLady lilycoveLady; - /*0x3B88*/ u8 filler_3B88[0x1E8]; + /*0x3B88*/ u8 filler_3B88[0x10]; + /*0x3B98*/ struct UnkSaveSubstruct_3b98 unk_3B98[20]; + /*0x3C88*/ u8 filler_3C88[0xE8]; /*0x3D70*/ struct WaldaPhrase waldaPhrase; // sizeof: 0x3D88 }; diff --git a/include/intro.h b/include/intro.h new file mode 100644 index 000000000..3a0fee07f --- /dev/null +++ b/include/intro.h @@ -0,0 +1,11 @@ +#ifndef GUARD_INTRO_H +#define GUARD_INTRO_H + +// Exported type declarations + +// Exported RAM declarations + +// Exported ROM declarations +void c2_copyright_1(void); + +#endif //GUARD_INTRO_H diff --git a/include/item_menu.h b/include/item_menu.h index 85655e9d5..6c8ef031b 100644 --- a/include/item_menu.h +++ b/include/item_menu.h @@ -5,6 +5,8 @@ // Exported RAM declarations +extern u16 gSpecialVar_ItemId; + // Exported ROM declarations void sub_81AAC50(void); void sub_81AAC70(void); diff --git a/include/librfu.h b/include/librfu.h index dbc8a41a6..aae7df4e9 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -67,6 +67,28 @@ union RfuPacket struct RfuPacket8 rfuPacket8; }; +struct __attribute__((packed)) UnkLinkRfuStruct_02022B14 +{ + u16 unk_00_0:4; + u16 unk_00_4:1; + u16 unk_00_5:1; + u16 unk_00_6:1; + u16 unk_00_7:1; + u16 unk_01_0:1; + u16 unk_01_1:1; + u16 unk_01_2:4; + u16 unk_01_6:2; + u8 playerTrainerId[2]; + u8 unk_04[4]; + u16 unk_08_0:10; + u16 unk_09_2:6; + u8 unk_0a_0:7; + u8 unk_0a_7:1; + u8 playerGender:1; + u8 unk_0b_1:7; + u8 unk_0c; +}; + struct RfuStruct { vs32 unk_0; @@ -103,6 +125,127 @@ struct RfuIntrStruct u8 block2[0x30]; }; +struct RfuUnk1 +{ + u16 unk_0; + u8 unk_2; + u8 unk_3; + u8 fill_4[14]; + u8 unk_12; + u32 unk_14; + u32 unk_18; + struct RfuIntrStruct unk_1c; +}; + +struct RfuUnk2 +{ + u16 unk_0; + u16 unk_2; + u8 fill_4[0x16]; + u8 unk_1a; + u8 fill_1b[0x19]; + u16 unk_34; + u16 unk_36; + u8 fill_38[0x16]; + u8 unk_4e; + u8 fill_4f[0x12]; + u8 unk_61; + u8 fill_62[6]; + void *unk_68; + void *unk_6c; + u8 unk_70[0x70]; +}; + +struct RfuUnk3 +{ + u32 unk_0; + u32 unk_4; + u8 unk_8[0xD4]; + u32 unk_dc; +}; + +struct RfuUnk5Sub { + u16 unk_00; + u8 unk_02; + u16 unk_04; + struct UnkLinkRfuStruct_02022B14 unk_06; + u8 fill_13[2]; + u8 unk_15[8]; +}; + +struct RfuUnk5 +{ + u8 unk_00; + u8 unk_01; + u8 unk_02; + u8 unk_03; + u8 unk_04; + u8 unk_05; + u8 unk_06; + u8 unk_07; + u8 unk_08; + u8 filler_09[1]; + u8 unk_0a[4]; + u8 filler_0e[6]; + struct RfuUnk5Sub unk_14[4]; +}; + extern struct RfuStruct *gRfuState; +extern struct RfuUnk5 *gUnknown_03007890; +extern u32 *gUnknown_03007894; +extern struct RfuUnk3* gUnknown_03007898; +extern struct RfuUnk2* gUnknown_03007880[4]; +extern struct RfuUnk1* gUnknown_03007870[4]; +extern void* sub_82E53F4; +extern void rfu_STC_clearAPIVariables(void); + +struct UnkLinkRfuStruct_02022B14; + void STWI_init_all(struct RfuIntrStruct *interruptStruct, IntrFunc *interrupt, bool8 copyInterruptToRam); +void rfu_REQ_stopMode(void); +void rfu_waitREQComplete(void); +u32 rfu_REQBN_softReset_and_checkID(void); +void rfu_REQ_sendData(u8); +void rfu_setMSCCallback(void (*func)(u16)); +void rfu_setREQCallback(void (*func)(u16, u16)); +bool8 rfu_getMasterSlave(void); +void rfu_REQBN_watchLink(u16 a0, u8 *a1, u8 *a2, u8 *a3); +bool16 rfu_syncVBlank(void); +void rfu_REQ_reset(void); +void rfu_REQ_configSystem(u16, u8, u8); +void rfu_REQ_configGameData(u8, u16, struct UnkLinkRfuStruct_02022B14 *, u8 *); +void rfu_REQ_startSearchChild(void); +void rfu_REQ_pollSearchChild(void); +void rfu_REQ_endSearchChild(void); +void rfu_REQ_startSearchParent(void); +void rfu_REQ_pollSearchParent(void); +void rfu_REQ_endSearchParent(void); +void rfu_REQ_startConnectParent(u16); +void rfu_REQ_pollConnectParent(void); +void rfu_REQ_endConnectParent(void); +void rfu_REQ_CHILD_startConnectRecovery(u8); +void rfu_REQ_CHILD_pollConnectRecovery(void); +void rfu_REQ_CHILD_endConnectRecovery(void); +void rfu_REQ_changeMasterSlave(void); +void rfu_REQ_RFUStatus(void); +void rfu_getRFUStatus(u8 *status); +u8 *rfu_getSTWIRecvBuffer(void); +u8 rfu_NI_CHILD_setSendGameName(u8 a0, u8 a1); +void rfu_clearSlot(u8 a0, u8 a1); +void rfu_clearAllSlot(void); +bool16 rfu_CHILD_getConnectRecoveryStatus(u8 *status); +bool16 rfu_getConnectParentStatus(u8 *status, u8 *a1); +bool16 rfu_UNI_PARENT_getDRAC_ACK(u8 *a0); +void rfu_REQ_disconnect(u8 who); +void rfu_changeSendTarget(u8 a0, u8 who, u8 a2); +void rfu_NI_stopReceivingData(u8 who); +u16 rfu_initializeAPI(u32 *unk0, u16 unk1, IntrFunc *interrupt, bool8 copyInterruptToRam); +void rfu_setTimerInterrupt(u8 which, IntrFunc *intr); +void rfu_setRecvBuffer(u8 a0, u8 a1, void *a2, size_t a3); +bool16 rfu_UNI_setSendData(u8 flag, void *ptr, u8 size); +void rfu_REQ_recvData(void); +void rfu_UNI_readySendData(u8 a0); +void rfu_UNI_clearRecvNewDataFlag(u8 a0); +void rfu_REQ_PARENT_resumeRetransmitAndChange(void); +void rfu_NI_setSendData(u8, u8, u8 *, u8); diff --git a/include/link.h b/include/link.h index 1c9795d29..b6f9b86d7 100644 --- a/include/link.h +++ b/include/link.h @@ -7,6 +7,9 @@ #define QUEUE_CAPACITY 50 #define BLOCK_BUFFER_SIZE 0x100 +#define LINK_SLAVE 0 +#define LINK_MASTER 8 + #define LINK_STAT_LOCAL_ID 0x00000003 #define LINK_STAT_PLAYER_COUNT 0x0000001C #define LINK_STAT_PLAYER_COUNT_SHIFT 2 @@ -16,7 +19,23 @@ #define LINK_STAT_CONN_ESTABLISHED_SHIFT 6 #define LINK_STAT_RECEIVED_NOTHING 0x00000100 #define LINK_STAT_RECEIVED_NOTHING_SHIFT 8 +#define LINK_STAT_UNK_FLAG_9 0x00000200 +#define LINK_STAT_UNK_FLAG_9_SHIFT 9 #define LINK_STAT_ERRORS 0x0007F000 +#define LINK_STAT_ERRORS_SHIFT 12 + +#define LINK_STAT_ERROR_HARDWARE 0x00001000 +#define LINK_STAT_ERROR_HARDWARE_SHIFT 12 +#define LINK_STAT_ERROR_CHECKSUM 0x00002000 +#define LINK_STAT_ERROR_CHECKSUM_SHIFT 13 +#define LINK_STAT_ERROR_QUEUE_FULL 0x00004000 +#define LINK_STAT_ERROR_QUEUE_FULL_SHIFT 14 +#define LINK_STAT_ERROR_LAG_MASTER 0x00010000 +#define LINK_STAT_ERROR_LAG_MASTER_SHIFT 16 +#define LINK_STAT_ERROR_INVALID_ID 0x00020000 +#define LINK_STAT_ERROR_INVALID_ID_SHIFT 17 +#define LINK_STAT_ERROR_LAG_SLAVE 0x00040000 +#define LINK_STAT_ERROR_LAG_SLAVE_SHIFT 18 #define EXTRACT_PLAYER_COUNT(status) \ (((status) & LINK_STAT_PLAYER_COUNT) >> LINK_STAT_PLAYER_COUNT_SHIFT) @@ -26,10 +45,41 @@ (((status) >> LINK_STAT_CONN_ESTABLISHED_SHIFT) & 1) #define EXTRACT_RECEIVED_NOTHING(status) \ (((status) >> LINK_STAT_RECEIVED_NOTHING_SHIFT) & 1) +#define EXTRACT_LINK_ERRORS(status) \ +(((status) & LINK_STAT_ERRORS) >> LINK_STAT_ERRORS_SHIFT) + +#define LINKCMD_SEND_LINK_TYPE 0x2222 +#define LINKCMD_0x2FFE 0x2FFE +#define LINKCMD_SEND_HELD_KEYS 0x4444 +#define LINKCMD_0x5555 0x5555 +#define LINKCMD_0x5566 0x5566 +#define LINKCMD_0x5FFF 0x5FFF +#define LINKCMD_0x6666 0x6666 +#define LINKCMD_0x7777 0x7777 +#define LINKCMD_CONT_BLOCK 0x8888 +#define LINKCMD_0xAAAA 0xAAAA +#define LINKCMD_0xAAAB 0xAAAB +#define LINKCMD_INIT_BLOCK 0xBBBB +#define LINKCMD_SEND_HELD_KEYS_2 0xCAFE +#define LINKCMD_0xCCCC 0xCCCC + +struct LinkStatus +{ + u32 localId:2; + u32 playerCount:3; + u32 master:1; + u32 connEstablished:1; + u32 unused_7:1; + u32 receivedNothing:1; + u32 unused_9:7; + u32 errors:7; +}; #define MASTER_HANDSHAKE 0x8FFF #define SLAVE_HANDSHAKE 0xB9A0 +#define SIO_MULTI_CNT ((struct SioMultiCnt *)REG_ADDR_SIOCNT) + enum { LINK_STATE_START0, @@ -45,6 +95,9 @@ enum EXCHANGE_COMPLETE, EXCHANGE_TIMED_OUT, EXCHANGE_IN_PROGRESS, + EXCHANGE_STAT_4, + EXCHANGE_STAT_5, + EXCHANGE_STAT_6 }; enum @@ -75,18 +128,18 @@ struct LinkPlayer struct LinkPlayerBlock { - u8 magic1[16]; + char magic1[16]; struct LinkPlayer linkPlayer; - u8 magic2[16]; + char magic2[16]; }; // circular queues struct SendQueue { - u16 data[CMD_LENGTH][QUEUE_CAPACITY]; - u8 pos; - u8 count; + /* 0x000 */ u16 data[CMD_LENGTH][QUEUE_CAPACITY]; + /* 0x320 */ u8 pos; + /* 0x321 */ u8 count; }; struct RecvQueue @@ -98,29 +151,29 @@ struct RecvQueue struct Link { - u8 isMaster; // 0: slave, 8: master - u8 state; - u8 localId; // local multi-player ID - u8 playerCount; - u16 tempRecvBuffer[4]; - bool8 receivedNothing; - s8 serialIntrCounter; - bool8 handshakeAsMaster; - u8 link_field_F; + /* 0x000 */ u8 isMaster; // 0: slave, 8: master + /* 0x001 */ u8 state; + /* 0x002 */ u8 localId; // local multi-player ID + /* 0x003 */ u8 playerCount; + /* 0x004 */ u16 tempRecvBuffer[4]; + /* 0x00c */ bool8 receivedNothing; + /* 0x00d */ s8 serialIntrCounter; + /* 0x00e */ bool8 handshakeAsMaster; + /* 0x00f */ u8 link_field_F; // error conditions - bool8 hardwareError; // hardware reported an error - bool8 badChecksum; // checksum didn't match between devices - u8 queueFull; // send or recv queue out of space - u8 lag; // connection is lagging + /* 0x010 */ bool8 hardwareError; // hardware reported an error + /* 0x011 */ bool8 badChecksum; // checksum didn't match between devices + /* 0x012 */ u8 queueFull; // send or recv queue out of space + /* 0x013 */ u8 lag; // connection is lagging - u16 checksum; + /* 0x014 */ u16 checksum; - u8 sendCmdIndex; - u8 recvCmdIndex; + /* 0x016 */ u8 sendCmdIndex; + /* 0x017 */ u8 recvCmdIndex; - struct SendQueue sendQueue; - struct RecvQueue recvQueue; + /* 0x018 */ struct SendQueue sendQueue; + /* 0x33c */ struct RecvQueue recvQueue; }; struct BlockRequest @@ -136,26 +189,26 @@ extern u16 gRecvCmds[MAX_RFU_PLAYERS][CMD_LENGTH]; extern u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE]; extern u16 gLinkType; extern u32 gLinkStatus; -extern u16 gBlockRecvBuffer[MAX_LINK_PLAYERS][BLOCK_BUFFER_SIZE / 2]; +extern u16 gBlockRecvBuffer[MAX_RFU_PLAYERS][BLOCK_BUFFER_SIZE / 2]; extern u16 gSendCmd[CMD_LENGTH]; -extern u8 gShouldAdvanceLinkState; -extern struct LinkPlayer gLinkPlayers[]; +extern struct LinkPlayer gLinkPlayers[5]; extern u16 word_3002910[]; extern bool8 gReceivedRemoteLinkPlayers; +extern u32 gUnknown_020223C0; extern bool8 gLinkVSyncDisabled; extern u32 gLinkStatus; void Task_DestroySelf(u8 taskId); void OpenLink(void); void CloseLink(void); -u16 LinkMain2(u16 *); +u16 LinkMain2(const u16 *); void sub_8007B14(void); bool32 sub_8007B24(void); void ClearLinkCallback(void); void ClearLinkCallback_2(void); u8 GetLinkPlayerCount(void); void OpenLinkTimed(void); -u8 GetLinkPlayerDataExchangeStatusTimed(void); +u8 GetLinkPlayerDataExchangeStatusTimed(int lower, int upper); bool8 IsLinkPlayerDataExchangeComplete(void); u32 GetLinkPlayerTrainerId(u8); void ResetLinkPlayers(void); @@ -163,11 +216,10 @@ void sub_8007E24(void); void sub_8007E4C(void); u8 GetMultiplayerId(void); u8 bitmask_all_link_players_but_self(void); -bool8 SendBlock(u8, void *, u16); +bool8 SendBlock(u8, const void *, u16); u8 GetBlockReceivedStatus(void); void ResetBlockReceivedFlags(void); void ResetBlockReceivedFlag(u8); -void SetLinkDebugValues(u32, u32); u8 GetLinkPlayerCount_2(void); bool8 IsLinkMaster(void); void CB2_LinkError(void); @@ -176,23 +228,64 @@ bool8 IsLinkConnectionEstablished(void); void SetSuppressLinkErrorMessage(bool8); bool8 HasLinkErrorOccurred(void); void ResetSerial(void); -u32 LinkMain1(u8 *, u16 *, u16[CMD_LENGTH][MAX_LINK_PLAYERS]); +u32 LinkMain1(u8 *shouldAdvanceLinkState, u16 *sendCmd, u16 (*recvCmds)[CMD_LENGTH]); void LinkVSync(void); void Timer3Intr(void); void SerialCB(void); u8 GetLinkPlayerCount(void); bool32 InUnionRoom(void); - void sub_800E0E8(void); bool8 sub_800A520(void); -bool8 sub_8010500(void); -void sub_800DFB4(u8, u8); +void CreateWirelessStatusIndicatorSprite(u8, u8); void sub_800ADF8(void); void sub_800B488(void); -void OpenLink(void); void sub_800A620(void); void sub_8011BD0(void); +u8 IsLinkMaster(void); void sub_800AC34(void); -u8 sub_800A0C8(s32, s32); +bool8 HandleLinkConnection(void); +void SetLinkDebugValues(u32 seed, u32 flags); +void sub_800A418(void); +void SetSuppressLinkErrorMessage(bool8 flag); +void sub_800B524(struct LinkPlayer *linkPlayer); +u8 GetSioMultiSI(void); +void sub_800AAF4(void); +void sub_800AF18(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, u8 unk_06); +void sub_800B348(void); +void sub_800B3A4(u32 who); + +extern u16 gLinkPartnersHeldKeys[6]; +extern u32 gLinkDebugSeed; +extern struct LinkPlayerBlock gLocalLinkPlayerBlock; +extern bool8 gLinkErrorOccurred; +extern u32 gLinkDebugFlags; +extern bool8 gRemoteLinkPlayersNotReceived[MAX_LINK_PLAYERS]; +extern u8 gBlockReceivedStatus[MAX_LINK_PLAYERS]; +extern u16 gLinkHeldKeys; +extern u32 gLinkStatus; +extern u8 gUnknown_030030E4; +extern u8 gUnknown_030030E8; +extern u8 gUnknown_030030EC[MAX_LINK_PLAYERS]; +extern u8 gUnknown_030030F0[MAX_LINK_PLAYERS]; +extern u16 gUnknown_030030F4; +extern u8 gSuppressLinkErrorMessage; +extern u8 gWirelessCommType; +extern bool8 gSavedLinkPlayerCount; +extern u8 gSavedMultiplayerId; +extern struct LinkTestBGInfo gLinkTestBGInfo; +extern void (*gLinkCallback)(void); +extern bool8 gShouldAdvanceLinkState; +extern u16 gLinkTestBlockChecksums[MAX_LINK_PLAYERS]; +extern u8 gBlockRequestType; +extern u8 gLastSendQueueCount; +extern u8 gLastRecvQueueCount; +extern u16 gLinkSavedIme; +extern u32 gFiller_03003074; +extern u32 gFiller_03003154; +extern u32 gFiller_03003158; +extern u32 gFiller_0300315c; +extern u32 gFiller_03004138; +extern u32 gFiller_0300413C; +extern u32 gFiller_03003080; #endif // GUARD_LINK_H diff --git a/include/link_rfu.h b/include/link_rfu.h new file mode 100644 index 000000000..a6084b138 --- /dev/null +++ b/include/link_rfu.h @@ -0,0 +1,235 @@ +#ifndef GUARD_LINK_RFU_H +#define GUARD_LINK_RFU_H + +// Exported type declarations + +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 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[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]; +}; + +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[32][70]; + /* 0x8c0 */ vu8 unk_8c0; + /* 0x8c1 */ vu8 unk_8c1; + /* 0x8c2 */ vu8 unk_8c2; + /* 0x8c3 */ 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 (*unk_00)(void); + /* 0x004 */ u16 unk_04; + /* 0x006 */ u8 filler_06[4]; + /* 0x00a */ u16 unk_0a; + /* 0x00c */ u8 unk_0c; + /* 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; + /* 0x103 */ u8 filler_103[0x21]; + /* 0x124 */ struct UnkRfuStruct_2_Sub_124 unk_124; + /* 0x9e8 */ struct UnkRfuStruct_2_Sub_9e8 unk_9e8; + /* 0xc1c */ struct UnkRfuStruct_2_Sub_c1c unk_c1c; + /* 0xc3c */ vu8 unk_c3c; + /* 0xc3d */ u8 unk_c3d; + /* 0xc3e */ vu8 unk_c3e; + /* 0xc3f */ u8 unk_c3f[70]; + /* 0xc85 */ u8 unk_c85; + /* 0xc86 */ u8 unk_c86; + /* 0xc87 */ u8 unk_c87[5][7][2]; + /* 0xccd */ u8 unk_ccd; + /* 0xcce */ u8 unk_cce; + /* 0xccf */ u8 unk_ccf; + /* 0xcd0 */ vu8 unk_cd0; + /* 0xcd1 */ u8 unk_cd1[4]; + /* 0xcd5 */ u8 unk_cd5[4]; + /* 0xcd9 */ u8 unk_cd9; + /* 0xcda */ u8 unk_cda; + /* 0xcdb */ vu8 unk_cdb; + /* 0xcdc */ vu8 unk_cdc; + /* 0xcdd */ u8 unk_cdd; + /* 0xcde */ u8 unk_cde[4]; + /* 0xce2 */ u8 unk_ce2; + /* 0xce2 */ u8 unk_ce3; + /* 0xce4 */ u8 unk_ce4; + /* 0xce5 */ u8 unk_ce5; + /* 0xce5 */ u8 unk_ce6; + /* 0xce7 */ u8 unk_ce7; + /* 0xce8 */ u8 unk_ce8; + /* 0xce9 */ u8 unk_ce9; + /* 0xcea */ u8 unk_cea[4]; + /* 0xcee */ u8 unk_cee[4]; +}; // size = 0xcf4 + +struct UnkRfuStruct_8010A14 { + char unk_00[15]; + u8 unk_0f; + u8 unk_10[4]; + struct LinkPlayer unk_14[5]; + u8 fill_a0[0x5c]; +}; + +// Exported RAM declarations + +extern struct UnkRfuStruct_1 gUnknown_03004140; +extern struct UnkRfuStruct_2 gUnknown_03005000; + +// Exported ROM declarations +u32 sub_800BEC0(void); +void sub_800E700(void); +void sub_800EDD4(void); +void sub_800F6FC(u8 who); +void sub_800F728(u8 who); +bool32 sub_800F7E4(void); +void sub_800F804(void); +void sub_800F850(void); +u8 sub_800FCD8(void); +bool32 sub_800FE84(const u8 *src, size_t size); +void Rfu_set_zero(void); +u8 sub_80104F4(void); +u8 rfu_get_multiplayer_id(void); +bool8 sub_8010100(u8 a0); +bool8 sub_8010500(void); +bool8 Rfu_IsMaster(void); +void task_add_05_task_del_08FA224_when_no_RfuFunc(void); +void sub_8010434(void); +void sub_800E604(void); +void sub_800E174(void); +void sub_800E6D0(void); +bool32 sub_8010EC0(void); +bool32 sub_8010F1C(void); +bool32 sub_8011A80(void); +bool32 sub_800F0B8(void); +u32 sub_80124D4(void); +void RfuVSync(void); +void sub_80111B0(bool32 a0); +u8 sub_8011A74(void); +struct UnkLinkRfuStruct_02022B14 *sub_800F7DC(void); +void sub_8011068(u8 a0); +void sub_8011170(u32 a0); +void sub_8011A64(u8 a0, u16 a1); + +#endif //GUARD_LINK_RFU_H diff --git a/include/load_save.h b/include/load_save.h index 1f406bbad..92c99fd90 100644 --- a/include/load_save.h +++ b/include/load_save.h @@ -2,6 +2,8 @@ #define GUARD_LOAD_SAVE_H extern bool32 gFlashMemoryPresent; +extern struct SaveBlock2 gSaveblock2; +extern struct PokemonStorage gPokemonStorage; void ClearSav2(void); void ClearSav1(void); @@ -19,6 +21,5 @@ void LoadSerializedGame(void); void LoadPlayerBag(void); void SavePlayerBag(void); void SetSaveBlocksPointers(u16); -void MoveSaveBlocks_ResetHeap(void); #endif // GUARD_LOAD_SAVE_H diff --git a/include/m4a.h b/include/m4a.h index 8c3380dd8..a1f413cf5 100644 --- a/include/m4a.h +++ b/include/m4a.h @@ -17,4 +17,9 @@ void m4aMPlayFadeOutTemporarily(struct MusicPlayerInfo *mplayInfo, u16 speed); void m4aMPlayFadeIn(struct MusicPlayerInfo *mplayInfo, u16 speed); void m4aMPlayImmInit(struct MusicPlayerInfo *mplayInfo); +extern struct MusicPlayerInfo gMPlayInfo_SE1; +extern struct MusicPlayerInfo gMPlayInfo_SE2; +extern struct MusicPlayerInfo gMPlayInfo_SE3; +extern struct SoundInfo gSoundInfo; + #endif //GUARD_M4A_H diff --git a/include/main.h b/include/main.h index 40a2580a2..3de34de13 100644 --- a/include/main.h +++ b/include/main.h @@ -42,14 +42,19 @@ struct Main /*0x439*/ u8 field_439_x4:1; }; -extern u8 gUnknown_3001764; -extern struct Main gMain; -extern bool8 gSoftResetDisabled; -extern bool8 gLinkVSyncDisabled; - extern const u8 gGameVersion; extern const u8 gGameLanguage; +extern u16 gKeyRepeatStartDelay; +extern bool8 gLinkTransferringData; +extern struct Main gMain; +extern u16 gKeyRepeatContinueDelay; +extern bool8 gSoftResetDisabled; +extern IntrFunc gIntrTable[]; +extern u8 gLinkVSyncDisabled; +extern u32 IntrMain_Buffer[]; +extern u8 gPcmDmaCounter; + void AgbMain(void); void SetMainCallback2(MainCallback callback); void InitKeys(void); @@ -60,6 +65,7 @@ void SetSerialCallback(IntrCallback callback); void InitFlashTimer(void); void DoSoftReset(void); void ClearPokemonCrySongs(void); +void RestoreSerialTimer3IntrHandlers(void); void StartTimer1(void); void SeedRngAndSetTrainerId(void); diff --git a/include/malloc.h b/include/malloc.h index 003ee1f03..6efa8fbef 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -1,6 +1,7 @@ #ifndef GUARD_MALLOC_H #define GUARD_MALLOC_H +#define HEAP_SIZE 0x1C000 #define malloc Alloc #define calloc(ct, sz) AllocZeroed((ct) * (sz)) #define free Free diff --git a/include/menu.h b/include/menu.h index e5f705cae..b5dfa10ba 100644 --- a/include/menu.h +++ b/include/menu.h @@ -32,6 +32,7 @@ int decompress_and_copy_tile_data_to_vram(u8 bg_id, const void *src, int size, u bool8 free_temp_tile_data_buffers_if_possible(void); u64 sub_8198A50(struct WindowTemplate*, u8, u8, u8, u8, u8, u8, u16); // returns something but it isn't used, fix when menu.s is decomp'd void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirstTileNum, u8 borderPalette, u8 initialCursorPos); +void copy_decompressed_tile_data_to_vram_autofree(u8 arg0, const void *arg1, bool32 arg2, u16 arg3, u8 arg4); s8 ProcessMenuInputNoWrap_(void); void do_scheduled_bg_tilemap_copies_to_vram(void); void clear_scheduled_bg_copies_to_vram(void); diff --git a/include/new_menu_helpers.h b/include/new_menu_helpers.h index bcbb1147d..c01cab440 100644 --- a/include/new_menu_helpers.h +++ b/include/new_menu_helpers.h @@ -4,6 +4,8 @@ #include "text.h" #include "task.h" +extern const u16 gUnknown_0860F074[]; + void sub_81971D0(void); void sub_8197200(void); void sub_81973A4(void); diff --git a/include/overworld.h b/include/overworld.h index 974f8f091..630b0a617 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -25,8 +25,6 @@ struct UCoords32 extern struct LinkPlayerMapObject gLinkPlayerMapObjects[4]; extern MainCallback gFieldCallback; -void IncrementGameStat(u8 index); - void Overworld_SetMapObjTemplateCoords(u8, s16, s16); void Overworld_SetMapObjTemplateMovementType(u8, u8); @@ -54,6 +52,7 @@ void Overworld_ChangeMusicToDefault(void); void Overworld_ChangeMusicTo(u16); bool32 is_c1_link_related_active(void); +extern u16 gUnknown_03005DA8; void strange_npc_table_clear(void); const struct MapHeader *get_mapheader_by_bank_and_number(u16, u16); @@ -73,6 +72,9 @@ void mapldr_default(void); u8 get_map_light_from_warp0(void); bool8 is_light_level_1_2_3_5_or_6(u8 a1); +bool32 sub_80875C8(void); +bool32 sub_8087634(void); +bool32 sub_808766C(void); void IncrementGameStat(u8); u32 GetGameStat(u8); diff --git a/include/reset_save_heap.h b/include/reset_save_heap.h new file mode 100644 index 000000000..12fd186ec --- /dev/null +++ b/include/reset_save_heap.h @@ -0,0 +1,12 @@ +#ifndef GUARD_RESET_SAVE_HEAP_H +#define GUARD_RESET_SAVE_HEAP_H + +// Exported type declarations + +// Exported RAM declarations + +// Exported ROM declarations + +void sub_81700F8(void); + +#endif //GUARD_RESET_SAVE_HEAP_H diff --git a/include/rom_8011DC0.h b/include/rom_8011DC0.h new file mode 100644 index 000000000..fd8c35f56 --- /dev/null +++ b/include/rom_8011DC0.h @@ -0,0 +1,12 @@ +#ifndef GUARD_rom_8011DC0_H +#define GUARD_rom_8011DC0_H + +// Exported type declarations + +// Exported RAM declarations + +// Exported ROM declarations + +void sub_8018438(void); + +#endif //GUARD_rom_8011DC0_H diff --git a/include/strings.h b/include/strings.h index 305007c5d..11ecf098f 100644 --- a/include/strings.h +++ b/include/strings.h @@ -101,6 +101,11 @@ extern const u8 gText_NoRegistry[]; extern const u8 gText_OkayToDeleteFromRegistry[]; extern const u8 gText_RegisteredDataDeleted[]; extern const u8 gUnknown_085EA79D[]; +extern const u8 gText_CommErrorEllipsis[]; +extern const u8 gText_MoveCloserToLinkPartner[]; +extern const u8 gText_CommErrorCheckConnections[]; +extern const u8 gText_ABtnTitleScreen[]; +extern const u8 gText_ABtnRegistrationCounter[]; extern const u8 gText_EmptyString2[]; extern const u8 gText_Confirm3[]; extern const u8 gText_Cancel4[]; diff --git a/include/trade.h b/include/trade.h new file mode 100644 index 000000000..15438ff3f --- /dev/null +++ b/include/trade.h @@ -0,0 +1,12 @@ +#ifndef GUARD_TRADE_H +#define GUARD_TRADE_H + +// Exported type declarations + +// Exported RAM declarations + +// Exported ROM declarations + +int sub_807A728(void); + +#endif //GUARD_TRADE_H |