private void UpdateSnesState(Mesen.GUI.DebugState state) { RegisterA.DimUpperByte = CheckM.Checked = (state.Cpu.PS & ProcFlags.MemoryMode8) != 0; RegisterX.DimUpperByte = RegisterY.DimUpperByte = CheckX.Checked = (state.Cpu.PS & ProcFlags.IndexMode8) != 0; CheckEmu.Checked = state.Cpu.EmulationMode; RegisterPC.Value = state.Cpu.K << 16 | state.Cpu.PC; RegisterP.Value = (int)state.Cpu.PS; RegisterA.Value = state.Cpu.A; RegisterX.Value = state.Cpu.X; RegisterY.Value = state.Cpu.Y; RegisterDB.Value = state.Cpu.DBR; RegisterDP.Value = state.Cpu.D; RegisterSP.Value = state.Cpu.SP; _stackPointer = state.Cpu.SP; CheckC.Checked = (state.Cpu.PS & ProcFlags.Carry) != 0; CheckZ.Checked = (state.Cpu.PS & ProcFlags.Zero) != 0; CheckIrq.Checked = (state.Cpu.PS & ProcFlags.IrqDisable) != 0; CheckDec.Checked = (state.Cpu.PS & ProcFlags.Decimal) != 0; CheckV.Checked = (state.Cpu.PS & ProcFlags.Overflow) != 0; CheckN.Checked = (state.Cpu.PS & ProcFlags.Negative) != 0; _lastCycle = state.Cpu.CycleCount; _lastFrame = state.Ppu.FrameCount; if (_lastCycle < _cycleBase) { _cycleBase = 0; } if (_lastFrame < _frameBase) { _frameBase = 0; } EditCycle.Text = (_lastCycle - _cycleBase).ToString(); EditScanline.Text = state.Ppu.Scanline.ToString(); EditPixel.Text = state.Ppu.Cycle.ToString(); EditFrame.Text = (_lastFrame - _frameBase).ToString(); }
[DllImport(DllPath, EntryPoint = "GetState")] private static extern void GetStateWrapper(ref DebugState state);
[DllImport(DLLPath)] public static extern void DebugGetState(ref DebugState state);