mirror of
https://github.com/Nexoniarz/Fry3DX.git
synced 2026-11-03 04:24:26 +00:00
macOS (Apple silicon and Intel): Fry3DX.app with its content in Resources and MoltenVK in Frameworks, OpenGL 4.1 when there's no Vulkan; the program's own path, memory, OS and CPU names on a Mac; files dropped on the window (and opened from the Finder) open; presets macos-arm64/macos-x64, a CI job, tools/package.py macos makes one universal app
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5c28e3da4e
commit
e22cd2e3e6
15 changed files with 273 additions and 40 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include "crash.h"
|
||||
|
||||
#include <core/log.h>
|
||||
#include <core/sysinfo.h>
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
|
|
@ -122,17 +123,6 @@ void onSignal(int sig) {
|
|||
}
|
||||
#endif
|
||||
|
||||
bool debuggerAttached() {
|
||||
#ifdef _WIN32
|
||||
return IsDebuggerPresent();
|
||||
#else
|
||||
std::ifstream f("/proc/self/status");
|
||||
for (std::string line; std::getline(f, line);)
|
||||
if (line.rfind("TracerPid:", 0) == 0) return std::atoi(line.c_str() + 10) != 0;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void watchdog() {
|
||||
constexpr double kTimeout = 45.0;
|
||||
for (;;) {
|
||||
|
|
@ -141,7 +131,7 @@ void watchdog() {
|
|||
g_beat = seconds();
|
||||
continue;
|
||||
}
|
||||
if (seconds() - g_beat < kTimeout || debuggerAttached()) continue;
|
||||
if (seconds() - g_beat < kTimeout || sys::debuggerAttached()) continue;
|
||||
#ifndef _WIN32
|
||||
pthread_kill(g_main, SIGUSR2); // its handler reports from the stuck thread (its backtrace)
|
||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
||||
|
|
@ -153,12 +143,8 @@ void watchdog() {
|
|||
|
||||
void install(const std::string& prefPath, const std::vector<std::string>& args, bool dog) {
|
||||
g_report = prefPath + "crash.txt";
|
||||
#ifdef _WIN32
|
||||
char exe[1024] = {};
|
||||
GetModuleFileNameA(nullptr, exe, sizeof exe);
|
||||
g_exe = exe;
|
||||
#else
|
||||
g_exe = std::filesystem::read_symlink("/proc/self/exe").string();
|
||||
g_exe = sys::executablePath();
|
||||
#ifndef _WIN32
|
||||
g_main = pthread_self();
|
||||
#endif
|
||||
g_args = {g_exe, "-crashreport", g_report, "--"};
|
||||
|
|
|
|||
Loading…
Reference in a new issue