Пример #1
0
        public static void Start()
        {
            Log.Information("VigemManager.Start");

            try
            {
                //TODO test that if we dont have vigem bus driver installed does the error still get propegated

                System.Threading.Thread.Sleep(1000);
                VigemInternals vig = new VigemInternals();
                InstanceSettings.GetInstance().SetVigemInternals(vig);
                vig.StartAndListen();
            }
            catch (Nefarius.ViGEm.Client.Exceptions.VigemBusNotFoundException e)
            {
                ExceptionLogger.LogException("VigemManager.Start error L55", e);

                System.Windows.MessageBox.Show("Vigembus not installed!",
                                               "Fatal Error",
                                               (MessageBoxButton)MessageBoxButtons.OK,
                                               (MessageBoxImage)MessageBoxIcon.Error);
                System.Windows.Forms.Application.Exit();
            }
            catch (Exception e)
            {
                ExceptionLogger.LogException("VigemManager.Start error L65", e);

                System.Windows.MessageBox.Show("whoops! tell the developer he failed",
                                               "Fatal Error",
                                               (MessageBoxButton)MessageBoxButtons.OK,
                                               (MessageBoxImage)MessageBoxIcon.Error);
                System.Windows.Forms.Application.Exit();
            }
        }
 private void RefreshRemotePlayProcess()
 {
     if (InstanceSettings.GetInstance().GetRemotePlayProcess() != null)
     {
         InstanceSettings.GetInstance().GetRemotePlayProcess().Refresh();
     }
 }
        public void WelcomeStep3Done_ConnectAdapter()
        {
            if (ApplicationSettings.GetInstance().EmulationMode == EmulationConstants.ONLY_VIGEM ||
                ApplicationSettings.GetInstance().EmulationMode == EmulationConstants.VIGEM_AND_PROCESS_INJECTION)
            {
                VigemManager.Start();
            }

            RefreshRemotePlayProcess();

            ApplicationSettings.Save();
            InstanceSettings.GetInstance().EnableMouseInput = true;

            simpleConfigPage     = new SimpleConfigPage();
            advancedMappingsPage = new AdvancedMappingsPage();
            MouseAdvancedConfigPage   mouseAdvancedConfigPage   = new MouseAdvancedConfigPage();
            MiscellaneousSettingsPage miscellaneousSettingsPage = new MiscellaneousSettingsPage();

            AddTab("Simple Config", simpleConfigPage);
            AddTab("Advanced mappings", advancedMappingsPage);
            AddTab("Mouse Advanced Config", mouseAdvancedConfigPage);
            AddTab("Miscellaneous Settings", miscellaneousSettingsPage);

            // remove the welcome tab
            tabs.Items.RemoveAt(0);

            // Refresh to ensure advancedMappingsPage isnt blank
            advancedMappingsPage.RefreshButtonContents();
        }
 private void Handler_RemotePlayVolumeChange(object sender, EventArgs e)
 {
     if (InstanceSettings.GetInstance().GetRemotePlayProcess() != null)
     {
         AudioManager.SetApplicationVolume(InstanceSettings.GetInstance().GetRemotePlayProcess().Id, UserSettings.GetInstance().RemotePlayVolume);
     }
 }
        private void Handle_LogLevelChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            if (Combo_LogLevel.SelectedValue != null)
            {
                ComboBoxItem selectedItem = (ComboBoxItem)Combo_LogLevel.SelectedItem;
                if (selectedItem.Tag != null)
                {
                    string     tag        = selectedItem.Tag.ToString();
                    int        value      = Int32.Parse(tag);
                    LogManager logManager = InstanceSettings.GetInstance().GetLogManager();

                    if (INDEX_LOG_DEFAULT == value)
                    {
                        logManager.SetLoggingLevel(LogEventLevel.Information);
                    }
                    else if (INDEX_LOG_DEBUG == value)
                    {
                        logManager.SetLoggingLevel(LogEventLevel.Debug);
                    }
                    else if (INDEX_LOG_VERBOSE == value)
                    {
                        logManager.SetLoggingLevel(LogEventLevel.Verbose);
                    }
                }
            }
        }
Пример #6
0
        private void OnAppExit(object sender, ExitEventArgs e)
        {
            Log.Debug("App OnAppExit");
            InstanceSettings.GetInstance().EnableMouseInput = false;

            // cause not having a cursor is a pain in the ass
            Utility.ShowCursor(true);

            UserSettings.Save(UserSettings.PROFILE_PREVIOUS);
            ApplicationSettings.Save();

            VigemManager.Stop(InstanceSettings.GetInstance());

            //TODO: hardcoded, fix.
            //Injector.FindProcess("RemotePlay").Kill();
        }
        private void SetInitialLogLevel()
        {
            LogManager    logManager = InstanceSettings.GetInstance().GetLogManager();
            LogEventLevel level      = logManager.GetLoggingLevel();

            Log.Information("LogControl.SetInitialLogLevel using {0}", level);

            if (LogEventLevel.Debug == level)
            {
                Combo_LogLevel.SelectedIndex = INDEX_LOG_DEBUG;
            }
            else if (LogEventLevel.Verbose == level)
            {
                Combo_LogLevel.SelectedIndex = INDEX_LOG_VERBOSE;
            }
            else
            {
                Combo_LogLevel.SelectedIndex = INDEX_LOG_DEFAULT;
            }
        }
Пример #8
0
        private async void OnAppStartup(object sender, StartupEventArgs e)
        {
            LogManager logManager = new LogManager();

            logManager.SetupLogger();
            InstanceSettings.GetInstance().SetLogManager(logManager);

            Console.WriteLine("app/adapter started");
            Console.WriteLine("for more about what has happened in this app, see logs/log.txt");
            Log.Information("PS4KMA v{0} started", VersionUtil.GetVersionWithBuildDate());

            // cause not having a cursor is a pain in the ass
            Utility.ShowCursor(true);

            ApplicationSettings.Load();
            UserSettings.LoadPrevious();

            AppUpdater appUpdater = new AppUpdater();

            await appUpdater.UpdateIfAvailable();
        }
Пример #9
0
 public static bool IsRemotePlayInForeground()
 {
     return(IsInForeground(InstanceSettings.GetInstance().GetRemotePlayProcess()));
 }
Пример #10
0
        protected void RefreshRemotePlayProcess()
        {
            Process RemotePlayProcess = Injector.FindProcess(RemotePlayConstants.TARGET_PROCESS_NAME);

            InstanceSettings.GetInstance().SetRemotePlayProcess(RemotePlayProcess);
        }