2020-09-16 20:14:35 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-06-21 12:25:28 +00:00
|
|
|
//
|
2020-09-16 20:14:35 +00:00
|
|
|
// EmulationStation Desktop Edition
|
2020-06-21 12:25:28 +00:00
|
|
|
// Platform.h
|
|
|
|
//
|
|
|
|
// Platform-specific functions.
|
|
|
|
//
|
|
|
|
|
2017-10-31 17:12:50 +00:00
|
|
|
#ifndef ES_CORE_PLATFORM_H
|
|
|
|
#define ES_CORE_PLATFORM_H
|
|
|
|
|
2017-11-01 22:21:10 +00:00
|
|
|
#include <string>
|
|
|
|
|
2020-08-23 15:04:30 +00:00
|
|
|
#if defined(_WIN64)
|
2021-07-07 18:31:46 +00:00
|
|
|
#include <winsock2.h>
|
2021-07-07 18:48:38 +00:00
|
|
|
// This order is required as MinGW complains if windows.h is included before winsock2.h.
|
2020-09-16 20:14:35 +00:00
|
|
|
#include <windows.h>
|
2012-09-10 18:48:00 +00:00
|
|
|
#endif
|
2013-05-13 19:53:28 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
enum QuitMode {
|
2021-07-07 18:31:46 +00:00
|
|
|
QUIT = 0, // Replace with AllowShortEnumsOnASingleLine: false (clang-format >=11.0).
|
2020-06-21 12:25:28 +00:00
|
|
|
REBOOT = 1,
|
|
|
|
POWEROFF = 2
|
2019-08-14 23:50:23 +00:00
|
|
|
};
|
|
|
|
|
2020-07-07 19:25:15 +00:00
|
|
|
// Uses UTF-8 for Unix and does a UTF-16/wstring conversion for Windows.
|
2020-06-21 12:25:28 +00:00
|
|
|
int runSystemCommand(const std::string& cmd_utf8);
|
2020-07-07 19:25:15 +00:00
|
|
|
// Windows specific UTF-16/wstring function. (FOR FUTURE USE)
|
|
|
|
int runSystemCommand(const std::wstring& cmd_utf16);
|
|
|
|
|
2021-03-24 19:13:33 +00:00
|
|
|
int launchGameUnix(const std::string& cmd_utf8, bool runInBackground);
|
2021-07-16 15:56:16 +00:00
|
|
|
int launchGameWindows(const std::wstring& cmd_utf16, bool runInBackground, bool hideWindow);
|
2020-07-07 19:25:15 +00:00
|
|
|
|
2020-07-18 11:21:44 +00:00
|
|
|
unsigned int getTaskbarState();
|
|
|
|
void hideTaskbar();
|
|
|
|
void revertTaskbarState(unsigned int& state);
|
|
|
|
|
2020-07-08 15:01:47 +00:00
|
|
|
// Clean, normal shutdown.
|
2019-08-14 23:50:23 +00:00
|
|
|
int quitES(QuitMode mode = QuitMode::QUIT);
|
2021-07-07 18:31:46 +00:00
|
|
|
|
2020-07-08 15:01:47 +00:00
|
|
|
// Immediately shut down the application as cleanly as possible.
|
|
|
|
void emergencyShutdown();
|
2019-08-14 23:50:23 +00:00
|
|
|
void processQuitMode();
|
2017-10-31 17:12:50 +00:00
|
|
|
|
|
|
|
#endif // ES_CORE_PLATFORM_H
|