mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-15 07:41:21 +02:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7804ef9793 | |||
| 673d8b3ad8 | |||
| 62e1296ced | |||
| a3bbd78e7b | |||
| 8dfbd1daae |
@@ -12,20 +12,6 @@
|
|||||||
"tintColor": "3b5ca8",
|
"tintColor": "3b5ca8",
|
||||||
"category": "games",
|
"category": "games",
|
||||||
"versions": [
|
"versions": [
|
||||||
{
|
|
||||||
"version": "0.1.88",
|
|
||||||
"date": "2026-08-14",
|
|
||||||
"size": 11311237,
|
|
||||||
"downloadURL": "https://github.com/bryanthaboi/gen1recomp/releases/download/v0.1.88/gen1recomp++-0.1.88-ios.ipa",
|
|
||||||
"localizedDescription": "Download the correct version for your computer below.\n\n## Contributors\n\n- @bryanthaboi"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"version": "0.1.87",
|
|
||||||
"date": "2026-08-14",
|
|
||||||
"size": 11310910,
|
|
||||||
"downloadURL": "https://github.com/bryanthaboi/gen1recomp/releases/download/v0.1.87/gen1recomp++-0.1.87-ios.ipa",
|
|
||||||
"localizedDescription": "Download the correct version for your computer below.\n\n## Contributors\n\n- @AverageConsumer\n- @bryanthaboi\n- @mleo2003\n- @ShaneMcGovernIE\n- MaxTomahawk"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"version": "0.1.86",
|
"version": "0.1.86",
|
||||||
"date": "2026-08-14",
|
"date": "2026-08-14",
|
||||||
|
|||||||
+49
-2
@@ -832,9 +832,41 @@ local function tryMigrateLegacy(version, fs)
|
|||||||
return id
|
return id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Scan the filesystem for orphaned slot files under saves/<version>/ when options.lua
|
||||||
|
-- has no registered slots for this version (e.g. options.lua was reset or lost).
|
||||||
|
local function scanDiskSlots(version, fs)
|
||||||
|
if not fs then return nil end
|
||||||
|
local dir = "saves/" .. version
|
||||||
|
local slots = {}
|
||||||
|
if fs.getDirectoryItems and fs.getInfo and fs.getInfo(dir) then
|
||||||
|
local items = pcall(fs.getDirectoryItems, dir) and fs.getDirectoryItems(dir) or {}
|
||||||
|
local numbers = {}
|
||||||
|
for _, item in ipairs(items) do
|
||||||
|
local slotId = item:match("^(slot%d+)%.lua$")
|
||||||
|
if slotId then
|
||||||
|
local n = tonumber(slotId:match("%d+"))
|
||||||
|
table.insert(numbers, { id = slotId, num = n or 0 })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(numbers, function(a, b) return a.num < b.num end)
|
||||||
|
for _, item in ipairs(numbers) do
|
||||||
|
table.insert(slots, item.id)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for i = 1, 30 do
|
||||||
|
local slotId = "slot" .. i
|
||||||
|
local path = dir .. "/" .. slotId .. ".lua"
|
||||||
|
if fs.getInfo and fs.getInfo(path) then
|
||||||
|
table.insert(slots, slotId)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return #slots > 0 and slots or nil
|
||||||
|
end
|
||||||
|
|
||||||
-- Resolve (once per version per process) which slot in-game saves use: an
|
-- Resolve (once per version per process) which slot in-game saves use: an
|
||||||
-- existing registry wins; otherwise a lazy legacy migration may create
|
-- existing registry wins; otherwise a lazy legacy migration may create
|
||||||
-- slot1; otherwise false, meaning the flat legacy path.
|
-- slot1; otherwise auto-recover disk slots; otherwise false (flat legacy path).
|
||||||
local function ensureVersionSlots(version, fs)
|
local function ensureVersionSlots(version, fs)
|
||||||
if slotsChecked[version] then return end
|
if slotsChecked[version] then return end
|
||||||
slotsChecked[version] = true
|
slotsChecked[version] = true
|
||||||
@@ -848,7 +880,22 @@ local function ensureVersionSlots(version, fs)
|
|||||||
activeSlotCache[version] = reg.active or reg.list[1]
|
activeSlotCache[version] = reg.active or reg.list[1]
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
activeSlotCache[version] = tryMigrateLegacy(version, fs) or false
|
local migrated = tryMigrateLegacy(version, fs)
|
||||||
|
if migrated then
|
||||||
|
activeSlotCache[version] = migrated
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- Auto-recovery: if options.lua lost its slot registry, scan disk for orphaned slot files
|
||||||
|
local recovered = scanDiskSlots(version, fs)
|
||||||
|
if recovered and #recovered > 0 then
|
||||||
|
opts.saveSlots = opts.saveSlots or {}
|
||||||
|
opts.saveSlots[version] = { list = recovered, active = recovered[1] }
|
||||||
|
SaveData.saveOptions(opts, fs)
|
||||||
|
activeSlotCache[version] = recovered[1]
|
||||||
|
Logger.info("auto-recovered %d save slot(s) for %s from disk", #recovered, version)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
activeSlotCache[version] = false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- (body for the forward-declared saveNames.) Resolves the ACTIVE slot for
|
-- (body for the forward-declared saveNames.) Resolves the ACTIVE slot for
|
||||||
|
|||||||
@@ -539,12 +539,19 @@ function PartyMenu:update(dt)
|
|||||||
-- .strength, GBPalWhiteOutWithDelay3 blinks the screen white
|
-- .strength, GBPalWhiteOutWithDelay3 blinks the screen white
|
||||||
-- before CloseTextDisplay returns to the map.
|
-- before CloseTextDisplay returns to the map.
|
||||||
local ow = self.game.overworld
|
local ow = self.game.overworld
|
||||||
if ow and not ow:partyKnows("STRENGTH") then
|
if ow and ow.useStrengthFieldMove then
|
||||||
|
if not ow:partyKnows("STRENGTH") then
|
||||||
refuseBadge(self)
|
refuseBadge(self)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
ow:useStrengthFieldMove(mon, function() self:close() end)
|
ow:useStrengthFieldMove(mon, function() self:close() end)
|
||||||
return
|
return
|
||||||
|
elseif ow and ow.useFieldMove then
|
||||||
|
ow:useFieldMove("STRENGTH", mon)
|
||||||
|
self:close()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
return
|
||||||
elseif action == "softboiled" then
|
elseif action == "softboiled" then
|
||||||
-- field SOFTBOILED (StartMenu_Pokemon .softboiled): transfer
|
-- field SOFTBOILED (StartMenu_Pokemon .softboiled): transfer
|
||||||
-- 1/5 of the user's max HP to a chosen teammate
|
-- 1/5 of the user's max HP to a chosen teammate
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ end
|
|||||||
|
|
||||||
do
|
do
|
||||||
local body, ver = PatchNotes.body(nil)
|
local body, ver = PatchNotes.body(nil)
|
||||||
check(type(body) == "string" and body:find("Issues closed", 1, true),
|
check(type(body) == "string" and (body:find("Download", 1, true) or body:find("Issues", 1, true)),
|
||||||
"without a check result PatchNotes uses the stashed iOS app-repo notes")
|
"without a check result PatchNotes uses the stashed iOS app-repo notes")
|
||||||
check(type(ver) == "string" and ver:find("^%d+%.%d+%.%d+$") ~= nil,
|
check(type(ver) == "string" and ver:find("^%d+%.%d+%.%d+$") ~= nil,
|
||||||
"stashed notes name a release version")
|
"stashed notes name a release version")
|
||||||
|
|||||||
@@ -348,5 +348,30 @@ do
|
|||||||
"MapPreview attaches a draw for a Gold map")
|
"MapPreview attaches a draw for a Gold map")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
do
|
||||||
|
local memfs = {
|
||||||
|
files = {
|
||||||
|
["saves/gold/slot1.lua"] = 'return { version = "gold", generation = 2, player = { name = "GOLD" } }',
|
||||||
|
["options.lua"] = 'return { textSpeed = 3 }',
|
||||||
|
},
|
||||||
|
getInfo = function(self, path)
|
||||||
|
return self.files[path] and { type = "file" } or nil
|
||||||
|
end,
|
||||||
|
read = function(self, path)
|
||||||
|
return self.files[path]
|
||||||
|
end,
|
||||||
|
write = function(self, path, data)
|
||||||
|
self.files[path] = data
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
remove = function(self, path)
|
||||||
|
self.files[path] = nil
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
local main, _, _ = SaveData.saveFilename("gold")
|
||||||
|
check(main ~= nil, "saveFilename resolves for gold")
|
||||||
|
end
|
||||||
|
|
||||||
print(string.format("save editor gen2 tests: %d passed, %d failed", passed, failed))
|
print(string.format("save editor gen2 tests: %d passed, %d failed", passed, failed))
|
||||||
if failed > 0 then os.exit(1) end
|
if failed > 0 then os.exit(1) end
|
||||||
|
|||||||
Reference in New Issue
Block a user