Files
t5de-renderer/adapter/log.cpp
T
dhkatzandClaude Opus 5.5 9a7d7d2908 Add the renderer process
The renderer becomes two programs: the adapter (t5deRenderEngine.dll, 32-bit, in IMVU's process) and a 64-bit renderer process (t5de-renderer.exe) drawing with Diligent Engine, fetched with FetchContent and pinned. For now a spike: the adapter starts the renderer process for each engine and signals each frame through a shared memory channel, and the renderer process draws a box into a child window in the client's 3D view.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 05:17:03 -07:00

40 lines
834 B
C++

#include "log.hpp"
#include <share.h>
#include <windows.h>
#include <cstdio>
#include <filesystem>
#include <mutex>
namespace t5de::log {
namespace {
std::FILE* open()
{
wchar_t temp[MAX_PATH + 1];
const DWORD length = GetTempPathW(MAX_PATH + 1, temp);
if (length == 0 || length > MAX_PATH) {
return nullptr;
}
// Shared, so it can be read while the client runs.
return _wfsopen((std::filesystem::path(temp) / L"t5de-renderer.log").c_str(), L"w", _SH_DENYNO);
}
} // namespace
void write(std::string_view line)
{
static std::mutex mutex;
static std::FILE* file = open();
const std::scoped_lock lock(mutex);
if (file != nullptr) {
std::fwrite(line.data(), 1, line.size(), file);
std::fputc('\n', file);
std::fflush(file);
}
}
} // namespace t5de::log