Skip to content

Commit

Permalink
Add gpSP save migration + restore mGBA transfer option
Browse files Browse the repository at this point in the history
  • Loading branch information
Aemiii91 committed Dec 23, 2024
1 parent 1727779 commit 80a5596
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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
32 changes: 30 additions & 2 deletions static/packages/Emu/Nintendo - GBA (gpSP)/Emu/GBA/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 80a5596

Please sign in to comment.