Changed '#ifdef' to '#if defined()' throughout the code.

This commit is contained in:
Leon Styhre 2020-08-23 17:04:30 +02:00
parent af5a48ed10
commit 88a5962926
28 changed files with 92 additions and 91 deletions

View file

@ -128,7 +128,7 @@ void CollectionSystemManager::saveCustomCollection(SystemData* sys)
CollectionSystemData sysData = mCustomCollectionSystemsData.at(name); CollectionSystemData sysData = mCustomCollectionSystemsData.at(name);
if (sysData.needsSave) { if (sysData.needsSave) {
std::ofstream configFile; std::ofstream configFile;
#ifdef _WIN64 #if defined(_WIN64)
configFile.open(Utils::String:: configFile.open(Utils::String::
stringToWideString(getCustomCollectionConfigPath(name)).c_str()); stringToWideString(getCustomCollectionConfigPath(name)).c_str());
#else #else
@ -996,7 +996,7 @@ std::vector<std::string> CollectionSystemManager::getSystemsFromConfig()
return systems; return systems;
pugi::xml_document doc; pugi::xml_document doc;
#ifdef _WIN64 #if defined(_WIN64)
pugi::xml_parse_result res = doc.load_file(Utils::String::stringToWideString(path).c_str()); pugi::xml_parse_result res = doc.load_file(Utils::String::stringToWideString(path).c_str());
#else #else
pugi::xml_parse_result res = doc.load_file(path.c_str()); pugi::xml_parse_result res = doc.load_file(path.c_str());

View file

@ -15,6 +15,7 @@
#include "Log.h" #include "Log.h"
#include "Settings.h" #include "Settings.h"
#include "SystemData.h" #include "SystemData.h"
#include <pugixml.hpp> #include <pugixml.hpp>
FileData* findOrCreateFile(SystemData* system, const std::string& path, FileType type) FileData* findOrCreateFile(SystemData* system, const std::string& path, FileType type)
@ -94,7 +95,7 @@ void parseGamelist(SystemData* system)
LOG(LogInfo) << "Parsing XML file \"" << xmlpath << "\"..."; LOG(LogInfo) << "Parsing XML file \"" << xmlpath << "\"...";
pugi::xml_document doc; pugi::xml_document doc;
#ifdef _WIN64 #if defined(_WIN64)
pugi::xml_parse_result result = pugi::xml_parse_result result =
doc.load_file(Utils::String::stringToWideString(xmlpath).c_str()); doc.load_file(Utils::String::stringToWideString(xmlpath).c_str());
#else #else
@ -204,7 +205,7 @@ void updateGamelist(SystemData* system)
if (Utils::FileSystem::exists(xmlReadPath)) { if (Utils::FileSystem::exists(xmlReadPath)) {
// Parse an existing file first. // Parse an existing file first.
#ifdef _WIN64 #if defined(_WIN64)
pugi::xml_parse_result result = pugi::xml_parse_result result =
doc.load_file(Utils::String::stringToWideString(xmlReadPath).c_str()); doc.load_file(Utils::String::stringToWideString(xmlReadPath).c_str());
#else #else
@ -288,7 +289,7 @@ void updateGamelist(SystemData* system)
LOG(LogInfo) << "Added/Updated " << numUpdated << LOG(LogInfo) << "Added/Updated " << numUpdated <<
" entities in '" << xmlReadPath << "'"; " entities in '" << xmlReadPath << "'";
#ifdef _WIN64 #if defined(_WIN64)
if (!doc.save_file(Utils::String::stringToWideString(xmlWritePath).c_str())) { if (!doc.save_file(Utils::String::stringToWideString(xmlWritePath).c_str())) {
#else #else
if (!doc.save_file(xmlWritePath.c_str())) { if (!doc.save_file(xmlWritePath.c_str())) {

View file

@ -226,7 +226,7 @@ bool SystemData::loadConfig()
} }
pugi::xml_document doc; pugi::xml_document doc;
#ifdef _WIN64 #if defined(_WIN64)
pugi::xml_parse_result res = doc.load_file(Utils::String::stringToWideString(path).c_str()); pugi::xml_parse_result res = doc.load_file(Utils::String::stringToWideString(path).c_str());
#else #else
pugi::xml_parse_result res = doc.load_file(path.c_str()); pugi::xml_parse_result res = doc.load_file(path.c_str());
@ -307,7 +307,7 @@ bool SystemData::loadConfig()
// Convert path to generic directory seperators. // Convert path to generic directory seperators.
path = Utils::FileSystem::getGenericPath(path); path = Utils::FileSystem::getGenericPath(path);
#ifdef _WIN64 #if defined(_WIN64)
if (!Settings::getInstance()->getBool("ShowHiddenFiles") && if (!Settings::getInstance()->getBool("ShowHiddenFiles") &&
Utils::FileSystem::isHidden(path)) { Utils::FileSystem::isHidden(path)) {
LOG(LogWarning) << "Skipping hidden ROM folder " << path; LOG(LogWarning) << "Skipping hidden ROM folder " << path;

View file

@ -7,7 +7,7 @@
#include "SystemScreenSaver.h" #include "SystemScreenSaver.h"
#ifdef _RPI_ #if defined(_RPI_)
#include "components/VideoPlayerComponent.h" #include "components/VideoPlayerComponent.h"
#endif #endif
#include "components/VideoVlcComponent.h" #include "components/VideoVlcComponent.h"
@ -24,7 +24,7 @@
#include <unordered_map> #include <unordered_map>
#include <time.h> #include <time.h>
#ifdef _WIN64 #if defined(_WIN64)
#include <cstring> #include <cstring>
#endif #endif
@ -104,7 +104,7 @@ void SystemScreenSaver::startScreenSaver()
} }
if (!path.empty() && Utils::FileSystem::exists(path)) { if (!path.empty() && Utils::FileSystem::exists(path)) {
#ifdef _RPI_ #if defined(_RPI_)
// Create the correct type of video component // Create the correct type of video component
if (Settings::getInstance()->getBool("ScreenSaverOmxPlayer")) if (Settings::getInstance()->getBool("ScreenSaverOmxPlayer"))
mVideoScreensaver = new VideoPlayerComponent(mWindow, getTitlePath()); mVideoScreensaver = new VideoPlayerComponent(mWindow, getTitlePath());
@ -330,7 +330,7 @@ void SystemScreenSaver::pickGameListNode(unsigned long index,
mCurrentGame = (*itf); mCurrentGame = (*itf);
// End of getting FileData. // End of getting FileData.
#ifdef _RPI_ #if defined(_RPI_)
if (Settings::getInstance()->getString("ScreenSaverGameInfo") != "never") if (Settings::getInstance()->getString("ScreenSaverGameInfo") != "never")
writeSubtitle(mGameName.c_str(), mSystemName.c_str(), writeSubtitle(mGameName.c_str(), mSystemName.c_str(),
(Settings::getInstance()->getString("ScreenSaverGameInfo") == (Settings::getInstance()->getString("ScreenSaverGameInfo") ==

View file

@ -114,7 +114,7 @@ void VolumeControl::init()
// Try to open mixer device. // Try to open mixer device.
if (mixerHandle == nullptr) { if (mixerHandle == nullptr) {
// Allow user to override the AudioCard and AudioDevice in es_settings.cfg. // Allow user to override the AudioCard and AudioDevice in es_settings.cfg.
#ifdef _RPI_ #if defined(_RPI_)
mixerCard = Settings::getInstance()->getString("AudioCard").c_str(); mixerCard = Settings::getInstance()->getString("AudioCard").c_str();
mixerName = Settings::getInstance()->getString("AudioDevice").c_str(); mixerName = Settings::getInstance()->getString("AudioDevice").c_str();
#endif #endif

View file

@ -93,12 +93,12 @@ void GuiMenu::openSoundSettings()
// The code is still active for Raspberry Pi though as I'm not sure if this is // The code is still active for Raspberry Pi though as I'm not sure if this is
// useful for that device. // useful for that device.
// #if defined(__linux__) // #if defined(__linux__)
#ifdef _RPI_ #if defined(_RPI_)
// audio card // audio card
auto audio_card = std::make_shared<OptionListComponent<std::string>> auto audio_card = std::make_shared<OptionListComponent<std::string>>
(mWindow, getHelpStyle(), "AUDIO CARD", false); (mWindow, getHelpStyle(), "AUDIO CARD", false);
std::vector<std::string> audio_cards; std::vector<std::string> audio_cards;
#ifdef _RPI_ #if defined(_RPI_)
// RPi Specific Audio Cards // RPi Specific Audio Cards
audio_cards.push_back("local"); audio_cards.push_back("local");
audio_cards.push_back("hdmi"); audio_cards.push_back("hdmi");
@ -150,7 +150,7 @@ void GuiMenu::openSoundSettings()
}); });
#endif #endif
#ifdef _RPI_ #if defined(_RPI_)
// OMX player Audio Device // OMX player Audio Device
auto omx_audio_dev = std::make_shared<OptionListComponent<std::string>> auto omx_audio_dev = std::make_shared<OptionListComponent<std::string>>
(mWindow, getHelpStyle(), "OMX PLAYER AUDIO DEVICE", false); (mWindow, getHelpStyle(), "OMX PLAYER AUDIO DEVICE", false);
@ -507,7 +507,7 @@ void GuiMenu::openOtherSettings()
s->addSaveFunc([max_vram] { Settings::getInstance()->setInt("MaxVRAM", s->addSaveFunc([max_vram] { Settings::getInstance()->setInt("MaxVRAM",
(int)Math::round(max_vram->getValue())); }); (int)Math::round(max_vram->getValue())); });
#ifdef __unix__ #if defined(__unix__)
// Fullscreen mode. // Fullscreen mode.
auto fullscreen_mode = std::make_shared<OptionListComponent<std::string>> auto fullscreen_mode = std::make_shared<OptionListComponent<std::string>>
(mWindow, getHelpStyle(), "FULLSCREEN MODE", false); (mWindow, getHelpStyle(), "FULLSCREEN MODE", false);
@ -549,7 +549,7 @@ void GuiMenu::openOtherSettings()
PowerSaver::init(); PowerSaver::init();
}); });
#ifdef _RPI_ #if defined(_RPI_)
// Video Player - VideoOmxPlayer. // Video Player - VideoOmxPlayer.
auto omx_player = std::make_shared<SwitchComponent>(mWindow); auto omx_player = std::make_shared<SwitchComponent>(mWindow);
omx_player->setState(Settings::getInstance()->getBool("VideoOmxPlayer")); omx_player->setState(Settings::getInstance()->getBool("VideoOmxPlayer"));
@ -616,7 +616,7 @@ void GuiMenu::openOtherSettings()
}); });
s->addRow(row); s->addRow(row);
#ifdef _WIN64 #if defined(_WIN64)
// Hide taskbar during ES program session. // Hide taskbar during ES program session.
auto hide_taskbar = std::make_shared<SwitchComponent>(mWindow); auto hide_taskbar = std::make_shared<SwitchComponent>(mWindow);
hide_taskbar->setState(Settings::getInstance()->getBool("HideTaskbar")); hide_taskbar->setState(Settings::getInstance()->getBool("HideTaskbar"));

View file

@ -33,7 +33,7 @@ GuiVideoScreensaverOptions::GuiVideoScreensaverOptions(Window* window, const cha
addSaveFunc([stretch_screensaver] { Settings::getInstance()-> addSaveFunc([stretch_screensaver] { Settings::getInstance()->
setBool("ScreenSaverStretchVideos", stretch_screensaver->getState()); }); setBool("ScreenSaverStretchVideos", stretch_screensaver->getState()); });
#ifdef _RPI_ #if defined(_RPI_)
auto ss_omx = std::make_shared<SwitchComponent>(mWindow); auto ss_omx = std::make_shared<SwitchComponent>(mWindow);
ss_omx->setState(Settings::getInstance()->getBool("ScreenSaverOmxPlayer")); ss_omx->setState(Settings::getInstance()->getBool("ScreenSaverOmxPlayer"));
addWithLabel("USE OMX PLAYER FOR SCREENSAVER", ss_omx); addWithLabel("USE OMX PLAYER FOR SCREENSAVER", ss_omx);
@ -87,7 +87,7 @@ GuiVideoScreensaverOptions::GuiVideoScreensaverOptions(Window* window, const cha
addSaveFunc([ss_video_audio] { Settings::getInstance()-> addSaveFunc([ss_video_audio] { Settings::getInstance()->
setBool("ScreenSaverVideoAudio", ss_video_audio->getState()); }); setBool("ScreenSaverVideoAudio", ss_video_audio->getState()); });
#ifdef _RPI_ #if defined(_RPI_)
// Define subtitle font. // Define subtitle font.
auto ss_omx_font_file = std::make_shared<TextComponent>(mWindow, "", auto ss_omx_font_file = std::make_shared<TextComponent>(mWindow, "",
Font::get(FONT_SIZE_SMALL), 0x777777FF); Font::get(FONT_SIZE_SMALL), 0x777777FF);
@ -115,14 +115,14 @@ GuiVideoScreensaverOptions::~GuiVideoScreensaverOptions()
void GuiVideoScreensaverOptions::save() void GuiVideoScreensaverOptions::save()
{ {
#ifdef _RPI_ #if defined(_RPI_)
bool startingStatusNotRisky = (Settings::getInstance()-> bool startingStatusNotRisky = (Settings::getInstance()->
getString("ScreenSaverGameInfo") == "never" || getString("ScreenSaverGameInfo") == "never" ||
!Settings::getInstance()->getBool("ScreenSaverOmxPlayer")); !Settings::getInstance()->getBool("ScreenSaverOmxPlayer"));
#endif #endif
GuiScreensaverOptions::save(); GuiScreensaverOptions::save();
#ifdef _RPI_ #if defined(_RPI_)
bool endStatusRisky = (Settings::getInstance()->getString("ScreenSaverGameInfo") != bool endStatusRisky = (Settings::getInstance()->getString("ScreenSaverGameInfo") !=
"never" && Settings::getInstance()->getBool("ScreenSaverOmxPlayer")); "never" && Settings::getInstance()->getBool("ScreenSaverOmxPlayer"));
if (startingStatusNotRisky && endStatusRisky) { if (startingStatusNotRisky && endStatusRisky) {

View file

@ -54,7 +54,7 @@ enum returnCode {
NO_ROMS NO_ROMS
}; };
#ifdef _WIN64 #if defined(_WIN64)
enum eConsoleType { enum eConsoleType {
NO_CONSOLE, NO_CONSOLE,
PARENT_CONSOLE, PARENT_CONSOLE,
@ -137,7 +137,7 @@ bool parseArgs(int argc, char* argv[])
{ {
Utils::FileSystem::setExePath(argv[0]); Utils::FileSystem::setExePath(argv[0]);
#ifdef _WIN64 #if defined(_WIN64)
// Print any command line output to the console. // Print any command line output to the console.
if (argc > 1) if (argc > 1)
eConsoleType ConsoleType = outputToConsole(false); eConsoleType ConsoleType = outputToConsole(false);
@ -151,7 +151,7 @@ bool parseArgs(int argc, char* argv[])
std::cerr << "Error: No home path supplied with \'--home'.\n"; std::cerr << "Error: No home path supplied with \'--home'.\n";
return false; return false;
} }
#ifdef _WIN64 #if defined(_WIN64)
if (!Utils::FileSystem::exists(argv[i + 1]) && if (!Utils::FileSystem::exists(argv[i + 1]) &&
(!Utils::FileSystem::driveExists(argv[i + 1]))) { (!Utils::FileSystem::driveExists(argv[i + 1]))) {
#else #else
@ -378,7 +378,7 @@ returnCode loadSystemConfigFile(std::string& errorMsg)
"THAT YOUR FILE EXTENSIONS AND SYSTEMS DIRECTORY\n" "THAT YOUR FILE EXTENSIONS AND SYSTEMS DIRECTORY\n"
"NAMES ARE SUPPORTED BY EMULATIONSTATION-DE.\n" "NAMES ARE SUPPORTED BY EMULATIONSTATION-DE.\n"
"THIS IS THE CURRENTLY CONFIGURED ROM DIRECTORY:\n"; "THIS IS THE CURRENTLY CONFIGURED ROM DIRECTORY:\n";
#ifdef _WIN64 #if defined(_WIN64)
errorMsg += Utils::String::replace(FileData::getROMDirectory(), "/", "\\"); errorMsg += Utils::String::replace(FileData::getROMDirectory(), "/", "\\");
#else #else
errorMsg += FileData::getROMDirectory(); errorMsg += FileData::getROMDirectory();
@ -403,19 +403,19 @@ int main(int argc, char* argv[])
std::locale::global(std::locale("C")); std::locale::global(std::locale("C"));
if (!parseArgs(argc, argv)) { if (!parseArgs(argc, argv)) {
#ifdef _WIN64 #if defined(_WIN64)
closeConsole(); closeConsole();
#endif #endif
return 0; return 0;
} }
#ifdef _WIN64 #if defined(_WIN64)
// Send debug output to the console.. // Send debug output to the console..
if (Settings::getInstance()->getBool("Debug")) if (Settings::getInstance()->getBool("Debug"))
outputToConsole(true); outputToConsole(true);
#endif #endif
#ifdef _WIN64 #if defined(_WIN64)
// Hide taskbar if the setting for this is enabled. // Hide taskbar if the setting for this is enabled.
bool taskbarStateChanged = false; bool taskbarStateChanged = false;
unsigned int taskbarState; unsigned int taskbarState;
@ -428,7 +428,7 @@ int main(int argc, char* argv[])
#endif #endif
// Call this ONLY when linking with FreeImage as a static library. // Call this ONLY when linking with FreeImage as a static library.
#ifdef FREEIMAGE_LIB #if defined(FREEIMAGE_LIB)
FreeImage_Initialise(); FreeImage_Initialise();
#endif #endif
@ -525,7 +525,7 @@ int main(int argc, char* argv[])
window.pushGui(new GuiMsgBox(&window, helpStyle, errorMsg.c_str(), window.pushGui(new GuiMsgBox(&window, helpStyle, errorMsg.c_str(),
"CHANGE ROM DIRECTORY", [&window, &helpStyle, updateVal] { "CHANGE ROM DIRECTORY", [&window, &helpStyle, updateVal] {
std::string currentROMDirectory; std::string currentROMDirectory;
#ifdef _WIN64 #if defined(_WIN64)
currentROMDirectory = currentROMDirectory =
Utils::String::replace(FileData::getROMDirectory(), "/", "\\"); Utils::String::replace(FileData::getROMDirectory(), "/", "\\");
#else #else
@ -665,11 +665,11 @@ int main(int argc, char* argv[])
SystemData::deleteSystems(); SystemData::deleteSystems();
// Call this ONLY when linking with FreeImage as a static library. // Call this ONLY when linking with FreeImage as a static library.
#ifdef FREEIMAGE_LIB #if defined(FREEIMAGE_LIB)
FreeImage_DeInitialise(); FreeImage_DeInitialise();
#endif #endif
#ifdef _WIN64 #if defined(_WIN64)
// If the taskbar state was changed (taskbar was hidden), then revert it. // If the taskbar state was changed (taskbar was hidden), then revert it.
if (taskbarStateChanged) if (taskbarStateChanged)
revertTaskbarState(taskbarState); revertTaskbarState(taskbarState);
@ -679,7 +679,7 @@ int main(int argc, char* argv[])
LOG(LogInfo) << "EmulationStation cleanly shutting down."; LOG(LogInfo) << "EmulationStation cleanly shutting down.";
#ifdef _WIN64 #if defined(_WIN64)
closeConsole(); closeConsole();
#endif #endif

View file

@ -255,7 +255,7 @@ MDResolveHandle::MDResolveHandle(const ScraperSearchResult& result,
return; return;
} }
#ifdef _WIN64 #if defined(_WIN64)
std::ofstream stream(Utils::String::stringToWideString(filePath).c_str(), std::ofstream stream(Utils::String::stringToWideString(filePath).c_str(),
std::ios_base::out | std::ios_base::binary); std::ios_base::out | std::ios_base::binary);
#else #else
@ -386,7 +386,7 @@ void MediaDownloadHandle::update()
return; return;
} }
#ifdef _WIN64 #if defined(_WIN64)
std::ofstream stream(Utils::String::stringToWideString(mSavePath).c_str(), std::ofstream stream(Utils::String::stringToWideString(mSavePath).c_str(),
std::ios_base::out | std::ios_base::binary); std::ios_base::out | std::ios_base::binary);
#else #else

View file

@ -433,7 +433,7 @@ bool ViewController::input(InputConfig* config, Input input)
if (mLockInput) if (mLockInput)
return true; return true;
#ifdef _WIN64 #if defined(_WIN64)
// This code is only needed for Windows, where we may need to keep ES running while // This code is only needed for Windows, where we may need to keep ES running while
// the game/emulator is in use. It's basically used to pause any playing game video // the game/emulator is in use. It's basically used to pause any playing game video
// and to keep the screensaver from activating. // and to keep the screensaver from activating.
@ -570,7 +570,7 @@ void ViewController::reloadGameListView(IGameListView* view, bool reloadTheme)
} }
} }
#ifdef _WIN64 #if defined(_WIN64)
// This code is only needed for Windows, where we may need to keep ES running while // This code is only needed for Windows, where we may need to keep ES running while
// the game/emulator is in use. It's basically used to pause any playing game video // the game/emulator is in use. It's basically used to pause any playing game video
// and to keep the screensaver from activating. // and to keep the screensaver from activating.

View file

@ -13,7 +13,7 @@
#include "Settings.h" #include "Settings.h"
#include "SystemData.h" #include "SystemData.h"
#include "Sound.h" #include "Sound.h"
#ifdef _RPI_ #if defined(_RPI_)
#include "components/VideoPlayerComponent.h" #include "components/VideoPlayerComponent.h"
#endif #endif
#include "components/VideoVlcComponent.h" #include "components/VideoVlcComponent.h"
@ -54,7 +54,7 @@ GridGameListView::GridGameListView(
const float padding = 0.01f; const float padding = 0.01f;
// Create the correct type of video window. // Create the correct type of video window.
#ifdef _RPI_ #if defined(_RPI_)
if (Settings::getInstance()->getBool("VideoOmxPlayer")) if (Settings::getInstance()->getBool("VideoOmxPlayer"))
mVideo = new VideoPlayerComponent(window, ""); mVideo = new VideoPlayerComponent(window, "");
else else

View file

@ -7,13 +7,13 @@
#include "views/gamelist/VideoGameListView.h" #include "views/gamelist/VideoGameListView.h"
#include "animations/LambdaAnimation.h" #include "animations/LambdaAnimation.h"
#ifdef _RPI_ #if defined(_RPI_)
#include "components/VideoPlayerComponent.h" #include "components/VideoPlayerComponent.h"
#endif #endif
#include "components/VideoVlcComponent.h" #include "components/VideoVlcComponent.h"
#include "utils/FileSystemUtil.h" #include "utils/FileSystemUtil.h"
#include "views/ViewController.h" #include "views/ViewController.h"
#ifdef _RPI_ #if defined(_RPI_)
#include "Settings.h" #include "Settings.h"
#endif #endif
@ -52,7 +52,7 @@ VideoGameListView::VideoGameListView(
const float padding = 0.01f; const float padding = 0.01f;
// Create the correct type of video window. // Create the correct type of video window.
#ifdef _RPI_ #if defined(_RPI_)
if (Settings::getInstance()->getBool("VideoOmxPlayer")) if (Settings::getInstance()->getBool("VideoOmxPlayer"))
mVideo = new VideoPlayerComponent(window, ""); mVideo = new VideoPlayerComponent(window, "");
else else

View file

@ -6,7 +6,7 @@
#include "CECInput.h" #include "CECInput.h"
#ifdef HAVE_LIBCEC #if defined(HAVE_LIBCEC)
#include "Log.h" #include "Log.h"
#include <iostream> // Bad bad cecloader. #include <iostream> // Bad bad cecloader.
@ -30,7 +30,7 @@ extern int SDL_USER_CECBUTTONUP;
CECInput* CECInput::sInstance = nullptr; CECInput* CECInput::sInstance = nullptr;
#ifdef HAVE_LIBCEC #if defined(HAVE_LIBCEC)
static void onAlert(void* /*cbParam*/, const CEC::libcec_alert type, static void onAlert(void* /*cbParam*/, const CEC::libcec_alert type,
const CEC::libcec_parameter param) const CEC::libcec_parameter param)
{ {
@ -58,7 +58,7 @@ static void onLogMessage(void* /*cbParam*/, const CEC::cec_log_message* message)
LOG(LogDebug) << "CECInput::onLogMessage message: " << message->message; LOG(LogDebug) << "CECInput::onLogMessage message: " << message->message;
} }
#ifdef _RPI_ #if defined(_RPI_)
static void vchi_tv_and_cec_init() static void vchi_tv_and_cec_init()
{ {
VCHI_INSTANCE_T vchi_instance; VCHI_INSTANCE_T vchi_instance;
@ -94,8 +94,8 @@ void CECInput::deinit()
CECInput::CECInput() : mlibCEC(nullptr) CECInput::CECInput() : mlibCEC(nullptr)
{ {
#ifdef HAVE_LIBCEC #if defined(HAVE_LIBCEC)
#ifdef _RPI_ #if defined(_RPI_)
// Restart vchi tv and CEC in case we just came back from another app using CEC (like Kodi). // Restart vchi tv and CEC in case we just came back from another app using CEC (like Kodi).
vchi_tv_and_cec_deinit(); vchi_tv_and_cec_deinit();
vchi_tv_and_cec_init(); vchi_tv_and_cec_init();
@ -150,14 +150,14 @@ CECInput::CECInput() : mlibCEC(nullptr)
CECInput::~CECInput() CECInput::~CECInput()
{ {
#ifdef HAVE_LIBCEC #if defined(HAVE_LIBCEC)
if (mlibCEC) { if (mlibCEC) {
mlibCEC->Close(); mlibCEC->Close();
UnloadLibCec(mlibCEC); UnloadLibCec(mlibCEC);
mlibCEC = nullptr; mlibCEC = nullptr;
} }
#ifdef _RPI_ #if defined(_RPI_)
// Deinit vchi tv and CEC in case we are going to launch another app using CEC (like Kodi). // Deinit vchi tv and CEC in case we are going to launch another app using CEC (like Kodi).
vchi_tv_and_cec_deinit(); vchi_tv_and_cec_deinit();
#endif // _RPI_ #endif // _RPI_
@ -167,7 +167,7 @@ CECInput::~CECInput()
std::string CECInput::getAlertTypeString(const unsigned int _type) std::string CECInput::getAlertTypeString(const unsigned int _type)
{ {
switch (_type) { switch (_type) {
#ifdef HAVE_LIBCEC #if defined(HAVE_LIBCEC)
case CEC::CEC_ALERT_SERVICE_DEVICE: { return "Service-Device"; } break; case CEC::CEC_ALERT_SERVICE_DEVICE: { return "Service-Device"; } break;
case CEC::CEC_ALERT_CONNECTION_LOST: { return "Connection-Lost"; } break; case CEC::CEC_ALERT_CONNECTION_LOST: { return "Connection-Lost"; } break;
case CEC::CEC_ALERT_PERMISSION_ERROR: { return "Permission-Error"; } break; case CEC::CEC_ALERT_PERMISSION_ERROR: { return "Permission-Error"; } break;
@ -184,7 +184,7 @@ std::string CECInput::getAlertTypeString(const unsigned int _type)
std::string CECInput::getOpCodeString(const unsigned int _opCode) std::string CECInput::getOpCodeString(const unsigned int _opCode)
{ {
switch (_opCode) { switch (_opCode) {
#ifdef HAVE_LIBCEC #if defined(HAVE_LIBCEC)
case CEC::CEC_OPCODE_ACTIVE_SOURCE: { return "Active-Source"; } break; case CEC::CEC_OPCODE_ACTIVE_SOURCE: { return "Active-Source"; } break;
case CEC::CEC_OPCODE_IMAGE_VIEW_ON: { return "Image-View-On"; } break; case CEC::CEC_OPCODE_IMAGE_VIEW_ON: { return "Image-View-On"; } break;
case CEC::CEC_OPCODE_TEXT_VIEW_ON: { return "Text-View-On"; } break; case CEC::CEC_OPCODE_TEXT_VIEW_ON: { return "Text-View-On"; } break;
@ -265,7 +265,7 @@ std::string CECInput::getOpCodeString(const unsigned int _opCode)
std::string CECInput::getKeyCodeString(const unsigned int _keyCode) std::string CECInput::getKeyCodeString(const unsigned int _keyCode)
{ {
switch (_keyCode) { switch (_keyCode) {
#ifdef HAVE_LIBCEC #if defined(HAVE_LIBCEC)
case CEC::CEC_USER_CONTROL_CODE_SELECT: { return "Select"; } break; case CEC::CEC_USER_CONTROL_CODE_SELECT: { return "Select"; } break;
case CEC::CEC_USER_CONTROL_CODE_UP: { return "Up"; } break; case CEC::CEC_USER_CONTROL_CODE_UP: { return "Up"; } break;
case CEC::CEC_USER_CONTROL_CODE_DOWN: { return "Down"; } break; case CEC::CEC_USER_CONTROL_CODE_DOWN: { return "Down"; } break;

View file

@ -54,7 +54,7 @@ HttpReq::HttpReq(const std::string& url) : mStatus(REQ_IN_PROGRESS), mHandle(nul
// Mozilla project). There is a possibility to use the OS provided Schannel certificates // Mozilla project). There is a possibility to use the OS provided Schannel certificates
// but I haven't been able to get this to work and it also seems to be problematic on // but I haven't been able to get this to work and it also seems to be problematic on
// older Windows versions. // older Windows versions.
#ifdef _WIN64 #if defined(_WIN64)
curl_easy_setopt(mHandle, CURLOPT_CAINFO, ResourceManager::getInstance()-> curl_easy_setopt(mHandle, CURLOPT_CAINFO, ResourceManager::getInstance()->
getResourcePath(":/certificates/curl-ca-bundle.crt").c_str()); getResourcePath(":/certificates/curl-ca-bundle.crt").c_str());
#endif #endif

View file

@ -198,7 +198,7 @@ int InputManager::getButtonCountByDevice(SDL_JoystickID id)
if (id == DEVICE_KEYBOARD) if (id == DEVICE_KEYBOARD)
return 120; // It's a lot, okay. return 120; // It's a lot, okay.
else if (id == DEVICE_CEC) else if (id == DEVICE_CEC)
#ifdef HAVE_CECLIB #if defined(HAVE_CECLIB)
return CEC::CEC_USER_CONTROL_CODE_MAX; return CEC::CEC_USER_CONTROL_CODE_MAX;
#else // HAVE_LIBCEF #else // HAVE_LIBCEF
return 0; return 0;
@ -331,7 +331,7 @@ bool InputManager::loadInputConfig(InputConfig* config)
} }
pugi::xml_document doc; pugi::xml_document doc;
#ifdef _WIN64 #if defined(_WIN64)
pugi::xml_parse_result res = doc.load_file(Utils::String::stringToWideString(path).c_str()); pugi::xml_parse_result res = doc.load_file(Utils::String::stringToWideString(path).c_str());
#else #else
pugi::xml_parse_result res = doc.load_file(path.c_str()); pugi::xml_parse_result res = doc.load_file(path.c_str());
@ -410,7 +410,7 @@ void InputManager::writeDeviceConfig(InputConfig* config)
if (Utils::FileSystem::exists(path)) { if (Utils::FileSystem::exists(path)) {
// Merge files. // Merge files.
#ifdef _WIN64 #if defined(_WIN64)
pugi::xml_parse_result result = pugi::xml_parse_result result =
doc.load_file(Utils::String::stringToWideString(path).c_str()); doc.load_file(Utils::String::stringToWideString(path).c_str());
#else #else
@ -454,7 +454,7 @@ void InputManager::writeDeviceConfig(InputConfig* config)
config->writeToXML(root); config->writeToXML(root);
#ifdef _WIN64 #if defined(_WIN64)
doc.save_file(Utils::String::stringToWideString(path).c_str()); doc.save_file(Utils::String::stringToWideString(path).c_str());
#else #else
doc.save_file(path.c_str()); doc.save_file(path.c_str());
@ -475,7 +475,7 @@ void InputManager::doOnFinish()
pugi::xml_document doc; pugi::xml_document doc;
if (Utils::FileSystem::exists(path)) { if (Utils::FileSystem::exists(path)) {
#ifdef _WIN64 #if defined(_WIN64)
pugi::xml_parse_result result = pugi::xml_parse_result result =
doc.load_file(Utils::String::stringToWideString(path).c_str()); doc.load_file(Utils::String::stringToWideString(path).c_str());
#else #else

View file

@ -42,7 +42,7 @@ void Log::init()
void Log::open() void Log::open()
{ {
#ifdef _WIN64 #if defined(_WIN64)
file.open(Utils::String::stringToWideString(getLogPath()).c_str()); file.open(Utils::String::stringToWideString(getLogPath()).c_str());
#else #else
file.open(getLogPath().c_str()); file.open(getLogPath().c_str());

View file

@ -50,7 +50,7 @@ MameNames::MameNames()
LOG(LogInfo) << "Parsing XML file \"" << xmlpath << "\"..."; LOG(LogInfo) << "Parsing XML file \"" << xmlpath << "\"...";
pugi::xml_document doc; pugi::xml_document doc;
#ifdef _WIN64 #if defined(_WIN64)
pugi::xml_parse_result result = pugi::xml_parse_result result =
doc.load_file(Utils::String::stringToWideString(xmlpath).c_str()); doc.load_file(Utils::String::stringToWideString(xmlpath).c_str());
#else #else
@ -80,7 +80,7 @@ MameNames::MameNames()
LOG(LogInfo) << "Parsing XML file \"" << xmlpath << "\"..."; LOG(LogInfo) << "Parsing XML file \"" << xmlpath << "\"...";
#ifdef _WIN64 #if defined(_WIN64)
result = doc.load_file(Utils::String::stringToWideString(xmlpath).c_str()); result = doc.load_file(Utils::String::stringToWideString(xmlpath).c_str());
#else #else
result = doc.load_file(xmlpath.c_str()); result = doc.load_file(xmlpath.c_str());
@ -106,7 +106,7 @@ MameNames::MameNames()
LOG(LogInfo) << "Parsing XML file \"" << xmlpath << "\"..."; LOG(LogInfo) << "Parsing XML file \"" << xmlpath << "\"...";
#ifdef _WIN64 #if defined(_WIN64)
result = doc.load_file(Utils::String::stringToWideString(xmlpath).c_str()); result = doc.load_file(Utils::String::stringToWideString(xmlpath).c_str());
#else #else
result = doc.load_file(xmlpath.c_str()); result = doc.load_file(xmlpath.c_str());

View file

@ -30,7 +30,7 @@
int runRebootCommand() int runRebootCommand()
{ {
#ifdef _WIN64 // Windows. #if defined(_WIN64) // Windows.
return system("shutdown -r -t 0"); return system("shutdown -r -t 0");
#else // macOS and Linux. #else // macOS and Linux.
return system("shutdown --reboot now"); return system("shutdown --reboot now");
@ -39,7 +39,7 @@ int runRebootCommand()
int runPoweroffCommand() int runPoweroffCommand()
{ {
#ifdef _WIN64 // Windows. #if defined(_WIN64) // Windows.
return system("shutdown -s -t 0"); return system("shutdown -s -t 0");
#else // macOS and Linux. #else // macOS and Linux.
return system("shutdown --poweroff now"); return system("shutdown --poweroff now");
@ -48,7 +48,7 @@ int runPoweroffCommand()
int runSystemCommand(const std::string& cmd_utf8) int runSystemCommand(const std::string& cmd_utf8)
{ {
#ifdef _WIN64 #if defined(_WIN64)
// On Windows we use _wsystem to support non-ASCII paths // On Windows we use _wsystem to support non-ASCII paths
// which requires converting from UTF-8 to a wstring. // which requires converting from UTF-8 to a wstring.
std::wstring wchar_str = Utils::String::stringToWideString(cmd_utf8); std::wstring wchar_str = Utils::String::stringToWideString(cmd_utf8);
@ -60,7 +60,7 @@ int runSystemCommand(const std::string& cmd_utf8)
int runSystemCommand(const std::wstring& cmd_utf16) int runSystemCommand(const std::wstring& cmd_utf16)
{ {
#ifdef _WIN64 #if defined(_WIN64)
return _wsystem(cmd_utf16.c_str()); return _wsystem(cmd_utf16.c_str());
#else #else
return 0; return 0;
@ -118,7 +118,7 @@ int launchEmulatorUnix(const std::string& cmd_utf8)
int launchEmulatorWindows(const std::wstring& cmd_utf16) int launchEmulatorWindows(const std::wstring& cmd_utf16)
{ {
#ifdef _WIN64 #if defined(_WIN64)
STARTUPINFOW si {}; STARTUPINFOW si {};
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
@ -187,7 +187,7 @@ int launchEmulatorWindows(const std::wstring& cmd_utf16)
unsigned int getTaskbarState() unsigned int getTaskbarState()
{ {
#ifdef _WIN64 #if defined(_WIN64)
APPBARDATA barData; APPBARDATA barData;
barData.cbSize = sizeof(APPBARDATA); barData.cbSize = sizeof(APPBARDATA);
return (UINT) SHAppBarMessage(ABM_GETSTATE, &barData); return (UINT) SHAppBarMessage(ABM_GETSTATE, &barData);
@ -198,7 +198,7 @@ unsigned int getTaskbarState()
void hideTaskbar() void hideTaskbar()
{ {
#ifdef _WIN64 #if defined(_WIN64)
APPBARDATA barData; APPBARDATA barData;
barData.cbSize = sizeof(APPBARDATA); barData.cbSize = sizeof(APPBARDATA);
barData.lParam = ABS_AUTOHIDE; barData.lParam = ABS_AUTOHIDE;
@ -208,7 +208,7 @@ void hideTaskbar()
void revertTaskbarState(unsigned int& state) void revertTaskbarState(unsigned int& state)
{ {
#ifdef _WIN64 #if defined(_WIN64)
APPBARDATA barData; APPBARDATA barData;
barData.cbSize = sizeof(APPBARDATA); barData.cbSize = sizeof(APPBARDATA);
barData.lParam = state; barData.lParam = state;
@ -243,7 +243,7 @@ void emergencyShutdown()
void touch(const std::string& filename) void touch(const std::string& filename)
{ {
#ifdef _WIN64 #if defined(_WIN64)
FILE* fp = fopen(filename.c_str(), "ab+"); FILE* fp = fopen(filename.c_str(), "ab+");
if (fp != nullptr) if (fp != nullptr)
fclose(fp); fclose(fp);

View file

@ -11,7 +11,7 @@
#include <string> #include <string>
// Why the hell this naming inconsistency exists is well beyond me. // Why the hell this naming inconsistency exists is well beyond me.
#ifdef _WIN64 #if defined(_WIN64)
#define sleep Sleep #define sleep Sleep
#endif #endif

View file

@ -100,7 +100,7 @@ void Settings::setDefaults()
// UI settings -> screensaver settings -> video screensaver settings. // UI settings -> screensaver settings -> video screensaver settings.
mIntMap["ScreenSaverSwapVideoTimeout"] = 25000; mIntMap["ScreenSaverSwapVideoTimeout"] = 25000;
mBoolMap["ScreenSaverStretchVideos"] = false; mBoolMap["ScreenSaverStretchVideos"] = false;
#ifdef _RPI_ #if defined(_RPI_)
mStringMap["ScreenSaverGameInfo"] = "never"; mStringMap["ScreenSaverGameInfo"] = "never";
#endif #endif
mBoolMap["ScreenSaverVideoAudio"] = false; mBoolMap["ScreenSaverVideoAudio"] = false;
@ -124,11 +124,11 @@ void Settings::setDefaults()
// settings could be added later on, if needed. // settings could be added later on, if needed.
// The code is still active for Raspberry Pi though as I'm not sure if this is // The code is still active for Raspberry Pi though as I'm not sure if this is
// useful for that device. // useful for that device.
#ifdef _RPI_ #if defined(_RPI_)
mStringMap["AudioCard"] = "default"; mStringMap["AudioCard"] = "default";
// Audio out device for volume control. // Audio out device for volume control.
//#endif //#endif
//#ifdef _RPI_ //#if defined(_RPI_)
mStringMap["AudioDevice"] = "PCM"; mStringMap["AudioDevice"] = "PCM";
// Audio out device for Video playback using OMX player. // Audio out device for Video playback using OMX player.
mStringMap["OMXAudioDev"] = "both"; mStringMap["OMXAudioDev"] = "both";
@ -167,7 +167,7 @@ void Settings::setDefaults()
mBoolMap["ScrapeVideos"] = true; mBoolMap["ScrapeVideos"] = true;
// Other settings. // Other settings.
#ifdef _RPI_ #if defined(_RPI_)
mIntMap["MaxVRAM"] = 80; mIntMap["MaxVRAM"] = 80;
#else #else
mIntMap["MaxVRAM"] = 128; mIntMap["MaxVRAM"] = 128;
@ -179,7 +179,7 @@ void Settings::setDefaults()
// This setting only applies to raspberry pi but set it for all platforms so // This setting only applies to raspberry pi but set it for all platforms so
// we don't get a warning if we encounter it on a different platform. // we don't get a warning if we encounter it on a different platform.
mBoolMap["VideoOmxPlayer"] = false; mBoolMap["VideoOmxPlayer"] = false;
#ifdef _RPI_ #if defined(_RPI_)
// We're defaulting to OMX Player for full screen video on the Pi. // We're defaulting to OMX Player for full screen video on the Pi.
mBoolMap["ScreenSaverOmxPlayer"] = true; mBoolMap["ScreenSaverOmxPlayer"] = true;
// Use OMX Player defaults. // Use OMX Player defaults.
@ -191,7 +191,7 @@ void Settings::setDefaults()
mBoolMap["ScreenSaverOmxPlayer"] = false; mBoolMap["ScreenSaverOmxPlayer"] = false;
#endif #endif
mStringMap["SaveGamelistsMode"] = "always"; mStringMap["SaveGamelistsMode"] = "always";
#ifdef _WIN64 #if defined(_WIN64)
mBoolMap["HideTaskbar"] = false; mBoolMap["HideTaskbar"] = false;
// Set this to true as default as it's unreliable to suspend ES during game launches // Set this to true as default as it's unreliable to suspend ES during game launches
// on some Windows versions/installations. // on some Windows versions/installations.
@ -289,7 +289,7 @@ void Settings::saveFile()
node.append_attribute("value").set_value(iter->second.c_str()); node.append_attribute("value").set_value(iter->second.c_str());
} }
#ifdef _WIN64 #if defined(_WIN64)
doc.save_file(Utils::String::stringToWideString(path).c_str()); doc.save_file(Utils::String::stringToWideString(path).c_str());
#else #else
doc.save_file(path.c_str()); doc.save_file(path.c_str());
@ -308,7 +308,7 @@ void Settings::loadFile()
return; return;
pugi::xml_document doc; pugi::xml_document doc;
#ifdef _WIN64 #if defined(_WIN64)
pugi::xml_parse_result result = doc.load_file(Utils::String::stringToWideString(path).c_str()); pugi::xml_parse_result result = doc.load_file(Utils::String::stringToWideString(path).c_str());
#else #else
pugi::xml_parse_result result = doc.load_file(path.c_str()); pugi::xml_parse_result result = doc.load_file(path.c_str());

View file

@ -260,7 +260,7 @@ void ThemeData::loadFile(std::map<std::string, std::string> sysDataMap, const st
mVariables.insert(sysDataMap.cbegin(), sysDataMap.cend()); mVariables.insert(sysDataMap.cbegin(), sysDataMap.cend());
pugi::xml_document doc; pugi::xml_document doc;
#ifdef _WIN64 #if defined(_WIN64)
pugi::xml_parse_result res = doc.load_file(Utils::String::stringToWideString(path).c_str()); pugi::xml_parse_result res = doc.load_file(Utils::String::stringToWideString(path).c_str());
#else #else
pugi::xml_parse_result res = doc.load_file(path.c_str()); pugi::xml_parse_result res = doc.load_file(path.c_str());
@ -306,7 +306,7 @@ void ThemeData::parseIncludes(const pugi::xml_node& root)
mPaths.push_back(path); mPaths.push_back(path);
pugi::xml_document includeDoc; pugi::xml_document includeDoc;
#ifdef _WIN64 #if defined(_WIN64)
pugi::xml_parse_result result = pugi::xml_parse_result result =
includeDoc.load_file(Utils::String::stringToWideString(path).c_str()); includeDoc.load_file(Utils::String::stringToWideString(path).c_str());
#else #else

View file

@ -4,7 +4,7 @@
// OMXPlayer video playing for Raspberry Pi. // OMXPlayer video playing for Raspberry Pi.
// //
#ifdef _RPI_ #if defined(_RPI_)
#include "components/VideoPlayerComponent.h" #include "components/VideoPlayerComponent.h"
#include "renderers/Renderer.h" #include "renderers/Renderer.h"

View file

@ -4,7 +4,7 @@
// OMXPlayer video playing for Raspberry Pi. // OMXPlayer video playing for Raspberry Pi.
// //
#ifdef _RPI_ #if defined(_RPI_)
#pragma once #pragma once
#ifndef ES_CORE_COMPONENTS_VIDEO_PLAYER_COMPONENT_H #ifndef ES_CORE_COMPONENTS_VIDEO_PLAYER_COMPONENT_H
#define ES_CORE_COMPONENTS_VIDEO_PLAYER_COMPONENT_H #define ES_CORE_COMPONENTS_VIDEO_PLAYER_COMPONENT_H

View file

@ -266,7 +266,7 @@ void VideoVlcComponent::startVideo()
mVideoWidth = 0; mVideoWidth = 0;
mVideoHeight = 0; mVideoHeight = 0;
#ifdef _WIN64 #if defined(_WIN64)
std::string path(Utils::String::replace(mVideoPath, "/", "\\")); std::string path(Utils::String::replace(mVideoPath, "/", "\\"));
#else #else
std::string path(mVideoPath); std::string path(mVideoPath);

View file

@ -100,7 +100,7 @@ namespace Renderer
unsigned int windowFlags; unsigned int windowFlags;
#ifdef _WIN64 #if defined(_WIN64)
// For Windows, always set the mode to windowed, as full screen mode seems to // For Windows, always set the mode to windowed, as full screen mode seems to
// behave quite erratic. There may be a proper fix for this, but for now windowed // behave quite erratic. There may be a proper fix for this, but for now windowed
// mode seems to behave well and it's almost completely seamless, especially with // mode seems to behave well and it's almost completely seamless, especially with

View file

@ -110,7 +110,7 @@ const ResourceData ResourceManager::getFileData(const std::string& path) const
ResourceData ResourceManager::loadFile(const std::string& path) const ResourceData ResourceManager::loadFile(const std::string& path) const
{ {
#ifdef _WIN64 #if defined(_WIN64)
std::ifstream stream(Utils::String::stringToWideString(path).c_str(), std::ios::binary); std::ifstream stream(Utils::String::stringToWideString(path).c_str(), std::ios::binary);
#else #else
std::ifstream stream(path, std::ios::binary); std::ifstream stream(path, std::ios::binary);

View file

@ -35,7 +35,7 @@
// The installPrefix directory is the value set for CMAKE_INSTALL_PREFIX during build. // The installPrefix directory is the value set for CMAKE_INSTALL_PREFIX during build.
// If not defined, the default prefix path '/usr/local' will be used. // If not defined, the default prefix path '/usr/local' will be used.
#if defined(__unix__) #if defined(__unix__)
#ifdef ES_INSTALL_PREFIX #if defined(ES_INSTALL_PREFIX)
std::string installPrefix = ES_INSTALL_PREFIX; std::string installPrefix = ES_INSTALL_PREFIX;
#else #else
std::string installPrefix = "/usr/local"; std::string installPrefix = "/usr/local";
@ -676,7 +676,7 @@ namespace Utils
return true; return true;
// Try to create directory. // Try to create directory.
#ifdef _WIN64 #if defined(_WIN64)
if (_wmkdir(Utils::String::stringToWideString(path).c_str()) == 0) if (_wmkdir(Utils::String::stringToWideString(path).c_str()) == 0)
return true; return true;
#else #else