public void ChangeCurrentGameEmulationType(EmulationType type) { var game = SettingsManager.CurrentGame; if (game == null) { return; } game.EmulationType = (int)type; }
public void CheckAndLoadXInputLibrary(UserGame game, bool getXInputStates) { lock (Controller.XInputLock) { // Don't load if loaded. if (Controller.IsLoaded) { return; } // Don't load until device list was not refreshed. if (UpdateDevicesPending) { return; } var emType = (EmulationType)(game?.EmulationType ?? (int)EmulationType.None); // Don't load if not needed. if (emType == EmulationType.None) { return; } // If no actual XInput states are required for Virtual emulation. if (emType == EmulationType.Virtual && !getXInputStates) { return; } // No actual XInput states are required for Library emulation when minimized. // This will also release exclusive lock if another game/application must use it. if (emType == EmulationType.Library && !Global._MainWindow.FormEventsEnabled) { return; } //MainForm.Current.Save(); var e = new DInputEventArgs(); // Always load Microsoft XInput DLL by default. CurrentEmulation = emType; var useMicrosoft = emType == EmulationType.Virtual; Program.ReloadCount++; var dllInfo = EngineHelper.GetDefaultDll(useMicrosoft); if (dllInfo != null && dllInfo.Exists) { var vi = FileVersionInfo.GetVersionInfo(dllInfo.FullName); e.XInputVersionInfo = vi; e.XInputFileInfo = dllInfo; // If fast reload of settings is supported then... if (Controller.IsLoaded && Controller.IsResetSupported) { IAsyncResult result; Action action = () => { Controller.Reset(); }; result = action.BeginInvoke(null, null); var timeout = !result.AsyncWaitHandle.WaitOne(1000); var caption = string.Format("Failed to Reset() controller. '{0}'", dllInfo.FullName); e.Error = new Exception(caption); } // Slow: Reload whole x360ce.dll. Exception error; Controller.ReLoadLibrary(dllInfo.FullName, out error); if (!Controller.IsLoaded) { var caption = string.Format("Failed to load '{0}'", dllInfo.FullName); e.Error = new Exception(caption); } } // If x360ce DLL loaded and settings changed then... var IsLibrary = game != null && game.IsLibrary; if (Controller.IsLoaded && IsLibrary && SettingsChanged) { // Reset configuration. Controller.Reset(); SettingsChanged = false; } var ev = XInputReloaded; if (ev != null) { ev(this, e); } } }
public int put_Emulation(EmulationType newVal) { return(((delegate * unmanaged <IBootOptions *, EmulationType, int>)(lpVtbl[13]))((IBootOptions *)Unsafe.AsPointer(ref this), newVal)); }