hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.14k stars 2.16k forks source link

YGO Tag Force Special Failed To Load Savestate Show No Warning What Cause The Issue #14653

Closed ghost closed 3 years ago

ghost commented 3 years ago

This video tell the issues. Screenrecorder-2021-07-28-11-33-19-421.zip logs-2021-07-28-11-34-27.zip

Redmi Note 9 ppsspp v1.11.3-975

hrydgard commented 3 years ago

Is this new?

hrydgard commented 3 years ago

Whoops, never mind, I can repro this in other games (Wipeout for example).

I'll track down and fix this later today.

hrydgard commented 3 years ago

Hm never mind I tricked myself, my savestate was just at the start so I thought I had the same symptom :/

unknownbrackets commented 3 years ago

Can you upload the save state?

-[Unknown]

ghost commented 3 years ago

Can you upload the save state?

-[Unknown]

PPSSPP_STATE.zip

ghost commented 3 years ago

What is this? Screenshot_2021-08-06-06-27-29-036_org ppsspp ppsspp

unknownbrackets commented 3 years ago

This save state is corrupt as we saw in #14564, but the corruption is different.

However, this one is more concerning looking. I'm hoping #14692 may have helped this too, but I'm pretty worried that it won't.

In this one, we have:

I'm now worried we have a bug where MEASURE and WRITE don't consistently return the same sizes. It really seems like we generated corrupt data and ZSTD had no problems on its end in this save state.

-[Unknown]

unknownbrackets commented 3 years ago

Also, I see the warning just fine. Is HideStateWarnings = True in ppsspp.ini?

-[Unknown]

ghost commented 3 years ago

This can be close now.

unknownbrackets commented 3 years ago

Okay - haven't seen any save states fail to save or not show warnings? I'll close then. Really hope those changes helped.

-[Unknown]

ghost commented 3 years ago

I can reproduce this again why 🤔 Screenshot_2021-09-16-17-40-58-926_org ppsspp ppsspp

unknownbrackets commented 3 years ago

Can you attach the save state? You didn't get an error when creating it, right?

-[Unknown]

ghost commented 3 years ago

Can you attach the save state? You didn't get an error when creating it, right?

-[Unknown]

Unfortunately I deleted the savestates with that issue I will try again to reproduce this issue.

iota97 commented 3 years ago

Mhhh, while I totally gotta admit I don't really get all the logic behind the save state I wonder:

Here we resize the vector if is smaller: https://github.com/hrydgard/ppsspp/blob/d31eddf417934c9106311d77a66bca8515862b5b/Core/SaveState.cpp#L95-L96

That vector can be either this static one: https://github.com/hrydgard/ppsspp/blob/d31eddf417934c9106311d77a66bca8515862b5b/Core/SaveState.cpp#L121 or one of this two (note that: typedef std::vector<u8> StateBuffer;) that are class member: https://github.com/hrydgard/ppsspp/blob/d31eddf417934c9106311d77a66bca8515862b5b/Core/SaveState.cpp#L244

Now the compress code loop over the vector size: https://github.com/hrydgard/ppsspp/blob/d31eddf417934c9106311d77a66bca8515862b5b/Core/SaveState.cpp#L179

So I wonder if the savestate size is smaller than the previous one does this work? Not sure if this is of any concern, but better ask ig :)

unknownbrackets commented 3 years ago

That code is only related to the rewind save states kept in RAM. That's not used for save states persisted to disk at all.

The compression code is just to deduplicate so it doesn't use insane amounts of RAM. It's true that it could probably be improved, but I just wanted it to be fast. See #5129.

Anyway, this issue is about save state files, which are handled here: https://github.com/hrydgard/ppsspp/blob/d31eddf417934c9106311d77a66bca8515862b5b/Core/SaveState.cpp#L913

That in turn calls the serialization code: https://github.com/hrydgard/ppsspp/blob/d31eddf417934c9106311d77a66bca8515862b5b/Common/Serialize/Serializer.h#L198

Which is where all the buffer and compression handling for file based save states is: https://github.com/hrydgard/ppsspp/blob/d31eddf417934c9106311d77a66bca8515862b5b/Common/Serialize/Serializer.cpp#L351

Ultimately, they both use the same mechanics, but the rewind code is bypassing all the file handling in the serializer since it wants to keep everything in RAM. Disk IO would make the perf impact of rewind much worse.

-[Unknown]

ghost commented 3 years ago

Cannot reproduce this again anymore 🤔 Tried to abuse savestate and then load state for playing for an hours and no issue. Closing.