Merge pull request #672 from GriffinRichards/sync-toolchain

Sync Makefile and tools with pokeemerald
This commit is contained in:
GriffinR
2024-09-18 19:40:16 -04:00
committed by GitHub
46 changed files with 14567 additions and 14467 deletions
+260 -239
View File
@@ -1,17 +1,20 @@
TOOLCHAIN := $(DEVKITARM)
COMPARE ?= 0
include config.mk
# Default make rule
all: rom
# Toolchain selection
TOOLCHAIN := $(DEVKITARM)
# don't use dkP's base_tools anymore
# because the redefinition of $(CC) conflicts
# with when we want to use $(CC) to preprocess files
# thus, manually create the variables for the bin
# files, or use arm-none-eabi binaries on the system
# if dkP is not installed on this system
ifneq (,$(TOOLCHAIN))
ifneq ($(wildcard $(TOOLCHAIN)/bin),)
export PATH := $(TOOLCHAIN)/bin:$(PATH)
endif
ifneq ($(wildcard $(TOOLCHAIN)/bin),)
export PATH := $(TOOLCHAIN)/bin:$(PATH)
endif
endif
PREFIX := arm-none-eabi-
@@ -20,14 +23,9 @@ OBJDUMP := $(PREFIX)objdump
AS := $(PREFIX)as
LD := $(PREFIX)ld
# note: the makefile must be set up so MODERNCC is never called
# if MODERN=0
MODERNCC := $(PREFIX)gcc
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
ifeq ($(OS),Windows_NT)
EXE := .exe
endif
# use arm-none-eabi-cpp for macOS
@@ -47,42 +45,20 @@ else
CPP := $(PREFIX)cpp
endif
include config.mk
GCC_VER = $(shell $(CC) -dumpversion)
ifeq ($(MODERN),0)
CC1 := tools/agbcc/bin/agbcc$(EXE)
override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm
LIBPATH := -L ../../tools/agbcc/lib
else
CC1 := $(shell $(MODERNCC) --print-prog-name=cc1) -quiet
override CFLAGS += -mthumb -mthumb-interwork -O2 -mcpu=arm7tdmi -mabi=apcs-gnu -fno-toplevel-reorder -fno-aggressive-loop-optimizations -Wno-pointer-to-int-cast
LIBPATH := -L $(shell dirname $(shell $(MODERNCC) --print-file-name=libgcc.a)) -L $(shell dirname $(shell $(MODERNCC) --print-file-name=libc.a))
endif
CPPFLAGS := -iquote include -D$(GAME_VERSION) -DREVISION=$(GAME_REVISION) -D$(GAME_LANGUAGE) -DMODERN=$(MODERN)
ifeq ($(MODERN),0)
CPPFLAGS += -I tools/agbcc -I tools/agbcc/include -nostdinc -undef
endif
SHELL := /bin/bash -o pipefail
ROM := poke$(BUILD_NAME).gba
OBJ_DIR := build/$(BUILD_NAME)
OBJ_DIR := $(BUILD_DIR)/$(BUILD_NAME)
ELF = $(ROM:.gba=.elf)
MAP = $(ROM:.gba=.map)
SYM = $(ROM:.gba=.sym)
ELF := $(ROM:.gba=.elf)
MAP := $(ROM:.gba=.map)
SYM := $(ROM:.gba=.sym)
# Commonly used directories
C_SUBDIR = src
DATA_C_SUBDIR = src/data
ASM_SUBDIR = asm
DATA_SRC_SUBDIR = src/data
DATA_ASM_SUBDIR = data
SONG_SUBDIR = sound/songs
MID_SUBDIR = sound/songs/midi
SAMPLE_SUBDIR = sound/direct_sound_samples
CRY_SUBDIR = sound/direct_sound_samples/cries
C_BUILDDIR = $(OBJ_DIR)/$(C_SUBDIR)
ASM_BUILDDIR = $(OBJ_DIR)/$(ASM_SUBDIR)
@@ -90,32 +66,61 @@ DATA_ASM_BUILDDIR = $(OBJ_DIR)/$(DATA_ASM_SUBDIR)
SONG_BUILDDIR = $(OBJ_DIR)/$(SONG_SUBDIR)
MID_BUILDDIR = $(OBJ_DIR)/$(MID_SUBDIR)
SHELL := bash -o pipefail
# Set flags for tools
ASFLAGS := -mcpu=arm7tdmi --defsym $(GAME_VERSION)=1 --defsym REVISION=$(GAME_REVISION) --defsym $(GAME_LANGUAGE)=1 --defsym MODERN=$(MODERN)
LDFLAGS = -Map ../../$(MAP)
INCLUDE_DIRS := include
INCLUDE_CPP_ARGS := $(INCLUDE_DIRS:%=-iquote %)
INCLUDE_SCANINC_ARGS := $(INCLUDE_DIRS:%=-I %)
LIB := $(LIBPATH) -lc -lgcc
ifneq ($(MODERN),0)
ifneq ($(DEVKITARM),)
ifeq ($(TOOLCHAIN),$(DEVKITARM))
LIB += -lsysbase -lc
O_LEVEL ?= 2
CPPFLAGS := $(INCLUDE_CPP_ARGS) -Wno-trigraphs -D$(GAME_VERSION) -DREVISION=$(GAME_REVISION) -D$(GAME_LANGUAGE) -DMODERN=$(MODERN)
ifeq ($(MODERN),0)
CPPFLAGS += -I tools/agbcc/include -I tools/agbcc -nostdinc -undef
CC1 := tools/agbcc/bin/agbcc$(EXE)
override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O$(O_LEVEL) -fhex-asm
LIBPATH := -L ../../tools/agbcc/lib
LIB := $(LIBPATH) -lgcc -lc
else
# Note: The makefile must be set up to not call these if modern == 0
MODERNCC := $(PREFIX)gcc
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 $(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
endif
LIB += -lnosys
# Enable debug info if set
ifeq ($(DINFO),1)
override CFLAGS += -g
endif
SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c
GFX := tools/gbagfx/gbagfx
AIF := tools/aif2pcm/aif2pcm
MID := tools/mid2agb/mid2agb
SCANINC := tools/scaninc/scaninc
PREPROC := tools/preproc/preproc
RAMSCRGEN := tools/ramscrgen/ramscrgen
FIX := tools/gbafix/gbafix
MAPJSON := tools/mapjson/mapjson
JSONPROC := tools/jsonproc/jsonproc
# Variable filled out in other make files
AUTO_GEN_TARGETS :=
include make_tools.mk
# Tool executables
GFX := $(TOOLS_DIR)/gbagfx/gbagfx$(EXE)
AIF := $(TOOLS_DIR)/aif2pcm/aif2pcm$(EXE)
MID := $(TOOLS_DIR)/mid2agb/mid2agb$(EXE)
SCANINC := $(TOOLS_DIR)/scaninc/scaninc$(EXE)
PREPROC := $(TOOLS_DIR)/preproc/preproc$(EXE)
RAMSCRGEN := $(TOOLS_DIR)/ramscrgen/ramscrgen$(EXE)
FIX := $(TOOLS_DIR)/gbafix/gbafix$(EXE)
MAPJSON := $(TOOLS_DIR)/mapjson/mapjson$(EXE)
JSONPROC := $(TOOLS_DIR)/jsonproc/jsonproc$(EXE)
PERL := perl
SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c
MAKEFLAGS += --no-print-directory
# Clear the default suffixes
.SUFFIXES:
@@ -124,25 +129,41 @@ PERL := perl
# Delete files that weren't built properly
.DELETE_ON_ERROR:
# Secondary expansion is required for dependency variables in object rules.
.SECONDEXPANSION:
ALL_BUILDS := firered firered_rev1 leafgreen leafgreen_rev1
ALL_BUILDS += $(ALL_BUILDS:%=%_modern)
$(shell mkdir -p $(C_BUILDDIR) $(ASM_BUILDDIR) $(DATA_ASM_BUILDDIR) $(SONG_BUILDDIR) $(MID_BUILDDIR))
RULES_NO_SCAN += clean clean-assets tidy generated clean-generated
.PHONY: all rom modern compare $(ALL_BUILDS) $(ALL_BUILDS:%=compare_%)
.PHONY: $(RULES_NO_SCAN)
infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line))))
# Build tools when building the rom
# Disable dependency scanning for clean/tidy/tools
ifeq (,$(filter-out all compare syms modern,$(MAKECMDGOALS)))
$(call infoshell, $(MAKE) tools)
else
NODEP := 1
# Check if we need to scan dependencies based on the chosen rule OR user preference
NODEP ?= 0
# Check if we need to pre-build tools and generate assets based on the chosen rule.
SETUP_PREREQS ?= 1
# Disable dependency scanning for rules that don't need it.
ifneq (,$(MAKECMDGOALS))
ifeq (,$(filter-out $(RULES_NO_SCAN),$(MAKECMDGOALS)))
NODEP := 1
SETUP_PREREQS := 0
endif
endif
C_SRCS := $(wildcard $(C_SUBDIR)/*.c)
ifeq ($(SETUP_PREREQS),1)
# If set on: Default target or a rule requiring a scan
# Forcibly execute `make tools` since we need them for what we are doing.
$(call infoshell, $(MAKE) -f make_tools.mk)
# Oh and also generate mapjson sources before we use `SCANINC`.
$(call infoshell, $(MAKE) generated)
endif
# Collect sources
C_SRCS_IN := $(wildcard $(C_SUBDIR)/*.c $(C_SUBDIR)/*/*.c $(C_SUBDIR)/*/*/*.c)
C_SRCS := $(foreach src,$(C_SRCS_IN),$(if $(findstring .inc.c,$(src)),,$(src)))
C_OBJS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_SRCS))
C_ASM_SRCS += $(wildcard $(C_SUBDIR)/*.s $(C_SUBDIR)/*/*.s $(C_SUBDIR)/*/*/*.s)
C_ASM_SRCS := $(wildcard $(C_SUBDIR)/*.s $(C_SUBDIR)/*/*.s $(C_SUBDIR)/*/*/*.s)
C_ASM_OBJS := $(patsubst $(C_SUBDIR)/%.s,$(C_BUILDDIR)/%.o,$(C_ASM_SRCS))
ASM_SRCS := $(wildcard $(ASM_SUBDIR)/*.s)
@@ -160,186 +181,37 @@ SONG_OBJS := $(patsubst $(SONG_SUBDIR)/%.s,$(SONG_BUILDDIR)/%.o,$(SONG_SRCS))
MID_SRCS := $(wildcard $(MID_SUBDIR)/*.mid)
MID_OBJS := $(patsubst $(MID_SUBDIR)/%.mid,$(MID_BUILDDIR)/%.o,$(MID_SRCS))
OBJS := $(C_OBJS) $(C_ASM_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS) $(SONG_OBJS) $(MID_OBJS)
OBJS := $(C_OBJS) $(C_ASM_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS) $(SONG_OBJS) $(MID_OBJS)
OBJS_REL := $(patsubst $(OBJ_DIR)/%,%,$(OBJS))
TOOLDIRS := $(filter-out tools/agbcc tools/binutils tools/analyze_source,$(wildcard tools/*))
TOOLBASE = $(TOOLDIRS:tools/%=%)
TOOLS = $(foreach tool,$(TOOLBASE),tools/$(tool)/$(tool)$(EXE))
SUBDIRS := $(sort $(dir $(OBJS)))
$(shell mkdir -p $(SUBDIRS))
ALL_BUILDS := firered firered_rev1 leafgreen leafgreen_rev1
ALL_BUILDS += $(ALL_BUILDS:%=%_modern)
.PHONY: all rom tools clean-tools mostlyclean clean compare tidy syms $(TOOLDIRS) $(ALL_BUILDS) $(ALL_BUILDS:%=compare_%) modern
MAKEFLAGS += --no-print-directory
AUTO_GEN_TARGETS :=
all: tools rom
syms: $(SYM)
# Pretend rules that are actually flags defer to `make all`
modern: all
compare: all
# Other rules
rom: $(ROM)
ifeq ($(COMPARE),1)
@$(SHA1) $(BUILD_NAME).sha1
endif
tools: $(TOOLDIRS)
syms: $(SYM)
$(TOOLDIRS):
@$(MAKE) -C $@
clean: tidy clean-tools clean-generated clean-assets
# For contributors to make sure a change didn't affect the contents of the ROM.
compare:
@$(MAKE) COMPARE=1
mostlyclean: tidy
rm -f $(SAMPLE_SUBDIR)/*.bin
rm -f $(CRY_SUBDIR)/*.bin
$(RM) $(SONG_OBJS) $(MID_SUBDIR)/*.s
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} +
$(RM) $(DATA_ASM_SUBDIR)/layouts/layouts.inc $(DATA_ASM_SUBDIR)/layouts/layouts_table.inc
$(RM) $(DATA_ASM_SUBDIR)/maps/connections.inc $(DATA_ASM_SUBDIR)/maps/events.inc $(DATA_ASM_SUBDIR)/maps/groups.inc $(DATA_ASM_SUBDIR)/maps/headers.inc
clean-assets:
rm -f $(MID_SUBDIR)/*.s
rm -f $(DATA_ASM_SUBDIR)/layouts/layouts.inc $(DATA_ASM_SUBDIR)/layouts/layouts_table.inc
rm -f $(DATA_ASM_SUBDIR)/maps/connections.inc $(DATA_ASM_SUBDIR)/maps/events.inc $(DATA_ASM_SUBDIR)/maps/groups.inc $(DATA_ASM_SUBDIR)/maps/headers.inc
find sound -iname '*.bin' -exec rm {} +
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} +
find $(DATA_ASM_SUBDIR)/maps \( -iname 'connections.inc' -o -iname 'events.inc' -o -iname 'header.inc' \) -exec rm {} +
$(RM) $(AUTO_GEN_TARGETS)
clean-tools:
@$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);)
clean: mostlyclean clean-tools
tidy:
$(RM) $(ALL_BUILDS:%=poke%{.gba,.elf,.map})
$(RM) -r build
include graphics_file_rules.mk
include tileset_rules.mk
include map_data_rules.mk
include spritesheet_rules.mk
include json_data_rules.mk
include songs.mk
%.s: ;
%.png: ;
%.pal: ;
%.aif: ;
%.1bpp: %.png ; $(GFX) $< $@
%.4bpp: %.png ; $(GFX) $< $@
%.8bpp: %.png ; $(GFX) $< $@
%.gbapal: %.pal ; $(GFX) $< $@
%.gbapal: %.png ; $(GFX) $< $@
%.lz: % ; $(GFX) $< $@
%.rl: % ; $(GFX) $< $@
$(CRY_SUBDIR)/%.bin: $(CRY_SUBDIR)/%.aif ; $(AIF) $< $@ --compress
sound/%.bin: sound/%.aif ; $(AIF) $< $@
sound/songs/%.s: sound/songs/%.mid
$(MID) $< $@
ifeq ($(MODERN),0)
$(C_BUILDDIR)/agb_flash.o: CFLAGS := -O -mthumb-interwork
$(C_BUILDDIR)/agb_flash_1m.o: CFLAGS := -O -mthumb-interwork
$(C_BUILDDIR)/agb_flash_mx.o: CFLAGS := -O -mthumb-interwork
$(C_BUILDDIR)/m4a.o: CC1 := tools/agbcc/bin/old_agbcc$(EXE)
$(C_BUILDDIR)/isagbprn.o: CC1 := tools/agbcc/bin/old_agbcc$(EXE)
$(C_BUILDDIR)/isagbprn.o: CFLAGS := -mthumb-interwork
$(C_BUILDDIR)/trainer_tower.o: CFLAGS += -ffreestanding
$(C_BUILDDIR)/battle_anim_flying.o: CFLAGS += -ffreestanding
$(C_BUILDDIR)/librfu_intr.o: CC1 := tools/agbcc/bin/agbcc_arm$(EXE)
$(C_BUILDDIR)/librfu_intr.o: CFLAGS := -O2 -mthumb-interwork -quiet
else
$(C_BUILDDIR)/berry_crush_2.o: CFLAGS += -Wno-address-of-packed-member
$(C_BUILDDIR)/berry_crush_3.o: CFLAGS += -Wno-address-of-packed-member
$(C_BUILDDIR)/braille_text.o: CFLAGS += -Wno-address-of-packed-member
$(C_BUILDDIR)/text.o: CFLAGS += -Wno-address-of-packed-member
$(C_BUILDDIR)/battle_tower.o: CFLAGS += -Wno-div-by-zero
$(C_BUILDDIR)/librfu_intr.o: override CFLAGS += -marm -mthumb-interwork -O2 -mtune=arm7tdmi -march=armv4t -mabi=apcs-gnu -fno-toplevel-reorder -fno-aggressive-loop-optimizations -Wno-pointer-to-int-cast
endif
ifeq ($(NODEP),1)
$(C_BUILDDIR)/%.o: c_dep :=
else
$(C_BUILDDIR)/%.o: c_dep = $(shell [[ -f $(C_SUBDIR)/$*.c ]] && $(SCANINC) -I include -I tools/agbcc/include $(C_SUBDIR)/$*.c)
endif
ifeq ($(DINFO),1)
override CFLAGS += -g
endif
$(C_BUILDDIR)/%.o : $(C_SUBDIR)/%.c $$(c_dep)
@$(CPP) $(CPPFLAGS) $< -o $(C_BUILDDIR)/$*.i
@$(PREPROC) $(C_BUILDDIR)/$*.i charmap.txt | $(CC1) $(CFLAGS) -o $(C_BUILDDIR)/$*.s
@echo -e ".text\n\t.align\t2, 0 @ Don't pad with nop\n" >> $(C_BUILDDIR)/$*.s
$(AS) $(ASFLAGS) -o $@ $(C_BUILDDIR)/$*.s
ifeq ($(NODEP),1)
$(C_BUILDDIR)/%.o: c_asm_dep :=
else
$(C_BUILDDIR)/%.o: c_asm_dep = $(shell [[ -f $(C_SUBDIR)/$*.s ]] && $(SCANINC) -I "" $(C_SUBDIR)/$*.s)
endif
$(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.s $$(c_asm_dep)
$(AS) $(ASFLAGS) -o $@ $<
ifeq ($(NODEP),1)
$(DATA_ASM_BUILDDIR)/%.o: data_dep :=
else
$(DATA_ASM_BUILDDIR)/%.o: data_dep = $(shell $(SCANINC) -I . $(DATA_ASM_SUBDIR)/$*.s)
endif
ifeq ($(NODEP),1)
$(ASM_BUILDDIR)/%.o: $(ASM_SUBDIR)/%.s
$(AS) $(ASFLAGS) -o $@ $<
else
define ASM_DEP
$1: $2 $$(shell $(SCANINC) -I include -I "" $2)
$$(AS) $$(ASFLAGS) -o $$@ $$<
endef
$(foreach src, $(ASM_SRCS), $(eval $(call ASM_DEP,$(patsubst $(ASM_SUBDIR)/%.s,$(ASM_BUILDDIR)/%.o, $(src)),$(src))))
endif
ifeq ($(NODEP),1)
$(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s
$(PREPROC) $< charmap.txt | $(CPP) -I include - | $(AS) $(ASFLAGS) -o $@
else
define DATA_ASM_DEP
$1: $2 $$(shell $(SCANINC) -I include -I "" $2)
$$(PREPROC) $$< charmap.txt | $$(CPP) -I include - | $$(AS) $$(ASFLAGS) -o $$@
endef
$(foreach src, $(REGULAR_DATA_ASM_SRCS), $(eval $(call DATA_ASM_DEP,$(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o, $(src)),$(src))))
endif
$(SONG_BUILDDIR)/%.o: $(SONG_SUBDIR)/%.s
$(AS) $(ASFLAGS) -I sound -o $@ $<
$(OBJ_DIR)/sym_bss.ld: sym_bss.txt
$(RAMSCRGEN) .bss $< ENGLISH > $@
$(OBJ_DIR)/sym_common.ld: sym_common.txt $(C_OBJS) $(wildcard common_syms/*.txt)
$(RAMSCRGEN) COMMON $< ENGLISH -c $(C_BUILDDIR),common_syms > $@
$(OBJ_DIR)/sym_ewram.ld: sym_ewram.txt
$(RAMSCRGEN) ewram_data $< ENGLISH > $@
ifeq ($(MODERN),0)
LD_SCRIPT := ld_script.ld
LD_SCRIPT_DEPS := $(OBJ_DIR)/sym_bss.ld $(OBJ_DIR)/sym_common.ld $(OBJ_DIR)/sym_ewram.ld
else
LD_SCRIPT := ld_script_modern.ld
LD_SCRIPT_DEPS :=
endif
$(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
$(ROM): $(ELF)
$(OBJCOPY) -O binary --gap-fill 0xFF --pad-to 0x9000000 $< $@
$(RM) -r $(BUILD_DIR)
# "friendly" target names for convenience sake
firered: ; @$(MAKE) GAME_VERSION=FIRERED
@@ -357,11 +229,160 @@ firered_rev1_modern: ; @$(MAKE) GAME_VERSION=FIRERED GAME_REVISION=1 MODERN=1
leafgreen_modern: ; @$(MAKE) GAME_VERSION=LEAFGREEN MODERN=1
leafgreen_rev1_modern: ; @$(MAKE) GAME_VERSION=LEAFGREEN GAME_REVISION=1 MODERN=1
modern: ; @$(MAKE) MODERN=1
# Other rules
include graphics_file_rules.mk
include tileset_rules.mk
include map_data_rules.mk
include spritesheet_rules.mk
include json_data_rules.mk
include audio_rules.mk
###################
### Symbol file ###
###################
generated: $(AUTO_GEN_TARGETS)
%.s: ;
%.png: ;
%.pal: ;
%.aif: ;
%.1bpp: %.png ; $(GFX) $< $@
%.4bpp: %.png ; $(GFX) $< $@
%.8bpp: %.png ; $(GFX) $< $@
%.gbapal: %.pal ; $(GFX) $< $@
%.gbapal: %.png ; $(GFX) $< $@
%.lz: % ; $(GFX) $< $@
%.rl: % ; $(GFX) $< $@
# NOTE: Tools must have been built prior (FIXME)
generated: tools $(AUTO_GEN_TARGETS)
clean-generated:
-rm -f $(AUTO_GEN_TARGETS)
ifeq ($(MODERN),0)
$(C_BUILDDIR)/agb_flash.o: CFLAGS := -O -mthumb-interwork
$(C_BUILDDIR)/agb_flash_1m.o: CFLAGS := -O -mthumb-interwork
$(C_BUILDDIR)/agb_flash_mx.o: CFLAGS := -O -mthumb-interwork
$(C_BUILDDIR)/m4a.o: CC1 := $(TOOLS_DIR)/agbcc/bin/old_agbcc$(EXE)
$(C_BUILDDIR)/isagbprn.o: CC1 := $(TOOLS_DIR)/agbcc/bin/old_agbcc$(EXE)
$(C_BUILDDIR)/isagbprn.o: CFLAGS := -mthumb-interwork
$(C_BUILDDIR)/trainer_tower.o: CFLAGS += -ffreestanding
$(C_BUILDDIR)/battle_anim_flying.o: CFLAGS += -ffreestanding
$(C_BUILDDIR)/librfu_intr.o: CC1 := $(TOOLS_DIR)/agbcc/bin/agbcc_arm$(EXE)
$(C_BUILDDIR)/librfu_intr.o: CFLAGS := -O2 -mthumb-interwork -quiet
else
$(C_BUILDDIR)/berry_crush_2.o: CFLAGS += -Wno-address-of-packed-member
$(C_BUILDDIR)/berry_crush_3.o: CFLAGS += -Wno-address-of-packed-member
$(C_BUILDDIR)/braille_text.o: CFLAGS += -Wno-address-of-packed-member
$(C_BUILDDIR)/text.o: CFLAGS += -Wno-address-of-packed-member
$(C_BUILDDIR)/battle_tower.o: CFLAGS += -Wno-div-by-zero
$(C_BUILDDIR)/librfu_intr.o: override CFLAGS += -marm -mthumb-interwork -O2 -mtune=arm7tdmi -march=armv4t -mabi=apcs-gnu -fno-toplevel-reorder -fno-aggressive-loop-optimizations -Wno-pointer-to-int-cast
endif
# Dependency rules (for the *.c & *.s sources to .o files)
# Have to be explicit or else missing files won't be reported.
# As a side effect, they're evaluated immediately instead of when the rule is invoked.
# It doesn't look like $(shell) can be deferred so there might not be a better way (Icedude_907: there is soon).
# For C dependencies.
# Args: $1 = Output file without extension (build/assets/src/data), $2 = Input file (src/data.c)
define C_DEP
$(call C_DEP_IMPL,$1,$2,$1)
endef
# Internal implementation details.
# $1: Output file without extension, $2 input file, $3 temp path (if keeping)
define C_DEP_IMPL
$1.o: $2
ifneq ($(KEEP_TEMPS),1)
@echo "$$(CC1) <flags> -o $$@ $$<"
@$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) -i $$< charmap.txt | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ -
else
@$$(CPP) $$(CPPFLAGS) $$< -o $3.i
@$$(PREPROC) $3.i charmap.txt | $$(CC1) $$(CFLAGS) -o $3.s
@echo -e ".text\n\t.align\t2, 0 @ Don't pad with nop\n" >> $3.s
$$(AS) $$(ASFLAGS) -o $$@ $3.s
endif
$1.d: $2
$(SCANINC) -M $1.d $(INCLUDE_SCANINC_ARGS) -I tools/agbcc/include $2
ifneq ($(NODEP),1)
$1.o: $1.d
-include $1.d
endif
endef
# Create generic rules if no dependency scanning, else create the real rules
ifeq ($(NODEP),1)
$(eval $(call C_DEP,$(C_BUILDDIR)/%,$(C_SUBDIR)/%.c))
else
$(foreach src,$(C_SRCS),$(eval $(call C_DEP,$(OBJ_DIR)/$(basename $(src)),$(src))))
endif
# Similar methodology for Assembly files
# $1: Output path without extension, $2: Input file (`*.s`)
define ASM_DEP
$1.o: $2
$$(AS) $$(ASFLAGS) -o $$@ $$<
$(call ASM_SCANINC,$1,$2)
endef
# As above but first doing a preprocessor pass
define ASM_DEP_PREPROC
$1.o: $2
$$(PREPROC) $$< charmap.txt | $$(CPP) $(INCLUDE_SCANINC_ARGS) - | $$(PREPROC) -ie $$< charmap.txt | $$(AS) $$(ASFLAGS) -o $$@
$(call ASM_SCANINC,$1,$2)
endef
define ASM_SCANINC
ifneq ($(NODEP),1)
$1.o: $1.d
$1.d: $2
$(SCANINC) -M $1.d $(INCLUDE_SCANINC_ARGS) -I "" $2
-include $1.d
endif
endef
# Dummy rules or real rules
ifeq ($(NODEP),1)
$(eval $(call ASM_DEP,$(ASM_BUILDDIR)/%,$(ASM_SUBDIR)/%.s))
$(eval $(call ASM_DEP_PREPROC,$(C_BUILDDIR)/%,$(C_SUBDIR)/%.s))
$(eval $(call ASM_DEP_PREPROC,$(DATA_ASM_BUILDDIR)/%,$(DATA_ASM_SUBDIR)/%.s))
else
$(foreach src, $(ASM_SRCS), $(eval $(call ASM_DEP,$(src:%.s=$(OBJ_DIR)/%),$(src))))
$(foreach src, $(C_ASM_SRCS), $(eval $(call ASM_DEP_PREPROC,$(src:%.s=$(OBJ_DIR)/%),$(src))))
$(foreach src, $(REGULAR_DATA_ASM_SRCS), $(eval $(call ASM_DEP_PREPROC,$(src:%.s=$(OBJ_DIR)/%),$(src))))
endif
$(OBJ_DIR)/sym_bss.ld: sym_bss.txt
$(RAMSCRGEN) .bss $< ENGLISH > $@
$(OBJ_DIR)/sym_common.ld: sym_common.txt $(C_OBJS) $(wildcard common_syms/*.txt)
$(RAMSCRGEN) COMMON $< ENGLISH -c $(C_BUILDDIR),common_syms > $@
$(OBJ_DIR)/sym_ewram.ld: sym_ewram.txt
$(RAMSCRGEN) ewram_data $< ENGLISH > $@
# Linker script
ifeq ($(MODERN),0)
LD_SCRIPT := ld_script.ld
LD_SCRIPT_DEPS := $(OBJ_DIR)/sym_bss.ld $(OBJ_DIR)/sym_common.ld $(OBJ_DIR)/sym_ewram.ld
else
LD_SCRIPT := ld_script_modern.ld
LD_SCRIPT_DEPS :=
endif
# Final rules
# Elf from object files
$(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
$(ROM): $(ELF)
$(OBJCOPY) -O binary --gap-fill 0xFF --pad-to 0x9000000 $< $@
# Symbol file (`make syms`)
$(SYM): $(ELF)
$(OBJDUMP) -t $< | sort -u | grep -E "^0[2389]" | $(PERL) -p -e 's/^(\w{8}) (\w).{6} \S+\t(\w{8}) (\S+)$$/\1 \2 \3 \4/g' > $@
+45
View File
@@ -0,0 +1,45 @@
# This file contains rules for making assemblies for most music in the game.
CRY_SUBDIR := sound/direct_sound_samples/cries
MID_ASM_DIR := $(MID_SUBDIR)
CRY_BIN_DIR := $(CRY_SUBDIR)
SOUND_BIN_DIR := sound
SPECIAL_OUTDIRS := $(MID_ASM_DIR) $(CRY_BIN_DIR)
SPECIAL_OUTDIRS += $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/direct_sound_samples/cries
$(shell mkdir -p $(SPECIAL_OUTDIRS) )
# Assembly song compilation
$(SONG_BUILDDIR)/%.o: $(SONG_SUBDIR)/%.s
$(AS) $(ASFLAGS) -I sound -o $@ $<
$(MID_BUILDDIR)/%.o: $(MID_ASM_DIR)/%.s
$(AS) $(ASFLAGS) -I sound -o $@ $<
# Compressed cries
$(CRY_BIN_DIR)/%.bin: $(CRY_SUBDIR)/%.aif
$(AIF) $< $@ --compress
# Uncompressed sounds
$(SOUND_BIN_DIR)/%.bin: sound/%.aif
$(AIF) $< $@
# For each line in midi.cfg, we do some trickery to convert it into a make rule for the `.mid` file described on the line
# Data following the colon in said file corresponds to arguments passed into mid2agb
MID_CFG_PATH := $(MID_SUBDIR)/midi.cfg
# $1: Source path no extension, $2 Options
define MID_RULE
$(MID_ASM_DIR)/$1.s: $(MID_SUBDIR)/$1.mid $(MID_CFG_PATH)
$(MID) $$< $$@ $2
endef
# source path, remaining text (options)
define MID_EXPANSION
$(eval $(call MID_RULE,$(basename $(patsubst %:,%,$(word 1,$1))),$(wordlist 2,999,$1)))
endef
$(foreach line,$(shell cat $(MID_CFG_PATH) | sed "s/ /__SPACE__/g"),$(call MID_EXPANSION,$(subst __SPACE__, ,$(line))))
# Warn users building without a .cfg - build will fail at link time
$(MID_ASM_DIR)/%.s: $(MID_SUBDIR)/%.mid
$(warning $< does not have an associated entry in midi.cfg! It cannot be built)
+28 -25
View File
@@ -3,49 +3,52 @@
GAME_VERSION ?= FIRERED
GAME_REVISION ?= 0
GAME_LANGUAGE ?= ENGLISH
# Builds the ROM using a modern compiler
MODERN ?= 0
# Compares the ROM to a checksum of the original - only makes sense using when non-modern
COMPARE ?= 0
KEEP_TEMPS ?= 0
ifeq (modern,$(MAKECMDGOALS))
MODERN := 1
endif
ifeq (compare,$(MAKECMDGOALS))
COMPARE := 1
endif
# For gbafix
MAKER_CODE := 01
MAKER_CODE := 01
BUILD_DIR := build
# Version
ifeq ($(GAME_VERSION),FIRERED)
TITLE := POKEMON FIRE
GAME_CODE := BPR
BUILD_NAME := firered
TITLE := POKEMON FIRE
GAME_CODE := BPR
BUILD_NAME := firered
else
ifeq ($(GAME_VERSION),LEAFGREEN)
TITLE := POKEMON LEAF
GAME_CODE := BPG
BUILD_NAME := leafgreen
TITLE := POKEMON LEAF
GAME_CODE := BPG
BUILD_NAME := leafgreen
else
$(error unknown version $(GAME_VERSION))
$(error unknown version $(GAME_VERSION))
endif
endif
# Revision
ifeq ($(GAME_REVISION),0)
BUILD_NAME := $(BUILD_NAME)
else
ifeq ($(GAME_REVISION),1)
BUILD_NAME := $(BUILD_NAME)_rev1
else
$(error unknown revision $(GAME_REVISION))
BUILD_NAME := $(BUILD_NAME)_rev1
endif
# Modern GCC
ifeq ($(MODERN),1)
BUILD_NAME := $(BUILD_NAME)_modern
endif
# Language
ifeq ($(GAME_LANGUAGE),ENGLISH)
BUILD_NAME := $(BUILD_NAME)
GAME_CODE := $(GAME_CODE)E
else
$(error unknown language $(GAME_LANGUAGE))
endif
# Modern GCC
ifeq ($(MODERN), 0)
BUILD_NAME := $(BUILD_NAME)
else
BUILD_NAME := $(BUILD_NAME)_modern
GAME_CODE := $(GAME_CODE)E
endif
+67
View File
@@ -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
+3
View File
@@ -0,0 +1,3 @@
# Will be moved to build/ eventually
map_groups.h
layouts.h
-374
View File
@@ -1,374 +0,0 @@
#ifndef GUARD_CONSTANTS_LAYOUTS_H
#define GUARD_CONSTANTS_LAYOUTS_H
//
// DO NOT MODIFY THIS FILE! It is auto-generated from data/layouts/layouts.json
//
#define LAYOUT_PALLET_TOWN_PLAYERS_HOUSE_1F 1
#define LAYOUT_PALLET_TOWN_PLAYERS_HOUSE_2F 2
#define LAYOUT_PALLET_TOWN_RIVALS_HOUSE 3
#define LAYOUT_LITTLEROOT_TOWN_MAYS_HOUSE_2F 4
#define LAYOUT_PALLET_TOWN_PROFESSOR_OAKS_LAB 5
#define LAYOUT_HOUSE1 6
#define LAYOUT_HOUSE2 7
#define LAYOUT_POKEMON_CENTER_1F 8
#define LAYOUT_POKEMON_CENTER_2F 9
#define LAYOUT_MART 10
#define LAYOUT_HOUSE3 11
#define LAYOUT_CERULEAN_CITY_GYM 12
#define LAYOUT_HOUSE4 13
#define LAYOUT_LAVARIDGE_TOWN_HERB_SHOP 14
#define LAYOUT_CELADON_CITY_GYM 15
#define LAYOUT_RS_POKEMON_CENTER_1F 16
#define LAYOUT_FIVE_ISLAND_RESORT_GORGEOUS_HOUSE 17
#define LAYOUT_PACIFIDLOG_TOWN_HOUSE1 18
#define LAYOUT_PACIFIDLOG_TOWN_HOUSE2 19
#define LAYOUT_FUCHSIA_CITY_GYM 20
#define LAYOUT_HOUSE5 21
#define LAYOUT_UNUSED1 24
#define LAYOUT_VERMILION_CITY_GYM 25
#define LAYOUT_CERULEAN_CITY_BIKE_SHOP 26
#define LAYOUT_CELADON_CITY_GAME_CORNER 27
#define LAYOUT_PEWTER_CITY_GYM 28
#define LAYOUT_FOUR_ISLAND_LORELEIS_HOUSE 30
#define LAYOUT_THREE_ISLAND_HOUSE1 31
#define LAYOUT_RUSTBORO_CITY_CUTTERS_HOUSE 32
#define LAYOUT_FORTREE_CITY_HOUSE1 33
#define LAYOUT_SAFFRON_CITY_GYM 34
#define LAYOUT_FORTREE_CITY_HOUSE2 35
#define LAYOUT_CINNABAR_ISLAND_GYM 36
#define LAYOUT_VIRIDIAN_CITY_GYM 37
#define LAYOUT_RS_SAFARI_ZONE_ENTRANCE 46
#define LAYOUT_BATTLE_COLOSSEUM_2P 47
#define LAYOUT_TRADE_CENTER 48
#define LAYOUT_RECORD_CORNER 49
#define LAYOUT_BATTLE_COLOSSEUM_4P 50
#define LAYOUT_FUCHSIA_CITY_SAFARI_ZONE_ENTRANCE 51
#define LAYOUT_RS_SAFARI_ZONE_NORTHEAST 52
#define LAYOUT_RS_SAFARI_ZONE_SOUTHWEST 53
#define LAYOUT_RS_SAFARI_ZONE_SOUTHEAST 54
#define LAYOUT_FORTREE_CITY_DECORATION_SHOP 55
#define LAYOUT_RS_BATTLE_TOWER 57
#define LAYOUT_SS_TIDAL_CORRIDOR 62
#define LAYOUT_SS_TIDAL_LOWER_DECK 63
#define LAYOUT_SS_TIDAL_ROOMS 64
#define LAYOUT_RUSTBORO_CITY_FLAT2_1F 65
#define LAYOUT_RUSTBORO_CITY_FLAT2_2F 66
#define LAYOUT_RUSTBORO_CITY_FLAT2_3F 67
#define LAYOUT_EVER_GRANDE_CITY_HALL_OF_FAME 68
#define LAYOUT_MOSSDEEP_CITY_EREADER_TRAINER_HOUSE_1F 69
#define LAYOUT_MOSSDEEP_CITY_EREADER_TRAINER_HOUSE_2F 70
#define LAYOUT_SOOTOPOLIS_CITY_HOUSE1 71
#define LAYOUT_SOOTOPOLIS_CITY_HOUSE2 72
#define LAYOUT_SOOTOPOLIS_CITY_HOUSE3 73
#define LAYOUT_RUSTBORO_CITY_FLAT1_1F 74
#define LAYOUT_RUSTBORO_CITY_FLAT1_2F 75
#define LAYOUT_RS_SAFARI_ZONE_REST_HOUSE 77
#define LAYOUT_PALLET_TOWN 78
#define LAYOUT_VIRIDIAN_CITY 79
#define LAYOUT_PEWTER_CITY 80
#define LAYOUT_CERULEAN_CITY 81
#define LAYOUT_LAVENDER_TOWN 82
#define LAYOUT_VERMILION_CITY 83
#define LAYOUT_CELADON_CITY 84
#define LAYOUT_FUCHSIA_CITY 85
#define LAYOUT_CINNABAR_ISLAND 86
#define LAYOUT_INDIGO_PLATEAU_EXTERIOR 87
#define LAYOUT_SAFFRON_CITY_CONNECTION 88
#define LAYOUT_ROUTE1 89
#define LAYOUT_ROUTE2 90
#define LAYOUT_ROUTE3 91
#define LAYOUT_ROUTE4 92
#define LAYOUT_ROUTE5 93
#define LAYOUT_ROUTE6 94
#define LAYOUT_ROUTE7 95
#define LAYOUT_ROUTE8 96
#define LAYOUT_ROUTE9 97
#define LAYOUT_ROUTE10 98
#define LAYOUT_ROUTE11 99
#define LAYOUT_ROUTE12 100
#define LAYOUT_ROUTE13 101
#define LAYOUT_ROUTE14 102
#define LAYOUT_ROUTE15 103
#define LAYOUT_ROUTE16 104
#define LAYOUT_ROUTE17 105
#define LAYOUT_ROUTE18 106
#define LAYOUT_ROUTE19 107
#define LAYOUT_ROUTE20 108
#define LAYOUT_ROUTE21_NORTH 109
#define LAYOUT_ROUTE22 110
#define LAYOUT_ROUTE23 111
#define LAYOUT_ROUTE24 112
#define LAYOUT_ROUTE25 113
#define LAYOUT_MT_MOON_1F 114
#define LAYOUT_MT_MOON_B1F 115
#define LAYOUT_MT_MOON_B2F 116
#define LAYOUT_VIRIDIAN_FOREST 117
#define LAYOUT_SSANNE_EXTERIOR 118
#define LAYOUT_SSANNE_1F_CORRIDOR 119
#define LAYOUT_SSANNE_2F_CORRIDOR 120
#define LAYOUT_SSANNE_3F_CORRIDOR 121
#define LAYOUT_SSANNE_B1F_CORRIDOR 122
#define LAYOUT_SSANNE_DECK 123
#define LAYOUT_DIGLETTS_CAVE_B1F 124
#define LAYOUT_VICTORY_ROAD_1F 125
#define LAYOUT_VICTORY_ROAD_2F 126
#define LAYOUT_VICTORY_ROAD_3F 127
#define LAYOUT_ROCKET_HIDEOUT_B1F 128
#define LAYOUT_ROCKET_HIDEOUT_B2F 129
#define LAYOUT_ROCKET_HIDEOUT_B3F 130
#define LAYOUT_ROCKET_HIDEOUT_B4F 131
#define LAYOUT_SILPH_CO_1F 132
#define LAYOUT_SILPH_CO_2F 133
#define LAYOUT_SILPH_CO_3F 134
#define LAYOUT_SILPH_CO_4F 135
#define LAYOUT_SILPH_CO_5F 136
#define LAYOUT_SILPH_CO_6F 137
#define LAYOUT_SILPH_CO_7F 138
#define LAYOUT_SILPH_CO_8F 139
#define LAYOUT_SILPH_CO_9F 140
#define LAYOUT_SILPH_CO_10F 141
#define LAYOUT_SILPH_CO_11F 142
#define LAYOUT_POKEMON_MANSION_1F 143
#define LAYOUT_POKEMON_MANSION_2F 144
#define LAYOUT_POKEMON_MANSION_3F 145
#define LAYOUT_POKEMON_MANSION_B1F 146
#define LAYOUT_SAFARI_ZONE_CENTER 147
#define LAYOUT_SAFARI_ZONE_EAST 148
#define LAYOUT_SAFARI_ZONE_NORTH 149
#define LAYOUT_SAFARI_ZONE_WEST 150
#define LAYOUT_CERULEAN_CAVE_1F 151
#define LAYOUT_CERULEAN_CAVE_2F 152
#define LAYOUT_CERULEAN_CAVE_B1F 153
#define LAYOUT_ROCK_TUNNEL_1F 154
#define LAYOUT_ROCK_TUNNEL_B1F 155
#define LAYOUT_SEAFOAM_ISLANDS_1F 156
#define LAYOUT_SEAFOAM_ISLANDS_B1F 157
#define LAYOUT_SEAFOAM_ISLANDS_B2F 158
#define LAYOUT_SEAFOAM_ISLANDS_B3F 159
#define LAYOUT_SEAFOAM_ISLANDS_B4F 160
#define LAYOUT_POKEMON_TOWER_1F 161
#define LAYOUT_POKEMON_TOWER_2F 162
#define LAYOUT_POKEMON_TOWER_3F 163
#define LAYOUT_POKEMON_TOWER_4F 164
#define LAYOUT_POKEMON_TOWER_5F 165
#define LAYOUT_POKEMON_TOWER_6F 166
#define LAYOUT_POKEMON_TOWER_7F 167
#define LAYOUT_POWER_PLANT 168
#define LAYOUT_ROUTE25_SEA_COTTAGE 169
#define LAYOUT_SSANNE_KITCHEN 170
#define LAYOUT_SSANNE_CAPTAINS_OFFICE 171
#define LAYOUT_UNDERGROUND_PATH_ENTRANCE 172
#define LAYOUT_UNDERGROUND_PATH_EAST_WEST_TUNNEL 173
#define LAYOUT_UNDERGROUND_PATH_NORTH_SOUTH_TUNNEL 174
#define LAYOUT_ROUTE12_NORTH_ENTRANCE_1F 176
#define LAYOUT_SSANNE_ROOM1 177
#define LAYOUT_SSANNE_ROOM2 178
#define LAYOUT_CELADON_CITY_DEPARTMENT_STORE_ELEVATOR 179
#define LAYOUT_PEWTER_CITY_MUSEUM_1F 180
#define LAYOUT_PEWTER_CITY_MUSEUM_2F 181
#define LAYOUT_CERULEAN_CITY_HOUSE2 182
#define LAYOUT_CERULEAN_CITY_HOUSE1 183
#define LAYOUT_CELADON_CITY_CONDOMINIUMS_1F 184
#define LAYOUT_CELADON_CITY_CONDOMINIUMS_2F 185
#define LAYOUT_CELADON_CITY_CONDOMINIUMS_3F 186
#define LAYOUT_CELADON_CITY_CONDOMINIUMS_ROOF 187
#define LAYOUT_CELADON_CITY_CONDOMINIUMS_ROOF_ROOM 188
#define LAYOUT_CELADON_CITY_GAME_CORNER_PRIZE_ROOM 189
#define LAYOUT_CELADON_CITY_RESTAURANT 190
#define LAYOUT_CELADON_CITY_HOTEL 191
#define LAYOUT_CELADON_CITY_DEPARTMENT_STORE_1F 192
#define LAYOUT_CELADON_CITY_DEPARTMENT_STORE_2F 193
#define LAYOUT_CELADON_CITY_DEPARTMENT_STORE_3F 194
#define LAYOUT_CELADON_CITY_DEPARTMENT_STORE_4F 195
#define LAYOUT_CELADON_CITY_DEPARTMENT_STORE_5F 196
#define LAYOUT_CELADON_CITY_DEPARTMENT_STORE_ROOF 197
#define LAYOUT_SAFARI_ZONE_REST_HOUSE 198
#define LAYOUT_SAFARI_ZONE_SECRET_HOUSE 199
#define LAYOUT_FUCHSIA_CITY_SAFARI_ZONE_OFFICE 200
#define LAYOUT_FUCHSIA_CITY_WARDENS_HOUSE 201
#define LAYOUT_FUCHSIA_CITY_HOUSE2 202
#define LAYOUT_CINNABAR_ISLAND_POKEMON_LAB_ENTRANCE 203
#define LAYOUT_CINNABAR_ISLAND_POKEMON_LAB_LOUNGE 204
#define LAYOUT_CINNABAR_ISLAND_POKEMON_LAB_RESEARCH_ROOM 205
#define LAYOUT_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM 206
#define LAYOUT_SAFFRON_CITY 207
#define LAYOUT_SAFFRON_CITY_NORTH_SOUTH_ENTRANCE 208
#define LAYOUT_SAFFRON_CITY_EAST_WEST_ENTRANCE 209
#define LAYOUT_DIGLETTS_CAVE_NORTH_ENTRANCE 210
#define LAYOUT_DIGLETTS_CAVE_SOUTH_ENTRANCE 211
#define LAYOUT_INDIGO_PLATEAU_POKEMON_CENTER_1F 212
#define LAYOUT_POKEMON_LEAGUE_LORELEIS_ROOM 213
#define LAYOUT_POKEMON_LEAGUE_BRUNOS_ROOM 214
#define LAYOUT_POKEMON_LEAGUE_AGATHAS_ROOM 215
#define LAYOUT_POKEMON_LEAGUE_LANCES_ROOM 216
#define LAYOUT_POKEMON_LEAGUE_CHAMPIONS_ROOM 217
#define LAYOUT_POKEMON_LEAGUE_HALL_OF_FAME 218
#define LAYOUT_ROUTE21_SOUTH 219
#define LAYOUT_ENTRANCE_2F 220
#define LAYOUT_ROUTE2_ENTRANCE 221
#define LAYOUT_ROUTE22_NORTH_ENTRANCE 222
#define LAYOUT_ROUTE16_NORTH_ENTRANCE_1F 223
#define LAYOUT_ENTRANCE_1F 224
#define LAYOUT_ROCKET_HIDEOUT_ELEVATOR 225
#define LAYOUT_SAFFRON_CITY_COPYCATS_HOUSE_1F 226
#define LAYOUT_SAFFRON_CITY_COPYCATS_HOUSE_2F 227
#define LAYOUT_SAFFRON_CITY_DOJO 228
#define LAYOUT_SILPH_CO_ELEVATOR 229
#define LAYOUT_ONE_ISLAND 230
#define LAYOUT_TWO_ISLAND 231
#define LAYOUT_THREE_ISLAND 232
#define LAYOUT_FOUR_ISLAND 233
#define LAYOUT_FIVE_ISLAND 234
#define LAYOUT_SEVEN_ISLAND 235
#define LAYOUT_SIX_ISLAND 236
#define LAYOUT_ONE_ISLAND_KINDLE_ROAD 237
#define LAYOUT_ONE_ISLAND_TREASURE_BEACH 238
#define LAYOUT_TWO_ISLAND_CAPE_BRINK 239
#define LAYOUT_THREE_ISLAND_BOND_BRIDGE 240
#define LAYOUT_THREE_ISLAND_PORT 241
#define LAYOUT_PROTOTYPE_SEVII_ISLE_6 242
#define LAYOUT_PROTOTYPE_SEVII_ISLE_7 243
#define LAYOUT_PROTOTYPE_SEVII_ISLE_8 244
#define LAYOUT_PROTOTYPE_SEVII_ISLE_9 245
#define LAYOUT_FIVE_ISLAND_RESORT_GORGEOUS 246
#define LAYOUT_FIVE_ISLAND_WATER_LABYRINTH 247
#define LAYOUT_FIVE_ISLAND_MEADOW 248
#define LAYOUT_FIVE_ISLAND_MEMORIAL_PILLAR 249
#define LAYOUT_SIX_ISLAND_OUTCAST_ISLAND 250
#define LAYOUT_SIX_ISLAND_GREEN_PATH 251
#define LAYOUT_SIX_ISLAND_WATER_PATH 252
#define LAYOUT_SIX_ISLAND_RUIN_VALLEY 253
#define LAYOUT_SEVEN_ISLAND_TRAINER_TOWER 254
#define LAYOUT_SEVEN_ISLAND_SEVAULT_CANYON_ENTRANCE 255
#define LAYOUT_SEVEN_ISLAND_SEVAULT_CANYON 256
#define LAYOUT_SEVEN_ISLAND_TANOBY_RUINS 257
#define LAYOUT_PROTOTYPE_SEVII_ISLE_22 258
#define LAYOUT_PROTOTYPE_SEVII_ISLE_23_EAST 259
#define LAYOUT_PROTOTYPE_SEVII_ISLE_23_WEST 260
#define LAYOUT_PROTOTYPE_SEVII_ISLE_24 261
#define LAYOUT_UNION_ROOM 262
#define LAYOUT_SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB 263
#define LAYOUT_SEVEN_ISLAND_HOUSE_ROOM1_DOOR_OPEN 264
#define LAYOUT_SEVEN_ISLAND_HOUSE_ROOM2 265
#define LAYOUT_VIRIDIAN_CITY_SCHOOL 266
#define LAYOUT_CELADON_CITY_RESTAURANT_DUPLICATE 267
#define LAYOUT_CELADON_CITY_HOTEL_DUPLICATE 268
#define LAYOUT_MT_EMBER_RUBY_PATH_B4F 269
#define LAYOUT_THREE_ISLAND_BERRY_FOREST 270
#define LAYOUT_ONE_ISLAND_POKEMON_CENTER_1F 271
#define LAYOUT_TWO_ISLAND_JOYFUL_GAME_CORNER 272
#define LAYOUT_VERMILION_CITY_POKEMON_FAN_CLUB 273
#define LAYOUT_LAVENDER_TOWN_VOLUNTEER_POKEMON_HOUSE 274
#define LAYOUT_ROUTE5_POKEMON_DAY_CARE 275
#define LAYOUT_VIRIDIAN_CITY_HOUSE 276
#define LAYOUT_FOUR_ISLAND_POKEMON_DAY_CARE 277
#define LAYOUT_SEAFOAM_ISLANDS_B3F_CURRENT_STOPPED 278
#define LAYOUT_SEAFOAM_ISLANDS_B4F_CURRENT_STOPPED 279
#define LAYOUT_MT_EMBER_EXTERIOR 280
#define LAYOUT_MT_EMBER_SUMMIT 281
#define LAYOUT_MT_EMBER_SUMMIT_PATH_1F 282
#define LAYOUT_MT_EMBER_SUMMIT_PATH_2F 283
#define LAYOUT_MT_EMBER_SUMMIT_PATH_3F 284
#define LAYOUT_MT_EMBER_RUBY_PATH_1F 285
#define LAYOUT_MT_EMBER_RUBY_PATH_B1F 286
#define LAYOUT_MT_EMBER_RUBY_PATH_B2F 287
#define LAYOUT_MT_EMBER_RUBY_PATH_B3F 288
#define LAYOUT_MT_EMBER_RUBY_PATH_B1F_STAIRS 289
#define LAYOUT_MT_EMBER_RUBY_PATH_B2F_STAIRS 290
#define LAYOUT_MT_EMBER_RUBY_PATH_B5F 291
#define LAYOUT_FIVE_ISLAND_ROCKET_WAREHOUSE 292
#define LAYOUT_FOUR_ISLAND_ICEFALL_CAVE_ENTRANCE 293
#define LAYOUT_FOUR_ISLAND_ICEFALL_CAVE_1F 294
#define LAYOUT_FOUR_ISLAND_ICEFALL_CAVE_B1F 295
#define LAYOUT_FOUR_ISLAND_ICEFALL_CAVE_BACK 296
#define LAYOUT_TRAINER_TOWER_LOBBY 297
#define LAYOUT_TRAINER_TOWER_1F 298
#define LAYOUT_TRAINER_TOWER_2F 299
#define LAYOUT_TRAINER_TOWER_3F 300
#define LAYOUT_TRAINER_TOWER_4F 301
#define LAYOUT_TRAINER_TOWER_5F 302
#define LAYOUT_TRAINER_TOWER_6F 303
#define LAYOUT_TRAINER_TOWER_7F 304
#define LAYOUT_TRAINER_TOWER_8F 305
#define LAYOUT_TRAINER_TOWER_ROOF 306
#define LAYOUT_TRAINER_TOWER_ELEVATOR 307
#define LAYOUT_CERULEAN_CITY_HOUSE5 308
#define LAYOUT_SIX_ISLAND_DOTTED_HOLE_1F 309
#define LAYOUT_SIX_ISLAND_DOTTED_HOLE_B1F 310
#define LAYOUT_SIX_ISLAND_DOTTED_HOLE_B2F 311
#define LAYOUT_SIX_ISLAND_DOTTED_HOLE_B3F 312
#define LAYOUT_SIX_ISLAND_DOTTED_HOLE_B4F 313
#define LAYOUT_SIX_ISLAND_DOTTED_HOLE_SAPPHIRE_ROOM 314
#define LAYOUT_ISLAND_HARBOR 315
#define LAYOUT_ONE_ISLAND_POKEMON_CENTER_2F 316
#define LAYOUT_SIX_ISLAND_PATTERN_BUSH 317
#define LAYOUT_THREE_ISLAND_DUNSPARCE_TUNNEL 318
#define LAYOUT_THREE_ISLAND_DUNSPARCE_TUNNEL_DUG_OUT 319
#define LAYOUT_FIVE_ISLAND_LOST_CAVE_ENTRANCE 320
#define LAYOUT_FIVE_ISLAND_LOST_CAVE_ROOM1 321
#define LAYOUT_FIVE_ISLAND_LOST_CAVE_ROOM2 322
#define LAYOUT_FIVE_ISLAND_LOST_CAVE_ROOM3 323
#define LAYOUT_FIVE_ISLAND_LOST_CAVE_ROOM4 324
#define LAYOUT_FIVE_ISLAND_LOST_CAVE_ROOM5 325
#define LAYOUT_FIVE_ISLAND_LOST_CAVE_ROOM6 326
#define LAYOUT_FIVE_ISLAND_LOST_CAVE_ROOM7 327
#define LAYOUT_FIVE_ISLAND_LOST_CAVE_ROOM8 328
#define LAYOUT_FIVE_ISLAND_LOST_CAVE_ROOM9 329
#define LAYOUT_FIVE_ISLAND_LOST_CAVE_ROOM10 330
#define LAYOUT_FIVE_ISLAND_LOST_CAVE_ROOM11 331
#define LAYOUT_FIVE_ISLAND_LOST_CAVE_ROOM12 332
#define LAYOUT_FIVE_ISLAND_LOST_CAVE_ROOM13 333
#define LAYOUT_FIVE_ISLAND_LOST_CAVE_ROOM14 334
#define LAYOUT_SEVEN_ISLAND_TANOBY_RUINS_MONEAN_CHAMBER 335
#define LAYOUT_SEVEN_ISLAND_TANOBY_RUINS_LIPTOO_CHAMBER 336
#define LAYOUT_SEVEN_ISLAND_TANOBY_RUINS_WEEPTH_CHAMBER 337
#define LAYOUT_SEVEN_ISLAND_TANOBY_RUINS_DILFORD_CHAMBER 338
#define LAYOUT_SEVEN_ISLAND_TANOBY_RUINS_SCUFIB_CHAMBER 339
#define LAYOUT_SIX_ISLAND_ALTERING_CAVE 340
#define LAYOUT_SEVEN_ISLAND_SEVAULT_CANYON_TANOBY_KEY 341
#define LAYOUT_BIRTH_ISLAND_EXTERIOR 342
#define LAYOUT_NAVEL_ROCK_EXTERIOR 343
#define LAYOUT_NAVEL_ROCK_1F 344
#define LAYOUT_NAVEL_ROCK_SUMMIT 345
#define LAYOUT_NAVEL_ROCK_BASE 346
#define LAYOUT_NAVEL_ROCK_SUMMIT_PATH_2F 347
#define LAYOUT_NAVEL_ROCK_SUMMIT_PATH_3F 348
#define LAYOUT_NAVEL_ROCK_SUMMIT_PATH_4F 349
#define LAYOUT_NAVEL_ROCK_SUMMIT_PATH_5F 350
#define LAYOUT_NAVEL_ROCK_BASE_PATH_B1F 351
#define LAYOUT_NAVEL_ROCK_BASE_PATH_B2F 352
#define LAYOUT_NAVEL_ROCK_BASE_PATH_B3F 353
#define LAYOUT_NAVEL_ROCK_BASE_PATH_B4F 354
#define LAYOUT_NAVEL_ROCK_BASE_PATH_B5F 355
#define LAYOUT_NAVEL_ROCK_BASE_PATH_B6F 356
#define LAYOUT_NAVEL_ROCK_BASE_PATH_B7F 357
#define LAYOUT_NAVEL_ROCK_BASE_PATH_B8F 358
#define LAYOUT_NAVEL_ROCK_BASE_PATH_B9F 359
#define LAYOUT_NAVEL_ROCK_BASE_PATH_B10F 360
#define LAYOUT_NAVEL_ROCK_BASE_PATH_B11F 361
#define LAYOUT_SEVEN_ISLAND_TANOBY_RUINS_RIXY_CHAMBER 362
#define LAYOUT_SEVEN_ISLAND_TANOBY_RUINS_VIAPOIS_CHAMBER 363
#define LAYOUT_NAVEL_ROCK_B1F 364
#define LAYOUT_NAVEL_ROCK_FORK 365
#define LAYOUT_TRAINER_TOWER_1F_DOUBLES 366
#define LAYOUT_TRAINER_TOWER_2F_DOUBLES 367
#define LAYOUT_TRAINER_TOWER_3F_DOUBLES 368
#define LAYOUT_TRAINER_TOWER_4F_DOUBLES 369
#define LAYOUT_TRAINER_TOWER_5F_DOUBLES 370
#define LAYOUT_TRAINER_TOWER_6F_DOUBLES 371
#define LAYOUT_TRAINER_TOWER_7F_DOUBLES 372
#define LAYOUT_TRAINER_TOWER_8F_DOUBLES 373
#define LAYOUT_TRAINER_TOWER_1F_KNOCKOUT 374
#define LAYOUT_TRAINER_TOWER_2F_KNOCKOUT 375
#define LAYOUT_TRAINER_TOWER_3F_KNOCKOUT 376
#define LAYOUT_TRAINER_TOWER_4F_KNOCKOUT 377
#define LAYOUT_TRAINER_TOWER_5F_KNOCKOUT 378
#define LAYOUT_TRAINER_TOWER_6F_KNOCKOUT 379
#define LAYOUT_TRAINER_TOWER_7F_KNOCKOUT 380
#define LAYOUT_TRAINER_TOWER_8F_KNOCKOUT 381
#define LAYOUT_SEVEN_ISLAND_HOUSE_ROOM1 382
#define LAYOUT_ONE_ISLAND_KINDLE_ROAD_EMBER_SPA 383
#endif // GUARD_CONSTANTS_LAYOUTS_H
-521
View File
@@ -1,521 +0,0 @@
#ifndef GUARD_CONSTANTS_MAP_GROUPS_H
#define GUARD_CONSTANTS_MAP_GROUPS_H
//
// DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json
//
// gMapGroup_Link
#define MAP_BATTLE_COLOSSEUM_2P (0 | (0 << 8))
#define MAP_TRADE_CENTER (1 | (0 << 8))
#define MAP_RECORD_CORNER (2 | (0 << 8))
#define MAP_BATTLE_COLOSSEUM_4P (3 | (0 << 8))
#define MAP_UNION_ROOM (4 | (0 << 8))
// gMapGroup_Dungeons
#define MAP_VIRIDIAN_FOREST (0 | (1 << 8))
#define MAP_MT_MOON_1F (1 | (1 << 8))
#define MAP_MT_MOON_B1F (2 | (1 << 8))
#define MAP_MT_MOON_B2F (3 | (1 << 8))
#define MAP_SSANNE_EXTERIOR (4 | (1 << 8))
#define MAP_SSANNE_1F_CORRIDOR (5 | (1 << 8))
#define MAP_SSANNE_2F_CORRIDOR (6 | (1 << 8))
#define MAP_SSANNE_3F_CORRIDOR (7 | (1 << 8))
#define MAP_SSANNE_B1F_CORRIDOR (8 | (1 << 8))
#define MAP_SSANNE_DECK (9 | (1 << 8))
#define MAP_SSANNE_KITCHEN (10 | (1 << 8))
#define MAP_SSANNE_CAPTAINS_OFFICE (11 | (1 << 8))
#define MAP_SSANNE_1F_ROOM1 (12 | (1 << 8))
#define MAP_SSANNE_1F_ROOM2 (13 | (1 << 8))
#define MAP_SSANNE_1F_ROOM3 (14 | (1 << 8))
#define MAP_SSANNE_1F_ROOM4 (15 | (1 << 8))
#define MAP_SSANNE_1F_ROOM5 (16 | (1 << 8))
#define MAP_SSANNE_1F_ROOM7 (17 | (1 << 8))
#define MAP_SSANNE_2F_ROOM1 (18 | (1 << 8))
#define MAP_SSANNE_2F_ROOM2 (19 | (1 << 8))
#define MAP_SSANNE_2F_ROOM3 (20 | (1 << 8))
#define MAP_SSANNE_2F_ROOM4 (21 | (1 << 8))
#define MAP_SSANNE_2F_ROOM5 (22 | (1 << 8))
#define MAP_SSANNE_2F_ROOM6 (23 | (1 << 8))
#define MAP_SSANNE_B1F_ROOM1 (24 | (1 << 8))
#define MAP_SSANNE_B1F_ROOM2 (25 | (1 << 8))
#define MAP_SSANNE_B1F_ROOM3 (26 | (1 << 8))
#define MAP_SSANNE_B1F_ROOM4 (27 | (1 << 8))
#define MAP_SSANNE_B1F_ROOM5 (28 | (1 << 8))
#define MAP_SSANNE_1F_ROOM6 (29 | (1 << 8))
#define MAP_UNDERGROUND_PATH_NORTH_ENTRANCE (30 | (1 << 8))
#define MAP_UNDERGROUND_PATH_NORTH_SOUTH_TUNNEL (31 | (1 << 8))
#define MAP_UNDERGROUND_PATH_SOUTH_ENTRANCE (32 | (1 << 8))
#define MAP_UNDERGROUND_PATH_WEST_ENTRANCE (33 | (1 << 8))
#define MAP_UNDERGROUND_PATH_EAST_WEST_TUNNEL (34 | (1 << 8))
#define MAP_UNDERGROUND_PATH_EAST_ENTRANCE (35 | (1 << 8))
#define MAP_DIGLETTS_CAVE_NORTH_ENTRANCE (36 | (1 << 8))
#define MAP_DIGLETTS_CAVE_B1F (37 | (1 << 8))
#define MAP_DIGLETTS_CAVE_SOUTH_ENTRANCE (38 | (1 << 8))
#define MAP_VICTORY_ROAD_1F (39 | (1 << 8))
#define MAP_VICTORY_ROAD_2F (40 | (1 << 8))
#define MAP_VICTORY_ROAD_3F (41 | (1 << 8))
#define MAP_ROCKET_HIDEOUT_B1F (42 | (1 << 8))
#define MAP_ROCKET_HIDEOUT_B2F (43 | (1 << 8))
#define MAP_ROCKET_HIDEOUT_B3F (44 | (1 << 8))
#define MAP_ROCKET_HIDEOUT_B4F (45 | (1 << 8))
#define MAP_ROCKET_HIDEOUT_ELEVATOR (46 | (1 << 8))
#define MAP_SILPH_CO_1F (47 | (1 << 8))
#define MAP_SILPH_CO_2F (48 | (1 << 8))
#define MAP_SILPH_CO_3F (49 | (1 << 8))
#define MAP_SILPH_CO_4F (50 | (1 << 8))
#define MAP_SILPH_CO_5F (51 | (1 << 8))
#define MAP_SILPH_CO_6F (52 | (1 << 8))
#define MAP_SILPH_CO_7F (53 | (1 << 8))
#define MAP_SILPH_CO_8F (54 | (1 << 8))
#define MAP_SILPH_CO_9F (55 | (1 << 8))
#define MAP_SILPH_CO_10F (56 | (1 << 8))
#define MAP_SILPH_CO_11F (57 | (1 << 8))
#define MAP_SILPH_CO_ELEVATOR (58 | (1 << 8))
#define MAP_POKEMON_MANSION_1F (59 | (1 << 8))
#define MAP_POKEMON_MANSION_2F (60 | (1 << 8))
#define MAP_POKEMON_MANSION_3F (61 | (1 << 8))
#define MAP_POKEMON_MANSION_B1F (62 | (1 << 8))
#define MAP_SAFARI_ZONE_CENTER (63 | (1 << 8))
#define MAP_SAFARI_ZONE_EAST (64 | (1 << 8))
#define MAP_SAFARI_ZONE_NORTH (65 | (1 << 8))
#define MAP_SAFARI_ZONE_WEST (66 | (1 << 8))
#define MAP_SAFARI_ZONE_CENTER_REST_HOUSE (67 | (1 << 8))
#define MAP_SAFARI_ZONE_EAST_REST_HOUSE (68 | (1 << 8))
#define MAP_SAFARI_ZONE_NORTH_REST_HOUSE (69 | (1 << 8))
#define MAP_SAFARI_ZONE_WEST_REST_HOUSE (70 | (1 << 8))
#define MAP_SAFARI_ZONE_SECRET_HOUSE (71 | (1 << 8))
#define MAP_CERULEAN_CAVE_1F (72 | (1 << 8))
#define MAP_CERULEAN_CAVE_2F (73 | (1 << 8))
#define MAP_CERULEAN_CAVE_B1F (74 | (1 << 8))
#define MAP_POKEMON_LEAGUE_LORELEIS_ROOM (75 | (1 << 8))
#define MAP_POKEMON_LEAGUE_BRUNOS_ROOM (76 | (1 << 8))
#define MAP_POKEMON_LEAGUE_AGATHAS_ROOM (77 | (1 << 8))
#define MAP_POKEMON_LEAGUE_LANCES_ROOM (78 | (1 << 8))
#define MAP_POKEMON_LEAGUE_CHAMPIONS_ROOM (79 | (1 << 8))
#define MAP_POKEMON_LEAGUE_HALL_OF_FAME (80 | (1 << 8))
#define MAP_ROCK_TUNNEL_1F (81 | (1 << 8))
#define MAP_ROCK_TUNNEL_B1F (82 | (1 << 8))
#define MAP_SEAFOAM_ISLANDS_1F (83 | (1 << 8))
#define MAP_SEAFOAM_ISLANDS_B1F (84 | (1 << 8))
#define MAP_SEAFOAM_ISLANDS_B2F (85 | (1 << 8))
#define MAP_SEAFOAM_ISLANDS_B3F (86 | (1 << 8))
#define MAP_SEAFOAM_ISLANDS_B4F (87 | (1 << 8))
#define MAP_POKEMON_TOWER_1F (88 | (1 << 8))
#define MAP_POKEMON_TOWER_2F (89 | (1 << 8))
#define MAP_POKEMON_TOWER_3F (90 | (1 << 8))
#define MAP_POKEMON_TOWER_4F (91 | (1 << 8))
#define MAP_POKEMON_TOWER_5F (92 | (1 << 8))
#define MAP_POKEMON_TOWER_6F (93 | (1 << 8))
#define MAP_POKEMON_TOWER_7F (94 | (1 << 8))
#define MAP_POWER_PLANT (95 | (1 << 8))
#define MAP_MT_EMBER_RUBY_PATH_B4F (96 | (1 << 8))
#define MAP_MT_EMBER_EXTERIOR (97 | (1 << 8))
#define MAP_MT_EMBER_SUMMIT_PATH_1F (98 | (1 << 8))
#define MAP_MT_EMBER_SUMMIT_PATH_2F (99 | (1 << 8))
#define MAP_MT_EMBER_SUMMIT_PATH_3F (100 | (1 << 8))
#define MAP_MT_EMBER_SUMMIT (101 | (1 << 8))
#define MAP_MT_EMBER_RUBY_PATH_B5F (102 | (1 << 8))
#define MAP_MT_EMBER_RUBY_PATH_1F (103 | (1 << 8))
#define MAP_MT_EMBER_RUBY_PATH_B1F (104 | (1 << 8))
#define MAP_MT_EMBER_RUBY_PATH_B2F (105 | (1 << 8))
#define MAP_MT_EMBER_RUBY_PATH_B3F (106 | (1 << 8))
#define MAP_MT_EMBER_RUBY_PATH_B1F_STAIRS (107 | (1 << 8))
#define MAP_MT_EMBER_RUBY_PATH_B2F_STAIRS (108 | (1 << 8))
#define MAP_THREE_ISLAND_BERRY_FOREST (109 | (1 << 8))
#define MAP_FOUR_ISLAND_ICEFALL_CAVE_ENTRANCE (110 | (1 << 8))
#define MAP_FOUR_ISLAND_ICEFALL_CAVE_1F (111 | (1 << 8))
#define MAP_FOUR_ISLAND_ICEFALL_CAVE_B1F (112 | (1 << 8))
#define MAP_FOUR_ISLAND_ICEFALL_CAVE_BACK (113 | (1 << 8))
#define MAP_FIVE_ISLAND_ROCKET_WAREHOUSE (114 | (1 << 8))
#define MAP_SIX_ISLAND_DOTTED_HOLE_1F (115 | (1 << 8))
#define MAP_SIX_ISLAND_DOTTED_HOLE_B1F (116 | (1 << 8))
#define MAP_SIX_ISLAND_DOTTED_HOLE_B2F (117 | (1 << 8))
#define MAP_SIX_ISLAND_DOTTED_HOLE_B3F (118 | (1 << 8))
#define MAP_SIX_ISLAND_DOTTED_HOLE_B4F (119 | (1 << 8))
#define MAP_SIX_ISLAND_DOTTED_HOLE_SAPPHIRE_ROOM (120 | (1 << 8))
#define MAP_SIX_ISLAND_PATTERN_BUSH (121 | (1 << 8))
#define MAP_SIX_ISLAND_ALTERING_CAVE (122 | (1 << 8))
// gMapGroup_SpecialArea
#define MAP_NAVEL_ROCK_EXTERIOR (0 | (2 << 8))
#define MAP_TRAINER_TOWER_1F (1 | (2 << 8))
#define MAP_TRAINER_TOWER_2F (2 | (2 << 8))
#define MAP_TRAINER_TOWER_3F (3 | (2 << 8))
#define MAP_TRAINER_TOWER_4F (4 | (2 << 8))
#define MAP_TRAINER_TOWER_5F (5 | (2 << 8))
#define MAP_TRAINER_TOWER_6F (6 | (2 << 8))
#define MAP_TRAINER_TOWER_7F (7 | (2 << 8))
#define MAP_TRAINER_TOWER_8F (8 | (2 << 8))
#define MAP_TRAINER_TOWER_ROOF (9 | (2 << 8))
#define MAP_TRAINER_TOWER_LOBBY (10 | (2 << 8))
#define MAP_TRAINER_TOWER_ELEVATOR (11 | (2 << 8))
#define MAP_FIVE_ISLAND_LOST_CAVE_ENTRANCE (12 | (2 << 8))
#define MAP_FIVE_ISLAND_LOST_CAVE_ROOM1 (13 | (2 << 8))
#define MAP_FIVE_ISLAND_LOST_CAVE_ROOM2 (14 | (2 << 8))
#define MAP_FIVE_ISLAND_LOST_CAVE_ROOM3 (15 | (2 << 8))
#define MAP_FIVE_ISLAND_LOST_CAVE_ROOM4 (16 | (2 << 8))
#define MAP_FIVE_ISLAND_LOST_CAVE_ROOM5 (17 | (2 << 8))
#define MAP_FIVE_ISLAND_LOST_CAVE_ROOM6 (18 | (2 << 8))
#define MAP_FIVE_ISLAND_LOST_CAVE_ROOM7 (19 | (2 << 8))
#define MAP_FIVE_ISLAND_LOST_CAVE_ROOM8 (20 | (2 << 8))
#define MAP_FIVE_ISLAND_LOST_CAVE_ROOM9 (21 | (2 << 8))
#define MAP_FIVE_ISLAND_LOST_CAVE_ROOM10 (22 | (2 << 8))
#define MAP_FIVE_ISLAND_LOST_CAVE_ROOM11 (23 | (2 << 8))
#define MAP_FIVE_ISLAND_LOST_CAVE_ROOM12 (24 | (2 << 8))
#define MAP_FIVE_ISLAND_LOST_CAVE_ROOM13 (25 | (2 << 8))
#define MAP_FIVE_ISLAND_LOST_CAVE_ROOM14 (26 | (2 << 8))
#define MAP_SEVEN_ISLAND_TANOBY_RUINS_MONEAN_CHAMBER (27 | (2 << 8))
#define MAP_SEVEN_ISLAND_TANOBY_RUINS_LIPTOO_CHAMBER (28 | (2 << 8))
#define MAP_SEVEN_ISLAND_TANOBY_RUINS_WEEPTH_CHAMBER (29 | (2 << 8))
#define MAP_SEVEN_ISLAND_TANOBY_RUINS_DILFORD_CHAMBER (30 | (2 << 8))
#define MAP_SEVEN_ISLAND_TANOBY_RUINS_SCUFIB_CHAMBER (31 | (2 << 8))
#define MAP_SEVEN_ISLAND_TANOBY_RUINS_RIXY_CHAMBER (32 | (2 << 8))
#define MAP_SEVEN_ISLAND_TANOBY_RUINS_VIAPOIS_CHAMBER (33 | (2 << 8))
#define MAP_THREE_ISLAND_DUNSPARCE_TUNNEL (34 | (2 << 8))
#define MAP_SEVEN_ISLAND_SEVAULT_CANYON_TANOBY_KEY (35 | (2 << 8))
#define MAP_NAVEL_ROCK_1F (36 | (2 << 8))
#define MAP_NAVEL_ROCK_SUMMIT (37 | (2 << 8))
#define MAP_NAVEL_ROCK_BASE (38 | (2 << 8))
#define MAP_NAVEL_ROCK_SUMMIT_PATH_2F (39 | (2 << 8))
#define MAP_NAVEL_ROCK_SUMMIT_PATH_3F (40 | (2 << 8))
#define MAP_NAVEL_ROCK_SUMMIT_PATH_4F (41 | (2 << 8))
#define MAP_NAVEL_ROCK_SUMMIT_PATH_5F (42 | (2 << 8))
#define MAP_NAVEL_ROCK_BASE_PATH_B1F (43 | (2 << 8))
#define MAP_NAVEL_ROCK_BASE_PATH_B2F (44 | (2 << 8))
#define MAP_NAVEL_ROCK_BASE_PATH_B3F (45 | (2 << 8))
#define MAP_NAVEL_ROCK_BASE_PATH_B4F (46 | (2 << 8))
#define MAP_NAVEL_ROCK_BASE_PATH_B5F (47 | (2 << 8))
#define MAP_NAVEL_ROCK_BASE_PATH_B6F (48 | (2 << 8))
#define MAP_NAVEL_ROCK_BASE_PATH_B7F (49 | (2 << 8))
#define MAP_NAVEL_ROCK_BASE_PATH_B8F (50 | (2 << 8))
#define MAP_NAVEL_ROCK_BASE_PATH_B9F (51 | (2 << 8))
#define MAP_NAVEL_ROCK_BASE_PATH_B10F (52 | (2 << 8))
#define MAP_NAVEL_ROCK_BASE_PATH_B11F (53 | (2 << 8))
#define MAP_NAVEL_ROCK_B1F (54 | (2 << 8))
#define MAP_NAVEL_ROCK_FORK (55 | (2 << 8))
#define MAP_BIRTH_ISLAND_EXTERIOR (56 | (2 << 8))
#define MAP_ONE_ISLAND_KINDLE_ROAD_EMBER_SPA (57 | (2 << 8))
#define MAP_BIRTH_ISLAND_HARBOR (58 | (2 << 8))
#define MAP_NAVEL_ROCK_HARBOR (59 | (2 << 8))
// gMapGroup_TownsAndRoutes
#define MAP_PALLET_TOWN (0 | (3 << 8))
#define MAP_VIRIDIAN_CITY (1 | (3 << 8))
#define MAP_PEWTER_CITY (2 | (3 << 8))
#define MAP_CERULEAN_CITY (3 | (3 << 8))
#define MAP_LAVENDER_TOWN (4 | (3 << 8))
#define MAP_VERMILION_CITY (5 | (3 << 8))
#define MAP_CELADON_CITY (6 | (3 << 8))
#define MAP_FUCHSIA_CITY (7 | (3 << 8))
#define MAP_CINNABAR_ISLAND (8 | (3 << 8))
#define MAP_INDIGO_PLATEAU_EXTERIOR (9 | (3 << 8))
#define MAP_SAFFRON_CITY (10 | (3 << 8))
#define MAP_SAFFRON_CITY_CONNECTION (11 | (3 << 8))
#define MAP_ONE_ISLAND (12 | (3 << 8))
#define MAP_TWO_ISLAND (13 | (3 << 8))
#define MAP_THREE_ISLAND (14 | (3 << 8))
#define MAP_FOUR_ISLAND (15 | (3 << 8))
#define MAP_FIVE_ISLAND (16 | (3 << 8))
#define MAP_SEVEN_ISLAND (17 | (3 << 8))
#define MAP_SIX_ISLAND (18 | (3 << 8))
#define MAP_ROUTE1 (19 | (3 << 8))
#define MAP_ROUTE2 (20 | (3 << 8))
#define MAP_ROUTE3 (21 | (3 << 8))
#define MAP_ROUTE4 (22 | (3 << 8))
#define MAP_ROUTE5 (23 | (3 << 8))
#define MAP_ROUTE6 (24 | (3 << 8))
#define MAP_ROUTE7 (25 | (3 << 8))
#define MAP_ROUTE8 (26 | (3 << 8))
#define MAP_ROUTE9 (27 | (3 << 8))
#define MAP_ROUTE10 (28 | (3 << 8))
#define MAP_ROUTE11 (29 | (3 << 8))
#define MAP_ROUTE12 (30 | (3 << 8))
#define MAP_ROUTE13 (31 | (3 << 8))
#define MAP_ROUTE14 (32 | (3 << 8))
#define MAP_ROUTE15 (33 | (3 << 8))
#define MAP_ROUTE16 (34 | (3 << 8))
#define MAP_ROUTE17 (35 | (3 << 8))
#define MAP_ROUTE18 (36 | (3 << 8))
#define MAP_ROUTE19 (37 | (3 << 8))
#define MAP_ROUTE20 (38 | (3 << 8))
#define MAP_ROUTE21_NORTH (39 | (3 << 8))
#define MAP_ROUTE21_SOUTH (40 | (3 << 8))
#define MAP_ROUTE22 (41 | (3 << 8))
#define MAP_ROUTE23 (42 | (3 << 8))
#define MAP_ROUTE24 (43 | (3 << 8))
#define MAP_ROUTE25 (44 | (3 << 8))
#define MAP_ONE_ISLAND_KINDLE_ROAD (45 | (3 << 8))
#define MAP_ONE_ISLAND_TREASURE_BEACH (46 | (3 << 8))
#define MAP_TWO_ISLAND_CAPE_BRINK (47 | (3 << 8))
#define MAP_THREE_ISLAND_BOND_BRIDGE (48 | (3 << 8))
#define MAP_THREE_ISLAND_PORT (49 | (3 << 8))
#define MAP_PROTOTYPE_SEVII_ISLE_6 (50 | (3 << 8))
#define MAP_PROTOTYPE_SEVII_ISLE_7 (51 | (3 << 8))
#define MAP_PROTOTYPE_SEVII_ISLE_8 (52 | (3 << 8))
#define MAP_PROTOTYPE_SEVII_ISLE_9 (53 | (3 << 8))
#define MAP_FIVE_ISLAND_RESORT_GORGEOUS (54 | (3 << 8))
#define MAP_FIVE_ISLAND_WATER_LABYRINTH (55 | (3 << 8))
#define MAP_FIVE_ISLAND_MEADOW (56 | (3 << 8))
#define MAP_FIVE_ISLAND_MEMORIAL_PILLAR (57 | (3 << 8))
#define MAP_SIX_ISLAND_OUTCAST_ISLAND (58 | (3 << 8))
#define MAP_SIX_ISLAND_GREEN_PATH (59 | (3 << 8))
#define MAP_SIX_ISLAND_WATER_PATH (60 | (3 << 8))
#define MAP_SIX_ISLAND_RUIN_VALLEY (61 | (3 << 8))
#define MAP_SEVEN_ISLAND_TRAINER_TOWER (62 | (3 << 8))
#define MAP_SEVEN_ISLAND_SEVAULT_CANYON_ENTRANCE (63 | (3 << 8))
#define MAP_SEVEN_ISLAND_SEVAULT_CANYON (64 | (3 << 8))
#define MAP_SEVEN_ISLAND_TANOBY_RUINS (65 | (3 << 8))
// gMapGroup_IndoorPallet
#define MAP_PALLET_TOWN_PLAYERS_HOUSE_1F (0 | (4 << 8))
#define MAP_PALLET_TOWN_PLAYERS_HOUSE_2F (1 | (4 << 8))
#define MAP_PALLET_TOWN_RIVALS_HOUSE (2 | (4 << 8))
#define MAP_PALLET_TOWN_PROFESSOR_OAKS_LAB (3 | (4 << 8))
// gMapGroup_IndoorViridian
#define MAP_VIRIDIAN_CITY_HOUSE (0 | (5 << 8))
#define MAP_VIRIDIAN_CITY_GYM (1 | (5 << 8))
#define MAP_VIRIDIAN_CITY_SCHOOL (2 | (5 << 8))
#define MAP_VIRIDIAN_CITY_MART (3 | (5 << 8))
#define MAP_VIRIDIAN_CITY_POKEMON_CENTER_1F (4 | (5 << 8))
#define MAP_VIRIDIAN_CITY_POKEMON_CENTER_2F (5 | (5 << 8))
// gMapGroup_IndoorPewter
#define MAP_PEWTER_CITY_MUSEUM_1F (0 | (6 << 8))
#define MAP_PEWTER_CITY_MUSEUM_2F (1 | (6 << 8))
#define MAP_PEWTER_CITY_GYM (2 | (6 << 8))
#define MAP_PEWTER_CITY_MART (3 | (6 << 8))
#define MAP_PEWTER_CITY_HOUSE1 (4 | (6 << 8))
#define MAP_PEWTER_CITY_POKEMON_CENTER_1F (5 | (6 << 8))
#define MAP_PEWTER_CITY_POKEMON_CENTER_2F (6 | (6 << 8))
#define MAP_PEWTER_CITY_HOUSE2 (7 | (6 << 8))
// gMapGroup_IndoorCerulean
#define MAP_CERULEAN_CITY_HOUSE1 (0 | (7 << 8))
#define MAP_CERULEAN_CITY_HOUSE2 (1 | (7 << 8))
#define MAP_CERULEAN_CITY_HOUSE3 (2 | (7 << 8))
#define MAP_CERULEAN_CITY_POKEMON_CENTER_1F (3 | (7 << 8))
#define MAP_CERULEAN_CITY_POKEMON_CENTER_2F (4 | (7 << 8))
#define MAP_CERULEAN_CITY_GYM (5 | (7 << 8))
#define MAP_CERULEAN_CITY_BIKE_SHOP (6 | (7 << 8))
#define MAP_CERULEAN_CITY_MART (7 | (7 << 8))
#define MAP_CERULEAN_CITY_HOUSE4 (8 | (7 << 8))
#define MAP_CERULEAN_CITY_HOUSE5 (9 | (7 << 8))
// gMapGroup_IndoorLavender
#define MAP_LAVENDER_TOWN_POKEMON_CENTER_1F (0 | (8 << 8))
#define MAP_LAVENDER_TOWN_POKEMON_CENTER_2F (1 | (8 << 8))
#define MAP_LAVENDER_TOWN_VOLUNTEER_POKEMON_HOUSE (2 | (8 << 8))
#define MAP_LAVENDER_TOWN_HOUSE1 (3 | (8 << 8))
#define MAP_LAVENDER_TOWN_HOUSE2 (4 | (8 << 8))
#define MAP_LAVENDER_TOWN_MART (5 | (8 << 8))
// gMapGroup_IndoorVermilion
#define MAP_VERMILION_CITY_HOUSE1 (0 | (9 << 8))
#define MAP_VERMILION_CITY_POKEMON_CENTER_1F (1 | (9 << 8))
#define MAP_VERMILION_CITY_POKEMON_CENTER_2F (2 | (9 << 8))
#define MAP_VERMILION_CITY_POKEMON_FAN_CLUB (3 | (9 << 8))
#define MAP_VERMILION_CITY_HOUSE2 (4 | (9 << 8))
#define MAP_VERMILION_CITY_MART (5 | (9 << 8))
#define MAP_VERMILION_CITY_GYM (6 | (9 << 8))
#define MAP_VERMILION_CITY_HOUSE3 (7 | (9 << 8))
// gMapGroup_IndoorCeladon
#define MAP_CELADON_CITY_DEPARTMENT_STORE_1F (0 | (10 << 8))
#define MAP_CELADON_CITY_DEPARTMENT_STORE_2F (1 | (10 << 8))
#define MAP_CELADON_CITY_DEPARTMENT_STORE_3F (2 | (10 << 8))
#define MAP_CELADON_CITY_DEPARTMENT_STORE_4F (3 | (10 << 8))
#define MAP_CELADON_CITY_DEPARTMENT_STORE_5F (4 | (10 << 8))
#define MAP_CELADON_CITY_DEPARTMENT_STORE_ROOF (5 | (10 << 8))
#define MAP_CELADON_CITY_DEPARTMENT_STORE_ELEVATOR (6 | (10 << 8))
#define MAP_CELADON_CITY_CONDOMINIUMS_1F (7 | (10 << 8))
#define MAP_CELADON_CITY_CONDOMINIUMS_2F (8 | (10 << 8))
#define MAP_CELADON_CITY_CONDOMINIUMS_3F (9 | (10 << 8))
#define MAP_CELADON_CITY_CONDOMINIUMS_ROOF (10 | (10 << 8))
#define MAP_CELADON_CITY_CONDOMINIUMS_ROOF_ROOM (11 | (10 << 8))
#define MAP_CELADON_CITY_POKEMON_CENTER_1F (12 | (10 << 8))
#define MAP_CELADON_CITY_POKEMON_CENTER_2F (13 | (10 << 8))
#define MAP_CELADON_CITY_GAME_CORNER (14 | (10 << 8))
#define MAP_CELADON_CITY_GAME_CORNER_PRIZE_ROOM (15 | (10 << 8))
#define MAP_CELADON_CITY_GYM (16 | (10 << 8))
#define MAP_CELADON_CITY_RESTAURANT (17 | (10 << 8))
#define MAP_CELADON_CITY_HOUSE1 (18 | (10 << 8))
#define MAP_CELADON_CITY_HOTEL (19 | (10 << 8))
// gMapGroup_IndoorFuchsia
#define MAP_FUCHSIA_CITY_SAFARI_ZONE_ENTRANCE (0 | (11 << 8))
#define MAP_FUCHSIA_CITY_MART (1 | (11 << 8))
#define MAP_FUCHSIA_CITY_SAFARI_ZONE_OFFICE (2 | (11 << 8))
#define MAP_FUCHSIA_CITY_GYM (3 | (11 << 8))
#define MAP_FUCHSIA_CITY_HOUSE1 (4 | (11 << 8))
#define MAP_FUCHSIA_CITY_POKEMON_CENTER_1F (5 | (11 << 8))
#define MAP_FUCHSIA_CITY_POKEMON_CENTER_2F (6 | (11 << 8))
#define MAP_FUCHSIA_CITY_WARDENS_HOUSE (7 | (11 << 8))
#define MAP_FUCHSIA_CITY_HOUSE2 (8 | (11 << 8))
#define MAP_FUCHSIA_CITY_HOUSE3 (9 | (11 << 8))
// gMapGroup_IndoorCinnabar
#define MAP_CINNABAR_ISLAND_GYM (0 | (12 << 8))
#define MAP_CINNABAR_ISLAND_POKEMON_LAB_ENTRANCE (1 | (12 << 8))
#define MAP_CINNABAR_ISLAND_POKEMON_LAB_LOUNGE (2 | (12 << 8))
#define MAP_CINNABAR_ISLAND_POKEMON_LAB_RESEARCH_ROOM (3 | (12 << 8))
#define MAP_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM (4 | (12 << 8))
#define MAP_CINNABAR_ISLAND_POKEMON_CENTER_1F (5 | (12 << 8))
#define MAP_CINNABAR_ISLAND_POKEMON_CENTER_2F (6 | (12 << 8))
#define MAP_CINNABAR_ISLAND_MART (7 | (12 << 8))
// gMapGroup_IndoorIndigoPlateau
#define MAP_INDIGO_PLATEAU_POKEMON_CENTER_1F (0 | (13 << 8))
#define MAP_INDIGO_PLATEAU_POKEMON_CENTER_2F (1 | (13 << 8))
// gMapGroup_IndoorSaffron
#define MAP_SAFFRON_CITY_COPYCATS_HOUSE_1F (0 | (14 << 8))
#define MAP_SAFFRON_CITY_COPYCATS_HOUSE_2F (1 | (14 << 8))
#define MAP_SAFFRON_CITY_DOJO (2 | (14 << 8))
#define MAP_SAFFRON_CITY_GYM (3 | (14 << 8))
#define MAP_SAFFRON_CITY_HOUSE (4 | (14 << 8))
#define MAP_SAFFRON_CITY_MART (5 | (14 << 8))
#define MAP_SAFFRON_CITY_POKEMON_CENTER_1F (6 | (14 << 8))
#define MAP_SAFFRON_CITY_POKEMON_CENTER_2F (7 | (14 << 8))
#define MAP_SAFFRON_CITY_MR_PSYCHICS_HOUSE (8 | (14 << 8))
#define MAP_SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB (9 | (14 << 8))
// gMapGroup_IndoorRoute2
#define MAP_ROUTE2_VIRIDIAN_FOREST_SOUTH_ENTRANCE (0 | (15 << 8))
#define MAP_ROUTE2_HOUSE (1 | (15 << 8))
#define MAP_ROUTE2_EAST_BUILDING (2 | (15 << 8))
#define MAP_ROUTE2_VIRIDIAN_FOREST_NORTH_ENTRANCE (3 | (15 << 8))
// gMapGroup_IndoorRoute4
#define MAP_ROUTE4_POKEMON_CENTER_1F (0 | (16 << 8))
#define MAP_ROUTE4_POKEMON_CENTER_2F (1 | (16 << 8))
// gMapGroup_IndoorRoute5
#define MAP_ROUTE5_POKEMON_DAY_CARE (0 | (17 << 8))
#define MAP_ROUTE5_SOUTH_ENTRANCE (1 | (17 << 8))
// gMapGroup_IndoorRoute6
#define MAP_ROUTE6_NORTH_ENTRANCE (0 | (18 << 8))
#define MAP_ROUTE6_UNUSED_HOUSE (1 | (18 << 8))
// gMapGroup_IndoorRoute7
#define MAP_ROUTE7_EAST_ENTRANCE (0 | (19 << 8))
// gMapGroup_IndoorRoute8
#define MAP_ROUTE8_WEST_ENTRANCE (0 | (20 << 8))
// gMapGroup_IndoorRoute10
#define MAP_ROUTE10_POKEMON_CENTER_1F (0 | (21 << 8))
#define MAP_ROUTE10_POKEMON_CENTER_2F (1 | (21 << 8))
// gMapGroup_IndoorRoute11
#define MAP_ROUTE11_EAST_ENTRANCE_1F (0 | (22 << 8))
#define MAP_ROUTE11_EAST_ENTRANCE_2F (1 | (22 << 8))
// gMapGroup_IndoorRoute12
#define MAP_ROUTE12_NORTH_ENTRANCE_1F (0 | (23 << 8))
#define MAP_ROUTE12_NORTH_ENTRANCE_2F (1 | (23 << 8))
#define MAP_ROUTE12_FISHING_HOUSE (2 | (23 << 8))
// gMapGroup_IndoorRoute15
#define MAP_ROUTE15_WEST_ENTRANCE_1F (0 | (24 << 8))
#define MAP_ROUTE15_WEST_ENTRANCE_2F (1 | (24 << 8))
// gMapGroup_IndoorRoute16
#define MAP_ROUTE16_HOUSE (0 | (25 << 8))
#define MAP_ROUTE16_NORTH_ENTRANCE_1F (1 | (25 << 8))
#define MAP_ROUTE16_NORTH_ENTRANCE_2F (2 | (25 << 8))
// gMapGroup_IndoorRoute18
#define MAP_ROUTE18_EAST_ENTRANCE_1F (0 | (26 << 8))
#define MAP_ROUTE18_EAST_ENTRANCE_2F (1 | (26 << 8))
// gMapGroup_IndoorRoute19
#define MAP_ROUTE19_UNUSED_HOUSE (0 | (27 << 8))
// gMapGroup_IndoorRoute22
#define MAP_ROUTE22_NORTH_ENTRANCE (0 | (28 << 8))
// gMapGroup_IndoorRoute23
#define MAP_ROUTE23_UNUSED_HOUSE (0 | (29 << 8))
// gMapGroup_IndoorRoute25
#define MAP_ROUTE25_SEA_COTTAGE (0 | (30 << 8))
// gMapGroup_IndoorSevenIsland
#define MAP_SEVEN_ISLAND_HOUSE_ROOM1 (0 | (31 << 8))
#define MAP_SEVEN_ISLAND_HOUSE_ROOM2 (1 | (31 << 8))
#define MAP_SEVEN_ISLAND_MART (2 | (31 << 8))
#define MAP_SEVEN_ISLAND_POKEMON_CENTER_1F (3 | (31 << 8))
#define MAP_SEVEN_ISLAND_POKEMON_CENTER_2F (4 | (31 << 8))
#define MAP_SEVEN_ISLAND_UNUSED_HOUSE (5 | (31 << 8))
#define MAP_SEVEN_ISLAND_HARBOR (6 | (31 << 8))
// gMapGroup_IndoorOneIsland
#define MAP_ONE_ISLAND_POKEMON_CENTER_1F (0 | (32 << 8))
#define MAP_ONE_ISLAND_POKEMON_CENTER_2F (1 | (32 << 8))
#define MAP_ONE_ISLAND_HOUSE1 (2 | (32 << 8))
#define MAP_ONE_ISLAND_HOUSE2 (3 | (32 << 8))
#define MAP_ONE_ISLAND_HARBOR (4 | (32 << 8))
// gMapGroup_IndoorTwoIsland
#define MAP_TWO_ISLAND_JOYFUL_GAME_CORNER (0 | (33 << 8))
#define MAP_TWO_ISLAND_HOUSE (1 | (33 << 8))
#define MAP_TWO_ISLAND_POKEMON_CENTER_1F (2 | (33 << 8))
#define MAP_TWO_ISLAND_POKEMON_CENTER_2F (3 | (33 << 8))
#define MAP_TWO_ISLAND_HARBOR (4 | (33 << 8))
// gMapGroup_IndoorThreeIsland
#define MAP_THREE_ISLAND_HOUSE1 (0 | (34 << 8))
#define MAP_THREE_ISLAND_POKEMON_CENTER_1F (1 | (34 << 8))
#define MAP_THREE_ISLAND_POKEMON_CENTER_2F (2 | (34 << 8))
#define MAP_THREE_ISLAND_MART (3 | (34 << 8))
#define MAP_THREE_ISLAND_HOUSE2 (4 | (34 << 8))
#define MAP_THREE_ISLAND_HOUSE3 (5 | (34 << 8))
#define MAP_THREE_ISLAND_HOUSE4 (6 | (34 << 8))
#define MAP_THREE_ISLAND_HOUSE5 (7 | (34 << 8))
// gMapGroup_IndoorFourIsland
#define MAP_FOUR_ISLAND_POKEMON_DAY_CARE (0 | (35 << 8))
#define MAP_FOUR_ISLAND_POKEMON_CENTER_1F (1 | (35 << 8))
#define MAP_FOUR_ISLAND_POKEMON_CENTER_2F (2 | (35 << 8))
#define MAP_FOUR_ISLAND_HOUSE1 (3 | (35 << 8))
#define MAP_FOUR_ISLAND_LORELEIS_HOUSE (4 | (35 << 8))
#define MAP_FOUR_ISLAND_HARBOR (5 | (35 << 8))
#define MAP_FOUR_ISLAND_HOUSE2 (6 | (35 << 8))
#define MAP_FOUR_ISLAND_MART (7 | (35 << 8))
// gMapGroup_IndoorFiveIsland
#define MAP_FIVE_ISLAND_POKEMON_CENTER_1F (0 | (36 << 8))
#define MAP_FIVE_ISLAND_POKEMON_CENTER_2F (1 | (36 << 8))
#define MAP_FIVE_ISLAND_HARBOR (2 | (36 << 8))
#define MAP_FIVE_ISLAND_HOUSE1 (3 | (36 << 8))
#define MAP_FIVE_ISLAND_HOUSE2 (4 | (36 << 8))
// gMapGroup_IndoorSixIsland
#define MAP_SIX_ISLAND_POKEMON_CENTER_1F (0 | (37 << 8))
#define MAP_SIX_ISLAND_POKEMON_CENTER_2F (1 | (37 << 8))
#define MAP_SIX_ISLAND_HARBOR (2 | (37 << 8))
#define MAP_SIX_ISLAND_HOUSE (3 | (37 << 8))
#define MAP_SIX_ISLAND_MART (4 | (37 << 8))
// gMapGroup_IndoorThreeIslandRoute
#define MAP_THREE_ISLAND_HARBOR (0 | (38 << 8))
// gMapGroup_IndoorFiveIslandRoute
#define MAP_FIVE_ISLAND_RESORT_GORGEOUS_HOUSE (0 | (39 << 8))
// gMapGroup_IndoorTwoIslandRoute
#define MAP_TWO_ISLAND_CAPE_BRINK_HOUSE (0 | (40 << 8))
// gMapGroup_IndoorSixIslandRoute
#define MAP_SIX_ISLAND_WATER_PATH_HOUSE1 (0 | (41 << 8))
#define MAP_SIX_ISLAND_WATER_PATH_HOUSE2 (1 | (41 << 8))
// gMapGroup_IndoorSevenIslandRoute
#define MAP_SEVEN_ISLAND_SEVAULT_CANYON_HOUSE (0 | (42 << 8))
#define MAP_GROUPS_COUNT 43
#endif // GUARD_CONSTANTS_MAP_GROUPS_H
+12 -13
View File
@@ -1,27 +1,26 @@
# JSON files are run through jsonproc, which is a tool that converts JSON data to an output file
# based on an Inja template. https://github.com/pantor/inja
AUTO_GEN_TARGETS += $(DATA_C_SUBDIR)/items.h
$(DATA_C_SUBDIR)/items.h: $(DATA_C_SUBDIR)/items.json $(DATA_C_SUBDIR)/items.json.txt
AUTO_GEN_TARGETS += $(DATA_SRC_SUBDIR)/wild_encounters.h
$(DATA_SRC_SUBDIR)/wild_encounters.h: $(DATA_SRC_SUBDIR)/wild_encounters.json $(DATA_SRC_SUBDIR)/wild_encounters.json.txt
$(JSONPROC) $^ $@
$(C_BUILDDIR)/item.o: c_dep += $(DATA_C_SUBDIR)/items.h
$(C_BUILDDIR)/wild_encounter.o: c_dep += $(DATA_SRC_SUBDIR)/wild_encounters.h
AUTO_GEN_TARGETS += $(DATA_C_SUBDIR)/wild_encounters.h
$(DATA_C_SUBDIR)/wild_encounters.h: $(DATA_C_SUBDIR)/wild_encounters.json $(DATA_C_SUBDIR)/wild_encounters.json.txt
AUTO_GEN_TARGETS += $(DATA_SRC_SUBDIR)/region_map/region_map_entries.h
$(DATA_SRC_SUBDIR)/region_map/region_map_entries.h: $(DATA_SRC_SUBDIR)/region_map/region_map_sections.json $(DATA_SRC_SUBDIR)/region_map/region_map_sections.entries.json.txt
$(JSONPROC) $^ $@
$(C_BUILDDIR)/wild_encounter.o: c_dep += $(DATA_C_SUBDIR)/wild_encounters.h
$(C_BUILDDIR)/region_map.o: c_dep += $(DATA_SRC_SUBDIR)/region_map/region_map_entries.h
AUTO_GEN_TARGETS += $(DATA_C_SUBDIR)/region_map/region_map_entry_strings.h
$(DATA_C_SUBDIR)/region_map/region_map_entry_strings.h: $(DATA_C_SUBDIR)/region_map/region_map_sections.json $(DATA_C_SUBDIR)/region_map/region_map_sections.strings.json.txt
AUTO_GEN_TARGETS += $(DATA_SRC_SUBDIR)/region_map/region_map_entry_strings.h
$(DATA_SRC_SUBDIR)/region_map/region_map_entry_strings.h: $(DATA_SRC_SUBDIR)/region_map/region_map_sections.json $(DATA_SRC_SUBDIR)/region_map/region_map_sections.strings.json.txt
$(JSONPROC) $^ $@
$(C_BUILDDIR)/region_map.o: c_dep += $(DATA_C_SUBDIR)/region_map/region_map_entry_strings.h
$(C_BUILDDIR)/region_map.o: c_dep += $(DATA_SRC_SUBDIR)/region_map/region_map_entry_strings.h
AUTO_GEN_TARGETS += $(DATA_C_SUBDIR)/region_map/region_map_entries.h
$(DATA_C_SUBDIR)/region_map/region_map_entries.h: $(DATA_C_SUBDIR)/region_map/region_map_sections.json $(DATA_C_SUBDIR)/region_map/region_map_sections.entries.json.txt
AUTO_GEN_TARGETS += $(DATA_SRC_SUBDIR)/items.h
$(DATA_SRC_SUBDIR)/items.h: $(DATA_SRC_SUBDIR)/items.json $(DATA_SRC_SUBDIR)/items.json.txt
$(JSONPROC) $^ $@
$(C_BUILDDIR)/region_map.o: c_dep += $(DATA_C_SUBDIR)/region_map/region_map_entries.h
$(C_BUILDDIR)/item.o: c_dep += $(DATA_SRC_SUBDIR)/items.h
+22
View File
@@ -0,0 +1,22 @@
# This controls building executables in the `tools` folder.
# Can be invoked through the `Makefile` or standalone.
MAKEFLAGS += --no-print-directory
# Inclusive list. If you don't want a tool to be built, don't add it here.
TOOLS_DIR := tools
TOOL_NAMES := aif2pcm bin2c gbafix gbagfx jsonproc mapjson mid2agb preproc ramscrgen rsfont scaninc
TOOLDIRS := $(TOOL_NAMES:%=$(TOOLS_DIR)/%)
# Tool making doesnt require a pokefirered dependency scan.
RULES_NO_SCAN += tools check-tools clean-tools $(TOOLDIRS)
.PHONY: $(RULES_NO_SCAN)
tools: $(TOOLDIRS)
$(TOOLDIRS):
@$(MAKE) -C $@
clean-tools:
@$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);)
+19 -19
View File
@@ -1,32 +1,32 @@
# Map JSON data
# Inputs
MAPS_DIR = $(DATA_ASM_SUBDIR)/maps
LAYOUTS_DIR = $(DATA_ASM_SUBDIR)/layouts
# Outputs
MAPS_OUTDIR := $(MAPS_DIR)
LAYOUTS_OUTDIR := $(LAYOUTS_DIR)
INCLUDECONSTS_OUTDIR := include/constants
AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/map_groups.h
AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/layouts.h
MAP_DIRS := $(dir $(wildcard $(MAPS_DIR)/*/map.json))
MAP_CONNECTIONS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/connections.inc,$(MAP_DIRS))
MAP_EVENTS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/events.inc,$(MAP_DIRS))
MAP_HEADERS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/header.inc,$(MAP_DIRS))
$(MAPS_DIR)/%/header.inc: $(MAPS_DIR)/%/map.json
$(MAPJSON) map firered $< $(LAYOUTS_DIR)/layouts.json
$(MAPS_DIR)/%/events.inc: $(MAPS_DIR)/%/header.inc ;
$(MAPS_DIR)/%/connections.inc: $(MAPS_DIR)/%/events.inc ;
$(MAPS_DIR)/groups.inc: $(MAPS_DIR)/map_groups.json
$(MAPJSON) groups firered $<
$(MAPS_DIR)/connections.inc: $(MAPS_DIR)/groups.inc ;
$(MAPS_DIR)/events.inc: $(MAPS_DIR)/connections.inc ;
$(MAPS_DIR)/headers.inc: $(MAPS_DIR)/events.inc ;
include/constants/map_groups.h: $(MAPS_DIR)/headers.inc ;
$(LAYOUTS_DIR)/layouts.inc: $(LAYOUTS_DIR)/layouts.json
$(MAPJSON) layouts firered $<
$(LAYOUTS_DIR)/layouts_table.inc: $(LAYOUTS_DIR)/layouts.inc ;
include/constants/layouts.h: $(LAYOUTS_DIR)/layouts_table.inc ;
$(DATA_ASM_BUILDDIR)/maps.o: $(DATA_ASM_SUBDIR)/maps.s $(LAYOUTS_DIR)/layouts.inc $(LAYOUTS_DIR)/layouts_table.inc $(MAPS_DIR)/headers.inc $(MAPS_DIR)/groups.inc $(MAPS_DIR)/connections.inc $(MAP_CONNECTIONS) $(MAP_HEADERS)
$(PREPROC) $< charmap.txt | $(CPP) -I include -nostdinc -undef -Wno-unicode - | $(AS) $(ASFLAGS) -o $@
$(PREPROC) $< charmap.txt | $(CPP) -I include -nostdinc -undef -Wno-unicode - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@
$(DATA_ASM_BUILDDIR)/map_events.o: $(DATA_ASM_SUBDIR)/map_events.s $(MAPS_DIR)/events.inc $(MAP_EVENTS)
$(PREPROC) $< charmap.txt | $(CPP) -I include -nostdinc -undef -Wno-unicode - | $(AS) $(ASFLAGS) -o $@
$(PREPROC) $< charmap.txt | $(CPP) -I include -nostdinc -undef -Wno-unicode - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@
$(MAPS_OUTDIR)/%/header.inc $(MAPS_OUTDIR)/%/events.inc $(MAPS_OUTDIR)/%/connections.inc: $(MAPS_DIR)/%/map.json
$(MAPJSON) map firered $< $(LAYOUTS_DIR)/layouts.json $(@D)
$(MAPS_OUTDIR)/connections.inc $(MAPS_OUTDIR)/groups.inc $(MAPS_OUTDIR)/events.inc $(MAPS_OUTDIR)/headers.inc $(INCLUDECONSTS_OUTDIR)/map_groups.h: $(MAPS_DIR)/map_groups.json
$(MAPJSON) groups firered $< $(MAPS_OUTDIR) $(INCLUDECONSTS_OUTDIR)
$(LAYOUTS_OUTDIR)/layouts.inc $(LAYOUTS_OUTDIR)/layouts_table.inc $(INCLUDECONSTS_OUTDIR)/layouts.h: $(LAYOUTS_DIR)/layouts.json
$(MAPJSON) layouts firered $< $(LAYOUTS_OUTDIR) $(INCLUDECONSTS_OUTDIR)
-829
View File
@@ -1,829 +0,0 @@
STD_REVERB = 50
$(MID_BUILDDIR)/%.o: $(MID_SUBDIR)/%.s
$(AS) $(ASFLAGS) -I sound -o $@ $<
$(MID_SUBDIR)/mus_rocket_hideout.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G133 -V090
$(MID_SUBDIR)/mus_follow_me.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G131 -V068
$(MID_SUBDIR)/mus_rs_vs_trainer.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G011 -V080 -P1
$(MID_SUBDIR)/mus_rs_vs_gym_leader.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G010 -V080
$(MID_SUBDIR)/mus_victory_road.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G154 -V090
$(MID_SUBDIR)/mus_cycling.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G141 -V090
$(MID_SUBDIR)/mus_intro_fight.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G136 -V090
$(MID_SUBDIR)/mus_hall_of_fame.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G145 -V079
$(MID_SUBDIR)/mus_encounter_deoxys.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G184 -V079
$(MID_SUBDIR)/mus_dummy.s: %.s: %.mid
$(MID) $< $@ -E -R40
$(MID_SUBDIR)/mus_credits.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G149 -V090
$(MID_SUBDIR)/mus_encounter_gym_leader.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G144 -V090
$(MID_SUBDIR)/mus_dex_rating.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G175 -V070 -P5
$(MID_SUBDIR)/mus_obtain_key_item.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G178 -V077 -P5
$(MID_SUBDIR)/mus_caught_intro.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G179 -V094 -P5
$(MID_SUBDIR)/mus_level_up.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G008 -V090 -P5
$(MID_SUBDIR)/mus_obtain_item.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G008 -V090 -P5
$(MID_SUBDIR)/mus_evolved.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G008 -V090 -P5
$(MID_SUBDIR)/mus_caught.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G170 -V100
$(MID_SUBDIR)/mus_cinnabar.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G138 -V090
$(MID_SUBDIR)/mus_gym.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G134 -V090
$(MID_SUBDIR)/mus_fuchsia.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G167 -V090
$(MID_SUBDIR)/mus_poke_jump.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G132 -V090
$(MID_SUBDIR)/mus_heal_unused.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G140 -V090
$(MID_SUBDIR)/mus_oak_lab.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G160 -V075
$(MID_SUBDIR)/mus_berry_pick.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G132 -V090
$(MID_SUBDIR)/mus_vermillion.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G172 -V090
$(MID_SUBDIR)/mus_route1.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G150 -V079
$(MID_SUBDIR)/mus_route3.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G152 -V083
$(MID_SUBDIR)/mus_route11.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G153 -V090
$(MID_SUBDIR)/mus_pallet.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G159 -V100
$(MID_SUBDIR)/mus_heal.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G008 -V090 -P5
$(MID_SUBDIR)/mus_slots_jackpot.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G008 -V100 -P5
$(MID_SUBDIR)/mus_slots_win.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G008 -V100 -P5
$(MID_SUBDIR)/mus_obtain_badge.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G008 -V090 -P5
$(MID_SUBDIR)/mus_obtain_berry.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G008 -V090 -P5
$(MID_SUBDIR)/mus_photo.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G180 -V100 -P5
$(MID_SUBDIR)/mus_evolution_intro.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G009 -V080 -P1
$(MID_SUBDIR)/mus_move_deleted.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G008 -V090 -P5
$(MID_SUBDIR)/mus_obtain_tmhm.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G008 -V090 -P5
$(MID_SUBDIR)/mus_too_bad.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G008 -V090 -P5
$(MID_SUBDIR)/mus_surf.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G164 -V071
$(MID_SUBDIR)/mus_sevii_123.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G173 -V084
$(MID_SUBDIR)/mus_sevii_45.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G188 -V084
$(MID_SUBDIR)/mus_sevii_67.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G189 -V084
$(MID_SUBDIR)/mus_sevii_cave.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G147 -V090
$(MID_SUBDIR)/mus_sevii_dungeon.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G146 -V090
$(MID_SUBDIR)/mus_sevii_route.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G187 -V080
$(MID_SUBDIR)/mus_net_center.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G162 -V096
$(MID_SUBDIR)/mus_pewter.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G173 -V084
$(MID_SUBDIR)/mus_oak.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G161 -V086
$(MID_SUBDIR)/mus_mystery_gift.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G183 -V100
$(MID_SUBDIR)/mus_route24.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G151 -V086
$(MID_SUBDIR)/mus_teachy_tv_show.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G131 -V068
$(MID_SUBDIR)/mus_mt_moon.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G147 -V090
$(MID_SUBDIR)/mus_school.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G012 -V100 -P1
$(MID_SUBDIR)/mus_poke_tower.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G165 -V090
$(MID_SUBDIR)/mus_poke_center.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G162 -V096
$(MID_SUBDIR)/mus_poke_flute.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G165 -V048 -P5
$(MID_SUBDIR)/mus_poke_mansion.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G148 -V090
$(MID_SUBDIR)/mus_jigglypuff.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G135 -V068 -P5
$(MID_SUBDIR)/mus_encounter_rival.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G174 -V079
$(MID_SUBDIR)/mus_rival_exit.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G174 -V079
$(MID_SUBDIR)/mus_encounter_rocket.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G142 -V096
$(MID_SUBDIR)/mus_ss_anne.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G163 -V090
$(MID_SUBDIR)/mus_new_game_exit.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G182 -V088
$(MID_SUBDIR)/mus_new_game_intro.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G182 -V088
$(MID_SUBDIR)/mus_evolution.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G009 -V080 -P1
$(MID_SUBDIR)/mus_lavender.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G139 -V090
$(MID_SUBDIR)/mus_silph.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G166 -V076
$(MID_SUBDIR)/mus_encounter_girl.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G143 -V051
$(MID_SUBDIR)/mus_encounter_boy.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G144 -V090
$(MID_SUBDIR)/mus_game_corner.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G132 -V090
$(MID_SUBDIR)/mus_slow_pallet.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G159 -V092
$(MID_SUBDIR)/mus_new_game_instruct.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G182 -V085
$(MID_SUBDIR)/mus_viridian_forest.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G146 -V090
$(MID_SUBDIR)/mus_trainer_tower.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G134 -V090
$(MID_SUBDIR)/mus_celadon.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G168 -V070
$(MID_SUBDIR)/mus_title.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G137 -V090
$(MID_SUBDIR)/mus_game_freak.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G181 -V075
$(MID_SUBDIR)/mus_teachy_tv_menu.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G186 -V059
$(MID_SUBDIR)/mus_union_room.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G132 -V090
$(MID_SUBDIR)/mus_vs_legend.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G157 -V090
$(MID_SUBDIR)/mus_vs_deoxys.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G185 -V080
$(MID_SUBDIR)/mus_vs_gym_leader.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G155 -V090
$(MID_SUBDIR)/mus_vs_champion.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G158 -V090
$(MID_SUBDIR)/mus_vs_mewtwo.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G157 -V090
$(MID_SUBDIR)/mus_vs_trainer.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G156 -V090
$(MID_SUBDIR)/mus_vs_wild.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G157 -V090
$(MID_SUBDIR)/se_door.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G129 -V100 -P5
$(MID_SUBDIR)/mus_victory_gym_leader.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G171 -V090
$(MID_SUBDIR)/mus_victory_trainer.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G169 -V089
$(MID_SUBDIR)/mus_victory_wild.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G170 -V090
$(MID_SUBDIR)/ph_choice_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_choice_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_choice_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_cloth_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_cloth_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_cloth_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_cure_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_cure_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_cure_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_dress_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_dress_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_dress_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_face_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_face_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_face_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_fleece_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_fleece_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_fleece_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_foot_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_foot_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_foot_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_goat_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_goat_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_goat_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_goose_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_goose_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_goose_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_kit_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_kit_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_kit_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_lot_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_lot_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_lot_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_mouth_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_mouth_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_mouth_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_nurse_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_nurse_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_nurse_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_price_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_price_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_price_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_strut_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_strut_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_strut_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_thought_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_thought_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_thought_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_trap_blend.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_trap_held.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/ph_trap_solo.s: %.s: %.mid
$(MID) $< $@ -E -G130 -P4
$(MID_SUBDIR)/se_bang.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_taillow_wing_flap.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V105 -P5
$(MID_SUBDIR)/se_glass_flute.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V105 -P5
$(MID_SUBDIR)/se_boo.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P4
$(MID_SUBDIR)/se_ball.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V070 -P4
$(MID_SUBDIR)/se_ball_open.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5
$(MID_SUBDIR)/se_mugshot.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P5
$(MID_SUBDIR)/se_contest_heart.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P5
$(MID_SUBDIR)/se_contest_curtain_fall.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V070 -P5
$(MID_SUBDIR)/se_contest_curtain_rise.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V070 -P5
$(MID_SUBDIR)/se_contest_icon_change.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P5
$(MID_SUBDIR)/se_contest_mons_turn.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P5
$(MID_SUBDIR)/se_contest_icon_clear.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P5
$(MID_SUBDIR)/se_card.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P4
$(MID_SUBDIR)/se_ledge.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P4
$(MID_SUBDIR)/se_itemfinder.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V090 -P5
$(MID_SUBDIR)/se_applause.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P5
$(MID_SUBDIR)/se_field_poison.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P5
$(MID_SUBDIR)/se_rs_door.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V080 -P5
$(MID_SUBDIR)/se_elevator.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4
$(MID_SUBDIR)/se_escalator.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4
$(MID_SUBDIR)/se_exp.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V080 -P5
$(MID_SUBDIR)/se_exp_max.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V094 -P5
$(MID_SUBDIR)/se_fu_zaku.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V120 -P4
$(MID_SUBDIR)/se_contest_condition_lose.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P4
$(MID_SUBDIR)/se_lavaridge_fall_warp.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -P4
$(MID_SUBDIR)/se_balloon_red.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V105 -P4
$(MID_SUBDIR)/se_balloon_blue.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V105 -P4
$(MID_SUBDIR)/se_balloon_yellow.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V105 -P4
$(MID_SUBDIR)/se_bridge_walk.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V095 -P4
$(MID_SUBDIR)/se_failure.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V120 -P4
$(MID_SUBDIR)/se_rotating_gate.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P4
$(MID_SUBDIR)/se_low_health.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P3
$(MID_SUBDIR)/se_sliding_door.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V095 -P4
$(MID_SUBDIR)/se_vend.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_bike_hop.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V090 -P4
$(MID_SUBDIR)/se_bike_bell.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P4
$(MID_SUBDIR)/se_contest_place.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P4
$(MID_SUBDIR)/se_exit.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V120 -P5
$(MID_SUBDIR)/se_use_item.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5
$(MID_SUBDIR)/se_unlock.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4
$(MID_SUBDIR)/se_ball_bounce_1.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4
$(MID_SUBDIR)/se_ball_bounce_2.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4
$(MID_SUBDIR)/se_ball_bounce_3.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4
$(MID_SUBDIR)/se_ball_bounce_4.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4
$(MID_SUBDIR)/se_super_effective.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P5
$(MID_SUBDIR)/se_not_effective.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P5
$(MID_SUBDIR)/se_effective.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P5
$(MID_SUBDIR)/se_puddle.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V020 -P4
$(MID_SUBDIR)/se_berry_blender.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P4
$(MID_SUBDIR)/se_switch.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P4
$(MID_SUBDIR)/se_ball_throw.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V120 -P5
$(MID_SUBDIR)/se_ship.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V075 -P4
$(MID_SUBDIR)/se_flee.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V090 -P5
$(MID_SUBDIR)/se_intro_blast.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5
$(MID_SUBDIR)/se_pc_login.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5
$(MID_SUBDIR)/se_pc_off.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5
$(MID_SUBDIR)/se_pc_on.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5
$(MID_SUBDIR)/se_pin.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V060 -P4
$(MID_SUBDIR)/se_ding_dong.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V090 -P5
$(MID_SUBDIR)/se_pokenav_off.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5
$(MID_SUBDIR)/se_pokenav_on.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5
$(MID_SUBDIR)/se_faint.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P5
$(MID_SUBDIR)/se_shiny.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V095 -P5
$(MID_SUBDIR)/se_rs_shop.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V090 -P5
$(MID_SUBDIR)/se_ice_crack.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P4
$(MID_SUBDIR)/se_ice_stairs.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P4
$(MID_SUBDIR)/se_ice_break.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4
$(MID_SUBDIR)/se_fall.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_save.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V080 -P5
$(MID_SUBDIR)/se_success.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V080 -P4
$(MID_SUBDIR)/se_select.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V080 -P5
$(MID_SUBDIR)/se_ball_trade.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5
$(MID_SUBDIR)/se_thunderstorm.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V080 -P2
$(MID_SUBDIR)/se_thunderstorm_stop.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V080 -P2
$(MID_SUBDIR)/se_thunder.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P3
$(MID_SUBDIR)/se_thunder2.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P3
$(MID_SUBDIR)/se_rain.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V080 -P2
$(MID_SUBDIR)/se_rain_stop.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V080 -P2
$(MID_SUBDIR)/se_downpour.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P2
$(MID_SUBDIR)/se_downpour_stop.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P2
$(MID_SUBDIR)/se_orb.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P5
$(MID_SUBDIR)/se_egg_hatch.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V120 -P5
$(MID_SUBDIR)/se_roulette_ball.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P2
$(MID_SUBDIR)/se_roulette_ball2.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P2
$(MID_SUBDIR)/se_ball_tray_exit.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5
$(MID_SUBDIR)/se_ball_tray_ball.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P5
$(MID_SUBDIR)/se_ball_tray_enter.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P5
$(MID_SUBDIR)/se_click.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P4
$(MID_SUBDIR)/se_warp_in.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V090 -P4
$(MID_SUBDIR)/se_warp_out.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V090 -P4
$(MID_SUBDIR)/se_note_a.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_note_b.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_note_c.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_note_c_high.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_note_d.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_mud_ball.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_note_e.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_note_f.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_note_g.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_breakable_door.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_truck_door.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_truck_unload.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -P4
$(MID_SUBDIR)/se_truck_move.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -P4
$(MID_SUBDIR)/se_truck_stop.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -P4
$(MID_SUBDIR)/se_repel.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -V090 -P4
$(MID_SUBDIR)/se_m_double_slap.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_m_comet_punch.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V120 -P4
$(MID_SUBDIR)/se_m_pay_day.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V095 -P4
$(MID_SUBDIR)/se_m_fire_punch.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_m_scratch.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_m_vicegrip.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_m_razor_wind.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_m_razor_wind2.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P4
$(MID_SUBDIR)/se_m_swords_dance.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4
$(MID_SUBDIR)/se_m_cut.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V120 -P4
$(MID_SUBDIR)/se_m_gust.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_m_gust2.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_m_wing_attack.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V105 -P4
$(MID_SUBDIR)/se_m_fly.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_m_bind.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4
$(MID_SUBDIR)/se_m_mega_kick.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P4
$(MID_SUBDIR)/se_m_mega_kick2.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_m_jump_kick.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_m_sand_attack.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_m_headbutt.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_m_horn_attack.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_m_take_down.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V105 -P4
$(MID_SUBDIR)/se_m_tail_whip.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_m_leer.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4
$(MID_SUBDIR)/se_dex_search.s: %.s: %.mid
$(MID) $< $@ -E -R$(STD_REVERB) -G127 -v100 -P5
+275
View File
@@ -0,0 +1,275 @@
mus_berry_pick.mid: -E -R50 -G132 -V090
mus_caught_intro.mid: -E -R50 -G179 -V094 -P5
mus_caught.mid: -E -R50 -G170 -V100
mus_celadon.mid: -E -R50 -G168 -V070
mus_cinnabar.mid: -E -R50 -G138 -V090
mus_credits.mid: -E -R50 -G149 -V090
mus_cycling.mid: -E -R50 -G141 -V090
mus_dex_rating.mid: -E -R50 -G175 -V070 -P5
mus_dummy.mid: -E -R40
mus_encounter_boy.mid: -E -R50 -G144 -V090
mus_encounter_deoxys.mid: -E -R50 -G184 -V079
mus_encounter_girl.mid: -E -R50 -G143 -V051
mus_encounter_gym_leader.mid: -E -R50 -G144 -V090
mus_encounter_rival.mid: -E -R50 -G174 -V079
mus_encounter_rocket.mid: -E -R50 -G142 -V096
mus_evolution_intro.mid: -E -R50 -G009 -V080 -P1
mus_evolution.mid: -E -R50 -G009 -V080 -P1
mus_evolved.mid: -E -R50 -G008 -V090 -P5
mus_follow_me.mid: -E -R50 -G131 -V068
mus_fuchsia.mid: -E -R50 -G167 -V090
mus_game_corner.mid: -E -R50 -G132 -V090
mus_game_freak.mid: -E -R50 -G181 -V075
mus_gym.mid: -E -R50 -G134 -V090
mus_hall_of_fame.mid: -E -R50 -G145 -V079
mus_heal_unused.mid: -E -R50 -G140 -V090
mus_heal.mid: -E -R50 -G008 -V090 -P5
mus_intro_fight.mid: -E -R50 -G136 -V090
mus_jigglypuff.mid: -E -R50 -G135 -V068 -P5
mus_lavender.mid: -E -R50 -G139 -V090
mus_level_up.mid: -E -R50 -G008 -V090 -P5
mus_move_deleted.mid: -E -R50 -G008 -V090 -P5
mus_mt_moon.mid: -E -R50 -G147 -V090
mus_mystery_gift.mid: -E -R50 -G183 -V100
mus_net_center.mid: -E -R50 -G162 -V096
mus_new_game_exit.mid: -E -R50 -G182 -V088
mus_new_game_instruct.mid: -E -R50 -G182 -V085
mus_new_game_intro.mid: -E -R50 -G182 -V088
mus_oak_lab.mid: -E -R50 -G160 -V075
mus_oak.mid: -E -R50 -G161 -V086
mus_obtain_badge.mid: -E -R50 -G008 -V090 -P5
mus_obtain_berry.mid: -E -R50 -G008 -V090 -P5
mus_obtain_item.mid: -E -R50 -G008 -V090 -P5
mus_obtain_key_item.mid: -E -R50 -G178 -V077 -P5
mus_obtain_tmhm.mid: -E -R50 -G008 -V090 -P5
mus_pallet.mid: -E -R50 -G159 -V100
mus_pewter.mid: -E -R50 -G173 -V084
mus_photo.mid: -E -R50 -G180 -V100 -P5
mus_poke_center.mid: -E -R50 -G162 -V096
mus_poke_flute.mid: -E -R50 -G165 -V048 -P5
mus_poke_jump.mid: -E -R50 -G132 -V090
mus_poke_mansion.mid: -E -R50 -G148 -V090
mus_poke_tower.mid: -E -R50 -G165 -V090
mus_rival_exit.mid: -E -R50 -G174 -V079
mus_rocket_hideout.mid: -E -R50 -G133 -V090
mus_route1.mid: -E -R50 -G150 -V079
mus_route11.mid: -E -R50 -G153 -V090
mus_route24.mid: -E -R50 -G151 -V086
mus_route3.mid: -E -R50 -G152 -V083
mus_rs_vs_gym_leader.mid: -E -R50 -G010 -V080
mus_rs_vs_trainer.mid: -E -R50 -G011 -V080 -P1
mus_school.mid: -E -R50 -G012 -V100 -P1
mus_sevii_123.mid: -E -R50 -G173 -V084
mus_sevii_45.mid: -E -R50 -G188 -V084
mus_sevii_67.mid: -E -R50 -G189 -V084
mus_sevii_cave.mid: -E -R50 -G147 -V090
mus_sevii_dungeon.mid: -E -R50 -G146 -V090
mus_sevii_route.mid: -E -R50 -G187 -V080
mus_silph.mid: -E -R50 -G166 -V076
mus_slots_jackpot.mid: -E -R50 -G008 -V100 -P5
mus_slots_win.mid: -E -R50 -G008 -V100 -P5
mus_slow_pallet.mid: -E -R50 -G159 -V092
mus_ss_anne.mid: -E -R50 -G163 -V090
mus_surf.mid: -E -R50 -G164 -V071
mus_teachy_tv_menu.mid: -E -R50 -G186 -V059
mus_teachy_tv_show.mid: -E -R50 -G131 -V068
mus_title.mid: -E -R50 -G137 -V090
mus_too_bad.mid: -E -R50 -G008 -V090 -P5
mus_trainer_tower.mid: -E -R50 -G134 -V090
mus_union_room.mid: -E -R50 -G132 -V090
mus_vermillion.mid: -E -R50 -G172 -V090
mus_victory_gym_leader.mid: -E -R50 -G171 -V090
mus_victory_road.mid: -E -R50 -G154 -V090
mus_victory_trainer.mid: -E -R50 -G169 -V089
mus_victory_wild.mid: -E -R50 -G170 -V090
mus_viridian_forest.mid: -E -R50 -G146 -V090
mus_vs_champion.mid: -E -R50 -G158 -V090
mus_vs_deoxys.mid: -E -R50 -G185 -V080
mus_vs_gym_leader.mid: -E -R50 -G155 -V090
mus_vs_legend.mid: -E -R50 -G157 -V090
mus_vs_mewtwo.mid: -E -R50 -G157 -V090
mus_vs_trainer.mid: -E -R50 -G156 -V090
mus_vs_wild.mid: -E -R50 -G157 -V090
ph_choice_blend.mid: -E -G130 -P4
ph_choice_held.mid: -E -G130 -P4
ph_choice_solo.mid: -E -G130 -P4
ph_cloth_blend.mid: -E -G130 -P4
ph_cloth_held.mid: -E -G130 -P4
ph_cloth_solo.mid: -E -G130 -P4
ph_cure_blend.mid: -E -G130 -P4
ph_cure_held.mid: -E -G130 -P4
ph_cure_solo.mid: -E -G130 -P4
ph_dress_blend.mid: -E -G130 -P4
ph_dress_held.mid: -E -G130 -P4
ph_dress_solo.mid: -E -G130 -P4
ph_face_blend.mid: -E -G130 -P4
ph_face_held.mid: -E -G130 -P4
ph_face_solo.mid: -E -G130 -P4
ph_fleece_blend.mid: -E -G130 -P4
ph_fleece_held.mid: -E -G130 -P4
ph_fleece_solo.mid: -E -G130 -P4
ph_foot_blend.mid: -E -G130 -P4
ph_foot_held.mid: -E -G130 -P4
ph_foot_solo.mid: -E -G130 -P4
ph_goat_blend.mid: -E -G130 -P4
ph_goat_held.mid: -E -G130 -P4
ph_goat_solo.mid: -E -G130 -P4
ph_goose_blend.mid: -E -G130 -P4
ph_goose_held.mid: -E -G130 -P4
ph_goose_solo.mid: -E -G130 -P4
ph_kit_blend.mid: -E -G130 -P4
ph_kit_held.mid: -E -G130 -P4
ph_kit_solo.mid: -E -G130 -P4
ph_lot_blend.mid: -E -G130 -P4
ph_lot_held.mid: -E -G130 -P4
ph_lot_solo.mid: -E -G130 -P4
ph_mouth_blend.mid: -E -G130 -P4
ph_mouth_held.mid: -E -G130 -P4
ph_mouth_solo.mid: -E -G130 -P4
ph_nurse_blend.mid: -E -G130 -P4
ph_nurse_held.mid: -E -G130 -P4
ph_nurse_solo.mid: -E -G130 -P4
ph_price_blend.mid: -E -G130 -P4
ph_price_held.mid: -E -G130 -P4
ph_price_solo.mid: -E -G130 -P4
ph_strut_blend.mid: -E -G130 -P4
ph_strut_held.mid: -E -G130 -P4
ph_strut_solo.mid: -E -G130 -P4
ph_thought_blend.mid: -E -G130 -P4
ph_thought_held.mid: -E -G130 -P4
ph_thought_solo.mid: -E -G130 -P4
ph_trap_blend.mid: -E -G130 -P4
ph_trap_held.mid: -E -G130 -P4
ph_trap_solo.mid: -E -G130 -P4
se_applause.mid: -E -R50 -G128 -V100 -P5
se_ball_bounce_1.mid: -E -R50 -G128 -V100 -P4
se_ball_bounce_2.mid: -E -R50 -G128 -V100 -P4
se_ball_bounce_3.mid: -E -R50 -G128 -V100 -P4
se_ball_bounce_4.mid: -E -R50 -G128 -V100 -P4
se_ball_open.mid: -E -R50 -G127 -V100 -P5
se_ball_throw.mid: -E -R50 -G128 -V120 -P5
se_ball_trade.mid: -E -R50 -G127 -V100 -P5
se_ball_tray_ball.mid: -E -R50 -G128 -V110 -P5
se_ball_tray_enter.mid: -E -R50 -G128 -V110 -P5
se_ball_tray_exit.mid: -E -R50 -G127 -V100 -P5
se_ball.mid: -E -R50 -G127 -V070 -P4
se_balloon_blue.mid: -E -R50 -G128 -V105 -P4
se_balloon_red.mid: -E -R50 -G128 -V105 -P4
se_balloon_yellow.mid: -E -R50 -G128 -V105 -P4
se_bang.mid: -E -R50 -G128 -V110 -P4
se_berry_blender.mid: -E -R50 -G128 -V090 -P4
se_bike_bell.mid: -E -R50 -G128 -V090 -P4
se_bike_hop.mid: -E -R50 -G127 -V090 -P4
se_boo.mid: -E -R50 -G127 -V110 -P4
se_breakable_door.mid: -E -R50 -G128 -V110 -P4
se_bridge_walk.mid: -E -R50 -G128 -V095 -P4
se_card.mid: -E -R50 -G127 -V100 -P4
se_click.mid: -E -R50 -G127 -V110 -P4
se_contest_condition_lose.mid: -E -R50 -G127 -V110 -P4
se_contest_curtain_fall.mid: -E -R50 -G128 -V070 -P5
se_contest_curtain_rise.mid: -E -R50 -G128 -V070 -P5
se_contest_heart.mid: -E -R50 -G128 -V090 -P5
se_contest_icon_change.mid: -E -R50 -G128 -V110 -P5
se_contest_icon_clear.mid: -E -R50 -G128 -V090 -P5
se_contest_mons_turn.mid: -E -R50 -G128 -V090 -P5
se_contest_place.mid: -E -R50 -G127 -V110 -P4
se_dex_search.mid: -E -R50 -G127 -v100 -P5
se_ding_dong.mid: -E -R50 -G127 -V090 -P5
se_door.mid: -E -R50 -G129 -V100 -P5
se_downpour_stop.mid: -E -R50 -G128 -V100 -P2
se_downpour.mid: -E -R50 -G128 -V100 -P2
se_effective.mid: -E -R50 -G127 -V110 -P5
se_egg_hatch.mid: -E -R50 -G128 -V120 -P5
se_elevator.mid: -E -R50 -G128 -V100 -P4
se_escalator.mid: -E -R50 -G128 -V100 -P4
se_exit.mid: -E -R50 -G127 -V120 -P5
se_exp_max.mid: -E -R50 -G128 -V094 -P5
se_exp.mid: -E -R50 -G128 -V080 -P5
se_failure.mid: -E -R50 -G127 -V120 -P4
se_faint.mid: -E -R50 -G127 -V110 -P5
se_fall.mid: -E -R50 -G128 -V110 -P4
se_field_poison.mid: -E -R50 -G127 -V110 -P5
se_flee.mid: -E -R50 -G127 -V090 -P5
se_fu_zaku.mid: -E -R50 -G127 -V120 -P4
se_glass_flute.mid: -E -R50 -G128 -V105 -P5
se_ice_break.mid: -E -R50 -G128 -V100 -P4
se_ice_crack.mid: -E -R50 -G127 -V100 -P4
se_ice_stairs.mid: -E -R50 -G128 -V090 -P4
se_intro_blast.mid: -E -R50 -G127 -V100 -P5
se_itemfinder.mid: -E -R50 -G127 -V090 -P5
se_lavaridge_fall_warp.mid: -E -R50 -G127 -P4
se_ledge.mid: -E -R50 -G127 -V100 -P4
se_low_health.mid: -E -R50 -G127 -V100 -P3
se_m_bind.mid: -E -R50 -G128 -V100 -P4
se_m_comet_punch.mid: -E -R50 -G128 -V120 -P4
se_m_cut.mid: -E -R50 -G128 -V120 -P4
se_m_double_slap.mid: -E -R50 -G128 -V110 -P4
se_m_fire_punch.mid: -E -R50 -G128 -V110 -P4
se_m_fly.mid: -E -R50 -G128 -V110 -P4
se_m_gust.mid: -E -R50 -G128 -V110 -P4
se_m_gust2.mid: -E -R50 -G128 -V110 -P4
se_m_headbutt.mid: -E -R50 -G128 -V110 -P4
se_m_horn_attack.mid: -E -R50 -G128 -V110 -P4
se_m_jump_kick.mid: -E -R50 -G128 -V110 -P4
se_m_leer.mid: -E -R50 -G128 -V110 -P4
se_m_mega_kick.mid: -E -R50 -G128 -V090 -P4
se_m_mega_kick2.mid: -E -R50 -G128 -V110 -P4
se_m_pay_day.mid: -E -R50 -G128 -V095 -P4
se_m_razor_wind.mid: -E -R50 -G128 -V110 -P4
se_m_razor_wind2.mid: -E -R50 -G128 -V090 -P4
se_m_sand_attack.mid: -E -R50 -G128 -V110 -P4
se_m_scratch.mid: -E -R50 -G128 -V110 -P4
se_m_swords_dance.mid: -E -R50 -G128 -V100 -P4
se_m_tail_whip.mid: -E -R50 -G128 -V110 -P4
se_m_take_down.mid: -E -R50 -G128 -V105 -P4
se_m_vicegrip.mid: -E -R50 -G128 -V110 -P4
se_m_wing_attack.mid: -E -R50 -G128 -V105 -P4
se_mud_ball.mid: -E -R50 -G128 -V110 -P4
se_mugshot.mid: -E -R50 -G128 -V090 -P5
se_not_effective.mid: -E -R50 -G127 -V110 -P5
se_note_a.mid: -E -R50 -G128 -V110 -P4
se_note_b.mid: -E -R50 -G128 -V110 -P4
se_note_c_high.mid: -E -R50 -G128 -V110 -P4
se_note_c.mid: -E -R50 -G128 -V110 -P4
se_note_d.mid: -E -R50 -G128 -V110 -P4
se_note_e.mid: -E -R50 -G128 -V110 -P4
se_note_f.mid: -E -R50 -G128 -V110 -P4
se_note_g.mid: -E -R50 -G128 -V110 -P4
se_orb.mid: -E -R50 -G128 -V100 -P5
se_pc_login.mid: -E -R50 -G127 -V100 -P5
se_pc_off.mid: -E -R50 -G127 -V100 -P5
se_pc_on.mid: -E -R50 -G127 -V100 -P5
se_pin.mid: -E -R50 -G127 -V060 -P4
se_pokenav_off.mid: -E -R50 -G127 -V100 -P5
se_pokenav_on.mid: -E -R50 -G127 -V100 -P5
se_puddle.mid: -E -R50 -G128 -V020 -P4
se_rain_stop.mid: -E -R50 -G128 -V080 -P2
se_rain.mid: -E -R50 -G128 -V080 -P2
se_repel.mid: -E -R50 -G127 -V090 -P4
se_rotating_gate.mid: -E -R50 -G128 -V090 -P4
se_roulette_ball.mid: -E -R50 -G128 -V110 -P2
se_roulette_ball2.mid: -E -R50 -G128 -V110 -P2
se_rs_door.mid: -E -R50 -G127 -V080 -P5
se_rs_shop.mid: -E -R50 -G127 -V090 -P5
se_save.mid: -E -R50 -G128 -V080 -P5
se_select.mid: -E -R50 -G127 -V080 -P5
se_shiny.mid: -E -R50 -G128 -V095 -P5
se_ship.mid: -E -R50 -G127 -V075 -P4
se_sliding_door.mid: -E -R50 -G128 -V095 -P4
se_success.mid: -E -R50 -G127 -V080 -P4
se_super_effective.mid: -E -R50 -G127 -V110 -P5
se_switch.mid: -E -R50 -G127 -V100 -P4
se_taillow_wing_flap.mid: -E -R50 -G128 -V105 -P5
se_thunder.mid: -E -R50 -G128 -V110 -P3
se_thunder2.mid: -E -R50 -G128 -V110 -P3
se_thunderstorm_stop.mid: -E -R50 -G128 -V080 -P2
se_thunderstorm.mid: -E -R50 -G128 -V080 -P2
se_truck_door.mid: -E -R50 -G128 -V110 -P4
se_truck_move.mid: -E -R50 -G128 -P4
se_truck_stop.mid: -E -R50 -G128 -P4
se_truck_unload.mid: -E -R50 -G127 -P4
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
+20 -20
View File
@@ -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]);
}
+9 -3
View File
@@ -1,4 +1,4 @@
CC = gcc
CC ?= gcc
CFLAGS = -Wall -Wextra -Wno-switch -Werror -std=c11 -O2
@@ -6,12 +6,18 @@ LIBS = -lm
SRCS = main.c extended.c
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
.PHONY: all clean
all: aif2pcm
all: aif2pcm$(EXE)
@:
aif2pcm: $(SRCS)
aif2pcm$(EXE): $(SRCS)
$(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) $(LIBS)
clean:
+80 -23
View File
@@ -51,8 +51,12 @@ do \
typedef struct {
unsigned long num_samples;
uint8_t *samples;
union {
uint8_t *samples8;
uint16_t *samples16;
};
uint8_t midi_note;
uint8_t sample_size;
bool has_loop;
unsigned long loop_offset;
double sample_rate;
@@ -208,11 +212,11 @@ void read_aif(struct Bytes *aif, AifData *aif_data)
num_sample_frames |= (aif->data[pos++] << 8);
num_sample_frames |= (uint8_t)aif->data[pos++];
short sample_size = (aif->data[pos++] << 8);
sample_size |= (uint8_t)aif->data[pos++];
if (sample_size != 8)
aif_data->sample_size = (aif->data[pos++] << 8);
aif_data->sample_size |= (uint8_t)aif->data[pos++];
if (aif_data->sample_size != 8 && aif_data->sample_size != 16)
{
FATAL_ERROR("sampleSize (%d) in the COMM Chunk must be 8!\n", sample_size);
FATAL_ERROR("sampleSize (%d) in the COMM Chunk must be 8 or 16!\n", aif_data->sample_size);
}
double sample_rate = ieee754_read_extended((uint8_t*)(aif->data + pos));
@@ -234,7 +238,7 @@ void read_aif(struct Bytes *aif, AifData *aif_data)
{
FATAL_ERROR("More than one MARK Chunk in file!\n");
}
markers = calloc(num_markers, sizeof(struct Marker));
// Read each marker.
@@ -285,7 +289,7 @@ void read_aif(struct Bytes *aif, AifData *aif_data)
// Skip NoLooping sustain loop.
pos += 4;
}
// Skip release loop, we don't need it.
pos += 6;
}
@@ -295,11 +299,28 @@ void read_aif(struct Bytes *aif, AifData *aif_data)
pos += 8;
unsigned long num_samples = chunk_size - 8;
uint8_t *sample_data = (uint8_t *)malloc(num_samples * sizeof(uint8_t));
memcpy(sample_data, &aif->data[pos], num_samples);
if (aif_data->sample_size == 8)
{
uint8_t *sample_data = (uint8_t *)malloc(num_samples * sizeof(uint8_t));
memcpy(sample_data, &aif->data[pos], num_samples);
aif_data->samples = sample_data;
aif_data->real_num_samples = num_samples;
aif_data->samples8 = sample_data;
aif_data->real_num_samples = num_samples;
}
else
{
uint16_t *sample_data = (uint16_t *)malloc(num_samples * sizeof(uint16_t));
uint16_t *sample_data_swapped = (uint16_t *)malloc(num_samples * sizeof(uint16_t));
memcpy(sample_data, &aif->data[pos], num_samples);
for (long unsigned i = 0; i < num_samples; i++)
{
sample_data_swapped[i] = __builtin_bswap16(sample_data[i]);
}
aif_data->samples16 = sample_data_swapped;
aif_data->real_num_samples = num_samples;
free(sample_data);
}
pos += chunk_size - 8;
}
else
@@ -308,12 +329,12 @@ void read_aif(struct Bytes *aif, AifData *aif_data)
pos += chunk_size;
}
}
if (markers)
{
// Resolve loop points.
struct Marker *cur_marker = markers;
// Grab loop start point.
for (int i = 0; i < num_markers; i++, cur_marker++)
{
@@ -351,6 +372,12 @@ const int gDeltaEncodingTable[] = {
-64, -49, -36, -25, -16, -9, -4, -1,
};
#define POSITIVE_DELTAS_START 0
#define POSITIVE_DELTAS_END 8
#define NEGATIVE_DELTAS_START 8
#define NEGATIVE_DELTAS_END 16
struct Bytes *delta_decompress(struct Bytes *delta, unsigned int expected_length)
{
struct Bytes *pcm = malloc(sizeof(struct Bytes));
@@ -418,15 +445,32 @@ struct Bytes *delta_decompress(struct Bytes *delta, unsigned int expected_length
return pcm;
}
#define U8_TO_S8(value) ((value) < 128 ? (value) : (value) - 256)
#define ABS(value) ((value) >= 0 ? (value) : -(value))
int get_delta_index(uint8_t sample, uint8_t prev_sample)
{
int best_error = INT_MAX;
int best_index = -1;
int delta_table_start_index;
int delta_table_end_index;
int sample_signed = U8_TO_S8(sample);
int prev_sample_signed = U8_TO_S8(prev_sample);
for (int i = 0; i < 16; i++)
// if we're going up (or equal), only choose positive deltas
if (prev_sample_signed <= sample_signed) {
delta_table_start_index = POSITIVE_DELTAS_START;
delta_table_end_index = POSITIVE_DELTAS_END;
} else {
delta_table_start_index = NEGATIVE_DELTAS_START;
delta_table_end_index = NEGATIVE_DELTAS_END;
}
for (int i = delta_table_start_index; i < delta_table_end_index; i++)
{
uint8_t new_sample = prev_sample + gDeltaEncodingTable[i];
int error = sample > new_sample ? sample - new_sample : new_sample - sample;
int new_sample_signed = U8_TO_S8(new_sample);
int error = ABS(new_sample_signed - sample_signed);
if (error < best_error)
{
@@ -527,9 +571,22 @@ do { \
void aif2pcm(const char *aif_filename, const char *pcm_filename, bool compress)
{
struct Bytes *aif = read_bytearray(aif_filename);
AifData aif_data = {0,0,0,0,0,0,0};
AifData aif_data = {0};
read_aif(aif, &aif_data);
// Convert 16-bit to 8-bit if necessary
if (aif_data.sample_size == 16)
{
aif_data.real_num_samples /= 2;
uint8_t *converted_samples = malloc(aif_data.real_num_samples * sizeof(uint8_t));
for (unsigned long i = 0; i < aif_data.real_num_samples; i++)
{
converted_samples[i] = aif_data.samples16[i] >> 8;
}
free(aif_data.samples16);
aif_data.samples8 = converted_samples;
}
int header_size = 0x10;
struct Bytes *pcm;
struct Bytes output = {0,0};
@@ -537,7 +594,7 @@ void aif2pcm(const char *aif_filename, const char *pcm_filename, bool compress)
if (compress)
{
struct Bytes *input = malloc(sizeof(struct Bytes));
input->data = aif_data.samples;
input->data = aif_data.samples8;
input->length = aif_data.real_num_samples;
pcm = delta_compress(input);
free(input);
@@ -545,7 +602,7 @@ void aif2pcm(const char *aif_filename, const char *pcm_filename, bool compress)
else
{
pcm = malloc(sizeof(struct Bytes));
pcm->data = aif_data.samples;
pcm->data = aif_data.samples8;
pcm->length = aif_data.real_num_samples;
}
output.length = header_size + pcm->length;
@@ -568,7 +625,7 @@ void aif2pcm(const char *aif_filename, const char *pcm_filename, bool compress)
free(aif);
free(pcm);
free(output.data);
free(aif_data.samples);
free(aif_data.samples8);
}
// Reads a .pcm file containing an array of 8-bit samples and produces an .aif file.
@@ -608,8 +665,8 @@ void pcm2aif(const char *pcm_filename, const char *aif_filename, uint32_t base_n
pcm->data += 0x10;
}
aif_data->samples = malloc(pcm->length);
memcpy(aif_data->samples, pcm->data, pcm->length);
aif_data->samples8 = malloc(pcm->length);
memcpy(aif_data->samples8, pcm->data, pcm->length);
struct Bytes *aif = malloc(sizeof(struct Bytes));
aif->length = 54 + 60 + pcm->length;
@@ -796,14 +853,14 @@ void pcm2aif(const char *pcm_filename, const char *aif_filename, uint32_t base_n
// Sound Data Chunk soundData
for (unsigned int i = 0; i < aif_data->loop_offset; i++)
{
aif->data[pos++] = aif_data->samples[i];
aif->data[pos++] = aif_data->samples8[i];
}
int j = 0;
for (unsigned int i = aif_data->loop_offset; i < pcm->length; i++)
{
int pcm_index = aif_data->loop_offset + (j++ % (pcm->length - aif_data->loop_offset));
aif->data[pos++] = aif_data->samples[pcm_index];
aif->data[pos++] = aif_data->samples8[pcm_index];
}
aif->length = pos;
+9 -3
View File
@@ -1,4 +1,4 @@
CC = gcc
CC ?= gcc
CFLAGS = -Wall -Wextra -Werror -std=c11 -O2
@@ -6,10 +6,16 @@ CFLAGS = -Wall -Wextra -Werror -std=c11 -O2
SRCS = bin2c.c
all: bin2c
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
all: bin2c$(EXE)
@:
bin2c: $(SRCS)
bin2c$(EXE): $(SRCS)
$(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS)
clean:
+9 -3
View File
@@ -1,12 +1,18 @@
CC = gcc
CC ?= gcc
.PHONY: all clean
SRCS = gbafix.c
all: gbafix
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
all: gbafix$(EXE)
@:
gbafix: $(SRCS)
gbafix$(EXE): $(SRCS)
$(CC) $(SRCS) -o $@ $(LDFLAGS)
clean:
+10 -4
View File
@@ -1,4 +1,4 @@
CC = gcc
CC ?= gcc
CFLAGS = -Wall -Wextra -Werror -Wno-sign-compare -std=c11 -O3 -flto -DPNG_SKIP_SETJMP_CHECK
CFLAGS += $(shell pkg-config --cflags libpng)
@@ -8,15 +8,21 @@ LDFLAGS += $(shell pkg-config --libs-only-L libpng)
SRCS = main.c convert_png.c gfx.c jasc_pal.c lz.c rl.c util.c font.c huff.c
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
.PHONY: all clean
all: gbagfx
all: gbagfx$(EXE)
@:
gbagfx-debug: $(SRCS) convert_png.h gfx.h global.h jasc_pal.h lz.h rl.h util.h font.h
gbagfx-debug$(EXE): $(SRCS) convert_png.h gfx.h global.h jasc_pal.h lz.h rl.h util.h font.h
$(CC) $(CFLAGS) -DDEBUG $(SRCS) -o $@ $(LDFLAGS) $(LIBS)
gbagfx: $(SRCS) convert_png.h gfx.h global.h jasc_pal.h lz.h rl.h util.h font.h
gbagfx$(EXE): $(SRCS) convert_png.h gfx.h global.h jasc_pal.h lz.h rl.h util.h font.h
$(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) $(LIBS)
clean:
+1 -2
View File
@@ -62,7 +62,7 @@ static unsigned char *ConvertBitDepth(unsigned char *src, int srcBitDepth, int d
for (j = 8 - srcBitDepth; j >= 0; j -= srcBitDepth)
{
unsigned char pixel = (srcByte >> j) % (1 << destBitDepth);
unsigned char pixel = ((srcByte >> j) % (1 << srcBitDepth)) % (1 << destBitDepth);
*dest |= pixel << destBit;
destBit -= destBitDepth;
if (destBit < 0)
@@ -130,7 +130,6 @@ void ReadPng(char *path, struct Image *image)
FATAL_ERROR("Bit depth of image must be 1, 2, 4, or 8.\n");
image->pixels = ConvertBitDepth(image->pixels, bit_depth, image->bitDepth, image->width * image->height);
free(src);
image->bitDepth = bit_depth;
}
}
+77 -15
View File
@@ -204,6 +204,18 @@ static void ConvertToTiles8Bpp(unsigned char *src, unsigned char *dest, int numT
}
}
// For untiled, plain images
static void CopyPlainPixels(unsigned char *src, unsigned char *dest, int size, int dataWidth, bool invertColors)
{
if (dataWidth == 0) return;
for (int i = 0; i < size; i += dataWidth) {
for (int j = dataWidth; j > 0; j--) {
unsigned char pixels = src[i + j - 1];
*dest++ = invertColors ? ~pixels : pixels;
}
}
}
static void DecodeAffineTilemap(unsigned char *input, unsigned char *output, unsigned char *tilemap, int tileSize, int numTiles)
{
for (int i = 0; i < numTiles; i++)
@@ -345,9 +357,9 @@ static unsigned char *DecodeTilemap(unsigned char *tiles, struct Tilemap *tilema
return decoded;
}
void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors)
void ReadTileImage(char *path, int tilesWidth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors)
{
int tileSize = bitDepth * 8;
int tileSize = image->bitDepth * 8;
int fileSize;
unsigned char *buffer = ReadWholeFile(path, &fileSize);
@@ -355,26 +367,25 @@ void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int
int numTiles = fileSize / tileSize;
if (image->tilemap.data.affine != NULL)
{
int outTileSize = (bitDepth == 4 && image->palette.numColors > 16) ? 64 : tileSize;
buffer = DecodeTilemap(buffer, &image->tilemap, &numTiles, image->isAffine, tileSize, outTileSize, bitDepth);
int outTileSize = (image->bitDepth == 4 && image->palette.numColors > 16) ? 64 : tileSize;
buffer = DecodeTilemap(buffer, &image->tilemap, &numTiles, image->isAffine, tileSize, outTileSize, image->bitDepth);
if (outTileSize == 64)
{
tileSize = 64;
image->bitDepth = bitDepth = 8;
image->bitDepth = 8;
}
}
int tilesHeight = (numTiles + tilesWidth - 1) / tilesWidth;
if (tilesWidth % metatileWidth != 0)
FATAL_ERROR("The width in tiles (%d) isn't a multiple of the specified metatile width (%d)", tilesWidth, metatileWidth);
FATAL_ERROR("The width in tiles (%d) isn't a multiple of the specified metatile width (%d)\n", tilesWidth, metatileWidth);
if (tilesHeight % metatileHeight != 0)
FATAL_ERROR("The height in tiles (%d) isn't a multiple of the specified metatile height (%d)", tilesHeight, metatileHeight);
FATAL_ERROR("The height in tiles (%d) isn't a multiple of the specified metatile height (%d)\n", tilesHeight, metatileHeight);
image->width = tilesWidth * 8;
image->height = tilesHeight * 8;
image->bitDepth = bitDepth;
image->pixels = calloc(tilesWidth * tilesHeight, tileSize);
if (image->pixels == NULL)
@@ -382,7 +393,7 @@ void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int
int metatilesWide = tilesWidth / metatileWidth;
switch (bitDepth) {
switch (image->bitDepth) {
case 1:
ConvertFromTiles1Bpp(buffer, image->pixels, numTiles, metatilesWide, metatileWidth, metatileHeight, invertColors);
break;
@@ -397,9 +408,9 @@ void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int
free(buffer);
}
void WriteImage(char *path, enum NumTilesMode numTilesMode, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors)
void WriteTileImage(char *path, enum NumTilesMode numTilesMode, int numTiles, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors)
{
int tileSize = bitDepth * 8;
int tileSize = image->bitDepth * 8;
if (image->width % 8 != 0)
FATAL_ERROR("The width in pixels (%d) isn't a multiple of 8.\n", image->width);
@@ -411,10 +422,10 @@ void WriteImage(char *path, enum NumTilesMode numTilesMode, int numTiles, int bi
int tilesHeight = image->height / 8;
if (tilesWidth % metatileWidth != 0)
FATAL_ERROR("The width in tiles (%d) isn't a multiple of the specified metatile width (%d)", tilesWidth, metatileWidth);
FATAL_ERROR("The width in tiles (%d) isn't a multiple of the specified metatile width (%d)\n", tilesWidth, metatileWidth);
if (tilesHeight % metatileHeight != 0)
FATAL_ERROR("The height in tiles (%d) isn't a multiple of the specified metatile height (%d)", tilesHeight, metatileHeight);
FATAL_ERROR("The height in tiles (%d) isn't a multiple of the specified metatile height (%d)\n", tilesHeight, metatileHeight);
int maxNumTiles = tilesWidth * tilesHeight;
@@ -432,7 +443,7 @@ void WriteImage(char *path, enum NumTilesMode numTilesMode, int numTiles, int bi
int metatilesWide = tilesWidth / metatileWidth;
switch (bitDepth) {
switch (image->bitDepth) {
case 1:
ConvertToTiles1Bpp(image->pixels, buffer, maxNumTiles, metatilesWide, metatileWidth, metatileHeight, invertColors);
break;
@@ -468,9 +479,60 @@ void WriteImage(char *path, enum NumTilesMode numTilesMode, int numTiles, int bi
free(buffer);
}
void ReadPlainImage(char *path, int dataWidth, struct Image *image, bool invertColors)
{
int fileSize;
unsigned char *buffer = ReadWholeFile(path, &fileSize);
if (fileSize % dataWidth != 0)
FATAL_ERROR("The image data size (%d) isn't a multiple of the specified data width %d.\n", fileSize, dataWidth);
// png scanlines have wasted bits if they do not align to byte boundaries.
// pngs misaligned in this way are not currently handled.
int pixelsPerByte = 8 / image->bitDepth;
if (image->width % pixelsPerByte != 0)
FATAL_ERROR("The width in pixels (%d) isn't a multiple of %d.\n", image->width, pixelsPerByte);
int numPixels = fileSize * pixelsPerByte;
image->height = (numPixels + image->width - 1) / image->width;
image->pixels = calloc(image->width * image->height * image->bitDepth / 8, 1);
if (image->pixels == NULL)
FATAL_ERROR("Failed to allocate memory for pixels.\n");
CopyPlainPixels(buffer, image->pixels, fileSize, dataWidth, invertColors);
free(buffer);
}
void WritePlainImage(char *path, int dataWidth, struct Image *image, bool invertColors)
{
int bufferSize = image->width * image->height * image->bitDepth / 8;
if (bufferSize % dataWidth != 0)
FATAL_ERROR("The image data size (%d) isn't a multiple of the specified data width %d.\n", bufferSize, dataWidth);
// png scanlines have wasted bits if they do not align to byte boundaries.
// pngs misaligned in this way are not currently handled.
int pixelsPerByte = 8 / image->bitDepth;
if (image->width % pixelsPerByte != 0)
FATAL_ERROR("The width in pixels (%d) isn't a multiple of %d.\n", image->width, pixelsPerByte);
unsigned char *buffer = malloc(bufferSize);
if (buffer == NULL)
FATAL_ERROR("Failed to allocate memory for pixels.\n");
CopyPlainPixels(image->pixels, buffer, bufferSize, dataWidth, invertColors);
WriteWholeFile(path, buffer, bufferSize);
free(buffer);
}
void FreeImage(struct Image *image)
{
if (image->tilemap.data.affine != NULL)
if (image->tilemap.data.affine != NULL)
{
free(image->tilemap.data.affine);
image->tilemap.data.affine = NULL;
+4 -2
View File
@@ -50,8 +50,10 @@ enum NumTilesMode {
NUM_TILES_ERROR,
};
void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors);
void WriteImage(char *path, enum NumTilesMode numTilesMode, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors);
void ReadTileImage(char *path, int tilesWidth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors);
void WriteTileImage(char *path, enum NumTilesMode numTilesMode, int numTiles, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors);
void ReadPlainImage(char *path, int dataWidth, struct Image *image, bool invertColors);
void WritePlainImage(char *path, int dataWidth, struct Image *image, bool invertColors);
void FreeImage(struct Image *image);
void ReadGbaPalette(char *path, struct Palette *palette);
void WriteGbaPalette(char *path, struct Palette *palette);
+6 -2
View File
@@ -46,10 +46,14 @@ void ReadJascPaletteLine(FILE *fp, char *line)
}
if (c == '\n')
FATAL_ERROR("LF line endings aren't supported.\n");
{
line[length] = 0;
return;
}
if (c == EOF)
FATAL_ERROR("Unexpected EOF. No CRLF at end of file.\n");
FATAL_ERROR("Unexpected EOF. No LF or CRLF at end of file.\n");
if (c == 0)
FATAL_ERROR("NUL character in file.\n");
+58 -14
View File
@@ -25,6 +25,9 @@ void ConvertGbaToPng(char *inputPath, char *outputPath, struct GbaToPngOptions *
{
struct Image image;
image.bitDepth = options->bitDepth;
image.tilemap.data.affine = NULL;
if (options->paletteFilePath != NULL)
{
char *paletteFileExtension = GetFileExtensionAfterDot(options->paletteFilePath);
@@ -45,22 +48,25 @@ void ConvertGbaToPng(char *inputPath, char *outputPath, struct GbaToPngOptions *
image.hasPalette = false;
}
if (options->tilemapFilePath != NULL)
if (options->isTiled)
{
int fileSize;
image.tilemap.data.affine = ReadWholeFile(options->tilemapFilePath, &fileSize);
if (options->isAffineMap && options->bitDepth != 8)
FATAL_ERROR("affine maps are necessarily 8bpp\n");
image.isAffine = options->isAffineMap;
image.tilemap.size = fileSize;
if (options->tilemapFilePath != NULL)
{
int fileSize;
image.tilemap.data.affine = ReadWholeFile(options->tilemapFilePath, &fileSize);
if (options->isAffineMap && options->bitDepth != 8)
FATAL_ERROR("affine maps are necessarily 8bpp\n");
image.isAffine = options->isAffineMap;
image.tilemap.size = fileSize;
}
ReadTileImage(inputPath, options->width, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette);
}
else
{
image.tilemap.data.affine = NULL;
image.width = options->width;
ReadPlainImage(inputPath, options->dataWidth, &image, !image.hasPalette);
}
ReadImage(inputPath, options->width, options->bitDepth, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette);
image.hasTransparency = options->hasTransparency;
WritePng(outputPath, &image);
@@ -77,7 +83,10 @@ void ConvertPngToGba(char *inputPath, char *outputPath, struct PngToGbaOptions *
ReadPng(inputPath, &image);
WriteImage(outputPath, options->numTilesMode, options->numTiles, options->bitDepth, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette);
if (options->isTiled)
WriteTileImage(outputPath, options->numTilesMode, options->numTiles, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette);
else
WritePlainImage(outputPath, options->dataWidth, &image, !image.hasPalette);
FreeImage(&image);
}
@@ -94,6 +103,8 @@ void HandleGbaToPngCommand(char *inputPath, char *outputPath, int argc, char **a
options.metatileHeight = 1;
options.tilemapFilePath = NULL;
options.isAffineMap = false;
options.isTiled = true;
options.dataWidth = 1;
for (int i = 3; i < argc; i++)
{
@@ -162,6 +173,22 @@ void HandleGbaToPngCommand(char *inputPath, char *outputPath, int argc, char **a
{
options.isAffineMap = true;
}
else if (strcmp(option, "-plain") == 0)
{
options.isTiled = false;
}
else if (strcmp(option, "-data_width") == 0)
{
if (i + 1 >= argc)
FATAL_ERROR("No data width value following \"-data_width\".\n");
i++;
if (!ParseNumber(argv[i], NULL, 10, &options.dataWidth))
FATAL_ERROR("Failed to parse data width.\n");
if (options.dataWidth < 1)
FATAL_ERROR("Data width must be positive.\n");
}
else
{
FATAL_ERROR("Unrecognized option \"%s\".\n", option);
@@ -177,15 +204,16 @@ void HandleGbaToPngCommand(char *inputPath, char *outputPath, int argc, char **a
void HandlePngToGbaCommand(char *inputPath, char *outputPath, int argc, char **argv)
{
char *outputFileExtension = GetFileExtensionAfterDot(outputPath);
int bitDepth = outputFileExtension[0] - '0';
struct PngToGbaOptions options;
options.numTilesMode = NUM_TILES_IGNORE;
options.numTiles = 0;
options.bitDepth = bitDepth;
options.bitDepth = outputFileExtension[0] - '0';
options.metatileWidth = 1;
options.metatileHeight = 1;
options.tilemapFilePath = NULL;
options.isAffineMap = false;
options.isTiled = true;
options.dataWidth = 1;
for (int i = 3; i < argc; i++)
{
@@ -236,6 +264,22 @@ void HandlePngToGbaCommand(char *inputPath, char *outputPath, int argc, char **a
if (options.metatileHeight < 1)
FATAL_ERROR("metatile height must be positive.\n");
}
else if (strcmp(option, "-plain") == 0)
{
options.isTiled = false;
}
else if (strcmp(option, "-data_width") == 0)
{
if (i + 1 >= argc)
FATAL_ERROR("No data width value following \"-data_width\".\n");
i++;
if (!ParseNumber(argv[i], NULL, 10, &options.dataWidth))
FATAL_ERROR("Failed to parse data width.\n");
if (options.dataWidth < 1)
FATAL_ERROR("Data width must be positive.\n");
}
else
{
FATAL_ERROR("Unrecognized option \"%s\".\n", option);
@@ -403,7 +447,7 @@ void HandleLZCompressCommand(char *inputPath, char *outputPath, int argc, char *
else if (strcmp(option, "-search") == 0)
{
if (i + 1 >= argc)
FATAL_ERROR("No size following \"-overflow\".\n");
FATAL_ERROR("No size following \"-search\".\n");
i++;
+4
View File
@@ -15,6 +15,8 @@ struct GbaToPngOptions {
int metatileHeight;
char *tilemapFilePath;
bool isAffineMap;
bool isTiled;
int dataWidth;
};
struct PngToGbaOptions {
@@ -25,6 +27,8 @@ struct PngToGbaOptions {
int metatileHeight;
char *tilemapFilePath;
bool isAffineMap;
bool isTiled;
int dataWidth;
};
#endif // OPTIONS_H
Regular → Executable
View File
Regular → Executable
+10 -4
View File
@@ -1,6 +1,6 @@
CXX := g++
CXX ?= g++
CXXFLAGS := -Wall -std=c++11 -O2
CXXFLAGS := -Wall -std=c++17 -O2
INCLUDES := -I .
@@ -8,12 +8,18 @@ SRCS := jsonproc.cpp
HEADERS := jsonproc.h inja.hpp nlohmann/json.hpp
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
.PHONY: all clean
all: jsonproc
all: jsonproc$(EXE)
@:
jsonproc: $(SRCS) $(HEADERS)
jsonproc$(EXE): $(SRCS) $(HEADERS)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SRCS) -o $@ $(LDFLAGS)
clean:
Regular → Executable
+2441 -3021
View File
File diff suppressed because it is too large Load Diff
Regular → Executable
+14 -4
View File
@@ -1,4 +1,6 @@
// jsonproc.cpp
// jsonproc converts JSON data to an output file based on an Inja template.
// https://github.com/pantor/inja
#include "jsonproc.h"
@@ -7,6 +9,9 @@
#include <string>
using std::string; using std::to_string;
#include <algorithm>
using std::replace_if;
#include <inja.hpp>
using namespace inja;
using json = nlohmann::json;
@@ -109,11 +114,16 @@ int main(int argc, char *argv[])
});
env.add_callback("cleanString", 1, [](Arguments& args) {
string badChars = ".'{} \n\t-_\u00e9";
string str = args.at(0)->get<string>();
str.erase(remove_if(str.begin(), str.end(), [&badChars](const char &c) {
return badChars.find(c) != std::string::npos;
}), str.end());
for (unsigned int i = 0; i < str.length(); i++) {
// This code is not Unicode aware, so UTF-8 is not easily parsable without introducing
// another library. Just filter out any non-alphanumeric characters for now.
// TODO: proper Unicode string normalization
if ((i == 0 && isdigit(str[i]))
|| !isalnum(str[i])) {
str[i] = '_';
}
}
return str;
});
Regular → Executable
View File
Regular → Executable
+10438 -9148
View File
File diff suppressed because it is too large Load Diff
+9 -3
View File
@@ -1,4 +1,4 @@
CXX := g++
CXX ?= g++
CXXFLAGS := -Wall -std=c++11 -O2
@@ -6,12 +6,18 @@ SRCS := json11.cpp mapjson.cpp
HEADERS := mapjson.h
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
.PHONY: all clean
all: mapjson
all: mapjson$(EXE)
@:
mapjson: $(SRCS) $(HEADERS)
mapjson$(EXE): $(SRCS) $(HEADERS)
$(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS)
clean:
+8 -9
View File
@@ -33,7 +33,6 @@ using std::vector;
using std::map;
using std::make_shared;
using std::initializer_list;
using std::move;
/* Helper for representing null - just a do-nothing struct, plus comparison
* operators so the helpers in JsonValue work. We can't use nullptr_t because
@@ -149,7 +148,7 @@ protected:
// Constructors
explicit Value(const T &value) : m_value(value) {}
explicit Value(T &&value) : m_value(move(value)) {}
explicit Value(T &&value) : m_value(std::move(value)) {}
// Get type tag
Json::Type type() const override {
@@ -196,7 +195,7 @@ class JsonString final : public Value<Json::STRING, string> {
const string &string_value() const override { return m_value; }
public:
explicit JsonString(const string &value) : Value(value) {}
explicit JsonString(string &&value) : Value(move(value)) {}
explicit JsonString(string &&value) : Value(std::move(value)) {}
};
class JsonArray final : public Value<Json::ARRAY, Json::array> {
@@ -204,7 +203,7 @@ class JsonArray final : public Value<Json::ARRAY, Json::array> {
const Json & operator[](size_t i) const override;
public:
explicit JsonArray(const Json::array &value) : Value(value) {}
explicit JsonArray(Json::array &&value) : Value(move(value)) {}
explicit JsonArray(Json::array &&value) : Value(std::move(value)) {}
};
class JsonObject final : public Value<Json::OBJECT, Json::object> {
@@ -212,7 +211,7 @@ class JsonObject final : public Value<Json::OBJECT, Json::object> {
const Json & operator[](const string &key) const override;
public:
explicit JsonObject(const Json::object &value) : Value(value) {}
explicit JsonObject(Json::object &&value) : Value(move(value)) {}
explicit JsonObject(Json::object &&value) : Value(std::move(value)) {}
};
class JsonNull final : public Value<Json::NUL, NullStruct> {
@@ -254,12 +253,12 @@ Json::Json(double value) : m_ptr(make_shared<JsonDouble>(value)) {
Json::Json(int value) : m_ptr(make_shared<JsonInt>(value)) {}
Json::Json(bool value) : m_ptr(value ? statics().t : statics().f) {}
Json::Json(const string &value) : m_ptr(make_shared<JsonString>(value)) {}
Json::Json(string &&value) : m_ptr(make_shared<JsonString>(move(value))) {}
Json::Json(string &&value) : m_ptr(make_shared<JsonString>(std::move(value))) {}
Json::Json(const char * value) : m_ptr(make_shared<JsonString>(value)) {}
Json::Json(const Json::array &values) : m_ptr(make_shared<JsonArray>(values)) {}
Json::Json(Json::array &&values) : m_ptr(make_shared<JsonArray>(move(values))) {}
Json::Json(Json::array &&values) : m_ptr(make_shared<JsonArray>(std::move(values))) {}
Json::Json(const Json::object &values) : m_ptr(make_shared<JsonObject>(values)) {}
Json::Json(Json::object &&values) : m_ptr(make_shared<JsonObject>(move(values))) {}
Json::Json(Json::object &&values) : m_ptr(make_shared<JsonObject>(std::move(values))) {}
/* * * * * * * * * * * * * * * * * * * *
* Accessors
@@ -357,7 +356,7 @@ struct JsonParser final {
* Mark this parse as failed.
*/
Json fail(string &&msg) {
return fail(move(msg), Json());
return fail(std::move(msg), Json());
}
template <typename T>
+67 -45
View File
@@ -30,6 +30,8 @@ using json11::Json;
#include "mapjson.h"
string version;
// System directory separator
string sep;
string read_text_file(string filepath) {
ifstream in_file(filepath);
@@ -330,13 +332,22 @@ string generate_map_events_text(Json map_data) {
return text.str();
}
string get_directory_name(string filename) {
size_t dir_pos = filename.find_last_of("/\\");
string strip_trailing_separator(string filename) {
if(filename.back() == '/' || filename.back() == '\\')
filename.pop_back();
return filename;
}
void infer_separator(string filename) {
size_t dir_pos = filename.find_last_of("/\\");
sep = filename[dir_pos];
}
string file_parent(string filename){
size_t dir_pos = filename.find_last_of("/\\");
return filename.substr(0, dir_pos + 1);
}
void process_map(string map_filepath, string layouts_filepath) {
void process_map(string map_filepath, string layouts_filepath, string output_dir) {
string mapdata_err, layouts_err;
string mapdata_json_text = read_text_file(map_filepath);
@@ -354,10 +365,10 @@ void process_map(string map_filepath, string layouts_filepath) {
string events_text = generate_map_events_text(map_data);
string connections_text = generate_map_connections_text(map_data);
string files_dir = get_directory_name(map_filepath);
write_text_file(files_dir + "header.inc", header_text);
write_text_file(files_dir + "events.inc", events_text);
write_text_file(files_dir + "connections.inc", connections_text);
string out_dir = strip_trailing_separator(output_dir).append(sep);
write_text_file(out_dir + "header.inc", header_text);
write_text_file(out_dir + "events.inc", events_text);
write_text_file(out_dir + "connections.inc", connections_text);
}
string generate_groups_text(Json groups_data) {
@@ -382,7 +393,7 @@ string generate_groups_text(Json groups_data) {
return text.str();
}
string generate_connections_text(Json groups_data) {
string generate_connections_text(Json groups_data, string include_path) {
vector<Json> map_names;
for (auto &group : groups_data["group_order"].array_items())
@@ -407,12 +418,12 @@ string generate_connections_text(Json groups_data) {
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n";
for (Json map_name : map_names)
text << "\t.include \"data/maps/" << json_to_string(map_name) << "/connections.inc\"\n";
text << "\t.include \"" << include_path << "/" << json_to_string(map_name) << "/connections.inc\"\n";
return text.str();
}
string generate_headers_text(Json groups_data) {
string generate_headers_text(Json groups_data, string include_path) {
vector<string> map_names;
for (auto &group : groups_data["group_order"].array_items())
@@ -424,12 +435,12 @@ string generate_headers_text(Json groups_data) {
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n";
for (string map_name : map_names)
text << "\t.include \"data/maps/" << map_name << "/header.inc\"\n";
text << "\t.include \"" << include_path << "/" << map_name << "/header.inc\"\n";
return text.str();
}
string generate_events_text(Json groups_data) {
string generate_events_text(Json groups_data, string include_path) {
vector<string> map_names;
for (auto &group : groups_data["group_order"].array_items())
@@ -438,17 +449,16 @@ string generate_events_text(Json groups_data) {
ostringstream text;
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n";
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from " << include_path << "/map_groups.json\n@\n\n";
for (string map_name : map_names)
text << "\t.include \"data/maps/" << map_name << "/events.inc\"\n";
text << "\t.include \"" << include_path << "/" << map_name << "/events.inc\"\n";
return text.str();
}
string generate_map_constants_text(string groups_filepath, Json groups_data) {
string file_dir = get_directory_name(groups_filepath);
char dir_separator = file_dir.back();
string file_dir = file_parent(groups_filepath) + sep;
ostringstream text;
@@ -466,7 +476,7 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) {
size_t max_length = 0;
for (auto &map_name : groups_data[groupName].array_items()) {
string map_filepath = file_dir + json_to_string(map_name) + dir_separator + "map.json";
string map_filepath = file_dir + json_to_string(map_name) + sep + "map.json";
string err_str;
Json map_data = Json::parse(read_text_file(map_filepath), err_str);
if (map_data == Json())
@@ -493,7 +503,11 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) {
return text.str();
}
void process_groups(string groups_filepath) {
// Output paths are directories with trailing path separators
void process_groups(string groups_filepath, string output_asm, string output_c) {
output_asm = strip_trailing_separator(output_asm); // Remove separator if existing.
output_c = strip_trailing_separator(output_c);
string err;
Json groups_data = Json::parse(read_text_file(groups_filepath), err);
@@ -501,19 +515,16 @@ void process_groups(string groups_filepath) {
FATAL_ERROR("%s\n", err.c_str());
string groups_text = generate_groups_text(groups_data);
string connections_text = generate_connections_text(groups_data);
string headers_text = generate_headers_text(groups_data);
string events_text = generate_events_text(groups_data);
string connections_text = generate_connections_text(groups_data, output_asm);
string headers_text = generate_headers_text(groups_data, output_asm);
string events_text = generate_events_text(groups_data, output_asm);
string map_header_text = generate_map_constants_text(groups_filepath, groups_data);
string file_dir = get_directory_name(groups_filepath);
char s = file_dir.back();
write_text_file(file_dir + "groups.inc", groups_text);
write_text_file(file_dir + "connections.inc", connections_text);
write_text_file(file_dir + "headers.inc", headers_text);
write_text_file(file_dir + "events.inc", events_text);
write_text_file(file_dir + ".." + s + ".." + s + "include" + s + "constants" + s + "map_groups.h", map_header_text);
write_text_file(output_asm + sep + "groups.inc", groups_text);
write_text_file(output_asm + sep + "connections.inc", connections_text);
write_text_file(output_asm + sep + "headers.inc", headers_text);
write_text_file(output_asm + sep + "events.inc", events_text);
write_text_file(output_c + sep + "map_groups.h", map_header_text);
}
string generate_layout_headers_text(Json layouts_data) {
@@ -586,7 +597,10 @@ string generate_layouts_constants_text(Json layouts_data) {
return text.str();
}
void process_layouts(string layouts_filepath) {
void process_layouts(string layouts_filepath, string output_asm, string output_c) {
output_asm = strip_trailing_separator(output_asm).append(sep);
output_c = strip_trailing_separator(output_c).append(sep);
string err;
Json layouts_data = Json::parse(read_text_file(layouts_filepath), err);
@@ -597,12 +611,9 @@ void process_layouts(string layouts_filepath) {
string layouts_table_text = generate_layouts_table_text(layouts_data);
string layouts_constants_text = generate_layouts_constants_text(layouts_data);
string file_dir = get_directory_name(layouts_filepath);
char s = file_dir.back();
write_text_file(file_dir + "layouts.inc", layout_headers_text);
write_text_file(file_dir + "layouts_table.inc", layouts_table_text);
write_text_file(file_dir + ".." + s + ".." + s + "include" + s + "constants" + s + "layouts.h", layouts_constants_text);
write_text_file(output_asm + "layouts.inc", layout_headers_text);
write_text_file(output_asm + "layouts_table.inc", layouts_table_text);
write_text_file(output_c + "layouts.h", layouts_constants_text);
}
int main(int argc, char *argv[]) {
@@ -620,29 +631,40 @@ int main(int argc, char *argv[]) {
FATAL_ERROR("ERROR: <mode> must be 'layouts', 'map', or 'groups'.\n");
if (mode == "map") {
if (argc != 5)
FATAL_ERROR("USAGE: mapjson map <game-version> <map_file> <layouts_file>\n");
if (argc != 6)
FATAL_ERROR("USAGE: mapjson map <game-version> <map_file> <layouts_file> <output_dir>\n");
infer_separator(argv[3]);
string filepath(argv[3]);
string layouts_filepath(argv[4]);
string output_dir(argv[5]);
process_map(filepath, layouts_filepath);
process_map(filepath, layouts_filepath, output_dir);
}
else if (mode == "groups") {
if (argc != 4)
FATAL_ERROR("USAGE: mapjson groups <game-version> <groups_file>\n");
if (argc != 6)
FATAL_ERROR("USAGE: mapjson groups <game-version> <groups_file> <output_asm_dir> <output_c_dir>\n");
infer_separator(argv[3]);
string filepath(argv[3]);
string output_asm(argv[4]);
string output_c(argv[5]);
process_groups(filepath);
process_groups(filepath, output_asm, output_c);
}
else if (mode == "layouts") {
if (argc != 4)
FATAL_ERROR("USAGE: mapjson layouts <game-version> <layouts_file>\n");
if (argc != 6)
FATAL_ERROR("USAGE: mapjson layouts <game-version> <layouts_file> <output_asm_dir> <output_c_dir>\n");
infer_separator(argv[3]);
string filepath(argv[3]);
string output_asm(argv[4]);
string output_c(argv[5]);
process_layouts(filepath);
process_layouts(filepath, output_asm, output_c);
}
else {
FATAL_ERROR("ERROR: <mode> must be 'layouts', 'map', or 'groups'.\n");
}
return 0;
+9 -3
View File
@@ -1,4 +1,4 @@
CXX := g++
CXX ?= g++
CXXFLAGS := -std=c++11 -O2 -Wall -Wno-switch -Werror
@@ -6,12 +6,18 @@ SRCS := agb.cpp error.cpp main.cpp midi.cpp tables.cpp
HEADERS := agb.h error.h main.h midi.h tables.h
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
.PHONY: all clean
all: mid2agb
all: mid2agb$(EXE)
@:
mid2agb: $(SRCS) $(HEADERS)
mid2agb$(EXE): $(SRCS) $(HEADERS)
$(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS)
clean:
+11 -5
View File
@@ -1,19 +1,25 @@
CXX := g++
CXX ?= g++
CXXFLAGS := -std=c++11 -O2 -Wall -Wno-switch -Werror
SRCS := asm_file.cpp c_file.cpp charmap.cpp preproc.cpp string_parser.cpp \
utf8.cpp
utf8.cpp io.cpp
HEADERS := asm_file.h c_file.h char_util.h charmap.h preproc.h string_parser.h \
utf8.h
utf8.h io.h
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
.PHONY: all clean
all: preproc
all: preproc$(EXE)
@:
preproc: $(SRCS) $(HEADERS)
preproc$(EXE): $(SRCS) $(HEADERS)
$(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS)
clean:
+318 -60
View File
@@ -26,33 +26,13 @@
#include "char_util.h"
#include "utf8.h"
#include "string_parser.h"
#include "../../include/characters.h"
#include "io.h"
AsmFile::AsmFile(std::string filename) : m_filename(filename)
AsmFile::AsmFile(std::string filename, bool isStdin, bool doEnum) : m_filename(filename)
{
FILE *fp = std::fopen(filename.c_str(), "rb");
if (fp == NULL)
FATAL_ERROR("Failed to open \"%s\" for reading.\n", filename.c_str());
std::fseek(fp, 0, SEEK_END);
m_size = std::ftell(fp);
if (m_size < 0)
FATAL_ERROR("File size of \"%s\" is less than zero.\n", filename.c_str());
else if (m_size == 0)
return; // Empty file
m_buffer = new char[m_size + 1];
std::rewind(fp);
if (std::fread(m_buffer, m_size, 1, fp) != 1)
FATAL_ERROR("Failed to read \"%s\".\n", filename.c_str());
m_buffer[m_size] = 0;
std::fclose(fp);
m_buffer = ReadFileToBuffer(filename.c_str(), isStdin, &m_size);
m_doEnum = doEnum;
m_pos = 0;
m_lineNum = 1;
@@ -64,6 +44,7 @@ AsmFile::AsmFile(std::string filename) : m_filename(filename)
AsmFile::AsmFile(AsmFile&& other) : m_filename(std::move(other.m_filename))
{
m_buffer = other.m_buffer;
m_doEnum = other.m_doEnum;
m_pos = other.m_pos;
m_size = other.m_size;
m_lineNum = other.m_lineNum;
@@ -173,6 +154,8 @@ Directive AsmFile::GetDirective()
return Directive::String;
else if (CheckForDirective(".braille"))
return Directive::Braille;
else if (CheckForDirective("enum"))
return Directive::Enum;
else
return Directive::Unknown;
}
@@ -283,7 +266,7 @@ int AsmFile::ReadString(unsigned char* s)
while (length < padLength)
{
s[length++] = 0;
s[length++] = CHAR_SPACE;
}
}
@@ -292,40 +275,92 @@ int AsmFile::ReadString(unsigned char* s)
return length;
}
void AsmFile::VerifyStringLength(int length)
{
if (length == kMaxStringLength)
RaiseError("mapped string longer than %d bytes", kMaxStringLength);
}
int AsmFile::ReadBraille(unsigned char* s)
{
static std::map<char, unsigned char> encoding =
{
{ 'A', 0x01 },
{ 'B', 0x05 },
{ 'C', 0x03 },
{ 'D', 0x0B },
{ 'E', 0x09 },
{ 'F', 0x07 },
{ 'G', 0x0F },
{ 'H', 0x0D },
{ 'I', 0x06 },
{ 'J', 0x0E },
{ 'K', 0x11 },
{ 'L', 0x15 },
{ 'M', 0x13 },
{ 'N', 0x1B },
{ 'O', 0x19 },
{ 'P', 0x17 },
{ 'Q', 0x1F },
{ 'R', 0x1D },
{ 'S', 0x16 },
{ 'T', 0x1E },
{ 'U', 0x31 },
{ 'V', 0x35 },
{ 'W', 0x2E },
{ 'X', 0x33 },
{ 'Y', 0x3B },
{ 'Z', 0x39 },
{ ' ', 0x00 },
{ ',', 0x04 },
{ '.', 0x2C },
{ '$', 0xFF },
{ 'A', BRAILLE_CHAR_A },
{ 'B', BRAILLE_CHAR_B },
{ 'C', BRAILLE_CHAR_C },
{ 'D', BRAILLE_CHAR_D },
{ 'E', BRAILLE_CHAR_E },
{ 'F', BRAILLE_CHAR_F },
{ 'G', BRAILLE_CHAR_G },
{ 'H', BRAILLE_CHAR_H },
{ 'I', BRAILLE_CHAR_I },
{ 'J', BRAILLE_CHAR_J },
{ 'K', BRAILLE_CHAR_K },
{ 'L', BRAILLE_CHAR_L },
{ 'M', BRAILLE_CHAR_M },
{ 'N', BRAILLE_CHAR_N },
{ 'O', BRAILLE_CHAR_O },
{ 'P', BRAILLE_CHAR_P },
{ 'Q', BRAILLE_CHAR_Q },
{ 'R', BRAILLE_CHAR_R },
{ 'S', BRAILLE_CHAR_S },
{ 'T', BRAILLE_CHAR_T },
{ 'U', BRAILLE_CHAR_U },
{ 'V', BRAILLE_CHAR_V },
{ 'W', BRAILLE_CHAR_W },
{ 'X', BRAILLE_CHAR_X },
{ 'Y', BRAILLE_CHAR_Y },
{ 'Z', BRAILLE_CHAR_Z },
{ 'a', BRAILLE_CHAR_A },
{ 'b', BRAILLE_CHAR_B },
{ 'c', BRAILLE_CHAR_C },
{ 'd', BRAILLE_CHAR_D },
{ 'e', BRAILLE_CHAR_E },
{ 'f', BRAILLE_CHAR_F },
{ 'g', BRAILLE_CHAR_G },
{ 'h', BRAILLE_CHAR_H },
{ 'i', BRAILLE_CHAR_I },
{ 'j', BRAILLE_CHAR_J },
{ 'k', BRAILLE_CHAR_K },
{ 'l', BRAILLE_CHAR_L },
{ 'm', BRAILLE_CHAR_M },
{ 'n', BRAILLE_CHAR_N },
{ 'o', BRAILLE_CHAR_O },
{ 'p', BRAILLE_CHAR_P },
{ 'q', BRAILLE_CHAR_Q },
{ 'r', BRAILLE_CHAR_R },
{ 's', BRAILLE_CHAR_S },
{ 't', BRAILLE_CHAR_T },
{ 'u', BRAILLE_CHAR_U },
{ 'v', BRAILLE_CHAR_V },
{ 'w', BRAILLE_CHAR_W },
{ 'x', BRAILLE_CHAR_X },
{ 'y', BRAILLE_CHAR_Y },
{ 'z', BRAILLE_CHAR_Z },
{ '0', BRAILLE_CHAR_0 },
{ '1', BRAILLE_CHAR_1 },
{ '2', BRAILLE_CHAR_2 },
{ '3', BRAILLE_CHAR_3 },
{ '4', BRAILLE_CHAR_4 },
{ '5', BRAILLE_CHAR_5 },
{ '6', BRAILLE_CHAR_6 },
{ '7', BRAILLE_CHAR_7 },
{ '8', BRAILLE_CHAR_8 },
{ '9', BRAILLE_CHAR_9 },
{ ' ', BRAILLE_CHAR_SPACE },
{ ',', BRAILLE_CHAR_COMMA },
{ '.', BRAILLE_CHAR_PERIOD },
{ '?', BRAILLE_CHAR_QUESTION_MARK },
{ '!', BRAILLE_CHAR_EXCL_MARK },
{ ':', BRAILLE_CHAR_COLON },
{ ';', BRAILLE_CHAR_SEMICOLON },
{ '-', BRAILLE_CHAR_HYPHEN },
{ '/', BRAILLE_CHAR_SLASH },
{ '(', BRAILLE_CHAR_PAREN },
{ ')', BRAILLE_CHAR_PAREN },
{ '\'', BRAILLE_CHAR_APOSTROPHE },
{ '#', BRAILLE_CHAR_NUMBER },
{ '$', EOS },
};
SkipWhitespace();
@@ -337,14 +372,13 @@ int AsmFile::ReadBraille(unsigned char* s)
m_pos++;
bool inNumber = false;
while (m_buffer[m_pos] != '"')
{
if (length == kMaxStringLength)
RaiseError("mapped string longer than %d bytes", kMaxStringLength);
if (m_buffer[m_pos] == '\\' && m_buffer[m_pos + 1] == 'n')
{
s[length++] = 0xFE;
VerifyStringLength(length);
s[length++] = CHAR_NEWLINE;
m_pos += 2;
}
else
@@ -359,6 +393,21 @@ int AsmFile::ReadBraille(unsigned char* s)
RaiseError("character '\\x%02X' not valid in braille string", m_buffer[m_pos]);
}
if (!inNumber && c >= '0' && c <= '9' )
{
// Output number indicator at start of a number
inNumber = true;
VerifyStringLength(length);
s[length++] = BRAILLE_CHAR_NUMBER;
}
else if (inNumber && encoding[c] == BRAILLE_CHAR_SPACE)
{
// Number ends at a space.
// Non-number characters encountered before a space will simply be output as is.
inNumber = false;
}
VerifyStringLength(length);
s[length++] = encoding[c];
m_pos++;
}
@@ -460,6 +509,88 @@ void AsmFile::OutputLine()
}
}
// parses an assumed C `enum`. Returns false if `enum { ...` is not matched
bool AsmFile::ParseEnum()
{
if (!m_doEnum)
return false;
long fallbackPosition = m_pos;
std::string headerFilename = "";
long currentHeaderLine = SkipWhitespaceAndEol();
std::string enumName = ReadIdentifier();
currentHeaderLine += SkipWhitespaceAndEol();
std::string enumBase = "0";
long enumCounter = 0;
long symbolCount = 0;
if (m_buffer[m_pos] != '{') // assume assembly macro, otherwise assume enum and report errors accordingly
{
m_pos = fallbackPosition - 4;
return false;
}
currentHeaderLine += FindLastLineNumber(headerFilename);
m_pos++;
for (;;)
{
currentHeaderLine += SkipWhitespaceAndEol();
std::string currentIdentName = ReadIdentifier();
if (!currentIdentName.empty())
{
std::printf("# %ld \"%s\"\n", currentHeaderLine, headerFilename.c_str());
currentHeaderLine += SkipWhitespaceAndEol();
if (m_buffer[m_pos] == '=')
{
m_pos++;
SkipWhitespace();
enumBase.clear();
for (;;)
{
if (m_pos == m_size)
RaiseError("unexpected EOF");
if (m_buffer[m_pos] == ',')
break;
if (m_buffer[m_pos] == '\n')
{
currentHeaderLine++;
enumBase.push_back(' ');
}
else
{
enumBase.push_back(m_buffer[m_pos]);
}
m_pos++;
}
enumCounter = 0;
}
std::printf(".equiv %s, (%s) + %ld\n", currentIdentName.c_str(), enumBase.c_str(), enumCounter);
enumCounter++;
symbolCount++;
}
else if (symbolCount == 0)
{
RaiseError("%s:%ld: empty enum is invalid", headerFilename.c_str(), currentHeaderLine);
}
if (m_buffer[m_pos] != ',')
{
currentHeaderLine += SkipWhitespaceAndEol();
if (m_buffer[m_pos++] == '}' && m_buffer[m_pos++] == ';')
{
ExpectEmptyRestOfLine();
break;
}
else
{
RaiseError("unterminated enum from included file %s:%ld", headerFilename.c_str(), currentHeaderLine);
}
}
m_pos++;
}
return true;
}
// Asserts that the rest of the line is empty and moves to the next one.
void AsmFile::ExpectEmptyRestOfLine()
{
@@ -532,3 +663,130 @@ void AsmFile::RaiseWarning(const char* format, ...)
{
DO_REPORT("warning");
}
// Skips Whitespace including newlines and returns the amount of newlines skipped
int AsmFile::SkipWhitespaceAndEol()
{
int newlines = 0;
while (m_buffer[m_pos] == '\t' || m_buffer[m_pos] == ' ' || m_buffer[m_pos] == '\n')
{
if (m_buffer[m_pos] == '\n')
newlines++;
m_pos++;
}
return newlines;
}
// returns the last line indicator and its corresponding file name without modifying the token index
int AsmFile::FindLastLineNumber(std::string& filename)
{
long pos = m_pos;
long linebreaks = 0;
while (m_buffer[pos] != '#' && pos >= 0)
{
if (m_buffer[pos] == '\n')
linebreaks++;
pos--;
}
if (pos < 0)
RaiseError("line indicator for header file not found before `enum`");
pos++;
while (m_buffer[pos] == ' ' || m_buffer[pos] == '\t')
pos++;
if (!IsAsciiDigit(m_buffer[pos]))
RaiseError("malformatted line indicator found before `enum`, expected line number");
unsigned n = 0;
int digit = 0;
while ((digit = ConvertDigit(m_buffer[pos++], 10)) != -1)
n = 10 * n + digit;
while (m_buffer[pos] == ' ' || m_buffer[pos] == '\t')
pos++;
if (m_buffer[pos++] != '"')
RaiseError("malformatted line indicator found before `enum`, expected filename");
while (m_buffer[pos] != '"')
{
unsigned char c = m_buffer[pos++];
if (c == 0)
{
if (pos >= m_size)
RaiseError("unexpected EOF in line indicator");
else
RaiseError("unexpected null character in line indicator");
}
if (!IsAsciiPrintable(c))
RaiseError("unexpected character '\\x%02X' in line indicator", c);
if (c == '\\')
{
c = m_buffer[pos];
RaiseError("unexpected escape '\\%c' in line indicator", c);
}
filename += c;
}
return n + linebreaks - 1;
}
std::string AsmFile::ReadIdentifier()
{
long start = m_pos;
if (!IsIdentifierStartingChar(m_buffer[m_pos]))
return std::string();
m_pos++;
while (IsIdentifierChar(m_buffer[m_pos]))
m_pos++;
return std::string(&m_buffer[start], m_pos - start);
}
long AsmFile::ReadInteger(std::string filename, long line)
{
bool negate = false;
int radix = 10;
if (!IsAsciiDigit(m_buffer[m_pos]))
{
if (m_buffer[m_pos++] == '-')
negate = true;
else
RaiseError("expected number in included file %s:%ld", filename.c_str(), line);
}
if (m_buffer[m_pos] == '0' && m_buffer[m_pos + 1] == 'x')
{
radix = 16;
m_pos += 2;
}
else if (m_buffer[m_pos] == '0' && m_buffer[m_pos + 1] == 'b')
{
radix = 2;
m_pos += 2;
}
else if (m_buffer[m_pos] == '0' && IsAsciiDigit(m_buffer[m_pos+1]))
{
radix = 8;
m_pos++;
}
long n = 0;
int digit;
while ((digit = ConvertDigit(m_buffer[m_pos], radix)) != -1)
{
n = n * radix + digit;
m_pos++;
}
return negate ? -n : n;
}
+9 -1
View File
@@ -31,13 +31,14 @@ enum class Directive
Include,
String,
Braille,
Enum,
Unknown
};
class AsmFile
{
public:
AsmFile(std::string filename);
AsmFile(std::string filename, bool isStdin, bool doEnum);
AsmFile(AsmFile&& other);
AsmFile(const AsmFile&) = delete;
~AsmFile();
@@ -49,9 +50,11 @@ public:
bool IsAtEnd();
void OutputLine();
void OutputLocation();
bool ParseEnum();
private:
char* m_buffer;
bool m_doEnum;
long m_pos;
long m_size;
long m_lineNum;
@@ -67,6 +70,11 @@ private:
void ReportDiagnostic(const char* type, const char* format, std::va_list args);
void RaiseError(const char* format, ...);
void RaiseWarning(const char* format, ...);
void VerifyStringLength(int length);
int SkipWhitespaceAndEol();
int FindLastLineNumber(std::string& filename);
std::string ReadIdentifier();
long ReadInteger(std::string filename, long line);
};
#endif // ASM_FILE_H
+15 -26
View File
@@ -23,39 +23,27 @@
#include <stdexcept>
#include <string>
#include <memory>
#include <cstring>
#include <cerrno>
#include "preproc.h"
#include "c_file.h"
#include "char_util.h"
#include "utf8.h"
#include "string_parser.h"
#include "io.h"
CFile::CFile(std::string filename) : m_filename(filename)
CFile::CFile(const char * filenameCStr, bool isStdin)
{
FILE *fp = std::fopen(filename.c_str(), "rb");
if (isStdin)
m_filename = std::string{"<stdin>/"}.append(filenameCStr);
else
m_filename = std::string(filenameCStr);
if (fp == NULL)
FATAL_ERROR("Failed to open \"%s\" for reading.\n", filename.c_str());
std::fseek(fp, 0, SEEK_END);
m_size = std::ftell(fp);
if (m_size < 0)
FATAL_ERROR("File size of \"%s\" is less than zero.\n", filename.c_str());
m_buffer = new char[m_size + 1];
std::rewind(fp);
if (std::fread(m_buffer, m_size, 1, fp) != 1)
FATAL_ERROR("Failed to read \"%s\".\n", filename.c_str());
m_buffer[m_size] = 0;
std::fclose(fp);
m_buffer = ReadFileToBuffer(filenameCStr, isStdin, &m_size);
m_pos = 0;
m_lineNum = 1;
m_isStdin = isStdin;
}
CFile::CFile(CFile&& other) : m_filename(std::move(other.m_filename))
@@ -64,13 +52,14 @@ CFile::CFile(CFile&& other) : m_filename(std::move(other.m_filename))
m_pos = other.m_pos;
m_size = other.m_size;
m_lineNum = other.m_lineNum;
m_isStdin = other.m_isStdin;
other.m_buffer = nullptr;
other.m_buffer = NULL;
}
CFile::~CFile()
{
delete[] m_buffer;
free(m_buffer);
}
void CFile::Preproc()
@@ -354,7 +343,7 @@ void CFile::TryConvertIncbin()
if (m_buffer[m_pos] == '\\')
RaiseError("unexpected escape in path string");
m_pos++;
}
@@ -389,7 +378,7 @@ void CFile::TryConvertIncbin()
m_pos++;
}
if (m_buffer[m_pos] != ')')
RaiseError("expected ')'");
+2 -1
View File
@@ -30,7 +30,7 @@
class CFile
{
public:
CFile(std::string filename);
CFile(const char * filenameCStr, bool isStdin);
CFile(CFile&& other);
CFile(const CFile&) = delete;
~CFile();
@@ -42,6 +42,7 @@ private:
long m_size;
long m_lineNum;
std::string m_filename;
bool m_isStdin;
bool ConsumeHorizontalWhitespace();
bool ConsumeNewline();
+51
View File
@@ -0,0 +1,51 @@
#include "preproc.h"
#include "io.h"
#include <string>
#include <cerrno>
#include <cstring>
char *ReadFileToBuffer(const char *filename, bool isStdin, long *size)
{
FILE *fp;
if (isStdin)
fp = stdin;
else
fp = std::fopen(filename, "rb");
if (fp == NULL)
FATAL_ERROR("Failed to open \"%s\" for reading.\n", filename);
*size = 0;
char *buffer = (char *)malloc(CHUNK_SIZE + 1);
if (buffer == NULL) {
FATAL_ERROR("Failed to allocate memory to process file \"%s\"!", filename);
}
std::size_t numAllocatedBytes = CHUNK_SIZE + 1;
std::size_t bufferOffset = 0;
std::size_t count;
while ((count = std::fread(buffer + bufferOffset, 1, CHUNK_SIZE, fp)) != 0) {
if (!std::ferror(fp)) {
*size += count;
if (std::feof(fp)) {
break;
}
numAllocatedBytes += CHUNK_SIZE;
bufferOffset += CHUNK_SIZE;
buffer = (char *)realloc(buffer, numAllocatedBytes);
if (buffer == NULL) {
FATAL_ERROR("Failed to allocate memory to process file \"%s\"!", filename);
}
} else {
FATAL_ERROR("Failed to read \"%s\". (error: %s)", filename, std::strerror(errno));
}
}
buffer[*size] = 0;
std::fclose(fp);
return buffer;
}
+8
View File
@@ -0,0 +1,8 @@
#ifndef IO_H_
#define IO_H_
#define CHUNK_SIZE 4096
char *ReadFileToBuffer(const char *filename, bool isStdin, long *size);
#endif // IO_H_
+61 -14
View File
@@ -20,11 +20,14 @@
#include <string>
#include <stack>
#include <unistd.h>
#include "preproc.h"
#include "asm_file.h"
#include "c_file.h"
#include "charmap.h"
static void UsageAndExit(const char *program);
Charmap* g_charmap;
void PrintAsmBytes(unsigned char *s, int length)
@@ -43,11 +46,12 @@ void PrintAsmBytes(unsigned char *s, int length)
}
}
void PreprocAsmFile(std::string filename)
void PreprocAsmFile(std::string filename, bool isStdin, bool doEnum)
{
std::stack<AsmFile> stack;
stack.push(AsmFile(filename));
stack.push(AsmFile(filename, isStdin, doEnum));
std::printf("# 1 \"%s\"\n", filename.c_str());
for (;;)
{
@@ -66,7 +70,7 @@ void PreprocAsmFile(std::string filename)
switch (directive)
{
case Directive::Include:
stack.push(AsmFile(stack.top().ReadPath()));
stack.push(AsmFile(stack.top().ReadPath(), false, doEnum));
stack.top().OutputLocation();
break;
case Directive::String:
@@ -83,6 +87,12 @@ void PreprocAsmFile(std::string filename)
PrintAsmBytes(s, length);
break;
}
case Directive::Enum:
{
if (!stack.top().ParseEnum())
stack.top().OutputLine();
break;
}
case Directive::Unknown:
{
std::string globalLabel = stack.top().GetGlobalLabel();
@@ -103,15 +113,15 @@ void PreprocAsmFile(std::string filename)
}
}
void PreprocCFile(std::string filename)
void PreprocCFile(const char * filename, bool isStdin)
{
CFile cFile(filename);
CFile cFile(filename, isStdin);
cFile.Preproc();
}
char* GetFileExtension(char* filename)
const char* GetFileExtension(const char* filename)
{
char* extension = filename;
const char* extension = filename;
while (*extension != 0)
extension++;
@@ -130,27 +140,64 @@ char* GetFileExtension(char* filename)
return extension;
}
static void UsageAndExit(const char *program)
{
std::fprintf(stderr, "Usage: %s [-i] [-e] SRC_FILE CHARMAP_FILE\nwhere -i denotes if input is from stdin\n -e enables enum handling\n", program);
std::exit(EXIT_FAILURE);
}
int main(int argc, char **argv)
{
if (argc != 3)
int opt;
const char *source = NULL;
const char *charmap = NULL;
bool isStdin = false;
bool doEnum = false;
/* preproc [-i] [-e] SRC_FILE CHARMAP_FILE */
while ((opt = getopt(argc, argv, "ie")) != -1)
{
std::fprintf(stderr, "Usage: %s SRC_FILE CHARMAP_FILE", argv[0]);
return 1;
switch (opt)
{
case 'i':
isStdin = true;
break;
case 'e':
doEnum = true;
break;
default:
UsageAndExit(argv[0]);
break;
}
}
g_charmap = new Charmap(argv[2]);
if (optind + 2 != argc)
UsageAndExit(argv[0]);
char* extension = GetFileExtension(argv[1]);
source = argv[optind + 0];
charmap = argv[optind + 1];
g_charmap = new Charmap(charmap);
const char* extension = GetFileExtension(source);
if (!extension)
FATAL_ERROR("\"%s\" has no file extension.\n", argv[1]);
if ((extension[0] == 's') && extension[1] == 0)
PreprocAsmFile(argv[1]);
{
PreprocAsmFile(source, isStdin, doEnum);
}
else if ((extension[0] == 'c' || extension[0] == 'i') && extension[1] == 0)
PreprocCFile(argv[1]);
{
if (doEnum)
FATAL_ERROR("-e is invalid for C sources\n");
PreprocCFile(source, isStdin);
}
else
{
FATAL_ERROR("\"%s\" has an unknown file extension of \"%s\".\n", argv[1], extension);
}
return 0;
}
+9 -3
View File
@@ -1,4 +1,4 @@
CXX := g++
CXX ?= g++
CXXFLAGS := -std=c++11 -O2 -Wall -Wno-switch -Werror
@@ -8,10 +8,16 @@ HEADERS := ramscrgen.h sym_file.h elf.h char_util.h
.PHONY: all clean
all: ramscrgen
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
all: ramscrgen$(EXE)
@:
ramscrgen: $(SRCS) $(HEADERS)
ramscrgen$(EXE): $(SRCS) $(HEADERS)
$(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS)
clean:
+9 -3
View File
@@ -1,4 +1,4 @@
CC = gcc
CC ?= gcc
CFLAGS = -Wall -Wextra -Werror -std=c11 -O2 -DPNG_SKIP_SETJMP_CHECK
CFLAGS += $(shell pkg-config --cflags libpng)
@@ -10,10 +10,16 @@ SRCS = main.c convert_png.c util.c font.c
.PHONY: all clean
all: rsfont
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
all: rsfont$(EXE)
@:
rsfont: $(SRCS) convert_png.h gfx.h global.h util.h font.h
rsfont$(EXE): $(SRCS) convert_png.h gfx.h global.h util.h font.h
$(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) $(LIBS)
clean:
+9 -3
View File
@@ -1,4 +1,4 @@
CXX = g++
CXX ?= g++
CXXFLAGS = -Wall -Werror -std=c++11 -O2
@@ -8,10 +8,16 @@ HEADERS := scaninc.h asm_file.h c_file.h source_file.h
.PHONY: all clean
all: scaninc
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
all: scaninc$(EXE)
@:
scaninc: $(SRCS) $(HEADERS)
scaninc$(EXE): $(SRCS) $(HEADERS)
$(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS)
clean:
+51 -3
View File
@@ -24,6 +24,9 @@
#include <queue>
#include <set>
#include <string>
#include <iostream>
#include <tuple>
#include <fstream>
#include "scaninc.h"
#include "source_file.h"
@@ -38,15 +41,19 @@ bool CanOpenFile(std::string path)
return true;
}
const char *const USAGE = "Usage: scaninc [-I INCLUDE_PATH] FILE_PATH\n";
const char *const USAGE = "Usage: scaninc [-I INCLUDE_PATH] [-M DEPENDENCY_OUT_PATH] FILE_PATH\n";
int main(int argc, char **argv)
{
std::queue<std::string> filesToProcess;
std::set<std::string> dependencies;
std::set<std::string> dependencies_includes;
std::vector<std::string> includeDirs;
bool makeformat = false;
std::string make_outfile;
argc--;
argv++;
@@ -68,6 +75,13 @@ int main(int argc, char **argv)
}
includeDirs.push_back(includeDir);
}
else if(arg.substr(0, 2) == "-M")
{
makeformat = true;
argc--;
argv++;
make_outfile = std::string(argv[0]);
}
else
{
FATAL_ERROR(USAGE);
@@ -111,7 +125,13 @@ int main(int argc, char **argv)
if (!exists && (file.FileType() == SourceFileType::Asm || file.FileType() == SourceFileType::Inc))
{
path = include;
if (CanOpenFile(path))
exists = true;
}
if (!exists)
continue;
dependencies_includes.insert(path);
bool inserted = dependencies.insert(path).second;
if (inserted && exists)
{
@@ -121,8 +141,36 @@ int main(int argc, char **argv)
includeDirs.pop_back();
}
for (const std::string &path : dependencies)
if(!makeformat)
{
std::printf("%s\n", path.c_str());
for (const std::string &path : dependencies)
{
std::printf("%s\n", path.c_str());
}
std::cout << std::endl;
}
else
{
// Write out make rules to a file
std::ofstream output(make_outfile);
// Print a make rule for the object file
size_t ext_pos = make_outfile.find_last_of(".");
auto object_file = make_outfile.substr(0, ext_pos + 1) + "o";
output << object_file.c_str() << ": ";
for (const std::string &path : dependencies)
{
output << path << " ";
}
// Dependency list rule.
// Although these rules are identical, they need to be separate, else make will trigger the rule again after the file is created for the first time.
output << "\n" << make_outfile.c_str() << ": ";
for (const std::string &path : dependencies_includes)
{
output << path << " ";
}
output.flush();
output.close();
}
}