I'm not sure if this is the right community for this, but figured I'd give it a try.
FCEUX is an amazing emulator for the NES, which is feature rich with debugging tools. It also offers the ability for users to run Lua scripts which have access to various emulator functions. However, I can't seem to figure out how to access the PPU memory of the NES. It offers direct access to the CPU memory and the ROM data, but doesn't seem to have direct access to the PPU memory. Since the NES uses memory-mapped I/O, it is possible - in theory - to get the data from special CPU memory addresses, but this seems cumbersome, and also like it might interfere with emulation.
Does anyone know of a way to programmatically extract the PPU memory via FCEUX's Lua API? If not, does anyone know of an emulator which features an API to extract PPU memory programmatically?
As of FCEUX 2.3.0, you can use
ppu.readbyte(int address)
andppu.readbyterange(int address, int length)
. Still nothing for writing bytes, though.To add onto SpiderDave's answer, you might have better luck if you call his
writebyteppu
hack from aregisterexec
callback at an address just after the game has finished writing its graphics for the frame.