Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State of Linux (Cont) #107

Closed
7 tasks done
Exzap opened this issue Aug 29, 2022 · 100 comments
Closed
7 tasks done

State of Linux (Cont) #107

Exzap opened this issue Aug 29, 2022 · 100 comments

Comments

@Exzap
Copy link
Contributor

Exzap commented Aug 29, 2022

This is a continuation of #1

The current top priorities for our Linux build are:

  • Providing AppImage releases
  • Wayland support (at least for Vulkan)
  • Finding a way to correctly emulate Wii U's case-insensitive filesystem on case-sensitive host filesystems

There are also some features that haven't been ported over yet:

  • HID support (Wii U nsyshid.rpl driver). Required for USB portals (Skylanders Portal of Power, Lego Dimension etc.)
  • nlibcurl. Has been ported but not tested a lot
  • Some debugger features like memory breakpoints

Nice to have:

  • Providing flatpak releases

(List last updated on 16-03-2024)

When building from source we use vcpkg for managing dependencies on all platforms and our officially supported and recommended compiler is Clang 14 or higher (and MSVC on Windows). With the -DENABLE_VCPKG=OFF option you can use system libraries instead of vcpkg but we generally discourage it as we prefer having builds with the same exact library configuration across all platforms for simplicity of debugging. We also won't officially support distributing Cemu as a distro package. Of course package maintainers are free to package it, but our focus is to streamline the troubleshooting and bug reporting process and it's way easier if there aren't dozens of different builds.

@Exzap Exzap pinned this issue Aug 29, 2022
@Tachi107
Copy link
Contributor

Tachi107 commented Aug 29, 2022

Finding a way to correctly emulate Wii U's case-insensitive filesystem on case-sensitive host filesystems

ext4 has case-folding support. Would it be possible to make it a requirement for Cemu? Users would have to store stuff accessed by the Wii U in a separate volume with this feature enabled though, which could be hard to do.

@JakobDev
Copy link
Contributor

ext4 has case-folding support. Would it be possible to make it a requirement for Cemu? Users would have to store stuff accessed by the Wii U in a separate volume with this feature enabled though, which could be hard to do.

That's a very bad idea. This requires, as you said, a seprate volume. Users might want to use a case-sensitive filesystem, so they need a own partition/drive just for Cemu.

It is also not very end user friendly to show a Message to new Linux Users, who want to play their Games: "Welcome to Cemu on Linux! Linux is a user friendly OS and not only a nerd OS as everyone says. Now please reformat your drive and create a partition with a case-insensitive filesystem to use Cemu."

Especially Steam Deck Users will have fun.

@Tachi107
Copy link
Contributor

Yeah I was just pointing out that the thing exists. It would be cool if Cemu supported it though, as I doubt that any workaround for case-folding would be more performant than an in-kernel implementation.

@Crementif
Copy link
Member

Crementif commented Aug 29, 2022

Steam Deck wouldn't have this issue afaik since it's using a case-insensitive filesystem. But yeah, really only Wine does this to my knowledge and they do heavy caching using a virtual filesystem to prevent it from hurting performance.

@Tachi107
Copy link
Contributor

Tachi107 commented Aug 29, 2022

To have a bit more context: what data used by Cemu needs casefolding support? Only the mlc01 folder? Only the games one? Both? Something else?

@Exzap
Copy link
Contributor Author

Exzap commented Aug 29, 2022

Case-insensitivity is needed for all files that map to the virtual Wii U file system in some way. Which is mlc and game folder files. So basically a majority of our file access code done by many different HLE modules

@Latrolage
Copy link

Latrolage commented Aug 29, 2022

This might be too hacky and im not too much of a programmer but cant all the files and directories which will be mapped to the wii u filesystem just be all uppercased or all lowercased

@Exzap
Copy link
Contributor Author

Exzap commented Aug 29, 2022

That wouldn't work because the case must be kept intact. Anything else is not accurate emulation and some games might rely on case-sensitive checks internally

@Dungeonseeker
Copy link

Dungeonseeker commented Aug 29, 2022

Edit - I was wrong

Another possibility though - https://www.collabora.com/news-and-blog/blog/2020/08/27/using-the-linux-kernel-case-insensitive-feature-in-ext4/

@Haxorzz
Copy link
Contributor

Haxorzz commented Aug 29, 2022

How do other emulators cope with this?

@PeterPierinakos
Copy link

It seems that y'all are talking about the Wii U's case-insensitive FS, but I'll throw this issue I'm having here since I think it's related to the main discussion:

Porting the remaining features (e.g. online play and some UI features)

About the online play feature(s), has anyone managed to get online actually working on Linux? I'm using the pre-compiled binary for Ubuntu on Arch, and after symlinking the missing dependencies the games I play work fine but when I try to go online by copying mlc01/ (recursively, of course), otp.bin and seeprom.bin it just throws this error in the account settings:

