RPCS3 / rpcs3

PS3 emulator/debugger
https://rpcs3.net/
GNU General Public License v2.0
14.55k stars 1.85k forks source link

Savestates #10478

Closed elad335 closed 1 year ago

elad335 commented 2 years ago

Restrictions (most will be lifted as this work progresses):

How to savestate

Ctrl+S savestates, savestate will be bootable from the game context menu later.

Versioning System

Because RPCS3 is one of the most complex emulators ever made (if not the most complex) and it is still in rapid development state, the need to update the emulation every now and then in a way which will affect savestates is inevitable. So, while the rest of the emulators use a global version for their savestate for all components of the emulation, RPCS3 savestates will work in a smarter way which allows both rapid development of the emulation and high compatibility of old savestates. The following actions has been taken:

Savestates modes (config.yml exclusives at the moment)

Additional TODO list: (besides lifting restrictions)

Fixes #4218

elad335 commented 2 years ago

Please test extensively this and report issues with logs. Also if you can get callstack for crashes I'll be glad. Issues remain unreported may persist after the pull requerst has been merged so please report them!

elad335 commented 2 years ago

Also feedback about reqeusted features is more than welcome!

elad335 commented 2 years ago

Also: before you are saving state, pause the emulation, go to kernel explorer and capture its contents. This really helps with debugging! Utilities -> Kernel Explorer

elad335 commented 2 years ago

I just made kernel explorer always expand its entries and made it larger for ease of capture. (shared memory and lwmutex you can leave uncaptured if they are too large)

elad335 commented 2 years ago

I recommend capturing kernel explorer in video at 1fps so its contents can be easily read.

Satan86 commented 2 years ago

GT5 - Saved state, game continued playing fine. Finished the race I was currently on and moved on to the next in a different track, where it desynced. Loaded the savestate I had done in the previous race and the emulator crashed. Log: RPCS3.zip Savestate file: https://drive.google.com/file/d/1oRKGorzNktKDKo63RyLW8SDeqXWAmWMK/view?usp=sharing

Motorstorm - After saving state, the game crashed when reloading. Log: RPCS3.zip Savestate file: https://drive.google.com/file/d/1OeLsJzNTxjyfK9e3Q-gawIsgLEkxa-pj/view?usp=sharing

Motorstorm Apocalypse - Saved state, when the game finished reloading the entire emulator closed. Log (last run): RPCS3.zip Savestate file: https://drive.google.com/file/d/1Ziw7z9eAts_wjO4KPBk8clCH9S9vEknb/view?usp=sharing

Ridge Racer 7 - Saved state, when the game finished reloading it threw a fatal error. Log: RPCS3.zip Savestate file: https://drive.google.com/file/d/1HykRMEDZfTf5JXqpsdSmZnzDikdVy7t8/view?usp=sharing

Gran Turismo HD Concept - This game never worked in any savestate version, still a white screen when when reloading the game after saving state. Resuming the game after pausing freezes it, so the kernel explorer video was captured with the game running. Log: RPCS3.log.gz Savestate file: https://drive.google.com/file/d/1Sz-ZJ6INCs8n_bcPuKrrZFrnT6-_J0KW/view?usp=sharing Kernel Explorer video:

https://user-images.githubusercontent.com/61447828/122669391-78156d80-d193-11eb-98d0-81a304c5b7fe.mp4

Skate 3 - Saved state, when the game finished reloading it threw a fatal error. Log: RPCS3.zip Savestate file: https://drive.google.com/file/d/197Mo_Xmpw7uRpw8yEHQ_1_ZZBK7KNiTF/view?usp=sharing Kernel explorer video:

https://user-images.githubusercontent.com/61447828/122669566-608ab480-d194-11eb-8847-ec1a440fb9a2.mp4

