Giter Club home page Giter Club logo

sdl2-gnuboy's Introduction

GNUBoy SDL2 Port

Overview

GNU/Linux
OSX
Windows MinGW-w64

A Multiplatform Gameboy Emulator. Free Software.

GNUBoy is a cool, old piece of software. This fork focuses on a multiplatform SDL 2 port. Hopefully this codebase can be helpful to someone in the future or someone interested in learning about C, SDL, or emulator development.

Fork or contribute! Based on GNUBoy and licensed under GNU GPLv2

Blue

Releases

The latest packaged releases are available under the associated workflow. This currently is only for Windows. If you use Linux/MacOS BUILD IT!!!!

Download Versioned Releases: (https://github.com/AlexOberhofer/SDL2-GNUBoy/releases)

Builds: (https://github.com/AlexOberhofer/SDL2-GNUBoy/actions)
Note Builds only provided for windows via mingw64 for each commit
Note The stability of these builds may vary

SDL2 GNUboy pre-compiled binaries will be provided with each release. The source is also provided on the release page and the binaries can be built from the source or from this repository.

For bleeding edge SDL2-GNUBoy - build the master branch. Some stable versions also have branches to build from if need be. Otherwise check the release tab for Windows binaries or build it "the unix way" for *nix / BSD / OSX.

v1.2.2

  • GameBoy and GameBoy Color Bios
  • SDL video bugfixes
  • Restored fullscreen toggle
  • Link cable emulation (*nix)

v1.2.1

  • Audio Bugfixes (No more popping noise on startup)
  • Audio Interface updates
  • Optional confirmation window when closing emulator session

v1.2.0

Thanks to Ryzee119 for his contributions!

  • Many SDL bug fixes
  • Fullscreen / RC file fixes
  • Key rebinding now works
  • Integer scaling (new integer_scale rc variable)
  • Joystick/Gamepad rewrite (new joy_deadzone rc variable)
  • Rumble Support (new joy_rumble_strength rc variable)

v1.1.1

  • Joystick/Gamepad Support
  • New GB classic pallette (Can be changed with rc file)
  • Renderer + Keyboard bugfixes

v1.1.0

  • Builds for more platforms
  • CPU logic fixes
  • Packaging + install scripts
  • SDL2 hardware rendering + scaling

v1.0

  • Supports Linux only

Screenshots

GB GBC
Dr Mario Lemmings
Super Mario :amd Pokemon Yellow
Tetris Pokemom Crystal

Performance

The emulation core of GNUBoy is mainly unmodified except for a number of bugfixes I have ported into this fork.

Accuracy

A number of cpu buxfixes were ported from here

The emulator currently fails only one CPU instruction via blarggs test rom (Windows executable running in wine on Linux):

SDL2GNUBoy v1.2.1

Improvements for v1.2.1:

  • Now compiles for Apple M1 chip.
  • SDL2 audio bugfixes
  • Better controller support + rumble (v1.2.0)
Pokemon Pinball (Now with rumble)
Pinball

SDL2GNUBoy has been compiled and tested on the following platforms:

  • Windows (x86/ARM)
  • Mac (x86/ARM)
  • Linux (x86/ARM)
  • WSL

Status

Version 1.2.2 is in development. See the master branch for bleeding edge SDL2-GNUBoy.

Whats been done

(At this point - this is only a subset of what actually has been done here... but below is a sample)

  • Multiplatform builds

  • SDL2 input implementation

  • SDL1.2 rendering ported to SDL2

  • SDL1.2 sound ported to SDL2

Todo

  • Porting: Emscripten?

  • Add handler for zip files (non-zlib)

Configuring

Sample configuration files are provided in the /rc/ directory of this repository.

Setup configuration from sample (From repository root)

$ cp ./rc/gnuboy.rc.sample ./gnuboy.rc

Example commands and color pallettes are also available in the /rc/ directory.

Configuring Boot ROM

The following bootrom files have been tested, but others may work.

Platform Name SHA1 Notes
GB dmg_boot.bin 4ED31EC6B0B175BB109C0EB5FD3D193DA823339F
GB mgb_boot.bin 4E68F9DA03C310E84C523654B9026E51F26CE7F0 Gameboy Pocket
GBC cgb_boot.bin 1293D68BF9643BC4F36954C1E80E38F39864528D

Building

Build scripts are provided for both native unix applications and for cross compiling via mingw-w64 gcc

Build instructions are provided for both below:

Mac

See the "Linux section" except for a few differences. The Mac build uses Clang by default. Build has been tested on both Intel and M1 Macintoshes.

Installing SDL2:

$ brew install sdl2

Building Mac Binar:y

$ make osx

Linux

This project requires GCC and SDL2 to build for linux. A Makefile has been provided.

Install SDL2 development libraries (Ubuntu):

$ apt-get install libsdl2-dev

Clone github repository:

$ git clone https://github.com/AlexOberhofer/SDL2-GNUBoy.git

Enter project directory:

$ cd sdl2-gnuboy

Build:

$ make linux

Run:

$ ./sdl2gnuboy ./rom

Windows (Cross Compiler)

SDL2 GNUboy can be cross compiled for Windows on Linux (or the Windows Linux Subsystem)

This requires mingw64-w64-gcc and the mingw SDL2 libraries.

These can be installed via the AUR or the SDL website (Extract and place contents in /usr/x86_64-w64-mingw32)

Install libraries (from AUR using yay)

$ yay mingw-w64-gcc

Install MinGW-w64-sdl2

$ yay mingw-w64-sdl2

Clone github repository:

$ git clone https://github.com/AlexOberhofer/SDL2-GNUBoy.git

Enter project directory:

$ cd sdl2-gnuboy

Build:

$ make windows

Run

Windows:

  • Drag and drop rom over executable

(Wine):

$ wine ./sdl2gnuboy.exe ./rom

Run (cmd):

$ ./sdl2gnuboy.exe ./rom

Controls (Keyboard)

Controls are as follows:

ESC - QUIT 
W - UP
S - DOWN
A - LEFT 
D - RIGHT 
Q - A
E - B
ENTER - START
X - SELECT

Controls (Gamepad)

Controls are as follows (Based on Xbox 360 controller layout):

Joy/Pad Up - UP
Joy/Pad Down - DOWN
Joy/Pad Left - LEFT 
Joy/Pad Right - RIGHT 
B - A
A - B
Start - START
Back - SELECT

Porting

The GNUBoy core is extremely fast and portable. Porting documentation can be found in the docs folder.

Repository Directory

  • /lib - Library Code
  • /sys - System dependent code
  • /src - Core emulator logic
  • /include - GNUBoy Header files
  • /docs - Various docs + media from GNUBoy

Developers

Alex Oberhofer

Acknowledgements

See CREDITS for full list of contributors.

Thank you to the original GNUBoy developers. Please see the history branch for their versions. Legacy documentation can be found in the docs folder.

sdl2-gnuboy's People

Contributors

aichingm avatar alexoberhofer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sdl2-gnuboy's Issues

SDL2 Sound Problems

Sound driver makes a pop noise upon startup.

The SDL sound interface needs a rewrite

sys_sleep doesnt guard against negative delays

If the frame time is longer than framelen, the delay will be negative. See

delay = framelen - sys_elapsed(timer);

sys_sleep in nix and windows dont check this and will hang. I encountered this went disabling sound.

Upsteam does this:
https://github.com/rofl0r/gnuboy/blob/1655356c6430c7c68c3c6071e1a44e3bea5066e9/sys/nix/nix.c#L63

Secondly,

pcm_submit always returns 1. This should return 0 if not using sound to fall back to the manual delay

int pcm_submit()
{
#ifdef SOUND
if (!pcm.buf)
return 0;
if (pcm.pos < pcm.len)
return 1;
while (!audio_done)
SDL_Delay(4);
audio_done = 0;
pcm.pos = 0;
#endif
return 1;
}

Both these fixes need to be implemented to allow disabling sound while maintaining accurate timing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.