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;
|
io_context_t m_aio_context;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool shareWrite;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FlatFileReader(void);
|
FlatFileReader(bool shareWrite = false);
|
||||||
virtual ~FlatFileReader(void);
|
virtual ~FlatFileReader(void);
|
||||||
|
|
||||||
virtual bool Open(const wxString& fileName);
|
virtual bool Open(const wxString& fileName);
|
||||||
|
|
|
@ -201,7 +201,10 @@ bool InputIsoFile::Open( const wxString& srcfile, bool testOnly )
|
||||||
Close();
|
Close();
|
||||||
m_filename = srcfile;
|
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);
|
m_reader->Open(m_filename);
|
||||||
|
|
||||||
bool isBlockdump, isCompressed = false;
|
bool isBlockdump, isCompressed = false;
|
||||||
|
|
|
@ -433,6 +433,7 @@ struct Pcsx2Config
|
||||||
bool
|
bool
|
||||||
CdvdVerboseReads :1, // enables cdvd read activity verbosely dumped to the console
|
CdvdVerboseReads :1, // enables cdvd read activity verbosely dumped to the console
|
||||||
CdvdDumpBlocks :1, // enables cdvd block dumping
|
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
|
EnablePatches :1, // enables patch detection and application
|
||||||
EnableCheats :1, // enables cheat detection and application
|
EnableCheats :1, // enables cheat detection and application
|
||||||
EnableWideScreenPatches :1,
|
EnableWideScreenPatches :1,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "PrecompiledHeader.h"
|
#include "PrecompiledHeader.h"
|
||||||
#include "AsyncFileReader.h"
|
#include "AsyncFileReader.h"
|
||||||
|
|
||||||
FlatFileReader::FlatFileReader(void)
|
FlatFileReader::FlatFileReader(bool shareWrite) : shareWrite(shareWrite)
|
||||||
{
|
{
|
||||||
m_blocksize = 2048;
|
m_blocksize = 2048;
|
||||||
m_fd = 0;
|
m_fd = 0;
|
||||||
|
|
|
@ -410,6 +410,7 @@ void Pcsx2Config::LoadSave( IniInterface& ini )
|
||||||
|
|
||||||
IniBitBool( CdvdVerboseReads );
|
IniBitBool( CdvdVerboseReads );
|
||||||
IniBitBool( CdvdDumpBlocks );
|
IniBitBool( CdvdDumpBlocks );
|
||||||
|
IniBitBool( CdvdShareWrite );
|
||||||
IniBitBool( EnablePatches );
|
IniBitBool( EnablePatches );
|
||||||
IniBitBool( EnableCheats );
|
IniBitBool( EnableCheats );
|
||||||
IniBitBool( EnableWideScreenPatches );
|
IniBitBool( EnableWideScreenPatches );
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "PrecompiledHeader.h"
|
#include "PrecompiledHeader.h"
|
||||||
#include "AsyncFileReader.h"
|
#include "AsyncFileReader.h"
|
||||||
|
|
||||||
FlatFileReader::FlatFileReader(void)
|
FlatFileReader::FlatFileReader(bool shareWrite) : shareWrite(shareWrite)
|
||||||
{
|
{
|
||||||
m_blocksize = 2048;
|
m_blocksize = 2048;
|
||||||
hOverlappedFile = INVALID_HANDLE_VALUE;
|
hOverlappedFile = INVALID_HANDLE_VALUE;
|
||||||
|
@ -35,10 +35,14 @@ bool FlatFileReader::Open(const wxString& fileName)
|
||||||
|
|
||||||
hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
|
|
||||||
|
DWORD shareMode = FILE_SHARE_READ;
|
||||||
|
if (shareWrite)
|
||||||
|
shareMode |= FILE_SHARE_WRITE;
|
||||||
|
|
||||||
hOverlappedFile = CreateFile(
|
hOverlappedFile = CreateFile(
|
||||||
fileName,
|
fileName,
|
||||||
GENERIC_READ,
|
GENERIC_READ,
|
||||||
FILE_SHARE_READ,
|
shareMode,
|
||||||
NULL,
|
NULL,
|
||||||
OPEN_EXISTING,
|
OPEN_EXISTING,
|
||||||
FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_OVERLAPPED,
|
FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_OVERLAPPED,
|
||||||
|
|
Loading…
Reference in New Issue