From 7d551930873d65dd411ce0b7b545dd774a3b1b05 Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Sun, 24 Sep 2023 17:11:40 +0300 Subject: [PATCH] Add implementations for CFG::SecureInfoGetByte101 and CFG::GetLocalFriendCodeSeed --- include/services/cfg.hpp | 2 ++ src/core/services/cfg.cpp | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/services/cfg.hpp b/include/services/cfg.hpp index 91010e931..3ab0426a8 100644 --- a/include/services/cfg.hpp +++ b/include/services/cfg.hpp @@ -16,9 +16,11 @@ class CFGService { // Service functions void getConfigInfoBlk2(u32 messagePointer); void getCountryCodeID(u32 messagePointer); + void getLocalFriendCodeSeed(u32 messagePointer); void getRegionCanadaUSA(u32 messagePointer); void getSystemModel(u32 messagePointer); void genUniqueConsoleHash(u32 messagePointer); + void secureInfoGetByte101(u32 messagePointer); void secureInfoGetRegion(u32 messagePointer); public: diff --git a/src/core/services/cfg.cpp b/src/core/services/cfg.cpp index dd133a3fa..23c6e262d 100644 --- a/src/core/services/cfg.cpp +++ b/src/core/services/cfg.cpp @@ -16,6 +16,9 @@ namespace CFGCommands { GetRegionCanadaUSA = 0x00040000, GetSystemModel = 0x00050000, GetCountryCodeID = 0x000A0040, + + GetLocalFriendCodeSeed = 0x04050000, + SecureInfoGetByte101 = 0x04070000, }; } @@ -208,4 +211,20 @@ void CFGService::getCountryCodeID(u32 messagePointer) { mem.write32(messagePointer + 4, Result::CFG::NotFound); mem.write16(messagePointer + 8, 0xFF); } +} + +void CFGService::secureInfoGetByte101(u32 messagePointer) { + log("CFG::SecureInfoGetByte101\n"); + + mem.write32(messagePointer, IPC::responseHeader(0x407, 2, 0)); + mem.write32(messagePointer + 4, Result::Success); + mem.write8(messagePointer + 8, 0); // Secure info byte 0x101 is usually 0 according to 3DBrew +} + +void CFGService::getLocalFriendCodeSeed(u32 messagePointer) { + log("CFG::GetLocalFriendCodeSeed\n"); + + mem.write32(messagePointer, IPC::responseHeader(0x405, 3, 0)); + mem.write32(messagePointer + 4, Result::Success); + mem.write64(messagePointer + 8, 0); } \ No newline at end of file