ptm.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. #include "common/common_types.h"
  6. namespace Service {
  7. class Interface;
  8. namespace PTM {
  9. /// Charge levels used by PTM functions
  10. enum class ChargeLevels : u32 {
  11. CriticalBattery = 1,
  12. LowBattery = 2,
  13. HalfFull = 3,
  14. MostlyFull = 4,
  15. CompletelyFull = 5,
  16. };
  17. /**
  18. * Represents the gamecoin file structure in the SharedExtData archive
  19. * More information in 3dbrew (http://www.3dbrew.org/wiki/Extdata#Shared_Extdata_0xf000000b_gamecoin.dat)
  20. */
  21. struct GameCoin {
  22. u32 magic; ///< Magic number: 0x4F00
  23. u16 total_coins; ///< Total Play Coins
  24. u16 total_coins_on_date; ///< Total Play Coins obtained on the date stored below.
  25. u32 step_count; ///< Total step count at the time a new Play Coin was obtained.
  26. u32 last_step_count; ///< Step count for the day the last Play Coin was obtained
  27. u16 year;
  28. u8 month;
  29. u8 day;
  30. };
  31. /**
  32. * It is unknown if GetAdapterState is the same as GetBatteryChargeState,
  33. * it is likely to just be a duplicate function of GetBatteryChargeState
  34. * that controls another part of the HW.
  35. * PTM::GetAdapterState service function
  36. * Outputs:
  37. * 1 : Result of function, 0 on success, otherwise error code
  38. * 2 : Output of function, 0 = not charging, 1 = charging.
  39. */
  40. void GetAdapterState(Interface* self);
  41. /**
  42. * PTM::GetShellState service function.
  43. * Outputs:
  44. * 1 : Result of function, 0 on success, otherwise error code
  45. * 2 : Whether the 3DS's physical shell casing is open (1) or closed (0)
  46. */
  47. void GetShellState(Interface* self);
  48. /**
  49. * PTM::GetBatteryLevel service function
  50. * Outputs:
  51. * 1 : Result of function, 0 on success, otherwise error code
  52. * 2 : Battery level, 5 = completely full battery, 4 = mostly full battery,
  53. * 3 = half full battery, 2 = low battery, 1 = critical battery.
  54. */
  55. void GetBatteryLevel(Interface* self);
  56. /**
  57. * PTM::GetBatteryChargeState service function
  58. * Outputs:
  59. * 1 : Result of function, 0 on success, otherwise error code
  60. * 2 : Output of function, 0 = not charging, 1 = charging.
  61. */
  62. void GetBatteryChargeState(Interface* self);
  63. /**
  64. * PTM::GetTotalStepCount service function
  65. * Outputs:
  66. * 1 : Result of function, 0 on success, otherwise error code
  67. * 2 : Output of function, * = total step count
  68. */
  69. void GetTotalStepCount(Interface* self);
  70. /**
  71. * PTM::IsLegacyPowerOff service function
  72. * Outputs:
  73. * 1: Result code, 0 on success, otherwise error code
  74. * 2: Whether the system is going through a power off
  75. */
  76. void IsLegacyPowerOff(Interface* self);
  77. /// Initialize the PTM service
  78. void Init();
  79. /// Shutdown the PTM service
  80. void Shutdown();
  81. } // namespace PTM
  82. } // namespace Service