diff --git a/VirtualComputer/.classpath b/VirtualComputer/.classpath index be86bf9..5b4c3df 100644 --- a/VirtualComputer/.classpath +++ b/VirtualComputer/.classpath @@ -16,5 +16,6 @@ + diff --git a/VirtualComputer/repo/org/virtualbox/VirtualBox/5.1/VirtualBox-5.1-javadoc.jar b/VirtualComputer/repo/org/virtualbox/VirtualBox/5.1/VirtualBox-5.1-javadoc.jar new file mode 100644 index 0000000..4ea760b Binary files /dev/null and b/VirtualComputer/repo/org/virtualbox/VirtualBox/5.1/VirtualBox-5.1-javadoc.jar differ diff --git a/VirtualComputer/repo/org/virtualbox/VirtualBox/5.1/VirtualBox-5.1-sources.jar b/VirtualComputer/repo/org/virtualbox/VirtualBox/5.1/VirtualBox-5.1-sources.jar new file mode 100644 index 0000000..95c0d9c Binary files /dev/null and b/VirtualComputer/repo/org/virtualbox/VirtualBox/5.1/VirtualBox-5.1-sources.jar differ diff --git a/VirtualComputer/repo/org/virtualbox/VirtualBox/5.1/VirtualBox-5.1.jar b/VirtualComputer/repo/org/virtualbox/VirtualBox/5.1/VirtualBox-5.1.jar index b0bd4ee..cc9bd32 100644 Binary files a/VirtualComputer/repo/org/virtualbox/VirtualBox/5.1/VirtualBox-5.1.jar and b/VirtualComputer/repo/org/virtualbox/VirtualBox/5.1/VirtualBox-5.1.jar differ diff --git a/VirtualComputer/src/sznp/virtualcomputer/MCFrameBuffer.java b/VirtualComputer/src/sznp/virtualcomputer/MCFrameBuffer.java new file mode 100644 index 0000000..bc37d1b --- /dev/null +++ b/VirtualComputer/src/sznp/virtualcomputer/MCFrameBuffer.java @@ -0,0 +1,108 @@ +package sznp.virtualcomputer; + +import org.virtualbox_5_1.IFramebuffer; +import org.virtualbox_5_1.ObjectRefManager; +import org.virtualbox_5_1.jaxws.VboxPortType; + +public class MCFrameBuffer extends IFramebuffer { + + public MCFrameBuffer(String wrapped, ObjectRefManager objMgr, VboxPortType port) { + super(wrapped, objMgr, port); + // TODO Auto-generated constructor stub + } + + /*@Override + public nsISupports queryInterface(String arg0) { + return null; + } + + @Override + public long getBitsPerPixel() { + return 32; + } + + @Override + public long getBytesPerLine() { + return 640 * 4; + } + + @Override + public long[] getCapabilities(long[] arg0) { + return new long[] { FramebufferCapabilities.UpdateImage }; + } + + @Override + public long getHeight() { + return 480; + } + + @Override + public long getHeightReduction() { + return 0; + } + + @Override + public IFramebufferOverlay getOverlay() { + return null; + } + + @Override + public long getPixelFormat() { + return BitmapFormat.RGBA; + } + + private byte visibleRegionB; + private long visibleRegionL; + + @Override + public long getVisibleRegion(byte arg0, long arg1) { + System.out.println("Visible region get."); + return visibleRegionL; + } + + @Override + public long getWidth() { + return 640; + } + + @Override + public long getWinId() { + return 0; + } + + @Override + public void notify3DEvent(long arg0, byte[] arg1) { + } + + @Override + public void notifyChange(long arg0, long arg1, long arg2, long arg3, long arg4) { + } + + @Override + public void notifyUpdate(long arg0, long arg1, long arg2, long arg3) { + // TODO Auto-generated method stub + System.out.println("UPDATE"); + } + + @Override + public void notifyUpdateImage(long arg0, long arg1, long arg2, long arg3, byte[] arg4) { + // TODO Auto-generated method stub + System.out.println("UPDATE IMAGE"); + } + + @Override + public void processVHWACommand(byte arg0) { + } + + @Override + public void setVisibleRegion(byte arg0, long arg1) { + visibleRegionB = arg0; + visibleRegionL = arg1; + System.out.println("Visible region set."); + } + + @Override + public boolean videoModeSupported(long arg0, long arg1, long arg2) { + return true; // We support EVERYTHING + }*/ +} diff --git a/VirtualComputer/src/sznp/virtualcomputer/PluginMain.java b/VirtualComputer/src/sznp/virtualcomputer/PluginMain.java index 62ee38f..bb95b2b 100644 --- a/VirtualComputer/src/sznp/virtualcomputer/PluginMain.java +++ b/VirtualComputer/src/sznp/virtualcomputer/PluginMain.java @@ -14,6 +14,9 @@ import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitTask; +import org.mozilla.interfaces.IFramebufferOverlay; +import org.mozilla.interfaces.nsISupports; +import org.virtualbox_5_1.IFramebuffer; import org.virtualbox_5_1.ISession; import org.virtualbox_5_1.IVirtualBox; import org.virtualbox_5_1.VirtualBoxManager; @@ -36,9 +39,13 @@ public class PluginMain extends JavaPlugin { ConsoleCommandSender ccs = getServer().getConsoleSender(); this.getCommand("computer").setExecutor(new Commands()); ccs.sendMessage("§bInitializing VirtualBox..."); - final VirtualBoxManager manager = VirtualBoxManager.createInstance(null); + // Connect con = new Connect("vbox:///"); + final VirtualBoxManager manager = VirtualBoxManager.createInstance(getDataFolder().getAbsolutePath()); vbox = manager.getVBox(); session = manager.getSessionObject(); + vbox.getMachines().get(0).launchVMProcess(session, "headless", ""); + session.getConsole().getDisplay().attachFramebuffer(0L, new MCFrameBuffer()); + ccs.sendMessage("§bLoading SketchMap..."); img = new BufferedImage(640, 480, BufferedImage.TYPE_INT_ARGB); HashMap map = new HashMap<>(); diff --git a/VirtualComputer/vboxjws-doc.jar b/VirtualComputer/vboxjws-doc.jar new file mode 100644 index 0000000..4ea760b Binary files /dev/null and b/VirtualComputer/vboxjws-doc.jar differ diff --git a/VirtualComputer/vboxjws-src.jar b/VirtualComputer/vboxjws-src.jar new file mode 100644 index 0000000..95c0d9c Binary files /dev/null and b/VirtualComputer/vboxjws-src.jar differ diff --git a/VirtualComputer/vboxjws.jar b/VirtualComputer/vboxjws.jar new file mode 100644 index 0000000..cc9bd32 Binary files /dev/null and b/VirtualComputer/vboxjws.jar differ