diff --git a/static/build/.tmp_update/script/migration/00020_rename_gpsp_save_extension.sh b/static/build/.tmp_update/script/migration/00020_rename_gpsp_save_extension.sh new file mode 100755 index 000000000..0ae967580 --- /dev/null +++ b/static/build/.tmp_update/script/migration/00020_rename_gpsp_save_extension.sh @@ -0,0 +1,11 @@ +#!/bin/sh +save_dir=/mnt/SDCARD/Saves/CurrentProfile/saves + +if [ ! -d $save_dir/gpSP ]; then + exit 0 +fi + +# Rename gpSP save files from .sav to .srm +for file in $save_dir/gpSP/*.sav; do + mv -n -- "$file" "${file%.sav}.srm" +done diff --git a/static/packages/Emu/Nintendo - GBA (gpSP)/Emu/GBA/launch.sh b/static/packages/Emu/Nintendo - GBA (gpSP)/Emu/GBA/launch.sh index ef79de521..5a1285b9c 100644 --- a/static/packages/Emu/Nintendo - GBA (gpSP)/Emu/GBA/launch.sh +++ b/static/packages/Emu/Nintendo - GBA (gpSP)/Emu/GBA/launch.sh @@ -18,9 +18,37 @@ mgba_save="$savedir/mGBA/$romname.srm" default_core=gpsp # check if gpSP save states exist -if [ ! -f "$gpsp_state" ] && [ ! -f "$gpsp_save" ] && [ [ -f "$mgba_state" ] || [ -f "$mgba_save" ] ]; then - default_core=mgba +if [ ! -f "$gpsp_state" ] && [ ! -f "$gpsp_save" ]; then + if [ -f "$mgba_save" ]; then + LD_PRELOAD=/mnt/SDCARD/miyoo/lib/libpadsp.so /mnt/SDCARD/.tmp_update/bin/prompt -r \ + -t "GBA CORE CHANGED" \ + -m "Default GBA core is now gpSP.\nDo you want to transfer your\nmGBA save file for this game?" \ + "Transfer save to gpSP" \ + "Keep playing with mGBA" + retcode=$? + + if [ $retcode -eq 0 ]; then + # remove weird gpSP file if it exists + if [ -f "$savedir/gpSP" ]; then + rm -f "$savedir/gpSP" + fi + + # create gpSP save directory + mkdir -p "$savedir/gpSP" + + # transfer save file + cp "$mgba_save" "$gpsp_save" + else + default_core=mgba + fi + elif [ -f "$mgba_state" ]; then + default_core=mgba + fi +fi + +# if core is mgba, create a config file +if [ "$default_core" = "mgba" ]; then mkdir -p "$homedir/.game_config" echo "core = \"mgba_libretro\"" > "$romcfgpath" fi