Merge branch 'misc_code_improvements' of https://github.com/edward-san/zdoom

This commit is contained in:
Christoph Oelckers 2015-04-03 09:33:33 +02:00
commit 6c603b3c78
8 changed files with 39 additions and 37 deletions

View File

@ -641,6 +641,23 @@ CCMD (error_fatal)
} }
} }
//==========================================================================
//
// CCMD crashout
//
// Debugging routine for testing the crash logger.
// Useless in a win32 debug build, because that doesn't enable the crash logger.
//
//==========================================================================
#if !defined(_WIN32) || !defined(_DEBUG)
CCMD (crashout)
{
*(volatile int *)0 = 0;
}
#endif
CCMD (dir) CCMD (dir)
{ {
FString dir, path; FString dir, path;

View File

@ -957,7 +957,7 @@ void ScanDirectory(TArray<FFileList> &list, const char *dirpath)
} }
} }
#elif defined(__sun) || defined(linux) #elif defined(__sun) || defined(__linux__)
//========================================================================== //==========================================================================
// //

View File

@ -47,6 +47,7 @@
#include "v_video.h" #include "v_video.h"
#include "gameconfigfile.h" #include "gameconfigfile.h"
#include "resourcefiles/resourcefile.h" #include "resourcefiles/resourcefile.h"
#include "version.h"
CVAR (Bool, queryiwad, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG); CVAR (Bool, queryiwad, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
@ -504,19 +505,19 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
if (numwads == 0) if (numwads == 0)
{ {
I_FatalError ("Cannot find a game IWAD (doom.wad, doom2.wad, heretic.wad, etc.).\n" I_FatalError ("Cannot find a game IWAD (doom.wad, doom2.wad, heretic.wad, etc.).\n"
"Did you install ZDoom properly? You can do either of the following:\n" "Did you install " GAMENAME " properly? You can do either of the following:\n"
"\n" "\n"
#if defined(_WIN32) #if defined(_WIN32)
"1. Place one or more of these wads in the same directory as ZDoom.\n" "1. Place one or more of these wads in the same directory as " GAMENAME ".\n"
"2. Edit your zdoom-username.ini and add the directories of your iwads\n" "2. Edit your " GAMENAMELOWERCASE "-username.ini and add the directories of your iwads\n"
"to the list beneath [IWADSearch.Directories]"); "to the list beneath [IWADSearch.Directories]");
#elif defined(__APPLE__) #elif defined(__APPLE__)
"1. Place one or more of these wads in ~/Library/Application Support/zdoom/\n" "1. Place one or more of these wads in ~/Library/Application Support/" GAMENAMELOWERCASE "/\n"
"2. Edit your ~/Library/Preferences/zdoom.ini and add the directories\n" "2. Edit your ~/Library/Preferences/" GAMENAMELOWERCASE ".ini and add the directories\n"
"of your iwads to the list beneath [IWADSearch.Directories]"); "of your iwads to the list beneath [IWADSearch.Directories]");
#else #else
"1. Place one or more of these wads in ~/.config/zdoom/.\n" "1. Place one or more of these wads in ~/.config/" GAMENAMELOWERCASE "/.\n"
"2. Edit your ~/.config/zdoom/zdoom.ini and add the directories of your\n" "2. Edit your ~/.config/" GAMENAMELOWERCASE "/" GAMENAMELOWERCASE ".ini and add the directories of your\n"
"iwads to the list beneath [IWADSearch.Directories]"); "iwads to the list beneath [IWADSearch.Directories]");
#endif #endif
} }

View File

