Skip to content

Commit 2493ec6

Browse files
author
sulokutdcmago
committed
Disabled __sector_erase() check when raw restoring as some unofficial cards seem to have problems with it.
Corrected typo in buffer checking in raw.c Note: not updating debug version because the changes don't affect its code
1 parent 5c04c9a commit 2493ec6

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

hbc/meta.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<app version="1">
33
<name>GCMM</name>
44
<coder>Suloku</coder>
5-
<version>1.4b</version>
6-
<release_date>20130903000000</release_date>
5+
<version>1.4c</version>
6+
<release_date>20140105000000</release_date>
77
<short_description>Memory Card Manager</short_description>
88
<long_description>A memory card manager for Wii/GC.
99

readme.txt

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ח����������� ������������������������������ �����������������������-����-���
2-
|0O��o� GCMM 1.4b by suloku �o��O0|
2+
|0O��o� GCMM 1.4c by suloku �o��O0|
33
| http://code.google.com/p/gcmm |
44
| (Under GPL License) |
55
`������� ���������������� ��������������� �������������������� �������������'
@@ -29,11 +29,14 @@ I (suloku) have updated the code to newest libraries to port it to the Wii syste
2929
ח����������� ������������������������������ �����������������������-����-���
3030
|0O��o� UPDATE HISTORY �o��O0|
3131
`������� ���������������� ��������������� �������������������� �������������'
32+
33+
[What's New 1.4c - january 05, 2014 - By suloku]
34+
* Disabled __sector_erase() check when raw restoring as some unofficial cards seem to have problems with it.
35+
3236
[What's New 1.4b - september 03, 2013 - By suloku]
3337
* Card initialization was wrong all the way, wich lead to savegames of the same game of different region or those that shared similar filenames (Twilight Princess and WindWaker) to not work properly. Thanks to antidote.crk for noticing. (read considerations sections for more info)
3438
* Added version display
3539

36-
3740
[What's New 1.4a - october 18, 2012 - By suloku]
3841
* Fixed SD Gecko when inserted/swapped at slot selection screen in GameCube mode.
3942
* FLash ID display was missing a byte

source/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
//Comment FLASHIDCHECK to allow writing any image to any mc. This will corrupt official cards.
3939
#define FLASHIDCHECK
4040

41-
const char appversion[] = "v1.4b";
41+
const char appversion[] = "v1.4c";
4242
int mode;
4343
int cancel;
4444
int doall;

source/raw.c

+12-3
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ s8 RestoreRawImage( s32 slot, char *sdfilename, s32 *bytes_writen )
376376
return -1;
377377
}
378378
EraseCheckBuffer = (u8*)memalign(32,SectorSize);
379-
if(CheckBuffer == NULL)
379+
if(EraseCheckBuffer == NULL)
380380
{
381381
mem_free(CardBuffer);
382382
mem_free(CheckBuffer);
@@ -486,6 +486,13 @@ s8 RestoreRawImage( s32 slot, char *sdfilename, s32 *bytes_writen )
486486
usleep(1*1000); //sleep untill the erase is done which sadly takes alot longer then read
487487
__card_sync(slot);
488488
#ifdef DEBUGRAW
489+
//Check if the sector was erased (all set to 0).
490+
491+
//Some unofficial memory cards apparently don't erase sectors when using __card_sectorerase(),
492+
//instead they can directly properly store the data calling just __card_write(),
493+
//so the following check will always fail, preventing restore for those cards, so I'm disabling
494+
//it and relying only on the __card_read() check done after writing the data.
495+
/*
489496
memset(CheckBuffer,0,write_len);
490497
DCInvalidateRange(CheckBuffer,write_len);
491498
read_data = 0;
@@ -529,7 +536,8 @@ s8 RestoreRawImage( s32 slot, char *sdfilename, s32 *bytes_writen )
529536
CARD_Unmount(slot);
530537
return -1;
531538
}
532-
#endif
539+
*/
540+
#endif
533541
}else
534542
{
535543
fclose(dumpFd);
@@ -539,7 +547,7 @@ s8 RestoreRawImage( s32 slot, char *sdfilename, s32 *bytes_writen )
539547
mem_free(EraseCheckBuffer);
540548
#endif
541549
//printf("\nerror writing data(%d) Memory card could be corrupt now!!!\n",err);
542-
sprintf(msg, "error erasing sector(%d) Memory card could be corrupt now!!!",err);
550+
sprintf(msg, "error erasing sector(%d). Memory card could be corrupt now!!!",err);
543551
WaitPrompt (msg);
544552
CARD_Unmount(slot);
545553
return -1;
@@ -554,6 +562,7 @@ s8 RestoreRawImage( s32 slot, char *sdfilename, s32 *bytes_writen )
554562
__card_sync(slot);
555563

556564
#ifdef DEBUGRAW
565+
//Check the written data against the buffer
557566
memset(CheckBuffer,0,write_len);
558567
DCInvalidateRange(CheckBuffer,write_len);
559568
read_data = 0;

0 commit comments

Comments
 (0)