User:Katoumegumi

From ArchWiki
Jump to navigation Jump to search

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

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 deskrop entry. Ideally, in ~/.local/share/applications/

~/.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.

Self compiling TKG Wine with patches

WIP

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

Note: If you use gonX wine or patches, setting SAP/SAD is not necessary, it should set to lowest values out of the box by default.

Setting STAGING_AUDIO_DURATION or STAGING_AUDIO_PERIOD is necessary if you use compatibility mode audio or you want to force specific quant/buffer size for osu!.

SAP/SAD equivalents for stock WINE are 100000 (10ms). Your SAP/SAD value should be your quant/buffer size in 100 nanoseconds. For example, 1ms is 48 quant/buffer size for 48KHz sample rate, so you write your SAP/SAD as 10000 if your quant/buffer size is 48.

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

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

~/.wineosu/osu/start.sh
export STAGING_AUDIO_DURATION=10000 #Shouldn't affect things on compatibility mode audio on.
export STAGING_AUDIO_PERIOD=10000

(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
support.dbus                          = true
mem.warn-mlock                        = false
mem.allow-mlock                       = true
mem.mlock-all                         = true
clock.power-of-two-quantum            = true

default.clock.rate        = 48000
default.clock.quantum     = 192
default.clock.min-quantum = 192
default.clock.max-quantum = 8192

# Uses RTKit to boost the data thread priority.
{   name = libpipewire-module-rtkit
    args = {
        nice.level   = 18
        rt.prio      = 99
        rt.time.soft = 200000
        rt.time.hard = 200000
    }
    flags = [ ifexists nofail ]
}
pipewire-pulse.conf
{   name = libpipewire-module-rtkit
        args = {
            nice.level   = 18
            rt.prio      = 95
            rt.time.soft = 200000
            rt.time.hard = 200000
        }
   {   name = libpipewire-module-protocol-pulse
            pulse.min.req = 192/48000              # 4ms
            pulse.default.req = 192/48000          # 4ms
            pulse.min.frag = 192/48000             # 4ms
            pulse.default.frag = 96000/48000       # 2 seconds
            pulse.default.tlength = 96000/48000    # 2 seconds
            pulse.min.quantum = 192/48000          # 4ms
            #pulse.default.format = F32
            
stream.properties = {
    node.latency = 96/48000

Restart PipeWire services.

$ systemctl --user restart pipewire.service pipewire.socket pipewire-media-session.service pipewire-pulse.service pipewire-pulse.socket

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

CJK fonts display as squares

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

No sound when opening the game

This usually happens when you use compatibility mode off on gonX build and PipeWire as your sound server.

One way to fix it is to reload audio device in osu! or use compatibility mode on as a more permanent solution. There should be no latency difference.

A better solution is to edit your alsa-monitor.conf in your PipeWire config folder.

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

General recommendations (osu!)

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

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

See also (osu!)

https://osu.ppy.sh/community/forums/topics/367783 - osu! forums osu! Linux installation guide.

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