Files
2025-09-29 00:52:08 +02:00

68 lines
1.6 KiB
Plaintext
Executable File

--
-- File:: extractimage.rbs
-- Description:: Extract an IMG or RPF file.
--
-- Author:: David Muir <david.muir@rockstarnorth.com>
-- Date:: 14 August 2009
--
source = get_param("input")
outputFolder = get_param("output")
outputExt = string.lower(get_extension_from_path(source))
-----------------------------------------------------------------------------
-- Functions
-----------------------------------------------------------------------------
function extract_recursive( path, outputDir )
local files = find_files( path .. "\\" .. "*.*" )
for key, value in files do
local input = path .. "\\" .. value
local output = outputDir .. "\\" .. value
print( input .. " ==> " .. output )
create_leadingpath( output )
copy_file( input, output )
end
local dirs = find_dirs( path )
for key, value in dirs do
local dir = path .. "\\" .. value
local output = outputDir .. "\\" .. value
create_leadingpath( output )
extract_recursive( dir, output )
end
end
-----------------------------------------------------------------------------
-- Entry-Point
-----------------------------------------------------------------------------
if outputExt == ".rpf" then
mount_pack(source, "image:/")
extract_recursive( "image:/", outputFolder )
unmount_pack(source)
else
mount_image(source, "image:\\")
local files = find_files("image:\\" .. "*.*")
for key, value in files do
copy_file("image:\\" .. value,outputFolder .. value)
end
unmount_image(source)
end
-- extractimage.rbs