From 6f37a8a7c34fbbfa62df139bfc904288e319d140 Mon Sep 17 00:00:00 2001 From: Pixel Date: Fri, 26 Oct 2012 09:06:13 -0700 Subject: And still more script types. --- VP-map.lua | 3 +++ VP-miscwork.lua | 30 ++++++++++++++++++++++++++++++ VP-process.lua | 12 +++++------- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/VP-map.lua b/VP-map.lua index f18249a..795e2e7 100644 --- a/VP-map.lua +++ b/VP-map.lua @@ -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) -- cgit v1.2.3