mirror of https://github.com/PCSX2/pcsx2.git
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).
This commit is contained in:
parent
f7c0a910f8
commit
79d57e2949
|
@ -394,7 +394,7 @@ bool DoCDVDopen()
|
||||||
cdvdTD td;
|
cdvdTD td;
|
||||||
CDVD->getTD(0, &td);
|
CDVD->getTD(0, &td);
|
||||||
|
|
||||||
blockDumpFile.Create(temp, 3);
|
blockDumpFile.Create(temp, 2);
|
||||||
|
|
||||||
if( blockDumpFile.IsOpened() )
|
if( blockDumpFile.IsOpened() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -113,9 +113,8 @@ protected:
|
||||||
// total number of blocks in the ISO image (including all parts)
|
// total number of blocks in the ISO image (including all parts)
|
||||||
u32 m_blocks;
|
u32 m_blocks;
|
||||||
|
|
||||||
// dtable / dtablesize are used when reading blockdumps
|
// dtable is used when reading blockdumps
|
||||||
std::unique_ptr<u32[]> m_dtable;
|
std::vector<u32> m_dtable;
|
||||||
int m_dtablesize;
|
|
||||||
|
|
||||||
std::unique_ptr<wxFileOutputStream> m_outstream;
|
std::unique_ptr<wxFileOutputStream> m_outstream;
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,6 @@ void OutputIsoFile::_init()
|
||||||
m_blockofs = 0;
|
m_blockofs = 0;
|
||||||
m_blocksize = 0;
|
m_blocksize = 0;
|
||||||
m_blocks = 0;
|
m_blocks = 0;
|
||||||
|
|
||||||
m_dtable = 0;
|
|
||||||
m_dtablesize = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputIsoFile::Create(const wxString& filename, int version)
|
void OutputIsoFile::Create(const wxString& filename, int version)
|
||||||
|
@ -93,12 +90,10 @@ void OutputIsoFile::WriteSector(const u8* src, uint lsn)
|
||||||
if (m_version == 2)
|
if (m_version == 2)
|
||||||
{
|
{
|
||||||
// Find and ignore blocks that have already been dumped:
|
// Find and ignore blocks that have already been dumped:
|
||||||
for (int i=0; i<m_dtablesize; ++i)
|
if (std::any_of(std::begin(m_dtable), std::end(m_dtable), [=](const u32 entry) {return entry == lsn;}))
|
||||||
{
|
return;
|
||||||
if (m_dtable[i] == lsn) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_dtable[m_dtablesize++] = lsn;
|
m_dtable.push_back(lsn);
|
||||||
|
|
||||||
WriteValue<u32>( lsn );
|
WriteValue<u32>( lsn );
|
||||||
}
|
}
|
||||||
|
@ -114,7 +109,7 @@ void OutputIsoFile::WriteSector(const u8* src, uint lsn)
|
||||||
|
|
||||||
void OutputIsoFile::Close()
|
void OutputIsoFile::Close()
|
||||||
{
|
{
|
||||||
m_dtable.reset(nullptr);
|
m_dtable.clear();
|
||||||
|
|
||||||
_init();
|
_init();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue