diff --git a/Source/Core/DiscIO/Src/Blob.h b/Source/Core/DiscIO/Src/Blob.h index 1722173d5a..778cc1f8d9 100644 --- a/Source/Core/DiscIO/Src/Blob.h +++ b/Source/Core/DiscIO/Src/Blob.h @@ -64,6 +64,7 @@ public: ~SectorReader(); const u8 *GetBlockData(u64 block_num); bool Read(u64 offset, u64 size, u8* out_ptr); + friend class DriveReader; }; // Factory function - examines the path to choose the right type of IBlobReader, and returns one. diff --git a/Source/Core/DiscIO/Src/DriveBlob.cpp b/Source/Core/DiscIO/Src/DriveBlob.cpp index fd104f441f..ce7bd4d752 100644 --- a/Source/Core/DiscIO/Src/DriveBlob.cpp +++ b/Source/Core/DiscIO/Src/DriveBlob.cpp @@ -36,7 +36,7 @@ namespace DiscIO } else { - SetSectorSize(2048); + SectorReader::SetSectorSize(2048); #ifdef _LOCKDRIVE // Lock the compact disc in the CD-ROM drive to prevent accidental // removal while reading from it. @@ -127,27 +127,17 @@ namespace DiscIO delete lpSector; } - void DriveReader::SetSectorSize(int blocksize) - { - for (int i = 0; i < CACHE_SIZE; i++) - { - cache[i] = new u8[blocksize]; - cache_tags[i] = (u64)(s64) - 1; - } - m_blocksize = blocksize; - } - const u8 *DriveReader::GetBlockData(u64 block_num) { - if (cache_tags[0] == block_num) + if (SectorReader::cache_tags[0] == block_num) { - return cache[0]; + return SectorReader::cache[0]; } else { GetBlock(block_num, cache[0]); - cache_tags[0] = block_num; - return cache[0]; + SectorReader::cache_tags[0] = block_num; + return SectorReader::cache[0]; } } diff --git a/Source/Core/DiscIO/Src/DriveBlob.h b/Source/Core/DiscIO/Src/DriveBlob.h index efd0d53cee..bd84fc3afa 100644 --- a/Source/Core/DiscIO/Src/DriveBlob.h +++ b/Source/Core/DiscIO/Src/DriveBlob.h @@ -32,13 +32,8 @@ class DriveReader : public SectorReader { private: DriveReader(const char *drive); - void SetSectorSize(int blocksize); - enum { CACHE_SIZE = 32 }; - int m_blocksize; - u8* cache[CACHE_SIZE]; - u64 cache_tags[CACHE_SIZE]; - int cache_age[CACHE_SIZE]; void GetBlock(u64 block_num, u8 *out_ptr); + #ifdef _WIN32 HANDLE hDisc; PREVENT_MEDIA_REMOVAL pmrLockCDROM; @@ -47,6 +42,7 @@ private: #endif s64 size; u64 *block_pointers; + public: static DriveReader *Create(const char *drive); ~DriveReader(); diff --git a/Source/Core/DolphinWX/Src/MemcardManager.cpp b/Source/Core/DolphinWX/Src/MemcardManager.cpp index cab7f97301..e1e22b29f3 100644 --- a/Source/Core/DolphinWX/Src/MemcardManager.cpp +++ b/Source/Core/DolphinWX/Src/MemcardManager.cpp @@ -206,22 +206,22 @@ void CMemcardManager::CreateGUIControls() { // Create the controls for both memcards -char ARROW[2][3] = {'<','-',0,'-','>',0}; + char ARROW[2][3] = {{'<','-',0,}, {'-','>',0}}; m_ConvertToGci = new wxButton(this, ID_CONVERTTOGCI, wxT("Convert to GCI"), DEFAULTS); for (int slot = SLOT_A; slot < SLOT_B + 1; slot++) { m_CopyFrom[slot] = new wxButton(this, ID_COPYFROM_A + slot, - wxString::Format("%1$sCopy%1$s", ARROW[slot ? 0 : 1]), DEFAULTS); + wxString::Format(wxT("%1$sCopy%1$s"), ARROW[slot ? 0 : 1]), DEFAULTS); m_FixChecksum[slot] = new wxButton(this, ID_FIXCHECKSUM_A + slot, - wxString::Format("%sFix Checksum%s", ARROWS), DEFAULTS); + wxString::Format(wxT("%sFix Checksum%s"), ARROWS), DEFAULTS); m_SaveImport[slot] = new wxButton(this, ID_SAVEIMPORT_A + slot, - wxString::Format("%sImport GCI%s", ARROWS), DEFAULTS); + wxString::Format(wxT("%sImport GCI%s"), ARROWS), DEFAULTS); m_SaveExport[slot] = new wxButton(this, ID_SAVEEXPORT_A + slot, - wxString::Format("%sExport GCI%s", ARROWS), DEFAULTS); + wxString::Format(wxT("%sExport GCI%s"), ARROWS), DEFAULTS); m_Delete[slot] = new wxButton(this, ID_DELETE_A + slot, - wxString::Format("%sDelete%s", ARROWS), DEFAULTS); + wxString::Format(wxT("%sDelete%s"), ARROWS), DEFAULTS); m_PrevPage[slot] = new wxButton(this, ID_PREVPAGE_A + slot, wxT("Prev Page"), DEFAULTS); @@ -243,7 +243,7 @@ char ARROW[2][3] = {'<','-',0,'-','>',0}; m_MemcardList[slot]->AssignImageList(new wxImageList(96,32),wxIMAGE_LIST_SMALL); - sMemcard[slot] = new wxStaticBoxSizer(wxVERTICAL, this, wxString::Format("Memory Card %c", 'A' + slot)); + sMemcard[slot] = new wxStaticBoxSizer(wxVERTICAL, this, wxString::Format(wxT("Memory Card %c"), 'A' + slot)); sMemcard[slot]->Add(m_MemcardPath[slot], 0, wxEXPAND|wxALL, 5); sMemcard[slot]->Add(m_MemcardList[slot], 1, wxEXPAND|wxALL, 5); sMemcard[slot]->Add(sPages[slot], 0, wxEXPAND|wxALL, 1); @@ -551,7 +551,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event) { wxString temp = wxFileSelector(_T("Select a save file to import"), (strcmp(DefaultIOPath.c_str(), "/Users/GC") == 0) ? wxEmptyString : - DefaultIOPath.c_str(), wxEmptyString, wxEmptyString, wxString::Format + wxString::FromAscii(DefaultIOPath.c_str()), wxEmptyString, wxEmptyString, wxString::Format ( _T("Gamecube save files(*.gci,*.gcs,*.sav)|*.gci;*.gcs;*.sav|" "Native GCI files (*.gci)|*.gci|" @@ -592,7 +592,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event) memoryCard[slot]->DEntry_FileName(index,tempC2); sprintf(tempC, "%s_%s.gci", tempC, tempC2); wxString temp = wxFileSelector(_T("Save GCI as.."), _T(DefaultIOPath.c_str()), - _T(tempC), _T(".gci"), wxString::Format + wxString::FromAscii(tempC), _T(".gci"), wxString::Format ( _T("GCI File(*.gci)|*.gci"), wxFileSelectorDefaultWildcardStr,