Files
SDD db535c2adc harness: explicit monochrome palette (pen 0 black, pen 1 white)
vt1200.cpp declared PALETTE(config, m_palette).set_entries(256) with no init
delegate, so render_active_line()'s pens 0/1 rendered in whatever MAME's
default palette held -- reported as red on screen.  Use
palette_device::MONOCHROME (emupal.cpp: palette_init_monochrome) with two
entries, so the colour is ours and deterministic.

Verified via a real MAME screenshot (screen:snapshot(), which renders through
the palette -- dump_frame()'s PPM is straight from bitmap pens and cannot show
colour): pal_mono_frame600.png is exactly black (0,0,0) + white (255,255,255).
palverify.lua takes the screenshot; the frame is the level-1 error screen.
2026-10-16 13:02:50 +03:00

31 lines
1.1 KiB
Lua

-- palverify.lua -- take a real MAME screenshot (video manager -> palette applied)
-- at a chosen frame. Unlike dump_frame()'s PPM (straight from bitmap pens), a
-- screen:snapshot() renders through the palette, so it is the correct instrument
-- for checking the mono colour ramp.
--
-- PAL_FRAME=<n> PAL_OUT=<abs path .png> <mame> ... -autoboot_script palverify.lua
local machine = manager.machine
local dbg = machine.debugger
local screens = machine.screens
local at = tonumber(os.getenv("PAL_FRAME") or "600")
local out = os.getenv("PAL_OUT") or "/home/arti/code/k-space/vt1200/harness/mame/pal_snap.png"
local screen = nil
for tag, s in pairs(screens) do screen = s; break end
if not screen then print("ERROR: no screen device"); machine:exit(); return end
local n = 0
emu.register_frame_done(function()
n = n + 1
if n == at then
local err = screen:snapshot(out)
print(string.format("SNAP frame=%d -> %s err=%s", n, out, tostring(err)))
machine:exit()
end
if n > at + 5 then machine:exit() end
end, "vt1200-palverify")
if dbg then dbg.execution_state = 'run' end