Some fixes

It compiles for sure
This commit is contained in:
Norbi Peti 2019-05-18 02:29:10 +02:00
parent 751cc5eb92
commit 6de24a2742
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
5 changed files with 44 additions and 26 deletions

View file

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <parent>
<artifactId>VirtualComputer</artifactId>
<groupId>io.github.NorbiPeti</groupId> <groupId>io.github.NorbiPeti</groupId>
<version>2.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>VirtualComputer-Core</artifactId> <artifactId>VirtualComputer-Core</artifactId>
<version>2.1-SNAPSHOT</version> <version>2.1-SNAPSHOT</version>
<build> <build>
@ -50,6 +54,7 @@
<artifactSet> <artifactSet>
<excludes> <excludes>
<exclude>org.virtualbox:VirtualBox-MSCOM</exclude> <exclude>org.virtualbox:VirtualBox-MSCOM</exclude>
<exclude>sznp.virtualcomputer:VirtualComputer-MSCOM</exclude>
</excludes> </excludes>
</artifactSet> </artifactSet>
</configuration> </configuration>
@ -75,6 +80,7 @@
<artifactSet> <artifactSet>
<excludes> <excludes>
<exclude>org.virtualbox:VirtualBox</exclude> <exclude>org.virtualbox:VirtualBox</exclude>
<exclude>sznp.virtualcomputer:VirtualComputer-XPCOM</exclude>
</excludes> </excludes>
</artifactSet> </artifactSet>
</configuration> </configuration>
@ -85,17 +91,31 @@
</build> </build>
</profile> </profile>
</profiles> </profiles>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>repo</id>
<url>file://${basedir}/repo</url>
</repository>
</repositories>
<dependencies> <dependencies>
<dependency>
<groupId>org.virtualbox</groupId>
<artifactId>VirtualBox-MSCOM</artifactId>
<version>6.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>sznp.virtualcomputer</groupId>
<artifactId>VirtualComputer-MSCOM</artifactId>
<version>2.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>hamcrest-core</artifactId>
<groupId>org.hamcrest</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
@ -128,12 +148,6 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.virtualbox</groupId>
<artifactId>VirtualBox-MSCOM</artifactId>
<version>6.0</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View file

@ -77,7 +77,7 @@
<artifactSet> <artifactSet>
<excludes> <excludes>
<exclude>org.virtualbox:VirtualBox-MSCOM</exclude> <exclude>org.virtualbox:VirtualBox-MSCOM</exclude>
<exclude>sznp.virtualcomputer.VirtualComputer-MSCOM</exclude> <exclude>sznp.virtualcomputer:VirtualComputer-MSCOM</exclude>
</excludes> </excludes>
</artifactSet> </artifactSet>
</configuration> </configuration>
@ -103,7 +103,7 @@
<artifactSet> <artifactSet>
<excludes> <excludes>
<exclude>org.virtualbox:VirtualBox</exclude> <exclude>org.virtualbox:VirtualBox</exclude>
<exclude>sznp.virtualcomputer.VirtualComputer-XPCOM</exclude> <exclude>sznp.virtualcomputer:VirtualComputer-XPCOM</exclude>
</excludes> </excludes>
</artifactSet> </artifactSet>
</configuration> </configuration>

View file

@ -9,6 +9,7 @@ import org.virtualbox_6_0.*;
import sznp.virtualcomputer.events.MachineEventHandler; import sznp.virtualcomputer.events.MachineEventHandler;
import sznp.virtualcomputer.events.VBoxEventHandler; import sznp.virtualcomputer.events.VBoxEventHandler;
import sznp.virtualcomputer.renderer.GPURenderer; import sznp.virtualcomputer.renderer.GPURenderer;
import sznp.virtualcomputer.renderer.MCFrameBuffer;
import sznp.virtualcomputer.util.COMUtils; import sznp.virtualcomputer.util.COMUtils;
import sznp.virtualcomputer.util.Scancode; import sznp.virtualcomputer.util.Scancode;
@ -86,7 +87,7 @@ public final class Computer {
handler.setProgress(progress); handler.setProgress(progress);
handler.registerTo(progress.getEventSource()); //TODO: Show progress bar some way? handler.registerTo(progress.getEventSource()); //TODO: Show progress bar some way?
console.getDisplay().attachFramebuffer(0L, 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) { private void sendMessage(@Nullable CommandSender sender, String message) {

View file

@ -9,6 +9,7 @@ import org.virtualbox_6_0.IDisplay;
import org.virtualbox_6_0.IDisplaySourceBitmap; import org.virtualbox_6_0.IDisplaySourceBitmap;
import org.virtualbox_6_0.VBoxException; import org.virtualbox_6_0.VBoxException;
import sznp.virtualcomputer.PluginMain; import sznp.virtualcomputer.PluginMain;
import sznp.virtualcomputer.util.COMUtils;
import sznp.virtualcomputer.util.IMCFrameBuffer; import sznp.virtualcomputer.util.IMCFrameBuffer;
import sznp.virtualcomputer.util.Timing; import sznp.virtualcomputer.util.Timing;
@ -29,7 +30,7 @@ public class MCFrameBuffer implements IMCFrameBuffer {
try { try {
display.querySourceBitmap(0L, holder); 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]; 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) { if (PluginMain.direct) {
pointer = new Pointer(ptr[0]); pointer = new Pointer(ptr[0]);
this.width = (int) w[0]; this.width = (int) w[0];

View file

@ -1,11 +1,9 @@
package sznp.virtualcomputer.util; package sznp.virtualcomputer.util;
import lombok.val; import lombok.val;
import org.virtualbox_6_0.IEvent; import org.virtualbox_6_0.*;
import org.virtualbox_6_0.IEventSource;
import org.virtualbox_6_0.IFramebuffer;
import org.virtualbox_6_0.VBoxEventType;
import org.virtualbox_6_0.xpcom.IUnknown; import org.virtualbox_6_0.xpcom.IUnknown;
import sznp.virtualcomputer.COMFrameBuffer;
import sznp.virtualcomputer.EventHandler; import sznp.virtualcomputer.EventHandler;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
@ -34,6 +32,10 @@ public final class COMUtils {
} }
public static IFramebuffer gimmeAFramebuffer(IMCFrameBuffer frameBuffer) { 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);
} }
} }