ptm.h 3.4 KB

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