Skip to content

Commit

Permalink
Disabled __sector_erase() check when raw restoring as some unofficial…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
sulokutdcmago committed Jan 5, 2014
1 parent 5c04c9a commit 2493ec6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
4 changes: 2 additions & 2 deletions hbc/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<app version="1">
<name>GCMM</name>
<coder>Suloku</coder>
<version>1.4b</version>
<release_date>20130903000000</release_date>
<version>1.4c</version>
<release_date>20140105000000</release_date>
<short_description>Memory Card Manager</short_description>
<long_description>A memory card manager for Wii/GC.

Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ח����������� ������������������������������ �����������������������-����-���
|0O��o� GCMM 1.4b by suloku �o��O0|
|0O��o� GCMM 1.4c by suloku �o��O0|
| http://code.google.com/p/gcmm |
| (Under GPL License) |
`������� ���������������� ��������������� �������������������� �������������'
Expand Down Expand Up @@ -29,11 +29,14 @@ I (suloku) have updated the code to newest libraries to port it to the Wii syste
ח����������� ������������������������������ �����������������������-����-���
|0O��o� UPDATE HISTORY �o��O0|
`������� ���������������� ��������������� �������������������� �������������'

[What's New 1.4c - january 05, 2014 - By suloku]
* Disabled __sector_erase() check when raw restoring as some unofficial cards seem to have problems with it.

[What's New 1.4b - september 03, 2013 - By suloku]
* 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)
* Added version display


[What's New 1.4a - october 18, 2012 - By suloku]
* Fixed SD Gecko when inserted/swapped at slot selection screen in GameCube mode.
* FLash ID display was missing a byte
Expand Down
2 changes: 1 addition & 1 deletion source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
//Comment FLASHIDCHECK to allow writing any image to any mc. This will corrupt official cards.
#define FLASHIDCHECK

const char appversion[] = "v1.4b";
const char appversion[] = "v1.4c";
int mode;
int cancel;
int doall;
Expand Down
15 changes: 12 additions & 3 deletions source/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ s8 RestoreRawImage( s32 slot, char *sdfilename, s32 *bytes_writen )
return -1;
}
EraseCheckBuffer = (u8*)memalign(32,SectorSize);
if(CheckBuffer == NULL)
if(EraseCheckBuffer == NULL)
{
mem_free(CardBuffer);
mem_free(CheckBuffer);
Expand Down Expand Up @@ -486,6 +486,13 @@ s8 RestoreRawImage( s32 slot, char *sdfilename, s32 *bytes_writen )
usleep(1*1000); //sleep untill the erase is done which sadly takes alot longer then read
__card_sync(slot);
#ifdef DEBUGRAW
//Check if the sector was erased (all set to 0).

//Some unofficial memory cards apparently don't erase sectors when using __card_sectorerase(),
//instead they can directly properly store the data calling just __card_write(),
//so the following check will always fail, preventing restore for those cards, so I'm disabling
//it and relying only on the __card_read() check done after writing the data.
/*
memset(CheckBuffer,0,write_len);
DCInvalidateRange(CheckBuffer,write_len);
read_data = 0;
Expand Down Expand Up @@ -529,7 +536,8 @@ s8 RestoreRawImage( s32 slot, char *sdfilename, s32 *bytes_writen )
CARD_Unmount(slot);
return -1;
}
#endif
*/
#endif
}else
{
fclose(dumpFd);
Expand All @@ -539,7 +547,7 @@ s8 RestoreRawImage( s32 slot, char *sdfilename, s32 *bytes_writen )
mem_free(EraseCheckBuffer);
#endif
//printf("\nerror writing data(%d) Memory card could be corrupt now!!!\n",err);
sprintf(msg, "error erasing sector(%d) Memory card could be corrupt now!!!",err);
sprintf(msg, "error erasing sector(%d). Memory card could be corrupt now!!!",err);
WaitPrompt (msg);
CARD_Unmount(slot);
return -1;
Expand All @@ -554,6 +562,7 @@ s8 RestoreRawImage( s32 slot, char *sdfilename, s32 *bytes_writen )
__card_sync(slot);

#ifdef DEBUGRAW
//Check the written data against the buffer
memset(CheckBuffer,0,write_len);
DCInvalidateRange(CheckBuffer,write_len);
read_data = 0;
Expand Down

0 comments on commit 2493ec6

Please sign in to comment.