shared_page.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright 2015 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. /**
  6. * The shared page stores various runtime configuration settings. This memory page is
  7. * read-only for user processes (there is a bit in the header that grants the process
  8. * write access, according to 3dbrew; this is not emulated)
  9. */
  10. #include "common/common_funcs.h"
  11. #include "common/common_types.h"
  12. #include "common/swap.h"
  13. #include "core/memory.h"
  14. ////////////////////////////////////////////////////////////////////////////////////////////////////
  15. namespace SharedPage {
  16. // See http://3dbrew.org/wiki/Configuration_Memory#Shared_Memory_Page_For_ARM11_Processes
  17. struct DateTime {
  18. u64_le date_time; // 0
  19. u64_le update_tick; // 8
  20. u64_le tick_to_second_coefficient; // 10
  21. u64_le tick_offset; // 18
  22. };
  23. static_assert(sizeof(DateTime) == 0x20, "Datetime size is wrong");
  24. struct SharedPageDef {
  25. // Most of these names are taken from the 3dbrew page linked above.
  26. u32_le date_time_counter; // 0
  27. u8 running_hw; // 4
  28. /// "Microcontroller hardware info"
  29. u8 mcu_hw_info; // 5
  30. INSERT_PADDING_BYTES(0x20 - 0x6); // 6
  31. DateTime date_time_0; // 20
  32. DateTime date_time_1; // 40
  33. u8 wifi_macaddr[6]; // 60
  34. u8 wifi_link_level; // 66
  35. u8 wifi_unknown2; // 67
  36. INSERT_PADDING_BYTES(0x80 - 0x68); // 68
  37. float_le sliderstate_3d; // 80
  38. u8 ledstate_3d; // 84
  39. INSERT_PADDING_BYTES(1); // 85
  40. u8 unknown_value; // 86
  41. INSERT_PADDING_BYTES(0xA0 - 0x87); // 87
  42. u64_le menu_title_id; // A0
  43. u64_le active_menu_title_id; // A8
  44. INSERT_PADDING_BYTES(0x1000 - 0xB0); // B0
  45. };
  46. static_assert(sizeof(SharedPageDef) == Memory::SHARED_PAGE_SIZE,
  47. "Shared page structure size is wrong");
  48. extern SharedPageDef shared_page;
  49. void Init();
  50. } // namespace