1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-22 20:06:40 +00:00

dmnt-cheat: Fix a few bugs in vm.

This commit is contained in:
Michael Scire 2019-03-15 18:29:43 -07:00
parent 433b01aaf8
commit 7551bebb88
2 changed files with 4 additions and 3 deletions

View file

@ -147,6 +147,7 @@ void DmntCheatVm::LogOpcode(const CheatVmOpcode *opcode) {
case CheatVmOpcodeType_BeginRegisterConditionalBlock:
this->LogToDebugFile("Opcode: Begin Register Conditional\n");
this->LogToDebugFile("Bit Width: %x\n", opcode->begin_reg_cond.bit_width);
this->LogToDebugFile("Cond Type: %x\n", opcode->begin_reg_cond.cond_type);
this->LogToDebugFile("V Reg Idx: %x\n", opcode->begin_reg_cond.val_reg_index);
switch (opcode->begin_reg_cond.comp_type) {
case CompareRegisterValueType_StaticValue:
@ -300,7 +301,7 @@ bool DmntCheatVm::DecodeNextOpcode(CheatVmOpcode *out) {
{
/* 400R0000 VVVVVVVV VVVVVVVV */
/* Read additional words. */
opcode.ldr_static.reg_index = ((first_dword >> 20) & 0xF);
opcode.ldr_static.reg_index = ((first_dword >> 16) & 0xF);
opcode.ldr_static.value = (((u64)GetNextDword()) << 32ul) | ((u64)GetNextDword());
}
break;
@ -461,7 +462,7 @@ void DmntCheatVm::SkipConditionalBlock() {
const size_t desired_depth = this->condition_depth - 1;
CheatVmOpcode skip_opcode;
while (this->DecodeNextOpcode(&skip_opcode) && this->condition_depth > desired_depth) {
while (this->condition_depth > desired_depth && this->DecodeNextOpcode(&skip_opcode)) {
/* Decode instructions until we see end of the current conditional block. */
/* NOTE: This is broken in gateway's implementation. */
/* Gateway currently checks for "0x2" instead of "0x20000000" */

View file

@ -26,7 +26,7 @@ Result HidManagement::GetKeysDown(u64 *keys) {
std::scoped_lock<HosMutex> lk(g_hid_keys_down_lock);
hidScanInput();
*keys = hidKeysDown(CONTROLLER_P1_AUTO);
*keys = hidKeysHeld(CONTROLLER_P1_AUTO);
return 0x0;
}