From 307ff4e1634dd1bdfaae6cbc30c422c114ec0056 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 2 Oct 2022 14:08:07 +0200 Subject: [PATCH] - pass filename to I_WriteIniFailed as parameter. This accessed game data from the backend. --- src/common/platform/posix/i_system_posix.cpp | 5 ++--- src/common/platform/win32/i_system.cpp | 5 ++--- src/common/platform/win32/i_system.h | 2 +- src/m_misc.cpp | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/common/platform/posix/i_system_posix.cpp b/src/common/platform/posix/i_system_posix.cpp index 698ea1c692..bb381d5513 100644 --- a/src/common/platform/posix/i_system_posix.cpp +++ b/src/common/platform/posix/i_system_posix.cpp @@ -36,12 +36,11 @@ #include "cmdlib.h" #include "i_system.h" -#include "gameconfigfile.h" -bool I_WriteIniFailed() +bool I_WriteIniFailed(const char * filename) { - printf("The config file %s could not be saved:\n%s\n", GameConfig->GetPathName(), strerror(errno)); + printf("The config file %s could not be saved:\n%s\n", filename, strerror(errno)); return false; // return true to retry } diff --git a/src/common/platform/win32/i_system.cpp b/src/common/platform/win32/i_system.cpp index 1005bd9d10..efc1002e35 100644 --- a/src/common/platform/win32/i_system.cpp +++ b/src/common/platform/win32/i_system.cpp @@ -80,7 +80,6 @@ #include "i_input.h" #include "c_dispatch.h" -#include "gameconfigfile.h" #include "v_font.h" #include "i_system.h" #include "bitmap.h" @@ -764,7 +763,7 @@ void DestroyCustomCursor() // //========================================================================== -bool I_WriteIniFailed() +bool I_WriteIniFailed(const char* filename) { char *lpMsgBuf; FString errortext; @@ -779,7 +778,7 @@ bool I_WriteIniFailed() 0, NULL ); - errortext.Format ("The config file %s could not be written:\n%s", GameConfig->GetPathName(), lpMsgBuf); + errortext.Format ("The config file %s could not be written:\n%s", filename, lpMsgBuf); LocalFree (lpMsgBuf); return MessageBoxA(mainwindow.GetHandle(), errortext.GetChars(), GAMENAME " configuration not saved", MB_ICONEXCLAMATION | MB_RETRYCANCEL) == IDRETRY; } diff --git a/src/common/platform/win32/i_system.h b/src/common/platform/win32/i_system.h index cebbfde8f4..09a4b642cf 100644 --- a/src/common/platform/win32/i_system.h +++ b/src/common/platform/win32/i_system.h @@ -41,7 +41,7 @@ void I_SetIWADInfo (); int I_PickIWad (WadStuff *wads, int numwads, bool queryiwad, int defaultiwad); // The ini could not be saved at exit -bool I_WriteIniFailed (); +bool I_WriteIniFailed (const char* filename); // [RH] Checks the registry for Steam's install path, so we can scan its // directories for IWADs if the user purchased any through Steam. diff --git a/src/m_misc.cpp b/src/m_misc.cpp index 11001255e6..6e40991dae 100644 --- a/src/m_misc.cpp +++ b/src/m_misc.cpp @@ -292,7 +292,7 @@ bool M_SaveDefaults (const char *filename) void M_SaveDefaultsFinal () { if (GameConfig == nullptr) return; - while (!M_SaveDefaults (nullptr) && I_WriteIniFailed ()) + while (!M_SaveDefaults (nullptr) && I_WriteIniFailed (GameConfig->GetPathName())) { /* Loop until the config saves or I_WriteIniFailed() returns false */ }