Update to spice2x-26-02-17 (pre-apply)

> broken commit
This commit is contained in:
[ ]
2026-02-19 15:41:42 +09:00
parent 04fc516d47
commit e923b7918f
211 changed files with 26313 additions and 19055 deletions
+75 -2
View File
@@ -26,7 +26,7 @@ namespace ImGui {
void HelpMarker(const char* desc) {
ImGui::TextDisabled("(?)");
if (ImGui::IsItemHovered()) {
if (ImGui::IsItemHovered(TOOLTIP_FLAGS)) {
HelpTooltip(desc);
}
}
@@ -59,7 +59,7 @@ namespace ImGui {
ImGui::PushStyleColor(ImGuiCol_TextDisabled, ImVec4(1.f, 1.f, 0.f, 1.f));
ImGui::TextDisabled("(!)");
ImGui::PopStyleColor();
if (ImGui::IsItemHovered()) {
if (ImGui::IsItemHovered(TOOLTIP_FLAGS)) {
WarnTooltip(desc, warn);
}
}
@@ -92,4 +92,77 @@ namespace ImGui {
ImGui::GetColorU32(ImGuiCol_PlotHistogram),
thickness);
}
std::string TruncateText(const std::string& p_text, float p_truncated_width, bool &truncated) {
std::string truncated_text = p_text;
const float text_width =
ImGui::CalcTextSize(p_text.c_str(), nullptr, true).x;
if (text_width > p_truncated_width) {
truncated = true;
constexpr const char* ELLIPSIS = " ...";
const float ellipsis_size = ImGui::CalcTextSize(ELLIPSIS).x;
int visible_chars = 0;
for (size_t i = 0; i < p_text.size(); i++) {
const float current_width = ImGui::CalcTextSize(
p_text.substr(0, i).c_str(), nullptr, true)
.x;
if (current_width + ellipsis_size > p_truncated_width) {
break;
}
visible_chars = i;
}
truncated_text = (p_text.substr(0, visible_chars) + ELLIPSIS).c_str();
}
return truncated_text;
}
void TextTruncated(const std::string& p_text, float p_truncated_width) {
if (p_text.empty()) {
ImGui::TextDisabled("-");
return;
}
bool truncated = false;
ImGui::TextUnformatted(TruncateText(p_text, p_truncated_width, truncated).c_str());
if (truncated && ImGui::IsItemHovered(TOOLTIP_FLAGS)) {
ImGui::HelpTooltip(p_text.c_str());
}
}
bool DeleteButton(const std::string& tooltip) {
ImGui::PushID(tooltip.c_str());
ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetColorU32(ImGuiCol_Button, 0.7f));
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(3.f, 2.f));
bool clicked = ImGui::SmallButton("\u00D7"); // multiplication sign (×)
ImGui::PopStyleVar();
ImGui::PopStyleColor();
if (!tooltip.empty() && ImGui::IsItemHovered(TOOLTIP_FLAGS)) {
ImGui::SameLine();
ImGui::HelpTooltip(tooltip.c_str());
}
ImGui::PopID();
return clicked;
}
bool ClearButton(const std::string& tooltip) {
ImGui::PushID(tooltip.c_str());
// same colors as a checkbox
ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetColorU32(ImGuiCol_FrameBg));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::GetColorU32(ImGuiCol_FrameBgHovered));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImGui::GetColorU32(ImGuiCol_FrameBgActive));
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.97f, 0.97f, 0.97f, 1.00f));
bool clicked = ImGui::Button("\u00D7"); // multiplication sign (×)
ImGui::PopStyleColor(4);
if (!tooltip.empty() && ImGui::IsItemHovered(TOOLTIP_FLAGS)) {
ImGui::SameLine();
ImGui::HelpTooltip(tooltip.c_str());
}
ImGui::PopID();
return clicked;
}
}
+11
View File
@@ -1,12 +1,23 @@
#pragma once
#include <string>
#include "external/imgui/imgui.h"
namespace ImGui {
constexpr ImGuiHoveredFlags TOOLTIP_FLAGS =
(ImGuiHoveredFlags_ForTooltip | ImGuiHoveredFlags_AllowWhenDisabled);
void HelpTooltip(const char* desc);
void HelpMarker(const char* desc);
void WarnTooltip(const char* desc, const char* warn);
void WarnMarker(const char* desc, const char* warn);
void DummyMarker();
void Knob(float fraction, float size, float thickness = 2.f,
float pos_x = -1.f, float pos_y = -1.f);
void TextTruncated(const std::string& p_text, float p_truncated_width);
bool DeleteButton(const std::string& tooltip);
bool ClearButton(const std::string& tooltip);
}
+29 -7
View File
@@ -3,6 +3,7 @@
#include "avs/game.h"
#include "cfg/configurator.h"
#include "games/io.h"
#include "games/gitadora/gitadora.h"
#include "games/iidx/iidx.h"
#include "hooks/graphics/graphics.h"
#include "misc/eamuse.h"
@@ -28,6 +29,7 @@
#include "windows/generic_sub.h"
#include "windows/iidx_seg.h"
#include "windows/iidx_sub.h"
#include "windows/gfdm_sub.h"
#include "windows/drs_dancefloor.h"
#include "windows/iopanel.h"
#include "windows/iopanel_ddr.h"
@@ -51,16 +53,26 @@ namespace overlay {
bool AUTO_SHOW_IOPANEL = false;
bool AUTO_SHOW_KEYPAD_P1 = false;
bool AUTO_SHOW_KEYPAD_P2 = false;
bool USE_WM_CHAR_FOR_IMGUI_CHAR_INPUT = false;
bool FPS_SHOULD_FLIP = false;
std::optional<uint32_t> UI_SCALE_PERCENT;
// global
std::mutex OVERLAY_MUTEX;
std::unique_ptr<overlay::SpiceOverlay> OVERLAY = nullptr;
ImFont* DSEG_FONT = nullptr;
bool SHOW_DEBUG_LOG_WINDOW = false;
ImVec2 apply_scaling_to_vector(float x, float y) {
if (!UI_SCALE_PERCENT.has_value()) {
return ImVec2(x, y);
}
return ImVec2(apply_scaling(x), apply_scaling(y));
}
ImVec2 apply_scaling_to_vector(const ImVec2& input) {
return apply_scaling_to_vector(input.x, input.y);
}
}
static void *ImGui_Alloc(size_t sz, void *user_data) {
@@ -170,6 +182,12 @@ void overlay::SpiceOverlay::init() {
style.WindowRounding = 0;
}
if (UI_SCALE_PERCENT.has_value()) {
const auto scale = static_cast<float>(UI_SCALE_PERCENT.value()) / 100.f;
ImGui::GetStyle().ScaleAllSizes(scale);
ImGui::GetIO().FontGlobalScale = scale;
}
// red theme based on:
// https://github.com/ocornut/imgui/issues/707#issuecomment-760220280
// r, g, b, a
@@ -245,7 +263,6 @@ void overlay::SpiceOverlay::init() {
if (!cfg::CONFIGURATOR_STANDALONE) {
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
}
if (is_touch_available("SpiceOverlay::init")) {
io.ConfigFlags |= ImGuiConfigFlags_IsTouchScreen;
@@ -270,13 +287,14 @@ void overlay::SpiceOverlay::init() {
ImFontConfig config {};
config.MergeMode = true;
log_misc("overlay", "loading fonts, failures are not fatal");
add_font("simsun.ttc", &config, io.Fonts->GetGlyphRangesChineseSimplifiedCommon());
add_font("arial.ttc", &config, io.Fonts->GetGlyphRangesCyrillic());
add_font("arial.ttf", &config, io.Fonts->GetGlyphRangesCyrillic());
add_font("meiryu.ttc", &config, io.Fonts->GetGlyphRangesJapanese());
add_font("meiryo.ttc", &config, io.Fonts->GetGlyphRangesJapanese());
add_font("gulim.ttc", &config, io.Fonts->GetGlyphRangesKorean());
add_font("cordia.ttc", &config, io.Fonts->GetGlyphRangesThai());
add_font("arial.ttc", &config, io.Fonts->GetGlyphRangesVietnamese());
add_font("cordia.ttf", &config, io.Fonts->GetGlyphRangesThai());
add_font("arial.ttf", &config, io.Fonts->GetGlyphRangesVietnamese());
// add special font
if (avs::game::is_model("LDJ")) {
@@ -365,7 +383,8 @@ void overlay::SpiceOverlay::init() {
window_iopanel = new overlay::windows::IIDXIOPanel(this);
} else if (avs::game::is_model("MDX")) {
window_iopanel = new overlay::windows::DDRIOPanel(this);
} else if (avs::game::is_model({"J32", "J33", "K32", "K33", "L32", "L33", "M32"})) {
} else if (avs::game::is_model({"J32", "J33", "K32", "K33", "L32", "L33", "M32"}) &&
!games::gitadora::is_arena_model()) {
window_iopanel = new overlay::windows::GitadoraIOPanel(this);
} else {
window_iopanel = new overlay::windows::IOPanel(this);
@@ -392,7 +411,10 @@ void overlay::SpiceOverlay::init() {
window_sub = new overlay::windows::DRSDanceFloorDisplay(this);
} else if (avs::game::is_model("KFC")) {
window_sub = new overlay::windows::SDVXSubScreen(this);
} else if (games::gitadora::is_arena_model() && games::gitadora::ARENA_SINGLE_WINDOW) {
window_sub = new overlay::windows::GitaDoraSubScreen(this);
}
if (window_sub) {
this->window_add(window_sub);
if (AUTO_SHOW_SUBSCREEN) {
+13
View File
@@ -3,6 +3,7 @@
#include <memory>
#include <mutex>
#include <functional>
#include <optional>
#include <vector>
#include <windows.h>
#include <d3d9.h>
@@ -27,6 +28,18 @@ namespace overlay {
extern bool USE_WM_CHAR_FOR_IMGUI_CHAR_INPUT;
extern bool FPS_SHOULD_FLIP;
extern bool SHOW_DEBUG_LOG_WINDOW;
extern std::optional<uint32_t> UI_SCALE_PERCENT;
template <typename T>
float apply_scaling(T input) {
if (!UI_SCALE_PERCENT.has_value()) {
return input;
}
return static_cast<float>(input) * UI_SCALE_PERCENT.value() / 100.f;
}
ImVec2 apply_scaling_to_vector(const ImVec2& input);
ImVec2 apply_scaling_to_vector(float x, float y);
class SpiceOverlay {
public:
+1 -1
View File
@@ -21,7 +21,7 @@ namespace overlay::windows {
CameraControl::CameraControl(SpiceOverlay *overlay) : Window(overlay) {
this->title = "IIDX Camera Control";
this->flags |= ImGuiWindowFlags_AlwaysAutoResize;
this->init_pos = ImVec2(40, 40);
this->init_pos = overlay::apply_scaling_to_vector(40, 40);
this->toggle_button = games::OverlayButtons::ToggleCameraControl;
}
+4 -5
View File
@@ -13,12 +13,11 @@
using namespace rapidjson;
namespace overlay::windows {
CardManager::CardManager(SpiceOverlay *overlay) : Window(overlay) {
this->title = "Card Manager";
this->init_size = ImVec2(420, 420);
this->init_size = overlay::apply_scaling_to_vector(ImVec2(420, 420));
if (cfg::CONFIGURATOR_STANDALONE) {
this->init_pos = ImVec2(40, 40);
@@ -304,7 +303,7 @@ namespace overlay::windows {
//
// setting ImGuiInputTextFlags_CallbackCharFilter and pressing escape doesn't cause below
// to return true, making it necessary to provide a callback...
ImGui::SetNextItemWidth(240);
ImGui::SetNextItemWidth(overlay::apply_scaling(240));
if (ImGui::InputTextWithHint("", "Type here to search..", &this->search_filter)) {
this->current_card = nullptr;
this->search_filter_in_lower_case = strtolower(this->search_filter);
@@ -451,7 +450,7 @@ namespace overlay::windows {
// check parse error
auto error = doc.GetParseError();
if (error) {
log_warning("cardmanager", "config parse error: {}", error);
log_warning("cardmanager", "config parse error: {}", static_cast<uint32_t>(error));
}
// verify root is a dict
@@ -542,7 +541,7 @@ namespace overlay::windows {
// check parse error
auto error = doc.GetParseError();
if (error) {
log_warning("cardmanager", "template parse error: {}", error);
log_warning("cardmanager", "template parse error: {}", static_cast<uint32_t>(error));
}
// add cards
+2026 -1717
View File
File diff suppressed because it is too large Load Diff
+35 -11
View File
@@ -38,7 +38,6 @@ namespace overlay::windows {
ConfigTab tab_selected = ConfigTab::CONFIG_TAB_INVALID;
// buttons tab
int buttons_page = 0;
bool buttons_keyboard_state[0xFF];
bool buttons_bind_active = false;
bool buttons_many_active = false;
@@ -55,7 +54,6 @@ namespace overlay::windows {
int analogs_devices_control_selected = -1;
// lights tab
int lights_page = 0;
std::vector<rawinput::Device *> lights_devices;
int lights_devices_selected = -1;
int lights_devices_control_selected = -1;
@@ -78,17 +76,33 @@ namespace overlay::windows {
std::string search_filter = "";
std::string search_filter_in_lower_case = "";
public:
Config(SpiceOverlay *overlay);
~Config() override;
void build_buttons(const std::string &name, std::vector<Button> *buttons, int min = 0, int max = -1);
void build_button(
const std::string &name,
Button &primary_button,
Button *button,
const int button_it,
const int button_it_max,
const int alt_index);
void bind_button_popup(const std::string &bind_name, Button *button, const int button_it_max, const int alt_index);
void naive_button_popup(const std::string &naive_string, Button *button, const int button_it_max, const int alt_index);
void edit_button_popup(
const std::string &edit_name,
const std::string &button_display,
Button *button,
const float button_velocity,
const int alt_index);
void clear_button(Button *button, const int alt_index);
void read_card(int player = -1);
void write_card(int player);
void build_content() override;
void build_buttons(const std::string &name, std::vector<Button> *buttons,
int min = 0, int max = -1);
void build_analogs(const std::string &name, std::vector<Analog> *analogs);
void edit_analog_popup(Analog &analog);
void build_lights(const std::string &name, std::vector<Light> *lights);
void build_light(Light &primary_light, Light *light, const int light_index, const int alt_index);
void clear_light(Light *light, const int alt_index);
void edit_light_popup(Light &primary_light, Light *light, const int alt_index);
void build_cards();
void build_options(
std::vector<Option> *options, const std::string &category, const std::string *filter=nullptr);
@@ -96,8 +110,18 @@ namespace overlay::windows {
void build_launcher();
void launch_shell(LPCSTR app, LPCSTR file=nullptr);
static void build_page_selector(int *page);
void build_menu(int *game_selected);
void shutdown_system(bool force, bool reboot_instead);
void set_alternating_row_colors(const int row_index);
public:
Config(SpiceOverlay *overlay);
~Config() override;
void read_card(int player = -1);
void write_card(int player);
void build_content() override;
};
}
+22 -3
View File
@@ -1,6 +1,9 @@
#include "exitprompt.h"
#include "avs/game.h"
#include "misc/eamuse.h"
#include "util/logging.h"
#include "games/iidx/iidx.h"
#include "games/gitadora/gitadora.h"
namespace overlay::windows {
@@ -8,10 +11,10 @@ namespace overlay::windows {
this->title = "spice2x";
this->init_size = ImVec2(
(ImGui::GetFontSize() * 14) + (ImGui::GetStyle().ItemSpacing.x * 2),
120);
overlay::apply_scaling(120));
this->init_pos = ImVec2(
ImGui::GetIO().DisplaySize.x / 2 - this->init_size.x / 2,
10);
overlay::apply_scaling(10));
this->flags = ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoCollapse
@@ -55,7 +58,23 @@ namespace overlay::windows {
}
ImGui::Spacing();
build_button(this->overlay->window_config, "Show Config", size, NextItem::NEW_LINE, false);
build_button(this->overlay->window_sub, "Show Subscreen", size, NextItem::NEW_LINE, false);
std::string sub = "Show Subscreen";
if (avs::game::is_model("LDJ")) {
if (games::iidx::TDJ_MODE) {
sub = "Show TDJ Subscreen";
} else {
sub = "Show LDJ LED Ticker";
}
} else if (avs::game::is_model("KFC")) {
sub = "Show Valkyrie Subscreen";
} else if (avs::game::is_model("REC")) {
sub = "Show DRS Dance Floor";
} else if (games::gitadora::is_arena_model() && games::gitadora::ARENA_SINGLE_WINDOW) {
sub = "Show GITADORA Subscreen";
}
build_button(this->overlay->window_sub, sub, size, NextItem::NEW_LINE, false);
ImGui::TextDisabled("Graphics");
build_button(this->overlay->window_camera, "Camera control", size, NextItem::NEW_LINE);
+18 -13
View File
@@ -1,5 +1,6 @@
#include <iomanip>
#include <sstream>
#include "external/fmt/include/fmt/chrono.h"
#include "fps.h"
namespace overlay::windows {
@@ -15,13 +16,17 @@ namespace overlay::windows {
| ImGuiWindowFlags_NoNavInputs
| ImGuiWindowFlags_NoDocking;
this->bg_alpha = 0.5f;
this->start_time = std::chrono::system_clock::now();
this->start_time =
std::chrono::floor<std::chrono::seconds>(std::chrono::system_clock::now());
}
void FPS::calculate_initial_window() {
// width is 114x82 px with window decoration, 98x47 for the content
int pos_x = overlay::FPS_SHOULD_FLIP ? 8 : ImGui::GetIO().DisplaySize.x - 122;
this->init_pos = ImVec2(pos_x, 8);
int pos_x =
overlay::FPS_SHOULD_FLIP ?
overlay::apply_scaling(8) :
ImGui::GetIO().DisplaySize.x - overlay::apply_scaling(122);
this->init_pos = ImVec2(pos_x, overlay::apply_scaling(8));
}
void FPS::build_content() {
@@ -31,23 +36,23 @@ namespace overlay::windows {
ImGui::Text("FPS: %.1f", io.Framerate);
// ImGui::Text("FT: %.2fms", 1000 / io.Framerate);
auto now = std::chrono::system_clock::now();
const auto now = std::chrono::system_clock::now();
const auto now_s = std::chrono::floor<std::chrono::seconds>(now);
// current time
{
auto now_t = std::chrono::system_clock::to_time_t(now);
static CHAR buf[48];
std::strftime(buf, sizeof(buf), "Time: %H:%M:%S", std::localtime(&now_t));
ImGui::Text(buf);
const std::time_t tt = std::chrono::system_clock::to_time_t(now_s);
std::tm local_tm{};
localtime_s(&local_tm, &tt);
ImGui::TextUnformatted(fmt::format("Time: {:%H:%M:%S}", local_tm).c_str());
}
// elapsed time
{
auto d = now - this->start_time;
const auto h = std::chrono::duration_cast<std::chrono::hours>(d);
const auto m = std::chrono::duration_cast<std::chrono::minutes>(d - h);
const auto s = std::chrono::duration_cast<std::chrono::seconds>(d - h - m);
ImGui::Text("Up: %02d:%02d:%02d", (int)h.count(), (int)m.count(), (int)s.count());
const auto uptime = now_s - this->start_time;
ImGui::TextUnformatted(
fmt::format("Up: {:%H:%M:%S}",
std::chrono::floor<std::chrono::seconds>(uptime)).c_str());
}
}
}
+12 -2
View File
@@ -2,8 +2,6 @@
#include "generic_sub.h"
#include <fmt/format.h>
#include "avs/game.h"
#include "games/io.h"
#include "cfg/screen_resize.h"
@@ -87,19 +85,27 @@ namespace overlay::windows {
}
void GenericSubScreen::touch_transform(const ImVec2 xy_in, LONG *x_out, LONG *y_out) {}
void GenericSubScreen::check_for_errors() {}
void GenericSubScreen::build_content() {
this->flags |= ImGuiWindowFlags_NoBackground;
check_for_errors();
if (this->disabled_message.has_value()) {
this->draws_window = true;
this->flags &= ~ImGuiWindowFlags_NoBackground;
ImGui::TextColored(YELLOW, "%s", this->disabled_message.value().c_str());
ImGui::TextUnformatted("");
if (ImGui::Button("Close")) {
this->set_active(false);
}
return;
}
this->draw_texture();
if (!this->texture) {
this->draws_window = true;
this->flags &= ~ImGuiWindowFlags_NoBackground;
ImGui::TextColored(YELLOW, "Failed to acquire surface texture for subscreen.");
if (avs::game::is_model("LDJ")) {
@@ -113,6 +119,10 @@ namespace overlay::windows {
"Ensure that you did not accidentally enable a patch \n"
"that turns off subscreen rendering.");
}
ImGui::TextUnformatted("");
if (ImGui::Button("Close")) {
this->set_active(false);
}
}
#if OVERLAYDBG
+1
View File
@@ -31,6 +31,7 @@ namespace overlay::windows {
protected:
virtual void touch_transform(const ImVec2 xy_in, LONG *x_out, LONG *y_out);
virtual void check_for_errors();
ImVec2 overlay_content_top_left;
ImVec2 overlay_content_size;
std::optional<std::string> disabled_message = std::nullopt;
+54
View File
@@ -0,0 +1,54 @@
#include "avs/game.h"
#include "gfdm_sub.h"
#include "games/gitadora/gitadora.h"
#include "hooks/graphics/graphics.h"
#include "touch/touch.h"
namespace overlay::windows {
GitaDoraSubScreen::GitaDoraSubScreen(SpiceOverlay *overlay) : GenericSubScreen(overlay) {
this->title = "GITADORA Subscreen";
if (!games::gitadora::is_arena_model()) {
this->disabled_message = "Requires Arena Model!";
}
this->resize_callback = keep_10_by_16;
// medium size - perfect for "layout B" in GW Delta, though in drums it covers the pacemaker
float size = 0.64f;
if (games::gitadora::SUBSCREEN_OVERLAY_SIZE.has_value()) {
if (games::gitadora::SUBSCREEN_OVERLAY_SIZE.value() == "large") {
// enough to not cover the FPS overlay
size = 0.88f;
} else if (games::gitadora::SUBSCREEN_OVERLAY_SIZE.value() == "small") {
size = 0.48f;
}
}
const float height = ImGui::GetIO().DisplaySize.y * size;
const float width = height * 10 / 16;
this->init_size = ImVec2(width, height + ImGui::GetFrameHeight());
// bottom right
this->init_pos = ImVec2(
ImGui::GetIO().DisplaySize.x - ImGui::GetFrameHeight() / 4 - this->init_size.x,
ImGui::GetIO().DisplaySize.y - this->init_size.y - (ImGui::GetFrameHeight() / 4));
}
void GitaDoraSubScreen::touch_transform(const ImVec2 xy_in, LONG *x_out, LONG *y_out) {
if (!this->get_active()) {
return;
}
if (GRAPHICS_WINDOWED) {
// Touch needs to be registered on global coords
*x_out = SPICETOUCH_TOUCH_X + xy_in.x * SPICETOUCH_TOUCH_WIDTH;
*y_out = SPICETOUCH_TOUCH_Y + xy_in.y * SPICETOUCH_TOUCH_HEIGHT;
} else {
// Fullscreen mode, scale to game coords
*x_out = xy_in.x * ImGui::GetIO().DisplaySize.x;
*y_out = xy_in.y * ImGui::GetIO().DisplaySize.y;
}
}
}
+20
View File
@@ -0,0 +1,20 @@
#pragma once
#include "overlay/window.h"
#include "overlay/windows/generic_sub.h"
namespace overlay::windows {
class GitaDoraSubScreen : public GenericSubScreen {
public:
GitaDoraSubScreen(SpiceOverlay *overlay);
protected:
void touch_transform(const ImVec2 xy_in, LONG *x_out, LONG *y_out) override;
private:
static void keep_10_by_16(ImGuiSizeCallbackData* data) {
data->DesiredSize.y = (data->DesiredSize.x * 16.f / 10.f) + ImGui::GetFrameHeight();
}
};
}
+42 -8
View File
@@ -10,12 +10,14 @@ namespace overlay::windows {
uint32_t IIDX_SEGMENT_FONT_SIZE = 64;
std::optional<uint32_t> IIDX_SEGMENT_FONT_COLOR = std::nullopt;
std::string IIDX_SEGMENT_LOCATION = "bottom";
bool IIDX_SEGMENT_BORDERLESS = false;
static const size_t TICKER_SIZE = 9;
static const ImVec4 DARK_GRAY(0.1f, 0.1f, 0.1f, 1.f);
static const ImVec4 YELLOW(1.f, 1.f, 0.f, 1.f);
static const ImVec4 RED(1.f, 0.f, 0.f, 1.f);
static const int PADDING_Y = 8;
static const int PADDING_X = 4;
static const float PADDING_Y = 8.f;
static const float PADDING_X = 4.f;
static const std::map<char, std::pair<char, char>> CHARMAP = {\
// period - add a space afterwards (game sends 'm' for period)
@@ -31,16 +33,18 @@ namespace overlay::windows {
log_fatal("iidx_seg", "DSEG_FONT is null");
}
this->title = "IIDX LED Segment Display";
this->title = "IIDX LDJ LED Ticker";
this->toggle_button = games::OverlayButtons::ToggleSubScreen;
this->remove_window_padding = true;
this->size_max = ImVec2(ImGui::GetIO().DisplaySize.x, ImGui::GetIO().DisplaySize.y);
this->flags = ImGuiWindowFlags_NoTitleBar
| ImGuiWindowFlags_NoScrollbar
this->flags = ImGuiWindowFlags_NoScrollbar
| ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoNavFocus
| ImGuiWindowFlags_NoNavInputs
| ImGuiWindowFlags_NoDocking;
if (IIDX_SEGMENT_BORDERLESS) {
this->flags |= ImGuiWindowFlags_NoTitleBar;
}
if (IIDX_SEGMENT_FONT_COLOR.has_value()) {
const auto rgb = IIDX_SEGMENT_FONT_COLOR.value();
@@ -51,13 +55,22 @@ namespace overlay::windows {
}
}
float IIDXSegmentDisplay::get_title_bar_height() {
// make sure you don't call this within PushFont/PopFont block
// since text line height calculation is dependent on current font size
return ImGui::GetTextLineHeight() + ImGui::GetStyle().FramePadding.y * 2.0f;
}
void IIDXSegmentDisplay::calculate_initial_window() {
// ImGui::CalcTextSize doesn't seem to work here, so manually calculate
ImGui::PushFont(DSEG_FONT);
this->init_size = ImGui::CalcTextSize("~.~.~.~.~.~.~.~.~.");
ImGui::PopFont();
this->init_size.x += PADDING_X * 2;
this->init_size.y += PADDING_Y * 2;
ImGui::PopFont();
if (!IIDX_SEGMENT_BORDERLESS) {
this->init_size.y += get_title_bar_height();
}
// initial horizontal position
if (IIDX_SEGMENT_LOCATION.find("left") != std::string::npos) {
@@ -79,6 +92,23 @@ namespace overlay::windows {
}
void IIDXSegmentDisplay::build_content() {
// explicitly check if TDJ I/O is enabled to account for the fact that I/O emulation may be
// disabled
if (games::iidx::CURRENT_IO_EMULATION_STATE == games::iidx::iidx_aio_emulation_state::bi2x_hook) {
ImGui::TextUnformatted("");
ImGui::TextColored(
YELLOW,
"%s",
"Invalid I/O mode; DLL is configured for TDJ I/O!\n"
"Enable -iidxtdj if you want TDJ subscreen overlay.");
ImGui::TextUnformatted("");
if (ImGui::Button("Close")) {
this->set_active(false);
}
return;
}
char input_ticker[TICKER_SIZE];
// get ticker content from game
@@ -127,9 +157,13 @@ namespace overlay::windows {
}
void IIDXSegmentDisplay::draw_ticker(char *ticker_string) {
ImGui::PushFont(DSEG_FONT);
float pad_y = PADDING_Y;
if (!IIDX_SEGMENT_BORDERLESS) {
pad_y += get_title_bar_height();
}
const auto pos = ImVec2(PADDING_X, pad_y);
const auto pos = ImVec2(PADDING_X, PADDING_Y);
ImGui::PushFont(DSEG_FONT);
// to imitate LED "off"
ImGui::SetCursorPos(pos);
+2
View File
@@ -8,12 +8,14 @@ namespace overlay::windows {
extern uint32_t IIDX_SEGMENT_FONT_SIZE;
extern std::optional<uint32_t> IIDX_SEGMENT_FONT_COLOR;
extern std::string IIDX_SEGMENT_LOCATION;
extern bool IIDX_SEGMENT_BORDERLESS;
class IIDXSegmentDisplay : public Window {
public:
IIDXSegmentDisplay(SpiceOverlay *overlay);
void calculate_initial_window() override;
void build_content() override;
float get_title_bar_height();
private:
ImVec4 color;
void draw_ticker(char *ticker_string);
+16 -5
View File
@@ -9,13 +9,12 @@
namespace overlay::windows {
IIDXSubScreen::IIDXSubScreen(SpiceOverlay *overlay) : GenericSubScreen(overlay) {
this->title = "IIDX Sub Screen";
this->title = "IIDX TDJ Subscreen";
if (GRAPHICS_IIDX_WSUB) {
this->disabled_message =
"Close this overlay and use the second window.\n"
"If you don't see the window, double check your DLL type and apply TDJ I/O patches as needed.";
this->draws_window = false;
this->disabled_message = "Close this overlay and use the second window. (try ALT+TAB)";
} else if (games::iidx::IIDX_TDJ_MONITOR_WARNING) {
this->disabled_message = "TDJ mode subscreen overlay is not compatible with -monitor option.";
}
float size = 0.5f;
@@ -43,6 +42,18 @@ namespace overlay::windows {
ImGui::GetIO().DisplaySize.y - this->init_size.y - (ImGui::GetFrameHeight() / 2));
}
void IIDXSubScreen::check_for_errors() {
if (games::iidx::CURRENT_IO_EMULATION_STATE ==
games::iidx::iidx_aio_emulation_state::bi2a_com2) {
// explicitly check if LDJ I/O is enabled (as opposed to checking if NOT TDJ I/O)
// to account for the fact that I/O emulation may be disabled
this->disabled_message =
"LDJ I/O detected; TDJ mode subscreen overlay requires TDJ I/O.\n"
"Ensure you apply applicable TDJ I/O patches, or run with TDJ DLL.";
}
}
void IIDXSubScreen::touch_transform(const ImVec2 xy_in, LONG *x_out, LONG *y_out) {
if (!this->get_active()) {
return;
+1
View File
@@ -12,6 +12,7 @@ namespace overlay::windows {
protected:
void touch_transform(const ImVec2 xy_in, LONG *x_out, LONG *y_out) override;
void check_for_errors() override;
};
}
+6 -2
View File
@@ -3,6 +3,7 @@
#include "launcher/launcher.h"
#include "games/io.h"
#include "misc/eamuse.h"
#include "overlay/imgui/extensions.h"
namespace overlay::windows {
@@ -11,7 +12,7 @@ namespace overlay::windows {
this->flags = ImGuiWindowFlags_AlwaysAutoResize;
this->init_size = ImVec2(
80,
overlay::apply_scaling(80),
ImGui::GetFrameHeight() +
ImGui::GetStyle().WindowPadding.y * 2 +
ImGui::GetFrameHeightWithSpacing() * 3 +
@@ -58,7 +59,7 @@ namespace overlay::windows {
void IOPanel::build_io_panel() {}
void IOPanel::build_operator_menu() {
const ImVec2 wide(60, 0);
const ImVec2 wide = overlay::apply_scaling_to_vector(60, 0);
const float spacing_x = ImGui::GetStyle().ItemSpacing.y;
const ImVec2 tall(
ImGui::GetFrameHeight(),
@@ -80,6 +81,9 @@ namespace overlay::windows {
{
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - ImGui::GetFrameHeightWithSpacing());
this->build_button("+", tall, this->test_button, this->service_button);
if (ImGui::IsItemHovered(ImGui::TOOLTIP_FLAGS)) {
ImGui::HelpTooltip("SERVICE + TEST");
}
}
ImGui::EndGroup();
+50 -15
View File
@@ -3,6 +3,7 @@
#include "games/io.h"
#include "games/gitadora/gitadora.h"
#include "games/gitadora/io.h"
#include "overlay/imgui/extensions.h"
#include "misc/eamuse.h"
#include "util/logging.h"
@@ -11,6 +12,7 @@ namespace overlay::windows {
GitadoraIOPanel::GitadoraIOPanel(SpiceOverlay *overlay) : IOPanel(overlay) {
this->title = "GITADORA IO Panel";
this->has_menu_controls = true;
// by default, make a safer assumption that there are two players
this->two_players = true;
// by default, enable the extra input only available on DX cabs...
@@ -33,6 +35,12 @@ namespace overlay::windows {
this->has_guitar_knobs = false;
}
if (games::gitadora::is_arena_model()) {
this->has_menu_controls = false;
this->two_players = false;
this->has_guitar_knobs = false;
}
find_gfdm_buttons();
}
@@ -68,25 +76,45 @@ namespace overlay::windows {
}
void GitadoraIOPanel::build_io_panel() {
ImGui::Dummy(ImVec2(12, 0));
ImGui::Dummy(overlay::apply_scaling_to_vector(12, 0));
ImGui::SameLine();
this->draw_buttons(0);
if (this->has_guitar_knobs) {
if (this->has_menu_controls) {
ImGui::SameLine();
this->draw_sliders(0);
}
// draw p2 only if guitar freaks
if (this->two_players) {
ImGui::SameLine();
ImGui::Dummy(ImVec2(12, 0));
ImGui::SameLine();
this->draw_buttons(1);
ImGui::PushID("P1");
this->draw_buttons(0);
if (this->has_guitar_knobs) {
ImGui::SameLine();
this->draw_sliders(1);
this->draw_sliders(0);
}
ImGui::PopID();
// draw p2 only if guitar freaks
if (this->two_players) {
ImGui::SameLine();
ImGui::Dummy(overlay::apply_scaling_to_vector(12, 0));
ImGui::SameLine();
ImGui::PushID("P2");
this->draw_buttons(1);
if (this->has_guitar_knobs) {
ImGui::SameLine();
this->draw_sliders(1);
}
ImGui::PopID();
}
}
if (games::gitadora::is_guitar()) {
ImGui::SameLine();
ImGui::Dummy(overlay::apply_scaling_to_vector(12, 0));
ImGui::SameLine();
ImGui::BeginGroup();
{
ImGui::Checkbox("P1 Lefty", &games::gitadora::P1_LEFTY);
if (this->two_players) {
ImGui::Checkbox("P2 Lefty", &games::gitadora::P2_LEFTY);
}
}
ImGui::EndGroup();
}
}
@@ -107,6 +135,10 @@ namespace overlay::windows {
{
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetFrameHeightWithSpacing());
this->build_button("<", leftright_size, this->left[p], nullptr, this->leftright_light[p]);
this->build_button("+", tiny_size, this->help[p], this->start[p], nullptr);
if (ImGui::IsItemHovered(ImGui::TOOLTIP_FLAGS)) {
ImGui::HelpTooltip("HELP + START");
}
}
ImGui::EndGroup();
@@ -135,6 +167,9 @@ namespace overlay::windows {
ImGui::BeginGroup();
{
this->build_button("?", tiny_size, this->help[p], nullptr, this->help_light[p]);
if (ImGui::IsItemHovered(ImGui::TOOLTIP_FLAGS)) {
ImGui::HelpTooltip("HELP");
}
this->build_button(">", leftright_size, this->right[p], nullptr, this->leftright_light[p]);
}
ImGui::EndGroup();
@@ -146,7 +181,7 @@ namespace overlay::windows {
games::gitadora::Analogs::GuitarP1Knob :
games::gitadora::Analogs::GuitarP2Knob;
const ImVec2 slider_size(32, get_suggested_height());
const ImVec2 slider_size(overlay::apply_scaling(32), get_suggested_height());
// get analog
const auto analogs = games::get_analogs(eamuse_get_game());
+1
View File
@@ -18,6 +18,7 @@ namespace overlay::windows {
void draw_buttons(const int player);
void draw_sliders(const int player);
bool has_menu_controls;
bool two_players;
bool has_guitar_knobs;
+15 -7
View File
@@ -19,15 +19,15 @@ namespace overlay::windows {
case 0: {
this->toggle_button = games::OverlayButtons::ToggleVirtualKeypadP1;
this->init_pos = ImVec2(
26,
ImGui::GetIO().DisplaySize.y - 264);
overlay::apply_scaling(26),
ImGui::GetIO().DisplaySize.y - overlay::apply_scaling(264));
break;
}
case 1: {
this->toggle_button = games::OverlayButtons::ToggleVirtualKeypadP2;
this->init_pos = ImVec2(
ImGui::GetIO().DisplaySize.x - 220,
ImGui::GetIO().DisplaySize.y - 264);
ImGui::GetIO().DisplaySize.x - overlay::apply_scaling(220),
ImGui::GetIO().DisplaySize.y - overlay::apply_scaling(264));
break;
}
}
@@ -82,9 +82,17 @@ namespace overlay::windows {
// add selectable (fill last line)
if (i == std::size(BUTTONS) - 1) {
ImGui::Selectable(button.text, false, 0, ImVec2(112, 32));
ImGui::Selectable(
button.text,
false,
0,
overlay::apply_scaling_to_vector(ImVec2(112, 32)));
} else {
ImGui::Selectable(button.text, false, 0, ImVec2(32, 32));
ImGui::Selectable(
button.text,
false,
0,
overlay::apply_scaling_to_vector(ImVec2(32, 32)));
}
// mouse down handler
@@ -112,7 +120,7 @@ namespace overlay::windows {
"Lightning Model cabinets (TDJ) do not have any keypads; they use the subscreen.\n\n"
"Fullscreen mode: bind a key in Overlay tab, and press it in game to show the subscreen, "
"then use your mouse to click. Page Up button is the default binding.\n\n"
"Windowed mode: look for the second window in the taskbar.\n\n"
"Windowed mode: look for the second window in the taskbar (or ALT+TAB).\n\n"
"Windowed mode with -iidxnosub: bring up the subscreen overlay (default Page Up).\n\n"
);
+67 -23
View File
@@ -1,11 +1,13 @@
#include "patch_manager.h"
#include <chrono>
#include <thread>
#include <fstream>
#include <shellapi.h>
#include <winhttp.h>
#include <psapi.h>
#include <format>
#include "external/fmt/include/fmt/chrono.h"
#include "external/rapidjson/document.h"
#include "external/rapidjson/prettywriter.h"
#include "external/rapidjson/stringbuffer.h"
@@ -40,7 +42,6 @@
using namespace rapidjson;
namespace overlay::windows {
@@ -288,6 +289,12 @@ namespace overlay::windows {
this->reload_local_patches();
}
if (avs::game::DLL_NAME == "kamunity.dll") {
ImGui::TextColored(ImVec4(1.f, 0.f, 0.f, 1.f), "Patches are not supported for Unity-based games.");
ImGui::TextColored(ImVec4(1.f, 0.f, 0.f, 1.f), "Instead, look for downloads of pre-patched DLLs.");
return;
}
// game code info
std::string identifiers;
identifiers += avs::game::get_identifier() + "\n\n";
@@ -714,7 +721,7 @@ namespace overlay::windows {
if (style_color_pushed) {
ImGui::PopStyleColor(style_color_pushed);
}
if (ImGui::IsItemHovered()) {
if (ImGui::IsItemHovered(ImGui::TOOLTIP_FLAGS)) {
show_patch_tooltip(patch);
}
@@ -755,7 +762,7 @@ namespace overlay::windows {
patch.last_status = is_patch_active(patch);
}
ImGui::EndDisabled();
if (ImGui::IsItemHovered()) {
if (ImGui::IsItemHovered(ImGui::TOOLTIP_FLAGS)) {
show_patch_tooltip(patch);
}
@@ -784,7 +791,7 @@ namespace overlay::windows {
}
ImGui::EndCombo();
}
if (ImGui::IsItemHovered()) {
if (ImGui::IsItemHovered(ImGui::TOOLTIP_FLAGS)) {
show_patch_tooltip(patch);
}
} else if (patch.type == PatchType::Integer) {
@@ -800,7 +807,7 @@ namespace overlay::windows {
apply_patch(patch, true);
config_dirty = true;
}
if (ImGui::IsItemHovered()) {
if (ImGui::IsItemHovered(ImGui::TOOLTIP_FLAGS)) {
show_patch_tooltip(patch);
}
}
@@ -817,7 +824,7 @@ namespace overlay::windows {
ImGui::InputInt("##dummy_int_input", &patch.patch_number.value);
}
ImGui::EndDisabled();
if (ImGui::IsItemHovered()) {
if (ImGui::IsItemHovered(ImGui::TOOLTIP_FLAGS)) {
show_patch_tooltip(patch);
}
}
@@ -923,6 +930,13 @@ namespace overlay::windows {
}
}
// match on model and ext, ignoring dest/spec/rev
// sample: LDJ:J:E:A:2025011400
bool PatchManager::is_game_id_wildcard_matched(const std::string& id_from_config) {
return ((id_from_config.compare(0, 3, avs::game::MODEL) == 0) &&
(id_from_config.compare(10, 10, avs::game::EXT) == 0));
}
void PatchManager::config_load() {
log_info("patchmanager", "loading config");
@@ -937,7 +951,7 @@ namespace overlay::windows {
// check parse error
auto error = doc.GetParseError();
if (error) {
log_warning("patchmanager", "config file parse error: {}", error);
log_warning("patchmanager", "config file parse error: {}", static_cast<uint32_t>(error));
}
// verify root is a dict
@@ -948,7 +962,7 @@ namespace overlay::windows {
if (auto_apply != doc.MemberEnd() && auto_apply->value.IsArray()) {
// get game id
auto game_id = avs::game::get_identifier();
const auto game_id = avs::game::get_identifier();
// iterate entries
setting_auto_apply = false;
@@ -957,15 +971,37 @@ namespace overlay::windows {
if (entry.IsString()) {
// check if this is our game identifier
std::string entry_id = entry.GetString();
if (game_id == entry_id) {
setting_auto_apply = true;
const std::string entry_id = entry.GetString();
if (!setting_auto_apply) {
if (game_id == entry_id) {
// exact match
setting_auto_apply = true;
log_misc(
"patchmanager",
"matched auto apply entry by full game identifier: {}",
entry_id);
} else if (is_game_id_wildcard_matched(entry_id)) {
// match on model and ext, ignoring dest/spec/rev
// sample: LDJ:J:E:A:2025011400
setting_auto_apply = true;
log_misc(
"patchmanager",
"matched auto apply entry by partial game identifier: {}:?:?:?:{}",
avs::game::MODEL, avs::game::EXT);
}
}
// move to list
setting_auto_apply_list.emplace_back(entry_id);
}
}
if (!setting_auto_apply) {
log_misc(
"patchmanager",
"no auto apply entry matched, patches will not load automatically");
}
}
// read enabled patches
@@ -1045,7 +1081,7 @@ namespace overlay::windows {
// check parse error
auto error = doc.GetParseError();
if (error) {
log_warning("patchmanager", "template parse error: {}", error);
log_warning("patchmanager", "template parse error: {}", static_cast<uint32_t>(error));
}
// auto apply setting
@@ -1053,7 +1089,7 @@ namespace overlay::windows {
auto game_id = avs::game::get_identifier();
bool game_id_added = false;
for (auto &entry : setting_auto_apply_list) {
if (entry == game_id) {
if (entry == game_id || is_game_id_wildcard_matched(entry)) {
if (!setting_auto_apply) {
continue;
}
@@ -1145,7 +1181,7 @@ namespace overlay::windows {
}
}
std::string get_game_identifier(const std::filesystem::path& dll_path) {
std::string get_game_identifier(const std::filesystem::path& dll_path, bool print_info) {
uint32_t time_date_stamp = 0;
uint32_t address_of_entry_point = 0;
@@ -1154,7 +1190,7 @@ namespace overlay::windows {
if (!result) {
return "";
}
// concatenate TimeDateStamp and AddressOfEntryPoint
std::string identifier =
fmt::format(
@@ -1163,6 +1199,16 @@ namespace overlay::windows {
time_date_stamp,
address_of_entry_point);
if (print_info) {
const auto time = std::chrono::system_clock::from_time_t(time_date_stamp);
log_info(
"patchmanager",
"file: {}, patch id: {}, build timestamp of dll: {:%Y-%m-%d %H:%M}",
dll_path.has_filename() ? dll_path.filename().string() : dll_path.string(),
identifier,
time);
}
return identifier;
}
@@ -1177,7 +1223,7 @@ namespace overlay::windows {
// check parse error
auto error = doc.GetParseError();
if (error) {
log_warning("patchmanager", "embedded patches json file parse error: {}", error);
log_warning("patchmanager", "embedded patches json file parse error: {}", static_cast<uint32_t>(error));
}
// iterate patches
@@ -1509,7 +1555,7 @@ namespace overlay::windows {
}
case PatchType::Unknown:
default:
log_warning("patchmanager", "unknown patch type: {}", patch_data.type);
log_warning("patchmanager", "unknown patch type: {}", static_cast<uint32_t>(patch_data.type));
break;
}
@@ -1652,14 +1698,12 @@ namespace overlay::windows {
ACTIVE_JSON_FILE = "";
std::string firstDll = avs::game::DLL_NAME;
std::string first_id = get_game_identifier(MODULE_PATH / firstDll);
std::string first_id = get_game_identifier(MODULE_PATH / firstDll, true);
std::filesystem::path firstPath = fmt::format("patches/{}.json", first_id);
log_misc("patchmanager", "patch identifier of {}: {}", firstDll, first_id);
auto extraDlls = getExtraDlls(firstDll);
std::erase_if(extraDlls, [](const std::string& dll) {
auto identifier = get_game_identifier(MODULE_PATH / dll);
auto identifier = get_game_identifier(MODULE_PATH / dll, true);
return identifier.empty() || !fileutils::file_exists(fmt::format("patches/{}.json", identifier));
});
@@ -1731,7 +1775,7 @@ namespace overlay::windows {
"patchmanager",
"patches file parse error at offset {}: {} ({})",
error_offset,
error,
static_cast<uint32_t>(error),
rapidjson::GetParseError_En(error));
}
@@ -2239,7 +2283,7 @@ namespace overlay::windows {
}
case PatchType::Unknown:
default:
log_warning("patchmanager", "unknown patch type: {}", patch_data.type);
log_warning("patchmanager", "unknown patch type: {}", static_cast<uint32_t>(patch_data.type));
break;
}
+3 -1
View File
@@ -97,7 +97,7 @@ namespace overlay::windows {
extern std::optional<std::string> PATCH_MANAGER_CFG_PATH_OVERRIDE;
std::string get_game_identifier(const std::filesystem::path& dll_path);
std::string get_game_identifier(const std::filesystem::path& dll_path, bool print_info=false);
class PatchManager : public Window {
public:
@@ -143,6 +143,8 @@ namespace overlay::windows {
std::string pe_identifier_for_patch = "");
void show_patch_tooltip(const PatchData& patch);
bool is_game_id_wildcard_matched(const std::string& id_from_config);
};
PatchStatus is_patch_active(PatchData &patch);
+92 -33
View File
@@ -27,6 +27,12 @@ namespace overlay::windows {
}
HWND ScreenResize::get_first_window() {
// this is ideal
if (GRAPHICS_HOOKED_WINDOW.has_value()) {
return GRAPHICS_HOOKED_WINDOW.value();
}
// we typically do not want to check GRAPHICS_WINDOWS because it may include
// system windows (e.g., CicMarshalWnd)
if (GRAPHICS_WINDOWS.size() == 0) {
return NULL;
}
@@ -55,6 +61,7 @@ namespace overlay::windows {
scene.offset_y = 0;
scene.scale_x = 1.f;
scene.scale_y = 1.f;
scene.duplicate = cfg::ScreenDuplicateMode::None;
}
cfg::SCREENRESIZE->enable_window_resize = false;
@@ -94,6 +101,21 @@ namespace overlay::windows {
}
void ScreenResize::build_fullscreen_config() {
if (avs::game::is_model("KFC")) {
ImGui::TextColored(ImVec4(1, 0.5f, 0.5f, 1.f),
"Warning: Enabling Image Resize uses more GPU\n"
"resources and may significantly lower framerate\n"
"for songs with Live2D! Results may vary, use at\n"
"your own risk.");
} else {
ImGui::TextColored(ImVec4(1, 0.5f, 0.5f, 1.f),
"Warning: Enabling Image Resize uses more GPU\n"
"resources and may significantly lower framerate\n"
"in some situations! Results may vary, use at\n"
"your own risk.");
}
// enable checkbox
ImGui::Checkbox("Enable", &cfg::SCREENRESIZE->enable_screen_resize);
ImGui::SameLine();
@@ -135,21 +157,42 @@ namespace overlay::windows {
// aspect ratio
ImGui::Checkbox("Keep Aspect Ratio", &scene.keep_aspect_ratio);
if (scene.keep_aspect_ratio) {
if (ImGui::SliderFloat("Scale", &scene.scale_x, 0.5f, 2.5f)) {
// we want to avoid zooming out below 0.6 as it will cause StretchRect calls to
// go on a slow sync path with the GPU, leading to frame drops in some situations
// (e.g., SDVX Live2D)
if (ImGui::SliderFloat("Scale", &scene.scale_x, 0.6f, 2.5f)) {
scene.scale_y = scene.scale_x;
}
ImGui::SameLine();
ImGui::HelpMarker("Hint: ctrl + click on the slider to type in a numeric value.");
} else {
ImGui::SliderFloat("Width Scale", &scene.scale_x, 0.5f, 2.5f);
ImGui::SliderFloat("Width Scale", &scene.scale_x, 0.6f, 2.5f);
ImGui::SameLine();
ImGui::HelpMarker("Hint: ctrl + click on the slider to type in a numeric value.");
ImGui::SliderFloat("Height Scale", &scene.scale_y, 0.5f, 2.5f);
ImGui::SliderFloat("Height Scale", &scene.scale_y, 0.6f, 2.5f);
ImGui::SameLine();
ImGui::HelpMarker("Hint: ctrl + click on the slider to type in a numeric value.");
}
static const char* dupe_items[] = { "None", "Copy Left", "Copy Right" };
const bool duplicate_changed = ImGui::Combo(
"Duplicate",
reinterpret_cast<int *>(&scene.duplicate),
dupe_items,
ARRAYSIZE(dupe_items));
ImGui::SameLine();
ImGui::HelpMarker(
"Show an identical copy of the image on the left or right, allowing you to achieve "
"wrap-around effect when an offset is set.");
ImGui::EndDisabled();
// tell d3d9 device to clear surface to get rid of ghost image
if (duplicate_changed) {
cfg::SCREENRESIZE->need_surface_clean = true;
}
}
void ScreenResize::build_windowed_config() {
@@ -159,8 +202,7 @@ namespace overlay::windows {
return;
}
ImGui::TextUnformatted("Warning: may cause some games to crash.");
ImGui::BeginDisabled(graphics_window_change_crashes_game());
ImGui::BeginDisabled(graphics_window_decoration_change_crashes_game());
if (ImGui::Combo(
"Window Style",
&cfg::SCREENRESIZE->window_decoration,
@@ -185,42 +227,59 @@ namespace overlay::windows {
"Reduces pixelated scaling artifacts. Works great on some games, but completely broken on others.\n\n"
"This can't be changed in-game; instead, set -windowscale option in spicecfg and restart.");
ImGui::Checkbox("Keep Aspect Ratio", &cfg::SCREENRESIZE->client_keep_aspect_ratio);
ImGui::Checkbox("Manual window move/resize", &cfg::SCREENRESIZE->enable_window_resize);
ImGui::BeginDisabled(graphics_window_move_and_resize_breaks_game());
{
ImGui::Checkbox("Keep Aspect Ratio", &cfg::SCREENRESIZE->client_keep_aspect_ratio);
ImGui::Checkbox("Manual window move/resize", &cfg::SCREENRESIZE->enable_window_resize);
}
ImGui::EndDisabled();
ImGui::BeginDisabled(!cfg::SCREENRESIZE->enable_window_resize);
bool changed = false;
const uint32_t step = 1;
const uint32_t step_fast = 10;
ImGui::BeginDisabled(cfg::SCREENRESIZE->client_keep_aspect_ratio);
ImGui::InputScalar(
"Width",
ImGuiDataType_U32,
&cfg::SCREENRESIZE->client_width,
&step, &step_fast, nullptr);
changed |= ImGui::IsItemDeactivatedAfterEdit();
ImGui::BeginDisabled(graphics_window_resize_breaks_game());
{
ImGui::BeginDisabled(cfg::SCREENRESIZE->client_keep_aspect_ratio);
{
ImGui::InputScalar(
"Width",
ImGuiDataType_U32,
&cfg::SCREENRESIZE->client_width,
&step, &step_fast, nullptr);
changed |= ImGui::IsItemDeactivatedAfterEdit();
}
ImGui::EndDisabled();
ImGui::InputScalar(
"Height",
ImGuiDataType_U32,
&cfg::SCREENRESIZE->client_height,
&step, &step_fast, nullptr);
changed |= ImGui::IsItemDeactivatedAfterEdit();
}
ImGui::EndDisabled();
ImGui::InputScalar(
"Height",
ImGuiDataType_U32,
&cfg::SCREENRESIZE->client_height,
&step, &step_fast, nullptr);
changed |= ImGui::IsItemDeactivatedAfterEdit();
ImGui::BeginDisabled(graphics_window_move_and_resize_breaks_game());
{
ImGui::InputScalar(
"X Offset",
ImGuiDataType_S32,
&cfg::SCREENRESIZE->window_offset_x,
&step, &step_fast, nullptr);
changed |= ImGui::IsItemDeactivatedAfterEdit();
ImGui::InputScalar(
"X Offset",
ImGuiDataType_S32,
&cfg::SCREENRESIZE->window_offset_x,
&step, &step_fast, nullptr);
changed |= ImGui::IsItemDeactivatedAfterEdit();
ImGui::InputScalar(
"Y Offset",
ImGuiDataType_S32,
&cfg::SCREENRESIZE->window_offset_y,
&step, &step_fast, nullptr);
changed |= ImGui::IsItemDeactivatedAfterEdit();
ImGui::InputScalar(
"Y Offset",
ImGuiDataType_S32,
&cfg::SCREENRESIZE->window_offset_y,
&step, &step_fast, nullptr);
changed |= ImGui::IsItemDeactivatedAfterEdit();
}
ImGui::EndDisabled();
if (changed) {
if (cfg::SCREENRESIZE->client_keep_aspect_ratio) {
+5 -4
View File
@@ -8,16 +8,17 @@
namespace overlay::windows {
SDVXSubScreen::SDVXSubScreen(SpiceOverlay *overlay) : GenericSubScreen(overlay) {
this->title = "SDVX Sub Screen";
this->title = "SDVX Subscreen";
bool isValkyrieCabinetMode = avs::game::SPEC[0] == 'G' || avs::game::SPEC[0] == 'H';
if (!isValkyrieCabinetMode) {
if (!games::sdvx::is_valkyrie_model()) {
this->disabled_message = "Valkyrie Model mode is not enabled!";
} else if (games::sdvx::SHOW_VM_MONITOR_WARNING) {
this->disabled_message = "VM mode subscreen overlay is not compatible with -monitor option";
} else if (GRAPHICS_WINDOWED) {
if (GRAPHICS_PREVENT_SECONDARY_WINDOW) {
this->disabled_message = "Subscreen has been disabled by the user (-sdvxnosub).";
} else {
this->disabled_message = "Overlay unavailable in windowed mode! Use the second window instead.";
this->disabled_message = "Overlay unavailable in windowed mode! Use the second window instead. (ALT+TAB)";
}
}