diff options
author | Pixel <pixel@nobis-crew.org> | 2012-10-25 21:15:03 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2012-10-25 21:15:03 -0700 |
commit | d17ccb1258c40fbd6767c4e2c98b6e2462cb8987 (patch) | |
tree | adabfd6be6ace2c86615e13c6d367ca8ffa83d90 /VP-miscwork.lua | |
parent | 911936a303001d2fb2f2e94c7228374656d1b88b (diff) |
More scripts types.
Diffstat (limited to 'VP-miscwork.lua')
-rw-r--r-- | VP-miscwork.lua | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/VP-miscwork.lua b/VP-miscwork.lua index 31f7e92..cb111f3 100644 --- a/VP-miscwork.lua +++ b/VP-miscwork.lua @@ -31,11 +31,54 @@ function process_arcgfx(fname, h, size, ext) index[i].size = h:readU32() end - local tell local outfile = {} + local script = nil + local font = nil for i = 1, nfiles do - tell = h:tell() - outfile[i] = process_single_file(fname .. string.format("/%04i-%08X", i, index[i].extra), h, index[i].size, ext) + local tell = h:tell() + local handler = nil + local counter = 1 + local f1 = andB(index[i].extra, 0xffffff00) + if dump_mode and f1 == 0x00300900 then + if script then error "Can't have two scripts" end + handler = function(fname, h, size, ext) + if counter == 1 then + log "taking script" + script = Buffer(true) + script:copyfrom(h) + else + error "Too many files" + end + counter = counter + 1 + end + elseif dump_mode and f1 == 0x00300800 then + if font then error "Can't have two fonts" end + handler = function(fname, h, size, ext) + if counter == 1 then + log "taking font" + font = Buffer(true) + font:copyfrom(h) + else + error "Too many files" + end + counter = counter + 1 + end + elseif not dump_mode and f1 == 0x00300900 then + error "Not written yet" + elseif not dump_mode and f1 == 0x00300800 then + error "Not written yet" + end + outfile[i] = process_single_file(fname .. string.format("/%04i-%08X", i, index[i].extra), h, index[i].size, ext, handler) + + if handler and script and font then + if dump_mode then + extract_simple_script(fname .. string.format("/%04i", i), script, font) + end + script:destroy() + font:destroy() + script = nil + font = nil + end h:seek(tell + index[i].size) end |