fceux icon indicating copy to clipboard operation
fceux copied to clipboard

memory.registerread isn't implemented

Open Xkeeper0 opened this issue 4 years ago • 2 comments

Specifically, the code here comments out the function with a "todo" marker: https://github.com/TASVideos/fceux/blob/master/src/lua-engine.cpp#L5941

Ideally, it would be nice to have memory.registerread() able to return a value that would be the result of that read, to be able to hook certain addresses. memory.registerwrite() recently got that functionality.

The use case would be hooking writes to areas of memory that can't be read or written to normally, such as PPU registers or the APU, or even arbitrary addresses. This would allow a Lua script to emulate / simulate external devices or addons.

(Previous versions of the documentation said that the value written was not passed to memory.registerwrite because "you could just read what was written with memory.readbyte", but in the case of hardware registers that wasn't possible)

Xkeeper0 avatar Jan 14 '21 17:01 Xkeeper0

I'm kinda curious what happens if we just uncomment it? memory_registerread does seem to have an implementation, at least at first glance.

bbbradsmith avatar Jan 15 '21 05:01 bbbradsmith

Doesn't seem to ever get called, judging by https://github.com/TASVideos/fceux/commit/3ab41b359cd21d51fdd810a2de77b39ed42baeb7

vadosnaprimer avatar Jan 15 '21 10:01 vadosnaprimer