PC-98 Touhou Linux Guide

By Daichungus

Submit issues and contribute: Source

This is the guide for the PC-98 era games. The Windows era Touhou guide is here.


Disclaimer

This guide focuses on using DOSBox-X and Neko Project II Kai for a simple and consistent experience. It does not cover every setup or edge case.

The goal here is to get most users running their PC-98 Touhou games quickly and cleanly.

If you're looking for more advanced or alternative methods, other resources may be better suited.


Preparing your Linux environment

Choosing a distro

Skip this section if you already have chosen your distro.

Most major distros and desktop environments should work well with this guide.

This guide has been personally tested with:

My only recommendation is to choose a well-known, widely-supported, and stable distro, which includes but is not limited to the following:

Installing required software

Before continuing, ensure you have the necessary graphics drivers and system firmware installed.

Consult your distro's documentation or other online resources for a proper setup (e.g., RPM Fusion for Nvidia drivers on Fedora, multilib repo on Arch, etc.).

  1. Update your repository using your distro's included package manager.

    Debian/Ubuntu/Linux Mint

    sudo apt update && sudo apt upgrade

    Fedora

    sudo dnf update

    Arch

    sudo pacman -Syu
  2. Install Flatpak on your distribution. If you do not wish to use Flatpak or already have it, skip this step.

Choosing an emulator

There exists several emulators of the PC-98 platform, many of which work very well on Windows or older hardware.

However, they're more likely to have issues and inconsistent behavior when running on Linux with Wine, especially on certain distributions.

As such, this guide will only cover two Linux-native emulators in detail. Choose the one that fits you the most:

DOSBox-X (skip to setup)

Neko Project II Kai (skip to setup)

A list of other PC-98 emulators can be found here.


DOSBox-X setup

Installation

Install DOSBox-X through your package manager

Flatpak

flatpak install flathub com.dosbox_x.DOSBox-X

Debian/Ubuntu/Linux Mint

sudo apt install dosbox-x

Fedora

sudo dnf copr enable rob72/DOSBox-X
sudo dnf install dosbox-x

Arch

git clone https://aur.archlinux.org/dosbox-x.git
cd dosbox-x && less PKGBUILD
makepkg -si dosbox-x

Settings to adjust before playing

Configuration file

DOSBox-X relies on a configuration file to apply the correct settings for various types of programs.

By default, DOSBox-X uses its own config file located at:

If the working directory contains a file named dosbox-x.conf, the settings that it contains will override the respective ones in the default config file.

If you prefer writing your own config file or directly editing the main config file, continue to the next sections.

Otherwise, download a font to the directory, then start running the games.

Working directory

The working directory is where DOSBox-X will run. By default, DOSBox-X will ask you to choose a directory in your system.*

If you intend on using DOSBox-X only to play the PC-98 Touhou games, set the directory with the HDI files as the default working directory in the default config file

[dosbox]
working directory option = default
working directory default = /your/path/to/pc98touhou/

* If ran from the desktop. If it was ran in the terminal, DOSBox-X uses the current directory as the working directory.

Graphics

To always start in fullscreen, set:

[sdl]
fullscreen = true
fullresolution = desktop

To ensure the graphics stay consistent, set:

[sdl]
output = openglpp

[render]
aspect = true
aspect_ratio = -1:-1

Enabling PC-98 mode

To always enable PC-98 mode, set

[dosbox]
machine = pc98

CPU speed

The default CPU cycle count (3000) is too low for the Touhou games, resulting in extremely slow gameplay.

For a consistently smooth experience,* set

[cpu]
cycles = 72000

If your hardware allows it, set

[cpu]
core = dynamic_x86

* In testing, most values between 10000 and 100000 worked well for the Touhou games. 72000 is suggested in this guide for most systems.

DOSBox-X used less of the CPU compared to "Normal" during testing with the same number of cycles.

Auto-execution

This is especially helpful if you intend on always using only one HDI file* and do not want to always type the commands by hand

[autoexec]
IMGMOUNT C TOUHOU.HDI
BOOT C:

Substitute TOUHOU.HDI with the actual name of your HDI file.

* For example, an HDI with all the PC-98 Touhou games or a full system


Neko Project II Kai setup

Installation

There are many different ways to have NP21kai installed to your system.

RetroArch

  1. Install RetroArch as a Flatpak

    flatpak install flathub org.libretro.RetroArch
  2. Run RetroArch either by GUI or
    flatpak run org.libretro.RetroArch
  3. In the Main Menu, select "Load Core", then "Download Core"

  4. Scroll down the list to NEC - PC-98 (Neko Project II Kai), then select to install it.

  5. Adjust settings before playing

Enter key on keyboard

Arch Linux

If you're new to Arch, please consider first reading the Arch Wiki article on how to install packages from the AUR, along with the article on makepkg.

  1. Install gtk2 from the AUR

    git clone https://aur.archlinux.org/gtk2.git
    cd gtk2 && less PKGBUILD
    makepkg -si gtk2
  2. Install np21kai from the AUR

    git clone https://aur.archlinux.org/np2kai-git.git
    cd np2kai-git && less PKGBUILD
    makepkg -si np21kai
  3. Proceed with adjusting the necessary settings.

