]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
host: log graceful shutdown (config, history)
authorbones_was_here <bones_was_here@xonotic.au>
Tue, 2 Jan 2024 13:21:15 +0000 (23:21 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Wed, 3 Jan 2024 01:11:46 +0000 (11:11 +1000)
Stopping demo recording should already get a message.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
host.c
keys.c

diff --git a/host.c b/host.c
index fdfb6836bbcdce8b88772cdb3c0fa30dddd3b096..4d272e365f52aa42352b6a525e6c9d79fb698a40 100644 (file)
--- 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 4d7ed1749a14ad0d2f7c35c546d5346185934443..fae464524839a9250f51ffb9d2230d8741663749 100644 (file)
--- 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);