Compare commits

..
2 Commits
Author SHA1 Message Date
bicarus ae7d169b3f cfg: trim surrounding whitespace in options tab (#935)
## Link to GitHub Issue or related Pull Request, if one exists
n/a

## Description of change
Remove leading and trailing whitespace for some commonly used options
(EA server URL, pcbid, etc) to prevent users copy-pasting wrong text.

## Testing
cfg only
2026-11-26 02:17:52 -08:00
bicarus-dev ce87d20f25 sdvx: cache result from K32GetPerformanceInfo to avoid performance issues on some PCs 2026-11-19 23:35:28 -08:00
5 changed files with 26 additions and 9 deletions

No files matched your search

+1 -4
View File
@@ -1,7 +1,4 @@
on:
push:
pull_request:
workflow_dispatch:
on: [push, pull_request]
name: Continuous Integration
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
+2
View File
@@ -48,6 +48,8 @@ struct OptionDefinition {
std::string file_extension = "";
std::string quick_setting_category = "";
bool trim_whitespace = false;
};
class Option {
+9 -2
View File
@@ -9,6 +9,7 @@
#include "hooks/devicehook.h"
#include "hooks/libraryhook.h"
#ifdef SPICE64
#include <mutex>
#include <psapi.h>
#include "hooks/graphics/nvapi_impl.h"
#endif
@@ -216,10 +217,16 @@ namespace games::sdvx {
}
// store a cached copy of the first successful call to K32GetPerformanceInfo
static std::mutex cache_mutex;
static PERFORMANCE_INFORMATION cached {};
static const BOOL cached_valid = K32GetPerformanceInfo_orig(&cached, sizeof(cached));
static bool cached_valid = false;
std::lock_guard<std::mutex> lock(cache_mutex);
if (!cached_valid) {
return K32GetPerformanceInfo_orig(info, cb);
if (!K32GetPerformanceInfo_orig(info, cb)) {
return FALSE;
}
cached = *info;
cached_valid = true;
}
// return the cached copy to avoid performance issues with the game calling this every frame
+4
View File
@@ -138,6 +138,7 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = std::invoke([]()
.setting_name = "example.com:8083",
.category = "Network",
.quick_setting_category = "Network",
.trim_whitespace = true,
};
c[launcher::Options::PCBID] = {
.title = "PCBID",
@@ -148,6 +149,7 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = std::invoke([]()
.category = "Network",
.sensitive = true,
.quick_setting_category = "Network",
.trim_whitespace = true,
};
c[launcher::Options::Player1Card] = {
.title = "Player 1 Card",
@@ -159,6 +161,7 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = std::invoke([]()
.sensitive = true,
.picker = OptionPickerType::EACard,
.quick_setting_category = "Network",
.trim_whitespace = true,
};
c[launcher::Options::Player2Card] = {
.title = "Player 2 Card",
@@ -170,6 +173,7 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = std::invoke([]()
.sensitive = true,
.picker = OptionPickerType::EACard,
.quick_setting_category = "Network",
.trim_whitespace = true,
};
c[launcher::Options::Player1PinMacro] = {
.title = "Player 1 PIN Macro",
+10 -3
View File
@@ -5282,9 +5282,16 @@ namespace overlay::windows {
ImGui::InputTextWithHint("", hint, buffer, sizeof(buffer) - 1);
// would like to use IsItemDeactivatedAfterEdit but can't handle the case when window is closed while editing
if (ImGui::IsItemEdited()) {
this->options_dirty = true;
option.value = buffer;
::Config::getInstance().updateBinding(games_list[games_selected], option);
// trim whitespace to prevent copy/paste errors
auto value = definition.trim_whitespace ?
strtrim(buffer) : std::string(buffer);
if (option.value != value) {
this->options_dirty = true;
option.value = std::move(value);
::Config::getInstance().updateBinding(games_list[games_selected], option);
}
}
if (ImGui::IsItemHovered(ImGui::TOOLTIP_FLAGS)) {
ImGui::HelpTooltip(definition.desc.c_str());