mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-15 15:51:17 +02:00
fix: allocate playthrough identity only on demand
This commit is contained in:
@@ -57,11 +57,18 @@ function Storage:_scope(game)
|
||||
local save = game and game.save
|
||||
local meta = save and save.meta
|
||||
local version = save and save.version
|
||||
local playthroughId = meta and meta.playthroughId
|
||||
if not (save and validSegment(version) and validSegment(playthroughId)) then
|
||||
if not (save and validSegment(version)) then
|
||||
return failure("not_in_playthrough",
|
||||
"Storage is available only inside an identified playthrough.")
|
||||
end
|
||||
local playthroughId = meta and meta.playthroughId
|
||||
if not validSegment(playthroughId) then
|
||||
playthroughId = SaveData.ensurePlaythroughId(save, self.injectedFs)
|
||||
end
|
||||
if not validSegment(playthroughId) then
|
||||
return failure("not_in_playthrough",
|
||||
"Storage could not identify the active playthrough.")
|
||||
end
|
||||
local fs = SaveData.persistenceFs(self.injectedFs)
|
||||
if not (fs and fs.read and fs.write and fs.getInfo) then
|
||||
return failure("storage_unavailable", "The persistence backend is unavailable.")
|
||||
|
||||
Reference in New Issue
Block a user