main,SaveTool,Configuration: further Wine support.
This commit is contained in:
parent
a1a155d0ac
commit
f7a8962194
5 changed files with 36 additions and 3 deletions
|
@ -156,6 +156,14 @@ Configuration::setSkipDisclaimer(bool mode) {
|
||||||
_conf.save();
|
_conf.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Configuration::isRunningInWine() const {
|
||||||
|
return _isRunningInWine;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Configuration::setRunningInWine(bool wine) {
|
||||||
|
_isRunningInWine = wine;
|
||||||
|
}
|
||||||
|
|
||||||
Configuration&
|
Configuration&
|
||||||
Configuration::instance() {
|
Configuration::instance() {
|
||||||
static Configuration conf{};
|
static Configuration conf{};
|
||||||
|
|
|
@ -46,6 +46,9 @@ class Configuration {
|
||||||
bool skipDisclaimer() const;
|
bool skipDisclaimer() const;
|
||||||
void setSkipDisclaimer(bool mode);
|
void setSkipDisclaimer(bool mode);
|
||||||
|
|
||||||
|
bool isRunningInWine() const;
|
||||||
|
void setRunningInWine(bool wine);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit Configuration();
|
explicit Configuration();
|
||||||
|
|
||||||
|
@ -57,6 +60,8 @@ class Configuration {
|
||||||
bool _advancedMode = false;
|
bool _advancedMode = false;
|
||||||
bool _checkUpdatesOnStartup = true;
|
bool _checkUpdatesOnStartup = true;
|
||||||
bool _skipDisclaimer = false;
|
bool _skipDisclaimer = false;
|
||||||
|
|
||||||
|
bool _isRunningInWine = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
Configuration& conf();
|
Configuration& conf();
|
||||||
|
|
|
@ -337,6 +337,12 @@ SaveTool::drawDisclaimer() {
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextUnformatted("This version of the application was tested on M.A.S.S. Builder early access version " SUPPORTED_GAME_VERSION ". It may or may not work with other versions of the game.");
|
ImGui::TextUnformatted("This version of the application was tested on M.A.S.S. Builder early access version " SUPPORTED_GAME_VERSION ". It may or may not work with other versions of the game.");
|
||||||
|
|
||||||
|
if(conf().isRunningInWine()) {
|
||||||
|
ImGui::Bullet();
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextUnformatted("You are currently running this application in Wine/Proton. It hasn't been fully tested, so some issues may arise. Furthermore, features may be unavailable.");
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::PopTextWrapPos();
|
ImGui::PopTextWrapPos();
|
||||||
|
|
||||||
if(ImGui::BeginTable("##DisclaimerLayoutTable", 3)) {
|
if(ImGui::BeginTable("##DisclaimerLayoutTable", 3)) {
|
||||||
|
@ -430,9 +436,12 @@ SaveTool::drawCheckbox(Containers::StringView label, bool value) {
|
||||||
|
|
||||||
void
|
void
|
||||||
SaveTool::openUri(Containers::StringView uri) {
|
SaveTool::openUri(Containers::StringView uri) {
|
||||||
ShellExecuteW(nullptr, nullptr, Utility::Unicode::widen(uri.data()), nullptr, nullptr, SW_SHOWDEFAULT);
|
if(!conf().isRunningInWine()) {
|
||||||
// TODO: have it open folders through winebrowser.exe when running using Wine/Proton.
|
ShellExecuteA(nullptr, nullptr, uri.data(), nullptr, nullptr, SW_SHOWDEFAULT);
|
||||||
// URLs like Discord invites or Steam Browser Protocol links should be disabled entirely there.
|
}
|
||||||
|
else {
|
||||||
|
std::system(Utility::format("winebrowser.exe {}", uri).cbegin());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -159,6 +159,7 @@ SaveTool::drawMainMenu() {
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::BeginDisabled(conf().isRunningInWine());
|
||||||
if(ImGui::BeginMenu("Game##GameMenu")) {
|
if(ImGui::BeginMenu("Game##GameMenu")) {
|
||||||
if(ImGui::MenuItem(ICON_FA_PLAY " Run demo##RunDemoMenuItem")) {
|
if(ImGui::MenuItem(ICON_FA_PLAY " Run demo##RunDemoMenuItem")) {
|
||||||
openUri("steam://run/1048390");
|
openUri("steam://run/1048390");
|
||||||
|
@ -185,6 +186,10 @@ SaveTool::drawMainMenu() {
|
||||||
|
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
if(conf().isRunningInWine() && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
|
||||||
|
ImGui::SetTooltip("Not available when running in Wine.");
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SAVETOOL_DEBUG_BUILD
|
#ifdef SAVETOOL_DEBUG_BUILD
|
||||||
if(ImGui::BeginMenu("Debug tools")) {
|
if(ImGui::BeginMenu("Debug tools")) {
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <synchapi.h>
|
#include <synchapi.h>
|
||||||
#include <winerror.h>
|
#include <winerror.h>
|
||||||
|
|
||||||
|
#include "Configuration/Configuration.h"
|
||||||
#include "Logger/MagnumLogBuffer.h"
|
#include "Logger/MagnumLogBuffer.h"
|
||||||
#include "SaveTool/SaveTool.h"
|
#include "SaveTool/SaveTool.h"
|
||||||
|
|
||||||
|
@ -50,6 +51,11 @@ int main(int argc, char** argv) {
|
||||||
"Your system doesn't support UTF-8.", nullptr);
|
"Your system doesn't support UTF-8.", nullptr);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(locale.hasSuffix(".65001")) {
|
||||||
|
LOG_INFO("Wine detected.");
|
||||||
|
conf().setRunningInWine(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto mutex_handle = CreateMutexW(nullptr, 0, L"MassBuilderSaveTool");
|
auto mutex_handle = CreateMutexW(nullptr, 0, L"MassBuilderSaveTool");
|
||||||
|
|
Loading…
Reference in a new issue