mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-06 22:25:41 +12:00
Add empty PTM service for CubicNinja
This commit is contained in:
parent
5d15efe72c
commit
49dc526347
7 changed files with 61 additions and 12 deletions
|
@ -56,6 +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
|
||||
)
|
||||
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
|
||||
|
@ -74,7 +75,7 @@ set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/opengl.hpp inc
|
|||
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/cfg.hpp include/services/region_codes.hpp
|
||||
include/fs/archive_save_data.hpp include/fs/archive_sdmc.hpp
|
||||
include/fs/archive_save_data.hpp include/fs/archive_sdmc.hpp include/services/ptm.hpp
|
||||
)
|
||||
|
||||
set(THIRD_PARTY_SOURCE_FILES third_party/imgui/imgui.cpp
|
||||
|
|
|
@ -10,17 +10,18 @@ namespace KernelHandles {
|
|||
// Hardcoded handles
|
||||
CurrentThread = 0xFFFF8000, // Used by the original kernel
|
||||
CurrentProcess = 0xFFFF8001, // Used by the original kernel
|
||||
APT = 0xFFFF8002, // App Title something service?
|
||||
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, // ?????
|
||||
APT, // App Title something service?
|
||||
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)
|
||||
NDM, // ?????
|
||||
PTM, // PTM service (Used for accessing various console info, such as battery, shell and pedometer state)
|
||||
|
||||
MinServiceHandle = APT,
|
||||
MaxServiceHandle = NDM,
|
||||
MaxServiceHandle = PTM,
|
||||
|
||||
GSPSharedMemHandle = MaxServiceHandle + 1, // Handle for the GSP shared memory
|
||||
HIDSharedMemHandle,
|
||||
|
@ -56,6 +57,7 @@ namespace KernelHandles {
|
|||
case GPU: return "GPU";
|
||||
case LCD: return "LCD";
|
||||
case NDM: return "NDM";
|
||||
case PTM: return "PTM";
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace Log {
|
|||
static Logger<true> gspGPULogger;
|
||||
static Logger<true> gspLCDLogger;
|
||||
static Logger<true> ndmLogger;
|
||||
static Logger<true> ptmLogger;
|
||||
static Logger<true> srvLogger;
|
||||
|
||||
#define MAKE_LOG_FUNCTION(functionName, logger) \
|
||||
|
|
18
include/services/ptm.hpp
Normal file
18
include/services/ptm.hpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#pragma once
|
||||
#include "helpers.hpp"
|
||||
#include "kernel_types.hpp"
|
||||
#include "logger.hpp"
|
||||
#include "memory.hpp"
|
||||
|
||||
class PTMService {
|
||||
Handle handle = KernelHandles::PTM;
|
||||
Memory& mem;
|
||||
MAKE_LOG_FUNCTION(log, ptmLogger)
|
||||
|
||||
// Service commands
|
||||
|
||||
public:
|
||||
PTMService(Memory& mem) : mem(mem) {}
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
};
|
|
@ -11,6 +11,7 @@
|
|||
#include "services/gsp_gpu.hpp"
|
||||
#include "services/gsp_lcd.hpp"
|
||||
#include "services/ndm.hpp"
|
||||
#include "services/ptm.hpp"
|
||||
|
||||
class Kernel;
|
||||
|
||||
|
@ -27,6 +28,7 @@ class ServiceManager {
|
|||
GPUService gsp_gpu;
|
||||
LCDService gsp_lcd;
|
||||
NDMService ndm;
|
||||
PTMService ptm;
|
||||
|
||||
// "srv:" commands
|
||||
void enableNotification(u32 messagePointer);
|
||||
|
|
21
src/core/services/ptm.cpp
Normal file
21
src/core/services/ptm.cpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include "services/ptm.hpp"
|
||||
|
||||
namespace PTMCommands {
|
||||
enum : u32 {
|
||||
};
|
||||
}
|
||||
|
||||
namespace Result {
|
||||
enum : u32 {
|
||||
Success = 0,
|
||||
};
|
||||
}
|
||||
|
||||
void PTMService::reset() {}
|
||||
|
||||
void PTMService::handleSyncRequest(u32 messagePointer) {
|
||||
const u32 command = mem.read32(messagePointer);
|
||||
switch (command) {
|
||||
default: Helpers::panic("PTM service requested. Command: %08X\n", command);
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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) {}
|
||||
gsp_lcd(mem), ndm(mem), ptm(mem) {}
|
||||
|
||||
void ServiceManager::reset() {
|
||||
apt.reset();
|
||||
|
@ -13,6 +13,7 @@ void ServiceManager::reset() {
|
|||
gsp_gpu.reset();
|
||||
gsp_lcd.reset();
|
||||
ndm.reset();
|
||||
ptm.reset();
|
||||
}
|
||||
|
||||
// Match IPC messages to a "srv:" command based on their header
|
||||
|
@ -91,7 +92,9 @@ void ServiceManager::getServiceHandle(u32 messagePointer) {
|
|||
handle = KernelHandles::LCD;
|
||||
} else if (service == "ndm:u") {
|
||||
handle = KernelHandles::NDM;
|
||||
}else {
|
||||
} else if (service == "ptm:u") {
|
||||
handle = KernelHandles::PTM;
|
||||
} else {
|
||||
Helpers::panic("srv: GetServiceHandle with unknown service %s", service.c_str());
|
||||
}
|
||||
|
||||
|
@ -125,6 +128,7 @@ void ServiceManager::sendCommandToService(u32 messagePointer, Handle handle) {
|
|||
case KernelHandles::GPU: [[likely]] gsp_gpu.handleSyncRequest(messagePointer); break;
|
||||
case KernelHandles::LCD: gsp_lcd.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));
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue