Fixed windows build

This commit is contained in:
KiritoDev 2022-05-11 13:00:04 -05:00 committed by louist103
parent 108cd8efc8
commit 6d2e1a603f
3 changed files with 6 additions and 12 deletions

View File

@ -13,7 +13,7 @@ void Ship::GameOverlay::LoadFont(const std::string& name, const std::string& pat
ImGuiIO& io = ImGui::GetIO();
std::shared_ptr<Archive> base = GlobalCtx2::GetInstance()->GetResourceManager()->GetArchive();
std::shared_ptr<File> font = std::make_shared<File>();
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);

View File

@ -7,6 +7,8 @@
#define PATH_HACK
#include <Utils/StringHelper.h>
#include <Utils/File.h>
#include "Lib/ImGui/imgui_internal.h"
#undef PATH_HACK
#undef Path
@ -421,14 +423,6 @@ template <typename Numeric> 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<char*>(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<float>(cfg[1])) {
CVar_SetFloat(cfg[0].c_str(), std::stof(cfg[1]));