Initial fixes to build on macOS.

This commit is contained in:
Ryan McGrath 2020-07-06 03:37:02 -07:00 committed by R2DLiu
commit ad66aedd04
4 changed files with 11 additions and 6 deletions

View file

@ -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<size_t>(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

View file

@ -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);

View file

@ -1,3 +1,5 @@
#include <memory>
#include "SlippiPad.h"
// TODO: Confirm the default and padding values are right

View file

@ -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