Merge branch 'dawn' of ssh+git://git.axiodl.com:6431/AxioDL/metaforce into dawn

This commit is contained in:
Phillip Stephens 2022-02-24 21:44:15 -08:00
commit 3ab7fdd723
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
3 changed files with 12 additions and 6 deletions

View File

@ -4,6 +4,7 @@
#include <cstdint>
#include <cstdlib>
#include <algorithm>
#include <string>
#ifndef _WIN32
#include <sys/stat.h>
#else

View File

@ -24,8 +24,8 @@ add_subdirectory(Particle)
if (WIN32)
list(APPEND PLAT_SRCS CMemoryCardSysWin.cpp)
elseif (APPLE)
list(APPEND PLAT_SRCS CMemoryCardSysOSX.cpp)
#elseif (APPLE)
#list(APPEND PLAT_SRCS CMemoryCardSysOSX.cpp)
else ()
list(APPEND PLAT_SRCS CMemoryCardSysNix.cpp)
endif ()

View File

@ -1,7 +1,7 @@
#include "CMemoryCardSys.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/IMain.hpp"
#include <Runtime/CBasics.hpp>
#include <SDL_filesystem.h>
namespace metaforce {
@ -25,8 +25,8 @@ std::string CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) {
auto path = *dolphinPath;
path += fmt::format(FMT_STRING("GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
struct stat64 theStat {};
if (stat64(path.c_str(), &theStat) != 0 || !S_ISREG(theStat.st_mode)) {
CBasics::Sstat theStat{};
if (CBasics::Stat(path.c_str(), &theStat) != 0 || !S_ISREG(theStat.st_mode)) {
/* legacy case for older dolphin versions */
const char* home = getenv("HOME");
if (home == nullptr || home[0] != '/') {
@ -34,9 +34,14 @@ std::string CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) {
}
path = home;
#ifndef __APPLE__
path += fmt::format(FMT_STRING("/.dolphin-emu/GC/MemoryCard{:c}.USA.raw"),
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
if (stat64(path.c_str(), &theStat) != 0 || !S_ISREG(theStat.st_mode)) {
#else
path += fmt::format(FMT_STRING("/Library/Application Support/Dolphin/GC/MemoryCard{:c}.USA.raw"),
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
#endif
if (CBasics::Stat(path.c_str(), &theStat) != 0 || !S_ISREG(theStat.st_mode)) {
return {};
}
}