├── .gitignore
├── LICENSE
├── PlataniumV3.sln
├── PlataniumV3
├── PlataniumV3.vcxproj
├── PlataniumV3.vcxproj.filters
├── include
│ └── platanium.hpp
├── lib
│ ├── curlrip.h
│ ├── cxxurl
│ │ ├── string.hpp
│ │ ├── url.cpp
│ │ └── url.hpp
│ ├── memcury.hpp
│ ├── minhook
│ │ ├── MinHook.h
│ │ ├── minhook.lib
│ │ └── old.lib
│ └── nlohmann
│ │ └── json.hpp
└── src
│ ├── aeskey.cpp
│ ├── config.cpp
│ ├── hooks.cpp
│ ├── logger.cpp
│ ├── main.cpp
│ ├── patterns.cpp
│ ├── safety.cpp
│ ├── threads.cpp
│ └── wrappers.cpp
├── PlataniumV3Launcher
├── PlataniumV3Launcher.vcxproj
├── PlataniumV3Launcher.vcxproj.filters
├── PlataniumV3Launcher.vcxproj.user
├── include
│ ├── plataniumv3gui.hpp
│ └── plataniumv3launcher.hpp
├── lib
│ ├── base64
│ │ ├── base64.cpp
│ │ └── base64.hpp
│ ├── fa_solid_900.h
│ ├── font_awesome_5.h
│ ├── glfw
│ │ ├── glfw3.h
│ │ ├── glfw3.lib
│ │ └── glfw3native.h
│ ├── imgui
│ │ ├── imconfig.h
│ │ ├── imgui.cpp
│ │ ├── imgui.h
│ │ ├── imgui_demo.cpp
│ │ ├── imgui_draw.cpp
│ │ ├── imgui_impl_glfw.cpp
│ │ ├── imgui_impl_glfw.h
│ │ ├── imgui_impl_opengl3.cpp
│ │ ├── imgui_impl_opengl3.h
│ │ ├── imgui_impl_opengl3_loader.h
│ │ ├── imgui_internal.h
│ │ ├── imgui_tables.cpp
│ │ ├── imgui_widgets.cpp
│ │ ├── imstb_rectpack.h
│ │ ├── imstb_textedit.h
│ │ └── imstb_truetype.h
│ ├── imgui_notify.h
│ ├── imguifilebrowser.h
│ ├── karlafont.h
│ ├── nlohmann
│ │ └── json.hpp
│ └── spdlog
│ │ ├── async.h
│ │ ├── async_logger-inl.h
│ │ ├── async_logger.h
│ │ ├── cfg
│ │ ├── argv.h
│ │ ├── env.h
│ │ ├── helpers-inl.h
│ │ └── helpers.h
│ │ ├── common-inl.h
│ │ ├── common.h
│ │ ├── details
│ │ ├── backtracer-inl.h
│ │ ├── backtracer.h
│ │ ├── circular_q.h
│ │ ├── console_globals.h
│ │ ├── file_helper-inl.h
│ │ ├── file_helper.h
│ │ ├── fmt_helper.h
│ │ ├── log_msg-inl.h
│ │ ├── log_msg.h
│ │ ├── log_msg_buffer-inl.h
│ │ ├── log_msg_buffer.h
│ │ ├── mpmc_blocking_q.h
│ │ ├── null_mutex.h
│ │ ├── os-inl.h
│ │ ├── os.h
│ │ ├── periodic_worker-inl.h
│ │ ├── periodic_worker.h
│ │ ├── registry-inl.h
│ │ ├── registry.h
│ │ ├── synchronous_factory.h
│ │ ├── tcp_client-windows.h
│ │ ├── tcp_client.h
│ │ ├── thread_pool-inl.h
│ │ ├── thread_pool.h
│ │ ├── udp_client-windows.h
│ │ ├── udp_client.h
│ │ └── windows_include.h
│ │ ├── fmt
│ │ ├── bin_to_hex.h
│ │ ├── bundled
│ │ │ ├── args.h
│ │ │ ├── chrono.h
│ │ │ ├── color.h
│ │ │ ├── compile.h
│ │ │ ├── core.h
│ │ │ ├── fmt.license.rst
│ │ │ ├── format-inl.h
│ │ │ ├── format.h
│ │ │ ├── locale.h
│ │ │ ├── os.h
│ │ │ ├── ostream.h
│ │ │ ├── printf.h
│ │ │ ├── ranges.h
│ │ │ ├── std.h
│ │ │ └── xchar.h
│ │ ├── chrono.h
│ │ ├── compile.h
│ │ ├── fmt.h
│ │ ├── ostr.h
│ │ ├── ranges.h
│ │ ├── std.h
│ │ └── xchar.h
│ │ ├── formatter.h
│ │ ├── fwd.h
│ │ ├── logger-inl.h
│ │ ├── logger.h
│ │ ├── pattern_formatter-inl.h
│ │ ├── pattern_formatter.h
│ │ ├── sinks
│ │ ├── android_sink.h
│ │ ├── ansicolor_sink-inl.h
│ │ ├── ansicolor_sink.h
│ │ ├── base_sink-inl.h
│ │ ├── base_sink.h
│ │ ├── basic_file_sink-inl.h
│ │ ├── basic_file_sink.h
│ │ ├── callback_sink.h
│ │ ├── daily_file_sink.h
│ │ ├── dist_sink.h
│ │ ├── dup_filter_sink.h
│ │ ├── hourly_file_sink.h
│ │ ├── kafka_sink.h
│ │ ├── mongo_sink.h
│ │ ├── msvc_sink.h
│ │ ├── null_sink.h
│ │ ├── ostream_sink.h
│ │ ├── qt_sinks.h
│ │ ├── ringbuffer_sink.h
│ │ ├── rotating_file_sink-inl.h
│ │ ├── rotating_file_sink.h
│ │ ├── sink-inl.h
│ │ ├── sink.h
│ │ ├── stdout_color_sinks-inl.h
│ │ ├── stdout_color_sinks.h
│ │ ├── stdout_sinks-inl.h
│ │ ├── stdout_sinks.h
│ │ ├── syslog_sink.h
│ │ ├── systemd_sink.h
│ │ ├── tcp_sink.h
│ │ ├── udp_sink.h
│ │ ├── win_eventlog_sink.h
│ │ ├── wincolor_sink-inl.h
│ │ └── wincolor_sink.h
│ │ ├── spdlog-inl.h
│ │ ├── spdlog.h
│ │ ├── stopwatch.h
│ │ ├── tweakme.h
│ │ └── version.h
└── src
│ ├── cipher.cpp
│ ├── config.cpp
│ ├── epic.cpp
│ ├── errors.cpp
│ ├── fortnite.cpp
│ ├── gui.cpp
│ ├── main.cpp
│ ├── parser.cpp
│ └── window.cpp
└── README.md
/PlataniumV3.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.5.33516.290
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PlataniumV3", "PlataniumV3\PlataniumV3.vcxproj", "{F24D9684-71AA-4753-B6DC-BFAAF5A34A17}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PlataniumV3Launcher", "PlataniumV3Launcher\PlataniumV3Launcher.vcxproj", "{29F2DDB5-D451-49AF-99B5-DD8AC60AED09}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|x64 = Debug|x64
13 | Debug|x86 = Debug|x86
14 | Release|x64 = Release|x64
15 | Release|x86 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {F24D9684-71AA-4753-B6DC-BFAAF5A34A17}.Debug|x64.ActiveCfg = Debug|x64
19 | {F24D9684-71AA-4753-B6DC-BFAAF5A34A17}.Debug|x64.Build.0 = Debug|x64
20 | {F24D9684-71AA-4753-B6DC-BFAAF5A34A17}.Debug|x86.ActiveCfg = Debug|Win32
21 | {F24D9684-71AA-4753-B6DC-BFAAF5A34A17}.Debug|x86.Build.0 = Debug|Win32
22 | {F24D9684-71AA-4753-B6DC-BFAAF5A34A17}.Release|x64.ActiveCfg = Release|x64
23 | {F24D9684-71AA-4753-B6DC-BFAAF5A34A17}.Release|x64.Build.0 = Release|x64
24 | {F24D9684-71AA-4753-B6DC-BFAAF5A34A17}.Release|x86.ActiveCfg = Release|Win32
25 | {F24D9684-71AA-4753-B6DC-BFAAF5A34A17}.Release|x86.Build.0 = Release|Win32
26 | {29F2DDB5-D451-49AF-99B5-DD8AC60AED09}.Debug|x64.ActiveCfg = Debug|x64
27 | {29F2DDB5-D451-49AF-99B5-DD8AC60AED09}.Debug|x64.Build.0 = Debug|x64
28 | {29F2DDB5-D451-49AF-99B5-DD8AC60AED09}.Debug|x86.ActiveCfg = Debug|Win32
29 | {29F2DDB5-D451-49AF-99B5-DD8AC60AED09}.Debug|x86.Build.0 = Debug|Win32
30 | {29F2DDB5-D451-49AF-99B5-DD8AC60AED09}.Release|x64.ActiveCfg = Release|x64
31 | {29F2DDB5-D451-49AF-99B5-DD8AC60AED09}.Release|x64.Build.0 = Release|x64
32 | {29F2DDB5-D451-49AF-99B5-DD8AC60AED09}.Release|x86.ActiveCfg = Release|Win32
33 | {29F2DDB5-D451-49AF-99B5-DD8AC60AED09}.Release|x86.Build.0 = Release|Win32
34 | EndGlobalSection
35 | GlobalSection(SolutionProperties) = preSolution
36 | HideSolutionNode = FALSE
37 | EndGlobalSection
38 | GlobalSection(ExtensibilityGlobals) = postSolution
39 | SolutionGuid = {377C8A79-8DBC-40E8-B816-74C21F7037A7}
40 | EndGlobalSection
41 | EndGlobal
42 |
--------------------------------------------------------------------------------
/PlataniumV3/PlataniumV3.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 | {830076cb-597a-4d2b-951d-085bf3fde97f}
18 |
19 |
20 | {26b0c68a-a772-4cd1-8b6f-005396d4cabb}
21 |
22 |
23 |
24 |
25 | Fichiers sources
26 |
27 |
28 | Fichiers sources
29 |
30 |
31 | Fichiers sources
32 |
33 |
34 | Fichiers sources
35 |
36 |
37 | Fichiers sources
38 |
39 |
40 | Fichiers sources
41 |
42 |
43 | Fichiers sources
44 |
45 |
46 | Fichiers sources\lib\cxxurl
47 |
48 |
49 | Fichiers sources
50 |
51 |
52 | Fichiers sources
53 |
54 |
55 |
56 |
57 | Fichiers d%27en-tête
58 |
59 |
60 | Fichiers d%27en-tête
61 |
62 |
63 |
--------------------------------------------------------------------------------
/PlataniumV3/lib/curlrip.h:
--------------------------------------------------------------------------------
1 | enum CURLcode {
2 | CURLE_BAD_FUNCTION_ARGUMENT = 43
3 | };
4 |
5 | enum CURLoption {
6 | CURLOPT_SSL_VERIFYPEER = 64,
7 | CURLOPT_SSL_VERIFYHOST = 81,
8 | CURLOPT_PROXY = 10004,
9 | CURLOPT_URL = 10002,
10 | };
--------------------------------------------------------------------------------
/PlataniumV3/lib/cxxurl/string.hpp:
--------------------------------------------------------------------------------
1 | #ifndef STRING_H
2 | #define STRING_H
3 |
4 | #include
5 | #include
6 |
7 | #ifdef ANDROID_PLATFORM
8 | namespace std
9 | {
10 | template < typename T > std::string to_string( const T& n )
11 | {
12 | std::ostringstream stm ;
13 | stm << n ;
14 | return stm.str() ;
15 | }
16 | }
17 | #endif
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/PlataniumV3/lib/minhook/minhook.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ramok0/PlataniumV3/522c8b56fdce536d3f6b4d08e7cda279249cd6f6/PlataniumV3/lib/minhook/minhook.lib
--------------------------------------------------------------------------------
/PlataniumV3/lib/minhook/old.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ramok0/PlataniumV3/522c8b56fdce536d3f6b4d08e7cda279249cd6f6/PlataniumV3/lib/minhook/old.lib
--------------------------------------------------------------------------------
/PlataniumV3/lib/nlohmann/json.hpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ramok0/PlataniumV3/522c8b56fdce536d3f6b4d08e7cda279249cd6f6/PlataniumV3/lib/nlohmann/json.hpp
--------------------------------------------------------------------------------
/PlataniumV3/src/aeskey.cpp:
--------------------------------------------------------------------------------
1 | #include "../include/platanium.hpp"
2 |
3 | std::string FAESKey::to_hex_string(void)
4 | {
5 | std::stringstream ss;
6 | ss << "0x";
7 | ss << std::hex << std::setfill('0');
8 |
9 | for (int i = 0; i < KeySize; i++)
10 | {
11 | ss << std::setw(2) << static_cast(Key[i]);
12 | }
13 |
14 | return ss.str();
15 | }
--------------------------------------------------------------------------------
/PlataniumV3/src/config.cpp:
--------------------------------------------------------------------------------
1 | #include "../include/platanium.hpp"
2 | #include
3 | #include
4 | #include
5 |
6 | bool get_config_path(std::filesystem::path& out)
7 | {
8 | char* data = GetCommandLineA();
9 |
10 | std::regex pattern(R"(-plataniumconfigpath=\"([^\"]+)\")");
11 | std::smatch match;
12 | std::string datastr = std::string(data);
13 |
14 | if (std::regex_search(datastr, match, pattern))
15 | {
16 | if (std::filesystem::exists(match[1].str()))
17 | {
18 | out = match[1].str();
19 | return true;
20 | }
21 | }
22 |
23 | return false;
24 | }
25 |
26 | void read_config(std::filesystem::path config_path)
27 | {
28 | std::ifstream stream(config_path);
29 |
30 | if (!stream.is_open()) return;
31 |
32 | nlohmann::json config = nlohmann::json::parse(stream);
33 |
34 | auto readData = [&config](std::string key, T & out) {
35 | out = config[key].get();
36 | };
37 |
38 | readData("should_check_pak", configuration::bypass_pak_checks);
39 | readData("detourURL", configuration::detourURL);
40 | readData("useProxy", configuration::useProxy);
41 | readData("disableSSL", configuration::disableSSL);
42 | readData("debug_websockets", configuration::debug_websockets);
43 | readData("forwardHost", configuration::forwardHost);
44 | readData("forwardProxy", configuration::forwardProxy);
45 | readData("dump_aes", configuration::dump_aes);
46 | int forwardPort;
47 | readData("forwardPort", forwardPort);
48 | configuration::forwardPort = std::to_string(forwardPort);
49 | }
--------------------------------------------------------------------------------
/PlataniumV3/src/logger.cpp:
--------------------------------------------------------------------------------
1 | #include "../include/platanium.hpp"
2 |
3 | void log_pointer(const char* pointerName, void* address, bool showOffset)
4 | {
5 | std::cout << std::format("[plataniumv3] - [{}] = {}", pointerName, address, showOffset) << (showOffset ? std::format(" ({})", (LPVOID)((uintptr_t)address - (uintptr_t)GetModuleHandle(0))) : "") << std::endl;
6 | }
--------------------------------------------------------------------------------
/PlataniumV3/src/main.cpp:
--------------------------------------------------------------------------------
1 | #include "../include/platanium.hpp"
2 |
3 | DWORD WINAPI Main(HMODULE hModule)
4 | {
5 | console* con = new console();
6 |
7 | std::cout << "Welcome to PlataniumV3, made by https://github.com/ramok0 !" << std::endl;
8 |
9 | std::filesystem::path config_path;
10 |
11 | if (!get_config_path(config_path))
12 | {
13 | MessageBoxA(0, "get_config_path returned false", "PlataniumV3", 0);
14 | return 1;
15 | }
16 |
17 | read_config(config_path);
18 | log_pointer("baseaddress", (LPVOID)GetModuleHandle(0));
19 | freeze_all_threads();
20 | find_patterns();
21 | assign_natives();
22 | check_version();
23 | place_hooks();
24 |
25 | resume_all_threads();
26 |
27 | //delete con;
28 | // FreeLibraryAndExitThread(hModule, 0);
29 | return 0;
30 | }
31 |
32 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved)
33 | {
34 | if (reason == DLL_PROCESS_ATTACH)
35 | {
36 | CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)Main, hModule, 0, nullptr);
37 | }
38 | return TRUE;
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/PlataniumV3/src/patterns.cpp:
--------------------------------------------------------------------------------
1 | #include "../include/platanium.hpp"
2 |
3 | #define WILDCARD UINT8_MAX
4 | #define assign(dest, address) dest = reinterpret_cast(address);
5 |
6 | void find_patterns(void)
7 | {
8 | Memcury::Scanner curl_easy_setopt = Memcury::Scanner::FindPattern(CURL_EASY_SETOPT);
9 | addresses::curl_easy_setopt = curl_easy_setopt.GetAs();
10 | log_pointer("curl_easy_setopt", addresses::curl_easy_setopt, true);
11 | addresses::curl_setopt = curl_easy_setopt.ScanFor({ Memcury::ASM::CALL }).RelativeOffset(1).GetAs();
12 | log_pointer("curl_setopt", addresses::curl_setopt, true);
13 |
14 | addresses::get_engine_version = Memcury::Scanner::FindStringRef(GET_ENGINE_VERSION).ScanFor({ 0xE8, WILDCARD,WILDCARD,WILDCARD,WILDCARD, 0x4C, 0x8B }, false).RelativeOffset(1).GetAs();
15 | log_pointer("FEngineVersion::Current", addresses::get_engine_version, true);
16 |
17 | assign(native::get_engine_version, addresses::get_engine_version);
18 |
19 | float engineVersion = GetEngineVersion();
20 |
21 | const wchar_t* RequestExitWithStatusStr = REQUEST_EXIT_WITH_STATUS;
22 |
23 | if (engineVersion >= 5.3f)
24 | {
25 | RequestExitWithStatusStr = L"Cannot find a compatible Vulkan device that supports surface presentation.\n\n";
26 | }
27 |
28 | std::cout << "Found Engine Version : " << engineVersion << std::endl;
29 |
30 | std::wcout << L"Searching String : " << RequestExitWithStatusStr << std::endl;
31 |
32 | //this is by far the best way to find this function
33 | addresses::request_exit_with_status = Memcury::Scanner::FindStringRef(RequestExitWithStatusStr).ScanFor({ 0xE8 }, true, 1).RelativeOffset(1).GetAs();
34 | log_pointer("FGenericPlatformMisc::RequestExitWithStatus", addresses::request_exit_with_status, true);
35 | if (engineVersion >= 5.3f)
36 | {
37 | addresses::unsafeenvironnement = Memcury::Scanner::FindStringRef(UNSAFE_ENVIRONNEMENT).ScanFor({ 0x40, 0x55, 0x53, 0x56 }, false).GetAs();
38 | }
39 | else {
40 | addresses::unsafeenvironnement = Memcury::Scanner::FindStringRef(UNSAFE_ENVIRONNEMENT).ScanFor({ WILDCARD, WILDCARD, WILDCARD, 0x24, WILDCARD, 0x55 }, false).GetAs();
41 | }
42 | log_pointer("UnsafeEnvironnement", addresses::unsafeenvironnement, true);
43 | if (configuration::bypass_pak_checks)
44 | {
45 | addresses::validate_container_signature = Memcury::Scanner::FindPattern("E8 ? ? ? ? 44 39 75 90 0F 85 ? ? ? ?").RelativeOffset(1).GetAs();
46 | log_pointer("validate_container_signature", addresses::validate_container_signature, true);
47 | }
48 |
49 | if (configuration::debug_websockets)
50 | {
51 | addresses::lws_client_connect_via_info = Memcury::Scanner::FindPattern("48 89 74 24 ? 57 48 83 EC 20 48 8B 71 30 48 8B F9").GetAs();
52 | log_pointer("lws_client_connect_via_info", addresses::lws_client_connect_via_info, true);
53 | addresses::lws_create_context = Memcury::Scanner::FindPattern("40 57 48 83 EC 40 48 8B F9").GetAs();
54 | log_pointer("lws_create_context", addresses::lws_create_context, true);
55 | }
56 |
57 | if (configuration::dump_aes)
58 | {
59 | addresses::decrypt_data = Memcury::Scanner::FindPattern("48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 20 49 8B D8 48 8B FA 48 8B F1 E8 ? ? ? ? 4C 8B C7").GetAs();
60 | log_pointer("FAES::DecryptData", addresses::decrypt_data, true);
61 | }
62 | }
63 |
64 | void assign_natives(void)
65 | {
66 | assign(native::curl_easy_setopt, addresses::curl_easy_setopt);
67 | assign(native::curl_setopt, addresses::curl_setopt);
68 | assign(native::request_exit_with_status, addresses::request_exit_with_status);
69 | assign(native::unsafe_environnement, addresses::unsafeenvironnement);
70 | assign(native::ValidateContainerSignature, addresses::validate_container_signature);
71 |
72 | assign(native::DecryptData, addresses::decrypt_data);
73 | if (configuration::debug_websockets)
74 | {
75 | assign(native::lws_create_context, addresses::lws_create_context);
76 | assign(native::lws_client_connect_via_info, addresses::lws_client_connect_via_info);
77 | }
78 | }
--------------------------------------------------------------------------------
/PlataniumV3/src/safety.cpp:
--------------------------------------------------------------------------------
1 | #include "../include/platanium.hpp"
2 | #include
3 |
4 | bool is_supported_version(void)
5 | {
6 | const std::array SUPPORTED_VERSIONS = { 5.1f, 5.11f, 5.2f };
7 | float current_version = GetEngineVersion();
8 |
9 |
10 | return std::find(SUPPORTED_VERSIONS.begin(), SUPPORTED_VERSIONS.end(), current_version) != SUPPORTED_VERSIONS.end();
11 | }
12 |
13 | void check_version(void)
14 | {
15 | if (!is_supported_version())
16 | {
17 | std::stringstream ss;
18 | ss << "[plataniumv3] - warning : this version of the engine (" << GetEngineVersion() << ") may be unsupported" << std::endl;
19 |
20 | MessageBoxA(0, ss.str().c_str(), "PlataniumV3", 0);
21 | }
22 | }
--------------------------------------------------------------------------------
/PlataniumV3/src/threads.cpp:
--------------------------------------------------------------------------------
1 | #include "../include/platanium.hpp"
2 |
3 | void freeze_all_threads(void)
4 | {
5 | HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, GetCurrentProcessId());
6 |
7 | THREADENTRY32 entry;
8 | entry.dwSize = sizeof(entry);
9 |
10 | DWORD currentThreadId = GetCurrentThreadId();
11 | DWORD currentProcessId = GetCurrentProcessId();
12 |
13 | if (Thread32First(snapshot, &entry))
14 | {
15 | while (Thread32Next(snapshot, &entry))
16 | {
17 | if (entry.th32ThreadID == currentThreadId || entry.th32OwnerProcessID != currentProcessId) continue;
18 | HANDLE threadHandle = OpenThread(THREAD_ALL_ACCESS, false, entry.th32ThreadID);
19 | SuspendThread(threadHandle);
20 | CloseHandle(threadHandle);
21 | }
22 | }
23 |
24 | CloseHandle(snapshot);
25 | }
26 |
27 | void resume_all_threads(void)
28 | {
29 | HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, GetCurrentProcessId());
30 |
31 | THREADENTRY32 entry;
32 | entry.dwSize = sizeof(entry);
33 |
34 | DWORD currentThreadId = GetCurrentThreadId();
35 | DWORD currentProcessId = GetCurrentProcessId();
36 |
37 | if (Thread32First(snapshot, &entry))
38 | {
39 | while (Thread32Next(snapshot, &entry))
40 | {
41 | if (entry.th32ThreadID == currentThreadId || entry.th32OwnerProcessID != currentProcessId) continue;
42 | HANDLE threadHandle = OpenThread(THREAD_ALL_ACCESS, false, entry.th32ThreadID);
43 | ResumeThread(threadHandle);
44 | CloseHandle(threadHandle);
45 | }
46 | }
47 |
48 | CloseHandle(snapshot);
49 | }
--------------------------------------------------------------------------------
/PlataniumV3/src/wrappers.cpp:
--------------------------------------------------------------------------------
1 | #include "../include/platanium.hpp"
2 |
3 | float GetEngineVersion()
4 | {
5 | FEngineVersionBase* version = (FEngineVersionBase*)native::get_engine_version();
6 | float engineVersion = (float)version->Major + ((float)version->Minor / 10.0f) + ((float)version->Patch / 100.f);
7 |
8 | return engineVersion;
9 | }
10 |
11 | CURLcode curl_setopt(void* handle, CURLoption opt, ...)
12 | {
13 | va_list arg;
14 | va_start(arg, opt);
15 |
16 | CURLcode result = native::curl_setopt(handle, opt, arg);
17 |
18 | va_end(arg);
19 |
20 | return result;
21 | }
--------------------------------------------------------------------------------
/PlataniumV3Launcher/PlataniumV3Launcher.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 | {0b5d647e-3b1c-4140-9262-9ec816ba6555}
18 |
19 |
20 |
21 |
22 | Fichiers d%27en-tête
23 |
24 |
25 | Fichiers d%27en-tête
26 |
27 |
28 |
29 |
30 | Fichiers sources
31 |
32 |
33 | Fichiers sources\lib
34 |
35 |
36 | Fichiers sources\lib
37 |
38 |
39 | Fichiers sources\lib
40 |
41 |
42 | Fichiers sources\lib
43 |
44 |
45 | Fichiers sources\lib
46 |
47 |
48 | Fichiers sources\lib
49 |
50 |
51 | Fichiers sources\lib
52 |
53 |
54 | Fichiers sources
55 |
56 |
57 | Fichiers sources
58 |
59 |
60 | Fichiers sources
61 |
62 |
63 | Fichiers sources
64 |
65 |
66 | Fichiers sources
67 |
68 |
69 | Fichiers sources
70 |
71 |
72 | Fichiers sources
73 |
74 |
75 | Fichiers sources\lib
76 |
77 |
78 | Fichiers sources
79 |
80 |
81 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/PlataniumV3Launcher.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/include/plataniumv3gui.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifndef __PLATANIUMV3GUI__
4 | #define __PLATANIUMV3GUI__
5 |
6 | #include "plataniumv3launcher.hpp"
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | #include
17 | #include
18 |
19 | #pragma comment(lib, "lib/glfw/glfw3.lib")
20 |
21 | //constants
22 | const int WINDOW_WIDTH = 800;
23 | const int WINDOW_HEIGHT = 600;
24 | constexpr const char* WINDOW_TITLE = "PlataniumV3 Launcher";
25 | constexpr ImGuiWindowFlags WINDOW_FLAGS = ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoCollapse;
26 |
27 |
28 | /*
29 | window related functions
30 | */
31 |
32 | //get window title
33 | const std::string get_window_title(void);
34 | //render epicgameslogin form
35 | void render_epic_games_login_form(void);
36 | //render main form
37 | void render_main_form(void);
38 | //init glfw and create window
39 | bool create_window(GLFWwindow** lpWindow);
40 | //init imgui
41 | void initialize_imgui(GLFWwindow* window);
42 | //init styles
43 | void initialize_styles(void);
44 | //draw the content
45 | void window_loop(GLFWwindow* window);
46 | //render the elements
47 | void gui_render(void);
48 | //cleanup memory & libraries
49 | void cleanup_window(GLFWwindow* window);
50 |
51 | #endif
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/base64/base64.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ramok0/PlataniumV3/522c8b56fdce536d3f6b4d08e7cda279249cd6f6/PlataniumV3Launcher/lib/base64/base64.cpp
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/base64/base64.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // base64 encoding and decoding with C++.
3 | // Version: 2.rc.09 (release candidate)
4 | //
5 |
6 | #ifndef BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A
7 | #define BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A
8 |
9 | #include
10 |
11 | #if __cplusplus >= 201703L
12 | #include
13 | #endif // __cplusplus >= 201703L
14 |
15 | std::string base64_encode(std::string const& s, bool url = false);
16 | std::string base64_encode_pem(std::string const& s);
17 | std::string base64_encode_mime(std::string const& s);
18 |
19 | std::string base64_decode(std::string const& s, bool remove_linebreaks = false);
20 | std::string base64_encode(unsigned char const*, size_t len, bool url = false);
21 |
22 | #if __cplusplus >= 201703L
23 | //
24 | // Interface with std::string_view rather than const std::string&
25 | // Requires C++17
26 | // Provided by Yannic Bonenberger (https://github.com/Yannic)
27 | //
28 | std::string base64_encode(std::string_view s, bool url = false);
29 | std::string base64_encode_pem(std::string_view s);
30 | std::string base64_encode_mime(std::string_view s);
31 |
32 | std::string base64_decode(std::string_view s, bool remove_linebreaks = false);
33 | #endif // __cplusplus >= 201703L
34 |
35 | #endif /* BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A */
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/glfw/glfw3.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ramok0/PlataniumV3/522c8b56fdce536d3f6b4d08e7cda279249cd6f6/PlataniumV3Launcher/lib/glfw/glfw3.lib
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/imgui/imgui_impl_glfw.h:
--------------------------------------------------------------------------------
1 | // dear imgui: Platform Backend for GLFW
2 | // This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan, WebGPU..)
3 | // (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
4 |
5 | // Implemented features:
6 | // [X] Platform: Clipboard support.
7 | // [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen/Pen (Windows only).
8 | // [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLFW_KEY_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set]
9 | // [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
10 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange' (note: the resizing cursors requires GLFW 3.4+).
11 |
12 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
13 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
14 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
15 | // Read online: https://github.com/ocornut/imgui/tree/master/docs
16 |
17 | #pragma once
18 | #include "imgui.h" // IMGUI_IMPL_API
19 |
20 | struct GLFWwindow;
21 | struct GLFWmonitor;
22 |
23 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks);
24 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks);
25 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOther(GLFWwindow* window, bool install_callbacks);
26 | IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown();
27 | IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame();
28 |
29 | // GLFW callbacks install
30 | // - When calling Init with 'install_callbacks=true': ImGui_ImplGlfw_InstallCallbacks() is called. GLFW callbacks will be installed for you. They will chain-call user's previously installed callbacks, if any.
31 | // - When calling Init with 'install_callbacks=false': GLFW callbacks won't be installed. You will need to call individual function yourself from your own GLFW callbacks.
32 | IMGUI_IMPL_API void ImGui_ImplGlfw_InstallCallbacks(GLFWwindow* window);
33 | IMGUI_IMPL_API void ImGui_ImplGlfw_RestoreCallbacks(GLFWwindow* window);
34 |
35 | // GFLW callbacks options:
36 | // - Set 'chain_for_all_windows=true' to enable chaining callbacks for all windows (including secondary viewports created by backends or by user)
37 | IMGUI_IMPL_API void ImGui_ImplGlfw_SetCallbacksChainForAllWindows(bool chain_for_all_windows);
38 |
39 | // GLFW callbacks (individual callbacks to call yourself if you didn't install callbacks)
40 | IMGUI_IMPL_API void ImGui_ImplGlfw_WindowFocusCallback(GLFWwindow* window, int focused); // Since 1.84
41 | IMGUI_IMPL_API void ImGui_ImplGlfw_CursorEnterCallback(GLFWwindow* window, int entered); // Since 1.84
42 | IMGUI_IMPL_API void ImGui_ImplGlfw_CursorPosCallback(GLFWwindow* window, double x, double y); // Since 1.87
43 | IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
44 | IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset);
45 | IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
46 | IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c);
47 | IMGUI_IMPL_API void ImGui_ImplGlfw_MonitorCallback(GLFWmonitor* monitor, int event);
48 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/imgui/imgui_impl_opengl3.h:
--------------------------------------------------------------------------------
1 | // dear imgui: Renderer Backend for modern OpenGL with shaders / programmatic pipeline
2 | // - Desktop GL: 2.x 3.x 4.x
3 | // - Embedded GL: ES 2.0 (WebGL 1.0), ES 3.0 (WebGL 2.0)
4 | // This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..)
5 |
6 | // Implemented features:
7 | // [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID!
8 | // [x] Renderer: Large meshes support (64k+ vertices) with 16-bit indices (Desktop OpenGL only).
9 |
10 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
11 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
12 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
13 | // Read online: https://github.com/ocornut/imgui/tree/master/docs
14 |
15 | // About GLSL version:
16 | // The 'glsl_version' initialization parameter should be nullptr (default) or a "#version XXX" string.
17 | // On computer platform the GLSL version default to "#version 130". On OpenGL ES 3 platform it defaults to "#version 300 es"
18 | // Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp.
19 |
20 | #pragma once
21 | #include "imgui.h" // IMGUI_IMPL_API
22 |
23 | // Backend API
24 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = nullptr);
25 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown();
26 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame();
27 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data);
28 |
29 | // (Optional) Called by Init/NewFrame/Shutdown
30 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateFontsTexture();
31 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyFontsTexture();
32 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects();
33 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects();
34 |
35 | // Specific OpenGL ES versions
36 | //#define IMGUI_IMPL_OPENGL_ES2 // Auto-detected on Emscripten
37 | //#define IMGUI_IMPL_OPENGL_ES3 // Auto-detected on iOS/Android
38 |
39 | // You can explicitly select GLES2 or GLES3 API by using one of the '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line.
40 | #if !defined(IMGUI_IMPL_OPENGL_ES2) \
41 | && !defined(IMGUI_IMPL_OPENGL_ES3)
42 |
43 | // Try to detect GLES on matching platforms
44 | #if defined(__APPLE__)
45 | #include
46 | #endif
47 | #if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) || (defined(__ANDROID__))
48 | #define IMGUI_IMPL_OPENGL_ES3 // iOS, Android -> GL ES 3, "#version 300 es"
49 | #elif defined(__EMSCRIPTEN__) || defined(__amigaos4__)
50 | #define IMGUI_IMPL_OPENGL_ES2 // Emscripten -> GL ES 2, "#version 100"
51 | #else
52 | // Otherwise imgui_impl_opengl3_loader.h will be used.
53 | #endif
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/nlohmann/json.hpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ramok0/PlataniumV3/522c8b56fdce536d3f6b4d08e7cda279249cd6f6/PlataniumV3Launcher/lib/nlohmann/json.hpp
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/async.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | //
7 | // Async logging using global thread pool
8 | // All loggers created here share same global thread pool.
9 | // Each log message is pushed to a queue along with a shared pointer to the
10 | // logger.
11 | // If a logger deleted while having pending messages in the queue, it's actual
12 | // destruction will defer
13 | // until all its messages are processed by the thread pool.
14 | // This is because each message in the queue holds a shared_ptr to the
15 | // originating logger.
16 |
17 | #include
18 | #include
19 | #include
20 |
21 | #include
22 | #include
23 | #include
24 |
25 | namespace spdlog {
26 |
27 | namespace details {
28 | static const size_t default_async_q_size = 8192;
29 | }
30 |
31 | // async logger factory - creates async loggers backed with thread pool.
32 | // if a global thread pool doesn't already exist, create it with default queue
33 | // size of 8192 items and single thread.
34 | template
35 | struct async_factory_impl
36 | {
37 | template
38 | static std::shared_ptr create(std::string logger_name, SinkArgs &&... args)
39 | {
40 | auto ®istry_inst = details::registry::instance();
41 |
42 | // create global thread pool if not already exists..
43 |
44 | auto &mutex = registry_inst.tp_mutex();
45 | std::lock_guard tp_lock(mutex);
46 | auto tp = registry_inst.get_tp();
47 | if (tp == nullptr)
48 | {
49 | tp = std::make_shared(details::default_async_q_size, 1U);
50 | registry_inst.set_tp(tp);
51 | }
52 |
53 | auto sink = std::make_shared(std::forward(args)...);
54 | auto new_logger = std::make_shared(std::move(logger_name), std::move(sink), std::move(tp), OverflowPolicy);
55 | registry_inst.initialize_logger(new_logger);
56 | return new_logger;
57 | }
58 | };
59 |
60 | using async_factory = async_factory_impl;
61 | using async_factory_nonblock = async_factory_impl;
62 |
63 | template
64 | inline std::shared_ptr create_async(std::string logger_name, SinkArgs &&... sink_args)
65 | {
66 | return async_factory::create(std::move(logger_name), std::forward(sink_args)...);
67 | }
68 |
69 | template
70 | inline std::shared_ptr create_async_nb(std::string logger_name, SinkArgs &&... sink_args)
71 | {
72 | return async_factory_nonblock::create(std::move(logger_name), std::forward(sink_args)...);
73 | }
74 |
75 | // set global thread pool.
76 | inline void init_thread_pool(
77 | size_t q_size, size_t thread_count, std::function on_thread_start, std::function on_thread_stop)
78 | {
79 | auto tp = std::make_shared(q_size, thread_count, on_thread_start, on_thread_stop);
80 | details::registry::instance().set_tp(std::move(tp));
81 | }
82 |
83 | inline void init_thread_pool(size_t q_size, size_t thread_count, std::function on_thread_start)
84 | {
85 | init_thread_pool(q_size, thread_count, on_thread_start, [] {});
86 | }
87 |
88 | inline void init_thread_pool(size_t q_size, size_t thread_count)
89 | {
90 | init_thread_pool(
91 | q_size, thread_count, [] {}, [] {});
92 | }
93 |
94 | // get the global thread pool.
95 | inline std::shared_ptr thread_pool()
96 | {
97 | return details::registry::instance().get_tp();
98 | }
99 | } // namespace spdlog
100 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/async_logger-inl.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #ifndef SPDLOG_HEADER_ONLY
7 | # include
8 | #endif
9 |
10 | #include
11 | #include
12 |
13 | #include
14 | #include
15 |
16 | SPDLOG_INLINE spdlog::async_logger::async_logger(
17 | std::string logger_name, sinks_init_list sinks_list, std::weak_ptr tp, async_overflow_policy overflow_policy)
18 | : async_logger(std::move(logger_name), sinks_list.begin(), sinks_list.end(), std::move(tp), overflow_policy)
19 | {}
20 |
21 | SPDLOG_INLINE spdlog::async_logger::async_logger(
22 | std::string logger_name, sink_ptr single_sink, std::weak_ptr tp, async_overflow_policy overflow_policy)
23 | : async_logger(std::move(logger_name), {std::move(single_sink)}, std::move(tp), overflow_policy)
24 | {}
25 |
26 | // send the log message to the thread pool
27 | SPDLOG_INLINE void spdlog::async_logger::sink_it_(const details::log_msg &msg)
28 | {
29 | if (auto pool_ptr = thread_pool_.lock())
30 | {
31 | pool_ptr->post_log(shared_from_this(), msg, overflow_policy_);
32 | }
33 | else
34 | {
35 | throw_spdlog_ex("async log: thread pool doesn't exist anymore");
36 | }
37 | }
38 |
39 | // send flush request to the thread pool
40 | SPDLOG_INLINE void spdlog::async_logger::flush_()
41 | {
42 | if (auto pool_ptr = thread_pool_.lock())
43 | {
44 | pool_ptr->post_flush(shared_from_this(), overflow_policy_);
45 | }
46 | else
47 | {
48 | throw_spdlog_ex("async flush: thread pool doesn't exist anymore");
49 | }
50 | }
51 |
52 | //
53 | // backend functions - called from the thread pool to do the actual job
54 | //
55 | SPDLOG_INLINE void spdlog::async_logger::backend_sink_it_(const details::log_msg &msg)
56 | {
57 | for (auto &sink : sinks_)
58 | {
59 | if (sink->should_log(msg.level))
60 | {
61 | SPDLOG_TRY
62 | {
63 | sink->log(msg);
64 | }
65 | SPDLOG_LOGGER_CATCH(msg.source)
66 | }
67 | }
68 |
69 | if (should_flush_(msg))
70 | {
71 | backend_flush_();
72 | }
73 | }
74 |
75 | SPDLOG_INLINE void spdlog::async_logger::backend_flush_()
76 | {
77 | for (auto &sink : sinks_)
78 | {
79 | SPDLOG_TRY
80 | {
81 | sink->flush();
82 | }
83 | SPDLOG_LOGGER_CATCH(source_loc())
84 | }
85 | }
86 |
87 | SPDLOG_INLINE std::shared_ptr spdlog::async_logger::clone(std::string new_name)
88 | {
89 | auto cloned = std::make_shared(*this);
90 | cloned->name_ = std::move(new_name);
91 | return cloned;
92 | }
93 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/async_logger.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | // Fast asynchronous logger.
7 | // Uses pre allocated queue.
8 | // Creates a single back thread to pop messages from the queue and log them.
9 | //
10 | // Upon each log write the logger:
11 | // 1. Checks if its log level is enough to log the message
12 | // 2. Push a new copy of the message to a queue (or block the caller until
13 | // space is available in the queue)
14 | // Upon destruction, logs all remaining messages in the queue before
15 | // destructing..
16 |
17 | #include
18 |
19 | namespace spdlog {
20 |
21 | // Async overflow policy - block by default.
22 | enum class async_overflow_policy
23 | {
24 | block, // Block until message can be enqueued
25 | overrun_oldest // Discard oldest message in the queue if full when trying to
26 | // add new item.
27 | };
28 |
29 | namespace details {
30 | class thread_pool;
31 | }
32 |
33 | class SPDLOG_API async_logger final : public std::enable_shared_from_this, public logger
34 | {
35 | friend class details::thread_pool;
36 |
37 | public:
38 | template
39 | async_logger(std::string logger_name, It begin, It end, std::weak_ptr tp,
40 | async_overflow_policy overflow_policy = async_overflow_policy::block)
41 | : logger(std::move(logger_name), begin, end)
42 | , thread_pool_(std::move(tp))
43 | , overflow_policy_(overflow_policy)
44 | {}
45 |
46 | async_logger(std::string logger_name, sinks_init_list sinks_list, std::weak_ptr tp,
47 | async_overflow_policy overflow_policy = async_overflow_policy::block);
48 |
49 | async_logger(std::string logger_name, sink_ptr single_sink, std::weak_ptr tp,
50 | async_overflow_policy overflow_policy = async_overflow_policy::block);
51 |
52 | std::shared_ptr clone(std::string new_name) override;
53 |
54 | protected:
55 | void sink_it_(const details::log_msg &msg) override;
56 | void flush_() override;
57 | void backend_sink_it_(const details::log_msg &incoming_log_msg);
58 | void backend_flush_();
59 |
60 | private:
61 | std::weak_ptr thread_pool_;
62 | async_overflow_policy overflow_policy_;
63 | };
64 | } // namespace spdlog
65 |
66 | #ifdef SPDLOG_HEADER_ONLY
67 | # include "async_logger-inl.h"
68 | #endif
69 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/cfg/argv.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 | #include
6 | #include
7 |
8 | //
9 | // Init log levels using each argv entry that starts with "SPDLOG_LEVEL="
10 | //
11 | // set all loggers to debug level:
12 | // example.exe "SPDLOG_LEVEL=debug"
13 |
14 | // set logger1 to trace level
15 | // example.exe "SPDLOG_LEVEL=logger1=trace"
16 |
17 | // turn off all logging except for logger1 and logger2:
18 | // example.exe "SPDLOG_LEVEL=off,logger1=debug,logger2=info"
19 |
20 | namespace spdlog {
21 | namespace cfg {
22 |
23 | // search for SPDLOG_LEVEL= in the args and use it to init the levels
24 | inline void load_argv_levels(int argc, const char **argv)
25 | {
26 | const std::string spdlog_level_prefix = "SPDLOG_LEVEL=";
27 | for (int i = 1; i < argc; i++)
28 | {
29 | std::string arg = argv[i];
30 | if (arg.find(spdlog_level_prefix) == 0)
31 | {
32 | auto levels_string = arg.substr(spdlog_level_prefix.size());
33 | helpers::load_levels(levels_string);
34 | }
35 | }
36 | }
37 |
38 | inline void load_argv_levels(int argc, char **argv)
39 | {
40 | load_argv_levels(argc, const_cast(argv));
41 | }
42 |
43 | } // namespace cfg
44 | } // namespace spdlog
45 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/cfg/env.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 | #include
6 | #include
7 | #include
8 |
9 | //
10 | // Init levels and patterns from env variables SPDLOG_LEVEL
11 | // Inspired from Rust's "env_logger" crate (https://crates.io/crates/env_logger).
12 | // Note - fallback to "info" level on unrecognized levels
13 | //
14 | // Examples:
15 | //
16 | // set global level to debug:
17 | // export SPDLOG_LEVEL=debug
18 | //
19 | // turn off all logging except for logger1:
20 | // export SPDLOG_LEVEL="*=off,logger1=debug"
21 | //
22 |
23 | // turn off all logging except for logger1 and logger2:
24 | // export SPDLOG_LEVEL="off,logger1=debug,logger2=info"
25 |
26 | namespace spdlog {
27 | namespace cfg {
28 | inline void load_env_levels()
29 | {
30 | auto env_val = details::os::getenv("SPDLOG_LEVEL");
31 | if (!env_val.empty())
32 | {
33 | helpers::load_levels(env_val);
34 | }
35 | }
36 |
37 | } // namespace cfg
38 | } // namespace spdlog
39 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/cfg/helpers-inl.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #ifndef SPDLOG_HEADER_ONLY
7 | # include
8 | #endif
9 |
10 | #include
11 | #include
12 | #include
13 |
14 | #include
15 | #include
16 | #include
17 | #include
18 |
19 | namespace spdlog {
20 | namespace cfg {
21 | namespace helpers {
22 |
23 | // inplace convert to lowercase
24 | inline std::string &to_lower_(std::string &str)
25 | {
26 | std::transform(
27 | str.begin(), str.end(), str.begin(), [](char ch) { return static_cast((ch >= 'A' && ch <= 'Z') ? ch + ('a' - 'A') : ch); });
28 | return str;
29 | }
30 |
31 | // inplace trim spaces
32 | inline std::string &trim_(std::string &str)
33 | {
34 | const char *spaces = " \n\r\t";
35 | str.erase(str.find_last_not_of(spaces) + 1);
36 | str.erase(0, str.find_first_not_of(spaces));
37 | return str;
38 | }
39 |
40 | // return (name,value) trimmed pair from given "name=value" string.
41 | // return empty string on missing parts
42 | // "key=val" => ("key", "val")
43 | // " key = val " => ("key", "val")
44 | // "key=" => ("key", "")
45 | // "val" => ("", "val")
46 |
47 | inline std::pair extract_kv_(char sep, const std::string &str)
48 | {
49 | auto n = str.find(sep);
50 | std::string k, v;
51 | if (n == std::string::npos)
52 | {
53 | v = str;
54 | }
55 | else
56 | {
57 | k = str.substr(0, n);
58 | v = str.substr(n + 1);
59 | }
60 | return std::make_pair(trim_(k), trim_(v));
61 | }
62 |
63 | // return vector of key/value pairs from sequence of "K1=V1,K2=V2,.."
64 | // "a=AAA,b=BBB,c=CCC,.." => {("a","AAA"),("b","BBB"),("c", "CCC"),...}
65 | inline std::unordered_map extract_key_vals_(const std::string &str)
66 | {
67 | std::string token;
68 | std::istringstream token_stream(str);
69 | std::unordered_map rv{};
70 | while (std::getline(token_stream, token, ','))
71 | {
72 | if (token.empty())
73 | {
74 | continue;
75 | }
76 | auto kv = extract_kv_('=', token);
77 | rv[kv.first] = kv.second;
78 | }
79 | return rv;
80 | }
81 |
82 | SPDLOG_INLINE void load_levels(const std::string &input)
83 | {
84 | if (input.empty() || input.size() > 512)
85 | {
86 | return;
87 | }
88 |
89 | auto key_vals = extract_key_vals_(input);
90 | std::unordered_map levels;
91 | level::level_enum global_level = level::info;
92 | bool global_level_found = false;
93 |
94 | for (auto &name_level : key_vals)
95 | {
96 | auto &logger_name = name_level.first;
97 | auto level_name = to_lower_(name_level.second);
98 | auto level = level::from_str(level_name);
99 | // ignore unrecognized level names
100 | if (level == level::off && level_name != "off")
101 | {
102 | continue;
103 | }
104 | if (logger_name.empty()) // no logger name indicate global level
105 | {
106 | global_level_found = true;
107 | global_level = level;
108 | }
109 | else
110 | {
111 | levels[logger_name] = level;
112 | }
113 | }
114 |
115 | details::registry::instance().set_levels(std::move(levels), global_level_found ? &global_level : nullptr);
116 | }
117 |
118 | } // namespace helpers
119 | } // namespace cfg
120 | } // namespace spdlog
121 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/cfg/helpers.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #include
7 | #include
8 |
9 | namespace spdlog {
10 | namespace cfg {
11 | namespace helpers {
12 | //
13 | // Init levels from given string
14 | //
15 | // Examples:
16 | //
17 | // set global level to debug: "debug"
18 | // turn off all logging except for logger1: "off,logger1=debug"
19 | // turn off all logging except for logger1 and logger2: "off,logger1=debug,logger2=info"
20 | //
21 | SPDLOG_API void load_levels(const std::string &txt);
22 | } // namespace helpers
23 |
24 | } // namespace cfg
25 | } // namespace spdlog
26 |
27 | #ifdef SPDLOG_HEADER_ONLY
28 | # include "helpers-inl.h"
29 | #endif // SPDLOG_HEADER_ONLY
30 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/common-inl.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #ifndef SPDLOG_HEADER_ONLY
7 | # include
8 | #endif
9 |
10 | #include
11 | #include
12 |
13 | namespace spdlog {
14 | namespace level {
15 |
16 | #if __cplusplus >= 201703L
17 | constexpr
18 | #endif
19 | static string_view_t level_string_views[] SPDLOG_LEVEL_NAMES;
20 |
21 | static const char *short_level_names[] SPDLOG_SHORT_LEVEL_NAMES;
22 |
23 | SPDLOG_INLINE const string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
24 | {
25 | return level_string_views[l];
26 | }
27 |
28 | SPDLOG_INLINE const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
29 | {
30 | return short_level_names[l];
31 | }
32 |
33 | SPDLOG_INLINE spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT
34 | {
35 | auto it = std::find(std::begin(level_string_views), std::end(level_string_views), name);
36 | if (it != std::end(level_string_views))
37 | return static_cast(std::distance(std::begin(level_string_views), it));
38 |
39 | // check also for "warn" and "err" before giving up..
40 | if (name == "warn")
41 | {
42 | return level::warn;
43 | }
44 | if (name == "err")
45 | {
46 | return level::err;
47 | }
48 | return level::off;
49 | }
50 | } // namespace level
51 |
52 | SPDLOG_INLINE spdlog_ex::spdlog_ex(std::string msg)
53 | : msg_(std::move(msg))
54 | {}
55 |
56 | SPDLOG_INLINE spdlog_ex::spdlog_ex(const std::string &msg, int last_errno)
57 | {
58 | #ifdef SPDLOG_USE_STD_FORMAT
59 | msg_ = std::system_error(std::error_code(last_errno, std::generic_category()), msg).what();
60 | #else
61 | memory_buf_t outbuf;
62 | fmt::format_system_error(outbuf, last_errno, msg.c_str());
63 | msg_ = fmt::to_string(outbuf);
64 | #endif
65 | }
66 |
67 | SPDLOG_INLINE const char *spdlog_ex::what() const SPDLOG_NOEXCEPT
68 | {
69 | return msg_.c_str();
70 | }
71 |
72 | SPDLOG_INLINE void throw_spdlog_ex(const std::string &msg, int last_errno)
73 | {
74 | SPDLOG_THROW(spdlog_ex(msg, last_errno));
75 | }
76 |
77 | SPDLOG_INLINE void throw_spdlog_ex(std::string msg)
78 | {
79 | SPDLOG_THROW(spdlog_ex(std::move(msg)));
80 | }
81 |
82 | } // namespace spdlog
83 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/backtracer-inl.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #ifndef SPDLOG_HEADER_ONLY
7 | # include
8 | #endif
9 | namespace spdlog {
10 | namespace details {
11 | SPDLOG_INLINE backtracer::backtracer(const backtracer &other)
12 | {
13 | std::lock_guard lock(other.mutex_);
14 | enabled_ = other.enabled();
15 | messages_ = other.messages_;
16 | }
17 |
18 | SPDLOG_INLINE backtracer::backtracer(backtracer &&other) SPDLOG_NOEXCEPT
19 | {
20 | std::lock_guard lock(other.mutex_);
21 | enabled_ = other.enabled();
22 | messages_ = std::move(other.messages_);
23 | }
24 |
25 | SPDLOG_INLINE backtracer &backtracer::operator=(backtracer other)
26 | {
27 | std::lock_guard lock(mutex_);
28 | enabled_ = other.enabled();
29 | messages_ = std::move(other.messages_);
30 | return *this;
31 | }
32 |
33 | SPDLOG_INLINE void backtracer::enable(size_t size)
34 | {
35 | std::lock_guard lock{mutex_};
36 | enabled_.store(true, std::memory_order_relaxed);
37 | messages_ = circular_q{size};
38 | }
39 |
40 | SPDLOG_INLINE void backtracer::disable()
41 | {
42 | std::lock_guard lock{mutex_};
43 | enabled_.store(false, std::memory_order_relaxed);
44 | }
45 |
46 | SPDLOG_INLINE bool backtracer::enabled() const
47 | {
48 | return enabled_.load(std::memory_order_relaxed);
49 | }
50 |
51 | SPDLOG_INLINE void backtracer::push_back(const log_msg &msg)
52 | {
53 | std::lock_guard lock{mutex_};
54 | messages_.push_back(log_msg_buffer{msg});
55 | }
56 |
57 | SPDLOG_INLINE bool backtracer::empty() const
58 | {
59 | std::lock_guard lock{mutex_};
60 | return messages_.empty();
61 | }
62 |
63 | // pop all items in the q and apply the given fun on each of them.
64 | SPDLOG_INLINE void backtracer::foreach_pop(std::function fun)
65 | {
66 | std::lock_guard lock{mutex_};
67 | while (!messages_.empty())
68 | {
69 | auto &front_msg = messages_.front();
70 | fun(front_msg);
71 | messages_.pop_front();
72 | }
73 | }
74 | } // namespace details
75 | } // namespace spdlog
76 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/backtracer.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #include
7 | #include
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | // Store log messages in circular buffer.
14 | // Useful for storing debug data in case of error/warning happens.
15 |
16 | namespace spdlog {
17 | namespace details {
18 | class SPDLOG_API backtracer
19 | {
20 | mutable std::mutex mutex_;
21 | std::atomic enabled_{false};
22 | circular_q messages_;
23 |
24 | public:
25 | backtracer() = default;
26 | backtracer(const backtracer &other);
27 |
28 | backtracer(backtracer &&other) SPDLOG_NOEXCEPT;
29 | backtracer &operator=(backtracer other);
30 |
31 | void enable(size_t size);
32 | void disable();
33 | bool enabled() const;
34 | void push_back(const log_msg &msg);
35 | bool empty() const;
36 |
37 | // pop all items in the q and apply the given fun on each of them.
38 | void foreach_pop(std::function fun);
39 | };
40 |
41 | } // namespace details
42 | } // namespace spdlog
43 |
44 | #ifdef SPDLOG_HEADER_ONLY
45 | # include "backtracer-inl.h"
46 | #endif
47 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/circular_q.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | // circular q view of std::vector.
5 | #pragma once
6 |
7 | #include
8 | #include
9 |
10 | namespace spdlog {
11 | namespace details {
12 | template
13 | class circular_q
14 | {
15 | size_t max_items_ = 0;
16 | typename std::vector::size_type head_ = 0;
17 | typename std::vector::size_type tail_ = 0;
18 | size_t overrun_counter_ = 0;
19 | std::vector v_;
20 |
21 | public:
22 | using value_type = T;
23 |
24 | // empty ctor - create a disabled queue with no elements allocated at all
25 | circular_q() = default;
26 |
27 | explicit circular_q(size_t max_items)
28 | : max_items_(max_items + 1) // one item is reserved as marker for full q
29 | , v_(max_items_)
30 | {}
31 |
32 | circular_q(const circular_q &) = default;
33 | circular_q &operator=(const circular_q &) = default;
34 |
35 | // move cannot be default,
36 | // since we need to reset head_, tail_, etc to zero in the moved object
37 | circular_q(circular_q &&other) SPDLOG_NOEXCEPT
38 | {
39 | copy_moveable(std::move(other));
40 | }
41 |
42 | circular_q &operator=(circular_q &&other) SPDLOG_NOEXCEPT
43 | {
44 | copy_moveable(std::move(other));
45 | return *this;
46 | }
47 |
48 | // push back, overrun (oldest) item if no room left
49 | void push_back(T &&item)
50 | {
51 | if (max_items_ > 0)
52 | {
53 | v_[tail_] = std::move(item);
54 | tail_ = (tail_ + 1) % max_items_;
55 |
56 | if (tail_ == head_) // overrun last item if full
57 | {
58 | head_ = (head_ + 1) % max_items_;
59 | ++overrun_counter_;
60 | }
61 | }
62 | }
63 |
64 | // Return reference to the front item.
65 | // If there are no elements in the container, the behavior is undefined.
66 | const T &front() const
67 | {
68 | return v_[head_];
69 | }
70 |
71 | T &front()
72 | {
73 | return v_[head_];
74 | }
75 |
76 | // Return number of elements actually stored
77 | size_t size() const
78 | {
79 | if (tail_ >= head_)
80 | {
81 | return tail_ - head_;
82 | }
83 | else
84 | {
85 | return max_items_ - (head_ - tail_);
86 | }
87 | }
88 |
89 | // Return const reference to item by index.
90 | // If index is out of range 0…size()-1, the behavior is undefined.
91 | const T &at(size_t i) const
92 | {
93 | assert(i < size());
94 | return v_[(head_ + i) % max_items_];
95 | }
96 |
97 | // Pop item from front.
98 | // If there are no elements in the container, the behavior is undefined.
99 | void pop_front()
100 | {
101 | head_ = (head_ + 1) % max_items_;
102 | }
103 |
104 | bool empty() const
105 | {
106 | return tail_ == head_;
107 | }
108 |
109 | bool full() const
110 | {
111 | // head is ahead of the tail by 1
112 | if (max_items_ > 0)
113 | {
114 | return ((tail_ + 1) % max_items_) == head_;
115 | }
116 | return false;
117 | }
118 |
119 | size_t overrun_counter() const
120 | {
121 | return overrun_counter_;
122 | }
123 |
124 | void reset_overrun_counter()
125 | {
126 | overrun_counter_ = 0;
127 | }
128 |
129 | private:
130 | // copy from other&& and reset it to disabled state
131 | void copy_moveable(circular_q &&other) SPDLOG_NOEXCEPT
132 | {
133 | max_items_ = other.max_items_;
134 | head_ = other.head_;
135 | tail_ = other.tail_;
136 | overrun_counter_ = other.overrun_counter_;
137 | v_ = std::move(other.v_);
138 |
139 | // put &&other in disabled, but valid state
140 | other.max_items_ = 0;
141 | other.head_ = other.tail_ = 0;
142 | other.overrun_counter_ = 0;
143 | }
144 | };
145 | } // namespace details
146 | } // namespace spdlog
147 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/console_globals.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #include
7 | #include
8 |
9 | namespace spdlog {
10 | namespace details {
11 |
12 | struct console_mutex
13 | {
14 | using mutex_t = std::mutex;
15 | static mutex_t &mutex()
16 | {
17 | static mutex_t s_mutex;
18 | return s_mutex;
19 | }
20 | };
21 |
22 | struct console_nullmutex
23 | {
24 | using mutex_t = null_mutex;
25 | static mutex_t &mutex()
26 | {
27 | static mutex_t s_mutex;
28 | return s_mutex;
29 | }
30 | };
31 | } // namespace details
32 | } // namespace spdlog
33 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/file_helper.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #include
7 | #include
8 |
9 | namespace spdlog {
10 | namespace details {
11 |
12 | // Helper class for file sinks.
13 | // When failing to open a file, retry several times(5) with a delay interval(10 ms).
14 | // Throw spdlog_ex exception on errors.
15 |
16 | class SPDLOG_API file_helper
17 | {
18 | public:
19 | file_helper() = default;
20 | explicit file_helper(const file_event_handlers &event_handlers);
21 |
22 | file_helper(const file_helper &) = delete;
23 | file_helper &operator=(const file_helper &) = delete;
24 | ~file_helper();
25 |
26 | void open(const filename_t &fname, bool truncate = false);
27 | void reopen(bool truncate);
28 | void flush();
29 | void sync();
30 | void close();
31 | void write(const memory_buf_t &buf);
32 | size_t size() const;
33 | const filename_t &filename() const;
34 |
35 | //
36 | // return file path and its extension:
37 | //
38 | // "mylog.txt" => ("mylog", ".txt")
39 | // "mylog" => ("mylog", "")
40 | // "mylog." => ("mylog.", "")
41 | // "/dir1/dir2/mylog.txt" => ("/dir1/dir2/mylog", ".txt")
42 | //
43 | // the starting dot in filenames is ignored (hidden files):
44 | //
45 | // ".mylog" => (".mylog". "")
46 | // "my_folder/.mylog" => ("my_folder/.mylog", "")
47 | // "my_folder/.mylog.txt" => ("my_folder/.mylog", ".txt")
48 | static std::tuple split_by_extension(const filename_t &fname);
49 |
50 | private:
51 | const int open_tries_ = 5;
52 | const unsigned int open_interval_ = 10;
53 | std::FILE *fd_{nullptr};
54 | filename_t filename_;
55 | file_event_handlers event_handlers_;
56 | };
57 | } // namespace details
58 | } // namespace spdlog
59 |
60 | #ifdef SPDLOG_HEADER_ONLY
61 | # include "file_helper-inl.h"
62 | #endif
63 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/log_msg-inl.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #ifndef SPDLOG_HEADER_ONLY
7 | # include
8 | #endif
9 |
10 | #include
11 |
12 | namespace spdlog {
13 | namespace details {
14 |
15 | SPDLOG_INLINE log_msg::log_msg(spdlog::log_clock::time_point log_time, spdlog::source_loc loc, string_view_t a_logger_name,
16 | spdlog::level::level_enum lvl, spdlog::string_view_t msg)
17 | : logger_name(a_logger_name)
18 | , level(lvl)
19 | , time(log_time)
20 | #ifndef SPDLOG_NO_THREAD_ID
21 | , thread_id(os::thread_id())
22 | #endif
23 | , source(loc)
24 | , payload(msg)
25 | {}
26 |
27 | SPDLOG_INLINE log_msg::log_msg(
28 | spdlog::source_loc loc, string_view_t a_logger_name, spdlog::level::level_enum lvl, spdlog::string_view_t msg)
29 | : log_msg(os::now(), loc, a_logger_name, lvl, msg)
30 | {}
31 |
32 | SPDLOG_INLINE log_msg::log_msg(string_view_t a_logger_name, spdlog::level::level_enum lvl, spdlog::string_view_t msg)
33 | : log_msg(os::now(), source_loc{}, a_logger_name, lvl, msg)
34 | {}
35 |
36 | } // namespace details
37 | } // namespace spdlog
38 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/log_msg.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #include
7 | #include
8 |
9 | namespace spdlog {
10 | namespace details {
11 | struct SPDLOG_API log_msg
12 | {
13 | log_msg() = default;
14 | log_msg(log_clock::time_point log_time, source_loc loc, string_view_t logger_name, level::level_enum lvl, string_view_t msg);
15 | log_msg(source_loc loc, string_view_t logger_name, level::level_enum lvl, string_view_t msg);
16 | log_msg(string_view_t logger_name, level::level_enum lvl, string_view_t msg);
17 | log_msg(const log_msg &other) = default;
18 | log_msg &operator=(const log_msg &other) = default;
19 |
20 | string_view_t logger_name;
21 | level::level_enum level{level::off};
22 | log_clock::time_point time;
23 | size_t thread_id{0};
24 |
25 | // wrapping the formatted text with color (updated by pattern_formatter).
26 | mutable size_t color_range_start{0};
27 | mutable size_t color_range_end{0};
28 |
29 | source_loc source;
30 | string_view_t payload;
31 | };
32 | } // namespace details
33 | } // namespace spdlog
34 |
35 | #ifdef SPDLOG_HEADER_ONLY
36 | # include "log_msg-inl.h"
37 | #endif
38 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/log_msg_buffer-inl.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #ifndef SPDLOG_HEADER_ONLY
7 | # include
8 | #endif
9 |
10 | namespace spdlog {
11 | namespace details {
12 |
13 | SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg &orig_msg)
14 | : log_msg{orig_msg}
15 | {
16 | buffer.append(logger_name.begin(), logger_name.end());
17 | buffer.append(payload.begin(), payload.end());
18 | update_string_views();
19 | }
20 |
21 | SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg_buffer &other)
22 | : log_msg{other}
23 | {
24 | buffer.append(logger_name.begin(), logger_name.end());
25 | buffer.append(payload.begin(), payload.end());
26 | update_string_views();
27 | }
28 |
29 | SPDLOG_INLINE log_msg_buffer::log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT : log_msg{other}, buffer{std::move(other.buffer)}
30 | {
31 | update_string_views();
32 | }
33 |
34 | SPDLOG_INLINE log_msg_buffer &log_msg_buffer::operator=(const log_msg_buffer &other)
35 | {
36 | log_msg::operator=(other);
37 | buffer.clear();
38 | buffer.append(other.buffer.data(), other.buffer.data() + other.buffer.size());
39 | update_string_views();
40 | return *this;
41 | }
42 |
43 | SPDLOG_INLINE log_msg_buffer &log_msg_buffer::operator=(log_msg_buffer &&other) SPDLOG_NOEXCEPT
44 | {
45 | log_msg::operator=(other);
46 | buffer = std::move(other.buffer);
47 | update_string_views();
48 | return *this;
49 | }
50 |
51 | SPDLOG_INLINE void log_msg_buffer::update_string_views()
52 | {
53 | logger_name = string_view_t{buffer.data(), logger_name.size()};
54 | payload = string_view_t{buffer.data() + logger_name.size(), payload.size()};
55 | }
56 |
57 | } // namespace details
58 | } // namespace spdlog
59 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/log_msg_buffer.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #include
7 |
8 | namespace spdlog {
9 | namespace details {
10 |
11 | // Extend log_msg with internal buffer to store its payload.
12 | // This is needed since log_msg holds string_views that points to stack data.
13 |
14 | class SPDLOG_API log_msg_buffer : public log_msg
15 | {
16 | memory_buf_t buffer;
17 | void update_string_views();
18 |
19 | public:
20 | log_msg_buffer() = default;
21 | explicit log_msg_buffer(const log_msg &orig_msg);
22 | log_msg_buffer(const log_msg_buffer &other);
23 | log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT;
24 | log_msg_buffer &operator=(const log_msg_buffer &other);
25 | log_msg_buffer &operator=(log_msg_buffer &&other) SPDLOG_NOEXCEPT;
26 | };
27 |
28 | } // namespace details
29 | } // namespace spdlog
30 |
31 | #ifdef SPDLOG_HEADER_ONLY
32 | # include "log_msg_buffer-inl.h"
33 | #endif
34 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/mpmc_blocking_q.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | // multi producer-multi consumer blocking queue.
7 | // enqueue(..) - will block until room found to put the new message.
8 | // enqueue_nowait(..) - will return immediately with false if no room left in
9 | // the queue.
10 | // dequeue_for(..) - will block until the queue is not empty or timeout have
11 | // passed.
12 |
13 | #include
14 |
15 | #include
16 | #include
17 |
18 | namespace spdlog {
19 | namespace details {
20 |
21 | template
22 | class mpmc_blocking_queue
23 | {
24 | public:
25 | using item_type = T;
26 | explicit mpmc_blocking_queue(size_t max_items)
27 | : q_(max_items)
28 | {}
29 |
30 | #ifndef __MINGW32__
31 | // try to enqueue and block if no room left
32 | void enqueue(T &&item)
33 | {
34 | {
35 | std::unique_lock lock(queue_mutex_);
36 | pop_cv_.wait(lock, [this] { return !this->q_.full(); });
37 | q_.push_back(std::move(item));
38 | }
39 | push_cv_.notify_one();
40 | }
41 |
42 | // enqueue immediately. overrun oldest message in the queue if no room left.
43 | void enqueue_nowait(T &&item)
44 | {
45 | {
46 | std::unique_lock lock(queue_mutex_);
47 | q_.push_back(std::move(item));
48 | }
49 | push_cv_.notify_one();
50 | }
51 |
52 | // dequeue with a timeout.
53 | // Return true, if succeeded dequeue item, false otherwise
54 | bool dequeue_for(T &popped_item, std::chrono::milliseconds wait_duration)
55 | {
56 | {
57 | std::unique_lock lock(queue_mutex_);
58 | if (!push_cv_.wait_for(lock, wait_duration, [this] { return !this->q_.empty(); }))
59 | {
60 | return false;
61 | }
62 | popped_item = std::move(q_.front());
63 | q_.pop_front();
64 | }
65 | pop_cv_.notify_one();
66 | return true;
67 | }
68 |
69 | // blocking dequeue without a timeout.
70 | void dequeue(T &popped_item)
71 | {
72 | {
73 | std::unique_lock lock(queue_mutex_);
74 | push_cv_.wait(lock, [this] { return !this->q_.empty(); });
75 | popped_item = std::move(q_.front());
76 | q_.pop_front();
77 | }
78 | pop_cv_.notify_one();
79 | }
80 |
81 | #else
82 | // apparently mingw deadlocks if the mutex is released before cv.notify_one(),
83 | // so release the mutex at the very end each function.
84 |
85 | // try to enqueue and block if no room left
86 | void enqueue(T &&item)
87 | {
88 | std::unique_lock lock(queue_mutex_);
89 | pop_cv_.wait(lock, [this] { return !this->q_.full(); });
90 | q_.push_back(std::move(item));
91 | push_cv_.notify_one();
92 | }
93 |
94 | // enqueue immediately. overrun oldest message in the queue if no room left.
95 | void enqueue_nowait(T &&item)
96 | {
97 | std::unique_lock lock(queue_mutex_);
98 | q_.push_back(std::move(item));
99 | push_cv_.notify_one();
100 | }
101 |
102 | // dequeue with a timeout.
103 | // Return true, if succeeded dequeue item, false otherwise
104 | bool dequeue_for(T &popped_item, std::chrono::milliseconds wait_duration)
105 | {
106 | std::unique_lock lock(queue_mutex_);
107 | if (!push_cv_.wait_for(lock, wait_duration, [this] { return !this->q_.empty(); }))
108 | {
109 | return false;
110 | }
111 | popped_item = std::move(q_.front());
112 | q_.pop_front();
113 | pop_cv_.notify_one();
114 | return true;
115 | }
116 |
117 | // blocking dequeue without a timeout.
118 | void dequeue(T &popped_item)
119 | {
120 | std::unique_lock lock(queue_mutex_);
121 | push_cv_.wait(lock, [this] { return !this->q_.empty(); });
122 | popped_item = std::move(q_.front());
123 | q_.pop_front();
124 | pop_cv_.notify_one();
125 | }
126 |
127 | #endif
128 |
129 | size_t overrun_counter()
130 | {
131 | std::unique_lock lock(queue_mutex_);
132 | return q_.overrun_counter();
133 | }
134 |
135 | size_t size()
136 | {
137 | std::unique_lock lock(queue_mutex_);
138 | return q_.size();
139 | }
140 |
141 | void reset_overrun_counter()
142 | {
143 | std::unique_lock lock(queue_mutex_);
144 | q_.reset_overrun_counter();
145 | }
146 |
147 | private:
148 | std::mutex queue_mutex_;
149 | std::condition_variable push_cv_;
150 | std::condition_variable pop_cv_;
151 | spdlog::details::circular_q q_;
152 | };
153 | } // namespace details
154 | } // namespace spdlog
155 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/null_mutex.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #include
7 | #include
8 | // null, no cost dummy "mutex" and dummy "atomic" int
9 |
10 | namespace spdlog {
11 | namespace details {
12 | struct null_mutex
13 | {
14 | void lock() const {}
15 | void unlock() const {}
16 | };
17 |
18 | struct null_atomic_int
19 | {
20 | int value;
21 | null_atomic_int() = default;
22 |
23 | explicit null_atomic_int(int new_value)
24 | : value(new_value)
25 | {}
26 |
27 | int load(std::memory_order = std::memory_order_relaxed) const
28 | {
29 | return value;
30 | }
31 |
32 | void store(int new_value, std::memory_order = std::memory_order_relaxed)
33 | {
34 | value = new_value;
35 | }
36 |
37 | int exchange(int new_value, std::memory_order = std::memory_order_relaxed)
38 | {
39 | std::swap(new_value, value);
40 | return new_value; // return value before the call
41 | }
42 | };
43 |
44 | } // namespace details
45 | } // namespace spdlog
46 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/os.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #include
7 | #include // std::time_t
8 |
9 | namespace spdlog {
10 | namespace details {
11 | namespace os {
12 |
13 | SPDLOG_API spdlog::log_clock::time_point now() SPDLOG_NOEXCEPT;
14 |
15 | SPDLOG_API std::tm localtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT;
16 |
17 | SPDLOG_API std::tm localtime() SPDLOG_NOEXCEPT;
18 |
19 | SPDLOG_API std::tm gmtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT;
20 |
21 | SPDLOG_API std::tm gmtime() SPDLOG_NOEXCEPT;
22 |
23 | // eol definition
24 | #if !defined(SPDLOG_EOL)
25 | # ifdef _WIN32
26 | # define SPDLOG_EOL "\r\n"
27 | # else
28 | # define SPDLOG_EOL "\n"
29 | # endif
30 | #endif
31 |
32 | SPDLOG_CONSTEXPR static const char *default_eol = SPDLOG_EOL;
33 |
34 | // folder separator
35 | #if !defined(SPDLOG_FOLDER_SEPS)
36 | # ifdef _WIN32
37 | # define SPDLOG_FOLDER_SEPS "\\/"
38 | # else
39 | # define SPDLOG_FOLDER_SEPS "/"
40 | # endif
41 | #endif
42 |
43 | SPDLOG_CONSTEXPR static const char folder_seps[] = SPDLOG_FOLDER_SEPS;
44 | SPDLOG_CONSTEXPR static const filename_t::value_type folder_seps_filename[] = SPDLOG_FILENAME_T(SPDLOG_FOLDER_SEPS);
45 |
46 | // fopen_s on non windows for writing
47 | SPDLOG_API bool fopen_s(FILE **fp, const filename_t &filename, const filename_t &mode);
48 |
49 | // Remove filename. return 0 on success
50 | SPDLOG_API int remove(const filename_t &filename) SPDLOG_NOEXCEPT;
51 |
52 | // Remove file if exists. return 0 on success
53 | // Note: Non atomic (might return failure to delete if concurrently deleted by other process/thread)
54 | SPDLOG_API int remove_if_exists(const filename_t &filename) SPDLOG_NOEXCEPT;
55 |
56 | SPDLOG_API int rename(const filename_t &filename1, const filename_t &filename2) SPDLOG_NOEXCEPT;
57 |
58 | // Return if file exists.
59 | SPDLOG_API bool path_exists(const filename_t &filename) SPDLOG_NOEXCEPT;
60 |
61 | // Return file size according to open FILE* object
62 | SPDLOG_API size_t filesize(FILE *f);
63 |
64 | // Return utc offset in minutes or throw spdlog_ex on failure
65 | SPDLOG_API int utc_minutes_offset(const std::tm &tm = details::os::localtime());
66 |
67 | // Return current thread id as size_t
68 | // It exists because the std::this_thread::get_id() is much slower(especially
69 | // under VS 2013)
70 | SPDLOG_API size_t _thread_id() SPDLOG_NOEXCEPT;
71 |
72 | // Return current thread id as size_t (from thread local storage)
73 | SPDLOG_API size_t thread_id() SPDLOG_NOEXCEPT;
74 |
75 | // This is avoid msvc issue in sleep_for that happens if the clock changes.
76 | // See https://github.com/gabime/spdlog/issues/609
77 | SPDLOG_API void sleep_for_millis(unsigned int milliseconds) SPDLOG_NOEXCEPT;
78 |
79 | SPDLOG_API std::string filename_to_str(const filename_t &filename);
80 |
81 | SPDLOG_API int pid() SPDLOG_NOEXCEPT;
82 |
83 | // Determine if the terminal supports colors
84 | // Source: https://github.com/agauniyal/rang/
85 | SPDLOG_API bool is_color_terminal() SPDLOG_NOEXCEPT;
86 |
87 | // Determine if the terminal attached
88 | // Source: https://github.com/agauniyal/rang/
89 | SPDLOG_API bool in_terminal(FILE *file) SPDLOG_NOEXCEPT;
90 |
91 | #if (defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES)) && defined(_WIN32)
92 | SPDLOG_API void wstr_to_utf8buf(wstring_view_t wstr, memory_buf_t &target);
93 |
94 | SPDLOG_API void utf8_to_wstrbuf(string_view_t str, wmemory_buf_t &target);
95 | #endif
96 |
97 | // Return directory name from given path or empty string
98 | // "abc/file" => "abc"
99 | // "abc/" => "abc"
100 | // "abc" => ""
101 | // "abc///" => "abc//"
102 | SPDLOG_API filename_t dir_name(const filename_t &path);
103 |
104 | // Create a dir from the given path.
105 | // Return true if succeeded or if this dir already exists.
106 | SPDLOG_API bool create_dir(const filename_t &path);
107 |
108 | // non thread safe, cross platform getenv/getenv_s
109 | // return empty string if field not found
110 | SPDLOG_API std::string getenv(const char *field);
111 |
112 | // Do fsync by FILE objectpointer.
113 | // Return true on success.
114 | SPDLOG_API bool fsync(FILE * fp);
115 |
116 | } // namespace os
117 | } // namespace details
118 | } // namespace spdlog
119 |
120 | #ifdef SPDLOG_HEADER_ONLY
121 | # include "os-inl.h"
122 | #endif
123 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/periodic_worker-inl.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #ifndef SPDLOG_HEADER_ONLY
7 | # include
8 | #endif
9 |
10 | namespace spdlog {
11 | namespace details {
12 |
13 | // stop the worker thread and join it
14 | SPDLOG_INLINE periodic_worker::~periodic_worker()
15 | {
16 | if (worker_thread_.joinable())
17 | {
18 | {
19 | std::lock_guard lock(mutex_);
20 | active_ = false;
21 | }
22 | cv_.notify_one();
23 | worker_thread_.join();
24 | }
25 | }
26 |
27 | } // namespace details
28 | } // namespace spdlog
29 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/periodic_worker.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | // periodic worker thread - periodically executes the given callback function.
7 | //
8 | // RAII over the owned thread:
9 | // creates the thread on construction.
10 | // stops and joins the thread on destruction (if the thread is executing a callback, wait for it to finish first).
11 |
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | namespace spdlog {
18 | namespace details {
19 |
20 | class SPDLOG_API periodic_worker
21 | {
22 | public:
23 | template
24 | periodic_worker(const std::function &callback_fun, std::chrono::duration interval)
25 | {
26 | active_ = (interval > std::chrono::duration::zero());
27 | if (!active_)
28 | {
29 | return;
30 | }
31 |
32 | worker_thread_ = std::thread([this, callback_fun, interval]() {
33 | for (;;)
34 | {
35 | std::unique_lock lock(this->mutex_);
36 | if (this->cv_.wait_for(lock, interval, [this] { return !this->active_; }))
37 | {
38 | return; // active_ == false, so exit this thread
39 | }
40 | callback_fun();
41 | }
42 | });
43 | }
44 | periodic_worker(const periodic_worker &) = delete;
45 | periodic_worker &operator=(const periodic_worker &) = delete;
46 | // stop the worker thread and join it
47 | ~periodic_worker();
48 |
49 | private:
50 | bool active_;
51 | std::thread worker_thread_;
52 | std::mutex mutex_;
53 | std::condition_variable cv_;
54 | };
55 | } // namespace details
56 | } // namespace spdlog
57 |
58 | #ifdef SPDLOG_HEADER_ONLY
59 | # include "periodic_worker-inl.h"
60 | #endif
61 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/registry.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | // Loggers registry of unique name->logger pointer
7 | // An attempt to create a logger with an already existing name will result with spdlog_ex exception.
8 | // If user requests a non existing logger, nullptr will be returned
9 | // This class is thread safe
10 |
11 | #include
12 | #include
13 |
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 |
21 | namespace spdlog {
22 | class logger;
23 |
24 | namespace details {
25 | class thread_pool;
26 |
27 | class SPDLOG_API registry
28 | {
29 | public:
30 | using log_levels = std::unordered_map;
31 | registry(const registry &) = delete;
32 | registry &operator=(const registry &) = delete;
33 |
34 | void register_logger(std::shared_ptr new_logger);
35 | void initialize_logger(std::shared_ptr new_logger);
36 | std::shared_ptr get(const std::string &logger_name);
37 | std::shared_ptr default_logger();
38 |
39 | // Return raw ptr to the default logger.
40 | // To be used directly by the spdlog default api (e.g. spdlog::info)
41 | // This make the default API faster, but cannot be used concurrently with set_default_logger().
42 | // e.g do not call set_default_logger() from one thread while calling spdlog::info() from another.
43 | logger *get_default_raw();
44 |
45 | // set default logger.
46 | // default logger is stored in default_logger_ (for faster retrieval) and in the loggers_ map.
47 | void set_default_logger(std::shared_ptr new_default_logger);
48 |
49 | void set_tp(std::shared_ptr tp);
50 |
51 | std::shared_ptr get_tp();
52 |
53 | // Set global formatter. Each sink in each logger will get a clone of this object
54 | void set_formatter(std::unique_ptr formatter);
55 |
56 | void enable_backtrace(size_t n_messages);
57 |
58 | void disable_backtrace();
59 |
60 | void set_level(level::level_enum log_level);
61 |
62 | void flush_on(level::level_enum log_level);
63 |
64 | template
65 | void flush_every(std::chrono::duration interval)
66 | {
67 | std::lock_guard lock(flusher_mutex_);
68 | auto clbk = [this]() { this->flush_all(); };
69 | periodic_flusher_ = details::make_unique(clbk, interval);
70 | }
71 |
72 | void set_error_handler(err_handler handler);
73 |
74 | void apply_all(const std::function)> &fun);
75 |
76 | void flush_all();
77 |
78 | void drop(const std::string &logger_name);
79 |
80 | void drop_all();
81 |
82 | // clean all resources and threads started by the registry
83 | void shutdown();
84 |
85 | std::recursive_mutex &tp_mutex();
86 |
87 | void set_automatic_registration(bool automatic_registration);
88 |
89 | // set levels for all existing/future loggers. global_level can be null if should not set.
90 | void set_levels(log_levels levels, level::level_enum *global_level);
91 |
92 | static registry &instance();
93 |
94 | void apply_logger_env_levels(std::shared_ptr new_logger);
95 |
96 | private:
97 | registry();
98 | ~registry();
99 |
100 | void throw_if_exists_(const std::string &logger_name);
101 | void register_logger_(std::shared_ptr new_logger);
102 | bool set_level_from_cfg_(logger *logger);
103 | std::mutex logger_map_mutex_, flusher_mutex_;
104 | std::recursive_mutex tp_mutex_;
105 | std::unordered_map> loggers_;
106 | log_levels log_levels_;
107 | std::unique_ptr formatter_;
108 | spdlog::level::level_enum global_log_level_ = level::info;
109 | level::level_enum flush_level_ = level::off;
110 | err_handler err_handler_;
111 | std::shared_ptr tp_;
112 | std::unique_ptr periodic_flusher_;
113 | std::shared_ptr default_logger_;
114 | bool automatic_registration_ = true;
115 | size_t backtrace_n_messages_ = 0;
116 | };
117 |
118 | } // namespace details
119 | } // namespace spdlog
120 |
121 | #ifdef SPDLOG_HEADER_ONLY
122 | # include "registry-inl.h"
123 | #endif
124 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/synchronous_factory.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #include "registry.h"
7 |
8 | namespace spdlog {
9 |
10 | // Default logger factory- creates synchronous loggers
11 | class logger;
12 |
13 | struct synchronous_factory
14 | {
15 | template
16 | static std::shared_ptr create(std::string logger_name, SinkArgs &&... args)
17 | {
18 | auto sink = std::make_shared(std::forward(args)...);
19 | auto new_logger = std::make_shared(std::move(logger_name), std::move(sink));
20 | details::registry::instance().initialize_logger(new_logger);
21 | return new_logger;
22 | }
23 | };
24 | } // namespace spdlog
25 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/tcp_client-windows.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #define WIN32_LEAN_AND_MEAN
7 | // tcp client helper
8 | #include
9 | #include
10 |
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 |
18 | #pragma comment(lib, "Ws2_32.lib")
19 | #pragma comment(lib, "Mswsock.lib")
20 | #pragma comment(lib, "AdvApi32.lib")
21 |
22 | namespace spdlog {
23 | namespace details {
24 | class tcp_client
25 | {
26 | SOCKET socket_ = INVALID_SOCKET;
27 |
28 | static void init_winsock_()
29 | {
30 | WSADATA wsaData;
31 | auto rv = WSAStartup(MAKEWORD(2, 2), &wsaData);
32 | if (rv != 0)
33 | {
34 | throw_winsock_error_("WSAStartup failed", ::WSAGetLastError());
35 | }
36 | }
37 |
38 | static void throw_winsock_error_(const std::string &msg, int last_error)
39 | {
40 | char buf[512];
41 | ::FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, last_error,
42 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, (sizeof(buf) / sizeof(char)), NULL);
43 |
44 | throw_spdlog_ex(fmt_lib::format("tcp_sink - {}: {}", msg, buf));
45 | }
46 |
47 | public:
48 | tcp_client()
49 | {
50 | init_winsock_();
51 | }
52 |
53 | ~tcp_client()
54 | {
55 | close();
56 | ::WSACleanup();
57 | }
58 |
59 | bool is_connected() const
60 | {
61 | return socket_ != INVALID_SOCKET;
62 | }
63 |
64 | void close()
65 | {
66 | ::closesocket(socket_);
67 | socket_ = INVALID_SOCKET;
68 | }
69 |
70 | SOCKET fd() const
71 | {
72 | return socket_;
73 | }
74 |
75 | // try to connect or throw on failure
76 | void connect(const std::string &host, int port)
77 | {
78 | if (is_connected())
79 | {
80 | close();
81 | }
82 | struct addrinfo hints
83 | {};
84 | ZeroMemory(&hints, sizeof(hints));
85 |
86 | hints.ai_family = AF_INET; // IPv4
87 | hints.ai_socktype = SOCK_STREAM; // TCP
88 | hints.ai_flags = AI_NUMERICSERV; // port passed as as numeric value
89 | hints.ai_protocol = 0;
90 |
91 | auto port_str = std::to_string(port);
92 | struct addrinfo *addrinfo_result;
93 | auto rv = ::getaddrinfo(host.c_str(), port_str.c_str(), &hints, &addrinfo_result);
94 | int last_error = 0;
95 | if (rv != 0)
96 | {
97 | last_error = ::WSAGetLastError();
98 | WSACleanup();
99 | throw_winsock_error_("getaddrinfo failed", last_error);
100 | }
101 |
102 | // Try each address until we successfully connect(2).
103 |
104 | for (auto *rp = addrinfo_result; rp != nullptr; rp = rp->ai_next)
105 | {
106 | socket_ = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
107 | if (socket_ == INVALID_SOCKET)
108 | {
109 | last_error = ::WSAGetLastError();
110 | WSACleanup();
111 | continue;
112 | }
113 | if (::connect(socket_, rp->ai_addr, (int)rp->ai_addrlen) == 0)
114 | {
115 | break;
116 | }
117 | else
118 | {
119 | last_error = ::WSAGetLastError();
120 | close();
121 | }
122 | }
123 | ::freeaddrinfo(addrinfo_result);
124 | if (socket_ == INVALID_SOCKET)
125 | {
126 | WSACleanup();
127 | throw_winsock_error_("connect failed", last_error);
128 | }
129 |
130 | // set TCP_NODELAY
131 | int enable_flag = 1;
132 | ::setsockopt(socket_, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast(&enable_flag), sizeof(enable_flag));
133 | }
134 |
135 | // Send exactly n_bytes of the given data.
136 | // On error close the connection and throw.
137 | void send(const char *data, size_t n_bytes)
138 | {
139 | size_t bytes_sent = 0;
140 | while (bytes_sent < n_bytes)
141 | {
142 | const int send_flags = 0;
143 | auto write_result = ::send(socket_, data + bytes_sent, (int)(n_bytes - bytes_sent), send_flags);
144 | if (write_result == SOCKET_ERROR)
145 | {
146 | int last_error = ::WSAGetLastError();
147 | close();
148 | throw_winsock_error_("send failed", last_error);
149 | }
150 |
151 | if (write_result == 0) // (probably should not happen but in any case..)
152 | {
153 | break;
154 | }
155 | bytes_sent += static_cast(write_result);
156 | }
157 | }
158 | };
159 | } // namespace details
160 | } // namespace spdlog
161 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/tcp_client.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #ifdef _WIN32
7 | # error include tcp_client-windows.h instead
8 | #endif
9 |
10 | // tcp client helper
11 | #include
12 | #include
13 |
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 |
21 | #include
22 |
23 | namespace spdlog {
24 | namespace details {
25 | class tcp_client
26 | {
27 | int socket_ = -1;
28 |
29 | public:
30 | bool is_connected() const
31 | {
32 | return socket_ != -1;
33 | }
34 |
35 | void close()
36 | {
37 | if (is_connected())
38 | {
39 | ::close(socket_);
40 | socket_ = -1;
41 | }
42 | }
43 |
44 | int fd() const
45 | {
46 | return socket_;
47 | }
48 |
49 | ~tcp_client()
50 | {
51 | close();
52 | }
53 |
54 | // try to connect or throw on failure
55 | void connect(const std::string &host, int port)
56 | {
57 | close();
58 | struct addrinfo hints
59 | {};
60 | memset(&hints, 0, sizeof(struct addrinfo));
61 | hints.ai_family = AF_INET; // IPv4
62 | hints.ai_socktype = SOCK_STREAM; // TCP
63 | hints.ai_flags = AI_NUMERICSERV; // port passed as as numeric value
64 | hints.ai_protocol = 0;
65 |
66 | auto port_str = std::to_string(port);
67 | struct addrinfo *addrinfo_result;
68 | auto rv = ::getaddrinfo(host.c_str(), port_str.c_str(), &hints, &addrinfo_result);
69 | if (rv != 0)
70 | {
71 | throw_spdlog_ex(fmt_lib::format("::getaddrinfo failed: {}", gai_strerror(rv)));
72 | }
73 |
74 | // Try each address until we successfully connect(2).
75 | int last_errno = 0;
76 | for (auto *rp = addrinfo_result; rp != nullptr; rp = rp->ai_next)
77 | {
78 | #if defined(SOCK_CLOEXEC)
79 | const int flags = SOCK_CLOEXEC;
80 | #else
81 | const int flags = 0;
82 | #endif
83 | socket_ = ::socket(rp->ai_family, rp->ai_socktype | flags, rp->ai_protocol);
84 | if (socket_ == -1)
85 | {
86 | last_errno = errno;
87 | continue;
88 | }
89 | rv = ::connect(socket_, rp->ai_addr, rp->ai_addrlen);
90 | if (rv == 0)
91 | {
92 | break;
93 | }
94 | last_errno = errno;
95 | ::close(socket_);
96 | socket_ = -1;
97 | }
98 | ::freeaddrinfo(addrinfo_result);
99 | if (socket_ == -1)
100 | {
101 | throw_spdlog_ex("::connect failed", last_errno);
102 | }
103 |
104 | // set TCP_NODELAY
105 | int enable_flag = 1;
106 | ::setsockopt(socket_, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast(&enable_flag), sizeof(enable_flag));
107 |
108 | // prevent sigpipe on systems where MSG_NOSIGNAL is not available
109 | #if defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL)
110 | ::setsockopt(socket_, SOL_SOCKET, SO_NOSIGPIPE, reinterpret_cast(&enable_flag), sizeof(enable_flag));
111 | #endif
112 |
113 | #if !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL)
114 | # error "tcp_sink would raise SIGPIPE since neither SO_NOSIGPIPE nor MSG_NOSIGNAL are available"
115 | #endif
116 | }
117 |
118 | // Send exactly n_bytes of the given data.
119 | // On error close the connection and throw.
120 | void send(const char *data, size_t n_bytes)
121 | {
122 | size_t bytes_sent = 0;
123 | while (bytes_sent < n_bytes)
124 | {
125 | #if defined(MSG_NOSIGNAL)
126 | const int send_flags = MSG_NOSIGNAL;
127 | #else
128 | const int send_flags = 0;
129 | #endif
130 | auto write_result = ::send(socket_, data + bytes_sent, n_bytes - bytes_sent, send_flags);
131 | if (write_result < 0)
132 | {
133 | close();
134 | throw_spdlog_ex("write(2) failed", errno);
135 | }
136 |
137 | if (write_result == 0) // (probably should not happen but in any case..)
138 | {
139 | break;
140 | }
141 | bytes_sent += static_cast(write_result);
142 | }
143 | }
144 | };
145 | } // namespace details
146 | } // namespace spdlog
147 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/thread_pool-inl.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #ifndef SPDLOG_HEADER_ONLY
7 | # include
8 | #endif
9 |
10 | #include
11 | #include
12 |
13 | namespace spdlog {
14 | namespace details {
15 |
16 | SPDLOG_INLINE thread_pool::thread_pool(
17 | size_t q_max_items, size_t threads_n, std::function on_thread_start, std::function on_thread_stop)
18 | : q_(q_max_items)
19 | {
20 | if (threads_n == 0 || threads_n > 1000)
21 | {
22 | throw_spdlog_ex("spdlog::thread_pool(): invalid threads_n param (valid "
23 | "range is 1-1000)");
24 | }
25 | for (size_t i = 0; i < threads_n; i++)
26 | {
27 | threads_.emplace_back([this, on_thread_start, on_thread_stop] {
28 | on_thread_start();
29 | this->thread_pool::worker_loop_();
30 | on_thread_stop();
31 | });
32 | }
33 | }
34 |
35 | SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items, size_t threads_n, std::function on_thread_start)
36 | : thread_pool(q_max_items, threads_n, on_thread_start, [] {})
37 | {}
38 |
39 | SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items, size_t threads_n)
40 | : thread_pool(
41 | q_max_items, threads_n, [] {}, [] {})
42 | {}
43 |
44 | // message all threads to terminate gracefully join them
45 | SPDLOG_INLINE thread_pool::~thread_pool()
46 | {
47 | SPDLOG_TRY
48 | {
49 | for (size_t i = 0; i < threads_.size(); i++)
50 | {
51 | post_async_msg_(async_msg(async_msg_type::terminate), async_overflow_policy::block);
52 | }
53 |
54 | for (auto &t : threads_)
55 | {
56 | t.join();
57 | }
58 | }
59 | SPDLOG_CATCH_STD
60 | }
61 |
62 | void SPDLOG_INLINE thread_pool::post_log(async_logger_ptr &&worker_ptr, const details::log_msg &msg, async_overflow_policy overflow_policy)
63 | {
64 | async_msg async_m(std::move(worker_ptr), async_msg_type::log, msg);
65 | post_async_msg_(std::move(async_m), overflow_policy);
66 | }
67 |
68 | void SPDLOG_INLINE thread_pool::post_flush(async_logger_ptr &&worker_ptr, async_overflow_policy overflow_policy)
69 | {
70 | post_async_msg_(async_msg(std::move(worker_ptr), async_msg_type::flush), overflow_policy);
71 | }
72 |
73 | size_t SPDLOG_INLINE thread_pool::overrun_counter()
74 | {
75 | return q_.overrun_counter();
76 | }
77 |
78 | void SPDLOG_INLINE thread_pool::reset_overrun_counter()
79 | {
80 | q_.reset_overrun_counter();
81 | }
82 |
83 | size_t SPDLOG_INLINE thread_pool::queue_size()
84 | {
85 | return q_.size();
86 | }
87 |
88 | void SPDLOG_INLINE thread_pool::post_async_msg_(async_msg &&new_msg, async_overflow_policy overflow_policy)
89 | {
90 | if (overflow_policy == async_overflow_policy::block)
91 | {
92 | q_.enqueue(std::move(new_msg));
93 | }
94 | else
95 | {
96 | q_.enqueue_nowait(std::move(new_msg));
97 | }
98 | }
99 |
100 | void SPDLOG_INLINE thread_pool::worker_loop_()
101 | {
102 | while (process_next_msg_()) {}
103 | }
104 |
105 | // process next message in the queue
106 | // return true if this thread should still be active (while no terminate msg
107 | // was received)
108 | bool SPDLOG_INLINE thread_pool::process_next_msg_()
109 | {
110 | async_msg incoming_async_msg;
111 | q_.dequeue(incoming_async_msg);
112 |
113 | switch (incoming_async_msg.msg_type)
114 | {
115 | case async_msg_type::log: {
116 | incoming_async_msg.worker_ptr->backend_sink_it_(incoming_async_msg);
117 | return true;
118 | }
119 | case async_msg_type::flush: {
120 | incoming_async_msg.worker_ptr->backend_flush_();
121 | return true;
122 | }
123 |
124 | case async_msg_type::terminate: {
125 | return false;
126 | }
127 |
128 | default: {
129 | assert(false);
130 | }
131 | }
132 |
133 | return true;
134 | }
135 |
136 | } // namespace details
137 | } // namespace spdlog
138 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/thread_pool.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | namespace spdlog {
17 | class async_logger;
18 |
19 | namespace details {
20 |
21 | using async_logger_ptr = std::shared_ptr;
22 |
23 | enum class async_msg_type
24 | {
25 | log,
26 | flush,
27 | terminate
28 | };
29 |
30 | // Async msg to move to/from the queue
31 | // Movable only. should never be copied
32 | struct async_msg : log_msg_buffer
33 | {
34 | async_msg_type msg_type{async_msg_type::log};
35 | async_logger_ptr worker_ptr;
36 |
37 | async_msg() = default;
38 | ~async_msg() = default;
39 |
40 | // should only be moved in or out of the queue..
41 | async_msg(const async_msg &) = delete;
42 |
43 | // support for vs2013 move
44 | #if defined(_MSC_VER) && _MSC_VER <= 1800
45 | async_msg(async_msg &&other)
46 | : log_msg_buffer(std::move(other))
47 | , msg_type(other.msg_type)
48 | , worker_ptr(std::move(other.worker_ptr))
49 | {}
50 |
51 | async_msg &operator=(async_msg &&other)
52 | {
53 | *static_cast(this) = std::move(other);
54 | msg_type = other.msg_type;
55 | worker_ptr = std::move(other.worker_ptr);
56 | return *this;
57 | }
58 | #else // (_MSC_VER) && _MSC_VER <= 1800
59 | async_msg(async_msg &&) = default;
60 | async_msg &operator=(async_msg &&) = default;
61 | #endif
62 |
63 | // construct from log_msg with given type
64 | async_msg(async_logger_ptr &&worker, async_msg_type the_type, const details::log_msg &m)
65 | : log_msg_buffer{m}
66 | , msg_type{the_type}
67 | , worker_ptr{std::move(worker)}
68 | {}
69 |
70 | async_msg(async_logger_ptr &&worker, async_msg_type the_type)
71 | : log_msg_buffer{}
72 | , msg_type{the_type}
73 | , worker_ptr{std::move(worker)}
74 | {}
75 |
76 | explicit async_msg(async_msg_type the_type)
77 | : async_msg{nullptr, the_type}
78 | {}
79 | };
80 |
81 | class SPDLOG_API thread_pool
82 | {
83 | public:
84 | using item_type = async_msg;
85 | using q_type = details::mpmc_blocking_queue;
86 |
87 | thread_pool(size_t q_max_items, size_t threads_n, std::function on_thread_start, std::function on_thread_stop);
88 | thread_pool(size_t q_max_items, size_t threads_n, std::function on_thread_start);
89 | thread_pool(size_t q_max_items, size_t threads_n);
90 |
91 | // message all threads to terminate gracefully and join them
92 | ~thread_pool();
93 |
94 | thread_pool(const thread_pool &) = delete;
95 | thread_pool &operator=(thread_pool &&) = delete;
96 |
97 | void post_log(async_logger_ptr &&worker_ptr, const details::log_msg &msg, async_overflow_policy overflow_policy);
98 | void post_flush(async_logger_ptr &&worker_ptr, async_overflow_policy overflow_policy);
99 | size_t overrun_counter();
100 | void reset_overrun_counter();
101 | size_t queue_size();
102 |
103 | private:
104 | q_type q_;
105 |
106 | std::vector threads_;
107 |
108 | void post_async_msg_(async_msg &&new_msg, async_overflow_policy overflow_policy);
109 | void worker_loop_();
110 |
111 | // process next message in the queue
112 | // return true if this thread should still be active (while no terminate msg
113 | // was received)
114 | bool process_next_msg_();
115 | };
116 |
117 | } // namespace details
118 | } // namespace spdlog
119 |
120 | #ifdef SPDLOG_HEADER_ONLY
121 | # include "thread_pool-inl.h"
122 | #endif
123 |
--------------------------------------------------------------------------------
/PlataniumV3Launcher/lib/spdlog/details/udp_client-windows.h:
--------------------------------------------------------------------------------
1 | // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 |
4 | #pragma once
5 |
6 | // Helper RAII over winsock udp client socket.
7 | // Will throw on construction if socket creation failed.
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include