Merge branch 'dev' of github.com:GravitLauncher/Launcher into dev

This commit is contained in:
Gravit 2019-07-04 14:42:38 +07:00
commit 4b8a336ba0
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
5 changed files with 66 additions and 19 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,26 +305,51 @@ 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) {
update.resetOverlay("Обновление файлов ресурсов"); makeSetProfileRequest(profile, function() {
var assetDirName = profile.getAssetDir(); ClientLauncher.setProfile(profile);
var assetDir = settings.updatesDir.resolve(assetDirName); var jvmDir = settings.updatesDir.resolve(jvmDirName);
var assetMatcher = profile.getAssetUpdateMatcher(); update.resetOverlay("Обновление файлов JVM");
makeSetProfileRequest(profile, function() { makeUpdateRequest(jvmDirName, jvmDir, null, digest, function(jvmHDir) {
ClientLauncher.setProfile(profile); ClientLauncher.setJavaBinPath(jvmDir);
makeUpdateRequest(assetDirName, assetDir, assetMatcher, digest, function(assetHDir) { update.resetOverlay("Обновление файлов ресурсов");
settings.putHDir(assetDirName, assetDir, assetHDir.hdir); var assetDirName = profile.getAssetDir();
var assetDir = settings.updatesDir.resolve(assetDirName);
update.resetOverlay("Обновление файлов клиента"); var assetMatcher = profile.getAssetUpdateMatcher();
var clientDirName = profile.getDir(); makeUpdateRequest(assetDirName, assetDir, assetMatcher, digest, function(assetHDir) {
var clientDir = settings.updatesDir.resolve(clientDirName); settings.putHDir(assetDirName, assetDir, assetHDir.hdir);
var clientMatcher = profile.getClientUpdateMatcher(); update.resetOverlay("Обновление файлов клиента");
makeUpdateRequest(clientDirName, clientDir, clientMatcher, digest, function(clientHDir) { var clientDirName = profile.getDir();
settings.putHDir(clientDirName, clientDir, clientHDir.hdir); var clientDir = settings.updatesDir.resolve(clientDirName);
doLaunchClient(assetDir, assetHDir.hdir, clientDir, clientHDir.hdir, profile, pp, accessToken); 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("Обновление файлов ресурсов");
var assetDirName = profile.getAssetDir();
var assetDir = settings.updatesDir.resolve(assetDirName);
var assetMatcher = profile.getAssetUpdateMatcher();
makeSetProfileRequest(profile, function() {
ClientLauncher.setProfile(profile);
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);
});
});
});
}
}); });
} }

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");

View file

@ -35,7 +35,10 @@ public enum Version {
MC113("1.13", 393), MC113("1.13", 393),
MC1131("1.13.1", 401), MC1131("1.13.1", 401),
MC1132("1.13.2", 402), MC1132("1.13.2", 402),
MC114("1.14", 477); MC114("1.14", 477),
MC1141("1.14.1", 480),
MC1142("1.14.2", 485),
MC1143("1.14.3", 490);
private static final Map<String, Version> VERSIONS; private static final Map<String, Version> VERSIONS;
static { static {

View file

@ -62,6 +62,7 @@
import pro.gravit.launcher.LauncherAPI; import pro.gravit.launcher.LauncherAPI;
public final class IOHelper { public final class IOHelper {
public static final long MB32 = 1 << 25;
private static final class DeleteDirVisitor extends SimpleFileVisitor<Path> { private static final class DeleteDirVisitor extends SimpleFileVisitor<Path> {
private final Path dir; private final Path dir;
private final boolean self; private final boolean self;