- Timestamp:
- 05/29/18 04:14:38 (7 years ago)
- Location:
- ps/trunk
- Files:
-
- 4 edited
-
binaries/system/readme.txt (modified) (1 diff)
-
source/main.cpp (modified) (1 diff)
-
source/ps/Replay.cpp (modified) (3 diffs)
-
source/ps/Replay.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/binaries/system/readme.txt
r21726 r21829 79 79 -unique-logs adds unix timestamp and process id to the filename of mainlog.html, interestinglog.html 80 80 and oos_dump.txt to prevent these files from becoming overwritten by another pyrogenesis process. 81 -hashtest-full=X whether to enable computation of full hashes in replaymode (default true). Can be disabled to improve performance. 82 -hashtest-quick=X whether to enable computation of quick hashes in replaymode (default false). Can be enabled for debugging purposes. 81 83 82 84 Windows-specific: -
ps/trunk/source/main.cpp
r21818 r21829 555 555 args.Has("serializationtest"), 556 556 args.Has("rejointest") ? args.Get("rejointest").ToInt() : -1, 557 args.Has("ooslog")); 557 args.Has("ooslog"), 558 !args.Has("hashtest-full") || args.Get("hashtest-full") == "true", 559 args.Has("hashtest-quick") && args.Get("hashtest-quick") == "true"); 558 560 } 559 561 -
ps/trunk/source/ps/Replay.cpp
r21823 r21829 168 168 LOGWARNING("%s\nThe mods of the replay are:\n%s\nThese mods are enabled:\n%s", warn, ModListToString(replayMods), ModListToString(enabledMods)); 169 169 } 170 void CReplayPlayer::Replay(bool serializationtest, int rejointestturn, bool ooslog) 170 171 void CReplayPlayer::Replay(const bool serializationtest, const int rejointestturn, const bool ooslog, const bool testHashFull, const bool testHashQuick) 171 172 { 172 173 ENSURE(m_Stream); … … 248 249 std::string replayHash; 249 250 *m_Stream >> replayHash; 250 251 bool quick = (type == "hash-quick"); 252 253 if (turn % 100 == 0) 254 { 255 std::string hash; 256 bool ok = g_Game->GetSimulation2()->ComputeStateHash(hash, quick); 257 ENSURE(ok); 258 std::string hexHash = Hexify(hash); 259 if (hexHash == replayHash) 260 debug_printf("hash ok (%s)\n", hexHash.c_str()); 261 else 262 debug_printf("HASH MISMATCH (%s != %s)\n", hexHash.c_str(), replayHash.c_str()); 263 } 251 TestHash(type, replayHash, testHashFull, testHashQuick); 264 252 } 265 253 else if (type == "end") … … 308 296 SAFE_DELETE(g_ScriptStatsTable); 309 297 } 298 299 void CReplayPlayer::TestHash(const std::string& hashType, const std::string& replayHash, const bool testHashFull, const bool testHashQuick) 300 { 301 bool quick = (hashType == "hash-quick"); 302 if ((quick && !testHashQuick) || (!quick && !testHashFull)) 303 return; 304 305 std::string hash; 306 ENSURE(g_Game->GetSimulation2()->ComputeStateHash(hash, quick)); 307 308 std::string hexHash = Hexify(hash); 309 310 if (hexHash == replayHash) 311 debug_printf("%s ok (%s)\n", hashType.c_str(), hexHash.c_str()); 312 else 313 debug_printf("%s MISMATCH (%s != %s)\n", hashType.c_str(), hexHash.c_str(), replayHash.c_str()); 314 } -
ps/trunk/source/ps/Replay.h
r21603 r21829 1 /* Copyright (C) 201 7Wildfire Games.1 /* Copyright (C) 2018 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * … … 99 99 100 100 void Load(const OsPath& path); 101 void Replay( bool serializationtest, int rejointestturn, bool ooslog);101 void Replay(const bool serializationtest, const int rejointestturn, const bool ooslog, const bool testHashFull, const bool testHashQuick); 102 102 103 103 private: … … 105 105 CStr ModListToString(const std::vector<std::vector<CStr>>& list) const; 106 106 void CheckReplayMods(const ScriptInterface& scriptInterface, JS::HandleValue attribs) const; 107 void TestHash(const std::string& hashType, const std::string& replayHash, const bool testHashFull, const bool testHashQuick); 107 108 }; 108 109
Note:
See TracChangeset
for help on using the changeset viewer.
