Homebrew CTR-GCS 0.3 : Finally, transfer F-zero savegames!

  • Thread starter Thread starter suloku
  • Start date Start date
  • Views Views 24,604
  • Replies Replies 138
  • Likes Likes 1
Maybe it is related to tueidj's modifications, I'm trying to use dacotaco's 0.2b but I still haven't been able to mount the official card (even using the system menu trick :S)
 
is it really corrupted?

While hacking around I once stumpled upon a similar issue. Every time after restoring, the games showed 'format MC, broken bla bla'.

re-plugging the memorycard 'fixed the issue'. It seemed there's just been something wrong in the way I accessed the MC (or the way I left it).
Maybe you got a different issue, but it's worth a try, I'd say.
 
That's depressing to read, I tested with an unoficial card. Well, at least we can copy the savegame to any unoficial card.

Then changing the hader of an official card will only break the card and there's no software solution for that? If that's so, we are again at the point of needing to change the ID in the savegame itself...

Do you know how to get the real flash ID from the header scrambled one?
Unscrambling the flash id from the header is simply the opposite of what happens when the card is formatted (since that's when the header is written), you just need to subtract the "random" value instead of adding it. This is the code that Devolution uses to find the flash id of emulated cards (which it then puts in the sram):
Code:
	int i;
volatile int read_done = 0;
union
{
struct
{
uint32_t serial[3];
uint64_t time;
} __attribute__((packed));
uint8_t data[MCARD_READ_SIZE]; // size of one memory card sector
} header __attribute__((aligned(32)));
uint64_t rand;
// read sector 0
read_memcard_sector(0, header.data, (ipccallback)sync_read, (void*)&read_done);
// wait for the read to finish
while (!read_done)
msleep(1);

// rand() taken from K&R, lol
rand = header.time; // seed

for (i=0; i < 12; i++)
{
rand = (rand * 1103515245 + 12345) >> 16;
header.data[i] -= rand;
rand = ((uint32_t)rand * 1103515245 + 12345) >> 16;
rand &= 0x7FFF;
}
// 12 bytes of Flash ID
memcard_serial[0] = header.serial[0];
memcard_serial[1] = header.serial[1];
memcard_serial[2] = header.serial[2];
The three u32 flash id values should be the same as the key[0], key[1] and key[2] values that are calculated inside libogc's __dounlock() function.
What you could do as a workaround to make official cards work with modified headers is unlock the card before playing the game, then write the flash id from the header to the sram (instead of the actual flash id), then start the game (so the card stays unlocked). Since the game compares the descrambled header flash id with the sram it should work.
That sounds interesting, however...

I tried to follow this tutorial in order to copy my F-Zero GX from an unofficial memory card (1019 blocks) to an official one (251 blocks).
Thanks to suloku tools I managed to create a raw image with all my savegames from the 251 official, I changed its ID and then added my F-Zero GX savegame. Dolphin reads it correctly, but it's impossible to restore it to my 251 official using ctr-gcs (no matter what version I use, tueidj's or suloku's). It's always corrupted after restoring it.

At first I thought it was related to tueidj's post here, but then I tried to restore my ORIGINAL (not modified) RAW to the 251 official and it gives me the same problem: the memory card is corrupted after restoring the RAW.

I don't care about the savegames lost there because I have a copy of all of them.
That's exactly what I said would happen, you can't copy modified headers from/to official cards. You can only copy them between unofficial cards or from/to the same official card without modifying it.
Maybe it is related to tueidj's modifications, I'm trying to use dacotaco's 0.2b but I still haven't been able to mount the official card (even using the system menu trick :S)
Because the program is looking at the wrong bytes in the sram for the flash id checksum...
 
Problem is that the original raw backup doesn't work in oficial cards.
edit: I've just writen original dump, then forced a backup (without formating) and the card is really corrupted.

By the way, I compiled dacotaco's unmodified source with latest libogc (wich has your memory card unlocking patch) but still official cards can't be unlocked.


And, sorry to sound noob, but fixing sramex struct is just a matter of changing u16 to u8? (This is interpreted from a previous post of yours)
 
And, sorry to sound noob, but fixing sramex struct is just a matter of changing u16 to u8? (This is interpreted from a previous post of yours)

I made a first patch, either way this leaves another issue with having to re-plug mc each time after using it with GCMM+...
 
Fixing the sram struct isn't enough since there is code in card.c that wrongly assumes the checksum is 16 bytes. For example:
Code:
			   	 sum = (sum^-1)&0xff;
sramex->flashID_chksum[chn] = (sum
 
I tested the beta he gave me. I suppose it's ok to comment here too.
Restoring a non protected save worked, but in game didn't work (data corrupted). I tested with Luigi's Mansion.
Restoring Fzero protected save didn't work (the transfer didn't even start). I used the same, non formated memory card of course.

I remember that restoring a Fzero save worked fine with MCbackup (but it works in Gamecube mode)

I'm available for more tests.
 
I've set up my gamecube, BBA and the original ctr-gcs in order to do some testing. While ctr-gcs (0.3, wii mode) seems to read the cards perfectly fine, it seems to have trouble when writting to official cards, resulting in corruption of the data.

I tried to write a raw with changed header to an official memory card (via original ctr-gcs) and it is properly written, but memory card then reports as corrupted. The data is there, in fact action replay can read the savedata just fine, as does original ctr-gcs, which can read and extract all savegames.

I think that a build of ctr-gcs (dacotaco) in gamecube mode will work fine, both read and write (though official memory cards with modified header will still report as corrupted).

I've realized that raw dumps of ofical cards will only work on the same official card, I guess this can also be used to restore a raw dump of different cards of the same size, but it isn't anything we couldn't do with gci savegames...


Actually now that I think about it, this won't work if official memory cards are used. The reason is the flash id in the header is a scrambled version of the real flash id (the one that gets written to nand). The real flash id is obtained during the unlock function and there's no way to copy that from one card to another. If the real flash id doesn't match the descrambled flash id from the card header, the card will be rejected by games as needing formatting. Unofficial cards all use zeroes for their flash id so there's no problem copying headers between them.

I'm wondering what does F-zero savegame store on unnoficial savegames if the real flash id is all zero (ie in unoficial cards), the random seed?

Restoring Fzero protected save didn't work (the transfer didn't even start). I used the same, non formated memory card of course.
I remember that restoring a Fzero save worked fine with MCbackup (but it works in Gamecube mode)

