~Hakurei Shrine~ > Tech Support

Touhou on Linux and MacOS X, using Wine or Virtualization

(1/25) > >>

Note:  This also exists on Touhou Wiki here.

For those of us who run Linux as our only operating system, finding functional alternatives to Windows programs can be pretty hard.  In the case where we need to run Windows programs, the Wine project has been long developing an 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, MacOS X.

Running Touhou games on Wine is hit-or-miss, but is possible.  Here I'll show how Wine works, and how to (attempt to) play Windows Touhou games under Wine.

Before we start, this does require a little familiarity with the shell (or command-line interface).  This Linux guide has a nice introduction to using the shell.

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 MacOS X using MacPorts
See Here

Using Wine
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.

Wine in MacOS 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.

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).  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:
* Megamari
* Patchcon
* Genius of Sappheiros
* Koumajou Densetsu Scarlet Symphony (both games)
* Nitroid

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.

PC98 Games
Both T98Next and Anex86 work just fine under Wine.  Also, if you're into two-player PoDD with a gamepad, JoyToKey also works under Wine.  For properly configuring your respective PC98 emulator, please see the PC98 emulator thread.

Gotchas, Troubleshooting
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 doesn't work at all.  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)
[EoSD] [PCB] [IaMP] [IN] [PoFV] [StB] [MoF] [SWR] [SA] [UFO] [HSTS] [DS] [FW] [TD]

Wine Bug Status (bugs.winehq.org)
Official Games
[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
[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
[19106] [MoF] Improperly rendered backgrounds Reported fixed as of Wine 1.4-rc6
[13554] [IaMP] Broken config.exe (16-bit app), comctl32.dll not properly imported
[18394] [PoFV] Patching to 1.50a breaks game, problems with dpnet.dll
[18440] [SWR] Menu/Game select crashes, problems with GetGlyphOutline in d3dx9_33.dll
[24206] [HSTS] Ending network game causes hangup
[30538] [SA - TD] Framerate Regression due to EDID polling lag
[30212] Koumajou Densetsu needs Scripting.Dictionary implementation.

I can't guarantee that any of this won't blow up your computer, kill your waifu, etc.  Please be careful.
Also, I'm pretty bad at writing things like this, if you have any suggestions or fixes let me know.

Original Wine/Linux thread here.

Credits:  Ruro for the original sticky, Silentsword for the Virtualization on Mac info.

Thanks for this. I have few issues running Touhou in Wine. For the most part, everything runs fine for me in Wine 1.1.33, except:

- SWR and UNL don't run at all.
- PoFV tends to freeze between stages.
- UFO's custom.exe won't open, but the game runs fine windowed.

Don't really care about the fighting games, but it would be nice to fix the UFO custom.exe thing, and get PoFV running.

Pretty much the same problems I have.  Also, a lot of the custom.exes don't work at all for me, and I don't really know if there's any fix for them.  I just don't even try to use them.

As for PoFV it freezes for me whenever I pick a character, and only certain characters in certain difficulty levels, along with random lockups between stages.  Really weird.

Just a GBZero:
This gives a bit more info for SWR and 12.3 on linux

Thanks!  I'll add that to the guide.


[0] Message Index

[#] Next page

Go to full version