updates for nds and new rom paths

This commit is contained in:
Rudis Muiznieks 2024-02-08 08:40:55 -06:00
parent 5b7262c6ab
commit db7e1be6bc
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
3 changed files with 28 additions and 20 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
out/
*.lpl *.lpl

View File

@ -1,6 +1,6 @@
{ {
"version": "1.5", "version": "1.5",
"default_core_path": "/tmp/cores/prboom_libretro.so", "default_core_path": "$CORE_PREFIX/prboom_libretro.so",
"default_core_name": "Doom (PrBoom)", "default_core_name": "Doom (PrBoom)",
"label_display_mode": 0, "label_display_mode": 0,
"right_thumbnail_mode": 0, "right_thumbnail_mode": 0,
@ -8,26 +8,20 @@
"sort_mode": 0, "sort_mode": 0,
"items": [ "items": [
{ {
"path": "/storage/roms/dooms/doom/doom.wad", "path": "$ROM_PREFIX/prboom/doom.wad",
"label": "Doom", "label": "Doom",
"core_path": "/tmp/cores/prboom_libretro.so",
"core_name": "Doom (PrBoom)",
"crc32": "DETECT", "crc32": "DETECT",
"db_name": "DOOM.lpl" "db_name": "DOOM.lpl"
}, },
{ {
"path": "/storage/roms/dooms/doom2/doom2.wad", "path": "$ROM_PREFIX/prboom/doom2.wad",
"label": "Doom II - Hell on Earth", "label": "Doom II - Hell on Earth",
"core_path": "/tmp/cores/prboom_libretro.so",
"core_name": "Doom (PrBoom)",
"crc32": "DETECT", "crc32": "DETECT",
"db_name": "DOOM.lpl" "db_name": "DOOM.lpl"
}, },
{ {
"path": "/storage/roms/dooms/finaldoom/plutonia.wad", "path": "$ROM_PREFIX/prboom/plutonia.wad",
"label": "Final Doom - The Plutonia Experiment", "label": "Final Doom - The Plutonia Experiment",
"core_path": "/tmp/cores/prboom_libretro.so",
"core_name": "Doom (PrBoom)",
"crc32": "DETECT", "crc32": "DETECT",
"db_name": "DOOM.lpl" "db_name": "DOOM.lpl"
} }

View File

@ -18,13 +18,13 @@ case "$sys_type" in
core_name="Atari - 2600 (Stella)" core_name="Atari - 2600 (Stella)"
db_name="Atari - 2600.lpl" db_name="Atari - 2600.lpl"
;; ;;
'atarilynx') 'lynx')
rom_ext="lnx" rom_ext="lnx"
core_path="$CORE_PREFIX/handy_libretro.so" core_path="$CORE_PREFIX/handy_libretro.so"
core_name="Atari - Lynx (Handy)" core_name="Atari - Lynx (Handy)"
db_name="Atari - Lynx.lpl" db_name="Atari - Lynx.lpl"
;; ;;
'arcade') 'mame')
rom_ext="zip" rom_ext="zip"
core_path="$CORE_PREFIX/mame2003_plus_libretro.so" core_path="$CORE_PREFIX/mame2003_plus_libretro.so"
core_name="Arcade (MAME 2003-Plus)" core_name="Arcade (MAME 2003-Plus)"
@ -102,25 +102,37 @@ case "$sys_type" in
core_name="Sony - PlayStation Portable (PPSSPP)" core_name="Sony - PlayStation Portable (PPSSPP)"
db_name="Sony - PlayStation Portable.lpl" db_name="Sony - PlayStation Portable.lpl"
;; ;;
'ws') 'wswan')
rom_ext="ws" rom_ext="ws"
core_path="$CORE_PREFIX/mednafen_wswan_libretro.so" core_path="$CORE_PREFIX/mednafen_wswan_libretro.so"
core_name="Bandai - WonderSwan (Beetle Cygne)" core_name="Bandai - WonderSwan (Beetle Cygne)"
db_name="Bandai - WonderSwan.lpl" db_name="Bandai - WonderSwan.lpl"
;; ;;
'wsc') 'wswanc')
rom_ext="wsc" rom_ext="wsc"
core_path="$CORE_PREFIX/mednafen_wswan_libretro.so" core_path="$CORE_PREFIX/mednafen_wswan_libretro.so"
core_name="Bandai - WonderSwan Color (Beetle Cygne)" core_name="Bandai - WonderSwan Color (Beetle Cygne)"
db_name="Bandai - WonderSwan Color.lpl" db_name="Bandai - WonderSwan Color.lpl"
;; ;;
'nds')
rom_ext="nds"
core_path="$CORE_PREFIX/desmume_libretro.so"
core_name="Nintendo - DS (DeSmuME)"
db_name="Nintendo - Nintendo DS.lpl"
;;
'prboom')
# special case, use template
echo 'Generating DOOM.lpl from template...'
sed "s|\\\$CORE_PREFIX|$CORE_PREFIX|g" DOOM.lpl | sed "s|\\\$ROM_PREFIX|$ROM_PREFIX|g" > out/DOOM.lpl
exit 0
;;
*) *)
echo "Don't recognize system for roms in $sys_type directory..." echo "Don't recognize system for roms in $sys_type directory..."
exit 1 exit 1
;; ;;
esac esac
cat > temp.json <<EOF cat > out/temp.json <<EOF
{ {
"version": "1.5", "version": "1.5",
"default_core_path": "$core_path", "default_core_path": "$core_path",
@ -132,19 +144,20 @@ cat > temp.json <<EOF
"items": [ "items": [
EOF EOF
mkdir -p out
echo "Reading roms from $rom_dir/*.$rom_ext..." echo "Reading roms from $rom_dir/*.$rom_ext..."
comma= comma=
for rom in "$rom_dir"/*."$rom_ext"; do for rom in "$rom_dir"/*."$rom_ext"; do
rom_file="$(basename "$rom" | sed 's/"/\\"/g')" rom_file="$(basename "$rom" | sed 's/"/\\"/g')"
if [ "$sys_type" = "arcade" ]; then if [ "$sys_type" = "arcade" ]; then
mame_name="${rom_file%.$rom_ext}" mame_name="${rom_file%."$rom_ext"}"
rom_label="$(jq -r '.[] | select(.name=="'"$mame_name"'") | .description' mame2003plusdb.json | sed 's/\( ([^)]\+)\)*$//')" rom_label="$(jq -r '.[] | select(.name=="'"$mame_name"'") | .description' mame2003plusdb.json | sed 's/\( ([^)]\+)\)*$//')"
else else
rom_label="$(echo "$rom_file" | sed 's/ \?\[[^]]\+\]//g' | sed 's/\( ([^)]\+)\)*\.[^.]\+$//')" rom_label="$(echo "$rom_file" | sed 's/ \?\[[^]]\+\]//g' | sed 's/\( ([^)]\+)\)*\.[^.]\+$//')"
fi fi
rom_path="$ROM_PREFIX/$sys_type/$rom_file" rom_path="$ROM_PREFIX/$sys_type/$rom_file"
cat >> temp.json <<EOF cat >> out/temp.json <<EOF
$comma{ $comma{
"path": "$rom_path", "path": "$rom_path",
"label": "$rom_label", "label": "$rom_label",
@ -155,11 +168,11 @@ EOF
comma=',' comma=','
done done
cat >> temp.json <<EOF cat >> out/temp.json <<EOF
] ]
} }
EOF EOF
if jq . temp.json > "$db_name"; then if jq . out/temp.json > "out/$db_name"; then
rm temp.json rm out/temp.json
fi fi