Add jaggl_dri implementation

bzip2
Graham 5 years ago
parent d0cc1b5029
commit 3e2192236f
  1. 21
      gl-dri-natives/pom.xml
  2. 29
      gl-dri-natives/src/main/c/jaggl_dri.c
  3. 51
      pom.xml

@ -9,7 +9,26 @@
</parent> </parent>
<artifactId>openrs2-gl-dri-natives</artifactId> <artifactId>openrs2-gl-dri-natives</artifactId>
<packaging>jar</packaging> <packaging>nar</packaging>
<name>OpenRS2 GL DRI Natives</name> <name>OpenRS2 GL DRI Natives</name>
<build>
<plugins>
<plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<configuration>
<linker>
<sysLibs>
<sysLib>
<type>shared</type>
<name>dl</name>
</sysLib>
</sysLibs>
</linker>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

@ -0,0 +1,29 @@
#include "jaggl_X11_dri.h"
#include <dlfcn.h>
#include <stddef.h>
static void *jaggl_dri_handle;
JNIEXPORT jboolean JNICALL Java_jaggl_X11_dri_open(JNIEnv *env, jclass cls, jstring path) {
if (jaggl_dri_handle) {
dlclose(jaggl_dri_handle);
jaggl_dri_handle = NULL;
}
const char *path_str = (*env)->GetStringUTFChars(env, path, NULL);
jaggl_dri_handle = dlopen(path_str, RTLD_LAZY | RTLD_GLOBAL);
(*env)->ReleaseStringUTFChars(env, path, path_str);
return jaggl_dri_handle != NULL;
}
JNIEXPORT jboolean JNICALL Java_jaggl_X11_dri_close(JNIEnv *env, jclass cls) {
if (jaggl_dri_handle) {
dlclose(jaggl_dri_handle);
jaggl_dri_handle = NULL;
return JNI_TRUE;
}
return JNI_FALSE;
}

@ -16,7 +16,6 @@
<module>deob-annotations</module> <module>deob-annotations</module>
<module>fernflower</module> <module>fernflower</module>
<module>game</module> <module>game</module>
<module>gl-dri-natives</module>
<module>gl-natives</module> <module>gl-natives</module>
<module>misc-natives</module> <module>misc-natives</module>
<module>util</module> <module>util</module>
@ -97,6 +96,11 @@
<build> <build>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<version>3.6.0</version>
</plugin>
<plugin> <plugin>
<groupId>io.github.zlika</groupId> <groupId>io.github.zlika</groupId>
<artifactId>reproducible-build-maven-plugin</artifactId> <artifactId>reproducible-build-maven-plugin</artifactId>
@ -170,6 +174,25 @@
</plugins> </plugins>
</pluginManagement> </pluginManagement>
<plugins> <plugins>
<plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<libraries>
<library>
<type>shared</type>
<linkCPP>false</linkCPP>
</library>
</libraries>
<c>
<optimize>full</optimize>
</c>
<java>
<include>true</include>
</java>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>io.github.zlika</groupId> <groupId>io.github.zlika</groupId>
<artifactId>reproducible-build-maven-plugin</artifactId> <artifactId>reproducible-build-maven-plugin</artifactId>
@ -261,5 +284,31 @@
<module>nonfree</module> <module>nonfree</module>
</modules> </modules>
</profile> </profile>
<profile>
<id>unix</id>
<activation>
<os>
<family>unix</family>
</os>
</activation>
<modules>
<module>gl-dri-natives</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<configuration>
<linker>
<options>
<option>-fPIC</option>
</options>
</linker>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles> </profiles>
</project> </project>

Loading…
Cancel
Save