mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-20 05:20:22 -07:00
A little more refactoring
This commit is contained in:
parent
4e77d5ab50
commit
6fda6b648d
1 changed files with 12 additions and 25 deletions
|
|
@ -406,28 +406,15 @@ public class Signlink implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (osName.startsWith("linux") || isSunOS) {
|
if (osName.startsWith("linux") || isSunOS) {
|
||||||
|
String[] libs = createLibs("linux");
|
||||||
String[] libs = createLibs(isSunOS ? (is64Bit ? 7 : 6) : (is64Bit ? 5 : 4));
|
|
||||||
libLoaderMethod.invoke(runtime, clientClass, libs[2]);
|
libLoaderMethod.invoke(runtime, clientClass, libs[2]);
|
||||||
DRIHack.begin();
|
DRIHack.begin();
|
||||||
libLoaderMethod.invoke(runtime, clientClass, libs[0]);
|
libLoaderMethod.invoke(runtime, clientClass, libs[0]);
|
||||||
DRIHack.end();
|
DRIHack.end();
|
||||||
libLoaderMethod.invoke(runtime, clientClass, libs[1]);
|
libLoaderMethod.invoke(runtime, clientClass, libs[1]);
|
||||||
|
|
||||||
} 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);
|
|
||||||
try {
|
|
||||||
libLoaderMethod.invoke(runtime, clientClass, getFileFromCacheFolder(this.gameName, this.cacheSubrevisionNum, libs[0]).toString());
|
|
||||||
libLoaderMethod.invoke(runtime, clientClass, getFileFromCacheFolder(this.gameName, this.cacheSubrevisionNum, libs[1]).toString());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (!osName.startsWith("win")) {
|
if(osName.startsWith("mac") && !osArchitecture.equals("ppc")) throw new Exception(); //We only have ppc libs for mac.
|
||||||
throw new Exception();
|
String[] libs = createLibs(osName.contains("win") ? "windows" : "macppc");
|
||||||
}
|
|
||||||
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 = getFileFromCacheFolder(this.gameName, this.cacheSubrevisionNum, libs[0]).toString();
|
String jogl = getFileFromCacheFolder(this.gameName, this.cacheSubrevisionNum, libs[0]).toString();
|
||||||
String awt = getFileFromCacheFolder(this.gameName, this.cacheSubrevisionNum, libs[1]).toString();
|
String awt = getFileFromCacheFolder(this.gameName, this.cacheSubrevisionNum, libs[1]).toString();
|
||||||
|
|
@ -514,26 +501,26 @@ public class Signlink implements Runnable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts the libs from the client resources
|
* Extracts the libs from the client resources
|
||||||
* @param archive deprecated - used to point to the cache archive for the lib, now indicates OS|Architecture "hash"
|
* @param os The OS in use: windows, macppc, or linux
|
||||||
* @return an array of the created filenames to load.
|
* @return an array of the created filenames to load.
|
||||||
* @author Ceikry
|
* @author Ceikry
|
||||||
*/
|
*/
|
||||||
public String[] createLibs(int archive) throws Throwable {
|
public String[] createLibs(String os) throws Throwable {
|
||||||
ArrayList<String> filenames = new ArrayList<>();
|
ArrayList<String> filenames = new ArrayList<>();
|
||||||
String jogl;
|
String jogl;
|
||||||
String awt;
|
String awt;
|
||||||
String glueGen = "";
|
String glueGen = "";
|
||||||
boolean isGluegenRequired = false;
|
boolean isGluegenRequired = false;
|
||||||
boolean is64Bit = osArchitecture.contains("64");
|
boolean is64Bit = osArchitecture.contains("64");
|
||||||
boolean isWindowsOrMac = archive < 4;
|
boolean isWindowsOrMac = os.equals("macppc") || os.equals("windows");
|
||||||
|
|
||||||
jogl = (archive < 2 ? "jogl" : "libjogl") +
|
String fileExtension = os.equals("windows") ? ".dll" : os.equals("macppc") ? ".jnilib" : ".so";
|
||||||
(is64Bit ? "_64" : "_32") +
|
|
||||||
(archive < 2 ? ".dll" : archive < 4 ? ".jnilib" : ".so");
|
|
||||||
|
|
||||||
awt = (archive < 2 ? "jogl_awt" : "libjogl_awt") +
|
jogl = (os.equals("windows") ? "jogl" : "libjogl") +
|
||||||
(is64Bit ? "_64" : "_32") +
|
(is64Bit ? "_64" : "_32") + fileExtension;
|
||||||
(archive < 2 ? ".dll" : archive < 4 ? ".jnilib" : ".so");
|
|
||||||
|
awt = (os.equals("windows") ? "jogl_awt" : "libjogl_awt") +
|
||||||
|
(is64Bit ? "_64" : "_32") + fileExtension;
|
||||||
|
|
||||||
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";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue