Skip to content

Commit 37da4c6

Browse files
committed
Fixed conflicts
2 parents 87008dc + cb07d27 commit 37da4c6

File tree

358 files changed

+20952
-22441
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

358 files changed

+20952
-22441
lines changed

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[submodule "tests/test_runner/test_roms"]
2+
path = tests/test_runner/test_roms
3+
url = https://github.com/nnarain/gb-test-roms.git
4+
[submodule "src/tools/gbdebugger/src/external/imgui"]
5+
path = src/tools/gbdebugger/src/external/imgui
6+
url = https://github.com/Flix01/imgui.git
7+
[submodule "src/tools/gbdebugger/src/external/imgui-sfml"]
8+
path = src/tools/gbdebugger/src/external/imgui-sfml
9+
url = https://github.com/eliasdaler/imgui-sfml.git

.travis.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ os:
77
compiler:
88
- g++
99

10+
addons:
11+
apt:
12+
packages:
13+
- lcov
14+
1015
before_install:
1116
- git clone --depth=1 https://github.com/nnarain/travis-ci-scripts.git ~/scripts
1217
- cd ~/scripts/ && ./bootstrap && cd -
@@ -19,20 +24,25 @@ install:
1924

2025
script:
2126
- mkdir build && cd build
22-
- cmake .. -DBUILD_EXAMPLE="OFF" -DBUILD_DOCS="ON" -DCMAKE_BUILD_TYPE=Release
23-
- make && make check
27+
- cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DWITH_COVERAGE=ON -DBUILD_DOCS="ON"
28+
- make
29+
- make check
30+
- make run_test_roms
2431
- cd ..
2532

