From bd294f7cff910795d58c19c72bb50275b4eb3f04 Mon Sep 17 00:00:00 2001 From: ceikry Date: Mon, 28 Jun 2021 11:46:25 -0500 Subject: [PATCH] "nooooooooo you cant just load libraries from a jar nooooooooooooooooooooooooooooooooooooo" --- .../main/kotlin/org/rs09/client/GameLaunch.kt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Client/src/main/kotlin/org/rs09/client/GameLaunch.kt b/Client/src/main/kotlin/org/rs09/client/GameLaunch.kt index 43f978430..c349eb2b5 100644 --- a/Client/src/main/kotlin/org/rs09/client/GameLaunch.kt +++ b/Client/src/main/kotlin/org/rs09/client/GameLaunch.kt @@ -3,6 +3,8 @@ package org.rs09.client import org.rs09.SystemLogger import org.rs09.client.config.GameConfig import org.runite.client.GameShell +import java.io.File +import java.io.FileOutputStream object GameLaunch { @@ -44,7 +46,22 @@ object GameLaunch { * Launches the client */ if(System.getProperty("os.name").toLowerCase().contains("nux")){ //Fixes crashing due to XInitThreads not being called - JVM bug - System.load(javaClass.classLoader.getResource("libfixXInitThreads.so")!!.file) + val istream = javaClass.classLoader.getResourceAsStream("libfixXInitThreads.so") + val buff = ByteArray(1024) + var read = -1 + val temp = File.createTempFile("libfixXInitThreads.so","") + val fos = FileOutputStream(temp) + + read = istream.read(buff) + while(read != -1){ + fos.write(buff, 0, read) + read = istream.read(buff) + } + + fos.close() + istream.close() + + System.load(temp.absolutePath) } GameShell.launchDesktop() }