Add more HLE service calls for eshop (#721)

This commit is contained in:
wheremyfoodat 2025-02-10 01:00:12 +02:00 committed by GitHub
parent b1a1b4caa7
commit da797831ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 26 additions and 1 deletions

View file

@ -23,6 +23,7 @@ class CFGService {
void getConfigInfoBlk2(u32 messagePointer); void getConfigInfoBlk2(u32 messagePointer);
void getConfigInfoBlk8(u32 messagePointer, u32 commandWord); void getConfigInfoBlk8(u32 messagePointer, u32 commandWord);
void getCountryCodeID(u32 messagePointer); void getCountryCodeID(u32 messagePointer);
void getCountryCodeString(u32 messagePointer);
void getLocalFriendCodeSeed(u32 messagePointer); void getLocalFriendCodeSeed(u32 messagePointer);
void getRegionCanadaUSA(u32 messagePointer); void getRegionCanadaUSA(u32 messagePointer);
void getSystemModel(u32 messagePointer); void getSystemModel(u32 messagePointer);

View file

@ -18,6 +18,7 @@ namespace CFGCommands {
GetSystemModel = 0x00050000, GetSystemModel = 0x00050000,
TranslateCountryInfo = 0x00080080, TranslateCountryInfo = 0x00080080,
GetCountryCodeString = 0x00090040,
GetCountryCodeID = 0x000A0040, GetCountryCodeID = 0x000A0040,
IsFangateSupported = 0x000B0000, IsFangateSupported = 0x000B0000,
SetConfigInfoBlk4 = 0x04020082, SetConfigInfoBlk4 = 0x04020082,
@ -50,6 +51,7 @@ void CFGService::handleSyncRequest(u32 messagePointer, CFGService::Type type) {
if (type != Type::NOR) { if (type != Type::NOR) {
switch (command) { switch (command) {
case CFGCommands::GetConfigInfoBlk2: [[likely]] getConfigInfoBlk2(messagePointer); break; case CFGCommands::GetConfigInfoBlk2: [[likely]] getConfigInfoBlk2(messagePointer); break;
case CFGCommands::GetCountryCodeString: getCountryCodeString(messagePointer); break;
case CFGCommands::GetCountryCodeID: getCountryCodeID(messagePointer); break; case CFGCommands::GetCountryCodeID: getCountryCodeID(messagePointer); break;
case CFGCommands::GetRegionCanadaUSA: getRegionCanadaUSA(messagePointer); break; case CFGCommands::GetRegionCanadaUSA: getRegionCanadaUSA(messagePointer); break;
case CFGCommands::GetSystemModel: getSystemModel(messagePointer); break; case CFGCommands::GetSystemModel: getSystemModel(messagePointer); break;
@ -315,6 +317,24 @@ void CFGService::getCountryCodeID(u32 messagePointer) {
} }
} }
void CFGService::getCountryCodeString(u32 messagePointer) {
const u16 id = mem.read16(messagePointer + 4);
log("CFG::getCountryCodeString (id = %04X)\n", id);
mem.write32(messagePointer, IPC::responseHeader(0x09, 2, 0));
for (auto [string, code] : countryCodeToTableIDMap) {
if (code == id) {
mem.write32(messagePointer + 4, Result::Success);
mem.write32(messagePointer + 8, u32(string));
return;
}
}
// Code is not a valid country code, return an appropriate error
mem.write32(messagePointer + 4, 0xD90103FA);
}
void CFGService::secureInfoGetByte101(u32 messagePointer) { void CFGService::secureInfoGetByte101(u32 messagePointer) {
log("CFG::SecureInfoGetByte101\n"); log("CFG::SecureInfoGetByte101\n");

View file

@ -19,7 +19,11 @@ void HTTPService::handleSyncRequest(u32 messagePointer) {
case HTTPCommands::CreateRootCertChain: createRootCertChain(messagePointer); break; case HTTPCommands::CreateRootCertChain: createRootCertChain(messagePointer); break;
case HTTPCommands::Initialize: initialize(messagePointer); break; case HTTPCommands::Initialize: initialize(messagePointer); break;
case HTTPCommands::RootCertChainAddDefaultCert: rootCertChainAddDefaultCert(messagePointer); break; case HTTPCommands::RootCertChainAddDefaultCert: rootCertChainAddDefaultCert(messagePointer); break;
default: Helpers::panic("HTTP service requested. Command: %08X\n", command);
default:
Helpers::warn("HTTP service requested. Command: %08X\n", command);
mem.write32(messagePointer + 4, Result::FailurePlaceholder);
break;
} }
} }