Esempio n. 1
0
        private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case InteropEmu.ConsoleNotificationType.EmulationStopped:
                this._scriptId = -1;
                break;

            case InteropEmu.ConsoleNotificationType.GameStopped:
                if (e.Parameter == IntPtr.Zero)
                {
                    this._scriptId = -1;
                }
                break;

            case InteropEmu.ConsoleNotificationType.GameInitCompleted:
                bool wasRunning = this._scriptId >= 0;
                this._scriptId = -1;
                this.BeginInvoke((Action)(() => {
                    lblScriptActive.Visible = false;
                    if (e.NotificationType == InteropEmu.ConsoleNotificationType.GameInitCompleted && wasRunning && mnuAutoRestart.Checked)
                    {
                        RunScript();
                    }
                }));
                break;
            }
        }
Esempio n. 2
0
        private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case InteropEmu.ConsoleNotificationType.CodeBreak:
            case InteropEmu.ConsoleNotificationType.GamePaused:
                if (ConfigManager.Config.DebugInfo.TextHookerRefreshOnBreak)
                {
                    this.GetData();
                    this.BeginInvoke((MethodInvoker)(() => this.RefreshViewers()));
                }
                break;

            case InteropEmu.ConsoleNotificationType.PpuViewerDisplayFrame:
                if (e.Parameter.ToInt32() == _ppuViewerId)
                {
                    if (ConfigManager.Config.DebugInfo.TextHookerAutoRefresh && !_refreshing && (DateTime.Now - _lastUpdate).Milliseconds > 66)
                    {
                        //Update at 15 fps at most
                        this.GetData();
                        this.BeginInvoke((MethodInvoker)(() => this.RefreshViewers()));
                        _lastUpdate = DateTime.Now;
                    }
                }
                break;

            case InteropEmu.ConsoleNotificationType.GameLoaded:
                //Configuration is lost when debugger is restarted (when switching game or power cycling)
                ctrlScanlineCycle.RefreshSettings();
                break;
            }
        }
Esempio n. 3
0
 private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
 {
     if (e.NotificationType == InteropEmu.ConsoleNotificationType.CodeBreak)
     {
         this.BeginInvoke((MethodInvoker)(() => this.RefreshData()));
     }
 }
Esempio n. 4
0
        private void HandleNotification(InteropEmu.NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case InteropEmu.ConsoleNotificationType.GameLoaded:
                if (InteropEmu.IsRunning())
                {
                    RefreshBreakpoints();
                }
                GameLoaded();
                if (OnRun != null)
                {
                    OnRun();
                }
                if (OnStatusChange != null)
                {
                    OnStatusChange(EmulatorStatus.Playing);
                }
                EmitDebugData();
                return;

            case InteropEmu.ConsoleNotificationType.CodeBreak:
                var source = (BreakSource)(byte)e.Parameter.ToInt64();
                //if (source == BreakSource.Breakpoint && OnBreak != null)
                if (OnBreak != null)
                {
                    DebugState state = default(DebugState);
                    InteropEmu.DebugGetState(ref state);
                    var address = InteropEmu.DebugGetAbsoluteAddress(state.CPU.DebugPC);
                    OnBreak(address);
                }
                if (OnStatusChange != null)
                {
                    OnStatusChange(EmulatorStatus.Paused);
                }
                EmitDebugData();
                return;

            case InteropEmu.ConsoleNotificationType.PpuFrameDone:
                CountFrame();
                return;
            }

            if (e.NotificationType == InteropEmu.ConsoleNotificationType.PpuFrameDone)
            {
                return;
            }
            if (e.NotificationType == InteropEmu.ConsoleNotificationType.EventViewerDisplayFrame)
            {
                return;
            }

            var status = string.Format("Emulator: {0}", e.NotificationType.ToString());

            _logHandler(new LogData(status, LogType.Normal));
        }
Esempio n. 5
0
 private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
 {
     if (e.NotificationType == InteropEmu.ConsoleNotificationType.GameStopped)
     {
         this._scriptId = -1;
         this.BeginInvoke((Action)(() => {
             lblScriptActive.Visible = false;
         }));
     }
 }
Esempio n. 6
0
 private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
 {
     if (e.NotificationType == InteropEmu.ConsoleNotificationType.CodeBreak)
     {
         this.BeginInvoke((MethodInvoker)(() => this.RefreshViewers()));
     }
     else if (e.NotificationType == InteropEmu.ConsoleNotificationType.PpuFrameDone)
     {
         this.BeginInvoke((MethodInvoker)(() => this.AutoRefresh()));
     }
 }
Esempio n. 7
0
        private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case InteropEmu.ConsoleNotificationType.CodeBreak:
                this.BeginInvoke((MethodInvoker)(() => this.RefreshData()));
                break;

            case InteropEmu.ConsoleNotificationType.GameReset:
            case InteropEmu.ConsoleNotificationType.GameLoaded:
                this.BeginInvoke((Action)(() => {
                    if (_formClosed)
                    {
                        return;
                    }
                    this.InitMemoryTypeDropdown(false);
                    ctrlMemoryAccessCounters.InitMemoryTypeDropdown();
                }));
                this.UpdateFlags();
                break;

            case InteropEmu.ConsoleNotificationType.PpuFrameDone:
                int refreshDelay = 90;
                switch (ConfigManager.Config.DebugInfo.RamAutoRefreshSpeed)
                {
                case RefreshSpeed.Low: refreshDelay = 90; break;

                case RefreshSpeed.Normal: refreshDelay = 32; break;

                case RefreshSpeed.High: refreshDelay = 16; break;
                }

                if (_selectedTab == tpgProfiler)
                {
                    refreshDelay *= 10;
                }

                DateTime now = DateTime.Now;
                if (!_updating && ConfigManager.Config.DebugInfo.RamAutoRefresh && (now - _lastUpdate).Milliseconds >= refreshDelay)
                {
                    _lastUpdate = now;
                    _updating   = true;
                    this.BeginInvoke((Action)(() => {
                        this.RefreshData();
                        _updating = false;
                    }));
                }
                break;
            }
        }
Esempio n. 8
0
 private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
 {
     switch (e.NotificationType)
     {
     case InteropEmu.ConsoleNotificationType.CodeBreak:
     case InteropEmu.ConsoleNotificationType.GamePaused:
         if (_config.EventViewerRefreshOnBreak)
         {
             this.RefreshData();
             this.BeginInvoke((MethodInvoker)(() => this.RefreshViewer()));
         }
         break;
     }
 }
Esempio n. 9
0
        private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case InteropEmu.ConsoleNotificationType.PpuFrameDone:
                this.BeginInvoke((MethodInvoker)(() => {
                    ctrlWatch.UpdateWatch(false);
                }));
                break;

            case InteropEmu.ConsoleNotificationType.CodeBreak:
                this.BeginInvoke((MethodInvoker)(() => {
                    ctrlWatch.UpdateWatch(false);
                }));
                break;
            }
        }
Esempio n. 10
0
        private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case InteropEmu.ConsoleNotificationType.CodeBreak:
                this.BeginInvoke((MethodInvoker)(() => UpdateDebugger()));
                BreakpointManager.SetBreakpoints();
                InteropEmu.DebugSetFlags(mnuPpuPartialDraw.Checked ? DebuggerFlags.PpuPartialDraw : DebuggerFlags.None);
                break;

            case InteropEmu.ConsoleNotificationType.GameReset:
            case InteropEmu.ConsoleNotificationType.GameLoaded:
                BreakpointManager.SetBreakpoints();
                InteropEmu.DebugStep(1);
                break;
            }
        }
Esempio n. 11
0
 void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
 {
     if (e.NotificationType == InteropEmu.ConsoleNotificationType.CodeBreak)
     {
         this.BeginInvoke((MethodInvoker)(() => this.RefreshData()));
     }
     else if (e.NotificationType == InteropEmu.ConsoleNotificationType.PpuFrameDone)
     {
         this.BeginInvoke((MethodInvoker)(() => {
             if (_autoRefreshCounter % 4 == 0 && this.mnuAutoRefresh.Checked)
             {
                 this.RefreshData();
             }
             _autoRefreshCounter++;
         }));
     }
 }
Esempio n. 12
0
 private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
 {
     if (e.NotificationType == InteropEmu.ConsoleNotificationType.CodeBreak)
     {
         this.GetData();
         this.BeginInvoke((MethodInvoker)(() => this.RefreshViewers()));
     }
     else if (e.NotificationType == InteropEmu.ConsoleNotificationType.PpuViewerDisplayFrame)
     {
         if (ConfigManager.Config.DebugInfo.PpuAutoRefresh && !_refreshing && (DateTime.Now - _lastUpdate).Milliseconds > 66)
         {
             //Update at 15 fps most
             this.GetData();
             this.BeginInvoke((MethodInvoker)(() => this.RefreshViewers()));
             _lastUpdate = DateTime.Now;
         }
     }
 }
Esempio n. 13
0
        private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case InteropEmu.ConsoleNotificationType.PpuFrameDone:
                if (ConfigManager.Config.DebugInfo.RefreshWatchWhileRunning)
                {
                    this.BeginInvoke((MethodInvoker)(() => ctrlWatch.UpdateWatch()));
                }
                break;

            case InteropEmu.ConsoleNotificationType.CodeBreak:
                this.BeginInvoke((MethodInvoker)(() => {
                    UpdateDebugger();
                    mnuContinue.Enabled = true;
                    mnuBreak.Enabled = false;
                }));
                BreakpointManager.SetBreakpoints();
                break;

            case InteropEmu.ConsoleNotificationType.GameReset:
            case InteropEmu.ConsoleNotificationType.GameLoaded:
                this.BeginInvoke((MethodInvoker)(() => {
                    this.UpdateWorkspace();
                    this.AutoLoadCdlFiles();
                    this.AutoLoadDbgFiles(true);
                    UpdateDebugger(true, false);
                    BreakpointManager.SetBreakpoints();

                    if (!ConfigManager.Config.DebugInfo.BreakOnReset)
                    {
                        ClearActiveStatement();
                    }
                }));

                if (ConfigManager.Config.DebugInfo.BreakOnReset)
                {
                    InteropEmu.DebugStep(1);
                }
                break;
            }
        }
        private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case InteropEmu.ConsoleNotificationType.PpuFrameDone:
                if (ConfigManager.Config.DebugInfo.RefreshWhileRunning)
                {
                    this.BeginInvoke((MethodInvoker)(() => {
                        ctrlWatch.UpdateWatch(false);
                    }));
                }
                break;

            case InteropEmu.ConsoleNotificationType.CodeBreak:
                this.BeginInvoke((MethodInvoker)(() => {
                    ctrlWatch.UpdateWatch(false);
                }));
                break;
            }
        }
Esempio n. 15
0
        private void notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case InteropEmu.ConsoleNotificationType.GameLoaded:
                _isNsf = InteropEmu.IsNsf();
                break;

            case InteropEmu.ConsoleNotificationType.PpuFrameDone:
                if (_isNsf)
                {
                    UInt32 elapsedFrames = InteropEmu.NsfGetFrameCount();
                    if ((elapsedFrames % 15) == 0)
                    {
                        this.BeginInvoke((Action)(() => this.UpdateTimeDisplay()));
                    }
                }
                break;
            }
        }
Esempio n. 16
0
        private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case InteropEmu.ConsoleNotificationType.CodeBreak:
                this.BeginInvoke((MethodInvoker)(() => this.RefreshData()));
                break;

            case InteropEmu.ConsoleNotificationType.GameReset:
            case InteropEmu.ConsoleNotificationType.GameLoaded:
                this.UpdateFlags();
                break;

            case InteropEmu.ConsoleNotificationType.PpuViewerDisplayFrame:
                int refreshDelay = 90;
                switch (ConfigManager.Config.DebugInfo.RamAutoRefreshSpeed)
                {
                case RefreshSpeed.Low: refreshDelay = 90; break;

                case RefreshSpeed.Normal: refreshDelay = 32; break;

                case RefreshSpeed.High: refreshDelay = 16; break;
                }

                DateTime now = DateTime.Now;
                if (!_updating && ConfigManager.Config.DebugInfo.RamAutoRefresh && (now - _lastUpdate).Milliseconds >= refreshDelay)
                {
                    _lastUpdate = now;
                    _updating   = true;
                    this.BeginInvoke((Action)(() => {
                        this.RefreshData();
                        _updating = false;
                    }));
                }
                break;
            }
        }
Esempio n. 17
0
        private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case InteropEmu.ConsoleNotificationType.CodeBreak:
            case InteropEmu.ConsoleNotificationType.GamePaused:
                if (ConfigManager.Config.DebugInfo.EventViewerRefreshOnBreak)
                {
                    this.GetData();
                    this.BeginInvoke((MethodInvoker)(() => this.RefreshViewer()));
                }
                break;

            case InteropEmu.ConsoleNotificationType.EventViewerDisplayFrame:
                if (!_refreshing && (DateTime.Now - _lastUpdate).Milliseconds >= 32)
                {
                    //Update at ~30 fps at most
                    this.GetData();
                    this.BeginInvoke((MethodInvoker)(() => this.RefreshViewer()));
                    _lastUpdate = DateTime.Now;
                }
                break;
            }
        }