private void btnOpen_Click(object sender, EventArgs e)
        {
            using (var openFileDialog = new OpenFileDialog())
            {
                openFileDialog.Title  = "Выберите карту CTP 3.21";
                openFileDialog.Filter = "Map files|*.j5;*.j7|All files|*.*";
                if (openFileDialog.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                ctpMap.LoadFromFile(openFileDialog.FileName);

                openFileDialog.Title    = "Выберите файл прошивки";
                openFileDialog.Filter   = "buffer files|*.bir;*.bin|all files|*.*";
                openFileDialog.FileName = String.Empty;
                if (openFileDialog.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                var fileInfo = new FileInfo(openFileDialog.FileName);

                if (fileInfo.Length != 0x10000 && !MapDataHelper.UnpackCtpFirmware(fileInfo, true, this))
                {
                    return;
                }

                buffer = File.ReadAllBytes(openFileDialog.FileName);
            }

            ctpMapTree.LoadMap(ctpMap, true);
            FirmwareHelper.FillRpmRT(buffer, out rpmSampling, out rpmRt32, out rpmRt16);

            for (int i = 0; i < 256; i++)
            {
                quantGrid.Rows[0].Cells[i].Value = rpmSampling[i].ToString();
            }

            for (int i = 0; i < 32; i++)
            {
                quant32Grid.Rows[0].Cells[i].Value = rpmRt32[i].ToString();
            }

            for (int i = 0; i < 16; i++)
            {
                quant16Grid.Rows[0].Cells[i].Value = rpmRt16[i].ToString();
            }
        }
Beispiel #2
0
        private void Prepare()
        {
            SWDigest  = DataHelper.CalculateCRC(buffer, 0, 0xB0);
            IsFastRpm = DataHelper.IndexOf(buffer, new byte[] { 0x90, 0x61, 0x3C, 0xE5, 0x55 }) != -1;

            J7esFlags.Prepare(buffer);
            FillKGbc();
            if (J7esFlags.IsDadMode && !J7esFlags.IsCommonKGBCTable)
            {
                kgbc.Address = FirmwareHelper.KGbcJ7esDadAddr;
            }

            FirmwareHelper.FillRpmRT(buffer, out rpmSampling, out rpmRt32, out rpmRt16);
            FillThrRT();
            FillGbcRT();
            FillTWatRT();
            FillPressRT();

            FillPoints();

            FillGbc();
            FillKGbc();
            FillKGbcPress();
        }
Beispiel #3
0
        private void OnNotificationReceived(NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case ConsoleNotificationType.GameLoaded:
                CheatCodes.ApplyCheats();

                this.BeginInvoke((Action)(() => {
                    UpdateDebuggerMenu();
                    ctrlRecentGames.Visible = false;
                    SaveStateManager.UpdateStateMenu(mnuLoadState, false);
                    SaveStateManager.UpdateStateMenu(mnuSaveState, true);

                    RomInfo romInfo = EmuApi.GetRomInfo();
                    this.Text = "Mesen-S - " + romInfo.GetRomName();

                    if (DebugWindowManager.HasOpenedWindow)
                    {
                        DebugWorkspaceManager.GetWorkspace();
                    }
                }));
                break;

            case ConsoleNotificationType.BeforeEmulationStop:
                this.Invoke((Action)(() => {
                    DebugWindowManager.CloseAll();
                }));
                break;

            case ConsoleNotificationType.GameResumed:
                this.BeginInvoke((Action)(() => {
                    //Ensure mouse is hidden when game is resumed
                    CursorManager.OnMouseMove(ctrlRenderer);
                }));
                break;

            case ConsoleNotificationType.EmulationStopped:
                this.BeginInvoke((Action)(() => {
                    this.Text = "Mesen-S";
                    UpdateDebuggerMenu();
                    ShowGameScreen(GameScreenMode.RecentGames);
                    ResizeRecentGames();
                    if (_displayManager.ExclusiveFullscreen)
                    {
                        _displayManager.SetFullscreenState(false);
                    }
                }));
                break;

            case ConsoleNotificationType.ResolutionChanged:
                this.BeginInvoke((Action)(() => {
                    _displayManager.UpdateViewerSize();
                }));
                break;

            case ConsoleNotificationType.ExecuteShortcut:
                this.BeginInvoke((Action)(() => {
                    _shortcuts.ExecuteShortcut((EmulatorShortcut)e.Parameter);
                }));
                break;

            case ConsoleNotificationType.MissingFirmware:
                this.Invoke((Action)(() => {
                    MissingFirmwareMessage msg = (MissingFirmwareMessage)Marshal.PtrToStructure(e.Parameter, typeof(MissingFirmwareMessage));
                    FirmwareHelper.RequestFirmwareFile(msg);
                }));
                break;
            }
        }
 public void Initialize()
 {
     _firmwareHelper          = new FirmwareHelper();
     _firmwareHelper.FileName = @"configuration.h";
 }