Need help with Spectrum emulator and determinism #273
Replies: 1 comment 10 replies
-
|
|
Beta Was this translation helpful? Give feedback.
10 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Firstly, sorry if this isn't the right place to ask, but I've been trying for 3 days now to join the "official forum", but it seems that whoever's in control of that wants to make it damn near impossible to register (I have no idea who created the first 16 bit home computer, and besides, first where, US, UK, Europe, Asia?, and then forcing you to wait what seems like an entire day to try again when you get it wrong seems ridiculous).
I'm trying to use MAME, specifically the Sinclari Spectrum emulator part, to form the basis of a regression test suite for my game creator Kwyll. I've managed to make some progress, writing Lua scripts that allow me to capture the state of the keyboard and joystick input ports, and when I press F12 capture a record of the Spectrum screen memory for later ocmparison. Then I've created another Lua script that can read that saved data, replay the input states, and at the right time compare the state of the Spectrum memory with the image saved to confirm the export from Kwyll is consistent.
It seems to work for some content, but for others, specifically one snapshot that cycles the colours and changes the screen contents on keypress input, it fails the image comparison for some capture points. If I save 5 screen captures, and it failes on 3 and 5, it seems it will always fail on 3 and 5, so it's consisten in that regard. However, I can't seem to work out what, if anything, I'm doing wrong to make sure that it consistently produces exactly the same screen memory at the specific frame of execution.
I'm using the "register_frame_done" hook to both capture the data in the record mode, and replay in the test mode. So my question is, is the frame counting and emulator execution deterministic in this regard? If I start the emulation by setting the "snapshot" to my .sna file and reset the "frame" counter at a point in the "register_frame_done" handler to move to the next test, is there any way to guarantee that frame 1, 2, 3, 4, etc. are consistent every time I run the snapshot? I'm a little confused as to why the replay is consistent, in that it fails in the same way every single time, but not consistent between the record and replay, even though I'm checking the "machine:time" value and recording it in the data stream, and during playback confirming they are within 0.00001s of each other.
Thanks for any help, happy to provide the record and replay scripts if that would help understand the problem. Also happy to be told that this is not possible in MAME, that would at least save me wasting any more time chasing.
Beta Was this translation helpful? Give feedback.
All reactions