mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-12-04 19:16:41 -08:00
Compare commits
4
Commits
26-08-20
...
7d5f528e1a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d5f528e1a | ||
|
|
2dc3c0cbe4 | ||
|
|
4c2a70bab6 | ||
|
|
46f76597fc |
No files matched your search
+7
-6
@@ -25,10 +25,11 @@ ENV PATH="$PATH:/opt/llvm-mingw-xp/bin"
|
|||||||
RUN curl -fsSL "https://github.com/mon/windows-dll-compat-checker/releases/download/v1.3/windows_dll_compat_checker-linux-x86_64.tar.xz" \
|
RUN curl -fsSL "https://github.com/mon/windows-dll-compat-checker/releases/download/v1.3/windows_dll_compat_checker-linux-x86_64.tar.xz" \
|
||||||
| tar -xJ -C /usr/local/bin
|
| tar -xJ -C /usr/local/bin
|
||||||
|
|
||||||
# libjpeg-turbo for JPEG encoding. Only the mingw-w64 toolchains get it;
|
# Stock makepkg.conf builds serially; this makes the AUR compiles below parallel.
|
||||||
# the WinXP targets build without JPEG support entirely.
|
RUN printf '%s\n' 'MAKEFLAGS="-j$(nproc)"' > /home/user/.makepkg.conf \
|
||||||
RUN su user -c "yay --noconfirm -S mingw-w64-libjpeg-turbo"
|
&& chown user: /home/user/.makepkg.conf
|
||||||
|
|
||||||
# x264 for the API H.264 video stream. Only the mingw-w64 toolchains need it;
|
# libjpeg-turbo for JPEG encoding, x264 for the API H.264 video stream. Only the
|
||||||
# the WinXP targets build without the stream encoder.
|
# mingw-w64 toolchains get these; the WinXP targets build without JPEG support
|
||||||
RUN su user -c "yay --noconfirm -S mingw-w64-x264"
|
# and without the stream encoder.
|
||||||
|
RUN su user -c "yay --noconfirm -S mingw-w64-libjpeg-turbo mingw-w64-x264"
|
||||||
@@ -21,12 +21,36 @@ namespace ImGui {
|
|||||||
base.y + overlay::apply_scaling(1.0f));
|
base.y + overlay::apply_scaling(1.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tooltips follow the mouse and only avoid a small box around the cursor, so
|
||||||
|
// they can cover the option they describe. Anchor to the hovered item and let
|
||||||
|
// ImGui's popup placer pick a side that clears it and stays on-screen. The
|
||||||
|
// size is taken from the tooltip window, so it covers any content.
|
||||||
|
static void SetNextTooltipPos() {
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
char name[32];
|
||||||
|
ImFormatString(name, IM_COUNTOF(name), "##Tooltip_%02d", g.TooltipOverrideCount);
|
||||||
|
ImGuiWindow *tooltip = ImGui::FindWindowByName(name);
|
||||||
|
if (tooltip == nullptr || !tooltip->WasActive) {
|
||||||
|
// Reopened tooltips are hidden for one frame while measuring size.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const ImRect item(ImGui::GetItemRectMin(), ImGui::GetItemRectMax());
|
||||||
|
ImGui::SetNextWindowPos(ImGui::FindBestWindowPosForPopupEx(
|
||||||
|
item.Min,
|
||||||
|
ImGui::CalcWindowNextAutoFitSize(tooltip),
|
||||||
|
&tooltip->AutoPosLastDirection,
|
||||||
|
ImGui::GetPopupAllowedExtentRect(tooltip),
|
||||||
|
item,
|
||||||
|
ImGuiPopupPositionPolicy_Tooltip));
|
||||||
|
}
|
||||||
|
|
||||||
void HelpTooltip(const char* desc) {
|
void HelpTooltip(const char* desc) {
|
||||||
ImGui::PushStyleColor(ImGuiCol_Border, bg);
|
ImGui::PushStyleColor(ImGuiCol_Border, bg);
|
||||||
ImGui::PushStyleColor(ImGuiCol_BorderShadow, bg);
|
ImGui::PushStyleColor(ImGuiCol_BorderShadow, bg);
|
||||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, bg);
|
ImGui::PushStyleColor(ImGuiCol_PopupBg, bg);
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, fg);
|
ImGui::PushStyleColor(ImGuiCol_Text, fg);
|
||||||
|
|
||||||
|
SetNextTooltipPos();
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
||||||
ImGui::TextUnformatted(desc);
|
ImGui::TextUnformatted(desc);
|
||||||
@@ -49,6 +73,7 @@ namespace ImGui {
|
|||||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, bg);
|
ImGui::PushStyleColor(ImGuiCol_PopupBg, bg);
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, fg);
|
ImGui::PushStyleColor(ImGuiCol_Text, fg);
|
||||||
|
|
||||||
|
SetNextTooltipPos();
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
||||||
if (desc && desc[0]) {
|
if (desc && desc[0]) {
|
||||||
|
|||||||
@@ -450,6 +450,8 @@ namespace overlay::windows {
|
|||||||
ImGuiInputTextFlags_EscapeClearsAll)) {
|
ImGuiInputTextFlags_EscapeClearsAll)) {
|
||||||
this->search_filter_in_lower_case = strtolower(this->search_filter);
|
this->search_filter_in_lower_case = strtolower(this->search_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clear search terms
|
||||||
if (!this->search_filter.empty()) {
|
if (!this->search_filter.empty()) {
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Clear")) {
|
if (ImGui::Button("Clear")) {
|
||||||
@@ -457,15 +459,22 @@ namespace overlay::windows {
|
|||||||
this->search_filter_in_lower_case.clear();
|
this->search_filter_in_lower_case.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// active only checkbox
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Checkbox("Active Only", &this->search_active_only);
|
||||||
|
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
|
|
||||||
// draw matching options
|
// draw matching options
|
||||||
if (!this->search_filter.empty()) {
|
if (!this->search_filter.empty() || this->search_active_only) {
|
||||||
for (auto category : launcher::get_categories(launcher::Options::OptionsCategory::Everything)) {
|
for (auto category : launcher::get_categories(launcher::Options::OptionsCategory::Everything)) {
|
||||||
this->build_options(
|
this->build_options(
|
||||||
options,
|
options,
|
||||||
category,
|
category,
|
||||||
const_cast<std::string *>(&this->search_filter_in_lower_case));
|
const_cast<std::string *>(&this->search_filter_in_lower_case),
|
||||||
|
false,
|
||||||
|
this->search_active_only);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (this->options_group_selected == OPTIONS_TAB_QUICK) {
|
} else if (this->options_group_selected == OPTIONS_TAB_QUICK) {
|
||||||
@@ -5041,7 +5050,8 @@ namespace overlay::windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Config::build_options(
|
void Config::build_options(
|
||||||
std::vector<Option> *options, const std::string &category, const std::string *filter, bool quick_only) {
|
std::vector<Option> *options, const std::string &category, const std::string *filter,
|
||||||
|
bool quick_only, bool active_only) {
|
||||||
|
|
||||||
// collect the options that match the current filters. doing this once lets us
|
// collect the options that match the current filters. doing this once lets us
|
||||||
// skip rendering an empty header + table for categories with no matches, and
|
// skip rendering an empty header + table for categories with no matches, and
|
||||||
@@ -5066,8 +5076,11 @@ namespace overlay::windows {
|
|||||||
if (!definition.game_name.empty() && definition.game_name != this->games_selected_name) {
|
if (!definition.game_name.empty() && definition.game_name != this->games_selected_name) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (filter != nullptr) {
|
if (active_only && !option.is_active()) {
|
||||||
if (filter->empty() || !option.search_match(*filter)) {
|
continue;
|
||||||
|
}
|
||||||
|
if (filter != nullptr && !filter->empty()) {
|
||||||
|
if (!option.search_match(*filter)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// limit to 30 results
|
// limit to 30 results
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ namespace overlay::windows {
|
|||||||
int options_category = 0;
|
int options_category = 0;
|
||||||
std::string search_filter = "";
|
std::string search_filter = "";
|
||||||
std::string search_filter_in_lower_case = "";
|
std::string search_filter_in_lower_case = "";
|
||||||
|
bool search_active_only = false;
|
||||||
|
|
||||||
// Options tab left-nav: selected group, currently highlighted category, and a pending scroll
|
// Options tab left-nav: selected group, currently highlighted category, and a pending scroll
|
||||||
std::string options_group_selected = "";
|
std::string options_group_selected = "";
|
||||||
@@ -216,7 +217,7 @@ namespace overlay::windows {
|
|||||||
void build_option_value_picker(Option& option);
|
void build_option_value_picker(Option& option);
|
||||||
void build_options(
|
void build_options(
|
||||||
std::vector<Option> *options, const std::string &category, const std::string *filter=nullptr,
|
std::vector<Option> *options, const std::string &category, const std::string *filter=nullptr,
|
||||||
bool quick_only=false);
|
bool quick_only=false, bool active_only=false);
|
||||||
void build_options_tab(float page_offset);
|
void build_options_tab(float page_offset);
|
||||||
void build_controller_tab(float page_offset, ControllerPage *page_selected_new);
|
void build_controller_tab(float page_offset, ControllerPage *page_selected_new);
|
||||||
bool build_nav_header(const char *label, bool active);
|
bool build_nav_header(const char *label, bool active);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include "avs/game.h"
|
#include "avs/game.h"
|
||||||
#include "cfg/configurator.h"
|
#include "cfg/configurator.h"
|
||||||
|
#include "external/imgui/imgui_internal.h"
|
||||||
#include "games/io.h"
|
#include "games/io.h"
|
||||||
#include "launcher/launcher.h"
|
#include "launcher/launcher.h"
|
||||||
#include "misc/clipboard.h"
|
#include "misc/clipboard.h"
|
||||||
@@ -215,19 +216,14 @@ namespace overlay::windows {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw a square checkmark for mixed-state groups (neither checked or unchecked)
|
// the state text next to a toggle is the checkbox label, so it has to dim itself instead
|
||||||
void render_patch_group_mixed_checkbox_mark() {
|
// of being wrapped in BeginDisabled (which would also kill the click area)
|
||||||
const auto check_min = ImGui::GetItemRectMin();
|
void push_toggle_label_color(bool checked) {
|
||||||
const float check_size = ImGui::GetFrameHeight();
|
auto color = ImGui::GetStyleColorVec4(ImGuiCol_Text);
|
||||||
const float calculated_padding = check_size / 3.6f;
|
if (!checked) {
|
||||||
const float padding = calculated_padding < 1.0f ? 1.0f : calculated_padding;
|
color.w *= ImGui::GetStyle().DisabledAlpha;
|
||||||
ImGui::GetWindowDrawList()->AddRectFilled(
|
}
|
||||||
ImVec2(check_min.x + padding, check_min.y + padding),
|
ImGui::PushStyleColor(ImGuiCol_Text, color);
|
||||||
ImVec2(
|
|
||||||
check_min.x + check_size - padding,
|
|
||||||
check_min.y + check_size - padding),
|
|
||||||
ImGui::GetColorU32(ImGuiCol_CheckMark),
|
|
||||||
ImGui::GetStyle().FrameRounding);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// render a tri-state checkbox for groups
|
// render a tri-state checkbox for groups
|
||||||
@@ -237,18 +233,24 @@ namespace overlay::windows {
|
|||||||
const std::vector<size_t>& members,
|
const std::vector<size_t>& members,
|
||||||
bool& checked) {
|
bool& checked) {
|
||||||
const bool mixed = state.status == PatchGroupStatus::Mixed;
|
const bool mixed = state.status == PatchGroupStatus::Mixed;
|
||||||
ImGui::BeginDisabled(state.status == PatchGroupStatus::Error);
|
const bool error = state.status == PatchGroupStatus::Error;
|
||||||
|
ImGui::BeginDisabled(error);
|
||||||
if (mixed) {
|
if (mixed) {
|
||||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(0.f, 0.f, 0.f, 0.f));
|
ImGui::PushItemFlag(ImGuiItemFlags_MixedValue, true);
|
||||||
}
|
}
|
||||||
const bool changed = ImGui::Checkbox("##group_checked_checkbox", &checked);
|
// the state text doubles as the checkbox label so clicking it toggles the group;
|
||||||
|
// errored groups show the failing patch there instead
|
||||||
|
const char *label = "##group_checked_checkbox";
|
||||||
|
if (!error) {
|
||||||
|
label = mixed ? "mixed" : (checked ? "ON" : "off");
|
||||||
|
}
|
||||||
|
push_toggle_label_color(checked);
|
||||||
|
const bool changed = ImGui::Checkbox(label, &checked);
|
||||||
|
ImGui::PopStyleColor();
|
||||||
if (mixed) {
|
if (mixed) {
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopItemFlag();
|
||||||
}
|
}
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
if (mixed && !changed) {
|
|
||||||
render_patch_group_mixed_checkbox_mark();
|
|
||||||
}
|
|
||||||
if (!changed) {
|
if (!changed) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -266,11 +268,11 @@ namespace overlay::windows {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// render aggregate status or error text beside the group checkbox
|
// render error text beside the group checkbox; other states are shown as its label
|
||||||
void render_patch_group_status(const PatchGroupState& state, bool checked) {
|
void render_patch_group_status(const PatchGroupState& state) {
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
if (state.status == PatchGroupStatus::Error) {
|
if (state.status == PatchGroupStatus::Error) {
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
const auto& error_patch = patcher::patches[state.first_error_index];
|
const auto& error_patch = patcher::patches[state.first_error_index];
|
||||||
const auto error_reason = error_patch.error_reason.empty()
|
const auto error_reason = error_patch.error_reason.empty()
|
||||||
? "Unknown error"
|
? "Unknown error"
|
||||||
@@ -279,12 +281,6 @@ namespace overlay::windows {
|
|||||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 0.f, 0.f, 1.f));
|
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 0.f, 0.f, 1.f));
|
||||||
ImGui::TextUnformatted(error_text.c_str());
|
ImGui::TextUnformatted(error_text.c_str());
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
} else if (state.status == PatchGroupStatus::Mixed) {
|
|
||||||
ImGui::TextUnformatted("mixed");
|
|
||||||
} else {
|
|
||||||
ImGui::BeginDisabled(!checked);
|
|
||||||
ImGui::TextUnformatted(checked ? "ON" : "off");
|
|
||||||
ImGui::EndDisabled();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +307,7 @@ namespace overlay::windows {
|
|||||||
if (ImGui::IsItemHovered(ImGui::TOOLTIP_FLAGS)) {
|
if (ImGui::IsItemHovered(ImGui::TOOLTIP_FLAGS)) {
|
||||||
show_patch_group_tooltip(group);
|
show_patch_group_tooltip(group);
|
||||||
}
|
}
|
||||||
render_patch_group_status(group_state, group_checked);
|
render_patch_group_status(group_state);
|
||||||
|
|
||||||
ImGui::TableSetColumnIndex(0);
|
ImGui::TableSetColumnIndex(0);
|
||||||
const auto group_name = get_patch_group_display_name(
|
const auto group_name = get_patch_group_display_name(
|
||||||
@@ -874,8 +870,18 @@ namespace overlay::windows {
|
|||||||
render_patch_group_child_gutter(last_group_child);
|
render_patch_group_child_gutter(last_group_child);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
}
|
}
|
||||||
|
// plain on/off patches have no extra widget, so the state text doubles as the
|
||||||
|
// checkbox label - clicking the text toggles it, like the Options tab
|
||||||
|
const bool has_extra_widget =
|
||||||
|
patch_status == patcher::PatchStatus::Error
|
||||||
|
|| patch.type == patcher::PatchType::Union
|
||||||
|
|| patch.type == patcher::PatchType::Integer;
|
||||||
|
const char *checkbox_label = has_extra_widget
|
||||||
|
? "##patch_checked_checkbox"
|
||||||
|
: (patch_checked ? "ON" : "off");
|
||||||
|
push_toggle_label_color(patch_checked);
|
||||||
ImGui::BeginDisabled(patch_status == patcher::PatchStatus::Error);
|
ImGui::BeginDisabled(patch_status == patcher::PatchStatus::Error);
|
||||||
if (ImGui::Checkbox("##patch_checked_checkbox", &patch_checked)) {
|
if (ImGui::Checkbox(checkbox_label, &patch_checked)) {
|
||||||
patcher::config_dirty = true;
|
patcher::config_dirty = true;
|
||||||
switch (patch_status) {
|
switch (patch_status) {
|
||||||
case patcher::PatchStatus::Enabled:
|
case patcher::PatchStatus::Enabled:
|
||||||
@@ -901,13 +907,14 @@ namespace overlay::windows {
|
|||||||
patch.last_status = patcher::is_patch_active(patch);
|
patch.last_status = patcher::is_patch_active(patch);
|
||||||
}
|
}
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
|
ImGui::PopStyleColor();
|
||||||
if (ImGui::IsItemHovered(ImGui::TOOLTIP_FLAGS)) {
|
if (ImGui::IsItemHovered(ImGui::TOOLTIP_FLAGS)) {
|
||||||
show_patch_tooltip(patch);
|
show_patch_tooltip(patch);
|
||||||
}
|
}
|
||||||
|
|
||||||
// second column, part 2: additional options UI (dropdown, text input)
|
// second column, part 2: additional options UI (dropdown, text input)
|
||||||
ImGui::SameLine();
|
|
||||||
if (patch_status == patcher::PatchStatus::Error){
|
if (patch_status == patcher::PatchStatus::Error){
|
||||||
|
ImGui::SameLine();
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 0.f, 0.f, 1.f));
|
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 0.f, 0.f, 1.f));
|
||||||
if (patch.error_reason.empty()) {
|
if (patch.error_reason.empty()) {
|
||||||
@@ -917,6 +924,7 @@ namespace overlay::windows {
|
|||||||
}
|
}
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
} else if (patch.type == patcher::PatchType::Union || patch.type == patcher::PatchType::Integer) {
|
} else if (patch.type == patcher::PatchType::Union || patch.type == patcher::PatchType::Integer) {
|
||||||
|
ImGui::SameLine();
|
||||||
if (patch_status == patcher::PatchStatus::Enabled) {
|
if (patch_status == patcher::PatchStatus::Enabled) {
|
||||||
if (patch.type == patcher::PatchType::Union) {
|
if (patch.type == patcher::PatchType::Union) {
|
||||||
set_patch_option_width();
|
set_patch_option_width();
|
||||||
@@ -970,11 +978,6 @@ namespace overlay::windows {
|
|||||||
show_patch_tooltip(patch);
|
show_patch_tooltip(patch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::BeginDisabled(!patch_checked);
|
|
||||||
ImGui::TextUnformatted(patch_checked ? "ON" : "off");
|
|
||||||
ImGui::EndDisabled();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::HighlightTableRowOnHover();
|
ImGui::HighlightTableRowOnHover();
|
||||||
|
|||||||
Reference in new issue
Block a user