dmnt: move stuff around slightly, add client bindings

This commit is contained in:
Michael Scire
2020-04-24 17:24:15 -07:00
parent be07035954
commit 1d40a08ef9
9 changed files with 95 additions and 51 deletions

View File

@@ -265,13 +265,13 @@ namespace ams::dmnt::cheat::impl {
return ResultSuccess();
}
Result BreakCheatProcessUnsafe() {
Result PauseCheatProcessUnsafe() {
this->broken_unsafe = true;
this->unsafe_break_event.Clear();
return svcBreakDebugProcess(this->GetCheatProcessHandle());
}
Result ContinueCheatProcessUnsafe() {
Result ResumeCheatProcessUnsafe() {
this->broken_unsafe = false;
this->unsafe_break_event.Signal();
dmnt::cheat::impl::ContinueCheatProcess(this->GetCheatProcessHandle());
@@ -356,20 +356,20 @@ namespace ams::dmnt::cheat::impl {
return svcQueryDebugProcessMemory(mapping, &tmp, this->GetCheatProcessHandle(), address);
}
Result BreakCheatProcess() {
Result PauseCheatProcess() {
std::scoped_lock lk(this->cheat_lock);
R_TRY(this->EnsureCheatProcess());
return this->BreakCheatProcessUnsafe();
return this->PauseCheatProcessUnsafe();
}
Result ContinueCheatProcess() {
Result ResumeCheatProcess() {
std::scoped_lock lk(this->cheat_lock);
R_TRY(this->EnsureCheatProcess());
return this->ContinueCheatProcessUnsafe();
return this->ResumeCheatProcessUnsafe();
}
Result GetCheatCount(u64 *out_count) {
@@ -1096,6 +1096,14 @@ namespace ams::dmnt::cheat::impl {
return GetReference(g_cheat_process_manager).ForceOpenCheatProcess();
}
Result PauseCheatProcess() {
return GetReference(g_cheat_process_manager).PauseCheatProcess();
}
Result ResumeCheatProcess() {
return GetReference(g_cheat_process_manager).ResumeCheatProcess();
}
Result ReadCheatProcessMemoryUnsafe(u64 process_addr, void *out_data, size_t size) {
return GetReference(g_cheat_process_manager).ReadCheatProcessMemoryUnsafe(process_addr, out_data, size);
}
@@ -1104,12 +1112,12 @@ namespace ams::dmnt::cheat::impl {
return GetReference(g_cheat_process_manager).WriteCheatProcessMemoryUnsafe(process_addr, data, size);
}
Result BreakCheatProcessUnsafe() {
return GetReference(g_cheat_process_manager).BreakCheatProcessUnsafe();
Result PauseCheatProcessUnsafe() {
return GetReference(g_cheat_process_manager).PauseCheatProcessUnsafe();
}
Result ContinueCheatProcessUnsafe() {
return GetReference(g_cheat_process_manager).ContinueCheatProcessUnsafe();
Result ResumeCheatProcessUnsafe() {
return GetReference(g_cheat_process_manager).ResumeCheatProcessUnsafe();
}
Result GetCheatProcessMappingCount(u64 *out_count) {
@@ -1132,14 +1140,6 @@ namespace ams::dmnt::cheat::impl {
return GetReference(g_cheat_process_manager).QueryCheatProcessMemory(mapping, address);
}
Result BreakCheatProcess() {
return GetReference(g_cheat_process_manager).BreakCheatProcess();
}
Result ContinueCheatProcess() {
return GetReference(g_cheat_process_manager).ContinueCheatProcess();
}
Result GetCheatCount(u64 *out_count) {
return GetReference(g_cheat_process_manager).GetCheatCount(out_count);
}

View File

@@ -24,20 +24,20 @@ namespace ams::dmnt::cheat::impl {
Handle GetCheatProcessEventHandle();
Result GetCheatProcessMetadata(CheatProcessMetadata *out);
Result ForceOpenCheatProcess();
Result PauseCheatProcess();
Result ResumeCheatProcess();
Result ReadCheatProcessMemoryUnsafe(u64 process_addr, void *out_data, size_t size);
Result WriteCheatProcessMemoryUnsafe(u64 process_addr, void *data, size_t size);
Result BreakCheatProcessUnsafe();
Result ContinueCheatProcessUnsafe();
Result PauseCheatProcessUnsafe();
Result ResumeCheatProcessUnsafe();
Result GetCheatProcessMappingCount(u64 *out_count);
Result GetCheatProcessMappings(MemoryInfo *mappings, size_t max_count, u64 *out_count, u64 offset);
Result ReadCheatProcessMemory(u64 proc_addr, void *out_data, size_t size);
Result WriteCheatProcessMemory(u64 proc_addr, const void *data, size_t size);
Result QueryCheatProcessMemory(MemoryInfo *mapping, u64 address);
Result BreakCheatProcess();
Result ContinueCheatProcess();
Result GetCheatCount(u64 *out_count);
Result GetCheats(CheatEntry *cheats, size_t max_count, u64 *out_count, u64 offset);

View File

@@ -247,11 +247,11 @@ namespace ams::dmnt::cheat::impl {
this->LogToDebugFile("Reg Idx: %x\n", opcode->rw_static_reg.idx);
this->LogToDebugFile("Stc Idx: %x\n", opcode->rw_static_reg.static_idx);
break;
case CheatVmOpcodeType_BreakProcess:
this->LogToDebugFile("Opcode: Break Cheat Process\n");
case CheatVmOpcodeType_PauseProcess:
this->LogToDebugFile("Opcode: Pause Cheat Process\n");
break;
case CheatVmOpcodeType_ContinueProcess:
this->LogToDebugFile("Opcode: Continue Cheat Process\n");
case CheatVmOpcodeType_ResumeProcess:
this->LogToDebugFile("Opcode: Resume Cheat Process\n");
break;
case CheatVmOpcodeType_DebugLog:
this->LogToDebugFile("Opcode: Debug Log\n");
@@ -596,18 +596,18 @@ namespace ams::dmnt::cheat::impl {
opcode.rw_static_reg.idx = (first_dword & 0xF);
}
break;
case CheatVmOpcodeType_BreakProcess:
case CheatVmOpcodeType_PauseProcess:
{
/* FF0????? */
/* FF0 = opcode 0xFF0 */
/* Breaks the current process. */
/* Pauses the current process. */
}
break;
case CheatVmOpcodeType_ContinueProcess:
case CheatVmOpcodeType_ResumeProcess:
{
/* FF1????? */
/* FF1 = opcode 0xFF1 */
/* Continues the current process. */
/* Resumes the current process. */
}
break;
case CheatVmOpcodeType_DebugLog:
@@ -1223,11 +1223,11 @@ namespace ams::dmnt::cheat::impl {
this->static_registers[cur_opcode.rw_static_reg.static_idx] = this->registers[cur_opcode.rw_static_reg.idx];
}
break;
case CheatVmOpcodeType_BreakProcess:
dmnt::cheat::impl::BreakCheatProcessUnsafe();
case CheatVmOpcodeType_PauseProcess:
dmnt::cheat::impl::PauseCheatProcessUnsafe();
break;
case CheatVmOpcodeType_ContinueProcess:
dmnt::cheat::impl::ContinueCheatProcessUnsafe();
case CheatVmOpcodeType_ResumeProcess:
dmnt::cheat::impl::ResumeCheatProcessUnsafe();
break;
case CheatVmOpcodeType_DebugLog:
{

View File

@@ -49,8 +49,8 @@ namespace ams::dmnt::cheat::impl {
CheatVmOpcodeType_DoubleExtendedWidth = 0xF0,
/* Double-extended width opcodes. */
CheatVmOpcodeType_BreakProcess = 0xFF0,
CheatVmOpcodeType_ContinueProcess = 0xFF1,
CheatVmOpcodeType_PauseProcess = 0xFF0,
CheatVmOpcodeType_ResumeProcess = 0xFF1,
CheatVmOpcodeType_DebugLog = 0xFFF,
};