mirror of https://github.com/AxioDL/metaforce.git
Merge CMemoryCardSysOSX and CMemoryCardSysNix
This commit is contained in:
parent
ad0affb11d
commit
b5a4bc0c93
|
@ -4,6 +4,7 @@
|
|||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#ifndef _WIN32
|
||||
#include <sys/stat.h>
|
||||
#else
|
||||
|
|
|
@ -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 ()
|
||||
|
|
|
@ -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 {};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue