mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-21 21:55:38 +00:00
Various updates to make the application compile on macOS.
This commit is contained in:
parent
6dd1078e09
commit
ad960b28ac
|
@ -12,12 +12,12 @@
|
|||
include(FindPkgMacros)
|
||||
|
||||
if (NOT WIN32)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PUGIXML REQUIRED pugixml>=1.09)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PUGIXML REQUIRED pugixml>=1.09)
|
||||
endif (NOT WIN32)
|
||||
|
||||
if (WIN32)
|
||||
find_path(PUGIXML_INCLUDE_DIR pugixml.hpp)
|
||||
find_path(PUGIXML_INCLUDE_DIR pugixml.hpp)
|
||||
|
||||
# Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found.
|
||||
include (FindPackageHandleStandardArgs)
|
||||
|
|
|
@ -14,7 +14,7 @@ if (NOT WIN32)
|
|||
endif (NOT WIN32)
|
||||
|
||||
if (WIN32)
|
||||
find_path(RAPIDJSON_INCLUDE_DIR rapidjson/rapidjson.h)
|
||||
find_path(RAPIDJSON_INCLUDE_DIR rapidjson/rapidjson.h)
|
||||
|
||||
# Support the REQUIRED and QUIET arguments, and set RAPIDJSON_FOUND if found.
|
||||
include (FindPackageHandleStandardArgs)
|
||||
|
@ -22,7 +22,7 @@ include (FindPackageHandleStandardArgs)
|
|||
find_package_handle_standard_args(RAPIDJSON DEFAULT_MSG RAPIDJSON_INCLUDE_DIR)
|
||||
|
||||
if (NOT RAPIDJSON_INCLUDE_DIR)
|
||||
message(FATAL_ERROR "RapidJSON include files not found!")
|
||||
message(FATAL_ERROR "RapidJSON include files not found!")
|
||||
endif()
|
||||
|
||||
endif (WIN32)
|
||||
|
|
|
@ -15,45 +15,43 @@
|
|||
#
|
||||
|
||||
if(VLC_INCLUDE_DIR AND VLC_LIBRARIES)
|
||||
# in cache already
|
||||
set(VLC_FIND_QUIETLY TRUE)
|
||||
# In cache already
|
||||
set(VLC_FIND_QUIETLY TRUE)
|
||||
endif(VLC_INCLUDE_DIR AND VLC_LIBRARIES)
|
||||
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
if(NOT WIN32)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(VLC REQUIRED libvlc>=3.0.0)
|
||||
set(VLC_DEFINITIONS ${VLC_CFLAGS})
|
||||
set(VLC_LIBRARIES ${VLC_LDFLAGS})
|
||||
endif(NOT WIN32)
|
||||
if(NOT WIN32 AND NOT APPLE)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(VLC REQUIRED libvlc>=3.0.0)
|
||||
set(VLC_DEFINITIONS ${VLC_CFLAGS})
|
||||
set(VLC_LIBRARIES ${VLC_LDFLAGS})
|
||||
endif(NOT WIN32 AND NOT APPLE)
|
||||
|
||||
if (WIN32)
|
||||
if(WIN32)
|
||||
# TODO add argument support to pass version on find_package
|
||||
include(MacroEnsureVersion)
|
||||
macro_ensure_version(3.0.0 ${VLC_VERSION} VLC_VERSION_OK)
|
||||
if(VLC_VERSION_OK)
|
||||
set(VLC_FOUND TRUE)
|
||||
message(STATUS "VLC library found")
|
||||
else(VLC_VERSION_OK)
|
||||
set(VLC_FOUND FALSE)
|
||||
message(FATAL_ERROR "VLC library not found")
|
||||
endif(VLC_VERSION_OK)
|
||||
|
||||
# TODO add argument support to pass version on find_package
|
||||
include(MacroEnsureVersion)
|
||||
macro_ensure_version(3.0.0 ${VLC_VERSION} VLC_VERSION_OK)
|
||||
if(VLC_VERSION_OK)
|
||||
set(VLC_FOUND TRUE)
|
||||
message(STATUS "VLC library found")
|
||||
else(VLC_VERSION_OK)
|
||||
set(VLC_FOUND FALSE)
|
||||
message(FATAL_ERROR "VLC library not found")
|
||||
endif(VLC_VERSION_OK)
|
||||
find_path(VLC_INCLUDE_DIR
|
||||
NAMES vlc.h
|
||||
PATHS ${VLC_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES vlc)
|
||||
|
||||
find_path(VLC_INCLUDE_DIR
|
||||
NAMES vlc.h
|
||||
PATHS ${VLC_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES vlc)
|
||||
find_library(VLC_LIBRARIES
|
||||
NAMES vlc
|
||||
PATHS ${VLC_LIBRARY_DIRS})
|
||||
|
||||
find_library(VLC_LIBRARIES
|
||||
NAMES vlc
|
||||
PATHS ${VLC_LIBRARY_DIRS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(VLC DEFAULT_MSG VLC_INCLUDE_DIR VLC_LIBRARIES)
|
||||
|
||||
# show the VLC_INCLUDE_DIR and VLC_LIBRARIES variables only in the advanced view
|
||||
mark_as_advanced(VLC_INCLUDE_DIR VLC_LIBRARIES)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(VLC DEFAULT_MSG VLC_INCLUDE_DIR VLC_LIBRARIES)
|
||||
|
||||
# show the VLC_INCLUDE_DIR and VLC_LIBRARIES variables only in the advanced view
|
||||
mark_as_advanced(VLC_INCLUDE_DIR VLC_LIBRARIES)
|
||||
endif (WIN32)
|
||||
|
|
|
@ -62,12 +62,18 @@ if(NOT WIN32)
|
|||
find_package(CURL REQUIRED)
|
||||
find_package(FreeImage REQUIRED)
|
||||
find_package(Freetype REQUIRED)
|
||||
find_package(Pugixml REQUIRED)
|
||||
find_package(RapidJSON REQUIRED)
|
||||
find_package(SDL2 REQUIRED)
|
||||
find_package(VLC REQUIRED)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
# For some strange reason, macOS complains about an uppercase 'P' in Pugixml.
|
||||
find_package(pugixml REQUIRED)
|
||||
elseif(UNIX)
|
||||
find_package(Pugixml REQUIRED)
|
||||
endif()
|
||||
|
||||
# Add libCEC support.
|
||||
if(CEC)
|
||||
find_package(libCEC REQUIRED)
|
||||
|
@ -96,8 +102,8 @@ endif()
|
|||
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
message("-- Compiler is Clang/LLVM")
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CLANG_VERSION)
|
||||
if(CLANG_VERSION VERSION_LESS 6.0.0)
|
||||
message(SEND_ERROR "You need at least Clang 6.0.0 to compile EmulationStation-DE!")
|
||||
if(CLANG_VERSION VERSION_LESS 4.2.1)
|
||||
message(SEND_ERROR "You need at least Clang 4.2.1 to compile EmulationStation-DE!")
|
||||
endif()
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
message("-- Compiler is GNU/GCC")
|
||||
|
@ -118,30 +124,39 @@ if(CMAKE_BUILD_TYPE MATCHES Debug)
|
|||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O0")
|
||||
|
||||
# If using Clang, then add additional debug data needed by GDB.
|
||||
# Comment this out if you're using LLDB for debugging as this flag makes
|
||||
# the binary much larger and the application much slower.
|
||||
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
# Comment this out if you're using LLDB for debugging as this flag makes the binary
|
||||
# much larger and the application much slower. On macoOS this setting is never enabled
|
||||
# as LLDB is the default debugger on this OS.
|
||||
if(NOT APPLE AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_DEBUG")
|
||||
endif()
|
||||
else()
|
||||
# Enable the C++11 standard and enable optimizations as it's a release build.
|
||||
# Also disable the assert() macros and strip the binary.
|
||||
# This will also disable all assert() macros. Strip the binary as well.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2 -DNDEBUG")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O2 -s")
|
||||
endif()
|
||||
|
||||
# This removes half of the ranlib warnings on macOS regarding no symbols for files that
|
||||
# are #ifdef'ed away. There must be a way to remove the other half as well?
|
||||
if(APPLE)
|
||||
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||
SET(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||
endif()
|
||||
|
||||
if(${GLSystem} MATCHES "Desktop OpenGL")
|
||||
add_definitions(-DUSE_OPENGL_21)
|
||||
else()
|
||||
add_definitions(-DUSE_OPENGLES_10)
|
||||
endif()
|
||||
|
||||
# For Unix systems, assign the installation prefix to local $ES_INSTALL_PREFIX variable.
|
||||
if(NOT WIN32)
|
||||
# For Unix systems (except for macOS), assign the installation prefix to the local
|
||||
# $ES_INSTALL_PREFIX variable.
|
||||
if(NOT WIN32 AND NOT APPLE)
|
||||
add_definitions(-DES_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
|
||||
# Handle additional (required) include files for dependency packages.
|
||||
# Handle additional (required) include files for dependency packages on Windows.
|
||||
if(WIN32)
|
||||
set(WIN32_INCLUDE_DIR "NOT_DEFINED" CACHE FILEPATH "")
|
||||
if(NOT EXISTS ${WIN32_INCLUDE_DIR})
|
||||
|
@ -163,6 +178,12 @@ set(COMMON_INCLUDE_DIRS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/external
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/es-core/src)
|
||||
|
||||
# Temporary solution until the VLC find module has been updated to work properly on macOS.
|
||||
if(APPLE)
|
||||
set(COMMON_INCLUDE_DIRS ${COMMON_INCLUDE_DIRS}
|
||||
"/Applications/VLC.app/Contents/MacOS/include")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(COMMON_INCLUDE_DIRS ${COMMON_INCLUDE_DIRS} ${WIN32_INCLUDE_DIR})
|
||||
endif()
|
||||
|
@ -226,6 +247,12 @@ elseif(WIN32)
|
|||
"nanosvg")
|
||||
endif()
|
||||
|
||||
# Temporary solution until the VLC find module has been updated to work properly on macOS.
|
||||
if (APPLE)
|
||||
set(COMMON_LIBRARIES ${COMMON_LIBRARIES}
|
||||
"/Applications/VLC.app/Contents/MacOS/lib/libvlc.dylib")
|
||||
endif()
|
||||
|
||||
# Add libCEC libraries.
|
||||
if(DEFINED libCEC_FOUND)
|
||||
if(DEFINED BCMHOST)
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
#ifndef ES_APP_FILE_FILTER_INDEX_H
|
||||
#define ES_APP_FILE_FILTER_INDEX_H
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <sstream>
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
#ifndef ES_APP_META_DATA_H
|
||||
#define ES_APP_META_DATA_H
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <sstream>
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ bool SystemData::copyConfigTemplate(const std::string& path)
|
|||
#if defined (_WIN64)
|
||||
systemsTemplateFile = ResourceManager::getInstance()->
|
||||
getResourcePath(":/templates/es_systems.cfg_windows");
|
||||
#elif defined(__unix__)
|
||||
#elif defined(__unix__) || defined (__APPLE__)
|
||||
systemsTemplateFile = ResourceManager::getInstance()->
|
||||
getResourcePath(":/templates/es_systems.cfg_unix");
|
||||
#endif
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
#include "math/Misc.h"
|
||||
#include "Log.h"
|
||||
|
||||
#ifdef _RPI_
|
||||
#if defined(_RPI_)
|
||||
#include "Settings.h"
|
||||
#endif
|
||||
|
||||
#ifdef _WIN64
|
||||
#if defined(_WIN64)
|
||||
#include <mmdeviceapi.h>
|
||||
#endif
|
||||
|
||||
|
@ -40,8 +40,8 @@ std::weak_ptr<VolumeControl> VolumeControl::sInstance;
|
|||
VolumeControl::VolumeControl()
|
||||
: originalVolume(0),
|
||||
internalVolume(0)
|
||||
#if defined (__APPLE__)
|
||||
#error TODO: Not implemented for MacOS yet!!!
|
||||
#if defined(__APPLE__)
|
||||
// #error TODO: Not implemented for MacOS yet!!!
|
||||
#elif defined(__linux__)
|
||||
, mixerIndex(0),
|
||||
mixerHandle(nullptr),
|
||||
|
@ -62,8 +62,8 @@ VolumeControl::VolumeControl(
|
|||
const VolumeControl & right):
|
||||
originalVolume(0),
|
||||
internalVolume(0)
|
||||
#if defined (__APPLE__)
|
||||
#error TODO: Not implemented for MacOS yet!!!
|
||||
#if defined(__APPLE__)
|
||||
// #error TODO: Not implemented for MacOS yet!!!
|
||||
#elif defined(__linux__)
|
||||
, mixerIndex(0),
|
||||
mixerHandle(nullptr),
|
||||
|
@ -108,8 +108,8 @@ std::shared_ptr<VolumeControl> & VolumeControl::getInstance()
|
|||
void VolumeControl::init()
|
||||
{
|
||||
// Initialize audio mixer interface.
|
||||
#if defined (__APPLE__)
|
||||
#error TODO: Not implemented for MacOS yet!!!
|
||||
#if defined(__APPLE__)
|
||||
// #error TODO: Not implemented for MacOS yet!!!
|
||||
#elif defined(__linux__)
|
||||
// Try to open mixer device.
|
||||
if (mixerHandle == nullptr) {
|
||||
|
@ -248,8 +248,8 @@ void VolumeControl::init()
|
|||
void VolumeControl::deinit()
|
||||
{
|
||||
// Deinitialize audio mixer interface.
|
||||
#if defined (__APPLE__)
|
||||
#error TODO: Not implemented for MacOS yet!!!
|
||||
#if defined(__APPLE__)
|
||||
// #error TODO: Not implemented for MacOS yet!!!
|
||||
#elif defined(__linux__)
|
||||
if (mixerHandle != nullptr) {
|
||||
snd_mixer_detach(mixerHandle, mixerCard);
|
||||
|
@ -275,8 +275,8 @@ int VolumeControl::getVolume() const
|
|||
{
|
||||
int volume = 0;
|
||||
|
||||
#if defined (__APPLE__)
|
||||
#error TODO: Not implemented for MacOS yet!!!
|
||||
#if defined(__APPLE__)
|
||||
// #error TODO: Not implemented for MacOS yet!!!
|
||||
#elif defined(__linux__)
|
||||
if (mixerElem != nullptr) {
|
||||
// Get volume range.
|
||||
|
@ -352,8 +352,8 @@ void VolumeControl::setVolume(int volume)
|
|||
|
||||
// Store values in internal variables.
|
||||
internalVolume = volume;
|
||||
#if defined (__APPLE__)
|
||||
#error TODO: Not implemented for MacOS yet!!!
|
||||
#if defined(__APPLE__)
|
||||
// #error TODO: Not implemented for MacOS yet!!!
|
||||
#elif defined(__linux__)
|
||||
if (mixerElem != nullptr) {
|
||||
// Get volume range.
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#if defined (__APPLE__)
|
||||
#error TODO: Not implemented for MacOS yet!!!
|
||||
#if defined(__APPLE__)
|
||||
//#error TODO: Not implemented for MacOS yet!!!
|
||||
#elif defined(__linux__)
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -25,8 +25,8 @@
|
|||
// Singleton pattern. Call getInstance() to get an object.
|
||||
class VolumeControl
|
||||
{
|
||||
#if defined (__APPLE__)
|
||||
#error TODO: Not implemented for MacOS yet!!!
|
||||
#if defined(__APPLE__)
|
||||
// #error TODO: Not implemented for MacOS yet!!!
|
||||
#elif defined(__linux__)
|
||||
static const char * mixerName;
|
||||
static const char * mixerCard;
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "SystemData.h"
|
||||
#include "SystemScreenSaver.h"
|
||||
|
||||
#ifdef _WIN64
|
||||
#if defined(_WIN64)
|
||||
#include <cstring>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
@ -597,7 +597,7 @@ int main(int argc, char* argv[])
|
|||
// Check if the media directory exists, and if not, log a warning.
|
||||
if (!Utils::FileSystem::isDirectory(FileData::getMediaDirectory()) ||
|
||||
Utils::FileSystem::isSymlink(FileData::getMediaDirectory())) {
|
||||
LOG(LogWarning) << "Games media directory does not exist "
|
||||
LOG(LogWarning) << "Game media directory does not exist "
|
||||
"(or is not a directory or a symlink):";
|
||||
LOG(LogWarning) << FileData::getMediaDirectory();
|
||||
}
|
||||
|
|
|
@ -248,11 +248,11 @@ void SystemView::onCursorChanged(const CursorState& /*state*/)
|
|||
// It's one of these...
|
||||
|
||||
float endPos = target; // Directly.
|
||||
float dist = abs(endPos - startPos);
|
||||
float dist = fabs(endPos - startPos);
|
||||
|
||||
if (abs(target + posMax - startPos - mScrollVelocity) < dist)
|
||||
if (fabs(target + posMax - startPos - mScrollVelocity) < dist)
|
||||
endPos = target + posMax; // Loop around the end (0 -> max).
|
||||
if (abs(target - posMax - startPos - mScrollVelocity) < dist)
|
||||
if (fabs(target - posMax - startPos - mScrollVelocity) < dist)
|
||||
endPos = target - posMax; // Loop around the start (max - 1 -> -1).
|
||||
|
||||
// Animate mSystemInfo's opacity (fade out, wait, fade back in).
|
||||
|
@ -541,11 +541,11 @@ void SystemView::renderCarousel(const Transform4x4f& trans)
|
|||
|
||||
float distance = i - mCamOffset;
|
||||
|
||||
float scale = 1.0f + ((mCarousel.logoScale - 1.0f) * (1.0f - abs(distance)));
|
||||
float scale = 1.0f + ((mCarousel.logoScale - 1.0f) * (1.0f - fabs(distance)));
|
||||
scale = Math::min(mCarousel.logoScale, Math::max(1.0f, scale));
|
||||
scale /= mCarousel.logoScale;
|
||||
|
||||
int opacity = (int)Math::round(0x80 + ((0xFF - 0x80) * (1.0f - abs(distance))));
|
||||
int opacity = (int)Math::round(0x80 + ((0xFF - 0x80) * (1.0f - fabs(distance))));
|
||||
opacity = Math::max((int) 0x80, opacity);
|
||||
|
||||
const std::shared_ptr<GuiComponent> &comp = mEntries.at(index).data.logo;
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
#include "AudioManager.h"
|
||||
#include "Settings.h"
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <sstream>
|
||||
#endif
|
||||
|
||||
bool PowerSaver::mState = false;
|
||||
bool PowerSaver::mRunningScreenSaver = false;
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ void Settings::setDefaults()
|
|||
#else
|
||||
mIntMap["MaxVRAM"] = 128;
|
||||
#endif
|
||||
#ifdef __unix__
|
||||
#if defined (__unix__) || defined (__APPLE__)
|
||||
mStringMap["FullscreenMode"] = "normal";
|
||||
#endif
|
||||
mStringMap["PowerSaverMode"] = "disabled";
|
||||
|
|
|
@ -9,12 +9,16 @@
|
|||
#ifndef ES_CORE_SOUND_H
|
||||
#define ES_CORE_SOUND_H
|
||||
|
||||
#if defined(__linux__) || defined (_WIN64)
|
||||
#if defined(__linux__) || defined(_WIN64)
|
||||
#include <SDL2/SDL_audio.h>
|
||||
#else
|
||||
#include "SDL_audio.h"
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <sstream>
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
|
|
@ -329,15 +329,15 @@ void ImageComponent::updateVertices()
|
|||
|
||||
void ImageComponent::updateColors()
|
||||
{
|
||||
const float opacity = (mOpacity * (mFading ? mFadeOpacity / 255.0 : 1.0)) / 255.0;
|
||||
const unsigned int color = Renderer::convertColor(mColorShift & 0xFFFFFF00 |
|
||||
(unsigned char)((mColorShift & 0xFF) * opacity));
|
||||
const unsigned int colorEnd = Renderer::convertColor(mColorShiftEnd & 0xFFFFFF00 |
|
||||
const float opacity = (mOpacity * (mFading ? mFadeOpacity / 255.0 : 1.0)) / 255.0;
|
||||
const unsigned int color = Renderer::convertColor((mColorShift & 0xFFFFFF00) |
|
||||
(unsigned char)((mColorShift & 0xFF) * opacity));
|
||||
const unsigned int colorEnd = Renderer::convertColor((mColorShiftEnd & 0xFFFFFF00) |
|
||||
(unsigned char)((mColorShiftEnd & 0xFF) * opacity));
|
||||
|
||||
mVertices[0].col = color;
|
||||
mVertices[1].col = mColorGradientHorizontal ? colorEnd : color;
|
||||
mVertices[2].col = mColorGradientHorizontal ? color : colorEnd;
|
||||
mVertices[2].col = mColorGradientHorizontal ? color : colorEnd;
|
||||
mVertices[3].col = colorEnd;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
namespace Renderer
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
#ifndef NDEBUG
|
||||
#define GL_CHECK_ERROR(Function) (Function, _GLCheckError(#Function))
|
||||
|
||||
static void _GLCheckError(const char* _funcName)
|
||||
|
@ -30,7 +30,7 @@ namespace Renderer
|
|||
|
||||
if (errorCode != GL_NO_ERROR) {
|
||||
LOG(LogError) << "OpenGL error: " << _funcName <<
|
||||
" failed with error code: " << errorCode;
|
||||
" failed with error code: 0x" << std::hex << errorCode;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
namespace Renderer
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
#ifndef NDEBUG
|
||||
#define GL_CHECK_ERROR(Function) (Function, _GLCheckError(#Function))
|
||||
|
||||
static void _GLCheckError(const char* _funcName)
|
||||
|
@ -30,7 +30,7 @@ namespace Renderer
|
|||
|
||||
if (errorCode != GL_NO_ERROR) {
|
||||
LOG(LogError) << "OpenGLES error: " << _funcName <<
|
||||
" failed with error code: " << errorCode;
|
||||
" failed with error code: 0x" << std::hex << errorCode;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#define _DARWIN_USE_64_BIT_INODE
|
||||
#endif
|
||||
|
||||
#include "utils/FileSystemUtil.h"
|
||||
|
||||
#include "utils/StringUtil.h"
|
||||
|
@ -134,7 +138,7 @@ namespace Utils
|
|||
#if defined(_WIN64)
|
||||
// On Windows we need to check HOMEDRIVE and HOMEPATH.
|
||||
if (!homePath.length()) {
|
||||
#ifdef _WIN64
|
||||
#if defined(_WIN64)
|
||||
std::string envHomeDrive =
|
||||
Utils::String::wideStringToString(_wgetenv(L"HOMEDRIVE"));
|
||||
std::string envHomePath =
|
||||
|
@ -167,7 +171,7 @@ namespace Utils
|
|||
char temp[512];
|
||||
|
||||
// Return current working directory.
|
||||
#ifdef _WIN64
|
||||
#if defined(_WIN64)
|
||||
wchar_t tempWide[512];
|
||||
return (_wgetcwd(tempWide, 512) ?
|
||||
getGenericPath(Utils::String::wideStringToString(tempWide)) : "");
|
||||
|
@ -178,7 +182,7 @@ namespace Utils
|
|||
|
||||
std::string getPathToBinary(const std::string& executable)
|
||||
{
|
||||
#ifdef _WIN64
|
||||
#if defined(_WIN64)
|
||||
return "";
|
||||
#else
|
||||
std::string pathVariable = std::string(getenv("PATH"));
|
||||
|
@ -230,7 +234,7 @@ namespace Utils
|
|||
// Just in case some build environments won't handle this correctly.
|
||||
// For Windows it doesn't really work like that and the application could have
|
||||
// been install to an arbitrary location, so this function won't be used on that OS.
|
||||
#ifdef __unix__
|
||||
#if defined(__unix__)
|
||||
if (!installPrefix.length())
|
||||
installPrefix = "/usr/local";
|
||||
return installPrefix + "/share/emulationstation";
|
||||
|
@ -564,7 +568,7 @@ namespace Utils
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
#if defined(_WIN64)
|
||||
std::ifstream sourceFile(Utils::String::stringToWideString(_source_path).c_str(),
|
||||
std::ios::binary);
|
||||
#else
|
||||
|
@ -578,7 +582,7 @@ namespace Utils
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
#if defined(_WIN64)
|
||||
std::ofstream targetFile(Utils::String::stringToWideString(_destination_path).c_str(),
|
||||
std::ios::binary);
|
||||
#else
|
||||
|
@ -622,7 +626,7 @@ namespace Utils
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
#if defined(_WIN64)
|
||||
_wrename(Utils::String::stringToWideString(_source_path).c_str(),
|
||||
Utils::String::stringToWideString(_destination_path).c_str());
|
||||
#else
|
||||
|
@ -641,7 +645,7 @@ namespace Utils
|
|||
return true;
|
||||
|
||||
// Try to remove file.
|
||||
#ifdef _WIN64
|
||||
#if defined(_WIN64)
|
||||
if (_wunlink(Utils::String::stringToWideString(path).c_str()) != 0) {
|
||||
LOG(LogError) << "Couldn't delete file, permission problems?";
|
||||
LOG(LogError) << path;
|
||||
|
@ -688,7 +692,7 @@ namespace Utils
|
|||
createDirectory(parent);
|
||||
|
||||
// Try to create directory again now that the parent should exist.
|
||||
#ifdef _WIN64
|
||||
#if defined(_WIN64)
|
||||
return (_wmkdir(Utils::String::stringToWideString(path).c_str()) == 0);
|
||||
#else
|
||||
return (mkdir(path.c_str(), 0755) == 0);
|
||||
|
@ -699,7 +703,10 @@ namespace Utils
|
|||
{
|
||||
std::string path = getGenericPath(_path);
|
||||
|
||||
#ifdef _WIN64
|
||||
#if defined(__APPLE__)
|
||||
struct stat info;
|
||||
return (stat(path.c_str(), &info) == 0);
|
||||
#elif defined(_WIN64)
|
||||
struct _stat64 info;
|
||||
return (_wstat64(Utils::String::stringToWideString(path).c_str(), &info) == 0);
|
||||
#else
|
||||
|
@ -710,7 +717,7 @@ namespace Utils
|
|||
|
||||
bool driveExists(const std::string& _path)
|
||||
{
|
||||
#ifdef _WIN64
|
||||
#if defined(_WIN64)
|
||||
std::string path = getGenericPath(_path);
|
||||
// Try to add a dot or a backslash and a dot depending on how the drive
|
||||
// letter was defined by the user.
|
||||
|
@ -741,12 +748,16 @@ namespace Utils
|
|||
bool isRegularFile(const std::string& _path)
|
||||
{
|
||||
std::string path = getGenericPath(_path);
|
||||
struct stat64 info;
|
||||
|
||||
#ifdef _WIN64
|
||||
#if defined(__APPLE__)
|
||||
struct stat info;
|
||||
return (stat(path.c_str(), &info) == 0);
|
||||
#elif defined(_WIN64)
|
||||
struct stat64 info;
|
||||
if (_wstat64(Utils::String::stringToWideString(path).c_str(), &info) != 0)
|
||||
return false;
|
||||
#else
|
||||
struct stat64 info;
|
||||
if (stat64(path.c_str(), &info) != 0)
|
||||
return false;
|
||||
#endif
|
||||
|
@ -758,13 +769,17 @@ namespace Utils
|
|||
bool isDirectory(const std::string& _path)
|
||||
{
|
||||
std::string path = getGenericPath(_path);
|
||||
struct stat64 info;
|
||||
|
||||
#ifdef _WIN64
|
||||
#if defined(__APPLE__)
|
||||
struct stat info;
|
||||
return (stat(path.c_str(), &info) == 0);
|
||||
#elif defined(_WIN64)
|
||||
struct stat64 info;
|
||||
if (_wstat64(Utils::String::stringToWideString(path).c_str(), &info) != 0)
|
||||
return false;
|
||||
#else
|
||||
if (stat64(path.c_str(), &info) != 0)
|
||||
struct stat64 info;
|
||||
if (stat64(path.c_str(), &info) != 0)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
|
@ -784,10 +799,18 @@ namespace Utils
|
|||
(Attributes & FILE_ATTRIBUTE_REPARSE_POINT))
|
||||
return true;
|
||||
#else
|
||||
|
||||
#if defined(__APPLE__)
|
||||
struct stat info;
|
||||
|
||||
if (lstat(path.c_str(), &info) != 0)
|
||||
return false;
|
||||
#else
|
||||
struct stat64 info;
|
||||
|
||||
if (lstat64(path.c_str(), &info) != 0)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// Check for S_IFLNK attribute.
|
||||
return (S_ISLNK(info.st_mode));
|
||||
|
|
|
@ -24,15 +24,13 @@ namespace Utils
|
|||
// 0xxxxxxx, one byte character.
|
||||
if ((c & 0x80) == 0) {
|
||||
// 0xxxxxxx
|
||||
result = ((_string[_cursor++] ) );
|
||||
result = ((_string[_cursor++]));
|
||||
}
|
||||
// 110xxxxx, two byte character.
|
||||
else if ((c & 0xE0) == 0xC0) {
|
||||
// 110xxxxx 10xxxxxx
|
||||
result = (_string[_cursor++] & 0x1F) << 6;
|
||||
result |= _string[_cursor++] & 0x3F;
|
||||
// result = ((_string[_cursor++] & 0x1F) << 6) |
|
||||
// ((_string[_cursor++] & 0x3F) );
|
||||
}
|
||||
// 1110xxxx, three byte character.
|
||||
else if ((c & 0xF0) == 0xE0) {
|
||||
|
@ -40,9 +38,6 @@ namespace Utils
|
|||
result = (_string[_cursor++] & 0x0F) << 12;
|
||||
result |= (_string[_cursor++] & 0x3F) << 6;
|
||||
result |= _string[_cursor++] & 0x3F;
|
||||
// result = ((_string[_cursor++] & 0x0F) << 12) |
|
||||
// ((_string[_cursor++] & 0x3F) << 6) |
|
||||
// ((_string[_cursor++] & 0x3F) );
|
||||
}
|
||||
// 11110xxx, four byte character.
|
||||
else if ((c & 0xF8) == 0xF0) {
|
||||
|
@ -51,10 +46,6 @@ namespace Utils
|
|||
result |= (_string[_cursor++] & 0x3F) << 12;
|
||||
result |= (_string[_cursor++] & 0x3F) << 6;
|
||||
result |= _string[_cursor++] & 0x3F;
|
||||
// result = ((_string[_cursor++] & 0x07) << 18) |
|
||||
// ((_string[_cursor++] & 0x3F) << 12) |
|
||||
// ((_string[_cursor++] & 0x3F) << 6) |
|
||||
// ((_string[_cursor++] & 0x3F) );
|
||||
}
|
||||
else {
|
||||
// Error, invalid unicode.
|
||||
|
|
Loading…
Reference in a new issue