2633
after_success:
27-
- ./scripts/travis_deploy_docs $TRAVIS_BRANCH $GITHUB_API_TOKEN
34+
- "./scripts/travis_deploy_docs $TRAVIS_BRANCH $GITHUB_API_TOKEN"
2835
- cd build
2936
- make package
3037
- export ARTIFACTS=$(ls -d1 $PWD/*.tar.gz)
3138

39+
- ../scripts/coverage
40+
- bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
41+
3242
deploy:
3343
provider: releases
3444
api_key:
35-
secure: d/qxX3lQXZg8gzABz8+IonCqCDbQSA0TCefBMnzZETvkKuZSCk7HoUxt1yVUPaybHSEP06uqyKI0qar7o48K2SLR3AakhmpUAfmrNRlCFYSzrUUag0vJXVsKR24g5T0aYQj8IHcYwWGQZ9/pZRcuCjtKee60ey40g3LzSO8/mRH7+96uAORLh5HsY1JvFJ/q1cnZQKG2+WNX8cw78NvTDzZb7zyeNiPLNmjvG6Hqys/qp2icSui6vLPKzaNm9r8mutk0tUdYY/RxsFt3auzkDeRGYLJyeRtM+OuIya7CmB5bsEi7AhwnFsTOfKL76Fpi7plKZ3nFUpjb3vIWb1M55ZIe2xd5qhzYTcG5NEOBVehcz+7WS7wlzlivrY9jrXQgMeJY/aBH5XsWRzL0i0fQt6NHF+gr2jOrDoHEPYTeBzoQEe8xX7f5IoHAxcn592UD3wno1K058WWb4wiXVITqhldJdDtRAIR9LQ1M7ieZiz/L6yf7/ScR5+HOkvkz/ipoCPKPR4CEikMq8loJDaJNv3OlV+I4XWh/yQR+Q4gSpZ/nizASgJIoOWI2OXGrTrassVfJeR8OmNQ9piuiUUxjdK8Z0SOPKphxVlKsyDpbVZ2vb+lfqLV8gl/t20/L1a1ZQhbWHK3XvQsuoHK2R1SKI/MOoF6DeQ7jRont8UMhoeE=
45+
secure: tkje4Q6TX/nuFFvyEnpltnaonPlf17Mcjxg8+Lb8QjH+3bF4E1emGZ+TYyl1oHtW8ePAFQjudEUtYPdPJayLJ/5iNtofMS5s7OPTB3cuhAFBcseHaTxzaHcLDHDmDqyQGtq3kOc7fxV0qRtGHrPVSRXRM7GaswIfCLxNkrOGUNR0qfZ3vNLrEy78kgR9HaUwCrA9IC7Esbgv6FFy4PKO+fOv7mowgjfvBw3piaL1yDBPKioKKE6g/NZRXdjOQxhwFnB2Z5JRM+qVuJwbJd3QGCFX0AJMSNnf3j+dy6tPsi/gzmWUuibjqFC7mvOVv32nU1CixLRV8t+Eo7Nz37/5+fPIMzkQmSpSdvMyfigL9jYz8ue3ZFeTRTLyradJJTA7A8tUIFwR+j/0hJuW/ahxppj7Sade70jDq+gLkghbpELQRU4GE/+7E+AYeQ8dCIl7boJNASoGXXBnDogj8n1oKwEAhNttUJ+L2yR7u99j6KpQhYCBo9tW+C+piwYrULtG9/oWnwfQbAuzcUnJzHk6U19XQBI1hoOETHBn3/1Wzsaj3aldZEDU8sybUhzy9ZUt3Ux9v3GdaW+TGbblMHkhIJte9pJWS3iq5H6FUbnFw8nV61XoAYE574FcRD5ovn1/gi/AJuAWuTV5szHlFzRZEULdJXVmmayQ3nmdEU0yM/I=
3646
file: "${ARTIFACTS}"
3747
skip_cleanup: true
3848
on:

CMakeLists.txt

Lines changed: 6 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -11,156 +11,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Mo
1111

1212
project(gameboycore)
1313

14-
# test endianness of system
15-
include(TestBigEndian)
14+
option(BUILD_DOCS "Build documentation" OFF)
1615

17-
test_big_endian(IS_BIG_ENDIAN)
16+
set(CMAKE_MODULE_PATH ${CMAKE_PREFIX_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
17+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
1818

19-
if(IS_BIG_ENDIAN)
20-
message("-- Setting __BIGENDIAN__")
21-
set(ENDIAN "__BIGENDIAN__")
22-
else(IS_BIG_ENDIAN)
23-
message("-- Setting __LITTLEENDIAN__")
24-
set(ENDIAN "__LITTLEENDIAN__")
25-
endif(IS_BIG_ENDIAN)
26-
27-
# Core sources for Gameboy emulation
28-
set(GAMEBOYCORE_API_HEADERS
29-
include/gameboycore/gameboycore_api.h
30-
include/gameboycore/gameboycore.h
31-
include/gameboycore/cpu.h
32-
include/gameboycore/mmu.h
33-
include/gameboycore/gpu.h
34-
include/gameboycore/apu.h
35-
include/gameboycore/joypad.h
36-
include/gameboycore/link.h
37-
include/gameboycore/link_cable.h
38-
include/gameboycore/pixel.h
39-
include/gameboycore/sprite.h
40-
)
41-
42-
set(GAMEBOYCORE_HEADERS
43-
${GAMEBOYCORE_API_HEADERS}
44-
include/gameboycore/alu.h
45-
include/gameboycore/tileram.h
46-
include/gameboycore/tilemap.h
47-
include/gameboycore/oam.h
48-
include/gameboycore/tile.h
49-
include/gameboycore/timer.h
50-
include/gameboycore/interrupt_provider.h
51-
include/gameboycore/palette.h
52-
include/gameboycore/detail/audio/square_wave_channel.h
53-
include/gameboycore/detail/audio/wave_channel.h
54-
include/gameboycore/detail/audio/noise_channel.h
55-
include/gameboycore/channel.h
56-
include/gameboycore/memorymap.h
57-
include/gameboycore/mbc.h
58-
include/gameboycore/mbc1.h
59-
include/gameboycore/mbc2.h
60-
include/gameboycore/mbc3.h
61-
include/gameboycore/mbc5.h
62-
include/gameboycore/rtc.h
63-
include/gameboycore/cartinfo.h
64-
include/gameboycore/opcodeinfo.h
65-
include/gameboycore/opcode_cycles.h
66-
src/core/bitutil.h
67-
src/core/shiftrotate.h
68-
)
69-
70-
set(GAMEBOYCORE
71-
src/core/gameboycore.cpp
72-
src/core/cpu.cpp
73-
src/core/mmu.cpp
74-
src/core/gpu.cpp
75-
src/core/apu.cpp
76-
src/core/joypad.cpp
77-
src/core/link.cpp
78-
src/core/link_cable.cpp
79-
src/core/mbc.cpp
80-
src/core/mbc1.cpp
81-
src/core/mbc2.cpp
82-
src/core/mbc3.cpp
83-
src/core/mbc5.cpp
84-
src/core/alu.cpp
85-
src/core/cartinfo.cpp
86-
src/core/shiftrotate.cpp
87-
src/core/opcodeinfo.cpp
88-
src/core/tileram.cpp
89-
src/core/tilemap.cpp
90-
src/core/oam.cpp
91-
src/core/timer.cpp
92-
)
93-
94-
# compiler specific flags
95-
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
96-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -Wno-format-security")
97-
elseif(MSVC)
98-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 -D_CRT_SECURE_NO_WARNINGS")
99-
endif()
100-
101-
include(version-config)
102-
generate_version_info()
103-
104-
include_directories(
105-
include/
106-
${CMAKE_BINARY_DIR}
107-
)
108-
109-
add_definitions(
110-
-D${ENDIAN}
111-
)
112-
113-
# Gameboy Core Library
114-
add_library(${PROJECT_NAME} SHARED
115-
${GAMEBOYCORE}
116-
${GAMEBOYCORE_HEADERS}
117-
)
118-
set_target_properties(${PROJECT_NAME} PROPERTIES
119-
COMPILE_FLAGS "-DGAMEBOYCORE_EXPORT"
120-
)
121-
122-
add_library(${PROJECT_NAME}-s STATIC
123-
${GAMEBOYCORE}
124-
${GAMEBOYCORE_HEADERS}
125-
)
126-
set_target_properties(${PROJECT_NAME}-s PROPERTIES
127-
COMPILE_FLAGS "-DGAMEBOYCORE_STATIC"
128-
)
129-
130-
# example
131-
if(NOT DEFINED BUILD_EXAMPLE)
132-
set(BUILD_EXAMPLE "ON")
133-
endif(NOT DEFINED BUILD_EXAMPLE)
134-
135-
if(BUILD_EXAMPLE STREQUAL "ON")
136-
add_subdirectory(src/example)
137-
endif(BUILD_EXAMPLE STREQUAL "ON")
138-
139-
# Tests
140-
if(NOT DEFINED BUILD_TESTS)
141-
set(BUILD_TESTS "ON")
142-
endif(NOT DEFINED BUILD_TESTS)
143-
144-
if(BUILD_TESTS STREQUAL "ON")
145-
enable_testing()
146-
add_subdirectory(tests)
147-
endif(BUILD_TESTS STREQUAL "ON")
148-
149-
# install core
150-
install(
151-
TARGETS ${PROJECT_NAME} ${PROJECT_NAME}-s
152-
ARCHIVE DESTINATION lib
153-
LIBRARY DESTINATION lib
154-
RUNTIME DESTINATION bin
155-
COMPONENT development
156-
)
157-
158-
# install headers
159-
install(
160-
FILES ${GAMEBOYCORE_API_HEADERS}
161-
DESTINATION include/gameboycore
162-
COMPONENT development
163-
)
19+
add_subdirectory(src)
16420

16521
# Installation
16622
include(get-version-config)
@@ -186,11 +42,7 @@ set(CPACK_COMPONENT_PROGRAMS_DISPLAY_NAME "Programs")
18642
include(CPack)
18743

18844
# documentation
189-
if(NOT DEFINED BUILD_DOCS)
190-
set(BUILD_DOCS "OFF")
191-
endif(NOT DEFINED BUILD_DOCS)
192-
193-
if(BUILD_DOCS STREQUAL "ON")
45+
if(BUILD_DOCS)
19446
find_package(Doxygen)
19547
if(DOXYGEN_FOUND)
19648
configure_file(docs/Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile @ONLY)
@@ -200,4 +52,4 @@ if(BUILD_DOCS STREQUAL "ON")
20052
COMMENT "Building documentation"
20153
)
20254
endif(DOXYGEN_FOUND)
203-
endif(BUILD_DOCS STREQUAL "ON")
55+
endif(BUILD_DOCS)

README.md

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Build Status](https://travis-ci.org/nnarain/gameboycore.svg?branch=develop)](https://travis-ci.org/nnarain/gameboycore)
44
[![Build status](https://ci.appveyor.com/api/projects/status/jkrjhds3i67o5k76/branch/develop?svg=true)](https://ci.appveyor.com/project/nnarain/gameboycore/branch/develop)
5-
[![GitHub issues](https://img.shields.io/github/issues/nnarain/gameboycore.svg)](https://github.com/nnarain/gameboycore/issues)
5+
[![codecov](https://codecov.io/gh/nnarain/gameboycore/branch/master/graph/badge.svg)](https://codecov.io/gh/nnarain/gameboycore)
66
[![GitHub release](https://img.shields.io/github/release/nnarain/gameboycore.svg)](https://github.com/nnarain/gameboycore/releases)
77

88
GameboyCore is a Gameboy/Gameboy Color emulator library written in C++.
@@ -20,25 +20,59 @@ GameboyCore running as:
2020

2121
The above application are somewhat incomplete however they all demonstrate GameboyCore working for the given environment.
2222

23-
Examples
23+
Building
2424
--------
2525

26-
The GameboyCore repo includes an [example project](https://github.com/nnarain/gameboycore/tree/master/src/example).
26+
The `GameboyCore` library does not have any dependencies and can be compiled using any C++11 compiler. The tools contained in this repo, however, do have additional dependencies that need to be installed. All dependencies should be findable by CMake.
2727

28-
Build
29-
-----
28+
Fetch source:
3029

31-
**Build Options**
30+
```bash
31+
git clone https://github.com/nnarain/gameboycore
32+
cd gameboycore
33+
git submodule update --init --recursive
34+
```
3235

33-
* `BUILD_DOCS`
34-
* `BUILD_EXAMPLE`
35-
* `BUILD_TESTS`
36+
To build the library, simply run `cmake`.
3637

37-
~~~~~~~~~~~~~~~~~~~~~~~~~~{.sh}
38-
cd path/to/project/
38+
```bash
3939
mkdir build && cd build
40-
cmake .. -DBUILD_EXAMPLE="<ON/OFF>"
41-
make
42-
~~~~~~~~~~~~~~~~~~~~~~~~~~
40+
cmake ..
41+
cmake --build . --target gameboycore
42+
```
43+
44+
**Building Tests**
45+
46+
Install `gtest` and build with `BUILD_TESTS=ON`. Optionally you can setup benchmarks by installing `google-benchmark`.
47+
48+
```bash
49+
cmake .. -DBUILD_TESTS=ON
50+
cmake --build . --target check
51+
cmake --build . --target bench
52+
```
53+
54+
A few test ROMs can be run as well.
55+
56+
```bash
57+
cmake --build . --target run_test_roms
58+
```
59+
60+
Only the test ROMs that print to the serial port are run. Of course any test ROM can be run with the debugger tool.
61+
62+
63+
**Building Tools**
64+
65+
Enable building tools by specifying `BUILD_TOOLS=ON`. If building tools is enabled, all will be built by default. Disable building tools with `WITH_<tool name>=OFF`.
66+
67+
All tools are compiled with the latest C++ standard.
68+
69+
Debugger:
70+
71+
* Used for running Gameboy ROMs and inspecting the core
72+
* Depends on SFML
73+
74+
RomInfo
75+
76+
* Used for printing the information in the ROM header
77+
4378

44-
Note: Building the example required SFML to be findable by CMake.

0 commit comments

Comments
 (0)