FIXED "Not supported" bug in VirtualBox

https://marc.info/?l=vbox-dev&m=142780789819967&w=2
(Must run as sudo currently)
Some other fixes related to rendering
This commit is contained in:
Norbi Peti 2017-12-21 22:23:23 +01:00
parent e16b1cbccf
commit 5d6b705299
6 changed files with 21 additions and 20 deletions

View file

@ -40,11 +40,6 @@
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>org.virtualbox:VirtualBox</include>
</includes>
</artifactSet>
<pluginExecution>
<action>
<execute />
@ -105,12 +100,6 @@
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>4.4.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View file

@ -41,11 +41,6 @@
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>org.virtualbox:VirtualBox</include>
</includes>
</artifactSet>
<pluginExecution>
<action>
<execute />
@ -91,6 +86,11 @@
<artifactId>jna</artifactId>
<version>4.4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.jnr/jnr-ffi -->
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-ffi</artifactId>
<version>2.1.7</version>
</dependency>
</dependencies>
</project>

View file

@ -63,7 +63,8 @@ public class DirectRenderer implements IRenderer {
wmap.flagDirty(0, 0);
wmap.flagDirty(128, 128); // Send the whole image - TODO: Only send changes
} catch (Exception e) {
if (ex != null && e.getMessage().equals(ex.getMessage()))
if (ex != null && (e.getMessage() == ex.getMessage()
|| (e.getMessage() != null && e.getMessage().equals(ex.getMessage()))))
return;
(ex = e).printStackTrace();
}

View file

@ -9,7 +9,7 @@ import org.virtualbox_5_2.*;
public class MCFrameBuffer implements IFramebuffer {
private IDisplay display;
private Holder<IDisplaySourceBitmap> holder;
private Holder<IDisplaySourceBitmap> holder = new Holder<>();
public MCFrameBuffer(IDisplay display) {
this.display = display;

View file

@ -11,10 +11,14 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import org.mozilla.xpcom.Mozilla;
import org.mozilla.xpcom.internal.XPCOMImpl;
import org.virtualbox_5_2.*;
import com.google.common.collect.Lists;
import jnr.ffi.LibraryLoader;
public class PluginMain extends JavaPlugin {
private IVirtualBox vbox;
private ISession session;
@ -49,6 +53,8 @@ public class PluginMain extends JavaPlugin {
System.setProperty("java.library.path", vbpath);
addLibraryPath(vbpath);
final VirtualBoxManager manager = VirtualBoxManager.createInstance(getDataFolder().getAbsolutePath());
VBoxLib vbl = LibraryLoader.create(VBoxLib.class).load(vbpath + "/libvboxjxpcom.so");
vbl.RTR3InitExe(0, "", 0);
vbox = manager.getVBox();
session = manager.getSessionObject(); // TODO: Events
ccs.sendMessage("§bLoading Screen...");
@ -104,7 +110,7 @@ public class PluginMain extends JavaPlugin {
sender.sendMessage("B: " + machine.getState().toString());
final IConsole console = session.getConsole();
sender.sendMessage("1: " + console.getState().toString());
console.powerUp();
console.powerUp(); // https://marc.info/?l=vbox-dev&m=142780789819967&w=2
sender.sendMessage("2: " + console.getState().toString());
console.getDisplay().attachFramebuffer(0L,
new IFramebuffer(new MCFrameBuffer(console.getDisplay())));

View file

@ -0,0 +1,5 @@
package sznp.virtualcomputer;
public interface VBoxLib {
void RTR3InitExe(int argc, String argv, int somethingzero);
}