clean up and larger importer

This commit is contained in:
bryanthaboi
2026-08-20 08:53:31 -04:00
parent 51c4766ead
commit 2468d5042d
5 changed files with 90 additions and 10 deletions
+2 -2
View File
@@ -195,8 +195,8 @@ local function parseImports(value, field, required)
if value == nil then return end
assert(type(value) == "number" and value > 0 and value % 1 == 0,
field .. " " .. label .. " must be a positive integer")
assert(value <= 128 * 1024 * 1024,
field .. " " .. label .. " exceeds the 128 MiB hard limit")
assert(value <= 2 * 1024 * 1024 * 1024,
field .. " " .. label .. " exceeds the 2 GiB hard limit")
end
validateSize(size, "size")
validateSize(maxSize, "max_size")
+7 -1
View File
@@ -23,11 +23,17 @@ local function isRequired(spec)
end
RequiredImports.specs = allSpecs
RequiredImports.MAX_BYTES = 128 * 1024 * 1024
RequiredImports.MAX_BYTES = 2 * 1024 * 1024 * 1024
-- Past this, the launcher interposes a free-space warning before importing.
RequiredImports.LARGE_WARN_BYTES = 128 * 1024 * 1024
local function sizeLabel(bytes)
if bytes >= 1024 * 1024 * 1024 then
return ("%.1f GiB"):format(bytes / (1024 * 1024 * 1024))
end
return ("%.1f MiB"):format(bytes / (1024 * 1024))
end
RequiredImports.sizeLabel = sizeLabel
-- Check size before a caller reads an external or stored file into one large
-- Lua string. N64 sources may carry a 512-byte copier header, while stored