From 93b4a7b81585a78a897eafc88be1d836c12f97e2 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 12 Sep 2024 12:59:51 -0400 Subject: [PATCH] Toolchain sync fixes --- Makefile | 19 ++++++----- config.mk | 4 +-- include/characters.h | 67 +++++++++++++++++++++++++++++++++++++ sound/songs/midi/midi.cfg | 2 +- src/region_map.c | 40 +++++++++++----------- tools/jsonproc/jsonproc.cpp | 7 ++++ 6 files changed, 107 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index 6f028474a..cd7650008 100644 --- a/Makefile +++ b/Makefile @@ -89,8 +89,14 @@ else PATH_MODERNCC := PATH="$(PATH)" $(MODERNCC) CC1 := $(shell $(PATH_MODERNCC) --print-prog-name=cc1) -quiet override CFLAGS += -mthumb -mthumb-interwork -O$(O_LEVEL) -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast - LIBPATH := -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libnosys.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libc.a))" - LIB := $(LIBPATH) -lgcc -lc -lnosys + LIBPATH := -L $(shell dirname $(shell $(PATH_MODERNCC) -print-file-name=libgcc.a)) -L $(shell dirname $(shell $(PATH_MODERNCC) -print-file-name=libc.a)) + LIB := $(LIBPATH) -lc -lgcc + ifneq ($(DEVKITARM),) + ifeq ($(TOOLCHAIN),$(DEVKITARM)) + LIB += -lsysbase -lc + endif + endif + LIB += -lnosys endif # Enable debug info if set ifeq ($(DINFO),1) @@ -194,7 +200,6 @@ endif syms: $(SYM) clean: tidy clean-tools clean-generated clean-assets -# @$(MAKE) clean -C libagbsyscall clean-assets: rm -f $(MID_SUBDIR)/*.s @@ -371,15 +376,11 @@ LD_SCRIPT := ld_script_modern.ld LD_SCRIPT_DEPS := endif -$(OBJ_DIR)/ld_script.ld: $(LD_SCRIPT) $(LD_SCRIPT_DEPS) - sed "s#tools/#tools/#g" $(LD_SCRIPT) > $(OBJ_DIR)/ld_script.ld - # Final rules # Elf from object files -$(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS) - @echo "cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ " - @cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld --print-memory-usage -o ../../$@ $(OBJS_REL) $(LIB) | cat +$(ELF): $(LD_SCRIPT) $(LD_SCRIPT_DEPS) $(OBJS) + @cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ../../$< --print-memory-usage -o ../../$@ $(OBJS_REL) $(LIB) | cat $(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(GAME_REVISION) --silent # Builds the rom from the elf file diff --git a/config.mk b/config.mk index b68147a6c..07a34ef9e 100644 --- a/config.mk +++ b/config.mk @@ -25,12 +25,12 @@ BUILD_DIR := build ifeq ($(GAME_VERSION),FIRERED) TITLE := POKEMON FIRE GAME_CODE := BPR - BUILD_NAME := firered + BUILD_NAME := firered else ifeq ($(GAME_VERSION),LEAFGREEN) TITLE := POKEMON LEAF GAME_CODE := BPG - BUILD_NAME := leafgreen + BUILD_NAME := leafgreen else $(error unknown version $(GAME_VERSION)) endif diff --git a/include/characters.h b/include/characters.h index c310a8e51..d00ecf0a3 100644 --- a/include/characters.h +++ b/include/characters.h @@ -279,4 +279,71 @@ #define PLACEHOLDER_ID_GROUDON 0xC #define PLACEHOLDER_ID_KYOGRE 0xD +// Note that while all dot combinations are represented in +// the Braille font, they are not all meaningful characters. +// Only those that have direct single-character translations are listed. +#define BRAILLE_CHAR_SPACE 0x00 +#define BRAILLE_CHAR_A 0x01 +// +#define BRAILLE_CHAR_C 0x03 +#define BRAILLE_CHAR_COMMA 0x04 +#define BRAILLE_CHAR_B 0x05 +#define BRAILLE_CHAR_I 0x06 +#define BRAILLE_CHAR_F 0x07 +// +#define BRAILLE_CHAR_E 0x09 +// +#define BRAILLE_CHAR_D 0x0B +#define BRAILLE_CHAR_COLON 0x0C +#define BRAILLE_CHAR_H 0x0D +#define BRAILLE_CHAR_J 0x0E +#define BRAILLE_CHAR_G 0x0F +#define BRAILLE_CHAR_APOSTROPHE 0x10 +#define BRAILLE_CHAR_K 0x11 +#define BRAILLE_CHAR_SLASH 0x12 +#define BRAILLE_CHAR_M 0x13 +#define BRAILLE_CHAR_SEMICOLON 0x14 +#define BRAILLE_CHAR_L 0x15 +#define BRAILLE_CHAR_S 0x16 +#define BRAILLE_CHAR_P 0x17 +// +#define BRAILLE_CHAR_O 0x19 +// +#define BRAILLE_CHAR_N 0x1B +#define BRAILLE_CHAR_EXCL_MARK 0x1C +#define BRAILLE_CHAR_R 0x1D +#define BRAILLE_CHAR_T 0x1E +#define BRAILLE_CHAR_Q 0x1F +// +#define BRAILLE_CHAR_PERIOD 0x2C +// +#define BRAILLE_CHAR_W 0x2E +// +#define BRAILLE_CHAR_HYPHEN 0x30 +#define BRAILLE_CHAR_U 0x31 +// +#define BRAILLE_CHAR_X 0x33 +#define BRAILLE_CHAR_QUESTION_MARK 0x34 // Also double quote left +#define BRAILLE_CHAR_V 0x35 +// +#define BRAILLE_CHAR_DBL_QUOTE_RIGHT 0x38 +#define BRAILLE_CHAR_Z 0x39 +#define BRAILLE_CHAR_NUMBER 0x3A +#define BRAILLE_CHAR_Y 0x3B +#define BRAILLE_CHAR_PAREN 0x3C +// +#define NUM_BRAILLE_CHARS 0x40 + +// Digits must be preceded by BRAILLE_CHAR_NUMBER +#define BRAILLE_CHAR_1 BRAILLE_CHAR_A +#define BRAILLE_CHAR_2 BRAILLE_CHAR_B +#define BRAILLE_CHAR_3 BRAILLE_CHAR_C +#define BRAILLE_CHAR_4 BRAILLE_CHAR_D +#define BRAILLE_CHAR_5 BRAILLE_CHAR_E +#define BRAILLE_CHAR_6 BRAILLE_CHAR_F +#define BRAILLE_CHAR_7 BRAILLE_CHAR_G +#define BRAILLE_CHAR_8 BRAILLE_CHAR_H +#define BRAILLE_CHAR_9 BRAILLE_CHAR_I +#define BRAILLE_CHAR_0 BRAILLE_CHAR_J + #endif // GUARD_CHARACTERS_H diff --git a/sound/songs/midi/midi.cfg b/sound/songs/midi/midi.cfg index 4f0afd872..5c419ac3f 100644 --- a/sound/songs/midi/midi.cfg +++ b/sound/songs/midi/midi.cfg @@ -272,4 +272,4 @@ se_unlock.mid: -E -R50 -G128 -V100 -P4 se_use_item.mid: -E -R50 -G127 -V100 -P5 se_vend.mid: -E -R50 -G128 -V110 -P4 se_warp_in.mid: -E -R50 -G127 -V090 -P4 -se_warp_out.mid: -E -R50 -G127 -V090 -P4 \ No newline at end of file +se_warp_out.mid: -E -R50 -G127 -V090 -P4 diff --git a/src/region_map.c b/src/region_map.c index 8e640c405..912d76145 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -640,79 +640,79 @@ static const union AnimCmd *const sAnims_SwitchMapCursor[] = { static const struct DungeonMapInfo sDungeonInfo[] = { { .id = MAPSEC_VIRIDIAN_FOREST, - .name = sMapsecName_VIRIDIANFOREST, + .name = sMapsecName_VIRIDIAN_FOREST, .desc = gText_RegionMap_AreaDesc_ViridianForest }, { .id = MAPSEC_MT_MOON, - .name = sMapsecName_MTMOON, + .name = sMapsecName_MT__MOON, .desc = gText_RegionMap_AreaDesc_MtMoon }, { .id = MAPSEC_DIGLETTS_CAVE, - .name = sMapsecName_DIGLETTSCAVE, + .name = sMapsecName_DIGLETT_S_CAVE, .desc = gText_RegionMap_AreaDesc_DiglettsCave }, { .id = MAPSEC_KANTO_VICTORY_ROAD, - .name = sMapsecName_VICTORYROAD, + .name = sMapsecName_VICTORY_ROAD, .desc = gText_RegionMap_AreaDesc_VictoryRoad }, { .id = MAPSEC_POKEMON_MANSION, - .name = sMapsecName_POKMONMANSION, + .name = sMapsecName_POK__MON_MANSION, .desc = gText_RegionMap_AreaDesc_PokemonMansion }, { .id = MAPSEC_KANTO_SAFARI_ZONE, - .name = sMapsecName_SAFARIZONE, + .name = sMapsecName_SAFARI_ZONE, .desc = gText_RegionMap_AreaDesc_SafariZone }, { .id = MAPSEC_ROCK_TUNNEL, - .name = sMapsecName_ROCKTUNNEL, + .name = sMapsecName_ROCK_TUNNEL, .desc = gText_RegionMap_AreaDesc_RockTunnel }, { .id = MAPSEC_SEAFOAM_ISLANDS, - .name = sMapsecName_SEAFOAMISLANDS, + .name = sMapsecName_SEAFOAM_ISLANDS, .desc = gText_RegionMap_AreaDesc_SeafoamIslands }, { .id = MAPSEC_POKEMON_TOWER, - .name = sMapsecName_POKMONTOWER, + .name = sMapsecName_POK__MON_TOWER, .desc = gText_RegionMap_AreaDesc_PokemonTower }, { .id = MAPSEC_CERULEAN_CAVE, - .name = sMapsecName_CERULEANCAVE, + .name = sMapsecName_CERULEAN_CAVE, .desc = gText_RegionMap_AreaDesc_CeruleanCave }, { .id = MAPSEC_POWER_PLANT, - .name = sMapsecName_POWERPLANT, + .name = sMapsecName_POWER_PLANT, .desc = gText_RegionMap_AreaDesc_PowerPlant }, { .id = MAPSEC_MT_EMBER, - .name = sMapsecName_MTEMBER, + .name = sMapsecName_MT__EMBER, .desc = gText_RegionMap_AreaDesc_MtEmber }, { .id = MAPSEC_BERRY_FOREST, - .name = sMapsecName_BERRYFOREST, + .name = sMapsecName_BERRY_FOREST, .desc = gText_RegionMap_AreaDesc_BerryForest }, { .id = MAPSEC_ICEFALL_CAVE, - .name = sMapsecName_ICEFALLCAVE, + .name = sMapsecName_ICEFALL_CAVE, .desc = gText_RegionMap_AreaDesc_IcefallCave }, { .id = MAPSEC_LOST_CAVE, - .name = sMapsecName_LOSTCAVE, + .name = sMapsecName_LOST_CAVE, .desc = gText_RegionMap_AreaDesc_LostCave }, { .id = MAPSEC_TANOBY_CHAMBERS, - .name = sMapsecName_TANOBYCHAMBERS, + .name = sMapsecName_TANOBY_CHAMBERS, .desc = gText_RegionMap_AreaDesc_TanobyRuins }, { .id = MAPSEC_ALTERING_CAVE, - .name = sMapsecName_ALTERINGCAVE, + .name = sMapsecName_ALTERING_CAVE, .desc = gText_RegionMap_AreaDesc_AlteringCave }, { .id = MAPSEC_PATTERN_BUSH, - .name = sMapsecName_PATTERNBUSH, + .name = sMapsecName_PATTERN_BUSH, .desc = gText_RegionMap_AreaDesc_PatternBush }, { .id = MAPSEC_DOTTED_HOLE, - .name = sMapsecName_DOTTEDHOLE, + .name = sMapsecName_DOTTED_HOLE, .desc = gText_RegionMap_AreaDesc_DottedHole } }; @@ -3806,7 +3806,7 @@ u8 *GetMapName(u8 *dst0, u16 mapsec, u16 fill) if ((idx = mapsec - MAPSECS_KANTO) <= MAPSEC_SPECIAL_AREA - MAPSECS_KANTO) { if (IsCeladonDeptStoreMapsec(mapsec) == TRUE) - dst = StringCopy(dst0, sMapsecName_CELADONDEPT); + dst = StringCopy(dst0, sMapsecName_CELADON_DEPT_); else dst = StringCopy(dst0, sMapNames[idx]); } diff --git a/tools/jsonproc/jsonproc.cpp b/tools/jsonproc/jsonproc.cpp index 03e51b765..68b1c73ba 100755 --- a/tools/jsonproc/jsonproc.cpp +++ b/tools/jsonproc/jsonproc.cpp @@ -45,6 +45,13 @@ int main(int argc, char *argv[]) return "//\n// DO NOT MODIFY THIS FILE! It is auto-generated from " + jsonfilepath +" and Inja template " + templateFilepath + "\n//\n"; }); + env.add_callback("contains", 2, [](Arguments& args) { + string word = args.at(0)->get(); + string check = args.at(1)->get(); + + return word.find(check) != std::string::npos; + }); + env.add_callback("subtract", 2, [](Arguments& args) { int minuend = args.at(0)->get(); int subtrahend = args.at(1)->get();