WE HAVE A POINTER

Turns out there IS pointer handling in the library, only the wrapper generator isn't prepared for pointers
In the end, all I did was editing the generated source file from byte[] to long[]
This commit is contained in:
Norbi Peti 2018-09-21 00:43:50 +02:00
parent 5dd5546dc1
commit 2ccf1d976e
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
3 changed files with 24 additions and 22 deletions

Binary file not shown.

View file

@ -97,8 +97,10 @@ public class MCFrameBuffer implements IFramebuffer {
* return; // Don't even try to render too large resolutions } * return; // Don't even try to render too large resolutions }
*/ */
tt = Bukkit.getScheduler().runTaskLaterAsynchronously(PluginMain.Instance, () -> { tt = Bukkit.getScheduler().runTaskLaterAsynchronously(PluginMain.Instance, () -> {
try {
display.querySourceBitmap(0L, holder); display.querySourceBitmap(0L, holder);
byte[] arr = PluginMain.allpixels.array(); //byte[] arr = PluginMain.allpixels.array();
long[] arr = new long[1];
long[] w = new long[1], h = new long[1], bpp = new long[1], bpl = new long[1], pf = new long[1]; long[] w = new long[1], h = new long[1], bpp = new long[1], bpl = new long[1], pf = new long[1];
holder.value.getTypedWrapped().queryBitmapInfo(arr, w, h, bpp, bpl, pf); holder.value.getTypedWrapped().queryBitmapInfo(arr, w, h, bpp, bpl, pf);
System.out.println("Arr0:" + arr[0]); System.out.println("Arr0:" + arr[0]);
@ -113,6 +115,9 @@ public class MCFrameBuffer implements IFramebuffer {
else if (r instanceof DirectRenderer) else if (r instanceof DirectRenderer)
((DirectRenderer) r).render(PluginMain.allpixels, xOrigin, yOrigin, width, height); ((DirectRenderer) r).render(PluginMain.allpixels, xOrigin, yOrigin, width, height);
System.out.println("Change!"); System.out.println("Change!");
} catch (Throwable t) {
t.printStackTrace();
}
}, 5); // Wait 1/4th of a second }, 5); // Wait 1/4th of a second
} }
@ -126,7 +131,6 @@ public class MCFrameBuffer implements IFramebuffer {
((DirectRenderer) r).render(PluginMain.allpixels, x, y, width, height); ((DirectRenderer) r).render(PluginMain.allpixels, x, y, width, height);
System.out.println("Update!"); System.out.println("Update!");
}, 5);*/ }, 5);*/
throw new UnsupportedOperationException("Use UpdateImage");
} }
@Override @Override
@ -135,11 +139,11 @@ public class MCFrameBuffer implements IFramebuffer {
} }
@Override @Override
public void processVHWACommand(byte arg0) { public void setVisibleRegion(byte arg0, long arg1) {
} }
@Override @Override
public void setVisibleRegion(byte arg0, long arg1) { public void processVHWACommand(byte b, int i, boolean b1) {
} }
@Override @Override

View file

@ -1,7 +1,6 @@
package sznp.virtualcomputer; package sznp.virtualcomputer;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.sun.jna.Memory;
import com.sun.jna.Pointer; import com.sun.jna.Pointer;
import jnr.ffi.LibraryLoader; import jnr.ffi.LibraryLoader;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -10,7 +9,6 @@ import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
import org.virtualbox_5_2.*; import org.virtualbox_5_2.*;
import sun.misc.Unsafe;
import java.io.File; import java.io.File;
import java.lang.reflect.Field; import java.lang.reflect.Field;