mirror of https://github.com/mgba-emu/mgba.git
Core: Fix portable mode on macOS
This commit is contained in:
parent
588186531c
commit
d85589b837
1
CHANGES
1
CHANGES
|
@ -15,6 +15,7 @@ Other fixes:
|
||||||
- ARM Debugger: Fix disassembly alignment (fixes mgba.io/i/2204)
|
- ARM Debugger: Fix disassembly alignment (fixes mgba.io/i/2204)
|
||||||
- Core: Fix memory leak in opening games from the library
|
- Core: Fix memory leak in opening games from the library
|
||||||
- Core: Fix memory searches for relative values (fixes mgba.io/i/2135)
|
- Core: Fix memory searches for relative values (fixes mgba.io/i/2135)
|
||||||
|
- Core: Fix portable mode on macOS
|
||||||
- GB Core: Fix GBC colors setting breaking default model overrides (fixes mgba.io/i/2161)
|
- GB Core: Fix GBC colors setting breaking default model overrides (fixes mgba.io/i/2161)
|
||||||
- GBA: Fix out of bounds ROM accesses on patched ROMs smaller than 32 MiB
|
- GBA: Fix out of bounds ROM accesses on patched ROMs smaller than 32 MiB
|
||||||
- Qt: Fix infrequent deadlock when using sync to video
|
- Qt: Fix infrequent deadlock when using sync to video
|
||||||
|
|
|
@ -228,6 +228,7 @@ endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
add_definitions(-D_DARWIN_C_SOURCE)
|
add_definitions(-D_DARWIN_C_SOURCE)
|
||||||
|
list(APPEND OS_LIB "-framework Foundation")
|
||||||
if(CMAKE_SYSTEM_VERSION VERSION_GREATER "10.5.8")
|
if(CMAKE_SYSTEM_VERSION VERSION_GREATER "10.5.8")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.6")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.6")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -19,6 +19,12 @@
|
||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <CoreFoundation/CFBundle.h>
|
||||||
|
#include <CoreFoundation/CFString.h>
|
||||||
|
#include <CoreFoundation/CFURL.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PSP2
|
#ifdef PSP2
|
||||||
#include <psp2/io/stat.h>
|
#include <psp2/io/stat.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -274,6 +280,16 @@ void mCoreConfigPortablePath(char* out, size_t outLength) {
|
||||||
out[0] = '\0';
|
out[0] = '\0';
|
||||||
#else
|
#else
|
||||||
getcwd(out, outLength);
|
getcwd(out, outLength);
|
||||||
|
#ifdef __APPLE__
|
||||||
|
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||||
|
if (strcmp(out, "/") == 0 && mainBundle) {
|
||||||
|
CFURLRef url = CFBundleCopyBundleURL(mainBundle);
|
||||||
|
CFURLRef suburl = CFURLCreateCopyDeletingLastPathComponent(kCFAllocatorDefault, url);
|
||||||
|
CFRelease(url);
|
||||||
|
CFURLGetFileSystemRepresentation(suburl, true, (UInt8*) out, outLength);
|
||||||
|
CFRelease(suburl);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
strncat(out, PATH_SEP "portable.ini", outLength - strlen(out));
|
strncat(out, PATH_SEP "portable.ini", outLength - strlen(out));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue