| 169 | }; |
| 170 | |
| 171 | bool SharedCacheView::Init() |
| 172 | { |
| 173 | std::string os; |
| 174 | std::string arch; |
| 175 | |
| 176 | m_logger = new Logger("SharedCache.View", GetFile()->GetSessionId()); |
| 177 | |
| 178 | uint32_t platform; |
| 179 | GetParentView()->Read(&platform, 0xd8, 4); |
| 180 | char magic[17]; |
| 181 | GetParentView()->Read(&magic, 0, 16); |
| 182 | magic[16] = 0; |
| 183 | |
| 184 | // TODO: Do we want to add any warnings about platform support here? |
| 185 | // TODO: Do we still consider macos experimental? |
| 186 | switch (platform) |
| 187 | { |
| 188 | case DSCPlatformMacOS: |
| 189 | case DSCPlatformTVOS: |
| 190 | case DSCPlatformTVOSSimulator: |
| 191 | os = "mac"; |
| 192 | break; |
| 193 | case DSCPlatformiOS: |
| 194 | case DSCPlatformiOSSimulator: |
| 195 | case DSCPlatformVisionOS: |
| 196 | case DSCPlatformVisionOSSimulator: |
| 197 | os = "ios"; |
| 198 | break; |
| 199 | // armv7 or slide info v1 (unsupported) |
| 200 | case DSCPlatformWatchOS: |
| 201 | case DSCPlatformWatchOSSimulator: |
| 202 | case DSCPlatformBridgeOS: |
| 203 | default: |
| 204 | m_logger->LogError("Unknown platform: %d", platform); |
| 205 | return false; |
| 206 | } |
| 207 | |
| 208 | if (std::string(magic) == "dyld_v1 arm64" || std::string(magic) == "dyld_v1 arm64e" |
| 209 | || std::string(magic) == "dyld_v1arm64_32") |
| 210 | { |
| 211 | arch = "aarch64"; |
| 212 | } |
| 213 | else if (std::string(magic) == "dyld_v1 x86_64" || std::string(magic) == "dyld_v1 x86_64h") |
| 214 | { |
| 215 | arch = "x86_64"; |
| 216 | } |
| 217 | else |
| 218 | { |
| 219 | m_logger->LogError("Unknown magic: %s", magic); |
| 220 | return false; |
| 221 | } |
| 222 | |
| 223 | SetDefaultPlatform(Platform::GetByName(os + "-" + arch)); |
| 224 | SetDefaultArchitecture(Architecture::GetByName(arch)); |
| 225 | |
| 226 | Ref<Settings> settings = GetLoadSettings(GetTypeName()); |
| 227 | |
| 228 | if (!settings) |
no test coverage detected