25
25
#include " psapi.h"
26
26
#include " tlhelp32.h"
27
27
28
- using namespace ll ::hash;
29
- using namespace ll ::hash_literals;
30
- using namespace ll ::i18n_literals;
31
- using namespace ll ;
28
+ namespace ll {
29
+
30
+ using namespace hash ;
31
+ using namespace hash_literals ;
32
+ using namespace i18n_literals ;
32
33
33
34
namespace fs = std::filesystem;
34
35
35
- ll:: Logger ll:: logger (" LeviLamina" );
36
- std::chrono::steady_clock::time_point ll:: severStartBeginTime;
37
- std::chrono::steady_clock::time_point ll:: severStartEndTime;
36
+ Logger logger (" LeviLamina" );
37
+ std::chrono::steady_clock::time_point severStartBeginTime;
38
+ std::chrono::steady_clock::time_point severStartEndTime;
38
39
39
- namespace {
40
40
void fixCurrentDirectory () {
41
41
std::wstring path (32767 , ' \0 ' );
42
42
GetModuleFileName (nullptr , path.data (), 32767 );
@@ -105,7 +105,7 @@ void checkOtherBdsInstance() {
105
105
}
106
106
107
107
void printWelcomeMsg () {
108
- auto lock = ll:: Logger::lock ();
108
+ auto lock = Logger::lock ();
109
109
logger.info (R"( )" );
110
110
logger.info (R"( _ _ _ _ )" );
111
111
logger.info (R"( | | _____ _(_) | __ _ _ __ ___ (_)_ __ __ _ )" );
@@ -125,13 +125,12 @@ void printWelcomeMsg() {
125
125
}
126
126
127
127
void checkProtocolVersion () {
128
- auto currentProtocol = ll:: getServerProtocolVersion ();
128
+ auto currentProtocol = getServerProtocolVersion ();
129
129
if (TARGET_BDS_PROTOCOL_VERSION != currentProtocol) {
130
130
logger.warn (" ll.main.warning.protocolVersionNotMatch.1" _tr, TARGET_BDS_PROTOCOL_VERSION, currentProtocol);
131
131
logger.warn (" ll.main.warning.protocolVersionNotMatch.2" _tr);
132
132
}
133
133
}
134
- } // namespace
135
134
136
135
BOOL WINAPI ConsoleExitHandler (DWORD CEvent) {
137
136
switch (CEvent) {
@@ -165,36 +164,34 @@ void unixSignalHandler(int signum) {
165
164
}
166
165
167
166
// extern
168
- namespace ll {
169
167
extern void registerLeviCommands ();
170
168
extern void setupSimpleServerLogger ();
171
- } // namespace ll
172
169
173
170
namespace bstats {
174
171
extern void registerBStats ();
175
172
}
176
173
177
- namespace ll :: i18n {
174
+ namespace i18n {
178
175
extern std::string globalDefaultLocaleName;
179
176
}
180
177
181
178
// bugfix
182
- namespace ll :: bugfix {
179
+ namespace bugfix {
183
180
extern void enableArrayTagBugFix ();
184
- } // namespace ll:: bugfix
181
+ } // namespace bugfix
185
182
void setupBugFixes () {
186
- auto & bugfixSettings = ll:: globalConfig.modules .tweak .bugfixes ;
187
- using namespace ll :: bugfix;
183
+ auto & bugfixSettings = globalConfig.modules .tweak .bugfixes ;
184
+ using namespace bugfix ;
188
185
if (bugfixSettings.fixArrayTagCompareBug ) {
189
186
enableArrayTagBugFix ();
190
187
}
191
188
}
192
189
193
190
void startCrashLogger () {
194
191
#if !LL_BUILTIN_CRASHLOGGER
195
- ll:: CrashLogger::initCrashLogger (ll:: globalConfig.modules .crashLogger .enabled );
192
+ CrashLogger::initCrashLogger (globalConfig.modules .crashLogger .enabled );
196
193
#else
197
- static ll:: CrashLoggerNew crashLogger{};
194
+ static CrashLoggerNew crashLogger{};
198
195
#endif
199
196
}
200
197
@@ -211,13 +208,13 @@ void leviLaminaMain() {
211
208
std::error_code ec;
212
209
fs::create_directories (" plugins" , ec);
213
210
214
- ll:: i18n::load (" plugins/LeviLamina/LangPack" );
211
+ i18n::load (" plugins/LeviLamina/LangPack" );
215
212
216
- ll:: loadLeviConfig ();
213
+ loadLeviConfig ();
217
214
218
215
// Update default language
219
- if (ll:: globalConfig.language != " system" ) {
220
- i18n::globalDefaultLocaleName = ll:: globalConfig.language ;
216
+ if (globalConfig.language != " system" ) {
217
+ i18n::globalDefaultLocaleName = globalConfig.language ;
221
218
}
222
219
223
220
checkProtocolVersion ();
@@ -226,9 +223,9 @@ void leviLaminaMain() {
226
223
setupBugFixes ();
227
224
fixCurrentDirectory ();
228
225
229
- if (ll:: globalConfig.modules .checkRunningBDS ) checkOtherBdsInstance ();
226
+ if (globalConfig.modules .checkRunningBDS ) checkOtherBdsInstance ();
230
227
231
- if (ll:: globalConfig.modules .crashLogger .enabled ) {
228
+ if (globalConfig.modules .crashLogger .enabled ) {
232
229
startCrashLogger ();
233
230
}
234
231
@@ -243,9 +240,9 @@ void leviLaminaMain() {
243
240
logger.warn (" ll.main.warning.inDebugMode" _tr);
244
241
#endif
245
242
246
- // if (ll:: globalConfig.enableAddonsHelper) InitAddonsHelper();
243
+ // if (globalConfig.enableAddonsHelper) InitAddonsHelper();
247
244
248
- ll:: plugin::PluginManager::getInstance ().loadAllPlugins ();
245
+ plugin::PluginManager::getInstance ().loadAllPlugins ();
249
246
250
247
registerLeviCommands ();
251
248
@@ -263,14 +260,14 @@ LL_AUTO_STATIC_HOOK(LeviLaminaMainHook, HookPriority::Normal, "main", int, int a
263
260
for (int i = 0 ; i < argc; ++i) {
264
261
switch (do_hash (argv[i])) {
265
262
case " --noColor" _h:
266
- ll:: globalConfig.logger .colorLog = false ;
263
+ globalConfig.logger .colorLog = false ;
267
264
break ;
268
265
case " -v" _h:
269
266
case " --version" _h:
270
- fmt::print (" {}" , ll:: getBdsVersion ().to_string ());
267
+ fmt::print (" {}" , getBdsVersion ().to_string ());
271
268
return 0 ;
272
269
case " --protocolversion" _h:
273
- fmt::print (" {}" , ll:: getServerProtocolVersion ());
270
+ fmt::print (" {}" , getServerProtocolVersion ());
274
271
return 0 ;
275
272
default :
276
273
break ;
@@ -282,5 +279,6 @@ LL_AUTO_STATIC_HOOK(LeviLaminaMainHook, HookPriority::Normal, "main", int, int a
282
279
getServerStatus () = ServerStatus::Default;
283
280
return res;
284
281
}
282
+ } // namespace ll
285
283
286
284
[[maybe_unused]] BOOL WINAPI DllMain (HMODULE, DWORD, LPVOID) { return true ; }
0 commit comments