Merge pull request #2907 from lioncash/log
GCMemcard: Clean up memcard logging messages.
This commit is contained in:
commit
9ba7497a3f
|
@ -30,7 +30,7 @@ GCMemcard::GCMemcard(const std::string &filename, bool forceCreation, bool ascii
|
||||||
{
|
{
|
||||||
if (!AskYesNoT("\"%s\" does not exist.\n Create a new 16MB Memcard?", filename.c_str()))
|
if (!AskYesNoT("\"%s\" does not exist.\n Create a new 16MB Memcard?", filename.c_str()))
|
||||||
return;
|
return;
|
||||||
ascii = AskYesNoT("Format as ascii (NTSC\\PAL)?\nChoose no for sjis (NTSC-J)");
|
ascii = AskYesNoT("Format as ASCII (NTSC\\PAL)?\nChoose no for Shift JIS (NTSC-J)");
|
||||||
}
|
}
|
||||||
Format(ascii);
|
Format(ascii);
|
||||||
return;
|
return;
|
||||||
|
@ -42,18 +42,18 @@ GCMemcard::GCMemcard(const std::string &filename, bool forceCreation, bool ascii
|
||||||
SplitPath(filename, nullptr, nullptr, &fileType);
|
SplitPath(filename, nullptr, nullptr, &fileType);
|
||||||
if (strcasecmp(fileType.c_str(), ".raw") && strcasecmp(fileType.c_str(), ".gcp"))
|
if (strcasecmp(fileType.c_str(), ".raw") && strcasecmp(fileType.c_str(), ".gcp"))
|
||||||
{
|
{
|
||||||
PanicAlertT("File has the extension \"%s\"\nvalid extensions are (.raw/.gcp)", fileType.c_str());
|
PanicAlertT("File has the extension \"%s\".\nValid extensions are (.raw/.gcp)", fileType.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto size = mcdFile.GetSize();
|
auto size = mcdFile.GetSize();
|
||||||
if (size < MC_FST_BLOCKS*BLOCK_SIZE)
|
if (size < MC_FST_BLOCKS*BLOCK_SIZE)
|
||||||
{
|
{
|
||||||
PanicAlertT("%s failed to load as a memorycard \nfile is not large enough to be a valid memory card file (0x%x bytes)", filename.c_str(), (unsigned) size);
|
PanicAlertT("%s failed to load as a memory card.\nFile is not large enough to be a valid memory card file (0x%x bytes)", filename.c_str(), (unsigned) size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (size % BLOCK_SIZE)
|
if (size % BLOCK_SIZE)
|
||||||
{
|
{
|
||||||
PanicAlertT("%s failed to load as a memorycard \n Card file size is invalid (0x%x bytes)", filename.c_str(), (unsigned) size);
|
PanicAlertT("%s failed to load as a memory card.\nCard file size is invalid (0x%x bytes)", filename.c_str(), (unsigned) size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ GCMemcard::GCMemcard(const std::string &filename, bool forceCreation, bool ascii
|
||||||
case MemCard2043Mb:
|
case MemCard2043Mb:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PanicAlertT("%s failed to load as a memorycard \n Card size is invalid (0x%x bytes)", filename.c_str(), (unsigned) size);
|
PanicAlertT("%s failed to load as a memory card.\nCard size is invalid (0x%x bytes)", filename.c_str(), (unsigned) size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ GCMemcard::GCMemcard(const std::string &filename, bool forceCreation, bool ascii
|
||||||
}
|
}
|
||||||
if (m_sizeMb != BE16(hdr.SizeMb))
|
if (m_sizeMb != BE16(hdr.SizeMb))
|
||||||
{
|
{
|
||||||
PanicAlertT("Memorycard filesize does not match the header size");
|
PanicAlertT("Memory card file size does not match the header size");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ GCMemcard::GCMemcard(const std::string &filename, bool forceCreation, bool ascii
|
||||||
if (csums & 0x4)
|
if (csums & 0x4)
|
||||||
{
|
{
|
||||||
// backup is also wrong!
|
// backup is also wrong!
|
||||||
PanicAlertT("Directory checksum failed\n and Directory backup checksum failed");
|
PanicAlertT("Directory checksum and directory backup checksum failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -181,7 +181,7 @@ GCMemcard::GCMemcard(const std::string &filename, bool forceCreation, bool ascii
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PanicAlertT("Failed to read block %d of the save data\nMemcard may be truncated\nFilePosition:%" PRIx64, i, mcdFile.Tell());
|
PanicAlertT("Failed to read block %u of the save data\nMemcard may be truncated\nFile position: 0x%" PRIx64, i, mcdFile.Tell());
|
||||||
m_valid = false;
|
m_valid = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::IVolume::EC
|
||||||
// in reality, there are not likely any valid gci files > 251 blocks
|
// in reality, there are not likely any valid gci files > 251 blocks
|
||||||
if (numBlocks > 2043)
|
if (numBlocks > 2043)
|
||||||
{
|
{
|
||||||
PanicAlertT("%s\nwas not loaded because it is an invalid gci.\n Number of blocks claimed to be %d",
|
PanicAlertT("%s\nwas not loaded because it is an invalid GCI.\n Number of blocks claimed to be %u",
|
||||||
gci.m_filename.c_str(), numBlocks);
|
gci.m_filename.c_str(), numBlocks);
|
||||||
return NO_INDEX;
|
return NO_INDEX;
|
||||||
}
|
}
|
||||||
|
@ -83,8 +83,8 @@ int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::IVolume::EC
|
||||||
u64 file_size = gcifile.GetSize();
|
u64 file_size = gcifile.GetSize();
|
||||||
if (file_size != size + DENTRY_SIZE)
|
if (file_size != size + DENTRY_SIZE)
|
||||||
{
|
{
|
||||||
PanicAlertT("%s\nwas not loaded because it is an invalid gci.\n File size (%" PRIx64
|
PanicAlertT("%s\nwas not loaded because it is an invalid GCI.\n File size (0x%" PRIx64
|
||||||
") does not match the size recorded in the header (%d)",
|
") does not match the size recorded in the header (0x%x)",
|
||||||
gci.m_filename.c_str(), file_size, size + DENTRY_SIZE);
|
gci.m_filename.c_str(), file_size, size + DENTRY_SIZE);
|
||||||
return NO_INDEX;
|
return NO_INDEX;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::IVolume::EC
|
||||||
if (totalBlocks > freeBlocks * 10)
|
if (totalBlocks > freeBlocks * 10)
|
||||||
{
|
{
|
||||||
|
|
||||||
PanicAlertT("%s\nwas not loaded because there is less than 10%% free space on the memorycard\n"\
|
PanicAlertT("%s\nwas not loaded because there is less than 10%% free blocks available on the memory card\n"\
|
||||||
"Total Blocks: %d; Free Blocks: %d",
|
"Total Blocks: %d; Free Blocks: %d",
|
||||||
gci.m_filename.c_str(), totalBlocks, freeBlocks);
|
gci.m_filename.c_str(), totalBlocks, freeBlocks);
|
||||||
return NO_INDEX;
|
return NO_INDEX;
|
||||||
|
@ -113,7 +113,7 @@ int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::IVolume::EC
|
||||||
u16 first_block = m_bat1.AssignBlocksContiguous(numBlocks);
|
u16 first_block = m_bat1.AssignBlocksContiguous(numBlocks);
|
||||||
if (first_block == 0xFFFF)
|
if (first_block == 0xFFFF)
|
||||||
{
|
{
|
||||||
PanicAlertT("%s\nwas not loaded because there are not enough free blocks on virtual memorycard",
|
PanicAlertT("%s\nwas not loaded because there are not enough free blocks on the virtual memory card",
|
||||||
fileName.c_str());
|
fileName.c_str());
|
||||||
return NO_INDEX;
|
return NO_INDEX;
|
||||||
}
|
}
|
||||||
|
@ -155,9 +155,8 @@ GCMemcardDirectory::GCMemcardDirectory(const std::string& directory, int slot, u
|
||||||
|
|
||||||
if (rFilenames.size() > 112)
|
if (rFilenames.size() > 112)
|
||||||
{
|
{
|
||||||
Core::DisplayMessage(
|
Core::DisplayMessage("Warning: There are more than 112 save files on this memory card.\n"
|
||||||
StringFromFormat("WARNING: There are more than 112 save files on this memorycards"\
|
" Only loading the first 112 in the folder, unless the game ID is the same as the current game's ID",
|
||||||
"\n Only loading the first 112 in the folder, unless the gameid is the current games id"),
|
|
||||||
4000);
|
4000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +164,7 @@ GCMemcardDirectory::GCMemcardDirectory(const std::string& directory, int slot, u
|
||||||
{
|
{
|
||||||
if (m_saves.size() == DIRLEN)
|
if (m_saves.size() == DIRLEN)
|
||||||
{
|
{
|
||||||
PanicAlertT("There are too many gci files in the folder\n%s\nOnly the first 127 will be available",
|
PanicAlertT("There are too many GCI files in the folder\n%s.\nOnly the first 127 will be available",
|
||||||
m_SaveDirectory.c_str());
|
m_SaveDirectory.c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -194,7 +193,7 @@ void GCMemcardDirectory::FlushThread()
|
||||||
|
|
||||||
|
|
||||||
Common::SetCurrentThreadName(
|
Common::SetCurrentThreadName(
|
||||||
StringFromFormat("Memcard%x-Flush", card_index).c_str());
|
StringFromFormat("Memcard %d flushing thread", card_index).c_str());
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
@ -291,7 +290,7 @@ s32 GCMemcardDirectory::Write(u32 destaddress, s32 length, u8 *srcaddress)
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> l(m_write_mutex);
|
std::unique_lock<std::mutex> l(m_write_mutex);
|
||||||
if (length != 0x80)
|
if (length != 0x80)
|
||||||
INFO_LOG(EXPANSIONINTERFACE, "WRITING TO %x, len %x", destaddress, length);
|
INFO_LOG(EXPANSIONINTERFACE, "Writing to 0x%x. Length: 0x%x", destaddress, length);
|
||||||
s32 block = destaddress / BLOCK_SIZE;
|
s32 block = destaddress / BLOCK_SIZE;
|
||||||
u32 offset = destaddress % BLOCK_SIZE;
|
u32 offset = destaddress % BLOCK_SIZE;
|
||||||
s32 extra = 0; // used for write calls that are across multiple blocks
|
s32 extra = 0; // used for write calls that are across multiple blocks
|
||||||
|
@ -338,7 +337,7 @@ s32 GCMemcardDirectory::Write(u32 destaddress, s32 length, u8 *srcaddress)
|
||||||
m_LastBlock = SaveAreaRW(block, true);
|
m_LastBlock = SaveAreaRW(block, true);
|
||||||
if (m_LastBlock == -1)
|
if (m_LastBlock == -1)
|
||||||
{
|
{
|
||||||
PanicAlertT("Report: GCIFolder Writing to unallocated block %x", block);
|
PanicAlertT("Report: GCIFolder Writing to unallocated block 0x%x", block);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -363,7 +362,7 @@ void GCMemcardDirectory::ClearBlock(u32 address)
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 block = address / BLOCK_SIZE;
|
u32 block = address / BLOCK_SIZE;
|
||||||
INFO_LOG(EXPANSIONINTERFACE, "clearing block %d", block);
|
INFO_LOG(EXPANSIONINTERFACE, "Clearing block %u", block);
|
||||||
switch (block)
|
switch (block)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -407,7 +406,7 @@ inline void GCMemcardDirectory::SyncSaves()
|
||||||
{
|
{
|
||||||
if (BE32(current->Dir[i].Gamecode) != 0xFFFFFFFF)
|
if (BE32(current->Dir[i].Gamecode) != 0xFFFFFFFF)
|
||||||
{
|
{
|
||||||
INFO_LOG(EXPANSIONINTERFACE, "Syncing Save %x", *(u32 *)&(current->Dir[i].Gamecode));
|
INFO_LOG(EXPANSIONINTERFACE, "Syncing save 0x%x", *(u32 *)&(current->Dir[i].Gamecode));
|
||||||
bool added = false;
|
bool added = false;
|
||||||
while (i >= m_saves.size())
|
while (i >= m_saves.size())
|
||||||
{
|
{
|
||||||
|
@ -427,13 +426,13 @@ inline void GCMemcardDirectory::SyncSaves()
|
||||||
if ((gamecode != 0xFFFFFFFF)
|
if ((gamecode != 0xFFFFFFFF)
|
||||||
&& (gamecode != newGameCode))
|
&& (gamecode != newGameCode))
|
||||||
{
|
{
|
||||||
PanicAlertT("Game overwrote with another games save, data corruption ahead %x, %x ",
|
PanicAlertT("Game overwrote with another games save. Data corruption ahead 0x%x, 0x%x",
|
||||||
BE32(m_saves[i].m_gci_header.Gamecode), BE32(current->Dir[i].Gamecode));
|
BE32(m_saves[i].m_gci_header.Gamecode), BE32(current->Dir[i].Gamecode));
|
||||||
}
|
}
|
||||||
memcpy((u8 *)&(m_saves[i].m_gci_header), (u8 *)&(current->Dir[i]), DENTRY_SIZE);
|
memcpy((u8 *)&(m_saves[i].m_gci_header), (u8 *)&(current->Dir[i]), DENTRY_SIZE);
|
||||||
if (old_start != new_start)
|
if (old_start != new_start)
|
||||||
{
|
{
|
||||||
INFO_LOG(EXPANSIONINTERFACE, "Save moved from %x to %x", old_start, new_start);
|
INFO_LOG(EXPANSIONINTERFACE, "Save moved from 0x%x to 0x%x", old_start, new_start);
|
||||||
m_saves[i].m_used_blocks.clear();
|
m_saves[i].m_used_blocks.clear();
|
||||||
m_saves[i].m_save_data.clear();
|
m_saves[i].m_save_data.clear();
|
||||||
}
|
}
|
||||||
|
@ -445,7 +444,7 @@ inline void GCMemcardDirectory::SyncSaves()
|
||||||
}
|
}
|
||||||
else if ((i < m_saves.size()) && (*(u32 *)&(m_saves[i].m_gci_header) != 0xFFFFFFFF))
|
else if ((i < m_saves.size()) && (*(u32 *)&(m_saves[i].m_gci_header) != 0xFFFFFFFF))
|
||||||
{
|
{
|
||||||
INFO_LOG(EXPANSIONINTERFACE, "Clearing and/or Deleting Save %x", BE32(m_saves[i].m_gci_header.Gamecode));
|
INFO_LOG(EXPANSIONINTERFACE, "Clearing and/or deleting save 0x%x", BE32(m_saves[i].m_gci_header.Gamecode));
|
||||||
*(u32 *)&(m_saves[i].m_gci_header.Gamecode) = 0xFFFFFFFF;
|
*(u32 *)&(m_saves[i].m_gci_header.Gamecode) = 0xFFFFFFFF;
|
||||||
m_saves[i].m_save_data.clear();
|
m_saves[i].m_save_data.clear();
|
||||||
m_saves[i].m_used_blocks.clear();
|
m_saves[i].m_used_blocks.clear();
|
||||||
|
@ -527,7 +526,7 @@ bool GCMemcardDirectory::SetUsedBlocks(int saveIndex)
|
||||||
block = currentBat->GetNextBlock(block);
|
block = currentBat->GetNextBlock(block);
|
||||||
if (block == 0)
|
if (block == 0)
|
||||||
{
|
{
|
||||||
PanicAlertT("BAT Incorrect, Dolphin will now exit");
|
PanicAlertT("BAT incorrect. Dolphin will now exit");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -536,7 +535,8 @@ bool GCMemcardDirectory::SetUsedBlocks(int saveIndex)
|
||||||
u16 blocksFromBat = (u16)m_saves[saveIndex].m_used_blocks.size();
|
u16 blocksFromBat = (u16)m_saves[saveIndex].m_used_blocks.size();
|
||||||
if (blocksFromBat != num_blocks)
|
if (blocksFromBat != num_blocks)
|
||||||
{
|
{
|
||||||
PanicAlertT("Warning BAT number of blocks %d does not match file header loaded %d", blocksFromBat, num_blocks);
|
PanicAlertT("Warning: Number of blocks indicated by the BAT (%u) does not match that of the loaded file header (%u)",
|
||||||
|
blocksFromBat, num_blocks);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,7 +567,7 @@ void GCMemcardDirectory::FlushToFile()
|
||||||
defaultSaveName.insert(defaultSaveName.end() - 4, '0');
|
defaultSaveName.insert(defaultSaveName.end() - 4, '0');
|
||||||
}
|
}
|
||||||
if (File::Exists(defaultSaveName))
|
if (File::Exists(defaultSaveName))
|
||||||
PanicAlertT("Failed to find new filename\n %s\n will be overwritten", defaultSaveName.c_str());
|
PanicAlertT("Failed to find new filename.\n%s\n will be overwritten", defaultSaveName.c_str());
|
||||||
m_saves[i].m_filename = defaultSaveName;
|
m_saves[i].m_filename = defaultSaveName;
|
||||||
}
|
}
|
||||||
File::IOFile GCI(m_saves[i].m_filename, "wb");
|
File::IOFile GCI(m_saves[i].m_filename, "wb");
|
||||||
|
@ -660,7 +660,7 @@ bool GCIFile::LoadSaveBlocks()
|
||||||
m_save_data.resize(num_blocks);
|
m_save_data.resize(num_blocks);
|
||||||
if (!savefile.ReadBytes(m_save_data.data(), num_blocks * BLOCK_SIZE))
|
if (!savefile.ReadBytes(m_save_data.data(), num_blocks * BLOCK_SIZE))
|
||||||
{
|
{
|
||||||
PanicAlertT("Failed to read data from gci file %s", m_filename.c_str());
|
PanicAlertT("Failed to read data from GCI file %s", m_filename.c_str());
|
||||||
m_save_data.clear();
|
m_save_data.clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ MemoryCard::MemoryCard(const std::string& filename, int _card_index, u16 sizeMb)
|
||||||
GCMemcard::Format(&m_memcard_data[0], m_filename.find(".JAP.raw") != std::string::npos, sizeMb);
|
GCMemcard::Format(&m_memcard_data[0], m_filename.find(".JAP.raw") != std::string::npos, sizeMb);
|
||||||
memset(&m_memcard_data[MC_HDR_SIZE], 0xFF, memory_card_size - MC_HDR_SIZE);
|
memset(&m_memcard_data[MC_HDR_SIZE], 0xFF, memory_card_size - MC_HDR_SIZE);
|
||||||
|
|
||||||
INFO_LOG(EXPANSIONINTERFACE, "No memory card found - a new one was created.");
|
INFO_LOG(EXPANSIONINTERFACE, "No memory card found. A new one was created instead.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Class members (including inherited ones) have now been initialized, so
|
// Class members (including inherited ones) have now been initialized, so
|
||||||
|
@ -69,7 +69,7 @@ void MemoryCard::FlushThread()
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::SetCurrentThreadName(
|
Common::SetCurrentThreadName(
|
||||||
StringFromFormat("Memcard%x-Flush", card_index).c_str());
|
StringFromFormat("Memcard %d flushing thread", card_index).c_str());
|
||||||
|
|
||||||
const auto flush_interval = std::chrono::seconds(15);
|
const auto flush_interval = std::chrono::seconds(15);
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ s32 MemoryCard::Read(u32 srcaddress, s32 length, u8 *destaddress)
|
||||||
{
|
{
|
||||||
if (!IsAddressInBounds(srcaddress))
|
if (!IsAddressInBounds(srcaddress))
|
||||||
{
|
{
|
||||||
PanicAlertT("MemoryCard: Read called with invalid source address, %x",
|
PanicAlertT("MemoryCard: Read called with invalid source address (0x%x)",
|
||||||
srcaddress);
|
srcaddress);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ s32 MemoryCard::Write(u32 destaddress, s32 length, u8 *srcaddress)
|
||||||
{
|
{
|
||||||
if (!IsAddressInBounds(destaddress))
|
if (!IsAddressInBounds(destaddress))
|
||||||
{
|
{
|
||||||
PanicAlertT("MemoryCard: Write called with invalid destination address, %x",
|
PanicAlertT("MemoryCard: Write called with invalid destination address (0x%x)",
|
||||||
destaddress);
|
destaddress);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ void MemoryCard::ClearBlock(u32 address)
|
||||||
{
|
{
|
||||||
if (address & (BLOCK_SIZE - 1) || !IsAddressInBounds(address))
|
if (address & (BLOCK_SIZE - 1) || !IsAddressInBounds(address))
|
||||||
{
|
{
|
||||||
PanicAlertT("MemoryCard: ClearBlock called on invalid address %x",
|
PanicAlertT("MemoryCard: ClearBlock called on invalid address (0x%x)",
|
||||||
address);
|
address);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue