Example #1
0
        public LoadResults LoadGame()
        {
            // Clear everything (needed?)
            Emulator.LightReset();

            // Get bootstream
            Debug.Assert(Bios.BootStream == null);
            string filePath;

            Bios.BootStream = GameLoader.FindBootStream(Bios.Game, out filePath);
            Debug.Assert(Bios.BootStream != null);

            LoadParameters loadParams = new LoadParameters();

            loadParams.FilePath = filePath;
            loadParams.Path     = Bios.Game.Folder;
#if DEBUG
            loadParams.AppendDatabase = true;
#endif
            LoadResults results = Bios.Loader.LoadModule(ModuleType.Boot, Bios.BootStream, loadParams);

            Debug.Assert(results.Successful == true);
            if (results.Successful == false)
            {
                Log.WriteLine(Verbosity.Critical, Feature.Bios, "load of game failed");
                Bios.Game = null;
                return(results);
            }

            this.CurrentPath = Bios.Game.Folder;
            this.Cpu.SetupGame(Bios.Game, Bios.BootStream);

            // Start modules
            foreach (Module module in Bios._modules)
            {
                module.Start();
            }

            Log.WriteLine(Verbosity.Normal, Feature.Bios, "game loaded");

            return(results);
        }