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:
@@ -3,13 +3,13 @@
|
||||
#include "Runtime/IMain.hpp"
|
||||
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)
|
||||
return {};
|
||||
|
||||
kabufuda::SystemString path = home;
|
||||
std::string path = home;
|
||||
path += fmt::format(FMT_STRING("/Library/Application Support/Dolphin/GC/MemoryCard{:c}.USA.raw"),
|
||||
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||
|
||||
@@ -22,14 +22,14 @@ 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");
|
||||
if (!home)
|
||||
return {};
|
||||
|
||||
kabufuda::SystemString path = home;
|
||||
std::string path = home;
|
||||
path += "/Library/Application Support/Dolphin/GC";
|
||||
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
||||
return {};
|
||||
@@ -42,12 +42,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