From 79d57e2949289ea92ca09fb045bd213b17d047b4 Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Tue, 23 Jan 2018 19:05:51 +0000 Subject: [PATCH] cdvd: Fix and switch to writing v2 format blockdumps Switch to using vector for the dump sector table, and also fix a bug where memory was not allocated when writing to a v2 format block dump, causing a null pointer dereference. Also switch to using the v2 block dump format, which generally produces smaller dump files (the dumps also seem smaller than the ones generated by cdvdiso, which seems to repeat sectors). --- pcsx2/CDVD/CDVDaccess.cpp | 2 +- pcsx2/CDVD/IsoFileFormats.h | 5 ++--- pcsx2/CDVD/OutputIsoFile.cpp | 13 ++++--------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/pcsx2/CDVD/CDVDaccess.cpp b/pcsx2/CDVD/CDVDaccess.cpp index 2adf7c10d6..9e9d166719 100644 --- a/pcsx2/CDVD/CDVDaccess.cpp +++ b/pcsx2/CDVD/CDVDaccess.cpp @@ -394,7 +394,7 @@ bool DoCDVDopen() cdvdTD td; CDVD->getTD(0, &td); - blockDumpFile.Create(temp, 3); + blockDumpFile.Create(temp, 2); if( blockDumpFile.IsOpened() ) { diff --git a/pcsx2/CDVD/IsoFileFormats.h b/pcsx2/CDVD/IsoFileFormats.h index 082bde3498..77ba8932cb 100644 --- a/pcsx2/CDVD/IsoFileFormats.h +++ b/pcsx2/CDVD/IsoFileFormats.h @@ -113,9 +113,8 @@ protected: // total number of blocks in the ISO image (including all parts) u32 m_blocks; - // dtable / dtablesize are used when reading blockdumps - std::unique_ptr m_dtable; - int m_dtablesize; + // dtable is used when reading blockdumps + std::vector m_dtable; std::unique_ptr m_outstream; diff --git a/pcsx2/CDVD/OutputIsoFile.cpp b/pcsx2/CDVD/OutputIsoFile.cpp index e77fa96f0c..695182958b 100644 --- a/pcsx2/CDVD/OutputIsoFile.cpp +++ b/pcsx2/CDVD/OutputIsoFile.cpp @@ -47,9 +47,6 @@ void OutputIsoFile::_init() m_blockofs = 0; m_blocksize = 0; m_blocks = 0; - - m_dtable = 0; - m_dtablesize = 0; } void OutputIsoFile::Create(const wxString& filename, int version) @@ -93,12 +90,10 @@ void OutputIsoFile::WriteSector(const u8* src, uint lsn) if (m_version == 2) { // Find and ignore blocks that have already been dumped: - for (int i=0; i( lsn ); } @@ -114,7 +109,7 @@ void OutputIsoFile::WriteSector(const u8* src, uint lsn) void OutputIsoFile::Close() { - m_dtable.reset(nullptr); + m_dtable.clear(); _init(); }