handled state saving IO errors
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@392 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
718a1c6a3f
commit
432084ebe7
|
@ -59,6 +59,15 @@ void DoState(PointerWrap &p)
|
||||||
|
|
||||||
void SaveStateCallback(u64 userdata, int cyclesLate)
|
void SaveStateCallback(u64 userdata, int cyclesLate)
|
||||||
{
|
{
|
||||||
|
static const int chunkSize = 16384;
|
||||||
|
z_stream strm;
|
||||||
|
|
||||||
|
FILE *f = fopen(cur_filename.c_str(), "wb");
|
||||||
|
if(f == NULL) {
|
||||||
|
Core::DisplayMessage("Could not save state", 2000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Jit64::ClearCache();
|
Jit64::ClearCache();
|
||||||
u8 *ptr = 0;
|
u8 *ptr = 0;
|
||||||
PointerWrap p(&ptr, PointerWrap::MODE_MEASURE);
|
PointerWrap p(&ptr, PointerWrap::MODE_MEASURE);
|
||||||
|
@ -68,13 +77,13 @@ void SaveStateCallback(u64 userdata, int cyclesLate)
|
||||||
ptr = buffer;
|
ptr = buffer;
|
||||||
p.SetMode(PointerWrap::MODE_WRITE);
|
p.SetMode(PointerWrap::MODE_WRITE);
|
||||||
DoState(p);
|
DoState(p);
|
||||||
FILE *f = fopen(cur_filename.c_str(), "wb");
|
|
||||||
fwrite(buffer, sz, 1, f);
|
fwrite(buffer, sz, 1, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
|
|
||||||
Core::DisplayMessage(StringFromFormat("Saved State to %s", cur_filename.c_str()).c_str(), 2000);
|
Core::DisplayMessage(StringFromFormat("Saved State to %s",
|
||||||
|
cur_filename.c_str()).c_str(), 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadStateCallback(u64 userdata, int cyclesLate)
|
void LoadStateCallback(u64 userdata, int cyclesLate)
|
||||||
|
|
Loading…
Reference in New Issue