- Welcome to Touhou Wiki!
- Account registration is currently disabled.
- Please visit our IRC channel and query an administrator to create a new account. Sorry for the inconvenience.
Running in Linux and Mac OS X
For those of us who run Linux as our only operating system, finding functional alternatives to Windows programs can be pretty hard. When we need to run Windows programs, the Wine project has long been a great emulation system that lets us do such a thing. Basically, it translates Windows functionality into their respective Linux counterparts, so you can still play your Windows games, work in Photoshop, etc. under Linux and, to a certain extent, Mac OS X.
It's not perfect--running Touhou games on Wine is hit-or-miss--but it is possible. This article will explain how Wine works, and how to (maybe) play Windows Touhou games under Wine.
- 1 Installing Wine on Linux
- 2 Installing Wine on Mac OS X using MacPorts
- 3 Using Wine
- 4 Running Touhou games
- 5 Using native Windows DLLs
- 6 Using VSync patches (and possibly other DLL-based patches) on Linux
- 7 Wine in Mac OS X
- 8 PC-98 Games
- 9 Gotchas, Troubleshooting
- 10 Outside the official games...
- 11 Touhou Games in the Wine AppDB (appdb.winehq.org)
- 12 Wine Bug Status (bugs.winehq.org)
- 13 Using Parallels and VMWare Fusion (Virtualization)
- 14 External links
- 15 Another Way of Running Touhou Games on Mac
- 16 Glitches
Installing Wine on Linux
Ubuntu and Debian: See Here
Fedora: See Here
SuSE: See Here
Gentoo: See Here. I recommend unmasking the git-fetching ebuild. Adding =app-emulation/wine-9999 ** to /etc/portage/package.keywords should do the trick. Do emerge -pv wine and check which version it wants to build (it should be app-emulation/wine-9999). Just be aware, building from Wine's Git repository might not actually work, the code is in constant flux.
Installing Wine on Mac OS X using MacPorts
If you already have MacPorts installed with all dependencies, simply run
$ sudo port install wine to install with all dependencies.
If you have yet to install MacPorts, refer to this page
Wine puts a hidden directory in your home folder, called .wine, which contains a full representation of a Windows folder hierarchy and miscellaneous library and system files. The .wine folder lives inside your home directory (~/.wine). Inside is another folder called drive_c, which is your Wine install's C: drive folder. If you browse inside this folder (~/.wine/drive_c) you'll probably quickly recognize it's contents from a standard Windows install.
Generally, your Linux distribution will have assigned Windows executable to automatically start within Wine, so double-clicking a Windows executable should generally just work. But if not, you'll have to invoke Wine from your terminal. This will be somewhat important for running Touhou games properly, but that'll come later. Anyway, here we'll look inside a program as it's installed within Wine with your terminal, move into it's folder and run it with Wine:
~ $ ls .wine/drive_c/Program\ Files/RandomProgram config.ini libjpeg.dll program.exe readme.txt ~ $ cd .wine/drive_c/Program\ Files/RandomProgram ~/.wine/drive_c/Program Files/RandomProgram $ wine program.exe
And that should start up your program.
Running Touhou games
Running a Touhou game is done the same way, only you might want to specify your locale while invoking Wine so it starts your game as a Japanese program. Here's how my Double Spoiler install looks like, and how to run it:
~ $ ls .wine/drive_c/Program\ Files/上海アリス幻樂団/ダブルスポイラー custom.exe readme.txt th125.exe unins000.dat omake.txt th125.dat thbgm.dat unins000.exe ~ $ cd .wine/drive_c/Program\ Files/上海アリス幻樂団/ダブルスポイラー ~/.wine/drive_c/Program Files/上海アリス幻樂団/ダブルスポイラー $ LANG="ja_JP.UTF-8" wine th125.exe
The LANG="ja_JP.UTF-8" part tells Wine to run under the Japanese locale, else it will run under whatever your default Locale is (en_US.UTF-8, en_GB.UTF-8, etc.), and you'll probably experience serious mojibake, although you may only see it in the program window's title. Also, you should run English patches under the Japanese locale; at which point your English-patched executable can be run under your default locale.
Using native Windows DLLs
This is pretty much no longer necessary for Touhou games, but it's a way to fix certain missing functionality in Wine you may find with other programs. Basically, Windows has a lot of available system interface DLLs, and it's a huge order to 100% duplicate all that functionality in Wine. While the Wine developers are constantly at work improving the coverage of the Windows' API, there's still lots of missing gaps here and there. One way to temporarily fix a partially-functioning DLL is to replace it with the original file from a Windows install. Here's the steps to do so; we'll use "d3dx9_36.dll" as an example. Also note, I have a 32-bit Vista installation mounted at /mnt/vista32.
First off, to copy the file. Wine's Windows folder is in .wine/drive_c/windows.
~ $ cp /mnt/vista32/Windows/System32/d3dx9_36.dll .wine/drive_c/windows/system32/
This might be all you need for the new DLL to work. To make sure programs see it, we'll configure it within Wine. Wine has a configuration utility called winecfg, run it from your terminal and you'll see this:
Click the Libraries tab:
Under "New override for library", type d3dx9_36, and click Add and Apply:
Now you can click OK to exit the utility, or peruse around the other tabs and settings. One issue with loading native Windows DLLs, they may require original low-level Windows DLLs (i.e. ntdll.dll) that Wine is emulating, and might not work. These are the core DLLs that Wine is emulating and cannot be replaced with native Windows DLLs, else you'll break your Wine folder.
Using VSync patches (and possibly other DLL-based patches) on Linux
Note: Wine 1.6 seems to run the VSync patches natively. Only follow these instructions if you're using an older version of Wine, or if you get the japanese error message that translates to "DLL Injection Failed".
The VSync Patch (aka vpatch) disables VSync in the Touhou games to reduce input delay. It can also produce minor speedups, especially in Touhou EoSD.
Running vpatch.exe in Wine cannot remove all input delay, as there appears to be some inherent input delay caused by running Touhou in Wine in the first place.
Normally, when vpatch.exe is run in Wine, a Japanese error message appears which essentially translates to "DLL Injection Failed". This is because Wine by default does not have the capability to modify running programs, which is what vpatch.exe requires. To give Wine this capability, run the following command in a terminal using sudo, su, or root:
setcap cap_sys_ptrace+epi /usr/bin/wineserver
The directory for wineserver might vary based on the Linux distribution.
If no errors appear, the command was successful, and vpatch.exe should now run properly under Wine. Be sure to exit the terminal after running the command; using Wine with root privileges is bad.
You can verify that vpatch.exe is working by loading a replay and holding the Shift key. If the FPS decreases from 60FPS to 30FPS, then vpatch.exe is working normally.
This fix should also theoretically enable the use of other DLL-based patches, though I haven't tested any.
Note that this fix will give all applications running under Wine, including potentially malicious applications, the capability to modify running programs. If you're concerned about this, the following command will revoke the added capability:
setcap -r /usr/bin/wineserver
Wine in Mac OS X
Wine works similarly in OS X compared to Linux, only you need to make sure you start X11 beforehand (Applications > Utilities > X11). One issue that Mac users may encounter is incredibly slow 3D graphics performance; this is due to Apple's X11 implementation not supporting hardware OpenGL in older versions of OS X (Tiger and below). If you encounter this, you may want to bite the bullet and upgrade.
Neko Project II, T98-Next, and Anex86 all work pretty well under Wine. If you're into two-player PoDD with a gamepad, JoyToKey also works under Wine!
There's even a native port of Neko Project II for Linux and Mac OS X called Xnp2. However, there are currently some sound problems that need to be investigated; using np2fmgen in Wine is recommended instead.
One issue I've seen is with joysticks. If you plug in your joystick while your Touhou game is running, it probably won't notice it. Make sure it's plugged in and working before running your Touhou game.
Installing English patches has been known to cause otherwise troublesome games to start working better.
For SWR and HSTS, see here (SWR/HSTS Wiki).
The Wine developers are constantly adding and fixing functionality, so while things are still iffy with Touhou games they're definitely improving. See below for a list of the current Touhou bugs on the Wine Bugzilla.
Outside the official games...
Touhou doujin games are also hit-or-miss. Danmakufu 0.x doesn't work at all, whereas ph3 does. Age of Ethanols is a .NET game, so it should run natively in Mono, but in my trials in getting it to run I've discovered it's coded in part C#, part C++, so it won't work without installing .NET and whatnot from within Wine.
Touhou Games in the Wine AppDB (appdb.winehq.org)
Wine Bug Status (bugs.winehq.org)
421 (EoSD - TD) Bad Text Part 2, DIB Engine Implementation: Now Implemented
13297 (EoSD - FW) Missing D3DXCreateTextureFromFileA in d3dx9_36.dll: Now Implemented
13490 (SWR, Patchcon) Nvidia video driver FPU bug, improper rounding causing game crash: Fixed in Nvidia drivers 275.19
13554 (IaMP) Broken config.exe (16-bit app), comctl32.dll not properly imported: Fixed as of Wine 1.7.6
15146 (MoF, TD) Bad Text Part 1, Mishandled rgb444 Depth Conversion: Now Implemented
18232 (SA, UFO) Huge framerate drop when OffscreenRenderingMode=fbo (Intel i945 graphics chips): Driver issue resolved
18394 (PoFV) Patching to 1.50a breaks game, problems with dpnet.dll: Fixed as of Wine 1.7.6
19106 (MoF) Improperly rendered backgrounds: Reported fixed as of Wine 1.4-rc6
24206 (HSTS) Ending network game causes hangup: Reported fixed as of Wine 1.5.27
30538 (SA - TD) Framerate Regression due to EDID polling lag
18440 (SWR) Menu/Game select crashes, problems with GetGlyphOutline in d3dx9_33.dll
25857 (HM) Needs ID3DXEffectImpl_*Pass calls implemented
33760 (MoF - TD) Aliased text
33761 (DDC) Aliased text and art
Using Parallels and VMWare Fusion (Virtualization)
Another alternative that works very well is to use Parallels Desktop to run the games.
Parallels Desktop version 5.0 runs the main series games very well: All of the Windows danmaku games except for PCB run without slowdown on a MacBook Pro. PCB appears to suffer from slowdown for unknown reasons.
Update: Version 1.00a of Ten Desires can be significantly laggy. Patching to 1.00c resolves all issues and will run the game at 60FPS
It is important to run the games in full screen, and it is better to use the zoom function to bring the game screen to full screen, at least on a MacBook Pro. Running the games in windowed mode often results in slowdown, and the computer appears to have real difficulties in displaying 640x480 natively (the games will run at 30fps). You can run them in 720x480 just fine, though.
Activate the zoom function through the "Trackpad" pane in System Preferences, and zoom in by putting the mouse in the middle of the screen and holding control and scrolling up with two fingers.
The fighting games (SWR and Soku) have no slowdown during matches, but DO have a serious delay while loading for the match (close to a minute). It has been suggested, but not yet confirmed, that placing the games on the virtual C: drive, rather than on the OSX desktop or other location in OSX, may clear this out; Parallels treats the Mac's hard drive as a network drive, which may slow access. Netplay has yet to be tested for either the fighters or for PoFV.
If your SWR/Soku display looks strange when run in fullscreen (usually, a bar at the bottom and right of the screen that displays the desktop), set the game to run in Windowed mode, exit out, and restart the game. Then change it back to fullscreen in the menu.
The PC-98 games can be run through anex86 without difficulty (so yes, emulation within
emulation virtualization). There is a PC-98 emulator for OSX, but it has not been updated for several years and does not appear to accept the Touhou games.
The following fan games have been confirmed to run fine under Parallels Desktop 5 using Windows XP on a MacBook Pro:
- Genius of Sappheiros (with or without English patch)
- Koumajou Densetsu Scarlet Symphony (both games)
The following do NOT run under Parallels 5, have severe slowdown, or suffer from fatal glitches, although in some cases this may be due to the graphics card (apparently, some of the fan games don't communicate properly with NVIDIA cards.):
- Super Marisa World (runs at 30FPS)
- Mountain of Faith Phantasm (runs at 30FPS)
- Sengou Gensokyo (cannot input commands during battle, otherwise 100%)
- Touhou Labyrinth (either will not display, or overwhelming glitches)
- Touhou Soccer 2 (no display)
For unknown reasons, VMWare Fusion will not run the Touhou games properly
The games have not yet been tested with Parallels Desktop 6. Stay tuned for information.
Another Way of Running Touhou Games on Mac
There is an easier way of running Touhou Games on a Mac. You need a Mac OSX with version 10.6.8 or later, X11, and Winebottler.
X11 is available at the iTunes Store, at a cheap price, or free if you get older versions.
You can download Winebottler here. Press the free download button, and a Disk Image should appear on your desktop after download. Drag the application Wine and Winebottler into your applications folder.
Download Touhou games if you have to.
Now, double click the Touhou game .exe . A dialogue box should pop up that says 'What would you like to do with the file?' Below that should be two options:
1.Run directly in /Users/((Homefoldername))/Wine
2. Convert to simple OS X application bundle.
Click on the first option. DO NOT CLICK THE SECOND ONE. The game will not run and your Wine will crash.
It should automatically open up X11 and run the game. No coding is required.
Most of the Touhou games, especially the 2nd gen Windows games, might experience minor to unacceptable slowdown on Intel Integrated Graphics (needs to be confirmed; does this slowdown also occur on dedicated graphics cards?)
EoSD, PCB, and IN will automatically glitch if you click the screen after loading the game. You controls will start going wonky and most likely you will have to quit Wine and X11. If you run the games for a prolonged period the in-game music will stop, and no matter how many times you quit Wine and start up the game again, the music will be gone. Controls going wonky can be resolved by opening the game's custom.exe and checking the box with the word "DirectInput". Also, the audio bugs should be fixed as of PulseAudio 1.0 & Alsa 1.0.25 (source)
Do not run games in full screen. Doing this will crash Wine. Wine 1.4 does not exhibit this issue.
Out of the 3 fighting games, only IaMP works. SWR and Hisoutensoku will appear as a black screen before Wine crashes.
TD will not work on Wine. I have a feeling that nothing after TD will work, since you will have to install some Windows software before playing it. TD seems to work in Wine 1.4, though my old laptop is physically unable to run the 2nd gen windows games at more than 15fps.
In-game english dialogue of MoF, SA, UFO, TGFW will not appear. Of all the Windows games, in-game japanese dialogue will appear as code. (This should be fixed, but I'm unable to test this)
All of the games will run on Normal FPS (that is, 60 or above) unless you have CPU fan wasting applications open.
((I have personally encountered a glitch in which after opening the game PoFV, IN will no longer work. Not sure if anyone else has encountered this glitch.))
((Note that these glitches are attributed to running of games using Winebottler (only) and X11 (the section above) I haven't tried the code way to open up games. If there is a new, improved version of Winebottler that works just like Wine, please tell me!))