示例#1
0
        private void tsbtnDebugLoadMap_Click(object sender, EventArgs e)
        {
            if (!RTH_Imports.IsConnected)
            {
                return;
            }

            uint   HeaderAddress = 0x547700;
            string connectInfo   = tslblDebugStatus.Text;

            try
            {
                tslblDebugStatus.Text = "[Loading Debug Map...]";
                byte[] data = new byte[2048];
                data = (byte[])RTH_Imports.Peek(HeaderAddress, (uint)data.Length);

                MapHeader LoadedMap = new MapHeader(data);

                string[] filePaths = Directory.GetFiles(Globals.Prefs.pathMapsFolder, "*.map");

                tslblDebugStatus.Text = "[Comparing Maps...]";
                foreach (string filename in filePaths)
                {
                    // Load file and read header
                    FileStream fs         = new FileStream(filename, FileMode.Open);
                    byte[]     headerData = new byte[2048];
                    fs.Read(headerData, 0, 2048);
                    fs.Close();
                    // Compare file to debug header
                    if (LoadedMap.Compare(new MapHeader(headerData)) == 0)
                    {
                        // Found our MAP!! YES!! Load It!!
                        TryLoadMapForm(filename);
                        return;
                    }
                }
                System.Windows.Forms.MessageBox.Show("No matching map found!" +
                                                     "\nType: " + LoadedMap.MapType +
                                                     "\nName: " + LoadedMap.MapName +
                                                     "\nScenario Name: " + LoadedMap.ScenarioName);
            }
            catch (Exception ex)
            {
                if (ex.Message == "No xbox processes loaded.")
                {
                    Globals.Global.ShowErrorMsg("Halo 2 not loaded", ex);
                }
                else
                {
                    Globals.Global.ShowErrorMsg("Load map failed!", ex);
                }
            }
            finally
            {
                tslblDebugStatus.Text = connectInfo;
            }
        }
示例#2
0
        private void tsbtnDebugLoadMap_Click(object sender, EventArgs e)
        {
            if (!RTH_Imports.IsConnected)
                return;

            uint HeaderAddress = 0x547700;
            string connectInfo = tslblDebugStatus.Text;

            try
            {
                tslblDebugStatus.Text = "[Loading Debug Map...]";
                byte[] data = new byte[2048];
                data = (byte[])RTH_Imports.Peek(HeaderAddress, (uint)data.Length);

                MapHeader LoadedMap = new MapHeader(data);

                string[] filePaths = Directory.GetFiles(Globals.Prefs.pathMapsFolder, "*.map");

                tslblDebugStatus.Text = "[Comparing Maps...]";
                foreach (string filename in filePaths)
                {
                    // Load file and read header
                    FileStream fs = new FileStream(filename, FileMode.Open);
                    byte[] headerData = new byte[2048];
                    fs.Read(headerData, 0, 2048);
                    fs.Close();
                    // Compare file to debug header
                    if (LoadedMap.Compare(new MapHeader(headerData)) == 0)
                    {
                        // Found our MAP!! YES!! Load It!!
                        TryLoadMapForm(filename);
                        return;
                    }
                }
                System.Windows.Forms.MessageBox.Show("No matching map found!" +
                                                      "\nType: " + LoadedMap.MapType +
                                                      "\nName: " + LoadedMap.MapName +
                                                      "\nScenario Name: " + LoadedMap.ScenarioName);
            }
            catch (Exception ex)
            {
                if (ex.Message == "No xbox processes loaded.")
                    Globals.Global.ShowErrorMsg("Halo 2 not loaded", ex);
                else
                    Globals.Global.ShowErrorMsg("Load map failed!", ex);
            }
            finally
            {
                tslblDebugStatus.Text = connectInfo;
            }
        }