Wikia

Touhou Wiki

Running in Linux

Talk49
7,239pages on
this wiki

Linux Th07 01

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.

General

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.

Audio

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: http://www.hackido.com/2009/10/quick-tip-solve-skipping-audio-in-wine.html

Video

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.

Game-specific

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);
       return WINED3DERR_INVALIDCALL;
   }

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

While there doesn't seem to be a native Linux PC-98 emulator, there is 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 (for me, anyways), 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 : http://www.4shared.com/file/125039086/c89186ee/anex86bmp.html

Miscellaneous

Remapping Keys

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

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

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.

VirtualBox

If you've got a fast pc, and if you have got problems with Wine, you could try VirtualBox (the download link is given at the bottom of this page). VirtualBox is a free emulator, which can emulate the Windows OS. This is what you need to do:

1•Download VirtualBox from the site (select Linux Host)

2•Download a Virtual disk with Windows stored on it, for a virtual harddisk, put"vhd" after the Windows version you want (I would use XP, so I should Google for "Windows XP vhd download")

3•Open VirtualBox and mount the harddrive via the wizard.

/!\READ THIS CAREFULLY, THIS DON'T HARM YOUR SYSTEM IF YOU DON'T USE THE RECOMMENDED CONFIGURATIONS, BUT IF YOU READ THIS, YOU WON'T GET INTO (much) TROUBLE/!\

4•Now open hte settings of the XP vhd, and go to the categorySelect AT LEAST 512MB of free RAM if you use a Windows XP vhd. If you want to let XP run proper, I should move the slider to the end of the green part.

5•If you've got a dualcore, quadcore or whatever, it is recommended to reserve one core for the emulator itself.

6•For the graphics memory, move the slider to the end of the green part. Now the virtual machine is configured to work well.

7•Copy your Touhou Project game to a USB-flashdrive or a CD/DVD (no matter if it is R, RW, - or +).

8•Start the virtual machine and install the Guest Addons (can be founded in the mount menu of the virtual machine)

9•Mount the USB or CD/DVD to the virtual machine and copy it to the virtual machine. WARNING! YOU CAN'T USE THE USB OR CD/DVD ON THE HOST IF IT IS MOUNTED! EVEN IF THE HOST IS Windows TOO!

Download link for VirtualBox: https://www.virtualbox.org/wiki/Downloads

Around Wikia's network

Random Wiki