99 lines
2.8 KiB
Plaintext
Executable File
99 lines
2.8 KiB
Plaintext
Executable File
-- package a folder into an audio release file
|
|
-- Matt Hailey 10/04/13
|
|
|
|
config_folder = "\\config\\"
|
|
|
|
-- Files to include in audio release
|
|
dat_files = {
|
|
"audioconfig",
|
|
"categories",
|
|
"curves",
|
|
"dynamix",
|
|
"game",
|
|
"optamp",
|
|
"sounds",
|
|
"speech2",
|
|
}
|
|
|
|
other_files = {
|
|
"packlist_rel.txt",
|
|
}
|
|
|
|
startsWith = function(self, piece)
|
|
return string.sub(self, 1, string.len(piece)) == piece
|
|
end
|
|
|
|
-- Package files into output folder
|
|
function packageFolder(path)
|
|
|
|
local full_config_path = path .. config_folder
|
|
local files = find_files( full_config_path .. "*.*" );
|
|
|
|
-- Find DAT files
|
|
for key1, value1 in dat_files do
|
|
local latest_version = 0
|
|
local curr_file_path = nil
|
|
|
|
local value1_lower = string.lower(value1)
|
|
|
|
-- First look for .dat??.rel file
|
|
for key2, value2 in files do
|
|
local value2_lower = string.lower(value2)
|
|
local ext = get_extension_from_path(value2_lower)
|
|
|
|
if startsWith(value2_lower, value1_lower) then
|
|
local full_path = full_config_path .. value2
|
|
|
|
-- Use release version of file
|
|
if ext == '.rel' then
|
|
local str_len = string.len(value2_lower) - string.len(ext)
|
|
local dat_file_path = string.sub(value2_lower, 0, str_len)
|
|
local dat_ext = get_extension_from_path(dat_file_path)
|
|
|
|
if startsWith(dat_ext, ".dat") then
|
|
local versionStr = string.sub(dat_ext, 5)
|
|
local version = tonumber(versionStr)
|
|
if version > latest_version then
|
|
latest_version = version
|
|
curr_file_path = full_path
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
if curr_file_path then
|
|
add_to_pack(curr_file_path)
|
|
end
|
|
end
|
|
|
|
-- Add any other files we require
|
|
for key1, value1 in other_files do
|
|
for key2, value2 in files do
|
|
local file_name_lower = string.lower(value2)
|
|
if file_name_lower == value1 then
|
|
local full_path = full_config_path .. value2
|
|
add_to_pack(full_path)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Package up required files for audio release
|
|
function package(packfile, path, platform)
|
|
|
|
set_platform(platform)
|
|
start_uncompressed_pack();
|
|
packageFolder(path);
|
|
save_pack(packfile);
|
|
close_pack();
|
|
|
|
end
|
|
|
|
local pack = get_param("pack");
|
|
local rootpath = get_param("rootpath");
|
|
local platform = get_param("platform");
|
|
|
|
package(pack, rootpath, platform);
|
|
|