Add news:u

This commit is contained in:
wheremyfoodat 2023-08-21 16:45:35 +03:00
parent 3f2a546915
commit d3d426985a
7 changed files with 47 additions and 5 deletions

View file

@ -137,7 +137,7 @@ set(SERVICE_SOURCE_FILES src/core/services/service_manager.cpp src/core/services
src/core/services/y2r.cpp src/core/services/cam.cpp src/core/services/ldr_ro.cpp
src/core/services/act.cpp src/core/services/nfc.cpp src/core/services/dlp_srvr.cpp
src/core/services/ir_user.cpp src/core/services/http.cpp src/core/services/soc.cpp
src/core/services/ssl.cpp
src/core/services/ssl.cpp src/core/services/news_u.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/dynapica/shader_rec.cpp
@ -178,7 +178,7 @@ set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/termcolor.hpp
include/config.hpp include/services/ir_user.hpp include/http_server.hpp include/cheats.hpp
include/action_replay.hpp include/renderer_sw/renderer_sw.hpp include/compiler_builtins.hpp
include/fs/romfs.hpp include/fs/ivfc.hpp include/discord_rpc.hpp include/services/http.hpp include/result/result_cfg.hpp
include/math_util.hpp include/services/soc.hpp
include/math_util.hpp include/services/soc.hpp include/services/news_u.hpp
)
cmrc_add_resource_library(

View file

@ -34,6 +34,7 @@ namespace KernelHandles {
NFC, // NFC (Duh), used for Amiibo
NIM, // Updates, DLC, etc
NDM, // ?????
NEWS_U, // This service literally has 1 command (AddNotification) and I don't even understand what it does
PTM, // PTM service (Used for accessing various console info, such as battery, shell and pedometer state)
SOC, // Socket service
SSL, // SSL service (Totally didn't expect that)
@ -85,6 +86,7 @@ namespace KernelHandles {
case MCU_HWC: return "MCU::HWC";
case MIC: return "MIC";
case NDM: return "NDM";
case NEWS_U: return "NEWS_U";
case NFC: return "NFC";
case NIM: return "NIM";
case PTM: return "PTM";

View file

@ -50,6 +50,7 @@ namespace Log {
static Logger<false> ldrLogger;
static Logger<false> mcuLogger;
static Logger<false> micLogger;
static Logger<false> newsLogger;
static Logger<false> nfcLogger;
static Logger<false> nimLogger;
static Logger<false> ndmLogger;

View file

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

View file

@ -27,6 +27,7 @@
#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/ptm.hpp"
@ -66,9 +67,10 @@ class ServiceManager {
LCDService gsp_lcd;
LDRService ldr;
MICService mic;
NDMService ndm;
NewsUService news_u;
NFCService nfc;
NIMService nim;
NDMService ndm;
PTMService ptm;
SOCService soc;
SSLService ssl;

View file

@ -0,0 +1,15 @@
#include "ipc.hpp"
#include "services/news_u.hpp"
namespace NewsCommands {
enum : u32 {};
}
void NewsUService::reset() {}
void NewsUService::handleSyncRequest(u32 messagePointer) {
const u32 command = mem.read32(messagePointer);
switch (command) {
default: Helpers::panic("news:u service requested. Command: %08X\n", command);
}
}

View file

@ -9,7 +9,7 @@ ServiceManager::ServiceManager(std::span<u32, 16> regs, Memory& mem, GPU& gpu, u
: regs(regs), mem(mem), kernel(kernel), ac(mem), am(mem), boss(mem), act(mem), apt(mem, kernel), cam(mem, kernel), cecd(mem, kernel), cfg(mem),
dlp_srvr(mem), dsp(mem, kernel), hid(mem, kernel), http(mem), ir_user(mem, kernel), frd(mem), fs(mem, kernel),
gsp_gpu(mem, gpu, kernel, currentPID), gsp_lcd(mem), ldr(mem), mcu_hwc(mem, config), mic(mem), nfc(mem, kernel), nim(mem), ndm(mem),
ptm(mem, config), soc(mem), ssl(mem), y2r(mem, kernel) {}
news_u(mem), ptm(mem, config), soc(mem), ssl(mem), y2r(mem, kernel) {}
static constexpr int MAX_NOTIFICATION_COUNT = 16;
@ -35,8 +35,10 @@ void ServiceManager::reset() {
ldr.reset();
mcu_hwc.reset();
mic.reset();
nim.reset();
ndm.reset();
news_u.reset();
nfc.reset();
nim.reset();
ptm.reset();
soc.reset();
ssl.reset();
@ -114,6 +116,7 @@ static std::map<std::string, Handle> serviceMap = {
{ "mcu::HWC", KernelHandles::MCU_HWC },
{ "mic:u", KernelHandles::MIC },
{ "ndm:u", KernelHandles::NDM },
{ "news:u", KernelHandles::NEWS_U },
{ "nfc:u", KernelHandles::NFC },
{ "nim:aoc", KernelHandles::NIM },
{ "ptm:u", KernelHandles::PTM }, // TODO: ptm:u and ptm:sysm have very different command sets
@ -202,6 +205,7 @@ void ServiceManager::sendCommandToService(u32 messagePointer, Handle handle) {
case KernelHandles::NFC: nfc.handleSyncRequest(messagePointer); break;
case KernelHandles::NIM: nim.handleSyncRequest(messagePointer); break;
case KernelHandles::NDM: ndm.handleSyncRequest(messagePointer); break;
case KernelHandles::NEWS_U: news_u.handleSyncRequest(messagePointer); break;
case KernelHandles::PTM: ptm.handleSyncRequest(messagePointer); break;
case KernelHandles::SOC: soc.handleSyncRequest(messagePointer); break;
case KernelHandles::SSL: ssl.handleSyncRequest(messagePointer); break;