mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-06 22:25:41 +12:00
[AC] Add service + SetClientVersion
This commit is contained in:
parent
400db8ef0a
commit
94fe205c48
7 changed files with 62 additions and 5 deletions
|
@ -58,6 +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
|
||||
)
|
||||
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
|
||||
|
@ -80,7 +81,7 @@ set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/opengl.hpp inc
|
|||
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 include/renderer_gl/renderer_gl.hpp
|
||||
include/renderer_gl/surfaces.hpp include/renderer_gl/surface_cache.hpp
|
||||
include/renderer_gl/surfaces.hpp include/renderer_gl/surface_cache.hpp include/services/ac.hpp
|
||||
)
|
||||
|
||||
set(THIRD_PARTY_SOURCE_FILES third_party/imgui/imgui.cpp
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace KernelHandles {
|
|||
// Hardcoded handles
|
||||
CurrentThread = 0xFFFF8000, // Used by the original kernel
|
||||
CurrentProcess = 0xFFFF8001, // Used by the original kernel
|
||||
AC,
|
||||
APT, // App Title something service?
|
||||
CECD, // Streetpass stuff?
|
||||
CFG, // CFG service (Console & region info)
|
||||
|
@ -22,7 +23,7 @@ namespace KernelHandles {
|
|||
NDM, // ?????
|
||||
PTM, // PTM service (Used for accessing various console info, such as battery, shell and pedometer state)
|
||||
|
||||
MinServiceHandle = APT,
|
||||
MinServiceHandle = AC,
|
||||
MaxServiceHandle = PTM,
|
||||
|
||||
GSPSharedMemHandle = MaxServiceHandle + 1, // Handle for the GSP shared memory
|
||||
|
|
19
include/services/ac.hpp
Normal file
19
include/services/ac.hpp
Normal file
|
@ -0,0 +1,19 @@
|
|||
#pragma once
|
||||
#include "helpers.hpp"
|
||||
#include "kernel_types.hpp"
|
||||
#include "logger.hpp"
|
||||
#include "memory.hpp"
|
||||
|
||||
class ACService {
|
||||
Handle handle = KernelHandles::AC;
|
||||
Memory& mem;
|
||||
MAKE_LOG_FUNCTION(log, acLogger)
|
||||
|
||||
// Service commands
|
||||
void setClientVersion(u32 messagePointer);
|
||||
|
||||
public:
|
||||
ACService(Memory& mem) : mem(mem) {}
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
};
|
|
@ -9,7 +9,7 @@ class CECDService {
|
|||
Memory& mem;
|
||||
MAKE_LOG_FUNCTION(log, cecdLogger)
|
||||
|
||||
// Service commands
|
||||
// Service commands
|
||||
|
||||
public:
|
||||
CECDService(Memory& mem) : mem(mem) {}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "kernel_types.hpp"
|
||||
#include "logger.hpp"
|
||||
#include "memory.hpp"
|
||||
#include "services/ac.hpp"
|
||||
#include "services/apt.hpp"
|
||||
#include "services/cecd.hpp"
|
||||
#include "services/cfg.hpp"
|
||||
|
@ -28,6 +29,7 @@ class ServiceManager {
|
|||
|
||||
MAKE_LOG_FUNCTION(log, srvLogger)
|
||||
|
||||
ACService ac;
|
||||
APTService apt;
|
||||
CECDService cecd;
|
||||
CFGService cfg;
|
||||
|
|
30
src/core/services/ac.cpp
Normal file
30
src/core/services/ac.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include "services/ac.hpp"
|
||||
|
||||
namespace ACCommands {
|
||||
enum : u32 {
|
||||
SetClientVersion = 0x00400042
|
||||
};
|
||||
}
|
||||
|
||||
namespace Result {
|
||||
enum : u32 {
|
||||
Success = 0,
|
||||
};
|
||||
}
|
||||
|
||||
void ACService::reset() {}
|
||||
|
||||
void ACService::handleSyncRequest(u32 messagePointer) {
|
||||
const u32 command = mem.read32(messagePointer);
|
||||
switch (command) {
|
||||
case ACCommands::SetClientVersion: setClientVersion(messagePointer); break;
|
||||
default: Helpers::panic("AC service requested. Command: %08X\n", command);
|
||||
}
|
||||
}
|
||||
|
||||
void ACService::setClientVersion(u32 messagePointer) {
|
||||
u32 version = mem.read32(messagePointer + 4);
|
||||
log("AC::SetClientVersion (version = %d)\n", version);
|
||||
|
||||
mem.write32(messagePointer + 4, Result::Success);
|
||||
}
|
|
@ -2,12 +2,13 @@
|
|||
#include "kernel.hpp"
|
||||
|
||||
ServiceManager::ServiceManager(std::array<u32, 16>& regs, Memory& mem, GPU& gpu, u32& currentPID, Kernel& kernel)
|
||||
: regs(regs), mem(mem), kernel(kernel), apt(mem, kernel), cecd(mem), cfg(mem), dsp(mem), hid(mem),
|
||||
: regs(regs), mem(mem), kernel(kernel), ac(mem), apt(mem, kernel), 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) {}
|
||||
|
||||
static constexpr int MAX_NOTIFICATION_COUNT = 16;
|
||||
|
||||
void ServiceManager::reset() {
|
||||
ac.reset();
|
||||
apt.reset();
|
||||
cecd.reset();
|
||||
cfg.reset();
|
||||
|
@ -79,7 +80,9 @@ void ServiceManager::getServiceHandle(u32 messagePointer) {
|
|||
std::string service = mem.readString(messagePointer + 4, 8);
|
||||
log("srv::getServiceHandle (Service: %s, nameLength: %d, flags: %d)\n", service.c_str(), nameLength, flags);
|
||||
|
||||
if (service == "APT:S") { // TODO: APT:A, APT:S and APT:U are slightly different
|
||||
if (service == "ac:u") {
|
||||
handle = KernelHandles::AC;
|
||||
} else if (service == "APT:S") { // TODO: APT:A, APT:S and APT:U are slightly different
|
||||
handle = KernelHandles::APT;
|
||||
} else if (service == "APT:A") {
|
||||
handle = KernelHandles::APT;
|
||||
|
@ -136,6 +139,7 @@ void ServiceManager::receiveNotification(u32 messagePointer) {
|
|||
|
||||
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::CECD: cecd.handleSyncRequest(messagePointer); break;
|
||||
case KernelHandles::CFG: cfg.handleSyncRequest(messagePointer); break;
|
||||
|
|
Loading…
Add table
Reference in a new issue