mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FIX] Фиксы работы загрузки своей джавы
This commit is contained in:
parent
642038576a
commit
f74b5cd1d9
4 changed files with 19 additions and 5 deletions
|
@ -62,9 +62,10 @@ public void start(String... args) throws Throwable {
|
||||||
Launcher.modulesManager = new ClientModuleManager(this);
|
Launcher.modulesManager = new ClientModuleManager(this);
|
||||||
LauncherConfig.getAutogenConfig().initModules();
|
LauncherConfig.getAutogenConfig().initModules();
|
||||||
Launcher.modulesManager.preInitModules();
|
Launcher.modulesManager.preInitModules();
|
||||||
LauncherGuardManager.initGuard(false);
|
|
||||||
if (runtimeProvider == null) runtimeProvider = new JSRuntimeProvider();
|
if (runtimeProvider == null) runtimeProvider = new JSRuntimeProvider();
|
||||||
runtimeProvider.init(false);
|
runtimeProvider.init(false);
|
||||||
|
runtimeProvider.preLoad();
|
||||||
|
LauncherGuardManager.initGuard(false);
|
||||||
Objects.requireNonNull(args, "args");
|
Objects.requireNonNull(args, "args");
|
||||||
if (started.getAndSet(true))
|
if (started.getAndSet(true))
|
||||||
throw new IllegalStateException("Launcher has been already started");
|
throw new IllegalStateException("Launcher has been already started");
|
||||||
|
|
|
@ -469,7 +469,6 @@ public static void main(String... args) throws Throwable {
|
||||||
LauncherConfig.getAutogenConfig().initModules(); //INIT
|
LauncherConfig.getAutogenConfig().initModules(); //INIT
|
||||||
initGson();
|
initGson();
|
||||||
Launcher.modulesManager.preInitModules();
|
Launcher.modulesManager.preInitModules();
|
||||||
LauncherGuardManager.initGuard(true);
|
|
||||||
checkJVMBitsAndVersion();
|
checkJVMBitsAndVersion();
|
||||||
JVMHelper.verifySystemProperties(ClientLauncher.class, true);
|
JVMHelper.verifySystemProperties(ClientLauncher.class, true);
|
||||||
EnvHelper.checkDangerousParams();
|
EnvHelper.checkDangerousParams();
|
||||||
|
@ -478,6 +477,7 @@ public static void main(String... args) throws Throwable {
|
||||||
if (engine.runtimeProvider == null) engine.runtimeProvider = new JSRuntimeProvider();
|
if (engine.runtimeProvider == null) engine.runtimeProvider = new JSRuntimeProvider();
|
||||||
engine.runtimeProvider.init(true);
|
engine.runtimeProvider.init(true);
|
||||||
engine.runtimeProvider.preLoad();
|
engine.runtimeProvider.preLoad();
|
||||||
|
LauncherGuardManager.initGuard(true);
|
||||||
// Read and delete params file
|
// Read and delete params file
|
||||||
LogHelper.debug("Reading ClientLauncher params");
|
LogHelper.debug("Reading ClientLauncher params");
|
||||||
Params params;
|
Params params;
|
||||||
|
|
|
@ -3,7 +3,10 @@
|
||||||
import ru.gravit.launcher.client.DirBridge;
|
import ru.gravit.launcher.client.DirBridge;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.JVMHelper;
|
import ru.gravit.utils.helper.JVMHelper;
|
||||||
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
import ru.gravit.utils.helper.UnpackHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
|
@ -23,6 +26,10 @@ public Path getJavaBinPath() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(boolean clientInstance) {
|
public void init(boolean clientInstance) {
|
||||||
|
try {
|
||||||
|
UnpackHelper.unpack(IOHelper.getResourceURL(JVMHelper.JVM_BITS == 64 ? "wrapper64.exe" : "wrapper32.exe"),DirBridge.getGuardDir());
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new SecurityException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
public class JSRuntimeProvider implements RuntimeProvider {
|
public class JSRuntimeProvider implements RuntimeProvider {
|
||||||
|
|
||||||
private final ScriptEngine engine = CommonHelper.newScriptEngine();
|
private final ScriptEngine engine = CommonHelper.newScriptEngine();
|
||||||
|
private boolean isPreLoaded = false;
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static void addLauncherClassBindings(Map<String, Object> bindings) {
|
public static void addLauncherClassBindings(Map<String, Object> bindings) {
|
||||||
|
@ -145,6 +146,7 @@ private void setScriptBindings() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(String[] args) throws ScriptException, NoSuchMethodException, IOException {
|
public void run(String[] args) throws ScriptException, NoSuchMethodException, IOException {
|
||||||
|
preLoad();
|
||||||
loadScript(Launcher.INIT_SCRIPT_FILE);
|
loadScript(Launcher.INIT_SCRIPT_FILE);
|
||||||
LogHelper.info("Invoking start() function");
|
LogHelper.info("Invoking start() function");
|
||||||
Launcher.modulesManager.postInitModules();
|
Launcher.modulesManager.postInitModules();
|
||||||
|
@ -154,8 +156,12 @@ public void run(String[] args) throws ScriptException, NoSuchMethodException, IO
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preLoad() throws IOException, ScriptException {
|
public void preLoad() throws IOException, ScriptException {
|
||||||
|
if(!isPreLoaded)
|
||||||
|
{
|
||||||
loadScript(Launcher.API_SCRIPT_FILE);
|
loadScript(Launcher.API_SCRIPT_FILE);
|
||||||
loadScript(Launcher.CONFIG_SCRIPT_FILE);
|
loadScript(Launcher.CONFIG_SCRIPT_FILE);
|
||||||
|
isPreLoaded = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue