Beispiel #1
0
        protected override void OnLoad(EventArgs e)
        {
            _notifListener = new NotificationListener();
            _notifListener.OnNotification += OnNotificationReceived;

            bool isPaused = EmuApi.IsPaused();

            ConfigManager.Config.Debug.Debugger.ApplyConfig();

            mnuUseAltSpcOpNames.Visible = false;

            switch (_cpuType)
            {
            case CpuType.Cpu:
                ctrlDisassemblyView.Initialize(new CpuDisassemblyManager(), new CpuLineStyleProvider());
                ConfigApi.SetDebuggerFlag(DebuggerFlags.CpuDebuggerEnabled, true);
                this.Text = "CPU Debugger";

                this.ctrlCpuStatus         = new ctrlCpuStatus();
                this.ctrlCpuStatus.Padding = new Padding(3, 0, 3, 0);
                this.ctrlCpuStatus.Dock    = DockStyle.Top;
                pnlStatus.Controls.Add(this.ctrlCpuStatus);
                break;

            case CpuType.Spc:
                ctrlDisassemblyView.Initialize(new SpcDisassemblyManager(), new SpcLineStyleProvider());
                ConfigApi.SetDebuggerFlag(DebuggerFlags.SpcDebuggerEnabled, true);
                mnuBreakOnWdm.Visible       = false;
                mnuBreakOnCop.Visible       = false;
                mnuBreakOnUnitRead.Visible  = false;
                sepBreakOnUnitRead.Visible  = false;
                mnuUseAltSpcOpNames.Visible = true;
                this.Text = "SPC Debugger";

                this.ctrlSpcStatus         = new ctrlSpcStatus();
                this.ctrlSpcStatus.Padding = new Padding(3, 0, 3, 0);
                this.ctrlSpcStatus.Dock    = DockStyle.Top;
                pnlStatus.Controls.Add(this.ctrlSpcStatus);
                break;

            case CpuType.Sa1:
                ctrlDisassemblyView.Initialize(new Sa1DisassemblyManager(), new Sa1LineStyleProvider());
                ConfigApi.SetDebuggerFlag(DebuggerFlags.Sa1DebuggerEnabled, true);
                this.Text = "SA-1 Debugger";

                this.ctrlCpuStatus         = new ctrlCpuStatus();
                this.ctrlCpuStatus.Padding = new Padding(3, 0, 3, 0);
                this.ctrlCpuStatus.Dock    = DockStyle.Top;
                pnlStatus.Controls.Add(this.ctrlCpuStatus);
                break;

            case CpuType.Gsu:
                ctrlDisassemblyView.Initialize(new GsuDisassemblyManager(), new GsuLineStyleProvider());
                ConfigApi.SetDebuggerFlag(DebuggerFlags.GsuDebuggerEnabled, true);
                this.Text = "GSU Debugger";
                HideDebuggerElements();

                this.ctrlGsuStatus         = new ctrlGsuStatus();
                this.ctrlGsuStatus.Padding = new Padding(3, 0, 3, 0);
                this.ctrlGsuStatus.Dock    = DockStyle.Top;
                pnlStatus.Controls.Add(this.ctrlGsuStatus);
                break;

            case CpuType.NecDsp:
                ctrlDisassemblyView.Initialize(new NecDspDisassemblyManager(), new NecDspLineStyleProvider());
                ConfigApi.SetDebuggerFlag(DebuggerFlags.NecDspDebuggerEnabled, true);
                this.Text = "DSP Debugger";
                HideDebuggerElements();

                this.ctrlNecDspStatus         = new ctrlNecDspStatus();
                this.ctrlNecDspStatus.Padding = new Padding(3, 0, 3, 0);
                this.ctrlNecDspStatus.Dock    = DockStyle.Top;
                pnlStatus.Controls.Add(this.ctrlNecDspStatus);
                break;

            case CpuType.Cx4:
                ctrlDisassemblyView.Initialize(new Cx4DisassemblyManager(), new Cx4LineStyleProvider());
                ConfigApi.SetDebuggerFlag(DebuggerFlags.Cx4DebuggerEnabled, true);
                this.Text = "CX4 Debugger";

                ctrlLabelList.Visible = false;
                HideDebuggerElements();

                this.ctrlCx4Status         = new ctrlCx4Status();
                this.ctrlCx4Status.Padding = new Padding(3, 0, 3, 0);
                this.ctrlCx4Status.Dock    = DockStyle.Top;
                pnlStatus.Controls.Add(this.ctrlCx4Status);
                break;

            case CpuType.Gameboy:
                ctrlDisassemblyView.Initialize(new GbDisassemblyManager(), new GbLineStyleProvider());
                ConfigApi.SetDebuggerFlag(DebuggerFlags.GbDebuggerEnabled, true);
                this.Text = "GB Debugger";

                ctrlMemoryMapping         = new ctrlMemoryMapping();
                ctrlMemoryMapping.Size    = new Size(this.ClientSize.Width, 33);
                ctrlMemoryMapping.Margin  = new Padding(3, 0, 3, 3);
                ctrlMemoryMapping.Dock    = DockStyle.Bottom;
                ctrlMemoryMapping.Visible = ConfigManager.Config.Debug.Debugger.ShowMemoryMappings;
                this.Controls.Add(ctrlMemoryMapping);
                ctrlMemoryMapping.SendToBack();

                sepBrkCopStpWdm.Visible = false;
                mnuBreakOnBrk.Visible   = false;
                mnuBreakOnWdm.Visible   = false;
                mnuBreakOnCop.Visible   = false;
                mnuBreakOnStp.Visible   = false;
                ctrlPpuStatus.Visible   = false;

                sepGameboyBreak.Visible = true;
                mnuGbBreakOnDisableLcdOutsideVblank.Visible = true;
                mnuGbBreakOnInvalidOamAccess.Visible        = true;
                mnuGbBreakOnInvalidOpCode.Visible           = true;
                mnuGbBreakOnInvalidVramAccess.Visible       = true;
                mnuGbBreakOnNopLoad.Visible       = true;
                mnuGbBreakOnOamCorruption.Visible = false;

                this.ctrlGameboyStatus         = new ctrlGameboyStatus();
                this.ctrlGameboyStatus.Padding = new Padding(3, 0, 3, 0);
                this.ctrlGameboyStatus.Dock    = DockStyle.Top;
                pnlStatus.Controls.Add(this.ctrlGameboyStatus);
                break;
            }

            ctrlBreakpoints.CpuType = _cpuType;
            ctrlWatch.CpuType       = _cpuType;

            InitShortcuts();
            InitToolbar();
            LoadConfig();

            toolTip.SetToolTip(picWatchHelp, ctrlWatch.GetTooltipText());

            BreakpointManager.AddCpuType(_cpuType);

            if (!isPaused)
            {
                DebugApi.Step(_cpuType, 10000, StepType.Step);
            }
            else
            {
                BreakEvent evt = new BreakEvent()
                {
                    BreakpointId = -1, Source = BreakSource.Unspecified
                };
                RefreshDebugger(evt);
            }

            base.OnLoad(e);
        }
Beispiel #2
0
 public void ApplyConfig()
 {
     ConfigApi.SetEmulationConfig(this);
 }
Beispiel #3
0
        /// <summary>
        ///   Creates a new instance of the <see cref="IpfsEngine"/> class.
        /// </summary>
        public IpfsEngine(char[] passphrase)
        {
            this.passphrase = passphrase;

            // Init the core api inteface.
            Bitswap    = new BitswapApi(this);
            Block      = new BlockApi(this);
            Bootstrap  = new BootstrapApi(this);
            Config     = new ConfigApi(this);
            Dag        = new DagApi(this);
            Dht        = new DhtApi(this);
            Dns        = new DnsApi(this);
            FileSystem = new FileSystemApi(this);
            Generic    = new GenericApi(this);
            Key        = new KeyApi(this);
            Name       = new NameApi(this);
            Object     = new ObjectApi(this);
            Pin        = new PinApi(this);
            PubSub     = new PubSubApi(this);
            Stats      = new StatsApi(this);
            Swarm      = new SwarmApi(this);

            // Async properties
            LocalPeer = new AsyncLazy <Peer>(async() =>
            {
                log.Debug("Building local peer");
                var keyChain = await KeyChain();
                log.Debug("Getting key info about self");
                var self                  = await keyChain.FindKeyByNameAsync("self");
                var localPeer             = new Peer();
                localPeer.Id              = self.Id;
                localPeer.PublicKey       = await keyChain.GetPublicKeyAsync("self");
                localPeer.ProtocolVersion = "ipfs/0.1.0";
                var version               = typeof(IpfsEngine).GetTypeInfo().Assembly.GetName().Version;
                localPeer.AgentVersion    = $"net-ipfs/{version.Major}.{version.Minor}.{version.Revision}";
                log.Debug("Built local peer");
                return(localPeer);
            });
            SwarmService = new AsyncLazy <Swarm>(async() =>
            {
                log.Debug("Building swarm service");
                var peer     = await LocalPeer;
                var keyChain = await KeyChain();
                var self     = await keyChain.GetPrivateKeyAsync("self");
                var swarm    = new Swarm
                {
                    LocalPeer    = peer,
                    LocalPeerKey = PeerTalk.Cryptography.Key.CreatePrivateKey(self)
                };
                log.Debug("Built swarm service");
                return(swarm);
            });
            BitswapService = new AsyncLazy <BlockExchange.Bitswap>(async() =>
            {
                log.Debug("Building bitswap service");
                var bitswap = new BlockExchange.Bitswap
                {
                    Swarm        = await SwarmService,
                    BlockService = Block
                };
                log.Debug("Built bitswap service");
                return(bitswap);
            });
            DhtService = new AsyncLazy <PeerTalk.Routing.Dht1>(async() =>
            {
                log.Debug("Building DHT service");
                var dht = new PeerTalk.Routing.Dht1
                {
                    Swarm = await SwarmService
                };
                dht.Swarm.Router = dht;
                log.Debug("Built DHT service");
                return(dht);
            });
        }
Beispiel #4
0
 public static void SetConfigInfo(int siteId, ConfigInfo configInfo)
 {
     ConfigInfoDict[siteId] = configInfo;
     ConfigApi.SetConfig(siteId, configInfo);
 }
Beispiel #5
0
 public void ApplyConfig()
 {
     ConfigApi.SetVideoConfig(this);
 }