0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

UI: Add Rosetta Detection

Adds a check that detects if OBS is running on Rosetta on macOS and logs
the result.
This commit is contained in:
gxalpha 2022-01-02 15:18:08 +01:00 committed by Jim
parent c60ec74424
commit 8298f040fe
3 changed files with 21 additions and 0 deletions

View File

@ -2116,6 +2116,12 @@ static int run_program(fstream &logFile, int argc, char *argv[])
}
#endif
#ifdef __APPLE__
bool rosettaTranslated = ProcessIsRosettaTranslated();
blog(LOG_INFO, "Rosetta translation used: %s",
rosettaTranslated ? "true" : "false");
#endif
if (!created_log) {
create_log_file(logFile);
created_log = true;

View File

@ -23,6 +23,7 @@
#include "obs-app.hpp"
#include <unistd.h>
#include <sys/sysctl.h>
#import <AppKit/AppKit.h>
@ -235,6 +236,19 @@ void EnableOSXDockIcon(bool enable)
NSApplicationActivationPolicyProhibited];
}
bool ProcessIsRosettaTranslated()
{
#ifdef __aarch64__
return false;
#else
int ret = 0;
size_t size = sizeof(ret);
if (sysctlbyname("sysctl.proc_translated", &ret, &size, NULL, 0) == -1)
return false;
return ret == 1;
#endif
}
/*
* This custom NSApplication subclass makes the app compatible with CEF. Qt
* also has an NSApplication subclass, but it doesn't conflict thanks to Qt

View File

@ -69,6 +69,7 @@ void EnableOSXDockIcon(bool enable);
void InstallNSApplicationSubclass();
void disableColorSpaceConversion(QWidget *window);
void CheckAppWithSameBundleID(bool &already_running);
bool ProcessIsRosettaTranslated();
#endif
#ifdef __linux__
void RunningInstanceCheck(bool &already_running);