DiscExtractor: Don't hardcode names in ExportApploader and ExportDOL

This commit is contained in:
JosJuice 2017-06-17 16:53:55 +02:00
parent 89c901780e
commit baf3a3b188
3 changed files with 12 additions and 10 deletions

View File

@ -72,7 +72,7 @@ bool ExportFile(const Volume& volume, const Partition& partition, const FileInfo
} }
bool ExportApploader(const Volume& volume, const Partition& partition, bool ExportApploader(const Volume& volume, const Partition& partition,
const std::string& export_folder) const std::string& export_filename)
{ {
if (!IsDisc(volume.GetVolumeType())) if (!IsDisc(volume.GetVolumeType()))
return false; return false;
@ -85,7 +85,7 @@ bool ExportApploader(const Volume& volume, const Partition& partition,
*apploader_size += *trailer_size + header_size; *apploader_size += *trailer_size + header_size;
DEBUG_LOG(DISCIO, "Apploader size -> %x", *apploader_size); DEBUG_LOG(DISCIO, "Apploader size -> %x", *apploader_size);
return ExportData(volume, partition, 0x2440, *apploader_size, export_folder + "/apploader.img"); return ExportData(volume, partition, 0x2440, *apploader_size, export_filename);
} }
std::optional<u64> GetBootDOLOffset(const Volume& volume, const Partition& partition) std::optional<u64> GetBootDOLOffset(const Volume& volume, const Partition& partition)
@ -129,7 +129,7 @@ std::optional<u32> GetBootDOLSize(const Volume& volume, const Partition& partiti
return dol_size; return dol_size;
} }
bool ExportDOL(const Volume& volume, const Partition& partition, const std::string& export_folder) bool ExportDOL(const Volume& volume, const Partition& partition, const std::string& export_filename)
{ {
if (!IsDisc(volume.GetVolumeType())) if (!IsDisc(volume.GetVolumeType()))
return false; return false;
@ -141,7 +141,7 @@ bool ExportDOL(const Volume& volume, const Partition& partition, const std::stri
if (!dol_size) if (!dol_size)
return false; return false;
return ExportData(volume, partition, *dol_offset, *dol_size, export_folder + "/boot.dol"); return ExportData(volume, partition, *dol_offset, *dol_size, export_filename);
} }
} // namespace DiscIO } // namespace DiscIO

View File

@ -21,9 +21,10 @@ bool ExportData(const Volume& volume, const Partition& partition, u64 offset, u6
bool ExportFile(const Volume& volume, const Partition& partition, const FileInfo* file_info, bool ExportFile(const Volume& volume, const Partition& partition, const FileInfo* file_info,
const std::string& export_filename); const std::string& export_filename);
bool ExportApploader(const Volume& volume, const Partition& partition, bool ExportApploader(const Volume& volume, const Partition& partition,
const std::string& export_folder); const std::string& export_filename);
std::optional<u64> GetBootDOLOffset(const Volume& volume, const Partition& partition); std::optional<u64> GetBootDOLOffset(const Volume& volume, const Partition& partition);
std::optional<u32> GetBootDOLSize(const Volume& volume, const Partition& partition, u64 dol_offset); std::optional<u32> GetBootDOLSize(const Volume& volume, const Partition& partition, u64 dol_offset);
bool ExportDOL(const Volume& volume, const Partition& partition, const std::string& export_folder); bool ExportDOL(const Volume& volume, const Partition& partition,
const std::string& export_filename);
} // namespace DiscIO } // namespace DiscIO

View File

@ -283,11 +283,11 @@ void FilesystemPanel::OnExtractHeaderData(wxCommandEvent& event)
bool ret = false; bool ret = false;
if (event.GetId() == ID_EXTRACT_APPLOADER) if (event.GetId() == ID_EXTRACT_APPLOADER)
{ {
ret = DiscIO::ExportApploader(*m_opened_iso, partition, WxStrToStr(path)); ret = DiscIO::ExportApploader(*m_opened_iso, partition, WxStrToStr(path) + "/apploader.img");
} }
else if (event.GetId() == ID_EXTRACT_DOL) else if (event.GetId() == ID_EXTRACT_DOL)
{ {
ret = DiscIO::ExportDOL(*m_opened_iso, partition, WxStrToStr(path)); ret = DiscIO::ExportDOL(*m_opened_iso, partition, WxStrToStr(path) + "/boot.dol");
} }
if (!ret) if (!ret)
@ -437,8 +437,9 @@ void FilesystemPanel::ExtractDirectories(const std::string& full_path,
{ {
if (full_path.empty()) // Root if (full_path.empty()) // Root
{ {
DiscIO::ExportApploader(*m_opened_iso, filesystem.GetPartition(), output_folder); DiscIO::ExportApploader(*m_opened_iso, filesystem.GetPartition(),
DiscIO::ExportDOL(*m_opened_iso, filesystem.GetPartition(), output_folder); output_folder + "/apploader.img");
DiscIO::ExportDOL(*m_opened_iso, filesystem.GetPartition(), output_folder + "/boot.dol");
} }
std::unique_ptr<DiscIO::FileInfo> file_info = filesystem.FindFileInfo(full_path); std::unique_ptr<DiscIO::FileInfo> file_info = filesystem.FindFileInfo(full_path);