mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 13:04:56 +00:00
Windows fixes
This commit is contained in:
@@ -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 {};
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
#include "athena/MemoryWriter.hpp"
|
||||
#include <unordered_map>
|
||||
|
||||
#ifdef _WIN32
|
||||
using ProcessType = HANDLE;
|
||||
#else
|
||||
using ProcessType = pid_t;
|
||||
#endif
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <> struct hash<zeus::CVector3f>
|
||||
@@ -122,7 +128,8 @@ struct VISIBuilder
|
||||
const std::vector<VISIRenderer::Entity>& entities,
|
||||
const std::vector<VISIRenderer::Light>& lights,
|
||||
size_t layer2LightCount,
|
||||
FPercent updatePercent);
|
||||
FPercent updatePercent,
|
||||
ProcessType parentPid);
|
||||
|
||||
VISIBuilder(VISIRenderer& renderer) : renderCache(renderer) {}
|
||||
};
|
||||
|
||||
@@ -503,6 +503,14 @@ void VISIRenderer::Run(FPercent updatePercent)
|
||||
return;
|
||||
}
|
||||
|
||||
ProcessType parentPid = 0;
|
||||
if (m_argc > 4)
|
||||
#ifdef _WIN32
|
||||
parentPid = ProcessType(wcstoull(m_argv[4], nullptr, 16));
|
||||
#else
|
||||
parentPid = ProcessType(strtoull(m_argv[4], nullptr, 16));
|
||||
#endif
|
||||
|
||||
uint32_t layer2LightCount = 0;
|
||||
{
|
||||
athena::io::FileReader r(m_argv[1]);
|
||||
@@ -579,7 +587,7 @@ void VISIRenderer::Run(FPercent updatePercent)
|
||||
VISIBuilder builder(*this);
|
||||
std::vector<uint8_t> dataOut = builder.build(m_totalAABB, m_models.size(),
|
||||
m_entities, m_lights, layer2LightCount,
|
||||
m_updatePercent);
|
||||
m_updatePercent, parentPid);
|
||||
if (dataOut.empty())
|
||||
{
|
||||
m_return = 1;
|
||||
|
||||
Reference in New Issue
Block a user