flyinghead / flycast

Flycast is a multiplatform Sega Dreamcast, Naomi, Naomi 2 and Atomiswave emulator
GNU General Public License v2.0
1.37k stars 167 forks source link

Wrong behaviour in Crazy Taxi's attract-mode #644

Open anchounio opened 2 years ago

anchounio commented 2 years ago

Please Note: This form is the minimum required information for submitting bugs.
Removing this form may lead to your issue being closed until it is completed.

Platform / OS / Hardware: Win10

Github hash: dcb439f

Hardware: Inte core i5 3300, geforce 9800

Wrong behaviour in Crazy Taxi's attract-mode car. Naomi version.

Here's the behaviour in Flycast: https://www.youtube.com/watch?v=ff2OV0fC8QE

Here's how it should work. Recorded from the original hardware: https://youtu.be/iJQZZmidsMo?t=119

This has never been fixed in any emulator. It also behaves badly in MAME and Demul.

71knight commented 2 years ago

LeMans 24-hour racing game car also crashes into things on redream emulator. I heard the problem may be floating point emulation being inaccurate in these emulators leading to poor pathfinding.

flyinghead commented 2 years ago

Yes, this is likely due to floating point inaccuracies vs. original hardware. Most SH4 floating point operations conform to the IEEE-754 standard, which guarantees that any given calculation leads to the same result regardless of the CPU/platform. However, there are two SH4 operations (namely FIPR and FTRV) that don't conform to this standard.

The first problem is we don't know exactly what these operations do (number of bits, rounding, etc.) And even if we knew, emulating these operations "manually" would probably be extremely slow. They are used intensively for all vector and matrix computations.