mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Before, we had to do a hack of capturing the command line using GetCommandLineA, and then checking if a certain argument is present. This was required due to how early the GameSDK dll was loaded (the g_CmdLine object was far from initialized in the engine). Due to the loader refactor, the commandline can be used directly after creation in the game's entry point (which is the time the SDK is getting loaded). Therefore, no copies of the command line are required anymore. This commit contains the following changes: - Correctly ordered the initialization, and deinitialization of systems (first init = last shutdown). - Factored out command line string copy in favor of game's implementation. - Factored the R5Reloaded emblem print into its own function. - Removed 'SpdLog_PostInit()', we can now directly call DevMsg() once SpdLog_Init() has been called, the logger callback sink deals with the formatting of the output. - Fixed a bug where the logger did not print the correct color for 'SYSTEM_WARNING' and 'SYSTEM_ERROR' in the external console. - Fixed a bug where the command line did not work when the game wasn't launched with the '-launcher' parameter. - Logs now equally appear on the external, and in-game console windows.
29 lines
1.1 KiB
C++
29 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <sstream>
|
|
#include "thirdparty/spdlog/spdlog.h"
|
|
#include "thirdparty/spdlog/async.h"
|
|
#include "thirdparty/spdlog/sinks/ostream_sink.h"
|
|
#include "thirdparty/spdlog/sinks/basic_file_sink.h"
|
|
#include "thirdparty/spdlog/sinks/stdout_sinks.h"
|
|
#include "thirdparty/spdlog/sinks/stdout_color_sinks.h"
|
|
#include "thirdparty/spdlog/sinks/ansicolor_sink.h"
|
|
#include "thirdparty/spdlog/sinks/rotating_file_sink.h"
|
|
|
|
constexpr int SPDLOG_MAX_SIZE = 10 * 1024 * 1024; // Sets number of bytes before rotating logger.
|
|
constexpr int SPDLOG_NUM_FILE = 512; // Sets number of files to rotate to.
|
|
|
|
inline bool g_bSpdLog_UseAnsiClr = false;
|
|
|
|
extern std::shared_ptr<spdlog::logger> g_TermLogger;
|
|
extern std::shared_ptr<spdlog::logger> g_ImGuiLogger;
|
|
|
|
//-------------------------------------------------------------------------
|
|
// IMGUI CONSOLE SINK |
|
|
extern std::ostringstream g_LogStream;
|
|
extern std::shared_ptr<spdlog::sinks::ostream_sink_st> g_LogSink;
|
|
|
|
void SpdLog_Init(const bool bAnsiColor);
|
|
void SpdLog_Create(void);
|
|
void SpdLog_Shutdown(void);
|