mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-12 17:40:17 -07:00
Did some more refactoring/renaming in SignLink
This commit is contained in:
parent
6d814042b0
commit
4e77d5ab50
2 changed files with 51 additions and 41 deletions
|
|
@ -69,7 +69,7 @@ public class Display {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void method918(int var1, int var2, int var3, int var4, Frame var5, int var6) {
|
public void configureDisplayMode(int var1, int var2, int var3, int var4, Frame var5, int var6) {
|
||||||
this.displayMode = this.graphicsDevice.getDisplayMode();
|
this.displayMode = this.graphicsDevice.getDisplayMode();
|
||||||
if (var1 > -6) {
|
if (var1 > -6) {
|
||||||
this.method919(false);
|
this.method919(false);
|
||||||
|
|
@ -123,7 +123,7 @@ public class Display {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void method920() {
|
public void updateDisplayMode() {
|
||||||
if (this.displayMode != null) {
|
if (this.displayMode != null) {
|
||||||
this.graphicsDevice.setDisplayMode(this.displayMode);
|
this.graphicsDevice.setDisplayMode(this.displayMode);
|
||||||
if (!this.graphicsDevice.getDisplayMode().equals(this.displayMode)) {
|
if (!this.graphicsDevice.getDisplayMode().equals(this.displayMode)) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.runite.client;
|
package org.runite.client;
|
||||||
|
|
||||||
|
import com.sun.opengl.impl.x11.DRIHack;
|
||||||
import org.rs09.SystemLogger;
|
import org.rs09.SystemLogger;
|
||||||
|
|
||||||
import java.applet.Applet;
|
import java.applet.Applet;
|
||||||
|
|
@ -29,7 +30,7 @@ public class Signlink implements Runnable {
|
||||||
private static String homeDirectory;
|
private static String homeDirectory;
|
||||||
private final Thread thread;
|
private final Thread thread;
|
||||||
private final String gameName;
|
private final String gameName;
|
||||||
private final int anInt1215;
|
private final int cacheSubrevisionNum;
|
||||||
public RandomAccessFileWrapper[] cacheIndicesFiles;
|
public RandomAccessFileWrapper[] cacheIndicesFiles;
|
||||||
public RandomAccessFileWrapper cacheDataFile;
|
public RandomAccessFileWrapper cacheDataFile;
|
||||||
public EventQueue systemEventQueue;
|
public EventQueue systemEventQueue;
|
||||||
|
|
@ -43,11 +44,13 @@ public class Signlink implements Runnable {
|
||||||
private Class64 aClass64_1213 = null;
|
private Class64 aClass64_1213 = null;
|
||||||
private Interface1 anInterface1_1217;
|
private Interface1 anInterface1_1217;
|
||||||
|
|
||||||
|
private final int STAGE_LOAD_HDLIB = 10;
|
||||||
|
|
||||||
|
|
||||||
public Signlink(Applet applet, int var2, String gameName, int cacheIndexes) throws Exception {
|
public Signlink(Applet applet, int var2, String gameName, int cacheIndexes) throws Exception {
|
||||||
javaVersion = "1.1";
|
javaVersion = "1.1";
|
||||||
this.gameName = gameName;
|
this.gameName = gameName;
|
||||||
this.anInt1215 = var2;
|
this.cacheSubrevisionNum = var2;
|
||||||
this.gameApplet = applet;
|
this.gameApplet = applet;
|
||||||
javaVendor = "Unknown";
|
javaVendor = "Unknown";
|
||||||
|
|
||||||
|
|
@ -106,13 +109,13 @@ public class Signlink implements Runnable {
|
||||||
} catch (Exception var10) {
|
} catch (Exception var10) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.randomDatFile = new RandomAccessFileWrapper(method1448(null, this.anInt1215, "random.dat"), "rw", 25L);
|
this.randomDatFile = new RandomAccessFileWrapper(getFileFromCacheFolder(null, this.cacheSubrevisionNum, "random.dat"), "rw", 25L);
|
||||||
this.cacheDataFile = new RandomAccessFileWrapper(method1448(this.gameName, this.anInt1215, "main_file_cache.dat2"), "rw", 104857600L);
|
this.cacheDataFile = new RandomAccessFileWrapper(getFileFromCacheFolder(this.gameName, this.cacheSubrevisionNum, "main_file_cache.dat2"), "rw", 104857600L);
|
||||||
this.cacheChecksumFile = new RandomAccessFileWrapper(method1448(this.gameName, this.anInt1215, "main_file_cache.idx255"), "rw", 1048576L);
|
this.cacheChecksumFile = new RandomAccessFileWrapper(getFileFromCacheFolder(this.gameName, this.cacheSubrevisionNum, "main_file_cache.idx255"), "rw", 1048576L);
|
||||||
this.cacheIndicesFiles = new RandomAccessFileWrapper[cacheIndexes];
|
this.cacheIndicesFiles = new RandomAccessFileWrapper[cacheIndexes];
|
||||||
|
|
||||||
for (int i = 0; i < cacheIndexes; ++i) {
|
for (int i = 0; i < cacheIndexes; ++i) {
|
||||||
this.cacheIndicesFiles[i] = new RandomAccessFileWrapper(method1448(this.gameName, this.anInt1215, "main_file_cache.idx" + i), "rw", 1048576L);
|
this.cacheIndicesFiles[i] = new RandomAccessFileWrapper(getFileFromCacheFolder(this.gameName, this.cacheSubrevisionNum, "main_file_cache.idx" + i), "rw", 1048576L);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -167,11 +170,11 @@ public class Signlink implements Runnable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File method1448(String gameName, int var1, String filename) {
|
public static File getFileFromCacheFolder(String gameName, int cacheSubRev, String filename) {
|
||||||
File cachedFile = cachedFiles.get(filename);
|
File cachedFile = cachedFiles.get(filename);
|
||||||
if (cachedFile == null) {
|
if (cachedFile == null) {
|
||||||
String[] basePaths = new String[]{homeDirectory, "c:/rscache/", "/rscache/", "c:/windows/", "c:/winnt/", "c:/", "/tmp/", ""};
|
String[] basePaths = new String[]{homeDirectory, "c:/rscache/", "/rscache/", "c:/windows/", "c:/winnt/", "c:/", "/tmp/", ""};
|
||||||
String[] folders = new String[]{".runite_rs", ".530file_store_" + var1};
|
String[] folders = new String[]{".runite_rs", ".530file_store_" + cacheSubRev};
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i) {
|
||||||
for (String folder : folders) {
|
for (String folder : folders) {
|
||||||
for (String basePath : basePaths) {
|
for (String basePath : basePaths) {
|
||||||
|
|
@ -372,60 +375,67 @@ public class Signlink implements Runnable {
|
||||||
Frame var5 = new Frame("Jagex Full Screen");
|
Frame var5 = new Frame("Jagex Full Screen");
|
||||||
var1.anObject974 = var5;
|
var1.anObject974 = var5;
|
||||||
var5.setResizable(false);
|
var5.setResizable(false);
|
||||||
this.display.method918(-56, var1.anInt980 & 65535, var1.anInt980 >> 16, 65535 & var1.anInt979, var5, var1.anInt979 >>> 16);
|
this.display.configureDisplayMode(-56, var1.anInt980 & 65535, var1.anInt980 >> 16, 65535 & var1.anInt979, var5, var1.anInt979 >>> 16);
|
||||||
} else if (stage == 7) {
|
} else if (stage == 7) {
|
||||||
this.display.method920();
|
this.display.updateDisplayMode();
|
||||||
} else if (10 == stage) {
|
} else if (stage == STAGE_LOAD_HDLIB) {
|
||||||
Class[] var17 = new Class[]{Class.forName("java.lang.Class"), Class.forName("java.lang.String")};
|
Class[] declaredMethodFields = new Class[]{Class.forName("java.lang.Class"), Class.forName("java.lang.String")};
|
||||||
Runtime runtime = Runtime.getRuntime();
|
Runtime runtime = Runtime.getRuntime();
|
||||||
Method var7;
|
Method libLoaderMethod;
|
||||||
|
Class<Client> clientClass = (Class<Client>) var1.anObject977;
|
||||||
|
|
||||||
if (!osName.startsWith("mac")) {
|
if (!osName.startsWith("mac")) {
|
||||||
var7 = Class.forName("java.lang.Runtime").getDeclaredMethod("loadLibrary0", var17);
|
libLoaderMethod = Class.forName("java.lang.Runtime").getDeclaredMethod("loadLibrary0", declaredMethodFields);
|
||||||
var7.setAccessible(true);
|
libLoaderMethod.setAccessible(true);
|
||||||
var7.invoke(runtime, var1.anObject977, "jawt");
|
libLoaderMethod.invoke(runtime, clientClass, "jawt");
|
||||||
var7.setAccessible(false);
|
libLoaderMethod.setAccessible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean is64Bit = osArchitecture.contains("64");
|
boolean is64Bit = osArchitecture.contains("64");
|
||||||
boolean isSunOS = osName.startsWith("sunos");
|
boolean isSunOS = osName.startsWith("sunos");
|
||||||
var7 = Class.forName("java.lang.Runtime").getDeclaredMethod("load0", var17);
|
//load0 is a reflection-based package-private method in Runtime. Not sure why jagex used this, but it's fucky.
|
||||||
var7.setAccessible(true);
|
libLoaderMethod = Class.forName("java.lang.Runtime").getDeclaredMethod("load0", declaredMethodFields);
|
||||||
|
libLoaderMethod.setAccessible(true);
|
||||||
|
|
||||||
SystemLogger.logInfo("Signlink - os Name: " + osName);
|
SystemLogger.logInfo("Signlink - os Name: " + osName);
|
||||||
SystemLogger.logInfo("Signlink - os Arch: " + osArchitecture);
|
SystemLogger.logInfo("Signlink - os Arch: " + osArchitecture);
|
||||||
if (osArchitecture.equals("aarch64"))
|
|
||||||
SystemLogger.logWarn("Going into HD will fail - current libs do not support ARM.");
|
|
||||||
if (osName.startsWith("linux") || isSunOS) {
|
|
||||||
String[] libs = createLibs(isSunOS ? (is64Bit ? 7 : 6) : (is64Bit ? 5 : 4));
|
|
||||||
var7.invoke(runtime, var1.anObject977, libs[2]);
|
|
||||||
Class var8 = getClass().getClassLoader().loadClass("com.sun.opengl.impl.x11.DRIHack");
|
|
||||||
var8.getMethod("begin", new Class[0]).invoke(null);
|
|
||||||
var7.invoke(runtime, var1.anObject977, libs[0]);
|
|
||||||
var8.getMethod("end", new Class[0]).invoke(null);
|
|
||||||
var7.invoke(runtime, var1.anObject977, libs[1]);
|
|
||||||
|
|
||||||
|
if (osArchitecture.equals("aarch64")) {
|
||||||
|
SystemLogger.logWarn("Going into HD will fail - current libs do not support ARM.");
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (osName.startsWith("linux") || isSunOS) {
|
||||||
|
|
||||||
|
String[] libs = createLibs(isSunOS ? (is64Bit ? 7 : 6) : (is64Bit ? 5 : 4));
|
||||||
|
libLoaderMethod.invoke(runtime, clientClass, libs[2]);
|
||||||
|
DRIHack.begin();
|
||||||
|
libLoaderMethod.invoke(runtime, clientClass, libs[0]);
|
||||||
|
DRIHack.end();
|
||||||
|
libLoaderMethod.invoke(runtime, clientClass, libs[1]);
|
||||||
|
|
||||||
} else if (osName.startsWith("mac")) {
|
} else if (osName.startsWith("mac")) {
|
||||||
|
if(!osArchitecture.equals("ppc")) throw new Exception(); //we only have ppc libs for mac.
|
||||||
String[] libs = createLibs(is64Bit ? 2 : 3);
|
String[] libs = createLibs(is64Bit ? 2 : 3);
|
||||||
try {
|
try {
|
||||||
var7.invoke(runtime, var1.anObject977, libs[0]);
|
libLoaderMethod.invoke(runtime, clientClass, getFileFromCacheFolder(this.gameName, this.cacheSubrevisionNum, libs[0]).toString());
|
||||||
var7.invoke(runtime, var1.anObject977, libs[1]);
|
libLoaderMethod.invoke(runtime, clientClass, getFileFromCacheFolder(this.gameName, this.cacheSubrevisionNum, libs[1]).toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (!osName.startsWith("win")) {
|
if (!osName.startsWith("win")) {
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
String[] libs = createLibs(is64Bit ? 1 : 0);
|
String[] libs = createLibs(is64Bit ? 1 : 0);
|
||||||
//Windows has to load them this way because temporary files are illegal.
|
//Windows has to load them this way because temporary files are illegal.
|
||||||
String jogl = method1448(this.gameName, this.anInt1215, libs[0]).toString();
|
String jogl = getFileFromCacheFolder(this.gameName, this.cacheSubrevisionNum, libs[0]).toString();
|
||||||
String awt = method1448(this.gameName, this.anInt1215, libs[1]).toString();
|
String awt = getFileFromCacheFolder(this.gameName, this.cacheSubrevisionNum, libs[1]).toString();
|
||||||
var7.invoke(runtime, var1.anObject977, jogl);
|
libLoaderMethod.invoke(runtime, clientClass, jogl);
|
||||||
var7.invoke(runtime, var1.anObject977, awt);
|
libLoaderMethod.invoke(runtime, clientClass, awt);
|
||||||
}
|
}
|
||||||
|
|
||||||
var7.setAccessible(false);
|
libLoaderMethod.setAccessible(false);
|
||||||
} else {
|
} else {
|
||||||
int var18;
|
int var18;
|
||||||
if (stage == 11) {
|
if (stage == 11) {
|
||||||
|
|
@ -528,8 +538,8 @@ public class Signlink implements Runnable {
|
||||||
if(!isWindowsOrMac) isGluegenRequired = true;
|
if(!isWindowsOrMac) isGluegenRequired = true;
|
||||||
if(isGluegenRequired) glueGen = "libgluegen-rt_" + (is64Bit ? "64" : "32") + ".so";
|
if(isGluegenRequired) glueGen = "libgluegen-rt_" + (is64Bit ? "64" : "32") + ".so";
|
||||||
|
|
||||||
File joglLib = isWindowsOrMac ? method1448(this.gameName, this.anInt1215, "jogl.dll") : File.createTempFile("jogl", "." + jogl.split("\\.")[1]);
|
File joglLib = isWindowsOrMac ? getFileFromCacheFolder(this.gameName, this.cacheSubrevisionNum, "jogl.dll") : File.createTempFile("jogl", "." + jogl.split("\\.")[1]);
|
||||||
File awtLib = isWindowsOrMac ? method1448(this.gameName, this.anInt1215, "jogl_awt.dll") : File.createTempFile("jogl_awt", "." + awt.split("\\.")[1]);
|
File awtLib = isWindowsOrMac ? getFileFromCacheFolder(this.gameName, this.cacheSubrevisionNum, "jogl_awt.dll") : File.createTempFile("jogl_awt", "." + awt.split("\\.")[1]);
|
||||||
|
|
||||||
try (InputStream in = getClass().getResourceAsStream("/lib/" + jogl); OutputStream out = openOutputStream(joglLib)) {
|
try (InputStream in = getClass().getResourceAsStream("/lib/" + jogl); OutputStream out = openOutputStream(joglLib)) {
|
||||||
if (in == null) throw new FileNotFoundException("Needed library does not exist: " + jogl);
|
if (in == null) throw new FileNotFoundException("Needed library does not exist: " + jogl);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue