• Welcome to Touhou Wiki!
  • Registering is temporarily disabled. Check in our Discord server to request an account and for assistance of any kind.

Running in Linux and macOS: Difference between revisions

From Touhou Wiki
Jump to navigation Jump to search
(Switching site as protondb now have a "proper" domain name)
m (wording update)
 
(30 intermediate revisions by 11 users not shown)
Line 1: Line 1:
[[File:Linux Th07 01.png|thumb|250px|right|''[[Perfect Cherry Blossom]]'' running in Wine]]
[[File:Linux Th07 01.png|thumb|250px|right|''[[Perfect Cherry Blossom]]'' running in Wine]]


For those of us who run [[Wikipedia:Linux|Linux]] or [[Wikipedia:Mac OS X|Mac OS X]] as our only operating system, finding functional alternatives to [[Windows]] programs can be pretty hard. When we need to run Windows programs, [http://www.winehq.org/ the Wine project] has long been a great emulation system that lets us do such a thing. Basically, it translates Windows functionality into the Linux equivalent to coding, so you can still play your Windows games, work in Photoshop, etc. under Linux and, to a certain extent, Mac OS X.
For those of us who run [[Wikipedia:Linux|Linux]] or [[Wikipedia:macOS|macOS]] as our only operating system, finding functional alternatives to [[Windows]] programs can be an issue. When we need to run Windows programs, [http://www.winehq.org/ the Wine project] has long been a great compatibility layer that lets us do just that. Basically, it translates Windows system calls into their Unix equivalents and runs programs in a Windows directory structure, so you can still play your Windows games, work in Photoshop, etc. under Linux and, to a certain extent, macOS.


It's not perfect, however; running games from the ''[[Touhou Project]]'' on Wine is hit-or-miss, but it's possible. This article will explain how Wine works, and how to (maybe) play Windows Touhou games under Wine.
Although Wine is not perfect, running official ''[[Touhou Project]]'' games on Wine will usually be fine, with some minor issues. This article will explain how Wine works and how to play Touhou games under Wine.
 
On Linux, it is recommended to use [https://lutris.net/ Lutris] as well, since it makes it easier to set up your games by not needing to run commands. See the Lutris section after you install Wine.


Before we start, this does require a little familiarity with the shell (or command-line interface). [http://tldp.org/LDP/intro-linux/html/ This Linux guide] has a nice [http://tldp.org/LDP/intro-linux/html/sect_02_02.html introduction to using the shell].
Before we start, this does require a little familiarity with the shell (or command-line interface). [http://tldp.org/LDP/intro-linux/html/ This Linux guide] has a nice [http://tldp.org/LDP/intro-linux/html/sect_02_02.html introduction to using the shell].
Line 9: Line 11:
==Installing Wine==
==Installing Wine==
===Linux===
===Linux===
*[https://www.archlinux.org/ Arch Linux]: [https://wiki.archlinux.org/index.php/Wine See here]
For many distributions, you will need to add the official WineHQ repository in order to install Wine. It can then be installed using your package manager. Alternatively, it can be installed from a GUI such as the Ubuntu Software Center.
*[http://www.ubuntu.com/ Ubuntu] and [http://www.debian.org/ Debian]: [http://www.winehq.org/download/deb See Here]
 
*[http://fedoraproject.org/ Fedora]: [http://fedoraproject.org/wiki/Wine See Here]
It is recommended to use the '''Staging''' version of Wine, since the universal Touhou practice tool [https://github.com/ack7139/thprac/releases thprac] will not work without it. This package is typically called <tt>winehq-staging</tt> or <tt>wine-staging</tt>. The Stable (standard) version is called <tt>winehq-stable</tt> or <tt>wine-stable</tt>. Installation instructions for Wine Staging are listed below.
*[http://www.opensuse.org/en/ SuSE]: [http://en.opensuse.org/Wine See Here]
 
*[http://www.gentoo.org/ Gentoo]: [http://wiki.winehq.org/Gentoo See Here]. Unmasking the git-fetching ebuild is recommend. 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.
'''Debian-based distributions'''
 
For Debian-based distributions, replace "focal" with "bionic".
<syntaxhighlight lang="bash">
sudo dpkg --add-architecture i386
wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
sudo apt-add-repository 'deb http://dl.winehq.org/wine-builds/ubuntu/ focal main'
sudo apt update
sudo apt install winehq-staging
</syntaxhighlight>
 
'''Fedora'''
 
If you use an older version of Fedora, make sure to replace 34 with the correct version number.
<syntaxhighlight lang="bash">
sudo dnf config-manager --add-repo https://dl.winehq.org/wine-builds/fedora/34/winehq.repo
sudo dnf install winehq-staging
</syntaxhighlight>
 
It should be noted that the version in Fedora's official repository is usually "new enough". Thus, simply
 
<syntaxhighlight lang="bash">
sudo dnf install wine
</syntaxhighlight>
 
should be enough. (For example, on a F36 box, the wine version is latest stable 7.0)
 
'''Arch Linux'''
 
Before installing Wine, enable multilib repository in <tt>/etc/pacman.conf</tt> and then update the repository with <code>pacman -Syu</code>.
<syntaxhighlight lang="bash">
sudo pacman -S wine-staging
</syntaxhighlight>
 
'''Building from source'''
 
If you do not use one of the above distros, or you cannot reliably connect to the winehq server, you can also build wine from source.
 
Note that building wine takes at least three hours on a reasonable system.
 
===macOS===
Wine no longer works as of macOS Catalina (version 10.15), as that version ended support for 32-bit applications. The only way to play Touhou on the newest versions of macOS is to use a [[Running_in_Linux_and_macOS#Using_Virtual_Machines|virtual machine]].


===Mac OS X===
'''Using MacPorts'''
'''Using MacPorts'''


If you already have MacPorts installed with all dependencies, simply run <code>$ sudo port install wine</code> to install with all dependencies.
If you already have MacPorts installed with all dependencies, simply run <code>sudo port install wine</code> to install with all dependencies.


If you have yet to install MacPorts, refer to this [http://www.macports.org/install.php installation instructions].
If you have yet to install MacPorts, refer to this [http://www.macports.org/install.php installation instructions].
Line 24: Line 66:
'''Using Homebrew'''
'''Using Homebrew'''


Go [http://brew.sh/ here] and install if needed, then run <code>$ brew install wine</code>
Go [http://brew.sh/ here] and install if needed, then run <code>brew install wine</code> in your terminal.


==Using Wine==
==Using Wine==
Wine puts a hidden directory in your home folder, called <tt>.wine</tt>, which contains a full representation of a Windows folder hierarchy and miscellaneous library and system files. The <tt>.wine</tt> folder lives inside your home directory (~/.wine). Inside is another folder called <tt>drive_c</tt>, 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.
On its first run, Wine creates a hidden directory in your home folder, called <tt>.wine</tt>, which contains a full representation of a Windows folder hierarchy and miscellaneous library and system files. One such representation is called a '''prefix''' (see the Wine prefixes section for more information). The <tt>.wine</tt> folder is in your home directory (~/.wine). Inside is another folder called <tt>drive_c</tt>, which is your Wine install's C: drive folder. If you browse inside this folder (<tt>~/.wine/drive_c</tt>), you will probably recognize its 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. To do this, navigate to the folder that contains the executable and then invoke Wine.
Generally, with Wine installed, your Linux distribution will have assigned Windows executables to automatically invoke Wine, so double-clicking a Windows executable should work. If not, you will have to run Wine from your terminal. To do this, navigate to the folder that contains the executable and run it with Wine, like so:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
~ $ cd .wine/drive_c/Program\ Files/RandomProgram
cd .wine/drive_c/Program\ Files/RandomProgram
~/.wine/drive_c/Program Files/RandomProgram $ wine program.exe
wine program.exe
</syntaxhighlight>
</syntaxhighlight>
And that ought to start up your program.


===Running Touhou games===
===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 to prevent some serious [[Wikipedia:Mojibake|mojibake]]. This can be done by adding <code>LANG="ja_JP.UTF-8"</code> before executing Wine.
Running a Touhou game is done the same way, either by double-clicking or using the terminal as shown above.


The example below took the installation of ''[[Double Spoiler]]'' and ran <tt>th125.exe</tt> which is the game:
Assuming you have a Japanese font installed on your system, the in-game text should show just fine and you do not need to run the game in Japanese locale. For ''[[Embodiment of Scarlet Devil]]'' however, as well as the resolution setting dialogs when launching a game, Japanese locale is required. This can be set by adding <code>LC_ALL="ja_JP.UTF-8"</code>, in front of your command to run Wine. The following example will navigate to a folder containing ''[[Double Spoiler]]'' and then launch it in Japanese locale:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
~ $ cd .wine/drive_c/Program\ Files/上海アリス幻樂団/ダブルスポイラー
cd .wine/drive_c/Program\ Files/上海アリス幻樂団/ダブルスポイラー
~/.wine/drive_c/Program Files/上海アリス幻樂団/ダブルスポイラー $ LANG="ja_JP.UTF-8" wine th125.exe
LC_ALL="ja_JP.UTF-8" wine th125.exe
</syntaxhighlight>
</syntaxhighlight>


'''Note:''' If you are running the language patch version of the game (<tt>en_US</tt> for example), you won't need no specify this unless if your system locale isn't <tt>en_US.UTF-8</tt>, specify <code>LANG="en_US.UTF-8"</code> before the command. Same applies to other language patch as well
Vpatch is not needed to run the games smoothly, unlike on Windows. See [[Running in Linux and macOS#Minimizing input lag|Minimizing input lag]] for how to prevent input lag on Linux.


'''Running games as 32-bits version of Windows'''
===Wine prefixes===
A prefix, or colloquially 'bottle', is a folder containing the Windows directory structure, to which specific Wine settings can be assigned. This way, it is possible to run certain games with Wine set to Windows 7, but others Windows 98, for example. A new prefix can be created by running <code>WINEPREFIX=&lt;path&gt; winecfg</code>, which will launch Wine's configuration menu as well. Note that the path must be absolute, e.g. <tt>~/.prefix_name</tt> to place it in your home directory. To create a 32-bit prefix, add <code>WINEARCH=win32</code> in front of the aforementioned example.


Due to the fact that some games still requires to run as 32-bits installation of Windows and the latest version of Wine usually installs as 64-bits, users need to change <tt>WINEARCH</tt> to <tt>win32</tt>. This is necessary if you want to install some missing components as demonstrated in the section below. It is recommended to change the Wine directory (normally <tt>~/.wine</tt>) to something else and set <code>WINEARCH=win32</code> before running the game.
For the official Touhou games, multiple prefixes are not needed and you can use any single prefix, such as the default <tt>.wine</tt> in your home directory. It can however be useful for other games, if they need Wine to run with different settings, such as a different Windows operating system, 32-bit instead of 64-bit, or different Windows libraries or components. If you need to run a game using a different prefix, specify it using <code>WINEPREFIX=&lt;path&gt; &lt;game&gt;</code>; not specifying any prefix will make Wine use the default one.
 
<syntaxhighlight lang="bash">
~/.wine/drive_c/Program Files/上海アリス幻樂団/ダブルスポイラー $ export WINEPREFIX="~/.wine32"
~/.wine/drive_c/Program Files/上海アリス幻樂団/ダブルスポイラー $ export WINEARCH=win32
~/.wine/drive_c/Program Files/上海アリス幻樂団/ダブルスポイラー $ LANG="ja_JP.UTF-8" wine th125.exe
</syntaxhighlight>


===Installing missing native Windows components===
===Installing missing native Windows components===
 
Although most Touhou games should run out of the box with the recent development of Wine, some games might experience instant crashes when trying to run them through Wine. This is mostly because Wine does not include all Windows libraries by default and missing libraries can lead to a crash. Make sure that all necessary components to launch the game are installed. There are some ways to achieve this:
Although most Touhou games should run out of the box with the recent development of Wine, some games might experience instant crash when try to running through Wine. This is mostly because Wine cannot emulate all of the Windows libraries/DLLs therefore leads to missing libraries and such which leads to crash. Before running the game, user should make sure that all necessary components are installed. There are some ways to achieve this:
   
   
'''Using Winetricks'''
'''Using Winetricks'''


[https://wiki.winehq.org/Winetricks Winetricks] is a helper script to aid in installing Windows components such as dlls, Windows runtime library. With <tt>winetricks</tt>, all installation of dlls and libraries can be done with merely a command.
[https://wiki.winehq.org/Winetricks Winetricks] is a program that is the primary method for installing Windows libraries (DLL) and other components. With <tt>winetricks</tt>, all of these installations can be done with merely a command, such as:
 
Start by installing Winetricks by following the installation instruction provided [https://github.com/Winetricks/winetricks here]. After installation. We will install  Execute this command to install "d3dx9_36.dll"


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
~ $ winetricks d3dx9_36
winetricks d3dx9_36
</syntaxhighlight>
</syntaxhighlight>


<tt>Winetricks</tt> also have a GUI, which can be open by executing <code>winetricks</code> in the Terminal.
Start by installing <tt>winetricks</tt> and following the installation instruction provided [https://github.com/Winetricks/winetricks here]. <tt>Winetricks</tt> also has a GUI, which can be opened by executing <tt>winetricks</tt> in a terminal window. To run it on a specific prefix, specify the prefix like so: <code>WINEPREFIX=&lt;path&gt; winetricks</code>.


'''Note:''' Some libraries such as <tt>dotnet40</tt> requires to install in a 32-bits environment.  
'''Note:''' Some libraries such as <tt>dotnet40</tt> have limited 64-bit support and may or may not be fully functional.


'''Copy the .dll from the Windows installation folder'''
'''Copy the .dll file from the Windows installation folder'''


Another way to temporarily fix a partially-functioning DLL is to replace it with the original file from a Windows install. Here is the way to do it.
Another way to temporarily fix a partially-functioning DLL is to replace it with the original file from a Windows install. Here is the way to do it.


'''Note:''' This was done on a 32-bit Vista installation mounted at /mnt/vista32.
'''Note:''' This was done on a 32-bit Vista installation mounted at <tt>/mnt/vista32</tt>.


First off, to copy the file. Wine's Windows folder is in .wine/drive_c/windows.
First off, to copy the file. Wine's Windows folder is in <tt>.wine/drive_c/windows</tt>.


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
~ $ cp /mnt/vista32/Windows/System32/d3dx9_36.dll .wine/drive_c/windows/system32/
cp /mnt/vista32/Windows/System32/d3dx9_36.dll .wine/drive_c/windows/system32/
</syntaxhighlight>
</syntaxhighlight>


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:<br />
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 <tt>winecfg</tt>; run it from your terminal, then click the "Libraries" tab and under "New override for library", type d3dx9_36, click "Add" followed by "Apply", and now you can click "OK" to exit the utility or peruse around the other tabs and settings. One issue with loading native Windows DLLs is that they may require original low-level Windows DLLs (e.g. <tt>ntdll.dll</tt>) 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; you will break your Wine prefix by doing so.
[[File:wine1.png]]<br />
Click the "Libraries" tab:<br />
[[File:wine2.png]]<br />
Under "New override for library", type d3dx9_36, and click "Add" then "Apply":<br />
[[File:wine3.png]]<br />
Now you can click "OK" to exit the utility, or peruse around the other tabs and settings. One issue with loading native Windows DLLs is that 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 Mac OS X===
===Wine on macOS===
Wine works similarly in OS X compared to Linux. 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.
Wine on macOS is very similar to Linux. One issue that macOS 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 macOS (Tiger and below). If you encounter this, you may want to bite the bullet and upgrade.


===PC-98 Games===
==Lutris==
Various emulators such as Neko Project II, T98-Next, and Anex86 all work pretty well under Wine in order to play the [[PC-98]] Touhou games. If you're into two-player ''[[Phantasmagoria of Dim.Dream]]'' with a gamepad, [http://www.electracode.com/4/joy2key/JoyToKey%20English%20Version.htm JoyToKey] also works under Wine!
Lutris is a Linux game manager, which makes it relatively easy to run all sorts of different games under different settings. It essentially provides a graphical interface to help streamline the process, so you do not need to run commands or shell scripts in order to play your games.


There's even a native port of Neko Project II for Linux and Mac OS X called [http://www.nonakap.org/np2/ Xnp2]. However, there are currently some sound problems that need to be investigated; using np2fmgen in Wine is recommended instead.
To install Lutris, follow the instructions for your distro as listed on [https://lutris.net/downloads/ the official Lutris website]. Assuming you have installed Wine Staging from the previous instructions, Wine will be usable as a "runner" in Lutris, that is, a program that can run games. Lutris can also launch a large variety of emulators, as well as native Linux games.


==Using VSync patches (and possibly other DLL-based patches) on Linux==
===Adding Games===
'''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".
To add a game, click the large '+' button in the top left, and choose Wine as the runner. In the Game options tab, provide the path to the executable and the game directory. Leave the Runner options and System options tabs unchanged. For an example, see the screenshots below.


The [[Game Tools and Modifications#Vsync Patches|VSync Patch]] (aka vpatch) disables VSync in the Touhou games to reduce input delay. It can also produce minor speedups, especially in ''[[Embodiment of Scarlet Devil]]''.
You can go back to game settings by right clicking a game and then clicking Configure. It is also possible to change the icon and banner by clicking them from the settings window. If you want to make a desktop or application menu shortcut to your game, right click the game on the main screen after it is added, and click 'Create desktop shortcut' or 'Create application menu shortcut'.


Running <tt>vpatch.exe</tt> 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.
{{multiple image
| align = left
| width = 300
| image1=Lutris1a.png | alt1=Lutris main menu
| image2=Lutris2a.png | alt2=Game info tab
| image3=Lutris3a.png | alt3=Game options tab
| image5=Lutris5a.png | alt5=Game added
| footer = ''[[Ten Desires]]'' being added into Lutris
| footer_align = center
}}
{{clear}}


Normally, when <tt>vpatch.exe</tt> is run in Wine, a Japanese error message appears which essentially translates to "DLL Injection Failed". This is because Wine by default doesn't have the capability to modify running programs, which is what <tt>vpatch.exe</tt> requires. To give Wine this capability, run the following command in a terminal using sudo, su, or root:
===Minimizing input lag===
To reduce input lag, you need to disable vsync and desktop compositing. Click the gear icon next to Wine under Runners. In the window that opens, navigate to the System options tab an add the following environment variables: <code>dxgi.syncInterval</code> and <code>d3d9.presentInterval</code>, both set to <code>0</code>. This will disable vsync. Additionally, check 'Show advanced options' and enable 'Disable desktop effects' in the same tab, which will disable the compositor.


<syntaxhighlight lang="bash">
This can also be applied only to an individual game, rather than all Wine games. To do this, use the System options tab of a single game instead (Right click game -> Configure).
setcap cap_sys_ptrace+epi /usr/bin/wineserver
</syntaxhighlight>


The directory for wineserver might vary based on the Linux distribution.
{{multiple image
| align = left
| width = 300
| image1=Lutris6a.png | alt1=Wine gear icon
| image2=Lutris7a.png | alt2=Wine system options
| image3=Lutris8a.png | alt3=Wine system options
| footer = How to reduce input lag
| footer_align = center
}}
{{clear}}


If no errors appear, the command was successful, and <tt>vpatch.exe</tt> should now run properly under Wine. Be sure to exit the terminal after running the command; using Wine with root privileges is [http://wiki.winehq.org/FAQ/#run_as_root bad].
If you use an NVIDIA graphics card, you also want to set the kernel parameter <code>nvidia-drm.modeset=1</code> to enable Kernel Mode Setting (KMS). AMD and Intel integrated graphics enable this by default. Assuming you use GRUB as your bootloader, edit <tt>/etc/default/grub</tt> and add it at the end of the value for <code>GRUB_CMDLINE_LINUX_DEFAULT</code>. Add <code>GRUB_CMDLINE_LINUX_DEFAULT="nvidia-drm.modeset=1"</code> if it is not present. Update grub with <code>sudo update-grub</code>, or <code>sudo grub-mkconfig &lt;your_grub_path&gt;</code>, and reboot for the change to apply. See [https://wiki.archlinux.org/title/Kernel_parameters ArchWiki] for other bootloaders.


You can verify that <tt>vpatch.exe</tt> is working by loading a replay and holding the Shift key. If the FPS decreases from 60FPS to 30FPS, then <tt>vpatch.exe</tt> is working normally.
==PC-98 Games==
The multi-system emulator [https://www.retroarch.com/ RetroArch] provides Neko Project II, which can be used to play the PC-98 games, and runs on both macOS and Linux. Do note that ''the clock multiplier is set too low by default''; it should be set to 16 in the emulator settings (accessed by pressing F1 while in-game).


This fix should also theoretically enable the use of other DLL-based patches, though none have been tested.
[https://dosbox-x.com/ DOSBox-X] also supports running PC-98 software and has native macOS and Linux versions.


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:
Various emulators such as the Windows version of Neko Project II, T98-Next, and Anex86 all work pretty well under Wine in order to play the [[PC-98]] Touhou games. For playing with a gamepad, [https://joytokey.net/en/ JoyToKey] also works under Wine. There is also a native port of Neko Project II for Linux and macOS called [http://www.nonakap.org/np2/ Xnp2]; however, there are currently some sound problems that need to be investigated{{cn}}. The regular Neko Project II is generally the best option.


<syntaxhighlight lang="bash">
==Fangames==
setcap -r /usr/bin/wineserver
{{stub|section}}
</syntaxhighlight>


==Gotchas, Troubleshooting==
==Troubleshooting==
{{Main|/Misc fixes|l1=Misc fixes}}
{{Main|/Misc fixes|l1=Misc fixes}}
* There are issues 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.
* For ''[[Scarlet Weather Rhapsody]]'' and ''[[Touhou Hisoutensoku]]'', [[hisouten:Linux_support|see here]] (SWR/HSTS Wiki).


*There are issues 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.
The Wine developers are constantly adding and fixing functionality, so while things are still iffy with certain Touhou games, they are definitely improving. See the main article linked above for a list of current Touhou bugs in Wine.


*Installing English patches has been known to cause otherwise troublesome games to start working better.
==Playing Steam Games on Linux==
With the release of some titles such as [https://en.touhouwiki.net/wiki/Hidden_Star_in_Four_Seasons Hidden Star in Four Seasons] or [https://en.touhouwiki.net/wiki/Antinomy_of_Common_Flowers Antinomy of Common Flowers] on Steam and the support of [https://steamcommunity.com/games/221410/announcements/detail/1696055855739350561 Proton], playing Touhou games on Steam has become easier for Linux users, since you can now use the built-in compatibility layers that Steam provides. Proton used to be quite buggy when it was new, but nowadays, if any game runs on Wine, you can typically expect it to run on Proton as well.


*For ''[[Scarlet Weather Rhapsody]]'' and ''[[Touhou Hisoutensoku]]'', [[hisouten:Linux_support|see here]] (SWR/HSTS Wiki).
===Installation and setup===
*[http://www.ubuntu.com/ Ubuntu]: [https://wiki.ubuntu.com/Valve See here]
*[https://www.debian.org/ Debian]: [https://wiki.debian.org/Steam See here]
*[https://www.archlinux.org/ Arch Linux]: [https://wiki.archlinux.org/index.php/steam See here]


*Games running at triple or even quadruple times normally on danmaku games which made the game running faster than normal is common when running with Nvidia GPU. Try to limit the FPS to 60 by enable VSync or adding <tt>VBLANK_MODE=1</tt> before using <tt>primusrun</tt> or <tt>optirun</tt> if you are using a hybrid GPU setup.
To enable Proton for all games, go to '''Steam -> Settings''', where a section called '''Steam Play''' will appear in the bottom of the sections list; navigate to the section and check '''Enable Steam Play for all titles''', after which Steam will have to be restarted. Following that, all of your games that don't run on Linux natively will automatically use Proton. This includes Non-Steam games that you manually add into your library.


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.
The current game compatibility can be found on [https://www.protondb.com/ the ProtonDB website]. Proton will automatically use the correct aspect ratio in fullscreen mode.


==Outside the official games...==
===Troubleshooting===
Touhou doujin games are also hit-or-miss.  
* Some user might experience game crashing with Proton right when starting up without it prompting to install any drivers (e.g. Proton needing to install DirectX if you are running HSiFS for the first time). If that is the case, consider using the flatpak version of Steam.
 
* There is also some problem regarding launching games that reside on NTFS partitions. This is a confirmed bug; a workaround for this is to mount the partition using [https://wiki.archlinux.org/index.php/NTFS-3G ntfs-3g] rather than <tt>ntfs</tt>. Make sure that you are the owner of the partition in question; set the options <code>defaults,uid=1000,gid=1000</code> for your NTFS partition in your <tt>/etc/fstab</tt> file.
''[[Age of Ethanols]]'' is a .NET game, so it should run natively in Mono. However, it's coded in part C#, part C++, so it won't work without installing .NET and whatnot from within Wine.
* If a game runs very slowly, try disabling DXVK. This can be done by setting <code>PROTON_USE_WINED3D11=1</code> as a game-specific launch option for Proton.
 
* If the audio is not working, try to install the following packages: <code>lib32-alsa-plugins</code> <code>lib32-libpulse</code> <code>lib32-openal</code>.
[[Moedan]] works fine in Wine (Wine 1.7.20, MacOSX)
* If you encounter an issue regarding a failure with Direct3D while running inside of Steam, try to add <code>PROTON_USE_WINED3D=1 %command%</code> in the textbox located at the game's properties > General > Launch Options.


[[Touhou Danmakufu]] 0.12m may or may not work - it worked better in older versions of wine, but crashes on start due to DirectX issues in later versions. ph3 works fine with the exception of .mp3 files not running due to copyright issues on .mp3 files and the consequent inability of Wine to run them as they would normally be run. (Wine 1.7.27, MacOSX)
==Using Virtual Machines==
'''Note:''' it is '''not recommended''' to play Touhou games this way on macOS or Linux, as it is very slow and memory-consuming to start an entire operating system just to play Touhou; only do this as a ''last resort''!


[[Labyrinth of Touhou]] works fine in Wine. (Wine 1.6 RC-1, MacOSX)
It is possible to use virtualization software such as Oracle VirtualBox and VMWare Player (both macOS and Linux) and Parallels Desktop (macOS) to run a virtual Windows operating system to play the Touhou games with. This virtual system is known as a virtual machine, or VM for short. You will be able to install and run them just as you would on Windows, as you are running Windows within your native operating system. You need Windows installation media (such as an ISO file) in order to install a Windows VM; for Windows 7 through Windows 10, see [https://support.microsoft.com/en-us/help/15088/windows-10-create-installation-media this Microsoft help page] for information on creating installation media.


==Touhou Games in the Wine AppDB (appdb.winehq.org)==
Normally a VM has limited graphics capability, due to using a virtual graphics driver rather than a dedicated graphics card. If you own more than one graphics card, however, it is possible to use PCI passthrough. With that set up, your VM uses the secondary graphics card while your host OS uses the primary one. This means that you can run more demanding games, as much as the graphics card allows. See [https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF this ArchWiki page] for more information.
<nowiki>[</nowiki> [http://appdb.winehq.org/objectManager.php?sClass=application&iId=6020 EoSD]<nowiki>] [</nowiki> [http://appdb.winehq.org/objectManager.php?sClass=application&iId=5810 PCB]<nowiki>] [</nowiki> [http://appdb.winehq.org/objectManager.php?sClass=application&iId=3362 IaMP]<nowiki>] [</nowiki> [http://appdb.winehq.org/objectManager.php?sClass=application&iId=4473 IN]<nowiki>] [</nowiki> [http://appdb.winehq.org/objectManager.php?sClass=application&iId=3363 PoFV]<nowiki>] [</nowiki> [http://appdb.winehq.org/objectManager.php?sClass=application&iId=5781 StB]<nowiki>] [</nowiki> [http://appdb.winehq.org/objectManager.php?sClass=application&iId=6117 MoF]<nowiki>] [</nowiki> [http://appdb.winehq.org/objectManager.php?sClass=application&iId=7426 SWR]<nowiki>] [</nowiki> [http://appdb.winehq.org/objectManager.php?sClass=application&iId=8077 SA]<nowiki>] [</nowiki> [http://appdb.winehq.org/objectManager.php?sClass=application&iId=9362 UFO]<nowiki>] [</nowiki> [http://appdb.winehq.org/objectManager.php?sClass=application&iId=10274 HSTS]<nowiki>] [</nowiki> [http://appdb.winehq.org/objectManager.php?sClass=application&iId=11267 DS]<nowiki>] [</nowiki> [http://appdb.winehq.org/objectManager.php?sClass=application&iId=11947 FW]<nowiki>] [</nowiki> [http://appdb.winehq.org/objectManager.php?sClass=application&iId=12978 TD]<nowiki>] [</nowiki> [http://appdb.winehq.org/objectManager.php?sClass=application&iId=15183 HM]<nowiki>] [</nowiki> [http://appdb.winehq.org/objectManager.php?sClass=application&iId=15180 DDC]<nowiki>] [</nowiki> [https://appdb.winehq.org/objectManager.php?sClass=application&iId=16141 ISC]<nowiki>] [</nowiki> [https://appdb.winehq.org/objectManager.php?sClass=application&iId=17603 ULiL]<nowiki>] [</nowiki> [https://appdb.winehq.org/objectManager.php?sClass=application&iId=16861 LoLK]<nowiki>][</nowiki> [https://appdb.winehq.org/objectManager.php?sClass=application&iId=18890 AoCF]<nowiki>][</nowiki> [https://appdb.winehq.org/objectManager.php?sClass=application&iId=18247 HSiFS]<nowiki>]</nowiki>
 
===Wine Bug Status (bugs.winehq.org)===
'''<p>Official Games</p>'''
 
'''<span style="background: lime;">[http://bugs.winehq.org/show_bug.cgi?id=421 421]</span> (EoSD - TD)''' Bad Text Part 2, DIB Engine Implementation:  '''Now Implemented'''<br />
'''<span style="background: lime;">[http://bugs.winehq.org/show_bug.cgi?id=13297 13297]</span> (EoSD - FW)''' Missing D3DXCreateTextureFromFileA in d3dx9_36.dll:  '''Now Implemented'''<br />
'''<span style="background: lime;">[http://bugs.winehq.org/show_bug.cgi?id=13490 13490]</span> (SWR, Patchcon)''' Nvidia video driver FPU bug, improper rounding causing game crash:  '''Fixed in Nvidia drivers 275.19'''<br />
'''<span style="background: lime;">[http://bugs.winehq.org/show_bug.cgi?id=13554 13554]</span> (IaMP)''' Broken config.exe (16-bit app), comctl32.dll not properly imported:  '''Fixed as of Wine 1.7.6'''<br />
'''<span style="background: lime;">[http://bugs.winehq.org/show_bug.cgi?id=15146 15146]</span> (MoF, TD)''' Bad Text Part 1, Mishandled rgb444 Depth Conversion:  '''Now Implemented'''<br />
'''<span style="background: lime;">[http://bugs.winehq.org/show_bug.cgi?id=18232 18232]</span> (SA, UFO)''' Huge framerate drop when OffscreenRenderingMode=fbo (Intel i945 graphics chips):  '''Driver issue resolved'''<br />
'''<span style="background: lime;">[http://bugs.winehq.org/show_bug.cgi?id=18394 18394]</span> (PoFV)''' Patching to 1.50a breaks game, problems with dpnet.dll:  '''Fixed as of Wine 1.7.6'''<br />
'''<span style="background: lime;">[http://bugs.winehq.org/show_bug.cgi?id=19106 19106]</span> (MoF)''' Improperly rendered backgrounds: '''Reported fixed as of Wine 1.4-rc6'''<br />
'''<span style="background: lime;">[http://bugs.winehq.org/show_bug.cgi?id=24206 24206]</span> (HSTS)''' Ending network game causes hangup: '''Reported fixed as of Wine 1.5.27'''<br />
'''<span style="background: lime;">[http://bugs.winehq.org/show_bug.cgi?id=18440 18440]</span> (SWR)''' Menu/Game select crashes, problems with GetGlyphOutline in d3dx9_33.dll:  '''Fixed as of Wine 1.7.29'''<br />
'''<span style="background: lime;">[https://bugs.winehq.org/show_bug.cgi?id=36882 36882]</span> (MoF, DDC, ISC)''' Certain Touhou Games (10, 14, 14.3) run at 20 FPS rather than 60:  '''Fixed as of Wine 1.7.36'''<br />
'''<span style="background: lime;">[http://bugs.winehq.org/show_bug.cgi?id=30538 30538]</span> (SA - TD)''' Touhou 11, 12, and 13 are incredibly slow with Intel, Nouveau, and Nvidia drivers<br />
'''<span style="background: red;">[https://bugs.winehq.org/show_bug.cgi?id=20080 20080]</span> (PCB, ISC)''' Menu cursor moves around by itself <br />
'''<span style="background: lime;">[http://bugs.winehq.org/show_bug.cgi?id=25857 25857]</span> (HM)''' Needs ID3DXEffectImpl_*Pass calls implemented '''Fixed as of Wine 2.7'''<br />
'''<span style="background: red;">[http://bugs.winehq.org/show_bug.cgi?id=33760 33760]</span> (DDC)''' Jagged edges on most text and art in the Touhou 14 demo<br />
'''<span style="background: red;">[http://bugs.winehq.org/show_bug.cgi?id=33761 33761]</span> (MoF - TD)''' Touhou 10 and up have aliased dialogue text<br />
 
'''<p>Fangames</p>'''
'''<span style="background: lime;">[http://bugs.winehq.org/show_bug.cgi?id=30212 30212]</span>''' '''Koumajou Densetsu''' needs Scripting.Dictionary implementation:  '''Fixed as of Wine 1.7.38'''<br />
'''<span style="background: red;">[http://bugs.winehq.org/show_bug.cgi?id=34314 34314]</span>''' '''Touhou Danmakufu''' 0.12m crashes on start (DMUSIC_CreateMidiOutPortImpl is a stub)<br />
'''<span style="background: red;">[http://bugs.winehq.org/show_bug.cgi?id=34884 34884]</span>''' '''Touhou Danmakufu''' 0.12m's font becomes distorted in Wine 1.7.5<br />
 
===Using Parallels and VMWare Fusion (Virtualization)===
Another alternative that works very well is to use Parallels Desktop to run the games.


===Parallels Desktop on macOS===
Parallels Desktop version 5.0 runs the main series games very well: All of the Windows danmaku games except for ''[[Perfect Cherry Blossom]]'' run without slowdown on a MacBook Pro. ''PCB'' appears to suffer from slowdown for unknown reasons.   
Parallels Desktop version 5.0 runs the main series games very well: All of the Windows danmaku games except for ''[[Perfect Cherry Blossom]]'' 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 fullscreen, and it is better to use the zoom function to bring the game screen to fullscreen, 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 640×480 natively (the games will run at 30fps). You can run them in 720×480 just fine, though.
 
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 640×480 natively (the games will run at 30fps). You can run them in 720×480 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.
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.
Line 200: Line 221:
If your ''SWR''/''Soku'' display looks strange when run in full screen (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 full screen in the menu.
If your ''SWR''/''Soku'' display looks strange when run in full screen (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 full screen in the menu.


The [[PC-98]] games can be run through anex86 without difficulty (so yes, emulation within <s>emulation</s> virtualization). There's 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 [[PC-98]] games can be run on emulators without difficulty (so yes, emulation within <s>emulation</s> virtualization). There's a PC-98 emulator for macOS, 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:
The following fan games have been confirmed to run fine under Parallels Desktop 5 using Windows XP on a MacBook Pro:
Line 216: Line 237:
*''[[Touhou Soccer Moushuuden]]'' (no display)
*''[[Touhou Soccer Moushuuden]]'' (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.
==Using Winebottler on macOS==
 
There is an easier way to run Touhou games on a Mac: Winebottler. To use this, you need macOS version 10.6.8 or later as well as X11. 11 is available at the iTunes Store, at a cheap price, or free if you get older versions.
==Playing Touhou Games on Steam==
With the release of some title such as [https://en.touhouwiki.net/wiki/Hidden_Star_in_Four_Seasons Hidden Star in Four Seasons] or [https://en.touhouwiki.net/wiki/Antinomy_of_Common_Flowers Antinomy of Common Flowers] on Steam and the support of [https://steamcommunity.com/games/221410/announcements/detail/1696055855739350561 Proton]. Playing Touhou games on Steam has become easier since now you can use the built in compatibility layers that Steam provided.


'''Note:''' Proton is a new project and is likely to have bugs, users are encouraged to report any bug they found with games to the project Github Repository. Note that if any game were proved to successfully run on Wine it might often as well run on Proton.
You can download Winebottler [http://darwine-winebottler.en.softonic.com/mac here]. Press the free download button, and a Disk Image should appear on your desktop after download. Drag the applications Wine and Winebottler into your applications folder.
===Installation===
*[https://www.archlinux.org/ Arch Linux]: [https://wiki.archlinux.org/index.php/steam See here]
*[http://www.ubuntu.com/ Ubuntu]: [https://wiki.ubuntu.com/Valve See Here]
*[https://www.debian.org/ Debian]: [https://wiki.debian.org/Steam See here]


To enable Proton for all game please go to '''Steam -> Settings''', a section called '''Steam Play''' will appear in the bottom of the sections list, navigate to the section and check '''Enable Steam Play for all titles''' then you are good to go.
Now, double-click the Touhou game <tt>.exe</tt>. A dialogue box should pop up that says "What would you like to do with the file?" Below that should be two options:


After that you can open your Library and select the game, Proton will do the rest of the job for you.
#Run directly in <tt>/Users/((Homefoldername))/Wine</tt>
 
#Convert to simple macOS application bundle.
Game compatibility can be found here: https://www.protondb.com/.
 
===Troubleshooting===
*Some user might experience game crashing with Proton right when starting up without it prompting to install any drivers (e.g Proton need to install DirectX initially if you are running HSiFS for the first time). If that is the case, consider using the flatpak version of Steam.
*There is also some problem regarding launching games that come from ntfs partitions. This is confirmed as a bug, a workaround for this is to mount the partition using [https://wiki.archlinux.org/index.php/NTFS-3G ntfs-3g] rather than ntfs.
 
==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. 11 is available at the iTunes Store, at a cheap price, or free if you get older versions.
 
You can download Winebottler [http://darwine-winebottler.en.softonic.com/mac 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.
 
Now, double click the Touhou game <tt>.exe</tt>. A dialogue box should pop up that says "What would you like to do with the file?" Below that should be two options:
 
#Run directly in /Users/((Homefoldername))/Wine
#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.'''  
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.
It should automatically open up X11 and run the game. No coding is required.
==[[Glitch]]es==
*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?)
*<strike>''EoSD'', ''PCB'', and ''[[Imperishable Night]]'' 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.</strike> Controls going wonky can be resolved by opening the game's <tt>custom.exe</tt> and checking the box with the word "DirectInput". Also, the audio bugs should be fixed as of PulseAudio 1.0 & Alsa 1.0.25 ([http://wiki.winehq.org/Sound#line-77 source])
*Wine 1.4 does not exhibit any issues when the game runs at full screen.
*<strike>Out of the 3 fighting games, only ''[[Immaterial and Missing Power]]'' works. ''SWR'' and ''Soku'' will appear as a black screen before Wine crashes.</strike>
*<strike>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.</strike> 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 ''[[Mountain of Faith]]'', ''[[Subterranean Animism]]'', ''[[Undefined Fantastic Object]]'' and ''[[Fairy Wars]]'' will not appear. Of all the Windows games, in-game Japanese dialogue will appear as code.
*All of the games will run on Normal FPS (that is, 60 or above), unless you have CPU fan wasting applications open.
*There may be a glitch where after opening the game ''PoFV'', ''IN'' will no longer work.
(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!)


==External links==
==External links==
[http://www.shrinemaiden.org/forum/index.php/topic,5902.0.html Touhou on Linux and Mac OS X, using Wine - Shrinemaiden.org]
[[fr:Jouer sous Linux/macOS]]
[[fr:Jouer sous GNU/Linux]]
[[it:Esecuzione su Linux]]
[[it:Esecuzione su Linux]]
[[ru:Запуск Touhou в Linux]]
[[ru:Запуск Touhou в Linux]]

Latest revision as of 15:22, 28 September 2023

Perfect Cherry Blossom running in Wine

For those of us who run Linux or macOS as our only operating system, finding functional alternatives to Windows programs can be an issue. When we need to run Windows programs, the Wine project has long been a great compatibility layer that lets us do just that. Basically, it translates Windows system calls into their Unix equivalents and runs programs in a Windows directory structure, so you can still play your Windows games, work in Photoshop, etc. under Linux and, to a certain extent, macOS.

Although Wine is not perfect, running official Touhou Project games on Wine will usually be fine, with some minor issues. This article will explain how Wine works and how to play Touhou games under Wine.

On Linux, it is recommended to use Lutris as well, since it makes it easier to set up your games by not needing to run commands. See the Lutris section after you install 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

Linux

For many distributions, you will need to add the official WineHQ repository in order to install Wine. It can then be installed using your package manager. Alternatively, it can be installed from a GUI such as the Ubuntu Software Center.

It is recommended to use the Staging version of Wine, since the universal Touhou practice tool thprac will not work without it. This package is typically called winehq-staging or wine-staging. The Stable (standard) version is called winehq-stable or wine-stable. Installation instructions for Wine Staging are listed below.

Debian-based distributions

For Debian-based distributions, replace "focal" with "bionic".

sudo dpkg --add-architecture i386
wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
sudo apt-add-repository 'deb http://dl.winehq.org/wine-builds/ubuntu/ focal main'
sudo apt update
sudo apt install winehq-staging

Fedora

If you use an older version of Fedora, make sure to replace 34 with the correct version number.

sudo dnf config-manager --add-repo https://dl.winehq.org/wine-builds/fedora/34/winehq.repo
sudo dnf install winehq-staging

It should be noted that the version in Fedora's official repository is usually "new enough". Thus, simply

sudo dnf install wine

should be enough. (For example, on a F36 box, the wine version is latest stable 7.0)

Arch Linux

Before installing Wine, enable multilib repository in /etc/pacman.conf and then update the repository with pacman -Syu.

sudo pacman -S wine-staging

Building from source

If you do not use one of the above distros, or you cannot reliably connect to the winehq server, you can also build wine from source.

Note that building wine takes at least three hours on a reasonable system.

macOS

Wine no longer works as of macOS Catalina (version 10.15), as that version ended support for 32-bit applications. The only way to play Touhou on the newest versions of macOS is to use a virtual machine.

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 installation instructions.

Using Homebrew

Go here and install if needed, then run brew install wine in your terminal.

Using Wine

On its first run, Wine creates 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. One such representation is called a prefix (see the Wine prefixes section for more information). The .wine folder is in 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 will probably recognize its contents from a standard Windows install.

Generally, with Wine installed, your Linux distribution will have assigned Windows executables to automatically invoke Wine, so double-clicking a Windows executable should work. If not, you will have to run Wine from your terminal. To do this, navigate to the folder that contains the executable and run it with Wine, like so:

cd .wine/drive_c/Program\ Files/RandomProgram
wine program.exe

Running Touhou games

Running a Touhou game is done the same way, either by double-clicking or using the terminal as shown above.

Assuming you have a Japanese font installed on your system, the in-game text should show just fine and you do not need to run the game in Japanese locale. For Embodiment of Scarlet Devil however, as well as the resolution setting dialogs when launching a game, Japanese locale is required. This can be set by adding LC_ALL="ja_JP.UTF-8", in front of your command to run Wine. The following example will navigate to a folder containing Double Spoiler and then launch it in Japanese locale:

cd .wine/drive_c/Program\ Files/上海アリス幻樂団/ダブルスポイラー
LC_ALL="ja_JP.UTF-8" wine th125.exe

Vpatch is not needed to run the games smoothly, unlike on Windows. See Minimizing input lag for how to prevent input lag on Linux.

Wine prefixes

A prefix, or colloquially 'bottle', is a folder containing the Windows directory structure, to which specific Wine settings can be assigned. This way, it is possible to run certain games with Wine set to Windows 7, but others Windows 98, for example. A new prefix can be created by running WINEPREFIX=<path> winecfg, which will launch Wine's configuration menu as well. Note that the path must be absolute, e.g. ~/.prefix_name to place it in your home directory. To create a 32-bit prefix, add WINEARCH=win32 in front of the aforementioned example.

For the official Touhou games, multiple prefixes are not needed and you can use any single prefix, such as the default .wine in your home directory. It can however be useful for other games, if they need Wine to run with different settings, such as a different Windows operating system, 32-bit instead of 64-bit, or different Windows libraries or components. If you need to run a game using a different prefix, specify it using WINEPREFIX=<path> <game>; not specifying any prefix will make Wine use the default one.

Installing missing native Windows components

Although most Touhou games should run out of the box with the recent development of Wine, some games might experience instant crashes when trying to run them through Wine. This is mostly because Wine does not include all Windows libraries by default and missing libraries can lead to a crash. Make sure that all necessary components to launch the game are installed. There are some ways to achieve this:

Using Winetricks

Winetricks is a program that is the primary method for installing Windows libraries (DLL) and other components. With winetricks, all of these installations can be done with merely a command, such as:

winetricks d3dx9_36

Start by installing winetricks and following the installation instruction provided here. Winetricks also has a GUI, which can be opened by executing winetricks in a terminal window. To run it on a specific prefix, specify the prefix like so: WINEPREFIX=<path> winetricks.

Note: Some libraries such as dotnet40 have limited 64-bit support and may or may not be fully functional.

Copy the .dll file from the Windows installation folder

Another way to temporarily fix a partially-functioning DLL is to replace it with the original file from a Windows install. Here is the way to do it.

Note: This was done on 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, then click the "Libraries" tab and under "New override for library", type d3dx9_36, click "Add" followed by "Apply", and now you can click "OK" to exit the utility or peruse around the other tabs and settings. One issue with loading native Windows DLLs is that they may require original low-level Windows DLLs (e.g. 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; you will break your Wine prefix by doing so.

Wine on macOS

Wine on macOS is very similar to Linux. One issue that macOS 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 macOS (Tiger and below). If you encounter this, you may want to bite the bullet and upgrade.

Lutris

Lutris is a Linux game manager, which makes it relatively easy to run all sorts of different games under different settings. It essentially provides a graphical interface to help streamline the process, so you do not need to run commands or shell scripts in order to play your games.

To install Lutris, follow the instructions for your distro as listed on the official Lutris website. Assuming you have installed Wine Staging from the previous instructions, Wine will be usable as a "runner" in Lutris, that is, a program that can run games. Lutris can also launch a large variety of emulators, as well as native Linux games.

Adding Games

To add a game, click the large '+' button in the top left, and choose Wine as the runner. In the Game options tab, provide the path to the executable and the game directory. Leave the Runner options and System options tabs unchanged. For an example, see the screenshots below.

You can go back to game settings by right clicking a game and then clicking Configure. It is also possible to change the icon and banner by clicking them from the settings window. If you want to make a desktop or application menu shortcut to your game, right click the game on the main screen after it is added, and click 'Create desktop shortcut' or 'Create application menu shortcut'.

Lutris main menu
Game info tab
Game options tab
Game added
Ten Desires being added into Lutris

Minimizing input lag

To reduce input lag, you need to disable vsync and desktop compositing. Click the gear icon next to Wine under Runners. In the window that opens, navigate to the System options tab an add the following environment variables: dxgi.syncInterval and d3d9.presentInterval, both set to 0. This will disable vsync. Additionally, check 'Show advanced options' and enable 'Disable desktop effects' in the same tab, which will disable the compositor.

This can also be applied only to an individual game, rather than all Wine games. To do this, use the System options tab of a single game instead (Right click game -> Configure).

Wine gear icon
Wine system options
Wine system options
How to reduce input lag

If you use an NVIDIA graphics card, you also want to set the kernel parameter nvidia-drm.modeset=1 to enable Kernel Mode Setting (KMS). AMD and Intel integrated graphics enable this by default. Assuming you use GRUB as your bootloader, edit /etc/default/grub and add it at the end of the value for GRUB_CMDLINE_LINUX_DEFAULT. Add GRUB_CMDLINE_LINUX_DEFAULT="nvidia-drm.modeset=1" if it is not present. Update grub with sudo update-grub, or sudo grub-mkconfig <your_grub_path>, and reboot for the change to apply. See ArchWiki for other bootloaders.

PC-98 Games

The multi-system emulator RetroArch provides Neko Project II, which can be used to play the PC-98 games, and runs on both macOS and Linux. Do note that the clock multiplier is set too low by default; it should be set to 16 in the emulator settings (accessed by pressing F1 while in-game).

DOSBox-X also supports running PC-98 software and has native macOS and Linux versions.

Various emulators such as the Windows version of Neko Project II, T98-Next, and Anex86 all work pretty well under Wine in order to play the PC-98 Touhou games. For playing with a gamepad, JoyToKey also works under Wine. There is also a native port of Neko Project II for Linux and macOS called Xnp2; however, there are currently some sound problems that need to be investigated[citation needed]. The regular Neko Project II is generally the best option.

Fangames

Attention: This section is a stub and it needs expanding with more information related to the section's topic. If you can add to it in any way, please do so.

Troubleshooting

  • There are issues 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.
  • For Scarlet Weather Rhapsody and Touhou Hisoutensoku, see here (SWR/HSTS Wiki).

The Wine developers are constantly adding and fixing functionality, so while things are still iffy with certain Touhou games, they are definitely improving. See the main article linked above for a list of current Touhou bugs in Wine.

Playing Steam Games on Linux

With the release of some titles such as Hidden Star in Four Seasons or Antinomy of Common Flowers on Steam and the support of Proton, playing Touhou games on Steam has become easier for Linux users, since you can now use the built-in compatibility layers that Steam provides. Proton used to be quite buggy when it was new, but nowadays, if any game runs on Wine, you can typically expect it to run on Proton as well.

Installation and setup

To enable Proton for all games, go to Steam -> Settings, where a section called Steam Play will appear in the bottom of the sections list; navigate to the section and check Enable Steam Play for all titles, after which Steam will have to be restarted. Following that, all of your games that don't run on Linux natively will automatically use Proton. This includes Non-Steam games that you manually add into your library.

The current game compatibility can be found on the ProtonDB website. Proton will automatically use the correct aspect ratio in fullscreen mode.

Troubleshooting

  • Some user might experience game crashing with Proton right when starting up without it prompting to install any drivers (e.g. Proton needing to install DirectX if you are running HSiFS for the first time). If that is the case, consider using the flatpak version of Steam.
  • There is also some problem regarding launching games that reside on NTFS partitions. This is a confirmed bug; a workaround for this is to mount the partition using ntfs-3g rather than ntfs. Make sure that you are the owner of the partition in question; set the options defaults,uid=1000,gid=1000 for your NTFS partition in your /etc/fstab file.
  • If a game runs very slowly, try disabling DXVK. This can be done by setting PROTON_USE_WINED3D11=1 as a game-specific launch option for Proton.
  • If the audio is not working, try to install the following packages: lib32-alsa-plugins lib32-libpulse lib32-openal.
  • If you encounter an issue regarding a failure with Direct3D while running inside of Steam, try to add PROTON_USE_WINED3D=1 %command% in the textbox located at the game's properties > General > Launch Options.

Using Virtual Machines

Note: it is not recommended to play Touhou games this way on macOS or Linux, as it is very slow and memory-consuming to start an entire operating system just to play Touhou; only do this as a last resort!

It is possible to use virtualization software such as Oracle VirtualBox and VMWare Player (both macOS and Linux) and Parallels Desktop (macOS) to run a virtual Windows operating system to play the Touhou games with. This virtual system is known as a virtual machine, or VM for short. You will be able to install and run them just as you would on Windows, as you are running Windows within your native operating system. You need Windows installation media (such as an ISO file) in order to install a Windows VM; for Windows 7 through Windows 10, see this Microsoft help page for information on creating installation media.

Normally a VM has limited graphics capability, due to using a virtual graphics driver rather than a dedicated graphics card. If you own more than one graphics card, however, it is possible to use PCI passthrough. With that set up, your VM uses the secondary graphics card while your host OS uses the primary one. This means that you can run more demanding games, as much as the graphics card allows. See this ArchWiki page for more information.

Parallels Desktop on macOS

Parallels Desktop version 5.0 runs the main series games very well: All of the Windows danmaku games except for Perfect Cherry Blossom run without slowdown on a MacBook Pro. PCB appears to suffer from slowdown for unknown reasons.

It is important to run the games in fullscreen, and it is better to use the zoom function to bring the game screen to fullscreen, 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 640×480 natively (the games will run at 30fps). You can run them in 720×480 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's 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 Phantasmagoria of Flower View.

If your SWR/Soku display looks strange when run in full screen (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 full screen in the menu.

The PC-98 games can be run on emulators without difficulty (so yes, emulation within emulation virtualization). There's a PC-98 emulator for macOS, 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:

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 fangames don't communicate properly with NVIDIA cards.):

Using Winebottler on macOS

There is an easier way to run Touhou games on a Mac: Winebottler. To use this, you need macOS version 10.6.8 or later as well as X11. 11 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 applications Wine and Winebottler into your applications folder.

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 macOS 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.

External links