Skip to content
This repository was archived by the owner on Apr 29, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class StormEngine(ConanFile):

# dependencies used in deploy binaries
# conan-center
requires = ["zlib/1.2.13", "spdlog/1.9.2", "fast_float/3.4.0", "mimalloc/2.0.3", "sentry-native/0.5.0",
requires = ["zlib/1.2.13", "spdlog/1.12.0", "fast_float/5.2.0", "mimalloc/2.1.2", "sentry-native/0.6.5",
# storm.jfrog.io
"directx/9.0@storm/prebuilt", "fmod/2.02.05@storm/prebuilt"]
# aux dependencies (e.g. for tests)
Expand Down Expand Up @@ -64,10 +64,7 @@ def imports(self):
self.__install_lib("steam_api64.dll")

self.__install_bin("mimalloc-redirect.dll")
if self.settings.build_type == "Debug":
self.__install_bin("mimalloc-debug.dll")
else:
self.__install_bin("mimalloc.dll")
self.__install_bin("mimalloc.dll")

else: # not Windows
if self.settings.build_type == "Debug":
Expand Down
42 changes: 0 additions & 42 deletions src/apps/engine/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,29 +55,6 @@ void RunFrameWithOverflowCheck()
#define RunFrameWithOverflowCheck RunFrame
#endif

void mimalloc_fun(const char *msg, void *arg)
{
static std::filesystem::path mimalloc_log_path;
if (mimalloc_log_path.empty())
{
mimalloc_log_path = fs::GetLogsPath() / "mimalloc.log";
std::error_code ec;
remove(mimalloc_log_path, ec);
}

FILE *mimalloc_log =
#ifdef _MSC_VER
_wfopen(mimalloc_log_path.c_str(), L"a+b");
#else
fopen(mimalloc_log_path.c_str(), "a+b");
#endif
if (mimalloc_log != nullptr)
{
fputs(msg, mimalloc_log);
fclose(mimalloc_log);
}
}

} // namespace

void HandleWindowEvent(const storm::OSWindow::Event &event)
Expand Down Expand Up @@ -129,19 +106,6 @@ int main(int argc, char *argv[])
return EXIT_SUCCESS;
}
#endif
mi_register_output(mimalloc_fun, nullptr);
mi_option_set(mi_option_show_errors, 1);
mi_option_set(mi_option_show_stats, 0);
mi_option_set(mi_option_eager_commit, 1);
mi_option_set(mi_option_eager_region_commit, 1);
mi_option_set(mi_option_large_os_pages, 1);
mi_option_set(mi_option_page_reset, 0);
mi_option_set(mi_option_segment_reset, 0);
mi_option_set(mi_option_reserve_huge_os_pages, 1);
mi_option_set(mi_option_segment_cache, 16);
#ifdef _DEBUG
mi_option_set(mi_option_verbose, 4);
#endif

SDL_InitSubSystem(SDL_INIT_EVENTS | SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER);

Expand Down Expand Up @@ -255,12 +219,6 @@ int main(int argc, char *argv[])
{
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}

if (core.Controls && core.Controls->GetDebugAsyncKeyState(VK_F1) && core.Controls->GetDebugAsyncKeyState(VK_SHIFT))
{
mi_stats_print_out(mimalloc_fun, nullptr);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}

// Release
Expand Down
2 changes: 1 addition & 1 deletion src/libs/core/src/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,7 @@ bool DATA::Plus(DATA *pV)
Set(sValue + std::to_string(pV->lValue));
break;
case VAR_FLOAT:
Set(sValue + fmt::format("{}", pV->fValue));
Set(sValue + std::format("{}", pV->fValue));
break;
case VAR_STRING:
Set(sValue + pV->sValue);
Expand Down
4 changes: 2 additions & 2 deletions src/libs/core/src/message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <algorithm>

#include <fmt/format.h>
#include <format>

