@@ -54,7 +54,7 @@ namespace ImGui
54
54
using namespace std ::chrono_literals;
55
55
using namespace vr ;
56
56
57
- static constexpr const char *version = " v1.1 .0" ;
57
+ static constexpr const char *version = " v1.2 .0" ;
58
58
59
59
static constexpr const char *iconPath = " icon.png" ;
60
60
@@ -78,12 +78,15 @@ int minimizeOnStart = 0;
78
78
// General
79
79
int resChangeDelayMs = 3000 ;
80
80
int dataAverageSamples = 128 ;
81
- std::string disabledApps = " steam.app.620980 steam.app.658920 steam.app.2177750 steam.app.2177760" ; // Beat Saber and HL2VR
82
- std::set<std::string> disabledAppsSet = {" steam.app.620980" , " steam.app.658920" , " steam.app.2177750" , " steam.app.2177760" };
81
+ std::string blacklistApps = " steam.app.620980 steam.app.658920 steam.app.2177750 steam.app.2177760" ; // Beat Saber and HL2VR
82
+ std::set<std::string> blacklistAppsSet = {" steam.app.620980" , " steam.app.658920" , " steam.app.2177750" , " steam.app.2177760" };
83
+ bool whitelistEnabled = false ;
84
+ std::string whitelistApps = " " ;
85
+ std::set<std::string> whitelistAppsSet = {};
83
86
// Resolution
84
87
int initialRes = 100 ;
85
88
int minRes = 70 ;
86
- int maxRes = 250 ;
89
+ int maxRes = 200 ;
87
90
int resIncreaseThreshold = 80 ;
88
91
int resDecreaseThreshold = 88 ;
89
92
int resIncreaseMin = 3 ;
@@ -147,14 +150,22 @@ bool loadSettings()
147
150
// Startup
148
151
autoStart = std::stoi (ini.GetValue (" Startup" , " autoStart" , std::to_string (autoStart).c_str ()));
149
152
minimizeOnStart = std::stoi (ini.GetValue (" Startup" , " minimizeOnStart" , std::to_string (minimizeOnStart).c_str ()));
153
+
150
154
// General
151
155
resChangeDelayMs = std::stoi (ini.GetValue (" General" , " resChangeDelayMs" , std::to_string (resChangeDelayMs).c_str ()));
152
156
dataAverageSamples = std::stoi (ini.GetValue (" General" , " dataAverageSamples" , std::to_string (dataAverageSamples).c_str ()));
153
157
if (dataAverageSamples > 128 )
154
158
dataAverageSamples = 128 ; // Max stored by OpenVR
155
- disabledApps = ini.GetValue (" General" , " disabledApps" , disabledApps.c_str ());
156
- std::replace (disabledApps.begin (), disabledApps.end (), ' ' , ' \n ' );
157
- disabledAppsSet = multilineStringToSet (disabledApps);
159
+ // blacklist
160
+ blacklistApps = ini.GetValue (" General" , " disabledApps" , blacklistApps.c_str ());
161
+ std::replace (blacklistApps.begin (), blacklistApps.end (), ' ' , ' \n ' );
162
+ blacklistAppsSet = multilineStringToSet (blacklistApps);
163
+ // whitelist
164
+ whitelistEnabled = std::stoi (ini.GetValue (" General" , " whitelistEnabled" , std::to_string (whitelistEnabled).c_str ()));
165
+ whitelistApps = ini.GetValue (" General" , " whitelistApps" , blacklistApps.c_str ());
166
+ std::replace (whitelistApps.begin (), whitelistApps.end (), ' ' , ' \n ' );
167
+ whitelistAppsSet = multilineStringToSet (whitelistApps);
168
+
158
169
// Resolution
159
170
initialRes = std::stoi (ini.GetValue (" Resolution" , " initialRes" , std::to_string (initialRes).c_str ()));
160
171
minRes = std::stoi (ini.GetValue (" Resolution" , " minRes" , std::to_string (minRes).c_str ()));
@@ -167,15 +178,18 @@ bool loadSettings()
167
178
resDecreaseScale = std::stoi (ini.GetValue (" Resolution" , " resDecreaseScale" , std::to_string (resDecreaseScale).c_str ()));
168
179
minCpuTimeThreshold = std::stof (ini.GetValue (" Resolution" , " minCpuTimeThreshold" , std::to_string (minCpuTimeThreshold).c_str ()));
169
180
resetOnThreshold = std::stoi (ini.GetValue (" Resolution" , " resetOnThreshold" , std::to_string (resetOnThreshold).c_str ()));
181
+
170
182
// Reprojection
171
183
alwaysReproject = std::stoi (ini.GetValue (" Reprojection" , " alwaysReproject" , std::to_string (alwaysReproject).c_str ()));
172
184
preferReprojection = std::stoi (ini.GetValue (" Reprojection" , " preferReprojection" , std::to_string (preferReprojection).c_str ()));
173
185
ignoreCpuTime = std::stoi (ini.GetValue (" Reprojection" , " ignoreCpuTime" , std::to_string (ignoreCpuTime).c_str ()));
186
+
174
187
// VRAM
175
188
vramMonitorEnabled = std::stoi (ini.GetValue (" VRAM" , " vramMonitorEnabled" , std::to_string (vramMonitorEnabled).c_str ()));
176
189
vramOnlyMode = std::stoi (ini.GetValue (" VRAM" , " vramOnlyMode" , std::to_string (vramOnlyMode).c_str ()));
177
190
vramTarget = std::stoi (ini.GetValue (" VRAM" , " vramTarget" , std::to_string (vramTarget).c_str ()));
178
191
vramLimit = std::stoi (ini.GetValue (" VRAM" , " vramLimit" , std::to_string (vramLimit).c_str ()));
192
+
179
193
return true ;
180
194
}
181
195
catch (...)
@@ -192,10 +206,14 @@ void saveSettings()
192
206
// Startup
193
207
ini.SetValue (" Startup" , " autoStart" , std::to_string (autoStart).c_str ());
194
208
ini.SetValue (" Startup" , " minimizeOnStart" , std::to_string (minimizeOnStart).c_str ());
209
+
195
210
// General
196
211
ini.SetValue (" General" , " resChangeDelayMs" , std::to_string (resChangeDelayMs).c_str ());
197
212
ini.SetValue (" General" , " dataAverageSamples" , std::to_string (dataAverageSamples).c_str ());
198
- ini.SetValue (" General" , " disabledApps" , setToConfigString (disabledAppsSet).c_str ());
213
+ ini.SetValue (" General" , " disabledApps" , setToConfigString (blacklistAppsSet).c_str ());
214
+ ini.SetValue (" General" , " whitelistEnabled" , std::to_string (whitelistEnabled).c_str ());
215
+ ini.SetValue (" General" , " whitelistApps" , setToConfigString (whitelistAppsSet).c_str ());
216
+
199
217
// Resolution
200
218
ini.SetValue (" Resolution" , " initialRes" , std::to_string (initialRes).c_str ());
201
219
ini.SetValue (" Resolution" , " minRes" , std::to_string (minRes).c_str ());
@@ -208,10 +226,12 @@ void saveSettings()
208
226
ini.SetValue (" Resolution" , " resDecreaseScale" , std::to_string (resDecreaseScale).c_str ());
209
227
ini.SetValue (" Resolution" , " minCpuTimeThreshold" , std::to_string (minCpuTimeThreshold).c_str ());
210
228
ini.SetValue (" Resolution" , " resetOnThreshold" , std::to_string (resetOnThreshold).c_str ());
229
+
211
230
// Reprojection
212
231
ini.SetValue (" Reprojection" , " alwaysReproject" , std::to_string (alwaysReproject).c_str ());
213
232
ini.SetValue (" Reprojection" , " preferReprojection" , std::to_string (preferReprojection).c_str ());
214
233
ini.SetValue (" Reprojection" , " ignoreCpuTime" , std::to_string (ignoreCpuTime).c_str ());
234
+
215
235
// VRAM
216
236
ini.SetValue (" VRAM" , " vramMonitorEnabled" , std::to_string (vramMonitorEnabled).c_str ());
217
237
ini.SetValue (" VRAM" , " vramOnlyMode" , std::to_string (vramOnlyMode).c_str ());
@@ -302,19 +322,24 @@ std::string getCurrentApplicationKey()
302
322
return {applicationKey};
303
323
}
304
324
305
- bool isApplicationDisabled (std::string appKey)
325
+ bool isApplicationBlacklisted (std::string appKey)
306
326
{
307
- return disabledAppsSet.find (appKey) != disabledAppsSet.end () || appKey == " " ;
327
+ return appKey == " " || blacklistAppsSet.find (appKey) != blacklistAppsSet.end ();
328
+ }
329
+
330
+ bool isApplicationWhitelisted (std::string appKey)
331
+ {
332
+ return appKey != " " && whitelistAppsSet.find (appKey) != whitelistAppsSet.end ();
308
333
}
309
334
310
335
bool shouldAdjustResolution (std::string appKey, bool manualRes, float cpuTime)
311
336
{
312
337
// Check if the SteamVR dashboard is open
313
338
bool inDashboard = vr::VROverlay ()->IsDashboardVisible ();
314
339
// Check that we're in a supported application
315
- bool isCurrentAppDisabled = isApplicationDisabled (appKey);
340
+ bool isCurrentAppSupported = ! isApplicationBlacklisted (appKey) && (!whitelistEnabled || isApplicationWhitelisted (appKey) );
316
341
// Only adjust resolution if not in dashboard, in a supported application. user didn't pause res and cpu time isn't below threshold
317
- return !inDashboard && !isCurrentAppDisabled && !manualRes && !(resetOnThreshold && cpuTime < minCpuTimeThreshold);
342
+ return !inDashboard && isCurrentAppSupported && !manualRes && !(resetOnThreshold && cpuTime < minCpuTimeThreshold);
318
343
}
319
344
320
345
void printLine (std::string text, long duration)
@@ -472,8 +497,10 @@ int main(int argc, char *argv[])
472
497
#pragma endregion
473
498
474
499
// Load settings from ini file
475
- if (!loadSettings ())
500
+ if (!loadSettings ()) {
501
+ std::replace (blacklistApps.begin (), blacklistApps.end (), ' ' , ' \n ' ); // Set blacklist newlines
476
502
saveSettings (); // Restore settings
503
+ }
477
504
478
505
// Set auto-start
479
506
int autoStartResult = handle_setup (autoStart);
@@ -927,19 +954,39 @@ int main(int argc, char *argv[])
927
954
}
928
955
addTooltip (" Number of frames' frametimes to average out." );
929
956
930
- if (ImGui::InputTextMultiline (" Disabled applications" , &disabledApps, ImVec2 (130 , 60 )))
931
- disabledAppsSet = multilineStringToSet (disabledApps);
932
- addTooltip (" List of OpenVR application keys that should be ignored for resolution adjustment in the format \' steam.app.APPID\' (e.g. steam.app.620980 for Beat Saber). One per line." );
933
- if (ImGui::Button (" Disable current application" , ImVec2 (200 , 26 )))
957
+ ImGui::Text (" Blacklist" );
958
+ addTooltip (" Don't allow resolution changes in blacklisted applications." );
959
+ if (ImGui::InputTextMultiline (" Blacklisted apps" , &blacklistApps, ImVec2 (130 , 60 ), ImGuiInputTextFlags_CharsNoBlank))
960
+ blacklistAppsSet = multilineStringToSet (blacklistApps);
961
+ addTooltip (" List of OpenVR application keys that should be blacklisted for resolution adjustment in the format \' steam.app.APPID\' (e.g. \' steam.app.620980\' for Beat Saber). One per line." );
962
+ if (ImGui::Button (" Blacklist current app" , ImVec2 (160 , 26 )))
963
+ {
964
+ std::string appKey = getCurrentApplicationKey ();
965
+ if (!isApplicationBlacklisted (appKey))
966
+ {
967
+ blacklistAppsSet.insert (appKey);
968
+ if (blacklistApps != " " ) blacklistApps += " \n " ;
969
+ blacklistApps += appKey;
970
+ }
971
+ }
972
+ addTooltip (" Adds the current application to the blacklist." );
973
+
974
+ ImGui::Checkbox (" Enable whitelist" , &whitelistEnabled);
975
+ addTooltip (" Only allow resolution changes in whitelisted applications." );
976
+ if (ImGui::InputTextMultiline (" Whitelisted apps" , &whitelistApps, ImVec2 (130 , 60 ), ImGuiInputTextFlags_CharsNoBlank))
977
+ whitelistAppsSet = multilineStringToSet (whitelistApps);
978
+ addTooltip (" List of OpenVR application keys that should be whitelisted for resolution adjustment in the format \' steam.app.APPID\' (e.g. \' steam.app.620980\' for Beat Saber). One per line." );
979
+ if (ImGui::Button (" Whitelist current app" , ImVec2 (164 , 26 )))
934
980
{
935
981
std::string appKey = getCurrentApplicationKey ();
936
- if (!isApplicationDisabled (appKey))
982
+ if (!isApplicationWhitelisted (appKey))
937
983
{
938
- disabledAppsSet.insert (appKey);
939
- disabledApps += " \n " + appKey;
984
+ whitelistAppsSet.insert (appKey);
985
+ if (whitelistApps != " " ) whitelistApps += " \n " ;
986
+ whitelistApps += appKey;
940
987
}
941
988
}
942
- addTooltip (" Adds the current application to the list of disable applications ." );
989
+ addTooltip (" Adds the current application to the whitelist ." );
943
990
}
944
991
945
992
if (ImGui::CollapsingHeader (" Resolution" ))
0 commit comments