That restore probably worked because the save was from the same memory card.
 
EDIT2: there's debug code to check if data written to memory card is the same as the one in the raw image. I don't know why, but data written is always different from image's even when restoring to unoficial cards (even when the restore is apparently succcessful). Even more, creating a new dump does actually create a correct dump, even though it seems to fail when writing :S
It seems that the problem is in the write function...

EDIT: nope, official cards still broken

I recovered my 251 card with original ctr-gcs, then I only tested writing and recovering the same image file of the card. I don't know what's happening, maybe someone can help:

1.- I have my 251 mc working normally
2-. I put a raw from another 251 mc (obviously it is then broken)
3.- Format it (with ctr-gcs 0.3a)
4.- restore original dump (of working card)
5.- card is still broken

ctr-gcs 0.3a
http://www.mediafire...dq6p8z4k64tzpms

Changelog and warnings:

ctr-gcs 0.3a
_________________________________________
suloku 21 august 2012
_________________________________________

-Added gamecube mode with SD gecko support (also with pso/sdload reloading support)
note: there's no SD gecko support in wii mode
-Added usb (fat32) support. Please plug only one device at a time.
-Added checks for internal SD, USB, SD gecko and memory card being inserted.
-Official memory cards are fully working in both wii and gamecube mode (previous version corrupted official memory cards when writing raw images.
-Included source of GCHeader.exe

About inseting headers and raw images:

First of all, official memory cards only accept its own header, any raw written to the official memory card wich doesn't have that card's header will render the memory card to be reported as corrupted.

So, you can change headers from official cards to unofficial cards and between unofficial cards.

Note that if an official card is formated, the header will change, but previous raw images of that card should still work.

You can still insert f-zero/Phantasy star online savegame and header to a official memory card image and it will work perfectly with dolphin.


Check out dolphin's memory card manager! It supports raw image files and gci/sav/gcs savegames!
http://code.google.c...emcard-manager/
 
What you guys are doing is fantastic. Transferring F-Zero GX savegame files is one of those lose ends in Wii hacking.
I don't know if this helps you in any way but this fellow found a way to transfer F-Zero GX saves using Action Replay and a Gamecube.
I'm just posting this in the hope that it may be somehow useful.
 
Well, I did more testing, it seems oficial gamecube cards aren't written at all. This is what I did:

-Create a blank (all zeros) memory card image
-Restore it to memcard.
-Card breaks, format it and dump formated card. All but the first 3 blocks is still zeroed, so the zeroed image got written.
-Try to restore original image, card breaks, format again.
-The new dump revelas that everithing is still zeroed, data wasn't really writen...

The fact is that unoficial cards work just well.

By the way, I tried also with original daco taco's 0.2b (with tueidj official cards fix) and restoring a raw image continues to break the card (if the image is diferent than the card contents)

What you guys are doing is fantastic. Transferring F-Zero GX savegame files is one of those lose ends in Wii hacking.
I don't know if this helps you in any way but this fellow found a way to transfer F-Zero GX saves using Action Replay and a Gamecube.
I'm just posting this in the hope that it may be somehow useful.

That is very interesting, I wonder what do the codes modify. This is a good solution merged with dolphin (well, I don't know if it has AR codes suport right now).

The problem is still writing the raw to an oficial card in wii mode (in gc mode we have sdmc-20070629-10.34_SoftDev for sdgecko users, it's a pity the source never got released, it works like a charm both with gci and raws)
 
Ultimately, if official cards are the problem, that is not a big deal, compared to the ability to transfer F-Zero saves. You can buy a 128MB Gamecube card from dealextreme for ~$7 shipped (to the US).
If you can now successfully transfer the saves to an unofficial card, which apparently you can, I think that is the bulk of the effort.

I can't wait to test this at home tonight.
If it works for me I"ll buy that big card and put all my saves there.
 
Ultimately, if official cards are the problem, that is not a big deal, compared to the ability to transfer F-Zero saves. You can buy a 128MB Gamecube card from dealextreme for ~$7 shipped (to the US).
If you can now successfully transfer the saves to an unofficial card, which apparently you can, I think that is the bulk of the effort.

I can't wait to test this at home tonight.
If it works for me I"ll buy that big card and put all my saves there.
It does work, I tested it on a real gamecube with a friends almost 100% savegame of F-zero.

I guess the problem with official cards has to do with the sramex structure and flashid checksum in libogc, maybe if that is fixed writing will work.

BTW reading works perfectly fine, so you can use your dumps with dolphin, or put them on an unoficial (same size) card.

The fact is that original ctr-gcs for gamecube over bba worked just fine with official cards, as does softdev's memcard example for gamecube (which source never saw the light, at least that I know).
 
What you guys are doing is fantastic. Transferring F-Zero GX savegame files is one of those lose ends in Wii hacking.
I don't know if this helps you in any way but this fellow found a way to transfer F-Zero GX saves using Action Replay and a Gamecube.
I'm just posting this in the hope that it may be somehow useful.


This solution works with AR for Wii too! I managed to transfer my game save from an unofficial mc to an official mc and its working perfect!
Thanks for pointing out the link with instructions. If someone wants to try just download the AR GC Package for Wii, The AR code isn't big at all so in minutes it's easy to transfer and use in any card that problematic gamesave.
 
  • Like
Reactions: 2 people
This solution works with AR for Wii too! I managed to transfer my game save from an unofficial mc to an official mc and its working perfect!


Thanks for pointing out the link with instructions. If someone wants to try just download the AR GC Package for Wii, The AR code isn't big at all so in minutes it's easy to transfer and use in any card that problematic gamesave.
This gets better by the hour Thanks for testing that out.
Can you point a link to this package?
 
The PAL code is here too: http://board.gscentral.org/retro-hacking/51598.htm

I didn't know this existed (I looked at F-Zero GX issue a lot of years ago, this is new to me!). Thank you!
 
If you don't have AR, you can still use a computer to transfer de savegame:

Get GCI of f-zero savegame
Get raw of destination card

Insert gci to raw card via dolphin card manager

Load f-zero with the raw card in dolphin with cheat enabled and save the game. (the cheat is already in dolphin: right click on game, then propierties)

Extract gci and insert to destination card (as the save has been saved to a raw card with the same serial than the destination card)
 

Site & Scene News

Popular threads in this forum