diff --git a/build.properties b/build.properties index 0950bdf29..1ca07ab44 100644 --- a/build.properties +++ b/build.properties @@ -5,7 +5,7 @@ forge.version=14.23.5.2860 mod.name=OpenComputers mod.group=li.cil.oc -mod.version=1.7.6 +mod.version=1.7.7 ae2.version=rv6-stable-7 buildcraft.version=7.99.24.8 diff --git a/changelog.md b/changelog.md index f4646c918..2af5bbac1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,89 +1,19 @@ ## New Features/Support -* Added: Access to waypoint address UUIDs in the Navigation Upgrade. (hohserg1) -* Added: [#779] Graphics Card video RAM system. - - Graphics Cards now have multiple internal video RAM buffers, which can be allocated and freed. - - Reads and writes to Video RAM have zero costs. - - Writing to the text buffer outside of the viewport now has zero costs. -* Added: More complete Unicode support! - - Unscii has been upgraded to version 2.1 (with funscii patches). - - Unifont 14.0.04 can now be used to fill in missing glyphs, thanks to the license change. - - The above mean that OpenComputers now supports the near-complete Unicode Basic Multilingual Plane. -* Added: More Upgrades now have a descriptive tooltip. -* Added: New mod integrations: - - GregTech: Seismic Prospector data reading. (repo-alt) - - Thaumic Energistics: Distillation pattern aspect information. (repo-alt) -* Changed: Block 0.0.0.0/8 from internet card by default. (divergentdave) -* Changed: Game logs now contain the dimension when reporting a machine's position. (D-Cysteine, repo-alt) -* Changed: Make Lua BIOS take use tail call optimisation. (skyem123) -* Changed: [#3440] 'media()' is now implemented on Server disk drives. -* Changed: Motion Sensor now considers both feet and eyes when checking for the visibility of an entity. -* Changed: The default CPU architecture is now Lua 5.3. -* Changed: When creating a new Rack, the "Relay Mode" is now disabled by default. -* Misc: Updated the following translations: - - Chinese (Low-power) - - German (JakobDev) - - Portuguese (guilherme-puida) - - Russian (Fingercomp, Smollet777) -* (1.7.10) Fixed: AE2 filtering by keys which are not always present. -* Fixed: AE2 item stack sizes larger than 2^31-1. -* Fixed: Barcode Reader upgrade crash when scanning anything that is not a valid target. (AmandaCameron) -* Fixed: [#3509] ByteBufInputStream memory leak. -* Fixed: [#3187] Crash with CodeChickenLib and IC2 installed. -* Fixed: [#3247] Disassembler accepted whole stack via direct inventory access. -* Fixed: [#3254] Edge case issues with Hologram copy(). -* Fixed: [#2999, #3225] Edge case issues with deleting computer/robot persistence data. -* (1.12.2) Fixed: Ender IO/Project: Red wrench compatibility. -* Fixed: [#3159] Error when calling 'debug.sendToDebugCard()'. -* Fixed: [#3494] Errors when using block GUIs on larger/negative Y values (f.e. with Cubic Chunks). -* Fixed: [#3391] Generator upgrade destroys fuel containers. -* Fixed: Inconsistent 3D print item stacking (Quant1um). -* Fixed: [#2911] Inconsistent values used by getGameType() and setGameType() in Debug Card. -* (1.12.2) Fixed: [#3472] Incorrect 3D print lighting. -* Fixed: [#3226] Incorrect Hard Drive reported maximum stack size when formatted. -* Fixed: [#3084] Incorrect parsing of the 'maxSignalQueueSize' configuration option. -* Fixed: [#3184] Incorrect redstone card sides inside racks and computers. -* Fixed: [#3182] Incorrect reporting of entity inventory names in Transposer, plus other Transposer interaction issues. -* Fixed: Missing null check for Blood Magic integration. -* Fixed: [#3336] Missing null check for GregTech data stick NBTs. -* Fixed: [#3249] NullPointerException when remote terminal is missing. -* Fixed: Potential edge case crash with the Tank Controller Upgrade. -* Fixed: [#3401] 'rawSetForeground', 'rawSetBackground' not working correctly. -* Fixed: [#3265] Relay 'setStrength' unlimited upper bound. (JamesOrdner) -* (1.7.10) Fixed: [#3540] Server-side crash with Motion Sensor -* Fixed: [#1999] 'string.gsub' patterns now allow numbers. -* Fixed: [#3195] Tier 1 Wireless Cards not receiving messages. -* (1.7.10) Fixed: [#3239] Unnecessary/unwanted canEntityDestroy check in OpenComputers fake player. -* Fixed: Update issues in the Floppy Drive GUI. +* 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. ## OpenOS fixes/improvements -* Changed: Added binary support to 'text.internal.reader'. -* Changed: Errors are now passed back to 'shell.execute'. -* Changed: 'install' no longer clobbers '/etc/rc.cfg' nor '/home/.shrc'. -* Changed: If /home is read-only, a helpful message is displayed to tell the user to run 'install'. -* Changed: Removed '-i' from 'cp' alias. -* Changed: [#3320] VT ABCD should move 1 character by default. -* Changed: [#3305] 'wget' now passes a default user agent. -* Fixed: [#3423] Can't yield from an orphan coroutine. -* Fixed: Crash when calling 'tty.setViewport' without arguments. -* Fixed: [#3499] 'edit' crashing once clicking somewhere. -* Fixed: [#3196] Env pass in 'sh' command. -* Fixed: [#3201] 'io.input' implementation inconsistency. -* Fixed: [#1207] I/O buffer reading splitting UTF-8 sequences. -* Fixed: Minor issues in the OpenOS manpage for 'ls'. (avevad) -* Fixed: [#3308] Out of memory error isn't reported in the shell in certain conditions. -* Fixed: Shift+Backspace handling in '/bin/edit'. -* Numerous small improvements to the codebase. +* 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. ## List of contributors -payonel, asie, -AmandaCameron, avevad, -D-Cysteine, -divergentdave, hohserg1, -JamesOrdner, repo-alt, -Fingercomp, guilherme-puida, -JakobDev, Low-power, -Quant1um, skyem123, -Smollet777 +payonel, asie diff --git a/settings.gradle b/settings.gradle index 09934984c..a3a48683c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -rootProject.name = "OpenComputers" \ No newline at end of file +rootProject.name = "opencomputers-1.12.2-forge" diff --git a/src/main/resources/assets/opencomputers/loot/openos/bin/sh.lua b/src/main/resources/assets/opencomputers/loot/openos/bin/sh.lua index de7a7b1c4..d4e4dd9db 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/bin/sh.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/bin/sh.lua @@ -41,5 +41,5 @@ if #args == 0 then end else -- execute command. - return sh.execute(_ENV, ...) + return sh.execute(...) end diff --git a/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua b/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua index 9209b8e32..b223b2e4e 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua @@ -1,7 +1,7 @@ -- called from /init.lua local raw_loadfile = ... -_G._OSVERSION = "OpenOS 1.7.6" +_G._OSVERSION = "OpenOS 1.7.7" -- luacheck: globals component computer unicode _OSVERSION local component = component diff --git a/src/main/resources/assets/opencomputers/loot/openos/lib/core/full_shell.lua b/src/main/resources/assets/opencomputers/loot/openos/lib/core/full_shell.lua index 7c6701715..2576b07ee 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/lib/core/full_shell.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/lib/core/full_shell.lua @@ -10,8 +10,8 @@ function shell.execute(command, env, ...) if not sh then return false, reason end - local proc = process.load(sh, env, nil, command) - local result = table.pack(process.internal.continue(proc, command, ...)) + local proc = process.load(sh, nil, nil, command) + local result = table.pack(process.internal.continue(proc, env, command, ...)) if result.n == 0 then return true end return table.unpack(result, 1, result.n) end diff --git a/src/main/scala/li/cil/oc/OpenComputers.scala b/src/main/scala/li/cil/oc/OpenComputers.scala index 668d1cf53..c0bdde6d3 100644 --- a/src/main/scala/li/cil/oc/OpenComputers.scala +++ b/src/main/scala/li/cil/oc/OpenComputers.scala @@ -21,6 +21,8 @@ object OpenComputers { final val Name = "OpenComputers" + final val McVersion = "1.12.2-forge" + final val Version = "@VERSION@" def log: Logger = logger.getOrElse(LogManager.getLogger(Name)) diff --git a/src/main/scala/li/cil/oc/Settings.scala b/src/main/scala/li/cil/oc/Settings.scala index 541d0d984..07db68b69 100644 --- a/src/main/scala/li/cil/oc/Settings.scala +++ b/src/main/scala/li/cil/oc/Settings.scala @@ -598,25 +598,25 @@ object Settings { val cidrPattern = """(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(?:/(\d{1,2}))""".r class AddressValidator(val value: String) { - val validator = try cidrPattern.findFirstIn(value) match { + val validator: (InetAddress, String) => Option[Boolean] = try cidrPattern.findFirstIn(value) match { case Some(cidrPattern(address, prefix)) => val addr = InetAddresses.coerceToInteger(InetAddresses.forString(address)) val mask = 0xFFFFFFFF << (32 - prefix.toInt) val min = addr & mask val max = min | ~mask - (inetAddress: InetAddress, host: String) => inetAddress match { + (inetAddress: InetAddress, host: String) => Some(inetAddress match { case v4: Inet4Address => val numeric = InetAddresses.coerceToInteger(v4) min <= numeric && numeric <= max case _ => true // Can't check IPv6 addresses so we pass them. - } + }) case _ => val address = InetAddress.getByName(value) - (inetAddress: InetAddress, host: String) => host == value || inetAddress == address + (inetAddress: InetAddress, host: String) => Some(host == value || inetAddress == address) } catch { case t: Throwable => OpenComputers.log.warn("Invalid entry in internet blacklist / whitelist: " + value, t) - (inetAddress: InetAddress, host: String) => true + (inetAddress: InetAddress, host: String) => None } def apply(inetAddress: InetAddress, host: String) = validator(inetAddress, host) diff --git a/src/main/scala/li/cil/oc/server/component/InternetCard.scala b/src/main/scala/li/cil/oc/server/component/InternetCard.scala index e4c4df868..512b40292 100644 --- a/src/main/scala/li/cil/oc/server/component/InternetCard.scala +++ b/src/main/scala/li/cil/oc/server/component/InternetCard.scala @@ -360,10 +360,10 @@ object InternetCard { } def checkLists(inetAddress: InetAddress, host: String) { - if (Settings.get.httpHostWhitelist.length > 0 && !Settings.get.httpHostWhitelist.exists(_ (inetAddress, host))) { + if (Settings.get.httpHostWhitelist.length > 0 && !Settings.get.httpHostWhitelist.exists(i => i.apply(inetAddress, host).getOrElse(false))) { throw new FileNotFoundException("address is not whitelisted") } - if (Settings.get.httpHostBlacklist.length > 0 && Settings.get.httpHostBlacklist.exists(_ (inetAddress, host))) { + if (Settings.get.httpHostBlacklist.length > 0 && Settings.get.httpHostBlacklist.exists(i => i.apply(inetAddress, host).getOrElse(true))) { throw new FileNotFoundException("address is blacklisted") } } diff --git a/src/main/scala/li/cil/oc/util/PackedColor.scala b/src/main/scala/li/cil/oc/util/PackedColor.scala index 771498615..1a28d4175 100644 --- a/src/main/scala/li/cil/oc/util/PackedColor.scala +++ b/src/main/scala/li/cil/oc/util/PackedColor.scala @@ -119,6 +119,20 @@ object PackedColor { private val greens = 8 private val blues = 5 + private val staticPalette = new Array[Int](240) + + { + for (index <- staticPalette.indices) { + val idxB = index % blues + val idxG = (index / blues) % greens + val idxR = (index / blues / greens) % reds + val r = (idxR * 0xFF / (reds - 1.0) + 0.5).toInt + val g = (idxG * 0xFF / (greens - 1.0) + 0.5).toInt + val b = (idxB * 0xFF / (blues - 1.0) + 0.5).toInt + staticPalette(index) = (r << rShift32) | (g << gShift32) | (b << bShift32) + } + } + // Initialize palette to grayscale, excluding black and white, because // those are already contained in the normal color cube. for (i <- palette.indices) { @@ -130,16 +144,7 @@ object PackedColor { override def inflate(value: Int) = if (isFromPalette(value)) super.inflate(value) - else { - val index = value - palette.length - val idxB = index % blues - val idxG = (index / blues) % greens - val idxR = (index / blues / greens) % reds - val r = (idxR * 0xFF / (reds - 1.0) + 0.5).toInt - val g = (idxG * 0xFF / (greens - 1.0) + 0.5).toInt - val b = (idxB * 0xFF / (blues - 1.0) + 0.5).toInt - (r << rShift32) | (g << gShift32) | (b << bShift32) - } + else staticPalette((value - palette.length) % 240) override def deflate(value: Color) = { val paletteIndex = super.deflate(value) diff --git a/src/main/scala/li/cil/oc/util/UpdateCheck.scala b/src/main/scala/li/cil/oc/util/UpdateCheck.scala index 25b0ccb8e..4172377cf 100644 --- a/src/main/scala/li/cil/oc/util/UpdateCheck.scala +++ b/src/main/scala/li/cil/oc/util/UpdateCheck.scala @@ -2,7 +2,6 @@ package li.cil.oc.util import java.io.InputStreamReader import java.net.URL - import com.google.gson.Gson import com.google.gson.stream.JsonReader import li.cil.oc.OpenComputers @@ -10,6 +9,7 @@ import li.cil.oc.Settings import net.minecraftforge.fml.common.Loader import net.minecraftforge.fml.common.versioning.ComparableVersion +import java.util.Objects import scala.collection.mutable import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future @@ -32,7 +32,18 @@ object UpdateCheck { while (reader.hasNext) { val release: Release = new Gson().fromJson(reader, classOf[Release]) if (!release.prerelease) { - candidates += release + // Handle the newer version format: mcVersion/release + var versionMatch = true + if (release.tag_name.contains("/")) { + val tagNameParts = release.tag_name.split("/", 2) + if (tagNameParts.length >= 2) { + release.tag_name = tagNameParts(1) + versionMatch = Objects.equals(OpenComputers.McVersion, tagNameParts(0)) + } + } + if (versionMatch) { + candidates += release + } } } reader.endArray()