ChendoChap / Playstation-4-Save-Mounter

MIT License
142 stars 56 forks source link

Compatibility with games #6

Closed Buzbee closed 5 years ago

Buzbee commented 5 years ago

Ratchet and Clank finds 0 Save directories Info in savedata.db: CUSA01047 rcps4 Saved Data

Encrypted files found in /user/home/user id/savedata/CUSA01047: rcps4.bin sdimg_rcps4

Workaround for this game does not seem to apply since no sce_sdmemory file. I duplicated record and replaced rcps4 with temp in above mentioned files. Save file is corrupted afterwards.

I got Last Guardian to work using hejran7's detailed workaround directions after changing an instruction to:

  1. copy to your desktop then rename ( sce_sdmemory.bin to temp.bin) and (sdimg_sce_sdmemory to sdimg_temp) now ftp the renamed files to same folder (CUSAXXXXX) and delete sce_sdmemory.bin & sdimg_sce_sdmemory...

BTW I miss "Find Playstation" in v1.2. It worked for me all the time although I know others had issues. Now I have to type the ip in all the time.

ChendoChap commented 5 years ago

just to be sure, you made sure to start the game with the correct account right? If that wasn't the problem..... I don't have that game and I don't really like pirating things so this is going to be annoying to fix. I'll add some log stuff, this will help us identify the problem.

As for the Find playstation button, like you said some people had issues with it, some of them were unable to figure out that they needed to type their ip manually so I just took it out. Now I probably could have made it save the ip but I've been very busy with studying lately.

I'll do this in the next few days.

Buzbee commented 5 years ago

Yes. I used the correct account.

Using the normal method I have successfully tested the following games: Unchartred 4 : A Thief's End Knack The Order - 1886 Final fantasy X/X-2 HD remaster Tearaway Unfolded Uncharted - The Nathan Drake Collection

Using the workaround method I have successfully tested the following games: The Last Guardian

Ratchet and Clank looks like it should work with the normal method and find save directory "rcps4" according to the savedata.db. It does have similarities to the workaround game method in that there is no load option and you have only one save with new game and continue as your only options.

BTW your program also has another use: converting retail game saves to fpkg game saves.

From experimenting, i noticed all my keystone files (in the sce_sys folder) from my fpkg saves were exactly the same (checksums match) so i copied it to my computer. I backed up my retail saves to usb. I installed a game using the retail disk and then copied my retail save to system storage from usb. I started the retail disc game until it got to the start screen. I used the ps4 save mounter and for every save directory your program found (including profiles) I replaced the retail keystone with my fpkg keystone. I then closed the retail game and deleted it from system storage. I installed fpkg for the same game and now my retail save works with my fpkg game! Now I can continue my game without the retail disk being in my drive!

For workaround games, I followed the workaround method with my retail save and backed up the decrypted temp folder to desktop and finished the workaround method. I then closed the retail game and deleted it from system storage. I also deleted the retail game save files from system storage also (they were backed up to usb). I installed fpkg for the same game and played the beginning of the game until I was sure the game had auto saved. I then followed the workaround method with my fpkg save until i was able to access the decrypted temp save files. I then replaced the memory.dat (for Last Guardian ) with the retail one i backed up to my computer earlier. I then went into the sce_sys folder and replaced the param.sfo file (for current trophy stats?) with the retail one then finished the workaround method. After closing the fpkg game and rebooting, my retail save works with my fpkg game now.

ChendoChap commented 5 years ago

trophy stats? param.sfo doesn't contain that afaik.

I'm not quite sure yet why some games load just fine while others do not. I added a rpc call logging option to a test build (launch the exe with -log as argument) but someone reported that those calls return 0x0 eventhough the save isn't found/mounted so this isn't really helpful. you can find the binary for this build in the comments of #5

Buzbee commented 5 years ago

sceSaveDataDirNameSearch ret = 0x809F0001 No saves found again. I like how your displaying the user id after clicking setup. Just like v1.2 I still sometimes have to click setup twice to receive "Status: Setup Done." I assume the mount option mounts read/write by default now since there is no read only option.

Wherever your searching for saves have it list all directories and files in the debug version log file. That way I can search for "rcps4". Your program may find the save file/dir but it may not be recognizing it as one.

ChendoChap commented 5 years ago

0x809F0001 occurs if the save data library hasn't been initialized yet. going in-game should initialize it but I'll add this to my to-do list for the next release

Buzbee commented 5 years ago

Is it possible the game only initializes the save library when it needs to auto save and deinitializes the save library when it is done saving?

In that case, could you keep polling to see if the save data library is initialized ( while we play the game until a save checkpoint and it does initialize) and then automount read/write)?

ChendoChap commented 5 years ago

it's possible although I can't think of any reason as to why they would do that. I know what I need to do but I just need to examine the behavior of initialization/termination functions, I'd like to avoid regressions.

