From ad66aedd046e8a39eaf23027ca709630a4153880 Mon Sep 17 00:00:00 2001 From: Ryan McGrath Date: Mon, 6 Jul 2020 03:37:02 -0700 Subject: [PATCH] Initial fixes to build on macOS. --- Source/Core/Common/StringUtil.cpp | 6 +++--- Source/Core/Common/StringUtil.h | 2 +- Source/Core/Core/Slippi/SlippiPad.cpp | 2 ++ Source/Core/UICommon/UICommon.cpp | 7 +++++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp index 4cf5d1c052..4c256c01a6 100644 --- a/Source/Core/Common/StringUtil.cpp +++ b/Source/Core/Common/StringUtil.cpp @@ -671,9 +671,9 @@ std::string UTF16BEToUTF8(const char16_t* str, size_t max_size) return CodeToUTF8("UTF-16BE", std::u16string_view(str, static_cast(str_end - str))); } -std::u32string UTF8ToUTF32(const std::string_view input) +std::u32string UTF8ToUTF32(const std::string& input) { - auto val = CodeTo("UTF-32LE", "UTF-8", input); + auto val = CodeTo("UTF-32LE", "UTF-8", std::string_view(input)); auto utf32Data = (char32_t*)val.data(); return std::u32string(utf32Data, utf32Data + (val.size() / 4)); } @@ -682,7 +682,7 @@ std::string UTF32toUTF8(const std::u32string& input) { auto utf8Data = (char*)input.data(); auto str = std::string(utf8Data, utf8Data + (input.size() * 4)); - return CodeTo("UTF-8", "UTF-32LE", str); + return CodeTo("UTF-8", "UTF-32LE", std::string_view(str)); } #endif diff --git a/Source/Core/Common/StringUtil.h b/Source/Core/Common/StringUtil.h index 476744019b..0ea9aecc1f 100644 --- a/Source/Core/Common/StringUtil.h +++ b/Source/Core/Common/StringUtil.h @@ -171,7 +171,7 @@ void StringPopBackIf(std::string* s, char c); #ifdef _WIN32 std::u32string UTF8ToUTF32(const std::string& input); #else -std::u32string UTF8ToUTF32(const std::string_view input); +std::u32string UTF8ToUTF32(const std::string& input); #endif std::string UTF32toUTF8(const std::u32string& input); std::string ConvertStringForGame(const std::string& input, int length); diff --git a/Source/Core/Core/Slippi/SlippiPad.cpp b/Source/Core/Core/Slippi/SlippiPad.cpp index b81f0e3180..ea68b1cd8f 100644 --- a/Source/Core/Core/Slippi/SlippiPad.cpp +++ b/Source/Core/Core/Slippi/SlippiPad.cpp @@ -1,3 +1,5 @@ +#include + #include "SlippiPad.h" // TODO: Confirm the default and padding values are right diff --git a/Source/Core/UICommon/UICommon.cpp b/Source/Core/UICommon/UICommon.cpp index c7bbf98e22..3528288e28 100644 --- a/Source/Core/UICommon/UICommon.cpp +++ b/Source/Core/UICommon/UICommon.cpp @@ -298,14 +298,17 @@ void SetUserDirectory(const std::string& custom_path) std::string home_path = std::string(home) + DIR_SEP; #if defined(__APPLE__) || defined(ANDROID) - if (env_path) + // Mainline Dolphin switched to storing things elsewhere some time ago. + // To get it working for now, let's just use the Slippi route. + /*if (env_path) { user_path = env_path; } else { user_path = home_path + DOLPHIN_DATA_DIR DIR_SEP; - } + }*/ + user_path = File::GetBundleDirectory() + "/Contents/Resources/User" DIR_SEP; #else // We are on a non-Apple and non-Android POSIX system, there are 4 cases: // 1. GetExeDirectory()/portable.txt exists