Skip to content

Commit

Permalink
Add more HLE service calls for eshop (#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
wheremyfoodat authored Feb 9, 2025
1 parent b1a1b4c commit da79783
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/services/cfg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class CFGService {
void getConfigInfoBlk2(u32 messagePointer);
void getConfigInfoBlk8(u32 messagePointer, u32 commandWord);
void getCountryCodeID(u32 messagePointer);
void getCountryCodeString(u32 messagePointer);
void getLocalFriendCodeSeed(u32 messagePointer);
void getRegionCanadaUSA(u32 messagePointer);
void getSystemModel(u32 messagePointer);
Expand Down
20 changes: 20 additions & 0 deletions src/core/services/cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace CFGCommands {
GetSystemModel = 0x00050000,
TranslateCountryInfo = 0x00080080,

GetCountryCodeString = 0x00090040,
GetCountryCodeID = 0x000A0040,
IsFangateSupported = 0x000B0000,
SetConfigInfoBlk4 = 0x04020082,
Expand Down Expand Up @@ -50,6 +51,7 @@ void CFGService::handleSyncRequest(u32 messagePointer, CFGService::Type type) {
if (type != Type::NOR) {
switch (command) {
case CFGCommands::GetConfigInfoBlk2: [[likely]] getConfigInfoBlk2(messagePointer); break;
case CFGCommands::GetCountryCodeString: getCountryCodeString(messagePointer); break;
case CFGCommands::GetCountryCodeID: getCountryCodeID(messagePointer); break;
case CFGCommands::GetRegionCanadaUSA: getRegionCanadaUSA(messagePointer); break;
case CFGCommands::GetSystemModel: getSystemModel(messagePointer); break;
Expand Down Expand Up @@ -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) {
log("CFG::SecureInfoGetByte101\n");

Expand Down
6 changes: 5 additions & 1 deletion src/core/services/http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ void HTTPService::handleSyncRequest(u32 messagePointer) {
case HTTPCommands::CreateRootCertChain: createRootCertChain(messagePointer); break;
case HTTPCommands::Initialize: initialize(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;
}
}

Expand Down

0 comments on commit da79783

Please sign in to comment.