1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Enable optional minimal SteamAPI integration for usage time tracking (editor only).

This commit is contained in:
bruvzg
2022-01-12 16:01:08 +02:00
parent 60844997bb
commit c34d64669e
5 changed files with 214 additions and 0 deletions

View File

@@ -112,6 +112,10 @@
#endif // DISABLE_DEPRECATED
#endif // TOOLS_ENABLED
#if defined(STEAMAPI_ENABLED)
#include "main/steam_tracker.h"
#endif
#include "modules/modules_enabled.gen.h" // For mono.
#if defined(MODULE_MONO_ENABLED) && defined(TOOLS_ENABLED)
@@ -142,6 +146,10 @@ static ZipArchive *zip_packed_data = nullptr;
#endif
static MessageQueue *message_queue = nullptr;
#if defined(STEAMAPI_ENABLED)
static SteamTracker *steam_tracker = nullptr;
#endif
// Initialized in setup2()
static AudioServer *audio_server = nullptr;
static CameraServer *camera_server = nullptr;
@@ -2428,6 +2436,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->benchmark_end_measure("Startup", "Core");
#if defined(STEAMAPI_ENABLED)
if (editor || project_manager) {
steam_tracker = memnew(SteamTracker);
}
#endif
if (p_second_phase) {
return setup2();
}
@@ -2486,6 +2500,12 @@ error:
OS::get_singleton()->benchmark_end_measure("Startup", "Core");
OS::get_singleton()->benchmark_end_measure("Startup", "Setup");
#if defined(STEAMAPI_ENABLED)
if (steam_tracker) {
memdelete(steam_tracker);
}
#endif
OS::get_singleton()->finalize_core();
locale = String();
@@ -4313,6 +4333,12 @@ void Main::cleanup(bool p_force) {
message_queue->flush();
memdelete(message_queue);
#if defined(STEAMAPI_ENABLED)
if (steam_tracker) {
memdelete(steam_tracker);
}
#endif
unregister_core_driver_types();
unregister_core_extensions();
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_CORE);