mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-11 17:41:33 +11:00
Build the pong example from the book as a real example
This commit is contained in:
parent
129138e388
commit
8a197dbd2b
20
.github/scripts/build-example-gba-files.sh
vendored
20
.github/scripts/build-example-gba-files.sh
vendored
|
@ -6,26 +6,28 @@ set -x # print every command before it runs
|
||||||
# Requires gbafix and arm-none-eabi-objcopy to already be installed
|
# Requires gbafix and arm-none-eabi-objcopy to already be installed
|
||||||
|
|
||||||
function build_rom() {
|
function build_rom() {
|
||||||
local GAME_NAME="$1"
|
local GAME_FOLDER="$1"
|
||||||
local INTERNAL_NAME="$2"
|
local INTERNAL_NAME="$2"
|
||||||
|
|
||||||
local TARGET_FOLDER="${CARGO_TARGET_DIR:-target}"
|
local GAME_NAME
|
||||||
|
GAME_NAME="$(basename "$GAME_FOLDER")"
|
||||||
|
|
||||||
|
local TARGET_FOLDER="${CARGO_TARGET_DIR:-$GAME_FOLDER/target}"
|
||||||
local GBA_FILE="$TARGET_FOLDER/$GAME_NAME.gba"
|
local GBA_FILE="$TARGET_FOLDER/$GAME_NAME.gba"
|
||||||
|
|
||||||
pushd "examples/$GAME_NAME"
|
(cd "$GAME_FOLDER" && cargo build --release --verbose --target thumbv4t-none-eabi)
|
||||||
cargo build --release --verbose --target thumbv4t-none-eabi
|
|
||||||
|
|
||||||
arm-none-eabi-objcopy -O binary "$TARGET_FOLDER/thumbv4t-none-eabi/release/$GAME_NAME" "$GBA_FILE"
|
arm-none-eabi-objcopy -O binary "$TARGET_FOLDER/thumbv4t-none-eabi/release/$GAME_NAME" "$GBA_FILE"
|
||||||
gbafix -p "-t${INTERNAL_NAME:0:12}" "-c${INTERNAL_NAME:0:4}" -mGC "$GBA_FILE"
|
gbafix -p "-t${INTERNAL_NAME:0:12}" "-c${INTERNAL_NAME:0:4}" -mGC "$GBA_FILE"
|
||||||
|
|
||||||
cp -v "$GBA_FILE" "../$GAME_NAME.gba"
|
cp -v "$GBA_FILE" "examples/$GAME_NAME.gba"
|
||||||
|
|
||||||
popd
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mkdir -p examples/target
|
mkdir -p examples/target
|
||||||
|
|
||||||
build_rom "the-purple-night" "PURPLENIGHT"
|
build_rom "examples/the-purple-night" "PURPLENIGHT"
|
||||||
build_rom "the-hat-chooses-the-wizard" "HATWIZARD"
|
build_rom "examples/the-hat-chooses-the-wizard" "HATWIZARD"
|
||||||
|
|
||||||
|
build_rom "book/games/pong" "PONG"
|
||||||
|
|
||||||
zip examples/target/examples.zip examples/*.gba
|
zip examples/target/examples.zip examples/*.gba
|
Loading…
Reference in a new issue