1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-26 13:52:21 +00:00

Stratosphere: Skeleton ldr:dmnt

This commit is contained in:
Michael Scire 2018-04-18 03:30:34 -06:00
parent 21fa9ff17c
commit c4db563261
5 changed files with 65 additions and 4 deletions

View file

@ -0,0 +1,7 @@
#pragma once
#include <switch.h>
class IServiceObject {
public:
virtual void dispatch(IpcParsedCommand *r, u32 *cmd_buf, u32 cmd_id, u32 *in_rawdata, u32 in_rawdata_size, u32 *out_rawdata, u32 *out_raw_data_count);
};

View file

@ -0,0 +1,21 @@
#include <switch.h>
#include "ldr_debug_monitor.hpp"
#include "ldr_launch_queue.hpp"
void DebugMonitorService::dispatch(IpcParsedCommand *r, u32 *cmd_buf, u32 cmd_id, u32 *in_rawdata, u32 in_rawdata_size, u32 *out_rawdata, u32 *out_raw_data_count) {
/* TODO */
}
Result DebugMonitorService::add_title_to_launch_queue(u64 tid, const char *args, size_t args_size) {
return LaunchQueue::add(tid, args, args_size);
}
Result DebugMonitorService::clear_launch_queue() {
LaunchQueue::clear();
return 0;
}
Result DebugMonitorService::get_nso_info(u64 pid, void *out, size_t out_size, u32 *out_num_nsos) {
/* TODO, once I've defined struct NsoInfo elsewhere (in ldr_RegisteredProcesses.hpp) */
return 0;
}

View file

@ -0,0 +1,15 @@
#pragma once
#include <switch.h>
#include "iserviceobject.hpp"
class DebugMonitorService : IServiceObject {
public:
void dispatch(IpcParsedCommand *r, u32 *cmd_buf, u32 cmd_id, u32 *in_rawdata, u32 in_rawdata_size, u32 *out_rawdata, u32 *out_raw_data_count);
private:
/* Actual commands. */
Result add_title_to_launch_queue(u64 tid, const char *args, size_t args_size);
Result clear_launch_queue();
Result get_nso_info(u64 pid, void *out, size_t out_size, u32 *out_num_nsos);
};

View file

@ -1,11 +1,28 @@
#include <switch.h>
#include <algorithm>
#include "ldr_launch_queue.hpp"
#include <switch.h>
namespace LaunchQueue {
static LaunchItem g_launch_queue[LAUNCH_QUEUE_SIZE];
Result add(LaunchItem *item) {
Result add(u64 tid, const char *args, u64 arg_size) {
if(arg_size > LAUNCH_QUEUE_ARG_SIZE_MAX) {
return 0x209;
}
int idx = get_free_index(tid);
if(idx == LAUNCH_QUEUE_FULL)
return 0x409;
g_launch_queue[idx].tid = tid;
g_launch_queue[idx].arg_size = arg_size;
std::copy(args, args + arg_size, g_launch_queue[idx].args);
return 0x0;
}
Result add_item(const LaunchItem *item) {
if(item->arg_size > LAUNCH_QUEUE_ARG_SIZE_MAX) {
return 0x209;
}

View file

@ -13,7 +13,8 @@ namespace LaunchQueue {
char args[LAUNCH_QUEUE_ARG_SIZE_MAX];
};
Result add(LaunchItem *item);
Result add(u64 tid, const char *args, u64 arg_size);
Result add_item(const LaunchItem *item);
int get_index(u64 tid);
int get_free_index(u64 tid);
bool contains(u64 tid);