updated GCMemcard to fix the header's checksum. sidenote: replace the first 0x13bytes of your raw memcard dumps with 0x0750B25EC2A150A9E2047343000000000B1B595C to use them in dolphin.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@908 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2008-10-18 05:19:44 +00:00
parent ad589b7b6b
commit cb14a17ff5
3 changed files with 39 additions and 27 deletions

View File

@ -220,7 +220,7 @@ void CFilesystemViewer::CreateGUIControls()
// Filesystem tree // Filesystem tree
sbTreectrl = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Filesytem:")); sbTreectrl = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Filesytem:"));
m_Treectrl = new wxTreeCtrl(this, ID_TREECTRL, wxDefaultPosition, wxSize(350, 450)/*wxDefaultSize*/, wxTR_DEFAULT_STYLE, wxDefaultValidator); m_Treectrl = new wxTreeCtrl(this, ID_TREECTRL, wxDefaultPosition, wxSize(350, -1), wxTR_DEFAULT_STYLE, wxDefaultValidator);
sbTreectrl->Add(m_Treectrl, 1, wxEXPAND); sbTreectrl->Add(m_Treectrl, 1, wxEXPAND);
RootId = m_Treectrl->AddRoot(wxT("Root"), -1, -1, 0); RootId = m_Treectrl->AddRoot(wxT("Root"), -1, -1, 0);
@ -229,7 +229,7 @@ void CFilesystemViewer::CreateGUIControls()
sMain = new wxGridBagSizer(0, 0); sMain = new wxGridBagSizer(0, 0);
sMain->Add(sbISODetails, wxGBPosition(0, 0), wxGBSpan(1, 1), wxEXPAND|wxALL, 5); sMain->Add(sbISODetails, wxGBPosition(0, 0), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sMain->Add(sbBannerDetails, wxGBPosition(1, 0), wxGBSpan(1, 1), wxEXPAND|wxALL, 5); sMain->Add(sbBannerDetails, wxGBPosition(1, 0), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sMain->Add(sbTreectrl, wxGBPosition(0, 1), wxGBSpan(2, 1), wxALL, 5); sMain->Add(sbTreectrl, wxGBPosition(0, 1), wxGBSpan(2, 1), wxEXPAND|wxALL, 5);
sMain->Add(m_Close, wxGBPosition(2, 1), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT, 5); sMain->Add(m_Close, wxGBPosition(2, 1), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT, 5);
this->SetSizer(sMain); this->SetSizer(sMain);

View File

@ -132,11 +132,11 @@ void CMemcardManager::CreateGUIControls()
sMemcard2 = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Memory Card 2")); sMemcard2 = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Memory Card 2"));
// Create the controls for both memcards // Create the controls for both memcards
// Will change Mem*.raw to *.raw, when loading invalid .raw files doesn't crash the app :/ // Loading invalid .raw files still crash the app, but eh, needed this for testing
m_Memcard1Path = new wxFilePickerCtrl(this, ID_MEMCARD1PATH, wxEmptyString, wxT("Choose a memory card:"), m_Memcard1Path = new wxFilePickerCtrl(this, ID_MEMCARD1PATH, wxEmptyString, wxT("Choose a memory card:"),
wxT("Dolphin memcards (Mem*.raw)|Mem*.raw"), wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_FILE_MUST_EXIST|wxFLP_OPEN); wxT("Raw memcards (*.raw)|*.raw"), wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_FILE_MUST_EXIST|wxFLP_OPEN);
m_Memcard2Path = new wxFilePickerCtrl(this, ID_MEMCARD2PATH, wxEmptyString, wxT("Choose a memory card:"), m_Memcard2Path = new wxFilePickerCtrl(this, ID_MEMCARD2PATH, wxEmptyString, wxT("Choose a memory card:"),
wxT("Dolphin memcards (Mem*.raw)|Mem*.raw"), wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_FILE_MUST_EXIST|wxFLP_OPEN); wxT("Raw memcards (*.raw)|*.raw"), wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_FILE_MUST_EXIST|wxFLP_OPEN);
m_MemcardList[0] = new wxListCtrl(this, ID_MEMCARD1LIST, wxDefaultPosition, wxSize(350,400), m_MemcardList[0] = new wxListCtrl(this, ID_MEMCARD1LIST, wxDefaultPosition, wxSize(350,400),
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL); wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL);
@ -225,7 +225,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
} }
break; break;
case ID_FIXCHECKSUM: case ID_FIXCHECKSUM:
if (m_MemcardList[0]->GetItemCount() > 0) if (memoryCard[0] != NULL)
{ {
// Fix checksums and save the changes // Fix checksums and save the changes
memoryCard[0]->FixChecksums() ? wxMessageBox(wxT("The checksum was successfully fixed"), wxT("Success"), wxOK) memoryCard[0]->FixChecksums() ? wxMessageBox(wxT("The checksum was successfully fixed"), wxT("Success"), wxOK)
@ -234,7 +234,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
} }
break; break;
case ID_CONVERTTOGCI: case ID_CONVERTTOGCI:
{ // Wont compile without brackets?? VC++ Express { // Wont compile without brackets??
wxString temp = wxFileSelector(_T("Select the save file to convert"), wxString temp = wxFileSelector(_T("Select the save file to convert"),
wxEmptyString, wxEmptyString, wxEmptyString,wxString::Format wxEmptyString, wxEmptyString, wxEmptyString,wxString::Format
( (
@ -245,6 +245,9 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
wxFileSelectorDefaultWildcardStr wxFileSelectorDefaultWildcardStr
), ),
wxFD_OPEN | wxFD_FILE_MUST_EXIST); wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (!temp.empty())
{
const char * fileName = temp.ToAscii(); const char * fileName = temp.ToAscii();
wxString temp2 = wxFileSelector(_T("Save GCI as.."), wxString temp2 = wxFileSelector(_T("Save GCI as.."),
wxEmptyString, wxEmptyString, _T(".gci"), wxString::Format wxEmptyString, wxEmptyString, _T(".gci"), wxString::Format
@ -260,6 +263,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
memoryCard[0]->ImportGci(fileName, fileName2); memoryCard[0]->ImportGci(fileName, fileName2);
} }
} }
}
break; break;
case ID_GCIOPENLEFT: case ID_GCIOPENLEFT:
if (memoryCard[0] != NULL) if (memoryCard[0] != NULL)

