Add some setup guide stuff

This commit is contained in:
Gwilym Kuiper 2021-11-24 20:20:17 +00:00
parent 2b5d5a5f41
commit fb67cadbc7
5 changed files with 92 additions and 1 deletions

View file

@ -0,0 +1,6 @@
# Running the example
Environment setup will depend on the platform you are using.
agb's requirements are [rust nightly](https://www.rust-lang.org/) edition and the gnu binutils for `arm-none-eabi`.
See the subpages here for platform specific setup guides.

View file

@ -0,0 +1,11 @@
# Running an example
In this section, we will get to the point where you can build and run the game built for the GMTK game jam using agb known as 'The Hat Chooses the Wizard'.
This will prove that your development environment is ready for the future tutorials and later building.
You can run the game using real hardware and a flash card.
However, at this stage, it is much easier to play on an emulator.
agb is guaranteed to work well using [mgba](https://mgba.io/), but other emulators will also work.
Note that some emulators will require a special 'fixed' gba ROM file.
See the later steps in this section for how to do this.

View file

@ -0,0 +1,34 @@
# Linux setup
This guide has been tested on Ubuntu, Arch Linux and Raspberry Pi OS running on a raspberry pi 4.
# 1. Install a recent version of rust
agb unfortunately relies on a few nightly rust features, so you need to ensure you have that installed.
Firstly, ensure that you have **rustup** installed which you can do by following the instructions on the [rust website](https://www.rust-lang.org/tools/install)
You can update rustup with `rustup update` if you have already installed it.
# 2. arm-none-eabi
We need this installed in order to be able to assemble the small amount of assembly in agb, and to do the final linking.
* On Debian and derivatives (like Ubuntu): `sudo apt install binutils-arm-non-eabi`
* On Arch Linux and derivatives: `pacman -S arm-none-eabi-binutils`
# 3. git
The source code for the game is hosted on github, so you will need git installed.
* On Debian and derivatives (like Ubuntu): `sudo apt install git`
* On Arch Linux and derivatives: `pacman -S git`
# 4. gbafix
In order to be able to play on real hardware or on some emulators, you may need to install 'gbafix'.
The rust implementation can be installed very easily using `cargo install gbafix`.
Make sure that the Cargo bin directory is in your `PATH` as we'll need to use it later.
That is all you need to get started.
You can now move on to 'building the game'.

34
book/src/03b_building.md Normal file
View file

@ -0,0 +1,34 @@
# Building the game
By the end of this section, you should be able to build and run an example game made using agb!
**This section is optional.**
If you just want to get straight into building your own games, you don't need to do this.
However, we recommended doing this section to prove that your setup works.
# 1. Get the source code
The source code can be fetched using `git clone https://github.com/agbrs/joinedtogether.git`.
# 2. Build the game
Build a copy of the game using `cargo build --release`.
This could take quite a while, but eventually you'll end up with a copy of the game in `target/thumbv4t-none-eabi/release/joinedtogether` or `target/thumbv4t-none-eabi/release/joinedtogether.elf` depending on platform.
This can be run directly by some emulators, but we need to run an extra step in order to convert the elf file into a '.gba' file.
```sh
arm-none-eabi-objcopy -O binary target/thumbv4t-none-eabi/release/joinedtogether joinedtogether.gba
gbafix joinedtogether.gba
```
or
```sh
arm-none-eabi-objcopy -O binary target/thumbv4t-none-eabi/release/joinedtogether.elf joinedtogether.gba
gbafix joinedtogether.gba
```
And then load the resulting file in your emulator of choice.
That's all there is to it!
If you have `mgba-qt` in your path, then you can launch the game directly using `cargo run --release`

View file

@ -2,3 +2,9 @@
- [Introduction](./01_introduction.md) - [Introduction](./01_introduction.md)
- [The Game Boy Advance hardware](./02_hardware.md) - [The Game Boy Advance hardware](./02_hardware.md)
- [Running an example](./03_getting_started.md)
- [Environment setup](./03_environment_setup.md)
- [Linux setup](./03a_linux_setup.md)
- [Windows setup]()
- [Mac OS setup]()
- [Building the game](./03b_building.md)