From 67d5ba08ab64bf3c913480a276b6e0886272ec2d Mon Sep 17 00:00:00 2001 From: Kenix3 Date: Tue, 2 Aug 2022 22:34:45 -0400 Subject: [PATCH] Converts gfxFramebuffer to be a pointer. --- libultraship/libultraship/ImGuiImpl.cpp | 8 +++----- libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp | 8 ++++---- libultraship/libultraship/Lib/Fast3D/gfx_pc.h | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index a1b44a6df..5581dd5a3 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -1625,12 +1625,10 @@ namespace SohImGui { pos = ImVec2(size.x / 2 - sw / 2, 0); size = ImVec2(sw, size.y); } - std::string fb_str = gfxFramebuffer; - if (!fb_str.empty()) { - uintptr_t fbuf = (uintptr_t)std::stoull(fb_str); - //ImGui::ImageSimple(reinterpret_cast(fbuf), pos, size); + if (gfxFramebuffer != NULL) { + //ImGui::ImageSimple(reinterpret_cast(gfxFramebuffer), pos, size); ImGui::SetCursorPos(pos); - ImGui::Image(reinterpret_cast(fbuf), size); + ImGui::Image(reinterpret_cast(gfxFramebuffer), size); } ImGui::End(); diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp index d855012ef..0660d6ebd 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp @@ -48,7 +48,7 @@ extern "C" { int ResourceMgr_OTRSigCheck(char* imgData); } -std::string gfxFramebuffer; +uintptr_t gfxFramebuffer; using namespace std; @@ -2783,7 +2783,7 @@ void gfx_run(Gfx *commands, const std::unordered_map& mtx_replaceme rendering_state.scissor = {}; gfx_run_dl(commands); gfx_flush(); - gfxFramebuffer = string(); + gfxFramebuffer = NULL; if (game_renders_to_framebuffer) { gfx_rapi->start_draw_to_framebuffer(0, 1); gfx_rapi->clear_framebuffer(); @@ -2793,12 +2793,12 @@ void gfx_run(Gfx *commands, const std::unordered_map& mtx_replaceme if (different_size) { gfx_rapi->resolve_msaa_color_buffer(game_framebuffer_msaa_resolved, game_framebuffer); - gfxFramebuffer = std::to_string((uintptr_t)gfx_rapi->get_framebuffer_texture_id(game_framebuffer_msaa_resolved)); + gfxFramebuffer = (uintptr_t)gfx_rapi->get_framebuffer_texture_id(game_framebuffer_msaa_resolved); } else { gfx_rapi->resolve_msaa_color_buffer(0, game_framebuffer); } } else { - gfxFramebuffer = std::to_string((uintptr_t)gfx_rapi->get_framebuffer_texture_id(game_framebuffer)); + gfxFramebuffer = (uintptr_t)gfx_rapi->get_framebuffer_texture_id(game_framebuffer); } } SohImGui::DrawFramebufferAndGameInput(); diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_pc.h b/libultraship/libultraship/Lib/Fast3D/gfx_pc.h index 931093079..feab8e3d9 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_pc.h +++ b/libultraship/libultraship/Lib/Fast3D/gfx_pc.h @@ -14,7 +14,7 @@ #define SCREEN_WIDTH 320 #define SCREEN_HEIGHT 240 -extern std::string gfxFramebuffer; +extern uintptr_t gfxFramebuffer; struct GfxRenderingAPI; struct GfxWindowManagerAPI;