From 5fae4f36dbbfc742759ae199629181f088e5c8c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 21 Mar 2023 11:42:55 +0100 Subject: [PATCH] Move SkipUI function --- Common/System/System.h | 2 ++ Core/Host.h | 2 -- Core/Util/PPGeDraw.cpp | 4 +++- headless/Headless.cpp | 2 ++ headless/StubHost.h | 2 -- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Common/System/System.h b/Common/System/System.h index aaa49f988e..8d74f9c270 100644 --- a/Common/System/System.h +++ b/Common/System/System.h @@ -132,6 +132,8 @@ enum SystemProperty { SYSPROP_CAN_JIT, SYSPROP_KEYBOARD_LAYOUT, + + SYSPROP_SKIP_UI, }; enum class SystemNotification { diff --git a/Core/Host.h b/Core/Host.h index 35800789da..aa9267ef4e 100644 --- a/Core/Host.h +++ b/Core/Host.h @@ -45,8 +45,6 @@ public: virtual void NotifyUserMessage(const std::string &message, float duration = 1.0f, u32 color = 0x00FFFFFF, const char *id = nullptr) {} virtual void SendUIMessage(const std::string &message, const std::string &value) {} - // Used for headless. - virtual bool ShouldSkipUI() { return false; } virtual void SendDebugOutput(const std::string &output) {} virtual void SendDebugScreenshot(const u8 *pixbuf, u32 w, u32 h) {} }; diff --git a/Core/Util/PPGeDraw.cpp b/Core/Util/PPGeDraw.cpp index 12dc1e86a9..b9124e85c9 100644 --- a/Core/Util/PPGeDraw.cpp +++ b/Core/Util/PPGeDraw.cpp @@ -18,6 +18,8 @@ #include #include "ext/xxhash.h" + +#include "Common/System/System.h" #include "Common/Data/Color/RGBAUtil.h" #include "Common/File/VFS/VFS.h" #include "Common/Data/Format/ZIMLoad.h" @@ -237,7 +239,7 @@ void __PPGeSetupListArgs() void __PPGeInit() { // PPGe isn't really important for headless, and LoadZIM takes a long time. - bool skipZIM = host->ShouldSkipUI(); + bool skipZIM = System_GetPropertyBool(SYSPROP_SKIP_UI); u8 *imageData[12]{}; int width[12]{}; diff --git a/headless/Headless.cpp b/headless/Headless.cpp index 55316a348a..52372f9de0 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -108,6 +108,8 @@ bool System_GetPropertyBool(SystemProperty prop) { switch (prop) { case SYSPROP_CAN_JIT: return true; + case SYSPROP_SKIP_UI: + return true; default: return false; } diff --git a/headless/StubHost.h b/headless/StubHost.h index e8b3463787..1159045f9e 100644 --- a/headless/StubHost.h +++ b/headless/StubHost.h @@ -36,8 +36,6 @@ public: bool AttemptLoadSymbolMap() override { g_symbolMap->Clear(); return false; } - bool ShouldSkipUI() override { return true; } - void SendDebugOutput(const std::string &output) override { if (output.find('\n') != output.npos) { DoFlushDebugOutput();