public MainWindow() { InitializeComponent(); // avoid activate window WindowStyle = WindowStyle.None; Topmost = true; AllowsTransparency = true; ShowInTaskbar = false; settings = new ePSXeQuitterSettings(); BuildMainMenu(); notifyIconWrapper = new ePSXeQuitterNotifyIcon(); gameTitle = new GameTitle(); gamepad = new ePSXeQuitterGamepad(); SetGamePadEvent(); inputSimulator = new InputSimulator(); List <string> args = new List <string>(Environment.GetCommandLineArgs()); args.RemoveAt(0); ePSXeProcess = ExecuteEPSXe(settings.ePSXePath, args); }
public ePSXeQuitterGamepad() { ePSXeQuitterSettings settings = new ePSXeQuitterSettings(); reporterState = new ReporterState(); if (!reporterState.LastActiveState.IsConnected) { // should be checked DirectInput } var hotkeysString = settings.Hotkeys.Split(',').Select(x => x.Trim()).Where(x => !string.IsNullOrWhiteSpace(x)); foreach (string hotkeyString in hotkeysString) { try { hotkeys.Add((int)Enum.Parse(typeof(GamePadButtonsAndDpad), hotkeyString, true)); } catch { } } dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 1000 / 60); dispatcherTimer.Start(); }
public GameTitle() { settings = new ePSXeQuitterSettings(); stateFolder = settings.StateFolderPath; if (!Directory.Exists(stateFolder)) { WriteLog(@"Couldn't find state folder: " + stateFolder); Application.Current.Shutdown(); } stateBackupFolder = settings.StateBackupFolderPath; if (!Directory.Exists(stateBackupFolder)) { Directory.CreateDirectory(stateBackupFolder); } inputSimulator = new InputSimulator(); // List <string> args = new List <string>(Environment.GetCommandLineArgs()); args.RemoveAt(0); string titlePath = GetTitlePath(args); if (File.Exists(titlePath)) { titleId = GetTitleIdFromFile(titlePath); } else if (Directory.Exists(titlePath)) { titleId = GetTitleIdFromFolder(titlePath); } else { WriteLog(@"Couldn't detect the title path: " + titlePath); Application.Current.Shutdown(); } // check title ID if (string.IsNullOrEmpty(titleId)) { WriteLog(@"Couldn't detect the title ID."); Application.Current.Shutdown(); } // check region if (Regex.Match(titleId, @"^(PBPX|SCED|SCES|SLED|SLEH|SLES)").Success) { ePSXeQuitterSettings.Region = Regions.EU; } else if (Regex.Match(titleId, @"^(ESPM|PAPX|PCPD|PCPX|SCPM|SCPS|SCZS|SIPS|SLBM|SLKA|SLPM|SLPS)").Success) { ePSXeQuitterSettings.Region = Regions.JP; } else { ePSXeQuitterSettings.Region = Regions.US; } }