there was a very old bug in the emulator which didnt matter due to luck but which caused unexciting mappers not to store their (empty) state correctly in the savestate. WriteStateChunk() returned 0 when there was an error in SubWrite(), even though it shouldve written a 5 to account for the overhead

This commit is contained in:
zeromus 2008-05-26 00:58:26 +00:00
parent 03ad29922f
commit 7489c70b3d
1 changed files with 2 additions and 2 deletions

View File

@ -143,7 +143,7 @@ static int WriteStateChunk(FILE *st, int type, SFORMAT *sf)
if(!SubWrite(st,sf))
{
return(0);
return 5;
}
return (bsize+5);
}
@ -358,7 +358,7 @@ bool FCEUSS_SaveFP(FILE *st)
//compress it
uint8* cbuf = new uint8[len*2]; //worst case compression, lets say twice the input buffer size
uLongf comprlen;
uLongf comprlen = len*2;
int error = compress2(cbuf,&comprlen,&buf[0],len,Z_BEST_COMPRESSION);
//dump the header