diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/common_funcs.h | 4 | ||||
-rw-r--r-- | src/common/memory_util.cpp | 8 | ||||
-rw-r--r-- | src/common/swap.h | 2 | ||||
-rw-r--r-- | src/core/file_sys/savedata_factory.cpp | 9 |
4 files changed, 16 insertions, 7 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 7cf7b7997..995938d0b 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -4,7 +4,7 @@ #pragma once -#if !defined(ARCHITECTURE_x86_64) && !defined(_M_ARM) +#if !defined(ARCHITECTURE_x86_64) && !defined(ARCHITECTURE_ARM) #include <cstdlib> // for exit #endif #include "common/common_types.h" @@ -30,7 +30,7 @@ #ifdef ARCHITECTURE_x86_64 #define Crash() __asm__ __volatile__("int $3") -#elif defined(_M_ARM) +#elif defined(ARCHITECTURE_ARM) #define Crash() __asm__ __volatile__("trap") #else #define Crash() exit(1) diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp index 5d89209ed..09462ccee 100644 --- a/src/common/memory_util.cpp +++ b/src/common/memory_util.cpp @@ -16,7 +16,7 @@ #include <sys/mman.h> #endif -#if !defined(_WIN32) && defined(ARCHITECTURE_X64) && !defined(MAP_32BIT) +#if !defined(_WIN32) && defined(ARCHITECTURE_x86_64) && !defined(MAP_32BIT) #include <unistd.h> #define PAGE_MASK (getpagesize() - 1) #define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK)) @@ -30,7 +30,7 @@ void* AllocateExecutableMemory(size_t size, bool low) { void* ptr = VirtualAlloc(nullptr, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); #else static char* map_hint = nullptr; -#if defined(ARCHITECTURE_X64) && !defined(MAP_32BIT) +#if defined(ARCHITECTURE_x86_64) && !defined(MAP_32BIT) // This OS has no flag to enforce allocation below the 4 GB boundary, // but if we hint that we want a low address it is very likely we will // get one. @@ -42,7 +42,7 @@ void* AllocateExecutableMemory(size_t size, bool low) { #endif void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE -#if defined(ARCHITECTURE_X64) && defined(MAP_32BIT) +#if defined(ARCHITECTURE_x86_64) && defined(MAP_32BIT) | (low ? MAP_32BIT : 0) #endif , @@ -57,7 +57,7 @@ void* AllocateExecutableMemory(size_t size, bool low) { #endif LOG_ERROR(Common_Memory, "Failed to allocate executable memory"); } -#if !defined(_WIN32) && defined(ARCHITECTURE_X64) && !defined(MAP_32BIT) +#if !defined(_WIN32) && defined(ARCHITECTURE_x86_64) && !defined(MAP_32BIT) else { if (low) { map_hint += size; diff --git a/src/common/swap.h b/src/common/swap.h index 4a4012d1a..f025f7450 100644 --- a/src/common/swap.h +++ b/src/common/swap.h @@ -69,7 +69,7 @@ inline u32 swap32(u32 _data) { inline u64 swap64(u64 _data) { return _byteswap_uint64(_data); } -#elif _M_ARM +#elif ARCHITECTURE_ARM inline u16 swap16(u16 _data) { u32 data = _data; __asm__("rev16 %0, %1\n" : "=l"(data) : "l"(data)); diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp index d78baf9c3..f3aa213af 100644 --- a/src/core/file_sys/savedata_factory.cpp +++ b/src/core/file_sys/savedata_factory.cpp @@ -17,6 +17,15 @@ SaveData_Factory::SaveData_Factory(std::string nand_directory) ResultVal<std::unique_ptr<FileSystemBackend>> SaveData_Factory::Open(const Path& path) { std::string save_directory = GetFullPath(); + + if (!FileUtil::Exists(save_directory)) { + // TODO(bunnei): This is a work-around to always create a save data directory if it does not + // already exist. This is a hack, as we do not understand yet how this works on hardware. + // Without a save data directory, many games will assert on boot. This should not have any + // bad side-effects. + FileUtil::CreateFullPath(save_directory); + } + // Return an error if the save data doesn't actually exist. if (!FileUtil::IsDirectory(save_directory)) { // TODO(Subv): Find out correct error code. |