Author Topic: Backing up Sega CD SRAM  (Read 12000 times)

0 Members and 1 Guest are viewing this topic.

Offline Hatta

  • Newbie
  • *
  • Posts: 24
Backing up Sega CD SRAM
« on: March 21, 2010, 02:49:37 AM »
I am using madmonkey's neoMythProgrammer on 64 bit Debian. I have formatted the cart, and flashed ChillyWilly's menu 1.2b1, it seems to work fine.  I flashed Beyond Oasis to it, saved a game and was able to read back the .srm just fine. 

When I flash SCD_SRAM.bin to the cart, I get a warning:

Code: [Select]
   *** warning: sram(128KB) save detected for SCD_SRAM, but there is no more free sram

I'm guessing that the programmer doesn't know that the SCD_SRAM doesn't overlap with the cartridge SRAM.  The actual RAM function of the cart seems to work fine, I can format it and copy saves from my sega CD with no problem.  So we're doing great so far.

The part I'm having problems with is backing up the Sega CD SRAM.  When I select the SRAM in neoMythProgrammer I only see SRAM for Beyond Oasis.  There's no hint that the SRAM even exists. 

OK, now I clear the flash.  Just delete the Beyond Oasis ROM and SCD_SRAM.  I burn SCD_SRAM onto an empty cart.  The SRAM warning I mentioned above doesn't appear.  Now I can actually see the SRAM in the Programmer app.  However, when I try to backup the SRAM, I get these errors and no .srm file:

Code: [Select]
   ***   error: invalid read attempt in line 607 of ../../src/core/neocontrol.cpp

   ***   error: invalid read attempt in line 607 of ../../src/core/neocontrol.cpp

   ***   error: invalid read attempt in line 607 of ../../src/core/neocontrol.cpp

   ***   error: invalid read attempt in line 607 of ../../src/core/neocontrol.cpp

   ***   error: invalid read attempt in line 607 of ../../src/core/neocontrol.cpp

   ***   error: readbank(i) failed in line 158 of ../../src/core/neosram.cpp

   ***   error: sram.read(sramdata,bbank*bsize*save_block_size,rs) failed in line 697 of ../../src/core/neocart.cpp

So that looks like a bug.   I wanted to check whether I could read the SRAM with neocmd.  Using the -bs flag I get the same error as above.  using 'neocmd -iot sram -r scd.scm' I get a 1056kbit file.  I dunno if that's big enough to be the entire SRAM, but I'm guessing it's the cartridge SRAM, which I haven't had any problem reading.

Can this be done with the madmonkey's programmer right now?  Any advice would be helpful.

Offline madmonkey

  • Moderator
  • Full Member
  • *****
  • Posts: 178
Re: Backing up Sega CD SRAM
« Reply #1 on: March 21, 2010, 03:15:14 AM »
not right now.
the reason is that I'm unsure if every cart actually has 256KB of sram - hence it's set to 128KB, I'm aware that cd_sram is impossible to read in that case - but since nobody complained, and my cd unit is dead I didn't do anything :)
well, now I have a reason to do something.
I guess the simplest thing would be to raise sram size to 256KB - but then you will have to add cd_sram file first or as soon as possible, otherwise it won't work.
that can be done in under 5 minutes, so that be it probably.
what's the command you're using that gives invalid read attempts? that shouldn't happen actually, so it's a bug.

ah, some carts already set to 256KB, so i'll also need your cartid - neocmd -id option.
which version of the app you're using? cartid is a bit version-dependent.
« Last Edit: March 21, 2010, 03:17:36 AM by madmonkey »

Offline Hatta

  • Newbie
  • *
  • Posts: 24
Re: Backing up Sega CD SRAM
« Reply #2 on: March 21, 2010, 04:24:16 AM »
Glad to hear it's a known limitation at least.


what's the command you're using that gives invalid read attempts? that shouldn't happen actually, so it's a bug.

Either using the 'backup sram' button in the GUI or './neocmd -bs SCD_SRAM' on the CLI.



Quote
ah, some carts already set to 256KB, so i'll also need your cartid - neocmd -id option.
which version of the app you're using? cartid is a bit version-dependent.

I'm using neotest_v07linux.  Is that the most recent version?  I've attached the cartid.bin
Thanks for the help!

Offline Hatta

  • Newbie
  • *
  • Posts: 24
Re: Backing up Sega CD SRAM
« Reply #3 on: March 21, 2010, 04:45:00 AM »
Also, how do SMS saves work?  I can run Phantasy Star and save and load just fine.  But there's no entry for Phantasy Star in the sram.   The menu doesn't seem to be allocating any for it either. 

Offline madmonkey

  • Moderator
  • Full Member
  • *****
  • Posts: 178
Re: Backing up Sega CD SRAM
« Reply #4 on: March 21, 2010, 05:00:25 AM »
here's the latest version - I also changed sram size to 256KB for all carts, so it will work, but only if you add cd_sram file first(delete file and add again if it's already there).
but,
>>'neocmd -iot sram -r scd.scm' I get a 1056kbit file.
you should get 1024kbit file in this case - I checked on 32bit winxp and it works.
you're using 64bit linux? were there any errors when you compiled it? if so, how they were resolved?

actually, I changed DWORD definition a bit, so try new version first, and if it works, above probably doesn't matter.


sms roms should work just like md roms - the key word "should".
I checked with phantasy star and it works, but save detection works by calculating md5 of the rom - there is no data in the rom itself to tell whether rom uses sram or not.
some sms roms might not be detected due to that, but not phantasy star.
can you send the rom(and where you got it)?
« Last Edit: March 21, 2010, 06:46:30 AM by madmonkey »

Offline Hatta

  • Newbie
  • *
  • Posts: 24
Re: Backing up Sega CD SRAM
« Reply #5 on: March 21, 2010, 06:14:05 AM »
Ok, I compiled the new version of neocmd, there were no errors.  Here's what I get:
Code: [Select]
hatta@iblis:~/projects/MythMD/madmonkey/wip/bin$ ./neocmd -bs SCD_SRAM


menu size: 02MB
sram size: 256KB
flash size: 64MB


0001 SCD_SRAM
type=0, run=9, bbank=01, bsize=0016, offset=0x00000000, size=02MB

 free space: 62MB



used flash space: 02MB
bad blocks: 01MB 128KB
free flash space: 60MB 896KB
space saved: 00B



   ***   error: invalid read attempt in line 607 of /home/hatta/projects/MythMD/madmonkey/wip/build/console/../../src/core/neocontrol.cpp

   ***   error: invalid read attempt in line 607 of /home/hatta/projects/MythMD/madmonkey/wip/build/console/../../src/core/neocontrol.cpp

   ***   error: invalid read attempt in line 607 of /home/hatta/projects/MythMD/madmonkey/wip/build/console/../../src/core/neocontrol.cpp

   ***   error: invalid read attempt in line 607 of /home/hatta/projects/MythMD/madmonkey/wip/build/console/../../src/core/neocontrol.cpp

   ***   error: invalid read attempt in line 607 of /home/hatta/projects/MythMD/madmonkey/wip/build/console/../../src/core/neocontrol.cpp

   ***   error: readbank(i) failed in line 159 of /home/hatta/projects/MythMD/madmonkey/wip/build/console/../../src/core/neosram.cpp

   ***   error: sram.read(sramdata,bbank*bsize*save_block_size,rs) failed in line 872 of /home/hatta/projects/MythMD/madmonkey/wip/build/console/../../src/core/neocart.cpp
no rom found: SCD_SRAM
end

Raw IO does give a file of the expected size.  256K.  I'll play some more with the SMS stuff and see if I can figure it out myself. 

Offline madmonkey

  • Moderator
  • Full Member
  • *****
  • Posts: 178
Re: Backing up Sega CD SRAM
« Reply #6 on: March 21, 2010, 06:28:28 AM »
that's really strange, it works on 32bit machine.
probably some stupid mistake on my part :)
if you mange to get it to work, be sure to post your changes, at the moment I don't have any x64 systems to test this stuff.

wait, I think I found it
please try this version
« Last Edit: March 21, 2010, 06:48:04 AM by madmonkey »

Offline Hatta

  • Newbie
  • *
  • Posts: 24
Re: Backing up Sega CD SRAM
« Reply #7 on: March 21, 2010, 07:41:11 AM »
'neocmd -bs SCD_SRAM' appears to work.  I get a 1mbit SCD_SRAM.srm file.  However, I can't write it back to the cart. 
'neocmd -s SCD_SRAM.srm' just tells me "no rom loaded: -s SCD_SRAM.srm" Am I calling it incorrectly?

Also I noticed another issue when I tried my cart on a couple 32bit machines I have here.  Neither was able to detect
the cart. Linux definitely detected it, it showed up in dmesg.  But on running 'neocmd' I just got "device is not connected"
Those were pretty old machines, maybe USB1 is the problem there.  Not a big issue right now as it's working on my
desktop, but I'd like to be able to program the cart from my laptop.   Any thoughts on that?

Offline madmonkey

  • Moderator
  • Full Member
  • *****
  • Posts: 178
Re: Backing up Sega CD SRAM
« Reply #8 on: March 21, 2010, 08:17:17 AM »
there is no option in the console app right now to load just the sram file, if you write rom and then sram file, it will work.
you can load sram file from the gui without any problems though.
btw, does this file work on emulators? it's dumped as-is, some preprocessing might be required(but probably not).

are you running the app as root on those machines? that might be permissions thing.
you don't have to run as root, if you set up permissions correctly.

Offline Hatta

  • Newbie
  • *
  • Posts: 24
Re: Backing up Sega CD SRAM
« Reply #9 on: March 21, 2010, 08:56:57 AM »
Aha! I deleted SCD_SRAM and wrote it back with 'neocmd SCD_SRAM.bin -s SCD_SRAM.srm'  This worked perfectly. 
Thank you so much for your help.  One more question, how do compile the GUI?

As for emulators, yes!  I moved SCD_SRAM.srm to SCD_SRAM.crm and it worked in Kega Fusion no problem.

And yes, a quick sudo fixed my problems on the other machines.  I should have thought of that myself.
But anyway I'm excited, this works really well now.  Thanks!

Offline madmonkey

  • Moderator
  • Full Member
  • *****
  • Posts: 178
Re: Backing up Sega CD SRAM
« Reply #10 on: March 21, 2010, 09:01:41 AM »
in linux it's very simple, unlike in windows.
apt-get install libusb-dev libqt4-dev qt4-dev-tools
cd build/gui
qmake && make
thats all :)

Offline ChillyWilly

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1753
  • Just a coding machine.
Re: Backing up Sega CD SRAM
« Reply #11 on: March 22, 2010, 03:13:22 AM »
In linux, you may have to do "sudo neocmd" to give it access rights to the cart. I have to do that in xubuntu.

SMS sram is handled the same way as MD sram - you set the sram bank size and the sram bank number. You should have no trouble making PSIV shared the sram with MD games. Just make sure it's set for its own bank.

Offline madmonkey

  • Moderator
  • Full Member
  • *****
  • Posts: 178
Re: Backing up Sega CD SRAM
« Reply #12 on: March 22, 2010, 03:22:03 AM »
you don't have to run sudo every time

groupadd neomyth
gpasswd -a <username> neomyth
gedit /etc/udev/rules.d/neomyth.rules
----------------------------------------------------------------------------
#neomyth device
SUBSYSTEM=="usb", ATTRS{idVendor}=="ffab", ATTRS{idProduct}=="dd03", MODE="0664", GROUP="neomyth"
----------------------------------------------------------------------------

SUBSYSTEM=="usb" might be SUBSYSTEM=="usb_device", seems to be udev version dependent.
logoff-logon for group membership to come into effect, replug cart to reset permissions.

that might not work in all distros, but should work in xubuntu at least, since it's based on debian.
for other distros steps might be slightly different.

Offline ChillyWilly

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1753
  • Just a coding machine.
Re: Backing up Sega CD SRAM
« Reply #13 on: March 24, 2010, 12:57:50 PM »
Uhhhh - it's easier to just add sudo in front.  ~sm-82.gif~.gif