mirror of https://github.com/PCSX2/pcsx2.git
Config: Convert MemoryCardType to an enum class
This commit is contained in:
parent
d72c476483
commit
1e703286f0
|
@ -84,12 +84,12 @@ enum class FMVAspectRatioSwitchType : u8
|
||||||
MaxCount
|
MaxCount
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MemoryCardType
|
enum class MemoryCardType
|
||||||
{
|
{
|
||||||
MemoryCard_None,
|
Empty,
|
||||||
MemoryCard_File,
|
File,
|
||||||
MemoryCard_Folder,
|
Folder,
|
||||||
MemoryCard_MaxCount
|
MaxCount
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class LimiterModeType : u8
|
enum class LimiterModeType : u8
|
||||||
|
|
|
@ -297,7 +297,7 @@ void FileMemoryCard::Open()
|
||||||
cont = true;
|
cont = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EmuConfig.Mcd[slot].Type != MemoryCardType::MemoryCard_File)
|
if (EmuConfig.Mcd[slot].Type != MemoryCardType::File)
|
||||||
{
|
{
|
||||||
str = L"[is not memcard file]";
|
str = L"[is not memcard file]";
|
||||||
cont = true;
|
cont = true;
|
||||||
|
@ -607,16 +607,16 @@ void FileMcd_EmuOpen()
|
||||||
{
|
{
|
||||||
if (EmuConfig.Mcd[slot].Enabled)
|
if (EmuConfig.Mcd[slot].Enabled)
|
||||||
{
|
{
|
||||||
MemoryCardType type = MemoryCardType::MemoryCard_File; // default to file if we can't find anything at the path so it gets auto-generated
|
MemoryCardType type = MemoryCardType::File; // default to file if we can't find anything at the path so it gets auto-generated
|
||||||
|
|
||||||
const wxString path = EmuConfig.FullpathToMcd(slot);
|
const wxString path = EmuConfig.FullpathToMcd(slot);
|
||||||
if (wxFileExists(path))
|
if (wxFileExists(path))
|
||||||
{
|
{
|
||||||
type = MemoryCardType::MemoryCard_File;
|
type = MemoryCardType::File;
|
||||||
}
|
}
|
||||||
else if (wxDirExists(path))
|
else if (wxDirExists(path))
|
||||||
{
|
{
|
||||||
type = MemoryCardType::MemoryCard_Folder;
|
type = MemoryCardType::Folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
EmuConfig.Mcd[slot].Type = type;
|
EmuConfig.Mcd[slot].Type = type;
|
||||||
|
@ -642,9 +642,9 @@ s32 FileMcd_IsPresent(uint port, uint slot)
|
||||||
const uint combinedSlot = FileMcd_ConvertToSlot(port, slot);
|
const uint combinedSlot = FileMcd_ConvertToSlot(port, slot);
|
||||||
switch (EmuConfig.Mcd[combinedSlot].Type)
|
switch (EmuConfig.Mcd[combinedSlot].Type)
|
||||||
{
|
{
|
||||||
case MemoryCardType::MemoryCard_File:
|
case MemoryCardType::File:
|
||||||
return Mcd::impl.IsPresent(combinedSlot);
|
return Mcd::impl.IsPresent(combinedSlot);
|
||||||
case MemoryCardType::MemoryCard_Folder:
|
case MemoryCardType::Folder:
|
||||||
return Mcd::implFolder.IsPresent(combinedSlot);
|
return Mcd::implFolder.IsPresent(combinedSlot);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -656,10 +656,10 @@ void FileMcd_GetSizeInfo(uint port, uint slot, McdSizeInfo* outways)
|
||||||
const uint combinedSlot = FileMcd_ConvertToSlot(port, slot);
|
const uint combinedSlot = FileMcd_ConvertToSlot(port, slot);
|
||||||
switch (EmuConfig.Mcd[combinedSlot].Type)
|
switch (EmuConfig.Mcd[combinedSlot].Type)
|
||||||
{
|
{
|
||||||
case MemoryCardType::MemoryCard_File:
|
case MemoryCardType::File:
|
||||||
Mcd::impl.GetSizeInfo(combinedSlot, *outways);
|
Mcd::impl.GetSizeInfo(combinedSlot, *outways);
|
||||||
break;
|
break;
|
||||||
case MemoryCardType::MemoryCard_Folder:
|
case MemoryCardType::Folder:
|
||||||
Mcd::implFolder.GetSizeInfo(combinedSlot, *outways);
|
Mcd::implFolder.GetSizeInfo(combinedSlot, *outways);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -672,9 +672,9 @@ bool FileMcd_IsPSX(uint port, uint slot)
|
||||||
const uint combinedSlot = FileMcd_ConvertToSlot(port, slot);
|
const uint combinedSlot = FileMcd_ConvertToSlot(port, slot);
|
||||||
switch (EmuConfig.Mcd[combinedSlot].Type)
|
switch (EmuConfig.Mcd[combinedSlot].Type)
|
||||||
{
|
{
|
||||||
case MemoryCardType::MemoryCard_File:
|
case MemoryCardType::File:
|
||||||
return Mcd::impl.IsPSX(combinedSlot);
|
return Mcd::impl.IsPSX(combinedSlot);
|
||||||
case MemoryCardType::MemoryCard_Folder:
|
case MemoryCardType::Folder:
|
||||||
return Mcd::implFolder.IsPSX(combinedSlot);
|
return Mcd::implFolder.IsPSX(combinedSlot);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -686,9 +686,9 @@ s32 FileMcd_Read(uint port, uint slot, u8* dest, u32 adr, int size)
|
||||||
const uint combinedSlot = FileMcd_ConvertToSlot(port, slot);
|
const uint combinedSlot = FileMcd_ConvertToSlot(port, slot);
|
||||||
switch (EmuConfig.Mcd[combinedSlot].Type)
|
switch (EmuConfig.Mcd[combinedSlot].Type)
|
||||||
{
|
{
|
||||||
case MemoryCardType::MemoryCard_File:
|
case MemoryCardType::File:
|
||||||
return Mcd::impl.Read(combinedSlot, dest, adr, size);
|
return Mcd::impl.Read(combinedSlot, dest, adr, size);
|
||||||
case MemoryCardType::MemoryCard_Folder:
|
case MemoryCardType::Folder:
|
||||||
return Mcd::implFolder.Read(combinedSlot, dest, adr, size);
|
return Mcd::implFolder.Read(combinedSlot, dest, adr, size);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -700,9 +700,9 @@ s32 FileMcd_Save(uint port, uint slot, const u8* src, u32 adr, int size)
|
||||||
const uint combinedSlot = FileMcd_ConvertToSlot(port, slot);
|
const uint combinedSlot = FileMcd_ConvertToSlot(port, slot);
|
||||||
switch (EmuConfig.Mcd[combinedSlot].Type)
|
switch (EmuConfig.Mcd[combinedSlot].Type)
|
||||||
{
|
{
|
||||||
case MemoryCardType::MemoryCard_File:
|
case MemoryCardType::File:
|
||||||
return Mcd::impl.Save(combinedSlot, src, adr, size);
|
return Mcd::impl.Save(combinedSlot, src, adr, size);
|
||||||
case MemoryCardType::MemoryCard_Folder:
|
case MemoryCardType::Folder:
|
||||||
return Mcd::implFolder.Save(combinedSlot, src, adr, size);
|
return Mcd::implFolder.Save(combinedSlot, src, adr, size);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -714,9 +714,9 @@ s32 FileMcd_EraseBlock(uint port, uint slot, u32 adr)
|
||||||
const uint combinedSlot = FileMcd_ConvertToSlot(port, slot);
|
const uint combinedSlot = FileMcd_ConvertToSlot(port, slot);
|
||||||
switch (EmuConfig.Mcd[combinedSlot].Type)
|
switch (EmuConfig.Mcd[combinedSlot].Type)
|
||||||
{
|
{
|
||||||
case MemoryCardType::MemoryCard_File:
|
case MemoryCardType::File:
|
||||||
return Mcd::impl.EraseBlock(combinedSlot, adr);
|
return Mcd::impl.EraseBlock(combinedSlot, adr);
|
||||||
case MemoryCardType::MemoryCard_Folder:
|
case MemoryCardType::Folder:
|
||||||
return Mcd::implFolder.EraseBlock(combinedSlot, adr);
|
return Mcd::implFolder.EraseBlock(combinedSlot, adr);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -728,9 +728,9 @@ u64 FileMcd_GetCRC(uint port, uint slot)
|
||||||
const uint combinedSlot = FileMcd_ConvertToSlot(port, slot);
|
const uint combinedSlot = FileMcd_ConvertToSlot(port, slot);
|
||||||
switch (EmuConfig.Mcd[combinedSlot].Type)
|
switch (EmuConfig.Mcd[combinedSlot].Type)
|
||||||
{
|
{
|
||||||
case MemoryCardType::MemoryCard_File:
|
case MemoryCardType::File:
|
||||||
return Mcd::impl.GetCRC(combinedSlot);
|
return Mcd::impl.GetCRC(combinedSlot);
|
||||||
case MemoryCardType::MemoryCard_Folder:
|
case MemoryCardType::Folder:
|
||||||
return Mcd::implFolder.GetCRC(combinedSlot);
|
return Mcd::implFolder.GetCRC(combinedSlot);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -745,7 +745,7 @@ void FileMcd_NextFrame(uint port, uint slot)
|
||||||
//case MemoryCardType::MemoryCard_File:
|
//case MemoryCardType::MemoryCard_File:
|
||||||
// Mcd::impl.NextFrame( combinedSlot );
|
// Mcd::impl.NextFrame( combinedSlot );
|
||||||
// break;
|
// break;
|
||||||
case MemoryCardType::MemoryCard_Folder:
|
case MemoryCardType::Folder:
|
||||||
Mcd::implFolder.NextFrame(combinedSlot);
|
Mcd::implFolder.NextFrame(combinedSlot);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -758,10 +758,10 @@ bool FileMcd_ReIndex(uint port, uint slot, const wxString& filter)
|
||||||
const uint combinedSlot = FileMcd_ConvertToSlot(port, slot);
|
const uint combinedSlot = FileMcd_ConvertToSlot(port, slot);
|
||||||
switch (EmuConfig.Mcd[combinedSlot].Type)
|
switch (EmuConfig.Mcd[combinedSlot].Type)
|
||||||
{
|
{
|
||||||
//case MemoryCardType::MemoryCard_File:
|
//case MemoryCardType::File:
|
||||||
// return Mcd::impl.ReIndex( combinedSlot, filter );
|
// return Mcd::impl.ReIndex( combinedSlot, filter );
|
||||||
// break;
|
// break;
|
||||||
case MemoryCardType::MemoryCard_Folder:
|
case MemoryCardType::Folder:
|
||||||
return Mcd::implFolder.ReIndex(combinedSlot, EmuConfig.McdFolderAutoManage, filter);
|
return Mcd::implFolder.ReIndex(combinedSlot, EmuConfig.McdFolderAutoManage, filter);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -104,7 +104,7 @@ void FolderMemoryCard::Open(const wxString& fullPath, const Pcsx2Config::McdOpti
|
||||||
wxString str(configuredFileName.GetFullPath());
|
wxString str(configuredFileName.GetFullPath());
|
||||||
bool disabled = false;
|
bool disabled = false;
|
||||||
|
|
||||||
if (mcdOptions.Enabled && mcdOptions.Type == MemoryCardType::MemoryCard_Folder)
|
if (mcdOptions.Enabled && mcdOptions.Type == MemoryCardType::Folder)
|
||||||
{
|
{
|
||||||
if (configuredFileName.GetFullName().IsEmpty())
|
if (configuredFileName.GetFullName().IsEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -511,7 +511,7 @@ Pcsx2Config::Pcsx2Config()
|
||||||
Mcd[slot].Filename = FileMcd_GetDefaultName(slot);
|
Mcd[slot].Filename = FileMcd_GetDefaultName(slot);
|
||||||
|
|
||||||
// Folder memory card is autodetected later.
|
// Folder memory card is autodetected later.
|
||||||
Mcd[slot].Type = MemoryCardType::MemoryCard_File;
|
Mcd[slot].Type = MemoryCardType::File;
|
||||||
}
|
}
|
||||||
|
|
||||||
GzipIsoIndexTemplate = "$(f).pindex.tmp";
|
GzipIsoIndexTemplate = "$(f).pindex.tmp";
|
||||||
|
|
|
@ -62,7 +62,7 @@ Dialogs::ConvertMemoryCardDialog::ConvertMemoryCardDialog( wxWindow* parent, con
|
||||||
|
|
||||||
s_padding += m_radio_CardType | pxSizerFlags::StdExpand();
|
s_padding += m_radio_CardType | pxSizerFlags::StdExpand();
|
||||||
|
|
||||||
if ( type != MemoryCardType::MemoryCard_File ) {
|
if ( type != MemoryCardType::File ) {
|
||||||
s_padding += Heading( pxE( L"Please note that the resulting file may not actually contain all saves, depending on how many are in the source memory card." ) );
|
s_padding += Heading( pxE( L"Please note that the resulting file may not actually contain all saves, depending on how many are in the source memory card." ) );
|
||||||
}
|
}
|
||||||
s_padding += Heading( pxE( L"WARNING: Converting a memory card may take a while! Please do not close the emulator during the conversion process, even if the emulator is no longer responding to input." ) );
|
s_padding += Heading( pxE( L"WARNING: Converting a memory card may take a while! Please do not close the emulator during the conversion process, even if the emulator is no longer responding to input." ) );
|
||||||
|
@ -102,10 +102,10 @@ void Dialogs::ConvertMemoryCardDialog::CreateControls( const MemoryCardType sour
|
||||||
const RadioPanelItem tblForFolder[] = { toFile8MB, toFile16MB, toFile32MB, toFile64MB };
|
const RadioPanelItem tblForFolder[] = { toFile8MB, toFile16MB, toFile32MB, toFile64MB };
|
||||||
|
|
||||||
switch ( sourceType ) {
|
switch ( sourceType ) {
|
||||||
case MemoryCardType::MemoryCard_File:
|
case MemoryCardType::File:
|
||||||
m_radio_CardType = new pxRadioPanel( this, tblForFile );
|
m_radio_CardType = new pxRadioPanel( this, tblForFile );
|
||||||
break;
|
break;
|
||||||
case MemoryCardType::MemoryCard_Folder:
|
case MemoryCardType::Folder:
|
||||||
m_radio_CardType = new pxRadioPanel( this, tblForFolder );
|
m_radio_CardType = new pxRadioPanel( this, tblForFolder );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -177,7 +177,7 @@ bool Dialogs::ConvertMemoryCardDialog::ConvertToFile( const wxFileName& sourcePa
|
||||||
FolderMemoryCard sourceFolderMemoryCard;
|
FolderMemoryCard sourceFolderMemoryCard;
|
||||||
Pcsx2Config::McdOptions config;
|
Pcsx2Config::McdOptions config;
|
||||||
config.Enabled = true;
|
config.Enabled = true;
|
||||||
config.Type = MemoryCardType::MemoryCard_Folder;
|
config.Type = MemoryCardType::Folder;
|
||||||
sourceFolderMemoryCard.Open( sourcePath.GetFullPath(), config, ( sizeInMB * 1024 * 1024 ) / FolderMemoryCard::ClusterSize, false, L"" );
|
sourceFolderMemoryCard.Open( sourcePath.GetFullPath(), config, ( sizeInMB * 1024 * 1024 ) / FolderMemoryCard::ClusterSize, false, L"" );
|
||||||
|
|
||||||
u8 buffer[FolderMemoryCard::PageSizeRaw];
|
u8 buffer[FolderMemoryCard::PageSizeRaw];
|
||||||
|
@ -206,7 +206,7 @@ bool Dialogs::ConvertMemoryCardDialog::ConvertToFolder( const wxFileName& source
|
||||||
FolderMemoryCard targetFolderMemoryCard;
|
FolderMemoryCard targetFolderMemoryCard;
|
||||||
Pcsx2Config::McdOptions config;
|
Pcsx2Config::McdOptions config;
|
||||||
config.Enabled = true;
|
config.Enabled = true;
|
||||||
config.Type = MemoryCardType::MemoryCard_Folder;
|
config.Type = MemoryCardType::Folder;
|
||||||
u32 adr = 0;
|
u32 adr = 0;
|
||||||
|
|
||||||
for ( int i = 0; i < 2; ++i ) {
|
for ( int i = 0; i < 2; ++i ) {
|
||||||
|
|
|
@ -62,7 +62,7 @@ bool EnumerateMemoryCard(McdSlotItem& dest, const wxFileName& filename, const wx
|
||||||
dest.IsFormatted = false;
|
dest.IsFormatted = false;
|
||||||
dest.IsPresent = false;
|
dest.IsPresent = false;
|
||||||
dest.IsPSX = false;
|
dest.IsPSX = false;
|
||||||
dest.Type = MemoryCardType::MemoryCard_None;
|
dest.Type = MemoryCardType::Empty;
|
||||||
|
|
||||||
const wxString fullpath(filename.GetFullPath());
|
const wxString fullpath(filename.GetFullPath());
|
||||||
//DevCon.WriteLn( fullpath );
|
//DevCon.WriteLn( fullpath );
|
||||||
|
@ -93,7 +93,7 @@ bool EnumerateMemoryCard(McdSlotItem& dest, const wxFileName& filename, const wx
|
||||||
dest.SizeInMB = 1; // MegaBIT
|
dest.SizeInMB = 1; // MegaBIT
|
||||||
}
|
}
|
||||||
|
|
||||||
dest.Type = MemoryCardType::MemoryCard_File;
|
dest.Type = MemoryCardType::File;
|
||||||
dest.IsFormatted = IsMcdFormatted(mcdFile);
|
dest.IsFormatted = IsMcdFormatted(mcdFile);
|
||||||
filename.GetTimes(NULL, &dest.DateModified, &dest.DateCreated);
|
filename.GetTimes(NULL, &dest.DateModified, &dest.DateCreated);
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ bool EnumerateMemoryCard(McdSlotItem& dest, const wxFileName& filename, const wx
|
||||||
|
|
||||||
dest.SizeInMB = 0;
|
dest.SizeInMB = 0;
|
||||||
|
|
||||||
dest.Type = MemoryCardType::MemoryCard_Folder;
|
dest.Type = MemoryCardType::Folder;
|
||||||
dest.IsFormatted = IsMcdFormatted(mcdFile);
|
dest.IsFormatted = IsMcdFormatted(mcdFile);
|
||||||
superBlockFileName.GetTimes(NULL, &dest.DateModified, &dest.DateCreated);
|
superBlockFileName.GetTimes(NULL, &dest.DateModified, &dest.DateCreated);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ struct McdSlotItem
|
||||||
{
|
{
|
||||||
Slot = -1;
|
Slot = -1;
|
||||||
SizeInMB = 0;
|
SizeInMB = 0;
|
||||||
Type = MemoryCard_None;
|
Type = MemoryCardType::Empty;
|
||||||
|
|
||||||
IsPSX = false;
|
IsPSX = false;
|
||||||
IsPresent = false;
|
IsPresent = false;
|
||||||
|
|
Loading…
Reference in New Issue