mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-14 00:56:35 +00:00
Stratosphere: Skeleton ldr:dmnt
This commit is contained in:
parent
21fa9ff17c
commit
c4db563261
5 changed files with 65 additions and 4 deletions
7
stratosphere/loader/source/iserviceobject.hpp
Normal file
7
stratosphere/loader/source/iserviceobject.hpp
Normal 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);
|
||||||
|
};
|
21
stratosphere/loader/source/ldr_debug_monitor.cpp
Normal file
21
stratosphere/loader/source/ldr_debug_monitor.cpp
Normal 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;
|
||||||
|
}
|
15
stratosphere/loader/source/ldr_debug_monitor.hpp
Normal file
15
stratosphere/loader/source/ldr_debug_monitor.hpp
Normal 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);
|
||||||
|
};
|
|
@ -1,11 +1,28 @@
|
||||||
|
#include <switch.h>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "ldr_launch_queue.hpp"
|
#include "ldr_launch_queue.hpp"
|
||||||
|
|
||||||
#include <switch.h>
|
|
||||||
|
|
||||||
namespace LaunchQueue {
|
namespace LaunchQueue {
|
||||||
static LaunchItem g_launch_queue[LAUNCH_QUEUE_SIZE];
|
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) {
|
if(item->arg_size > LAUNCH_QUEUE_ARG_SIZE_MAX) {
|
||||||
return 0x209;
|
return 0x209;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,8 @@ namespace LaunchQueue {
|
||||||
char args[LAUNCH_QUEUE_ARG_SIZE_MAX];
|
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_index(u64 tid);
|
||||||
int get_free_index(u64 tid);
|
int get_free_index(u64 tid);
|
||||||
bool contains(u64 tid);
|
bool contains(u64 tid);
|
||||||
|
|
Loading…
Reference in a new issue