예제 #1
0
        public EmulatorWindow(Mainform parent)
        {
            InitializeComponent();
            Closing += (o, e) =>
            {
                ShutDown();
            };

            MainForm = parent;
        }
예제 #2
0
		public EmulatorWindow(Mainform parent)
		{
			InitializeComponent();
			Closing += (o, e) =>
			{
				ShutDown();
			};

			MainForm = parent;
		}
예제 #3
0
파일: Program.cs 프로젝트: h31nr1ch/BizHawk
        static void SubMain(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            string iniPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "config.ini");

            Global.Config = ConfigService.Load <Config>(iniPath);
            Global.Config.ResolveDefaults();
            HawkFile.ArchiveHandlerFactory = new SevenZipSharpArchiveHandler();

            //super hacky! this needs to be done first. still not worth the trouble to make this system fully proper
            for (int i = 0; i < args.Length; i++)
            {
                var arg = args[i].ToLower();
                if (arg.StartsWith("--gdi"))
                {
                    Global.Config.DispMethod = Config.EDispMethod.GdiPlus;
                }
            }


            //WHY do we have to do this? some intel graphics drivers (ig7icd64.dll 10.18.10.3304 on an unknown chip on win8.1) are calling SetDllDirectory() for the process, which ruins stuff.
            //The relevant initialization happened just before in "create IGL context".
            //It isn't clear whether we need the earlier SetDllDirectory(), but I think we do.
            //note: this is pasted instead of being put in a static method due to this initialization code being sensitive to things like that, and not wanting to cause it to break
            //pasting should be safe (not affecting the jit order of things)
            string dllDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");

            SetDllDirectory(dllDir);

            try
            {
                using (var mf = new Mainform(args))
                {
                    var title = mf.Text;
                    mf.Show();
                    mf.Text = title;
                    try
                    {
                        mf.ProgramRunLoop();
                    }
                    catch (Exception e)
                    {
#if WINDOWS
                        if (Global.MovieSession.Movie.IsActive)
                        {
                            var result = MessageBox.Show(
                                "EmuHawk has thrown a fatal exception and is about to close.\nA movie has been detected. Would you like to try to save?\n(Note: Depending on what caused this error, this may or may not succeed)",
                                "Fatal error: " + e.GetType().Name,
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Exclamation
                                );
                            if (result == DialogResult.Yes)
                            {
                                Global.MovieSession.Movie.Save();
                            }
                        }
#endif
                        throw;
                    }
                }
            }
            catch (Exception e)
            {
                string message = e.ToString();
                if (e.InnerException != null)
                {
                    message += "\n\nInner Exception:\n\n" + e.InnerException;
                }

                message += "\n\nStackTrace:\n" + e.StackTrace;
                MessageBox.Show(message);
            }
#if WINDOWS
            finally
            {
                GamePad.CloseAll();
            }
#endif
        }
예제 #4
0
		public InputManager(Mainform mainForm)
		{
			_mainForm = mainForm;
		}
예제 #5
0
 public InputManager(Mainform mainForm)
 {
     _mainForm = mainForm;
 }
예제 #6
0
파일: Program.cs 프로젝트: henke37/BizHawk
		static void SubMain(string[] args)
		{
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			string iniPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "config.ini");
			Global.Config = ConfigService.Load<Config>(iniPath);
			Global.Config.ResolveDefaults();
			HawkFile.ArchiveHandlerFactory = new SevenZipSharpArchiveHandler();

			//super hacky! this needs to be done first. still not worth the trouble to make this system fully proper
			for (int i = 0; i < args.Length; i++)
			{
				var arg = args[i].ToLower();
				if (arg.StartsWith("--gdi"))
				{
					Global.Config.DispMethod = Config.EDispMethod.GdiPlus;
				}
			}


			//WHY do we have to do this? some intel graphics drivers (ig7icd64.dll 10.18.10.3304 on an unknown chip on win8.1) are calling SetDllDirectory() for the process, which ruins stuff.
			//The relevant initialization happened just before in "create IGL context".
			//It isn't clear whether we need the earlier SetDllDirectory(), but I think we do.
			//note: this is pasted instead of being put in a static method due to this initialization code being sensitive to things like that, and not wanting to cause it to break
			//pasting should be safe (not affecting the jit order of things)
			string dllDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
			SetDllDirectory(dllDir);

			try
			{
					using (var mf = new Mainform(args))
					{
						var title = mf.Text;
						mf.Show();
						mf.Text = title;
						try
						{
							mf.ProgramRunLoop();
						}
						catch (Exception e)
						{
#if WINDOWS
							if (Global.MovieSession.Movie.IsActive)
							{
								var result = MessageBox.Show(
									"EmuHawk has thrown a fatal exception and is about to close.\nA movie has been detected. Would you like to try to save?\n(Note: Depending on what caused this error, this may or may succeed)",
									"Fatal error: " + e.GetType().Name,
									MessageBoxButtons.YesNo,
									MessageBoxIcon.Exclamation
									);
								if (result == DialogResult.Yes)
								{
									Global.MovieSession.Movie.Save();
								}
							}
#endif
							throw;
						}
					}
			}
			catch (Exception e)
			{
				string message = e.ToString();
				if (e.InnerException != null)
				{
					message += "\n\nInner Exception:\n\n" + e.InnerException;
				}

				message += "\n\nStackTrace:\n" + e.StackTrace;
				MessageBox.Show(message);
			}
#if WINDOWS
			finally
			{
				GamePad.CloseAll();
			}
#endif
		}