mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FEATURE] getJVMTotalMemory
This commit is contained in:
parent
44a4feacde
commit
517ffbd371
2 changed files with 21 additions and 2 deletions
|
@ -29,9 +29,9 @@ var settingsClass = Java.extend(LauncherSettingsClass.static, {
|
||||||
|
|
||||||
setRAM: function(ram) {
|
setRAM: function(ram) {
|
||||||
if (ram>762&&ram<1024){
|
if (ram>762&&ram<1024){
|
||||||
settings.ram = java.lang.Math["min(int,int)"](ram, FunctionalBridge.getTotalMemory());
|
settings.ram = java.lang.Math["min(int,int)"](ram, FunctionalBridge.getJVMTotalMemory());
|
||||||
}else{
|
}else{
|
||||||
settings.ram = java.lang.Math["min(int,int)"](((ram / 256) | 0) * 256, FunctionalBridge.getTotalMemory());
|
settings.ram = java.lang.Math["min(int,int)"](((ram / 256) | 0) * 256, FunctionalBridge.getJVMTotalMemory());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import javafx.concurrent.Task;
|
import javafx.concurrent.Task;
|
||||||
import ru.gravit.launcher.HWID;
|
import ru.gravit.launcher.HWID;
|
||||||
import ru.gravit.launcher.LauncherAPI;
|
import ru.gravit.launcher.LauncherAPI;
|
||||||
|
import ru.gravit.launcher.guard.LauncherGuardManager;
|
||||||
import ru.gravit.launcher.hasher.FileNameMatcher;
|
import ru.gravit.launcher.hasher.FileNameMatcher;
|
||||||
import ru.gravit.launcher.hasher.HashedDir;
|
import ru.gravit.launcher.hasher.HashedDir;
|
||||||
import ru.gravit.launcher.hwid.OshiHWIDProvider;
|
import ru.gravit.launcher.hwid.OshiHWIDProvider;
|
||||||
|
@ -79,6 +80,24 @@ public static long getTotalMemory() {
|
||||||
return hwidProvider.getTotalMemory() >> 20;
|
return hwidProvider.getTotalMemory() >> 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@LauncherAPI
|
||||||
|
public static int getClientJVMBits()
|
||||||
|
{
|
||||||
|
return LauncherGuardManager.guard.getClientJVMBits();
|
||||||
|
}
|
||||||
|
@LauncherAPI
|
||||||
|
public static long getJVMTotalMemory()
|
||||||
|
{
|
||||||
|
if(getClientJVMBits() == 32)
|
||||||
|
{
|
||||||
|
return Math.min(getTotalMemory(),1536);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return getTotalMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static HasherStore getDefaultHasherStore() {
|
public static HasherStore getDefaultHasherStore() {
|
||||||
return HasherManager.getDefaultStore();
|
return HasherManager.getDefaultStore();
|
||||||
|
|
Loading…
Reference in a new issue