Merge pull request #710 from reicast/feat/vmu-safer-creation

maple: Gracefully fail if vmu cannot be written
This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis 2015-07-29 00:03:00 +02:00
commit fb6d0a0166
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)