cdvd: Fix writing of CD blockdumps

Write the full CD sector (not including subchannels) to a blockdump
instead of just a partial CD sector that isn't offset correctly.
This commit is contained in:
Jonathan Li 2018-01-23 19:07:25 +00:00
parent 79d57e2949
commit eeca9f61bf
3 changed files with 26 additions and 3 deletions

View File

@ -438,9 +438,18 @@ s32 DoCDVDreadSector(u8* buffer, u32 lsn, int mode)
int ret = CDVD->readSector(buffer,lsn,mode); int ret = CDVD->readSector(buffer,lsn,mode);
if (ret == 0 && blockDumpFile.IsOpened()) if (ret == 0 && blockDumpFile.IsOpened())
{
if (blockDumpFile.GetBlockSize() == CD_FRAMESIZE_RAW && mode != CDVD_MODE_2352)
{
u8 blockDumpBuffer[CD_FRAMESIZE_RAW];
if (CDVD->readSector(blockDumpBuffer, lsn, CDVD_MODE_2352) == 0)
blockDumpFile.WriteSector(blockDumpBuffer, lsn);
}
else
{ {
blockDumpFile.WriteSector(buffer, lsn); blockDumpFile.WriteSector(buffer, lsn);
} }
}
return ret; return ret;
} }
@ -477,9 +486,18 @@ s32 DoCDVDgetBuffer(u8* buffer)
int ret = CDVD->getBuffer2(buffer); int ret = CDVD->getBuffer2(buffer);
if (ret == 0 && blockDumpFile.IsOpened()) if (ret == 0 && blockDumpFile.IsOpened())
{
if (blockDumpFile.GetBlockSize() == CD_FRAMESIZE_RAW && lastReadSize != 2352)
{
u8 blockDumpBuffer[CD_FRAMESIZE_RAW];
if (CDVD->readSector(blockDumpBuffer, lastLSN, CDVD_MODE_2352) == 0)
blockDumpFile.WriteSector(blockDumpBuffer, lastLSN);
}
else
{ {
blockDumpFile.WriteSector(buffer, lastLSN); blockDumpFile.WriteSector(buffer, lastLSN);
} }
}
return ret; return ret;
} }

View File

@ -123,7 +123,7 @@ public:
virtual ~OutputIsoFile(); virtual ~OutputIsoFile();
bool IsOpened() const; bool IsOpened() const;
u32 GetBlockSize() const;
const wxString& GetFilename() const const wxString& GetFilename() const
{ {

View File

@ -133,3 +133,8 @@ bool OutputIsoFile::IsOpened() const
{ {
return m_outstream && m_outstream->IsOk(); return m_outstream && m_outstream->IsOk();
} }
u32 OutputIsoFile::GetBlockSize() const
{
return m_blocksize;
}