mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-11 15:09:00 +01:00
fix for memcards. the default is 128Mb now too. (shouldn't be a hassle, if there's a bunch of repeated data inside, they still compress nicely :) )
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@866 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
e1ca5de156
commit
5157e69211
@ -61,65 +61,67 @@ CEXIMemoryCard::CEXIMemoryCard(const std::string& _rName, const std::string& _rF
|
|||||||
//0x00000020 Memory Card 507 32Mb
|
//0x00000020 Memory Card 507 32Mb
|
||||||
//0x00000040 Memory Card 1019 64Mb
|
//0x00000040 Memory Card 1019 64Mb
|
||||||
//0x00000080 Memory Card 2043 128Mb
|
//0x00000080 Memory Card 2043 128Mb
|
||||||
card_id = 0xc221;
|
|
||||||
|
//0x00000510 16Mb "bigben" card
|
||||||
//card_id = 0xc243;
|
//card_id = 0xc243;
|
||||||
|
|
||||||
|
card_id = 0xc221; // It's a nintendo brand memcard
|
||||||
|
|
||||||
FILE* pFile = NULL;
|
FILE* pFile = NULL;
|
||||||
pFile = fopen(m_strFilename.c_str(), "rb");
|
pFile = fopen(m_strFilename.c_str(), "rb");
|
||||||
fseek( pFile, 0L, SEEK_END );
|
if (pFile)
|
||||||
long MemFileSize = ftell( pFile );
|
|
||||||
//the switch is based on the size of the memory cards depending on their size !IN BYTES!
|
|
||||||
//by default they will be 2MB mem cards
|
|
||||||
switch ((MemFileSize / (8 * 1024))-5) // Convert the filesize in bytes to the "nintendo-size"
|
|
||||||
{
|
{
|
||||||
|
fseek( pFile, 0L, SEEK_END );
|
||||||
|
long MemFileSize = ftell( pFile );
|
||||||
|
|
||||||
|
switch ((MemFileSize / (8 * 1024))-5) // Convert the filesize in bytes to the "nintendo-size"
|
||||||
|
{
|
||||||
case 59:
|
case 59:
|
||||||
//4Mb or 512KB size
|
|
||||||
nintendo_card_id = 0x00000004;
|
nintendo_card_id = 0x00000004;
|
||||||
memory_card_size = 512 * 1024;
|
memory_card_size = 512 * 1024;
|
||||||
break;
|
break;
|
||||||
case 123:
|
case 123:
|
||||||
//8Mb or 1MB size
|
|
||||||
nintendo_card_id = 0x00000008;
|
nintendo_card_id = 0x00000008;
|
||||||
memory_card_size = 1024 * 1024;
|
memory_card_size = 1024 * 1024;
|
||||||
break;
|
break;
|
||||||
case 251:
|
case 251:
|
||||||
//16Mb or 2MB size
|
|
||||||
nintendo_card_id = 0x00000010;
|
nintendo_card_id = 0x00000010;
|
||||||
memory_card_size = 2 * 1024 * 1024;
|
memory_card_size = 2 * 1024 * 1024;
|
||||||
break;
|
break;
|
||||||
case 507:
|
case 507:
|
||||||
//32Mb or 4MB size
|
|
||||||
nintendo_card_id = 0x00000020;
|
nintendo_card_id = 0x00000020;
|
||||||
memory_card_size = 4 * 1024 * 1024;
|
memory_card_size = 4 * 1024 * 1024;
|
||||||
break;
|
break;
|
||||||
case 1019:
|
case 1019:
|
||||||
//64Mb or 8MB size
|
|
||||||
nintendo_card_id = 0x00000040;
|
nintendo_card_id = 0x00000040;
|
||||||
memory_card_size = 8 * 1024 * 1024;
|
memory_card_size = 8 * 1024 * 1024;
|
||||||
break;
|
break;
|
||||||
case 2043:
|
case 2043:
|
||||||
//128Mb or 16MB size
|
|
||||||
nintendo_card_id = 0x00000080;
|
nintendo_card_id = 0x00000080;
|
||||||
memory_card_size = 16 * 1024 * 1024;
|
memory_card_size = 16 * 1024 * 1024;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Perhaps default behavior should be changed?
|
// Because everyone wants the biggest memcard :}
|
||||||
nintendo_card_id = 0x00000010;
|
nintendo_card_id = 0x00000080;
|
||||||
memory_card_size = 2 * 1024 * 1024;
|
memory_card_size = 16 * 1024 * 1024;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memory_card_content = new u8[memory_card_size];
|
|
||||||
memset(memory_card_content, 0xFF, memory_card_size);
|
// Return to start otherwise the mem card is "corrupt"
|
||||||
|
fseek( pFile,0L,SEEK_SET);
|
||||||
|
|
||||||
|
memory_card_content = new u8[memory_card_size];
|
||||||
|
memset(memory_card_content, 0xFF, memory_card_size);
|
||||||
|
|
||||||
//return to start otherwise the mem card is "corrupt"
|
|
||||||
fseek( pFile,0L,SEEK_SET);
|
|
||||||
if (pFile)
|
|
||||||
{
|
|
||||||
LOG(EXPANSIONINTERFACE, "Reading memory card %s", m_strFilename.c_str());
|
LOG(EXPANSIONINTERFACE, "Reading memory card %s", m_strFilename.c_str());
|
||||||
fread(memory_card_content, 1, memory_card_size, pFile);
|
fread(memory_card_content, 1, memory_card_size, pFile);
|
||||||
fclose(pFile);
|
fclose(pFile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
nintendo_card_id = 0x00000080;
|
||||||
|
memory_card_size = 16 * 1024 * 1024;
|
||||||
|
|
||||||
LOG(EXPANSIONINTERFACE, "No memory card found. Will create new.");
|
LOG(EXPANSIONINTERFACE, "No memory card found. Will create new.");
|
||||||
Flush();
|
Flush();
|
||||||
Core::DisplayMessage(StringFromFormat("Wrote memory card contents to %s", m_strFilename.c_str()), 4000);
|
Core::DisplayMessage(StringFromFormat("Wrote memory card contents to %s", m_strFilename.c_str()), 4000);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user