Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CD

on:
push:
tags:
- 'v*'
workflow_dispatch:

defaults:
run:
shell: bash

# required for upload
permissions:
contents: write

jobs:

Linux:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: [ ubuntu-24.04, ubuntu-24.04-arm ]
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: sudo apt update -y && sudo apt install -y build-essential libreadline-dev libsdl2-dev

- name: Build zip
run: make standalone libretro zip

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
*.zip

MacOS:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: [ macos-latest, macos-13 ]
steps:
- uses: actions/checkout@v4

- name: Install
run: brew install sdl2

- name: Build zip
run: make standalone libretro zip

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
*.zip
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches: [ main, master ]
pull_request:
workflow_dispatch:

jobs:
Linux:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: sudo apt update -y && sudo apt install -y build-essential libreadline-dev libsdl2-dev

- name: Continuous Integration
run: make standalone libretro

MacOS:
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: brew install sdl2

- name: Continuous Integration
run: make standalone libretro
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
*.so
*.d
*.gb
*.zip
main
.vscode
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,23 @@ OBJS_STANDALONE = main.o sdl.o debugger.o
OBJS_LIBRETRO = libretro.o debugger-dummy.o

OBJS_STANDALONE := $(patsubst %.o,obj_standalone/%.o,$(OBJS) $(OBJS_STANDALONE))
OBJS_LIBRETRO := $(patsubst %.o,obj_libretro/%.o,$(OBJS) $(OBJS_LIBRETRO))
OBJS_LIBRETRO := $(patsubst %.o,obj_libretro/%.o,$(OBJS) $(OBJS_LIBRETRO))

RM = rm -fv

ARCH := $(shell uname -m)
UNAME_S := $(shell uname -s)

ifeq ($(UNAME_S),Linux)
PLATFORM := linux
else ifeq ($(UNAME_S),Darwin)
PLATFORM := darwin
else ifeq ($(OS),Windows_NT)
PLATFORM := windows
else
PLATFORM := unknown
endif

SDL2_CFLAGS := $(shell pkg-config --cflags sdl2)
SDL2_LDFLAGS := $(shell pkg-config --libs sdl2)

Expand Down Expand Up @@ -48,5 +61,9 @@ clean:
$(RM) $(PROGNAME) $(LIBRETRONAME)
$(RM) -r obj_standalone obj_libretro

zip:
zip -9 -r gbc-${PLATFORM}-${ARCH}.zip ${PROGNAME}
zip -9 -r koengb_libretro-${PLATFORM}-${ARCH}.zip ${LIBRETRONAME}

-include obj_standalone/*.d
-include obj_libretro/*.d
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![CI](https://github.com/koenk/gbc/actions/workflows/ci.yml/badge.svg)](https://github.com/koenk/gbc/actions/workflows/ci.yml)
[![CD](https://github.com/koenk/gbc/actions/workflows/cd.yml/badge.svg)](https://github.com/koenk/gbc/actions/workflows/cd.yml)

# GBC

A simple GameBoy and GameBoy Color emulator written in C.
Expand Down Expand Up @@ -32,9 +35,10 @@ core there are no dependencies for building, but using it requires a compatible
frontend such as Retroarch.

Building and running the standalone frontend can be done as such:

$ make
$ ./main path/to/romfile
```shell
make
./main path/to/romfile
```

Running `./main -h` shows all available options. Button mappings are as follows:

Expand Down Expand Up @@ -74,10 +78,10 @@ Linux, which can run Retroarch via hakchi2, we can run our libretro core on
there as well simply by cross-compiling the code. This requires an ARM
cross-compiler, which can be found on Ubuntu in the `gcc-arm-linux-gnueabihf`
package. Then compiling can be done as such:

$ make clean # To clean up any .o files created for the native architecture
$ make libretro CC=arm-linux-gnueabihf-gcc

```shell
make clean # To clean up any .o files created for the native architecture
make libretro CC=arm-linux-gnueabihf-gcc
```
Copy `koengb_libretro.so` to the SNES mini with hakchi2's FTP in
`/var/lib/hakchi/rootfs/etc/libretro/core`. Create a folder in the games
directory (`/var/lib/hakchi/rootfs/usr/share/games/001`), and modify the
Expand Down