mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-11 15:01:49 +00:00
Use UTF-8 exclusively internally
This removes SystemString, SystemChar, etc. All filepaths and log strings are assumed to be UTF-8, with conversions to UTF-16 for Windows APIs as appropriate. Updates amuse, athena, boo, kabufua and nod
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace metaforce {
|
||||
|
||||
kabufuda::SystemString CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) {
|
||||
std::string CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) {
|
||||
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
|
||||
const char* home = getenv("HOME");
|
||||
if (!home || home[0] != '/')
|
||||
@@ -12,8 +12,8 @@ kabufuda::SystemString CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlo
|
||||
const char* dataHome = getenv("XDG_DATA_HOME");
|
||||
|
||||
/* XDG-selected data path */
|
||||
kabufuda::SystemString path =
|
||||
((dataHome && dataHome[0] == '/') ? dataHome : hecl::SystemString(home)) + "/.local/share/dolphin-emu";
|
||||
std::string path =
|
||||
((dataHome && dataHome[0] == '/') ? dataHome : std::string(home)) + "/.local/share/dolphin-emu";
|
||||
path += fmt::format(FMT_STRING("/GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||
|
||||
hecl::Sstat theStat;
|
||||
@@ -31,7 +31,7 @@ kabufuda::SystemString CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlo
|
||||
return {};
|
||||
}
|
||||
|
||||
kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot, bool dolphin) {
|
||||
std::string CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot, bool dolphin) {
|
||||
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
|
||||
if (dolphin) {
|
||||
const char* home = getenv("HOME");
|
||||
@@ -40,8 +40,8 @@ kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot sl
|
||||
const char* dataHome = getenv("XDG_DATA_HOME");
|
||||
|
||||
/* XDG-selected data path */
|
||||
kabufuda::SystemString path =
|
||||
((dataHome && dataHome[0] == '/') ? dataHome : hecl::SystemString(home)) + "/.local/share/dolphin-emu/GC";
|
||||
std::string path =
|
||||
((dataHome && dataHome[0] == '/') ? dataHome : std::string(home)) + "/.local/share/dolphin-emu/GC";
|
||||
|
||||
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
||||
return {};
|
||||
@@ -52,12 +52,12 @@ kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot sl
|
||||
return path;
|
||||
}
|
||||
} else {
|
||||
kabufuda::SystemString path = _GetDolphinCardPath(slot);
|
||||
std::string path = _GetDolphinCardPath(slot);
|
||||
hecl::SanitizePath(path);
|
||||
if (path.find('/') == kabufuda::SystemString::npos) {
|
||||
path = hecl::GetcwdStr() + _SYS_STR("/") + _GetDolphinCardPath(slot);
|
||||
if (path.find('/') == std::string::npos) {
|
||||
path = hecl::GetcwdStr() + "/" + _GetDolphinCardPath(slot);
|
||||
}
|
||||
hecl::SystemString tmpPath = path.substr(0, path.find_last_of(_SYS_STR("/")));
|
||||
std::string tmpPath = path.substr(0, path.find_last_of("/"));
|
||||
hecl::RecursiveMakeDir(tmpPath.c_str());
|
||||
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
|
||||
if (fp) {
|
||||
|
||||
Reference in New Issue
Block a user