The currently selected account is not valid or dumped online account
AccountId missing (The account is not connected to a NNID)

My host machine is running Arch. Online works just fine on a Windows 10 VM (it says that the account is valid on Windows), so it's definitely not me following the instructions incorrectly. Does anyone know what could be causing this issue?

@JPabloLassala
Copy link

Users might want to use a case-sensitive filesystem, so they need a own partition/drive just for Cemu.

You can create an image file and format it as ext4

@Dungeonseeker
Copy link

Users might want to use a case-sensitive filesystem, so they need a own partition/drive just for Cemu.

You can create an image file and format it as ext4

To do it properly someone would need to write a Wii/U filesystem driver just like this one for FATX...

https://github.com/mborgerson/fatx

... which uses a userspace FUSE based library and can seamlessly handle mounting Xbox & Xbox 360 images directly.

@imsl0wer
Copy link

imsl0wer commented Aug 29, 2022

I'm on latest ArchLinux and compiled Cemu with gcc and g++ and make. Few issues:

  • Changing Controller Settings(rumble and sticks) doesn't work it's just blank displaying what was in foreground before opening it
  • I can't get any game I own working. Smash bros launches but after all the dlc messages popped up it crashes, wind waker crashes after opening it same with tp same with star fox zero and breath of the wild. Bayonetta 1&2 also crash :<
    Tried it on my NTFS drive and ext4 both have the same issue

@Tachi107
Copy link
Contributor

Tachi107 commented Aug 29, 2022

You can create an image file and format it as ext4

This may work for the mlc01 folder, but not for the games one. The latter has to be easily accessible to the user. Still, better than requiring a different partition :)

To do it properly someone would need to write a Wii/U filesystem driver just like this one for FATX which uses a userspace FUSE based library and can seamlessly handle mounting Xbox & Xbox 360 images directly.

Mh, I believe that the issue here is the opposite; you don't need to mount a Wii U filesystem on the host, but you have to read the host's filesystem on the (emulated) Wii U

@Exzap
Copy link
Contributor Author

Exzap commented Aug 29, 2022

Wine handles the case mismatch problem by recursively iterating directories and comparing file/folder names manually. With lots of caching it can be made fast.

@PeterPierinakos
Copy link

@imsl0wer

Are you using Vulkan or OpenGL as the graphics API?

@Dungeonseeker
Copy link

Dungeonseeker commented Aug 29, 2022

Mh, I believe that the issue here is the opposite; you don't need to mount a Wii U filesystem on the host, but you have to read the host's filesystem on the (emulated) Wii U

There's no functional difference between the two, once a filesystem is mounted on the host it is accessible by both the host and the emulator. So you create a 32GB image, format it for the WiiU, mount it with FUSE and its good. Emulator can read it as a native volume and the user can drag/drop files as needed.

Edit Still not exactly ideal though since you could only ever hold 32GBs worth of games at one time and would need to swap them out as needed. Also any kind of image solution would break the GUI game list.

@Crementif
Copy link
Member

Crementif commented Aug 29, 2022

About the online play feature(s), has anyone managed to get online actually working on Linux?

Nope, they're currently stubbed on Linux, like a few other things. One of the things listed by Exzap. Task is still up for grabs for anyone who wants :p.

@PeterPierinakos
Copy link

@Crementif I managed to get Cemu to say that my account is valid by compiling from source. It was a problem with the binary in the releases. I'll update if I encounter any issues, but the problem I mentioned is fixed for now.

@JPabloLassala
Copy link

Wine handles the case mismatch problem by recursively iterating directories and comparing file/folder names manually. With lots of caching it can be made fast.

I don't know what does Wine implement below the hood, but, maybe, a small SQLite db can be used to cache the entire tree?

@Dungeonseeker
Copy link

Wine handles the case mismatch problem by recursively iterating directories and comparing file/folder names manually. With lots of caching it can be made fast.

I don't know what does Wine implement below the hood, but, maybe, a small SQLite db can be used to cache the entire tree?

For Unix, Redis would be a better choice than SQLite.

@imsl0wer
Copy link

imsl0wer commented Aug 29, 2022

@imsl0wer

Are you using Vulkan or OpenGL as the graphics API?

Using Vulkan, OpenGL does the same thing

@Tatsh
Copy link

Tatsh commented Aug 29, 2022

XDG Base Directory Specification

The files that Cemu writes and reads from should not be next to the binary. It should be in the XDG directories.

graphicsPacks should go in XDG_DATA_HOME: e.g. ~/.local/share/cemu/graphicsPacks, as should memorySearcher and mlc01. Controller profiles and custom game profiles should also go here. log.txt should be written here as well or don't do that and write to syslog.

settings.xml should go in XDG_CONFIG_HOME. keys.txt shoudl also be placed here.

shaderCache should go in XDG_CACHE_HOME.

@Ziemas
Copy link
Contributor

Ziemas commented Aug 29, 2022

Wine handles the case mismatch problem by recursively iterating directories and comparing file/folder names manually. With lots of caching it can be made fast.

I don't know what does Wine implement below the hood, but, maybe, a small SQLite db can be used to cache the entire tree?

For Unix, Redis would be a better choice than SQLite.

Why would there be any need to persistently store such a cache? I can't think of any good reason for that.

Nor would there be any need for a database engine to manage it.

@Tachi107
Copy link
Contributor

Controller profiles and custom game profiles should also go here.

To me they look more like configuration files than general data, so why not ~/.config/cemu/?

log.txt should be written here as well or don't do that and write to syslog.

Mh, shouldn't logs go to ~/.cache/cemu/?

$XDG_CACHE_HOME defines the base directory relative to which user-specific non-essential data files should be stored.

@Yasand123
Copy link

Controller profiles and custom game profiles should also go here.

To me they look more like configuration files than general data, so why not ~/.config/cemu/?

log.txt should be written here as well or don't do that and write to syslog.

Mh, shouldn't logs go to ~/.cache/cemu/?

$XDG_CACHE_HOME defines the base directory relative to which user-specific non-essential data files should be stored.

Yeah, cache is more for what programs do internally; if the files it generates are usable/useful for the end user it shouldn't be stored in cache generally.

@Tachi107
Copy link
Contributor

Good news! I had a quick chat with Krisman, the guy who implemented casefolding (case-insensitive) support for ext4, and he said the following:

Unfortunately, there is no way to mount a directory from a filesystem over a different filesystem. But, the Ext4/F2FS implementations support case-insensitiveness per-directory, so you could make only those specific directories case-insensitive.

Since you cannot guarantee the user is on ext4, one way forward is to store the emulation directories inside a qcow image, that you will later mount on a specific path. Since you control the image creation/distribution, you can guarantee it is ext4 and correctly configured to expose the right case-insensitive directories.

As you said, there is also the userspace solution, which you emulate case-insensitiveness in userspace, if it detects the underlying filesystem doesn't support it. Valve, who is a big user of case-insensitiveness, actually has their own library for supporting older systems. If they find the system to be ext4 on a fairly recent kernel, they will use the kernel implementation. otherwise, they fallback to the library. A userspace implementation is always racy, but it usually works well enough as a fallback. I wrote a library (unmaintained) for that here:

https://gitlab.collabora.com/krisman/libcasefold

Please, let me know if you decide to use it, I can revive the project and start maintaining it again. It deserves some love.

Finally, a piece of good news is that my team is working on briging case-insensitive support for more filesystems. Right now, we support ext4 and f2fs, but the plan is to enable it on btrfs and tmpfs in the near future.

But this would still require the users to re-format their main ext4 partition, right? At least on my Debian system, it seems that the casefold feature is not enabled.

You don't need to reformat. But before enabling it on a directory, you need to configure the superblock, which is basically telling it which encoding will be used for case-insensitive directories:

tune2fs -O encoding /dev/sdx

It won't make the filesystem case-insensitive, just configure the superblock. Unless you use overlayfs, there isn't any downside on doing that. We are still working on mixing case-insensitive and overlayfs. If you have any problems, the new versions of tune2fs allow disabling the flag too.

All things considered, I think that using an ext4 image managed by Cemu (as also mentioned by @JPabloLassala) might be the best solution so far. Opportunistic use of the casefold feature on the host's filesystem might not be helpful in practice, because as far as I know there are no distros that ship with this feature enabled by default, and enabling it requires unmounting the filesystem (that could be hard/impossible to do for users that store everything in a single partition, like me).

Using an image would likely mean that the mlc01 and games folder won't be normally accessible by the user, but I guess Cemu could transparently mount and unmuont the image when launched and closed.

@joshuajeschek
Copy link

joshuajeschek commented Nov 30, 2022

there is no sound

I also had no sound at first and was confused. I needed to select an audio device in General Settings -> Audio -> TV. It doesn't seem to default to the first/default one on setup.

Yep, that's also what I tried, but I get a crash whenever I try to open general settings. More info in issue #527 (there is no reaction there yet tho)

Is it possible to edit the settings without the UI? The sound is honestly the only thing preventing me to start playing

@bunkbail
Copy link

bunkbail commented Dec 1, 2022

I've been using the AppImages of Cemu (2.0.17, 2.0.18 and 2.0.19) for a few weeks now, no crashes and everything works great and fast (at least for BoTW), except that the app doesn't seem to respect the system dark theme on KDE.

./Cemu-2.0-19-x86_64.AppImage

Gtk-Message: 01:18:26.863: Failed to load module "colorreload-gtk-module"
Gtk-Message: 01:18:26.863: Failed to load module "window-decorations-gtk-module"

(AppRun.wrapped:12339): Gtk-CRITICAL **: 01:18:26.904: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar

@bunkbail
Copy link

bunkbail commented Dec 1, 2022

Is it possible to edit the settings without the UI? The sound is honestly the only thing preventing me to start playing

This is what I've got in mine /home/bunkbail/.config/Cemu/settings.xml

<Audio>
    <api>3</api>
    <delay>2</delay>
    <TVChannels>1</TVChannels>
    <PadChannels>1</PadChannels>
    <InputChannels>0</InputChannels>
    <TVVolume>100</TVVolume>
    <PadVolume>0</PadVolume>
    <InputVolume>50</InputVolume>
    <TVDevice>alsa_output.pci-0000_09_00.4.analog-stereo</TVDevice>
    <PadDevice></PadDevice>
    <InputDevice></InputDevice>
</Audio>

@Exzap
Copy link
Contributor Author

Exzap commented Jan 13, 2023

I updated the original post to match the current state of development.

@petran79
Copy link

Compiling from source in Ubuntu 22.04 , following the instructions on the site, gives me this error
cmake -S . -B build -DCMAKE_BUILD_TYPE=release -DCMAKE_C_COMPILER=/usr/bin/clang-12 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-12 -G Ninja -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja
CMake Error at /usr/share/cmake-3.22/Modules/CMakeDetermineSystem.cmake:130 (message):
Could not find toolchain file:
/home/user/Cemu_2.0-25/Cemu-main/dependencies/vcpkg/scripts/buildsystems/vcpkg.cmake
Call Stack (most recent call first):
CMakeLists.txt:31 (project)

@kzdixon

This comment was marked as off-topic.

@Tatsh
Copy link

Tatsh commented Feb 17, 2023

You should file an issue on my repo if you are having an issue with the ebuilds.

Cemu is covered in the readme: https://github.com/Tatsh/tatsh-overlay#cemu

@jr1991-g
Copy link

There is now a Flatpak version available!

@Haxorzz
Copy link
Contributor

Haxorzz commented Mar 26, 2023

I REJOICE FOR FREEDOM!

Any way to merge or transition from appimage to flatpak? Like configs and such?

@JakobDev
Copy link
Contributor

You can copy the Cemu directory from ~/.local/share to ~/.var/info.cemu.Cemu/data and from ~/.config to ~/.var/info.cemu.Cemu/config

@minilandl
Copy link

Checking in tried to play Lego dimensions and couldn't get the portal to work looks like that's because hid support isn't in the Linux version yet

@Haxorzz
Copy link
Contributor

Haxorzz commented Mar 27, 2023

I think the flatpak is stuck in stable and they don't have a beta branch on flatpak

@prurigro
Copy link

prurigro commented Apr 20, 2023

In case it helps anyone else who couldn't get the audio devices to populate:

  1. Run pactl list short sources and choose a sink id starting with alsa_output
  2. Open the settings.xml file and in the <Audio> tag, add the sink id to <TVDevice></TVDevice>
  3. Open Cemu and the audio device should be populated, and you'll be able to select other audio devices too

@RubixDev
Copy link

Is there any tracking issue or PR on the missing HID support?

@minilandl
Copy link

Just tested Lego dimensions on arch using the AUR package and can confirm that the the postal works and detects figures

@Fxzzi
Copy link

Fxzzi commented Feb 12, 2024

Hey all, one suggestion for the Cemu linux builds is to change the directory for shadercache. Currently, they are stored in ~/.cache/Cemu/shaderCache which seems sensible considering the name, but people who clear their cache frequently will also end up deleting this folder, causing them to have to recompile all shaders.

@tm604
Copy link

tm604 commented Feb 12, 2024

people who clear their cache frequently will also end up deleting this folder, causing them to have to recompile all shaders.

That's the point of the common cache folder, though? Removing that entire folder will affect many other applications: it's a convenient way to clear up some space, splitting that out into separate custom places per app is a step backwards.

@TacoCake
Copy link

Exactly, why would a user delete the cache folder and not expect everything to have to be re-cached again?

Maybe the solution would be to not blindly delete the entire cache folder to try to save space 🙃

@Fxzzi
Copy link

Fxzzi commented Feb 12, 2024

I completely understand where you're coming from with the precompiled shader cache, but I think for the transferable cache these are not usually supposed to be removed. They would take a while to regenerate if you were to play again.

@mubinulhaque
Copy link

So why are these builds experimental? Linux support looks to be completely fine??? I'm on Steam Deck btw

@Exzap
Copy link
Contributor Author

Exzap commented Mar 16, 2024

Experimental just means that it didn't go through the rigorous testing and bug fixing period that comes with calling a release stable. But I agree that the state of the Linux releases is pretty good and this issue has runs it's course. Let's close it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests