1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-01-23 15:36:54 +00:00

Fix several issues with the web emulator

- Bump TeaVM version to fix issues with locales and our "export"
   generation.
 - Fix TComputerThread not requeuing correctly.
This commit is contained in:
Jonathan Coates 2023-11-15 13:12:31 +00:00
parent b343c01216
commit f8b7422294
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
4 changed files with 14 additions and 4 deletions

View File

@ -42,7 +42,6 @@ repositories {
url "https://squiddev.cc/maven/" url "https://squiddev.cc/maven/"
content { content {
includeGroup("cc.tweaked") includeGroup("cc.tweaked")
includeModule("org.squiddev", "Cobalt")
} }
} }
} }

View File

@ -68,7 +68,7 @@ mixinGradle = "0.7.+"
nullAway = "0.9.9" nullAway = "0.9.9"
spotless = "6.21.0" spotless = "6.21.0"
taskTree = "2.1.1" taskTree = "2.1.1"
teavm = "0.10.0-SQUID.1" teavm = "0.10.0-SQUID.2"
vanillaGradle = "0.2.1-SNAPSHOT" vanillaGradle = "0.2.1-SNAPSHOT"
vineflower = "1.11.0" vineflower = "1.11.0"

View File

@ -35,6 +35,7 @@ local term = _ENV
-- @since 1.31 -- @since 1.31
-- @usage -- @usage
-- Redirect to a monitor on the right of the computer. -- Redirect to a monitor on the right of the computer.
--
-- term.redirect(peripheral.wrap("right")) -- term.redirect(peripheral.wrap("right"))
term.redirect = function(target) term.redirect = function(target)
expect(1, target, "table") expect(1, target, "table")

View File

@ -28,6 +28,7 @@ public class TComputerThread implements ComputerScheduler {
private static final ArrayDeque<ExecutorImpl> executors = new ArrayDeque<>(); private static final ArrayDeque<ExecutorImpl> executors = new ArrayDeque<>();
private static final TimerHandler callback = TComputerThread::workOnce; private static final TimerHandler callback = TComputerThread::workOnce;
private static boolean enqueued;
public TComputerThread(int threads) { public TComputerThread(int threads) {
} }
@ -38,6 +39,8 @@ public class TComputerThread implements ComputerScheduler {
} }
private static void workOnce() { private static void workOnce() {
enqueued = false;
var executor = executors.poll(); var executor = executors.poll();
if (executor == null) throw new IllegalStateException("Working, but executor is null"); if (executor == null) throw new IllegalStateException("Working, but executor is null");
@ -50,7 +53,14 @@ public class TComputerThread implements ComputerScheduler {
} }
executor.afterWork(); executor.afterWork();
if (!executors.isEmpty()) Callbacks.setImmediate(callback); if (!executors.isEmpty()) enqueue();
}
private static void enqueue() {
if (enqueued) return;
enqueued = true;
Callbacks.setImmediate(callback);
} }
@Override @Override
@ -75,8 +85,8 @@ public class TComputerThread implements ComputerScheduler {
if (onQueue) return; if (onQueue) return;
onQueue = true; onQueue = true;
if (executors.isEmpty()) Callbacks.setImmediate(callback);
executors.add(this); executors.add(this);
enqueue();
} }
void beforeWork() { void beforeWork() {