mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-25 05:55:41 -04:00
Merge pull request #81 from asiekierka/gtnh-oc-1.8.0-20220928
Update to latest upstream
This commit is contained in:
commit
e4a5321202
32
changelog.md
32
changelog.md
@ -1,19 +1,29 @@
|
||||
## New Features/Support
|
||||
|
||||
* Fixed: Adjusted version check to support the newer GitHub tag format.
|
||||
* Fixed: [#2883] Allowing any domain through if a whitelisted domain failed to resolve.
|
||||
* (1.12.2) Fixed: Block/item color regression (introduced in OpenComputers 1.7.6).
|
||||
* Fixed: [#3547] Character glyph regressions (introduced in OpenComputers 1.7.6).
|
||||
* Fixed: [#3004] Incorrect damage/metadata values on Cable items.
|
||||
* (1.12.2) Fixed: [#3546] Incorrect version number reported by mod.
|
||||
* (1.12.2) Fixed: Reflection call regression (introduced in OpenComputers 1.7.6).
|
||||
* (1.12.2) Fixed: [#2902] Thread race condition crash when rendering some blocks.
|
||||
* Added: Experimental Lua 5.4 support (Lua 5.4.4).
|
||||
* For now, this is hidden behind a configuration option.
|
||||
* Added: Forestry circuit boards' internal layout is now available to Lua scripts.
|
||||
* Added: Major upgrade of Lua libraries.
|
||||
* Updated LuaJ to 3.0.2 with many third-party patches applied.
|
||||
* JNLua is now compiled with proper optimizations - ~2x better performance!
|
||||
* Lua 5.2 has been updated with gamax92's backported bugfixes.
|
||||
* Lua 5.3 has been updated from 5.3.2 to 5.3.6.
|
||||
* 64-bit integers in calls should now be handled properly.
|
||||
* Added: Official support for AArch64 on Linux and macOS.
|
||||
* Added: Subtle indentations to Redstone I/O texture.
|
||||
* The amount of darkened dots on each side marks the ordinal number of the side it responds to.
|
||||
* Added: Support for non-BMP Unicode codepoints!
|
||||
* To clarify, Unicode characters >= 0x10000 should now be fully supported - as long as they're provided in the font.
|
||||
* Changed: New limitFlightHeight configuration definition.
|
||||
* This allows values above 256 to be used, which may be useful for Cubic Chunks users.
|
||||
* Changed: The game now crashes instead of reloading defaults if a config file is present but invalid.
|
||||
* Removed: Native Lua library support for FreeBSD and x86 macOS.
|
||||
* (1.7.10) Fixed: [#3239] Inconsistencies in Robot block clicking.
|
||||
|
||||
## OpenOS fixes/improvements
|
||||
|
||||
* Fixed: /bin/edit not working on Lua 5.2 (introduced in OpenOS 1.7.6).
|
||||
* Fixed: Reverted "[#3196] Env pass in 'sh' command." due to a regression.
|
||||
* Fixed: [#3558] Invalid file modification timestamps in /bin/ls.
|
||||
|
||||
## List of contributors
|
||||
|
||||
payonel, asie
|
||||
asie, payonel, Smok1e
|
||||
|
@ -1,9 +1,9 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
shadeCompile name: 'OC-LuaJ', version: '20220904.0', ext: 'jar'
|
||||
shadeCompile name: 'OC-JNLua', version: '20220904.0', ext: 'jar'
|
||||
shadeCompile name: 'OC-JNLua-Natives', version: '20220904.0', ext: 'jar'
|
||||
shadeCompile name: 'OC-LuaJ', version: '20220907.1', ext: 'jar'
|
||||
shadeCompile name: 'OC-JNLua', version: '20220928.0', ext: 'jar'
|
||||
shadeCompile name: 'OC-JNLua-Natives', version: '20220928.0', ext: 'jar'
|
||||
|
||||
compile("com.google.code.findbugs:jsr305:3.0.2")
|
||||
|
||||
|
@ -1511,10 +1511,21 @@ opencomputers {
|
||||
# to work.
|
||||
logFullNativeLibLoadErrors: false
|
||||
|
||||
# Force loading one specific library, to avoid trying to load any
|
||||
# others. Use this if you get warnings in the log or are told to do
|
||||
# so for debugging purposes ;-)
|
||||
forceNativeLibWithName: ""
|
||||
# Force the platform name for the native libraries, instead of relying
|
||||
# on auto-detecting it. Use this if your system is using an otherwise
|
||||
# unsupported operating system or CPU architecture. If unsure, leave blank.
|
||||
#
|
||||
# Examples of platform strings include "solaris-x86_64" for 64-bit Solaris,
|
||||
# or "windows-aarch64" for Windows on the aarch64 (64-bit arm) architecture.
|
||||
forceNativeLibPlatform: ""
|
||||
|
||||
# Force the native library loader to check the specified directory for natives first,
|
||||
# before trying to find libraries packaged with OpenComputers. Use this if you want to
|
||||
# use custom native libraries, or are on an unsupported platform. If unsure, leave blank.
|
||||
#
|
||||
# This can be an absolute or relative path. If relative, the base directory will be the .minecraft
|
||||
# directory of the running Minecraft instance.
|
||||
forceNativeLibPathFirst: ""
|
||||
|
||||
# Used to suppress log spam for OpenGL errors on derpy drivers. I'm
|
||||
# quite certain the code in the font render is valid, display list
|
||||
@ -1585,15 +1596,17 @@ opencomputers {
|
||||
|
||||
# Chunkloader Upgrade settings.
|
||||
chunkloader {
|
||||
# This is a list of blacklisted dimensions. Chunkloaders may only be activated
|
||||
# in dimensions that aren't present in this list.
|
||||
# This is a list of blacklisted dimensions in the form of numeric IDs.
|
||||
# Chunkloaders may only be activated in dimensions that aren't present in
|
||||
# this list.
|
||||
dimBlacklist: []
|
||||
|
||||
# This is a list of whitelisted dimensions. Chunkloaders may only be activated
|
||||
# in dimensions that are present in this list. If this list is empty,
|
||||
# chunkloaders may be activated to all dimensions not blacklisted. Note that the
|
||||
# blacklist is always applied, so if an entry is present in both the
|
||||
# whitelist and the blacklist, the blacklist will win.
|
||||
# This is a list of whitelisted dimensions in the form of numeric IDs.
|
||||
# Chunkloaders may only be activated in dimensions that are present in
|
||||
# this list. If this list is empty, chunkloaders may be activated to all
|
||||
# dimensions not blacklisted. Note that the blacklist is always applied,
|
||||
# so if an entry is present in both the whitelist and the blacklist, the
|
||||
# blacklist will win.
|
||||
dimWhitelist: []
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
-- called from /init.lua
|
||||
local raw_loadfile = ...
|
||||
|
||||
_G._OSVERSION = "OpenOS 1.7.7"
|
||||
_G._OSVERSION = "OpenOS 1.8.0-snapshot"
|
||||
|
||||
-- luacheck: globals component computer unicode _OSVERSION
|
||||
local component = component
|
||||
|
@ -310,7 +310,7 @@ local function stat(path, name)
|
||||
info.sort_name = info.name:gsub("^%.","")
|
||||
info.isLink, info.link = fs.isLink(info.full_path)
|
||||
info.size = info.isLink and 0 or fs.size(info.full_path)
|
||||
info.time = fs.lastModified(info.full_path)
|
||||
info.time = fs.lastModified(info.full_path)/1000
|
||||
info.fs = fs.get(info.full_path)
|
||||
info.ext = info.name:match("(%.[^.]+)$") or ""
|
||||
return info
|
||||
|
@ -439,7 +439,8 @@ class Settings(val config: Config) {
|
||||
val limitMemory = !config.getBoolean("debug.disableMemoryLimit")
|
||||
val forceCaseInsensitive = config.getBoolean("debug.forceCaseInsensitiveFS")
|
||||
val logFullLibLoadErrors = config.getBoolean("debug.logFullNativeLibLoadErrors")
|
||||
val forceNativeLib = config.getString("debug.forceNativeLibWithName")
|
||||
val forceNativeLibPlatform = config.getString("debug.forceNativeLibPlatform")
|
||||
val forceNativeLibPathFirst = config.getString("debug.forceNativeLibPathFirst")
|
||||
val logOpenGLErrors = config.getBoolean("debug.logOpenGLErrors")
|
||||
val logHexFontErrors = config.getBoolean("debug.logHexFontErrors")
|
||||
val alwaysTryNative = config.getBoolean("debug.alwaysTryNative")
|
||||
@ -519,7 +520,7 @@ object Settings {
|
||||
catch {
|
||||
case e: Throwable =>
|
||||
if (file.exists()) {
|
||||
OpenComputers.log.warn("Failed loading config, using defaults.", e)
|
||||
throw new RuntimeException("Error parsing configuration file. To restore defaults, delete '" + file.getName + "' and restart the game.", e)
|
||||
}
|
||||
settings = new Settings(defaults.getConfig("opencomputers"))
|
||||
defaults
|
||||
|
@ -86,7 +86,10 @@ object ScreenRenderer extends TileEntitySpecialRenderer {
|
||||
RenderState.checkError(getClass.getName + ".renderTileEntityAt: fade")
|
||||
|
||||
if (screen.buffer.isRenderingEnabled) {
|
||||
val profiler = Minecraft.getMinecraft.mcProfiler
|
||||
profiler.startSection("opencomputers:screen_text")
|
||||
draw()
|
||||
profiler.endSection()
|
||||
}
|
||||
|
||||
RenderState.enableLighting()
|
||||
|
@ -4,8 +4,8 @@ import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.io.FileOutputStream
|
||||
import java.nio.channels.Channels
|
||||
import java.nio.file.Paths
|
||||
import java.util.regex.Pattern
|
||||
|
||||
import com.google.common.base.Strings
|
||||
import com.google.common.io.PatternFilenameFilter
|
||||
import li.cil.oc.OpenComputers
|
||||
@ -130,36 +130,39 @@ abstract class LuaStateFactory {
|
||||
private var currentLib = ""
|
||||
|
||||
private val libraryName = {
|
||||
if (!Strings.isNullOrEmpty(Settings.get.forceNativeLib)) Settings.get.forceNativeLib
|
||||
|
||||
else {
|
||||
val libExtension = {
|
||||
if (SystemUtils.IS_OS_MAC) ".dylib"
|
||||
else if (SystemUtils.IS_OS_WINDOWS) ".dll"
|
||||
else ".so"
|
||||
}
|
||||
|
||||
val systemName = {
|
||||
if (SystemUtils.IS_OS_FREE_BSD) "freebsd"
|
||||
else if (SystemUtils.IS_OS_NET_BSD) "netbsd"
|
||||
else if (SystemUtils.IS_OS_OPEN_BSD) "openbsd"
|
||||
else if (SystemUtils.IS_OS_SOLARIS) "solaris"
|
||||
else if (SystemUtils.IS_OS_LINUX) "linux"
|
||||
else if (SystemUtils.IS_OS_MAC) "darwin"
|
||||
else if (SystemUtils.IS_OS_WINDOWS) "windows"
|
||||
else "unknown"
|
||||
}
|
||||
|
||||
val archName = {
|
||||
if (Architecture.IS_OS_ARM64) "aarch64"
|
||||
else if (Architecture.IS_OS_ARM) "arm"
|
||||
else if (Architecture.IS_OS_X64) "x86_64"
|
||||
else if (Architecture.IS_OS_X86) "x86"
|
||||
else "unknown"
|
||||
}
|
||||
|
||||
"libjnlua" + version + "-" + systemName + "-" + archName + libExtension
|
||||
val libExtension = {
|
||||
if (SystemUtils.IS_OS_MAC) ".dylib"
|
||||
else if (SystemUtils.IS_OS_WINDOWS) ".dll"
|
||||
else ".so"
|
||||
}
|
||||
|
||||
val platformName = {
|
||||
if (!Strings.isNullOrEmpty(Settings.get.forceNativeLibPlatform)) Settings.get.forceNativeLibPlatform
|
||||
else {
|
||||
val systemName = {
|
||||
if (SystemUtils.IS_OS_FREE_BSD) "freebsd"
|
||||
else if (SystemUtils.IS_OS_NET_BSD) "netbsd"
|
||||
else if (SystemUtils.IS_OS_OPEN_BSD) "openbsd"
|
||||
else if (SystemUtils.IS_OS_SOLARIS) "solaris"
|
||||
else if (SystemUtils.IS_OS_LINUX) "linux"
|
||||
else if (SystemUtils.IS_OS_MAC) "darwin"
|
||||
else if (SystemUtils.IS_OS_WINDOWS) "windows"
|
||||
else "unknown"
|
||||
}
|
||||
|
||||
val archName = {
|
||||
if (Architecture.IS_OS_ARM64) "aarch64"
|
||||
else if (Architecture.IS_OS_ARM) "arm"
|
||||
else if (Architecture.IS_OS_X64) "x86_64"
|
||||
else if (Architecture.IS_OS_X86) "x86"
|
||||
else "unknown"
|
||||
}
|
||||
|
||||
systemName + "-" + archName
|
||||
}
|
||||
}
|
||||
|
||||
"libjnlua" + version + "-" + platformName + libExtension
|
||||
}
|
||||
|
||||
protected def create(maxMemory: Option[Int] = None): jnlua.LuaState
|
||||
@ -170,13 +173,12 @@ abstract class LuaStateFactory {
|
||||
|
||||
def isAvailable = haveNativeLibrary
|
||||
|
||||
val is64Bit = Architecture.IS_OS_X64
|
||||
|
||||
// Since we use native libraries we have to do some work. This includes
|
||||
// figuring out what we're running on, so that we can load the proper shared
|
||||
// libraries compiled for that system. It also means we have to unpack the
|
||||
// shared libraries somewhere so that we can load them, because we cannot
|
||||
// load them directly from a JAR.
|
||||
// load them directly from a JAR. Lastly, we need to handle library overrides in
|
||||
// case the user wants to use custom libraries, or are not on a supported platform.
|
||||
def init() {
|
||||
if (libraryName == null) {
|
||||
return
|
||||
@ -194,108 +196,123 @@ abstract class LuaStateFactory {
|
||||
}
|
||||
}
|
||||
|
||||
val libraryUrl = classOf[Machine].getResource(s"/assets/${Settings.resourceDomain}/lib/$libraryName")
|
||||
if (libraryUrl == null) {
|
||||
OpenComputers.log.warn(s"Native library with name '$version/$libraryName' not found.")
|
||||
return
|
||||
var tmpLibFile: File = null
|
||||
if (!Strings.isNullOrEmpty(Settings.get.forceNativeLibPathFirst)) {
|
||||
val libraryTest = new File(Settings.get.forceNativeLibPathFirst, libraryName);
|
||||
if (libraryTest.canRead) {
|
||||
tmpLibFile = libraryTest
|
||||
currentLib = libraryTest.getAbsolutePath
|
||||
OpenComputers.log.info(s"Found forced-path filesystem library $currentLib.")
|
||||
}
|
||||
else
|
||||
OpenComputers.log.warn(s"forceNativeLibPathFirst is set, but $currentLib was not found there. Falling back to checking the built-in libraries.")
|
||||
}
|
||||
|
||||
val tmpLibName = s"OpenComputersMod-${OpenComputers.Version}-$version-$libraryName"
|
||||
val tmpBasePath = if (Settings.get.nativeInTmpDir) {
|
||||
val path = System.getProperty("java.io.tmpdir")
|
||||
if (path == null) ""
|
||||
else if (path.endsWith("/") || path.endsWith("\\")) path
|
||||
else path + "/"
|
||||
}
|
||||
else "./"
|
||||
val tmpLibFile = new File(tmpBasePath + tmpLibName)
|
||||
if (currentLib.isEmpty) {
|
||||
val libraryUrl = classOf[Machine].getResource(s"/assets/${Settings.resourceDomain}/lib/$libraryName")
|
||||
if (libraryUrl == null) {
|
||||
OpenComputers.log.warn(s"Native library with name '$libraryName' not found.")
|
||||
return
|
||||
}
|
||||
|
||||
// Clean up old library files when not in tmp dir.
|
||||
if (!Settings.get.nativeInTmpDir) {
|
||||
val libDir = new File(tmpBasePath)
|
||||
if (libDir.isDirectory) {
|
||||
for (file <- libDir.listFiles(new PatternFilenameFilter("^" + Pattern.quote("OpenComputersMod-") + ".*" + Pattern.quote("-" + libraryName) + "$"))) {
|
||||
if (file.compareTo(tmpLibFile) != 0) {
|
||||
file.delete()
|
||||
val tmpLibName = s"OpenComputersMod-${OpenComputers.Version}-$version-$libraryName"
|
||||
val tmpBasePath = if (Settings.get.nativeInTmpDir) {
|
||||
val path = System.getProperty("java.io.tmpdir")
|
||||
if (path == null) ""
|
||||
else if (path.endsWith("/") || path.endsWith("\\")) path
|
||||
else path + "/"
|
||||
}
|
||||
else "./"
|
||||
tmpLibFile = new File(tmpBasePath + tmpLibName)
|
||||
|
||||
// Clean up old library files when not in tmp dir.
|
||||
if (!Settings.get.nativeInTmpDir) {
|
||||
val libDir = new File(tmpBasePath)
|
||||
if (libDir.isDirectory) {
|
||||
for (file <- libDir.listFiles(new PatternFilenameFilter("^" + Pattern.quote("OpenComputersMod-") + ".*" + Pattern.quote("-" + libraryName) + "$"))) {
|
||||
if (file.compareTo(tmpLibFile) != 0) {
|
||||
file.delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the file, already exists, make sure it's the same we need, if it's
|
||||
// not disable use of the natives.
|
||||
if (tmpLibFile.exists()) {
|
||||
var matching = true
|
||||
try {
|
||||
val inCurrent = libraryUrl.openStream()
|
||||
val inExisting = new FileInputStream(tmpLibFile)
|
||||
var inCurrentByte = 0
|
||||
var inExistingByte = 0
|
||||
do {
|
||||
inCurrentByte = inCurrent.read()
|
||||
inExistingByte = inExisting.read()
|
||||
if (inCurrentByte != inExistingByte) {
|
||||
matching = false
|
||||
inCurrentByte = -1
|
||||
inExistingByte = -1
|
||||
}
|
||||
}
|
||||
while (inCurrentByte != -1 && inExistingByte != -1)
|
||||
inCurrent.close()
|
||||
inExisting.close()
|
||||
}
|
||||
catch {
|
||||
case _: Throwable =>
|
||||
matching = false
|
||||
}
|
||||
if (!matching) {
|
||||
// Try to delete an old instance of the library, in case we have an update
|
||||
// and deleteOnExit fails (which it regularly does on Windows it seems).
|
||||
// Note that this should only ever be necessary for dev-builds, where the
|
||||
// version number didn't change (since the version number is part of the name).
|
||||
// If the file, already exists, make sure it's the same we need, if it's
|
||||
// not disable use of the natives.
|
||||
if (tmpLibFile.exists()) {
|
||||
var matching = true
|
||||
try {
|
||||
tmpLibFile.delete()
|
||||
val inCurrent = libraryUrl.openStream()
|
||||
val inExisting = new FileInputStream(tmpLibFile)
|
||||
var inCurrentByte = 0
|
||||
var inExistingByte = 0
|
||||
do {
|
||||
inCurrentByte = inCurrent.read()
|
||||
inExistingByte = inExisting.read()
|
||||
if (inCurrentByte != inExistingByte) {
|
||||
matching = false
|
||||
inCurrentByte = -1
|
||||
inExistingByte = -1
|
||||
}
|
||||
}
|
||||
while (inCurrentByte != -1 && inExistingByte != -1)
|
||||
inCurrent.close()
|
||||
inExisting.close()
|
||||
}
|
||||
catch {
|
||||
case t: Throwable => // Ignore.
|
||||
case _: Throwable =>
|
||||
matching = false
|
||||
}
|
||||
if (tmpLibFile.exists()) {
|
||||
OpenComputers.log.warn(s"Could not update native library '${tmpLibFile.getName}'!")
|
||||
if (!matching) {
|
||||
// Try to delete an old instance of the library, in case we have an update
|
||||
// and deleteOnExit fails (which it regularly does on Windows it seems).
|
||||
// Note that this should only ever be necessary for dev-builds, where the
|
||||
// version number didn't change (since the version number is part of the name).
|
||||
try {
|
||||
tmpLibFile.delete()
|
||||
}
|
||||
catch {
|
||||
case t: Throwable => // Ignore.
|
||||
}
|
||||
if (tmpLibFile.exists()) {
|
||||
OpenComputers.log.warn(s"Could not update native library '${tmpLibFile.getName}'!")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Copy the file contents to the temporary file.
|
||||
try {
|
||||
val in = Channels.newChannel(libraryUrl.openStream())
|
||||
// Copy the file contents to the temporary file.
|
||||
try {
|
||||
val out = new FileOutputStream(tmpLibFile).getChannel
|
||||
val in = Channels.newChannel(libraryUrl.openStream())
|
||||
try {
|
||||
out.transferFrom(in, 0, Long.MaxValue)
|
||||
tmpLibFile.deleteOnExit()
|
||||
// Set file permissions more liberally for multi-user+instance servers.
|
||||
tmpLibFile.setReadable(true, false)
|
||||
tmpLibFile.setWritable(true, false)
|
||||
tmpLibFile.setExecutable(true, false)
|
||||
val out = new FileOutputStream(tmpLibFile).getChannel
|
||||
try {
|
||||
out.transferFrom(in, 0, Long.MaxValue)
|
||||
tmpLibFile.deleteOnExit()
|
||||
// Set file permissions more liberally for multi-user+instance servers.
|
||||
tmpLibFile.setReadable(true, false)
|
||||
tmpLibFile.setWritable(true, false)
|
||||
tmpLibFile.setExecutable(true, false)
|
||||
}
|
||||
finally {
|
||||
out.close()
|
||||
}
|
||||
}
|
||||
finally {
|
||||
out.close()
|
||||
in.close()
|
||||
}
|
||||
}
|
||||
finally {
|
||||
in.close()
|
||||
catch {
|
||||
// Java (or Windows?) locks the library file when opening it, so any
|
||||
// further tries to update it while another instance is still running
|
||||
// will fail. We still want to try each time, since the files may have
|
||||
// been updated.
|
||||
// Alternatively, the file could not be opened for reading/writing.
|
||||
case t: Throwable => // Nothing.
|
||||
}
|
||||
// Try to load the lib.
|
||||
currentLib = tmpLibFile.getAbsolutePath
|
||||
}
|
||||
catch {
|
||||
// Java (or Windows?) locks the library file when opening it, so any
|
||||
// further tries to update it while another instance is still running
|
||||
// will fail. We still want to try each time, since the files may have
|
||||
// been updated.
|
||||
// Alternatively, the file could not be opened for reading/writing.
|
||||
case t: Throwable => // Nothing.
|
||||
}
|
||||
// Try to load the lib.
|
||||
currentLib = tmpLibFile.getAbsolutePath
|
||||
|
||||
try {
|
||||
LuaStateFactory.synchronized {
|
||||
System.load(currentLib)
|
||||
|
@ -42,7 +42,7 @@ abstract class NativeLuaArchitecture(val machine: api.machine.Machine) extends A
|
||||
|
||||
private[machine] var kernelMemory = 0
|
||||
|
||||
private[machine] val ramScale = if (factory.is64Bit) Settings.get.ramScaleFor64Bit else 1.0
|
||||
private[machine] var ramScale: Double = 1.0
|
||||
|
||||
private val persistence = new PersistenceAPI(this)
|
||||
|
||||
@ -150,16 +150,16 @@ abstract class NativeLuaArchitecture(val machine: api.machine.Machine) extends A
|
||||
override def isInitialized = kernelMemory > 0
|
||||
|
||||
override def recomputeMemory(components: java.lang.Iterable[ItemStack]) = {
|
||||
val memory = math.ceil(memoryInBytes(components) * ramScale).toInt
|
||||
val memoryBytes = memoryInBytes(components)
|
||||
Option(lua) match {
|
||||
case Some(l) if Settings.get.limitMemory =>
|
||||
l.setTotalMemory(Int.MaxValue)
|
||||
if (kernelMemory > 0) {
|
||||
l.setTotalMemory(kernelMemory + memory)
|
||||
l.setTotalMemory(kernelMemory + math.ceil(memoryBytes * ramScale).toInt)
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
memory > 0
|
||||
memoryBytes > 0
|
||||
}
|
||||
|
||||
private def memoryInBytes(components: java.lang.Iterable[ItemStack]) = components.foldLeft(0.0)((acc, stack) => acc + (Option(api.Driver.driverFor(stack)) match {
|
||||
@ -314,6 +314,7 @@ abstract class NativeLuaArchitecture(val machine: api.machine.Machine) extends A
|
||||
return false
|
||||
case Some(value) => lua = value
|
||||
}
|
||||
ramScale = if (lua.getPointerWidth >= 8) Settings.get.ramScaleFor64Bit else 1.0
|
||||
|
||||
apis.foreach(_.initialize())
|
||||
|
||||
|
@ -81,9 +81,6 @@ object ExtendedLuaState {
|
||||
}
|
||||
// Bring table back to top (in case memo values were pushed).
|
||||
lua.pushValue(tableIndex)
|
||||
lua.pushString("n")
|
||||
lua.pushInteger(count)
|
||||
lua.rawSet(-3)
|
||||
}
|
||||
|
||||
def pushTable(obj: AnyRef, map: Map[_, _], memo: util.IdentityHashMap[Any, Int]) {
|
||||
|
@ -59,9 +59,7 @@ object ScalaClosure {
|
||||
}
|
||||
|
||||
def toLuaList(value: Iterable[Any]): LuaValue = {
|
||||
val table = LuaValue.listOf(value.map(toLuaValue).toArray)
|
||||
table.set("n", table.length())
|
||||
table
|
||||
LuaValue.listOf(value.map(toLuaValue).toArray)
|
||||
}
|
||||
|
||||
def toLuaTable(value: Map[_, _]): LuaValue = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user