diff options
author | scnorton <scnorton@biociphers.org> | 2018-01-18 12:53:31 -0500 |
---|---|---|
committer | scnorton <scnorton@biociphers.org> | 2018-01-18 12:53:31 -0500 |
commit | c6ff1a6ce39cb67c6de21f2e4938ea62c97ee7e5 (patch) | |
tree | 47e2f5eaa84c3cc97b96bdf06170136abe446d81 /include/global.h | |
parent | 3c2b1731eeb7037a1b681444b1c126fc239a904e (diff) | |
parent | 24e0edee9f428a68715c47051ebba3cda5a3e5a7 (diff) |
Merge branch 'master' into link
Diffstat (limited to 'include/global.h')
-rw-r--r-- | include/global.h | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/include/global.h b/include/global.h index b4b92e5d8..1987a0ada 100644 --- a/include/global.h +++ b/include/global.h @@ -1,8 +1,8 @@ #ifndef GUARD_GLOBAL_H #define GUARD_GLOBAL_H +#include "config.h" // we need to define config before gba headers as print stuff needs the functions nulled before defines. #include "gba/gba.h" -#include "config.h" // Prevent cross-jump optimization. #define BLOCK_CROSS_JUMP asm(""); @@ -31,11 +31,31 @@ char* strcpy(char *dst0, const char *src0); #define POKEMON_NAME_LENGTH 10 #define OT_NAME_LENGTH 7 +#define HEAP_SIZE 0x1C000 + extern u8 gStringVar1[]; extern u8 gStringVar2[]; extern u8 gStringVar3[]; extern u8 gStringVar4[]; +// There are many quirks in the source code which have overarching behavioral differences from +// a number of other files. For example, diploma.c seems to declare rodata before each use while +// other files declare out of order and must be at the beginning. There are also a number of +// macros which differ from one file to the next due to the method of obtaining the result, such +// as these below. Because of this, there is a theory (Two Team Theory) that states that these +// programming projects had more than 1 "programming team" which utilized different macros for +// each of the files that were worked on. +#define T1_READ_8(ptr) ((ptr)[0]) +#define T1_READ_16(ptr) ((ptr)[0] | ((ptr)[1] << 8)) +#define T1_READ_32(ptr) ((ptr)[0] | ((ptr)[1] << 8) | ((ptr)[2] << 16) | ((ptr)[3] << 24)) +#define T1_READ_PTR(ptr) (u8*) T1_READ_32(ptr) + +// T2_READ_8 is a duplicate to remain consistent with each group. +#define T2_READ_8(ptr) ((ptr)[0]) +#define T2_READ_16(ptr) ((ptr)[0] + ((ptr)[1] << 8)) +#define T2_READ_32(ptr) ((ptr)[0] + ((ptr)[1] << 8) + ((ptr)[2] << 16) + ((ptr)[3] << 24)) +#define T2_READ_PTR(ptr) (void*) T2_READ_32(ptr) + enum { VERSION_SAPPHIRE = 1, @@ -45,7 +65,8 @@ enum VERSION_LEAF_GREEN = 5, }; -enum LanguageId { +enum LanguageId +{ LANGUAGE_JAPANESE = 1, LANGUAGE_ENGLISH = 2, LANGUAGE_FRENCH = 3, @@ -223,7 +244,7 @@ struct SaveBlock2 /*0x1EC*/ struct BerryCrush berryCrush; /*0x1FC*/ struct PokemonJumpResults pokeJump; /*0x20C*/ struct BerryPickingResults berryPick; - /*0x214*/ u8 field_214[1032]; + /*0x21C*/ u8 field_21C[1032]; /*0x624*/ u16 contestLinkResults[20]; // 4 positions for 5 categories, possibly a struct or a 2d array // All below could be a one giant struct @@ -245,7 +266,7 @@ struct SaveBlock2 /*0xCA9*/ u8 field_CA9_f : 1; // 0x80 /*0xCAA*/ u16 field_CAA[4]; /*0xCB2*/ u16 battlePyramidWildHeaderId; - /*0xCB4*/ u8 field_CB4[82]; + /*0xCB4*/ u16 field_CB4[41]; /*0xD06*/ u8 field_D06; /*0xD07*/ u8 field_D07; /*0xD08*/ u8 filler_D08[0x112]; @@ -361,10 +382,12 @@ struct EasyChatPair u16 words[2]; }; /*size = 0x8*/ +#define MAIL_WORDS_COUNT 9 + struct MailStruct { - /*0x00*/ u16 words[9]; - /*0x12*/ u8 playerName[8]; + /*0x00*/ u16 words[MAIL_WORDS_COUNT]; + /*0x12*/ u8 playerName[PLAYER_NAME_LENGTH]; /*0x1A*/ u8 trainerId[4]; /*0x1E*/ u16 species; /*0x20*/ u16 itemId; @@ -494,11 +517,12 @@ struct RecordMixingDayCareMail bool16 holdsItem[DAYCARE_MON_COUNT]; }; -#define MAP_OBJECTS_COUNT 16 -#define BERRY_TREES_COUNT 128 -#define FLAGS_COUNT 300 -#define VARS_COUNT 256 -#define MAIL_COUNT 16 +#define POKEBLOCKS_COUNT 40 +#define MAP_OBJECTS_COUNT 16 +#define BERRY_TREES_COUNT 128 +#define FLAGS_COUNT 300 +#define VARS_COUNT 256 +#define MAIL_COUNT 16 enum { @@ -596,7 +620,7 @@ struct SaveBlock1 /*0x650*/ struct ItemSlot bagPocket_PokeBalls[16]; /*0x690*/ struct ItemSlot bagPocket_TMHM[64]; /*0x790*/ struct ItemSlot bagPocket_Berries[46]; - /*0x848*/ struct Pokeblock pokeblocks[40]; + /*0x848*/ struct Pokeblock pokeblocks[POKEBLOCKS_COUNT]; /*0x988*/ u8 seen1[52]; /*0x9BC*/ u16 berryBlenderRecords[3]; /*0x9C2*/ u8 field_9C2[6]; |