Skip to content

Commit

Permalink
Support building on Windows and Linux
Browse files Browse the repository at this point in the history
Add GitHub workflow action.
  • Loading branch information
matthewwalsh0 committed Sep 16, 2020
1 parent d12d5ee commit 9fb8a13
Show file tree
Hide file tree
Showing 49 changed files with 120 additions and 55 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: build

on: [push]

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]

steps:
- uses: actions/checkout@v2

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE
6 changes: 3 additions & 3 deletions include/APU.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef MBOY_ANDROID_APU_H
#define MBOY_ANDROID_APU_H

#include <sys/types.h>
#include "Types.h"
#include "GUI.h"
#include "SquareChannel.h"
#include "WaveChannel.h"
Expand Down Expand Up @@ -32,9 +32,9 @@ class APU {
u_int32_t volumeEnvelopeCounter = 0;
bool ready = false;
bool power = false;
struct config* config;
Config* config;
public:
APU(GUI* gui, Memory* memory, struct config* config);
APU(GUI* gui, Memory* memory, Config* config);
void step(u_int16_t lastInstructionDuration, u_int32_t count);
};

Expand Down
2 changes: 1 addition & 1 deletion include/BackgroundAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define MBOY_ANDROID_BACKGROUNDATTRIBUTES_H


#include <sys/types.h>
#include "Types.h"

