1.5: Fuckin' UE5... #38

Manually merged
williamjcm merged 126 commits from one-point-five into master 2024-07-22 11:06:13 +02:00
7 changed files with 28 additions and 22 deletions
Showing only changes of commit d612b0afe6 - Show all commits

View file

@ -55,6 +55,10 @@ SaveTool::SaveTool(const Arguments& arguments):
tweak.enable("", "../../"); tweak.enable("", "../../");
#endif #endif
LOG_INFO_FORMAT("Framebuffer size: {}x{}", framebufferSize().x(), framebufferSize().y());
LOG_INFO_FORMAT("Window size: {}x{}", windowSize().x(), windowSize().y());
LOG_INFO_FORMAT("DPI scaling: {}x{}", dpiScaling().x(), dpiScaling().y());
LOG_INFO("Configuring OpenGL renderer."); LOG_INFO("Configuring OpenGL renderer.");
GL::Renderer::enable(GL::Renderer::Feature::Blending); GL::Renderer::enable(GL::Renderer::Feature::Blending);
GL::Renderer::enable(GL::Renderer::Feature::ScissorTest); GL::Renderer::enable(GL::Renderer::Feature::ScissorTest);
@ -306,7 +310,7 @@ SaveTool::drawGui() {
void void
SaveTool::drawDisclaimer() { SaveTool::drawDisclaimer() {
ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f}}, ImGuiCond_Always, center_pivot); ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f} / dpiScaling()}, ImGuiCond_Always, center_pivot);
if(ImGui::Begin("Disclaimer##DisclaimerWindow", nullptr, if(ImGui::Begin("Disclaimer##DisclaimerWindow", nullptr,
ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoBringToFrontOnFocus| ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoBringToFrontOnFocus|
@ -374,7 +378,7 @@ SaveTool::drawDisclaimer() {
void void
SaveTool::drawInitialisation() { SaveTool::drawInitialisation() {
ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f}}, ImGuiCond_Always, center_pivot); ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f} / dpiScaling()}, ImGuiCond_Always, center_pivot);
if(ImGui::BeginPopupModal("##InitPopup", nullptr, if(ImGui::BeginPopupModal("##InitPopup", nullptr,
ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar)) ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar))

View file

@ -62,7 +62,7 @@ void
SaveTool::initialiseGui() { SaveTool::initialiseGui() {
LOG_INFO("Initialising Dear ImGui."); LOG_INFO("Initialising Dear ImGui.");
ImGui::CreateContext(); auto ctx = ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
@ -92,15 +92,10 @@ SaveTool::initialiseGui() {
16.0f * float(framebufferSize().x()) / size.x(), &icon_config, brand_range); 16.0f * float(framebufferSize().x()) / size.x(), &icon_config, brand_range);
auto mono_font = _rs.getRaw("SourceCodePro-Regular.ttf"_s); auto mono_font = _rs.getRaw("SourceCodePro-Regular.ttf"_s);
ImVector<ImWchar> range;
ImFontGlyphRangesBuilder builder;
builder.AddRanges(io.Fonts->GetGlyphRangesDefault());
builder.AddChar(u'š'); // This allows displaying Vladimír Vondruš' name in Corrade's and Magnum's licences.
builder.BuildRanges(&range);
io.Fonts->AddFontFromMemoryTTF(const_cast<char*>(mono_font.data()), int(mono_font.size()), io.Fonts->AddFontFromMemoryTTF(const_cast<char*>(mono_font.data()), int(mono_font.size()),
18.0f * float(framebufferSize().x()) / size.x(), &font_config, range.Data); 18.0f * float(framebufferSize().x()) / size.x(), &font_config);
_imgui = ImGuiIntegration::Context(*ImGui::GetCurrentContext(), windowSize()); _imgui = ImGuiIntegration::Context(*ctx, Vector2{windowSize()}/dpiScaling(), windowSize(), framebufferSize());
io.IniFilename = nullptr; io.IniFilename = nullptr;

View file

@ -19,6 +19,8 @@
#include <Corrade/Utility/Format.h> #include <Corrade/Utility/Format.h>
#include <Corrade/Utility/Path.h> #include <Corrade/Utility/Path.h>
#include <Magnum/ImGuiIntegration/Integration.h>
#include <SDL_messagebox.h> #include <SDL_messagebox.h>
#include "../Configuration/Configuration.h" #include "../Configuration/Configuration.h"
@ -31,7 +33,7 @@
void void
SaveTool::drawManager() { SaveTool::drawManager() {
ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always); ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always);
ImGui::SetNextWindowSize({float(windowSize().x()), float(windowSize().y()) - ImGui::GetItemRectSize().y}, ImGui::SetNextWindowSize(ImVec2{Vector2{float(windowSize().x()), float(windowSize().y()) - ImGui::GetItemRectSize().y} / dpiScaling()},
ImGuiCond_Always); ImGuiCond_Always);
if(!ImGui::Begin("##MainWindow", nullptr, if(!ImGui::Begin("##MainWindow", nullptr,
ImGuiWindowFlags_NoDecoration|ImGuiWindowFlags_NoMove| ImGuiWindowFlags_NoDecoration|ImGuiWindowFlags_NoMove|

View file

@ -38,7 +38,7 @@ SaveTool::drawMassViewer() {
} }
ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always); ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always);
ImGui::SetNextWindowSize({float(windowSize().x()), float(windowSize().y()) - ImGui::GetItemRectSize().y}, ImGui::SetNextWindowSize(ImVec2{Vector2{float(windowSize().x()), float(windowSize().y()) - ImGui::GetItemRectSize().y} / dpiScaling()},
ImGuiCond_Always); ImGuiCond_Always);
if(!ImGui::Begin("##MassViewer", nullptr, if(!ImGui::Begin("##MassViewer", nullptr,
ImGuiWindowFlags_NoDecoration|ImGuiWindowFlags_NoMove| ImGuiWindowFlags_NoDecoration|ImGuiWindowFlags_NoMove|

View file

@ -32,7 +32,11 @@ SaveTool::drawFrameInfo() {
ImGui::BeginGroup(); ImGui::BeginGroup();
if(ImGui::BeginChild("##JointSliders", {(ImGui::GetContentRegionAvail().x / 2.0f) - (ImGui::GetStyle().WindowPadding.x / 2.0f), 300.0f}, true, ImGuiWindowFlags_MenuBar)) { if(ImGui::BeginChild("##JointSliders",
{(ImGui::GetContentRegionAvail().x / 2.0f) - (ImGui::GetStyle().WindowPadding.x / 2.0f),
(ImGui::GetContentRegionAvail().y / 1.75f) - (ImGui::GetStyle().WindowPadding.y / 2.0f)},
true, ImGuiWindowFlags_MenuBar))
{
if(ImGui::BeginMenuBar()) { if(ImGui::BeginMenuBar()) {
ImGui::TextUnformatted("Joint sliders"); ImGui::TextUnformatted("Joint sliders");
@ -43,7 +47,10 @@ SaveTool::drawFrameInfo() {
} }
ImGui::EndChild(); ImGui::EndChild();
if(ImGui::BeginChild("##FrameStyles", {(ImGui::GetContentRegionAvail().x / 2.0f) - (ImGui::GetStyle().WindowPadding.x / 2.0f), 0.0f}, true, ImGuiWindowFlags_MenuBar)) { if(ImGui::BeginChild("##FrameStyles",
{(ImGui::GetContentRegionAvail().x / 2.0f) - (ImGui::GetStyle().WindowPadding.x / 2.0f), 0.0f},
true, ImGuiWindowFlags_MenuBar))
{
if(ImGui::BeginMenuBar()) { if(ImGui::BeginMenuBar()) {
ImGui::TextUnformatted("Frame styles"); ImGui::TextUnformatted("Frame styles");

View file

@ -51,11 +51,11 @@ SaveTool::drawWeapons() {
ImGui::EndTable(); ImGui::EndTable();
ImGui::Separator();
bool dirty = _meleeDirty || _shieldsDirty || _bShootersDirty || _eShootersDirty || _bLaunchersDirty || _eLaunchersDirty; bool dirty = _meleeDirty || _shieldsDirty || _bShootersDirty || _eShootersDirty || _bLaunchersDirty || _eLaunchersDirty;
if(!dirty) { ImGui::BeginDisabled(!dirty);
ImGui::BeginDisabled();
}
if(drawUnsafeWidget([]{ return ImGui::Button(ICON_FA_SAVE " Save"); })) { if(drawUnsafeWidget([]{ return ImGui::Button(ICON_FA_SAVE " Save"); })) {
if(_meleeDirty) { if(_meleeDirty) {
@ -154,9 +154,7 @@ SaveTool::drawWeapons() {
} }
} }
if(!dirty) { ImGui::EndDisabled();
ImGui::EndDisabled();
}
ImGui::EndGroup(); ImGui::EndGroup();

View file

@ -28,7 +28,7 @@ void
SaveTool::drawProfileManager() { SaveTool::drawProfileManager() {
static std::size_t profile_index = 0; static std::size_t profile_index = 0;
ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f}}, ImGuiCond_Always, center_pivot); ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f} / dpiScaling()}, ImGuiCond_Always, center_pivot);
if(ImGui::Begin("Profile management##ProfileManager", nullptr, if(ImGui::Begin("Profile management##ProfileManager", nullptr,
ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoBringToFrontOnFocus| ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoBringToFrontOnFocus|
ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_MenuBar)) ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_MenuBar))
@ -128,7 +128,7 @@ SaveTool::drawProfileManager() {
ImGuiID ImGuiID
SaveTool::drawBackupListPopup() { SaveTool::drawBackupListPopup() {
ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f}}, ImGuiCond_Always, center_pivot); ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f} / dpiScaling()}, ImGuiCond_Always, center_pivot);
if(!ImGui::BeginPopupModal("Backups##BackupsModal", nullptr, if(!ImGui::BeginPopupModal("Backups##BackupsModal", nullptr,
ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove))
{ {