1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-15 08:26:56 +00:00

pgl: implement InitializeProcessControlTask

This commit is contained in:
Michael Scire 2020-04-16 03:39:43 -07:00
parent 48f7697784
commit 25c392676b
2 changed files with 24 additions and 3 deletions

View file

@ -41,6 +41,11 @@ namespace ams::pgl::srv {
bool g_enable_crash_report_screenshot = true; bool g_enable_crash_report_screenshot = true;
bool g_enable_jit_debug = false; bool g_enable_jit_debug = false;
constexpr inline size_t ProcessControlTaskStackSize = 4_KB;
constexpr inline s32 ProcessControlTaskPriority = 21;
os::ThreadType g_process_control_task_thread;
alignas(os::ThreadStackAlignment) u8 g_process_control_task_stack[ProcessControlTaskStackSize];
os::SdkMutex g_process_data_mutex; os::SdkMutex g_process_data_mutex;
ProcessData g_process_data[ProcessDataCount]; ProcessData g_process_data[ProcessDataCount];
@ -131,10 +136,23 @@ namespace ams::pgl::srv {
return pm::shell::LaunchProgram(std::addressof(dummy_process_id), ncm::ProgramLocation::Make(ncm::SystemDebugAppletId::SnapShotDumper, ncm::StorageId::BuiltInSystem), pm::LaunchFlags_None); return pm::shell::LaunchProgram(std::addressof(dummy_process_id), ncm::ProgramLocation::Make(ncm::SystemDebugAppletId::SnapShotDumper, ncm::StorageId::BuiltInSystem), pm::LaunchFlags_None);
} }
void ProcessControlTask(void *) {
/* TODO */
}
} }
void InitializeProcessControlTask() { void InitializeProcessControlTask() {
/* TODO */ /* Create the task thread. */
R_ABORT_UNLESS(os::CreateThread(std::addressof(g_process_control_task_thread), ProcessControlTask, nullptr, g_process_control_task_stack, sizeof(g_process_control_task_stack), ProcessControlTaskPriority));
/* Retrieve settings. */
settings::fwdbg::GetSettingsItemValue(std::addressof(g_enable_jit_debug), sizeof(g_enable_jit_debug), "jit_debug", "enable_jit_debug");
settings::fwdbg::GetSettingsItemValue(std::addressof(g_enable_crash_report_screenshot), sizeof(g_enable_crash_report_screenshot), "creport", "crash_screen_shot");
g_is_production = !settings::fwdbg::IsDebugModeEnabled();
/* Start the thread. */
os::StartThread(std::addressof(g_process_control_task_thread));
} }
Result LaunchProgram(os::ProcessId *out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags) { Result LaunchProgram(os::ProcessId *out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags) {

View file

@ -17,8 +17,11 @@
namespace ams::settings::fwdbg { namespace ams::settings::fwdbg {
/* TODO: Implement when libnx wrapper is added. */ bool IsDebugModeEnabled() {
bool IsDebugModeEnabled(); bool value = false;
R_ABORT_UNLESS(::setsysGetDebugModeFlag(std::addressof(value)));
return value;
}
size_t WEAK_SYMBOL GetSettingsItemValueSize(const char *name, const char *key) { size_t WEAK_SYMBOL GetSettingsItemValueSize(const char *name, const char *key) {
u64 size = 0; u64 size = 0;