/// <summary> /// Attempts to load a rom set from a zip archive file /// </summary> /// <param name="filename">filename of the zip archive containing the rom set</param> /// <param name="set">returns RomSet on success</param> /// <param name="errMessage">error message returned on failure</param> /// <returns>true if the rom set was sucessfully loaded, false if error</returns> static public bool ReadRomSetFromZipArchive(string filename, out RomSet?set, out string?errMessage) { set = new RomSet(filename, out errMessage); if (errMessage == null) { return(true); } set = null; return(false); }
protected override void LoadContent() { base.LoadContent(); // Create the screen manager component. ScreenManager = new ScreenManager(this); Components.Add(ScreenManager); // read the ROMs if (RomSet.ReadRomSetFromZipArchive("irobot.zip", out RomSet? roms, out string?errMsg) && roms != null) { // now create the hardware mMachine = new Emulation.Machine(roms, new MathboxRenderer.Factory(ScreenManager)); } LoadingScreen.Load(ScreenManager, true, null, new GameScreen(ScreenManager)); if (errMsg != null) { string message = $"ROMSET MISSING\n\n{errMsg}"; MessageBoxScreen dialog = new MessageBoxScreen(ScreenManager, message, false); ScreenManager.AddScreen(dialog, null); } }