Running in Linux and Mac OS X/Misc fixes

From Touhou Wiki
Jump to navigation Jump to search

Audio[edit]

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[edit]

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.


VSync problems[edit]

For most of the shooter games, running at more than 60 frames per second prevents you from saving replays. With Touhou, this makes the game harder, since you're playing at a higher speed. On Linux (nVidia drivers in particular), the frame rate may be forced higher.

If the game doesn't respect the fps limiter and runs higher than 60FPS, try one of the solutions below:

Enabling vsync on command line[edit]

  1. Disable any desktop effect you may have on (compiz/kwin/...)
  2. Run the game with __GL_SYNC_TO_VBLANK=1 (for example: __GL_SYNC_TO_VBLANK=1 wine th13.exe)

Editting xorg.conf[edit]

Note that this is more complicated, requires root access, can screw X up, and is not supported on newer distros which do not have xorg.conf anymore.

(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[edit]

Immaterial and Missing Power[edit]

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

The Embodiment of Scarlet Devil[edit]

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[edit]

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[edit]

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[edit]

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[edit]

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[edit]

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.

PC-98 Games[edit]

There is a port of Neko Project II for Linux and Mac OS X called Xnp2. At the present time it seems to have some sound problems, requiring a rather large sound buffer to avoid stuttering.

The program needs to be compiled from source. To install dependencies:

$ sudo aptitude install build-essential nasm checkinstall libsdl1.2-dev libsdl-mixer1.2-dev libgtk2.0-dev libxxf86vm-dev

replacing aptitude with your distribution's package manager where necessary.

To compile, change to the source folder, then:

$ ./configure --enable-ia32
$ make

Make sure the --enable-ia32 flag is supplied. Otherwise, the i386 instructions will be missing and the games will not run (same as running np2.exe on fmgen). After this, follow the settings above to configure the system, but you may have to set the sound buffer up to 200ms or more to avoid stuttering; this may result in audio lag.

All the usual PC-98 emulators for Windows work without any significant problems in Wine; in particular, the fmgen build of Neko Project II (recommended for Windows) works without any modifications. If you wish to play without audio lag this is the recommended way of playing on Linux/Mac OS X.

Miscellaneous[edit]

Remapping Keys[edit]

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[edit]

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[edit]

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.