mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- disabled the settings.cfg console script so that the newly added config code can take over its duties.
- write the console log to the folder returned by M_GetDocumentsPath and not to the root game directory. - removed G_ExtPreInit because it has become redundant. The search path setup will have to be redone anyway.
This commit is contained in:
parent
1e0d49f947
commit
cd47582632
15 changed files with 21 additions and 254 deletions
|
@ -1498,17 +1498,6 @@ int app_main(int argc, char const * const * argv)
|
|||
char buffer[BMAX_PATH];
|
||||
margc = argc;
|
||||
margv = argv;
|
||||
#ifdef _WIN32
|
||||
#endif
|
||||
|
||||
G_ExtPreInit(argc, argv);
|
||||
|
||||
#ifdef DEBUGGINGAIDS
|
||||
extern int32_t (*check_filename_casing_fn)(void);
|
||||
check_filename_casing_fn = check_filename_casing;
|
||||
#endif
|
||||
|
||||
OSD_SetLogFile(APPBASENAME ".log");
|
||||
|
||||
OSD_SetFunctions(NULL,
|
||||
NULL,
|
||||
|
@ -1571,18 +1560,10 @@ int app_main(int argc, char const * const * argv)
|
|||
OSD_SetParameters(0, 0, 0, 12, 2, 12, OSD_ERROR, OSDTEXT_RED, 0);
|
||||
registerosdcommands();
|
||||
|
||||
char *const setupFileName = Xstrdup(SetupFilename);
|
||||
char *const p = strtok(setupFileName, ".");
|
||||
|
||||
if (!p || !Bstrcmp(SetupFilename, SETUPFILENAME))
|
||||
Bsprintf(buffer, "settings.cfg");
|
||||
else
|
||||
Bsprintf(buffer, "%s_settings.cfg", p);
|
||||
|
||||
Bfree(setupFileName);
|
||||
|
||||
OSD_Exec(buffer);
|
||||
#if 0
|
||||
// todo: Handle more intelligently.
|
||||
OSD_Exec("autoexec.cfg");
|
||||
#endif
|
||||
|
||||
// Not neccessary ?
|
||||
// CONFIG_SetDefaultKeys(keydefaults, true);
|
||||
|
|
|
@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "compat.h"
|
||||
#include "build.h"
|
||||
#include "baselayer.h"
|
||||
#include "cmdlib.h"
|
||||
#include "palette.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -100,23 +101,10 @@ void G_SetupGlobalPsky(void)
|
|||
g_pskyidx = skyIdx;
|
||||
}
|
||||
|
||||
static char g_rootDir[BMAX_PATH];
|
||||
|
||||
int32_t g_groupFileHandle;
|
||||
struct strllist* CommandPaths, * CommandGrps;
|
||||
|
||||
void G_ExtPreInit(int32_t argc,char const * const * argv)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
GetModuleFileNameA(NULL,g_rootDir,BMAX_PATH);
|
||||
Bcorrectfilename(g_rootDir,1);
|
||||
//chdir(g_rootDir);
|
||||
#else
|
||||
getcwd(g_rootDir,BMAX_PATH);
|
||||
strcat(g_rootDir,"/");
|
||||
#endif
|
||||
}
|
||||
|
||||
void G_ExtInit(void)
|
||||
{
|
||||
char cwd[BMAX_PATH];
|
||||
|
@ -197,7 +185,7 @@ void G_LoadGroups(int32_t autoload)
|
|||
{
|
||||
char cwd[BMAX_PATH];
|
||||
|
||||
Bstrcat(g_rootDir, g_modDir);
|
||||
FString g_rootDir = progdir + g_modDir;
|
||||
addsearchpath(g_rootDir);
|
||||
// addsearchpath(mod_dir);
|
||||
|
||||
|
|
|
@ -516,7 +516,6 @@ extern int loaddefinitions_game(const char *fn, int32_t preload);
|
|||
extern void G_AddSearchPaths(void);
|
||||
extern void G_CleanupSearchPaths(void);
|
||||
|
||||
extern void G_ExtPreInit(int32_t argc, char const * const * argv);
|
||||
extern void G_ExtInit(void);
|
||||
|
||||
void G_LoadGroupsInDir(const char *dirname);
|
||||
|
|
|
@ -567,48 +567,6 @@ int CONFIG_ReadSetup(void)
|
|||
|
||||
void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.cfg
|
||||
{
|
||||
char *ptr = Xstrdup(SetupFilename);
|
||||
char filename[BMAX_PATH];
|
||||
|
||||
if (!Bstrcmp(SetupFilename, SETUPFILENAME))
|
||||
Bsprintf(filename, "settings.cfg");
|
||||
else
|
||||
Bsprintf(filename, "%s_settings.cfg", strtok(ptr, "."));
|
||||
|
||||
BFILE *fp = Bfopen(filename, "wt");
|
||||
|
||||
if (fp)
|
||||
{
|
||||
Bfprintf(fp,"unbindall\n");
|
||||
|
||||
for (int i=0; i<MAXBOUNDKEYS+MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
if (CONTROL_KeyIsBound(i))
|
||||
{
|
||||
Bfprintf(fp, "bind \"%s\"%s \"%s\"\n", CONTROL_KeyBinds[i].key,
|
||||
CONTROL_KeyBinds[i].repeat ? "" : " norepeat",
|
||||
CONTROL_KeyBinds[i].cmdstr);
|
||||
}
|
||||
}
|
||||
|
||||
OSD_WriteAliases(fp);
|
||||
|
||||
if (g_isAlterDefaultCrosshair)
|
||||
Bfprintf(fp, "crosshaircolor %d %d %d\n", CrosshairColors.r, CrosshairColors.g, CrosshairColors.b);
|
||||
|
||||
OSD_WriteCvars(fp);
|
||||
|
||||
Bfclose(fp);
|
||||
Bfree(ptr);
|
||||
|
||||
OSD_Printf("Wrote %s\n", filename);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
OSD_Printf("Error writing %s: %s\n", filename, strerror(errno));
|
||||
|
||||
Bfree(ptr);
|
||||
}
|
||||
|
||||
void CONFIG_WriteSetup(uint32_t flags)
|
||||
|
|
|
@ -766,14 +766,8 @@ void OSD_SetLogFile(const char *fn)
|
|||
|
||||
if (osdlog)
|
||||
{
|
||||
#ifndef USE_PHYSFS
|
||||
#ifdef DEBUGGINGAIDS
|
||||
const int bufmode = _IONBF;
|
||||
#else
|
||||
const int bufmode = _IOLBF;
|
||||
#endif
|
||||
setvbuf(osdlog, (char *)NULL, bufmode, BUFSIZ);
|
||||
#endif
|
||||
osdlogfn = fn;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "gamecontrol.h"
|
||||
#include "resourcefile.h"
|
||||
#include "sc_man.h"
|
||||
#include "i_specialpaths.h"
|
||||
#include "../../glbackend/glbackend.h"
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
|
@ -606,6 +607,11 @@ int main(int argc, char *argv[])
|
|||
|
||||
try
|
||||
{
|
||||
// Write to the DOCUMENTS directory, not the game directory
|
||||
|
||||
FString logpath = M_GetDocumentsPath() + "demolition.log";
|
||||
OSD_SetLogFile(logpath);
|
||||
|
||||
// Startup dialog must be presented here so that everything can be set up before reading the keybinds.
|
||||
G_LoadConfig(currentGame);
|
||||
CONFIG_Init();
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "baselayer.h"
|
||||
#include "palette.h"
|
||||
#include "gamecvars.h"
|
||||
|
||||
#include "cmdlib.h"
|
||||
#include "grpscan.h"
|
||||
|
||||
#include "vfs.h"
|
||||
|
@ -244,7 +244,6 @@ void G_SetupGlobalPsky(void)
|
|||
|
||||
//////////
|
||||
|
||||
static char g_rootDir[BMAX_PATH];
|
||||
//char g_modDir[BMAX_PATH] = "/";
|
||||
|
||||
|
||||
|
@ -252,18 +251,6 @@ static void G_LoadAddon(void);
|
|||
int32_t g_groupFileHandle;
|
||||
struct strllist* CommandPaths, * CommandGrps;
|
||||
|
||||
void G_ExtPreInit(int32_t argc,char const * const * argv)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
GetModuleFileNameA(NULL,g_rootDir,BMAX_PATH);
|
||||
Bcorrectfilename(g_rootDir,1);
|
||||
//buildvfs_chdir(g_rootDir);
|
||||
#else
|
||||
buildvfs_getcwd(g_rootDir,BMAX_PATH);
|
||||
strcat(g_rootDir,"/");
|
||||
#endif
|
||||
}
|
||||
|
||||
void G_ExtInit(void)
|
||||
{
|
||||
char cwd[BMAX_PATH];
|
||||
|
@ -400,8 +387,8 @@ void G_LoadGroups(int32_t autoload)
|
|||
{
|
||||
char cwd[BMAX_PATH];
|
||||
|
||||
Bstrcat(g_rootDir, g_modDir);
|
||||
addsearchpath(g_rootDir);
|
||||
FString g_rootDir = progdir + g_modDir;
|
||||
addsearchpath(g_rootDir);
|
||||
// addsearchpath(mod_dir);
|
||||
|
||||
char path[BMAX_PATH];
|
||||
|
|
|
@ -119,7 +119,6 @@ extern void G_SetupGlobalPsky(void);
|
|||
extern void G_AddSearchPaths(void);
|
||||
extern void G_CleanupSearchPaths(void);
|
||||
|
||||
extern void G_ExtPreInit(int32_t argc,char const * const * argv);
|
||||
extern void G_ExtInit(void);
|
||||
extern void G_ScanGroups(void);
|
||||
extern void G_LoadGroups(int32_t autoload);
|
||||
|
|
|
@ -716,65 +716,6 @@ int CONFIG_ReadSetup(void)
|
|||
|
||||
void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.cfg
|
||||
{
|
||||
char filename[BMAX_PATH];
|
||||
|
||||
if (!Bstrcmp(g_setupFileName, SETUPFILENAME))
|
||||
Bsprintf(filename, "settings.cfg");
|
||||
else
|
||||
Bsprintf(filename, "%s_settings.cfg", strtok(g_setupFileName, "."));
|
||||
|
||||
buildvfs_FILE fp = buildvfs_fopen_write(filename);
|
||||
|
||||
if (fp)
|
||||
{
|
||||
buildvfs_fputstr(fp,"\nunbindall\n");
|
||||
|
||||
for (int i=0; i<MAXBOUNDKEYS+MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
if (CONTROL_KeyIsBound(i))
|
||||
{
|
||||
buildvfs_fputstr(fp, "bind \"");
|
||||
buildvfs_fputstrptr(fp, CONTROL_KeyBinds[i].key);
|
||||
if (CONTROL_KeyBinds[i].repeat)
|
||||
buildvfs_fputstr(fp, "\" \"");
|
||||
else
|
||||
buildvfs_fputstr(fp, "\" norepeat \"");
|
||||
buildvfs_fputstrptr(fp, CONTROL_KeyBinds[i].cmdstr);
|
||||
buildvfs_fputstr(fp, "\"\n");
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<NUMGAMEFUNCTIONS; ++i)
|
||||
{
|
||||
char const * name = CONFIG_FunctionNumToName(i);
|
||||
if (name && name[0] != '\0' && (KeyboardKeys[i][0] == 0xff || !KeyboardKeys[i][0]))
|
||||
{
|
||||
buildvfs_fputstr(fp, "unbound ");
|
||||
buildvfs_fputstrptr(fp, name);
|
||||
buildvfs_fputstr(fp, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
OSD_WriteAliases(fp);
|
||||
|
||||
if (g_crosshairSum != -1 && g_crosshairSum != DefaultCrosshairColors.r+(DefaultCrosshairColors.g<<8)+(DefaultCrosshairColors.b<<16))
|
||||
{
|
||||
buildvfs_fputstr(fp, "crosshaircolor ");
|
||||
char buf[64];
|
||||
snprintf(buf, sizeof(buf), "%d %d %d\n", CrosshairColors.r, CrosshairColors.g, CrosshairColors.b);
|
||||
buildvfs_fputstrptr(fp, buf);
|
||||
}
|
||||
|
||||
OSD_WriteCvars(fp);
|
||||
|
||||
buildvfs_fclose(fp);
|
||||
|
||||
OSD_Printf("Wrote %s\n", filename);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
OSD_Printf("Error writing %s: %s\n", filename, strerror(errno));
|
||||
}
|
||||
|
||||
void CONFIG_WriteSetup(uint32_t flags)
|
||||
|
|
|
@ -6297,10 +6297,6 @@ int app_main(int argc, const char * const*argv)
|
|||
else atexit(enet_deinitialize);
|
||||
#endif
|
||||
|
||||
G_ExtPreInit(argc, argv);
|
||||
|
||||
OSD_SetLogFile(APPBASENAME ".log");
|
||||
|
||||
OSD_SetFunctions(GAME_drawosdchar,
|
||||
GAME_drawosdstr,
|
||||
GAME_drawosdcursor,
|
||||
|
@ -6529,18 +6525,9 @@ int app_main(int argc, const char * const*argv)
|
|||
g_clipMapFiles.clear();
|
||||
#endif
|
||||
|
||||
char *const setupFileName = Xstrdup(g_setupFileName);
|
||||
char *const p = strtok(setupFileName, ".");
|
||||
|
||||
if (!p || !Bstrcmp(g_setupFileName, SETUPFILENAME))
|
||||
Bsprintf(tempbuf, "settings.cfg");
|
||||
else
|
||||
Bsprintf(tempbuf, "%s_settings.cfg", p);
|
||||
|
||||
Xfree(setupFileName);
|
||||
|
||||
OSD_Exec(tempbuf);
|
||||
#if 0
|
||||
OSD_Exec("autoexec.cfg");
|
||||
#endif
|
||||
|
||||
system_getcvars();
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "build.h"
|
||||
#include "baselayer.h"
|
||||
#include "palette.h"
|
||||
|
||||
#include "cmdlib.h"
|
||||
#include "grpscan.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -211,23 +211,10 @@ void G_SetupGlobalPsky(void)
|
|||
|
||||
//////////
|
||||
|
||||
static char g_rootDir[BMAX_PATH];
|
||||
static void G_LoadAddon(void);
|
||||
int32_t g_groupFileHandle;
|
||||
struct strllist* CommandPaths, * CommandGrps;
|
||||
|
||||
void G_ExtPreInit(int32_t argc,char const * const * argv)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
GetModuleFileNameA(NULL,g_rootDir,BMAX_PATH);
|
||||
Bcorrectfilename(g_rootDir,1);
|
||||
//chdir(g_rootDir);
|
||||
#else
|
||||
getcwd(g_rootDir,BMAX_PATH);
|
||||
strcat(g_rootDir,"/");
|
||||
#endif
|
||||
}
|
||||
|
||||
void G_ExtInit(void)
|
||||
{
|
||||
char cwd[BMAX_PATH];
|
||||
|
@ -357,8 +344,8 @@ void G_LoadGroups(int32_t autoload)
|
|||
{
|
||||
char cwd[BMAX_PATH];
|
||||
|
||||
Bstrcat(g_rootDir, g_modDir);
|
||||
addsearchpath(g_rootDir);
|
||||
FString g_rootDir = progdir + g_modDir;
|
||||
addsearchpath(g_rootDir);
|
||||
// addsearchpath(mod_dir);
|
||||
|
||||
char path[BMAX_PATH];
|
||||
|
|
|
@ -127,7 +127,6 @@ extern void G_SetupGlobalPsky(void);
|
|||
extern void G_AddSearchPaths(void);
|
||||
extern void G_CleanupSearchPaths(void);
|
||||
|
||||
extern void G_ExtPreInit(int32_t argc,char const * const * argv);
|
||||
extern void G_ExtInit(void);
|
||||
extern void G_ScanGroups(void);
|
||||
extern void G_LoadGroups(int32_t autoload);
|
||||
|
|
|
@ -527,48 +527,6 @@ int32_t CONFIG_ReadSetup(void)
|
|||
|
||||
void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.cfg
|
||||
{
|
||||
int32_t i;
|
||||
BFILE *fp;
|
||||
char *ptr = Xstrdup(g_setupFileName);
|
||||
char tempbuf[128];
|
||||
|
||||
if (!Bstrcmp(g_setupFileName, SETUPFILENAME))
|
||||
Bsprintf(tempbuf, "settings.cfg");
|
||||
else Bsprintf(tempbuf, "%s_settings.cfg", strtok(ptr, "."));
|
||||
|
||||
fp = Bfopen(tempbuf, "wt");
|
||||
|
||||
if (fp)
|
||||
{
|
||||
Bfprintf(fp,"unbindall\n");
|
||||
|
||||
for (i=0; i<MAXBOUNDKEYS+MAXMOUSEBUTTONS; i++)
|
||||
if (CONTROL_KeyIsBound(i))
|
||||
Bfprintf(fp,"bind \"%s\"%s \"%s\"\n",CONTROL_KeyBinds[i].key,
|
||||
CONTROL_KeyBinds[i].repeat?"":" norepeat",CONTROL_KeyBinds[i].cmdstr);
|
||||
|
||||
OSD_WriteAliases(fp);
|
||||
|
||||
if (g_crosshairSum != -1 && g_crosshairSum != DefaultCrosshairColors.r+(DefaultCrosshairColors.g<<8)+(DefaultCrosshairColors.b<<16))
|
||||
Bfprintf(fp, "crosshaircolor %d %d %d\n", CrosshairColors.r, CrosshairColors.g, CrosshairColors.b);
|
||||
|
||||
OSD_WriteCvars(fp);
|
||||
|
||||
Bfclose(fp);
|
||||
|
||||
if (!Bstrcmp(g_setupFileName, SETUPFILENAME))
|
||||
OSD_Printf("Wrote settings.cfg\n");
|
||||
else OSD_Printf("Wrote %s_settings.cfg\n",ptr);
|
||||
|
||||
Bfree(ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Bstrcmp(g_setupFileName, SETUPFILENAME))
|
||||
OSD_Printf("Error writing settings.cfg: %s\n", strerror(errno));
|
||||
else OSD_Printf("Error writing %s_settings.cfg: %s\n",ptr,strerror(errno));
|
||||
|
||||
Bfree(ptr);
|
||||
}
|
||||
|
||||
void CONFIG_WriteSetup(uint32_t flags)
|
||||
|
|
|
@ -7670,10 +7670,6 @@ int app_main(int argc, char const * const * argv)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
G_ExtPreInit(argc, argv);
|
||||
|
||||
OSD_SetLogFile(APPBASENAME ".log");
|
||||
|
||||
OSD_SetFunctions(GAME_drawosdchar,
|
||||
GAME_drawosdstr,
|
||||
GAME_drawosdcursor,
|
||||
|
@ -7910,18 +7906,9 @@ int app_main(int argc, char const * const * argv)
|
|||
g_clipMapFiles.clear();
|
||||
#endif
|
||||
|
||||
char *const setupFileName = Xstrdup(g_setupFileName);
|
||||
char *const p = strtok(setupFileName, ".");
|
||||
|
||||
if (!p || !Bstrcmp(g_setupFileName, SETUPFILENAME))
|
||||
Bsprintf(tempbuf, "settings.cfg");
|
||||
else
|
||||
Bsprintf(tempbuf, "%s_settings.cfg", p);
|
||||
|
||||
Bfree(setupFileName);
|
||||
|
||||
OSD_Exec(tempbuf);
|
||||
#if 0
|
||||
OSD_Exec("autoexec.cfg");
|
||||
#endif
|
||||
|
||||
system_getcvars();
|
||||
|
||||
|
|
|
@ -3462,8 +3462,6 @@ int32_t app_main(int32_t argc, char const * const * argv)
|
|||
}
|
||||
#endif
|
||||
|
||||
OSD_SetLogFile(APPBASENAME ".log");
|
||||
|
||||
{
|
||||
//char *supportdir = Bgetsupportdir(TRUE);
|
||||
char *appdir = Bgetappdir();
|
||||
|
@ -3538,8 +3536,6 @@ int32_t app_main(int32_t argc, char const * const * argv)
|
|||
}
|
||||
#endif
|
||||
|
||||
OSD_SetLogFile("sw.log");
|
||||
|
||||
if (g_grpNamePtr == NULL)
|
||||
{
|
||||
const char *cp = getenv("SWGRP");
|
||||
|
|
Loading…
Reference in a new issue