mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-12-03 03:16:41 -08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae7d169b3f | ||
|
|
ce87d20f25 |
No files matched your search
@@ -1,7 +1,4 @@
|
|||||||
on:
|
on: [push, pull_request]
|
||||||
push:
|
|
||||||
pull_request:
|
|
||||||
workflow_dispatch:
|
|
||||||
name: Continuous Integration
|
name: Continuous Integration
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ struct OptionDefinition {
|
|||||||
std::string file_extension = "";
|
std::string file_extension = "";
|
||||||
|
|
||||||
std::string quick_setting_category = "";
|
std::string quick_setting_category = "";
|
||||||
|
|
||||||
|
bool trim_whitespace = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Option {
|
class Option {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "hooks/devicehook.h"
|
#include "hooks/devicehook.h"
|
||||||
#include "hooks/libraryhook.h"
|
#include "hooks/libraryhook.h"
|
||||||
#ifdef SPICE64
|
#ifdef SPICE64
|
||||||
|
#include <mutex>
|
||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
#include "hooks/graphics/nvapi_impl.h"
|
#include "hooks/graphics/nvapi_impl.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -216,10 +217,16 @@ namespace games::sdvx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// store a cached copy of the first successful call to K32GetPerformanceInfo
|
// store a cached copy of the first successful call to K32GetPerformanceInfo
|
||||||
|
static std::mutex cache_mutex;
|
||||||
static PERFORMANCE_INFORMATION cached {};
|
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) {
|
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
|
// return the cached copy to avoid performance issues with the game calling this every frame
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = std::invoke([]()
|
|||||||
.setting_name = "example.com:8083",
|
.setting_name = "example.com:8083",
|
||||||
.category = "Network",
|
.category = "Network",
|
||||||
.quick_setting_category = "Network",
|
.quick_setting_category = "Network",
|
||||||
|
.trim_whitespace = true,
|
||||||
};
|
};
|
||||||
c[launcher::Options::PCBID] = {
|
c[launcher::Options::PCBID] = {
|
||||||
.title = "PCBID",
|
.title = "PCBID",
|
||||||
@@ -148,6 +149,7 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = std::invoke([]()
|
|||||||
.category = "Network",
|
.category = "Network",
|
||||||
.sensitive = true,
|
.sensitive = true,
|
||||||
.quick_setting_category = "Network",
|
.quick_setting_category = "Network",
|
||||||
|
.trim_whitespace = true,
|
||||||
};
|
};
|
||||||
c[launcher::Options::Player1Card] = {
|
c[launcher::Options::Player1Card] = {
|
||||||
.title = "Player 1 Card",
|
.title = "Player 1 Card",
|
||||||
@@ -159,6 +161,7 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = std::invoke([]()
|
|||||||
.sensitive = true,
|
.sensitive = true,
|
||||||
.picker = OptionPickerType::EACard,
|
.picker = OptionPickerType::EACard,
|
||||||
.quick_setting_category = "Network",
|
.quick_setting_category = "Network",
|
||||||
|
.trim_whitespace = true,
|
||||||
};
|
};
|
||||||
c[launcher::Options::Player2Card] = {
|
c[launcher::Options::Player2Card] = {
|
||||||
.title = "Player 2 Card",
|
.title = "Player 2 Card",
|
||||||
@@ -170,6 +173,7 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = std::invoke([]()
|
|||||||
.sensitive = true,
|
.sensitive = true,
|
||||||
.picker = OptionPickerType::EACard,
|
.picker = OptionPickerType::EACard,
|
||||||
.quick_setting_category = "Network",
|
.quick_setting_category = "Network",
|
||||||
|
.trim_whitespace = true,
|
||||||
};
|
};
|
||||||
c[launcher::Options::Player1PinMacro] = {
|
c[launcher::Options::Player1PinMacro] = {
|
||||||
.title = "Player 1 PIN Macro",
|
.title = "Player 1 PIN Macro",
|
||||||
|
|||||||
@@ -5282,9 +5282,16 @@ namespace overlay::windows {
|
|||||||
ImGui::InputTextWithHint("", hint, buffer, sizeof(buffer) - 1);
|
ImGui::InputTextWithHint("", hint, buffer, sizeof(buffer) - 1);
|
||||||
// would like to use IsItemDeactivatedAfterEdit but can't handle the case when window is closed while editing
|
// would like to use IsItemDeactivatedAfterEdit but can't handle the case when window is closed while editing
|
||||||
if (ImGui::IsItemEdited()) {
|
if (ImGui::IsItemEdited()) {
|
||||||
this->options_dirty = true;
|
// trim whitespace to prevent copy/paste errors
|
||||||
option.value = buffer;
|
auto value = definition.trim_whitespace ?
|
||||||
::Config::getInstance().updateBinding(games_list[games_selected], option);
|
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)) {
|
if (ImGui::IsItemHovered(ImGui::TOOLTIP_FLAGS)) {
|
||||||
ImGui::HelpTooltip(definition.desc.c_str());
|
ImGui::HelpTooltip(definition.desc.c_str());
|
||||||
|
|||||||
Reference in new issue
Block a user