Skip to content
Merged
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
20 changes: 0 additions & 20 deletions CMake/logging.cmake

This file was deleted.

4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ set(GAME_STR "MM")
project(2s2h VERSION 3.0.1 LANGUAGES C CXX)
include(CMake/2ship-cvars.cmake)
include(CMake/lus-cvars.cmake)
include(CMake/logging.cmake)
set(SPDLOG_LEVEL_TRACE 0)
set(SPDLOG_LEVEL_OFF 6)
set(SPDLOG_MIN_CUTOFF SPDLOG_LEVEL_TRACE CACHE STRING "cutoff at trace")
set(PROJECT_BUILD_NAME "Mion Bravo" CACHE STRING "" FORCE)
set(PROJECT_TEAM "github.com/harbourmasters" CACHE STRING "" FORCE)

Expand Down
2 changes: 1 addition & 1 deletion libultraship
11 changes: 9 additions & 2 deletions mm/2s2h/BenGui/BenMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ static const std::vector<const char*> debugSaveOptions = {
"Empty save", // DEBUG_SAVE_INFO_NONE
};

#ifdef _DEBUG
DebugLogOption defaultLogLevel = DEBUG_LOG_TRACE;
#else
DebugLogOption defaultLogLevel = DEBUG_LOG_INFO;
#endif

static const std::vector<const char*> logLevels = {
"Trace", // DEBUG_LOG_TRACE
"Debug", // DEBUG_LOG_DEBUG
Expand Down Expand Up @@ -1690,10 +1696,11 @@ void BenMenu::AddDevTools() {
.Options(ComboboxOptions()
.Tooltip("The log level determines which messages are printed to the "
"console. This does not affect the log file output.")
.ComboVec(&logLevels))
.ComboVec(&logLevels)
.DefaultIndex(defaultLogLevel))
.Callback([](WidgetInfo& info) {
Ship::Context::GetInstance()->GetLogger()->set_level(
(spdlog::level::level_enum)CVarGetInteger("gDeveloperTools.LogLevel", 1));
(spdlog::level::level_enum)CVarGetInteger("gDeveloperTools.LogLevel", defaultLogLevel));
})
.PreFunc([](WidgetInfo& info) { info.isHidden = mBenMenu->disabledMap.at(DISABLE_FOR_DEBUG_MODE_OFF).active; });
AddWidget(path, "Frame Advance", WIDGET_CHECKBOX)
Expand Down
18 changes: 8 additions & 10 deletions mm/2s2h/BenPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,17 @@ OTRGlobals::OTRGlobals() {

context = Ship::Context::CreateUninitializedInstance("2 Ship 2 Harkinian", appShortName, "2ship2harkinian.json");
context->InitFileDropMgr();
context->InitLogging();
context->InitGfxDebugger();
context->InitConfiguration();
context->InitConsoleVariables();
#if (_DEBUG)
auto defaultLogLevel = spdlog::level::trace;
#else
auto defaultLogLevel = spdlog::level::info;
#endif
auto logLevel = (spdlog::level::level_enum)CVarGetInteger("gDeveloperTools.LogLevel", defaultLogLevel);
context->InitLogging(logLevel, logLevel);
Ship::Context::GetInstance()->GetLogger()->set_pattern("[%H:%M:%S.%e] [%s:%#] [%l] %v");

// tell LUS to reserve 3 SoH specific threads (Game, Audio, Save)
context->InitResourceManager(archiveFiles, {}, 3);
Expand All @@ -195,15 +202,6 @@ OTRGlobals::OTRGlobals() {
context->InitWindow(benFast3dWindow);

// Override LUS defaults
#if (_DEBUG)
int defaultLogLevel = 0;
#else
int defaultLogLevel = 2;
#endif
Ship::Context::GetInstance()->GetLogger()->set_level(
(spdlog::level::level_enum)CVarGetInteger("gDeveloperTools.LogLevel", defaultLogLevel));
Ship::Context::GetInstance()->GetLogger()->set_pattern("[%H:%M:%S.%e] [%s:%#] [%l] %v");

auto overlay = context->GetInstance()->GetWindow()->GetGui()->GetGameOverlay();
overlay->LoadFont("Press Start 2P", 12.0f, "fonts/PressStart2P-Regular.ttf");
overlay->LoadFont("Fipps", 32.0f, "fonts/Fipps-Regular.otf");
Expand Down
24 changes: 14 additions & 10 deletions mm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,48 +251,52 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
"ENABLE_DX11;"
">"
"$<$<CONFIG:Release>:"
"NDEBUG"
"NDEBUG;"
">"
#"$<$<BOOL:${BUILD_CROWD_CONTROL}>:ENABLE_CROWD_CONTROL>"
"INCLUDE_GAME_PRINTF;"
#"ENABLE_CROWD_CONTROL;"
"F3DEX_GBI_2"
"UNICODE;"
"_UNICODE"
SPDLOG_ACTIVE_LEVEL=${SPDLOG_MIN_CUTOFF}
LOG_LEVEL_GAME_PRINTS=${SPDLOG_LEVEL_OFF}
STORMLIB_NO_AUTO_LINK
"_CRT_SECURE_NO_WARNINGS;"
NOMINMAX
)
elseif (CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
target_compile_definitions(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Debug>:"
"_DEBUG"
"_DEBUG;"
">"
"$<$<CONFIG:Release>:"
"NDEBUG"
"NDEBUG;"
">"
"F3DEX_GBI_2"
"SPDLOG_ACTIVE_LEVEL=3;"
"F3DEX_GBI_2;"
"SPDLOG_NO_THREAD_ID;"
"SPDLOG_NO_TLS;"
"STBI_NO_THREAD_LOCALS;"
SPDLOG_ACTIVE_LEVEL=${SPDLOG_MIN_CUTOFF}
LOG_LEVEL_GAME_PRINTS=${SPDLOG_LEVEL_OFF}
)
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang")
target_compile_definitions(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Debug>:"
"_DEBUG"
"_DEBUG;"
">"
"$<$<CONFIG:Release>:"
"NDEBUG"
"NDEBUG;"
">"
"F3DEX_GBI_2"
"F3DEX_GBI_2;"
# "$<$<BOOL:${BUILD_CROWD_CONTROL}>:ENABLE_CROWD_CONTROL>"
"SPDLOG_ACTIVE_LEVEL=0;"
"_CONSOLE;"
"_CRT_SECURE_NO_WARNINGS;"
"ENABLE_OPENGL;"
"UNICODE;"
"_UNICODE"
"_UNICODE;"
SPDLOG_ACTIVE_LEVEL=${SPDLOG_MIN_CUTOFF}
LOG_LEVEL_GAME_PRINTS=${SPDLOG_LEVEL_OFF}
"NON_MATCHING;"
"NON_EQUIVALENT;"
)
Expand Down
Loading