mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 11:15:12 -04:00
Made max mem configurable.
This commit is contained in:
parent
a69c09e4be
commit
9535cad412
@ -254,6 +254,14 @@ opencomputers {
|
||||
# scaled up to 96KB, `computer.totalMemory` will return 64KB, and if there
|
||||
# are really 45KB free, `computer.freeMemory` will return 32KB.
|
||||
ramScaleFor64Bit: 1.8
|
||||
|
||||
# The total maximum amount of memory a Lua machine may use for user
|
||||
# programs. The total amount made available by components cannot
|
||||
# exceed this. The default is 64*1024*1024. Keep in mind that this does
|
||||
# not include memory reserved for built-in code such as `machine.lua`.
|
||||
# IMPORTANT: DO NOT MESS WITH THIS UNLESS YOU KNOW WHAT YOU'RE DOING.
|
||||
# IN PARTICULAR, DO NOT REPORT ISSUES AFTER MESSING WITH THIS!
|
||||
maxTotalRam: 67108864
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,6 +86,7 @@ class Settings(val config: Config) {
|
||||
Array(192, 256, 384, 512, 768, 1024)
|
||||
}
|
||||
val ramScaleFor64Bit = config.getDouble("computer.lua.ramScaleFor64Bit") max 1
|
||||
val maxTotalRam = config.getInt("computer.lua.maxTotalRam") max 0
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
// robot
|
||||
|
@ -160,7 +160,7 @@ abstract class NativeLuaArchitecture(val machine: api.machine.Machine) extends A
|
||||
private def memoryInBytes(components: java.lang.Iterable[ItemStack]) = components.foldLeft(0.0)((acc, stack) => acc + (Option(api.Driver.driverFor(stack)) match {
|
||||
case Some(driver: Memory) => driver.amount(stack) * 1024
|
||||
case _ => 0
|
||||
})).toInt max 0 min 50000000
|
||||
})).toInt max 0 min Settings.get.maxTotalRam
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
|
@ -105,7 +105,7 @@ class LuaJLuaArchitecture(val machine: api.machine.Machine) extends Architecture
|
||||
private def memoryInBytes(components: java.lang.Iterable[ItemStack]) = components.foldLeft(0.0)((acc, stack) => acc + (Option(api.Driver.driverFor(stack)) match {
|
||||
case Some(driver: Memory) => driver.amount(stack) * 1024
|
||||
case _ => 0
|
||||
})).toInt max 0 min 50000000
|
||||
})).toInt max 0 min Settings.get.maxTotalRam
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user