From d45a67eeab55500b953ea0ee3552c39a9f4505e2 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 10 Jan 2022 19:53:23 +0100 Subject: [PATCH] (Windows) Fixed a few compiler errors and warnings. --- es-app/src/guis/GuiMenu.cpp | 4 ++++ es-core/src/components/LottieComponent.cpp | 4 ++-- es-core/src/utils/PlatformUtil.cpp | 27 ++++++++++++---------- es-core/src/utils/PlatformUtil.h | 8 +++---- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index dddcd6ef8..93f58e181 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -9,6 +9,10 @@ #include "guis/GuiMenu.h" +#if defined(_WIN64) +#include +#endif + #include "CollectionSystemsManager.h" #include "EmulationStation.h" #include "FileFilterIndex.h" diff --git a/es-core/src/components/LottieComponent.cpp b/es-core/src/components/LottieComponent.cpp index 272188595..b6453d08f 100644 --- a/es-core/src/components/LottieComponent.cpp +++ b/es-core/src/components/LottieComponent.cpp @@ -198,7 +198,7 @@ void LottieComponent::resetFileAnimation() if (mFuture.valid()) mFuture.get(); mFuture = mAnimation->render(mFrameNum, *mSurface, mKeepAspectRatio); - mLastRenderedFrame = mFrameNum; + mLastRenderedFrame = static_cast(mFrameNum); } } @@ -447,7 +447,7 @@ void LottieComponent::render(const glm::mat4& parentTrans) if (renderNextFrame && !mHoldFrame) { mFuture = mAnimation->render(mFrameNum, *mSurface, mKeepAspectRatio); - mLastRenderedFrame = mFrameNum; + mLastRenderedFrame = static_cast(mFrameNum); } } diff --git a/es-core/src/utils/PlatformUtil.cpp b/es-core/src/utils/PlatformUtil.cpp index b11336c3b..e0bb93df6 100644 --- a/es-core/src/utils/PlatformUtil.cpp +++ b/es-core/src/utils/PlatformUtil.cpp @@ -10,6 +10,9 @@ #include "Log.h" #include "Window.h" +#if defined(_WIN64) +#include "utils/StringUtil.h" +#endif #include @@ -259,7 +262,7 @@ namespace Utils int quitES(QuitMode mode) { - quitMode = mode; + sQuitMode = mode; SDL_Event quit; quit.type = SDL_QUIT; @@ -267,19 +270,9 @@ namespace Utils return 0; } - void emergencyShutdown() - { - LOG(LogError) << "Critical - Performing emergency shutdown..."; - - Window::getInstance()->deinit(); - Log::flush(); - - exit(EXIT_FAILURE); - } - void processQuitMode() { - switch (quitMode) { + switch (sQuitMode) { case QuitMode::REBOOT: { LOG(LogInfo) << "Rebooting system"; runRebootCommand(); @@ -296,6 +289,16 @@ namespace Utils } } + void emergencyShutdown() + { + LOG(LogError) << "Critical - Performing emergency shutdown..."; + + Window::getInstance()->deinit(); + Log::flush(); + + exit(EXIT_FAILURE); + } + } // namespace Platform } // namespace Utils diff --git a/es-core/src/utils/PlatformUtil.h b/es-core/src/utils/PlatformUtil.h index 9e1fccf6d..f63e35255 100644 --- a/es-core/src/utils/PlatformUtil.h +++ b/es-core/src/utils/PlatformUtil.h @@ -12,8 +12,6 @@ #include #if defined(_WIN64) -#include -// This order is required as MinGW complains if windows.h is included before winsock2.h. #include #endif @@ -44,12 +42,14 @@ namespace Utils // Clean, normal shutdown. int quitES(QuitMode mode = QuitMode::QUIT); + void processQuitMode(); // Immediately shut down the application as cleanly as possible. void emergencyShutdown(); - void processQuitMode(); - inline static QuitMode quitMode = QuitMode::QUIT; + static QuitMode sQuitMode = QuitMode::QUIT; + // This is simply to get rid of a GCC false positive -Wunused-variable compiler warning. + static QuitMode sQuitModeDummy = sQuitMode; } // namespace Platform