mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-29 23:32:23 +00:00
dmnt-cheat: fix compat
This commit is contained in:
parent
afae7eaa11
commit
8d140d835a
2 changed files with 18 additions and 5 deletions
|
@ -106,7 +106,8 @@
|
||||||
"svcReadDebugProcessMemory": "0x6a",
|
"svcReadDebugProcessMemory": "0x6a",
|
||||||
"svcWriteDebugProcessMemory": "0x6b",
|
"svcWriteDebugProcessMemory": "0x6b",
|
||||||
"svcSetHardwareBreakPoint": "0x6c",
|
"svcSetHardwareBreakPoint": "0x6c",
|
||||||
"svcGetDebugThreadParam": "0x6d"
|
"svcGetDebugThreadParam": "0x6d",
|
||||||
|
"svcCallSecureMonitor": "0x7f"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"type": "min_kernel_version",
|
"type": "min_kernel_version",
|
||||||
|
|
|
@ -63,8 +63,8 @@ bool DmntCheatManager::HasActiveCheatProcess() {
|
||||||
void DmntCheatManager::ContinueCheatProcess() {
|
void DmntCheatManager::ContinueCheatProcess() {
|
||||||
if (HasActiveCheatProcess()) {
|
if (HasActiveCheatProcess()) {
|
||||||
/* Loop getting debug events. */
|
/* Loop getting debug events. */
|
||||||
u8 tmp;
|
u64 debug_event_buf[0x50];
|
||||||
while (R_SUCCEEDED(svcGetDebugEvent(&tmp, g_cheat_process_debug_hnd))) {
|
while (R_SUCCEEDED(svcGetDebugEvent((u8 *)debug_event_buf, g_cheat_process_debug_hnd))) {
|
||||||
/* ... */
|
/* ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,6 +130,13 @@ static void PopulateMemoryExtents(MemoryRegionExtents *extents, Handle p_h, u64
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void StartDebugProcess(u64 pid) {
|
||||||
|
Result rc = pmdmntStartProcess(pid);
|
||||||
|
if (R_FAILED(rc)) {
|
||||||
|
fatalSimple(rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DmntCheatManager::OnNewApplicationLaunch() {
|
void DmntCheatManager::OnNewApplicationLaunch() {
|
||||||
std::scoped_lock<HosMutex> lk(g_cheat_lock);
|
std::scoped_lock<HosMutex> lk(g_cheat_lock);
|
||||||
Result rc;
|
Result rc;
|
||||||
|
@ -166,7 +173,7 @@ void DmntCheatManager::OnNewApplicationLaunch() {
|
||||||
{
|
{
|
||||||
LoaderModuleInfo proc_modules[2];
|
LoaderModuleInfo proc_modules[2];
|
||||||
u32 num_modules;
|
u32 num_modules;
|
||||||
if (R_FAILED((rc = ldrDmntGetModuleInfos(g_cheat_process_metadata.process_id, proc_modules, 2, &num_modules)))) {
|
if (R_FAILED((rc = ldrDmntGetModuleInfos(g_cheat_process_metadata.process_id, proc_modules, sizeof(proc_modules), &num_modules)))) {
|
||||||
fatalSimple(rc);
|
fatalSimple(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,6 +181,7 @@ void DmntCheatManager::OnNewApplicationLaunch() {
|
||||||
/* If we only have one, we must be e.g. mitming HBL. */
|
/* If we only have one, we must be e.g. mitming HBL. */
|
||||||
/* We don't want to fuck with HBL. */
|
/* We don't want to fuck with HBL. */
|
||||||
if (num_modules != 2) {
|
if (num_modules != 2) {
|
||||||
|
StartDebugProcess(g_cheat_process_metadata.process_id);
|
||||||
g_cheat_process_metadata.process_id = 0;
|
g_cheat_process_metadata.process_id = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -182,14 +190,18 @@ void DmntCheatManager::OnNewApplicationLaunch() {
|
||||||
g_cheat_process_metadata.main_nso_extents.size = proc_modules[1].size;
|
g_cheat_process_metadata.main_nso_extents.size = proc_modules[1].size;
|
||||||
memcpy(g_cheat_process_metadata.main_nso_build_id, proc_modules[1].build_id, sizeof(g_cheat_process_metadata.main_nso_build_id));
|
memcpy(g_cheat_process_metadata.main_nso_build_id, proc_modules[1].build_id, sizeof(g_cheat_process_metadata.main_nso_build_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Read cheats off the SD. */
|
/* TODO: Read cheats off the SD. */
|
||||||
|
|
||||||
|
|
||||||
/* Open a debug handle. */
|
/* Open a debug handle. */
|
||||||
if (R_FAILED((rc = svcDebugActiveProcess(&g_cheat_process_debug_hnd, g_cheat_process_metadata.process_id)))) {
|
if (R_FAILED((rc = svcDebugActiveProcess(&g_cheat_process_debug_hnd, g_cheat_process_metadata.process_id)))) {
|
||||||
fatalSimple(rc);
|
fatalSimple(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Start the process. */
|
||||||
|
StartDebugProcess(g_cheat_process_metadata.process_id);
|
||||||
|
|
||||||
/* Continue debug events, etc. */
|
/* Continue debug events, etc. */
|
||||||
ContinueCheatProcess();
|
ContinueCheatProcess();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue