Permit the use of protected game data files
Many DOS games open all their files in write-mode regardless if the game actually intends to write to them or not. This can result the files' metadata being updated (lossing the original date-stamp) as well as putting the file at-risk of corruption if the game crashes with the file open for writing. Under the existing DOSBox implementation, if a user attempts to write-protect their data files then DOSBox will quit with an error in the above scenario. This commit allows the use of write-protected files (similar to running a game from CDROM) and indicates which files are being actively protected against modification. Typically the only files that need to be left writable are those that the game actually changes, such as: save-game files, highscore files, in-game settings, and so on. If these are also protected, then the game will quit/crash immediately after the protected message is printed, and thus indicate which file require write-allowance.
This commit is contained in:
parent
6804faf931
commit
c730e5d70a
2 changed files with 38 additions and 20 deletions
|
@ -22,6 +22,7 @@
|
|||
#include "dosbox.h"
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -75,6 +76,7 @@ public:
|
|||
virtual bool isRemovable(void);
|
||||
virtual Bits UnMount(void);
|
||||
const char* getBasedir() {return basedir;};
|
||||
virtual bool isNewWriteProtectedFile(const std::string& filename);
|
||||
protected:
|
||||
char basedir[CROSS_LEN];
|
||||
struct {
|
||||
|
@ -82,6 +84,7 @@ protected:
|
|||
} srchInfo[MAX_OPENDIRS];
|
||||
|
||||
private:
|
||||
std::set<std::string> write_protected_files;
|
||||
struct {
|
||||
Bit16u bytes_sector;
|
||||
Bit8u sectors_cluster;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue