mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 15:21:44 +00:00
Don't write stdout.txt and stderr.txt when portable.
To be able to test if the game is running portable all checks of the portable cvar must be done after Cvar_Init(). Instead of redirecting stdout and stderr as early as possible, delay the redirection right after Cvar_Init(). After this change the printf() in WinMain() aren't printed into stdout.txt, but I guess that it isn't a big problem. All interessting stuff like the search pathes is still there. Rename fs_portable to portable. It's no longer filesystem specific.
This commit is contained in:
parent
3032698f95
commit
4d299e26d7
6 changed files with 22 additions and 14 deletions
|
@ -550,3 +550,12 @@ Sys_FreeLibrary(void *handle)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Just a dummy. There's no need on unixoid systems to
|
||||
* redirect stdout and stderr.
|
||||
*/
|
||||
void
|
||||
Sys_RedirectStdout(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -652,7 +652,7 @@ Sys_RedirectStdout(void)
|
|||
char path_stdout[MAX_OSPATH];
|
||||
char path_stderr[MAX_OSPATH];
|
||||
|
||||
if (dedicated && dedicated->value)
|
||||
if (portable->value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -708,11 +708,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
/* Make the current instance global */
|
||||
global_hInstance = hInstance;
|
||||
|
||||
/* Redirect stdout and stderr into a file */
|
||||
#ifndef DEDICATED_ONLY
|
||||
Sys_RedirectStdout();
|
||||
#endif
|
||||
|
||||
printf("Yamagi Quake II v%s\n", YQ2VERSION);
|
||||
printf("=====================\n\n");
|
||||
|
||||
|
|
|
@ -786,7 +786,7 @@ Key_WriteConsoleHistory()
|
|||
int i;
|
||||
char path[MAX_OSPATH];
|
||||
|
||||
if (fs_portable->value)
|
||||
if (portable->value)
|
||||
{
|
||||
Com_sprintf(path, sizeof(path), "%sconsole_history.txt", Sys_GetBinaryDir());
|
||||
}
|
||||
|
@ -833,7 +833,7 @@ Key_ReadConsoleHistory()
|
|||
|
||||
char path[MAX_OSPATH];
|
||||
|
||||
if (fs_portable->value)
|
||||
if (portable->value)
|
||||
{
|
||||
Com_sprintf(path, sizeof(path), "%sconsole_history.txt", Sys_GetBinaryDir());
|
||||
}
|
||||
|
|
|
@ -131,7 +131,6 @@ cvar_t *fs_basedir;
|
|||
cvar_t *fs_cddir;
|
||||
cvar_t *fs_gamedirvar;
|
||||
cvar_t *fs_debug;
|
||||
cvar_t *fs_portable;
|
||||
|
||||
fsHandle_t *FS_GetFileByHandle(fileHandle_t f);
|
||||
char *Sys_GetCurrentDirectory(void);
|
||||
|
@ -943,7 +942,7 @@ FS_AddHomeAsGameDirectory(char *dir)
|
|||
char gdir[MAX_OSPATH];
|
||||
size_t len;
|
||||
|
||||
if (fs_portable->value)
|
||||
if (portable->value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1572,9 +1571,6 @@ FS_InitFilesystem(void)
|
|||
/* Current directory. */
|
||||
fs_homepath = Cvar_Get("homepath", Sys_GetCurrentDirectory(), CVAR_NOSET);
|
||||
|
||||
/* Be portable, don't add HOME to the search patch */
|
||||
fs_portable = Cvar_Get("fs_portable", "0", 0);
|
||||
|
||||
/* Add baseq2 to search path. */
|
||||
FS_AddGameDirectory(va("%s/" BASEDIRNAME, fs_basedir->string));
|
||||
FS_AddBinaryDirAsGameDirectory(BASEDIRNAME);
|
||||
|
|
|
@ -726,7 +726,7 @@ extern cvar_t *modder;
|
|||
extern cvar_t *dedicated;
|
||||
extern cvar_t *host_speeds;
|
||||
extern cvar_t *log_stats;
|
||||
extern cvar_t *fs_portable;
|
||||
extern cvar_t *portable;
|
||||
|
||||
extern FILE *log_stats_file;
|
||||
|
||||
|
@ -769,6 +769,7 @@ void Sys_Sleep(int msec);
|
|||
void Sys_FreeLibrary(void *handle);
|
||||
void *Sys_LoadLibrary(const char *path, const char *sym, void **handle);
|
||||
void *Sys_GetProcAddress(void *handle, const char *sym);
|
||||
void Sys_RedirectStdout(void);
|
||||
|
||||
/* CLIENT / SERVER SYSTEMS */
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ cvar_t *developer;
|
|||
cvar_t *modder;
|
||||
cvar_t *timescale;
|
||||
cvar_t *fixedtime;
|
||||
cvar_t *portable;
|
||||
|
||||
#ifndef DEDICATED_ONLY
|
||||
cvar_t *showtrace;
|
||||
#endif
|
||||
|
@ -200,7 +202,12 @@ Qcommon_Init(int argc, char **argv)
|
|||
Cmd_Init();
|
||||
Cvar_Init();
|
||||
|
||||
/* Be portable, don't add HOME to the search path
|
||||
* This is needed by Sys_RedirectStdout() on Windows*/
|
||||
portable = Cvar_Get("portable", "0", 0);
|
||||
|
||||
#ifndef DEDICATED_ONLY
|
||||
Sys_RedirectStdout();
|
||||
Key_Init();
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue