From 0d9cc6c1f79f9c41a0dfd64efd17561519de43b9 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 11 Apr 2023 20:09:05 +0100 Subject: [PATCH] Replace references to gbafix with agb-gbafix --- CHANGELOG.md | 3 +++ README.md | 2 -- book/src/setup/building.md | 19 +++++-------------- book/src/setup/linux.md | 4 ++-- book/src/setup/mac.md | 4 ++-- template/README.md | 7 +++---- 6 files changed, 15 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4404d6fd..c15cd3ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- Added custom `gbafix` implementation which can take the elf file produced by `cargo build` directly, removing the need for the objcopy step. + ### Changed - Made Vector2D::new a const function. - The template now uses rust 2021 edition by default. diff --git a/README.md b/README.md index b9b06e4e..ed82fb7b 100644 --- a/README.md +++ b/README.md @@ -66,8 +66,6 @@ to just write games for the Game Boy Advance using this library: * Install with `cargo install just` * [mdbook](https://rust-lang.github.io/mdBook/index.html) * Install with `cargo install mdbook` -* [gbafix](https://crates.io/crates/gbafix) - * Install with `cargo install gbafix` With all of this installed, you should be able to run a full build of agb using by running ```sh diff --git a/book/src/setup/building.md b/book/src/setup/building.md index 0358c76e..d88b9e53 100644 --- a/book/src/setup/building.md +++ b/book/src/setup/building.md @@ -30,30 +30,21 @@ Depending on your platform, the file will have either a `.elf` extension or no e ## 3. Convert the binary to a GBA file In order to run the game on an emulator, we need to convert the binary file to a GBA file. -To do this, we'll use two tools: `arm-none-eabi-objcopy` and `gbafix`. +To do this, we'll use the tool `agb-gbafix`. -Run the following command to convert the binary file to a GBA file: +Run the following command to convert the binary file to a GBA ROM: ```sh -arm-none-eabi-objcopy -O binary target/thumbv4t-none-eabi/release/template template.gba +agb-gbafix target/thumbv4t-none-eabi/release/template -o template.gba ``` or ```sh -arm-none-eabi-objcopy -O binary target/thumbv4t-none-eabi/release/template.elf template.gba +agb-gbafix target/thumbv4t-none-eabi/release/template.elf -o template.gba ``` -Depending on whether your file has the .elf extension. -This command will create a template.gba file in the template directory. - -Next, run the following command to fix the GBA header: - -```sh -gbafix template.gba -``` - -This command will add the correct GBA header to the template.gba file. +This command will add the correct GBA header to the template.gba file and it will be playable on real hardware or an emulator. ## 4. Run the game diff --git a/book/src/setup/linux.md b/book/src/setup/linux.md index 0c4c6574..f96557f0 100644 --- a/book/src/setup/linux.md +++ b/book/src/setup/linux.md @@ -25,8 +25,8 @@ The source code for the game is hosted on github, so you will need to install gi # 4. gbafix -In order to be able to play games made with agb on real hardware or on some emulators, you will need to install 'gbafix'. -The rust implementation can be installed very easily using `cargo install gbafix`. +In order to be able to play games made with agb on real hardware or on some emulators, you will need to install 'agb-gbafix'. +Agb's implementation can be installed very easily using `cargo install agb-gbafix`. Make sure that the Cargo bin directory is in your `PATH` as we'll need to use it later. diff --git a/book/src/setup/mac.md b/book/src/setup/mac.md index a03248ca..510765e3 100644 --- a/book/src/setup/mac.md +++ b/book/src/setup/mac.md @@ -43,8 +43,8 @@ After installing to your `/Applications` folder you can add the binary to your p # 5. Real hardware - gbafix -In order to be able to play games made with agb on real hardware or on some emulators, you will need to install 'gbafix'. -The rust implementation can be installed very easily using `cargo install gbafix`. +In order to be able to play games made with agb on real hardware or on some emulators, you will need to install 'agb-gbafix'. +Agb's implementation can be installed very easily using `cargo install agb-gbafix`. Make sure that the Cargo bin directory is in your `PATH` as we'll need to use it later. diff --git a/template/README.md b/template/README.md index 423ea1e4..2d488275 100644 --- a/template/README.md +++ b/template/README.md @@ -22,8 +22,8 @@ You will also want to install an emulator. The best support in agb is with [mgba `println!` support via `agb::println!` but any emulator should work. You'll get the best experience if `mgba-qt` is in your `PATH`. -If you want to run your game on real hardware, you will also need to install `gbafix` which you can do after installing -rust with the following: `cargo install gbafix`. This is not required if you are only running your game in an emulator. +If you want to run your game on real hardware, you will also need to install `agb-gbafix` which you can do after installing +rust with the following: `cargo install agb-gbafix`. This is not required if you are only running your game in an emulator. ### Running in an emulator @@ -68,6 +68,5 @@ running on the real thing. First build the binary in release mode using the instructions above, then do the following: ```sh -arm-none-eabi-objcopy -O binary target/thumbv4t-none-eabi/release/ .gba -gbafix .gba +agb-gbafix target/thumbv4t-none-eabi/release/ -o .gba ``` \ No newline at end of file