EDIT: It seems that the initialization function returns 0x0 even if the library is already initialized. I haven't tested this on an actual ps4 yet but that's what I'm getting from the binary.

would you mind testing it for me? test if 0x809F0001 is fixed and if normal games still work, thank you test.zip

Buzbee commented 5 years ago

You did it! Ratchet and Clank works now. I also tested a normal game - Nathan Drake Collection and it seems to work just like before.

Are you going to work on why the setup button sometimes works after 1 click and other times it takes a second click. More often than not it takes two.

Also, last version had a grammical error "Mouting Failed" instead of mounting.

Now only if you get those games to work automatically that require the workaround method....

Here's a snippet on how Ps4 save wizard handles them:

"Then go into each CUSA and look for any files with an "sdimg_" prefix and remove it. IE: rename "sdimg_sce_sdmemory" to "sce_sdmemory". If you have a lot to rename I have used a windows program called Bulk Rename Utility (BRU) and it works really well.

Now your saves should be showing up in the Save Wizard. Expand each CUSA line to see the save files for each game. ..."

Full info here:

https://gbatemp.net/threads/how-to-restore-save-from-non-activated-ps4-to-an-activated-one.521580/

ChendoChap commented 5 years ago

I have no idea why the setup button is behaving like that, I've encountered the issue as well but I can't actively reproduce it.

Here's a snippet on how Ps4 save wizard handles them

that doesn't help in our case. I've tried to make sce_ saves mountable but I've only managed to make them show up as results mounting still fails.

mschumacher69 commented 5 years ago

How do you tell if the setup button worked or not? I don't always see the message "Setup complete", but I tried moving the saves of the 4 games that I played on my PS4 to my PS4 Pro and all 4 worked fine even though I didn't always see the "Setup complete" message after clicking on Setup.

ChendoChap commented 5 years ago

I'm an idiot... it's an easy fix

Buzbee commented 5 years ago

I really thought I was onto something.

"But a different folder is needed to "trick" the Save Wizard into signing the local save. Stripping the sdimg_ prefix (that the PS4 appears to place in front of all saves for a local account) allows the Save Wizard to "find" the file names that it expects."

By stripping "sdimg_" you will be left with 2 files (besides backups) a "sce_sdmemory" file with no extension and a sce_sdmemory.bin file.

So, after the pfsSKKey file and the encrypted save file matching, the PS4 save wizard was able to find and decrypt the save.

ChendoChap commented 5 years ago

that's irrelevant it's only slightly similar to the current workaround that already tricks the ps4. I'm currently trying to get it to work but I'm getting sick of debugging this ****

Buzbee commented 5 years ago

Have you tried automating the workaround method for sce_sdmemory saves?

Make backup of savedata.db Edit savedata.db and save Have user close game and then reopen it ( to use new savedata.db) etc.

ChendoChap commented 5 years ago

I'd rather avoid such a method, people generally don't like it when stuff messes with the fs.

ChendoChap commented 5 years ago

I've done some re and got some guy to test things for me. result: save mounter is now able to mount sce_ saves without using some workaround method, I'll update the repo later

Buzbee commented 5 years ago

Great! What was the secret? You can also filter out the elf files that are common to all games in the next version.

ChendoChap commented 5 years ago

I needed some patches in shellcore and ok I'll add it.

ChendoChap commented 5 years ago

could you try mounting this or any other sce_ save without the workaround on the latest version v1.4?

Buzbee commented 5 years ago

I tested it with the only workaround game I have - The Last Guardian. It worked successfully in the normal method now. However, I tried it with the new read only method by searching for cusa03627 and it finds the sce_save but when I press Transfer Mount it says T Mounting Failed. What exactly is Transfer Mount? Why would I want to open up the save read only?

Someone who tested your workaround method with all his sce_save games said he couldn't get resident Evil 4 to work with the workaround method. It would be nice if someone has that game to test it with v1.4.

ChendoChap commented 5 years ago

You use transfer mount when you want to mount some game's save but do not feel like installing the game itself, this is handy for people who regularly share a lot of saves with people. as they normally would need to find a save, resign it with save wizard & install the original game. with this method they only need to resign the save and just have 'a game' not the game the save would normally need.

Did you make sure to unmount the save when you tried mounting it with transfer mount? if you did start the program with '-log' as argument and send me the file. EDIT: the RE4 thing was fixed with v1.3.1 iirc

Leeful commented 5 years ago

I cannot get 1.4 to work with sce_ saves. I first tried with God Of War and I cannot get it overwite the save..

Everything looks as though it all went well but when you start the game again it is still the old save that is there and not the new one.

SaveMounter finds the game OK and appears to Mount and Unmount the save correctly. When you transfer the save file with FTP that also appears to have worked as it should.

The problem is when you close and reopen the game it is still the old save file.

I even tried it with The Last Guardian because that was reported here as working but I get the same results with that game too.

