Skip to content

Commit

Permalink
Merge pull request #2474 from joolswills/addPort_custom_script
Browse files Browse the repository at this point in the history
addPort - remove script parameter and handle in scriptmodule
  • Loading branch information
joolswills committed Aug 24, 2018
2 parents d6c0e4b + c86f0e8 commit 8fa87a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
10 changes: 1 addition & 9 deletions scriptmodules/helpers.sh
Expand Up @@ -1147,12 +1147,9 @@ function delSystem() {
## @param name display name for the launch script
## @param cmd commandline to launch
## @param game rom/game parameter (optional)
## @param script launch script to use instead of the default (optional - requires game to be set)
## @brief Adds a port to the emulationstation ports menu.
## @details Adds an emulators.cfg entry as with addSystem but also creates a launch script in `$datadir/ports/$name.sh`.
##
## Can optionally take a script via stdin to use instead of the default launch script.
##
## Can also optionally take a game parameter which can be used to create multiple launch
## scripts for different games using the same engine - eg for quake
##
Expand All @@ -1167,7 +1164,6 @@ function addPort() {
local file="$romdir/ports/$3.sh"
local cmd="$4"
local game="$5"
local script="$6"
# move configurations from old ports location
if [[ -d "$configdir/$port" ]]; then
Expand All @@ -1187,14 +1183,10 @@ function addPort() {
mkUserDir "$romdir/ports"
if [[ -z "$script" ]]; then
cat >"$file" << _EOF_
cat >"$file" << _EOF_
#!/bin/bash
"$rootdir/supplementary/runcommand/runcommand.sh" 0 _PORT_ "$port" "$game"
_EOF_
else
cat >"$file" <<< "$script"
fi
chown $user:$user "$file"
chmod +x "$file"
Expand Down
8 changes: 6 additions & 2 deletions scriptmodules/libretrocores/lr-nxengine.sh
Expand Up @@ -35,15 +35,19 @@ function configure_lr-nxengine() {
local script
setConfigRoot "ports"

read -r -d "" script << _EOF_
addPort "$md_id" "cavestory" "Cave Story" "$md_inst/nxengine_libretro.so"
local file="$romdir/ports/Cave Story.sh"
# custom launch script - if the data files are not found, warn the user
cat >"$file" << _EOF_
#!/bin/bash
if [[ ! -f "$romdir/ports/CaveStory/Doukutsu.exe" ]]; then
dialog --no-cancel --pause "$md_help" 22 76 15
else
"$rootdir/supplementary/runcommand/runcommand.sh" 0 _PORT_ cavestory "$romdir/ports/CaveStory/Doukutsu.exe"
fi
_EOF_
addPort "$md_id" "cavestory" "Cave Story" "$md_inst/nxengine_libretro.so" "" "$script"
chown $user:$user "$file"
chmod +x "$file"

ensureSystemretroconfig "ports/cavestory"
}

0 comments on commit 8fa87a1

Please sign in to comment.