1 // Copyright 2017 Dolphin Emulator Project
2 // Licensed under GPLv2+
3 // Refer to the license.txt file included.
4 
5 #pragma once
6 
7 #include <array>
8 
9 #include "Common/CommonTypes.h"
10 
11 namespace IOS::HLE
12 {
13 struct MemoryValues
14 {
15   u16 ios_number;
16   u32 ios_version;
17   u32 ios_date;
18   u32 mem1_physical_size;
19   u32 mem1_simulated_size;
20   u32 mem1_end;
21   u32 mem1_arena_begin;
22   u32 mem1_arena_end;
23   u32 mem2_physical_size;
24   u32 mem2_simulated_size;
25   u32 mem2_end;
26   u32 mem2_arena_begin;
27   u32 mem2_arena_end;
28   u32 ipc_buffer_begin;
29   u32 ipc_buffer_end;
30   u32 hollywood_revision;
31   u32 ram_vendor;
32   u32 ios_reserved_begin;
33   u32 ios_reserved_end;
34   u32 sysmenu_sync;
35 };
36 
37 const std::array<MemoryValues, 41>& GetMemoryValues();
38 
39 enum class Feature
40 {
41   // Kernel, ES, FS, STM, DI, OH0, OH1
42   Core = 1 << 0,
43   // SDIO
44   SDIO = 1 << 1,
45   // Network (base support: SO, Ethernet; KD, SSL, NCD, Wi-Fi)
46   SO = 1 << 2,
47   Ethernet = 1 << 3,
48   KD = 1 << 4,
49   SSL = 1 << 5,
50   NCD = 1 << 6,
51   WiFi = 1 << 7,
52   // KBD
53   USB_KBD = 1 << 8,
54   // USB_HID v4
55   USB_HIDv4 = 1 << 9,
56   // SDv2 support
57   SDv2 = 1 << 10,
58   // New USB modules (USB, USB_VEN, USB_HUB, USB_MSC, OHCI0, USB_HIDv5)
59   NewUSB = 1 << 11,
60   // EHCI
61   EHCI = 1 << 12,
62   // WFS (WFSSRV, WFSI, USB_SHARED)
63   WFS = 1 << 13,
64 };
65 
66 constexpr Feature operator|(Feature lhs, Feature rhs)
67 {
68   return static_cast<Feature>(static_cast<int>(lhs) | static_cast<int>(rhs));
69 }
70 
71 constexpr Feature& operator|=(Feature& lhs, Feature rhs)
72 {
73   lhs = lhs | rhs;
74   return lhs;
75 }
76 
HasFeature(Feature features,Feature feature)77 constexpr bool HasFeature(Feature features, Feature feature)
78 {
79   return (static_cast<int>(features) & static_cast<int>(feature)) != 0;
80 }
81 
82 bool HasFeature(u32 major_version, Feature feature);
83 Feature GetFeatures(u32 major_version);
84 bool IsEmulated(u32 major_version);
85 bool IsEmulated(u64 title_id);
86 }  // namespace IOS::HLE
87