From 6d2e1a603f9aff76f4cf02c22788ace358bed134 Mon Sep 17 00:00:00 2001 From: KiritoDev <36680385+KiritoDv@users.noreply.github.com> Date: Wed, 11 May 2022 13:00:04 -0500 Subject: [PATCH] Fixed windows build --- libultraship/libultraship/GameOverlay.cpp | 4 ++-- .../libultraship/Lib/Fast3D/gfx_direct3d11.cpp | 2 +- soh/soh/Enhancements/debugconsole.cpp | 12 +++--------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/libultraship/libultraship/GameOverlay.cpp b/libultraship/libultraship/GameOverlay.cpp index a8438643f..f514599b1 100644 --- a/libultraship/libultraship/GameOverlay.cpp +++ b/libultraship/libultraship/GameOverlay.cpp @@ -13,7 +13,7 @@ void Ship::GameOverlay::LoadFont(const std::string& name, const std::string& pat ImGuiIO& io = ImGui::GetIO(); std::shared_ptr base = GlobalCtx2::GetInstance()->GetResourceManager()->GetArchive(); std::shared_ptr font = std::make_shared(); - base->LoadFile(normalize(path), false, font); + base->LoadFile(path, false, font); if (font->bIsLoaded) { char* font_data = new char[font->dwBufferSize]; memcpy(font_data, font->buffer.get(), font->dwBufferSize); @@ -65,7 +65,7 @@ ImVec2 Ship::GameOverlay::CalculateTextSize(const char* text, const char* text_e text_display_end = text_end; GameOverlay* overlay = SohImGui::overlay; - + ImFont* font = overlay->CurrentFont == "Default" ? g.Font : overlay->Fonts[overlay->CurrentFont]; const float font_size = font->FontSize; if (text == text_display_end) diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_direct3d11.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_direct3d11.cpp index 448c90735..4664a0faa 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_direct3d11.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_direct3d11.cpp @@ -1027,7 +1027,7 @@ struct GfxRenderingAPI gfx_direct3d11_api = { gfx_d3d11_get_framebuffer_texture_id, gfx_d3d11_select_texture_fb, gfx_d3d11_delete_texture, - gfx_d3d11_set_texture_filter, + gfx_d3d11_set_texture_filter, gfx_d3d11_get_texture_filter }; diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index 94b230cd1..60375d440 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -7,6 +7,8 @@ #define PATH_HACK #include #include + +#include "Lib/ImGui/imgui_internal.h" #undef PATH_HACK #undef Path @@ -421,14 +423,6 @@ template bool is_number(const std::string& s) { return ((std::istringstream(s) >> n >> std::ws).eof()); } -char* Strdup(const char* src) { - const unsigned len = strlen(src) + 1; - char* newstr = static_cast(malloc(len)); - if (newstr) - memcpy(newstr, src, len); - return newstr; -} - void DebugConsole_LoadCVars() { if (File::Exists("cvars.cfg")) { @@ -441,7 +435,7 @@ void DebugConsole_LoadCVars() if (cfg[1].find("\"") != std::string::npos) { std::string value(cfg[1]); value.erase(std::ranges::remove(value, '\"').begin(), value.end()); - CVar_SetString(cfg[0].c_str(), Strdup(value.c_str())); + CVar_SetString(cfg[0].c_str(), ImStrdup(value.c_str())); } if (is_number(cfg[1])) { CVar_SetFloat(cfg[0].c_str(), std::stof(cfg[1]));