overlay: Add build, title name, and file name to overlay
This commit is contained in:
parent
8b35389c71
commit
05a7acf13e
|
@ -117,8 +117,11 @@ static struct {
|
||||||
|
|
||||||
static const char* section_overlay = "overlay";
|
static const char* section_overlay = "overlay";
|
||||||
static struct {
|
static struct {
|
||||||
|
const char* build_hash = "Build Hash";
|
||||||
const char* FPS = "FPS";
|
const char* FPS = "FPS";
|
||||||
const char* hle_lle_stats = "HLE/LLE Stats";
|
const char* hle_lle_stats = "HLE/LLE Stats";
|
||||||
|
const char* title_name = "Title Name";
|
||||||
|
const char* file_name = "File Name";
|
||||||
} sect_overlay_keys;
|
} sect_overlay_keys;
|
||||||
|
|
||||||
static const char* section_audio = "audio";
|
static const char* section_audio = "audio";
|
||||||
|
@ -547,8 +550,11 @@ bool Settings::LoadConfig()
|
||||||
|
|
||||||
// ==== Overlay Begin =========
|
// ==== Overlay Begin =========
|
||||||
|
|
||||||
|
m_overlay.build_hash = m_si.GetBoolValue(section_overlay, sect_overlay_keys.build_hash, false);
|
||||||
m_overlay.fps = m_si.GetBoolValue(section_overlay, sect_overlay_keys.FPS, false);
|
m_overlay.fps = m_si.GetBoolValue(section_overlay, sect_overlay_keys.FPS, false);
|
||||||
m_overlay.hle_lle_stats = m_si.GetBoolValue(section_overlay, sect_overlay_keys.hle_lle_stats, false);
|
m_overlay.hle_lle_stats = m_si.GetBoolValue(section_overlay, sect_overlay_keys.hle_lle_stats, false);
|
||||||
|
m_overlay.title_name = m_si.GetBoolValue(section_overlay, sect_overlay_keys.title_name, false);
|
||||||
|
m_overlay.file_name = m_si.GetBoolValue(section_overlay, sect_overlay_keys.file_name, false);
|
||||||
|
|
||||||
// ==== Overlay End ===========
|
// ==== Overlay End ===========
|
||||||
|
|
||||||
|
@ -735,8 +741,11 @@ bool Settings::Save(std::string file_path)
|
||||||
|
|
||||||
// ==== Overlay Begin =======
|
// ==== Overlay Begin =======
|
||||||
|
|
||||||
|
m_si.SetBoolValue(section_overlay, sect_overlay_keys.build_hash, m_overlay.build_hash, nullptr, true);
|
||||||
m_si.SetBoolValue(section_overlay, sect_overlay_keys.FPS, m_overlay.fps, nullptr, true);
|
m_si.SetBoolValue(section_overlay, sect_overlay_keys.FPS, m_overlay.fps, nullptr, true);
|
||||||
m_si.SetBoolValue(section_overlay, sect_overlay_keys.hle_lle_stats, m_overlay.hle_lle_stats, nullptr, true);
|
m_si.SetBoolValue(section_overlay, sect_overlay_keys.hle_lle_stats, m_overlay.hle_lle_stats, nullptr, true);
|
||||||
|
m_si.SetBoolValue(section_overlay, sect_overlay_keys.title_name, m_overlay.title_name, nullptr, true);
|
||||||
|
m_si.SetBoolValue(section_overlay, sect_overlay_keys.file_name, m_overlay.file_name, nullptr, true);
|
||||||
|
|
||||||
// ==== Overlay End =========
|
// ==== Overlay End =========
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,6 @@
|
||||||
#include "common/AddressRanges.h"
|
#include "common/AddressRanges.h"
|
||||||
#include "common/xbox/Types.hpp"
|
#include "common/xbox/Types.hpp"
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
|
||||||
|
|
||||||
#ifdef CXBXR_EMU
|
#ifdef CXBXR_EMU
|
||||||
extern "C" void CxbxKrnlPrintUEM(ULONG);
|
extern "C" void CxbxKrnlPrintUEM(ULONG);
|
||||||
#endif
|
#endif
|
||||||
|
@ -58,12 +56,11 @@ Xbe::Xbe(const char *x_szFilename, bool bFromGUI)
|
||||||
|
|
||||||
FILE *XbeFile = fopen(x_szFilename, "rb");
|
FILE *XbeFile = fopen(x_szFilename, "rb");
|
||||||
|
|
||||||
// verify Xbe file was opened successfully
|
std::string XbeName = std::filesystem::path(x_szFilename).filename().string(); // recover the xbe name
|
||||||
if(XbeFile == 0)
|
|
||||||
{
|
// verify Xbe file was opened successfully
|
||||||
using namespace fs; // limit its scope inside here
|
if(XbeFile == 0) {
|
||||||
|
|
||||||
std::string XbeName = path(x_szFilename).filename().string(); // recover the xbe name
|
|
||||||
// NOTE: the check for the existence of the child window is necessary because the user could have previously loaded the dashboard,
|
// NOTE: the check for the existence of the child window is necessary because the user could have previously loaded the dashboard,
|
||||||
// removed/changed the path and attempt to load it again from the recent list, which will crash CxbxInitWindow below
|
// removed/changed the path and attempt to load it again from the recent list, which will crash CxbxInitWindow below
|
||||||
// Note that GetHwnd(), CxbxKrnl_hEmuParent and HalReturnToFirmware are all not suitable here for various reasons
|
// Note that GetHwnd(), CxbxKrnl_hEmuParent and HalReturnToFirmware are all not suitable here for various reasons
|
||||||
|
@ -96,7 +93,7 @@ Xbe::Xbe(const char *x_szFilename, bool bFromGUI)
|
||||||
SetFatalError(std::string("Could not open the Xbe file ") + XbeName);
|
SetFatalError(std::string("Could not open the Xbe file ") + XbeName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("OK\n");
|
printf("OK\n");
|
||||||
|
|
||||||
|
@ -111,6 +108,14 @@ Xbe::Xbe(const char *x_szFilename, bool bFromGUI)
|
||||||
*(++c) = '\0';
|
*(++c) = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("OK\n");
|
||||||
|
|
||||||
|
// remember the Xbe file name
|
||||||
|
{
|
||||||
|
printf("Xbe::Xbe: Storing Xbe File Name...");
|
||||||
|
strncpy(m_szFileName, XbeName.c_str(), ARRAY_SIZE(m_szFileName) * sizeof(char));
|
||||||
|
}
|
||||||
|
|
||||||
printf("OK\n");
|
printf("OK\n");
|
||||||
|
|
||||||
// read Xbe image header
|
// read Xbe image header
|
||||||
|
|
|
@ -258,6 +258,9 @@ class Xbe : public Error
|
||||||
// Xbe original path
|
// Xbe original path
|
||||||
char m_szPath[MAX_PATH];
|
char m_szPath[MAX_PATH];
|
||||||
|
|
||||||
|
// Xbe original file name
|
||||||
|
char m_szFileName[MAX_PATH];
|
||||||
|
|
||||||
// Xbe ascii title, translated from certificate title
|
// Xbe ascii title, translated from certificate title
|
||||||
char m_szAsciiTitle[41];
|
char m_szAsciiTitle[41];
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,11 @@
|
||||||
// Intended to store as permanent settings
|
// Intended to store as permanent settings
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
bool build_hash;
|
||||||
bool fps;
|
bool fps;
|
||||||
bool hle_lle_stats;
|
bool hle_lle_stats;
|
||||||
|
bool title_name;
|
||||||
|
bool file_name;
|
||||||
} overlay_settings;
|
} overlay_settings;
|
||||||
|
|
||||||
// Intended for EmuShared only below
|
// Intended for EmuShared only below
|
||||||
|
|
|
@ -120,8 +120,11 @@ void ImGuiUI::DrawMenu()
|
||||||
if (ImGui::BeginMenu("Settings")) {
|
if (ImGui::BeginMenu("Settings")) {
|
||||||
if (ImGui::BeginMenu("Overlay")) {
|
if (ImGui::BeginMenu("Overlay")) {
|
||||||
bool bChanged = false;
|
bool bChanged = false;
|
||||||
|
bChanged |= ImGui::MenuItem("Show Build Hash", NULL, &m_settings.build_hash);
|
||||||
bChanged |= ImGui::MenuItem("Show FPS", NULL, &m_settings.fps);
|
bChanged |= ImGui::MenuItem("Show FPS", NULL, &m_settings.fps);
|
||||||
bChanged |= ImGui::MenuItem("Show HLE/LLE Stats", NULL, &m_settings.hle_lle_stats);
|
bChanged |= ImGui::MenuItem("Show HLE/LLE Stats", NULL, &m_settings.hle_lle_stats);
|
||||||
|
bChanged |= ImGui::MenuItem("Show Title Name", NULL, &m_settings.title_name);
|
||||||
|
bChanged |= ImGui::MenuItem("Show File Name", NULL, &m_settings.file_name);
|
||||||
if (bChanged) {
|
if (bChanged) {
|
||||||
g_EmuShared->SetOverlaySettings(&m_settings);
|
g_EmuShared->SetOverlaySettings(&m_settings);
|
||||||
ipc_send_gui_update(IPC_UPDATE_GUI::OVERLAY, 1);
|
ipc_send_gui_update(IPC_UPDATE_GUI::OVERLAY, 1);
|
||||||
|
@ -139,14 +142,18 @@ void ImGuiUI::DrawMenu()
|
||||||
|
|
||||||
void ImGuiUI::DrawWidgets()
|
void ImGuiUI::DrawWidgets()
|
||||||
{
|
{
|
||||||
if (m_settings.fps || m_settings.hle_lle_stats) {
|
|
||||||
|
if (m_settings.fps
|
||||||
|
|| m_settings.hle_lle_stats
|
||||||
|
||m_settings.title_name
|
||||||
|
|| m_settings.file_name) {
|
||||||
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(ImGui::GetIO().DisplaySize.x - (IMGUI_MIN_DIST_SIDE/* * m_backbuffer_scale*/),
|
ImGui::SetNextWindowPos(ImVec2(ImGui::GetIO().DisplaySize.x - (IMGUI_MIN_DIST_SIDE/* * m_backbuffer_scale*/),
|
||||||
IMGUI_MIN_DIST_TOP/* * m_backbuffer_scale*/), ImGuiCond_Always, ImVec2(1.0f, 0.0f));
|
IMGUI_MIN_DIST_TOP/* * m_backbuffer_scale*/), ImGuiCond_Always, ImVec2(1.0f, 0.0f));
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(200.0f/* * m_backbuffer_scale*/, 0.0f));
|
ImGui::SetNextWindowSize(ImVec2(200.0f/* * m_backbuffer_scale*/, 0.0f));
|
||||||
ImGui::SetNextWindowBgAlpha(0.5f);
|
ImGui::SetNextWindowBgAlpha(0.5f);
|
||||||
if (ImGui::Begin("overlay_stats", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoNav |
|
if (ImGui::Begin("overlay_stats_topright", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoNav |
|
||||||
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar |
|
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar |
|
||||||
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing)) {
|
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing)) {
|
||||||
|
|
||||||
|
@ -180,8 +187,36 @@ void ImGuiUI::DrawWidgets()
|
||||||
- ImGui::GetScrollX() - 2 * ImGui::GetStyle().ItemSpacing.x);
|
- ImGui::GetScrollX() - 2 * ImGui::GetStyle().ItemSpacing.x);
|
||||||
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), flagString.c_str());
|
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), flagString.c_str());
|
||||||
}
|
}
|
||||||
ImGui::End();
|
|
||||||
|
if (m_settings.title_name) {
|
||||||
|
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "Title: %.41s", CxbxKrnl_Xbe->m_szAsciiTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_settings.file_name) {
|
||||||
|
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "File: %.260s", CxbxKrnl_Xbe->m_szFileName);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_settings.build_hash) {
|
||||||
|
|
||||||
|
ImGui::SetNextWindowPos(ImVec2(IMGUI_MIN_DIST_SIDE, ImGui::GetIO().DisplaySize.y - IMGUI_MIN_DIST_SIDE/* * m_backbuffer_scale*/),
|
||||||
|
ImGuiCond_Always, ImVec2(0.0f, 1.0f));
|
||||||
|
|
||||||
|
//ImGui::SetNextWindowSize(ImVec2(200.0f/* * m_backbuffer_scale*/, 0.0f));
|
||||||
|
ImGui::SetNextWindowBgAlpha(0.5f);
|
||||||
|
if (ImGui::Begin("overlay_stats_bottom", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoNav |
|
||||||
|
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar |
|
||||||
|
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing)) {
|
||||||
|
|
||||||
|
if (m_settings.build_hash) {
|
||||||
|
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "Build: %s", GetGitVersionStr());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiWindowFlags input_handler = m_is_focus ? ImGuiWindowFlags_None : ImGuiWindowFlags_NoInputs;
|
ImGuiWindowFlags input_handler = m_is_focus ? ImGuiWindowFlags_None : ImGuiWindowFlags_NoInputs;
|
||||||
|
|
|
@ -50,8 +50,8 @@ void ImGuiVideo::DrawWidgets(bool is_focus, ImGuiWindowFlags input_handler)
|
||||||
if (ImGui::CollapsingHeader("Vertex Buffer Cache", ImGuiTreeNodeFlags_DefaultOpen)) {
|
if (ImGui::CollapsingHeader("Vertex Buffer Cache", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||||
VertexBufferConverter.DrawCacheStats();
|
VertexBufferConverter.DrawCacheStats();
|
||||||
}
|
}
|
||||||
ImGui::End();
|
|
||||||
}
|
}
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render the lightgun laser
|
// Render the lightgun laser
|
||||||
|
|
Loading…
Reference in New Issue