mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-17 01:31:25 +00:00
- added a config getter to the interface.
Now the only external reference left in the backend code is the call to GameMain.
This commit is contained in:
parent
e6615629b3
commit
207913bced
4 changed files with 14 additions and 5 deletions
|
@ -43,7 +43,8 @@
|
|||
#include "resourcefile.h"
|
||||
#include "version.h"
|
||||
#include "findfile.h"
|
||||
#include "gameconfigfile.h"
|
||||
#include "i_interface.h"
|
||||
#include "configfile.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -392,6 +393,7 @@ void FSoundFontManager::CollectSoundfonts()
|
|||
findstate_t c_file;
|
||||
void *file;
|
||||
|
||||
FConfigFile* GameConfig = sysCallbacks.GetConfig ? sysCallbacks.GetConfig() : nullptr;
|
||||
if (GameConfig != NULL && GameConfig->SetSection ("SoundfontSearch.Directories"))
|
||||
{
|
||||
const char *key;
|
||||
|
|
|
@ -9,6 +9,7 @@ class FRenderState;
|
|||
class FGameTexture;
|
||||
class FTextureID;
|
||||
enum EUpscaleFlags : int;
|
||||
class FConfigFile;
|
||||
|
||||
struct SystemCallbacks
|
||||
{
|
||||
|
@ -44,6 +45,7 @@ struct SystemCallbacks
|
|||
void (*OnMenuOpen)(bool makesound);
|
||||
void (*LanguageChanged)(const char*);
|
||||
bool (*OkForLocalization)(FTextureID, const char*);
|
||||
FConfigFile* (*GetConfig)();
|
||||
};
|
||||
|
||||
extern SystemCallbacks sysCallbacks;
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
#include <math.h>
|
||||
#include "vectors.h"
|
||||
#include "m_joy.h"
|
||||
#include "gameconfigfile.h"
|
||||
#include "configfile.h"
|
||||
#include "i_interface.h"
|
||||
#include "d_eventbase.h"
|
||||
#include "cmdlib.h"
|
||||
#include "printf.h"
|
||||
|
@ -92,10 +93,11 @@ IJoystickConfig::~IJoystickConfig()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
static bool M_SetJoystickConfigSection(IJoystickConfig *joy, bool create)
|
||||
static bool M_SetJoystickConfigSection(IJoystickConfig *joy, bool create, FConfigFile* GameConfig)
|
||||
{
|
||||
FString id = "Joy:";
|
||||
id += joy->GetIdentifier();
|
||||
if (!GameConfig) return false;
|
||||
return GameConfig->SetSection(id, create);
|
||||
}
|
||||
|
||||
|
@ -107,13 +109,14 @@ static bool M_SetJoystickConfigSection(IJoystickConfig *joy, bool create)
|
|||
|
||||
bool M_LoadJoystickConfig(IJoystickConfig *joy)
|
||||
{
|
||||
FConfigFile* GameConfig = sysCallbacks.GetConfig ? sysCallbacks.GetConfig() : nullptr;
|
||||
char key[32];
|
||||
const char *value;
|
||||
int axislen;
|
||||
int numaxes;
|
||||
|
||||
joy->SetDefaultConfig();
|
||||
if (!M_SetJoystickConfigSection(joy, false))
|
||||
if (!M_SetJoystickConfigSection(joy, false, GameConfig))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -166,10 +169,11 @@ bool M_LoadJoystickConfig(IJoystickConfig *joy)
|
|||
|
||||
void M_SaveJoystickConfig(IJoystickConfig *joy)
|
||||
{
|
||||
FConfigFile* GameConfig = sysCallbacks.GetConfig ? sysCallbacks.GetConfig() : nullptr;
|
||||
char key[32], value[32];
|
||||
int axislen, numaxes;
|
||||
|
||||
if (GameConfig != NULL && M_SetJoystickConfigSection(joy, true))
|
||||
if (GameConfig != NULL && M_SetJoystickConfigSection(joy, true, GameConfig))
|
||||
{
|
||||
GameConfig->ClearCurrentSection();
|
||||
if (!joy->IsSensitivityDefault())
|
||||
|
|
|
@ -3557,6 +3557,7 @@ static int D_DoomMain_Internal (void)
|
|||
OnMenuOpen,
|
||||
System_LanguageChanged,
|
||||
OkForLocalization,
|
||||
[]() ->FConfigFile* { return GameConfig; }
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue