Ports: Add mGBA

This commit is contained in:
Luke Wilde 2022-04-13 17:22:56 +01:00 committed by Linus Groh
parent 5d6c5571c4
commit a9a90b1b58
Notes: sideshowbarker 2024-07-17 11:50:18 +09:00
5 changed files with 65 additions and 0 deletions

View file

@ -132,6 +132,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
| [`mawk`](mawk/) | mawk | 1.3.4-20200120 | https://invisible-island.net/mawk/ | | [`mawk`](mawk/) | mawk | 1.3.4-20200120 | https://invisible-island.net/mawk/ |
| [`mbedtls`](mbedtls/) | Mbed TLS | 2.16.2 | https://tls.mbed.org/ | | [`mbedtls`](mbedtls/) | Mbed TLS | 2.16.2 | https://tls.mbed.org/ |
| [`mc`](mc/) | Midnight Commander | 4.8.27 | http://midnight-commander.org/ | | [`mc`](mc/) | Midnight Commander | 4.8.27 | http://midnight-commander.org/ |
| [`mgba`](mgba/) | Game Boy, Game Boy Color and Game Boy Advance emulator | 0.9.3 | https://mgba.io/ |
| [`milkytracker`](milkytracker/) | milkytracker | 1.03.00 | https://github.com/milkytracker/MilkyTracker | | [`milkytracker`](milkytracker/) | milkytracker | 1.03.00 | https://github.com/milkytracker/MilkyTracker |
| [`mold`](mold/) | A Modern Linker | 1.0.2 | https://github.com/rui314/mold | | [`mold`](mold/) | A Modern Linker | 1.0.2 | https://github.com/rui314/mold |
| [`mpc`](mpc/) | GNU Multiple Precision Complex Library (MPC) | 1.2.1 | http://www.multiprecision.org/mpc/ | | [`mpc`](mpc/) | GNU Multiple Precision Complex Library (MPC) | 1.2.1 | http://www.multiprecision.org/mpc/ |

16
Ports/mgba/package.sh Executable file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env -S bash ../.port_include.sh
port=mgba
version=0.9.3
files="https://github.com/mgba-emu/mgba/archive/refs/tags/${version}.tar.gz mgba-${version}.tar.gz 692ff0ac50e18380df0ff3ee83071f9926715200d0dceedd9d16a028a59537a0"
auth_type=sha256
configopts=("-DCMAKE_TOOLCHAIN_FILE=${SERENITY_BUILD_DIR}/CMakeToolchain.txt")
useconfigure=true
depends=("SDL2" "zlib" "sqlite" "libpng" "libzip")
configure() {
run cmake "${configopts[@]}"
}
install() {
run make install
}

View file

@ -0,0 +1,23 @@
# Patches for mGBA on SerenityOS
## `serenity-does-not-support-futimens-or-futimes.patch`
We do not currently support futimens or futimes. [futimens is a POSIX function,](https://pubs.opengroup.org/onlinepubs/9699919799/)
so this is an issue on our side.
### Status
- [ ] Local?
- [ ] Should be merged to upstream?
- [X] Resolves issue(s) with our side of things
- [ ] Hack
## `use-sdl-software-renderer-with-no-vsync.patch`
This makes us use the SDL software renderer with no vsync, as our SDL2 port does not currently support accelerated rendering
or vsync.
### Status
- [ ] Local?
- [ ] Should be merged to upstream?
- [X] Resolves issue(s) with our side of things
- [ ] Hack

View file

@ -0,0 +1,14 @@
--- mgba-0.9.3/src/util/vfs/vfs-fd.c 2021-12-18 01:56:32.000000000 +0000
+++ mgba-0.9.3.serenity/src/util/vfs/vfs-fd.c 2022-04-13 02:50:08.792765951 +0100
@@ -200,11 +200,6 @@
UNUSED(size);
struct VFileFD* vfd = (struct VFileFD*) vf;
#ifndef _WIN32
-#ifdef __HAIKU__
- futimens(vfd->fd, NULL);
-#else
- futimes(vfd->fd, NULL);
-#endif
if (buffer && size) {
return msync(buffer, size, MS_ASYNC) == 0;
}

View file

@ -0,0 +1,11 @@
--- mgba-0.9.3/src/platform/sdl/sw-sdl2.c 2021-12-18 01:56:32.000000000 +0000
+++ mgba-0.9.3.serenity/src/platform/sdl/sw-sdl2.c 2022-04-13 02:50:08.760766286 +0100
@@ -25,7 +25,7 @@
renderer->window = SDL_CreateWindow(projectName, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, renderer->viewportWidth, renderer->viewportHeight, SDL_WINDOW_OPENGL | (SDL_WINDOW_FULLSCREEN_DESKTOP * renderer->player.fullscreen));
SDL_GetWindowSize(renderer->window, &renderer->viewportWidth, &renderer->viewportHeight);
renderer->player.window = renderer->window;
- renderer->sdlRenderer = SDL_CreateRenderer(renderer->window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
+ renderer->sdlRenderer = SDL_CreateRenderer(renderer->window, -1, SDL_RENDERER_SOFTWARE);
#ifdef COLOR_16_BIT
#ifdef COLOR_5_6_5
renderer->sdlTex = SDL_CreateTexture(renderer->sdlRenderer, SDL_PIXELFORMAT_RGB565, SDL_TEXTUREACCESS_STREAMING, width, height);