Let us start here, from square one. No, from Zero!
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#include "acio_status_buffers.h"
|
||||
#include "overlay/imgui/extensions.h"
|
||||
#include "external/imgui/imgui_memory_editor.h"
|
||||
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
ACIOStatusBuffers::ACIOStatusBuffers(SpiceOverlay *overlay, acio::ACIOModule *module)
|
||||
: Window(overlay), module(module) {
|
||||
this->title = module->name + " Status Buffers";
|
||||
this->init_size = ImVec2(600, 400);
|
||||
this->init_pos = ImVec2(
|
||||
ImGui::GetIO().DisplaySize.x / 2 - this->init_size.x / 2,
|
||||
ImGui::GetIO().DisplaySize.y / 2 - this->init_size.y / 2);
|
||||
this->active = true;
|
||||
|
||||
// configure editor defaults
|
||||
this->editor = new MemoryEditor();
|
||||
this->editor->OptShowDataPreview = true;
|
||||
this->editor->PreviewDataType = MemoryEditor::DataType::DataType_U16;
|
||||
}
|
||||
|
||||
ACIOStatusBuffers::~ACIOStatusBuffers() {
|
||||
|
||||
// kill editor
|
||||
delete this->editor;
|
||||
}
|
||||
|
||||
void ACIOStatusBuffers::build_content() {
|
||||
|
||||
// freeze checkbox
|
||||
if (module->status_buffer_freeze) {
|
||||
ImGui::Checkbox("Freeze", module->status_buffer_freeze);
|
||||
ImGui::SameLine();
|
||||
ImGui::HelpMarker("Prevent automatic modifications to the buffer.");
|
||||
ImGui::Separator();
|
||||
}
|
||||
|
||||
// draw editor
|
||||
this->editor->DrawContents(
|
||||
this->module->status_buffer,
|
||||
this->module->status_buffer_size);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "overlay/window.h"
|
||||
#include "acio/acio.h"
|
||||
|
||||
struct MemoryEditor;
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
class ACIOStatusBuffers : public Window {
|
||||
public:
|
||||
|
||||
ACIOStatusBuffers(SpiceOverlay *overlay, acio::ACIOModule *module);
|
||||
~ACIOStatusBuffers() override;
|
||||
|
||||
void build_content() override;
|
||||
|
||||
private:
|
||||
acio::ACIOModule *module;
|
||||
MemoryEditor *editor;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
#include <games/io.h>
|
||||
#include "card_manager.h"
|
||||
|
||||
#include "external/rapidjson/document.h"
|
||||
#include "external/rapidjson/writer.h"
|
||||
#include "misc/eamuse.h"
|
||||
#include "util/utils.h"
|
||||
#include "util/fileutils.h"
|
||||
|
||||
using namespace rapidjson;
|
||||
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
CardManager::CardManager(SpiceOverlay *overlay) : Window(overlay) {
|
||||
this->title = "Card Manager";
|
||||
this->init_size = ImVec2(300, 200);
|
||||
this->init_pos = ImVec2(
|
||||
ImGui::GetIO().DisplaySize.x / 2 - this->init_size.x / 2,
|
||||
ImGui::GetIO().DisplaySize.y / 2 - this->init_size.y / 2);
|
||||
this->toggle_button = games::OverlayButtons::ToggleCardManager;
|
||||
this->config_path = std::string(getenv("APPDATA")) + "\\spicetools_card_manager.json";
|
||||
if (fileutils::file_exists(this->config_path)) {
|
||||
this->config_load();
|
||||
}
|
||||
}
|
||||
|
||||
CardManager::~CardManager() {
|
||||
}
|
||||
|
||||
void CardManager::build_content() {
|
||||
|
||||
// get window size
|
||||
auto window_size = ImGui::GetWindowSize();
|
||||
|
||||
// name field
|
||||
ImGui::InputTextWithHint("Card Name", "Main Card",
|
||||
this->name_buffer, std::size(this->name_buffer));
|
||||
|
||||
// card field
|
||||
ImGui::InputTextWithHint("Card ID", "E0040123456789AB",
|
||||
this->card_buffer,
|
||||
std::size(this->card_buffer),
|
||||
ImGuiInputTextFlags_CharsHexadecimal
|
||||
| ImGuiInputTextFlags_CharsUppercase);
|
||||
|
||||
// add card button
|
||||
if (strlen(this->card_buffer) == 16) {
|
||||
if (ImGui::Button("Add Card", ImVec2(-1.f, 0.f))) {
|
||||
|
||||
// save entry
|
||||
CardEntry entry {
|
||||
.name = this->name_buffer,
|
||||
.id = this->card_buffer
|
||||
};
|
||||
this->cards.emplace_back(entry);
|
||||
this->config_dirty = true;
|
||||
|
||||
// clear input fields
|
||||
memset(this->name_buffer, 0, sizeof(this->name_buffer));
|
||||
memset(this->card_buffer, 0, sizeof(this->card_buffer));
|
||||
}
|
||||
} else {
|
||||
ImGui::Text("Enter card identifier...");
|
||||
}
|
||||
|
||||
// cards area
|
||||
ImGui::Separator();
|
||||
if (ImGui::BeginChild("cards", ImVec2(0, window_size.y - 128))) {
|
||||
for (auto &card : this->cards) {
|
||||
|
||||
// get card name
|
||||
std::string card_name = card.name;
|
||||
if (card.name.size() > 0) {
|
||||
card_name += " - ";
|
||||
}
|
||||
card_name += card.id;
|
||||
|
||||
// draw entry
|
||||
ImGui::PushID(&card);
|
||||
if (ImGui::Selectable(card_name.c_str(), card.selected)) {
|
||||
|
||||
// unselect other cards
|
||||
for (auto &card_disable : this->cards) {
|
||||
card_disable.selected = false;
|
||||
}
|
||||
|
||||
// mark this card as the selected one
|
||||
card.selected = true;
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
// insert P1 button
|
||||
if (ImGui::Button("Insert P1")) {
|
||||
auto card = this->cards_get_selected();
|
||||
uint8_t card_bin[8];
|
||||
if (card && card->id.length() == 16 && hex2bin(card->id.c_str(), card_bin)) {
|
||||
eamuse_card_insert(0, card_bin);
|
||||
}
|
||||
}
|
||||
|
||||
// insert P2 button
|
||||
if (eamuse_get_game_keypads() > 1) {
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Insert P2")) {
|
||||
auto card = this->cards_get_selected();
|
||||
uint8_t card_bin[8];
|
||||
if (card && card->id.length() == 16 && hex2bin(card->id.c_str(), card_bin)) {
|
||||
eamuse_card_insert(1, card_bin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// save button
|
||||
if (this->config_dirty) {
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Save")) {
|
||||
this->config_save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CardEntry *CardManager::cards_get_selected() {
|
||||
|
||||
// iterate cards
|
||||
for (auto &card : this->cards) {
|
||||
|
||||
// check if selected and return pointer
|
||||
if (card.selected) {
|
||||
return &card;
|
||||
}
|
||||
}
|
||||
|
||||
// no card selected
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CardManager::config_load() {
|
||||
log_info("cardmanager", "loading config");
|
||||
|
||||
// clear cards
|
||||
this->cards.clear();
|
||||
|
||||
// read config file
|
||||
std::string config = fileutils::text_read(this->config_path);
|
||||
if (!config.empty()) {
|
||||
|
||||
// parse document
|
||||
Document doc;
|
||||
doc.Parse(config.c_str());
|
||||
|
||||
// check parse error
|
||||
auto error = doc.GetParseError();
|
||||
if (error) {
|
||||
log_warning("cardmanager", "config parse error: {}", error);
|
||||
}
|
||||
|
||||
// verify root is a dict
|
||||
if (doc.IsObject()) {
|
||||
|
||||
// find pages
|
||||
auto pages = doc.FindMember("pages");
|
||||
if (pages != doc.MemberEnd() && pages->value.IsArray()) {
|
||||
|
||||
// iterate pages
|
||||
for (auto &page : pages->value.GetArray()) {
|
||||
if (page.IsObject()) {
|
||||
|
||||
// get cards
|
||||
auto cards = page.FindMember("cards");
|
||||
if (cards != doc.MemberEnd() && cards->value.IsArray()) {
|
||||
|
||||
// iterate cards
|
||||
for (auto &card : cards->value.GetArray()) {
|
||||
if (card.IsObject()) {
|
||||
|
||||
// find attributes
|
||||
auto name = card.FindMember("name");
|
||||
if (name == doc.MemberEnd() || !name->value.IsString()) {
|
||||
log_warning("cardmanager", "card name not found");
|
||||
continue;
|
||||
}
|
||||
auto id = card.FindMember("id");
|
||||
if (id == doc.MemberEnd() || !id->value.IsString()) {
|
||||
log_warning("cardmanager", "card id not found");
|
||||
continue;
|
||||
}
|
||||
|
||||
// save entry
|
||||
CardEntry entry {
|
||||
.name = name->value.GetString(),
|
||||
.id = id->value.GetString()
|
||||
};
|
||||
this->cards.emplace_back(entry);
|
||||
|
||||
} else {
|
||||
log_warning("cardmanager", "card is not an object");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log_warning("cardmanager", "cards not found or not an array");
|
||||
}
|
||||
} else {
|
||||
log_warning("cardmanager", "page is not an object");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log_warning("cardmanager", "pages not found or not an array");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CardManager::config_save() {
|
||||
log_info("cardmanager", "saving config");
|
||||
|
||||
// create document
|
||||
Document doc;
|
||||
doc.Parse(
|
||||
"{"
|
||||
" \"pages\": ["
|
||||
" {"
|
||||
" \"cards\": ["
|
||||
" ]"
|
||||
" }"
|
||||
" ]"
|
||||
"}"
|
||||
);
|
||||
|
||||
// check parse error
|
||||
auto error = doc.GetParseError();
|
||||
if (error) {
|
||||
log_warning("cardmanager", "template parse error: {}", error);
|
||||
}
|
||||
|
||||
// add cards
|
||||
auto &cards = doc["pages"][0]["cards"];
|
||||
for (auto &entry : this->cards) {
|
||||
Value card(kObjectType);
|
||||
card.AddMember("name", StringRef(entry.name.c_str()), doc.GetAllocator());
|
||||
card.AddMember("id", StringRef(entry.id.c_str()), doc.GetAllocator());
|
||||
cards.PushBack(card, doc.GetAllocator());
|
||||
}
|
||||
|
||||
// build JSON
|
||||
StringBuffer buffer;
|
||||
Writer<StringBuffer> writer(buffer);
|
||||
doc.Accept(writer);
|
||||
|
||||
// save to file
|
||||
if (fileutils::text_write(this->config_path, buffer.GetString())) {
|
||||
this->config_dirty = false;
|
||||
} else {
|
||||
log_warning("cardmanager", "unable to save config file to {}", this->config_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "overlay/window.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
struct CardEntry {
|
||||
std::string name = "unnamed";
|
||||
std::string id = "E004000000000000";
|
||||
bool selected = false;
|
||||
};
|
||||
|
||||
class CardManager : public Window {
|
||||
public:
|
||||
|
||||
CardManager(SpiceOverlay *overlay);
|
||||
~CardManager() override;
|
||||
|
||||
void build_content() override;
|
||||
|
||||
private:
|
||||
|
||||
std::string config_path;
|
||||
bool config_dirty = false;
|
||||
std::vector<CardEntry> cards;
|
||||
char name_buffer[65] {};
|
||||
char card_buffer[17] {};
|
||||
|
||||
CardEntry *cards_get_selected();
|
||||
void config_load();
|
||||
void config_save();
|
||||
};
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,76 @@
|
||||
#pragma once
|
||||
|
||||
#include "cfg/game.h"
|
||||
#include "overlay/window.h"
|
||||
#include "rawinput/device.h"
|
||||
#include "external/imgui/imgui_filebrowser.h"
|
||||
#include "patch_manager.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
class Config : public Window {
|
||||
private:
|
||||
|
||||
// game selection
|
||||
int games_selected = -1;
|
||||
std::string games_selected_name = "";
|
||||
std::vector<Game> games_list;
|
||||
std::vector<const char *> games_names;
|
||||
|
||||
// buttons tab
|
||||
int buttons_page = 0;
|
||||
bool buttons_keyboard_state[0xFF];
|
||||
bool buttons_bind_active = false;
|
||||
bool buttons_many_active = false;
|
||||
bool buttons_many_naive = false;
|
||||
int buttons_many_delay = 0;
|
||||
int buttons_many_index = -1;
|
||||
|
||||
// analogs tab
|
||||
std::vector<rawinput::Device *> analogs_devices;
|
||||
int analogs_devices_selected = -1;
|
||||
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;
|
||||
|
||||
// keypads tab
|
||||
int keypads_selected[2] {};
|
||||
char keypads_card_path[2][1024] {};
|
||||
std::thread *keypads_card_select = nullptr;
|
||||
bool keypads_card_select_done = false;
|
||||
ImGui::FileBrowser keypads_card_select_browser[2];
|
||||
char keypads_card_number[2][18] {};
|
||||
|
||||
// patches tab
|
||||
std::unique_ptr<PatchManager> patch_manager;
|
||||
|
||||
// options tab
|
||||
bool options_show_hidden = false;
|
||||
bool options_dirty = false;
|
||||
int options_category = 0;
|
||||
|
||||
public:
|
||||
Config(SpiceOverlay *overlay);
|
||||
~Config() override;
|
||||
|
||||
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 build_lights(const std::string &name, std::vector<Light> *lights);
|
||||
void build_cards();
|
||||
void build_options(std::vector<Option> *options, const std::string &category);
|
||||
void build_about();
|
||||
void build_licenses();
|
||||
void build_launcher();
|
||||
|
||||
static void build_page_selector(int *page);
|
||||
static void vertical_align_text_column();
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,983 @@
|
||||
#include <winsock2.h>
|
||||
|
||||
#include "control.h"
|
||||
|
||||
#include <csignal>
|
||||
|
||||
#include <psapi.h>
|
||||
|
||||
#include "acio/acio.h"
|
||||
#include "api/controller.h"
|
||||
#include "avs/core.h"
|
||||
#include "avs/ea3.h"
|
||||
#include "avs/game.h"
|
||||
#include "build/resource.h"
|
||||
#include "cfg/analog.h"
|
||||
#include "cfg/button.h"
|
||||
#include "external/imgui/imgui_memory_editor.h"
|
||||
#include "games/io.h"
|
||||
#include "games/iidx/io.h"
|
||||
#include "games/shared/lcdhandle.h"
|
||||
#include "hooks/graphics/graphics.h"
|
||||
#include "launcher/launcher.h"
|
||||
#include "launcher/shutdown.h"
|
||||
#include "misc/eamuse.h"
|
||||
#include "rawinput/rawinput.h"
|
||||
#include "util/cpuutils.h"
|
||||
#include "util/memutils.h"
|
||||
#include "util/netutils.h"
|
||||
#include "util/libutils.h"
|
||||
#include "util/peb.h"
|
||||
#include "util/resutils.h"
|
||||
#include "util/utils.h"
|
||||
#include "touch/touch.h"
|
||||
|
||||
#include "acio_status_buffers.h"
|
||||
#include "eadev.h"
|
||||
#include "wnd_manager.h"
|
||||
#include "midi.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
Control::Control(SpiceOverlay *overlay) : Window(overlay) {
|
||||
this->title = "SpiceTools Control";
|
||||
this->flags = ImGuiWindowFlags_AlwaysAutoResize;
|
||||
this->toggle_button = games::OverlayButtons::ToggleControl;
|
||||
this->init_pos = ImVec2(10, 10);
|
||||
this->size_min.x = 300;
|
||||
}
|
||||
|
||||
Control::~Control() {
|
||||
}
|
||||
|
||||
void Control::build_content() {
|
||||
top_row_buttons();
|
||||
img_gui_view();
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
avs_info_view();
|
||||
acio_view();
|
||||
cpu_view();
|
||||
graphics_view();
|
||||
buttons_view();
|
||||
analogs_view();
|
||||
lights_view();
|
||||
cards_view();
|
||||
coin_view();
|
||||
control_view();
|
||||
api_view();
|
||||
raw_input_view();
|
||||
touch_view();
|
||||
lcd_view();
|
||||
about_view();
|
||||
ddr_timing_view();
|
||||
iidx_effectors_view();
|
||||
}
|
||||
|
||||
void Control::top_row_buttons() {
|
||||
|
||||
// memory editor button
|
||||
ImGui::SetNextItemWidth(-1.f);
|
||||
if (ImGui::Button("Memory Editor")) {
|
||||
this->memory_editor_open = true;
|
||||
}
|
||||
|
||||
// memory editor window
|
||||
if (this->memory_editor_open) {
|
||||
static MemoryEditor memory_editor = MemoryEditor();
|
||||
ImGui::SetNextWindowSize(ImVec2(600, 400), ImGuiCond_Once);
|
||||
if (ImGui::Begin("Memory Editor", &this->memory_editor_open)) {
|
||||
|
||||
// draw filter
|
||||
if (this->memory_editor_filter.Draw("Filter")) {
|
||||
memory_editor_modules.clear();
|
||||
memory_editor_names.clear();
|
||||
memory_editor_selection = -1;
|
||||
}
|
||||
|
||||
// obtain modules
|
||||
if (memory_editor_modules.empty()) {
|
||||
peb::obtain_modules(&memory_editor_modules);
|
||||
|
||||
// extract names for combobox
|
||||
for (size_t i = 0; i < memory_editor_modules.size();) {
|
||||
auto s = memory_editor_modules[i].first.c_str();
|
||||
|
||||
// check if passes filter
|
||||
if (memory_editor_filter.PassFilter(s)) {
|
||||
memory_editor_names.emplace_back(s);
|
||||
i++;
|
||||
} else {
|
||||
memory_editor_modules.erase(memory_editor_modules.begin() + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// draw combo box
|
||||
ImGui::Combo("DLL Selection",
|
||||
&memory_editor_selection,
|
||||
&memory_editor_names[0],
|
||||
static_cast<int>(memory_editor_names.size()));
|
||||
ImGui::Separator();
|
||||
if (memory_editor_selection >= 0) {
|
||||
HMODULE module = memory_editor_modules[memory_editor_selection].second;
|
||||
|
||||
// get module information
|
||||
MODULEINFO module_info{};
|
||||
if (GetModuleInformation(
|
||||
GetCurrentProcess(),
|
||||
module,
|
||||
&module_info,
|
||||
sizeof(MODULEINFO))) {
|
||||
|
||||
/*
|
||||
* unprotect memory
|
||||
* small hack: don't reset the mode since multiple pages with different modes are affected
|
||||
* they'd get overridden by the original mode of the first page
|
||||
*/
|
||||
memutils::VProtectGuard guard(
|
||||
module_info.lpBaseOfDll,
|
||||
module_info.SizeOfImage,
|
||||
PAGE_EXECUTE_READWRITE,
|
||||
false);
|
||||
|
||||
// draw memory editor
|
||||
memory_editor.DrawContents(
|
||||
module_info.lpBaseOfDll,
|
||||
module_info.SizeOfImage,
|
||||
(size_t) module_info.lpBaseOfDll);
|
||||
} else {
|
||||
ImGui::Text("Could not get module information");
|
||||
}
|
||||
} else {
|
||||
ImGui::Text("Please select a module");
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
// EA-Dev
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("EA-Dev")) {
|
||||
this->children.emplace_back(new EADevWindow(this->overlay));
|
||||
}
|
||||
|
||||
// Window Manager
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Window Manager")) {
|
||||
this->children.emplace_back(new WndManagerWindow(this->overlay));
|
||||
}
|
||||
}
|
||||
|
||||
void Control::img_gui_view() {
|
||||
if (ImGui::CollapsingHeader("ImGui")) {
|
||||
|
||||
// display size
|
||||
ImGui::Text("Display Size: %dx%d",
|
||||
static_cast<int>(ImGui::GetIO().DisplaySize.x),
|
||||
static_cast<int>(ImGui::GetIO().DisplaySize.y));
|
||||
|
||||
// metrics button
|
||||
this->metrics_open |= ImGui::Button("Metrics Window");
|
||||
if (this->metrics_open) {
|
||||
ImGui::ShowMetricsWindow(&this->metrics_open);
|
||||
}
|
||||
|
||||
// demo button
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Demo Window")) {
|
||||
this->demo_open = true;
|
||||
}
|
||||
if (this->demo_open) {
|
||||
ImGui::ShowDemoWindow(&this->demo_open);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Control::avs_info_view() {
|
||||
if (ImGui::CollapsingHeader("AVS")) {
|
||||
|
||||
// game
|
||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||
if (ImGui::TreeNode("Game")) {
|
||||
ImGui::BulletText("DLL Name: %s", avs::game::DLL_NAME.c_str());
|
||||
ImGui::BulletText("Identifier: %s", avs::game::get_identifier().c_str());
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
// core
|
||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||
if (ImGui::TreeNode("Core")) {
|
||||
ImGui::BulletText("DLL Name: %s", avs::core::DLL_NAME.c_str());
|
||||
ImGui::BulletText("Version: %s", avs::core::VERSION_STR.c_str());
|
||||
ImGui::BulletText("%s", fmt::format("Heap Size: {}{}",
|
||||
(uint64_t) avs::core::HEAP_SIZE,
|
||||
avs::core::DEFAULT_HEAP_SIZE_SET ? " (Default)" : "").c_str());
|
||||
ImGui::BulletText("Log Path: %s", avs::core::LOG_PATH.c_str());
|
||||
ImGui::BulletText("Config Path: %s", avs::core::CFG_PATH.c_str());
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
// EA3
|
||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||
if (ImGui::TreeNode("EA3")) {
|
||||
ImGui::BulletText("DLL Name: %s", avs::ea3::DLL_NAME.c_str());
|
||||
ImGui::BulletText("Version: %s", avs::ea3::VERSION_STR.c_str());
|
||||
ImGui::BulletText("Config Path: %s", avs::ea3::CFG_PATH.c_str());
|
||||
ImGui::BulletText("App Path: %s", avs::ea3::APP_PATH.c_str());
|
||||
ImGui::BulletText("Services: %s", avs::ea3::EA3_BOOT_URL.c_str());
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Control::acio_view() {
|
||||
if (ImGui::CollapsingHeader("ACIO")) {
|
||||
ImGui::Columns(4, "acio_columns");
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Name");
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("Hook");
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("Attached");
|
||||
ImGui::NextColumn();
|
||||
ImGui::NextColumn();
|
||||
ImGui::Separator();
|
||||
for (auto &module : acio::MODULES) {
|
||||
ImGui::PushID((void *) module);
|
||||
ImGui::Text("%s", module->name.c_str());
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("%s", acio::hook_mode_str(module->hook_mode));
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("%s", module->attached ? "true" : "false");
|
||||
ImGui::NextColumn();
|
||||
if (module->status_buffer && module->status_buffer_size) {
|
||||
if (ImGui::Button("Status")) {
|
||||
this->children.emplace_back(new ACIOStatusBuffers(overlay, module));
|
||||
}
|
||||
}
|
||||
ImGui::NextColumn();
|
||||
ImGui::Separator();
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::Columns(1);
|
||||
}
|
||||
}
|
||||
|
||||
void Control::cpu_view() {
|
||||
auto cpu_load_values = cpuutils::get_load();
|
||||
if (cpu_load_values.size() && ImGui::CollapsingHeader("CPU")) {
|
||||
|
||||
// print detected cores
|
||||
ImGui::BulletText("Detected cores: %i", (int) std::thread::hardware_concurrency());
|
||||
|
||||
// make sure the temporary buffer has enough space
|
||||
while (this->cpu_values.size() < cpu_load_values.size()) {
|
||||
this->cpu_values.emplace_back(0.f);
|
||||
}
|
||||
|
||||
// iterate cores
|
||||
for (size_t cpu = 0; cpu < cpu_load_values.size(); cpu++) {
|
||||
|
||||
// update average
|
||||
auto avg_load = MIN(MAX(this->cpu_values[cpu] +
|
||||
(cpu_load_values[cpu] - this->cpu_values[cpu]) * ImGui::GetIO().DeltaTime, 0), 100);
|
||||
this->cpu_values[cpu] = avg_load;
|
||||
|
||||
// draw content
|
||||
ImGui::BulletText("CPU #%i:", (int) cpu + 1);
|
||||
ImGui::SameLine();
|
||||
ImGui::ProgressBar(avg_load * 0.01f, ImVec2(64, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Control::graphics_view() {
|
||||
if (ImGui::CollapsingHeader("Graphics")) {
|
||||
|
||||
// screenshot button
|
||||
if (ImGui::Button("Take Screenshot")) {
|
||||
graphics_screenshot_trigger();
|
||||
}
|
||||
|
||||
// graphics information
|
||||
ImGui::BulletText("D3D9 Adapter ID: %lu",
|
||||
overlay->adapter_identifier.DeviceId);
|
||||
ImGui::BulletText("D3D9 Adapter Name: %s",
|
||||
overlay->adapter_identifier.DeviceName);
|
||||
ImGui::BulletText("D3D9 Adapter Revision: %lu",
|
||||
overlay->adapter_identifier.Revision);
|
||||
ImGui::BulletText("D3D9 Adapter SubSys ID: %lu",
|
||||
overlay->adapter_identifier.SubSysId);
|
||||
ImGui::BulletText("D3D9 Adapter Vendor ID: %lu",
|
||||
overlay->adapter_identifier.VendorId);
|
||||
ImGui::BulletText("D3D9 Adapter WQHL Level: %lu",
|
||||
overlay->adapter_identifier.WHQLLevel);
|
||||
ImGui::BulletText("D3D9 Adapter Driver: %s",
|
||||
overlay->adapter_identifier.Driver);
|
||||
ImGui::BulletText("%s", fmt::format("D3D9 Adapter Driver Version: {}",
|
||||
overlay->adapter_identifier.DriverVersion.QuadPart).c_str());
|
||||
ImGui::BulletText("D3D9 Adapter Description: %s",
|
||||
overlay->adapter_identifier.Description);
|
||||
ImGui::BulletText("D3D9 Adapter GUID: %s",
|
||||
guid2s(overlay->adapter_identifier.DeviceIdentifier).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void Control::buttons_view() {
|
||||
auto buttons = games::get_buttons(eamuse_get_game());
|
||||
if (buttons && !buttons->empty() && ImGui::CollapsingHeader("Buttons")) {
|
||||
|
||||
// print each button state
|
||||
for (auto &button : *buttons) {
|
||||
|
||||
// state
|
||||
float state = GameAPI::Buttons::getVelocity(RI_MGR, button);
|
||||
ImGui::ProgressBar(state, ImVec2(32.f, 0));
|
||||
|
||||
// mouse down handler
|
||||
if (ImGui::IsItemHovered()) {
|
||||
if (ImGui::IsAnyMouseDown()) {
|
||||
button.override_state = GameAPI::Buttons::BUTTON_PRESSED;
|
||||
button.override_velocity = 1.f;
|
||||
button.override_enabled = true;
|
||||
} else {
|
||||
button.override_enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// mark overridden items
|
||||
if (button.override_enabled) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 0.f, 1.f));
|
||||
}
|
||||
|
||||
// text
|
||||
ImGui::SameLine(0.f, ImGui::GetStyle().ItemInnerSpacing.x);
|
||||
if (RI_MGR && button.isSet()) {
|
||||
ImGui::Text("%s [%s]",
|
||||
button.getName().c_str(),
|
||||
button.getDisplayString(RI_MGR.get()).c_str());
|
||||
} else {
|
||||
ImGui::Text("%s", button.getName().c_str());
|
||||
}
|
||||
|
||||
// pop override color
|
||||
if (button.override_enabled) {
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Control::analogs_view() {
|
||||
auto analogs = games::get_analogs(eamuse_get_game());
|
||||
if (analogs && !analogs->empty() && ImGui::CollapsingHeader("Analogs")) {
|
||||
|
||||
// print each button state
|
||||
for (auto &analog : *analogs) {
|
||||
|
||||
// state
|
||||
float state = GameAPI::Analogs::getState(RI_MGR, analog);
|
||||
ImGui::ProgressBar(state, ImVec2(32.f, 0));
|
||||
|
||||
// mouse down handler
|
||||
if (ImGui::IsItemHovered()) {
|
||||
if (ImGui::IsAnyMouseDown()) {
|
||||
analog.override_state = 1.f;
|
||||
analog.override_enabled = true;
|
||||
} else {
|
||||
analog.override_enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// mark overridden items
|
||||
if (analog.override_enabled) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 0.f, 1.f));
|
||||
}
|
||||
|
||||
// text
|
||||
ImGui::SameLine(0.f, ImGui::GetStyle().ItemInnerSpacing.x);
|
||||
if (RI_MGR && analog.isSet()) {
|
||||
ImGui::Text("%s [%s]",
|
||||
analog.getName().c_str(),
|
||||
analog.getDisplayString(RI_MGR.get()).c_str());
|
||||
} else {
|
||||
ImGui::Text("%s", analog.getName().c_str());
|
||||
}
|
||||
|
||||
// pop override color
|
||||
if (analog.override_enabled) {
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Control::lights_view() {
|
||||
auto lights = games::get_lights(eamuse_get_game());
|
||||
if (lights && !lights->empty() && ImGui::CollapsingHeader("Lights")) {
|
||||
|
||||
// print each button state
|
||||
for (auto &light : *lights) {
|
||||
|
||||
// state
|
||||
float state = GameAPI::Lights::readLight(RI_MGR, light);
|
||||
ImGui::ProgressBar(state, ImVec2(32.f, 0));
|
||||
|
||||
// mouse down handler
|
||||
if (ImGui::IsItemHovered()) {
|
||||
if (ImGui::IsAnyMouseDown()) {
|
||||
light.override_state = 1.f;
|
||||
light.override_enabled = true;
|
||||
} else {
|
||||
light.override_enabled = false;
|
||||
}
|
||||
GameAPI::Lights::writeLight(RI_MGR, light, light.last_state);
|
||||
RI_MGR->devices_flush_output();
|
||||
}
|
||||
|
||||
// mark overridden items
|
||||
if (light.override_enabled) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 0.f, 1.f));
|
||||
}
|
||||
|
||||
// text
|
||||
ImGui::SameLine(0.f, ImGui::GetStyle().ItemInnerSpacing.x);
|
||||
if (RI_MGR && light.isSet()) {
|
||||
ImGui::Text("%s [%s]",
|
||||
light.getName().c_str(),
|
||||
light.getDisplayString(RI_MGR.get()).c_str());
|
||||
} else {
|
||||
ImGui::Text("%s", light.getName().c_str());
|
||||
}
|
||||
|
||||
// pop override color
|
||||
if (light.override_enabled) {
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Control::cards_view() {
|
||||
if (ImGui::CollapsingHeader("Cards")) {
|
||||
ImGui::InputTextWithHint("Card ID", "E0040123456789AB",
|
||||
this->card_input,
|
||||
std::size(this->card_input),
|
||||
ImGuiInputTextFlags_CharsHexadecimal
|
||||
| ImGuiInputTextFlags_CharsUppercase);
|
||||
if (strlen(this->card_input) < 16) {
|
||||
ImGui::Text("Please enter your card identifier...");
|
||||
} else {
|
||||
if (ImGui::Button("Insert P1")) {
|
||||
uint8_t card_data[8];
|
||||
if (hex2bin(this->card_input, card_data)) {
|
||||
eamuse_card_insert(0, card_data);
|
||||
}
|
||||
}
|
||||
if (eamuse_get_game_keypads() > 1) {
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Insert P2")) {
|
||||
uint8_t card_data[8];
|
||||
if (hex2bin(this->card_input, card_data)) {
|
||||
eamuse_card_insert(1, card_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Control::coin_view() {
|
||||
if (ImGui::CollapsingHeader("Coins")) {
|
||||
auto coinstock = eamuse_coin_get_stock();
|
||||
ImGui::Text("Blocker: %s", eamuse_coin_get_block() ? "closed" : "open");
|
||||
ImGui::Text("Coinstock: %i", coinstock);
|
||||
ImGui::Separator();
|
||||
if (ImGui::Button("Add Coin")) {
|
||||
eamuse_coin_add();
|
||||
}
|
||||
if (coinstock != 0) {
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Consume")) {
|
||||
eamuse_coin_consume_stock();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Control::control_view() {
|
||||
if (ImGui::CollapsingHeader("Control")) {
|
||||
|
||||
// launcher utils
|
||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||
if (ImGui::TreeNode("Launcher Utils")) {
|
||||
if (ImGui::Button("Restart")) {
|
||||
launcher::restart();
|
||||
}
|
||||
if (ImGui::Button("Terminate")) {
|
||||
launcher::shutdown(0);
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
// signal triggers
|
||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||
if (ImGui::TreeNode("Signal Triggers")) {
|
||||
if (ImGui::Button("Raise SIGABRT")) {
|
||||
::raise(SIGABRT);
|
||||
}
|
||||
if (ImGui::Button("Raise SIGFPE")) {
|
||||
::raise(SIGFPE);
|
||||
}
|
||||
if (ImGui::Button("Raise SIGILL")) {
|
||||
::raise(SIGILL);
|
||||
}
|
||||
if (ImGui::Button("Raise SIGINT")) {
|
||||
::raise(SIGINT);
|
||||
}
|
||||
if (ImGui::Button("Raise SIGSEGV")) {
|
||||
::raise(SIGSEGV);
|
||||
}
|
||||
if (ImGui::Button("Raise SIGTERM")) {
|
||||
::raise(SIGTERM);
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Control::api_view() {
|
||||
if (API_CONTROLLER != nullptr && ImGui::CollapsingHeader("API")) {
|
||||
std::vector<api::ClientState> client_states;
|
||||
API_CONTROLLER->obtain_client_states(&client_states);
|
||||
|
||||
// show ip addresses
|
||||
auto ip_addresses = netutils::get_local_addresses();
|
||||
if (!ip_addresses.empty()) {
|
||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||
if (ImGui::TreeNode("Local IP-Addresses")) {
|
||||
for (auto &adr : ip_addresses) {
|
||||
ImGui::BulletText("%s", adr.c_str());
|
||||
}
|
||||
ImGui::TreePop();
|
||||
ImGui::Separator();
|
||||
}
|
||||
}
|
||||
|
||||
// client count
|
||||
ImGui::Text("Connected clients: %u", (unsigned int) client_states.size());
|
||||
|
||||
// iterate clients
|
||||
for (auto &client : client_states) {
|
||||
auto address = API_CONTROLLER->get_ip_address(client.address);
|
||||
if (ImGui::TreeNode(("Client @ " + address).c_str())) {
|
||||
if (client.password.empty()) {
|
||||
ImGui::Text("No password set.");
|
||||
} else {
|
||||
ImGui::Text("Password set.");
|
||||
}
|
||||
if (ImGui::TreeNode("Modules")) {
|
||||
for (auto &module : client.modules) {
|
||||
if (ImGui::TreeNode(module->name.c_str())) {
|
||||
ImGui::Text("Password force: %i", module->password_force);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Control::raw_input_view() {
|
||||
if (RI_MGR != nullptr && ImGui::CollapsingHeader("RawInput")) {
|
||||
|
||||
// midi control
|
||||
if (ImGui::Button("MIDI-Control")) {
|
||||
this->children.push_back(new MIDIWindow(this->overlay));
|
||||
}
|
||||
|
||||
// device count
|
||||
auto devices = RI_MGR->devices_get();
|
||||
ImGui::Text("Devices detected: %u", (unsigned int) devices.size());
|
||||
|
||||
// iterate devices
|
||||
for (auto &device : devices) {
|
||||
if (ImGui::TreeNode(("#" + to_string(device.id) + ": " + device.desc).c_str())) {
|
||||
ImGui::Text("GUID: %s", device.info.guid_str.c_str());
|
||||
ImGui::Text("Output: %i", device.output_enabled);
|
||||
if (device.input_hz > 0 || device.input_hz_max > 0) {
|
||||
ImGui::Text("Input rate (cur): %.2fHz", device.input_hz);
|
||||
ImGui::Text("Input rate (max): %.2fHz", device.input_hz_max);
|
||||
}
|
||||
switch (device.type) {
|
||||
case rawinput::MOUSE: {
|
||||
auto mouse = device.mouseInfo;
|
||||
ImGui::Text("Type: Mouse");
|
||||
ImGui::Text("X: %ld", mouse->pos_x);
|
||||
ImGui::Text("Y: %ld", mouse->pos_y);
|
||||
ImGui::Text("Wheel: %ld", mouse->pos_wheel);
|
||||
|
||||
// keys
|
||||
std::stringstream keys;
|
||||
keys << "[";
|
||||
for (auto key : mouse->key_states) {
|
||||
keys << (key ? "1," : "0,");
|
||||
}
|
||||
keys << "]";
|
||||
ImGui::Text("Keys: %s", keys.str().c_str());
|
||||
|
||||
break;
|
||||
}
|
||||
case rawinput::KEYBOARD: {
|
||||
auto keyboard = device.keyboardInfo;
|
||||
ImGui::Text("Type: Keyboard");
|
||||
|
||||
// keys
|
||||
std::stringstream keys;
|
||||
keys << "[";
|
||||
for (size_t i = 0; i < std::size(keyboard->key_states); i++) {
|
||||
if (keyboard->key_states[i]) {
|
||||
keys << i << ",";
|
||||
}
|
||||
}
|
||||
keys << "]";
|
||||
ImGui::Text("Keys: %s", keys.str().c_str());
|
||||
|
||||
break;
|
||||
}
|
||||
case rawinput::HID: {
|
||||
auto hid = device.hidInfo;
|
||||
ImGui::Text("Type: HID");
|
||||
ImGui::Text("VID: %04X", hid->attributes.VendorID);
|
||||
ImGui::Text("PID: %04X", hid->attributes.ProductID);
|
||||
ImGui::Text("VER: %i", hid->attributes.VersionNumber);
|
||||
switch (hid->driver) {
|
||||
case rawinput::HIDDriver::PacDrive:
|
||||
ImGui::Text("Driver: PacDrive");
|
||||
break;
|
||||
default:
|
||||
ImGui::Text("Driver: Default");
|
||||
break;
|
||||
}
|
||||
|
||||
// button states
|
||||
if (!hid->button_states.empty() && ImGui::TreeNode("Button States")) {
|
||||
size_t button_cap_name = 0;
|
||||
for (auto state_list : hid->button_states) {
|
||||
for (auto state : state_list) {
|
||||
ImGui::Text("%s: %i",
|
||||
hid->button_caps_names[button_cap_name++].c_str(),
|
||||
state ? 1 : 0);
|
||||
}
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
// button output states
|
||||
if (!hid->button_output_states.empty() && ImGui::TreeNode("Button Output States")) {
|
||||
size_t button_output_cap_name = 0;
|
||||
for (auto state_list : hid->button_output_states) {
|
||||
for (auto state : state_list) {
|
||||
ImGui::Text("%s: %i",
|
||||
hid->button_output_caps_names[button_output_cap_name++].c_str(),
|
||||
state ? 1 : 0);
|
||||
}
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
// analog states
|
||||
if (!hid->value_states.empty() && ImGui::TreeNode("Analog States")) {
|
||||
size_t value_cap_name = 0;
|
||||
for (auto analog_state : hid->value_states) {
|
||||
ImGui::Text("%s: %.2f",
|
||||
hid->value_caps_names[value_cap_name++].c_str(),
|
||||
analog_state);
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
// analog output states
|
||||
if (!hid->value_output_states.empty() && ImGui::TreeNode("Analog Output States")) {
|
||||
size_t value_output_cap_name = 0;
|
||||
for (auto analog_state : hid->value_output_states) {
|
||||
ImGui::Text("%s: %.2f",
|
||||
hid->value_output_caps_names[value_output_cap_name++].c_str(),
|
||||
analog_state);
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case rawinput::MIDI: {
|
||||
ImGui::Text("Type: MIDI");
|
||||
break;
|
||||
}
|
||||
case rawinput::SEXTET_OUTPUT: {
|
||||
ImGui::Text("Type: Sextet");
|
||||
break;
|
||||
}
|
||||
case rawinput::PIUIO_DEVICE: {
|
||||
ImGui::Text("Type: PIUIO");
|
||||
break;
|
||||
}
|
||||
case rawinput::DESTROYED: {
|
||||
ImGui::Text("Disconnected.");
|
||||
break;
|
||||
}
|
||||
case rawinput::UNKNOWN:
|
||||
default:
|
||||
ImGui::Text("Type: Unknown");
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Control::touch_view() {
|
||||
if (ImGui::CollapsingHeader("Touch")) {
|
||||
|
||||
// status
|
||||
ImGui::Text("Status: %s", is_touch_available() ? "available" : "unavailable");
|
||||
|
||||
// touch points
|
||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||
if (ImGui::TreeNode("Touch Points")) {
|
||||
|
||||
// get touch points
|
||||
std::vector<TouchPoint> touch_points;
|
||||
touch_get_points(touch_points);
|
||||
for (auto &tp : touch_points) {
|
||||
|
||||
// draw touch point
|
||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||
if (ImGui::TreeNode((void *) (size_t) tp.id, "TP #%lu", tp.id)) {
|
||||
ImGui::Text("X: %ld", tp.x);
|
||||
ImGui::Text("Y: %ld", tp.y);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Control::lcd_view() {
|
||||
if (games::shared::LCD_ENABLED && ImGui::CollapsingHeader("LCD")) {
|
||||
ImGui::Text("Enabled: %s", games::shared::LCD_ENABLED ? "true" : "false");
|
||||
ImGui::Text("CSM: %s", games::shared::LCD_CSM.c_str());
|
||||
ImGui::Text("BRI: %i", games::shared::LCD_BRI);
|
||||
ImGui::Text("CON: %i", games::shared::LCD_CON);
|
||||
ImGui::Text("RED: %i", games::shared::LCD_RED);
|
||||
ImGui::Text("GREEN: %i", games::shared::LCD_GREEN);
|
||||
ImGui::Text("BLUE: %i", games::shared::LCD_BLUE);
|
||||
ImGui::Text("BL: %i", games::shared::LCD_BL);
|
||||
}
|
||||
}
|
||||
|
||||
void Control::about_view() {
|
||||
if (ImGui::CollapsingHeader("About")) {
|
||||
if (ImGui::TreeNode("Changelog")) {
|
||||
ImGui::Separator();
|
||||
if (ImGui::BeginChild("changelog", ImVec2(400, 400))) {
|
||||
ImGui::TextUnformatted(resutil::load_file_string(IDR_CHANGELOG).c_str());
|
||||
}
|
||||
ImGui::EndChild();
|
||||
}
|
||||
if (ImGui::TreeNode("Licenses")) {
|
||||
ImGui::Separator();
|
||||
if (ImGui::BeginChild("changelog", ImVec2(400, 400), false,
|
||||
ImGuiWindowFlags_HorizontalScrollbar
|
||||
| ImGuiWindowFlags_AlwaysHorizontalScrollbar)) {
|
||||
ImGui::TextUnformatted(resutil::load_file_string(IDR_LICENSES).c_str());
|
||||
}
|
||||
ImGui::EndChild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Control::ddr_timing_view() {
|
||||
if (avs::game::is_model("MDX") && ImGui::CollapsingHeader("DDR Timing")) {
|
||||
|
||||
// patches
|
||||
struct ddr_patch {
|
||||
const char *ext;
|
||||
const char *name;
|
||||
const char *format;
|
||||
int min;
|
||||
int max;
|
||||
size_t offset;
|
||||
intptr_t offset_ptr = 0;
|
||||
};
|
||||
|
||||
static struct ddr_patch PATCHES[] = {
|
||||
|
||||
// patches for MDX-001-2019042200
|
||||
{ "2019042200", "Sound Offset", "%d ms", 0, 1000, 0x1CCC5 },
|
||||
{ "2019042200", "Render Offset", "%d ms", 0, 1000, 0x1CD0A },
|
||||
{ "2019042200", "Input Offset", "%d ms", 0, 1000, 0x1CCE5 },
|
||||
{ "2019042200", "Bomb Offset", "%d frames", 0, 10, 0x1CCC0 },
|
||||
{ "2019042200", "SSQ Offset", "%d ms", -1000, 1000, 0x1CCCA },
|
||||
{ "2019042200", "Cabinet Type", "%d", 0, 6, 0x1CDAE },
|
||||
};
|
||||
|
||||
// check if patches available
|
||||
bool patches_available = false;
|
||||
for (auto &patch : PATCHES) {
|
||||
if (avs::game::is_ext(patch.ext)) {
|
||||
patches_available = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// show message if no patches available
|
||||
if (!patches_available) {
|
||||
ImGui::Text("No offsets known for this version.");
|
||||
} else {
|
||||
|
||||
// iterate patches
|
||||
for (auto &patch : PATCHES) {
|
||||
if (avs::game::is_ext(patch.ext)) {
|
||||
|
||||
// check if pointer is uninitialized
|
||||
if (patch.offset_ptr == 0) {
|
||||
|
||||
// get module information
|
||||
auto dll_path = MODULE_PATH / "gamemdx.dll";
|
||||
|
||||
// get dll_module
|
||||
auto dll_module = libutils::try_module(dll_path);
|
||||
if (!dll_module) {
|
||||
// no fatal error, might just not be loaded yet
|
||||
break;
|
||||
}
|
||||
|
||||
// get module information
|
||||
MODULEINFO dll_module_info {};
|
||||
if (GetModuleInformation(
|
||||
GetCurrentProcess(),
|
||||
dll_module,
|
||||
&dll_module_info,
|
||||
sizeof(MODULEINFO)))
|
||||
{
|
||||
// convert offset to RVA
|
||||
auto rva = libutils::offset2rva(dll_path, patch.offset);
|
||||
if (rva && rva != ~0) {
|
||||
|
||||
// get data pointer
|
||||
patch.offset_ptr = reinterpret_cast<intptr_t>(dll_module_info.lpBaseOfDll) + rva;
|
||||
} else {
|
||||
|
||||
// invalidate
|
||||
patch.offset_ptr = -1;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// invalidate
|
||||
patch.offset_ptr = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// check if pointer is valid
|
||||
if (patch.offset_ptr != -1) {
|
||||
auto *value_ptr = reinterpret_cast<uint16_t *>(patch.offset_ptr);
|
||||
|
||||
// draw drag widget
|
||||
int value = *value_ptr;
|
||||
ImGui::DragInt(patch.name, &value, 0.2f, patch.min, patch.max, patch.format);
|
||||
|
||||
// write value back
|
||||
if (value != *value_ptr) {
|
||||
memutils::VProtectGuard guard(value_ptr, sizeof(uint16_t));
|
||||
*value_ptr = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Control::iidx_effectors_view() {
|
||||
if (avs::game::is_model("LDJ") && ImGui::CollapsingHeader("IIDX Effectors")) {
|
||||
|
||||
// effector analog entries
|
||||
static const std::map<size_t, const char *> ANALOG_ENTRIES {
|
||||
{ games::iidx::Analogs::VEFX, "VEFX" },
|
||||
{ games::iidx::Analogs::LowEQ, "LoEQ" },
|
||||
{ games::iidx::Analogs::HiEQ, "HiEQ" },
|
||||
{ games::iidx::Analogs::Filter, "Flt" },
|
||||
{ games::iidx::Analogs::PlayVolume, "Vol" },
|
||||
};
|
||||
|
||||
// iterate analogs
|
||||
float hue = 0.f;
|
||||
bool overridden = false;
|
||||
static auto analogs = games::get_analogs(eamuse_get_game());
|
||||
for (auto &[index, name] : ANALOG_ENTRIES) {
|
||||
|
||||
// safety check
|
||||
if (index >= analogs->size()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// get analog
|
||||
auto &analog = (*analogs)[index];
|
||||
overridden |= analog.override_enabled;
|
||||
|
||||
// push id and style
|
||||
ImGui::PushID((void *) name);
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, (ImVec4) ImColor::HSV(hue, 0.5f, 0.5f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, (ImVec4) ImColor::HSV(hue, 0.6f, 0.5f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, (ImVec4) ImColor::HSV(hue, 0.7f, 0.5f));
|
||||
ImGui::PushStyleColor(ImGuiCol_SliderGrab, (ImVec4) ImColor::HSV(hue, 0.9f, 0.9f));
|
||||
if (analog.override_enabled) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.f, 1.f, 0.f, 1.f));
|
||||
} else {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.8f, 0.8f, 1.f));
|
||||
}
|
||||
|
||||
// vertical slider
|
||||
auto new_state = analog.override_enabled ? analog.override_state
|
||||
: GameAPI::Analogs::getState(RI_MGR, analog);
|
||||
if (hue > 0.f) {
|
||||
ImGui::SameLine();
|
||||
}
|
||||
ImGui::VSliderFloat("##v", ImVec2(32, 160), &new_state, 0.f, 1.f, name);
|
||||
if (new_state != analog.override_state) {
|
||||
analog.override_state = new_state;
|
||||
analog.override_enabled = true;
|
||||
}
|
||||
|
||||
// pop id and style
|
||||
ImGui::PopStyleColor(5);
|
||||
ImGui::PopID();
|
||||
|
||||
// rainbow
|
||||
hue += 1.f / 7;
|
||||
}
|
||||
|
||||
// reset button
|
||||
if (overridden) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.f, 1.f, 0.f, 1.f));
|
||||
if (ImGui::Button("Reset")) {
|
||||
for (auto &[index, name] : ANALOG_ENTRIES) {
|
||||
if (index < analogs->size()) {
|
||||
(*analogs)[index].override_enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
#include "overlay/window.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
class Control : public Window {
|
||||
public:
|
||||
|
||||
Control(SpiceOverlay *overlay);
|
||||
~Control() override;
|
||||
|
||||
void build_content() override;
|
||||
|
||||
private:
|
||||
|
||||
// state
|
||||
char card_input[17] {};
|
||||
|
||||
// other windows
|
||||
bool demo_open = false;
|
||||
bool metrics_open = false;
|
||||
std::vector<float> cpu_values;
|
||||
|
||||
// memory editor
|
||||
bool memory_editor_open = false;
|
||||
int memory_editor_selection = -1;
|
||||
std::vector<std::pair<std::string, HMODULE>> memory_editor_modules;
|
||||
std::vector<const char*> memory_editor_names;
|
||||
ImGuiTextFilter memory_editor_filter;
|
||||
|
||||
// pane views
|
||||
void top_row_buttons();
|
||||
void img_gui_view();
|
||||
void avs_info_view();
|
||||
void acio_view();
|
||||
void cpu_view();
|
||||
void graphics_view();
|
||||
void buttons_view();
|
||||
void analogs_view();
|
||||
void lights_view();
|
||||
void cards_view();
|
||||
void coin_view();
|
||||
void control_view();
|
||||
void api_view();
|
||||
void raw_input_view();
|
||||
void touch_view();
|
||||
void lcd_view();
|
||||
void about_view();
|
||||
void ddr_timing_view();
|
||||
void iidx_effectors_view();
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
#include "eadev.h"
|
||||
|
||||
#include "avs/automap.h"
|
||||
#include "util/fileutils.h"
|
||||
#include "overlay/imgui/extensions.h"
|
||||
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
EADevWindow::EADevWindow(SpiceOverlay *overlay) : Window(overlay) {
|
||||
this->title = "EA-Dev";
|
||||
this->init_size = ImVec2(
|
||||
ImGui::GetIO().DisplaySize.x * 0.8f,
|
||||
ImGui::GetIO().DisplaySize.y * 0.8f);
|
||||
this->size_min = ImVec2(250, 200);
|
||||
this->init_pos = ImVec2(
|
||||
ImGui::GetIO().DisplaySize.x / 2 - this->init_size.x / 2,
|
||||
ImGui::GetIO().DisplaySize.y / 2 - this->init_size.y / 2);
|
||||
this->active = true;
|
||||
|
||||
// read existing automap contents from file
|
||||
if (avs::automap::DUMP_FILENAME.length() > 0) {
|
||||
auto contents = fileutils::text_read(avs::automap::DUMP_FILENAME);
|
||||
if (contents.length() > 0) {
|
||||
this->automap_hook(this, contents.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// add hook for receiving automap messages
|
||||
avs::automap::hook_add(automap_hook, this);
|
||||
}
|
||||
|
||||
EADevWindow::~EADevWindow() {
|
||||
avs::automap::hook_remove(automap_hook, this);
|
||||
}
|
||||
|
||||
void EADevWindow::build_content() {
|
||||
|
||||
// automap
|
||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||
if (ImGui::CollapsingHeader("Automap")) {
|
||||
|
||||
// enable checkbox
|
||||
if (ImGui::Checkbox("Enabled", &avs::automap::ENABLED)) {
|
||||
if (avs::automap::ENABLED) {
|
||||
avs::automap::enable();
|
||||
} else {
|
||||
avs::automap::disable();
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::HelpMarker("Enable this module.");
|
||||
|
||||
// dump checkbox
|
||||
ImGui::Checkbox("Dump", &avs::automap::DUMP);
|
||||
if (avs::automap::DUMP_FILENAME.length() > 0) {
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("- %s", avs::automap::DUMP_FILENAME.c_str());
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::HelpMarker("Dump all destroyed props to file.");
|
||||
|
||||
// json checkbox
|
||||
ImGui::Checkbox("JSON", &avs::automap::JSON);
|
||||
ImGui::SameLine();
|
||||
ImGui::HelpMarker("Output in JSON instead of XML.");
|
||||
|
||||
// patch checkbox
|
||||
ImGui::Checkbox("Patch", &avs::automap::PATCH);
|
||||
ImGui::SameLine();
|
||||
ImGui::HelpMarker("Try to dynamically add all non-existing nodes which are being accessed. (WIP)");
|
||||
|
||||
// network checkbox
|
||||
ImGui::Checkbox("Network Only", &avs::automap::RESTRICT_NETWORK);
|
||||
ImGui::SameLine();
|
||||
ImGui::HelpMarker("Restrict functionality to calls/responses.");
|
||||
|
||||
// autoscroll checkbox
|
||||
ImGui::Checkbox("Auto-Scroll", &this->automap_autoscroll);
|
||||
ImGui::SameLine();
|
||||
ImGui::HelpMarker("Automatically scroll to bottom.");
|
||||
|
||||
// clear button
|
||||
if (!this->automap_data.empty()) {
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Clear")) {
|
||||
this->automap_data.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// log view
|
||||
ImGui::Separator();
|
||||
ImGui::BeginChild("scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar);
|
||||
for (size_t i = 0; i < automap_data.size(); i++) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, (i % 2) == 0
|
||||
? ImVec4(1.0f, 0.7f, 0.7f, 1.f)
|
||||
: ImVec4(0.7f, 1.0f, 0.7f, 1.f));
|
||||
ImGui::TextUnformatted(automap_data[i].c_str());
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
if (this->automap_scroll_to_bottom) {
|
||||
this->automap_scroll_to_bottom = false;
|
||||
ImGui::SetScrollHereY(1.f);
|
||||
}
|
||||
ImGui::EndChild();
|
||||
}
|
||||
}
|
||||
|
||||
void EADevWindow::automap_hook(void *user, const char *data) {
|
||||
auto This = (EADevWindow*) user;
|
||||
This->automap_data.emplace_back(std::string(data));
|
||||
if (This->automap_autoscroll) {
|
||||
This->automap_scroll_to_bottom = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "overlay/window.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
class EADevWindow : public Window {
|
||||
public:
|
||||
|
||||
EADevWindow(SpiceOverlay *overlay);
|
||||
~EADevWindow() override;
|
||||
|
||||
void build_content() override;
|
||||
static void automap_hook(void *user, const char *data);
|
||||
|
||||
private:
|
||||
|
||||
bool automap_autoscroll = true;
|
||||
bool automap_scroll_to_bottom = false;
|
||||
std::vector<std::string> automap_data;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "fps.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
FPS::FPS(SpiceOverlay *overlay) : Window(overlay) {
|
||||
this->title = "FPS & Frame Time";
|
||||
this->flags = ImGuiWindowFlags_NoTitleBar
|
||||
| ImGuiWindowFlags_NoCollapse
|
||||
| ImGuiWindowFlags_NoResize
|
||||
| ImGuiWindowFlags_AlwaysAutoResize
|
||||
| ImGuiWindowFlags_NoDecoration
|
||||
| ImGuiWindowFlags_NoFocusOnAppearing
|
||||
| ImGuiWindowFlags_NoNavFocus
|
||||
| ImGuiWindowFlags_NoNavInputs;
|
||||
this->bg_alpha = 0.4f;
|
||||
}
|
||||
|
||||
const ImVec2 FPS::initial_pos() {
|
||||
return ImVec2(ImGui::GetIO().DisplaySize.x - 100, 10);
|
||||
}
|
||||
|
||||
void FPS::build_content() {
|
||||
|
||||
// frame timers
|
||||
ImGuiIO &io = ImGui::GetIO();
|
||||
ImGui::Text("FPS: %.1f", io.Framerate);
|
||||
ImGui::Text("FT: %.2fms", 1000 / io.Framerate);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "overlay/window.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
class FPS : public Window {
|
||||
public:
|
||||
|
||||
FPS(SpiceOverlay *overlay);
|
||||
|
||||
const ImVec2 initial_pos() override;
|
||||
void build_content() override;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
#undef CINTERFACE
|
||||
|
||||
#include "iidx_sub.h"
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "games/io.h"
|
||||
#include "hooks/graphics/backends/d3d9/d3d9_backend.h"
|
||||
#include "hooks/graphics/backends/d3d9/d3d9_device.h"
|
||||
#include "util/logging.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
const ImVec4 YELLOW(1.f, 1.f, 0.f, 1.f);
|
||||
const ImVec4 WHITE(1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
IIDXSubScreen::IIDXSubScreen(SpiceOverlay *overlay) : Window(overlay), device(overlay->get_device()) {
|
||||
this->draws_window = false;
|
||||
this->title = "Sub Screen";
|
||||
this->toggle_button = games::OverlayButtons::ToggleSubScreen;
|
||||
|
||||
this->texture_size = ImVec2(0, 0);
|
||||
}
|
||||
|
||||
void IIDXSubScreen::build_content() {
|
||||
this->draw_texture();
|
||||
|
||||
/*
|
||||
if (this->status_message.has_value()) {
|
||||
ImGui::TextColored(YELLOW, "%s", this->status_message.value().c_str());
|
||||
} else if (this->texture) {
|
||||
ImGui::TextColored(WHITE, "Successfully acquired surface texture");
|
||||
} else {
|
||||
ImGui::TextColored(YELLOW, "Failed to acquire surface texture");
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
bool IIDXSubScreen::build_texture(IDirect3DSurface9 *surface) {
|
||||
HRESULT hr;
|
||||
|
||||
D3DSURFACE_DESC desc {};
|
||||
hr = surface->GetDesc(&desc);
|
||||
if (FAILED(hr)) {
|
||||
this->status_message = fmt::format("Failed to get surface descriptor, hr={}", FMT_HRESULT(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = this->device->CreateTexture(desc.Width, desc.Height, 0, desc.Usage, desc.Format,
|
||||
desc.Pool, &this->texture, nullptr);
|
||||
if (FAILED(hr)) {
|
||||
this->status_message = fmt::format("Failed to create render target, hr={}", FMT_HRESULT(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
this->texture_size = ImVec2(desc.Width, desc.Height);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void IIDXSubScreen::draw_texture() {
|
||||
HRESULT hr;
|
||||
|
||||
auto surface = graphics_d3d9_ldj_get_sub_screen();
|
||||
if (surface == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->texture == nullptr) {
|
||||
if (!this->build_texture(surface)) {
|
||||
this->texture = nullptr;
|
||||
this->texture_size = ImVec2(0, 0);
|
||||
|
||||
surface->Release();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
IDirect3DSurface9 *texture_surface = nullptr;
|
||||
hr = this->texture->GetSurfaceLevel(0, &texture_surface);
|
||||
if (FAILED(hr)) {
|
||||
this->status_message = fmt::format("Failed to get texture surface, hr={}", FMT_HRESULT(hr));
|
||||
|
||||
surface->Release();
|
||||
return;
|
||||
}
|
||||
|
||||
hr = this->device->StretchRect(surface, nullptr, texture_surface, nullptr, D3DTEXF_NONE);
|
||||
if (FAILED(hr)) {
|
||||
this->status_message = fmt::format("Failed to copy back buffer contents, hr={}", FMT_HRESULT(hr));
|
||||
|
||||
surface->Release();
|
||||
texture_surface->Release();
|
||||
return;
|
||||
}
|
||||
|
||||
surface->Release();
|
||||
texture_surface->Release();
|
||||
|
||||
ImGui::GetBackgroundDrawList()->AddImage(
|
||||
reinterpret_cast<void *>(this->texture),
|
||||
ImVec2(0, 0),
|
||||
this->texture_size,
|
||||
ImVec2(0, 0),
|
||||
ImVec2(1, 1));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef SPICETOOLS_OVERLAY_WINDOWS_IIDX_SUB_H
|
||||
#define SPICETOOLS_OVERLAY_WINDOWS_IIDX_SUB_H
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include <windows.h>
|
||||
#include <d3d9.h>
|
||||
|
||||
#include "overlay/window.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
class IIDXSubScreen : public Window {
|
||||
public:
|
||||
IIDXSubScreen(SpiceOverlay *overlay);
|
||||
|
||||
void build_content() override;
|
||||
|
||||
private:
|
||||
bool build_texture(IDirect3DSurface9 *surface);
|
||||
void draw_texture();
|
||||
|
||||
std::optional<std::string> status_message = std::nullopt;
|
||||
|
||||
IDirect3DDevice9 *device = nullptr;
|
||||
IDirect3DTexture9 *texture = nullptr;
|
||||
ImVec2 texture_size;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SPICETOOLS_OVERLAY_WINDOWS_IIDX_SUB_H
|
||||
@@ -0,0 +1,94 @@
|
||||
#include <games/io.h>
|
||||
#include "keypad.h"
|
||||
|
||||
#include "misc/eamuse.h"
|
||||
#include "util/logging.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
Keypad::Keypad(SpiceOverlay *overlay, size_t unit) : Window(overlay), unit(unit) {
|
||||
this->title = "Keypad P" + to_string(unit + 1);
|
||||
this->flags = ImGuiWindowFlags_NoResize
|
||||
| ImGuiWindowFlags_NoCollapse
|
||||
| ImGuiWindowFlags_AlwaysAutoResize;
|
||||
|
||||
switch (this->unit) {
|
||||
case 0: {
|
||||
this->toggle_button = games::OverlayButtons::ToggleVirtualKeypadP1;
|
||||
this->init_pos = ImVec2(
|
||||
26,
|
||||
ImGui::GetIO().DisplaySize.y - 264);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
this->toggle_button = games::OverlayButtons::ToggleVirtualKeypadP2;
|
||||
this->init_pos = ImVec2(
|
||||
ImGui::GetIO().DisplaySize.x - 220,
|
||||
ImGui::GetIO().DisplaySize.y - 264);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Keypad::~Keypad() {
|
||||
|
||||
// reset overrides
|
||||
eamuse_set_keypad_overrides_overlay(this->unit, 0);
|
||||
}
|
||||
|
||||
void Keypad::build_content() {
|
||||
|
||||
// buttons
|
||||
static const struct {
|
||||
const char *text;
|
||||
int flag;
|
||||
} BUTTONS[] = {
|
||||
{ "7", 1 << EAM_IO_KEYPAD_7 },
|
||||
{ "8", 1 << EAM_IO_KEYPAD_8 },
|
||||
{ "9", 1 << EAM_IO_KEYPAD_9 },
|
||||
{ "4", 1 << EAM_IO_KEYPAD_4 },
|
||||
{ "5", 1 << EAM_IO_KEYPAD_5 },
|
||||
{ "6", 1 << EAM_IO_KEYPAD_6 },
|
||||
{ "1", 1 << EAM_IO_KEYPAD_1 },
|
||||
{ "2", 1 << EAM_IO_KEYPAD_2 },
|
||||
{ "3", 1 << EAM_IO_KEYPAD_3 },
|
||||
{ "0", 1 << EAM_IO_KEYPAD_0 },
|
||||
{ "00", 1 << EAM_IO_KEYPAD_00 },
|
||||
{ ".", 1 << EAM_IO_KEYPAD_DECIMAL },
|
||||
{ "Insert Card", 1 << EAM_IO_INSERT },
|
||||
};
|
||||
|
||||
// reset overrides
|
||||
eamuse_set_keypad_overrides_overlay(this->unit, 0);
|
||||
|
||||
// build grid
|
||||
for (size_t i = 0; i < std::size(BUTTONS); i++) {
|
||||
auto &button = BUTTONS[i];
|
||||
|
||||
// push id and alignment
|
||||
ImGui::PushID(4096 + i);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, ImVec2(0.5f, 0.5f));
|
||||
|
||||
// add selectable (fill last line)
|
||||
if (i == std::size(BUTTONS) - 1) {
|
||||
ImGui::Selectable(button.text, false, 0, ImVec2(112, 32));
|
||||
} else {
|
||||
ImGui::Selectable(button.text, false, 0, ImVec2(32, 32));
|
||||
}
|
||||
|
||||
// mouse down handler
|
||||
if (ImGui::IsItemHovered() && ImGui::IsAnyMouseDown()) {
|
||||
eamuse_set_keypad_overrides_overlay(this->unit, button.flag);
|
||||
}
|
||||
|
||||
// pop id and alignment
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopID();
|
||||
|
||||
// line join
|
||||
if ((i % 3) < 2) {
|
||||
ImGui::SameLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "overlay/window.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
class Keypad : public Window {
|
||||
private:
|
||||
|
||||
size_t unit = 0;
|
||||
|
||||
public:
|
||||
|
||||
Keypad(SpiceOverlay *overlay, size_t unit);
|
||||
~Keypad() override;
|
||||
|
||||
void build_content() override;
|
||||
};
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,125 @@
|
||||
#pragma once
|
||||
|
||||
#include "overlay/window.h"
|
||||
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <memory>
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
enum class HueFunc : int {
|
||||
Sine, Cosine, Absolute, Linear,
|
||||
Count
|
||||
};
|
||||
|
||||
class KFControl : public Window {
|
||||
public:
|
||||
|
||||
KFControl(SpiceOverlay *overlay);
|
||||
~KFControl() override;
|
||||
|
||||
void config_save();
|
||||
void config_load();
|
||||
ImVec4 hsv_transform(ImVec4 col,
|
||||
float hue = 0.f, float sat = 1.f, float val = 1.f);
|
||||
ImVec4 hue_shift(ImVec4 col, float amp, float per, uint64_t ms);
|
||||
|
||||
void build_content() override;
|
||||
|
||||
private:
|
||||
std::string config_path;
|
||||
int config_profile = 0;
|
||||
|
||||
std::unique_ptr<std::thread> worker;
|
||||
bool worker_running = false;
|
||||
void worker_start();
|
||||
void worker_func();
|
||||
std::mutex worker_m;
|
||||
void worker_button_check(bool state_new, bool *state_old, int scan,
|
||||
int profile_switch = -1);
|
||||
void worker_button_set(int scan, bool state);
|
||||
void worker_mouse_click(bool state);
|
||||
void worker_mouse_move(int dx, int dy);
|
||||
|
||||
int poll_delay = 1;
|
||||
float vol_deadzone = 0.003f;
|
||||
uint64_t vol_timeout = 32;
|
||||
bool vol_mouse = false;
|
||||
float vol_mouse_sensitivity = 512;
|
||||
bool start_click = false;
|
||||
bool kp_profiles = false;
|
||||
|
||||
float vol_sound = 0.f;
|
||||
float vol_headphone = 0.f;
|
||||
float vol_external = 0.f;
|
||||
float vol_woofer = 0.f;
|
||||
bool vol_mute = false;
|
||||
|
||||
char icca_file[512] = "";
|
||||
uint64_t icca_timeout = 4000;
|
||||
uint64_t coin_timeout = 250;
|
||||
|
||||
ImVec4 light_wing_left_up {};
|
||||
ImVec4 light_wing_left_low {};
|
||||
ImVec4 light_wing_right_up {};
|
||||
ImVec4 light_wing_right_low {};
|
||||
ImVec4 light_woofer {};
|
||||
ImVec4 light_controller {};
|
||||
ImVec4 light_generator {};
|
||||
|
||||
bool light_buttons = true;
|
||||
bool light_hue_preview = false;
|
||||
bool light_hue_disable = false;
|
||||
HueFunc light_hue_func = HueFunc::Sine;
|
||||
float light_wing_left_up_hue_amp = 0.f;
|
||||
float light_wing_left_up_hue_per = 1.f;
|
||||
float light_wing_left_low_hue_amp = 0.f;
|
||||
float light_wing_left_low_hue_per = 1.f;
|
||||
float light_wing_right_up_hue_amp = 0.f;
|
||||
float light_wing_right_up_hue_per = 1.f;
|
||||
float light_wing_right_low_hue_amp = 0.f;
|
||||
float light_wing_right_low_hue_per = 1.f;
|
||||
float light_woofer_hue_amp = 0.f;
|
||||
float light_woofer_hue_per = 1.f;
|
||||
float light_controller_hue_amp = 0.f;
|
||||
float light_controller_hue_per = 1.f;
|
||||
float light_generator_hue_amp = 0.f;
|
||||
float light_generator_hue_per = 1.f;
|
||||
|
||||
/*
|
||||
* Keyboard Scancodes
|
||||
* Check: http://kbdlayout.info/kbdus/overview+scancodes
|
||||
*/
|
||||
|
||||
int scan_service = 3;
|
||||
int scan_test = 4;
|
||||
int scan_coin_mech = 5;
|
||||
int scan_bt_a = 32;
|
||||
int scan_bt_b = 33;
|
||||
int scan_bt_c = 36;
|
||||
int scan_bt_d = 37;
|
||||
int scan_fx_l = 46;
|
||||
int scan_fx_r = 50;
|
||||
int scan_start = 2;
|
||||
int scan_headphone = 0;
|
||||
int scan_vol_l_left = 17;
|
||||
int scan_vol_l_right = 18;
|
||||
int scan_vol_r_left = 24;
|
||||
int scan_vol_r_right = 25;
|
||||
int scan_icca = 6;
|
||||
int scan_coin = 7;
|
||||
int scan_kp_0 = 0;
|
||||
int scan_kp_1 = 0;
|
||||
int scan_kp_2 = 0;
|
||||
int scan_kp_3 = 0;
|
||||
int scan_kp_4 = 0;
|
||||
int scan_kp_5 = 0;
|
||||
int scan_kp_6 = 0;
|
||||
int scan_kp_7 = 0;
|
||||
int scan_kp_8 = 0;
|
||||
int scan_kp_9 = 0;
|
||||
int scan_kp_00 = 0;
|
||||
int scan_kp_decimal = 0;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
#include "log.h"
|
||||
#include "util/utils.h"
|
||||
#include "util/fileutils.h"
|
||||
#include "games/io.h"
|
||||
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
Log::Log(SpiceOverlay *overlay) : Window(overlay) {
|
||||
this->title = "Log";
|
||||
this->toggle_button = games::OverlayButtons::ToggleLog;
|
||||
this->init_size = ImVec2(
|
||||
ImGui::GetIO().DisplaySize.x * 0.8f,
|
||||
ImGui::GetIO().DisplaySize.y * 0.8f);
|
||||
this->size_min = ImVec2(250, 200);
|
||||
this->init_pos = ImVec2(
|
||||
ImGui::GetIO().DisplaySize.x / 2 - this->init_size.x / 2,
|
||||
ImGui::GetIO().DisplaySize.y / 2 - this->init_size.y / 2);
|
||||
|
||||
// read existing contents from file
|
||||
if (LOG_FILE_PATH.length() > 0) {
|
||||
auto contents = fileutils::text_read(LOG_FILE_PATH);
|
||||
if (contents.length() > 0) {
|
||||
this->log_hook(this, contents, logger::Style::DEFAULT, contents);
|
||||
}
|
||||
}
|
||||
|
||||
// add log hook
|
||||
logger::hook_add(&log_hook, this);
|
||||
}
|
||||
|
||||
Log::~Log() {
|
||||
|
||||
// remove log hook
|
||||
logger::hook_remove(&log_hook, this);
|
||||
}
|
||||
|
||||
void Log::clear() {
|
||||
|
||||
// lock and clear the data vector
|
||||
std::lock_guard<std::mutex> lock(this->log_data_m);
|
||||
this->log_data.clear();
|
||||
}
|
||||
|
||||
void Log::build_content() {
|
||||
|
||||
// clear button
|
||||
if (ImGui::Button("Clear")) {
|
||||
this->clear();
|
||||
}
|
||||
|
||||
// autoscroll option
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Autoscroll", &this->autoscroll);
|
||||
|
||||
// filter
|
||||
ImGui::SameLine();
|
||||
this->filter.Draw("Filter", -50.f);
|
||||
|
||||
// log area
|
||||
ImGui::Separator();
|
||||
ImGui::BeginChild("scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar);
|
||||
|
||||
// iterate log data
|
||||
this->log_data_m.lock();
|
||||
for (auto &data : log_data) {
|
||||
|
||||
// ignore empty lines and check filter
|
||||
if (data.first != "\r\n" && this->filter.PassFilter(data.first.c_str())) {
|
||||
|
||||
// decide on color
|
||||
ImVec4 col(1.f, 1.f, 1.f, 1.f);
|
||||
switch (data.second) {
|
||||
case logger::GREY:
|
||||
col = ImVec4(0.6f, 0.6f, 0.6f, 1.f);
|
||||
break;
|
||||
case logger::YELLOW:
|
||||
col = ImVec4(1.f, 1.f, 0.f, 1.f);
|
||||
break;
|
||||
case logger::RED:
|
||||
col = ImVec4(1.f, 0.f, 0.f, 1.f);
|
||||
break;
|
||||
case logger::DEFAULT:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// draw text
|
||||
ImGui::TextColored(col, "%s", data.first.c_str());
|
||||
}
|
||||
}
|
||||
this->log_data_m.unlock();
|
||||
|
||||
// automatic scrolling to bottom
|
||||
if (scroll_to_bottom) {
|
||||
scroll_to_bottom = false;
|
||||
ImGui::SetScrollHereY(1.f);
|
||||
}
|
||||
|
||||
// end log area
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
bool Log::log_hook(void *user, const std::string &data, logger::Style style, std::string &out) {
|
||||
|
||||
// get reference from user pointer
|
||||
auto This = reinterpret_cast<Log *>(user);
|
||||
|
||||
// copy log data
|
||||
This->log_data_m.lock();
|
||||
This->log_data.emplace_back(data, style);
|
||||
This->log_data_m.unlock();
|
||||
|
||||
// autoscroll
|
||||
if (This->autoscroll) {
|
||||
This->scroll_to_bottom = true;
|
||||
}
|
||||
|
||||
// don't replace log data
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <mutex>
|
||||
#include "overlay/window.h"
|
||||
#include "launcher/logger.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
class Log : public Window {
|
||||
private:
|
||||
|
||||
std::vector<std::pair<std::string, logger::Style>> log_data;
|
||||
std::mutex log_data_m;
|
||||
ImGuiTextFilter filter;
|
||||
bool scroll_to_bottom = true;
|
||||
bool autoscroll = true;
|
||||
|
||||
void clear();
|
||||
|
||||
public:
|
||||
|
||||
Log(SpiceOverlay *overlay);
|
||||
~Log() override;
|
||||
|
||||
void build_content() override;
|
||||
static bool log_hook(void *user, const std::string &data, logger::Style style, std::string &out);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
#include "midi.h"
|
||||
#include "launcher/launcher.h"
|
||||
#include "util/logging.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
static std::string midi_cmd_str(uint8_t cmd) {
|
||||
const char *name = "UNKNOWN";
|
||||
switch (cmd) {
|
||||
case 0x8:
|
||||
name = "NOTE OFF";
|
||||
break;
|
||||
case 0x9:
|
||||
name = "NOTE ON";
|
||||
break;
|
||||
case 0xA:
|
||||
name = "POLY.PRESS.";
|
||||
break;
|
||||
case 0xB:
|
||||
name = "CTRL CHANGE";
|
||||
break;
|
||||
case 0xC:
|
||||
name = "PRG CHANGE";
|
||||
break;
|
||||
case 0xD:
|
||||
name = "CHAN.PRESS.";
|
||||
break;
|
||||
case 0xE:
|
||||
name = "PITCH BEND";
|
||||
break;
|
||||
case 0xF:
|
||||
name = "SYSTEM";
|
||||
break;
|
||||
}
|
||||
return fmt::format("{} (0x{:2X})", name, cmd);
|
||||
}
|
||||
|
||||
MIDIWindow::MIDIWindow(SpiceOverlay *overlay) : Window(overlay) {
|
||||
this->title = "MIDI Control";
|
||||
this->init_size = ImVec2(
|
||||
ImGui::GetIO().DisplaySize.x * 0.8f,
|
||||
ImGui::GetIO().DisplaySize.y * 0.8f);
|
||||
this->size_min = ImVec2(250, 200);
|
||||
this->init_pos = ImVec2(
|
||||
ImGui::GetIO().DisplaySize.x / 2 - this->init_size.x / 2,
|
||||
ImGui::GetIO().DisplaySize.y / 2 - this->init_size.y / 2);
|
||||
this->active = true;
|
||||
|
||||
// add hook for receiving midi messages
|
||||
RI_MGR->add_callback_midi(this, MIDIWindow::midi_hook);
|
||||
}
|
||||
|
||||
MIDIWindow::~MIDIWindow() {
|
||||
RI_MGR->remove_callback_midi(this, MIDIWindow::midi_hook);
|
||||
}
|
||||
|
||||
void MIDIWindow::build_content() {
|
||||
|
||||
// reset button
|
||||
if (ImGui::Button("Reset")) {
|
||||
this->midi_data.clear();
|
||||
}
|
||||
|
||||
// autoscroll checkbox
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Autoscroll", &this->autoscroll);
|
||||
|
||||
// log section
|
||||
ImGui::BeginChild("MidiLog", ImVec2(), false);
|
||||
|
||||
// header
|
||||
ImGui::Columns(5, "MidiLogColumns", true);
|
||||
ImGui::TextColored(ImVec4(1.f, 0.7f, 0, 1), "Device"); ImGui::NextColumn();
|
||||
ImGui::TextColored(ImVec4(1.f, 0.7f, 0, 1), "Command"); ImGui::NextColumn();
|
||||
ImGui::TextColored(ImVec4(1.f, 0.7f, 0, 1), "Channel"); ImGui::NextColumn();
|
||||
ImGui::TextColored(ImVec4(1.f, 0.7f, 0, 1), "Data 1"); ImGui::NextColumn();
|
||||
ImGui::TextColored(ImVec4(1.f, 0.7f, 0, 1), "Data 2"); ImGui::NextColumn();
|
||||
|
||||
// data
|
||||
ImGui::Separator();
|
||||
for (auto &data : this->midi_data) {
|
||||
|
||||
// set color
|
||||
srand(data.device->id * 2111);
|
||||
float hue = ((float) rand()) / ((float) RAND_MAX);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImColor::HSV(hue, 0.8f, 0.8f, 1.f).Value);
|
||||
|
||||
// data cells
|
||||
ImGui::Text("%i: %s", (int) data.device->id, data.device->desc.c_str());
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("%s", midi_cmd_str(data.cmd).c_str());
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("0x%02X - %i", data.ch, data.ch);
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("0x%02X", data.b1);
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("0x%02X", data.b2);
|
||||
ImGui::NextColumn();
|
||||
|
||||
// clean up
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
||||
// autoscroll
|
||||
if (this->autoscroll_apply) {
|
||||
this->autoscroll_apply = false;
|
||||
ImGui::SetScrollHereY(1.f);
|
||||
}
|
||||
|
||||
// clean up section
|
||||
ImGui::Columns();
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
void MIDIWindow::midi_hook(void *user, rawinput::Device *device,
|
||||
uint8_t cmd, uint8_t ch, uint8_t b1, uint8_t b2) {
|
||||
auto This = (MIDIWindow*) user;
|
||||
This->midi_data.emplace_back(MIDIData {
|
||||
.device = device,
|
||||
.cmd = cmd,
|
||||
.ch = ch,
|
||||
.b1 = b1,
|
||||
.b2 = b2,
|
||||
});
|
||||
if (This->autoscroll) {
|
||||
This->autoscroll_apply = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include "rawinput/rawinput.h"
|
||||
#include "overlay/window.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
struct MIDIData {
|
||||
rawinput::Device *device;
|
||||
uint8_t cmd, ch;
|
||||
uint8_t b1, b2;
|
||||
};
|
||||
|
||||
class MIDIWindow : public Window {
|
||||
public:
|
||||
|
||||
MIDIWindow(SpiceOverlay *overlay);
|
||||
~MIDIWindow() override;
|
||||
|
||||
void build_content() override;
|
||||
static void midi_hook(void *user, rawinput::Device *device,
|
||||
uint8_t cmd, uint8_t ch, uint8_t b1, uint8_t b2);
|
||||
|
||||
private:
|
||||
|
||||
std::vector<MIDIData> midi_data;
|
||||
bool autoscroll = true;
|
||||
bool autoscroll_apply = false;
|
||||
};
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,83 @@
|
||||
#pragma once
|
||||
|
||||
#include "overlay/window.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
enum class PatchType {
|
||||
Unknown,
|
||||
Memory,
|
||||
Signature,
|
||||
};
|
||||
|
||||
enum class PatchStatus {
|
||||
Error,
|
||||
Disabled,
|
||||
Enabled,
|
||||
};
|
||||
|
||||
struct MemoryPatch {
|
||||
std::string dll_name = "";
|
||||
std::shared_ptr<uint8_t[]> data_disabled = nullptr;
|
||||
size_t data_disabled_len = 0;
|
||||
std::shared_ptr<uint8_t[]> data_enabled = nullptr;
|
||||
size_t data_enabled_len = 0;
|
||||
uint64_t data_offset = 0;
|
||||
uint8_t *data_offset_ptr = nullptr;
|
||||
bool fatal_error = false;
|
||||
};
|
||||
|
||||
struct PatchData;
|
||||
struct SignaturePatch {
|
||||
std::string dll_name = "";
|
||||
std::string signature = "", replacement = "";
|
||||
int64_t offset = 0, usage = 0;
|
||||
|
||||
MemoryPatch to_memory(PatchData *patch);
|
||||
};
|
||||
|
||||
struct PatchData {
|
||||
bool enabled;
|
||||
std::string game_code;
|
||||
int datecode_min, datecode_max;
|
||||
std::string name, description;
|
||||
PatchType type;
|
||||
bool preset;
|
||||
std::vector<MemoryPatch> patches_memory;
|
||||
PatchStatus last_status;
|
||||
bool saved;
|
||||
std::string hash;
|
||||
bool unverified = false;
|
||||
};
|
||||
|
||||
class PatchManager : public Window {
|
||||
public:
|
||||
|
||||
PatchManager(SpiceOverlay *overlay, bool apply_patches = false);
|
||||
~PatchManager() override;
|
||||
|
||||
void build_content() override;
|
||||
void reload_patches(bool apply_patches = false);
|
||||
|
||||
private:
|
||||
|
||||
// configuration
|
||||
static std::string config_path;
|
||||
static bool config_dirty;
|
||||
static bool setting_auto_apply;
|
||||
static std::vector<std::string> setting_auto_apply_list;
|
||||
static std::vector<std::string> setting_patches_enabled;
|
||||
|
||||
// patches
|
||||
static std::vector<PatchData> patches;
|
||||
static bool patches_initialized;
|
||||
|
||||
void config_load();
|
||||
void config_save();
|
||||
|
||||
void append_patches(std::string &patches_json, bool apply_patches = false);
|
||||
};
|
||||
|
||||
PatchStatus is_patch_active(PatchData &patch);
|
||||
bool apply_patch(PatchData &patch, bool active);
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
#include <games/io.h>
|
||||
|
||||
#include "screen_resize.h"
|
||||
#include "cfg/screen_resize.h"
|
||||
#include "misc/eamuse.h"
|
||||
#include "util/logging.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
ScreenResize::ScreenResize(SpiceOverlay *overlay) : Window(overlay) {
|
||||
this->title = "Screen Resize";
|
||||
this->flags = ImGuiWindowFlags_AlwaysAutoResize;
|
||||
this->init_pos = ImVec2(
|
||||
ImGui::GetIO().DisplaySize.x / 2 - this->init_size.x / 2,
|
||||
ImGui::GetIO().DisplaySize.y / 2 - this->init_size.y / 2);
|
||||
this->toggle_button = games::OverlayButtons::ToggleScreenResize;
|
||||
this->toggle_screen_resize = games::OverlayButtons::ScreenResize;
|
||||
}
|
||||
|
||||
ScreenResize::~ScreenResize() {
|
||||
}
|
||||
|
||||
void ScreenResize::build_content() {
|
||||
|
||||
// enable checkbox
|
||||
ImGui::Checkbox("Enable Screen Resize", &cfg::SCREENRESIZE->enable_screen_resize);
|
||||
if (cfg::SCREENRESIZE->enable_screen_resize) {
|
||||
|
||||
// general settings
|
||||
ImGui::Checkbox("Enable Linear Filter", &cfg::SCREENRESIZE->enable_linear_filter);
|
||||
ImGui::InputInt("X Offset", &cfg::SCREENRESIZE->offset_x);
|
||||
ImGui::InputInt("Y Offset", &cfg::SCREENRESIZE->offset_y);
|
||||
|
||||
// aspect ratio
|
||||
ImGui::Checkbox("Keep Aspect Ratio", &cfg::SCREENRESIZE->keep_aspect_ratio);
|
||||
if (cfg::SCREENRESIZE->keep_aspect_ratio) {
|
||||
if (ImGui::SliderFloat("Scale", &cfg::SCREENRESIZE->scale_x, 0.65f, 2.0f)) {
|
||||
cfg::SCREENRESIZE->scale_y = cfg::SCREENRESIZE->scale_x;
|
||||
}
|
||||
} else {
|
||||
ImGui::SliderFloat("Width Scale", &cfg::SCREENRESIZE->scale_x, 0.65f, 2.0f);
|
||||
ImGui::SliderFloat("Height Scale", &cfg::SCREENRESIZE->scale_y, 0.65f, 2.0f);
|
||||
}
|
||||
|
||||
// reset button
|
||||
if (ImGui::Button("Reset")) {
|
||||
cfg::SCREENRESIZE->offset_x = 0;
|
||||
cfg::SCREENRESIZE->offset_y = 0;
|
||||
cfg::SCREENRESIZE->scale_x = 1;
|
||||
cfg::SCREENRESIZE->scale_y = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// load button
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Load")) {
|
||||
cfg::SCREENRESIZE->config_load();
|
||||
}
|
||||
|
||||
// save button
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Save")) {
|
||||
cfg::SCREENRESIZE->config_save();
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenResize::update() {
|
||||
Window::update();
|
||||
if (this->toggle_screen_resize != ~0u) {
|
||||
auto overlay_buttons = games::get_buttons_overlay(eamuse_get_game());
|
||||
bool toggle_screen_resize_new = overlay_buttons
|
||||
&& this->overlay->hotkeys_triggered()
|
||||
&& GameAPI::Buttons::getState(RI_MGR, overlay_buttons->at(this->toggle_screen_resize));
|
||||
|
||||
if (toggle_screen_resize_new && !this->toggle_screen_resize_state) {
|
||||
cfg::SCREENRESIZE->enable_screen_resize = !cfg::SCREENRESIZE->enable_screen_resize;
|
||||
}
|
||||
this->toggle_screen_resize_state = toggle_screen_resize_new;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "overlay/window.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
class ScreenResize : public Window {
|
||||
public:
|
||||
ScreenResize(SpiceOverlay *overlay);
|
||||
~ScreenResize() override;
|
||||
|
||||
void build_content() override;
|
||||
void update();
|
||||
|
||||
private:
|
||||
size_t toggle_screen_resize = ~0u;
|
||||
bool toggle_screen_resize_state = false;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
#undef CINTERFACE
|
||||
|
||||
#include "sdvx_sub.h"
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "games/io.h"
|
||||
#include "hooks/graphics/backends/d3d9/d3d9_backend.h"
|
||||
#include "hooks/graphics/backends/d3d9/d3d9_device.h"
|
||||
#include "util/logging.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
const ImVec4 YELLOW(1.f, 1.f, 0.f, 1.f);
|
||||
const ImVec4 WHITE(1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
SDVXSubScreen::SDVXSubScreen(SpiceOverlay *overlay) : Window(overlay), device(overlay->get_device()) {
|
||||
this->draws_window = false;
|
||||
this->title = "Sub Screen";
|
||||
this->toggle_button = games::OverlayButtons::ToggleSubScreen;
|
||||
|
||||
this->texture_size = ImVec2(0, 0);
|
||||
}
|
||||
|
||||
void SDVXSubScreen::build_content() {
|
||||
this->draw_texture();
|
||||
|
||||
/*
|
||||
if (this->status_message.has_value()) {
|
||||
ImGui::TextColored(YELLOW, "%s", this->status_message.value().c_str());
|
||||
} else if (this->texture) {
|
||||
ImGui::TextColored(WHITE, "Successfully acquired surface texture");
|
||||
} else {
|
||||
ImGui::TextColored(YELLOW, "Failed to acquire surface texture");
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
bool SDVXSubScreen::build_texture(IDirect3DSurface9 *surface) {
|
||||
HRESULT hr;
|
||||
|
||||
D3DSURFACE_DESC desc {};
|
||||
hr = surface->GetDesc(&desc);
|
||||
if (FAILED(hr)) {
|
||||
this->status_message = fmt::format("Failed to get surface descriptor, hr={}", FMT_HRESULT(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = this->device->CreateTexture(desc.Width, desc.Height, 0, desc.Usage, desc.Format,
|
||||
desc.Pool, &this->texture, nullptr);
|
||||
if (FAILED(hr)) {
|
||||
this->status_message = fmt::format("Failed to create render target, hr={}", FMT_HRESULT(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
this->texture_size = ImVec2(1080, 608);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SDVXSubScreen::draw_texture() {
|
||||
HRESULT hr;
|
||||
|
||||
auto surface = graphics_d3d9_ldj_get_sub_screen();
|
||||
if (surface == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->texture == nullptr) {
|
||||
if (!this->build_texture(surface)) {
|
||||
this->texture = nullptr;
|
||||
this->texture_size = ImVec2(0, 0);
|
||||
|
||||
surface->Release();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
IDirect3DSurface9 *texture_surface = nullptr;
|
||||
hr = this->texture->GetSurfaceLevel(0, &texture_surface);
|
||||
if (FAILED(hr)) {
|
||||
this->status_message = fmt::format("Failed to get texture surface, hr={}", FMT_HRESULT(hr));
|
||||
|
||||
surface->Release();
|
||||
return;
|
||||
}
|
||||
|
||||
hr = this->device->StretchRect(surface, nullptr, texture_surface, nullptr, D3DTEXF_NONE);
|
||||
if (FAILED(hr)) {
|
||||
this->status_message = fmt::format("Failed to copy back buffer contents, hr={}", FMT_HRESULT(hr));
|
||||
|
||||
surface->Release();
|
||||
texture_surface->Release();
|
||||
return;
|
||||
}
|
||||
|
||||
surface->Release();
|
||||
texture_surface->Release();
|
||||
|
||||
ImGui::GetBackgroundDrawList()->AddImage(
|
||||
reinterpret_cast<void *>(this->texture),
|
||||
ImVec2(0, 0),
|
||||
this->texture_size,
|
||||
ImVec2(0, 0),
|
||||
ImVec2(1, 1));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef SPICETOOLS_OVERLAY_WINDOWS_SDVX_SUB_H
|
||||
#define SPICETOOLS_OVERLAY_WINDOWS_SDVX_SUB_H
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include <windows.h>
|
||||
#include <d3d9.h>
|
||||
|
||||
#include "overlay/window.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
class SDVXSubScreen : public Window {
|
||||
public:
|
||||
SDVXSubScreen(SpiceOverlay *overlay);
|
||||
|
||||
void build_content() override;
|
||||
|
||||
private:
|
||||
bool build_texture(IDirect3DSurface9 *surface);
|
||||
void draw_texture();
|
||||
|
||||
std::optional<std::string> status_message = std::nullopt;
|
||||
|
||||
IDirect3DDevice9 *device = nullptr;
|
||||
IDirect3DTexture9 *texture = nullptr;
|
||||
ImVec2 texture_size;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SPICETOOLS_OVERLAY_WINDOWS_SDVX_SUB_H
|
||||
@@ -0,0 +1,218 @@
|
||||
#include "vr.h"
|
||||
#include "misc/vrutil.h"
|
||||
#include "util/logging.h"
|
||||
#include "games/io.h"
|
||||
#include "games/drs/drs.h"
|
||||
#include "avs/game.h"
|
||||
#include "overlay/imgui/extensions.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
VRWindow::VRWindow(SpiceOverlay *overlay) : Window(overlay) {
|
||||
this->title = "VR";
|
||||
this->flags = ImGuiWindowFlags_None;
|
||||
this->toggle_button = games::OverlayButtons::ToggleVRControl;
|
||||
this->init_size = ImVec2(500, 800);
|
||||
this->size_min = ImVec2(250, 200);
|
||||
}
|
||||
|
||||
VRWindow::~VRWindow() {
|
||||
}
|
||||
|
||||
void VRWindow::build_content() {
|
||||
ImGui::BeginTabBar("VRTabBar");
|
||||
if (ImGui::BeginTabItem("Info")) {
|
||||
build_info();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (avs::game::is_model("REC")) {
|
||||
if (ImGui::BeginTabItem("Dancefloor")) {
|
||||
build_dancefloor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VRWindow::build_info() {
|
||||
|
||||
// status
|
||||
auto status = vrutil::STATUS;
|
||||
switch (status) {
|
||||
case vrutil::VRStatus::Disabled:
|
||||
ImGui::TextColored(
|
||||
ImVec4(0.4f, 0.4f, 0.4f, 1.f),
|
||||
"Disabled");
|
||||
if (ImGui::Button("Start")) {
|
||||
vrutil::init();
|
||||
if (avs::game::is_model("REC")) {
|
||||
games::drs::start_vr();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case vrutil::VRStatus::Error:
|
||||
ImGui::TextColored(
|
||||
ImVec4(0.8f, 0.1f, 0.1f, 1.f),
|
||||
"Error");
|
||||
if (ImGui::Button("Restart")) {
|
||||
vrutil::shutdown();
|
||||
vrutil::init();
|
||||
}
|
||||
break;
|
||||
case vrutil::VRStatus::Running:
|
||||
ImGui::TextColored(
|
||||
ImVec4(0.1f, 0.8f, 0.1f, 1.f),
|
||||
"Running");
|
||||
if (ImGui::Button("Stop")) {
|
||||
vrutil::shutdown();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// rescan
|
||||
if (ImGui::Button("Rescan Devices")) {
|
||||
vrutil::scan(true);
|
||||
}
|
||||
|
||||
// data table header
|
||||
ImGui::Columns(2);
|
||||
ImGui::Text("Device");
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("Position");
|
||||
ImGui::NextColumn();
|
||||
ImGui::Separator();
|
||||
|
||||
// HMD/Left/Right data
|
||||
vr::TrackedDevicePose_t hmd_pose, left_pose, right_pose;
|
||||
vr::VRControllerState_t left_state, right_state;
|
||||
vrutil::get_hmd_pose(&hmd_pose);
|
||||
vrutil::get_con_pose(vrutil::INDEX_LEFT, &left_pose, &left_state);
|
||||
vrutil::get_con_pose(vrutil::INDEX_RIGHT, &right_pose, &right_state);
|
||||
auto hmd_pos = vrutil::get_translation(hmd_pose.mDeviceToAbsoluteTracking);
|
||||
auto left_pos = vrutil::get_translation(left_pose.mDeviceToAbsoluteTracking);
|
||||
auto right_pos = vrutil::get_translation(right_pose.mDeviceToAbsoluteTracking);
|
||||
ImGui::Text("HMD");
|
||||
ImGui::NextColumn();
|
||||
ImGui::TextUnformatted(fmt::format(
|
||||
"X={:3f} Y={:3f} Z={:3f}",
|
||||
hmd_pos.x, hmd_pos.y, hmd_pos.z).c_str());
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("Left");
|
||||
ImGui::NextColumn();
|
||||
ImGui::TextUnformatted(fmt::format(
|
||||
"X={:3f} Y={:3f} Z={:3f}",
|
||||
left_pos.x, left_pos.y, left_pos.z).c_str());
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("Right");
|
||||
ImGui::NextColumn();
|
||||
ImGui::TextUnformatted(fmt::format(
|
||||
"X={:3f} Y={:3f} Z={:3f}",
|
||||
right_pos.x, right_pos.y, right_pos.z).c_str());
|
||||
ImGui::NextColumn();
|
||||
}
|
||||
|
||||
void VRWindow::build_dancefloor() {
|
||||
ImGui::Separator();
|
||||
|
||||
// settings
|
||||
ImGui::DragFloat3("Scale", &games::drs::VR_SCALE[0], 0.1f);
|
||||
ImGui::DragFloat3("Offset", &games::drs::VR_OFFSET[0], 0.1f);
|
||||
ImGui::DragFloat("Rotation", &games::drs::VR_ROTATION, 0.5f);
|
||||
for (int i = 0; i < (int) std::size(games::drs::VR_FOOTS); ++i) {
|
||||
auto &foot = games::drs::VR_FOOTS[i];
|
||||
ImGui::Separator();
|
||||
ImGui::PushID(&foot);
|
||||
ImGui::Text("%s Foot", i == 0 ? "Left" : "Right");
|
||||
ImGui::InputInt("Device Index", (int*) &foot.index, 1, 1);
|
||||
ImGui::DragFloat("Length", &foot.length,
|
||||
0.005f, 0.001f, 1000.f);
|
||||
ImGui::DragFloat("Size Base", &foot.size_base,
|
||||
0.005f, 0.001f, 1000.f);
|
||||
ImGui::DragFloat("Size Scale", &foot.size_scale,
|
||||
0.005f, 0.001f, 1000.f);
|
||||
ImGui::DragFloat4("Rotation Quat", &foot.rotation.x, 0.001f, -1, 1);
|
||||
if (ImGui::Button("Calibrate")) {
|
||||
vr::TrackedDevicePose_t pose;
|
||||
vr::VRControllerState_t state;
|
||||
vrutil::get_con_pose(foot.get_index(), &pose, &state);
|
||||
foot.length = foot.height + 0.02f;
|
||||
auto pose_rot = vrutil::get_rotation(pose.mDeviceToAbsoluteTracking.m);
|
||||
foot.rotation = linalg::qmul(linalg::qinv(pose_rot),
|
||||
vrutil::get_rotation((float) M_PI * -0.5f, 0, 0));
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::HelpMarker("Place the controller to the lower part of your leg "
|
||||
"and press this button to auto calibrate angle and length");
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
// prepare view
|
||||
auto draw_list = ImGui::GetWindowDrawList();
|
||||
auto canvas_pos = ImGui::GetCursorScreenPos();
|
||||
auto canvas_size = ImGui::GetContentRegionAvail();
|
||||
float offset_x = canvas_size.x * 0.5f;
|
||||
float offset_y = canvas_size.y * 0.1f;
|
||||
float off_x = offset_x + canvas_pos.x;
|
||||
float off_y = offset_y + canvas_pos.y;
|
||||
float scale = std::min(canvas_size.x, canvas_size.y) / 60;
|
||||
|
||||
// axis
|
||||
draw_list->AddLine(
|
||||
ImVec2(canvas_pos.x, off_y),
|
||||
ImVec2(canvas_pos.x + canvas_size.x, off_y),
|
||||
ImColor(255, 0, 0, 128));
|
||||
draw_list->AddLine(
|
||||
ImVec2(off_x, canvas_pos.y),
|
||||
ImVec2(off_x, canvas_pos.y + canvas_size.y),
|
||||
ImColor(0, 255, 0, 128));
|
||||
|
||||
// tiles
|
||||
for (int x = 0; x < 38; x++) {
|
||||
for (int y = 0; y < 49; y++) {
|
||||
auto &led = games::drs::DRS_TAPELED[x + y * 38];
|
||||
ImColor color((int) led[0], (int) led[1], (int) led[2]);
|
||||
ImVec2 p1((x - 19) * scale + off_x, (y + 0) * scale + off_y);
|
||||
ImVec2 p2((x - 18) * scale + off_x, (y + 1) * scale + off_y);
|
||||
draw_list->AddRectFilled(p1, p2, color, 0.f);
|
||||
}
|
||||
}
|
||||
|
||||
// foots
|
||||
const float foot_box = 2.f * scale;
|
||||
for (auto &foot : games::drs::VR_FOOTS) {
|
||||
vr::TrackedDevicePose_t pose;
|
||||
vr::VRControllerState_t state;
|
||||
vrutil::get_con_pose(foot.get_index(), &pose, &state);
|
||||
if (pose.bPoseIsValid) {
|
||||
|
||||
// position
|
||||
auto pos = vrutil::get_translation(pose.mDeviceToAbsoluteTracking);
|
||||
pos = foot.to_world(pos);
|
||||
pos.x -= 19;
|
||||
pos *= scale;
|
||||
ImColor color(255, 0, 255);
|
||||
if (foot.event.type == games::drs::DRS_DOWN
|
||||
|| (foot.event.type == games::drs::DRS_MOVE)) {
|
||||
auto size_factor = foot.event.width / (foot.size_base + foot.size_scale);
|
||||
color = ImColor((int) (size_factor * 127) + 128, 0, 0);
|
||||
}
|
||||
ImVec2 p1(pos.x + off_x - foot_box * 0.5f,
|
||||
pos.y + off_y - foot_box * 0.5f);
|
||||
ImVec2 p2(pos.x + off_x + foot_box * 0.5f,
|
||||
pos.y + off_y + foot_box * 0.5f);
|
||||
draw_list->AddRectFilled(p1, p2, color, 0.f);
|
||||
|
||||
// direction
|
||||
auto direction = -linalg::qzdir(linalg::qmul(
|
||||
vrutil::get_rotation(pose.mDeviceToAbsoluteTracking.m),
|
||||
foot.rotation));
|
||||
direction = linalg::aliases::float3 {
|
||||
-direction.z, direction.x, direction.y
|
||||
};
|
||||
auto end = pos + direction * foot.length * scale;
|
||||
draw_list->AddLine(
|
||||
ImVec2(pos.x + off_x, pos.y + off_y),
|
||||
ImVec2(end.x + off_x, end.y + off_y),
|
||||
ImColor(0, 255, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "overlay/window.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
class VRWindow : public Window {
|
||||
public:
|
||||
|
||||
VRWindow(SpiceOverlay *overlay);
|
||||
~VRWindow() override;
|
||||
|
||||
void build_content() override;
|
||||
void build_info();
|
||||
void build_dancefloor();
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
#include "wnd_manager.h"
|
||||
#include "hooks/graphics/graphics.h"
|
||||
#include "util/logging.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
WndManagerWindow::WndManagerWindow(SpiceOverlay *overlay) : Window(overlay) {
|
||||
this->title = "Window Manager";
|
||||
this->flags |= ImGuiWindowFlags_AlwaysAutoResize;
|
||||
this->init_pos = ImVec2(
|
||||
ImGui::GetIO().DisplaySize.x / 2 - this->init_size.x / 2,
|
||||
ImGui::GetIO().DisplaySize.y / 2 - this->init_size.y / 2);
|
||||
this->size_min = ImVec2(400, 400);
|
||||
this->active = true;
|
||||
}
|
||||
|
||||
WndManagerWindow::~WndManagerWindow() {
|
||||
}
|
||||
|
||||
static std::string hwnd_preview(int index, HWND hwnd) {
|
||||
char hwnd_title[256];
|
||||
if (GetWindowText(hwnd, hwnd_title, sizeof(hwnd_title)) > 0) {
|
||||
return hwnd_title;
|
||||
} else {
|
||||
return fmt::format("{}: {}", index, (void*) hwnd);
|
||||
}
|
||||
}
|
||||
|
||||
void WndManagerWindow::build_content() {
|
||||
|
||||
// get current window
|
||||
auto &windows_list = GRAPHICS_WINDOWS;
|
||||
HWND hwnd_current = 0;
|
||||
std::string preview = "None";
|
||||
if (this->window_current >= (int) windows_list.size()) {
|
||||
this->window_current = windows_list.size() - 1;
|
||||
}
|
||||
if (this->window_current >= 0) {
|
||||
hwnd_current = windows_list[this->window_current];
|
||||
preview = hwnd_preview(this->window_current, hwnd_current);
|
||||
}
|
||||
|
||||
// window selection
|
||||
if (ImGui::BeginCombo("Window Selection", preview.c_str(), 0)) {
|
||||
size_t count = 0;
|
||||
for (auto &hwnd : windows_list) {
|
||||
bool selected = hwnd_current == hwnd;
|
||||
auto cur_preview = hwnd_preview(count, hwnd);
|
||||
if (ImGui::Selectable(cur_preview.c_str(), selected)) {
|
||||
this->window_current = count;
|
||||
}
|
||||
if (selected) {
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
count++;
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
// window information
|
||||
ImGui::Separator();
|
||||
if (hwnd_current == 0) {
|
||||
ImGui::TextColored(ImVec4(1.f, 0.f, 0.f, 1.f),
|
||||
"Please select a window first...");
|
||||
} else {
|
||||
|
||||
// window information
|
||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||
if (ImGui::CollapsingHeader("Information")) {
|
||||
static struct {
|
||||
const char *desc;
|
||||
int index;
|
||||
} INFORMATION [] {
|
||||
{ .desc = "GWL_EXSTYLE", .index = GWL_EXSTYLE },
|
||||
{ .desc = "GWLP_HINSTANCE", .index = -6 },
|
||||
{ .desc = "GWLP_HWNDPARENT", .index = -8 },
|
||||
{ .desc = "GWLP_ID", .index = GWL_ID },
|
||||
{ .desc = "GWL_STYLE", .index = GWL_STYLE },
|
||||
{ .desc = "GWLP_USERDATA", .index = -21 },
|
||||
{ .desc = "GWLP_WNDPROC", .index = -4 },
|
||||
};
|
||||
|
||||
// columns header
|
||||
ImGui::Columns(2);
|
||||
ImGui::TextUnformatted("Index"); ImGui::NextColumn();
|
||||
ImGui::TextUnformatted("Value"); ImGui::NextColumn();
|
||||
|
||||
// add information
|
||||
ImGui::Separator();
|
||||
for (auto &entry : INFORMATION) {
|
||||
|
||||
// index
|
||||
ImGui::TextUnformatted(entry.desc);
|
||||
ImGui::NextColumn();
|
||||
|
||||
// value
|
||||
ImGui::Text("%p", (void*) GetWindowLongPtr(hwnd_current, entry.index));
|
||||
ImGui::NextColumn();
|
||||
}
|
||||
|
||||
// end columns
|
||||
ImGui::Columns();
|
||||
}
|
||||
|
||||
// size information
|
||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||
if (ImGui::CollapsingHeader("Sizes")) {
|
||||
|
||||
// window rect
|
||||
RECT hwnd_rect {};
|
||||
if (GetWindowRect(hwnd_current, &hwnd_rect)) {
|
||||
ImGui::Text("Window Rect: %ld %ld %ld %ld - %ld %ld",
|
||||
hwnd_rect.left, hwnd_rect.top, hwnd_rect.right, hwnd_rect.bottom,
|
||||
hwnd_rect.right - hwnd_rect.left, hwnd_rect.bottom - hwnd_rect.top);
|
||||
|
||||
// client rect
|
||||
RECT client_rect {};
|
||||
if (GetClientRect(hwnd_current, &client_rect)) {
|
||||
ImGui::Text("Client Rect: %ld %ld %ld %ld - %ld %ld",
|
||||
client_rect.left, client_rect.top, client_rect.right, client_rect.bottom,
|
||||
client_rect.right - client_rect.left, client_rect.bottom - client_rect.top);
|
||||
ImGui::Text("Decoration Size: %ld %ld",
|
||||
(hwnd_rect.right - hwnd_rect.left) - (client_rect.right - client_rect.left),
|
||||
(hwnd_rect.bottom - hwnd_rect.top) - (client_rect.bottom - client_rect.top));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// position information
|
||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||
if (ImGui::CollapsingHeader("Positions")) {
|
||||
|
||||
// window position
|
||||
RECT hwnd_rect {};
|
||||
if (GetWindowRect(hwnd_current, &hwnd_rect)) {
|
||||
ImGui::Text("Window Position: %ld %ld",
|
||||
hwnd_rect.left, hwnd_rect.top);
|
||||
}
|
||||
|
||||
// cursor position
|
||||
POINT cursor_pos;
|
||||
if (GetCursorPos(&cursor_pos)) {
|
||||
ImGui::Text("Cursor Position: %ld %ld",
|
||||
cursor_pos.x, cursor_pos.y);
|
||||
if (ScreenToClient(hwnd_current, &cursor_pos)) {
|
||||
ImGui::Text("Cursor Client Position: %ld %ld",
|
||||
cursor_pos.x, cursor_pos.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "overlay/window.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
class WndManagerWindow : public Window {
|
||||
public:
|
||||
|
||||
WndManagerWindow(SpiceOverlay *overlay);
|
||||
~WndManagerWindow() override;
|
||||
|
||||
void build_content() override;
|
||||
|
||||
private:
|
||||
|
||||
int window_current = -1;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user