Add DLP::SRVR service

This commit is contained in:
wheremyfoodat 2023-05-27 00:32:43 +03:00
parent b37256e9ea
commit e3fb364d95
7 changed files with 67 additions and 6 deletions

View file

@ -82,7 +82,7 @@ set(SERVICE_SOURCE_FILES src/core/services/service_manager.cpp src/core/services
src/core/services/ac.cpp src/core/services/am.cpp src/core/services/boss.cpp
src/core/services/frd.cpp src/core/services/nim.cpp src/core/services/shared_font.cpp
src/core/services/y2r.cpp src/core/services/cam.cpp src/core/services/ldr_ro.cpp
src/core/services/act.cpp src/core/services/nfc.cpp
src/core/services/act.cpp src/core/services/nfc.cpp src/core/services/dlp_srvr.cpp
)
set(PICA_SOURCE_FILES src/core/PICA/gpu.cpp src/core/PICA/regs.cpp src/core/PICA/shader_unit.cpp
src/core/PICA/shader_interpreter.cpp
@ -112,7 +112,7 @@ set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/opengl.hpp inc
include/fs/archive_ext_save_data.hpp include/services/shared_font.hpp include/fs/archive_ncch.hpp
include/renderer_gl/textures.hpp include/colour.hpp include/services/y2r.hpp include/services/cam.hpp
include/services/ldr_ro.hpp include/ipc.hpp include/services/act.hpp include/services/nfc.hpp
include/system_models.hpp
include/system_models.hpp include/services/dlp_srvr.hpp
)
set(THIRD_PARTY_SOURCE_FILES third_party/imgui/imgui.cpp

View file

@ -18,11 +18,12 @@ namespace KernelHandles {
CAM, // Camera service
CECD, // More Streetpass stuff?
CFG, // CFG service (Console & region info)
DLP_SRVR, // Download Play: Server. Used for network play.
DSP, // DSP service (Used for audio decoding and output)
HID, // HID service (Handles everything input-related including gyro)
FRD, // Friend service (Miiverse friend service)
FS, // Filesystem service
GPU, // GPU service
DSP, // DSP service (Used for audio decoding and output)
LCD, // LCD service (Used for configuring the displays)
LDR_RO, // Loader service. Used for loading CROs.
MIC, // MIC service (Controls the microphone)
@ -64,10 +65,11 @@ namespace KernelHandles {
case CAM: return "CAM";
case CECD: return "CECD";
case CFG: return "CFG";
case DSP: return "DSP";
case DLP_SRVR: return "DLP::SRVR";
case HID: return "HID";
case FRD: return "FRD";
case FS: return "FS";
case DSP: return "DSP";
case GPU: return "GSP::GPU";
case LCD: return "GSP::LCD";
case LDR_RO: return "LDR:RO";

View file

@ -38,6 +38,7 @@ namespace Log {
static Logger<false> cecdLogger;
static Logger<false> cfgLogger;
static Logger<false> dspServiceLogger;
static Logger<false> dlpSrvrLogger;
static Logger<false> frdLogger;
static Logger<false> fsLogger;
static Logger<false> hidLogger;

View file

@ -0,0 +1,21 @@
#pragma once
#include "helpers.hpp"
#include "kernel_types.hpp"
#include "logger.hpp"
#include "memory.hpp"
// Please forgive me for how everything in this file is named
// "dlp:SRVR" is not a nice name to work with
class DlpSrvrService {
Handle handle = KernelHandles::DLP_SRVR;
Memory& mem;
MAKE_LOG_FUNCTION(log, dlpSrvrLogger)
// Service commands
void isChild(u32 messagePointer);
public:
DlpSrvrService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};

View file

@ -12,6 +12,7 @@
#include "services/cam.hpp"
#include "services/cecd.hpp"
#include "services/cfg.hpp"
#include "services/dlp_srvr.hpp"
#include "services/dsp.hpp"
#include "services/hid.hpp"
#include "services/frd.hpp"
@ -46,6 +47,7 @@ class ServiceManager {
CAMService cam;
CECDService cecd;
CFGService cfg;
DlpSrvrService dlp_srvr;
DSPService dsp;
HIDService hid;
FRDService frd;

View file

@ -0,0 +1,32 @@
#include "services/dlp_srvr.hpp"
#include "ipc.hpp"
namespace DlpSrvrCommands {
enum : u32 {
IsChild = 0x000E0040
};
}
namespace Result {
enum : u32 {
Success = 0,
};
}
void DlpSrvrService::reset() {}
void DlpSrvrService::handleSyncRequest(u32 messagePointer) {
const u32 command = mem.read32(messagePointer);
switch (command) {
case DlpSrvrCommands::IsChild: isChild(messagePointer); break;
default: Helpers::panic("DLP::SRVR service requested. Command: %08X\n", command);
}
}
void DlpSrvrService::isChild(u32 messagePointer) {
log("DLP::SRVR: IsChild\n");
mem.write32(messagePointer, IPC::responseHeader(0x0E, 2, 0));
mem.write32(messagePointer + 4, Result::Success);
mem.write32(messagePointer + 8, 0); // We are responsible adults
}

View file

@ -5,7 +5,7 @@
ServiceManager::ServiceManager(std::array<u32, 16>& regs, Memory& mem, GPU& gpu, u32& currentPID, Kernel& kernel)
: regs(regs), mem(mem), kernel(kernel), ac(mem), am(mem), boss(mem), act(mem), apt(mem, kernel), cam(mem),
cecd(mem, kernel), cfg(mem), dsp(mem, kernel), hid(mem, kernel), frd(mem), fs(mem, kernel),
cecd(mem, kernel), cfg(mem), dlp_srvr(mem), dsp(mem, kernel), hid(mem, kernel), frd(mem), fs(mem, kernel),
gsp_gpu(mem, gpu, kernel, currentPID), gsp_lcd(mem), ldr(mem), mic(mem), nfc(mem, kernel), nim(mem), ndm(mem),
ptm(mem), y2r(mem, kernel) {}
@ -21,6 +21,7 @@ void ServiceManager::reset() {
cam.reset();
cecd.reset();
cfg.reset();
dlp_srvr.reset();
dsp.reset();
hid.reset();
frd.reset();
@ -97,6 +98,7 @@ static std::map<std::string, Handle> serviceMap = {
{ "cam:u", KernelHandles::CAM },
{ "cecd:u", KernelHandles::CECD },
{ "cfg:u", KernelHandles::CFG },
{ "dlp:SRVR", KernelHandles::DLP_SRVR },
{ "dsp::DSP", KernelHandles::DSP },
{ "hid:USER", KernelHandles::HID },
{ "frd:u", KernelHandles::FRD },
@ -170,6 +172,7 @@ void ServiceManager::sendCommandToService(u32 messagePointer, Handle handle) {
case KernelHandles::GPU: [[likely]] gsp_gpu.handleSyncRequest(messagePointer); break;
case KernelHandles::FS: [[likely]] fs.handleSyncRequest(messagePointer); break;
case KernelHandles::APT: [[likely]] apt.handleSyncRequest(messagePointer); break;
case KernelHandles::DSP: [[likely]] dsp.handleSyncRequest(messagePointer); break;
case KernelHandles::AC: ac.handleSyncRequest(messagePointer); break;
case KernelHandles::ACT: act.handleSyncRequest(messagePointer); break;
@ -178,7 +181,7 @@ void ServiceManager::sendCommandToService(u32 messagePointer, Handle handle) {
case KernelHandles::CAM: cam.handleSyncRequest(messagePointer); break;
case KernelHandles::CECD: cecd.handleSyncRequest(messagePointer); break;
case KernelHandles::CFG: cfg.handleSyncRequest(messagePointer); break;
case KernelHandles::DSP: dsp.handleSyncRequest(messagePointer); break;
case KernelHandles::DLP_SRVR: dlp_srvr.handleSyncRequest(messagePointer); break;
case KernelHandles::HID: hid.handleSyncRequest(messagePointer); break;
case KernelHandles::FRD: frd.handleSyncRequest(messagePointer); break;
case KernelHandles::LCD: gsp_lcd.handleSyncRequest(messagePointer); break;