Skip to content

Commit

Permalink
Fix CI Failing Build
Browse files Browse the repository at this point in the history
  • Loading branch information
r41k0u authored Oct 11, 2023
1 parent 96f803a commit 6175ba3
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,29 @@ jobs:
submodules: recursive

- name: install_dependencies
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
sudo apt-get update -y -qq
sudo apt-get install libsdl2-dev
sudo apt-get update && sudo apt-get install xorg-dev libglu1-mesa-dev freeglut3-dev mesa-common-dev libsdl2-dev
fi
if [ "$RUNNER_OS" == "macOS" ]; then
brew install SDL2
brew install SDL2_image
fi
if [ "$RUNNER_OS" == "Windows" ]; then
curl -L -O https://www.libsdl.org/release/SDL2-devel-2.28.4-VC.zip
7z x SDL2-devel-2.28.4-VC.zip -oSDL2
fi
- name: build
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update && sudo apt-get install xorg-dev libglu1-mesa-dev freeglut3-dev mesa-common-dev
if [ "$RUNNER_OS" == "Windows" ]; then
export SDL2_DIR=D:\\a\\gbemu\\gbemu\\SDL2\\SDL2-2.28.4\\cmake
fi
mkdir build
cd build
cmake ..
cmake --build . -j 8
shell: bash
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set(SOURCES
)

target_sources(${PROJECT_NAME} PRIVATE ${SOURCES})

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})

Expand All @@ -27,4 +27,4 @@ endif ()

target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARIES})

set(SDL2_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/include")
set(SDL2_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/include")
11 changes: 8 additions & 3 deletions src/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
#include "mmap.h"
#include <stdio.h>
#include <algorithm>
#include <SDL.h>
#include <vector>

#ifdef __linux__
#include <SDL2/SDL.h>
#else
#include <SDL.h>
#endif

struct Sprite
{
Word address;
Expand Down Expand Up @@ -59,7 +64,7 @@ class PPU
// OBP1 register is the OBJ Palette 1 Data
Byte objPalette1;

// Internal window line counter
// Internal window line counter
Byte hiddenWindowLineCounter;

// The GameBoy screen
Expand Down Expand Up @@ -117,4 +122,4 @@ class PPU
void setMemoryMap(MemoryMap* m) { mMap = m; }
void executePPU(int cycles);
Byte getPPUMode() { return ppuMode; }
};
};
6 changes: 4 additions & 2 deletions src/mmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ void MemoryMap::readInput(Byte value)
ioPorts[0] = current;
}

void MemoryMap::mapRom() {
void MemoryMap::mapRom()
{
// Load the Boot ROM
// Into the first 0x100 bytes
fread(romBank0, 1, 256, bootRomFile);
Expand All @@ -315,7 +316,8 @@ void MemoryMap::mapRom() {
mbcMode = romBank0[0x147];
}

void MemoryMap::unloadBootRom() {
void MemoryMap::unloadBootRom()
{
fseek(romFile, 0x00, SEEK_SET);
fread(romBank0, 1, 256, romFile);
}
4 changes: 2 additions & 2 deletions src/mmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class MemoryMap
private:
Byte mbcMode;

FILE *bootRomFile;
FILE *romFile;
FILE* bootRomFile;
FILE* romFile;

// First ROM Bank
// 16 KB 0x0000 - 0x3FFF
Expand Down

0 comments on commit 6175ba3

Please sign in to comment.