View File

@ -591,6 +591,12 @@ bool GCMemcard::FixChecksums()
u16 csum1=0,csum2=0; u16 csum1=0,csum2=0;
calc_checksumsBE((u16*)&hdr,0xFE,&csum1,&csum2);
hdr.CheckSum1[0]=u8(csum1>>8);
hdr.CheckSum1[1]=u8(csum1);
hdr.CheckSum2[0]=u8(csum2>>8);
hdr.CheckSum2[1]=u8(csum2);
calc_checksumsBE((u16*)&dir,0xFFE,&csum1,&csum2); calc_checksumsBE((u16*)&dir,0xFFE,&csum1,&csum2);
dir.CheckSum1[0]=u8(csum1>>8); dir.CheckSum1[0]=u8(csum1>>8);
dir.CheckSum1[1]=u8(csum1); dir.CheckSum1[1]=u8(csum1);
@ -852,12 +858,14 @@ GCMemcard::GCMemcard(const char *filename)
// update checksums // update checksums
csums = TestChecksums(); csums = TestChecksums();
} }
} // It seems that the backup having a larger counter doesn't necessarily mean
// the backup should be copied?
if(BE16(dir_backup.UpdateCounter) > BE16(dir.UpdateCounter)) //check if the backup is newer // }
{ //
dir = dir_backup; // if(BE16(dir_backup.UpdateCounter) > BE16(dir.UpdateCounter)) //check if the backup is newer
bat = bat_backup; // needed? // {
// dir = dir_backup;
// bat = bat_backup; // needed?
} }
fseek(mcd,0xa000,SEEK_SET); fseek(mcd,0xa000,SEEK_SET);