Ok.. I had a closer look... the memory allocation error dont happen in zlib..
When zlib fails to allocate memory, you get another message 'failed to compress game data' (but the game wont crash)
The bug happens with the earlier mentioned stream that gets all the game added into it before compression is done..
It appears the size of this stream starts out small, and everytime it is filled up, it doubles in size... this works out fine at first.. the stream eventually increases to 80MB.. 160MB.. then 320MB... but when it tries to go up to 640MB, it crashes...
So basically it should be relatively easy to fix this.. just need to continiously make the stream zip itself and save to disc instead of storing in memory before starting to zip..
Bad news is that to be able to do this in the DLL, would break save game compatibility.. since would basically need to store the save as 2 seperate games (the original save just containing a pointer to the file that contains the real game data)
When zlib fails to allocate memory, you get another message 'failed to compress game data' (but the game wont crash)
The bug happens with the earlier mentioned stream that gets all the game added into it before compression is done..
It appears the size of this stream starts out small, and everytime it is filled up, it doubles in size... this works out fine at first.. the stream eventually increases to 80MB.. 160MB.. then 320MB... but when it tries to go up to 640MB, it crashes...
So basically it should be relatively easy to fix this.. just need to continiously make the stream zip itself and save to disc instead of storing in memory before starting to zip..
Bad news is that to be able to do this in the DLL, would break save game compatibility.. since would basically need to store the save as 2 seperate games (the original save just containing a pointer to the file that contains the real game data)