mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-09 15:49:25 +01:00
GCMemcard: Remove unused ability of ImportGci() to write a GCI file to disk.
This commit is contained in:
parent
018572018e
commit
e390fd0f4e
@ -837,22 +837,20 @@ GCMemcardImportFileRetVal GCMemcard::CopyFrom(const GCMemcard& source, u8 index)
|
||||
}
|
||||
}
|
||||
|
||||
GCMemcardImportFileRetVal GCMemcard::ImportGci(const std::string& inputFile,
|
||||
const std::string& outputFile)
|
||||
GCMemcardImportFileRetVal GCMemcard::ImportGci(const std::string& inputFile)
|
||||
{
|
||||
if (outputFile.empty() && !m_valid)
|
||||
if (!m_valid)
|
||||
return GCMemcardImportFileRetVal::OPENFAIL;
|
||||
|
||||
File::IOFile gci(inputFile, "rb");
|
||||
if (!gci)
|
||||
return GCMemcardImportFileRetVal::OPENFAIL;
|
||||
|
||||
return ImportGciInternal(std::move(gci), inputFile, outputFile);
|
||||
return ImportGciInternal(std::move(gci), inputFile);
|
||||
}
|
||||
|
||||
GCMemcardImportFileRetVal GCMemcard::ImportGciInternal(File::IOFile&& gci,
|
||||
const std::string& inputFile,
|
||||
const std::string& outputFile)
|
||||
const std::string& inputFile)
|
||||
{
|
||||
unsigned int offset;
|
||||
std::string fileType;
|
||||
@ -907,39 +905,7 @@ GCMemcardImportFileRetVal GCMemcard::ImportGciInternal(File::IOFile&& gci,
|
||||
gci.ReadBytes(b.m_block.data(), b.m_block.size());
|
||||
saveData.push_back(b);
|
||||
}
|
||||
GCMemcardImportFileRetVal ret;
|
||||
if (!outputFile.empty())
|
||||
{
|
||||
File::IOFile gci2(outputFile, "wb");
|
||||
bool completeWrite = true;
|
||||
if (!gci2)
|
||||
{
|
||||
return GCMemcardImportFileRetVal::OPENFAIL;
|
||||
}
|
||||
gci2.Seek(0, SEEK_SET);
|
||||
|
||||
if (!gci2.WriteBytes(&tempDEntry, DENTRY_SIZE))
|
||||
completeWrite = false;
|
||||
int fileBlocks = tempDEntry.m_block_count;
|
||||
gci2.Seek(DENTRY_SIZE, SEEK_SET);
|
||||
|
||||
for (int i = 0; i < fileBlocks; ++i)
|
||||
{
|
||||
if (!gci2.WriteBytes(saveData[i].m_block.data(), saveData[i].m_block.size()))
|
||||
completeWrite = false;
|
||||
}
|
||||
|
||||
// TODO: This is interpreted as failure by the calling code if it only checks for SUCCESS.
|
||||
// What is the logic here?
|
||||
if (completeWrite)
|
||||
ret = GCMemcardImportFileRetVal::GCS;
|
||||
else
|
||||
ret = GCMemcardImportFileRetVal::WRITEFAIL;
|
||||
}
|
||||
else
|
||||
ret = ImportFile(tempDEntry, saveData);
|
||||
|
||||
return ret;
|
||||
return ImportFile(tempDEntry, saveData);
|
||||
}
|
||||
|
||||
GCMemcardExportFileRetVal GCMemcard::ExportGci(u8 index, const std::string& fileName,
|
||||
|
@ -60,8 +60,6 @@ enum class GCMemcardImportFileRetVal
|
||||
SAVFAIL,
|
||||
OPENFAIL,
|
||||
LENGTHFAIL,
|
||||
WRITEFAIL,
|
||||
GCS,
|
||||
};
|
||||
|
||||
enum class GCMemcardExportFileRetVal
|
||||
@ -380,8 +378,7 @@ private:
|
||||
int m_active_directory;
|
||||
int m_active_bat;
|
||||
|
||||
GCMemcardImportFileRetVal ImportGciInternal(File::IOFile&& gci, const std::string& inputFile,
|
||||
const std::string& outputFile);
|
||||
GCMemcardImportFileRetVal ImportGciInternal(File::IOFile&& gci, const std::string& inputFile);
|
||||
void InitActiveDirBat();
|
||||
|
||||
const Directory& GetActiveDirectory() const;
|
||||
@ -456,8 +453,8 @@ public:
|
||||
// reads a save from another memcard, and imports the data into this memcard
|
||||
GCMemcardImportFileRetVal CopyFrom(const GCMemcard& source, u8 index);
|
||||
|
||||
// reads a .gci/.gcs/.sav file and calls ImportFile or saves out a gci file
|
||||
GCMemcardImportFileRetVal ImportGci(const std::string& inputFile, const std::string& outputFile);
|
||||
// reads a .gci/.gcs/.sav file and calls ImportFile
|
||||
GCMemcardImportFileRetVal ImportGci(const std::string& inputFile);
|
||||
|
||||
// writes a .gci file to disk containing index
|
||||
GCMemcardExportFileRetVal ExportGci(u8 index, const std::string& fileName,
|
||||
|
@ -330,7 +330,7 @@ void GCMemcardManager::ImportFile()
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
const auto result = m_slot_memcard[m_active_slot]->ImportGci(path.toStdString(), "");
|
||||
const auto result = m_slot_memcard[m_active_slot]->ImportGci(path.toStdString());
|
||||
|
||||
if (result != GCMemcardImportFileRetVal::SUCCESS)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user