Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/im-rises/gameboyemulator

Game Boy Emulator made in C++.
https://github.com/im-rises/gameboyemulator

cplusplus cpp emulator gameboy games

Last synced: 2 months ago
JSON representation

Game Boy Emulator made in C++.

Awesome Lists containing this project

README

        

# GameBoyEmulator


cmakeLogo
cppLogo
cmakeLogo

## Description

Game Boy Emulator developed in C++ using SDL2.
You can compile the program using CMake.
Games like Pokémon aren't working due to the lack of MBC3/MBC5 cartridges implementation.

SDL2 website:

> **Note**
> C++ version 17
> SDL2 version 2.0.14.

## Features

The Emulator features :

- Save-state
- Screenshots
- Different color modes
- Audio
- Xbox/PlayStation controller

## Images

| Tetris | Super Mario Land 2 |
| --- | --- |
| ![tetrisTitleScreen](https://user-images.githubusercontent.com/59691442/150528557-720e411d-2e16-4cc0-9817-167364169358.png) | ![marioLand2TitleScreen](https://user-images.githubusercontent.com/59691442/150528763-29bdaaf0-ca37-4a76-87d7-290d40da1065.png) |

| Kirby's Dream Land | The Legend of Zelda Link's Awakening |
| --- | --- |
| ![kirbyDreamLandTitleScreen](https://user-images.githubusercontent.com/59691442/150528769-c1abc87b-6fae-4989-9481-b69ba493fecc.png) | ![zeldaTitleScreen](https://user-images.githubusercontent.com/59691442/150528776-c72dec37-00a2-42eb-aa3c-4cea48577342.png) |

## Video

## Quickstart

To use the emulator it depends on your system. Please follow the steps in section `Windows` or `Linux`.

All the releases can be found in the link below:
[Source code and releases](https://github.com/Im-Rises/GameBoyEmulator/releases)

You can download the emulator by clicking on one of the Windows or Linux images, depending on your operating system.

### Windows

cmakeLogo

Once download make sure you have the `sdl2.dll` file next to the emulator .exe file, you can start the emulator by doing
a drag and drop of a rom to the .exe file, it will automatically start the game. You can also start the emulator by
typing the following command in your terminal.

```bash
./GameBoyEmulator.exe
```

### Linux

cmakeLogo

Once download you'll need to install the `SDL2 library` by typing one of the following commands :

```shell
sudo apt-get install libsdl2-dev
```

or

```shell
sudo apt-get install libsdl2-2.0-0
```

> **Warning**
> Depending on your Linux distribution the command to install SDL2 may change.

Once it's done, you can start the emulator by doing a drag and drop of a rom on the emulator file, or you can type the
following command:

```bash
./GameBoyEmulator.exe
```

## Compilation

Emulator is supported under Linux and Windows.
The source code provide a `CMakeList.txt` file to compile the emulator.

You can download CMake here:

Linux's users need to install the developer version of SDL2 to compile the Emulator. To install it types the following
command in your terminal:

```shell
sudo apt-get install libsdl2-dev
```

## Emulator controls

### Emulator interface

- F10 : Switch Game Boy's color mode (GreenScale or Grayscale)

- F11 : Switch between Fullscreen and windowed mode

- Escape button/click cross to exit emulation

- O : Create a screenshot of the game in the folder next to tha app (screenshots/)

- P : Pause emulation

- U : Increase emulator audio volume

- J : Decrease emulator audio volume

- B : create save-state

- N : load save-state

- Tab : restart game/emulator

### Use save states

To use a save-state press the B button on your keyboard, it will create a bmp image file named with the name of the game
and the extension .gb.state.bmp. To load it, just press the N on your keyboard to load it when the game is playing.

The save-state is a screenshot of the game, allowing you to know where you're going to resume the game if you use it.

### Screenshots feature

The emulator allow you to do screenshot of the game everytime. You can create one by pushing the IMP key on your
keyboard. The screenshots will be saved in the folder next to the Emulator `screenshots/`.

### Emulator game controls

You can play games with your keyboard and also with Xbox or Playstation controller.

The controller must be connected before you start the emulator. The selected controller will Rumble for you to know
which controller has been selected (for PlayStation user the controller's led will be green).

| Console buttons | Emulator buttons | Xbox Controller | Playstation Controller |
|-----------------|------------------|-----------------|------------------------|
| A | D | B | O |
| B | S | A | X |
| Start | Enter | start | options |
| Select | Space | select | share |
| ← | ← | arrow/joystick | arrow/joystick |
| → | → | arrow/joystick | arrow/joystick |
| ↓ | ↓ | arrow/joystick | arrow/joystick |
| ↑ | ↑ | arrow/joystick | arrow/joystick |

## Ini file

When you download/start the emulator you will get a GameBoyEmulator.ini file. This file allows you to change some
parameters about the emulator.

| Ini file setting | Description |
|------------------|---------------------------------|
| startBios | load or not bios |
| biosPath | set boot-rom path |
| width | window width |
| height | window height |
| colorMode | change color mode (from 0 to 3) |

You can modify each of these parameters manually. To disable the bios load, put the value 0 in

Original .ini file:

```inifile
startBios='0'
biosPath='./dmg_boot.bin'
width='640'
height='576'
colorMode='0'
```

## Emulation color modes

| Zelda Link's Awakening in grayscale | Zelda Link's Awakening in green-scale |
|-------------------------------------|--------------------------------------|
|![zelda_grayscale](https://user-images.githubusercontent.com/59691442/179115301-a6d756c2-f519-459a-ab73-5dd16173e470.png)|![zelda_green-scale](https://user-images.githubusercontent.com/59691442/179115353-5f27ad9a-29df-45f9-82e4-feab011a58b4.png)|

## GitHub Actions

[![CMake](https://github.com/Im-Rises/GameBoyEmulator/actions/workflows/cmake.yml/badge.svg?branch=main)](https://github.com/Im-Rises/GameBoyEmulator/actions/workflows/cmake.yml)

The repository has a GitHub Actions file to verify the good behaviour of the project before merging/pushing to the main
branch with a wrong code.

## Documentations

CMake:

SDL wiki:

Video overview of the Game Boy, to understand the fundamental:

The main documentation about the console:

The boot-rom:

Opcodes map:

Rom/Ram banking:

PPU:

Audio and sound:

SPU:

Test roms I used to debug my emulator:

Other docs (mostly about emulation in general):

## Contributors

Quentin MOREL :

- @Im-Rises
-

[![GitHub contributors](https://contrib.rocks/image?repo=Im-Rises/GameBoyEmulator)](https://github.com/Im-Rises/GameBoyEmulator/graphs/contributors)