God of War 3 - Everything seems to work fine, except performance took a hit after saving state, lost about 5 FPS. Log (tested Heavenly Sword on the same run so it's also logged, it worked fine): RPCS3.zip Savestate file: https://drive.google.com/file/d/1sKvunZp9ng7J5846626FMnwK0BHL7MEB/view?usp=sharing Kernel Explorer video:

https://user-images.githubusercontent.com/61447828/122670438-f5ec6f80-d1b9-11eb-8457-27d02755845b.mp4

The Last Of Us - Saved state, when the game finished reloading it threw a fatal error. Log: RPCS3.log.gz Savestate file: https://drive.google.com/file/d/1DlK6FvfHXuLMBJCJfW9FJHIQr-JjcqdJ/view?usp=sharing Kernel Explorer video:

https://user-images.githubusercontent.com/61447828/122671098-02be9280-d1bd-11eb-8ec8-56ee9c7b72d4.mp4

I could get kernel explorer clips for the first few later if needed, they were tested before your latest commits

ChrisNonyminus commented 2 years ago

Grand Theft Auto IV (NPUB30702) crashes rpcs3 when loading states. Tested on the opening of the game. Log: RPCS3.log Savestate File: https://drive.google.com/file/d/1b8aKQRzu-K8Hy8Qlb7giTgQw9kZvFayy/view?usp=sharing Like a dummy, I forgot to record the kernel explorer before saving the state, so unfortunately I can't show any video of it because there is none.


Fallout New Vegas (BLUS30500) freezes when loading states. Tested on the opening of the game, in-game, where you wake up in Doc Mitchell's house. Log: RPCS3.log Savestate File: https://drive.google.com/file/d/1406Zk_Bp9C6snGUH0qP-J0qD0usuTKZz/view?usp=sharing Turns out RPCS3 crashes when starting the kernel explorer (for this game, at least), so I could record it for this, either.

ChrisNonyminus commented 2 years ago

Half Life 2 The Orange Box (BLUS30055) crashes rpcs3 when saving states, before the file is even made. Tested in the opening of Half Life 2. Log: RPCS3.log

Jonathan44062 commented 2 years ago

Sonic Unleashed - Doesn't work with the save state and I got an error Log: RPCS3.log.gz Savestate file: https://www.mediafire.com/file/axjk1j6tu2k8vc1/BLUS30244.SAVESTAT/file Kernel Explorer Video: https://www.youtube.com/watch?v=0HvW2z9M4Ps

AphelionWasTaken commented 2 years ago

FFX Remaster - creating or loading a savestate causes the ground to render improperly. It appears black except for where characters are standing. No other observed issues. image image RPCS3 FFX.log.gz https://user-images.githubusercontent.com/61633628/122690063-d3c01500-d1ec-11eb-8914-1dc3589f3116.mp4

Rainbow 6 Vegas 2 - No observed issues. RPCS3 Vegas.log.gz https://user-images.githubusercontent.com/61633628/122690228-e5ee8300-d1ed-11eb-8ccb-a4befb679ed3.mp4

Tales of Xillia 2 - No observed issues. RPCS3 Xillia 2.log.gz https://user-images.githubusercontent.com/61633628/122689930-b63e7b80-d1eb-11eb-92bf-a761d9cca1d9.mp4

SSX - Creating or loading a savestate causes a graphical issue with the snow around your character. This issue does go away after a short amount of time.

Attempting to create a savestate after restarting a drop causes the emulator to crash. It fails to create a savestate in this situation. image image Log (successful savestate) RPCS3 SSX.log.gz Kernel Explorer (successful savestate) https://user-images.githubusercontent.com/61633628/122689671-25b36b80-d1ea-11eb-96bc-1b791daec4b1.mp4 Log (crash) RPCS3 SSX Crash.log Kernel Explorer (crash) https://user-images.githubusercontent.com/61633628/122690670-93629600-d1f0-11eb-87fb-65a9ace98ba0.mp4

Haze - No observed issues. RPCS3.log.gz https://user-images.githubusercontent.com/61633628/122689536-e3d5f580-d1e8-11eb-9ed2-7908c2c933f5.mp4

Skate 2 - Creating a savestate crashes the emulator while the game reloads. Attempting to load this savestate also causes the emulator to crash while the game boots. RPCS3 Skate 2.zip https://user-images.githubusercontent.com/61633628/122691153-83988100-d1f3-11eb-804c-902575b25f3b.mp4

Crafty-The-Fox commented 2 years ago

DJ Hero 2 Demo - Creating a savestate crashes the emulator while the game reloads.

RPCS3 DJ Hero 2 Demo.zip

Kernel Explorer MP4

Kilowog01 commented 2 years ago

LittleBigPlanet™ [BCES00611]-Savestate doesn't load RPCS3.log.gz https://drive.google.com/file/d/1Zrut6uufzUcuOLyIL6ccQkQyoijSa_Np/view?usp=sharing https://user-images.githubusercontent.com/16064499/122705023-45b74f00-d22b-11eb-9625-a81009f50c61.mp4

elad335 commented 2 years ago

Anyone has visual studio and can get me callstacks for crashes?

Satan86 commented 2 years ago

RPCS3 crashes whenever I try to boot a game with VS attached, no idea why. Will have to figure that out first

elad335 commented 2 years ago

You need to disable "break when this exception type is thrown" for RSX access violations to work.

Satan86 commented 2 years ago

Thanks for the suggestion, VS debugger is working. Got some callstacks:

Loading savestates on Motorstorm ![Screenshot_7](https://user-images.githubusercontent.com/61447828/122976605-eb250c80-d36a-11eb-82a0-e250af5e8250.png)
Loading savestates on Ridge Racer 7 ![Screenshot_8](https://user-images.githubusercontent.com/61447828/122977309-a057c480-d36b-11eb-8f57-602b34a8402a.png)
Loading savestates on Gran Turismo 5 ![Screenshot_10](https://user-images.githubusercontent.com/61447828/122983411-5c1bf280-d372-11eb-8f61-c29c288b608e.png)
Loading savestates on The Last Of Us ![Screenshot_11](https://user-images.githubusercontent.com/61447828/122984569-8b7f2f00-d373-11eb-9761-881716bc0e81.png)
Loading savestates on Skate 3 ![Screenshot_12](https://user-images.githubusercontent.com/61447828/122986701-ac597b80-d397-11eb-938a-8557e491f77a.png)
Loading savestates on Motorstorm Apocalypse ![Screenshot_13](https://user-images.githubusercontent.com/61447828/122987380-710b7c80-d398-11eb-8780-52de8e4f854d.png)
elad335 commented 2 years ago

Fixed UNIX builds, added debugging info for crashes.

elad335 commented 2 years ago

Pushed some bugfixes.

elad335 commented 2 years ago

Retest your games.

doesthisusername commented 2 years ago

Tested Ratchet & Clank (NPEA00385) on a commit from yesterday, as well as ba47b84 (most recent as of writing). I got the same results on both.

Works perfectly in most cases, except any time a cinematic appears (pre-rendered bink video cutscenes) after loading a savestate (does not matter where in the game the savestate was made), the game will freeze with {PPU[0x1000000] Thread (main_thread) [0x005f0650]} VM: Access violation reading location 0xbadf00d (unmapped memory) [type=u32].

Additionally, if I make a savestate on the first splash screen (the health warning), the game will freeze (infinite loop? one thread is maxed) with {PPU[0x100000e] NPTrophyRegister} PPU TODO: Unimplemented syscall syscall_0 -> CELL_OK (r3=0x0, r4=0x4f0aa0, r5=0x0, r6=0x0, r7=0x3, r8=0x0, r9=0x100000e00000000, r10=0x100000e) on savestate load.

I tried both with the recommended settings (though I couldn't figure out how to "select libvdec.sprx"; I couldn't move it out of the top list box) and my usual settings (all the ones you recommended turned off). No differences I could see.

Logs (I had some code mods loaded for the game eboot, let me know if I should verify without. also they contain both making and loading the state): RPCS3.badf00d.log RPCS3.syscall_0.log

Hope it helps, and thanks a lot for working on this! I've been wishing for this for a long time, and it's going to be very useful!

ChrisNonyminus commented 2 years ago

Half Life 2 The Orange Box now saves and loads states in-game, but when it loads a savestate file rpcs3 errors out, saying the path is invalid. Log: RPCS3.log.gz

elad335 commented 2 years ago

Fixed random SPU crash at loading savestate.

gs-soda commented 2 years ago

Uncharted 1 saves and loads without issues RPCS3.log.gz

elad335 commented 2 years ago

@ChrisNonyminus Retest.

ChrisNonyminus commented 2 years ago

@ChrisNonyminus Retest.

It's fixed now.

Jonathan44062 commented 2 years ago

Testing new build PR

Sonic Unleashed still not working, same error Log: RPCS3.log.gz Kernel Explorer Video: https://www.youtube.com/watch?v=gqyPa-3yxZs

Silent Hill HD Collection, it get stock compiling shaders and only head a sound Log: RPCS3.log.gz Stock Kernel Explorer Video:

https://user-images.githubusercontent.com/78843189/123482146-67695b00-d5ca-11eb-8c33-82eb4a262ed2.mp4

Metal Gear Solid HD Collection, Same issue as Silent Hill HD Collection Log: RPCS3.log.gz Stock 2 Kernel Video Explorer:

https://user-images.githubusercontent.com/78843189/123483127-e4490480-d5cb-11eb-87e5-fff7d36f5718.mp4

elad335 commented 2 years ago

@Jonathan44062 Retest.

Jonathan44062 commented 2 years ago

Silent Hill HD Collection and Metal Gear Solid HD Collection works fine now! But not Sonic Unleashed, same error Log: RPCS3.log.gz Kernel Explorer Video: https://www.youtube.com/watch?v=A42Zb0lrRCU

wheelmac92 commented 2 years ago

In God of War 3, if you make a save state with no patches enabled, then enable all the patches, then load the save state, significant bugs happen.

Can there be a safe-guard in place to prevent people from loading save states that are incompatible due to changes in patches?

elad335 commented 2 years ago

https://github.com/RPCS3/rpcs3/pull/10478#issuecomment-870804764

@wheelmac92 Thank you for your feedback, what should really happen is that patches are ignored on savestste load. (as if the old patches are still active) I will add the todo list.

wheelmac92 commented 2 years ago

What if a save state is taken for an un-updated game, and then a Title Update is installed, and then the save state is loaded? Is there any safe-guard there? What about DLC? @elad335

elad335 commented 2 years ago

It should be incomaptible, but this error checking is not yet implemented.

elad335 commented 2 years ago

Implemented softcoded game file paths handling: what this means? it means that you can share savestates between people and move game files from one place to another and savestates will still be compatible. (applies to disc games and moving the entrie of /dev_(hdd0/flash) Testers needed to test if this feature alwayas works, for disc games it means to move the game folder to somewhere else then informing RPCS3 of its new location. (needs to appear in game list)

Kilowog01 commented 2 years ago

LittleBigPlanet™ [BCES00611] The first time it gets ingame, but the performance is destroyed, 80% of the inputs don't work and the textures are black. After closing RPCS3, saved the log and tried to boot with savestate...RPCS3 crashes. I uploaded both logs, savestate file and video of everything happening. https://drive.google.com/drive/folders/1Y8EeUn5kijcYd0ngF-WFm0J9cE3wlBAA?usp=sharing

Jonathan44062 commented 2 years ago

I don't have that error with Sonic Unleashed anymore, but now, it doesn't load the game after pressing CTRL + S No error message what I see Log: RPCS3.log.gz Kernel Explorer: https://user-images.githubusercontent.com/78843189/125519205-4ceed4f8-2aa7-47fa-ab08-78ea9ab0bbbd.mp4

Playstation All Stars Battle Royale Same issue with Sonic Unleashed? It doesn't load the game after pressing CTRL + S And i get this message image Log: RPCS3.log.gz Kernel Explorer: https://user-images.githubusercontent.com/78843189/125523332-54429594-3195-4d4a-bc06-b4e19d3590d3.mp4

elad335 commented 2 years ago

Btw you can now press "Log All" button in kernel explorer for the same effect as recording.

Jonathan44062 commented 2 years ago

I did what did you said, with the "Log All", no more recording in the kernel explorer Here's the log file, with Sonic Unleashed, it doesn't load the game after pressing CTRL + S RPCS3.log.gz

Closing the emulator and open again to boot the save state, I have this message image After that, I cannot repeat to reboot again with the save state Log with the error: RPCS3.log

Kilowog01 commented 2 years ago

LittleBigPlanet 2 and 3 don't even launch with this build, they both crash with the default settings and the required settings. RPCS3_LBP2.log RPCS3_LBP2_DEFAULT.log RPCS3_LBP3.log RPCS3_LBP3_DEFAULT.log

elad335 commented 2 years ago

Wait it does need elaboration in case it affects the file format of savestats, better to address savestate file format issues now instead of in master.

elad335 commented 2 years ago

Even inserting zero-filled space in the final file for later implementation is an option.

MsDarkLow commented 2 years ago

Yakuza Ishin crashes as soon it loads the save state. It used to previously work on the older builds posted in #development (ex: rpcs3_savestates_elad_v1.04 worked fine here)

Log: RPCS3.log.gz Savestate File: https://drive.google.com/file/d/1txsaFevj7TKc_CnJZi14BKbjtrFMHpaV/view?usp=sharing

elad335 commented 2 years ago

It's because you turned on HLE lwmutex.

AphelionWasTaken commented 2 years ago

LBP 2 still does not launch with this PR. Gets stuck after building the caches image RPCS3.log

elad335 commented 2 years ago

Disabling Logging... Please enable logging.

AphelionWasTaken commented 2 years ago

absolute smoothbrain moment. should have looked at the log size.

here is a proper log: RPCS3.log

elad335 commented 2 years ago

@AphelionWasTaken Retest.

AphelionWasTaken commented 2 years ago

Good news: LBP2 now loads just fine image

Not so good news: Attempting to create a save state causes the emulator to crash RPCS3.zip

elad335 commented 2 years ago

Fixed "Start Paused" savestates' setting, there was no report of it being broken so I notified it anyways. Also removed debugging changes to kernel explorer.

Asinin3 commented 2 years ago

Sly Cooper Thieves in Time crashes when creating a savestate. image RPCS3.zip

elad335 commented 2 years ago

@Asinin3 Retest, I've implemented a missing statesaving of emulated PS3 filesystem feature.