-
Notifications
You must be signed in to change notification settings - Fork 2
/
Function.cpp
50 lines (41 loc) · 1.07 KB
/
Function.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "Function.h"
#include <spdlog/sinks/ostream_sink.h>
#include "Application.h"
#include "Configuration.h"
MFMAPI void ToggleHUD_Compass()
{
auto app = Application::GetSingleton();
app->ToggleCompass();
}
MFMAPI void ToggleHUD_PlayerBar()
{
auto app = Application::GetSingleton();
app->TogglePlayerBar();
}
MFMAPI void ToggleHUD_Subtitle()
{
auto app = Application::GetSingleton();
app->ToggleSubtitle();
}
MFMAPI void ToggleUI()
{
auto app = Application::GetSingleton();
app->ToggleUI();
}
MFMAPI void ReloadConfig(char* a_msg, std::size_t a_len)
{
std::ostringstream oss;
{
auto sink = std::make_shared<spdlog::sinks::ostream_sink_mt>(oss);
sink->set_pattern("[%l] %v");
spdlog::default_logger_raw()->sinks().push_back(std::move(sink));
}
try {
Configuration::Init(false);
} catch (const std::exception&) {
// Suppress exception.
}
auto msg = oss.str();
std::memcpy(a_msg, msg.c_str(), std::min(msg.size() + 1, a_len));
spdlog::default_logger_raw()->sinks().pop_back();
}