@ -204,7 +204,7 @@ FString M_GetConfigPath(bool for_reading)
{ {
path += "/" GAME_DIR; path += "/" GAME_DIR;
CreatePath(path); CreatePath(path);
path += "/zdoom.ini"; path += "/" GAMENAMELOWERCASE ".ini";
} }
else else
{ // construct "$PROGDIR/zdoom-$USER.ini" { // construct "$PROGDIR/zdoom-$USER.ini"
@ -224,11 +224,11 @@ FString M_GetConfigPath(bool for_reading)
*probe = '_'; *probe = '_';
++probe; ++probe;
} }
path << "zdoom-" << uname << ".ini"; path << GAMENAMELOWERCASE "-" << uname << ".ini";
} }
else else
{ // Couldn't get user name, so just use zdoom.ini { // Couldn't get user name, so just use zdoom.ini
path += "zdoom.ini"; path += GAMENAMELOWERCASE ".ini";
} }
} }
@ -239,7 +239,7 @@ FString M_GetConfigPath(bool for_reading)
if (!FileExists(path)) if (!FileExists(path))
{ {
path = progdir; path = progdir;
path << "zdoom.ini"; path << GAMENAMELOWERCASE ".ini";
} }
} }
@ -411,11 +411,11 @@ FString M_GetConfigPath(bool for_reading)
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX)) noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
{ {
FString path; FString path;
path << cpath << "/zdoom.ini"; path << cpath << "/" GAMENAMELOWERCASE ".ini";
return path; return path;
} }
// Ungh. // Ungh.
return "zdoom.ini"; return GAMENAMELOWERCASE ".ini";
} }
//=========================================================================== //===========================================================================
@ -497,12 +497,12 @@ FString GetUserFile (const char *file)
// This can be removed after a release or two // This can be removed after a release or two
// Transfer the old zdoom directory to the new location // Transfer the old zdoom directory to the new location
bool moved = false; bool moved = false;
FString oldpath = NicePath("~/.zdoom/"); FString oldpath = NicePath("~/." GAMENAMELOWERCASE "/");
if (stat (oldpath, &extrainfo) != -1) if (stat (oldpath, &extrainfo) != -1)
{ {
if (rename(oldpath, path) == -1) if (rename(oldpath, path) == -1)
{ {
I_Error ("Failed to move old zdoom directory (%s) to new location (%s).", I_Error ("Failed to move old " GAMENAMELOWERCASE " directory (%s) to new location (%s).",
oldpath.GetChars(), path.GetChars()); oldpath.GetChars(), path.GetChars());
} }
else else
@ -598,7 +598,7 @@ FString M_GetCajunPath(const char *botfilename)
FString M_GetConfigPath(bool for_reading) FString M_GetConfigPath(bool for_reading)
{ {
return GetUserFile("zdoom.ini"); return GetUserFile(GAMENAMELOWERCASE ".ini");
} }
//=========================================================================== //===========================================================================

View File

@ -37,7 +37,7 @@ static struct {
pid_t pid; pid_t pid;
int has_siginfo; int has_siginfo;
siginfo_t siginfo; siginfo_t siginfo;
char buf[1024]; char buf[4096];
} crash_info; } crash_info;

View File

@ -240,7 +240,7 @@ int main (int argc, char **argv)
#if !defined (__APPLE__) #if !defined (__APPLE__)
{ {
int s[4] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS }; int s[4] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS };
cc_install_handlers(argc, argv, 4, s, "zdoom-crash.log", DoomSpecificInfo); cc_install_handlers(argc, argv, 4, s, GAMENAMELOWERCASE "-crash.log", DoomSpecificInfo);
} }
#endif // !__APPLE__ #endif // !__APPLE__

View File

@ -88,13 +88,14 @@ const char *GetVersionString();
// More stuff that needs to be different for derivatives. // More stuff that needs to be different for derivatives.
#define GAMENAME "ZDoom" #define GAMENAME "ZDoom"
#define GAMENAMELOWERCASE "zdoom"
#define FORUM_URL "http://forum.zdoom.org" #define FORUM_URL "http://forum.zdoom.org"
#define BUGS_FORUM_URL "http://forum.zdoom.org/index.php?c=3" #define BUGS_FORUM_URL "http://forum.zdoom.org/index.php?c=3"
#if defined(__APPLE__) || defined(_WIN32) #if defined(__APPLE__) || defined(_WIN32)
#define GAME_DIR GAMENAME #define GAME_DIR GAMENAME
#else #else
#define GAME_DIR ".config/zdoom" #define GAME_DIR ".config/" GAMENAMELOWERCASE
#endif #endif

View File

@ -1288,20 +1288,3 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE nothing, LPSTR cmdline, int n
MainThread = INVALID_HANDLE_VALUE; MainThread = INVALID_HANDLE_VALUE;
return 0; return 0;
} }
//==========================================================================
//
// CCMD crashout
//
// Debugging routine for testing the crash logger.
// Useless in a debug build, because that doesn't enable the crash logger.
//
//==========================================================================
#ifndef _DEBUG
#include "c_dispatch.h"
CCMD (crashout)
{
*(int *)0 = 0;
}
#endif