예제 #1
0
        /// <summary>
        ///     Created in Program, instantiated by GuiInitializer.
        ///     Finds the Batman: Arkham Asylum Profile or creates it if it doesn't exist yet.
        ///     Calls getNVSettings().
        /// </summary>
        public NvidiaWorker()
        {
            NVIDIA.Initialize();
            logger.Debug("Constructor - NVIDIA API initialized.");
            _session = DriverSettingsSession.CreateAndLoad();
            try
            {
                _session.FindProfileByName("Batman: Arkham Asylum");
            }
            catch (NVIDIAApiException e)
            {
                Console.WriteLine(e);
                DriverSettingsProfile profile =
                    DriverSettingsProfile.CreateProfile(_session, "Batman: Arkham Asylum", null);
                ProfileApplication profApp = ProfileApplication.CreateApplication(profile, "shippingpc-bmgame.exe");
                profile = profApp.Profile;
                profile.SetSetting(KnownSettingId.AmbientOcclusionModeActive, 0);
                profile.SetSetting(KnownSettingId.AmbientOcclusionMode, 0);
                _session.Save();
                logger.Warn("Constructor - NVIDIA profile not found. Creating profile: {0}", profile.ToString());
            }

            _prof = _session.FindProfileByName("Batman: Arkham Asylum");
            getNVSettings();
            logger.Info("Constructor - NVIDIA profile fully processed.");
        }
예제 #2
0
        public static void Initialize()
        {
#if DEBUG
            try
            {
#endif
            ThreadPriorityHook = new SetThreadPriority();
            ThreadPriorityHook.OnThreadPriorityChanged = OnThreadPriorityChanged;
            ThreadPriorityHook.Install();

            var NVPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "nvapi64.dll");
            if (File.Exists(NVPath))
            {
                NVIDIA.Initialize();
                using (var Session = DriverSettingsSession.CreateAndLoad())
                {
                    var Application = Session.FindApplication(Process.GetCurrentProcess().MainModule.FileName);
                    if (Application != null)
                    {
                        Application.Profile.SetSetting(KnownSettingId.OpenGLThreadControl, 1);
                        Session.Save();
                    }
#if DEBUG
                    else
                    {
                        LOG.WriteLine("Failed to Find the Application Profile");
                        LOG.Flush();
                    }
#endif
                }
                NVIDIA.Unload();
            }
#if DEBUG
        }

        catch (Exception ex)
        {
            LOG.WriteLine(ex);
            LOG.Flush();
        }
#endif
        }