-
Notifications
You must be signed in to change notification settings - Fork 58
Add QEMU #53
Comments
Huge plus for that, it would be really good to use also QEMU. |
I'm currently working on this, you can watch my progress on the qemu branch. I've got the setup GUI (the one when you start the game) working with QEMU, I've only tested it on Linux yet though and I will test it using Windows later on (before publishing the version). The rest of the implementation should be incredibly simple, just connect to the screen using VNC and get a feed in VMRunnable, create VHDs using the qemu command, start the VM by creating a long command, stop it by just killing the process, maybe I can detect if it's manually shut down if the process stops on it's own, and it should be all set by then. |
I know that QEMU has multiple architectures, which ones are you going to support? |
x86_64 and i386 (normal 64-bit and 32-bit architectures) |
I wonder if the implementation of a real VNC client for the ingame screen means that it will be able to connect to any remote stream over the network (not only on the local PC). If so, would it be possible for the server running the game to also be running many VMs with Vbox or Qemu/KVM, all managed by this mod through APIs like libvirt in case of Qemu and Vbox API? |
That would be awesome if @Delta2Force is able to do that, and it could also kinda help with #3 |
Theoretically, yes! It would be a really cool idea. For it to work cables would have to be added first though, so different PCs can have different screens and such. |
https://blogs.oracle.com/vaibhav/listing-java-process-from-java |
Ok, currently the input is a bit weird. I don't have a clue how to solve it other than maybe using a different VNC library. You can try it out by compiling the qemu branch. |
I have tried building and using Qemu, i think it works, but it seems i have no display , and no way to know which port are used for vnc (or even if vnc is working) |
|
I tried using vnc viewer with this ip:port and it worked! Though, it's quite slow, even Arch iso was loading like 5 mins, which is really slow. I shared 8 gigs of ram and cpu divided by two (6 threads), usually it starts in less than 1 min in VirtualManager (qemu). Input from game crashes my game btw. Log |
I did some research and coding about this implementation and found some things:
Sadly, i haven't found any java vnc library except ones that uses C mappings (JNA) |
Added kvm as default option (TODO to check if KVM enabled for OS) Changed graphics adapter to Virtio from std (TODO to check if virtio presented in system, if not - fallback to std) Added lower-case latin keys for sending to VNC (Althrough, caps lock should be sent and be used, it's not always working for some reason)
Fixed issue when input was weird after unfocusing and focusing again (timer-based input disabler) Synchronized blocks on keys list to prevent concurrent modifications, task scheduler for key inputs Serious fixes for Delta2Force#53 issue, but not all. TODO: black screens every rejoin (have to replace each to see new image) and repeat keys on input.
Basically issue with input was: unfocusing from screen caused keys about unpressing not to be added to vnc keys scheduler. |
Can you do a pull request on here with your changes? |
I wasn't sure about making pull request since it's not all fixes, but if you said about it, then sure i will make it. |
Generally speaking, there is a need a centralized handling for all input, no matter from where. Else somewhere you would handle input using GLFW directly in one render frame, and in other you would process it using mixin, this causes issues, as you can see with GuiFocus and VMRunnable. |
I did some fixes and changes, but i found other bugs... |
I just noticed this:
Does it still start the VM if KVM is disabled or it's launched using Windows? |
I don't have Windows right now, and it probably won't start without KVM. |
Currently the QEMU to display output and input handling is very slow and there's always a chance for freezed screen. |
Anybody say Cables? #37 |
You can use Intel HAXM with QEMU on Windows to greatly improve performance (Intel processors only, I'm pretty sure AMD has something similar too, but the mod would have to recognize if the CPU is Intel or AMD and use the correct driver) Edit: I did a quick Google search and I couldn't find AMD's equalivent to Intel HAXM driver (Android studio has their own driver but I don't think that would work). You can still use HAXM on Intel processors but for AMD you should either stick with VirtualBox or add Hyper-V support (#144 ) Edit 2: I just found out you can use Hyper-V with QEMU on Windows using the |
I have a new idea about doing qemu alltogether: what about turning QEMU into a JNI library and just calling all the functions directly within the mod? I'm looking into this right now, but it should be possible. |
isn't this gonna be kinda madness taking care of such huge thing as making qemu adapter for JNI? |
@Delta2Force I may have found something that could help: |
QEMU can be accessed using a VNC server, which shouldn't be too hard to implement. QEMU exists for all platforms, so it should work pretty well. I would add an option at the start to use VirtualBox or QEMU.
The text was updated successfully, but these errors were encountered: