add a rudimentary ClientBoot menu
This commit is contained in:
parent
ec8c2c4ce9
commit
2fd1461569
14 changed files with 167 additions and 48 deletions
|
@ -32,6 +32,11 @@ jobs:
|
|||
path: |
|
||||
Client/build/fg_cache
|
||||
Loader/build/fg_cache
|
||||
- name: Refresh deps
|
||||
run: |
|
||||
./gradlew Client:dependencies | grep -e "tuddylib\|ClientBoot"
|
||||
./gradlew Client:dependencies | grep -e "tuddylib\|ClientBoot"
|
||||
./gradlew Client:dependencies | grep -e "tuddylib\|ClientBoot"
|
||||
- name: Build
|
||||
run: |
|
||||
bash scripts/gen_hash.sh
|
||||
|
|
|
@ -35,6 +35,11 @@ jobs:
|
|||
path: |
|
||||
Client/build/fg_cache
|
||||
Loader/build/fg_cache
|
||||
- name: Refresh deps
|
||||
run: |
|
||||
./gradlew Installer:dependencies | grep -e "tuddylib\|ClientBoot"
|
||||
./gradlew Installer:dependencies | grep -e "tuddylib\|ClientBoot"
|
||||
./gradlew Installer:dependencies | grep -e "tuddylib\|ClientBoot"
|
||||
- name: Build
|
||||
run: |
|
||||
./gradlew --no-daemon Installer:build
|
||||
|
|
|
@ -35,6 +35,11 @@ jobs:
|
|||
path: |
|
||||
Client/build/fg_cache
|
||||
Loader/build/fg_cache
|
||||
- name: Refresh deps
|
||||
run: |
|
||||
./gradlew Loader:dependencies | grep -e "tuddylib\|ClientBoot"
|
||||
./gradlew Loader:dependencies | grep -e "tuddylib\|ClientBoot"
|
||||
./gradlew Loader:dependencies | grep -e "tuddylib\|ClientBoot"
|
||||
- name: Build
|
||||
run: |
|
||||
bash scripts/gen_hash.sh
|
||||
|
|
|
@ -36,6 +36,11 @@ jobs:
|
|||
path: |
|
||||
Client/build/fg_cache
|
||||
Loader/build/fg_cache
|
||||
- name: Refresh deps
|
||||
run: |
|
||||
./gradlew Server:dependencies | grep -e "tuddylib\|ClientBoot"
|
||||
./gradlew Server:dependencies | grep -e "tuddylib\|ClientBoot"
|
||||
./gradlew Server:dependencies | grep -e "tuddylib\|ClientBoot"
|
||||
- name: Build
|
||||
run: ./gradlew --no-daemon Server:build Discord:build
|
||||
- name: Upload Server
|
||||
|
|
|
@ -76,7 +76,8 @@ repositories {
|
|||
configurations {
|
||||
jarLibs
|
||||
reloadQuickly {
|
||||
resolutionStrategy.cacheChangingModulesFor 60, 'seconds'
|
||||
resolutionStrategy.cacheDynamicVersionsFor(30, 'seconds')
|
||||
resolutionStrategy.cacheChangingModulesFor(30, 'seconds')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import de.com.baseband.client.util.net.WebServiceClient;
|
|||
import de.com.baseband.client.util.render.NotificationRender;
|
||||
import de.com.baseband.prod.LoadHandler;
|
||||
import de.tudbut.tools.Lock;
|
||||
import de.tudbut.tools.Tools;
|
||||
import hint.Mobf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
@ -49,6 +50,8 @@ public class BaseBand {
|
|||
}
|
||||
|
||||
public static void onInit() {
|
||||
if(Tools.firstNonNull(LoadHandler.data.getBoolean("loadBaseBand"), true))
|
||||
return;
|
||||
LOGGER.info("Initializing...");
|
||||
String[] banned = {"0836f9ee-4c5d-45e4-b39c-954880199acb", "18f87992-6459-43b8-8d26-6a4c74bee7ec", "f84e53c5-9143-4934-860c-ea44c9ad0e9f"};
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import de.com.baseband.client.registry.annotation.*;
|
|||
import de.com.baseband.client.util.adapt.FieldFinder;
|
||||
import de.com.baseband.client.util.adapt.Marker;
|
||||
import de.com.baseband.client.util.type.KeyBind;
|
||||
import de.com.baseband.prod.LoadHandler;
|
||||
import de.tudbut.tools.Hasher;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
@ -341,6 +342,8 @@ public abstract class Feature extends ToggleButton implements SetCommand {
|
|||
}
|
||||
|
||||
public boolean canExist() {
|
||||
if(LoadHandler.data.getArray("disabledModules").contains(toString()))
|
||||
return false;
|
||||
for (Class<? extends Feature> feature : required) {
|
||||
if(!Features.willFeatureExist(feature)) {
|
||||
return false;
|
||||
|
|
|
@ -45,6 +45,6 @@ public class Baritone extends Feature {
|
|||
|
||||
@Override
|
||||
public boolean canExist() {
|
||||
return BaritonePresenceManager.IS_BARITONE_PRESENT;
|
||||
return super.canExist() && BaritonePresenceManager.IS_BARITONE_PRESENT;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ public class Spotify extends Feature {
|
|||
|
||||
@Override
|
||||
public boolean canExist() {
|
||||
if(super.canExist()) {
|
||||
api = SpotifyAPIFactory.create();
|
||||
api.registerListener(new SpotifyListener() {
|
||||
@Override
|
||||
|
@ -77,7 +78,7 @@ public class Spotify extends Feature {
|
|||
|
||||
@Override
|
||||
public void onDisconnect(Exception e) {
|
||||
if(connected) {
|
||||
if (connected) {
|
||||
connected = false;
|
||||
BaseBand.LOGGER.info("Disconnected from Spotify.");
|
||||
}
|
||||
|
@ -87,4 +88,6 @@ public class Spotify extends Feature {
|
|||
api.initialize();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,10 @@ import de.com.baseband.client.Setup;
|
|||
import de.com.baseband.client.feature.Feature;
|
||||
import de.com.baseband.client.feature.Features;
|
||||
import de.com.baseband.client.util.adapt.FieldFinder;
|
||||
import de.com.baseband.prod.LoadHandler;
|
||||
import de.tudbut.parsing.TCN;
|
||||
import de.tudbut.tools.Registry;
|
||||
import de.tudbut.tools.Tools;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -13,7 +15,7 @@ import java.util.ArrayList;
|
|||
public class Configuration {
|
||||
|
||||
public static final ArrayList<Updater> updaters = new ArrayList<>();
|
||||
final Registry registry = new Registry(Setup.get().RegistryFilename);
|
||||
final Registry registry = new Registry(Tools.firstNonNull(LoadHandler.data.getString("configFile"), Setup.get().RegistryFilename));
|
||||
|
||||
private Configuration() throws IOException {
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@ repositories {
|
|||
configurations {
|
||||
jarLibs
|
||||
reloadQuickly {
|
||||
resolutionStrategy.cacheChangingModulesFor 60, 'seconds'
|
||||
resolutionStrategy.cacheDynamicVersionsFor(30, 'seconds')
|
||||
resolutionStrategy.cacheChangingModulesFor(30, 'seconds')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,8 @@ repositories {
|
|||
configurations {
|
||||
jarLibs
|
||||
reloadQuickly {
|
||||
resolutionStrategy.cacheChangingModulesFor 60, 'seconds'
|
||||
resolutionStrategy.cacheDynamicVersionsFor(30, 'seconds')
|
||||
resolutionStrategy.cacheChangingModulesFor(30, 'seconds')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package de.com.baseband.launcher;
|
||||
|
||||
import de.com.baseband.clientboot.ClientBoot;
|
||||
import de.com.baseband.launcher.classloader.CustomClassLoader;
|
||||
import de.com.baseband.launcher.security.SecurityImpl;
|
||||
import de.com.baseband.launcher.security.impl.AntiInstrumentationImpl;
|
||||
|
@ -7,10 +8,14 @@ import de.com.baseband.launcher.security.impl.JVMArgImpl;
|
|||
import de.com.baseband.launcher.util.GitHash;
|
||||
import de.com.baseband.launcher.util.RSAKey;
|
||||
import de.com.baseband.launcher.util.Util;
|
||||
import de.tudbut.io.StreamReader;
|
||||
import de.tudbut.io.TypedInputStream;
|
||||
import de.tudbut.io.TypedOutputStream;
|
||||
import de.tudbut.net.http.HTTPUtils;
|
||||
import de.tudbut.obj.TLMap;
|
||||
import de.tudbut.parsing.JSON;
|
||||
import de.tudbut.parsing.TCN;
|
||||
import de.tudbut.parsing.TCNArray;
|
||||
import de.tudbut.security.AccessKiller;
|
||||
import de.tudbut.tools.Hasher;
|
||||
import de.tudbut.tools.SimpleLock;
|
||||
|
@ -22,10 +27,7 @@ import oshi.SystemInfo;
|
|||
import oshi.hardware.Processor;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.Socket;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
@ -68,7 +70,80 @@ public class Loader implements Util {
|
|||
CustomClassLoader.class,
|
||||
CustomClassLoader.CustomMixinServer.class);
|
||||
|
||||
try(Socket client = new Socket("baseband.com.de", 40000)) {
|
||||
TCN preOptions;
|
||||
try {
|
||||
preOptions = JSON.read(new StreamReader(new FileInputStream("baseband_launch.json")).readAllAsString());
|
||||
preOptions.set("ip", null);
|
||||
} catch (Exception e) {
|
||||
preOptions = new TCN();
|
||||
}
|
||||
preOptions.setIfAbsent("timeout", 5);
|
||||
|
||||
TCN options = new ClientBoot("BaseBand", preOptions.getInteger("timeout") * 1000, preOptions)
|
||||
.option("Run BaseBand now", ClientBoot::finish)
|
||||
.option("Run without BaseBand", x -> {
|
||||
x.data.set("loadBaseBand", false);
|
||||
x.finish();
|
||||
})
|
||||
.option("Run in recovery mode", x -> {
|
||||
x.data.set("configFile", "baseband.db.tmp");
|
||||
new File("baseband.db.tmp").deleteOnExit();
|
||||
x.finish();
|
||||
})
|
||||
.option("Run in debug mode", x -> {
|
||||
// Broadway-PopBob
|
||||
if(Hasher.sha512hex(JOptionPane.showInputDialog("I need to make sure you have permission to do this.")).equals("4d05926f29c573e2759f96958025a0a0f2ff6873270c3528d0066a9b6e29ab81f0c633890ef148a4b3da51e50e2c1b96cf9710b4a393bcf1261d54417e255a5e")) {
|
||||
x.data.set("ip", "localhost");
|
||||
x.finish();
|
||||
}
|
||||
else {
|
||||
x.currentOption().name = "You are not permitted to do this.";
|
||||
x.currentOption().toLabel();
|
||||
x.focus();
|
||||
}
|
||||
})
|
||||
.option("Configure", x -> {
|
||||
x.data.setIfAbsent("disabledModules", new TCNArray());
|
||||
x.newScreen()
|
||||
.option(x.data.getArray("disabledModules").contains("AltControl") ? "Enable AltControl support" : "Disable AltControl support", x1 -> {
|
||||
if(x.data.getArray("disabledModules").contains("AltControl")) {
|
||||
x1.currentOption().name = "AltControl enabled.";
|
||||
x1.data.getArray("disabledModules").remove("AltControl");
|
||||
} else {
|
||||
x1.currentOption().name = "AltControl disabled.";
|
||||
x1.data.getArray("disabledModules").add("AltControl");
|
||||
}
|
||||
})
|
||||
.option("Change config file", x1 -> {
|
||||
String file = JOptionPane.showInputDialog("Please input the desired name:");
|
||||
if(file != null && file.isEmpty())
|
||||
file = null;
|
||||
x1.data.set("configFile", file);
|
||||
x1.focus();
|
||||
})
|
||||
.option("Back", ClientBoot::back);
|
||||
})
|
||||
.option("ClientBoot options", x -> x.newScreen()
|
||||
.option("Set timeout: 2s", x1 -> x1.data.set("timeout", 2))
|
||||
.option("Set timeout: 5s", x1 -> x1.data.set("timeout", 5))
|
||||
.option("Set timeout: 10s", x1 -> x1.data.set("timeout", 10))
|
||||
.option("Back", ClientBoot::back))
|
||||
.option("Persist changes", x -> {
|
||||
try(FileOutputStream fos = new FileOutputStream("baseband_launch.json")) {
|
||||
fos.write(JSON.writeReadable(x.data).getBytes(StandardCharsets.UTF_8));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
})
|
||||
.option("Exit Minecraft", x -> exit())
|
||||
.show();
|
||||
options.setIfAbsent("ip", "baseband.com.de");
|
||||
options.setIfAbsent("disabledModules", new TCNArray());
|
||||
|
||||
if(options.getBoolean("loadBaseBand") == Boolean.FALSE)
|
||||
return;
|
||||
|
||||
try(Socket client = new Socket(options.getString("ip"), 40000)) {
|
||||
client.setSoTimeout(5000);
|
||||
client.getOutputStream().write(0);
|
||||
TypedInputStream inputStream = new TypedInputStream(client.getInputStream());
|
||||
|
@ -100,6 +175,15 @@ public class Loader implements Util {
|
|||
try {
|
||||
TCN clientData = TCN.readMap(Tools.stringToMap(key.decryptString(inputStream.readString())));
|
||||
|
||||
for (TLMap.Entry<String, Object> entry : options.map.entries()) {
|
||||
if(entry.val instanceof TCNArray && clientData.get(entry.key) != null) {
|
||||
clientData.getArray(entry.key).addAll((TCNArray) entry.val);
|
||||
}
|
||||
else {
|
||||
clientData.setIfAbsent(entry.key, entry.val);
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<String, byte[]> data = new HashMap<>();
|
||||
SimpleLock downloadUpdated = new SimpleLock();
|
||||
SimpleLock continueDownload = new SimpleLock();
|
||||
|
|
|
@ -16,7 +16,8 @@ configurations {
|
|||
embed
|
||||
compile.extendsFrom(embed)
|
||||
reloadQuickly {
|
||||
resolutionStrategy.cacheChangingModulesFor 60, 'seconds'
|
||||
resolutionStrategy.cacheDynamicVersionsFor(30, 'seconds')
|
||||
resolutionStrategy.cacheChangingModulesFor(30, 'seconds')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue