Allow to disable Avanguard (#33)

This commit is contained in:
Vladimir Votyakov 2018-10-12 14:04:17 +04:00 committed by Gravit
parent 1bb8b4621b
commit 76dd4ce250
4 changed files with 13 additions and 6 deletions

View file

@ -205,7 +205,7 @@ public void start(String... args) throws Throwable {
loadScript("dialog/dialog.js"); loadScript("dialog/dialog.js");
LogHelper.info("Invoking start() function"); LogHelper.info("Invoking start() function");
Invocable invoker = (Invocable) engine; Invocable invoker = (Invocable) engine;
if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) { if (Launcher.isUsingAvanguard()) {
AvanguardStarter.start((Path) invoker.invokeFunction("getPathDirHelper")); AvanguardStarter.start((Path) invoker.invokeFunction("getPathDirHelper"));
AvanguardStarter.loadVared(); AvanguardStarter.loadVared();
AvanguardStarter.main(false); AvanguardStarter.main(false);

View file

@ -320,7 +320,7 @@ public static Process launch(
checkJVMBitsAndVersion(); checkJVMBitsAndVersion();
// Fill CLI arguments // Fill CLI arguments
List<String> args = new LinkedList<>(); List<String> args = new LinkedList<>();
boolean wrapper = isUsingWrapper(); boolean wrapper = isUsingWrapper() && Launcher.isUsingAvanguard();
Path javaBin; Path javaBin;
if (wrapper) javaBin = JVMHelper.JVM_BITS == 64 ? AvanguardStarter.wrap64 : AvanguardStarter.wrap32; if (wrapper) javaBin = JVMHelper.JVM_BITS == 64 ? AvanguardStarter.wrap64 : AvanguardStarter.wrap32;
else else
@ -383,7 +383,7 @@ public static void main(String... args) throws Throwable {
Launcher.modulesManager = new ClientModuleManager(null); Launcher.modulesManager = new ClientModuleManager(null);
LauncherConfig.getAutogenConfig().initModules(); //INIT LauncherConfig.getAutogenConfig().initModules(); //INIT
Launcher.modulesManager.preInitModules(); Launcher.modulesManager.preInitModules();
if (JVMHelper.OS_TYPE == OS.MUSTDIE) { if (Launcher.isUsingAvanguard()) {
AvanguardStarter.loadVared(); AvanguardStarter.loadVared();
AvanguardStarter.main(false); AvanguardStarter.main(false);
} }

View file

@ -69,9 +69,9 @@ protected Result requestDo(HInput input, HOutput output) throws IOException {
output.writeString(login, SerializeLimits.MAX_LOGIN); output.writeString(login, SerializeLimits.MAX_LOGIN);
output.writeString(Launcher.profile.getTitle(), SerializeLimits.MAX_CLIENT); output.writeString(Launcher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
output.writeInt(auth_id); output.writeInt(auth_id);
output.writeLong(JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE ? GuardBind.avnGetHddId() : 0); output.writeLong(Launcher.isUsingAvanguard() ? GuardBind.avnGetHddId() : 0);
output.writeLong(JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE ? GuardBind.avnGetCpuid() : 0); output.writeLong(Launcher.isUsingAvanguard() ? GuardBind.avnGetCpuid() : 0);
output.writeLong(JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE ? GuardBind.avnGetSmbiosId() : 0); output.writeLong(Launcher.isUsingAvanguard() ? GuardBind.avnGetSmbiosId() : 0);
output.writeByteArray(encryptedPassword, SecurityHelper.CRYPTO_MAX_LENGTH); output.writeByteArray(encryptedPassword, SecurityHelper.CRYPTO_MAX_LENGTH);
output.flush(); output.flush();

View file

@ -13,6 +13,7 @@
import ru.gravit.launcher.profiles.ClientProfile; import ru.gravit.launcher.profiles.ClientProfile;
import ru.gravit.utils.Version; import ru.gravit.utils.Version;
import ru.gravit.utils.helper.IOHelper; import ru.gravit.utils.helper.IOHelper;
import ru.gravit.utils.helper.JVMHelper;
import ru.gravit.utils.helper.SecurityHelper; import ru.gravit.utils.helper.SecurityHelper;
import ru.gravit.launcher.modules.ModulesManagerInterface; import ru.gravit.launcher.modules.ModulesManagerInterface;
import ru.gravit.launcher.serialize.HInput; import ru.gravit.launcher.serialize.HInput;
@ -109,4 +110,10 @@ public static String toHash(UUID uuid) {
public static Version getVersion() { public static Version getVersion() {
return new Version(MAJOR, MINOR, PATCH, BUILD, RELEASE); return new Version(MAJOR, MINOR, PATCH, BUILD, RELEASE);
} }
public static final boolean useAvanguard = true;
public static boolean isUsingAvanguard() {
return JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE && useAvanguard;
}
} }