dmnt: update for new-ipc

This commit is contained in:
Michael Scire 2019-10-17 21:18:27 -07:00
parent e679446994
commit e94abc4b5e
3 changed files with 21 additions and 6 deletions

View File

@ -16,7 +16,9 @@
#pragma once #pragma once
#include "../os/os_common_types.hpp"
#include "../ncm/ncm_types.hpp" #include "../ncm/ncm_types.hpp"
#include "../sf/sf_buffer_tags.hpp"
namespace sts::dmnt::cheat { namespace sts::dmnt::cheat {
@ -26,7 +28,7 @@ namespace sts::dmnt::cheat {
u64 size; u64 size;
}; };
u64 process_id; os::ProcessId process_id;
ncm::TitleId title_id; ncm::TitleId title_id;
MemoryRegionExtents main_nso_extents; MemoryRegionExtents main_nso_extents;
MemoryRegionExtents heap_extents; MemoryRegionExtents heap_extents;
@ -37,18 +39,21 @@ namespace sts::dmnt::cheat {
static_assert(std::is_pod<CheatProcessMetadata>::value && sizeof(CheatProcessMetadata) == 0x70, "CheatProcessMetadata definition!"); static_assert(std::is_pod<CheatProcessMetadata>::value && sizeof(CheatProcessMetadata) == 0x70, "CheatProcessMetadata definition!");
struct CheatDefinition { struct CheatDefinition : sf::LargeData, sf::PrefersMapAliasTransferMode {
char readable_name[0x40]; char readable_name[0x40];
uint32_t num_opcodes; uint32_t num_opcodes;
uint32_t opcodes[0x100]; uint32_t opcodes[0x100];
}; };
struct CheatEntry { struct CheatEntry : sf::LargeData, sf::PrefersMapAliasTransferMode {
bool enabled; bool enabled;
uint32_t cheat_id; uint32_t cheat_id;
CheatDefinition definition; CheatDefinition definition;
}; };
static_assert(std::is_pod<CheatDefinition>::value, "CheatDefinition");
static_assert(std::is_pod<CheatEntry>::value, "CheatEntry");
struct FrozenAddressValue { struct FrozenAddressValue {
u64 value; u64 value;
u8 width; u8 width;

View File

@ -46,10 +46,14 @@ namespace sts::os {
inline constexpr const ProcessId InvalidProcessId = ProcessId::Invalid; inline constexpr const ProcessId InvalidProcessId = ProcessId::Invalid;
NX_INLINE Result GetProcessId(os::ProcessId *out, ::Handle process_handle) {
return svcGetProcessId(&out->value, process_handle);
}
NX_INLINE ProcessId GetCurrentProcessId() { NX_INLINE ProcessId GetCurrentProcessId() {
u64 current_process_id = 0; os::ProcessId current_process_id;
R_ASSERT(svcGetProcessId(&current_process_id, CUR_PROCESS_HANDLE)); R_ASSERT(GetProcessId(&current_process_id, CUR_PROCESS_HANDLE));
return os::ProcessId{current_process_id}; return current_process_id;
} }
inline constexpr bool operator==(const ProcessId &lhs, const ProcessId &rhs) { inline constexpr bool operator==(const ProcessId &lhs, const ProcessId &rhs) {

View File

@ -52,4 +52,10 @@ namespace sts::os {
} }
}; };
NX_INLINE u32 GetCurrentThreadPriority() {
u32 prio;
R_ASSERT(svcGetThreadPriority(&prio, CUR_THREAD_HANDLE));
return prio;
}
} }