PCSX2 / pcsx2

PCSX2 - The Playstation 2 Emulator
https://pcsx2.net
Other
10.61k stars 1.54k forks source link

[BUG]: TAS save state undo issue. #11454

Open RRX-JP opened 1 week ago

RRX-JP commented 1 week ago

Describe the Bug

If a save state is performed during recording in TAS and the state is loaded, undoing will corrupt the subsequent recording because of the frame gap that occurs at the timing of loading.

i7 10700K GTX 1070

Game:SLPM-65719 Burnout 3 - Takedown

Reproduction Steps

  1. Record TAS.
  2. play and Save State.
  3. load Save State. (At this point, UndoCount is set to 1.)
  4. Complete the recording at any time.
  5. play TAS.(Select record file. File generated in 2.)
  6. The gap occurs at the timing of the load state.

Video https://youtu.be/m1VNQpb81UU

Expected Behavior

No response

PCSX2 Revision

v1.7.5922

Operating System

Windows 11

If Linux - Specify Distro

No response

Logs & Dumps

No response

RRX-JP commented 1 week ago

Apparently not a blank, It appears that a few frames were not recorded.

https://github.com/PCSX2/pcsx2/blob/3040474f99894915caf81d065dab0a22f37bbcdc/pcsx2/VMManager.cpp#L1813 I feel there is a problem here.

sestain commented 1 week ago

Can confirm this too from my own testing.

kage2051 commented 4 days ago

Sounds like a data race between GS and EE threads, which this PR should fix: https://github.com/PCSX2/pcsx2/pull/10793

However, the generated builds for it lack of any fixes for .p2m2 playback (it does nothing after clicking on Tools > Input Recording > Play) so I am unable to properly test these changes.

F0bes commented 4 days ago

Sounds like a data race between GS and EE threads, which this PR should fix: #10793

However, the generated builds for it lack of any fixes for .p2m2 playback (it does nothing after clicking on Tools > Input Recording > Play) so I am unable to properly test these changes.

I've rebased that PR. Once it builds you should be able to test it with the latest master changes.

kage2051 commented 3 days ago

Looks like the PR does not fix the issue. The RNG in most titles seems to be really inconsistent between states.

RRX-JP commented 3 days ago

test from 1.7.5936 If you can give me some hints. Load state and when it is rewritten. I deleted the front 2 frames (+18h+18h) and it improved.

image Blue: Record before load state. Black: Deleted from the record before the load state. Pink: overwritten by load state.

kage2051 commented 3 days ago

I should also mention emulation pausing also causes the frame dropping/removal in the recording file.

RRX-JP commented 3 days ago

I should also mention emulation pausing also causes the frame dropping/removal in the recording file.

Yeah. I confirmed it about 3 minutes ago.

kage2051 commented 3 days ago

test from 1.7.5936 If you can give me some hints. Load state and when it is rewritten. I deleted the front 2 frames (+18h+18h) and it improved.

image Blue: Record before load state. Black: Deleted from the record before the load state. Pink: overwritten by load state.

How can I determine which frames are fine and which are not because of a state load?

RRX-JP commented 1 day ago

test from 1.7.5936 If you can give me some hints. Load state and when it is rewritten. I deleted the front 2 frames (+18h+18h) and it improved. image Blue: Record before load state. Black: Deleted from the record before the load state. Pink: overwritten by load state.

How can I determine which frames are fine and which are not because of a state load?

Perform a save state while holding down any key, and perform a load state with no key pressed.