mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-06 06:05:40 +12:00
117 lines
3 KiB
C++
117 lines
3 KiB
C++
#pragma once
|
|
#include <array>
|
|
#include <optional>
|
|
#include <span>
|
|
|
|
#include "kernel_types.hpp"
|
|
#include "logger.hpp"
|
|
#include "memory.hpp"
|
|
#include "services/ac.hpp"
|
|
#include "services/act.hpp"
|
|
#include "services/am.hpp"
|
|
#include "services/apt.hpp"
|
|
#include "services/boss.hpp"
|
|
#include "services/cam.hpp"
|
|
#include "services/cecd.hpp"
|
|
#include "services/cfg.hpp"
|
|
#include "services/csnd.hpp"
|
|
#include "services/dlp_srvr.hpp"
|
|
#include "services/dsp.hpp"
|
|
#include "services/frd.hpp"
|
|
#include "services/fs.hpp"
|
|
#include "services/gsp_gpu.hpp"
|
|
#include "services/gsp_lcd.hpp"
|
|
#include "services/hid.hpp"
|
|
#include "services/http.hpp"
|
|
#include "services/ir_user.hpp"
|
|
#include "services/ldr_ro.hpp"
|
|
#include "services/mcu/mcu_hwc.hpp"
|
|
#include "services/mic.hpp"
|
|
#include "services/ndm.hpp"
|
|
#include "services/news_u.hpp"
|
|
#include "services/nfc.hpp"
|
|
#include "services/nim.hpp"
|
|
#include "services/ns.hpp"
|
|
#include "services/nwm_uds.hpp"
|
|
#include "services/ptm.hpp"
|
|
#include "services/soc.hpp"
|
|
#include "services/ssl.hpp"
|
|
#include "services/y2r.hpp"
|
|
|
|
struct EmulatorConfig;
|
|
// More circular dependencies!!
|
|
class Kernel;
|
|
|
|
class ServiceManager {
|
|
using Handle = HorizonHandle;
|
|
|
|
std::span<u32, 16> regs;
|
|
Memory& mem;
|
|
Kernel& kernel;
|
|
|
|
std::optional<Handle> notificationSemaphore;
|
|
|
|
MAKE_LOG_FUNCTION(log, srvLogger)
|
|
|
|
ACService ac;
|
|
ACTService act;
|
|
AMService am;
|
|
APTService apt;
|
|
BOSSService boss;
|
|
CAMService cam;
|
|
CECDService cecd;
|
|
CFGService cfg;
|
|
CSNDService csnd;
|
|
DlpSrvrService dlp_srvr;
|
|
DSPService dsp;
|
|
HIDService hid;
|
|
HTTPService http;
|
|
IRUserService ir_user;
|
|
FRDService frd;
|
|
FSService fs;
|
|
GPUService gsp_gpu;
|
|
LCDService gsp_lcd;
|
|
LDRService ldr;
|
|
MICService mic;
|
|
NDMService ndm;
|
|
NewsUService news_u;
|
|
NFCService nfc;
|
|
NwmUdsService nwm_uds;
|
|
NIMService nim;
|
|
NSService ns;
|
|
PTMService ptm;
|
|
SOCService soc;
|
|
SSLService ssl;
|
|
Y2RService y2r;
|
|
|
|
MCU::HWCService mcu_hwc;
|
|
|
|
// "srv:" commands
|
|
void enableNotification(u32 messagePointer);
|
|
void getServiceHandle(u32 messagePointer);
|
|
void receiveNotification(u32 messagePointer);
|
|
void registerClient(u32 messagePointer);
|
|
void subscribe(u32 messagePointer);
|
|
void unsubscribe(u32 messagePointer);
|
|
|
|
public:
|
|
ServiceManager(std::span<u32, 16> regs, Memory& mem, GPU& gpu, u32& currentPID, Kernel& kernel, const EmulatorConfig& config);
|
|
void reset();
|
|
void initializeFS() { fs.initializeFilesystem(); }
|
|
void handleSyncRequest(u32 messagePointer);
|
|
|
|
// Forward a SendSyncRequest IPC message to the service with the respective handle
|
|
void sendCommandToService(u32 messagePointer, Handle handle);
|
|
|
|
// Wrappers for communicating with certain services
|
|
void sendGPUInterrupt(GPUInterrupt type) { gsp_gpu.requestInterrupt(type); }
|
|
void setGSPSharedMem(u8* ptr) { gsp_gpu.setSharedMem(ptr); }
|
|
void setHIDSharedMem(u8* ptr) { hid.setSharedMem(ptr); }
|
|
void setCSNDSharedMem(u8* ptr) { csnd.setSharedMemory(ptr); }
|
|
|
|
// Input function wrappers
|
|
HIDService& getHID() { return hid; }
|
|
NFCService& getNFC() { return nfc; }
|
|
DSPService& getDSP() { return dsp; }
|
|
Y2RService& getY2R() { return y2r; }
|
|
};
|