Skip to content

Commit

Permalink
Merge pull request pret#672 from GriffinRichards/sync-toolchain
Browse files Browse the repository at this point in the history
Sync Makefile and tools with pokeemerald
  • Loading branch information
GriffinRichards authored Sep 18, 2024
2 parents 539ed36 + e47a054 commit 311d317
Show file tree
Hide file tree
Showing 46 changed files with 16,143 additions and 16,043 deletions.
387 changes: 204 additions & 183 deletions Makefile

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions audio_rules.mk
Original file line number Diff line number Diff line change
@@ -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)
53 changes: 28 additions & 25 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 67 additions & 0 deletions include/characters.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 3 additions & 0 deletions include/constants/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Will be moved to build/ eventually
map_groups.h
layouts.h
Loading

0 comments on commit 311d317

Please sign in to comment.