2006-02-24 04:48:15 +00:00
|
|
|
/*
|
|
|
|
** gameconfigfile.cpp
|
|
|
|
** An .ini parser specifically for zdoom.ini
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
2008-12-07 00:50:04 +00:00
|
|
|
** Copyright 1998-2008 Randy Heit
|
2006-02-24 04:48:15 +00:00
|
|
|
** All rights reserved.
|
|
|
|
**
|
|
|
|
** Redistribution and use in source and binary forms, with or without
|
|
|
|
** modification, are permitted provided that the following conditions
|
|
|
|
** are met:
|
|
|
|
**
|
|
|
|
** 1. Redistributions of source code must retain the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer.
|
|
|
|
** 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer in the
|
|
|
|
** documentation and/or other materials provided with the distribution.
|
|
|
|
** 3. The name of the author may not be used to endorse or promote products
|
|
|
|
** derived from this software without specific prior written permission.
|
|
|
|
**
|
|
|
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
2009-09-03 04:40:13 +00:00
|
|
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OFf
|
2006-02-24 04:48:15 +00:00
|
|
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
2009-09-03 03:51:41 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
#include <CoreServices/CoreServices.h>
|
|
|
|
#endif
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include <windows.h>
|
|
|
|
extern HWND Window;
|
2006-09-14 00:02:31 +00:00
|
|
|
#define USE_WINDOWS_DWORD
|
2006-02-24 04:48:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "doomdef.h"
|
|
|
|
#include "gameconfigfile.h"
|
|
|
|
#include "c_cvars.h"
|
|
|
|
#include "c_dispatch.h"
|
|
|
|
#include "c_bind.h"
|
|
|
|
#include "gstrings.h"
|
|
|
|
#include "m_argv.h"
|
|
|
|
#include "cmdlib.h"
|
|
|
|
#include "version.h"
|
|
|
|
#include "m_misc.h"
|
|
|
|
#include "v_font.h"
|
|
|
|
#include "a_pickups.h"
|
|
|
|
#include "doomstat.h"
|
|
|
|
#include "i_system.h"
|
2010-10-15 15:13:53 +00:00
|
|
|
#include "gi.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
EXTERN_CVAR (Bool, con_centernotify)
|
|
|
|
EXTERN_CVAR (Int, msg0color)
|
|
|
|
EXTERN_CVAR (Color, color)
|
|
|
|
EXTERN_CVAR (Float, dimamount)
|
|
|
|
EXTERN_CVAR (Int, msgmidcolor)
|
|
|
|
EXTERN_CVAR (Int, msgmidcolor2)
|
|
|
|
EXTERN_CVAR (Bool, snd_pitched)
|
|
|
|
EXTERN_CVAR (Color, am_wallcolor)
|
|
|
|
EXTERN_CVAR (Color, am_fdwallcolor)
|
|
|
|
EXTERN_CVAR (Color, am_cdwallcolor)
|
2008-04-09 03:55:04 +00:00
|
|
|
EXTERN_CVAR (Float, spc_amp)
|
2009-02-19 14:36:37 +00:00
|
|
|
EXTERN_CVAR (Bool, wi_percents)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
FGameConfigFile::FGameConfigFile ()
|
|
|
|
{
|
2009-09-09 17:12:47 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
FString user_docs, user_app_support, local_app_support;
|
|
|
|
#endif
|
2006-05-03 22:45:01 +00:00
|
|
|
FString pathname;
|
2012-05-15 21:47:15 +00:00
|
|
|
|
|
|
|
OkayToWrite = false; // Do not allow saving of the config before DoGameSetup()
|
2006-02-24 04:48:15 +00:00
|
|
|
bMigrating = false;
|
2013-05-25 16:34:23 +00:00
|
|
|
bModSetup = false;
|
2006-02-24 04:48:15 +00:00
|
|
|
pathname = GetConfigPath (true);
|
|
|
|
ChangePathName (pathname);
|
|
|
|
LoadConfigFile (MigrateStub, NULL);
|
|
|
|
|
|
|
|
if (!HaveSections ())
|
|
|
|
{ // Config file not found; try the old one
|
|
|
|
MigrateOldConfig ();
|
|
|
|
}
|
|
|
|
|
|
|
|
// If zdoom.ini was read from the program directory, switch
|
|
|
|
// to the user directory now. If it was read from the user
|
|
|
|
// directory, this effectively does nothing.
|
|
|
|
pathname = GetConfigPath (false);
|
|
|
|
ChangePathName (pathname);
|
|
|
|
|
|
|
|
// Set default IWAD search paths if none present
|
|
|
|
if (!SetSection ("IWADSearch.Directories"))
|
|
|
|
{
|
|
|
|
SetSection ("IWADSearch.Directories", true);
|
|
|
|
SetValueForKey ("Path", ".", true);
|
|
|
|
SetValueForKey ("Path", "$DOOMWADDIR", true);
|
2009-09-09 17:12:47 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
char cpath[PATH_MAX];
|
|
|
|
FSRef folder;
|
|
|
|
|
|
|
|
if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) &&
|
|
|
|
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
|
|
|
|
{
|
|
|
|
user_docs << cpath << "/" GAME_DIR;
|
|
|
|
SetValueForKey("Path", user_docs, true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetValueForKey("Path", "~/" GAME_DIR, true);
|
|
|
|
}
|
|
|
|
if (noErr == FSFindFolder(kUserDomain, kApplicationSupportFolderType, kCreateFolder, &folder) &&
|
|
|
|
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
|
|
|
|
{
|
|
|
|
user_app_support << cpath << "/" GAME_DIR;
|
|
|
|
SetValueForKey("Path", user_app_support, true);
|
|
|
|
}
|
|
|
|
SetValueForKey ("Path", "$PROGDIR", true);
|
|
|
|
if (noErr == FSFindFolder(kLocalDomain, kApplicationSupportFolderType, kCreateFolder, &folder) &&
|
|
|
|
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
|
|
|
|
{
|
|
|
|
local_app_support << cpath << "/" GAME_DIR;
|
|
|
|
SetValueForKey("Path", local_app_support, true);
|
|
|
|
}
|
2013-07-30 09:45:42 +00:00
|
|
|
#elif !defined(__unix__)
|
2006-02-24 04:48:15 +00:00
|
|
|
SetValueForKey ("Path", "$HOME", true);
|
|
|
|
SetValueForKey ("Path", "$PROGDIR", true);
|
|
|
|
#else
|
2009-09-09 17:12:47 +00:00
|
|
|
SetValueForKey ("Path", "~/" GAME_DIR, true);
|
2006-02-24 04:48:15 +00:00
|
|
|
SetValueForKey ("Path", SHARE_DIR, true);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set default search paths if none present
|
|
|
|
if (!SetSection ("FileSearch.Directories"))
|
|
|
|
{
|
|
|
|
SetSection ("FileSearch.Directories", true);
|
2009-09-09 17:12:47 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
SetValueForKey ("Path", user_docs, true);
|
|
|
|
SetValueForKey ("Path", user_app_support, true);
|
|
|
|
SetValueForKey ("Path", "$PROGDIR", true);
|
|
|
|
SetValueForKey ("Path", local_app_support, true);
|
2013-07-30 09:45:42 +00:00
|
|
|
#elif !defined(__unix__)
|
2006-02-24 04:48:15 +00:00
|
|
|
SetValueForKey ("Path", "$PROGDIR", true);
|
|
|
|
#else
|
2011-02-02 02:11:15 +00:00
|
|
|
SetValueForKey ("Path", "~/" GAME_DIR, true);
|
2006-02-24 04:48:15 +00:00
|
|
|
SetValueForKey ("Path", SHARE_DIR, true);
|
|
|
|
#endif
|
|
|
|
SetValueForKey ("Path", "$DOOMWADDIR", true);
|
|
|
|
}
|
2008-12-07 00:50:04 +00:00
|
|
|
|
|
|
|
// Create auto-load sections, so users know what's available.
|
|
|
|
// Note that this totem pole is the reverse of the order that
|
|
|
|
// they will appear in the file.
|
2010-01-16 07:51:50 +00:00
|
|
|
CreateSectionAtStart("Harmony.Autoload");
|
|
|
|
CreateSectionAtStart("UrbanBrawl.Autoload");
|
2008-12-07 00:50:04 +00:00
|
|
|
CreateSectionAtStart("Chex3.Autoload");
|
2015-01-22 07:38:08 +00:00
|
|
|
CreateSectionAtStart("Chex1.Autoload");
|
2008-12-07 00:50:04 +00:00
|
|
|
CreateSectionAtStart("Chex.Autoload");
|
|
|
|
CreateSectionAtStart("Strife.Autoload");
|
|
|
|
CreateSectionAtStart("HexenDK.Autoload");
|
|
|
|
CreateSectionAtStart("Hexen.Autoload");
|
2015-01-22 07:38:08 +00:00
|
|
|
CreateSectionAtStart("HereticSR.Autoload");
|
2008-12-07 00:50:04 +00:00
|
|
|
CreateSectionAtStart("Heretic.Autoload");
|
|
|
|
CreateSectionAtStart("FreeDM.Autoload");
|
2015-01-22 07:38:08 +00:00
|
|
|
CreateSectionAtStart("Freedoom2.Autoload");
|
2008-12-07 00:50:04 +00:00
|
|
|
CreateSectionAtStart("Freedoom1.Autoload");
|
|
|
|
CreateSectionAtStart("Freedoom.Autoload");
|
|
|
|
CreateSectionAtStart("Plutonia.Autoload");
|
|
|
|
CreateSectionAtStart("TNT.Autoload");
|
2015-01-22 07:38:08 +00:00
|
|
|
CreateSectionAtStart("Doom2BFG.Autoload");
|
2008-12-07 00:50:04 +00:00
|
|
|
CreateSectionAtStart("Doom2.Autoload");
|
2015-01-22 07:38:08 +00:00
|
|
|
CreateSectionAtStart("DoomBFG.Autoload");
|
2015-01-22 18:55:20 +00:00
|
|
|
CreateSectionAtStart("DoomU.Autoload");
|
|
|
|
CreateSectionAtStart("Doom1.Autoload");
|
2008-12-07 00:50:04 +00:00
|
|
|
CreateSectionAtStart("Doom.Autoload");
|
|
|
|
CreateSectionAtStart("Global.Autoload");
|
|
|
|
|
|
|
|
// The same goes for auto-exec files.
|
|
|
|
CreateStandardAutoExec("Chex.AutoExec", true);
|
|
|
|
CreateStandardAutoExec("Strife.AutoExec", true);
|
|
|
|
CreateStandardAutoExec("Hexen.AutoExec", true);
|
|
|
|
CreateStandardAutoExec("Heretic.AutoExec", true);
|
|
|
|
CreateStandardAutoExec("Doom.AutoExec", true);
|
|
|
|
|
|
|
|
// Move search paths back to the top.
|
|
|
|
MoveSectionToStart("FileSearch.Directories");
|
|
|
|
MoveSectionToStart("IWADSearch.Directories");
|
|
|
|
|
|
|
|
// Add some self-documentation.
|
|
|
|
SetSectionNote("IWADSearch.Directories",
|
|
|
|
"# These are the directories to automatically search for IWADs.\n"
|
|
|
|
"# Each directory should be on a separate line, preceded by Path=\n");
|
|
|
|
SetSectionNote("FileSearch.Directories",
|
|
|
|
"# These are the directories to search for wads added with the -file\n"
|
|
|
|
"# command line parameter, if they cannot be found with the path\n"
|
|
|
|
"# as-is. Layout is the same as for IWADSearch.Directories\n");
|
|
|
|
SetSectionNote("Doom.AutoExec",
|
|
|
|
"# Files to automatically execute when running the corresponding game.\n"
|
|
|
|
"# Each file should be on its own line, preceded by Path=\n\n");
|
|
|
|
SetSectionNote("Global.Autoload",
|
|
|
|
"# WAD files to always load. These are loaded after the IWAD but before\n"
|
|
|
|
"# any files added with -file. Place each file on its own line, preceded\n"
|
|
|
|
"# by Path=\n");
|
|
|
|
SetSectionNote("Doom.Autoload",
|
|
|
|
"# Wad files to automatically load depending on the game and IWAD you are\n"
|
|
|
|
"# playing. You may have have files that are loaded for all similar IWADs\n"
|
|
|
|
"# (the game) and files that are only loaded for particular IWADs. For example,\n"
|
|
|
|
"# any files listed under Doom.Autoload will be loaded for any version of Doom,\n"
|
|
|
|
"# but files listed under Doom2.Autoload will only load when you are\n"
|
|
|
|
"# playing Doom 2.\n\n");
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FGameConfigFile::~FGameConfigFile ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGameConfigFile::WriteCommentHeader (FILE *file) const
|
|
|
|
{
|
2013-06-23 02:49:51 +00:00
|
|
|
fprintf (file, "# This file was generated by " GAMENAME " %s on %s\n", GetVersionString(), myasctime());
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FGameConfigFile::MigrateStub (const char *pathname, FConfigFile *config, void *userdata)
|
|
|
|
{
|
|
|
|
static_cast<FGameConfigFile *>(config)->bMigrating = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGameConfigFile::MigrateOldConfig ()
|
|
|
|
{
|
|
|
|
// Set default key bindings. These will be overridden
|
|
|
|
// by the bindings in the config file if it exists.
|
|
|
|
C_SetDefaultBindings ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGameConfigFile::DoGlobalSetup ()
|
|
|
|
{
|
|
|
|
if (SetSection ("GlobalSettings.Unknown"))
|
|
|
|
{
|
|
|
|
ReadCVars (CVAR_GLOBALCONFIG);
|
|
|
|
}
|
|
|
|
if (SetSection ("GlobalSettings"))
|
|
|
|
{
|
|
|
|
ReadCVars (CVAR_GLOBALCONFIG);
|
|
|
|
}
|
|
|
|
if (SetSection ("LastRun"))
|
|
|
|
{
|
|
|
|
const char *lastver = GetValueForKey ("Version");
|
|
|
|
if (lastver != NULL)
|
|
|
|
{
|
|
|
|
double last = atof (lastver);
|
|
|
|
if (last < 123.1)
|
|
|
|
{
|
|
|
|
FBaseCVar *noblitter = FindCVar ("vid_noblitter", NULL);
|
|
|
|
if (noblitter != NULL)
|
|
|
|
{
|
|
|
|
noblitter->ResetToDefault ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (last < 202)
|
|
|
|
{
|
|
|
|
// Make sure the Hexen hotkeys are accessible by default.
|
|
|
|
if (SetSection ("Hexen.Bindings"))
|
|
|
|
{
|
|
|
|
SetValueForKey ("\\", "use ArtiHealth");
|
|
|
|
SetValueForKey ("scroll", "+showscores");
|
|
|
|
SetValueForKey ("0", "useflechette");
|
|
|
|
SetValueForKey ("9", "use ArtiBlastRadius");
|
|
|
|
SetValueForKey ("8", "use ArtiTeleport");
|
|
|
|
SetValueForKey ("7", "use ArtiTeleportOther");
|
2010-02-12 23:18:41 +00:00
|
|
|
SetValueForKey ("6", "use ArtiPork");
|
|
|
|
SetValueForKey ("5", "use ArtiInvulnerability2");
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (last < 204)
|
|
|
|
{ // The old default for vsync was true, but with an unlimited framerate
|
|
|
|
// now, false is a better default.
|
|
|
|
FBaseCVar *vsync = FindCVar ("vid_vsync", NULL);
|
|
|
|
if (vsync != NULL)
|
|
|
|
{
|
|
|
|
vsync->ResetToDefault ();
|
|
|
|
}
|
|
|
|
}
|
2008-03-11 22:17:57 +00:00
|
|
|
if (last < 206)
|
|
|
|
{ // spc_amp is now a float, not an int.
|
2008-04-09 03:55:04 +00:00
|
|
|
if (spc_amp > 16)
|
2008-03-11 22:17:57 +00:00
|
|
|
{
|
2008-04-09 03:55:04 +00:00
|
|
|
spc_amp = spc_amp / 16.f;
|
2008-03-11 22:17:57 +00:00
|
|
|
}
|
|
|
|
}
|
2008-04-09 03:55:04 +00:00
|
|
|
if (last < 207)
|
|
|
|
{ // Now that snd_midiprecache works again, you probably don't want it on.
|
2008-04-12 05:04:37 +00:00
|
|
|
FBaseCVar *precache = FindCVar ("snd_midiprecache", NULL);
|
|
|
|
if (precache != NULL)
|
|
|
|
{
|
|
|
|
precache->ResetToDefault();
|
|
|
|
}
|
2008-04-09 03:55:04 +00:00
|
|
|
}
|
2009-02-20 00:53:25 +00:00
|
|
|
if (last < 208)
|
|
|
|
{ // Weapon sections are no longer used, so tidy up the config by deleting them.
|
|
|
|
const char *name;
|
|
|
|
size_t namelen;
|
|
|
|
bool more;
|
|
|
|
|
|
|
|
more = SetFirstSection();
|
|
|
|
while (more)
|
|
|
|
{
|
|
|
|
name = GetCurrentSection();
|
|
|
|
if (name != NULL &&
|
|
|
|
(namelen = strlen(name)) > 12 &&
|
|
|
|
strcmp(name + namelen - 12, ".WeaponSlots") == 0)
|
|
|
|
{
|
|
|
|
more = DeleteCurrentSection();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
more = SetNextSection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-09-04 22:25:46 +00:00
|
|
|
if (last < 209)
|
|
|
|
{
|
|
|
|
// menu dimming is now a gameinfo option so switch user override off
|
|
|
|
FBaseCVar *dim = FindCVar ("dimamount", NULL);
|
|
|
|
if (dim != NULL)
|
|
|
|
{
|
|
|
|
dim->ResetToDefault ();
|
|
|
|
}
|
|
|
|
}
|
2010-02-12 23:18:41 +00:00
|
|
|
if (last < 210)
|
|
|
|
{
|
|
|
|
if (SetSection ("Hexen.Bindings"))
|
|
|
|
{
|
|
|
|
// These 2 were misnamed in earlier versions
|
|
|
|
SetValueForKey ("6", "use ArtiPork");
|
|
|
|
SetValueForKey ("5", "use ArtiInvulnerability2");
|
|
|
|
}
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGameConfigFile::DoGameSetup (const char *gamename)
|
|
|
|
{
|
|
|
|
const char *key;
|
|
|
|
const char *value;
|
|
|
|
|
|
|
|
if (bMigrating)
|
|
|
|
{
|
|
|
|
MigrateOldConfig ();
|
|
|
|
}
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
sublen = countof(section) - 1 - mysnprintf (section, countof(section), "%s.", gamename);
|
|
|
|
subsection = section + countof(section) - sublen - 1;
|
|
|
|
section[countof(section) - 1] = '\0';
|
2006-02-24 04:48:15 +00:00
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
strncpy (subsection, "UnknownConsoleVariables", sublen);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (SetSection (section))
|
|
|
|
{
|
|
|
|
ReadCVars (0);
|
|
|
|
}
|
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
strncpy (subsection, "ConsoleVariables", sublen);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (SetSection (section))
|
|
|
|
{
|
|
|
|
ReadCVars (0);
|
|
|
|
}
|
|
|
|
|
2010-10-15 15:13:53 +00:00
|
|
|
if (gameinfo.gametype & GAME_Raven)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-10-15 15:13:53 +00:00
|
|
|
SetRavenDefaults (gameinfo.gametype == GAME_Hexen);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2013-05-25 16:34:23 +00:00
|
|
|
// The NetServerInfo section will be read and override anything loaded
|
|
|
|
// here when it's determined that a netgame is being played.
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
strncpy (subsection, "LocalServerInfo", sublen);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (SetSection (section))
|
|
|
|
{
|
|
|
|
ReadCVars (0);
|
|
|
|
}
|
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
strncpy (subsection, "Player", sublen);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (SetSection (section))
|
|
|
|
{
|
|
|
|
ReadCVars (0);
|
|
|
|
}
|
|
|
|
|
2010-08-27 15:20:05 +00:00
|
|
|
if (!bMigrating)
|
|
|
|
{
|
|
|
|
C_SetDefaultBindings ();
|
|
|
|
}
|
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
strncpy (subsection, "Bindings", sublen);
|
2010-08-27 15:20:05 +00:00
|
|
|
if (SetSection (section))
|
|
|
|
{
|
|
|
|
Bindings.UnbindAll();
|
|
|
|
while (NextInSection (key, value))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-08-27 15:20:05 +00:00
|
|
|
Bindings.DoBind (key, value);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
2010-08-27 15:20:05 +00:00
|
|
|
|
|
|
|
strncpy (subsection, "DoubleBindings", sublen);
|
|
|
|
if (SetSection (section))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-08-27 15:20:05 +00:00
|
|
|
DoubleBindings.UnbindAll();
|
2006-02-24 04:48:15 +00:00
|
|
|
while (NextInSection (key, value))
|
|
|
|
{
|
2010-08-27 15:20:05 +00:00
|
|
|
DoubleBindings.DoBind (key, value);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-27 15:20:05 +00:00
|
|
|
strncpy (subsection, "AutomapBindings", sublen);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (SetSection (section))
|
|
|
|
{
|
2010-08-27 15:20:05 +00:00
|
|
|
AutomapBindings.UnbindAll();
|
2006-02-24 04:48:15 +00:00
|
|
|
while (NextInSection (key, value))
|
|
|
|
{
|
2010-08-27 15:20:05 +00:00
|
|
|
AutomapBindings.DoBind (key, value);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
strncpy (subsection, "ConsoleAliases", sublen);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (SetSection (section))
|
|
|
|
{
|
|
|
|
const char *name = NULL;
|
|
|
|
while (NextInSection (key, value))
|
|
|
|
{
|
|
|
|
if (stricmp (key, "Name") == 0)
|
|
|
|
{
|
|
|
|
name = value;
|
|
|
|
}
|
|
|
|
else if (stricmp (key, "Command") == 0 && name != NULL)
|
|
|
|
{
|
|
|
|
C_SetAlias (name, value);
|
|
|
|
name = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-05-15 21:47:15 +00:00
|
|
|
OkayToWrite = true;
|
2007-04-28 09:06:32 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2013-05-25 16:34:23 +00:00
|
|
|
// Like DoGameSetup(), but for mod-specific cvars.
|
|
|
|
// Called after CVARINFO has been parsed.
|
|
|
|
void FGameConfigFile::DoModSetup(const char *gamename)
|
|
|
|
{
|
|
|
|
mysnprintf(section, countof(section), "%s.Player.Mod", gamename);
|
|
|
|
if (SetSection(section))
|
|
|
|
{
|
2013-05-25 17:08:59 +00:00
|
|
|
ReadCVars(CVAR_MOD|CVAR_USERINFO|CVAR_IGNORE);
|
2013-05-25 16:34:23 +00:00
|
|
|
}
|
|
|
|
mysnprintf(section, countof(section), "%s.LocalServerInfo.Mod", gamename);
|
|
|
|
if (SetSection (section))
|
|
|
|
{
|
2013-05-25 17:08:59 +00:00
|
|
|
ReadCVars (CVAR_MOD|CVAR_SERVERINFO|CVAR_IGNORE);
|
2013-05-25 16:34:23 +00:00
|
|
|
}
|
|
|
|
// Signal that these sections should be rewritten when saving the config.
|
|
|
|
bModSetup = true;
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void FGameConfigFile::ReadNetVars ()
|
|
|
|
{
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
strncpy (subsection, "NetServerInfo", sublen);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (SetSection (section))
|
|
|
|
{
|
|
|
|
ReadCVars (0);
|
|
|
|
}
|
2013-05-25 16:34:23 +00:00
|
|
|
if (bModSetup)
|
|
|
|
{
|
|
|
|
mysnprintf(subsection, sublen, "NetServerInfo.Mod");
|
|
|
|
if (SetSection(section))
|
|
|
|
{
|
2013-05-25 17:08:59 +00:00
|
|
|
ReadCVars(CVAR_MOD|CVAR_SERVERINFO|CVAR_IGNORE);
|
2013-05-25 16:34:23 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2013-05-25 16:34:23 +00:00
|
|
|
// Read cvars from a cvar section of the ini. Flags are the flags to give
|
|
|
|
// to newly-created cvars that were not already defined.
|
2006-02-24 04:48:15 +00:00
|
|
|
void FGameConfigFile::ReadCVars (DWORD flags)
|
|
|
|
{
|
|
|
|
const char *key, *value;
|
|
|
|
FBaseCVar *cvar;
|
|
|
|
UCVarValue val;
|
|
|
|
|
2013-05-25 17:08:59 +00:00
|
|
|
flags |= CVAR_ARCHIVE|CVAR_UNSETTABLE|CVAR_AUTO;
|
2006-02-24 04:48:15 +00:00
|
|
|
while (NextInSection (key, value))
|
|
|
|
{
|
|
|
|
cvar = FindCVar (key, NULL);
|
|
|
|
if (cvar == NULL)
|
|
|
|
{
|
2013-05-25 16:34:23 +00:00
|
|
|
cvar = new FStringCVar (key, NULL, flags);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
val.String = const_cast<char *>(value);
|
|
|
|
cvar->SetGenericRep (val, CVAR_String);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGameConfigFile::ArchiveGameData (const char *gamename)
|
|
|
|
{
|
|
|
|
char section[32*3], *subsection;
|
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
sublen = countof(section) - 1 - mysnprintf (section, countof(section), "%s.", gamename);
|
|
|
|
subsection = section + countof(section) - 1 - sublen;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
strncpy (subsection, "Player", sublen);
|
2006-02-24 04:48:15 +00:00
|
|
|
SetSection (section, true);
|
|
|
|
ClearCurrentSection ();
|
2013-05-25 03:23:44 +00:00
|
|
|
C_ArchiveCVars (this, CVAR_ARCHIVE|CVAR_USERINFO);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2013-05-25 16:34:23 +00:00
|
|
|
if (bModSetup)
|
|
|
|
{
|
|
|
|
strncpy (subsection + 6, ".Mod", sublen - 6);
|
|
|
|
SetSection (section, true);
|
|
|
|
ClearCurrentSection ();
|
2013-05-25 17:08:59 +00:00
|
|
|
C_ArchiveCVars (this, CVAR_MOD|CVAR_ARCHIVE|CVAR_AUTO|CVAR_USERINFO);
|
2013-05-25 16:34:23 +00:00
|
|
|
}
|
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
strncpy (subsection, "ConsoleVariables", sublen);
|
2006-02-24 04:48:15 +00:00
|
|
|
SetSection (section, true);
|
|
|
|
ClearCurrentSection ();
|
2013-05-25 03:23:44 +00:00
|
|
|
C_ArchiveCVars (this, CVAR_ARCHIVE);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2013-05-25 16:34:23 +00:00
|
|
|
// Do not overwrite the serverinfo section if playing a netgame, and
|
|
|
|
// this machine was not the initial host.
|
2006-02-24 04:48:15 +00:00
|
|
|
if (!netgame || consoleplayer == 0)
|
2013-05-25 16:34:23 +00:00
|
|
|
{
|
|
|
|
strncpy (subsection, netgame ? "NetServerInfo" : "LocalServerInfo", sublen);
|
2006-02-24 04:48:15 +00:00
|
|
|
SetSection (section, true);
|
|
|
|
ClearCurrentSection ();
|
2013-05-25 03:23:44 +00:00
|
|
|
C_ArchiveCVars (this, CVAR_ARCHIVE|CVAR_SERVERINFO);
|
2013-05-25 16:34:23 +00:00
|
|
|
|
|
|
|
if (bModSetup)
|
|
|
|
{
|
|
|
|
strncpy (subsection, netgame ? "NetServerInfo.Mod" : "LocalServerInfo.Mod", sublen);
|
|
|
|
SetSection (section, true);
|
|
|
|
ClearCurrentSection ();
|
2013-05-25 17:08:59 +00:00
|
|
|
C_ArchiveCVars (this, CVAR_MOD|CVAR_ARCHIVE|CVAR_AUTO|CVAR_SERVERINFO);
|
2013-05-25 16:34:23 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
strncpy (subsection, "UnknownConsoleVariables", sublen);
|
2006-02-24 04:48:15 +00:00
|
|
|
SetSection (section, true);
|
|
|
|
ClearCurrentSection ();
|
2013-05-25 03:23:44 +00:00
|
|
|
C_ArchiveCVars (this, CVAR_ARCHIVE|CVAR_AUTO);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
strncpy (subsection, "ConsoleAliases", sublen);
|
2006-02-24 04:48:15 +00:00
|
|
|
SetSection (section, true);
|
|
|
|
ClearCurrentSection ();
|
|
|
|
C_ArchiveAliases (this);
|
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
M_SaveCustomKeys (this, section, subsection, sublen);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
strcpy (subsection, "Bindings");
|
|
|
|
SetSection (section, true);
|
2010-08-27 15:20:05 +00:00
|
|
|
Bindings.ArchiveBindings (this);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
strncpy (subsection, "DoubleBindings", sublen);
|
2006-02-24 04:48:15 +00:00
|
|
|
SetSection (section, true);
|
2010-08-27 15:20:05 +00:00
|
|
|
DoubleBindings.ArchiveBindings (this);
|
|
|
|
|
|
|
|
strncpy (subsection, "AutomapBindings", sublen);
|
|
|
|
SetSection (section, true);
|
|
|
|
AutomapBindings.ArchiveBindings (this);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FGameConfigFile::ArchiveGlobalData ()
|
|
|
|
{
|
|
|
|
SetSection ("LastRun", true);
|
|
|
|
ClearCurrentSection ();
|
2006-04-21 05:44:21 +00:00
|
|
|
SetValueForKey ("Version", LASTRUNVERSION);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
SetSection ("GlobalSettings", true);
|
|
|
|
ClearCurrentSection ();
|
2013-05-25 03:23:44 +00:00
|
|
|
C_ArchiveCVars (this, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
SetSection ("GlobalSettings.Unknown", true);
|
|
|
|
ClearCurrentSection ();
|
2013-05-25 03:23:44 +00:00
|
|
|
C_ArchiveCVars (this, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_AUTO);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2006-05-03 22:45:01 +00:00
|
|
|
FString FGameConfigFile::GetConfigPath (bool tryProg)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-03-02 04:51:16 +00:00
|
|
|
const char *pathval;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
pathval = Args->CheckValue ("-config");
|
2006-02-24 04:48:15 +00:00
|
|
|
if (pathval != NULL)
|
2010-03-02 04:51:16 +00:00
|
|
|
{
|
2006-05-03 22:45:01 +00:00
|
|
|
return FString(pathval);
|
2010-03-02 04:51:16 +00:00
|
|
|
}
|
2013-09-15 02:02:47 +00:00
|
|
|
return M_GetConfigPath(tryProg);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-12-07 00:50:04 +00:00
|
|
|
void FGameConfigFile::CreateStandardAutoExec(const char *section, bool start)
|
|
|
|
{
|
|
|
|
if (!SetSection(section))
|
|
|
|
{
|
2013-09-15 02:02:47 +00:00
|
|
|
FString path = M_GetAutoexecPath();
|
2008-12-07 00:50:04 +00:00
|
|
|
SetSection (section, true);
|
|
|
|
SetValueForKey ("Path", path.GetChars());
|
|
|
|
}
|
|
|
|
if (start)
|
|
|
|
{
|
|
|
|
MoveSectionToStart(section);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void FGameConfigFile::AddAutoexec (DArgs *list, const char *game)
|
|
|
|
{
|
|
|
|
char section[64];
|
|
|
|
const char *key;
|
|
|
|
const char *value;
|
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
mysnprintf (section, countof(section), "%s.AutoExec", game);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (bMigrating)
|
|
|
|
{
|
|
|
|
FBaseCVar *autoexec = FindCVar ("autoexec", NULL);
|
|
|
|
|
|
|
|
if (autoexec != NULL)
|
|
|
|
{
|
|
|
|
UCVarValue val;
|
|
|
|
char *path;
|
|
|
|
|
|
|
|
val = autoexec->GetGenericRep (CVAR_String);
|
|
|
|
path = copystring (val.String);
|
|
|
|
delete autoexec;
|
|
|
|
SetSection (section, true);
|
|
|
|
SetValueForKey ("Path", path);
|
|
|
|
list->AppendArg (path);
|
|
|
|
delete[] path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// If <game>.AutoExec section does not exist, create it
|
|
|
|
// with a default autoexec.cfg file present.
|
2008-12-07 00:50:04 +00:00
|
|
|
CreateStandardAutoExec(section, false);
|
2006-02-24 04:48:15 +00:00
|
|
|
// Run any files listed in the <game>.AutoExec section
|
2008-12-07 00:50:04 +00:00
|
|
|
if (!SectionIsEmpty())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
while (NextInSection (key, value))
|
|
|
|
{
|
2008-12-07 00:50:04 +00:00
|
|
|
if (stricmp (key, "Path") == 0 && *value != '\0')
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-12-07 00:50:04 +00:00
|
|
|
FString expanded_path = ExpandEnvVars(value);
|
|
|
|
if (FileExists(expanded_path))
|
|
|
|
{
|
|
|
|
list->AppendArg (ExpandEnvVars(value));
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGameConfigFile::SetRavenDefaults (bool isHexen)
|
|
|
|
{
|
|
|
|
UCVarValue val;
|
|
|
|
|
|
|
|
if (bMigrating)
|
|
|
|
{
|
|
|
|
con_centernotify.ResetToDefault ();
|
|
|
|
msg0color.ResetToDefault ();
|
|
|
|
color.ResetToDefault ();
|
|
|
|
}
|
|
|
|
|
2009-02-19 14:36:37 +00:00
|
|
|
val.Bool = false;
|
|
|
|
wi_percents.SetGenericRepDefault (val, CVAR_Bool);
|
2006-02-24 04:48:15 +00:00
|
|
|
val.Bool = true;
|
|
|
|
con_centernotify.SetGenericRepDefault (val, CVAR_Bool);
|
|
|
|
snd_pitched.SetGenericRepDefault (val, CVAR_Bool);
|
|
|
|
val.Int = 9;
|
|
|
|
msg0color.SetGenericRepDefault (val, CVAR_Int);
|
|
|
|
val.Int = CR_WHITE;
|
|
|
|
msgmidcolor.SetGenericRepDefault (val, CVAR_Int);
|
|
|
|
val.Int = CR_YELLOW;
|
|
|
|
msgmidcolor2.SetGenericRepDefault (val, CVAR_Int);
|
|
|
|
|
|
|
|
val.Int = 0x543b17;
|
|
|
|
am_wallcolor.SetGenericRepDefault (val, CVAR_Int);
|
|
|
|
val.Int = 0xd0b085;
|
|
|
|
am_fdwallcolor.SetGenericRepDefault (val, CVAR_Int);
|
|
|
|
val.Int = 0x734323;
|
|
|
|
am_cdwallcolor.SetGenericRepDefault (val, CVAR_Int);
|
|
|
|
|
|
|
|
// Fix the Heretic/Hexen automap colors so they are correct.
|
|
|
|
// (They were wrong on older versions.)
|
|
|
|
if (*am_wallcolor == 0x2c1808 && *am_fdwallcolor == 0x887058 && *am_cdwallcolor == 0x4c3820)
|
|
|
|
{
|
|
|
|
am_wallcolor.ResetToDefault ();
|
|
|
|
am_fdwallcolor.ResetToDefault ();
|
|
|
|
am_cdwallcolor.ResetToDefault ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isHexen)
|
|
|
|
{
|
|
|
|
val.Int = 0x3f6040;
|
|
|
|
color.SetGenericRepDefault (val, CVAR_Int);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (whereisini)
|
|
|
|
{
|
2013-09-15 02:02:47 +00:00
|
|
|
FString path = M_GetConfigPath(false);
|
2006-02-24 04:48:15 +00:00
|
|
|
Printf ("%s\n", path.GetChars());
|
|
|
|
}
|