From 6de24a2742ebe2fc28365382dd95d703e2648bfc Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sat, 18 May 2019 02:29:10 +0200 Subject: [PATCH] Some fixes It compiles for sure --- .../dependency-reduced-pom.xml | 48 ++++++++++++------- VirtualComputer-Core/pom.xml | 4 +- .../java/sznp/virtualcomputer/Computer.java | 3 +- .../renderer/MCFrameBuffer.java | 3 +- .../sznp/virtualcomputer/util/COMUtils.java | 12 +++-- 5 files changed, 44 insertions(+), 26 deletions(-) diff --git a/VirtualComputer-Core/dependency-reduced-pom.xml b/VirtualComputer-Core/dependency-reduced-pom.xml index 3a2283f..e42fa8a 100644 --- a/VirtualComputer-Core/dependency-reduced-pom.xml +++ b/VirtualComputer-Core/dependency-reduced-pom.xml @@ -1,8 +1,12 @@ - 4.0.0 + + VirtualComputer io.github.NorbiPeti + 2.1-SNAPSHOT + + 4.0.0 VirtualComputer-Core 2.1-SNAPSHOT @@ -50,6 +54,7 @@ org.virtualbox:VirtualBox-MSCOM + sznp.virtualcomputer:VirtualComputer-MSCOM @@ -75,6 +80,7 @@ org.virtualbox:VirtualBox + sznp.virtualcomputer:VirtualComputer-XPCOM @@ -85,17 +91,31 @@ - - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - - - repo - file://${basedir}/repo - - + + org.virtualbox + VirtualBox-MSCOM + 6.0 + compile + + + sznp.virtualcomputer + VirtualComputer-MSCOM + 2.1-SNAPSHOT + compile + + + junit + junit + 4.11 + test + + + hamcrest-core + org.hamcrest + + + org.spigotmc spigot-api @@ -128,12 +148,6 @@ - - org.virtualbox - VirtualBox-MSCOM - 6.0 - compile - diff --git a/VirtualComputer-Core/pom.xml b/VirtualComputer-Core/pom.xml index 7cb7c1a..f55b3cd 100644 --- a/VirtualComputer-Core/pom.xml +++ b/VirtualComputer-Core/pom.xml @@ -77,7 +77,7 @@ org.virtualbox:VirtualBox-MSCOM - sznp.virtualcomputer.VirtualComputer-MSCOM + sznp.virtualcomputer:VirtualComputer-MSCOM @@ -103,7 +103,7 @@ org.virtualbox:VirtualBox - sznp.virtualcomputer.VirtualComputer-XPCOM + sznp.virtualcomputer:VirtualComputer-XPCOM diff --git a/VirtualComputer-Core/src/main/java/sznp/virtualcomputer/Computer.java b/VirtualComputer-Core/src/main/java/sznp/virtualcomputer/Computer.java index 4bf50f9..21eade2 100644 --- a/VirtualComputer-Core/src/main/java/sznp/virtualcomputer/Computer.java +++ b/VirtualComputer-Core/src/main/java/sznp/virtualcomputer/Computer.java @@ -9,6 +9,7 @@ import org.virtualbox_6_0.*; import sznp.virtualcomputer.events.MachineEventHandler; import sznp.virtualcomputer.events.VBoxEventHandler; import sznp.virtualcomputer.renderer.GPURenderer; +import sznp.virtualcomputer.renderer.MCFrameBuffer; import sznp.virtualcomputer.util.COMUtils; import sznp.virtualcomputer.util.Scancode; @@ -86,7 +87,7 @@ public final class Computer { handler.setProgress(progress); handler.registerTo(progress.getEventSource()); //TODO: Show progress bar some way? console.getDisplay().attachFramebuffer(0L, - COMUtils.gimmeAFramebuffer(new COMFrameBuffer(console.getDisplay(), true))); + COMUtils.gimmeAFramebuffer(new MCFrameBuffer(console.getDisplay()))); } private void sendMessage(@Nullable CommandSender sender, String message) { diff --git a/VirtualComputer-Core/src/main/java/sznp/virtualcomputer/renderer/MCFrameBuffer.java b/VirtualComputer-Core/src/main/java/sznp/virtualcomputer/renderer/MCFrameBuffer.java index 353e035..3589d47 100644 --- a/VirtualComputer-Core/src/main/java/sznp/virtualcomputer/renderer/MCFrameBuffer.java +++ b/VirtualComputer-Core/src/main/java/sznp/virtualcomputer/renderer/MCFrameBuffer.java @@ -9,6 +9,7 @@ import org.virtualbox_6_0.IDisplay; import org.virtualbox_6_0.IDisplaySourceBitmap; import org.virtualbox_6_0.VBoxException; import sznp.virtualcomputer.PluginMain; +import sznp.virtualcomputer.util.COMUtils; import sznp.virtualcomputer.util.IMCFrameBuffer; import sznp.virtualcomputer.util.Timing; @@ -29,7 +30,7 @@ public class MCFrameBuffer implements IMCFrameBuffer { try { display.querySourceBitmap(0L, holder); long[] ptr = new long[1], w = new long[1], h = new long[1], bpp = new long[1], bpl = new long[1], pf = new long[1]; - holder.value.getTypedWrapped().queryBitmapInfo(ptr, w, h, bpp, bpl, pf); + COMUtils.queryBitmapInfo(holder.value, ptr, w, h, bpp, bpl, pf); if (PluginMain.direct) { pointer = new Pointer(ptr[0]); this.width = (int) w[0]; diff --git a/VirtualComputerXPCOM/src/main/java/sznp/virtualcomputer/util/COMUtils.java b/VirtualComputerXPCOM/src/main/java/sznp/virtualcomputer/util/COMUtils.java index f2570df..266004f 100644 --- a/VirtualComputerXPCOM/src/main/java/sznp/virtualcomputer/util/COMUtils.java +++ b/VirtualComputerXPCOM/src/main/java/sznp/virtualcomputer/util/COMUtils.java @@ -1,11 +1,9 @@ package sznp.virtualcomputer.util; import lombok.val; -import org.virtualbox_6_0.IEvent; -import org.virtualbox_6_0.IEventSource; -import org.virtualbox_6_0.IFramebuffer; -import org.virtualbox_6_0.VBoxEventType; +import org.virtualbox_6_0.*; import org.virtualbox_6_0.xpcom.IUnknown; +import sznp.virtualcomputer.COMFrameBuffer; import sznp.virtualcomputer.EventHandler; import java.lang.reflect.InvocationTargetException; @@ -34,6 +32,10 @@ public final class COMUtils { } public static IFramebuffer gimmeAFramebuffer(IMCFrameBuffer frameBuffer) { - return new IFramebuffer(frameBuffer); //TODO + return new IFramebuffer(new COMFrameBuffer(frameBuffer)); + } + + public static void queryBitmapInfo(IDisplaySourceBitmap bitmap, long[] ptr, long[] w, long[] h, long[] bpp, long[] bpl, long[] pf) { + bitmap.getTypedWrapped().queryBitmapInfo(ptr, w, h, bpp, bpl, pf); } }