private void btnContinue_Click(object sender, EventArgs e) { if (this.dtSet.Tables[2].Rows.Count == 0) { if (this.Attached) { this.Attached = false; Commands.ps4ninja_detach(this.PID, this.Client); this.btnContinue.Text = "Stop"; UpdateUIControls(); } else { this.Attached = true; Commands.ps4ninja_attach(this.PID, 0, this.Client); UpdateDebugUI(); this.btnContinue.Text = "Continue"; } } else { Commands.ps4ninja_continue(this.PID, this.Client); byte[] regs = Commands.ps4ninja_read_regs(this.PID, this.Client); PS4CPU cpu = new PS4CPU(regs); String tmpRIP = string.Format("{0:X16}", cpu.r_rip - 1); foreach (System.Data.DataRow dr in this.dtSet.Tables[2].Rows) { if (Convert.ToString(dr["Address"]) == tmpRIP) { byte tmpOpcode = StringToByteArray(Convert.ToString(dr["OriginalByte"]))[0]; Commands.ps4ninja_exit_breakpoint(this.PID, tmpOpcode, this.Client); this.dtSet.Tables[2].Rows.Remove(dr); UpdateDebugUI(); return; } } } }
private void UpdateDebugUI() { byte[] regs = Commands.ps4ninja_read_regs(this.PID, this.Client); PS4CPU cpu = new PS4CPU(regs); this.ps4Cpu = cpu; this.txtRAX.Text = string.Format("{0:X16}", this.ps4Cpu.r_rax); this.txtRBX.Text = string.Format("{0:X16}", this.ps4Cpu.r_rbx); this.txtRCX.Text = string.Format("{0:X16}", this.ps4Cpu.r_rcx); this.txtRDX.Text = string.Format("{0:X16}", this.ps4Cpu.r_rdx); this.txtRDI.Text = string.Format("{0:X16}", this.ps4Cpu.r_rdi); this.txtRSI.Text = string.Format("{0:X16}", this.ps4Cpu.r_rsi); this.txtRBP.Text = string.Format("{0:X16}", this.ps4Cpu.r_rbp); this.txtRSP.Text = string.Format("{0:X16}", this.ps4Cpu.r_rsp); this.txtR15.Text = string.Format("{0:X16}", this.ps4Cpu.r_r15); this.txtR14.Text = string.Format("{0:X16}", this.ps4Cpu.r_r14); this.txtR13.Text = string.Format("{0:X16}", this.ps4Cpu.r_r13); this.txtR12.Text = string.Format("{0:X16}", this.ps4Cpu.r_r12); this.txtR11.Text = string.Format("{0:X16}", this.ps4Cpu.r_r11); this.txtR10.Text = string.Format("{0:X16}", this.ps4Cpu.r_r10); this.txtR9.Text = string.Format("{0:X16}", this.ps4Cpu.r_r9); this.txtR8.Text = string.Format("{0:X16}", this.ps4Cpu.r_r8); this.txtCS.Text = string.Format("{0:X16}", this.ps4Cpu.r_cs); this.txtDS.Text = string.Format("{0:X16}", this.ps4Cpu.r_ds); this.txtFP.Text = string.Format("{0:X16}", this.ps4Cpu.r_rflags); this.SelectedCodeAddr = this.ps4Cpu.r_rip; this.txtRIP.Text = string.Format("{0:X16}", this.ps4Cpu.r_rip); this.SelectedRIP = this.ps4Cpu.r_rip; this.FlagRegs = Utility.ReverseString(Convert.ToString((long)this.ps4Cpu.r_rflags, 2)); LoadNewCode(this.SelectedRIP, 0x100); UpdateUIControls(); }