Progress error reporting on start fail
This commit is contained in:
parent
bc88724847
commit
8fbf044530
4 changed files with 35 additions and 9 deletions
10
README.md
10
README.md
|
@ -17,15 +17,17 @@ A working modern computer in Minecraft made using VirtualBox and Java. No client
|
|||
|
||||
* OS X; Ubuntu 16.04/18.04
|
||||
* VirtualBox 6.0
|
||||
* Spgiot/Bukkit 1.8/1.9/1.12
|
||||
* Spgiot/Bukkit 1.12
|
||||
* Java 8
|
||||
|
||||
*The fast rendering method currently only supports 1.12.2.*
|
||||
|
||||
### Tested on:
|
||||
*The requirements vary greatly depending on what OS you want to run ingame but here are my specs that can run Overwatch in Minecraft.*
|
||||
|
||||
* CPU: Intel 3.5 GHz
|
||||
* CPU: Intel® Pentium(R) CPU G3460 @ 3.50GHz × 2
|
||||
* RAM: 8 GB
|
||||
* GPU: NVidia GeForce GTX 650
|
||||
* GPU: NVidia GeForce GTX 650 1 GB
|
||||
|
||||
*Due to VirtualBox Java binding support limitations the plugin does not support Windows currently.*
|
||||
|
||||
|
@ -74,7 +76,7 @@ Due to the way it works, it automatically plays every sound from the virtual mac
|
|||
|
||||
### Special thanks:
|
||||
* The creators of VirtualBox for making it open-source and kind of easy to use (though I had minor issues as the documentation doesn't really tell me how to write a new frontend :P and that I needed to learn how machines work - especially keyboards)
|
||||
* @iiegit for testing and more testing for the non-Windows version
|
||||
* @iiegit for testing and more testing for the non-Windows version and helping a lot to get it on /r/sequence
|
||||
|
||||
# Known issues
|
||||
## Port remains open (cannot bind to port)
|
||||
|
|
1
VirtualComputer/lombok.config
Normal file
1
VirtualComputer/lombok.config
Normal file
|
@ -0,0 +1 @@
|
|||
lombok.var.flagUsage = ALLOW
|
|
@ -79,6 +79,7 @@ public final class Computer {
|
|||
handler = new MachineEventHandler(Computer.this, sender);
|
||||
listener = handler.registerTo(console.getEventSource());
|
||||
IProgress progress = console.powerUp(); // https://marc.info/?l=vbox-dev&m=142780789819967&w=2
|
||||
handler.setProgress(progress);
|
||||
handler.registerTo(progress.getEventSource()); //TODO: Show progress bar some way?
|
||||
console.getDisplay().attachFramebuffer(0L,
|
||||
new IFramebuffer(new MCFrameBuffer(console.getDisplay(), true)));
|
||||
|
@ -199,6 +200,8 @@ public final class Computer {
|
|||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
if (session.getState() == SessionState.Locked) {
|
||||
session.unlockMachine(); //Needs to be outside of the event handler
|
||||
handler = null;
|
||||
machine = null;
|
||||
}
|
||||
});
|
||||
GPURendererInternal.setPixels(new byte[1], 0, 0); //Black screen
|
||||
|
|
|
@ -1,21 +1,29 @@
|
|||
package sznp.virtualcomputer.events;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.var;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.virtualbox_6_0.IProgressTaskCompletedEvent;
|
||||
import org.virtualbox_6_0.IProgress;
|
||||
import org.virtualbox_6_0.IStateChangedEvent;
|
||||
import org.virtualbox_6_0.VBoxEventType;
|
||||
import sznp.virtualcomputer.Computer;
|
||||
import sznp.virtualcomputer.PluginMain;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class MachineEventHandler extends EventHandlerBase {
|
||||
private final Computer computer;
|
||||
private final CommandSender sender;
|
||||
private boolean starting = false;
|
||||
@Setter
|
||||
private IProgress progress;
|
||||
|
||||
public MachineEventHandler(Computer computer, CommandSender sender) {
|
||||
super(ImmutableMap.of(VBoxEventType.OnStateChanged, IStateChangedEvent.class,
|
||||
VBoxEventType.OnProgressTaskCompleted, IProgressTaskCompletedEvent.class));
|
||||
super(ImmutableMap.of(VBoxEventType.OnStateChanged, IStateChangedEvent.class));
|
||||
//VBoxEventType.OnProgressPercentageChanged, IProgressPercentageChangedEvent.class)); - Doesn't fire at all, the complete event only fires on success
|
||||
this.computer = computer;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
@ -32,6 +40,18 @@ public class MachineEventHandler extends EventHandlerBase {
|
|||
sender.sendMessage("§cFailed to start computer! See the VM's log for more details.");
|
||||
sender.sendMessage("§cMake sure that 2D and 3D acceleration is disabled.");
|
||||
starting = false;
|
||||
Bukkit.getScheduler().runTaskAsynchronously(PluginMain.Instance, () -> {
|
||||
progress.waitForCompletion(-1);
|
||||
if (progress != null && progress.getCompleted() && progress.getResultCode() != 0) {
|
||||
Logger l = PluginMain.Instance.getLogger();
|
||||
l.warning("Result code: " + Integer.toHexString(progress.getResultCode()));
|
||||
for (var info = progress.getErrorInfo(); info != null; info = info.getNext()) {
|
||||
l.warning("----------------");
|
||||
l.warning("VBox: " + info.getText());
|
||||
l.warning("Component: " + info.getComponent());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
computer.onMachineStop(sender);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue