2018-04-19 06:00:10 +01:00
|
|
|
#pragma once
|
|
|
|
#include <switch.h>
|
|
|
|
|
|
|
|
#define REGISTRATION_LIST_MAX (0x40)
|
|
|
|
|
|
|
|
#define NSO_INFO_MAX (0x20)
|
|
|
|
|
|
|
|
class Registration {
|
|
|
|
public:
|
|
|
|
struct NsoInfo {
|
|
|
|
u64 base_address;
|
|
|
|
u64 size;
|
|
|
|
unsigned char build_id[0x20];
|
|
|
|
};
|
|
|
|
|
2018-04-19 23:14:48 +01:00
|
|
|
struct NsoInfoHolder {
|
|
|
|
bool in_use;
|
|
|
|
NsoInfo info;
|
|
|
|
};
|
|
|
|
|
2018-04-19 06:00:10 +01:00
|
|
|
struct TidSid {
|
|
|
|
u64 title_id;
|
|
|
|
FsStorageId storage_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Process {
|
|
|
|
bool in_use;
|
2018-04-26 21:53:33 +01:00
|
|
|
bool is_64_bit_addspace;
|
2018-04-19 06:00:10 +01:00
|
|
|
u64 index;
|
|
|
|
u64 process_id;
|
|
|
|
u64 title_id_min;
|
|
|
|
Registration::TidSid tid_sid;
|
2018-04-19 23:14:48 +01:00
|
|
|
Registration::NsoInfoHolder nso_infos[NSO_INFO_MAX];
|
2018-04-19 06:00:10 +01:00
|
|
|
u64 _0x730;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct List {
|
|
|
|
Registration::Process processes[REGISTRATION_LIST_MAX];
|
|
|
|
u64 num_processes;
|
|
|
|
};
|
|
|
|
|
|
|
|
static Registration::Process *get_free_process();
|
|
|
|
static Registration::Process *get_process(u64 index);
|
2018-04-19 23:14:48 +01:00
|
|
|
static Registration::Process *get_process_by_process_id(u64 pid);
|
2018-04-22 02:52:49 +01:00
|
|
|
static Result get_registered_tid_sid(u64 index, Registration::TidSid *out);
|
2018-04-19 06:00:10 +01:00
|
|
|
static bool register_tid_sid(const TidSid *tid_sid, u64 *out_index);
|
|
|
|
static bool unregister_index(u64 index);
|
2018-04-26 21:53:33 +01:00
|
|
|
static void set_process_id_tid_min_and_is_64_bit_addspace(u64 index, u64 process_id, u64 tid_min, bool is_64_bit_addspace);
|
2018-04-19 06:00:10 +01:00
|
|
|
static void add_nso_info(u64 index, u64 base_address, u64 size, const unsigned char *build_id);
|
2018-04-19 23:14:48 +01:00
|
|
|
static Result get_nso_infos_for_process_id(NsoInfo *out, u32 max_out, u64 process_id, u32 *num_written);
|
2018-04-19 06:00:10 +01:00
|
|
|
};
|