[SRV] Empty CECD/MIC services for MK7 and 3D Land

This commit is contained in:
wheremyfoodat 2022-10-16 12:27:44 +03:00
parent 1147824709
commit 55ca643c5d
9 changed files with 100 additions and 3 deletions

View file

@ -56,7 +56,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/cfg.cpp
src/core/services/ptm.cpp
src/core/services/ptm.cpp src/core/services/mic.cpp src/core/services/cecd.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
@ -76,6 +76,7 @@ set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/opengl.hpp inc
include/loader/lz77.hpp include/fs/archive_base.hpp include/fs/archive_ncch.hpp
include/services/dsp.hpp include/services/cfg.hpp include/services/region_codes.hpp
include/fs/archive_save_data.hpp include/fs/archive_sdmc.hpp include/services/ptm.hpp
include/services/mic.hpp include/services/cecd.hpp
)
set(THIRD_PARTY_SOURCE_FILES third_party/imgui/imgui.cpp

View file

@ -11,12 +11,14 @@ namespace KernelHandles {
CurrentThread = 0xFFFF8000, // Used by the original kernel
CurrentProcess = 0xFFFF8001, // Used by the original kernel
APT, // App Title something service?
CECD, // Streetpass stuff?
CFG, // CFG service (Console & region info)
HID, // HID service (Handles everything input-related including gyro)
FS, // Filesystem service
GPU, // GPU service
DSP, // DSP service (Used for audio decoding and output)
LCD, // LCD service (Used for configuring the displays)
MIC, // MIC service (Controls the microphone)
NDM, // ?????
PTM, // PTM service (Used for accessing various console info, such as battery, shell and pedometer state)
@ -50,12 +52,14 @@ namespace KernelHandles {
static const char* getServiceName(Handle handle) {
switch (handle) {
case APT: return "APT";
case CECD: return "CECD";
case CFG: return "CFG";
case HID: return "HID";
case FS: return "FS";
case DSP: return "DSP";
case GPU: return "GPU";
case LCD: return "LCD";
case MIC: return "MIC";
case NDM: return "NDM";
case PTM: return "PTM";
default: return "Unknown";

View file

@ -27,12 +27,14 @@ namespace Log {
// Service loggers
static Logger<true> aptLogger;
static Logger<true> cecdLogger;
static Logger<true> cfgLogger;
static Logger<true> dspServiceLogger;
static Logger<true> fsLogger;
static Logger<true> hidLogger;
static Logger<true> gspGPULogger;
static Logger<true> gspLCDLogger;
static Logger<true> micLogger;
static Logger<true> ndmLogger;
static Logger<true> ptmLogger;
static Logger<true> srvLogger;

18
include/services/cecd.hpp Normal file
View file

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

18
include/services/mic.hpp Normal file
View file

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

View file

@ -4,12 +4,14 @@
#include "logger.hpp"
#include "memory.hpp"
#include "services/apt.hpp"
#include "services/cecd.hpp"
#include "services/cfg.hpp"
#include "services/dsp.hpp"
#include "services/hid.hpp"
#include "services/fs.hpp"
#include "services/gsp_gpu.hpp"
#include "services/gsp_lcd.hpp"
#include "services/mic.hpp"
#include "services/ndm.hpp"
#include "services/ptm.hpp"
@ -21,12 +23,14 @@ class ServiceManager {
MAKE_LOG_FUNCTION(log, srvLogger)
APTService apt;
CECDService cecd;
CFGService cfg;
DSPService dsp;
HIDService hid;
FSService fs;
GPUService gsp_gpu;
LCDService gsp_lcd;
MICService mic;
NDMService ndm;
PTMService ptm;

View file

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

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

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

View file

@ -1,17 +1,19 @@
#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), cfg(mem), dsp(mem), hid(mem), fs(mem, kernel), gsp_gpu(mem, gpu, currentPID),
gsp_lcd(mem), ndm(mem), ptm(mem) {}
: regs(regs), mem(mem), apt(mem), cecd(mem), cfg(mem), dsp(mem), hid(mem), fs(mem, kernel), gsp_gpu(mem, gpu, currentPID),
gsp_lcd(mem), mic(mem), ndm(mem), ptm(mem) {}
void ServiceManager::reset() {
apt.reset();
cecd.reset();
cfg.reset();
dsp.reset();
hid.reset();
fs.reset();
gsp_gpu.reset();
gsp_lcd.reset();
mic.reset();
ndm.reset();
ptm.reset();
}
@ -78,6 +80,8 @@ void ServiceManager::getServiceHandle(u32 messagePointer) {
handle = KernelHandles::APT;
} else if (service == "APT:U") {
handle = KernelHandles::APT;
} else if (service == "cecd:u") {
handle = KernelHandles::CECD;
} else if (service == "cfg:u") {
handle = KernelHandles::CFG;
} else if (service == "dsp::DSP") {
@ -90,6 +94,8 @@ void ServiceManager::getServiceHandle(u32 messagePointer) {
handle = KernelHandles::GPU;
} else if (service == "gsp::Lcd") {
handle = KernelHandles::LCD;
} else if (service == "mic:u") {
handle = KernelHandles::MIC;
} else if (service == "ndm:u") {
handle = KernelHandles::NDM;
} else if (service == "ptm:u") {
@ -121,12 +127,14 @@ void ServiceManager::receiveNotification(u32 messagePointer) {
void ServiceManager::sendCommandToService(u32 messagePointer, Handle handle) {
switch (handle) {
case KernelHandles::APT: apt.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::HID: hid.handleSyncRequest(messagePointer); break;
case KernelHandles::FS: fs.handleSyncRequest(messagePointer); break;
case KernelHandles::GPU: [[likely]] gsp_gpu.handleSyncRequest(messagePointer); break;
case KernelHandles::LCD: gsp_lcd.handleSyncRequest(messagePointer); break;
case KernelHandles::MIC: mic.handleSyncRequest(messagePointer); break;
case KernelHandles::NDM: ndm.handleSyncRequest(messagePointer); break;
case KernelHandles::PTM: ptm.handleSyncRequest(messagePointer); break;
default: Helpers::panic("Sent IPC message to unknown service %08X\n Command: %08X", handle, mem.read32(messagePointer));