mirror of https://github.com/PCSX2/pcsx2.git
Allow to share writing to the ISO through an ini option
This commit is contained in:
parent
7e5b6dee9c
commit
f5fe75a73b
|
@ -75,8 +75,10 @@ class FlatFileReader : public AsyncFileReader
|
|||
io_context_t m_aio_context;
|
||||
#endif
|
||||
|
||||
bool shareWrite;
|
||||
|
||||
public:
|
||||
FlatFileReader(void);
|
||||
FlatFileReader(bool shareWrite = false);
|
||||
virtual ~FlatFileReader(void);
|
||||
|
||||
virtual bool Open(const wxString& fileName);
|
||||
|
|
|
@ -201,7 +201,10 @@ bool InputIsoFile::Open( const wxString& srcfile, bool testOnly )
|
|||
Close();
|
||||
m_filename = srcfile;
|
||||
|
||||
m_reader = new FlatFileReader();
|
||||
// Allow write sharing of the iso based on the ini settings.
|
||||
// Mostly useful for romhacking, where the disc is frequently
|
||||
// changed and the emulator would block modifications
|
||||
m_reader = new FlatFileReader(EmuConfig.CdvdShareWrite);
|
||||
m_reader->Open(m_filename);
|
||||
|
||||
bool isBlockdump, isCompressed = false;
|
||||
|
|
|
@ -433,6 +433,7 @@ struct Pcsx2Config
|
|||
bool
|
||||
CdvdVerboseReads :1, // enables cdvd read activity verbosely dumped to the console
|
||||
CdvdDumpBlocks :1, // enables cdvd block dumping
|
||||
CdvdShareWrite :1, // allows the iso to be modified while it's loaded
|
||||
EnablePatches :1, // enables patch detection and application
|
||||
EnableCheats :1, // enables cheat detection and application
|
||||
EnableWideScreenPatches :1,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "PrecompiledHeader.h"
|
||||
#include "AsyncFileReader.h"
|
||||
|
||||
FlatFileReader::FlatFileReader(void)
|
||||
FlatFileReader::FlatFileReader(bool shareWrite) : shareWrite(shareWrite)
|
||||
{
|
||||
m_blocksize = 2048;
|
||||
m_fd = 0;
|
||||
|
|
|
@ -410,6 +410,7 @@ void Pcsx2Config::LoadSave( IniInterface& ini )
|
|||
|
||||
IniBitBool( CdvdVerboseReads );
|
||||
IniBitBool( CdvdDumpBlocks );
|
||||
IniBitBool( CdvdShareWrite );
|
||||
IniBitBool( EnablePatches );
|
||||
IniBitBool( EnableCheats );
|
||||
IniBitBool( EnableWideScreenPatches );
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2014 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2014 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "AsyncFileReader.h"
|
||||
|
||||
FlatFileReader::FlatFileReader(void)
|
||||
FlatFileReader::FlatFileReader(bool shareWrite) : shareWrite(shareWrite)
|
||||
{
|
||||
m_blocksize = 2048;
|
||||
hOverlappedFile = INVALID_HANDLE_VALUE;
|
||||
|
@ -35,10 +35,14 @@ bool FlatFileReader::Open(const wxString& fileName)
|
|||
|
||||
hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
|
||||
DWORD shareMode = FILE_SHARE_READ;
|
||||
if (shareWrite)
|
||||
shareMode |= FILE_SHARE_WRITE;
|
||||
|
||||
hOverlappedFile = CreateFile(
|
||||
fileName,
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ,
|
||||
shareMode,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_OVERLAPPED,
|
||||
|
|
Loading…
Reference in New Issue