From 8ea073e617bd8102be757f8c25d45e8185318d00 Mon Sep 17 00:00:00 2001 From: anzz1 Date: Tue, 30 May 2023 02:57:12 +0000 Subject: [PATCH] mgba_sgb, shutdown fix after latest picoarch update, mgba is 50% smaller and uses less memory. mgba_sgb bifurcated to a standalone core, which is half the size. hopefully fixed the poweroff screen getting stuck, in short: fork bad vfork good. mgba savestates on 32MB roms seem to work fine now, provided that the rom is stored in unpacked form. --- commits.txt | 5 +++-- extras/Emus/SGB.pak/launch.sh | 2 +- makefile | 2 +- src/common/common.c | 8 ++++++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/commits.txt b/commits.txt index 3a31bdd..7af12ce 100644 --- a/commits.txt +++ b/commits.txt @@ -1,7 +1,7 @@ 5e600602 DinguxCommander c57a554b SDL-1.2 c320273d dropbear-embedded -fb7d4e59 picoarch +ee40c1cc picoarch 76e45c34 libpicofe 88252880 libretro-common 15efb9df st-sdl @@ -15,7 +15,8 @@ ad2c71d8 fceumm a9376c86 gpsp 720b8ad4 mame2000 75c658cc mednafen_supafaust -314bf7b6 mgba +5d48e074 mgba +5d48e074 mgba_sgb 1f371e51 nxengine 1ebc39a1 pcsx_rearmed 44a6c678 picodrive diff --git a/extras/Emus/SGB.pak/launch.sh b/extras/Emus/SGB.pak/launch.sh index 7d0ccb7..c86489d 100755 --- a/extras/Emus/SGB.pak/launch.sh +++ b/extras/Emus/SGB.pak/launch.sh @@ -1,6 +1,6 @@ #!/bin/sh -EMU_EXE=mgba +EMU_EXE=mgba_sgb PERF_LEVEL=performance CORES_PATH=$(dirname "$0") diff --git a/makefile b/makefile index 782e519..74350b0 100644 --- a/makefile +++ b/makefile @@ -130,7 +130,7 @@ payload: cp ./third-party/picoarch/output/beetle-supergrafx_libretro.so ./build/EXTRAS/Emus/SGX.pak/mednafen_supergrafx_libretro.so cp ./third-party/picoarch/output/pokemini_libretro.so ./build/EXTRAS/Emus/PKM.pak/ cp ./third-party/picoarch/output/mgba_libretro.so ./build/EXTRAS/Emus/MGBA.pak/ - cp ./third-party/picoarch/output/mgba_libretro.so ./build/EXTRAS/Emus/SGB.pak/ + cp ./third-party/picoarch/output/mgba_sgb_libretro.so ./build/EXTRAS/Emus/SGB.pak/ cp ./third-party/picoarch/output/fake-08_libretro.so ./build/EXTRAS/Emus/P8.pak/ cp ./third-party/picoarch/output/smsplus-gx_libretro.so ./build/EXTRAS/Emus/GG.pak/smsplus_libretro.so cp ./third-party/picoarch/output/mame2000_libretro.so ./build/EXTRAS/Emus/MAME.pak/ diff --git a/src/common/common.c b/src/common/common.c index ed9ee77..2966fb6 100644 --- a/src/common/common.c +++ b/src/common/common.c @@ -894,13 +894,17 @@ int preventAutosleep(void) { void powerOff(void) { if (can_poweroff) { + pid_t pid = -1; char* msg = exists(kAutoResumePath) ? "Quicksave created,\npowering off" : "Powering off"; SDL_FillRect(screen, NULL, 0); GFX_blitBodyCopy(screen, msg, 0,0,Screen.width,Screen.height); SDL_Flip(screen); sleep(1); - system("shutdown"); - while (1) pause(); + while (pid < 0) { + pid = vfork(); + } + if (pid == 0) execlp("shutdown", "shutdown", NULL); + _exit(0); } }