Skip to content

Commit

Permalink
Output main archive checksums in DumpState()
Browse files Browse the repository at this point in the history
  • Loading branch information
lhog committed Mar 18, 2024
1 parent 8cd254d commit a5f90f8
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions rts/System/Sync/DumpState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "Sim/Weapons/WeaponDefHandler.h"
#include "Map/ReadMap.h"
#include "System/StringUtil.h"
#include "System/FileSystem/ArchiveScanner.h"
#include "System/Log/ILog.h"
#include "System/SpringHash.h"

Expand Down Expand Up @@ -174,6 +175,7 @@ void DumpState(int newMinFrameNum, int newMaxFrameNum, int newFramePeriod, std::

#define DUMP_MATH_CONST
#define DUMP_MODEL_DATA
#define DUMP_CS_DATA
#define DUMP_UNIT_DATA
#define DUMP_UNIT_PIECE_DATA
#define DUMP_UNIT_WEAPON_DATA
Expand Down Expand Up @@ -218,6 +220,32 @@ void DumpState(int newMinFrameNum, int newMaxFrameNum, int newFramePeriod, std::
}
#endif

#ifdef DUMP_CS_DATA
if (gs->frameNum == gMinFrameNum) { //dump once
sha512::hex_digest hexDigest;
{
hexDigest = { 0 };
const auto mapCheckSum = archiveScanner->GetArchiveCompleteChecksumBytes(gameSetup->mapName);
sha512::dump_digest(mapCheckSum, hexDigest);
file << "\tmapCheckSum: " << std::string(hexDigest.data()) << "\n";
}
{
hexDigest = { 0 };
const auto modCheckSum = archiveScanner->GetArchiveCompleteChecksumBytes(gameSetup->modName);
sha512::dump_digest(modCheckSum, hexDigest);
file << "\tmodCheckSum: " << std::string(hexDigest.data()) << "\n";
}
/*
for (const auto& ari : archiveScanner->GetAllArchives()) {
hexDigest = { 0 };
const auto cs = archiveScanner->GetArchiveCompleteChecksumBytes(ari.GetNameVersioned());
sha512::dump_digest(cs, hexDigest);
file << "\tArchive: " << ari.GetNameVersioned() << " checkSum: " << std::string(hexDigest.data()) << "\n";
}
*/
}
#endif

#ifdef DUMP_MODEL_DATA
if (gs->frameNum == gMinFrameNum) { //dump once
// models no longer have same order and IDs across different runs due to MT preload.
Expand Down

0 comments on commit a5f90f8

Please sign in to comment.