From befc637441a79a6f58086685d4678168f225cdcd Mon Sep 17 00:00:00 2001 From: gigaherz Date: Sun, 2 Dec 2012 14:20:42 +0000 Subject: [PATCH] async-iso: Uncomment and fix the blockdump creation code. git-svn-id: http://pcsx2.googlecode.com/svn/branches/async-iso@5471 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/CDVD/CDVDaccess.cpp | 20 +++++----- pcsx2/CDVD/IsoFileFormats.h | 55 ++++++++++++++++++++++++++ pcsx2/CDVD/OutputIsoFile.cpp | 76 +++--------------------------------- 3 files changed, 70 insertions(+), 81 deletions(-) diff --git a/pcsx2/CDVD/CDVDaccess.cpp b/pcsx2/CDVD/CDVDaccess.cpp index fc93791522..dc3e8c23fe 100644 --- a/pcsx2/CDVD/CDVDaccess.cpp +++ b/pcsx2/CDVD/CDVDaccess.cpp @@ -58,7 +58,7 @@ int lastLSN; // needed for block dumping // Records last read block length for block dumping //static int plsn = 0; -//static OutputIsoFile blockDumpFile; +static OutputIsoFile blockDumpFile; // Assertion check for CDVD != NULL (in devel and debug builds), because its handier than // relying on DEP exceptions -- and a little more reliable too. @@ -337,12 +337,12 @@ bool DoCDVDopen() if( ret == 1 ) throw Exception::CancelEvent(L"User canceled the CDVD plugin's open dialog."); int cdtype = DoCDVDdetectDiskType(); -/* + if (!EmuConfig.CdvdDumpBlocks || (cdtype == CDVD_TYPE_NODISC)) { blockDumpFile.Close(); return true; - }*/ + } // TODO: Add a blockdumps configurable folder, and use that instead of CWD(). @@ -367,8 +367,8 @@ bool DoCDVDopen() cdvdTD td; CDVD->getTD(0, &td); -/* - blockDumpFile.Create(temp, ISOFLAGS_BLOCKDUMP_V3); + + blockDumpFile.Create(temp, 3); if( blockDumpFile.IsOpened() ) { @@ -390,7 +390,7 @@ bool DoCDVDopen() } blockDumpFile.WriteFormat(blockofs, blocksize, blocks); } -*/ + return true; } @@ -410,12 +410,12 @@ s32 DoCDVDreadSector(u8* buffer, u32 lsn, int mode) { CheckNullCDVD(); int ret = CDVD->readSector(buffer,lsn,mode); -/* + if (ret == 0 && blockDumpFile.IsOpened()) { blockDumpFile.WriteBlock(buffer, lsn); } -*/ + return ret; } @@ -449,12 +449,12 @@ s32 DoCDVDgetBuffer(u8* buffer) { CheckNullCDVD(); int ret = CDVD->getBuffer2(buffer); -/* + if (ret == 0 && blockDumpFile.IsOpened()) { blockDumpFile.WriteBlock(buffer, lastLSN); } -*/ + return ret; } diff --git a/pcsx2/CDVD/IsoFileFormats.h b/pcsx2/CDVD/IsoFileFormats.h index 8949fc2baf..f026c59fe4 100644 --- a/pcsx2/CDVD/IsoFileFormats.h +++ b/pcsx2/CDVD/IsoFileFormats.h @@ -95,3 +95,58 @@ protected: bool tryIsoType(u32 _size, s32 _offset, s32 _blockofs); void FindParts(); }; + +class OutputIsoFile +{ + DeclareNoncopyableObject( OutputIsoFile ); + +protected: + wxString m_filename; + + u32 m_version; + + s32 m_offset; + s32 m_blockofs; + u32 m_blocksize; + + // total number of blocks in the ISO image (including all parts) + u32 m_blocks; + + // dtable / dtablesize are used when reading blockdumps + ScopedArray m_dtable; + int m_dtablesize; + + ScopedPtr m_outstream; + +public: + OutputIsoFile(); + virtual ~OutputIsoFile() throw(); + + bool IsOpened() const; + + + const wxString& GetFilename() const + { + return m_filename; + } + + void Create(const wxString& filename, int mode); + void Close(); + void WriteFormat(int blockofs, uint blocksize, uint blocks); + + void WriteBlock(const u8* src, uint lsn); + +protected: + void _init(); + + void _WriteBlock(const u8* src, uint lsn); + void _WriteBlockD(const u8* src, uint lsn); + + void outWrite( const void* src, size_t size ); + + template< typename T > + void outWrite( const T& data ) + { + outWrite( &data, sizeof(data) ); + } +}; diff --git a/pcsx2/CDVD/OutputIsoFile.cpp b/pcsx2/CDVD/OutputIsoFile.cpp index dc0b5edbe0..a2bac83ca2 100644 --- a/pcsx2/CDVD/OutputIsoFile.cpp +++ b/pcsx2/CDVD/OutputIsoFile.cpp @@ -20,70 +20,6 @@ #include -/* -class OutputIsoFile -{ - DeclareNoncopyableObject( OutputIsoFile ); - -protected: - wxString m_filename; - - isoType m_type; - u32 m_flags; - - s32 m_offset; - s32 m_blockofs; - u32 m_blocksize; - - // total number of blocks in the ISO image (including all parts) - u32 m_blocks; - - // dtable / dtablesize are used when reading blockdumps - ScopedArray m_dtable; - int m_dtablesize; - - ScopedPtr m_outstream; - - // Currently unused internal buffer (it was used for compressed - // iso support, before it was removed). - //ScopedArray m_buffer; - //int m_buflsn; - -public: - OutputIsoFile(); - virtual ~OutputIsoFile() throw(); - - bool IsOpened() const; - - - const wxString& GetFilename() const - { - return m_filename; - } - - void Create(const wxString& filename, int mode); - void Close(); - void WriteFormat(int blockofs, uint blocksize, uint blocks); - - void WriteBlock(const u8* src, uint lsn); - -protected: - void _init(); - - void _WriteBlock(const u8* src, uint lsn); - void _WriteBlockD(const u8* src, uint lsn); - - void outWrite( const void* src, size_t size ); - - template< typename T > - void outWrite( const T& data ) - { - outWrite( &data, sizeof(data) ); - } -}; -*/ - -/* void pxStream_OpenCheck( const wxStreamBase& stream, const wxString& fname, const wxString& mode ) { if (stream.IsOk()) return; @@ -105,8 +41,7 @@ OutputIsoFile::~OutputIsoFile() throw() void OutputIsoFile::_init() { - m_type = ISOTYPE_ILLEGAL; - m_flags = 0; + m_version = 0; m_offset = 0; m_blockofs = 0; @@ -117,12 +52,12 @@ void OutputIsoFile::_init() m_dtablesize = 0; } -void OutputIsoFile::Create(const wxString& filename, int flags) +void OutputIsoFile::Create(const wxString& filename, int version) { Close(); m_filename = filename; - m_flags = flags; + m_version = version; m_offset = 0; m_blockofs = 24; m_blocksize = 2048; @@ -144,7 +79,7 @@ void OutputIsoFile::WriteFormat(int _blockofs, uint _blocksize, uint _blocks) Console.WriteLn("blocksize = %u", m_blocksize); Console.WriteLn("blocks = %u", m_blocks); - if (m_flags & ISOFLAGS_BLOCKDUMP_V2) + if (m_version == 2) { outWrite("BDV2", 4); outWrite(m_blocksize); @@ -176,7 +111,7 @@ void OutputIsoFile::_WriteBlockD(const u8* src, uint lsn) void OutputIsoFile::WriteBlock(const u8* src, uint lsn) { - if (m_flags == ISOFLAGS_BLOCKDUMP_V2) + if (m_version == 2) _WriteBlockD(src, lsn); else _WriteBlock(src, lsn); @@ -208,4 +143,3 @@ bool OutputIsoFile::IsOpened() const { return m_outstream && m_outstream->IsOk(); } -*/ \ No newline at end of file