From 11de7527325f460f45c63c11a8f250f8f6a1f44f Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Wed, 6 Mar 2019 13:36:03 +0100 Subject: [PATCH] Readme update & testing Aparapi --- README.md | 10 +++++++-- VirtualComputer/pom.xml | 5 +++++ .../src/sznp/virtualcomputer/Test.java | 22 +++++++++++++++++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6e00892..6bac8ee 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,12 @@ I plan on making a series where I show the whole process of creating this projec *If you don't meet these requirements, you may need to compile the files for yourself. If you do please send the compiled version to me so more people can download it.* * OS X; Ubuntu 16.04/18.04 -* VirtualBox 5.2 +* VirtualBox 6.0 * Spgiot/Bukkit 1.8/1.9/1.12 * Java 8 ### Untested: -* Any Linux versions +* Other Linux versions * Other VirtualBox versions (code modifications are probably necessary) * Other Spigot/Bukkit versions * Other Java versions @@ -66,3 +66,9 @@ 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 + +# Known issues +## Port remains open (cannot bind to port) +**Fix:** Close all VirtualBox instances and wait 10 seconds. + +**Cause:** Possibly it happens because the plugin creates the VBoxSVC process, which thus inherits file descriptors such as the open server port. diff --git a/VirtualComputer/pom.xml b/VirtualComputer/pom.xml index 53187c5..cb1f018 100644 --- a/VirtualComputer/pom.xml +++ b/VirtualComputer/pom.xml @@ -87,5 +87,10 @@ jnr-ffi 2.1.7 + + com.aparapi + aparapi + 1.10.0 + \ No newline at end of file diff --git a/VirtualComputer/src/sznp/virtualcomputer/Test.java b/VirtualComputer/src/sznp/virtualcomputer/Test.java index 28ce9de..80a6e80 100644 --- a/VirtualComputer/src/sznp/virtualcomputer/Test.java +++ b/VirtualComputer/src/sznp/virtualcomputer/Test.java @@ -1,19 +1,37 @@ package sznp.virtualcomputer; +import com.aparapi.Kernel; +import com.aparapi.Range; import com.sun.jna.Native; import com.sun.jna.Pointer; import jnr.ffi.LibraryLoader; import java.io.File; import java.nio.ByteBuffer; +import java.util.Arrays; public class Test { public static void main(String[] args) { - System.out.println(new File("").getAbsolutePath()); + /*System.out.println(new File("").getAbsolutePath()); PXCLib pxc = LibraryLoader.create(PXCLib.class).search(new File("").getAbsolutePath()).load("pxc"); ByteBuffer bb = ByteBuffer.allocateDirect(2); long[] x = new long[]{Pointer.nativeValue(Native.getDirectBufferPointer(bb))}; pxc.convert(new int[]{5, 10}, x); - System.out.println(bb.get(0)); //19 AYY //TO!DO: Use setSource, we don't want to wrap the native array + System.out.println(bb.get(0)); //19 AYY //TO!DO: Use setSource, we don't want to wrap the native array*/ + //final int[] a={5,6,8,2,3,10,5,26,5,416,41,85,416,41}; + //final int[] b={10,80,10,3,32,20,56,85,51,968,156,5894,10,60,52}; + final int[] a={5,6}; + final int[] b={10,80}; + final int[] res=new int[a.length]; + Kernel kernel=new Kernel() { + @Override + public void run() { + int i=getGlobalId(); + //System.out.println(i); + res[i]=a[i]+b[i]; + } + }; + kernel.execute(Range.create(res.length)); + System.out.println(Arrays.toString(res)); } }