From 999d9747e98388595e6531da11a6400bb11b44b0 Mon Sep 17 00:00:00 2001 From: Pieter Hulshoff Date: Thu, 5 Dec 2019 16:51:46 +0100 Subject: [PATCH] Fixed Windows compile errors. --- RetroFE/Source/Graphics/PageBuilder.cpp | 2 +- RetroFE/Source/Utility/Utils.cpp | 8 ++++++++ RetroFE/Source/Utility/Utils.h | 1 + RetroFE/Source/Version.cpp | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/RetroFE/Source/Graphics/PageBuilder.cpp b/RetroFE/Source/Graphics/PageBuilder.cpp index 51ed7d0..ee81aba 100644 --- a/RetroFE/Source/Graphics/PageBuilder.cpp +++ b/RetroFE/Source/Graphics/PageBuilder.cpp @@ -97,7 +97,7 @@ Page *PageBuilder::buildPage( std::string collectionName ) layoutPath = Utils::combinePath(layoutPath, "layout"); } layoutFile = Utils::combinePath(layoutPath, layoutPage + ".xml"); - layoutFileAspect = Utils::combinePath(layoutPath, layoutPage + " " + std::to_string( screenWidth_/std::__gcd( screenWidth_, screenHeight_ ) ) + "x" + std::to_string( screenHeight_/std::__gcd( screenWidth_, screenHeight_ ) ) + ".xml" ); + layoutFileAspect = Utils::combinePath(layoutPath, layoutPage + " " + std::to_string( screenWidth_/Utils::gcd( screenWidth_, screenHeight_ ) ) + "x" + std::to_string( screenHeight_/Utils::gcd( screenWidth_, screenHeight_ ) ) + ".xml" ); Logger::write(Logger::ZONE_INFO, "Layout", "Initializing " + layoutFileAspect); diff --git a/RetroFE/Source/Utility/Utils.cpp b/RetroFE/Source/Utility/Utils.cpp index 19978bf..6c59af6 100644 --- a/RetroFE/Source/Utility/Utils.cpp +++ b/RetroFE/Source/Utility/Utils.cpp @@ -266,3 +266,11 @@ void Utils::listToVector( std::string str, std::vector &vec, char d } vec.push_back( Utils::trimEnds( str.substr( previous, current - previous ) ) ); } + + +int Utils::gcd( int a, int b ) +{ + if (b == 0) + return a; + return gcd( b, a % b ); +} diff --git a/RetroFE/Source/Utility/Utils.h b/RetroFE/Source/Utility/Utils.h index 7a41b74..df7b654 100644 --- a/RetroFE/Source/Utility/Utils.h +++ b/RetroFE/Source/Utility/Utils.h @@ -36,6 +36,7 @@ public: static std::string filterComments(std::string line); static std::string trimEnds(std::string str); static void listToVector( std::string str, std::vector &vec, char delimiter ); + static int gcd( int a, int b ); //todo: there has to be a better way to do this static std::string combinePath(std::list &paths); diff --git a/RetroFE/Source/Version.cpp b/RetroFE/Source/Version.cpp index 8df1e93..d51b3d7 100644 --- a/RetroFE/Source/Version.cpp +++ b/RetroFE/Source/Version.cpp @@ -21,7 +21,7 @@ std::string retrofe_version_major = "0"; std::string retrofe_version_minor = "9"; -std::string retrofe_version_build = "18"; +std::string retrofe_version_build = "19"; std::string Version::getString( )