Skip to content

Commit

Permalink
ppsspp/lr-ppsspp: (bug) resolve conflict on removal
Browse files Browse the repository at this point in the history
Both stand-alone `ppsspp` and the libretro core `lr-ppsspp` share the `$HOME/.config/ppsspp` save file directory.

`moveConfigDir` removes the symlink on removal; this will disconnects the existing saves from the remaining emulator.

ppsspp: Use moveConfigDir only on install.

On removal, do not use the helper function. Remove the symlink manually and only if no remaining PSP emulators.

lr-ppsspp: Libretro core did not link this dir at all, and just used mkUserDir instead. Switch to use moveConfigDir and same fix as above, for libretro core also.
  • Loading branch information
s1eve-mcdichae1 committed May 24, 2022
1 parent 5cd6dd2 commit cd2a5ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
15 changes: 12 additions & 3 deletions scriptmodules/emulators/ppsspp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,19 @@ function configure_ppsspp() {
fi

mkRomDir "psp"
moveConfigDir "$home/.config/ppsspp" "$md_conf_root/psp"
mkUserDir "$md_conf_root/psp/PSP"
ln -snf "$romdir/psp" "$md_conf_root/psp/PSP/GAME"
if [[ "$md_mode" == "install" ]]; then
moveConfigDir "$home/.config/ppsspp" "$md_conf_root/psp"
mkUserDir "$md_conf_root/psp/PSP"
ln -snf "$romdir/psp" "$md_conf_root/psp/PSP/GAME"
fi

addEmulator 0 "$md_id" "psp" "pushd $md_inst; $md_inst/PPSSPPSDL ${extra_params[*]} %ROM%; popd"
addSystem "psp"

# if we are removing the last remaining psp emu - remove the symlink
if [[ "$md_mode" == "remove" ]]; then
if [[ -h "$home/.config/ppsspp" && ! -f "$md_conf_root/psp/emulators.cfg" ]]; then
rm -f "$home/.config/ppsspp"
fi
fi
}
9 changes: 8 additions & 1 deletion scriptmodules/libretrocores/lr-ppsspp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,16 @@ function configure_lr-ppsspp() {
# the core needs a save file directory, use the same folder as standalone 'ppsspp'
iniConfig " = " "" "$configdir/psp/retroarch.cfg"
iniSet "savefile_directory" "$home/.config/ppsspp"
mkUserDir "$home/.config/ppsspp"
moveConfigDir "$home/.config/ppsspp" "$md_conf_root/psp"
fi

addEmulator 1 "$md_id" "psp" "$md_inst/ppsspp_libretro.so"
addSystem "psp"

# if we are removing the last remaining psp emu - remove the symlink
if [[ "$md_mode" == "remove" ]]; then
if [[ -h "$home/.config/ppsspp" && ! -f "$md_conf_root/psp/emulators.cfg" ]]; then
rm -f "$home/.config/ppsspp"
fi
fi
}

0 comments on commit cd2a5ed

Please sign in to comment.