From 3ac7b7113bdda84b145355cab95ef4d4662cfda2 Mon Sep 17 00:00:00 2001 From: Robert Cochran Date: Sat, 22 Aug 2026 22:55:05 -0700 Subject: [PATCH 1/5] OpenOS: limit boot resolution to 80x25 --- .../opencomputers/loot_disks/openos/lib/core/boot.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/data/opencomputers/opencomputers/loot_disks/openos/lib/core/boot.lua b/src/main/resources/data/opencomputers/opencomputers/loot_disks/openos/lib/core/boot.lua index c52720ad58..567b6cfa10 100644 --- a/src/main/resources/data/opencomputers/opencomputers/loot_disks/openos/lib/core/boot.lua +++ b/src/main/resources/data/opencomputers/opencomputers/loot_disks/openos/lib/core/boot.lua @@ -31,7 +31,7 @@ if gpu then end _G.boot_screen = gpu.getScreen() w, h = gpu.maxResolution() - gpu.setResolution(w, h) + gpu.setResolution(math.min(w, 80), math.min(h, 25)) gpu.setBackground(0x000000) gpu.setForeground(0xFFFFFF) gpu.fill(1, 1, w, h, " ") From 1307d8707bb81d107f60e8518da20cac7c6514ed Mon Sep 17 00:00:00 2001 From: Robert Cochran Date: Sat, 22 Aug 2026 22:57:11 -0700 Subject: [PATCH 2/5] Add GPU function to check which side may be limiting capabilities --- .../oc/server/component/GraphicsCard.scala | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/scala/li/cil/oc/server/component/GraphicsCard.scala b/src/main/scala/li/cil/oc/server/component/GraphicsCard.scala index 6284d29991..bae99d2563 100644 --- a/src/main/scala/li/cil/oc/server/component/GraphicsCard.scala +++ b/src/main/scala/li/cil/oc/server/component/GraphicsCard.scala @@ -436,6 +436,25 @@ class GraphicsCard(val tier: Int, val vramScreens: Option[Double] = None, val vi result(math.min(gmw, smw), math.min(gmh, smh)) }) + @Callback(direct = true, doc = """function():string or nil -- Return which of GPU or screen is limiting display capabilities, if either""") + def capabilityLimiter(context: Context, args: Arguments): Array[AnyRef] = + // FIXME: Assumes that GPU/screen tiers do not differ only by color depth, + // which is *currently* valid but may not be in the future. It would be + // better to just use the tier values directly, but I couldn't figure out + // how to access the physical screen from the TextBuffer... + screen(s => { + val gmw = maxResolution._1 + val smw = s.getMaximumWidth + result( + if (gmw > smw) + "screen" + else if (gmw < smw) + "gpu" + else // Equal, so neither is limiting + null + ) + }) + @Callback(direct = true, doc = """function():number, number -- Get the current viewport resolution.""") def getViewport(context: Context, args: Arguments): Array[AnyRef] = screen(s => result(s.getViewportWidth, s.getViewportHeight)) From 86f71d98da22c6f492f6590a64b93d32bf1e42fa Mon Sep 17 00:00:00 2001 From: Robert Cochran Date: Sat, 22 Aug 2026 22:58:39 -0700 Subject: [PATCH 3/5] OpenOS: add --max flag to resolution --- .../loot_disks/openos/bin/resolution.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/resources/data/opencomputers/opencomputers/loot_disks/openos/bin/resolution.lua b/src/main/resources/data/opencomputers/opencomputers/loot_disks/openos/bin/resolution.lua index 6c1bfce717..c6794f454e 100644 --- a/src/main/resources/data/opencomputers/opencomputers/loot_disks/openos/bin/resolution.lua +++ b/src/main/resources/data/opencomputers/opencomputers/loot_disks/openos/bin/resolution.lua @@ -1,9 +1,21 @@ local shell = require("shell") local tty = require("tty") -local args = shell.parse(...) +local args, ops = shell.parse(...) local gpu = tty.gpu() +if ops["max"] then + local w, h = gpu.maxResolution() + io.write(w," ",h,"\n") + -- Give a diagnostic for whether or not the capabilities of the screen and GPU + -- are mismatched + local limiter = gpu.capabilityLimiter() + if limiter then + io.write("(Limited by ",limiter,")\n") + end + return +end + if #args == 0 then local w, h = gpu.getViewport() io.write(w," ",h,"\n") @@ -11,7 +23,7 @@ if #args == 0 then end if #args ~= 2 then - print("Usage: resolution [ ]") + print("Usage: resolution [ ] or resolution --max") return end From a57140a666e254c5254c891bf6e1c742a259b4bc Mon Sep 17 00:00:00 2001 From: Robert Cochran Date: Sat, 22 Aug 2026 23:41:58 -0700 Subject: [PATCH 4/5] Remove useless comment --- .../opencomputers/loot_disks/openos/bin/resolution.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/resources/data/opencomputers/opencomputers/loot_disks/openos/bin/resolution.lua b/src/main/resources/data/opencomputers/opencomputers/loot_disks/openos/bin/resolution.lua index c6794f454e..d171e05cfe 100644 --- a/src/main/resources/data/opencomputers/opencomputers/loot_disks/openos/bin/resolution.lua +++ b/src/main/resources/data/opencomputers/opencomputers/loot_disks/openos/bin/resolution.lua @@ -7,8 +7,6 @@ local gpu = tty.gpu() if ops["max"] then local w, h = gpu.maxResolution() io.write(w," ",h,"\n") - -- Give a diagnostic for whether or not the capabilities of the screen and GPU - -- are mismatched local limiter = gpu.capabilityLimiter() if limiter then io.write("(Limited by ",limiter,")\n") From b4f738d740edf2b8c62cc42ba14ceb5a7bf4005b Mon Sep 17 00:00:00 2001 From: Robert Cochran Date: Sat, 22 Aug 2026 23:42:30 -0700 Subject: [PATCH 5/5] Revert "OpenOS: limit boot resolution to 80x25" This reverts commit 9a6d95c46e8bcb93b3c0352cdf223b1377c5ad51. We're going to figure out how to solve the resolution downscaling issues in a different way that doesn't involve reducing the resolution on the computer side. --- .../opencomputers/loot_disks/openos/lib/core/boot.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/data/opencomputers/opencomputers/loot_disks/openos/lib/core/boot.lua b/src/main/resources/data/opencomputers/opencomputers/loot_disks/openos/lib/core/boot.lua index 567b6cfa10..c52720ad58 100644 --- a/src/main/resources/data/opencomputers/opencomputers/loot_disks/openos/lib/core/boot.lua +++ b/src/main/resources/data/opencomputers/opencomputers/loot_disks/openos/lib/core/boot.lua @@ -31,7 +31,7 @@ if gpu then end _G.boot_screen = gpu.getScreen() w, h = gpu.maxResolution() - gpu.setResolution(math.min(w, 80), math.min(h, 25)) + gpu.setResolution(w, h) gpu.setBackground(0x000000) gpu.setForeground(0xFFFFFF) gpu.fill(1, 1, w, h, " ")