diff --git a/polymer/eduke32/build/include/compat.h b/polymer/eduke32/build/include/compat.h index 044c679fd..5664732de 100644 --- a/polymer/eduke32/build/include/compat.h +++ b/polymer/eduke32/build/include/compat.h @@ -486,6 +486,7 @@ static inline uint16_t system_15bit_rand(void) { return ((uint16_t)rand())&0x7ff # define Bstat stat # define Bfopen fopen # define Bfclose fclose +# define Bfflush fflush # define Bfeof feof # define Bfgetc fgetc # define Brewind rewind diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index f28e64026..9947ec143 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -8852,6 +8852,8 @@ static int32_t osdcmd_quit(const osdfuncparm_t *parm) ExtUnInit(); uninitengine(); + Bfflush(NULL); + exit(0); } diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 9a7c56a80..9ea9153d3 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -784,7 +784,7 @@ int32_t CONFIG_ReadSetup(void) void CONFIG_WriteBinds(void) // save binds and aliases to _settings.cfg { int32_t i; - FILE *fp; + BFILE *fp; char *ptr = Bstrdup(setupfilename); char tempbuf[128]; @@ -792,36 +792,36 @@ void CONFIG_WriteBinds(void) // save binds and aliases to _settings.cfg Bsprintf(tempbuf, "settings.cfg"); else Bsprintf(tempbuf, "%s_settings.cfg", strtok(ptr, ".")); - fp = fopen(tempbuf, "wt"); + fp = Bfopen(tempbuf, "wt"); if (fp) { symbol_t *symb; - fprintf(fp,"// this file automatically generated by EDuke32\n"); - fprintf(fp,"// these settings take precedence over your main cfg file\n"); - fprintf(fp,"// do not modify if you lack common sense\n"); + Bfprintf(fp,"// this file automatically generated by EDuke32\n"); + Bfprintf(fp,"// these settings take precedence over your main cfg file\n"); + Bfprintf(fp,"// do not modify if you lack common sense\n"); - fprintf(fp,"unbindall\n"); + Bfprintf(fp,"unbindall\n"); for (i=0; inext) if (symb->func == (void *)OSD_ALIAS) - fprintf(fp,"alias \"%s\" \"%s\"\n", symb->name, symb->help); + Bfprintf(fp,"alias \"%s\" \"%s\"\n", symb->name, symb->help); /* for (i = 0; i < sizeof(cvar)/sizeof(cvarmappings); i++) if (!(cvar[i].type&CVAR_NOSAVE)) - fprintf(fp,"%s \"%d\"\n",cvar[i].name,*(int32_t*)cvar[i].var); + Bfprintf(fp,"%s \"%d\"\n",cvar[i].name,*(int32_t*)cvar[i].var); */ OSD_WriteCvars(fp); - fclose(fp); + Bfclose(fp); if (!Bstrcmp(setupfilename, SETUPFILENAME)) OSD_Printf("Wrote settings.cfg\n"); else OSD_Printf("Wrote %s_settings.cfg\n",ptr); @@ -1019,6 +1019,7 @@ void CONFIG_WriteSetup(uint32_t flags) SCRIPT_Free(ud.config.scripthandle); OSD_Printf("Wrote %s\n",setupfilename); CONFIG_WriteBinds(); + Bfflush(NULL); } diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index a7c4979de..a17beadab 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -2136,6 +2136,8 @@ void G_GameExit(const char *msg) uninitgroupfile(); + Bfflush(NULL); + exit(0); } @@ -9494,6 +9496,7 @@ void G_Shutdown(void) KB_Shutdown(); uninitengine(); G_Cleanup(); + Bfflush(NULL); } /* @@ -9771,6 +9774,8 @@ static void G_Startup(void) tilesizx[MIRROR] = tilesizy[MIRROR] = 0; screenpeek = myconnectindex; + + Bfflush(NULL); } void G_UpdatePlayerFromMenu(void) diff --git a/polymer/eduke32/source/m32exec.c b/polymer/eduke32/source/m32exec.c index 0b10761cd..9f5375265 100644 --- a/polymer/eduke32/source/m32exec.c +++ b/polymer/eduke32/source/m32exec.c @@ -3088,6 +3088,7 @@ dodefault: "helixhorned@gmail.com.\n\n" "Thank you!\n"); vm.flags |= VMFLAG_ERROR; + Bfflush(NULL); return 1; } }