BueniaDev / libmbGB

Game Boy (Color) emulation library, sorta
GNU General Public License v3.0
3 stars 0 forks source link
drawing

Run on Repl.it

Game Boy (Color) emulation library, sorta

The goal here is to do things right and fast (like melonDS). But, also, you know, to have a fun challenge... :)

Features

Able to run most commercial Game Boy (and most commercial Game Boy Color) titles with sound

Game Boy Camera, Game Boy Printer and Barcode Boy support

Exclusive "hybrid mode" that combines the Game Boy Color's DMG mode with emulation of some of the Game Boy's DMG-exclusive bugs, including the STAT IRQ bug that Legend of Zerd (aka. Zerd no Densetsu) relies on

And more to come!

Building Instructions

The libmbGB library does not have any dependencies and can be compiled with MinGW on Windows, and both GCC and Clang on Linux, as well as AppleClang on OSX. The examples contained in this repo, however, do have additional dependencies that need to be installed. All dependencies should be findable by CMake.

Linux:

Step 1: Install dependencies:

Core dependencies:

Optional dependencies:

* SDL2 (for the command-line frontend (and audio in the (currently WIP) Qt frontend)):

    * Debian (not tested): `sudo apt-get install libsdl2-dev`

    * Arch (not tested): `sudo pacman -S sdl2`

    * Fedora (not tested): `sudo dnf install SDL2-devel`

    * OpenSUSE: (not tested): `sudo zypper in libSDL2-devel`

* Qt5 or Qt6 (for the (currently WIP) Qt frontend):
    * Not throughly tested yet, so certain versions might or might not work. 

* In addition, the below commands will install packages for Qt5. Consult your distro to see which Qt6 packages, if any, are available.

    * Debian (not tested): `sudo apt-get install qtbase5-dev qtmultimedia5-dev`

    * Arch (not tested): `sudo pacman -S qt5`

    * Fedora (not tested): `sudo dnf install qt5-qtmultimedia-devel`

    * OpenSUSE (not tested): `sudo zypper in libQt5Multimedia5 libqt5-qtmultimedia-devel libQt5Concurrent-devel`

* OpenCV (for Game Boy Camera support in mbGB-SDL2):

    * Debian (not tested): `sudo apt-get install libopencv-dev`

    * Arch (not tested): `sudo pacman -S opencv`

    * Fedora (not tested): `sudo dnf install opencv opencv-devel`

    * OpenSUSE (not tested): `sudo zypper in opencv opencv-devel`

* OpenGL (for hardware-accelerated OpenGL rendering in mbGB-SDL2):

    * Debian (not tested): `sudo apt-get install libglu1-mesa-dev mesa-common-dev`

    * Arch (not tested): `sudo apt-get install mesa-libgl`

    * Fedora (not tested): `sudo dnf install mesa-libglapi` (if not already installed)

    * OpenSUSE (not tested): `sudo zypper in mesa-libgl-devel`

Step 2: Clone the repository:

git clone --recursive https://github.com/BueniaDev/libmbGB.git
cd libmbGB

Step 3: Compile:

mkdir build && cd build
cmake .. -G "Unix Makefiles" -DBUILD_EXAMPLES="<ON/OFF>" -DBUILD_SDL2="<ON/OFF>" -DBUILD_QT="<ON/OFF>" -DBUILD_QT6="<ON/OFF>" -DCMAKE_BUILD_TYPE="<Debug/Release>"
make -j$(nproc --all)

Mac OS (not tested):

You will need homebrew, a recent version of Xcode and the Xcode command-line tools to build libmbGB. Please note that due to personal financial constraints, libmbGB has not been tested on Mac OS as of yet.

Step 1: Install dependencies:

Step 2: Clone the repository:

git clone --recursive https://github.com/BueniaDev/libmbGB.git
cd libmbGB

Step 3: Tell CMake where your Qt5 is installed (add this line to ~/.profile if you want to make this permanent):

export Qt5_DIR=$(brew --prefix)/opt/qt5

If you choose not to build the Qt5 frontend, skip this step and proceed to step 4.

Step 4: Compile:

mkdir build && cd build
cmake .. -G "Unix Makefiles" -DBUILD_EXAMPLES="<ON/OFF>" -DBUILD_SDL2="<ON/OFF>" -DBUILD_QT="<ON/OFF>" -DCMAKE_BUILD_TYPE="<Debug/Release>""
make -j$(sysctl -n hw.ncpu)

Windows:

You will need MSYS2 in order to install libmbGB. Make sure to run pacman -Syu as needed.

Step 1: Install dependencies:

pacman -Sy --needed base-devel git ${MINGW_PACKAGE_PREFIX}-{cmake,glew,opencv,qt5,SDL2,toolchain}

Step 2: Clone the repository:

git clone --recursive https://github.com/BueniaDev/libmbGB.git
cd libmbGB

Step 3: Compile:

mkdir build && cd build
cmake .. -G "MSYS Makefiles" -DBUILD_EXAMPLES="<ON/OFF>" -DBUILD_SDL2="<ON/OFF>" -DBUILD_WEBCAM="<ON/OFF>" -DBUILD_OPENGL="<ON/OFF>" -DBUILD_QT="<ON/OFF>" -DCMAKE_BUILD_TYPE="<Debug/Release>"
make -j$(nproc --all)
../tools/msys-dist.sh

Known issues

MBC1-based multicart games

MBC1 multicarts, such as Mortal Kombat 1/2 and Bomberman Collection, as well as a few others, currently require the command line argument of "--mbc1m" passed to libmbGB in order to run properly.

However, a fix for this issue is currently in the works.

Plans

Near-term

Medium-term

Long-term

License

drawing

libmbGB is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Copyright

(C) 2022 BueniaDev. This project is not affiliated in any way with Nintendo. Game Boy and Game Boy Color are registered trademarks of Nintendo Co., Ltd.

For information regarding libmbGB's stance on copyright infringement, as well as proof of libmbGB's legality, see the LEGAL.md file in this repository.