Add BOSS service

This commit is contained in:
wheremyfoodat 2023-01-06 02:40:45 +02:00
parent 243224eed3
commit f965dea916
7 changed files with 60 additions and 5 deletions

View file

@ -58,7 +58,7 @@ set(SERVICE_SOURCE_FILES src/core/services/service_manager.cpp src/core/services
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/mic.cpp src/core/services/cecd.cpp
src/core/services/ac.cpp src/core/services/frd.cpp
src/core/services/ac.cpp src/core/services/boss.cpp src/core/services/frd.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
@ -82,7 +82,7 @@ set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/opengl.hpp inc
include/fs/archive_save_data.hpp include/fs/archive_sdmc.hpp include/services/ptm.hpp
include/services/mic.hpp include/services/cecd.hpp include/renderer_gl/renderer_gl.hpp
include/renderer_gl/surfaces.hpp include/renderer_gl/surface_cache.hpp include/services/ac.hpp
include/services/frd.hpp
include/services/boss.hpp include/services/frd.hpp
)
set(THIRD_PARTY_SOURCE_FILES third_party/imgui/imgui.cpp

View file

@ -12,7 +12,8 @@ namespace KernelHandles {
CurrentProcess = 0xFFFF8001, // Used by the original kernel
AC, // Something network related
APT, // App Title something service?
CECD, // Streetpass stuff?
BOSS, // Streetpass stuff?
CECD, // More Streetpass stuff?
CFG, // CFG service (Console & region info)
HID, // HID service (Handles everything input-related including gyro)
FRD, // Friend service (Miiverse friend service)

View file

@ -30,6 +30,7 @@ namespace Log {
// Service loggers
static Logger<false> acLogger;
static Logger<false> aptLogger;
static Logger<false> bossLogger;
static Logger<false> cecdLogger;
static Logger<false> cfgLogger;
static Logger<false> dspServiceLogger;

19
include/services/boss.hpp Normal file
View file

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

View file

@ -6,6 +6,7 @@
#include "memory.hpp"
#include "services/ac.hpp"
#include "services/apt.hpp"
#include "services/boss.hpp"
#include "services/cecd.hpp"
#include "services/cfg.hpp"
#include "services/dsp.hpp"
@ -32,6 +33,7 @@ class ServiceManager {
ACService ac;
APTService apt;
BOSSService boss;
CECDService cecd;
CFGService cfg;
DSPService dsp;

View file

@ -0,0 +1,28 @@
#include "services/boss.hpp"
namespace BOSSCommands {
enum : u32 {
InitializeSession = 0x00010082
};
}
namespace Result {
enum : u32 {
Success = 0,
};
}
void BOSSService::reset() {}
void BOSSService::handleSyncRequest(u32 messagePointer) {
const u32 command = mem.read32(messagePointer);
switch (command) {
case BOSSCommands::InitializeSession: initializeSession(messagePointer); break;
default: Helpers::panic("BOSS service requested. Command: %08X\n", command);
}
}
void BOSSService::initializeSession(u32 messagePointer) {
log("BOSS::InitializeSession (stubbed)\n");
mem.write32(messagePointer + 4, Result::Success);
}

View file

@ -2,14 +2,15 @@
#include "kernel.hpp"
ServiceManager::ServiceManager(std::array<u32, 16>& regs, Memory& mem, GPU& gpu, u32& currentPID, Kernel& kernel)
: regs(regs), mem(mem), kernel(kernel), ac(mem), apt(mem, kernel), cecd(mem), cfg(mem), dsp(mem), hid(mem),
frd(mem), fs(mem, kernel), gsp_gpu(mem, gpu, currentPID), gsp_lcd(mem), mic(mem), ndm(mem), ptm(mem) {}
: regs(regs), mem(mem), kernel(kernel), ac(mem), boss(mem), apt(mem, kernel), cecd(mem), cfg(mem), dsp(mem),
hid(mem), frd(mem), fs(mem, kernel), gsp_gpu(mem, gpu, currentPID), gsp_lcd(mem), mic(mem), ndm(mem), ptm(mem) {}
static constexpr int MAX_NOTIFICATION_COUNT = 16;
void ServiceManager::reset() {
ac.reset();
apt.reset();
boss.reset();
cecd.reset();
cfg.reset();
dsp.reset();
@ -90,6 +91,8 @@ void ServiceManager::getServiceHandle(u32 messagePointer) {
handle = KernelHandles::APT;
} else if (service == "APT:U") {
handle = KernelHandles::APT;
} else if (service == "boss:U") {
handle = KernelHandles::BOSS;
} else if (service == "cecd:u") {
handle = KernelHandles::CECD;
} else if (service == "cfg:u") {
@ -152,6 +155,7 @@ void ServiceManager::sendCommandToService(u32 messagePointer, Handle handle) {
switch (handle) {
case KernelHandles::AC: ac.handleSyncRequest(messagePointer); break;
case KernelHandles::APT: apt.handleSyncRequest(messagePointer); break;
case KernelHandles::BOSS: boss.handleSyncRequest(messagePointer); break;
case KernelHandles::CECD: cecd.handleSyncRequest(messagePointer); break;
case KernelHandles::CFG: cfg.handleSyncRequest(messagePointer); break;
case KernelHandles::DSP: dsp.handleSyncRequest(messagePointer); break;