mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FEATURE] Упрощение добавления своего HWIDProvider
This commit is contained in:
parent
6cc18ec1b8
commit
9fb3d44d6a
1 changed files with 10 additions and 6 deletions
|
@ -24,7 +24,7 @@ public class FunctionalBridge {
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(0);
|
public static ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(0);
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static OshiHWIDProvider hwidProvider = new OshiHWIDProvider();
|
public static OshiHWIDProvider hwidProvider;
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static AtomicReference<HWID> hwid = new AtomicReference<>();
|
public static AtomicReference<HWID> hwid = new AtomicReference<>();
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
|
@ -51,14 +51,18 @@ public static void startTask(Runnable task) {
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static HWID getHWID() {
|
public static HWID getHWID() {
|
||||||
HWID hhwid = hwid.get();
|
HWID hhwid = hwid.get();
|
||||||
if (hhwid == null) hwid.set(hwidProvider.getHWID());
|
if (hhwid == null) {
|
||||||
|
if(hwidProvider == null) hwidProvider = new OshiHWIDProvider();
|
||||||
|
hwid.set(hwidProvider.getHWID());
|
||||||
|
}
|
||||||
return hhwid;
|
return hhwid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static int getTotalMemory() {
|
public static long getTotalMemory() {
|
||||||
if (cachedMemorySize > 0) return (int) cachedMemorySize;
|
if (cachedMemorySize > 0) return cachedMemorySize;
|
||||||
return (int) (cachedMemorySize = hwidProvider.getTotalMemory() >> 20);
|
if(hwidProvider == null) hwidProvider = new OshiHWIDProvider();
|
||||||
|
return (cachedMemorySize = hwidProvider.getTotalMemory() >> 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
|
@ -67,7 +71,7 @@ public static int getClientJVMBits() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static int getJVMTotalMemory() {
|
public static long getJVMTotalMemory() {
|
||||||
if (getClientJVMBits() == 32) {
|
if (getClientJVMBits() == 32) {
|
||||||
return Math.min(getTotalMemory(), 1536);
|
return Math.min(getTotalMemory(), 1536);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue