mirror of
https://github.com/ARMSX2/ARMSX2.git
synced 2026-08-24 16:50:16 -07:00
iOS: port JIT and W^X foundation, refresh SwiftUI frontend, fix critical boot and display bugs
Port the complete JIT and write-xor-execute infrastructure to DarwinMisc with four JitModes (Simulator, Legacy, LuckTXM, LuckNoTXM), dual-mapping via vm_remap for writable code aliases, the csops CS_DEBUGGED probe for JIT availability detection, brk assembly helpers for the TXM protocol, and the W^X toggle functions. Connect the JIT foundation to the code emitters through AsmHelpers dual-map bridge, Memory.cpp MmapCodeDualMap allocation, and the aR5900 LegacyEnsureExecutable path. Refresh the iOS SwiftUI frontend from the iOS-refresh branch, bringing in 11 missing and 20 drifted Swift files plus ios_main.mm integration. Switch the CI to a real device build using the iphoneos SDK. Fix the Achievements crash by gracefully degrading when no HTTPDownloader is available (no CURL on iOS). Fix the Metal surface to reuse the UIView's existing CAMetalLayer instead of an orphaned allocation that caused half-screen crops. Fix GS memory allocation by using mmap and vm_remap instead of shm_open which is blocked by the iOS sandbox. Suppress the false positive Graphics not Automatic OSD warning. Merge upstream master and resolve all resulting compile errors.
This commit is contained in:
@@ -999,6 +999,26 @@ std::FILE* FileSystem::OpenCFile(const char* filename, const char* mode, Error*
|
||||
|
||||
return fp;
|
||||
#else
|
||||
#if defined(__ANDROID__)
|
||||
if (std::strncmp(filename, "content://", 10) == 0)
|
||||
{
|
||||
const int fd = OpenFDFileContent(filename);
|
||||
if (fd < 0)
|
||||
{
|
||||
Error::SetString(error, "Unable to open Android content URI.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::FILE* fp = fdopen(fd, mode);
|
||||
if (!fp)
|
||||
{
|
||||
Error::SetErrno(error, errno);
|
||||
close(fd);
|
||||
}
|
||||
return fp;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::FILE* fp = std::fopen(filename, mode);
|
||||
if (!fp)
|
||||
Error::SetErrno(error, errno);
|
||||
@@ -1046,6 +1066,16 @@ int FileSystem::OpenFDFile(const char* filename, int flags, int mode, Error* err
|
||||
|
||||
return -1;
|
||||
#else
|
||||
#if defined(__ANDROID__)
|
||||
if (std::strncmp(filename, "content://", 10) == 0 && (flags & O_ACCMODE) == O_RDONLY)
|
||||
{
|
||||
const int fd = OpenFDFileContent(filename);
|
||||
if (fd < 0)
|
||||
Error::SetString(error, "Unable to open Android content URI.");
|
||||
return fd;
|
||||
}
|
||||
#endif
|
||||
|
||||
const int fd = open(filename, flags, mode);
|
||||
if (fd < 0)
|
||||
Error::SetErrno(error, errno);
|
||||
@@ -1096,6 +1126,27 @@ std::FILE* FileSystem::OpenSharedCFile(const char* filename, const char* mode, F
|
||||
Error::SetErrno(error, errno);
|
||||
return nullptr;
|
||||
#else
|
||||
#if defined(__ANDROID__)
|
||||
// content:// URIs (Storage Access Framework) must route through the JNI
|
||||
// ContentResolver bridge — std::fopen can't open them. ChdFileReader opens
|
||||
// the disc through this shared variant, so without this bridge every .chd on
|
||||
// external/SD storage failed VM init ("Failed to open CDVD ... errno 2") and
|
||||
// bounced back to the library, while .iso (which uses OpenCFile) worked.
|
||||
// Mirrors the identical bridge in OpenCFile / OpenFDFile / FileExists.
|
||||
if (std::strncmp(filename, "content://", 10) == 0)
|
||||
{
|
||||
const int fd = OpenFDFileContent(filename);
|
||||
if (fd < 0)
|
||||
{
|
||||
Error::SetString(error, "Unable to open Android content URI.");
|
||||
return nullptr;
|
||||
}
|
||||
std::FILE* fp = fdopen(fd, mode);
|
||||
if (!fp)
|
||||
Error::SetErrno(error, errno);
|
||||
return fp;
|
||||
}
|
||||
#endif
|
||||
std::FILE* fp = std::fopen(filename, mode);
|
||||
if (!fp)
|
||||
Error::SetErrno(error, errno);
|
||||
@@ -2371,6 +2422,18 @@ bool FileSystem::FileExists(const char* path)
|
||||
if (path[0] == '\0')
|
||||
return false;
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
if (std::strncmp(path, "content://", 10) == 0)
|
||||
{
|
||||
const int fd = OpenFDFileContent(path);
|
||||
if (fd < 0)
|
||||
return false;
|
||||
|
||||
close(fd);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// stat file
|
||||
struct stat sysStatData;
|
||||
if (stat(path, &sysStatData) < 0)
|
||||
|
||||
Reference in New Issue
Block a user