public FirmwaresConfig(
            IDialogController dialogController,
            FirmwareManager firmwareManager,
            IDictionary <string, string> firmwareUserSpecifications,
            PathEntryCollection pathEntries,
            bool retryLoadRom    = false,
            string reloadRomPath = null)
        {
            _firmwareUserSpecifications = firmwareUserSpecifications;
            _pathEntries     = pathEntries;
            DialogController = dialogController;
            Manager          = firmwareManager;

            InitializeComponent();

            tbbGroup.Image
                          = tbbScan.Image
                          = tbbOrganize.Image
                          = tbbImport.Image
                          = tbbClose.Image
                          = tbbCloseReload.Image
                          = tbbOpenFolder.Image = Properties.Resources.Placeholder;

            // prep ImageList for ListView
            foreach (var kvp in StatusIcons.OrderBy(static kvp => kvp.Key))
Beispiel #2
0
        partial void DeployAction(NSObject sender)
        {
            var productId = Convert.ToByte(Globals.DeviceTypes.SingleOrDefault(x => x.Name == DeviceType.SelectedItem.Title).ProductID);

            FirmwareManager manager = new FirmwareManager();

            manager.FirmwareUpdateProgress += (string status) =>
            {
                InvokeOnMainThread(() => { DeployButton.Title = "Deploying... " + status + "%"; });
            };

            Task.Run(() =>
            {
                if (string.IsNullOrEmpty(_configFile) || string.IsNullOrEmpty(_flashFile) || string.IsNullOrEmpty(_bootFile))
                {
                    return;
                }

                InvokeOnMainThread(() =>
                {
                    DeployButton.Enabled         = false;
                    UpdateFirmwareButton.Enabled = false;
                    NetworkUpdateButton.Enabled  = false;
                    OutputToConsole("Started deploy");
                });

                try
                {
                    manager.EraseAndUploadDevice(0, productId, _configFile, _flashFile, _bootFile);
                }
                catch (Exception e)
                {
                    InvokeOnMainThread(() => OutputToConsole("Firmware update failed:\n" + e));
                }
                finally
                {
                    InvokeOnMainThread(() =>
                    {
                        _networkConfig = new NetworkConfig();
                        LoadNetworkSettings(true);

                        DeployButton.Title   = "Deploy";
                        DeployButton.Enabled = true;

                        NetworkUpdateButton.Enabled  = true;
                        UpdateFirmwareButton.Enabled = true;

                        BootFile   = string.Empty;
                        ConfigFile = string.Empty;
                        FlashFile  = string.Empty;

                        OutputToConsole("Finished deploy");
                    });
                }
            });
        }
Beispiel #3
0
        public FirmwaresConfig(
            FirmwareManager firmwareManager,
            IDictionary <string, string> firmwareUserSpecifications,
            IMainFormForConfig mainForm,
            PathEntryCollection pathEntries,
            bool retryLoadRom    = false,
            string reloadRomPath = null)
        {
            _firmwareUserSpecifications = firmwareUserSpecifications;
            _mainForm    = mainForm;
            _pathEntries = pathEntries;
            Manager      = firmwareManager;

            InitializeComponent();

            tbbGroup.Image
                          = tbbScan.Image
                          = tbbOrganize.Image
                          = tbbImport.Image
                          = tbbClose.Image
                          = tbbCloseReload.Image
                          = tbbOpenFolder.Image = Resources.Placeholder;

            // prep ImageList for ListView
            imageList1.Images.AddRange(new Image[]
            {
                Resources.RetroQuestion,
                Resources.ExclamationRed,
                Resources.GreenCheck,
                Resources.ThumbsDown,
            });
            // these constants are used for items' ImageIndex, the order matters
            Debug.Assert(imageList1.Images[IdUnsure] == Resources.RetroQuestion);
            Debug.Assert(imageList1.Images[IdMissing] == Resources.ExclamationRed);
            Debug.Assert(imageList1.Images[IdOk] == Resources.GreenCheck);
            Debug.Assert(imageList1.Images[IdBad] == Resources.ThumbsDown);

            _listViewSorter = new ListViewSorter(-1);

            if (retryLoadRom)
            {
                toolStripSeparator1.Visible = true;
                tbbCloseReload.Visible      = true;
                tbbCloseReload.Enabled      = true;


                tbbCloseReload.ToolTipText = string.IsNullOrWhiteSpace(reloadRomPath)
                                        ? "Close Firmware Manager and reload ROM"
                                        : $"Close Firmware Manager and reload {reloadRomPath}";
            }
        }
        public RecordMovie(
            IMainFormForTools mainForm,
            Config config,
            GameInfo game,
            IEmulator core,
            IMovieSession movieSession,
            FirmwareManager firmwareManager)
        {
            _mainForm        = mainForm;
            _config          = config;
            _game            = game;
            _emulator        = core;
            _movieSession    = movieSession;
            _firmwareManager = firmwareManager;
            InitializeComponent();
            Icon            = Properties.Resources.TAStudioIcon;
            BrowseBtn.Image = Properties.Resources.OpenFile;
            if (OSTailoredCode.IsUnixHost)
            {
                Load += (_, _) =>
                {
                    //HACK to make this usable on Linux. No clue why this Form in particular is so much worse, maybe the GroupBox? --yoshi
                    groupBox1.Height -= 24;
                    DefaultAuthorCheckBox.Location += new Size(0, 32);
                    var s = new Size(0, 40);
                    OK.Location     += s;
                    Cancel.Location += s;
                }
            }
            ;

            if (!_emulator.HasSavestates())
            {
                StartFromCombo.Items.Remove(
                    StartFromCombo.Items
                    .OfType <object>()
                    .First(i => i.ToString()
                           .ToLower() == "now"));
            }

            if (!_emulator.HasSaveRam())
            {
                StartFromCombo.Items.Remove(
                    StartFromCombo.Items
                    .OfType <object>()
                    .First(i => i.ToString()
                           .ToLower() == "saveram"));
            }
        }
Beispiel #5
0
 public PathConfig(
     FirmwareManager firmwareManager,
     IDictionary <string, string> firmwareUserSpecifications,
     IGameInfo game,
     IMainFormForConfig mainForm,
     PathEntryCollection pathEntries)
 {
     _firmwareManager            = firmwareManager;
     _firmwareUserSpecifications = firmwareUserSpecifications;
     _game        = game;
     _mainForm    = mainForm;
     _pathEntries = pathEntries;
     InitializeComponent();
     SpecialCommandsBtn.Image = Properties.Resources.Help;
 }
Beispiel #6
0
        public FirmwaresConfig(
            IDialogController dialogController,
            FirmwareManager firmwareManager,
            IDictionary <string, string> firmwareUserSpecifications,
            PathEntryCollection pathEntries,
            bool retryLoadRom    = false,
            string reloadRomPath = null)
        {
            _firmwareUserSpecifications = firmwareUserSpecifications;
            _pathEntries     = pathEntries;
            DialogController = dialogController;
            Manager          = firmwareManager;

            InitializeComponent();

            tbbGroup.Image
                          = tbbScan.Image
                          = tbbOrganize.Image
                          = tbbImport.Image
                          = tbbClose.Image
                          = tbbCloseReload.Image
                          = tbbOpenFolder.Image = Resources.Placeholder;

            // prep ImageList for ListView
            // the order matters, so make sure these match IdUnsure, IdMissing, etc.
            imageList1.Images.AddRange(new Image[]
            {
                Resources.RetroQuestion,
                Resources.ExclamationRed,
                Resources.GreenCheck,
                Resources.ThumbsDown,
            });

            _listViewSorter = new ListViewSorter(-1);

            if (retryLoadRom)
            {
                toolStripSeparator1.Visible = true;
                tbbCloseReload.Visible      = true;
                tbbCloseReload.Enabled      = true;


                tbbCloseReload.ToolTipText = string.IsNullOrWhiteSpace(reloadRomPath)
                                        ? "Close Firmware Manager and reload ROM"
                                        : $"Close Firmware Manager and reload {reloadRomPath}";
            }
        }
Beispiel #7
0
        partial void UpdateFirmwareAction(NSObject sender)
        {
            var productId = Convert.ToByte(Globals.DeviceTypes.SingleOrDefault(x => x.Name == DeviceType.SelectedItem.Title).ProductID);

            FirmwareManager manager = new FirmwareManager();

            manager.FirmwareUpdateProgress += (string status) =>
            {
                if (status != "100")
                {
                    InvokeOnMainThread(() => UpdateFirmwareButton.Title = "Updating... " + status + "%");
                }
            };

            Task.Run(() =>
            {
                InvokeOnMainThread(() =>
                {
                    OutputToConsole("Started firmware update");
                    UpdateFirmwareButton.Enabled = false;
                    NetworkUpdateButton.Enabled  = false;
                });

                try
                {
                    manager.EraseAndUploadDevice(0, productId);
                }
                catch (Exception e)
                {
                    InvokeOnMainThread(() => OutputToConsole("Firmware update failed:\n" + e));
                    return;
                }
                finally
                {
                    InvokeOnMainThread(() =>
                    {
                        UpdateFirmwareButton.Enabled = true;
                        NetworkUpdateButton.Enabled  = true;
                        UpdateFirmwareButton.Title   = "Update Firmware";
                        _networkConfig = new NetworkConfig();
                        LoadNetworkSettings(true);
                        OutputToConsole("Finished firmware update");
                    });
                }
            });
        }
        public FirmwaresConfig(
            FirmwareManager firmwareManager,
            IDictionary <string, string> firmwareUserSpecifications,
            IGameInfo game,
            IMainFormForConfig mainForm,
            PathEntryCollection pathEntries,
            bool retryLoadRom    = false,
            string reloadRomPath = null)
        {
            _firmwareUserSpecifications = firmwareUserSpecifications;
            _game        = game;
            _mainForm    = mainForm;
            _pathEntries = pathEntries;
            Manager      = firmwareManager;

            InitializeComponent();

            tbbGroup.Image
                          = tbbScan.Image
                          = tbbOrganize.Image
                          = tbbImport.Image
                          = tbbClose.Image
                          = tbbCloseReload.Image
                          = tbbOpenFolder.Image = Resources.Placeholder;

            // prep ImageList for ListView with 3 item states for {idUnsure, idMissing, idOk}
            imageList1.Images.AddRange(new Image[] { Resources.RetroQuestion, Resources.ExclamationRed, Resources.GreenCheck });

            _listViewSorter = new ListViewSorter(-1);

            if (retryLoadRom)
            {
                toolStripSeparator1.Visible = true;
                tbbCloseReload.Visible      = true;
                tbbCloseReload.Enabled      = true;


                tbbCloseReload.ToolTipText = string.IsNullOrWhiteSpace(reloadRomPath)
                                        ? "Close Firmware Manager and reload ROM"
                                        : $"Close Firmware Manager and reload {reloadRomPath}";
            }
        }
Beispiel #9
0
        public OnlineManager(OltProtocol oltProtocol, LambdaAdapter lambdaAdapter)
        {
            settings = new Settings();
            settings.LoadFromFile();
            dataLogger = new DataLogger();
            dataKeeper = new DiagDataKeeper();
            dataKeeper.LoadSettings(Settings.settingsKeeper);
            firmwareManager    = new FirmwareManager(this);
            this.OltProtocol   = oltProtocol;
            this.LambdaAdapter = lambdaAdapter;

            if (settings.AutoLoadLastFirmware)
            {
                firmwareManager.Open(settings.LastFirmwarePath);
            }

            oltProtocol.OnDiagUpdate += oltProtocol_OnDiagUpdate;
            oltProtocol.OnConnect    += oltProtocol_OnConnect;
            oltProtocol.OnDisconnect += oltProtocol_OnDisconnect;
        }
Beispiel #10
0
        public RecordMovie(
            IMainFormForTools mainForm,
            Config config,
            GameInfo game,
            IEmulator core,
            IMovieSession movieSession,
            FirmwareManager firmwareManager)
        {
            _mainForm        = mainForm;
            _config          = config;
            _game            = game;
            _emulator        = core;
            _movieSession    = movieSession;
            _firmwareManager = firmwareManager;
            InitializeComponent();
            Icon            = Properties.Resources.TAStudio_MultiSize;
            BrowseBtn.Image = Properties.Resources.OpenFile;

            if (!_emulator.HasSavestates())
            {
                StartFromCombo.Items.Remove(
                    StartFromCombo.Items
                    .OfType <object>()
                    .First(i => i.ToString()
                           .ToLower() == "now"));
            }

            if (!_emulator.HasSaveRam())
            {
                StartFromCombo.Items.Remove(
                    StartFromCombo.Items
                    .OfType <object>()
                    .First(i => i.ToString()
                           .ToLower() == "saveram"));
            }
        }
Beispiel #11
0
 public HomieHub(HomieDeviceManager deviceManager, FirmwareManager firmwareManager)
 {
     HomieDeviceManager = deviceManager;
     FirmwareManager    = firmwareManager;
 }
        // TODO: This doesn't really belong here, but not sure where to put it
        public static void PopulateWithDefaultHeaderValues(
            this IMovie movie,
            IEmulator emulator,
            GameInfo game,
            FirmwareManager firmwareManager,
            string author)
        {
            movie.Author          = author;
            movie.EmulatorVersion = VersionInfo.GetEmuVersion();
            movie.SystemID        = emulator.SystemId;

            var settable = new SettingsAdapter(emulator);

            if (settable.HasSyncSettings)
            {
                movie.SyncSettingsJson = ConfigService.SaveWithType(settable.GetSyncSettings());
            }

            if (game.IsNullInstance())
            {
                movie.GameName = "NULL";
            }
            else
            {
                movie.GameName = game.FilesystemSafeName();
                movie.Hash     = game.Hash;
                if (game.FirmwareHash != null)
                {
                    movie.FirmwareHash = game.FirmwareHash;
                }
            }

            if (emulator.HasBoardInfo())
            {
                movie.BoardName = emulator.AsBoardInfo().BoardName;
            }

            if (emulator.HasRegions())
            {
                var region = emulator.AsRegionable().Region;
                if (region == Emulation.Common.DisplayType.PAL)
                {
                    movie.HeaderEntries.Add(HeaderKeys.Pal, "1");
                }
            }

            if (firmwareManager.RecentlyServed.Any())
            {
                foreach (var firmware in firmwareManager.RecentlyServed)
                {
                    var key = $"{firmware.SystemId}_Firmware_{firmware.FirmwareId}";

                    if (!movie.HeaderEntries.ContainsKey(key))
                    {
                        movie.HeaderEntries.Add(key, firmware.Hash);
                    }
                }
            }

            if (emulator is GBHawk gbHawk && gbHawk.IsCGBMode())
            {
                movie.HeaderEntries.Add("IsCGBMode", "1");
            }

            if (emulator is SubGBHawk subgbHawk)
            {
                if (subgbHawk._GBCore.IsCGBMode())
                {
                    movie.HeaderEntries.Add("IsCGBMode", "1");
                }

                movie.HeaderEntries.Add(HeaderKeys.CycleCount, "0");
            }

            if (emulator is Gameboy gb)
            {
                if (gb.IsCGBMode())
                {
                    movie.HeaderEntries.Add("IsCGBMode", "1");
                }

                movie.HeaderEntries.Add(HeaderKeys.CycleCount, "0");
            }

            if (emulator is SMS sms)
            {
                if (sms.IsSG1000)
                {
                    movie.HeaderEntries.Add("IsSGMode", "1");
                }

                if (sms.IsGameGear)
                {
                    movie.HeaderEntries.Add("IsGGMode", "1");
                }
            }

            if (emulator is GPGX gpgx && gpgx.IsMegaCD)
            {
                movie.HeaderEntries.Add("IsSegaCDMode", "1");
            }

            if (emulator is PicoDrive pico && pico.Is32XActive)
            {
                movie.HeaderEntries.Add("Is32X", "1");
            }

            if (emulator is SubNESHawk)
            {
                movie.HeaderEntries.Add(HeaderKeys.VBlankCount, "0");
            }

            movie.Core = ((CoreAttribute)Attribute
                          .GetCustomAttribute(emulator.GetType(), typeof(CoreAttribute)))
                         .CoreName;
        }