PCSX2 / pcsx2

PCSX2 - The Playstation 2 Emulator
https://pcsx2.net
GNU General Public License v3.0
11.45k stars 1.59k forks source link

[BUG]: Emulation during TAS playback is inconsistant #11607

Open TheLastRar opened 1 month ago

TheLastRar commented 1 month ago

Describe the Bug

Emulation is inconsistent can cause two playbacks of the same input recording to behaviours differently

Discovered when playing back a recording of me playing the tutorial for Jak X (PAL)

Playback will typically desync during the second tutorial, where the tutorial prompt freezes the game while you are in motion

In run 1, this tutorial was starts on frame 9248 and (slowly) starts to unpause on frame 9499 In run 2, this tutorial was starts on frame 9248 and (slowly) starts to unpause on frame 9500

As this tutorial occurs while you are motion, the recorded inputs and the car position become desynced.

The following drift is (possible as a result?) then exasperates the desync, as run 2 exists the drift a frame earlier, does not re-enter the drift and as a result leaves the tunnel miss-aligned from the 1st run.

Other de-syncs observed but didn't have a visible gameplay affect are; 2 lines of subtitles (frame 3684 & 4206) are delayed by 2 frames, despite other subtitles and the camera movements being in sync Differences in visual effects (particles and the movement of the pickups)

Run 1 (Tutorial 2 starts at 3mins in) https://youtu.be/6aL6yC8rbdU

Run 2 (Tutorial 2 starts at 3mins in) https://youtu.be/GuAlRCYPGKw

A Comparison (Tutorial 2 starts at 3mins in) https://youtu.be/P9d-MLa-HII The comparison is made using the following command ffmpeg -y -i "vid1.mp4" -i "vid2.mp4" -filter_complex '[1:v]format=yuva444p,lut=c3=128,negate[video2withAlpha],[0:v][video2withAlpha]overlay[out]' -map [out] "compare.mp4"

The input recording file JakXTestRecording.zip

Reproduction Steps

Using either the attached recording file, or your own recording file

  1. Playback the recording file
  2. Close and reopen the emulator
  3. Playback the recording file and observe the difference

The video capture was produced using the following steps;

  1. Start the game with Pause on Start set
  2. Frame Advance until frame 5
  3. Start the video capture
  4. Unpause

Expected Behavior

Playback of input recording files to result in consistent behaviour

PCSX2 Revision

Recordings from #11590, bug verified to exist on v2.1.18

Operating System

Windows 11

If Linux - Specify Distro

No response

CPU

AMD Ryzen 9 7950X3D

GPU

RTX 4080

GS Settings

No response

Emulation Settings

Pause On Start: Enabled Fast Boot: Enabled Memory Card Slots 1 & 2: Ejected + Disabled

GS Window Screenshots

No response

Logs & Dumps

emulog.txt

sestain commented 1 month ago

test 1: https://youtu.be/sv9F0htCuIs test 2: https://youtu.be/VZMQQWi-0WI compare: https://youtu.be/tLno1EW0cvY Compare maybe has like 1 frame difference, but it's so small it's almost unnoticeable. Also it didn't desync for me, so technically I couldn't reproduce the issue even though it had 1 frame difference between playbacks but it synced.

kage2051 commented 1 month ago

Something tells me it's the CDVD side causing the frame drift. I remember a similar case with 3DS TASing where most of the desyncs were caused by I/O depending on host disk transfer rate, even if it's being playback'd on the same computer. Which was fixed at least for the ported core on BizHawk dev builds.

TheLastRar commented 1 month ago

test 1: https://youtu.be/sv9F0htCuIs test 2: https://youtu.be/VZMQQWi-0WI compare: https://youtu.be/tLno1EW0cvY Compare maybe has like 1 frame difference, but it's so small it's almost unnoticeable. Also it didn't desync for me, so technically I couldn't reproduce the issue even though it had 1 frame difference between playbacks but it synced.

I tested Crash TwinSanity and it didn't suffer from this bug, it played back consistently for me

Something tells me it's the CDVD side causing the frame drift. I remember a similar case with 3DS TASing where most of the desyncs were caused by I/O depending on host disk transfer rate, even if it's being playback'd on the same computer. Which was fixed at least for the ported core on BizHawk dev builds.

I had initially suspected something on the SPU side (as the effected tutorial plays for the duration of a voice line, along with the other issue of de-synced subs), but it could easily be something else