EXPORT int PUBLIC QTV_Init (void) { if (cluster) return 0; cluster = malloc(sizeof(*cluster)); if (cluster) { memset(cluster, 0, sizeof(*cluster)); cluster->qwdsocket[0] = INVALID_SOCKET; cluster->qwdsocket[1] = INVALID_SOCKET; cluster->tcpsocket[0] = INVALID_SOCKET; cluster->tcpsocket[1] = INVALID_SOCKET; cluster->anticheattime = 1*1000; cluster->tooslowdelay = 100; cluster->qwlistenportnum = 0; cluster->allownqclients = true; strcpy(cluster->hostname, DEFAULT_HOSTNAME); cluster->buildnumber = build_number(); cluster->maxproxies = -1; strcpy(cluster->demodir, "qw/demos/"); return 0; } return -1; }
int EXT_FUNC GetBuildNumber_api() { return build_number(); }
void BuildMessage( bf_write& buf, byte msgtype, char const *mapname, unsigned int uSessionID ) { bf_write encrypted; byte encrypted_data[ 2048 ]; buf.WriteByte( C2M_PHONEHOME ); buf.WriteByte( '\n' ); buf.WriteByte( C2M_PHONEHOME_PROTOCOL_VERSION ); buf.WriteLong( uSessionID ); // sessionid (request new id by sending 0) // encryption object IceKey cipher(1); /* medium encryption level */ unsigned char ucEncryptionKey[8] = { 191, 1, 0, 222, 85, 39, 154, 1 }; cipher.set( ucEncryptionKey ); encrypted.StartWriting( encrypted_data, sizeof( encrypted_data ) ); byte corruption_identifier = 0x01; encrypted.WriteByte( corruption_identifier ); // Data version protocol encrypted.WriteByte( 1 ); // Write the "build identifier" -- unique to each person we give a build to. encrypted.WriteString( m_szBuildIdentifier ); { char computername[ 64 ]; Q_memset( computername, 0, sizeof( computername ) ); #if defined ( _WIN32 ) DWORD length = sizeof( computername ) - 1; if ( !GetComputerName( computername, &length ) ) { Q_strncpy( computername, "???", sizeof( computername ) ); } #else if ( gethostname( computername, sizeof(computername) ) == -1 ) { Q_strncpy( computername, "Linux????", sizeof( computername ) ); } computername[sizeof(computername)-1] = '\0'; #endif encrypted.WriteString( computername ); } { char username[ 64 ]; Q_memset( username, 0, sizeof( username ) ); #if defined ( _WIN32 ) DWORD length = sizeof( username ) - 1; if ( !GetUserName( username, &length ) ) { Q_strncpy( username, "???", sizeof( username ) ); } #else struct passwd *pass = getpwuid( getuid() ); if ( pass ) { Q_strncpy( username, pass->pw_name, sizeof( username ) ); } else { Q_strncpy( username, "LinuxUser??", sizeof( username ) ); } username[sizeof(username)-1] = '\0'; #endif encrypted.WriteString( username ); } char gamedir[ 64 ]; Q_FileBase( com_gamedir, gamedir, sizeof( gamedir ) ); encrypted.WriteString( gamedir ); unsigned int uBuildNumber = build_number(); encrypted.WriteLong( (int)uBuildNumber ); // WRite timestamp of engine encrypted.WriteFloat( (float)realtime ); encrypted.WriteByte( msgtype ); if ( mapname != NULL ) { encrypted.WriteString( mapname ); } int isDebugUser = ( Sys_IsDebuggerPresent() || CommandLine()->FindParm( "-allowdebug" ) ) ? 1 : 0; encrypted.WriteByte( isDebugUser ); while ( encrypted.GetNumBytesWritten() % 8 ) { encrypted.WriteByte( 0 ); } EncryptBuffer( cipher, (unsigned char *)encrypted.GetData(), encrypted.GetNumBytesWritten() ); buf.WriteShort( (int)encrypted.GetNumBytesWritten() ); buf.WriteBytes( (unsigned char *)encrypted.GetData(), encrypted.GetNumBytesWritten() ); }
/* <9a1a9> ../engine/sv_log.c:162 */ void Log_Open(void) { time_t ltime; struct tm *today; char szFileBase[MAX_PATH]; char szTestFile[MAX_PATH]; int i; FileHandle_t fp; char *temp; if (!g_psvs.log.active || (sv_log_onefile.value != 0.0f && g_psvs.log.file)) return; if (mp_logfile.value == 0.0f) Con_Printf("Server logging data to console.\n"); else { Log_Close(); time(<ime); today = localtime(<ime); temp = Cvar_VariableString("logsdir"); if (!temp || Q_strlen(temp) <= 0 || Q_strstr(temp, ":") || Q_strstr(temp, "..")) Q_snprintf(szFileBase, sizeof(szFileBase), "logs/L%02i%02i", today->tm_mon + 1, today->tm_mday); else Q_snprintf(szFileBase, sizeof(szFileBase), "%s/L%02i%02i", temp, today->tm_mon + 1, today->tm_mday); for (i = 0; i < 1000; i++) { Q_snprintf(szTestFile, sizeof(szTestFile), "%s%03i.log", szFileBase, i); COM_FixSlashes(szTestFile); COM_CreatePath(szTestFile); fp = FS_OpenPathID(szTestFile, "r", "GAMECONFIG"); if (!fp) { COM_CreatePath(szTestFile); fp = FS_OpenPathID(szTestFile, "wt", "GAMECONFIG"); if (fp) { g_psvs.log.file = (void *)fp; Con_Printf("Server logging data to file %s\n", szTestFile); Log_Printf("Log file started (file \"%s\") (game \"%s\") (version \"%i/%s/%d\")\n", szTestFile, Info_ValueForKey(Info_Serverinfo(), "*gamedir"), PROTOCOL_VERSION, gpszVersionString, build_number()); } return; } FS_Close(fp); } Con_Printf("Unable to open logfiles under %s\nLogging disabled\n", szFileBase); g_psvs.log.active = FALSE; } }
int COM_BuildNumber() { return build_number(); }