From 7c8d73071af4ac8fd11b89cbd7c83cea8c0ce3cb Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Sun, 24 Sep 2023 22:24:49 +0300 Subject: [PATCH] Add cfg:s --- include/kernel/handles.hpp | 1 + src/core/services/cfg.cpp | 16 +++++++++++++++- src/core/services/service_manager.cpp | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/kernel/handles.hpp b/include/kernel/handles.hpp index 31be1f7f7..b038049f3 100644 --- a/include/kernel/handles.hpp +++ b/include/kernel/handles.hpp @@ -19,6 +19,7 @@ namespace KernelHandles { CECD, // More Streetpass stuff? CFG_U, // CFG service (Console & region info) CFG_I, + CFG_S, // Used by most system apps in lieu of cfg:u CSND, // Plays audio directly from PCM samples DLP_SRVR, // Download Play: Server. Used for network play. DSP, // DSP service (Used for audio decoding and output) diff --git a/src/core/services/cfg.cpp b/src/core/services/cfg.cpp index 5a916ef05..7cab91bd1 100644 --- a/src/core/services/cfg.cpp +++ b/src/core/services/cfg.cpp @@ -34,7 +34,21 @@ void CFGService::handleSyncRequest(u32 messagePointer, CFGService::Type type) { case CFGCommands::GetSystemModel: getSystemModel(messagePointer); break; case CFGCommands::GenHashConsoleUnique: genUniqueConsoleHash(messagePointer); break; case CFGCommands::SecureInfoGetRegion: secureInfoGetRegion(messagePointer); break; - default: Helpers::panic("CFG service requested. Command: %08X\n", command); + + default: + if (type == Type::S) { + // cfg:s-only functions + switch (command) { + case CFGCommands::GetConfigInfoBlk8: getConfigInfoBlk8(messagePointer); break; + case CFGCommands::GetLocalFriendCodeSeed: getLocalFriendCodeSeed(messagePointer); break; + case CFGCommands::SecureInfoGetByte101: secureInfoGetByte101(messagePointer); break; + default: Helpers::panic("CFG:S service requested. Command: %08X\n", command); + } + } else { + Helpers::panic("CFG service requested. Command: %08X\n", command); + } + + break; } } diff --git a/src/core/services/service_manager.cpp b/src/core/services/service_manager.cpp index 114a0fbc0..2a95b5c94 100644 --- a/src/core/services/service_manager.cpp +++ b/src/core/services/service_manager.cpp @@ -106,6 +106,7 @@ static std::map serviceMap = { { "cecd:u", KernelHandles::CECD }, { "cfg:u", KernelHandles::CFG_U }, { "cfg:i", KernelHandles::CFG_I }, + { "cfg:s", KernelHandles::CFG_S }, { "csnd:SND", KernelHandles::CSND }, { "dlp:SRVR", KernelHandles::DLP_SRVR }, { "dsp::DSP", KernelHandles::DSP }, @@ -210,6 +211,7 @@ void ServiceManager::sendCommandToService(u32 messagePointer, Handle handle) { case KernelHandles::CECD: cecd.handleSyncRequest(messagePointer); break; case KernelHandles::CFG_U: cfg.handleSyncRequest(messagePointer, CFGService::Type::U); break; case KernelHandles::CFG_I: cfg.handleSyncRequest(messagePointer, CFGService::Type::I); break; + case KernelHandles::CFG_S: cfg.handleSyncRequest(messagePointer, CFGService::Type::S); break; case KernelHandles::CSND: csnd.handleSyncRequest(messagePointer); break; case KernelHandles::DLP_SRVR: dlp_srvr.handleSyncRequest(messagePointer); break; case KernelHandles::HID: hid.handleSyncRequest(messagePointer); break;