mirror of
https://github.com/Q3Rally-Team/q3rally.git
synced 2024-11-26 22:01:50 +00:00
0d5fb492cd
Fix GCC 6 misleading-indentation warning add SECURITY.md OpenGL2: Restore adding fixed ambient light when HDR is enabled Few LCC memory fixes. fix a few potential buffer overwrite in Game VM Enable compiler optimization on all macOS architectures Don't allow qagame module to create "botlib.log" at ANY filesystem location Make FS_BuildOSPath for botlib.log consistent with typical usage tiny readme thing Remove extra plus sign from Huff_Compress() Fix VMs being able to change CVAR_PROTECTED cvars Don't register fs_game cvar everywhere just to get the value Don't let VMs change engine latch cvars immediately Fix fs_game '..' reading outside of home and base path Fix VMs forcing engine latch cvar to update to latched value Revert my recent cvar latch changes Revert "Don't let VMs change engine latch cvars immediately" Partially revert "Fix fs_game '..' reading outside of home and base path" Revert "Fix VMs forcing engine latch cvar to update to latched value" Fix exploit to bypass filename restrictions on Windows Changes to systemd q3a.service Fix Q_vsnprintf for mingw-w64 Fix timelimit causing an infinite map ending loop Fix invalid access to cluster 0 in AAS_AreaRouteToGoalArea() Fix negative frag/capturelimit causing an infinite map end loop OpenGL2: Fix dark lightmap on shader in mpteam6 Make FS_InvalidGameDir() consider subdirectories invalid [qcommon] Remove dead serialization code [qcommon] Make several zone variables and functions static. Fix MAC_OS_X_VERSION_MIN_REQUIRED for macOS 10.10 and later Increase q3_ui .arena filename list buffer size to 4096 bytes OpenGL2: Fix crash when BSP has deluxe maps and vertex lit surfaces Support Unicode characters greater than 0xFF in cl_consoleKeys Fix macOS app bundle with space in name OpenGL1: Use glGenTextures instead of hardcoded values Remove CON_FlushIn function and where STDIN needs flushing, use tcflush POSIX function Update libogg from 1.3.2 to 1.3.3 Rename (already updated) libogg-1.3.2 to libogg-1.3.3 Update libvorbis from 1.3.5 to 1.3.6 * Fix CVE-2018-5146 - out-of-bounds write on codebook decoding. * Fix CVE-2017-14632 - free() on unitialized data * Fix CVE-2017-14633 - out-of-bounds read Rename (already updated) libvorbis-1.3.5 to libvorbis-1.3.6 Update opus from 1.1.4 to 1.2.1 Rename (already updated) opus-1.1.4 to opus-1.2.1 Update opusfile from 0.8 to 0.9 Rename (already updated) opusfile-0.8 to opusfile-0.9 First swing at a CONTRIBUTING.md Allow loading system OpenAL library on macOS again Remove duplicate setting of FREETYPE_CFLAGS in Makefile Fix exploit to reset player by sending wrong serverId Fix "Going to CS_ZOMBIE for [clientname]" developer message Fix MSG_Read*String*() functions not being able to read last byte from message
173 lines
5.1 KiB
C
173 lines
5.1 KiB
C
/*
|
|
===========================================================================
|
|
Copyright (C) 1999-2005 Id Software, Inc.
|
|
|
|
This file is part of Quake III Arena source code.
|
|
|
|
Quake III Arena source code is free software; you can redistribute it
|
|
and/or modify it under the terms of the GNU General Public License as
|
|
published by the Free Software Foundation; either version 2 of the License,
|
|
or (at your option) any later version.
|
|
|
|
Quake III Arena source code is distributed in the hope that it will be
|
|
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with Quake III Arena source code; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
===========================================================================
|
|
*/
|
|
|
|
/*****************************************************************************
|
|
* name: l_log.c
|
|
*
|
|
* desc: log file
|
|
*
|
|
* $Archive: /MissionPack/CODE/botlib/l_log.c $
|
|
*
|
|
*****************************************************************************/
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#include "../qcommon/q_shared.h"
|
|
#include "../qcommon/qcommon.h"
|
|
#include "botlib.h"
|
|
#include "be_interface.h" //for botimport.Print
|
|
#include "l_libvar.h"
|
|
#include "l_log.h"
|
|
|
|
#define MAX_LOGFILENAMESIZE 1024
|
|
|
|
typedef struct logfile_s
|
|
{
|
|
char filename[MAX_LOGFILENAMESIZE];
|
|
FILE *fp;
|
|
int numwrites;
|
|
} logfile_t;
|
|
|
|
static logfile_t logfile;
|
|
|
|
//===========================================================================
|
|
//
|
|
// Parameter: -
|
|
// Returns: -
|
|
// Changes Globals: -
|
|
//===========================================================================
|
|
void Log_Open(char *filename)
|
|
{
|
|
char *ospath;
|
|
if (!LibVarValue("log", "0")) return;
|
|
if (!filename || !strlen(filename))
|
|
{
|
|
botimport.Print(PRT_MESSAGE, "openlog <filename>\n");
|
|
return;
|
|
} //end if
|
|
if (logfile.fp)
|
|
{
|
|
botimport.Print(PRT_ERROR, "log file %s is already opened\n", logfile.filename);
|
|
return;
|
|
} //end if
|
|
ospath = FS_BuildOSPath(Cvar_VariableString("fs_homepath"), Cvar_VariableString("fs_game"), filename);
|
|
logfile.fp = fopen(ospath, "wb");
|
|
if (!logfile.fp)
|
|
{
|
|
botimport.Print(PRT_ERROR, "can't open the log file %s\n", filename);
|
|
return;
|
|
} //end if
|
|
Q_strncpyz(logfile.filename, filename, MAX_LOGFILENAMESIZE);
|
|
botimport.Print(PRT_MESSAGE, "Opened log %s\n", logfile.filename);
|
|
} //end of the function Log_Create
|
|
//===========================================================================
|
|
//
|
|
// Parameter: -
|
|
// Returns: -
|
|
// Changes Globals: -
|
|
//===========================================================================
|
|
void Log_Close(void)
|
|
{
|
|
if (!logfile.fp) return;
|
|
if (fclose(logfile.fp))
|
|
{
|
|
botimport.Print(PRT_ERROR, "can't close log file %s\n", logfile.filename);
|
|
return;
|
|
} //end if
|
|
logfile.fp = NULL;
|
|
botimport.Print(PRT_MESSAGE, "Closed log %s\n", logfile.filename);
|
|
} //end of the function Log_Close
|
|
//===========================================================================
|
|
//
|
|
// Parameter: -
|
|
// Returns: -
|
|
// Changes Globals: -
|
|
//===========================================================================
|
|
void Log_Shutdown(void)
|
|
{
|
|
if (logfile.fp) Log_Close();
|
|
} //end of the function Log_Shutdown
|
|
//===========================================================================
|
|
//
|
|
// Parameter: -
|
|
// Returns: -
|
|
// Changes Globals: -
|
|
//===========================================================================
|
|
void QDECL Log_Write(char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
|
|
if (!logfile.fp) return;
|
|
va_start(ap, fmt);
|
|
vfprintf(logfile.fp, fmt, ap);
|
|
va_end(ap);
|
|
//fprintf(logfile.fp, "\r\n");
|
|
fflush(logfile.fp);
|
|
} //end of the function Log_Write
|
|
//===========================================================================
|
|
//
|
|
// Parameter: -
|
|
// Returns: -
|
|
// Changes Globals: -
|
|
//===========================================================================
|
|
void QDECL Log_WriteTimeStamped(char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
|
|
if (!logfile.fp) return;
|
|
fprintf(logfile.fp, "%d %02d:%02d:%02d:%02d ",
|
|
logfile.numwrites,
|
|
(int) (botlibglobals.time / 60 / 60),
|
|
(int) (botlibglobals.time / 60),
|
|
(int) (botlibglobals.time),
|
|
(int) ((int) (botlibglobals.time * 100)) -
|
|
((int) botlibglobals.time) * 100);
|
|
va_start(ap, fmt);
|
|
vfprintf(logfile.fp, fmt, ap);
|
|
va_end(ap);
|
|
fprintf(logfile.fp, "\r\n");
|
|
logfile.numwrites++;
|
|
fflush(logfile.fp);
|
|
} //end of the function Log_Write
|
|
//===========================================================================
|
|
//
|
|
// Parameter: -
|
|
// Returns: -
|
|
// Changes Globals: -
|
|
//===========================================================================
|
|
FILE *Log_FilePointer(void)
|
|
{
|
|
return logfile.fp;
|
|
} //end of the function Log_FilePointer
|
|
//===========================================================================
|
|
//
|
|
// Parameter: -
|
|
// Returns: -
|
|
// Changes Globals: -
|
|
//===========================================================================
|
|
void Log_Flush(void)
|
|
{
|
|
if (logfile.fp) fflush(logfile.fp);
|
|
} //end of the function Log_Flush
|
|
|