Получение объема памяти с помощью OSHI

This commit is contained in:
Gravit 2018-12-06 10:24:02 +07:00
parent 6f4a4b60bc
commit f6b0255ee6
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
2 changed files with 7 additions and 2 deletions

View file

@ -29,9 +29,9 @@ var settingsClass = Java.extend(LauncherSettingsClass.static, {
setRAM: function(ram) {
if (ram>762&&ram<1024){
settings.ram = java.lang.Math["min(int,int)"](ram, JVMHelper.RAM);
settings.ram = java.lang.Math["min(int,int)"](ram, FunctionalBridge.getTotalMemory());
}else{
settings.ram = java.lang.Math["min(int,int)"](((ram / 256) | 0) * 256, JVMHelper.RAM);
settings.ram = java.lang.Math["min(int,int)"](((ram / 256) | 0) * 256, FunctionalBridge.getTotalMemory());
}
},
});

View file

@ -69,6 +69,11 @@ public static HWID getHWID()
{
return hwidProvider.getHWID();
}
@LauncherAPI
public static long getTotalMemory()
{
return hwidProvider.getTotalMemory() >> 20;
}
@FunctionalInterface
public interface HashedDirRunnable {