suloku / gcmm

A gamecube/wii memory card manager
GNU General Public License v3.0
251 stars 24 forks source link

RAW restore not working in 1.4a and 1.4b #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Make RAW backup.
2.Try to restore the same RAW backup.
3.Get this error message: "Error! _sectorirase failed for unknown reasons at 
sector 0!"

This happened today with v1.4a and I downloaded the newest version 1.4b but the 
same. I tried older version 1.3 and it seems to works fine. No Errors and works 
as expect (games load files as normal).

RAW backup was made with 1.4a and restored with 1.3.

Also tried to make another RAW backup with 1.4b (on empty/formated memory card) 
and restore with the same 1.4b version - again this error.

Original issue reported on code.google.com by vladko1...@gmail.com on 11 Oct 2013 at 11:42

GoogleCodeExporter commented 9 years ago
Now I found that this issue is reported before. Let me answer in other 
questions. The card isn't official (it's like this 
http://thumbs2.ebaystatic.com/d/l225/m/mhXHBngDYV-zY5IhUFDKX_Q.jpg ). 32MB, 507 
blocks. Single save and restore works fine.

Original comment by vladko1...@gmail.com on 11 Oct 2013 at 8:50

GoogleCodeExporter commented 9 years ago
Sorry for the late response, I wanted to make some tests myself before 
replying, but I couldn't do so, so I'll just reply.

Firstly, hace you tried to restore with version 1.4 (not 1.4b or 1.4a)?

Do you have any other memory card? If you only have that one memory card, how 
long have you had it and how often have you used it? Have you made a lot of raw 
restores on it?

I encountered this same error myself before releaseing 1.4b, but it appeared on 
an unnoficial card, the very same one I've been using for testing all along, so 
it didn't surprise to me that the card was worn out.

You may want to read this text: 
https://code.google.com/p/gcmm/downloads/detail?name=gcmm_r14b_debug.rar&can=2&q
=#makechanges

Summing up: some bit of block #0 of the memory card's flash memory has worn 
out. The 
"Error! _sectorirase failed for unknown reasons at sector 0!" indicates that 
this has failed, even if it is only 1 bit and it is in an irrelevant region 
(there are such regions in the mc structure). Only way to trully test and 
locate this bit is by making 4 raw restores: a full 0xFF image, then check if 
it really set all bits to 1 comparing a raw backup of this 0xFFed card. Then 
restore a 0x00 image and check if all bits can be set to 0; and then try to 
restore a 0xFF image again to see if all bits can be set to 1.

