qw: get rid of simple_crypt obfuscation

Presumably a simple anti-cheat precaution to stop people running "strings"
on the binaries in the days before the source was available. The
de-obfuscated strings are sent over the wire in the net protocol anyway.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
Kevin Shanahan 2012-12-13 07:05:56 +10:30
parent cc4a68e120
commit e227a1da93
4 changed files with 11 additions and 69 deletions

View File

@ -152,31 +152,6 @@ int fps_count;
static jmp_buf host_abort;
static float server_version = 0;// version of server we connected to
char emodel_name[] =
{ 'e' ^ 0xff, 'm' ^ 0xff, 'o' ^ 0xff, 'd' ^ 0xff, 'e' ^ 0xff, 'l' ^ 0xff,
0
};
char pmodel_name[] =
{ 'p' ^ 0xff, 'm' ^ 0xff, 'o' ^ 0xff, 'd' ^ 0xff, 'e' ^ 0xff, 'l' ^ 0xff,
0
};
char prespawn_name[] =
{ 'p' ^ 0xff, 'r' ^ 0xff, 'e' ^ 0xff, 's' ^ 0xff, 'p' ^ 0xff, 'a' ^ 0xff,
'w' ^ 0xff, 'n' ^ 0xff,
' ' ^ 0xff, '%' ^ 0xff, 'i' ^ 0xff, ' ' ^ 0xff, '0' ^ 0xff, ' ' ^ 0xff,
'%' ^ 0xff, 'i' ^ 0xff, 0
};
char modellist_name[] =
{ 'm' ^ 0xff, 'o' ^ 0xff, 'd' ^ 0xff, 'e' ^ 0xff, 'l' ^ 0xff, 'l' ^ 0xff,
'i' ^ 0xff, 's' ^ 0xff, 't' ^ 0xff,
' ' ^ 0xff, '%' ^ 0xff, 'i' ^ 0xff, ' ' ^ 0xff, '%' ^ 0xff, 'i' ^ 0xff, 0
};
char soundlist_name[] =
{ 's' ^ 0xff, 'o' ^ 0xff, 'u' ^ 0xff, 'n' ^ 0xff, 'd' ^ 0xff, 'l' ^ 0xff,
'i' ^ 0xff, 's' ^ 0xff, 't' ^ 0xff,
' ' ^ 0xff, '%' ^ 0xff, 'i' ^ 0xff, ' ' ^ 0xff, '%' ^ 0xff, 'i' ^ 0xff, 0
};
/*
==================
CL_Quit_f
@ -645,7 +620,7 @@ CL_FullInfo_f(void)
if (*s)
s++;
if (!strcasecmp(key, pmodel_name) || !strcasecmp(key, emodel_name))
if (!strcasecmp(key, "pmodel") || !strcasecmp(key, "emodel"))
continue;
Info_SetValueForKey(cls.userinfo, key, value, MAX_INFO_STRING);
@ -670,8 +645,7 @@ CL_SetInfo_f(void)
Con_Printf("usage: setinfo [ <key> <value> ]\n");
return;
}
if (!strcasecmp(Cmd_Argv(1), pmodel_name)
|| !strcmp(Cmd_Argv(1), emodel_name))
if (!strcasecmp(Cmd_Argv(1), "pmodel") || !strcmp(Cmd_Argv(1), "emodel"))
return;
Info_SetValueForKey(cls.userinfo, Cmd_Argv(1), Cmd_Argv(2),
@ -1423,23 +1397,6 @@ Host_Frame(float time)
fps_count++;
}
static void
simple_crypt(char *buf, int len)
{
while (len--)
*buf++ ^= 0xff;
}
void
Host_FixupModelNames(void)
{
simple_crypt(emodel_name, sizeof(emodel_name) - 1);
simple_crypt(pmodel_name, sizeof(pmodel_name) - 1);
simple_crypt(prespawn_name, sizeof(prespawn_name) - 1);
simple_crypt(modellist_name, sizeof(modellist_name) - 1);
simple_crypt(soundlist_name, sizeof(soundlist_name) - 1);
}
//============================================================================
/*
@ -1473,8 +1430,6 @@ Host_Init(quakeparms_t *parms)
COM_Init();
Host_FixupModelNames();
NET_Init(PORT_CLIENT);
Netchan_Init();

View File

@ -261,9 +261,8 @@ Model_NextDownload(void)
// done with modellist, request first of static signon messages
MSG_WriteByte(&cls.netchan.message, clc_stringcmd);
// MSG_WriteString (&cls.netchan.message, va("prespawn %i 0 %i", cl.servercount, cl.worldmodel->checksum2));
MSG_WriteString(&cls.netchan.message,
va(prespawn_name, cl.servercount,
va("prespawn %i 0 %i", cl.servercount,
cl.worldmodel->checksum2));
}
@ -302,9 +301,8 @@ Sound_NextDownload(void)
cl_spikeindex = -1;
cl_flagindex = -1;
MSG_WriteByte(&cls.netchan.message, clc_stringcmd);
// MSG_WriteString (&cls.netchan.message, va("modellist %i 0", cl.servercount));
MSG_WriteString(&cls.netchan.message,
va(modellist_name, cl.servercount, 0));
va("modellist %i 0", cl.servercount));
}
@ -602,16 +600,15 @@ CL_ParseServerData(void)
movevars.entgravity = MSG_ReadFloat();
// seperate the printfs so the server message can have a color
Con_Printf
("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
Con_Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36"
"\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
Con_Printf("%c%s\n", 2, str);
// ask for the sound list next
memset(cl.sound_name, 0, sizeof(cl.sound_name));
MSG_WriteByte(&cls.netchan.message, clc_stringcmd);
// MSG_WriteString (&cls.netchan.message, va("soundlist %i 0", cl.servercount));
MSG_WriteString(&cls.netchan.message,
va(soundlist_name, cl.servercount, 0));
va("soundlist %i 0", cl.servercount));
// now waiting for downloads, etc
cls.state = ca_onserver;
@ -633,7 +630,6 @@ CL_ParseSoundlist(void)
// memset (cl.sound_precache, 0, sizeof(cl.sound_precache));
numsounds = MSG_ReadByte();
for (;;) {
str = MSG_ReadString();
if (!str[0])
@ -645,12 +641,10 @@ CL_ParseSoundlist(void)
}
n = MSG_ReadByte();
if (n) {
MSG_WriteByte(&cls.netchan.message, clc_stringcmd);
// MSG_WriteString (&cls.netchan.message, va("soundlist %i %i", cl.servercount, n));
MSG_WriteString(&cls.netchan.message,
va(soundlist_name, cl.servercount, n));
va("soundlist %i %i", cl.servercount, n));
return;
}
@ -695,9 +689,8 @@ CL_ParseModellist(void)
if (n) {
MSG_WriteByte(&cls.netchan.message, clc_stringcmd);
// MSG_WriteString (&cls.netchan.message, va("modellist %i %i", cl.servercount, n));
MSG_WriteString(&cls.netchan.message,
va(modellist_name, cl.servercount, n));
va("modellist %i %i", cl.servercount, n));
return;
}

View File

@ -380,12 +380,6 @@ void CL_BeginServerConnect(void);
extern int cl_numvisedicts;
extern entity_t cl_visedicts[];
extern char emodel_name[];
extern char pmodel_name[];
extern char prespawn_name[];
extern char modellist_name[];
extern char soundlist_name[];
extern int fps_count;
extern int minimum_memory;

View File

@ -247,13 +247,13 @@ Mod_LoadAliasModel(const model_loader_t *loader, model_t *mod, void *buffer,
snprintf(st, sizeof(st), "%d", (int)crc);
Info_SetValueForKey(cls.userinfo,
!strcmp(loadmodel->name, "progs/player.mdl") ?
pmodel_name : emodel_name, st, MAX_INFO_STRING);
"pmodel" : "emodel", st, MAX_INFO_STRING);
if (cls.state >= ca_connected) {
MSG_WriteByte(&cls.netchan.message, clc_stringcmd);
snprintf(st, sizeof(st), "setinfo %s %d",
!strcmp(loadmodel->name, "progs/player.mdl") ?
pmodel_name : emodel_name, (int)crc);
"pmodel" : "emodel", (int)crc);
SZ_Print(&cls.netchan.message, st);
}
}