Initial work on Java tab. Added custom range slider.

Also added two more settings tabs. These are experimental and subject to change.
This commit is contained in:
Daniel Scalzi
2018-06-11 22:11:05 -04:00
parent 08eb04775e
commit db7ba0d450
4 changed files with 175 additions and 1 deletions

View File

@@ -9,11 +9,26 @@ const dataPath = path.join(sysRoot, '.westeroscraft')
const firstLaunch = !fs.existsSync(dataPath)
exports.getAbsoluteMinRAM = function(){
const mem = os.totalmem()
return mem >= 6000000000 ? 3 : 2
}
exports.getAbsoluteMaxRAM = function(){
const mem = os.totalmem()
const gT16 = mem-16000000000
return Math.floor((mem-1000000000-(gT16 > 0 ? (Number.parseInt(gT16/8) + 16000000000/4) : mem/4))/1000000000)
}
function resolveMaxRAM(){
const mem = os.totalmem()
return mem >= 8000000000 ? '4G' : (mem >= 6000000000 ? '3G' : '2G')
}
function resolveMinRAM(){
return exports.getAbsoluteMinRAM() + 'G'
}
/**
* Three types of values:
* Static = Explicitly declared.
@@ -23,7 +38,7 @@ function resolveMaxRAM(){
const DEFAULT_CONFIG = {
settings: {
java: {
minRAM: '2G',
minRAM: resolveMinRAM(),
maxRAM: resolveMaxRAM(), // Dynamic
executable: null,
jvmOptions: [