@@ -334,11 +334,13 @@ end
334334
335335function main :LoadDatSource (value )
336336 self .leagueLabel = nil
337+ local reExportState = self .reExportGGPKData
338+ self .reExportGGPKData = true
339+ self .datSource = value
337340 local out = io.open (self .datSource .spec .. (self .datSource .spec :match (" %.lua$" ) and " " or " .lua" ), " w" )
338341 out :write (' return ' )
339342 writeLuaTable (out , self .datSpecs , 1 )
340343 out :close ()
341- self .datSource = value
342344 self .datSpecs = LoadModule (self .datSource .spec )
343345 self :InitGGPK ()
344346 if USE_DAT64 then
@@ -349,6 +351,7 @@ function main:LoadDatSource(value)
349351 if self .datFileByName [" leaguenames" ] then
350352 self .leagueLabel = self .datFileByName [" leaguenames" ]:ReadValueText ({ type = " String" }, self .datFileByName [" leaguenames" ].rows [2 ] + 8 )
351353 end
354+ self .reExportGGPKData = reExportState
352355end
353356
354357function main :OpenPathPopup ()
@@ -520,7 +523,7 @@ function main:LoadSettings()
520523 end
521524 for _ , node in ipairs (setXML [1 ]) do
522525 if type (node ) == " table" then
523- if node .elem == " DatSource" then
526+ if node .elem == " DatSource" and ( node . attrib . ggpkPath or node . attrib . path ) and node . attrib . datFilePath then
524527 self .datSource = self .datSource or { }
525528 self .datSource .ggpkPath = node .attrib .ggpkPath or node .attrib .path
526529 self .datSource .datFilePath = node .attrib .datFilePath
@@ -530,18 +533,19 @@ function main:LoadSettings()
530533 if node .elem == " DatSources" then
531534 self .datSources = self .datSources or { }
532535 for _ , child in ipairs (node ) do
533- t_insert (self .datSources , { ggpkPath = child .attrib .ggpkPath , datFilePath = child .attrib .datFilePath , label = child .attrib .label , spec = child .attrib .spec })
536+ if (child .attrib .ggpkPath or child .attrib .path ) and child .attrib .datFilePath then
537+ t_insert (self .datSources , { ggpkPath = child .attrib .ggpkPath , datFilePath = child .attrib .datFilePath , label = child .attrib .label , spec = child .attrib .spec })
538+ end
534539 end
535540 end
536541 end
537542 end
538- if type (self .datSources ) ~= " table" then
539- self .datSources = { }
540- end
541- if not next (self .datSources ) then
543+ if self .datSources and not next (self .datSources ) and self .datSource then
542544 t_insert (self .datSources , self .datSource )
543545 end
544- self .datSource = self .datSource or self .datSources [1 ]
546+ if not self .datSoruce and self .datSources then
547+ self .datSource = self .datSources [1 ]
548+ end
545549end
546550
547551function main :SaveSettings ()
0 commit comments