summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2006-05-06 17:18:02 +0000
committerTim Angus <tim@ngus.net>2006-05-06 17:18:02 +0000
commitbb7bd83aaec4504b4fb90919cccaaf4d9a7b418d (patch)
treea99058fef0dbf93af48dab4581b9f785d93e68ff /src/client
parentbd9d761dd958aef00218de084bae00eb9bf788a4 (diff)
* Merged ioq3-r775
- SDL_GammaRamp stuff - Anisotropic texture filtering - q3testesque r_flares - cl_guid - Security fixes
Diffstat (limited to 'src/client')
-rw-r--r--src/client/cl_main.c31
-rw-r--r--src/client/client.h3
2 files changed, 33 insertions, 1 deletions
diff --git a/src/client/cl_main.c b/src/client/cl_main.c
index 28e5021f..af8c1d76 100644
--- a/src/client/cl_main.c
+++ b/src/client/cl_main.c
@@ -2012,7 +2012,7 @@ void CL_Frame ( int msec ) {
}
Q_strncpyz( mapName, COM_SkipPath( cl.mapname ), sizeof( cl.mapname ) );
- COM_StripExtension( mapName, mapName );
+ COM_StripExtension(mapName, mapName, sizeof(mapName));
Cbuf_ExecuteText( EXEC_NOW,
va( "record %s-%s-%s", nowString, serverName, mapName ) );
@@ -2324,6 +2324,28 @@ void CL_StopVideo_f( void )
CL_CloseAVI( );
}
+static void CL_GenerateQKey(void)
+{
+ int len = 0;
+ unsigned char buff[2048];
+
+ len = FS_ReadFile(QKEY_FILE, NULL);
+ if(len >= (int)sizeof(buff)) {
+ Com_Printf("QKEY found.\n");
+ return;
+ }
+ else {
+ int i;
+ srand(time(0));
+ for(i = 0; i < sizeof(buff) - 1; i++) {
+ buff[i] = (unsigned char)(rand() % 255);
+ }
+ buff[i] = 0;
+ Com_Printf("QKEY generated\n");
+ FS_WriteFile(QKEY_FILE, buff, sizeof(buff));
+ }
+}
+
/*
====================
CL_Init
@@ -2472,6 +2494,9 @@ void CL_Init( void ) {
Cvar_Set( "cl_running", "1" );
+ CL_GenerateQKey();
+ Cvar_Get("cl_guid", Com_MD5File(QKEY_FILE, 0), CVAR_USERINFO | CVAR_ROM);
+
Com_Printf( "----- Client Initialization Complete -----\n" );
}
@@ -2485,6 +2510,10 @@ CL_Shutdown
void CL_Shutdown( void ) {
static qboolean recursive = qfalse;
+ // check whether the client is running at all.
+ if(!(com_cl_running && com_cl_running->integer))
+ return;
+
Com_Printf( "----- CL_Shutdown -----\n" );
if ( recursive ) {
diff --git a/src/client/client.h b/src/client/client.h
index a7db023f..e5f5d596 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -31,6 +31,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../cgame/cg_public.h"
#include "../game/bg_public.h"
+// tjw: file full of random crap that gets used to create cl_guid
+#define QKEY_FILE "qkey"
+
#define RETRANSMIT_TIMEOUT 3000 // time between connection packet retransmits