dmnt: refactor to use sts:: namespace.
This commit is contained in:
20
stratosphere/libstratosphere/include/stratosphere/dmnt.hpp
Normal file
20
stratosphere/libstratosphere/include/stratosphere/dmnt.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <switch.h>
|
||||
|
||||
#include "dmnt/dmnt_cheat_types.hpp"
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../ncm/ncm_types.hpp"
|
||||
|
||||
namespace sts::dmnt::cheat {
|
||||
|
||||
struct CheatProcessMetadata {
|
||||
struct MemoryRegionExtents {
|
||||
u64 base;
|
||||
u64 size;
|
||||
};
|
||||
|
||||
u64 process_id;
|
||||
ncm::TitleId title_id;
|
||||
MemoryRegionExtents main_nso_extents;
|
||||
MemoryRegionExtents heap_extents;
|
||||
MemoryRegionExtents alias_extents;
|
||||
MemoryRegionExtents aslr_extents;
|
||||
u8 main_nso_build_id[0x20];
|
||||
};
|
||||
|
||||
static_assert(std::is_pod<CheatProcessMetadata>::value && sizeof(CheatProcessMetadata) == 0x70, "CheatProcessMetadata definition!");
|
||||
|
||||
struct CheatDefinition {
|
||||
char readable_name[0x40];
|
||||
uint32_t num_opcodes;
|
||||
uint32_t opcodes[0x100];
|
||||
};
|
||||
|
||||
struct CheatEntry {
|
||||
bool enabled;
|
||||
uint32_t cheat_id;
|
||||
CheatDefinition definition;
|
||||
};
|
||||
|
||||
struct FrozenAddressValue {
|
||||
u64 value;
|
||||
u8 width;
|
||||
};
|
||||
|
||||
struct FrozenAddressEntry {
|
||||
u64 address;
|
||||
FrozenAddressValue value;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -224,24 +224,33 @@ class HosSignal {
|
||||
mutexUnlock(&m);
|
||||
}
|
||||
|
||||
void Wait() {
|
||||
void Wait(bool reset = false) {
|
||||
mutexLock(&m);
|
||||
|
||||
while (!signaled) {
|
||||
condvarWait(&cv, &m);
|
||||
}
|
||||
|
||||
if (reset) {
|
||||
this->signaled = false;
|
||||
}
|
||||
|
||||
mutexUnlock(&m);
|
||||
}
|
||||
|
||||
bool TryWait() {
|
||||
bool TryWait(bool reset = false) {
|
||||
mutexLock(&m);
|
||||
|
||||
bool success = signaled;
|
||||
if (reset) {
|
||||
this->signaled = false;
|
||||
}
|
||||
|
||||
mutexUnlock(&m);
|
||||
return success;
|
||||
}
|
||||
|
||||
Result TimedWait(u64 ns) {
|
||||
Result TimedWait(u64 ns, bool reset = false) {
|
||||
mutexLock(&m);
|
||||
TimeoutHelper timeout_helper(ns);
|
||||
|
||||
@@ -251,6 +260,10 @@ class HosSignal {
|
||||
}
|
||||
}
|
||||
|
||||
if (reset) {
|
||||
this->signaled = false;
|
||||
}
|
||||
|
||||
mutexUnlock(&m);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20,4 +20,5 @@
|
||||
#include "pm/pm_types.hpp"
|
||||
#include "pm/pm_boot_mode_api.hpp"
|
||||
#include "pm/pm_info_api.hpp"
|
||||
#include "pm/pm_shell_api.hpp"
|
||||
#include "pm/pm_shell_api.hpp"
|
||||
#include "pm/pm_dmnt_api.hpp"
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../ldr.hpp"
|
||||
#include "pm_types.hpp"
|
||||
|
||||
namespace sts::pm::dmnt {
|
||||
|
||||
/* Debug Monitor API. */
|
||||
Result StartProcess(u64 process_id);
|
||||
Result GetProcessId(u64 *out_process_id, const ncm::TitleId title_id);
|
||||
Result GetApplicationProcessId(u64 *out_process_id);
|
||||
Result HookToCreateApplicationProcess(Handle *out_handle);
|
||||
Result AtmosphereGetProcessInfo(Handle *out_handle, ncm::TitleLocation *out_loc, u64 process_id);
|
||||
Result AtmosphereGetCurrentLimitInfo(u64 *out_current_value, u64 *out_limit_value, ResourceLimitGroup group, LimitableResource resource);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user