diff options
| author | 2015-05-12 23:29:24 -0300 | |
|---|---|---|
| committer | 2015-05-15 00:04:41 -0300 | |
| commit | 52158c1b8dccd3b469ab502a42a46a1d277928aa (patch) | |
| tree | 7232d68efcb7d0570a12f628cf6a8634c7e51ed1 /src/core/hle/shared_page.cpp | |
| parent | Memory: Read ConfigMem directly from Memory::Read (diff) | |
| download | yuzu-52158c1b8dccd3b469ab502a42a46a1d277928aa.tar.gz yuzu-52158c1b8dccd3b469ab502a42a46a1d277928aa.tar.xz yuzu-52158c1b8dccd3b469ab502a42a46a1d277928aa.zip | |
Memory: Read SharedPage directly from Memory::Read
Diffstat (limited to 'src/core/hle/shared_page.cpp')
| -rw-r--r-- | src/core/hle/shared_page.cpp | 55 |
1 files changed, 2 insertions, 53 deletions
diff --git a/src/core/hle/shared_page.cpp b/src/core/hle/shared_page.cpp index 9de832158..4014eee98 100644 --- a/src/core/hle/shared_page.cpp +++ b/src/core/hle/shared_page.cpp | |||
| @@ -16,63 +16,12 @@ | |||
| 16 | 16 | ||
| 17 | namespace SharedPage { | 17 | namespace SharedPage { |
| 18 | 18 | ||
| 19 | // see http://3dbrew.org/wiki/Configuration_Memory#Shared_Memory_Page_For_ARM11_Processes | 19 | SharedPageDef shared_page; |
| 20 | 20 | ||
| 21 | #pragma pack(1) | 21 | void Init() { |
| 22 | struct DateTime { | ||
| 23 | u64 date_time; // 0x0 | ||
| 24 | u64 update_tick; // 0x8 | ||
| 25 | INSERT_PADDING_BYTES(0x20 - 0x10); // 0x10 | ||
| 26 | }; | ||
| 27 | |||
| 28 | struct SharedPageDef { | ||
| 29 | // most of these names are taken from the 3dbrew page linked above. | ||
| 30 | u32 date_time_selector; // 0x0 | ||
| 31 | u8 running_hw; // 0x4 | ||
| 32 | u8 mcu_hw_info; // 0x5: don't know what the acronyms mean | ||
| 33 | INSERT_PADDING_BYTES(0x20 - 0x6); // 0x6 | ||
| 34 | DateTime date_time_0; // 0x20 | ||
| 35 | DateTime date_time_1; // 0x40 | ||
| 36 | u8 wifi_macaddr[6]; // 0x60 | ||
| 37 | u8 wifi_unknown1; // 0x66: 3dbrew says these are "Likely wifi hardware related" | ||
| 38 | u8 wifi_unknown2; // 0x67 | ||
| 39 | INSERT_PADDING_BYTES(0x80 - 0x68); // 0x68 | ||
| 40 | float sliderstate_3d; // 0x80 | ||
| 41 | u8 ledstate_3d; // 0x84 | ||
| 42 | INSERT_PADDING_BYTES(0xA0 - 0x85); // 0x85 | ||
| 43 | u64 menu_title_id; // 0xA0 | ||
| 44 | u64 active_menu_title_id; // 0xA8 | ||
| 45 | INSERT_PADDING_BYTES(0x1000 - 0xB0); // 0xB0 | ||
| 46 | }; | ||
| 47 | #pragma pack() | ||
| 48 | |||
| 49 | static_assert(sizeof(DateTime) == 0x20, "Datetime size is wrong"); | ||
| 50 | static_assert(sizeof(SharedPageDef) == Memory::SHARED_PAGE_SIZE, "Shared page structure size is wrong"); | ||
| 51 | |||
| 52 | static SharedPageDef shared_page; | ||
| 53 | |||
| 54 | template <typename T> | ||
| 55 | inline void Read(T &var, const u32 addr) { | ||
| 56 | u32 offset = addr - Memory::SHARED_PAGE_VADDR; | ||
| 57 | var = *(reinterpret_cast<T*>(((uintptr_t)&shared_page) + offset)); | ||
| 58 | } | ||
| 59 | |||
| 60 | // Explicitly instantiate template functions because we aren't defining this in the header: | ||
| 61 | template void Read<u64>(u64 &var, const u32 addr); | ||
| 62 | template void Read<u32>(u32 &var, const u32 addr); | ||
| 63 | template void Read<u16>(u16 &var, const u32 addr); | ||
| 64 | template void Read<u8>(u8 &var, const u32 addr); | ||
| 65 | |||
| 66 | void Set3DSlider(float amount) { | ||
| 67 | std::memset(&shared_page, 0, sizeof(shared_page)); | 22 | std::memset(&shared_page, 0, sizeof(shared_page)); |
| 68 | 23 | ||
| 69 | shared_page.sliderstate_3d = amount; | ||
| 70 | shared_page.ledstate_3d = (amount == 0.0f); // off when non-zero | ||
| 71 | } | ||
| 72 | |||
| 73 | void Init() { | ||
| 74 | shared_page.running_hw = 0x1; // product | 24 | shared_page.running_hw = 0x1; // product |
| 75 | Set3DSlider(0.0f); | ||
| 76 | } | 25 | } |
| 77 | 26 | ||
| 78 | void Shutdown() { | 27 | void Shutdown() { |