|
1 | 1 | diff a/src/Export/Classes/GGPKData.lua b/src/Export/Classes/GGPKData.lua (rejected hunks) |
2 | | -@@ -67,48 +63,44 @@ function GGPKClass:ExtractFilesWithBun(fileListStr, useRegex) |
3 | | - os.execute(cmd) |
| 2 | +@@ -126,14 +126,13 @@ function GGPKClass:ExtractList(listToExtract, cache, useRegex) |
4 | 3 | end |
5 | 4 |
|
6 | | -+-- Use manifest files to avoid command line limit and reduce cmd calls |
7 | | -+function GGPKClass:ExtractFilesWithBunFromTable(fileTable, useRegex) |
8 | | -+ local useRegex = useRegex or false |
9 | | -+ local manifest = self.oozPath .. "extract_list.txt" |
10 | | -+ local f = assert(io.open(manifest, "w")) |
11 | | -+ for _, fname in ipairs(fileTable) do |
12 | | -+ f:write(string.lower(fname), "\n") |
13 | | -+ end |
14 | | -+ f:close() |
15 | | -+ local cmd = 'cd "' .. self.oozPath .. '" && bun_extract_file.exe extract-files ' .. (useRegex and '--regex "' or '"') .. self.path .. '" . < "' .. manifest .. '"' |
16 | | -+ ConPrintf(cmd) |
17 | | -+ os.execute(cmd) |
18 | | -+ os.remove(manifest) |
19 | | -+end |
20 | | -+ |
21 | | - function GGPKClass:ExtractFiles(reExport) |
22 | | - if reExport then |
23 | | - local datList, csdList, otList, itList = self:GetNeededFiles() |
24 | | -- local sweetSpotCharacter = 6000 |
25 | | -- local fileList = '' |
26 | | -- |
27 | | -+ local datFiles = {} |
28 | | - for _, fname in ipairs(datList) do |
29 | | -- if USE_DAT64 then |
30 | | -- fileList = fileList .. '"' .. fname .. 'c64" ' |
31 | | -- else |
32 | | -- fileList = fileList .. '"' .. fname .. '" ' |
33 | | -- end |
34 | | -- |
35 | | -- if fileList:len() > sweetSpotCharacter then |
36 | | -- self:ExtractFilesWithBun(fileList) |
37 | | -- fileList = '' |
38 | | -- end |
39 | | -- end |
40 | | -- |
41 | | -- for _, fname in ipairs(otList) do |
42 | | -- self:ExtractFilesWithBun('"' .. fname .. '"', true) |
43 | | -+ datFiles[#datFiles + 1] = fname .. "c64" |
44 | | - end |
45 | | - |
46 | | -- for _, fname in ipairs(itList) do |
47 | | -- fileList = fileList .. '"' .. fname .. '" ' |
48 | | -- |
49 | | -- if fileList:len() > sweetSpotCharacter then |
50 | | -- self:ExtractFilesWithBun(fileList) |
51 | | -- fileList = '' |
52 | | -- end |
53 | | -+ -- non-regex chunk: dat files + itList |
54 | | -+ for i = 1, #itList do |
55 | | -+ datFiles[#datFiles + 1] = itList[i] |
56 | | - end |
57 | | -+ self:ExtractFilesWithBunFromTable(datFiles, false) |
58 | | - |
59 | | -- if (fileList:len() > 0) then |
60 | | -- self:ExtractFilesWithBun(fileList) |
61 | | -- fileList = '' |
62 | | -+ -- regex chunk: otList + csdList (stat descriptions) |
63 | | -+ local regexFiles = {} |
64 | | -+ for i = 1, #otList do |
65 | | -+ regexFiles[#regexFiles + 1] = otList[i] |
66 | | - end |
67 | | -- |
68 | | -- -- Special handling for stat descriptions (CSD) as they |
69 | | -- -- are regex based |
70 | | -- for _, fname in ipairs(csdList) do |
71 | | -- self:ExtractFilesWithBun('"' .. fname .. '"', true) |
72 | | -+ for i = 1, #csdList do |
73 | | -+ regexFiles[#regexFiles + 1] = csdList[i] |
74 | | - end |
75 | | -+ self:ExtractFilesWithBunFromTable(regexFiles, true) |
76 | | - end |
77 | | - |
78 | | - -- Overwrite Enums |
79 | | -@@ -120,39 +112,17 @@ end |
80 | | - |
81 | | - function GGPKClass:ExtractList(listToExtract, cache, useRegex) |
82 | | - useRegex = useRegex or false |
83 | | -- local sweetSpotCharacter = 6000 |
84 | | - printf("Extracting ...") |
85 | | -- local fileList = '' |
86 | | -+ local fileTable = {} |
87 | | - for _, fname in ipairs(listToExtract) do |
88 | | - -- we are going to validate if the file is already extracted in this session |
89 | | - if not cache[fname] then |
90 | | - cache[fname] = true |
91 | | -- fileList = fileList .. '"' .. string.lower(fname) .. '" ' |
92 | | -- |
93 | | -- if fileList:len() > sweetSpotCharacter then |
94 | | -- self:ExtractFilesWithBun(fileList, useRegex) |
95 | | -- fileList = '' |
96 | | -- end |
97 | | -+ fileTable[#fileTable + 1] = fname |
98 | | - end |
99 | | - end |
100 | | - |
101 | | -- if fileList:len() > 0 then |
102 | | -- self:ExtractFilesWithBun(fileList, useRegex) |
103 | | -- fileList = '' |
104 | | -- end |
105 | | --end |
106 | | -- |
107 | | --function GGPKClass:AddDatFiles() |
108 | | -- local datFiles = scanDir(self.oozPath .. "Data\\Balance\\", '%w+%.dat$') |
| 5 | + function GGPKClass:AddDat64Files() |
| 6 | +- local datFiles = scanDir(self.oozPath .. "Data\\Balance\\", '%w+%.datc64$') |
109 | 7 | - for _, f in ipairs(datFiles) do |
110 | | -- local record = { } |
| 8 | ++ local datFiles = self:GetNeededFiles() |
| 9 | ++ for _, fname in ipairs(datFiles) do |
| 10 | + local record = { } |
111 | 11 | - record.name = f |
112 | 12 | - local rawFile = io.open(self.oozPath .. "Data\\Balance\\" .. f, 'rb') |
113 | | -- record.data = rawFile:read("*all") |
114 | | -- rawFile:close() |
| 13 | ++ record.name = fname:match("([^/\\]+)$") .. "c64" |
| 14 | ++ local rawFile = io.open(self.oozPath .. fname:gsub("/", "\\") .. "c64", 'rb') |
| 15 | + record.data = rawFile:read("*all") |
| 16 | + rawFile:close() |
115 | 17 | - --ConPrintf("FILENAME: %s", fname) |
116 | | -- t_insert(self.dat, record) |
117 | | -- end |
118 | | -+ self:ExtractFilesWithBunFromTable(fileTable, useRegex) |
| 18 | + t_insert(self.dat, record) |
| 19 | + end |
119 | 20 | end |
120 | | - |
121 | | - function GGPKClass:AddDat64Files() |
| 21 | +@@ -163,6 +162,8 @@ function GGPKClass:GetNeededFiles() |
| 22 | + "Data/Balance/ModFamily.dat", |
| 23 | + "Data/Balance/ModSellPriceTypes.dat", |
| 24 | + "Data/Balance/ModEffectStats.dat", |
| 25 | ++ "Data/Balance/ModDomains.dat", |
| 26 | ++ "Data/Balance/ModGenerationTypes.dat", |
| 27 | + "Data/Balance/ActiveSkills.dat", |
| 28 | + "Data/Balance/ActiveSkillType.dat", |
| 29 | + "Data/Balance/AlternateSkillTargetingBehaviours.dat", |
0 commit comments