ares icon indicating copy to clipboard operation
ares copied to clipboard

[32X] Doom 32X Resurrection v3.x exits with internal error

Open viciious opened this issue 2 years ago • 1 comments

Describe the bug D32XR v3.x randomly fails to pass an internal safety check during the gameplay and exits with an error.

To Reproduce Steps to reproduce the behavior:

  1. Launch D32XR v3.x ROM
  2. Start a new map, preferrably MAP 1 or MAP 19
  3. Stand still for a bit
  4. See the following error message on the black background "lastopening > MAXOPENINGS: 4690"

The error involves some randomness or a few tries may be needed. Changing screen resolution to the maximum value seems to increase the odds of the error.

Expected behavior No errors.

Screenshots image

Additional context

Please see https://github.com/viciious/d32xr/blob/master/r_main.c#L968

The 'lastopening' variable is a variable that is shared across two CPUs. The sanity check fails on the main CPU after the secondary CPU is done writing to it and corresponding cache line is flushed on the main CPU. This happens in ares, not on real hardware or other emulators. The problem may be related to bank switching, but I find that unlikely.

viciious avatar Aug 31 '23 12:08 viciious

Note that this may still be a software issue, depending on how ares emulates SH2 CPU cache. I'll report back if I manage to fix it.

viciious avatar Aug 31 '23 12:08 viciious