User:Katoumegumi

From ArchWiki
Jump to navigation Jump to search

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.

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.

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!

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/

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=~/.wineosu/osu/icon.png
Exec=~/.wineosu/osu/start.sh
GenericName=osu!
Name=osu!
StartupNotify=true

(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>

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!

(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

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.