I spent most of today finally making some meaningful progress on SGB emulator accuracy testing and console verification sync testing. Today I set up lsnes in Linux by compiling from source (with some direct help from Ilari in IRC) to allow for the most flexibility in testing. I determined very quickly that there was no point in attempting to do a lua script conversion from VBM format to lsnes format as timing is drastically different. In particular, the SGB runs at about 1.024 the speed of a GBC and on top of that the SGB is not well emulated so I realized that a better course of action was to try a test segment and re-implement the inputs, adjusting as needed.
I used Pokemon Yellow and recreated the initial input up to saving the game from
FractalFusion's Total Control run. This took an oddly long amount of time, possibly because my kids took great delight in throwing themselves across my lap or generally being kids that wanted to spend time with their dad, which I was obliged to reciprocate, but I digress. I eventually created this
Pokemon Yellow lsnes SGB test movie file which *should* sync on a standard release of lsnes. My initial console verification tests did not go well; it seemed like the console was far slower than the emulator, especially when doing the color fadeout transitions. I ended up using a hex editor (okteta) to add a substantial number of lag frames prior to these transitions, and after a fair bit of twiddling I was able to get the movie file to console verify.
This series of statements should be considered carefully - first, we already knew that SGB emulation wasn't fantastic, and now we know that it's off by several frames in groups. This means that any run must be tediously verified and checked against the console while it's being developed to ensure it will sync. It also means that some mechanism for adding lag frames and keeping track of them needs to be implemented as what I'm doing now is editing the .frame.r16m console verification file (seeing as it probably wouldn't sync if we added the lag frames to the lsnes movie file). I'm not yet sure how to handle this, although my preference would be to doge the problem altogether by improving SGB support to properly include lag frames where they are needed. I'm not optimistic that this can happen in the next 7 weeks, however, so I'll proceed under the assumption that we'll need to make do with the emulation abilities available today.
I do not yet know what limits this will put on the SGB portion of the run but to me it seems like the hardest segment will be reaching total control of Pokemon (regardless of which variant). I will continue to plow forward on my own but if anyone has any suggestions or thoughts on how to proceed please feel free to speak up. Thanks!