UI: Add warning on startup for running in Wine

master
Rodney 2022-02-07 23:16:59 +01:00 committed by GitHub
parent 109b54fd66
commit b7a24d54c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 3 deletions

View File

@ -109,6 +109,9 @@ AlreadyRunning.LaunchAnyway="Launch Anyway"
ChromeOS.Title="Unsupported Platform"
ChromeOS.Text="OBS appears to be running inside a ChromeOS container. This platform is unsupported"
Wine.Title="Wine detected"
Wine.Text="Running OBS in Wine is unsupported, and many features such as capture or device sources will not work or only in limited capacity.<br><br>It is recommended to run a native version of OBS instead, for example <a href='https://flathub.org/apps/details/com.obsproject.Studio'>our Flatpak version</a> or your operating system's packages."
# warning when closing docks. it's frustrating that we actually need this.
DockCloseWarning.Title="Closing Dockable Window"
DockCloseWarning.Text="You just closed a dockable window. If you'd like to show it again, use the Docks menu on the menu bar."

View File

@ -2156,16 +2156,33 @@ static int run_program(fstream &logFile, int argc, char *argv[])
}
#endif
if (!created_log) {
create_log_file(logFile);
created_log = true;
}
#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;
#ifdef _WIN32
if (IsRunningOnWine()) {
QMessageBox mb(QMessageBox::Question,
QTStr("Wine.Title"), QTStr("Wine.Text"));
mb.setTextFormat(Qt::RichText);
mb.addButton(QTStr("AlreadyRunning.LaunchAnyway"),
QMessageBox::AcceptRole);
QPushButton *closeButton =
mb.addButton(QMessageBox::Close);
mb.setDefaultButton(closeButton);
mb.exec();
if (mb.clickedButton() == closeButton)
return 0;
}
#endif
if (argc > 1) {
stringstream stor;

View File

@ -449,3 +449,23 @@ QString GetMonitorName(const QString &id)
return QString::fromWCharArray(target.monitorFriendlyDeviceName);
}
/* Based on https://www.winehq.org/pipermail/wine-devel/2008-September/069387.html */
typedef const char *(CDECL *WINEGETVERSION)(void);
bool IsRunningOnWine()
{
WINEGETVERSION func;
HMODULE nt;
nt = GetModuleHandleW(L"ntdll");
if (!nt)
return false;
func = (WINEGETVERSION)GetProcAddress(nt, "wine_get_version");
if (func) {
blog(LOG_WARNING, "Running on Wine version \"%s\"", func());
return true;
}
return false;
}

View File

@ -64,6 +64,7 @@ public:
RunOnceMutex GetRunOnceMutex(bool &already_running);
QString GetMonitorName(const QString &id);
bool IsRunningOnWine();
#endif
#ifdef __APPLE__