Skip to content

Commit f4d3727

Browse files
NostrademousWires77
authored andcommitted
make CTRL+F5 do a full-re-export; otherwise just load (#50)
1 parent 37751c5 commit f4d3727

File tree

2 files changed

+45
-38
lines changed

2 files changed

+45
-38
lines changed

src/Export/Classes/GGPKData.lua

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ end
3131

3232
-- Path can be in any format recognized by the extractor at oozPath, ie,
3333
-- a .ggpk file or a Steam Path of Exile directory
34-
local GGPKClass = newClass("GGPKData", function(self, path, datPath)
34+
local GGPKClass = newClass("GGPKData", function(self, path, datPath, reExport)
3535
if datPath then
3636
self.oozPath = datPath:match("\\$") and datPath or (datPath .. "\\")
3737
else
3838
self.path = path
3939
self.oozPath = io.popen("cd"):read('*l'):gsub('\r?', '') .. "\\ggpk\\"
40-
self:CleanDir()
41-
self:ExtractFiles()
40+
self:CleanDir(reExport)
41+
self:ExtractFiles(reExport)
4242
end
4343

4444
self.dat = { }
@@ -51,10 +51,12 @@ local GGPKClass = newClass("GGPKData", function(self, path, datPath)
5151
end
5252
end)
5353

54-
function GGPKClass:CleanDir()
55-
local cmd = 'del ' .. self.oozPath .. 'Data ' .. self.oozPath .. 'Metadata /Q /S'
56-
ConPrintf(cmd)
57-
os.execute(cmd)
54+
function GGPKClass:CleanDir(reExport)
55+
if reExport then
56+
local cmd = 'del ' .. self.oozPath .. 'Data ' .. self.oozPath .. 'Metadata /Q /S'
57+
ConPrintf(cmd)
58+
os.execute(cmd)
59+
end
5860
end
5961

6062
function GGPKClass:ExtractFilesWithBun(fileListStr)
@@ -63,45 +65,47 @@ function GGPKClass:ExtractFilesWithBun(fileListStr)
6365
os.execute(cmd)
6466
end
6567

66-
function GGPKClass:ExtractFiles()
67-
local datList, txtList, itList = self:GetNeededFiles()
68-
local sweetSpotCharacter = 6000
69-
local fileList = ''
70-
for _, fname in ipairs(datList) do
71-
if USE_DAT64 then
72-
fileList = fileList .. '"' .. fname .. 'c64" '
73-
else
74-
fileList = fileList .. '"' .. fname .. '" '
75-
end
68+
function GGPKClass:ExtractFiles(reExport)
69+
if reExport then
70+
local datList, txtList, itList = self:GetNeededFiles()
71+
local sweetSpotCharacter = 6000
72+
local fileList = ''
73+
for _, fname in ipairs(datList) do
74+
if USE_DAT64 then
75+
fileList = fileList .. '"' .. fname .. 'c64" '
76+
else
77+
fileList = fileList .. '"' .. fname .. '" '
78+
end
7679

77-
if fileList:len() > sweetSpotCharacter then
78-
self:ExtractFilesWithBun(fileList)
79-
fileList = ''
80+
if fileList:len() > sweetSpotCharacter then
81+
self:ExtractFilesWithBun(fileList)
82+
fileList = ''
83+
end
8084
end
81-
end
8285

83-
for _, fname in ipairs(txtList) do
84-
fileList = fileList .. '"' .. fname .. '" '
86+
for _, fname in ipairs(txtList) do
87+
fileList = fileList .. '"' .. fname .. '" '
8588

86-
if fileList:len() > sweetSpotCharacter then
87-
self:ExtractFilesWithBun(fileList)
88-
fileList = ''
89+
if fileList:len() > sweetSpotCharacter then
90+
self:ExtractFilesWithBun(fileList)
91+
fileList = ''
92+
end
8993
end
90-
end
9194

92-
for _, fname in ipairs(itList) do
93-
fileList = fileList .. '"' .. fname .. '" '
95+
for _, fname in ipairs(itList) do
96+
fileList = fileList .. '"' .. fname .. '" '
97+
98+
if fileList:len() > sweetSpotCharacter then
99+
self:ExtractFilesWithBun(fileList)
100+
fileList = ''
101+
end
102+
end
94103

95-
if fileList:len() > sweetSpotCharacter then
104+
if (fileList:len() > 0) then
96105
self:ExtractFilesWithBun(fileList)
97-
fileList = ''
98106
end
99107
end
100108

101-
if (fileList:len() > 0) then
102-
self:ExtractFilesWithBun(fileList)
103-
end
104-
105109
-- Overwrite Enums
106110
local errMsg = PLoadModule("Scripts/enums.lua")
107111
if errMsg then

src/Export/Main.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ function main:Init()
7474
self.datFileByName = { }
7575

7676
self:LoadSettings()
77-
77+
self.reExportGGPKData = false
78+
if IsKeyDown("CTRL") then
79+
self.reExportGGPKData = true
80+
end
7881
self:InitGGPK()
7982
if self.datSource then
8083
if USE_DAT64 then
@@ -446,10 +449,10 @@ function main:InitGGPK()
446449
local now = GetTime()
447450
local ggpkPath = self.datSource.ggpkPath
448451
if ggpkPath and ggpkPath ~= "" then
449-
self.ggpk = new("GGPKData", ggpkPath)
452+
self.ggpk = new("GGPKData", ggpkPath, nil, self.reExportGGPKData)
450453
ConPrintf("GGPK: %d ms", GetTime() - now)
451454
elseif self.datSource.datFilePath then
452-
self.ggpk = new("GGPKData", nil, self.datSource.datFilePath)
455+
self.ggpk = new("GGPKData", nil, self.datSource.datFilePath, self.reExportGGPKData)
453456
ConPrintf("GGPK: %d ms", GetTime() - now)
454457
end
455458
end

0 commit comments

Comments
 (0)