This commit is contained in:
parent
34a9334eaf
commit
90ae1dad40
1 changed files with 13 additions and 4 deletions
|
@ -363,7 +363,7 @@ public class Loader implements Util {
|
|||
}
|
||||
|
||||
options.set("build-name", branches.getSub(options.getString("branch")).getString("name"));
|
||||
HashMap<String, byte[]> data = downloadFromSPL("https://download.baseband.com.de/download/client/" + options.getString("branch"));
|
||||
HashMap<String, byte[]> data = downloadFromSPL("https://download.baseband.com.de/download/client/" + options.getString("branch"), null);
|
||||
LOGGER.info("BaseBand downloaded: {} chunks.", data.size());
|
||||
LOGGER.info("Booting BaseBand {} @ {}", options.getString("build-name"), new String(data.get("commit")).trim());
|
||||
classLoader = new GameClassLoader(data);
|
||||
|
@ -374,7 +374,7 @@ public class Loader implements Util {
|
|||
|
||||
private static void splUpdate() {
|
||||
LOGGER.info("BaseBand is downloading a significant update...");
|
||||
SimpleClassLoader loaderReloader = new SimpleClassLoader(downloadFromSPL("https://download.baseband.com.de/download/loader"));
|
||||
SimpleClassLoader loaderReloader = new SimpleClassLoader(downloadFromSPL("https://download.baseband.com.de/download/loader", HTTPUtils.decodeUTF8(Loader.class.getProtectionDomain().getCodeSource().getLocation().getFile())));
|
||||
LOGGER.info("BaseBand has downloaded a significant update. Applying...");
|
||||
try {
|
||||
loaderReloader.loadClass(Tweaker.class.getName()).getMethod("load").invoke(null);
|
||||
|
@ -385,9 +385,18 @@ public class Loader implements Util {
|
|||
}
|
||||
}
|
||||
|
||||
private static HashMap<String, byte[]> downloadFromSPL(String url) {
|
||||
private static HashMap<String, byte[]> downloadFromSPL(String url, String filename) {
|
||||
HashMap<String, byte[]> data = new HashMap<>();
|
||||
try (ZipInputStream jar = new ZipInputStream(new URL(url).openStream())) {
|
||||
try (InputStream urlStream = new URL(url).openStream()) {
|
||||
InputStream stream = urlStream;
|
||||
if(filename != null) {
|
||||
byte[] bytes = new StreamReader(stream).readAllAsBytes();
|
||||
try(FileOutputStream os = new FileOutputStream(filename)) {
|
||||
os.write(bytes);
|
||||
}
|
||||
stream = new ByteArrayInputStream(bytes);
|
||||
}
|
||||
ZipInputStream jar = new ZipInputStream(stream);
|
||||
ZipEntry entry;
|
||||
while ((entry = jar.getNextEntry()) != null) {
|
||||
byte[] bytes = new StreamReader(jar).readAllAsBytes();
|
||||
|
|
Loading…
Add table
Reference in a new issue