Exemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();

            // TODO: Cleanup arg handling

            string[] args = Environment.GetCommandLineArgs();

            // Arguments are expected before the Form is created
            if (args.Length < 2)
            {
                throw new Exception("Incorrect usage");
            }

            var items = new List <string>(args.Length - 1);

            for (int i = 1; i < args.Length; ++i)
            {
                items.Add(args[i]);
            }

            CachedArgs = items.ToArray();

            DebugEvents = new DebuggerFormEvents(this);

            SetDebugProcessActive(false);

            txDisassembly.InlineLinkClicked += OnDisassemblyNavigation;

            foreach (string FileEventEnum in Enum.GetNames(typeof(FileEventType)))
            {
                cbAction.Items.Add(FileEventEnum);
            }

            cbAction.SelectedIndex = 0;

            foreach (string VariableEnum in Enum.GetNames(typeof(PatchType)))
            {
                cbDataFormat.Items.Add(VariableEnum);
            }

            cbDataFormat.SelectedIndex = 0;
            InvokePatchTypeChange();

            fileWatchMan = new FileWatchManager(clbBreakpoints);
            debugStrMan  = new DebugOutputManager(lbDebug);
            patchMan     = new PatchManager();
        }
Exemplo n.º 2
0
        public CxbxDebuggerInstance(Form Owner, string[] args)
        {
            InitializeComponent();

            MdiParent = Owner;

#if !DEBUG
            // Arguments are expected before the Form is created
            if (args.Length < 2)
            {
                throw new Exception("Incorrect usage");
            }
#endif

            StartupArgs = args;

            DebugEvents = new DebuggerFormEvents(this);

            SetDebugState(DebugState.Unknown);

            txDisassembly.InlineLinkClicked += OnDisassemblyNavigation;

            foreach (string FileEventEnum in Enum.GetNames(typeof(FileEventType)))
            {
                cbAction.Items.Add(FileEventEnum);
            }

            cbAction.SelectedIndex = 0;

            foreach (string VariableEnum in Enum.GetNames(typeof(PatchType)))
            {
                cbDataFormat.Items.Add(VariableEnum);
            }

            cbDataFormat.SelectedIndex = 0;
            InvokePatchTypeChange();

            fileWatchMan = new FileWatchManager(clbBreakpoints);
            debugStrMan  = new DebugOutputManager(lbDebug);
            patchMan     = new PatchManager();

            CreateDebuggerOnce();
        }
Exemplo n.º 3
0
        public Form1()
        {
            InitializeComponent();

            // TODO: Cleanup arg handling

            string[] args = Environment.GetCommandLineArgs();

#if !DEBUG
            // Arguments are expected before the Form is created
            if (args.Length < 2)
            {
                throw new Exception("Incorrect usage");
            }
#endif

            var items = new List <string>(args.Length - 1);
            for (int i = 1; i < args.Length; ++i)
            {
                items.Add(args[i]);
            }

            CachedArgs = items.ToArray();

            if (CachedArgs.Length > 3)
            {
                if (CachedArgs[1] == "/load" && File.Exists(CachedArgs[2]))
                {
                    var file = File.OpenRead(CachedArgs[2]);
                    if (file.CanRead)
                    {
                        var currentXbe = new Xbox.XBE();
                        if (currentXbe.Read(new BinaryReader(file)))
                        {
                            targetXbe = currentXbe;
                        }

                        file.Close();
                    }
                }
            }

            string targetName = "untitled";

            // Rebrand with formatted title id
            if (targetXbe != null)
            {
                Text       = $"Cxbx-Reloaded Debugger - {targetXbe.Title} ({targetXbe.TitleId})";
                targetName = targetXbe.TitleIdHex;
            }

            LoadCheatTable($"{targetName}.ct");
            LoadScript($"{targetName}_script.txt");

            DebugEvents = new DebuggerFormEvents(this);

            SetDebugProcessActive(false);

            txDisassembly.InlineLinkClicked += OnDisassemblyNavigation;

            foreach (string FileEventEnum in Enum.GetNames(typeof(FileEventType)))
            {
                cbAction.Items.Add(FileEventEnum);
            }

            cbAction.SelectedIndex = 0;

            foreach (string VariableEnum in Enum.GetNames(typeof(PatchType)))
            {
                cbDataFormat.Items.Add(VariableEnum);
            }

            cbDataFormat.SelectedIndex = 0;
            InvokePatchTypeChange();

            fileWatchMan = new FileWatchManager(clbBreakpoints);
            debugStrMan  = new DebugOutputManager(lbDebug);
            patchMan     = new PatchManager();
            scriptMan    = new ScriptManager();
        }