This should help locate the failing bit(s) of the card. This is the test I 
wanted to make (if I could confirm that my mc had a failing bit, then I would 
assume the code is right and your card is failing too; if not it would mean 
there's an error in the code).

If you are willing to test your card, I can provide you a 0xFFed and 0x00ed 
images of your card's size and instructions for the testing.

For the record, 1.4b worked just fine on another (unnofficial) card.

Original comment by sulokuTDCmago@gmail.com on 22 Oct 2013 at 6:57

GoogleCodeExporter commented 9 years ago
Just checked the code, the error specifically indicates that not all bits of 
the first sector could be set to 1.

Also, you should have a "sectcheck_dump.bin" at the root of your fat device, 
with is a dump of the first sector of the card made right after calling 
sector_erase, which should set the first sector all to 0xFF (that's erasing the 
card for the gamecube).

Could you attach it?

Original comment by sulokuTDCmago@gmail.com on 22 Oct 2013 at 7:12

GoogleCodeExporter commented 9 years ago
I have not enought time to test and will answer in short:
I have three memory cards of 32MB (one is official but it's new and I don't 
want to use it). It was my second memory card (brand new memory) I wanted to 
make full backup of the first one. I have never used restores before. And I 
didn't use ver 1.4.

Maybe I will answer if I test v1.4 when I have free time.

The attached file was on my SD card but I don't remember what was the last 
thing I did.

Original comment by vladko1...@gmail.com on 26 Dec 2013 at 10:22

Attachments:

GoogleCodeExporter commented 9 years ago
Now I made many new tests and I will write the results. But let me explain 
something:
I have two memory cards both UNofficial and both 32MB (507 blocks).
- I have the first one for 1 year and 3 months. It's WHITE and I use it for 
most of games (PAL and NTSC). I have never tried to make RAW restore on it.
- I have the second for 3 months. It's BLACK and I made all raw restores on it. 
I am use it for some NTSC-J games that can't save on the other memory card 
without formatting (I have only one like that: Nintendo Puzzle Collection).

Also I tested three versions of GCMM with OLD raw backups and NEW raw backups:
- OLD means that the backup was made before three months (but I don't know on 
which version of GCMM).
- NEW means that I made new raw backup today with exactly the same version on 
GCMM which I tested. When I tested v1.4b I made backup with v1.4b, when I 
tested v1.4 - made backup by v1.4...

If I say "(OLD) WHITE to BLACK" it means that the backup was made 3 months ago 
from WHITE memory card and tried to restore it on BLACK memory card.

And now the results.
GCMM v1.3:
- (OLD) WHITE to BLACK - works fine.
- (OLD) BLACK to BLACK - works fine.
- (NEW) WHITE to BLACK - works fine.
- (NEW) BLACK to BLACK - works fine.
Also they never made "sectcheck_dump.bin" file.

GCMM v1.4b:
- (OLD) WHITE to BLACK - "Error! _sectorirase failed for unknown reasons at 
sector 0!"
- (OLD) BLACK to BLACK - "Error! _sectorirase failed for unknown reasons at 
sector 0!"
- (NEW) WHITE to BLACK - "Error! _sectorirase failed for unknown reasons at 
sector 0!"
- (NEW) BLACK to BLACK - didn't test it.
Each three files "sectcheck_dump.bin" was with exactly the same content 
(Compared with HEX editor).

GCMM v1.4:
- (OLD) WHITE to BLACK - "Error! _sectorirase failed for unknown reasons at 
sector 0!"
- (OLD) BLACK to BLACK - "Error! _sectorirase failed for unknown reasons at 
sector 0!"
- (NEW) WHITE to BLACK - "Error! _sectorirase failed for unknown reasons at 
sector 0!"
- (NEW) BLACK to BLACK - "Error! _sectorirase failed for unknown reasons at 
sector 0!"
Each three files "sectcheck_dump.bin" was with exactly the same content 
(Compared with HEX editor). The same file as GCMM v1.4b.

Also I tried to use wiimote and gamecube (wavebird) controller but only once or 
twice - no differences in results.

I will upload the "sectcheck_dump.bin" file WHICH IS DIFFERENT FROM FILE 
UPLOADED BEFORE.

Original comment by vladko1...@gmail.com on 5 Jan 2014 at 3:08

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, don't bother doing more tests.

Unofficial memory cards work a little diferently than official cards. Official 
cards need to be erased, then written, while unofficial cards can be written 
directly (that is why raw restore didn't work with official cards at first).

I'm only guessing here, but my bet is that unofficial cards have some sort of 
hardware that makes them automatically erase before writing data and they 
simply ignore the gamecube's erase comands, so _sectorirase (need to correct 
the typo there :p) fails because the card doesn't really erase anything.

I do have an unofficial card that works fine with 1.4 and 1.4b, so I guess that 
card is "better made" in the sense that it replicates official memory card 
behavior.

The solution that comes to mind is either disabling this "security check" (I 
simply read the data after erasing/writing and see if it is the same it should 
have written) either for all cards or just unofficial cards (based on the ID, 
since unofficial cards all share the same ID).

I won't be able to do that until february, but in the meantime you can use 1.3 
version (or 1.4b debug) for your raw restore needs. The code is the same, so 
don't worry about any kind of incompatibility or anything. Raw backup and 
single savegame backup/restore should work perfectly fine on 1.4b.

Thank you for your feedback.

Original comment by sulokuTDCmago@gmail.com on 5 Jan 2014 at 5:23

GoogleCodeExporter commented 9 years ago
I checked the code a little and decided to disable the __sector_erase() check. 
There shouldn't be any more problems with unofficial cards and there's another 
check to be sure the data is correctly written (after writing a block, it is 
read and compared to what it should have written).

If you can try this before january 15 I'll update svn and downloads page 
(google is disabling new downloads due to user abuse).

Original comment by sulokuTDCmago@gmail.com on 5 Jan 2014 at 6:12

Attachments:

GoogleCodeExporter commented 9 years ago
I've tested it myself with my cards (one unofficial that doesn't output the 
error and another unofficial that did output the error), restore works again 
correctly with unofficial cards.

Get the new file from the downloads page: 
https://code.google.com/p/gcmm/downloads/detail?name=gcmm_1.4c.zip&can=2&q=#make
changes

Original comment by sulokuTDCmago@gmail.com on 5 Jan 2014 at 8:20

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I tested it and now RAW restore works. I am glad that we solved this issue.

I figured and decided to offer that you can also check before write every bit. 
If you want to set to "true" and it is already "true" no need to write it 
again. I think that this will make restoring/writing faster and will help for 
better lifespan of memory card.

Original comment by vladko1...@gmail.com on 6 Jan 2014 at 2:35

GoogleCodeExporter commented 9 years ago
What you say is interesting, but I don't think it would work on official cards. 
Also, I don't have the time or knowledge to implement such a method.

I'm glad it works correctly for you too.

Original comment by sulokuTDCmago@gmail.com on 6 Jan 2014 at 6:02