class BackgroundAttributes {
public:
Expand Down
2 changes: 1 addition & 1 deletion include/Bytes.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MY_APPLICATION_BYTES_H
#define MY_APPLICATION_BYTES_H

#include <sys/types.h>
#include "Types.h"

class Bytes {
public:
Expand Down
2 changes: 1 addition & 1 deletion include/CPU.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef MY_APPLICATION_CPU_H
#define MY_APPLICATION_CPU_H

#include <sys/types.h>
#include "Types.h"

#include "MemoryHook.h"
#include "LogFile.h"
Expand Down
2 changes: 1 addition & 1 deletion include/ColourPalette.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define MBOY_ANDROID_COLOURPALETTE_H


#include <sys/types.h>
#include "Types.h"
#include "Tile.h"

class ColourPalette {
Expand Down
2 changes: 1 addition & 1 deletion include/ColourPaletteData.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MBOY_ANDROID_COLOURPALETTEDATA_H
#define MBOY_ANDROID_COLOURPALETTEDATA_H

#include <sys/types.h>
#include "Types.h"
#include "Tile.h"

class ColourPaletteData {
Expand Down
2 changes: 1 addition & 1 deletion include/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "Tile.h"
#include "TileSet.h"

struct config {
struct Config {
bool background = true;
bool window = true;
bool sprites = true;
Expand Down
2 changes: 1 addition & 1 deletion include/Control.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MY_APPLICATION_CONTROL_H
#define MY_APPLICATION_CONTROL_H

#include <sys/types.h>
#include "Types.h"
#include "MemoryHook.h"

class Control {
Expand Down
2 changes: 1 addition & 1 deletion include/CoreMemory.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef MY_APPLICATION_COREMEMORY_H
#define MY_APPLICATION_COREMEMORY_H

#include <sys/types.h>
#include "Types.h"

class CoreMemory {
private:
Expand Down
4 changes: 2 additions & 2 deletions include/Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class Display {
private:
MemoryHook* memory;
struct config* config;
Config* config;
Sprite* spriteCache[40];
public:
TileMap tileMap_0;
Expand All @@ -23,7 +23,7 @@ class Display {
ColourPaletteData backgroundColourPaletteData;
ColourPaletteData spriteColourPaletteData;

Display(MemoryHook* memory, struct config* config);
Display(MemoryHook* memory, Config* config);
void drawLine(Pixels* pixels, u_int8_t line, bool isColour, Control* control);
void clearSprite(u_int16_t address);
void invalidateTile(TileMap* tileMap, u_int16_t address);
Expand Down
6 changes: 3 additions & 3 deletions include/GPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MY_APPLICATION_GPU_H
#define MY_APPLICATION_GPU_H

#include <sys/types.h>
#include "Types.h"
#include "Control.h"
#include "Pixels.h"
#include "Display.h"
Expand Down Expand Up @@ -37,15 +37,15 @@ class GPU {
u_int16_t frameCount = 0;
u_int16_t hdmaTarget = 0;
u_int16_t hdmaSource = 0;
struct config* config;
Config* config;

public:
u_int16_t line;
u_int16_t coincidenceLine;

Display display;

GPU(Memory* memory, GUI* gui, struct config* config);
GPU(Memory* memory, GUI* gui, Config* config);
void step(u_int16_t lastInstructionDuration, MemoryHook* memory, bool isColour, u_int32_t count);
u_int8_t getStat();
void setStat(u_int8_t value);
Expand Down
2 changes: 1 addition & 1 deletion include/GUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MY_APPLICATION_GUI_H
#define MY_APPLICATION_GUI_H

#include <sys/types.h>
#include "Types.h"

const u_int8_t BUTTON_START = 0;
const u_int8_t BUTTON_SELECT = 1;
Expand Down
4 changes: 2 additions & 2 deletions include/Gameboy.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class Gameboy {
Timer timer;
Joypad joypad;
GUI* gui;
config* config;
Config* config;
public:
Gameboy(std::string path, GUI* gui, struct config* config);
Gameboy(std::string path, GUI* gui, Config* config);
void run();
};

Expand Down
2 changes: 1 addition & 1 deletion include/Instructions.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MY_APPLICATION_INSTRUCTIONS_H
#define MY_APPLICATION_INSTRUCTIONS_H

#include <sys/types.h>
#include "Types.h"
#include "CPU.h"
#include "MemoryHook.h"

Expand Down
2 changes: 1 addition & 1 deletion include/Joypad.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef MBOY_ANDROID_JOYPAD_H
#define MBOY_ANDROID_JOYPAD_H

#include <sys/types.h>
#include "Types.h"

#include "GUI.h"
#include "Memory.h"
Expand Down
2 changes: 1 addition & 1 deletion include/MBC1.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MBOY_ANDROID_MBC1_H
#define MBOY_ANDROID_MBC1_H

#include <sys/types.h>
#include "Types.h"
#include "MemoryHook.h"
#include "Rom.h"

Expand Down
2 changes: 1 addition & 1 deletion include/MBC3.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MBOY_ANDROID_MBC3_H
#define MBOY_ANDROID_MBC3_H

#include <sys/types.h>
#include "Types.h"
#include "MemoryHook.h"
#include "Rom.h"

Expand Down
2 changes: 1 addition & 1 deletion include/MBC5.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MBOY_ANDROID_MBC5_H
#define MBOY_ANDROID_MBC5_H

#include <sys/types.h>
#include "Types.h"
#include "MemoryHook.h"
#include "Rom.h"

Expand Down
2 changes: 1 addition & 1 deletion include/Memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MY_APPLICATION_MEMORY_H
#define MY_APPLICATION_MEMORY_H

#include <sys/types.h>
#include "Types.h"
#include <functional>
#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion include/MemoryHook.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MY_APPLICATION_MEMORYHOOK_H
#define MY_APPLICATION_MEMORYHOOK_H

#include <sys/types.h>
#include "Types.h"

class MemoryHook {
public:
Expand Down
2 changes: 1 addition & 1 deletion include/MemoryMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MY_APPLICATION_MEMORYMAP_H
#define MY_APPLICATION_MEMORYMAP_H

#include <sys/types.h>
#include "Types.h"

// CPU + Timer
const u_int16_t ADDRESS_DIVIDER = 0xFF04;
Expand Down
2 changes: 1 addition & 1 deletion include/MemoryRegister.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef MY_APPLICATION_MEMORYREGISTER_H
#define MY_APPLICATION_MEMORYREGISTER_H

#include <sys/types.h>
#include "Types.h"
#include <functional>

#include "MemoryHook.h"
Expand Down
2 changes: 1 addition & 1 deletion include/NoiseChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MBOY_ANDROID_NOISECHANNEL_H
#define MBOY_ANDROID_NOISECHANNEL_H

#include <sys/types.h>
#include "Types.h"

class NoiseChannel {
private:
Expand Down
2 changes: 1 addition & 1 deletion include/Pixels.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MY_APPLICATION_PIXELS_H
#define MY_APPLICATION_PIXELS_H

#include <sys/types.h>
#include "Types.h"

const u_int32_t WHITE = 0xFFFFFFFF;

Expand Down
2 changes: 1 addition & 1 deletion include/Rom.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef MY_APPLICATION_ROM_H
#define MY_APPLICATION_ROM_H

#include <sys/types.h>
#include "Types.h"
#include <string>

#include "MemoryHook.h"
Expand Down
2 changes: 1 addition & 1 deletion include/SaveFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MY_APPLICATION_SAVEFILE_H
#define MY_APPLICATION_SAVEFILE_H

#include <sys/types.h>
#include "Types.h"
#include "Ram.h"
#include <string>
#include <fstream>
Expand Down
2 changes: 1 addition & 1 deletion include/Sprite.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define MBOY_SPRITE_H


#include <sys/types.h>
#include "Types.h"
#include "MemoryHook.h"
#include "Tile.h"

Expand Down
2 changes: 1 addition & 1 deletion include/SquareChannel.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef MBOY_ANDROID_SQUARECHANNEL_H
#define MBOY_ANDROID_SQUARECHANNEL_H

#include <sys/types.h>
#include "Types.h"

class SquareChannel {
private:
Expand Down
6 changes: 3 additions & 3 deletions include/Tile.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MY_APPLICATION_TILE_H
#define MY_APPLICATION_TILE_H

#include <sys/types.h>
#include "Types.h"
#include "MemoryHook.h"
#include "Pixels.h"
#include "VRAM.h"
Expand All @@ -23,8 +23,8 @@ class Tile {
private:
u_int32_t colourIndexes[TILE_SIZE * TILE_SIZE];
bool large;
u_int32_t paletteCache[256 * TILE_SIZE * TILE_SIZE];
bool paletteCacheSet[256 * TILE_SIZE] = {[0 ... 256 * TILE_SIZE - 1] = false};
u_int32_t paletteCache[256 * TILE_SIZE * TILE_SIZE] = { 0 };
bool paletteCacheSet[256 * TILE_SIZE];
public:
Tile(MemoryHook* memory, u_int16_t start, bool large, bool alternateBank);
void drawLine(Pixels* pixels, palette palette, u_int16_t localY,
Expand Down
2 changes: 1 addition & 1 deletion include/TileMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TileMap {
private:
MemoryHook* memory;
u_int16_t end;
bool invalidTiles[TILE_COUNT * TILE_COUNT] = {[0 ... TILE_COUNT * TILE_COUNT - 1] = true};
bool invalidTiles[TILE_COUNT * TILE_COUNT];
bool* disableCache;
public:
u_int16_t start;
Expand Down
4 changes: 2 additions & 2 deletions include/TileSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef MY_APPLICATION_TILESET_H
#define MY_APPLICATION_TILESET_H

#include <sys/types.h>
#include "Types.h"
#include "MemoryHook.h"
#include "Tile.h"

Expand All @@ -14,7 +14,7 @@ class TileSet {
u_int16_t start;
bool isSigned;
Tile* tileCache[1024 * 2];
bool tileCacheSet[1024 * 2] = {[0 ... 2047] = false};
bool tileCacheSet[1024 * 2];
MemoryHook* memory;
bool* disableCache;
public:
Expand Down
2 changes: 1 addition & 1 deletion include/Timer.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef MY_APPLICATION_TIMER_H
#define MY_APPLICATION_TIMER_H

#include <sys/types.h>
#include "Types.h"

#include "Memory.h"

Expand Down
18 changes: 18 additions & 0 deletions include/Types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef TYPES_H
#define TYPES_H

#ifdef _WIN32

#include <stdint.h>

typedef uint8_t u_int8_t;
typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;

#else

#include <sys/types.h>

#endif

#endif
Loading

0 comments on commit 9fb8a13

Please sign in to comment.