@Buzbee Did you actually load the game and test if the save was replaced correctly or did you just mount and unmount the save in SaveMounter to test it? because as I said earlier, it looks like it all worked OK in savemounter but when you restart the game it is still the old save.

As a last resort I tried this: Started the game, mounted the save, Replaced the old save with the new in FTP, unmounted the save. I then physically pulled the plug on my PS4 instead of exiting the game. (I thought that maybe the PS4 was saving the game just before it was exiting and overwriting the replaced save.)

When I restarted my PS4 and started the game it said the save was corrupt and that is was replacing it with one that was backed up on the system.

Any ideas?

Buzbee commented 5 years ago

I only tested:

SaveMounter finds the game OK and appears to Mount and Unmount the save correctly. When you transfer the save file with FTP that also appears to have worked as it should.

I only had the one save to transfer to and from via ftp so I just assumed it worked. I always use the options button and choose close application after closing out my ftp app.

ChendoChap commented 5 years ago

I might be able to change the mount permission of the new mount option to RW, that way we can test if it's due to the save already being in use. EDIT: someone tested a few games and told me gow is the only game not working, but he was able to get it to work by unplugging the ps4 which confirms that it's due the game overwriting the save with old data.

Buzbee commented 5 years ago

Leeful above stated that he got a corrupt save with gow by unplugging it. He also said it didn't work with the last guardian. Maybe he got a corrupt save with Last Guardian?

Leeful commented 5 years ago

I have found an easy workaround method that works by overwriting the encryped game save files without having the game running. It worked for both GOW and The Last Guardian.

This is what I did with God Of War:

Start GOW game and create a new 34MB save named 'sce_sdmemory2' with SaveMounter. Click on Search again to find the new 'sce_sdmemory2' save and Mount it. Copy over the memory.dat save file to the new save directory and unmount the save. Close Savemounter and exit GOW game.

Open your FTP client and go to the savedata directory for the game mine is: /user/home/196b354e/savedata/CUSA07410/ Inside are the following files: _sce_bu_sce_sdmemory.bin sce_sdmemory.bin sce_sdmemory2.bin sdimg_sce_bu_sce_sdmemory sdimg_sce_sdmemory sdimg_scesdmemory2

Then I deleted the old files: _sce_bu_sce_sdmemory.bin sce_sdmemory.bin sdimg_sce_bu_sce_sdmemory sdimg_scesdmemory

Then I renamed the new files: sce_sdmemory2.bin > sce_sdmemory.bin sdimg_sce_sdmemory2 >sdimg_sce_sdmemory

When I start GOW my new save file works :)

The last thing I did was to tidy up and delete the old save from the PS4 saved data management. In the saved data management for GOW it said there were 2 saves so I deleted the one with the older date and no picture.

ChendoChap commented 5 years ago

Latest version (v1.5) should make this a lot easier. It now mounts saves even if not a single game is running, this should stop the ps4 from overwriting parts of modified saves with old data (for games like gow, the ones using sce_ saves). Can you please confirm this? That way I can finally close this issue.

Leeful commented 5 years ago

I can confirm that v1.5 is now working with GOD OF WAR - CUSA07410 and The Last Guardian - CUSA03627. Thanks for fixing this.

The only issue I have now is that it is very difficult to find the game you are looking for. As you can see from the image below thr CUSA numbers are not in order. savemounter1 5

Could you make it automatically detect a game that is running like it did before. That way you do not have to know the CUSA for the game you want. You can always ask the user close the game before mounting and unmounting the save.

One other thing, is the built in ps4debug payload the same as the one used before? I only ask because I prefer to send the payload myself using my own Host menu. My host menu sends both the ps4debug and an ftp payload at the same time in just 1 click to save time.

In fact a great addition to Save Mounter would be to incorporate an FTP payload in to the debug payload and to have a built in FTP program inside Save Mounter so that you dont have to use another FTP program. I know it would be a lot of work but that would be amazing, what do you think?

Anyway, Thanks again for all the hard work you have put into making and updating Save Mounter.

ChendoChap commented 5 years ago

Yea no problem adding sorting isn't that hard, I literally didn't even notice it wasn't already.

eh I might be able to resolve those ids to title names but that depends on how it would affect performance... It's currently relatively fast but that could change if I had to add sce functions to it. I didn't really write that thing with that many games in mind, I literally only have like 6 games so my list is considerably shorter.

the payload is indeed the same one as before, it literally hasn't changed since initial release.

merging the payload shouldn't be too difficult but tbh I don't really feel like doing that.. also current ftp payload has a little problem, it stays in the browser (process-wise) this means that ftp cuts out if the browser crashes, which it does if you open menus like settings/trophies/... and adding a ftp client seems rather pointless since there are already a lot of good ftp client in existence and I don't think anything I would make could live up to those so don't get your hopes up.

I feel like there isn't that much left to do, since I can't really think of anything else that I could add that isn't 100% ux.