mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-16 08:11:35 +02:00
CLOSES #604, CLOSES #666, CLOSES #716, CLOSES #727, CLOSES #763, CLOSES #781, CLOSES #784, CLOSES #799, CLOSES #801, CLOSES #810, CLOSES #828, CLOSES #834, CLOSES #838, CLOSES #849, CLOSES #852, CLOSES #857, CLOSES #863, CLOSES #864, CLOSES #867, CLOSES #869, CLOSES #870, CLOSES #872, CLOSES #839
This commit is contained in:
@@ -28,6 +28,24 @@ function SafeArea.rect()
|
||||
return 0, 0, ww, wh
|
||||
end
|
||||
|
||||
-- A safe rect that cannot fit the window's unit space is a backend
|
||||
-- reporting framebuffer PIXELS -- the iOS build (LOVE 12 + SDL3) did this
|
||||
-- in portrait on iOS 16, and clamping it as-is kept a DPI-inflated top
|
||||
-- inset that pushed the whole launcher a band down the screen (#810).
|
||||
-- Convert back to units with per-axis ratios; the axes can disagree on
|
||||
-- forced-rotation devices (see displayMetrics in src/render/Renderer.lua,
|
||||
-- #208).
|
||||
if (w > ww + 0.5 or h > wh + 0.5)
|
||||
and love.graphics.getPixelDimensions then
|
||||
local pw, ph = love.graphics.getPixelDimensions()
|
||||
local dx = (pw and pw > 0) and (pw / ww) or 1
|
||||
local dy = (ph and ph > 0) and (ph / wh) or 1
|
||||
if dx > 1.01 or dy > 1.01 then
|
||||
x, w = x / dx, w / dx
|
||||
y, h = y / dy, h / dy
|
||||
end
|
||||
end
|
||||
|
||||
-- Clamp to the drawable window so a bad / mid-rotation backend cannot
|
||||
-- push layout outside the surface.
|
||||
x = math.max(0, math.min(x, ww))
|
||||
|
||||
@@ -417,6 +417,18 @@ function SaveData.saveOptions(opts, fs)
|
||||
#encoded, type(wrote) == "string" and tostring(#wrote) or "nothing")
|
||||
return nil
|
||||
end
|
||||
-- #828: roll the backup FORWARD to the bytes just verified. The
|
||||
-- pre-write roll above only preserves the previous file for a death
|
||||
-- during this rewrite; at rest the backup must hold the newest verified
|
||||
-- state, because the hard teardown out of a game session (HostShell's
|
||||
-- restartApp kill on Android, execv on a SteamOS AppImage) can eat the
|
||||
-- main file outright and loadOptions then promotes this copy. The
|
||||
-- encoder is key-sorted, so the follow-up rewrites a play session makes
|
||||
-- (play()'s lastVersion stamp, the in-game save flush) are byte-identical
|
||||
-- and skip the conditional roll -- without this line the backup still
|
||||
-- held the file from BEFORE the launcher's change, and recovery reverted
|
||||
-- the just-changed setting (BATTLE LAYOUT back to OG).
|
||||
fs.write(OPTIONS_BACKUP_FILENAME, encoded)
|
||||
-- the staged witness has served its purpose; the main file is verified
|
||||
remove(fs, OPTIONS_TMP_FILENAME)
|
||||
return opts
|
||||
|
||||
Reference in New Issue
Block a user