Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/ps/Replay.cpp
Show All 28 Lines | |||||
#include "ps/Loader.h" | #include "ps/Loader.h" | ||||
#include "ps/Mod.h" | #include "ps/Mod.h" | ||||
#include "ps/Profile.h" | #include "ps/Profile.h" | ||||
#include "ps/ProfileViewer.h" | #include "ps/ProfileViewer.h" | ||||
#include "ps/Pyrogenesis.h" | #include "ps/Pyrogenesis.h" | ||||
#include "ps/Mod.h" | #include "ps/Mod.h" | ||||
#include "ps/Util.h" | #include "ps/Util.h" | ||||
#include "ps/VisualReplay.h" | #include "ps/VisualReplay.h" | ||||
#include "scriptinterface/ScriptContext.h" | |||||
#include "scriptinterface/ScriptInterface.h" | #include "scriptinterface/ScriptInterface.h" | ||||
#include "scriptinterface/ScriptRuntime.h" | |||||
#include "scriptinterface/ScriptStats.h" | #include "scriptinterface/ScriptStats.h" | ||||
#include "simulation2/components/ICmpGuiInterface.h" | #include "simulation2/components/ICmpGuiInterface.h" | ||||
#include "simulation2/helpers/Player.h" | #include "simulation2/helpers/Player.h" | ||||
#include "simulation2/helpers/SimulationCommand.h" | #include "simulation2/helpers/SimulationCommand.h" | ||||
#include "simulation2/Simulation2.h" | #include "simulation2/Simulation2.h" | ||||
#include "simulation2/system/CmpPtr.h" | #include "simulation2/system/CmpPtr.h" | ||||
#include <ctime> | #include <ctime> | ||||
▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
ENSURE(m_Stream); | ENSURE(m_Stream); | ||||
new CProfileViewer; | new CProfileViewer; | ||||
new CProfileManager; | new CProfileManager; | ||||
g_ScriptStatsTable = new CScriptStatsTable; | g_ScriptStatsTable = new CScriptStatsTable; | ||||
g_ProfileViewer.AddRootTable(g_ScriptStatsTable); | g_ProfileViewer.AddRootTable(g_ScriptStatsTable); | ||||
const int runtimeSize = 384 * 1024 * 1024; | const int contextSize = 384 * 1024 * 1024; | ||||
const int heapGrowthBytesGCTrigger = 20 * 1024 * 1024; | const int heapGrowthBytesGCTrigger = 20 * 1024 * 1024; | ||||
g_ScriptRuntime = ScriptRuntime::CreateRuntime(runtimeSize, heapGrowthBytesGCTrigger); | g_ScriptContext = ScriptContext::CreateContext(contextSize, heapGrowthBytesGCTrigger); | ||||
Mod::CacheEnabledModVersions(g_ScriptRuntime); | Mod::CacheEnabledModVersions(g_ScriptContext); | ||||
g_Game = new CGame(false); | g_Game = new CGame(false); | ||||
if (serializationtest) | if (serializationtest) | ||||
g_Game->GetSimulation2()->EnableSerializationTest(); | g_Game->GetSimulation2()->EnableSerializationTest(); | ||||
if (rejointestturn >= 0) | if (rejointestturn >= 0) | ||||
g_Game->GetSimulation2()->EnableRejoinTest(rejointestturn); | g_Game->GetSimulation2()->EnableRejoinTest(rejointestturn); | ||||
if (ooslog) | if (ooslog) | ||||
g_Game->GetSimulation2()->EnableOOSLog(); | g_Game->GetSimulation2()->EnableOOSLog(); | ||||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | void CReplayPlayer::Replay(const bool serializationtest, const int rejointestturn, const bool ooslog, const bool testHashFull, const bool testHashQuick) | ||||
ENSURE(ok); | ENSURE(ok); | ||||
debug_printf("# Final state: %s\n", Hexify(hash).c_str()); | debug_printf("# Final state: %s\n", Hexify(hash).c_str()); | ||||
timer_DisplayClientTotals(); | timer_DisplayClientTotals(); | ||||
SAFE_DELETE(g_Game); | SAFE_DELETE(g_Game); | ||||
// Must be explicitly destructed here to avoid callbacks from the JSAPI trying to use g_Profiler2 when | // Must be explicitly destructed here to avoid callbacks from the JSAPI trying to use g_Profiler2 when | ||||
// it's already destructed. | // it's already destructed. | ||||
g_ScriptRuntime.reset(); | g_ScriptContext.reset(); | ||||
// Clean up | // Clean up | ||||
delete &g_TexMan; | delete &g_TexMan; | ||||
delete &g_Profiler; | delete &g_Profiler; | ||||
delete &g_ProfileViewer; | delete &g_ProfileViewer; | ||||
SAFE_DELETE(g_ScriptStatsTable); | SAFE_DELETE(g_ScriptStatsTable); | ||||
} | } | ||||
Show All 17 Lines |
Wildfire Games · Phabricator