void MESSAGE::Move2Start()
{
Expand Down Expand Up @@ -208,6 +208,6 @@ storm::MessageParam MESSAGE::GetParamValue(const char c, va_list&args)
return std::string(ptr);
}
default:
throw std::runtime_error(fmt::format("Unknown message format: '{}'", c));
throw std::runtime_error(std::format("Unknown message format: '{}'", c));
}
}
146 changes: 0 additions & 146 deletions src/libs/diagnostics/src/spdlog_sinks/file_helper.cpp

This file was deleted.

55 changes: 0 additions & 55 deletions src/libs/diagnostics/src/spdlog_sinks/file_helper.hpp

This file was deleted.

12 changes: 2 additions & 10 deletions src/libs/diagnostics/src/spdlog_sinks/syncable_sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,9 @@ void storm::logging::sinks::syncable_sink::set_formatter(std::unique_ptr<spdlog:
formatter_ = std::move(sink_formatter);
}

void storm::logging::sinks::syncable_sink::sync() const
void storm::logging::sinks::syncable_sink::sync()
{
#ifdef _WIN32
const auto success = FlushFileBuffers(reinterpret_cast<HANDLE>(_get_osfhandle(_fileno(file_helper_.getfd()))));
if (!success)
{
OutputDebugStringA(std::format("failed to flush:{} ({})", file_helper_.filename(), GetLastError()).c_str());
}
#else
fsync(fileno(file_helper_.getfd()));
#endif
file_helper_.sync();
}

void storm::logging::sinks::syncable_sink::terminate_immediately()
Expand Down
10 changes: 3 additions & 7 deletions src/libs/diagnostics/src/spdlog_sinks/syncable_sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
#include <spdlog/common.h>
#include <spdlog/details/log_msg.h>
#include <spdlog/sinks/sink.h>

// TODO: write own helper or patch spdlog to retrieve fd (protected or getter)
// this is basically spdlog::details::file_helper with additional getfd method
// this may break down after spdlog update
#include "file_helper.hpp"
#include <spdlog/details/file_helper.h>

namespace storm::logging::sinks
{
Expand All @@ -28,12 +24,12 @@ class syncable_sink final : public spdlog::sinks::sink
void set_pattern(const std::string &pattern) override;
void set_formatter(std::unique_ptr<spdlog::formatter> sink_formatter) override;

void sync() const;
void sync();
void terminate_immediately();

protected:
std::unique_ptr<spdlog::formatter> formatter_;
details::file_helper file_helper_;
spdlog::details::file_helper file_helper_;
};

} // namespace storm::spdlog_sinks
4 changes: 2 additions & 2 deletions src/libs/dialog/src/legacy_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ uint64_t LegacyDialog::ProcessMessage(MESSAGE &msg)
const auto last_name_attr = core.Entity_GetAttribute(charId, "lastname");
const std::string_view name = name_attr ? name_attr : "";
const std::string_view last_name = last_name_attr ? last_name_attr : "";
characterName_ = fmt::format("{} {}", name, last_name);
characterName_ = std::format("{} {}", name, last_name);
std::transform(characterName_.begin(), characterName_.end(), characterName_.begin(), ::toupper);
break;
}
Expand Down Expand Up @@ -480,7 +480,7 @@ void LegacyDialog::SetAction(std::string action)

void LegacyDialog::UpdateHeadModel(const std::string &headModelPath)
{
const std::string newHeadModelPath = fmt::format("Heads/{}", headModelPath);
const std::string newHeadModelPath = std::format("Heads/{}", headModelPath);

if (headModelPath_ != newHeadModelPath)
{
Expand Down
4 changes: 2 additions & 2 deletions src/libs/geometry/src/geom_static.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Import library main file

#include <cstdint>
#include <cstring>
#include <fmt/format.h>
#include <format>
#include <vector>

#include "../../util/include/string_compare.hpp"
Expand Down Expand Up @@ -210,7 +210,7 @@ GEOM::GEOM(const char *fname, const char *lightname, GEOM_SERVICE &_srv, int32_t
});
if (!valid)
{
throw std::runtime_error(fmt::format("Detected invalid collision data while loading file '{}'", fname));
throw std::runtime_error(std::format("Detected invalid collision data while loading file '{}'", fname));
}
}
}
Expand Down
Loading