-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathUIFFM.java
More file actions
142 lines (108 loc) · 10.1 KB
/
Copy pathUIFFM.java
File metadata and controls
142 lines (108 loc) · 10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package javaforce.ffm;
import java.lang.foreign.*;
import java.lang.invoke.*;
import static java.lang.foreign.ValueLayout.*;
import javaforce.*;
import javaforce.ffm.*;
import javaforce.api.*;
import javaforce.ui.*;
/** UIAPI FFM implementation.
*
* Generated by GenFFM - DO NOT EDIT
*/
public class UIFFM implements UIAPI {
private FFM ffm;
private static UIFFM instance;
public static synchronized UIFFM getInstance() {
if (instance == null) {
instance = new UIFFM();
if (!instance.ffm_init()) {
JFLog.log("UIFFM init failed!");
instance = null;
}
}
return instance;
}
private MethodHandle uiInit;
public boolean uiInit() { try { boolean _ret_value_ = (boolean)uiInit.invokeExact();return _ret_value_; } catch (Throwable t) { JFLog.log(t); return false;} }
private MethodHandle uiWindowGetFramebufferResized;
public boolean uiWindowGetFramebufferResized(long a1) { try { boolean _ret_value_ = (boolean)uiWindowGetFramebufferResized.invokeExact(a1);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return false;} }
private MethodHandle uiSaveJPG;
public byte[] uiSaveJPG(int[] a1,int a2,int a3,int a4) { try { Arena arena = Arena.ofAuto(); MemorySegment _array_a1 = FFM.toMemory(arena, a1);FFM.createFFMArray();uiSaveJPG.invokeExact(_array_a1,a2,a3,a4);FFM.copyBack(_array_a1,a1);return (byte[])FFM.getArray(); } catch (Throwable t) { JFLog.log(t); return null;} }
private MethodHandle uiSavePNG;
public byte[] uiSavePNG(int[] a1,int a2,int a3) { try { Arena arena = Arena.ofAuto(); MemorySegment _array_a1 = FFM.toMemory(arena, a1);FFM.createFFMArray();uiSavePNG.invokeExact(_array_a1,a2,a3);FFM.copyBack(_array_a1,a1);return (byte[])FFM.getArray(); } catch (Throwable t) { JFLog.log(t); return null;} }
private MethodHandle uiLoadFont;
public int uiLoadFont(byte[] a1,int a2,int[] a3,int[] a4,int[] a5,int[] a6,byte[] a7,int a8,int a9) { try { Arena arena = Arena.ofAuto(); MemorySegment _array_a1 = FFM.toMemory(arena, a1);MemorySegment _array_a3 = FFM.toMemory(arena, a3);MemorySegment _array_a4 = FFM.toMemory(arena, a4);MemorySegment _array_a5 = FFM.toMemory(arena, a5);MemorySegment _array_a6 = FFM.toMemory(arena, a6);MemorySegment _array_a7 = FFM.toMemory(arena, a7);int _ret_value_ = (int)uiLoadFont.invokeExact(_array_a1,a2,_array_a3,_array_a4,_array_a5,_array_a6,_array_a7,a8,a9);FFM.copyBack(_array_a1,a1);FFM.copyBack(_array_a3,a3);FFM.copyBack(_array_a4,a4);FFM.copyBack(_array_a5,a5);FFM.copyBack(_array_a6,a6);FFM.copyBack(_array_a7,a7);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return -1;} }
private MethodHandle uiLoadJPG;
public int[] uiLoadJPG(byte[] a1,int a2,int[] a3) { try { Arena arena = Arena.ofAuto(); MemorySegment _array_a1 = FFM.toMemory(arena, a1);MemorySegment _array_a3 = FFM.toMemory(arena, a3);FFM.createFFMArray();uiLoadJPG.invokeExact(_array_a1,a2,_array_a3);FFM.copyBack(_array_a1,a1);FFM.copyBack(_array_a3,a3);return (int[])FFM.getArray(); } catch (Throwable t) { JFLog.log(t); return null;} }
private MethodHandle uiLoadPNG;
public int[] uiLoadPNG(byte[] a1,int a2,int[] a3) { try { Arena arena = Arena.ofAuto(); MemorySegment _array_a1 = FFM.toMemory(arena, a1);MemorySegment _array_a3 = FFM.toMemory(arena, a3);FFM.createFFMArray();uiLoadPNG.invokeExact(_array_a1,a2,_array_a3);FFM.copyBack(_array_a1,a1);FFM.copyBack(_array_a3,a3);return (int[])FFM.getArray(); } catch (Throwable t) { JFLog.log(t); return null;} }
private MethodHandle uiWindowGetFramebufferSize;
public int[] uiWindowGetFramebufferSize(long a1) { try { FFM.createFFMArray();uiWindowGetFramebufferSize.invokeExact(a1);return (int[])FFM.getArray(); } catch (Throwable t) { JFLog.log(t); return null;} }
private MethodHandle uiWindowGetRequiredExtensions;
public java.lang.String[] uiWindowGetRequiredExtensions() { try { FFM.createFFMArray();uiWindowGetRequiredExtensions.invokeExact();return (java.lang.String[])FFM.getArray(); } catch (Throwable t) { JFLog.log(t); return null;} }
private MethodHandle uiWindowCreate;
public long uiWindowCreate(int a1,java.lang.String a2,int a3,int a4,long a5) { try { Arena arena = Arena.ofAuto(); long _ret_value_ = (long)uiWindowCreate.invokeExact(a1,(MemorySegment)(a2 == null ? MemorySegment.NULL : arena.allocateFrom(a2)),a3,a4,a5);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return -1;} }
private MethodHandle uiWindowCreateSurface;
public long uiWindowCreateSurface(long a1,long a2) { try { long _ret_value_ = (long)uiWindowCreateSurface.invokeExact(a1,a2);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return -1;} }
private MethodHandle uiPollEvents;
public void uiPollEvents(long a1,int a2,javaforce.ui.UIEvents a3) { try { FFM.setUIEvents(a3);uiPollEvents.invokeExact(a1,a2,FFM.upcall_UIEvents_dispatchEvent); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle uiPostEvent;
public void uiPostEvent() { try { uiPostEvent.invokeExact(); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle uiWindowDestroy;
public void uiWindowDestroy(long a1) { try { uiWindowDestroy.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle uiWindowGetPos;
public void uiWindowGetPos(long a1,int[] a2) { try { Arena arena = Arena.ofAuto(); MemorySegment _array_a2 = FFM.toMemory(arena, a2);uiWindowGetPos.invokeExact(a1,_array_a2);FFM.copyBack(_array_a2,a2); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle uiWindowHide;
public void uiWindowHide(long a1) { try { uiWindowHide.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle uiWindowHideCursor;
public void uiWindowHideCursor(long a1) { try { uiWindowHideCursor.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle uiWindowLockCursor;
public void uiWindowLockCursor(long a1) { try { uiWindowLockCursor.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle uiWindowSetCurrent;
public void uiWindowSetCurrent(long a1) { try { uiWindowSetCurrent.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle uiWindowSetIcon;
public void uiWindowSetIcon(long a1,java.lang.String a2,int a3,int a4) { try { Arena arena = Arena.ofAuto(); uiWindowSetIcon.invokeExact(a1,(MemorySegment)(a2 == null ? MemorySegment.NULL : arena.allocateFrom(a2)),a3,a4); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle uiWindowSetPos;
public void uiWindowSetPos(long a1,int a2,int a3) { try { uiWindowSetPos.invokeExact(a1,a2,a3); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle uiWindowShow;
public void uiWindowShow(long a1) { try { uiWindowShow.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle uiWindowShowCursor;
public void uiWindowShowCursor(long a1) { try { uiWindowShowCursor.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle uiWindowSwap;
public void uiWindowSwap(long a1) { try { uiWindowSwap.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private boolean ffm_init() {
if (FFM.debug) JFLog.log("UIFFM init started");
MethodHandle init;
ffm = FFM.getInstance();
init = ffm.getFunction("UIAPIinit", ffm.getFunctionDesciptor(ValueLayout.JAVA_BOOLEAN));
if (init == null) return false;
try {if (!(boolean)init.invokeExact()) return false;} catch (Throwable t) {JFLog.log(t); return false;}
uiInit = ffm.getFunctionPtr("_uiInit", ffm.getFunctionDesciptor(JAVA_BOOLEAN));
uiWindowGetFramebufferResized = ffm.getFunctionPtr("_uiWindowGetFramebufferResized", ffm.getFunctionDesciptor(JAVA_BOOLEAN,JAVA_LONG));
uiSaveJPG = ffm.getFunctionPtr("_uiSaveJPG", ffm.getFunctionDesciptorVoid(ADDRESS,JAVA_INT,JAVA_INT,JAVA_INT));
uiSavePNG = ffm.getFunctionPtr("_uiSavePNG", ffm.getFunctionDesciptorVoid(ADDRESS,JAVA_INT,JAVA_INT));
uiLoadFont = ffm.getFunctionPtr("_uiLoadFont", ffm.getFunctionDesciptor(JAVA_INT,ADDRESS,JAVA_INT,ADDRESS,ADDRESS,ADDRESS,ADDRESS,ADDRESS,JAVA_INT,JAVA_INT));
uiLoadJPG = ffm.getFunctionPtr("_uiLoadJPG", ffm.getFunctionDesciptorVoid(ADDRESS,JAVA_INT,ADDRESS));
uiLoadPNG = ffm.getFunctionPtr("_uiLoadPNG", ffm.getFunctionDesciptorVoid(ADDRESS,JAVA_INT,ADDRESS));
uiWindowGetFramebufferSize = ffm.getFunctionPtr("_uiWindowGetFramebufferSize", ffm.getFunctionDesciptorVoid(JAVA_LONG));
uiWindowGetRequiredExtensions = ffm.getFunctionPtr("_uiWindowGetRequiredExtensions", ffm.getFunctionDesciptorVoid());
uiWindowCreate = ffm.getFunctionPtr("_uiWindowCreate", ffm.getFunctionDesciptor(JAVA_LONG,JAVA_INT,ADDRESS,JAVA_INT,JAVA_INT,JAVA_LONG));
uiWindowCreateSurface = ffm.getFunctionPtr("_uiWindowCreateSurface", ffm.getFunctionDesciptor(JAVA_LONG,JAVA_LONG,JAVA_LONG));
uiPollEvents = ffm.getFunctionPtr("_uiPollEvents", ffm.getFunctionDesciptorVoid(JAVA_LONG,JAVA_INT,ADDRESS));
uiPostEvent = ffm.getFunctionPtr("_uiPostEvent", ffm.getFunctionDesciptorVoid());
uiWindowDestroy = ffm.getFunctionPtr("_uiWindowDestroy", ffm.getFunctionDesciptorVoid(JAVA_LONG));
uiWindowGetPos = ffm.getFunctionPtr("_uiWindowGetPos", ffm.getFunctionDesciptorVoid(JAVA_LONG,ADDRESS));
uiWindowHide = ffm.getFunctionPtr("_uiWindowHide", ffm.getFunctionDesciptorVoid(JAVA_LONG));
uiWindowHideCursor = ffm.getFunctionPtr("_uiWindowHideCursor", ffm.getFunctionDesciptorVoid(JAVA_LONG));
uiWindowLockCursor = ffm.getFunctionPtr("_uiWindowLockCursor", ffm.getFunctionDesciptorVoid(JAVA_LONG));
uiWindowSetCurrent = ffm.getFunctionPtr("_uiWindowSetCurrent", ffm.getFunctionDesciptorVoid(JAVA_LONG));
uiWindowSetIcon = ffm.getFunctionPtr("_uiWindowSetIcon", ffm.getFunctionDesciptorVoid(JAVA_LONG,ADDRESS,JAVA_INT,JAVA_INT));
uiWindowSetPos = ffm.getFunctionPtr("_uiWindowSetPos", ffm.getFunctionDesciptorVoid(JAVA_LONG,JAVA_INT,JAVA_INT));
uiWindowShow = ffm.getFunctionPtr("_uiWindowShow", ffm.getFunctionDesciptorVoid(JAVA_LONG));
uiWindowShowCursor = ffm.getFunctionPtr("_uiWindowShowCursor", ffm.getFunctionDesciptorVoid(JAVA_LONG));
uiWindowSwap = ffm.getFunctionPtr("_uiWindowSwap", ffm.getFunctionDesciptorVoid(JAVA_LONG));
if (FFM.debug) JFLog.log("UIFFM init complete");
return true;
}
}