MythTV-Mythgame脚本,允许基于ROM选择qjoypad配置文件



我正在尝试编写一个脚本,该脚本启动mupen64plus,但允许根据运行的rom选择不同的qjoypad profiles。现在我只有一个rom需要不同的配置文件,但我可以想象,在未来我会有许多基于rom的不同配置文件。我想我会在未来对这些添加使用elif语句。如果我把rom的名称放在ROM= field中,我知道脚本可以正常工作。我想不通的是如何将已选择的rom文件名拉入脚本中。我以为Mythgame只会使用%s作为变量,但这似乎不起作用。

有人能给我一些指导吗?

#!/bin/sh -e
# Script to launch mupen64plus with correct settings
# rom file
ROM=%s
# mupen64plus executable
MUPEN64PLUS=mupen64plus
# gamepad executable
GAMEPAD=qjoypad
# gamepad process name to kill
GAMEPAD_PS=qjoypad
# emulator process name to kill
MUPEN64PLUS_PS=mupen64plus
if [ "$ROM" = "Brunswick Circuit Pro Bowling.z64" ]; then
$GAMEPAD "n64-bowl" &
else
$GAMEPAD "n64" &
fi
$MUPEN64PLUS --gfx mupen64plus-video-glide64mk2 --osd --resolution 1360x768 --fullscreen "$1"
killall $MUPEN64PLUS_PS $GAMEPAD_PS 

我已经解决了这个问题,以防其他人想在MythGame设置中实现类似的东西。这是代码,您可以为多个游戏板配置的任何模拟器和elif语句操作它。

#!/bin/sh -e
# Script to launch mupen64plus with correct settings
# rom file
ROM="$1"
ROMNAME=${ROM##*[/|\]}
# mupen64plus executable
MUPEN64PLUS="mupen64plus"
# gamepad executable
GAMEPAD="qjoypad"
# gamepad process name to kill
GAMEPAD_PS="qjoypad"
# emulator process name to kill
MUPEN64PLUS_PS="mupen64plus"
if [ "$ROMNAME" = "yourromename.z64" ]; then
$GAMEPAD "n64-bowl" &
else
$GAMEPAD "n64" &
fi
$MUPEN64PLUS  --gfx mupen64plus-video-glide64mk2 --osd --resolution 1360x768 --fullscreen "$ROM"
killall $MUPEN64PLUS_PS $GAMEPAD_PS

最新更新