-- 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", "sp_sounds", "speech2", "dlc_gtao_game", "dlc_gtao_mix", "dlc_gtao_sounds", "dlc_gtao_speech", "dlctu_game", "dlctu_sounds", "dlctu_curves" } 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 fileName = 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 fileName = value2_lower end end end end end if curr_file_path then add_to_pack(curr_file_path, "config/" .. fileName) 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, "config/" .. value2) end end end end -- Package up required files for audio release function package(packfile, path, platform) set_platform("durango") 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);