Compare commits

...
4 Commits
Author SHA1 Message Date
drmext 7d5f528e1a overlay: tooltip static position and fix overlap (#883)
Tooltips no longer follow the mouse after initially activating, and
don't cover the main option when hovering above.
2026-08-21 15:01:46 -07:00
bicarus 2dc3c0cbe4 patcher: make the checkbox label toggleable (#882)
Requested by a certain sea creature. Don't know why ImGui doesn't do
this by default.

Also, use ImGui internal mixed state (tri-state) checkbox instead
rendering our own.
2026-08-20 23:48:11 -07:00
bicarus 4c2a70bab6 build: improve dockerfile (#881)
## Link to GitHub Issue or related Pull Request, if one exists
#0

## Description of change

`mingw-w64-libjpeg-turbo` and `mingw-w64-x264` are AUR packages, so the
deps image compiles them from source, once per mingw target arch. Stock
`makepkg.conf` leaves `MAKEFLAGS` commented out and both PKGBUILDs call
bare `make`, so all of that was building single-threaded.

Adds a `~/.makepkg.conf` for the build user setting
`MAKEFLAGS="-j$(nproc)"`. It is kept literal so it evaluates when
makepkg sources the file, rather than baking in the core count of
whichever machine built the image. Using `~/.makepkg.conf` rather than
`/etc` leaves the pacman-owned system file untouched.

Measured on 20 cores, compiling both libraries from scratch: **310s to
64s, a 4.8x improvement.**

Also merges the two `yay` invocations into a single layer.

## Testing
2026-08-20 23:25:00 -07:00
bicarus 46f76597fc cfg: active only filter for options search (#879)
Requested by a sea creature
2026-08-20 22:38:30 -07:00
5 changed files with 93 additions and 50 deletions

No files matched your search

+7 -6
View File
@@ -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" \
| tar -xJ -C /usr/local/bin
# libjpeg-turbo for JPEG encoding. Only the mingw-w64 toolchains get it;
# the WinXP targets build without JPEG support entirely.
RUN su user -c "yay --noconfirm -S mingw-w64-libjpeg-turbo"
# Stock makepkg.conf builds serially; this makes the AUR compiles below parallel.
RUN printf '%s\n' 'MAKEFLAGS="-j$(nproc)"' > /home/user/.makepkg.conf \
&& chown user: /home/user/.makepkg.conf
# x264 for the API H.264 video stream. Only the mingw-w64 toolchains need it;
# the WinXP targets build without the stream encoder.
RUN su user -c "yay --noconfirm -S mingw-w64-x264"
# libjpeg-turbo for JPEG encoding, x264 for the API H.264 video stream. Only the
# mingw-w64 toolchains get these; the WinXP targets build without JPEG support
# and without the stream encoder.
RUN su user -c "yay --noconfirm -S mingw-w64-libjpeg-turbo mingw-w64-x264"
+25
View File
@@ -21,12 +21,36 @@ namespace ImGui {
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) {
ImGui::PushStyleColor(ImGuiCol_Border, bg);
ImGui::PushStyleColor(ImGuiCol_BorderShadow, bg);
ImGui::PushStyleColor(ImGuiCol_PopupBg, bg);
ImGui::PushStyleColor(ImGuiCol_Text, fg);
SetNextTooltipPos();
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::TextUnformatted(desc);
@@ -49,6 +73,7 @@ namespace ImGui {
ImGui::PushStyleColor(ImGuiCol_PopupBg, bg);
ImGui::PushStyleColor(ImGuiCol_Text, fg);
SetNextTooltipPos();
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
if (desc && desc[0]) {
+18 -5
View File
@@ -450,6 +450,8 @@ namespace overlay::windows {
ImGuiInputTextFlags_EscapeClearsAll)) {
this->search_filter_in_lower_case = strtolower(this->search_filter);
}
// clear search terms
if (!this->search_filter.empty()) {
ImGui::SameLine();
if (ImGui::Button("Clear")) {
@@ -457,15 +459,22 @@ namespace overlay::windows {
this->search_filter_in_lower_case.clear();
}
}
// active only checkbox
ImGui::SameLine();
ImGui::Checkbox("Active Only", &this->search_active_only);
ImGui::Spacing();
// 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)) {
this->build_options(
options,
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) {
@@ -5041,7 +5050,8 @@ namespace overlay::windows {
}
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
// 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) {
continue;
}
if (filter != nullptr) {
if (filter->empty() || !option.search_match(*filter)) {
if (active_only && !option.is_active()) {
continue;
}
if (filter != nullptr && !filter->empty()) {
if (!option.search_match(*filter)) {
continue;
}
// limit to 30 results
+2 -1
View File
@@ -141,6 +141,7 @@ namespace overlay::windows {
int options_category = 0;
std::string search_filter = "";
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
std::string options_group_selected = "";
@@ -216,7 +217,7 @@ namespace overlay::windows {
void build_option_value_picker(Option& option);
void build_options(
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_controller_tab(float page_offset, ControllerPage *page_selected_new);
bool build_nav_header(const char *label, bool active);
+41 -38
View File
@@ -7,6 +7,7 @@
#include <unordered_set>
#include "avs/game.h"
#include "cfg/configurator.h"
#include "external/imgui/imgui_internal.h"
#include "games/io.h"
#include "launcher/launcher.h"
#include "misc/clipboard.h"
@@ -215,19 +216,14 @@ namespace overlay::windows {
return name;
}
// draw a square checkmark for mixed-state groups (neither checked or unchecked)
void render_patch_group_mixed_checkbox_mark() {
const auto check_min = ImGui::GetItemRectMin();
const float check_size = ImGui::GetFrameHeight();
const float calculated_padding = check_size / 3.6f;
const float padding = calculated_padding < 1.0f ? 1.0f : calculated_padding;
ImGui::GetWindowDrawList()->AddRectFilled(
ImVec2(check_min.x + padding, check_min.y + padding),
ImVec2(
check_min.x + check_size - padding,
check_min.y + check_size - padding),
ImGui::GetColorU32(ImGuiCol_CheckMark),
ImGui::GetStyle().FrameRounding);
// the state text next to a toggle is the checkbox label, so it has to dim itself instead
// of being wrapped in BeginDisabled (which would also kill the click area)
void push_toggle_label_color(bool checked) {
auto color = ImGui::GetStyleColorVec4(ImGuiCol_Text);
if (!checked) {
color.w *= ImGui::GetStyle().DisabledAlpha;
}
ImGui::PushStyleColor(ImGuiCol_Text, color);
}
// render a tri-state checkbox for groups
@@ -237,18 +233,24 @@ namespace overlay::windows {
const std::vector<size_t>& members,
bool& checked) {
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) {
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) {
ImGui::PopStyleColor();
ImGui::PopItemFlag();
}
ImGui::EndDisabled();
if (mixed && !changed) {
render_patch_group_mixed_checkbox_mark();
}
if (!changed) {
return false;
}
@@ -266,11 +268,11 @@ namespace overlay::windows {
return true;
}
// render aggregate status or error text beside the group checkbox
void render_patch_group_status(const PatchGroupState& state, bool checked) {
ImGui::SameLine();
ImGui::AlignTextToFramePadding();
// render error text beside the group checkbox; other states are shown as its label
void render_patch_group_status(const PatchGroupState& state) {
if (state.status == PatchGroupStatus::Error) {
ImGui::SameLine();
ImGui::AlignTextToFramePadding();
const auto& error_patch = patcher::patches[state.first_error_index];
const auto error_reason = error_patch.error_reason.empty()
? "Unknown error"
@@ -279,12 +281,6 @@ namespace overlay::windows {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 0.f, 0.f, 1.f));
ImGui::TextUnformatted(error_text.c_str());
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)) {
show_patch_group_tooltip(group);
}
render_patch_group_status(group_state, group_checked);
render_patch_group_status(group_state);
ImGui::TableSetColumnIndex(0);
const auto group_name = get_patch_group_display_name(
@@ -874,8 +870,18 @@ namespace overlay::windows {
render_patch_group_child_gutter(last_group_child);
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);
if (ImGui::Checkbox("##patch_checked_checkbox", &patch_checked)) {
if (ImGui::Checkbox(checkbox_label, &patch_checked)) {
patcher::config_dirty = true;
switch (patch_status) {
case patcher::PatchStatus::Enabled:
@@ -901,13 +907,14 @@ namespace overlay::windows {
patch.last_status = patcher::is_patch_active(patch);
}
ImGui::EndDisabled();
ImGui::PopStyleColor();
if (ImGui::IsItemHovered(ImGui::TOOLTIP_FLAGS)) {
show_patch_tooltip(patch);
}
// second column, part 2: additional options UI (dropdown, text input)
ImGui::SameLine();
if (patch_status == patcher::PatchStatus::Error){
ImGui::SameLine();
ImGui::AlignTextToFramePadding();
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 0.f, 0.f, 1.f));
if (patch.error_reason.empty()) {
@@ -917,6 +924,7 @@ namespace overlay::windows {
}
ImGui::PopStyleColor();
} else if (patch.type == patcher::PatchType::Union || patch.type == patcher::PatchType::Integer) {
ImGui::SameLine();
if (patch_status == patcher::PatchStatus::Enabled) {
if (patch.type == patcher::PatchType::Union) {
set_patch_option_width();
@@ -970,11 +978,6 @@ namespace overlay::windows {
show_patch_tooltip(patch);
}
}
} else {
ImGui::AlignTextToFramePadding();
ImGui::BeginDisabled(!patch_checked);
ImGui::TextUnformatted(patch_checked ? "ON" : "off");
ImGui::EndDisabled();
}
ImGui::HighlightTableRowOnHover();