Perfect Cherry Blossom running in Wine

With the release of Wine 1.0.1, most of the Touhou games run nearly flawlessly in Linux! Just install Wine 1.0.1 or later from your distribution's package manager and run your TH games.


Launching a Wine application

First, change to the application directory -- Windows does this automatically when launching an application, Wine doesn't.

% cd ~/.wine/drive_c/thXX

Now when you launch the application it will find all its files.

% LANG=ja_JP.UTF-8 WINEDEBUG=-all wine thXX.exe

LANG to make sure that all messages are displayed properly (you might have to add the locale to /etc/locale.gen and run locale-gen). WINEDEBUG=-all to disable all the debugging messages, remove this if you want to debug a crash or problem.


MIDI works fine as long as OSS audio driver is used and there's some synth behind.

For emu10k1-based soundcards, be sure to load a proper soundbank with sfxload.

If you're running Ubuntu or using PulseAudio for some other God-forsaken reason, it's dangerous to go alone. Take this:


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

Renicing the games might help to get a lower slow score.

% pgrep thXX | xargs renice -2

You may have to run renice as root (using sudo) depending on system configuration. Do not run Wine as root.

For most of the shooter games, running at more than 60 frames per second prevents you from saving replays. On Linux (nVidia drivers in particular), the frame rate may be forced higher.

VSync problems - If the game doesn't respect the fps limiter and runs higher than 60FPS, this might solve it (this[1] winehq thread is for ufo demo, but works for all the games):

(Only applies to LCD monitors and Nvidia drivers)

Edit your /etc/X11/xorg.conf (command sudo nano /etc/X11/xorg.conf) adding this under the Device section

       Option "UseEdidFreqs" "false"

This disables override of HorizSync and VertRefresh values in xorg.conf. Then under Monitor section, change the HorizSync and VertRefresh to match those of your monitor. Check your manual or the manufacturer's webpage. Then change the upper limit of VertRefresh to 60.0. Example:

       HorizSync 30.0 - 81.0
       VertRefresh 43.0 - 60.0

Also, make sure to disable Compiz, and also to enable VSync at nvidia-settings while playing.


Immaterial and Missing Power

The configuration file config.exe is not runnable in wine. See bug 13554.

The Embodiment of Scarlet Devil

One user reported a problem of the game not respecting the 60 FPS limiter setting on fullscreen. See bug 13085. It was circumvented by setting the game in windowed mode and, because you can't play this game in a tiny window, setting the desktop to 640x480 before launching the game. Don't use Ctrl+Alt+KP_Minus for this though; that doesn't change the Virtual Resolution (i.e. what all the applications think your resolution is), only what you can see of it. So use xrandr -s 640x480, and when you're done xrandr -s oldres.

Alternatively, if you are using nVidia's binary drivers try setting the environment variable __GL_SYNC_TO_VBLANK to 1 for the application.

If you're using ATI fglrx you can do basically the same thing: in the Catalyst Control Center, click the arrow next to "3D," select "More Settings," and move the "Wait for vertical refresh" slider all the way to the right ("Always on").

Phantasmagoria of Flower View

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

Mountain of Faith, Subterranean Animism, Undefined Fantastic Object, MegaMari

A native d3dx9_36.dll is required for these games to run. Google for it and place it in the application directory. See bug 13297.

However, even with a native d3dx9_36.dll text gets nearly invisible, making dialogue very hard to read. Gameplay is not affected though. See bug 15146.

As of Wine 1.1.43, you no longer need d3dx9_36.dll to run the game. However, for MoF, SA and UFO, some text (what would normally be fuzzy) doesn't show at all.

Scarlet Weather Rhapsody, Hisoutensoku, PatchCon

These also refuse to run without a native d3dx9_36.dll. In this case the native file does not help, as it immediately hangs on another problem. See Bug 13490 for more information.

I very recently had some success running SWR on Linux. I copied over from my windows install (with the .dll already in the folder), and the game started right up. I'm running Arch linux's rolling release with everything up-to-date as of May 3rd. Not all features worked, the worst of which being the network play (crashes the game). Wine version 1.1.20

[ EDIT: In Custom.exe, turn DirectInput on and this will fix the problem at least for PCB! Tested on Arch Linux 2.6.35 / Wine 1.3.3 ]

Shoot The Bullet

STB runs, but photos will not capture. This can be fixed with a custom wine build. Comment out this block in dlls/wined3d/surface.c: (line 2667 in 1.1.40)

   if (This->resource.pool == WINED3DPOOL_SCRATCH )
       FIXME("(%p) Operation not supported for scratch textures\n",This);

New photos will appear, but the already taken ones will remain black.

(Different user: I never have this problem with Shoot the Bullet. Only Double Spoiler. And as noted, that can be fixed by using the proprietary d3dx9_36.dll)

Double Spoiler, Fairy Wars

Is playable without special hacks, but certain graphical effects won't work unless you're using d3dx9_36.dll. Notably, certain text and menu graphics don't appear, and you take blank pictures in Double Spoiler.

The PC-98 Games

There is a native Linux PC-98 emulator called xnp2. It's available from for example the aur and probably also other places. In order to use the emulator, download the font.rom and the appropriate np2rc file from here, then modify the paths in the np2rc file and run the emulator with the command xnp2 --config [path to np2rc].

There is also a Windows emulator that runs well in Wine: T98-Next (first download link) runs with basically no problems. The text is a little screwed up, but it's easy enough to figure out what to do. Load your .hdi file into HD DRIVE 1 (click on the box next to the red rectangle) then click the Power button in the upper-left. Audio and graphics should run full speed.

If you use Anex86, English text is completely unreadable without installing a better font :


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
xmodmap -e "keycode 39 = S"
xmodmap -e "keycode 40 = D"
xmodmap -e "keycode 84 = KP_5"
xmodmap -e "keycode 24 = Q"

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, xmodmap is invoked once again to reset the key configuration (this is important!).

It should not be too difficult to modify the script above to work with other games.

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.


If you have a fast pc, and if you have problems with Wine, you can try VirtualBox. VirtualBox is a free tool to create and use Virtual Machines (VMs). This is what you need to do:

  1. Make sure VT-x (for Intel processors) or AMD-V (for AMD processors) is enabled in your BIOS settings (Google [Your model] + "BIOS settings").
  2. Download VirtualBox from this link (select your Linux distribution and architecture)
  3. Download a Virtual disk with Windows on it, you can Google (Windows version you want) + "vhd download" to get one (for example, for XP, Google "Windows XP vhd download"). If you have a Windows DVD or want to download an ISO it may be less troublesome to use that.
  4. Open VirtualBox and select "New". Name it whatever you want, for example "Touhou". For the type select "Microsoft Windows" and for the version select the version of Windows you are using.
  5. Reserve 512 MB of RAM for XP, 1GB for Vista and above.
  6. Choose "Use an existing hard drive image" if you are using a preinstalled VHD; or "Create a Virtual Hard Disk Now" for a new installation, then choose "VDI (VirtualBox Disk Image)" as the format, "Dynamically Allocated" as the type, and 32 GB as the size.
  7. Click "Settings", then go to "Display". Set Video Memory to 128 MB and enable both 3D Acceleration and 2D Video Acceleration.
  8. Click "Start". If you are installing Windows, choose your install disk or ISO file, and then go through the installation process.
  9. Install VirtualBox Guest Additions (In the Device menu)
  10. Copy your Touhou Project game to a USB or a CD/DVD
  11. Mount the USB or CD/DVD in VirtualBox and copy the game to the virtual machine.
  12. You should now be able to play Touhou in a VM.
Community content is available under CC-BY-SA unless otherwise noted.