-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8a934c8
Showing
104 changed files
with
11,211 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
### made using snippets from https://github.com/github/gitignore | ||
|
||
### C++ | ||
# Prerequisites | ||
*.d | ||
|
||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
|
||
### CMake | ||
CMakeCache.txt | ||
CMakeFiles | ||
CMakeScripts | ||
Testing | ||
Makefile | ||
cmake_install.cmake | ||
install_manifest.txt | ||
compile_commands.json | ||
CTestTestfile.cmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
# config project | ||
project(sdgbc CXX) | ||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
# enable debug symbols if no build type is specified | ||
if(CMAKE_BUILD_TYPE STREQUAL "") | ||
set(CMAKE_BUILD_TYPE Debug) | ||
endif() | ||
|
||
# define local include dir | ||
include_directories(include) | ||
|
||
# define executable sources | ||
file(GLOB sdgbc_SOURCES | ||
include/*.h | ||
include/audio/*.h | ||
include/debug/*.h | ||
include/hw/*.h | ||
include/hw/apu/*.h | ||
include/hw/cart/*.h | ||
include/hw/cpu/*.h | ||
include/wxui/*.h | ||
include/wxui/winrc/*.rc # windows resource files | ||
include/wxui/xpm/*.h # icon xpms | ||
include/wxui/xpm/*.xpm | ||
|
||
src/*.cpp | ||
src/audio/*.cpp | ||
src/debug/*.cpp | ||
src/hw/*.cpp | ||
src/hw/apu/*.cpp | ||
src/hw/cart/*.cpp | ||
src/hw/cpu/*.cpp | ||
src/wxui/*.cpp | ||
) | ||
|
||
add_executable(sdgbc WIN32 ${sdgbc_SOURCES}) | ||
|
||
# macro defs for msvc to disable unsafe warnings from wxWidgets headers | ||
if(MSVC) | ||
target_compile_definitions(sdgbc PRIVATE _CRT_SECURE_NO_WARNINGS) | ||
endif() | ||
|
||
# setup our modules path | ||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) | ||
|
||
# if UNIX, find X11 and also find PkgConfig and use it to find GTK | ||
if(UNIX) | ||
find_package(X11 REQUIRED) | ||
if(X11_FOUND) | ||
message(STATUS "X11 found") | ||
include_directories(${X11_INCLUDE_DIR}) | ||
target_link_libraries(sdgbc ${X11_LIBRARIES}) | ||
endif() | ||
|
||
find_package(PkgConfig REQUIRED) | ||
if(PkgConfig_FOUND) | ||
message(STATUS "PkgConfig found") | ||
|
||
pkg_check_modules(GTK REQUIRED gtk+-2.0) | ||
if(GTK_FOUND) | ||
message(STATUS "GTK found") | ||
include_directories(${GTK_INCLUDE_DIRS}) | ||
link_directories(${GTK_LIBRARY_DIRS}) | ||
add_definitions(${GTK_CFLAGS_OTHER}) | ||
target_link_libraries(sdgbc ${GTK_LIBRARIES}) | ||
endif() | ||
endif() | ||
endif() | ||
|
||
# find wxWidgets | ||
find_package(wxWidgets 3.0 REQUIRED core base) | ||
if(wxWidgets_FOUND) | ||
message(STATUS "wxWidgets found") | ||
include(${wxWidgets_USE_FILE}) | ||
target_link_libraries(sdgbc ${wxWidgets_LIBRARIES}) | ||
endif() | ||
|
||
# find SFML | ||
# NOTE: any version above 2.3.1 causes the program to crash due to an X11 | ||
# incompatability for some reason | ||
find_package(SFML 2.3.1 EXACT REQUIRED system window graphics audio) | ||
if(SFML_FOUND) | ||
message(STATUS "SFML found") | ||
include_directories(${SFML_INCLUDE_DIR}) | ||
target_link_libraries(sdgbc ${SFML_LIBRARIES}) | ||
endif() | ||
|
||
# install target and extra pre-reqs | ||
install(TARGETS sdgbc DESTINATION bin) | ||
include(InstallRequiredSystemLibraries) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2017-2018 Sean Dewar (seandewar @ Github) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
# sdgbc | ||
|
||
A software emulator for the Nintendo Game Boy Color written in C++ using SFML | ||
and wxWidgets. Available for Windows and Linux (tested using the MSVC and GCC | ||
compilers). | ||
|
||
![img](https://github.com/seandewar/sdgbc/blob/master/docs/img/gui_pkmn_crystal.png?raw=true "sdgbc running Pokémon Crystal Version") | ||
![img](https://github.com/seandewar/sdgbc/blob/master/docs/img/gui_toy_story_racer.png?raw=true "sdgbc running Toy Story Racer") | ||
![img](https://github.com/seandewar/sdgbc/blob/master/docs/img/gui_loz_dx_dmg_mode.png?raw=true "sdgbc running The Legend of Zelda: Link's Awakening in DMG mode") | ||
|
||
This emulator can run most Game Boy and Game Boy Color games from their ROM dump | ||
files to an acceptable level of accuracy, including those requiring MBC1, MBC2, MBC3 | ||
(with minimal RTC) and MBC5 (without Rumble) support. | ||
|
||
sdgbc was developed as a final year BSc. computer science project at the University | ||
of Leicester, UK. | ||
A copy of the submitted dissertation and viva presentation slides can be | ||
found in the `docs` directory. | ||
|
||
|
||
## Building | ||
|
||
sdgbc is configured to be built using CMake (version 3.5 or above). The code relies | ||
on some C++14 features, and thus, requires a C++14 standard-compliant compiler. | ||
|
||
The following instructions assume some familiarity with CMake. Running `cmake-gui` | ||
or `ccmake` is recommended to easily follow these instructions: | ||
|
||
|
||
### Building for Windows | ||
|
||
*The following has been tested using CMake 3.5, MSVC 14, wxWidgets 3.0.1 and SFML | ||
2.4.1:* | ||
|
||
1. Launch CMake. | ||
2. Set the source code directory to the sdgbc repository root directory. | ||
3. Set the binary output directory to any directory you wish. | ||
4. Create a `PATH` cache variable called `SFML_ROOT`. Set it to root directory of | ||
your SFML installation. | ||
5. Create a `PATH` cache variable called `wxWidgets_ROOT_DIR`. Set it to root | ||
directory of your wxWidgets installation. | ||
6. Create a `PATH` cache variable called `wxWidgets_LIB_DIR`. Set it to the | ||
`lib\vc140_dll` directory of your wxWidgets installation. | ||
7. Configure the project using the `Visual Studio 14 2015` generator. | ||
8. Generate the project file. A `sdgbc.sln` Visual Studio solution file will be | ||
created inside of the specified binary output directory. | ||
|
||
After opening the solution file in Visual Studio, press Ctrl+F5 to build and run | ||
the software (without debugging). | ||
|
||
|
||
### Building for Linux | ||
|
||
*The following has been tested using CMake 3.5, GCC 5.4, wxWidgets 3.0.1 and SFML | ||
2.3.1:* | ||
**(You may experience some X11 compatibility issues running the software with any | ||
version of SFML greater than 2.3.1!)** | ||
|
||
1. Launch CMake. | ||
2. Set the source code directory to the sdgbc repository root directory. | ||
3. Set the binary output directory to any directory you wish. | ||
4. Create a `PATH` cache variable called `SFML_ROOT`. Set it to root directory of | ||
your SFML installation. | ||
5. Configure the project using the `Unix Makefile` generator. | ||
6. Generate the makefile. It will be created inside of the specified binary output | ||
directory. | ||
|
||
Using a shell, change your current working directory to the binary output directory | ||
and run `make`. | ||
This can be done using sh or bash by running the following command: | ||
|
||
```bash | ||
cd BINARY_DIR_PATH && make | ||
``` | ||
|
||
|
||
## Running | ||
|
||
The emulator can be ran in a GUI mode by simply opening the built `sdgbc` executable | ||
file. The emulated joypad can be interacted with using the keyboard as follows: | ||
|
||
| Joypad Key | Keyboard Key | | ||
| ---------- | ------------ | | ||
| D-pad Keys | Arrow Keys | | ||
| B | Z | | ||
| A | X | | ||
| Start | Return | | ||
| Select | Shift | | ||
|
||
![img](https://github.com/seandewar/sdgbc/blob/master/docs/img/cpu_cmd.png?raw=true "sdgbc running with the --cpu-cmd command-line argument") | ||
|
||
Additionally, a command-line interface for debugging the emulated CPU is | ||
available for use. It can be accessed by passing the `--cpu-cmd` argument to | ||
the program. A list of commands can be found by executing the `help` command. | ||
|
||
Optionally, a path to a GB or GBC ROM file can be given via the command-line | ||
arguments for both modes: | ||
* `sdgbc ROM_PATH` *(for the main GUI mode)* | ||
* `sdgbc --cpu-cmd ROM_PATH` *(for the command-line CPU debugger mode)* | ||
|
||
|
||
## License | ||
|
||
The software is distributed using the MIT license as follows: | ||
|
||
``` | ||
The MIT License (MIT) | ||
Copyright (c) 2017-2018 Sean Dewar (seandewar @ Github) | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
``` |
Oops, something went wrong.