Files
mitch030504--AstroQuest-Frame/quest-host/cpp/log.cpp
T
bigmak94andClaude Opus 5.5 b5f400bbbd AstroQuest 0.11: ASTRO BOT Rescue Mission in VR on Meta Quest 3 and PC VR
On top of the shadps4-arm64 core imported in the previous commit:

- PlayStation VR emulation: headset, tracker, reprojection, camera and social screen; the
  player's seat and view reset; head velocity for head-butts; field of view settings
- Sound: a native Ngs2 engine (samplers, submixers, effects), the Audio3d spatializer, virtual
  surround for headset speakers, microphone pass-through; libSceJson2; libSceFiber on FEX
- Fixes for CUSA12392 under emulation: real-time step, pace and resolution governor, larger
  render sizes on the PC, save loading at start
- Renderer: geometry shaders fed with fans/polygons/loops, cube-array layers of light probes,
  sample-count mismatches on Adreno, timeline semaphore hang, FXAA in place of the MSAA
  resolve, sharpening, VR frame export
- quest-host: the Quest app (OpenXR host that runs the glibc core as a child process, frames
  through AHardwareBuffers, DualSense mapping, hand-tracked controller placement, KGSL shim)
- PC: in-process OpenXR host (Virtual Desktop or any OpenXR runtime), Touch controllers as the
  gamepad, launcher with a settings window; vendored OpenXR SDK 1.1.63
- Builds keep the build machine's folders out of the binaries (-ffile-prefix-map); machine
  settings (Python, headset serial, signing key) live in git-ignored tools/*.local files
- tools: build, packaging and test scripts for Windows and the headset
- README with installation, license (GPL-2.0-or-later), third-party notices and thanks

No game files are part of the repository; .gitignore only lets listed paths in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 15:00:43 +02:00

56 lines
1.5 KiB
C++

// SPDX-License-Identifier: GPL-2.0-or-later
#include "log.h"
#include <cstdarg>
#include <cstdio>
#include <ctime>
#include <mutex>
#include <string>
namespace {
std::mutex g_mutex;
FILE* g_file = nullptr;
} // namespace
void SetLogFile(const char* path) {
std::scoped_lock lock{g_mutex};
if (g_file != nullptr) {
std::fclose(g_file);
}
// "e": the emulator process must not inherit the file.
g_file = std::fopen(path, "we");
}
void HostLog(int priority, const char* format, ...) {
va_list args;
va_start(args, format);
va_list measure;
va_copy(measure, args);
const int length = std::vsnprintf(nullptr, 0, format, measure);
va_end(measure);
std::string text(length > 0 ? static_cast<size_t>(length) : 0, '\0');
if (length > 0) {
std::vsnprintf(text.data(), text.size() + 1, format, args);
}
va_end(args);
__android_log_write(priority, LOG_TAG, text.c_str());
std::scoped_lock lock{g_mutex};
if (g_file == nullptr) {
return;
}
timespec now{};
clock_gettime(CLOCK_REALTIME, &now);
tm local{};
localtime_r(&now.tv_sec, &local);
const char level = priority >= ANDROID_LOG_ERROR ? 'E' : priority >= ANDROID_LOG_WARN ? 'W' : 'I';
std::fprintf(g_file, "%02d:%02d:%02d.%03ld %c %s\n", local.tm_hour, local.tm_min, local.tm_sec,
now.tv_nsec / 1'000'000, level, text.c_str());
// A session can end by the app being killed.
std::fflush(g_file);
}