protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.Text = string.Format("{0} (v{1}). By {2}", GameSpecificConstants.ClientWindowTitle, GameSpecificConstants.CameraVersion, GameSpecificConstants.CameraCredits); FillAboutTab(); // First setup the controls _settingsEditor.Setup(); _keyBindingsEditor.Setup(); // then load the values from the ini file (if any) so the controls are already there. AppStateSingleton.Instance().LoadFromIni(); AppStateSingleton.Instance().LoadRecentProcessList(); MessageHandlerSingleton.Instance().ConnectedToNamedPipeFunc = () => HandleConnectedToPipe(); MessageHandlerSingleton.Instance().ClientConnectionReceivedFunc = () => HandleConnectionReceived(); _generalTabControl.UpdateSelectedRenderAPI(); // Disable all tabs, except general, log and about. _hotsamplingTab.Enabled = false; _settingsTab.Enabled = false; _keyBindingsTab.Enabled = false; var notificationWindow = new NotificationWindow(); MessageHandlerSingleton.Instance().NotificationLogFunc = s => notificationWindow.AddNotification(s); notificationWindow.Show(this); }
public static void InitializeKeyBindings() { var appState = AppStateSingleton.Instance(); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.BlockInputToGame, nameof(KeyBindingType.BlockInputToGame), new KeyCombination(GameSpecificKeyBindingDefaults.BlockInputToGameDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.EnableDisableCamera, nameof(KeyBindingType.EnableDisableCamera), new KeyCombination(GameSpecificKeyBindingDefaults.EnableDisableCameraDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.DecreaseFoV, nameof(KeyBindingType.DecreaseFoV), new KeyCombination(GameSpecificKeyBindingDefaults.DecreaseFoVDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.IncreaseFoV, nameof(KeyBindingType.IncreaseFoV), new KeyCombination(GameSpecificKeyBindingDefaults.IncreaseFoVDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.ResetFoV, nameof(KeyBindingType.ResetFoV), new KeyCombination(GameSpecificKeyBindingDefaults.ResetFoVDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.LockUnlockCameraMovement, nameof(KeyBindingType.LockUnlockCameraMovement), new KeyCombination(GameSpecificKeyBindingDefaults.LockUnlockCameraMovementDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.MoveCameraLeft, nameof(KeyBindingType.MoveCameraLeft), new KeyCombination(GameSpecificKeyBindingDefaults.MoveCameraLeftDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.MoveCameraRight, nameof(KeyBindingType.MoveCameraRight), new KeyCombination(GameSpecificKeyBindingDefaults.MoveCameraRightDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.MoveCameraForward, nameof(KeyBindingType.MoveCameraForward), new KeyCombination(GameSpecificKeyBindingDefaults.MoveCameraForwardDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.MoveCameraBackward, nameof(KeyBindingType.MoveCameraBackward), new KeyCombination(GameSpecificKeyBindingDefaults.MoveCameraBackwardDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.MoveCameraUp, nameof(KeyBindingType.MoveCameraUp), new KeyCombination(GameSpecificKeyBindingDefaults.MoveCameraUpDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.MoveCameraDown, nameof(KeyBindingType.MoveCameraDown), new KeyCombination(GameSpecificKeyBindingDefaults.MoveCameraDownDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.RotateCameraUp, nameof(KeyBindingType.RotateCameraUp), new KeyCombination(GameSpecificKeyBindingDefaults.RotateCameraUpDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.RotateCameraDown, nameof(KeyBindingType.RotateCameraDown), new KeyCombination(GameSpecificKeyBindingDefaults.RotateCameraDownDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.RotateCameraLeft, nameof(KeyBindingType.RotateCameraLeft), new KeyCombination(GameSpecificKeyBindingDefaults.RotateCameraLeftDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.RotateCameraRight, nameof(KeyBindingType.RotateCameraRight), new KeyCombination(GameSpecificKeyBindingDefaults.RotateCameraRightDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.TiltCameraLeft, nameof(KeyBindingType.TiltCameraLeft), new KeyCombination(GameSpecificKeyBindingDefaults.TiltCameraLeftDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.TiltCameraRight, nameof(KeyBindingType.TiltCameraRight), new KeyCombination(GameSpecificKeyBindingDefaults.TiltCameraRightDefault))); //appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.SkipFrames, nameof(KeyBindingType.SkipFrames), new KeyCombination(GameSpecificKeyBindingDefaults.SkipFramesDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.ResetTilt, nameof(KeyBindingType.ResetTilt), new KeyCombination(GameSpecificKeyBindingDefaults.ResetTiltDefault))); //appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.ToggleHUD, nameof(KeyBindingType.ToggleHUD), new KeyCombination(GameSpecificKeyBindingDefaults.ToggleHUDDefault))); //appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.PauseUnpauseGame, nameof(KeyBindingType.PauseUnpauseGame), new KeyCombination(GameSpecificKeyBindingDefaults.PauseUnpauseGameDefault))); appState.AddKeyBinding(new KeyBindingSetting(GameSpecificKeyBindingType.TimeOfDayEarlier, nameof(GameSpecificKeyBindingType.TimeOfDayEarlier), new KeyCombination(GameSpecificKeyBindingDefaults.TimeOfDayEarlierDefault))); appState.AddKeyBinding(new KeyBindingSetting(GameSpecificKeyBindingType.TimeOfDayLater, nameof(GameSpecificKeyBindingType.TimeOfDayLater), new KeyCombination(GameSpecificKeyBindingDefaults.TimeOfDayLaterDefault))); }
public static void InitializeSettings() { var appState = AppStateSingleton.Instance(); appState.AddSetting(new FloatSetting(SettingType.FastMovementMultiplier, nameof(SettingType.FastMovementMultiplier), 0.1M, 100.0M, 2, 0.01M, GameSpecificSettingDefaults.FastMovementMultiplier)); appState.AddSetting(new FloatSetting(SettingType.SlowMovementMultiplier, nameof(SettingType.SlowMovementMultiplier), 0.001M, 1.0M, 3, 0.001M, GameSpecificSettingDefaults.SlowMovementMultiplier)); appState.AddSetting(new FloatSetting(SettingType.UpMovementMultiplier, nameof(SettingType.UpMovementMultiplier), 0.1M, 10.0M, 2, 0.01M, GameSpecificSettingDefaults.UpMovementMultiplier)); appState.AddSetting(new FloatSetting(SettingType.MovementSpeed, nameof(SettingType.MovementSpeed), 0.1M, 3.0M, 2, 0.01M, GameSpecificSettingDefaults.MovementSpeed)); appState.AddSetting(new DropDownSetting(SettingType.CameraControlDevice, nameof(SettingType.CameraControlDevice), new List <string>() { nameof(CameraDeviceType.KeyboardMouse), nameof(CameraDeviceType.Gamepad), nameof(CameraDeviceType.Both) }, GameSpecificSettingDefaults.CameraControlDevice)); appState.AddSetting(new FloatSetting(SettingType.RotationSpeed, nameof(SettingType.RotationSpeed), 0.001M, 0.5M, 3, 0.001M, GameSpecificSettingDefaults.RotationSpeed)); appState.AddSetting(new BoolSetting(SettingType.InvertYLookDirection, nameof(SettingType.InvertYLookDirection), GameSpecificSettingDefaults.InvertYLookDirection)); appState.AddSetting(new FloatSetting(SettingType.FoVZoomSpeed, nameof(SettingType.FoVZoomSpeed), 0.0001M, 0.01M, 4, 0.0001M, GameSpecificSettingDefaults.FoVZoomSpeed)); appState.AddSetting(new FolderSetting(SettingType.ShotOutputFolder, nameof(SettingType.ShotOutputFolder), Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "Please select the screenshot output directory")); appState.AddSetting(new IntSetting(SettingType.ShotFramesToWait, nameof(SettingType.ShotFramesToWait), 1, 100, 1, GameSpecificSettingDefaults.ShotFramesToWait)); appState.AddSetting(new DropDownSetting(SettingType.ShotType, nameof(SettingType.ShotType), new List <string>() { nameof(ScreenshotType.HorizontalPanorama), nameof(ScreenshotType.Lightfield) }, GameSpecificSettingDefaults.ShotType)); appState.AddSetting(new FloatSetting(SettingType.PanoTotalFoV, nameof(SettingType.PanoTotalFoV), 30.0M, 359.0M, 1, 0.1M, GameSpecificSettingDefaults.PanoTotalFoV)); appState.AddSetting(new FloatSetting(SettingType.PanoOverlapPercentage, nameof(SettingType.PanoOverlapPercentage), 0.1M, 99.9M, 1, 0.1M, GameSpecificSettingDefaults.PanoOverlapPercentage)); appState.AddSetting(new FloatSetting(SettingType.LightfieldDistance, nameof(SettingType.LightfieldDistance), 0.001M, 5.0M, 3, 0.001M, GameSpecificSettingDefaults.LightfieldDistance)); appState.AddSetting(new IntSetting(SettingType.LightfieldShotCount, nameof(SettingType.LightfieldShotCount), 0, 60, 1, GameSpecificSettingDefaults.LightfieldShotCount)); appState.AddSetting(new DropDownSetting(SettingType.ShotFileType, nameof(SettingType.ShotFileType), new List <string>() { nameof(ScreenshotFileType.Bmp), nameof(ScreenshotFileType.Jpeg), nameof(ScreenshotFileType.Png) }, GameSpecificSettingDefaults.ShotFileType)); }
public static void InitializeKeyBindings() { var appState = AppStateSingleton.Instance(); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.BlockInputToGame, nameof(KeyBindingType.BlockInputToGame), new KeyCombination(GameSpecificKeyBindingDefaults.BlockInputToGameDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.EnableDisableCamera, nameof(KeyBindingType.EnableDisableCamera), new KeyCombination(GameSpecificKeyBindingDefaults.EnableDisableCameraDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.DecreaseFoV, nameof(KeyBindingType.DecreaseFoV), new KeyCombination(GameSpecificKeyBindingDefaults.DecreaseFoVDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.IncreaseFoV, nameof(KeyBindingType.IncreaseFoV), new KeyCombination(GameSpecificKeyBindingDefaults.IncreaseFoVDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.ResetFoV, nameof(KeyBindingType.ResetFoV), new KeyCombination(GameSpecificKeyBindingDefaults.ResetFoVDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.LockUnlockCameraMovement, nameof(KeyBindingType.LockUnlockCameraMovement), new KeyCombination(GameSpecificKeyBindingDefaults.LockUnlockCameraMovementDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.MoveCameraLeft, nameof(KeyBindingType.MoveCameraLeft), new KeyCombination(GameSpecificKeyBindingDefaults.MoveCameraLeftDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.MoveCameraRight, nameof(KeyBindingType.MoveCameraRight), new KeyCombination(GameSpecificKeyBindingDefaults.MoveCameraRightDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.MoveCameraForward, nameof(KeyBindingType.MoveCameraForward), new KeyCombination(GameSpecificKeyBindingDefaults.MoveCameraForwardDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.MoveCameraBackward, nameof(KeyBindingType.MoveCameraBackward), new KeyCombination(GameSpecificKeyBindingDefaults.MoveCameraBackwardDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.MoveCameraUp, nameof(KeyBindingType.MoveCameraUp), new KeyCombination(GameSpecificKeyBindingDefaults.MoveCameraUpDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.MoveCameraDown, nameof(KeyBindingType.MoveCameraDown), new KeyCombination(GameSpecificKeyBindingDefaults.MoveCameraDownDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.RotateCameraUp, nameof(KeyBindingType.RotateCameraUp), new KeyCombination(GameSpecificKeyBindingDefaults.RotateCameraUpDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.RotateCameraDown, nameof(KeyBindingType.RotateCameraDown), new KeyCombination(GameSpecificKeyBindingDefaults.RotateCameraDownDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.RotateCameraLeft, nameof(KeyBindingType.RotateCameraLeft), new KeyCombination(GameSpecificKeyBindingDefaults.RotateCameraLeftDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.RotateCameraRight, nameof(KeyBindingType.RotateCameraRight), new KeyCombination(GameSpecificKeyBindingDefaults.RotateCameraRightDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.TiltCameraLeft, nameof(KeyBindingType.TiltCameraLeft), new KeyCombination(GameSpecificKeyBindingDefaults.TiltCameraLeftDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.TiltCameraRight, nameof(KeyBindingType.TiltCameraRight), new KeyCombination(GameSpecificKeyBindingDefaults.TiltCameraRightDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.TestMultiShotSetup, nameof(KeyBindingType.TestMultiShotSetup), new KeyCombination(GameSpecificKeyBindingDefaults.TestMultiShotSetupDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.TakeShot, nameof(KeyBindingType.TakeShot), new KeyCombination(GameSpecificKeyBindingDefaults.TakeShotDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.TakeMultiShot, nameof(KeyBindingType.TakeMultiShot), new KeyCombination(false, true, false, GameSpecificKeyBindingDefaults.TakeMultiShotDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.ToggleHUD, nameof(KeyBindingType.ToggleHUD), new KeyCombination(GameSpecificKeyBindingDefaults.ToggleHUDDefault))); appState.AddKeyBinding(new KeyBindingSetting(KeyBindingType.PauseUnpauseGame, nameof(KeyBindingType.PauseUnpauseGame), new KeyCombination(GameSpecificKeyBindingDefaults.PauseUnpauseGameDefault))); }
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) { _sbHyperlink.NavigateUri = new Uri(ConstantsEnums.IGCSRootURL); _notificationNotifier = new Notifier(cfg => { cfg.PositionProvider = new PrimaryScreenPositionProvider(corner: Corner.TopLeft, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(6)); cfg.Dispatcher = Application.Current.Dispatcher; cfg.DisplayOptions.TopMost = true; }); this.Title = string.Format("{0} (v{1}). By {2}", GameSpecificConstants.ClientWindowTitle, GameSpecificConstants.CameraVersion, GameSpecificConstants.CameraCredits); // First setup the controls _configurationEditor.Setup(); _keyBindingsEditor.Setup(); // then load the values from the ini file (if any) so the controls are already there. AppStateSingleton.Instance().LoadFromIni(); AppStateSingleton.Instance().LoadRecentProcessList(); MessageHandlerSingleton.Instance().ConnectedToNamedPipeFunc = () => HandleConnectedToPipe(); MessageHandlerSingleton.Instance().ClientConnectionReceivedFunc = () => HandleConnectionReceived(); // Disable all tabs, except general, log and about. _hotSamplingTab.IsEnabled = false; _configurationTab.IsEnabled = false; _keybindingsTab.IsEnabled = false; MessageHandlerSingleton.Instance().NotificationLogFunc = s => DisplayNotification(s); }
private void _injectButton_Click(object sender, EventArgs e) { if (!IsReadyToInject()) { return; } // assume things are OK var injector = new DllInjector(); string filenameOfDllToInject = GetAbsolutePathForDllName(); var result = injector.PerformInjection(_selectedProcess.Id, filenameOfDllToInject); if (result) { // store dll with process name in recent list AppStateSingleton.Instance().AddDllNameForProcess(_selectedProcess.MainModule.ModuleName, filenameOfDllToInject); AppStateSingleton.Instance().SetAttachedProcess(_selectedProcess); _selectedProcess.EnableRaisingEvents = true; _selectedProcess.Exited += _selectedProcess_Exited; DisplayAttachedProcessInUI(); this.DllInjected.RaiseEvent(this); } else { MessageBox.Show(string.Format("Injection failed when performing:{0}{1}{0}The following error occurred:{0}{2}", Environment.NewLine, injector.LastActionPerformed, new Win32Exception(injector.LastError).Message), "Injection result", MessageBoxButton.OK, MessageBoxImage.Error); } }
public static void InitializeSettings() { var appState = AppStateSingleton.Instance(); appState.AddSetting(new FloatSetting(SettingType.FastMovementMultiplier, nameof(SettingType.FastMovementMultiplier), 0.1, 100.0, 2, 0.01, GameSpecificSettingDefaults.FastMovementMultiplier)); appState.AddSetting(new FloatSetting(SettingType.SlowMovementMultiplier, nameof(SettingType.SlowMovementMultiplier), 0.001, 1.0, 3, 0.001, GameSpecificSettingDefaults.SlowMovementMultiplier)); appState.AddSetting(new FloatSetting(SettingType.UpMovementMultiplier, nameof(SettingType.UpMovementMultiplier), 0.1, 10.0, 2, 0.01, GameSpecificSettingDefaults.UpMovementMultiplier)); appState.AddSetting(new FloatSetting(SettingType.MovementSpeed, nameof(SettingType.MovementSpeed), 0.001, 0.5, 3, 0.001, GameSpecificSettingDefaults.MovementSpeed)); appState.AddSetting(new DropDownSetting(SettingType.CameraControlDevice, nameof(SettingType.CameraControlDevice), new List <string>() { nameof(CameraDeviceType.KeyboardMouse), nameof(CameraDeviceType.Gamepad), nameof(CameraDeviceType.Both) }, GameSpecificSettingDefaults.CameraControlDevice)); appState.AddSetting(new FloatSetting(SettingType.RotationSpeed, nameof(SettingType.RotationSpeed), 0.001, 0.5, 3, 0.001, GameSpecificSettingDefaults.RotationSpeed)); appState.AddSetting(new BoolSetting(SettingType.InvertYLookDirection, nameof(SettingType.InvertYLookDirection), GameSpecificSettingDefaults.InvertYLookDirection)); appState.AddSetting(new FloatSetting(SettingType.FoVZoomSpeed, nameof(SettingType.FoVZoomSpeed), 0.01, 2.0, 2, 0.01, GameSpecificSettingDefaults.FoVZoomSpeed)); appState.AddSetting(new FloatSetting(GameSpecificSettingType.TimeOfDay, nameof(GameSpecificSettingType.TimeOfDay), 0.00, 23.99, 2, 0.01, GameSpecificSettingDefaults.TimeOfDay) { PersistToIniFile = false }); appState.AddSetting(new FloatSetting(GameSpecificSettingType.Wetness_StreetWetnessFactor, nameof(GameSpecificSettingType.Wetness_StreetWetnessFactor), 0.0, 1.0f, 2, 0.01, GameSpecificSettingDefaults.Wetness_StreetWetnessFactor) { PersistToIniFile = false }); appState.AddSetting(new FloatSetting(GameSpecificSettingType.Wetness_PuddleSize, nameof(GameSpecificSettingType.Wetness_PuddleSize), 0.0, 1.0f, 2, 0.01, GameSpecificSettingDefaults.Wetness_PuddleSize) { PersistToIniFile = false }); appState.AddSetting(new BoolSetting(GameSpecificSettingType.Wetness_OverrideParameters, nameof(GameSpecificSettingType.Wetness_OverrideParameters), GameSpecificSettingDefaults.Wetness_OverrideParameters) { PersistToIniFile = false }); }
internal void Setup() { var settings = AppStateSingleton.Instance().Settings; foreach (var setting in settings) { switch (setting.ID) { case GameSpecificSettingType.TimeOfDay: setting.Setup(_timeOfDayInput); break; case GameSpecificSettingType.Wetness_OverrideParameters: setting.Setup(_overrideWetness); break; case GameSpecificSettingType.Wetness_PuddleSize: setting.Setup(_puddleSizeInput); break; case GameSpecificSettingType.Wetness_StreetWetnessFactor: setting.Setup(_streetWetnessInput); break; } } }
private void HandleConnectedToPipe() { LogHandlerSingleton.Instance().LogLine("Connected to the DLL's named pipe", "System", true, true); AppStateSingleton.Instance().SendSettings(); AppStateSingleton.Instance().SendKeyBindings(); LogHandlerSingleton.Instance().LogLine("Initial settings sent", "System", true, true); _clientToDllConnectedSBLabel.Text = "Camera dll->client active"; }
protected override void OnClosing(CancelEventArgs e) { // first make sure the recently used resolutions are persisted AppStateSingleton.Instance().StoreRecentlyUsedResolutions(_hotsamplingControl.RecentlyUserResolutions); AppStateSingleton.Instance().SaveSettingsToIni(); AppStateSingleton.Instance().SaveRecentProcessList(); _notificationNotifier.Dispose(); base.OnClosing(e); }
private void HandleDllInjected() { // enable all tabs _hotsamplingTab.Enabled = true; _settingsTab.Enabled = true; _keyBindingsTab.Enabled = true; // show the resolutions on the hotsampling tab _hotsamplingControl.BindData(); // Send preferred rendering API. AppStateSingleton.Instance().PreferredRenderApiKind = _generalTabControl.SelectedRenderAPI; MessageHandlerSingleton.Instance().SendDXGIHookActionForPreferredRenderAPI(_generalTabControl.SelectedRenderAPI); }
internal void Setup() { var settings = AppStateSingleton.Instance().Settings; foreach (var setting in settings) { switch (setting.ID) { case SettingType.FastMovementMultiplier: setting.Setup(_fastMovementInput); break; case SettingType.SlowMovementMultiplier: setting.Setup(_slowMovementInput); break; case SettingType.UpMovementMultiplier: setting.Setup(_upMovementInput); break; case SettingType.MovementSpeed: setting.Setup(_movementSpeedInput); break; case SettingType.CameraControlDevice: setting.Setup(_cameraControlDeviceInput); break; case SettingType.RotationSpeed: setting.Setup(_rotationSpeedInput); break; case SettingType.InvertYLookDirection: setting.Setup(_invertYInput); break; case SettingType.FoVZoomSpeed: setting.Setup(_fovSpeedInput); break; case SettingType.EnableSharpening: setting.Setup(_enableSharpeningInput); break; case SettingType.ResolutionScale: setting.Setup(_resolutionScaleInput); break; } } }
private void HandleConnectedToPipe() { LogHandlerSingleton.Instance().LogLine("Connected to the DLL's named pipe", "System", true); if (this.CheckAccess()) { AppStateSingleton.Instance().SendInitialData(); } else { this.Dispatcher?.Invoke(() => AppStateSingleton.Instance().SendInitialData()); } LogHandlerSingleton.Instance().LogLine("Initial settings sent", "System", true); SetTextOnTextBlock(_dllToClientConnectedSBLabel, "Camera dll->client active"); }
private void DisplayAttachedProcessInUI() { var attachedProcess = AppStateSingleton.Instance().AttachedProcess; if (attachedProcess == null) { _injectDllGroupBox.Visible = true; _attachedProcessInfoGroupBox.Visible = false; return; } _attachedProcessInfoGroupBox.Visible = true; _injectDllGroupBox.Visible = false; _executableIconPictureBox.Image = System.Drawing.Icon.ExtractAssociatedIcon(attachedProcess.MainModule.FileName).ToBitmap(); _executableTextBox.Text = attachedProcess.MainModule.FileName; _windowTitleTextBox.Text = attachedProcess.MainWindowTitle; }
private void DisplayAttachedProcessInUI() { var attachedProcess = AppStateSingleton.Instance().AttachedProcess; if (attachedProcess == null) { _injectDllGroupBox.Visibility = Visibility.Visible; _attachedProcessInfoGroupBox.Visibility = Visibility.Hidden; return; } _injectDllGroupBox.Visibility = Visibility.Collapsed; _attachedProcessInfoGroupBox.Visibility = Visibility.Visible; _executableIconImage.Source = System.Drawing.Icon.ExtractAssociatedIcon(attachedProcess.MainModule.FileName).ToBitmapImage(); _executableTextBox.Text = attachedProcess.MainModule.FileName; _windowTitleTextBox.Text = attachedProcess.MainWindowTitle; }
internal void Setup() { var settings = AppStateSingleton.Instance().Settings; foreach (var setting in settings) { switch (setting.ID) { case SettingType.FastMovementMultiplier: setting.Setup(_fastMovementInput); break; case SettingType.SlowMovementMultiplier: setting.Setup(_slowMovementInput); break; case SettingType.UpMovementMultiplier: setting.Setup(_upMovementInput); break; case SettingType.MovementSpeed: setting.Setup(_movementSpeedInput); break; case SettingType.CameraControlDevice: setting.Setup(_cameraControlDeviceInput); break; case SettingType.RotationSpeed: setting.Setup(_rotationSpeedInput); break; case SettingType.InvertYLookDirection: setting.Setup(_invertYInput); break; case SettingType.FoVZoomSpeed: setting.Setup(_fovSpeedInput); break; case GameSpecificSettingType.TimeOfDay: setting.Setup(_timeOfDayInput); break; } } }
public static void InitializeSettings() { var appState = AppStateSingleton.Instance(); appState.AddSetting(new FloatSetting(SettingType.FastMovementMultiplier, nameof(SettingType.FastMovementMultiplier), 0.1, 100.0, 2, 0.01, GameSpecificSettingDefaults.FastMovementMultiplier)); appState.AddSetting(new FloatSetting(SettingType.SlowMovementMultiplier, nameof(SettingType.SlowMovementMultiplier), 0.001, 1.0, 3, 0.001, GameSpecificSettingDefaults.SlowMovementMultiplier)); appState.AddSetting(new FloatSetting(SettingType.UpMovementMultiplier, nameof(SettingType.UpMovementMultiplier), 0.1, 10.0, 2, 0.01, GameSpecificSettingDefaults.UpMovementMultiplier)); appState.AddSetting(new FloatSetting(SettingType.MovementSpeed, nameof(SettingType.MovementSpeed), 0.1, 3.0, 2, 0.01, GameSpecificSettingDefaults.MovementSpeed)); appState.AddSetting(new DropDownSetting(SettingType.CameraControlDevice, nameof(SettingType.CameraControlDevice), new List <string>() { nameof(CameraDeviceType.KeyboardMouse), nameof(CameraDeviceType.Gamepad), nameof(CameraDeviceType.Both) }, GameSpecificSettingDefaults.CameraControlDevice)); appState.AddSetting(new FloatSetting(SettingType.RotationSpeed, nameof(SettingType.RotationSpeed), 0.001, 0.5, 3, 0.001, GameSpecificSettingDefaults.RotationSpeed)); appState.AddSetting(new BoolSetting(SettingType.InvertYLookDirection, nameof(SettingType.InvertYLookDirection), GameSpecificSettingDefaults.InvertYLookDirection)); appState.AddSetting(new FloatSetting(SettingType.FoVZoomSpeed, nameof(SettingType.FoVZoomSpeed), 0.0001, 0.01, 4, 0.0001, GameSpecificSettingDefaults.FoVZoomSpeed)); }
private void _selectProcessButton_Click(object sender, RoutedEventArgs e) { var processSelector = new ProcessSelectorWPF(AppStateSingleton.Instance().GetRecentProcessesList()); processSelector.Owner = Window.GetWindow(this); processSelector.ShowDialog(); if (!processSelector.DialogResult.HasValue || !processSelector.DialogResult.Value) { return; } _selectedProcess = processSelector.SelectedProcess; DisplayProcessInfoForInjection(); // pre-select the dll if there's no dll selected if (string.IsNullOrEmpty(_dllFilenameTextBox.Text)) { _dllFilenameTextBox.Text = AppStateSingleton.Instance().GetDllNameForSelectedProcess(_selectedProcess?.MainModule?.ModuleName) ?? string.Empty; } }
private void _selectProcessButton_Click(object sender, EventArgs e) { using (var processSelector = new ProcessSelector(AppStateSingleton.Instance().GetRecentProcessesList())) { var result = processSelector.ShowDialog(this); if (result == DialogResult.Cancel) { return; } _selectedProcess = processSelector.SelectedProcess; DisplayProcessInfoForInjection(); // pre-select the dll if there's no dll selected if (string.IsNullOrEmpty(_dllFilenameTextBox.Text)) { _dllFilenameTextBox.Text = AppStateSingleton.Instance().GetDllNameForSelectedProcess(_selectedProcess?.MainModule?.ModuleName) ?? string.Empty; } } }
private void GetActiveGameWindowInfo() { _gameWindowHwnd = AppStateSingleton.Instance().GetMainWindowHandleOfAttachedProcess(); if (_gameWindowHwnd == IntPtr.Zero) { _currentWidthTextBox.Text = string.Empty; _currentHeightTextBox.Text = string.Empty; _currentARTextBox.Text = string.Empty; return; } Win32Wrapper.GetWindowInfo(_gameWindowHwnd, ref _gameWindowInfo); _currentWidthTextBox.Text = _gameWindowInfo.rcWindow.Width.ToString(); _currentHeightTextBox.Text = _gameWindowInfo.rcWindow.Height.ToString(); _currentARTextBox.Text = GeneralUtils.CalculateAspectRatio(_gameWindowInfo.rcWindow.Width, _gameWindowInfo.rcWindow.Height).ToString(appendDescription: false); if (_newHeightBox.Value <= 0 || _newWidthBox.Value <= 0) { //reset with current window _newHeightBox.Value = _gameWindowInfo.rcWindow.Height; _newWidthBox.Value = _gameWindowInfo.rcWindow.Width; _aspectRatioTextBox.Text = _currentARTextBox.Text; } }
private void GetActiveGameWindowInfo() { _gameWindowHwnd = AppStateSingleton.Instance().GetMainWindowHandleOfAttachedProcess(); _currentResolutionGroupBox.Enabled = _gameWindowHwnd != IntPtr.Zero; if (_gameWindowHwnd == IntPtr.Zero) { _currentWidthTextBox.Text = string.Empty; _currentHeightTextBox.Text = string.Empty; _currentARTextBox.Text = string.Empty; return; } Win32Wrapper.GetWindowInfo(_gameWindowHwnd, ref _gameWindowInfo); _currentWidthTextBox.Text = _gameWindowInfo.rcWindow.Width.ToString(); _currentHeightTextBox.Text = _gameWindowInfo.rcWindow.Height.ToString(); _currentARTextBox.Text = CalculateAspectRatio(_gameWindowInfo.rcWindow.Width, _gameWindowInfo.rcWindow.Height).ToString(); if (_newHeightUpDown.Value <= 0 || _newWidthUpDown.Value <= 0) { //reset with current window _newHeightUpDown.Value = _gameWindowInfo.rcWindow.Height; _newWidthUpDown.Value = _gameWindowInfo.rcWindow.Width; } }
protected override void OnClosing(CancelEventArgs e) { AppStateSingleton.Instance().SaveSettingsToIni(); AppStateSingleton.Instance().SaveRecentProcessList(); base.OnClosing(e); }
internal void Setup() { var settings = AppStateSingleton.Instance().Settings; foreach (var setting in settings) { switch (setting.ID) { case SettingType.FastMovementMultiplier: setting.Setup(_fastMovementInput); break; case SettingType.SlowMovementMultiplier: setting.Setup(_slowMovementInput); break; case SettingType.UpMovementMultiplier: setting.Setup(_upMovementInput); break; case SettingType.MovementSpeed: setting.Setup(_movementSpeedInput); break; case SettingType.CameraControlDevice: setting.Setup(_cameraControlDeviceInput); break; case SettingType.RotationSpeed: setting.Setup(_rotationSpeedInput); break; case SettingType.InvertYLookDirection: setting.Setup(_invertYInput); break; case SettingType.FoVZoomSpeed: setting.Setup(_fovSpeedInput); break; case SettingType.ShotOutputFolder: setting.Setup(_shotOutputFolderInput); break; case SettingType.ShotFramesToWait: setting.Setup(_frameWaitInput); break; case SettingType.ShotType: setting.Setup(_shotTypeInput); break; case SettingType.PanoTotalFoV: setting.Setup(_panoFovInput); break; case SettingType.PanoOverlapPercentage: setting.Setup(_panoOverlapInput); break; case SettingType.LightfieldDistance: setting.Setup(_lightfieldDistanceInput); break; case SettingType.LightfieldShotCount: setting.Setup(_lightfieldShotCountInput); break; case SettingType.ShotFileType: setting.Setup(_shotFileTypeInput); break; } } }
public void BindData() { GetActiveGameWindowInfo(); // game window hwnd is set in getactivegamewindowinfo. // Use Windows Forms. This app is opt-in on high dpi awareness, so the values should be correct. This high-dpi awareness will f**k up winforms controls but we're // not using these so it's ok. It's otherwise a PITA to get the monitor resolution of the monitor the window is on! var screenWithGameWindow = Screen.FromHandle(_gameWindowHwnd); BuildResolutionTree(screenWithGameWindow.Bounds); _resolutionRefreshTimer.Enabled = true; this.RecentlyUserResolutions = new ObservableCollection <Resolution>(AppStateSingleton.Instance().RecentlyUsedResolutions); _recentlyUsedResolutionsList.ItemsSource = this.RecentlyUserResolutions; }
internal void Setup() { var keybindings = AppStateSingleton.Instance().KeyBindings; foreach (var binding in keybindings) { switch (binding.ID) { case KeyBindingType.BlockInputToGame: binding.Setup(_blockInputInput); break; case KeyBindingType.EnableDisableCamera: binding.Setup(_enableDisableCameraInput); break; case KeyBindingType.DecreaseFoV: binding.Setup(_decreaseFoVInput); break; case KeyBindingType.IncreaseFoV: binding.Setup(_increaseFoVInput); break; case KeyBindingType.ResetFoV: binding.Setup(_resetFoVInput); break; case KeyBindingType.LockUnlockCameraMovement: binding.Setup(_lockUnlockCameraMovementInput); break; case KeyBindingType.MoveCameraLeft: binding.Setup(_moveCameraLeftInput); break; case KeyBindingType.MoveCameraRight: binding.Setup(_moveCameraRightInput); break; case KeyBindingType.MoveCameraForward: binding.Setup(_moveCameraForwardInput); break; case KeyBindingType.MoveCameraBackward: binding.Setup(_moveCameraBackwardInput); break; case KeyBindingType.MoveCameraUp: binding.Setup(_moveCameraUpInput); break; case KeyBindingType.MoveCameraDown: binding.Setup(_moveCameraDownInput); break; case KeyBindingType.RotateCameraUp: binding.Setup(_rotateCameraUpInput); break; case KeyBindingType.RotateCameraDown: binding.Setup(_rotateCameraDownInput); break; case KeyBindingType.RotateCameraLeft: binding.Setup(_rotateCameraLeftInput); break; case KeyBindingType.RotateCameraRight: binding.Setup(_rotateCameraRightInput); break; case KeyBindingType.TiltCameraLeft: binding.Setup(_tiltCameraLeftInput); break; case KeyBindingType.TiltCameraRight: binding.Setup(_tiltCameraRightInput); break; case KeyBindingType.TestMultiShotSetup: binding.Setup(_testMultiShotSetupInput); break; case KeyBindingType.TakeShot: binding.Setup(_takeShotInput); break; case KeyBindingType.TakeMultiShot: binding.Setup(_takeMultiShotInput); break; case KeyBindingType.ToggleHUD: binding.Setup(_toggleHUDInput); break; case KeyBindingType.PauseUnpauseGame: binding.Setup(_pauseUnPauseInput); break; } } }
/// <summary> /// Updates the combobox selection with the preferred render api from the ini file, which is loaded after this control has been shown and initialized. /// </summary> public void UpdateSelectedRenderAPI() { _renderAPIComboBox.SelectedValue = AppStateSingleton.Instance().PreferredRenderApiKind; }
internal void Setup() { var keybindings = AppStateSingleton.Instance().KeyBindings; foreach (var binding in keybindings) { switch (binding.ID) { case KeyBindingType.BlockInputToGame: binding.Setup(_blockInputInput); break; case KeyBindingType.EnableDisableCamera: binding.Setup(_enableDisableCameraInput); break; case KeyBindingType.DecreaseFoV: binding.Setup(_decreaseFoVInput); break; case KeyBindingType.IncreaseFoV: binding.Setup(_increaseFoVInput); break; case KeyBindingType.ResetFoV: binding.Setup(_resetFoVInput); break; case KeyBindingType.LockUnlockCameraMovement: binding.Setup(_lockUnlockCameraMovementInput); break; case KeyBindingType.MoveCameraLeft: binding.Setup(_moveCameraLeftInput); break; case KeyBindingType.MoveCameraRight: binding.Setup(_moveCameraRightInput); break; case KeyBindingType.MoveCameraForward: binding.Setup(_moveCameraForwardInput); break; case KeyBindingType.MoveCameraBackward: binding.Setup(_moveCameraBackwardInput); break; case KeyBindingType.MoveCameraUp: binding.Setup(_moveCameraUpInput); break; case KeyBindingType.MoveCameraDown: binding.Setup(_moveCameraDownInput); break; case KeyBindingType.RotateCameraUp: binding.Setup(_rotateCameraUpInput); break; case KeyBindingType.RotateCameraDown: binding.Setup(_rotateCameraDownInput); break; case KeyBindingType.RotateCameraLeft: binding.Setup(_rotateCameraLeftInput); break; case KeyBindingType.RotateCameraRight: binding.Setup(_rotateCameraRightInput); break; case KeyBindingType.TiltCameraLeft: binding.Setup(_tiltCameraLeftInput); break; case KeyBindingType.TiltCameraRight: binding.Setup(_tiltCameraRightInput); break; case KeyBindingType.ResetTilt: binding.Setup(_resetTiltCameraInput); break; case GameSpecificKeyBindingType.TimeOfDayEarlier: binding.Setup(_timeOfDayEarlierInput); break; case GameSpecificKeyBindingType.TimeOfDayLater: binding.Setup(_timeOfDayLaterInput); break; } } }