Flush the buffer of handles for the same file. (Betrayal in Antara). Thanks ripsaw
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3624
This commit is contained in:
parent
72bf840408
commit
0af0da678c
1 changed files with 24 additions and 0 deletions
|
@ -41,6 +41,7 @@ public:
|
|||
Bit16u GetInformation(void);
|
||||
bool UpdateDateTimeFromHost(void);
|
||||
void FlagReadOnlyMedium(void);
|
||||
void Flush(void);
|
||||
private:
|
||||
FILE * fhandle;
|
||||
bool read_only_medium;
|
||||
|
@ -95,6 +96,22 @@ bool localDrive::FileOpen(DOS_File * * file,char * name,Bit32u flags) {
|
|||
CROSS_FILENAME(newname);
|
||||
dirCache.ExpandName(newname);
|
||||
|
||||
//Flush the buffer of handles for the same file. (Betrayal in Antara)
|
||||
Bit8u i,drive=DOS_DRIVES;
|
||||
localFile *lfp;
|
||||
for (i=0;i<DOS_DRIVES;i++) {
|
||||
if (Drives[i]==this) {
|
||||
drive=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i=0;i<DOS_FILES;i++) {
|
||||
if (Files[i] && Files[i]->IsOpen() && Files[i]->GetDrive()==drive && Files[i]->IsName(name)) {
|
||||
lfp=dynamic_cast<localFile*>(Files[i]);
|
||||
if (lfp) lfp->Flush();
|
||||
}
|
||||
}
|
||||
|
||||
FILE * hand=fopen(newname,type);
|
||||
// Bit32u err=errno;
|
||||
if (!hand) {
|
||||
|
@ -541,6 +558,13 @@ bool localFile::UpdateDateTimeFromHost(void) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void localFile::Flush(void) {
|
||||
if (last_action==WRITE) {
|
||||
fseek(fhandle,ftell(fhandle),SEEK_SET);
|
||||
last_action=NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ********************************************
|
||||
// CDROM DRIVE
|
||||
|
|
Loading…
Add table
Reference in a new issue