Building from source (xnp21kai)

The steps below are from the README document.

  1. Install the required programs and libraries*

    Debian/Ubuntu/Linux Mint

    sudo apt install git cmake ninja-build build-essential libx11-dev libglib2.0-dev libgtk2.0-dev libsdl2-dev libsdl2-mixer-dev libsdl2-ttf-dev libsdl1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libusb-1.0-0-dev libfreetype-dev libfontconfig1-dev libssl-dev

    Fedora

    sudo dnf groupinstall "Development Tools"

    sudo dnf install gcc-c++ cmake libusb-devel SDL-devel SDL_mixer-devel SDL_ttf-devel SDL2-devel SDL2_mixer-devel SDL2_ttf-devel gtk2-devel libX11-devel fontconfig-devel freetype-devel

    * Installing these libraries may cause some of your programs or dependencies to be automatically removed. Always check what packages will be installed and removed before confirmation.

  2. Clone the np21kai repo

    git clone https://github.com/AZO234/NP2kai.git
  3. Navigate to the repo and make the work directory

    cd NP2kai
    mkdir build
    cd build
  4. Generate the makefile

    cmake .. -D BUILD_X=ON
  5. Make. Errors are normal.

    make -j
  6. Install the binary (to /usr/local/bin/)

    sudo make install
  7. Run the program, and adjust settings
    xnp21kai

Settings to adjust before playing

RetroArch

  1. Go back* to the previous menu and select the respective core. On the Main Menu, "Start Core" will be in place of "Load Core".

  2. Start the core without content and press F1 to open the Quick Menu

  3. Select "Core Options", and apply these settings:

  4. Go back and restart the core.

  5. You're now ready to run the games

* Backspace key on keyboard

These settings are required for smooth gameplay.

xnp21kai

  1. In the menu bar, adjust these settings for a smooth experience. To apply them, hit "Reset" in "Emulator"

  2. Install the necessary ROM files to ~/.config/xnp21kai/

* The default multiplier of 20 should be enough for most systems, but can result in slowdowns on sections with large amount of enemies or danmaku.

It has been known that a buffer of 100 ms or more will result in noticeable sound delay, especially for sound effects.


PC-98 files

ROM files

You may need to install some PC-98 ROM files for your emulator to work properly.

NP2Kai on RetroArch and DOSBox-X both already include the necessary files.

However, xnp21kai does require these files:

Fonts

Both Neko Project II Kai and DOSBox-X require the a font file.

Some popular font files are available to download from here:

Move/copy the font file to the same directory/folder as your PC-98 Touhou HDI file(s).

For xnp21kai, place it in ~/.config/xnp21kai. If you are using a font besides FONT.ROM, edit fontfile in xnp21kairc to the abosolute filepath of the font.


Running the PC-98 Touhou games

It is highly recommended that you store your HDI files in a directory/folder like "Games" or "Touhou"

DOSBox-X

GUI/Desktop

  1. If prompted, select the directory/folder with your HDI files as your working directory.

  2. Wait for it to finish loading, then run these two commands in DOSBox-X:

    IMGMOUNT C TOUHOU.HDI
    BOOT C:
    Substitute TOUHOU.HDI with the actual filename* of the HDI file you want to load.
  3. Enjoy!

  4. See next section on how to remove or change the HDI file

* The filename is case-sensitive!

Depending on the type of HDI file you obtained, you'll either directly boot into the game or a menu with the games listed.

Command Line

  1. Navigate to the directory folder with your HDI(s) and config file, then run

  2. Follow the same remaining steps as above

Neko Project II Kai

RetroArch

  1. In the Main Menu, select "Load Core", then "NEC - PC-98 (Neko Project II Kai)"

  2. If it's your first time loading the HDI file:

    1. Select "Load Content"

    2. Navigate to to directory with the file and select it

    If you have loaded the HDI file before:

    1. Select "Playlists", then "History"

    2. Select the HDI file, then run it.

  3. Enjoy!

  4. To remove the HDI file, go into the Quick Menu and select "Close Content"

xnp21kai

  1. In the menu bar, select "HardDisk"

  2. Choose IDE0-0*, then "Open"

  3. Find your Touhou HDI file and open it.

  4. Reset the emulator.

  5. Enjoy!

  6. To remove the HDI, simply choose "Remove" on the "hard disk" the HDI is located in and reset the emulator.

* IDE0-0 acts like the C: drive, while IDE0-1 is the A: drive.

To switch to another HDI, simply choose "Open" again.


Important and useful tips

Unless you're directly using the original PC-98 files, HDI files contain everything!

DOSBox-X

xnp21kai

RetroArch

Other


Common Issues

This section is under expansion. Submit issues here.

xnp21kai

No sound

Try stopping the program and run it again. (Ctrl+C if launched from the terminal)

Can't close/freezes

Includes errors being thrown even when pressing Ctrl+C in the terminal. Unfortunately, This is arbitrary behavior that there is no exact solution to so far.

Testing by the author suggests that directly running xnp21kai from /usr/local/bin/ may solve this issue if it repeatedly happens.

Fullscreen isn't fullscreen

Unfortunately there is currently no option to scale up the display.


Additional Resources and References


Special Thanks

The author would like to thank the following for their support: