Add empty cfg:u service

This commit is contained in:
wheremyfoodat 2022-10-10 23:44:52 +03:00
parent e02ef8a213
commit 1ddba7737f
7 changed files with 55 additions and 9 deletions

View file

@ -55,7 +55,7 @@ set(KERNEL_SOURCE_FILES src/core/kernel/kernel.cpp src/core/kernel/resource_limi
)
set(SERVICE_SOURCE_FILES src/core/services/service_manager.cpp src/core/services/apt.cpp src/core/services/hid.cpp
src/core/services/fs.cpp src/core/services/gsp_gpu.cpp src/core/services/gsp_lcd.cpp
src/core/services/ndm.cpp src/core/services/dsp.cpp
src/core/services/ndm.cpp src/core/services/dsp.cpp src/core/services/cfg.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/renderer_opengl.cpp
@ -73,7 +73,7 @@ set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/opengl.hpp inc
include/PICA/shader.hpp include/PICA/shader_unit.hpp include/PICA/float_types.hpp
include/logger.hpp include/loader/ncch.hpp include/loader/ncsd.hpp include/io_file.hpp
include/loader/lz77.hpp include/fs/archive_base.hpp include/fs/archive_ncch.hpp
include/services/dsp.hpp
include/services/dsp.hpp include/services/cfg.hpp
)
set(THIRD_PARTY_SOURCE_FILES third_party/imgui/imgui.cpp

View file

@ -11,12 +11,13 @@ namespace KernelHandles {
CurrentThread = 0xFFFF8000, // Used by the original kernel
CurrentProcess = 0xFFFF8001, // Used by the original kernel
APT = 0xFFFF8002, // App Title something service?
HID = 0xFFFF8003, // Handles everything input-related including gyro
FS = 0xFFFF8004, // Filesystem service
GPU = 0xFFFF8005, // GPU service
DSP = 0xFFFF8006, // DSP service (Used for audio decoding and output)
LCD = 0xFFFF8007, // LCD service (Used for configuring the displays)
NDM = 0xFFFF8008, // ?????
CFG = 0xFFFF8003, // Console & region info
HID = 0xFFFF8004, // Handles everything input-related including gyro
FS = 0xFFFF8005, // Filesystem service
GPU = 0xFFFF8006, // GPU service
DSP = 0xFFFF8007, // DSP service (Used for audio decoding and output)
LCD = 0xFFFF8008, // LCD service (Used for configuring the displays)
NDM = 0xFFFF8009, // ?????
MinServiceHandle = APT,
MaxServiceHandle = NDM,
@ -48,6 +49,7 @@ namespace KernelHandles {
static const char* getServiceName(Handle handle) {
switch (handle) {
case APT: return "APT";
case CFG: return "CFG";
case HID: return "HID";
case FS: return "FS";
case DSP: return "DSP";

View file

@ -27,6 +27,7 @@ namespace Log {
// Service loggers
static Logger<true> aptLogger;
static Logger<true> cfgLogger;
static Logger<true> dspServiceLogger;
static Logger<true> fsLogger;
static Logger<true> hidLogger;

15
include/services/cfg.hpp Normal file
View file

@ -0,0 +1,15 @@
#pragma once
#include "helpers.hpp"
#include "logger.hpp"
#include "memory.hpp"
class CFGService {
Handle handle = KernelHandles::CFG;
Memory& mem;
MAKE_LOG_FUNCTION(log, cfgLogger)
public:
CFGService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};

View file

@ -4,6 +4,7 @@
#include "logger.hpp"
#include "memory.hpp"
#include "services/apt.hpp"
#include "services/cfg.hpp"
#include "services/dsp.hpp"
#include "services/hid.hpp"
#include "services/fs.hpp"
@ -19,6 +20,7 @@ class ServiceManager {
MAKE_LOG_FUNCTION(log, srvLogger)
APTService apt;
CFGService cfg;
DSPService dsp;
HIDService hid;
FSService fs;

21
src/core/services/cfg.cpp Normal file
View file

@ -0,0 +1,21 @@
#include "services/cfg.hpp"
namespace CFGCommands {
enum : u32 {
};
}
namespace Result {
enum : u32 {
Success = 0,
};
}
void CFGService::reset() {}
void CFGService::handleSyncRequest(u32 messagePointer) {
const u32 command = mem.read32(messagePointer);
switch (command) {
default: Helpers::panic("CFG service requested. Command: %08X\n", command);
}
}

View file

@ -1,10 +1,12 @@
#include "services/service_manager.hpp"
ServiceManager::ServiceManager(std::array<u32, 16>& regs, Memory& mem, GPU& gpu, u32& currentPID, Kernel& kernel)
: regs(regs), mem(mem), apt(mem), dsp(mem), hid(mem), fs(mem, kernel), gsp_gpu(mem, gpu, currentPID), gsp_lcd(mem), ndm(mem) {}
: regs(regs), mem(mem), apt(mem), cfg(mem), dsp(mem), hid(mem), fs(mem, kernel), gsp_gpu(mem, gpu, currentPID),
gsp_lcd(mem), ndm(mem) {}
void ServiceManager::reset() {
apt.reset();
cfg.reset();
dsp.reset();
hid.reset();
fs.reset();
@ -75,6 +77,8 @@ void ServiceManager::getServiceHandle(u32 messagePointer) {
handle = KernelHandles::APT;
} else if (service == "APT:U") {
handle = KernelHandles::APT;
} else if (service == "cfg:u") {
handle = KernelHandles::CFG;
} else if (service == "dsp::DSP") {
handle = KernelHandles::DSP;
} else if (service == "hid:USER") {
@ -114,6 +118,7 @@ void ServiceManager::receiveNotification(u32 messagePointer) {
void ServiceManager::sendCommandToService(u32 messagePointer, Handle handle) {
switch (handle) {
case KernelHandles::APT: apt.handleSyncRequest(messagePointer); break;
case KernelHandles::CFG: cfg.handleSyncRequest(messagePointer); break;
case KernelHandles::DSP: dsp.handleSyncRequest(messagePointer); break;
case KernelHandles::HID: hid.handleSyncRequest(messagePointer); break;
case KernelHandles::FS: fs.handleSyncRequest(messagePointer); break;