slinga-homebrew / Save-Game-Copier

Copy Sega Saturn save game files
GNU General Public License v3.0
50 stars 9 forks source link

SGC does not backup save file COMMENTS. It replaces them with SGC. Backing up comments is VITAL! #21

Closed GameSack closed 3 years ago

GameSack commented 3 years ago

I've noticed that SGC ignores comments. Not only do those comments help identify what the save data is for, but many games use it. For example, on Sim City 2000, the name of my city was changed from JoeVille to SGC. In Policenauts, the comments are used to tell the game and the player the chapter and amount of time as been played up to that point. Now when I try to load a game, all of my 10 save files say SGC. As a result, the game thinks that each save file is the same. despite me having plenty of saves in disc 1 and 2, the game always asks me to insert disc 3 no matter which one I select. Kind of game breaking.

Again, the comments are vital and absolutely essential. Very, very, VERY important!

slinga-homebrew commented 3 years ago

This is a dupe of this issue: https://github.com/slinga-homebrew/Save-Game-Copier/issues/1.

RevQuixo commented 3 years ago

I'm not sure this is a duplicate or not. Issue #1 talks about displaying within SGC. What we are talking about is what is displayed within a game. the comments section is used within certain games to identify save information (see attached). Stripping it out renders the saves basically unidentifiable in game. policenauts

I think the ideal would be SGC displays what is displayed in the internal memory but behind the scenes copies all the attributes of a save file. If a save of the same name exists (even with a different checksum) the program would either automatically overwrite or at the very least warn you that a file already exists with the same name).

slinga-homebrew commented 3 years ago

Understood. It will be a significant change. I'm not ruling it out but it's a lot to do for two games.

RevQuixo commented 3 years ago

I'd surprised if it ends up only being two games. (That would be the best case scenario). I'll report back if/when others come to light.

slinga-homebrew commented 3 years ago

Sure that sounds reasonable.

amerika13 commented 3 years ago

I went through a giant list of saves on my Saturn today and over half of them had comments that pertained to where the player was and in some cases what disc. So it's definitely than just two games that has information a player would need if they had more than one save. It's definitely something that should be changed if possible as it also limits players wanting to trade saves and knowing what they are in a list. Or for speed runners with a big list of saves to learn certain sections of games.

RevQuixo commented 3 years ago

@amerika13 Well I guess the question is whether the comments affect anything "in game" or if they are just comments used when viewing the files in the memory manager. The former is a critical thing (such as policenauts) since you can't identify saves in-game the latter is still important in keeping a file repository but at least doesn't break the gameplay experience. Both are important of course, just in varying degrees. :)

amerika13 commented 3 years ago

That's what I thought I specified above. I restored my original saves on my JP saturn and there were nearly 20 of them on it. Many had identifitying information about the save in the comments section which surprised me as I did not grow up with the Saturn. Information you would need in order to select the correct save for your location in a game (either actual name of location or time stamp).

johannes-fetz commented 3 years ago

@slinga-homebrew I will add a method in the JoEngine to retrieve the comment associated with the backup. jo_backup_save_file_contents () already allows to save it.

johannes-fetz commented 3 years ago

@slinga-homebrew https://github.com/johannes-fetz/joengine/commit/e9acdb0c742945d3fc8b14d4f037b02c99c2e7bc char * comment = jo_backup_load_file_comment(dev, "DEMO.BKP"); jo_free(comment);

johannes-fetz commented 3 years ago

@GameSack Are you guys behind Game Sack channel on Youtube ? https://www.youtube.com/channel/UCT6LaAC9VckZYJUzutUW3PQ

RevQuixo commented 3 years ago

@GameSack Are you guys behind Game Sack channel on Youtube ? https://www.youtube.com/channel/UCT6LaAC9VckZYJUzutUW3PQ

It is Joe from Gamesack. He asked in the TerraOnion discord about the comments functionality and we sent him here. :)

johannes-fetz commented 3 years ago

Ok, because I like this channel 😄 I follow them from many years

slinga-homebrew commented 3 years ago

This ticket is on my list to work on. It's just going to be a lot of code.

RevQuixo commented 3 years ago

Just adding to this ticket I moved a Grandia save back to internal memory with save Game Copier and the game does not recognize it. Guessing it is comments related.

slinga-homebrew commented 3 years ago

I have a very early alpha build available: https://github.com/slinga-homebrew/Save-Game-Copier/releases/tag/3.4.0.

I need testing on Satiator: @emeraldNova @abrasive and MODE: @RevQuixo @terraonion-dev

I haven't uploaded the source yet, will clean up and post shortly. Please backup your saves before using.

The change in this version is that SGC now works only on .BUP files. The .BUP file is a 64-byte save game metadata header that sits in front of the raw save. This way we can retain the comment, date, language, etc. Of the saves.

amerika13 commented 3 years ago

I tried out the 3.4.0 Alpha and I was able to copy saves from the Saturn to the SD card file system within the SATSAVES folder. I can see the new .BUP files that I made. However, when I go to the MODE menu option within SGC I get an error stating, "Found 0 saves on the device". So SGC is not reading the old saves nor the new .BUP saves @slinga-homebrew

I mentioned this to Neodev and he thought it might be some error in the list processing.

RevQuixo commented 3 years ago

Expanding on @amerika13 . I emptied the satsaves folder on Mode and copied over a couple of clean saves (not previously moved by SGC. They moved successfully, but in the absence of any older style saves, SGC just black screens, so there does appear to be a read issue on the MODE side for BUP files. Also, when copying an cartridge save to internal memory using SGC it doesn't recognize the Japanese character set properly. See attached. Blue was original, red was moved to internal via SGC.

slinga-homebrew commented 3 years ago

Thank you for the quick feedback. I found a few issues which I fixed: https://github.com/slinga-homebrew/Save-Game-Copier/releases/tag/3.4.1. I also added a debug print at the bottom of the screen that prints the save name and filename to help debug what's going on. I also checked in the the source code.

Regarding the Japanese comments I'm stumped. I figure the print routines I'm using don't handle Japanese but not sure why it would prevent the comments from transferring over. In my testing all of the English comments seem to be transferring just fine.

amerika13 commented 3 years ago

Thank you for the quick feedback. I found a few issues which I fixed: https://github.com/slinga-homebrew/Save-Game-Copier/releases/tag/3.4.1. I also added a debug print at the bottom of the screen that prints the save name and filename to help debug what's going on. I also checked in the the source code.

Regarding the Japanese comments I'm stumped. I figure the print routines I'm using don't handle Japanese but not sure why it would prevent the comments from transferring over. In my testing all of the English comments seem to be transferring just fine.

Is there a library you're using for the transfer that is ASCI only and not UTF-8 (or similar)?

slinga-homebrew commented 3 years ago

Saturn uses Shift-Jis encoding. I am using strncpy() to copy the comment fields. Dunno why it would break on Shift-jis (unless there are NULLs embedded).

RevQuixo commented 3 years ago

So 3.4.1 still has teh messed up text in the internal memory screen of teh Saturn for Grandia, but the game does recognize the save which it wasn't doing before. Interestingly the comment section in SGC shows a blank for the comments for the saves too..so maybe because SGC isn't reading it properly it isn't passing it down fully.

Unfortunately MODE is still broken. It opens the Mode menu, shows MODE at the top for 2-3 seconds and then the program black screens and I have to restart the Saturn.

slinga-homebrew commented 3 years ago

I put some more logging in: https://github.com/slinga-homebrew/Save-Game-Copier/releases/tag/3.4.2.

Not sure what I'm doing wrong. I think Terraonion will have to take a look at my source. Hard to debug without a MODE.

RevQuixo commented 3 years ago

Neodev thinks it is related to SGC trying to both list and read the contents of the saves simultaneously. He built me a test iso that stopped the crashing but only ends up with one file in MODE listed...he's on the case though, might have a solution in a day or two.

slinga-homebrew commented 3 years ago

Here's yet another alpha: https://github.com/slinga-homebrew/Save-Game-Copier/releases/tag/3.4.3.

RevQuixo commented 3 years ago

Get a bunch of warning messages and failures. neodev figured out a fix and he is submitting it soon.

amerika13 commented 3 years ago

Yeah, Rev and I both tested Neodev's fix and it appears to work. One side effect of the fix, however, is that only the .bup files are now seen when viewing using the MODE option. I had probably 50+ saves in my directory but only the 3 BUP files were seen.

amerika13 commented 3 years ago

Also, Japanese text is still producing garbage in the comments section according to Rev.

slinga-homebrew commented 3 years ago

I only support .BUP files now. I'll take a look at the Japanese text.

slinga-homebrew commented 3 years ago

I figured out the issue with the Japanese comment. I need to change the language of the save game. Jo Engine uses the language of the system and the system's current date. Once I changed the language to Japanese the comments were rendering correct.

Again this is in the Saturn BIOS, in SGC it still displays as blank but is being copied over correctly.

slinga-homebrew commented 3 years ago

Alpha for MODE support (from Terraonion) and fix for Japanese comment issue: https://github.com/slinga-homebrew/Save-Game-Copier/releases/tag/3.4.4

Again SGC won't show the Japanese comments (they will appear blank) but when you view in the Saturn BIOS they should now be correct.

amerika13 commented 3 years ago

I just tested this and I do not see the file that I saved from the MODE menu. I went and made a new save for JP Symphony of the Night which has JP comments. I can see it on internal memory and cart, and it looks like it copies to MODE internal but when I choose the mode menu to view a list of saves, I only see one Save file. And I should have 4 total now.

The issue Neodev fixed was the inability to see all the saves from the MODE menu. Did his code get merged in?

I was able to copy from my Cart to Internal using SGC and when I rebooted to check, the comment was preserved, however. I think before the comment would have been changed to SGC in that use case.

slinga-homebrew commented 3 years ago

Is the file extension .BUP? And yes I merged Terraonion's PR.

amerika13 commented 3 years ago

Yeah, it is. The only save that will show in the list right now is the Policenauts .BUP save.

image

slinga-homebrew commented 3 years ago

Here's some more logging: https://github.com/slinga-homebrew/Save-Game-Copier/releases/tag/3.4.5.

We can see what count says and if any of the error conditions hit.

amerika13 commented 3 years ago

I tried out the debug build and I was getting errors on every file that was in my folder regardless of them being .BUP files or not. So you might want error handling and a message telling people to delete their old saves as they are no longer supported.

I went ahead and deleted the old saves and I was still getting errors. I got the Jo engine messages listed below and then it took me to the list screen. Let me know if you need me to do anything different.

image image image

slinga-homebrew commented 3 years ago

I don't understand why it's listing only 1 file. I think Terraonion might need to take a look. You have 4 .BUP files there correct?

slinga-homebrew commented 3 years ago

Here's even more logging: https://github.com/slinga-homebrew/Save-Game-Copier/releases/tag/3.4.6.

I'm heading off to sleep, will take a look tomorrow.

Thanks again for all of the debugging.

amerika13 commented 3 years ago

Ok, so what happens with 3.4.6 is I get an Jo Engine error that says it sees 4 files (and I have 4 saves. Then it gives me another error stating that it can only see Policenauts and 1 file and then proceeds to give me the MODE list with only Policenauts in it.

Neodev (TO) wondered if the merge might have had issues with his earlier fix since this is the issue he fixed with his code.

image

amerika13 commented 3 years ago

Oh, I was able to test your JP Comments fix despite the listing error with MODE. I deleted all of my non Symphony of the Night saves and I then copied that save file from MODE over to my internal RAM and worked perfectly with characters displayed as they should in the Saturn save menu. image

amerika13 commented 3 years ago

I spoke to Neodev and he looked at your recent merge and he said it got a bit messed up and that code was duplicated. He is going to make another PR with his changes. He pulled down your recent code and had me test an image and it was able to display the list of saves.

image

slinga-homebrew commented 3 years ago

Sorry about that, I applied the new MODE PR. There was an update to Jo Engine regarding save game files, I'll test it out and create a new release tonight with everything in it. I think we're getting close.

slinga-homebrew commented 3 years ago

Here's the build with everything integrated: https://github.com/slinga-homebrew/Save-Game-Copier/releases/tag/3.4.8. I think this will work now.

amerika13 commented 3 years ago

@slinga-homebrew It looks like we are near/at the end of the road for this!

SGC properly lists saves copied from both internal and cartridge memory within the MODE menu. SGC saves the comments on transfer as they are supposed to be. I made a ton of Policenauts saves that puts a time stamp on the save and what Act you're in and those are all working. SGC saves Japanese text correctly now (tested with Symphony of the Night saves). All saves that have been transferred between internal, cart ram and MODE file system all work correctly and the MD5 checksum was consistent on copies back to MODE file system.

I also tried to break SGC by trying to copy more data to the internal RAM than it allows. JO engine gives an error and allows you to press Start to go back to the menu. So that is handled gracefully.

Things I have not tested yet: Paging functionality if you have like 50+ saves Alpha/numeric ordering of those saves. This does appear to work as the 7 or so saves I have right now are all in order, but I would want more than that to say that it's 100% working. What happens if the ram cart is full and you tried to copy more data to it. I believe JO Engine will issue the same error as when trying this with internal RAM, but I do not have enough saves to validate this right now. I have not tested any PAL saves. Specifically alternate languages like French or Spanish.

amerika13 commented 3 years ago

One last request? Is there anyway for JP text or non-english text to be shown in the SGC menu? I do not see this as a big issue, as it's just visual since the text is being recorded properly and can be seen on the Saturn, but if it could be displayed that would be preferable. Especially for anybody in the Japanese reading community.

I feel like resolving that or at least stating in the README that it can't be done (if it can't) would be a great way to button this all up.

And thanks again for all the effort you have put into this. With ODE's getting to be a lot easier to come by per console, being able to transfer saves among the community is amazing. People who just want to get to where they used to be with an old save, speed runners wanting to quickly get others setup with saves, content creators who quickly want to get some B-Roll footage later in a game they have never played etc. There are tons of reasons why this is pretty amazing so I just wanted to say thank you so much.

slinga-homebrew commented 3 years ago

Paging should work. I tested with a bunch of saves on the CD at some point. I also don't anticipate any issue with sorting as I'm using a builtin sort lib. But more testing is always welcome.

Regarding the non-English text, I'm using jo_printf() which I don't think supports non-English characters. I'll look into how to do it but it might be complicated. I agree I should document it in the readme for the time being.

I'm going to close the ticket, feel free to re-open if you run into issues. And thanks again for your debugging help.