/gb-emu

A Game Boy emulator

Primary LanguageC++GNU General Public License v3.0GPL-3.0

gb-emu

An open source GameBoy emulator written in C++.

Dependency

At the moment, the emulator has been tested on Ubuntu and Fedora. On Ubuntu the required software can be installed with:

sudo apt install git cmake g++ libsdl2-dev libboost-program-options-dev

On Fedora the required software can be installed with:

sudo dnf install git make cmake g++ SDL2 SDL2-devel boost-devel

Building

git clone https://github.com/leofracca/gb-emu
cd gb-emu
mkdir build
cd build
cmake ..
make

Then the executable gbemu will be created inside the build folder.

Playing

To run the emulator:

./gbemu path/to/rom [scale]

where scale represents the scale of the window.

For example, supposing that there is a ROM called rom.gb inside the build folder, the command would be:

./gbemu rom.gb

or

./gbemu rom.gb 4

if you want a bigger window (in this case the window will be 4 times bigger than the normal).

Buttons

Game Boy Keyboard
A A
B S
Arrows Arrows
Start Space
Select Enter

Testing

To run the tests:

make test

In addition to check the correctness of the code, the tests also check if there are memory leaks (using valgrind).

Some tests are handwritten, but there is also a test that opens a window that runs a test ROM. Use

make blarrg

to run it.

Thanks to Blargg's tests roms.

Coverage

To generate the code coverage you need to pass the flag -DCOVERAGE=ON when building the project with CMake. Then the target coverage will be available. gcovr is required.

The command

make coverage

will generate the coverage/coverage.html file with all the statistics about the coverage (remember to run make test and make blargg first).

Undefined behaviours

To check undefined behaviours you need to pass the -DUSAN=ON when building the project with CMake.

Documentation

To create the documentation:

make doc

The doc folder will be created inside the root folder of the project.

To use this command Doxygen is required. OPTIONAL: you will also need the texlive-font-utils package to have a LaTeX documentation.

TODO

  • GameBoy Color support

  • Audio

References

Images

Homescreen Gameplay