Performance pass: cut per-frame allocations and draw calls, fix frame-rate and batch bugs

- Shared render: cache Font encode/width, skip unchanged palette/ShaderFX
  uniform sends, reuse quads and scratch tables, cheaper sprite palettes
- Mods: fast path for loaded requires, memoized sandbox verdicts, fewer
  Hooks:call allocations, drop emptied hook chains
- Audio: bulk PCM writes, cry/SFX prewarm on the worker, sliced sync
  fallback, cached Gen 3 SE sources
- Gen 1: per-frame SGB battle palettes, hoisted overworld FX, cached menus
- Gen 2: numeric attr grid, indexed anim cells, entity culling, memoized
  cache keys, palette shader set once per tile run
- Gen 3: reuse native tile batches, per-cell metatile rebuilds, partial
  FRLG tile anim uploads, near-view ghost ticking, packed FRLG font atlas
- Fixes: emergency quit timer, Gen 3 batch regression and stale sprite
  index, trainer card texture leak, missing pic re-reads, anim tint cache,
  Crystal ghost grass overdraw, refresh-rate dependent counters, pad swap
This commit is contained in:
Shane McGovern
2026-09-30 14:53:18 +00:00
parent af69971efe
commit 795276935c
88 changed files with 5768 additions and 1138 deletions
+15 -7
View File
@@ -130,16 +130,24 @@ function Menu:draw()
-- PlaceString at hlcoord 3,0 writes over the border row it was just
-- drawn on (oak_speech2.asm:162-170)
if self.title then
local title = self.title:gsub("{DONE}%s*$", "")
:gsub("{PROMPT}%s*$", "")
local lines = {}
for line in (title .. "\n"):gmatch("(.-)\n") do
lines[#lines + 1] = line
-- the title's lines and glyph counts, rebuilt only when it changes
-- (this draws every frame the menu is up)
local lines, glyphs = self.titleLines, self.titleGlyphs
if self.titleLinesFor ~= self.title or not lines then
local title = self.title:gsub("{DONE}%s*$", "")
:gsub("{PROMPT}%s*$", "")
lines, glyphs = {}, {}
for line in (title .. "\n"):gmatch("(.-)\n") do
lines[#lines + 1] = line
glyphs[#lines] = #Font.split(line)
end
self.titleLinesFor = self.title
self.titleLines, self.titleGlyphs = lines, glyphs
end
love.graphics.setColor(1, 1, 1, 1)
for i, line in ipairs(lines) do
for i = 1, #lines do
love.graphics.rectangle("fill", (self.tx + 3) * 8,
(self.ty + i - 1) * 8, #Font.split(line) * 8, 8)
(self.ty + i - 1) * 8, glyphs[i] * 8, 8)
end
love.graphics.setColor(0, 0, 0, 1)
for i, line in ipairs(lines) do