Dmnt: Add break/continue commands, add static register api. (#899)

* dmnt: implement break/continue, static reg commands

* dmnt: revise per WerWolv's feedback.
This commit is contained in:
SciresM 2020-04-24 17:00:43 -07:00 committed by GitHub
parent b7c4dae899
commit be07035954
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 242 additions and 8 deletions

View file

@ -237,6 +237,22 @@ namespace ams::dmnt::cheat::impl {
this->LogToDebugFile("Act[%02x]: %d\n", i, opcode->save_restore_regmask.should_operate[i]);
}
break;
case CheatVmOpcodeType_ReadWriteStaticRegister:
this->LogToDebugFile("Opcode: Read/Write Static Register\n");
if (opcode->rw_static_reg.static_idx < NumReadableStaticRegisters) {
this->LogToDebugFile("Op Type: ReadStaticRegister\n");
} else {
this->LogToDebugFile("Op Type: WriteStaticRegister\n");
}
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");
break;
case CheatVmOpcodeType_ContinueProcess:
this->LogToDebugFile("Opcode: Continue Cheat Process\n");
break;
case CheatVmOpcodeType_DebugLog:
this->LogToDebugFile("Opcode: Debug Log\n");
this->LogToDebugFile("Bit Width: %x\n", opcode->debug_log.bit_width);
@ -570,6 +586,30 @@ namespace ams::dmnt::cheat::impl {
}
}
break;
case CheatVmOpcodeType_ReadWriteStaticRegister:
{
/* C3000XXx */
/* C3 = opcode 0xC3. */
/* XX = static register index. */
/* x = register index. */
opcode.rw_static_reg.static_idx = ((first_dword >> 4) & 0xFF);
opcode.rw_static_reg.idx = (first_dword & 0xF);
}
break;
case CheatVmOpcodeType_BreakProcess:
{
/* FF0????? */
/* FF0 = opcode 0xFF0 */
/* Breaks the current process. */
}
break;
case CheatVmOpcodeType_ContinueProcess:
{
/* FF1????? */
/* FF1 = opcode 0xFF1 */
/* Continues the current process. */
}
break;
case CheatVmOpcodeType_DebugLog:
{
/* FFFTIX## */
@ -1174,6 +1214,21 @@ namespace ams::dmnt::cheat::impl {
}
}
break;
case CheatVmOpcodeType_ReadWriteStaticRegister:
if (cur_opcode.rw_static_reg.static_idx < NumReadableStaticRegisters) {
/* Load a register with a static register. */
this->registers[cur_opcode.rw_static_reg.idx] = this->static_registers[cur_opcode.rw_static_reg.static_idx];
} else {
/* Store a register to a static register. */
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();
break;
case CheatVmOpcodeType_ContinueProcess:
dmnt::cheat::impl::ContinueCheatProcessUnsafe();
break;
case CheatVmOpcodeType_DebugLog:
{
/* Read value from memory. */