diff --git a/build/Rosetta.luau b/build/Rosetta.luau index 30d5dab..0803796 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 diff --git a/build/Rosetta.luau.linemap.json b/build/Rosetta.luau.linemap.json index 740e512..8eecfd5 100644 --- a/build/Rosetta.luau.linemap.json +++ b/build/Rosetta.luau.linemap.json @@ -1,618 +1,619 @@ [ [29, "src/Rosetta/init.luau"], -[913, "src/Rosetta/Registry.luau"], -[3322, "src/Rosetta/Types.luau"], -[4435, "src/Rosetta/archive/7z/init.luau"], -[4820, "src/Rosetta/archive/7z/Header.luau"], -[5347, "src/Rosetta/archive/adf/init.luau"], -[5629, "src/Rosetta/archive/applesingle/init.luau"], -[5815, "src/Rosetta/archive/ar/init.luau"], -[6218, "src/Rosetta/archive/arj/init.luau"], -[6428, "src/Rosetta/archive/binhex/init.luau"], -[6677, "src/Rosetta/archive/br/init.luau"], -[6752, "src/Rosetta/archive/bz2/init.luau"], -[6816, "src/Rosetta/archive/cab/init.luau"], -[7229, "src/Rosetta/archive/cab/Sum.luau"], -[7270, "src/Rosetta/archive/cpio/init.luau"], -[7438, "src/Rosetta/archive/d64/init.luau"], -[7852, "src/Rosetta/archive/fat/init.luau"], -[7974, "src/Rosetta/archive/grp/init.luau"], -[8088, "src/Rosetta/archive/gzip/init.luau"], -[8273, "src/Rosetta/archive/iso/init.luau"], -[8345, "src/Rosetta/archive/lha/init.luau"], -[8770, "src/Rosetta/archive/lz4/init.luau"], -[9114, "src/Rosetta/archive/macbinary/init.luau"], -[9312, "src/Rosetta/archive/mpq/init.luau"], -[9718, "src/Rosetta/archive/mpq/Crypt.luau"], -[9783, "src/Rosetta/archive/pak/init.luau"], -[9917, "src/Rosetta/archive/rpm/init.luau"], -[10241, "src/Rosetta/archive/tar/init.luau"], -[10359, "src/Rosetta/archive/unitypackage/init.luau"], -[10595, "src/Rosetta/archive/uu/init.luau"], -[10865, "src/Rosetta/archive/vpk/init.luau"], -[11176, "src/Rosetta/archive/vswap/init.luau"], -[11446, "src/Rosetta/archive/wad/init.luau"], -[11900, "src/Rosetta/archive/wad/Picture.luau"], -[12002, "src/Rosetta/archive/wad2/init.luau"], -[12284, "src/Rosetta/archive/xz/init.luau"], -[12384, "src/Rosetta/archive/yenc/init.luau"], -[12656, "src/Rosetta/archive/z/init.luau"], -[12752, "src/Rosetta/archive/zip/init.luau"], -[12971, "src/Rosetta/archive/zoo/init.luau"], -[13167, "src/Rosetta/archive/zst/init.luau"], -[13231, "src/Rosetta/audio/aac/init.luau"], -[13444, "src/Rosetta/audio/ac3/init.luau"], -[13591, "src/Rosetta/audio/adpcm/init.luau"], -[13737, "src/Rosetta/audio/adx/init.luau"], -[13969, "src/Rosetta/audio/aiff/init.luau"], -[14361, "src/Rosetta/audio/ape/init.luau"], -[14490, "src/Rosetta/audio/au/init.luau"], -[14652, "src/Rosetta/audio/brstm/init.luau"], -[14944, "src/Rosetta/audio/caf/init.luau"], -[15611, "src/Rosetta/audio/flac/init.luau"], -[15760, "src/Rosetta/audio/flac/Meta.luau"], -[15982, "src/Rosetta/audio/flac/Stream.luau"], -[16352, "src/Rosetta/audio/m4a/init.luau"], -[16695, "src/Rosetta/audio/mp3/init.luau"], -[16956, "src/Rosetta/audio/mp3/Index.luau"], -[17147, "src/Rosetta/audio/mp3/Stream.luau"], -[17374, "src/Rosetta/audio/mp3/Tags.luau"], -[17686, "src/Rosetta/audio/mpc/init.luau"], -[17781, "src/Rosetta/audio/opus/init.luau"], -[18160, "src/Rosetta/audio/opus/Encode.luau"], -[18272, "src/Rosetta/audio/qoa/init.luau"], -[18453, "src/Rosetta/audio/tta/init.luau"], -[18572, "src/Rosetta/audio/vag/init.luau"], -[18796, "src/Rosetta/audio/voc/init.luau"], -[19072, "src/Rosetta/audio/vorbis/init.luau"], -[19527, "src/Rosetta/audio/vorbis/Encode.luau"], -[20340, "src/Rosetta/audio/wav/init.luau"], -[20961, "src/Rosetta/audio/wav/Codecs.luau"], -[21140, "src/Rosetta/audio/wavpack/init.luau"], -[21348, "src/Rosetta/cad/step/init.luau"], -[21730, "src/Rosetta/cad/step/Brep.luau"], -[21965, "src/Rosetta/cad/step/Parse.luau"], -[22522, "src/Rosetta/cad/step/Write.luau"], -[22770, "src/Rosetta/codecs/audio/Aac/init.luau"], -[23178, "src/Rosetta/codecs/audio/Aac/Decode.luau"], -[24154, "src/Rosetta/codecs/audio/Aac/Ps.luau"], -[24744, "src/Rosetta/codecs/audio/Aac/Sbr.luau"], -[25811, "src/Rosetta/codecs/audio/Aac/SbrBits.luau"], -[25930, "src/Rosetta/codecs/audio/Aac/SbrDct.luau"], -[27172, "src/Rosetta/codecs/audio/Aac/SbrHf.luau"], -[27664, "src/Rosetta/codecs/audio/Aac/SbrQmf.luau"], -[27781, "src/Rosetta/codecs/audio/Aac/SbrTables.luau"], -[28194, "src/Rosetta/codecs/audio/Aac/Tables.luau"], -[28530, "src/Rosetta/codecs/audio/Ac3/init.luau"], -[28690, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], -[29575, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], -[29677, "src/Rosetta/codecs/audio/Adpcm/init.luau"], -[30431, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], -[30734, "src/Rosetta/codecs/audio/Alac/init.luau"], -[30969, "src/Rosetta/codecs/audio/Alac/Decode.luau"], -[31388, "src/Rosetta/codecs/audio/Alac/Encode.luau"], -[31800, "src/Rosetta/codecs/audio/Ape/init.luau"], -[32016, "src/Rosetta/codecs/audio/Ape/Decode.luau"], -[32777, "src/Rosetta/codecs/audio/ApeTag.luau"], -[32875, "src/Rosetta/codecs/audio/Flac/init.luau"], -[32887, "src/Rosetta/codecs/audio/Flac/Encode.luau"], -[33836, "src/Rosetta/codecs/audio/Flac/Frame.luau"], -[34456, "src/Rosetta/codecs/audio/Hively/init.luau"], -[34653, "src/Rosetta/codecs/audio/Hively/Load.luau"], -[34903, "src/Rosetta/codecs/audio/Hively/Player.luau"], -[35862, "src/Rosetta/codecs/audio/Hively/Tables.luau"], -[36082, "src/Rosetta/codecs/audio/Mdct/init.luau"], -[36302, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], -[36556, "src/Rosetta/codecs/audio/MidiRender.luau"], -[36903, "src/Rosetta/codecs/audio/Mpa/init.luau"], -[36918, "src/Rosetta/codecs/audio/Mpa/Analysis.luau"], -[36977, "src/Rosetta/codecs/audio/Mpa/Core.luau"], -[38635, "src/Rosetta/codecs/audio/Mpa/EncTables.luau"], -[38928, "src/Rosetta/codecs/audio/Mpa/Encode2.luau"], -[39313, "src/Rosetta/codecs/audio/Mpa/Encode3.luau"], -[39954, "src/Rosetta/codecs/audio/Mpa/Header.luau"], -[40095, "src/Rosetta/codecs/audio/Mpa/Tables.luau"], -[40322, "src/Rosetta/codecs/audio/Musepack/init.luau"], -[40668, "src/Rosetta/codecs/audio/Musepack/Decode.luau"], -[41562, "src/Rosetta/codecs/audio/Musepack/Tables.luau"], -[41941, "src/Rosetta/codecs/audio/Opus/init.luau"], -[41956, "src/Rosetta/codecs/audio/Opus/Celt.luau"], -[43828, "src/Rosetta/codecs/audio/Opus/CeltEncoder.luau"], -[44893, "src/Rosetta/codecs/audio/Opus/CeltTables.luau"], -[44954, "src/Rosetta/codecs/audio/Opus/Decoder.luau"], -[45418, "src/Rosetta/codecs/audio/Opus/Mdct.luau"], -[45769, "src/Rosetta/codecs/audio/Opus/Packet.luau"], -[46002, "src/Rosetta/codecs/audio/Opus/Silk.luau"], -[48044, "src/Rosetta/codecs/audio/Opus/SilkTables.luau"], -[48418, "src/Rosetta/codecs/audio/Pcm/init.luau"], -[48682, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], -[48979, "src/Rosetta/codecs/audio/Qoa/init.luau"], -[49261, "src/Rosetta/codecs/audio/Resample/init.luau"], -[49656, "src/Rosetta/codecs/audio/SoundFont/init.luau"], -[49711, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], -[49855, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], -[50369, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"], -[51168, "src/Rosetta/codecs/audio/Stream.luau"], -[51330, "src/Rosetta/codecs/audio/Tracker/init.luau"], -[51813, "src/Rosetta/codecs/audio/Tracker/Load.luau"], -[52092, "src/Rosetta/codecs/audio/Tracker/Mixer.luau"], -[52339, "src/Rosetta/codecs/audio/Tracker/Pcm.luau"], -[52468, "src/Rosetta/codecs/audio/Tracker/Player.luau"], -[54457, "src/Rosetta/codecs/audio/Tracker/Tables.luau"], -[54574, "src/Rosetta/codecs/audio/Tta/init.luau"], -[54692, "src/Rosetta/codecs/audio/Tta/Decode.luau"], -[54944, "src/Rosetta/codecs/audio/Vorbis/init.luau"], -[54958, "src/Rosetta/codecs/audio/Vorbis/Codebook.luau"], -[55342, "src/Rosetta/codecs/audio/Vorbis/Packet.luau"], -[55915, "src/Rosetta/codecs/audio/Vorbis/Setup.luau"], -[56337, "src/Rosetta/codecs/audio/Vorbis/Tables.luau"], -[56377, "src/Rosetta/codecs/audio/VorbisComment.luau"], -[56430, "src/Rosetta/codecs/audio/WavPack/init.luau"], -[56653, "src/Rosetta/codecs/audio/WavPack/Block.luau"], -[58108, "src/Rosetta/codecs/audio/WavPack/Tables.luau"], -[58171, "src/Rosetta/codecs/compress/Brotli/init.luau"], -[58258, "src/Rosetta/codecs/compress/Brotli/Decode.luau"], -[59234, "src/Rosetta/codecs/compress/Brotli/Static.luau"], -[60102, "src/Rosetta/codecs/compress/Bzip2/init.luau"], -[60146, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], -[60659, "src/Rosetta/codecs/compress/Deflate/init.luau"], -[60985, "src/Rosetta/codecs/compress/Deflate/Compress.luau"], -[61467, "src/Rosetta/codecs/compress/Deflate/Inflate.luau"], -[61915, "src/Rosetta/codecs/compress/Explode.luau"], -[62111, "src/Rosetta/codecs/compress/Lz4.luau"], -[62380, "src/Rosetta/codecs/compress/Lzh/init.luau"], -[62984, "src/Rosetta/codecs/compress/Lzma/init.luau"], -[63524, "src/Rosetta/codecs/compress/Lzma/Crc64.luau"], -[63591, "src/Rosetta/codecs/compress/Lzma/Decode.luau"], -[64064, "src/Rosetta/codecs/compress/Lzma/Filters.luau"], -[64240, "src/Rosetta/codecs/compress/Lzw/init.luau"], -[64508, "src/Rosetta/codecs/compress/Lzx.luau"], -[64942, "src/Rosetta/codecs/compress/PackBits.luau"], -[65032, "src/Rosetta/codecs/compress/Quantum.luau"], -[65269, "src/Rosetta/codecs/compress/UnixCompress.luau"], -[65573, "src/Rosetta/codecs/compress/Xxh32.luau"], -[65642, "src/Rosetta/codecs/compress/Zstd/init.luau"], -[65699, "src/Rosetta/codecs/compress/Zstd/Decode.luau"], -[66683, "src/Rosetta/codecs/compress/Zstd/Xxh64.luau"], -[66835, "src/Rosetta/codecs/entropy/Huffman.luau"], -[67122, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], -[67133, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], -[67354, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.luau"], -[67598, "src/Rosetta/codecs/font/Bitmap.luau"], -[67799, "src/Rosetta/codecs/font/Cff/init.luau"], -[68440, "src/Rosetta/codecs/font/GlyphNames.luau"], -[68590, "src/Rosetta/codecs/font/TrueType/init.luau"], -[68904, "src/Rosetta/codecs/font/TrueType/Glyf.luau"], -[69296, "src/Rosetta/codecs/font/TrueType/Tables.luau"], -[69798, "src/Rosetta/codecs/image/Bcn/init.luau"], -[69905, "src/Rosetta/codecs/image/Bcn/Decode.luau"], -[70389, "src/Rosetta/codecs/image/Bcn/Encode.luau"], -[70818, "src/Rosetta/codecs/image/Blend.luau"], -[71197, "src/Rosetta/codecs/image/Dct/init.luau"], -[71697, "src/Rosetta/codecs/image/Etc.luau"], -[71995, "src/Rosetta/codecs/image/Half.luau"], -[72064, "src/Rosetta/codecs/image/Jpeg/init.luau"], -[72418, "src/Rosetta/codecs/image/Jpeg/Arith.luau"], -[72826, "src/Rosetta/codecs/image/Jpeg/Color.luau"], -[73191, "src/Rosetta/codecs/image/Jpeg/Decode.luau"], -[73956, "src/Rosetta/codecs/image/Jpeg/Encode.luau"], -[74837, "src/Rosetta/codecs/image/Jpeg/Scan.luau"], -[75306, "src/Rosetta/codecs/image/Jpeg/Tables.luau"], -[75384, "src/Rosetta/codecs/image/Jpeg/Yuv.luau"], -[75451, "src/Rosetta/codecs/image/Miptex.luau"], -[75751, "src/Rosetta/codecs/image/Pixels.luau"], -[76071, "src/Rosetta/codecs/image/Quantize/init.luau"], -[76532, "src/Rosetta/codecs/image/Raster.luau"], -[77229, "src/Rosetta/codecs/image/Texel.luau"], -[77602, "src/Rosetta/codecs/image/Texture.luau"], -[77747, "src/Rosetta/codecs/image/Vp8/init.luau"], -[77878, "src/Rosetta/codecs/image/Vp8/Decode.luau"], -[79834, "src/Rosetta/codecs/image/Vp8/Predict.luau"], -[80097, "src/Rosetta/codecs/image/Vp8/Tables.luau"], -[80347, "src/Rosetta/codecs/image/Vp8/Yuv.luau"], -[80489, "src/Rosetta/codecs/image/Vp8L/init.luau"], -[80593, "src/Rosetta/codecs/image/Vp8L/Decode.luau"], -[81533, "src/Rosetta/codecs/image/Vp8L/Encode.luau"], -[82485, "src/Rosetta/codecs/image/Yuv.luau"], -[82790, "src/Rosetta/codecs/model/Brush.luau"], -[83430, "src/Rosetta/codecs/model/Displacement.luau"], -[83579, "src/Rosetta/codecs/model/DoomMap/init.luau"], -[84024, "src/Rosetta/codecs/model/DoomMap/Udmf.luau"], -[84274, "src/Rosetta/codecs/model/Draco/init.luau"], -[84606, "src/Rosetta/codecs/model/Draco/Attributes.luau"], -[85075, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], -[86264, "src/Rosetta/codecs/model/Draco/Int64.luau"], -[86413, "src/Rosetta/codecs/model/Draco/KdTree.luau"], -[86772, "src/Rosetta/codecs/model/Draco/Predict.luau"], -[87734, "src/Rosetta/codecs/model/Draco/Reader.luau"], -[88208, "src/Rosetta/codecs/model/Mat4.luau"], -[88467, "src/Rosetta/codecs/model/MeshFlatten.luau"], -[88995, "src/Rosetta/codecs/model/Minecraft/init.luau"], -[89547, "src/Rosetta/codecs/model/Minecraft/Colors.luau"], -[89626, "src/Rosetta/codecs/model/Minecraft/Legacy.luau"], -[89733, "src/Rosetta/codecs/model/Minecraft/Packed.luau"], -[89939, "src/Rosetta/codecs/model/Patch.luau"], -[90063, "src/Rosetta/codecs/model/Polygon.luau"], -[90297, "src/Rosetta/codecs/model/Rbx/init.luau"], -[90534, "src/Rosetta/codecs/model/Rbx/Binary.luau"], -[91288, "src/Rosetta/codecs/model/Rig.luau"], -[91531, "src/Rosetta/codecs/model/Sampler.luau"], -[91691, "src/Rosetta/codecs/model/SourceAnim.luau"], -[91912, "src/Rosetta/codecs/model/Vrml/init.luau"], -[92060, "src/Rosetta/codecs/model/Vrml/Build.luau"], -[92634, "src/Rosetta/codecs/model/Vrml/Fields.luau"], -[92797, "src/Rosetta/codecs/model/Vrml/Geometry.luau"], -[93546, "src/Rosetta/codecs/model/Vrml/Parse.luau"], -[94068, "src/Rosetta/codecs/model/Vrml/Write.luau"], -[94795, "src/Rosetta/codecs/model/Vrml/Xml.luau"], -[95027, "src/Rosetta/codecs/text/GodotVariant.luau"], -[95686, "src/Rosetta/codecs/text/Json/init.luau"], -[95955, "src/Rosetta/codecs/text/Json/Decode.luau"], -[96390, "src/Rosetta/codecs/text/Json/Encode.luau"], -[96735, "src/Rosetta/codecs/text/KeyValues/init.luau"], -[97305, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], -[97611, "src/Rosetta/codecs/text/Lexer/init.luau"], -[97743, "src/Rosetta/codecs/text/Nbt/init.luau"], -[98096, "src/Rosetta/codecs/text/Nbt/Binary.luau"], -[98788, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], -[99428, "src/Rosetta/codecs/text/Nbt/Value.luau"], -[99666, "src/Rosetta/codecs/text/Text/init.luau"], -[99757, "src/Rosetta/codecs/text/Url/init.luau"], -[99962, "src/Rosetta/codecs/text/Xml/init.luau"], -[100412, "src/Rosetta/codecs/text/Xml/Parse.luau"], -[101216, "src/Rosetta/codecs/video/Dsp.luau"], -[102054, "src/Rosetta/codecs/video/H263/init.luau"], -[102211, "src/Rosetta/codecs/video/H263/Decoder.luau"], -[103069, "src/Rosetta/codecs/video/H263/Tables.luau"], -[103273, "src/Rosetta/codecs/video/H264/init.luau"], -[103647, "src/Rosetta/codecs/video/H264/Bitstream.luau"], -[103922, "src/Rosetta/codecs/video/H264/Cabac.luau"], -[105053, "src/Rosetta/codecs/video/H264/Cavlc.luau"], -[105821, "src/Rosetta/codecs/video/H264/Deblock.luau"], -[106083, "src/Rosetta/codecs/video/H264/Decoder.luau"], -[107093, "src/Rosetta/codecs/video/H264/Inter.luau"], -[107419, "src/Rosetta/codecs/video/H264/Intra.luau"], -[107826, "src/Rosetta/codecs/video/H264/Mb.luau"], -[108765, "src/Rosetta/codecs/video/H264/Params.luau"], -[109213, "src/Rosetta/codecs/video/H264/Slice.luau"], -[109465, "src/Rosetta/codecs/video/H264/Tables.luau"], -[109507, "src/Rosetta/codecs/video/H264/Transform.luau"], -[109672, "src/Rosetta/codecs/video/Legacy/init.luau"], -[109871, "src/Rosetta/codecs/video/Legacy/Cinepak.luau"], -[110168, "src/Rosetta/codecs/video/Legacy/Flic.luau"], -[110535, "src/Rosetta/codecs/video/Legacy/Msvideo1.luau"], -[110653, "src/Rosetta/codecs/video/Legacy/Picture.luau"], -[110761, "src/Rosetta/codecs/video/Legacy/QtRle.luau"], -[111034, "src/Rosetta/codecs/video/Legacy/Smacker.luau"], -[111429, "src/Rosetta/codecs/video/Legacy/Smc.luau"], -[111606, "src/Rosetta/codecs/video/Mpeg1/init.luau"], -[111619, "src/Rosetta/codecs/video/Mpeg2/init.luau"], -[111987, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], -[113514, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], -[113654, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"], -[113793, "src/Rosetta/codecs/video/Theora/init.luau"], -[114057, "src/Rosetta/codecs/video/Theora/Decoder.luau"], -[115321, "src/Rosetta/codecs/video/Theora/Header.luau"], -[115685, "src/Rosetta/codecs/video/Video/init.luau"], -[116243, "src/Rosetta/codecs/video/Video/Source.luau"], -[116529, "src/Rosetta/containers/Archive.luau"], -[116796, "src/Rosetta/containers/AudioWrap.luau"], -[117306, "src/Rosetta/containers/Avi/init.luau"], -[117859, "src/Rosetta/containers/Blend.luau"], -[118598, "src/Rosetta/containers/Chunks.luau"], -[118733, "src/Rosetta/containers/Cpio.luau"], -[119161, "src/Rosetta/containers/Demux.luau"], -[119436, "src/Rosetta/containers/Ebml/init.luau"], -[119750, "src/Rosetta/containers/Fat.luau"], -[120438, "src/Rosetta/containers/Iso9660.luau"], -[120943, "src/Rosetta/containers/IsoBmff/init.luau"], -[121114, "src/Rosetta/containers/IsoBmff/Box.luau"], -[121303, "src/Rosetta/containers/IsoBmff/Demux.luau"], -[122149, "src/Rosetta/containers/IsoBmff/Meta.luau"], -[122671, "src/Rosetta/containers/IsoBmff/Mux.luau"], -[123188, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], -[123306, "src/Rosetta/containers/MacFile.luau"], -[123455, "src/Rosetta/containers/MpegEs.luau"], -[123622, "src/Rosetta/containers/MpegPs/init.luau"], -[123843, "src/Rosetta/containers/MpegTs/init.luau"], -[124636, "src/Rosetta/containers/Ogg/init.luau"], -[125061, "src/Rosetta/containers/Ogg/Mux.luau"], -[125250, "src/Rosetta/containers/Ogg/Page.luau"], -[125416, "src/Rosetta/containers/Riff/init.luau"], -[125733, "src/Rosetta/containers/Tar.luau"], -[126147, "src/Rosetta/containers/Zip/init.luau"], -[126779, "src/Rosetta/core/Adler32.luau"], -[126839, "src/Rosetta/core/Base64.luau"], -[127067, "src/Rosetta/core/Bits.luau"], -[127360, "src/Rosetta/core/Bytes.luau"], -[127887, "src/Rosetta/core/Crc16.luau"], -[127939, "src/Rosetta/core/Crc32.luau"], -[128090, "src/Rosetta/core/Err.luau"], -[128172, "src/Rosetta/core/Input.luau"], -[128248, "src/Rosetta/core/Md5.luau"], -[128406, "src/Rosetta/core/Sniff.luau"], -[128435, "src/Rosetta/data/cbor/init.luau"], -[128534, "src/Rosetta/data/cbor/Codec.luau"], -[129103, "src/Rosetta/data/csv/init.luau"], -[129415, "src/Rosetta/data/ini/init.luau"], -[129661, "src/Rosetta/data/json/init.luau"], -[129753, "src/Rosetta/data/msgpack/init.luau"], -[129842, "src/Rosetta/data/msgpack/Codec.luau"], -[130284, "src/Rosetta/data/nbt/init.luau"], -[130343, "src/Rosetta/data/plist/init.luau"], -[130649, "src/Rosetta/data/plist/Binary.luau"], -[130916, "src/Rosetta/data/q3shader/init.luau"], -[131155, "src/Rosetta/data/q3skin/init.luau"], -[131251, "src/Rosetta/data/snbt/init.luau"], -[131314, "src/Rosetta/data/toml/init.luau"], -[131381, "src/Rosetta/data/toml/Decode.luau"], -[132009, "src/Rosetta/data/toml/Encode.luau"], -[132218, "src/Rosetta/data/tres/init.luau"], -[132363, "src/Rosetta/data/vdf/init.luau"], -[132464, "src/Rosetta/data/xml/init.luau"], -[132520, "src/Rosetta/data/yaml/init.luau"], -[132593, "src/Rosetta/data/yaml/Emit.luau"], -[132883, "src/Rosetta/data/yaml/Parse.luau"], -[134176, "src/Rosetta/font/bdf/init.luau"], -[134465, "src/Rosetta/font/bmfont/init.luau"], -[134892, "src/Rosetta/font/bmfont/Parse.luau"], -[135345, "src/Rosetta/font/eot/init.luau"], -[135577, "src/Rosetta/font/fon/init.luau"], -[135860, "src/Rosetta/font/hershey/init.luau"], -[136055, "src/Rosetta/font/pcf/init.luau"], -[136335, "src/Rosetta/font/psf/init.luau"], -[136655, "src/Rosetta/font/ttf/init.luau"], -[136706, "src/Rosetta/font/type1/init.luau"], -[137065, "src/Rosetta/font/type1/Charstring.luau"], -[137343, "src/Rosetta/font/woff/init.luau"], -[137475, "src/Rosetta/font/woff2/init.luau"], -[137532, "src/Rosetta/font/woff2/Rebuild.luau"], -[138072, "src/Rosetta/host/init.luau"], -[138117, "src/Rosetta/host/Love.luau"], -[138260, "src/Rosetta/host/LuaJIT.luau"], -[138310, "src/Rosetta/host/Luau.luau"], -[138333, "src/Rosetta/host/Roblox.luau"], -[138692, "src/Rosetta/image/ani/init.luau"], -[138872, "src/Rosetta/image/art/init.luau"], -[139360, "src/Rosetta/image/blp/init.luau"], -[139618, "src/Rosetta/image/bmp/init.luau"], -[140033, "src/Rosetta/image/dds/init.luau"], -[140516, "src/Rosetta/image/exr/init.luau"], -[141276, "src/Rosetta/image/exr/Codec.luau"], -[141387, "src/Rosetta/image/exr/Piz.luau"], -[141744, "src/Rosetta/image/gif/init.luau"], -[142260, "src/Rosetta/image/gif/Decode.luau"], -[142336, "src/Rosetta/image/hdr/init.luau"], -[142565, "src/Rosetta/image/hdr/Codec.luau"], -[142776, "src/Rosetta/image/icns/init.luau"], -[143107, "src/Rosetta/image/ico/init.luau"], -[143384, "src/Rosetta/image/ico/Dib.luau"], -[143479, "src/Rosetta/image/ilbm/init.luau"], -[143798, "src/Rosetta/image/jpeg/init.luau"], -[143934, "src/Rosetta/image/ktx/init.luau"], -[144594, "src/Rosetta/image/lmp/init.luau"], -[144727, "src/Rosetta/image/pcx/init.luau"], -[144991, "src/Rosetta/image/png/init.luau"], -[145571, "src/Rosetta/image/png/Apng.luau"], -[145651, "src/Rosetta/image/png/Decode.luau"], -[146024, "src/Rosetta/image/png/Encode.luau"], -[146227, "src/Rosetta/image/pnm/init.luau"], -[146605, "src/Rosetta/image/pnm/Codec.luau"], -[146882, "src/Rosetta/image/qoi/init.luau"], -[147004, "src/Rosetta/image/qoi/Codec.luau"], -[147161, "src/Rosetta/image/sgi/init.luau"], -[147446, "src/Rosetta/image/spr/init.luau"], -[147759, "src/Rosetta/image/sunras/init.luau"], -[148005, "src/Rosetta/image/tga/init.luau"], -[148275, "src/Rosetta/image/tga/Codec.luau"], -[148475, "src/Rosetta/image/tiff/init.luau"], -[149302, "src/Rosetta/image/tiff/Pixels.luau"], -[149692, "src/Rosetta/image/tim/init.luau"], -[149934, "src/Rosetta/image/vtf/init.luau"], -[150169, "src/Rosetta/image/webp/init.luau"], -[150779, "src/Rosetta/image/webp/Alpha.luau"], -[150855, "src/Rosetta/image/webp/Anim.luau"], -[151010, "src/Rosetta/image/xbm/init.luau"], -[151171, "src/Rosetta/image/xpm/init.luau"], -[151439, "src/Rosetta/image/xpm/Names.luau"], -[151495, "src/Rosetta/layered/aseprite/init.luau"], -[152233, "src/Rosetta/layered/ora/init.luau"], -[152520, "src/Rosetta/layered/psd/init.luau"], -[153255, "src/Rosetta/layered/psd/Channels.luau"], -[153607, "src/Rosetta/model/3ds/init.luau"], -[153690, "src/Rosetta/model/3ds/Build.luau"], -[154337, "src/Rosetta/model/3ds/Read.luau"], -[154833, "src/Rosetta/model/3ds/Write.luau"], -[155638, "src/Rosetta/model/3mf/init.luau"], -[155720, "src/Rosetta/model/3mf/Read.luau"], -[156308, "src/Rosetta/model/3mf/Write.luau"], -[156713, "src/Rosetta/model/ase/init.luau"], -[156836, "src/Rosetta/model/ase/Build.luau"], -[157410, "src/Rosetta/model/ase/Parse.luau"], -[157479, "src/Rosetta/model/ase/Write.luau"], -[157942, "src/Rosetta/model/b3d/init.luau"], -[157997, "src/Rosetta/model/b3d/Read.luau"], -[158568, "src/Rosetta/model/blend/init.luau"], -[158664, "src/Rosetta/model/blend/Anim.luau"], -[159010, "src/Rosetta/model/blend/Material.luau"], -[159362, "src/Rosetta/model/blend/Mesh.luau"], -[159997, "src/Rosetta/model/blend/Normals.luau"], -[160158, "src/Rosetta/model/blend/Prim.luau"], -[160607, "src/Rosetta/model/blend/Read.luau"], -[161507, "src/Rosetta/model/bsp/init.luau"], -[161698, "src/Rosetta/model/bsp/Lightmap.luau"], -[161764, "src/Rosetta/model/bsp/Quake.luau"], -[162153, "src/Rosetta/model/bsp/Quake3.luau"], -[162382, "src/Rosetta/model/bsp/Tree.luau"], -[162770, "src/Rosetta/model/buildmap/init.luau"], -[163042, "src/Rosetta/model/buildmap/Geometry.luau"], -[163445, "src/Rosetta/model/d3map/init.luau"], -[163727, "src/Rosetta/model/d3map/Parse.luau"], -[163925, "src/Rosetta/model/dae/init.luau"], -[164114, "src/Rosetta/model/dae/Math.luau"], -[164161, "src/Rosetta/model/dae/Read.luau"], -[166011, "src/Rosetta/model/dae/Write.luau"], -[166380, "src/Rosetta/model/fbx/init.luau"], -[166528, "src/Rosetta/model/fbx/Ascii.luau"], -[166798, "src/Rosetta/model/fbx/Binary.luau"], -[167253, "src/Rosetta/model/fbx/Read.luau"], -[168615, "src/Rosetta/model/fbx/Write.luau"], -[169600, "src/Rosetta/model/fbx/Xform.luau"], -[169641, "src/Rosetta/model/gltf/init.luau"], -[169878, "src/Rosetta/model/gltf/Pack.luau"], -[169947, "src/Rosetta/model/gltf/Read.luau"], -[170678, "src/Rosetta/model/gltf/Write.luau"], -[171358, "src/Rosetta/model/godot/init.luau"], -[171449, "src/Rosetta/model/godot/Build.luau"], -[171991, "src/Rosetta/model/godot/Primitives.luau"], -[172266, "src/Rosetta/model/godot/Surface.luau"], -[172751, "src/Rosetta/model/godot/Write.luau"], -[173080, "src/Rosetta/model/iqm/init.luau"], -[173156, "src/Rosetta/model/iqm/Read.luau"], -[173511, "src/Rosetta/model/iqm/Write.luau"], -[174198, "src/Rosetta/model/ldraw/init.luau"], -[174276, "src/Rosetta/model/ldraw/Colors.luau"], -[174594, "src/Rosetta/model/ldraw/Read.luau"], -[175171, "src/Rosetta/model/lwo/init.luau"], -[175247, "src/Rosetta/model/lwo/Build.luau"], -[175709, "src/Rosetta/model/lwo/Parse.luau"], -[176252, "src/Rosetta/model/map/init.luau"], -[176569, "src/Rosetta/model/map/Build.luau"], -[176813, "src/Rosetta/model/map/Parse.luau"], -[177198, "src/Rosetta/model/map/Write.luau"], -[177344, "src/Rosetta/model/mca/init.luau"], -[177686, "src/Rosetta/model/mca/Chunk.luau"], -[177819, "src/Rosetta/model/mca/Lz4Block.luau"], -[177889, "src/Rosetta/model/md2/init.luau"], -[178088, "src/Rosetta/model/md3/init.luau"], -[178316, "src/Rosetta/model/md5/init.luau"], -[178397, "src/Rosetta/model/md5/Read.luau"], -[178830, "src/Rosetta/model/mdl/init.luau"], -[178912, "src/Rosetta/model/mdl/HalfLife.luau"], -[179216, "src/Rosetta/model/mdl/Quake.luau"], -[179434, "src/Rosetta/model/ms3d/init.luau"], -[179506, "src/Rosetta/model/ms3d/Read.luau"], -[179952, "src/Rosetta/model/ms3d/Write.luau"], -[180421, "src/Rosetta/model/obj/init.luau"], -[181239, "src/Rosetta/model/obj/Mtl.luau"], -[181527, "src/Rosetta/model/off/init.luau"], -[181989, "src/Rosetta/model/ply/init.luau"], -[183094, "src/Rosetta/model/ply/Binary.luau"], -[183295, "src/Rosetta/model/pmx/init.luau"], -[183364, "src/Rosetta/model/pmx/Build.luau"], -[183660, "src/Rosetta/model/pmx/Pmd.luau"], -[183995, "src/Rosetta/model/pmx/Read.luau"], -[184399, "src/Rosetta/model/proc/init.luau"], -[184781, "src/Rosetta/model/qb/init.luau"], -[185174, "src/Rosetta/model/rbxm/init.luau"], -[185767, "src/Rosetta/model/rbxmx/init.luau"], -[186443, "src/Rosetta/model/robloxmesh/init.luau"], -[187102, "src/Rosetta/model/robloxmesh/Parse.luau"], -[187559, "src/Rosetta/model/robloxmesh/Write.luau"], -[187668, "src/Rosetta/model/schematic/init.luau"], -[187989, "src/Rosetta/model/schematic/Common.luau"], -[188109, "src/Rosetta/model/schematic/Litematic.luau"], -[188320, "src/Rosetta/model/schematic/Mcedit.luau"], -[188564, "src/Rosetta/model/schematic/Sponge.luau"], -[188693, "src/Rosetta/model/smd/init.luau"], -[188760, "src/Rosetta/model/smd/Read.luau"], -[189029, "src/Rosetta/model/smd/Write.luau"], -[189272, "src/Rosetta/model/sourcemdl/init.luau"], -[189443, "src/Rosetta/model/sourcemdl/Build.luau"], -[189873, "src/Rosetta/model/sourcemdl/Material.luau"], -[190034, "src/Rosetta/model/sourcemdl/Mdl.luau"], -[190561, "src/Rosetta/model/sourcemdl/Phy.luau"], -[190684, "src/Rosetta/model/sourcemdl/Vtx.luau"], -[190866, "src/Rosetta/model/sourcemdl/Vvd.luau"], -[190960, "src/Rosetta/model/stl/init.luau"], -[191410, "src/Rosetta/model/stl/Decode.luau"], -[191484, "src/Rosetta/model/t3d/init.luau"], -[191578, "src/Rosetta/model/t3d/Build.luau"], -[191983, "src/Rosetta/model/t3d/Parse.luau"], -[192151, "src/Rosetta/model/udmf/init.luau"], -[192234, "src/Rosetta/model/usda/init.luau"], -[192443, "src/Rosetta/model/usda/Build.luau"], -[193721, "src/Rosetta/model/usda/Parse.luau"], -[194519, "src/Rosetta/model/usda/Write.luau"], -[195336, "src/Rosetta/model/vbsp/init.luau"], -[195782, "src/Rosetta/model/vbsp/Faces.luau"], -[196006, "src/Rosetta/model/vbsp/Props.luau"], -[196098, "src/Rosetta/model/vmf/init.luau"], -[196423, "src/Rosetta/model/vmf/Build.luau"], -[196847, "src/Rosetta/model/vox/init.luau"], -[197733, "src/Rosetta/model/vox/Grid.luau"], -[197790, "src/Rosetta/model/vrml/init.luau"], -[197856, "src/Rosetta/model/x/init.luau"], -[197986, "src/Rosetta/model/x/Build.luau"], -[198549, "src/Rosetta/model/x/Parse.luau"], -[198846, "src/Rosetta/model/x3d/init.luau"], -[198924, "src/Rosetta/music/669/init.luau"], -[199131, "src/Rosetta/music/ahx/init.luau"], -[199183, "src/Rosetta/music/far/init.luau"], -[199413, "src/Rosetta/music/hmp/init.luau"], -[199678, "src/Rosetta/music/hvl/init.luau"], -[199730, "src/Rosetta/music/it/init.luau"], -[200149, "src/Rosetta/music/it/Itsex.luau"], -[200266, "src/Rosetta/music/med/init.luau"], -[200914, "src/Rosetta/music/midi/init.luau"], -[201058, "src/Rosetta/music/midi/Smf.luau"], -[201470, "src/Rosetta/music/mod/init.luau"], -[201824, "src/Rosetta/music/mtm/init.luau"], -[202047, "src/Rosetta/music/mus/init.luau"], -[202205, "src/Rosetta/music/okt/init.luau"], -[202487, "src/Rosetta/music/ptm/init.luau"], -[202710, "src/Rosetta/music/s3m/init.luau"], -[202947, "src/Rosetta/music/sf2/init.luau"], -[202991, "src/Rosetta/music/stm/init.luau"], -[203223, "src/Rosetta/music/ult/init.luau"], -[203528, "src/Rosetta/music/umx/init.luau"], -[203745, "src/Rosetta/music/xm/init.luau"], -[204307, "src/Rosetta/music/xmi/init.luau"], -[204516, "src/Rosetta/ops/AudioOps.luau"], -[204995, "src/Rosetta/ops/ImageOps/init.luau"], -[205643, "src/Rosetta/ops/ImageOps/Kernels.luau"], -[206283, "src/Rosetta/ops/LayerOps.luau"], -[206376, "src/Rosetta/ops/MeshOps/init.luau"], -[207428, "src/Rosetta/ops/MeshOps/Greedy.luau"], -[207595, "src/Rosetta/ops/MusicOps.luau"], -[207944, "src/Rosetta/playlist/m3u/init.luau"], -[208297, "src/Rosetta/playlist/pls/init.luau"], -[208475, "src/Rosetta/playlist/xspf/init.luau"], -[208678, "src/Rosetta/subtitle/ass/init.luau"], -[209122, "src/Rosetta/subtitle/srt/init.luau"], -[209295, "src/Rosetta/subtitle/vtt/init.luau"], -[209498, "src/Rosetta/vector/gamemaps/init.luau"], -[209685, "src/Rosetta/vector/gamemaps/Expand.luau"], -[209782, "src/Rosetta/vector/ldtk/init.luau"], -[209874, "src/Rosetta/vector/ldtk/Read.luau"], -[210210, "src/Rosetta/vector/ldtk/Write.luau"], -[210858, "src/Rosetta/vector/ogmo/init.luau"], -[210977, "src/Rosetta/vector/ogmo/Read.luau"], -[211382, "src/Rosetta/vector/ogmo/Write.luau"], -[211736, "src/Rosetta/vector/svg/init.luau"], -[211822, "src/Rosetta/vector/svg/Parse.luau"], -[212568, "src/Rosetta/vector/svg/PathData.luau"], -[212936, "src/Rosetta/vector/svg/Render.luau"], -[213353, "src/Rosetta/vector/svg/Style.luau"], -[213725, "src/Rosetta/vector/svg/Write.luau"], -[213925, "src/Rosetta/vector/tiled/init.luau"], -[214105, "src/Rosetta/vector/tiled/Data.luau"], -[214256, "src/Rosetta/vector/tiled/Tmj.luau"], -[214887, "src/Rosetta/vector/tiled/Tmx.luau"], -[215499, "src/Rosetta/video/avi/init.luau"], -[215793, "src/Rosetta/video/fli/init.luau"], -[215944, "src/Rosetta/video/flv/init.luau"], -[216328, "src/Rosetta/video/flv/Amf.luau"], -[216486, "src/Rosetta/video/flv/Mux.luau"], -[216767, "src/Rosetta/video/h264/init.luau"], -[216906, "src/Rosetta/video/mkv/init.luau"], -[217062, "src/Rosetta/video/mkv/Mux.luau"], -[217341, "src/Rosetta/video/mkv/Parse.luau"], -[218062, "src/Rosetta/video/mp4/init.luau"], -[218390, "src/Rosetta/video/mpegps/init.luau"], -[218577, "src/Rosetta/video/mpegts/init.luau"], -[218823, "src/Rosetta/video/ogv/init.luau"], -[219218, "src/Rosetta/video/smk/init.luau"], -[219527, "src/Rosetta/video/smk/Audio.luau"], -[219647, "src/Rosetta/video/y4m/init.luau"] +[946, "src/Rosetta/Registry.luau"], +[3563, "src/Rosetta/Sniffs.luau"], +[6949, "src/Rosetta/Types.luau"], +[8062, "src/Rosetta/archive/7z/init.luau"], +[8447, "src/Rosetta/archive/7z/Header.luau"], +[8974, "src/Rosetta/archive/adf/init.luau"], +[9256, "src/Rosetta/archive/applesingle/init.luau"], +[9442, "src/Rosetta/archive/ar/init.luau"], +[9845, "src/Rosetta/archive/arj/init.luau"], +[10055, "src/Rosetta/archive/binhex/init.luau"], +[10304, "src/Rosetta/archive/br/init.luau"], +[10379, "src/Rosetta/archive/bz2/init.luau"], +[10443, "src/Rosetta/archive/cab/init.luau"], +[10856, "src/Rosetta/archive/cab/Sum.luau"], +[10897, "src/Rosetta/archive/cpio/init.luau"], +[11065, "src/Rosetta/archive/d64/init.luau"], +[11479, "src/Rosetta/archive/fat/init.luau"], +[11601, "src/Rosetta/archive/grp/init.luau"], +[11715, "src/Rosetta/archive/gzip/init.luau"], +[11900, "src/Rosetta/archive/iso/init.luau"], +[11972, "src/Rosetta/archive/lha/init.luau"], +[12397, "src/Rosetta/archive/lz4/init.luau"], +[12741, "src/Rosetta/archive/macbinary/init.luau"], +[12939, "src/Rosetta/archive/mpq/init.luau"], +[13345, "src/Rosetta/archive/mpq/Crypt.luau"], +[13410, "src/Rosetta/archive/pak/init.luau"], +[13544, "src/Rosetta/archive/rpm/init.luau"], +[13868, "src/Rosetta/archive/tar/init.luau"], +[13986, "src/Rosetta/archive/unitypackage/init.luau"], +[14222, "src/Rosetta/archive/uu/init.luau"], +[14492, "src/Rosetta/archive/vpk/init.luau"], +[14803, "src/Rosetta/archive/vswap/init.luau"], +[15073, "src/Rosetta/archive/wad/init.luau"], +[15527, "src/Rosetta/archive/wad/Picture.luau"], +[15629, "src/Rosetta/archive/wad2/init.luau"], +[15911, "src/Rosetta/archive/xz/init.luau"], +[16011, "src/Rosetta/archive/yenc/init.luau"], +[16283, "src/Rosetta/archive/z/init.luau"], +[16379, "src/Rosetta/archive/zip/init.luau"], +[16598, "src/Rosetta/archive/zoo/init.luau"], +[16794, "src/Rosetta/archive/zst/init.luau"], +[16858, "src/Rosetta/audio/aac/init.luau"], +[17071, "src/Rosetta/audio/ac3/init.luau"], +[17218, "src/Rosetta/audio/adpcm/init.luau"], +[17364, "src/Rosetta/audio/adx/init.luau"], +[17596, "src/Rosetta/audio/aiff/init.luau"], +[17988, "src/Rosetta/audio/ape/init.luau"], +[18117, "src/Rosetta/audio/au/init.luau"], +[18279, "src/Rosetta/audio/brstm/init.luau"], +[18571, "src/Rosetta/audio/caf/init.luau"], +[19238, "src/Rosetta/audio/flac/init.luau"], +[19387, "src/Rosetta/audio/flac/Meta.luau"], +[19609, "src/Rosetta/audio/flac/Stream.luau"], +[19979, "src/Rosetta/audio/m4a/init.luau"], +[20322, "src/Rosetta/audio/mp3/init.luau"], +[20583, "src/Rosetta/audio/mp3/Index.luau"], +[20774, "src/Rosetta/audio/mp3/Stream.luau"], +[21001, "src/Rosetta/audio/mp3/Tags.luau"], +[21313, "src/Rosetta/audio/mpc/init.luau"], +[21408, "src/Rosetta/audio/opus/init.luau"], +[21787, "src/Rosetta/audio/opus/Encode.luau"], +[21899, "src/Rosetta/audio/qoa/init.luau"], +[22080, "src/Rosetta/audio/tta/init.luau"], +[22199, "src/Rosetta/audio/vag/init.luau"], +[22423, "src/Rosetta/audio/voc/init.luau"], +[22699, "src/Rosetta/audio/vorbis/init.luau"], +[23154, "src/Rosetta/audio/vorbis/Encode.luau"], +[23967, "src/Rosetta/audio/wav/init.luau"], +[24588, "src/Rosetta/audio/wav/Codecs.luau"], +[24767, "src/Rosetta/audio/wavpack/init.luau"], +[24975, "src/Rosetta/cad/step/init.luau"], +[25357, "src/Rosetta/cad/step/Brep.luau"], +[25592, "src/Rosetta/cad/step/Parse.luau"], +[26149, "src/Rosetta/cad/step/Write.luau"], +[26397, "src/Rosetta/codecs/audio/Aac/init.luau"], +[26805, "src/Rosetta/codecs/audio/Aac/Decode.luau"], +[27781, "src/Rosetta/codecs/audio/Aac/Ps.luau"], +[28371, "src/Rosetta/codecs/audio/Aac/Sbr.luau"], +[29438, "src/Rosetta/codecs/audio/Aac/SbrBits.luau"], +[29557, "src/Rosetta/codecs/audio/Aac/SbrDct.luau"], +[30799, "src/Rosetta/codecs/audio/Aac/SbrHf.luau"], +[31291, "src/Rosetta/codecs/audio/Aac/SbrQmf.luau"], +[31408, "src/Rosetta/codecs/audio/Aac/SbrTables.luau"], +[31821, "src/Rosetta/codecs/audio/Aac/Tables.luau"], +[32157, "src/Rosetta/codecs/audio/Ac3/init.luau"], +[32317, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], +[33202, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], +[33304, "src/Rosetta/codecs/audio/Adpcm/init.luau"], +[34058, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], +[34361, "src/Rosetta/codecs/audio/Alac/init.luau"], +[34596, "src/Rosetta/codecs/audio/Alac/Decode.luau"], +[35015, "src/Rosetta/codecs/audio/Alac/Encode.luau"], +[35427, "src/Rosetta/codecs/audio/Ape/init.luau"], +[35643, "src/Rosetta/codecs/audio/Ape/Decode.luau"], +[36404, "src/Rosetta/codecs/audio/ApeTag.luau"], +[36502, "src/Rosetta/codecs/audio/Flac/init.luau"], +[36514, "src/Rosetta/codecs/audio/Flac/Encode.luau"], +[37463, "src/Rosetta/codecs/audio/Flac/Frame.luau"], +[38083, "src/Rosetta/codecs/audio/Hively/init.luau"], +[38280, "src/Rosetta/codecs/audio/Hively/Load.luau"], +[38530, "src/Rosetta/codecs/audio/Hively/Player.luau"], +[39489, "src/Rosetta/codecs/audio/Hively/Tables.luau"], +[39709, "src/Rosetta/codecs/audio/Mdct/init.luau"], +[39929, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], +[40183, "src/Rosetta/codecs/audio/MidiRender.luau"], +[40530, "src/Rosetta/codecs/audio/Mpa/init.luau"], +[40545, "src/Rosetta/codecs/audio/Mpa/Analysis.luau"], +[40604, "src/Rosetta/codecs/audio/Mpa/Core.luau"], +[42262, "src/Rosetta/codecs/audio/Mpa/EncTables.luau"], +[42555, "src/Rosetta/codecs/audio/Mpa/Encode2.luau"], +[42940, "src/Rosetta/codecs/audio/Mpa/Encode3.luau"], +[43581, "src/Rosetta/codecs/audio/Mpa/Header.luau"], +[43722, "src/Rosetta/codecs/audio/Mpa/Tables.luau"], +[43949, "src/Rosetta/codecs/audio/Musepack/init.luau"], +[44295, "src/Rosetta/codecs/audio/Musepack/Decode.luau"], +[45189, "src/Rosetta/codecs/audio/Musepack/Tables.luau"], +[45568, "src/Rosetta/codecs/audio/Opus/init.luau"], +[45583, "src/Rosetta/codecs/audio/Opus/Celt.luau"], +[47455, "src/Rosetta/codecs/audio/Opus/CeltEncoder.luau"], +[48520, "src/Rosetta/codecs/audio/Opus/CeltTables.luau"], +[48581, "src/Rosetta/codecs/audio/Opus/Decoder.luau"], +[49045, "src/Rosetta/codecs/audio/Opus/Mdct.luau"], +[49396, "src/Rosetta/codecs/audio/Opus/Packet.luau"], +[49629, "src/Rosetta/codecs/audio/Opus/Silk.luau"], +[51671, "src/Rosetta/codecs/audio/Opus/SilkTables.luau"], +[52045, "src/Rosetta/codecs/audio/Pcm/init.luau"], +[52309, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], +[52606, "src/Rosetta/codecs/audio/Qoa/init.luau"], +[52888, "src/Rosetta/codecs/audio/Resample/init.luau"], +[53283, "src/Rosetta/codecs/audio/SoundFont/init.luau"], +[53338, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], +[53482, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], +[53996, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"], +[54795, "src/Rosetta/codecs/audio/Stream.luau"], +[54957, "src/Rosetta/codecs/audio/Tracker/init.luau"], +[55440, "src/Rosetta/codecs/audio/Tracker/Load.luau"], +[55719, "src/Rosetta/codecs/audio/Tracker/Mixer.luau"], +[55966, "src/Rosetta/codecs/audio/Tracker/Pcm.luau"], +[56095, "src/Rosetta/codecs/audio/Tracker/Player.luau"], +[58084, "src/Rosetta/codecs/audio/Tracker/Tables.luau"], +[58201, "src/Rosetta/codecs/audio/Tta/init.luau"], +[58319, "src/Rosetta/codecs/audio/Tta/Decode.luau"], +[58571, "src/Rosetta/codecs/audio/Vorbis/init.luau"], +[58585, "src/Rosetta/codecs/audio/Vorbis/Codebook.luau"], +[58969, "src/Rosetta/codecs/audio/Vorbis/Packet.luau"], +[59542, "src/Rosetta/codecs/audio/Vorbis/Setup.luau"], +[59964, "src/Rosetta/codecs/audio/Vorbis/Tables.luau"], +[60004, "src/Rosetta/codecs/audio/VorbisComment.luau"], +[60057, "src/Rosetta/codecs/audio/WavPack/init.luau"], +[60280, "src/Rosetta/codecs/audio/WavPack/Block.luau"], +[61735, "src/Rosetta/codecs/audio/WavPack/Tables.luau"], +[61798, "src/Rosetta/codecs/compress/Brotli/init.luau"], +[61885, "src/Rosetta/codecs/compress/Brotli/Decode.luau"], +[62861, "src/Rosetta/codecs/compress/Brotli/Static.luau"], +[63729, "src/Rosetta/codecs/compress/Bzip2/init.luau"], +[63773, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], +[64286, "src/Rosetta/codecs/compress/Deflate/init.luau"], +[64612, "src/Rosetta/codecs/compress/Deflate/Compress.luau"], +[65094, "src/Rosetta/codecs/compress/Deflate/Inflate.luau"], +[65542, "src/Rosetta/codecs/compress/Explode.luau"], +[65738, "src/Rosetta/codecs/compress/Lz4.luau"], +[66007, "src/Rosetta/codecs/compress/Lzh/init.luau"], +[66611, "src/Rosetta/codecs/compress/Lzma/init.luau"], +[67151, "src/Rosetta/codecs/compress/Lzma/Crc64.luau"], +[67218, "src/Rosetta/codecs/compress/Lzma/Decode.luau"], +[67691, "src/Rosetta/codecs/compress/Lzma/Filters.luau"], +[67867, "src/Rosetta/codecs/compress/Lzw/init.luau"], +[68135, "src/Rosetta/codecs/compress/Lzx.luau"], +[68569, "src/Rosetta/codecs/compress/PackBits.luau"], +[68659, "src/Rosetta/codecs/compress/Quantum.luau"], +[68896, "src/Rosetta/codecs/compress/UnixCompress.luau"], +[69200, "src/Rosetta/codecs/compress/Xxh32.luau"], +[69269, "src/Rosetta/codecs/compress/Zstd/init.luau"], +[69326, "src/Rosetta/codecs/compress/Zstd/Decode.luau"], +[70310, "src/Rosetta/codecs/compress/Zstd/Xxh64.luau"], +[70462, "src/Rosetta/codecs/entropy/Huffman.luau"], +[70749, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], +[70760, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], +[70981, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.luau"], +[71225, "src/Rosetta/codecs/font/Bitmap.luau"], +[71426, "src/Rosetta/codecs/font/Cff/init.luau"], +[72067, "src/Rosetta/codecs/font/GlyphNames.luau"], +[72217, "src/Rosetta/codecs/font/TrueType/init.luau"], +[72531, "src/Rosetta/codecs/font/TrueType/Glyf.luau"], +[72923, "src/Rosetta/codecs/font/TrueType/Tables.luau"], +[73425, "src/Rosetta/codecs/image/Bcn/init.luau"], +[73532, "src/Rosetta/codecs/image/Bcn/Decode.luau"], +[74016, "src/Rosetta/codecs/image/Bcn/Encode.luau"], +[74445, "src/Rosetta/codecs/image/Blend.luau"], +[74824, "src/Rosetta/codecs/image/Dct/init.luau"], +[75324, "src/Rosetta/codecs/image/Etc.luau"], +[75622, "src/Rosetta/codecs/image/Half.luau"], +[75691, "src/Rosetta/codecs/image/Jpeg/init.luau"], +[76045, "src/Rosetta/codecs/image/Jpeg/Arith.luau"], +[76453, "src/Rosetta/codecs/image/Jpeg/Color.luau"], +[76818, "src/Rosetta/codecs/image/Jpeg/Decode.luau"], +[77583, "src/Rosetta/codecs/image/Jpeg/Encode.luau"], +[78464, "src/Rosetta/codecs/image/Jpeg/Scan.luau"], +[78933, "src/Rosetta/codecs/image/Jpeg/Tables.luau"], +[79011, "src/Rosetta/codecs/image/Jpeg/Yuv.luau"], +[79078, "src/Rosetta/codecs/image/Miptex.luau"], +[79378, "src/Rosetta/codecs/image/Pixels.luau"], +[79698, "src/Rosetta/codecs/image/Quantize/init.luau"], +[80159, "src/Rosetta/codecs/image/Raster.luau"], +[80856, "src/Rosetta/codecs/image/Texel.luau"], +[81229, "src/Rosetta/codecs/image/Texture.luau"], +[81374, "src/Rosetta/codecs/image/Vp8/init.luau"], +[81505, "src/Rosetta/codecs/image/Vp8/Decode.luau"], +[83461, "src/Rosetta/codecs/image/Vp8/Predict.luau"], +[83724, "src/Rosetta/codecs/image/Vp8/Tables.luau"], +[83974, "src/Rosetta/codecs/image/Vp8/Yuv.luau"], +[84116, "src/Rosetta/codecs/image/Vp8L/init.luau"], +[84220, "src/Rosetta/codecs/image/Vp8L/Decode.luau"], +[85160, "src/Rosetta/codecs/image/Vp8L/Encode.luau"], +[86112, "src/Rosetta/codecs/image/Yuv.luau"], +[86417, "src/Rosetta/codecs/model/Brush.luau"], +[87057, "src/Rosetta/codecs/model/Displacement.luau"], +[87206, "src/Rosetta/codecs/model/DoomMap/init.luau"], +[87651, "src/Rosetta/codecs/model/DoomMap/Udmf.luau"], +[87901, "src/Rosetta/codecs/model/Draco/init.luau"], +[88233, "src/Rosetta/codecs/model/Draco/Attributes.luau"], +[88702, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], +[89891, "src/Rosetta/codecs/model/Draco/Int64.luau"], +[90040, "src/Rosetta/codecs/model/Draco/KdTree.luau"], +[90399, "src/Rosetta/codecs/model/Draco/Predict.luau"], +[91361, "src/Rosetta/codecs/model/Draco/Reader.luau"], +[91835, "src/Rosetta/codecs/model/Mat4.luau"], +[92094, "src/Rosetta/codecs/model/MeshFlatten.luau"], +[92622, "src/Rosetta/codecs/model/Minecraft/init.luau"], +[93174, "src/Rosetta/codecs/model/Minecraft/Colors.luau"], +[93253, "src/Rosetta/codecs/model/Minecraft/Legacy.luau"], +[93360, "src/Rosetta/codecs/model/Minecraft/Packed.luau"], +[93566, "src/Rosetta/codecs/model/Patch.luau"], +[93690, "src/Rosetta/codecs/model/Polygon.luau"], +[93924, "src/Rosetta/codecs/model/Rbx/init.luau"], +[94161, "src/Rosetta/codecs/model/Rbx/Binary.luau"], +[94915, "src/Rosetta/codecs/model/Rig.luau"], +[95158, "src/Rosetta/codecs/model/Sampler.luau"], +[95318, "src/Rosetta/codecs/model/SourceAnim.luau"], +[95539, "src/Rosetta/codecs/model/Vrml/init.luau"], +[95687, "src/Rosetta/codecs/model/Vrml/Build.luau"], +[96261, "src/Rosetta/codecs/model/Vrml/Fields.luau"], +[96424, "src/Rosetta/codecs/model/Vrml/Geometry.luau"], +[97173, "src/Rosetta/codecs/model/Vrml/Parse.luau"], +[97695, "src/Rosetta/codecs/model/Vrml/Write.luau"], +[98422, "src/Rosetta/codecs/model/Vrml/Xml.luau"], +[98654, "src/Rosetta/codecs/text/GodotVariant.luau"], +[99313, "src/Rosetta/codecs/text/Json/init.luau"], +[99582, "src/Rosetta/codecs/text/Json/Decode.luau"], +[100017, "src/Rosetta/codecs/text/Json/Encode.luau"], +[100362, "src/Rosetta/codecs/text/KeyValues/init.luau"], +[100932, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], +[101238, "src/Rosetta/codecs/text/Lexer/init.luau"], +[101370, "src/Rosetta/codecs/text/Nbt/init.luau"], +[101723, "src/Rosetta/codecs/text/Nbt/Binary.luau"], +[102415, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], +[103055, "src/Rosetta/codecs/text/Nbt/Value.luau"], +[103293, "src/Rosetta/codecs/text/Text/init.luau"], +[103384, "src/Rosetta/codecs/text/Url/init.luau"], +[103589, "src/Rosetta/codecs/text/Xml/init.luau"], +[104039, "src/Rosetta/codecs/text/Xml/Parse.luau"], +[104843, "src/Rosetta/codecs/video/Dsp.luau"], +[105681, "src/Rosetta/codecs/video/H263/init.luau"], +[105838, "src/Rosetta/codecs/video/H263/Decoder.luau"], +[106696, "src/Rosetta/codecs/video/H263/Tables.luau"], +[106900, "src/Rosetta/codecs/video/H264/init.luau"], +[107274, "src/Rosetta/codecs/video/H264/Bitstream.luau"], +[107549, "src/Rosetta/codecs/video/H264/Cabac.luau"], +[108680, "src/Rosetta/codecs/video/H264/Cavlc.luau"], +[109448, "src/Rosetta/codecs/video/H264/Deblock.luau"], +[109710, "src/Rosetta/codecs/video/H264/Decoder.luau"], +[110720, "src/Rosetta/codecs/video/H264/Inter.luau"], +[111046, "src/Rosetta/codecs/video/H264/Intra.luau"], +[111453, "src/Rosetta/codecs/video/H264/Mb.luau"], +[112392, "src/Rosetta/codecs/video/H264/Params.luau"], +[112840, "src/Rosetta/codecs/video/H264/Slice.luau"], +[113092, "src/Rosetta/codecs/video/H264/Tables.luau"], +[113134, "src/Rosetta/codecs/video/H264/Transform.luau"], +[113299, "src/Rosetta/codecs/video/Legacy/init.luau"], +[113498, "src/Rosetta/codecs/video/Legacy/Cinepak.luau"], +[113795, "src/Rosetta/codecs/video/Legacy/Flic.luau"], +[114162, "src/Rosetta/codecs/video/Legacy/Msvideo1.luau"], +[114280, "src/Rosetta/codecs/video/Legacy/Picture.luau"], +[114388, "src/Rosetta/codecs/video/Legacy/QtRle.luau"], +[114661, "src/Rosetta/codecs/video/Legacy/Smacker.luau"], +[115056, "src/Rosetta/codecs/video/Legacy/Smc.luau"], +[115233, "src/Rosetta/codecs/video/Mpeg1/init.luau"], +[115246, "src/Rosetta/codecs/video/Mpeg2/init.luau"], +[115614, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], +[117141, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], +[117281, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"], +[117420, "src/Rosetta/codecs/video/Theora/init.luau"], +[117684, "src/Rosetta/codecs/video/Theora/Decoder.luau"], +[118948, "src/Rosetta/codecs/video/Theora/Header.luau"], +[119312, "src/Rosetta/codecs/video/Video/init.luau"], +[119870, "src/Rosetta/codecs/video/Video/Source.luau"], +[120156, "src/Rosetta/containers/Archive.luau"], +[120423, "src/Rosetta/containers/AudioWrap.luau"], +[120933, "src/Rosetta/containers/Avi/init.luau"], +[121486, "src/Rosetta/containers/Blend.luau"], +[122225, "src/Rosetta/containers/Chunks.luau"], +[122360, "src/Rosetta/containers/Cpio.luau"], +[122788, "src/Rosetta/containers/Demux.luau"], +[123063, "src/Rosetta/containers/Ebml/init.luau"], +[123377, "src/Rosetta/containers/Fat.luau"], +[124065, "src/Rosetta/containers/Iso9660.luau"], +[124570, "src/Rosetta/containers/IsoBmff/init.luau"], +[124741, "src/Rosetta/containers/IsoBmff/Box.luau"], +[124930, "src/Rosetta/containers/IsoBmff/Demux.luau"], +[125776, "src/Rosetta/containers/IsoBmff/Meta.luau"], +[126298, "src/Rosetta/containers/IsoBmff/Mux.luau"], +[126815, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], +[126933, "src/Rosetta/containers/MacFile.luau"], +[127082, "src/Rosetta/containers/MpegEs.luau"], +[127249, "src/Rosetta/containers/MpegPs/init.luau"], +[127470, "src/Rosetta/containers/MpegTs/init.luau"], +[128263, "src/Rosetta/containers/Ogg/init.luau"], +[128688, "src/Rosetta/containers/Ogg/Mux.luau"], +[128877, "src/Rosetta/containers/Ogg/Page.luau"], +[129043, "src/Rosetta/containers/Riff/init.luau"], +[129360, "src/Rosetta/containers/Tar.luau"], +[129774, "src/Rosetta/containers/Zip/init.luau"], +[130406, "src/Rosetta/core/Adler32.luau"], +[130466, "src/Rosetta/core/Base64.luau"], +[130694, "src/Rosetta/core/Bits.luau"], +[130987, "src/Rosetta/core/Bytes.luau"], +[131514, "src/Rosetta/core/Crc16.luau"], +[131566, "src/Rosetta/core/Crc32.luau"], +[131717, "src/Rosetta/core/Err.luau"], +[131799, "src/Rosetta/core/Input.luau"], +[131875, "src/Rosetta/core/Md5.luau"], +[132033, "src/Rosetta/core/Sniff.luau"], +[132062, "src/Rosetta/data/cbor/init.luau"], +[132161, "src/Rosetta/data/cbor/Codec.luau"], +[132730, "src/Rosetta/data/csv/init.luau"], +[133042, "src/Rosetta/data/ini/init.luau"], +[133288, "src/Rosetta/data/json/init.luau"], +[133380, "src/Rosetta/data/msgpack/init.luau"], +[133469, "src/Rosetta/data/msgpack/Codec.luau"], +[133911, "src/Rosetta/data/nbt/init.luau"], +[133970, "src/Rosetta/data/plist/init.luau"], +[134276, "src/Rosetta/data/plist/Binary.luau"], +[134543, "src/Rosetta/data/q3shader/init.luau"], +[134782, "src/Rosetta/data/q3skin/init.luau"], +[134878, "src/Rosetta/data/snbt/init.luau"], +[134941, "src/Rosetta/data/toml/init.luau"], +[135008, "src/Rosetta/data/toml/Decode.luau"], +[135636, "src/Rosetta/data/toml/Encode.luau"], +[135845, "src/Rosetta/data/tres/init.luau"], +[135990, "src/Rosetta/data/vdf/init.luau"], +[136091, "src/Rosetta/data/xml/init.luau"], +[136147, "src/Rosetta/data/yaml/init.luau"], +[136220, "src/Rosetta/data/yaml/Emit.luau"], +[136510, "src/Rosetta/data/yaml/Parse.luau"], +[137803, "src/Rosetta/font/bdf/init.luau"], +[138092, "src/Rosetta/font/bmfont/init.luau"], +[138519, "src/Rosetta/font/bmfont/Parse.luau"], +[138972, "src/Rosetta/font/eot/init.luau"], +[139204, "src/Rosetta/font/fon/init.luau"], +[139487, "src/Rosetta/font/hershey/init.luau"], +[139682, "src/Rosetta/font/pcf/init.luau"], +[139962, "src/Rosetta/font/psf/init.luau"], +[140282, "src/Rosetta/font/ttf/init.luau"], +[140333, "src/Rosetta/font/type1/init.luau"], +[140692, "src/Rosetta/font/type1/Charstring.luau"], +[140970, "src/Rosetta/font/woff/init.luau"], +[141102, "src/Rosetta/font/woff2/init.luau"], +[141159, "src/Rosetta/font/woff2/Rebuild.luau"], +[141699, "src/Rosetta/host/init.luau"], +[141744, "src/Rosetta/host/Love.luau"], +[141887, "src/Rosetta/host/LuaJIT.luau"], +[141937, "src/Rosetta/host/Luau.luau"], +[141960, "src/Rosetta/host/Roblox.luau"], +[142319, "src/Rosetta/image/ani/init.luau"], +[142499, "src/Rosetta/image/art/init.luau"], +[142987, "src/Rosetta/image/blp/init.luau"], +[143245, "src/Rosetta/image/bmp/init.luau"], +[143660, "src/Rosetta/image/dds/init.luau"], +[144143, "src/Rosetta/image/exr/init.luau"], +[144903, "src/Rosetta/image/exr/Codec.luau"], +[145014, "src/Rosetta/image/exr/Piz.luau"], +[145371, "src/Rosetta/image/gif/init.luau"], +[145887, "src/Rosetta/image/gif/Decode.luau"], +[145963, "src/Rosetta/image/hdr/init.luau"], +[146192, "src/Rosetta/image/hdr/Codec.luau"], +[146403, "src/Rosetta/image/icns/init.luau"], +[146734, "src/Rosetta/image/ico/init.luau"], +[147011, "src/Rosetta/image/ico/Dib.luau"], +[147106, "src/Rosetta/image/ilbm/init.luau"], +[147425, "src/Rosetta/image/jpeg/init.luau"], +[147561, "src/Rosetta/image/ktx/init.luau"], +[148221, "src/Rosetta/image/lmp/init.luau"], +[148354, "src/Rosetta/image/pcx/init.luau"], +[148618, "src/Rosetta/image/png/init.luau"], +[149198, "src/Rosetta/image/png/Apng.luau"], +[149278, "src/Rosetta/image/png/Decode.luau"], +[149651, "src/Rosetta/image/png/Encode.luau"], +[149854, "src/Rosetta/image/pnm/init.luau"], +[150232, "src/Rosetta/image/pnm/Codec.luau"], +[150509, "src/Rosetta/image/qoi/init.luau"], +[150631, "src/Rosetta/image/qoi/Codec.luau"], +[150788, "src/Rosetta/image/sgi/init.luau"], +[151073, "src/Rosetta/image/spr/init.luau"], +[151386, "src/Rosetta/image/sunras/init.luau"], +[151632, "src/Rosetta/image/tga/init.luau"], +[151902, "src/Rosetta/image/tga/Codec.luau"], +[152102, "src/Rosetta/image/tiff/init.luau"], +[152929, "src/Rosetta/image/tiff/Pixels.luau"], +[153319, "src/Rosetta/image/tim/init.luau"], +[153561, "src/Rosetta/image/vtf/init.luau"], +[153796, "src/Rosetta/image/webp/init.luau"], +[154406, "src/Rosetta/image/webp/Alpha.luau"], +[154482, "src/Rosetta/image/webp/Anim.luau"], +[154637, "src/Rosetta/image/xbm/init.luau"], +[154798, "src/Rosetta/image/xpm/init.luau"], +[155066, "src/Rosetta/image/xpm/Names.luau"], +[155122, "src/Rosetta/layered/aseprite/init.luau"], +[155860, "src/Rosetta/layered/ora/init.luau"], +[156147, "src/Rosetta/layered/psd/init.luau"], +[156882, "src/Rosetta/layered/psd/Channels.luau"], +[157234, "src/Rosetta/model/3ds/init.luau"], +[157317, "src/Rosetta/model/3ds/Build.luau"], +[157964, "src/Rosetta/model/3ds/Read.luau"], +[158460, "src/Rosetta/model/3ds/Write.luau"], +[159265, "src/Rosetta/model/3mf/init.luau"], +[159347, "src/Rosetta/model/3mf/Read.luau"], +[159935, "src/Rosetta/model/3mf/Write.luau"], +[160340, "src/Rosetta/model/ase/init.luau"], +[160463, "src/Rosetta/model/ase/Build.luau"], +[161037, "src/Rosetta/model/ase/Parse.luau"], +[161106, "src/Rosetta/model/ase/Write.luau"], +[161569, "src/Rosetta/model/b3d/init.luau"], +[161624, "src/Rosetta/model/b3d/Read.luau"], +[162195, "src/Rosetta/model/blend/init.luau"], +[162291, "src/Rosetta/model/blend/Anim.luau"], +[162637, "src/Rosetta/model/blend/Material.luau"], +[162989, "src/Rosetta/model/blend/Mesh.luau"], +[163624, "src/Rosetta/model/blend/Normals.luau"], +[163785, "src/Rosetta/model/blend/Prim.luau"], +[164234, "src/Rosetta/model/blend/Read.luau"], +[165134, "src/Rosetta/model/bsp/init.luau"], +[165325, "src/Rosetta/model/bsp/Lightmap.luau"], +[165391, "src/Rosetta/model/bsp/Quake.luau"], +[165780, "src/Rosetta/model/bsp/Quake3.luau"], +[166009, "src/Rosetta/model/bsp/Tree.luau"], +[166397, "src/Rosetta/model/buildmap/init.luau"], +[166669, "src/Rosetta/model/buildmap/Geometry.luau"], +[167072, "src/Rosetta/model/d3map/init.luau"], +[167354, "src/Rosetta/model/d3map/Parse.luau"], +[167552, "src/Rosetta/model/dae/init.luau"], +[167741, "src/Rosetta/model/dae/Math.luau"], +[167788, "src/Rosetta/model/dae/Read.luau"], +[169638, "src/Rosetta/model/dae/Write.luau"], +[170007, "src/Rosetta/model/fbx/init.luau"], +[170155, "src/Rosetta/model/fbx/Ascii.luau"], +[170425, "src/Rosetta/model/fbx/Binary.luau"], +[170880, "src/Rosetta/model/fbx/Read.luau"], +[172242, "src/Rosetta/model/fbx/Write.luau"], +[173227, "src/Rosetta/model/fbx/Xform.luau"], +[173268, "src/Rosetta/model/gltf/init.luau"], +[173505, "src/Rosetta/model/gltf/Pack.luau"], +[173574, "src/Rosetta/model/gltf/Read.luau"], +[174305, "src/Rosetta/model/gltf/Write.luau"], +[174985, "src/Rosetta/model/godot/init.luau"], +[175076, "src/Rosetta/model/godot/Build.luau"], +[175618, "src/Rosetta/model/godot/Primitives.luau"], +[175893, "src/Rosetta/model/godot/Surface.luau"], +[176378, "src/Rosetta/model/godot/Write.luau"], +[176707, "src/Rosetta/model/iqm/init.luau"], +[176783, "src/Rosetta/model/iqm/Read.luau"], +[177138, "src/Rosetta/model/iqm/Write.luau"], +[177825, "src/Rosetta/model/ldraw/init.luau"], +[177903, "src/Rosetta/model/ldraw/Colors.luau"], +[178221, "src/Rosetta/model/ldraw/Read.luau"], +[178798, "src/Rosetta/model/lwo/init.luau"], +[178874, "src/Rosetta/model/lwo/Build.luau"], +[179336, "src/Rosetta/model/lwo/Parse.luau"], +[179879, "src/Rosetta/model/map/init.luau"], +[180196, "src/Rosetta/model/map/Build.luau"], +[180440, "src/Rosetta/model/map/Parse.luau"], +[180825, "src/Rosetta/model/map/Write.luau"], +[180971, "src/Rosetta/model/mca/init.luau"], +[181313, "src/Rosetta/model/mca/Chunk.luau"], +[181446, "src/Rosetta/model/mca/Lz4Block.luau"], +[181516, "src/Rosetta/model/md2/init.luau"], +[181715, "src/Rosetta/model/md3/init.luau"], +[181943, "src/Rosetta/model/md5/init.luau"], +[182024, "src/Rosetta/model/md5/Read.luau"], +[182457, "src/Rosetta/model/mdl/init.luau"], +[182539, "src/Rosetta/model/mdl/HalfLife.luau"], +[182843, "src/Rosetta/model/mdl/Quake.luau"], +[183061, "src/Rosetta/model/ms3d/init.luau"], +[183133, "src/Rosetta/model/ms3d/Read.luau"], +[183579, "src/Rosetta/model/ms3d/Write.luau"], +[184048, "src/Rosetta/model/obj/init.luau"], +[184866, "src/Rosetta/model/obj/Mtl.luau"], +[185154, "src/Rosetta/model/off/init.luau"], +[185616, "src/Rosetta/model/ply/init.luau"], +[186721, "src/Rosetta/model/ply/Binary.luau"], +[186922, "src/Rosetta/model/pmx/init.luau"], +[186991, "src/Rosetta/model/pmx/Build.luau"], +[187287, "src/Rosetta/model/pmx/Pmd.luau"], +[187622, "src/Rosetta/model/pmx/Read.luau"], +[188026, "src/Rosetta/model/proc/init.luau"], +[188408, "src/Rosetta/model/qb/init.luau"], +[188801, "src/Rosetta/model/rbxm/init.luau"], +[189394, "src/Rosetta/model/rbxmx/init.luau"], +[190070, "src/Rosetta/model/robloxmesh/init.luau"], +[190729, "src/Rosetta/model/robloxmesh/Parse.luau"], +[191186, "src/Rosetta/model/robloxmesh/Write.luau"], +[191295, "src/Rosetta/model/schematic/init.luau"], +[191616, "src/Rosetta/model/schematic/Common.luau"], +[191736, "src/Rosetta/model/schematic/Litematic.luau"], +[191947, "src/Rosetta/model/schematic/Mcedit.luau"], +[192191, "src/Rosetta/model/schematic/Sponge.luau"], +[192320, "src/Rosetta/model/smd/init.luau"], +[192387, "src/Rosetta/model/smd/Read.luau"], +[192656, "src/Rosetta/model/smd/Write.luau"], +[192899, "src/Rosetta/model/sourcemdl/init.luau"], +[193070, "src/Rosetta/model/sourcemdl/Build.luau"], +[193500, "src/Rosetta/model/sourcemdl/Material.luau"], +[193661, "src/Rosetta/model/sourcemdl/Mdl.luau"], +[194188, "src/Rosetta/model/sourcemdl/Phy.luau"], +[194311, "src/Rosetta/model/sourcemdl/Vtx.luau"], +[194493, "src/Rosetta/model/sourcemdl/Vvd.luau"], +[194587, "src/Rosetta/model/stl/init.luau"], +[195037, "src/Rosetta/model/stl/Decode.luau"], +[195111, "src/Rosetta/model/t3d/init.luau"], +[195205, "src/Rosetta/model/t3d/Build.luau"], +[195610, "src/Rosetta/model/t3d/Parse.luau"], +[195778, "src/Rosetta/model/udmf/init.luau"], +[195861, "src/Rosetta/model/usda/init.luau"], +[196070, "src/Rosetta/model/usda/Build.luau"], +[197348, "src/Rosetta/model/usda/Parse.luau"], +[198146, "src/Rosetta/model/usda/Write.luau"], +[198963, "src/Rosetta/model/vbsp/init.luau"], +[199409, "src/Rosetta/model/vbsp/Faces.luau"], +[199633, "src/Rosetta/model/vbsp/Props.luau"], +[199725, "src/Rosetta/model/vmf/init.luau"], +[200050, "src/Rosetta/model/vmf/Build.luau"], +[200474, "src/Rosetta/model/vox/init.luau"], +[201360, "src/Rosetta/model/vox/Grid.luau"], +[201417, "src/Rosetta/model/vrml/init.luau"], +[201483, "src/Rosetta/model/x/init.luau"], +[201613, "src/Rosetta/model/x/Build.luau"], +[202176, "src/Rosetta/model/x/Parse.luau"], +[202473, "src/Rosetta/model/x3d/init.luau"], +[202551, "src/Rosetta/music/669/init.luau"], +[202758, "src/Rosetta/music/ahx/init.luau"], +[202810, "src/Rosetta/music/far/init.luau"], +[203040, "src/Rosetta/music/hmp/init.luau"], +[203305, "src/Rosetta/music/hvl/init.luau"], +[203357, "src/Rosetta/music/it/init.luau"], +[203776, "src/Rosetta/music/it/Itsex.luau"], +[203893, "src/Rosetta/music/med/init.luau"], +[204541, "src/Rosetta/music/midi/init.luau"], +[204685, "src/Rosetta/music/midi/Smf.luau"], +[205097, "src/Rosetta/music/mod/init.luau"], +[205451, "src/Rosetta/music/mtm/init.luau"], +[205674, "src/Rosetta/music/mus/init.luau"], +[205832, "src/Rosetta/music/okt/init.luau"], +[206114, "src/Rosetta/music/ptm/init.luau"], +[206337, "src/Rosetta/music/s3m/init.luau"], +[206574, "src/Rosetta/music/sf2/init.luau"], +[206618, "src/Rosetta/music/stm/init.luau"], +[206850, "src/Rosetta/music/ult/init.luau"], +[207155, "src/Rosetta/music/umx/init.luau"], +[207372, "src/Rosetta/music/xm/init.luau"], +[207934, "src/Rosetta/music/xmi/init.luau"], +[208143, "src/Rosetta/ops/AudioOps.luau"], +[208622, "src/Rosetta/ops/ImageOps/init.luau"], +[209270, "src/Rosetta/ops/ImageOps/Kernels.luau"], +[209910, "src/Rosetta/ops/LayerOps.luau"], +[210003, "src/Rosetta/ops/MeshOps/init.luau"], +[211055, "src/Rosetta/ops/MeshOps/Greedy.luau"], +[211222, "src/Rosetta/ops/MusicOps.luau"], +[211571, "src/Rosetta/playlist/m3u/init.luau"], +[211924, "src/Rosetta/playlist/pls/init.luau"], +[212102, "src/Rosetta/playlist/xspf/init.luau"], +[212305, "src/Rosetta/subtitle/ass/init.luau"], +[212749, "src/Rosetta/subtitle/srt/init.luau"], +[212922, "src/Rosetta/subtitle/vtt/init.luau"], +[213125, "src/Rosetta/vector/gamemaps/init.luau"], +[213312, "src/Rosetta/vector/gamemaps/Expand.luau"], +[213409, "src/Rosetta/vector/ldtk/init.luau"], +[213501, "src/Rosetta/vector/ldtk/Read.luau"], +[213837, "src/Rosetta/vector/ldtk/Write.luau"], +[214485, "src/Rosetta/vector/ogmo/init.luau"], +[214604, "src/Rosetta/vector/ogmo/Read.luau"], +[215009, "src/Rosetta/vector/ogmo/Write.luau"], +[215363, "src/Rosetta/vector/svg/init.luau"], +[215449, "src/Rosetta/vector/svg/Parse.luau"], +[216195, "src/Rosetta/vector/svg/PathData.luau"], +[216563, "src/Rosetta/vector/svg/Render.luau"], +[216980, "src/Rosetta/vector/svg/Style.luau"], +[217352, "src/Rosetta/vector/svg/Write.luau"], +[217552, "src/Rosetta/vector/tiled/init.luau"], +[217732, "src/Rosetta/vector/tiled/Data.luau"], +[217883, "src/Rosetta/vector/tiled/Tmj.luau"], +[218514, "src/Rosetta/vector/tiled/Tmx.luau"], +[219126, "src/Rosetta/video/avi/init.luau"], +[219420, "src/Rosetta/video/fli/init.luau"], +[219571, "src/Rosetta/video/flv/init.luau"], +[219955, "src/Rosetta/video/flv/Amf.luau"], +[220113, "src/Rosetta/video/flv/Mux.luau"], +[220394, "src/Rosetta/video/h264/init.luau"], +[220533, "src/Rosetta/video/mkv/init.luau"], +[220689, "src/Rosetta/video/mkv/Mux.luau"], +[220968, "src/Rosetta/video/mkv/Parse.luau"], +[221689, "src/Rosetta/video/mp4/init.luau"], +[222017, "src/Rosetta/video/mpegps/init.luau"], +[222204, "src/Rosetta/video/mpegts/init.luau"], +[222450, "src/Rosetta/video/ogv/init.luau"], +[222845, "src/Rosetta/video/smk/init.luau"], +[223154, "src/Rosetta/video/smk/Audio.luau"], +[223274, "src/Rosetta/video/y4m/init.luau"] ] diff --git a/build/Rosetta.rbxm b/build/Rosetta.rbxm index 14fe6cc..6645efd 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 629bc05..6fa66e8 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"], [4414, "src/Rosetta/codecs/audio/Adpcm/init.luau"], [5168, "src/Rosetta/codecs/image/Yuv.luau"], [5473, "src/Rosetta/codecs/model/Rbx/init.luau"], [5710, "src/Rosetta/codecs/video/Video/init.luau"], [6268, "src/Rosetta/containers/AudioWrap.luau"], [6778, "src/Rosetta/containers/Ogg/Mux.luau"], [6967, "src/Rosetta/core/Bytes.luau"], [7494, "src/Rosetta/core/Crc32.luau"], [7645, "src/Rosetta/core/Err.luau"], [7727, "src/Rosetta/core/Input.luau"], [7803, "src/Rosetta/host/init.luau"]], -"Core_2": [[8, "src/Rosetta/ops/ImageOps/init.luau"], [656, "src/Rosetta/ops/ImageOps/Kernels.luau"]], +"Core_1": [[8, "src/Rosetta/init.luau"], [925, "src/Rosetta/Registry.luau"], [3542, "src/Rosetta/Types.luau"], [4655, "src/Rosetta/codecs/audio/Adpcm/init.luau"], [5409, "src/Rosetta/codecs/image/Yuv.luau"], [5714, "src/Rosetta/codecs/model/Rbx/init.luau"], [5951, "src/Rosetta/codecs/video/Video/init.luau"], [6509, "src/Rosetta/containers/AudioWrap.luau"], [7019, "src/Rosetta/containers/Ogg/Mux.luau"], [7208, "src/Rosetta/core/Bytes.luau"], [7735, "src/Rosetta/core/Crc32.luau"], [7886, "src/Rosetta/core/Err.luau"], [7968, "src/Rosetta/core/Input.luau"]], +"Core_2": [[8, "src/Rosetta/host/init.luau"], [53, "src/Rosetta/ops/ImageOps/init.luau"], [701, "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"], [1227, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], [2754, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], [2894, "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"], [382, "src/Rosetta/codecs/video/H264/Bitstream.luau"], [657, "src/Rosetta/codecs/video/H264/Cabac.luau"], [1788, "src/Rosetta/codecs/video/H264/Cavlc.luau"], [2556, "src/Rosetta/codecs/video/H264/Deblock.luau"], [2818, "src/Rosetta/codecs/video/H264/Decoder.luau"], [3828, "src/Rosetta/codecs/video/H264/Inter.luau"], [4154, "src/Rosetta/codecs/video/H264/Intra.luau"], [4561, "src/Rosetta/codecs/video/H264/Mb.luau"], [5500, "src/Rosetta/codecs/video/H264/Params.luau"], [5948, "src/Rosetta/codecs/video/H264/Slice.luau"], [6200, "src/Rosetta/codecs/video/H264/Tables.luau"], [6242, "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 ec96b82..3e4cb66 100644 --- a/build/Rosetta.rbxmx +++ b/build/Rosetta.rbxmx @@ -22,7 +22,7 @@ local __CHUNK = { ["core/Crc32"] = "Core_1", ["core/Err"] = "Core_1", ["core/Input"] = "Core_1", - ["host"] = "Core_1", + ["host"] = "Core_2", ["ops/ImageOps"] = "Core_2", ["ops/ImageOps/Kernels"] = "Core_2", ["codecs/video/Dsp"] = "Mpeg2", @@ -160,6 +160,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", @@ -680,7 +681,7 @@ return Rosetta --!optimize 2 --!nocheck -- rosetta chunk Core_1 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 14 modules (5 native: @native); the Rosetta root requires it when one of them is first included. +-- 13 modules (5 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() @@ -764,6 +765,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) @@ -773,52 +824,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 @@ -1382,7 +1416,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 @@ -1572,6 +1606,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, @@ -1580,6 +1616,8 @@ type Entry = { mime: { string }, deps: { string }, caps: { [string]: any }, + sniff: number, + variant: boolean?, load: () -> any, } @@ -1592,6 +1630,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, @@ -1604,6 +1643,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, @@ -1616,6 +1656,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, @@ -1628,6 +1669,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, @@ -1640,6 +1682,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, @@ -1652,6 +1695,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, @@ -1664,6 +1708,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, @@ -1676,6 +1721,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, @@ -1688,6 +1734,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, @@ -1700,6 +1747,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, @@ -1712,6 +1760,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, @@ -1724,6 +1773,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, @@ -1736,6 +1786,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, @@ -1748,6 +1799,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, @@ -1760,6 +1812,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, @@ -1772,6 +1825,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, @@ -1784,6 +1838,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, @@ -1796,6 +1851,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, @@ -1808,6 +1864,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, @@ -1820,6 +1877,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, @@ -1832,6 +1890,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, @@ -1844,6 +1903,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, @@ -1856,6 +1916,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, @@ -1868,6 +1929,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, @@ -1880,6 +1942,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, @@ -1892,6 +1955,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, @@ -1904,6 +1968,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, @@ -1916,6 +1981,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, @@ -1928,6 +1994,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, @@ -1940,6 +2007,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, @@ -1952,6 +2020,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, @@ -1964,6 +2033,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, @@ -1976,6 +2046,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, @@ -1988,6 +2059,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, @@ -2000,6 +2072,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, @@ -2012,6 +2085,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, @@ -2024,6 +2099,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, @@ -2036,6 +2112,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, @@ -2048,6 +2125,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, @@ -2060,6 +2138,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, @@ -2072,6 +2151,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, @@ -2084,6 +2164,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, @@ -2096,6 +2177,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, @@ -2108,6 +2190,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, @@ -2120,6 +2203,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, @@ -2132,6 +2216,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, @@ -2144,6 +2229,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, @@ -2156,6 +2242,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, @@ -2168,6 +2255,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, @@ -2180,6 +2268,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, @@ -2192,6 +2281,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, @@ -2204,6 +2294,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, @@ -2216,6 +2307,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, @@ -2228,6 +2320,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, @@ -2240,6 +2334,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, @@ -2252,6 +2347,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, @@ -2264,6 +2360,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, @@ -2276,6 +2373,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, @@ -2288,6 +2386,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, @@ -2300,6 +2399,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, @@ -2312,6 +2412,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, @@ -2324,6 +2425,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, @@ -2336,6 +2438,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, @@ -2348,6 +2451,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, @@ -2360,6 +2464,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, @@ -2372,6 +2477,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, @@ -2384,6 +2490,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, @@ -2396,6 +2503,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, @@ -2408,6 +2516,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, @@ -2420,6 +2529,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, @@ -2432,6 +2542,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, @@ -2444,6 +2555,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, @@ -2456,6 +2568,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, @@ -2468,6 +2581,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, @@ -2480,6 +2594,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, @@ -2492,6 +2607,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, @@ -2504,6 +2620,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, @@ -2516,6 +2633,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, @@ -2528,6 +2646,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, @@ -2540,6 +2659,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, @@ -2552,6 +2672,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, @@ -2564,6 +2685,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, @@ -2576,6 +2698,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, @@ -2588,6 +2711,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, @@ -2600,6 +2724,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, @@ -2612,6 +2737,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, @@ -2624,6 +2750,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, @@ -2636,6 +2763,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, @@ -2648,6 +2776,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, @@ -2660,6 +2790,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, @@ -2672,6 +2804,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, @@ -2684,6 +2817,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, @@ -2696,6 +2831,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, @@ -2708,6 +2844,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, @@ -2720,6 +2857,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, @@ -2732,6 +2870,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, @@ -2744,6 +2883,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, @@ -2756,6 +2896,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, @@ -2768,6 +2909,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, @@ -2780,6 +2922,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, @@ -2792,6 +2935,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, @@ -2804,6 +2948,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, @@ -2816,6 +2961,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, @@ -2828,6 +2974,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, @@ -2840,6 +2987,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, @@ -2852,6 +3000,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, @@ -2864,6 +3013,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, @@ -2876,6 +3026,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, @@ -2888,6 +3039,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, @@ -2900,6 +3052,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, @@ -2912,6 +3065,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, @@ -2924,6 +3078,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, @@ -2936,6 +3091,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, @@ -2948,6 +3104,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, @@ -2960,6 +3117,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, @@ -2972,6 +3130,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, @@ -2984,6 +3143,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, @@ -2996,6 +3156,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, @@ -3008,6 +3169,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, @@ -3020,6 +3182,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, @@ -3032,6 +3195,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, @@ -3044,6 +3208,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, @@ -3056,6 +3221,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, @@ -3068,6 +3234,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, @@ -3080,6 +3247,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, @@ -3092,6 +3260,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, @@ -3104,6 +3273,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, @@ -3116,6 +3286,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, @@ -3128,6 +3299,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, @@ -3140,6 +3312,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, @@ -3152,6 +3325,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, @@ -3164,6 +3338,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, @@ -3176,6 +3351,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, @@ -3188,6 +3364,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, @@ -3200,6 +3377,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, @@ -3212,6 +3390,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, @@ -3224,6 +3403,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, @@ -3236,6 +3416,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, @@ -3248,6 +3429,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, @@ -3260,6 +3442,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, @@ -3272,6 +3455,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, @@ -3284,6 +3468,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, @@ -3296,6 +3481,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, @@ -3308,6 +3494,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, @@ -3320,6 +3507,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, @@ -3332,6 +3520,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, @@ -3344,6 +3533,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, @@ -3356,6 +3546,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, @@ -3368,6 +3559,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, @@ -3380,6 +3572,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, @@ -3392,6 +3585,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, @@ -3404,6 +3598,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, @@ -3416,6 +3611,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, @@ -3428,6 +3624,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, @@ -3440,6 +3637,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, @@ -3452,6 +3650,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, @@ -3464,6 +3663,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, @@ -3476,6 +3676,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, @@ -3488,6 +3689,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, @@ -3500,6 +3702,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, @@ -3512,6 +3715,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, @@ -3524,6 +3728,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, @@ -3536,6 +3741,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, @@ -3548,6 +3754,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, @@ -3560,6 +3767,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, @@ -3572,6 +3780,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, @@ -3584,6 +3793,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, @@ -3596,6 +3806,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, @@ -3608,6 +3819,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, @@ -3620,6 +3832,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, @@ -3632,6 +3845,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, @@ -3644,6 +3858,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, @@ -3656,6 +3871,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, @@ -3668,6 +3884,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, @@ -3680,6 +3897,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, @@ -3692,6 +3910,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, @@ -3704,6 +3923,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, @@ -3716,6 +3936,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, @@ -3728,6 +3949,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, @@ -3740,6 +3962,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, @@ -3752,6 +3975,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, @@ -3764,6 +3988,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, @@ -3776,6 +4001,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, @@ -3788,6 +4014,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, @@ -3800,6 +4027,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, @@ -3812,6 +4040,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, @@ -3824,6 +4053,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, @@ -3836,6 +4066,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, @@ -3848,6 +4079,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, @@ -3860,6 +4092,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, @@ -3872,6 +4105,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, @@ -3884,6 +4118,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, @@ -3896,6 +4131,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, @@ -3908,6 +4144,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, @@ -3920,6 +4157,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, @@ -3932,6 +4170,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, @@ -3944,6 +4183,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, @@ -3956,6 +4196,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, @@ -3968,6 +4209,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, @@ -8478,6 +8720,19 @@ end return Input 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. +-- 3 modules (1 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["host"] = function() -- host: the runtime adapter, detected once at load time. Roblox (no file system; toEditableImage), LÖVE @@ -8523,19 +8778,6 @@ end local _ = Err return host 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. --- 2 modules (1 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["ops/ImageOps"] = function() -- ops/ImageOps: editing on the standard Image: conversion, crop, resize, flips, rotation, compositing, pixel access, @@ -74680,6 +74922,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 @@ -82641,7 +86282,7 @@ end - + archive_2 --!optimize 2 @@ -83501,7 +87142,7 @@ end - + audio --!optimize 2 @@ -91631,7 +95272,7 @@ end - + cad --!optimize 2 @@ -93066,7 +96707,7 @@ end - + codecs_audio --!optimize 2 @@ -99314,7 +102955,7 @@ end - + codecs_compress --!optimize 2 @@ -102355,7 +105996,7 @@ end - + codecs_entropy --!optimize 2 @@ -103131,7 +106772,7 @@ end - + codecs_font --!optimize 2 @@ -105344,7 +108985,7 @@ end - + codecs_image --!optimize 2 @@ -108399,7 +112040,7 @@ end - + codecs_model --!optimize 2 @@ -116478,7 +120119,7 @@ end - + codecs_text --!optimize 2 @@ -122680,7 +126321,7 @@ end - + codecs_video --!optimize 2 @@ -122979,7 +126620,7 @@ end - + containers --!optimize 2 @@ -131362,7 +135003,7 @@ end - + core --!optimize 2 @@ -132195,7 +135836,7 @@ end - + data --!optimize 2 @@ -137949,7 +141590,7 @@ end - + font --!optimize 2 @@ -141858,7 +145499,7 @@ end - + host --!optimize 2 @@ -142446,7 +146087,7 @@ end - + image_1 --!optimize 2 @@ -150290,7 +153931,7 @@ end - + image_2 --!optimize 2 @@ -154039,7 +157680,7 @@ end - + layered --!optimize 2 @@ -156164,7 +159805,7 @@ end - + model_1 --!optimize 2 @@ -163177,7 +166818,7 @@ end - + model_2 --!optimize 2 @@ -169836,7 +173477,7 @@ end - + model_3 --!optimize 2 @@ -177190,7 +180831,7 @@ end - + model_4 --!optimize 2 @@ -184598,7 +188239,7 @@ end - + model_5 --!optimize 2 @@ -192656,7 +196297,7 @@ end - + model_6 --!optimize 2 @@ -200621,7 +204262,7 @@ end - + model_7 --!optimize 2 @@ -201572,7 +205213,7 @@ end - + music --!optimize 2 @@ -207177,7 +210818,7 @@ end - + ops --!optimize 2 @@ -209330,7 +212971,7 @@ end - + playlist --!optimize 2 @@ -210077,7 +213718,7 @@ end - + subtitle --!optimize 2 @@ -210910,7 +214551,7 @@ end - + vector --!optimize 2 @@ -216924,7 +220565,7 @@ end - + video --!optimize 2 diff --git a/build/rosetta.lua b/build/rosetta.lua index 36cfb6f..a5f46e2 100644 --- a/build/rosetta.lua +++ b/build/rosetta.lua @@ -743,6 +743,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 +802,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 +1394,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 +1584,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 +1608,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 +1621,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 +1634,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 +1647,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 +1660,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 +1673,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 +1686,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 +1699,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 +1712,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 +1725,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 +1738,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 +1751,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 +1764,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 +1777,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 +1790,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 +1803,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 +1816,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 +1829,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 +1842,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 +1855,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 +1868,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 +1881,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 +1894,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 +1907,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 +1920,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 +1933,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 +1946,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 +1959,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 +1972,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 +1985,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 +1998,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 +2011,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 +2024,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 +2037,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 +2050,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 +2063,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 +2077,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 +2090,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 +2103,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 +2116,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 +2129,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 +2142,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 +2155,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 +2168,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 +2181,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 +2194,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 +2207,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 +2220,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 +2233,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 +2246,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 +2259,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 +2272,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 +2285,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 +2298,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 +2312,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 +2325,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 +2338,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 +2351,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 +2364,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 +2377,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 +2390,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 +2403,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 +2416,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 +2429,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 +2442,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 +2455,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 +2468,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 +2481,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 +2494,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 +2507,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 +2520,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 +2533,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 +2546,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 +2559,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 +2572,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 +2585,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 +2598,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 +2611,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 +2624,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 +2637,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 +2650,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 +2663,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 +2676,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 +2689,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 +2702,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 +2715,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 +2728,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 +2741,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 +2754,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 +2768,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 +2782,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 +2795,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 +2809,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 +2822,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 +2835,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 +2848,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 +2861,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 +2874,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 +2887,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 +2900,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 +2913,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 +2926,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 +2939,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 +2952,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 +2965,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 +2978,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 +2991,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 +3004,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 +3017,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 +3030,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 +3043,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 +3056,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 +3069,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 +3082,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 +3095,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 +3108,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 +3121,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 +3134,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 +3147,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 +3160,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 +3173,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 +3186,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 +3199,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 +3212,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 +3225,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 +3238,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 +3251,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 +3264,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 +3277,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 +3290,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 +3303,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 +3316,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 +3329,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 +3342,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 +3355,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 +3368,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 +3381,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 +3394,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 +3407,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 +3420,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 +3433,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 +3446,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 +3459,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 +3472,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 +3485,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 +3498,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 +3511,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 +3524,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 +3537,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 +3550,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 +3563,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 +3576,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 +3589,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 +3602,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 +3615,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 +3628,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 +3641,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 +3654,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 +3667,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 +3680,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 +3693,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 +3706,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 +3719,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 +3732,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 +3745,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 +3758,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 +3771,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 +3784,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 +3797,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 +3810,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 +3823,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 +3836,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 +3849,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 +3862,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 +3875,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 +3888,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 +3901,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 +3914,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 +3927,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 +3940,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 +3953,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 +3966,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 +3979,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 +3992,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 +4005,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 +4018,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 +4031,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 +4044,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 +4057,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 +4070,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 +4083,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 +4096,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 +4109,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 +4122,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 +4135,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 +4148,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 +4161,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 +4174,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 +4187,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 +4196,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 diff --git a/build/rosetta.lua.linemap.json b/build/rosetta.lua.linemap.json index 1f5f820..6397f24 100644 --- a/build/rosetta.lua.linemap.json +++ b/build/rosetta.lua.linemap.json @@ -1,618 +1,619 @@ [ [666, "src/Rosetta/init.luau"], -[1550, "src/Rosetta/Registry.luau"], -[3959, "src/Rosetta/Types.luau"], -[5072, "src/Rosetta/archive/7z/init.luau"], -[5457, "src/Rosetta/archive/7z/Header.luau"], -[5984, "src/Rosetta/archive/adf/init.luau"], -[6266, "src/Rosetta/archive/applesingle/init.luau"], -[6452, "src/Rosetta/archive/ar/init.luau"], -[6855, "src/Rosetta/archive/arj/init.luau"], -[7065, "src/Rosetta/archive/binhex/init.luau"], -[7314, "src/Rosetta/archive/br/init.luau"], -[7389, "src/Rosetta/archive/bz2/init.luau"], -[7453, "src/Rosetta/archive/cab/init.luau"], -[7866, "src/Rosetta/archive/cab/Sum.luau"], -[7907, "src/Rosetta/archive/cpio/init.luau"], -[8075, "src/Rosetta/archive/d64/init.luau"], -[8489, "src/Rosetta/archive/fat/init.luau"], -[8611, "src/Rosetta/archive/grp/init.luau"], -[8725, "src/Rosetta/archive/gzip/init.luau"], -[8910, "src/Rosetta/archive/iso/init.luau"], -[8982, "src/Rosetta/archive/lha/init.luau"], -[9407, "src/Rosetta/archive/lz4/init.luau"], -[9751, "src/Rosetta/archive/macbinary/init.luau"], -[9949, "src/Rosetta/archive/mpq/init.luau"], -[10355, "src/Rosetta/archive/mpq/Crypt.luau"], -[10420, "src/Rosetta/archive/pak/init.luau"], -[10554, "src/Rosetta/archive/rpm/init.luau"], -[10878, "src/Rosetta/archive/tar/init.luau"], -[10996, "src/Rosetta/archive/unitypackage/init.luau"], -[11232, "src/Rosetta/archive/uu/init.luau"], -[11502, "src/Rosetta/archive/vpk/init.luau"], -[11813, "src/Rosetta/archive/vswap/init.luau"], -[12083, "src/Rosetta/archive/wad/init.luau"], -[12537, "src/Rosetta/archive/wad/Picture.luau"], -[12639, "src/Rosetta/archive/wad2/init.luau"], -[12921, "src/Rosetta/archive/xz/init.luau"], -[13021, "src/Rosetta/archive/yenc/init.luau"], -[13293, "src/Rosetta/archive/z/init.luau"], -[13389, "src/Rosetta/archive/zip/init.luau"], -[13608, "src/Rosetta/archive/zoo/init.luau"], -[13804, "src/Rosetta/archive/zst/init.luau"], -[13868, "src/Rosetta/audio/aac/init.luau"], -[14081, "src/Rosetta/audio/ac3/init.luau"], -[14228, "src/Rosetta/audio/adpcm/init.luau"], -[14374, "src/Rosetta/audio/adx/init.luau"], -[14606, "src/Rosetta/audio/aiff/init.luau"], -[14998, "src/Rosetta/audio/ape/init.luau"], -[15127, "src/Rosetta/audio/au/init.luau"], -[15289, "src/Rosetta/audio/brstm/init.luau"], -[15581, "src/Rosetta/audio/caf/init.luau"], -[16248, "src/Rosetta/audio/flac/init.luau"], -[16397, "src/Rosetta/audio/flac/Meta.luau"], -[16619, "src/Rosetta/audio/flac/Stream.luau"], -[16989, "src/Rosetta/audio/m4a/init.luau"], -[17332, "src/Rosetta/audio/mp3/init.luau"], -[17593, "src/Rosetta/audio/mp3/Index.luau"], -[17784, "src/Rosetta/audio/mp3/Stream.luau"], -[18011, "src/Rosetta/audio/mp3/Tags.luau"], -[18323, "src/Rosetta/audio/mpc/init.luau"], -[18418, "src/Rosetta/audio/opus/init.luau"], -[18797, "src/Rosetta/audio/opus/Encode.luau"], -[18909, "src/Rosetta/audio/qoa/init.luau"], -[19090, "src/Rosetta/audio/tta/init.luau"], -[19209, "src/Rosetta/audio/vag/init.luau"], -[19433, "src/Rosetta/audio/voc/init.luau"], -[19709, "src/Rosetta/audio/vorbis/init.luau"], -[20164, "src/Rosetta/audio/vorbis/Encode.luau"], -[20977, "src/Rosetta/audio/wav/init.luau"], -[21598, "src/Rosetta/audio/wav/Codecs.luau"], -[21777, "src/Rosetta/audio/wavpack/init.luau"], -[21985, "src/Rosetta/cad/step/init.luau"], -[22367, "src/Rosetta/cad/step/Brep.luau"], -[22602, "src/Rosetta/cad/step/Parse.luau"], -[23159, "src/Rosetta/cad/step/Write.luau"], -[23407, "src/Rosetta/codecs/audio/Aac/init.luau"], -[23815, "src/Rosetta/codecs/audio/Aac/Decode.luau"], -[24791, "src/Rosetta/codecs/audio/Aac/Ps.luau"], -[25381, "src/Rosetta/codecs/audio/Aac/Sbr.luau"], -[26448, "src/Rosetta/codecs/audio/Aac/SbrBits.luau"], -[26567, "src/Rosetta/codecs/audio/Aac/SbrDct.luau"], -[27809, "src/Rosetta/codecs/audio/Aac/SbrHf.luau"], -[28301, "src/Rosetta/codecs/audio/Aac/SbrQmf.luau"], -[28418, "src/Rosetta/codecs/audio/Aac/SbrTables.luau"], -[28831, "src/Rosetta/codecs/audio/Aac/Tables.luau"], -[29167, "src/Rosetta/codecs/audio/Ac3/init.luau"], -[29327, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], -[30212, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], -[30314, "src/Rosetta/codecs/audio/Adpcm/init.luau"], -[31068, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], -[31371, "src/Rosetta/codecs/audio/Alac/init.luau"], -[31606, "src/Rosetta/codecs/audio/Alac/Decode.luau"], -[32025, "src/Rosetta/codecs/audio/Alac/Encode.luau"], -[32437, "src/Rosetta/codecs/audio/Ape/init.luau"], -[32653, "src/Rosetta/codecs/audio/Ape/Decode.luau"], -[33414, "src/Rosetta/codecs/audio/ApeTag.luau"], -[33512, "src/Rosetta/codecs/audio/Flac/init.luau"], -[33524, "src/Rosetta/codecs/audio/Flac/Encode.luau"], -[34473, "src/Rosetta/codecs/audio/Flac/Frame.luau"], -[35093, "src/Rosetta/codecs/audio/Hively/init.luau"], -[35290, "src/Rosetta/codecs/audio/Hively/Load.luau"], -[35540, "src/Rosetta/codecs/audio/Hively/Player.luau"], -[36499, "src/Rosetta/codecs/audio/Hively/Tables.luau"], -[36719, "src/Rosetta/codecs/audio/Mdct/init.luau"], -[36939, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], -[37193, "src/Rosetta/codecs/audio/MidiRender.luau"], -[37540, "src/Rosetta/codecs/audio/Mpa/init.luau"], -[37555, "src/Rosetta/codecs/audio/Mpa/Analysis.luau"], -[37614, "src/Rosetta/codecs/audio/Mpa/Core.luau"], -[39272, "src/Rosetta/codecs/audio/Mpa/EncTables.luau"], -[39565, "src/Rosetta/codecs/audio/Mpa/Encode2.luau"], -[39950, "src/Rosetta/codecs/audio/Mpa/Encode3.luau"], -[40591, "src/Rosetta/codecs/audio/Mpa/Header.luau"], -[40732, "src/Rosetta/codecs/audio/Mpa/Tables.luau"], -[40959, "src/Rosetta/codecs/audio/Musepack/init.luau"], -[41305, "src/Rosetta/codecs/audio/Musepack/Decode.luau"], -[42199, "src/Rosetta/codecs/audio/Musepack/Tables.luau"], -[42578, "src/Rosetta/codecs/audio/Opus/init.luau"], -[42593, "src/Rosetta/codecs/audio/Opus/Celt.luau"], -[44465, "src/Rosetta/codecs/audio/Opus/CeltEncoder.luau"], -[45530, "src/Rosetta/codecs/audio/Opus/CeltTables.luau"], -[45591, "src/Rosetta/codecs/audio/Opus/Decoder.luau"], -[46055, "src/Rosetta/codecs/audio/Opus/Mdct.luau"], -[46406, "src/Rosetta/codecs/audio/Opus/Packet.luau"], -[46639, "src/Rosetta/codecs/audio/Opus/Silk.luau"], -[48681, "src/Rosetta/codecs/audio/Opus/SilkTables.luau"], -[49055, "src/Rosetta/codecs/audio/Pcm/init.luau"], -[49319, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], -[49616, "src/Rosetta/codecs/audio/Qoa/init.luau"], -[49898, "src/Rosetta/codecs/audio/Resample/init.luau"], -[50293, "src/Rosetta/codecs/audio/SoundFont/init.luau"], -[50348, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], -[50492, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], -[51006, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"], -[51805, "src/Rosetta/codecs/audio/Stream.luau"], -[51967, "src/Rosetta/codecs/audio/Tracker/init.luau"], -[52450, "src/Rosetta/codecs/audio/Tracker/Load.luau"], -[52729, "src/Rosetta/codecs/audio/Tracker/Mixer.luau"], -[52976, "src/Rosetta/codecs/audio/Tracker/Pcm.luau"], -[53105, "src/Rosetta/codecs/audio/Tracker/Player.luau"], -[55094, "src/Rosetta/codecs/audio/Tracker/Tables.luau"], -[55211, "src/Rosetta/codecs/audio/Tta/init.luau"], -[55329, "src/Rosetta/codecs/audio/Tta/Decode.luau"], -[55581, "src/Rosetta/codecs/audio/Vorbis/init.luau"], -[55595, "src/Rosetta/codecs/audio/Vorbis/Codebook.luau"], -[55979, "src/Rosetta/codecs/audio/Vorbis/Packet.luau"], -[56552, "src/Rosetta/codecs/audio/Vorbis/Setup.luau"], -[56974, "src/Rosetta/codecs/audio/Vorbis/Tables.luau"], -[57014, "src/Rosetta/codecs/audio/VorbisComment.luau"], -[57067, "src/Rosetta/codecs/audio/WavPack/init.luau"], -[57290, "src/Rosetta/codecs/audio/WavPack/Block.luau"], -[58745, "src/Rosetta/codecs/audio/WavPack/Tables.luau"], -[58808, "src/Rosetta/codecs/compress/Brotli/init.luau"], -[58895, "src/Rosetta/codecs/compress/Brotli/Decode.luau"], -[59871, "src/Rosetta/codecs/compress/Brotli/Static.luau"], -[60739, "src/Rosetta/codecs/compress/Bzip2/init.luau"], -[60783, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], -[61296, "src/Rosetta/codecs/compress/Deflate/init.luau"], -[61622, "src/Rosetta/codecs/compress/Deflate/Compress.luau"], -[62104, "src/Rosetta/codecs/compress/Deflate/Inflate.luau"], -[62552, "src/Rosetta/codecs/compress/Explode.luau"], -[62748, "src/Rosetta/codecs/compress/Lz4.luau"], -[63017, "src/Rosetta/codecs/compress/Lzh/init.luau"], -[63621, "src/Rosetta/codecs/compress/Lzma/init.luau"], -[64161, "src/Rosetta/codecs/compress/Lzma/Crc64.luau"], -[64228, "src/Rosetta/codecs/compress/Lzma/Decode.luau"], -[64701, "src/Rosetta/codecs/compress/Lzma/Filters.luau"], -[64877, "src/Rosetta/codecs/compress/Lzw/init.luau"], -[65145, "src/Rosetta/codecs/compress/Lzx.luau"], -[65579, "src/Rosetta/codecs/compress/PackBits.luau"], -[65669, "src/Rosetta/codecs/compress/Quantum.luau"], -[65906, "src/Rosetta/codecs/compress/UnixCompress.luau"], -[66210, "src/Rosetta/codecs/compress/Xxh32.luau"], -[66279, "src/Rosetta/codecs/compress/Zstd/init.luau"], -[66336, "src/Rosetta/codecs/compress/Zstd/Decode.luau"], -[67320, "src/Rosetta/codecs/compress/Zstd/Xxh64.luau"], -[67472, "src/Rosetta/codecs/entropy/Huffman.luau"], -[67759, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], -[67770, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], -[67991, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.luau"], -[68235, "src/Rosetta/codecs/font/Bitmap.luau"], -[68436, "src/Rosetta/codecs/font/Cff/init.luau"], -[69077, "src/Rosetta/codecs/font/GlyphNames.luau"], -[69227, "src/Rosetta/codecs/font/TrueType/init.luau"], -[69541, "src/Rosetta/codecs/font/TrueType/Glyf.luau"], -[69933, "src/Rosetta/codecs/font/TrueType/Tables.luau"], -[70435, "src/Rosetta/codecs/image/Bcn/init.luau"], -[70542, "src/Rosetta/codecs/image/Bcn/Decode.luau"], -[71026, "src/Rosetta/codecs/image/Bcn/Encode.luau"], -[71455, "src/Rosetta/codecs/image/Blend.luau"], -[71834, "src/Rosetta/codecs/image/Dct/init.luau"], -[72334, "src/Rosetta/codecs/image/Etc.luau"], -[72632, "src/Rosetta/codecs/image/Half.luau"], -[72701, "src/Rosetta/codecs/image/Jpeg/init.luau"], -[73055, "src/Rosetta/codecs/image/Jpeg/Arith.luau"], -[73463, "src/Rosetta/codecs/image/Jpeg/Color.luau"], -[73828, "src/Rosetta/codecs/image/Jpeg/Decode.luau"], -[74593, "src/Rosetta/codecs/image/Jpeg/Encode.luau"], -[75474, "src/Rosetta/codecs/image/Jpeg/Scan.luau"], -[75943, "src/Rosetta/codecs/image/Jpeg/Tables.luau"], -[76021, "src/Rosetta/codecs/image/Jpeg/Yuv.luau"], -[76088, "src/Rosetta/codecs/image/Miptex.luau"], -[76388, "src/Rosetta/codecs/image/Pixels.luau"], -[76708, "src/Rosetta/codecs/image/Quantize/init.luau"], -[77169, "src/Rosetta/codecs/image/Raster.luau"], -[77866, "src/Rosetta/codecs/image/Texel.luau"], -[78239, "src/Rosetta/codecs/image/Texture.luau"], -[78384, "src/Rosetta/codecs/image/Vp8/init.luau"], -[78515, "src/Rosetta/codecs/image/Vp8/Decode.luau"], -[80471, "src/Rosetta/codecs/image/Vp8/Predict.luau"], -[80734, "src/Rosetta/codecs/image/Vp8/Tables.luau"], -[80984, "src/Rosetta/codecs/image/Vp8/Yuv.luau"], -[81126, "src/Rosetta/codecs/image/Vp8L/init.luau"], -[81230, "src/Rosetta/codecs/image/Vp8L/Decode.luau"], -[82170, "src/Rosetta/codecs/image/Vp8L/Encode.luau"], -[83122, "src/Rosetta/codecs/image/Yuv.luau"], -[83427, "src/Rosetta/codecs/model/Brush.luau"], -[84067, "src/Rosetta/codecs/model/Displacement.luau"], -[84216, "src/Rosetta/codecs/model/DoomMap/init.luau"], -[84661, "src/Rosetta/codecs/model/DoomMap/Udmf.luau"], -[84911, "src/Rosetta/codecs/model/Draco/init.luau"], -[85243, "src/Rosetta/codecs/model/Draco/Attributes.luau"], -[85712, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], -[86901, "src/Rosetta/codecs/model/Draco/Int64.luau"], -[87050, "src/Rosetta/codecs/model/Draco/KdTree.luau"], -[87409, "src/Rosetta/codecs/model/Draco/Predict.luau"], -[88371, "src/Rosetta/codecs/model/Draco/Reader.luau"], -[88845, "src/Rosetta/codecs/model/Mat4.luau"], -[89104, "src/Rosetta/codecs/model/MeshFlatten.luau"], -[89632, "src/Rosetta/codecs/model/Minecraft/init.luau"], -[90184, "src/Rosetta/codecs/model/Minecraft/Colors.luau"], -[90263, "src/Rosetta/codecs/model/Minecraft/Legacy.luau"], -[90370, "src/Rosetta/codecs/model/Minecraft/Packed.luau"], -[90576, "src/Rosetta/codecs/model/Patch.luau"], -[90700, "src/Rosetta/codecs/model/Polygon.luau"], -[90934, "src/Rosetta/codecs/model/Rbx/init.luau"], -[91171, "src/Rosetta/codecs/model/Rbx/Binary.luau"], -[91925, "src/Rosetta/codecs/model/Rig.luau"], -[92168, "src/Rosetta/codecs/model/Sampler.luau"], -[92328, "src/Rosetta/codecs/model/SourceAnim.luau"], -[92549, "src/Rosetta/codecs/model/Vrml/init.luau"], -[92697, "src/Rosetta/codecs/model/Vrml/Build.luau"], -[93271, "src/Rosetta/codecs/model/Vrml/Fields.luau"], -[93434, "src/Rosetta/codecs/model/Vrml/Geometry.luau"], -[94183, "src/Rosetta/codecs/model/Vrml/Parse.luau"], -[94705, "src/Rosetta/codecs/model/Vrml/Write.luau"], -[95432, "src/Rosetta/codecs/model/Vrml/Xml.luau"], -[95664, "src/Rosetta/codecs/text/GodotVariant.luau"], -[96323, "src/Rosetta/codecs/text/Json/init.luau"], -[96592, "src/Rosetta/codecs/text/Json/Decode.luau"], -[97027, "src/Rosetta/codecs/text/Json/Encode.luau"], -[97372, "src/Rosetta/codecs/text/KeyValues/init.luau"], -[97942, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], -[98248, "src/Rosetta/codecs/text/Lexer/init.luau"], -[98380, "src/Rosetta/codecs/text/Nbt/init.luau"], -[98733, "src/Rosetta/codecs/text/Nbt/Binary.luau"], -[99425, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], -[100065, "src/Rosetta/codecs/text/Nbt/Value.luau"], -[100303, "src/Rosetta/codecs/text/Text/init.luau"], -[100394, "src/Rosetta/codecs/text/Url/init.luau"], -[100599, "src/Rosetta/codecs/text/Xml/init.luau"], -[101049, "src/Rosetta/codecs/text/Xml/Parse.luau"], -[101853, "src/Rosetta/codecs/video/Dsp.luau"], -[102691, "src/Rosetta/codecs/video/H263/init.luau"], -[102848, "src/Rosetta/codecs/video/H263/Decoder.luau"], -[103706, "src/Rosetta/codecs/video/H263/Tables.luau"], -[103910, "src/Rosetta/codecs/video/H264/init.luau"], -[104284, "src/Rosetta/codecs/video/H264/Bitstream.luau"], -[104559, "src/Rosetta/codecs/video/H264/Cabac.luau"], -[105690, "src/Rosetta/codecs/video/H264/Cavlc.luau"], -[106458, "src/Rosetta/codecs/video/H264/Deblock.luau"], -[106720, "src/Rosetta/codecs/video/H264/Decoder.luau"], -[107730, "src/Rosetta/codecs/video/H264/Inter.luau"], -[108056, "src/Rosetta/codecs/video/H264/Intra.luau"], -[108463, "src/Rosetta/codecs/video/H264/Mb.luau"], -[109402, "src/Rosetta/codecs/video/H264/Params.luau"], -[109850, "src/Rosetta/codecs/video/H264/Slice.luau"], -[110102, "src/Rosetta/codecs/video/H264/Tables.luau"], -[110144, "src/Rosetta/codecs/video/H264/Transform.luau"], -[110309, "src/Rosetta/codecs/video/Legacy/init.luau"], -[110508, "src/Rosetta/codecs/video/Legacy/Cinepak.luau"], -[110805, "src/Rosetta/codecs/video/Legacy/Flic.luau"], -[111172, "src/Rosetta/codecs/video/Legacy/Msvideo1.luau"], -[111290, "src/Rosetta/codecs/video/Legacy/Picture.luau"], -[111398, "src/Rosetta/codecs/video/Legacy/QtRle.luau"], -[111671, "src/Rosetta/codecs/video/Legacy/Smacker.luau"], -[112066, "src/Rosetta/codecs/video/Legacy/Smc.luau"], -[112243, "src/Rosetta/codecs/video/Mpeg1/init.luau"], -[112256, "src/Rosetta/codecs/video/Mpeg2/init.luau"], -[112624, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], -[114151, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], -[114291, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"], -[114430, "src/Rosetta/codecs/video/Theora/init.luau"], -[114694, "src/Rosetta/codecs/video/Theora/Decoder.luau"], -[115958, "src/Rosetta/codecs/video/Theora/Header.luau"], -[116322, "src/Rosetta/codecs/video/Video/init.luau"], -[116880, "src/Rosetta/codecs/video/Video/Source.luau"], -[117166, "src/Rosetta/containers/Archive.luau"], -[117433, "src/Rosetta/containers/AudioWrap.luau"], -[117943, "src/Rosetta/containers/Avi/init.luau"], -[118496, "src/Rosetta/containers/Blend.luau"], -[119235, "src/Rosetta/containers/Chunks.luau"], -[119370, "src/Rosetta/containers/Cpio.luau"], -[119798, "src/Rosetta/containers/Demux.luau"], -[120073, "src/Rosetta/containers/Ebml/init.luau"], -[120387, "src/Rosetta/containers/Fat.luau"], -[121075, "src/Rosetta/containers/Iso9660.luau"], -[121580, "src/Rosetta/containers/IsoBmff/init.luau"], -[121751, "src/Rosetta/containers/IsoBmff/Box.luau"], -[121940, "src/Rosetta/containers/IsoBmff/Demux.luau"], -[122786, "src/Rosetta/containers/IsoBmff/Meta.luau"], -[123308, "src/Rosetta/containers/IsoBmff/Mux.luau"], -[123825, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], -[123943, "src/Rosetta/containers/MacFile.luau"], -[124092, "src/Rosetta/containers/MpegEs.luau"], -[124259, "src/Rosetta/containers/MpegPs/init.luau"], -[124480, "src/Rosetta/containers/MpegTs/init.luau"], -[125273, "src/Rosetta/containers/Ogg/init.luau"], -[125698, "src/Rosetta/containers/Ogg/Mux.luau"], -[125887, "src/Rosetta/containers/Ogg/Page.luau"], -[126053, "src/Rosetta/containers/Riff/init.luau"], -[126370, "src/Rosetta/containers/Tar.luau"], -[126784, "src/Rosetta/containers/Zip/init.luau"], -[127416, "src/Rosetta/core/Adler32.luau"], -[127476, "src/Rosetta/core/Base64.luau"], -[127704, "src/Rosetta/core/Bits.luau"], -[127997, "src/Rosetta/core/Bytes.luau"], -[128524, "src/Rosetta/core/Crc16.luau"], -[128576, "src/Rosetta/core/Crc32.luau"], -[128727, "src/Rosetta/core/Err.luau"], -[128809, "src/Rosetta/core/Input.luau"], -[128885, "src/Rosetta/core/Md5.luau"], -[129043, "src/Rosetta/core/Sniff.luau"], -[129072, "src/Rosetta/data/cbor/init.luau"], -[129171, "src/Rosetta/data/cbor/Codec.luau"], -[129740, "src/Rosetta/data/csv/init.luau"], -[130052, "src/Rosetta/data/ini/init.luau"], -[130298, "src/Rosetta/data/json/init.luau"], -[130390, "src/Rosetta/data/msgpack/init.luau"], -[130479, "src/Rosetta/data/msgpack/Codec.luau"], -[130921, "src/Rosetta/data/nbt/init.luau"], -[130980, "src/Rosetta/data/plist/init.luau"], -[131286, "src/Rosetta/data/plist/Binary.luau"], -[131553, "src/Rosetta/data/q3shader/init.luau"], -[131792, "src/Rosetta/data/q3skin/init.luau"], -[131888, "src/Rosetta/data/snbt/init.luau"], -[131951, "src/Rosetta/data/toml/init.luau"], -[132018, "src/Rosetta/data/toml/Decode.luau"], -[132646, "src/Rosetta/data/toml/Encode.luau"], -[132855, "src/Rosetta/data/tres/init.luau"], -[133000, "src/Rosetta/data/vdf/init.luau"], -[133101, "src/Rosetta/data/xml/init.luau"], -[133157, "src/Rosetta/data/yaml/init.luau"], -[133230, "src/Rosetta/data/yaml/Emit.luau"], -[133520, "src/Rosetta/data/yaml/Parse.luau"], -[134813, "src/Rosetta/font/bdf/init.luau"], -[135102, "src/Rosetta/font/bmfont/init.luau"], -[135529, "src/Rosetta/font/bmfont/Parse.luau"], -[135982, "src/Rosetta/font/eot/init.luau"], -[136214, "src/Rosetta/font/fon/init.luau"], -[136497, "src/Rosetta/font/hershey/init.luau"], -[136692, "src/Rosetta/font/pcf/init.luau"], -[136972, "src/Rosetta/font/psf/init.luau"], -[137292, "src/Rosetta/font/ttf/init.luau"], -[137343, "src/Rosetta/font/type1/init.luau"], -[137702, "src/Rosetta/font/type1/Charstring.luau"], -[137980, "src/Rosetta/font/woff/init.luau"], -[138112, "src/Rosetta/font/woff2/init.luau"], -[138169, "src/Rosetta/font/woff2/Rebuild.luau"], -[138709, "src/Rosetta/host/init.luau"], -[138754, "src/Rosetta/host/Love.luau"], -[138897, "src/Rosetta/host/LuaJIT.luau"], -[138947, "src/Rosetta/host/Luau.luau"], -[138970, "src/Rosetta/host/Roblox.luau"], -[139329, "src/Rosetta/image/ani/init.luau"], -[139509, "src/Rosetta/image/art/init.luau"], -[139997, "src/Rosetta/image/blp/init.luau"], -[140255, "src/Rosetta/image/bmp/init.luau"], -[140670, "src/Rosetta/image/dds/init.luau"], -[141153, "src/Rosetta/image/exr/init.luau"], -[141913, "src/Rosetta/image/exr/Codec.luau"], -[142024, "src/Rosetta/image/exr/Piz.luau"], -[142381, "src/Rosetta/image/gif/init.luau"], -[142897, "src/Rosetta/image/gif/Decode.luau"], -[142973, "src/Rosetta/image/hdr/init.luau"], -[143202, "src/Rosetta/image/hdr/Codec.luau"], -[143413, "src/Rosetta/image/icns/init.luau"], -[143744, "src/Rosetta/image/ico/init.luau"], -[144021, "src/Rosetta/image/ico/Dib.luau"], -[144116, "src/Rosetta/image/ilbm/init.luau"], -[144435, "src/Rosetta/image/jpeg/init.luau"], -[144571, "src/Rosetta/image/ktx/init.luau"], -[145231, "src/Rosetta/image/lmp/init.luau"], -[145364, "src/Rosetta/image/pcx/init.luau"], -[145628, "src/Rosetta/image/png/init.luau"], -[146208, "src/Rosetta/image/png/Apng.luau"], -[146288, "src/Rosetta/image/png/Decode.luau"], -[146661, "src/Rosetta/image/png/Encode.luau"], -[146864, "src/Rosetta/image/pnm/init.luau"], -[147242, "src/Rosetta/image/pnm/Codec.luau"], -[147519, "src/Rosetta/image/qoi/init.luau"], -[147641, "src/Rosetta/image/qoi/Codec.luau"], -[147798, "src/Rosetta/image/sgi/init.luau"], -[148083, "src/Rosetta/image/spr/init.luau"], -[148396, "src/Rosetta/image/sunras/init.luau"], -[148642, "src/Rosetta/image/tga/init.luau"], -[148912, "src/Rosetta/image/tga/Codec.luau"], -[149112, "src/Rosetta/image/tiff/init.luau"], -[149939, "src/Rosetta/image/tiff/Pixels.luau"], -[150329, "src/Rosetta/image/tim/init.luau"], -[150571, "src/Rosetta/image/vtf/init.luau"], -[150806, "src/Rosetta/image/webp/init.luau"], -[151416, "src/Rosetta/image/webp/Alpha.luau"], -[151492, "src/Rosetta/image/webp/Anim.luau"], -[151647, "src/Rosetta/image/xbm/init.luau"], -[151808, "src/Rosetta/image/xpm/init.luau"], -[152076, "src/Rosetta/image/xpm/Names.luau"], -[152132, "src/Rosetta/layered/aseprite/init.luau"], -[152870, "src/Rosetta/layered/ora/init.luau"], -[153157, "src/Rosetta/layered/psd/init.luau"], -[153892, "src/Rosetta/layered/psd/Channels.luau"], -[154244, "src/Rosetta/model/3ds/init.luau"], -[154327, "src/Rosetta/model/3ds/Build.luau"], -[154974, "src/Rosetta/model/3ds/Read.luau"], -[155470, "src/Rosetta/model/3ds/Write.luau"], -[156275, "src/Rosetta/model/3mf/init.luau"], -[156357, "src/Rosetta/model/3mf/Read.luau"], -[156945, "src/Rosetta/model/3mf/Write.luau"], -[157350, "src/Rosetta/model/ase/init.luau"], -[157473, "src/Rosetta/model/ase/Build.luau"], -[158047, "src/Rosetta/model/ase/Parse.luau"], -[158116, "src/Rosetta/model/ase/Write.luau"], -[158579, "src/Rosetta/model/b3d/init.luau"], -[158634, "src/Rosetta/model/b3d/Read.luau"], -[159205, "src/Rosetta/model/blend/init.luau"], -[159301, "src/Rosetta/model/blend/Anim.luau"], -[159647, "src/Rosetta/model/blend/Material.luau"], -[159999, "src/Rosetta/model/blend/Mesh.luau"], -[160634, "src/Rosetta/model/blend/Normals.luau"], -[160795, "src/Rosetta/model/blend/Prim.luau"], -[161244, "src/Rosetta/model/blend/Read.luau"], -[162144, "src/Rosetta/model/bsp/init.luau"], -[162335, "src/Rosetta/model/bsp/Lightmap.luau"], -[162401, "src/Rosetta/model/bsp/Quake.luau"], -[162790, "src/Rosetta/model/bsp/Quake3.luau"], -[163019, "src/Rosetta/model/bsp/Tree.luau"], -[163407, "src/Rosetta/model/buildmap/init.luau"], -[163679, "src/Rosetta/model/buildmap/Geometry.luau"], -[164082, "src/Rosetta/model/d3map/init.luau"], -[164364, "src/Rosetta/model/d3map/Parse.luau"], -[164562, "src/Rosetta/model/dae/init.luau"], -[164751, "src/Rosetta/model/dae/Math.luau"], -[164798, "src/Rosetta/model/dae/Read.luau"], -[166648, "src/Rosetta/model/dae/Write.luau"], -[167017, "src/Rosetta/model/fbx/init.luau"], -[167165, "src/Rosetta/model/fbx/Ascii.luau"], -[167435, "src/Rosetta/model/fbx/Binary.luau"], -[167890, "src/Rosetta/model/fbx/Read.luau"], -[169252, "src/Rosetta/model/fbx/Write.luau"], -[170237, "src/Rosetta/model/fbx/Xform.luau"], -[170278, "src/Rosetta/model/gltf/init.luau"], -[170515, "src/Rosetta/model/gltf/Pack.luau"], -[170584, "src/Rosetta/model/gltf/Read.luau"], -[171315, "src/Rosetta/model/gltf/Write.luau"], -[171995, "src/Rosetta/model/godot/init.luau"], -[172086, "src/Rosetta/model/godot/Build.luau"], -[172628, "src/Rosetta/model/godot/Primitives.luau"], -[172903, "src/Rosetta/model/godot/Surface.luau"], -[173388, "src/Rosetta/model/godot/Write.luau"], -[173717, "src/Rosetta/model/iqm/init.luau"], -[173793, "src/Rosetta/model/iqm/Read.luau"], -[174148, "src/Rosetta/model/iqm/Write.luau"], -[174835, "src/Rosetta/model/ldraw/init.luau"], -[174913, "src/Rosetta/model/ldraw/Colors.luau"], -[175231, "src/Rosetta/model/ldraw/Read.luau"], -[175808, "src/Rosetta/model/lwo/init.luau"], -[175884, "src/Rosetta/model/lwo/Build.luau"], -[176346, "src/Rosetta/model/lwo/Parse.luau"], -[176889, "src/Rosetta/model/map/init.luau"], -[177206, "src/Rosetta/model/map/Build.luau"], -[177450, "src/Rosetta/model/map/Parse.luau"], -[177835, "src/Rosetta/model/map/Write.luau"], -[177981, "src/Rosetta/model/mca/init.luau"], -[178323, "src/Rosetta/model/mca/Chunk.luau"], -[178456, "src/Rosetta/model/mca/Lz4Block.luau"], -[178526, "src/Rosetta/model/md2/init.luau"], -[178725, "src/Rosetta/model/md3/init.luau"], -[178953, "src/Rosetta/model/md5/init.luau"], -[179034, "src/Rosetta/model/md5/Read.luau"], -[179467, "src/Rosetta/model/mdl/init.luau"], -[179549, "src/Rosetta/model/mdl/HalfLife.luau"], -[179853, "src/Rosetta/model/mdl/Quake.luau"], -[180071, "src/Rosetta/model/ms3d/init.luau"], -[180143, "src/Rosetta/model/ms3d/Read.luau"], -[180589, "src/Rosetta/model/ms3d/Write.luau"], -[181058, "src/Rosetta/model/obj/init.luau"], -[181876, "src/Rosetta/model/obj/Mtl.luau"], -[182164, "src/Rosetta/model/off/init.luau"], -[182626, "src/Rosetta/model/ply/init.luau"], -[183731, "src/Rosetta/model/ply/Binary.luau"], -[183932, "src/Rosetta/model/pmx/init.luau"], -[184001, "src/Rosetta/model/pmx/Build.luau"], -[184297, "src/Rosetta/model/pmx/Pmd.luau"], -[184632, "src/Rosetta/model/pmx/Read.luau"], -[185036, "src/Rosetta/model/proc/init.luau"], -[185418, "src/Rosetta/model/qb/init.luau"], -[185811, "src/Rosetta/model/rbxm/init.luau"], -[186404, "src/Rosetta/model/rbxmx/init.luau"], -[187080, "src/Rosetta/model/robloxmesh/init.luau"], -[187739, "src/Rosetta/model/robloxmesh/Parse.luau"], -[188196, "src/Rosetta/model/robloxmesh/Write.luau"], -[188305, "src/Rosetta/model/schematic/init.luau"], -[188626, "src/Rosetta/model/schematic/Common.luau"], -[188746, "src/Rosetta/model/schematic/Litematic.luau"], -[188957, "src/Rosetta/model/schematic/Mcedit.luau"], -[189201, "src/Rosetta/model/schematic/Sponge.luau"], -[189330, "src/Rosetta/model/smd/init.luau"], -[189397, "src/Rosetta/model/smd/Read.luau"], -[189666, "src/Rosetta/model/smd/Write.luau"], -[189909, "src/Rosetta/model/sourcemdl/init.luau"], -[190080, "src/Rosetta/model/sourcemdl/Build.luau"], -[190510, "src/Rosetta/model/sourcemdl/Material.luau"], -[190671, "src/Rosetta/model/sourcemdl/Mdl.luau"], -[191198, "src/Rosetta/model/sourcemdl/Phy.luau"], -[191321, "src/Rosetta/model/sourcemdl/Vtx.luau"], -[191503, "src/Rosetta/model/sourcemdl/Vvd.luau"], -[191597, "src/Rosetta/model/stl/init.luau"], -[192047, "src/Rosetta/model/stl/Decode.luau"], -[192121, "src/Rosetta/model/t3d/init.luau"], -[192215, "src/Rosetta/model/t3d/Build.luau"], -[192620, "src/Rosetta/model/t3d/Parse.luau"], -[192788, "src/Rosetta/model/udmf/init.luau"], -[192871, "src/Rosetta/model/usda/init.luau"], -[193080, "src/Rosetta/model/usda/Build.luau"], -[194358, "src/Rosetta/model/usda/Parse.luau"], -[195156, "src/Rosetta/model/usda/Write.luau"], -[195973, "src/Rosetta/model/vbsp/init.luau"], -[196419, "src/Rosetta/model/vbsp/Faces.luau"], -[196643, "src/Rosetta/model/vbsp/Props.luau"], -[196735, "src/Rosetta/model/vmf/init.luau"], -[197060, "src/Rosetta/model/vmf/Build.luau"], -[197484, "src/Rosetta/model/vox/init.luau"], -[198370, "src/Rosetta/model/vox/Grid.luau"], -[198427, "src/Rosetta/model/vrml/init.luau"], -[198493, "src/Rosetta/model/x/init.luau"], -[198623, "src/Rosetta/model/x/Build.luau"], -[199186, "src/Rosetta/model/x/Parse.luau"], -[199483, "src/Rosetta/model/x3d/init.luau"], -[199561, "src/Rosetta/music/669/init.luau"], -[199768, "src/Rosetta/music/ahx/init.luau"], -[199820, "src/Rosetta/music/far/init.luau"], -[200050, "src/Rosetta/music/hmp/init.luau"], -[200315, "src/Rosetta/music/hvl/init.luau"], -[200367, "src/Rosetta/music/it/init.luau"], -[200786, "src/Rosetta/music/it/Itsex.luau"], -[200903, "src/Rosetta/music/med/init.luau"], -[201551, "src/Rosetta/music/midi/init.luau"], -[201695, "src/Rosetta/music/midi/Smf.luau"], -[202107, "src/Rosetta/music/mod/init.luau"], -[202461, "src/Rosetta/music/mtm/init.luau"], -[202684, "src/Rosetta/music/mus/init.luau"], -[202842, "src/Rosetta/music/okt/init.luau"], -[203124, "src/Rosetta/music/ptm/init.luau"], -[203347, "src/Rosetta/music/s3m/init.luau"], -[203584, "src/Rosetta/music/sf2/init.luau"], -[203628, "src/Rosetta/music/stm/init.luau"], -[203860, "src/Rosetta/music/ult/init.luau"], -[204165, "src/Rosetta/music/umx/init.luau"], -[204382, "src/Rosetta/music/xm/init.luau"], -[204944, "src/Rosetta/music/xmi/init.luau"], -[205153, "src/Rosetta/ops/AudioOps.luau"], -[205632, "src/Rosetta/ops/ImageOps/init.luau"], -[206280, "src/Rosetta/ops/ImageOps/Kernels.luau"], -[206920, "src/Rosetta/ops/LayerOps.luau"], -[207013, "src/Rosetta/ops/MeshOps/init.luau"], -[208065, "src/Rosetta/ops/MeshOps/Greedy.luau"], -[208232, "src/Rosetta/ops/MusicOps.luau"], -[208581, "src/Rosetta/playlist/m3u/init.luau"], -[208934, "src/Rosetta/playlist/pls/init.luau"], -[209112, "src/Rosetta/playlist/xspf/init.luau"], -[209315, "src/Rosetta/subtitle/ass/init.luau"], -[209759, "src/Rosetta/subtitle/srt/init.luau"], -[209932, "src/Rosetta/subtitle/vtt/init.luau"], -[210135, "src/Rosetta/vector/gamemaps/init.luau"], -[210322, "src/Rosetta/vector/gamemaps/Expand.luau"], -[210419, "src/Rosetta/vector/ldtk/init.luau"], -[210511, "src/Rosetta/vector/ldtk/Read.luau"], -[210847, "src/Rosetta/vector/ldtk/Write.luau"], -[211495, "src/Rosetta/vector/ogmo/init.luau"], -[211614, "src/Rosetta/vector/ogmo/Read.luau"], -[212019, "src/Rosetta/vector/ogmo/Write.luau"], -[212373, "src/Rosetta/vector/svg/init.luau"], -[212459, "src/Rosetta/vector/svg/Parse.luau"], -[213205, "src/Rosetta/vector/svg/PathData.luau"], -[213573, "src/Rosetta/vector/svg/Render.luau"], -[213990, "src/Rosetta/vector/svg/Style.luau"], -[214362, "src/Rosetta/vector/svg/Write.luau"], -[214562, "src/Rosetta/vector/tiled/init.luau"], -[214742, "src/Rosetta/vector/tiled/Data.luau"], -[214893, "src/Rosetta/vector/tiled/Tmj.luau"], -[215524, "src/Rosetta/vector/tiled/Tmx.luau"], -[216136, "src/Rosetta/video/avi/init.luau"], -[216430, "src/Rosetta/video/fli/init.luau"], -[216581, "src/Rosetta/video/flv/init.luau"], -[216965, "src/Rosetta/video/flv/Amf.luau"], -[217123, "src/Rosetta/video/flv/Mux.luau"], -[217404, "src/Rosetta/video/h264/init.luau"], -[217543, "src/Rosetta/video/mkv/init.luau"], -[217699, "src/Rosetta/video/mkv/Mux.luau"], -[217978, "src/Rosetta/video/mkv/Parse.luau"], -[218699, "src/Rosetta/video/mp4/init.luau"], -[219027, "src/Rosetta/video/mpegps/init.luau"], -[219214, "src/Rosetta/video/mpegts/init.luau"], -[219460, "src/Rosetta/video/ogv/init.luau"], -[219855, "src/Rosetta/video/smk/init.luau"], -[220164, "src/Rosetta/video/smk/Audio.luau"], -[220284, "src/Rosetta/video/y4m/init.luau"] +[1583, "src/Rosetta/Registry.luau"], +[4200, "src/Rosetta/Sniffs.luau"], +[7586, "src/Rosetta/Types.luau"], +[8699, "src/Rosetta/archive/7z/init.luau"], +[9084, "src/Rosetta/archive/7z/Header.luau"], +[9611, "src/Rosetta/archive/adf/init.luau"], +[9893, "src/Rosetta/archive/applesingle/init.luau"], +[10079, "src/Rosetta/archive/ar/init.luau"], +[10482, "src/Rosetta/archive/arj/init.luau"], +[10692, "src/Rosetta/archive/binhex/init.luau"], +[10941, "src/Rosetta/archive/br/init.luau"], +[11016, "src/Rosetta/archive/bz2/init.luau"], +[11080, "src/Rosetta/archive/cab/init.luau"], +[11493, "src/Rosetta/archive/cab/Sum.luau"], +[11534, "src/Rosetta/archive/cpio/init.luau"], +[11702, "src/Rosetta/archive/d64/init.luau"], +[12116, "src/Rosetta/archive/fat/init.luau"], +[12238, "src/Rosetta/archive/grp/init.luau"], +[12352, "src/Rosetta/archive/gzip/init.luau"], +[12537, "src/Rosetta/archive/iso/init.luau"], +[12609, "src/Rosetta/archive/lha/init.luau"], +[13034, "src/Rosetta/archive/lz4/init.luau"], +[13378, "src/Rosetta/archive/macbinary/init.luau"], +[13576, "src/Rosetta/archive/mpq/init.luau"], +[13982, "src/Rosetta/archive/mpq/Crypt.luau"], +[14047, "src/Rosetta/archive/pak/init.luau"], +[14181, "src/Rosetta/archive/rpm/init.luau"], +[14505, "src/Rosetta/archive/tar/init.luau"], +[14623, "src/Rosetta/archive/unitypackage/init.luau"], +[14859, "src/Rosetta/archive/uu/init.luau"], +[15129, "src/Rosetta/archive/vpk/init.luau"], +[15440, "src/Rosetta/archive/vswap/init.luau"], +[15710, "src/Rosetta/archive/wad/init.luau"], +[16164, "src/Rosetta/archive/wad/Picture.luau"], +[16266, "src/Rosetta/archive/wad2/init.luau"], +[16548, "src/Rosetta/archive/xz/init.luau"], +[16648, "src/Rosetta/archive/yenc/init.luau"], +[16920, "src/Rosetta/archive/z/init.luau"], +[17016, "src/Rosetta/archive/zip/init.luau"], +[17235, "src/Rosetta/archive/zoo/init.luau"], +[17431, "src/Rosetta/archive/zst/init.luau"], +[17495, "src/Rosetta/audio/aac/init.luau"], +[17708, "src/Rosetta/audio/ac3/init.luau"], +[17855, "src/Rosetta/audio/adpcm/init.luau"], +[18001, "src/Rosetta/audio/adx/init.luau"], +[18233, "src/Rosetta/audio/aiff/init.luau"], +[18625, "src/Rosetta/audio/ape/init.luau"], +[18754, "src/Rosetta/audio/au/init.luau"], +[18916, "src/Rosetta/audio/brstm/init.luau"], +[19208, "src/Rosetta/audio/caf/init.luau"], +[19875, "src/Rosetta/audio/flac/init.luau"], +[20024, "src/Rosetta/audio/flac/Meta.luau"], +[20246, "src/Rosetta/audio/flac/Stream.luau"], +[20616, "src/Rosetta/audio/m4a/init.luau"], +[20959, "src/Rosetta/audio/mp3/init.luau"], +[21220, "src/Rosetta/audio/mp3/Index.luau"], +[21411, "src/Rosetta/audio/mp3/Stream.luau"], +[21638, "src/Rosetta/audio/mp3/Tags.luau"], +[21950, "src/Rosetta/audio/mpc/init.luau"], +[22045, "src/Rosetta/audio/opus/init.luau"], +[22424, "src/Rosetta/audio/opus/Encode.luau"], +[22536, "src/Rosetta/audio/qoa/init.luau"], +[22717, "src/Rosetta/audio/tta/init.luau"], +[22836, "src/Rosetta/audio/vag/init.luau"], +[23060, "src/Rosetta/audio/voc/init.luau"], +[23336, "src/Rosetta/audio/vorbis/init.luau"], +[23791, "src/Rosetta/audio/vorbis/Encode.luau"], +[24604, "src/Rosetta/audio/wav/init.luau"], +[25225, "src/Rosetta/audio/wav/Codecs.luau"], +[25404, "src/Rosetta/audio/wavpack/init.luau"], +[25612, "src/Rosetta/cad/step/init.luau"], +[25994, "src/Rosetta/cad/step/Brep.luau"], +[26229, "src/Rosetta/cad/step/Parse.luau"], +[26786, "src/Rosetta/cad/step/Write.luau"], +[27034, "src/Rosetta/codecs/audio/Aac/init.luau"], +[27442, "src/Rosetta/codecs/audio/Aac/Decode.luau"], +[28418, "src/Rosetta/codecs/audio/Aac/Ps.luau"], +[29008, "src/Rosetta/codecs/audio/Aac/Sbr.luau"], +[30075, "src/Rosetta/codecs/audio/Aac/SbrBits.luau"], +[30194, "src/Rosetta/codecs/audio/Aac/SbrDct.luau"], +[31436, "src/Rosetta/codecs/audio/Aac/SbrHf.luau"], +[31928, "src/Rosetta/codecs/audio/Aac/SbrQmf.luau"], +[32045, "src/Rosetta/codecs/audio/Aac/SbrTables.luau"], +[32458, "src/Rosetta/codecs/audio/Aac/Tables.luau"], +[32794, "src/Rosetta/codecs/audio/Ac3/init.luau"], +[32954, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], +[33839, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], +[33941, "src/Rosetta/codecs/audio/Adpcm/init.luau"], +[34695, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], +[34998, "src/Rosetta/codecs/audio/Alac/init.luau"], +[35233, "src/Rosetta/codecs/audio/Alac/Decode.luau"], +[35652, "src/Rosetta/codecs/audio/Alac/Encode.luau"], +[36064, "src/Rosetta/codecs/audio/Ape/init.luau"], +[36280, "src/Rosetta/codecs/audio/Ape/Decode.luau"], +[37041, "src/Rosetta/codecs/audio/ApeTag.luau"], +[37139, "src/Rosetta/codecs/audio/Flac/init.luau"], +[37151, "src/Rosetta/codecs/audio/Flac/Encode.luau"], +[38100, "src/Rosetta/codecs/audio/Flac/Frame.luau"], +[38720, "src/Rosetta/codecs/audio/Hively/init.luau"], +[38917, "src/Rosetta/codecs/audio/Hively/Load.luau"], +[39167, "src/Rosetta/codecs/audio/Hively/Player.luau"], +[40126, "src/Rosetta/codecs/audio/Hively/Tables.luau"], +[40346, "src/Rosetta/codecs/audio/Mdct/init.luau"], +[40566, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], +[40820, "src/Rosetta/codecs/audio/MidiRender.luau"], +[41167, "src/Rosetta/codecs/audio/Mpa/init.luau"], +[41182, "src/Rosetta/codecs/audio/Mpa/Analysis.luau"], +[41241, "src/Rosetta/codecs/audio/Mpa/Core.luau"], +[42899, "src/Rosetta/codecs/audio/Mpa/EncTables.luau"], +[43192, "src/Rosetta/codecs/audio/Mpa/Encode2.luau"], +[43577, "src/Rosetta/codecs/audio/Mpa/Encode3.luau"], +[44218, "src/Rosetta/codecs/audio/Mpa/Header.luau"], +[44359, "src/Rosetta/codecs/audio/Mpa/Tables.luau"], +[44586, "src/Rosetta/codecs/audio/Musepack/init.luau"], +[44932, "src/Rosetta/codecs/audio/Musepack/Decode.luau"], +[45826, "src/Rosetta/codecs/audio/Musepack/Tables.luau"], +[46205, "src/Rosetta/codecs/audio/Opus/init.luau"], +[46220, "src/Rosetta/codecs/audio/Opus/Celt.luau"], +[48092, "src/Rosetta/codecs/audio/Opus/CeltEncoder.luau"], +[49157, "src/Rosetta/codecs/audio/Opus/CeltTables.luau"], +[49218, "src/Rosetta/codecs/audio/Opus/Decoder.luau"], +[49682, "src/Rosetta/codecs/audio/Opus/Mdct.luau"], +[50033, "src/Rosetta/codecs/audio/Opus/Packet.luau"], +[50266, "src/Rosetta/codecs/audio/Opus/Silk.luau"], +[52308, "src/Rosetta/codecs/audio/Opus/SilkTables.luau"], +[52682, "src/Rosetta/codecs/audio/Pcm/init.luau"], +[52946, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], +[53243, "src/Rosetta/codecs/audio/Qoa/init.luau"], +[53525, "src/Rosetta/codecs/audio/Resample/init.luau"], +[53920, "src/Rosetta/codecs/audio/SoundFont/init.luau"], +[53975, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], +[54119, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], +[54633, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"], +[55432, "src/Rosetta/codecs/audio/Stream.luau"], +[55594, "src/Rosetta/codecs/audio/Tracker/init.luau"], +[56077, "src/Rosetta/codecs/audio/Tracker/Load.luau"], +[56356, "src/Rosetta/codecs/audio/Tracker/Mixer.luau"], +[56603, "src/Rosetta/codecs/audio/Tracker/Pcm.luau"], +[56732, "src/Rosetta/codecs/audio/Tracker/Player.luau"], +[58721, "src/Rosetta/codecs/audio/Tracker/Tables.luau"], +[58838, "src/Rosetta/codecs/audio/Tta/init.luau"], +[58956, "src/Rosetta/codecs/audio/Tta/Decode.luau"], +[59208, "src/Rosetta/codecs/audio/Vorbis/init.luau"], +[59222, "src/Rosetta/codecs/audio/Vorbis/Codebook.luau"], +[59606, "src/Rosetta/codecs/audio/Vorbis/Packet.luau"], +[60179, "src/Rosetta/codecs/audio/Vorbis/Setup.luau"], +[60601, "src/Rosetta/codecs/audio/Vorbis/Tables.luau"], +[60641, "src/Rosetta/codecs/audio/VorbisComment.luau"], +[60694, "src/Rosetta/codecs/audio/WavPack/init.luau"], +[60917, "src/Rosetta/codecs/audio/WavPack/Block.luau"], +[62372, "src/Rosetta/codecs/audio/WavPack/Tables.luau"], +[62435, "src/Rosetta/codecs/compress/Brotli/init.luau"], +[62522, "src/Rosetta/codecs/compress/Brotli/Decode.luau"], +[63498, "src/Rosetta/codecs/compress/Brotli/Static.luau"], +[64366, "src/Rosetta/codecs/compress/Bzip2/init.luau"], +[64410, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], +[64923, "src/Rosetta/codecs/compress/Deflate/init.luau"], +[65249, "src/Rosetta/codecs/compress/Deflate/Compress.luau"], +[65731, "src/Rosetta/codecs/compress/Deflate/Inflate.luau"], +[66179, "src/Rosetta/codecs/compress/Explode.luau"], +[66375, "src/Rosetta/codecs/compress/Lz4.luau"], +[66644, "src/Rosetta/codecs/compress/Lzh/init.luau"], +[67248, "src/Rosetta/codecs/compress/Lzma/init.luau"], +[67788, "src/Rosetta/codecs/compress/Lzma/Crc64.luau"], +[67855, "src/Rosetta/codecs/compress/Lzma/Decode.luau"], +[68328, "src/Rosetta/codecs/compress/Lzma/Filters.luau"], +[68504, "src/Rosetta/codecs/compress/Lzw/init.luau"], +[68772, "src/Rosetta/codecs/compress/Lzx.luau"], +[69206, "src/Rosetta/codecs/compress/PackBits.luau"], +[69296, "src/Rosetta/codecs/compress/Quantum.luau"], +[69533, "src/Rosetta/codecs/compress/UnixCompress.luau"], +[69837, "src/Rosetta/codecs/compress/Xxh32.luau"], +[69906, "src/Rosetta/codecs/compress/Zstd/init.luau"], +[69963, "src/Rosetta/codecs/compress/Zstd/Decode.luau"], +[70947, "src/Rosetta/codecs/compress/Zstd/Xxh64.luau"], +[71099, "src/Rosetta/codecs/entropy/Huffman.luau"], +[71386, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], +[71397, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], +[71618, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.luau"], +[71862, "src/Rosetta/codecs/font/Bitmap.luau"], +[72063, "src/Rosetta/codecs/font/Cff/init.luau"], +[72704, "src/Rosetta/codecs/font/GlyphNames.luau"], +[72854, "src/Rosetta/codecs/font/TrueType/init.luau"], +[73168, "src/Rosetta/codecs/font/TrueType/Glyf.luau"], +[73560, "src/Rosetta/codecs/font/TrueType/Tables.luau"], +[74062, "src/Rosetta/codecs/image/Bcn/init.luau"], +[74169, "src/Rosetta/codecs/image/Bcn/Decode.luau"], +[74653, "src/Rosetta/codecs/image/Bcn/Encode.luau"], +[75082, "src/Rosetta/codecs/image/Blend.luau"], +[75461, "src/Rosetta/codecs/image/Dct/init.luau"], +[75961, "src/Rosetta/codecs/image/Etc.luau"], +[76259, "src/Rosetta/codecs/image/Half.luau"], +[76328, "src/Rosetta/codecs/image/Jpeg/init.luau"], +[76682, "src/Rosetta/codecs/image/Jpeg/Arith.luau"], +[77090, "src/Rosetta/codecs/image/Jpeg/Color.luau"], +[77455, "src/Rosetta/codecs/image/Jpeg/Decode.luau"], +[78220, "src/Rosetta/codecs/image/Jpeg/Encode.luau"], +[79101, "src/Rosetta/codecs/image/Jpeg/Scan.luau"], +[79570, "src/Rosetta/codecs/image/Jpeg/Tables.luau"], +[79648, "src/Rosetta/codecs/image/Jpeg/Yuv.luau"], +[79715, "src/Rosetta/codecs/image/Miptex.luau"], +[80015, "src/Rosetta/codecs/image/Pixels.luau"], +[80335, "src/Rosetta/codecs/image/Quantize/init.luau"], +[80796, "src/Rosetta/codecs/image/Raster.luau"], +[81493, "src/Rosetta/codecs/image/Texel.luau"], +[81866, "src/Rosetta/codecs/image/Texture.luau"], +[82011, "src/Rosetta/codecs/image/Vp8/init.luau"], +[82142, "src/Rosetta/codecs/image/Vp8/Decode.luau"], +[84098, "src/Rosetta/codecs/image/Vp8/Predict.luau"], +[84361, "src/Rosetta/codecs/image/Vp8/Tables.luau"], +[84611, "src/Rosetta/codecs/image/Vp8/Yuv.luau"], +[84753, "src/Rosetta/codecs/image/Vp8L/init.luau"], +[84857, "src/Rosetta/codecs/image/Vp8L/Decode.luau"], +[85797, "src/Rosetta/codecs/image/Vp8L/Encode.luau"], +[86749, "src/Rosetta/codecs/image/Yuv.luau"], +[87054, "src/Rosetta/codecs/model/Brush.luau"], +[87694, "src/Rosetta/codecs/model/Displacement.luau"], +[87843, "src/Rosetta/codecs/model/DoomMap/init.luau"], +[88288, "src/Rosetta/codecs/model/DoomMap/Udmf.luau"], +[88538, "src/Rosetta/codecs/model/Draco/init.luau"], +[88870, "src/Rosetta/codecs/model/Draco/Attributes.luau"], +[89339, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], +[90528, "src/Rosetta/codecs/model/Draco/Int64.luau"], +[90677, "src/Rosetta/codecs/model/Draco/KdTree.luau"], +[91036, "src/Rosetta/codecs/model/Draco/Predict.luau"], +[91998, "src/Rosetta/codecs/model/Draco/Reader.luau"], +[92472, "src/Rosetta/codecs/model/Mat4.luau"], +[92731, "src/Rosetta/codecs/model/MeshFlatten.luau"], +[93259, "src/Rosetta/codecs/model/Minecraft/init.luau"], +[93811, "src/Rosetta/codecs/model/Minecraft/Colors.luau"], +[93890, "src/Rosetta/codecs/model/Minecraft/Legacy.luau"], +[93997, "src/Rosetta/codecs/model/Minecraft/Packed.luau"], +[94203, "src/Rosetta/codecs/model/Patch.luau"], +[94327, "src/Rosetta/codecs/model/Polygon.luau"], +[94561, "src/Rosetta/codecs/model/Rbx/init.luau"], +[94798, "src/Rosetta/codecs/model/Rbx/Binary.luau"], +[95552, "src/Rosetta/codecs/model/Rig.luau"], +[95795, "src/Rosetta/codecs/model/Sampler.luau"], +[95955, "src/Rosetta/codecs/model/SourceAnim.luau"], +[96176, "src/Rosetta/codecs/model/Vrml/init.luau"], +[96324, "src/Rosetta/codecs/model/Vrml/Build.luau"], +[96898, "src/Rosetta/codecs/model/Vrml/Fields.luau"], +[97061, "src/Rosetta/codecs/model/Vrml/Geometry.luau"], +[97810, "src/Rosetta/codecs/model/Vrml/Parse.luau"], +[98332, "src/Rosetta/codecs/model/Vrml/Write.luau"], +[99059, "src/Rosetta/codecs/model/Vrml/Xml.luau"], +[99291, "src/Rosetta/codecs/text/GodotVariant.luau"], +[99950, "src/Rosetta/codecs/text/Json/init.luau"], +[100219, "src/Rosetta/codecs/text/Json/Decode.luau"], +[100654, "src/Rosetta/codecs/text/Json/Encode.luau"], +[100999, "src/Rosetta/codecs/text/KeyValues/init.luau"], +[101569, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], +[101875, "src/Rosetta/codecs/text/Lexer/init.luau"], +[102007, "src/Rosetta/codecs/text/Nbt/init.luau"], +[102360, "src/Rosetta/codecs/text/Nbt/Binary.luau"], +[103052, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], +[103692, "src/Rosetta/codecs/text/Nbt/Value.luau"], +[103930, "src/Rosetta/codecs/text/Text/init.luau"], +[104021, "src/Rosetta/codecs/text/Url/init.luau"], +[104226, "src/Rosetta/codecs/text/Xml/init.luau"], +[104676, "src/Rosetta/codecs/text/Xml/Parse.luau"], +[105480, "src/Rosetta/codecs/video/Dsp.luau"], +[106318, "src/Rosetta/codecs/video/H263/init.luau"], +[106475, "src/Rosetta/codecs/video/H263/Decoder.luau"], +[107333, "src/Rosetta/codecs/video/H263/Tables.luau"], +[107537, "src/Rosetta/codecs/video/H264/init.luau"], +[107911, "src/Rosetta/codecs/video/H264/Bitstream.luau"], +[108186, "src/Rosetta/codecs/video/H264/Cabac.luau"], +[109317, "src/Rosetta/codecs/video/H264/Cavlc.luau"], +[110085, "src/Rosetta/codecs/video/H264/Deblock.luau"], +[110347, "src/Rosetta/codecs/video/H264/Decoder.luau"], +[111357, "src/Rosetta/codecs/video/H264/Inter.luau"], +[111683, "src/Rosetta/codecs/video/H264/Intra.luau"], +[112090, "src/Rosetta/codecs/video/H264/Mb.luau"], +[113029, "src/Rosetta/codecs/video/H264/Params.luau"], +[113477, "src/Rosetta/codecs/video/H264/Slice.luau"], +[113729, "src/Rosetta/codecs/video/H264/Tables.luau"], +[113771, "src/Rosetta/codecs/video/H264/Transform.luau"], +[113936, "src/Rosetta/codecs/video/Legacy/init.luau"], +[114135, "src/Rosetta/codecs/video/Legacy/Cinepak.luau"], +[114432, "src/Rosetta/codecs/video/Legacy/Flic.luau"], +[114799, "src/Rosetta/codecs/video/Legacy/Msvideo1.luau"], +[114917, "src/Rosetta/codecs/video/Legacy/Picture.luau"], +[115025, "src/Rosetta/codecs/video/Legacy/QtRle.luau"], +[115298, "src/Rosetta/codecs/video/Legacy/Smacker.luau"], +[115693, "src/Rosetta/codecs/video/Legacy/Smc.luau"], +[115870, "src/Rosetta/codecs/video/Mpeg1/init.luau"], +[115883, "src/Rosetta/codecs/video/Mpeg2/init.luau"], +[116251, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], +[117778, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], +[117918, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"], +[118057, "src/Rosetta/codecs/video/Theora/init.luau"], +[118321, "src/Rosetta/codecs/video/Theora/Decoder.luau"], +[119585, "src/Rosetta/codecs/video/Theora/Header.luau"], +[119949, "src/Rosetta/codecs/video/Video/init.luau"], +[120507, "src/Rosetta/codecs/video/Video/Source.luau"], +[120793, "src/Rosetta/containers/Archive.luau"], +[121060, "src/Rosetta/containers/AudioWrap.luau"], +[121570, "src/Rosetta/containers/Avi/init.luau"], +[122123, "src/Rosetta/containers/Blend.luau"], +[122862, "src/Rosetta/containers/Chunks.luau"], +[122997, "src/Rosetta/containers/Cpio.luau"], +[123425, "src/Rosetta/containers/Demux.luau"], +[123700, "src/Rosetta/containers/Ebml/init.luau"], +[124014, "src/Rosetta/containers/Fat.luau"], +[124702, "src/Rosetta/containers/Iso9660.luau"], +[125207, "src/Rosetta/containers/IsoBmff/init.luau"], +[125378, "src/Rosetta/containers/IsoBmff/Box.luau"], +[125567, "src/Rosetta/containers/IsoBmff/Demux.luau"], +[126413, "src/Rosetta/containers/IsoBmff/Meta.luau"], +[126935, "src/Rosetta/containers/IsoBmff/Mux.luau"], +[127452, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], +[127570, "src/Rosetta/containers/MacFile.luau"], +[127719, "src/Rosetta/containers/MpegEs.luau"], +[127886, "src/Rosetta/containers/MpegPs/init.luau"], +[128107, "src/Rosetta/containers/MpegTs/init.luau"], +[128900, "src/Rosetta/containers/Ogg/init.luau"], +[129325, "src/Rosetta/containers/Ogg/Mux.luau"], +[129514, "src/Rosetta/containers/Ogg/Page.luau"], +[129680, "src/Rosetta/containers/Riff/init.luau"], +[129997, "src/Rosetta/containers/Tar.luau"], +[130411, "src/Rosetta/containers/Zip/init.luau"], +[131043, "src/Rosetta/core/Adler32.luau"], +[131103, "src/Rosetta/core/Base64.luau"], +[131331, "src/Rosetta/core/Bits.luau"], +[131624, "src/Rosetta/core/Bytes.luau"], +[132151, "src/Rosetta/core/Crc16.luau"], +[132203, "src/Rosetta/core/Crc32.luau"], +[132354, "src/Rosetta/core/Err.luau"], +[132436, "src/Rosetta/core/Input.luau"], +[132512, "src/Rosetta/core/Md5.luau"], +[132670, "src/Rosetta/core/Sniff.luau"], +[132699, "src/Rosetta/data/cbor/init.luau"], +[132798, "src/Rosetta/data/cbor/Codec.luau"], +[133367, "src/Rosetta/data/csv/init.luau"], +[133679, "src/Rosetta/data/ini/init.luau"], +[133925, "src/Rosetta/data/json/init.luau"], +[134017, "src/Rosetta/data/msgpack/init.luau"], +[134106, "src/Rosetta/data/msgpack/Codec.luau"], +[134548, "src/Rosetta/data/nbt/init.luau"], +[134607, "src/Rosetta/data/plist/init.luau"], +[134913, "src/Rosetta/data/plist/Binary.luau"], +[135180, "src/Rosetta/data/q3shader/init.luau"], +[135419, "src/Rosetta/data/q3skin/init.luau"], +[135515, "src/Rosetta/data/snbt/init.luau"], +[135578, "src/Rosetta/data/toml/init.luau"], +[135645, "src/Rosetta/data/toml/Decode.luau"], +[136273, "src/Rosetta/data/toml/Encode.luau"], +[136482, "src/Rosetta/data/tres/init.luau"], +[136627, "src/Rosetta/data/vdf/init.luau"], +[136728, "src/Rosetta/data/xml/init.luau"], +[136784, "src/Rosetta/data/yaml/init.luau"], +[136857, "src/Rosetta/data/yaml/Emit.luau"], +[137147, "src/Rosetta/data/yaml/Parse.luau"], +[138440, "src/Rosetta/font/bdf/init.luau"], +[138729, "src/Rosetta/font/bmfont/init.luau"], +[139156, "src/Rosetta/font/bmfont/Parse.luau"], +[139609, "src/Rosetta/font/eot/init.luau"], +[139841, "src/Rosetta/font/fon/init.luau"], +[140124, "src/Rosetta/font/hershey/init.luau"], +[140319, "src/Rosetta/font/pcf/init.luau"], +[140599, "src/Rosetta/font/psf/init.luau"], +[140919, "src/Rosetta/font/ttf/init.luau"], +[140970, "src/Rosetta/font/type1/init.luau"], +[141329, "src/Rosetta/font/type1/Charstring.luau"], +[141607, "src/Rosetta/font/woff/init.luau"], +[141739, "src/Rosetta/font/woff2/init.luau"], +[141796, "src/Rosetta/font/woff2/Rebuild.luau"], +[142336, "src/Rosetta/host/init.luau"], +[142381, "src/Rosetta/host/Love.luau"], +[142524, "src/Rosetta/host/LuaJIT.luau"], +[142574, "src/Rosetta/host/Luau.luau"], +[142597, "src/Rosetta/host/Roblox.luau"], +[142956, "src/Rosetta/image/ani/init.luau"], +[143136, "src/Rosetta/image/art/init.luau"], +[143624, "src/Rosetta/image/blp/init.luau"], +[143882, "src/Rosetta/image/bmp/init.luau"], +[144297, "src/Rosetta/image/dds/init.luau"], +[144780, "src/Rosetta/image/exr/init.luau"], +[145540, "src/Rosetta/image/exr/Codec.luau"], +[145651, "src/Rosetta/image/exr/Piz.luau"], +[146008, "src/Rosetta/image/gif/init.luau"], +[146524, "src/Rosetta/image/gif/Decode.luau"], +[146600, "src/Rosetta/image/hdr/init.luau"], +[146829, "src/Rosetta/image/hdr/Codec.luau"], +[147040, "src/Rosetta/image/icns/init.luau"], +[147371, "src/Rosetta/image/ico/init.luau"], +[147648, "src/Rosetta/image/ico/Dib.luau"], +[147743, "src/Rosetta/image/ilbm/init.luau"], +[148062, "src/Rosetta/image/jpeg/init.luau"], +[148198, "src/Rosetta/image/ktx/init.luau"], +[148858, "src/Rosetta/image/lmp/init.luau"], +[148991, "src/Rosetta/image/pcx/init.luau"], +[149255, "src/Rosetta/image/png/init.luau"], +[149835, "src/Rosetta/image/png/Apng.luau"], +[149915, "src/Rosetta/image/png/Decode.luau"], +[150288, "src/Rosetta/image/png/Encode.luau"], +[150491, "src/Rosetta/image/pnm/init.luau"], +[150869, "src/Rosetta/image/pnm/Codec.luau"], +[151146, "src/Rosetta/image/qoi/init.luau"], +[151268, "src/Rosetta/image/qoi/Codec.luau"], +[151425, "src/Rosetta/image/sgi/init.luau"], +[151710, "src/Rosetta/image/spr/init.luau"], +[152023, "src/Rosetta/image/sunras/init.luau"], +[152269, "src/Rosetta/image/tga/init.luau"], +[152539, "src/Rosetta/image/tga/Codec.luau"], +[152739, "src/Rosetta/image/tiff/init.luau"], +[153566, "src/Rosetta/image/tiff/Pixels.luau"], +[153956, "src/Rosetta/image/tim/init.luau"], +[154198, "src/Rosetta/image/vtf/init.luau"], +[154433, "src/Rosetta/image/webp/init.luau"], +[155043, "src/Rosetta/image/webp/Alpha.luau"], +[155119, "src/Rosetta/image/webp/Anim.luau"], +[155274, "src/Rosetta/image/xbm/init.luau"], +[155435, "src/Rosetta/image/xpm/init.luau"], +[155703, "src/Rosetta/image/xpm/Names.luau"], +[155759, "src/Rosetta/layered/aseprite/init.luau"], +[156497, "src/Rosetta/layered/ora/init.luau"], +[156784, "src/Rosetta/layered/psd/init.luau"], +[157519, "src/Rosetta/layered/psd/Channels.luau"], +[157871, "src/Rosetta/model/3ds/init.luau"], +[157954, "src/Rosetta/model/3ds/Build.luau"], +[158601, "src/Rosetta/model/3ds/Read.luau"], +[159097, "src/Rosetta/model/3ds/Write.luau"], +[159902, "src/Rosetta/model/3mf/init.luau"], +[159984, "src/Rosetta/model/3mf/Read.luau"], +[160572, "src/Rosetta/model/3mf/Write.luau"], +[160977, "src/Rosetta/model/ase/init.luau"], +[161100, "src/Rosetta/model/ase/Build.luau"], +[161674, "src/Rosetta/model/ase/Parse.luau"], +[161743, "src/Rosetta/model/ase/Write.luau"], +[162206, "src/Rosetta/model/b3d/init.luau"], +[162261, "src/Rosetta/model/b3d/Read.luau"], +[162832, "src/Rosetta/model/blend/init.luau"], +[162928, "src/Rosetta/model/blend/Anim.luau"], +[163274, "src/Rosetta/model/blend/Material.luau"], +[163626, "src/Rosetta/model/blend/Mesh.luau"], +[164261, "src/Rosetta/model/blend/Normals.luau"], +[164422, "src/Rosetta/model/blend/Prim.luau"], +[164871, "src/Rosetta/model/blend/Read.luau"], +[165771, "src/Rosetta/model/bsp/init.luau"], +[165962, "src/Rosetta/model/bsp/Lightmap.luau"], +[166028, "src/Rosetta/model/bsp/Quake.luau"], +[166417, "src/Rosetta/model/bsp/Quake3.luau"], +[166646, "src/Rosetta/model/bsp/Tree.luau"], +[167034, "src/Rosetta/model/buildmap/init.luau"], +[167306, "src/Rosetta/model/buildmap/Geometry.luau"], +[167709, "src/Rosetta/model/d3map/init.luau"], +[167991, "src/Rosetta/model/d3map/Parse.luau"], +[168189, "src/Rosetta/model/dae/init.luau"], +[168378, "src/Rosetta/model/dae/Math.luau"], +[168425, "src/Rosetta/model/dae/Read.luau"], +[170275, "src/Rosetta/model/dae/Write.luau"], +[170644, "src/Rosetta/model/fbx/init.luau"], +[170792, "src/Rosetta/model/fbx/Ascii.luau"], +[171062, "src/Rosetta/model/fbx/Binary.luau"], +[171517, "src/Rosetta/model/fbx/Read.luau"], +[172879, "src/Rosetta/model/fbx/Write.luau"], +[173864, "src/Rosetta/model/fbx/Xform.luau"], +[173905, "src/Rosetta/model/gltf/init.luau"], +[174142, "src/Rosetta/model/gltf/Pack.luau"], +[174211, "src/Rosetta/model/gltf/Read.luau"], +[174942, "src/Rosetta/model/gltf/Write.luau"], +[175622, "src/Rosetta/model/godot/init.luau"], +[175713, "src/Rosetta/model/godot/Build.luau"], +[176255, "src/Rosetta/model/godot/Primitives.luau"], +[176530, "src/Rosetta/model/godot/Surface.luau"], +[177015, "src/Rosetta/model/godot/Write.luau"], +[177344, "src/Rosetta/model/iqm/init.luau"], +[177420, "src/Rosetta/model/iqm/Read.luau"], +[177775, "src/Rosetta/model/iqm/Write.luau"], +[178462, "src/Rosetta/model/ldraw/init.luau"], +[178540, "src/Rosetta/model/ldraw/Colors.luau"], +[178858, "src/Rosetta/model/ldraw/Read.luau"], +[179435, "src/Rosetta/model/lwo/init.luau"], +[179511, "src/Rosetta/model/lwo/Build.luau"], +[179973, "src/Rosetta/model/lwo/Parse.luau"], +[180516, "src/Rosetta/model/map/init.luau"], +[180833, "src/Rosetta/model/map/Build.luau"], +[181077, "src/Rosetta/model/map/Parse.luau"], +[181462, "src/Rosetta/model/map/Write.luau"], +[181608, "src/Rosetta/model/mca/init.luau"], +[181950, "src/Rosetta/model/mca/Chunk.luau"], +[182083, "src/Rosetta/model/mca/Lz4Block.luau"], +[182153, "src/Rosetta/model/md2/init.luau"], +[182352, "src/Rosetta/model/md3/init.luau"], +[182580, "src/Rosetta/model/md5/init.luau"], +[182661, "src/Rosetta/model/md5/Read.luau"], +[183094, "src/Rosetta/model/mdl/init.luau"], +[183176, "src/Rosetta/model/mdl/HalfLife.luau"], +[183480, "src/Rosetta/model/mdl/Quake.luau"], +[183698, "src/Rosetta/model/ms3d/init.luau"], +[183770, "src/Rosetta/model/ms3d/Read.luau"], +[184216, "src/Rosetta/model/ms3d/Write.luau"], +[184685, "src/Rosetta/model/obj/init.luau"], +[185503, "src/Rosetta/model/obj/Mtl.luau"], +[185791, "src/Rosetta/model/off/init.luau"], +[186253, "src/Rosetta/model/ply/init.luau"], +[187358, "src/Rosetta/model/ply/Binary.luau"], +[187559, "src/Rosetta/model/pmx/init.luau"], +[187628, "src/Rosetta/model/pmx/Build.luau"], +[187924, "src/Rosetta/model/pmx/Pmd.luau"], +[188259, "src/Rosetta/model/pmx/Read.luau"], +[188663, "src/Rosetta/model/proc/init.luau"], +[189045, "src/Rosetta/model/qb/init.luau"], +[189438, "src/Rosetta/model/rbxm/init.luau"], +[190031, "src/Rosetta/model/rbxmx/init.luau"], +[190707, "src/Rosetta/model/robloxmesh/init.luau"], +[191366, "src/Rosetta/model/robloxmesh/Parse.luau"], +[191823, "src/Rosetta/model/robloxmesh/Write.luau"], +[191932, "src/Rosetta/model/schematic/init.luau"], +[192253, "src/Rosetta/model/schematic/Common.luau"], +[192373, "src/Rosetta/model/schematic/Litematic.luau"], +[192584, "src/Rosetta/model/schematic/Mcedit.luau"], +[192828, "src/Rosetta/model/schematic/Sponge.luau"], +[192957, "src/Rosetta/model/smd/init.luau"], +[193024, "src/Rosetta/model/smd/Read.luau"], +[193293, "src/Rosetta/model/smd/Write.luau"], +[193536, "src/Rosetta/model/sourcemdl/init.luau"], +[193707, "src/Rosetta/model/sourcemdl/Build.luau"], +[194137, "src/Rosetta/model/sourcemdl/Material.luau"], +[194298, "src/Rosetta/model/sourcemdl/Mdl.luau"], +[194825, "src/Rosetta/model/sourcemdl/Phy.luau"], +[194948, "src/Rosetta/model/sourcemdl/Vtx.luau"], +[195130, "src/Rosetta/model/sourcemdl/Vvd.luau"], +[195224, "src/Rosetta/model/stl/init.luau"], +[195674, "src/Rosetta/model/stl/Decode.luau"], +[195748, "src/Rosetta/model/t3d/init.luau"], +[195842, "src/Rosetta/model/t3d/Build.luau"], +[196247, "src/Rosetta/model/t3d/Parse.luau"], +[196415, "src/Rosetta/model/udmf/init.luau"], +[196498, "src/Rosetta/model/usda/init.luau"], +[196707, "src/Rosetta/model/usda/Build.luau"], +[197985, "src/Rosetta/model/usda/Parse.luau"], +[198783, "src/Rosetta/model/usda/Write.luau"], +[199600, "src/Rosetta/model/vbsp/init.luau"], +[200046, "src/Rosetta/model/vbsp/Faces.luau"], +[200270, "src/Rosetta/model/vbsp/Props.luau"], +[200362, "src/Rosetta/model/vmf/init.luau"], +[200687, "src/Rosetta/model/vmf/Build.luau"], +[201111, "src/Rosetta/model/vox/init.luau"], +[201997, "src/Rosetta/model/vox/Grid.luau"], +[202054, "src/Rosetta/model/vrml/init.luau"], +[202120, "src/Rosetta/model/x/init.luau"], +[202250, "src/Rosetta/model/x/Build.luau"], +[202813, "src/Rosetta/model/x/Parse.luau"], +[203110, "src/Rosetta/model/x3d/init.luau"], +[203188, "src/Rosetta/music/669/init.luau"], +[203395, "src/Rosetta/music/ahx/init.luau"], +[203447, "src/Rosetta/music/far/init.luau"], +[203677, "src/Rosetta/music/hmp/init.luau"], +[203942, "src/Rosetta/music/hvl/init.luau"], +[203994, "src/Rosetta/music/it/init.luau"], +[204413, "src/Rosetta/music/it/Itsex.luau"], +[204530, "src/Rosetta/music/med/init.luau"], +[205178, "src/Rosetta/music/midi/init.luau"], +[205322, "src/Rosetta/music/midi/Smf.luau"], +[205734, "src/Rosetta/music/mod/init.luau"], +[206088, "src/Rosetta/music/mtm/init.luau"], +[206311, "src/Rosetta/music/mus/init.luau"], +[206469, "src/Rosetta/music/okt/init.luau"], +[206751, "src/Rosetta/music/ptm/init.luau"], +[206974, "src/Rosetta/music/s3m/init.luau"], +[207211, "src/Rosetta/music/sf2/init.luau"], +[207255, "src/Rosetta/music/stm/init.luau"], +[207487, "src/Rosetta/music/ult/init.luau"], +[207792, "src/Rosetta/music/umx/init.luau"], +[208009, "src/Rosetta/music/xm/init.luau"], +[208571, "src/Rosetta/music/xmi/init.luau"], +[208780, "src/Rosetta/ops/AudioOps.luau"], +[209259, "src/Rosetta/ops/ImageOps/init.luau"], +[209907, "src/Rosetta/ops/ImageOps/Kernels.luau"], +[210547, "src/Rosetta/ops/LayerOps.luau"], +[210640, "src/Rosetta/ops/MeshOps/init.luau"], +[211692, "src/Rosetta/ops/MeshOps/Greedy.luau"], +[211859, "src/Rosetta/ops/MusicOps.luau"], +[212208, "src/Rosetta/playlist/m3u/init.luau"], +[212561, "src/Rosetta/playlist/pls/init.luau"], +[212739, "src/Rosetta/playlist/xspf/init.luau"], +[212942, "src/Rosetta/subtitle/ass/init.luau"], +[213386, "src/Rosetta/subtitle/srt/init.luau"], +[213559, "src/Rosetta/subtitle/vtt/init.luau"], +[213762, "src/Rosetta/vector/gamemaps/init.luau"], +[213949, "src/Rosetta/vector/gamemaps/Expand.luau"], +[214046, "src/Rosetta/vector/ldtk/init.luau"], +[214138, "src/Rosetta/vector/ldtk/Read.luau"], +[214474, "src/Rosetta/vector/ldtk/Write.luau"], +[215122, "src/Rosetta/vector/ogmo/init.luau"], +[215241, "src/Rosetta/vector/ogmo/Read.luau"], +[215646, "src/Rosetta/vector/ogmo/Write.luau"], +[216000, "src/Rosetta/vector/svg/init.luau"], +[216086, "src/Rosetta/vector/svg/Parse.luau"], +[216832, "src/Rosetta/vector/svg/PathData.luau"], +[217200, "src/Rosetta/vector/svg/Render.luau"], +[217617, "src/Rosetta/vector/svg/Style.luau"], +[217989, "src/Rosetta/vector/svg/Write.luau"], +[218189, "src/Rosetta/vector/tiled/init.luau"], +[218369, "src/Rosetta/vector/tiled/Data.luau"], +[218520, "src/Rosetta/vector/tiled/Tmj.luau"], +[219151, "src/Rosetta/vector/tiled/Tmx.luau"], +[219763, "src/Rosetta/video/avi/init.luau"], +[220057, "src/Rosetta/video/fli/init.luau"], +[220208, "src/Rosetta/video/flv/init.luau"], +[220592, "src/Rosetta/video/flv/Amf.luau"], +[220750, "src/Rosetta/video/flv/Mux.luau"], +[221031, "src/Rosetta/video/h264/init.luau"], +[221170, "src/Rosetta/video/mkv/init.luau"], +[221326, "src/Rosetta/video/mkv/Mux.luau"], +[221605, "src/Rosetta/video/mkv/Parse.luau"], +[222326, "src/Rosetta/video/mp4/init.luau"], +[222654, "src/Rosetta/video/mpegps/init.luau"], +[222841, "src/Rosetta/video/mpegts/init.luau"], +[223087, "src/Rosetta/video/ogv/init.luau"], +[223482, "src/Rosetta/video/smk/init.luau"], +[223791, "src/Rosetta/video/smk/Audio.luau"], +[223911, "src/Rosetta/video/y4m/init.luau"] ] diff --git a/docs/API.md b/docs/API.md index f6c8d08..d724f43 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/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/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/fixtures.py b/tools/fixtures.py index 08dce50..db102cf 100644 --- a/tools/fixtures.py +++ b/tools/fixtures.py @@ -8,6 +8,7 @@ # INPUTS = ["tests/fixtures/pngsuite", ...] # optional: files / dirs whose change triggers a rebuild # def generate(ctx): ... # ctx.emit("png_suite", value), ctx.nix("imagemagick", [...]), ... # A generator is skipped while all its outputs are newer than itself and its INPUTS (--force reruns it). +# LAST = True runs it after the others; it also reruns when any other generator's output changed (it reads them) # # ctx.emit(name, value): writes tests/gen/.luau returning value. Python values map to Luau: bytes -> string # literal (any bytes), str -> string literal, int / float / bool, list / tuple -> array, dict -> table (string keys @@ -123,12 +124,16 @@ def main(): if "--list" in sys.argv: print("\n".join(names)) return + mods = {name: load(os.path.join(GENERATORS, name + ".py")) for name in names} + names.sort(key=lambda n: bool(getattr(mods[n], "LAST", False))) for name in names: if args and not any(a in name for a in args): continue path = os.path.join(GENERATORS, name + ".py") - mod = load(path) + mod = mods[name] inputs = [path, os.path.abspath(__file__)] + [os.path.join(ROOT, p) for p in getattr(mod, "INPUTS", [])] + if getattr(mod, "LAST", False): + inputs += [os.path.join(stamps, n) for n in names if n != name and not getattr(mods[n], "LAST", False)] stamp = os.path.join(stamps, name) if not force and os.path.exists(stamp): outs = open(stamp).read().split("\n") diff --git a/tools/fixtures/detect.py b/tools/fixtures/detect.py new file mode 100644 index 0000000..a273701 --- /dev/null +++ b/tools/fixtures/detect.py @@ -0,0 +1,56 @@ +# Detection fixtures (tools/fixtures.py): samples of every other fixture module, for tests/detect.luau (lazy detection +# against the eager reference). Runs after the other generators (LAST) and reads their tests/gen output. +# tests/gen/detect_blobs_<1..4>.luau { { from = "", data = } }: up to PER_MODULE string literals of +# 16 bytes or more per module, evenly spaced, cut to CUT bytes, without repeats +import hashlib, os, re + +LAST = True +PER_MODULE = 6 +CUT = 16384 +PARTS = 4 +PART_BYTES = 5_000_000 +HEADER = "-- generated by tools/fixtures.py" +LITERAL = re.compile(rb'"([^"]*)"') +ESCAPE = re.compile(rb"\\x([0-9a-f]{2})") + + +def decode(raw): + return ESCAPE.sub(lambda m: bytes([int(m.group(1), 16)]), raw) + + +def generate(ctx): + names = sorted(f[:-5] for f in os.listdir(ctx.gen) if f.endswith(".luau") and not f.startswith("detect_")) + seen, blobs = set(), [] + for name in names: + with open(os.path.join(ctx.gen, name + ".luau"), "rb") as f: + text = f.read() + if not text.startswith(HEADER.encode()): + continue + lits = [m.span(1) for m in LITERAL.finditer(text) if m.end(1) - m.start(1) >= 16] + lits = [(a, b) for a, b in lits if len(decode(text[a:min(b, a + 64)])) >= 16] + if not lits: + continue + step = max(1, len(lits) / PER_MODULE) + picks = sorted({int(i * step) for i in range(PER_MODULE)} & set(range(len(lits)))) + for i in picks: + a, b = lits[i] + data = decode(text[a:min(b, a + CUT * 4)])[:CUT] + h = hashlib.sha1(data).digest() + if h in seen: + continue + seen.add(h) + blobs.append({"from": name, "data": data}) + parts, cur, size = [], [], 0 + for b in blobs: + if size + len(b["data"]) > PART_BYTES and cur: + parts.append(cur) + cur, size = [], 0 + cur.append(b) + size += len(b["data"]) + parts.append(cur) + if len(parts) > PARTS: + raise SystemExit("fixtures/detect: %d parts, raise PARTS (and the requires in tests/detect.luau)" % len(parts)) + while len(parts) < PARTS: + parts.append([]) + for i, p in enumerate(parts, 1): + ctx.emit("detect_blobs_%d" % i, p) diff --git a/tools/gen_registry.py b/tools/gen_registry.py index e7ec47e..6c1024b 100644 --- a/tools/gen_registry.py +++ b/tools/gen_registry.py @@ -3,6 +3,8 @@ # src/Rosetta///init.luau and writes # src/Rosetta/Registry.luau a static list (Roblox has no dynamic require): each format's contract metadata, copied # from its init.luau, and a load() that requires the module on first use +# src/Rosetta/Sniffs.luau each format's sniff, copied with what it reaches (tools/sniff_extract.py), so detection +# runs without requiring the format modules # docs/FORMATS.md the capability matrix, from each contract's caps # README.md the format table (read / write) and the codec + container list, between the markers # / and / @@ -11,6 +13,9 @@ # --check: exit 1 when any of them is out of date (tools/lint.sh runs this). import os, re, sys +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import sniff_extract + ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SRC = os.path.join(ROOT, "src", "Rosetta") CATEGORIES = ["image", "audio", "video", "model", "cad", "font", "archive", "data", "vector", "layered", "subtitle", @@ -50,6 +55,9 @@ def scan(): sys.exit("gen_registry: %s/%s/init.luau: missing contract fields %s" % (cat, fmt, ", ".join(missing))) c["path"] = cat + "/" + fmt c["folder_category"] = cat + text = open(init).read() + c["sniff_cost"], c["sniff_block"], self_name = sniff_extract.extract(text, c["path"]) + c["variant"] = sniff_extract.has_variant(text, self_name) formats.append(c) return formats @@ -60,6 +68,8 @@ def registry(formats): "-- 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 = {", "\tname: string,", "\tcategory: string,", @@ -68,6 +78,8 @@ def registry(formats): "\tmime: { string },", "\tdeps: { string },", "\tcaps: { [string]: any },", + "\tsniff: number,", + "\tvariant: boolean?,", "\tload: () -> any,", "}", "", @@ -83,6 +95,8 @@ def registry(formats): "\t\tmime = %s," % c["mime"], "\t\tdeps = %s," % c["deps"], "\t\tcaps = %s," % c["caps"], + "\t\tsniff = %d," % c["sniff_cost"], + ] + (["\t\tvariant = true,"] if c["variant"] else []) + [ "\t\tload = function()", '\t\t\treturn require("@rosetta/%s")' % c["path"], "\t\tend,", @@ -92,6 +106,38 @@ def registry(formats): return "\n".join(out) +def sniffs(formats): + out = [ + "--!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", + "\tlocal proxy = {}", + "\treturn setmetatable(proxy, {", + "\t\t__index = function(_, k: any): any", + "\t\t\tlocal m = load()", + "\t\t\tsetmetatable(proxy, { __index = m })", + "\t\t\treturn m[k]", + "\t\tend,", + "\t})", + "end", + "", + ] + for c in formats: + if c["sniff_block"] is None: + continue + out.append("do -- %s" % c["path"]) + out += c["sniff_block"] + out += ["end", ""] + out += ["return S", ""] + return "\n".join(out) + + def caps_dict(lit): """{ decode = true, depths = { 8 } } -> ordered [(key, text)] at the top level.""" body = lit.strip()[1:-1] @@ -220,6 +266,7 @@ def main(): readme_path = os.path.join(ROOT, "README.md") outputs = { os.path.join(SRC, "Registry.luau"): registry(formats), + os.path.join(SRC, "Sniffs.luau"): sniffs(formats), os.path.join(ROOT, "docs", "FORMATS.md"): formats_md(formats), readme_path: readme(formats, readme_path), } @@ -239,7 +286,7 @@ def main(): sys.exit(1) print("gen_registry: up to date (%d formats)" % len(formats)) else: - print("gen_registry: %d formats -> src/Rosetta/Registry.luau, docs/FORMATS.md, README.md%s" % ( + print("gen_registry: %d formats -> src/Rosetta/Registry.luau, Sniffs.luau, docs/FORMATS.md, README.md%s" % ( len(formats), "" if stale else " (unchanged)")) diff --git a/tools/lint_rules.py b/tools/lint_rules.py index 7027f61..fd998f5 100644 --- a/tools/lint_rules.py +++ b/tools/lint_rules.py @@ -9,7 +9,7 @@ # NATIVE native code never throws: a --!native module has no error( / assert( and requires no module that has # one; an @native function body has no error( / assert(. A format's init.luau is never --!native. # LAYERS requires go downward: core < Types < host; core, Types < codecs < containers < formats (/) -# < ops < api (init, Registry). core / codecs / containers / ops may require their own layer; a format +# < ops < api (init, Registry, Sniffs). core / codecs / containers / ops may require their own layer; a format # may require its own folder but never another format; only the api requires host. # codecs live in a domain folder: codecs// (CODEC_DOMAINS). # DEPS a format folder's requires outside itself are exactly the contract's deps = { ... }. @@ -19,7 +19,8 @@ # tests//.luau with a fuzz pass (:fuzz(). # DUP no copy-pasted code: a function body of DUP_LINES (12) or more code lines whose tokens (comments and # whitespace dropped, identifiers kept) equal another module's function body fails; move it down to a -# shared module (core / codecs / containers) and call it from both. +# shared module (core / codecs / containers) and call it from both. Sniffs.luau (generated copies of the +# formats' sniffs) is not compared. # DOCS docs/STYLE.md's layer block names every codec (codecs//), container and core module in the # tree; README.md's generated format table and codec list ( ... ) # match tools/gen_registry.py's output; README.md links every docs/guide page, docs/API.md and @@ -69,7 +70,7 @@ def resolve(target): def layer(mod): """(rank, group) of a module path""" top = mod.split("/")[0] if mod else "" - if mod in ("", "Registry"): + if mod in ("", "Registry", "Sniffs"): return 6, "api" if top == "core": return 0, "core" @@ -296,6 +297,8 @@ TOKEN = re.compile(r'"(?:[^"\\]|\\.)*"|\'(?:[^\'\\]|\\.)*\'|\[=*\[.*?\]=*\]|[A-Z FUNC = re.compile(r"^(\s*)(?:local\s+)?function\b") bodies = {} for f, lines in text.items(): + if mods[f] == "Sniffs": + continue for i, line in enumerate(lines): m = FUNC.match(line) if not m: diff --git a/tools/sniff_extract.py b/tools/sniff_extract.py new file mode 100644 index 0000000..414ff58 --- /dev/null +++ b/tools/sniff_extract.py @@ -0,0 +1,198 @@ +#!/usr/bin/env python3 +# Sniff extraction for tools/gen_registry.py: copies each format's sniff function out of its init.luau, with the +# top-level locals, types and statements it reaches, so src/Rosetta/Sniffs.luau can sniff without requiring the +# format module. A format whose sniff reaches its own module table (or a forward-declared local) is not copied: the api +# loads the module to sniff it. Requires the copy reaches: core/* as they are; any other module through a proxy that +# requires it on first field access (sniff time). +# cost 0: the copy needs only core/*; 1: it reaches a proxied module; 2: not copied (the module sniffs). +import re + +KEYWORDS = set("and break continue do else elseif end false for function if in local nil not or repeat return then " + "true until while type export typeof".split()) +NAME = r"[A-Za-z_]\w*" + + +def clean(text): + """text with string, comment and long-bracket contents blanked (newlines kept), same length""" + out, i, n = [], 0, len(text) + while i < n: + c = text[i] + if c == "-" and text.startswith("--", i): + m = re.match(r"--\[(=*)\[", text[i:]) + if m: + j = text.find("]" + m.group(1) + "]", i + len(m.group(0))) + j = n if j < 0 else j + len(m.group(1)) + 2 + else: + j = text.find("\n", i) + j = n if j < 0 else j + out.append(re.sub(r"[^\n]", " ", text[i:j])) + i = j + elif c == "[" and re.match(r"\[(=*)\[", text[i:]): + m = re.match(r"\[(=*)\[", text[i:]) + j = text.find("]" + m.group(1) + "]", i + len(m.group(0))) + j = n if j < 0 else j + len(m.group(1)) + 2 + out.append('"' + re.sub(r"[^\n]", " ", text[i + 1:j - 1]) + '"') + i = j + elif c in "\"'": + j = i + 1 + while j < n and text[j] != c and text[j] != "\n": + j += 2 if text[j] == "\\" else 1 + j = min(j + 1, n) + out.append(c + " " * (j - i - 2) + c if j - i >= 2 else text[i:j]) + i = j + else: + out.append(c) + i += 1 + return "".join(out) + + +def split_top(s): + """split s on commas outside brackets""" + parts, depth, cur = [], 0, "" + for ch in s: + if ch in "({[<": + depth += 1 + elif ch in ")}]>": + depth -= 1 + if ch == "," and depth == 0: + parts.append(cur) + cur = "" + else: + cur += ch + parts.append(cur) + return parts + + +def statements(text): + """[(first line, last line, cleaned text)] of the top-level statements (0-based inclusive line numbers)""" + lines = text.split("\n") + cl = clean(text).split("\n") + starts = [i for i, l in enumerate(cl) if l[:1] not in ("", " ", "\t") and not re.match(r"(end|until)\b|[}\])]", l)] + out = [] + for k, s in enumerate(starts): + e = (starts[k + 1] if k + 1 < len(starts) else len(lines)) - 1 + while e > s and cl[e].strip() == "": + e -= 1 + out.append((s, e, "\n".join(cl[s:e + 1]))) + return out + + +def free_names(code): + """identifiers read by code that are not field / method names (an over-approximation: locals are included)""" + return {m.group(1) for m in re.finditer(r"(?"): + cut = i + break + head = rest if cut is None else rest[:cut] + names = [p.split(":")[0].strip() for p in split_top(head.split("\n")[0] if cut is None else head)] + return [n for n in names if re.fullmatch(NAME, n)], ("forward" if cut is None else "local") + return [], None + + +REQUIRE = re.compile(r'^local\s+(' + NAME + r')\s*=\s*require\("@rosetta/([\w/]+)"\)\s*$') + + +def extract(text, path): + """(cost, block lines or None, module table name) for one format's init.luau""" + lines = text.split("\n") + sts = statements(text) + sniff_i, self_name = None, None + for i, (s, e, st) in enumerate(sts): + m = re.match(r"function\s+(" + NAME + r")\.sniff\s*\(", st) + if m: + sniff_i, self_name = i, m.group(1) + if sniff_i is None: + return 2, None, None + defs = [] # (statement index, name, kind) + for i, (s, e, st) in enumerate(sts): + names, kind = defines(st) + for n in names: + defs.append((i, n, kind)) + def_names = {n for _, n, _ in defs} + # top-level statements that are not declarations: assignments, loops (a table filled at load time) + others = [i for i, (s, e, st) in enumerate(sts) if defines(st)[1] is None and i != sniff_i] + + def resolve(name, before): + best = None + for i, n, kind in defs: + if n == name and i < before: + best = (i, kind) + return best + + include, lazy, todo, bad = set(), {}, [sniff_i], False + reached = set() + while todo: + i = todo.pop() + if i in include: + continue + include.add(i) + st = sts[i][2] + body = st + if i == sniff_i: + body = st[st.index("("):] + for n in free_names(body): + if n == self_name: + bad = True + continue + r = resolve(n, i) + if r is None: + continue + j, kind = r + if kind == "forward": + bad = True + continue + reached.add(n) + req = REQUIRE.match(lines[sts[j][0]]) if sts[j][0] == sts[j][1] else None + if req and not req.group(2).startswith("core/"): + lazy[j] = (req.group(1), req.group(2)) + continue + todo.append(j) + # load-time statements that touch a reached local (a lookup table filled by a loop) + for k in others: + if k not in include and re.match(r"(function\s+)?" + re.escape(self_name) + r"\b|return\b", sts[k][2]) is None: + if free_names(sts[k][2]) & reached: + todo.append(k) + if bad: + return 2, None, self_name + # a non-function statement that reads a proxied module runs at load time: the proxy would load it at once + for i in include: + if i != sniff_i and defines(sts[i][2])[1] not in ("func", "type"): + if free_names(sts[i][2]) & {a for a, _ in lazy.values()}: + return 2, None, self_name + block = [] + for i in sorted(set(include) | set(lazy)): + s, e, st = sts[i] + if i in lazy: + alias, mod = lazy[i] + block.append('local %s = lazy(function()\n\treturn require("@rosetta/%s")\nend)' % (alias, mod)) + elif i == sniff_i: + src = "\n".join(lines[s:e + 1]) + src = re.sub(r"^function\s+" + re.escape(self_name) + r"\.sniff\s*\(", 'S["%s"] = function(' % path, src) + block.append(src) + else: + src = "\n".join(lines[s:e + 1]) + block.append(re.sub(r"^export\s+type\b", "type", src)) + return (1 if lazy else 0), block, self_name + + +def has_variant(text, self_name): + return self_name is not None and re.search(r"^function\s+" + re.escape(self_name) + r"\.variant\s*\(", text, re.M) is not None