• Welcome to Touhou Wiki!
  • Registering is temporarily disabled. Check in our Discord server to request an account and for assistance of any kind.

Running in Linux and macOS/Misc fixes

From Touhou Wiki
< Running in Linux and macOS
Revision as of 23:24, 19 September 2022 by Mami (talk | contribs) (Mami moved page Running in Linux and Mac OS X/Misc fixes to Running in Linux and macOS/Misc fixes: updating OS name)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


In most cases, audio should work just fine.

MIDI requires software such as FluidSynth or Timidity to be running, as well as a soundfont (.sf2 file).


Fullscreen support may be a little flakey depending on your window manager, desktop environment, Wine options and video drivers.

For NVIDIA users, there is no way to enable GPU scaling to ensure the correct aspect ratio of 4:3 when playing Touhou in fullscreen. Playing on Steam is a workaround for this; see the Proton section of the parent page.

VSync problems

Some games might have an issue where they play at a framerate faster than 60 FPS, rendering them anything from much harder to flat out unplayable.

If a game's framerate exceeds 60 FPS, use libstrangle. In Lutris, this can be done for either a single game or a runner, assuming libstrangle is installed. Right click a game, or click the gear icon next to a runner, then set the FPS limit in the System options tab.


The Embodiment of Scarlet Devil

The player character sprite is rendered on top of enemy sprites instead of under them, obscuring certain safespots.

Embodiment of Scarlet Devil up to Shoot the Bullet will not speed up replays when Ctrl is pressed while using vpatch.

Immaterial and Missing Power

Pausing appears to be broken. It will play the pause sound effect, but the menu will not show, nor is it usable.

Phantasmagoria of Flower View

If the game crashes at startup after patching to 1.50a, try using a native dpnet.dll. See bug 18394.

PC-98 Games

DOSBox-X runs natively on Linux. PC-98 emulators for Windows work in Wine without any significant problems.


Remapping Keys

It's very easy to remap keys using xmodmap. Consider the following script (for Imperishable Night):

xmodmap -e "keycode 39 = Z"
xmodmap -e "keycode 40 = X"
xmodmap -e "keycode 84 = KP_2"
xmodmap -e "keycode 24 = Escape"
cd /path/to/th08/
wine ./th08.exe
setxkbmap -layout us

There are a few distinct parts of this script. After the first hashbang line, there are four commands invoking xmodmap. These commands remap the keyboard temporarily for the entire desktop. The first two lines remap Z and X to S and D, respectively. The next one maps Numpad 2 to Numpad 5. This is useful for users who wish to use the numpad like the arrow keys. The next line maps the escape button to Q (to decrease the amount that the hand has to move from its normal position to pause or restart the game).

The next two lines invoke the game itself. First, the script changes the directory to ensure that the background music works. It then invokes wine ./th08.exe. After the game has quit, setxbkmap is invoked to reset the key configuration to standard US International layout (this is important! and keep in mind you will need to change this if you use a different layout).

The above script can be modified to launch any game with remapped keys.

How to Get Keycodes

The syntax the xmodmap command to assign a keycode to a key is xmodmap -e keycode {KEYCODE} = {ASSIGNMENT},

To get the keycode, xev can be used. Simply start xev by invoking it from a console. Press a key. Then, look for information regarding the key press.

For example:

KeyRelease event, serial 31, synthetic NO, window 0x3000001,
    root 0x1a6, subw 0x0, time 14040642, (53,205), root:(2001,267),
    state 0x10, keycode 38 (keysym 0x61, a), same_screen YES,
    XLookupString gives 1 bytes: (61) "a"
    XFilterEvent returns: False

The key A is currently mapped to keycode 38.

KeyRelease event, serial 31, synthetic NO, window 0x3000001,
    root 0x1a6, subw 0x0, time 14142576, (-360,480), root:(1588,542),
    state 0x10, keycode 39 (keysym 0x73, s), same_screen YES,
    XLookupString gives 1 bytes: (73) "s"
    XFilterEvent returns: False

The key S is mapped to keycode 39.

To make xmodmap map A to S (that is every time the original S key is pressed, the character A is typed) invoke:

xmodmap -e "keycode 39 = A"
                    ^    ^- The value desired (from the first xev output above)
                    |- The key desired (from the second xev output above)

To return the key back to its original state:

xmodmap -e "keycode 39 = S"

In this manner, the Touhou key configuration can be easily changed.


Joysticks should work without problems as long as the right modules are loaded. You'll need at least a connection-specific driver (such as gamecon for controllers wired to the parallel port) and the joydev driver for the device in /dev/input.

It's a good idea to calibrate the input device if you are going to use any of its analog inputs. jscal in the joyutils package will help with this.

If input appears laggy or unresponsive, disabling "directx input" via the custom.exe in the touhou game dir might help.