(Windows) Fixed a few compiler errors and warnings.

This commit is contained in:
Leon Styhre 2022-01-10 19:53:23 +01:00
parent b4e08ba92b
commit d45a67eeab
4 changed files with 25 additions and 18 deletions

View file

@ -9,6 +9,10 @@
#include "guis/GuiMenu.h" #include "guis/GuiMenu.h"
#if defined(_WIN64)
#include <winsock2.h>
#endif
#include "CollectionSystemsManager.h" #include "CollectionSystemsManager.h"
#include "EmulationStation.h" #include "EmulationStation.h"
#include "FileFilterIndex.h" #include "FileFilterIndex.h"

View file

@ -198,7 +198,7 @@ void LottieComponent::resetFileAnimation()
if (mFuture.valid()) if (mFuture.valid())
mFuture.get(); mFuture.get();
mFuture = mAnimation->render(mFrameNum, *mSurface, mKeepAspectRatio); mFuture = mAnimation->render(mFrameNum, *mSurface, mKeepAspectRatio);
mLastRenderedFrame = mFrameNum; mLastRenderedFrame = static_cast<int>(mFrameNum);
} }
} }
@ -447,7 +447,7 @@ void LottieComponent::render(const glm::mat4& parentTrans)
if (renderNextFrame && !mHoldFrame) { if (renderNextFrame && !mHoldFrame) {
mFuture = mAnimation->render(mFrameNum, *mSurface, mKeepAspectRatio); mFuture = mAnimation->render(mFrameNum, *mSurface, mKeepAspectRatio);
mLastRenderedFrame = mFrameNum; mLastRenderedFrame = static_cast<int>(mFrameNum);
} }
} }

View file

@ -10,6 +10,9 @@
#include "Log.h" #include "Log.h"
#include "Window.h" #include "Window.h"
#if defined(_WIN64)
#include "utils/StringUtil.h"
#endif
#include <SDL2/SDL_events.h> #include <SDL2/SDL_events.h>
@ -259,7 +262,7 @@ namespace Utils
int quitES(QuitMode mode) int quitES(QuitMode mode)
{ {
quitMode = mode; sQuitMode = mode;
SDL_Event quit; SDL_Event quit;
quit.type = SDL_QUIT; quit.type = SDL_QUIT;
@ -267,19 +270,9 @@ namespace Utils
return 0; return 0;
} }
void emergencyShutdown()
{
LOG(LogError) << "Critical - Performing emergency shutdown...";
Window::getInstance()->deinit();
Log::flush();
exit(EXIT_FAILURE);
}
void processQuitMode() void processQuitMode()
{ {
switch (quitMode) { switch (sQuitMode) {
case QuitMode::REBOOT: { case QuitMode::REBOOT: {
LOG(LogInfo) << "Rebooting system"; LOG(LogInfo) << "Rebooting system";
runRebootCommand(); 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 Platform
} // namespace Utils } // namespace Utils

View file

@ -12,8 +12,6 @@
#include <string> #include <string>
#if defined(_WIN64) #if defined(_WIN64)
#include <winsock2.h>
// This order is required as MinGW complains if windows.h is included before winsock2.h.
#include <windows.h> #include <windows.h>
#endif #endif
@ -44,12 +42,14 @@ namespace Utils
// Clean, normal shutdown. // Clean, normal shutdown.
int quitES(QuitMode mode = QuitMode::QUIT); int quitES(QuitMode mode = QuitMode::QUIT);
void processQuitMode();
// Immediately shut down the application as cleanly as possible. // Immediately shut down the application as cleanly as possible.
void emergencyShutdown(); 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 } // namespace Platform