Skip to content

Commit b07bd3b

Browse files
committed
[Mac OS X] Try to fix ISO Verification Failed crashes
1 parent 98906eb commit b07bd3b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

rpcs3/Loader/ISO.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ static void* get_aligned_buf()
3939
// IMPORTANT NOTE: It must be aligned (probably enough on multiple of 4) to support raw device, otherwise any read from file will fail
4040
#if defined(_WIN32)
4141
buf = _aligned_malloc(ISO_SECTOR_SIZE, ISO_SECTOR_SIZE * 2);
42+
#elif defined(__APPLE__)
43+
constexpr size_t NativeAlign = std::max(static_cast<size_t>(ISO_SECTOR_SIZE * 2), sizeof(void*));
44+
buf = std::aligned_alloc(NativeAlign, (ISO_SECTOR_SIZE + (NativeAlign - 1)) & ~(NativeAlign - 1));
4245
#else
4346
buf = std::aligned_alloc(ISO_SECTOR_SIZE * 2, ISO_SECTOR_SIZE);
4447
#endif

0 commit comments

Comments
 (0)