mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Remove the telemetry (#45)
* remove the telemetry except from the renderers as I'm not being capable to remove it from there
* remove the telemetry except from the renderers as I'm not being capable to remove it from there
* Remove remainder of non-functional Telemetry and Citra Web Services
Squashed commit of the following:
commit f6dd4d4579c91db323877f0d08b9c01c82e1bb32
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 14:02:26 2024 -0600
    gl_driver.h: add back missing functions
commit 8f14384e7a7b763c3f2ccb3af6b5a59df641d9ee
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 13:56:16 2024 -0600
    gl_driver.cpp: add back missing functions
commit 5c802524b01a6eb05952d88ccf9dd78d63baee0a
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 13:39:46 2024 -0600
    apply clang-format
commit e8f62a7d3ee8a3da885a28bce21bcfcb84f13a84
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 13:16:22 2024 -0600
    remove web_tab
commit ced7f1e4909ae7b2714a96e3c3fa0500e8c62968
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 13:13:47 2024 -0600
    remove unused call?
commit f10e05da887e4570853fae2bd55a71087b4bcc77
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 13:03:47 2024 -0600
    fix build errors
commit 0489c1770b4b48d51f626145ae9235d3c81029fc
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 12:54:35 2024 -0600
    Remove deleted files
commit b2eb56f5a1f01663cc9874d99fe77ee64b48622b
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 12:43:17 2024 -0600
    Remove ConfigureWeb
commit b96f7c724006b2c5ee2272becaa70584fe90d012
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 11:49:51 2024 -0600
    remove unused DebugHandler
commit 91ddf16f63f9ae07b0cb2768171728dc878d1653
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 11:41:31 2024 -0600
    remove CollectToolingInfo() reference
commit 3909ac0502f23f8fb54944b53d5072b6986f8ffd
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 11:33:39 2024 -0600
    Fix "clean renderer_vulkan.cpp"
    This reverts commit 8a882658da9fabca40d71d73bfaf3bb5702acd72.
commit f4a10c4e4f27471b0a263ac363a6fa2abc9d6dc9
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 11:25:12 2024 -0600
    remove Core() references
commit 5593b8484e7c9f525ea218902dd2c13148d86b37
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 11:09:26 2024 -0600
    clean core/core.cpp
commit 55bbd8ad283297ef79db11e19ca6303fdfba6626
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 11:03:45 2024 -0600
    apply clang-format
commit 3707a0b2705dd415876130c9c90b0916bdea11db
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 11:02:16 2024 -0600
    citra_qt/main.h
commit ddbdea9be4d8179a333e04e7c302e215868715a9
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 11:01:30 2024 -0600
    clean common/detached_tasks.h
commit b513ba3b91ebc81bddd634b5690b6434824e1c7a
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 10:58:51 2024 -0600
    clean android/app/src/main/jni/default_ini.h
commit b6ba7d7cd730393883fdca294c651a4186727b55
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 10:58:14 2024 -0600
    clean android/app/src/main/jni/native.cpp
commit 2351305bb24b005920af0f3f7bb6bbb5bb3124bd
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 10:56:59 2024 -0600
    network/network_settings.h
commit 5b4c1ebb97c7fad5daf7789e1d3640041c2412fb
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 10:55:53 2024 -0600
    clean citra_qt/configuration/configure_web.ui
commit 9526d5122995c2e9c52b4d93b6e836a2ea4c80ef
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 10:54:53 2024 -0600
    citra_qt/configuration/config.cpp
commit ec6fe57412ce97e06096fc07f8b86dd080b7b944
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 10:53:50 2024 -0600
    clean citra/default_ini.h
commit acba1cf7e94de2fa87174e9f6d7c7c4554146352
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 10:52:47 2024 -0600
    clean citra/config.cpp
commit 02888777590d4e4bf1423e168a672ca0c5e140e5
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 10:50:42 2024 -0600
    clean vk_instance.cpp
commit eae451d5825b3601382c3a6dd08a3bde5c7a9460
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 10:48:53 2024 -0600
    clean vk_instanch.h
commit 8a882658da9fabca40d71d73bfaf3bb5702acd72
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 10:47:11 2024 -0600
    clean renderer_vulkan.cpp
commit ea6df111bc447913d2999acd86de984acced7eeb
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 10:45:51 2024 -0600
    clean renderer_opengl.cpp
commit 6b1bea0ef8cf8831c520d1c4e90b9d73d421c764
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 10:44:17 2024 -0600
    clean pica_to_gl.h
commit c12e984045a430cb10500241ada68701f73c85ac
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 10:42:48 2024 -0600
    clean gl_driver.h
commit ca3fe7801fff125a1ab8706bfc3998ca2928bded
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 10:40:14 2024 -0600
    clean gl_driver.cpp
commit d57381c38b217a423a7039bc7b413d79f59c2ff1
Author: Reg Tiangha <rtiangha@users.noreply.github.com>
Date:   Fri Mar 29 10:38:44 2024 -0600
    delete telemetry files
commit 1af826d1a045c5568a0d9ef4ca423514f298aee2
Author: Miguel <81558772+Miguel-hrvs@users.noreply.github.com>
Date:   Wed Mar 27 16:17:58 2024 +0100
    remove the telemetry except from the renderers as I'm not being capable to remove it from there
* rebase renderer_vulkan
* clean up renderer_vulkan
* bring back vulkan gpu logging
* clang-format vk_instance.h
* fix-formatting
---------
Co-authored-by: Reg Tiangha <rtiangha@users.noreply.github.com>
			
			
This commit is contained in:
		
							parent
							
								
									a442389a60
								
							
						
					
					
						commit
						8e35df1a6c
					
				
					 62 changed files with 49 additions and 4395 deletions
				
			
		|  | @ -467,8 +467,6 @@ add_library(citra_core STATIC | |||
|     savestate_data.h | ||||
|     system_titles.cpp | ||||
|     system_titles.h | ||||
|     telemetry_session.cpp | ||||
|     telemetry_session.h | ||||
|     tracer/citrace.h | ||||
|     tracer/recorder.cpp | ||||
|     tracer/recorder.h | ||||
|  |  | |||
|  | @ -47,7 +47,6 @@ | |||
| #ifdef ENABLE_SCRIPTING | ||||
| #include "core/rpc/server.h" | ||||
| #endif | ||||
| #include "core/telemetry_session.h" | ||||
| #include "network/network.h" | ||||
| #include "video_core/custom_textures/custom_tex_manager.h" | ||||
| #include "video_core/gpu.h" | ||||
|  | @ -322,7 +321,6 @@ System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::st | |||
|         restore_plugin_context.reset(); | ||||
|     } | ||||
| 
 | ||||
|     telemetry_session->AddInitialInfo(*app_loader); | ||||
|     std::shared_ptr<Kernel::Process> process; | ||||
|     const Loader::ResultStatus load_result{app_loader->Load(process)}; | ||||
|     if (Loader::ResultStatus::Success != load_result) { | ||||
|  | @ -452,8 +450,6 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, | |||
|                       Settings::values.output_device.GetValue()); | ||||
|     dsp_core->EnableStretching(Settings::values.enable_audio_stretching.GetValue()); | ||||
| 
 | ||||
|     telemetry_session = std::make_unique<Core::TelemetrySession>(); | ||||
| 
 | ||||
| #ifdef ENABLE_SCRIPTING | ||||
|     rpc_server = std::make_unique<RPC::Server>(*this); | ||||
| #endif | ||||
|  | @ -578,16 +574,6 @@ void System::RegisterImageInterface(std::shared_ptr<Frontend::ImageInterface> im | |||
| } | ||||
| 
 | ||||
| void System::Shutdown(bool is_deserializing) { | ||||
|     // Log last frame performance stats
 | ||||
|     const auto perf_results = GetAndResetPerfStats(); | ||||
|     constexpr auto performance = Common::Telemetry::FieldType::Performance; | ||||
| 
 | ||||
|     telemetry_session->AddField(performance, "Shutdown_EmulationSpeed", | ||||
|                                 perf_results.emulation_speed * 100.0); | ||||
|     telemetry_session->AddField(performance, "Shutdown_Framerate", perf_results.game_fps); | ||||
|     telemetry_session->AddField(performance, "Shutdown_Frametime", perf_results.frametime * 1000.0); | ||||
|     telemetry_session->AddField(performance, "Mean_Frametime_MS", | ||||
|                                 perf_stats ? perf_stats->GetMeanFrametime() : 0); | ||||
| 
 | ||||
|     // Shutdown emulation session
 | ||||
|     is_powered_on = false; | ||||
|  | @ -599,7 +585,6 @@ void System::Shutdown(bool is_deserializing) { | |||
|         app_loader.reset(); | ||||
|     } | ||||
|     custom_tex_manager.reset(); | ||||
|     telemetry_session.reset(); | ||||
| #ifdef ENABLE_SCRIPTING | ||||
|     rpc_server.reset(); | ||||
| #endif | ||||
|  |  | |||
|  | @ -72,7 +72,6 @@ class AppLoader; | |||
| namespace Core { | ||||
| 
 | ||||
| class ARM_Interface; | ||||
| class TelemetrySession; | ||||
| class ExclusiveMonitor; | ||||
| class Timing; | ||||
| 
 | ||||
|  | @ -165,14 +164,6 @@ public: | |||
|         return is_powered_on; | ||||
|     } | ||||
| 
 | ||||
|     /**
 | ||||
|      * Returns a reference to the telemetry session for this emulation session. | ||||
|      * @returns Reference to the telemetry session. | ||||
|      */ | ||||
|     [[nodiscard]] Core::TelemetrySession& TelemetrySession() const { | ||||
|         return *telemetry_session; | ||||
|     } | ||||
| 
 | ||||
|     /// Prepare the core emulation for a reschedule
 | ||||
|     void PrepareReschedule(); | ||||
| 
 | ||||
|  | @ -385,9 +376,6 @@ private: | |||
|     /// When true, signals that a reschedule should happen
 | ||||
|     bool reschedule_pending{}; | ||||
| 
 | ||||
|     /// Telemetry session for this emulation session
 | ||||
|     std::unique_ptr<Core::TelemetrySession> telemetry_session; | ||||
| 
 | ||||
|     std::unique_ptr<VideoCore::GPU> gpu; | ||||
| 
 | ||||
|     /// Service manager
 | ||||
|  |  | |||
|  | @ -34,7 +34,6 @@ | |||
| #include "core/hw/aes/ccm.h" | ||||
| #include "core/hw/aes/key.h" | ||||
| #include "core/loader/loader.h" | ||||
| #include "core/telemetry_session.h" | ||||
| 
 | ||||
| SERVICE_CONSTRUCT_IMPL(Service::APT::Module) | ||||
| 
 | ||||
|  | @ -274,10 +273,6 @@ void Module::APTInterface::GetSharedFont(Kernel::HLERequestContext& ctx) { | |||
|     IPC::RequestParser rp(ctx); | ||||
|     IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); | ||||
| 
 | ||||
|     // Log in telemetry if the game uses the shared font
 | ||||
|     apt->system.TelemetrySession().AddField(Common::Telemetry::FieldType::Session, | ||||
|                                             "RequiresSharedFont", true); | ||||
| 
 | ||||
|     if (!apt->shared_font_loaded) { | ||||
|         // On real 3DS, font loading happens on booting. However, we load it on demand to coordinate
 | ||||
|         // with CFG region auto configuration, which happens later than APT initialization.
 | ||||
|  |  | |||
|  | @ -26,7 +26,6 @@ | |||
| #include "core/loader/smdh.h" | ||||
| #include "core/memory.h" | ||||
| #include "core/system_titles.h" | ||||
| #include "core/telemetry_session.h" | ||||
| #include "network/network.h" | ||||
| 
 | ||||
| namespace Loader { | ||||
|  | @ -277,9 +276,6 @@ ResultStatus AppLoader_NCCH::Load(std::shared_ptr<Kernel::Process>& process) { | |||
|         overlay_ncch = &update_ncch; | ||||
|     } | ||||
| 
 | ||||
|     system.TelemetrySession().AddField(Common::Telemetry::FieldType::Session, "ProgramId", | ||||
|                                        program_id); | ||||
| 
 | ||||
|     if (auto room_member = Network::GetRoomMember().lock()) { | ||||
|         Network::GameInfo game_info; | ||||
|         ReadTitle(game_info.name); | ||||
|  |  | |||
|  | @ -1,176 +0,0 @@ | |||
| // Copyright 2017 Citra Emulator Project
 | ||||
| // Licensed under GPLv2 or any later version
 | ||||
| // Refer to the license.txt file included.
 | ||||
| 
 | ||||
| #include <cryptopp/osrng.h> | ||||
| 
 | ||||
| #include "common/assert.h" | ||||
| #include "common/common_types.h" | ||||
| #include "common/file_util.h" | ||||
| #include "common/logging/log.h" | ||||
| #include "common/scm_rev.h" | ||||
| #include "common/settings.h" | ||||
| #include "core/core.h" | ||||
| #include "core/loader/loader.h" | ||||
| #include "core/telemetry_session.h" | ||||
| #include "network/network_settings.h" | ||||
| 
 | ||||
| #ifdef ENABLE_WEB_SERVICE | ||||
| #include "web_service/telemetry_json.h" | ||||
| #include "web_service/verify_login.h" | ||||
| #endif | ||||
| 
 | ||||
| namespace Core { | ||||
| 
 | ||||
| namespace Telemetry = Common::Telemetry; | ||||
| 
 | ||||
| static u64 GenerateTelemetryId() { | ||||
|     u64 telemetry_id{}; | ||||
|     CryptoPP::AutoSeededRandomPool rng; | ||||
|     rng.GenerateBlock(reinterpret_cast<CryptoPP::byte*>(&telemetry_id), sizeof(u64)); | ||||
|     return telemetry_id; | ||||
| } | ||||
| 
 | ||||
| u64 GetTelemetryId() { | ||||
|     u64 telemetry_id{}; | ||||
|     const std::string filename{FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + | ||||
|                                "telemetry_id"}; | ||||
| 
 | ||||
|     if (FileUtil::Exists(filename)) { | ||||
|         FileUtil::IOFile file(filename, "rb"); | ||||
|         if (!file.IsOpen()) { | ||||
|             LOG_ERROR(Core, "failed to open telemetry_id: {}", filename); | ||||
|             return {}; | ||||
|         } | ||||
|         file.ReadBytes(&telemetry_id, sizeof(u64)); | ||||
|     } else { | ||||
|         FileUtil::IOFile file(filename, "wb"); | ||||
|         if (!file.IsOpen()) { | ||||
|             LOG_ERROR(Core, "failed to open telemetry_id: {}", filename); | ||||
|             return {}; | ||||
|         } | ||||
|         telemetry_id = GenerateTelemetryId(); | ||||
|         file.WriteBytes(&telemetry_id, sizeof(u64)); | ||||
|     } | ||||
| 
 | ||||
|     return telemetry_id; | ||||
| } | ||||
| 
 | ||||
| u64 RegenerateTelemetryId() { | ||||
|     const u64 new_telemetry_id{GenerateTelemetryId()}; | ||||
|     const std::string filename{FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + | ||||
|                                "telemetry_id"}; | ||||
| 
 | ||||
|     FileUtil::IOFile file(filename, "wb"); | ||||
|     if (!file.IsOpen()) { | ||||
|         LOG_ERROR(Core, "failed to open telemetry_id: {}", filename); | ||||
|         return {}; | ||||
|     } | ||||
|     file.WriteBytes(&new_telemetry_id, sizeof(u64)); | ||||
|     return new_telemetry_id; | ||||
| } | ||||
| 
 | ||||
| bool VerifyLogin(const std::string& username, const std::string& token) { | ||||
| #ifdef ENABLE_WEB_SERVICE | ||||
|     return WebService::VerifyLogin(NetSettings::values.web_api_url, username, token); | ||||
| #else | ||||
|     return false; | ||||
| #endif | ||||
| } | ||||
| 
 | ||||
| TelemetrySession::TelemetrySession() = default; | ||||
| 
 | ||||
| TelemetrySession::~TelemetrySession() { | ||||
|     // Log one-time session end information
 | ||||
|     const s64 shutdown_time{std::chrono::duration_cast<std::chrono::milliseconds>( | ||||
|                                 std::chrono::system_clock::now().time_since_epoch()) | ||||
|                                 .count()}; | ||||
|     AddField(Telemetry::FieldType::Session, "Shutdown_Time", shutdown_time); | ||||
| 
 | ||||
| #ifdef ENABLE_WEB_SERVICE | ||||
|     auto backend = std::make_unique<WebService::TelemetryJson>(NetSettings::values.web_api_url, | ||||
|                                                                NetSettings::values.citra_username, | ||||
|                                                                NetSettings::values.citra_token); | ||||
| #else | ||||
|     auto backend = std::make_unique<Telemetry::NullVisitor>(); | ||||
| #endif | ||||
| 
 | ||||
|     // Complete the session, submitting to the web service backend if necessary
 | ||||
|     field_collection.Accept(*backend); | ||||
|     if (NetSettings::values.enable_telemetry) { | ||||
|         backend->Complete(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader) { | ||||
|     // Log one-time top-level information
 | ||||
|     AddField(Telemetry::FieldType::None, "TelemetryId", GetTelemetryId()); | ||||
| 
 | ||||
|     // Log one-time session start information
 | ||||
|     const s64 init_time{std::chrono::duration_cast<std::chrono::milliseconds>( | ||||
|                             std::chrono::system_clock::now().time_since_epoch()) | ||||
|                             .count()}; | ||||
|     AddField(Telemetry::FieldType::Session, "Init_Time", init_time); | ||||
|     std::string program_name; | ||||
|     const Loader::ResultStatus res{app_loader.ReadTitle(program_name)}; | ||||
|     if (res == Loader::ResultStatus::Success) { | ||||
|         AddField(Telemetry::FieldType::Session, "ProgramName", program_name); | ||||
|     } | ||||
| 
 | ||||
|     // Log application information
 | ||||
|     Telemetry::AppendBuildInfo(field_collection); | ||||
| 
 | ||||
|     // Log user system information
 | ||||
|     Telemetry::AppendCPUInfo(field_collection); | ||||
|     Telemetry::AppendOSInfo(field_collection); | ||||
| 
 | ||||
|     // Log user configuration information
 | ||||
|     AddField(Telemetry::FieldType::UserConfig, "Audio_SinkId", | ||||
|              static_cast<int>(Settings::values.output_type.GetValue())); | ||||
|     AddField(Telemetry::FieldType::UserConfig, "Audio_EnableAudioStretching", | ||||
|              Settings::values.enable_audio_stretching.GetValue()); | ||||
|     AddField(Telemetry::FieldType::UserConfig, "Core_UseCpuJit", | ||||
|              Settings::values.use_cpu_jit.GetValue()); | ||||
|     AddField(Telemetry::FieldType::UserConfig, "Renderer_ResolutionFactor", | ||||
|              Settings::values.resolution_factor.GetValue()); | ||||
|     AddField(Telemetry::FieldType::UserConfig, "Renderer_FrameLimit", | ||||
|              Settings::values.frame_limit.GetValue()); | ||||
|     AddField(Telemetry::FieldType::UserConfig, "Renderer_Backend", | ||||
|              static_cast<int>(Settings::values.graphics_api.GetValue())); | ||||
|     AddField(Telemetry::FieldType::UserConfig, "Renderer_UseHwShader", | ||||
|              Settings::values.use_hw_shader.GetValue()); | ||||
|     AddField(Telemetry::FieldType::UserConfig, "Renderer_ShadersAccurateMul", | ||||
|              Settings::values.shaders_accurate_mul.GetValue()); | ||||
|     AddField(Telemetry::FieldType::UserConfig, "Renderer_UseShaderJit", | ||||
|              Settings::values.use_shader_jit.GetValue()); | ||||
|     AddField(Telemetry::FieldType::UserConfig, "Renderer_UseVsync", | ||||
|              Settings::values.use_vsync_new.GetValue()); | ||||
|     AddField(Telemetry::FieldType::UserConfig, "Renderer_FilterMode", | ||||
|              Settings::values.filter_mode.GetValue()); | ||||
|     AddField(Telemetry::FieldType::UserConfig, "Renderer_Render3d", | ||||
|              static_cast<int>(Settings::values.render_3d.GetValue())); | ||||
|     AddField(Telemetry::FieldType::UserConfig, "Renderer_Factor3d", | ||||
|              Settings::values.factor_3d.GetValue()); | ||||
|     AddField(Telemetry::FieldType::UserConfig, "Renderer_MonoRenderOption", | ||||
|              static_cast<int>(Settings::values.mono_render_option.GetValue())); | ||||
|     AddField(Telemetry::FieldType::UserConfig, "System_IsNew3ds", | ||||
|              Settings::values.is_new_3ds.GetValue()); | ||||
|     AddField(Telemetry::FieldType::UserConfig, "System_LLEApplets", | ||||
|              Settings::values.lle_applets.GetValue()); | ||||
|     AddField(Telemetry::FieldType::UserConfig, "System_RegionValue", | ||||
|              Settings::values.region_value.GetValue()); | ||||
| } | ||||
| 
 | ||||
| bool TelemetrySession::SubmitTestcase() { | ||||
| #ifdef ENABLE_WEB_SERVICE | ||||
|     auto backend = std::make_unique<WebService::TelemetryJson>(NetSettings::values.web_api_url, | ||||
|                                                                NetSettings::values.citra_username, | ||||
|                                                                NetSettings::values.citra_token); | ||||
|     field_collection.Accept(*backend); | ||||
|     return backend->SubmitTestcase(); | ||||
| #else | ||||
|     return false; | ||||
| #endif | ||||
| } | ||||
| 
 | ||||
| } // namespace Core
 | ||||
|  | @ -1,91 +0,0 @@ | |||
| // Copyright 2017 Citra Emulator Project
 | ||||
| // Licensed under GPLv2 or any later version
 | ||||
| // Refer to the license.txt file included.
 | ||||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <memory> | ||||
| #include <string> | ||||
| #include "common/telemetry.h" | ||||
| 
 | ||||
| namespace Loader { | ||||
| class AppLoader; | ||||
| } | ||||
| 
 | ||||
| namespace Core { | ||||
| 
 | ||||
| /**
 | ||||
|  * Instruments telemetry for this emulation session. Creates a new set of telemetry fields on each | ||||
|  * session, logging any one-time fields. Interfaces with the telemetry backend used for submitting | ||||
|  * data to the web service. Submits session data on close. | ||||
|  */ | ||||
| class TelemetrySession { | ||||
| public: | ||||
|     explicit TelemetrySession(); | ||||
|     ~TelemetrySession(); | ||||
| 
 | ||||
|     TelemetrySession(const TelemetrySession&) = delete; | ||||
|     TelemetrySession& operator=(const TelemetrySession&) = delete; | ||||
| 
 | ||||
|     TelemetrySession(TelemetrySession&&) = delete; | ||||
|     TelemetrySession& operator=(TelemetrySession&&) = delete; | ||||
| 
 | ||||
|     /**
 | ||||
|      * Adds the initial telemetry info necessary when starting up a title. | ||||
|      * | ||||
|      * This includes information such as: | ||||
|      *   - Telemetry ID | ||||
|      *   - Initialization time | ||||
|      *   - Title ID | ||||
|      *   - Title name | ||||
|      *   - Title file format | ||||
|      *   - Miscellaneous settings values. | ||||
|      * | ||||
|      * @param app_loader The application loader to use to retrieve | ||||
|      *                   title-specific information. | ||||
|      */ | ||||
|     void AddInitialInfo(Loader::AppLoader& app_loader); | ||||
| 
 | ||||
|     /**
 | ||||
|      * Wrapper around the Telemetry::FieldCollection::AddField method. | ||||
|      * @param type Type of the field to add. | ||||
|      * @param name Name of the field to add. | ||||
|      * @param value Value for the field to add. | ||||
|      */ | ||||
|     template <typename T> | ||||
|     void AddField(Common::Telemetry::FieldType type, const char* name, T value) { | ||||
|         field_collection.AddField(type, name, std::move(value)); | ||||
|     } | ||||
| 
 | ||||
|     /**
 | ||||
|      * Submits a Testcase. | ||||
|      * @returns A bool indicating whether the submission succeeded | ||||
|      */ | ||||
|     bool SubmitTestcase(); | ||||
| 
 | ||||
| private: | ||||
|     /// Tracks all added fields for the session
 | ||||
|     Common::Telemetry::FieldCollection field_collection; | ||||
| }; | ||||
| 
 | ||||
| /**
 | ||||
|  * Gets TelemetryId, a unique identifier used for the user's telemetry sessions. | ||||
|  * @returns The current TelemetryId for the session. | ||||
|  */ | ||||
| u64 GetTelemetryId(); | ||||
| 
 | ||||
| /**
 | ||||
|  * Regenerates TelemetryId, a unique identifier used for the user's telemetry sessions. | ||||
|  * @returns The new TelemetryId that was generated. | ||||
|  */ | ||||
| u64 RegenerateTelemetryId(); | ||||
| 
 | ||||
| /**
 | ||||
|  * Verifies the username and token. | ||||
|  * @param username Citra username to use for authentication. | ||||
|  * @param token Citra token to use for authentication. | ||||
|  * @returns Future with bool indicating whether the verification succeeded | ||||
|  */ | ||||
| bool VerifyLogin(const std::string& username, const std::string& token); | ||||
| 
 | ||||
| } // namespace Core
 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue