Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Genshin Impact on Android VM under Linux working! #9

Open
XaeroVincent opened this issue Feb 18, 2021 · 78 comments
Open

Genshin Impact on Android VM under Linux working! #9

XaeroVincent opened this issue Feb 18, 2021 · 78 comments

Comments

@XaeroVincent
Copy link
Contributor

I got the game to work under Bliss OS 11.12 with QEMU & Virgil virtual GPU.

I've set the VM to 4 CPU cores and 8GB of RAM.

Download the game from APKPure and download an XAPK Installer app to install it in XAPK form. The game will crash numerous times during the download. Just keep trying. Press the Windows key on the keyboard once the game starts downloading from the 3D menu then open System Monitor to look at the network download traffic. The game may crash but continue to download it's 9GB of data. Try redoing the steps again if the network traffic and CPU usage falls to near zero. Eventually the game will download and once the game is downloaded, it doesn't appear to crash anymore (so far).

Keyboard mapping isn't working (Octopus doesn't seem to launch the game), however the game thankfully responds to mouse input!!

You can move your character around by moving the mouse cursor towards the bottom left hand corner of the screen (but not all the way to the end) and hold the left mouse button. Your character will move when you move your mouse while holding the left button down. Other actions can be done by clicking their respective buttons.

The framerate isn't great (maybe 10 to 15 FPS) but MUCH better compared to the nested virtualization under a Windows VM + Bluestacks that I had working prior. I have the graphics settings set at "Low". This level of performance is with a Core i7 6700HQ, 32GB RAM, and a GTX 1070 Mobile. A better computer will obviously yield better performance results.

genshin

@PseudoDistant
Copy link

Hello I am here now.

@PseudoDistant
Copy link

Any ETA on the Bluestacks libraries? ;-;

@XaeroVincent
Copy link
Contributor Author

XaeroVincent commented Feb 18, 2021

Any ETA on the Bluestacks libraries? ;-;

Bluestacks libraries aren't needed. The necessary Houdini libraries are already included with Bliss OS.

@Marc-Pierre-Barbier
Copy link
Owner

Any ETA on the Bluestacks libraries? ;-;

i damaged my install by trying

Any ETA on the Bluestacks libraries? ;-;

Bluestacks libraries aren't needed. The necessary Houdini libraries are already included with Bliss OS.

we can definitly improve if we have the bluestack libs because it doesn't crash as much in the download phase

@ghost
Copy link

ghost commented Feb 18, 2021

keyboard mapping isn’t working

Should I make the translation layer or should [at]Marc-Pierre-Barbier make it?

@Marc-Pierre-Barbier
Copy link
Owner

keyboard mapping isn’t working

Should I make the translation layer or should [at]Marc-Pierre-Barbier make it?

i will work on it if i achieve to make the game run, so feel free to start

@ghost
Copy link

ghost commented Feb 18, 2021

I don’t even have it running yet :( Also, it seems that Genshin Impact uses a timing attack to detect VM, so Windows version is officially hopeless. Only android is possible now... let’s hope it still works

@ghost
Copy link

ghost commented Feb 18, 2021

I can nearly hear my SSD’s happiness as 39GB of virtual SSD is deleted from the system

@Marc-Pierre-Barbier
Copy link
Owner

im going to try the lastest blissos release to see if it change something

@ghost
Copy link

ghost commented Feb 18, 2021

1.7GB, this may take some time...

@XaeroVincent
Copy link
Contributor Author

I don’t even have it running yet :( Also, it seems that Genshin Impact uses a timing attack to detect VM, so Windows version is officially hopeless. Only android is possible now... let’s hope it still works

They make so much effort to block Windows VMs now, yet it's still easy to bypass the anti-cheat altogether, which is how others are playing it on Linux via Wine with throwaway accounts. Stupid decisions on the developers part.

@XaeroVincent
Copy link
Contributor Author

Any ETA on the Bluestacks libraries? ;-;

i damaged my install by trying

Any ETA on the Bluestacks libraries? ;-;

Bluestacks libraries aren't needed. The necessary Houdini libraries are already included with Bliss OS.

we can definitly improve if we have the bluestack libs because it doesn't crash as much in the download phase

Slightly less crashing but it still did crash a ton of times during the download phase. I wouldn't really consider it much of an improvement (if any). The improvement with Bluestacks is the super easy keyboard mapping.

What might be an improvement is distributing updated Bliss OS disk images with Genshin Impact fully pre-installed?

@Marc-Pierre-Barbier
Copy link
Owner

What might be an improvement is distributing updated Bliss OS disk images with Genshin Impact fully pre-installed?

yea great idea

@ghost
Copy link

ghost commented Feb 18, 2021

Though I am unsure of the legality of such a thing... aka unsure if we can distribute disk images containing Genshin Impact

@Marc-Pierre-Barbier
Copy link
Owner

Marc-Pierre-Barbier commented Feb 18, 2021

Though I am unsure of the legality of such a thing... aka unsure if we can distribute disk images containing Genshin Impact

i don't want to read the genshin licence ...

@XaeroVincent
Copy link
Contributor Author

Another thing that might be a problem for using Bluestacks houdini is that it's based on Android 7.1 but Bliss OS is Android 9.

There are different versions of Houdini for different Android versions, such as Houdini7_x/y/z.sfs vs 9_x/y/z.sfs

@XaeroVincent
Copy link
Contributor Author

Though I am unsure of the legality of such a thing... aka unsure if we can distribute disk images containing Genshin Impact

i don't want to read the genshin licence ...

I'm guessing we're already violating the license by just playing the game in a VM in the first place.

@PseudoDistant
Copy link

Though I am unsure of the legality of such a thing... aka unsure if we can distribute disk images containing Genshin Impact

i don't want to read the genshin licence ...

I'm guessing we're already violating the license by just playing the game in a VM in the first place.

I mean, I never saw anything in the agreement about a VM :/ .

@ghost
Copy link

ghost commented Feb 18, 2021 via email

@ghost
Copy link

ghost commented Feb 18, 2021 via email

@ghost
Copy link

ghost commented Feb 18, 2021 via email

@XaeroVincent
Copy link
Contributor Author

XaeroVincent commented Feb 18, 2021

If this is a 15FPS on a 1070M, on an i5-5250U iGPU, this will be 1fps :( This means that playing Genshin on my PC will be impossible :( Of course, playing on a macbook isn’t exactly the best idea, but syscall user dispatch isnt out yet so no wine, so my only options are still limited

Le 18 févr. 2021 à 13:31, pika chu @.> a écrit :  It says that we cannot tamper with the anticheat, nothing about not running it in emulators or VMs, it also says that we cannot disable the anticheat, but this is not the primary goal of running it in a vm >> Le 18 févr. 2021 à 13:12, FarLanderCraft @.> a écrit : >> >  > Though I am unsure of the legality of such a thing... aka unsure if we can distribute disk images containing Genshin Impact > > i don't want to read the genshin licence ... > > I'm guessing we're already violating the license by just playing the game in a VM in the first place. > > I mean, I never saw anything in the agreement about a VM :/ . > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub, or unsubscribe.

That's with "low" settings. You could try with "lowest" and turn off AA, but yeah it won't be great and the experience is worse than when it ran in a Windows VM.

This game requires higher-end Android smart phones (Snapdragon 845 or better is recommended) since they don't really water it down compared to the PC version and I'm guessing the x64 to Aarch64 translation is eating up a lot of resources.

You could create a spare throwaway account and play the game with Wine and the game patcher. It would be a far better experience than what we're doing here, just riskier.

If you're using a Macbook with macOS, you can just install Bluestacks 4 64-bit for Mac. It might run better compared to Android x86? Just make sure it's the 64-bit version with 64-bit Android.

From what I've read the "syscall user dispatch" wont magically allow anti-cheat kernel drivers to work under Wine. IIRC, it's more for allowing anti-tamper and other forms of DRM like Denuvo to behave better under Wine and Linux.

@ghost
Copy link

ghost commented Feb 18, 2021 via email

@ghost
Copy link

ghost commented Feb 18, 2021

Screen Shot 2021-02-18 at 3 51 00 PM
yeah uhh is this normal

@XaeroVincent
Copy link
Contributor Author

Are you on macOS or is that just a Mac Linux theme?

@ghost
Copy link

ghost commented Feb 18, 2021

On macOS

@ghost
Copy link

ghost commented Feb 18, 2021

Now it says it's i686. WHAT IS WRONG WITH YOU QEMU
sorry had to vent

@XaeroVincent
Copy link
Contributor Author

Have you tried Bluestacks for Mac?

https://www.bluestacks.com/download.html

Or does the Mac version only support 32-bit Android games?

@ghost
Copy link

ghost commented Feb 18, 2021

Exactly.
Also, now it boots

@ghost
Copy link

ghost commented Feb 18, 2021

Aaaaand it crashes, blackscreen, MacBook Air early 2015.

@ghost
Copy link

ghost commented Feb 18, 2021

ok so now entire Bluestacks crashes... but QEMU not an option...

@Marc-Pierre-Barbier
Copy link
Owner

Screen Shot 2021-02-18 at 4 22 28 PM
Again

press ctrl + d until it start

@ghost
Copy link

ghost commented Feb 19, 2021

nope,
Screen Shot 2021-02-19 at 10 08 04 AM

@ghost
Copy link

ghost commented Feb 19, 2021

I think I should just go on my Linux box even if it's the samsung 505NP EFI corruption one lol

@ghost
Copy link

ghost commented Feb 19, 2021

nomodeset fixed it, now what?

@ghost
Copy link

ghost commented Feb 19, 2021

yay lawnchair!!!
Screen Shot 2021-02-19 at 10 33 00 AM
it needed nomodeset to boot, so this means that I have to go on my linux box... for real.
also this took an hour to boot
EDIT: ADB not working

@ghost
Copy link

ghost commented Feb 19, 2021

adb not working, could someone help me?

@Marc-Pierre-Barbier
Copy link
Owner

Marc-Pierre-Barbier commented Feb 19, 2021

adb not working, could someone help me?

use adb over ip
you need to enable it in the dev menu
i didn't achieved to get it working

@ghost
Copy link

ghost commented Feb 19, 2021

me neither, i tried it

@XaeroVincent
Copy link
Contributor Author

XaeroVincent commented Feb 19, 2021

I've managed to get key mapping working with a background scripting hack.

I can use a bash script with xdotool that waits for a key input and then moves the mouse cursor to a specific spot in the game and simulates a left click or hold inside the QEMU window. Obviously this requires you to run an X11 session instead of Wayland and doesn't work when the QEMU window is full-screen (but it can be maximized).

I so far have managed to get WASD keys mapped and enables the character to move forwards and back on the screen. Other mappings are easy to add.

What keys should be used for which particular actions, such as weapon use or switching characters?

The biggest problem I'm having is just getting Genshin Impact to run consecutive times to do key map testing. I can get the game to occasionally run but then if I restart my VM, the game will often no longer start and just crash at loading screen. It all seems pretty random and there appears to be no reliable way to get the game to start predictably.

@ghost
Copy link

ghost commented Feb 19, 2021 via email

@PseudoDistant
Copy link

It just drops me to a CLI
Screen Shot 2021-02-18 at 4 12 15 PM

Wait here for a moment, it takes a bit for the shell to start first-time sometimes.
There is the possibility that the installer failed to do it correctly, do an auto-install.
(I had the same problem first-time.)

@ghost
Copy link

ghost commented Feb 19, 2021 via email

@ghost
Copy link

ghost commented Feb 23, 2021

Can someone update me on the progress of the joystick translation layer?
Or should I try to do it? (that requires bliss os to boot though)

@Marc-Pierre-Barbier
Copy link
Owner

i can't since my game still doesn't want to boot

@ghost
Copy link

ghost commented Feb 24, 2021 via email

@ghost
Copy link

ghost commented Feb 24, 2021 via email

@Marc-Pierre-Barbier
Copy link
Owner

Marc-Pierre-Barbier commented Feb 24, 2021

wait, does nomodeset disable virgil?

Le 24 févr. 2021 à 04:10, Marc barbier @.***> a écrit :  i can't since my game still doesn't want to boot — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

https://askubuntu.com/questions/207175/what-does-nomodeset-do
" nomodeset parameter instructs the kernel to not load video drivers and use BIOS modes instead until X is loaded."
soo you have virgil but with no driver

@ghost
Copy link

ghost commented Feb 24, 2021

so its basically useless
ok
time to go to actual linux box
this may take a while

@ghost
Copy link

ghost commented Feb 27, 2021

Screen Shot 2021-02-27 at 11 21 30 AM

only with GTK3 frontend

TIL, so try GTK frontend instead.

@Quackdoc
Copy link

Quackdoc commented May 21, 2021

@NotKirito virgl renderer is known to have issues on mac. so you can try this
https://mail.gnu.org/archive/html/qemu-devel/2021-02/msg04235.html

or wait for venus to upstream in qemu (venus is a vulkan version of virgl and should hopefully work with moltenVK)

In the mean time, you can try vmware-svga as it too has 3d acceleration to some degree. though software rasterizer may be faster than it.

performance won't be great regardless until venus gets support gets added. (on linux hosts you can do GPU passthrough)

@XaeroVincent you can pass a gpu through (If you go that route do not pass the GTX card, as nouveau graphics only)

you can pass through your Igpu I believe or I think that cpu supports intel GVT-g, but ive never tested gvt-g with android before.

@Marc-Pierre-Barbier
Copy link
Owner

@NotKirito virgl renderer is known to have issues on mac. so you can try this
https://mail.gnu.org/archive/html/qemu-devel/2021-02/msg04235.html

or wait for venus to upstream in qemu (venus is a vulkan version of virgl and should hopefully work with moltenVK)

In the mean time, you can try vmware-svga as it too has 3d acceleration to some degree. though software rasterizer may be faster than it.

performance won't be great regardless until venus gets support gets added. (on linux hosts you can do GPU passthrough)

@XaeroVincent you can pass a gpu through (If you go that route do not pass the GTX card, as nouveau graphics only)

you can pass through your Igpu I believe or I think that cpu supports intel GVT-g, but ive never tested gvt-g with android before.

Gvt-G is not meant for this. i tried and the game was running at like 1fps or less
if you want good DESKTOP performance or video decode perofrmance it can do the trick but the 256 MB vram was a deal breaker, depending on your system you might be able to go up to 2GB of ram but it don't expect it to perform well

The best option we have is https://github.com/DualCoder/vgpu_unlock wich allows you to use the tesla driver and try to use sr-iov to do the equivalent of GVT-G but with a better gpu

@ghost
Copy link

ghost commented May 21, 2021 via email

@Quackdoc
Copy link

i do have an ETA for a linux box and i am not compiling qemu from source, thats going to take 5 hours

Okay, meanwhile, if you still want to try i did some more digging, here is a homebrew version
https://github.com/knazarov/homebrew-qemu-virgl
Patches are being upstreamed, keep an eye on
https://github.com/knazarov/homebrew-qemu-virgl
anholt/libepoxy#239

Gvt-G is not meant for this. i tried and the game was running at like 1fps or less
if you want good DESKTOP performance or video decode perofrmance it can do the trick but the 256 MB vram was a deal breaker, depending on your system you might be able to go up to 2GB of ram but it don't expect it to perform well

GVT-g preformed fine for me doing basic games, I wouldn't expect much but it should be much higher, If you are limited to that ram though, I wouldn't expect much

The best option we have is https://github.com/DualCoder/vgpu_unlock wich allows you to use the tesla driver and try to use sr-iov to do the equivalent of GVT-G but with a better gpu

I don't think it would be all that much better as androidx86 is limited to nouveau drivers.

Kinda sucks but oh well, I guess we are in a hurry up and wait situation. while venus won't directly benefit, if zink + venus gets implemented on android x86 it should preform significantly better. ill bring it up on the android-generic telegram

@azteca1998
Copy link

Hi,

I have some news regarding playing the android version of GI. They are neither good nor bad, but news nonetheless.

Since I had some time, I searched again for options and found redroid, a project to run android with GPU acceleration and arm translation on docker. The documentation was a bit lacking, but with some help from the devs (thx devs, if you ever see this) I managed to get an android instance with GPU and arm translation "working".

The app installs and runs successfully (at least the launcher part).

Then I had to download the actual game, which I had to painfully do so at 300-500kb/s (probably due to the arm translation since on my phone it's at least 10 times faster). The launcher still froze at least 20 times while downloading, and since I wasn't sure if it was still downloading, I restarted the app. I had to restart the entire container a few times, and it crashed my computer twice when it spawned the dump_crash32 processes (for some reason, it spawned like 30 at the same time).

About two or three hours ago, I finally managed to finish downloading it. Finally, it was time to test it. However, I realized just how slow the ndk_translation libraries are when it literally took between 40 minutes and an hour just to verify its files. Thankfully it loaded a bit faster at about 10 to 15 mins.

Then the game ran until when it should finally render the world. At this point it just left me with a black screen, and some time later it popped a message with "Connection lost. Retry?" or similar, and if I try to relog it just sends me back to the "start game" screen. The same happens every time.

I should note that the redroid project is in its early stages and there are some (rather important) parts that are not yet implemented, like the entire audio hardware abstraction layer... (yes, there is no audio). Or that the input (keyboard, mouse) events are cloned to android (double mouse cursor and blindly pressing keys on android if you're using it on linux while not looking at the android screen...). Still, I think it's an interesting experiment and wanted to share my results.

If anyone has any suggestion, please share it and I'll try it when possible.

@ghost
Copy link

ghost commented Jun 8, 2021 via email

@azteca1998
Copy link

What I wanted suggestions on was the black screen and loading times.

The speed should be the same for my phone and my computer since they are connected to the same place, one by wifi and the other by cable, so that's most likely not the issue. I could try the speed test but imho it's probably pointless. Besides, trying to get pip on an android shell is not worth anyone's time, and the browser will probably run the x86_64 version instead of the arm one, so that issue should not be present. I think that the fact that on my phone is at least 10 times faster than with ndk_translation proves it's most likely ndk_translation's fault.

If you're still curious about the speed, point me to a speed testing app that uses native libraries and has no x86 version, and I'll test it for you (but it'll probably work a lot better since the game probably does some processing in realtime, like data decompression or something).

@ghost
Copy link

ghost commented Jun 12, 2021

Maybe the black screen is caused by genshin not being able to render anything fast enough + network not being fast enough to ping genshin servers? Try wiresharking too?

@Quackdoc
Copy link

Quackdoc commented Jun 14, 2021

I completely had a braindead moment, has anyone tried using android emulator with cuttlefish? it could be much more performant than virgl. and I tried it a long time ago now with older apps, and had decent performance with it. you can enable it in the official android emulator via the command at the bottom. I cannot test it, but if someone is willing to, it could be an avenue forward.

Not to mention a lot of time will be needed before virgl gets remotely acceptable performance. due the the architecture of virgl (It translates Guest calls into Gallium3D calls, transports them back to host, and converts gallium calls into opengl calls, so its not very efficient at the moment,) and Venus will be vulkan only for a short bit, until the either gallium3D calls get translated to vulkan under virgl renderer, or someone implements zink into android to use Venus.

In either case the same thing is more or less happening which is opengl -> gallium3d -> vulkan, its just a matter of how (or rather when) it is implemented. but in any case, I wouldn't assume it a to be something that would happen soon

So GFXstream, or Cuttlefish is probably the best short term solution.

launch_cvd --gpu_mode=gfxstream

EDIT: I should note, cuttlefish is not really android emulator, but the specifics are here
https://android.googlesource.com/device/google/cuttlefish/

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

No branches or pull requests

5 participants