[IR:USER] Add empty service

This commit is contained in:
wheremyfoodat 2023-07-08 19:35:59 +03:00
parent 46207a3995
commit 1c08912a59
7 changed files with 47 additions and 2 deletions

View file

@ -104,6 +104,7 @@ set(SERVICE_SOURCE_FILES src/core/services/service_manager.cpp src/core/services
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/dlp_srvr.cpp
src/core/services/ir_user.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 src/core/PICA/dynapica/shader_rec.cpp
@ -141,7 +142,7 @@ set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/opengl.hpp inc
include/result/result_common.hpp include/result/result_fs.hpp include/result/result_fnd.hpp
include/result/result_gsp.hpp include/result/result_kernel.hpp include/result/result_os.hpp
include/crypto/aes_engine.hpp include/metaprogramming.hpp include/PICA/pica_vertex.hpp include/gl_state.hpp
include/config.hpp
include/config.hpp include/services/ir_user.hpp
)
set(THIRD_PARTY_SOURCE_FILES third_party/imgui/imgui.cpp

View file

@ -21,6 +21,7 @@ namespace KernelHandles {
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)
IR_USER, // One of 3 infrared communication services
FRD, // Friend service (Miiverse friend service)
FS, // Filesystem service
GPU, // GPU service
@ -68,6 +69,7 @@ namespace KernelHandles {
case DSP: return "DSP";
case DLP_SRVR: return "DLP::SRVR";
case HID: return "HID";
case IR_USER: return "IR:USER";
case FRD: return "FRD";
case FS: return "FS";
case GPU: return "GSP::GPU";

View file

@ -42,6 +42,7 @@ namespace Log {
static Logger<false> frdLogger;
static Logger<false> fsLogger;
static Logger<false> hidLogger;
static Logger<false> irUserLogger;
static Logger<false> gspGPULogger;
static Logger<false> gspLCDLogger;
static Logger<false> ldrLogger;

View file

@ -0,0 +1,19 @@
#pragma once
#include "helpers.hpp"
#include "kernel_types.hpp"
#include "logger.hpp"
#include "memory.hpp"
#include "result/result.hpp"
class IRUserService {
Handle handle = KernelHandles::IR_USER;
Memory& mem;
MAKE_LOG_FUNCTION(log, irUserLogger)
// Service commands
public:
IRUserService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};

View file

@ -21,6 +21,7 @@
#include "services/gsp_gpu.hpp"
#include "services/gsp_lcd.hpp"
#include "services/hid.hpp"
#include "services/ir_user.hpp"
#include "services/ldr_ro.hpp"
#include "services/mic.hpp"
#include "services/ndm.hpp"
@ -52,6 +53,7 @@ class ServiceManager {
DlpSrvrService dlp_srvr;
DSPService dsp;
HIDService hid;
IRUserService ir_user;
FRDService frd;
FSService fs;
GPUService gsp_gpu;

View file

@ -0,0 +1,15 @@
#include "ipc.hpp"
#include "services/ir_user.hpp"
namespace IRUserCommands {
enum : u32 {};
}
void IRUserService::reset() {}
void IRUserService::handleSyncRequest(u32 messagePointer) {
const u32 command = mem.read32(messagePointer);
switch (command) {
default: Helpers::panic("ir:USER service requested. Command: %08X\n", command);
}
}

View file

@ -7,7 +7,7 @@
ServiceManager::ServiceManager(std::span<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), dlp_srvr(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), ir_user(mem), 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) {}
@ -26,6 +26,7 @@ void ServiceManager::reset() {
dlp_srvr.reset();
dsp.reset();
hid.reset();
ir_user.reset();
frd.reset();
fs.reset();
gsp_gpu.reset();
@ -83,6 +84,7 @@ void ServiceManager::registerClient(u32 messagePointer) {
mem.write32(messagePointer + 4, Result::Success);
}
// clang-format off
static std::map<std::string, Handle> serviceMap = {
{ "ac:u", KernelHandles::AC },
{ "act:u", KernelHandles::ACT },
@ -97,6 +99,7 @@ static std::map<std::string, Handle> serviceMap = {
{ "dlp:SRVR", KernelHandles::DLP_SRVR },
{ "dsp::DSP", KernelHandles::DSP },
{ "hid:USER", KernelHandles::HID },
{ "ir:USER", KernelHandles::IR_USER },
{ "frd:u", KernelHandles::FRD },
{ "fs:USER", KernelHandles::FS },
{ "gsp::Gpu", KernelHandles::GPU },
@ -110,6 +113,7 @@ static std::map<std::string, Handle> serviceMap = {
{ "ptm:sysm", KernelHandles::PTM },
{ "y2r:u", KernelHandles::Y2R }
};
// clang-format on
// https://www.3dbrew.org/wiki/SRV:GetServiceHandle
void ServiceManager::getServiceHandle(u32 messagePointer) {
@ -179,6 +183,7 @@ void ServiceManager::sendCommandToService(u32 messagePointer, Handle handle) {
case KernelHandles::CFG: cfg.handleSyncRequest(messagePointer); break;
case KernelHandles::DLP_SRVR: dlp_srvr.handleSyncRequest(messagePointer); break;
case KernelHandles::HID: hid.handleSyncRequest(messagePointer); break;
case KernelHandles::IR_USER: ir_user.handleSyncRequest(messagePointer); break;
case KernelHandles::FRD: frd.handleSyncRequest(messagePointer); break;
case KernelHandles::LCD: gsp_lcd.handleSyncRequest(messagePointer); break;
case KernelHandles::LDR_RO: ldr.handleSyncRequest(messagePointer); break;