Polprzewodnikowy / SummerCart64

SummerCart64 - a fully open source N64 flashcart
https://summercart64.dev
GNU General Public License v3.0
405 stars 22 forks source link

Improve CIC emulation timings #45

Open Polprzewodnikowy opened 11 months ago

Polprzewodnikowy commented 11 months ago

Describe the bug CIC emulation doesn't adhere to timings generated by real CIC chip in two locations: before sending encoded checksum and before sending x105 algorithm result. This makes games boot faster than on real cartridge.

To Reproduce Steps to reproduce the behavior:

  1. Run game on SC64 with direct mode enabled
  2. Measure timings
  3. Run game on retail cartridge
  4. Measure timings

Screenshots No screenshots.

Expected behavior Timings should be close to the real CIC chip.

Possible solution Add delay between detecting falling edge of CIC clock and falling edge of CIC data in locations mentioned above.

networkfusion commented 6 months ago

Was this not fixed with V2.18?

Polprzewodnikowy commented 6 months ago

Not really, I still need to measure differences between real CIC and emulated one.

jago85 commented 4 months ago

Why is that even a problem? Or does it have something to do with speedrunning, where everyone has to have the same prerequisites?

Polprzewodnikowy commented 3 months ago

I've got one report where SC64 booted the game couple of frames faster than retail cartridge. Test was done with direct boot (there was no code running before loading the game). I haven't done such testing myself so I couldn't be 100% sure if the CIC timings are at fault here, but it seems that's the only difference between retail cartridge and SC64. I've noticed that PIF waits for CIC response in couple of places but I'm not sure if this wait time could extend to several milliseconds, as boot time difference was measured in 16 ms frames.