diff --git a/Source/Core/DolphinWX/Src/MemcardManager.cpp b/Source/Core/DolphinWX/Src/MemcardManager.cpp index cc9b5d6c3a..5e1389c1fd 100644 --- a/Source/Core/DolphinWX/Src/MemcardManager.cpp +++ b/Source/Core/DolphinWX/Src/MemcardManager.cpp @@ -16,7 +16,6 @@ // http://code.google.com/p/dolphin-emu/ #include "Globals.h" - #include "MemcardManager.h" #include "wx/mstream.h" @@ -54,7 +53,7 @@ wxBitmap wxBitmapFromMemoryRGBA(const unsigned char* data, int width, int height u8 *pixelData = pdata + sizeof(hdr); - for(int y=0;yCopy->"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_CopyLeft = new wxButton(this, ID_COPYLEFT, wxT("<-Copy<-"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + m_CopyRight = new wxButton(this, ID_COPYRIGHT, wxT("->Copy->"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - m_FixChecksum = new wxButton(this, ID_FIXCHECKSUM, wxT("Fix\nchecksum"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + m_FixChecksum = new wxButton(this, ID_FIXCHECKSUM, wxT("<-Fix\nChecksum"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + + m_GciOpenLeft = new wxButton(this, ID_GCIOPENLEFT, wxT("<-Import GCI"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + m_GciSaveLeft = new wxButton(this, ID_GCISAVELEFT, wxT("<-Export GCI"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + m_GciOpenRight = new wxButton(this, ID_GCIOPENRIGHT, wxT("Import GCI->"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + m_GciSaveRight = new wxButton(this, ID_GCISAVERIGHT, wxT("Export GCI->"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - m_DeleteRight = new wxButton(this, ID_DELETERIGHT, wxT("Delete->"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_DeleteLeft = new wxButton(this, ID_DELETELEFT, wxT("<-Delete"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + m_DeleteRight = new wxButton(this, ID_DELETERIGHT, wxT("Delete->"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - // sizers that double as wxStaticBoxes + // Sizers that double as wxStaticBoxes sMemcard1 = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Memory Card 1")); sMemcard2 = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Memory Card 2")); - // create the controls for both memcards - // will change Mem*.raw to *.raw, when loading invalid .raw files doesn't crash the app :/ + // Create the controls for both memcards + // Will change Mem*.raw to *.raw, when loading invalid .raw files doesn't crash the app :/ 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); 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); - + m_MemcardList[0] = new wxListCtrl(this, ID_MEMCARD1LIST, wxDefaultPosition, wxSize(350,400), wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL); m_MemcardList[1] = new wxListCtrl(this, ID_MEMCARD2LIST, wxDefaultPosition, wxSize(350,400), @@ -135,14 +145,20 @@ void CMemcardManager::CreateGUIControls() // mmmm sizer goodness wxBoxSizer* sButtons; sButtons = new wxBoxSizer(wxVERTICAL); + sButtons->AddStretchSpacer(2); + sButtons->Add(m_CopyLeft, 0, wxEXPAND, 5); + sButtons->Add(m_CopyRight, 0, wxEXPAND, 5); sButtons->AddStretchSpacer(1); - sButtons->Add(m_CopyRight, 0, 0, 5); - sButtons->Add(m_CopyLeft, 0, 0, 5); - sButtons->AddStretchSpacer(2); - sButtons->Add(m_FixChecksum, 0, 0, 5); - sButtons->AddStretchSpacer(2); - sButtons->Add(m_DeleteRight, 0, 0, 5); - sButtons->Add(m_DeleteLeft, 0, 0, 5); + sButtons->Add(m_FixChecksum, 0, wxEXPAND, 5); + sButtons->AddStretchSpacer(1); + sButtons->Add(m_GciOpenLeft, 0, wxEXPAND, 5); + sButtons->Add(m_GciSaveLeft, 0, wxEXPAND, 5); + sButtons->AddStretchSpacer(1); + sButtons->Add(m_GciOpenRight, 0, wxEXPAND, 5); + sButtons->Add(m_GciSaveRight, 0, wxEXPAND, 5); + sButtons->AddStretchSpacer(1); + sButtons->Add(m_DeleteLeft, 0, wxEXPAND, 5); + sButtons->Add(m_DeleteRight, 0, wxEXPAND, 5); sButtons->AddStretchSpacer(1); sMemcard1->Add(m_Memcard1Path, 0, wxEXPAND|wxALL, 5); @@ -157,6 +173,7 @@ void CMemcardManager::CreateGUIControls() this->SetSizer(sMain); sMain->SetSizeHints(this); + Fit(); } void CMemcardManager::OnClose(wxCloseEvent& WXUNUSED (event)) @@ -166,14 +183,15 @@ void CMemcardManager::OnClose(wxCloseEvent& WXUNUSED (event)) void CMemcardManager::OnPathChange(wxFileDirPickerEvent& event) { - switch(event.GetId()) + + switch (event.GetId()) { - case ID_MEMCARD1PATH: - ReloadMemcard(event.GetPath().mb_str(), 0); - break; - case ID_MEMCARD2PATH: - ReloadMemcard(event.GetPath().mb_str(), 1); - break; + case ID_MEMCARD1PATH: + ReloadMemcard(event.GetPath().mb_str(), 0); + break; + case ID_MEMCARD2PATH: + ReloadMemcard(event.GetPath().mb_str(), 1); + break; } } @@ -184,53 +202,129 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event) switch(event.GetId()) { - case ID_COPYRIGHT: - if(index0 != -1 && m_MemcardList[1]->GetItemCount() > 0) + case ID_COPYLEFT: + if ((index1 != -1) && (memoryCard[0] != NULL)) + { + memoryCard[0]->CopyFrom(*memoryCard[1], index1); + memoryCard[0]->Save(); + ReloadMemcard(m_Memcard1Path->GetPath().mb_str(), 0); + } + break; + case ID_COPYRIGHT: + if ((index0 != -1) && (memoryCard[1] != NULL)) + { + memoryCard[1]->CopyFrom(*memoryCard[0], index0); + memoryCard[1]->Save(); + ReloadMemcard(m_Memcard2Path->GetPath().mb_str(), 1); + } + break; + case ID_FIXCHECKSUM: + if (m_MemcardList[0]->GetItemCount() > 0) + { + // Fix checksums and save the changes + memoryCard[0]->FixChecksums() ? wxMessageBox(wxT("The checksum was successfully fixed"), wxT("Success"), wxOK) + : wxMessageBox(wxT("The checksum could not be successfully fixed"), wxT("Error"), wxOK|wxICON_ERROR); + memoryCard[0]->Save(); + } + break; + case ID_GCIOPENLEFT: + if (memoryCard[0] != NULL) + { + wxString temp = wxFileSelector(_T("Select the GCI file to import"), + wxEmptyString, wxEmptyString, wxEmptyString,wxString::Format + ( + _T("GCI File(*.gci)|*.gci|All files (%s)|%s"), + wxFileSelectorDefaultWildcardStr, + wxFileSelectorDefaultWildcardStr + ), + wxFD_OPEN | wxFD_FILE_MUST_EXIST); + const char * fileName = temp.ToAscii(); + + if (temp.length()>0) { - memoryCard[1]->CopyFrom(*memoryCard[0], index0); - memoryCard[1]->Save(); - ReloadMemcard(m_Memcard2Path->GetPath().mb_str(), 1); - } - break; - case ID_COPYLEFT: - if(index1 != -1 && m_MemcardList[0]->GetItemCount() > 0) - { - memoryCard[0]->CopyFrom(*memoryCard[1], index1); + memoryCard[0]->AddGci(fileName); memoryCard[0]->Save(); ReloadMemcard(m_Memcard1Path->GetPath().mb_str(), 0); } - break; - case ID_FIXCHECKSUM: - if(m_MemcardList[0]->GetItemCount() > 0) + } + break; + case ID_GCIOPENRIGHT: + if (memoryCard[1] != NULL) + { + wxString temp = wxFileSelector(_T("Select the GCI file to import"), + wxEmptyString, wxEmptyString, wxEmptyString,wxString::Format + ( + _T("GCI File(*.gci)|*.gci|All files (%s)|%s"), + wxFileSelectorDefaultWildcardStr, + wxFileSelectorDefaultWildcardStr + ), + wxFD_OPEN | wxFD_FILE_MUST_EXIST); + const char * fileName = temp.ToAscii(); + + if (temp.length()>0) { - // Fix checksums and save the changes - memoryCard[0]->FixChecksums(); - memoryCard[0]->Save(); - wxMessageBox(wxT("The checksum was successfully fixed"), wxT("Message"), wxOK); - } - break; - case ID_DELETERIGHT: - if(index1 != -1) - { - memoryCard[1]->RemoveFile(index1); + memoryCard[1]->AddGci(fileName); memoryCard[1]->Save(); - ReloadMemcard(m_Memcard2Path->GetPath().mb_str(), 1); - } - break; - case ID_DELETELEFT: - if(index0 != -1) - { - memoryCard[0]->RemoveFile(index0); - memoryCard[0]->Save(); ReloadMemcard(m_Memcard1Path->GetPath().mb_str(), 0); } - break; + } + break; + case ID_GCISAVELEFT: + if (index0 != -1) + { + wxString temp = wxFileSelector(_T("Save GCI as.."), + wxEmptyString, wxEmptyString, _T(".gci"), wxString::Format + ( + _T("GCI File(*.gci)|*.gci"), + wxFileSelectorDefaultWildcardStr, + wxFileSelectorDefaultWildcardStr + ), + wxFD_OVERWRITE_PROMPT|wxFD_SAVE); + const char * fileName = temp.ToAscii(); + + if (temp.length()>0) + memoryCard[0]->SaveGci(index0, fileName); + } + break; + case ID_GCISAVERIGHT: + if (index1 != -1) + { + wxString temp = wxFileSelector(_T("Save GCI as.."), + wxEmptyString, wxEmptyString, _T(".gci"), wxString::Format + ( + _T("GCI File(*.gci)|*.gci"), + wxFileSelectorDefaultWildcardStr, + wxFileSelectorDefaultWildcardStr + ), + wxFD_OVERWRITE_PROMPT|wxFD_SAVE); + const char * fileName = temp.ToAscii(); + + if (temp.length()>0) + memoryCard[1]->SaveGci(index1, fileName); + } + break; + case ID_DELETELEFT: + if (index0 != -1) + { + memoryCard[0]->RemoveFile(index0); + memoryCard[0]->Save(); + ReloadMemcard(m_Memcard1Path->GetPath().mb_str(), 0); + } + break; + case ID_DELETERIGHT: + if (index1 != -1) + { + memoryCard[1]->RemoveFile(index1); + memoryCard[1]->Save(); + ReloadMemcard(m_Memcard2Path->GetPath().mb_str(), 1); + } + break; } } void CMemcardManager::ReloadMemcard(const char *fileName, int card) { - if(memoryCard[card]) delete memoryCard[card]; + if (memoryCard[card]) delete memoryCard[card]; // TODO: add error checking and animate icons memoryCard[card] = new GCMemcard(fileName); @@ -248,7 +342,7 @@ void CMemcardManager::ReloadMemcard(const char *fileName, int card) int nFiles = memoryCard[card]->GetNumFiles(); int *images = new int[nFiles*2]; - for(int i=0;iReadAnimRGBA8(i,animData,animDelay); - if(!memoryCard[card]->ReadBannerRGBA8(i,pxdata)) + if (!memoryCard[card]->ReadBannerRGBA8(i,pxdata)) { memset(pxdata,0,96*32*4); - if(numFrames>0) // just use the first one + if (numFrames>0) // Just use the first one { u32 *icdata = animData; - for(int y=0;y<32;y++) + for (int y=0;y<32;y++) { - for(int x=0;x<32;x++) + for (int x=0;x<32;x++) { pxdata[y*96+x+32] = icdata[y*32+x] /* | 0xFF000000 */; } @@ -277,35 +371,35 @@ void CMemcardManager::ReloadMemcard(const char *fileName, int card) wxBitmap map = wxBitmapFromMemoryRGBA((u8*)pxdata,96,32); images[i*2] = list->Add(map); - if(numFrames>0) + if (numFrames>0) { memset(pxdata,0,96*32*4); int frames=3; - if(numFramesAdd(icon); } } - for(int i=0;iGetComment1(i,title)) title[0]=0; - if(!memoryCard[card]->GetComment2(i,comment)) comment[0]=0; + if (!memoryCard[card]->GetComment1(i,title)) title[0]=0; + if (!memoryCard[card]->GetComment2(i,comment)) comment[0]=0; int index = m_MemcardList[card]->InsertItem(i, wxT("row")); m_MemcardList[card]->SetItem(index, COLUMN_BANNER, wxEmptyString); @@ -313,19 +407,20 @@ void CMemcardManager::ReloadMemcard(const char *fileName, int card) m_MemcardList[card]->SetItem(index, COLUMN_COMMENT, wxString::FromAscii(comment)); m_MemcardList[card]->SetItem(index, COLUMN_ICON, wxEmptyString); - if(images[i]>=0) + if (images[i]>=0) { m_MemcardList[card]->SetItemImage(index, images[i*2]); m_MemcardList[card]->SetItemColumnImage(index, COLUMN_ICON, images[i*2+1]); } } - m_MemcardList[card]->Show(); delete[] images; - // automatic column width + // Automatic column width and then show the list for (int i = 0; i < m_MemcardList[card]->GetColumnCount(); i++) { m_MemcardList[card]->SetColumnWidth(i, wxLIST_AUTOSIZE); } + + m_MemcardList[card]->Show(); } diff --git a/Source/Core/DolphinWX/Src/MemcardManager.h b/Source/Core/DolphinWX/Src/MemcardManager.h index 12df1504a5..77dd862d87 100644 --- a/Source/Core/DolphinWX/Src/MemcardManager.h +++ b/Source/Core/DolphinWX/Src/MemcardManager.h @@ -14,7 +14,7 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ - +//updated to 677 #ifndef __MEMCARD_MANAGER_h__ #define __MEMCARD_MANAGER_h__ @@ -35,27 +35,29 @@ class CMemcardManager { public: - CMemcardManager(wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Memory Card Manager WARNING-Make backups before using, will probably mangle stuff!"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = MEMCARD_MANAGER_STYLE); + CMemcardManager(wxWindow *parent, wxWindowID id = 1, const wxString& title = wxT("Memory Card Manager WARNING-Make backups before using, will probably mangle stuff!"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = MEMCARD_MANAGER_STYLE); virtual ~CMemcardManager(); private: DECLARE_EVENT_TABLE(); - wxBoxSizer* sMain; - wxButton* m_CopyRight; - wxButton* m_CopyLeft; - wxButton* m_FixChecksum; - wxButton* m_DeleteRight; - wxButton* m_DeleteLeft; - wxStaticBoxSizer* sMemcard1; - wxStaticBoxSizer* sMemcard2; - wxFilePickerCtrl* m_Memcard1Path; - wxFilePickerCtrl* m_Memcard2Path; - wxListCtrl* m_MemcardList[2]; - wxTimer* m_Timer; + wxBoxSizer *sMain; + wxButton *m_CopyLeft; + wxButton *m_CopyRight; + wxButton *m_FixChecksum; + wxButton *m_GciOpenLeft; + wxButton *m_GciSaveLeft; + wxButton *m_GciOpenRight; + wxButton *m_GciSaveRight; + wxButton *m_DeleteLeft; + wxButton *m_DeleteRight; + wxStaticBoxSizer *sMemcard1; + wxStaticBoxSizer *sMemcard2; + wxFilePickerCtrl *m_Memcard1Path; + wxFilePickerCtrl *m_Memcard2Path; - int nframe; + wxListCtrl *m_MemcardList[2]; enum { @@ -66,6 +68,10 @@ class CMemcardManager ID_DELETELEFT, ID_MEMCARD1PATH, ID_MEMCARD2PATH, + ID_GCISAVERIGHT, + ID_GCISAVELEFT, + ID_GCIOPENRIGHT, + ID_GCIOPENLEFT, ID_MEMCARD1LIST, ID_MEMCARD2LIST, ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values diff --git a/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.cpp b/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.cpp index 0bee47ca44..34bd84ffab 100644 --- a/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.cpp +++ b/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.cpp @@ -1,5 +1,20 @@ -// gcmc.cpp: define el punto de entrada de la aplicación de consola. -// +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + #ifdef _WIN32 #include "stdafx.h" #endif @@ -249,16 +264,20 @@ bool GCMemcard::GetFileData(u32 index, u8*dest) //index in the directory array if(!mcdFile) return false; int block = BE16(dir.Dir[index].FirstBlock); + int saveLength = BE16(dir.Dir[index].BlockCount); + int memcardSize = BE16(hdr.Size) * 0x0010; assert((block!=0xFFFF)&&(block>0)); do { - int nextblock=bswap16(bat.Map[block-5]); - assert(nextblock>0); - memcpy(dest,mc_data + 0x2000*(block-5),0x2000); dest+=0x2000; - block=nextblock; + if(block + saveLength != memcardSize) + { + int nextblock=bswap16(bat.Map[block-5]); + assert(nextblock>0); + block=nextblock; + }else block=0xffff; } while(block!=0xffff); @@ -540,46 +559,38 @@ u32 GCMemcard::TestChecksums() return 0; } - -// ========================================================================================== -// Fix checksums - I'll begin with fixing Directory and Directory backup. Feel free to add the -// other blocks. -// ------------------------------------------------------------------------------------------ -u32 GCMemcard::FixChecksums() +bool GCMemcard::FixChecksums() { - if(!mcdFile) return 0xFFFFFFFF; + if(!mcdFile) return false; u16 csum1=0,csum2=0; - u32 results = 0; - calc_checksumsBE((u16*)&dir,0xFFE,&csum1,&csum2); - if(BE16(dir.CheckSum1) != csum1) results |= 2; - if(BE16(dir.CheckSum2) != csum2) results |= 2; - - // ------------------------------------------------------------------------------------------ - // Save the values we just read dir.CheckSum1[0]=u8(csum1>>8); dir.CheckSum1[1]=u8(csum1); dir.CheckSum2[0]=u8(csum2>>8); dir.CheckSum2[1]=u8(csum2); - // ------------------------------------------------------------------------------------------ calc_checksumsBE((u16*)&dir_backup,0xFFE,&csum1,&csum2); - if(BE16(dir_backup.CheckSum1) != csum1) results |= 4; - if(BE16(dir_backup.CheckSum2) != csum2) results |= 4; - - // ------------------------------------------------------------------------------------------ - // Save the values we just read dir_backup.CheckSum1[0]=u8(csum1>>8); dir_backup.CheckSum1[1]=u8(csum1); dir_backup.CheckSum2[0]=u8(csum2>>8); dir_backup.CheckSum2[1]=u8(csum2); - // ------------------------------------------------------------------------------------------ - return 0; -} -// ========================================================================================== + calc_checksumsBE((u16*)(((u8*)&bat)+4),0xFFE,&csum1,&csum2); + bat.CheckSum1[0]=u8(csum1>>8); + bat.CheckSum1[1]=u8(csum1); + bat.CheckSum2[0]=u8(csum2>>8); + bat.CheckSum2[1]=u8(csum2); + + calc_checksumsBE((u16*)(((u8*)&bat_backup)+4),0xFFE,&csum1,&csum2); + bat_backup.CheckSum1[0]=u8(csum1>>8); + bat_backup.CheckSum1[1]=u8(csum1); + bat_backup.CheckSum2[0]=u8(csum2>>8); + bat_backup.CheckSum2[1]=u8(csum2); + + return true; +} u32 GCMemcard::CopyFrom(GCMemcard& source, u32 index) { @@ -598,6 +609,53 @@ u32 GCMemcard::CopyFrom(GCMemcard& source, u32 index) return ret; } +u32 GCMemcard::AddGci(const char *fileName) +{ + if(!mcdFile) return 0; + + FILE *gci=fopen(fileName,"rb"); + + if(!gci) return 0; + + DEntry *d = new DEntry; + fread(d,1,0x40,gci); + + u32 size=BE16((d->BlockCount))*0x2000; + u8 *t = new u8[size]; + fread(t,1,size,gci); + u32 ret = ImportFile(*d,t); + delete[] t; + delete d; + return ret; +} + +bool GCMemcard::SaveGci(u32 index, const char *fileName) +{ + FILE *gci=fopen(fileName,"wb"); + + if(!gci) return false; + + fseek(gci,0,SEEK_SET); + + DEntry d; + if(!this->GetFileInfo(index,d)) return false; + fwrite(&d,1,0x40,gci); + + u8 *t = new u8[this->GetFileSize(index)*0x2000]; + + if(!this->GetFileData(index,t)) return false; + + int fileBlocks=BE16(d.BlockCount); + + fseek(gci,0x40,SEEK_SET); + fwrite(t,1,0x2000*fileBlocks,gci); + + fclose(gci); + delete[] t; + + return true; +} + bool GCMemcard::Save() { if(!mcdFile) return false; @@ -683,6 +741,7 @@ GCMemcard::GCMemcard(const char *filename) fseek(mcd,0xa000,SEEK_SET); + assert(BE16(hdr.Size)!=0xFFFF); mc_data_size=(((u32)BE16(hdr.Size)*16)-5)*0x2000; mc_data = new u8[mc_data_size]; diff --git a/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.h b/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.h index 2a5626fdf5..d787c4a80a 100644 --- a/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.h +++ b/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.h @@ -1,3 +1,20 @@ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + #pragma once typedef unsigned char u8; @@ -128,8 +145,8 @@ public: bool IsOpen(); u32 TestChecksums(); - u32 FixChecksums(); - + bool FixChecksums(); + // get number of file entries in the directory u32 GetNumFiles(); @@ -160,6 +177,12 @@ public: // reads a save from another memcard, and imports the data into this memcard u32 CopyFrom(GCMemcard& source, u32 index); + // writes a .gci file to disk containing index + bool SaveGci(u32 index, const char* fileName); + + // reads a .gci file and calls ImportFile + u32 AddGci(const char* fileName); + // reads the banner image bool ReadBannerRGBA8(u32 index, u32* buffer);