2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 05:47:42 +00:00

Windows fixes

This commit is contained in:
Jack Andersen
2017-10-23 17:12:10 -10:00
parent 15d60493f2
commit 4ee4963aaf
17 changed files with 103 additions and 44 deletions

View File

@@ -313,7 +313,8 @@ std::vector<uint8_t> VISIBuilder::build(const zeus::CAABox& fullAabb,
const std::vector<VISIRenderer::Entity>& entities,
const std::vector<VISIRenderer::Light>& lights,
size_t layer2LightCount,
FPercent updatePercent)
FPercent updatePercent,
ProcessType parentPid)
{
Log.report(logvisor::Info, "Started!");
@@ -321,8 +322,20 @@ std::vector<uint8_t> VISIBuilder::build(const zeus::CAABox& fullAabb,
renderCache.m_lightMetaBit = featureCount;
Progress prog(updatePercent);
pid_t parentPid = getppid();
auto terminate = [this, parentPid]() { return renderCache.m_renderer.m_terminate || kill(parentPid, 0); };
#ifndef _WIN32
auto terminate = [this, parentPid]()
{
return renderCache.m_renderer.m_terminate || (parentPid ? kill(parentPid, 0) : false);
};
#else
auto terminate = [this, parentPid]()
{
DWORD exitCode = 0;
if (!GetExitCodeProcess(parentPid, &exitCode))
return renderCache.m_renderer.m_terminate;
return renderCache.m_renderer.m_terminate || (parentPid ? exitCode != STILL_ACTIVE : false);
};
#endif
rootNode.buildChildren(0, 1, fullAabb, renderCache, prog, terminate);
if (terminate())
return {};