summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorProjectRevoTPP <projectrevotpp@hotmail.com>2017-11-05 01:34:52 -0400
committerProjectRevoTPP <projectrevotpp@hotmail.com>2017-11-05 01:34:52 -0400
commit4cf701c5871a17f0bc580019e8d294bc1c84ebf3 (patch)
treee2d7246d97c18b1660156d345ee988212a039d84 /include
parent8832b766facd48c85c1b99ac6dad555f1e2aa1c7 (diff)
move ewram defines to ewram.h.
Diffstat (limited to 'include')
-rw-r--r--include/battle.h18
-rw-r--r--include/battle_anim.h6
-rw-r--r--include/battle_party_menu.h3
-rw-r--r--include/decoration.h3
-rw-r--r--include/dewford_trend.h3
-rwxr-xr-xinclude/ewram.h124
-rw-r--r--include/party_menu.h6
-rw-r--r--include/player_pc.h1
-rw-r--r--include/script_pokemon_80F9.h2
9 files changed, 132 insertions, 34 deletions
diff --git a/include/battle.h b/include/battle.h
index dc9ac93cc..692e1a981 100644
--- a/include/battle.h
+++ b/include/battle.h
@@ -189,9 +189,6 @@ enum
BATTLE_TERRAIN_PLAIN,
};
-// needed to match the hack that is get_item, thanks cam, someone else clean this up later.
-extern u8 unk_2000000[];
-
struct Trainer
{
/*0x00*/ u8 partyFlags;
@@ -671,20 +668,7 @@ extern struct WishFutureKnock gWishFutureKnock;
extern struct AI_ThinkingStruct gAIThinkingSpace;
extern struct Struct20238C8 gUnknown_020238C8;
-// TODO: move ewram to global.h
-extern u8 ewram[];
-
-#define BATTLE_STRUCT ((struct BattleStruct *) (ewram + 0x00000))
-#define AI_THINKING_STRUCT ((struct AI_ThinkingStruct *)(ewram + 0x16800))
-#define UNK_2016A00_STRUCT ((struct UnkBattleStruct1 *) (ewram + 0x16A00))
-#define AI_STACK ((struct AI_Stack *) (ewram + 0x16C00))
-#define AI_ARRAY_160CC ((struct SmallItemStruct *) (ewram + 0x160CC))
-#define B_BATTLESCRIPTS_STACK ((struct scriptsStack *) (ewram + 0x17110))
-#define B_FUNCTION_STACK ((struct funcStack *) (ewram + 0x17140))
-#define ewram17800 ((struct Struct2017800 *) (ewram + 0x17800))
-#define ewram17810 ((struct Struct2017810 *) (ewram + 0x17810))
-#define ewram17840 (*(struct Struct2017840 *) (ewram + 0x17840))
-#define ewram17000 ((u32 *) (ewram + 0x17100))
+#include "ewram.h"
// used in many battle files, it seems as though Hisashi Sogabe wrote
// some sort of macro to replace the use of actually calling memset.
diff --git a/include/battle_anim.h b/include/battle_anim.h
index 3db5ae967..27683e866 100644
--- a/include/battle_anim.h
+++ b/include/battle_anim.h
@@ -7,11 +7,7 @@
#define REG_BG1CNT_BITFIELD REG_BGnCNT_BITFIELD(1)
#define REG_BG2CNT_BITFIELD REG_BGnCNT_BITFIELD(2)
-#define EWRAM_14800 ((u16 *)(unk_2000000 + 0x14800))
-#define EWRAM_17800 ((struct UnknownStruct1 *)(unk_2000000 + 0x17800))
-#define EWRAM_17810 ((struct UnknownStruct3 *)(unk_2000000 + 0x17810))
-#define EWRAM_18000 ((u16 *)(unk_2000000 + 0x18000))
-#define EWRAM_19348 (*(u16 *)(unk_2000000 + 0x19348))
+#include "ewram.h"
struct BGCntrlBitfield
{
diff --git a/include/battle_party_menu.h b/include/battle_party_menu.h
index 200b0c653..d08c1e9ae 100644
--- a/include/battle_party_menu.h
+++ b/include/battle_party_menu.h
@@ -1,8 +1,7 @@
#ifndef GUARD_BATTLE_PARTY_MENU_H
#define GUARD_BATTLE_PARTY_MENU_H
-extern u8 unk_2000000[];
-#define EWRAM_1609D unk_2000000[0x1609D]
+#include "ewram.h"
void HandleBattlePartyMenu(u8);
bool8 SetUpBattlePartyMenu(void);
diff --git a/include/decoration.h b/include/decoration.h
index 70abc29bf..414c02dad 100644
--- a/include/decoration.h
+++ b/include/decoration.h
@@ -204,8 +204,7 @@ struct UnkStruct_803EC860
extern const struct UnkStruct_803EC860 gUnknown_083EC860[];
-extern u8 ewram[];
-#define ewram_1f000 (*(struct DecoPCPointers *)(ewram + 0x1f000))
+#include "ewram.h"
struct UnkStruct_02038900
{
diff --git a/include/dewford_trend.h b/include/dewford_trend.h
index 26075d633..c4a1a142d 100644
--- a/include/dewford_trend.h
+++ b/include/dewford_trend.h
@@ -1,8 +1,7 @@
#ifndef GUARD_DEWFORDTREND_H
#define GUARD_DEWFORDTREND_H
-#define ARRAY_2007800 ((struct EasyChatPair *)(unk_2000000 + 0x7800))
-#define ARRAY_2007900 ((struct EasyChatPair *)(unk_2000000 + 0x7900))
+#include "ewram.h"
void InitDewfordTrend(void);
void sub_80FA4E4(void *, u32, u8);
diff --git a/include/ewram.h b/include/ewram.h
new file mode 100755
index 000000000..1b54a1ebc
--- /dev/null
+++ b/include/ewram.h
@@ -0,0 +1,124 @@
+#ifndef GUARD_EWRAM_H
+#define GUARD_EWRAM_H
+
+extern u8 ewram[];
+
+#define BATTLE_STRUCT ((struct BattleStruct *) (ewram + 0x0))
+#define ewram0 (*(struct UnknownStruct7 *)(ewram + 0x0))
+#define ewram0_2 (*(struct Struct2000000 *)(ewram + 0x0))
+#define namingScreenData (*(struct NamingScreenData *)(ewram + 0x0))
+#define unk_2000000 (*(struct UnkStruct *)(ewram + 0x0))
+#define ewramBerryPic (ewram + 0x0)
+#define ewram0_3 (*(struct UnknownStruct3 *)(ewram + 0x0))
+#define ewram0_4 (*(struct Unk2000000 *)(ewram + 0x0))
+#define ewram4 (*(struct UnknownStruct8 *)(ewram + 0x4))
+#define ewram520 ((struct UnknownStruct7 *)(ewram + 0x00520))
+#define ewram888 (ewram + 0x888)
+#define ewramBlankMapName (ewram + 0xA48)
+#define ewramA6E (ewram[0xA6E])
+#define ewram01000 (*(struct Unk2001000 *)(ewram + 0x1000))
+#define ewramBerryPicTemp (ewram + 0x1000)
+#define EWRAM_1000 (*(struct Struct2001000 *)(ewram + 0x1000))
+#define gUnk20011fa (u8 *)(&ewram[0x11FA])
+#define gUnk2002694 (u8 *)(&ewram[0x2694])
+#define gUnk20026A6 (u8 *)(&ewram[0x26A6])
+#define gUnk20026e4 (u8 *)(&ewram[0x26E4])
+#define gUnknown_02007000 (*(ewramStruct_02007000 *)(ewram + 0x7000))
+#define ARRAY_2007800 ((struct EasyChatPair *)(ewram + 0x7800))
+#define ARRAY_2007900 ((struct EasyChatPair *)(ewram + 0x7900))
+#define unk_2008000 (*(struct PlayerRecords *)(ewram + 0x08000))
+#define TRANSITION_STRUCT (*(struct TransitionData *) (ewram + 0xC000))
+#define ewram_2010000 (*(struct TradeEwramStruct *)(ewram + 0x10000))
+#define EWRAM_14000 ((u8 *)(ewram + 0x14000))
+#define EWRAM_14800 ((u16 *)(ewram + 0x14800))
+#define sEvoInfo ((*(struct EvoInfo*)(ewram + 0x14800)))
+#define EWRAM_15000 ((u8 *)(ewram + 0x15000))
+#define ewram16000 (ewram[0x16000])
+#define ewram16001 (ewram[0x16001])
+#define ewram16002 (ewram[0x16002])
+#define ewram16003 (ewram[0x16003])
+#define ewram1600C (ewram[0x1600C])
+#define ewram1600E (ewram[0x1600E])
+#define ewram1601B (ewram[0x1601B])
+#define ewram16020 ((u8 *)(ewram + 0x16020))
+#define ewram16056 (ewram[0x16056])
+#define ewram16058 (ewram[0x16058])
+#define ewram16059 (ewram[0x16059])
+#define UNK_201606C_ARRAY (ewram + 0x1606C) // lazy define but whatever.
+#define ewram16078 (ewram[0x16078])
+#define ewram16084 (ewram[0x16084])
+#define ewram16086 (ewram[0x16086])
+#define ewram16087 (ewram[0x16087])
+#define ewram16088 (ewram[0x16088])
+#define ewram16088_2 (*(u8 *)(ewram + 0x16088))
+#define ewram16089 (ewram[0x16089])
+#define ewram16089_2 (*(u8 *)(ewram + 0x16089))
+#define EWRAM_1609D (ewram[0x1609D])
+#define ewram160A1 (ewram[0x160A1])
+#define ewram160A6 (ewram[0x160A6])
+#define ewram160AC ((u8 *)(ewram + 0x160AC))
+#define ewram160BC ((u16 *)(ewram + 0x160BC)) // hp
+#define ewram160C8 (ewram[0x160C8])
+#define ewram160C9 (ewram[0x160C9])
+#define ewram160CB (ewram[0x160CB])
+#define ewram160CC ((u8 *)(ewram + 0x160CC))
+#define USED_HELD_ITEM(bank) ((((u16*)(&ewram[0x160CC + bank * 2]))))
+#define USED_HELD_ITEMS(bank) (*(u16 *)&ewram[0x160CC + 2 * (bank)])
+#define ewram160E6 (ewram[0x160E6])
+#define CHOICED_MOVE(bank) (((u16*)(&ewram[0x160E8 + bank * 2])))
+#define ewram160E8 ((u8 *)(ewram + 0x160E8))
+#define ewram160F0 ((u8 *)(ewram + 0x160F0))
+#define ewram160F9 (ewram[0x160F9])
+#define ewram160FB (ewram[0x160FB])
+#define ewram16100 ((u8 *)(ewram + 0x16100))
+#define ewram16108 ((u8 *)(ewram + 0x16108))
+#define ewram16110 (ewram[0x16110])
+#define ewram16111 (ewram[0x16111])
+#define ewram16113 (ewram[0x16113])
+#define AI_THINKING_STRUCT ((struct AI_ThinkingStruct *)(ewram + 0x16800))
+#define UNK_2016A00_STRUCT ((struct UnkBattleStruct1 *) (ewram + 0x16A00))
+#define AI_STACK ((struct AI_Stack *) (ewram + 0x16C00))
+#define AI_ARRAY_160CC ((struct SmallItemStruct *) (ewram + 0x160CC))
+#define ewram17100_2 (*(struct Struct2017100 *)(ewram + 0x17100))
+#define B_BATTLESCRIPTS_STACK ((struct scriptsStack *) (ewram + 0x17110))
+#define B_FUNCTION_STACK ((struct funcStack *) (ewram + 0x17140))
+#define ewram17800 ((struct Struct2017800 *) (ewram + 0x17800))
+#define ewram17810 ((struct Struct2017810 *) (ewram + 0x17810))
+#define ewram17840 (*(struct Struct2017840 *) (ewram + 0x17840))
+#define ewram17850 ((struct UnknownStruct5 *)(ewram + 0x17850))
+#define ewram17000 ((u32 *) (ewram + 0x17100)) // this label is incorrect.
+#define ewram17100 ((u32 *)(ewram + 0x17100))
+#define ewram17130 (ewram[0x17130])
+#define ewram17160 (ewram[0x17160])
+#define EWRAM_17800 ((struct UnknownStruct1 *)(ewram + 0x17800))
+#define EWRAM_17810 ((struct UnknownStruct3 *)(ewram + 0x17810))
+#define unk_2018000 (*(struct PlayerRecords *)(ewram + 0x18000))
+#define EWRAM_18000 ((u16 *)(ewram + 0x18000))
+#define ewram18000 ((u16 *)(ewram + 0x18000))
+#define UNK_2018000_STRUCT (*(struct UnknownStruct2018000 *)(ewram + 0x18000))
+#define ewram18300 ((u16 *)(ewram + 0x18300))
+#define EWRAM_19348 (*(u16 *)(ewram + 0x19348))
+#define ewram19348 (*(struct Struct2019348 *)(ewram + 0x19348))
+#define ewram1B000 (*(struct Unk201B000 *)(ewram + 0x1B000))
+#define ewram1B000_alt (*(struct Struct201B000 *)(ewram + 0x1B000))
+#define EWRAM_1B000 ewram1B000_alt // FIXME
+#define EWRAM_1B000_2 (*(struct Struct201B000 *)(ewram + 0x1B000))
+#define EWRAM_1C000 (*(struct Struct201C000 *)(ewram + 0x1C000))
+#define ewram1C000 (*(struct Unk201C000 *)(ewram + 0x1C000))
+#define ewram1c000 (*(struct Unk201C000 *)(ewram + 0x1C000)) // FIXME, names too similar
+#define ewram1D000 ((struct Pokemon *)(ewram + 0x1D000))
+#define ewram1D000_2 ((u16 *)(ewram + 0x1D000))
+#define ewram1D400 ((u16 *)(ewram + 0x1D400))
+#define ewramSavedItemsPocket ((struct ItemSlot *)(ewram + 0x1E000)) // saved items pocket (for Wally battle)
+#define HALL_OF_FAME_SHEET_0 ((u8 *)(ewram + 0x1E000))
+#define HALL_OF_FAME_SHEET_1 ((u8 *)(ewram + 0x1E800))
+#define ewram_1f000 (*(struct DecoPCPointers *)(ewram + 0x1f000))
+#define ewramSavedPokeballsPocket ((struct ItemSlot *)(ewram + 0x1F000)) // saved Pokeballs pocket (for Wally battle)
+#define HALL_OF_FAME_SHEET_2 ((u8 *)(ewram + 0x1F000))
+#define EWRAM_1F800 ((u16 *)(ewram + 0x1F800))
+#define ewram1FE00 (*(struct Unk201FE00 *)(ewram + 0x1FE00))
+#define gHelperState (ewram[0x1FFFE])
+#define gReshowState (ewram[0x1FFFF])
+#define ewramBagSetupStep (ewram[0x1FFFF])
+
+#endif
diff --git a/include/party_menu.h b/include/party_menu.h
index f13c2c2df..a60b90469 100644
--- a/include/party_menu.h
+++ b/include/party_menu.h
@@ -101,11 +101,7 @@ struct UnknownPokemonStruct2
/*0x1D*/ u8 language;
};
-extern u8 ewram[];
-#define ewram01000 (*(struct Unk2001000 *)(ewram + 0x01000))
-#define ewram1B000 (*(struct Unk201B000 *)(ewram + 0x1B000))
-#define ewram1B000_alt (*(struct Struct201B000 *)(ewram + 0x1B000))
-#define EWRAM_1B000 ewram1B000_alt
+#include "ewram.h"
void CB2_PartyMenuMain(void);
void ChangeBattleTowerPartyMenuSelection(u8 taskId, s8 directionPressed);
diff --git a/include/player_pc.h b/include/player_pc.h
index 8debeda88..3302ec634 100644
--- a/include/player_pc.h
+++ b/include/player_pc.h
@@ -13,6 +13,7 @@
#define SWAP_ITEM_INDEX data[8]
#define SWITCH_MODE_ACTIVE data[9]
+// this is potentially an ewram access occuring in high ewram. TODO: investigate this further.
#define NEW_GAME_PC_ITEMS(i, type) ((u16)((u16 *)gNewGamePCItems + type)[i * 2])
// defined and used in the above macro
diff --git a/include/script_pokemon_80F9.h b/include/script_pokemon_80F9.h
index fa5d57f0e..5e2b11f3c 100644
--- a/include/script_pokemon_80F9.h
+++ b/include/script_pokemon_80F9.h
@@ -7,7 +7,7 @@ struct UnknownStruct2018000
u8 unk8;
};
-extern struct UnknownStruct2018000 unk_2018000;
+#include "ewram.h" // UNK_2018000_STRUCT requires this include. TODO: fix?
void OpenPartyMenuFromScriptContext(u8 taskId);
void sub_80F9C00(void);