mirror of https://github.com/PCSX2/pcsx2.git
IOP HLE: Only track handles to valid files.
Bonus check for file validity when saving states.
This commit is contained in:
parent
324b1464e4
commit
1c1f67c091
pcsx2
|
@ -613,15 +613,17 @@ namespace R3000A
|
||||||
v0 = allocfd(file);
|
v0 = allocfd(file);
|
||||||
if ((s32)v0 < 0)
|
if ((s32)v0 < 0)
|
||||||
file->close();
|
file->close();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fileHandle handle;
|
||||||
|
handle.fd_index = v0 - firstfd;
|
||||||
|
handle.flags = flags;
|
||||||
|
handle.full_path = path;
|
||||||
|
handle.mode = mode;
|
||||||
|
handles.push_back(handle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileHandle handle;
|
|
||||||
handle.fd_index = v0 - firstfd;
|
|
||||||
handle.flags = flags;
|
|
||||||
handle.full_path = path;
|
|
||||||
handle.mode = mode;
|
|
||||||
handles.push_back(handle);
|
|
||||||
|
|
||||||
pc = ra;
|
pc = ra;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1463,7 +1465,7 @@ bool SaveStateBase::handleFreeze()
|
||||||
//save the current file position
|
//save the current file position
|
||||||
const u32 fd = R3000A::handles[i].fd_index;
|
const u32 fd = R3000A::handles[i].fd_index;
|
||||||
IOManFile* file = R3000A::ioman::getfd<IOManFile>(fd + firstfd);
|
IOManFile* file = R3000A::ioman::getfd<IOManFile>(fd + firstfd);
|
||||||
s32 pos = file->lseek(0, SEEK_CUR);
|
s32 pos = file ? file->lseek(0, SEEK_CUR) : 0;
|
||||||
Freeze(pos);
|
Freeze(pos);
|
||||||
|
|
||||||
//save the parameters for opening the file
|
//save the parameters for opening the file
|
||||||
|
|
Loading…
Reference in New Issue