diff --git a/build/Rosetta.luau b/build/Rosetta.luau index 72fd7cc..a4efb3a 100644 --- a/build/Rosetta.luau +++ b/build/Rosetta.luau @@ -106,6 +106,56 @@ end local LATE: { [string]: number } = { br = 0.3 } -- archive/br: a trial decode of up to 256 KB +-- detection order: by the cost of a sniff (Registry.sniff: Sniffs.luau, Sniffs.luau reaching a codec, the format +-- module), then registry order; the costly LATE sniffs last +local order: { number }? = nil +local byExt: { [string]: { number } } = {} +local Sniffs: { [string]: (any) -> number }? = nil + +local function sniffOrder(): { number } + local o = order + if o then + return o + end + local list: { number } = {} + for idx, e in Registry do + table.insert(list, idx) + for _, x in e.extensions do + byExt[x] = byExt[x] or {} + table.insert(byExt[x], idx) + end + end + local function rank(idx: number): number + local e = Registry[idx] + return if LATE[e.name] then 3 else e.sniff + end + table.sort(list, function(a: number, b: number): boolean + local ra, rb = rank(a), rank(b) + if ra ~= rb then + return ra < rb + end + return a < b + end) + order = list + return list +end + +local function sniffer(e: Registry.Entry): ((any) -> number)? + if e.sniff < 2 then + local s = Sniffs + if not s then + s = __include("Sniffs") :: any + Sniffs = s + end + local f = (s :: { [string]: (any) -> number })[e.path] + if f then + return f + end + end + local m = module(e) + return if m and type(m.sniff) == "function" then m.sniff else nil +end + local function detect(buf: buffer, name: string?, category: string?, format: string?): (Registry.Entry?, Err.Err?) if format then local e = find(format, category) @@ -115,52 +165,35 @@ local function detect(buf: buffer, name: string?, category: string?, format: str return e, nil end local ext = Input.extension(name) + local list = sniffOrder() + local hits = if ext then byExt[ext] else nil local best: Registry.Entry? = nil local bestScore, bestIdx = 0, 0 - -- sniffs score 0..1 (core/Sniff); the extension's format scoring 1 cannot be beaten. Formats with a costly sniff - -- (LATE: the most they score) run last, and only when they could still win; ties go to registry order. - local late: { number }? = nil - for idx, e in Registry do - if inCategory(e, category) and (e.caps.decode or e.caps.open) then - local cap = LATE[e.name] - if cap then - late = late or {} - table.insert(late :: { number }, idx) - continue - end - local m = module(e) - if m and m.sniff then - local ok, score = pcall(m.sniff, Bytes.reader(buf)) - if ok and type(score) == "number" and score > 0 then - local extHit = ext and table.find(e.extensions, ext) - if extHit then - score += 0.01 -- ties go to the extension - end - if score > bestScore then - best, bestScore, bestIdx = e, score, idx - if extHit and score >= 1.01 then - return e, nil - end - end + -- sniffs score 0..1 (core/Sniff), +0.01 for the extension's formats; the best wins, ties go to registry order. The + -- extension's formats run first, and a sniff runs only while its cap (1, or LATE) could still win. + for pass = 1, 2 do + local ids = if pass == 1 then hits else list + if ids then + for _, idx in ids do + if pass == 2 and bestScore > 1 then + break end - end - end - end - if late then - for _, idx in late do - local e = Registry[idx] - local extHit = ext and table.find(e.extensions, ext) - local cap = LATE[e.name] + (if extHit then 0.01 else 0) - if cap > bestScore or (cap == bestScore and idx < bestIdx) then - local m = module(e) - if m and m.sniff then - local ok, score = pcall(m.sniff, Bytes.reader(buf)) - if ok and type(score) == "number" and score > 0 then - if extHit then - score += 0.01 - end - if score > bestScore or (score == bestScore and idx < bestIdx) then - best, bestScore, bestIdx = e, score, idx + local e = Registry[idx] + local extHit = pass == 1 or (hits ~= nil and table.find(hits, idx) ~= nil) + if (pass == 1 or not extHit) and inCategory(e, category) and (e.caps.decode or e.caps.open) then + local cap = (LATE[e.name] or 1) + (if extHit then 0.01 else 0) + if cap > bestScore or (cap == bestScore and idx < bestIdx) then + local sniff = sniffer(e) + if sniff then + local ok, score = pcall(sniff, Bytes.reader(buf)) + if ok and type(score) == "number" and score > 0 then + if extHit then + score += 0.01 + end + if score > bestScore or (score == bestScore and idx < bestIdx) then + best, bestScore, bestIdx = e, score, idx + end + end end end end @@ -724,7 +757,7 @@ function F.detect(src: any, opts: Options?): (string?, Err.Err?) return nil, err end -- a format may name the file's flavour more precisely (video/mkv: "webm" for DocType webm) - local m = module(entry) + local m = if entry.variant then module(entry) else nil if m and type(m.variant) == "function" then local ok, v = pcall(m.variant, Bytes.reader(buf)) if ok and type(v) == "string" then @@ -914,6 +947,8 @@ __FILES["Registry"] = function() -- Registry: GENERATED by tools/gen_registry.py from the format folders - do not edit. -- One entry per format: the contract metadata (copied from its init.luau) and load(), which requires the format -- module on first use (a static require, as Roblox needs). Order: category, then name. +-- sniff: where detection finds the format's sniff (tools/sniff_extract.py): 0 Sniffs.luau, 1 Sniffs.luau reaching a +-- codec / container on first call, 2 the format module. variant: the module has variant(r). type Entry = { name: string, category: string, @@ -922,6 +957,8 @@ type Entry = { mime: { string }, deps: { string }, caps: { [string]: any }, + sniff: number, + variant: boolean?, load: () -> any, } @@ -934,6 +971,7 @@ local list: { Entry } = { mime = { "application/x-navi-animation" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Riff" }, caps = { decode = true, encode = true, alpha = true, animation = true, frames = true }, + sniff = 0, load = function() return __include("image/ani") end, @@ -946,6 +984,7 @@ local list: { Entry } = { mime = { "image/x-build-art" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels", "codecs/image/Quantize" }, caps = { decode = true, encode = true, alpha = true, palette = true, frames = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/art") end, @@ -958,6 +997,7 @@ local list: { Entry } = { mime = { "image/x-blp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Jpeg", "codecs/image/Bcn" }, caps = { decode = true, encode = true, alpha = true, variants = { "blp1", "blp2" }, compressions = { "jpeg", "palette", "dxt1", "dxt3", "dxt5", "bgra" } }, + sniff = 0, load = function() return __include("image/blp") end, @@ -970,6 +1010,7 @@ local list: { Entry } = { mime = { "image/bmp", "image/x-bmp", "image/x-ms-bmp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, depths = { 1, 2, 4, 8, 16, 24, 32 }, rle = true }, + sniff = 0, load = function() return __include("image/bmp") end, @@ -982,6 +1023,7 @@ local list: { Entry } = { mime = { "image/vnd-ms.dds", "image/x-dds" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Bcn", "codecs/image/Texel", "codecs/image/Texture" }, caps = { decode = true, encode = true, alpha = true, float = true, mipmaps = true, cubemap = true, compressed = { "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7" } }, + sniff = 0, load = function() return __include("image/dds") end, @@ -994,6 +1036,7 @@ local list: { Entry } = { mime = { "image/x-exr", "image/aces" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Half", "codecs/compress/Deflate" }, caps = { decode = true, encode = true, alpha = true, float = true, hdr = true, depths = { 16, 32 }, multipart = true, tiled = true }, + sniff = 0, load = function() return __include("image/exr") end, @@ -1006,6 +1049,7 @@ local list: { Entry } = { mime = { "image/gif" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Lzw", "codecs/image/Quantize", "Types" }, caps = { decode = true, encode = true, animation = true, alpha = true, palette = true, depths = { 1, 2, 4, 8 } }, + sniff = 0, load = function() return __include("image/gif") end, @@ -1018,6 +1062,7 @@ local list: { Entry } = { mime = { "image/vnd.radiance", "image/x-hdr" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = false, float = true, depths = { 32 } }, + sniff = 0, load = function() return __include("image/hdr") end, @@ -1030,6 +1075,7 @@ local list: { Entry } = { mime = { "image/icns", "image/x-icns" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "containers/Chunks" }, caps = { decode = true, encode = true, alpha = true, frames = true, depths = { 1, 24, 32 } }, + sniff = 0, load = function() return __include("image/icns") end, @@ -1042,6 +1088,7 @@ local list: { Entry } = { mime = { "image/vnd.microsoft.icon", "image/x-icon" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, frames = true, depths = { 1, 4, 8, 16, 24, 32 } }, + sniff = 0, load = function() return __include("image/ico") end, @@ -1054,6 +1101,7 @@ local list: { Entry } = { mime = { "image/x-ilbm", "image/x-iff" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/compress/PackBits", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 2, 3, 4, 5, 6, 7, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/ilbm") end, @@ -1066,6 +1114,7 @@ local list: { Entry } = { mime = { "image/jpeg" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Jpeg" }, caps = { decode = true, encode = true, lossy = true, alpha = false, depths = { 8, 12 }, progressive = true, arithmetic = true }, + sniff = 0, load = function() return __include("image/jpeg") end, @@ -1078,6 +1127,7 @@ local list: { Entry } = { mime = { "image/ktx2", "image/ktx" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/compress/Deflate", "codecs/compress/Zstd", "codecs/image/Texel", "codecs/image/Texture" }, caps = { decode = true, encode = true, alpha = true, float = true, mipmaps = true, cubemap = true, compressed = { "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7", "etc1", "etc2", "eac" } }, + sniff = 0, load = function() return __include("image/ktx") end, @@ -1090,6 +1140,7 @@ local list: { Entry } = { mime = { "image/x-quake-lmp" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, alpha = true, depths = { 8 }, variants = { "qpic", "palette", "colormap" } }, + sniff = 0, load = function() return __include("image/lmp") end, @@ -1102,6 +1153,7 @@ local list: { Entry } = { mime = { "image/vnd.zbrush.pcx", "image/x-pcx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 2, 4, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/pcx") end, @@ -1114,6 +1166,7 @@ local list: { Entry } = { mime = { "image/png", "image/apng" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Deflate", "Types", "containers/Chunks" }, caps = { decode = true, encode = true, animation = true, alpha = true, depths = { 1, 2, 4, 8, 16 } }, + sniff = 0, load = function() return __include("image/png") end, @@ -1126,6 +1179,7 @@ local list: { Entry } = { mime = { "image/x-portable-anymap", "image/x-portable-bitmap", "image/x-portable-graymap", "image/x-portable-pixmap", "image/x-portable-arbitrarymap", "image/x-portable-floatmap" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 1, 8, 16, 32 }, float = true }, + sniff = 0, load = function() return __include("image/pnm") end, @@ -1138,6 +1192,7 @@ local list: { Entry } = { mime = { "image/qoi", "image/x-qoi" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/qoi") end, @@ -1150,6 +1205,7 @@ local list: { Entry } = { mime = { "image/sgi", "image/x-rgb" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 8, 16 } }, + sniff = 0, load = function() return __include("image/sgi") end, @@ -1162,6 +1218,7 @@ local list: { Entry } = { mime = { "image/x-quake-sprite" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, alpha = true, animation = true, variants = { "quake", "halflife", "spr32" } }, + sniff = 0, load = function() return __include("image/spr") end, @@ -1174,6 +1231,7 @@ local list: { Entry } = { mime = { "image/x-sun-raster", "image/x-cmu-raster" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/sunras") end, @@ -1186,6 +1244,7 @@ local list: { Entry } = { mime = { "image/x-tga", "image/x-targa" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 8, 15, 16, 24, 32 } }, + sniff = 0, load = function() return __include("image/tga") end, @@ -1198,6 +1257,7 @@ local list: { Entry } = { mime = { "image/tiff" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/compress/Lzw", "codecs/compress/PackBits" }, caps = { decode = true, encode = true, alpha = true, pages = true, depths = { 1, 2, 4, 8, 16, 32 }, float = true }, + sniff = 0, load = function() return __include("image/tiff") end, @@ -1210,6 +1270,7 @@ local list: { Entry } = { mime = { "image/x-tim" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 4, 8, 16, 24 } }, + sniff = 0, load = function() return __include("image/tim") end, @@ -1222,6 +1283,7 @@ local list: { Entry } = { mime = { "image/x-vtf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Bcn", "codecs/image/Texel" }, caps = { decode = true, encode = false, alpha = true, animation = true, versions = { "7.0", "7.1", "7.2", "7.3", "7.4", "7.5" } }, + sniff = 0, load = function() return __include("image/vtf") end, @@ -1234,6 +1296,7 @@ local list: { Entry } = { mime = { "image/webp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Vp8", "codecs/image/Vp8L", "containers/Riff" }, caps = { decode = true, encode = true, animation = true, alpha = true, lossy = true, lossless = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/webp") end, @@ -1246,6 +1309,7 @@ local list: { Entry } = { mime = { "image/x-xbitmap", "image/x-xbm" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, depths = { 1 } }, + sniff = 0, load = function() return __include("image/xbm") end, @@ -1258,6 +1322,7 @@ local list: { Entry } = { mime = { "image/x-xpixmap", "image/x-xpm" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/xpm") end, @@ -1270,6 +1335,7 @@ local list: { Entry } = { mime = { "audio/aac", "audio/aacp", "audio/x-aac" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Aac", "codecs/audio/Pcm", "codecs/audio/Stream" }, caps = { decode = true, encode = false, codecs = { "aac" }, streaming = true }, + sniff = 1, load = function() return __include("audio/aac") end, @@ -1282,6 +1348,7 @@ local list: { Entry } = { mime = { "audio/ac3", "audio/x-ac3" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/Ac3" }, caps = { decode = true, encode = false, codecs = { "ac3" }, channels = 6, streaming = true, lossy = true }, + sniff = 1, load = function() return __include("audio/ac3") end, @@ -1294,6 +1361,7 @@ local list: { Entry } = { mime = { "audio/x-adpcm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, headerless = true, codecs = { "ima", "ima_wav", "ms", "ima_qt", "psx" } }, + sniff = 0, load = function() return __include("audio/adpcm") end, @@ -1306,6 +1374,7 @@ local list: { Entry } = { mime = { "audio/x-adx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, loops = true, channels = 8 }, + sniff = 0, load = function() return __include("audio/adx") end, @@ -1318,6 +1387,7 @@ local list: { Entry } = { mime = { "audio/aiff", "audio/x-aiff" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm/Decoder", "containers/Chunks" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, lossy = false }, + sniff = 0, load = function() return __include("audio/aiff") end, @@ -1330,6 +1400,7 @@ local list: { Entry } = { mime = { "audio/ape", "audio/x-ape", "audio/x-monkeys-audio" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Ape" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, float = true, depths = { 8, 16, 24, 32 } }, + sniff = 0, load = function() return __include("audio/ape") end, @@ -1342,6 +1413,7 @@ local list: { Entry } = { mime = { "audio/basic", "audio/x-au" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, lossy = false }, + sniff = 0, load = function() return __include("audio/au") end, @@ -1354,6 +1426,8 @@ local list: { Entry } = { mime = { "audio/x-brstm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = false, streaming = true, lossy = true, loops = true, containers = { "RSTM", "CSTM", "FSTM" } }, + sniff = 0, + variant = true, load = function() return __include("audio/brstm") end, @@ -1366,6 +1440,7 @@ local list: { Entry } = { mime = { "audio/x-caf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Aac", "codecs/audio/Adpcm/Decoder", "codecs/audio/Alac", "codecs/audio/Pcm", "codecs/audio/Stream", "containers/Chunks" }, caps = { decode = true, encode = true, codecs = { "pcm", "alac", "aac", "ulaw", "alaw" }, encodeCodecs = { "pcm", "alac" }, tags = true, streaming = true }, + sniff = 0, load = function() return __include("audio/caf") end, @@ -1378,6 +1453,7 @@ local list: { Entry } = { mime = { "audio/flac", "audio/x-flac" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/audio/Pcm", "codecs/audio/VorbisComment", "codecs/audio/Flac/Frame", "codecs/audio/Flac/Encode" }, caps = { decode = true, encode = true, streaming = true, depths = { 4, 8, 12, 16, 20, 24, 32 }, ogg = true, seek = true }, + sniff = 0, load = function() return __include("audio/flac") end, @@ -1390,6 +1466,7 @@ local list: { Entry } = { mime = { "audio/mp4", "audio/x-m4a", "audio/m4a" }, deps = { "core/Err", "core/Bytes", "Types", "containers/IsoBmff", "codecs/audio/Aac", "codecs/audio/Alac", "codecs/audio/Pcm", "codecs/audio/Stream" }, caps = { decode = true, encode = true, codecs = { "aac", "alac" }, encodeCodecs = { "alac" }, tags = true, streaming = true }, + sniff = 1, load = function() return __include("audio/m4a") end, @@ -1402,6 +1479,7 @@ local list: { Entry } = { mime = { "audio/mpeg", "audio/mp3", "audio/mpa" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Resample", "codecs/audio/Mpa/Header", "codecs/audio/Mpa/Core", "codecs/audio/Mpa/Encode3", "codecs/audio/Mpa/Encode2" }, caps = { decode = true, encode = true, streaming = true, seek = true, layers = { 1, 2, 3 }, encodeLayers = { 2, 3 }, channels = 2 }, + sniff = 1, load = function() return __include("audio/mp3") end, @@ -1414,6 +1492,7 @@ local list: { Entry } = { mime = { "audio/x-musepack", "audio/musepack" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Musepack" }, caps = { decode = true, encode = false, codecs = { "musepack" }, versions = { 7, 8 }, streaming = true, lossy = true }, + sniff = 1, load = function() return __include("audio/mpc") end, @@ -1426,6 +1505,7 @@ local list: { Entry } = { mime = { "audio/opus", "audio/ogg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/entropy/RangeCoder/Decoder", "codecs/audio/Pcm", "codecs/audio/Resample", "codecs/audio/VorbisComment", "codecs/audio/Opus/CeltEncoder", "codecs/audio/Opus/Decoder", "codecs/audio/Opus/Packet", "codecs/audio/Opus/Celt", "codecs/audio/Opus/Silk" }, caps = { decode = true, encode = true, streaming = true, seek = true, lossy = true, channels = 255, rates = { 48000 }, encodeModes = { "celt" }, encodeChannels = 2 }, + sniff = 0, load = function() return __include("audio/opus") end, @@ -1438,6 +1518,7 @@ local list: { Entry } = { mime = { "audio/qoa" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/Qoa" }, caps = { decode = true, encode = true, streaming = true, lossy = true, seek = true, channels = 8 }, + sniff = 0, load = function() return __include("audio/qoa") end, @@ -1450,6 +1531,7 @@ local list: { Entry } = { mime = { "audio/x-tta", "audio/tta" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Tta" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, depths = { 8, 16, 24 } }, + sniff = 0, load = function() return __include("audio/tta") end, @@ -1462,6 +1544,7 @@ local list: { Entry } = { mime = { "audio/x-vag" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, loops = true, channels = 2 }, + sniff = 0, load = function() return __include("audio/vag") end, @@ -1474,6 +1557,7 @@ local list: { Entry } = { mime = { "audio/x-voc" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16 }, lossy = false }, + sniff = 0, load = function() return __include("audio/voc") end, @@ -1486,6 +1570,7 @@ local list: { Entry } = { mime = { "audio/ogg", "audio/vorbis" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/audio/Mdct", "codecs/audio/Pcm", "codecs/audio/VorbisComment", "codecs/audio/Vorbis/Tables", "codecs/audio/Vorbis/Setup", "codecs/audio/Vorbis/Packet" }, caps = { decode = true, encode = true, streaming = true, seek = true, lossy = true, channels = 255 }, + sniff = 0, load = function() return __include("audio/vorbis") end, @@ -1498,6 +1583,7 @@ local list: { Entry } = { mime = { "audio/wav", "audio/x-wav", "audio/wave", "audio/vnd.wave" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Riff", "codecs/audio/Pcm", "codecs/audio/Adpcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, rf64 = true }, + sniff = 1, load = function() return __include("audio/wav") end, @@ -1510,6 +1596,7 @@ local list: { Entry } = { mime = { "audio/x-wavpack", "audio/wavpack" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/WavPack" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, hybrid = true, float = true, depths = { 8, 12, 16, 20, 24, 32 } }, + sniff = 0, load = function() return __include("audio/wavpack") end, @@ -1522,6 +1609,7 @@ local list: { Entry } = { mime = { "video/x-msvideo", "video/avi" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Avi", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, video = { "mjpeg", "mpeg1", "mpeg2", "rawvideo" }, audio = true, odml = true }, + sniff = 0, load = function() return __include("video/avi") end, @@ -1534,6 +1622,7 @@ local list: { Entry } = { mime = { "video/x-fli", "video/fli", "video/x-flc" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "flic" }, depths = { 8, 15, 16, 24 } }, + sniff = 0, load = function() return __include("video/fli") end, @@ -1546,6 +1635,7 @@ local list: { Entry } = { mime = { "video/x-flv", "video/flv" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source", "codecs/video/H263", "codecs/video/H264", "codecs/audio/Aac" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "flv1", "h264" }, audio = true, metadata = true }, + sniff = 0, load = function() return __include("video/flv") end, @@ -1558,6 +1648,7 @@ local list: { Entry } = { mime = { "video/h264" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source", "codecs/video/H264" }, caps = { decode = true, encode = true, streaming = true, video = { "h264" }, depths = { 8 } }, + sniff = 0, load = function() return __include("video/h264") end, @@ -1570,6 +1661,8 @@ local list: { Entry } = { mime = { "video/x-matroska", "video/webm", "audio/x-matroska", "audio/webm" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ebml", "containers/Demux", "containers/Avi", "containers/IsoBmff/QtPalette", "codecs/compress/Deflate", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "vp8", "mjpeg", "mpeg1", "mpeg2", "theora", "rawvideo" }, audio = true, subtitles = true }, + sniff = 0, + variant = true, load = function() return __include("video/mkv") end, @@ -1582,6 +1675,7 @@ local list: { Entry } = { mime = { "video/mp4", "video/quicktime", "video/3gpp" }, deps = { "core/Err", "core/Bytes", "Types", "containers/IsoBmff", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "mjpeg", "mpeg1", "mpeg2", "h264" }, audio = true, fragments = true }, + sniff = 1, load = function() return __include("video/mp4") end, @@ -1594,6 +1688,7 @@ local list: { Entry } = { mime = { "video/mpeg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/MpegPs", "containers/MpegEs", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "mpeg1", "mpeg2" }, audio = true }, + sniff = 0, load = function() return __include("video/mpegps") end, @@ -1606,6 +1701,7 @@ local list: { Entry } = { mime = { "video/mp2t" }, deps = { "core/Err", "core/Bytes", "Types", "containers/MpegTs", "containers/MpegEs", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "mpeg1", "mpeg2", "h264" }, audio = true }, + sniff = 0, load = function() return __include("video/mpegts") end, @@ -1618,6 +1714,7 @@ local list: { Entry } = { mime = { "video/ogg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "containers/Demux", "containers/AudioWrap", "codecs/video/Theora", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "theora" }, audio = true }, + sniff = 0, load = function() return __include("video/ogv") end, @@ -1630,6 +1727,7 @@ local list: { Entry } = { mime = { "video/vnd.radgamettools.smacker" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/audio/Stream", "codecs/video/Legacy/Smacker" }, caps = { decode = true, encode = false, streaming = true, video = { "smackvid" }, audio = { "smackaudio", "pcm_u8", "pcm_s16le" } }, + sniff = 0, load = function() return __include("video/smk") end, @@ -1642,6 +1740,7 @@ local list: { Entry } = { mime = { "video/x-yuv4mpeg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, video = { "rawvideo" }, depths = { 8, 10, 12, 16 } }, + sniff = 0, load = function() return __include("video/y4m") end, @@ -1654,6 +1753,7 @@ local list: { Entry } = { mime = { "application/x-3ds", "image/x-3ds" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Sampler" }, caps = { decode = true, encode = true, materials = true, textures = true, animation = true, cameras = true, lights = true, instancing = true }, + sniff = 0, load = function() return __include("model/3ds") end, @@ -1666,6 +1766,7 @@ local list: { Entry } = { mime = { "model/3mf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "containers/Zip" }, caps = { decode = true, encode = true, materials = true, vertexColors = true, textures = true, units = true }, + sniff = 0, load = function() return __include("model/3mf") end, @@ -1678,6 +1779,7 @@ local list: { Entry } = { mime = { "model/x-ase", "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text", "codecs/model/Mat4" }, caps = { decode = true, encode = true, text = true, materials = true, cameras = true, lights = true, vertexColors = true }, + sniff = 1, load = function() return __include("model/ase") end, @@ -1690,6 +1792,7 @@ local list: { Entry } = { mime = { "model/x-b3d" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/model/Mat4" }, caps = { decode = true, encode = false, materials = true, textures = true, skins = true, animation = true, colors = true }, + sniff = 0, load = function() return __include("model/b3d") end, @@ -1702,6 +1805,7 @@ local list: { Entry } = { mime = { "application/x-blender" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Blend", "codecs/compress/Deflate", "codecs/compress/Zstd", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/Polygon" }, caps = { decode = true, encode = false, materials = true, textures = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, polygons = true, compressed = true }, + sniff = 1, load = function() return __include("model/blend") end, @@ -1714,6 +1818,7 @@ local list: { Entry } = { mime = { "model/x-bsp" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex", "codecs/model/Patch" }, caps = { decode = true, encode = false, variants = { "quake", "bsp2", "2psb", "halflife", "quake2", "quake3" }, lightmaps = true, collision = true, visibility = true }, + sniff = 0, load = function() return __include("model/bsp") end, @@ -1726,6 +1831,7 @@ local list: { Entry } = { mime = { "application/x-build-map" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Polygon" }, caps = { decode = true, encode = true, sprites = true, slopes = true }, + sniff = 0, load = function() return __include("model/buildmap") end, @@ -1738,6 +1844,7 @@ local list: { Entry } = { mime = { "text/x-doom3-map" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Brush", "codecs/model/Patch", "codecs/model/Mat4", "codecs/text/Lexer" }, caps = { decode = true, encode = false, patches = true, variants = { "doom3", "quake4" } }, + sniff = 0, load = function() return __include("model/d3map") end, @@ -1750,6 +1857,7 @@ local list: { Entry } = { mime = { "model/vnd.collada+xml", "model/vnd.collada+zip" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "core/Base64", "containers/Zip", "codecs/model/Mat4" }, caps = { decode = true, encode = true, materials = true, polygons = true, skins = true, morphTargets = true, animation = true, cameras = true, lights = true, zae = true }, + sniff = 0, load = function() return __include("model/dae") end, @@ -1762,6 +1870,7 @@ local list: { Entry } = { mime = { "application/vnd.autodesk.fbx", "model/fbx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "core/Base64", "codecs/model/Mat4" }, caps = { decode = true, encode = true, binary = true, ascii = true, materials = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, polygons = true }, + sniff = 2, load = function() return __include("model/fbx") end, @@ -1774,6 +1883,7 @@ local list: { Entry } = { mime = { "model/gltf+json", "model/gltf-binary" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Base64", "core/Sniff", "codecs/model/Draco" }, caps = { decode = true, encode = true, binary = true, materials = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, draco = true }, + sniff = 0, load = function() return __include("model/gltf") end, @@ -1786,6 +1896,7 @@ local list: { Entry } = { mime = { "application/x-godot-scene" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/GodotVariant", "codecs/model/Mat4" }, caps = { decode = true, encode = true, text = true, materials = true, cameras = true, lights = true, instances = true }, + sniff = 0, load = function() return __include("model/godot") end, @@ -1798,6 +1909,7 @@ local list: { Entry } = { mime = { "model/x-iqm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/Sampler" }, caps = { decode = true, encode = true, materials = true, skins = true, animation = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/iqm") end, @@ -1810,6 +1922,7 @@ local list: { Entry } = { mime = { "application/x-ldraw", "application/x-multi-part-ldraw" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = false, materials = true, lines = true, instancing = true }, + sniff = 0, load = function() return __include("model/ldraw") end, @@ -1822,6 +1935,7 @@ local list: { Entry } = { mime = { "image/x-lwo", "model/x-lwo" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks" }, caps = { decode = true, encode = false, materials = true, polygons = true, vertexColors = true, morphTargets = true }, + sniff = 0, load = function() return __include("model/lwo") end, @@ -1834,6 +1948,7 @@ local list: { Entry } = { mime = { "text/x-quake-map" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Miptex", "codecs/model/Brush", "codecs/model/Patch" }, caps = { decode = true, encode = true, variants = { "quake", "valve220", "quake2", "quake3" }, patches = true }, + sniff = 0, load = function() return __include("model/map") end, @@ -1846,6 +1961,7 @@ local list: { Entry } = { mime = { "application/x-minecraft-region" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/text/Nbt", "codecs/model/Minecraft", "codecs/compress/Lz4" }, caps = { decode = true, encode = false, voxels = true, blocks = true }, + sniff = 0, load = function() return __include("model/mca") end, @@ -1858,6 +1974,7 @@ local list: { Entry } = { mime = { "model/x-md2" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Rig" }, caps = { decode = true, encode = false, morph = true, animation = true }, + sniff = 0, load = function() return __include("model/md2") end, @@ -1870,6 +1987,7 @@ local list: { Entry } = { mime = { "model/x-md3" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Mat4", "codecs/model/Rig" }, caps = { decode = true, encode = false, morph = true, animation = true, tags = true }, + sniff = 0, load = function() return __include("model/md3") end, @@ -1882,6 +2000,7 @@ local list: { Entry } = { mime = { "model/x-md5mesh", "model/x-md5anim" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Sniff", "Types", "codecs/model/Rig" }, caps = { decode = true, encode = false, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/md5") end, @@ -1894,6 +2013,7 @@ local list: { Entry } = { mime = { "model/x-mdl" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/SourceAnim" }, caps = { decode = true, encode = false, variants = { "quake", "halflife" }, morph = true, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/mdl") end, @@ -1906,6 +2026,7 @@ local list: { Entry } = { mime = { "application/x-ms3d" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, materials = true, skins = true, animation = true }, + sniff = 1, load = function() return __include("model/ms3d") end, @@ -1918,6 +2039,7 @@ local list: { Entry } = { mime = { "model/obj" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, materials = true, polygons = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/obj") end, @@ -1930,6 +2052,7 @@ local list: { Entry } = { mime = { "model/off", "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, polygons = true, points = true, colors = true, binary = false }, + sniff = 0, load = function() return __include("model/off") end, @@ -1942,6 +2065,7 @@ local list: { Entry } = { mime = { "model/ply", "application/ply" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, ascii = true, binary = true, polygons = true, points = true, colors = true }, + sniff = 0, load = function() return __include("model/ply") end, @@ -1954,6 +2078,7 @@ local list: { Entry } = { mime = { "model/x-pmx", "model/x-pmd" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text" }, caps = { decode = true, encode = false, materials = true, skins = true, morphTargets = true, pmd = true }, + sniff = 0, load = function() return __include("model/pmx") end, @@ -1966,6 +2091,7 @@ local list: { Entry } = { mime = { "model/x-doom3-proc" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Lexer" }, caps = { decode = true, encode = false, portals = true }, + sniff = 0, load = function() return __include("model/proc") end, @@ -1978,6 +2104,7 @@ local list: { Entry } = { mime = { "model/x-qubicle" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, voxels = true, truecolor = true }, + sniff = 0, load = function() return __include("model/qb") end, @@ -1990,6 +2117,8 @@ local list: { Entry } = { mime = { "application/x-roblox-rbxm", "application/x-roblox-rbxl" }, deps = { "core/Err", "core/Bytes", "core/Md5", "codecs/compress/Lz4", "codecs/compress/Zstd", "codecs/model/Rbx", "codecs/model/Rbx/Binary" }, caps = { decode = true, encode = true, tree = true, compression = { "none", "lz4", "zstd" } }, + sniff = 0, + variant = true, load = function() return __include("model/rbxm") end, @@ -2002,6 +2131,8 @@ local list: { Entry } = { mime = { "application/x-roblox-rbxmx", "application/x-roblox-rbxlx" }, deps = { "core/Err", "core/Bytes", "core/Base64", "core/Md5", "codecs/text/Xml", "codecs/model/Rbx" }, caps = { decode = true, encode = true, tree = true }, + sniff = 0, + variant = true, load = function() return __include("model/rbxmx") end, @@ -2014,6 +2145,7 @@ local list: { Entry } = { mime = { "application/x-roblox-mesh" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Draco" }, caps = { decode = true, encode = true, skinning = true, lods = true, versions = { "1.00", "1.01", "2.00", "3.00", "3.01", "4.00", "4.01", "5.00", "6.00", "7.00" } }, + sniff = 0, load = function() return __include("model/robloxmesh") end, @@ -2026,6 +2158,8 @@ local list: { Entry } = { mime = { "application/x-minecraft-schematic" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Nbt", "codecs/model/Minecraft" }, caps = { decode = true, encode = true, voxels = true, blocks = true, variants = { "schem", "schematic", "litematic" } }, + sniff = 1, + variant = true, load = function() return __include("model/schematic") end, @@ -2038,6 +2172,7 @@ local list: { Entry } = { mime = { "model/x-smd", "text/plain" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Rig" }, caps = { decode = true, encode = true, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/smd") end, @@ -2050,6 +2185,7 @@ local list: { Entry } = { mime = { "model/x-source-mdl" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Half", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/SourceAnim", "codecs/text/KeyValues" }, caps = { decode = true, encode = false, skins = true, morph = true, animation = true, lods = true }, + sniff = 0, load = function() return __include("model/sourcemdl") end, @@ -2062,6 +2198,7 @@ local list: { Entry } = { mime = { "model/stl", "application/sla" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, ascii = true, binary = true, colors = true, indexed = false }, + sniff = 0, load = function() return __include("model/stl") end, @@ -2074,6 +2211,7 @@ local list: { Entry } = { mime = { "text/x-unreal-t3d" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Text", "codecs/model/Brush" }, caps = { decode = true, encode = false, text = true, brushes = true, actors = true }, + sniff = 0, load = function() return __include("model/t3d") end, @@ -2086,6 +2224,7 @@ local list: { Entry } = { mime = { "text/x-udmf" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/DoomMap" }, caps = { decode = true, encode = false, maps = true }, + sniff = 0, load = function() return __include("model/udmf") end, @@ -2098,6 +2237,7 @@ local list: { Entry } = { mime = { "model/vnd.usda", "model/vnd.usdz+zip" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip", "codecs/model/Mat4" }, caps = { decode = true, encode = true, materials = true, animation = true, cameras = true, lights = true, polygons = true, vertexColors = true, usdz = "read", usdc = false }, + sniff = 0, load = function() return __include("model/usda") end, @@ -2110,6 +2250,7 @@ local list: { Entry } = { mime = { "model/x-vbsp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Lzma", "codecs/text/KeyValues", "codecs/model/Mat4", "codecs/model/Displacement", "containers/Zip", "containers/Archive" }, caps = { decode = true, encode = false, versions = { 19, 20, 21 }, displacements = true, staticProps = true, pak = true }, + sniff = 0, load = function() return __include("model/vbsp") end, @@ -2122,6 +2263,7 @@ local list: { Entry } = { mime = { "model/x-vmf" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Sniff", "Types", "codecs/text/KeyValues", "codecs/model/Brush", "codecs/model/Displacement", "codecs/model/Mat4" }, caps = { decode = true, encode = true, displacements = true, roundTrip = true }, + sniff = 0, load = function() return __include("model/vmf") end, @@ -2134,6 +2276,7 @@ local list: { Entry } = { mime = { "model/x-vox" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, voxels = true, sceneGraph = true, materials = true }, + sniff = 0, load = function() return __include("model/vox") end, @@ -2146,6 +2289,7 @@ local list: { Entry } = { mime = { "model/vrml", "x-world/x-vrml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Vrml" }, caps = { decode = true, encode = true, materials = true, polygons = true, animation = true, cameras = true, lights = true, lines = true, points = true }, + sniff = 0, load = function() return __include("model/vrml") end, @@ -2158,6 +2302,7 @@ local list: { Entry } = { mime = { "model/x-directx", "text/x-directx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/model/Mat4", "codecs/model/Rig" }, caps = { decode = true, encode = false, text = true, binary = true, compressed = true, materials = true, skins = true, animation = true, polygons = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/x") end, @@ -2170,6 +2315,7 @@ local list: { Entry } = { mime = { "model/x3d+xml", "model/x3d-vrml", "model/x3d+fastinfoset" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Vrml" }, caps = { decode = true, encode = true, materials = true, polygons = true, animation = true, cameras = true, lights = true, lines = true, points = true, xml = true, classic = true }, + sniff = 0, load = function() return __include("model/x3d") end, @@ -2182,6 +2328,7 @@ local list: { Entry } = { mime = { "model/step", "application/step", "application/p21" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, complexEntities = true, sections = true, brep = "plugin", tessellate = "plugin" }, + sniff = 0, load = function() return __include("cad/step") end, @@ -2194,6 +2341,7 @@ local list: { Entry } = { mime = { "application/x-font-bdf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = true, bitmap = true }, + sniff = 0, load = function() return __include("font/bdf") end, @@ -2206,6 +2354,7 @@ local list: { Entry } = { mime = { "application/x-bmfont" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, bitmap = true, variants = { "text", "xml", "binary" }, extraFiles = true }, + sniff = 0, load = function() return __include("font/bmfont") end, @@ -2218,6 +2367,7 @@ local list: { Entry } = { mime = { "application/vnd.ms-fontobject" }, deps = { "core/Err", "core/Bytes", "codecs/text/Text", "codecs/font/TrueType" }, caps = { decode = true, encode = true, variants = { "1.0", "2.1", "2.2" } }, + sniff = 0, load = function() return __include("font/eot") end, @@ -2230,6 +2380,7 @@ local list: { Entry } = { mime = { "application/x-font-fnt" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text", "codecs/font/Bitmap" }, caps = { decode = true, encode = false, bitmap = true, variants = { "fnt2", "fnt3", "ne", "pe" } }, + sniff = 0, load = function() return __include("font/fon") end, @@ -2242,6 +2393,7 @@ local list: { Entry } = { mime = { "application/x-hershey-font" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Raster" }, caps = { decode = true, encode = false, strokes = true }, + sniff = 0, load = function() return __include("font/hershey") end, @@ -2254,6 +2406,7 @@ local list: { Entry } = { mime = { "application/x-font-pcf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = false, bitmap = true }, + sniff = 0, load = function() return __include("font/pcf") end, @@ -2266,6 +2419,7 @@ local list: { Entry } = { mime = { "application/x-font-linux-psf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = true, bitmap = true, variants = { "psf1", "psf2" } }, + sniff = 0, load = function() return __include("font/psf") end, @@ -2278,6 +2432,7 @@ local list: { Entry } = { mime = { "font/ttf", "font/otf", "font/collection" }, deps = { "core/Err", "core/Bytes", "codecs/font/TrueType" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" }, collection = true, kerning = true }, + sniff = 0, load = function() return __include("font/ttf") end, @@ -2290,6 +2445,7 @@ local list: { Entry } = { mime = { "application/x-font-type1" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Raster", "codecs/font/GlyphNames" }, caps = { decode = true, encode = false, outlines = { "type1" }, variants = { "pfb", "pfa" } }, + sniff = 0, load = function() return __include("font/type1") end, @@ -2302,6 +2458,7 @@ local list: { Entry } = { mime = { "font/woff" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/font/TrueType" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" } }, + sniff = 0, load = function() return __include("font/woff") end, @@ -2314,6 +2471,7 @@ local list: { Entry } = { mime = { "font/woff2" }, deps = { "core/Err", "core/Bytes", "codecs/font/TrueType", "codecs/compress/Brotli" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" }, transforms = { "glyf", "loca", "hmtx" } }, + sniff = 0, load = function() return __include("font/woff2") end, @@ -2326,6 +2484,7 @@ local list: { Entry } = { mime = { "application/x-7z-compressed" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "Types", "codecs/compress/Lzma", "codecs/compress/Deflate", "codecs/compress/Bzip2", "codecs/compress/Zstd", "containers/Archive", "codecs/text/Text" }, caps = { decode = true, encode = false, methods = { "copy", "lzma", "lzma2", "deflate", "bcj", "delta" }, encrypted = false }, + sniff = 0, load = function() return __include("archive/7z") end, @@ -2338,6 +2497,7 @@ local list: { Entry } = { mime = { "application/x-amiga-disk-format" }, deps = { "core/Err", "core/Bytes", "containers/Archive" }, caps = { decode = true, encode = false, variants = { "ofs", "ffs" } }, + sniff = 0, load = function() return __include("archive/adf") end, @@ -2350,6 +2510,7 @@ local list: { Entry } = { mime = { "application/applefile", "multipart/appledouble" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true, variants = { "applesingle", "appledouble" } }, + sniff = 0, load = function() return __include("archive/applesingle") end, @@ -2362,6 +2523,7 @@ local list: { Entry } = { mime = { "application/x-archive", "application/vnd.debian.binary-package" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzma", "codecs/compress/Zstd", "codecs/compress/Bzip2", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, variants = { "gnu", "bsd" }, deb = true }, + sniff = 0, load = function() return __include("archive/ar") end, @@ -2374,6 +2536,7 @@ local list: { Entry } = { mime = { "application/x-arj" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = false, methods = { "store", "arj1", "arj2", "arj3", "arj4" } }, + sniff = 0, load = function() return __include("archive/arj") end, @@ -2386,6 +2549,7 @@ local list: { Entry } = { mime = { "application/mac-binhex40" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true }, + sniff = 0, load = function() return __include("archive/binhex") end, @@ -2398,6 +2562,7 @@ local list: { Entry } = { mime = { "application/x-brotli" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Brotli", "containers/Archive" }, caps = { decode = true, encode = false, stream = true }, + sniff = 1, load = function() return __include("archive/br") end, @@ -2410,6 +2575,7 @@ local list: { Entry } = { mime = { "application/x-bzip2" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "codecs/compress/Bzip2" }, caps = { decode = true, encode = false, stream = true }, + sniff = 0, load = function() return __include("archive/bz2") end, @@ -2422,6 +2588,7 @@ local list: { Entry } = { mime = { "application/vnd.ms-cab-compressed" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzx", "codecs/compress/Quantum", "containers/Archive" }, caps = { decode = true, encode = true, methods = { "store", "mszip", "lzx", "quantum" } }, + sniff = 0, load = function() return __include("archive/cab") end, @@ -2434,6 +2601,7 @@ local list: { Entry } = { mime = { "application/x-cpio" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Cpio" }, caps = { decode = true, encode = true, variants = { "newc", "crc", "odc", "bin" } }, + sniff = 0, load = function() return __include("archive/cpio") end, @@ -2446,6 +2614,7 @@ local list: { Entry } = { mime = { "application/x-d64" }, deps = { "core/Err", "core/Bytes", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "d64", "d71", "d81" } }, + sniff = 0, load = function() return __include("archive/d64") end, @@ -2458,6 +2627,7 @@ local list: { Entry } = { mime = { "application/x-fat-image" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Fat" }, caps = { decode = true, encode = true, variants = { "fat12", "fat16", "fat32" } }, + sniff = 1, load = function() return __include("archive/fat") end, @@ -2470,6 +2640,7 @@ local list: { Entry } = { mime = { "application/x-build-grp" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "containers/Archive" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("archive/grp") end, @@ -2482,6 +2653,7 @@ local list: { Entry } = { mime = { "application/gzip" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Deflate", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, stream = true }, + sniff = 0, load = function() return __include("archive/gzip") end, @@ -2494,6 +2666,7 @@ local list: { Entry } = { mime = { "application/x-iso9660-image" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Iso9660" }, caps = { decode = true, encode = false, extensions = { "joliet", "rockridge", "eltorito" } }, + sniff = 0, load = function() return __include("archive/iso") end, @@ -2506,6 +2679,7 @@ local list: { Entry } = { mime = { "application/x-lzh-compressed" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = true, methods = { "lh0", "lh1", "lh4", "lh5", "lh6", "lh7", "lhx", "lzs", "lz5", "lz4", "lhd" } }, + sniff = 0, load = function() return __include("archive/lha") end, @@ -2518,6 +2692,7 @@ local list: { Entry } = { mime = { "application/x-lz4" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Lz4", "codecs/compress/Xxh32", "containers/Archive" }, caps = { decode = true, encode = true, stream = true, legacy = true }, + sniff = 0, load = function() return __include("archive/lz4") end, @@ -2530,6 +2705,7 @@ local list: { Entry } = { mime = { "application/x-macbinary" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true, variants = { "I", "II", "III" } }, + sniff = 0, load = function() return __include("archive/macbinary") end, @@ -2542,6 +2718,7 @@ local list: { Entry } = { mime = { "application/x-mpq" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "codecs/compress/Deflate", "codecs/compress/Bzip2", "codecs/compress/Lzma", "codecs/compress/Explode" }, caps = { decode = true, encode = false, versions = { 1, 2, 3, 4 }, methods = { "zlib", "implode", "bzip2", "lzma", "sparse" }, encryption = true }, + sniff = 0, load = function() return __include("archive/mpq") end, @@ -2554,6 +2731,7 @@ local list: { Entry } = { mime = { "application/x-pak" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "quake", "sin" } }, + sniff = 0, load = function() return __include("archive/pak") end, @@ -2566,6 +2744,7 @@ local list: { Entry } = { mime = { "application/x-rpm" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzma", "codecs/compress/Zstd", "codecs/compress/Bzip2", "containers/Archive", "containers/Cpio" }, caps = { decode = true, encode = false, compressors = { "gzip", "bzip2", "xz", "lzma", "zstd" } }, + sniff = 0, load = function() return __include("archive/rpm") end, @@ -2578,6 +2757,7 @@ local list: { Entry } = { mime = { "application/x-tar" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, variants = { "ustar", "pax", "gnu" } }, + sniff = 1, load = function() return __include("archive/tar") end, @@ -2590,6 +2770,7 @@ local list: { Entry } = { mime = { "application/x-unitypackage" }, deps = { "core/Err", "core/Bytes", "core/Md5", "codecs/compress/Deflate", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true }, + sniff = 1, load = function() return __include("archive/unitypackage") end, @@ -2602,6 +2783,7 @@ local list: { Entry } = { mime = { "text/x-uuencode" }, deps = { "core/Err", "core/Bytes", "core/Base64", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "uu", "xx", "base64" } }, + sniff = 0, load = function() return __include("archive/uu") end, @@ -2614,6 +2796,7 @@ local list: { Entry } = { mime = { "application/x-vpk" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Crc32", "core/Md5", "containers/Archive" }, caps = { decode = true, encode = true, versions = { 1, 2 }, multipart = true }, + sniff = 0, load = function() return __include("archive/vpk") end, @@ -2626,6 +2809,7 @@ local list: { Entry } = { mime = { "application/x-wolf3d-vswap" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Archive", "codecs/image/Pixels" }, caps = { decode = true, encode = false, images = true, sounds = true }, + sniff = 0, load = function() return __include("archive/vswap") end, @@ -2638,6 +2822,7 @@ local list: { Entry } = { mime = { "application/x-doom" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Archive", "codecs/image/Pixels", "codecs/model/DoomMap" }, caps = { decode = true, encode = true, images = true, maps = true, variants = { "iwad", "pwad" } }, + sniff = 0, load = function() return __include("archive/wad") end, @@ -2650,6 +2835,7 @@ local list: { Entry } = { mime = { "application/x-quake-wad" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "containers/Archive", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, images = true, variants = { "wad2", "wad3" } }, + sniff = 0, load = function() return __include("archive/wad2") end, @@ -2662,6 +2848,7 @@ local list: { Entry } = { mime = { "application/x-xz", "application/x-lzma" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Lzma", "containers/Archive" }, caps = { decode = true, encode = false, stream = true, filters = { "lzma2", "lzma", "delta", "x86", "powerpc", "arm", "armthumb", "sparc", "arm64" } }, + sniff = 0, load = function() return __include("archive/xz") end, @@ -2674,6 +2861,7 @@ local list: { Entry } = { mime = { "application/x-yenc" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "containers/Archive" }, caps = { decode = true, encode = true, multipart = true }, + sniff = 0, load = function() return __include("archive/yenc") end, @@ -2686,6 +2874,7 @@ local list: { Entry } = { mime = { "application/x-compress" }, deps = { "core/Err", "core/Bytes", "codecs/compress/UnixCompress", "containers/Archive" }, caps = { decode = true, encode = true, stream = true, bits = { 9, 16 } }, + sniff = 0, load = function() return __include("archive/z") end, @@ -2698,6 +2887,7 @@ local list: { Entry } = { mime = { "application/zip", "application/x-zip-compressed" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip" }, caps = { decode = true, encode = true, methods = { "store", "deflate" }, zip64 = true }, + sniff = 0, load = function() return __include("archive/zip") end, @@ -2710,6 +2900,7 @@ local list: { Entry } = { mime = { "application/x-zoo" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "codecs/compress/Lzw", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = false, methods = { "store", "lzw", "lzh" } }, + sniff = 0, load = function() return __include("archive/zoo") end, @@ -2722,6 +2913,7 @@ local list: { Entry } = { mime = { "application/zstd" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Zstd", "containers/Archive" }, caps = { decode = true, encode = false, stream = true }, + sniff = 1, load = function() return __include("archive/zst") end, @@ -2734,6 +2926,7 @@ local list: { Entry } = { mime = { "application/cbor", "application/cbor-seq" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, binary = true, ordered = true, tags = true }, + sniff = 0, load = function() return __include("data/cbor") end, @@ -2746,6 +2939,7 @@ local list: { Entry } = { mime = { "text/csv", "text/tab-separated-values" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, header = true }, + sniff = 0, load = function() return __include("data/csv") end, @@ -2758,6 +2952,7 @@ local list: { Entry } = { mime = { "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, ordered = true }, + sniff = 0, load = function() return __include("data/ini") end, @@ -2770,6 +2965,7 @@ local list: { Entry } = { mime = { "application/json", "application/x-ndjson" }, deps = { "core/Err", "core/Bytes", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, ordered = true, streaming = true }, + sniff = 0, load = function() return __include("data/json") end, @@ -2782,6 +2978,7 @@ local list: { Entry } = { mime = { "application/msgpack", "application/x-msgpack" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, binary = true, ordered = true }, + sniff = 0, load = function() return __include("data/msgpack") end, @@ -2794,6 +2991,7 @@ local list: { Entry } = { mime = { "application/x-minecraft-nbt" }, deps = { "core/Err", "core/Bytes", "codecs/text/Nbt" }, caps = { decode = true, encode = true, binary = true, ordered = true, typed = true }, + sniff = 1, load = function() return __include("data/nbt") end, @@ -2806,6 +3004,7 @@ local list: { Entry } = { mime = { "application/x-plist", "application/x-bplist" }, deps = { "core/Err", "core/Bytes", "Types", "core/Base64", "codecs/text/Xml", "codecs/text/Json" }, caps = { decode = true, encode = true, binary = "read", ordered = true }, + sniff = 0, load = function() return __include("data/plist") end, @@ -2818,6 +3017,7 @@ local list: { Entry } = { mime = { "text/x-quake3-shader" }, deps = { "core/Err", "core/Bytes" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("data/q3shader") end, @@ -2830,6 +3030,7 @@ local list: { Entry } = { mime = { "text/x-quake3-skin" }, deps = { "core/Err", "core/Bytes" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("data/q3skin") end, @@ -2842,6 +3043,7 @@ local list: { Entry } = { mime = { "text/x-minecraft-snbt" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "codecs/text/Nbt" }, caps = { decode = true, encode = true, ordered = true, typed = true }, + sniff = 0, load = function() return __include("data/snbt") end, @@ -2854,6 +3056,7 @@ local list: { Entry } = { mime = { "application/toml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "codecs/text/Text" }, caps = { decode = true, encode = true, ordered = true, dates = true }, + sniff = 0, load = function() return __include("data/toml") end, @@ -2866,6 +3069,7 @@ local list: { Entry } = { mime = { "application/x-godot-resource" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/GodotVariant" }, caps = { decode = true, encode = true, ordered = true }, + sniff = 0, load = function() return __include("data/tres") end, @@ -2878,6 +3082,7 @@ local list: { Entry } = { mime = { "text/x-vdf" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "codecs/text/KeyValues" }, caps = { decode = true, encode = true, ordered = true, binary = true }, + sniff = 1, load = function() return __include("data/vdf") end, @@ -2890,6 +3095,7 @@ local list: { Entry } = { mime = { "application/xml", "text/xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "core/Sniff" }, caps = { decode = true, encode = true, namespaces = true, streaming = true }, + sniff = 0, load = function() return __include("data/xml") end, @@ -2902,6 +3108,7 @@ local list: { Entry } = { mime = { "application/yaml", "application/x-yaml", "text/yaml" }, deps = { "core/Err", "core/Bytes", "Types", "core/Base64", "codecs/text/Text" }, caps = { decode = true, encode = true, ordered = true, multiDocument = true, anchors = true }, + sniff = 0, load = function() return __include("data/yaml") end, @@ -2914,6 +3121,7 @@ local list: { Entry } = { mime = { "application/x-wolf3d-gamemaps" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types" }, caps = { decode = true, encode = false, tilemap = true }, + sniff = 0, load = function() return __include("vector/gamemaps") end, @@ -2926,6 +3134,7 @@ local list: { Entry } = { mime = { "application/x-ldtk+json" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Json" }, caps = { decode = true, encode = true, levels = true, worlds = true, intGrid = true, entities = true }, + sniff = 0, load = function() return __include("vector/ldtk") end, @@ -2938,6 +3147,7 @@ local list: { Entry } = { mime = { "application/x-ogmo+json" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "core/Base64", "Types", "codecs/text/Json" }, caps = { decode = true, encode = true, projects = true, entities = true, decals = true }, + sniff = 0, load = function() return __include("vector/ogmo") end, @@ -2950,6 +3160,7 @@ local list: { Entry } = { mime = { "image/svg+xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "codecs/image/Raster", "codecs/image/Blend", "core/Sniff" }, caps = { decode = true, encode = true, rasterize = true, text = false }, + sniff = 0, load = function() return __include("vector/svg") end, @@ -2962,6 +3173,7 @@ local list: { Entry } = { mime = { "application/x-tiled-tmx", "application/x-tiled-tmj" }, deps = { "core/Err", "core/Bytes", "core/Base64", "Types", "codecs/text/Xml", "codecs/text/Json", "codecs/compress/Deflate", "core/Sniff" }, caps = { decode = true, encode = true, tilesets = true, infinite = true }, + sniff = 0, load = function() return __include("vector/tiled") end, @@ -2974,6 +3186,7 @@ local list: { Entry } = { mime = { "image/x-aseprite" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate" }, caps = { decode = true, encode = true, layers = true, groups = true, animation = true, depths = { 8, 16, 32 } }, + sniff = 0, load = function() return __include("layered/aseprite") end, @@ -2986,6 +3199,7 @@ local list: { Entry } = { mime = { "image/openraster" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip", "codecs/text/Xml", "codecs/image/Blend" }, caps = { decode = true, encode = true, layers = true, groups = true, depths = { 8 } }, + sniff = 0, load = function() return __include("layered/ora") end, @@ -2998,6 +3212,7 @@ local list: { Entry } = { mime = { "image/vnd.adobe.photoshop" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Blend", "codecs/compress/Deflate", "codecs/compress/PackBits", "codecs/text/Text" }, caps = { decode = true, encode = true, layers = true, groups = true, depths = { 1, 8, 16, 32 } }, + sniff = 0, load = function() return __include("layered/psd") end, @@ -3010,6 +3225,7 @@ local list: { Entry } = { mime = { "text/x-ssa", "text/x-ass" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = true }, + sniff = 0, load = function() return __include("subtitle/ass") end, @@ -3022,6 +3238,7 @@ local list: { Entry } = { mime = { "application/x-subrip", "text/srt" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = false }, + sniff = 0, load = function() return __include("subtitle/srt") end, @@ -3034,6 +3251,7 @@ local list: { Entry } = { mime = { "text/vtt" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = true }, + sniff = 0, load = function() return __include("subtitle/vtt") end, @@ -3046,6 +3264,7 @@ local list: { Entry } = { mime = { "audio/x-669" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 8, 8 } }, + sniff = 0, load = function() return __include("music/669") end, @@ -3058,6 +3277,7 @@ local list: { Entry } = { mime = { "audio/x-ahx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Hively" }, caps = { decode = true, encode = false, render = true, channels = { 4, 4 }, subsongs = true }, + sniff = 0, load = function() return __include("music/ahx") end, @@ -3070,6 +3290,7 @@ local list: { Entry } = { mime = { "audio/x-far" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 16, 16 } }, + sniff = 0, load = function() return __include("music/far") end, @@ -3082,6 +3303,7 @@ local list: { Entry } = { mime = { "audio/x-hmp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true, hmi = true }, + sniff = 0, load = function() return __include("music/hmp") end, @@ -3094,6 +3316,7 @@ local list: { Entry } = { mime = { "audio/x-hvl" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Hively" }, caps = { decode = true, encode = false, render = true, channels = { 4, 16 }, subsongs = true }, + sniff = 0, load = function() return __include("music/hvl") end, @@ -3106,6 +3329,7 @@ local list: { Entry } = { mime = { "audio/it", "audio/x-it" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, channels = { 1, 64 }, compressedSamples = true }, + sniff = 0, load = function() return __include("music/it") end, @@ -3118,6 +3342,7 @@ local list: { Entry } = { mime = { "audio/x-med" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 64 } }, + sniff = 0, load = function() return __include("music/med") end, @@ -3130,6 +3355,7 @@ local list: { Entry } = { mime = { "audio/midi", "audio/x-midi" }, deps = { "core/Err", "core/Bytes", "codecs/audio/MidiRender", "Types" }, caps = { decode = true, encode = true, formats = { 0, 1, 2 }, render = true, streaming = true, rmid = true }, + sniff = 0, load = function() return __include("music/midi") end, @@ -3142,6 +3368,7 @@ local list: { Entry } = { mime = { "audio/x-mod", "audio/mod" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = true, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/mod") end, @@ -3154,6 +3381,7 @@ local list: { Entry } = { mime = { "audio/x-mtm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/mtm") end, @@ -3166,6 +3394,7 @@ local list: { Entry } = { mime = { "audio/x-mus" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true }, + sniff = 0, load = function() return __include("music/mus") end, @@ -3178,6 +3407,7 @@ local list: { Entry } = { mime = { "audio/x-okt" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 4, 8 } }, + sniff = 0, load = function() return __include("music/okt") end, @@ -3190,6 +3420,7 @@ local list: { Entry } = { mime = { "audio/x-ptm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/ptm") end, @@ -3202,6 +3433,7 @@ local list: { Entry } = { mime = { "audio/s3m", "audio/x-s3m" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/s3m") end, @@ -3214,6 +3446,7 @@ local list: { Entry } = { mime = { "audio/x-soundfont" }, deps = { "core/Err", "core/Bytes", "codecs/audio/SoundFont" }, caps = { decode = true, encode = false, sm24 = true, sf3 = false }, + sniff = 1, load = function() return __include("music/sf2") end, @@ -3226,6 +3459,7 @@ local list: { Entry } = { mime = { "audio/x-stm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 4, 4 } }, + sniff = 0, load = function() return __include("music/stm") end, @@ -3238,6 +3472,7 @@ local list: { Entry } = { mime = { "audio/x-ult" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/ult") end, @@ -3250,6 +3485,7 @@ local list: { Entry } = { mime = { "audio/x-umx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, container = true }, + sniff = 0, load = function() return __include("music/umx") end, @@ -3262,6 +3498,7 @@ local list: { Entry } = { mime = { "audio/xm", "audio/x-xm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Adpcm" }, caps = { decode = true, encode = true, render = true, channels = { 1, 64 } }, + sniff = 0, load = function() return __include("music/xm") end, @@ -3274,6 +3511,7 @@ local list: { Entry } = { mime = { "audio/x-xmidi" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true, songs = true }, + sniff = 0, load = function() return __include("music/xmi") end, @@ -3286,6 +3524,7 @@ local list: { Entry } = { mime = { "audio/x-mpegurl", "audio/mpegurl", "application/vnd.apple.mpegurl", "application/x-mpegurl" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Text", "core/Sniff" }, caps = { decode = true, encode = true, hls = true }, + sniff = 0, load = function() return __include("playlist/m3u") end, @@ -3298,6 +3537,7 @@ local list: { Entry } = { mime = { "audio/x-scpls", "audio/scpls" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Text", "core/Sniff" }, caps = { decode = true, encode = true }, + sniff = 1, load = function() return __include("playlist/pls") end, @@ -3310,6 +3550,7 @@ local list: { Entry } = { mime = { "application/xspf+xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Xml" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("playlist/xspf") end, @@ -3318,6 +3559,3392 @@ local list: { Entry } = { return list end +__FILES["Sniffs"] = function() + + +-- Sniffs: GENERATED by tools/gen_registry.py from the format folders - do not edit. +-- Each format's sniff (format path -> sniff(r)), copied from its init.luau with the top-level locals and types it +-- reaches (tools/sniff_extract.py), so detection requires no format module. Requires outside core/ are proxies that +-- require on first use. Formats whose sniff needs their module (Registry sniff = 2) are not here. +local S: { [string]: (any) -> number } = {} + +local function lazy(load: () -> any): any + local proxy = {} + return setmetatable(proxy, { + __index = function(_, k: any): any + local m = load() + setmetatable(proxy, { __index = m }) + return m[k] + end, + }) +end + +do -- image/ani +local Bytes = __include("core/Bytes") +S["image/ani"] = function(r: Bytes.Reader): number + return if r:peek(4) == "RIFF" and r:peek(4, 8) == "ACON" then 1 else 0 +end +end + +do -- image/art +local Bytes = __include("core/Bytes") +local readu8, readu16, readu32, readi16 = buffer.readu8, buffer.readu16, buffer.readu32, buffer.readi16 +local function header(b: buffer, o: number, limit: number): (number?, number?, number?, number?, boolean?) + local p = o + local prefixed = false + if limit - p >= 8 and buffer.readstring(b, p, 8) == "BUILDART" then + p += 8 + prefixed = true + end + if limit - p < 16 or readu32(b, p) ~= 1 then + return nil, nil, nil, nil, nil + end + local first, last = readu32(b, p + 8), readu32(b, p + 12) + if last < first or last - first >= 65536 then + return nil, nil, nil, nil, nil + end + return p + 16, first, last, readu32(b, p + 4), prefixed +end +S["image/art"] = function(r: Bytes.Reader): number + local at, first, last = header(r.buf, r.base, r.limit) + if not at or not first or not last then + return 0 + end + local n = last - first + 1 + local p = at :: number + if r.limit - p < n * 8 then + return 0 + end + local total = 0 + for i = 0, n - 1 do + local w, h = readi16(r.buf, p + i * 2), readi16(r.buf, p + n * 2 + i * 2) + if w < 0 or h < 0 then + return 0 + end + total += w * h + end + local size = p + n * 8 + total - r.base + local have = r.limit - r.base + return if size == have then 0.9 elseif size < have and have - size < 4096 then 0.5 else 0 +end +end + +do -- image/blp +local Bytes = __include("core/Bytes") +S["image/blp"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m == "BLP1" or m == "BLP2" then 1 elseif m == "BLP0" then 0.8 else 0 +end +end + +do -- image/bmp +local Bytes = __include("core/Bytes") +S["image/bmp"] = function(r: Bytes.Reader): number + if r:peek(2) ~= "BM" then + return 0 + end + local n = r:peekU8(14) + math.max(r:peekU8(15), 0) * 256 + if r:peekU8(16) == 0 and r:peekU8(17) == 0 and (n == 12 or n == 16 or n == 40 or n == 52 or n == 56 or n == 64 or n == 108 or n == 124) then + return 0.9 + end + return 0.2 +end +end + +do -- image/dds +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "DDS " +S["image/dds"] = function(r: Bytes.Reader): number + return math.max(Sniff.magic(r, MAGIC .. "\124\0\0\0"), Sniff.magic(r, MAGIC, 0, 0.6)) +end +end + +do -- image/exr +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "\118\47\49\1" +S["image/exr"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- image/gif +local Bytes = __include("core/Bytes") +S["image/gif"] = function(r: Bytes.Reader): number + local s = r:peek(6) + return if s == "GIF89a" or s == "GIF87a" then 1 else 0 +end +end + +do -- image/hdr +local Bytes = __include("core/Bytes") +S["image/hdr"] = function(r: Bytes.Reader): number + local s = r:peek(10) + if s == "#?RADIANCE" then + return 1 + end + if string.sub(s, 1, 6) == "#?RGBE" then + return 1 + end + if string.sub(s, 1, 2) == "#?" and string.match(s, "^#%?%u") then + return 0.5 + end + return 0 +end +end + +do -- image/icns +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/icns"] = function(r: Bytes.Reader): number + return Sniff.magic(r, "icns") +end +end + +do -- image/ico +local Bytes = __include("core/Bytes") +local readu8 = buffer.readu8 +S["image/ico"] = function(r: Bytes.Reader): number + if r:remaining() < 22 then + return 0 + end + local b, o = r.buf, r.pos + local typ = buffer.readu16(b, o + 2) + local count = buffer.readu16(b, o + 4) + if buffer.readu16(b, o) ~= 0 or (typ ~= 1 and typ ~= 2) or count == 0 then + return 0 + end + -- the first entry: reserved byte 0, a size and offset inside the file + local size, off = buffer.readu32(b, o + 14), buffer.readu32(b, o + 18) + if readu8(b, o + 9) ~= 0 or size == 0 or off < 6 + count * 16 then + return 0 + end + return 0.8 +end +end + +do -- image/ilbm +local Bytes = __include("core/Bytes") +S["image/ilbm"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "FORM" then + return 0 + end + local t = r:peek(4, 8) + return if t == "ILBM" or t == "PBM " then 1 else 0 +end +end + +do -- image/jpeg +local Bytes = __include("core/Bytes") +S["image/jpeg"] = function(r: Bytes.Reader): number + local s = r:peek(3) + return if s == "\255\216\255" then 1 else 0 +end +end + +do -- image/ktx +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local ID1 = "\171KTX 11\187\r\n\26\n" +local ID2 = "\171KTX 20\187\r\n\26\n" +S["image/ktx"] = function(r: Bytes.Reader): number + return math.max(Sniff.magic(r, ID2), Sniff.magic(r, ID1)) +end +end + +do -- image/lmp +local Bytes = __include("core/Bytes") +local function kindOf(r: Bytes.Reader): string? + local n = r:remaining() + if n == 768 then + return "palette" + elseif n == 16385 or n == 16384 then + return "colormap" + end + if n < 9 then + return nil + end + local w, h = buffer.readu32(r.buf, r.pos), buffer.readu32(r.buf, r.pos + 4) + if w > 0 and h > 0 and w <= 4096 and h <= 4096 and 8 + w * h == n then + return "qpic" + end + return nil +end +S["image/lmp"] = function(r: Bytes.Reader): number + local k = kindOf(r) + return if k == "qpic" then 0.3 elseif k then 0.05 else 0 +end +end + +do -- image/pcx +local Bytes = __include("core/Bytes") +S["image/pcx"] = function(r: Bytes.Reader): number + if r:size() < 128 then + return 0 + end + local m, v, e, bpp = r:peekU8(0), r:peekU8(1), r:peekU8(2), r:peekU8(3) + if m ~= 10 or (v ~= 0 and v ~= 2 and v ~= 3 and v ~= 4 and v ~= 5) or e > 1 then + return 0 + end + return if bpp == 1 or bpp == 2 or bpp == 4 or bpp == 8 then 0.8 else 0 +end +end + +do -- image/png +local Bytes = __include("core/Bytes") +local SIGNATURE = "\137PNG\r\n\26\n" +S["image/png"] = function(r: Bytes.Reader): number + return if r:peek(8) == SIGNATURE then 1 else 0 +end +end + +do -- image/pnm +local Bytes = __include("core/Bytes") +S["image/pnm"] = function(r: Bytes.Reader): number + if r:remaining() < 3 then + return 0 + end + local a, b, c = r:peekU8(0), r:peekU8(1), r:peekU8(2) + if a ~= 80 then -- 'P' + return 0 + end + local ws = c == 32 or (c >= 9 and c <= 13) + if b >= 49 and b <= 55 and ws then -- P1..P7 + return 0.9 + end + if (b == 70 or b == 102) and ws then -- PF / Pf + return 0.9 + end + return 0 +end +end + +do -- image/qoi +local Bytes = __include("core/Bytes") +S["image/qoi"] = function(r: Bytes.Reader): number + return if r:peek(4) == "qoif" then 1 else 0 +end +end + +do -- image/sgi +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/sgi"] = function(r: Bytes.Reader): number + if Sniff.magic(r, "\1\218") == 0 or r:size() < 512 then + return 0 + end + local st, bpc = r:peekU8(2), r:peekU8(3) + return if st <= 1 and (bpc == 1 or bpc == 2) then 1 else 0 +end +end + +do -- image/spr +local Bytes = __include("core/Bytes") +S["image/spr"] = function(r: Bytes.Reader): number + if r:remaining() < 36 or r:peek(4) ~= "IDSP" then + return 0 + end + local v = buffer.readi32(r.buf, r.pos + 4) + return if v == 1 or v == 2 or v == 32 then 1 else 0.3 +end +end + +do -- image/sunras +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "\89\166\106\149" +S["image/sunras"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- image/tga +local Bytes = __include("core/Bytes") +local TYPES = { [1] = true, [2] = true, [3] = true, [9] = true, [10] = true, [11] = true } +local FOOTER = "TRUEVISION-XFILE.\0" +local readu8 = buffer.readu8 +type Header = { + idLen: number, + cmapType: number, + imageType: number, + cmapFirst: number, + cmapLen: number, + cmapBits: number, + width: number, + height: number, + depth: number, + desc: number, +} +local function header(r: Bytes.Reader): Header? + if r.limit - r.base < 18 then + return nil + end + local b, o = r.buf, r.base + local function u16(q: number): number + return readu8(b, o + q) + readu8(b, o + q + 1) * 256 + end + local h: Header = { + idLen = readu8(b, o), + cmapType = readu8(b, o + 1), + imageType = readu8(b, o + 2), + cmapFirst = u16(3), + cmapLen = u16(5), + cmapBits = readu8(b, o + 7), + width = u16(12), + height = u16(14), + depth = readu8(b, o + 16), + desc = readu8(b, o + 17), + } + return h +end +local function implausible(h: Header): string? + local t = h.imageType + if not TYPES[t] then + return "image type " .. t + end + if h.cmapType > 1 then + return "colour map type " .. h.cmapType + end + local mapped = t == 1 or t == 9 + if mapped and (h.cmapType ~= 1 or (h.depth ~= 8 and h.depth ~= 16)) then + return "colour-mapped image without a colour map" + end + if h.cmapType == 1 and h.cmapLen > 0 and h.cmapBits ~= 15 and h.cmapBits ~= 16 and h.cmapBits ~= 24 and h.cmapBits ~= 32 then + return "colour map entry size " .. h.cmapBits + end + if (t == 2 or t == 10) and h.depth ~= 15 and h.depth ~= 16 and h.depth ~= 24 and h.depth ~= 32 then + return "pixel depth " .. h.depth + end + if (t == 3 or t == 11) and h.depth ~= 8 and h.depth ~= 16 then + return "grey pixel depth " .. h.depth + end + if h.width == 0 or h.height == 0 then + return "zero size" + end + if h.desc >= 64 then + return "interleaving / reserved descriptor bits" + end + return nil +end +S["image/tga"] = function(r: Bytes.Reader): number + local h = header(r) + if not h or implausible(h) then + return 0 + end + local n = r.limit - r.base + if n >= 44 and buffer.readstring(r.buf, r.limit - 18, 18) == FOOTER then + return 0.9 + end + return 0.2 +end +end + +do -- image/tiff +local Bytes = __include("core/Bytes") +S["image/tiff"] = function(r: Bytes.Reader): number + local s = r:peek(4) + if s == "II*\0" or s == "MM\0*" or s == "II+\0" or s == "MM\0+" then + return 1 + end + return 0 +end +end + +do -- image/tim +local Bytes = __include("core/Bytes") +S["image/tim"] = function(r: Bytes.Reader): number + if r:remaining() < 20 or r:peek(4) ~= "\16\0\0\0" then + return 0 + end + local flags = r:peekU8(4) + if flags > 0x0F or (flags % 8) > 3 or r:peek(3, 5) ~= "\0\0\0" then + return 0 + end + return 0.8 +end +end + +do -- image/vtf +local Bytes = __include("core/Bytes") +S["image/vtf"] = function(r: Bytes.Reader): number + return if r:peek(4) == "VTF\0" and r:peekU8(4) == 7 then 1 else 0 +end +end + +do -- image/webp +local Bytes = __include("core/Bytes") +S["image/webp"] = function(r: Bytes.Reader): number + if r:peek(4) == "RIFF" and r:peek(4, 8) == "WEBP" then + return 1 + end + return 0 +end +end + +do -- image/xbm +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/xbm"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 256, true) + if string.match(s, "^#define%s+[%w_]*_?width%s+%d+") or string.match(s, "^/%*.-%*/%s*#define%s+[%w_]*width%s+%d+") then + return 0.9 + end + return 0 +end +end + +do -- image/xpm +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/xpm"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 64, true) + if string.sub(s, 1, 9) == "/* XPM */" or string.sub(s, 1, 6) == "! XPM2" then + return 1 + end + return 0 +end +end + +do -- audio/aac +local Bytes = __include("core/Bytes") +local Aac = lazy(function() + return __include("codecs/audio/Aac") +end) +local readu8 = buffer.readu8 +local function id3Size(b: buffer, p: number, limit: number): number + if p + 10 > limit or buffer.readstring(b, p, 3) ~= "ID3" then + return 0 + end + local s = 0 + for i = 6, 9 do + s = s * 128 + bit32.band(readu8(b, p + i), 127) + end + local footer = if bit32.band(readu8(b, p + 5), 0x10) ~= 0 then 10 else 0 + return 10 + s + footer +end +S["audio/aac"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + p += id3Size(b, p, limit) + local h = Aac.adts(b, p, limit) + if not h then + return 0 + end + local h2 = Aac.adts(b, p + h.frameSize, limit) + if h2 and h2.sfIndex == h.sfIndex and h2.channelConfig == h.channelConfig then + return 0.9 + end + return if p + h.frameSize >= limit then 0.7 else 0.4 +end +end + +do -- audio/ac3 +local Bytes = __include("core/Bytes") +local Ac3 = lazy(function() + return __include("codecs/audio/Ac3") +end) +S["audio/ac3"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + local h = Ac3.header(b, p, limit) + if not h then + return 0 + end + local h2 = Ac3.header(b, p + h.frameSize, limit) + if h2 and h2.sampleRate == h.sampleRate then + return 0.9 + end + return if p + h.frameSize >= limit then 0.6 else 0.3 +end +end + +do -- audio/adpcm +local Bytes = __include("core/Bytes") +S["audio/adpcm"] = function(_r: Bytes.Reader): number + return 0 +end +end + +do -- audio/adx +local Bytes = __include("core/Bytes") +S["audio/adx"] = function(r: Bytes.Reader): number + if r:peekU8(0) ~= 0x80 or r:peekU8(1) ~= 0 then + return 0 + end + local off = r:peekU8(2) * 256 + r:peekU8(3) + return if r:peek(6, off - 2) == "(c)CRI" then 1 else 0 +end +end + +do -- audio/aiff +local Bytes = __include("core/Bytes") +S["audio/aiff"] = function(r: Bytes.Reader): number + if r:remaining() < 12 or r:peek(4) ~= "FORM" then + return 0 + end + local form = buffer.readstring(r.buf, r.pos + 8, 4) + return if form == "AIFF" or form == "AIFC" then 1 else 0 +end +end + +do -- audio/ape +local Bytes = __include("core/Bytes") +S["audio/ape"] = function(r: Bytes.Reader): number + local head = r:peek(4) + if head == "MAC " or head == "MACF" then -- MACF: float samples + return 1 + end + if string.sub(head, 1, 3) == "ID3" then + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + local id = r:peek(4, 10 + sz + (if footer then 10 else 0)) + return if id == "MAC " or id == "MACF" then 1 else 0 + end + return 0 +end +end + +do -- audio/au +local Bytes = __include("core/Bytes") +S["audio/au"] = function(r: Bytes.Reader): number + return if r:peek(4) == ".snd" then 1 else 0 +end +end + +do -- audio/brstm +local Bytes = __include("core/Bytes") +S["audio/brstm"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m ~= "RSTM" and m ~= "CSTM" and m ~= "FSTM" then + return 0 + end + local bom = r:peek(2, 4) + return if bom == "\254\255" or bom == "\255\254" then 1 else 0 +end +end + +do -- audio/caf +local Bytes = __include("core/Bytes") +S["audio/caf"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h == 8 and string.sub(h, 1, 4) == "caff" and string.byte(h, 5) == 0 and string.byte(h, 6) == 1 then + return 1 + end + return 0 +end +end + +do -- audio/flac +local Bytes = __include("core/Bytes") +S["audio/flac"] = function(r: Bytes.Reader): number + local head = r:peek(4) + if head == "fLaC" then + return 1 + end + if head == "OggS" then + -- the first page's packet: 0x7F "FLAC" (the Ogg FLAC mapping) + local nseg = r:peekU8(26) + if nseg > 0 and r:peek(5, 27 + nseg) == "\127FLAC" then + return 1 + end + return 0 + end + if string.sub(head, 1, 3) == "ID3" then + -- an ID3v2 tag, then fLaC (mp3 files start with ID3 too) + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + return if r:peek(4, 10 + sz + (if footer then 10 else 0)) == "fLaC" then 1 else 0 + end + return 0 +end +end + +do -- audio/m4a +local Bytes = __include("core/Bytes") +local IsoBmff = lazy(function() + return __include("containers/IsoBmff") +end) +local AUDIO_BRANDS: { [string]: number } = { ["M4A "] = 1, ["M4B "] = 1, ["M4P "] = 1, ["M4V "] = 0.3 } +S["audio/m4a"] = function(r: Bytes.Reader): number + local brand = IsoBmff.sniff(r) + if brand == nil then + return 0 + end + if AUDIO_BRANDS[brand] then + return AUDIO_BRANDS[brand] + end + if brand == "avif" or brand == "avis" or brand == "heic" or brand == "heix" or brand == "mif1" or brand == "msf1" or brand == "crx " then + return 0 + end + return 0.4 -- an MP4 / MOV that may hold audio; a video format claims it more strongly +end +end + +do -- audio/mp3 +local Bytes = __include("core/Bytes") +local Header = lazy(function() + return __include("codecs/audio/Mpa/Header") +end) +local Tags = lazy(function() + return __include("audio/mp3/Tags") +end) +S["audio/mp3"] = function(r: Bytes.Reader): number + local b, p, lim = r.buf, r.pos, r.limit + local id3 = false + for _ = 1, 4 do -- (ffmpeg writes a tag even when the input had one: tags can follow each other) + local n = if p + 3 <= lim and buffer.readstring(b, p, 3) == "ID3" then Tags.id3v2Size(b, p, lim) else 0 + if n <= 0 then + break + end + id3 = true + p += n + end + if p + 4 > lim or not Header.valid(b, p) then + return if id3 then 0.5 else 0 + end + local fb = Header.frameBytes(b, p, 0) + if fb > 0 then + fb += Header.padding(b, p) + if p + fb + 4 <= lim and Header.compare(b, p, p + fb) then + return 0.9 + end + if p + fb == lim then + return 0.6 + end + end + return if id3 then 0.7 else 0.25 +end +end + +do -- audio/mpc +local Bytes = __include("core/Bytes") +local Musepack = lazy(function() + return __include("codecs/audio/Musepack") +end) +local function id3v2(b: buffer, p: number, limit: number): number + if p + 10 > limit or buffer.readstring(b, p, 3) ~= "ID3" then + return 0 + end + local n = 10 + for i = 6, 9 do + n += bit32.band(buffer.readu8(b, p + i), 127) * 128 ^ (9 - i) + end + return n + (if bit32.band(buffer.readu8(b, p + 5), 0x10) ~= 0 then 10 else 0) +end +S["audio/mpc"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + p += id3v2(b, p, limit) + local v = Musepack.magic(b, p, limit) + if v == 8 then + return 1 + end + return if v == 7 then 0.9 else 0 +end +end + +do -- audio/opus +local Bytes = __include("core/Bytes") +S["audio/opus"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "OggS" then + return 0 + end + local nseg = r:peekU8(26) + if nseg < 1 then + return 0 + end + return if r:peek(8, 27 + nseg) == "OpusHead" then 1 else 0 +end +end + +do -- audio/qoa +local Bytes = __include("core/Bytes") +S["audio/qoa"] = function(r: Bytes.Reader): number + return if r:peek(4) == "qoaf" then 1 else 0 +end +end + +do -- audio/tta +local Bytes = __include("core/Bytes") +local function id3Size(r: Bytes.Reader): number + if r:peek(3) ~= "ID3" then + return 0 + end + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + return 10 + sz + (if footer then 10 else 0) +end +S["audio/tta"] = function(r: Bytes.Reader): number + return if r:peek(4, id3Size(r)) == "TTA1" then 1 else 0 +end +end + +do -- audio/vag +local Bytes = __include("core/Bytes") +S["audio/vag"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m == "VAGp" or m == "VAGi" or m == "KVAG" then 1 else 0 +end +end + +do -- audio/voc +local Bytes = __include("core/Bytes") +local MAGIC = "Creative Voice File\26" +S["audio/voc"] = function(r: Bytes.Reader): number + return if r:peek(20) == MAGIC then 1 else 0 +end +end + +do -- audio/vorbis +local Bytes = __include("core/Bytes") +S["audio/vorbis"] = function(r: Bytes.Reader): number + if r:remaining() < 35 or r:peek(4) ~= "OggS" then + return 0 + end + local b, p = r.buf, r.pos + local nseg = buffer.readu8(b, p + 26) + local d = p + 27 + nseg + if d + 7 > r.limit then + return 0 + end + return if buffer.readu8(b, d) == 1 and buffer.readstring(b, d + 1, 6) == "vorbis" then 1 else 0 +end +end + +do -- audio/wav +local Bytes = __include("core/Bytes") +local Riff = lazy(function() + return __include("containers/Riff") +end) +S["audio/wav"] = function(r: Bytes.Reader): number + return if Riff.sniff(r) == "WAVE" then 1 else 0 +end +end + +do -- audio/wavpack +local Bytes = __include("core/Bytes") +S["audio/wavpack"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "wvpk" then + return 0 + end + local v = r:peekU8(9) + return if v == 4 then 1 else 0.5 +end +end + +do -- video/avi +local Bytes = __include("core/Bytes") +S["video/avi"] = function(r: Bytes.Reader): number + if r:peek(4) == "RIFF" and r:peek(4, 8) == "AVI " then + return 1 + end + return 0 +end +end + +do -- video/fli +local Bytes = __include("core/Bytes") +local FLI, FLC, DTA = 0xAF11, 0xAF12, 0xAF44 +S["video/fli"] = function(r: Bytes.Reader): number + local s = r:peek(18) + if #s < 18 then + return 0 + end + local magic = string.byte(s, 5) + string.byte(s, 6) * 256 + if magic ~= FLI and magic ~= FLC and magic ~= DTA then + return 0 + end + local w = string.byte(s, 9) + string.byte(s, 10) * 256 + local h = string.byte(s, 11) + string.byte(s, 12) * 256 + if w > 4096 or h > 4096 then + return 0 + end + return 0.9 +end +end + +do -- video/flv +local Bytes = __include("core/Bytes") +S["video/flv"] = function(r: Bytes.Reader): number + if r:remaining() >= 9 and r:peek(3) == "FLV" then + return if r:peekU8(3) == 1 then 1 else 0.6 + end + return 0 +end +end + +do -- video/h264 +local Bytes = __include("core/Bytes") +S["video/h264"] = function(r: Bytes.Reader): number + local s = r:peek(5) + if not s or #s < 4 then + return 0 + end + local hdr + if string.byte(s, 1) == 0 and string.byte(s, 2) == 0 and string.byte(s, 3) == 1 then + hdr = string.byte(s, 4) + elseif #s >= 5 and string.byte(s, 1) == 0 and string.byte(s, 2) == 0 and string.byte(s, 3) == 0 and string.byte(s, 4) == 1 then + hdr = string.byte(s, 5) + else + return 0 + end + if hdr >= 128 then + return 0 + end + local t = hdr % 32 + if t == 7 then + return 0.8 + elseif t == 9 or t == 6 or t == 8 then + return 0.5 + elseif t == 5 then + return 0.4 + end + return 0 +end +end + +do -- video/mkv +local Bytes = __include("core/Bytes") +S["video/mkv"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "\26\69\223\163" then + return 0 + end + local head = r:peek(math.min(64, r:remaining())) + if string.find(head, "webm", 1, true) or string.find(head, "matroska", 1, true) then + return 1 + end + return 0.5 +end +end + +do -- video/mp4 +local Bytes = __include("core/Bytes") +local IsoBmff = lazy(function() + return __include("containers/IsoBmff") +end) +local IMAGE_BRANDS = { avif = true, avis = true, heic = true, heix = true, mif1 = true, msf1 = true, ["crx "] = true } +local AUDIO_BRANDS = { ["M4A "] = true, ["M4B "] = true, ["M4P "] = true } +S["video/mp4"] = function(r: Bytes.Reader): number + local brand = IsoBmff.sniff(r) + if brand == nil or IMAGE_BRANDS[brand] then + return 0 + end + if AUDIO_BRANDS[brand] then + return 0.2 + end + if brand == "M4V " then + return 0.9 + end + return if brand == "" then 0.6 else 0.8 +end +end + +do -- video/mpegps +local Bytes = __include("core/Bytes") +S["video/mpegps"] = function(r: Bytes.Reader): number + if r:peek(4) == "\0\0\1\186" then + return 0.9 + end + if r:peek(4) == "\0\0\1\179" then + return 0.5 -- an MPEG-1 / 2 video elementary stream (sequence header) + end + return 0 +end +end + +do -- video/mpegts +local Bytes = __include("core/Bytes") +local SIZES = { 188, 192 } +local function packetSize(r: Bytes.Reader): (number, number) + local n = r:remaining() + local head = r:peek(2048 + 2 * 192) + local lim = math.min(n, 2048) + local start = 0 + while start < lim do + local f = string.find(head, "G", start + 1, true) -- 0x47 + if not f or f > lim then + break + end + start = f - 1 + for _, size in SIZES do + local hits, need = 0, math.min(3, (n - start - 1) // size + 1) + for k = 0, 2 do + local at = start + k * size + if at < n and string.byte(head, at + 1) == 0x47 then + hits += 1 + end + end + if hits >= need and (need >= 2 or start == 0) then + if size == 192 and start >= 4 then + return 192, start - 4 + elseif size == 188 then + return 188, start + end + end + end + start += 1 + end + return 0, 0 +end +S["video/mpegts"] = function(r: Bytes.Reader): number + local s, off = packetSize(r) + if s == 0 then + return 0 + end + if off > 0 then + return 0.6 + end + return if r:remaining() >= 3 * s then 0.9 else 0.5 +end +end + +do -- video/ogv +local Bytes = __include("core/Bytes") +S["video/ogv"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "OggS" then + return 0 + end + local b, p, lim = r.buf, r.pos, r.limit + for _ = 1, 8 do + if p + 27 > lim or buffer.readstring(b, p, 4) ~= "OggS" or buffer.readu8(b, p + 5) % 4 < 2 then + return 0 + end + local nseg = buffer.readu8(b, p + 26) + local d = p + 27 + nseg + if d + 7 <= lim and buffer.readu8(b, d) == 0x80 and buffer.readstring(b, d + 1, 6) == "theora" then + return 1 + end + if d > lim then + return 0 + end + local size = 0 + for i = 0, nseg - 1 do + size += buffer.readu8(b, p + 27 + i) + end + p = d + size + end + return 0 +end +end + +do -- video/smk +local Bytes = __include("core/Bytes") +S["video/smk"] = function(r: Bytes.Reader): number + local s = r:peek(4) + if s ~= "SMK2" and s ~= "SMK4" then + return 0 + end + return 1 +end +end + +do -- video/y4m +local Bytes = __include("core/Bytes") +local MAGIC = "YUV4MPEG2 " +S["video/y4m"] = function(r: Bytes.Reader): number + return if r:peek(10) == MAGIC then 1 else 0 +end +end + +do -- model/3ds +local Bytes = __include("core/Bytes") +S["model/3ds"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h < 8 or string.byte(h, 1) ~= 0x4D or string.byte(h, 2) ~= 0x4D then + return 0 + end + local b1, b2, b3, b4, c1, c2 = string.byte(h, 3, 8) + local size = b1 + b2 * 256 + b3 * 65536 + b4 * 16777216 + local child = c1 + c2 * 256 + if size < 16 or not (child == 0x0002 or child == 0x3D3D or child == 0xB000) then + return 0 + end + return if size == r.limit - r.pos then 0.95 else 0.7 +end +end + +do -- model/3mf +local Bytes = __include("core/Bytes") +S["model/3mf"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "PK\3\4" then + return 0 + end + local n = r:size() + local tail = buffer.readstring(r.buf, r.base + math.max(0, n - 65536), math.min(n, 65536)) + if string.find(tail, "3D/[^/]*%.model") or string.find(tail, "3dmodel.model", 1, true) then + return 0.95 + end + local head = r:peek(256) + if string.find(head, "3D/", 1, true) then + return 0.7 + end + return 0 +end +end + +do -- model/ase +local Bytes = __include("core/Bytes") +local Text = lazy(function() + return __include("codecs/text/Text") +end) +local MAGIC = "*3DSMAX_ASCIIEXPORT" +local function utf16(r: Bytes.Reader): (boolean?, boolean) + local h = r:peek(2) + if h == "\255\254" then + return true, false + elseif h == "\254\255" then + return true, true + elseif #h == 2 and string.byte(h, 2) == 0 and string.byte(h, 1) == 42 then + return true, false + elseif #h == 2 and string.byte(h, 1) == 0 and string.byte(h, 2) == 42 then + return true, true + end + return nil, false +end +local function text(r: Bytes.Reader, n: number?): string + local wide, be = utf16(r) + local len = r.limit - r.pos + if n then + len = math.min(len, n) + end + if wide then + local skip = if r:peek(2) == "\255\254" or r:peek(2) == "\254\255" then 2 else 0 + return Text.utf16(r.buf, r.pos + skip, len - skip, be) + end + return Text.toUtf8(buffer.readstring(r.buf, r.pos, len)) +end +S["model/ase"] = function(r: Bytes.Reader): number + local h = string.match(text(r, 256), "^%s*(%*[%w_]+)") + if h == MAGIC then + return 1 + end + return 0 +end +end + +do -- model/b3d +local Bytes = __include("core/Bytes") +S["model/b3d"] = function(r: Bytes.Reader): number + if r:peek(4) == "BB3D" then + return if r:peek(4, 8) ~= "" then 1 else 0.8 + end + return 0 +end +end + +do -- model/blend +local Bytes = __include("core/Bytes") +local Deflate = lazy(function() + return __include("codecs/compress/Deflate") +end) +local Zstd = lazy(function() + return __include("codecs/compress/Zstd") +end) +S["model/blend"] = function(r: Bytes.Reader): number + local head = r:peek(7) + if head == "BLENDER" then + return 1 + end + local n = r.limit - r.base + if string.sub(head, 1, 3) == "\31\139\8" then + local inner = Deflate.peek(r.buf, r.base, n, 7) + return if inner and buffer.tostring(inner) == "BLENDER" then 1 else 0 + end + if string.sub(head, 1, 4) == Zstd.MAGIC then + if n > 4 * 2 ^ 20 then + return 0.5 + end + local out = Zstd.decompress(r.buf, r.base, n, { verify = false }) + return if out and buffer.len(out) >= 7 and buffer.readstring(out, 0, 7) == "BLENDER" then 1 else 0 + end + return 0 +end +end + +do -- model/bsp +local Bytes = __include("core/Bytes") +S["model/bsp"] = function(r: Bytes.Reader): number + if r:remaining() < 64 then + return 0 + end + local m = r:peek(4) + local v = buffer.readi32(r.buf, r.pos + (if m == "IBSP" then 4 else 0)) + if m == "BSP2" or m == "2PSB" then + v = 29 + end + if m == "IBSP" then + return if v == 38 or v == 46 or v == 47 then 1 else 0.3 + end + if v == 29 or v == 30 then + local size = r:remaining() + for i = 0, 14 do + local o, n = buffer.readi32(r.buf, r.pos + 4 + i * 8), buffer.readi32(r.buf, r.pos + 8 + i * 8) + if o < 0 or n < 0 or o + n > size then + return 0 + end + end + return 0.6 + end + return 0 +end +end + +do -- model/buildmap +local Bytes = __include("core/Bytes") +local SECTOR_SIZE, WALL_SIZE, SPRITE_SIZE = 40, 32, 44 +local HEADER = 22 -- version, posx, posy, posz, ang, cursectnum, then u16 numsectors at 20 +local readu16 = buffer.readu16 +local function layout(b: buffer, o: number, limit: number): (number?, number?, number?, number?) + if limit - o < HEADER then + return nil, nil, nil, nil + end + local ns = readu16(b, o + 20) + local p = o + HEADER + ns * SECTOR_SIZE + if p + 2 > limit then + return nil, nil, nil, nil + end + local nw = readu16(b, p) + p += 2 + nw * WALL_SIZE + if p + 2 > limit then + return nil, nil, nil, nil + end + local nsp = readu16(b, p) + p += 2 + nsp * SPRITE_SIZE + return ns, nw, nsp, p +end +S["model/buildmap"] = function(r: Bytes.Reader): number + local b, o, limit = r.buf, r.base, r.limit + if limit - o < HEADER then + return 0 + end + local v = buffer.readu32(b, o) + if v ~= 7 and v ~= 8 and v ~= 9 then + return 0 + end + local ns, _, _, stop = layout(b, o, limit) + if not ns or not stop or stop > limit then + return 0 + end + return if stop == limit then 0.9 else 0.5 +end +end + +do -- model/d3map +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/d3map"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + for _ = 1, 16 do + local rest = string.match(head, "^//[^\n]*\n%s*(.*)$") + if not rest then + break + end + head = rest + end + return if string.match(head, "^Version%s+[123]%s") then 1 else 0 +end +end + +do -- model/dae +local Bytes = __include("core/Bytes") +S["model/dae"] = function(r: Bytes.Reader): number + local head = r:peek(2048) + if string.sub(head, 1, 4) == "PK\3\4" then + local nlen = string.byte(head, 27) or 0 + local name = string.lower(string.sub(head, 31, 30 + nlen)) + if string.find(name, "%.dae$") or name == "manifest.xml" then + return 0.95 + end + return 0 + end + -- UTF-16 files: drop the zero bytes + if string.find(string.sub(head, 1, 4), "\0", 1, true) then + head = string.gsub(head, "%z", "") + end + if string.find(head, " sectors then + return 0 + end + used += 1 + if used == 1 then + local p = r.base + off * 4096 + if p + 5 > r.limit then + return 0 + end + local c = buffer.readu8(b, p + 4) % 128 + if COMPRESSION[c] == nil then + return 0 + end + end + end + end + return if used > 0 then 0.8 else 0.2 +end +end + +do -- model/md2 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md2"] = function(r: Bytes.Reader): number + if r:remaining() < 68 then + return 0 + end + return if Sniff.magic(r, "IDP2") == 1 and r:peekU8(4) == 8 then 1 else 0 +end +end + +do -- model/md3 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md3"] = function(r: Bytes.Reader): number + if r:remaining() < 108 then + return 0 + end + return if Sniff.magic(r, "IDP3") == 1 and r:peekU8(4) == 15 then 1 else 0 +end +end + +do -- model/md5 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md5"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + head = string.gsub(head, "^//[^\n]*\n%s*", "") + return if string.match(head, "^MD5Version%s+%d+") then 1 else 0 +end +end + +do -- model/mdl +local Bytes = __include("core/Bytes") +S["model/mdl"] = function(r: Bytes.Reader): number + local m = r:peek(4) + local v = r:peekU8(4) + if (m == "IDPO" and v == 6) or (m == "IDST" and v == 10) then + return 1 + end + return 0 +end +end + +do -- model/ms3d +local Bytes = __include("core/Bytes") +local Read = lazy(function() + return __include("model/ms3d/Read") +end) +S["model/ms3d"] = function(r: Bytes.Reader): number + local h = r:peek(14) + if string.sub(h, 1, 10) ~= Read.MAGIC then + return 0 + end + local v = string.byte(h, 11) + return if v == 3 or v == 4 then 1 else 0.6 +end +end + +do -- model/obj +local Bytes = __include("core/Bytes") +S["model/obj"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "\0", 1, true) then + return 0 + end + if string.find(head, "^%s*v%s+[%-%d%.]") or string.find(head, "\n%s*v%s+[%-%d%.]") then + return 0.6 + end + if string.find(head, "^#") and (string.find(head, "\nmtllib ") or string.find(head, "\no ") or string.find(head, "\ng ")) then + return 0.4 + end + return 0 +end +end + +do -- model/off +local Bytes = __include("core/Bytes") +S["model/off"] = function(r: Bytes.Reader): number + local head = r:peek(512) + for _ = 1, 16 do + local rest = string.match(head, "^%s*#[^\n]*\n(.*)$") + if not rest then + break + end + head = rest + end + local kw = string.match(head, "^%s*(%w+)") + if kw and string.match(kw, "^S?T?C?N?4?n?OFF$") then + return 0.9 + end + return 0 +end +end + +do -- model/ply +local Bytes = __include("core/Bytes") +S["model/ply"] = function(r: Bytes.Reader): number + local h = r:peek(4) + return if h == "ply\n" or h == "ply\r" then 1 else 0 +end +end + +do -- model/pmx +local Bytes = __include("core/Bytes") +S["model/pmx"] = function(r: Bytes.Reader): number + local head = r:peek(8) + if string.sub(head, 1, 4) == "PMX " then + return 1 + end + if string.sub(head, 1, 7) == "Pmd\0\0\128\63" then + return 1 + end + return 0 +end +end + +do -- model/proc +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/proc"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64, true) + if string.match(head, "^mapProcFile%d%d%d") then + return 1 + end + if string.match(head, '^"?PROC"?%s+"?%d') then + return 0.9 + end + return 0 +end +end + +do -- model/qb +local Bytes = __include("core/Bytes") +S["model/qb"] = function(r: Bytes.Reader): number + if r:remaining() < 24 or r:peek(4) ~= "\1\1\0\0" then + return 0 + end + local b, p = r.buf, r.pos + local fmt, z, comp, mask = buffer.readu32(b, p + 4), buffer.readu32(b, p + 8), buffer.readu32(b, p + 12), buffer.readu32(b, p + 16) + if fmt > 1 or z > 1 or comp > 1 or mask > 1 then + return 0 + end + return 0.9 +end +end + +do -- model/rbxm +local Bytes = __include("core/Bytes") +local MAGIC = "]*%?>", "") + if match(head, "^%s*]") then + return if find(head, "version=", 1, true) then 1 else 0.8 + end + return 0 +end +end + +do -- model/robloxmesh +local Bytes = __include("core/Bytes") +S["model/robloxmesh"] = function(r: Bytes.Reader): number + return if string.match(r:peek(13), "^version [1-7]%.%d%d[\r\n]") then 1 else 0 +end +end + +do -- model/schematic +local Bytes = __include("core/Bytes") +local Nbt = lazy(function() + return __include("codecs/text/Nbt") +end) +local LITEMATIC_HINTS = { "Regions", "EnclosingSize", "RegionCount", "TotalVolume", "MinecraftDataVersion" } +local SPONGE_HINTS = { "BlockData", "PaletteMax" } -- v1 / v2 fields (some writers leave the root unnamed) +local function hinted(head: string, hints: { string }): boolean + for _, h in hints do + if string.find(head, string.char(0, #h) .. h, 1, true) then + return true + end + end + return false +end +S["model/schematic"] = function(r: Bytes.Reader): number + local p = Nbt.peek(r.buf, r.base, r.limit - r.base) + if not p or p.rootType ~= "compound" or p.endian ~= "big" then + return 0 + end + if p.name == "Schematic" or (p.firstName == "Schematic" and p.firstType == "compound") then + return 1 + end + local head = buffer.tostring(p.head) + return if hinted(head, LITEMATIC_HINTS) or hinted(head, SPONGE_HINTS) then 1 else 0 +end +end + +do -- model/smd +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/smd"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 256, true) + head = string.gsub(head, "^//[^\n]*\n%s*", "") + if string.match(head, "^version%s+1%s") and string.find(head, "nodes", 1, true) then + return 0.9 + end + return 0 +end +end + +do -- model/sourcemdl +local Bytes = __include("core/Bytes") +S["model/sourcemdl"] = function(r: Bytes.Reader): number + if r.limit - r.base < 8 or r:peek(4) ~= "IDST" then + return 0 + end + local v = buffer.readi32(r.buf, r.base + 4) + return if v >= 44 and v <= 49 then 1 else 0 +end +end + +do -- model/stl +local Bytes = __include("core/Bytes") +local function lower5(s: string): boolean + return string.lower(s) == "solid" +end +S["model/stl"] = function(r: Bytes.Reader): number + local size = r:remaining() + if size >= 84 then + local c = r:peek(4, 80) + local n = string.byte(c, 1) + string.byte(c, 2) * 256 + string.byte(c, 3) * 65536 + string.byte(c, 4) * 16777216 + if 84 + 50 * n == size then + return 0.9 + end + end + local head = r:peek(512) + local s = string.match(head, "^%s*(%a+)") + if s and lower5(s) then + local l = string.lower(head) + return if string.find(l, "facet", 1, true) or string.find(l, "endsolid", 1, true) then 0.9 else 0.5 + end + return 0 +end +end + +do -- model/t3d +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/t3d"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 512) + local first = string.match(h, "^%s*(Begin%s+%a+)") + if first == nil then + return 0 + end + local kind = string.lower(string.match(first, "%a+$") or "") + if kind == "map" or kind == "actor" or kind == "level" or kind == "brush" or kind == "polylist" then + return 0.9 + end + return 0.3 +end +end + +do -- model/udmf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/udmf"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 1024, true) + for _ = 1, 32 do + local rest = string.match(head, "^//[^\n]*\n%s*(.*)$") or string.match(head, "^/%*.-%*/%s*(.*)$") + if not rest then + break + end + head = rest + end + if string.match(head, "^[Nn][Aa][Mm][Ee][Ss][Pp][Aa][Cc][Ee]%s*=%s*\"") then + return 0.9 + end + return 0 +end +end + +do -- model/usda +local Bytes = __include("core/Bytes") +local function isUsdz(r: Bytes.Reader): boolean + if r:peek(4) ~= "PK\3\4" then + return false + end + local lo, hi = r:peekU8(26), r:peekU8(27) + if lo < 0 or hi < 0 then + return false + end + local nameLen = lo + hi * 256 + local name = string.lower(r:peek(30 + nameLen)) + name = string.sub(name, 31) + return string.find(name, "%.usd[ac]?$") ~= nil +end +S["model/usda"] = function(r: Bytes.Reader): number + local head = r:peek(8) + if string.sub(head, 1, 5) == "#usda" or string.sub(head, 1, 8) == "\239\187\191#usda" then + return 1 + end + if head == "PXR-USDC" then + return 0.9 -- USDC magic, so the error says it is unsupported + end + if isUsdz(r) then + return 0.95 + end + return 0 +end +end + +do -- model/vbsp +local Bytes = __include("core/Bytes") +local HEADER = 8 + 64 * 16 + 4 +S["model/vbsp"] = function(r: Bytes.Reader): number + if r:remaining() < HEADER or r:peek(4) ~= "VBSP" then + return 0 + end + local v = buffer.readi32(r.buf, r.pos + 4) + return if v >= 19 and v <= 21 then 1 else 0.5 +end +end + +do -- model/vmf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/vmf"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + if string.find(head, "%z") then + return 0 + end + if string.match(head, "^versioninfo%s*{") or string.match(head, '^"versioninfo"%s*{') then + return 0.9 + end + if string.match(head, "^world%s*{") or string.match(head, "^visgroups%s*{") then + return 0.6 + end + return 0 +end +end + +do -- model/vox +local Bytes = __include("core/Bytes") +S["model/vox"] = function(r: Bytes.Reader): number + return if r:peek(4) == "VOX " and r:peek(4, 8) == "MAIN" then 1 elseif r:peek(4) == "VOX " then 0.8 else 0 +end +end + +do -- model/vrml +local Bytes = __include("core/Bytes") +S["model/vrml"] = function(r: Bytes.Reader): number + local head = r:peek(16) + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + return if string.sub(head, 1, 10) == "#VRML V2.0" then 1 elseif string.sub(head, 1, 6) == "#VRML " then 0.6 else 0 +end +end + +do -- model/x +local Bytes = __include("core/Bytes") +local ENCODINGS = { ["txt "] = "text", ["bin "] = "binary", tzip = "text", bzip = "binary" } +S["model/x"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "xof " then + return 0 + end + return if ENCODINGS[r:peek(4, 8)] then 1 else 0.5 +end +end + +do -- model/x3d +local Bytes = __include("core/Bytes") +S["model/x3d"] = function(r: Bytes.Reader): number + local head = r:peek(1024) + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + if string.sub(head, 1, 5) == "#X3D " then + return 1 + end + if string.sub(head, 1, 4) == "\224\0\0\1" and string.find(head, "x3d", 1, true) then + return 0.9 + end + if string.find(head, "]") or string.find(head, "", 1, true) or (string.find(head, "", 1, true)) then + return if string.find(r:peek(512), "= 64 then + local lfanew = string.byte(h, 61) + string.byte(h, 62) * 256 + string.byte(h, 63) * 65536 + local sig = r:peek(2, lfanew) + return if sig == "NE" then 0.6 elseif sig == "PE" then 0.2 else 0 + end + if isFnt(h) and #h >= 6 then + local size = string.byte(h, 3) + string.byte(h, 4) * 256 + string.byte(h, 5) * 65536 + string.byte(h, 6) * 16777216 + return if size == r:size() then 0.9 elseif size <= r:size() and size > 118 then 0.3 else 0 + end + return 0 +end +end + +do -- font/hershey +local Bytes = __include("core/Bytes") +local function header(line: string): (number?, number?) + if #line < 10 then + return nil, nil + end + local id = tonumber((string.gsub(string.sub(line, 1, 5), "^%s+", ""))) + local n = tonumber((string.gsub(string.sub(line, 6, 8), "^%s+", ""))) + if not id or not n or n < 1 or string.find(string.sub(line, 1, 8), "[^%d ]") then + return nil, nil + end + return id, n +end +S["font/hershey"] = function(r: Bytes.Reader): number + local head = r:peek(256) + local line = string.match(head, "^([^\r\n]*)") + local id, n = header(line or "") + if not id or not n then + return 0 + end + local body = string.sub(line :: string, 9) + if string.find(body, "[^ -~]") then + return 0 + end + return if #body == math.min(2 * n, 64) or #body == 2 * n then 0.7 else 0.3 +end +end + +do -- font/pcf +local Bytes = __include("core/Bytes") +S["font/pcf"] = function(r: Bytes.Reader): number + return if r:peek(4) == "\1fcp" then 1 else 0 +end +end + +do -- font/psf +local Bytes = __include("core/Bytes") +S["font/psf"] = function(r: Bytes.Reader): number + local h = r:peek(4) + if h == "\114\181\74\134" then + return 1 + end + if string.sub(h, 1, 2) == "\54\4" and #h >= 4 and string.byte(h, 3) <= 7 and string.byte(h, 4) > 0 then + return 0.9 + end + return 0 +end +end + +do -- font/ttf +local Bytes = __include("core/Bytes") +S["font/ttf"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "\0\1\0\0" or m == "OTTO" or m == "ttcf" or m == "true" then + return 0.9 + end + return 0 +end +end + +do -- font/type1 +local Bytes = __include("core/Bytes") +S["font/type1"] = function(r: Bytes.Reader): number + local h = r:peek(64) + if string.sub(h, 1, 2) == "\128\1" then + h = string.sub(h, 7) + end + if string.sub(h, 1, 14) == "%!PS-AdobeFont" or string.sub(h, 1, 10) == "%!FontType" then + return 1 + end + return 0 +end +end + +do -- font/woff +local Bytes = __include("core/Bytes") +S["font/woff"] = function(r: Bytes.Reader): number + return if r:peek(4) == "wOFF" then 1 else 0 +end +end + +do -- font/woff2 +local Bytes = __include("core/Bytes") +S["font/woff2"] = function(r: Bytes.Reader): number + return if r:peek(4) == "wOF2" then 1 else 0 +end +end + +do -- archive/7z +local Bytes = __include("core/Bytes") +local MAGIC = "7z\188\175\39\28" +S["archive/7z"] = function(r: Bytes.Reader): number + return if r:peek(6) == MAGIC then 1 else 0 +end +end + +do -- archive/adf +local Bytes = __include("core/Bytes") +local BS = 512 +S["archive/adf"] = function(r: Bytes.Reader): number + local n = r:size() + if n < 4 * BS or n % BS ~= 0 then + return 0 + end + local h = r:peek(4) + if string.sub(h, 1, 3) ~= "DOS" or string.byte(h, 4) > 5 then + return 0 + end + return if n == 901120 or n == 1802240 then 0.95 else 0.6 +end +end + +do -- archive/applesingle +local Bytes = __include("core/Bytes") +S["archive/applesingle"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h < 8 then + return 0 + end + local magic = string.sub(h, 1, 4) + local ver = string.sub(h, 5, 8) + if (magic == "\0\5\22\0" or magic == "\0\5\22\7") and (ver == "\0\1\0\0" or ver == "\0\2\0\0") then + return 1 + end + return 0 +end +end + +do -- archive/ar +local Bytes = __include("core/Bytes") +local MAGIC = "!\n" +S["archive/ar"] = function(r: Bytes.Reader): number + if r:peek(8) == MAGIC then + return if r:peek(13, 68) == "debian-binary" then 1 else 0.9 + end + return if r:peek(8) == "!\n" then 0.5 else 0 +end +end + +do -- archive/arj +local Bytes = __include("core/Bytes") +S["archive/arj"] = function(r: Bytes.Reader): number + local h = r:peek(4) + if #h == 4 and string.byte(h, 1) == 0x60 and string.byte(h, 2) == 0xEA then + local size = string.byte(h, 3) + string.byte(h, 4) * 256 + return if size > 0 and size <= 2600 then 0.9 else 0 + end + return 0 +end +end + +do -- archive/binhex +local Bytes = __include("core/Bytes") +local BANNER = "(This file must be converted with BinHex" +S["archive/binhex"] = function(r: Bytes.Reader): number + local head = r:peek(2048) + local at = string.find(head, BANNER, 1, true) + if not at then + return 0 + end + return if at == 1 then 1 else 0.8 +end +end + +do -- archive/br +local Err = __include("core/Err") +local Bytes = __include("core/Bytes") +local Brotli = lazy(function() + return __include("codecs/compress/Brotli") +end) +local SNIFF_WHOLE = 262144 -- streams up to this size are decoded whole by sniff +local SNIFF_PREFIX = 65536 +S["archive/br"] = function(r: Bytes.Reader): number + local n = r:remaining() + if n == 0 then + return 0 + end + if n <= SNIFF_WHOLE then + local out, consumed = Brotli.decompress(r.buf, r.pos, n, { maxBytes = 2 ^ 26 }) + if out and consumed == r.limit then + return if buffer.len(out) > 0 then 0.3 else 0.05 + end + return 0 + end + local _, err = Brotli.decompress(r.buf, r.pos, SNIFF_PREFIX, { maxBytes = 2 ^ 22 }) + if err and (err.code == Err.TRUNCATED or err.code == Err.LIMIT) then + return 0.05 + end + return 0 +end +end + +do -- archive/bz2 +local Bytes = __include("core/Bytes") +S["archive/bz2"] = function(r: Bytes.Reader): number + local h = r:peek(10) + if #h < 10 or string.sub(h, 1, 3) ~= "BZh" then + return 0 + end + local lv = string.byte(h, 4) + if lv < 0x31 or lv > 0x39 then + return 0 + end + local magic = string.sub(h, 5, 10) + if magic == "\x31\x41\x59\x26\x53\x59" or magic == "\x17\x72\x45\x38\x50\x90" then + return 1 + end + return 0 +end +end + +do -- archive/cab +local Bytes = __include("core/Bytes") +S["archive/cab"] = function(r: Bytes.Reader): number + if r:peek(8) == "MSCF\0\0\0\0" then + return 1 + end + return 0 +end +end + +do -- archive/cpio +local Bytes = __include("core/Bytes") +S["archive/cpio"] = function(r: Bytes.Reader): number + local m = r:peek(6) + if m == "070701" or m == "070702" or m == "070707" then + return 1 + end + local b2 = r:peek(2) + if (b2 == "\199\113" or b2 == "\113\199") and r:remaining() >= 26 then + return 0.5 + end + return 0 +end +end + +do -- archive/d64 +local Bytes = __include("core/Bytes") +type Geometry = { kind: string, tracks: number, offsets: { number }, spt: { number }, dirTrack: number, total: number } +local function geometry(kind: string, tracks: number): Geometry + local offsets, spt = {}, {} + local o = 0 + for t = 1, tracks do + local n + if kind == "d81" then + n = 40 + else + local s = if kind == "d71" and t > 35 then t - 35 else t + n = if s <= 17 then 21 elseif s <= 24 then 19 elseif s <= 30 then 18 else 17 + end + offsets[t], spt[t] = o, n + o += n * 256 + end + return { kind = kind, tracks = tracks, offsets = offsets, spt = spt, dirTrack = if kind == "d81" then 40 else 18, total = o } +end +local function detect(len: number): Geometry? + for _, g in { { "d64", 35 }, { "d64", 40 }, { "d64", 42 }, { "d71", 70 }, { "d81", 80 } } :: { { any } } do + local geo = geometry(g[1] :: string, g[2] :: number) + local sectors = geo.total // 256 + if len == geo.total or (g[1] ~= "d81" and len == geo.total + sectors) then + return geo + end + end + return nil +end +S["archive/d64"] = function(r: Bytes.Reader): number + local geo = detect(r:size()) + if not geo then + return 0 + end + -- the BAM / header sector: dir track link and DOS version byte + local h = r:sub(geo.offsets[geo.dirTrack], 256) + local t, s, v = h:u8(), h:u8(), h:u8() + if geo.kind == "d81" then + return if t == 40 and s == 3 and v == 0x44 then 0.9 else 0.3 + end + return if t == 18 and s == 1 and (v == 0x41 or v == 0) then 0.9 else 0.3 +end +end + +do -- archive/fat +local Bytes = __include("core/Bytes") +local Fat = lazy(function() + return __include("containers/Fat") +end) +S["archive/fat"] = function(r: Bytes.Reader): number + if r:remaining() < 512 then + return 0 + end + local v = Fat.open(r.buf, r.base + r.pos, r.limit - r.base - r.pos) + if not v then + return 0 + end + return if v.partition then 0.6 else 0.8 +end +end + +do -- archive/grp +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "KenSilverman" +S["archive/grp"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- archive/gzip +local Bytes = __include("core/Bytes") +S["archive/gzip"] = function(r: Bytes.Reader): number + return if r:peek(3) == "\31\139\8" then 1 else 0 +end +end + +do -- archive/iso +local Bytes = __include("core/Bytes") +S["archive/iso"] = function(r: Bytes.Reader): number + return if r:peek(5, 16 * 2048 + 1) == "CD001" then 1 else 0 +end +end + +do -- archive/lha +local Bytes = __include("core/Bytes") +local METHODS: { [string]: boolean } = { + ["-lh0-"] = true, ["-lz4-"] = true, ["-lhd-"] = true, ["-lh1-"] = true, ["-lh4-"] = true, ["-lh5-"] = true, + ["-lh6-"] = true, ["-lh7-"] = true, ["-lhx-"] = true, ["-lzs-"] = true, ["-lz5-"] = true, ["-lh2-"] = true, + ["-lh3-"] = true, ["-pm0-"] = true, ["-pm1-"] = true, ["-pm2-"] = true, ["-lk7-"] = true, +} +local function isHeader(s: string): boolean + if #s < 22 then + return false + end + local m = string.sub(s, 3, 7) + local level = string.byte(s, 21) + return METHODS[m] == true and level <= 3 +end +S["archive/lha"] = function(r: Bytes.Reader): number + if isHeader(r:peek(22)) then + return 0.95 + end + return 0 +end +end + +do -- archive/lz4 +local Bytes = __include("core/Bytes") +S["archive/lz4"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "\4\34\77\24" then + return 1 + elseif m == "\2\33\76\24" then + return 0.9 + elseif #m == 4 and string.byte(m, 1) >= 0x50 and string.byte(m, 1) <= 0x5F and string.sub(m, 2) == "\42\77\24" then + -- a skippable frame (zstd shares the magic): an LZ4 frame after it + local h = r:peek(4, 4) + if #h == 4 then + local n = string.byte(h, 1) + string.byte(h, 2) * 256 + string.byte(h, 3) * 65536 + string.byte(h, 4) * 16777216 + if r:peek(4, 8 + n) == "\4\34\77\24" then + return 1 + end + end + end + return 0 +end +end + +do -- archive/macbinary +local Bytes = __include("core/Bytes") +local Crc16 = __include("core/Crc16") +local function version(b: buffer, o: number, len: number): string? + if len < 128 then + return nil + end + local u8 = function(i: number): number + return buffer.readu8(b, o + i) + end + if u8(0) ~= 0 or u8(74) ~= 0 then + return nil + end + local nameLen = u8(1) + if nameLen < 1 or nameLen > 63 then + return nil + end + local function be32(i: number): number + return u8(i) * 16777216 + u8(i + 1) * 65536 + u8(i + 2) * 256 + u8(i + 3) + end + local dlen, rlen = be32(83), be32(87) + if dlen > 0x7FFFFFFF or rlen > 0x7FFFFFFF then + return nil + end + local crc = u8(124) * 256 + u8(125) + if crc == Crc16.ccitt(b, o, 124) and (crc ~= 0 or u8(122) >= 129) then + return if buffer.readstring(b, o + 102, 4) == "mBIN" then "III" else "II" + end + if buffer.readstring(b, o + 102, 4) == "mBIN" then + return nil -- III with a bad CRC + end + -- MacBinary I: byte 82 zero, bytes 99..125 zero, the forks within the file + if u8(82) ~= 0 then + return nil + end + for i = 99, 125 do + if u8(i) ~= 0 then + return nil + end + end + local need = 128 + math.ceil(dlen / 128) * 128 + rlen + return if need <= len + 127 then "I" else nil +end +S["archive/macbinary"] = function(r: Bytes.Reader): number + local n = math.min(r:remaining(), 128) + if n < 128 then + return 0 + end + local v = version(r.buf, r.base + r.pos, r.limit - r.base - r.pos) + return if v == "III" then 0.95 elseif v == "II" then 0.8 elseif v == "I" then 0.3 else 0 +end +end + +do -- archive/mpq +local Bytes = __include("core/Bytes") +S["archive/mpq"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "MPQ\x1A" or m == "MPQ\x1B" then + return 1 + end + -- a prefixed archive (an installer stub): the header on a 512-byte boundary in the first 64 KB + for at = 512, math.min(65536, r:remaining() - 32), 512 do + if r:peek(4, at) == "MPQ\x1A" then + return 0.6 + end + end + return 0 +end +end + +do -- archive/pak +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["archive/pak"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + return math.max(Sniff.magic(r, "PACK", 0, 0.9), Sniff.magic(r, "SPAK", 0, 0.9)) +end +end + +do -- archive/rpm +local Bytes = __include("core/Bytes") +local LEAD_MAGIC = "\237\171\238\219" +S["archive/rpm"] = function(r: Bytes.Reader): number + return if r:peek(4) == LEAD_MAGIC then 1 else 0 +end +end + +do -- archive/tar +local Bytes = __include("core/Bytes") +local Tar = lazy(function() + return __include("containers/Tar") +end) +S["archive/tar"] = function(r: Bytes.Reader): number + if r:remaining() < 512 then + return 0 + end + if not Tar.valid(r.buf, r.pos) then + return 0 + end + return if r:peek(5, 257) == "ustar" then 0.95 else 0.6 +end +end + +do -- archive/unitypackage +local Bytes = __include("core/Bytes") +local Deflate = lazy(function() + return __include("codecs/compress/Deflate") +end) +local Tar = lazy(function() + return __include("containers/Tar") +end) +local function guidOf(name: string): (string?, string?) + local n = string.gsub(name, "^%./", "") + local guid, rest = string.match(n, "^(%x+)/?(.*)$") + if guid and #guid == 32 then + return string.lower(guid), rest + end + return nil, nil +end +S["archive/unitypackage"] = function(r: Bytes.Reader): number + if r:peek(3) ~= "\31\139\8" then + return 0 + end + local head = Deflate.peek(r.buf, r.pos, r.limit - r.pos, 512) + if not head or buffer.len(head) < 512 or not Tar.valid(head, 0) then + return 0 + end + local z = 0 + while z < 100 and buffer.readu8(head, z) ~= 0 do + z += 1 + end + return if guidOf(buffer.readstring(head, 0, z)) then 1 else 0 -- ties with archive/gzip go to the extension +end +end + +do -- archive/uu +local Bytes = __include("core/Bytes") +S["archive/uu"] = function(r: Bytes.Reader): number + local head = r:peek(4096) + if string.match(head, "^begin%-base64 [0-7]+ [^\r\n]") or string.match(head, "^begin [0-7]+ [^\r\n]") then + return 0.9 + end + if string.match(head, "\nbegin%-base64 [0-7]+ [^\r\n]") or string.match(head, "\nbegin [0-7][0-7][0-7]+ [^\r\n]") then + return 0.5 + end + return 0 +end +end + +do -- archive/vpk +local Bytes = __include("core/Bytes") +S["archive/vpk"] = function(r: Bytes.Reader): number + if r:remaining() < 12 or r:peek(4) ~= "\x34\x12\xAA\x55" then + return 0 + end + local v = r:peekU8(4) + return if v == 1 or v == 2 then 1 else 0.5 +end +end + +do -- archive/vswap +local Bytes = __include("core/Bytes") +local readu8, readu16, readi16, writeu32 = buffer.readu8, buffer.readu16, buffer.readi16, buffer.writeu32 +local function header(r: Bytes.Reader): (number?, number, number) + if r:remaining() < 6 then + return nil, 0, 0 + end + local n, ss, so = readu16(r.buf, r.base), readu16(r.buf, r.base + 2), readu16(r.buf, r.base + 4) + if n == 0 or ss > so or so > n or 6 + n * 6 > r:remaining() then + return nil, 0, 0 + end + return n, ss, so +end +S["archive/vswap"] = function(r: Bytes.Reader): number + local n = header(r) + if not n then + return 0 + end + local size = r.limit - r.base + local b = r.buf + local last = 6 + n * 6 + local nonzero = 0 + for i = 0, n - 1 do + local o = buffer.readu32(b, r.base + 6 + i * 4) + local l = readu16(b, r.base + 6 + n * 4 + i * 2) + if o ~= 0 then + if o < last or o + l > size then + return 0 + end + last = o + nonzero += 1 + end + end + return if nonzero > 0 then 0.6 else 0 +end +end + +do -- archive/wad +local Bytes = __include("core/Bytes") +S["archive/wad"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + local m = r:peek(4) + if m ~= "IWAD" and m ~= "PWAD" then + return 0 + end + return 0.9 +end +end + +do -- archive/wad2 +local Bytes = __include("core/Bytes") +S["archive/wad2"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + local m = r:peek(4) + return if m == "WAD2" or m == "WAD3" then 0.9 else 0 +end +end + +do -- archive/xz +local Bytes = __include("core/Bytes") +local XZ_MAGIC = "\253" .. "7zXZ\0" +local function aloneScore(r: Bytes.Reader): number + local h = r:peek(14) + if #h < 14 then + return 0 + end + local d = string.byte(h, 1) + if d >= 225 or string.byte(h, 14) ~= 0 then + return 0 + end + local dict = string.byte(h, 2) + string.byte(h, 3) * 256 + string.byte(h, 4) * 65536 + string.byte(h, 5) * 16777216 + local okDict = false + for n = 12, 31 do + if dict == 2 ^ n or (n < 31 and dict == 2 ^ n + 2 ^ (n - 1)) then + okDict = true + break + end + end + if not okDict then + return 0 + end + local s = string.sub(h, 6, 13) + if s ~= string.rep("\255", 8) and (string.byte(h, 11) ~= 0 or string.byte(h, 12) ~= 0 or string.byte(h, 13) ~= 0) then + return 0 + end + return if d == 0x5D then 0.4 else 0.2 +end +S["archive/xz"] = function(r: Bytes.Reader): number + if r:peek(6) == XZ_MAGIC then + return 1 + end + return aloneScore(r) +end +end + +do -- archive/yenc +local Bytes = __include("core/Bytes") +S["archive/yenc"] = function(r: Bytes.Reader): number + local head = r:peek(4096) + if string.match(head, "^=ybegin ") then + return 0.95 + end + return if string.find(head, "\n=ybegin [^\n]*name=") then 0.6 else 0 +end +end + +do -- archive/z +local Bytes = __include("core/Bytes") +S["archive/z"] = function(r: Bytes.Reader): number + if r:peek(2) ~= "\31\157" then + return 0 + end + local f = r:peekU8(2) + return if f >= 0 and bit32.band(f, 0x60) == 0 and bit32.band(f, 0x1F) >= 9 and bit32.band(f, 0x1F) <= 16 then 1 else 0.3 +end +end + +do -- archive/zip +local Bytes = __include("core/Bytes") +S["archive/zip"] = function(r: Bytes.Reader): number + local s = r:peek(4) + -- ZIP-based formats (docx, jar, 3mf, ...) score higher in their own sniff + if s == "PK\3\4" or s == "PK\5\6" then + return 0.6 + end + if string.sub(s, 1, 2) == "MZ" then + return 0 -- a self-extractor opens with Zip.decode / opts.format = "zip" + end + return 0 +end +end + +do -- archive/zoo +local Bytes = __include("core/Bytes") +local TAG = 0xFDC4A7DC +S["archive/zoo"] = function(r: Bytes.Reader): number + local h = r:peek(24) + if #h < 24 then + return 0 + end + local tag = string.byte(h, 21) + string.byte(h, 22) * 256 + string.byte(h, 23) * 65536 + string.byte(h, 24) * 16777216 + if tag ~= TAG then + return 0 + end + return if string.sub(h, 1, 4) == "ZOO " then 1 else 0.8 +end +end + +do -- archive/zst +local Bytes = __include("core/Bytes") +local Zstd = lazy(function() + return __include("codecs/compress/Zstd") +end) +S["archive/zst"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == Zstd.MAGIC then + return 1 + end + -- a skippable frame (0x184D2A50 .. 0x184D2A5F) is usually followed by a zstd frame + if #m == 4 and string.sub(m, 2, 4) == "\42\77\24" and bit32.band(string.byte(m, 1), 0xF0) == 0x50 then + return 0.5 + end + return 0 +end +end + +do -- data/cbor +local Bytes = __include("core/Bytes") +S["data/cbor"] = function(r: Bytes.Reader): number + return if r:peek(3) == "\217\217\247" then 1 else 0 +end +end + +do -- data/csv +local Bytes = __include("core/Bytes") +local find, sub, byte, gsub = string.find, string.sub, string.byte, string.gsub +S["data/csv"] = function(r: Bytes.Reader): number + local head = r:peek(1024) + if find(head, "%z") then + return 0 + end + local l1, l2 = string.match(head, "^([^\r\n]*)\r?\n([^\r\n]*)") + if not l1 or l1 == "" then + return 0 + end + for _, d in { ",", "\t", ";" } do + local _, c1 = gsub(l1, d, "") + local _, c2 = gsub(l2 :: string, d, "") + if c1 > 0 and c1 == c2 then + return 0.15 + end + end + return 0 +end +end + +do -- data/ini +local Bytes = __include("core/Bytes") +S["data/ini"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "%z") then + return 0 + end + local first = string.match(head, "^[%s]*([^\r\n]*)") + while first and string.match(first, "^[;#]") do + head = string.match(head, "^[^\n]*\n(.*)$") or "" + first = string.match(head, "^[%s]*([^\r\n]*)") + end + if first and string.match(first, "^%[[^%]]+%]%s*$") then + return 0.2 + end + return 0 +end +end + +do -- data/json +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["data/json"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + local first = string.match(head, "^[ \t\r\n]*(.)") + if first == "{" then + local nxt = string.match(head, "^[^{]*{[ \t\r\n]*(.)") + return if nxt == nil or nxt == '"' or nxt == "}" then 0.6 else 0.1 + elseif first == "[" then + -- past any nested '[': a JSON value must start (TOML / INI "[section]" and "[[table]]" do not) + local nxt = string.match(head, "^[ \t\r\n]*[%[ \t\r\n]*(.)") + if nxt == nil or string.find('{"-0123456789tfn]', nxt, 1, true) then + return 0.3 + end + return 0 + end + return 0 +end +end + +do -- data/msgpack +local Bytes = __include("core/Bytes") +S["data/msgpack"] = function(_r: Bytes.Reader): number + return 0 -- no magic: by extension or opts.format only +end +end + +do -- data/nbt +local Bytes = __include("core/Bytes") +local Nbt = lazy(function() + return __include("codecs/text/Nbt") +end) +S["data/nbt"] = function(r: Bytes.Reader): number + local p = Nbt.peek(r.buf, r.base, r.limit - r.base) + if not p or p.rootType ~= "compound" then + return 0 + end + if p.compression ~= "none" then + return if p.firstType then 1 else 0.5 -- gzip wrapped NBT: ties with archive/gzip go to the extension + end + return if p.firstType and p.firstName then 0.6 else 0.2 +end +end + +do -- data/plist +local Bytes = __include("core/Bytes") +S["data/plist"] = function(r: Bytes.Reader): number + local head = r:peek(256) + if string.sub(head, 1, 6) == "bplist" then + return 1 + end + if string.find(head, " 0 and good == lines and paths > 0 then 0.5 else 0 +end +end + +do -- data/snbt +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["data/snbt"] = function(r: Bytes.Reader): number + -- SNBT has what JSON never has: unquoted keys, typed numbers (1b, 2.5f), [I; arrays, single-quoted strings + local head = Sniff.text(r, 512, true) + local first = string.sub(head, 1, 1) + if first ~= "{" and first ~= "[" then + return 0 + end + if string.find(head, "[{,]%s*[%a_][%w_%-%.%+]*%s*:") or string.find(head, "%d[bBsSlLfFdD]%s*[,}%]]") + or string.find(head, "%[[BIL]%s*;") or string.find(head, "[:,%[]%s*'") + then + return 0.7 + end + return 0 +end +end + +do -- data/toml +local Bytes = __include("core/Bytes") +S["data/toml"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "%z") then + return 0 + end + for line in string.gmatch(head, "[^\n]+") do + local l = string.match(line, "^[ \t]*(.-)[ \t\r]*$") :: string + if l ~= "" and string.sub(l, 1, 1) ~= "#" then + if string.match(l, "^%[%[?[%w_%-%.\"' ]+%]%]?$") or string.match(l, "^[%w_%-%.\"']+[ \t]*=[ \t]*[\"'%[{%dtf%+%-in]") then + return 0.2 + end + return 0 + end + end + return 0 +end +end + +do -- data/tres +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["data/tres"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 256) + if string.match(h, "^%s*%[gd_resource[%s%]]") then + return 1 + end + return 0 +end +end + +do -- data/vdf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local KeyValues = lazy(function() + return __include("codecs/text/KeyValues") +end) +S["data/vdf"] = function(r: Bytes.Reader): number + local n = r:remaining() + if KeyValues.isBinary(r.buf, r.pos, n) then + return 0.3 + end + local head = Sniff.text(r, 256, true) + if string.find(head, "%z") then + return 0 + end + head = string.gsub(head, "^//[^\n]*\n%s*", "") + if string.match(head, '^"[^"\n]+"%s*{') or string.match(head, '^"[^"\n]+"%s*%[[^%]\n]*%]%s*{') then + return 0.6 + end + if string.match(head, "^#base%s") or string.match(head, "^#include%s") then + return 0.5 + end + if string.match(head, '^[%w_]+%s*\n%s*{%s*\n%s*"') then + return 0.3 + end + return 0 +end +end + +do -- data/xml +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["data/xml"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + if string.match(head, "^<%?xml[ \t\r\n]") or string.sub(head, 1, 4) == "\255\254<\0" or string.sub(head, 1, 4) == "\254\255\0<" then + return 0.5 + end + if string.match(head, "^[ \t\r\n]*<[%a!]") then + return 0.3 + end + return 0 +end +end + +do -- data/yaml +local Bytes = __include("core/Bytes") +S["data/yaml"] = function(r: Bytes.Reader): number + local head = r:peek(256) + if string.find(head, "%z") then + return 0 + end + if string.match(head, "^%%YAML ") then + return 0.9 + end + if string.match(head, "^%-%-%-[ \r\n]") then + return 0.5 + end + local line = string.match(head, "^[ \t\r\n]*([^\r\n]*)") + if line and (string.match(line, "^[%w_%-\"']+[%w_%- \"']*:[ ]") or string.match(line, "^[%w_%-]+:$") or string.match(line, "^%- ")) then + return 0.2 + end + return 0 +end +end + +do -- vector/gamemaps +local Bytes = __include("core/Bytes") +local MAGIC = "TED5v1.0" +S["vector/gamemaps"] = function(r: Bytes.Reader): number + if r:peek(8) == MAGIC then + return 1 + end + -- MAPHEAD: the RLEW tag 0xABCD, then 100 offsets (0 / -1 when absent) + if r:remaining() >= 402 and r:remaining() <= 1024 and buffer.readu16(r.buf, r.base) == 0xABCD then + local first = buffer.readi32(r.buf, r.base + 2) + if first > 0 then + return 0.7 + end + end + return 0 +end +end + +do -- vector/ldtk +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["vector/ldtk"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 1024) + if not string.match(h, "^%s*{") then + return 0 + end + if string.find(h, "\"fileType\"%s*:%s*\"LDtk Project JSON\"") then + return 1 + end + if string.find(h, "\"jsonVersion\"", 1, true) and string.find(h, "\"worldLayout\"", 1, true) then + return 0.8 + end + return 0 +end +end + +do -- vector/ogmo +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["vector/ogmo"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 2048) + if not string.match(h, "^%s*{") or not string.find(h, "\"ogmoVersion\"", 1, true) then + return 0 + end + if string.find(h, "\"layerGridDefaultSize\"", 1, true) or string.find(h, "\"levelPaths\"", 1, true) then + return 1 + end + return 0.9 +end +end + +do -- vector/svg +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["vector/svg"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 4096) + if not string.match(h, "^%s*<") then + return 0 + end + if string.find(h, ":]") or string.find(h, "<%w+:svg[%s>]") then + return 0.95 + end + return 0 +end +end + +do -- vector/tiled +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local function head(r: Bytes.Reader): string + local h = Sniff.text(r, 1024) + return h +end +S["vector/tiled"] = function(r: Bytes.Reader): number + local h = head(r) + if string.match(h, "^%s*<") then + if string.find(h, "]") or string.find(h, "]") then + return 0.9 + end + return 0 + end + if string.match(h, "^%s*{") then + -- Tiled writes its keys sorted: "type" comes last, so look at the tail too + local n = r:remaining() + local tail = if n > 1024 then r:peek(1024, n - 1024) else "" + for _, part in { h, tail } do + if string.find(part, "\"type\"%s*:%s*\"map\"") or string.find(part, "\"type\"%s*:%s*\"tileset\"") then + return 0.8 + end + end + if string.find(h, "\"tilewidth\"", 1, true) and (string.find(h, "\"orientation\"", 1, true) or string.find(h, "\"tilesets\"", 1, true)) then + return 0.6 + end + end + return 0 +end +end + +do -- layered/aseprite +local Bytes = __include("core/Bytes") +S["layered/aseprite"] = function(r: Bytes.Reader): number + if r:peekU8(4) == 0xE0 and r:peekU8(5) == 0xA5 then + local d = r:peekU8(12) + if (d == 32 or d == 16 or d == 8) and r:peekU8(13) == 0 then + return 1 + end + return 0.5 + end + return 0 +end +end + +do -- layered/ora +local Bytes = __include("core/Bytes") +local MIME = "image/openraster" +S["layered/ora"] = function(r: Bytes.Reader): number + -- a zip whose first (stored) entry is "mimetype" holding image/openraster + if r:peek(4) == "PK\3\4" and r:peek(8, 30) == "mimetype" and r:peek(#MIME, 38) == MIME then + return 1 + end + return 0 +end +end + +do -- layered/psd +local Bytes = __include("core/Bytes") +S["layered/psd"] = function(r: Bytes.Reader): number + local h = r:peek(6) + if string.sub(h, 1, 4) == "8BPS" and (string.sub(h, 5, 6) == "\0\1" or string.sub(h, 5, 6) == "\0\2") then + return 1 + end + return 0 +end +end + +do -- subtitle/ass +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["subtitle/ass"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + if string.match(head, "^%s*%[[Ss]cript [Ii]nfo%]") then + return 1 + end + return 0 +end +end + +do -- subtitle/srt +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local TIMING = "^%s*(%d+):(%d%d?):(%d%d?)[,.](%d+)%s*%-%->%s*(%d+):(%d%d?):(%d%d?)[,.](%d+)%s*(.-)%s*$" +local function frac(digits: string): number + return (tonumber(digits) :: number) / 10 ^ #digits +end +local function timing(line: string): (number?, number?, string?) + local h1, m1, s1, f1, h2, m2, s2, f2, rest = string.match(line, TIMING) + if not h1 then + return nil, nil, nil + end + local a = tonumber(h1) :: number * 3600 + tonumber(m1) :: number * 60 + tonumber(s1) :: number + frac(f1 :: string) + local b = tonumber(h2) :: number * 3600 + tonumber(m2) :: number * 60 + tonumber(s2) :: number + frac(f2 :: string) + return a, b, rest +end +S["subtitle/srt"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512) + head = string.gsub(head, "\r", "\n") + local first, second = string.match(head, "^%s*([^\n]*)\n([^\n]*)") + if first and string.match(first, "^%d+%s*$") and second and timing(second) then + return 0.9 + end + if first and timing(first) then + return 0.6 + end + return 0 +end +end + +do -- subtitle/vtt +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["subtitle/vtt"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 10) + if string.sub(head, 1, 6) == "WEBVTT" then + local c = string.sub(head, 7, 7) + if c == "" or c == " " or c == "\t" or c == "\n" or c == "\r" then + return 1 + end + end + return 0 +end +end + +do -- music/669 +local Bytes = __include("core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 497 then + return false + end + local magic = r:peek(2) + if magic ~= "if" and magic ~= "JN" then + return false + end + local nsmp, npat, restart = r:peekU8(110), r:peekU8(111), r:peekU8(112) + if nsmp > 64 or restart >= 128 or npat > 128 then + return false + end + local bad = 0 + for i = 2, 109 do + local c = r:peekU8(i) + if c > 0 and c <= 31 then + bad += 1 + if bad > 40 then + return false + end + end + end + for i = 0, 127 do + local o, t, b = r:peekU8(113 + i), r:peekU8(241 + i), r:peekU8(369 + i) + if (o >= 128 and o < 0xFE) or (o < 128 and t == 0) or t > 15 or b >= 64 then + return false + end + end + return true +end +S["music/669"] = function(r: Bytes.Reader): number + return if validHeader(r) then 0.6 else 0 +end +end + +do -- music/ahx +local Bytes = __include("core/Bytes") +S["music/ahx"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m and #m == 4 and string.sub(m, 1, 3) == "THX" and string.byte(m, 4) < 3 then 1 else 0 +end +end + +do -- music/far +local Bytes = __include("core/Bytes") +S["music/far"] = function(r: Bytes.Reader): number + if r:size() >= 98 and r:peek(4) == "FAR\xFE" and r:peek(3, 44) == "\r\n\x1A" and r:peekU8(47) + r:peekU8(48) * 256 >= 98 then + return 1 + end + return 0 +end +end + +do -- music/hmp +local Bytes = __include("core/Bytes") +local HMI_MAGIC = "HMI-MIDISONG061595" +S["music/hmp"] = function(r: Bytes.Reader): number + return if r:peek(8) == "HMIMIDIP" or r:peek(18) == HMI_MAGIC then 1 else 0 +end +end + +do -- music/hvl +local Bytes = __include("core/Bytes") +S["music/hvl"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m and #m == 4 and string.sub(m, 1, 3) == "HVL" and string.byte(m, 4) <= 1 then 1 else 0 +end +end + +do -- music/it +local Bytes = __include("core/Bytes") +S["music/it"] = function(r: Bytes.Reader): number + return if r:peek(4) == "IMPM" then 1 else 0 +end +end + +do -- music/med +local Bytes = __include("core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 52 or r:peek(3) ~= "MMD" then + return false + end + local v = r:peekU8(3) + if v < 0x30 or v > 0x33 then + return false + end + local h = r:sub(8, 44) + local songOff = h:u32be() + h:skip(4) + local blockOff = h:u32be() + h:skip(4) + local smpOff = h:u32be() + return songOff >= 52 and songOff + 63 * 8 + 284 <= r:size() and blockOff >= 52 and (smpOff == 0 or smpOff >= 52) +end +S["music/med"] = function(r: Bytes.Reader): number + return if validHeader(r) then 1 else 0 +end +end + +do -- music/midi +local Bytes = __include("core/Bytes") +S["music/midi"] = function(r: Bytes.Reader): number + if r:peek(4) == "MThd" then + return 1 + end + if r:peek(4) == "RIFF" and r:peek(4, 8) == "RMID" then + return 1 + end + return 0 +end +end + +do -- music/mod +local Bytes = __include("core/Bytes") +local FIXED: { [string]: number } = { + ["M.K."] = 4, + ["M!K!"] = 4, + ["M&K!"] = 4, + ["N.T."] = 4, + ["FLT4"] = 4, + ["FLT8"] = 8, + ["CD81"] = 8, + ["OKTA"] = 8, + ["OCTA"] = 8, + ["EXO4"] = 4, + ["EXO8"] = 8, +} +local function signatureChannels(sig: string): number? + local fixed = FIXED[sig] + if fixed then + return fixed + end + local d = string.match(sig, "^(%d)CHN$") + if d then + local n = tonumber(d) :: number + return if n >= 1 then n else nil + end + local dd = string.match(sig, "^(%d%d)C[HN]$") + if dd then + local n = tonumber(dd) :: number + return if n >= 1 and n <= 32 then n else nil + end + local t = string.match(sig, "^TDZ(%d)$") + if t then + local n = tonumber(t) :: number + return if n >= 1 then n else nil + end + return nil +end +S["music/mod"] = function(r: Bytes.Reader): number + if r:size() < 1084 then + return 0 + end + local sig = r:peek(4, 1080) + if signatureChannels(sig) then + return 0.8 + end + return 0 +end +end + +do -- music/mtm +local Bytes = __include("core/Bytes") +S["music/mtm"] = function(r: Bytes.Reader): number + if r:size() >= 66 and r:peek(3) == "MTM" and r:peekU8(3) < 0x20 and r:peekU8(33) >= 1 and r:peekU8(33) <= 32 then + return 1 + end + return 0 +end +end + +do -- music/mus +local Bytes = __include("core/Bytes") +S["music/mus"] = function(r: Bytes.Reader): number + return if r:peek(4) == "MUS\x1a" then 1 else 0 +end +end + +do -- music/okt +local Bytes = __include("core/Bytes") +S["music/okt"] = function(r: Bytes.Reader): number + return if r:peek(8) == "OKTASONG" then 1 else 0 +end +end + +do -- music/ptm +local Bytes = __include("core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 608 or r:peek(4, 44) ~= "PTMF" or r:peekU8(28) ~= 26 or r:peekU8(30) > 2 then + return false + end + local h = r:sub(32, 10) + local nord, nsmp, npat, nch, flags = h:u16le(), h:u16le(), h:u16le(), h:u16le(), h:u16le() + return flags == 0 and nch >= 1 and nch <= 32 and nord >= 1 and nord <= 256 and nsmp >= 1 and nsmp <= 255 and npat >= 1 and npat <= 128 +end +S["music/ptm"] = function(r: Bytes.Reader): number + return if validHeader(r) then 1 else 0 +end +end + +do -- music/s3m +local Bytes = __include("core/Bytes") +S["music/s3m"] = function(r: Bytes.Reader): number + if r:size() >= 48 and r:peek(4, 44) == "SCRM" then + return 1 + end + return 0 +end +end + +do -- music/sf2 +local Bytes = __include("core/Bytes") +local SoundFont = lazy(function() + return __include("codecs/audio/SoundFont") +end) +S["music/sf2"] = function(r: Bytes.Reader): number + return if SoundFont.sniff(r) then 1 else 0 +end +end + +do -- music/stm +local Bytes = __include("core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 48 then + return false + end + local eof, ftype, major, minor = r:peekU8(28), r:peekU8(29), r:peekU8(30), r:peekU8(31) + local npat, gv = r:peekU8(33), r:peekU8(34) + if ftype ~= 2 or (eof ~= 0x1A and eof ~= 2) or major ~= 2 or (minor ~= 0 and minor ~= 10 and minor ~= 20 and minor ~= 21) then + return false + end + if npat > 64 or (gv > 64 and gv ~= 0x58) then + return false + end + for i = 20, 27 do + local c = r:peekU8(i) + if c < 0x20 or c >= 0x7F then + return false + end + end + return true +end +S["music/stm"] = function(r: Bytes.Reader): number + return if validHeader(r) then 0.7 else 0 +end +end + +do -- music/ult +local Bytes = __include("core/Bytes") +S["music/ult"] = function(r: Bytes.Reader): number + local v = r:peekU8(14) + if r:size() >= 48 and r:peek(14) == "MAS_UTrack_V00" and v >= 0x31 and v <= 0x34 then + return 1 + end + return 0 +end +end + +do -- music/umx +local Bytes = __include("core/Bytes") +local MAGIC = "\xC1\x83\x2A\x9E" +type Header = { version: number, nameCount: number, nameOffset: number, exportCount: number, exportOffset: number, importCount: number, importOffset: number } +local function header(r: Bytes.Reader): Header? + if r:size() < 36 or r:peek(4) ~= MAGIC then + return nil + end + local h = r:sub(4, 32) + local version = h:u16le() + h:skip(6) + local hd: Header = { + version = version, + nameCount = h:u32le(), + nameOffset = h:u32le(), + exportCount = h:u32le(), + exportOffset = h:u32le(), + importCount = h:u32le(), + importOffset = h:u32le(), + } + if h.err or hd.nameOffset < 36 or hd.exportOffset < 36 or hd.importOffset < 36 then + return nil + end + if hd.nameCount == 0 or hd.exportCount == 0 or hd.importCount == 0 or hd.nameCount > 2 ^ 20 or hd.exportCount > 2 ^ 20 or hd.importCount > 2 ^ 20 then + return nil + end + return hd +end +local function index(r: Bytes.Reader): number + local b = r:u8() + local neg = b >= 0x80 + local v = b % 64 + if bit32.band(b, 0x40) ~= 0 then + local shift = 6 + repeat + b = r:u8() + v += (b % 128) * 2 ^ shift + shift += 7 + until b < 0x80 or shift >= 32 + end + return if neg then -v else v +end +local function names(r: Bytes.Reader, h: Header): { string } + local list = {} + local nr = r:sub(h.nameOffset) + for _ = 1, math.min(h.nameCount, 65536) do + if nr:remaining() < 5 then + break + end + if h.version >= 64 then + index(nr) + end + table.insert(list, string.lower(nr:cstring(1024))) + nr:skip(4) + end + return list +end +S["music/umx"] = function(r: Bytes.Reader): number + local h = header(r) + if not h then + return 0 + end + return if table.find(names(r, h), "music") then 1 else 0.3 +end +end + +do -- music/xm +local Bytes = __include("core/Bytes") +local MAGIC = "Extended Module: " +S["music/xm"] = function(r: Bytes.Reader): number + return if r:peek(17) == MAGIC then 1 else 0 +end +end + +do -- music/xmi +local Bytes = __include("core/Bytes") +S["music/xmi"] = function(r: Bytes.Reader): number + local id, kind = r:peek(4), r:peek(4, 8) + if id == "FORM" and (kind == "XDIR" or kind == "XMID") then + return 1 + end + return if id == "CAT " and kind == "XMID" then 0.9 else 0 +end +end + +do -- playlist/m3u +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["playlist/m3u"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 512) + s = (string.match(s, "^%s*(.*)$") :: string) + if string.sub(s, 1, 7) == "#EXTM3U" then + return 0.95 + end + if string.find(s, "^#EXTINF:") or string.find(s, "^#EXT%-X%-") then + return 0.8 + end + return 0 +end +end + +do -- playlist/pls +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local Text = lazy(function() + return __include("codecs/text/Text") +end) +S["playlist/pls"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 64) + local first = string.match(s, "^%s*([^\r\n]*)") + return if first and string.lower(Text.trim(first)) == "[playlist]" then 0.95 else 0 +end +end + +do -- playlist/xspf +local Bytes = __include("core/Bytes") +local NS = "http://xspf.org/ns/0/" +S["playlist/xspf"] = function(r: Bytes.Reader): number + local s = r:peek(1024) + local i = string.find(s, "<%w*:?playlist[%s>]") + if i and string.find(s, NS, 1, true) then + return 0.95 + end + return 0 +end +end + +return S +end __FILES["Types"] = function() -- Types: the standard value types each category decodes to and encodes from, plus small constructors. Every @@ -71205,7 +74832,7 @@ __FILES["codecs/image/Dct"] = function() -- libjpeg's islow (jidctint.c / jfdctint.c), the reduced IDCTs (jidctred.c) and jcdctmgr.c's rounding quantiser, bit-exact -- with libjpeg-turbo. From jpeg-luau 1.0 (same author); IJG code: licenses/libjpeg-turbo-LICENSE.md. local readi16, readu16, writeu16, writeu32, readu8, writei16 = buffer.readi16, buffer.readu16, buffer.writeu16, buffer.writeu32, buffer.readu8, buffer.writei16 -local clamp = math.clamp +local clamp, abs, sign = math.clamp, math.abs, math.sign local Dct = {} @@ -71584,18 +75211,13 @@ end local fw = table.create(64, 0) -local function quant(coef: buffer, off: number, div: buffer, v: number, i: number) - local qv = readu16(div, i * 2) * 8 - local h = qv // 2 - if v < 0 then - writei16(coef, off + i * 2, -((h - v) // qv)) - else - writei16(coef, off + i * 2, (v + h) // qv) - end +-- (|v| + q * 4) // (q * 8) with v's sign, branch-free (a sign branch here gave LuaJIT side traces it could not compile) +local function quant(coef: buffer, off: number, qv: number, v: number, i: number) + writei16(coef, off + i * 2, (abs(v) + qv / 2) // qv * sign(v)) end --- quantised as jcdctmgr.c: (|v| + q * 4) // (q * 8) with the sign restored -function Dct.fdctQuantize(src: buffer, stride: number, x: number, y: number, w: number, h: number, div: buffer, coef: buffer, off: number) +-- quantised as jcdctmgr.c: (|v| + q * 4) // (q * 8) with the sign restored; div[i + 1] = q * 8 for natural index i +function Dct.fdctQuantize(src: buffer, stride: number, x: number, y: number, w: number, h: number, div: { number }, coef: buffer, off: number) local lastX, lastY = w - 1, h - 1 for r = 0, 7 do local row = math.min(y + r, lastY) * stride @@ -71684,14 +75306,14 @@ function Dct.fdctQuantize(src: buffer, stride: number, x: number, y: number, w: local o3 = (tmp6 + z2 + z3 + 16384) // 32768 local o1 = (tmp7 + z1 + z4 + 16384) // 32768 local cc = c - 1 - quant(coef, off, div, o0, cc) - quant(coef, off, div, o1, cc + 8) - quant(coef, off, div, o2, cc + 16) - quant(coef, off, div, o3, cc + 24) - quant(coef, off, div, o4, cc + 32) - quant(coef, off, div, o5, cc + 40) - quant(coef, off, div, o6, cc + 48) - quant(coef, off, div, o7, cc + 56) + quant(coef, off, div[c], o0, cc) + quant(coef, off, div[c + 8], o1, cc + 8) + quant(coef, off, div[c + 16], o2, cc + 16) + quant(coef, off, div[c + 24], o3, cc + 24) + quant(coef, off, div[c + 32], o4, cc + 32) + quant(coef, off, div[c + 40], o5, cc + 40) + quant(coef, off, div[c + 48], o6, cc + 48) + quant(coef, off, div[c + 56], o7, cc + 56) end end @@ -74554,11 +78176,11 @@ function Encode.run(px: buffer, w: number, h: number, bpp: number, o: Options): local qt = { Tables.quant(Tables.LUMA, o.quality), Tables.quant(Tables.CHROMA, o.quality) } local qdiv = {} for t = 1, 2 do - local b = buffer.create(128) + local d = table.create(64, 0) for i = 1, 64 do - writeu16(b, (i - 1) * 2, qt[t][i]) + d[i] = qt[t][i] * 8 end - qdiv[t] = b + qdiv[t] = d end local comps: { Comp } = {} diff --git a/build/Rosetta.luau.linemap.json b/build/Rosetta.luau.linemap.json index b4ef7e5..0233445 100644 --- a/build/Rosetta.luau.linemap.json +++ b/build/Rosetta.luau.linemap.json @@ -1,620 +1,621 @@ [ [29, "src/Rosetta/init.luau"], -[913, "src/Rosetta/Registry.luau"], -[3322, "src/Rosetta/Types.luau"], -[4439, "src/Rosetta/archive/7z/init.luau"], -[4824, "src/Rosetta/archive/7z/Header.luau"], -[5351, "src/Rosetta/archive/adf/init.luau"], -[5633, "src/Rosetta/archive/applesingle/init.luau"], -[5819, "src/Rosetta/archive/ar/init.luau"], -[6222, "src/Rosetta/archive/arj/init.luau"], -[6432, "src/Rosetta/archive/binhex/init.luau"], -[6681, "src/Rosetta/archive/br/init.luau"], -[6756, "src/Rosetta/archive/bz2/init.luau"], -[6820, "src/Rosetta/archive/cab/init.luau"], -[7233, "src/Rosetta/archive/cab/Sum.luau"], -[7274, "src/Rosetta/archive/cpio/init.luau"], -[7442, "src/Rosetta/archive/d64/init.luau"], -[7856, "src/Rosetta/archive/fat/init.luau"], -[7978, "src/Rosetta/archive/grp/init.luau"], -[8092, "src/Rosetta/archive/gzip/init.luau"], -[8277, "src/Rosetta/archive/iso/init.luau"], -[8349, "src/Rosetta/archive/lha/init.luau"], -[8774, "src/Rosetta/archive/lz4/init.luau"], -[9118, "src/Rosetta/archive/macbinary/init.luau"], -[9316, "src/Rosetta/archive/mpq/init.luau"], -[9722, "src/Rosetta/archive/mpq/Crypt.luau"], -[9787, "src/Rosetta/archive/pak/init.luau"], -[9921, "src/Rosetta/archive/rpm/init.luau"], -[10245, "src/Rosetta/archive/tar/init.luau"], -[10363, "src/Rosetta/archive/unitypackage/init.luau"], -[10599, "src/Rosetta/archive/uu/init.luau"], -[10869, "src/Rosetta/archive/vpk/init.luau"], -[11180, "src/Rosetta/archive/vswap/init.luau"], -[11450, "src/Rosetta/archive/wad/init.luau"], -[11904, "src/Rosetta/archive/wad/Picture.luau"], -[12006, "src/Rosetta/archive/wad2/init.luau"], -[12288, "src/Rosetta/archive/xz/init.luau"], -[12388, "src/Rosetta/archive/yenc/init.luau"], -[12660, "src/Rosetta/archive/z/init.luau"], -[12756, "src/Rosetta/archive/zip/init.luau"], -[12975, "src/Rosetta/archive/zoo/init.luau"], -[13171, "src/Rosetta/archive/zst/init.luau"], -[13235, "src/Rosetta/audio/aac/init.luau"], -[13448, "src/Rosetta/audio/ac3/init.luau"], -[13595, "src/Rosetta/audio/adpcm/init.luau"], -[13741, "src/Rosetta/audio/adx/init.luau"], -[13973, "src/Rosetta/audio/aiff/init.luau"], -[14365, "src/Rosetta/audio/ape/init.luau"], -[14494, "src/Rosetta/audio/au/init.luau"], -[14656, "src/Rosetta/audio/brstm/init.luau"], -[14948, "src/Rosetta/audio/caf/init.luau"], -[15615, "src/Rosetta/audio/flac/init.luau"], -[15764, "src/Rosetta/audio/flac/Meta.luau"], -[15986, "src/Rosetta/audio/flac/Stream.luau"], -[16356, "src/Rosetta/audio/m4a/init.luau"], -[16699, "src/Rosetta/audio/mp3/init.luau"], -[16960, "src/Rosetta/audio/mp3/Index.luau"], -[17151, "src/Rosetta/audio/mp3/Stream.luau"], -[17378, "src/Rosetta/audio/mp3/Tags.luau"], -[17690, "src/Rosetta/audio/mpc/init.luau"], -[17785, "src/Rosetta/audio/opus/init.luau"], -[18164, "src/Rosetta/audio/opus/Encode.luau"], -[18276, "src/Rosetta/audio/qoa/init.luau"], -[18457, "src/Rosetta/audio/tta/init.luau"], -[18576, "src/Rosetta/audio/vag/init.luau"], -[18800, "src/Rosetta/audio/voc/init.luau"], -[19076, "src/Rosetta/audio/vorbis/init.luau"], -[19531, "src/Rosetta/audio/vorbis/Encode.luau"], -[20344, "src/Rosetta/audio/wav/init.luau"], -[20965, "src/Rosetta/audio/wav/Codecs.luau"], -[21144, "src/Rosetta/audio/wavpack/init.luau"], -[21352, "src/Rosetta/cad/step/init.luau"], -[21734, "src/Rosetta/cad/step/Brep.luau"], -[21969, "src/Rosetta/cad/step/Parse.luau"], -[22526, "src/Rosetta/cad/step/Write.luau"], -[22774, "src/Rosetta/codecs/audio/Aac/init.luau"], -[23182, "src/Rosetta/codecs/audio/Aac/Decode.luau"], -[24158, "src/Rosetta/codecs/audio/Aac/Ps.luau"], -[24748, "src/Rosetta/codecs/audio/Aac/Sbr.luau"], -[25815, "src/Rosetta/codecs/audio/Aac/SbrBits.luau"], -[25934, "src/Rosetta/codecs/audio/Aac/SbrDct.luau"], -[27176, "src/Rosetta/codecs/audio/Aac/SbrHf.luau"], -[27668, "src/Rosetta/codecs/audio/Aac/SbrQmf.luau"], -[27785, "src/Rosetta/codecs/audio/Aac/SbrTables.luau"], -[28198, "src/Rosetta/codecs/audio/Aac/Tables.luau"], -[28534, "src/Rosetta/codecs/audio/Ac3/init.luau"], -[28694, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], -[29579, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], -[29681, "src/Rosetta/codecs/audio/Adpcm/init.luau"], -[30435, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], -[30738, "src/Rosetta/codecs/audio/Alac/init.luau"], -[30973, "src/Rosetta/codecs/audio/Alac/Decode.luau"], -[31392, "src/Rosetta/codecs/audio/Alac/Encode.luau"], -[31804, "src/Rosetta/codecs/audio/Ape/init.luau"], -[32020, "src/Rosetta/codecs/audio/Ape/Decode.luau"], -[32781, "src/Rosetta/codecs/audio/ApeTag.luau"], -[32879, "src/Rosetta/codecs/audio/Flac/init.luau"], -[32891, "src/Rosetta/codecs/audio/Flac/Encode.luau"], -[33840, "src/Rosetta/codecs/audio/Flac/Frame.luau"], -[34460, "src/Rosetta/codecs/audio/Hively/init.luau"], -[34657, "src/Rosetta/codecs/audio/Hively/Load.luau"], -[34907, "src/Rosetta/codecs/audio/Hively/Player.luau"], -[35866, "src/Rosetta/codecs/audio/Hively/Tables.luau"], -[36086, "src/Rosetta/codecs/audio/Mdct/init.luau"], -[36306, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], -[36560, "src/Rosetta/codecs/audio/MidiRender.luau"], -[36907, "src/Rosetta/codecs/audio/Mpa/init.luau"], -[36922, "src/Rosetta/codecs/audio/Mpa/Analysis.luau"], -[36981, "src/Rosetta/codecs/audio/Mpa/Core.luau"], -[38639, "src/Rosetta/codecs/audio/Mpa/EncTables.luau"], -[38932, "src/Rosetta/codecs/audio/Mpa/Encode2.luau"], -[39317, "src/Rosetta/codecs/audio/Mpa/Encode3.luau"], -[39958, "src/Rosetta/codecs/audio/Mpa/Header.luau"], -[40099, "src/Rosetta/codecs/audio/Mpa/Tables.luau"], -[40326, "src/Rosetta/codecs/audio/Musepack/init.luau"], -[40672, "src/Rosetta/codecs/audio/Musepack/Decode.luau"], -[41566, "src/Rosetta/codecs/audio/Musepack/Tables.luau"], -[41945, "src/Rosetta/codecs/audio/Opus/init.luau"], -[41960, "src/Rosetta/codecs/audio/Opus/Celt.luau"], -[43832, "src/Rosetta/codecs/audio/Opus/CeltEncoder.luau"], -[44897, "src/Rosetta/codecs/audio/Opus/CeltTables.luau"], -[44958, "src/Rosetta/codecs/audio/Opus/Decoder.luau"], -[45422, "src/Rosetta/codecs/audio/Opus/Mdct.luau"], -[45773, "src/Rosetta/codecs/audio/Opus/Packet.luau"], -[46006, "src/Rosetta/codecs/audio/Opus/Silk.luau"], -[48048, "src/Rosetta/codecs/audio/Opus/SilkTables.luau"], -[48422, "src/Rosetta/codecs/audio/Pcm/init.luau"], -[48686, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], -[48983, "src/Rosetta/codecs/audio/Qoa/init.luau"], -[49265, "src/Rosetta/codecs/audio/Resample/init.luau"], -[49660, "src/Rosetta/codecs/audio/SoundFont/init.luau"], -[49715, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], -[49859, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], -[50373, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"], -[51172, "src/Rosetta/codecs/audio/Stream.luau"], -[51334, "src/Rosetta/codecs/audio/Tracker/init.luau"], -[51817, "src/Rosetta/codecs/audio/Tracker/Load.luau"], -[52096, "src/Rosetta/codecs/audio/Tracker/Mixer.luau"], -[52343, "src/Rosetta/codecs/audio/Tracker/Pcm.luau"], -[52472, "src/Rosetta/codecs/audio/Tracker/Player.luau"], -[54461, "src/Rosetta/codecs/audio/Tracker/Tables.luau"], -[54578, "src/Rosetta/codecs/audio/Tta/init.luau"], -[54696, "src/Rosetta/codecs/audio/Tta/Decode.luau"], -[54948, "src/Rosetta/codecs/audio/Vorbis/init.luau"], -[54962, "src/Rosetta/codecs/audio/Vorbis/Codebook.luau"], -[55346, "src/Rosetta/codecs/audio/Vorbis/Packet.luau"], -[55919, "src/Rosetta/codecs/audio/Vorbis/Setup.luau"], -[56341, "src/Rosetta/codecs/audio/Vorbis/Tables.luau"], -[56381, "src/Rosetta/codecs/audio/VorbisComment.luau"], -[56434, "src/Rosetta/codecs/audio/WavPack/init.luau"], -[56657, "src/Rosetta/codecs/audio/WavPack/Block.luau"], -[58112, "src/Rosetta/codecs/audio/WavPack/Tables.luau"], -[58175, "src/Rosetta/codecs/compress/Brotli/init.luau"], -[58262, "src/Rosetta/codecs/compress/Brotli/Decode.luau"], -[59238, "src/Rosetta/codecs/compress/Brotli/Static.luau"], -[60106, "src/Rosetta/codecs/compress/Bzip2/init.luau"], -[60150, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], -[60663, "src/Rosetta/codecs/compress/Deflate/init.luau"], -[60989, "src/Rosetta/codecs/compress/Deflate/Compress.luau"], -[61471, "src/Rosetta/codecs/compress/Deflate/Inflate.luau"], -[61919, "src/Rosetta/codecs/compress/Explode.luau"], -[62115, "src/Rosetta/codecs/compress/Lz4.luau"], -[62384, "src/Rosetta/codecs/compress/Lzh/init.luau"], -[62988, "src/Rosetta/codecs/compress/Lzma/init.luau"], -[63528, "src/Rosetta/codecs/compress/Lzma/Crc64.luau"], -[63595, "src/Rosetta/codecs/compress/Lzma/Decode.luau"], -[64068, "src/Rosetta/codecs/compress/Lzma/Filters.luau"], -[64244, "src/Rosetta/codecs/compress/Lzw/init.luau"], -[64512, "src/Rosetta/codecs/compress/Lzx.luau"], -[64946, "src/Rosetta/codecs/compress/PackBits.luau"], -[65036, "src/Rosetta/codecs/compress/Quantum.luau"], -[65273, "src/Rosetta/codecs/compress/UnixCompress.luau"], -[65577, "src/Rosetta/codecs/compress/Xxh32.luau"], -[65646, "src/Rosetta/codecs/compress/Zstd/init.luau"], -[65703, "src/Rosetta/codecs/compress/Zstd/Decode.luau"], -[66687, "src/Rosetta/codecs/compress/Zstd/Xxh64.luau"], -[66839, "src/Rosetta/codecs/entropy/Huffman.luau"], -[67126, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], -[67137, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], -[67358, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.luau"], -[67602, "src/Rosetta/codecs/font/Bitmap.luau"], -[67803, "src/Rosetta/codecs/font/Cff/init.luau"], -[68444, "src/Rosetta/codecs/font/GlyphNames.luau"], -[68594, "src/Rosetta/codecs/font/TrueType/init.luau"], -[68908, "src/Rosetta/codecs/font/TrueType/Glyf.luau"], -[69300, "src/Rosetta/codecs/font/TrueType/Tables.luau"], -[69802, "src/Rosetta/codecs/image/Bcn/init.luau"], -[69909, "src/Rosetta/codecs/image/Bcn/Decode.luau"], -[70393, "src/Rosetta/codecs/image/Bcn/Encode.luau"], -[70822, "src/Rosetta/codecs/image/Blend.luau"], -[71201, "src/Rosetta/codecs/image/Dct/init.luau"], -[71701, "src/Rosetta/codecs/image/Etc.luau"], -[71999, "src/Rosetta/codecs/image/Half.luau"], -[72068, "src/Rosetta/codecs/image/Jpeg/init.luau"], -[72422, "src/Rosetta/codecs/image/Jpeg/Arith.luau"], -[72830, "src/Rosetta/codecs/image/Jpeg/Color.luau"], -[73195, "src/Rosetta/codecs/image/Jpeg/Decode.luau"], -[73960, "src/Rosetta/codecs/image/Jpeg/Encode.luau"], -[74841, "src/Rosetta/codecs/image/Jpeg/Scan.luau"], -[75310, "src/Rosetta/codecs/image/Jpeg/Tables.luau"], -[75388, "src/Rosetta/codecs/image/Jpeg/Yuv.luau"], -[75455, "src/Rosetta/codecs/image/Miptex.luau"], -[75755, "src/Rosetta/codecs/image/Pixels.luau"], -[76075, "src/Rosetta/codecs/image/Quantize/init.luau"], -[76536, "src/Rosetta/codecs/image/Raster.luau"], -[77233, "src/Rosetta/codecs/image/Texel.luau"], -[77606, "src/Rosetta/codecs/image/Texture.luau"], -[77751, "src/Rosetta/codecs/image/Vp8/init.luau"], -[77893, "src/Rosetta/codecs/image/Vp8/Decode.luau"], -[79873, "src/Rosetta/codecs/image/Vp8/Predict.luau"], -[80136, "src/Rosetta/codecs/image/Vp8/Tables.luau"], -[80386, "src/Rosetta/codecs/image/Vp8/Yuv.luau"], -[80528, "src/Rosetta/codecs/image/Vp8L/init.luau"], -[80632, "src/Rosetta/codecs/image/Vp8L/Decode.luau"], -[81572, "src/Rosetta/codecs/image/Vp8L/Encode.luau"], -[82524, "src/Rosetta/codecs/image/Yuv.luau"], -[82845, "src/Rosetta/codecs/model/Brush.luau"], -[83485, "src/Rosetta/codecs/model/Displacement.luau"], -[83634, "src/Rosetta/codecs/model/DoomMap/init.luau"], -[84079, "src/Rosetta/codecs/model/DoomMap/Udmf.luau"], -[84329, "src/Rosetta/codecs/model/Draco/init.luau"], -[84661, "src/Rosetta/codecs/model/Draco/Attributes.luau"], -[85130, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], -[86319, "src/Rosetta/codecs/model/Draco/Int64.luau"], -[86468, "src/Rosetta/codecs/model/Draco/KdTree.luau"], -[86827, "src/Rosetta/codecs/model/Draco/Predict.luau"], -[87789, "src/Rosetta/codecs/model/Draco/Reader.luau"], -[88263, "src/Rosetta/codecs/model/Mat4.luau"], -[88522, "src/Rosetta/codecs/model/MeshFlatten.luau"], -[89050, "src/Rosetta/codecs/model/Minecraft/init.luau"], -[89602, "src/Rosetta/codecs/model/Minecraft/Colors.luau"], -[89681, "src/Rosetta/codecs/model/Minecraft/Legacy.luau"], -[89788, "src/Rosetta/codecs/model/Minecraft/Packed.luau"], -[89994, "src/Rosetta/codecs/model/Patch.luau"], -[90118, "src/Rosetta/codecs/model/Polygon.luau"], -[90352, "src/Rosetta/codecs/model/Rbx/init.luau"], -[90589, "src/Rosetta/codecs/model/Rbx/Binary.luau"], -[91343, "src/Rosetta/codecs/model/Rig.luau"], -[91586, "src/Rosetta/codecs/model/Sampler.luau"], -[91746, "src/Rosetta/codecs/model/SourceAnim.luau"], -[91967, "src/Rosetta/codecs/model/Vrml/init.luau"], -[92115, "src/Rosetta/codecs/model/Vrml/Build.luau"], -[92689, "src/Rosetta/codecs/model/Vrml/Fields.luau"], -[92852, "src/Rosetta/codecs/model/Vrml/Geometry.luau"], -[93601, "src/Rosetta/codecs/model/Vrml/Parse.luau"], -[94123, "src/Rosetta/codecs/model/Vrml/Write.luau"], -[94850, "src/Rosetta/codecs/model/Vrml/Xml.luau"], -[95082, "src/Rosetta/codecs/text/GodotVariant.luau"], -[95741, "src/Rosetta/codecs/text/Json/init.luau"], -[96010, "src/Rosetta/codecs/text/Json/Decode.luau"], -[96445, "src/Rosetta/codecs/text/Json/Encode.luau"], -[96790, "src/Rosetta/codecs/text/KeyValues/init.luau"], -[97360, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], -[97666, "src/Rosetta/codecs/text/Lexer/init.luau"], -[97798, "src/Rosetta/codecs/text/Nbt/init.luau"], -[98151, "src/Rosetta/codecs/text/Nbt/Binary.luau"], -[98843, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], -[99483, "src/Rosetta/codecs/text/Nbt/Value.luau"], -[99721, "src/Rosetta/codecs/text/Text/init.luau"], -[99812, "src/Rosetta/codecs/text/Url/init.luau"], -[100017, "src/Rosetta/codecs/text/Xml/init.luau"], -[100467, "src/Rosetta/codecs/text/Xml/Parse.luau"], -[101271, "src/Rosetta/codecs/video/Dsp.luau"], -[102109, "src/Rosetta/codecs/video/H263/init.luau"], -[102266, "src/Rosetta/codecs/video/H263/Decoder.luau"], -[103124, "src/Rosetta/codecs/video/H263/Tables.luau"], -[103328, "src/Rosetta/codecs/video/H264/init.luau"], -[103718, "src/Rosetta/codecs/video/H264/Bitstream.luau"], -[103993, "src/Rosetta/codecs/video/H264/Cabac.luau"], -[105124, "src/Rosetta/codecs/video/H264/Cavlc.luau"], -[105892, "src/Rosetta/codecs/video/H264/Deblock.luau"], -[106154, "src/Rosetta/codecs/video/H264/Decoder.luau"], -[107220, "src/Rosetta/codecs/video/H264/Inter.luau"], -[107546, "src/Rosetta/codecs/video/H264/Intra.luau"], -[107953, "src/Rosetta/codecs/video/H264/Mb.luau"], -[108907, "src/Rosetta/codecs/video/H264/Params.luau"], -[109355, "src/Rosetta/codecs/video/H264/Slice.luau"], -[109607, "src/Rosetta/codecs/video/H264/Tables.luau"], -[109649, "src/Rosetta/codecs/video/H264/Transform.luau"], -[109814, "src/Rosetta/codecs/video/Legacy/init.luau"], -[110013, "src/Rosetta/codecs/video/Legacy/Cinepak.luau"], -[110310, "src/Rosetta/codecs/video/Legacy/Flic.luau"], -[110677, "src/Rosetta/codecs/video/Legacy/Msvideo1.luau"], -[110795, "src/Rosetta/codecs/video/Legacy/Picture.luau"], -[110903, "src/Rosetta/codecs/video/Legacy/QtRle.luau"], -[111176, "src/Rosetta/codecs/video/Legacy/Smacker.luau"], -[111571, "src/Rosetta/codecs/video/Legacy/Smc.luau"], -[111748, "src/Rosetta/codecs/video/Mpeg1/init.luau"], -[111761, "src/Rosetta/codecs/video/Mpeg2/init.luau"], -[112135, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], -[113662, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], -[113802, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"], -[113941, "src/Rosetta/codecs/video/Theora/init.luau"], -[114205, "src/Rosetta/codecs/video/Theora/Decoder.luau"], -[115469, "src/Rosetta/codecs/video/Theora/Header.luau"], -[115833, "src/Rosetta/codecs/video/Video/init.luau"], -[116448, "src/Rosetta/codecs/video/Video/Disposable.luau"], -[116659, "src/Rosetta/codecs/video/Video/Pool.luau"], -[116711, "src/Rosetta/codecs/video/Video/Source.luau"], -[116997, "src/Rosetta/containers/Archive.luau"], -[117264, "src/Rosetta/containers/AudioWrap.luau"], -[117774, "src/Rosetta/containers/Avi/init.luau"], -[118327, "src/Rosetta/containers/Blend.luau"], -[119066, "src/Rosetta/containers/Chunks.luau"], -[119201, "src/Rosetta/containers/Cpio.luau"], -[119629, "src/Rosetta/containers/Demux.luau"], -[119915, "src/Rosetta/containers/Ebml/init.luau"], -[120229, "src/Rosetta/containers/Fat.luau"], -[120917, "src/Rosetta/containers/Iso9660.luau"], -[121422, "src/Rosetta/containers/IsoBmff/init.luau"], -[121593, "src/Rosetta/containers/IsoBmff/Box.luau"], -[121782, "src/Rosetta/containers/IsoBmff/Demux.luau"], -[122628, "src/Rosetta/containers/IsoBmff/Meta.luau"], -[123150, "src/Rosetta/containers/IsoBmff/Mux.luau"], -[123667, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], -[123785, "src/Rosetta/containers/MacFile.luau"], -[123934, "src/Rosetta/containers/MpegEs.luau"], -[124101, "src/Rosetta/containers/MpegPs/init.luau"], -[124322, "src/Rosetta/containers/MpegTs/init.luau"], -[125115, "src/Rosetta/containers/Ogg/init.luau"], -[125540, "src/Rosetta/containers/Ogg/Mux.luau"], -[125729, "src/Rosetta/containers/Ogg/Page.luau"], -[125895, "src/Rosetta/containers/Riff/init.luau"], -[126212, "src/Rosetta/containers/Tar.luau"], -[126626, "src/Rosetta/containers/Zip/init.luau"], -[127258, "src/Rosetta/core/Adler32.luau"], -[127318, "src/Rosetta/core/Base64.luau"], -[127546, "src/Rosetta/core/Bits.luau"], -[127839, "src/Rosetta/core/Bytes.luau"], -[128366, "src/Rosetta/core/Crc16.luau"], -[128418, "src/Rosetta/core/Crc32.luau"], -[128569, "src/Rosetta/core/Err.luau"], -[128651, "src/Rosetta/core/Input.luau"], -[128727, "src/Rosetta/core/Md5.luau"], -[128885, "src/Rosetta/core/Sniff.luau"], -[128914, "src/Rosetta/data/cbor/init.luau"], -[129013, "src/Rosetta/data/cbor/Codec.luau"], -[129582, "src/Rosetta/data/csv/init.luau"], -[129894, "src/Rosetta/data/ini/init.luau"], -[130140, "src/Rosetta/data/json/init.luau"], -[130232, "src/Rosetta/data/msgpack/init.luau"], -[130321, "src/Rosetta/data/msgpack/Codec.luau"], -[130763, "src/Rosetta/data/nbt/init.luau"], -[130822, "src/Rosetta/data/plist/init.luau"], -[131128, "src/Rosetta/data/plist/Binary.luau"], -[131395, "src/Rosetta/data/q3shader/init.luau"], -[131634, "src/Rosetta/data/q3skin/init.luau"], -[131730, "src/Rosetta/data/snbt/init.luau"], -[131793, "src/Rosetta/data/toml/init.luau"], -[131860, "src/Rosetta/data/toml/Decode.luau"], -[132488, "src/Rosetta/data/toml/Encode.luau"], -[132697, "src/Rosetta/data/tres/init.luau"], -[132842, "src/Rosetta/data/vdf/init.luau"], -[132943, "src/Rosetta/data/xml/init.luau"], -[132999, "src/Rosetta/data/yaml/init.luau"], -[133072, "src/Rosetta/data/yaml/Emit.luau"], -[133362, "src/Rosetta/data/yaml/Parse.luau"], -[134655, "src/Rosetta/font/bdf/init.luau"], -[134944, "src/Rosetta/font/bmfont/init.luau"], -[135371, "src/Rosetta/font/bmfont/Parse.luau"], -[135824, "src/Rosetta/font/eot/init.luau"], -[136056, "src/Rosetta/font/fon/init.luau"], -[136339, "src/Rosetta/font/hershey/init.luau"], -[136534, "src/Rosetta/font/pcf/init.luau"], -[136814, "src/Rosetta/font/psf/init.luau"], -[137134, "src/Rosetta/font/ttf/init.luau"], -[137185, "src/Rosetta/font/type1/init.luau"], -[137544, "src/Rosetta/font/type1/Charstring.luau"], -[137822, "src/Rosetta/font/woff/init.luau"], -[137954, "src/Rosetta/font/woff2/init.luau"], -[138011, "src/Rosetta/font/woff2/Rebuild.luau"], -[138551, "src/Rosetta/host/init.luau"], -[138596, "src/Rosetta/host/Love.luau"], -[138739, "src/Rosetta/host/LuaJIT.luau"], -[138789, "src/Rosetta/host/Luau.luau"], -[138812, "src/Rosetta/host/Roblox.luau"], -[139171, "src/Rosetta/image/ani/init.luau"], -[139351, "src/Rosetta/image/art/init.luau"], -[139839, "src/Rosetta/image/blp/init.luau"], -[140097, "src/Rosetta/image/bmp/init.luau"], -[140512, "src/Rosetta/image/dds/init.luau"], -[140995, "src/Rosetta/image/exr/init.luau"], -[141755, "src/Rosetta/image/exr/Codec.luau"], -[141866, "src/Rosetta/image/exr/Piz.luau"], -[142223, "src/Rosetta/image/gif/init.luau"], -[142739, "src/Rosetta/image/gif/Decode.luau"], -[142815, "src/Rosetta/image/hdr/init.luau"], -[143044, "src/Rosetta/image/hdr/Codec.luau"], -[143255, "src/Rosetta/image/icns/init.luau"], -[143586, "src/Rosetta/image/ico/init.luau"], -[143863, "src/Rosetta/image/ico/Dib.luau"], -[143958, "src/Rosetta/image/ilbm/init.luau"], -[144277, "src/Rosetta/image/jpeg/init.luau"], -[144413, "src/Rosetta/image/ktx/init.luau"], -[145073, "src/Rosetta/image/lmp/init.luau"], -[145206, "src/Rosetta/image/pcx/init.luau"], -[145470, "src/Rosetta/image/png/init.luau"], -[146050, "src/Rosetta/image/png/Apng.luau"], -[146130, "src/Rosetta/image/png/Decode.luau"], -[146503, "src/Rosetta/image/png/Encode.luau"], -[146706, "src/Rosetta/image/pnm/init.luau"], -[147084, "src/Rosetta/image/pnm/Codec.luau"], -[147361, "src/Rosetta/image/qoi/init.luau"], -[147483, "src/Rosetta/image/qoi/Codec.luau"], -[147640, "src/Rosetta/image/sgi/init.luau"], -[147925, "src/Rosetta/image/spr/init.luau"], -[148238, "src/Rosetta/image/sunras/init.luau"], -[148484, "src/Rosetta/image/tga/init.luau"], -[148754, "src/Rosetta/image/tga/Codec.luau"], -[148954, "src/Rosetta/image/tiff/init.luau"], -[149781, "src/Rosetta/image/tiff/Pixels.luau"], -[150171, "src/Rosetta/image/tim/init.luau"], -[150413, "src/Rosetta/image/vtf/init.luau"], -[150648, "src/Rosetta/image/webp/init.luau"], -[151258, "src/Rosetta/image/webp/Alpha.luau"], -[151334, "src/Rosetta/image/webp/Anim.luau"], -[151489, "src/Rosetta/image/xbm/init.luau"], -[151650, "src/Rosetta/image/xpm/init.luau"], -[151918, "src/Rosetta/image/xpm/Names.luau"], -[151974, "src/Rosetta/layered/aseprite/init.luau"], -[152712, "src/Rosetta/layered/ora/init.luau"], -[152999, "src/Rosetta/layered/psd/init.luau"], -[153734, "src/Rosetta/layered/psd/Channels.luau"], -[154086, "src/Rosetta/model/3ds/init.luau"], -[154169, "src/Rosetta/model/3ds/Build.luau"], -[154816, "src/Rosetta/model/3ds/Read.luau"], -[155312, "src/Rosetta/model/3ds/Write.luau"], -[156117, "src/Rosetta/model/3mf/init.luau"], -[156199, "src/Rosetta/model/3mf/Read.luau"], -[156787, "src/Rosetta/model/3mf/Write.luau"], -[157192, "src/Rosetta/model/ase/init.luau"], -[157315, "src/Rosetta/model/ase/Build.luau"], -[157889, "src/Rosetta/model/ase/Parse.luau"], -[157958, "src/Rosetta/model/ase/Write.luau"], -[158421, "src/Rosetta/model/b3d/init.luau"], -[158476, "src/Rosetta/model/b3d/Read.luau"], -[159047, "src/Rosetta/model/blend/init.luau"], -[159143, "src/Rosetta/model/blend/Anim.luau"], -[159489, "src/Rosetta/model/blend/Material.luau"], -[159841, "src/Rosetta/model/blend/Mesh.luau"], -[160476, "src/Rosetta/model/blend/Normals.luau"], -[160637, "src/Rosetta/model/blend/Prim.luau"], -[161086, "src/Rosetta/model/blend/Read.luau"], -[161986, "src/Rosetta/model/bsp/init.luau"], -[162177, "src/Rosetta/model/bsp/Lightmap.luau"], -[162243, "src/Rosetta/model/bsp/Quake.luau"], -[162632, "src/Rosetta/model/bsp/Quake3.luau"], -[162861, "src/Rosetta/model/bsp/Tree.luau"], -[163249, "src/Rosetta/model/buildmap/init.luau"], -[163521, "src/Rosetta/model/buildmap/Geometry.luau"], -[163924, "src/Rosetta/model/d3map/init.luau"], -[164206, "src/Rosetta/model/d3map/Parse.luau"], -[164404, "src/Rosetta/model/dae/init.luau"], -[164593, "src/Rosetta/model/dae/Math.luau"], -[164640, "src/Rosetta/model/dae/Read.luau"], -[166490, "src/Rosetta/model/dae/Write.luau"], -[166859, "src/Rosetta/model/fbx/init.luau"], -[167007, "src/Rosetta/model/fbx/Ascii.luau"], -[167277, "src/Rosetta/model/fbx/Binary.luau"], -[167732, "src/Rosetta/model/fbx/Read.luau"], -[169094, "src/Rosetta/model/fbx/Write.luau"], -[170079, "src/Rosetta/model/fbx/Xform.luau"], -[170120, "src/Rosetta/model/gltf/init.luau"], -[170357, "src/Rosetta/model/gltf/Pack.luau"], -[170426, "src/Rosetta/model/gltf/Read.luau"], -[171157, "src/Rosetta/model/gltf/Write.luau"], -[171837, "src/Rosetta/model/godot/init.luau"], -[171928, "src/Rosetta/model/godot/Build.luau"], -[172470, "src/Rosetta/model/godot/Primitives.luau"], -[172745, "src/Rosetta/model/godot/Surface.luau"], -[173230, "src/Rosetta/model/godot/Write.luau"], -[173559, "src/Rosetta/model/iqm/init.luau"], -[173635, "src/Rosetta/model/iqm/Read.luau"], -[173990, "src/Rosetta/model/iqm/Write.luau"], -[174677, "src/Rosetta/model/ldraw/init.luau"], -[174755, "src/Rosetta/model/ldraw/Colors.luau"], -[175073, "src/Rosetta/model/ldraw/Read.luau"], -[175650, "src/Rosetta/model/lwo/init.luau"], -[175726, "src/Rosetta/model/lwo/Build.luau"], -[176188, "src/Rosetta/model/lwo/Parse.luau"], -[176731, "src/Rosetta/model/map/init.luau"], -[177048, "src/Rosetta/model/map/Build.luau"], -[177292, "src/Rosetta/model/map/Parse.luau"], -[177677, "src/Rosetta/model/map/Write.luau"], -[177823, "src/Rosetta/model/mca/init.luau"], -[178165, "src/Rosetta/model/mca/Chunk.luau"], -[178298, "src/Rosetta/model/mca/Lz4Block.luau"], -[178368, "src/Rosetta/model/md2/init.luau"], -[178567, "src/Rosetta/model/md3/init.luau"], -[178795, "src/Rosetta/model/md5/init.luau"], -[178876, "src/Rosetta/model/md5/Read.luau"], -[179309, "src/Rosetta/model/mdl/init.luau"], -[179391, "src/Rosetta/model/mdl/HalfLife.luau"], -[179695, "src/Rosetta/model/mdl/Quake.luau"], -[179913, "src/Rosetta/model/ms3d/init.luau"], -[179985, "src/Rosetta/model/ms3d/Read.luau"], -[180431, "src/Rosetta/model/ms3d/Write.luau"], -[180900, "src/Rosetta/model/obj/init.luau"], -[181718, "src/Rosetta/model/obj/Mtl.luau"], -[182006, "src/Rosetta/model/off/init.luau"], -[182468, "src/Rosetta/model/ply/init.luau"], -[183573, "src/Rosetta/model/ply/Binary.luau"], -[183774, "src/Rosetta/model/pmx/init.luau"], -[183843, "src/Rosetta/model/pmx/Build.luau"], -[184139, "src/Rosetta/model/pmx/Pmd.luau"], -[184474, "src/Rosetta/model/pmx/Read.luau"], -[184878, "src/Rosetta/model/proc/init.luau"], -[185260, "src/Rosetta/model/qb/init.luau"], -[185653, "src/Rosetta/model/rbxm/init.luau"], -[186246, "src/Rosetta/model/rbxmx/init.luau"], -[186922, "src/Rosetta/model/robloxmesh/init.luau"], -[187581, "src/Rosetta/model/robloxmesh/Parse.luau"], -[188038, "src/Rosetta/model/robloxmesh/Write.luau"], -[188147, "src/Rosetta/model/schematic/init.luau"], -[188468, "src/Rosetta/model/schematic/Common.luau"], -[188588, "src/Rosetta/model/schematic/Litematic.luau"], -[188799, "src/Rosetta/model/schematic/Mcedit.luau"], -[189043, "src/Rosetta/model/schematic/Sponge.luau"], -[189172, "src/Rosetta/model/smd/init.luau"], -[189239, "src/Rosetta/model/smd/Read.luau"], -[189508, "src/Rosetta/model/smd/Write.luau"], -[189751, "src/Rosetta/model/sourcemdl/init.luau"], -[189922, "src/Rosetta/model/sourcemdl/Build.luau"], -[190352, "src/Rosetta/model/sourcemdl/Material.luau"], -[190513, "src/Rosetta/model/sourcemdl/Mdl.luau"], -[191040, "src/Rosetta/model/sourcemdl/Phy.luau"], -[191163, "src/Rosetta/model/sourcemdl/Vtx.luau"], -[191345, "src/Rosetta/model/sourcemdl/Vvd.luau"], -[191439, "src/Rosetta/model/stl/init.luau"], -[191889, "src/Rosetta/model/stl/Decode.luau"], -[191963, "src/Rosetta/model/t3d/init.luau"], -[192057, "src/Rosetta/model/t3d/Build.luau"], -[192462, "src/Rosetta/model/t3d/Parse.luau"], -[192630, "src/Rosetta/model/udmf/init.luau"], -[192713, "src/Rosetta/model/usda/init.luau"], -[192922, "src/Rosetta/model/usda/Build.luau"], -[194200, "src/Rosetta/model/usda/Parse.luau"], -[194998, "src/Rosetta/model/usda/Write.luau"], -[195815, "src/Rosetta/model/vbsp/init.luau"], -[196261, "src/Rosetta/model/vbsp/Faces.luau"], -[196485, "src/Rosetta/model/vbsp/Props.luau"], -[196577, "src/Rosetta/model/vmf/init.luau"], -[196902, "src/Rosetta/model/vmf/Build.luau"], -[197326, "src/Rosetta/model/vox/init.luau"], -[198212, "src/Rosetta/model/vox/Grid.luau"], -[198269, "src/Rosetta/model/vrml/init.luau"], -[198335, "src/Rosetta/model/x/init.luau"], -[198465, "src/Rosetta/model/x/Build.luau"], -[199028, "src/Rosetta/model/x/Parse.luau"], -[199325, "src/Rosetta/model/x3d/init.luau"], -[199403, "src/Rosetta/music/669/init.luau"], -[199610, "src/Rosetta/music/ahx/init.luau"], -[199662, "src/Rosetta/music/far/init.luau"], -[199892, "src/Rosetta/music/hmp/init.luau"], -[200157, "src/Rosetta/music/hvl/init.luau"], -[200209, "src/Rosetta/music/it/init.luau"], -[200628, "src/Rosetta/music/it/Itsex.luau"], -[200745, "src/Rosetta/music/med/init.luau"], -[201393, "src/Rosetta/music/midi/init.luau"], -[201537, "src/Rosetta/music/midi/Smf.luau"], -[201949, "src/Rosetta/music/mod/init.luau"], -[202303, "src/Rosetta/music/mtm/init.luau"], -[202526, "src/Rosetta/music/mus/init.luau"], -[202684, "src/Rosetta/music/okt/init.luau"], -[202966, "src/Rosetta/music/ptm/init.luau"], -[203189, "src/Rosetta/music/s3m/init.luau"], -[203426, "src/Rosetta/music/sf2/init.luau"], -[203470, "src/Rosetta/music/stm/init.luau"], -[203702, "src/Rosetta/music/ult/init.luau"], -[204007, "src/Rosetta/music/umx/init.luau"], -[204224, "src/Rosetta/music/xm/init.luau"], -[204786, "src/Rosetta/music/xmi/init.luau"], -[204995, "src/Rosetta/ops/AudioOps.luau"], -[205474, "src/Rosetta/ops/ImageOps/init.luau"], -[206122, "src/Rosetta/ops/ImageOps/Kernels.luau"], -[206762, "src/Rosetta/ops/LayerOps.luau"], -[206855, "src/Rosetta/ops/MeshOps/init.luau"], -[207907, "src/Rosetta/ops/MeshOps/Greedy.luau"], -[208074, "src/Rosetta/ops/MusicOps.luau"], -[208423, "src/Rosetta/playlist/m3u/init.luau"], -[208776, "src/Rosetta/playlist/pls/init.luau"], -[208954, "src/Rosetta/playlist/xspf/init.luau"], -[209157, "src/Rosetta/subtitle/ass/init.luau"], -[209601, "src/Rosetta/subtitle/srt/init.luau"], -[209774, "src/Rosetta/subtitle/vtt/init.luau"], -[209977, "src/Rosetta/vector/gamemaps/init.luau"], -[210164, "src/Rosetta/vector/gamemaps/Expand.luau"], -[210261, "src/Rosetta/vector/ldtk/init.luau"], -[210353, "src/Rosetta/vector/ldtk/Read.luau"], -[210689, "src/Rosetta/vector/ldtk/Write.luau"], -[211337, "src/Rosetta/vector/ogmo/init.luau"], -[211456, "src/Rosetta/vector/ogmo/Read.luau"], -[211861, "src/Rosetta/vector/ogmo/Write.luau"], -[212215, "src/Rosetta/vector/svg/init.luau"], -[212301, "src/Rosetta/vector/svg/Parse.luau"], -[213047, "src/Rosetta/vector/svg/PathData.luau"], -[213415, "src/Rosetta/vector/svg/Render.luau"], -[213832, "src/Rosetta/vector/svg/Style.luau"], -[214204, "src/Rosetta/vector/svg/Write.luau"], -[214404, "src/Rosetta/vector/tiled/init.luau"], -[214584, "src/Rosetta/vector/tiled/Data.luau"], -[214735, "src/Rosetta/vector/tiled/Tmj.luau"], -[215366, "src/Rosetta/vector/tiled/Tmx.luau"], -[215978, "src/Rosetta/video/avi/init.luau"], -[216272, "src/Rosetta/video/fli/init.luau"], -[216423, "src/Rosetta/video/flv/init.luau"], -[216807, "src/Rosetta/video/flv/Amf.luau"], -[216965, "src/Rosetta/video/flv/Mux.luau"], -[217246, "src/Rosetta/video/h264/init.luau"], -[217385, "src/Rosetta/video/mkv/init.luau"], -[217541, "src/Rosetta/video/mkv/Mux.luau"], -[217820, "src/Rosetta/video/mkv/Parse.luau"], -[218541, "src/Rosetta/video/mp4/init.luau"], -[218869, "src/Rosetta/video/mpegps/init.luau"], -[219056, "src/Rosetta/video/mpegts/init.luau"], -[219302, "src/Rosetta/video/ogv/init.luau"], -[219697, "src/Rosetta/video/smk/init.luau"], -[220006, "src/Rosetta/video/smk/Audio.luau"], -[220126, "src/Rosetta/video/y4m/init.luau"] +[946, "src/Rosetta/Registry.luau"], +[3563, "src/Rosetta/Sniffs.luau"], +[6949, "src/Rosetta/Types.luau"], +[8066, "src/Rosetta/archive/7z/init.luau"], +[8451, "src/Rosetta/archive/7z/Header.luau"], +[8978, "src/Rosetta/archive/adf/init.luau"], +[9260, "src/Rosetta/archive/applesingle/init.luau"], +[9446, "src/Rosetta/archive/ar/init.luau"], +[9849, "src/Rosetta/archive/arj/init.luau"], +[10059, "src/Rosetta/archive/binhex/init.luau"], +[10308, "src/Rosetta/archive/br/init.luau"], +[10383, "src/Rosetta/archive/bz2/init.luau"], +[10447, "src/Rosetta/archive/cab/init.luau"], +[10860, "src/Rosetta/archive/cab/Sum.luau"], +[10901, "src/Rosetta/archive/cpio/init.luau"], +[11069, "src/Rosetta/archive/d64/init.luau"], +[11483, "src/Rosetta/archive/fat/init.luau"], +[11605, "src/Rosetta/archive/grp/init.luau"], +[11719, "src/Rosetta/archive/gzip/init.luau"], +[11904, "src/Rosetta/archive/iso/init.luau"], +[11976, "src/Rosetta/archive/lha/init.luau"], +[12401, "src/Rosetta/archive/lz4/init.luau"], +[12745, "src/Rosetta/archive/macbinary/init.luau"], +[12943, "src/Rosetta/archive/mpq/init.luau"], +[13349, "src/Rosetta/archive/mpq/Crypt.luau"], +[13414, "src/Rosetta/archive/pak/init.luau"], +[13548, "src/Rosetta/archive/rpm/init.luau"], +[13872, "src/Rosetta/archive/tar/init.luau"], +[13990, "src/Rosetta/archive/unitypackage/init.luau"], +[14226, "src/Rosetta/archive/uu/init.luau"], +[14496, "src/Rosetta/archive/vpk/init.luau"], +[14807, "src/Rosetta/archive/vswap/init.luau"], +[15077, "src/Rosetta/archive/wad/init.luau"], +[15531, "src/Rosetta/archive/wad/Picture.luau"], +[15633, "src/Rosetta/archive/wad2/init.luau"], +[15915, "src/Rosetta/archive/xz/init.luau"], +[16015, "src/Rosetta/archive/yenc/init.luau"], +[16287, "src/Rosetta/archive/z/init.luau"], +[16383, "src/Rosetta/archive/zip/init.luau"], +[16602, "src/Rosetta/archive/zoo/init.luau"], +[16798, "src/Rosetta/archive/zst/init.luau"], +[16862, "src/Rosetta/audio/aac/init.luau"], +[17075, "src/Rosetta/audio/ac3/init.luau"], +[17222, "src/Rosetta/audio/adpcm/init.luau"], +[17368, "src/Rosetta/audio/adx/init.luau"], +[17600, "src/Rosetta/audio/aiff/init.luau"], +[17992, "src/Rosetta/audio/ape/init.luau"], +[18121, "src/Rosetta/audio/au/init.luau"], +[18283, "src/Rosetta/audio/brstm/init.luau"], +[18575, "src/Rosetta/audio/caf/init.luau"], +[19242, "src/Rosetta/audio/flac/init.luau"], +[19391, "src/Rosetta/audio/flac/Meta.luau"], +[19613, "src/Rosetta/audio/flac/Stream.luau"], +[19983, "src/Rosetta/audio/m4a/init.luau"], +[20326, "src/Rosetta/audio/mp3/init.luau"], +[20587, "src/Rosetta/audio/mp3/Index.luau"], +[20778, "src/Rosetta/audio/mp3/Stream.luau"], +[21005, "src/Rosetta/audio/mp3/Tags.luau"], +[21317, "src/Rosetta/audio/mpc/init.luau"], +[21412, "src/Rosetta/audio/opus/init.luau"], +[21791, "src/Rosetta/audio/opus/Encode.luau"], +[21903, "src/Rosetta/audio/qoa/init.luau"], +[22084, "src/Rosetta/audio/tta/init.luau"], +[22203, "src/Rosetta/audio/vag/init.luau"], +[22427, "src/Rosetta/audio/voc/init.luau"], +[22703, "src/Rosetta/audio/vorbis/init.luau"], +[23158, "src/Rosetta/audio/vorbis/Encode.luau"], +[23971, "src/Rosetta/audio/wav/init.luau"], +[24592, "src/Rosetta/audio/wav/Codecs.luau"], +[24771, "src/Rosetta/audio/wavpack/init.luau"], +[24979, "src/Rosetta/cad/step/init.luau"], +[25361, "src/Rosetta/cad/step/Brep.luau"], +[25596, "src/Rosetta/cad/step/Parse.luau"], +[26153, "src/Rosetta/cad/step/Write.luau"], +[26401, "src/Rosetta/codecs/audio/Aac/init.luau"], +[26809, "src/Rosetta/codecs/audio/Aac/Decode.luau"], +[27785, "src/Rosetta/codecs/audio/Aac/Ps.luau"], +[28375, "src/Rosetta/codecs/audio/Aac/Sbr.luau"], +[29442, "src/Rosetta/codecs/audio/Aac/SbrBits.luau"], +[29561, "src/Rosetta/codecs/audio/Aac/SbrDct.luau"], +[30803, "src/Rosetta/codecs/audio/Aac/SbrHf.luau"], +[31295, "src/Rosetta/codecs/audio/Aac/SbrQmf.luau"], +[31412, "src/Rosetta/codecs/audio/Aac/SbrTables.luau"], +[31825, "src/Rosetta/codecs/audio/Aac/Tables.luau"], +[32161, "src/Rosetta/codecs/audio/Ac3/init.luau"], +[32321, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], +[33206, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], +[33308, "src/Rosetta/codecs/audio/Adpcm/init.luau"], +[34062, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], +[34365, "src/Rosetta/codecs/audio/Alac/init.luau"], +[34600, "src/Rosetta/codecs/audio/Alac/Decode.luau"], +[35019, "src/Rosetta/codecs/audio/Alac/Encode.luau"], +[35431, "src/Rosetta/codecs/audio/Ape/init.luau"], +[35647, "src/Rosetta/codecs/audio/Ape/Decode.luau"], +[36408, "src/Rosetta/codecs/audio/ApeTag.luau"], +[36506, "src/Rosetta/codecs/audio/Flac/init.luau"], +[36518, "src/Rosetta/codecs/audio/Flac/Encode.luau"], +[37467, "src/Rosetta/codecs/audio/Flac/Frame.luau"], +[38087, "src/Rosetta/codecs/audio/Hively/init.luau"], +[38284, "src/Rosetta/codecs/audio/Hively/Load.luau"], +[38534, "src/Rosetta/codecs/audio/Hively/Player.luau"], +[39493, "src/Rosetta/codecs/audio/Hively/Tables.luau"], +[39713, "src/Rosetta/codecs/audio/Mdct/init.luau"], +[39933, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], +[40187, "src/Rosetta/codecs/audio/MidiRender.luau"], +[40534, "src/Rosetta/codecs/audio/Mpa/init.luau"], +[40549, "src/Rosetta/codecs/audio/Mpa/Analysis.luau"], +[40608, "src/Rosetta/codecs/audio/Mpa/Core.luau"], +[42266, "src/Rosetta/codecs/audio/Mpa/EncTables.luau"], +[42559, "src/Rosetta/codecs/audio/Mpa/Encode2.luau"], +[42944, "src/Rosetta/codecs/audio/Mpa/Encode3.luau"], +[43585, "src/Rosetta/codecs/audio/Mpa/Header.luau"], +[43726, "src/Rosetta/codecs/audio/Mpa/Tables.luau"], +[43953, "src/Rosetta/codecs/audio/Musepack/init.luau"], +[44299, "src/Rosetta/codecs/audio/Musepack/Decode.luau"], +[45193, "src/Rosetta/codecs/audio/Musepack/Tables.luau"], +[45572, "src/Rosetta/codecs/audio/Opus/init.luau"], +[45587, "src/Rosetta/codecs/audio/Opus/Celt.luau"], +[47459, "src/Rosetta/codecs/audio/Opus/CeltEncoder.luau"], +[48524, "src/Rosetta/codecs/audio/Opus/CeltTables.luau"], +[48585, "src/Rosetta/codecs/audio/Opus/Decoder.luau"], +[49049, "src/Rosetta/codecs/audio/Opus/Mdct.luau"], +[49400, "src/Rosetta/codecs/audio/Opus/Packet.luau"], +[49633, "src/Rosetta/codecs/audio/Opus/Silk.luau"], +[51675, "src/Rosetta/codecs/audio/Opus/SilkTables.luau"], +[52049, "src/Rosetta/codecs/audio/Pcm/init.luau"], +[52313, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], +[52610, "src/Rosetta/codecs/audio/Qoa/init.luau"], +[52892, "src/Rosetta/codecs/audio/Resample/init.luau"], +[53287, "src/Rosetta/codecs/audio/SoundFont/init.luau"], +[53342, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], +[53486, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], +[54000, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"], +[54799, "src/Rosetta/codecs/audio/Stream.luau"], +[54961, "src/Rosetta/codecs/audio/Tracker/init.luau"], +[55444, "src/Rosetta/codecs/audio/Tracker/Load.luau"], +[55723, "src/Rosetta/codecs/audio/Tracker/Mixer.luau"], +[55970, "src/Rosetta/codecs/audio/Tracker/Pcm.luau"], +[56099, "src/Rosetta/codecs/audio/Tracker/Player.luau"], +[58088, "src/Rosetta/codecs/audio/Tracker/Tables.luau"], +[58205, "src/Rosetta/codecs/audio/Tta/init.luau"], +[58323, "src/Rosetta/codecs/audio/Tta/Decode.luau"], +[58575, "src/Rosetta/codecs/audio/Vorbis/init.luau"], +[58589, "src/Rosetta/codecs/audio/Vorbis/Codebook.luau"], +[58973, "src/Rosetta/codecs/audio/Vorbis/Packet.luau"], +[59546, "src/Rosetta/codecs/audio/Vorbis/Setup.luau"], +[59968, "src/Rosetta/codecs/audio/Vorbis/Tables.luau"], +[60008, "src/Rosetta/codecs/audio/VorbisComment.luau"], +[60061, "src/Rosetta/codecs/audio/WavPack/init.luau"], +[60284, "src/Rosetta/codecs/audio/WavPack/Block.luau"], +[61739, "src/Rosetta/codecs/audio/WavPack/Tables.luau"], +[61802, "src/Rosetta/codecs/compress/Brotli/init.luau"], +[61889, "src/Rosetta/codecs/compress/Brotli/Decode.luau"], +[62865, "src/Rosetta/codecs/compress/Brotli/Static.luau"], +[63733, "src/Rosetta/codecs/compress/Bzip2/init.luau"], +[63777, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], +[64290, "src/Rosetta/codecs/compress/Deflate/init.luau"], +[64616, "src/Rosetta/codecs/compress/Deflate/Compress.luau"], +[65098, "src/Rosetta/codecs/compress/Deflate/Inflate.luau"], +[65546, "src/Rosetta/codecs/compress/Explode.luau"], +[65742, "src/Rosetta/codecs/compress/Lz4.luau"], +[66011, "src/Rosetta/codecs/compress/Lzh/init.luau"], +[66615, "src/Rosetta/codecs/compress/Lzma/init.luau"], +[67155, "src/Rosetta/codecs/compress/Lzma/Crc64.luau"], +[67222, "src/Rosetta/codecs/compress/Lzma/Decode.luau"], +[67695, "src/Rosetta/codecs/compress/Lzma/Filters.luau"], +[67871, "src/Rosetta/codecs/compress/Lzw/init.luau"], +[68139, "src/Rosetta/codecs/compress/Lzx.luau"], +[68573, "src/Rosetta/codecs/compress/PackBits.luau"], +[68663, "src/Rosetta/codecs/compress/Quantum.luau"], +[68900, "src/Rosetta/codecs/compress/UnixCompress.luau"], +[69204, "src/Rosetta/codecs/compress/Xxh32.luau"], +[69273, "src/Rosetta/codecs/compress/Zstd/init.luau"], +[69330, "src/Rosetta/codecs/compress/Zstd/Decode.luau"], +[70314, "src/Rosetta/codecs/compress/Zstd/Xxh64.luau"], +[70466, "src/Rosetta/codecs/entropy/Huffman.luau"], +[70753, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], +[70764, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], +[70985, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.luau"], +[71229, "src/Rosetta/codecs/font/Bitmap.luau"], +[71430, "src/Rosetta/codecs/font/Cff/init.luau"], +[72071, "src/Rosetta/codecs/font/GlyphNames.luau"], +[72221, "src/Rosetta/codecs/font/TrueType/init.luau"], +[72535, "src/Rosetta/codecs/font/TrueType/Glyf.luau"], +[72927, "src/Rosetta/codecs/font/TrueType/Tables.luau"], +[73429, "src/Rosetta/codecs/image/Bcn/init.luau"], +[73536, "src/Rosetta/codecs/image/Bcn/Decode.luau"], +[74020, "src/Rosetta/codecs/image/Bcn/Encode.luau"], +[74449, "src/Rosetta/codecs/image/Blend.luau"], +[74828, "src/Rosetta/codecs/image/Dct/init.luau"], +[75323, "src/Rosetta/codecs/image/Etc.luau"], +[75621, "src/Rosetta/codecs/image/Half.luau"], +[75690, "src/Rosetta/codecs/image/Jpeg/init.luau"], +[76044, "src/Rosetta/codecs/image/Jpeg/Arith.luau"], +[76452, "src/Rosetta/codecs/image/Jpeg/Color.luau"], +[76817, "src/Rosetta/codecs/image/Jpeg/Decode.luau"], +[77582, "src/Rosetta/codecs/image/Jpeg/Encode.luau"], +[78463, "src/Rosetta/codecs/image/Jpeg/Scan.luau"], +[78932, "src/Rosetta/codecs/image/Jpeg/Tables.luau"], +[79010, "src/Rosetta/codecs/image/Jpeg/Yuv.luau"], +[79077, "src/Rosetta/codecs/image/Miptex.luau"], +[79377, "src/Rosetta/codecs/image/Pixels.luau"], +[79697, "src/Rosetta/codecs/image/Quantize/init.luau"], +[80158, "src/Rosetta/codecs/image/Raster.luau"], +[80855, "src/Rosetta/codecs/image/Texel.luau"], +[81228, "src/Rosetta/codecs/image/Texture.luau"], +[81373, "src/Rosetta/codecs/image/Vp8/init.luau"], +[81515, "src/Rosetta/codecs/image/Vp8/Decode.luau"], +[83495, "src/Rosetta/codecs/image/Vp8/Predict.luau"], +[83758, "src/Rosetta/codecs/image/Vp8/Tables.luau"], +[84008, "src/Rosetta/codecs/image/Vp8/Yuv.luau"], +[84150, "src/Rosetta/codecs/image/Vp8L/init.luau"], +[84254, "src/Rosetta/codecs/image/Vp8L/Decode.luau"], +[85194, "src/Rosetta/codecs/image/Vp8L/Encode.luau"], +[86146, "src/Rosetta/codecs/image/Yuv.luau"], +[86467, "src/Rosetta/codecs/model/Brush.luau"], +[87107, "src/Rosetta/codecs/model/Displacement.luau"], +[87256, "src/Rosetta/codecs/model/DoomMap/init.luau"], +[87701, "src/Rosetta/codecs/model/DoomMap/Udmf.luau"], +[87951, "src/Rosetta/codecs/model/Draco/init.luau"], +[88283, "src/Rosetta/codecs/model/Draco/Attributes.luau"], +[88752, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], +[89941, "src/Rosetta/codecs/model/Draco/Int64.luau"], +[90090, "src/Rosetta/codecs/model/Draco/KdTree.luau"], +[90449, "src/Rosetta/codecs/model/Draco/Predict.luau"], +[91411, "src/Rosetta/codecs/model/Draco/Reader.luau"], +[91885, "src/Rosetta/codecs/model/Mat4.luau"], +[92144, "src/Rosetta/codecs/model/MeshFlatten.luau"], +[92672, "src/Rosetta/codecs/model/Minecraft/init.luau"], +[93224, "src/Rosetta/codecs/model/Minecraft/Colors.luau"], +[93303, "src/Rosetta/codecs/model/Minecraft/Legacy.luau"], +[93410, "src/Rosetta/codecs/model/Minecraft/Packed.luau"], +[93616, "src/Rosetta/codecs/model/Patch.luau"], +[93740, "src/Rosetta/codecs/model/Polygon.luau"], +[93974, "src/Rosetta/codecs/model/Rbx/init.luau"], +[94211, "src/Rosetta/codecs/model/Rbx/Binary.luau"], +[94965, "src/Rosetta/codecs/model/Rig.luau"], +[95208, "src/Rosetta/codecs/model/Sampler.luau"], +[95368, "src/Rosetta/codecs/model/SourceAnim.luau"], +[95589, "src/Rosetta/codecs/model/Vrml/init.luau"], +[95737, "src/Rosetta/codecs/model/Vrml/Build.luau"], +[96311, "src/Rosetta/codecs/model/Vrml/Fields.luau"], +[96474, "src/Rosetta/codecs/model/Vrml/Geometry.luau"], +[97223, "src/Rosetta/codecs/model/Vrml/Parse.luau"], +[97745, "src/Rosetta/codecs/model/Vrml/Write.luau"], +[98472, "src/Rosetta/codecs/model/Vrml/Xml.luau"], +[98704, "src/Rosetta/codecs/text/GodotVariant.luau"], +[99363, "src/Rosetta/codecs/text/Json/init.luau"], +[99632, "src/Rosetta/codecs/text/Json/Decode.luau"], +[100067, "src/Rosetta/codecs/text/Json/Encode.luau"], +[100412, "src/Rosetta/codecs/text/KeyValues/init.luau"], +[100982, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], +[101288, "src/Rosetta/codecs/text/Lexer/init.luau"], +[101420, "src/Rosetta/codecs/text/Nbt/init.luau"], +[101773, "src/Rosetta/codecs/text/Nbt/Binary.luau"], +[102465, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], +[103105, "src/Rosetta/codecs/text/Nbt/Value.luau"], +[103343, "src/Rosetta/codecs/text/Text/init.luau"], +[103434, "src/Rosetta/codecs/text/Url/init.luau"], +[103639, "src/Rosetta/codecs/text/Xml/init.luau"], +[104089, "src/Rosetta/codecs/text/Xml/Parse.luau"], +[104893, "src/Rosetta/codecs/video/Dsp.luau"], +[105731, "src/Rosetta/codecs/video/H263/init.luau"], +[105888, "src/Rosetta/codecs/video/H263/Decoder.luau"], +[106746, "src/Rosetta/codecs/video/H263/Tables.luau"], +[106950, "src/Rosetta/codecs/video/H264/init.luau"], +[107340, "src/Rosetta/codecs/video/H264/Bitstream.luau"], +[107615, "src/Rosetta/codecs/video/H264/Cabac.luau"], +[108746, "src/Rosetta/codecs/video/H264/Cavlc.luau"], +[109514, "src/Rosetta/codecs/video/H264/Deblock.luau"], +[109776, "src/Rosetta/codecs/video/H264/Decoder.luau"], +[110842, "src/Rosetta/codecs/video/H264/Inter.luau"], +[111168, "src/Rosetta/codecs/video/H264/Intra.luau"], +[111575, "src/Rosetta/codecs/video/H264/Mb.luau"], +[112529, "src/Rosetta/codecs/video/H264/Params.luau"], +[112977, "src/Rosetta/codecs/video/H264/Slice.luau"], +[113229, "src/Rosetta/codecs/video/H264/Tables.luau"], +[113271, "src/Rosetta/codecs/video/H264/Transform.luau"], +[113436, "src/Rosetta/codecs/video/Legacy/init.luau"], +[113635, "src/Rosetta/codecs/video/Legacy/Cinepak.luau"], +[113932, "src/Rosetta/codecs/video/Legacy/Flic.luau"], +[114299, "src/Rosetta/codecs/video/Legacy/Msvideo1.luau"], +[114417, "src/Rosetta/codecs/video/Legacy/Picture.luau"], +[114525, "src/Rosetta/codecs/video/Legacy/QtRle.luau"], +[114798, "src/Rosetta/codecs/video/Legacy/Smacker.luau"], +[115193, "src/Rosetta/codecs/video/Legacy/Smc.luau"], +[115370, "src/Rosetta/codecs/video/Mpeg1/init.luau"], +[115383, "src/Rosetta/codecs/video/Mpeg2/init.luau"], +[115757, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], +[117284, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], +[117424, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"], +[117563, "src/Rosetta/codecs/video/Theora/init.luau"], +[117827, "src/Rosetta/codecs/video/Theora/Decoder.luau"], +[119091, "src/Rosetta/codecs/video/Theora/Header.luau"], +[119455, "src/Rosetta/codecs/video/Video/init.luau"], +[120070, "src/Rosetta/codecs/video/Video/Disposable.luau"], +[120281, "src/Rosetta/codecs/video/Video/Pool.luau"], +[120333, "src/Rosetta/codecs/video/Video/Source.luau"], +[120619, "src/Rosetta/containers/Archive.luau"], +[120886, "src/Rosetta/containers/AudioWrap.luau"], +[121396, "src/Rosetta/containers/Avi/init.luau"], +[121949, "src/Rosetta/containers/Blend.luau"], +[122688, "src/Rosetta/containers/Chunks.luau"], +[122823, "src/Rosetta/containers/Cpio.luau"], +[123251, "src/Rosetta/containers/Demux.luau"], +[123537, "src/Rosetta/containers/Ebml/init.luau"], +[123851, "src/Rosetta/containers/Fat.luau"], +[124539, "src/Rosetta/containers/Iso9660.luau"], +[125044, "src/Rosetta/containers/IsoBmff/init.luau"], +[125215, "src/Rosetta/containers/IsoBmff/Box.luau"], +[125404, "src/Rosetta/containers/IsoBmff/Demux.luau"], +[126250, "src/Rosetta/containers/IsoBmff/Meta.luau"], +[126772, "src/Rosetta/containers/IsoBmff/Mux.luau"], +[127289, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], +[127407, "src/Rosetta/containers/MacFile.luau"], +[127556, "src/Rosetta/containers/MpegEs.luau"], +[127723, "src/Rosetta/containers/MpegPs/init.luau"], +[127944, "src/Rosetta/containers/MpegTs/init.luau"], +[128737, "src/Rosetta/containers/Ogg/init.luau"], +[129162, "src/Rosetta/containers/Ogg/Mux.luau"], +[129351, "src/Rosetta/containers/Ogg/Page.luau"], +[129517, "src/Rosetta/containers/Riff/init.luau"], +[129834, "src/Rosetta/containers/Tar.luau"], +[130248, "src/Rosetta/containers/Zip/init.luau"], +[130880, "src/Rosetta/core/Adler32.luau"], +[130940, "src/Rosetta/core/Base64.luau"], +[131168, "src/Rosetta/core/Bits.luau"], +[131461, "src/Rosetta/core/Bytes.luau"], +[131988, "src/Rosetta/core/Crc16.luau"], +[132040, "src/Rosetta/core/Crc32.luau"], +[132191, "src/Rosetta/core/Err.luau"], +[132273, "src/Rosetta/core/Input.luau"], +[132349, "src/Rosetta/core/Md5.luau"], +[132507, "src/Rosetta/core/Sniff.luau"], +[132536, "src/Rosetta/data/cbor/init.luau"], +[132635, "src/Rosetta/data/cbor/Codec.luau"], +[133204, "src/Rosetta/data/csv/init.luau"], +[133516, "src/Rosetta/data/ini/init.luau"], +[133762, "src/Rosetta/data/json/init.luau"], +[133854, "src/Rosetta/data/msgpack/init.luau"], +[133943, "src/Rosetta/data/msgpack/Codec.luau"], +[134385, "src/Rosetta/data/nbt/init.luau"], +[134444, "src/Rosetta/data/plist/init.luau"], +[134750, "src/Rosetta/data/plist/Binary.luau"], +[135017, "src/Rosetta/data/q3shader/init.luau"], +[135256, "src/Rosetta/data/q3skin/init.luau"], +[135352, "src/Rosetta/data/snbt/init.luau"], +[135415, "src/Rosetta/data/toml/init.luau"], +[135482, "src/Rosetta/data/toml/Decode.luau"], +[136110, "src/Rosetta/data/toml/Encode.luau"], +[136319, "src/Rosetta/data/tres/init.luau"], +[136464, "src/Rosetta/data/vdf/init.luau"], +[136565, "src/Rosetta/data/xml/init.luau"], +[136621, "src/Rosetta/data/yaml/init.luau"], +[136694, "src/Rosetta/data/yaml/Emit.luau"], +[136984, "src/Rosetta/data/yaml/Parse.luau"], +[138277, "src/Rosetta/font/bdf/init.luau"], +[138566, "src/Rosetta/font/bmfont/init.luau"], +[138993, "src/Rosetta/font/bmfont/Parse.luau"], +[139446, "src/Rosetta/font/eot/init.luau"], +[139678, "src/Rosetta/font/fon/init.luau"], +[139961, "src/Rosetta/font/hershey/init.luau"], +[140156, "src/Rosetta/font/pcf/init.luau"], +[140436, "src/Rosetta/font/psf/init.luau"], +[140756, "src/Rosetta/font/ttf/init.luau"], +[140807, "src/Rosetta/font/type1/init.luau"], +[141166, "src/Rosetta/font/type1/Charstring.luau"], +[141444, "src/Rosetta/font/woff/init.luau"], +[141576, "src/Rosetta/font/woff2/init.luau"], +[141633, "src/Rosetta/font/woff2/Rebuild.luau"], +[142173, "src/Rosetta/host/init.luau"], +[142218, "src/Rosetta/host/Love.luau"], +[142361, "src/Rosetta/host/LuaJIT.luau"], +[142411, "src/Rosetta/host/Luau.luau"], +[142434, "src/Rosetta/host/Roblox.luau"], +[142793, "src/Rosetta/image/ani/init.luau"], +[142973, "src/Rosetta/image/art/init.luau"], +[143461, "src/Rosetta/image/blp/init.luau"], +[143719, "src/Rosetta/image/bmp/init.luau"], +[144134, "src/Rosetta/image/dds/init.luau"], +[144617, "src/Rosetta/image/exr/init.luau"], +[145377, "src/Rosetta/image/exr/Codec.luau"], +[145488, "src/Rosetta/image/exr/Piz.luau"], +[145845, "src/Rosetta/image/gif/init.luau"], +[146361, "src/Rosetta/image/gif/Decode.luau"], +[146437, "src/Rosetta/image/hdr/init.luau"], +[146666, "src/Rosetta/image/hdr/Codec.luau"], +[146877, "src/Rosetta/image/icns/init.luau"], +[147208, "src/Rosetta/image/ico/init.luau"], +[147485, "src/Rosetta/image/ico/Dib.luau"], +[147580, "src/Rosetta/image/ilbm/init.luau"], +[147899, "src/Rosetta/image/jpeg/init.luau"], +[148035, "src/Rosetta/image/ktx/init.luau"], +[148695, "src/Rosetta/image/lmp/init.luau"], +[148828, "src/Rosetta/image/pcx/init.luau"], +[149092, "src/Rosetta/image/png/init.luau"], +[149672, "src/Rosetta/image/png/Apng.luau"], +[149752, "src/Rosetta/image/png/Decode.luau"], +[150125, "src/Rosetta/image/png/Encode.luau"], +[150328, "src/Rosetta/image/pnm/init.luau"], +[150706, "src/Rosetta/image/pnm/Codec.luau"], +[150983, "src/Rosetta/image/qoi/init.luau"], +[151105, "src/Rosetta/image/qoi/Codec.luau"], +[151262, "src/Rosetta/image/sgi/init.luau"], +[151547, "src/Rosetta/image/spr/init.luau"], +[151860, "src/Rosetta/image/sunras/init.luau"], +[152106, "src/Rosetta/image/tga/init.luau"], +[152376, "src/Rosetta/image/tga/Codec.luau"], +[152576, "src/Rosetta/image/tiff/init.luau"], +[153403, "src/Rosetta/image/tiff/Pixels.luau"], +[153793, "src/Rosetta/image/tim/init.luau"], +[154035, "src/Rosetta/image/vtf/init.luau"], +[154270, "src/Rosetta/image/webp/init.luau"], +[154880, "src/Rosetta/image/webp/Alpha.luau"], +[154956, "src/Rosetta/image/webp/Anim.luau"], +[155111, "src/Rosetta/image/xbm/init.luau"], +[155272, "src/Rosetta/image/xpm/init.luau"], +[155540, "src/Rosetta/image/xpm/Names.luau"], +[155596, "src/Rosetta/layered/aseprite/init.luau"], +[156334, "src/Rosetta/layered/ora/init.luau"], +[156621, "src/Rosetta/layered/psd/init.luau"], +[157356, "src/Rosetta/layered/psd/Channels.luau"], +[157708, "src/Rosetta/model/3ds/init.luau"], +[157791, "src/Rosetta/model/3ds/Build.luau"], +[158438, "src/Rosetta/model/3ds/Read.luau"], +[158934, "src/Rosetta/model/3ds/Write.luau"], +[159739, "src/Rosetta/model/3mf/init.luau"], +[159821, "src/Rosetta/model/3mf/Read.luau"], +[160409, "src/Rosetta/model/3mf/Write.luau"], +[160814, "src/Rosetta/model/ase/init.luau"], +[160937, "src/Rosetta/model/ase/Build.luau"], +[161511, "src/Rosetta/model/ase/Parse.luau"], +[161580, "src/Rosetta/model/ase/Write.luau"], +[162043, "src/Rosetta/model/b3d/init.luau"], +[162098, "src/Rosetta/model/b3d/Read.luau"], +[162669, "src/Rosetta/model/blend/init.luau"], +[162765, "src/Rosetta/model/blend/Anim.luau"], +[163111, "src/Rosetta/model/blend/Material.luau"], +[163463, "src/Rosetta/model/blend/Mesh.luau"], +[164098, "src/Rosetta/model/blend/Normals.luau"], +[164259, "src/Rosetta/model/blend/Prim.luau"], +[164708, "src/Rosetta/model/blend/Read.luau"], +[165608, "src/Rosetta/model/bsp/init.luau"], +[165799, "src/Rosetta/model/bsp/Lightmap.luau"], +[165865, "src/Rosetta/model/bsp/Quake.luau"], +[166254, "src/Rosetta/model/bsp/Quake3.luau"], +[166483, "src/Rosetta/model/bsp/Tree.luau"], +[166871, "src/Rosetta/model/buildmap/init.luau"], +[167143, "src/Rosetta/model/buildmap/Geometry.luau"], +[167546, "src/Rosetta/model/d3map/init.luau"], +[167828, "src/Rosetta/model/d3map/Parse.luau"], +[168026, "src/Rosetta/model/dae/init.luau"], +[168215, "src/Rosetta/model/dae/Math.luau"], +[168262, "src/Rosetta/model/dae/Read.luau"], +[170112, "src/Rosetta/model/dae/Write.luau"], +[170481, "src/Rosetta/model/fbx/init.luau"], +[170629, "src/Rosetta/model/fbx/Ascii.luau"], +[170899, "src/Rosetta/model/fbx/Binary.luau"], +[171354, "src/Rosetta/model/fbx/Read.luau"], +[172716, "src/Rosetta/model/fbx/Write.luau"], +[173701, "src/Rosetta/model/fbx/Xform.luau"], +[173742, "src/Rosetta/model/gltf/init.luau"], +[173979, "src/Rosetta/model/gltf/Pack.luau"], +[174048, "src/Rosetta/model/gltf/Read.luau"], +[174779, "src/Rosetta/model/gltf/Write.luau"], +[175459, "src/Rosetta/model/godot/init.luau"], +[175550, "src/Rosetta/model/godot/Build.luau"], +[176092, "src/Rosetta/model/godot/Primitives.luau"], +[176367, "src/Rosetta/model/godot/Surface.luau"], +[176852, "src/Rosetta/model/godot/Write.luau"], +[177181, "src/Rosetta/model/iqm/init.luau"], +[177257, "src/Rosetta/model/iqm/Read.luau"], +[177612, "src/Rosetta/model/iqm/Write.luau"], +[178299, "src/Rosetta/model/ldraw/init.luau"], +[178377, "src/Rosetta/model/ldraw/Colors.luau"], +[178695, "src/Rosetta/model/ldraw/Read.luau"], +[179272, "src/Rosetta/model/lwo/init.luau"], +[179348, "src/Rosetta/model/lwo/Build.luau"], +[179810, "src/Rosetta/model/lwo/Parse.luau"], +[180353, "src/Rosetta/model/map/init.luau"], +[180670, "src/Rosetta/model/map/Build.luau"], +[180914, "src/Rosetta/model/map/Parse.luau"], +[181299, "src/Rosetta/model/map/Write.luau"], +[181445, "src/Rosetta/model/mca/init.luau"], +[181787, "src/Rosetta/model/mca/Chunk.luau"], +[181920, "src/Rosetta/model/mca/Lz4Block.luau"], +[181990, "src/Rosetta/model/md2/init.luau"], +[182189, "src/Rosetta/model/md3/init.luau"], +[182417, "src/Rosetta/model/md5/init.luau"], +[182498, "src/Rosetta/model/md5/Read.luau"], +[182931, "src/Rosetta/model/mdl/init.luau"], +[183013, "src/Rosetta/model/mdl/HalfLife.luau"], +[183317, "src/Rosetta/model/mdl/Quake.luau"], +[183535, "src/Rosetta/model/ms3d/init.luau"], +[183607, "src/Rosetta/model/ms3d/Read.luau"], +[184053, "src/Rosetta/model/ms3d/Write.luau"], +[184522, "src/Rosetta/model/obj/init.luau"], +[185340, "src/Rosetta/model/obj/Mtl.luau"], +[185628, "src/Rosetta/model/off/init.luau"], +[186090, "src/Rosetta/model/ply/init.luau"], +[187195, "src/Rosetta/model/ply/Binary.luau"], +[187396, "src/Rosetta/model/pmx/init.luau"], +[187465, "src/Rosetta/model/pmx/Build.luau"], +[187761, "src/Rosetta/model/pmx/Pmd.luau"], +[188096, "src/Rosetta/model/pmx/Read.luau"], +[188500, "src/Rosetta/model/proc/init.luau"], +[188882, "src/Rosetta/model/qb/init.luau"], +[189275, "src/Rosetta/model/rbxm/init.luau"], +[189868, "src/Rosetta/model/rbxmx/init.luau"], +[190544, "src/Rosetta/model/robloxmesh/init.luau"], +[191203, "src/Rosetta/model/robloxmesh/Parse.luau"], +[191660, "src/Rosetta/model/robloxmesh/Write.luau"], +[191769, "src/Rosetta/model/schematic/init.luau"], +[192090, "src/Rosetta/model/schematic/Common.luau"], +[192210, "src/Rosetta/model/schematic/Litematic.luau"], +[192421, "src/Rosetta/model/schematic/Mcedit.luau"], +[192665, "src/Rosetta/model/schematic/Sponge.luau"], +[192794, "src/Rosetta/model/smd/init.luau"], +[192861, "src/Rosetta/model/smd/Read.luau"], +[193130, "src/Rosetta/model/smd/Write.luau"], +[193373, "src/Rosetta/model/sourcemdl/init.luau"], +[193544, "src/Rosetta/model/sourcemdl/Build.luau"], +[193974, "src/Rosetta/model/sourcemdl/Material.luau"], +[194135, "src/Rosetta/model/sourcemdl/Mdl.luau"], +[194662, "src/Rosetta/model/sourcemdl/Phy.luau"], +[194785, "src/Rosetta/model/sourcemdl/Vtx.luau"], +[194967, "src/Rosetta/model/sourcemdl/Vvd.luau"], +[195061, "src/Rosetta/model/stl/init.luau"], +[195511, "src/Rosetta/model/stl/Decode.luau"], +[195585, "src/Rosetta/model/t3d/init.luau"], +[195679, "src/Rosetta/model/t3d/Build.luau"], +[196084, "src/Rosetta/model/t3d/Parse.luau"], +[196252, "src/Rosetta/model/udmf/init.luau"], +[196335, "src/Rosetta/model/usda/init.luau"], +[196544, "src/Rosetta/model/usda/Build.luau"], +[197822, "src/Rosetta/model/usda/Parse.luau"], +[198620, "src/Rosetta/model/usda/Write.luau"], +[199437, "src/Rosetta/model/vbsp/init.luau"], +[199883, "src/Rosetta/model/vbsp/Faces.luau"], +[200107, "src/Rosetta/model/vbsp/Props.luau"], +[200199, "src/Rosetta/model/vmf/init.luau"], +[200524, "src/Rosetta/model/vmf/Build.luau"], +[200948, "src/Rosetta/model/vox/init.luau"], +[201834, "src/Rosetta/model/vox/Grid.luau"], +[201891, "src/Rosetta/model/vrml/init.luau"], +[201957, "src/Rosetta/model/x/init.luau"], +[202087, "src/Rosetta/model/x/Build.luau"], +[202650, "src/Rosetta/model/x/Parse.luau"], +[202947, "src/Rosetta/model/x3d/init.luau"], +[203025, "src/Rosetta/music/669/init.luau"], +[203232, "src/Rosetta/music/ahx/init.luau"], +[203284, "src/Rosetta/music/far/init.luau"], +[203514, "src/Rosetta/music/hmp/init.luau"], +[203779, "src/Rosetta/music/hvl/init.luau"], +[203831, "src/Rosetta/music/it/init.luau"], +[204250, "src/Rosetta/music/it/Itsex.luau"], +[204367, "src/Rosetta/music/med/init.luau"], +[205015, "src/Rosetta/music/midi/init.luau"], +[205159, "src/Rosetta/music/midi/Smf.luau"], +[205571, "src/Rosetta/music/mod/init.luau"], +[205925, "src/Rosetta/music/mtm/init.luau"], +[206148, "src/Rosetta/music/mus/init.luau"], +[206306, "src/Rosetta/music/okt/init.luau"], +[206588, "src/Rosetta/music/ptm/init.luau"], +[206811, "src/Rosetta/music/s3m/init.luau"], +[207048, "src/Rosetta/music/sf2/init.luau"], +[207092, "src/Rosetta/music/stm/init.luau"], +[207324, "src/Rosetta/music/ult/init.luau"], +[207629, "src/Rosetta/music/umx/init.luau"], +[207846, "src/Rosetta/music/xm/init.luau"], +[208408, "src/Rosetta/music/xmi/init.luau"], +[208617, "src/Rosetta/ops/AudioOps.luau"], +[209096, "src/Rosetta/ops/ImageOps/init.luau"], +[209744, "src/Rosetta/ops/ImageOps/Kernels.luau"], +[210384, "src/Rosetta/ops/LayerOps.luau"], +[210477, "src/Rosetta/ops/MeshOps/init.luau"], +[211529, "src/Rosetta/ops/MeshOps/Greedy.luau"], +[211696, "src/Rosetta/ops/MusicOps.luau"], +[212045, "src/Rosetta/playlist/m3u/init.luau"], +[212398, "src/Rosetta/playlist/pls/init.luau"], +[212576, "src/Rosetta/playlist/xspf/init.luau"], +[212779, "src/Rosetta/subtitle/ass/init.luau"], +[213223, "src/Rosetta/subtitle/srt/init.luau"], +[213396, "src/Rosetta/subtitle/vtt/init.luau"], +[213599, "src/Rosetta/vector/gamemaps/init.luau"], +[213786, "src/Rosetta/vector/gamemaps/Expand.luau"], +[213883, "src/Rosetta/vector/ldtk/init.luau"], +[213975, "src/Rosetta/vector/ldtk/Read.luau"], +[214311, "src/Rosetta/vector/ldtk/Write.luau"], +[214959, "src/Rosetta/vector/ogmo/init.luau"], +[215078, "src/Rosetta/vector/ogmo/Read.luau"], +[215483, "src/Rosetta/vector/ogmo/Write.luau"], +[215837, "src/Rosetta/vector/svg/init.luau"], +[215923, "src/Rosetta/vector/svg/Parse.luau"], +[216669, "src/Rosetta/vector/svg/PathData.luau"], +[217037, "src/Rosetta/vector/svg/Render.luau"], +[217454, "src/Rosetta/vector/svg/Style.luau"], +[217826, "src/Rosetta/vector/svg/Write.luau"], +[218026, "src/Rosetta/vector/tiled/init.luau"], +[218206, "src/Rosetta/vector/tiled/Data.luau"], +[218357, "src/Rosetta/vector/tiled/Tmj.luau"], +[218988, "src/Rosetta/vector/tiled/Tmx.luau"], +[219600, "src/Rosetta/video/avi/init.luau"], +[219894, "src/Rosetta/video/fli/init.luau"], +[220045, "src/Rosetta/video/flv/init.luau"], +[220429, "src/Rosetta/video/flv/Amf.luau"], +[220587, "src/Rosetta/video/flv/Mux.luau"], +[220868, "src/Rosetta/video/h264/init.luau"], +[221007, "src/Rosetta/video/mkv/init.luau"], +[221163, "src/Rosetta/video/mkv/Mux.luau"], +[221442, "src/Rosetta/video/mkv/Parse.luau"], +[222163, "src/Rosetta/video/mp4/init.luau"], +[222491, "src/Rosetta/video/mpegps/init.luau"], +[222678, "src/Rosetta/video/mpegts/init.luau"], +[222924, "src/Rosetta/video/ogv/init.luau"], +[223319, "src/Rosetta/video/smk/init.luau"], +[223628, "src/Rosetta/video/smk/Audio.luau"], +[223748, "src/Rosetta/video/y4m/init.luau"] ] diff --git a/build/Rosetta.rbxm b/build/Rosetta.rbxm index 16cf34f..c685b97 100644 Binary files a/build/Rosetta.rbxm and b/build/Rosetta.rbxm differ diff --git a/build/Rosetta.rbxm.linemap.json b/build/Rosetta.rbxm.linemap.json index 5b5ef9a..0917eaf 100644 --- a/build/Rosetta.rbxm.linemap.json +++ b/build/Rosetta.rbxm.linemap.json @@ -1,6 +1,6 @@ { -"Core_1": [[8, "src/Rosetta/init.luau"], [892, "src/Rosetta/Registry.luau"], [3301, "src/Rosetta/Types.luau"], [4418, "src/Rosetta/codecs/audio/Adpcm/init.luau"], [5172, "src/Rosetta/codecs/image/Yuv.luau"], [5493, "src/Rosetta/codecs/model/Rbx/init.luau"], [5730, "src/Rosetta/codecs/video/Video/init.luau"], [6345, "src/Rosetta/codecs/video/Video/Disposable.luau"], [6556, "src/Rosetta/codecs/video/Video/Pool.luau"], [6608, "src/Rosetta/containers/AudioWrap.luau"], [7118, "src/Rosetta/containers/Ogg/Mux.luau"], [7307, "src/Rosetta/core/Bytes.luau"]], -"Core_2": [[8, "src/Rosetta/core/Crc32.luau"], [159, "src/Rosetta/core/Err.luau"], [241, "src/Rosetta/core/Input.luau"], [317, "src/Rosetta/host/init.luau"], [362, "src/Rosetta/ops/ImageOps/init.luau"], [1010, "src/Rosetta/ops/ImageOps/Kernels.luau"]], +"Core_1": [[8, "src/Rosetta/init.luau"], [925, "src/Rosetta/Registry.luau"], [3542, "src/Rosetta/Types.luau"], [4659, "src/Rosetta/codecs/audio/Adpcm/init.luau"], [5413, "src/Rosetta/codecs/image/Yuv.luau"], [5734, "src/Rosetta/codecs/model/Rbx/init.luau"], [5971, "src/Rosetta/codecs/video/Video/init.luau"], [6586, "src/Rosetta/codecs/video/Video/Disposable.luau"], [6797, "src/Rosetta/codecs/video/Video/Pool.luau"], [6849, "src/Rosetta/containers/AudioWrap.luau"], [7359, "src/Rosetta/containers/Ogg/Mux.luau"]], +"Core_2": [[8, "src/Rosetta/core/Bytes.luau"], [535, "src/Rosetta/core/Crc32.luau"], [686, "src/Rosetta/core/Err.luau"], [768, "src/Rosetta/core/Input.luau"], [844, "src/Rosetta/host/init.luau"], [889, "src/Rosetta/ops/ImageOps/init.luau"], [1537, "src/Rosetta/ops/ImageOps/Kernels.luau"]], "Mpeg2": [[8, "src/Rosetta/codecs/video/Dsp.luau"], [846, "src/Rosetta/codecs/video/Mpeg1/init.luau"], [859, "src/Rosetta/codecs/video/Mpeg2/init.luau"], [1233, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], [2760, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], [2900, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"]], "H263": [[8, "src/Rosetta/codecs/video/H263/init.luau"], [165, "src/Rosetta/codecs/video/H263/Decoder.luau"], [1023, "src/Rosetta/codecs/video/H263/Tables.luau"]], "H264": [[8, "src/Rosetta/codecs/video/H264/init.luau"], [398, "src/Rosetta/codecs/video/H264/Bitstream.luau"], [673, "src/Rosetta/codecs/video/H264/Cabac.luau"], [1804, "src/Rosetta/codecs/video/H264/Cavlc.luau"], [2572, "src/Rosetta/codecs/video/H264/Deblock.luau"], [2834, "src/Rosetta/codecs/video/H264/Decoder.luau"], [3900, "src/Rosetta/codecs/video/H264/Inter.luau"], [4226, "src/Rosetta/codecs/video/H264/Intra.luau"], [4633, "src/Rosetta/codecs/video/H264/Mb.luau"], [5587, "src/Rosetta/codecs/video/H264/Params.luau"], [6035, "src/Rosetta/codecs/video/H264/Slice.luau"], [6287, "src/Rosetta/codecs/video/H264/Tables.luau"], [6329, "src/Rosetta/codecs/video/H264/Transform.luau"]], @@ -27,6 +27,7 @@ "Hively": [[8, "src/Rosetta/codecs/audio/Hively/init.luau"], [205, "src/Rosetta/codecs/audio/Hively/Load.luau"], [455, "src/Rosetta/codecs/audio/Hively/Player.luau"], [1414, "src/Rosetta/codecs/audio/Hively/Tables.luau"]], "SoundFont": [[8, "src/Rosetta/codecs/audio/SoundFont/init.luau"], [63, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], [207, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], [721, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"]], "Draco": [[8, "src/Rosetta/codecs/model/Draco/init.luau"], [340, "src/Rosetta/codecs/model/Draco/Attributes.luau"], [809, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], [1998, "src/Rosetta/codecs/model/Draco/Int64.luau"], [2147, "src/Rosetta/codecs/model/Draco/KdTree.luau"], [2506, "src/Rosetta/codecs/model/Draco/Predict.luau"], [3468, "src/Rosetta/codecs/model/Draco/Reader.luau"]], +"Root": [[8, "src/Rosetta/Sniffs.luau"]], "archive_1": [[8, "src/Rosetta/archive/7z/init.luau"], [393, "src/Rosetta/archive/7z/Header.luau"], [920, "src/Rosetta/archive/adf/init.luau"], [1202, "src/Rosetta/archive/applesingle/init.luau"], [1388, "src/Rosetta/archive/ar/init.luau"], [1791, "src/Rosetta/archive/arj/init.luau"], [2001, "src/Rosetta/archive/binhex/init.luau"], [2250, "src/Rosetta/archive/br/init.luau"], [2325, "src/Rosetta/archive/bz2/init.luau"], [2389, "src/Rosetta/archive/cab/init.luau"], [2802, "src/Rosetta/archive/cab/Sum.luau"], [2843, "src/Rosetta/archive/cpio/init.luau"], [3011, "src/Rosetta/archive/d64/init.luau"], [3425, "src/Rosetta/archive/fat/init.luau"], [3547, "src/Rosetta/archive/grp/init.luau"], [3661, "src/Rosetta/archive/gzip/init.luau"], [3846, "src/Rosetta/archive/iso/init.luau"], [3918, "src/Rosetta/archive/lha/init.luau"], [4343, "src/Rosetta/archive/lz4/init.luau"], [4687, "src/Rosetta/archive/macbinary/init.luau"], [4885, "src/Rosetta/archive/mpq/init.luau"], [5291, "src/Rosetta/archive/mpq/Crypt.luau"], [5356, "src/Rosetta/archive/pak/init.luau"], [5490, "src/Rosetta/archive/rpm/init.luau"], [5814, "src/Rosetta/archive/tar/init.luau"], [5932, "src/Rosetta/archive/unitypackage/init.luau"], [6168, "src/Rosetta/archive/uu/init.luau"], [6438, "src/Rosetta/archive/vpk/init.luau"], [6749, "src/Rosetta/archive/vswap/init.luau"], [7019, "src/Rosetta/archive/wad/init.luau"], [7473, "src/Rosetta/archive/wad/Picture.luau"], [7575, "src/Rosetta/archive/wad2/init.luau"], [7857, "src/Rosetta/archive/xz/init.luau"]], "archive_2": [[8, "src/Rosetta/archive/yenc/init.luau"], [280, "src/Rosetta/archive/z/init.luau"], [376, "src/Rosetta/archive/zip/init.luau"], [595, "src/Rosetta/archive/zoo/init.luau"], [791, "src/Rosetta/archive/zst/init.luau"]], "audio": [[8, "src/Rosetta/audio/aac/init.luau"], [221, "src/Rosetta/audio/ac3/init.luau"], [368, "src/Rosetta/audio/adpcm/init.luau"], [514, "src/Rosetta/audio/adx/init.luau"], [746, "src/Rosetta/audio/aiff/init.luau"], [1138, "src/Rosetta/audio/ape/init.luau"], [1267, "src/Rosetta/audio/au/init.luau"], [1429, "src/Rosetta/audio/brstm/init.luau"], [1721, "src/Rosetta/audio/caf/init.luau"], [2388, "src/Rosetta/audio/flac/init.luau"], [2537, "src/Rosetta/audio/flac/Meta.luau"], [2759, "src/Rosetta/audio/flac/Stream.luau"], [3129, "src/Rosetta/audio/m4a/init.luau"], [3472, "src/Rosetta/audio/mp3/init.luau"], [3733, "src/Rosetta/audio/mp3/Index.luau"], [3924, "src/Rosetta/audio/mp3/Stream.luau"], [4151, "src/Rosetta/audio/mp3/Tags.luau"], [4463, "src/Rosetta/audio/mpc/init.luau"], [4558, "src/Rosetta/audio/opus/init.luau"], [4937, "src/Rosetta/audio/opus/Encode.luau"], [5049, "src/Rosetta/audio/qoa/init.luau"], [5230, "src/Rosetta/audio/tta/init.luau"], [5349, "src/Rosetta/audio/vag/init.luau"], [5573, "src/Rosetta/audio/voc/init.luau"], [5849, "src/Rosetta/audio/vorbis/init.luau"], [6304, "src/Rosetta/audio/vorbis/Encode.luau"], [7117, "src/Rosetta/audio/wav/init.luau"], [7738, "src/Rosetta/audio/wav/Codecs.luau"], [7917, "src/Rosetta/audio/wavpack/init.luau"]], diff --git a/build/Rosetta.rbxmx b/build/Rosetta.rbxmx index fdaacb6..6f2a603 100644 --- a/build/Rosetta.rbxmx +++ b/build/Rosetta.rbxmx @@ -20,7 +20,7 @@ local __CHUNK = { ["codecs/video/Video/Pool"] = "Core_1", ["containers/AudioWrap"] = "Core_1", ["containers/Ogg/Mux"] = "Core_1", - ["core/Bytes"] = "Core_1", + ["core/Bytes"] = "Core_2", ["core/Crc32"] = "Core_2", ["core/Err"] = "Core_2", ["core/Input"] = "Core_2", @@ -162,6 +162,7 @@ local __CHUNK = { ["codecs/model/Draco/KdTree"] = "Draco", ["codecs/model/Draco/Predict"] = "Draco", ["codecs/model/Draco/Reader"] = "Draco", + ["Sniffs"] = "Root", ["archive/7z"] = "archive_1", ["archive/7z/Header"] = "archive_1", ["archive/adf"] = "archive_1", @@ -682,7 +683,7 @@ return Rosetta --!optimize 2 --!nocheck -- rosetta chunk Core_1 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 12 modules (4 native: @native); the Rosetta root requires it when one of them is first included. +-- 11 modules (3 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES[""] = function() @@ -766,6 +767,56 @@ end local LATE: { [string]: number } = { br = 0.3 } -- archive/br: a trial decode of up to 256 KB +-- detection order: by the cost of a sniff (Registry.sniff: Sniffs.luau, Sniffs.luau reaching a codec, the format +-- module), then registry order; the costly LATE sniffs last +local order: { number }? = nil +local byExt: { [string]: { number } } = {} +local Sniffs: { [string]: (any) -> number }? = nil + +local function sniffOrder(): { number } + local o = order + if o then + return o + end + local list: { number } = {} + for idx, e in Registry do + table.insert(list, idx) + for _, x in e.extensions do + byExt[x] = byExt[x] or {} + table.insert(byExt[x], idx) + end + end + local function rank(idx: number): number + local e = Registry[idx] + return if LATE[e.name] then 3 else e.sniff + end + table.sort(list, function(a: number, b: number): boolean + local ra, rb = rank(a), rank(b) + if ra ~= rb then + return ra < rb + end + return a < b + end) + order = list + return list +end + +local function sniffer(e: Registry.Entry): ((any) -> number)? + if e.sniff < 2 then + local s = Sniffs + if not s then + s = __include("Sniffs") :: any + Sniffs = s + end + local f = (s :: { [string]: (any) -> number })[e.path] + if f then + return f + end + end + local m = module(e) + return if m and type(m.sniff) == "function" then m.sniff else nil +end + local function detect(buf: buffer, name: string?, category: string?, format: string?): (Registry.Entry?, Err.Err?) if format then local e = find(format, category) @@ -775,52 +826,35 @@ local function detect(buf: buffer, name: string?, category: string?, format: str return e, nil end local ext = Input.extension(name) + local list = sniffOrder() + local hits = if ext then byExt[ext] else nil local best: Registry.Entry? = nil local bestScore, bestIdx = 0, 0 - -- sniffs score 0..1 (core/Sniff); the extension's format scoring 1 cannot be beaten. Formats with a costly sniff - -- (LATE: the most they score) run last, and only when they could still win; ties go to registry order. - local late: { number }? = nil - for idx, e in Registry do - if inCategory(e, category) and (e.caps.decode or e.caps.open) then - local cap = LATE[e.name] - if cap then - late = late or {} - table.insert(late :: { number }, idx) - continue - end - local m = module(e) - if m and m.sniff then - local ok, score = pcall(m.sniff, Bytes.reader(buf)) - if ok and type(score) == "number" and score > 0 then - local extHit = ext and table.find(e.extensions, ext) - if extHit then - score += 0.01 -- ties go to the extension - end - if score > bestScore then - best, bestScore, bestIdx = e, score, idx - if extHit and score >= 1.01 then - return e, nil - end - end + -- sniffs score 0..1 (core/Sniff), +0.01 for the extension's formats; the best wins, ties go to registry order. The + -- extension's formats run first, and a sniff runs only while its cap (1, or LATE) could still win. + for pass = 1, 2 do + local ids = if pass == 1 then hits else list + if ids then + for _, idx in ids do + if pass == 2 and bestScore > 1 then + break end - end - end - end - if late then - for _, idx in late do - local e = Registry[idx] - local extHit = ext and table.find(e.extensions, ext) - local cap = LATE[e.name] + (if extHit then 0.01 else 0) - if cap > bestScore or (cap == bestScore and idx < bestIdx) then - local m = module(e) - if m and m.sniff then - local ok, score = pcall(m.sniff, Bytes.reader(buf)) - if ok and type(score) == "number" and score > 0 then - if extHit then - score += 0.01 - end - if score > bestScore or (score == bestScore and idx < bestIdx) then - best, bestScore, bestIdx = e, score, idx + local e = Registry[idx] + local extHit = pass == 1 or (hits ~= nil and table.find(hits, idx) ~= nil) + if (pass == 1 or not extHit) and inCategory(e, category) and (e.caps.decode or e.caps.open) then + local cap = (LATE[e.name] or 1) + (if extHit then 0.01 else 0) + if cap > bestScore or (cap == bestScore and idx < bestIdx) then + local sniff = sniffer(e) + if sniff then + local ok, score = pcall(sniff, Bytes.reader(buf)) + if ok and type(score) == "number" and score > 0 then + if extHit then + score += 0.01 + end + if score > bestScore or (score == bestScore and idx < bestIdx) then + best, bestScore, bestIdx = e, score, idx + end + end end end end @@ -1384,7 +1418,7 @@ function F.detect(src: any, opts: Options?): (string?, Err.Err?) return nil, err end -- a format may name the file's flavour more precisely (video/mkv: "webm" for DocType webm) - local m = module(entry) + local m = if entry.variant then module(entry) else nil if m and type(m.variant) == "function" then local ok, v = pcall(m.variant, Bytes.reader(buf)) if ok and type(v) == "string" then @@ -1574,6 +1608,8 @@ __FILES["Registry"] = function() -- Registry: GENERATED by tools/gen_registry.py from the format folders - do not edit. -- One entry per format: the contract metadata (copied from its init.luau) and load(), which requires the format -- module on first use (a static require, as Roblox needs). Order: category, then name. +-- sniff: where detection finds the format's sniff (tools/sniff_extract.py): 0 Sniffs.luau, 1 Sniffs.luau reaching a +-- codec / container on first call, 2 the format module. variant: the module has variant(r). type Entry = { name: string, category: string, @@ -1582,6 +1618,8 @@ type Entry = { mime: { string }, deps: { string }, caps: { [string]: any }, + sniff: number, + variant: boolean?, load: () -> any, } @@ -1594,6 +1632,7 @@ local list: { Entry } = { mime = { "application/x-navi-animation" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Riff" }, caps = { decode = true, encode = true, alpha = true, animation = true, frames = true }, + sniff = 0, load = function() return __include("image/ani") end, @@ -1606,6 +1645,7 @@ local list: { Entry } = { mime = { "image/x-build-art" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels", "codecs/image/Quantize" }, caps = { decode = true, encode = true, alpha = true, palette = true, frames = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/art") end, @@ -1618,6 +1658,7 @@ local list: { Entry } = { mime = { "image/x-blp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Jpeg", "codecs/image/Bcn" }, caps = { decode = true, encode = true, alpha = true, variants = { "blp1", "blp2" }, compressions = { "jpeg", "palette", "dxt1", "dxt3", "dxt5", "bgra" } }, + sniff = 0, load = function() return __include("image/blp") end, @@ -1630,6 +1671,7 @@ local list: { Entry } = { mime = { "image/bmp", "image/x-bmp", "image/x-ms-bmp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, depths = { 1, 2, 4, 8, 16, 24, 32 }, rle = true }, + sniff = 0, load = function() return __include("image/bmp") end, @@ -1642,6 +1684,7 @@ local list: { Entry } = { mime = { "image/vnd-ms.dds", "image/x-dds" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Bcn", "codecs/image/Texel", "codecs/image/Texture" }, caps = { decode = true, encode = true, alpha = true, float = true, mipmaps = true, cubemap = true, compressed = { "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7" } }, + sniff = 0, load = function() return __include("image/dds") end, @@ -1654,6 +1697,7 @@ local list: { Entry } = { mime = { "image/x-exr", "image/aces" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Half", "codecs/compress/Deflate" }, caps = { decode = true, encode = true, alpha = true, float = true, hdr = true, depths = { 16, 32 }, multipart = true, tiled = true }, + sniff = 0, load = function() return __include("image/exr") end, @@ -1666,6 +1710,7 @@ local list: { Entry } = { mime = { "image/gif" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Lzw", "codecs/image/Quantize", "Types" }, caps = { decode = true, encode = true, animation = true, alpha = true, palette = true, depths = { 1, 2, 4, 8 } }, + sniff = 0, load = function() return __include("image/gif") end, @@ -1678,6 +1723,7 @@ local list: { Entry } = { mime = { "image/vnd.radiance", "image/x-hdr" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = false, float = true, depths = { 32 } }, + sniff = 0, load = function() return __include("image/hdr") end, @@ -1690,6 +1736,7 @@ local list: { Entry } = { mime = { "image/icns", "image/x-icns" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "containers/Chunks" }, caps = { decode = true, encode = true, alpha = true, frames = true, depths = { 1, 24, 32 } }, + sniff = 0, load = function() return __include("image/icns") end, @@ -1702,6 +1749,7 @@ local list: { Entry } = { mime = { "image/vnd.microsoft.icon", "image/x-icon" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, frames = true, depths = { 1, 4, 8, 16, 24, 32 } }, + sniff = 0, load = function() return __include("image/ico") end, @@ -1714,6 +1762,7 @@ local list: { Entry } = { mime = { "image/x-ilbm", "image/x-iff" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/compress/PackBits", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 2, 3, 4, 5, 6, 7, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/ilbm") end, @@ -1726,6 +1775,7 @@ local list: { Entry } = { mime = { "image/jpeg" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Jpeg" }, caps = { decode = true, encode = true, lossy = true, alpha = false, depths = { 8, 12 }, progressive = true, arithmetic = true }, + sniff = 0, load = function() return __include("image/jpeg") end, @@ -1738,6 +1788,7 @@ local list: { Entry } = { mime = { "image/ktx2", "image/ktx" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/compress/Deflate", "codecs/compress/Zstd", "codecs/image/Texel", "codecs/image/Texture" }, caps = { decode = true, encode = true, alpha = true, float = true, mipmaps = true, cubemap = true, compressed = { "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7", "etc1", "etc2", "eac" } }, + sniff = 0, load = function() return __include("image/ktx") end, @@ -1750,6 +1801,7 @@ local list: { Entry } = { mime = { "image/x-quake-lmp" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, alpha = true, depths = { 8 }, variants = { "qpic", "palette", "colormap" } }, + sniff = 0, load = function() return __include("image/lmp") end, @@ -1762,6 +1814,7 @@ local list: { Entry } = { mime = { "image/vnd.zbrush.pcx", "image/x-pcx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 2, 4, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/pcx") end, @@ -1774,6 +1827,7 @@ local list: { Entry } = { mime = { "image/png", "image/apng" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Deflate", "Types", "containers/Chunks" }, caps = { decode = true, encode = true, animation = true, alpha = true, depths = { 1, 2, 4, 8, 16 } }, + sniff = 0, load = function() return __include("image/png") end, @@ -1786,6 +1840,7 @@ local list: { Entry } = { mime = { "image/x-portable-anymap", "image/x-portable-bitmap", "image/x-portable-graymap", "image/x-portable-pixmap", "image/x-portable-arbitrarymap", "image/x-portable-floatmap" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 1, 8, 16, 32 }, float = true }, + sniff = 0, load = function() return __include("image/pnm") end, @@ -1798,6 +1853,7 @@ local list: { Entry } = { mime = { "image/qoi", "image/x-qoi" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/qoi") end, @@ -1810,6 +1866,7 @@ local list: { Entry } = { mime = { "image/sgi", "image/x-rgb" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 8, 16 } }, + sniff = 0, load = function() return __include("image/sgi") end, @@ -1822,6 +1879,7 @@ local list: { Entry } = { mime = { "image/x-quake-sprite" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, alpha = true, animation = true, variants = { "quake", "halflife", "spr32" } }, + sniff = 0, load = function() return __include("image/spr") end, @@ -1834,6 +1892,7 @@ local list: { Entry } = { mime = { "image/x-sun-raster", "image/x-cmu-raster" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/sunras") end, @@ -1846,6 +1905,7 @@ local list: { Entry } = { mime = { "image/x-tga", "image/x-targa" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 8, 15, 16, 24, 32 } }, + sniff = 0, load = function() return __include("image/tga") end, @@ -1858,6 +1918,7 @@ local list: { Entry } = { mime = { "image/tiff" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/compress/Lzw", "codecs/compress/PackBits" }, caps = { decode = true, encode = true, alpha = true, pages = true, depths = { 1, 2, 4, 8, 16, 32 }, float = true }, + sniff = 0, load = function() return __include("image/tiff") end, @@ -1870,6 +1931,7 @@ local list: { Entry } = { mime = { "image/x-tim" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 4, 8, 16, 24 } }, + sniff = 0, load = function() return __include("image/tim") end, @@ -1882,6 +1944,7 @@ local list: { Entry } = { mime = { "image/x-vtf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Bcn", "codecs/image/Texel" }, caps = { decode = true, encode = false, alpha = true, animation = true, versions = { "7.0", "7.1", "7.2", "7.3", "7.4", "7.5" } }, + sniff = 0, load = function() return __include("image/vtf") end, @@ -1894,6 +1957,7 @@ local list: { Entry } = { mime = { "image/webp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Vp8", "codecs/image/Vp8L", "containers/Riff" }, caps = { decode = true, encode = true, animation = true, alpha = true, lossy = true, lossless = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/webp") end, @@ -1906,6 +1970,7 @@ local list: { Entry } = { mime = { "image/x-xbitmap", "image/x-xbm" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, depths = { 1 } }, + sniff = 0, load = function() return __include("image/xbm") end, @@ -1918,6 +1983,7 @@ local list: { Entry } = { mime = { "image/x-xpixmap", "image/x-xpm" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/xpm") end, @@ -1930,6 +1996,7 @@ local list: { Entry } = { mime = { "audio/aac", "audio/aacp", "audio/x-aac" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Aac", "codecs/audio/Pcm", "codecs/audio/Stream" }, caps = { decode = true, encode = false, codecs = { "aac" }, streaming = true }, + sniff = 1, load = function() return __include("audio/aac") end, @@ -1942,6 +2009,7 @@ local list: { Entry } = { mime = { "audio/ac3", "audio/x-ac3" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/Ac3" }, caps = { decode = true, encode = false, codecs = { "ac3" }, channels = 6, streaming = true, lossy = true }, + sniff = 1, load = function() return __include("audio/ac3") end, @@ -1954,6 +2022,7 @@ local list: { Entry } = { mime = { "audio/x-adpcm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, headerless = true, codecs = { "ima", "ima_wav", "ms", "ima_qt", "psx" } }, + sniff = 0, load = function() return __include("audio/adpcm") end, @@ -1966,6 +2035,7 @@ local list: { Entry } = { mime = { "audio/x-adx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, loops = true, channels = 8 }, + sniff = 0, load = function() return __include("audio/adx") end, @@ -1978,6 +2048,7 @@ local list: { Entry } = { mime = { "audio/aiff", "audio/x-aiff" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm/Decoder", "containers/Chunks" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, lossy = false }, + sniff = 0, load = function() return __include("audio/aiff") end, @@ -1990,6 +2061,7 @@ local list: { Entry } = { mime = { "audio/ape", "audio/x-ape", "audio/x-monkeys-audio" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Ape" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, float = true, depths = { 8, 16, 24, 32 } }, + sniff = 0, load = function() return __include("audio/ape") end, @@ -2002,6 +2074,7 @@ local list: { Entry } = { mime = { "audio/basic", "audio/x-au" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, lossy = false }, + sniff = 0, load = function() return __include("audio/au") end, @@ -2014,6 +2087,8 @@ local list: { Entry } = { mime = { "audio/x-brstm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = false, streaming = true, lossy = true, loops = true, containers = { "RSTM", "CSTM", "FSTM" } }, + sniff = 0, + variant = true, load = function() return __include("audio/brstm") end, @@ -2026,6 +2101,7 @@ local list: { Entry } = { mime = { "audio/x-caf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Aac", "codecs/audio/Adpcm/Decoder", "codecs/audio/Alac", "codecs/audio/Pcm", "codecs/audio/Stream", "containers/Chunks" }, caps = { decode = true, encode = true, codecs = { "pcm", "alac", "aac", "ulaw", "alaw" }, encodeCodecs = { "pcm", "alac" }, tags = true, streaming = true }, + sniff = 0, load = function() return __include("audio/caf") end, @@ -2038,6 +2114,7 @@ local list: { Entry } = { mime = { "audio/flac", "audio/x-flac" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/audio/Pcm", "codecs/audio/VorbisComment", "codecs/audio/Flac/Frame", "codecs/audio/Flac/Encode" }, caps = { decode = true, encode = true, streaming = true, depths = { 4, 8, 12, 16, 20, 24, 32 }, ogg = true, seek = true }, + sniff = 0, load = function() return __include("audio/flac") end, @@ -2050,6 +2127,7 @@ local list: { Entry } = { mime = { "audio/mp4", "audio/x-m4a", "audio/m4a" }, deps = { "core/Err", "core/Bytes", "Types", "containers/IsoBmff", "codecs/audio/Aac", "codecs/audio/Alac", "codecs/audio/Pcm", "codecs/audio/Stream" }, caps = { decode = true, encode = true, codecs = { "aac", "alac" }, encodeCodecs = { "alac" }, tags = true, streaming = true }, + sniff = 1, load = function() return __include("audio/m4a") end, @@ -2062,6 +2140,7 @@ local list: { Entry } = { mime = { "audio/mpeg", "audio/mp3", "audio/mpa" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Resample", "codecs/audio/Mpa/Header", "codecs/audio/Mpa/Core", "codecs/audio/Mpa/Encode3", "codecs/audio/Mpa/Encode2" }, caps = { decode = true, encode = true, streaming = true, seek = true, layers = { 1, 2, 3 }, encodeLayers = { 2, 3 }, channels = 2 }, + sniff = 1, load = function() return __include("audio/mp3") end, @@ -2074,6 +2153,7 @@ local list: { Entry } = { mime = { "audio/x-musepack", "audio/musepack" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Musepack" }, caps = { decode = true, encode = false, codecs = { "musepack" }, versions = { 7, 8 }, streaming = true, lossy = true }, + sniff = 1, load = function() return __include("audio/mpc") end, @@ -2086,6 +2166,7 @@ local list: { Entry } = { mime = { "audio/opus", "audio/ogg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/entropy/RangeCoder/Decoder", "codecs/audio/Pcm", "codecs/audio/Resample", "codecs/audio/VorbisComment", "codecs/audio/Opus/CeltEncoder", "codecs/audio/Opus/Decoder", "codecs/audio/Opus/Packet", "codecs/audio/Opus/Celt", "codecs/audio/Opus/Silk" }, caps = { decode = true, encode = true, streaming = true, seek = true, lossy = true, channels = 255, rates = { 48000 }, encodeModes = { "celt" }, encodeChannels = 2 }, + sniff = 0, load = function() return __include("audio/opus") end, @@ -2098,6 +2179,7 @@ local list: { Entry } = { mime = { "audio/qoa" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/Qoa" }, caps = { decode = true, encode = true, streaming = true, lossy = true, seek = true, channels = 8 }, + sniff = 0, load = function() return __include("audio/qoa") end, @@ -2110,6 +2192,7 @@ local list: { Entry } = { mime = { "audio/x-tta", "audio/tta" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Tta" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, depths = { 8, 16, 24 } }, + sniff = 0, load = function() return __include("audio/tta") end, @@ -2122,6 +2205,7 @@ local list: { Entry } = { mime = { "audio/x-vag" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, loops = true, channels = 2 }, + sniff = 0, load = function() return __include("audio/vag") end, @@ -2134,6 +2218,7 @@ local list: { Entry } = { mime = { "audio/x-voc" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16 }, lossy = false }, + sniff = 0, load = function() return __include("audio/voc") end, @@ -2146,6 +2231,7 @@ local list: { Entry } = { mime = { "audio/ogg", "audio/vorbis" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/audio/Mdct", "codecs/audio/Pcm", "codecs/audio/VorbisComment", "codecs/audio/Vorbis/Tables", "codecs/audio/Vorbis/Setup", "codecs/audio/Vorbis/Packet" }, caps = { decode = true, encode = true, streaming = true, seek = true, lossy = true, channels = 255 }, + sniff = 0, load = function() return __include("audio/vorbis") end, @@ -2158,6 +2244,7 @@ local list: { Entry } = { mime = { "audio/wav", "audio/x-wav", "audio/wave", "audio/vnd.wave" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Riff", "codecs/audio/Pcm", "codecs/audio/Adpcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, rf64 = true }, + sniff = 1, load = function() return __include("audio/wav") end, @@ -2170,6 +2257,7 @@ local list: { Entry } = { mime = { "audio/x-wavpack", "audio/wavpack" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/WavPack" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, hybrid = true, float = true, depths = { 8, 12, 16, 20, 24, 32 } }, + sniff = 0, load = function() return __include("audio/wavpack") end, @@ -2182,6 +2270,7 @@ local list: { Entry } = { mime = { "video/x-msvideo", "video/avi" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Avi", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, video = { "mjpeg", "mpeg1", "mpeg2", "rawvideo" }, audio = true, odml = true }, + sniff = 0, load = function() return __include("video/avi") end, @@ -2194,6 +2283,7 @@ local list: { Entry } = { mime = { "video/x-fli", "video/fli", "video/x-flc" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "flic" }, depths = { 8, 15, 16, 24 } }, + sniff = 0, load = function() return __include("video/fli") end, @@ -2206,6 +2296,7 @@ local list: { Entry } = { mime = { "video/x-flv", "video/flv" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source", "codecs/video/H263", "codecs/video/H264", "codecs/audio/Aac" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "flv1", "h264" }, audio = true, metadata = true }, + sniff = 0, load = function() return __include("video/flv") end, @@ -2218,6 +2309,7 @@ local list: { Entry } = { mime = { "video/h264" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source", "codecs/video/H264" }, caps = { decode = true, encode = true, streaming = true, video = { "h264" }, depths = { 8 } }, + sniff = 0, load = function() return __include("video/h264") end, @@ -2230,6 +2322,8 @@ local list: { Entry } = { mime = { "video/x-matroska", "video/webm", "audio/x-matroska", "audio/webm" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ebml", "containers/Demux", "containers/Avi", "containers/IsoBmff/QtPalette", "codecs/compress/Deflate", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "vp8", "mjpeg", "mpeg1", "mpeg2", "theora", "rawvideo" }, audio = true, subtitles = true }, + sniff = 0, + variant = true, load = function() return __include("video/mkv") end, @@ -2242,6 +2336,7 @@ local list: { Entry } = { mime = { "video/mp4", "video/quicktime", "video/3gpp" }, deps = { "core/Err", "core/Bytes", "Types", "containers/IsoBmff", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "mjpeg", "mpeg1", "mpeg2", "h264" }, audio = true, fragments = true }, + sniff = 1, load = function() return __include("video/mp4") end, @@ -2254,6 +2349,7 @@ local list: { Entry } = { mime = { "video/mpeg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/MpegPs", "containers/MpegEs", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "mpeg1", "mpeg2" }, audio = true }, + sniff = 0, load = function() return __include("video/mpegps") end, @@ -2266,6 +2362,7 @@ local list: { Entry } = { mime = { "video/mp2t" }, deps = { "core/Err", "core/Bytes", "Types", "containers/MpegTs", "containers/MpegEs", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "mpeg1", "mpeg2", "h264" }, audio = true }, + sniff = 0, load = function() return __include("video/mpegts") end, @@ -2278,6 +2375,7 @@ local list: { Entry } = { mime = { "video/ogg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "containers/Demux", "containers/AudioWrap", "codecs/video/Theora", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "theora" }, audio = true }, + sniff = 0, load = function() return __include("video/ogv") end, @@ -2290,6 +2388,7 @@ local list: { Entry } = { mime = { "video/vnd.radgamettools.smacker" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/audio/Stream", "codecs/video/Legacy/Smacker" }, caps = { decode = true, encode = false, streaming = true, video = { "smackvid" }, audio = { "smackaudio", "pcm_u8", "pcm_s16le" } }, + sniff = 0, load = function() return __include("video/smk") end, @@ -2302,6 +2401,7 @@ local list: { Entry } = { mime = { "video/x-yuv4mpeg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, video = { "rawvideo" }, depths = { 8, 10, 12, 16 } }, + sniff = 0, load = function() return __include("video/y4m") end, @@ -2314,6 +2414,7 @@ local list: { Entry } = { mime = { "application/x-3ds", "image/x-3ds" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Sampler" }, caps = { decode = true, encode = true, materials = true, textures = true, animation = true, cameras = true, lights = true, instancing = true }, + sniff = 0, load = function() return __include("model/3ds") end, @@ -2326,6 +2427,7 @@ local list: { Entry } = { mime = { "model/3mf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "containers/Zip" }, caps = { decode = true, encode = true, materials = true, vertexColors = true, textures = true, units = true }, + sniff = 0, load = function() return __include("model/3mf") end, @@ -2338,6 +2440,7 @@ local list: { Entry } = { mime = { "model/x-ase", "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text", "codecs/model/Mat4" }, caps = { decode = true, encode = true, text = true, materials = true, cameras = true, lights = true, vertexColors = true }, + sniff = 1, load = function() return __include("model/ase") end, @@ -2350,6 +2453,7 @@ local list: { Entry } = { mime = { "model/x-b3d" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/model/Mat4" }, caps = { decode = true, encode = false, materials = true, textures = true, skins = true, animation = true, colors = true }, + sniff = 0, load = function() return __include("model/b3d") end, @@ -2362,6 +2466,7 @@ local list: { Entry } = { mime = { "application/x-blender" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Blend", "codecs/compress/Deflate", "codecs/compress/Zstd", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/Polygon" }, caps = { decode = true, encode = false, materials = true, textures = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, polygons = true, compressed = true }, + sniff = 1, load = function() return __include("model/blend") end, @@ -2374,6 +2479,7 @@ local list: { Entry } = { mime = { "model/x-bsp" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex", "codecs/model/Patch" }, caps = { decode = true, encode = false, variants = { "quake", "bsp2", "2psb", "halflife", "quake2", "quake3" }, lightmaps = true, collision = true, visibility = true }, + sniff = 0, load = function() return __include("model/bsp") end, @@ -2386,6 +2492,7 @@ local list: { Entry } = { mime = { "application/x-build-map" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Polygon" }, caps = { decode = true, encode = true, sprites = true, slopes = true }, + sniff = 0, load = function() return __include("model/buildmap") end, @@ -2398,6 +2505,7 @@ local list: { Entry } = { mime = { "text/x-doom3-map" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Brush", "codecs/model/Patch", "codecs/model/Mat4", "codecs/text/Lexer" }, caps = { decode = true, encode = false, patches = true, variants = { "doom3", "quake4" } }, + sniff = 0, load = function() return __include("model/d3map") end, @@ -2410,6 +2518,7 @@ local list: { Entry } = { mime = { "model/vnd.collada+xml", "model/vnd.collada+zip" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "core/Base64", "containers/Zip", "codecs/model/Mat4" }, caps = { decode = true, encode = true, materials = true, polygons = true, skins = true, morphTargets = true, animation = true, cameras = true, lights = true, zae = true }, + sniff = 0, load = function() return __include("model/dae") end, @@ -2422,6 +2531,7 @@ local list: { Entry } = { mime = { "application/vnd.autodesk.fbx", "model/fbx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "core/Base64", "codecs/model/Mat4" }, caps = { decode = true, encode = true, binary = true, ascii = true, materials = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, polygons = true }, + sniff = 2, load = function() return __include("model/fbx") end, @@ -2434,6 +2544,7 @@ local list: { Entry } = { mime = { "model/gltf+json", "model/gltf-binary" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Base64", "core/Sniff", "codecs/model/Draco" }, caps = { decode = true, encode = true, binary = true, materials = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, draco = true }, + sniff = 0, load = function() return __include("model/gltf") end, @@ -2446,6 +2557,7 @@ local list: { Entry } = { mime = { "application/x-godot-scene" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/GodotVariant", "codecs/model/Mat4" }, caps = { decode = true, encode = true, text = true, materials = true, cameras = true, lights = true, instances = true }, + sniff = 0, load = function() return __include("model/godot") end, @@ -2458,6 +2570,7 @@ local list: { Entry } = { mime = { "model/x-iqm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/Sampler" }, caps = { decode = true, encode = true, materials = true, skins = true, animation = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/iqm") end, @@ -2470,6 +2583,7 @@ local list: { Entry } = { mime = { "application/x-ldraw", "application/x-multi-part-ldraw" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = false, materials = true, lines = true, instancing = true }, + sniff = 0, load = function() return __include("model/ldraw") end, @@ -2482,6 +2596,7 @@ local list: { Entry } = { mime = { "image/x-lwo", "model/x-lwo" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks" }, caps = { decode = true, encode = false, materials = true, polygons = true, vertexColors = true, morphTargets = true }, + sniff = 0, load = function() return __include("model/lwo") end, @@ -2494,6 +2609,7 @@ local list: { Entry } = { mime = { "text/x-quake-map" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Miptex", "codecs/model/Brush", "codecs/model/Patch" }, caps = { decode = true, encode = true, variants = { "quake", "valve220", "quake2", "quake3" }, patches = true }, + sniff = 0, load = function() return __include("model/map") end, @@ -2506,6 +2622,7 @@ local list: { Entry } = { mime = { "application/x-minecraft-region" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/text/Nbt", "codecs/model/Minecraft", "codecs/compress/Lz4" }, caps = { decode = true, encode = false, voxels = true, blocks = true }, + sniff = 0, load = function() return __include("model/mca") end, @@ -2518,6 +2635,7 @@ local list: { Entry } = { mime = { "model/x-md2" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Rig" }, caps = { decode = true, encode = false, morph = true, animation = true }, + sniff = 0, load = function() return __include("model/md2") end, @@ -2530,6 +2648,7 @@ local list: { Entry } = { mime = { "model/x-md3" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Mat4", "codecs/model/Rig" }, caps = { decode = true, encode = false, morph = true, animation = true, tags = true }, + sniff = 0, load = function() return __include("model/md3") end, @@ -2542,6 +2661,7 @@ local list: { Entry } = { mime = { "model/x-md5mesh", "model/x-md5anim" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Sniff", "Types", "codecs/model/Rig" }, caps = { decode = true, encode = false, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/md5") end, @@ -2554,6 +2674,7 @@ local list: { Entry } = { mime = { "model/x-mdl" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/SourceAnim" }, caps = { decode = true, encode = false, variants = { "quake", "halflife" }, morph = true, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/mdl") end, @@ -2566,6 +2687,7 @@ local list: { Entry } = { mime = { "application/x-ms3d" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, materials = true, skins = true, animation = true }, + sniff = 1, load = function() return __include("model/ms3d") end, @@ -2578,6 +2700,7 @@ local list: { Entry } = { mime = { "model/obj" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, materials = true, polygons = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/obj") end, @@ -2590,6 +2713,7 @@ local list: { Entry } = { mime = { "model/off", "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, polygons = true, points = true, colors = true, binary = false }, + sniff = 0, load = function() return __include("model/off") end, @@ -2602,6 +2726,7 @@ local list: { Entry } = { mime = { "model/ply", "application/ply" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, ascii = true, binary = true, polygons = true, points = true, colors = true }, + sniff = 0, load = function() return __include("model/ply") end, @@ -2614,6 +2739,7 @@ local list: { Entry } = { mime = { "model/x-pmx", "model/x-pmd" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text" }, caps = { decode = true, encode = false, materials = true, skins = true, morphTargets = true, pmd = true }, + sniff = 0, load = function() return __include("model/pmx") end, @@ -2626,6 +2752,7 @@ local list: { Entry } = { mime = { "model/x-doom3-proc" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Lexer" }, caps = { decode = true, encode = false, portals = true }, + sniff = 0, load = function() return __include("model/proc") end, @@ -2638,6 +2765,7 @@ local list: { Entry } = { mime = { "model/x-qubicle" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, voxels = true, truecolor = true }, + sniff = 0, load = function() return __include("model/qb") end, @@ -2650,6 +2778,8 @@ local list: { Entry } = { mime = { "application/x-roblox-rbxm", "application/x-roblox-rbxl" }, deps = { "core/Err", "core/Bytes", "core/Md5", "codecs/compress/Lz4", "codecs/compress/Zstd", "codecs/model/Rbx", "codecs/model/Rbx/Binary" }, caps = { decode = true, encode = true, tree = true, compression = { "none", "lz4", "zstd" } }, + sniff = 0, + variant = true, load = function() return __include("model/rbxm") end, @@ -2662,6 +2792,8 @@ local list: { Entry } = { mime = { "application/x-roblox-rbxmx", "application/x-roblox-rbxlx" }, deps = { "core/Err", "core/Bytes", "core/Base64", "core/Md5", "codecs/text/Xml", "codecs/model/Rbx" }, caps = { decode = true, encode = true, tree = true }, + sniff = 0, + variant = true, load = function() return __include("model/rbxmx") end, @@ -2674,6 +2806,7 @@ local list: { Entry } = { mime = { "application/x-roblox-mesh" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Draco" }, caps = { decode = true, encode = true, skinning = true, lods = true, versions = { "1.00", "1.01", "2.00", "3.00", "3.01", "4.00", "4.01", "5.00", "6.00", "7.00" } }, + sniff = 0, load = function() return __include("model/robloxmesh") end, @@ -2686,6 +2819,8 @@ local list: { Entry } = { mime = { "application/x-minecraft-schematic" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Nbt", "codecs/model/Minecraft" }, caps = { decode = true, encode = true, voxels = true, blocks = true, variants = { "schem", "schematic", "litematic" } }, + sniff = 1, + variant = true, load = function() return __include("model/schematic") end, @@ -2698,6 +2833,7 @@ local list: { Entry } = { mime = { "model/x-smd", "text/plain" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Rig" }, caps = { decode = true, encode = true, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/smd") end, @@ -2710,6 +2846,7 @@ local list: { Entry } = { mime = { "model/x-source-mdl" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Half", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/SourceAnim", "codecs/text/KeyValues" }, caps = { decode = true, encode = false, skins = true, morph = true, animation = true, lods = true }, + sniff = 0, load = function() return __include("model/sourcemdl") end, @@ -2722,6 +2859,7 @@ local list: { Entry } = { mime = { "model/stl", "application/sla" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, ascii = true, binary = true, colors = true, indexed = false }, + sniff = 0, load = function() return __include("model/stl") end, @@ -2734,6 +2872,7 @@ local list: { Entry } = { mime = { "text/x-unreal-t3d" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Text", "codecs/model/Brush" }, caps = { decode = true, encode = false, text = true, brushes = true, actors = true }, + sniff = 0, load = function() return __include("model/t3d") end, @@ -2746,6 +2885,7 @@ local list: { Entry } = { mime = { "text/x-udmf" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/DoomMap" }, caps = { decode = true, encode = false, maps = true }, + sniff = 0, load = function() return __include("model/udmf") end, @@ -2758,6 +2898,7 @@ local list: { Entry } = { mime = { "model/vnd.usda", "model/vnd.usdz+zip" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip", "codecs/model/Mat4" }, caps = { decode = true, encode = true, materials = true, animation = true, cameras = true, lights = true, polygons = true, vertexColors = true, usdz = "read", usdc = false }, + sniff = 0, load = function() return __include("model/usda") end, @@ -2770,6 +2911,7 @@ local list: { Entry } = { mime = { "model/x-vbsp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Lzma", "codecs/text/KeyValues", "codecs/model/Mat4", "codecs/model/Displacement", "containers/Zip", "containers/Archive" }, caps = { decode = true, encode = false, versions = { 19, 20, 21 }, displacements = true, staticProps = true, pak = true }, + sniff = 0, load = function() return __include("model/vbsp") end, @@ -2782,6 +2924,7 @@ local list: { Entry } = { mime = { "model/x-vmf" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Sniff", "Types", "codecs/text/KeyValues", "codecs/model/Brush", "codecs/model/Displacement", "codecs/model/Mat4" }, caps = { decode = true, encode = true, displacements = true, roundTrip = true }, + sniff = 0, load = function() return __include("model/vmf") end, @@ -2794,6 +2937,7 @@ local list: { Entry } = { mime = { "model/x-vox" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, voxels = true, sceneGraph = true, materials = true }, + sniff = 0, load = function() return __include("model/vox") end, @@ -2806,6 +2950,7 @@ local list: { Entry } = { mime = { "model/vrml", "x-world/x-vrml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Vrml" }, caps = { decode = true, encode = true, materials = true, polygons = true, animation = true, cameras = true, lights = true, lines = true, points = true }, + sniff = 0, load = function() return __include("model/vrml") end, @@ -2818,6 +2963,7 @@ local list: { Entry } = { mime = { "model/x-directx", "text/x-directx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/model/Mat4", "codecs/model/Rig" }, caps = { decode = true, encode = false, text = true, binary = true, compressed = true, materials = true, skins = true, animation = true, polygons = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/x") end, @@ -2830,6 +2976,7 @@ local list: { Entry } = { mime = { "model/x3d+xml", "model/x3d-vrml", "model/x3d+fastinfoset" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Vrml" }, caps = { decode = true, encode = true, materials = true, polygons = true, animation = true, cameras = true, lights = true, lines = true, points = true, xml = true, classic = true }, + sniff = 0, load = function() return __include("model/x3d") end, @@ -2842,6 +2989,7 @@ local list: { Entry } = { mime = { "model/step", "application/step", "application/p21" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, complexEntities = true, sections = true, brep = "plugin", tessellate = "plugin" }, + sniff = 0, load = function() return __include("cad/step") end, @@ -2854,6 +3002,7 @@ local list: { Entry } = { mime = { "application/x-font-bdf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = true, bitmap = true }, + sniff = 0, load = function() return __include("font/bdf") end, @@ -2866,6 +3015,7 @@ local list: { Entry } = { mime = { "application/x-bmfont" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, bitmap = true, variants = { "text", "xml", "binary" }, extraFiles = true }, + sniff = 0, load = function() return __include("font/bmfont") end, @@ -2878,6 +3028,7 @@ local list: { Entry } = { mime = { "application/vnd.ms-fontobject" }, deps = { "core/Err", "core/Bytes", "codecs/text/Text", "codecs/font/TrueType" }, caps = { decode = true, encode = true, variants = { "1.0", "2.1", "2.2" } }, + sniff = 0, load = function() return __include("font/eot") end, @@ -2890,6 +3041,7 @@ local list: { Entry } = { mime = { "application/x-font-fnt" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text", "codecs/font/Bitmap" }, caps = { decode = true, encode = false, bitmap = true, variants = { "fnt2", "fnt3", "ne", "pe" } }, + sniff = 0, load = function() return __include("font/fon") end, @@ -2902,6 +3054,7 @@ local list: { Entry } = { mime = { "application/x-hershey-font" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Raster" }, caps = { decode = true, encode = false, strokes = true }, + sniff = 0, load = function() return __include("font/hershey") end, @@ -2914,6 +3067,7 @@ local list: { Entry } = { mime = { "application/x-font-pcf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = false, bitmap = true }, + sniff = 0, load = function() return __include("font/pcf") end, @@ -2926,6 +3080,7 @@ local list: { Entry } = { mime = { "application/x-font-linux-psf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = true, bitmap = true, variants = { "psf1", "psf2" } }, + sniff = 0, load = function() return __include("font/psf") end, @@ -2938,6 +3093,7 @@ local list: { Entry } = { mime = { "font/ttf", "font/otf", "font/collection" }, deps = { "core/Err", "core/Bytes", "codecs/font/TrueType" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" }, collection = true, kerning = true }, + sniff = 0, load = function() return __include("font/ttf") end, @@ -2950,6 +3106,7 @@ local list: { Entry } = { mime = { "application/x-font-type1" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Raster", "codecs/font/GlyphNames" }, caps = { decode = true, encode = false, outlines = { "type1" }, variants = { "pfb", "pfa" } }, + sniff = 0, load = function() return __include("font/type1") end, @@ -2962,6 +3119,7 @@ local list: { Entry } = { mime = { "font/woff" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/font/TrueType" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" } }, + sniff = 0, load = function() return __include("font/woff") end, @@ -2974,6 +3132,7 @@ local list: { Entry } = { mime = { "font/woff2" }, deps = { "core/Err", "core/Bytes", "codecs/font/TrueType", "codecs/compress/Brotli" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" }, transforms = { "glyf", "loca", "hmtx" } }, + sniff = 0, load = function() return __include("font/woff2") end, @@ -2986,6 +3145,7 @@ local list: { Entry } = { mime = { "application/x-7z-compressed" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "Types", "codecs/compress/Lzma", "codecs/compress/Deflate", "codecs/compress/Bzip2", "codecs/compress/Zstd", "containers/Archive", "codecs/text/Text" }, caps = { decode = true, encode = false, methods = { "copy", "lzma", "lzma2", "deflate", "bcj", "delta" }, encrypted = false }, + sniff = 0, load = function() return __include("archive/7z") end, @@ -2998,6 +3158,7 @@ local list: { Entry } = { mime = { "application/x-amiga-disk-format" }, deps = { "core/Err", "core/Bytes", "containers/Archive" }, caps = { decode = true, encode = false, variants = { "ofs", "ffs" } }, + sniff = 0, load = function() return __include("archive/adf") end, @@ -3010,6 +3171,7 @@ local list: { Entry } = { mime = { "application/applefile", "multipart/appledouble" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true, variants = { "applesingle", "appledouble" } }, + sniff = 0, load = function() return __include("archive/applesingle") end, @@ -3022,6 +3184,7 @@ local list: { Entry } = { mime = { "application/x-archive", "application/vnd.debian.binary-package" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzma", "codecs/compress/Zstd", "codecs/compress/Bzip2", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, variants = { "gnu", "bsd" }, deb = true }, + sniff = 0, load = function() return __include("archive/ar") end, @@ -3034,6 +3197,7 @@ local list: { Entry } = { mime = { "application/x-arj" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = false, methods = { "store", "arj1", "arj2", "arj3", "arj4" } }, + sniff = 0, load = function() return __include("archive/arj") end, @@ -3046,6 +3210,7 @@ local list: { Entry } = { mime = { "application/mac-binhex40" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true }, + sniff = 0, load = function() return __include("archive/binhex") end, @@ -3058,6 +3223,7 @@ local list: { Entry } = { mime = { "application/x-brotli" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Brotli", "containers/Archive" }, caps = { decode = true, encode = false, stream = true }, + sniff = 1, load = function() return __include("archive/br") end, @@ -3070,6 +3236,7 @@ local list: { Entry } = { mime = { "application/x-bzip2" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "codecs/compress/Bzip2" }, caps = { decode = true, encode = false, stream = true }, + sniff = 0, load = function() return __include("archive/bz2") end, @@ -3082,6 +3249,7 @@ local list: { Entry } = { mime = { "application/vnd.ms-cab-compressed" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzx", "codecs/compress/Quantum", "containers/Archive" }, caps = { decode = true, encode = true, methods = { "store", "mszip", "lzx", "quantum" } }, + sniff = 0, load = function() return __include("archive/cab") end, @@ -3094,6 +3262,7 @@ local list: { Entry } = { mime = { "application/x-cpio" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Cpio" }, caps = { decode = true, encode = true, variants = { "newc", "crc", "odc", "bin" } }, + sniff = 0, load = function() return __include("archive/cpio") end, @@ -3106,6 +3275,7 @@ local list: { Entry } = { mime = { "application/x-d64" }, deps = { "core/Err", "core/Bytes", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "d64", "d71", "d81" } }, + sniff = 0, load = function() return __include("archive/d64") end, @@ -3118,6 +3288,7 @@ local list: { Entry } = { mime = { "application/x-fat-image" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Fat" }, caps = { decode = true, encode = true, variants = { "fat12", "fat16", "fat32" } }, + sniff = 1, load = function() return __include("archive/fat") end, @@ -3130,6 +3301,7 @@ local list: { Entry } = { mime = { "application/x-build-grp" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "containers/Archive" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("archive/grp") end, @@ -3142,6 +3314,7 @@ local list: { Entry } = { mime = { "application/gzip" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Deflate", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, stream = true }, + sniff = 0, load = function() return __include("archive/gzip") end, @@ -3154,6 +3327,7 @@ local list: { Entry } = { mime = { "application/x-iso9660-image" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Iso9660" }, caps = { decode = true, encode = false, extensions = { "joliet", "rockridge", "eltorito" } }, + sniff = 0, load = function() return __include("archive/iso") end, @@ -3166,6 +3340,7 @@ local list: { Entry } = { mime = { "application/x-lzh-compressed" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = true, methods = { "lh0", "lh1", "lh4", "lh5", "lh6", "lh7", "lhx", "lzs", "lz5", "lz4", "lhd" } }, + sniff = 0, load = function() return __include("archive/lha") end, @@ -3178,6 +3353,7 @@ local list: { Entry } = { mime = { "application/x-lz4" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Lz4", "codecs/compress/Xxh32", "containers/Archive" }, caps = { decode = true, encode = true, stream = true, legacy = true }, + sniff = 0, load = function() return __include("archive/lz4") end, @@ -3190,6 +3366,7 @@ local list: { Entry } = { mime = { "application/x-macbinary" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true, variants = { "I", "II", "III" } }, + sniff = 0, load = function() return __include("archive/macbinary") end, @@ -3202,6 +3379,7 @@ local list: { Entry } = { mime = { "application/x-mpq" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "codecs/compress/Deflate", "codecs/compress/Bzip2", "codecs/compress/Lzma", "codecs/compress/Explode" }, caps = { decode = true, encode = false, versions = { 1, 2, 3, 4 }, methods = { "zlib", "implode", "bzip2", "lzma", "sparse" }, encryption = true }, + sniff = 0, load = function() return __include("archive/mpq") end, @@ -3214,6 +3392,7 @@ local list: { Entry } = { mime = { "application/x-pak" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "quake", "sin" } }, + sniff = 0, load = function() return __include("archive/pak") end, @@ -3226,6 +3405,7 @@ local list: { Entry } = { mime = { "application/x-rpm" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzma", "codecs/compress/Zstd", "codecs/compress/Bzip2", "containers/Archive", "containers/Cpio" }, caps = { decode = true, encode = false, compressors = { "gzip", "bzip2", "xz", "lzma", "zstd" } }, + sniff = 0, load = function() return __include("archive/rpm") end, @@ -3238,6 +3418,7 @@ local list: { Entry } = { mime = { "application/x-tar" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, variants = { "ustar", "pax", "gnu" } }, + sniff = 1, load = function() return __include("archive/tar") end, @@ -3250,6 +3431,7 @@ local list: { Entry } = { mime = { "application/x-unitypackage" }, deps = { "core/Err", "core/Bytes", "core/Md5", "codecs/compress/Deflate", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true }, + sniff = 1, load = function() return __include("archive/unitypackage") end, @@ -3262,6 +3444,7 @@ local list: { Entry } = { mime = { "text/x-uuencode" }, deps = { "core/Err", "core/Bytes", "core/Base64", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "uu", "xx", "base64" } }, + sniff = 0, load = function() return __include("archive/uu") end, @@ -3274,6 +3457,7 @@ local list: { Entry } = { mime = { "application/x-vpk" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Crc32", "core/Md5", "containers/Archive" }, caps = { decode = true, encode = true, versions = { 1, 2 }, multipart = true }, + sniff = 0, load = function() return __include("archive/vpk") end, @@ -3286,6 +3470,7 @@ local list: { Entry } = { mime = { "application/x-wolf3d-vswap" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Archive", "codecs/image/Pixels" }, caps = { decode = true, encode = false, images = true, sounds = true }, + sniff = 0, load = function() return __include("archive/vswap") end, @@ -3298,6 +3483,7 @@ local list: { Entry } = { mime = { "application/x-doom" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Archive", "codecs/image/Pixels", "codecs/model/DoomMap" }, caps = { decode = true, encode = true, images = true, maps = true, variants = { "iwad", "pwad" } }, + sniff = 0, load = function() return __include("archive/wad") end, @@ -3310,6 +3496,7 @@ local list: { Entry } = { mime = { "application/x-quake-wad" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "containers/Archive", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, images = true, variants = { "wad2", "wad3" } }, + sniff = 0, load = function() return __include("archive/wad2") end, @@ -3322,6 +3509,7 @@ local list: { Entry } = { mime = { "application/x-xz", "application/x-lzma" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Lzma", "containers/Archive" }, caps = { decode = true, encode = false, stream = true, filters = { "lzma2", "lzma", "delta", "x86", "powerpc", "arm", "armthumb", "sparc", "arm64" } }, + sniff = 0, load = function() return __include("archive/xz") end, @@ -3334,6 +3522,7 @@ local list: { Entry } = { mime = { "application/x-yenc" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "containers/Archive" }, caps = { decode = true, encode = true, multipart = true }, + sniff = 0, load = function() return __include("archive/yenc") end, @@ -3346,6 +3535,7 @@ local list: { Entry } = { mime = { "application/x-compress" }, deps = { "core/Err", "core/Bytes", "codecs/compress/UnixCompress", "containers/Archive" }, caps = { decode = true, encode = true, stream = true, bits = { 9, 16 } }, + sniff = 0, load = function() return __include("archive/z") end, @@ -3358,6 +3548,7 @@ local list: { Entry } = { mime = { "application/zip", "application/x-zip-compressed" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip" }, caps = { decode = true, encode = true, methods = { "store", "deflate" }, zip64 = true }, + sniff = 0, load = function() return __include("archive/zip") end, @@ -3370,6 +3561,7 @@ local list: { Entry } = { mime = { "application/x-zoo" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "codecs/compress/Lzw", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = false, methods = { "store", "lzw", "lzh" } }, + sniff = 0, load = function() return __include("archive/zoo") end, @@ -3382,6 +3574,7 @@ local list: { Entry } = { mime = { "application/zstd" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Zstd", "containers/Archive" }, caps = { decode = true, encode = false, stream = true }, + sniff = 1, load = function() return __include("archive/zst") end, @@ -3394,6 +3587,7 @@ local list: { Entry } = { mime = { "application/cbor", "application/cbor-seq" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, binary = true, ordered = true, tags = true }, + sniff = 0, load = function() return __include("data/cbor") end, @@ -3406,6 +3600,7 @@ local list: { Entry } = { mime = { "text/csv", "text/tab-separated-values" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, header = true }, + sniff = 0, load = function() return __include("data/csv") end, @@ -3418,6 +3613,7 @@ local list: { Entry } = { mime = { "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, ordered = true }, + sniff = 0, load = function() return __include("data/ini") end, @@ -3430,6 +3626,7 @@ local list: { Entry } = { mime = { "application/json", "application/x-ndjson" }, deps = { "core/Err", "core/Bytes", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, ordered = true, streaming = true }, + sniff = 0, load = function() return __include("data/json") end, @@ -3442,6 +3639,7 @@ local list: { Entry } = { mime = { "application/msgpack", "application/x-msgpack" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, binary = true, ordered = true }, + sniff = 0, load = function() return __include("data/msgpack") end, @@ -3454,6 +3652,7 @@ local list: { Entry } = { mime = { "application/x-minecraft-nbt" }, deps = { "core/Err", "core/Bytes", "codecs/text/Nbt" }, caps = { decode = true, encode = true, binary = true, ordered = true, typed = true }, + sniff = 1, load = function() return __include("data/nbt") end, @@ -3466,6 +3665,7 @@ local list: { Entry } = { mime = { "application/x-plist", "application/x-bplist" }, deps = { "core/Err", "core/Bytes", "Types", "core/Base64", "codecs/text/Xml", "codecs/text/Json" }, caps = { decode = true, encode = true, binary = "read", ordered = true }, + sniff = 0, load = function() return __include("data/plist") end, @@ -3478,6 +3678,7 @@ local list: { Entry } = { mime = { "text/x-quake3-shader" }, deps = { "core/Err", "core/Bytes" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("data/q3shader") end, @@ -3490,6 +3691,7 @@ local list: { Entry } = { mime = { "text/x-quake3-skin" }, deps = { "core/Err", "core/Bytes" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("data/q3skin") end, @@ -3502,6 +3704,7 @@ local list: { Entry } = { mime = { "text/x-minecraft-snbt" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "codecs/text/Nbt" }, caps = { decode = true, encode = true, ordered = true, typed = true }, + sniff = 0, load = function() return __include("data/snbt") end, @@ -3514,6 +3717,7 @@ local list: { Entry } = { mime = { "application/toml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "codecs/text/Text" }, caps = { decode = true, encode = true, ordered = true, dates = true }, + sniff = 0, load = function() return __include("data/toml") end, @@ -3526,6 +3730,7 @@ local list: { Entry } = { mime = { "application/x-godot-resource" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/GodotVariant" }, caps = { decode = true, encode = true, ordered = true }, + sniff = 0, load = function() return __include("data/tres") end, @@ -3538,6 +3743,7 @@ local list: { Entry } = { mime = { "text/x-vdf" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "codecs/text/KeyValues" }, caps = { decode = true, encode = true, ordered = true, binary = true }, + sniff = 1, load = function() return __include("data/vdf") end, @@ -3550,6 +3756,7 @@ local list: { Entry } = { mime = { "application/xml", "text/xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "core/Sniff" }, caps = { decode = true, encode = true, namespaces = true, streaming = true }, + sniff = 0, load = function() return __include("data/xml") end, @@ -3562,6 +3769,7 @@ local list: { Entry } = { mime = { "application/yaml", "application/x-yaml", "text/yaml" }, deps = { "core/Err", "core/Bytes", "Types", "core/Base64", "codecs/text/Text" }, caps = { decode = true, encode = true, ordered = true, multiDocument = true, anchors = true }, + sniff = 0, load = function() return __include("data/yaml") end, @@ -3574,6 +3782,7 @@ local list: { Entry } = { mime = { "application/x-wolf3d-gamemaps" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types" }, caps = { decode = true, encode = false, tilemap = true }, + sniff = 0, load = function() return __include("vector/gamemaps") end, @@ -3586,6 +3795,7 @@ local list: { Entry } = { mime = { "application/x-ldtk+json" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Json" }, caps = { decode = true, encode = true, levels = true, worlds = true, intGrid = true, entities = true }, + sniff = 0, load = function() return __include("vector/ldtk") end, @@ -3598,6 +3808,7 @@ local list: { Entry } = { mime = { "application/x-ogmo+json" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "core/Base64", "Types", "codecs/text/Json" }, caps = { decode = true, encode = true, projects = true, entities = true, decals = true }, + sniff = 0, load = function() return __include("vector/ogmo") end, @@ -3610,6 +3821,7 @@ local list: { Entry } = { mime = { "image/svg+xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "codecs/image/Raster", "codecs/image/Blend", "core/Sniff" }, caps = { decode = true, encode = true, rasterize = true, text = false }, + sniff = 0, load = function() return __include("vector/svg") end, @@ -3622,6 +3834,7 @@ local list: { Entry } = { mime = { "application/x-tiled-tmx", "application/x-tiled-tmj" }, deps = { "core/Err", "core/Bytes", "core/Base64", "Types", "codecs/text/Xml", "codecs/text/Json", "codecs/compress/Deflate", "core/Sniff" }, caps = { decode = true, encode = true, tilesets = true, infinite = true }, + sniff = 0, load = function() return __include("vector/tiled") end, @@ -3634,6 +3847,7 @@ local list: { Entry } = { mime = { "image/x-aseprite" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate" }, caps = { decode = true, encode = true, layers = true, groups = true, animation = true, depths = { 8, 16, 32 } }, + sniff = 0, load = function() return __include("layered/aseprite") end, @@ -3646,6 +3860,7 @@ local list: { Entry } = { mime = { "image/openraster" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip", "codecs/text/Xml", "codecs/image/Blend" }, caps = { decode = true, encode = true, layers = true, groups = true, depths = { 8 } }, + sniff = 0, load = function() return __include("layered/ora") end, @@ -3658,6 +3873,7 @@ local list: { Entry } = { mime = { "image/vnd.adobe.photoshop" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Blend", "codecs/compress/Deflate", "codecs/compress/PackBits", "codecs/text/Text" }, caps = { decode = true, encode = true, layers = true, groups = true, depths = { 1, 8, 16, 32 } }, + sniff = 0, load = function() return __include("layered/psd") end, @@ -3670,6 +3886,7 @@ local list: { Entry } = { mime = { "text/x-ssa", "text/x-ass" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = true }, + sniff = 0, load = function() return __include("subtitle/ass") end, @@ -3682,6 +3899,7 @@ local list: { Entry } = { mime = { "application/x-subrip", "text/srt" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = false }, + sniff = 0, load = function() return __include("subtitle/srt") end, @@ -3694,6 +3912,7 @@ local list: { Entry } = { mime = { "text/vtt" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = true }, + sniff = 0, load = function() return __include("subtitle/vtt") end, @@ -3706,6 +3925,7 @@ local list: { Entry } = { mime = { "audio/x-669" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 8, 8 } }, + sniff = 0, load = function() return __include("music/669") end, @@ -3718,6 +3938,7 @@ local list: { Entry } = { mime = { "audio/x-ahx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Hively" }, caps = { decode = true, encode = false, render = true, channels = { 4, 4 }, subsongs = true }, + sniff = 0, load = function() return __include("music/ahx") end, @@ -3730,6 +3951,7 @@ local list: { Entry } = { mime = { "audio/x-far" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 16, 16 } }, + sniff = 0, load = function() return __include("music/far") end, @@ -3742,6 +3964,7 @@ local list: { Entry } = { mime = { "audio/x-hmp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true, hmi = true }, + sniff = 0, load = function() return __include("music/hmp") end, @@ -3754,6 +3977,7 @@ local list: { Entry } = { mime = { "audio/x-hvl" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Hively" }, caps = { decode = true, encode = false, render = true, channels = { 4, 16 }, subsongs = true }, + sniff = 0, load = function() return __include("music/hvl") end, @@ -3766,6 +3990,7 @@ local list: { Entry } = { mime = { "audio/it", "audio/x-it" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, channels = { 1, 64 }, compressedSamples = true }, + sniff = 0, load = function() return __include("music/it") end, @@ -3778,6 +4003,7 @@ local list: { Entry } = { mime = { "audio/x-med" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 64 } }, + sniff = 0, load = function() return __include("music/med") end, @@ -3790,6 +4016,7 @@ local list: { Entry } = { mime = { "audio/midi", "audio/x-midi" }, deps = { "core/Err", "core/Bytes", "codecs/audio/MidiRender", "Types" }, caps = { decode = true, encode = true, formats = { 0, 1, 2 }, render = true, streaming = true, rmid = true }, + sniff = 0, load = function() return __include("music/midi") end, @@ -3802,6 +4029,7 @@ local list: { Entry } = { mime = { "audio/x-mod", "audio/mod" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = true, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/mod") end, @@ -3814,6 +4042,7 @@ local list: { Entry } = { mime = { "audio/x-mtm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/mtm") end, @@ -3826,6 +4055,7 @@ local list: { Entry } = { mime = { "audio/x-mus" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true }, + sniff = 0, load = function() return __include("music/mus") end, @@ -3838,6 +4068,7 @@ local list: { Entry } = { mime = { "audio/x-okt" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 4, 8 } }, + sniff = 0, load = function() return __include("music/okt") end, @@ -3850,6 +4081,7 @@ local list: { Entry } = { mime = { "audio/x-ptm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/ptm") end, @@ -3862,6 +4094,7 @@ local list: { Entry } = { mime = { "audio/s3m", "audio/x-s3m" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/s3m") end, @@ -3874,6 +4107,7 @@ local list: { Entry } = { mime = { "audio/x-soundfont" }, deps = { "core/Err", "core/Bytes", "codecs/audio/SoundFont" }, caps = { decode = true, encode = false, sm24 = true, sf3 = false }, + sniff = 1, load = function() return __include("music/sf2") end, @@ -3886,6 +4120,7 @@ local list: { Entry } = { mime = { "audio/x-stm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 4, 4 } }, + sniff = 0, load = function() return __include("music/stm") end, @@ -3898,6 +4133,7 @@ local list: { Entry } = { mime = { "audio/x-ult" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/ult") end, @@ -3910,6 +4146,7 @@ local list: { Entry } = { mime = { "audio/x-umx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, container = true }, + sniff = 0, load = function() return __include("music/umx") end, @@ -3922,6 +4159,7 @@ local list: { Entry } = { mime = { "audio/xm", "audio/x-xm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Adpcm" }, caps = { decode = true, encode = true, render = true, channels = { 1, 64 } }, + sniff = 0, load = function() return __include("music/xm") end, @@ -3934,6 +4172,7 @@ local list: { Entry } = { mime = { "audio/x-xmidi" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true, songs = true }, + sniff = 0, load = function() return __include("music/xmi") end, @@ -3946,6 +4185,7 @@ local list: { Entry } = { mime = { "audio/x-mpegurl", "audio/mpegurl", "application/vnd.apple.mpegurl", "application/x-mpegurl" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Text", "core/Sniff" }, caps = { decode = true, encode = true, hls = true }, + sniff = 0, load = function() return __include("playlist/m3u") end, @@ -3958,6 +4198,7 @@ local list: { Entry } = { mime = { "audio/x-scpls", "audio/scpls" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Text", "core/Sniff" }, caps = { decode = true, encode = true }, + sniff = 1, load = function() return __include("playlist/pls") end, @@ -3970,6 +4211,7 @@ local list: { Entry } = { mime = { "application/xspf+xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Xml" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("playlist/xspf") end, @@ -7984,6 +8226,19 @@ end return Mux end +end + + + + + + Core_2 + --!optimize 2 +--!nocheck +-- rosetta chunk Core_2 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 7 modules (3 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["core/Bytes"] = @native function() @@ -8511,19 +8766,6 @@ end return Bytes end -end - - - - - - Core_2 - --!optimize 2 ---!nocheck --- rosetta chunk Core_2 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 6 modules (2 native: @native); the Rosetta root requires it when one of them is first included. --- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). -return function(__FILES, __include) __FILES["core/Crc32"] = @native function() @@ -26008,7 +26250,7 @@ __FILES["codecs/image/Dct"] = @native function() -- libjpeg's islow (jidctint.c / jfdctint.c), the reduced IDCTs (jidctred.c) and jcdctmgr.c's rounding quantiser, bit-exact -- with libjpeg-turbo. From jpeg-luau 1.0 (same author); IJG code: licenses/libjpeg-turbo-LICENSE.md. local readi16, readu16, writeu16, writeu32, readu8, writei16 = buffer.readi16, buffer.readu16, buffer.writeu16, buffer.writeu32, buffer.readu8, buffer.writei16 -local clamp = math.clamp +local clamp, abs, sign = math.clamp, math.abs, math.sign local Dct = {} @@ -26387,18 +26629,13 @@ end local fw = table.create(64, 0) -@native local function quant(coef: buffer, off: number, div: buffer, v: number, i: number) - local qv = readu16(div, i * 2) * 8 - local h = qv // 2 - if v < 0 then - writei16(coef, off + i * 2, -((h - v) // qv)) - else - writei16(coef, off + i * 2, (v + h) // qv) - end +-- (|v| + q * 4) // (q * 8) with v's sign, branch-free (a sign branch here gave LuaJIT side traces it could not compile) +@native local function quant(coef: buffer, off: number, qv: number, v: number, i: number) + writei16(coef, off + i * 2, (abs(v) + qv / 2) // qv * sign(v)) end --- quantised as jcdctmgr.c: (|v| + q * 4) // (q * 8) with the sign restored -@native function Dct.fdctQuantize(src: buffer, stride: number, x: number, y: number, w: number, h: number, div: buffer, coef: buffer, off: number) +-- quantised as jcdctmgr.c: (|v| + q * 4) // (q * 8) with the sign restored; div[i + 1] = q * 8 for natural index i +@native function Dct.fdctQuantize(src: buffer, stride: number, x: number, y: number, w: number, h: number, div: { number }, coef: buffer, off: number) local lastX, lastY = w - 1, h - 1 for r = 0, 7 do local row = math.min(y + r, lastY) * stride @@ -26487,14 +26724,14 @@ end local o3 = (tmp6 + z2 + z3 + 16384) // 32768 local o1 = (tmp7 + z1 + z4 + 16384) // 32768 local cc = c - 1 - quant(coef, off, div, o0, cc) - quant(coef, off, div, o1, cc + 8) - quant(coef, off, div, o2, cc + 16) - quant(coef, off, div, o3, cc + 24) - quant(coef, off, div, o4, cc + 32) - quant(coef, off, div, o5, cc + 40) - quant(coef, off, div, o6, cc + 48) - quant(coef, off, div, o7, cc + 56) + quant(coef, off, div[c], o0, cc) + quant(coef, off, div[c + 8], o1, cc + 8) + quant(coef, off, div[c + 16], o2, cc + 16) + quant(coef, off, div[c + 24], o3, cc + 24) + quant(coef, off, div[c + 32], o4, cc + 32) + quant(coef, off, div[c + 40], o5, cc + 40) + quant(coef, off, div[c + 48], o6, cc + 48) + quant(coef, off, div[c + 56], o7, cc + 56) end end @@ -29003,11 +29240,11 @@ type Options = { local qt = { Tables.quant(Tables.LUMA, o.quality), Tables.quant(Tables.CHROMA, o.quality) } local qdiv = {} for t = 1, 2 do - local b = buffer.create(128) + local d = table.create(64, 0) for i = 1, 64 do - writeu16(b, (i - 1) * 2, qt[t][i]) + d[i] = qt[t][i] * 8 end - qdiv[t] = b + qdiv[t] = d end local comps: { Comp } = {} @@ -75150,6 +75387,3405 @@ end + + Root + --!optimize 2 +--!nocheck +-- rosetta chunk Root (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) +__FILES["Sniffs"] = function() + + +-- Sniffs: GENERATED by tools/gen_registry.py from the format folders - do not edit. +-- Each format's sniff (format path -> sniff(r)), copied from its init.luau with the top-level locals and types it +-- reaches (tools/sniff_extract.py), so detection requires no format module. Requires outside core/ are proxies that +-- require on first use. Formats whose sniff needs their module (Registry sniff = 2) are not here. +local S: { [string]: (any) -> number } = {} + +local function lazy(load: () -> any): any + local proxy = {} + return setmetatable(proxy, { + __index = function(_, k: any): any + local m = load() + setmetatable(proxy, { __index = m }) + return m[k] + end, + }) +end + +do -- image/ani +local Bytes = __include("core/Bytes") +S["image/ani"] = function(r: Bytes.Reader): number + return if r:peek(4) == "RIFF" and r:peek(4, 8) == "ACON" then 1 else 0 +end +end + +do -- image/art +local Bytes = __include("core/Bytes") +local readu8, readu16, readu32, readi16 = buffer.readu8, buffer.readu16, buffer.readu32, buffer.readi16 +local function header(b: buffer, o: number, limit: number): (number?, number?, number?, number?, boolean?) + local p = o + local prefixed = false + if limit - p >= 8 and buffer.readstring(b, p, 8) == "BUILDART" then + p += 8 + prefixed = true + end + if limit - p < 16 or readu32(b, p) ~= 1 then + return nil, nil, nil, nil, nil + end + local first, last = readu32(b, p + 8), readu32(b, p + 12) + if last < first or last - first >= 65536 then + return nil, nil, nil, nil, nil + end + return p + 16, first, last, readu32(b, p + 4), prefixed +end +S["image/art"] = function(r: Bytes.Reader): number + local at, first, last = header(r.buf, r.base, r.limit) + if not at or not first or not last then + return 0 + end + local n = last - first + 1 + local p = at :: number + if r.limit - p < n * 8 then + return 0 + end + local total = 0 + for i = 0, n - 1 do + local w, h = readi16(r.buf, p + i * 2), readi16(r.buf, p + n * 2 + i * 2) + if w < 0 or h < 0 then + return 0 + end + total += w * h + end + local size = p + n * 8 + total - r.base + local have = r.limit - r.base + return if size == have then 0.9 elseif size < have and have - size < 4096 then 0.5 else 0 +end +end + +do -- image/blp +local Bytes = __include("core/Bytes") +S["image/blp"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m == "BLP1" or m == "BLP2" then 1 elseif m == "BLP0" then 0.8 else 0 +end +end + +do -- image/bmp +local Bytes = __include("core/Bytes") +S["image/bmp"] = function(r: Bytes.Reader): number + if r:peek(2) ~= "BM" then + return 0 + end + local n = r:peekU8(14) + math.max(r:peekU8(15), 0) * 256 + if r:peekU8(16) == 0 and r:peekU8(17) == 0 and (n == 12 or n == 16 or n == 40 or n == 52 or n == 56 or n == 64 or n == 108 or n == 124) then + return 0.9 + end + return 0.2 +end +end + +do -- image/dds +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "DDS " +S["image/dds"] = function(r: Bytes.Reader): number + return math.max(Sniff.magic(r, MAGIC .. "\124\0\0\0"), Sniff.magic(r, MAGIC, 0, 0.6)) +end +end + +do -- image/exr +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "\118\47\49\1" +S["image/exr"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- image/gif +local Bytes = __include("core/Bytes") +S["image/gif"] = function(r: Bytes.Reader): number + local s = r:peek(6) + return if s == "GIF89a" or s == "GIF87a" then 1 else 0 +end +end + +do -- image/hdr +local Bytes = __include("core/Bytes") +S["image/hdr"] = function(r: Bytes.Reader): number + local s = r:peek(10) + if s == "#?RADIANCE" then + return 1 + end + if string.sub(s, 1, 6) == "#?RGBE" then + return 1 + end + if string.sub(s, 1, 2) == "#?" and string.match(s, "^#%?%u") then + return 0.5 + end + return 0 +end +end + +do -- image/icns +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/icns"] = function(r: Bytes.Reader): number + return Sniff.magic(r, "icns") +end +end + +do -- image/ico +local Bytes = __include("core/Bytes") +local readu8 = buffer.readu8 +S["image/ico"] = function(r: Bytes.Reader): number + if r:remaining() < 22 then + return 0 + end + local b, o = r.buf, r.pos + local typ = buffer.readu16(b, o + 2) + local count = buffer.readu16(b, o + 4) + if buffer.readu16(b, o) ~= 0 or (typ ~= 1 and typ ~= 2) or count == 0 then + return 0 + end + -- the first entry: reserved byte 0, a size and offset inside the file + local size, off = buffer.readu32(b, o + 14), buffer.readu32(b, o + 18) + if readu8(b, o + 9) ~= 0 or size == 0 or off < 6 + count * 16 then + return 0 + end + return 0.8 +end +end + +do -- image/ilbm +local Bytes = __include("core/Bytes") +S["image/ilbm"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "FORM" then + return 0 + end + local t = r:peek(4, 8) + return if t == "ILBM" or t == "PBM " then 1 else 0 +end +end + +do -- image/jpeg +local Bytes = __include("core/Bytes") +S["image/jpeg"] = function(r: Bytes.Reader): number + local s = r:peek(3) + return if s == "\255\216\255" then 1 else 0 +end +end + +do -- image/ktx +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local ID1 = "\171KTX 11\187\r\n\26\n" +local ID2 = "\171KTX 20\187\r\n\26\n" +S["image/ktx"] = function(r: Bytes.Reader): number + return math.max(Sniff.magic(r, ID2), Sniff.magic(r, ID1)) +end +end + +do -- image/lmp +local Bytes = __include("core/Bytes") +local function kindOf(r: Bytes.Reader): string? + local n = r:remaining() + if n == 768 then + return "palette" + elseif n == 16385 or n == 16384 then + return "colormap" + end + if n < 9 then + return nil + end + local w, h = buffer.readu32(r.buf, r.pos), buffer.readu32(r.buf, r.pos + 4) + if w > 0 and h > 0 and w <= 4096 and h <= 4096 and 8 + w * h == n then + return "qpic" + end + return nil +end +S["image/lmp"] = function(r: Bytes.Reader): number + local k = kindOf(r) + return if k == "qpic" then 0.3 elseif k then 0.05 else 0 +end +end + +do -- image/pcx +local Bytes = __include("core/Bytes") +S["image/pcx"] = function(r: Bytes.Reader): number + if r:size() < 128 then + return 0 + end + local m, v, e, bpp = r:peekU8(0), r:peekU8(1), r:peekU8(2), r:peekU8(3) + if m ~= 10 or (v ~= 0 and v ~= 2 and v ~= 3 and v ~= 4 and v ~= 5) or e > 1 then + return 0 + end + return if bpp == 1 or bpp == 2 or bpp == 4 or bpp == 8 then 0.8 else 0 +end +end + +do -- image/png +local Bytes = __include("core/Bytes") +local SIGNATURE = "\137PNG\r\n\26\n" +S["image/png"] = function(r: Bytes.Reader): number + return if r:peek(8) == SIGNATURE then 1 else 0 +end +end + +do -- image/pnm +local Bytes = __include("core/Bytes") +S["image/pnm"] = function(r: Bytes.Reader): number + if r:remaining() < 3 then + return 0 + end + local a, b, c = r:peekU8(0), r:peekU8(1), r:peekU8(2) + if a ~= 80 then -- 'P' + return 0 + end + local ws = c == 32 or (c >= 9 and c <= 13) + if b >= 49 and b <= 55 and ws then -- P1..P7 + return 0.9 + end + if (b == 70 or b == 102) and ws then -- PF / Pf + return 0.9 + end + return 0 +end +end + +do -- image/qoi +local Bytes = __include("core/Bytes") +S["image/qoi"] = function(r: Bytes.Reader): number + return if r:peek(4) == "qoif" then 1 else 0 +end +end + +do -- image/sgi +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/sgi"] = function(r: Bytes.Reader): number + if Sniff.magic(r, "\1\218") == 0 or r:size() < 512 then + return 0 + end + local st, bpc = r:peekU8(2), r:peekU8(3) + return if st <= 1 and (bpc == 1 or bpc == 2) then 1 else 0 +end +end + +do -- image/spr +local Bytes = __include("core/Bytes") +S["image/spr"] = function(r: Bytes.Reader): number + if r:remaining() < 36 or r:peek(4) ~= "IDSP" then + return 0 + end + local v = buffer.readi32(r.buf, r.pos + 4) + return if v == 1 or v == 2 or v == 32 then 1 else 0.3 +end +end + +do -- image/sunras +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "\89\166\106\149" +S["image/sunras"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- image/tga +local Bytes = __include("core/Bytes") +local TYPES = { [1] = true, [2] = true, [3] = true, [9] = true, [10] = true, [11] = true } +local FOOTER = "TRUEVISION-XFILE.\0" +local readu8 = buffer.readu8 +type Header = { + idLen: number, + cmapType: number, + imageType: number, + cmapFirst: number, + cmapLen: number, + cmapBits: number, + width: number, + height: number, + depth: number, + desc: number, +} +local function header(r: Bytes.Reader): Header? + if r.limit - r.base < 18 then + return nil + end + local b, o = r.buf, r.base + local function u16(q: number): number + return readu8(b, o + q) + readu8(b, o + q + 1) * 256 + end + local h: Header = { + idLen = readu8(b, o), + cmapType = readu8(b, o + 1), + imageType = readu8(b, o + 2), + cmapFirst = u16(3), + cmapLen = u16(5), + cmapBits = readu8(b, o + 7), + width = u16(12), + height = u16(14), + depth = readu8(b, o + 16), + desc = readu8(b, o + 17), + } + return h +end +local function implausible(h: Header): string? + local t = h.imageType + if not TYPES[t] then + return "image type " .. t + end + if h.cmapType > 1 then + return "colour map type " .. h.cmapType + end + local mapped = t == 1 or t == 9 + if mapped and (h.cmapType ~= 1 or (h.depth ~= 8 and h.depth ~= 16)) then + return "colour-mapped image without a colour map" + end + if h.cmapType == 1 and h.cmapLen > 0 and h.cmapBits ~= 15 and h.cmapBits ~= 16 and h.cmapBits ~= 24 and h.cmapBits ~= 32 then + return "colour map entry size " .. h.cmapBits + end + if (t == 2 or t == 10) and h.depth ~= 15 and h.depth ~= 16 and h.depth ~= 24 and h.depth ~= 32 then + return "pixel depth " .. h.depth + end + if (t == 3 or t == 11) and h.depth ~= 8 and h.depth ~= 16 then + return "grey pixel depth " .. h.depth + end + if h.width == 0 or h.height == 0 then + return "zero size" + end + if h.desc >= 64 then + return "interleaving / reserved descriptor bits" + end + return nil +end +S["image/tga"] = function(r: Bytes.Reader): number + local h = header(r) + if not h or implausible(h) then + return 0 + end + local n = r.limit - r.base + if n >= 44 and buffer.readstring(r.buf, r.limit - 18, 18) == FOOTER then + return 0.9 + end + return 0.2 +end +end + +do -- image/tiff +local Bytes = __include("core/Bytes") +S["image/tiff"] = function(r: Bytes.Reader): number + local s = r:peek(4) + if s == "II*\0" or s == "MM\0*" or s == "II+\0" or s == "MM\0+" then + return 1 + end + return 0 +end +end + +do -- image/tim +local Bytes = __include("core/Bytes") +S["image/tim"] = function(r: Bytes.Reader): number + if r:remaining() < 20 or r:peek(4) ~= "\16\0\0\0" then + return 0 + end + local flags = r:peekU8(4) + if flags > 0x0F or (flags % 8) > 3 or r:peek(3, 5) ~= "\0\0\0" then + return 0 + end + return 0.8 +end +end + +do -- image/vtf +local Bytes = __include("core/Bytes") +S["image/vtf"] = function(r: Bytes.Reader): number + return if r:peek(4) == "VTF\0" and r:peekU8(4) == 7 then 1 else 0 +end +end + +do -- image/webp +local Bytes = __include("core/Bytes") +S["image/webp"] = function(r: Bytes.Reader): number + if r:peek(4) == "RIFF" and r:peek(4, 8) == "WEBP" then + return 1 + end + return 0 +end +end + +do -- image/xbm +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/xbm"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 256, true) + if string.match(s, "^#define%s+[%w_]*_?width%s+%d+") or string.match(s, "^/%*.-%*/%s*#define%s+[%w_]*width%s+%d+") then + return 0.9 + end + return 0 +end +end + +do -- image/xpm +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/xpm"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 64, true) + if string.sub(s, 1, 9) == "/* XPM */" or string.sub(s, 1, 6) == "! XPM2" then + return 1 + end + return 0 +end +end + +do -- audio/aac +local Bytes = __include("core/Bytes") +local Aac = lazy(function() + return __include("codecs/audio/Aac") +end) +local readu8 = buffer.readu8 +local function id3Size(b: buffer, p: number, limit: number): number + if p + 10 > limit or buffer.readstring(b, p, 3) ~= "ID3" then + return 0 + end + local s = 0 + for i = 6, 9 do + s = s * 128 + bit32.band(readu8(b, p + i), 127) + end + local footer = if bit32.band(readu8(b, p + 5), 0x10) ~= 0 then 10 else 0 + return 10 + s + footer +end +S["audio/aac"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + p += id3Size(b, p, limit) + local h = Aac.adts(b, p, limit) + if not h then + return 0 + end + local h2 = Aac.adts(b, p + h.frameSize, limit) + if h2 and h2.sfIndex == h.sfIndex and h2.channelConfig == h.channelConfig then + return 0.9 + end + return if p + h.frameSize >= limit then 0.7 else 0.4 +end +end + +do -- audio/ac3 +local Bytes = __include("core/Bytes") +local Ac3 = lazy(function() + return __include("codecs/audio/Ac3") +end) +S["audio/ac3"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + local h = Ac3.header(b, p, limit) + if not h then + return 0 + end + local h2 = Ac3.header(b, p + h.frameSize, limit) + if h2 and h2.sampleRate == h.sampleRate then + return 0.9 + end + return if p + h.frameSize >= limit then 0.6 else 0.3 +end +end + +do -- audio/adpcm +local Bytes = __include("core/Bytes") +S["audio/adpcm"] = function(_r: Bytes.Reader): number + return 0 +end +end + +do -- audio/adx +local Bytes = __include("core/Bytes") +S["audio/adx"] = function(r: Bytes.Reader): number + if r:peekU8(0) ~= 0x80 or r:peekU8(1) ~= 0 then + return 0 + end + local off = r:peekU8(2) * 256 + r:peekU8(3) + return if r:peek(6, off - 2) == "(c)CRI" then 1 else 0 +end +end + +do -- audio/aiff +local Bytes = __include("core/Bytes") +S["audio/aiff"] = function(r: Bytes.Reader): number + if r:remaining() < 12 or r:peek(4) ~= "FORM" then + return 0 + end + local form = buffer.readstring(r.buf, r.pos + 8, 4) + return if form == "AIFF" or form == "AIFC" then 1 else 0 +end +end + +do -- audio/ape +local Bytes = __include("core/Bytes") +S["audio/ape"] = function(r: Bytes.Reader): number + local head = r:peek(4) + if head == "MAC " or head == "MACF" then -- MACF: float samples + return 1 + end + if string.sub(head, 1, 3) == "ID3" then + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + local id = r:peek(4, 10 + sz + (if footer then 10 else 0)) + return if id == "MAC " or id == "MACF" then 1 else 0 + end + return 0 +end +end + +do -- audio/au +local Bytes = __include("core/Bytes") +S["audio/au"] = function(r: Bytes.Reader): number + return if r:peek(4) == ".snd" then 1 else 0 +end +end + +do -- audio/brstm +local Bytes = __include("core/Bytes") +S["audio/brstm"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m ~= "RSTM" and m ~= "CSTM" and m ~= "FSTM" then + return 0 + end + local bom = r:peek(2, 4) + return if bom == "\254\255" or bom == "\255\254" then 1 else 0 +end +end + +do -- audio/caf +local Bytes = __include("core/Bytes") +S["audio/caf"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h == 8 and string.sub(h, 1, 4) == "caff" and string.byte(h, 5) == 0 and string.byte(h, 6) == 1 then + return 1 + end + return 0 +end +end + +do -- audio/flac +local Bytes = __include("core/Bytes") +S["audio/flac"] = function(r: Bytes.Reader): number + local head = r:peek(4) + if head == "fLaC" then + return 1 + end + if head == "OggS" then + -- the first page's packet: 0x7F "FLAC" (the Ogg FLAC mapping) + local nseg = r:peekU8(26) + if nseg > 0 and r:peek(5, 27 + nseg) == "\127FLAC" then + return 1 + end + return 0 + end + if string.sub(head, 1, 3) == "ID3" then + -- an ID3v2 tag, then fLaC (mp3 files start with ID3 too) + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + return if r:peek(4, 10 + sz + (if footer then 10 else 0)) == "fLaC" then 1 else 0 + end + return 0 +end +end + +do -- audio/m4a +local Bytes = __include("core/Bytes") +local IsoBmff = lazy(function() + return __include("containers/IsoBmff") +end) +local AUDIO_BRANDS: { [string]: number } = { ["M4A "] = 1, ["M4B "] = 1, ["M4P "] = 1, ["M4V "] = 0.3 } +S["audio/m4a"] = function(r: Bytes.Reader): number + local brand = IsoBmff.sniff(r) + if brand == nil then + return 0 + end + if AUDIO_BRANDS[brand] then + return AUDIO_BRANDS[brand] + end + if brand == "avif" or brand == "avis" or brand == "heic" or brand == "heix" or brand == "mif1" or brand == "msf1" or brand == "crx " then + return 0 + end + return 0.4 -- an MP4 / MOV that may hold audio; a video format claims it more strongly +end +end + +do -- audio/mp3 +local Bytes = __include("core/Bytes") +local Header = lazy(function() + return __include("codecs/audio/Mpa/Header") +end) +local Tags = lazy(function() + return __include("audio/mp3/Tags") +end) +S["audio/mp3"] = function(r: Bytes.Reader): number + local b, p, lim = r.buf, r.pos, r.limit + local id3 = false + for _ = 1, 4 do -- (ffmpeg writes a tag even when the input had one: tags can follow each other) + local n = if p + 3 <= lim and buffer.readstring(b, p, 3) == "ID3" then Tags.id3v2Size(b, p, lim) else 0 + if n <= 0 then + break + end + id3 = true + p += n + end + if p + 4 > lim or not Header.valid(b, p) then + return if id3 then 0.5 else 0 + end + local fb = Header.frameBytes(b, p, 0) + if fb > 0 then + fb += Header.padding(b, p) + if p + fb + 4 <= lim and Header.compare(b, p, p + fb) then + return 0.9 + end + if p + fb == lim then + return 0.6 + end + end + return if id3 then 0.7 else 0.25 +end +end + +do -- audio/mpc +local Bytes = __include("core/Bytes") +local Musepack = lazy(function() + return __include("codecs/audio/Musepack") +end) +local function id3v2(b: buffer, p: number, limit: number): number + if p + 10 > limit or buffer.readstring(b, p, 3) ~= "ID3" then + return 0 + end + local n = 10 + for i = 6, 9 do + n += bit32.band(buffer.readu8(b, p + i), 127) * 128 ^ (9 - i) + end + return n + (if bit32.band(buffer.readu8(b, p + 5), 0x10) ~= 0 then 10 else 0) +end +S["audio/mpc"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + p += id3v2(b, p, limit) + local v = Musepack.magic(b, p, limit) + if v == 8 then + return 1 + end + return if v == 7 then 0.9 else 0 +end +end + +do -- audio/opus +local Bytes = __include("core/Bytes") +S["audio/opus"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "OggS" then + return 0 + end + local nseg = r:peekU8(26) + if nseg < 1 then + return 0 + end + return if r:peek(8, 27 + nseg) == "OpusHead" then 1 else 0 +end +end + +do -- audio/qoa +local Bytes = __include("core/Bytes") +S["audio/qoa"] = function(r: Bytes.Reader): number + return if r:peek(4) == "qoaf" then 1 else 0 +end +end + +do -- audio/tta +local Bytes = __include("core/Bytes") +local function id3Size(r: Bytes.Reader): number + if r:peek(3) ~= "ID3" then + return 0 + end + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + return 10 + sz + (if footer then 10 else 0) +end +S["audio/tta"] = function(r: Bytes.Reader): number + return if r:peek(4, id3Size(r)) == "TTA1" then 1 else 0 +end +end + +do -- audio/vag +local Bytes = __include("core/Bytes") +S["audio/vag"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m == "VAGp" or m == "VAGi" or m == "KVAG" then 1 else 0 +end +end + +do -- audio/voc +local Bytes = __include("core/Bytes") +local MAGIC = "Creative Voice File\26" +S["audio/voc"] = function(r: Bytes.Reader): number + return if r:peek(20) == MAGIC then 1 else 0 +end +end + +do -- audio/vorbis +local Bytes = __include("core/Bytes") +S["audio/vorbis"] = function(r: Bytes.Reader): number + if r:remaining() < 35 or r:peek(4) ~= "OggS" then + return 0 + end + local b, p = r.buf, r.pos + local nseg = buffer.readu8(b, p + 26) + local d = p + 27 + nseg + if d + 7 > r.limit then + return 0 + end + return if buffer.readu8(b, d) == 1 and buffer.readstring(b, d + 1, 6) == "vorbis" then 1 else 0 +end +end + +do -- audio/wav +local Bytes = __include("core/Bytes") +local Riff = lazy(function() + return __include("containers/Riff") +end) +S["audio/wav"] = function(r: Bytes.Reader): number + return if Riff.sniff(r) == "WAVE" then 1 else 0 +end +end + +do -- audio/wavpack +local Bytes = __include("core/Bytes") +S["audio/wavpack"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "wvpk" then + return 0 + end + local v = r:peekU8(9) + return if v == 4 then 1 else 0.5 +end +end + +do -- video/avi +local Bytes = __include("core/Bytes") +S["video/avi"] = function(r: Bytes.Reader): number + if r:peek(4) == "RIFF" and r:peek(4, 8) == "AVI " then + return 1 + end + return 0 +end +end + +do -- video/fli +local Bytes = __include("core/Bytes") +local FLI, FLC, DTA = 0xAF11, 0xAF12, 0xAF44 +S["video/fli"] = function(r: Bytes.Reader): number + local s = r:peek(18) + if #s < 18 then + return 0 + end + local magic = string.byte(s, 5) + string.byte(s, 6) * 256 + if magic ~= FLI and magic ~= FLC and magic ~= DTA then + return 0 + end + local w = string.byte(s, 9) + string.byte(s, 10) * 256 + local h = string.byte(s, 11) + string.byte(s, 12) * 256 + if w > 4096 or h > 4096 then + return 0 + end + return 0.9 +end +end + +do -- video/flv +local Bytes = __include("core/Bytes") +S["video/flv"] = function(r: Bytes.Reader): number + if r:remaining() >= 9 and r:peek(3) == "FLV" then + return if r:peekU8(3) == 1 then 1 else 0.6 + end + return 0 +end +end + +do -- video/h264 +local Bytes = __include("core/Bytes") +S["video/h264"] = function(r: Bytes.Reader): number + local s = r:peek(5) + if not s or #s < 4 then + return 0 + end + local hdr + if string.byte(s, 1) == 0 and string.byte(s, 2) == 0 and string.byte(s, 3) == 1 then + hdr = string.byte(s, 4) + elseif #s >= 5 and string.byte(s, 1) == 0 and string.byte(s, 2) == 0 and string.byte(s, 3) == 0 and string.byte(s, 4) == 1 then + hdr = string.byte(s, 5) + else + return 0 + end + if hdr >= 128 then + return 0 + end + local t = hdr % 32 + if t == 7 then + return 0.8 + elseif t == 9 or t == 6 or t == 8 then + return 0.5 + elseif t == 5 then + return 0.4 + end + return 0 +end +end + +do -- video/mkv +local Bytes = __include("core/Bytes") +S["video/mkv"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "\26\69\223\163" then + return 0 + end + local head = r:peek(math.min(64, r:remaining())) + if string.find(head, "webm", 1, true) or string.find(head, "matroska", 1, true) then + return 1 + end + return 0.5 +end +end + +do -- video/mp4 +local Bytes = __include("core/Bytes") +local IsoBmff = lazy(function() + return __include("containers/IsoBmff") +end) +local IMAGE_BRANDS = { avif = true, avis = true, heic = true, heix = true, mif1 = true, msf1 = true, ["crx "] = true } +local AUDIO_BRANDS = { ["M4A "] = true, ["M4B "] = true, ["M4P "] = true } +S["video/mp4"] = function(r: Bytes.Reader): number + local brand = IsoBmff.sniff(r) + if brand == nil or IMAGE_BRANDS[brand] then + return 0 + end + if AUDIO_BRANDS[brand] then + return 0.2 + end + if brand == "M4V " then + return 0.9 + end + return if brand == "" then 0.6 else 0.8 +end +end + +do -- video/mpegps +local Bytes = __include("core/Bytes") +S["video/mpegps"] = function(r: Bytes.Reader): number + if r:peek(4) == "\0\0\1\186" then + return 0.9 + end + if r:peek(4) == "\0\0\1\179" then + return 0.5 -- an MPEG-1 / 2 video elementary stream (sequence header) + end + return 0 +end +end + +do -- video/mpegts +local Bytes = __include("core/Bytes") +local SIZES = { 188, 192 } +local function packetSize(r: Bytes.Reader): (number, number) + local n = r:remaining() + local head = r:peek(2048 + 2 * 192) + local lim = math.min(n, 2048) + local start = 0 + while start < lim do + local f = string.find(head, "G", start + 1, true) -- 0x47 + if not f or f > lim then + break + end + start = f - 1 + for _, size in SIZES do + local hits, need = 0, math.min(3, (n - start - 1) // size + 1) + for k = 0, 2 do + local at = start + k * size + if at < n and string.byte(head, at + 1) == 0x47 then + hits += 1 + end + end + if hits >= need and (need >= 2 or start == 0) then + if size == 192 and start >= 4 then + return 192, start - 4 + elseif size == 188 then + return 188, start + end + end + end + start += 1 + end + return 0, 0 +end +S["video/mpegts"] = function(r: Bytes.Reader): number + local s, off = packetSize(r) + if s == 0 then + return 0 + end + if off > 0 then + return 0.6 + end + return if r:remaining() >= 3 * s then 0.9 else 0.5 +end +end + +do -- video/ogv +local Bytes = __include("core/Bytes") +S["video/ogv"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "OggS" then + return 0 + end + local b, p, lim = r.buf, r.pos, r.limit + for _ = 1, 8 do + if p + 27 > lim or buffer.readstring(b, p, 4) ~= "OggS" or buffer.readu8(b, p + 5) % 4 < 2 then + return 0 + end + local nseg = buffer.readu8(b, p + 26) + local d = p + 27 + nseg + if d + 7 <= lim and buffer.readu8(b, d) == 0x80 and buffer.readstring(b, d + 1, 6) == "theora" then + return 1 + end + if d > lim then + return 0 + end + local size = 0 + for i = 0, nseg - 1 do + size += buffer.readu8(b, p + 27 + i) + end + p = d + size + end + return 0 +end +end + +do -- video/smk +local Bytes = __include("core/Bytes") +S["video/smk"] = function(r: Bytes.Reader): number + local s = r:peek(4) + if s ~= "SMK2" and s ~= "SMK4" then + return 0 + end + return 1 +end +end + +do -- video/y4m +local Bytes = __include("core/Bytes") +local MAGIC = "YUV4MPEG2 " +S["video/y4m"] = function(r: Bytes.Reader): number + return if r:peek(10) == MAGIC then 1 else 0 +end +end + +do -- model/3ds +local Bytes = __include("core/Bytes") +S["model/3ds"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h < 8 or string.byte(h, 1) ~= 0x4D or string.byte(h, 2) ~= 0x4D then + return 0 + end + local b1, b2, b3, b4, c1, c2 = string.byte(h, 3, 8) + local size = b1 + b2 * 256 + b3 * 65536 + b4 * 16777216 + local child = c1 + c2 * 256 + if size < 16 or not (child == 0x0002 or child == 0x3D3D or child == 0xB000) then + return 0 + end + return if size == r.limit - r.pos then 0.95 else 0.7 +end +end + +do -- model/3mf +local Bytes = __include("core/Bytes") +S["model/3mf"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "PK\3\4" then + return 0 + end + local n = r:size() + local tail = buffer.readstring(r.buf, r.base + math.max(0, n - 65536), math.min(n, 65536)) + if string.find(tail, "3D/[^/]*%.model") or string.find(tail, "3dmodel.model", 1, true) then + return 0.95 + end + local head = r:peek(256) + if string.find(head, "3D/", 1, true) then + return 0.7 + end + return 0 +end +end + +do -- model/ase +local Bytes = __include("core/Bytes") +local Text = lazy(function() + return __include("codecs/text/Text") +end) +local MAGIC = "*3DSMAX_ASCIIEXPORT" +local function utf16(r: Bytes.Reader): (boolean?, boolean) + local h = r:peek(2) + if h == "\255\254" then + return true, false + elseif h == "\254\255" then + return true, true + elseif #h == 2 and string.byte(h, 2) == 0 and string.byte(h, 1) == 42 then + return true, false + elseif #h == 2 and string.byte(h, 1) == 0 and string.byte(h, 2) == 42 then + return true, true + end + return nil, false +end +local function text(r: Bytes.Reader, n: number?): string + local wide, be = utf16(r) + local len = r.limit - r.pos + if n then + len = math.min(len, n) + end + if wide then + local skip = if r:peek(2) == "\255\254" or r:peek(2) == "\254\255" then 2 else 0 + return Text.utf16(r.buf, r.pos + skip, len - skip, be) + end + return Text.toUtf8(buffer.readstring(r.buf, r.pos, len)) +end +S["model/ase"] = function(r: Bytes.Reader): number + local h = string.match(text(r, 256), "^%s*(%*[%w_]+)") + if h == MAGIC then + return 1 + end + return 0 +end +end + +do -- model/b3d +local Bytes = __include("core/Bytes") +S["model/b3d"] = function(r: Bytes.Reader): number + if r:peek(4) == "BB3D" then + return if r:peek(4, 8) ~= "" then 1 else 0.8 + end + return 0 +end +end + +do -- model/blend +local Bytes = __include("core/Bytes") +local Deflate = lazy(function() + return __include("codecs/compress/Deflate") +end) +local Zstd = lazy(function() + return __include("codecs/compress/Zstd") +end) +S["model/blend"] = function(r: Bytes.Reader): number + local head = r:peek(7) + if head == "BLENDER" then + return 1 + end + local n = r.limit - r.base + if string.sub(head, 1, 3) == "\31\139\8" then + local inner = Deflate.peek(r.buf, r.base, n, 7) + return if inner and buffer.tostring(inner) == "BLENDER" then 1 else 0 + end + if string.sub(head, 1, 4) == Zstd.MAGIC then + if n > 4 * 2 ^ 20 then + return 0.5 + end + local out = Zstd.decompress(r.buf, r.base, n, { verify = false }) + return if out and buffer.len(out) >= 7 and buffer.readstring(out, 0, 7) == "BLENDER" then 1 else 0 + end + return 0 +end +end + +do -- model/bsp +local Bytes = __include("core/Bytes") +S["model/bsp"] = function(r: Bytes.Reader): number + if r:remaining() < 64 then + return 0 + end + local m = r:peek(4) + local v = buffer.readi32(r.buf, r.pos + (if m == "IBSP" then 4 else 0)) + if m == "BSP2" or m == "2PSB" then + v = 29 + end + if m == "IBSP" then + return if v == 38 or v == 46 or v == 47 then 1 else 0.3 + end + if v == 29 or v == 30 then + local size = r:remaining() + for i = 0, 14 do + local o, n = buffer.readi32(r.buf, r.pos + 4 + i * 8), buffer.readi32(r.buf, r.pos + 8 + i * 8) + if o < 0 or n < 0 or o + n > size then + return 0 + end + end + return 0.6 + end + return 0 +end +end + +do -- model/buildmap +local Bytes = __include("core/Bytes") +local SECTOR_SIZE, WALL_SIZE, SPRITE_SIZE = 40, 32, 44 +local HEADER = 22 -- version, posx, posy, posz, ang, cursectnum, then u16 numsectors at 20 +local readu16 = buffer.readu16 +local function layout(b: buffer, o: number, limit: number): (number?, number?, number?, number?) + if limit - o < HEADER then + return nil, nil, nil, nil + end + local ns = readu16(b, o + 20) + local p = o + HEADER + ns * SECTOR_SIZE + if p + 2 > limit then + return nil, nil, nil, nil + end + local nw = readu16(b, p) + p += 2 + nw * WALL_SIZE + if p + 2 > limit then + return nil, nil, nil, nil + end + local nsp = readu16(b, p) + p += 2 + nsp * SPRITE_SIZE + return ns, nw, nsp, p +end +S["model/buildmap"] = function(r: Bytes.Reader): number + local b, o, limit = r.buf, r.base, r.limit + if limit - o < HEADER then + return 0 + end + local v = buffer.readu32(b, o) + if v ~= 7 and v ~= 8 and v ~= 9 then + return 0 + end + local ns, _, _, stop = layout(b, o, limit) + if not ns or not stop or stop > limit then + return 0 + end + return if stop == limit then 0.9 else 0.5 +end +end + +do -- model/d3map +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/d3map"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + for _ = 1, 16 do + local rest = string.match(head, "^//[^\n]*\n%s*(.*)$") + if not rest then + break + end + head = rest + end + return if string.match(head, "^Version%s+[123]%s") then 1 else 0 +end +end + +do -- model/dae +local Bytes = __include("core/Bytes") +S["model/dae"] = function(r: Bytes.Reader): number + local head = r:peek(2048) + if string.sub(head, 1, 4) == "PK\3\4" then + local nlen = string.byte(head, 27) or 0 + local name = string.lower(string.sub(head, 31, 30 + nlen)) + if string.find(name, "%.dae$") or name == "manifest.xml" then + return 0.95 + end + return 0 + end + -- UTF-16 files: drop the zero bytes + if string.find(string.sub(head, 1, 4), "\0", 1, true) then + head = string.gsub(head, "%z", "") + end + if string.find(head, "<COLLADA", 1, true) then + return 1 + end + return 0 +end +end + +do -- model/gltf +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["model/gltf"] = function(r: Bytes.Reader): number + if r:peek(4) == "glTF" then + return 1 + end + local head = r:peek(1024) + local s = Sniff.dropBom(head) + if string.find(s, "^%s*{") and string.find(s, "\"asset\"", 1, true) then + return 0.9 + end + if string.find(s, "^%s*{") and (string.find(s, "\"accessors\"", 1, true) or string.find(s, "\"bufferViews\"", 1, true)) then + return 0.6 + end + return 0 +end +end + +do -- model/godot +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/godot"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 256) + if string.match(h, "^%s*%[gd_scene[%s%]]") then + return 1 + end + return 0 +end +end + +do -- model/iqm +local Bytes = __include("core/Bytes") +local MAGIC = "INTERQUAKEMODEL\0" +S["model/iqm"] = function(r: Bytes.Reader): number + return if r:peek(16) == MAGIC then 1 else 0 +end +end + +do -- model/ldraw +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/ldraw"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 2048, true) + if string.find(head, "^0%s+FILE%s") then + return 0.9 + end + if string.find(head, "\n%s*1%s+%S+" .. string.rep("%s+[-+%deE.]+", 12) .. "%s+[^\n]+%.[dDlL][aAdD][tTrR]%s*\r?\n") then + return 0.8 + end + if string.find(head, "^0[ \t]+%a") and string.find(head, "\n%s*[1-5]%s+%S+%s+[-+%d.]+%s+[-+%d.]+%s+[-+%d.]+%s+[-+%d.]+%s+[-+%d.]+%s+[-+%d.]") then + return 0.4 + end + return 0 +end +end + +do -- model/lwo +local Bytes = __include("core/Bytes") +local VERSIONS = { LWO2 = true, LWOB = true, LXOB = true } +S["model/lwo"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "FORM" then + return 0 + end + local v = r:peek(4, 8) + return if VERSIONS[v] then 1 elseif v == "LWO3" then 0.8 else 0 +end +end + +do -- model/map +local Bytes = __include("core/Bytes") +S["model/map"] = function(r: Bytes.Reader): number + local head = r:peek(math.min(r:remaining(), 4096)) + if #head < 2 or string.find(head, "[%z\1-\8\14-\31]") then + return 0 + end + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + local s = head + local game = false + while true do + local c = string.match(s, "^%s*//[^\n]*\n?()") + if not c then + break + end + if string.match(s, "^%s*//%s*Game:") then + game = true + end + s = string.sub(s, c :: number) + end + local body = string.match(s, '^%s*{%s*"[^"\n]*"%s*"') or string.match(s, "^%s*{%s*{%s*[%(bp]") + if not body then + return if game and string.match(s, "^%s*{") then 0.6 else 0 + end + return if game or string.find(head, '"classname"', 1, true) then 0.9 else 0.6 +end +end + +do -- model/mca +local Bytes = __include("core/Bytes") +local COMPRESSION = { [1] = "gzip", [2] = "zlib", [3] = "none", [4] = "lz4", [127] = "custom" } +S["model/mca"] = function(r: Bytes.Reader): number + local n = r.limit - r.base + if n < 8192 then + return 0 + end + local sectors = (n + 4095) // 4096 + local used, b = 0, r.buf + for i = 0, 1023 do + local e = bit32.byteswap(buffer.readu32(b, r.base + i * 4)) + if e ~= 0 then + local off, cnt = e // 256, e % 256 + if off < 2 or cnt == 0 or off + cnt > sectors then + return 0 + end + used += 1 + if used == 1 then + local p = r.base + off * 4096 + if p + 5 > r.limit then + return 0 + end + local c = buffer.readu8(b, p + 4) % 128 + if COMPRESSION[c] == nil then + return 0 + end + end + end + end + return if used > 0 then 0.8 else 0.2 +end +end + +do -- model/md2 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md2"] = function(r: Bytes.Reader): number + if r:remaining() < 68 then + return 0 + end + return if Sniff.magic(r, "IDP2") == 1 and r:peekU8(4) == 8 then 1 else 0 +end +end + +do -- model/md3 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md3"] = function(r: Bytes.Reader): number + if r:remaining() < 108 then + return 0 + end + return if Sniff.magic(r, "IDP3") == 1 and r:peekU8(4) == 15 then 1 else 0 +end +end + +do -- model/md5 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md5"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + head = string.gsub(head, "^//[^\n]*\n%s*", "") + return if string.match(head, "^MD5Version%s+%d+") then 1 else 0 +end +end + +do -- model/mdl +local Bytes = __include("core/Bytes") +S["model/mdl"] = function(r: Bytes.Reader): number + local m = r:peek(4) + local v = r:peekU8(4) + if (m == "IDPO" and v == 6) or (m == "IDST" and v == 10) then + return 1 + end + return 0 +end +end + +do -- model/ms3d +local Bytes = __include("core/Bytes") +local Read = lazy(function() + return __include("model/ms3d/Read") +end) +S["model/ms3d"] = function(r: Bytes.Reader): number + local h = r:peek(14) + if string.sub(h, 1, 10) ~= Read.MAGIC then + return 0 + end + local v = string.byte(h, 11) + return if v == 3 or v == 4 then 1 else 0.6 +end +end + +do -- model/obj +local Bytes = __include("core/Bytes") +S["model/obj"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "\0", 1, true) then + return 0 + end + if string.find(head, "^%s*v%s+[%-%d%.]") or string.find(head, "\n%s*v%s+[%-%d%.]") then + return 0.6 + end + if string.find(head, "^#") and (string.find(head, "\nmtllib ") or string.find(head, "\no ") or string.find(head, "\ng ")) then + return 0.4 + end + return 0 +end +end + +do -- model/off +local Bytes = __include("core/Bytes") +S["model/off"] = function(r: Bytes.Reader): number + local head = r:peek(512) + for _ = 1, 16 do + local rest = string.match(head, "^%s*#[^\n]*\n(.*)$") + if not rest then + break + end + head = rest + end + local kw = string.match(head, "^%s*(%w+)") + if kw and string.match(kw, "^S?T?C?N?4?n?OFF$") then + return 0.9 + end + return 0 +end +end + +do -- model/ply +local Bytes = __include("core/Bytes") +S["model/ply"] = function(r: Bytes.Reader): number + local h = r:peek(4) + return if h == "ply\n" or h == "ply\r" then 1 else 0 +end +end + +do -- model/pmx +local Bytes = __include("core/Bytes") +S["model/pmx"] = function(r: Bytes.Reader): number + local head = r:peek(8) + if string.sub(head, 1, 4) == "PMX " then + return 1 + end + if string.sub(head, 1, 7) == "Pmd\0\0\128\63" then + return 1 + end + return 0 +end +end + +do -- model/proc +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/proc"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64, true) + if string.match(head, "^mapProcFile%d%d%d") then + return 1 + end + if string.match(head, '^"?PROC"?%s+"?%d') then + return 0.9 + end + return 0 +end +end + +do -- model/qb +local Bytes = __include("core/Bytes") +S["model/qb"] = function(r: Bytes.Reader): number + if r:remaining() < 24 or r:peek(4) ~= "\1\1\0\0" then + return 0 + end + local b, p = r.buf, r.pos + local fmt, z, comp, mask = buffer.readu32(b, p + 4), buffer.readu32(b, p + 8), buffer.readu32(b, p + 12), buffer.readu32(b, p + 16) + if fmt > 1 or z > 1 or comp > 1 or mask > 1 then + return 0 + end + return 0.9 +end +end + +do -- model/rbxm +local Bytes = __include("core/Bytes") +local MAGIC = "<roblox!\137\255\13\10\26\10" +S["model/rbxm"] = function(r: Bytes.Reader): number + return if r:peek(14) == MAGIC then 1 else 0 +end +end + +do -- model/rbxmx +local Bytes = __include("core/Bytes") +local find, format, match, gmatch = string.find, string.format, string.match, string.gmatch +S["model/rbxmx"] = function(r: Bytes.Reader): number + local head = r:peek(256) + head = string.gsub(head, "^\239\187\191", "") + head = string.gsub(head, "^%s*<%?xml[^>]*%?>", "") + if match(head, "^%s*<roblox[%s>]") then + return if find(head, "version=", 1, true) then 1 else 0.8 + end + return 0 +end +end + +do -- model/robloxmesh +local Bytes = __include("core/Bytes") +S["model/robloxmesh"] = function(r: Bytes.Reader): number + return if string.match(r:peek(13), "^version [1-7]%.%d%d[\r\n]") then 1 else 0 +end +end + +do -- model/schematic +local Bytes = __include("core/Bytes") +local Nbt = lazy(function() + return __include("codecs/text/Nbt") +end) +local LITEMATIC_HINTS = { "Regions", "EnclosingSize", "RegionCount", "TotalVolume", "MinecraftDataVersion" } +local SPONGE_HINTS = { "BlockData", "PaletteMax" } -- v1 / v2 fields (some writers leave the root unnamed) +local function hinted(head: string, hints: { string }): boolean + for _, h in hints do + if string.find(head, string.char(0, #h) .. h, 1, true) then + return true + end + end + return false +end +S["model/schematic"] = function(r: Bytes.Reader): number + local p = Nbt.peek(r.buf, r.base, r.limit - r.base) + if not p or p.rootType ~= "compound" or p.endian ~= "big" then + return 0 + end + if p.name == "Schematic" or (p.firstName == "Schematic" and p.firstType == "compound") then + return 1 + end + local head = buffer.tostring(p.head) + return if hinted(head, LITEMATIC_HINTS) or hinted(head, SPONGE_HINTS) then 1 else 0 +end +end + +do -- model/smd +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/smd"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 256, true) + head = string.gsub(head, "^//[^\n]*\n%s*", "") + if string.match(head, "^version%s+1%s") and string.find(head, "nodes", 1, true) then + return 0.9 + end + return 0 +end +end + +do -- model/sourcemdl +local Bytes = __include("core/Bytes") +S["model/sourcemdl"] = function(r: Bytes.Reader): number + if r.limit - r.base < 8 or r:peek(4) ~= "IDST" then + return 0 + end + local v = buffer.readi32(r.buf, r.base + 4) + return if v >= 44 and v <= 49 then 1 else 0 +end +end + +do -- model/stl +local Bytes = __include("core/Bytes") +local function lower5(s: string): boolean + return string.lower(s) == "solid" +end +S["model/stl"] = function(r: Bytes.Reader): number + local size = r:remaining() + if size >= 84 then + local c = r:peek(4, 80) + local n = string.byte(c, 1) + string.byte(c, 2) * 256 + string.byte(c, 3) * 65536 + string.byte(c, 4) * 16777216 + if 84 + 50 * n == size then + return 0.9 + end + end + local head = r:peek(512) + local s = string.match(head, "^%s*(%a+)") + if s and lower5(s) then + local l = string.lower(head) + return if string.find(l, "facet", 1, true) or string.find(l, "endsolid", 1, true) then 0.9 else 0.5 + end + return 0 +end +end + +do -- model/t3d +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/t3d"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 512) + local first = string.match(h, "^%s*(Begin%s+%a+)") + if first == nil then + return 0 + end + local kind = string.lower(string.match(first, "%a+$") or "") + if kind == "map" or kind == "actor" or kind == "level" or kind == "brush" or kind == "polylist" then + return 0.9 + end + return 0.3 +end +end + +do -- model/udmf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/udmf"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 1024, true) + for _ = 1, 32 do + local rest = string.match(head, "^//[^\n]*\n%s*(.*)$") or string.match(head, "^/%*.-%*/%s*(.*)$") + if not rest then + break + end + head = rest + end + if string.match(head, "^[Nn][Aa][Mm][Ee][Ss][Pp][Aa][Cc][Ee]%s*=%s*\"") then + return 0.9 + end + return 0 +end +end + +do -- model/usda +local Bytes = __include("core/Bytes") +local function isUsdz(r: Bytes.Reader): boolean + if r:peek(4) ~= "PK\3\4" then + return false + end + local lo, hi = r:peekU8(26), r:peekU8(27) + if lo < 0 or hi < 0 then + return false + end + local nameLen = lo + hi * 256 + local name = string.lower(r:peek(30 + nameLen)) + name = string.sub(name, 31) + return string.find(name, "%.usd[ac]?$") ~= nil +end +S["model/usda"] = function(r: Bytes.Reader): number + local head = r:peek(8) + if string.sub(head, 1, 5) == "#usda" or string.sub(head, 1, 8) == "\239\187\191#usda" then + return 1 + end + if head == "PXR-USDC" then + return 0.9 -- USDC magic, so the error says it is unsupported + end + if isUsdz(r) then + return 0.95 + end + return 0 +end +end + +do -- model/vbsp +local Bytes = __include("core/Bytes") +local HEADER = 8 + 64 * 16 + 4 +S["model/vbsp"] = function(r: Bytes.Reader): number + if r:remaining() < HEADER or r:peek(4) ~= "VBSP" then + return 0 + end + local v = buffer.readi32(r.buf, r.pos + 4) + return if v >= 19 and v <= 21 then 1 else 0.5 +end +end + +do -- model/vmf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/vmf"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + if string.find(head, "%z") then + return 0 + end + if string.match(head, "^versioninfo%s*{") or string.match(head, '^"versioninfo"%s*{') then + return 0.9 + end + if string.match(head, "^world%s*{") or string.match(head, "^visgroups%s*{") then + return 0.6 + end + return 0 +end +end + +do -- model/vox +local Bytes = __include("core/Bytes") +S["model/vox"] = function(r: Bytes.Reader): number + return if r:peek(4) == "VOX " and r:peek(4, 8) == "MAIN" then 1 elseif r:peek(4) == "VOX " then 0.8 else 0 +end +end + +do -- model/vrml +local Bytes = __include("core/Bytes") +S["model/vrml"] = function(r: Bytes.Reader): number + local head = r:peek(16) + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + return if string.sub(head, 1, 10) == "#VRML V2.0" then 1 elseif string.sub(head, 1, 6) == "#VRML " then 0.6 else 0 +end +end + +do -- model/x +local Bytes = __include("core/Bytes") +local ENCODINGS = { ["txt "] = "text", ["bin "] = "binary", tzip = "text", bzip = "binary" } +S["model/x"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "xof " then + return 0 + end + return if ENCODINGS[r:peek(4, 8)] then 1 else 0.5 +end +end + +do -- model/x3d +local Bytes = __include("core/Bytes") +S["model/x3d"] = function(r: Bytes.Reader): number + local head = r:peek(1024) + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + if string.sub(head, 1, 5) == "#X3D " then + return 1 + end + if string.sub(head, 1, 4) == "\224\0\0\1" and string.find(head, "x3d", 1, true) then + return 0.9 + end + if string.find(head, "<X3D[%s>]") or string.find(head, "<!DOCTYPE X3D", 1, true) then + return 1 + end + return 0 +end +end + +do -- cad/step +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["cad/step"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 256) + head = string.gsub(head, "^%s*/%*.-%*/", "") + if string.find(head, "^%s*ISO%-10303%-21%s*;") then + return 1 + end + return 0 +end +end + +do -- font/bdf +local Bytes = __include("core/Bytes") +S["font/bdf"] = function(r: Bytes.Reader): number + local head = r:peek(32) + return if string.match(head, "^STARTFONT%s+2%.%d") then 1 else 0 +end +end + +do -- font/bmfont +local Bytes = __include("core/Bytes") +S["font/bmfont"] = function(r: Bytes.Reader): number + local head = r:peek(64) + if string.sub(head, 1, 4) == "BMF\3" then + return 1 + end + if string.match(head, "^info%s+face=") or string.match(head, "^info%s+") and string.find(head, "size=", 1, true) then + return 0.9 + end + if string.find(head, "<font>", 1, true) or (string.find(head, "<?xml", 1, true) and string.find(r:peek(512), "<font>", 1, true)) then + return if string.find(r:peek(512), "<info", 1, true) then 0.9 else 0.3 + end + return 0 +end +end + +do -- font/eot +local Bytes = __include("core/Bytes") +local MAGIC = 0x504C +S["font/eot"] = function(r: Bytes.Reader): number + local h = r:peek(36) + if #h < 36 then + return 0 + end + local ver = string.sub(h, 9, 12) + local magic = string.byte(h, 35) + string.byte(h, 36) * 256 + if magic == MAGIC and (ver == "\0\0\1\0" or ver == "\1\0\2\0" or ver == "\2\0\2\0") then + return 1 + end + return 0 +end +end + +do -- font/fon +local Bytes = __include("core/Bytes") +local function isFnt(h: string): boolean + if #h < 4 then + return false + end + local ver = string.byte(h, 1) + string.byte(h, 2) * 256 + return ver == 0x200 or ver == 0x300 +end +S["font/fon"] = function(r: Bytes.Reader): number + local h = r:peek(64) + if string.sub(h, 1, 2) == "MZ" and #h >= 64 then + local lfanew = string.byte(h, 61) + string.byte(h, 62) * 256 + string.byte(h, 63) * 65536 + local sig = r:peek(2, lfanew) + return if sig == "NE" then 0.6 elseif sig == "PE" then 0.2 else 0 + end + if isFnt(h) and #h >= 6 then + local size = string.byte(h, 3) + string.byte(h, 4) * 256 + string.byte(h, 5) * 65536 + string.byte(h, 6) * 16777216 + return if size == r:size() then 0.9 elseif size <= r:size() and size > 118 then 0.3 else 0 + end + return 0 +end +end + +do -- font/hershey +local Bytes = __include("core/Bytes") +local function header(line: string): (number?, number?) + if #line < 10 then + return nil, nil + end + local id = tonumber((string.gsub(string.sub(line, 1, 5), "^%s+", ""))) + local n = tonumber((string.gsub(string.sub(line, 6, 8), "^%s+", ""))) + if not id or not n or n < 1 or string.find(string.sub(line, 1, 8), "[^%d ]") then + return nil, nil + end + return id, n +end +S["font/hershey"] = function(r: Bytes.Reader): number + local head = r:peek(256) + local line = string.match(head, "^([^\r\n]*)") + local id, n = header(line or "") + if not id or not n then + return 0 + end + local body = string.sub(line :: string, 9) + if string.find(body, "[^ -~]") then + return 0 + end + return if #body == math.min(2 * n, 64) or #body == 2 * n then 0.7 else 0.3 +end +end + +do -- font/pcf +local Bytes = __include("core/Bytes") +S["font/pcf"] = function(r: Bytes.Reader): number + return if r:peek(4) == "\1fcp" then 1 else 0 +end +end + +do -- font/psf +local Bytes = __include("core/Bytes") +S["font/psf"] = function(r: Bytes.Reader): number + local h = r:peek(4) + if h == "\114\181\74\134" then + return 1 + end + if string.sub(h, 1, 2) == "\54\4" and #h >= 4 and string.byte(h, 3) <= 7 and string.byte(h, 4) > 0 then + return 0.9 + end + return 0 +end +end + +do -- font/ttf +local Bytes = __include("core/Bytes") +S["font/ttf"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "\0\1\0\0" or m == "OTTO" or m == "ttcf" or m == "true" then + return 0.9 + end + return 0 +end +end + +do -- font/type1 +local Bytes = __include("core/Bytes") +S["font/type1"] = function(r: Bytes.Reader): number + local h = r:peek(64) + if string.sub(h, 1, 2) == "\128\1" then + h = string.sub(h, 7) + end + if string.sub(h, 1, 14) == "%!PS-AdobeFont" or string.sub(h, 1, 10) == "%!FontType" then + return 1 + end + return 0 +end +end + +do -- font/woff +local Bytes = __include("core/Bytes") +S["font/woff"] = function(r: Bytes.Reader): number + return if r:peek(4) == "wOFF" then 1 else 0 +end +end + +do -- font/woff2 +local Bytes = __include("core/Bytes") +S["font/woff2"] = function(r: Bytes.Reader): number + return if r:peek(4) == "wOF2" then 1 else 0 +end +end + +do -- archive/7z +local Bytes = __include("core/Bytes") +local MAGIC = "7z\188\175\39\28" +S["archive/7z"] = function(r: Bytes.Reader): number + return if r:peek(6) == MAGIC then 1 else 0 +end +end + +do -- archive/adf +local Bytes = __include("core/Bytes") +local BS = 512 +S["archive/adf"] = function(r: Bytes.Reader): number + local n = r:size() + if n < 4 * BS or n % BS ~= 0 then + return 0 + end + local h = r:peek(4) + if string.sub(h, 1, 3) ~= "DOS" or string.byte(h, 4) > 5 then + return 0 + end + return if n == 901120 or n == 1802240 then 0.95 else 0.6 +end +end + +do -- archive/applesingle +local Bytes = __include("core/Bytes") +S["archive/applesingle"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h < 8 then + return 0 + end + local magic = string.sub(h, 1, 4) + local ver = string.sub(h, 5, 8) + if (magic == "\0\5\22\0" or magic == "\0\5\22\7") and (ver == "\0\1\0\0" or ver == "\0\2\0\0") then + return 1 + end + return 0 +end +end + +do -- archive/ar +local Bytes = __include("core/Bytes") +local MAGIC = "!<arch>\n" +S["archive/ar"] = function(r: Bytes.Reader): number + if r:peek(8) == MAGIC then + return if r:peek(13, 68) == "debian-binary" then 1 else 0.9 + end + return if r:peek(8) == "!<thin>\n" then 0.5 else 0 +end +end + +do -- archive/arj +local Bytes = __include("core/Bytes") +S["archive/arj"] = function(r: Bytes.Reader): number + local h = r:peek(4) + if #h == 4 and string.byte(h, 1) == 0x60 and string.byte(h, 2) == 0xEA then + local size = string.byte(h, 3) + string.byte(h, 4) * 256 + return if size > 0 and size <= 2600 then 0.9 else 0 + end + return 0 +end +end + +do -- archive/binhex +local Bytes = __include("core/Bytes") +local BANNER = "(This file must be converted with BinHex" +S["archive/binhex"] = function(r: Bytes.Reader): number + local head = r:peek(2048) + local at = string.find(head, BANNER, 1, true) + if not at then + return 0 + end + return if at == 1 then 1 else 0.8 +end +end + +do -- archive/br +local Err = __include("core/Err") +local Bytes = __include("core/Bytes") +local Brotli = lazy(function() + return __include("codecs/compress/Brotli") +end) +local SNIFF_WHOLE = 262144 -- streams up to this size are decoded whole by sniff +local SNIFF_PREFIX = 65536 +S["archive/br"] = function(r: Bytes.Reader): number + local n = r:remaining() + if n == 0 then + return 0 + end + if n <= SNIFF_WHOLE then + local out, consumed = Brotli.decompress(r.buf, r.pos, n, { maxBytes = 2 ^ 26 }) + if out and consumed == r.limit then + return if buffer.len(out) > 0 then 0.3 else 0.05 + end + return 0 + end + local _, err = Brotli.decompress(r.buf, r.pos, SNIFF_PREFIX, { maxBytes = 2 ^ 22 }) + if err and (err.code == Err.TRUNCATED or err.code == Err.LIMIT) then + return 0.05 + end + return 0 +end +end + +do -- archive/bz2 +local Bytes = __include("core/Bytes") +S["archive/bz2"] = function(r: Bytes.Reader): number + local h = r:peek(10) + if #h < 10 or string.sub(h, 1, 3) ~= "BZh" then + return 0 + end + local lv = string.byte(h, 4) + if lv < 0x31 or lv > 0x39 then + return 0 + end + local magic = string.sub(h, 5, 10) + if magic == "\x31\x41\x59\x26\x53\x59" or magic == "\x17\x72\x45\x38\x50\x90" then + return 1 + end + return 0 +end +end + +do -- archive/cab +local Bytes = __include("core/Bytes") +S["archive/cab"] = function(r: Bytes.Reader): number + if r:peek(8) == "MSCF\0\0\0\0" then + return 1 + end + return 0 +end +end + +do -- archive/cpio +local Bytes = __include("core/Bytes") +S["archive/cpio"] = function(r: Bytes.Reader): number + local m = r:peek(6) + if m == "070701" or m == "070702" or m == "070707" then + return 1 + end + local b2 = r:peek(2) + if (b2 == "\199\113" or b2 == "\113\199") and r:remaining() >= 26 then + return 0.5 + end + return 0 +end +end + +do -- archive/d64 +local Bytes = __include("core/Bytes") +type Geometry = { kind: string, tracks: number, offsets: { number }, spt: { number }, dirTrack: number, total: number } +local function geometry(kind: string, tracks: number): Geometry + local offsets, spt = {}, {} + local o = 0 + for t = 1, tracks do + local n + if kind == "d81" then + n = 40 + else + local s = if kind == "d71" and t > 35 then t - 35 else t + n = if s <= 17 then 21 elseif s <= 24 then 19 elseif s <= 30 then 18 else 17 + end + offsets[t], spt[t] = o, n + o += n * 256 + end + return { kind = kind, tracks = tracks, offsets = offsets, spt = spt, dirTrack = if kind == "d81" then 40 else 18, total = o } +end +local function detect(len: number): Geometry? + for _, g in { { "d64", 35 }, { "d64", 40 }, { "d64", 42 }, { "d71", 70 }, { "d81", 80 } } :: { { any } } do + local geo = geometry(g[1] :: string, g[2] :: number) + local sectors = geo.total // 256 + if len == geo.total or (g[1] ~= "d81" and len == geo.total + sectors) then + return geo + end + end + return nil +end +S["archive/d64"] = function(r: Bytes.Reader): number + local geo = detect(r:size()) + if not geo then + return 0 + end + -- the BAM / header sector: dir track link and DOS version byte + local h = r:sub(geo.offsets[geo.dirTrack], 256) + local t, s, v = h:u8(), h:u8(), h:u8() + if geo.kind == "d81" then + return if t == 40 and s == 3 and v == 0x44 then 0.9 else 0.3 + end + return if t == 18 and s == 1 and (v == 0x41 or v == 0) then 0.9 else 0.3 +end +end + +do -- archive/fat +local Bytes = __include("core/Bytes") +local Fat = lazy(function() + return __include("containers/Fat") +end) +S["archive/fat"] = function(r: Bytes.Reader): number + if r:remaining() < 512 then + return 0 + end + local v = Fat.open(r.buf, r.base + r.pos, r.limit - r.base - r.pos) + if not v then + return 0 + end + return if v.partition then 0.6 else 0.8 +end +end + +do -- archive/grp +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "KenSilverman" +S["archive/grp"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- archive/gzip +local Bytes = __include("core/Bytes") +S["archive/gzip"] = function(r: Bytes.Reader): number + return if r:peek(3) == "\31\139\8" then 1 else 0 +end +end + +do -- archive/iso +local Bytes = __include("core/Bytes") +S["archive/iso"] = function(r: Bytes.Reader): number + return if r:peek(5, 16 * 2048 + 1) == "CD001" then 1 else 0 +end +end + +do -- archive/lha +local Bytes = __include("core/Bytes") +local METHODS: { [string]: boolean } = { + ["-lh0-"] = true, ["-lz4-"] = true, ["-lhd-"] = true, ["-lh1-"] = true, ["-lh4-"] = true, ["-lh5-"] = true, + ["-lh6-"] = true, ["-lh7-"] = true, ["-lhx-"] = true, ["-lzs-"] = true, ["-lz5-"] = true, ["-lh2-"] = true, + ["-lh3-"] = true, ["-pm0-"] = true, ["-pm1-"] = true, ["-pm2-"] = true, ["-lk7-"] = true, +} +local function isHeader(s: string): boolean + if #s < 22 then + return false + end + local m = string.sub(s, 3, 7) + local level = string.byte(s, 21) + return METHODS[m] == true and level <= 3 +end +S["archive/lha"] = function(r: Bytes.Reader): number + if isHeader(r:peek(22)) then + return 0.95 + end + return 0 +end +end + +do -- archive/lz4 +local Bytes = __include("core/Bytes") +S["archive/lz4"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "\4\34\77\24" then + return 1 + elseif m == "\2\33\76\24" then + return 0.9 + elseif #m == 4 and string.byte(m, 1) >= 0x50 and string.byte(m, 1) <= 0x5F and string.sub(m, 2) == "\42\77\24" then + -- a skippable frame (zstd shares the magic): an LZ4 frame after it + local h = r:peek(4, 4) + if #h == 4 then + local n = string.byte(h, 1) + string.byte(h, 2) * 256 + string.byte(h, 3) * 65536 + string.byte(h, 4) * 16777216 + if r:peek(4, 8 + n) == "\4\34\77\24" then + return 1 + end + end + end + return 0 +end +end + +do -- archive/macbinary +local Bytes = __include("core/Bytes") +local Crc16 = __include("core/Crc16") +local function version(b: buffer, o: number, len: number): string? + if len < 128 then + return nil + end + local u8 = function(i: number): number + return buffer.readu8(b, o + i) + end + if u8(0) ~= 0 or u8(74) ~= 0 then + return nil + end + local nameLen = u8(1) + if nameLen < 1 or nameLen > 63 then + return nil + end + local function be32(i: number): number + return u8(i) * 16777216 + u8(i + 1) * 65536 + u8(i + 2) * 256 + u8(i + 3) + end + local dlen, rlen = be32(83), be32(87) + if dlen > 0x7FFFFFFF or rlen > 0x7FFFFFFF then + return nil + end + local crc = u8(124) * 256 + u8(125) + if crc == Crc16.ccitt(b, o, 124) and (crc ~= 0 or u8(122) >= 129) then + return if buffer.readstring(b, o + 102, 4) == "mBIN" then "III" else "II" + end + if buffer.readstring(b, o + 102, 4) == "mBIN" then + return nil -- III with a bad CRC + end + -- MacBinary I: byte 82 zero, bytes 99..125 zero, the forks within the file + if u8(82) ~= 0 then + return nil + end + for i = 99, 125 do + if u8(i) ~= 0 then + return nil + end + end + local need = 128 + math.ceil(dlen / 128) * 128 + rlen + return if need <= len + 127 then "I" else nil +end +S["archive/macbinary"] = function(r: Bytes.Reader): number + local n = math.min(r:remaining(), 128) + if n < 128 then + return 0 + end + local v = version(r.buf, r.base + r.pos, r.limit - r.base - r.pos) + return if v == "III" then 0.95 elseif v == "II" then 0.8 elseif v == "I" then 0.3 else 0 +end +end + +do -- archive/mpq +local Bytes = __include("core/Bytes") +S["archive/mpq"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "MPQ\x1A" or m == "MPQ\x1B" then + return 1 + end + -- a prefixed archive (an installer stub): the header on a 512-byte boundary in the first 64 KB + for at = 512, math.min(65536, r:remaining() - 32), 512 do + if r:peek(4, at) == "MPQ\x1A" then + return 0.6 + end + end + return 0 +end +end + +do -- archive/pak +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["archive/pak"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + return math.max(Sniff.magic(r, "PACK", 0, 0.9), Sniff.magic(r, "SPAK", 0, 0.9)) +end +end + +do -- archive/rpm +local Bytes = __include("core/Bytes") +local LEAD_MAGIC = "\237\171\238\219" +S["archive/rpm"] = function(r: Bytes.Reader): number + return if r:peek(4) == LEAD_MAGIC then 1 else 0 +end +end + +do -- archive/tar +local Bytes = __include("core/Bytes") +local Tar = lazy(function() + return __include("containers/Tar") +end) +S["archive/tar"] = function(r: Bytes.Reader): number + if r:remaining() < 512 then + return 0 + end + if not Tar.valid(r.buf, r.pos) then + return 0 + end + return if r:peek(5, 257) == "ustar" then 0.95 else 0.6 +end +end + +do -- archive/unitypackage +local Bytes = __include("core/Bytes") +local Deflate = lazy(function() + return __include("codecs/compress/Deflate") +end) +local Tar = lazy(function() + return __include("containers/Tar") +end) +local function guidOf(name: string): (string?, string?) + local n = string.gsub(name, "^%./", "") + local guid, rest = string.match(n, "^(%x+)/?(.*)$") + if guid and #guid == 32 then + return string.lower(guid), rest + end + return nil, nil +end +S["archive/unitypackage"] = function(r: Bytes.Reader): number + if r:peek(3) ~= "\31\139\8" then + return 0 + end + local head = Deflate.peek(r.buf, r.pos, r.limit - r.pos, 512) + if not head or buffer.len(head) < 512 or not Tar.valid(head, 0) then + return 0 + end + local z = 0 + while z < 100 and buffer.readu8(head, z) ~= 0 do + z += 1 + end + return if guidOf(buffer.readstring(head, 0, z)) then 1 else 0 -- ties with archive/gzip go to the extension +end +end + +do -- archive/uu +local Bytes = __include("core/Bytes") +S["archive/uu"] = function(r: Bytes.Reader): number + local head = r:peek(4096) + if string.match(head, "^begin%-base64 [0-7]+ [^\r\n]") or string.match(head, "^begin [0-7]+ [^\r\n]") then + return 0.9 + end + if string.match(head, "\nbegin%-base64 [0-7]+ [^\r\n]") or string.match(head, "\nbegin [0-7][0-7][0-7]+ [^\r\n]") then + return 0.5 + end + return 0 +end +end + +do -- archive/vpk +local Bytes = __include("core/Bytes") +S["archive/vpk"] = function(r: Bytes.Reader): number + if r:remaining() < 12 or r:peek(4) ~= "\x34\x12\xAA\x55" then + return 0 + end + local v = r:peekU8(4) + return if v == 1 or v == 2 then 1 else 0.5 +end +end + +do -- archive/vswap +local Bytes = __include("core/Bytes") +local readu8, readu16, readi16, writeu32 = buffer.readu8, buffer.readu16, buffer.readi16, buffer.writeu32 +local function header(r: Bytes.Reader): (number?, number, number) + if r:remaining() < 6 then + return nil, 0, 0 + end + local n, ss, so = readu16(r.buf, r.base), readu16(r.buf, r.base + 2), readu16(r.buf, r.base + 4) + if n == 0 or ss > so or so > n or 6 + n * 6 > r:remaining() then + return nil, 0, 0 + end + return n, ss, so +end +S["archive/vswap"] = function(r: Bytes.Reader): number + local n = header(r) + if not n then + return 0 + end + local size = r.limit - r.base + local b = r.buf + local last = 6 + n * 6 + local nonzero = 0 + for i = 0, n - 1 do + local o = buffer.readu32(b, r.base + 6 + i * 4) + local l = readu16(b, r.base + 6 + n * 4 + i * 2) + if o ~= 0 then + if o < last or o + l > size then + return 0 + end + last = o + nonzero += 1 + end + end + return if nonzero > 0 then 0.6 else 0 +end +end + +do -- archive/wad +local Bytes = __include("core/Bytes") +S["archive/wad"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + local m = r:peek(4) + if m ~= "IWAD" and m ~= "PWAD" then + return 0 + end + return 0.9 +end +end + +do -- archive/wad2 +local Bytes = __include("core/Bytes") +S["archive/wad2"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + local m = r:peek(4) + return if m == "WAD2" or m == "WAD3" then 0.9 else 0 +end +end + +do -- archive/xz +local Bytes = __include("core/Bytes") +local XZ_MAGIC = "\253" .. "7zXZ\0" +local function aloneScore(r: Bytes.Reader): number + local h = r:peek(14) + if #h < 14 then + return 0 + end + local d = string.byte(h, 1) + if d >= 225 or string.byte(h, 14) ~= 0 then + return 0 + end + local dict = string.byte(h, 2) + string.byte(h, 3) * 256 + string.byte(h, 4) * 65536 + string.byte(h, 5) * 16777216 + local okDict = false + for n = 12, 31 do + if dict == 2 ^ n or (n < 31 and dict == 2 ^ n + 2 ^ (n - 1)) then + okDict = true + break + end + end + if not okDict then + return 0 + end + local s = string.sub(h, 6, 13) + if s ~= string.rep("\255", 8) and (string.byte(h, 11) ~= 0 or string.byte(h, 12) ~= 0 or string.byte(h, 13) ~= 0) then + return 0 + end + return if d == 0x5D then 0.4 else 0.2 +end +S["archive/xz"] = function(r: Bytes.Reader): number + if r:peek(6) == XZ_MAGIC then + return 1 + end + return aloneScore(r) +end +end + +do -- archive/yenc +local Bytes = __include("core/Bytes") +S["archive/yenc"] = function(r: Bytes.Reader): number + local head = r:peek(4096) + if string.match(head, "^=ybegin ") then + return 0.95 + end + return if string.find(head, "\n=ybegin [^\n]*name=") then 0.6 else 0 +end +end + +do -- archive/z +local Bytes = __include("core/Bytes") +S["archive/z"] = function(r: Bytes.Reader): number + if r:peek(2) ~= "\31\157" then + return 0 + end + local f = r:peekU8(2) + return if f >= 0 and bit32.band(f, 0x60) == 0 and bit32.band(f, 0x1F) >= 9 and bit32.band(f, 0x1F) <= 16 then 1 else 0.3 +end +end + +do -- archive/zip +local Bytes = __include("core/Bytes") +S["archive/zip"] = function(r: Bytes.Reader): number + local s = r:peek(4) + -- ZIP-based formats (docx, jar, 3mf, ...) score higher in their own sniff + if s == "PK\3\4" or s == "PK\5\6" then + return 0.6 + end + if string.sub(s, 1, 2) == "MZ" then + return 0 -- a self-extractor opens with Zip.decode / opts.format = "zip" + end + return 0 +end +end + +do -- archive/zoo +local Bytes = __include("core/Bytes") +local TAG = 0xFDC4A7DC +S["archive/zoo"] = function(r: Bytes.Reader): number + local h = r:peek(24) + if #h < 24 then + return 0 + end + local tag = string.byte(h, 21) + string.byte(h, 22) * 256 + string.byte(h, 23) * 65536 + string.byte(h, 24) * 16777216 + if tag ~= TAG then + return 0 + end + return if string.sub(h, 1, 4) == "ZOO " then 1 else 0.8 +end +end + +do -- archive/zst +local Bytes = __include("core/Bytes") +local Zstd = lazy(function() + return __include("codecs/compress/Zstd") +end) +S["archive/zst"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == Zstd.MAGIC then + return 1 + end + -- a skippable frame (0x184D2A50 .. 0x184D2A5F) is usually followed by a zstd frame + if #m == 4 and string.sub(m, 2, 4) == "\42\77\24" and bit32.band(string.byte(m, 1), 0xF0) == 0x50 then + return 0.5 + end + return 0 +end +end + +do -- data/cbor +local Bytes = __include("core/Bytes") +S["data/cbor"] = function(r: Bytes.Reader): number + return if r:peek(3) == "\217\217\247" then 1 else 0 +end +end + +do -- data/csv +local Bytes = __include("core/Bytes") +local find, sub, byte, gsub = string.find, string.sub, string.byte, string.gsub +S["data/csv"] = function(r: Bytes.Reader): number + local head = r:peek(1024) + if find(head, "%z") then + return 0 + end + local l1, l2 = string.match(head, "^([^\r\n]*)\r?\n([^\r\n]*)") + if not l1 or l1 == "" then + return 0 + end + for _, d in { ",", "\t", ";" } do + local _, c1 = gsub(l1, d, "") + local _, c2 = gsub(l2 :: string, d, "") + if c1 > 0 and c1 == c2 then + return 0.15 + end + end + return 0 +end +end + +do -- data/ini +local Bytes = __include("core/Bytes") +S["data/ini"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "%z") then + return 0 + end + local first = string.match(head, "^[%s]*([^\r\n]*)") + while first and string.match(first, "^[;#]") do + head = string.match(head, "^[^\n]*\n(.*)$") or "" + first = string.match(head, "^[%s]*([^\r\n]*)") + end + if first and string.match(first, "^%[[^%]]+%]%s*$") then + return 0.2 + end + return 0 +end +end + +do -- data/json +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["data/json"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + local first = string.match(head, "^[ \t\r\n]*(.)") + if first == "{" then + local nxt = string.match(head, "^[^{]*{[ \t\r\n]*(.)") + return if nxt == nil or nxt == '"' or nxt == "}" then 0.6 else 0.1 + elseif first == "[" then + -- past any nested '[': a JSON value must start (TOML / INI "[section]" and "[[table]]" do not) + local nxt = string.match(head, "^[ \t\r\n]*[%[ \t\r\n]*(.)") + if nxt == nil or string.find('{"-0123456789tfn]', nxt, 1, true) then + return 0.3 + end + return 0 + end + return 0 +end +end + +do -- data/msgpack +local Bytes = __include("core/Bytes") +S["data/msgpack"] = function(_r: Bytes.Reader): number + return 0 -- no magic: by extension or opts.format only +end +end + +do -- data/nbt +local Bytes = __include("core/Bytes") +local Nbt = lazy(function() + return __include("codecs/text/Nbt") +end) +S["data/nbt"] = function(r: Bytes.Reader): number + local p = Nbt.peek(r.buf, r.base, r.limit - r.base) + if not p or p.rootType ~= "compound" then + return 0 + end + if p.compression ~= "none" then + return if p.firstType then 1 else 0.5 -- gzip wrapped NBT: ties with archive/gzip go to the extension + end + return if p.firstType and p.firstName then 0.6 else 0.2 +end +end + +do -- data/plist +local Bytes = __include("core/Bytes") +S["data/plist"] = function(r: Bytes.Reader): number + local head = r:peek(256) + if string.sub(head, 1, 6) == "bplist" then + return 1 + end + if string.find(head, "<!DOCTYPE plist", 1, true) or string.find(head, "<plist", 1, true) then + return 0.9 + end + return 0 +end +end + +do -- data/q3shader +local Bytes = __include("core/Bytes") +local KEYWORDS = { "surfaceparm", "map", "clampmap", "animmap", "blendfunc", "rgbgen", "alphagen", "tcgen", "tcmod", + "cull", "deformvertexes", "qer_editorimage", "nopicmip", "nomipmaps", "skyparms", "q3map_", "depthwrite", "alphafunc" } +S["data/q3shader"] = function(r: Bytes.Reader): number + local head = r:peek(math.min(r:remaining(), 2048)) + if #head < 4 or string.find(head, "[%z\1-\8\14-\31]") then + return 0 + end + local s = string.gsub(string.gsub(head, "/%*.-%*/", " "), "//[^\n]*", "") + if not string.match(s, "^%s*[^%s{}\"]+%s*{") then + return 0 + end + local lower = string.lower(s) + for _, k in KEYWORDS do + if string.find(lower, "%f[%w_]" .. k) then + return 0.7 + end + end + return 0.2 +end +end + +do -- data/q3skin +local Bytes = __include("core/Bytes") +S["data/q3skin"] = function(r: Bytes.Reader): number + local head = r:peek(math.min(r:remaining(), 1024)) + if #head < 3 or string.find(head, "[%z\1-\8\14-\31]") then + return 0 + end + local lines, good, paths = 0, 0, 0 + for line in string.gmatch(head, "[^\r\n]+") do + if not string.match(line, "^%s*$") then + lines += 1 + local surface, shader = string.match(line, "^%s*([%w_%-]+)%s*,%s*([^,%s]*)%s*$") + if surface and shader == "" and string.sub(string.lower(surface), 1, 4) == "tag_" then + good += 1 + elseif shader and string.find(shader, "/", 1, true) then + good += 1 + paths += 1 + end + end + end + return if lines > 0 and good == lines and paths > 0 then 0.5 else 0 +end +end + +do -- data/snbt +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["data/snbt"] = function(r: Bytes.Reader): number + -- SNBT has what JSON never has: unquoted keys, typed numbers (1b, 2.5f), [I; arrays, single-quoted strings + local head = Sniff.text(r, 512, true) + local first = string.sub(head, 1, 1) + if first ~= "{" and first ~= "[" then + return 0 + end + if string.find(head, "[{,]%s*[%a_][%w_%-%.%+]*%s*:") or string.find(head, "%d[bBsSlLfFdD]%s*[,}%]]") + or string.find(head, "%[[BIL]%s*;") or string.find(head, "[:,%[]%s*'") + then + return 0.7 + end + return 0 +end +end + +do -- data/toml +local Bytes = __include("core/Bytes") +S["data/toml"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "%z") then + return 0 + end + for line in string.gmatch(head, "[^\n]+") do + local l = string.match(line, "^[ \t]*(.-)[ \t\r]*$") :: string + if l ~= "" and string.sub(l, 1, 1) ~= "#" then + if string.match(l, "^%[%[?[%w_%-%.\"' ]+%]%]?$") or string.match(l, "^[%w_%-%.\"']+[ \t]*=[ \t]*[\"'%[{%dtf%+%-in]") then + return 0.2 + end + return 0 + end + end + return 0 +end +end + +do -- data/tres +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["data/tres"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 256) + if string.match(h, "^%s*%[gd_resource[%s%]]") then + return 1 + end + return 0 +end +end + +do -- data/vdf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local KeyValues = lazy(function() + return __include("codecs/text/KeyValues") +end) +S["data/vdf"] = function(r: Bytes.Reader): number + local n = r:remaining() + if KeyValues.isBinary(r.buf, r.pos, n) then + return 0.3 + end + local head = Sniff.text(r, 256, true) + if string.find(head, "%z") then + return 0 + end + head = string.gsub(head, "^//[^\n]*\n%s*", "") + if string.match(head, '^"[^"\n]+"%s*{') or string.match(head, '^"[^"\n]+"%s*%[[^%]\n]*%]%s*{') then + return 0.6 + end + if string.match(head, "^#base%s") or string.match(head, "^#include%s") then + return 0.5 + end + if string.match(head, '^[%w_]+%s*\n%s*{%s*\n%s*"') then + return 0.3 + end + return 0 +end +end + +do -- data/xml +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["data/xml"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + if string.match(head, "^<%?xml[ \t\r\n]") or string.sub(head, 1, 4) == "\255\254<\0" or string.sub(head, 1, 4) == "\254\255\0<" then + return 0.5 + end + if string.match(head, "^[ \t\r\n]*<[%a!]") then + return 0.3 + end + return 0 +end +end + +do -- data/yaml +local Bytes = __include("core/Bytes") +S["data/yaml"] = function(r: Bytes.Reader): number + local head = r:peek(256) + if string.find(head, "%z") then + return 0 + end + if string.match(head, "^%%YAML ") then + return 0.9 + end + if string.match(head, "^%-%-%-[ \r\n]") then + return 0.5 + end + local line = string.match(head, "^[ \t\r\n]*([^\r\n]*)") + if line and (string.match(line, "^[%w_%-\"']+[%w_%- \"']*:[ ]") or string.match(line, "^[%w_%-]+:$") or string.match(line, "^%- ")) then + return 0.2 + end + return 0 +end +end + +do -- vector/gamemaps +local Bytes = __include("core/Bytes") +local MAGIC = "TED5v1.0" +S["vector/gamemaps"] = function(r: Bytes.Reader): number + if r:peek(8) == MAGIC then + return 1 + end + -- MAPHEAD: the RLEW tag 0xABCD, then 100 offsets (0 / -1 when absent) + if r:remaining() >= 402 and r:remaining() <= 1024 and buffer.readu16(r.buf, r.base) == 0xABCD then + local first = buffer.readi32(r.buf, r.base + 2) + if first > 0 then + return 0.7 + end + end + return 0 +end +end + +do -- vector/ldtk +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["vector/ldtk"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 1024) + if not string.match(h, "^%s*{") then + return 0 + end + if string.find(h, "\"fileType\"%s*:%s*\"LDtk Project JSON\"") then + return 1 + end + if string.find(h, "\"jsonVersion\"", 1, true) and string.find(h, "\"worldLayout\"", 1, true) then + return 0.8 + end + return 0 +end +end + +do -- vector/ogmo +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["vector/ogmo"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 2048) + if not string.match(h, "^%s*{") or not string.find(h, "\"ogmoVersion\"", 1, true) then + return 0 + end + if string.find(h, "\"layerGridDefaultSize\"", 1, true) or string.find(h, "\"levelPaths\"", 1, true) then + return 1 + end + return 0.9 +end +end + +do -- vector/svg +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["vector/svg"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 4096) + if not string.match(h, "^%s*<") then + return 0 + end + if string.find(h, "<svg[%s>:]") or string.find(h, "<%w+:svg[%s>]") then + return 0.95 + end + return 0 +end +end + +do -- vector/tiled +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local function head(r: Bytes.Reader): string + local h = Sniff.text(r, 1024) + return h +end +S["vector/tiled"] = function(r: Bytes.Reader): number + local h = head(r) + if string.match(h, "^%s*<") then + if string.find(h, "<map[%s>]") or string.find(h, "<tileset[%s>]") then + return 0.9 + end + return 0 + end + if string.match(h, "^%s*{") then + -- Tiled writes its keys sorted: "type" comes last, so look at the tail too + local n = r:remaining() + local tail = if n > 1024 then r:peek(1024, n - 1024) else "" + for _, part in { h, tail } do + if string.find(part, "\"type\"%s*:%s*\"map\"") or string.find(part, "\"type\"%s*:%s*\"tileset\"") then + return 0.8 + end + end + if string.find(h, "\"tilewidth\"", 1, true) and (string.find(h, "\"orientation\"", 1, true) or string.find(h, "\"tilesets\"", 1, true)) then + return 0.6 + end + end + return 0 +end +end + +do -- layered/aseprite +local Bytes = __include("core/Bytes") +S["layered/aseprite"] = function(r: Bytes.Reader): number + if r:peekU8(4) == 0xE0 and r:peekU8(5) == 0xA5 then + local d = r:peekU8(12) + if (d == 32 or d == 16 or d == 8) and r:peekU8(13) == 0 then + return 1 + end + return 0.5 + end + return 0 +end +end + +do -- layered/ora +local Bytes = __include("core/Bytes") +local MIME = "image/openraster" +S["layered/ora"] = function(r: Bytes.Reader): number + -- a zip whose first (stored) entry is "mimetype" holding image/openraster + if r:peek(4) == "PK\3\4" and r:peek(8, 30) == "mimetype" and r:peek(#MIME, 38) == MIME then + return 1 + end + return 0 +end +end + +do -- layered/psd +local Bytes = __include("core/Bytes") +S["layered/psd"] = function(r: Bytes.Reader): number + local h = r:peek(6) + if string.sub(h, 1, 4) == "8BPS" and (string.sub(h, 5, 6) == "\0\1" or string.sub(h, 5, 6) == "\0\2") then + return 1 + end + return 0 +end +end + +do -- subtitle/ass +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["subtitle/ass"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + if string.match(head, "^%s*%[[Ss]cript [Ii]nfo%]") then + return 1 + end + return 0 +end +end + +do -- subtitle/srt +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local TIMING = "^%s*(%d+):(%d%d?):(%d%d?)[,.](%d+)%s*%-%->%s*(%d+):(%d%d?):(%d%d?)[,.](%d+)%s*(.-)%s*$" +local function frac(digits: string): number + return (tonumber(digits) :: number) / 10 ^ #digits +end +local function timing(line: string): (number?, number?, string?) + local h1, m1, s1, f1, h2, m2, s2, f2, rest = string.match(line, TIMING) + if not h1 then + return nil, nil, nil + end + local a = tonumber(h1) :: number * 3600 + tonumber(m1) :: number * 60 + tonumber(s1) :: number + frac(f1 :: string) + local b = tonumber(h2) :: number * 3600 + tonumber(m2) :: number * 60 + tonumber(s2) :: number + frac(f2 :: string) + return a, b, rest +end +S["subtitle/srt"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512) + head = string.gsub(head, "\r", "\n") + local first, second = string.match(head, "^%s*([^\n]*)\n([^\n]*)") + if first and string.match(first, "^%d+%s*$") and second and timing(second) then + return 0.9 + end + if first and timing(first) then + return 0.6 + end + return 0 +end +end + +do -- subtitle/vtt +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["subtitle/vtt"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 10) + if string.sub(head, 1, 6) == "WEBVTT" then + local c = string.sub(head, 7, 7) + if c == "" or c == " " or c == "\t" or c == "\n" or c == "\r" then + return 1 + end + end + return 0 +end +end + +do -- music/669 +local Bytes = __include("core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 497 then + return false + end + local magic = r:peek(2) + if magic ~= "if" and magic ~= "JN" then + return false + end + local nsmp, npat, restart = r:peekU8(110), r:peekU8(111), r:peekU8(112) + if nsmp > 64 or restart >= 128 or npat > 128 then + return false + end + local bad = 0 + for i = 2, 109 do + local c = r:peekU8(i) + if c > 0 and c <= 31 then + bad += 1 + if bad > 40 then + return false + end + end + end + for i = 0, 127 do + local o, t, b = r:peekU8(113 + i), r:peekU8(241 + i), r:peekU8(369 + i) + if (o >= 128 and o < 0xFE) or (o < 128 and t == 0) or t > 15 or b >= 64 then + return false + end + end + return true +end +S["music/669"] = function(r: Bytes.Reader): number + return if validHeader(r) then 0.6 else 0 +end +end + +do -- music/ahx +local Bytes = __include("core/Bytes") +S["music/ahx"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m and #m == 4 and string.sub(m, 1, 3) == "THX" and string.byte(m, 4) < 3 then 1 else 0 +end +end + +do -- music/far +local Bytes = __include("core/Bytes") +S["music/far"] = function(r: Bytes.Reader): number + if r:size() >= 98 and r:peek(4) == "FAR\xFE" and r:peek(3, 44) == "\r\n\x1A" and r:peekU8(47) + r:peekU8(48) * 256 >= 98 then + return 1 + end + return 0 +end +end + +do -- music/hmp +local Bytes = __include("core/Bytes") +local HMI_MAGIC = "HMI-MIDISONG061595" +S["music/hmp"] = function(r: Bytes.Reader): number + return if r:peek(8) == "HMIMIDIP" or r:peek(18) == HMI_MAGIC then 1 else 0 +end +end + +do -- music/hvl +local Bytes = __include("core/Bytes") +S["music/hvl"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m and #m == 4 and string.sub(m, 1, 3) == "HVL" and string.byte(m, 4) <= 1 then 1 else 0 +end +end + +do -- music/it +local Bytes = __include("core/Bytes") +S["music/it"] = function(r: Bytes.Reader): number + return if r:peek(4) == "IMPM" then 1 else 0 +end +end + +do -- music/med +local Bytes = __include("core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 52 or r:peek(3) ~= "MMD" then + return false + end + local v = r:peekU8(3) + if v < 0x30 or v > 0x33 then + return false + end + local h = r:sub(8, 44) + local songOff = h:u32be() + h:skip(4) + local blockOff = h:u32be() + h:skip(4) + local smpOff = h:u32be() + return songOff >= 52 and songOff + 63 * 8 + 284 <= r:size() and blockOff >= 52 and (smpOff == 0 or smpOff >= 52) +end +S["music/med"] = function(r: Bytes.Reader): number + return if validHeader(r) then 1 else 0 +end +end + +do -- music/midi +local Bytes = __include("core/Bytes") +S["music/midi"] = function(r: Bytes.Reader): number + if r:peek(4) == "MThd" then + return 1 + end + if r:peek(4) == "RIFF" and r:peek(4, 8) == "RMID" then + return 1 + end + return 0 +end +end + +do -- music/mod +local Bytes = __include("core/Bytes") +local FIXED: { [string]: number } = { + ["M.K."] = 4, + ["M!K!"] = 4, + ["M&K!"] = 4, + ["N.T."] = 4, + ["FLT4"] = 4, + ["FLT8"] = 8, + ["CD81"] = 8, + ["OKTA"] = 8, + ["OCTA"] = 8, + ["EXO4"] = 4, + ["EXO8"] = 8, +} +local function signatureChannels(sig: string): number? + local fixed = FIXED[sig] + if fixed then + return fixed + end + local d = string.match(sig, "^(%d)CHN$") + if d then + local n = tonumber(d) :: number + return if n >= 1 then n else nil + end + local dd = string.match(sig, "^(%d%d)C[HN]$") + if dd then + local n = tonumber(dd) :: number + return if n >= 1 and n <= 32 then n else nil + end + local t = string.match(sig, "^TDZ(%d)$") + if t then + local n = tonumber(t) :: number + return if n >= 1 then n else nil + end + return nil +end +S["music/mod"] = function(r: Bytes.Reader): number + if r:size() < 1084 then + return 0 + end + local sig = r:peek(4, 1080) + if signatureChannels(sig) then + return 0.8 + end + return 0 +end +end + +do -- music/mtm +local Bytes = __include("core/Bytes") +S["music/mtm"] = function(r: Bytes.Reader): number + if r:size() >= 66 and r:peek(3) == "MTM" and r:peekU8(3) < 0x20 and r:peekU8(33) >= 1 and r:peekU8(33) <= 32 then + return 1 + end + return 0 +end +end + +do -- music/mus +local Bytes = __include("core/Bytes") +S["music/mus"] = function(r: Bytes.Reader): number + return if r:peek(4) == "MUS\x1a" then 1 else 0 +end +end + +do -- music/okt +local Bytes = __include("core/Bytes") +S["music/okt"] = function(r: Bytes.Reader): number + return if r:peek(8) == "OKTASONG" then 1 else 0 +end +end + +do -- music/ptm +local Bytes = __include("core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 608 or r:peek(4, 44) ~= "PTMF" or r:peekU8(28) ~= 26 or r:peekU8(30) > 2 then + return false + end + local h = r:sub(32, 10) + local nord, nsmp, npat, nch, flags = h:u16le(), h:u16le(), h:u16le(), h:u16le(), h:u16le() + return flags == 0 and nch >= 1 and nch <= 32 and nord >= 1 and nord <= 256 and nsmp >= 1 and nsmp <= 255 and npat >= 1 and npat <= 128 +end +S["music/ptm"] = function(r: Bytes.Reader): number + return if validHeader(r) then 1 else 0 +end +end + +do -- music/s3m +local Bytes = __include("core/Bytes") +S["music/s3m"] = function(r: Bytes.Reader): number + if r:size() >= 48 and r:peek(4, 44) == "SCRM" then + return 1 + end + return 0 +end +end + +do -- music/sf2 +local Bytes = __include("core/Bytes") +local SoundFont = lazy(function() + return __include("codecs/audio/SoundFont") +end) +S["music/sf2"] = function(r: Bytes.Reader): number + return if SoundFont.sniff(r) then 1 else 0 +end +end + +do -- music/stm +local Bytes = __include("core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 48 then + return false + end + local eof, ftype, major, minor = r:peekU8(28), r:peekU8(29), r:peekU8(30), r:peekU8(31) + local npat, gv = r:peekU8(33), r:peekU8(34) + if ftype ~= 2 or (eof ~= 0x1A and eof ~= 2) or major ~= 2 or (minor ~= 0 and minor ~= 10 and minor ~= 20 and minor ~= 21) then + return false + end + if npat > 64 or (gv > 64 and gv ~= 0x58) then + return false + end + for i = 20, 27 do + local c = r:peekU8(i) + if c < 0x20 or c >= 0x7F then + return false + end + end + return true +end +S["music/stm"] = function(r: Bytes.Reader): number + return if validHeader(r) then 0.7 else 0 +end +end + +do -- music/ult +local Bytes = __include("core/Bytes") +S["music/ult"] = function(r: Bytes.Reader): number + local v = r:peekU8(14) + if r:size() >= 48 and r:peek(14) == "MAS_UTrack_V00" and v >= 0x31 and v <= 0x34 then + return 1 + end + return 0 +end +end + +do -- music/umx +local Bytes = __include("core/Bytes") +local MAGIC = "\xC1\x83\x2A\x9E" +type Header = { version: number, nameCount: number, nameOffset: number, exportCount: number, exportOffset: number, importCount: number, importOffset: number } +local function header(r: Bytes.Reader): Header? + if r:size() < 36 or r:peek(4) ~= MAGIC then + return nil + end + local h = r:sub(4, 32) + local version = h:u16le() + h:skip(6) + local hd: Header = { + version = version, + nameCount = h:u32le(), + nameOffset = h:u32le(), + exportCount = h:u32le(), + exportOffset = h:u32le(), + importCount = h:u32le(), + importOffset = h:u32le(), + } + if h.err or hd.nameOffset < 36 or hd.exportOffset < 36 or hd.importOffset < 36 then + return nil + end + if hd.nameCount == 0 or hd.exportCount == 0 or hd.importCount == 0 or hd.nameCount > 2 ^ 20 or hd.exportCount > 2 ^ 20 or hd.importCount > 2 ^ 20 then + return nil + end + return hd +end +local function index(r: Bytes.Reader): number + local b = r:u8() + local neg = b >= 0x80 + local v = b % 64 + if bit32.band(b, 0x40) ~= 0 then + local shift = 6 + repeat + b = r:u8() + v += (b % 128) * 2 ^ shift + shift += 7 + until b < 0x80 or shift >= 32 + end + return if neg then -v else v +end +local function names(r: Bytes.Reader, h: Header): { string } + local list = {} + local nr = r:sub(h.nameOffset) + for _ = 1, math.min(h.nameCount, 65536) do + if nr:remaining() < 5 then + break + end + if h.version >= 64 then + index(nr) + end + table.insert(list, string.lower(nr:cstring(1024))) + nr:skip(4) + end + return list +end +S["music/umx"] = function(r: Bytes.Reader): number + local h = header(r) + if not h then + return 0 + end + return if table.find(names(r, h), "music") then 1 else 0.3 +end +end + +do -- music/xm +local Bytes = __include("core/Bytes") +local MAGIC = "Extended Module: " +S["music/xm"] = function(r: Bytes.Reader): number + return if r:peek(17) == MAGIC then 1 else 0 +end +end + +do -- music/xmi +local Bytes = __include("core/Bytes") +S["music/xmi"] = function(r: Bytes.Reader): number + local id, kind = r:peek(4), r:peek(4, 8) + if id == "FORM" and (kind == "XDIR" or kind == "XMID") then + return 1 + end + return if id == "CAT " and kind == "XMID" then 0.9 else 0 +end +end + +do -- playlist/m3u +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["playlist/m3u"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 512) + s = (string.match(s, "^%s*(.*)$") :: string) + if string.sub(s, 1, 7) == "#EXTM3U" then + return 0.95 + end + if string.find(s, "^#EXTINF:") or string.find(s, "^#EXT%-X%-") then + return 0.8 + end + return 0 +end +end + +do -- playlist/pls +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local Text = lazy(function() + return __include("codecs/text/Text") +end) +S["playlist/pls"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 64) + local first = string.match(s, "^%s*([^\r\n]*)") + return if first and string.lower(Text.trim(first)) == "[playlist]" then 0.95 else 0 +end +end + +do -- playlist/xspf +local Bytes = __include("core/Bytes") +local NS = "http://xspf.org/ns/0/" +S["playlist/xspf"] = function(r: Bytes.Reader): number + local s = r:peek(1024) + local i = string.find(s, "<%w*:?playlist[%s>]") + if i and string.find(s, NS, 1, true) then + return 0.95 + end + return 0 +end +end + +return S +end +end + + + + archive_1 --!optimize 2 @@ -83111,7 +86747,7 @@ end - + archive_2 --!optimize 2 @@ -83971,7 +87607,7 @@ end - + audio --!optimize 2 @@ -92101,7 +95737,7 @@ end - + cad --!optimize 2 @@ -93536,7 +97172,7 @@ end - + codecs_audio --!optimize 2 @@ -99784,7 +103420,7 @@ end - + codecs_compress --!optimize 2 @@ -102825,7 +106461,7 @@ end - + codecs_entropy --!optimize 2 @@ -103601,7 +107237,7 @@ end - + codecs_font --!optimize 2 @@ -105814,7 +109450,7 @@ end - + codecs_image --!optimize 2 @@ -108869,7 +112505,7 @@ end - + codecs_model --!optimize 2 @@ -116948,7 +120584,7 @@ end - + codecs_text --!optimize 2 @@ -123150,7 +126786,7 @@ end - + codecs_video --!optimize 2 @@ -123449,7 +127085,7 @@ end - + containers --!optimize 2 @@ -131843,7 +135479,7 @@ end - + core --!optimize 2 @@ -132676,7 +136312,7 @@ end - + data --!optimize 2 @@ -138430,7 +142066,7 @@ end - + font --!optimize 2 @@ -142339,7 +145975,7 @@ end - + host --!optimize 2 @@ -142927,7 +146563,7 @@ end - + image_1 --!optimize 2 @@ -150771,7 +154407,7 @@ end - + image_2 --!optimize 2 @@ -154520,7 +158156,7 @@ end - + layered --!optimize 2 @@ -156645,7 +160281,7 @@ end - + model_1 --!optimize 2 @@ -163658,7 +167294,7 @@ end - + model_2 --!optimize 2 @@ -170317,7 +173953,7 @@ end - + model_3 --!optimize 2 @@ -177671,7 +181307,7 @@ end - + model_4 --!optimize 2 @@ -185079,7 +188715,7 @@ end - + model_5 --!optimize 2 @@ -193137,7 +196773,7 @@ end - + model_6 --!optimize 2 @@ -201102,7 +204738,7 @@ end - + model_7 --!optimize 2 @@ -202053,7 +205689,7 @@ end - + music --!optimize 2 @@ -207658,7 +211294,7 @@ end - + ops --!optimize 2 @@ -209811,7 +213447,7 @@ end - + playlist --!optimize 2 @@ -210558,7 +214194,7 @@ end - + subtitle --!optimize 2 @@ -211391,7 +215027,7 @@ end - + vector --!optimize 2 @@ -217405,7 +221041,7 @@ end - + video --!optimize 2 diff --git a/build/rosetta.lua b/build/rosetta.lua index 5a9d039..0e46802 100644 --- a/build/rosetta.lua +++ b/build/rosetta.lua @@ -461,8 +461,13 @@ end do -- math.min / math.max are branch-free in a trace; an if / elseif clamp spawned side traces and ran ~3.5x slower. -- NaN stays NaN, as in Luau (maxsd would return lo). + -- Vararg (`...` unused): LuaJIT never starts a root trace at a vararg function but still inlines it into its + -- callers' traces. The plain clamp, called from interpreted code, started root traces that aborted on the return + -- into the caller's loop; enough aborts blacklist it, every trace that reaches a blacklisted function aborts too, and + -- in a long mixed process one codec left every clamp user interpreted (jpeg, webp, tiff 2-10x slower). Not done for + -- the others: a vararg math.sign made Monkey's Audio's sign-heavy filters ~40% slower. local mmin, mmax = math.min, math.max - math.clamp = math.clamp or function(x, lo, hi) + math.clamp = math.clamp or function(x, lo, hi, ...) if lo > hi then error("max must be greater than or equal to min", 2) end if x ~= x then return x end return mmin(mmax(x, lo), hi) @@ -743,6 +748,56 @@ end local LATE= { br = 0.3 } -- archive/br: a trial decode of up to 256 KB +-- detection order: by the cost of a sniff (Registry.sniff: Sniffs.luau, Sniffs.luau reaching a codec, the format +-- module), then registry order; the costly LATE sniffs last +local order= nil +local byExt= {} +local Sniffs= nil + +local function sniffOrder() +local o = order + if o then + return o + end + local list= {} + for idx, e in __iter(Registry) do + table.insert(list, idx) + for _, x in __iter(e.extensions) do + byExt[x] = byExt[x] or {} + table.insert(byExt[x], idx) + end + end + local function rank(idx) +local e = Registry[idx] + return LATE[e.name] and 3 or e.sniff + end + table.sort(list, function(a, b) +local ra, rb = rank(a), rank(b) + if ra ~= rb then + return ra < rb + end + return a < b + end) + order = list + return list +end + +local function sniffer(e) +if e.sniff < 2 then + local s = Sniffs + if not s then + s = (__include("Sniffs") ) +Sniffs = s + end + local f = (s )[e.path] + if f then + return f + end + end + local m = module(e) + return (m and type(m.sniff) == "function" and{m.sniff }or{nil +})[1]end + local function detect(buf, name, category, format) if format then local e = find(format, category) @@ -752,52 +807,35 @@ if format then return e, nil end local ext = Input.extension(name) - local best= nil + local list = sniffOrder() + local hits = (ext and{byExt[ext] }or{nil +})[1] local best= nil local bestScore, bestIdx = 0, 0 - -- sniffs score 0..1 (core/Sniff); the extension's format scoring 1 cannot be beaten. Formats with a costly sniff - -- (LATE: the most they score) run last, and only when they could still win; ties go to registry order. - local late= nil - for idx, e in __iter(Registry) do -local __DARKLUA_CONTINUE_3=false repeat if inCategory(e, category) and (e.caps.decode or e.caps.open) then - local cap = LATE[e.name] - if cap then - late = late or {} - table.insert(late , idx) -__DARKLUA_CONTINUE_3=true break - end - local m = module(e) - if m and m.sniff then - local ok, score = pcall(m.sniff, Bytes.reader(buf)) - if ok and type(score) == "number" and score > 0 then - local extHit = ext and table.find(e.extensions, ext) - if extHit then - score =score+ 0.01 -- ties go to the extension - end - if score > bestScore then - best, bestScore, bestIdx = e, score, idx - if extHit and score >= 1.01 then - return e, nil - end - end + -- sniffs score 0..1 (core/Sniff), +0.01 for the extension's formats; the best wins, ties go to registry order. The + -- extension's formats run first, and a sniff runs only while its cap (1, or LATE) could still win. + for pass = 1, 2 do + local ids = (pass == 1 and{hits }or{list +})[1] if ids then + for _, idx in __iter(ids) do + if pass == 2 and bestScore > 1 then + break end - end - end -__DARKLUA_CONTINUE_3=true until true if not __DARKLUA_CONTINUE_3 then break end end - if late then - for _, idx in __iter(late) do - local e = Registry[idx] - local extHit = ext and table.find(e.extensions, ext) - local cap = LATE[e.name] + (extHit and 0.01 or 0) - if cap > bestScore or (cap == bestScore and idx < bestIdx) then - local m = module(e) - if m and m.sniff then - local ok, score = pcall(m.sniff, Bytes.reader(buf)) - if ok and type(score) == "number" and score > 0 then - if extHit then - score =score+ 0.01 - end - if score > bestScore or (score == bestScore and idx < bestIdx) then - best, bestScore, bestIdx = e, score, idx + local e = Registry[idx] + local extHit = pass == 1 or (hits ~= nil and table.find(hits, idx) ~= nil) + if (pass == 1 or not extHit) and inCategory(e, category) and (e.caps.decode or e.caps.open) then + local cap = (LATE[e.name] or 1) + (extHit and 0.01 or 0) + if cap > bestScore or (cap == bestScore and idx < bestIdx) then + local sniff = sniffer(e) + if sniff then + local ok, score = pcall(sniff, Bytes.reader(buf)) + if ok and type(score) == "number" and score > 0 then + if extHit then + score =score+ 0.01 + end + if score > bestScore or (score == bestScore and idx < bestIdx) then + best, bestScore, bestIdx = e, score, idx + end + end end end end @@ -1361,8 +1399,8 @@ local o= opts or {} return nil, err end -- a format may name the file's flavour more precisely (video/mkv: "webm" for DocType webm) - local m = module(entry) - if m and type(m.variant) == "function" then + local m = (entry.variant and{(module(entry) )}or{nil +})[1] if m and type(m.variant) == "function" then local ok, v = pcall(m.variant, Bytes.reader(buf)) if ok and type(v) == "string" then return v, nil @@ -1551,6 +1589,10 @@ __FILES["Registry"] = function() -- Registry: GENERATED by tools/gen_registry.py from the format folders - do not edit. -- One entry per format: the contract metadata (copied from its init.luau) and load(), which requires the format -- module on first use (a static require, as Roblox needs). Order: category, then name. +-- sniff: where detection finds the format's sniff (tools/sniff_extract.py): 0 Sniffs.luau, 1 Sniffs.luau reaching a +-- codec / container on first call, 2 the format module. variant: the module has variant(r). + + @@ -1571,6 +1613,7 @@ local list= { mime = { "application/x-navi-animation" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Riff" }, caps = { decode = true, encode = true, alpha = true, animation = true, frames = true }, + sniff = 0, load = function() return __include("image/ani") end, @@ -1583,6 +1626,7 @@ local list= { mime = { "image/x-build-art" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels", "codecs/image/Quantize" }, caps = { decode = true, encode = true, alpha = true, palette = true, frames = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/art") end, @@ -1595,6 +1639,7 @@ local list= { mime = { "image/x-blp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Jpeg", "codecs/image/Bcn" }, caps = { decode = true, encode = true, alpha = true, variants = { "blp1", "blp2" }, compressions = { "jpeg", "palette", "dxt1", "dxt3", "dxt5", "bgra" } }, + sniff = 0, load = function() return __include("image/blp") end, @@ -1607,6 +1652,7 @@ local list= { mime = { "image/bmp", "image/x-bmp", "image/x-ms-bmp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, depths = { 1, 2, 4, 8, 16, 24, 32 }, rle = true }, + sniff = 0, load = function() return __include("image/bmp") end, @@ -1619,6 +1665,7 @@ local list= { mime = { "image/vnd-ms.dds", "image/x-dds" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Bcn", "codecs/image/Texel", "codecs/image/Texture" }, caps = { decode = true, encode = true, alpha = true, float = true, mipmaps = true, cubemap = true, compressed = { "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7" } }, + sniff = 0, load = function() return __include("image/dds") end, @@ -1631,6 +1678,7 @@ local list= { mime = { "image/x-exr", "image/aces" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Half", "codecs/compress/Deflate" }, caps = { decode = true, encode = true, alpha = true, float = true, hdr = true, depths = { 16, 32 }, multipart = true, tiled = true }, + sniff = 0, load = function() return __include("image/exr") end, @@ -1643,6 +1691,7 @@ local list= { mime = { "image/gif" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Lzw", "codecs/image/Quantize", "Types" }, caps = { decode = true, encode = true, animation = true, alpha = true, palette = true, depths = { 1, 2, 4, 8 } }, + sniff = 0, load = function() return __include("image/gif") end, @@ -1655,6 +1704,7 @@ local list= { mime = { "image/vnd.radiance", "image/x-hdr" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = false, float = true, depths = { 32 } }, + sniff = 0, load = function() return __include("image/hdr") end, @@ -1667,6 +1717,7 @@ local list= { mime = { "image/icns", "image/x-icns" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "containers/Chunks" }, caps = { decode = true, encode = true, alpha = true, frames = true, depths = { 1, 24, 32 } }, + sniff = 0, load = function() return __include("image/icns") end, @@ -1679,6 +1730,7 @@ local list= { mime = { "image/vnd.microsoft.icon", "image/x-icon" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, frames = true, depths = { 1, 4, 8, 16, 24, 32 } }, + sniff = 0, load = function() return __include("image/ico") end, @@ -1691,6 +1743,7 @@ local list= { mime = { "image/x-ilbm", "image/x-iff" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/compress/PackBits", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 2, 3, 4, 5, 6, 7, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/ilbm") end, @@ -1703,6 +1756,7 @@ local list= { mime = { "image/jpeg" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Jpeg" }, caps = { decode = true, encode = true, lossy = true, alpha = false, depths = { 8, 12 }, progressive = true, arithmetic = true }, + sniff = 0, load = function() return __include("image/jpeg") end, @@ -1715,6 +1769,7 @@ local list= { mime = { "image/ktx2", "image/ktx" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/compress/Deflate", "codecs/compress/Zstd", "codecs/image/Texel", "codecs/image/Texture" }, caps = { decode = true, encode = true, alpha = true, float = true, mipmaps = true, cubemap = true, compressed = { "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7", "etc1", "etc2", "eac" } }, + sniff = 0, load = function() return __include("image/ktx") end, @@ -1727,6 +1782,7 @@ local list= { mime = { "image/x-quake-lmp" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, alpha = true, depths = { 8 }, variants = { "qpic", "palette", "colormap" } }, + sniff = 0, load = function() return __include("image/lmp") end, @@ -1739,6 +1795,7 @@ local list= { mime = { "image/vnd.zbrush.pcx", "image/x-pcx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 2, 4, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/pcx") end, @@ -1751,6 +1808,7 @@ local list= { mime = { "image/png", "image/apng" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Deflate", "Types", "containers/Chunks" }, caps = { decode = true, encode = true, animation = true, alpha = true, depths = { 1, 2, 4, 8, 16 } }, + sniff = 0, load = function() return __include("image/png") end, @@ -1763,6 +1821,7 @@ local list= { mime = { "image/x-portable-anymap", "image/x-portable-bitmap", "image/x-portable-graymap", "image/x-portable-pixmap", "image/x-portable-arbitrarymap", "image/x-portable-floatmap" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 1, 8, 16, 32 }, float = true }, + sniff = 0, load = function() return __include("image/pnm") end, @@ -1775,6 +1834,7 @@ local list= { mime = { "image/qoi", "image/x-qoi" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/qoi") end, @@ -1787,6 +1847,7 @@ local list= { mime = { "image/sgi", "image/x-rgb" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 8, 16 } }, + sniff = 0, load = function() return __include("image/sgi") end, @@ -1799,6 +1860,7 @@ local list= { mime = { "image/x-quake-sprite" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, alpha = true, animation = true, variants = { "quake", "halflife", "spr32" } }, + sniff = 0, load = function() return __include("image/spr") end, @@ -1811,6 +1873,7 @@ local list= { mime = { "image/x-sun-raster", "image/x-cmu-raster" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/sunras") end, @@ -1823,6 +1886,7 @@ local list= { mime = { "image/x-tga", "image/x-targa" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 8, 15, 16, 24, 32 } }, + sniff = 0, load = function() return __include("image/tga") end, @@ -1835,6 +1899,7 @@ local list= { mime = { "image/tiff" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/compress/Lzw", "codecs/compress/PackBits" }, caps = { decode = true, encode = true, alpha = true, pages = true, depths = { 1, 2, 4, 8, 16, 32 }, float = true }, + sniff = 0, load = function() return __include("image/tiff") end, @@ -1847,6 +1912,7 @@ local list= { mime = { "image/x-tim" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 4, 8, 16, 24 } }, + sniff = 0, load = function() return __include("image/tim") end, @@ -1859,6 +1925,7 @@ local list= { mime = { "image/x-vtf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Bcn", "codecs/image/Texel" }, caps = { decode = true, encode = false, alpha = true, animation = true, versions = { "7.0", "7.1", "7.2", "7.3", "7.4", "7.5" } }, + sniff = 0, load = function() return __include("image/vtf") end, @@ -1871,6 +1938,7 @@ local list= { mime = { "image/webp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Vp8", "codecs/image/Vp8L", "containers/Riff" }, caps = { decode = true, encode = true, animation = true, alpha = true, lossy = true, lossless = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/webp") end, @@ -1883,6 +1951,7 @@ local list= { mime = { "image/x-xbitmap", "image/x-xbm" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, depths = { 1 } }, + sniff = 0, load = function() return __include("image/xbm") end, @@ -1895,6 +1964,7 @@ local list= { mime = { "image/x-xpixmap", "image/x-xpm" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/xpm") end, @@ -1907,6 +1977,7 @@ local list= { mime = { "audio/aac", "audio/aacp", "audio/x-aac" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Aac", "codecs/audio/Pcm", "codecs/audio/Stream" }, caps = { decode = true, encode = false, codecs = { "aac" }, streaming = true }, + sniff = 1, load = function() return __include("audio/aac") end, @@ -1919,6 +1990,7 @@ local list= { mime = { "audio/ac3", "audio/x-ac3" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/Ac3" }, caps = { decode = true, encode = false, codecs = { "ac3" }, channels = 6, streaming = true, lossy = true }, + sniff = 1, load = function() return __include("audio/ac3") end, @@ -1931,6 +2003,7 @@ local list= { mime = { "audio/x-adpcm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, headerless = true, codecs = { "ima", "ima_wav", "ms", "ima_qt", "psx" } }, + sniff = 0, load = function() return __include("audio/adpcm") end, @@ -1943,6 +2016,7 @@ local list= { mime = { "audio/x-adx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, loops = true, channels = 8 }, + sniff = 0, load = function() return __include("audio/adx") end, @@ -1955,6 +2029,7 @@ local list= { mime = { "audio/aiff", "audio/x-aiff" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm/Decoder", "containers/Chunks" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, lossy = false }, + sniff = 0, load = function() return __include("audio/aiff") end, @@ -1967,6 +2042,7 @@ local list= { mime = { "audio/ape", "audio/x-ape", "audio/x-monkeys-audio" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Ape" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, float = true, depths = { 8, 16, 24, 32 } }, + sniff = 0, load = function() return __include("audio/ape") end, @@ -1979,6 +2055,7 @@ local list= { mime = { "audio/basic", "audio/x-au" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, lossy = false }, + sniff = 0, load = function() return __include("audio/au") end, @@ -1991,6 +2068,8 @@ local list= { mime = { "audio/x-brstm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = false, streaming = true, lossy = true, loops = true, containers = { "RSTM", "CSTM", "FSTM" } }, + sniff = 0, + variant = true, load = function() return __include("audio/brstm") end, @@ -2003,6 +2082,7 @@ local list= { mime = { "audio/x-caf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Aac", "codecs/audio/Adpcm/Decoder", "codecs/audio/Alac", "codecs/audio/Pcm", "codecs/audio/Stream", "containers/Chunks" }, caps = { decode = true, encode = true, codecs = { "pcm", "alac", "aac", "ulaw", "alaw" }, encodeCodecs = { "pcm", "alac" }, tags = true, streaming = true }, + sniff = 0, load = function() return __include("audio/caf") end, @@ -2015,6 +2095,7 @@ local list= { mime = { "audio/flac", "audio/x-flac" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/audio/Pcm", "codecs/audio/VorbisComment", "codecs/audio/Flac/Frame", "codecs/audio/Flac/Encode" }, caps = { decode = true, encode = true, streaming = true, depths = { 4, 8, 12, 16, 20, 24, 32 }, ogg = true, seek = true }, + sniff = 0, load = function() return __include("audio/flac") end, @@ -2027,6 +2108,7 @@ local list= { mime = { "audio/mp4", "audio/x-m4a", "audio/m4a" }, deps = { "core/Err", "core/Bytes", "Types", "containers/IsoBmff", "codecs/audio/Aac", "codecs/audio/Alac", "codecs/audio/Pcm", "codecs/audio/Stream" }, caps = { decode = true, encode = true, codecs = { "aac", "alac" }, encodeCodecs = { "alac" }, tags = true, streaming = true }, + sniff = 1, load = function() return __include("audio/m4a") end, @@ -2039,6 +2121,7 @@ local list= { mime = { "audio/mpeg", "audio/mp3", "audio/mpa" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Resample", "codecs/audio/Mpa/Header", "codecs/audio/Mpa/Core", "codecs/audio/Mpa/Encode3", "codecs/audio/Mpa/Encode2" }, caps = { decode = true, encode = true, streaming = true, seek = true, layers = { 1, 2, 3 }, encodeLayers = { 2, 3 }, channels = 2 }, + sniff = 1, load = function() return __include("audio/mp3") end, @@ -2051,6 +2134,7 @@ local list= { mime = { "audio/x-musepack", "audio/musepack" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Musepack" }, caps = { decode = true, encode = false, codecs = { "musepack" }, versions = { 7, 8 }, streaming = true, lossy = true }, + sniff = 1, load = function() return __include("audio/mpc") end, @@ -2063,6 +2147,7 @@ local list= { mime = { "audio/opus", "audio/ogg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/entropy/RangeCoder/Decoder", "codecs/audio/Pcm", "codecs/audio/Resample", "codecs/audio/VorbisComment", "codecs/audio/Opus/CeltEncoder", "codecs/audio/Opus/Decoder", "codecs/audio/Opus/Packet", "codecs/audio/Opus/Celt", "codecs/audio/Opus/Silk" }, caps = { decode = true, encode = true, streaming = true, seek = true, lossy = true, channels = 255, rates = { 48000 }, encodeModes = { "celt" }, encodeChannels = 2 }, + sniff = 0, load = function() return __include("audio/opus") end, @@ -2075,6 +2160,7 @@ local list= { mime = { "audio/qoa" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/Qoa" }, caps = { decode = true, encode = true, streaming = true, lossy = true, seek = true, channels = 8 }, + sniff = 0, load = function() return __include("audio/qoa") end, @@ -2087,6 +2173,7 @@ local list= { mime = { "audio/x-tta", "audio/tta" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Tta" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, depths = { 8, 16, 24 } }, + sniff = 0, load = function() return __include("audio/tta") end, @@ -2099,6 +2186,7 @@ local list= { mime = { "audio/x-vag" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, loops = true, channels = 2 }, + sniff = 0, load = function() return __include("audio/vag") end, @@ -2111,6 +2199,7 @@ local list= { mime = { "audio/x-voc" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16 }, lossy = false }, + sniff = 0, load = function() return __include("audio/voc") end, @@ -2123,6 +2212,7 @@ local list= { mime = { "audio/ogg", "audio/vorbis" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/audio/Mdct", "codecs/audio/Pcm", "codecs/audio/VorbisComment", "codecs/audio/Vorbis/Tables", "codecs/audio/Vorbis/Setup", "codecs/audio/Vorbis/Packet" }, caps = { decode = true, encode = true, streaming = true, seek = true, lossy = true, channels = 255 }, + sniff = 0, load = function() return __include("audio/vorbis") end, @@ -2135,6 +2225,7 @@ local list= { mime = { "audio/wav", "audio/x-wav", "audio/wave", "audio/vnd.wave" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Riff", "codecs/audio/Pcm", "codecs/audio/Adpcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, rf64 = true }, + sniff = 1, load = function() return __include("audio/wav") end, @@ -2147,6 +2238,7 @@ local list= { mime = { "audio/x-wavpack", "audio/wavpack" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/WavPack" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, hybrid = true, float = true, depths = { 8, 12, 16, 20, 24, 32 } }, + sniff = 0, load = function() return __include("audio/wavpack") end, @@ -2159,6 +2251,7 @@ local list= { mime = { "video/x-msvideo", "video/avi" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Avi", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, video = { "mjpeg", "mpeg1", "mpeg2", "rawvideo" }, audio = true, odml = true }, + sniff = 0, load = function() return __include("video/avi") end, @@ -2171,6 +2264,7 @@ local list= { mime = { "video/x-fli", "video/fli", "video/x-flc" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "flic" }, depths = { 8, 15, 16, 24 } }, + sniff = 0, load = function() return __include("video/fli") end, @@ -2183,6 +2277,7 @@ local list= { mime = { "video/x-flv", "video/flv" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source", "codecs/video/H263", "codecs/video/H264", "codecs/audio/Aac" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "flv1", "h264" }, audio = true, metadata = true }, + sniff = 0, load = function() return __include("video/flv") end, @@ -2195,6 +2290,7 @@ local list= { mime = { "video/h264" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source", "codecs/video/H264" }, caps = { decode = true, encode = true, streaming = true, video = { "h264" }, depths = { 8 } }, + sniff = 0, load = function() return __include("video/h264") end, @@ -2207,6 +2303,8 @@ local list= { mime = { "video/x-matroska", "video/webm", "audio/x-matroska", "audio/webm" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ebml", "containers/Demux", "containers/Avi", "containers/IsoBmff/QtPalette", "codecs/compress/Deflate", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "vp8", "mjpeg", "mpeg1", "mpeg2", "theora", "rawvideo" }, audio = true, subtitles = true }, + sniff = 0, + variant = true, load = function() return __include("video/mkv") end, @@ -2219,6 +2317,7 @@ local list= { mime = { "video/mp4", "video/quicktime", "video/3gpp" }, deps = { "core/Err", "core/Bytes", "Types", "containers/IsoBmff", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "mjpeg", "mpeg1", "mpeg2", "h264" }, audio = true, fragments = true }, + sniff = 1, load = function() return __include("video/mp4") end, @@ -2231,6 +2330,7 @@ local list= { mime = { "video/mpeg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/MpegPs", "containers/MpegEs", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "mpeg1", "mpeg2" }, audio = true }, + sniff = 0, load = function() return __include("video/mpegps") end, @@ -2243,6 +2343,7 @@ local list= { mime = { "video/mp2t" }, deps = { "core/Err", "core/Bytes", "Types", "containers/MpegTs", "containers/MpegEs", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "mpeg1", "mpeg2", "h264" }, audio = true }, + sniff = 0, load = function() return __include("video/mpegts") end, @@ -2255,6 +2356,7 @@ local list= { mime = { "video/ogg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "containers/Demux", "containers/AudioWrap", "codecs/video/Theora", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "theora" }, audio = true }, + sniff = 0, load = function() return __include("video/ogv") end, @@ -2267,6 +2369,7 @@ local list= { mime = { "video/vnd.radgamettools.smacker" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/audio/Stream", "codecs/video/Legacy/Smacker" }, caps = { decode = true, encode = false, streaming = true, video = { "smackvid" }, audio = { "smackaudio", "pcm_u8", "pcm_s16le" } }, + sniff = 0, load = function() return __include("video/smk") end, @@ -2279,6 +2382,7 @@ local list= { mime = { "video/x-yuv4mpeg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, video = { "rawvideo" }, depths = { 8, 10, 12, 16 } }, + sniff = 0, load = function() return __include("video/y4m") end, @@ -2291,6 +2395,7 @@ local list= { mime = { "application/x-3ds", "image/x-3ds" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Sampler" }, caps = { decode = true, encode = true, materials = true, textures = true, animation = true, cameras = true, lights = true, instancing = true }, + sniff = 0, load = function() return __include("model/3ds") end, @@ -2303,6 +2408,7 @@ local list= { mime = { "model/3mf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "containers/Zip" }, caps = { decode = true, encode = true, materials = true, vertexColors = true, textures = true, units = true }, + sniff = 0, load = function() return __include("model/3mf") end, @@ -2315,6 +2421,7 @@ local list= { mime = { "model/x-ase", "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text", "codecs/model/Mat4" }, caps = { decode = true, encode = true, text = true, materials = true, cameras = true, lights = true, vertexColors = true }, + sniff = 1, load = function() return __include("model/ase") end, @@ -2327,6 +2434,7 @@ local list= { mime = { "model/x-b3d" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/model/Mat4" }, caps = { decode = true, encode = false, materials = true, textures = true, skins = true, animation = true, colors = true }, + sniff = 0, load = function() return __include("model/b3d") end, @@ -2339,6 +2447,7 @@ local list= { mime = { "application/x-blender" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Blend", "codecs/compress/Deflate", "codecs/compress/Zstd", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/Polygon" }, caps = { decode = true, encode = false, materials = true, textures = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, polygons = true, compressed = true }, + sniff = 1, load = function() return __include("model/blend") end, @@ -2351,6 +2460,7 @@ local list= { mime = { "model/x-bsp" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex", "codecs/model/Patch" }, caps = { decode = true, encode = false, variants = { "quake", "bsp2", "2psb", "halflife", "quake2", "quake3" }, lightmaps = true, collision = true, visibility = true }, + sniff = 0, load = function() return __include("model/bsp") end, @@ -2363,6 +2473,7 @@ local list= { mime = { "application/x-build-map" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Polygon" }, caps = { decode = true, encode = true, sprites = true, slopes = true }, + sniff = 0, load = function() return __include("model/buildmap") end, @@ -2375,6 +2486,7 @@ local list= { mime = { "text/x-doom3-map" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Brush", "codecs/model/Patch", "codecs/model/Mat4", "codecs/text/Lexer" }, caps = { decode = true, encode = false, patches = true, variants = { "doom3", "quake4" } }, + sniff = 0, load = function() return __include("model/d3map") end, @@ -2387,6 +2499,7 @@ local list= { mime = { "model/vnd.collada+xml", "model/vnd.collada+zip" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "core/Base64", "containers/Zip", "codecs/model/Mat4" }, caps = { decode = true, encode = true, materials = true, polygons = true, skins = true, morphTargets = true, animation = true, cameras = true, lights = true, zae = true }, + sniff = 0, load = function() return __include("model/dae") end, @@ -2399,6 +2512,7 @@ local list= { mime = { "application/vnd.autodesk.fbx", "model/fbx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "core/Base64", "codecs/model/Mat4" }, caps = { decode = true, encode = true, binary = true, ascii = true, materials = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, polygons = true }, + sniff = 2, load = function() return __include("model/fbx") end, @@ -2411,6 +2525,7 @@ local list= { mime = { "model/gltf+json", "model/gltf-binary" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Base64", "core/Sniff", "codecs/model/Draco" }, caps = { decode = true, encode = true, binary = true, materials = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, draco = true }, + sniff = 0, load = function() return __include("model/gltf") end, @@ -2423,6 +2538,7 @@ local list= { mime = { "application/x-godot-scene" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/GodotVariant", "codecs/model/Mat4" }, caps = { decode = true, encode = true, text = true, materials = true, cameras = true, lights = true, instances = true }, + sniff = 0, load = function() return __include("model/godot") end, @@ -2435,6 +2551,7 @@ local list= { mime = { "model/x-iqm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/Sampler" }, caps = { decode = true, encode = true, materials = true, skins = true, animation = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/iqm") end, @@ -2447,6 +2564,7 @@ local list= { mime = { "application/x-ldraw", "application/x-multi-part-ldraw" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = false, materials = true, lines = true, instancing = true }, + sniff = 0, load = function() return __include("model/ldraw") end, @@ -2459,6 +2577,7 @@ local list= { mime = { "image/x-lwo", "model/x-lwo" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks" }, caps = { decode = true, encode = false, materials = true, polygons = true, vertexColors = true, morphTargets = true }, + sniff = 0, load = function() return __include("model/lwo") end, @@ -2471,6 +2590,7 @@ local list= { mime = { "text/x-quake-map" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Miptex", "codecs/model/Brush", "codecs/model/Patch" }, caps = { decode = true, encode = true, variants = { "quake", "valve220", "quake2", "quake3" }, patches = true }, + sniff = 0, load = function() return __include("model/map") end, @@ -2483,6 +2603,7 @@ local list= { mime = { "application/x-minecraft-region" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/text/Nbt", "codecs/model/Minecraft", "codecs/compress/Lz4" }, caps = { decode = true, encode = false, voxels = true, blocks = true }, + sniff = 0, load = function() return __include("model/mca") end, @@ -2495,6 +2616,7 @@ local list= { mime = { "model/x-md2" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Rig" }, caps = { decode = true, encode = false, morph = true, animation = true }, + sniff = 0, load = function() return __include("model/md2") end, @@ -2507,6 +2629,7 @@ local list= { mime = { "model/x-md3" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Mat4", "codecs/model/Rig" }, caps = { decode = true, encode = false, morph = true, animation = true, tags = true }, + sniff = 0, load = function() return __include("model/md3") end, @@ -2519,6 +2642,7 @@ local list= { mime = { "model/x-md5mesh", "model/x-md5anim" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Sniff", "Types", "codecs/model/Rig" }, caps = { decode = true, encode = false, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/md5") end, @@ -2531,6 +2655,7 @@ local list= { mime = { "model/x-mdl" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/SourceAnim" }, caps = { decode = true, encode = false, variants = { "quake", "halflife" }, morph = true, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/mdl") end, @@ -2543,6 +2668,7 @@ local list= { mime = { "application/x-ms3d" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, materials = true, skins = true, animation = true }, + sniff = 1, load = function() return __include("model/ms3d") end, @@ -2555,6 +2681,7 @@ local list= { mime = { "model/obj" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, materials = true, polygons = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/obj") end, @@ -2567,6 +2694,7 @@ local list= { mime = { "model/off", "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, polygons = true, points = true, colors = true, binary = false }, + sniff = 0, load = function() return __include("model/off") end, @@ -2579,6 +2707,7 @@ local list= { mime = { "model/ply", "application/ply" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, ascii = true, binary = true, polygons = true, points = true, colors = true }, + sniff = 0, load = function() return __include("model/ply") end, @@ -2591,6 +2720,7 @@ local list= { mime = { "model/x-pmx", "model/x-pmd" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text" }, caps = { decode = true, encode = false, materials = true, skins = true, morphTargets = true, pmd = true }, + sniff = 0, load = function() return __include("model/pmx") end, @@ -2603,6 +2733,7 @@ local list= { mime = { "model/x-doom3-proc" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Lexer" }, caps = { decode = true, encode = false, portals = true }, + sniff = 0, load = function() return __include("model/proc") end, @@ -2615,6 +2746,7 @@ local list= { mime = { "model/x-qubicle" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, voxels = true, truecolor = true }, + sniff = 0, load = function() return __include("model/qb") end, @@ -2627,6 +2759,8 @@ local list= { mime = { "application/x-roblox-rbxm", "application/x-roblox-rbxl" }, deps = { "core/Err", "core/Bytes", "core/Md5", "codecs/compress/Lz4", "codecs/compress/Zstd", "codecs/model/Rbx", "codecs/model/Rbx/Binary" }, caps = { decode = true, encode = true, tree = true, compression = { "none", "lz4", "zstd" } }, + sniff = 0, + variant = true, load = function() return __include("model/rbxm") end, @@ -2639,6 +2773,8 @@ local list= { mime = { "application/x-roblox-rbxmx", "application/x-roblox-rbxlx" }, deps = { "core/Err", "core/Bytes", "core/Base64", "core/Md5", "codecs/text/Xml", "codecs/model/Rbx" }, caps = { decode = true, encode = true, tree = true }, + sniff = 0, + variant = true, load = function() return __include("model/rbxmx") end, @@ -2651,6 +2787,7 @@ local list= { mime = { "application/x-roblox-mesh" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Draco" }, caps = { decode = true, encode = true, skinning = true, lods = true, versions = { "1.00", "1.01", "2.00", "3.00", "3.01", "4.00", "4.01", "5.00", "6.00", "7.00" } }, + sniff = 0, load = function() return __include("model/robloxmesh") end, @@ -2663,6 +2800,8 @@ local list= { mime = { "application/x-minecraft-schematic" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Nbt", "codecs/model/Minecraft" }, caps = { decode = true, encode = true, voxels = true, blocks = true, variants = { "schem", "schematic", "litematic" } }, + sniff = 1, + variant = true, load = function() return __include("model/schematic") end, @@ -2675,6 +2814,7 @@ local list= { mime = { "model/x-smd", "text/plain" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Rig" }, caps = { decode = true, encode = true, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/smd") end, @@ -2687,6 +2827,7 @@ local list= { mime = { "model/x-source-mdl" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Half", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/SourceAnim", "codecs/text/KeyValues" }, caps = { decode = true, encode = false, skins = true, morph = true, animation = true, lods = true }, + sniff = 0, load = function() return __include("model/sourcemdl") end, @@ -2699,6 +2840,7 @@ local list= { mime = { "model/stl", "application/sla" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, ascii = true, binary = true, colors = true, indexed = false }, + sniff = 0, load = function() return __include("model/stl") end, @@ -2711,6 +2853,7 @@ local list= { mime = { "text/x-unreal-t3d" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Text", "codecs/model/Brush" }, caps = { decode = true, encode = false, text = true, brushes = true, actors = true }, + sniff = 0, load = function() return __include("model/t3d") end, @@ -2723,6 +2866,7 @@ local list= { mime = { "text/x-udmf" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/DoomMap" }, caps = { decode = true, encode = false, maps = true }, + sniff = 0, load = function() return __include("model/udmf") end, @@ -2735,6 +2879,7 @@ local list= { mime = { "model/vnd.usda", "model/vnd.usdz+zip" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip", "codecs/model/Mat4" }, caps = { decode = true, encode = true, materials = true, animation = true, cameras = true, lights = true, polygons = true, vertexColors = true, usdz = "read", usdc = false }, + sniff = 0, load = function() return __include("model/usda") end, @@ -2747,6 +2892,7 @@ local list= { mime = { "model/x-vbsp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Lzma", "codecs/text/KeyValues", "codecs/model/Mat4", "codecs/model/Displacement", "containers/Zip", "containers/Archive" }, caps = { decode = true, encode = false, versions = { 19, 20, 21 }, displacements = true, staticProps = true, pak = true }, + sniff = 0, load = function() return __include("model/vbsp") end, @@ -2759,6 +2905,7 @@ local list= { mime = { "model/x-vmf" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Sniff", "Types", "codecs/text/KeyValues", "codecs/model/Brush", "codecs/model/Displacement", "codecs/model/Mat4" }, caps = { decode = true, encode = true, displacements = true, roundTrip = true }, + sniff = 0, load = function() return __include("model/vmf") end, @@ -2771,6 +2918,7 @@ local list= { mime = { "model/x-vox" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, voxels = true, sceneGraph = true, materials = true }, + sniff = 0, load = function() return __include("model/vox") end, @@ -2783,6 +2931,7 @@ local list= { mime = { "model/vrml", "x-world/x-vrml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Vrml" }, caps = { decode = true, encode = true, materials = true, polygons = true, animation = true, cameras = true, lights = true, lines = true, points = true }, + sniff = 0, load = function() return __include("model/vrml") end, @@ -2795,6 +2944,7 @@ local list= { mime = { "model/x-directx", "text/x-directx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/model/Mat4", "codecs/model/Rig" }, caps = { decode = true, encode = false, text = true, binary = true, compressed = true, materials = true, skins = true, animation = true, polygons = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/x") end, @@ -2807,6 +2957,7 @@ local list= { mime = { "model/x3d+xml", "model/x3d-vrml", "model/x3d+fastinfoset" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Vrml" }, caps = { decode = true, encode = true, materials = true, polygons = true, animation = true, cameras = true, lights = true, lines = true, points = true, xml = true, classic = true }, + sniff = 0, load = function() return __include("model/x3d") end, @@ -2819,6 +2970,7 @@ local list= { mime = { "model/step", "application/step", "application/p21" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, complexEntities = true, sections = true, brep = "plugin", tessellate = "plugin" }, + sniff = 0, load = function() return __include("cad/step") end, @@ -2831,6 +2983,7 @@ local list= { mime = { "application/x-font-bdf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = true, bitmap = true }, + sniff = 0, load = function() return __include("font/bdf") end, @@ -2843,6 +2996,7 @@ local list= { mime = { "application/x-bmfont" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, bitmap = true, variants = { "text", "xml", "binary" }, extraFiles = true }, + sniff = 0, load = function() return __include("font/bmfont") end, @@ -2855,6 +3009,7 @@ local list= { mime = { "application/vnd.ms-fontobject" }, deps = { "core/Err", "core/Bytes", "codecs/text/Text", "codecs/font/TrueType" }, caps = { decode = true, encode = true, variants = { "1.0", "2.1", "2.2" } }, + sniff = 0, load = function() return __include("font/eot") end, @@ -2867,6 +3022,7 @@ local list= { mime = { "application/x-font-fnt" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text", "codecs/font/Bitmap" }, caps = { decode = true, encode = false, bitmap = true, variants = { "fnt2", "fnt3", "ne", "pe" } }, + sniff = 0, load = function() return __include("font/fon") end, @@ -2879,6 +3035,7 @@ local list= { mime = { "application/x-hershey-font" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Raster" }, caps = { decode = true, encode = false, strokes = true }, + sniff = 0, load = function() return __include("font/hershey") end, @@ -2891,6 +3048,7 @@ local list= { mime = { "application/x-font-pcf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = false, bitmap = true }, + sniff = 0, load = function() return __include("font/pcf") end, @@ -2903,6 +3061,7 @@ local list= { mime = { "application/x-font-linux-psf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = true, bitmap = true, variants = { "psf1", "psf2" } }, + sniff = 0, load = function() return __include("font/psf") end, @@ -2915,6 +3074,7 @@ local list= { mime = { "font/ttf", "font/otf", "font/collection" }, deps = { "core/Err", "core/Bytes", "codecs/font/TrueType" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" }, collection = true, kerning = true }, + sniff = 0, load = function() return __include("font/ttf") end, @@ -2927,6 +3087,7 @@ local list= { mime = { "application/x-font-type1" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Raster", "codecs/font/GlyphNames" }, caps = { decode = true, encode = false, outlines = { "type1" }, variants = { "pfb", "pfa" } }, + sniff = 0, load = function() return __include("font/type1") end, @@ -2939,6 +3100,7 @@ local list= { mime = { "font/woff" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/font/TrueType" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" } }, + sniff = 0, load = function() return __include("font/woff") end, @@ -2951,6 +3113,7 @@ local list= { mime = { "font/woff2" }, deps = { "core/Err", "core/Bytes", "codecs/font/TrueType", "codecs/compress/Brotli" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" }, transforms = { "glyf", "loca", "hmtx" } }, + sniff = 0, load = function() return __include("font/woff2") end, @@ -2963,6 +3126,7 @@ local list= { mime = { "application/x-7z-compressed" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "Types", "codecs/compress/Lzma", "codecs/compress/Deflate", "codecs/compress/Bzip2", "codecs/compress/Zstd", "containers/Archive", "codecs/text/Text" }, caps = { decode = true, encode = false, methods = { "copy", "lzma", "lzma2", "deflate", "bcj", "delta" }, encrypted = false }, + sniff = 0, load = function() return __include("archive/7z") end, @@ -2975,6 +3139,7 @@ local list= { mime = { "application/x-amiga-disk-format" }, deps = { "core/Err", "core/Bytes", "containers/Archive" }, caps = { decode = true, encode = false, variants = { "ofs", "ffs" } }, + sniff = 0, load = function() return __include("archive/adf") end, @@ -2987,6 +3152,7 @@ local list= { mime = { "application/applefile", "multipart/appledouble" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true, variants = { "applesingle", "appledouble" } }, + sniff = 0, load = function() return __include("archive/applesingle") end, @@ -2999,6 +3165,7 @@ local list= { mime = { "application/x-archive", "application/vnd.debian.binary-package" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzma", "codecs/compress/Zstd", "codecs/compress/Bzip2", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, variants = { "gnu", "bsd" }, deb = true }, + sniff = 0, load = function() return __include("archive/ar") end, @@ -3011,6 +3178,7 @@ local list= { mime = { "application/x-arj" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = false, methods = { "store", "arj1", "arj2", "arj3", "arj4" } }, + sniff = 0, load = function() return __include("archive/arj") end, @@ -3023,6 +3191,7 @@ local list= { mime = { "application/mac-binhex40" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true }, + sniff = 0, load = function() return __include("archive/binhex") end, @@ -3035,6 +3204,7 @@ local list= { mime = { "application/x-brotli" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Brotli", "containers/Archive" }, caps = { decode = true, encode = false, stream = true }, + sniff = 1, load = function() return __include("archive/br") end, @@ -3047,6 +3217,7 @@ local list= { mime = { "application/x-bzip2" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "codecs/compress/Bzip2" }, caps = { decode = true, encode = false, stream = true }, + sniff = 0, load = function() return __include("archive/bz2") end, @@ -3059,6 +3230,7 @@ local list= { mime = { "application/vnd.ms-cab-compressed" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzx", "codecs/compress/Quantum", "containers/Archive" }, caps = { decode = true, encode = true, methods = { "store", "mszip", "lzx", "quantum" } }, + sniff = 0, load = function() return __include("archive/cab") end, @@ -3071,6 +3243,7 @@ local list= { mime = { "application/x-cpio" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Cpio" }, caps = { decode = true, encode = true, variants = { "newc", "crc", "odc", "bin" } }, + sniff = 0, load = function() return __include("archive/cpio") end, @@ -3083,6 +3256,7 @@ local list= { mime = { "application/x-d64" }, deps = { "core/Err", "core/Bytes", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "d64", "d71", "d81" } }, + sniff = 0, load = function() return __include("archive/d64") end, @@ -3095,6 +3269,7 @@ local list= { mime = { "application/x-fat-image" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Fat" }, caps = { decode = true, encode = true, variants = { "fat12", "fat16", "fat32" } }, + sniff = 1, load = function() return __include("archive/fat") end, @@ -3107,6 +3282,7 @@ local list= { mime = { "application/x-build-grp" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "containers/Archive" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("archive/grp") end, @@ -3119,6 +3295,7 @@ local list= { mime = { "application/gzip" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Deflate", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, stream = true }, + sniff = 0, load = function() return __include("archive/gzip") end, @@ -3131,6 +3308,7 @@ local list= { mime = { "application/x-iso9660-image" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Iso9660" }, caps = { decode = true, encode = false, extensions = { "joliet", "rockridge", "eltorito" } }, + sniff = 0, load = function() return __include("archive/iso") end, @@ -3143,6 +3321,7 @@ local list= { mime = { "application/x-lzh-compressed" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = true, methods = { "lh0", "lh1", "lh4", "lh5", "lh6", "lh7", "lhx", "lzs", "lz5", "lz4", "lhd" } }, + sniff = 0, load = function() return __include("archive/lha") end, @@ -3155,6 +3334,7 @@ local list= { mime = { "application/x-lz4" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Lz4", "codecs/compress/Xxh32", "containers/Archive" }, caps = { decode = true, encode = true, stream = true, legacy = true }, + sniff = 0, load = function() return __include("archive/lz4") end, @@ -3167,6 +3347,7 @@ local list= { mime = { "application/x-macbinary" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true, variants = { "I", "II", "III" } }, + sniff = 0, load = function() return __include("archive/macbinary") end, @@ -3179,6 +3360,7 @@ local list= { mime = { "application/x-mpq" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "codecs/compress/Deflate", "codecs/compress/Bzip2", "codecs/compress/Lzma", "codecs/compress/Explode" }, caps = { decode = true, encode = false, versions = { 1, 2, 3, 4 }, methods = { "zlib", "implode", "bzip2", "lzma", "sparse" }, encryption = true }, + sniff = 0, load = function() return __include("archive/mpq") end, @@ -3191,6 +3373,7 @@ local list= { mime = { "application/x-pak" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "quake", "sin" } }, + sniff = 0, load = function() return __include("archive/pak") end, @@ -3203,6 +3386,7 @@ local list= { mime = { "application/x-rpm" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzma", "codecs/compress/Zstd", "codecs/compress/Bzip2", "containers/Archive", "containers/Cpio" }, caps = { decode = true, encode = false, compressors = { "gzip", "bzip2", "xz", "lzma", "zstd" } }, + sniff = 0, load = function() return __include("archive/rpm") end, @@ -3215,6 +3399,7 @@ local list= { mime = { "application/x-tar" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, variants = { "ustar", "pax", "gnu" } }, + sniff = 1, load = function() return __include("archive/tar") end, @@ -3227,6 +3412,7 @@ local list= { mime = { "application/x-unitypackage" }, deps = { "core/Err", "core/Bytes", "core/Md5", "codecs/compress/Deflate", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true }, + sniff = 1, load = function() return __include("archive/unitypackage") end, @@ -3239,6 +3425,7 @@ local list= { mime = { "text/x-uuencode" }, deps = { "core/Err", "core/Bytes", "core/Base64", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "uu", "xx", "base64" } }, + sniff = 0, load = function() return __include("archive/uu") end, @@ -3251,6 +3438,7 @@ local list= { mime = { "application/x-vpk" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Crc32", "core/Md5", "containers/Archive" }, caps = { decode = true, encode = true, versions = { 1, 2 }, multipart = true }, + sniff = 0, load = function() return __include("archive/vpk") end, @@ -3263,6 +3451,7 @@ local list= { mime = { "application/x-wolf3d-vswap" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Archive", "codecs/image/Pixels" }, caps = { decode = true, encode = false, images = true, sounds = true }, + sniff = 0, load = function() return __include("archive/vswap") end, @@ -3275,6 +3464,7 @@ local list= { mime = { "application/x-doom" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Archive", "codecs/image/Pixels", "codecs/model/DoomMap" }, caps = { decode = true, encode = true, images = true, maps = true, variants = { "iwad", "pwad" } }, + sniff = 0, load = function() return __include("archive/wad") end, @@ -3287,6 +3477,7 @@ local list= { mime = { "application/x-quake-wad" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "containers/Archive", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, images = true, variants = { "wad2", "wad3" } }, + sniff = 0, load = function() return __include("archive/wad2") end, @@ -3299,6 +3490,7 @@ local list= { mime = { "application/x-xz", "application/x-lzma" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Lzma", "containers/Archive" }, caps = { decode = true, encode = false, stream = true, filters = { "lzma2", "lzma", "delta", "x86", "powerpc", "arm", "armthumb", "sparc", "arm64" } }, + sniff = 0, load = function() return __include("archive/xz") end, @@ -3311,6 +3503,7 @@ local list= { mime = { "application/x-yenc" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "containers/Archive" }, caps = { decode = true, encode = true, multipart = true }, + sniff = 0, load = function() return __include("archive/yenc") end, @@ -3323,6 +3516,7 @@ local list= { mime = { "application/x-compress" }, deps = { "core/Err", "core/Bytes", "codecs/compress/UnixCompress", "containers/Archive" }, caps = { decode = true, encode = true, stream = true, bits = { 9, 16 } }, + sniff = 0, load = function() return __include("archive/z") end, @@ -3335,6 +3529,7 @@ local list= { mime = { "application/zip", "application/x-zip-compressed" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip" }, caps = { decode = true, encode = true, methods = { "store", "deflate" }, zip64 = true }, + sniff = 0, load = function() return __include("archive/zip") end, @@ -3347,6 +3542,7 @@ local list= { mime = { "application/x-zoo" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "codecs/compress/Lzw", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = false, methods = { "store", "lzw", "lzh" } }, + sniff = 0, load = function() return __include("archive/zoo") end, @@ -3359,6 +3555,7 @@ local list= { mime = { "application/zstd" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Zstd", "containers/Archive" }, caps = { decode = true, encode = false, stream = true }, + sniff = 1, load = function() return __include("archive/zst") end, @@ -3371,6 +3568,7 @@ local list= { mime = { "application/cbor", "application/cbor-seq" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, binary = true, ordered = true, tags = true }, + sniff = 0, load = function() return __include("data/cbor") end, @@ -3383,6 +3581,7 @@ local list= { mime = { "text/csv", "text/tab-separated-values" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, header = true }, + sniff = 0, load = function() return __include("data/csv") end, @@ -3395,6 +3594,7 @@ local list= { mime = { "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, ordered = true }, + sniff = 0, load = function() return __include("data/ini") end, @@ -3407,6 +3607,7 @@ local list= { mime = { "application/json", "application/x-ndjson" }, deps = { "core/Err", "core/Bytes", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, ordered = true, streaming = true }, + sniff = 0, load = function() return __include("data/json") end, @@ -3419,6 +3620,7 @@ local list= { mime = { "application/msgpack", "application/x-msgpack" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, binary = true, ordered = true }, + sniff = 0, load = function() return __include("data/msgpack") end, @@ -3431,6 +3633,7 @@ local list= { mime = { "application/x-minecraft-nbt" }, deps = { "core/Err", "core/Bytes", "codecs/text/Nbt" }, caps = { decode = true, encode = true, binary = true, ordered = true, typed = true }, + sniff = 1, load = function() return __include("data/nbt") end, @@ -3443,6 +3646,7 @@ local list= { mime = { "application/x-plist", "application/x-bplist" }, deps = { "core/Err", "core/Bytes", "Types", "core/Base64", "codecs/text/Xml", "codecs/text/Json" }, caps = { decode = true, encode = true, binary = "read", ordered = true }, + sniff = 0, load = function() return __include("data/plist") end, @@ -3455,6 +3659,7 @@ local list= { mime = { "text/x-quake3-shader" }, deps = { "core/Err", "core/Bytes" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("data/q3shader") end, @@ -3467,6 +3672,7 @@ local list= { mime = { "text/x-quake3-skin" }, deps = { "core/Err", "core/Bytes" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("data/q3skin") end, @@ -3479,6 +3685,7 @@ local list= { mime = { "text/x-minecraft-snbt" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "codecs/text/Nbt" }, caps = { decode = true, encode = true, ordered = true, typed = true }, + sniff = 0, load = function() return __include("data/snbt") end, @@ -3491,6 +3698,7 @@ local list= { mime = { "application/toml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "codecs/text/Text" }, caps = { decode = true, encode = true, ordered = true, dates = true }, + sniff = 0, load = function() return __include("data/toml") end, @@ -3503,6 +3711,7 @@ local list= { mime = { "application/x-godot-resource" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/GodotVariant" }, caps = { decode = true, encode = true, ordered = true }, + sniff = 0, load = function() return __include("data/tres") end, @@ -3515,6 +3724,7 @@ local list= { mime = { "text/x-vdf" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "codecs/text/KeyValues" }, caps = { decode = true, encode = true, ordered = true, binary = true }, + sniff = 1, load = function() return __include("data/vdf") end, @@ -3527,6 +3737,7 @@ local list= { mime = { "application/xml", "text/xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "core/Sniff" }, caps = { decode = true, encode = true, namespaces = true, streaming = true }, + sniff = 0, load = function() return __include("data/xml") end, @@ -3539,6 +3750,7 @@ local list= { mime = { "application/yaml", "application/x-yaml", "text/yaml" }, deps = { "core/Err", "core/Bytes", "Types", "core/Base64", "codecs/text/Text" }, caps = { decode = true, encode = true, ordered = true, multiDocument = true, anchors = true }, + sniff = 0, load = function() return __include("data/yaml") end, @@ -3551,6 +3763,7 @@ local list= { mime = { "application/x-wolf3d-gamemaps" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types" }, caps = { decode = true, encode = false, tilemap = true }, + sniff = 0, load = function() return __include("vector/gamemaps") end, @@ -3563,6 +3776,7 @@ local list= { mime = { "application/x-ldtk+json" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Json" }, caps = { decode = true, encode = true, levels = true, worlds = true, intGrid = true, entities = true }, + sniff = 0, load = function() return __include("vector/ldtk") end, @@ -3575,6 +3789,7 @@ local list= { mime = { "application/x-ogmo+json" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "core/Base64", "Types", "codecs/text/Json" }, caps = { decode = true, encode = true, projects = true, entities = true, decals = true }, + sniff = 0, load = function() return __include("vector/ogmo") end, @@ -3587,6 +3802,7 @@ local list= { mime = { "image/svg+xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "codecs/image/Raster", "codecs/image/Blend", "core/Sniff" }, caps = { decode = true, encode = true, rasterize = true, text = false }, + sniff = 0, load = function() return __include("vector/svg") end, @@ -3599,6 +3815,7 @@ local list= { mime = { "application/x-tiled-tmx", "application/x-tiled-tmj" }, deps = { "core/Err", "core/Bytes", "core/Base64", "Types", "codecs/text/Xml", "codecs/text/Json", "codecs/compress/Deflate", "core/Sniff" }, caps = { decode = true, encode = true, tilesets = true, infinite = true }, + sniff = 0, load = function() return __include("vector/tiled") end, @@ -3611,6 +3828,7 @@ local list= { mime = { "image/x-aseprite" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate" }, caps = { decode = true, encode = true, layers = true, groups = true, animation = true, depths = { 8, 16, 32 } }, + sniff = 0, load = function() return __include("layered/aseprite") end, @@ -3623,6 +3841,7 @@ local list= { mime = { "image/openraster" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip", "codecs/text/Xml", "codecs/image/Blend" }, caps = { decode = true, encode = true, layers = true, groups = true, depths = { 8 } }, + sniff = 0, load = function() return __include("layered/ora") end, @@ -3635,6 +3854,7 @@ local list= { mime = { "image/vnd.adobe.photoshop" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Blend", "codecs/compress/Deflate", "codecs/compress/PackBits", "codecs/text/Text" }, caps = { decode = true, encode = true, layers = true, groups = true, depths = { 1, 8, 16, 32 } }, + sniff = 0, load = function() return __include("layered/psd") end, @@ -3647,6 +3867,7 @@ local list= { mime = { "text/x-ssa", "text/x-ass" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = true }, + sniff = 0, load = function() return __include("subtitle/ass") end, @@ -3659,6 +3880,7 @@ local list= { mime = { "application/x-subrip", "text/srt" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = false }, + sniff = 0, load = function() return __include("subtitle/srt") end, @@ -3671,6 +3893,7 @@ local list= { mime = { "text/vtt" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = true }, + sniff = 0, load = function() return __include("subtitle/vtt") end, @@ -3683,6 +3906,7 @@ local list= { mime = { "audio/x-669" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 8, 8 } }, + sniff = 0, load = function() return __include("music/669") end, @@ -3695,6 +3919,7 @@ local list= { mime = { "audio/x-ahx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Hively" }, caps = { decode = true, encode = false, render = true, channels = { 4, 4 }, subsongs = true }, + sniff = 0, load = function() return __include("music/ahx") end, @@ -3707,6 +3932,7 @@ local list= { mime = { "audio/x-far" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 16, 16 } }, + sniff = 0, load = function() return __include("music/far") end, @@ -3719,6 +3945,7 @@ local list= { mime = { "audio/x-hmp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true, hmi = true }, + sniff = 0, load = function() return __include("music/hmp") end, @@ -3731,6 +3958,7 @@ local list= { mime = { "audio/x-hvl" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Hively" }, caps = { decode = true, encode = false, render = true, channels = { 4, 16 }, subsongs = true }, + sniff = 0, load = function() return __include("music/hvl") end, @@ -3743,6 +3971,7 @@ local list= { mime = { "audio/it", "audio/x-it" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, channels = { 1, 64 }, compressedSamples = true }, + sniff = 0, load = function() return __include("music/it") end, @@ -3755,6 +3984,7 @@ local list= { mime = { "audio/x-med" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 64 } }, + sniff = 0, load = function() return __include("music/med") end, @@ -3767,6 +3997,7 @@ local list= { mime = { "audio/midi", "audio/x-midi" }, deps = { "core/Err", "core/Bytes", "codecs/audio/MidiRender", "Types" }, caps = { decode = true, encode = true, formats = { 0, 1, 2 }, render = true, streaming = true, rmid = true }, + sniff = 0, load = function() return __include("music/midi") end, @@ -3779,6 +4010,7 @@ local list= { mime = { "audio/x-mod", "audio/mod" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = true, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/mod") end, @@ -3791,6 +4023,7 @@ local list= { mime = { "audio/x-mtm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/mtm") end, @@ -3803,6 +4036,7 @@ local list= { mime = { "audio/x-mus" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true }, + sniff = 0, load = function() return __include("music/mus") end, @@ -3815,6 +4049,7 @@ local list= { mime = { "audio/x-okt" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 4, 8 } }, + sniff = 0, load = function() return __include("music/okt") end, @@ -3827,6 +4062,7 @@ local list= { mime = { "audio/x-ptm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/ptm") end, @@ -3839,6 +4075,7 @@ local list= { mime = { "audio/s3m", "audio/x-s3m" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/s3m") end, @@ -3851,6 +4088,7 @@ local list= { mime = { "audio/x-soundfont" }, deps = { "core/Err", "core/Bytes", "codecs/audio/SoundFont" }, caps = { decode = true, encode = false, sm24 = true, sf3 = false }, + sniff = 1, load = function() return __include("music/sf2") end, @@ -3863,6 +4101,7 @@ local list= { mime = { "audio/x-stm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 4, 4 } }, + sniff = 0, load = function() return __include("music/stm") end, @@ -3875,6 +4114,7 @@ local list= { mime = { "audio/x-ult" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/ult") end, @@ -3887,6 +4127,7 @@ local list= { mime = { "audio/x-umx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, container = true }, + sniff = 0, load = function() return __include("music/umx") end, @@ -3899,6 +4140,7 @@ local list= { mime = { "audio/xm", "audio/x-xm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Adpcm" }, caps = { decode = true, encode = true, render = true, channels = { 1, 64 } }, + sniff = 0, load = function() return __include("music/xm") end, @@ -3911,6 +4153,7 @@ local list= { mime = { "audio/x-xmidi" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true, songs = true }, + sniff = 0, load = function() return __include("music/xmi") end, @@ -3923,6 +4166,7 @@ local list= { mime = { "audio/x-mpegurl", "audio/mpegurl", "application/vnd.apple.mpegurl", "application/x-mpegurl" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Text", "core/Sniff" }, caps = { decode = true, encode = true, hls = true }, + sniff = 0, load = function() return __include("playlist/m3u") end, @@ -3935,6 +4179,7 @@ local list= { mime = { "audio/x-scpls", "audio/scpls" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Text", "core/Sniff" }, caps = { decode = true, encode = true }, + sniff = 1, load = function() return __include("playlist/pls") end, @@ -3947,6 +4192,7 @@ local list= { mime = { "application/xspf+xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Xml" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("playlist/xspf") end, @@ -3955,6 +4201,3392 @@ local list= { return list end +__FILES["Sniffs"] = function() +local __compat = __compat local buffer, bit32, __iter = __compat.buffer, __compat.bit32, __compat.__iter --!strict +--!optimize 2 +-- Sniffs: GENERATED by tools/gen_registry.py from the format folders - do not edit. +-- Each format's sniff (format path -> sniff(r)), copied from its init.luau with the top-level locals and types it +-- reaches (tools/sniff_extract.py), so detection requires no format module. Requires outside core/ are proxies that +-- require on first use. Formats whose sniff needs their module (Registry sniff = 2) are not here. +local S= {} + +local function lazy(load) +local proxy = {} + return setmetatable(proxy, { + __index = function(_, k) +local m = load() + setmetatable(proxy, { __index = m }) + return m[k] + end, + }) +end + +do -- image/ani +local Bytes = __include("core/Bytes") +S["image/ani"] = function(r) +return r:peek(4) == "RIFF" and r:peek(4, 8) == "ACON" and 1 or 0 +end +end + +do -- image/art +local Bytes = __include("core/Bytes") +local readu8, readu16, readu32, readi16 = buffer.readu8, buffer.readu16, buffer.readu32, buffer.readi16 +local function header(b, o, limit) +local p = o + local prefixed = false + if limit - p >= 8 and buffer.readstring(b, p, 8) == "BUILDART" then + p =p+ 8 + prefixed = true + end + if limit - p < 16 or readu32(b, p) ~= 1 then + return nil, nil, nil, nil, nil + end + local first, last = readu32(b, p + 8), readu32(b, p + 12) + if last < first or last - first >= 65536 then + return nil, nil, nil, nil, nil + end + return p + 16, first, last, readu32(b, p + 4), prefixed +end +S["image/art"] = function(r) +local at, first, last = header(r.buf, r.base, r.limit) + if not at or not first or not last then + return 0 + end + local n = last - first + 1 + local p = at +if r.limit - p < n * 8 then + return 0 + end + local total = 0 + for i = 0, n - 1 do + local w, h = readi16(r.buf, p + i * 2), readi16(r.buf, p + n * 2 + i * 2) + if w < 0 or h < 0 then + return 0 + end + total =total+ w * h + end + local size = p + n * 8 + total - r.base + local have = r.limit - r.base + return size == have and 0.9 or(size < have and have - size < 4096 and 0.5 or 0 +)end +end + +do -- image/blp +local Bytes = __include("core/Bytes") +S["image/blp"] = function(r) +local m = r:peek(4) + return (m == "BLP1" or m == "BLP2" )and 1 or(m == "BLP0" and 0.8 or 0 +)end +end + +do -- image/bmp +local Bytes = __include("core/Bytes") +S["image/bmp"] = function(r) +if r:peek(2) ~= "BM" then + return 0 + end + local n = r:peekU8(14) + math.max(r:peekU8(15), 0) * 256 + if r:peekU8(16) == 0 and r:peekU8(17) == 0 and (n == 12 or n == 16 or n == 40 or n == 52 or n == 56 or n == 64 or n == 108 or n == 124) then + return 0.9 + end + return 0.2 +end +end + +do -- image/dds +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "DDS " +S["image/dds"] = function(r) +return math.max(Sniff.magic(r, MAGIC .. "\124\0\0\0"), Sniff.magic(r, MAGIC, 0, 0.6)) +end +end + +do -- image/exr +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "\118\47\49\1" +S["image/exr"] = function(r) +return Sniff.magic(r, MAGIC) +end +end + +do -- image/gif +local Bytes = __include("core/Bytes") +S["image/gif"] = function(r) +local s = r:peek(6) + return (s == "GIF89a" or s == "GIF87a" )and 1 or 0 +end +end + +do -- image/hdr +local Bytes = __include("core/Bytes") +S["image/hdr"] = function(r) +local s = r:peek(10) + if s == "#?RADIANCE" then + return 1 + end + if string.sub(s, 1, 6) == "#?RGBE" then + return 1 + end + if string.sub(s, 1, 2) == "#?" and string.match(s, "^#%?%u") then + return 0.5 + end + return 0 +end +end + +do -- image/icns +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/icns"] = function(r) +return Sniff.magic(r, "icns") +end +end + +do -- image/ico +local Bytes = __include("core/Bytes") +local readu8 = buffer.readu8 +S["image/ico"] = function(r) +if r:remaining() < 22 then + return 0 + end + local b, o = r.buf, r.pos + local typ = buffer.readu16(b, o + 2) + local count = buffer.readu16(b, o + 4) + if buffer.readu16(b, o) ~= 0 or (typ ~= 1 and typ ~= 2) or count == 0 then + return 0 + end + -- the first entry: reserved byte 0, a size and offset inside the file + local size, off = buffer.readu32(b, o + 14), buffer.readu32(b, o + 18) + if readu8(b, o + 9) ~= 0 or size == 0 or off < 6 + count * 16 then + return 0 + end + return 0.8 +end +end + +do -- image/ilbm +local Bytes = __include("core/Bytes") +S["image/ilbm"] = function(r) +if r:peek(4) ~= "FORM" then + return 0 + end + local t = r:peek(4, 8) + return (t == "ILBM" or t == "PBM " )and 1 or 0 +end +end + +do -- image/jpeg +local Bytes = __include("core/Bytes") +S["image/jpeg"] = function(r) +local s = r:peek(3) + return s == "\255\216\255" and 1 or 0 +end +end + +do -- image/ktx +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local ID1 = "\171KTX 11\187\r\n\26\n" +local ID2 = "\171KTX 20\187\r\n\26\n" +S["image/ktx"] = function(r) +return math.max(Sniff.magic(r, ID2), Sniff.magic(r, ID1)) +end +end + +do -- image/lmp +local Bytes = __include("core/Bytes") +local function kindOf(r) +local n = r:remaining() + if n == 768 then + return "palette" + elseif n == 16385 or n == 16384 then + return "colormap" + end + if n < 9 then + return nil + end + local w, h = buffer.readu32(r.buf, r.pos), buffer.readu32(r.buf, r.pos + 4) + if w > 0 and h > 0 and w <= 4096 and h <= 4096 and 8 + w * h == n then + return "qpic" + end + return nil +end +S["image/lmp"] = function(r) +local k = kindOf(r) + return k == "qpic" and 0.3 or(k and 0.05 or 0 +)end +end + +do -- image/pcx +local Bytes = __include("core/Bytes") +S["image/pcx"] = function(r) +if r:size() < 128 then + return 0 + end + local m, v, e, bpp = r:peekU8(0), r:peekU8(1), r:peekU8(2), r:peekU8(3) + if m ~= 10 or (v ~= 0 and v ~= 2 and v ~= 3 and v ~= 4 and v ~= 5) or e > 1 then + return 0 + end + return (bpp == 1 or bpp == 2 or bpp == 4 or bpp == 8 )and 0.8 or 0 +end +end + +do -- image/png +local Bytes = __include("core/Bytes") +local SIGNATURE = "\137PNG\r\n\26\n" +S["image/png"] = function(r) +return r:peek(8) == SIGNATURE and 1 or 0 +end +end + +do -- image/pnm +local Bytes = __include("core/Bytes") +S["image/pnm"] = function(r) +if r:remaining() < 3 then + return 0 + end + local a, b, c = r:peekU8(0), r:peekU8(1), r:peekU8(2) + if a ~= 80 then -- 'P' + return 0 + end + local ws = c == 32 or (c >= 9 and c <= 13) + if b >= 49 and b <= 55 and ws then -- P1..P7 + return 0.9 + end + if (b == 70 or b == 102) and ws then -- PF / Pf + return 0.9 + end + return 0 +end +end + +do -- image/qoi +local Bytes = __include("core/Bytes") +S["image/qoi"] = function(r) +return r:peek(4) == "qoif" and 1 or 0 +end +end + +do -- image/sgi +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/sgi"] = function(r) +if Sniff.magic(r, "\1\218") == 0 or r:size() < 512 then + return 0 + end + local st, bpc = r:peekU8(2), r:peekU8(3) + return st <= 1 and (bpc == 1 or bpc == 2) and 1 or 0 +end +end + +do -- image/spr +local Bytes = __include("core/Bytes") +S["image/spr"] = function(r) +if r:remaining() < 36 or r:peek(4) ~= "IDSP" then + return 0 + end + local v = buffer.readi32(r.buf, r.pos + 4) + return (v == 1 or v == 2 or v == 32 )and 1 or 0.3 +end +end + +do -- image/sunras +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "\89\166\106\149" +S["image/sunras"] = function(r) +return Sniff.magic(r, MAGIC) +end +end + +do -- image/tga +local Bytes = __include("core/Bytes") +local TYPES = { [1] = true, [2] = true, [3] = true, [9] = true, [10] = true, [11] = true } +local FOOTER = "TRUEVISION-XFILE.\0" +local readu8 = buffer.readu8 + + + + + + + + + + + + +local function header(r) +if r.limit - r.base < 18 then + return nil + end + local b, o = r.buf, r.base + local function u16(q) +return readu8(b, o + q) + readu8(b, o + q + 1) * 256 + end + local h= { + idLen = readu8(b, o), + cmapType = readu8(b, o + 1), + imageType = readu8(b, o + 2), + cmapFirst = u16(3), + cmapLen = u16(5), + cmapBits = readu8(b, o + 7), + width = u16(12), + height = u16(14), + depth = readu8(b, o + 16), + desc = readu8(b, o + 17), + } + return h +end +local function implausible(h) +local t = h.imageType + if not TYPES[t] then + return "image type " .. t + end + if h.cmapType > 1 then + return "colour map type " .. h.cmapType + end + local mapped = t == 1 or t == 9 + if mapped and (h.cmapType ~= 1 or (h.depth ~= 8 and h.depth ~= 16)) then + return "colour-mapped image without a colour map" + end + if h.cmapType == 1 and h.cmapLen > 0 and h.cmapBits ~= 15 and h.cmapBits ~= 16 and h.cmapBits ~= 24 and h.cmapBits ~= 32 then + return "colour map entry size " .. h.cmapBits + end + if (t == 2 or t == 10) and h.depth ~= 15 and h.depth ~= 16 and h.depth ~= 24 and h.depth ~= 32 then + return "pixel depth " .. h.depth + end + if (t == 3 or t == 11) and h.depth ~= 8 and h.depth ~= 16 then + return "grey pixel depth " .. h.depth + end + if h.width == 0 or h.height == 0 then + return "zero size" + end + if h.desc >= 64 then + return "interleaving / reserved descriptor bits" + end + return nil +end +S["image/tga"] = function(r) +local h = header(r) + if not h or implausible(h) then + return 0 + end + local n = r.limit - r.base + if n >= 44 and buffer.readstring(r.buf, r.limit - 18, 18) == FOOTER then + return 0.9 + end + return 0.2 +end +end + +do -- image/tiff +local Bytes = __include("core/Bytes") +S["image/tiff"] = function(r) +local s = r:peek(4) + if s == "II*\0" or s == "MM\0*" or s == "II+\0" or s == "MM\0+" then + return 1 + end + return 0 +end +end + +do -- image/tim +local Bytes = __include("core/Bytes") +S["image/tim"] = function(r) +if r:remaining() < 20 or r:peek(4) ~= "\16\0\0\0" then + return 0 + end + local flags = r:peekU8(4) + if flags > 0x0F or (flags % 8) > 3 or r:peek(3, 5) ~= "\0\0\0" then + return 0 + end + return 0.8 +end +end + +do -- image/vtf +local Bytes = __include("core/Bytes") +S["image/vtf"] = function(r) +return r:peek(4) == "VTF\0" and r:peekU8(4) == 7 and 1 or 0 +end +end + +do -- image/webp +local Bytes = __include("core/Bytes") +S["image/webp"] = function(r) +if r:peek(4) == "RIFF" and r:peek(4, 8) == "WEBP" then + return 1 + end + return 0 +end +end + +do -- image/xbm +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/xbm"] = function(r) +local s = Sniff.text(r, 256, true) + if string.match(s, "^#define%s+[%w_]*_?width%s+%d+") or string.match(s, "^/%*.-%*/%s*#define%s+[%w_]*width%s+%d+") then + return 0.9 + end + return 0 +end +end + +do -- image/xpm +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/xpm"] = function(r) +local s = Sniff.text(r, 64, true) + if string.sub(s, 1, 9) == "/* XPM */" or string.sub(s, 1, 6) == "! XPM2" then + return 1 + end + return 0 +end +end + +do -- audio/aac +local Bytes = __include("core/Bytes") +local Aac = lazy(function() + return __include("codecs/audio/Aac") +end) +local readu8 = buffer.readu8 +local function id3Size(b, p, limit) +if p + 10 > limit or buffer.readstring(b, p, 3) ~= "ID3" then + return 0 + end + local s = 0 + for i = 6, 9 do + s = s * 128 + bit32.band(readu8(b, p + i), 127) + end + local footer = bit32.band(readu8(b, p + 5), 0x10) ~= 0 and 10 or 0 + return 10 + s + footer +end +S["audio/aac"] = function(r) +local b, p, limit = r.buf, r.pos, r.limit + p =p+ id3Size(b, p, limit) + local h = Aac.adts(b, p, limit) + if not h then + return 0 + end + local h2 = Aac.adts(b, p + h.frameSize, limit) + if h2 and h2.sfIndex == h.sfIndex and h2.channelConfig == h.channelConfig then + return 0.9 + end + return p + h.frameSize >= limit and 0.7 or 0.4 +end +end + +do -- audio/ac3 +local Bytes = __include("core/Bytes") +local Ac3 = lazy(function() + return __include("codecs/audio/Ac3") +end) +S["audio/ac3"] = function(r) +local b, p, limit = r.buf, r.pos, r.limit + local h = Ac3.header(b, p, limit) + if not h then + return 0 + end + local h2 = Ac3.header(b, p + h.frameSize, limit) + if h2 and h2.sampleRate == h.sampleRate then + return 0.9 + end + return p + h.frameSize >= limit and 0.6 or 0.3 +end +end + +do -- audio/adpcm +local Bytes = __include("core/Bytes") +S["audio/adpcm"] = function(_r) +return 0 +end +end + +do -- audio/adx +local Bytes = __include("core/Bytes") +S["audio/adx"] = function(r) +if r:peekU8(0) ~= 0x80 or r:peekU8(1) ~= 0 then + return 0 + end + local off = r:peekU8(2) * 256 + r:peekU8(3) + return r:peek(6, off - 2) == "(c)CRI" and 1 or 0 +end +end + +do -- audio/aiff +local Bytes = __include("core/Bytes") +S["audio/aiff"] = function(r) +if r:remaining() < 12 or r:peek(4) ~= "FORM" then + return 0 + end + local form = buffer.readstring(r.buf, r.pos + 8, 4) + return (form == "AIFF" or form == "AIFC" )and 1 or 0 +end +end + +do -- audio/ape +local Bytes = __include("core/Bytes") +S["audio/ape"] = function(r) +local head = r:peek(4) + if head == "MAC " or head == "MACF" then -- MACF: float samples + return 1 + end + if string.sub(head, 1, 3) == "ID3" then + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + local id = r:peek(4, 10 + sz + (footer and 10 or 0)) + return (id == "MAC " or id == "MACF" )and 1 or 0 + end + return 0 +end +end + +do -- audio/au +local Bytes = __include("core/Bytes") +S["audio/au"] = function(r) +return r:peek(4) == ".snd" and 1 or 0 +end +end + +do -- audio/brstm +local Bytes = __include("core/Bytes") +S["audio/brstm"] = function(r) +local m = r:peek(4) + if m ~= "RSTM" and m ~= "CSTM" and m ~= "FSTM" then + return 0 + end + local bom = r:peek(2, 4) + return (bom == "\254\255" or bom == "\255\254" )and 1 or 0 +end +end + +do -- audio/caf +local Bytes = __include("core/Bytes") +S["audio/caf"] = function(r) +local h = r:peek(8) + if #h == 8 and string.sub(h, 1, 4) == "caff" and string.byte(h, 5) == 0 and string.byte(h, 6) == 1 then + return 1 + end + return 0 +end +end + +do -- audio/flac +local Bytes = __include("core/Bytes") +S["audio/flac"] = function(r) +local head = r:peek(4) + if head == "fLaC" then + return 1 + end + if head == "OggS" then + -- the first page's packet: 0x7F "FLAC" (the Ogg FLAC mapping) + local nseg = r:peekU8(26) + if nseg > 0 and r:peek(5, 27 + nseg) == "\127FLAC" then + return 1 + end + return 0 + end + if string.sub(head, 1, 3) == "ID3" then + -- an ID3v2 tag, then fLaC (mp3 files start with ID3 too) + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + return r:peek(4, 10 + sz + (footer and 10 or 0)) == "fLaC" and 1 or 0 + end + return 0 +end +end + +do -- audio/m4a +local Bytes = __include("core/Bytes") +local IsoBmff = lazy(function() + return __include("containers/IsoBmff") +end) +local AUDIO_BRANDS= { ["M4A "] = 1, ["M4B "] = 1, ["M4P "] = 1, ["M4V "] = 0.3 } +S["audio/m4a"] = function(r) +local brand = IsoBmff.sniff(r) + if brand == nil then + return 0 + end + if AUDIO_BRANDS[brand] then + return AUDIO_BRANDS[brand] + end + if brand == "avif" or brand == "avis" or brand == "heic" or brand == "heix" or brand == "mif1" or brand == "msf1" or brand == "crx " then + return 0 + end + return 0.4 -- an MP4 / MOV that may hold audio; a video format claims it more strongly +end +end + +do -- audio/mp3 +local Bytes = __include("core/Bytes") +local Header = lazy(function() + return __include("codecs/audio/Mpa/Header") +end) +local Tags = lazy(function() + return __include("audio/mp3/Tags") +end) +S["audio/mp3"] = function(r) +local b, p, lim = r.buf, r.pos, r.limit + local id3 = false + for _ = 1, 4 do -- (ffmpeg writes a tag even when the input had one: tags can follow each other) + local n = (p + 3 <= lim and buffer.readstring(b, p, 3) == "ID3" and{(Tags.id3v2Size(b, p, lim) )}or{0 +})[1] if n <= 0 then + break + end + id3 = true + p =p+ n + end + if p + 4 > lim or not Header.valid(b, p) then + return id3 and 0.5 or 0 + end + local fb = Header.frameBytes(b, p, 0) + if fb > 0 then + fb =fb+ Header.padding(b, p) + if p + fb + 4 <= lim and Header.compare(b, p, p + fb) then + return 0.9 + end + if p + fb == lim then + return 0.6 + end + end + return id3 and 0.7 or 0.25 +end +end + +do -- audio/mpc +local Bytes = __include("core/Bytes") +local Musepack = lazy(function() + return __include("codecs/audio/Musepack") +end) +local function id3v2(b, p, limit) +if p + 10 > limit or buffer.readstring(b, p, 3) ~= "ID3" then + return 0 + end + local n = 10 + for i = 6, 9 do + n =n+ bit32.band(buffer.readu8(b, p + i), 127) * 128 ^ (9 - i) + end + return n + (bit32.band(buffer.readu8(b, p + 5), 0x10) ~= 0 and 10 or 0) +end +S["audio/mpc"] = function(r) +local b, p, limit = r.buf, r.pos, r.limit + p =p+ id3v2(b, p, limit) + local v = Musepack.magic(b, p, limit) + if v == 8 then + return 1 + end + return v == 7 and 0.9 or 0 +end +end + +do -- audio/opus +local Bytes = __include("core/Bytes") +S["audio/opus"] = function(r) +if r:peek(4) ~= "OggS" then + return 0 + end + local nseg = r:peekU8(26) + if nseg < 1 then + return 0 + end + return r:peek(8, 27 + nseg) == "OpusHead" and 1 or 0 +end +end + +do -- audio/qoa +local Bytes = __include("core/Bytes") +S["audio/qoa"] = function(r) +return r:peek(4) == "qoaf" and 1 or 0 +end +end + +do -- audio/tta +local Bytes = __include("core/Bytes") +local function id3Size(r) +if r:peek(3) ~= "ID3" then + return 0 + end + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + return 10 + sz + (footer and 10 or 0) +end +S["audio/tta"] = function(r) +return r:peek(4, id3Size(r)) == "TTA1" and 1 or 0 +end +end + +do -- audio/vag +local Bytes = __include("core/Bytes") +S["audio/vag"] = function(r) +local m = r:peek(4) + return (m == "VAGp" or m == "VAGi" or m == "KVAG" )and 1 or 0 +end +end + +do -- audio/voc +local Bytes = __include("core/Bytes") +local MAGIC = "Creative Voice File\26" +S["audio/voc"] = function(r) +return r:peek(20) == MAGIC and 1 or 0 +end +end + +do -- audio/vorbis +local Bytes = __include("core/Bytes") +S["audio/vorbis"] = function(r) +if r:remaining() < 35 or r:peek(4) ~= "OggS" then + return 0 + end + local b, p = r.buf, r.pos + local nseg = buffer.readu8(b, p + 26) + local d = p + 27 + nseg + if d + 7 > r.limit then + return 0 + end + return buffer.readu8(b, d) == 1 and buffer.readstring(b, d + 1, 6) == "vorbis" and 1 or 0 +end +end + +do -- audio/wav +local Bytes = __include("core/Bytes") +local Riff = lazy(function() + return __include("containers/Riff") +end) +S["audio/wav"] = function(r) +return Riff.sniff(r) == "WAVE" and 1 or 0 +end +end + +do -- audio/wavpack +local Bytes = __include("core/Bytes") +S["audio/wavpack"] = function(r) +if r:peek(4) ~= "wvpk" then + return 0 + end + local v = r:peekU8(9) + return v == 4 and 1 or 0.5 +end +end + +do -- video/avi +local Bytes = __include("core/Bytes") +S["video/avi"] = function(r) +if r:peek(4) == "RIFF" and r:peek(4, 8) == "AVI " then + return 1 + end + return 0 +end +end + +do -- video/fli +local Bytes = __include("core/Bytes") +local FLI, FLC, DTA = 0xAF11, 0xAF12, 0xAF44 +S["video/fli"] = function(r) +local s = r:peek(18) + if #s < 18 then + return 0 + end + local magic = string.byte(s, 5) + string.byte(s, 6) * 256 + if magic ~= FLI and magic ~= FLC and magic ~= DTA then + return 0 + end + local w = string.byte(s, 9) + string.byte(s, 10) * 256 + local h = string.byte(s, 11) + string.byte(s, 12) * 256 + if w > 4096 or h > 4096 then + return 0 + end + return 0.9 +end +end + +do -- video/flv +local Bytes = __include("core/Bytes") +S["video/flv"] = function(r) +if r:remaining() >= 9 and r:peek(3) == "FLV" then + return r:peekU8(3) == 1 and 1 or 0.6 + end + return 0 +end +end + +do -- video/h264 +local Bytes = __include("core/Bytes") +S["video/h264"] = function(r) +local s = r:peek(5) + if not s or #s < 4 then + return 0 + end + local hdr + if string.byte(s, 1) == 0 and string.byte(s, 2) == 0 and string.byte(s, 3) == 1 then + hdr = string.byte(s, 4) + elseif #s >= 5 and string.byte(s, 1) == 0 and string.byte(s, 2) == 0 and string.byte(s, 3) == 0 and string.byte(s, 4) == 1 then + hdr = string.byte(s, 5) + else + return 0 + end + if hdr >= 128 then + return 0 + end + local t = hdr % 32 + if t == 7 then + return 0.8 + elseif t == 9 or t == 6 or t == 8 then + return 0.5 + elseif t == 5 then + return 0.4 + end + return 0 +end +end + +do -- video/mkv +local Bytes = __include("core/Bytes") +S["video/mkv"] = function(r) +if r:peek(4) ~= "\26\69\223\163" then + return 0 + end + local head = r:peek(math.min(64, r:remaining())) + if string.find(head, "webm", 1, true) or string.find(head, "matroska", 1, true) then + return 1 + end + return 0.5 +end +end + +do -- video/mp4 +local Bytes = __include("core/Bytes") +local IsoBmff = lazy(function() + return __include("containers/IsoBmff") +end) +local IMAGE_BRANDS = { avif = true, avis = true, heic = true, heix = true, mif1 = true, msf1 = true, ["crx "] = true } +local AUDIO_BRANDS = { ["M4A "] = true, ["M4B "] = true, ["M4P "] = true } +S["video/mp4"] = function(r) +local brand = IsoBmff.sniff(r) + if brand == nil or IMAGE_BRANDS[brand] then + return 0 + end + if AUDIO_BRANDS[brand] then + return 0.2 + end + if brand == "M4V " then + return 0.9 + end + return brand == "" and 0.6 or 0.8 +end +end + +do -- video/mpegps +local Bytes = __include("core/Bytes") +S["video/mpegps"] = function(r) +if r:peek(4) == "\0\0\1\186" then + return 0.9 + end + if r:peek(4) == "\0\0\1\179" then + return 0.5 -- an MPEG-1 / 2 video elementary stream (sequence header) + end + return 0 +end +end + +do -- video/mpegts +local Bytes = __include("core/Bytes") +local SIZES = { 188, 192 } +local function packetSize(r) +local n = r:remaining() + local head = r:peek(2048 + 2 * 192) + local lim = math.min(n, 2048) + local start = 0 + while start < lim do + local f = string.find(head, "G", start + 1, true) -- 0x47 + if not f or f > lim then + break + end + start = f - 1 + for _, size in __iter(SIZES) do + local hits, need = 0, math.min(3, math.floor((n - start - 1) / size )+ 1) + for k = 0, 2 do + local at = start + k * size + if at < n and string.byte(head, at + 1) == 0x47 then + hits =hits+ 1 + end + end + if hits >= need and (need >= 2 or start == 0) then + if size == 192 and start >= 4 then + return 192, start - 4 + elseif size == 188 then + return 188, start + end + end + end + start =start+ 1 + end + return 0, 0 +end +S["video/mpegts"] = function(r) +local s, off = packetSize(r) + if s == 0 then + return 0 + end + if off > 0 then + return 0.6 + end + return r:remaining() >= 3 * s and 0.9 or 0.5 +end +end + +do -- video/ogv +local Bytes = __include("core/Bytes") +S["video/ogv"] = function(r) +if r:peek(4) ~= "OggS" then + return 0 + end + local b, p, lim = r.buf, r.pos, r.limit + for _ = 1, 8 do + if p + 27 > lim or buffer.readstring(b, p, 4) ~= "OggS" or buffer.readu8(b, p + 5) % 4 < 2 then + return 0 + end + local nseg = buffer.readu8(b, p + 26) + local d = p + 27 + nseg + if d + 7 <= lim and buffer.readu8(b, d) == 0x80 and buffer.readstring(b, d + 1, 6) == "theora" then + return 1 + end + if d > lim then + return 0 + end + local size = 0 + for i = 0, nseg - 1 do + size =size+ buffer.readu8(b, p + 27 + i) + end + p = d + size + end + return 0 +end +end + +do -- video/smk +local Bytes = __include("core/Bytes") +S["video/smk"] = function(r) +local s = r:peek(4) + if s ~= "SMK2" and s ~= "SMK4" then + return 0 + end + return 1 +end +end + +do -- video/y4m +local Bytes = __include("core/Bytes") +local MAGIC = "YUV4MPEG2 " +S["video/y4m"] = function(r) +return r:peek(10) == MAGIC and 1 or 0 +end +end + +do -- model/3ds +local Bytes = __include("core/Bytes") +S["model/3ds"] = function(r) +local h = r:peek(8) + if #h < 8 or string.byte(h, 1) ~= 0x4D or string.byte(h, 2) ~= 0x4D then + return 0 + end + local b1, b2, b3, b4, c1, c2 = string.byte(h, 3, 8) + local size = b1 + b2 * 256 + b3 * 65536 + b4 * 16777216 + local child = c1 + c2 * 256 + if size < 16 or not (child == 0x0002 or child == 0x3D3D or child == 0xB000) then + return 0 + end + return size == r.limit - r.pos and 0.95 or 0.7 +end +end + +do -- model/3mf +local Bytes = __include("core/Bytes") +S["model/3mf"] = function(r) +if r:peek(4) ~= "PK\3\4" then + return 0 + end + local n = r:size() + local tail = buffer.readstring(r.buf, r.base + math.max(0, n - 65536), math.min(n, 65536)) + if string.find(tail, "3D/[^/]*%.model") or string.find(tail, "3dmodel.model", 1, true) then + return 0.95 + end + local head = r:peek(256) + if string.find(head, "3D/", 1, true) then + return 0.7 + end + return 0 +end +end + +do -- model/ase +local Bytes = __include("core/Bytes") +local Text = lazy(function() + return __include("codecs/text/Text") +end) +local MAGIC = "*3DSMAX_ASCIIEXPORT" +local function utf16(r) +local h = r:peek(2) + if h == "\255\254" then + return true, false + elseif h == "\254\255" then + return true, true + elseif #h == 2 and string.byte(h, 2) == 0 and string.byte(h, 1) == 42 then + return true, false + elseif #h == 2 and string.byte(h, 1) == 0 and string.byte(h, 2) == 42 then + return true, true + end + return nil, false +end +local function text(r, n) +local wide, be = utf16(r) + local len = r.limit - r.pos + if n then + len = math.min(len, n) + end + if wide then + local skip = (r:peek(2) == "\255\254" or r:peek(2) == "\254\255" )and 2 or 0 + return Text.utf16(r.buf, r.pos + skip, len - skip, be) + end + return Text.toUtf8(buffer.readstring(r.buf, r.pos, len)) +end +S["model/ase"] = function(r) +local h = string.match(text(r, 256), "^%s*(%*[%w_]+)") + if h == MAGIC then + return 1 + end + return 0 +end +end + +do -- model/b3d +local Bytes = __include("core/Bytes") +S["model/b3d"] = function(r) +if r:peek(4) == "BB3D" then + return r:peek(4, 8) ~= "" and 1 or 0.8 + end + return 0 +end +end + +do -- model/blend +local Bytes = __include("core/Bytes") +local Deflate = lazy(function() + return __include("codecs/compress/Deflate") +end) +local Zstd = lazy(function() + return __include("codecs/compress/Zstd") +end) +S["model/blend"] = function(r) +local head = r:peek(7) + if head == "BLENDER" then + return 1 + end + local n = r.limit - r.base + if string.sub(head, 1, 3) == "\31\139\8" then + local inner = Deflate.peek(r.buf, r.base, n, 7) + return inner and buffer.tostring(inner) == "BLENDER" and 1 or 0 + end + if string.sub(head, 1, 4) == Zstd.MAGIC then + if n > 4 * 2 ^ 20 then + return 0.5 + end + local out = Zstd.decompress(r.buf, r.base, n, { verify = false }) + return out and buffer.len(out) >= 7 and buffer.readstring(out, 0, 7) == "BLENDER" and 1 or 0 + end + return 0 +end +end + +do -- model/bsp +local Bytes = __include("core/Bytes") +S["model/bsp"] = function(r) +if r:remaining() < 64 then + return 0 + end + local m = r:peek(4) + local v = buffer.readi32(r.buf, r.pos + (m == "IBSP" and 4 or 0)) + if m == "BSP2" or m == "2PSB" then + v = 29 + end + if m == "IBSP" then + return (v == 38 or v == 46 or v == 47 )and 1 or 0.3 + end + if v == 29 or v == 30 then + local size = r:remaining() + for i = 0, 14 do + local o, n = buffer.readi32(r.buf, r.pos + 4 + i * 8), buffer.readi32(r.buf, r.pos + 8 + i * 8) + if o < 0 or n < 0 or o + n > size then + return 0 + end + end + return 0.6 + end + return 0 +end +end + +do -- model/buildmap +local Bytes = __include("core/Bytes") +local SECTOR_SIZE, WALL_SIZE, SPRITE_SIZE = 40, 32, 44 +local HEADER = 22 -- version, posx, posy, posz, ang, cursectnum, then u16 numsectors at 20 +local readu16 = buffer.readu16 +local function layout(b, o, limit) +if limit - o < HEADER then + return nil, nil, nil, nil + end + local ns = readu16(b, o + 20) + local p = o + HEADER + ns * SECTOR_SIZE + if p + 2 > limit then + return nil, nil, nil, nil + end + local nw = readu16(b, p) + p =p+ (2 + nw * WALL_SIZE +) if p + 2 > limit then + return nil, nil, nil, nil + end + local nsp = readu16(b, p) + p =p+ (2 + nsp * SPRITE_SIZE +) return ns, nw, nsp, p +end +S["model/buildmap"] = function(r) +local b, o, limit = r.buf, r.base, r.limit + if limit - o < HEADER then + return 0 + end + local v = buffer.readu32(b, o) + if v ~= 7 and v ~= 8 and v ~= 9 then + return 0 + end + local ns, _, _, stop = layout(b, o, limit) + if not ns or not stop or stop > limit then + return 0 + end + return stop == limit and 0.9 or 0.5 +end +end + +do -- model/d3map +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/d3map"] = function(r) +local head = Sniff.text(r, 512, true) + for _ = 1, 16 do + local rest = string.match(head, "^//[^\n]*\n%s*(.*)$") + if not rest then + break + end + head = rest + end + return string.match(head, "^Version%s+[123]%s") and 1 or 0 +end +end + +do -- model/dae +local Bytes = __include("core/Bytes") +S["model/dae"] = function(r) +local head = r:peek(2048) + if string.sub(head, 1, 4) == "PK\3\4" then + local nlen = string.byte(head, 27) or 0 + local name = string.lower(string.sub(head, 31, 30 + nlen)) + if string.find(name, "%.dae$") or name == "manifest.xml" then + return 0.95 + end + return 0 + end + -- UTF-16 files: drop the zero bytes + if string.find(string.sub(head, 1, 4), "\0", 1, true) then + head = string.gsub(head, "%z", "") + end + if string.find(head, " sectors then + return 0 + end + used =used+ 1 + if used == 1 then + local p = r.base + off * 4096 + if p + 5 > r.limit then + return 0 + end + local c = buffer.readu8(b, p + 4) % 128 + if COMPRESSION[c] == nil then + return 0 + end + end + end + end + return used > 0 and 0.8 or 0.2 +end +end + +do -- model/md2 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md2"] = function(r) +if r:remaining() < 68 then + return 0 + end + return Sniff.magic(r, "IDP2") == 1 and r:peekU8(4) == 8 and 1 or 0 +end +end + +do -- model/md3 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md3"] = function(r) +if r:remaining() < 108 then + return 0 + end + return Sniff.magic(r, "IDP3") == 1 and r:peekU8(4) == 15 and 1 or 0 +end +end + +do -- model/md5 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md5"] = function(r) +local head = Sniff.text(r, 512, true) + head = string.gsub(head, "^//[^\n]*\n%s*", "") + return string.match(head, "^MD5Version%s+%d+") and 1 or 0 +end +end + +do -- model/mdl +local Bytes = __include("core/Bytes") +S["model/mdl"] = function(r) +local m = r:peek(4) + local v = r:peekU8(4) + if (m == "IDPO" and v == 6) or (m == "IDST" and v == 10) then + return 1 + end + return 0 +end +end + +do -- model/ms3d +local Bytes = __include("core/Bytes") +local Read = lazy(function() + return __include("model/ms3d/Read") +end) +S["model/ms3d"] = function(r) +local h = r:peek(14) + if string.sub(h, 1, 10) ~= Read.MAGIC then + return 0 + end + local v = string.byte(h, 11) + return (v == 3 or v == 4 )and 1 or 0.6 +end +end + +do -- model/obj +local Bytes = __include("core/Bytes") +S["model/obj"] = function(r) +local head = r:peek(512) + if string.find(head, "\0", 1, true) then + return 0 + end + if string.find(head, "^%s*v%s+[%-%d%.]") or string.find(head, "\n%s*v%s+[%-%d%.]") then + return 0.6 + end + if string.find(head, "^#") and (string.find(head, "\nmtllib ") or string.find(head, "\no ") or string.find(head, "\ng ")) then + return 0.4 + end + return 0 +end +end + +do -- model/off +local Bytes = __include("core/Bytes") +S["model/off"] = function(r) +local head = r:peek(512) + for _ = 1, 16 do + local rest = string.match(head, "^%s*#[^\n]*\n(.*)$") + if not rest then + break + end + head = rest + end + local kw = string.match(head, "^%s*(%w+)") + if kw and string.match(kw, "^S?T?C?N?4?n?OFF$") then + return 0.9 + end + return 0 +end +end + +do -- model/ply +local Bytes = __include("core/Bytes") +S["model/ply"] = function(r) +local h = r:peek(4) + return (h == "ply\n" or h == "ply\r" )and 1 or 0 +end +end + +do -- model/pmx +local Bytes = __include("core/Bytes") +S["model/pmx"] = function(r) +local head = r:peek(8) + if string.sub(head, 1, 4) == "PMX " then + return 1 + end + if string.sub(head, 1, 7) == "Pmd\0\0\128\63" then + return 1 + end + return 0 +end +end + +do -- model/proc +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/proc"] = function(r) +local head = Sniff.text(r, 64, true) + if string.match(head, "^mapProcFile%d%d%d") then + return 1 + end + if string.match(head, '^"?PROC"?%s+"?%d') then + return 0.9 + end + return 0 +end +end + +do -- model/qb +local Bytes = __include("core/Bytes") +S["model/qb"] = function(r) +if r:remaining() < 24 or r:peek(4) ~= "\1\1\0\0" then + return 0 + end + local b, p = r.buf, r.pos + local fmt, z, comp, mask = buffer.readu32(b, p + 4), buffer.readu32(b, p + 8), buffer.readu32(b, p + 12), buffer.readu32(b, p + 16) + if fmt > 1 or z > 1 or comp > 1 or mask > 1 then + return 0 + end + return 0.9 +end +end + +do -- model/rbxm +local Bytes = __include("core/Bytes") +local MAGIC = "]*%?>", "") + if match(head, "^%s*]") then + return find(head, "version=", 1, true) and 1 or 0.8 + end + return 0 +end +end + +do -- model/robloxmesh +local Bytes = __include("core/Bytes") +S["model/robloxmesh"] = function(r) +return string.match(r:peek(13), "^version [1-7]%.%d%d[\r\n]") and 1 or 0 +end +end + +do -- model/schematic +local Bytes = __include("core/Bytes") +local Nbt = lazy(function() + return __include("codecs/text/Nbt") +end) +local LITEMATIC_HINTS = { "Regions", "EnclosingSize", "RegionCount", "TotalVolume", "MinecraftDataVersion" } +local SPONGE_HINTS = { "BlockData", "PaletteMax" } -- v1 / v2 fields (some writers leave the root unnamed) +local function hinted(head, hints) +for _, h in __iter(hints) do + if string.find(head, string.char(0, #h) .. h, 1, true) then + return true + end + end + return false +end +S["model/schematic"] = function(r) +local p = Nbt.peek(r.buf, r.base, r.limit - r.base) + if not p or p.rootType ~= "compound" or p.endian ~= "big" then + return 0 + end + if p.name == "Schematic" or (p.firstName == "Schematic" and p.firstType == "compound") then + return 1 + end + local head = buffer.tostring(p.head) + return (hinted(head, LITEMATIC_HINTS) or hinted(head, SPONGE_HINTS) )and 1 or 0 +end +end + +do -- model/smd +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/smd"] = function(r) +local head = Sniff.text(r, 256, true) + head = string.gsub(head, "^//[^\n]*\n%s*", "") + if string.match(head, "^version%s+1%s") and string.find(head, "nodes", 1, true) then + return 0.9 + end + return 0 +end +end + +do -- model/sourcemdl +local Bytes = __include("core/Bytes") +S["model/sourcemdl"] = function(r) +if r.limit - r.base < 8 or r:peek(4) ~= "IDST" then + return 0 + end + local v = buffer.readi32(r.buf, r.base + 4) + return v >= 44 and v <= 49 and 1 or 0 +end +end + +do -- model/stl +local Bytes = __include("core/Bytes") +local function lower5(s) +return string.lower(s) == "solid" +end +S["model/stl"] = function(r) +local size = r:remaining() + if size >= 84 then + local c = r:peek(4, 80) + local n = string.byte(c, 1) + string.byte(c, 2) * 256 + string.byte(c, 3) * 65536 + string.byte(c, 4) * 16777216 + if 84 + 50 * n == size then + return 0.9 + end + end + local head = r:peek(512) + local s = string.match(head, "^%s*(%a+)") + if s and lower5(s) then + local l = string.lower(head) + return (string.find(l, "facet", 1, true) or string.find(l, "endsolid", 1, true) )and 0.9 or 0.5 + end + return 0 +end +end + +do -- model/t3d +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/t3d"] = function(r) +local h = Sniff.text(r, 512) + local first = string.match(h, "^%s*(Begin%s+%a+)") + if first == nil then + return 0 + end + local kind = string.lower(string.match(first, "%a+$") or "") + if kind == "map" or kind == "actor" or kind == "level" or kind == "brush" or kind == "polylist" then + return 0.9 + end + return 0.3 +end +end + +do -- model/udmf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/udmf"] = function(r) +local head = Sniff.text(r, 1024, true) + for _ = 1, 32 do + local rest = string.match(head, "^//[^\n]*\n%s*(.*)$") or string.match(head, "^/%*.-%*/%s*(.*)$") + if not rest then + break + end + head = rest + end + if string.match(head, "^[Nn][Aa][Mm][Ee][Ss][Pp][Aa][Cc][Ee]%s*=%s*\"") then + return 0.9 + end + return 0 +end +end + +do -- model/usda +local Bytes = __include("core/Bytes") +local function isUsdz(r) +if r:peek(4) ~= "PK\3\4" then + return false + end + local lo, hi = r:peekU8(26), r:peekU8(27) + if lo < 0 or hi < 0 then + return false + end + local nameLen = lo + hi * 256 + local name = string.lower(r:peek(30 + nameLen)) + name = string.sub(name, 31) + return string.find(name, "%.usd[ac]?$") ~= nil +end +S["model/usda"] = function(r) +local head = r:peek(8) + if string.sub(head, 1, 5) == "#usda" or string.sub(head, 1, 8) == "\239\187\191#usda" then + return 1 + end + if head == "PXR-USDC" then + return 0.9 -- USDC magic, so the error says it is unsupported + end + if isUsdz(r) then + return 0.95 + end + return 0 +end +end + +do -- model/vbsp +local Bytes = __include("core/Bytes") +local HEADER = 8 + 64 * 16 + 4 +S["model/vbsp"] = function(r) +if r:remaining() < HEADER or r:peek(4) ~= "VBSP" then + return 0 + end + local v = buffer.readi32(r.buf, r.pos + 4) + return v >= 19 and v <= 21 and 1 or 0.5 +end +end + +do -- model/vmf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/vmf"] = function(r) +local head = Sniff.text(r, 512, true) + if string.find(head, "%z") then + return 0 + end + if string.match(head, "^versioninfo%s*{") or string.match(head, '^"versioninfo"%s*{') then + return 0.9 + end + if string.match(head, "^world%s*{") or string.match(head, "^visgroups%s*{") then + return 0.6 + end + return 0 +end +end + +do -- model/vox +local Bytes = __include("core/Bytes") +S["model/vox"] = function(r) +return r:peek(4) == "VOX " and r:peek(4, 8) == "MAIN" and 1 or(r:peek(4) == "VOX " and 0.8 or 0 +)end +end + +do -- model/vrml +local Bytes = __include("core/Bytes") +S["model/vrml"] = function(r) +local head = r:peek(16) + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + return string.sub(head, 1, 10) == "#VRML V2.0" and 1 or(string.sub(head, 1, 6) == "#VRML " and 0.6 or 0 +)end +end + +do -- model/x +local Bytes = __include("core/Bytes") +local ENCODINGS = { ["txt "] = "text", ["bin "] = "binary", tzip = "text", bzip = "binary" } +S["model/x"] = function(r) +if r:peek(4) ~= "xof " then + return 0 + end + return ENCODINGS[r:peek(4, 8)] and 1 or 0.5 +end +end + +do -- model/x3d +local Bytes = __include("core/Bytes") +S["model/x3d"] = function(r) +local head = r:peek(1024) + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + if string.sub(head, 1, 5) == "#X3D " then + return 1 + end + if string.sub(head, 1, 4) == "\224\0\0\1" and string.find(head, "x3d", 1, true) then + return 0.9 + end + if string.find(head, "]") or string.find(head, "", 1, true) or (string.find(head, "", 1, true)) then + return string.find(r:peek(512), "= 64 then + local lfanew = string.byte(h, 61) + string.byte(h, 62) * 256 + string.byte(h, 63) * 65536 + local sig = r:peek(2, lfanew) + return sig == "NE" and 0.6 or(sig == "PE" and 0.2 or 0 +) end + if isFnt(h) and #h >= 6 then + local size = string.byte(h, 3) + string.byte(h, 4) * 256 + string.byte(h, 5) * 65536 + string.byte(h, 6) * 16777216 + return size == r:size() and 0.9 or(size <= r:size() and size > 118 and 0.3 or 0 +) end + return 0 +end +end + +do -- font/hershey +local Bytes = __include("core/Bytes") +local function header(line) +if #line < 10 then + return nil, nil + end + local id = tonumber((string.gsub(string.sub(line, 1, 5), "^%s+", ""))) + local n = tonumber((string.gsub(string.sub(line, 6, 8), "^%s+", ""))) + if not id or not n or n < 1 or string.find(string.sub(line, 1, 8), "[^%d ]") then + return nil, nil + end + return id, n +end +S["font/hershey"] = function(r) +local head = r:peek(256) + local line = string.match(head, "^([^\r\n]*)") + local id, n = header(line or "") + if not id or not n then + return 0 + end + local body = string.sub(line , 9) + if string.find(body, "[^ -~]") then + return 0 + end + return (#body == math.min(2 * n, 64) or #body == 2 * n )and 0.7 or 0.3 +end +end + +do -- font/pcf +local Bytes = __include("core/Bytes") +S["font/pcf"] = function(r) +return r:peek(4) == "\1fcp" and 1 or 0 +end +end + +do -- font/psf +local Bytes = __include("core/Bytes") +S["font/psf"] = function(r) +local h = r:peek(4) + if h == "\114\181\74\134" then + return 1 + end + if string.sub(h, 1, 2) == "\54\4" and #h >= 4 and string.byte(h, 3) <= 7 and string.byte(h, 4) > 0 then + return 0.9 + end + return 0 +end +end + +do -- font/ttf +local Bytes = __include("core/Bytes") +S["font/ttf"] = function(r) +local m = r:peek(4) + if m == "\0\1\0\0" or m == "OTTO" or m == "ttcf" or m == "true" then + return 0.9 + end + return 0 +end +end + +do -- font/type1 +local Bytes = __include("core/Bytes") +S["font/type1"] = function(r) +local h = r:peek(64) + if string.sub(h, 1, 2) == "\128\1" then + h = string.sub(h, 7) + end + if string.sub(h, 1, 14) == "%!PS-AdobeFont" or string.sub(h, 1, 10) == "%!FontType" then + return 1 + end + return 0 +end +end + +do -- font/woff +local Bytes = __include("core/Bytes") +S["font/woff"] = function(r) +return r:peek(4) == "wOFF" and 1 or 0 +end +end + +do -- font/woff2 +local Bytes = __include("core/Bytes") +S["font/woff2"] = function(r) +return r:peek(4) == "wOF2" and 1 or 0 +end +end + +do -- archive/7z +local Bytes = __include("core/Bytes") +local MAGIC = "7z\188\175\39\28" +S["archive/7z"] = function(r) +return r:peek(6) == MAGIC and 1 or 0 +end +end + +do -- archive/adf +local Bytes = __include("core/Bytes") +local BS = 512 +S["archive/adf"] = function(r) +local n = r:size() + if n < 4 * BS or n % BS ~= 0 then + return 0 + end + local h = r:peek(4) + if string.sub(h, 1, 3) ~= "DOS" or string.byte(h, 4) > 5 then + return 0 + end + return (n == 901120 or n == 1802240 )and 0.95 or 0.6 +end +end + +do -- archive/applesingle +local Bytes = __include("core/Bytes") +S["archive/applesingle"] = function(r) +local h = r:peek(8) + if #h < 8 then + return 0 + end + local magic = string.sub(h, 1, 4) + local ver = string.sub(h, 5, 8) + if (magic == "\0\5\22\0" or magic == "\0\5\22\7") and (ver == "\0\1\0\0" or ver == "\0\2\0\0") then + return 1 + end + return 0 +end +end + +do -- archive/ar +local Bytes = __include("core/Bytes") +local MAGIC = "!\n" +S["archive/ar"] = function(r) +if r:peek(8) == MAGIC then + return r:peek(13, 68) == "debian-binary" and 1 or 0.9 + end + return r:peek(8) == "!\n" and 0.5 or 0 +end +end + +do -- archive/arj +local Bytes = __include("core/Bytes") +S["archive/arj"] = function(r) +local h = r:peek(4) + if #h == 4 and string.byte(h, 1) == 0x60 and string.byte(h, 2) == 0xEA then + local size = string.byte(h, 3) + string.byte(h, 4) * 256 + return size > 0 and size <= 2600 and 0.9 or 0 + end + return 0 +end +end + +do -- archive/binhex +local Bytes = __include("core/Bytes") +local BANNER = "(This file must be converted with BinHex" +S["archive/binhex"] = function(r) +local head = r:peek(2048) + local at = string.find(head, BANNER, 1, true) + if not at then + return 0 + end + return at == 1 and 1 or 0.8 +end +end + +do -- archive/br +local Err = __include("core/Err") +local Bytes = __include("core/Bytes") +local Brotli = lazy(function() + return __include("codecs/compress/Brotli") +end) +local SNIFF_WHOLE = 262144 -- streams up to this size are decoded whole by sniff +local SNIFF_PREFIX = 65536 +S["archive/br"] = function(r) +local n = r:remaining() + if n == 0 then + return 0 + end + if n <= SNIFF_WHOLE then + local out, consumed = Brotli.decompress(r.buf, r.pos, n, { maxBytes = 2 ^ 26 }) + if out and consumed == r.limit then + return buffer.len(out) > 0 and 0.3 or 0.05 + end + return 0 + end + local _, err = Brotli.decompress(r.buf, r.pos, SNIFF_PREFIX, { maxBytes = 2 ^ 22 }) + if err and (err.code == Err.TRUNCATED or err.code == Err.LIMIT) then + return 0.05 + end + return 0 +end +end + +do -- archive/bz2 +local Bytes = __include("core/Bytes") +S["archive/bz2"] = function(r) +local h = r:peek(10) + if #h < 10 or string.sub(h, 1, 3) ~= "BZh" then + return 0 + end + local lv = string.byte(h, 4) + if lv < 0x31 or lv > 0x39 then + return 0 + end + local magic = string.sub(h, 5, 10) + if magic == "\x31\x41\x59\x26\x53\x59" or magic == "\x17\x72\x45\x38\x50\x90" then + return 1 + end + return 0 +end +end + +do -- archive/cab +local Bytes = __include("core/Bytes") +S["archive/cab"] = function(r) +if r:peek(8) == "MSCF\0\0\0\0" then + return 1 + end + return 0 +end +end + +do -- archive/cpio +local Bytes = __include("core/Bytes") +S["archive/cpio"] = function(r) +local m = r:peek(6) + if m == "070701" or m == "070702" or m == "070707" then + return 1 + end + local b2 = r:peek(2) + if (b2 == "\199\113" or b2 == "\113\199") and r:remaining() >= 26 then + return 0.5 + end + return 0 +end +end + +do -- archive/d64 +local Bytes = __include("core/Bytes") + +local function geometry(kind, tracks) +local offsets, spt = {}, {} + local o = 0 + for t = 1, tracks do + local n + if kind == "d81" then + n = 40 + else + local s = (kind == "d71" and t > 35 and((t - 35 ))or(t +)) n = s <= 17 and 21 or(s <= 24 and 19 or(s <= 30 and 18 or 17 +)) end + offsets[t], spt[t] = o, n + o =o+ n * 256 + end + return { kind = kind, tracks = tracks, offsets = offsets, spt = spt, dirTrack = kind == "d81" and 40 or 18, total = o } +end +local function detect(len) +for _, g in __iter({ { "d64", 35 }, { "d64", 40 }, { "d64", 42 }, { "d71", 70 }, { "d81", 80 } }) do + local geo = geometry(g[1] , g[2] ) + local sectors = math.floor(geo.total / 256 +) if len == geo.total or (g[1] ~= "d81" and len == geo.total + sectors) then + return geo + end + end + return nil +end +S["archive/d64"] = function(r) +local geo = detect(r:size()) + if not geo then + return 0 + end + -- the BAM / header sector: dir track link and DOS version byte + local h = r:sub(geo.offsets[geo.dirTrack], 256) + local t, s, v = h:u8(), h:u8(), h:u8() + if geo.kind == "d81" then + return t == 40 and s == 3 and v == 0x44 and 0.9 or 0.3 + end + return t == 18 and s == 1 and (v == 0x41 or v == 0) and 0.9 or 0.3 +end +end + +do -- archive/fat +local Bytes = __include("core/Bytes") +local Fat = lazy(function() + return __include("containers/Fat") +end) +S["archive/fat"] = function(r) +if r:remaining() < 512 then + return 0 + end + local v = Fat.open(r.buf, r.base + r.pos, r.limit - r.base - r.pos) + if not v then + return 0 + end + return v.partition and 0.6 or 0.8 +end +end + +do -- archive/grp +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "KenSilverman" +S["archive/grp"] = function(r) +return Sniff.magic(r, MAGIC) +end +end + +do -- archive/gzip +local Bytes = __include("core/Bytes") +S["archive/gzip"] = function(r) +return r:peek(3) == "\31\139\8" and 1 or 0 +end +end + +do -- archive/iso +local Bytes = __include("core/Bytes") +S["archive/iso"] = function(r) +return r:peek(5, 16 * 2048 + 1) == "CD001" and 1 or 0 +end +end + +do -- archive/lha +local Bytes = __include("core/Bytes") +local METHODS= { + ["-lh0-"] = true, ["-lz4-"] = true, ["-lhd-"] = true, ["-lh1-"] = true, ["-lh4-"] = true, ["-lh5-"] = true, + ["-lh6-"] = true, ["-lh7-"] = true, ["-lhx-"] = true, ["-lzs-"] = true, ["-lz5-"] = true, ["-lh2-"] = true, + ["-lh3-"] = true, ["-pm0-"] = true, ["-pm1-"] = true, ["-pm2-"] = true, ["-lk7-"] = true, +} +local function isHeader(s) +if #s < 22 then + return false + end + local m = string.sub(s, 3, 7) + local level = string.byte(s, 21) + return METHODS[m] == true and level <= 3 +end +S["archive/lha"] = function(r) +if isHeader(r:peek(22)) then + return 0.95 + end + return 0 +end +end + +do -- archive/lz4 +local Bytes = __include("core/Bytes") +S["archive/lz4"] = function(r) +local m = r:peek(4) + if m == "\4\34\77\24" then + return 1 + elseif m == "\2\33\76\24" then + return 0.9 + elseif #m == 4 and string.byte(m, 1) >= 0x50 and string.byte(m, 1) <= 0x5F and string.sub(m, 2) == "\42\77\24" then + -- a skippable frame (zstd shares the magic): an LZ4 frame after it + local h = r:peek(4, 4) + if #h == 4 then + local n = string.byte(h, 1) + string.byte(h, 2) * 256 + string.byte(h, 3) * 65536 + string.byte(h, 4) * 16777216 + if r:peek(4, 8 + n) == "\4\34\77\24" then + return 1 + end + end + end + return 0 +end +end + +do -- archive/macbinary +local Bytes = __include("core/Bytes") +local Crc16 = __include("core/Crc16") +local function version(b, o, len) +if len < 128 then + return nil + end + local u8 = function(i) +return buffer.readu8(b, o + i) + end + if u8(0) ~= 0 or u8(74) ~= 0 then + return nil + end + local nameLen = u8(1) + if nameLen < 1 or nameLen > 63 then + return nil + end + local function be32(i) +return u8(i) * 16777216 + u8(i + 1) * 65536 + u8(i + 2) * 256 + u8(i + 3) + end + local dlen, rlen = be32(83), be32(87) + if dlen > 0x7FFFFFFF or rlen > 0x7FFFFFFF then + return nil + end + local crc = u8(124) * 256 + u8(125) + if crc == Crc16.ccitt(b, o, 124) and (crc ~= 0 or u8(122) >= 129) then + return buffer.readstring(b, o + 102, 4) == "mBIN" and"III" or"II" + end + if buffer.readstring(b, o + 102, 4) == "mBIN" then + return nil -- III with a bad CRC + end + -- MacBinary I: byte 82 zero, bytes 99..125 zero, the forks within the file + if u8(82) ~= 0 then + return nil + end + for i = 99, 125 do + if u8(i) ~= 0 then + return nil + end + end + local need = 128 + math.ceil(dlen / 128) * 128 + rlen + return need <= len + 127 and"I" or nil +end +S["archive/macbinary"] = function(r) +local n = math.min(r:remaining(), 128) + if n < 128 then + return 0 + end + local v = version(r.buf, r.base + r.pos, r.limit - r.base - r.pos) + return v == "III" and 0.95 or(v == "II" and 0.8 or(v == "I" and 0.3 or 0 +))end +end + +do -- archive/mpq +local Bytes = __include("core/Bytes") +S["archive/mpq"] = function(r) +local m = r:peek(4) + if m == "MPQ\x1A" or m == "MPQ\x1B" then + return 1 + end + -- a prefixed archive (an installer stub): the header on a 512-byte boundary in the first 64 KB + for at = 512, math.min(65536, r:remaining() - 32), 512 do + if r:peek(4, at) == "MPQ\x1A" then + return 0.6 + end + end + return 0 +end +end + +do -- archive/pak +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["archive/pak"] = function(r) +if r:remaining() < 12 then + return 0 + end + return math.max(Sniff.magic(r, "PACK", 0, 0.9), Sniff.magic(r, "SPAK", 0, 0.9)) +end +end + +do -- archive/rpm +local Bytes = __include("core/Bytes") +local LEAD_MAGIC = "\237\171\238\219" +S["archive/rpm"] = function(r) +return r:peek(4) == LEAD_MAGIC and 1 or 0 +end +end + +do -- archive/tar +local Bytes = __include("core/Bytes") +local Tar = lazy(function() + return __include("containers/Tar") +end) +S["archive/tar"] = function(r) +if r:remaining() < 512 then + return 0 + end + if not Tar.valid(r.buf, r.pos) then + return 0 + end + return r:peek(5, 257) == "ustar" and 0.95 or 0.6 +end +end + +do -- archive/unitypackage +local Bytes = __include("core/Bytes") +local Deflate = lazy(function() + return __include("codecs/compress/Deflate") +end) +local Tar = lazy(function() + return __include("containers/Tar") +end) +local function guidOf(name) +local n = string.gsub(name, "^%./", "") + local guid, rest = string.match(n, "^(%x+)/?(.*)$") + if guid and #guid == 32 then + return string.lower(guid), rest + end + return nil, nil +end +S["archive/unitypackage"] = function(r) +if r:peek(3) ~= "\31\139\8" then + return 0 + end + local head = Deflate.peek(r.buf, r.pos, r.limit - r.pos, 512) + if not head or buffer.len(head) < 512 or not Tar.valid(head, 0) then + return 0 + end + local z = 0 + while z < 100 and buffer.readu8(head, z) ~= 0 do + z =z+ 1 + end + return guidOf(buffer.readstring(head, 0, z)) and 1 or 0 -- ties with archive/gzip go to the extension +end +end + +do -- archive/uu +local Bytes = __include("core/Bytes") +S["archive/uu"] = function(r) +local head = r:peek(4096) + if string.match(head, "^begin%-base64 [0-7]+ [^\r\n]") or string.match(head, "^begin [0-7]+ [^\r\n]") then + return 0.9 + end + if string.match(head, "\nbegin%-base64 [0-7]+ [^\r\n]") or string.match(head, "\nbegin [0-7][0-7][0-7]+ [^\r\n]") then + return 0.5 + end + return 0 +end +end + +do -- archive/vpk +local Bytes = __include("core/Bytes") +S["archive/vpk"] = function(r) +if r:remaining() < 12 or r:peek(4) ~= "\x34\x12\xAA\x55" then + return 0 + end + local v = r:peekU8(4) + return (v == 1 or v == 2 )and 1 or 0.5 +end +end + +do -- archive/vswap +local Bytes = __include("core/Bytes") +local readu8, readu16, readi16, writeu32 = buffer.readu8, buffer.readu16, buffer.readi16, buffer.writeu32 +local function header(r) +if r:remaining() < 6 then + return nil, 0, 0 + end + local n, ss, so = readu16(r.buf, r.base), readu16(r.buf, r.base + 2), readu16(r.buf, r.base + 4) + if n == 0 or ss > so or so > n or 6 + n * 6 > r:remaining() then + return nil, 0, 0 + end + return n, ss, so +end +S["archive/vswap"] = function(r) +local n = header(r) + if not n then + return 0 + end + local size = r.limit - r.base + local b = r.buf + local last = 6 + n * 6 + local nonzero = 0 + for i = 0, n - 1 do + local o = buffer.readu32(b, r.base + 6 + i * 4) + local l = readu16(b, r.base + 6 + n * 4 + i * 2) + if o ~= 0 then + if o < last or o + l > size then + return 0 + end + last = o + nonzero =nonzero+ 1 + end + end + return nonzero > 0 and 0.6 or 0 +end +end + +do -- archive/wad +local Bytes = __include("core/Bytes") +S["archive/wad"] = function(r) +if r:remaining() < 12 then + return 0 + end + local m = r:peek(4) + if m ~= "IWAD" and m ~= "PWAD" then + return 0 + end + return 0.9 +end +end + +do -- archive/wad2 +local Bytes = __include("core/Bytes") +S["archive/wad2"] = function(r) +if r:remaining() < 12 then + return 0 + end + local m = r:peek(4) + return (m == "WAD2" or m == "WAD3" )and 0.9 or 0 +end +end + +do -- archive/xz +local Bytes = __include("core/Bytes") +local XZ_MAGIC = "\253" .. "7zXZ\0" +local function aloneScore(r) +local h = r:peek(14) + if #h < 14 then + return 0 + end + local d = string.byte(h, 1) + if d >= 225 or string.byte(h, 14) ~= 0 then + return 0 + end + local dict = string.byte(h, 2) + string.byte(h, 3) * 256 + string.byte(h, 4) * 65536 + string.byte(h, 5) * 16777216 + local okDict = false + for n = 12, 31 do + if dict == 2 ^ n or (n < 31 and dict == 2 ^ n + 2 ^ (n - 1)) then + okDict = true + break + end + end + if not okDict then + return 0 + end + local s = string.sub(h, 6, 13) + if s ~= string.rep("\255", 8) and (string.byte(h, 11) ~= 0 or string.byte(h, 12) ~= 0 or string.byte(h, 13) ~= 0) then + return 0 + end + return d == 0x5D and 0.4 or 0.2 +end +S["archive/xz"] = function(r) +if r:peek(6) == XZ_MAGIC then + return 1 + end + return aloneScore(r) +end +end + +do -- archive/yenc +local Bytes = __include("core/Bytes") +S["archive/yenc"] = function(r) +local head = r:peek(4096) + if string.match(head, "^=ybegin ") then + return 0.95 + end + return string.find(head, "\n=ybegin [^\n]*name=") and 0.6 or 0 +end +end + +do -- archive/z +local Bytes = __include("core/Bytes") +S["archive/z"] = function(r) +if r:peek(2) ~= "\31\157" then + return 0 + end + local f = r:peekU8(2) + return f >= 0 and bit32.band(f, 0x60) == 0 and bit32.band(f, 0x1F) >= 9 and bit32.band(f, 0x1F) <= 16 and 1 or 0.3 +end +end + +do -- archive/zip +local Bytes = __include("core/Bytes") +S["archive/zip"] = function(r) +local s = r:peek(4) + -- ZIP-based formats (docx, jar, 3mf, ...) score higher in their own sniff + if s == "PK\3\4" or s == "PK\5\6" then + return 0.6 + end + if string.sub(s, 1, 2) == "MZ" then + return 0 -- a self-extractor opens with Zip.decode / opts.format = "zip" + end + return 0 +end +end + +do -- archive/zoo +local Bytes = __include("core/Bytes") +local TAG = 0xFDC4A7DC +S["archive/zoo"] = function(r) +local h = r:peek(24) + if #h < 24 then + return 0 + end + local tag = string.byte(h, 21) + string.byte(h, 22) * 256 + string.byte(h, 23) * 65536 + string.byte(h, 24) * 16777216 + if tag ~= TAG then + return 0 + end + return string.sub(h, 1, 4) == "ZOO " and 1 or 0.8 +end +end + +do -- archive/zst +local Bytes = __include("core/Bytes") +local Zstd = lazy(function() + return __include("codecs/compress/Zstd") +end) +S["archive/zst"] = function(r) +local m = r:peek(4) + if m == Zstd.MAGIC then + return 1 + end + -- a skippable frame (0x184D2A50 .. 0x184D2A5F) is usually followed by a zstd frame + if #m == 4 and string.sub(m, 2, 4) == "\42\77\24" and bit32.band(string.byte(m, 1), 0xF0) == 0x50 then + return 0.5 + end + return 0 +end +end + +do -- data/cbor +local Bytes = __include("core/Bytes") +S["data/cbor"] = function(r) +return r:peek(3) == "\217\217\247" and 1 or 0 +end +end + +do -- data/csv +local Bytes = __include("core/Bytes") +local find, sub, byte, gsub = string.find, string.sub, string.byte, string.gsub +S["data/csv"] = function(r) +local head = r:peek(1024) + if find(head, "%z") then + return 0 + end + local l1, l2 = string.match(head, "^([^\r\n]*)\r?\n([^\r\n]*)") + if not l1 or l1 == "" then + return 0 + end + for _, d in __iter({ ",", "\t", ";" }) do + local _, c1 = gsub(l1, d, "") + local _, c2 = gsub(l2 , d, "") + if c1 > 0 and c1 == c2 then + return 0.15 + end + end + return 0 +end +end + +do -- data/ini +local Bytes = __include("core/Bytes") +S["data/ini"] = function(r) +local head = r:peek(512) + if string.find(head, "%z") then + return 0 + end + local first = string.match(head, "^[%s]*([^\r\n]*)") + while first and string.match(first, "^[;#]") do + head = string.match(head, "^[^\n]*\n(.*)$") or "" + first = string.match(head, "^[%s]*([^\r\n]*)") + end + if first and string.match(first, "^%[[^%]]+%]%s*$") then + return 0.2 + end + return 0 +end +end + +do -- data/json +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["data/json"] = function(r) +local head = Sniff.text(r, 64) + local first = string.match(head, "^[ \t\r\n]*(.)") + if first == "{" then + local nxt = string.match(head, "^[^{]*{[ \t\r\n]*(.)") + return (nxt == nil or nxt == '"' or nxt == "}" )and 0.6 or 0.1 + elseif first == "[" then + -- past any nested '[': a JSON value must start (TOML / INI "[section]" and "[[table]]" do not) + local nxt = string.match(head, "^[ \t\r\n]*[%[ \t\r\n]*(.)") + if nxt == nil or string.find('{"-0123456789tfn]', nxt, 1, true) then + return 0.3 + end + return 0 + end + return 0 +end +end + +do -- data/msgpack +local Bytes = __include("core/Bytes") +S["data/msgpack"] = function(_r) +return 0 -- no magic: by extension or opts.format only +end +end + +do -- data/nbt +local Bytes = __include("core/Bytes") +local Nbt = lazy(function() + return __include("codecs/text/Nbt") +end) +S["data/nbt"] = function(r) +local p = Nbt.peek(r.buf, r.base, r.limit - r.base) + if not p or p.rootType ~= "compound" then + return 0 + end + if p.compression ~= "none" then + return p.firstType and 1 or 0.5 -- gzip wrapped NBT: ties with archive/gzip go to the extension + end + return p.firstType and p.firstName and 0.6 or 0.2 +end +end + +do -- data/plist +local Bytes = __include("core/Bytes") +S["data/plist"] = function(r) +local head = r:peek(256) + if string.sub(head, 1, 6) == "bplist" then + return 1 + end + if string.find(head, " 0 and good == lines and paths > 0 and 0.5 or 0 +end +end + +do -- data/snbt +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["data/snbt"] = function(r) -- SNBT has what JSON never has: unquoted keys, typed numbers (1b, 2.5f), [I; arrays, single-quoted strings + +local head = Sniff.text(r, 512, true) + local first = string.sub(head, 1, 1) + if first ~= "{" and first ~= "[" then + return 0 + end + if string.find(head, "[{,]%s*[%a_][%w_%-%.%+]*%s*:") or string.find(head, "%d[bBsSlLfFdD]%s*[,}%]]") + or string.find(head, "%[[BIL]%s*;") or string.find(head, "[:,%[]%s*'") + then + return 0.7 + end + return 0 +end +end + +do -- data/toml +local Bytes = __include("core/Bytes") +S["data/toml"] = function(r) +local head = r:peek(512) + if string.find(head, "%z") then + return 0 + end + for line in __iter(string.gmatch(head, "[^\n]+")) do + local l = (string.match(line, "^[ \t]*(.-)[ \t\r]*$") ) +if l ~= "" and string.sub(l, 1, 1) ~= "#" then + if string.match(l, "^%[%[?[%w_%-%.\"' ]+%]%]?$") or string.match(l, "^[%w_%-%.\"']+[ \t]*=[ \t]*[\"'%[{%dtf%+%-in]") then + return 0.2 + end + return 0 + end + end + return 0 +end +end + +do -- data/tres +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["data/tres"] = function(r) +local h = Sniff.text(r, 256) + if string.match(h, "^%s*%[gd_resource[%s%]]") then + return 1 + end + return 0 +end +end + +do -- data/vdf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local KeyValues = lazy(function() + return __include("codecs/text/KeyValues") +end) +S["data/vdf"] = function(r) +local n = r:remaining() + if KeyValues.isBinary(r.buf, r.pos, n) then + return 0.3 + end + local head = Sniff.text(r, 256, true) + if string.find(head, "%z") then + return 0 + end + head = string.gsub(head, "^//[^\n]*\n%s*", "") + if string.match(head, '^"[^"\n]+"%s*{') or string.match(head, '^"[^"\n]+"%s*%[[^%]\n]*%]%s*{') then + return 0.6 + end + if string.match(head, "^#base%s") or string.match(head, "^#include%s") then + return 0.5 + end + if string.match(head, '^[%w_]+%s*\n%s*{%s*\n%s*"') then + return 0.3 + end + return 0 +end +end + +do -- data/xml +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["data/xml"] = function(r) +local head = Sniff.text(r, 64) + if string.match(head, "^<%?xml[ \t\r\n]") or string.sub(head, 1, 4) == "\255\254<\0" or string.sub(head, 1, 4) == "\254\255\0<" then + return 0.5 + end + if string.match(head, "^[ \t\r\n]*<[%a!]") then + return 0.3 + end + return 0 +end +end + +do -- data/yaml +local Bytes = __include("core/Bytes") +S["data/yaml"] = function(r) +local head = r:peek(256) + if string.find(head, "%z") then + return 0 + end + if string.match(head, "^%%YAML ") then + return 0.9 + end + if string.match(head, "^%-%-%-[ \r\n]") then + return 0.5 + end + local line = string.match(head, "^[ \t\r\n]*([^\r\n]*)") + if line and (string.match(line, "^[%w_%-\"']+[%w_%- \"']*:[ ]") or string.match(line, "^[%w_%-]+:$") or string.match(line, "^%- ")) then + return 0.2 + end + return 0 +end +end + +do -- vector/gamemaps +local Bytes = __include("core/Bytes") +local MAGIC = "TED5v1.0" +S["vector/gamemaps"] = function(r) +if r:peek(8) == MAGIC then + return 1 + end + -- MAPHEAD: the RLEW tag 0xABCD, then 100 offsets (0 / -1 when absent) + if r:remaining() >= 402 and r:remaining() <= 1024 and buffer.readu16(r.buf, r.base) == 0xABCD then + local first = buffer.readi32(r.buf, r.base + 2) + if first > 0 then + return 0.7 + end + end + return 0 +end +end + +do -- vector/ldtk +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["vector/ldtk"] = function(r) +local h = Sniff.text(r, 1024) + if not string.match(h, "^%s*{") then + return 0 + end + if string.find(h, "\"fileType\"%s*:%s*\"LDtk Project JSON\"") then + return 1 + end + if string.find(h, "\"jsonVersion\"", 1, true) and string.find(h, "\"worldLayout\"", 1, true) then + return 0.8 + end + return 0 +end +end + +do -- vector/ogmo +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["vector/ogmo"] = function(r) +local h = Sniff.text(r, 2048) + if not string.match(h, "^%s*{") or not string.find(h, "\"ogmoVersion\"", 1, true) then + return 0 + end + if string.find(h, "\"layerGridDefaultSize\"", 1, true) or string.find(h, "\"levelPaths\"", 1, true) then + return 1 + end + return 0.9 +end +end + +do -- vector/svg +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["vector/svg"] = function(r) +local h = Sniff.text(r, 4096) + if not string.match(h, "^%s*<") then + return 0 + end + if string.find(h, ":]") or string.find(h, "<%w+:svg[%s>]") then + return 0.95 + end + return 0 +end +end + +do -- vector/tiled +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local function head(r) +local h = Sniff.text(r, 1024) + return h +end +S["vector/tiled"] = function(r) +local h = head(r) + if string.match(h, "^%s*<") then + if string.find(h, "]") or string.find(h, "]") then + return 0.9 + end + return 0 + end + if string.match(h, "^%s*{") then + -- Tiled writes its keys sorted: "type" comes last, so look at the tail too + local n = r:remaining() + local tail = (n > 1024 and{(r:peek(1024, n - 1024) )}or{"" +})[1] for _, part in __iter({ h, tail }) do + if string.find(part, "\"type\"%s*:%s*\"map\"") or string.find(part, "\"type\"%s*:%s*\"tileset\"") then + return 0.8 + end + end + if string.find(h, "\"tilewidth\"", 1, true) and (string.find(h, "\"orientation\"", 1, true) or string.find(h, "\"tilesets\"", 1, true)) then + return 0.6 + end + end + return 0 +end +end + +do -- layered/aseprite +local Bytes = __include("core/Bytes") +S["layered/aseprite"] = function(r) +if r:peekU8(4) == 0xE0 and r:peekU8(5) == 0xA5 then + local d = r:peekU8(12) + if (d == 32 or d == 16 or d == 8) and r:peekU8(13) == 0 then + return 1 + end + return 0.5 + end + return 0 +end +end + +do -- layered/ora +local Bytes = __include("core/Bytes") +local MIME = "image/openraster" +S["layered/ora"] = function(r) -- a zip whose first (stored) entry is "mimetype" holding image/openraster + +if r:peek(4) == "PK\3\4" and r:peek(8, 30) == "mimetype" and r:peek(#MIME, 38) == MIME then + return 1 + end + return 0 +end +end + +do -- layered/psd +local Bytes = __include("core/Bytes") +S["layered/psd"] = function(r) +local h = r:peek(6) + if string.sub(h, 1, 4) == "8BPS" and (string.sub(h, 5, 6) == "\0\1" or string.sub(h, 5, 6) == "\0\2") then + return 1 + end + return 0 +end +end + +do -- subtitle/ass +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["subtitle/ass"] = function(r) +local head = Sniff.text(r, 64) + if string.match(head, "^%s*%[[Ss]cript [Ii]nfo%]") then + return 1 + end + return 0 +end +end + +do -- subtitle/srt +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local TIMING = "^%s*(%d+):(%d%d?):(%d%d?)[,.](%d+)%s*%-%->%s*(%d+):(%d%d?):(%d%d?)[,.](%d+)%s*(.-)%s*$" +local function frac(digits) +return ((tonumber(digits) )) / 10 ^ #digits +end +local function timing(line) +local h1, m1, s1, f1, h2, m2, s2, f2, rest = string.match(line, TIMING) + if not h1 then + return nil, nil, nil + end + local a = (tonumber(h1) )* 3600 + (tonumber(m1) )* 60 + (tonumber(s1) )+ frac(f1 ) + local b = (tonumber(h2) )* 3600 + (tonumber(m2) )* 60 + (tonumber(s2) )+ frac(f2 ) + return a, b, rest +end +S["subtitle/srt"] = function(r) +local head = Sniff.text(r, 512) + head = string.gsub(head, "\r", "\n") + local first, second = string.match(head, "^%s*([^\n]*)\n([^\n]*)") + if first and string.match(first, "^%d+%s*$") and second and timing(second) then + return 0.9 + end + if first and timing(first) then + return 0.6 + end + return 0 +end +end + +do -- subtitle/vtt +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["subtitle/vtt"] = function(r) +local head = Sniff.text(r, 10) + if string.sub(head, 1, 6) == "WEBVTT" then + local c = string.sub(head, 7, 7) + if c == "" or c == " " or c == "\t" or c == "\n" or c == "\r" then + return 1 + end + end + return 0 +end +end + +do -- music/669 +local Bytes = __include("core/Bytes") +local function validHeader(r) +if r:size() < 497 then + return false + end + local magic = r:peek(2) + if magic ~= "if" and magic ~= "JN" then + return false + end + local nsmp, npat, restart = r:peekU8(110), r:peekU8(111), r:peekU8(112) + if nsmp > 64 or restart >= 128 or npat > 128 then + return false + end + local bad = 0 + for i = 2, 109 do + local c = r:peekU8(i) + if c > 0 and c <= 31 then + bad =bad+ 1 + if bad > 40 then + return false + end + end + end + for i = 0, 127 do + local o, t, b = r:peekU8(113 + i), r:peekU8(241 + i), r:peekU8(369 + i) + if (o >= 128 and o < 0xFE) or (o < 128 and t == 0) or t > 15 or b >= 64 then + return false + end + end + return true +end +S["music/669"] = function(r) +return validHeader(r) and 0.6 or 0 +end +end + +do -- music/ahx +local Bytes = __include("core/Bytes") +S["music/ahx"] = function(r) +local m = r:peek(4) + return m and #m == 4 and string.sub(m, 1, 3) == "THX" and string.byte(m, 4) < 3 and 1 or 0 +end +end + +do -- music/far +local Bytes = __include("core/Bytes") +S["music/far"] = function(r) +if r:size() >= 98 and r:peek(4) == "FAR\xFE" and r:peek(3, 44) == "\r\n\x1A" and r:peekU8(47) + r:peekU8(48) * 256 >= 98 then + return 1 + end + return 0 +end +end + +do -- music/hmp +local Bytes = __include("core/Bytes") +local HMI_MAGIC = "HMI-MIDISONG061595" +S["music/hmp"] = function(r) +return (r:peek(8) == "HMIMIDIP" or r:peek(18) == HMI_MAGIC )and 1 or 0 +end +end + +do -- music/hvl +local Bytes = __include("core/Bytes") +S["music/hvl"] = function(r) +local m = r:peek(4) + return m and #m == 4 and string.sub(m, 1, 3) == "HVL" and string.byte(m, 4) <= 1 and 1 or 0 +end +end + +do -- music/it +local Bytes = __include("core/Bytes") +S["music/it"] = function(r) +return r:peek(4) == "IMPM" and 1 or 0 +end +end + +do -- music/med +local Bytes = __include("core/Bytes") +local function validHeader(r) +if r:size() < 52 or r:peek(3) ~= "MMD" then + return false + end + local v = r:peekU8(3) + if v < 0x30 or v > 0x33 then + return false + end + local h = r:sub(8, 44) + local songOff = h:u32be() + h:skip(4) + local blockOff = h:u32be() + h:skip(4) + local smpOff = h:u32be() + return songOff >= 52 and songOff + 63 * 8 + 284 <= r:size() and blockOff >= 52 and (smpOff == 0 or smpOff >= 52) +end +S["music/med"] = function(r) +return validHeader(r) and 1 or 0 +end +end + +do -- music/midi +local Bytes = __include("core/Bytes") +S["music/midi"] = function(r) +if r:peek(4) == "MThd" then + return 1 + end + if r:peek(4) == "RIFF" and r:peek(4, 8) == "RMID" then + return 1 + end + return 0 +end +end + +do -- music/mod +local Bytes = __include("core/Bytes") +local FIXED= { + ["M.K."] = 4, + ["M!K!"] = 4, + ["M&K!"] = 4, + ["N.T."] = 4, + ["FLT4"] = 4, + ["FLT8"] = 8, + ["CD81"] = 8, + ["OKTA"] = 8, + ["OCTA"] = 8, + ["EXO4"] = 4, + ["EXO8"] = 8, +} +local function signatureChannels(sig) +local fixed = FIXED[sig] + if fixed then + return fixed + end + local d = string.match(sig, "^(%d)CHN$") + if d then + local n = (tonumber(d) ) +return (n >= 1 and{n }or{nil +})[1] end + local dd = string.match(sig, "^(%d%d)C[HN]$") + if dd then + local n = (tonumber(dd) ) +return (n >= 1 and n <= 32 and{n }or{nil +})[1] end + local t = string.match(sig, "^TDZ(%d)$") + if t then + local n = (tonumber(t) ) +return (n >= 1 and{n }or{nil +})[1] end + return nil +end +S["music/mod"] = function(r) +if r:size() < 1084 then + return 0 + end + local sig = r:peek(4, 1080) + if signatureChannels(sig) then + return 0.8 + end + return 0 +end +end + +do -- music/mtm +local Bytes = __include("core/Bytes") +S["music/mtm"] = function(r) +if r:size() >= 66 and r:peek(3) == "MTM" and r:peekU8(3) < 0x20 and r:peekU8(33) >= 1 and r:peekU8(33) <= 32 then + return 1 + end + return 0 +end +end + +do -- music/mus +local Bytes = __include("core/Bytes") +S["music/mus"] = function(r) +return r:peek(4) == "MUS\x1a" and 1 or 0 +end +end + +do -- music/okt +local Bytes = __include("core/Bytes") +S["music/okt"] = function(r) +return r:peek(8) == "OKTASONG" and 1 or 0 +end +end + +do -- music/ptm +local Bytes = __include("core/Bytes") +local function validHeader(r) +if r:size() < 608 or r:peek(4, 44) ~= "PTMF" or r:peekU8(28) ~= 26 or r:peekU8(30) > 2 then + return false + end + local h = r:sub(32, 10) + local nord, nsmp, npat, nch, flags = h:u16le(), h:u16le(), h:u16le(), h:u16le(), h:u16le() + return flags == 0 and nch >= 1 and nch <= 32 and nord >= 1 and nord <= 256 and nsmp >= 1 and nsmp <= 255 and npat >= 1 and npat <= 128 +end +S["music/ptm"] = function(r) +return validHeader(r) and 1 or 0 +end +end + +do -- music/s3m +local Bytes = __include("core/Bytes") +S["music/s3m"] = function(r) +if r:size() >= 48 and r:peek(4, 44) == "SCRM" then + return 1 + end + return 0 +end +end + +do -- music/sf2 +local Bytes = __include("core/Bytes") +local SoundFont = lazy(function() + return __include("codecs/audio/SoundFont") +end) +S["music/sf2"] = function(r) +return SoundFont.sniff(r) and 1 or 0 +end +end + +do -- music/stm +local Bytes = __include("core/Bytes") +local function validHeader(r) +if r:size() < 48 then + return false + end + local eof, ftype, major, minor = r:peekU8(28), r:peekU8(29), r:peekU8(30), r:peekU8(31) + local npat, gv = r:peekU8(33), r:peekU8(34) + if ftype ~= 2 or (eof ~= 0x1A and eof ~= 2) or major ~= 2 or (minor ~= 0 and minor ~= 10 and minor ~= 20 and minor ~= 21) then + return false + end + if npat > 64 or (gv > 64 and gv ~= 0x58) then + return false + end + for i = 20, 27 do + local c = r:peekU8(i) + if c < 0x20 or c >= 0x7F then + return false + end + end + return true +end +S["music/stm"] = function(r) +return validHeader(r) and 0.7 or 0 +end +end + +do -- music/ult +local Bytes = __include("core/Bytes") +S["music/ult"] = function(r) +local v = r:peekU8(14) + if r:size() >= 48 and r:peek(14) == "MAS_UTrack_V00" and v >= 0x31 and v <= 0x34 then + return 1 + end + return 0 +end +end + +do -- music/umx +local Bytes = __include("core/Bytes") +local MAGIC = "\xC1\x83\x2A\x9E" + +local function header(r) +if r:size() < 36 or r:peek(4) ~= MAGIC then + return nil + end + local h = r:sub(4, 32) + local version = h:u16le() + h:skip(6) + local hd= { + version = version, + nameCount = h:u32le(), + nameOffset = h:u32le(), + exportCount = h:u32le(), + exportOffset = h:u32le(), + importCount = h:u32le(), + importOffset = h:u32le(), + } + if h.err or hd.nameOffset < 36 or hd.exportOffset < 36 or hd.importOffset < 36 then + return nil + end + if hd.nameCount == 0 or hd.exportCount == 0 or hd.importCount == 0 or hd.nameCount > 2 ^ 20 or hd.exportCount > 2 ^ 20 or hd.importCount > 2 ^ 20 then + return nil + end + return hd +end +local function index(r) +local b = r:u8() + local neg = b >= 0x80 + local v = b % 64 + if bit32.band(b, 0x40) ~= 0 then + local shift = 6 + repeat + b = r:u8() + v =v+ (b % 128) * 2 ^ shift + shift =shift+ 7 + until b < 0x80 or shift >= 32 + end + return (neg and{(-v )}or{v +})[1]end +local function names(r, h) +local list = {} + local nr = r:sub(h.nameOffset) + for _ = 1, math.min(h.nameCount, 65536) do + if nr:remaining() < 5 then + break + end + if h.version >= 64 then + index(nr) + end + table.insert(list, string.lower(nr:cstring(1024))) + nr:skip(4) + end + return list +end +S["music/umx"] = function(r) +local h = header(r) + if not h then + return 0 + end + return table.find(names(r, h), "music") and 1 or 0.3 +end +end + +do -- music/xm +local Bytes = __include("core/Bytes") +local MAGIC = "Extended Module: " +S["music/xm"] = function(r) +return r:peek(17) == MAGIC and 1 or 0 +end +end + +do -- music/xmi +local Bytes = __include("core/Bytes") +S["music/xmi"] = function(r) +local id, kind = r:peek(4), r:peek(4, 8) + if id == "FORM" and (kind == "XDIR" or kind == "XMID") then + return 1 + end + return id == "CAT " and kind == "XMID" and 0.9 or 0 +end +end + +do -- playlist/m3u +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["playlist/m3u"] = function(r) +local s = Sniff.text(r, 512) + s = ((string.match(s, "^%s*(.*)$") )) + if string.sub(s, 1, 7) == "#EXTM3U" then + return 0.95 + end + if string.find(s, "^#EXTINF:") or string.find(s, "^#EXT%-X%-") then + return 0.8 + end + return 0 +end +end + +do -- playlist/pls +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local Text = lazy(function() + return __include("codecs/text/Text") +end) +S["playlist/pls"] = function(r) +local s = Sniff.text(r, 64) + local first = string.match(s, "^%s*([^\r\n]*)") + return first and string.lower(Text.trim(first)) == "[playlist]" and 0.95 or 0 +end +end + +do -- playlist/xspf +local Bytes = __include("core/Bytes") +local NS = "http://xspf.org/ns/0/" +S["playlist/xspf"] = function(r) +local s = r:peek(1024) + local i = string.find(s, "<%w*:?playlist[%s>]") + if i and string.find(s, NS, 1, true) then + return 0.95 + end + return 0 +end +end + +return S +end __FILES["Types"] = function() local __compat = __compat local buffer, type, __iter = __compat.buffer, __compat.type, __compat.__iter --!strict -- Types: the standard value types each category decodes to and encodes from, plus small constructors. Every @@ -71842,7 +75474,7 @@ local __compat = __compat local buffer = __compat.buffer --!strict -- libjpeg's islow (jidctint.c / jfdctint.c), the reduced IDCTs (jidctred.c) and jcdctmgr.c's rounding quantiser, bit-exact -- with libjpeg-turbo. From jpeg-luau 1.0 (same author); IJG code: licenses/libjpeg-turbo-LICENSE.md. local readi16, readu16, writeu16, writeu32, readu8, writei16 = buffer.readi16, buffer.readu16, buffer.writeu16, buffer.writeu32, buffer.readu8, buffer.writei16 -local clamp = math.clamp +local clamp, abs, sign = math.clamp, math.abs, math.sign local Dct = {} @@ -72221,17 +75853,12 @@ end local fw = table.create(64, 0) -local function quant(coef, off, div, v, i) - local qv = readu16(div, i * 2) * 8 - local h = math.floor(qv / 2 -) if v < 0 then - writei16(coef, off + i * 2, -(math.floor((h - v) / qv))) - else - writei16(coef, off + i * 2, math.floor((v + h) / qv)) - end +-- (|v| + q * 4) // (q * 8) with v's sign, branch-free (a sign branch here gave LuaJIT side traces it could not compile) +local function quant(coef, off, qv, v, i) + writei16(coef, off + i * 2, math.floor((abs(v) + qv / 2) / qv )* sign(v)) end --- quantised as jcdctmgr.c: (|v| + q * 4) // (q * 8) with the sign restored +-- quantised as jcdctmgr.c: (|v| + q * 4) // (q * 8) with the sign restored; div[i + 1] = q * 8 for natural index i function Dct.fdctQuantize(src, stride, x, y, w, h, div, coef, off) local lastX, lastY = w - 1, h - 1 for r = 0, 7 do @@ -72321,14 +75948,14 @@ else ) local o3 = math.floor((tmp6 + z2 + z3 + 16384) / 32768 ) local o1 = math.floor((tmp7 + z1 + z4 + 16384) / 32768 ) local cc = c - 1 - quant(coef, off, div, o0, cc) - quant(coef, off, div, o1, cc + 8) - quant(coef, off, div, o2, cc + 16) - quant(coef, off, div, o3, cc + 24) - quant(coef, off, div, o4, cc + 32) - quant(coef, off, div, o5, cc + 40) - quant(coef, off, div, o6, cc + 48) - quant(coef, off, div, o7, cc + 56) + quant(coef, off, div[c], o0, cc) + quant(coef, off, div[c + 8], o1, cc + 8) + quant(coef, off, div[c + 16], o2, cc + 16) + quant(coef, off, div[c + 24], o3, cc + 24) + quant(coef, off, div[c + 32], o4, cc + 32) + quant(coef, off, div[c + 40], o5, cc + 40) + quant(coef, off, div[c + 48], o6, cc + 48) + quant(coef, off, div[c + 56], o7, cc + 56) end end @@ -75191,11 +78818,11 @@ OUT = buffer.create(math.max(1024, math.floor(w * h / 2))) local qt = { Tables.quant(Tables.LUMA, o.quality), Tables.quant(Tables.CHROMA, o.quality) } local qdiv = {} for t = 1, 2 do - local b = buffer.create(128) + local d = table.create(64, 0) for i = 1, 64 do - writeu16(b, (i - 1) * 2, qt[t][i]) + d[i] = qt[t][i] * 8 end - qdiv[t] = b + qdiv[t] = d end local comps= {} diff --git a/build/rosetta.lua.linemap.json b/build/rosetta.lua.linemap.json index 0c8422b..b2e2383 100644 --- a/build/rosetta.lua.linemap.json +++ b/build/rosetta.lua.linemap.json @@ -1,620 +1,621 @@ [ -[666, "src/Rosetta/init.luau"], -[1550, "src/Rosetta/Registry.luau"], -[3959, "src/Rosetta/Types.luau"], -[5076, "src/Rosetta/archive/7z/init.luau"], -[5461, "src/Rosetta/archive/7z/Header.luau"], -[5988, "src/Rosetta/archive/adf/init.luau"], -[6270, "src/Rosetta/archive/applesingle/init.luau"], -[6456, "src/Rosetta/archive/ar/init.luau"], -[6859, "src/Rosetta/archive/arj/init.luau"], -[7069, "src/Rosetta/archive/binhex/init.luau"], -[7318, "src/Rosetta/archive/br/init.luau"], -[7393, "src/Rosetta/archive/bz2/init.luau"], -[7457, "src/Rosetta/archive/cab/init.luau"], -[7870, "src/Rosetta/archive/cab/Sum.luau"], -[7911, "src/Rosetta/archive/cpio/init.luau"], -[8079, "src/Rosetta/archive/d64/init.luau"], -[8493, "src/Rosetta/archive/fat/init.luau"], -[8615, "src/Rosetta/archive/grp/init.luau"], -[8729, "src/Rosetta/archive/gzip/init.luau"], -[8914, "src/Rosetta/archive/iso/init.luau"], -[8986, "src/Rosetta/archive/lha/init.luau"], -[9411, "src/Rosetta/archive/lz4/init.luau"], -[9755, "src/Rosetta/archive/macbinary/init.luau"], -[9953, "src/Rosetta/archive/mpq/init.luau"], -[10359, "src/Rosetta/archive/mpq/Crypt.luau"], -[10424, "src/Rosetta/archive/pak/init.luau"], -[10558, "src/Rosetta/archive/rpm/init.luau"], -[10882, "src/Rosetta/archive/tar/init.luau"], -[11000, "src/Rosetta/archive/unitypackage/init.luau"], -[11236, "src/Rosetta/archive/uu/init.luau"], -[11506, "src/Rosetta/archive/vpk/init.luau"], -[11817, "src/Rosetta/archive/vswap/init.luau"], -[12087, "src/Rosetta/archive/wad/init.luau"], -[12541, "src/Rosetta/archive/wad/Picture.luau"], -[12643, "src/Rosetta/archive/wad2/init.luau"], -[12925, "src/Rosetta/archive/xz/init.luau"], -[13025, "src/Rosetta/archive/yenc/init.luau"], -[13297, "src/Rosetta/archive/z/init.luau"], -[13393, "src/Rosetta/archive/zip/init.luau"], -[13612, "src/Rosetta/archive/zoo/init.luau"], -[13808, "src/Rosetta/archive/zst/init.luau"], -[13872, "src/Rosetta/audio/aac/init.luau"], -[14085, "src/Rosetta/audio/ac3/init.luau"], -[14232, "src/Rosetta/audio/adpcm/init.luau"], -[14378, "src/Rosetta/audio/adx/init.luau"], -[14610, "src/Rosetta/audio/aiff/init.luau"], -[15002, "src/Rosetta/audio/ape/init.luau"], -[15131, "src/Rosetta/audio/au/init.luau"], -[15293, "src/Rosetta/audio/brstm/init.luau"], -[15585, "src/Rosetta/audio/caf/init.luau"], -[16252, "src/Rosetta/audio/flac/init.luau"], -[16401, "src/Rosetta/audio/flac/Meta.luau"], -[16623, "src/Rosetta/audio/flac/Stream.luau"], -[16993, "src/Rosetta/audio/m4a/init.luau"], -[17336, "src/Rosetta/audio/mp3/init.luau"], -[17597, "src/Rosetta/audio/mp3/Index.luau"], -[17788, "src/Rosetta/audio/mp3/Stream.luau"], -[18015, "src/Rosetta/audio/mp3/Tags.luau"], -[18327, "src/Rosetta/audio/mpc/init.luau"], -[18422, "src/Rosetta/audio/opus/init.luau"], -[18801, "src/Rosetta/audio/opus/Encode.luau"], -[18913, "src/Rosetta/audio/qoa/init.luau"], -[19094, "src/Rosetta/audio/tta/init.luau"], -[19213, "src/Rosetta/audio/vag/init.luau"], -[19437, "src/Rosetta/audio/voc/init.luau"], -[19713, "src/Rosetta/audio/vorbis/init.luau"], -[20168, "src/Rosetta/audio/vorbis/Encode.luau"], -[20981, "src/Rosetta/audio/wav/init.luau"], -[21602, "src/Rosetta/audio/wav/Codecs.luau"], -[21781, "src/Rosetta/audio/wavpack/init.luau"], -[21989, "src/Rosetta/cad/step/init.luau"], -[22371, "src/Rosetta/cad/step/Brep.luau"], -[22606, "src/Rosetta/cad/step/Parse.luau"], -[23163, "src/Rosetta/cad/step/Write.luau"], -[23411, "src/Rosetta/codecs/audio/Aac/init.luau"], -[23819, "src/Rosetta/codecs/audio/Aac/Decode.luau"], -[24795, "src/Rosetta/codecs/audio/Aac/Ps.luau"], -[25385, "src/Rosetta/codecs/audio/Aac/Sbr.luau"], -[26452, "src/Rosetta/codecs/audio/Aac/SbrBits.luau"], -[26571, "src/Rosetta/codecs/audio/Aac/SbrDct.luau"], -[27813, "src/Rosetta/codecs/audio/Aac/SbrHf.luau"], -[28305, "src/Rosetta/codecs/audio/Aac/SbrQmf.luau"], -[28422, "src/Rosetta/codecs/audio/Aac/SbrTables.luau"], -[28835, "src/Rosetta/codecs/audio/Aac/Tables.luau"], -[29171, "src/Rosetta/codecs/audio/Ac3/init.luau"], -[29331, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], -[30216, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], -[30318, "src/Rosetta/codecs/audio/Adpcm/init.luau"], -[31072, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], -[31375, "src/Rosetta/codecs/audio/Alac/init.luau"], -[31610, "src/Rosetta/codecs/audio/Alac/Decode.luau"], -[32029, "src/Rosetta/codecs/audio/Alac/Encode.luau"], -[32441, "src/Rosetta/codecs/audio/Ape/init.luau"], -[32657, "src/Rosetta/codecs/audio/Ape/Decode.luau"], -[33418, "src/Rosetta/codecs/audio/ApeTag.luau"], -[33516, "src/Rosetta/codecs/audio/Flac/init.luau"], -[33528, "src/Rosetta/codecs/audio/Flac/Encode.luau"], -[34477, "src/Rosetta/codecs/audio/Flac/Frame.luau"], -[35097, "src/Rosetta/codecs/audio/Hively/init.luau"], -[35294, "src/Rosetta/codecs/audio/Hively/Load.luau"], -[35544, "src/Rosetta/codecs/audio/Hively/Player.luau"], -[36503, "src/Rosetta/codecs/audio/Hively/Tables.luau"], -[36723, "src/Rosetta/codecs/audio/Mdct/init.luau"], -[36943, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], -[37197, "src/Rosetta/codecs/audio/MidiRender.luau"], -[37544, "src/Rosetta/codecs/audio/Mpa/init.luau"], -[37559, "src/Rosetta/codecs/audio/Mpa/Analysis.luau"], -[37618, "src/Rosetta/codecs/audio/Mpa/Core.luau"], -[39276, "src/Rosetta/codecs/audio/Mpa/EncTables.luau"], -[39569, "src/Rosetta/codecs/audio/Mpa/Encode2.luau"], -[39954, "src/Rosetta/codecs/audio/Mpa/Encode3.luau"], -[40595, "src/Rosetta/codecs/audio/Mpa/Header.luau"], -[40736, "src/Rosetta/codecs/audio/Mpa/Tables.luau"], -[40963, "src/Rosetta/codecs/audio/Musepack/init.luau"], -[41309, "src/Rosetta/codecs/audio/Musepack/Decode.luau"], -[42203, "src/Rosetta/codecs/audio/Musepack/Tables.luau"], -[42582, "src/Rosetta/codecs/audio/Opus/init.luau"], -[42597, "src/Rosetta/codecs/audio/Opus/Celt.luau"], -[44469, "src/Rosetta/codecs/audio/Opus/CeltEncoder.luau"], -[45534, "src/Rosetta/codecs/audio/Opus/CeltTables.luau"], -[45595, "src/Rosetta/codecs/audio/Opus/Decoder.luau"], -[46059, "src/Rosetta/codecs/audio/Opus/Mdct.luau"], -[46410, "src/Rosetta/codecs/audio/Opus/Packet.luau"], -[46643, "src/Rosetta/codecs/audio/Opus/Silk.luau"], -[48685, "src/Rosetta/codecs/audio/Opus/SilkTables.luau"], -[49059, "src/Rosetta/codecs/audio/Pcm/init.luau"], -[49323, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], -[49620, "src/Rosetta/codecs/audio/Qoa/init.luau"], -[49902, "src/Rosetta/codecs/audio/Resample/init.luau"], -[50297, "src/Rosetta/codecs/audio/SoundFont/init.luau"], -[50352, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], -[50496, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], -[51010, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"], -[51809, "src/Rosetta/codecs/audio/Stream.luau"], -[51971, "src/Rosetta/codecs/audio/Tracker/init.luau"], -[52454, "src/Rosetta/codecs/audio/Tracker/Load.luau"], -[52733, "src/Rosetta/codecs/audio/Tracker/Mixer.luau"], -[52980, "src/Rosetta/codecs/audio/Tracker/Pcm.luau"], -[53109, "src/Rosetta/codecs/audio/Tracker/Player.luau"], -[55098, "src/Rosetta/codecs/audio/Tracker/Tables.luau"], -[55215, "src/Rosetta/codecs/audio/Tta/init.luau"], -[55333, "src/Rosetta/codecs/audio/Tta/Decode.luau"], -[55585, "src/Rosetta/codecs/audio/Vorbis/init.luau"], -[55599, "src/Rosetta/codecs/audio/Vorbis/Codebook.luau"], -[55983, "src/Rosetta/codecs/audio/Vorbis/Packet.luau"], -[56556, "src/Rosetta/codecs/audio/Vorbis/Setup.luau"], -[56978, "src/Rosetta/codecs/audio/Vorbis/Tables.luau"], -[57018, "src/Rosetta/codecs/audio/VorbisComment.luau"], -[57071, "src/Rosetta/codecs/audio/WavPack/init.luau"], -[57294, "src/Rosetta/codecs/audio/WavPack/Block.luau"], -[58749, "src/Rosetta/codecs/audio/WavPack/Tables.luau"], -[58812, "src/Rosetta/codecs/compress/Brotli/init.luau"], -[58899, "src/Rosetta/codecs/compress/Brotli/Decode.luau"], -[59875, "src/Rosetta/codecs/compress/Brotli/Static.luau"], -[60743, "src/Rosetta/codecs/compress/Bzip2/init.luau"], -[60787, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], -[61300, "src/Rosetta/codecs/compress/Deflate/init.luau"], -[61626, "src/Rosetta/codecs/compress/Deflate/Compress.luau"], -[62108, "src/Rosetta/codecs/compress/Deflate/Inflate.luau"], -[62556, "src/Rosetta/codecs/compress/Explode.luau"], -[62752, "src/Rosetta/codecs/compress/Lz4.luau"], -[63021, "src/Rosetta/codecs/compress/Lzh/init.luau"], -[63625, "src/Rosetta/codecs/compress/Lzma/init.luau"], -[64165, "src/Rosetta/codecs/compress/Lzma/Crc64.luau"], -[64232, "src/Rosetta/codecs/compress/Lzma/Decode.luau"], -[64705, "src/Rosetta/codecs/compress/Lzma/Filters.luau"], -[64881, "src/Rosetta/codecs/compress/Lzw/init.luau"], -[65149, "src/Rosetta/codecs/compress/Lzx.luau"], -[65583, "src/Rosetta/codecs/compress/PackBits.luau"], -[65673, "src/Rosetta/codecs/compress/Quantum.luau"], -[65910, "src/Rosetta/codecs/compress/UnixCompress.luau"], -[66214, "src/Rosetta/codecs/compress/Xxh32.luau"], -[66283, "src/Rosetta/codecs/compress/Zstd/init.luau"], -[66340, "src/Rosetta/codecs/compress/Zstd/Decode.luau"], -[67324, "src/Rosetta/codecs/compress/Zstd/Xxh64.luau"], -[67476, "src/Rosetta/codecs/entropy/Huffman.luau"], -[67763, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], -[67774, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], -[67995, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.luau"], -[68239, "src/Rosetta/codecs/font/Bitmap.luau"], -[68440, "src/Rosetta/codecs/font/Cff/init.luau"], -[69081, "src/Rosetta/codecs/font/GlyphNames.luau"], -[69231, "src/Rosetta/codecs/font/TrueType/init.luau"], -[69545, "src/Rosetta/codecs/font/TrueType/Glyf.luau"], -[69937, "src/Rosetta/codecs/font/TrueType/Tables.luau"], -[70439, "src/Rosetta/codecs/image/Bcn/init.luau"], -[70546, "src/Rosetta/codecs/image/Bcn/Decode.luau"], -[71030, "src/Rosetta/codecs/image/Bcn/Encode.luau"], -[71459, "src/Rosetta/codecs/image/Blend.luau"], -[71838, "src/Rosetta/codecs/image/Dct/init.luau"], -[72338, "src/Rosetta/codecs/image/Etc.luau"], -[72636, "src/Rosetta/codecs/image/Half.luau"], -[72705, "src/Rosetta/codecs/image/Jpeg/init.luau"], -[73059, "src/Rosetta/codecs/image/Jpeg/Arith.luau"], -[73467, "src/Rosetta/codecs/image/Jpeg/Color.luau"], -[73832, "src/Rosetta/codecs/image/Jpeg/Decode.luau"], -[74597, "src/Rosetta/codecs/image/Jpeg/Encode.luau"], -[75478, "src/Rosetta/codecs/image/Jpeg/Scan.luau"], -[75947, "src/Rosetta/codecs/image/Jpeg/Tables.luau"], -[76025, "src/Rosetta/codecs/image/Jpeg/Yuv.luau"], -[76092, "src/Rosetta/codecs/image/Miptex.luau"], -[76392, "src/Rosetta/codecs/image/Pixels.luau"], -[76712, "src/Rosetta/codecs/image/Quantize/init.luau"], -[77173, "src/Rosetta/codecs/image/Raster.luau"], -[77870, "src/Rosetta/codecs/image/Texel.luau"], -[78243, "src/Rosetta/codecs/image/Texture.luau"], -[78388, "src/Rosetta/codecs/image/Vp8/init.luau"], -[78530, "src/Rosetta/codecs/image/Vp8/Decode.luau"], -[80510, "src/Rosetta/codecs/image/Vp8/Predict.luau"], -[80773, "src/Rosetta/codecs/image/Vp8/Tables.luau"], -[81023, "src/Rosetta/codecs/image/Vp8/Yuv.luau"], -[81165, "src/Rosetta/codecs/image/Vp8L/init.luau"], -[81269, "src/Rosetta/codecs/image/Vp8L/Decode.luau"], -[82209, "src/Rosetta/codecs/image/Vp8L/Encode.luau"], -[83161, "src/Rosetta/codecs/image/Yuv.luau"], -[83482, "src/Rosetta/codecs/model/Brush.luau"], -[84122, "src/Rosetta/codecs/model/Displacement.luau"], -[84271, "src/Rosetta/codecs/model/DoomMap/init.luau"], -[84716, "src/Rosetta/codecs/model/DoomMap/Udmf.luau"], -[84966, "src/Rosetta/codecs/model/Draco/init.luau"], -[85298, "src/Rosetta/codecs/model/Draco/Attributes.luau"], -[85767, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], -[86956, "src/Rosetta/codecs/model/Draco/Int64.luau"], -[87105, "src/Rosetta/codecs/model/Draco/KdTree.luau"], -[87464, "src/Rosetta/codecs/model/Draco/Predict.luau"], -[88426, "src/Rosetta/codecs/model/Draco/Reader.luau"], -[88900, "src/Rosetta/codecs/model/Mat4.luau"], -[89159, "src/Rosetta/codecs/model/MeshFlatten.luau"], -[89687, "src/Rosetta/codecs/model/Minecraft/init.luau"], -[90239, "src/Rosetta/codecs/model/Minecraft/Colors.luau"], -[90318, "src/Rosetta/codecs/model/Minecraft/Legacy.luau"], -[90425, "src/Rosetta/codecs/model/Minecraft/Packed.luau"], -[90631, "src/Rosetta/codecs/model/Patch.luau"], -[90755, "src/Rosetta/codecs/model/Polygon.luau"], -[90989, "src/Rosetta/codecs/model/Rbx/init.luau"], -[91226, "src/Rosetta/codecs/model/Rbx/Binary.luau"], -[91980, "src/Rosetta/codecs/model/Rig.luau"], -[92223, "src/Rosetta/codecs/model/Sampler.luau"], -[92383, "src/Rosetta/codecs/model/SourceAnim.luau"], -[92604, "src/Rosetta/codecs/model/Vrml/init.luau"], -[92752, "src/Rosetta/codecs/model/Vrml/Build.luau"], -[93326, "src/Rosetta/codecs/model/Vrml/Fields.luau"], -[93489, "src/Rosetta/codecs/model/Vrml/Geometry.luau"], -[94238, "src/Rosetta/codecs/model/Vrml/Parse.luau"], -[94760, "src/Rosetta/codecs/model/Vrml/Write.luau"], -[95487, "src/Rosetta/codecs/model/Vrml/Xml.luau"], -[95719, "src/Rosetta/codecs/text/GodotVariant.luau"], -[96378, "src/Rosetta/codecs/text/Json/init.luau"], -[96647, "src/Rosetta/codecs/text/Json/Decode.luau"], -[97082, "src/Rosetta/codecs/text/Json/Encode.luau"], -[97427, "src/Rosetta/codecs/text/KeyValues/init.luau"], -[97997, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], -[98303, "src/Rosetta/codecs/text/Lexer/init.luau"], -[98435, "src/Rosetta/codecs/text/Nbt/init.luau"], -[98788, "src/Rosetta/codecs/text/Nbt/Binary.luau"], -[99480, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], -[100120, "src/Rosetta/codecs/text/Nbt/Value.luau"], -[100358, "src/Rosetta/codecs/text/Text/init.luau"], -[100449, "src/Rosetta/codecs/text/Url/init.luau"], -[100654, "src/Rosetta/codecs/text/Xml/init.luau"], -[101104, "src/Rosetta/codecs/text/Xml/Parse.luau"], -[101908, "src/Rosetta/codecs/video/Dsp.luau"], -[102746, "src/Rosetta/codecs/video/H263/init.luau"], -[102903, "src/Rosetta/codecs/video/H263/Decoder.luau"], -[103761, "src/Rosetta/codecs/video/H263/Tables.luau"], -[103965, "src/Rosetta/codecs/video/H264/init.luau"], -[104355, "src/Rosetta/codecs/video/H264/Bitstream.luau"], -[104630, "src/Rosetta/codecs/video/H264/Cabac.luau"], -[105761, "src/Rosetta/codecs/video/H264/Cavlc.luau"], -[106529, "src/Rosetta/codecs/video/H264/Deblock.luau"], -[106791, "src/Rosetta/codecs/video/H264/Decoder.luau"], -[107857, "src/Rosetta/codecs/video/H264/Inter.luau"], -[108183, "src/Rosetta/codecs/video/H264/Intra.luau"], -[108590, "src/Rosetta/codecs/video/H264/Mb.luau"], -[109544, "src/Rosetta/codecs/video/H264/Params.luau"], -[109992, "src/Rosetta/codecs/video/H264/Slice.luau"], -[110244, "src/Rosetta/codecs/video/H264/Tables.luau"], -[110286, "src/Rosetta/codecs/video/H264/Transform.luau"], -[110451, "src/Rosetta/codecs/video/Legacy/init.luau"], -[110650, "src/Rosetta/codecs/video/Legacy/Cinepak.luau"], -[110947, "src/Rosetta/codecs/video/Legacy/Flic.luau"], -[111314, "src/Rosetta/codecs/video/Legacy/Msvideo1.luau"], -[111432, "src/Rosetta/codecs/video/Legacy/Picture.luau"], -[111540, "src/Rosetta/codecs/video/Legacy/QtRle.luau"], -[111813, "src/Rosetta/codecs/video/Legacy/Smacker.luau"], -[112208, "src/Rosetta/codecs/video/Legacy/Smc.luau"], -[112385, "src/Rosetta/codecs/video/Mpeg1/init.luau"], -[112398, "src/Rosetta/codecs/video/Mpeg2/init.luau"], -[112772, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], -[114299, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], -[114439, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"], -[114578, "src/Rosetta/codecs/video/Theora/init.luau"], -[114842, "src/Rosetta/codecs/video/Theora/Decoder.luau"], -[116106, "src/Rosetta/codecs/video/Theora/Header.luau"], -[116470, "src/Rosetta/codecs/video/Video/init.luau"], -[117085, "src/Rosetta/codecs/video/Video/Disposable.luau"], -[117296, "src/Rosetta/codecs/video/Video/Pool.luau"], -[117348, "src/Rosetta/codecs/video/Video/Source.luau"], -[117634, "src/Rosetta/containers/Archive.luau"], -[117901, "src/Rosetta/containers/AudioWrap.luau"], -[118411, "src/Rosetta/containers/Avi/init.luau"], -[118964, "src/Rosetta/containers/Blend.luau"], -[119703, "src/Rosetta/containers/Chunks.luau"], -[119838, "src/Rosetta/containers/Cpio.luau"], -[120266, "src/Rosetta/containers/Demux.luau"], -[120552, "src/Rosetta/containers/Ebml/init.luau"], -[120866, "src/Rosetta/containers/Fat.luau"], -[121554, "src/Rosetta/containers/Iso9660.luau"], -[122059, "src/Rosetta/containers/IsoBmff/init.luau"], -[122230, "src/Rosetta/containers/IsoBmff/Box.luau"], -[122419, "src/Rosetta/containers/IsoBmff/Demux.luau"], -[123265, "src/Rosetta/containers/IsoBmff/Meta.luau"], -[123787, "src/Rosetta/containers/IsoBmff/Mux.luau"], -[124304, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], -[124422, "src/Rosetta/containers/MacFile.luau"], -[124571, "src/Rosetta/containers/MpegEs.luau"], -[124738, "src/Rosetta/containers/MpegPs/init.luau"], -[124959, "src/Rosetta/containers/MpegTs/init.luau"], -[125752, "src/Rosetta/containers/Ogg/init.luau"], -[126177, "src/Rosetta/containers/Ogg/Mux.luau"], -[126366, "src/Rosetta/containers/Ogg/Page.luau"], -[126532, "src/Rosetta/containers/Riff/init.luau"], -[126849, "src/Rosetta/containers/Tar.luau"], -[127263, "src/Rosetta/containers/Zip/init.luau"], -[127895, "src/Rosetta/core/Adler32.luau"], -[127955, "src/Rosetta/core/Base64.luau"], -[128183, "src/Rosetta/core/Bits.luau"], -[128476, "src/Rosetta/core/Bytes.luau"], -[129003, "src/Rosetta/core/Crc16.luau"], -[129055, "src/Rosetta/core/Crc32.luau"], -[129206, "src/Rosetta/core/Err.luau"], -[129288, "src/Rosetta/core/Input.luau"], -[129364, "src/Rosetta/core/Md5.luau"], -[129522, "src/Rosetta/core/Sniff.luau"], -[129551, "src/Rosetta/data/cbor/init.luau"], -[129650, "src/Rosetta/data/cbor/Codec.luau"], -[130219, "src/Rosetta/data/csv/init.luau"], -[130531, "src/Rosetta/data/ini/init.luau"], -[130777, "src/Rosetta/data/json/init.luau"], -[130869, "src/Rosetta/data/msgpack/init.luau"], -[130958, "src/Rosetta/data/msgpack/Codec.luau"], -[131400, "src/Rosetta/data/nbt/init.luau"], -[131459, "src/Rosetta/data/plist/init.luau"], -[131765, "src/Rosetta/data/plist/Binary.luau"], -[132032, "src/Rosetta/data/q3shader/init.luau"], -[132271, "src/Rosetta/data/q3skin/init.luau"], -[132367, "src/Rosetta/data/snbt/init.luau"], -[132430, "src/Rosetta/data/toml/init.luau"], -[132497, "src/Rosetta/data/toml/Decode.luau"], -[133125, "src/Rosetta/data/toml/Encode.luau"], -[133334, "src/Rosetta/data/tres/init.luau"], -[133479, "src/Rosetta/data/vdf/init.luau"], -[133580, "src/Rosetta/data/xml/init.luau"], -[133636, "src/Rosetta/data/yaml/init.luau"], -[133709, "src/Rosetta/data/yaml/Emit.luau"], -[133999, "src/Rosetta/data/yaml/Parse.luau"], -[135292, "src/Rosetta/font/bdf/init.luau"], -[135581, "src/Rosetta/font/bmfont/init.luau"], -[136008, "src/Rosetta/font/bmfont/Parse.luau"], -[136461, "src/Rosetta/font/eot/init.luau"], -[136693, "src/Rosetta/font/fon/init.luau"], -[136976, "src/Rosetta/font/hershey/init.luau"], -[137171, "src/Rosetta/font/pcf/init.luau"], -[137451, "src/Rosetta/font/psf/init.luau"], -[137771, "src/Rosetta/font/ttf/init.luau"], -[137822, "src/Rosetta/font/type1/init.luau"], -[138181, "src/Rosetta/font/type1/Charstring.luau"], -[138459, "src/Rosetta/font/woff/init.luau"], -[138591, "src/Rosetta/font/woff2/init.luau"], -[138648, "src/Rosetta/font/woff2/Rebuild.luau"], -[139188, "src/Rosetta/host/init.luau"], -[139233, "src/Rosetta/host/Love.luau"], -[139376, "src/Rosetta/host/LuaJIT.luau"], -[139426, "src/Rosetta/host/Luau.luau"], -[139449, "src/Rosetta/host/Roblox.luau"], -[139808, "src/Rosetta/image/ani/init.luau"], -[139988, "src/Rosetta/image/art/init.luau"], -[140476, "src/Rosetta/image/blp/init.luau"], -[140734, "src/Rosetta/image/bmp/init.luau"], -[141149, "src/Rosetta/image/dds/init.luau"], -[141632, "src/Rosetta/image/exr/init.luau"], -[142392, "src/Rosetta/image/exr/Codec.luau"], -[142503, "src/Rosetta/image/exr/Piz.luau"], -[142860, "src/Rosetta/image/gif/init.luau"], -[143376, "src/Rosetta/image/gif/Decode.luau"], -[143452, "src/Rosetta/image/hdr/init.luau"], -[143681, "src/Rosetta/image/hdr/Codec.luau"], -[143892, "src/Rosetta/image/icns/init.luau"], -[144223, "src/Rosetta/image/ico/init.luau"], -[144500, "src/Rosetta/image/ico/Dib.luau"], -[144595, "src/Rosetta/image/ilbm/init.luau"], -[144914, "src/Rosetta/image/jpeg/init.luau"], -[145050, "src/Rosetta/image/ktx/init.luau"], -[145710, "src/Rosetta/image/lmp/init.luau"], -[145843, "src/Rosetta/image/pcx/init.luau"], -[146107, "src/Rosetta/image/png/init.luau"], -[146687, "src/Rosetta/image/png/Apng.luau"], -[146767, "src/Rosetta/image/png/Decode.luau"], -[147140, "src/Rosetta/image/png/Encode.luau"], -[147343, "src/Rosetta/image/pnm/init.luau"], -[147721, "src/Rosetta/image/pnm/Codec.luau"], -[147998, "src/Rosetta/image/qoi/init.luau"], -[148120, "src/Rosetta/image/qoi/Codec.luau"], -[148277, "src/Rosetta/image/sgi/init.luau"], -[148562, "src/Rosetta/image/spr/init.luau"], -[148875, "src/Rosetta/image/sunras/init.luau"], -[149121, "src/Rosetta/image/tga/init.luau"], -[149391, "src/Rosetta/image/tga/Codec.luau"], -[149591, "src/Rosetta/image/tiff/init.luau"], -[150418, "src/Rosetta/image/tiff/Pixels.luau"], -[150808, "src/Rosetta/image/tim/init.luau"], -[151050, "src/Rosetta/image/vtf/init.luau"], -[151285, "src/Rosetta/image/webp/init.luau"], -[151895, "src/Rosetta/image/webp/Alpha.luau"], -[151971, "src/Rosetta/image/webp/Anim.luau"], -[152126, "src/Rosetta/image/xbm/init.luau"], -[152287, "src/Rosetta/image/xpm/init.luau"], -[152555, "src/Rosetta/image/xpm/Names.luau"], -[152611, "src/Rosetta/layered/aseprite/init.luau"], -[153349, "src/Rosetta/layered/ora/init.luau"], -[153636, "src/Rosetta/layered/psd/init.luau"], -[154371, "src/Rosetta/layered/psd/Channels.luau"], -[154723, "src/Rosetta/model/3ds/init.luau"], -[154806, "src/Rosetta/model/3ds/Build.luau"], -[155453, "src/Rosetta/model/3ds/Read.luau"], -[155949, "src/Rosetta/model/3ds/Write.luau"], -[156754, "src/Rosetta/model/3mf/init.luau"], -[156836, "src/Rosetta/model/3mf/Read.luau"], -[157424, "src/Rosetta/model/3mf/Write.luau"], -[157829, "src/Rosetta/model/ase/init.luau"], -[157952, "src/Rosetta/model/ase/Build.luau"], -[158526, "src/Rosetta/model/ase/Parse.luau"], -[158595, "src/Rosetta/model/ase/Write.luau"], -[159058, "src/Rosetta/model/b3d/init.luau"], -[159113, "src/Rosetta/model/b3d/Read.luau"], -[159684, "src/Rosetta/model/blend/init.luau"], -[159780, "src/Rosetta/model/blend/Anim.luau"], -[160126, "src/Rosetta/model/blend/Material.luau"], -[160478, "src/Rosetta/model/blend/Mesh.luau"], -[161113, "src/Rosetta/model/blend/Normals.luau"], -[161274, "src/Rosetta/model/blend/Prim.luau"], -[161723, "src/Rosetta/model/blend/Read.luau"], -[162623, "src/Rosetta/model/bsp/init.luau"], -[162814, "src/Rosetta/model/bsp/Lightmap.luau"], -[162880, "src/Rosetta/model/bsp/Quake.luau"], -[163269, "src/Rosetta/model/bsp/Quake3.luau"], -[163498, "src/Rosetta/model/bsp/Tree.luau"], -[163886, "src/Rosetta/model/buildmap/init.luau"], -[164158, "src/Rosetta/model/buildmap/Geometry.luau"], -[164561, "src/Rosetta/model/d3map/init.luau"], -[164843, "src/Rosetta/model/d3map/Parse.luau"], -[165041, "src/Rosetta/model/dae/init.luau"], -[165230, "src/Rosetta/model/dae/Math.luau"], -[165277, "src/Rosetta/model/dae/Read.luau"], -[167127, "src/Rosetta/model/dae/Write.luau"], -[167496, "src/Rosetta/model/fbx/init.luau"], -[167644, "src/Rosetta/model/fbx/Ascii.luau"], -[167914, "src/Rosetta/model/fbx/Binary.luau"], -[168369, "src/Rosetta/model/fbx/Read.luau"], -[169731, "src/Rosetta/model/fbx/Write.luau"], -[170716, "src/Rosetta/model/fbx/Xform.luau"], -[170757, "src/Rosetta/model/gltf/init.luau"], -[170994, "src/Rosetta/model/gltf/Pack.luau"], -[171063, "src/Rosetta/model/gltf/Read.luau"], -[171794, "src/Rosetta/model/gltf/Write.luau"], -[172474, "src/Rosetta/model/godot/init.luau"], -[172565, "src/Rosetta/model/godot/Build.luau"], -[173107, "src/Rosetta/model/godot/Primitives.luau"], -[173382, "src/Rosetta/model/godot/Surface.luau"], -[173867, "src/Rosetta/model/godot/Write.luau"], -[174196, "src/Rosetta/model/iqm/init.luau"], -[174272, "src/Rosetta/model/iqm/Read.luau"], -[174627, "src/Rosetta/model/iqm/Write.luau"], -[175314, "src/Rosetta/model/ldraw/init.luau"], -[175392, "src/Rosetta/model/ldraw/Colors.luau"], -[175710, "src/Rosetta/model/ldraw/Read.luau"], -[176287, "src/Rosetta/model/lwo/init.luau"], -[176363, "src/Rosetta/model/lwo/Build.luau"], -[176825, "src/Rosetta/model/lwo/Parse.luau"], -[177368, "src/Rosetta/model/map/init.luau"], -[177685, "src/Rosetta/model/map/Build.luau"], -[177929, "src/Rosetta/model/map/Parse.luau"], -[178314, "src/Rosetta/model/map/Write.luau"], -[178460, "src/Rosetta/model/mca/init.luau"], -[178802, "src/Rosetta/model/mca/Chunk.luau"], -[178935, "src/Rosetta/model/mca/Lz4Block.luau"], -[179005, "src/Rosetta/model/md2/init.luau"], -[179204, "src/Rosetta/model/md3/init.luau"], -[179432, "src/Rosetta/model/md5/init.luau"], -[179513, "src/Rosetta/model/md5/Read.luau"], -[179946, "src/Rosetta/model/mdl/init.luau"], -[180028, "src/Rosetta/model/mdl/HalfLife.luau"], -[180332, "src/Rosetta/model/mdl/Quake.luau"], -[180550, "src/Rosetta/model/ms3d/init.luau"], -[180622, "src/Rosetta/model/ms3d/Read.luau"], -[181068, "src/Rosetta/model/ms3d/Write.luau"], -[181537, "src/Rosetta/model/obj/init.luau"], -[182355, "src/Rosetta/model/obj/Mtl.luau"], -[182643, "src/Rosetta/model/off/init.luau"], -[183105, "src/Rosetta/model/ply/init.luau"], -[184210, "src/Rosetta/model/ply/Binary.luau"], -[184411, "src/Rosetta/model/pmx/init.luau"], -[184480, "src/Rosetta/model/pmx/Build.luau"], -[184776, "src/Rosetta/model/pmx/Pmd.luau"], -[185111, "src/Rosetta/model/pmx/Read.luau"], -[185515, "src/Rosetta/model/proc/init.luau"], -[185897, "src/Rosetta/model/qb/init.luau"], -[186290, "src/Rosetta/model/rbxm/init.luau"], -[186883, "src/Rosetta/model/rbxmx/init.luau"], -[187559, "src/Rosetta/model/robloxmesh/init.luau"], -[188218, "src/Rosetta/model/robloxmesh/Parse.luau"], -[188675, "src/Rosetta/model/robloxmesh/Write.luau"], -[188784, "src/Rosetta/model/schematic/init.luau"], -[189105, "src/Rosetta/model/schematic/Common.luau"], -[189225, "src/Rosetta/model/schematic/Litematic.luau"], -[189436, "src/Rosetta/model/schematic/Mcedit.luau"], -[189680, "src/Rosetta/model/schematic/Sponge.luau"], -[189809, "src/Rosetta/model/smd/init.luau"], -[189876, "src/Rosetta/model/smd/Read.luau"], -[190145, "src/Rosetta/model/smd/Write.luau"], -[190388, "src/Rosetta/model/sourcemdl/init.luau"], -[190559, "src/Rosetta/model/sourcemdl/Build.luau"], -[190989, "src/Rosetta/model/sourcemdl/Material.luau"], -[191150, "src/Rosetta/model/sourcemdl/Mdl.luau"], -[191677, "src/Rosetta/model/sourcemdl/Phy.luau"], -[191800, "src/Rosetta/model/sourcemdl/Vtx.luau"], -[191982, "src/Rosetta/model/sourcemdl/Vvd.luau"], -[192076, "src/Rosetta/model/stl/init.luau"], -[192526, "src/Rosetta/model/stl/Decode.luau"], -[192600, "src/Rosetta/model/t3d/init.luau"], -[192694, "src/Rosetta/model/t3d/Build.luau"], -[193099, "src/Rosetta/model/t3d/Parse.luau"], -[193267, "src/Rosetta/model/udmf/init.luau"], -[193350, "src/Rosetta/model/usda/init.luau"], -[193559, "src/Rosetta/model/usda/Build.luau"], -[194837, "src/Rosetta/model/usda/Parse.luau"], -[195635, "src/Rosetta/model/usda/Write.luau"], -[196452, "src/Rosetta/model/vbsp/init.luau"], -[196898, "src/Rosetta/model/vbsp/Faces.luau"], -[197122, "src/Rosetta/model/vbsp/Props.luau"], -[197214, "src/Rosetta/model/vmf/init.luau"], -[197539, "src/Rosetta/model/vmf/Build.luau"], -[197963, "src/Rosetta/model/vox/init.luau"], -[198849, "src/Rosetta/model/vox/Grid.luau"], -[198906, "src/Rosetta/model/vrml/init.luau"], -[198972, "src/Rosetta/model/x/init.luau"], -[199102, "src/Rosetta/model/x/Build.luau"], -[199665, "src/Rosetta/model/x/Parse.luau"], -[199962, "src/Rosetta/model/x3d/init.luau"], -[200040, "src/Rosetta/music/669/init.luau"], -[200247, "src/Rosetta/music/ahx/init.luau"], -[200299, "src/Rosetta/music/far/init.luau"], -[200529, "src/Rosetta/music/hmp/init.luau"], -[200794, "src/Rosetta/music/hvl/init.luau"], -[200846, "src/Rosetta/music/it/init.luau"], -[201265, "src/Rosetta/music/it/Itsex.luau"], -[201382, "src/Rosetta/music/med/init.luau"], -[202030, "src/Rosetta/music/midi/init.luau"], -[202174, "src/Rosetta/music/midi/Smf.luau"], -[202586, "src/Rosetta/music/mod/init.luau"], -[202940, "src/Rosetta/music/mtm/init.luau"], -[203163, "src/Rosetta/music/mus/init.luau"], -[203321, "src/Rosetta/music/okt/init.luau"], -[203603, "src/Rosetta/music/ptm/init.luau"], -[203826, "src/Rosetta/music/s3m/init.luau"], -[204063, "src/Rosetta/music/sf2/init.luau"], -[204107, "src/Rosetta/music/stm/init.luau"], -[204339, "src/Rosetta/music/ult/init.luau"], -[204644, "src/Rosetta/music/umx/init.luau"], -[204861, "src/Rosetta/music/xm/init.luau"], -[205423, "src/Rosetta/music/xmi/init.luau"], -[205632, "src/Rosetta/ops/AudioOps.luau"], -[206111, "src/Rosetta/ops/ImageOps/init.luau"], -[206759, "src/Rosetta/ops/ImageOps/Kernels.luau"], -[207399, "src/Rosetta/ops/LayerOps.luau"], -[207492, "src/Rosetta/ops/MeshOps/init.luau"], -[208544, "src/Rosetta/ops/MeshOps/Greedy.luau"], -[208711, "src/Rosetta/ops/MusicOps.luau"], -[209060, "src/Rosetta/playlist/m3u/init.luau"], -[209413, "src/Rosetta/playlist/pls/init.luau"], -[209591, "src/Rosetta/playlist/xspf/init.luau"], -[209794, "src/Rosetta/subtitle/ass/init.luau"], -[210238, "src/Rosetta/subtitle/srt/init.luau"], -[210411, "src/Rosetta/subtitle/vtt/init.luau"], -[210614, "src/Rosetta/vector/gamemaps/init.luau"], -[210801, "src/Rosetta/vector/gamemaps/Expand.luau"], -[210898, "src/Rosetta/vector/ldtk/init.luau"], -[210990, "src/Rosetta/vector/ldtk/Read.luau"], -[211326, "src/Rosetta/vector/ldtk/Write.luau"], -[211974, "src/Rosetta/vector/ogmo/init.luau"], -[212093, "src/Rosetta/vector/ogmo/Read.luau"], -[212498, "src/Rosetta/vector/ogmo/Write.luau"], -[212852, "src/Rosetta/vector/svg/init.luau"], -[212938, "src/Rosetta/vector/svg/Parse.luau"], -[213684, "src/Rosetta/vector/svg/PathData.luau"], -[214052, "src/Rosetta/vector/svg/Render.luau"], -[214469, "src/Rosetta/vector/svg/Style.luau"], -[214841, "src/Rosetta/vector/svg/Write.luau"], -[215041, "src/Rosetta/vector/tiled/init.luau"], -[215221, "src/Rosetta/vector/tiled/Data.luau"], -[215372, "src/Rosetta/vector/tiled/Tmj.luau"], -[216003, "src/Rosetta/vector/tiled/Tmx.luau"], -[216615, "src/Rosetta/video/avi/init.luau"], -[216909, "src/Rosetta/video/fli/init.luau"], -[217060, "src/Rosetta/video/flv/init.luau"], -[217444, "src/Rosetta/video/flv/Amf.luau"], -[217602, "src/Rosetta/video/flv/Mux.luau"], -[217883, "src/Rosetta/video/h264/init.luau"], -[218022, "src/Rosetta/video/mkv/init.luau"], -[218178, "src/Rosetta/video/mkv/Mux.luau"], -[218457, "src/Rosetta/video/mkv/Parse.luau"], -[219178, "src/Rosetta/video/mp4/init.luau"], -[219506, "src/Rosetta/video/mpegps/init.luau"], -[219693, "src/Rosetta/video/mpegts/init.luau"], -[219939, "src/Rosetta/video/ogv/init.luau"], -[220334, "src/Rosetta/video/smk/init.luau"], -[220643, "src/Rosetta/video/smk/Audio.luau"], -[220763, "src/Rosetta/video/y4m/init.luau"] +[671, "src/Rosetta/init.luau"], +[1588, "src/Rosetta/Registry.luau"], +[4205, "src/Rosetta/Sniffs.luau"], +[7591, "src/Rosetta/Types.luau"], +[8708, "src/Rosetta/archive/7z/init.luau"], +[9093, "src/Rosetta/archive/7z/Header.luau"], +[9620, "src/Rosetta/archive/adf/init.luau"], +[9902, "src/Rosetta/archive/applesingle/init.luau"], +[10088, "src/Rosetta/archive/ar/init.luau"], +[10491, "src/Rosetta/archive/arj/init.luau"], +[10701, "src/Rosetta/archive/binhex/init.luau"], +[10950, "src/Rosetta/archive/br/init.luau"], +[11025, "src/Rosetta/archive/bz2/init.luau"], +[11089, "src/Rosetta/archive/cab/init.luau"], +[11502, "src/Rosetta/archive/cab/Sum.luau"], +[11543, "src/Rosetta/archive/cpio/init.luau"], +[11711, "src/Rosetta/archive/d64/init.luau"], +[12125, "src/Rosetta/archive/fat/init.luau"], +[12247, "src/Rosetta/archive/grp/init.luau"], +[12361, "src/Rosetta/archive/gzip/init.luau"], +[12546, "src/Rosetta/archive/iso/init.luau"], +[12618, "src/Rosetta/archive/lha/init.luau"], +[13043, "src/Rosetta/archive/lz4/init.luau"], +[13387, "src/Rosetta/archive/macbinary/init.luau"], +[13585, "src/Rosetta/archive/mpq/init.luau"], +[13991, "src/Rosetta/archive/mpq/Crypt.luau"], +[14056, "src/Rosetta/archive/pak/init.luau"], +[14190, "src/Rosetta/archive/rpm/init.luau"], +[14514, "src/Rosetta/archive/tar/init.luau"], +[14632, "src/Rosetta/archive/unitypackage/init.luau"], +[14868, "src/Rosetta/archive/uu/init.luau"], +[15138, "src/Rosetta/archive/vpk/init.luau"], +[15449, "src/Rosetta/archive/vswap/init.luau"], +[15719, "src/Rosetta/archive/wad/init.luau"], +[16173, "src/Rosetta/archive/wad/Picture.luau"], +[16275, "src/Rosetta/archive/wad2/init.luau"], +[16557, "src/Rosetta/archive/xz/init.luau"], +[16657, "src/Rosetta/archive/yenc/init.luau"], +[16929, "src/Rosetta/archive/z/init.luau"], +[17025, "src/Rosetta/archive/zip/init.luau"], +[17244, "src/Rosetta/archive/zoo/init.luau"], +[17440, "src/Rosetta/archive/zst/init.luau"], +[17504, "src/Rosetta/audio/aac/init.luau"], +[17717, "src/Rosetta/audio/ac3/init.luau"], +[17864, "src/Rosetta/audio/adpcm/init.luau"], +[18010, "src/Rosetta/audio/adx/init.luau"], +[18242, "src/Rosetta/audio/aiff/init.luau"], +[18634, "src/Rosetta/audio/ape/init.luau"], +[18763, "src/Rosetta/audio/au/init.luau"], +[18925, "src/Rosetta/audio/brstm/init.luau"], +[19217, "src/Rosetta/audio/caf/init.luau"], +[19884, "src/Rosetta/audio/flac/init.luau"], +[20033, "src/Rosetta/audio/flac/Meta.luau"], +[20255, "src/Rosetta/audio/flac/Stream.luau"], +[20625, "src/Rosetta/audio/m4a/init.luau"], +[20968, "src/Rosetta/audio/mp3/init.luau"], +[21229, "src/Rosetta/audio/mp3/Index.luau"], +[21420, "src/Rosetta/audio/mp3/Stream.luau"], +[21647, "src/Rosetta/audio/mp3/Tags.luau"], +[21959, "src/Rosetta/audio/mpc/init.luau"], +[22054, "src/Rosetta/audio/opus/init.luau"], +[22433, "src/Rosetta/audio/opus/Encode.luau"], +[22545, "src/Rosetta/audio/qoa/init.luau"], +[22726, "src/Rosetta/audio/tta/init.luau"], +[22845, "src/Rosetta/audio/vag/init.luau"], +[23069, "src/Rosetta/audio/voc/init.luau"], +[23345, "src/Rosetta/audio/vorbis/init.luau"], +[23800, "src/Rosetta/audio/vorbis/Encode.luau"], +[24613, "src/Rosetta/audio/wav/init.luau"], +[25234, "src/Rosetta/audio/wav/Codecs.luau"], +[25413, "src/Rosetta/audio/wavpack/init.luau"], +[25621, "src/Rosetta/cad/step/init.luau"], +[26003, "src/Rosetta/cad/step/Brep.luau"], +[26238, "src/Rosetta/cad/step/Parse.luau"], +[26795, "src/Rosetta/cad/step/Write.luau"], +[27043, "src/Rosetta/codecs/audio/Aac/init.luau"], +[27451, "src/Rosetta/codecs/audio/Aac/Decode.luau"], +[28427, "src/Rosetta/codecs/audio/Aac/Ps.luau"], +[29017, "src/Rosetta/codecs/audio/Aac/Sbr.luau"], +[30084, "src/Rosetta/codecs/audio/Aac/SbrBits.luau"], +[30203, "src/Rosetta/codecs/audio/Aac/SbrDct.luau"], +[31445, "src/Rosetta/codecs/audio/Aac/SbrHf.luau"], +[31937, "src/Rosetta/codecs/audio/Aac/SbrQmf.luau"], +[32054, "src/Rosetta/codecs/audio/Aac/SbrTables.luau"], +[32467, "src/Rosetta/codecs/audio/Aac/Tables.luau"], +[32803, "src/Rosetta/codecs/audio/Ac3/init.luau"], +[32963, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], +[33848, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], +[33950, "src/Rosetta/codecs/audio/Adpcm/init.luau"], +[34704, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], +[35007, "src/Rosetta/codecs/audio/Alac/init.luau"], +[35242, "src/Rosetta/codecs/audio/Alac/Decode.luau"], +[35661, "src/Rosetta/codecs/audio/Alac/Encode.luau"], +[36073, "src/Rosetta/codecs/audio/Ape/init.luau"], +[36289, "src/Rosetta/codecs/audio/Ape/Decode.luau"], +[37050, "src/Rosetta/codecs/audio/ApeTag.luau"], +[37148, "src/Rosetta/codecs/audio/Flac/init.luau"], +[37160, "src/Rosetta/codecs/audio/Flac/Encode.luau"], +[38109, "src/Rosetta/codecs/audio/Flac/Frame.luau"], +[38729, "src/Rosetta/codecs/audio/Hively/init.luau"], +[38926, "src/Rosetta/codecs/audio/Hively/Load.luau"], +[39176, "src/Rosetta/codecs/audio/Hively/Player.luau"], +[40135, "src/Rosetta/codecs/audio/Hively/Tables.luau"], +[40355, "src/Rosetta/codecs/audio/Mdct/init.luau"], +[40575, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], +[40829, "src/Rosetta/codecs/audio/MidiRender.luau"], +[41176, "src/Rosetta/codecs/audio/Mpa/init.luau"], +[41191, "src/Rosetta/codecs/audio/Mpa/Analysis.luau"], +[41250, "src/Rosetta/codecs/audio/Mpa/Core.luau"], +[42908, "src/Rosetta/codecs/audio/Mpa/EncTables.luau"], +[43201, "src/Rosetta/codecs/audio/Mpa/Encode2.luau"], +[43586, "src/Rosetta/codecs/audio/Mpa/Encode3.luau"], +[44227, "src/Rosetta/codecs/audio/Mpa/Header.luau"], +[44368, "src/Rosetta/codecs/audio/Mpa/Tables.luau"], +[44595, "src/Rosetta/codecs/audio/Musepack/init.luau"], +[44941, "src/Rosetta/codecs/audio/Musepack/Decode.luau"], +[45835, "src/Rosetta/codecs/audio/Musepack/Tables.luau"], +[46214, "src/Rosetta/codecs/audio/Opus/init.luau"], +[46229, "src/Rosetta/codecs/audio/Opus/Celt.luau"], +[48101, "src/Rosetta/codecs/audio/Opus/CeltEncoder.luau"], +[49166, "src/Rosetta/codecs/audio/Opus/CeltTables.luau"], +[49227, "src/Rosetta/codecs/audio/Opus/Decoder.luau"], +[49691, "src/Rosetta/codecs/audio/Opus/Mdct.luau"], +[50042, "src/Rosetta/codecs/audio/Opus/Packet.luau"], +[50275, "src/Rosetta/codecs/audio/Opus/Silk.luau"], +[52317, "src/Rosetta/codecs/audio/Opus/SilkTables.luau"], +[52691, "src/Rosetta/codecs/audio/Pcm/init.luau"], +[52955, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], +[53252, "src/Rosetta/codecs/audio/Qoa/init.luau"], +[53534, "src/Rosetta/codecs/audio/Resample/init.luau"], +[53929, "src/Rosetta/codecs/audio/SoundFont/init.luau"], +[53984, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], +[54128, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], +[54642, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"], +[55441, "src/Rosetta/codecs/audio/Stream.luau"], +[55603, "src/Rosetta/codecs/audio/Tracker/init.luau"], +[56086, "src/Rosetta/codecs/audio/Tracker/Load.luau"], +[56365, "src/Rosetta/codecs/audio/Tracker/Mixer.luau"], +[56612, "src/Rosetta/codecs/audio/Tracker/Pcm.luau"], +[56741, "src/Rosetta/codecs/audio/Tracker/Player.luau"], +[58730, "src/Rosetta/codecs/audio/Tracker/Tables.luau"], +[58847, "src/Rosetta/codecs/audio/Tta/init.luau"], +[58965, "src/Rosetta/codecs/audio/Tta/Decode.luau"], +[59217, "src/Rosetta/codecs/audio/Vorbis/init.luau"], +[59231, "src/Rosetta/codecs/audio/Vorbis/Codebook.luau"], +[59615, "src/Rosetta/codecs/audio/Vorbis/Packet.luau"], +[60188, "src/Rosetta/codecs/audio/Vorbis/Setup.luau"], +[60610, "src/Rosetta/codecs/audio/Vorbis/Tables.luau"], +[60650, "src/Rosetta/codecs/audio/VorbisComment.luau"], +[60703, "src/Rosetta/codecs/audio/WavPack/init.luau"], +[60926, "src/Rosetta/codecs/audio/WavPack/Block.luau"], +[62381, "src/Rosetta/codecs/audio/WavPack/Tables.luau"], +[62444, "src/Rosetta/codecs/compress/Brotli/init.luau"], +[62531, "src/Rosetta/codecs/compress/Brotli/Decode.luau"], +[63507, "src/Rosetta/codecs/compress/Brotli/Static.luau"], +[64375, "src/Rosetta/codecs/compress/Bzip2/init.luau"], +[64419, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], +[64932, "src/Rosetta/codecs/compress/Deflate/init.luau"], +[65258, "src/Rosetta/codecs/compress/Deflate/Compress.luau"], +[65740, "src/Rosetta/codecs/compress/Deflate/Inflate.luau"], +[66188, "src/Rosetta/codecs/compress/Explode.luau"], +[66384, "src/Rosetta/codecs/compress/Lz4.luau"], +[66653, "src/Rosetta/codecs/compress/Lzh/init.luau"], +[67257, "src/Rosetta/codecs/compress/Lzma/init.luau"], +[67797, "src/Rosetta/codecs/compress/Lzma/Crc64.luau"], +[67864, "src/Rosetta/codecs/compress/Lzma/Decode.luau"], +[68337, "src/Rosetta/codecs/compress/Lzma/Filters.luau"], +[68513, "src/Rosetta/codecs/compress/Lzw/init.luau"], +[68781, "src/Rosetta/codecs/compress/Lzx.luau"], +[69215, "src/Rosetta/codecs/compress/PackBits.luau"], +[69305, "src/Rosetta/codecs/compress/Quantum.luau"], +[69542, "src/Rosetta/codecs/compress/UnixCompress.luau"], +[69846, "src/Rosetta/codecs/compress/Xxh32.luau"], +[69915, "src/Rosetta/codecs/compress/Zstd/init.luau"], +[69972, "src/Rosetta/codecs/compress/Zstd/Decode.luau"], +[70956, "src/Rosetta/codecs/compress/Zstd/Xxh64.luau"], +[71108, "src/Rosetta/codecs/entropy/Huffman.luau"], +[71395, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], +[71406, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], +[71627, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.luau"], +[71871, "src/Rosetta/codecs/font/Bitmap.luau"], +[72072, "src/Rosetta/codecs/font/Cff/init.luau"], +[72713, "src/Rosetta/codecs/font/GlyphNames.luau"], +[72863, "src/Rosetta/codecs/font/TrueType/init.luau"], +[73177, "src/Rosetta/codecs/font/TrueType/Glyf.luau"], +[73569, "src/Rosetta/codecs/font/TrueType/Tables.luau"], +[74071, "src/Rosetta/codecs/image/Bcn/init.luau"], +[74178, "src/Rosetta/codecs/image/Bcn/Decode.luau"], +[74662, "src/Rosetta/codecs/image/Bcn/Encode.luau"], +[75091, "src/Rosetta/codecs/image/Blend.luau"], +[75470, "src/Rosetta/codecs/image/Dct/init.luau"], +[75965, "src/Rosetta/codecs/image/Etc.luau"], +[76263, "src/Rosetta/codecs/image/Half.luau"], +[76332, "src/Rosetta/codecs/image/Jpeg/init.luau"], +[76686, "src/Rosetta/codecs/image/Jpeg/Arith.luau"], +[77094, "src/Rosetta/codecs/image/Jpeg/Color.luau"], +[77459, "src/Rosetta/codecs/image/Jpeg/Decode.luau"], +[78224, "src/Rosetta/codecs/image/Jpeg/Encode.luau"], +[79105, "src/Rosetta/codecs/image/Jpeg/Scan.luau"], +[79574, "src/Rosetta/codecs/image/Jpeg/Tables.luau"], +[79652, "src/Rosetta/codecs/image/Jpeg/Yuv.luau"], +[79719, "src/Rosetta/codecs/image/Miptex.luau"], +[80019, "src/Rosetta/codecs/image/Pixels.luau"], +[80339, "src/Rosetta/codecs/image/Quantize/init.luau"], +[80800, "src/Rosetta/codecs/image/Raster.luau"], +[81497, "src/Rosetta/codecs/image/Texel.luau"], +[81870, "src/Rosetta/codecs/image/Texture.luau"], +[82015, "src/Rosetta/codecs/image/Vp8/init.luau"], +[82157, "src/Rosetta/codecs/image/Vp8/Decode.luau"], +[84137, "src/Rosetta/codecs/image/Vp8/Predict.luau"], +[84400, "src/Rosetta/codecs/image/Vp8/Tables.luau"], +[84650, "src/Rosetta/codecs/image/Vp8/Yuv.luau"], +[84792, "src/Rosetta/codecs/image/Vp8L/init.luau"], +[84896, "src/Rosetta/codecs/image/Vp8L/Decode.luau"], +[85836, "src/Rosetta/codecs/image/Vp8L/Encode.luau"], +[86788, "src/Rosetta/codecs/image/Yuv.luau"], +[87109, "src/Rosetta/codecs/model/Brush.luau"], +[87749, "src/Rosetta/codecs/model/Displacement.luau"], +[87898, "src/Rosetta/codecs/model/DoomMap/init.luau"], +[88343, "src/Rosetta/codecs/model/DoomMap/Udmf.luau"], +[88593, "src/Rosetta/codecs/model/Draco/init.luau"], +[88925, "src/Rosetta/codecs/model/Draco/Attributes.luau"], +[89394, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], +[90583, "src/Rosetta/codecs/model/Draco/Int64.luau"], +[90732, "src/Rosetta/codecs/model/Draco/KdTree.luau"], +[91091, "src/Rosetta/codecs/model/Draco/Predict.luau"], +[92053, "src/Rosetta/codecs/model/Draco/Reader.luau"], +[92527, "src/Rosetta/codecs/model/Mat4.luau"], +[92786, "src/Rosetta/codecs/model/MeshFlatten.luau"], +[93314, "src/Rosetta/codecs/model/Minecraft/init.luau"], +[93866, "src/Rosetta/codecs/model/Minecraft/Colors.luau"], +[93945, "src/Rosetta/codecs/model/Minecraft/Legacy.luau"], +[94052, "src/Rosetta/codecs/model/Minecraft/Packed.luau"], +[94258, "src/Rosetta/codecs/model/Patch.luau"], +[94382, "src/Rosetta/codecs/model/Polygon.luau"], +[94616, "src/Rosetta/codecs/model/Rbx/init.luau"], +[94853, "src/Rosetta/codecs/model/Rbx/Binary.luau"], +[95607, "src/Rosetta/codecs/model/Rig.luau"], +[95850, "src/Rosetta/codecs/model/Sampler.luau"], +[96010, "src/Rosetta/codecs/model/SourceAnim.luau"], +[96231, "src/Rosetta/codecs/model/Vrml/init.luau"], +[96379, "src/Rosetta/codecs/model/Vrml/Build.luau"], +[96953, "src/Rosetta/codecs/model/Vrml/Fields.luau"], +[97116, "src/Rosetta/codecs/model/Vrml/Geometry.luau"], +[97865, "src/Rosetta/codecs/model/Vrml/Parse.luau"], +[98387, "src/Rosetta/codecs/model/Vrml/Write.luau"], +[99114, "src/Rosetta/codecs/model/Vrml/Xml.luau"], +[99346, "src/Rosetta/codecs/text/GodotVariant.luau"], +[100005, "src/Rosetta/codecs/text/Json/init.luau"], +[100274, "src/Rosetta/codecs/text/Json/Decode.luau"], +[100709, "src/Rosetta/codecs/text/Json/Encode.luau"], +[101054, "src/Rosetta/codecs/text/KeyValues/init.luau"], +[101624, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], +[101930, "src/Rosetta/codecs/text/Lexer/init.luau"], +[102062, "src/Rosetta/codecs/text/Nbt/init.luau"], +[102415, "src/Rosetta/codecs/text/Nbt/Binary.luau"], +[103107, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], +[103747, "src/Rosetta/codecs/text/Nbt/Value.luau"], +[103985, "src/Rosetta/codecs/text/Text/init.luau"], +[104076, "src/Rosetta/codecs/text/Url/init.luau"], +[104281, "src/Rosetta/codecs/text/Xml/init.luau"], +[104731, "src/Rosetta/codecs/text/Xml/Parse.luau"], +[105535, "src/Rosetta/codecs/video/Dsp.luau"], +[106373, "src/Rosetta/codecs/video/H263/init.luau"], +[106530, "src/Rosetta/codecs/video/H263/Decoder.luau"], +[107388, "src/Rosetta/codecs/video/H263/Tables.luau"], +[107592, "src/Rosetta/codecs/video/H264/init.luau"], +[107982, "src/Rosetta/codecs/video/H264/Bitstream.luau"], +[108257, "src/Rosetta/codecs/video/H264/Cabac.luau"], +[109388, "src/Rosetta/codecs/video/H264/Cavlc.luau"], +[110156, "src/Rosetta/codecs/video/H264/Deblock.luau"], +[110418, "src/Rosetta/codecs/video/H264/Decoder.luau"], +[111484, "src/Rosetta/codecs/video/H264/Inter.luau"], +[111810, "src/Rosetta/codecs/video/H264/Intra.luau"], +[112217, "src/Rosetta/codecs/video/H264/Mb.luau"], +[113171, "src/Rosetta/codecs/video/H264/Params.luau"], +[113619, "src/Rosetta/codecs/video/H264/Slice.luau"], +[113871, "src/Rosetta/codecs/video/H264/Tables.luau"], +[113913, "src/Rosetta/codecs/video/H264/Transform.luau"], +[114078, "src/Rosetta/codecs/video/Legacy/init.luau"], +[114277, "src/Rosetta/codecs/video/Legacy/Cinepak.luau"], +[114574, "src/Rosetta/codecs/video/Legacy/Flic.luau"], +[114941, "src/Rosetta/codecs/video/Legacy/Msvideo1.luau"], +[115059, "src/Rosetta/codecs/video/Legacy/Picture.luau"], +[115167, "src/Rosetta/codecs/video/Legacy/QtRle.luau"], +[115440, "src/Rosetta/codecs/video/Legacy/Smacker.luau"], +[115835, "src/Rosetta/codecs/video/Legacy/Smc.luau"], +[116012, "src/Rosetta/codecs/video/Mpeg1/init.luau"], +[116025, "src/Rosetta/codecs/video/Mpeg2/init.luau"], +[116399, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], +[117926, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], +[118066, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"], +[118205, "src/Rosetta/codecs/video/Theora/init.luau"], +[118469, "src/Rosetta/codecs/video/Theora/Decoder.luau"], +[119733, "src/Rosetta/codecs/video/Theora/Header.luau"], +[120097, "src/Rosetta/codecs/video/Video/init.luau"], +[120712, "src/Rosetta/codecs/video/Video/Disposable.luau"], +[120923, "src/Rosetta/codecs/video/Video/Pool.luau"], +[120975, "src/Rosetta/codecs/video/Video/Source.luau"], +[121261, "src/Rosetta/containers/Archive.luau"], +[121528, "src/Rosetta/containers/AudioWrap.luau"], +[122038, "src/Rosetta/containers/Avi/init.luau"], +[122591, "src/Rosetta/containers/Blend.luau"], +[123330, "src/Rosetta/containers/Chunks.luau"], +[123465, "src/Rosetta/containers/Cpio.luau"], +[123893, "src/Rosetta/containers/Demux.luau"], +[124179, "src/Rosetta/containers/Ebml/init.luau"], +[124493, "src/Rosetta/containers/Fat.luau"], +[125181, "src/Rosetta/containers/Iso9660.luau"], +[125686, "src/Rosetta/containers/IsoBmff/init.luau"], +[125857, "src/Rosetta/containers/IsoBmff/Box.luau"], +[126046, "src/Rosetta/containers/IsoBmff/Demux.luau"], +[126892, "src/Rosetta/containers/IsoBmff/Meta.luau"], +[127414, "src/Rosetta/containers/IsoBmff/Mux.luau"], +[127931, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], +[128049, "src/Rosetta/containers/MacFile.luau"], +[128198, "src/Rosetta/containers/MpegEs.luau"], +[128365, "src/Rosetta/containers/MpegPs/init.luau"], +[128586, "src/Rosetta/containers/MpegTs/init.luau"], +[129379, "src/Rosetta/containers/Ogg/init.luau"], +[129804, "src/Rosetta/containers/Ogg/Mux.luau"], +[129993, "src/Rosetta/containers/Ogg/Page.luau"], +[130159, "src/Rosetta/containers/Riff/init.luau"], +[130476, "src/Rosetta/containers/Tar.luau"], +[130890, "src/Rosetta/containers/Zip/init.luau"], +[131522, "src/Rosetta/core/Adler32.luau"], +[131582, "src/Rosetta/core/Base64.luau"], +[131810, "src/Rosetta/core/Bits.luau"], +[132103, "src/Rosetta/core/Bytes.luau"], +[132630, "src/Rosetta/core/Crc16.luau"], +[132682, "src/Rosetta/core/Crc32.luau"], +[132833, "src/Rosetta/core/Err.luau"], +[132915, "src/Rosetta/core/Input.luau"], +[132991, "src/Rosetta/core/Md5.luau"], +[133149, "src/Rosetta/core/Sniff.luau"], +[133178, "src/Rosetta/data/cbor/init.luau"], +[133277, "src/Rosetta/data/cbor/Codec.luau"], +[133846, "src/Rosetta/data/csv/init.luau"], +[134158, "src/Rosetta/data/ini/init.luau"], +[134404, "src/Rosetta/data/json/init.luau"], +[134496, "src/Rosetta/data/msgpack/init.luau"], +[134585, "src/Rosetta/data/msgpack/Codec.luau"], +[135027, "src/Rosetta/data/nbt/init.luau"], +[135086, "src/Rosetta/data/plist/init.luau"], +[135392, "src/Rosetta/data/plist/Binary.luau"], +[135659, "src/Rosetta/data/q3shader/init.luau"], +[135898, "src/Rosetta/data/q3skin/init.luau"], +[135994, "src/Rosetta/data/snbt/init.luau"], +[136057, "src/Rosetta/data/toml/init.luau"], +[136124, "src/Rosetta/data/toml/Decode.luau"], +[136752, "src/Rosetta/data/toml/Encode.luau"], +[136961, "src/Rosetta/data/tres/init.luau"], +[137106, "src/Rosetta/data/vdf/init.luau"], +[137207, "src/Rosetta/data/xml/init.luau"], +[137263, "src/Rosetta/data/yaml/init.luau"], +[137336, "src/Rosetta/data/yaml/Emit.luau"], +[137626, "src/Rosetta/data/yaml/Parse.luau"], +[138919, "src/Rosetta/font/bdf/init.luau"], +[139208, "src/Rosetta/font/bmfont/init.luau"], +[139635, "src/Rosetta/font/bmfont/Parse.luau"], +[140088, "src/Rosetta/font/eot/init.luau"], +[140320, "src/Rosetta/font/fon/init.luau"], +[140603, "src/Rosetta/font/hershey/init.luau"], +[140798, "src/Rosetta/font/pcf/init.luau"], +[141078, "src/Rosetta/font/psf/init.luau"], +[141398, "src/Rosetta/font/ttf/init.luau"], +[141449, "src/Rosetta/font/type1/init.luau"], +[141808, "src/Rosetta/font/type1/Charstring.luau"], +[142086, "src/Rosetta/font/woff/init.luau"], +[142218, "src/Rosetta/font/woff2/init.luau"], +[142275, "src/Rosetta/font/woff2/Rebuild.luau"], +[142815, "src/Rosetta/host/init.luau"], +[142860, "src/Rosetta/host/Love.luau"], +[143003, "src/Rosetta/host/LuaJIT.luau"], +[143053, "src/Rosetta/host/Luau.luau"], +[143076, "src/Rosetta/host/Roblox.luau"], +[143435, "src/Rosetta/image/ani/init.luau"], +[143615, "src/Rosetta/image/art/init.luau"], +[144103, "src/Rosetta/image/blp/init.luau"], +[144361, "src/Rosetta/image/bmp/init.luau"], +[144776, "src/Rosetta/image/dds/init.luau"], +[145259, "src/Rosetta/image/exr/init.luau"], +[146019, "src/Rosetta/image/exr/Codec.luau"], +[146130, "src/Rosetta/image/exr/Piz.luau"], +[146487, "src/Rosetta/image/gif/init.luau"], +[147003, "src/Rosetta/image/gif/Decode.luau"], +[147079, "src/Rosetta/image/hdr/init.luau"], +[147308, "src/Rosetta/image/hdr/Codec.luau"], +[147519, "src/Rosetta/image/icns/init.luau"], +[147850, "src/Rosetta/image/ico/init.luau"], +[148127, "src/Rosetta/image/ico/Dib.luau"], +[148222, "src/Rosetta/image/ilbm/init.luau"], +[148541, "src/Rosetta/image/jpeg/init.luau"], +[148677, "src/Rosetta/image/ktx/init.luau"], +[149337, "src/Rosetta/image/lmp/init.luau"], +[149470, "src/Rosetta/image/pcx/init.luau"], +[149734, "src/Rosetta/image/png/init.luau"], +[150314, "src/Rosetta/image/png/Apng.luau"], +[150394, "src/Rosetta/image/png/Decode.luau"], +[150767, "src/Rosetta/image/png/Encode.luau"], +[150970, "src/Rosetta/image/pnm/init.luau"], +[151348, "src/Rosetta/image/pnm/Codec.luau"], +[151625, "src/Rosetta/image/qoi/init.luau"], +[151747, "src/Rosetta/image/qoi/Codec.luau"], +[151904, "src/Rosetta/image/sgi/init.luau"], +[152189, "src/Rosetta/image/spr/init.luau"], +[152502, "src/Rosetta/image/sunras/init.luau"], +[152748, "src/Rosetta/image/tga/init.luau"], +[153018, "src/Rosetta/image/tga/Codec.luau"], +[153218, "src/Rosetta/image/tiff/init.luau"], +[154045, "src/Rosetta/image/tiff/Pixels.luau"], +[154435, "src/Rosetta/image/tim/init.luau"], +[154677, "src/Rosetta/image/vtf/init.luau"], +[154912, "src/Rosetta/image/webp/init.luau"], +[155522, "src/Rosetta/image/webp/Alpha.luau"], +[155598, "src/Rosetta/image/webp/Anim.luau"], +[155753, "src/Rosetta/image/xbm/init.luau"], +[155914, "src/Rosetta/image/xpm/init.luau"], +[156182, "src/Rosetta/image/xpm/Names.luau"], +[156238, "src/Rosetta/layered/aseprite/init.luau"], +[156976, "src/Rosetta/layered/ora/init.luau"], +[157263, "src/Rosetta/layered/psd/init.luau"], +[157998, "src/Rosetta/layered/psd/Channels.luau"], +[158350, "src/Rosetta/model/3ds/init.luau"], +[158433, "src/Rosetta/model/3ds/Build.luau"], +[159080, "src/Rosetta/model/3ds/Read.luau"], +[159576, "src/Rosetta/model/3ds/Write.luau"], +[160381, "src/Rosetta/model/3mf/init.luau"], +[160463, "src/Rosetta/model/3mf/Read.luau"], +[161051, "src/Rosetta/model/3mf/Write.luau"], +[161456, "src/Rosetta/model/ase/init.luau"], +[161579, "src/Rosetta/model/ase/Build.luau"], +[162153, "src/Rosetta/model/ase/Parse.luau"], +[162222, "src/Rosetta/model/ase/Write.luau"], +[162685, "src/Rosetta/model/b3d/init.luau"], +[162740, "src/Rosetta/model/b3d/Read.luau"], +[163311, "src/Rosetta/model/blend/init.luau"], +[163407, "src/Rosetta/model/blend/Anim.luau"], +[163753, "src/Rosetta/model/blend/Material.luau"], +[164105, "src/Rosetta/model/blend/Mesh.luau"], +[164740, "src/Rosetta/model/blend/Normals.luau"], +[164901, "src/Rosetta/model/blend/Prim.luau"], +[165350, "src/Rosetta/model/blend/Read.luau"], +[166250, "src/Rosetta/model/bsp/init.luau"], +[166441, "src/Rosetta/model/bsp/Lightmap.luau"], +[166507, "src/Rosetta/model/bsp/Quake.luau"], +[166896, "src/Rosetta/model/bsp/Quake3.luau"], +[167125, "src/Rosetta/model/bsp/Tree.luau"], +[167513, "src/Rosetta/model/buildmap/init.luau"], +[167785, "src/Rosetta/model/buildmap/Geometry.luau"], +[168188, "src/Rosetta/model/d3map/init.luau"], +[168470, "src/Rosetta/model/d3map/Parse.luau"], +[168668, "src/Rosetta/model/dae/init.luau"], +[168857, "src/Rosetta/model/dae/Math.luau"], +[168904, "src/Rosetta/model/dae/Read.luau"], +[170754, "src/Rosetta/model/dae/Write.luau"], +[171123, "src/Rosetta/model/fbx/init.luau"], +[171271, "src/Rosetta/model/fbx/Ascii.luau"], +[171541, "src/Rosetta/model/fbx/Binary.luau"], +[171996, "src/Rosetta/model/fbx/Read.luau"], +[173358, "src/Rosetta/model/fbx/Write.luau"], +[174343, "src/Rosetta/model/fbx/Xform.luau"], +[174384, "src/Rosetta/model/gltf/init.luau"], +[174621, "src/Rosetta/model/gltf/Pack.luau"], +[174690, "src/Rosetta/model/gltf/Read.luau"], +[175421, "src/Rosetta/model/gltf/Write.luau"], +[176101, "src/Rosetta/model/godot/init.luau"], +[176192, "src/Rosetta/model/godot/Build.luau"], +[176734, "src/Rosetta/model/godot/Primitives.luau"], +[177009, "src/Rosetta/model/godot/Surface.luau"], +[177494, "src/Rosetta/model/godot/Write.luau"], +[177823, "src/Rosetta/model/iqm/init.luau"], +[177899, "src/Rosetta/model/iqm/Read.luau"], +[178254, "src/Rosetta/model/iqm/Write.luau"], +[178941, "src/Rosetta/model/ldraw/init.luau"], +[179019, "src/Rosetta/model/ldraw/Colors.luau"], +[179337, "src/Rosetta/model/ldraw/Read.luau"], +[179914, "src/Rosetta/model/lwo/init.luau"], +[179990, "src/Rosetta/model/lwo/Build.luau"], +[180452, "src/Rosetta/model/lwo/Parse.luau"], +[180995, "src/Rosetta/model/map/init.luau"], +[181312, "src/Rosetta/model/map/Build.luau"], +[181556, "src/Rosetta/model/map/Parse.luau"], +[181941, "src/Rosetta/model/map/Write.luau"], +[182087, "src/Rosetta/model/mca/init.luau"], +[182429, "src/Rosetta/model/mca/Chunk.luau"], +[182562, "src/Rosetta/model/mca/Lz4Block.luau"], +[182632, "src/Rosetta/model/md2/init.luau"], +[182831, "src/Rosetta/model/md3/init.luau"], +[183059, "src/Rosetta/model/md5/init.luau"], +[183140, "src/Rosetta/model/md5/Read.luau"], +[183573, "src/Rosetta/model/mdl/init.luau"], +[183655, "src/Rosetta/model/mdl/HalfLife.luau"], +[183959, "src/Rosetta/model/mdl/Quake.luau"], +[184177, "src/Rosetta/model/ms3d/init.luau"], +[184249, "src/Rosetta/model/ms3d/Read.luau"], +[184695, "src/Rosetta/model/ms3d/Write.luau"], +[185164, "src/Rosetta/model/obj/init.luau"], +[185982, "src/Rosetta/model/obj/Mtl.luau"], +[186270, "src/Rosetta/model/off/init.luau"], +[186732, "src/Rosetta/model/ply/init.luau"], +[187837, "src/Rosetta/model/ply/Binary.luau"], +[188038, "src/Rosetta/model/pmx/init.luau"], +[188107, "src/Rosetta/model/pmx/Build.luau"], +[188403, "src/Rosetta/model/pmx/Pmd.luau"], +[188738, "src/Rosetta/model/pmx/Read.luau"], +[189142, "src/Rosetta/model/proc/init.luau"], +[189524, "src/Rosetta/model/qb/init.luau"], +[189917, "src/Rosetta/model/rbxm/init.luau"], +[190510, "src/Rosetta/model/rbxmx/init.luau"], +[191186, "src/Rosetta/model/robloxmesh/init.luau"], +[191845, "src/Rosetta/model/robloxmesh/Parse.luau"], +[192302, "src/Rosetta/model/robloxmesh/Write.luau"], +[192411, "src/Rosetta/model/schematic/init.luau"], +[192732, "src/Rosetta/model/schematic/Common.luau"], +[192852, "src/Rosetta/model/schematic/Litematic.luau"], +[193063, "src/Rosetta/model/schematic/Mcedit.luau"], +[193307, "src/Rosetta/model/schematic/Sponge.luau"], +[193436, "src/Rosetta/model/smd/init.luau"], +[193503, "src/Rosetta/model/smd/Read.luau"], +[193772, "src/Rosetta/model/smd/Write.luau"], +[194015, "src/Rosetta/model/sourcemdl/init.luau"], +[194186, "src/Rosetta/model/sourcemdl/Build.luau"], +[194616, "src/Rosetta/model/sourcemdl/Material.luau"], +[194777, "src/Rosetta/model/sourcemdl/Mdl.luau"], +[195304, "src/Rosetta/model/sourcemdl/Phy.luau"], +[195427, "src/Rosetta/model/sourcemdl/Vtx.luau"], +[195609, "src/Rosetta/model/sourcemdl/Vvd.luau"], +[195703, "src/Rosetta/model/stl/init.luau"], +[196153, "src/Rosetta/model/stl/Decode.luau"], +[196227, "src/Rosetta/model/t3d/init.luau"], +[196321, "src/Rosetta/model/t3d/Build.luau"], +[196726, "src/Rosetta/model/t3d/Parse.luau"], +[196894, "src/Rosetta/model/udmf/init.luau"], +[196977, "src/Rosetta/model/usda/init.luau"], +[197186, "src/Rosetta/model/usda/Build.luau"], +[198464, "src/Rosetta/model/usda/Parse.luau"], +[199262, "src/Rosetta/model/usda/Write.luau"], +[200079, "src/Rosetta/model/vbsp/init.luau"], +[200525, "src/Rosetta/model/vbsp/Faces.luau"], +[200749, "src/Rosetta/model/vbsp/Props.luau"], +[200841, "src/Rosetta/model/vmf/init.luau"], +[201166, "src/Rosetta/model/vmf/Build.luau"], +[201590, "src/Rosetta/model/vox/init.luau"], +[202476, "src/Rosetta/model/vox/Grid.luau"], +[202533, "src/Rosetta/model/vrml/init.luau"], +[202599, "src/Rosetta/model/x/init.luau"], +[202729, "src/Rosetta/model/x/Build.luau"], +[203292, "src/Rosetta/model/x/Parse.luau"], +[203589, "src/Rosetta/model/x3d/init.luau"], +[203667, "src/Rosetta/music/669/init.luau"], +[203874, "src/Rosetta/music/ahx/init.luau"], +[203926, "src/Rosetta/music/far/init.luau"], +[204156, "src/Rosetta/music/hmp/init.luau"], +[204421, "src/Rosetta/music/hvl/init.luau"], +[204473, "src/Rosetta/music/it/init.luau"], +[204892, "src/Rosetta/music/it/Itsex.luau"], +[205009, "src/Rosetta/music/med/init.luau"], +[205657, "src/Rosetta/music/midi/init.luau"], +[205801, "src/Rosetta/music/midi/Smf.luau"], +[206213, "src/Rosetta/music/mod/init.luau"], +[206567, "src/Rosetta/music/mtm/init.luau"], +[206790, "src/Rosetta/music/mus/init.luau"], +[206948, "src/Rosetta/music/okt/init.luau"], +[207230, "src/Rosetta/music/ptm/init.luau"], +[207453, "src/Rosetta/music/s3m/init.luau"], +[207690, "src/Rosetta/music/sf2/init.luau"], +[207734, "src/Rosetta/music/stm/init.luau"], +[207966, "src/Rosetta/music/ult/init.luau"], +[208271, "src/Rosetta/music/umx/init.luau"], +[208488, "src/Rosetta/music/xm/init.luau"], +[209050, "src/Rosetta/music/xmi/init.luau"], +[209259, "src/Rosetta/ops/AudioOps.luau"], +[209738, "src/Rosetta/ops/ImageOps/init.luau"], +[210386, "src/Rosetta/ops/ImageOps/Kernels.luau"], +[211026, "src/Rosetta/ops/LayerOps.luau"], +[211119, "src/Rosetta/ops/MeshOps/init.luau"], +[212171, "src/Rosetta/ops/MeshOps/Greedy.luau"], +[212338, "src/Rosetta/ops/MusicOps.luau"], +[212687, "src/Rosetta/playlist/m3u/init.luau"], +[213040, "src/Rosetta/playlist/pls/init.luau"], +[213218, "src/Rosetta/playlist/xspf/init.luau"], +[213421, "src/Rosetta/subtitle/ass/init.luau"], +[213865, "src/Rosetta/subtitle/srt/init.luau"], +[214038, "src/Rosetta/subtitle/vtt/init.luau"], +[214241, "src/Rosetta/vector/gamemaps/init.luau"], +[214428, "src/Rosetta/vector/gamemaps/Expand.luau"], +[214525, "src/Rosetta/vector/ldtk/init.luau"], +[214617, "src/Rosetta/vector/ldtk/Read.luau"], +[214953, "src/Rosetta/vector/ldtk/Write.luau"], +[215601, "src/Rosetta/vector/ogmo/init.luau"], +[215720, "src/Rosetta/vector/ogmo/Read.luau"], +[216125, "src/Rosetta/vector/ogmo/Write.luau"], +[216479, "src/Rosetta/vector/svg/init.luau"], +[216565, "src/Rosetta/vector/svg/Parse.luau"], +[217311, "src/Rosetta/vector/svg/PathData.luau"], +[217679, "src/Rosetta/vector/svg/Render.luau"], +[218096, "src/Rosetta/vector/svg/Style.luau"], +[218468, "src/Rosetta/vector/svg/Write.luau"], +[218668, "src/Rosetta/vector/tiled/init.luau"], +[218848, "src/Rosetta/vector/tiled/Data.luau"], +[218999, "src/Rosetta/vector/tiled/Tmj.luau"], +[219630, "src/Rosetta/vector/tiled/Tmx.luau"], +[220242, "src/Rosetta/video/avi/init.luau"], +[220536, "src/Rosetta/video/fli/init.luau"], +[220687, "src/Rosetta/video/flv/init.luau"], +[221071, "src/Rosetta/video/flv/Amf.luau"], +[221229, "src/Rosetta/video/flv/Mux.luau"], +[221510, "src/Rosetta/video/h264/init.luau"], +[221649, "src/Rosetta/video/mkv/init.luau"], +[221805, "src/Rosetta/video/mkv/Mux.luau"], +[222084, "src/Rosetta/video/mkv/Parse.luau"], +[222805, "src/Rosetta/video/mp4/init.luau"], +[223133, "src/Rosetta/video/mpegps/init.luau"], +[223320, "src/Rosetta/video/mpegts/init.luau"], +[223566, "src/Rosetta/video/ogv/init.luau"], +[223961, "src/Rosetta/video/smk/init.luau"], +[224270, "src/Rosetta/video/smk/Audio.luau"], +[224390, "src/Rosetta/video/y4m/init.luau"] ] diff --git a/compat/luajit.lua b/compat/luajit.lua index cd9745b..1bcf693 100644 --- a/compat/luajit.lua +++ b/compat/luajit.lua @@ -456,8 +456,13 @@ end do -- math.min / math.max are branch-free in a trace; an if / elseif clamp spawned side traces and ran ~3.5x slower. -- NaN stays NaN, as in Luau (maxsd would return lo). + -- Vararg (`...` unused): LuaJIT never starts a root trace at a vararg function but still inlines it into its + -- callers' traces. The plain clamp, called from interpreted code, started root traces that aborted on the return + -- into the caller's loop; enough aborts blacklist it, every trace that reaches a blacklisted function aborts too, and + -- in a long mixed process one codec left every clamp user interpreted (jpeg, webp, tiff 2-10x slower). Not done for + -- the others: a vararg math.sign made Monkey's Audio's sign-heavy filters ~40% slower. local mmin, mmax = math.min, math.max - math.clamp = math.clamp or function(x, lo, hi) + math.clamp = math.clamp or function(x, lo, hi, ...) if lo > hi then error("max must be greater than or equal to min", 2) end if x ~= x then return x end return mmin(mmax(x, lo), hi) diff --git a/docs/API.md b/docs/API.md index a6d5953..70184f2 100644 --- a/docs/API.md +++ b/docs/API.md @@ -24,7 +24,7 @@ come back as a third value `{ [file name] = buffer }` (or in the caller's `opts. | `F.save(value, dest?, opts?)` | `buffer` / `true` (+ the extra files, see above) | | `F.saveString(value, opts?)` | the encoded bytes as a string | | `F.convert(src, format, opts?)` | load + save (`opts` go to both; `opts.out = path` writes a file) | -| `F.detect(src, opts?)` | the format name (content sniffing first, then the extension); a format's optional `variant(r)` can name the flavour (`"webm"` for a WebM file read by mkv) | +| `F.detect(src, opts?)` | the format name (content sniffing first, then the extension); a format's optional `variant(r)` can name the flavour (`"webm"` for a WebM file read by mkv). Sniffing loads no format module (the generated `Sniffs.luau`); `load` / `open` / `save` load only the format they use | | `F.formats(category?)` | `{ { name, category, extensions, mime, caps } }` without loading any format (also [FORMATS.md](FORMATS.md)) | | `F.format(name)` | the format module itself (`sniff` / `decode` / `encode` / `open` and extras such as `png.info`) | diff --git a/docs/STYLE.md b/docs/STYLE.md index 16e2caf..01d4ef2 100644 --- a/docs/STYLE.md +++ b/docs/STYLE.md @@ -18,7 +18,7 @@ The reference implementation to copy is **PNG**: ``` src/Rosetta/ - init.luau Registry.luau (generated) api (layer 6) + init.luau Registry.luau Sniffs.luau (gen.) api (layer 6) ops/ ops (layer 5.5) editing on the standard types (F.ops.image / mesh / layers / audio / music; ImageOps, ...) // formats (layer 5) image audio video model cad font archive data @@ -156,6 +156,11 @@ Rules: inside a bigger buffer; never assume offset 0). It returns the category's standard type from `Types.luau` (`Types.Image.new(w, h)`, `Types.Scene.new()`, ...), `rgba8` for images unless `opts.native` asks for the source layout. Fill `meta.source = { format = "", ... }` with the source facts (bit depth, colour type, codec, ...). +- `sniff(r)` scores 0..1 and is copied, with the top-level locals, types and loops it reaches, into the generated + `Sniffs.luau`, so detection requires no format module (requires outside `core/` become proxies loaded at sniff time). + A sniff that reaches its module table (`Png.info(r)`), a forward-declared local or a load-time read of a non-core + module is not copied: its module then loads on every detection that gets that far. `tests/detect.luau` checks the + copies against the modules. - `encode(value, opts)` returns a buffer. Validate the value first and return `Err.ARG` for anything wrong. - `open(r, opts)` (audio / video) returns the streaming Decoder / VideoDecoder / Demuxer from `Types.luau`. If a format has `open` but no `decode`, `F.load` decodes the whole stream through it. @@ -312,8 +317,8 @@ t:done() 2. Shared code (a codec two formats need, a container) goes to `codecs//` or `containers/` instead, with its own test in `tests/codecs/` / `tests/containers/`. 3. `deps = { ... }` = the requires outside the folder. -4. `python3 -I tools/gen_registry.py` (regenerates `src/Rosetta/Registry.luau` and `docs/FORMATS.md`; never edit those - by hand; after a merge, just rerun it). +4. `python3 -I tools/gen_registry.py` (regenerates `src/Rosetta/Registry.luau`, `Sniffs.luau` and `docs/FORMATS.md`; + never edit those by hand; after a merge, just rerun it). 5. `tools/fixtures/.py` + `tests//.luau`. 6. `bash tools/test.sh ` while working (both runtimes), then `bash tools/test.sh` (everything + lint). 7. The docs line comes from the contract (`docs/FORMATS.md`); put format notes (limits, spec deviations, bench numbers) diff --git a/src/Rosetta/Registry.luau b/src/Rosetta/Registry.luau index fd33c7f..afbe9c8 100644 --- a/src/Rosetta/Registry.luau +++ b/src/Rosetta/Registry.luau @@ -2,6 +2,8 @@ -- Registry: GENERATED by tools/gen_registry.py from the format folders - do not edit. -- One entry per format: the contract metadata (copied from its init.luau) and load(), which requires the format -- module on first use (a static require, as Roblox needs). Order: category, then name. +-- sniff: where detection finds the format's sniff (tools/sniff_extract.py): 0 Sniffs.luau, 1 Sniffs.luau reaching a +-- codec / container on first call, 2 the format module. variant: the module has variant(r). export type Entry = { name: string, category: string, @@ -10,6 +12,8 @@ export type Entry = { mime: { string }, deps: { string }, caps: { [string]: any }, + sniff: number, + variant: boolean?, load: () -> any, } @@ -22,6 +26,7 @@ local list: { Entry } = { mime = { "application/x-navi-animation" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Riff" }, caps = { decode = true, encode = true, alpha = true, animation = true, frames = true }, + sniff = 0, load = function() return require("@rosetta/image/ani") end, @@ -34,6 +39,7 @@ local list: { Entry } = { mime = { "image/x-build-art" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels", "codecs/image/Quantize" }, caps = { decode = true, encode = true, alpha = true, palette = true, frames = true, depths = { 8 } }, + sniff = 0, load = function() return require("@rosetta/image/art") end, @@ -46,6 +52,7 @@ local list: { Entry } = { mime = { "image/x-blp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Jpeg", "codecs/image/Bcn" }, caps = { decode = true, encode = true, alpha = true, variants = { "blp1", "blp2" }, compressions = { "jpeg", "palette", "dxt1", "dxt3", "dxt5", "bgra" } }, + sniff = 0, load = function() return require("@rosetta/image/blp") end, @@ -58,6 +65,7 @@ local list: { Entry } = { mime = { "image/bmp", "image/x-bmp", "image/x-ms-bmp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, depths = { 1, 2, 4, 8, 16, 24, 32 }, rle = true }, + sniff = 0, load = function() return require("@rosetta/image/bmp") end, @@ -70,6 +78,7 @@ local list: { Entry } = { mime = { "image/vnd-ms.dds", "image/x-dds" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Bcn", "codecs/image/Texel", "codecs/image/Texture" }, caps = { decode = true, encode = true, alpha = true, float = true, mipmaps = true, cubemap = true, compressed = { "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7" } }, + sniff = 0, load = function() return require("@rosetta/image/dds") end, @@ -82,6 +91,7 @@ local list: { Entry } = { mime = { "image/x-exr", "image/aces" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Half", "codecs/compress/Deflate" }, caps = { decode = true, encode = true, alpha = true, float = true, hdr = true, depths = { 16, 32 }, multipart = true, tiled = true }, + sniff = 0, load = function() return require("@rosetta/image/exr") end, @@ -94,6 +104,7 @@ local list: { Entry } = { mime = { "image/gif" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Lzw", "codecs/image/Quantize", "Types" }, caps = { decode = true, encode = true, animation = true, alpha = true, palette = true, depths = { 1, 2, 4, 8 } }, + sniff = 0, load = function() return require("@rosetta/image/gif") end, @@ -106,6 +117,7 @@ local list: { Entry } = { mime = { "image/vnd.radiance", "image/x-hdr" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = false, float = true, depths = { 32 } }, + sniff = 0, load = function() return require("@rosetta/image/hdr") end, @@ -118,6 +130,7 @@ local list: { Entry } = { mime = { "image/icns", "image/x-icns" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "containers/Chunks" }, caps = { decode = true, encode = true, alpha = true, frames = true, depths = { 1, 24, 32 } }, + sniff = 0, load = function() return require("@rosetta/image/icns") end, @@ -130,6 +143,7 @@ local list: { Entry } = { mime = { "image/vnd.microsoft.icon", "image/x-icon" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, frames = true, depths = { 1, 4, 8, 16, 24, 32 } }, + sniff = 0, load = function() return require("@rosetta/image/ico") end, @@ -142,6 +156,7 @@ local list: { Entry } = { mime = { "image/x-ilbm", "image/x-iff" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/compress/PackBits", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 2, 3, 4, 5, 6, 7, 8, 24, 32 } }, + sniff = 0, load = function() return require("@rosetta/image/ilbm") end, @@ -154,6 +169,7 @@ local list: { Entry } = { mime = { "image/jpeg" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Jpeg" }, caps = { decode = true, encode = true, lossy = true, alpha = false, depths = { 8, 12 }, progressive = true, arithmetic = true }, + sniff = 0, load = function() return require("@rosetta/image/jpeg") end, @@ -166,6 +182,7 @@ local list: { Entry } = { mime = { "image/ktx2", "image/ktx" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/compress/Deflate", "codecs/compress/Zstd", "codecs/image/Texel", "codecs/image/Texture" }, caps = { decode = true, encode = true, alpha = true, float = true, mipmaps = true, cubemap = true, compressed = { "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7", "etc1", "etc2", "eac" } }, + sniff = 0, load = function() return require("@rosetta/image/ktx") end, @@ -178,6 +195,7 @@ local list: { Entry } = { mime = { "image/x-quake-lmp" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, alpha = true, depths = { 8 }, variants = { "qpic", "palette", "colormap" } }, + sniff = 0, load = function() return require("@rosetta/image/lmp") end, @@ -190,6 +208,7 @@ local list: { Entry } = { mime = { "image/vnd.zbrush.pcx", "image/x-pcx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 2, 4, 8, 24, 32 } }, + sniff = 0, load = function() return require("@rosetta/image/pcx") end, @@ -202,6 +221,7 @@ local list: { Entry } = { mime = { "image/png", "image/apng" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Deflate", "Types", "containers/Chunks" }, caps = { decode = true, encode = true, animation = true, alpha = true, depths = { 1, 2, 4, 8, 16 } }, + sniff = 0, load = function() return require("@rosetta/image/png") end, @@ -214,6 +234,7 @@ local list: { Entry } = { mime = { "image/x-portable-anymap", "image/x-portable-bitmap", "image/x-portable-graymap", "image/x-portable-pixmap", "image/x-portable-arbitrarymap", "image/x-portable-floatmap" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 1, 8, 16, 32 }, float = true }, + sniff = 0, load = function() return require("@rosetta/image/pnm") end, @@ -226,6 +247,7 @@ local list: { Entry } = { mime = { "image/qoi", "image/x-qoi" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 8 } }, + sniff = 0, load = function() return require("@rosetta/image/qoi") end, @@ -238,6 +260,7 @@ local list: { Entry } = { mime = { "image/sgi", "image/x-rgb" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 8, 16 } }, + sniff = 0, load = function() return require("@rosetta/image/sgi") end, @@ -250,6 +273,7 @@ local list: { Entry } = { mime = { "image/x-quake-sprite" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, alpha = true, animation = true, variants = { "quake", "halflife", "spr32" } }, + sniff = 0, load = function() return require("@rosetta/image/spr") end, @@ -262,6 +286,7 @@ local list: { Entry } = { mime = { "image/x-sun-raster", "image/x-cmu-raster" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 8, 24, 32 } }, + sniff = 0, load = function() return require("@rosetta/image/sunras") end, @@ -274,6 +299,7 @@ local list: { Entry } = { mime = { "image/x-tga", "image/x-targa" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 8, 15, 16, 24, 32 } }, + sniff = 0, load = function() return require("@rosetta/image/tga") end, @@ -286,6 +312,7 @@ local list: { Entry } = { mime = { "image/tiff" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/compress/Lzw", "codecs/compress/PackBits" }, caps = { decode = true, encode = true, alpha = true, pages = true, depths = { 1, 2, 4, 8, 16, 32 }, float = true }, + sniff = 0, load = function() return require("@rosetta/image/tiff") end, @@ -298,6 +325,7 @@ local list: { Entry } = { mime = { "image/x-tim" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 4, 8, 16, 24 } }, + sniff = 0, load = function() return require("@rosetta/image/tim") end, @@ -310,6 +338,7 @@ local list: { Entry } = { mime = { "image/x-vtf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Bcn", "codecs/image/Texel" }, caps = { decode = true, encode = false, alpha = true, animation = true, versions = { "7.0", "7.1", "7.2", "7.3", "7.4", "7.5" } }, + sniff = 0, load = function() return require("@rosetta/image/vtf") end, @@ -322,6 +351,7 @@ local list: { Entry } = { mime = { "image/webp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Vp8", "codecs/image/Vp8L", "containers/Riff" }, caps = { decode = true, encode = true, animation = true, alpha = true, lossy = true, lossless = true, depths = { 8 } }, + sniff = 0, load = function() return require("@rosetta/image/webp") end, @@ -334,6 +364,7 @@ local list: { Entry } = { mime = { "image/x-xbitmap", "image/x-xbm" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, depths = { 1 } }, + sniff = 0, load = function() return require("@rosetta/image/xbm") end, @@ -346,6 +377,7 @@ local list: { Entry } = { mime = { "image/x-xpixmap", "image/x-xpm" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 8 } }, + sniff = 0, load = function() return require("@rosetta/image/xpm") end, @@ -358,6 +390,7 @@ local list: { Entry } = { mime = { "audio/aac", "audio/aacp", "audio/x-aac" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Aac", "codecs/audio/Pcm", "codecs/audio/Stream" }, caps = { decode = true, encode = false, codecs = { "aac" }, streaming = true }, + sniff = 1, load = function() return require("@rosetta/audio/aac") end, @@ -370,6 +403,7 @@ local list: { Entry } = { mime = { "audio/ac3", "audio/x-ac3" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/Ac3" }, caps = { decode = true, encode = false, codecs = { "ac3" }, channels = 6, streaming = true, lossy = true }, + sniff = 1, load = function() return require("@rosetta/audio/ac3") end, @@ -382,6 +416,7 @@ local list: { Entry } = { mime = { "audio/x-adpcm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, headerless = true, codecs = { "ima", "ima_wav", "ms", "ima_qt", "psx" } }, + sniff = 0, load = function() return require("@rosetta/audio/adpcm") end, @@ -394,6 +429,7 @@ local list: { Entry } = { mime = { "audio/x-adx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, loops = true, channels = 8 }, + sniff = 0, load = function() return require("@rosetta/audio/adx") end, @@ -406,6 +442,7 @@ local list: { Entry } = { mime = { "audio/aiff", "audio/x-aiff" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm/Decoder", "containers/Chunks" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, lossy = false }, + sniff = 0, load = function() return require("@rosetta/audio/aiff") end, @@ -418,6 +455,7 @@ local list: { Entry } = { mime = { "audio/ape", "audio/x-ape", "audio/x-monkeys-audio" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Ape" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, float = true, depths = { 8, 16, 24, 32 } }, + sniff = 0, load = function() return require("@rosetta/audio/ape") end, @@ -430,6 +468,7 @@ local list: { Entry } = { mime = { "audio/basic", "audio/x-au" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, lossy = false }, + sniff = 0, load = function() return require("@rosetta/audio/au") end, @@ -442,6 +481,8 @@ local list: { Entry } = { mime = { "audio/x-brstm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = false, streaming = true, lossy = true, loops = true, containers = { "RSTM", "CSTM", "FSTM" } }, + sniff = 0, + variant = true, load = function() return require("@rosetta/audio/brstm") end, @@ -454,6 +495,7 @@ local list: { Entry } = { mime = { "audio/x-caf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Aac", "codecs/audio/Adpcm/Decoder", "codecs/audio/Alac", "codecs/audio/Pcm", "codecs/audio/Stream", "containers/Chunks" }, caps = { decode = true, encode = true, codecs = { "pcm", "alac", "aac", "ulaw", "alaw" }, encodeCodecs = { "pcm", "alac" }, tags = true, streaming = true }, + sniff = 0, load = function() return require("@rosetta/audio/caf") end, @@ -466,6 +508,7 @@ local list: { Entry } = { mime = { "audio/flac", "audio/x-flac" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/audio/Pcm", "codecs/audio/VorbisComment", "codecs/audio/Flac/Frame", "codecs/audio/Flac/Encode" }, caps = { decode = true, encode = true, streaming = true, depths = { 4, 8, 12, 16, 20, 24, 32 }, ogg = true, seek = true }, + sniff = 0, load = function() return require("@rosetta/audio/flac") end, @@ -478,6 +521,7 @@ local list: { Entry } = { mime = { "audio/mp4", "audio/x-m4a", "audio/m4a" }, deps = { "core/Err", "core/Bytes", "Types", "containers/IsoBmff", "codecs/audio/Aac", "codecs/audio/Alac", "codecs/audio/Pcm", "codecs/audio/Stream" }, caps = { decode = true, encode = true, codecs = { "aac", "alac" }, encodeCodecs = { "alac" }, tags = true, streaming = true }, + sniff = 1, load = function() return require("@rosetta/audio/m4a") end, @@ -490,6 +534,7 @@ local list: { Entry } = { mime = { "audio/mpeg", "audio/mp3", "audio/mpa" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Resample", "codecs/audio/Mpa/Header", "codecs/audio/Mpa/Core", "codecs/audio/Mpa/Encode3", "codecs/audio/Mpa/Encode2" }, caps = { decode = true, encode = true, streaming = true, seek = true, layers = { 1, 2, 3 }, encodeLayers = { 2, 3 }, channels = 2 }, + sniff = 1, load = function() return require("@rosetta/audio/mp3") end, @@ -502,6 +547,7 @@ local list: { Entry } = { mime = { "audio/x-musepack", "audio/musepack" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Musepack" }, caps = { decode = true, encode = false, codecs = { "musepack" }, versions = { 7, 8 }, streaming = true, lossy = true }, + sniff = 1, load = function() return require("@rosetta/audio/mpc") end, @@ -514,6 +560,7 @@ local list: { Entry } = { mime = { "audio/opus", "audio/ogg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/entropy/RangeCoder/Decoder", "codecs/audio/Pcm", "codecs/audio/Resample", "codecs/audio/VorbisComment", "codecs/audio/Opus/CeltEncoder", "codecs/audio/Opus/Decoder", "codecs/audio/Opus/Packet", "codecs/audio/Opus/Celt", "codecs/audio/Opus/Silk" }, caps = { decode = true, encode = true, streaming = true, seek = true, lossy = true, channels = 255, rates = { 48000 }, encodeModes = { "celt" }, encodeChannels = 2 }, + sniff = 0, load = function() return require("@rosetta/audio/opus") end, @@ -526,6 +573,7 @@ local list: { Entry } = { mime = { "audio/qoa" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/Qoa" }, caps = { decode = true, encode = true, streaming = true, lossy = true, seek = true, channels = 8 }, + sniff = 0, load = function() return require("@rosetta/audio/qoa") end, @@ -538,6 +586,7 @@ local list: { Entry } = { mime = { "audio/x-tta", "audio/tta" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Tta" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, depths = { 8, 16, 24 } }, + sniff = 0, load = function() return require("@rosetta/audio/tta") end, @@ -550,6 +599,7 @@ local list: { Entry } = { mime = { "audio/x-vag" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, loops = true, channels = 2 }, + sniff = 0, load = function() return require("@rosetta/audio/vag") end, @@ -562,6 +612,7 @@ local list: { Entry } = { mime = { "audio/x-voc" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16 }, lossy = false }, + sniff = 0, load = function() return require("@rosetta/audio/voc") end, @@ -574,6 +625,7 @@ local list: { Entry } = { mime = { "audio/ogg", "audio/vorbis" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/audio/Mdct", "codecs/audio/Pcm", "codecs/audio/VorbisComment", "codecs/audio/Vorbis/Tables", "codecs/audio/Vorbis/Setup", "codecs/audio/Vorbis/Packet" }, caps = { decode = true, encode = true, streaming = true, seek = true, lossy = true, channels = 255 }, + sniff = 0, load = function() return require("@rosetta/audio/vorbis") end, @@ -586,6 +638,7 @@ local list: { Entry } = { mime = { "audio/wav", "audio/x-wav", "audio/wave", "audio/vnd.wave" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Riff", "codecs/audio/Pcm", "codecs/audio/Adpcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, rf64 = true }, + sniff = 1, load = function() return require("@rosetta/audio/wav") end, @@ -598,6 +651,7 @@ local list: { Entry } = { mime = { "audio/x-wavpack", "audio/wavpack" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/WavPack" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, hybrid = true, float = true, depths = { 8, 12, 16, 20, 24, 32 } }, + sniff = 0, load = function() return require("@rosetta/audio/wavpack") end, @@ -610,6 +664,7 @@ local list: { Entry } = { mime = { "video/x-msvideo", "video/avi" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Avi", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, video = { "mjpeg", "mpeg1", "mpeg2", "rawvideo" }, audio = true, odml = true }, + sniff = 0, load = function() return require("@rosetta/video/avi") end, @@ -622,6 +677,7 @@ local list: { Entry } = { mime = { "video/x-fli", "video/fli", "video/x-flc" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "flic" }, depths = { 8, 15, 16, 24 } }, + sniff = 0, load = function() return require("@rosetta/video/fli") end, @@ -634,6 +690,7 @@ local list: { Entry } = { mime = { "video/x-flv", "video/flv" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source", "codecs/video/H263", "codecs/video/H264", "codecs/audio/Aac" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "flv1", "h264" }, audio = true, metadata = true }, + sniff = 0, load = function() return require("@rosetta/video/flv") end, @@ -646,6 +703,7 @@ local list: { Entry } = { mime = { "video/h264" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source", "codecs/video/H264" }, caps = { decode = true, encode = true, streaming = true, video = { "h264" }, depths = { 8 } }, + sniff = 0, load = function() return require("@rosetta/video/h264") end, @@ -658,6 +716,8 @@ local list: { Entry } = { mime = { "video/x-matroska", "video/webm", "audio/x-matroska", "audio/webm" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ebml", "containers/Demux", "containers/Avi", "containers/IsoBmff/QtPalette", "codecs/compress/Deflate", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "vp8", "mjpeg", "mpeg1", "mpeg2", "theora", "rawvideo" }, audio = true, subtitles = true }, + sniff = 0, + variant = true, load = function() return require("@rosetta/video/mkv") end, @@ -670,6 +730,7 @@ local list: { Entry } = { mime = { "video/mp4", "video/quicktime", "video/3gpp" }, deps = { "core/Err", "core/Bytes", "Types", "containers/IsoBmff", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "mjpeg", "mpeg1", "mpeg2", "h264" }, audio = true, fragments = true }, + sniff = 1, load = function() return require("@rosetta/video/mp4") end, @@ -682,6 +743,7 @@ local list: { Entry } = { mime = { "video/mpeg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/MpegPs", "containers/MpegEs", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "mpeg1", "mpeg2" }, audio = true }, + sniff = 0, load = function() return require("@rosetta/video/mpegps") end, @@ -694,6 +756,7 @@ local list: { Entry } = { mime = { "video/mp2t" }, deps = { "core/Err", "core/Bytes", "Types", "containers/MpegTs", "containers/MpegEs", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "mpeg1", "mpeg2", "h264" }, audio = true }, + sniff = 0, load = function() return require("@rosetta/video/mpegts") end, @@ -706,6 +769,7 @@ local list: { Entry } = { mime = { "video/ogg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "containers/Demux", "containers/AudioWrap", "codecs/video/Theora", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "theora" }, audio = true }, + sniff = 0, load = function() return require("@rosetta/video/ogv") end, @@ -718,6 +782,7 @@ local list: { Entry } = { mime = { "video/vnd.radgamettools.smacker" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/audio/Stream", "codecs/video/Legacy/Smacker" }, caps = { decode = true, encode = false, streaming = true, video = { "smackvid" }, audio = { "smackaudio", "pcm_u8", "pcm_s16le" } }, + sniff = 0, load = function() return require("@rosetta/video/smk") end, @@ -730,6 +795,7 @@ local list: { Entry } = { mime = { "video/x-yuv4mpeg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, video = { "rawvideo" }, depths = { 8, 10, 12, 16 } }, + sniff = 0, load = function() return require("@rosetta/video/y4m") end, @@ -742,6 +808,7 @@ local list: { Entry } = { mime = { "application/x-3ds", "image/x-3ds" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Sampler" }, caps = { decode = true, encode = true, materials = true, textures = true, animation = true, cameras = true, lights = true, instancing = true }, + sniff = 0, load = function() return require("@rosetta/model/3ds") end, @@ -754,6 +821,7 @@ local list: { Entry } = { mime = { "model/3mf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "containers/Zip" }, caps = { decode = true, encode = true, materials = true, vertexColors = true, textures = true, units = true }, + sniff = 0, load = function() return require("@rosetta/model/3mf") end, @@ -766,6 +834,7 @@ local list: { Entry } = { mime = { "model/x-ase", "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text", "codecs/model/Mat4" }, caps = { decode = true, encode = true, text = true, materials = true, cameras = true, lights = true, vertexColors = true }, + sniff = 1, load = function() return require("@rosetta/model/ase") end, @@ -778,6 +847,7 @@ local list: { Entry } = { mime = { "model/x-b3d" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/model/Mat4" }, caps = { decode = true, encode = false, materials = true, textures = true, skins = true, animation = true, colors = true }, + sniff = 0, load = function() return require("@rosetta/model/b3d") end, @@ -790,6 +860,7 @@ local list: { Entry } = { mime = { "application/x-blender" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Blend", "codecs/compress/Deflate", "codecs/compress/Zstd", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/Polygon" }, caps = { decode = true, encode = false, materials = true, textures = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, polygons = true, compressed = true }, + sniff = 1, load = function() return require("@rosetta/model/blend") end, @@ -802,6 +873,7 @@ local list: { Entry } = { mime = { "model/x-bsp" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex", "codecs/model/Patch" }, caps = { decode = true, encode = false, variants = { "quake", "bsp2", "2psb", "halflife", "quake2", "quake3" }, lightmaps = true, collision = true, visibility = true }, + sniff = 0, load = function() return require("@rosetta/model/bsp") end, @@ -814,6 +886,7 @@ local list: { Entry } = { mime = { "application/x-build-map" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Polygon" }, caps = { decode = true, encode = true, sprites = true, slopes = true }, + sniff = 0, load = function() return require("@rosetta/model/buildmap") end, @@ -826,6 +899,7 @@ local list: { Entry } = { mime = { "text/x-doom3-map" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Brush", "codecs/model/Patch", "codecs/model/Mat4", "codecs/text/Lexer" }, caps = { decode = true, encode = false, patches = true, variants = { "doom3", "quake4" } }, + sniff = 0, load = function() return require("@rosetta/model/d3map") end, @@ -838,6 +912,7 @@ local list: { Entry } = { mime = { "model/vnd.collada+xml", "model/vnd.collada+zip" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "core/Base64", "containers/Zip", "codecs/model/Mat4" }, caps = { decode = true, encode = true, materials = true, polygons = true, skins = true, morphTargets = true, animation = true, cameras = true, lights = true, zae = true }, + sniff = 0, load = function() return require("@rosetta/model/dae") end, @@ -850,6 +925,7 @@ local list: { Entry } = { mime = { "application/vnd.autodesk.fbx", "model/fbx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "core/Base64", "codecs/model/Mat4" }, caps = { decode = true, encode = true, binary = true, ascii = true, materials = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, polygons = true }, + sniff = 2, load = function() return require("@rosetta/model/fbx") end, @@ -862,6 +938,7 @@ local list: { Entry } = { mime = { "model/gltf+json", "model/gltf-binary" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Base64", "core/Sniff", "codecs/model/Draco" }, caps = { decode = true, encode = true, binary = true, materials = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, draco = true }, + sniff = 0, load = function() return require("@rosetta/model/gltf") end, @@ -874,6 +951,7 @@ local list: { Entry } = { mime = { "application/x-godot-scene" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/GodotVariant", "codecs/model/Mat4" }, caps = { decode = true, encode = true, text = true, materials = true, cameras = true, lights = true, instances = true }, + sniff = 0, load = function() return require("@rosetta/model/godot") end, @@ -886,6 +964,7 @@ local list: { Entry } = { mime = { "model/x-iqm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/Sampler" }, caps = { decode = true, encode = true, materials = true, skins = true, animation = true, vertexColors = true }, + sniff = 0, load = function() return require("@rosetta/model/iqm") end, @@ -898,6 +977,7 @@ local list: { Entry } = { mime = { "application/x-ldraw", "application/x-multi-part-ldraw" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = false, materials = true, lines = true, instancing = true }, + sniff = 0, load = function() return require("@rosetta/model/ldraw") end, @@ -910,6 +990,7 @@ local list: { Entry } = { mime = { "image/x-lwo", "model/x-lwo" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks" }, caps = { decode = true, encode = false, materials = true, polygons = true, vertexColors = true, morphTargets = true }, + sniff = 0, load = function() return require("@rosetta/model/lwo") end, @@ -922,6 +1003,7 @@ local list: { Entry } = { mime = { "text/x-quake-map" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Miptex", "codecs/model/Brush", "codecs/model/Patch" }, caps = { decode = true, encode = true, variants = { "quake", "valve220", "quake2", "quake3" }, patches = true }, + sniff = 0, load = function() return require("@rosetta/model/map") end, @@ -934,6 +1016,7 @@ local list: { Entry } = { mime = { "application/x-minecraft-region" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/text/Nbt", "codecs/model/Minecraft", "codecs/compress/Lz4" }, caps = { decode = true, encode = false, voxels = true, blocks = true }, + sniff = 0, load = function() return require("@rosetta/model/mca") end, @@ -946,6 +1029,7 @@ local list: { Entry } = { mime = { "model/x-md2" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Rig" }, caps = { decode = true, encode = false, morph = true, animation = true }, + sniff = 0, load = function() return require("@rosetta/model/md2") end, @@ -958,6 +1042,7 @@ local list: { Entry } = { mime = { "model/x-md3" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Mat4", "codecs/model/Rig" }, caps = { decode = true, encode = false, morph = true, animation = true, tags = true }, + sniff = 0, load = function() return require("@rosetta/model/md3") end, @@ -970,6 +1055,7 @@ local list: { Entry } = { mime = { "model/x-md5mesh", "model/x-md5anim" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Sniff", "Types", "codecs/model/Rig" }, caps = { decode = true, encode = false, skins = true, animation = true }, + sniff = 0, load = function() return require("@rosetta/model/md5") end, @@ -982,6 +1068,7 @@ local list: { Entry } = { mime = { "model/x-mdl" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/SourceAnim" }, caps = { decode = true, encode = false, variants = { "quake", "halflife" }, morph = true, skins = true, animation = true }, + sniff = 0, load = function() return require("@rosetta/model/mdl") end, @@ -994,6 +1081,7 @@ local list: { Entry } = { mime = { "application/x-ms3d" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, materials = true, skins = true, animation = true }, + sniff = 1, load = function() return require("@rosetta/model/ms3d") end, @@ -1006,6 +1094,7 @@ local list: { Entry } = { mime = { "model/obj" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, materials = true, polygons = true, vertexColors = true }, + sniff = 0, load = function() return require("@rosetta/model/obj") end, @@ -1018,6 +1107,7 @@ local list: { Entry } = { mime = { "model/off", "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, polygons = true, points = true, colors = true, binary = false }, + sniff = 0, load = function() return require("@rosetta/model/off") end, @@ -1030,6 +1120,7 @@ local list: { Entry } = { mime = { "model/ply", "application/ply" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, ascii = true, binary = true, polygons = true, points = true, colors = true }, + sniff = 0, load = function() return require("@rosetta/model/ply") end, @@ -1042,6 +1133,7 @@ local list: { Entry } = { mime = { "model/x-pmx", "model/x-pmd" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text" }, caps = { decode = true, encode = false, materials = true, skins = true, morphTargets = true, pmd = true }, + sniff = 0, load = function() return require("@rosetta/model/pmx") end, @@ -1054,6 +1146,7 @@ local list: { Entry } = { mime = { "model/x-doom3-proc" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Lexer" }, caps = { decode = true, encode = false, portals = true }, + sniff = 0, load = function() return require("@rosetta/model/proc") end, @@ -1066,6 +1159,7 @@ local list: { Entry } = { mime = { "model/x-qubicle" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, voxels = true, truecolor = true }, + sniff = 0, load = function() return require("@rosetta/model/qb") end, @@ -1078,6 +1172,8 @@ local list: { Entry } = { mime = { "application/x-roblox-rbxm", "application/x-roblox-rbxl" }, deps = { "core/Err", "core/Bytes", "core/Md5", "codecs/compress/Lz4", "codecs/compress/Zstd", "codecs/model/Rbx", "codecs/model/Rbx/Binary" }, caps = { decode = true, encode = true, tree = true, compression = { "none", "lz4", "zstd" } }, + sniff = 0, + variant = true, load = function() return require("@rosetta/model/rbxm") end, @@ -1090,6 +1186,8 @@ local list: { Entry } = { mime = { "application/x-roblox-rbxmx", "application/x-roblox-rbxlx" }, deps = { "core/Err", "core/Bytes", "core/Base64", "core/Md5", "codecs/text/Xml", "codecs/model/Rbx" }, caps = { decode = true, encode = true, tree = true }, + sniff = 0, + variant = true, load = function() return require("@rosetta/model/rbxmx") end, @@ -1102,6 +1200,7 @@ local list: { Entry } = { mime = { "application/x-roblox-mesh" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Draco" }, caps = { decode = true, encode = true, skinning = true, lods = true, versions = { "1.00", "1.01", "2.00", "3.00", "3.01", "4.00", "4.01", "5.00", "6.00", "7.00" } }, + sniff = 0, load = function() return require("@rosetta/model/robloxmesh") end, @@ -1114,6 +1213,8 @@ local list: { Entry } = { mime = { "application/x-minecraft-schematic" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Nbt", "codecs/model/Minecraft" }, caps = { decode = true, encode = true, voxels = true, blocks = true, variants = { "schem", "schematic", "litematic" } }, + sniff = 1, + variant = true, load = function() return require("@rosetta/model/schematic") end, @@ -1126,6 +1227,7 @@ local list: { Entry } = { mime = { "model/x-smd", "text/plain" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Rig" }, caps = { decode = true, encode = true, skins = true, animation = true }, + sniff = 0, load = function() return require("@rosetta/model/smd") end, @@ -1138,6 +1240,7 @@ local list: { Entry } = { mime = { "model/x-source-mdl" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Half", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/SourceAnim", "codecs/text/KeyValues" }, caps = { decode = true, encode = false, skins = true, morph = true, animation = true, lods = true }, + sniff = 0, load = function() return require("@rosetta/model/sourcemdl") end, @@ -1150,6 +1253,7 @@ local list: { Entry } = { mime = { "model/stl", "application/sla" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, ascii = true, binary = true, colors = true, indexed = false }, + sniff = 0, load = function() return require("@rosetta/model/stl") end, @@ -1162,6 +1266,7 @@ local list: { Entry } = { mime = { "text/x-unreal-t3d" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Text", "codecs/model/Brush" }, caps = { decode = true, encode = false, text = true, brushes = true, actors = true }, + sniff = 0, load = function() return require("@rosetta/model/t3d") end, @@ -1174,6 +1279,7 @@ local list: { Entry } = { mime = { "text/x-udmf" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/DoomMap" }, caps = { decode = true, encode = false, maps = true }, + sniff = 0, load = function() return require("@rosetta/model/udmf") end, @@ -1186,6 +1292,7 @@ local list: { Entry } = { mime = { "model/vnd.usda", "model/vnd.usdz+zip" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip", "codecs/model/Mat4" }, caps = { decode = true, encode = true, materials = true, animation = true, cameras = true, lights = true, polygons = true, vertexColors = true, usdz = "read", usdc = false }, + sniff = 0, load = function() return require("@rosetta/model/usda") end, @@ -1198,6 +1305,7 @@ local list: { Entry } = { mime = { "model/x-vbsp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Lzma", "codecs/text/KeyValues", "codecs/model/Mat4", "codecs/model/Displacement", "containers/Zip", "containers/Archive" }, caps = { decode = true, encode = false, versions = { 19, 20, 21 }, displacements = true, staticProps = true, pak = true }, + sniff = 0, load = function() return require("@rosetta/model/vbsp") end, @@ -1210,6 +1318,7 @@ local list: { Entry } = { mime = { "model/x-vmf" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Sniff", "Types", "codecs/text/KeyValues", "codecs/model/Brush", "codecs/model/Displacement", "codecs/model/Mat4" }, caps = { decode = true, encode = true, displacements = true, roundTrip = true }, + sniff = 0, load = function() return require("@rosetta/model/vmf") end, @@ -1222,6 +1331,7 @@ local list: { Entry } = { mime = { "model/x-vox" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, voxels = true, sceneGraph = true, materials = true }, + sniff = 0, load = function() return require("@rosetta/model/vox") end, @@ -1234,6 +1344,7 @@ local list: { Entry } = { mime = { "model/vrml", "x-world/x-vrml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Vrml" }, caps = { decode = true, encode = true, materials = true, polygons = true, animation = true, cameras = true, lights = true, lines = true, points = true }, + sniff = 0, load = function() return require("@rosetta/model/vrml") end, @@ -1246,6 +1357,7 @@ local list: { Entry } = { mime = { "model/x-directx", "text/x-directx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/model/Mat4", "codecs/model/Rig" }, caps = { decode = true, encode = false, text = true, binary = true, compressed = true, materials = true, skins = true, animation = true, polygons = true, vertexColors = true }, + sniff = 0, load = function() return require("@rosetta/model/x") end, @@ -1258,6 +1370,7 @@ local list: { Entry } = { mime = { "model/x3d+xml", "model/x3d-vrml", "model/x3d+fastinfoset" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Vrml" }, caps = { decode = true, encode = true, materials = true, polygons = true, animation = true, cameras = true, lights = true, lines = true, points = true, xml = true, classic = true }, + sniff = 0, load = function() return require("@rosetta/model/x3d") end, @@ -1270,6 +1383,7 @@ local list: { Entry } = { mime = { "model/step", "application/step", "application/p21" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, complexEntities = true, sections = true, brep = "plugin", tessellate = "plugin" }, + sniff = 0, load = function() return require("@rosetta/cad/step") end, @@ -1282,6 +1396,7 @@ local list: { Entry } = { mime = { "application/x-font-bdf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = true, bitmap = true }, + sniff = 0, load = function() return require("@rosetta/font/bdf") end, @@ -1294,6 +1409,7 @@ local list: { Entry } = { mime = { "application/x-bmfont" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, bitmap = true, variants = { "text", "xml", "binary" }, extraFiles = true }, + sniff = 0, load = function() return require("@rosetta/font/bmfont") end, @@ -1306,6 +1422,7 @@ local list: { Entry } = { mime = { "application/vnd.ms-fontobject" }, deps = { "core/Err", "core/Bytes", "codecs/text/Text", "codecs/font/TrueType" }, caps = { decode = true, encode = true, variants = { "1.0", "2.1", "2.2" } }, + sniff = 0, load = function() return require("@rosetta/font/eot") end, @@ -1318,6 +1435,7 @@ local list: { Entry } = { mime = { "application/x-font-fnt" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text", "codecs/font/Bitmap" }, caps = { decode = true, encode = false, bitmap = true, variants = { "fnt2", "fnt3", "ne", "pe" } }, + sniff = 0, load = function() return require("@rosetta/font/fon") end, @@ -1330,6 +1448,7 @@ local list: { Entry } = { mime = { "application/x-hershey-font" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Raster" }, caps = { decode = true, encode = false, strokes = true }, + sniff = 0, load = function() return require("@rosetta/font/hershey") end, @@ -1342,6 +1461,7 @@ local list: { Entry } = { mime = { "application/x-font-pcf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = false, bitmap = true }, + sniff = 0, load = function() return require("@rosetta/font/pcf") end, @@ -1354,6 +1474,7 @@ local list: { Entry } = { mime = { "application/x-font-linux-psf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = true, bitmap = true, variants = { "psf1", "psf2" } }, + sniff = 0, load = function() return require("@rosetta/font/psf") end, @@ -1366,6 +1487,7 @@ local list: { Entry } = { mime = { "font/ttf", "font/otf", "font/collection" }, deps = { "core/Err", "core/Bytes", "codecs/font/TrueType" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" }, collection = true, kerning = true }, + sniff = 0, load = function() return require("@rosetta/font/ttf") end, @@ -1378,6 +1500,7 @@ local list: { Entry } = { mime = { "application/x-font-type1" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Raster", "codecs/font/GlyphNames" }, caps = { decode = true, encode = false, outlines = { "type1" }, variants = { "pfb", "pfa" } }, + sniff = 0, load = function() return require("@rosetta/font/type1") end, @@ -1390,6 +1513,7 @@ local list: { Entry } = { mime = { "font/woff" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/font/TrueType" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" } }, + sniff = 0, load = function() return require("@rosetta/font/woff") end, @@ -1402,6 +1526,7 @@ local list: { Entry } = { mime = { "font/woff2" }, deps = { "core/Err", "core/Bytes", "codecs/font/TrueType", "codecs/compress/Brotli" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" }, transforms = { "glyf", "loca", "hmtx" } }, + sniff = 0, load = function() return require("@rosetta/font/woff2") end, @@ -1414,6 +1539,7 @@ local list: { Entry } = { mime = { "application/x-7z-compressed" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "Types", "codecs/compress/Lzma", "codecs/compress/Deflate", "codecs/compress/Bzip2", "codecs/compress/Zstd", "containers/Archive", "codecs/text/Text" }, caps = { decode = true, encode = false, methods = { "copy", "lzma", "lzma2", "deflate", "bcj", "delta" }, encrypted = false }, + sniff = 0, load = function() return require("@rosetta/archive/7z") end, @@ -1426,6 +1552,7 @@ local list: { Entry } = { mime = { "application/x-amiga-disk-format" }, deps = { "core/Err", "core/Bytes", "containers/Archive" }, caps = { decode = true, encode = false, variants = { "ofs", "ffs" } }, + sniff = 0, load = function() return require("@rosetta/archive/adf") end, @@ -1438,6 +1565,7 @@ local list: { Entry } = { mime = { "application/applefile", "multipart/appledouble" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true, variants = { "applesingle", "appledouble" } }, + sniff = 0, load = function() return require("@rosetta/archive/applesingle") end, @@ -1450,6 +1578,7 @@ local list: { Entry } = { mime = { "application/x-archive", "application/vnd.debian.binary-package" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzma", "codecs/compress/Zstd", "codecs/compress/Bzip2", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, variants = { "gnu", "bsd" }, deb = true }, + sniff = 0, load = function() return require("@rosetta/archive/ar") end, @@ -1462,6 +1591,7 @@ local list: { Entry } = { mime = { "application/x-arj" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = false, methods = { "store", "arj1", "arj2", "arj3", "arj4" } }, + sniff = 0, load = function() return require("@rosetta/archive/arj") end, @@ -1474,6 +1604,7 @@ local list: { Entry } = { mime = { "application/mac-binhex40" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true }, + sniff = 0, load = function() return require("@rosetta/archive/binhex") end, @@ -1486,6 +1617,7 @@ local list: { Entry } = { mime = { "application/x-brotli" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Brotli", "containers/Archive" }, caps = { decode = true, encode = false, stream = true }, + sniff = 1, load = function() return require("@rosetta/archive/br") end, @@ -1498,6 +1630,7 @@ local list: { Entry } = { mime = { "application/x-bzip2" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "codecs/compress/Bzip2" }, caps = { decode = true, encode = false, stream = true }, + sniff = 0, load = function() return require("@rosetta/archive/bz2") end, @@ -1510,6 +1643,7 @@ local list: { Entry } = { mime = { "application/vnd.ms-cab-compressed" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzx", "codecs/compress/Quantum", "containers/Archive" }, caps = { decode = true, encode = true, methods = { "store", "mszip", "lzx", "quantum" } }, + sniff = 0, load = function() return require("@rosetta/archive/cab") end, @@ -1522,6 +1656,7 @@ local list: { Entry } = { mime = { "application/x-cpio" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Cpio" }, caps = { decode = true, encode = true, variants = { "newc", "crc", "odc", "bin" } }, + sniff = 0, load = function() return require("@rosetta/archive/cpio") end, @@ -1534,6 +1669,7 @@ local list: { Entry } = { mime = { "application/x-d64" }, deps = { "core/Err", "core/Bytes", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "d64", "d71", "d81" } }, + sniff = 0, load = function() return require("@rosetta/archive/d64") end, @@ -1546,6 +1682,7 @@ local list: { Entry } = { mime = { "application/x-fat-image" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Fat" }, caps = { decode = true, encode = true, variants = { "fat12", "fat16", "fat32" } }, + sniff = 1, load = function() return require("@rosetta/archive/fat") end, @@ -1558,6 +1695,7 @@ local list: { Entry } = { mime = { "application/x-build-grp" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "containers/Archive" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return require("@rosetta/archive/grp") end, @@ -1570,6 +1708,7 @@ local list: { Entry } = { mime = { "application/gzip" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Deflate", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, stream = true }, + sniff = 0, load = function() return require("@rosetta/archive/gzip") end, @@ -1582,6 +1721,7 @@ local list: { Entry } = { mime = { "application/x-iso9660-image" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Iso9660" }, caps = { decode = true, encode = false, extensions = { "joliet", "rockridge", "eltorito" } }, + sniff = 0, load = function() return require("@rosetta/archive/iso") end, @@ -1594,6 +1734,7 @@ local list: { Entry } = { mime = { "application/x-lzh-compressed" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = true, methods = { "lh0", "lh1", "lh4", "lh5", "lh6", "lh7", "lhx", "lzs", "lz5", "lz4", "lhd" } }, + sniff = 0, load = function() return require("@rosetta/archive/lha") end, @@ -1606,6 +1747,7 @@ local list: { Entry } = { mime = { "application/x-lz4" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Lz4", "codecs/compress/Xxh32", "containers/Archive" }, caps = { decode = true, encode = true, stream = true, legacy = true }, + sniff = 0, load = function() return require("@rosetta/archive/lz4") end, @@ -1618,6 +1760,7 @@ local list: { Entry } = { mime = { "application/x-macbinary" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true, variants = { "I", "II", "III" } }, + sniff = 0, load = function() return require("@rosetta/archive/macbinary") end, @@ -1630,6 +1773,7 @@ local list: { Entry } = { mime = { "application/x-mpq" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "codecs/compress/Deflate", "codecs/compress/Bzip2", "codecs/compress/Lzma", "codecs/compress/Explode" }, caps = { decode = true, encode = false, versions = { 1, 2, 3, 4 }, methods = { "zlib", "implode", "bzip2", "lzma", "sparse" }, encryption = true }, + sniff = 0, load = function() return require("@rosetta/archive/mpq") end, @@ -1642,6 +1786,7 @@ local list: { Entry } = { mime = { "application/x-pak" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "quake", "sin" } }, + sniff = 0, load = function() return require("@rosetta/archive/pak") end, @@ -1654,6 +1799,7 @@ local list: { Entry } = { mime = { "application/x-rpm" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzma", "codecs/compress/Zstd", "codecs/compress/Bzip2", "containers/Archive", "containers/Cpio" }, caps = { decode = true, encode = false, compressors = { "gzip", "bzip2", "xz", "lzma", "zstd" } }, + sniff = 0, load = function() return require("@rosetta/archive/rpm") end, @@ -1666,6 +1812,7 @@ local list: { Entry } = { mime = { "application/x-tar" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, variants = { "ustar", "pax", "gnu" } }, + sniff = 1, load = function() return require("@rosetta/archive/tar") end, @@ -1678,6 +1825,7 @@ local list: { Entry } = { mime = { "application/x-unitypackage" }, deps = { "core/Err", "core/Bytes", "core/Md5", "codecs/compress/Deflate", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true }, + sniff = 1, load = function() return require("@rosetta/archive/unitypackage") end, @@ -1690,6 +1838,7 @@ local list: { Entry } = { mime = { "text/x-uuencode" }, deps = { "core/Err", "core/Bytes", "core/Base64", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "uu", "xx", "base64" } }, + sniff = 0, load = function() return require("@rosetta/archive/uu") end, @@ -1702,6 +1851,7 @@ local list: { Entry } = { mime = { "application/x-vpk" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Crc32", "core/Md5", "containers/Archive" }, caps = { decode = true, encode = true, versions = { 1, 2 }, multipart = true }, + sniff = 0, load = function() return require("@rosetta/archive/vpk") end, @@ -1714,6 +1864,7 @@ local list: { Entry } = { mime = { "application/x-wolf3d-vswap" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Archive", "codecs/image/Pixels" }, caps = { decode = true, encode = false, images = true, sounds = true }, + sniff = 0, load = function() return require("@rosetta/archive/vswap") end, @@ -1726,6 +1877,7 @@ local list: { Entry } = { mime = { "application/x-doom" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Archive", "codecs/image/Pixels", "codecs/model/DoomMap" }, caps = { decode = true, encode = true, images = true, maps = true, variants = { "iwad", "pwad" } }, + sniff = 0, load = function() return require("@rosetta/archive/wad") end, @@ -1738,6 +1890,7 @@ local list: { Entry } = { mime = { "application/x-quake-wad" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "containers/Archive", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, images = true, variants = { "wad2", "wad3" } }, + sniff = 0, load = function() return require("@rosetta/archive/wad2") end, @@ -1750,6 +1903,7 @@ local list: { Entry } = { mime = { "application/x-xz", "application/x-lzma" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Lzma", "containers/Archive" }, caps = { decode = true, encode = false, stream = true, filters = { "lzma2", "lzma", "delta", "x86", "powerpc", "arm", "armthumb", "sparc", "arm64" } }, + sniff = 0, load = function() return require("@rosetta/archive/xz") end, @@ -1762,6 +1916,7 @@ local list: { Entry } = { mime = { "application/x-yenc" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "containers/Archive" }, caps = { decode = true, encode = true, multipart = true }, + sniff = 0, load = function() return require("@rosetta/archive/yenc") end, @@ -1774,6 +1929,7 @@ local list: { Entry } = { mime = { "application/x-compress" }, deps = { "core/Err", "core/Bytes", "codecs/compress/UnixCompress", "containers/Archive" }, caps = { decode = true, encode = true, stream = true, bits = { 9, 16 } }, + sniff = 0, load = function() return require("@rosetta/archive/z") end, @@ -1786,6 +1942,7 @@ local list: { Entry } = { mime = { "application/zip", "application/x-zip-compressed" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip" }, caps = { decode = true, encode = true, methods = { "store", "deflate" }, zip64 = true }, + sniff = 0, load = function() return require("@rosetta/archive/zip") end, @@ -1798,6 +1955,7 @@ local list: { Entry } = { mime = { "application/x-zoo" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "codecs/compress/Lzw", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = false, methods = { "store", "lzw", "lzh" } }, + sniff = 0, load = function() return require("@rosetta/archive/zoo") end, @@ -1810,6 +1968,7 @@ local list: { Entry } = { mime = { "application/zstd" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Zstd", "containers/Archive" }, caps = { decode = true, encode = false, stream = true }, + sniff = 1, load = function() return require("@rosetta/archive/zst") end, @@ -1822,6 +1981,7 @@ local list: { Entry } = { mime = { "application/cbor", "application/cbor-seq" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, binary = true, ordered = true, tags = true }, + sniff = 0, load = function() return require("@rosetta/data/cbor") end, @@ -1834,6 +1994,7 @@ local list: { Entry } = { mime = { "text/csv", "text/tab-separated-values" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, header = true }, + sniff = 0, load = function() return require("@rosetta/data/csv") end, @@ -1846,6 +2007,7 @@ local list: { Entry } = { mime = { "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, ordered = true }, + sniff = 0, load = function() return require("@rosetta/data/ini") end, @@ -1858,6 +2020,7 @@ local list: { Entry } = { mime = { "application/json", "application/x-ndjson" }, deps = { "core/Err", "core/Bytes", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, ordered = true, streaming = true }, + sniff = 0, load = function() return require("@rosetta/data/json") end, @@ -1870,6 +2033,7 @@ local list: { Entry } = { mime = { "application/msgpack", "application/x-msgpack" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, binary = true, ordered = true }, + sniff = 0, load = function() return require("@rosetta/data/msgpack") end, @@ -1882,6 +2046,7 @@ local list: { Entry } = { mime = { "application/x-minecraft-nbt" }, deps = { "core/Err", "core/Bytes", "codecs/text/Nbt" }, caps = { decode = true, encode = true, binary = true, ordered = true, typed = true }, + sniff = 1, load = function() return require("@rosetta/data/nbt") end, @@ -1894,6 +2059,7 @@ local list: { Entry } = { mime = { "application/x-plist", "application/x-bplist" }, deps = { "core/Err", "core/Bytes", "Types", "core/Base64", "codecs/text/Xml", "codecs/text/Json" }, caps = { decode = true, encode = true, binary = "read", ordered = true }, + sniff = 0, load = function() return require("@rosetta/data/plist") end, @@ -1906,6 +2072,7 @@ local list: { Entry } = { mime = { "text/x-quake3-shader" }, deps = { "core/Err", "core/Bytes" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return require("@rosetta/data/q3shader") end, @@ -1918,6 +2085,7 @@ local list: { Entry } = { mime = { "text/x-quake3-skin" }, deps = { "core/Err", "core/Bytes" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return require("@rosetta/data/q3skin") end, @@ -1930,6 +2098,7 @@ local list: { Entry } = { mime = { "text/x-minecraft-snbt" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "codecs/text/Nbt" }, caps = { decode = true, encode = true, ordered = true, typed = true }, + sniff = 0, load = function() return require("@rosetta/data/snbt") end, @@ -1942,6 +2111,7 @@ local list: { Entry } = { mime = { "application/toml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "codecs/text/Text" }, caps = { decode = true, encode = true, ordered = true, dates = true }, + sniff = 0, load = function() return require("@rosetta/data/toml") end, @@ -1954,6 +2124,7 @@ local list: { Entry } = { mime = { "application/x-godot-resource" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/GodotVariant" }, caps = { decode = true, encode = true, ordered = true }, + sniff = 0, load = function() return require("@rosetta/data/tres") end, @@ -1966,6 +2137,7 @@ local list: { Entry } = { mime = { "text/x-vdf" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "codecs/text/KeyValues" }, caps = { decode = true, encode = true, ordered = true, binary = true }, + sniff = 1, load = function() return require("@rosetta/data/vdf") end, @@ -1978,6 +2150,7 @@ local list: { Entry } = { mime = { "application/xml", "text/xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "core/Sniff" }, caps = { decode = true, encode = true, namespaces = true, streaming = true }, + sniff = 0, load = function() return require("@rosetta/data/xml") end, @@ -1990,6 +2163,7 @@ local list: { Entry } = { mime = { "application/yaml", "application/x-yaml", "text/yaml" }, deps = { "core/Err", "core/Bytes", "Types", "core/Base64", "codecs/text/Text" }, caps = { decode = true, encode = true, ordered = true, multiDocument = true, anchors = true }, + sniff = 0, load = function() return require("@rosetta/data/yaml") end, @@ -2002,6 +2176,7 @@ local list: { Entry } = { mime = { "application/x-wolf3d-gamemaps" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types" }, caps = { decode = true, encode = false, tilemap = true }, + sniff = 0, load = function() return require("@rosetta/vector/gamemaps") end, @@ -2014,6 +2189,7 @@ local list: { Entry } = { mime = { "application/x-ldtk+json" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Json" }, caps = { decode = true, encode = true, levels = true, worlds = true, intGrid = true, entities = true }, + sniff = 0, load = function() return require("@rosetta/vector/ldtk") end, @@ -2026,6 +2202,7 @@ local list: { Entry } = { mime = { "application/x-ogmo+json" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "core/Base64", "Types", "codecs/text/Json" }, caps = { decode = true, encode = true, projects = true, entities = true, decals = true }, + sniff = 0, load = function() return require("@rosetta/vector/ogmo") end, @@ -2038,6 +2215,7 @@ local list: { Entry } = { mime = { "image/svg+xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "codecs/image/Raster", "codecs/image/Blend", "core/Sniff" }, caps = { decode = true, encode = true, rasterize = true, text = false }, + sniff = 0, load = function() return require("@rosetta/vector/svg") end, @@ -2050,6 +2228,7 @@ local list: { Entry } = { mime = { "application/x-tiled-tmx", "application/x-tiled-tmj" }, deps = { "core/Err", "core/Bytes", "core/Base64", "Types", "codecs/text/Xml", "codecs/text/Json", "codecs/compress/Deflate", "core/Sniff" }, caps = { decode = true, encode = true, tilesets = true, infinite = true }, + sniff = 0, load = function() return require("@rosetta/vector/tiled") end, @@ -2062,6 +2241,7 @@ local list: { Entry } = { mime = { "image/x-aseprite" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate" }, caps = { decode = true, encode = true, layers = true, groups = true, animation = true, depths = { 8, 16, 32 } }, + sniff = 0, load = function() return require("@rosetta/layered/aseprite") end, @@ -2074,6 +2254,7 @@ local list: { Entry } = { mime = { "image/openraster" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip", "codecs/text/Xml", "codecs/image/Blend" }, caps = { decode = true, encode = true, layers = true, groups = true, depths = { 8 } }, + sniff = 0, load = function() return require("@rosetta/layered/ora") end, @@ -2086,6 +2267,7 @@ local list: { Entry } = { mime = { "image/vnd.adobe.photoshop" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Blend", "codecs/compress/Deflate", "codecs/compress/PackBits", "codecs/text/Text" }, caps = { decode = true, encode = true, layers = true, groups = true, depths = { 1, 8, 16, 32 } }, + sniff = 0, load = function() return require("@rosetta/layered/psd") end, @@ -2098,6 +2280,7 @@ local list: { Entry } = { mime = { "text/x-ssa", "text/x-ass" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = true }, + sniff = 0, load = function() return require("@rosetta/subtitle/ass") end, @@ -2110,6 +2293,7 @@ local list: { Entry } = { mime = { "application/x-subrip", "text/srt" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = false }, + sniff = 0, load = function() return require("@rosetta/subtitle/srt") end, @@ -2122,6 +2306,7 @@ local list: { Entry } = { mime = { "text/vtt" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = true }, + sniff = 0, load = function() return require("@rosetta/subtitle/vtt") end, @@ -2134,6 +2319,7 @@ local list: { Entry } = { mime = { "audio/x-669" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 8, 8 } }, + sniff = 0, load = function() return require("@rosetta/music/669") end, @@ -2146,6 +2332,7 @@ local list: { Entry } = { mime = { "audio/x-ahx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Hively" }, caps = { decode = true, encode = false, render = true, channels = { 4, 4 }, subsongs = true }, + sniff = 0, load = function() return require("@rosetta/music/ahx") end, @@ -2158,6 +2345,7 @@ local list: { Entry } = { mime = { "audio/x-far" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 16, 16 } }, + sniff = 0, load = function() return require("@rosetta/music/far") end, @@ -2170,6 +2358,7 @@ local list: { Entry } = { mime = { "audio/x-hmp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true, hmi = true }, + sniff = 0, load = function() return require("@rosetta/music/hmp") end, @@ -2182,6 +2371,7 @@ local list: { Entry } = { mime = { "audio/x-hvl" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Hively" }, caps = { decode = true, encode = false, render = true, channels = { 4, 16 }, subsongs = true }, + sniff = 0, load = function() return require("@rosetta/music/hvl") end, @@ -2194,6 +2384,7 @@ local list: { Entry } = { mime = { "audio/it", "audio/x-it" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, channels = { 1, 64 }, compressedSamples = true }, + sniff = 0, load = function() return require("@rosetta/music/it") end, @@ -2206,6 +2397,7 @@ local list: { Entry } = { mime = { "audio/x-med" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 64 } }, + sniff = 0, load = function() return require("@rosetta/music/med") end, @@ -2218,6 +2410,7 @@ local list: { Entry } = { mime = { "audio/midi", "audio/x-midi" }, deps = { "core/Err", "core/Bytes", "codecs/audio/MidiRender", "Types" }, caps = { decode = true, encode = true, formats = { 0, 1, 2 }, render = true, streaming = true, rmid = true }, + sniff = 0, load = function() return require("@rosetta/music/midi") end, @@ -2230,6 +2423,7 @@ local list: { Entry } = { mime = { "audio/x-mod", "audio/mod" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = true, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return require("@rosetta/music/mod") end, @@ -2242,6 +2436,7 @@ local list: { Entry } = { mime = { "audio/x-mtm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return require("@rosetta/music/mtm") end, @@ -2254,6 +2449,7 @@ local list: { Entry } = { mime = { "audio/x-mus" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true }, + sniff = 0, load = function() return require("@rosetta/music/mus") end, @@ -2266,6 +2462,7 @@ local list: { Entry } = { mime = { "audio/x-okt" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 4, 8 } }, + sniff = 0, load = function() return require("@rosetta/music/okt") end, @@ -2278,6 +2475,7 @@ local list: { Entry } = { mime = { "audio/x-ptm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return require("@rosetta/music/ptm") end, @@ -2290,6 +2488,7 @@ local list: { Entry } = { mime = { "audio/s3m", "audio/x-s3m" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return require("@rosetta/music/s3m") end, @@ -2302,6 +2501,7 @@ local list: { Entry } = { mime = { "audio/x-soundfont" }, deps = { "core/Err", "core/Bytes", "codecs/audio/SoundFont" }, caps = { decode = true, encode = false, sm24 = true, sf3 = false }, + sniff = 1, load = function() return require("@rosetta/music/sf2") end, @@ -2314,6 +2514,7 @@ local list: { Entry } = { mime = { "audio/x-stm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 4, 4 } }, + sniff = 0, load = function() return require("@rosetta/music/stm") end, @@ -2326,6 +2527,7 @@ local list: { Entry } = { mime = { "audio/x-ult" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return require("@rosetta/music/ult") end, @@ -2338,6 +2540,7 @@ local list: { Entry } = { mime = { "audio/x-umx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, container = true }, + sniff = 0, load = function() return require("@rosetta/music/umx") end, @@ -2350,6 +2553,7 @@ local list: { Entry } = { mime = { "audio/xm", "audio/x-xm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Adpcm" }, caps = { decode = true, encode = true, render = true, channels = { 1, 64 } }, + sniff = 0, load = function() return require("@rosetta/music/xm") end, @@ -2362,6 +2566,7 @@ local list: { Entry } = { mime = { "audio/x-xmidi" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true, songs = true }, + sniff = 0, load = function() return require("@rosetta/music/xmi") end, @@ -2374,6 +2579,7 @@ local list: { Entry } = { mime = { "audio/x-mpegurl", "audio/mpegurl", "application/vnd.apple.mpegurl", "application/x-mpegurl" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Text", "core/Sniff" }, caps = { decode = true, encode = true, hls = true }, + sniff = 0, load = function() return require("@rosetta/playlist/m3u") end, @@ -2386,6 +2592,7 @@ local list: { Entry } = { mime = { "audio/x-scpls", "audio/scpls" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Text", "core/Sniff" }, caps = { decode = true, encode = true }, + sniff = 1, load = function() return require("@rosetta/playlist/pls") end, @@ -2398,6 +2605,7 @@ local list: { Entry } = { mime = { "application/xspf+xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Xml" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return require("@rosetta/playlist/xspf") end, diff --git a/src/Rosetta/Sniffs.luau b/src/Rosetta/Sniffs.luau new file mode 100644 index 0000000..9df7fe1 --- /dev/null +++ b/src/Rosetta/Sniffs.luau @@ -0,0 +1,3384 @@ +--!strict +--!optimize 2 +-- Sniffs: GENERATED by tools/gen_registry.py from the format folders - do not edit. +-- Each format's sniff (format path -> sniff(r)), copied from its init.luau with the top-level locals and types it +-- reaches (tools/sniff_extract.py), so detection requires no format module. Requires outside core/ are proxies that +-- require on first use. Formats whose sniff needs their module (Registry sniff = 2) are not here. +local S: { [string]: (any) -> number } = {} + +local function lazy(load: () -> any): any + local proxy = {} + return setmetatable(proxy, { + __index = function(_, k: any): any + local m = load() + setmetatable(proxy, { __index = m }) + return m[k] + end, + }) +end + +do -- image/ani +local Bytes = require("@rosetta/core/Bytes") +S["image/ani"] = function(r: Bytes.Reader): number + return if r:peek(4) == "RIFF" and r:peek(4, 8) == "ACON" then 1 else 0 +end +end + +do -- image/art +local Bytes = require("@rosetta/core/Bytes") +local readu8, readu16, readu32, readi16 = buffer.readu8, buffer.readu16, buffer.readu32, buffer.readi16 +local function header(b: buffer, o: number, limit: number): (number?, number?, number?, number?, boolean?) + local p = o + local prefixed = false + if limit - p >= 8 and buffer.readstring(b, p, 8) == "BUILDART" then + p += 8 + prefixed = true + end + if limit - p < 16 or readu32(b, p) ~= 1 then + return nil, nil, nil, nil, nil + end + local first, last = readu32(b, p + 8), readu32(b, p + 12) + if last < first or last - first >= 65536 then + return nil, nil, nil, nil, nil + end + return p + 16, first, last, readu32(b, p + 4), prefixed +end +S["image/art"] = function(r: Bytes.Reader): number + local at, first, last = header(r.buf, r.base, r.limit) + if not at or not first or not last then + return 0 + end + local n = last - first + 1 + local p = at :: number + if r.limit - p < n * 8 then + return 0 + end + local total = 0 + for i = 0, n - 1 do + local w, h = readi16(r.buf, p + i * 2), readi16(r.buf, p + n * 2 + i * 2) + if w < 0 or h < 0 then + return 0 + end + total += w * h + end + local size = p + n * 8 + total - r.base + local have = r.limit - r.base + return if size == have then 0.9 elseif size < have and have - size < 4096 then 0.5 else 0 +end +end + +do -- image/blp +local Bytes = require("@rosetta/core/Bytes") +S["image/blp"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m == "BLP1" or m == "BLP2" then 1 elseif m == "BLP0" then 0.8 else 0 +end +end + +do -- image/bmp +local Bytes = require("@rosetta/core/Bytes") +S["image/bmp"] = function(r: Bytes.Reader): number + if r:peek(2) ~= "BM" then + return 0 + end + local n = r:peekU8(14) + math.max(r:peekU8(15), 0) * 256 + if r:peekU8(16) == 0 and r:peekU8(17) == 0 and (n == 12 or n == 16 or n == 40 or n == 52 or n == 56 or n == 64 or n == 108 or n == 124) then + return 0.9 + end + return 0.2 +end +end + +do -- image/dds +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +local MAGIC = "DDS " +S["image/dds"] = function(r: Bytes.Reader): number + return math.max(Sniff.magic(r, MAGIC .. "\124\0\0\0"), Sniff.magic(r, MAGIC, 0, 0.6)) +end +end + +do -- image/exr +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +local MAGIC = "\118\47\49\1" +S["image/exr"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- image/gif +local Bytes = require("@rosetta/core/Bytes") +S["image/gif"] = function(r: Bytes.Reader): number + local s = r:peek(6) + return if s == "GIF89a" or s == "GIF87a" then 1 else 0 +end +end + +do -- image/hdr +local Bytes = require("@rosetta/core/Bytes") +S["image/hdr"] = function(r: Bytes.Reader): number + local s = r:peek(10) + if s == "#?RADIANCE" then + return 1 + end + if string.sub(s, 1, 6) == "#?RGBE" then + return 1 + end + if string.sub(s, 1, 2) == "#?" and string.match(s, "^#%?%u") then + return 0.5 + end + return 0 +end +end + +do -- image/icns +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["image/icns"] = function(r: Bytes.Reader): number + return Sniff.magic(r, "icns") +end +end + +do -- image/ico +local Bytes = require("@rosetta/core/Bytes") +local readu8 = buffer.readu8 +S["image/ico"] = function(r: Bytes.Reader): number + if r:remaining() < 22 then + return 0 + end + local b, o = r.buf, r.pos + local typ = buffer.readu16(b, o + 2) + local count = buffer.readu16(b, o + 4) + if buffer.readu16(b, o) ~= 0 or (typ ~= 1 and typ ~= 2) or count == 0 then + return 0 + end + -- the first entry: reserved byte 0, a size and offset inside the file + local size, off = buffer.readu32(b, o + 14), buffer.readu32(b, o + 18) + if readu8(b, o + 9) ~= 0 or size == 0 or off < 6 + count * 16 then + return 0 + end + return 0.8 +end +end + +do -- image/ilbm +local Bytes = require("@rosetta/core/Bytes") +S["image/ilbm"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "FORM" then + return 0 + end + local t = r:peek(4, 8) + return if t == "ILBM" or t == "PBM " then 1 else 0 +end +end + +do -- image/jpeg +local Bytes = require("@rosetta/core/Bytes") +S["image/jpeg"] = function(r: Bytes.Reader): number + local s = r:peek(3) + return if s == "\255\216\255" then 1 else 0 +end +end + +do -- image/ktx +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +local ID1 = "\171KTX 11\187\r\n\26\n" +local ID2 = "\171KTX 20\187\r\n\26\n" +S["image/ktx"] = function(r: Bytes.Reader): number + return math.max(Sniff.magic(r, ID2), Sniff.magic(r, ID1)) +end +end + +do -- image/lmp +local Bytes = require("@rosetta/core/Bytes") +local function kindOf(r: Bytes.Reader): string? + local n = r:remaining() + if n == 768 then + return "palette" + elseif n == 16385 or n == 16384 then + return "colormap" + end + if n < 9 then + return nil + end + local w, h = buffer.readu32(r.buf, r.pos), buffer.readu32(r.buf, r.pos + 4) + if w > 0 and h > 0 and w <= 4096 and h <= 4096 and 8 + w * h == n then + return "qpic" + end + return nil +end +S["image/lmp"] = function(r: Bytes.Reader): number + local k = kindOf(r) + return if k == "qpic" then 0.3 elseif k then 0.05 else 0 +end +end + +do -- image/pcx +local Bytes = require("@rosetta/core/Bytes") +S["image/pcx"] = function(r: Bytes.Reader): number + if r:size() < 128 then + return 0 + end + local m, v, e, bpp = r:peekU8(0), r:peekU8(1), r:peekU8(2), r:peekU8(3) + if m ~= 10 or (v ~= 0 and v ~= 2 and v ~= 3 and v ~= 4 and v ~= 5) or e > 1 then + return 0 + end + return if bpp == 1 or bpp == 2 or bpp == 4 or bpp == 8 then 0.8 else 0 +end +end + +do -- image/png +local Bytes = require("@rosetta/core/Bytes") +local SIGNATURE = "\137PNG\r\n\26\n" +S["image/png"] = function(r: Bytes.Reader): number + return if r:peek(8) == SIGNATURE then 1 else 0 +end +end + +do -- image/pnm +local Bytes = require("@rosetta/core/Bytes") +S["image/pnm"] = function(r: Bytes.Reader): number + if r:remaining() < 3 then + return 0 + end + local a, b, c = r:peekU8(0), r:peekU8(1), r:peekU8(2) + if a ~= 80 then -- 'P' + return 0 + end + local ws = c == 32 or (c >= 9 and c <= 13) + if b >= 49 and b <= 55 and ws then -- P1..P7 + return 0.9 + end + if (b == 70 or b == 102) and ws then -- PF / Pf + return 0.9 + end + return 0 +end +end + +do -- image/qoi +local Bytes = require("@rosetta/core/Bytes") +S["image/qoi"] = function(r: Bytes.Reader): number + return if r:peek(4) == "qoif" then 1 else 0 +end +end + +do -- image/sgi +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["image/sgi"] = function(r: Bytes.Reader): number + if Sniff.magic(r, "\1\218") == 0 or r:size() < 512 then + return 0 + end + local st, bpc = r:peekU8(2), r:peekU8(3) + return if st <= 1 and (bpc == 1 or bpc == 2) then 1 else 0 +end +end + +do -- image/spr +local Bytes = require("@rosetta/core/Bytes") +S["image/spr"] = function(r: Bytes.Reader): number + if r:remaining() < 36 or r:peek(4) ~= "IDSP" then + return 0 + end + local v = buffer.readi32(r.buf, r.pos + 4) + return if v == 1 or v == 2 or v == 32 then 1 else 0.3 +end +end + +do -- image/sunras +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +local MAGIC = "\89\166\106\149" +S["image/sunras"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- image/tga +local Bytes = require("@rosetta/core/Bytes") +local TYPES = { [1] = true, [2] = true, [3] = true, [9] = true, [10] = true, [11] = true } +local FOOTER = "TRUEVISION-XFILE.\0" +local readu8 = buffer.readu8 +type Header = { + idLen: number, + cmapType: number, + imageType: number, + cmapFirst: number, + cmapLen: number, + cmapBits: number, + width: number, + height: number, + depth: number, + desc: number, +} +local function header(r: Bytes.Reader): Header? + if r.limit - r.base < 18 then + return nil + end + local b, o = r.buf, r.base + local function u16(q: number): number + return readu8(b, o + q) + readu8(b, o + q + 1) * 256 + end + local h: Header = { + idLen = readu8(b, o), + cmapType = readu8(b, o + 1), + imageType = readu8(b, o + 2), + cmapFirst = u16(3), + cmapLen = u16(5), + cmapBits = readu8(b, o + 7), + width = u16(12), + height = u16(14), + depth = readu8(b, o + 16), + desc = readu8(b, o + 17), + } + return h +end +local function implausible(h: Header): string? + local t = h.imageType + if not TYPES[t] then + return "image type " .. t + end + if h.cmapType > 1 then + return "colour map type " .. h.cmapType + end + local mapped = t == 1 or t == 9 + if mapped and (h.cmapType ~= 1 or (h.depth ~= 8 and h.depth ~= 16)) then + return "colour-mapped image without a colour map" + end + if h.cmapType == 1 and h.cmapLen > 0 and h.cmapBits ~= 15 and h.cmapBits ~= 16 and h.cmapBits ~= 24 and h.cmapBits ~= 32 then + return "colour map entry size " .. h.cmapBits + end + if (t == 2 or t == 10) and h.depth ~= 15 and h.depth ~= 16 and h.depth ~= 24 and h.depth ~= 32 then + return "pixel depth " .. h.depth + end + if (t == 3 or t == 11) and h.depth ~= 8 and h.depth ~= 16 then + return "grey pixel depth " .. h.depth + end + if h.width == 0 or h.height == 0 then + return "zero size" + end + if h.desc >= 64 then + return "interleaving / reserved descriptor bits" + end + return nil +end +S["image/tga"] = function(r: Bytes.Reader): number + local h = header(r) + if not h or implausible(h) then + return 0 + end + local n = r.limit - r.base + if n >= 44 and buffer.readstring(r.buf, r.limit - 18, 18) == FOOTER then + return 0.9 + end + return 0.2 +end +end + +do -- image/tiff +local Bytes = require("@rosetta/core/Bytes") +S["image/tiff"] = function(r: Bytes.Reader): number + local s = r:peek(4) + if s == "II*\0" or s == "MM\0*" or s == "II+\0" or s == "MM\0+" then + return 1 + end + return 0 +end +end + +do -- image/tim +local Bytes = require("@rosetta/core/Bytes") +S["image/tim"] = function(r: Bytes.Reader): number + if r:remaining() < 20 or r:peek(4) ~= "\16\0\0\0" then + return 0 + end + local flags = r:peekU8(4) + if flags > 0x0F or (flags % 8) > 3 or r:peek(3, 5) ~= "\0\0\0" then + return 0 + end + return 0.8 +end +end + +do -- image/vtf +local Bytes = require("@rosetta/core/Bytes") +S["image/vtf"] = function(r: Bytes.Reader): number + return if r:peek(4) == "VTF\0" and r:peekU8(4) == 7 then 1 else 0 +end +end + +do -- image/webp +local Bytes = require("@rosetta/core/Bytes") +S["image/webp"] = function(r: Bytes.Reader): number + if r:peek(4) == "RIFF" and r:peek(4, 8) == "WEBP" then + return 1 + end + return 0 +end +end + +do -- image/xbm +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["image/xbm"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 256, true) + if string.match(s, "^#define%s+[%w_]*_?width%s+%d+") or string.match(s, "^/%*.-%*/%s*#define%s+[%w_]*width%s+%d+") then + return 0.9 + end + return 0 +end +end + +do -- image/xpm +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["image/xpm"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 64, true) + if string.sub(s, 1, 9) == "/* XPM */" or string.sub(s, 1, 6) == "! XPM2" then + return 1 + end + return 0 +end +end + +do -- audio/aac +local Bytes = require("@rosetta/core/Bytes") +local Aac = lazy(function() + return require("@rosetta/codecs/audio/Aac") +end) +local readu8 = buffer.readu8 +local function id3Size(b: buffer, p: number, limit: number): number + if p + 10 > limit or buffer.readstring(b, p, 3) ~= "ID3" then + return 0 + end + local s = 0 + for i = 6, 9 do + s = s * 128 + bit32.band(readu8(b, p + i), 127) + end + local footer = if bit32.band(readu8(b, p + 5), 0x10) ~= 0 then 10 else 0 + return 10 + s + footer +end +S["audio/aac"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + p += id3Size(b, p, limit) + local h = Aac.adts(b, p, limit) + if not h then + return 0 + end + local h2 = Aac.adts(b, p + h.frameSize, limit) + if h2 and h2.sfIndex == h.sfIndex and h2.channelConfig == h.channelConfig then + return 0.9 + end + return if p + h.frameSize >= limit then 0.7 else 0.4 +end +end + +do -- audio/ac3 +local Bytes = require("@rosetta/core/Bytes") +local Ac3 = lazy(function() + return require("@rosetta/codecs/audio/Ac3") +end) +S["audio/ac3"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + local h = Ac3.header(b, p, limit) + if not h then + return 0 + end + local h2 = Ac3.header(b, p + h.frameSize, limit) + if h2 and h2.sampleRate == h.sampleRate then + return 0.9 + end + return if p + h.frameSize >= limit then 0.6 else 0.3 +end +end + +do -- audio/adpcm +local Bytes = require("@rosetta/core/Bytes") +S["audio/adpcm"] = function(_r: Bytes.Reader): number + return 0 +end +end + +do -- audio/adx +local Bytes = require("@rosetta/core/Bytes") +S["audio/adx"] = function(r: Bytes.Reader): number + if r:peekU8(0) ~= 0x80 or r:peekU8(1) ~= 0 then + return 0 + end + local off = r:peekU8(2) * 256 + r:peekU8(3) + return if r:peek(6, off - 2) == "(c)CRI" then 1 else 0 +end +end + +do -- audio/aiff +local Bytes = require("@rosetta/core/Bytes") +S["audio/aiff"] = function(r: Bytes.Reader): number + if r:remaining() < 12 or r:peek(4) ~= "FORM" then + return 0 + end + local form = buffer.readstring(r.buf, r.pos + 8, 4) + return if form == "AIFF" or form == "AIFC" then 1 else 0 +end +end + +do -- audio/ape +local Bytes = require("@rosetta/core/Bytes") +S["audio/ape"] = function(r: Bytes.Reader): number + local head = r:peek(4) + if head == "MAC " or head == "MACF" then -- MACF: float samples + return 1 + end + if string.sub(head, 1, 3) == "ID3" then + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + local id = r:peek(4, 10 + sz + (if footer then 10 else 0)) + return if id == "MAC " or id == "MACF" then 1 else 0 + end + return 0 +end +end + +do -- audio/au +local Bytes = require("@rosetta/core/Bytes") +S["audio/au"] = function(r: Bytes.Reader): number + return if r:peek(4) == ".snd" then 1 else 0 +end +end + +do -- audio/brstm +local Bytes = require("@rosetta/core/Bytes") +S["audio/brstm"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m ~= "RSTM" and m ~= "CSTM" and m ~= "FSTM" then + return 0 + end + local bom = r:peek(2, 4) + return if bom == "\254\255" or bom == "\255\254" then 1 else 0 +end +end + +do -- audio/caf +local Bytes = require("@rosetta/core/Bytes") +S["audio/caf"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h == 8 and string.sub(h, 1, 4) == "caff" and string.byte(h, 5) == 0 and string.byte(h, 6) == 1 then + return 1 + end + return 0 +end +end + +do -- audio/flac +local Bytes = require("@rosetta/core/Bytes") +S["audio/flac"] = function(r: Bytes.Reader): number + local head = r:peek(4) + if head == "fLaC" then + return 1 + end + if head == "OggS" then + -- the first page's packet: 0x7F "FLAC" (the Ogg FLAC mapping) + local nseg = r:peekU8(26) + if nseg > 0 and r:peek(5, 27 + nseg) == "\127FLAC" then + return 1 + end + return 0 + end + if string.sub(head, 1, 3) == "ID3" then + -- an ID3v2 tag, then fLaC (mp3 files start with ID3 too) + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + return if r:peek(4, 10 + sz + (if footer then 10 else 0)) == "fLaC" then 1 else 0 + end + return 0 +end +end + +do -- audio/m4a +local Bytes = require("@rosetta/core/Bytes") +local IsoBmff = lazy(function() + return require("@rosetta/containers/IsoBmff") +end) +local AUDIO_BRANDS: { [string]: number } = { ["M4A "] = 1, ["M4B "] = 1, ["M4P "] = 1, ["M4V "] = 0.3 } +S["audio/m4a"] = function(r: Bytes.Reader): number + local brand = IsoBmff.sniff(r) + if brand == nil then + return 0 + end + if AUDIO_BRANDS[brand] then + return AUDIO_BRANDS[brand] + end + if brand == "avif" or brand == "avis" or brand == "heic" or brand == "heix" or brand == "mif1" or brand == "msf1" or brand == "crx " then + return 0 + end + return 0.4 -- an MP4 / MOV that may hold audio; a video format claims it more strongly +end +end + +do -- audio/mp3 +local Bytes = require("@rosetta/core/Bytes") +local Header = lazy(function() + return require("@rosetta/codecs/audio/Mpa/Header") +end) +local Tags = lazy(function() + return require("@rosetta/audio/mp3/Tags") +end) +S["audio/mp3"] = function(r: Bytes.Reader): number + local b, p, lim = r.buf, r.pos, r.limit + local id3 = false + for _ = 1, 4 do -- (ffmpeg writes a tag even when the input had one: tags can follow each other) + local n = if p + 3 <= lim and buffer.readstring(b, p, 3) == "ID3" then Tags.id3v2Size(b, p, lim) else 0 + if n <= 0 then + break + end + id3 = true + p += n + end + if p + 4 > lim or not Header.valid(b, p) then + return if id3 then 0.5 else 0 + end + local fb = Header.frameBytes(b, p, 0) + if fb > 0 then + fb += Header.padding(b, p) + if p + fb + 4 <= lim and Header.compare(b, p, p + fb) then + return 0.9 + end + if p + fb == lim then + return 0.6 + end + end + return if id3 then 0.7 else 0.25 +end +end + +do -- audio/mpc +local Bytes = require("@rosetta/core/Bytes") +local Musepack = lazy(function() + return require("@rosetta/codecs/audio/Musepack") +end) +local function id3v2(b: buffer, p: number, limit: number): number + if p + 10 > limit or buffer.readstring(b, p, 3) ~= "ID3" then + return 0 + end + local n = 10 + for i = 6, 9 do + n += bit32.band(buffer.readu8(b, p + i), 127) * 128 ^ (9 - i) + end + return n + (if bit32.band(buffer.readu8(b, p + 5), 0x10) ~= 0 then 10 else 0) +end +S["audio/mpc"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + p += id3v2(b, p, limit) + local v = Musepack.magic(b, p, limit) + if v == 8 then + return 1 + end + return if v == 7 then 0.9 else 0 +end +end + +do -- audio/opus +local Bytes = require("@rosetta/core/Bytes") +S["audio/opus"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "OggS" then + return 0 + end + local nseg = r:peekU8(26) + if nseg < 1 then + return 0 + end + return if r:peek(8, 27 + nseg) == "OpusHead" then 1 else 0 +end +end + +do -- audio/qoa +local Bytes = require("@rosetta/core/Bytes") +S["audio/qoa"] = function(r: Bytes.Reader): number + return if r:peek(4) == "qoaf" then 1 else 0 +end +end + +do -- audio/tta +local Bytes = require("@rosetta/core/Bytes") +local function id3Size(r: Bytes.Reader): number + if r:peek(3) ~= "ID3" then + return 0 + end + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + return 10 + sz + (if footer then 10 else 0) +end +S["audio/tta"] = function(r: Bytes.Reader): number + return if r:peek(4, id3Size(r)) == "TTA1" then 1 else 0 +end +end + +do -- audio/vag +local Bytes = require("@rosetta/core/Bytes") +S["audio/vag"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m == "VAGp" or m == "VAGi" or m == "KVAG" then 1 else 0 +end +end + +do -- audio/voc +local Bytes = require("@rosetta/core/Bytes") +local MAGIC = "Creative Voice File\26" +S["audio/voc"] = function(r: Bytes.Reader): number + return if r:peek(20) == MAGIC then 1 else 0 +end +end + +do -- audio/vorbis +local Bytes = require("@rosetta/core/Bytes") +S["audio/vorbis"] = function(r: Bytes.Reader): number + if r:remaining() < 35 or r:peek(4) ~= "OggS" then + return 0 + end + local b, p = r.buf, r.pos + local nseg = buffer.readu8(b, p + 26) + local d = p + 27 + nseg + if d + 7 > r.limit then + return 0 + end + return if buffer.readu8(b, d) == 1 and buffer.readstring(b, d + 1, 6) == "vorbis" then 1 else 0 +end +end + +do -- audio/wav +local Bytes = require("@rosetta/core/Bytes") +local Riff = lazy(function() + return require("@rosetta/containers/Riff") +end) +S["audio/wav"] = function(r: Bytes.Reader): number + return if Riff.sniff(r) == "WAVE" then 1 else 0 +end +end + +do -- audio/wavpack +local Bytes = require("@rosetta/core/Bytes") +S["audio/wavpack"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "wvpk" then + return 0 + end + local v = r:peekU8(9) + return if v == 4 then 1 else 0.5 +end +end + +do -- video/avi +local Bytes = require("@rosetta/core/Bytes") +S["video/avi"] = function(r: Bytes.Reader): number + if r:peek(4) == "RIFF" and r:peek(4, 8) == "AVI " then + return 1 + end + return 0 +end +end + +do -- video/fli +local Bytes = require("@rosetta/core/Bytes") +local FLI, FLC, DTA = 0xAF11, 0xAF12, 0xAF44 +S["video/fli"] = function(r: Bytes.Reader): number + local s = r:peek(18) + if #s < 18 then + return 0 + end + local magic = string.byte(s, 5) + string.byte(s, 6) * 256 + if magic ~= FLI and magic ~= FLC and magic ~= DTA then + return 0 + end + local w = string.byte(s, 9) + string.byte(s, 10) * 256 + local h = string.byte(s, 11) + string.byte(s, 12) * 256 + if w > 4096 or h > 4096 then + return 0 + end + return 0.9 +end +end + +do -- video/flv +local Bytes = require("@rosetta/core/Bytes") +S["video/flv"] = function(r: Bytes.Reader): number + if r:remaining() >= 9 and r:peek(3) == "FLV" then + return if r:peekU8(3) == 1 then 1 else 0.6 + end + return 0 +end +end + +do -- video/h264 +local Bytes = require("@rosetta/core/Bytes") +S["video/h264"] = function(r: Bytes.Reader): number + local s = r:peek(5) + if not s or #s < 4 then + return 0 + end + local hdr + if string.byte(s, 1) == 0 and string.byte(s, 2) == 0 and string.byte(s, 3) == 1 then + hdr = string.byte(s, 4) + elseif #s >= 5 and string.byte(s, 1) == 0 and string.byte(s, 2) == 0 and string.byte(s, 3) == 0 and string.byte(s, 4) == 1 then + hdr = string.byte(s, 5) + else + return 0 + end + if hdr >= 128 then + return 0 + end + local t = hdr % 32 + if t == 7 then + return 0.8 + elseif t == 9 or t == 6 or t == 8 then + return 0.5 + elseif t == 5 then + return 0.4 + end + return 0 +end +end + +do -- video/mkv +local Bytes = require("@rosetta/core/Bytes") +S["video/mkv"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "\26\69\223\163" then + return 0 + end + local head = r:peek(math.min(64, r:remaining())) + if string.find(head, "webm", 1, true) or string.find(head, "matroska", 1, true) then + return 1 + end + return 0.5 +end +end + +do -- video/mp4 +local Bytes = require("@rosetta/core/Bytes") +local IsoBmff = lazy(function() + return require("@rosetta/containers/IsoBmff") +end) +local IMAGE_BRANDS = { avif = true, avis = true, heic = true, heix = true, mif1 = true, msf1 = true, ["crx "] = true } +local AUDIO_BRANDS = { ["M4A "] = true, ["M4B "] = true, ["M4P "] = true } +S["video/mp4"] = function(r: Bytes.Reader): number + local brand = IsoBmff.sniff(r) + if brand == nil or IMAGE_BRANDS[brand] then + return 0 + end + if AUDIO_BRANDS[brand] then + return 0.2 + end + if brand == "M4V " then + return 0.9 + end + return if brand == "" then 0.6 else 0.8 +end +end + +do -- video/mpegps +local Bytes = require("@rosetta/core/Bytes") +S["video/mpegps"] = function(r: Bytes.Reader): number + if r:peek(4) == "\0\0\1\186" then + return 0.9 + end + if r:peek(4) == "\0\0\1\179" then + return 0.5 -- an MPEG-1 / 2 video elementary stream (sequence header) + end + return 0 +end +end + +do -- video/mpegts +local Bytes = require("@rosetta/core/Bytes") +local SIZES = { 188, 192 } +local function packetSize(r: Bytes.Reader): (number, number) + local n = r:remaining() + local head = r:peek(2048 + 2 * 192) + local lim = math.min(n, 2048) + local start = 0 + while start < lim do + local f = string.find(head, "G", start + 1, true) -- 0x47 + if not f or f > lim then + break + end + start = f - 1 + for _, size in SIZES do + local hits, need = 0, math.min(3, (n - start - 1) // size + 1) + for k = 0, 2 do + local at = start + k * size + if at < n and string.byte(head, at + 1) == 0x47 then + hits += 1 + end + end + if hits >= need and (need >= 2 or start == 0) then + if size == 192 and start >= 4 then + return 192, start - 4 + elseif size == 188 then + return 188, start + end + end + end + start += 1 + end + return 0, 0 +end +S["video/mpegts"] = function(r: Bytes.Reader): number + local s, off = packetSize(r) + if s == 0 then + return 0 + end + if off > 0 then + return 0.6 + end + return if r:remaining() >= 3 * s then 0.9 else 0.5 +end +end + +do -- video/ogv +local Bytes = require("@rosetta/core/Bytes") +S["video/ogv"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "OggS" then + return 0 + end + local b, p, lim = r.buf, r.pos, r.limit + for _ = 1, 8 do + if p + 27 > lim or buffer.readstring(b, p, 4) ~= "OggS" or buffer.readu8(b, p + 5) % 4 < 2 then + return 0 + end + local nseg = buffer.readu8(b, p + 26) + local d = p + 27 + nseg + if d + 7 <= lim and buffer.readu8(b, d) == 0x80 and buffer.readstring(b, d + 1, 6) == "theora" then + return 1 + end + if d > lim then + return 0 + end + local size = 0 + for i = 0, nseg - 1 do + size += buffer.readu8(b, p + 27 + i) + end + p = d + size + end + return 0 +end +end + +do -- video/smk +local Bytes = require("@rosetta/core/Bytes") +S["video/smk"] = function(r: Bytes.Reader): number + local s = r:peek(4) + if s ~= "SMK2" and s ~= "SMK4" then + return 0 + end + return 1 +end +end + +do -- video/y4m +local Bytes = require("@rosetta/core/Bytes") +local MAGIC = "YUV4MPEG2 " +S["video/y4m"] = function(r: Bytes.Reader): number + return if r:peek(10) == MAGIC then 1 else 0 +end +end + +do -- model/3ds +local Bytes = require("@rosetta/core/Bytes") +S["model/3ds"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h < 8 or string.byte(h, 1) ~= 0x4D or string.byte(h, 2) ~= 0x4D then + return 0 + end + local b1, b2, b3, b4, c1, c2 = string.byte(h, 3, 8) + local size = b1 + b2 * 256 + b3 * 65536 + b4 * 16777216 + local child = c1 + c2 * 256 + if size < 16 or not (child == 0x0002 or child == 0x3D3D or child == 0xB000) then + return 0 + end + return if size == r.limit - r.pos then 0.95 else 0.7 +end +end + +do -- model/3mf +local Bytes = require("@rosetta/core/Bytes") +S["model/3mf"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "PK\3\4" then + return 0 + end + local n = r:size() + local tail = buffer.readstring(r.buf, r.base + math.max(0, n - 65536), math.min(n, 65536)) + if string.find(tail, "3D/[^/]*%.model") or string.find(tail, "3dmodel.model", 1, true) then + return 0.95 + end + local head = r:peek(256) + if string.find(head, "3D/", 1, true) then + return 0.7 + end + return 0 +end +end + +do -- model/ase +local Bytes = require("@rosetta/core/Bytes") +local Text = lazy(function() + return require("@rosetta/codecs/text/Text") +end) +local MAGIC = "*3DSMAX_ASCIIEXPORT" +local function utf16(r: Bytes.Reader): (boolean?, boolean) + local h = r:peek(2) + if h == "\255\254" then + return true, false + elseif h == "\254\255" then + return true, true + elseif #h == 2 and string.byte(h, 2) == 0 and string.byte(h, 1) == 42 then + return true, false + elseif #h == 2 and string.byte(h, 1) == 0 and string.byte(h, 2) == 42 then + return true, true + end + return nil, false +end +local function text(r: Bytes.Reader, n: number?): string + local wide, be = utf16(r) + local len = r.limit - r.pos + if n then + len = math.min(len, n) + end + if wide then + local skip = if r:peek(2) == "\255\254" or r:peek(2) == "\254\255" then 2 else 0 + return Text.utf16(r.buf, r.pos + skip, len - skip, be) + end + return Text.toUtf8(buffer.readstring(r.buf, r.pos, len)) +end +S["model/ase"] = function(r: Bytes.Reader): number + local h = string.match(text(r, 256), "^%s*(%*[%w_]+)") + if h == MAGIC then + return 1 + end + return 0 +end +end + +do -- model/b3d +local Bytes = require("@rosetta/core/Bytes") +S["model/b3d"] = function(r: Bytes.Reader): number + if r:peek(4) == "BB3D" then + return if r:peek(4, 8) ~= "" then 1 else 0.8 + end + return 0 +end +end + +do -- model/blend +local Bytes = require("@rosetta/core/Bytes") +local Deflate = lazy(function() + return require("@rosetta/codecs/compress/Deflate") +end) +local Zstd = lazy(function() + return require("@rosetta/codecs/compress/Zstd") +end) +S["model/blend"] = function(r: Bytes.Reader): number + local head = r:peek(7) + if head == "BLENDER" then + return 1 + end + local n = r.limit - r.base + if string.sub(head, 1, 3) == "\31\139\8" then + local inner = Deflate.peek(r.buf, r.base, n, 7) + return if inner and buffer.tostring(inner) == "BLENDER" then 1 else 0 + end + if string.sub(head, 1, 4) == Zstd.MAGIC then + if n > 4 * 2 ^ 20 then + return 0.5 + end + local out = Zstd.decompress(r.buf, r.base, n, { verify = false }) + return if out and buffer.len(out) >= 7 and buffer.readstring(out, 0, 7) == "BLENDER" then 1 else 0 + end + return 0 +end +end + +do -- model/bsp +local Bytes = require("@rosetta/core/Bytes") +S["model/bsp"] = function(r: Bytes.Reader): number + if r:remaining() < 64 then + return 0 + end + local m = r:peek(4) + local v = buffer.readi32(r.buf, r.pos + (if m == "IBSP" then 4 else 0)) + if m == "BSP2" or m == "2PSB" then + v = 29 + end + if m == "IBSP" then + return if v == 38 or v == 46 or v == 47 then 1 else 0.3 + end + if v == 29 or v == 30 then + local size = r:remaining() + for i = 0, 14 do + local o, n = buffer.readi32(r.buf, r.pos + 4 + i * 8), buffer.readi32(r.buf, r.pos + 8 + i * 8) + if o < 0 or n < 0 or o + n > size then + return 0 + end + end + return 0.6 + end + return 0 +end +end + +do -- model/buildmap +local Bytes = require("@rosetta/core/Bytes") +local SECTOR_SIZE, WALL_SIZE, SPRITE_SIZE = 40, 32, 44 +local HEADER = 22 -- version, posx, posy, posz, ang, cursectnum, then u16 numsectors at 20 +local readu16 = buffer.readu16 +local function layout(b: buffer, o: number, limit: number): (number?, number?, number?, number?) + if limit - o < HEADER then + return nil, nil, nil, nil + end + local ns = readu16(b, o + 20) + local p = o + HEADER + ns * SECTOR_SIZE + if p + 2 > limit then + return nil, nil, nil, nil + end + local nw = readu16(b, p) + p += 2 + nw * WALL_SIZE + if p + 2 > limit then + return nil, nil, nil, nil + end + local nsp = readu16(b, p) + p += 2 + nsp * SPRITE_SIZE + return ns, nw, nsp, p +end +S["model/buildmap"] = function(r: Bytes.Reader): number + local b, o, limit = r.buf, r.base, r.limit + if limit - o < HEADER then + return 0 + end + local v = buffer.readu32(b, o) + if v ~= 7 and v ~= 8 and v ~= 9 then + return 0 + end + local ns, _, _, stop = layout(b, o, limit) + if not ns or not stop or stop > limit then + return 0 + end + return if stop == limit then 0.9 else 0.5 +end +end + +do -- model/d3map +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/d3map"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + for _ = 1, 16 do + local rest = string.match(head, "^//[^\n]*\n%s*(.*)$") + if not rest then + break + end + head = rest + end + return if string.match(head, "^Version%s+[123]%s") then 1 else 0 +end +end + +do -- model/dae +local Bytes = require("@rosetta/core/Bytes") +S["model/dae"] = function(r: Bytes.Reader): number + local head = r:peek(2048) + if string.sub(head, 1, 4) == "PK\3\4" then + local nlen = string.byte(head, 27) or 0 + local name = string.lower(string.sub(head, 31, 30 + nlen)) + if string.find(name, "%.dae$") or name == "manifest.xml" then + return 0.95 + end + return 0 + end + -- UTF-16 files: drop the zero bytes + if string.find(string.sub(head, 1, 4), "\0", 1, true) then + head = string.gsub(head, "%z", "") + end + if string.find(head, " sectors then + return 0 + end + used += 1 + if used == 1 then + local p = r.base + off * 4096 + if p + 5 > r.limit then + return 0 + end + local c = buffer.readu8(b, p + 4) % 128 + if COMPRESSION[c] == nil then + return 0 + end + end + end + end + return if used > 0 then 0.8 else 0.2 +end +end + +do -- model/md2 +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/md2"] = function(r: Bytes.Reader): number + if r:remaining() < 68 then + return 0 + end + return if Sniff.magic(r, "IDP2") == 1 and r:peekU8(4) == 8 then 1 else 0 +end +end + +do -- model/md3 +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/md3"] = function(r: Bytes.Reader): number + if r:remaining() < 108 then + return 0 + end + return if Sniff.magic(r, "IDP3") == 1 and r:peekU8(4) == 15 then 1 else 0 +end +end + +do -- model/md5 +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/md5"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + head = string.gsub(head, "^//[^\n]*\n%s*", "") + return if string.match(head, "^MD5Version%s+%d+") then 1 else 0 +end +end + +do -- model/mdl +local Bytes = require("@rosetta/core/Bytes") +S["model/mdl"] = function(r: Bytes.Reader): number + local m = r:peek(4) + local v = r:peekU8(4) + if (m == "IDPO" and v == 6) or (m == "IDST" and v == 10) then + return 1 + end + return 0 +end +end + +do -- model/ms3d +local Bytes = require("@rosetta/core/Bytes") +local Read = lazy(function() + return require("@rosetta/model/ms3d/Read") +end) +S["model/ms3d"] = function(r: Bytes.Reader): number + local h = r:peek(14) + if string.sub(h, 1, 10) ~= Read.MAGIC then + return 0 + end + local v = string.byte(h, 11) + return if v == 3 or v == 4 then 1 else 0.6 +end +end + +do -- model/obj +local Bytes = require("@rosetta/core/Bytes") +S["model/obj"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "\0", 1, true) then + return 0 + end + if string.find(head, "^%s*v%s+[%-%d%.]") or string.find(head, "\n%s*v%s+[%-%d%.]") then + return 0.6 + end + if string.find(head, "^#") and (string.find(head, "\nmtllib ") or string.find(head, "\no ") or string.find(head, "\ng ")) then + return 0.4 + end + return 0 +end +end + +do -- model/off +local Bytes = require("@rosetta/core/Bytes") +S["model/off"] = function(r: Bytes.Reader): number + local head = r:peek(512) + for _ = 1, 16 do + local rest = string.match(head, "^%s*#[^\n]*\n(.*)$") + if not rest then + break + end + head = rest + end + local kw = string.match(head, "^%s*(%w+)") + if kw and string.match(kw, "^S?T?C?N?4?n?OFF$") then + return 0.9 + end + return 0 +end +end + +do -- model/ply +local Bytes = require("@rosetta/core/Bytes") +S["model/ply"] = function(r: Bytes.Reader): number + local h = r:peek(4) + return if h == "ply\n" or h == "ply\r" then 1 else 0 +end +end + +do -- model/pmx +local Bytes = require("@rosetta/core/Bytes") +S["model/pmx"] = function(r: Bytes.Reader): number + local head = r:peek(8) + if string.sub(head, 1, 4) == "PMX " then + return 1 + end + if string.sub(head, 1, 7) == "Pmd\0\0\128\63" then + return 1 + end + return 0 +end +end + +do -- model/proc +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/proc"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64, true) + if string.match(head, "^mapProcFile%d%d%d") then + return 1 + end + if string.match(head, '^"?PROC"?%s+"?%d') then + return 0.9 + end + return 0 +end +end + +do -- model/qb +local Bytes = require("@rosetta/core/Bytes") +S["model/qb"] = function(r: Bytes.Reader): number + if r:remaining() < 24 or r:peek(4) ~= "\1\1\0\0" then + return 0 + end + local b, p = r.buf, r.pos + local fmt, z, comp, mask = buffer.readu32(b, p + 4), buffer.readu32(b, p + 8), buffer.readu32(b, p + 12), buffer.readu32(b, p + 16) + if fmt > 1 or z > 1 or comp > 1 or mask > 1 then + return 0 + end + return 0.9 +end +end + +do -- model/rbxm +local Bytes = require("@rosetta/core/Bytes") +local MAGIC = "]*%?>", "") + if match(head, "^%s*]") then + return if find(head, "version=", 1, true) then 1 else 0.8 + end + return 0 +end +end + +do -- model/robloxmesh +local Bytes = require("@rosetta/core/Bytes") +S["model/robloxmesh"] = function(r: Bytes.Reader): number + return if string.match(r:peek(13), "^version [1-7]%.%d%d[\r\n]") then 1 else 0 +end +end + +do -- model/schematic +local Bytes = require("@rosetta/core/Bytes") +local Nbt = lazy(function() + return require("@rosetta/codecs/text/Nbt") +end) +local LITEMATIC_HINTS = { "Regions", "EnclosingSize", "RegionCount", "TotalVolume", "MinecraftDataVersion" } +local SPONGE_HINTS = { "BlockData", "PaletteMax" } -- v1 / v2 fields (some writers leave the root unnamed) +local function hinted(head: string, hints: { string }): boolean + for _, h in hints do + if string.find(head, string.char(0, #h) .. h, 1, true) then + return true + end + end + return false +end +S["model/schematic"] = function(r: Bytes.Reader): number + local p = Nbt.peek(r.buf, r.base, r.limit - r.base) + if not p or p.rootType ~= "compound" or p.endian ~= "big" then + return 0 + end + if p.name == "Schematic" or (p.firstName == "Schematic" and p.firstType == "compound") then + return 1 + end + local head = buffer.tostring(p.head) + return if hinted(head, LITEMATIC_HINTS) or hinted(head, SPONGE_HINTS) then 1 else 0 +end +end + +do -- model/smd +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/smd"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 256, true) + head = string.gsub(head, "^//[^\n]*\n%s*", "") + if string.match(head, "^version%s+1%s") and string.find(head, "nodes", 1, true) then + return 0.9 + end + return 0 +end +end + +do -- model/sourcemdl +local Bytes = require("@rosetta/core/Bytes") +S["model/sourcemdl"] = function(r: Bytes.Reader): number + if r.limit - r.base < 8 or r:peek(4) ~= "IDST" then + return 0 + end + local v = buffer.readi32(r.buf, r.base + 4) + return if v >= 44 and v <= 49 then 1 else 0 +end +end + +do -- model/stl +local Bytes = require("@rosetta/core/Bytes") +local function lower5(s: string): boolean + return string.lower(s) == "solid" +end +S["model/stl"] = function(r: Bytes.Reader): number + local size = r:remaining() + if size >= 84 then + local c = r:peek(4, 80) + local n = string.byte(c, 1) + string.byte(c, 2) * 256 + string.byte(c, 3) * 65536 + string.byte(c, 4) * 16777216 + if 84 + 50 * n == size then + return 0.9 + end + end + local head = r:peek(512) + local s = string.match(head, "^%s*(%a+)") + if s and lower5(s) then + local l = string.lower(head) + return if string.find(l, "facet", 1, true) or string.find(l, "endsolid", 1, true) then 0.9 else 0.5 + end + return 0 +end +end + +do -- model/t3d +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/t3d"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 512) + local first = string.match(h, "^%s*(Begin%s+%a+)") + if first == nil then + return 0 + end + local kind = string.lower(string.match(first, "%a+$") or "") + if kind == "map" or kind == "actor" or kind == "level" or kind == "brush" or kind == "polylist" then + return 0.9 + end + return 0.3 +end +end + +do -- model/udmf +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/udmf"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 1024, true) + for _ = 1, 32 do + local rest = string.match(head, "^//[^\n]*\n%s*(.*)$") or string.match(head, "^/%*.-%*/%s*(.*)$") + if not rest then + break + end + head = rest + end + if string.match(head, "^[Nn][Aa][Mm][Ee][Ss][Pp][Aa][Cc][Ee]%s*=%s*\"") then + return 0.9 + end + return 0 +end +end + +do -- model/usda +local Bytes = require("@rosetta/core/Bytes") +local function isUsdz(r: Bytes.Reader): boolean + if r:peek(4) ~= "PK\3\4" then + return false + end + local lo, hi = r:peekU8(26), r:peekU8(27) + if lo < 0 or hi < 0 then + return false + end + local nameLen = lo + hi * 256 + local name = string.lower(r:peek(30 + nameLen)) + name = string.sub(name, 31) + return string.find(name, "%.usd[ac]?$") ~= nil +end +S["model/usda"] = function(r: Bytes.Reader): number + local head = r:peek(8) + if string.sub(head, 1, 5) == "#usda" or string.sub(head, 1, 8) == "\239\187\191#usda" then + return 1 + end + if head == "PXR-USDC" then + return 0.9 -- USDC magic, so the error says it is unsupported + end + if isUsdz(r) then + return 0.95 + end + return 0 +end +end + +do -- model/vbsp +local Bytes = require("@rosetta/core/Bytes") +local HEADER = 8 + 64 * 16 + 4 +S["model/vbsp"] = function(r: Bytes.Reader): number + if r:remaining() < HEADER or r:peek(4) ~= "VBSP" then + return 0 + end + local v = buffer.readi32(r.buf, r.pos + 4) + return if v >= 19 and v <= 21 then 1 else 0.5 +end +end + +do -- model/vmf +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/vmf"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + if string.find(head, "%z") then + return 0 + end + if string.match(head, "^versioninfo%s*{") or string.match(head, '^"versioninfo"%s*{') then + return 0.9 + end + if string.match(head, "^world%s*{") or string.match(head, "^visgroups%s*{") then + return 0.6 + end + return 0 +end +end + +do -- model/vox +local Bytes = require("@rosetta/core/Bytes") +S["model/vox"] = function(r: Bytes.Reader): number + return if r:peek(4) == "VOX " and r:peek(4, 8) == "MAIN" then 1 elseif r:peek(4) == "VOX " then 0.8 else 0 +end +end + +do -- model/vrml +local Bytes = require("@rosetta/core/Bytes") +S["model/vrml"] = function(r: Bytes.Reader): number + local head = r:peek(16) + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + return if string.sub(head, 1, 10) == "#VRML V2.0" then 1 elseif string.sub(head, 1, 6) == "#VRML " then 0.6 else 0 +end +end + +do -- model/x +local Bytes = require("@rosetta/core/Bytes") +local ENCODINGS = { ["txt "] = "text", ["bin "] = "binary", tzip = "text", bzip = "binary" } +S["model/x"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "xof " then + return 0 + end + return if ENCODINGS[r:peek(4, 8)] then 1 else 0.5 +end +end + +do -- model/x3d +local Bytes = require("@rosetta/core/Bytes") +S["model/x3d"] = function(r: Bytes.Reader): number + local head = r:peek(1024) + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + if string.sub(head, 1, 5) == "#X3D " then + return 1 + end + if string.sub(head, 1, 4) == "\224\0\0\1" and string.find(head, "x3d", 1, true) then + return 0.9 + end + if string.find(head, "]") or string.find(head, "", 1, true) or (string.find(head, "", 1, true)) then + return if string.find(r:peek(512), "= 64 then + local lfanew = string.byte(h, 61) + string.byte(h, 62) * 256 + string.byte(h, 63) * 65536 + local sig = r:peek(2, lfanew) + return if sig == "NE" then 0.6 elseif sig == "PE" then 0.2 else 0 + end + if isFnt(h) and #h >= 6 then + local size = string.byte(h, 3) + string.byte(h, 4) * 256 + string.byte(h, 5) * 65536 + string.byte(h, 6) * 16777216 + return if size == r:size() then 0.9 elseif size <= r:size() and size > 118 then 0.3 else 0 + end + return 0 +end +end + +do -- font/hershey +local Bytes = require("@rosetta/core/Bytes") +local function header(line: string): (number?, number?) + if #line < 10 then + return nil, nil + end + local id = tonumber((string.gsub(string.sub(line, 1, 5), "^%s+", ""))) + local n = tonumber((string.gsub(string.sub(line, 6, 8), "^%s+", ""))) + if not id or not n or n < 1 or string.find(string.sub(line, 1, 8), "[^%d ]") then + return nil, nil + end + return id, n +end +S["font/hershey"] = function(r: Bytes.Reader): number + local head = r:peek(256) + local line = string.match(head, "^([^\r\n]*)") + local id, n = header(line or "") + if not id or not n then + return 0 + end + local body = string.sub(line :: string, 9) + if string.find(body, "[^ -~]") then + return 0 + end + return if #body == math.min(2 * n, 64) or #body == 2 * n then 0.7 else 0.3 +end +end + +do -- font/pcf +local Bytes = require("@rosetta/core/Bytes") +S["font/pcf"] = function(r: Bytes.Reader): number + return if r:peek(4) == "\1fcp" then 1 else 0 +end +end + +do -- font/psf +local Bytes = require("@rosetta/core/Bytes") +S["font/psf"] = function(r: Bytes.Reader): number + local h = r:peek(4) + if h == "\114\181\74\134" then + return 1 + end + if string.sub(h, 1, 2) == "\54\4" and #h >= 4 and string.byte(h, 3) <= 7 and string.byte(h, 4) > 0 then + return 0.9 + end + return 0 +end +end + +do -- font/ttf +local Bytes = require("@rosetta/core/Bytes") +S["font/ttf"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "\0\1\0\0" or m == "OTTO" or m == "ttcf" or m == "true" then + return 0.9 + end + return 0 +end +end + +do -- font/type1 +local Bytes = require("@rosetta/core/Bytes") +S["font/type1"] = function(r: Bytes.Reader): number + local h = r:peek(64) + if string.sub(h, 1, 2) == "\128\1" then + h = string.sub(h, 7) + end + if string.sub(h, 1, 14) == "%!PS-AdobeFont" or string.sub(h, 1, 10) == "%!FontType" then + return 1 + end + return 0 +end +end + +do -- font/woff +local Bytes = require("@rosetta/core/Bytes") +S["font/woff"] = function(r: Bytes.Reader): number + return if r:peek(4) == "wOFF" then 1 else 0 +end +end + +do -- font/woff2 +local Bytes = require("@rosetta/core/Bytes") +S["font/woff2"] = function(r: Bytes.Reader): number + return if r:peek(4) == "wOF2" then 1 else 0 +end +end + +do -- archive/7z +local Bytes = require("@rosetta/core/Bytes") +local MAGIC = "7z\188\175\39\28" +S["archive/7z"] = function(r: Bytes.Reader): number + return if r:peek(6) == MAGIC then 1 else 0 +end +end + +do -- archive/adf +local Bytes = require("@rosetta/core/Bytes") +local BS = 512 +S["archive/adf"] = function(r: Bytes.Reader): number + local n = r:size() + if n < 4 * BS or n % BS ~= 0 then + return 0 + end + local h = r:peek(4) + if string.sub(h, 1, 3) ~= "DOS" or string.byte(h, 4) > 5 then + return 0 + end + return if n == 901120 or n == 1802240 then 0.95 else 0.6 +end +end + +do -- archive/applesingle +local Bytes = require("@rosetta/core/Bytes") +S["archive/applesingle"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h < 8 then + return 0 + end + local magic = string.sub(h, 1, 4) + local ver = string.sub(h, 5, 8) + if (magic == "\0\5\22\0" or magic == "\0\5\22\7") and (ver == "\0\1\0\0" or ver == "\0\2\0\0") then + return 1 + end + return 0 +end +end + +do -- archive/ar +local Bytes = require("@rosetta/core/Bytes") +local MAGIC = "!\n" +S["archive/ar"] = function(r: Bytes.Reader): number + if r:peek(8) == MAGIC then + return if r:peek(13, 68) == "debian-binary" then 1 else 0.9 + end + return if r:peek(8) == "!\n" then 0.5 else 0 +end +end + +do -- archive/arj +local Bytes = require("@rosetta/core/Bytes") +S["archive/arj"] = function(r: Bytes.Reader): number + local h = r:peek(4) + if #h == 4 and string.byte(h, 1) == 0x60 and string.byte(h, 2) == 0xEA then + local size = string.byte(h, 3) + string.byte(h, 4) * 256 + return if size > 0 and size <= 2600 then 0.9 else 0 + end + return 0 +end +end + +do -- archive/binhex +local Bytes = require("@rosetta/core/Bytes") +local BANNER = "(This file must be converted with BinHex" +S["archive/binhex"] = function(r: Bytes.Reader): number + local head = r:peek(2048) + local at = string.find(head, BANNER, 1, true) + if not at then + return 0 + end + return if at == 1 then 1 else 0.8 +end +end + +do -- archive/br +local Err = require("@rosetta/core/Err") +local Bytes = require("@rosetta/core/Bytes") +local Brotli = lazy(function() + return require("@rosetta/codecs/compress/Brotli") +end) +local SNIFF_WHOLE = 262144 -- streams up to this size are decoded whole by sniff +local SNIFF_PREFIX = 65536 +S["archive/br"] = function(r: Bytes.Reader): number + local n = r:remaining() + if n == 0 then + return 0 + end + if n <= SNIFF_WHOLE then + local out, consumed = Brotli.decompress(r.buf, r.pos, n, { maxBytes = 2 ^ 26 }) + if out and consumed == r.limit then + return if buffer.len(out) > 0 then 0.3 else 0.05 + end + return 0 + end + local _, err = Brotli.decompress(r.buf, r.pos, SNIFF_PREFIX, { maxBytes = 2 ^ 22 }) + if err and (err.code == Err.TRUNCATED or err.code == Err.LIMIT) then + return 0.05 + end + return 0 +end +end + +do -- archive/bz2 +local Bytes = require("@rosetta/core/Bytes") +S["archive/bz2"] = function(r: Bytes.Reader): number + local h = r:peek(10) + if #h < 10 or string.sub(h, 1, 3) ~= "BZh" then + return 0 + end + local lv = string.byte(h, 4) + if lv < 0x31 or lv > 0x39 then + return 0 + end + local magic = string.sub(h, 5, 10) + if magic == "\x31\x41\x59\x26\x53\x59" or magic == "\x17\x72\x45\x38\x50\x90" then + return 1 + end + return 0 +end +end + +do -- archive/cab +local Bytes = require("@rosetta/core/Bytes") +S["archive/cab"] = function(r: Bytes.Reader): number + if r:peek(8) == "MSCF\0\0\0\0" then + return 1 + end + return 0 +end +end + +do -- archive/cpio +local Bytes = require("@rosetta/core/Bytes") +S["archive/cpio"] = function(r: Bytes.Reader): number + local m = r:peek(6) + if m == "070701" or m == "070702" or m == "070707" then + return 1 + end + local b2 = r:peek(2) + if (b2 == "\199\113" or b2 == "\113\199") and r:remaining() >= 26 then + return 0.5 + end + return 0 +end +end + +do -- archive/d64 +local Bytes = require("@rosetta/core/Bytes") +type Geometry = { kind: string, tracks: number, offsets: { number }, spt: { number }, dirTrack: number, total: number } +local function geometry(kind: string, tracks: number): Geometry + local offsets, spt = {}, {} + local o = 0 + for t = 1, tracks do + local n + if kind == "d81" then + n = 40 + else + local s = if kind == "d71" and t > 35 then t - 35 else t + n = if s <= 17 then 21 elseif s <= 24 then 19 elseif s <= 30 then 18 else 17 + end + offsets[t], spt[t] = o, n + o += n * 256 + end + return { kind = kind, tracks = tracks, offsets = offsets, spt = spt, dirTrack = if kind == "d81" then 40 else 18, total = o } +end +local function detect(len: number): Geometry? + for _, g in { { "d64", 35 }, { "d64", 40 }, { "d64", 42 }, { "d71", 70 }, { "d81", 80 } } :: { { any } } do + local geo = geometry(g[1] :: string, g[2] :: number) + local sectors = geo.total // 256 + if len == geo.total or (g[1] ~= "d81" and len == geo.total + sectors) then + return geo + end + end + return nil +end +S["archive/d64"] = function(r: Bytes.Reader): number + local geo = detect(r:size()) + if not geo then + return 0 + end + -- the BAM / header sector: dir track link and DOS version byte + local h = r:sub(geo.offsets[geo.dirTrack], 256) + local t, s, v = h:u8(), h:u8(), h:u8() + if geo.kind == "d81" then + return if t == 40 and s == 3 and v == 0x44 then 0.9 else 0.3 + end + return if t == 18 and s == 1 and (v == 0x41 or v == 0) then 0.9 else 0.3 +end +end + +do -- archive/fat +local Bytes = require("@rosetta/core/Bytes") +local Fat = lazy(function() + return require("@rosetta/containers/Fat") +end) +S["archive/fat"] = function(r: Bytes.Reader): number + if r:remaining() < 512 then + return 0 + end + local v = Fat.open(r.buf, r.base + r.pos, r.limit - r.base - r.pos) + if not v then + return 0 + end + return if v.partition then 0.6 else 0.8 +end +end + +do -- archive/grp +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +local MAGIC = "KenSilverman" +S["archive/grp"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- archive/gzip +local Bytes = require("@rosetta/core/Bytes") +S["archive/gzip"] = function(r: Bytes.Reader): number + return if r:peek(3) == "\31\139\8" then 1 else 0 +end +end + +do -- archive/iso +local Bytes = require("@rosetta/core/Bytes") +S["archive/iso"] = function(r: Bytes.Reader): number + return if r:peek(5, 16 * 2048 + 1) == "CD001" then 1 else 0 +end +end + +do -- archive/lha +local Bytes = require("@rosetta/core/Bytes") +local METHODS: { [string]: boolean } = { + ["-lh0-"] = true, ["-lz4-"] = true, ["-lhd-"] = true, ["-lh1-"] = true, ["-lh4-"] = true, ["-lh5-"] = true, + ["-lh6-"] = true, ["-lh7-"] = true, ["-lhx-"] = true, ["-lzs-"] = true, ["-lz5-"] = true, ["-lh2-"] = true, + ["-lh3-"] = true, ["-pm0-"] = true, ["-pm1-"] = true, ["-pm2-"] = true, ["-lk7-"] = true, +} +local function isHeader(s: string): boolean + if #s < 22 then + return false + end + local m = string.sub(s, 3, 7) + local level = string.byte(s, 21) + return METHODS[m] == true and level <= 3 +end +S["archive/lha"] = function(r: Bytes.Reader): number + if isHeader(r:peek(22)) then + return 0.95 + end + return 0 +end +end + +do -- archive/lz4 +local Bytes = require("@rosetta/core/Bytes") +S["archive/lz4"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "\4\34\77\24" then + return 1 + elseif m == "\2\33\76\24" then + return 0.9 + elseif #m == 4 and string.byte(m, 1) >= 0x50 and string.byte(m, 1) <= 0x5F and string.sub(m, 2) == "\42\77\24" then + -- a skippable frame (zstd shares the magic): an LZ4 frame after it + local h = r:peek(4, 4) + if #h == 4 then + local n = string.byte(h, 1) + string.byte(h, 2) * 256 + string.byte(h, 3) * 65536 + string.byte(h, 4) * 16777216 + if r:peek(4, 8 + n) == "\4\34\77\24" then + return 1 + end + end + end + return 0 +end +end + +do -- archive/macbinary +local Bytes = require("@rosetta/core/Bytes") +local Crc16 = require("@rosetta/core/Crc16") +local function version(b: buffer, o: number, len: number): string? + if len < 128 then + return nil + end + local u8 = function(i: number): number + return buffer.readu8(b, o + i) + end + if u8(0) ~= 0 or u8(74) ~= 0 then + return nil + end + local nameLen = u8(1) + if nameLen < 1 or nameLen > 63 then + return nil + end + local function be32(i: number): number + return u8(i) * 16777216 + u8(i + 1) * 65536 + u8(i + 2) * 256 + u8(i + 3) + end + local dlen, rlen = be32(83), be32(87) + if dlen > 0x7FFFFFFF or rlen > 0x7FFFFFFF then + return nil + end + local crc = u8(124) * 256 + u8(125) + if crc == Crc16.ccitt(b, o, 124) and (crc ~= 0 or u8(122) >= 129) then + return if buffer.readstring(b, o + 102, 4) == "mBIN" then "III" else "II" + end + if buffer.readstring(b, o + 102, 4) == "mBIN" then + return nil -- III with a bad CRC + end + -- MacBinary I: byte 82 zero, bytes 99..125 zero, the forks within the file + if u8(82) ~= 0 then + return nil + end + for i = 99, 125 do + if u8(i) ~= 0 then + return nil + end + end + local need = 128 + math.ceil(dlen / 128) * 128 + rlen + return if need <= len + 127 then "I" else nil +end +S["archive/macbinary"] = function(r: Bytes.Reader): number + local n = math.min(r:remaining(), 128) + if n < 128 then + return 0 + end + local v = version(r.buf, r.base + r.pos, r.limit - r.base - r.pos) + return if v == "III" then 0.95 elseif v == "II" then 0.8 elseif v == "I" then 0.3 else 0 +end +end + +do -- archive/mpq +local Bytes = require("@rosetta/core/Bytes") +S["archive/mpq"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "MPQ\x1A" or m == "MPQ\x1B" then + return 1 + end + -- a prefixed archive (an installer stub): the header on a 512-byte boundary in the first 64 KB + for at = 512, math.min(65536, r:remaining() - 32), 512 do + if r:peek(4, at) == "MPQ\x1A" then + return 0.6 + end + end + return 0 +end +end + +do -- archive/pak +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["archive/pak"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + return math.max(Sniff.magic(r, "PACK", 0, 0.9), Sniff.magic(r, "SPAK", 0, 0.9)) +end +end + +do -- archive/rpm +local Bytes = require("@rosetta/core/Bytes") +local LEAD_MAGIC = "\237\171\238\219" +S["archive/rpm"] = function(r: Bytes.Reader): number + return if r:peek(4) == LEAD_MAGIC then 1 else 0 +end +end + +do -- archive/tar +local Bytes = require("@rosetta/core/Bytes") +local Tar = lazy(function() + return require("@rosetta/containers/Tar") +end) +S["archive/tar"] = function(r: Bytes.Reader): number + if r:remaining() < 512 then + return 0 + end + if not Tar.valid(r.buf, r.pos) then + return 0 + end + return if r:peek(5, 257) == "ustar" then 0.95 else 0.6 +end +end + +do -- archive/unitypackage +local Bytes = require("@rosetta/core/Bytes") +local Deflate = lazy(function() + return require("@rosetta/codecs/compress/Deflate") +end) +local Tar = lazy(function() + return require("@rosetta/containers/Tar") +end) +local function guidOf(name: string): (string?, string?) + local n = string.gsub(name, "^%./", "") + local guid, rest = string.match(n, "^(%x+)/?(.*)$") + if guid and #guid == 32 then + return string.lower(guid), rest + end + return nil, nil +end +S["archive/unitypackage"] = function(r: Bytes.Reader): number + if r:peek(3) ~= "\31\139\8" then + return 0 + end + local head = Deflate.peek(r.buf, r.pos, r.limit - r.pos, 512) + if not head or buffer.len(head) < 512 or not Tar.valid(head, 0) then + return 0 + end + local z = 0 + while z < 100 and buffer.readu8(head, z) ~= 0 do + z += 1 + end + return if guidOf(buffer.readstring(head, 0, z)) then 1 else 0 -- ties with archive/gzip go to the extension +end +end + +do -- archive/uu +local Bytes = require("@rosetta/core/Bytes") +S["archive/uu"] = function(r: Bytes.Reader): number + local head = r:peek(4096) + if string.match(head, "^begin%-base64 [0-7]+ [^\r\n]") or string.match(head, "^begin [0-7]+ [^\r\n]") then + return 0.9 + end + if string.match(head, "\nbegin%-base64 [0-7]+ [^\r\n]") or string.match(head, "\nbegin [0-7][0-7][0-7]+ [^\r\n]") then + return 0.5 + end + return 0 +end +end + +do -- archive/vpk +local Bytes = require("@rosetta/core/Bytes") +S["archive/vpk"] = function(r: Bytes.Reader): number + if r:remaining() < 12 or r:peek(4) ~= "\x34\x12\xAA\x55" then + return 0 + end + local v = r:peekU8(4) + return if v == 1 or v == 2 then 1 else 0.5 +end +end + +do -- archive/vswap +local Bytes = require("@rosetta/core/Bytes") +local readu8, readu16, readi16, writeu32 = buffer.readu8, buffer.readu16, buffer.readi16, buffer.writeu32 +local function header(r: Bytes.Reader): (number?, number, number) + if r:remaining() < 6 then + return nil, 0, 0 + end + local n, ss, so = readu16(r.buf, r.base), readu16(r.buf, r.base + 2), readu16(r.buf, r.base + 4) + if n == 0 or ss > so or so > n or 6 + n * 6 > r:remaining() then + return nil, 0, 0 + end + return n, ss, so +end +S["archive/vswap"] = function(r: Bytes.Reader): number + local n = header(r) + if not n then + return 0 + end + local size = r.limit - r.base + local b = r.buf + local last = 6 + n * 6 + local nonzero = 0 + for i = 0, n - 1 do + local o = buffer.readu32(b, r.base + 6 + i * 4) + local l = readu16(b, r.base + 6 + n * 4 + i * 2) + if o ~= 0 then + if o < last or o + l > size then + return 0 + end + last = o + nonzero += 1 + end + end + return if nonzero > 0 then 0.6 else 0 +end +end + +do -- archive/wad +local Bytes = require("@rosetta/core/Bytes") +S["archive/wad"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + local m = r:peek(4) + if m ~= "IWAD" and m ~= "PWAD" then + return 0 + end + return 0.9 +end +end + +do -- archive/wad2 +local Bytes = require("@rosetta/core/Bytes") +S["archive/wad2"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + local m = r:peek(4) + return if m == "WAD2" or m == "WAD3" then 0.9 else 0 +end +end + +do -- archive/xz +local Bytes = require("@rosetta/core/Bytes") +local XZ_MAGIC = "\253" .. "7zXZ\0" +local function aloneScore(r: Bytes.Reader): number + local h = r:peek(14) + if #h < 14 then + return 0 + end + local d = string.byte(h, 1) + if d >= 225 or string.byte(h, 14) ~= 0 then + return 0 + end + local dict = string.byte(h, 2) + string.byte(h, 3) * 256 + string.byte(h, 4) * 65536 + string.byte(h, 5) * 16777216 + local okDict = false + for n = 12, 31 do + if dict == 2 ^ n or (n < 31 and dict == 2 ^ n + 2 ^ (n - 1)) then + okDict = true + break + end + end + if not okDict then + return 0 + end + local s = string.sub(h, 6, 13) + if s ~= string.rep("\255", 8) and (string.byte(h, 11) ~= 0 or string.byte(h, 12) ~= 0 or string.byte(h, 13) ~= 0) then + return 0 + end + return if d == 0x5D then 0.4 else 0.2 +end +S["archive/xz"] = function(r: Bytes.Reader): number + if r:peek(6) == XZ_MAGIC then + return 1 + end + return aloneScore(r) +end +end + +do -- archive/yenc +local Bytes = require("@rosetta/core/Bytes") +S["archive/yenc"] = function(r: Bytes.Reader): number + local head = r:peek(4096) + if string.match(head, "^=ybegin ") then + return 0.95 + end + return if string.find(head, "\n=ybegin [^\n]*name=") then 0.6 else 0 +end +end + +do -- archive/z +local Bytes = require("@rosetta/core/Bytes") +S["archive/z"] = function(r: Bytes.Reader): number + if r:peek(2) ~= "\31\157" then + return 0 + end + local f = r:peekU8(2) + return if f >= 0 and bit32.band(f, 0x60) == 0 and bit32.band(f, 0x1F) >= 9 and bit32.band(f, 0x1F) <= 16 then 1 else 0.3 +end +end + +do -- archive/zip +local Bytes = require("@rosetta/core/Bytes") +S["archive/zip"] = function(r: Bytes.Reader): number + local s = r:peek(4) + -- ZIP-based formats (docx, jar, 3mf, ...) score higher in their own sniff + if s == "PK\3\4" or s == "PK\5\6" then + return 0.6 + end + if string.sub(s, 1, 2) == "MZ" then + return 0 -- a self-extractor opens with Zip.decode / opts.format = "zip" + end + return 0 +end +end + +do -- archive/zoo +local Bytes = require("@rosetta/core/Bytes") +local TAG = 0xFDC4A7DC +S["archive/zoo"] = function(r: Bytes.Reader): number + local h = r:peek(24) + if #h < 24 then + return 0 + end + local tag = string.byte(h, 21) + string.byte(h, 22) * 256 + string.byte(h, 23) * 65536 + string.byte(h, 24) * 16777216 + if tag ~= TAG then + return 0 + end + return if string.sub(h, 1, 4) == "ZOO " then 1 else 0.8 +end +end + +do -- archive/zst +local Bytes = require("@rosetta/core/Bytes") +local Zstd = lazy(function() + return require("@rosetta/codecs/compress/Zstd") +end) +S["archive/zst"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == Zstd.MAGIC then + return 1 + end + -- a skippable frame (0x184D2A50 .. 0x184D2A5F) is usually followed by a zstd frame + if #m == 4 and string.sub(m, 2, 4) == "\42\77\24" and bit32.band(string.byte(m, 1), 0xF0) == 0x50 then + return 0.5 + end + return 0 +end +end + +do -- data/cbor +local Bytes = require("@rosetta/core/Bytes") +S["data/cbor"] = function(r: Bytes.Reader): number + return if r:peek(3) == "\217\217\247" then 1 else 0 +end +end + +do -- data/csv +local Bytes = require("@rosetta/core/Bytes") +local find, sub, byte, gsub = string.find, string.sub, string.byte, string.gsub +S["data/csv"] = function(r: Bytes.Reader): number + local head = r:peek(1024) + if find(head, "%z") then + return 0 + end + local l1, l2 = string.match(head, "^([^\r\n]*)\r?\n([^\r\n]*)") + if not l1 or l1 == "" then + return 0 + end + for _, d in { ",", "\t", ";" } do + local _, c1 = gsub(l1, d, "") + local _, c2 = gsub(l2 :: string, d, "") + if c1 > 0 and c1 == c2 then + return 0.15 + end + end + return 0 +end +end + +do -- data/ini +local Bytes = require("@rosetta/core/Bytes") +S["data/ini"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "%z") then + return 0 + end + local first = string.match(head, "^[%s]*([^\r\n]*)") + while first and string.match(first, "^[;#]") do + head = string.match(head, "^[^\n]*\n(.*)$") or "" + first = string.match(head, "^[%s]*([^\r\n]*)") + end + if first and string.match(first, "^%[[^%]]+%]%s*$") then + return 0.2 + end + return 0 +end +end + +do -- data/json +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +S["data/json"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + local first = string.match(head, "^[ \t\r\n]*(.)") + if first == "{" then + local nxt = string.match(head, "^[^{]*{[ \t\r\n]*(.)") + return if nxt == nil or nxt == '"' or nxt == "}" then 0.6 else 0.1 + elseif first == "[" then + -- past any nested '[': a JSON value must start (TOML / INI "[section]" and "[[table]]" do not) + local nxt = string.match(head, "^[ \t\r\n]*[%[ \t\r\n]*(.)") + if nxt == nil or string.find('{"-0123456789tfn]', nxt, 1, true) then + return 0.3 + end + return 0 + end + return 0 +end +end + +do -- data/msgpack +local Bytes = require("@rosetta/core/Bytes") +S["data/msgpack"] = function(_r: Bytes.Reader): number + return 0 -- no magic: by extension or opts.format only +end +end + +do -- data/nbt +local Bytes = require("@rosetta/core/Bytes") +local Nbt = lazy(function() + return require("@rosetta/codecs/text/Nbt") +end) +S["data/nbt"] = function(r: Bytes.Reader): number + local p = Nbt.peek(r.buf, r.base, r.limit - r.base) + if not p or p.rootType ~= "compound" then + return 0 + end + if p.compression ~= "none" then + return if p.firstType then 1 else 0.5 -- gzip wrapped NBT: ties with archive/gzip go to the extension + end + return if p.firstType and p.firstName then 0.6 else 0.2 +end +end + +do -- data/plist +local Bytes = require("@rosetta/core/Bytes") +S["data/plist"] = function(r: Bytes.Reader): number + local head = r:peek(256) + if string.sub(head, 1, 6) == "bplist" then + return 1 + end + if string.find(head, " 0 and good == lines and paths > 0 then 0.5 else 0 +end +end + +do -- data/snbt +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["data/snbt"] = function(r: Bytes.Reader): number + -- SNBT has what JSON never has: unquoted keys, typed numbers (1b, 2.5f), [I; arrays, single-quoted strings + local head = Sniff.text(r, 512, true) + local first = string.sub(head, 1, 1) + if first ~= "{" and first ~= "[" then + return 0 + end + if string.find(head, "[{,]%s*[%a_][%w_%-%.%+]*%s*:") or string.find(head, "%d[bBsSlLfFdD]%s*[,}%]]") + or string.find(head, "%[[BIL]%s*;") or string.find(head, "[:,%[]%s*'") + then + return 0.7 + end + return 0 +end +end + +do -- data/toml +local Bytes = require("@rosetta/core/Bytes") +S["data/toml"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "%z") then + return 0 + end + for line in string.gmatch(head, "[^\n]+") do + local l = string.match(line, "^[ \t]*(.-)[ \t\r]*$") :: string + if l ~= "" and string.sub(l, 1, 1) ~= "#" then + if string.match(l, "^%[%[?[%w_%-%.\"' ]+%]%]?$") or string.match(l, "^[%w_%-%.\"']+[ \t]*=[ \t]*[\"'%[{%dtf%+%-in]") then + return 0.2 + end + return 0 + end + end + return 0 +end +end + +do -- data/tres +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["data/tres"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 256) + if string.match(h, "^%s*%[gd_resource[%s%]]") then + return 1 + end + return 0 +end +end + +do -- data/vdf +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +local KeyValues = lazy(function() + return require("@rosetta/codecs/text/KeyValues") +end) +S["data/vdf"] = function(r: Bytes.Reader): number + local n = r:remaining() + if KeyValues.isBinary(r.buf, r.pos, n) then + return 0.3 + end + local head = Sniff.text(r, 256, true) + if string.find(head, "%z") then + return 0 + end + head = string.gsub(head, "^//[^\n]*\n%s*", "") + if string.match(head, '^"[^"\n]+"%s*{') or string.match(head, '^"[^"\n]+"%s*%[[^%]\n]*%]%s*{') then + return 0.6 + end + if string.match(head, "^#base%s") or string.match(head, "^#include%s") then + return 0.5 + end + if string.match(head, '^[%w_]+%s*\n%s*{%s*\n%s*"') then + return 0.3 + end + return 0 +end +end + +do -- data/xml +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +S["data/xml"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + if string.match(head, "^<%?xml[ \t\r\n]") or string.sub(head, 1, 4) == "\255\254<\0" or string.sub(head, 1, 4) == "\254\255\0<" then + return 0.5 + end + if string.match(head, "^[ \t\r\n]*<[%a!]") then + return 0.3 + end + return 0 +end +end + +do -- data/yaml +local Bytes = require("@rosetta/core/Bytes") +S["data/yaml"] = function(r: Bytes.Reader): number + local head = r:peek(256) + if string.find(head, "%z") then + return 0 + end + if string.match(head, "^%%YAML ") then + return 0.9 + end + if string.match(head, "^%-%-%-[ \r\n]") then + return 0.5 + end + local line = string.match(head, "^[ \t\r\n]*([^\r\n]*)") + if line and (string.match(line, "^[%w_%-\"']+[%w_%- \"']*:[ ]") or string.match(line, "^[%w_%-]+:$") or string.match(line, "^%- ")) then + return 0.2 + end + return 0 +end +end + +do -- vector/gamemaps +local Bytes = require("@rosetta/core/Bytes") +local MAGIC = "TED5v1.0" +S["vector/gamemaps"] = function(r: Bytes.Reader): number + if r:peek(8) == MAGIC then + return 1 + end + -- MAPHEAD: the RLEW tag 0xABCD, then 100 offsets (0 / -1 when absent) + if r:remaining() >= 402 and r:remaining() <= 1024 and buffer.readu16(r.buf, r.base) == 0xABCD then + local first = buffer.readi32(r.buf, r.base + 2) + if first > 0 then + return 0.7 + end + end + return 0 +end +end + +do -- vector/ldtk +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["vector/ldtk"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 1024) + if not string.match(h, "^%s*{") then + return 0 + end + if string.find(h, "\"fileType\"%s*:%s*\"LDtk Project JSON\"") then + return 1 + end + if string.find(h, "\"jsonVersion\"", 1, true) and string.find(h, "\"worldLayout\"", 1, true) then + return 0.8 + end + return 0 +end +end + +do -- vector/ogmo +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["vector/ogmo"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 2048) + if not string.match(h, "^%s*{") or not string.find(h, "\"ogmoVersion\"", 1, true) then + return 0 + end + if string.find(h, "\"layerGridDefaultSize\"", 1, true) or string.find(h, "\"levelPaths\"", 1, true) then + return 1 + end + return 0.9 +end +end + +do -- vector/svg +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +S["vector/svg"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 4096) + if not string.match(h, "^%s*<") then + return 0 + end + if string.find(h, ":]") or string.find(h, "<%w+:svg[%s>]") then + return 0.95 + end + return 0 +end +end + +do -- vector/tiled +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +local function head(r: Bytes.Reader): string + local h = Sniff.text(r, 1024) + return h +end +S["vector/tiled"] = function(r: Bytes.Reader): number + local h = head(r) + if string.match(h, "^%s*<") then + if string.find(h, "]") or string.find(h, "]") then + return 0.9 + end + return 0 + end + if string.match(h, "^%s*{") then + -- Tiled writes its keys sorted: "type" comes last, so look at the tail too + local n = r:remaining() + local tail = if n > 1024 then r:peek(1024, n - 1024) else "" + for _, part in { h, tail } do + if string.find(part, "\"type\"%s*:%s*\"map\"") or string.find(part, "\"type\"%s*:%s*\"tileset\"") then + return 0.8 + end + end + if string.find(h, "\"tilewidth\"", 1, true) and (string.find(h, "\"orientation\"", 1, true) or string.find(h, "\"tilesets\"", 1, true)) then + return 0.6 + end + end + return 0 +end +end + +do -- layered/aseprite +local Bytes = require("@rosetta/core/Bytes") +S["layered/aseprite"] = function(r: Bytes.Reader): number + if r:peekU8(4) == 0xE0 and r:peekU8(5) == 0xA5 then + local d = r:peekU8(12) + if (d == 32 or d == 16 or d == 8) and r:peekU8(13) == 0 then + return 1 + end + return 0.5 + end + return 0 +end +end + +do -- layered/ora +local Bytes = require("@rosetta/core/Bytes") +local MIME = "image/openraster" +S["layered/ora"] = function(r: Bytes.Reader): number + -- a zip whose first (stored) entry is "mimetype" holding image/openraster + if r:peek(4) == "PK\3\4" and r:peek(8, 30) == "mimetype" and r:peek(#MIME, 38) == MIME then + return 1 + end + return 0 +end +end + +do -- layered/psd +local Bytes = require("@rosetta/core/Bytes") +S["layered/psd"] = function(r: Bytes.Reader): number + local h = r:peek(6) + if string.sub(h, 1, 4) == "8BPS" and (string.sub(h, 5, 6) == "\0\1" or string.sub(h, 5, 6) == "\0\2") then + return 1 + end + return 0 +end +end + +do -- subtitle/ass +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +S["subtitle/ass"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + if string.match(head, "^%s*%[[Ss]cript [Ii]nfo%]") then + return 1 + end + return 0 +end +end + +do -- subtitle/srt +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +local TIMING = "^%s*(%d+):(%d%d?):(%d%d?)[,.](%d+)%s*%-%->%s*(%d+):(%d%d?):(%d%d?)[,.](%d+)%s*(.-)%s*$" +local function frac(digits: string): number + return (tonumber(digits) :: number) / 10 ^ #digits +end +local function timing(line: string): (number?, number?, string?) + local h1, m1, s1, f1, h2, m2, s2, f2, rest = string.match(line, TIMING) + if not h1 then + return nil, nil, nil + end + local a = tonumber(h1) :: number * 3600 + tonumber(m1) :: number * 60 + tonumber(s1) :: number + frac(f1 :: string) + local b = tonumber(h2) :: number * 3600 + tonumber(m2) :: number * 60 + tonumber(s2) :: number + frac(f2 :: string) + return a, b, rest +end +S["subtitle/srt"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512) + head = string.gsub(head, "\r", "\n") + local first, second = string.match(head, "^%s*([^\n]*)\n([^\n]*)") + if first and string.match(first, "^%d+%s*$") and second and timing(second) then + return 0.9 + end + if first and timing(first) then + return 0.6 + end + return 0 +end +end + +do -- subtitle/vtt +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +S["subtitle/vtt"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 10) + if string.sub(head, 1, 6) == "WEBVTT" then + local c = string.sub(head, 7, 7) + if c == "" or c == " " or c == "\t" or c == "\n" or c == "\r" then + return 1 + end + end + return 0 +end +end + +do -- music/669 +local Bytes = require("@rosetta/core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 497 then + return false + end + local magic = r:peek(2) + if magic ~= "if" and magic ~= "JN" then + return false + end + local nsmp, npat, restart = r:peekU8(110), r:peekU8(111), r:peekU8(112) + if nsmp > 64 or restart >= 128 or npat > 128 then + return false + end + local bad = 0 + for i = 2, 109 do + local c = r:peekU8(i) + if c > 0 and c <= 31 then + bad += 1 + if bad > 40 then + return false + end + end + end + for i = 0, 127 do + local o, t, b = r:peekU8(113 + i), r:peekU8(241 + i), r:peekU8(369 + i) + if (o >= 128 and o < 0xFE) or (o < 128 and t == 0) or t > 15 or b >= 64 then + return false + end + end + return true +end +S["music/669"] = function(r: Bytes.Reader): number + return if validHeader(r) then 0.6 else 0 +end +end + +do -- music/ahx +local Bytes = require("@rosetta/core/Bytes") +S["music/ahx"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m and #m == 4 and string.sub(m, 1, 3) == "THX" and string.byte(m, 4) < 3 then 1 else 0 +end +end + +do -- music/far +local Bytes = require("@rosetta/core/Bytes") +S["music/far"] = function(r: Bytes.Reader): number + if r:size() >= 98 and r:peek(4) == "FAR\xFE" and r:peek(3, 44) == "\r\n\x1A" and r:peekU8(47) + r:peekU8(48) * 256 >= 98 then + return 1 + end + return 0 +end +end + +do -- music/hmp +local Bytes = require("@rosetta/core/Bytes") +local HMI_MAGIC = "HMI-MIDISONG061595" +S["music/hmp"] = function(r: Bytes.Reader): number + return if r:peek(8) == "HMIMIDIP" or r:peek(18) == HMI_MAGIC then 1 else 0 +end +end + +do -- music/hvl +local Bytes = require("@rosetta/core/Bytes") +S["music/hvl"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m and #m == 4 and string.sub(m, 1, 3) == "HVL" and string.byte(m, 4) <= 1 then 1 else 0 +end +end + +do -- music/it +local Bytes = require("@rosetta/core/Bytes") +S["music/it"] = function(r: Bytes.Reader): number + return if r:peek(4) == "IMPM" then 1 else 0 +end +end + +do -- music/med +local Bytes = require("@rosetta/core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 52 or r:peek(3) ~= "MMD" then + return false + end + local v = r:peekU8(3) + if v < 0x30 or v > 0x33 then + return false + end + local h = r:sub(8, 44) + local songOff = h:u32be() + h:skip(4) + local blockOff = h:u32be() + h:skip(4) + local smpOff = h:u32be() + return songOff >= 52 and songOff + 63 * 8 + 284 <= r:size() and blockOff >= 52 and (smpOff == 0 or smpOff >= 52) +end +S["music/med"] = function(r: Bytes.Reader): number + return if validHeader(r) then 1 else 0 +end +end + +do -- music/midi +local Bytes = require("@rosetta/core/Bytes") +S["music/midi"] = function(r: Bytes.Reader): number + if r:peek(4) == "MThd" then + return 1 + end + if r:peek(4) == "RIFF" and r:peek(4, 8) == "RMID" then + return 1 + end + return 0 +end +end + +do -- music/mod +local Bytes = require("@rosetta/core/Bytes") +local FIXED: { [string]: number } = { + ["M.K."] = 4, + ["M!K!"] = 4, + ["M&K!"] = 4, + ["N.T."] = 4, + ["FLT4"] = 4, + ["FLT8"] = 8, + ["CD81"] = 8, + ["OKTA"] = 8, + ["OCTA"] = 8, + ["EXO4"] = 4, + ["EXO8"] = 8, +} +local function signatureChannels(sig: string): number? + local fixed = FIXED[sig] + if fixed then + return fixed + end + local d = string.match(sig, "^(%d)CHN$") + if d then + local n = tonumber(d) :: number + return if n >= 1 then n else nil + end + local dd = string.match(sig, "^(%d%d)C[HN]$") + if dd then + local n = tonumber(dd) :: number + return if n >= 1 and n <= 32 then n else nil + end + local t = string.match(sig, "^TDZ(%d)$") + if t then + local n = tonumber(t) :: number + return if n >= 1 then n else nil + end + return nil +end +S["music/mod"] = function(r: Bytes.Reader): number + if r:size() < 1084 then + return 0 + end + local sig = r:peek(4, 1080) + if signatureChannels(sig) then + return 0.8 + end + return 0 +end +end + +do -- music/mtm +local Bytes = require("@rosetta/core/Bytes") +S["music/mtm"] = function(r: Bytes.Reader): number + if r:size() >= 66 and r:peek(3) == "MTM" and r:peekU8(3) < 0x20 and r:peekU8(33) >= 1 and r:peekU8(33) <= 32 then + return 1 + end + return 0 +end +end + +do -- music/mus +local Bytes = require("@rosetta/core/Bytes") +S["music/mus"] = function(r: Bytes.Reader): number + return if r:peek(4) == "MUS\x1a" then 1 else 0 +end +end + +do -- music/okt +local Bytes = require("@rosetta/core/Bytes") +S["music/okt"] = function(r: Bytes.Reader): number + return if r:peek(8) == "OKTASONG" then 1 else 0 +end +end + +do -- music/ptm +local Bytes = require("@rosetta/core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 608 or r:peek(4, 44) ~= "PTMF" or r:peekU8(28) ~= 26 or r:peekU8(30) > 2 then + return false + end + local h = r:sub(32, 10) + local nord, nsmp, npat, nch, flags = h:u16le(), h:u16le(), h:u16le(), h:u16le(), h:u16le() + return flags == 0 and nch >= 1 and nch <= 32 and nord >= 1 and nord <= 256 and nsmp >= 1 and nsmp <= 255 and npat >= 1 and npat <= 128 +end +S["music/ptm"] = function(r: Bytes.Reader): number + return if validHeader(r) then 1 else 0 +end +end + +do -- music/s3m +local Bytes = require("@rosetta/core/Bytes") +S["music/s3m"] = function(r: Bytes.Reader): number + if r:size() >= 48 and r:peek(4, 44) == "SCRM" then + return 1 + end + return 0 +end +end + +do -- music/sf2 +local Bytes = require("@rosetta/core/Bytes") +local SoundFont = lazy(function() + return require("@rosetta/codecs/audio/SoundFont") +end) +S["music/sf2"] = function(r: Bytes.Reader): number + return if SoundFont.sniff(r) then 1 else 0 +end +end + +do -- music/stm +local Bytes = require("@rosetta/core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 48 then + return false + end + local eof, ftype, major, minor = r:peekU8(28), r:peekU8(29), r:peekU8(30), r:peekU8(31) + local npat, gv = r:peekU8(33), r:peekU8(34) + if ftype ~= 2 or (eof ~= 0x1A and eof ~= 2) or major ~= 2 or (minor ~= 0 and minor ~= 10 and minor ~= 20 and minor ~= 21) then + return false + end + if npat > 64 or (gv > 64 and gv ~= 0x58) then + return false + end + for i = 20, 27 do + local c = r:peekU8(i) + if c < 0x20 or c >= 0x7F then + return false + end + end + return true +end +S["music/stm"] = function(r: Bytes.Reader): number + return if validHeader(r) then 0.7 else 0 +end +end + +do -- music/ult +local Bytes = require("@rosetta/core/Bytes") +S["music/ult"] = function(r: Bytes.Reader): number + local v = r:peekU8(14) + if r:size() >= 48 and r:peek(14) == "MAS_UTrack_V00" and v >= 0x31 and v <= 0x34 then + return 1 + end + return 0 +end +end + +do -- music/umx +local Bytes = require("@rosetta/core/Bytes") +local MAGIC = "\xC1\x83\x2A\x9E" +type Header = { version: number, nameCount: number, nameOffset: number, exportCount: number, exportOffset: number, importCount: number, importOffset: number } +local function header(r: Bytes.Reader): Header? + if r:size() < 36 or r:peek(4) ~= MAGIC then + return nil + end + local h = r:sub(4, 32) + local version = h:u16le() + h:skip(6) + local hd: Header = { + version = version, + nameCount = h:u32le(), + nameOffset = h:u32le(), + exportCount = h:u32le(), + exportOffset = h:u32le(), + importCount = h:u32le(), + importOffset = h:u32le(), + } + if h.err or hd.nameOffset < 36 or hd.exportOffset < 36 or hd.importOffset < 36 then + return nil + end + if hd.nameCount == 0 or hd.exportCount == 0 or hd.importCount == 0 or hd.nameCount > 2 ^ 20 or hd.exportCount > 2 ^ 20 or hd.importCount > 2 ^ 20 then + return nil + end + return hd +end +local function index(r: Bytes.Reader): number + local b = r:u8() + local neg = b >= 0x80 + local v = b % 64 + if bit32.band(b, 0x40) ~= 0 then + local shift = 6 + repeat + b = r:u8() + v += (b % 128) * 2 ^ shift + shift += 7 + until b < 0x80 or shift >= 32 + end + return if neg then -v else v +end +local function names(r: Bytes.Reader, h: Header): { string } + local list = {} + local nr = r:sub(h.nameOffset) + for _ = 1, math.min(h.nameCount, 65536) do + if nr:remaining() < 5 then + break + end + if h.version >= 64 then + index(nr) + end + table.insert(list, string.lower(nr:cstring(1024))) + nr:skip(4) + end + return list +end +S["music/umx"] = function(r: Bytes.Reader): number + local h = header(r) + if not h then + return 0 + end + return if table.find(names(r, h), "music") then 1 else 0.3 +end +end + +do -- music/xm +local Bytes = require("@rosetta/core/Bytes") +local MAGIC = "Extended Module: " +S["music/xm"] = function(r: Bytes.Reader): number + return if r:peek(17) == MAGIC then 1 else 0 +end +end + +do -- music/xmi +local Bytes = require("@rosetta/core/Bytes") +S["music/xmi"] = function(r: Bytes.Reader): number + local id, kind = r:peek(4), r:peek(4, 8) + if id == "FORM" and (kind == "XDIR" or kind == "XMID") then + return 1 + end + return if id == "CAT " and kind == "XMID" then 0.9 else 0 +end +end + +do -- playlist/m3u +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +S["playlist/m3u"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 512) + s = (string.match(s, "^%s*(.*)$") :: string) + if string.sub(s, 1, 7) == "#EXTM3U" then + return 0.95 + end + if string.find(s, "^#EXTINF:") or string.find(s, "^#EXT%-X%-") then + return 0.8 + end + return 0 +end +end + +do -- playlist/pls +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +local Text = lazy(function() + return require("@rosetta/codecs/text/Text") +end) +S["playlist/pls"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 64) + local first = string.match(s, "^%s*([^\r\n]*)") + return if first and string.lower(Text.trim(first)) == "[playlist]" then 0.95 else 0 +end +end + +do -- playlist/xspf +local Bytes = require("@rosetta/core/Bytes") +local NS = "http://xspf.org/ns/0/" +S["playlist/xspf"] = function(r: Bytes.Reader): number + local s = r:peek(1024) + local i = string.find(s, "<%w*:?playlist[%s>]") + if i and string.find(s, NS, 1, true) then + return 0.95 + end + return 0 +end +end + +return S diff --git a/src/Rosetta/codecs/image/Dct/init.luau b/src/Rosetta/codecs/image/Dct/init.luau index f8ce068..c661d8a 100644 --- a/src/Rosetta/codecs/image/Dct/init.luau +++ b/src/Rosetta/codecs/image/Dct/init.luau @@ -5,7 +5,7 @@ -- libjpeg's islow (jidctint.c / jfdctint.c), the reduced IDCTs (jidctred.c) and jcdctmgr.c's rounding quantiser, bit-exact -- with libjpeg-turbo. From jpeg-luau 1.0 (same author); IJG code: licenses/libjpeg-turbo-LICENSE.md. local readi16, readu16, writeu16, writeu32, readu8, writei16 = buffer.readi16, buffer.readu16, buffer.writeu16, buffer.writeu32, buffer.readu8, buffer.writei16 -local clamp = math.clamp +local clamp, abs, sign = math.clamp, math.abs, math.sign local Dct = {} @@ -384,18 +384,13 @@ end local fw = table.create(64, 0) -local function quant(coef: buffer, off: number, div: buffer, v: number, i: number) - local qv = readu16(div, i * 2) * 8 - local h = qv // 2 - if v < 0 then - writei16(coef, off + i * 2, -((h - v) // qv)) - else - writei16(coef, off + i * 2, (v + h) // qv) - end +-- (|v| + q * 4) // (q * 8) with v's sign, branch-free (a sign branch here gave LuaJIT side traces it could not compile) +local function quant(coef: buffer, off: number, qv: number, v: number, i: number) + writei16(coef, off + i * 2, (abs(v) + qv / 2) // qv * sign(v)) end --- quantised as jcdctmgr.c: (|v| + q * 4) // (q * 8) with the sign restored -function Dct.fdctQuantize(src: buffer, stride: number, x: number, y: number, w: number, h: number, div: buffer, coef: buffer, off: number) +-- quantised as jcdctmgr.c: (|v| + q * 4) // (q * 8) with the sign restored; div[i + 1] = q * 8 for natural index i +function Dct.fdctQuantize(src: buffer, stride: number, x: number, y: number, w: number, h: number, div: { number }, coef: buffer, off: number) local lastX, lastY = w - 1, h - 1 for r = 0, 7 do local row = math.min(y + r, lastY) * stride @@ -484,14 +479,14 @@ function Dct.fdctQuantize(src: buffer, stride: number, x: number, y: number, w: local o3 = (tmp6 + z2 + z3 + 16384) // 32768 local o1 = (tmp7 + z1 + z4 + 16384) // 32768 local cc = c - 1 - quant(coef, off, div, o0, cc) - quant(coef, off, div, o1, cc + 8) - quant(coef, off, div, o2, cc + 16) - quant(coef, off, div, o3, cc + 24) - quant(coef, off, div, o4, cc + 32) - quant(coef, off, div, o5, cc + 40) - quant(coef, off, div, o6, cc + 48) - quant(coef, off, div, o7, cc + 56) + quant(coef, off, div[c], o0, cc) + quant(coef, off, div[c + 8], o1, cc + 8) + quant(coef, off, div[c + 16], o2, cc + 16) + quant(coef, off, div[c + 24], o3, cc + 24) + quant(coef, off, div[c + 32], o4, cc + 32) + quant(coef, off, div[c + 40], o5, cc + 40) + quant(coef, off, div[c + 48], o6, cc + 48) + quant(coef, off, div[c + 56], o7, cc + 56) end end diff --git a/src/Rosetta/codecs/image/Jpeg/Encode.luau b/src/Rosetta/codecs/image/Jpeg/Encode.luau index c72711d..40d25a8 100644 --- a/src/Rosetta/codecs/image/Jpeg/Encode.luau +++ b/src/Rosetta/codecs/image/Jpeg/Encode.luau @@ -595,11 +595,11 @@ function Encode.run(px: buffer, w: number, h: number, bpp: number, o: Options): local qt = { Tables.quant(Tables.LUMA, o.quality), Tables.quant(Tables.CHROMA, o.quality) } local qdiv = {} for t = 1, 2 do - local b = buffer.create(128) + local d = table.create(64, 0) for i = 1, 64 do - writeu16(b, (i - 1) * 2, qt[t][i]) + d[i] = qt[t][i] * 8 end - qdiv[t] = b + qdiv[t] = d end local comps: { Comp } = {} diff --git a/src/Rosetta/init.luau b/src/Rosetta/init.luau index a0db2dd..b4eb96a 100644 --- a/src/Rosetta/init.luau +++ b/src/Rosetta/init.luau @@ -78,6 +78,56 @@ end local LATE: { [string]: number } = { br = 0.3 } -- archive/br: a trial decode of up to 256 KB +-- detection order: by the cost of a sniff (Registry.sniff: Sniffs.luau, Sniffs.luau reaching a codec, the format +-- module), then registry order; the costly LATE sniffs last +local order: { number }? = nil +local byExt: { [string]: { number } } = {} +local Sniffs: { [string]: (any) -> number }? = nil + +local function sniffOrder(): { number } + local o = order + if o then + return o + end + local list: { number } = {} + for idx, e in Registry do + table.insert(list, idx) + for _, x in e.extensions do + byExt[x] = byExt[x] or {} + table.insert(byExt[x], idx) + end + end + local function rank(idx: number): number + local e = Registry[idx] + return if LATE[e.name] then 3 else e.sniff + end + table.sort(list, function(a: number, b: number): boolean + local ra, rb = rank(a), rank(b) + if ra ~= rb then + return ra < rb + end + return a < b + end) + order = list + return list +end + +local function sniffer(e: Registry.Entry): ((any) -> number)? + if e.sniff < 2 then + local s = Sniffs + if not s then + s = require("@rosetta/Sniffs") :: any + Sniffs = s + end + local f = (s :: { [string]: (any) -> number })[e.path] + if f then + return f + end + end + local m = module(e) + return if m and type(m.sniff) == "function" then m.sniff else nil +end + local function detect(buf: buffer, name: string?, category: string?, format: string?): (Registry.Entry?, Err.Err?) if format then local e = find(format, category) @@ -87,52 +137,35 @@ local function detect(buf: buffer, name: string?, category: string?, format: str return e, nil end local ext = Input.extension(name) + local list = sniffOrder() + local hits = if ext then byExt[ext] else nil local best: Registry.Entry? = nil local bestScore, bestIdx = 0, 0 - -- sniffs score 0..1 (core/Sniff); the extension's format scoring 1 cannot be beaten. Formats with a costly sniff - -- (LATE: the most they score) run last, and only when they could still win; ties go to registry order. - local late: { number }? = nil - for idx, e in Registry do - if inCategory(e, category) and (e.caps.decode or e.caps.open) then - local cap = LATE[e.name] - if cap then - late = late or {} - table.insert(late :: { number }, idx) - continue - end - local m = module(e) - if m and m.sniff then - local ok, score = pcall(m.sniff, Bytes.reader(buf)) - if ok and type(score) == "number" and score > 0 then - local extHit = ext and table.find(e.extensions, ext) - if extHit then - score += 0.01 -- ties go to the extension - end - if score > bestScore then - best, bestScore, bestIdx = e, score, idx - if extHit and score >= 1.01 then - return e, nil - end - end + -- sniffs score 0..1 (core/Sniff), +0.01 for the extension's formats; the best wins, ties go to registry order. The + -- extension's formats run first, and a sniff runs only while its cap (1, or LATE) could still win. + for pass = 1, 2 do + local ids = if pass == 1 then hits else list + if ids then + for _, idx in ids do + if pass == 2 and bestScore > 1 then + break end - end - end - end - if late then - for _, idx in late do - local e = Registry[idx] - local extHit = ext and table.find(e.extensions, ext) - local cap = LATE[e.name] + (if extHit then 0.01 else 0) - if cap > bestScore or (cap == bestScore and idx < bestIdx) then - local m = module(e) - if m and m.sniff then - local ok, score = pcall(m.sniff, Bytes.reader(buf)) - if ok and type(score) == "number" and score > 0 then - if extHit then - score += 0.01 - end - if score > bestScore or (score == bestScore and idx < bestIdx) then - best, bestScore, bestIdx = e, score, idx + local e = Registry[idx] + local extHit = pass == 1 or (hits ~= nil and table.find(hits, idx) ~= nil) + if (pass == 1 or not extHit) and inCategory(e, category) and (e.caps.decode or e.caps.open) then + local cap = (LATE[e.name] or 1) + (if extHit then 0.01 else 0) + if cap > bestScore or (cap == bestScore and idx < bestIdx) then + local sniff = sniffer(e) + if sniff then + local ok, score = pcall(sniff, Bytes.reader(buf)) + if ok and type(score) == "number" and score > 0 then + if extHit then + score += 0.01 + end + if score > bestScore or (score == bestScore and idx < bestIdx) then + best, bestScore, bestIdx = e, score, idx + end + end end end end @@ -696,7 +729,7 @@ function F.detect(src: any, opts: Options?): (string?, Err.Err?) return nil, err end -- a format may name the file's flavour more precisely (video/mkv: "webm" for DocType webm) - local m = module(entry) + local m = if entry.variant then module(entry) else nil if m and type(m.variant) == "function" then local ok, v = pcall(m.variant, Bytes.reader(buf)) if ok and type(v) == "string" then diff --git a/tests/codecs/dct.luau b/tests/codecs/dct.luau index e5e4ac9..4cf4a85 100644 --- a/tests/codecs/dct.luau +++ b/tests/codecs/dct.luau @@ -71,8 +71,12 @@ do for i = 0, 63 do buffer.writeu16(q, i * 2, 1 + rand(40)) end + local div = table.create(64, 0) -- fdctQuantize's divisors: q * 8 + for i = 1, 64 do + div[i] = buffer.readu16(q, (i - 1) * 2) * 8 + end local coef = buffer.create(128) - Dct.fdctQuantize(src, 8, 0, 0, 8, 8, q, coef, 0) + Dct.fdctQuantize(src, 8, 0, 0, 8, 8, div, coef, 0) for v = 0, 7 do for u = 0, 7 do local s = 0 @@ -88,6 +92,7 @@ do end end t:check(worst <= 0.75, "fdct + quantise within rounding of the float reference: " .. worst) + local div1 = table.create(64, 8) local rt = 0 for _ = 1, 100 do local src = buffer.create(64) @@ -95,7 +100,7 @@ do buffer.writeu8(src, i, rand(256)) end local coef = buffer.create(128) - Dct.fdctQuantize(src, 8, 0, 0, 8, 8, ones, coef, 0) + Dct.fdctQuantize(src, 8, 0, 0, 8, 8, div1, coef, 0) local plane = buffer.create(128) Dct.idctBlock(coef, 0, ones, plane, 0, 8, 2, 128, 255) for i = 0, 63 do @@ -112,8 +117,8 @@ do end end local a, b = buffer.create(128), buffer.create(128) - Dct.fdctQuantize(small, 3, 0, 0, 3, 2, ones, a, 0) - Dct.fdctQuantize(ext, 8, 0, 0, 8, 8, ones, b, 0) + Dct.fdctQuantize(small, 3, 0, 0, 3, 2, div1, a, 0) + Dct.fdctQuantize(ext, 8, 0, 0, 8, 8, div1, b, 0) t:check(buffer.tostring(a) == buffer.tostring(b), "edge replication") end diff --git a/tests/detect.luau b/tests/detect.luau new file mode 100644 index 0000000..c6054f6 --- /dev/null +++ b/tests/detect.luau @@ -0,0 +1,210 @@ +-- detect tests: lazy detection (Sniffs.luau, cost order, extension first) against the eager reference (every format +-- module's own sniff, registry order) on samples of every fixture module, with and without names and categories; +-- which modules a first detect loads. Fixtures: tools/fixtures/detect.py. +local T = require("@tests/T") +local Registry = require("@rosetta/Registry") + +local loads: { string } = {} +for _, e in Registry do + local load = e.load + e.load = function(): any + table.insert(loads, e.path) + return load() + end +end + +local F = require("@rosetta") +local Bytes = require("@rosetta/core/Bytes") +local Input = require("@rosetta/core/Input") +local Sniffs = require("@rosetta/Sniffs") +local Blobs1 = require("@tests/gen/detect_blobs_1") +local Blobs2 = require("@tests/gen/detect_blobs_2") +local Blobs3 = require("@tests/gen/detect_blobs_3") +local Blobs4 = require("@tests/gen/detect_blobs_4") + +local t = T.suite("detect") + +-- 1. a first detect of a PNG loads no format module, with or without its name +local PNG = buffer.fromstring("\137PNG\r\n\26\n\0\0\0\rIHDR\0\0\0\1\0\0\0\1\8\6\0\0\0\31\21\196\137\0\0\0\rIDATx\218c\248\255\255?\0\5\254\2\254\167\53\129\132\0\0\0\0IEND\174B`\130") +t:eq(F.detect(PNG, { name = "a.png" }), "png", "png with name") +t:eq(F.detect(PNG), "png", "png without name") +t:eq(F.detect(PNG, { name = "a.jpg" }), "png", "png named .jpg") +t:eq(#loads, 0, "no format module loaded (" .. table.concat(loads, " ") .. ")") +local junk = buffer.create(4096) +for i = 0, 4095 do + buffer.writeu8(junk, i, (i * 7919) % 251) +end +F.detect(junk) +local need = 0 +for _, e in Registry do + if e.sniff == 2 then + need += 1 + end +end +t:check(#loads <= need + 1, "unknown data loads only the modules that sniff themselves: " .. table.concat(loads, " ")) +t:note("unknown data: %d format modules loaded (%s)", #loads, table.concat(loads, " ")) + +-- 2. the eager reference: each module's own sniff in registry order, the extension's format at 1 returns at once, +-- archive/br (a trial decode, at most 0.3) last +local modules: { [string]: any } = {} +for _, e in Registry do + modules[e.path] = e.load() +end + +local function refDetect(buf: buffer, name: string?, category: string?): any + local ext = Input.extension(name) + local best, bestScore, bestIdx = nil, 0, 0 + local late: { number } = {} + for idx, e in Registry do + if (category == nil or e.category == category) and (e.caps.decode or e.caps.open) then + if e.name == "br" then + table.insert(late, idx) + continue + end + local ok, score = pcall(modules[e.path].sniff, Bytes.reader(buf)) + if ok and type(score) == "number" and score > 0 then + local extHit = ext and table.find(e.extensions, ext) + if extHit then + score += 0.01 + end + if score > bestScore then + best, bestScore, bestIdx = e, score, idx + if extHit and score >= 1.01 then + return e + end + end + end + end + end + for _, idx in late do + local e = Registry[idx] + local extHit = ext and table.find(e.extensions, ext) + local cap = 0.3 + (if extHit then 0.01 else 0) + if cap > bestScore or (cap == bestScore and idx < bestIdx) then + local ok, score = pcall(modules[e.path].sniff, Bytes.reader(buf)) + if ok and type(score) == "number" and score > 0 then + if extHit then + score += 0.01 + end + if score > bestScore or (score == bestScore and idx < bestIdx) then + best, bestScore, bestIdx = e, score, idx + end + end + end + end + if best then + return best + end + if ext then + for _, e in Registry do + if (category == nil or e.category == category) and e.name == ext then + return e + end + end + for _, e in Registry do + if (category == nil or e.category == category) and table.find(e.extensions, ext) then + return e + end + end + end + return nil +end + +local function refName(buf: buffer, name: string?, category: string?): string? + local e = refDetect(buf, name, category) + if not e then + return nil + end + local m = modules[e.path] + if type(m.variant) == "function" then + local ok, v = pcall(m.variant, Bytes.reader(buf)) + if ok and type(v) == "string" then + return v + end + end + return e.name +end + +local blobs: { { from: string, data: string } } = {} +for _, part in { Blobs1, Blobs2, Blobs3, Blobs4 } do + for _, b in part :: any do + table.insert(blobs, b) + end +end +local rng = T.rng(7) +for n = 0, 40 do + local b = buffer.create(n * 7) + for i = 0, n * 7 - 1 do + buffer.writeu8(b, i, rng(256) - 1) + end + table.insert(blobs, { from = "random", data = buffer.tostring(b) }) +end +table.insert(blobs, { from = "junk", data = buffer.tostring(junk) }) +table.insert(blobs, { from = "png", data = buffer.tostring(PNG) }) +t:check(#blobs > 1000, "samples from the fixture modules (" .. #blobs .. ")") + +-- 3. every copied sniff scores as the module's own, and every score is in 0..1 (the cost order relies on it) +local copied, diff, over = 0, 0, 0 +for _, e in Registry do + local s = (Sniffs :: any)[e.path] + t:eq(s ~= nil, e.sniff < 2, e.path .. ": in Sniffs.luau as Registry.sniff says") + if s then + copied += 1 + end +end +for _, b in blobs do + local buf = buffer.fromstring(b.data) + for _, e in Registry do + local own = modules[e.path].sniff + local ok1, s1 = pcall(own, Bytes.reader(buf)) + if ok1 and type(s1) == "number" and s1 > 1 then + over += 1 + t:note("%s scores %s on a sample of %s", e.path, tostring(s1), b.from) + end + local s = (Sniffs :: any)[e.path] + if s then + local ok2, s2 = pcall(s, Bytes.reader(buf)) + if ok1 ~= ok2 or (ok1 and s1 ~= s2) then + diff += 1 + if diff <= 10 then + t:note("%s on a sample of %s: module %s, copy %s", e.path, b.from, tostring(s1), tostring(s2)) + end + end + end + end +end +t:eq(diff, 0, "copied sniffs score as the modules do") +t:eq(over, 0, "no sniff scores over 1") + +-- 4. F.detect = the reference: no name, the reference's own extension, a wrong one, an unknown one; and per category +local runs, mismatch = 0, 0 +local function same(buf: buffer, from: string, name: string?, category: string?) + local want = refName(buf, name, category) + local got = F.detect(buf, { name = name, category = category }) + runs += 1 + if got ~= want then + mismatch += 1 + if mismatch <= 10 then + t:note("sample of %s, name %s, category %s: got %s, want %s", from, tostring(name), tostring(category), tostring(got), tostring(want)) + end + end +end +for _, b in blobs do + local buf = buffer.fromstring(b.data) + same(buf, b.from, nil, nil) + local e = refDetect(buf, nil, nil) + if e then + same(buf, b.from, "x." .. e.extensions[1], nil) + same(buf, b.from, nil, e.category) + end + same(buf, b.from, "x.png", nil) + same(buf, b.from, "x.txt", nil) + same(buf, b.from, "x.bin", "audio") +end +t:eq(mismatch, 0, "F.detect matches the eager reference (" .. runs .. " detects)") +t:note("%d samples, %d detects, %d of %d sniffs copied into Sniffs.luau", #blobs, runs, copied, #Registry) + +t:fuzz("detect", function(b: buffer): any + return F.detect(b) +end, { PNG, junk }) +t:done() diff --git a/tools/bench.sh b/tools/bench.sh index 920cd8b..d3d4e67 100644 --- a/tools/bench.sh +++ b/tools/bench.sh @@ -2,7 +2,9 @@ # Timings (bash tools/bench.sh [core [filter]]): tools/bench.luau under luau --codegen -O2 and under LuaJIT (the module build, # build/_modules/luajit). "core" runs tools/bench_core.luau (inflate / deflate, checksums, rbxm / rbxmx, json / xml, # F.detect, gltf / obj, the other decompressors) under luau -O2, luau --codegen -O2 and LuaJIT; a filter keeps the lines -# whose label contains it. +# whose label contains it. "mixed" (LuaJIT only) runs tools/bench_image.luau and tools/bench_video.luau each on its own, +# then tools/bench_mixed.luau: core, audio, video and image in one process, marking the lines that run more than 1.3x +# slower there (trace pollution between codecs). cd "$(dirname "$0")/.." || exit 1 LUAU=${LUAU:-$(command -v luau || nix shell nixpkgs#luau -c sh -c 'command -v luau')} LUAJIT=${LUAJIT:-$(command -v luajit || nix shell nixpkgs#luajit -c sh -c 'command -v luajit')} @@ -15,5 +17,15 @@ if [ "$1" = core ]; then "$LUAJIT" -e "$LJPATH" build/_modules/luajit/tools/bench_core.lua "$2" exit 0 fi +if [ "$1" = mixed ]; then + tmp=$(mktemp -d) + for s in image video; do + "$LUAJIT" -e "$LJPATH" build/_modules/luajit/tools/bench_$s.lua > "$tmp/$s" || exit 1 + done + "$LUAJIT" -e "$LJPATH" build/_modules/luajit/tools/bench_mixed.lua "$tmp/image" "$tmp/video" + status=$? + rm -r "$tmp" + exit $status +fi "$LUAU" --codegen -O2 tools/bench.luau "$LUAJIT" -e "$LJPATH" build/_modules/luajit/tools/bench.lua diff --git a/tools/bench_mixed.luau b/tools/bench_mixed.luau new file mode 100644 index 0000000..aebcfb4 --- /dev/null +++ b/tools/bench_mixed.luau @@ -0,0 +1,85 @@ +-- Mixed-workload check (bash tools/bench.sh mixed), LuaJIT only: bench_core, bench_audio, bench_video and bench_image +-- in one process, as an app that decodes many formats runs them, the video and image lines against each bench run +-- alone (the files of its arguments, written by bench.sh). LuaJIT's traces, blacklists and penalties are per process: +-- a shared helper blacklisted by one codec, or a side trace that never compiles, slows every later caller, which the +-- per-codec benches never show. Lines more than 1.3x slower mixed than alone are marked. +local jit = (_G :: any).jit +if jit == nil then + print("bench_mixed: LuaJIT only (bash tools/bench.sh mixed)") + return +end +local G = _G :: any +local loadfile, io = G.loadfile, G.io +local imageAlone, videoAlone = ... + +-- "luajit