summaryrefslogtreecommitdiff
path: root/src/core/hle/shared_page.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/shared_page.cpp')
-rw-r--r--src/core/hle/shared_page.cpp57
1 files changed, 3 insertions, 54 deletions
diff --git a/src/core/hle/shared_page.cpp b/src/core/hle/shared_page.cpp
index 4f227a370..4014eee98 100644
--- a/src/core/hle/shared_page.cpp
+++ b/src/core/hle/shared_page.cpp
@@ -8,7 +8,7 @@
8#include "common/common_funcs.h" 8#include "common/common_funcs.h"
9 9
10#include "core/core.h" 10#include "core/core.h"
11#include "core/mem_map.h" 11#include "core/memory.h"
12#include "core/hle/config_mem.h" 12#include "core/hle/config_mem.h"
13#include "core/hle/shared_page.h" 13#include "core/hle/shared_page.h"
14 14
@@ -16,63 +16,12 @@
16 16
17namespace SharedPage { 17namespace SharedPage {
18 18
19// see http://3dbrew.org/wiki/Configuration_Memory#Shared_Memory_Page_For_ARM11_Processes 19SharedPageDef shared_page;
20 20
21#pragma pack(1) 21void Init() {
22struct DateTime {
23 u64 date_time; // 0x0
24 u64 update_tick; // 0x8
25 INSERT_PADDING_BYTES(0x20 - 0x10); // 0x10
26};
27
28struct 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
49static_assert(sizeof(DateTime) == 0x20, "Datetime size is wrong");
50static_assert(sizeof(SharedPageDef) == Memory::SHARED_PAGE_SIZE, "Shared page structure size is wrong");
51
52static SharedPageDef shared_page;
53
54template <typename T>
55inline 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:
61template void Read<u64>(u64 &var, const u32 addr);
62template void Read<u32>(u32 &var, const u32 addr);
63template void Read<u16>(u16 &var, const u32 addr);
64template void Read<u8>(u8 &var, const u32 addr);
65
66void 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
73void Init() {
74 shared_page.running_hw = 0x1; // product 24 shared_page.running_hw = 0x1; // product
75 Set3DSlider(0.0f);
76} 25}
77 26
78void Shutdown() { 27void Shutdown() {