Add option to disable ghost map hash check.

This commit is contained in:
furo 2023-10-26 19:34:13 +02:00
parent 92206044d1
commit c79e4c2de5
2 changed files with 8 additions and 4 deletions

View file

@ -4,6 +4,7 @@
#include <engine/console.h>
#include <engine/shared/compression.h>
#include <engine/shared/config.h>
#include <engine/shared/network.h>
#include <engine/storage.h>
@ -220,9 +221,10 @@ int CGhostLoader::Load(const char *pFilename, const char *pMap, SHA256_DIGEST Ma
m_File = 0;
return -1;
}
if(m_Header.m_Version >= 6)
{
if(m_Header.m_MapSha256 != MapSha256)
if(m_Header.m_MapSha256 != MapSha256 && g_Config.m_ClRaceGhostStrictMap)
{
char aGhostSha256[SHA256_MAXSTRSIZE];
sha256_str(m_Header.m_MapSha256, aGhostSha256, sizeof(aGhostSha256));
@ -240,7 +242,7 @@ int CGhostLoader::Load(const char *pFilename, const char *pMap, SHA256_DIGEST Ma
{
io_skip(m_File, -(int)sizeof(SHA256_DIGEST));
unsigned GhostMapCrc = bytes_be_to_uint(m_Header.m_aZeroes);
if(str_comp(m_Header.m_aMap, pMap) != 0 || GhostMapCrc != MapCrc)
if((str_comp(m_Header.m_aMap, pMap) != 0 || GhostMapCrc != MapCrc) && g_Config.m_ClRaceGhostStrictMap)
{
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "ghost map '%s' crc mismatch, wanted=%08x ghost=%08x", pMap, MapCrc, GhostMapCrc);
@ -380,14 +382,15 @@ bool CGhostLoader::GetGhostInfo(const char *pFilename, CGhostInfo *pGhostInfo, c
{
return false;
}
if(Header.m_Version >= 6)
if(Header.m_Version >= 6 && g_Config.m_ClRaceGhostStrictMap)
{
if(Header.m_MapSha256 != MapSha256)
{
return false;
}
}
else
else if(g_Config.m_ClRaceGhostStrictMap)
{
unsigned GhostMapCrc = bytes_be_to_uint(Header.m_aZeroes);
if(GhostMapCrc != MapCrc)

View file

@ -322,6 +322,7 @@ MACRO_CONFIG_INT(ClRaceGhost, cl_race_ghost, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_S
MACRO_CONFIG_INT(ClRaceGhostServerControl, cl_race_ghost_server_control, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Let the server start the ghost")
MACRO_CONFIG_INT(ClRaceShowGhost, cl_race_show_ghost, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show ghost")
MACRO_CONFIG_INT(ClRaceSaveGhost, cl_race_save_ghost, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Save ghost")
MACRO_CONFIG_INT(ClRaceGhostStrictMap, cl_race_ghost_strict_map, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Strict map checking when loading ghosts")
MACRO_CONFIG_INT(ClDDRaceScoreBoard, cl_ddrace_scoreboard, 1, 0, 1, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Enable DDRace Scoreboard")
MACRO_CONFIG_INT(SvResetPickups, sv_reset_pickups, 0, 0, 1, CFGFLAG_SERVER | CFGFLAG_GAME, "Whether the weapons are reset on passing the start tile or not")