diff options
author | Pixel <pixel@nobis-crew.org> | 2012-10-26 09:06:13 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2012-10-26 09:06:13 -0700 |
commit | 6f37a8a7c34fbbfa62df139bfc904288e319d140 (patch) | |
tree | 2c2c0651e501ae0032210dcd2c8917539efe4cd9 | |
parent | d17ccb1258c40fbd6767c4e2c98b6e2462cb8987 (diff) |
And still more script types.
-rw-r--r-- | VP-map.lua | 3 | ||||
-rw-r--r-- | VP-miscwork.lua | 30 | ||||
-rw-r--r-- | VP-process.lua | 12 |
3 files changed, 38 insertions, 7 deletions
@@ -4,6 +4,7 @@ VP_maintypes = { "GFX", "MAIN", "GAME", + "MISC", } VP_map = { } @@ -93,6 +94,8 @@ VP_map = { [2173] = { dir = "MISC/GFX", ext = "agx", ftype = "arcgfx", }, + [2294] = { dir = "MISC/SCRIPT", ext = "script", ftype = "cscript", }, + -- -- Videos -- diff --git a/VP-miscwork.lua b/VP-miscwork.lua index cb111f3..1818b30 100644 --- a/VP-miscwork.lua +++ b/VP-miscwork.lua @@ -100,3 +100,33 @@ function process_arcgfx(fname, h, size, ext) -- return ret end +function process_cscript(fname, h, size, ext) + log("Processing " .. fname .. ".slz") + log("Extracting " .. fname .. " - format 'cscript'") + local counter = 1 + local script + local font + local handler = function(fname, h, size, ext) + if counter == 1 then + log "taking script" + script = Buffer(true) + script:copyfrom(h) + elseif counter == 2 then + log "taking font" + font = Buffer(true) + font:copyfrom(h) + else + error "Too many files" + end + counter = counter + 1 + end + + process_single_file(fname, h, h:getsize(), ext, handler) + + if not script or not font then error "Not enough files" end + if dump_mode then + extract_simple_script(fname, script, font) + end + script:destroy() + font:destroy() +end diff --git a/VP-process.lua b/VP-process.lua index c85cfc5..2861d4e 100644 --- a/VP-process.lua +++ b/VP-process.lua @@ -239,14 +239,12 @@ function process_files(index, map, iso, iso_full, cindex, index_add, jp_in_us) log("JP-in-US: replacing file " .. i .. " by file " .. lookup) file_out = index_add[lookup].cd:cdfile(index_add[lookup].sector, index_add[lookup].size * sec_sizes[mode]) end - elseif not ftype then - file_out = process_single_file("DUMP/" .. dir .. string.format("/%04i", i), file_in, file_in:getsize(), ext) - elseif ftype == "arcgfx" then - file_out = process_arcgfx("DUMP/" .. dir .. string.format("/%04i", i), file_in, file_in:getsize(), ext) - elseif ftype == "arcroom" then - file_out = process_arcroom("DUMP/" .. dir .. string.format("/%04i", i), file_in, file_in:getsize(), ext) + elseif ftype then + local handler = _G["process_" .. ftype] + if not handler then error("Unknown ftype: " .. ftype) end + file_out = handler("DUMP/" .. dir .. string.format("/%04i", i), file_in, file_in:getsize(), ext) else - error("Unknow ftype: " .. ftype) + file_out = process_single_file("DUMP/" .. dir .. string.format("/%04i", i), file_in, file_in:getsize(), ext) end if not file_out then file_out = file_in end file_in:seek(0) |