mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-08 06:40:45 +01:00
rewritten save function
This commit is contained in:
parent
c2e8d57671
commit
6bfaa25966
@ -835,12 +835,20 @@ SaveFile (char * buffer, char *filepath, size_t datasize, bool silent)
|
|||||||
{
|
{
|
||||||
while(!written && retry == 1)
|
while(!written && retry == 1)
|
||||||
{
|
{
|
||||||
if(ChangeInterface(device, silent))
|
if(!ChangeInterface(device, silent))
|
||||||
{
|
break;
|
||||||
|
|
||||||
file = fopen (filepath, "wb");
|
file = fopen (filepath, "wb");
|
||||||
|
|
||||||
if (file)
|
if(!file)
|
||||||
{
|
{
|
||||||
|
if(silent)
|
||||||
|
break;
|
||||||
|
|
||||||
|
retry = ErrorPromptRetry("Error creating file!");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
while(written < datasize)
|
while(written < datasize)
|
||||||
{
|
{
|
||||||
if(datasize - written > 4096) nextwrite=4096;
|
if(datasize - written > 4096) nextwrite=4096;
|
||||||
@ -851,16 +859,11 @@ SaveFile (char * buffer, char *filepath, size_t datasize, bool silent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(written != datasize) written = 0;
|
if(written != datasize) written = 0;
|
||||||
fclose (file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!written)
|
if(!written)
|
||||||
{
|
{
|
||||||
unmountRequired[device] = true;
|
unmountRequired[device] = true;
|
||||||
if(!silent)
|
|
||||||
retry = ErrorPromptRetry("Error saving file!");
|
retry = ErrorPromptRetry("Error saving file!");
|
||||||
else
|
|
||||||
retry = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user