maple: Gracefully fail if vmu cannot be written

This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis 2015-07-28 16:27:27 +02:00
parent d3c3feb523
commit 83d3abf266
1 changed files with 6 additions and 2 deletions

View File

@ -286,8 +286,12 @@ struct maple_sega_vmu: maple_base
{
printf("Unable to open VMU save file \"%s\", creating new file\n",apath.c_str());
file=fopen(apath.c_str(),"wb");
fwrite(flash_data, sizeof(flash_data), 1, file);
fseek(file,0,SEEK_SET);
if (file) {
fwrite(flash_data, sizeof(flash_data), 1, file);
fseek(file,0,SEEK_SET);
} else {
printf("Unable to create vmu\n");
}
}
if (!file)