Skip to content

Commit

Permalink
Use setvbuf for world save/load operations
Browse files Browse the repository at this point in the history
  • Loading branch information
AliceLR committed Aug 22, 2019
1 parent e1329b8 commit 3b243e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/changelog.txt
Expand Up @@ -19,6 +19,9 @@ USERS
transparent foregrounds wouldn't draw any char backgrounds.
+ Fixed 3DS renderer crashes that would occur when large numbers
of sprites were active.
+ File IO for world saving/loading is now buffered, which should
improve save/load times on the 3DS and Switch.
+ Enabled writing zip data descriptors for the Switch.

DEVELOPERS

Expand Down
6 changes: 6 additions & 0 deletions src/world.c
Expand Up @@ -1991,6 +1991,9 @@ static int save_world_zip(struct world *mzx_world, const char *file,
if(!fp)
goto err;

// TODO temporary fix to improve save times on the embedded platforms.
setvbuf(fp, NULL, _IOFBF, 16384);

// Header
if(!savegame)
{
Expand Down Expand Up @@ -2734,6 +2737,9 @@ static FILE *try_open_world(const char *file, boolean savegame,
if(!fp)
return NULL;

// TODO temporary fix to improve load times on the embedded platforms.
setvbuf(fp, NULL, _IOFBF, 16384);

if(savegame)
{
if(!fread(magic, 5, 1, fp))
Expand Down

0 comments on commit 3b243e5

Please sign in to comment.