mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +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,
|
GCMemcardImportFileRetVal GCMemcard::ImportGci(const std::string& inputFile)
|
||||||
const std::string& outputFile)
|
|
||||||
{
|
{
|
||||||
if (outputFile.empty() && !m_valid)
|
if (!m_valid)
|
||||||
return GCMemcardImportFileRetVal::OPENFAIL;
|
return GCMemcardImportFileRetVal::OPENFAIL;
|
||||||
|
|
||||||
File::IOFile gci(inputFile, "rb");
|
File::IOFile gci(inputFile, "rb");
|
||||||
if (!gci)
|
if (!gci)
|
||||||
return GCMemcardImportFileRetVal::OPENFAIL;
|
return GCMemcardImportFileRetVal::OPENFAIL;
|
||||||
|
|
||||||
return ImportGciInternal(std::move(gci), inputFile, outputFile);
|
return ImportGciInternal(std::move(gci), inputFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
GCMemcardImportFileRetVal GCMemcard::ImportGciInternal(File::IOFile&& gci,
|
GCMemcardImportFileRetVal GCMemcard::ImportGciInternal(File::IOFile&& gci,
|
||||||
const std::string& inputFile,
|
const std::string& inputFile)
|
||||||
const std::string& outputFile)
|
|
||||||
{
|
{
|
||||||
unsigned int offset;
|
unsigned int offset;
|
||||||
std::string fileType;
|
std::string fileType;
|
||||||
@ -907,39 +905,7 @@ GCMemcardImportFileRetVal GCMemcard::ImportGciInternal(File::IOFile&& gci,
|
|||||||
gci.ReadBytes(b.m_block.data(), b.m_block.size());
|
gci.ReadBytes(b.m_block.data(), b.m_block.size());
|
||||||
saveData.push_back(b);
|
saveData.push_back(b);
|
||||||
}
|
}
|
||||||
GCMemcardImportFileRetVal ret;
|
return ImportFile(tempDEntry, saveData);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GCMemcardExportFileRetVal GCMemcard::ExportGci(u8 index, const std::string& fileName,
|
GCMemcardExportFileRetVal GCMemcard::ExportGci(u8 index, const std::string& fileName,
|
||||||
|
@ -60,8 +60,6 @@ enum class GCMemcardImportFileRetVal
|
|||||||
SAVFAIL,
|
SAVFAIL,
|
||||||
OPENFAIL,
|
OPENFAIL,
|
||||||
LENGTHFAIL,
|
LENGTHFAIL,
|
||||||
WRITEFAIL,
|
|
||||||
GCS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class GCMemcardExportFileRetVal
|
enum class GCMemcardExportFileRetVal
|
||||||
@ -380,8 +378,7 @@ private:
|
|||||||
int m_active_directory;
|
int m_active_directory;
|
||||||
int m_active_bat;
|
int m_active_bat;
|
||||||
|
|
||||||
GCMemcardImportFileRetVal ImportGciInternal(File::IOFile&& gci, const std::string& inputFile,
|
GCMemcardImportFileRetVal ImportGciInternal(File::IOFile&& gci, const std::string& inputFile);
|
||||||
const std::string& outputFile);
|
|
||||||
void InitActiveDirBat();
|
void InitActiveDirBat();
|
||||||
|
|
||||||
const Directory& GetActiveDirectory() const;
|
const Directory& GetActiveDirectory() const;
|
||||||
@ -456,8 +453,8 @@ public:
|
|||||||
// reads a save from another memcard, and imports the data into this memcard
|
// reads a save from another memcard, and imports the data into this memcard
|
||||||
GCMemcardImportFileRetVal CopyFrom(const GCMemcard& source, u8 index);
|
GCMemcardImportFileRetVal CopyFrom(const GCMemcard& source, u8 index);
|
||||||
|
|
||||||
// reads a .gci/.gcs/.sav file and calls ImportFile or saves out a gci file
|
// reads a .gci/.gcs/.sav file and calls ImportFile
|
||||||
GCMemcardImportFileRetVal ImportGci(const std::string& inputFile, const std::string& outputFile);
|
GCMemcardImportFileRetVal ImportGci(const std::string& inputFile);
|
||||||
|
|
||||||
// writes a .gci file to disk containing index
|
// writes a .gci file to disk containing index
|
||||||
GCMemcardExportFileRetVal ExportGci(u8 index, const std::string& fileName,
|
GCMemcardExportFileRetVal ExportGci(u8 index, const std::string& fileName,
|
||||||
|
@ -330,7 +330,7 @@ void GCMemcardManager::ImportFile()
|
|||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return;
|
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)
|
if (result != GCMemcardImportFileRetVal::SUCCESS)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user