diff options
author | luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> | 2020-07-04 18:14:40 -0400 |
---|---|---|
committer | luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> | 2020-07-04 18:14:40 -0400 |
commit | d7df6bf6e3b6066bef0bd0602b0b9c2d036f100a (patch) | |
tree | 84f7564fdc72867f44e9c5acf6b1dae78b5f13b6 | |
parent | aecf2dbf6e26469cc40ab2c3aec155aecba7091b (diff) |
Get rid of manual sym defines in sym_ewram.txt and ld_script_modern.txt
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | compare.sh | 12 | ||||
-rw-r--r-- | constants/misc_constants.inc | 2 | ||||
-rw-r--r-- | include/pokemon_summary_screen.h | 6 | ||||
-rw-r--r-- | ld_script_modern.txt | 14 | ||||
-rw-r--r-- | replace.sh | 9 | ||||
-rw-r--r-- | src/pokemon_summary_screen.c | 23 | ||||
-rw-r--r-- | sym_ewram.txt | 39 |
8 files changed, 30 insertions, 77 deletions
diff --git a/.gitignore b/.gitignore index e83f42a30..50910379c 100644 --- a/.gitignore +++ b/.gitignore @@ -56,5 +56,3 @@ types_*.taghl _Deparsed_XSubs.pm porymap.project.cfg .vscode/*.* -baserom.txt -pokefirered.txt diff --git a/compare.sh b/compare.sh index 86db204ee..10279b616 100644 --- a/compare.sh +++ b/compare.sh @@ -1,11 +1,11 @@ -#!/bin/sh +#!/bin/bash # Compares baserom.gba and pokefirered.gba -# create baserom.txt if necessary -if [ ! -f baserom.txt ]; then - hexdump -C baserom.gba > baserom.txt # can create an empty baserom.txt if no baserom.gba +# create baserom_compare.dump if necessary +if [ ! -f baserom_compare.dump ]; then + hexdump -C baserom.gba > baserom_compare.dump # can create an empty baserom_compare.dump if no baserom.gba fi -hexdump -C pokefirered.gba > pokefirered.txt +hexdump -C pokefirered.gba > pokefirered_compare.dump -diff -u baserom.txt pokefirered.txt | less +diff -u baserom_compare.dump pokefirered_compare.dump | less diff --git a/constants/misc_constants.inc b/constants/misc_constants.inc index 959465a5a..1f4a6a23a 100644 --- a/constants/misc_constants.inc +++ b/constants/misc_constants.inc @@ -3,8 +3,6 @@ .set NULL, 0 - .set MOVE_NAME_LENGTH, 13 - .set SPRITE_SIZE_8x8, (OAM_SIZE_0 >> 28) | (OAM_SQUARE >> 14) .set SPRITE_SIZE_16x16, (OAM_SIZE_1 >> 28) | (OAM_SQUARE >> 14) .set SPRITE_SIZE_32x32, (OAM_SIZE_2 >> 28) | (OAM_SQUARE >> 14) diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index 5e3603bfe..df136ac21 100644 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -3,10 +3,8 @@ #include "main.h" -extern u8 gLastViewedMonIndex; - -extern const u8 *const gMoveDescriptionPointers[]; -extern const u8 *const gNatureNamePointers[]; +extern const u8 * const gMoveDescriptionPointers[]; +extern const u8 * const gNatureNamePointers[]; void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u16); void ShowPokemonSummaryScreenSet40EF(u8 mode, struct BoxPokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)); diff --git a/ld_script_modern.txt b/ld_script_modern.txt index 33de4451a..992706e1b 100644 --- a/ld_script_modern.txt +++ b/ld_script_modern.txt @@ -12,20 +12,6 @@ SECTIONS { . = 0x1C000; *(ewram_data); - /* pokemon_summary_screen.o */ - . = ALIGN(4); - gUnknown_203B140 = .; . += 0x4; - gUnknown_203B144 = .; . += 0x4; - gUnknown_203B148 = .; . += 0x10; - gUnknown_203B158 = .; . += 0x4; - gUnknown_203B15C = .; . += 0x4; - gUnknown_203B160 = .; . += 0x4; - gUnknown_203B164 = .; . += 0x4; - gUnknown_203B168 = .; . += 0x4; - gLastViewedMonIndex = .; . += 0x1; - gUnknown_203B16D = .; . += 0x1; - gUnknown_203B16E = .; . += 0x2; - gUnknown_203B170 = .; . += 0x4; . = 0x40000; } diff --git a/replace.sh b/replace.sh new file mode 100644 index 000000000..8ec32d944 --- /dev/null +++ b/replace.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# $1: phrase to find +# $2: phrase to replace $1 +if [ "$1" = "" -o "$2" = "" ]; then + echo "Usage: replace.sh [PHRASE TO FIND] [PHRASE TO REPLACE PHRASE TO FIND]" + exit 0 +fi + +sed -i 's/\<'"$1"'\>/'"$2"'/' $(grep -lwr --include="*.s" --include="*.h" --include="*.c" --include="*.inc" --include="*.json" --include="*.txt" --exclude-dir="tools" --exclude-dir=".git" --exclude-dir="build" --exclude-dir="berry_fix/build" --exclude-dir="berry_fix/payload/build" --exclude-dir=".travis" "$1") diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index e06dcb6dd..086c9585b 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -316,17 +316,18 @@ struct Struct203B168 u16 unk06; /* 0x06 */ }; -extern struct PokemonSummaryScreenData * gMonSummaryScreen; -extern struct Struct203B144 * gUnknown_203B144; -extern struct Struct203B148 * gUnknown_203B148[4]; -extern struct Struct203B158 * gUnknown_203B158; -extern struct Struct203B15C * gUnknown_203B15C; -extern struct Struct203B160 * gUnknown_203B160; -extern struct Struct203B164 * gUnknown_203B164; -extern struct Struct203B168 * gUnknown_203B168; -extern u8 gUnknown_203B16D; -extern u8 gUnknown_203B16E; -extern struct Struct203B170 * gUnknown_203B170; +static EWRAM_DATA struct PokemonSummaryScreenData * gMonSummaryScreen = NULL; +static EWRAM_DATA struct Struct203B144 * gUnknown_203B144 = NULL; +static EWRAM_DATA struct Struct203B148 * gUnknown_203B148[4] = {}; +static EWRAM_DATA struct Struct203B158 * gUnknown_203B158 = NULL; +static EWRAM_DATA struct Struct203B15C * gUnknown_203B15C = NULL; +static EWRAM_DATA struct Struct203B160 * gUnknown_203B160 = NULL; +static EWRAM_DATA struct Struct203B164 * gUnknown_203B164 = NULL; +static EWRAM_DATA struct Struct203B168 * gUnknown_203B168 = NULL; +static EWRAM_DATA u8 gLastViewedMonIndex = 0; +static EWRAM_DATA u8 gUnknown_203B16D = 0; +static EWRAM_DATA u8 gUnknown_203B16E = 0; +static EWRAM_DATA struct Struct203B170 * gUnknown_203B170 = NULL; extern const u32 gUnknown_8E9B750[]; extern const u32 gUnknown_8E9B950[]; diff --git a/sym_ewram.txt b/sym_ewram.txt index 9fabd6c3b..d92def7f2 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -232,45 +232,8 @@ .include "src/tm_case.o" .align 2 .include "src/menu_indicators.o" - .align 2 - @ .include "src/pokemon_summary_screen.o" -gMonSummaryScreen: @ 203B140 - .space 0x4 - -gUnknown_203B144: @ 203B144 - .space 0x4 - -gUnknown_203B148: @ 203B148 - .space 0x10 - -gUnknown_203B158: @ 203B158 - .space 0x4 - -gUnknown_203B15C: @ 203B15C - .space 0x4 - -gUnknown_203B160: @ 203B160 - .space 0x4 - -gUnknown_203B164: @ 203B164 - .space 0x4 - -gUnknown_203B168: @ 203B168 - .space 0x4 - -gLastViewedMonIndex: @ 203B16C - .space 0x1 - -gUnknown_203B16D: @ 203B16D - .space 0x1 - -gUnknown_203B16E: @ 203B16E - .space 0x2 - -gUnknown_203B170: @ 203B170 - .space 0x4 - + .include "src/pokemon_summary_screen.o" .align 2 .include "src/help_system.o" .align 2 |