cfg_i.cpp 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include "common/log.h"
  5. #include "core/hle/hle.h"
  6. #include "core/hle/service/cfg/cfg.h"
  7. #include "core/hle/service/cfg/cfg_i.h"
  8. ////////////////////////////////////////////////////////////////////////////////////////////////////
  9. // Namespace CFG_I
  10. namespace CFG_I {
  11. /**
  12. * CFG_I::GetConfigInfoBlk8 service function
  13. * This function is called by two command headers,
  14. * there appears to be no difference between them according to 3dbrew
  15. * Inputs:
  16. * 0 : 0x04010082 / 0x08010082
  17. * 1 : Size
  18. * 2 : Block ID
  19. * 3 : Descriptor for the output buffer
  20. * 4 : Output buffer pointer
  21. * Outputs:
  22. * 1 : Result of function, 0 on success, otherwise error code
  23. */
  24. static void GetConfigInfoBlk8(Service::Interface* self) {
  25. u32* cmd_buffer = Kernel::GetCommandBuffer();
  26. u32 size = cmd_buffer[1];
  27. u32 block_id = cmd_buffer[2];
  28. u8* data_pointer = Memory::GetPointer(cmd_buffer[4]);
  29. if (data_pointer == nullptr) {
  30. cmd_buffer[1] = -1; // TODO(Subv): Find the right error code
  31. return;
  32. }
  33. cmd_buffer[1] = Service::CFG::GetConfigInfoBlock(block_id, size, 0x8, data_pointer).raw;
  34. }
  35. /**
  36. * CFG_I::UpdateConfigNANDSavegame service function
  37. * This function is called by two command headers,
  38. * there appears to be no difference between them according to 3dbrew
  39. * Inputs:
  40. * 0 : 0x04030000 / 0x08030000
  41. * Outputs:
  42. * 1 : Result of function, 0 on success, otherwise error code
  43. */
  44. static void UpdateConfigNANDSavegame(Service::Interface* self) {
  45. u32* cmd_buffer = Kernel::GetCommandBuffer();
  46. cmd_buffer[1] = Service::CFG::UpdateConfigNANDSavegame().raw;
  47. }
  48. /**
  49. * CFG_I::FormatConfig service function
  50. * Inputs:
  51. * 0 : 0x08060000
  52. * Outputs:
  53. * 1 : Result of function, 0 on success, otherwise error code
  54. */
  55. static void FormatConfig(Service::Interface* self) {
  56. u32* cmd_buffer = Kernel::GetCommandBuffer();
  57. cmd_buffer[1] = Service::CFG::FormatConfig().raw;
  58. }
  59. const Interface::FunctionInfo FunctionTable[] = {
  60. {0x04010082, GetConfigInfoBlk8, "GetConfigInfoBlk8"},
  61. {0x04020082, nullptr, "SetConfigInfoBlk4"},
  62. {0x04030000, UpdateConfigNANDSavegame, "UpdateConfigNANDSavegame"},
  63. {0x04040042, nullptr, "GetLocalFriendCodeSeedData"},
  64. {0x04050000, nullptr, "GetLocalFriendCodeSeed"},
  65. {0x04060000, nullptr, "SecureInfoGetRegion"},
  66. {0x04070000, nullptr, "SecureInfoGetByte101"},
  67. {0x04080042, nullptr, "SecureInfoGetSerialNo"},
  68. {0x04090000, nullptr, "UpdateConfigBlk00040003"},
  69. {0x08010082, GetConfigInfoBlk8, "GetConfigInfoBlk8"},
  70. {0x08020082, nullptr, "SetConfigInfoBlk4"},
  71. {0x08030000, UpdateConfigNANDSavegame, "UpdateConfigNANDSavegame"},
  72. {0x080400C2, nullptr, "CreateConfigInfoBlk"},
  73. {0x08050000, nullptr, "DeleteConfigNANDSavefile"},
  74. {0x08060000, FormatConfig, "FormatConfig"},
  75. {0x08080000, nullptr, "UpdateConfigBlk1"},
  76. {0x08090000, nullptr, "UpdateConfigBlk2"},
  77. {0x080A0000, nullptr, "UpdateConfigBlk3"},
  78. {0x080B0082, nullptr, "SetGetLocalFriendCodeSeedData"},
  79. {0x080C0042, nullptr, "SetLocalFriendCodeSeedSignature"},
  80. {0x080D0000, nullptr, "DeleteCreateNANDLocalFriendCodeSeed"},
  81. {0x080E0000, nullptr, "VerifySigLocalFriendCodeSeed"},
  82. {0x080F0042, nullptr, "GetLocalFriendCodeSeedData"},
  83. {0x08100000, nullptr, "GetLocalFriendCodeSeed"},
  84. {0x08110084, nullptr, "SetSecureInfo"},
  85. {0x08120000, nullptr, "DeleteCreateNANDSecureInfo"},
  86. {0x08130000, nullptr, "VerifySigSecureInfo"},
  87. {0x08140042, nullptr, "SecureInfoGetData"},
  88. {0x08150042, nullptr, "SecureInfoGetSignature"},
  89. {0x08160000, nullptr, "SecureInfoGetRegion"},
  90. {0x08170000, nullptr, "SecureInfoGetByte101"},
  91. {0x08180042, nullptr, "SecureInfoGetSerialNo"},
  92. };
  93. ////////////////////////////////////////////////////////////////////////////////////////////////////
  94. // Interface class
  95. Interface::Interface() {
  96. Register(FunctionTable, ARRAY_SIZE(FunctionTable));
  97. }
  98. } // namespace