Hatsune Miku: Project DIVA Mega Mix+

Hatsune Miku: Project DIVA Mega Mix+

39 ratings
Linux Setup for Mega Mix+
By PD Addict
After months of passively piddling around trying to diagnose various problems with playing Mega Mix+ on Linux, I've finally found a setup that breaks through all the nonsense and gets Mega Mix+ working like it should under Linux.

( Image credit: https://twitter.com/digiral6/status/1597972027943813120 )
2
2
   
Award
Favorite
Favorited
Unfavorite
Intended Audience
This guide is geared towards users of unsupported-by-Valve GNU/Linux distributions. Mega Mix+ runs better out of the box on officially supported Steam platforms like the Steam Deck, Ubuntu LTSes, and SteamOS. You can run MangoHud[github.com] to see if you're having a performance problem. If you can't hit a near-steady 60FPS, the this guide is here to help.
Steam Deck
This guide is largely irrelevant for Steam Deck. Mega Mix+ can maintain a near-constant 60fps out of the box. GameMode, GameScope, and MangoHud are either already installed or rendered moot.

Prior to SteamOS 3.4 the only thing to look out for is that SteamCompMgr and Mega Mix+ both enforce vsync with their own frame buffers, which can introduce additional input lag. Under this condition, you can use the High Refresh Rate mod to disable vsync in Mega Mix+ so that you don't double-up on vsync buffers.

After SteamOS 3.4 there's now an option to Allow Tearing which disables SteamCompMgr from enforcing vsync. You can now opt to let Mega Mix+ handle vsync, forgoing the High Refresh Rate mod completely if you want.

Thanks go out to Icy for allowing me to bug her with some brief tests as I don't own a Deck myself.
Steam Runtime vs Steam Native
This might only apply to Arch Linux, but I notice slightly more input lag using Steam Runtime (STEAM_RUNTIME=1 which is default) vs. Steam Native (STEAM_RUNTIME=0). The difference is minute but you'll definitely notice it during the kind of rapid spamming you'll get on higher-difficulty songs.

Under Ubuntu 22.04 LTS, the input lag using Steam Runtime is just fine.

Unfortunately I don't have experience outside of those two options. If there's no steam-native-runtime[archlinux.org] package for your distro, you'll have to do things The Hard Way™ if you want to be able to use STEAM_RUNTIME=0.
Requirements
Mega Mix+ Screen Configuration
On my system, both "Full Screen" and "No Frame" options under Options → Display Settings → Display Mode work fine. If you have trouble getting things to work with gamescope, try seeing if setting one or the other makes it work.

With that out of the way, this section in the game will tell you what Mega Mix+ will run at before you go meddling around with gamescope. You can opt to have gamescope run 1:1 between Mega Mix and your monitor, or you can opt to use NIS or FSR to allow Mega Mix to use a smaller resolution and let gamescope upscale it for you.

Do note that the resolution Mega Mix+ uses for both "Full Screen" and "No Frame" are locked to what it thinks is your monitor's resolution, and that gamescope will fudge this for you if you decide to use upscaling.
GameMode Configuration
Edit ~/.config/gamemode.ini to alter the following lines:

[general] desiredgov=performance renice=10 [custom] start=notify-send "GameMode started" /usr/bin/qdbus org.kde.KWin /Compositor suspend end=notify-send "GameMode ended" /usr/bin/qdbus org.kde.KWin /Compositor resume

Note: The KWin lines are only applicable when using kwin (from KDE Plasma) as your window manager and compositor. You can replace these lines with commands relative to your wm/compositor if not using kwin or omit them entirely if not using compositing.
High Refresh Rate Mod Configuration
Configure the High Refresh Rate mode to disable vsync. THIS IS NECESSARY TO REDUCE INPUT LAG. Otherwise both Mega Mix+ and GameScope are going to have their own vsync buffers and things will feel a bit off during game play. There is no way to disable GameScope's vsync at the time I'm writing this. The only option is to use a mod to tell Mega Mix to not use vsync.

You're also most likely going to want to cap the refresh rate to something sane. When I left the High Refresh Rate config at framerate=0 (unlimited) my GPU would spit out 240+ FPS during game play, sucking down over 130W and causing the GPU fans to start running full bore. Keeping things at 120 FPS works well enough for me and my peasant 60 FPS monitor.

This also has the side benefit of solving the Denuvo stutters. I still get the occasional stutter, but under this setup they're FAR less intrusive and ALMOST NEVER game-breaking.

Edit the following lines in <game-location>/mods/High Refresh Rate/config.toml

vsync = false framerate = 120
Steam Command Line
WINEDLLOVERRIDES='dinput8.dll=n,b' gamemoderun gamescope -i -n -f -W 1920 -H 1080 -r 60 -e --rt -- mangohud %command%

  • WINEDLLOVERRIDES='dinput8.dll=n,b' is needed by DivaModLoader under Linux
  • gamemoderun is used to set the CPU governor to "performance," renice the application to have a bit higher priority than normal, and to temporarily turn off desktop compositing while running the game.
  • gamescope -i -n -f -W 1920 -H 1080 -r 60 -e --rt -- launches the game in its own nested compositor, separating the game from your desktop and vice versa. Besides solving any framerate issues introduced by your desktop that aren't solved with GameMode, it also has a nice side benefit of stopping Mega Mix+ from hogging your mouse while running.
    • -i -n tells GameScope to use integer scaling and nearest-neighbor filtering. I specify this as I'm going to use a resolution that's 1:1 with my display and I don't want GameScope trying to do anything too strenuous.
    • -f -W 1920 -H 1080 -r 60 tells GameScope to run full-screen and at which output resolution and frame rate. When not specified, -w and -h (nested width and height) default to -W and -H (output width and height) respectively.
    • -e enables Steam integration.
    • --rt tells GameScope to use realtime scheduling to help make sure input lag is as low as possible
    • -- is necessary to tell GameScope that there are no more arguments and that the command to execute comes next.
  • mangohud is optional BUT MUST APPEAR HERE IF YOU WISH TO USE IT. Otherwise MangoHud and GameScope will conflict and crash.
  • %command% tells Steam to insert whatever it needs to to run the game.

If you have a 4K display, you can change the gamescope command line to

gamescope [-U|-Y] -f -w 1920 -h 1080 -W 3840 -H 2160 -r 60 -e --rt --

where -U uses AMD's FidelityFX Super Resolution and -Y uses NVIDIA Image Scaling.
Conclusion
Mega Mix+ should now run just as well under Linux as it does under Windows.


Some people would say this is why gaming on Linux sucks, but...
  1. try playing Linux-native games under WSL and tell me how that goes, and
  2. can you really expect Linux to translate a proprietary game API (DirectX 11) from another OS and run that 100%?
Proton is doing its best to not only translate the Windows API to the GNU userland, but to translate the DX11 API to Vulkan. Out of the box, the game is quite playable. And it probably runs even better out of the box on officially supported platforms (Steam Deck, Ubuntu LTSes, SteamOS).

Linux-native games work much better. Project Heartbeat runs fine with no tinkering since it's under active development. Momodora RUtM runs fine under Steam Runtime, or under Steam Native once you account for the recent version bumps to OpenSSL. Gaming on Linux can work. We just have an entire industry full of devs trained on Windows programming and little else, and corporations that are so focused on profits over everything else, that we're stuck in a chicken-and-the-egg cycle that has no end in sight.

It would have been a lot better if Mega Mix+ was coded against Vulkan, but Sega seems hesitant to touch code they don't have to and to adopt new things. Sega Nu (which Arcade Future Tone used) supported DirectX 11 all the way back in 2013, so MM+ using DX11 is most likely because of familiarity and existing toolsets. There's semi-functional PS4 Future Tone menu UI code in Mega Mix+, which you could write off to time constraints if not for the fact the Switch port sits between PS4 and PC. And then there's the PS4 Future Tone pause exploit patch that simply dropped all holds, ceased scoring when you change an offset, and bumped all bonuses by +10% so players could bump illegitimate socres off the leaderboards.
License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License[creativecommons.org].
4 Comments
AnimeKing18 Jul 4, 2024 @ 4:27pm 
I'm a Linux user Ubuntu on my desktop and Steam OS 3 on my steam deck (of coarse) and I never had any issues with playing mega mix+ its been perfect.
Eggsukr Apr 10, 2024 @ 9:27pm 
Thanks :)
Krired Jan 2, 2023 @ 4:18pm 
Ok so I don't have Linux or anything of the sort but I can tell this took a bunch of effort and time, so thanks, very cool.
Sabina Dec 31, 2022 @ 2:10pm 
useful!:mikuDIVA: