From 6d7ce4397972f050c17b11de2f75209bdd562b80 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Tue, 2 Jan 2024 23:21:15 +1000 Subject: [PATCH] host: log graceful shutdown (config, history) Stopping demo recording should already get a message. Signed-off-by: bones_was_here --- host.c | 12 ++++++------ keys.c | 6 ++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/host.c b/host.c index fdfb6836..4d272e36 100644 --- a/host.c +++ b/host.c @@ -202,9 +202,11 @@ void Host_SaveConfig(const char *file) f = FS_OpenRealFile(file, "wb", false); if (!f) { - Con_Printf(CON_ERROR "Couldn't write %s.\n", file); + Con_Printf(CON_ERROR "Couldn't write %s\n", file); return; } + else + Con_Printf("Saving config to %s ...\n", file); Key_WriteBindings (f); Cvar_WriteVariables (&cvars_all, f); @@ -217,10 +219,8 @@ static void Host_SaveConfig_f(cmd_state_t *cmd) { const char *file = CONFIGFILENAME; - if(Cmd_Argc(cmd) >= 2) { + if(Cmd_Argc(cmd) >= 2) file = Cmd_Argv(cmd, 1); - Con_Printf("Saving to %s\n", file); - } Host_SaveConfig(file); } @@ -581,12 +581,12 @@ void Host_Shutdown(void) if (isdown) { - Con_Print("recursive shutdown\n"); + Con_Print(CON_WARN "recursive shutdown\n"); return; } if (setjmp(host.abortframe)) { - Con_Print("aborted the quitting frame?!?\n"); + Con_Print(CON_WARN "aborted the quitting frame?!?\n"); return; } isdown = true; diff --git a/keys.c b/keys.c index 4d7ed174..fae46452 100644 --- a/keys.c +++ b/keys.c @@ -92,18 +92,20 @@ static void Key_History_Init(void) static void Key_History_Shutdown(void) { - // TODO write history to a file - // not necessary for mobile #ifndef DP_MOBILETOUCH qfile_t *historyfile = FS_OpenRealFile("darkplaces_history.txt", "w", false); if(historyfile) { int i; + + Con_Print("Saving command history to darkplaces_history.txt ...\n"); for(i = 0; i < CONBUFFER_LINES_COUNT(&history); ++i) FS_Printf(historyfile, "%s\n", ConBuffer_GetLine(&history, i)); FS_Close(historyfile); } + else + Con_Print(CON_ERROR "Couldn't write darkplaces_history.txt\n"); #endif ConBuffer_Shutdown(&history); -- 2.39.2