finalburnneo / FBNeo

FinalBurn Neo - We are Team FBNeo.
http://neo-source.com
Other
915 stars 360 forks source link

Possible input lag regression with CPS1 #58

Closed barbudreadmon closed 5 years ago

barbudreadmon commented 5 years ago

I was benchmarking input lag for some systems against the fbalpha2012 libretro core (which is based on 0.2.97.24) and noticed something : fbalpha2012 has 1 frame of input lag on cps1, while current fbneo has 2 frames. I only tested this on sf2 & dino. On a sidenote, CPS2 (and the few other systems i tested) has the same input lag on both cores.

dinkc64 commented 5 years ago

Help wanted: someone to figure out what caused this? and a possible solution? I can think of one thing - previously we were using completely wrong # of lines per frame, so some games would glitch. Cyclewise, I think we're pretty much right-on, but on the other hand, anything could be possible.

best regards,

barbudreadmon commented 5 years ago

I can think of one thing - previously we were using completely wrong # of lines per frame, so some games would glitch. Cyclewise, I think we're pretty much right-on, but on the other hand, anything could be possible.

Good guess, the input lag regression is the result of this commit, more specifically the part in cps_run.cpp where CpsDraw was moved (i tried moving it back and the input lag went down to 1 frame again).

dinkc64 commented 5 years ago

Captain Commando and Chiki / Mega Twins get raster glitches when drawing at the end of frame as opposed to at vblank (like it does and should). I'm pretty sure it's being emulated faithfully, basically drawing at the end of frame means we're drawing some of the next frame's data (which is why it glitches) - because after vblank that's when it starts preparing the next scene/frame. The glitches are basically caused by the mixing of current frame + incomplete next frame's data being displayed.

dinkc64 commented 5 years ago

But, there is always a solution... :) I know for a fact chiki and captcomm have issues, we can have those games draw at vblank and have all the rest draw at end of frame. Problem solved, if we find other games that have raster glitches they can also be kludged.

barbudreadmon commented 5 years ago

If drawing at vblank is how it should be, then i'm totally fine with it. I thought it was only a regression but if it's actually an improvement accuracy-wise, maybe we should stay that way ? 2 frames of input lag is not that bad (especially on the libretro port where you can artificially cut it anyway).

dinkc64 commented 5 years ago

Code in. Just need some more help. First, notice what a raster glitch is by grabbing the latest code and run captcomm after editing d_cps1.cpp: static INT32 Cps1RasterInit() { Cps1DrawAtVblank = 1; <- change this to 0 for this test.

return DrvInit();

}

watch as the titlescreen uses a raster effect to expand the Captain Commando logo. Do you see those glitches as it expands the logo? A glitch can also involve flickering something and disappearing it before showing it again & before or after fadeouts. Now change the init back to Cps1DrawAtVblank = 1;

The next step involves looking for similar raster glitches on other CPS1 game other than Captain Commando and Mega Twins / Chiki. They usually present themselves in the titlescreen/attract mode or cutscenes after starting a game.

These are just guidelines to look for raster bugs, if you don't want to do this that is ok :)

dinkc64 commented 5 years ago

Responce to your message above, this is how I originally wanted to do it but [that evil guy] cut my code (you can see in the history), so when I realized that he is not in charge any more, we'll do it my way :)

barbudreadmon commented 5 years ago

we'll do it my way :)

That's fine too :), i'll close then !

barbudreadmon commented 5 years ago

Re-opening already, i found an issue with logo zoom/rotation on sf2 and clones, however i couldn't fix sf2rules & sf2b3 by using Cps1RasterInit in their custom init functions. I sent a PR for the others (however i didn't test all the clones, only those with custom init functions).

NB : it seems TwelveMhzInit is fixing logo for sf2rules & sf2b3, but i didn't include this in my PR because i wasn't sure about side effects.

On a sidenote (most likely unrelated to the current issue), i found this glitch on sf2b's guile stage : sf2b-190623-172931

dinkc64 commented 5 years ago

Can you please re-check sf2 titlescreen before and after the vblank kludge? If so, can you post a side-by-side picture for the bad frames?

I compared SF2's titlescreen logo pseudo-"roto-zoom" both ways, and each one has equally crappy effect. Drawing at vblank or end of frame makes no difference at all, at least to my eyes.

This effect was intended by capcom, because cps1 doesn't support roz they did a pseudo-roz effect and it looks horrible - but probably they meant for it to happen so fast and never thought people would single-step the frames :)

dinkc64 commented 5 years ago

sf2b doesn't support all of the scroll registers that a normal cps1 board has, which is the reason for the broken plane tail-fin. See the Notes: section on standalone ;)

dinkc64 commented 5 years ago

p.s. I just single-stepped old vs. new sf2 titlescreen side-by-side and frames are identical.

barbudreadmon commented 5 years ago

Nvm, it seems i messed up somewhere while testing yesterday (i can't figure out what i did though), i can't reproduce it anymore. Somehow instead of rotating then expanding, the tiles of the logo were merging into a single square then expanding, it was really weird. Sorry about the false alarm... Closing again then.