shared_page.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. INSERT_PADDING_BYTES(0x20 - 0x10); // 10
  21. };
  22. static_assert(sizeof(DateTime) == 0x20, "Datetime size is wrong");
  23. struct SharedPageDef {
  24. // Most of these names are taken from the 3dbrew page linked above.
  25. u32_le date_time_selector; // 0
  26. u8 running_hw; // 4
  27. /// "Microcontroller hardware info"
  28. u8 mcu_hw_info; // 5
  29. INSERT_PADDING_BYTES(0x20 - 0x6); // 6
  30. DateTime date_time_0; // 20
  31. DateTime date_time_1; // 40
  32. u8 wifi_macaddr[6]; // 60
  33. u8 wifi_unknown1; // 66
  34. u8 wifi_unknown2; // 67
  35. INSERT_PADDING_BYTES(0x80 - 0x68); // 68
  36. float_le sliderstate_3d; // 80
  37. u8 ledstate_3d; // 84
  38. INSERT_PADDING_BYTES(0xA0 - 0x85); // 85
  39. u64_le menu_title_id; // A0
  40. u64_le active_menu_title_id; // A8
  41. INSERT_PADDING_BYTES(0x1000 - 0xB0); // B0
  42. };
  43. static_assert(sizeof(SharedPageDef) == Memory::SHARED_PAGE_SIZE, "Shared page structure size is wrong");
  44. extern SharedPageDef shared_page;
  45. void Init();
  46. } // namespace