Добавление своей jvm в runtime (#302)

* Signed-off-by: LoomeL <kotgeorgy01@gmail.com>

* Загрузка своей JVM

* Поправка настройки по умолчанию
This commit is contained in:
LoomeL 2019-07-03 19:31:35 +06:00 committed by Gravit
parent 493fbf8f2b
commit 67662dfdac
3 changed files with 61 additions and 18 deletions

View file

@ -16,6 +16,12 @@ var config = {
autoEnterDefault: false, // Should autoEnter be enabled by default? autoEnterDefault: false, // Should autoEnter be enabled by default?
fullScreenDefault: false, // Should fullScreen be enabled by default? fullScreenDefault: false, // Should fullScreen be enabled by default?
ramDefault: 1024, // Default RAM amount (0 for auto) ramDefault: 1024, // Default RAM amount (0 for auto)
jvm: {
enable: false,
jvmMustdie32Dir: "jre-8u202-win32",
jvmMustdie64Dir: "jre-8u202-win64",
}
}; };
DirBridge.dir = DirBridge.getLauncherDir(config.dir); DirBridge.dir = DirBridge.getLauncherDir(config.dir);

View file

@ -305,7 +305,31 @@ function doAuth(login, rsaPassword, auth_type) {
function doUpdate(profile, pp, accessToken) { function doUpdate(profile, pp, accessToken) {
var digest = profile.isUpdateFastCheck(); var digest = profile.isUpdateFastCheck();
overlay.swap(0, update.overlay, function(event) { overlay.swap(0, update.overlay, function(event) {
if (config.jvm.enable) {
makeSetProfileRequest(profile, function() {
ClientLauncher.setProfile(profile);
var jvmDir = settings.updatesDir.resolve(jvmDirName);
update.resetOverlay("Обновление файлов JVM");
makeUpdateRequest(jvmDirName, jvmDir, null, digest, function(jvmHDir) {
ClientLauncher.setJavaBinPath(jvmDir);
update.resetOverlay("Обновление файлов ресурсов");
var assetDirName = profile.getAssetDir();
var assetDir = settings.updatesDir.resolve(assetDirName);
var assetMatcher = profile.getAssetUpdateMatcher();
makeUpdateRequest(assetDirName, assetDir, assetMatcher, digest, function(assetHDir) {
settings.putHDir(assetDirName, assetDir, assetHDir.hdir);
update.resetOverlay("Обновление файлов клиента");
var clientDirName = profile.getDir();
var clientDir = settings.updatesDir.resolve(clientDirName);
var clientMatcher = profile.getClientUpdateMatcher();
makeUpdateRequest(clientDirName, clientDir, clientMatcher, digest, function(clientHDir) {
settings.putHDir(clientDirName, clientDir, clientHDir.hdir);
doLaunchClient(assetDir, assetHDir.hdir, clientDir, clientHDir.hdir, profile, pp, accessToken);
});
});
});
});
} else {
update.resetOverlay("Обновление файлов ресурсов"); update.resetOverlay("Обновление файлов ресурсов");
var assetDirName = profile.getAssetDir(); var assetDirName = profile.getAssetDir();
var assetDir = settings.updatesDir.resolve(assetDirName); var assetDir = settings.updatesDir.resolve(assetDirName);
@ -325,6 +349,7 @@ function doUpdate(profile, pp, accessToken) {
}); });
}); });
}); });
}
}); });
} }

View file

@ -79,6 +79,18 @@ function setRootParent(parent) {
function start(args) { function start(args) {
if (config.jvm.enable) {
switch (JVMHelper.OS_TYPE) {
case JVMHelperOS.MUSTDIE:
jvmDirName = JVMHelper.OS_BITS === 32 ? config.jvm.jvmMustdie32Dir :
jvmDirName = JVMHelper.OS_BITS === 64 ? config.jvm.jvmMustdie64Dir : config.jvm.enable = false;
break;
default:
config.jvm.enable = false;
break;
}
}
LogHelper.debug("Setting FX properties"); LogHelper.debug("Setting FX properties");
java.lang.System.setProperty("prism.lcdtext", "false"); java.lang.System.setProperty("prism.lcdtext", "false");