From e8ecb01ab2f7d7e67a525621e6ea7ada08c52952 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 29 Nov 2017 19:54:15 +0100 Subject: more work on battle setup --- include/global.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index f3ec9ce33..8e936aa8c 100644 --- a/include/global.h +++ b/include/global.h @@ -36,6 +36,24 @@ 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 +63,8 @@ enum VERSION_LEAF_GREEN = 5, }; -enum LanguageId { +enum LanguageId +{ LANGUAGE_JAPANESE = 1, LANGUAGE_ENGLISH = 2, LANGUAGE_GERMAN = 5, @@ -240,7 +259,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[82]; /*0xD06*/ u8 field_D06; /*0xD07*/ u8 field_D07; /*0xD08*/ u8 filler_D08[0x112]; -- cgit v1.2.3 From 4faa442d5ab55d2961907661e21538028d7372d8 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 3 Dec 2017 19:19:11 +0100 Subject: decompile and label mail --- include/global.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index f3ec9ce33..a3e234cf0 100644 --- a/include/global.h +++ b/include/global.h @@ -356,10 +356,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; -- cgit v1.2.3 From 435167674968749684710d7ad5c4f628c6b4ae86 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 16 Dec 2017 00:08:23 +0100 Subject: decompile more of pokeblock.s --- include/global.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index f3ec9ce33..fdcebc924 100644 --- a/include/global.h +++ b/include/global.h @@ -489,11 +489,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 { @@ -586,7 +587,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]; -- cgit v1.2.3 From 601ec28721b250d74e7fd61300226ff07c8a710b Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Sat, 6 Jan 2018 00:35:48 -0600 Subject: remove explicit memcpy and add HEAP_SIZE constant --- include/global.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index b6a496dd1..7943fc569 100644 --- a/include/global.h +++ b/include/global.h @@ -31,6 +31,8 @@ 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[]; -- cgit v1.2.3 From 7be61cfb1a55feb9ab30cfda9e78ed33c74eb097 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sat, 6 Jan 2018 21:12:42 -0500 Subject: add assert support to pokeemerald. --- include/global.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index 7943fc569..1d0962cf6 100644 --- a/include/global.h +++ b/include/global.h @@ -3,6 +3,7 @@ #include "gba/gba.h" #include "config.h" +#include "assert.h" // Prevent cross-jump optimization. #define BLOCK_CROSS_JUMP asm(""); -- cgit v1.2.3 From 10ddfac7abab614d2c4488244cee35054ed06fa8 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sat, 6 Jan 2018 22:00:08 -0500 Subject: consistency --- include/global.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index 1d0962cf6..3e260fd2a 100644 --- a/include/global.h +++ b/include/global.h @@ -1,9 +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" -#include "assert.h" // Prevent cross-jump optimization. #define BLOCK_CROSS_JUMP asm(""); -- cgit v1.2.3