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

[Feature Request] Linux support #7

Closed
RBNXI opened this issue Jul 3, 2022 · 69 comments
Closed

[Feature Request] Linux support #7

RBNXI opened this issue Jul 3, 2022 · 69 comments
Labels
enhancement New feature or request

Comments

@RBNXI
Copy link

RBNXI commented Jul 3, 2022

Probably it's too soon to ask for a Linux port (although I think it should be easy, since the main problem would be launching the game on Linux but that's easy solvable launching the Lutris launcher.bat file of the game instead of the .exe), but could we get a quick guide on how to launch Cultivation with Wine?, it's currently impossible without some tinkering that I don't know (or maybe it's absolutely impossible to run it with Wine for some technical reason?).

@SpikeHD
Copy link
Collaborator

SpikeHD commented Jul 4, 2022

Linux/Mac builds are possible, they just have to specifically be built on Linux/Mac. I’ll probably setup GitHub actions at some point to create automated Linux builds

@KingRainbow44
Copy link
Member

at the moment, a few of cultivation's base logic (embedded in src-tauri) is platform specfiic and locked to windows. while it's in theory possible, it isn't well supported at the moment. (only a few methods have os checks)

it is worth noting that cross compatibility is planned (it's on our trello that we don't use)

@Fanixtar
Copy link

afaik linux require some client patching to make it work

@RBNXI
Copy link
Author

RBNXI commented Jul 12, 2022

afaik linux require some client patching to make it work

You mean to run Genshin on Linux? It doesn't need a patch, only a fix to some registry entries and a redirect to ip 0 for some calls.
I mean, I can play Genshin in Linux, the problem is that Cultivation is not compatible with Linux.

@ChazyTheBest
Copy link

afaik linux require some client patching to make it work

You mean to run Genshin on Linux? It doesn't need a patch, only a fix to some registry entries and a redirect to ip 0 for some calls. I mean, I can play Genshin in Linux, the problem is that Cultivation is not compatible with Linux.

Don't they ban linux users? Don't tell me I could've had played all this time without my phone?

@SpikeHD
Copy link
Collaborator

SpikeHD commented Jul 14, 2022

Never heard of a linux user getting banned, I played linux myself for a while no problem

@RBNXI
Copy link
Author

RBNXI commented Jul 14, 2022

In general, for most games, even with the most aggressive patches that forces the game to run without anticheat, the worst problem could be that you get kicked of the game some times because the game thinks that your files are corrupted, but you won't get ban if you don't cheat.
In genshin I've never have the tiniest problem, and of course I'm not banned either.

@ChazyTheBest
Copy link

ChazyTheBest commented Jul 14, 2022

Sorry, I was half sleep and couldn't have been more ambiguous.

I may really be gullible. I read last year about having to disable anti-cheat in order to run GI on linux and also read comments of people getting banned and honestly I freaked out, didn't want to loose my whale dolphin (ish) account. You mean to say online games (the ones using anti-cheat) don't ban linux users? I mean the ones that require tampering with the game files. I've read this for some online games, but who knows if it's really true or not. Which is one of last topics I read a while ago about fully supporting gaming on linux, games that require kernel-level access, how it affects linux and its users and solutions such as providing access to some dummy interface.

I also play different online games on linux and it really feels good not having to rely on windows. This could only get better by getting full wine-wayland support :)

Ugh, truth is I don't really have enough experience with rust or I would've opened a PR to replace the windows specific code. Tauri looks like a nice toolkit, I'll have to give it a try some day, my javascript is getting rusty (coding as a whole lol).

@Birdulon
Copy link
Member

You mean to say online games (the ones using anti-cheat) don't ban linux users?

We don't have any firsthand accounts of it happening. This can change at any time and nobody here will be able to do anything for you if you do get banned. I would personally consider getting banned from this game to be a blessing, but I don't blame anyone for feeling differently about that.

It's against ToS, there's more than enough potential ways for them to detect it (normal operation for the Windows client expects remote code execution with admin access), and on the other hand they want paying customers to stay addicted and giving them some forced time off might wake them up to how pointless it all is.

Nobody here can guarantee anything will happen either way, and even if they claim they can, they'll disappear if you ever ask them to pay for a banned account ;)

@RBNXI
Copy link
Author

RBNXI commented Jul 14, 2022

You mean to say online games (the ones using anti-cheat) don't ban linux users?

For MOST games, that's the case. And if the game is playable without any tinkering, it's probably just running the anticheat with Wine, so it should be legal and you shouldn't get banned. But if the game needs a patch that disables the anticheat, either you get automatically banned (if the anticheat is VERY aggressive, and I've never have this problem personally) or the game let's you play as long as you don't cheat.
For genshin... I haven't heard anyone getting banned because of playing in Linux, and you have a Linux patch in the Lutris website, so there are a lot of people using it and no one has reported a ban yet.
BUT, in the case of Grasscutter, even when no one should be banned for using it, it's recommended not to use the same genshin installation for playing in the official servers and Grascutter, just in case.

games that require kernel-level access

Like Valorant, right? I don't know if that would be possible in Wine, probably yes, at some point, but if that requires some kernel level patch FOR LINUX... I wouldn't play it.

I also play different online games on linux and it really feels good not having to rely on windows

Same :D

I would've opened a PR to replace the windows specific code

If you do so, you have my gratitude :D

@SpikeHD SpikeHD added the enhancement New feature or request label Jul 25, 2022
@RBNXI
Copy link
Author

RBNXI commented Aug 28, 2022

Has this progressed since then?

@SpikeHD
Copy link
Collaborator

SpikeHD commented Aug 28, 2022

Nope

@SpikeHD SpikeHD pinned this issue Aug 29, 2022
@SpikeHD SpikeHD changed the title Linux guide? [Feature Request] Linux support Aug 29, 2022
@hetake2
Copy link

hetake2 commented Sep 1, 2022

Ok, I compiled the launcher and it works (Arch Linux).

My next step would be patching the game once I download it from official launcher.

And final step would be trying to launch the game from Cultivation.

But of course there's no built-in Wine/Proton to launch this game for Linux, so, I might need some hints about which source file should I modify to add the ability to execute Wine/Proton by pressing "Launch" button.

If somebody is interested in cooperation to launch the game in Linux, feel free to DM me in discord: Алладин#8211

I hope soon I'll be able to send PR.

@4Benj
Copy link
Member

4Benj commented Sep 1, 2022

My next step would be patching the game once I download it from official launcher.

From my discoveries while working on #83, client patching seems to be completely broken currently. So I don't think you'd have much luck with that unless you fix it yourself.

I might need some hints about which source file should I modify to add the ability to execute Wine/Proton by pressing "Launch" button.

I'm not sure myself what files you'd need to modify, but it might be a good idea for when Linux supported is implemented to automatically patch the game for Linux support. If you need help with developing the patcher, feel free to contact me and I'll see what I can do when I get time.

@SpikeHD
Copy link
Collaborator

SpikeHD commented Sep 1, 2022

This is still actively being worked on, and I already have ideas on how I will handle it. The best way to get linux support is to just wait for me to finish it :P

@ArjixWasTaken
Copy link

ArjixWasTaken commented Sep 16, 2022

Sent a message to subscribe to this issue 💾

Edit: oof, looks like i can subscribe w/o doing that, sry 🙏

@TropicLegend
Copy link

I'm so hyped for Linux Support, finally no VM needed

@TropicLegend
Copy link

If y'all need some base to work with, I can PM you some an anime game launcher

@ChazyTheBest
Copy link

ChazyTheBest commented Sep 19, 2022

But of course there's no built-in Wine/Proton to launch this game for Linux, so, I might need some hints about which source file should I modify to add the ability to execute Wine/Proton by pressing "Launch" button.

No need to reinvent the wheel, there are other projects that do exactly the same, launch a windows game using a wine prefix with dxvk, for example: https://github.com/goatcorp/FFXIVQuickLauncher

@SpikeHD If you need more ideas or just are curious, the ffxiv launcher does exactly this (except the patching).

@Mar0xy
Copy link

Mar0xy commented Sep 28, 2022

If you need specific examples for this game you can look at https://github.com/an-anime-team/an-anime-game-launcher or the GTK alternative written in rust https://github.com/an-anime-team/an-anime-game-launcher-gtk

@TropicLegend
Copy link

If you need specific examples for this game you can look at https://github.com/an-anime-team/an-anime-game-launcher or the GTK alternative written in rust https://github.com/an-anime-team/an-anime-game-launcher-gtk

It's specifically said that you should not send links to their project publicly. Please delete them.

@Mar0xy
Copy link

Mar0xy commented Sep 29, 2022

If you need specific examples for this game you can look at https://github.com/an-anime-team/an-anime-game-launcher or the GTK alternative written in rust https://github.com/an-anime-team/an-anime-game-launcher-gtk

It's specifically said that you should not send links to their project publicly. Please delete them.

I am one of the devs and admins so no I won't.

@TropicLegend
Copy link

Didn’t know about that.
Thanks for making it.

@paletteOvO
Copy link

Besides a fully supported game launcher for Linux, is it possible to port Grasscutter patcher only and release it individually?

@GarnetSunset
Copy link

Would it be possible to pack cultivation into flatpak? :O For steam deck! :)

@TropicLegend
Copy link

Yeah, that'd be awesome.
Is there any update on Linux support for Cultivation?

@ArjixWasTaken

This comment was marked as off-topic.

@fnr1r
Copy link
Contributor

fnr1r commented Jun 28, 2023

@SpikeHD

  1. PR sent. (QOL and path changes #186)
  2. From what I've gathered, the only thing we have to care about is Linux-specific patches (called "dawn") and renaming mhypbase.dll (which is its own option). In the case of Linux-specific patches, I'll error out if the game is not patched. Installing the game and changing settings (like upscaling, managing wine version or changing the /etc/hosts file to block telemetry) can be handled by the other launcher.
  3. Yep. Wine respects http_proxy and https_proxy environment variables. I tested it on a clean install of Ubuntu.

As for 5, today I finished implementing patching in a way that respects the other launcher's settings, so I think that's dealt with.

@SpikeHD
Copy link
Collaborator

SpikeHD commented Jun 28, 2023

Alright that makes sense. Been about (if not more than) a year since I've played on Linux so I'm glad the patch is the same as when I did it. I think it's reasonable to expect that someone running the game on Linux will have already patched the game to work on it (either with Dawn manually or with the other launcher).

How is setting the game path handled on the Linux side? Is the DirInput now able to accept a command as it's input (eg. wine cmd /c launcher.bat as opposed to the standard C:/Path/To/Game.exe that Windows users currently do)? What other problems does the branch have atm?

(you are welcome to open a PR and just slap WIP: in front of it so we don't accidentally merge it! Makes it easy for people to see the diff)

@SpikeHD
Copy link
Collaborator

SpikeHD commented Jul 1, 2023

@fnr1r forgot to ping again oops

@fnr1r
Copy link
Contributor

fnr1r commented Jul 2, 2023

@SpikeHD
I use the same element as on Windows. Since the game_command option was not fully implemented, I removed it (although it's still in translation files). My clone also ignores the un_elevated toggle, but I have not hidden it on Linux yet.

As for other problems, I noticed some code is duplicated across Rust and TS. While it is a bit annoying, I kept most of it as-is. The one thing I moved to Rust is RSA patching.
Installing CA files is disabled since it crashed the launcher upon failing. I'll enable it once I find a way to do it across distros.
I'm not sure if anything swag-related works.
Some operations, like unpatching or stopping MongoDB, run two times, which causes some problems. In the case of unpatching, it shows a popup telling the user that unpatching failed, despite everything working. And in the case of MongoDB, one of the commands fail and prints an error message in the console.
That's about it.

@CurrentSubset68
Copy link

@SpikeHD
putting cultivation on flatpak/flathub could be a way to get around supporting all distros. it's sandboxed tho so there might be a few issues with it to fix.
(personally waiting for an arch release tho somone will probably make an unofficial aur package at some point)

@SpikeHD
Copy link
Collaborator

SpikeHD commented Sep 8, 2023

I don't have the time or energy to put it there and debug any weirdness that comes from the sandboxing right now, so you'll just have to settle with Github releases and/or whenever someone decides to maintain an AUR package

@SpikeHD SpikeHD closed this as completed Sep 8, 2023
@My1
Copy link

My1 commented Sep 9, 2023

is an appimage maybe less "sandboxy"? because appimages also run on deck

or maybe even a zip with a runnable bin or whatever

@SpikeHD
Copy link
Collaborator

SpikeHD commented Sep 9, 2023

Culti currently is erroring when attempting to bundle an AppImage. Might just be my WSL, so if someone else is able to do it lemme know

@GarnetSunset
Copy link

Is there a branch for packaging it that you were working on spike? I can bang my head against it on a native server if you want

@SpikeHD
Copy link
Collaborator

SpikeHD commented Sep 9, 2023

No branch, Tauri should be handling it all already so it shouldn't require more than a simple pnpm tauri build. You are more than welcome to give it a shot though! @GarnetSunset

@GarnetSunset
Copy link

I'll give it a shot! :)

@Mar0xy
Copy link

Mar0xy commented Sep 12, 2023

@SpikeHD putting cultivation on flatpak/flathub could be a way to get around supporting all distros. it's sandboxed tho so there might be a few issues with it to fix. (personally waiting for an arch release tho somone will probably make an unofficial aur package at some point)

This is actually not recommend as we also had our launcher on flathub until we back tracked and started our own flatpak repo due to backlash caused by gamingonlinux creator due to the fact that they(the gnome/flathub team) accept an app like ours so we came to an agreement to just move off the platform. You can actually see how we handle publishing to the repo here: https://github.com/an-anime-team/flatpak-builds/blob/main/.github/workflows/build-pak.yml

PS: sorry for the ping spike forgot to remove your handle

@My1
Copy link

My1 commented Sep 12, 2023

a flatpak would be really awesome, especially for deck ppl (or in general immutable system partitions), and for the normal version maybe a rename should be done as it clashes with a package available in the default ubuntu AND debian repos.

https://packages.debian.org/bookworm/cultivation
https://packages.ubuntu.com/jammy/cultivation

bonus advantage would be not needing root for hosts file stuff as can be seen in AAGL

@GarnetSunset
Copy link

An issue that I saw, I can't figure out where it's referenced but, there's a part of the build system where it tries to run "appimage.sh", but that script doesn't exist, but build_appimage.sh DOES. Tried grepping for the place it was called with no luck

@GarnetSunset
Copy link

Successfully builds now! :)

@SpikeHD
Copy link
Collaborator

SpikeHD commented Sep 12, 2023

👏 what'd you change? you're welcome to make a PR

@GarnetSunset
Copy link

That's the weird part, nothing!
Installed all the required awful dependencies for tauri (which i can get a list of they were a LOT)
Installed node 18.17.1
Build it, it worked.

a@ToledoDante:~/Cultivation$ git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
a@ToledoDante:~/Cultivation$ pnpm tauri build

> cultivation@1.0.26 tauri /home/a/Cultivation
> tauri "build"

   Compiling cultivation v1.2.0 (/home/a/Cultivation/src-tauri)
    Finished release [optimized] target(s) in 11.72s
warning: the following packages contain code that will be rejected by a future version of Rust: rustc-serialize v0.3.24
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`
    Bundling cultivation_1.2.0_amd64.deb (/home/a/Cultivation/src-tauri/target/release/bundle/deb/cultivation_1.2.0_amd64.deb)
    Bundling cultivation_1.2.0_amd64.AppImage (/home/a/Cultivation/src-tauri/target/release/bundle/appimage/cultivation_1.2.0_amd64.AppImage)
    Finished 2 bundles at:
        /home/a/Cultivation/src-tauri/target/release/bundle/deb/cultivation_1.2.0_amd64.deb
        /home/a/Cultivation/src-tauri/target/release/bundle/appimage/cultivation_1.2.0_amd64.AppImage

a@ToledoDante:~/Cultivation$ node
Welcome to Node.js v18.17.1.
Type ".help" for more information.
>
(To exit, press Ctrl+C again or Ctrl+D or type .exit)
>

@SpikeHD
Copy link
Collaborator

SpikeHD commented Sep 12, 2023

Huh, guess my WSL was just borked. In that case I will try to setup Actions or something soon to handle that properly. Thanks for looking into it!

@GarnetSunset
Copy link

wOOT :) Sound good! HAven't tested on steam deck yet but i will

@RBNXI
Copy link
Author

RBNXI commented Oct 1, 2023

Huh, guess my WSL was just borked. In that case I will try to setup Actions or something soon to handle that properly. Thanks for looking into it!

Where can I try this? I don't know hoe github actions works. Is this supposed to be a way to build an appimage automatically? I want to test it on Arch

@SpikeHD
Copy link
Collaborator

SpikeHD commented Oct 1, 2023

@RBNXI Well, if I remembered to upload appimages via actions then they would show up here, but obviously I didn't, so if you want you can just follow the build instructions and build it manually for now.

@RBNXI
Copy link
Author

RBNXI commented Oct 1, 2023

@RBNXI Well, if I remembered to upload appimages via actions then they would show up here, but obviously I didn't, so if you want you can just follow the build instructions and build it manually for now.

Ok, I'll try it and see. If you have time upload it too so more people can test it!

@CurrentSubset68
Copy link

CurrentSubset68 commented Oct 1, 2023

@RBNXI I’m not sure if the amd_64.zip is arch only or just a universal linux version but that seems to work. It’ll be in releases.
It won’t install it’ll just be portable wherever you leave it

@RBNXI
Copy link
Author

RBNXI commented Oct 1, 2023

@RBNXI I’m not sure if the amd_64.zip is arch only or just a universal linux version but that seems to work. It’ll be in releases. It won’t install it’ll just be portable wherever you leave it

Nah, it doesn't work. The proxy doesn't seem to work and the game won't launch.
Error:


Renamed /run/media/ruben/Anima/Juegos/genshin-impact/Cultivation/genshin/mhypbase.dll to /run/media/ruben/Anima/Juegos/genshin-impact/Cultivation/genshin/mhypbase.dll.bak
Set server to http://localhost:443
Connecting to proxy...
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: No such file or directory (os error 2)', src/proxy.rs:293:34
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Game already patched!
The game is already patched.
Set server to http://localhost:443
Connecting to proxy...
thread '<unnamed>' panicked at 'Can't launch game. Check the other launcher.: "Wine is not installed"', src/system_helpers.rs:325:10
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Any { .. }', src/main.rs:354:24

I guess the problem launching the game is that it doesn't detect the wine installation? Maybe I have to set an environment variable?. I don't know about the problem with the proxy though.

@EncampedMars801
Copy link

EncampedMars801 commented Oct 1, 2023

It's the weirdest thing, I kept having an issue where (to the best of my knowledge) it would launch the 4.1 client I had installed through AAGL despite the game path being set to a separate 4.0.1 client. Then when I removed the AAGL folder to try to get it to actually run the correct version, I ended up with that error above.

Update: I built the binary myself, and while the wine error went away, I'm still getting the first part of the error (seen below) and the game still isn't opening.

Set server to http://localhost:443
Connecting to proxy...
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: No such file or directory (os error 2)', src/proxy.rs:293:34
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Waiting for game thread timed out

@RBNXI
Copy link
Author

RBNXI commented Oct 2, 2023

So it compiles and runs fine now, but still needs some fixes to run the game properly... It's something I guess, but it's been a yer already since I opened this issue... I wish I had the knowledge to fix this already and keep testing Grasscutter on Linux like I did some time ago, but I can't since some update that broke the proxy config I was using with mitm, it's probably very outdated by now and the best way to run this is through Cultivation...
Anyways, in the meantime, if someone knows some trick to run this using Cultivation, like running Cultivation and the internal proxy (Grasscutter runs fine so no need for it, same with the patch I think) but running the game with Lutris, tell me please.

fnr1r added a commit to fnr1r/Cultivation that referenced this issue Dec 24, 2023
I noticed that one issue on Grasscutters#7 was probably caused by anime-launcher-sdk trying to run the wrong version of the game (the one specified in aagl).
It's fixed now.
@DarkReaperBoy
Copy link

flatpak support pls 🙏

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

No branches or pull requests