[iortcw] 466/497: MP: Remove the 'light dedicated' code
Simon McVittie
smcv at debian.org
Wed Sep 21 19:49:47 UTC 2016
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to annotated tag 1.42d
in repository iortcw.
commit b48acf128085925ead809ca90d336f82b34b9b6b
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date: Mon Dec 7 17:23:53 2015 -0500
MP: Remove the 'light dedicated' code
---
MP/code/qcommon/files.c | 327 +---------------------------------------------
MP/code/qcommon/qcommon.h | 4 -
MP/code/server/sv_init.c | 11 --
3 files changed, 2 insertions(+), 340 deletions(-)
diff --git a/MP/code/qcommon/files.c b/MP/code/qcommon/files.c
index 62400e8..98177f0 100644
--- a/MP/code/qcommon/files.c
+++ b/MP/code/qcommon/files.c
@@ -1312,15 +1312,13 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
if(strstr(filename, "ui.mp.qvm"))
pak->referenced |= FS_UI_REF;
-#if !defined( PRE_RELEASE_DEMO ) && !defined( DO_LIGHT_DEDICATED )
- // DHM -- Nerve :: Don't allow maps to be loaded from pak0 (singleplayer)
+ // DHM -- Nerve :: Don't allow singleplayer maps to be loaded from pak0
if(!FS_IsExt(filename, ".bsp", len) == 0 &&
Q_stricmp( pak->pakBasename, "pak0" ) == 0 ) {
*file = 0;
return -1;
}
-#endif
if(uniqueFILE)
{
@@ -2344,10 +2342,6 @@ static pack_t *FS_LoadZipFile(const char *zipfile, const char *basename ) {
pack->checksum = Com_BlockChecksum( &fs_headerLongs[ 1 ], sizeof(*fs_headerLongs) * ( fs_numHeaderLongs - 1 ) );
pack->pure_checksum = Com_BlockChecksum( fs_headerLongs, sizeof(*fs_headerLongs) * fs_numHeaderLongs );
- // TTimo: DO_LIGHT_DEDICATED
- // curious about the size of those
- //Com_DPrintf("Com_BlockChecksumKey: %s %u\n", pack->pakBasename, 4 * fs_numHeaderLongs);
- // cumulated for light dedicated: 21558 bytes
pack->checksum = LittleLong( pack->checksum );
pack->pure_checksum = LittleLong( pack->pure_checksum );
@@ -3866,7 +3860,6 @@ static void FS_CheckPak0( void )
}
#endif
-#if !defined( DO_LIGHT_DEDICATED )
/*
=====================
FS_LoadedPakChecksums
@@ -3946,10 +3939,6 @@ const char *FS_LoadedPakPureChecksums( void ) {
Q_strcat( info, sizeof( info ), va( "%i ", search->pack->pure_checksum ) );
}
- // DO_LIGHT_DEDICATED
- // only comment out when you need a new pure checksums string
- //Com_DPrintf("FS_LoadPakPureChecksums: %s\n", info);
-
return info;
}
@@ -4012,6 +4001,7 @@ const char *FS_ReferencedPakNames( void ) {
return info;
}
+
/*
=====================
FS_ReferencedPakPureChecksums
@@ -4020,10 +4010,6 @@ Returns a space separated string containing the pure checksums of all referenced
Servers with sv_pure set will get this string back from clients for pure validation
The string has a specific order, "cgame ui @ ref1 ref2 ref3 ..."
-
-NOTE TTimo - DO_LIGHT_DEDICATED
-this function is only used by the client to build the string sent back to server
-we don't have any need of overriding it for light, but it's useless in dedicated
=====================
*/
const char *FS_ReferencedPakPureChecksums( void ) {
@@ -4063,316 +4049,7 @@ const char *FS_ReferencedPakPureChecksums( void ) {
return info;
}
-#else // DO_LIGHT_DEDICATED implementation follows
-
-/*
-=========================================================================================
-DO_LIGHT_DEDICATED, general notes
-we are going to fake the checksums sent to the clients
-that only matters to the pk3 we have replaced by their lighter version, currently:
-
-Cvar_Set2: sv_pakNames mp_pakmaps0 mp_pak2 mp_pak1 mp_pak0 pak0
-Cvar_Set2: sv_paks -1153491798 125907563 -1023558518 764840216 1886207346
-
-all the files above have their 'server required' content collapsed into a single pak0.pk3
-
-the other .pk3 files should be handled as usual
-
-more details are in unix/dedicated-only.txt
-
-=========================================================================================
-*/
-
-// our target faked checksums
-// those don't need to be encrypted or anything, that's what you see in the +set developer 1
-static const char* pak_fakechecksums = "2149774797u -137448799 131270674 125907563 -1023558518 764840216 1886207346";
-static const char* pak_names = "mp_pak5 mp_pak4 mp_pak3 mp_pak2 mp_pak1 mp_pak0 pak0";
-
-/*
-this is the pure checksum string for a constant value of fs_checksumFeed we have choosen (see SV_SpawnServer)
-to obtain the new string for a different fs_checksumFeed value, run a regular server and enable the relevant
-verbosity code in SV_SpawnServer and FS_LoadedPakPureChecksums (the full server version of course)
-
-NOTE: if you have an mp_bin in the middle, you need to take out it's checksum
- (we keep mp_bin out of the faked stuff because we don't want to have to update those feeds too often heh)
-
-once you have the clear versions, you can shift them by commenting out the code chunk in FS_RandChecksumFeed
-you need to use the right line in FS_LoadedPakPureChecksums wether you are running on clear strings, or shifted ones
-*/
-
-/*
-// clear checksums, rebuild those from a regular server and you will shift them next
-static const int feeds[5] = {
- 0xd6009839, 0x636bb1d5, 0x198df4c9, 0x7ffa631b, 0x8f89a69e
-};
-
-static const char* pak_purechecksums[5] = {
- "943814896 694898104 1407923890 242847633 1117823230 -1543700213",
- "-111135514 976363775 -1066586315 -509503305 226888806 623380740",
- "465689568 1394972621 1593048073 488347192 -238809598 -396332776",
- "-2000534548 253432450 -1505880367 682854303 -1183636432 -1745648892",
- "-588301396 -637070806 -49124646 831116909 -666702847 1152718748"
-};
-*/
-
-static const int feeds[5] = {
- 0xd6009839, 0x636bb1d5, 0x198df4c9, 0x7ffa631b, 0x8f89a69e
-};
-
-// shifted strings, so that it's not directly scannable from exe
-// see FS_RandChecksumFeed to generate them
-static const char* pak_purechecksums[5] = {
- "FA at E>AEFC-CFAEFE>=A->A=DF?@EF=-?A?EADC@@->>>DE?@?@=-:>BA at D==?>@",
- ";????ACC?B.GEDADAEEC.;?>DDCFDA?C.;C>GC>AA>C.@@DFFFF>D.D at AAF>EB>",
- "CEDEGHDEG/@BHCHFAEA@/@DHB?CG?FB/CGGBCF at HA/<ABGG?HDHG/<BHEBBAFFE",
- "=B@@@ECDEDH0BECDCBDE at 0=AE at EHH@CFG0FHBHEDC at C0=AAHCFCFDCB0=AGDEFDHHIB",
- ">FIIDABDJG1>GDHAHAIAG1>EJBCEGEG1IDBBBGJAJ1>GGGHACIEH1BBFCHBIHEI"
-};
-
-// counter to walk through the randomized list
-static int feed_index = -1;
-
-static int lookup_randomized[5] = { 0, 1, 2, 3, 4 };
-
-/*
-=====================
-randomize the order of the 5 checksums we rely on
-5 random swaps of the table
-=====================
-*/
-void FS_InitRandomFeed( void ) {
- int i, swap, aux;
- for ( i = 0; i < 5; i++ )
- {
- swap = (int)( 5.0 * rand() / ( RAND_MAX + 1.0 ) );
- aux = lookup_randomized[i]; lookup_randomized[i] = lookup_randomized[swap]; lookup_randomized[swap] = aux;
- }
-}
-/*
-=====================
-FS_RandChecksumFeed
-
-Return a random checksum feed among our list
-we keep the seed and use it when requested for the pure checksum
-=====================
-*/
-int FS_RandChecksumFeed( void ) {
- /*
- // use this to dump shifted versions of the pure checksum strings
- int i;
- for(i=0;i<5;i++)
- {
- Com_Printf("FS_RandChecksumFeed: %s\n", FS_ShiftStr(pak_purechecksums[i], 13+i));
- }
- */
- if ( feed_index == -1 ) {
- FS_InitRandomFeed();
- }
- feed_index = ( feed_index + 1 ) % 5;
- return feeds[lookup_randomized[feed_index]];
-}
-
-/*
-=====================
-FS_LoadedPakChecksums
-
-Returns a space separated string containing the checksums of all loaded pk3 files.
-Servers with sv_pure set will get this string and pass it to clients.
-
-DO_LIGHT_DEDICATED:
-drop lightweight pak0 checksum, put the faked pk3s checksums instead
-=====================
-*/
-const char *FS_LoadedPakChecksums( void ) {
- static char info[BIG_INFO_STRING];
- searchpath_t *search;
-
- info[0] = 0;
-
- for ( search = fs_searchpaths ; search ; search = search->next ) {
- // is the element a pak file?
- if ( !search->pack ) {
- continue;
- }
-
- if ( strcmp( search->pack->pakBasename,"pak0" ) ) {
- // this is a regular pk3
- Q_strcat( info, sizeof( info ), va( "%i ", search->pack->checksum ) );
- } else
- {
- // this is the light pk3
- Q_strcat( info, sizeof( info ), va( "%s ", pak_fakechecksums ) );
- }
- }
-
- return info;
-}
-
-/*
-=====================
-FS_LoadedPakNames
-
-Returns a space separated string containing the names of all loaded pk3 files.
-Servers with sv_pure set will get this string and pass it to clients.
-
-DO_LIGHT_DEDICATED:
-drop lightweight pak0 name, put the faked pk3s names instead
-=====================
-*/
-const char *FS_LoadedPakNames( void ) {
- static char info[BIG_INFO_STRING];
- searchpath_t *search;
-
- info[0] = 0;
-
- for ( search = fs_searchpaths ; search ; search = search->next ) {
- // is the element a pak file?
- if ( !search->pack ) {
- continue;
- }
-
- if ( *info ) {
- Q_strcat( info, sizeof( info ), " " );
- }
- if ( strcmp( search->pack->pakBasename,"pak0" ) ) {
- // regular pk3
- Q_strcat( info, sizeof( info ), search->pack->pakBasename );
- } else
- {
- // light pk3
- Q_strcat( info, sizeof( info ), pak_names );
- }
- }
-
- return info;
-}
-
-/*
-=====================
-FS_LoadedPakPureChecksums
-
-Returns a space separated string containing the pure checksums of all loaded pk3 files.
-Servers with sv_pure use these checksums to compare with the checksums the clients send
-back to the server.
-
-DO_LIGHT_DEDICATED:
-FS_LoadPakChecksums to send the pak string to the client
-FS_LoadPakPureChecksums is used locally to compare against what the client sends back
-
-the pure_checksums are computed by Com_MemoryBlockChecksum with a random key (fs_checksumFeed)
-since we can't do this on restricted server, we always use the same fs_checksumFeed value
-
-drop lightweight pak0 checksum, put the faked pk3s pure checksums instead
-
-=====================
-*/
-const char *FS_LoadedPakPureChecksums( void ) {
- static char info[BIG_INFO_STRING];
- searchpath_t *search;
-
- info[0] = 0;
-
- for ( search = fs_searchpaths ; search ; search = search->next ) {
- // is the element a pak file?
- if ( !search->pack ) {
- continue;
- }
-
- if ( strcmp( search->pack->pakBasename,"pak0" ) ) {
- // this is a regular pk3
- Q_strcat( info, sizeof( info ), va( "%i ", search->pack->pure_checksum ) );
- } else
- {
- // this is the light pk3
- // use this if you are running on shifted strings
- Q_strcat( info, sizeof( info ), va( "%s ", FS_ShiftStr( pak_purechecksums[lookup_randomized[feed_index]], -13 - lookup_randomized[feed_index] ) ) );
- // use this if you are running on clear checksum strings instead of shifted ones
- //Q_strcat( info, sizeof( info ), va("%s ", pak_purechecksums[lookup_randomized[feed_index]] ) );
- }
- }
-
- return info;
-}
-
-/*
-=====================
-FS_ReferencedPakChecksums
-
-Returns a space separated string containing the checksums of all referenced pk3 files.
-The server will send this to the clients so they can check which files should be auto-downloaded.
-
-DO_LIGHT_DEDICATED:
-don't send the checksum of pak0 (even if it's referenced)
-
-NOTE:
-do we need to fake referenced paks too?
-those are Id paks, so you can't download them
-mp_pakmaps0 would be a worthy candidate for download though, but we don't have it anyway
-the only thing if we omit sending of some referenced stuff, you don't get the console message that says "you're missing this"
-=====================
-*/
-const char *FS_ReferencedPakChecksums( void ) {
- static char info[BIG_INFO_STRING];
- searchpath_t *search;
-
- info[0] = 0;
-
- for ( search = fs_searchpaths ; search ; search = search->next ) {
- // is the element a pak file?
- if ( search->pack ) {
- if ( search->pack->referenced ) {
- if ( strcmp( search->pack->pakBasename, "pak0" ) ) {
- // this is not the light pk3
- Q_strcat( info, sizeof( info ), va( "%i ", search->pack->checksum ) );
- }
- }
- }
- }
-
- return info;
-}
-
-/*
-=====================
-FS_ReferencedPakNames
-
-Returns a space separated string containing the names of all referenced pk3 files.
-The server will send this to the clients so they can check which files should be auto-downloaded.
-
-DO_LIGHT_DEDICATED:
-don't send pak0 see above for details
-=====================
-*/
-const char *FS_ReferencedPakNames( void ) {
- static char info[BIG_INFO_STRING];
- searchpath_t *search;
-
- info[0] = 0;
-
- // we want to return ALL pk3's from the fs_game path
- // and referenced one's from baseq3
- for ( search = fs_searchpaths ; search ; search = search->next ) {
- // is the element a pak file?
- if ( search->pack ) {
- if ( *info ) {
- Q_strcat( info, sizeof( info ), " " );
- }
- if ( search->pack->referenced ) {
- if ( strcmp( search->pack->pakBasename, "pak0" ) ) {
- // this is not the light pk3
- Q_strcat( info, sizeof( info ), search->pack->pakGamename );
- Q_strcat( info, sizeof( info ), "/" );
- Q_strcat( info, sizeof( info ), search->pack->pakBasename );
- }
- }
- }
- }
-
- return info;
-}
-
-#endif
/*
=====================
diff --git a/MP/code/qcommon/qcommon.h b/MP/code/qcommon/qcommon.h
index 0fdfeea..5b0b871 100644
--- a/MP/code/qcommon/qcommon.h
+++ b/MP/code/qcommon/qcommon.h
@@ -821,10 +821,6 @@ extern int cl_connectedToPureServer;
qboolean FS_CL_ExtractFromPakFile( void *searchpath, const char *fullpath, const char *filename, const char *cvar_lastVersion );
#endif
-#if defined( DO_LIGHT_DEDICATED )
-int FS_RandChecksumFeed( void );
-#endif
-
char *FS_ShiftedStrStr( const char *string, const char *substring, int shift );
char *FS_ShiftStr( const char *string, int shift );
diff --git a/MP/code/server/sv_init.c b/MP/code/server/sv_init.c
index 4a1102d..aab8101 100644
--- a/MP/code/server/sv_init.c
+++ b/MP/code/server/sv_init.c
@@ -591,20 +591,9 @@ void SV_SpawnServer( char *server, qboolean killBots ) {
// make sure we are not paused
Cvar_Set( "cl_paused", "0" );
-#if !defined( DO_LIGHT_DEDICATED )
// get a new checksum feed and restart the file system
sv.checksumFeed = ( ((int) rand() << 16) ^ rand() ) ^ Com_Milliseconds();
- // DO_LIGHT_DEDICATED
- // only comment out when you need a new pure checksum string and it's associated random feed
- //Com_DPrintf("SV_SpawnServer checksum feed: %p\n", sv.checksumFeed);
-
-#else // DO_LIGHT_DEDICATED implementation below
- // we are not able to randomize the checksum feed since the feed is used as key for pure_checksum computations
- // files.c 1776 : pack->pure_checksum = Com_BlockChecksumKey( fs_headerLongs, 4 * fs_numHeaderLongs, LittleLong(fs_checksumFeed) );
- // we request a fake randomized feed, files.c knows the answer
- sv.checksumFeed = FS_RandChecksumFeed();
-#endif
FS_Restart( sv.checksumFeed );
// Load map config if present
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list