Pseudo Saturn Kai 6.074 released !
Written by cafealpha 2 comments

The release was initially announced on SegaXtreme forums, because it is my favorite forums for Saturn things (more than 11 years I registered to it !
Big thanks to the forum moderation/maintenance/support team for their steady good work


So since I'm a lazy person, let's slightly arrange this article from what I wrote on SegaXtreme forums !
What's new in this version ? Well, there's basically, not a lot of major features (sorry !), but fix of a critical bug affecting Gamer's Cartridge, and addition of some "minor, but that I wanted to add someday" features.
______________
Features for Gamer's Cartridge users
Indirect Dump : Dump cartridge (boot cartridge, or official memory cartridge, or any other cartridge) by compressing its contents to internal backup memory, and then extracting it to SD card when Gamer's Cartridge is inserted.
Because of small size of internal backup memory, it may be required to repeat the "insert memory cartridge → Indirect Dump → Turn off Saturn → Insert Gamer's Cartridge → Indirect Dump → Turn off Saturn" cycle several times, but at the end cartridge is dumped

Requires some motivation and free time on user side (It took me 45 minutes in order to dump my good old very first official memory cartridge), but this way of dumping doesn't requires to unsolder cartridge memory chips, which is the most important for me !
Note : if you are the lucky owner of Saturn FDD, then floppy disc is used instead of internal backup memory, and consequently dump is significantly faster and simpler.
Left : Screen display after compressing dump data
to internal backup memory
Right : Screen display after writing dump data from
internal backup memory to SD card
Theses pictures were taken on Indirect Dump's first successful test
to internal backup memory
Right : Screen display after writing dump data from
internal backup memory to SD card
Theses pictures were taken on Indirect Dump's first successful test

One extra application of this feature was to dump ROMs from legacy cartridges such as X-Terminator, Satellite, ST Key and "8MEG memory cartridge". Curious people wanting to test theses cartridges theses ROMs can found them available for flashing (at your own risks) in Pseudo Saturn Kai Save Data Manager.
Special thanks to A Murder Of Crows, AtariBorn and SaturnGuru who dumped their cartridges ... and reported many bugs from early versions of Indirect Dump feature



Indirect Dump development : the cut scenes

Left : dump data corruption (see below for details)
Right : Dump file CRC check error. Fortunately, only dump
computation routine was buggy, and dump feature itself was working

Save Data corruption bugfix : This corruption problem concerns saves on Saturn internal memory, with save data size making save sector allocation table finishing exactly at the end of a sector. Very few games are concerned, and the only example I could find so far is Albert Odyssey.
I found this problem when testing Indirect Dump : data compressed then written to internal save memory wasn't then correctly read and decompressed to SD card.
I initially thought this problem to be caused by Indirect Dump itself, because at the time I had this problem, I just finished to mess with data alignment error when preparing indirect dump's compressed data, so thought that this was the next bug to fix regarding Indirect Dump

Quick investigation showed that contents of read data wasn't as expected, with a small portion of data being same as data at unrelated offset ... so maybe a problem when compressing and adding header etc to Indirect Dump save data ? It took me then a around one hour of testing and code review until I was sure that culprit was actually not Indirect Dump itself, because re-read of save data didn't matched with written save data !
Then, testing Indirect Dump with same input data and virtual memory cartridge disabled worked as expected, which 99% confirmed that problem was located on virtual memory cartridge side !
So yes, "virtual memory cartridge" actually manages save data handling for all backup devices (internal save memory, memory cartridge, and even Saturn FDD too) : this is possible because Gamer's Cartridge hooks Saturn backup library at relatively high software level.
In comparison with 1:1 hardware emulation of save memory cartridge, this has the advantage of being free of capacity limitation inherent to memory cartridge's chips, and also allows to store save data individually on SD card (two files per save, vs big file containing all saves for 1:1 cartridge emulation). On the other side, all the save data handling software has to be re-written, so care has to be taken when re-implementing it

So, this is quite an uncomfortable bug I have to face : save data are corrupted when being written to internal save memory, and Gamer's Cartridge was released around 6 months before, with consequently cartridges potentially corrupting save data in the wild.
Fortunately, while being hard to find, the bug wasn't hard to fix


Internal Save Data corruption related source code
Left : before fix
Right : after fix
Left : before fix
Right : after fix
Since I really didn't want to fix half of the bug (and having to fix the remaining half on other release), next step is to add a test bench tool for internal save data memory access !
"Test bench" is a program that automatically tests a lot of patterns for a given function or module. Ideally, all major modules should have their test bench, but in the real world, making test bench programs takes time, so programs are usually manually tested with 2 or 3 patterns, and then developer prays for all other patterns being bug-free

... And to tell you the truth, this test bench was the largest one I wrote so far


Here is how test bench screen looks like on my dev environment :
SatLink and Yabause couple showing test bench screen.
SatLink and Yabause : my best friends when testing Saturn programs
SatLink and Yabause : my best friends when testing Saturn programs

Screen copy above was taken after fixing internal save data support, and I forgot to take a similar screen copy when bug wasn't yet fixed ... latest Save Data Manager CDROM's + Gamer's Cartridge with firmwave 6.037 should display error in test bench screen, so it would be funny to try it ... maybe someday

BTW, Test Bench is still available in Save Data Manager CD-ROM (it took me a bit of time to add test bench screen, so didn't wanted to remove it after fixing internal save data corruption bug !), but this test bench screen requires a trick in order to be accessed : did you found it ?

That's all about internal save data corruption : I fixed it, and checked a lot of patterns about internal save data access, so similar problem shouldn't happen in the future !
Additionally, I didn't received any feedback from users about this bug, so let's hope it didn't corrupted game saves elsewhere than on my dev laptop

Autodump : Automatically dump saves from internal backup memory to SD card, so that they can be restored in the case they are lost because of depleted CR2032 battery, or save data manipulation error, etc.
With this feature, you won't have to say anymore "I lost all my saves because of that $%QTY@!#% CR2032 battery"

Since this feature uses SD card, it is available on Gamer's Cartridge only. And no, I won't write save data into Action Replay's cartridge flash ROM : flash ROM chips are not designed in order to be written frequently, hence using flash ROM as read/write storage area may prematurely brick your Action Replay cartridge.
If you're not convinced about flash ROM limited write cycles, I can make some "cartridge self destruction" feature that would continuously write and erase random data to flash ROM, but don't claim that your cartridge no longer boots after that

An alternate solution in order to keep internal save data change the chip holding internal save memory to a FRAM one that doesn't requires battery to retain saves data, as detailed in db-electronics.ca.
(there are maybe other alternate solutions, so please let me know in the comments if I missed one)
The advantage of this FRAM mod is that saves are not lost when CR2032 battery is depleted. There are however several disadvantages :
- This is an hardware mod, which requires to remove a chip, then solder another one, hence quite difficult to do.
- CR2032 battery is still required in order to keep clock and language informations.
For being the developer of Pseudo Saturn Kai and Gamer's Cartridge, my opinion is a bit biased, but autodump is a better solution, because autodump is not an invasive mod (plug cartridge vs change chip on Saturn motherboard), and the FRAM solution doesn't allows to dump save data to modern media device. Anyway, I don't force you to like my projects, so if you don't like autodump, then don't use it

Virtual Floppy Disk Drive. Simulate Saturn Floppy Disc Drive (FDD) behavior, with save data stored on SD card.
This feature Worked fine with Dezaemon 2, which can now handle 10 saves at once (5 saves from cartridge, and 5 other saves on FDD

This is a feature available on Gamer's Cartridge only too. Thanks to this feature, floppy disk access is available without having to plug any floppy disk drive to Saturn

______________
Features for Action Replay and Gamer's Cartridge users
Proper support of FDD in Save Data Manager : Save Data Manager now supports both two partitions of Saturn floppy discs for all common operations such as copy, move, delete, import, dump, etc.Special thanks to Dezaemon DB for big assistance in beta testing


Backup devices informations from Save Data Manager :
First device is internal backup memory : the easiest to handle

Second device is backup memory cartridge,
unconnected (zero partitions detected) in this picture
Third device is FDD : two partitions, wrong unit ID returned,
and always set at third position in devices information
array, even when cartridge is not available.
Basically, FDD is a real trouble-maker when trying to handle backup devices


Save Data Manager development cut scenes : trying to format FDD

(format for both two partitions is displayed in a single picture)
Don't worry about the horrible display of error
messages : it's (finally) improved in version 6.074

Soft Reset Patch : Change the "A+B+C+Start key combo" soft reset from "exit to multiplayer screen" to system reset. This idea is not from me, but from neuroacid (rmenu developer).
More saves to import from Save Data Manager. The most noticeable addition is saves from Urawaza Dataro cartridge, containing quality saves for Japanese games. Special thanks to Madroms for dumping the cartridge, and providing me its dump file

Other : Fixed many bugs, and added other bugs ... the usual routine

(Not a software feature, but) future users of Gamer's Cartridge may appreciate the couple of new labels, designed by beebaraka-sensei (twitter) for artwork itself and Dezaemon DB (twitter) for the final editing of the labels. Many thanks to them for the very good work !
Dezaemon-themed labels ... could you find out the odd label ? 

The design on theses labels is themed on Dezaemon 2, and as you can see, the Dezaemon character on the game cover grew in the right way

I personally do appreciate the white themed one

Before being asked "where are the cheat codes ?", please let me reply :)
Update three months after writing the explanation above : cheat codes on Pseudo Saturn Kai are working on few games !!

There are many things remaining until reaching an "OK to release" state, but at least the cheat codes core feature seems to work, which is quite a relief for me :)
By the way, there's a trick cheat codes selection menu in Pseudo Saturn Kai 6.074 : did you found it ? It won't do anything else than showing games list and cheats for each games, so it's not worth spending more than 10 minutes in looking for the appropriates key(s) combo and timing however.
Yes, this release have (at least) two Easter eggs available


Apart from cheat codes, there are many other things scheduled for future releases : I initially planned to release everything at once, but had to make this intermediary release in order to fix the save data corruption bug on Gamer's Cartridge, so stay tuned

PS : Special thanks to Stac for beta testing
