I need a break
As a somewhat fun way to get some extra Japanese exposure I started playing game cube games with Dolphin. However I have to look up so many words and grammar points that normal dialogue speed is way too fast for me. The games sometimes wait for a button press to proceed with the dialogues, but during cut-scenes they often progress automatically. Luckily with emulators you can pause the emulation at any time and it’s easy enough to bind that to a separate button on the controller.
Sadly PC games usually have no way to pause them at arbitrary times. But we can hack together something similar with POSIX signals and a little shell script.
#!/bin/bash
#use command line parameter to specify the program to pause
cmdName=$1
pInfo=`ps -o pid:1,s:1 --no-headers -C $cmdName`
if [[ -z $pInfo ]]
then
echo No process found for $cmdName
exit
fi
pid=`echo $pInfo | cut -f 1 -d ' '`
stat=`echo $pInfo | cut -f 2 -d ' '`
if [ "S" = "$stat" ]
then
echo stopping pid $pid
kill -SIGSTOP $pid
else
echo continuing pid $pid
kill -CONT $pid
fiThe script sends either STOP or CONT to stop or continue the process, depending on the state the target process is currently in. By binding ineedabreak.sh <command name> to some key one can easily pause and continue pretty much any game at any time. This whole setup works surprisingly well for the few games I’ve tested. I wouldn’t be surprised if it fails spectacularly for other games though.
Sometimes pausing a game this way even has nice side effects. One of the games I tested was Disgaea 2. The Linux port doesn’t have a window mode, which is super annoying. Especially if you want to look up some vocabulary in the browser. The instant the browser window gets the focus the game minimizes to the taskbar. When paused with SIGSTOP the window stays open and looking up several words at once becomes much less tiresome.