user3348186
user3348186

Reputation: 1

MythTV - Mythgame script that allows qjoypad profile selection based on ROM

I am trying to write a script that launches mupen64plus but allows for different qjoypad profilesto be selected based on which rom is running. Right now I only have one rom that needs a different profile but I can imagine in the future I would have numerous different profiles needed based on rom. I think I would use an elif statement for those additions in the future. I know the script works properly if I put the name of the rom into the ROM= field. What I can't figure out is how to pull the rom file name that has been selected into the script. I thought it would just be the %s that Mythgame uses as the variable but that doesn't seem to work.

Can someone please provide me some guidance?

#!/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 

Upvotes: 0

Views: 76

Answers (1)

user3348186
user3348186

Reputation: 1

I've solved this in case anyone else wants to implement something similar in their MythGame Setup. Here is the code and you can manipulate it for probably any emulator and elif statements for multiple game pad configurations.

#!/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

Upvotes: 0

Related Questions