From 1de525900dbfea9b44f70531e0a82c2629a9ba57 Mon Sep 17 00:00:00 2001 From: Kenix3 Date: Tue, 2 Aug 2022 22:10:26 -0400 Subject: [PATCH] Removes unnecessary Environment.cpp file. --- libultraship/libultraship/Environment.cpp | 16 ---------------- libultraship/libultraship/Environment.h | 8 -------- libultraship/libultraship/ImGuiImpl.cpp | 3 +-- .../libultraship/Lib/Fast3D/gfx_opengl.cpp | 1 - libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp | 9 +++++---- libultraship/libultraship/Lib/Fast3D/gfx_pc.h | 2 ++ libultraship/libultraship/libultraship.vcxproj | 2 -- .../libultraship/libultraship.vcxproj.filters | 9 --------- 8 files changed, 8 insertions(+), 42 deletions(-) delete mode 100644 libultraship/libultraship/Environment.cpp delete mode 100644 libultraship/libultraship/Environment.h diff --git a/libultraship/libultraship/Environment.cpp b/libultraship/libultraship/Environment.cpp deleted file mode 100644 index 53d0f330b..000000000 --- a/libultraship/libultraship/Environment.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "Environment.h" - -#include -#include - -std::map environmentVars; - -namespace SohUtils { - void saveEnvironmentVar(const std::string& key, const std::string& value) { - environmentVars[key] = value; - } - - std::string getEnvironmentVar(const std::string& key) { - return environmentVars[key]; - } -} \ No newline at end of file diff --git a/libultraship/libultraship/Environment.h b/libultraship/libultraship/Environment.h deleted file mode 100644 index 4d6ab3346..000000000 --- a/libultraship/libultraship/Environment.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -#include - -namespace SohUtils { - void saveEnvironmentVar(const std::string& key, const std::string& value); - std::string getEnvironmentVar(const std::string& key); -} \ No newline at end of file diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index f19ce7eac..a1b44a6df 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -8,7 +8,6 @@ #include #include "Archive.h" -#include "Environment.h" #include "GameSettings.h" #include "Console.h" #include "Hooks.h" @@ -1626,7 +1625,7 @@ namespace SohImGui { pos = ImVec2(size.x / 2 - sw / 2, 0); size = ImVec2(sw, size.y); } - std::string fb_str = SohUtils::getEnvironmentVar("framebuffer"); + 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); diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp index ad683e047..3d199ef71 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp @@ -44,7 +44,6 @@ #include "gfx_cc.h" #include "gfx_rendering_api.h" #include "../../ImGuiImpl.h" -#include "../../Environment.h" #include "../../GlobalCtx2.h" #include "gfx_pc.h" diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp index 0a5d0ceef..d855012ef 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp @@ -32,7 +32,6 @@ #include "../../luslog.h" #include "../StrHash64.h" #include "../../ImGuiImpl.h" -#include "../../Environment.h" #include "../../GameVersions.h" #include "../../ResourceMgr.h" #include "../../Utils.h" @@ -49,6 +48,8 @@ extern "C" { int ResourceMgr_OTRSigCheck(char* imgData); } +std::string gfxFramebuffer; + using namespace std; #define SEG_ADDR(seg, addr) (addr | (seg << 24) | 1) @@ -2782,7 +2783,7 @@ void gfx_run(Gfx *commands, const std::unordered_map& mtx_replaceme rendering_state.scissor = {}; gfx_run_dl(commands); gfx_flush(); - SohUtils::saveEnvironmentVar("framebuffer", string()); + gfxFramebuffer = string(); if (game_renders_to_framebuffer) { gfx_rapi->start_draw_to_framebuffer(0, 1); gfx_rapi->clear_framebuffer(); @@ -2792,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); - SohUtils::saveEnvironmentVar("framebuffer", std::to_string((uintptr_t)gfx_rapi->get_framebuffer_texture_id(game_framebuffer_msaa_resolved))); + gfxFramebuffer = std::to_string((uintptr_t)gfx_rapi->get_framebuffer_texture_id(game_framebuffer_msaa_resolved)); } else { gfx_rapi->resolve_msaa_color_buffer(0, game_framebuffer); } } else { - SohUtils::saveEnvironmentVar("framebuffer", std::to_string((uintptr_t)gfx_rapi->get_framebuffer_texture_id(game_framebuffer))); + gfxFramebuffer = std::to_string((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 4e620ef2d..931093079 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_pc.h +++ b/libultraship/libultraship/Lib/Fast3D/gfx_pc.h @@ -14,6 +14,8 @@ #define SCREEN_WIDTH 320 #define SCREEN_HEIGHT 240 +extern std::string gfxFramebuffer; + struct GfxRenderingAPI; struct GfxWindowManagerAPI; diff --git a/libultraship/libultraship/libultraship.vcxproj b/libultraship/libultraship/libultraship.vcxproj index 4d7eab9b4..52df7d395 100644 --- a/libultraship/libultraship/libultraship.vcxproj +++ b/libultraship/libultraship/libultraship.vcxproj @@ -258,7 +258,6 @@ - @@ -354,7 +353,6 @@ - diff --git a/libultraship/libultraship/libultraship.vcxproj.filters b/libultraship/libultraship/libultraship.vcxproj.filters index fa5c505aa..f84250c29 100644 --- a/libultraship/libultraship/libultraship.vcxproj.filters +++ b/libultraship/libultraship/libultraship.vcxproj.filters @@ -67,9 +67,6 @@ {ccd6359f-e357-41ca-9b89-5f509dd30649} - - {94ca4b98-cee2-48e6-a88b-68b8d2fed287} - {0dca2d94-45ba-4916-b03a-1dd5f949114c} @@ -321,9 +318,6 @@ Source Files\Audio - - Source Files\CustomImpl\Environment - Source Files\CustomImpl\Utils @@ -605,9 +599,6 @@ Source Files\Lib\ImGui - - Source Files\CustomImpl\Environment - Source Files\CustomImpl\Utils