User:Katoumegumi

From ArchWiki

Contact informaton

Discord: katoumegumi_#3231

osu!: https://osu.ppy.sh/users/4428094

Telegram: https://t.me/KatouMegumi_osu

email: self(at)katou.pw (rarely checked)

osu! (stable) on Arch Linux

Note: This is my personal configuration for my osu! stuff on Arch Linux. No plans will be made to make a separate osu! wiki page.
Note: This guide implies you have read Help:Reading and/or know your ways around Linux. (in case you're using a different distribution.)

osu! is a freeware rhythm game where player uses mouse and keyboard input to click on circles to the rhythm in main gameplay mode.

The following install guide has different installation methods for osu!, one with Lutris and a basic one. There are also included some instructions on improving experience with the game, like switching to a custom wine version or switching to PipeWire audio server.

You should pick your preferred installation method and then decide whether you want to do additional steps to improve your experience with the game also outlined here.

Installing osu!

Enable multilib and install wine and winetricks

Prepare wineprefix

Create WINEPREFIX for your osu! installation and run winetricks to install required dependencies for osu! to work correctly.

$ WINEARCH=win32 WINEPREFIX=~/.wineosu winetricks dotnet40 cjkfonts gdiplus

cjkfonts allows you to see CJK characters correctly, instead of squares. gdiplus fixes icon display in osu! settings.

Note: You do not need to install gdiplus if you use wine version 6.10 or above.

Installing the game

Note: You can skip next 3 steps if you want to symlink your existing osu! installation. Refer to ln(1) for instructions.

Create a folder for your osu! install inside your newly created wine prefix.

$ mkdir ~/.wineosu/osu/

Download osu! executable.

$ wget --output-document ~/.wineosu/osu/osu\!.exe https://m1.ppy.sh/r/osu\!install.exe

Start osu! and test if it works correctly.

$ WINEARCH=win32 WINEPREFIX=~/.wineosu wine ~/.wineosu/osu/osu\!.exe

Create startup script for osu!

~/.wineosu/osu/start.sh
#!/usr/bin/env bash
#export PATH="$HOME/.wineosu/osuwine/bin:$PATH" #Use custom WINE version to run osu!
export WINEARCH=win32
export WINEPREFIX="$HOME/.wineosu"
#export WINEFSYNC=1

#export STAGING_AUDIO_PERIOD=10000

#start osu!
wine osu\!.exe

Creating freedesktop entry

Fetch osu! logo.

$ wget --output-document ~/.wineosu/osu/icon.png https://github.com/ppy/osu-wiki/raw/master/wiki/Brand_identity_guidelines/img/usage-full-colour.png

Create and edit a new desktop entry file for osu!.

~/.local/share/applications/osu.desktop
[Desktop Entry]
Type=Application
Comment=A freeware rhythm game where player uses mouse and keyboard input to click on circles to the rhythm in main gameplay mode.
Icon=<change to your home folder>/.wineosu/osu/icon.png #XDG spec doesn\\'t support environment variables. Enter home path manually.
Exec=<change to your home folder>/.wineosu/osu/start.sh #XDG spec doesn\\'t support environment variables. Enter home path manually.
GenericName=osu!
Name=osu!
StartupNotify=true

Installing osu! (Lutris)

Preparing folders

$ mkdir -p ~/Games/osu/game

Installing the game

First, download osu! executable

$ wget --output-document ~/Games/osu/game/osu\!.exe https://m1.ppy.sh/r/osu\!install.exe

Open Lutris, click on "Add a new game" (plus symbol in the top left).

In "Game info", set runner to "Wine" and name the game.

In "Game Options", set your executable to "~/Games/osu/game/osu!.exe", Wine prefix to "~/Games/osu", Prefix architecture to "32-bit"

Initializing Lutris wineprefix

First, run the newly created game to initialize a wineprefix for osu!.

At first, osu! will not run because we're missing required dependencies for osu! to work.

Using winetricks to install required dependencies

In Lutris, select your newly created osu! profile, then next to a "wine" button, click on a dropdown menu button and choose "Open Bash terminal".

Enter the following command

$ winetricks dotnet40 cjkfonts gdiplus

Additional tweaks

Warning: Do not enable "Reduce PulseAudio latency". It is actually counter productive and messes with SAP/SAD values. It sets your application audio buffer to 60ms unneedlesy, as it was intended for ancient setups with weak hardware and back then awful stock distributions' PulseAudio configurations.

In "System Options" turn on "Disable desktop effects" to remove compositor latency on supported desktop environments.

(Optional) Using different wine version

Note: This section is currently work in progress.

Community prebuilt binaries

There are three choices of prebuilt patched wine from osu! community.

gonX builds, includes all comfort patches with automatically adjusting SAP values and crash fixes. (Best.)

openglfreak's builds, same as gonX, but using unreverted winepulse.

PooN's original build at wine-osuAUR, no crash fixes, outdated wine, have to manually configure SAP values.

Installing prebuilt binaries with included patches

After you have downloaded one of the builds (excl. PooN's AUR package build), install it with

# pacman -U <archive>
Installing prebuilt binaries with included patches (Lutris)

Extract downloaded wine archive's opt/ folder contents to ~/.local/share/lutris/runners/wine/ In "Runner options", choose your new "Wine version".

Editing your osu! launch script to use patched wine

start.sh
export PATH="/opt/wine-osu/bin:$PATH" #Use custom WINE version to run osu!

Setting SAP/SAD

SAP/SAD equivalents for stock WINE are 100000 (10ms). Your SAP/SAD value should be your quant/buffer size in 100 nanoseconds.

You can divide your quant by 48 (if you use 48Khz) to get first 5 digits of SAP/SAD. Pad with zeroes if necessary.

(quant / sample_rate_KHz) = SAP/SAD

If, for example you have sample rate of of 44.1, divide by 44.1 instead.

~/.wineosu/osu/start.sh
...
export STAGING_AUDIO_DURATION=6667 # 0.667ms at 48KHz
export STAGING_AUDIO_PERIOD=6667 # 0.667ms at 48KHz
...

(Optional) Switching to PipeWire

Remove PulseAudio

Note: Ideally, we'd use jack for low latency audio, but wine does not support jack. Besides, all community wine patches for osu! target PulseAudio.

Disable all PulseAudio services.

$ systemctl --user disable --now pulseaudio.socket pulseaudio.service

Installing PipeWire

Note: Ideally, you should refer to PipeWire wiki article for better, more in-depth instructions.

Install pipewire, pipewire-pulse, pipewire-media-session.

Enable PipeWire services.

$ systemctl --user enable --now pipewire.service pipewire.socket pipewire-media-session.service pipewire-pulse.service pipewire-pulse.socket

Configuring PipeWire.

Warning: Do not edit files in /usr/share/pipewire/

Copy PipeWire template configuration to ~/.config/pipewire/ or /etc/pipewire/ (system-wide)

$ cp /usr/share/pipewire/* ~/.config/pipewire/
Edit your PipeWire configuration.
Note: The following configuration shown is targeting my specific CPU. (AMD A10-8750) The quantum (sample size) value depends on your own system and its capabilities. You may want to play around with it to get stable audio without xruns.

You should set your start quant values to either 32 (0.667 ms) or 48 (1 ms) and test your configuration. The sweet spot is different for everyone.

In layman terms, quant, or otherwise known as "sample size" is how much data (audio chunks) at once is being streamed to/from your sound card. Sending smaller packets stresses your CPU but gives you lower latency, since you send chunks as fast as possible. While sending bigger chunks less frequently does not stress your CPU as much, but increases latency.

pipewire.conf
context.properties = {
    ...
    default.clock.rate        = 48000
    default.clock.quantum     = 192
    default.clock.min-quantum = 192
    ...
pipewire-pulse.conf
{   name = libpipewire-module-protocol-pulse
            ...
            pulse.min.req = 192/48000              # 4ms
            pulse.default.req = 192/48000          # 4ms
            pulse.min.frag = 192/48000             # 4ms
            pulse.min.quantum = 192/48000          # 4ms
            ...

stream.properties = {
    ...
    node.latency = 96/48000
    ...

Restart PipeWire services.

$ systemctl --user restart --now pipewire\*

Try playing osu!. If the sound is very robotic or otherwise weird or distorted, you are running into major xruns. Double your quant values and restart PipeWire services. Try again and check for stability. In best case scenario, you should not have any sound distortions. You can check for xruns (referred to as errors) by running pw-top.

$ pw-top

Troubleshooting (osu!)

osu! can't connect to internet

If osu! is complaining about no internet connection, install lib32-gnutls

osu! doesn't start and I get black screen after the cookie disappears

Install lib32-libxcomposite

Nothing works!

You are likely missing wine dependencies that are not stated in the wine package.

You can find instructions on how to install them at the Lutris wiki

# pacman -S --needed wine-staging giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls \
mpg123 lib32-mpg123 openal lib32-openal v4l-utils lib32-v4l-utils libpulse lib32-libpulse libgpg-error \
lib32-libgpg-error alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo \
sqlite lib32-sqlite libxcomposite lib32-libxcomposite libxinerama lib32-libgcrypt libgcrypt lib32-libxinerama \
ncurses lib32-ncurses opencl-icd-loader lib32-opencl-icd-loader libxslt lib32-libxslt libva lib32-libva gtk3 \
lib32-gtk3 gst-plugins-base-libs lib32-gst-plugins-base-libs vulkan-icd-loader lib32-vulkan-icd-loader

CJK fonts display as squares

Install meiryo in your wineprefix through winetricks or install ttf-win10AUR

No sound when opening the game

Edit your alsa-monitor.conf in your PipeWire config folder.

media-session.d/alsa-monitor.conf
session.suspend-timeout-seconds = 0

osu! File associations (Lutris)

Install osu-handlerAUR, osu-mimeAUR. If you have osu!lazer file associations, you might want to enable your DE to ask for what program to use to open osu! files.

General recommendations (osu!)

Set your universal offset to -40 (or -25 if using compatibility mode audio) to account for wine quirks.

Consider disabling your window manager's compositor while you play to reduce visual lag or use Openbox for gaming explicitly.

If you use tablet, consider using opentabletdriverAUR instead of your kernel drivers.

See also (osu!)

https://blog.thepoon.fr/osuLinuxAudioLatency/ - ThePooN's osu! installation guide for various Linux distributions (incl. Arch Linux)

https://drive.google.com/drive/folders/17MVlyXixv7uS3JW4B-H8oS4qgLn7eBw5 - gonX's WINE builds.

Applying to other rhythm games

TJAPlayer3 and forks

Some new TJAP3 forks have native Linux support, notably TJAP3-GL and TJAP3-F.

TJAPlayer3 and forks are based on dotnet.

gdiplus is actually necessary to boot.

Most TJAP3-based simulators have broken input on wine, only TaikoCatsCaffe seems to work.

Most of the stuff applicable for osu! should apply here too.

Credits (osu!)

gonX (wine builds/patches and WIP guide I took some things from.)

ThePooN (original guide that still uses PA)

Anonymous (Tip for "no audio" fix.)

osu!lazer

install osu-lazer-binAUR.

Low latency audio

For lowest latency audio you should use JACK or pipewire-jack, depending on your setup.

The following script implies your use pipewire-jack and pipewire respectively. Refer to User:Katoumegumi#(Optional)_Switching_to_PipeWire if you want to switch to pipewire

~/.local/share/osu/start.sh
#!/usr/bin/env bash
export PIPEWIRE_LATENCY=32/48000

#start osu!lazer
pw-jack osu-lazer

Do not forget to change your osu!lazer config settings in either game menu or configuration file to actually use JACK.

~/.local/share/osu/framework.ini
AudioDevice = JACK Audio Connection Kit

Notes

Some people insist that you should use a specific patch to remove 10ms hardcoded buffer, however I find that it's irrelevant if you use JACK audio output. You can correct me if I'm mistaken. My e2e latency measurements show 1ms difference in favour of lazer compared to stable on wine. (pw-jack, single threaded, PIPEWIRE_LATENCY=32/48000 for lazer. STAGING_AUDIO_DURATION=6667, 32 pipewire quant and patched wine for stable)

Another issue with having recompiled osu!lazer is that you have to have matching binary hash to be able to receive support and play multiplayer. It's likely in the future that it would be required for score submission as well. Better not risk it.

peppy actually doesn't want you to spoof checksums too.

Visual novels

This will not work for every visual novel (Koi ga Saku Koro Sakura Doki notably just crashes on startup due to bad mfplat support) there is. Your best bet should be just spinning up a virtual machine.

Unless you really want to use Wine, you could try this.

Wineprefix setup

$ LC_ALL=ja_JP.UTF-8 WINEARCH=win32 WINEPREFIX=~/.winevn winetricks cjkfonts gdiplus wmp9

Startup script

start.sh
#!/etc/bin/env bash
export LC_ALL=ja_JP.UTF-8 WINEARCH=win32 WINEPREFIX=$HOME/.winevn

wine program.exe

List of tested working titles (engines)

Title Publisher/Translator Developer Engine Extras
Aokana NekoNyan sprite NekoNyan Unity Engine There exists a native Linux fan made port of the engine. The Japanese version uses Buriko General Interpreter engine.
Hatsukoi 1/1 Tsurezure Scans toneworks Siglus
Furebara NekoNyan SMEE Buriko General Interpreter
Sugar * Style NekoNyan SMEE Buriko General Interpreter
Making * Lovers NekoNyan SMEE Buriko General Interpreter
HaremKingdom Shuravune SMEE Buriko General Interpreter
Sanoba Witch NekoNyan Yuzusoft KiriKiri
Senren * Banka NekoNyan Yuzusoft KiriKiri
Riddle Joker NekoNyan Yuzusoft KiriKiri
Sankanu Renai NekoNyan ASA Project KiriKiri
Maitetsu Fakku lose KiriKiri
ATRI -My Dear Moments- ANIPLEX.EXE Front Wing KiriKiri
Engine issues
Engine Notes
KiriKiri Text rendering is visually broken, colored text borders don't work.
Siglus WMP content will require wmp9 winetricks package installed, likely
Buriko General Interpreter No issues found.