summaryrefslogtreecommitdiff
path: root/view/sharedcache
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-04-16 16:34:01 -0400
committerMason Reed <mason@vector35.com>2025-04-28 20:43:54 -0400
commite3bbd4fb8d3eaff44a16f19e1840e2ecd20387de (patch)
tree2be5e2df34dc20b01646b8e13c2a3f56404ceb86 /view/sharedcache
parent8267ab475cb2ac82fd3724c009f21e8e30143f6b (diff)
[SharedCache] Support loading iOS shared caches older than 11
Still need to fix branch island images not being picked up
Diffstat (limited to 'view/sharedcache')
-rw-r--r--view/sharedcache/core/SharedCacheView.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/view/sharedcache/core/SharedCacheView.cpp b/view/sharedcache/core/SharedCacheView.cpp
index 0cd4d82e..77f6e633 100644
--- a/view/sharedcache/core/SharedCacheView.cpp
+++ b/view/sharedcache/core/SharedCacheView.cpp
@@ -176,11 +176,27 @@ bool SharedCacheView::Init()
m_logger = new Logger("SharedCache.View", GetFile()->GetSessionId());
uint32_t platform;
+ // NOTE: This entry only exists on ios 11 and later, older versions will just assume iOS.
GetParentView()->Read(&platform, 0xd8, 4);
char magic[17];
GetParentView()->Read(&magic, 0, 16);
magic[16] = 0;
+ if (std::string(magic) == "dyld_v1 arm64" || std::string(magic) == "dyld_v1 arm64e"
+ || std::string(magic) == "dyld_v1arm64_32")
+ {
+ arch = "aarch64";
+ }
+ else if (std::string(magic) == "dyld_v1 x86_64" || std::string(magic) == "dyld_v1 x86_64h")
+ {
+ arch = "x86_64";
+ }
+ else
+ {
+ m_logger->LogError("Unknown magic: %s", magic);
+ return false;
+ }
+
// TODO: Do we want to add any warnings about platform support here?
// TODO: Do we still consider macos experimental?
switch (platform)
@@ -200,24 +216,12 @@ bool SharedCacheView::Init()
case DSCPlatformWatchOS:
case DSCPlatformWatchOSSimulator:
case DSCPlatformBridgeOS:
- default:
- m_logger->LogError("Unknown platform: %d", platform);
- return false;
- }
-
- if (std::string(magic) == "dyld_v1 arm64" || std::string(magic) == "dyld_v1 arm64e"
- || std::string(magic) == "dyld_v1arm64_32")
- {
- arch = "aarch64";
- }
- else if (std::string(magic) == "dyld_v1 x86_64" || std::string(magic) == "dyld_v1 x86_64h")
- {
- arch = "x86_64";
- }
- else
- {
- m_logger->LogError("Unknown magic: %s", magic);
+ m_logger->LogError("Unsupported platform: %d", platform);
return false;
+ default:
+ m_logger->LogWarn("Unknown platform: %d selecting iOS...", platform);
+ os = "ios";
+ break;
}
SetDefaultPlatform(Platform::GetByName(os + "-" + arch));