1
0
mirror of https://git.suyu.dev/suyu/suyu synced 2025-08-30 16:06:30 -05:00

Quality-of-Life Improvements

This commit is contained in:
Levi Akatsuki
2024-03-15 21:48:09 +00:00
committed by ddutchie
parent f1ef23cc6a
commit e1538413e9
128 changed files with 494 additions and 1525 deletions

View File

@@ -1136,8 +1136,6 @@ add_library(core STATIC
precompiled_headers.h
reporter.cpp
reporter.h
telemetry_session.cpp
telemetry_session.h
tools/freezer.cpp
tools/freezer.h
tools/renderdoc.cpp

View File

@@ -16,8 +16,8 @@ using namespace Common::Literals;
class DynarmicCallbacks32 : public Dynarmic::A32::UserCallbacks {
public:
explicit DynarmicCallbacks32(ArmDynarmic32& parent, Kernel::KProcess* process)
: m_parent{parent}, m_memory(process->GetMemory()),
m_process(process), m_debugger_enabled{parent.m_system.DebuggerEnabled()},
: m_parent{parent}, m_memory(process->GetMemory()), m_process(process),
m_debugger_enabled{parent.m_system.DebuggerEnabled()},
m_check_memory_access{m_debugger_enabled ||
!Settings::values.cpuopt_ignore_memory_aborts.GetValue()} {}

View File

@@ -16,8 +16,8 @@ using namespace Common::Literals;
class DynarmicCallbacks64 : public Dynarmic::A64::UserCallbacks {
public:
explicit DynarmicCallbacks64(ArmDynarmic64& parent, Kernel::KProcess* process)
: m_parent{parent}, m_memory(process->GetMemory()),
m_process(process), m_debugger_enabled{parent.m_system.DebuggerEnabled()},
: m_parent{parent}, m_memory(process->GetMemory()), m_process(process),
m_debugger_enabled{parent.m_system.DebuggerEnabled()},
m_check_memory_access{m_debugger_enabled ||
!Settings::values.cpuopt_ignore_memory_aborts.GetValue()} {}

View File

@@ -55,7 +55,6 @@
#include "core/memory/cheat_engine.h"
#include "core/perf_stats.h"
#include "core/reporter.h"
#include "core/telemetry_session.h"
#include "core/tools/freezer.h"
#include "core/tools/renderdoc.h"
#include "hid_core/hid_core.h"
@@ -272,8 +271,6 @@ struct System::Impl {
}
SystemResultStatus SetupForApplicationProcess(System& system, Frontend::EmuWindow& emu_window) {
telemetry_session = std::make_unique<Core::TelemetrySession>();
host1x_core = std::make_unique<Tegra::Host1x::Host1x>(system);
gpu_core = VideoCore::CreateGPU(emu_window, system);
if (!gpu_core) {
@@ -354,8 +351,6 @@ struct System::Impl {
return init_result;
}
telemetry_session->AddInitialInfo(*app_loader, fs_controller, *content_provider);
// Initialize cheat engine
if (cheat_engine) {
cheat_engine->Initialize();
@@ -401,21 +396,6 @@ struct System::Impl {
void ShutdownMainProcess() {
SetShuttingDown(true);
// Log last frame performance stats if game was loaded
if (perf_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.average_game_fps);
telemetry_session->AddField(performance, "Shutdown_Frametime",
perf_results.frametime * 1000.0);
telemetry_session->AddField(performance, "Mean_Frametime_MS",
perf_stats->GetMeanFrametime());
}
is_powered_on = false;
exit_locked = false;
exit_requested = false;
@@ -434,7 +414,6 @@ struct System::Impl {
service_manager.reset();
fs_controller.Reset();
cheat_engine.reset();
telemetry_session.reset();
core_timing.ClearPendingEvents();
app_loader.reset();
audio_core.reset();
@@ -534,9 +513,6 @@ struct System::Impl {
/// Services
std::unique_ptr<Service::Services> services;
/// Telemetry session for this emulation session
std::unique_ptr<Core::TelemetrySession> telemetry_session;
/// Network instance
Network::NetworkInstance network_instance;
@@ -663,14 +639,6 @@ PerfStatsResults System::GetAndResetPerfStats() {
return impl->GetAndResetPerfStats();
}
TelemetrySession& System::TelemetrySession() {
return *impl->telemetry_session;
}
const TelemetrySession& System::TelemetrySession() const {
return *impl->telemetry_session;
}
Kernel::PhysicalCore& System::CurrentPhysicalCore() {
return impl->kernel.CurrentPhysicalCore();
}

View File

@@ -122,7 +122,6 @@ class GPUDirtyMemoryManager;
class PerfStats;
class Reporter;
class SpeedLimiter;
class TelemetrySession;
struct PerfStatsResults;
@@ -218,12 +217,6 @@ public:
*/
[[nodiscard]] bool IsPoweredOn() const;
/// Gets a reference to the telemetry session for this emulation session.
[[nodiscard]] Core::TelemetrySession& TelemetrySession();
/// Gets a reference to the telemetry session for this emulation session.
[[nodiscard]] const Core::TelemetrySession& TelemetrySession() const;
/// Prepare the core emulation for a reschedule
void PrepareReschedule(u32 core_index);

View File

@@ -29,8 +29,8 @@ constexpr std::array partition_names{
XCI::XCI(VirtualFile file_, u64 program_id, size_t program_index)
: file(std::move(file_)), program_nca_status{Loader::ResultStatus::ErrorXCIMissingProgramNCA},
partitions(partition_names.size()),
partitions_raw(partition_names.size()), keys{Core::Crypto::KeyManager::Instance()} {
partitions(partition_names.size()), partitions_raw(partition_names.size()),
keys{Core::Crypto::KeyManager::Instance()} {
const auto header_status = TryReadHeader();
if (header_status != Loader::ResultStatus::Success) {
status = header_status;

View File

@@ -91,8 +91,12 @@ public:
}
#define DECLARE_PATH_FLAG_HANDLER(__WHICH__) \
constexpr bool Is##__WHICH__##Allowed() const { return (m_value & __WHICH__##Flag) != 0; } \
constexpr void Allow##__WHICH__() { m_value |= __WHICH__##Flag; }
constexpr bool Is##__WHICH__##Allowed() const { \
return (m_value & __WHICH__##Flag) != 0; \
} \
constexpr void Allow##__WHICH__() { \
m_value |= __WHICH__##Flag; \
}
DECLARE_PATH_FLAG_HANDLER(WindowsPath)
DECLARE_PATH_FLAG_HANDLER(RelativePath)

View File

@@ -19,9 +19,9 @@
namespace FileSys {
NSP::NSP(VirtualFile file_, u64 title_id_, std::size_t program_index_)
: file(std::move(file_)), expected_program_id(title_id_),
program_index(program_index_), status{Loader::ResultStatus::Success},
pfs(std::make_shared<PartitionFilesystem>(file)), keys{Core::Crypto::KeyManager::Instance()} {
: file(std::move(file_)), expected_program_id(title_id_), program_index(program_index_),
status{Loader::ResultStatus::Success}, pfs(std::make_shared<PartitionFilesystem>(file)),
keys{Core::Crypto::KeyManager::Instance()} {
if (pfs->GetStatus() != Loader::ResultStatus::Success) {
status = pfs->GetStatus();
return;

View File

@@ -44,8 +44,8 @@ static bool CalculateHMAC256(Destination* out, const SourceKey* key, std::size_t
}
NAX::NAX(VirtualFile file_)
: header(std::make_unique<NAXHeader>()),
file(std::move(file_)), keys{Core::Crypto::KeyManager::Instance()} {
: header(std::make_unique<NAXHeader>()), file(std::move(file_)),
keys{Core::Crypto::KeyManager::Instance()} {
std::string path = Common::FS::SanitizePath(file->GetFullPath());
static const std::regex nax_path_regex("/registered/(000000[0-9A-F]{2})/([0-9A-F]{32})\\.nca",
std::regex_constants::ECMAScript |
@@ -62,8 +62,8 @@ NAX::NAX(VirtualFile file_)
}
NAX::NAX(VirtualFile file_, std::array<u8, 0x10> nca_id)
: header(std::make_unique<NAXHeader>()),
file(std::move(file_)), keys{Core::Crypto::KeyManager::Instance()} {
: header(std::make_unique<NAXHeader>()), file(std::move(file_)),
keys{Core::Crypto::KeyManager::Instance()} {
Core::Crypto::SHA256Hash hash{};
mbedtls_sha256_ret(nca_id.data(), nca_id.size(), hash.data(), 0);
status = Parse(fmt::format("/registered/000000{:02X}/{}.nca", hash[0],

View File

@@ -24,7 +24,9 @@ private:
friend class ::Kernel::KClassTokenGenerator; \
static constexpr inline auto ObjectType = ::Kernel::KClassTokenGenerator::ObjectType::CLASS; \
static constexpr inline const char* const TypeName = #CLASS; \
static constexpr inline ClassTokenType ClassToken() { return ::Kernel::ClassToken<CLASS>; } \
static constexpr inline ClassTokenType ClassToken() { \
return ::Kernel::ClassToken<CLASS>; \
} \
\
public: \
SUYU_NON_COPYABLE(CLASS); \
@@ -35,9 +37,15 @@ public:
constexpr ClassTokenType Token = ClassToken(); \
return TypeObj(TypeName, Token); \
} \
static constexpr const char* GetStaticTypeName() { return TypeName; } \
virtual TypeObj GetTypeObj() ATTRIBUTE { return GetStaticTypeObj(); } \
virtual const char* GetTypeName() ATTRIBUTE { return GetStaticTypeName(); } \
static constexpr const char* GetStaticTypeName() { \
return TypeName; \
} \
virtual TypeObj GetTypeObj() ATTRIBUTE { \
return GetStaticTypeObj(); \
} \
virtual const char* GetTypeName() ATTRIBUTE { \
return GetStaticTypeName(); \
} \
\
private: \
constexpr bool operator!=(const TypeObj& rhs)

View File

@@ -128,8 +128,8 @@ KVirtualAddress KMemoryRegionTree::GetRandomAlignedRegion(size_t size, size_t al
KMemoryLayout::KMemoryLayout()
: m_virtual_tree{m_memory_region_allocator}, m_physical_tree{m_memory_region_allocator},
m_virtual_linear_tree{m_memory_region_allocator}, m_physical_linear_tree{
m_memory_region_allocator} {}
m_virtual_linear_tree{m_memory_region_allocator},
m_physical_linear_tree{m_memory_region_allocator} {}
void KMemoryLayout::InitializeLinearMemoryRegionTrees(KPhysicalAddress aligned_linear_phys_start,
KVirtualAddress linear_virtual_start) {

View File

@@ -17,38 +17,32 @@ namespace Kernel {
class KThread;
template <typename T>
concept KPriorityQueueAffinityMask = !
std::is_reference_v<T>&& requires(T& t) {
{ t.GetAffinityMask() } -> Common::ConvertibleTo<u64>;
{ t.SetAffinityMask(0) };
concept KPriorityQueueAffinityMask = !std::is_reference_v<T> && requires(T& t) {
{ t.GetAffinityMask() } -> Common::ConvertibleTo<u64>;
{ t.SetAffinityMask(0) };
{ t.GetAffinity(0) } -> std::same_as<bool>;
{ t.SetAffinity(0, false) };
{ t.SetAll() };
};
{ t.GetAffinity(0) } -> std::same_as<bool>;
{ t.SetAffinity(0, false) };
{ t.SetAll() };
};
template <typename T>
concept KPriorityQueueMember = !
std::is_reference_v<T>&& requires(T& t) {
{ typename T::QueueEntry() };
{ (typename T::QueueEntry()).Initialize() };
{ (typename T::QueueEntry()).SetPrev(std::addressof(t)) };
{ (typename T::QueueEntry()).SetNext(std::addressof(t)) };
{ (typename T::QueueEntry()).GetNext() } -> std::same_as<T*>;
{ (typename T::QueueEntry()).GetPrev() } -> std::same_as<T*>;
{
t.GetPriorityQueueEntry(0)
} -> std::same_as<typename T::QueueEntry&>;
concept KPriorityQueueMember = !std::is_reference_v<T> && requires(T& t) {
{ typename T::QueueEntry() };
{ (typename T::QueueEntry()).Initialize() };
{ (typename T::QueueEntry()).SetPrev(std::addressof(t)) };
{ (typename T::QueueEntry()).SetNext(std::addressof(t)) };
{ (typename T::QueueEntry()).GetNext() } -> std::same_as<T*>;
{ (typename T::QueueEntry()).GetPrev() } -> std::same_as<T*>;
{ t.GetPriorityQueueEntry(0) } -> std::same_as<typename T::QueueEntry&>;
{ t.GetAffinityMask() };
{
std::remove_cvref_t<decltype(t.GetAffinityMask())>()
} -> KPriorityQueueAffinityMask;
{ t.GetAffinityMask() };
{ std::remove_cvref_t<decltype(t.GetAffinityMask())>() } -> KPriorityQueueAffinityMask;
{ t.GetActiveCore() } -> Common::ConvertibleTo<s32>;
{ t.GetPriority() } -> Common::ConvertibleTo<s32>;
{ t.IsDummyThread() } -> Common::ConvertibleTo<bool>;
};
{ t.GetActiveCore() } -> Common::ConvertibleTo<s32>;
{ t.GetPriority() } -> Common::ConvertibleTo<s32>;
{ t.IsDummyThread() } -> Common::ConvertibleTo<bool>;
};
template <typename Member, size_t NumCores_, int LowestPriority, int HighestPriority>
requires KPriorityQueueMember<Member>

View File

@@ -10,11 +10,10 @@
namespace Kernel {
template <typename T>
concept KLockable = !
std::is_reference_v<T>&& requires(T& t) {
{ t.Lock() } -> std::same_as<void>;
{ t.Unlock() } -> std::same_as<void>;
};
concept KLockable = !std::is_reference_v<T> && requires(T& t) {
{ t.Lock() } -> std::same_as<void>;
{ t.Unlock() } -> std::same_as<void>;
};
template <typename T>
requires KLockable<T>

View File

@@ -458,9 +458,13 @@ constexpr inline Result __TmpCurrentResultReference = ResultSuccess;
if (true)
#define R_CONVERT(catch_type, convert_type) \
R_CATCH(catch_type) { R_THROW(static_cast<Result>(convert_type)); }
R_CATCH(catch_type) { \
R_THROW(static_cast<Result>(convert_type)); \
}
#define R_CONVERT_ALL(convert_type) \
R_CATCH_ALL() { R_THROW(static_cast<Result>(convert_type)); }
R_CATCH_ALL() { \
R_THROW(static_cast<Result>(convert_type)); \
}
#define R_ASSERT(res_expr) ASSERT(R_SUCCEEDED(res_expr))

View File

@@ -1028,8 +1028,8 @@ void Module::Interface::TrySelectUserWithoutInteraction(HLERequestContext& ctx)
Module::Interface::Interface(std::shared_ptr<Module> module_,
std::shared_ptr<ProfileManager> profile_manager_,
Core::System& system_, const char* name)
: ServiceFramework{system_, name}, module{std::move(module_)}, profile_manager{std::move(
profile_manager_)} {}
: ServiceFramework{system_, name}, module{std::move(module_)},
profile_manager{std::move(profile_manager_)} {}
Module::Interface::~Interface() = default;

View File

@@ -18,9 +18,8 @@ namespace Service::AM::Frontend {
Cabinet::Cabinet(Core::System& system_, std::shared_ptr<Applet> applet_,
LibraryAppletMode applet_mode_, const Core::Frontend::CabinetApplet& frontend_)
: FrontendApplet{system_, applet_, applet_mode_}, frontend{frontend_}, service_context{
system_,
"CabinetApplet"} {
: FrontendApplet{system_, applet_, applet_mode_}, frontend{frontend_},
service_context{system_, "CabinetApplet"} {
availability_change_event =
service_context.CreateEvent("CabinetApplet:AvailabilityChangeEvent");

View File

@@ -18,8 +18,8 @@ namespace Service::AM {
IApplicationProxy::IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet,
Kernel::KProcess* process, WindowSystem& window_system)
: ServiceFramework{system_, "IApplicationProxy"},
m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} {
: ServiceFramework{system_, "IApplicationProxy"}, m_window_system{window_system},
m_process{process}, m_applet{std::move(applet)} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&IApplicationProxy::GetCommonStateGetter>, "GetCommonStateGetter"},

View File

@@ -165,8 +165,8 @@ std::shared_ptr<ILibraryAppletAccessor> CreateFrontendApplet(Core::System& syste
ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_, std::shared_ptr<Applet> applet,
WindowSystem& window_system)
: ServiceFramework{system_, "ILibraryAppletCreator"},
m_window_system{window_system}, m_applet{std::move(applet)} {
: ServiceFramework{system_, "ILibraryAppletCreator"}, m_window_system{window_system},
m_applet{std::move(applet)} {
static const FunctionInfo functions[] = {
{0, D<&ILibraryAppletCreator::CreateLibraryApplet>, "CreateLibraryApplet"},
{1, nullptr, "TerminateAllLibraryApplets"},

View File

@@ -20,8 +20,8 @@ namespace Service::AM {
ILibraryAppletProxy::ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
Kernel::KProcess* process, WindowSystem& window_system)
: ServiceFramework{system_, "ILibraryAppletProxy"},
m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} {
: ServiceFramework{system_, "ILibraryAppletProxy"}, m_window_system{window_system},
m_process{process}, m_applet{std::move(applet)} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&ILibraryAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"},

View File

@@ -16,8 +16,8 @@ namespace Service::AM {
ISelfController::ISelfController(Core::System& system_, std::shared_ptr<Applet> applet,
Kernel::KProcess* process)
: ServiceFramework{system_, "ISelfController"}, m_process{process}, m_applet{
std::move(applet)} {
: ServiceFramework{system_, "ISelfController"}, m_process{process},
m_applet{std::move(applet)} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&ISelfController::Exit>, "Exit"},

View File

@@ -20,8 +20,8 @@ namespace Service::AM {
ISystemAppletProxy::ISystemAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
Kernel::KProcess* process, WindowSystem& window_system)
: ServiceFramework{system_, "ISystemAppletProxy"},
m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} {
: ServiceFramework{system_, "ISystemAppletProxy"}, m_window_system{window_system},
m_process{process}, m_applet{std::move(applet)} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&ISystemAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"},

View File

@@ -11,8 +11,8 @@ namespace Service::AM {
IWindowController::IWindowController(Core::System& system_, std::shared_ptr<Applet> applet,
WindowSystem& window_system)
: ServiceFramework{system_, "IWindowController"},
m_window_system{window_system}, m_applet{std::move(applet)} {
: ServiceFramework{system_, "IWindowController"}, m_window_system{window_system},
m_applet{std::move(applet)} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "CreateWindow"},

View File

@@ -9,8 +9,8 @@ namespace Service::AOC {
constexpr Result ResultNoPurchasedProductInfoAvailable{ErrorModule::NIMShop, 400};
IPurchaseEventManager::IPurchaseEventManager(Core::System& system_)
: ServiceFramework{system_, "IPurchaseEventManager"}, service_context{system,
"IPurchaseEventManager"} {
: ServiceFramework{system_, "IPurchaseEventManager"},
service_context{system, "IPurchaseEventManager"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&IPurchaseEventManager::SetDefaultDeliveryTarget>, "SetDefaultDeliveryTarget"},

View File

@@ -12,9 +12,8 @@ IAudioIn::IAudioIn(Core::System& system_, Manager& manager, size_t session_id,
const std::string& device_name, const AudioInParameter& in_params,
Kernel::KProcess* handle, u64 applet_resource_user_id)
: ServiceFramework{system_, "IAudioIn"}, process{handle}, service_context{system_, "IAudioIn"},
event{service_context.CreateEvent("AudioInEvent")}, impl{std::make_shared<In>(system_,
manager, event,
session_id)} {
event{service_context.CreateEvent("AudioInEvent")},
impl{std::make_shared<In>(system_, manager, event, session_id)} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&IAudioIn::GetAudioInState>, "GetAudioInState"},

View File

@@ -10,8 +10,8 @@ namespace Service::Audio {
using namespace AudioCore::AudioIn;
IAudioInManager::IAudioInManager(Core::System& system_)
: ServiceFramework{system_, "audin:u"}, impl{std::make_unique<AudioCore::AudioIn::Manager>(
system_)} {
: ServiceFramework{system_, "audin:u"},
impl{std::make_unique<AudioCore::AudioIn::Manager>(system_)} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&IAudioInManager::ListAudioIns>, "ListAudioIns"},

View File

@@ -14,8 +14,8 @@ IAudioRenderer::IAudioRenderer(Core::System& system_, Manager& manager_,
s32 session_id)
: ServiceFramework{system_, "IAudioRenderer"}, service_context{system_, "IAudioRenderer"},
rendered_event{service_context.CreateEvent("IAudioRendererEvent")}, manager{manager_},
impl{std::make_unique<Renderer>(system_, manager, rendered_event)}, process_handle{
process_handle_} {
impl{std::make_unique<Renderer>(system_, manager, rendered_event)},
process_handle{process_handle_} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&IAudioRenderer::GetSampleRate>, "GetSampleRate"},

View File

@@ -7,9 +7,8 @@
namespace Service::News {
INewlyArrivedEventHolder::INewlyArrivedEventHolder(Core::System& system_)
: ServiceFramework{system_, "INewlyArrivedEventHolder"}, service_context{
system_,
"INewlyArrivedEventHolder"} {
: ServiceFramework{system_, "INewlyArrivedEventHolder"},
service_context{system_, "INewlyArrivedEventHolder"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&INewlyArrivedEventHolder::Get>, "Get"},

View File

@@ -7,8 +7,8 @@
namespace Service::News {
IOverwriteEventHolder::IOverwriteEventHolder(Core::System& system_)
: ServiceFramework{system_, "IOverwriteEventHolder"}, service_context{system_,
"IOverwriteEventHolder"} {
: ServiceFramework{system_, "IOverwriteEventHolder"},
service_context{system_, "IOverwriteEventHolder"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&IOverwriteEventHolder::Get>, "Get"},

View File

@@ -11,8 +11,8 @@
namespace Service::FileSystem {
IFileSystem::IFileSystem(Core::System& system_, FileSys::VirtualDir dir_, SizeGetter size_getter_)
: ServiceFramework{system_, "IFileSystem"}, backend{std::make_unique<FileSys::Fsa::IFileSystem>(
dir_)},
: ServiceFramework{system_, "IFileSystem"},
backend{std::make_unique<FileSys::Fsa::IFileSystem>(dir_)},
size_getter{std::move(size_getter_)} {
static const FunctionInfo functions[] = {
{0, D<&IFileSystem::CreateFile>, "CreateFile"},

View File

@@ -12,8 +12,8 @@ namespace Service::FileSystem {
ISaveDataInfoReader::ISaveDataInfoReader(Core::System& system_,
std::shared_ptr<SaveDataController> save_data_controller_,
FileSys::SaveDataSpaceId space)
: ServiceFramework{system_, "ISaveDataInfoReader"}, save_data_controller{
save_data_controller_} {
: ServiceFramework{system_, "ISaveDataInfoReader"},
save_data_controller{save_data_controller_} {
static const FunctionInfo functions[] = {
{0, D<&ISaveDataInfoReader::ReadSaveDataInfo>, "ReadSaveDataInfo"},
};

View File

@@ -11,8 +11,8 @@
namespace Service::Glue::Time {
AlarmWorker::AlarmWorker(Core::System& system, StandardSteadyClockResource& steady_clock_resource)
: m_system{system}, m_ctx{system, "Glue:AlarmWorker"}, m_steady_clock_resource{
steady_clock_resource} {}
: m_system{system}, m_ctx{system, "Glue:AlarmWorker"},
m_steady_clock_resource{steady_clock_resource} {}
AlarmWorker::~AlarmWorker() {
m_system.CoreTiming().UnscheduleEvent(m_timer_timing_event);

View File

@@ -87,10 +87,8 @@ static Service::PSC::Time::LocationName GetTimeZoneString(
}
TimeManager::TimeManager(Core::System& system)
: m_steady_clock_resource{system}, m_time_zone_binary{system}, m_worker{
system,
m_steady_clock_resource,
m_file_timestamp_worker} {
: m_steady_clock_resource{system}, m_time_zone_binary{system},
m_worker{system, m_steady_clock_resource, m_file_timestamp_worker} {
m_time_m =
system.ServiceManager().GetService<Service::PSC::Time::ServiceManager>("time:m", true);

View File

@@ -22,9 +22,9 @@ TimeZoneService::TimeZoneService(
std::shared_ptr<Service::PSC::Time::TimeZoneService> time_zone_service)
: ServiceFramework{system_, "ITimeZoneService"}, m_system{system},
m_can_write_timezone_device_location{can_write_timezone_device_location},
m_file_timestamp_worker{file_timestamp_worker}, m_wrapped_service{std::move(
time_zone_service)},
m_operation_event{m_system}, m_time_zone_binary{time_zone_binary} {
m_file_timestamp_worker{file_timestamp_worker},
m_wrapped_service{std::move(time_zone_service)}, m_operation_event{m_system},
m_time_zone_binary{time_zone_binary} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&TimeZoneService::GetDeviceLocationName>, "GetDeviceLocationName"},

View File

@@ -19,11 +19,11 @@ namespace Service::Glue::Time {
TimeWorker::TimeWorker(Core::System& system, StandardSteadyClockResource& steady_clock_resource,
FileTimestampWorker& file_timestamp_worker)
: m_system{system}, m_ctx{m_system, "Glue:TimeWorker"}, m_event{m_ctx.CreateEvent(
"Glue:TimeWorker:Event")},
: m_system{system}, m_ctx{m_system, "Glue:TimeWorker"},
m_event{m_ctx.CreateEvent("Glue:TimeWorker:Event")},
m_steady_clock_resource{steady_clock_resource},
m_file_timestamp_worker{file_timestamp_worker}, m_timer_steady_clock{m_ctx.CreateEvent(
"Glue:TimeWorker:SteadyClockTimerEvent")},
m_file_timestamp_worker{file_timestamp_worker},
m_timer_steady_clock{m_ctx.CreateEvent("Glue:TimeWorker:SteadyClockTimerEvent")},
m_timer_file_system{m_ctx.CreateEvent("Glue:TimeWorker:FileTimeTimerEvent")},
m_alarm_worker{m_system, m_steady_clock_resource}, m_pm_state_change_handler{m_alarm_worker} {
m_timer_steady_clock_timing_event = Core::Timing::CreateEvent(

View File

@@ -17,8 +17,8 @@ namespace Service::HID {
IHidDebugServer::IHidDebugServer(Core::System& system_, std::shared_ptr<ResourceManager> resource,
std::shared_ptr<HidFirmwareSettings> settings)
: ServiceFramework{system_, "hid:dbg"}, resource_manager{resource}, firmware_settings{
settings} {
: ServiceFramework{system_, "hid:dbg"}, resource_manager{resource},
firmware_settings{settings} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "DeactivateDebugPad"},

View File

@@ -72,8 +72,8 @@ public:
u32 num_handles_to_copy_ = 0, u32 num_objects_to_move_ = 0,
Flags flags = Flags::None)
: RequestHelperBase(ctx), normal_params_size(normal_params_size_),
num_handles_to_copy(num_handles_to_copy_),
num_objects_to_move(num_objects_to_move_), kernel{ctx.kernel} {
num_handles_to_copy(num_handles_to_copy_), num_objects_to_move(num_objects_to_move_),
kernel{ctx.kernel} {
memset(cmdbuf, 0, sizeof(u32) * IPC::COMMAND_BUFFER_LENGTH);

View File

@@ -40,8 +40,8 @@ class DynarmicCallbacks64 : public Dynarmic::A64::UserCallbacks {
public:
explicit DynarmicCallbacks64(Core::Memory::Memory& memory_, std::vector<u8>& local_memory_,
IntervalSet& mapped_ranges_, JITContextImpl& parent_)
: memory{memory_}, local_memory{local_memory_},
mapped_ranges{mapped_ranges_}, parent{parent_} {}
: memory{memory_}, local_memory{local_memory_}, mapped_ranges{mapped_ranges_},
parent{parent_} {}
u8 MemoryRead8(u64 vaddr) override {
return ReadMemory<u8>(vaddr);

View File

@@ -23,8 +23,8 @@ class IDatabaseService final : public ServiceFramework<IDatabaseService> {
public:
explicit IDatabaseService(Core::System& system_, std::shared_ptr<MiiManager> mii_manager,
bool is_system_)
: ServiceFramework{system_, "IDatabaseService"}, manager{mii_manager}, is_system{
is_system_} {
: ServiceFramework{system_, "IDatabaseService"}, manager{mii_manager},
is_system{is_system_} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&IDatabaseService::IsUpdated>, "IsUpdated"},

View File

@@ -30,8 +30,8 @@ Alarm::~Alarm() {
Alarms::Alarms(Core::System& system, StandardSteadyClockCore& steady_clock,
PowerStateRequestManager& power_state_request_manager)
: m_system{system}, m_ctx{system, "Psc:Alarms"}, m_steady_clock{steady_clock},
m_power_state_request_manager{power_state_request_manager}, m_event{m_ctx.CreateEvent(
"Psc:Alarms:Event")} {}
m_power_state_request_manager{power_state_request_manager},
m_event{m_ctx.CreateEvent("Psc:Alarms:Event")} {}
Alarms::~Alarms() {
m_ctx.CloseEvent(m_event);

View File

@@ -11,8 +11,8 @@ StandardUserSystemClockCore::StandardUserSystemClockCore(
StandardNetworkSystemClockCore& network_clock)
: SystemClockCore{local_clock.GetSteadyClock()}, m_system{system},
m_ctx{m_system, "Psc:StandardUserSystemClockCore"}, m_local_system_clock{local_clock},
m_network_system_clock{network_clock}, m_event{m_ctx.CreateEvent(
"Psc:StandardUserSystemClockCore:Event")} {}
m_network_system_clock{network_clock},
m_event{m_ctx.CreateEvent("Psc:StandardUserSystemClockCore:Event")} {}
StandardUserSystemClockCore::~StandardUserSystemClockCore() {
m_ctx.CloseEvent(m_event);

View File

@@ -6,8 +6,8 @@
namespace Service::PSC::Time {
OperationEvent::OperationEvent(Core::System& system)
: m_ctx{system, "Time:OperationEvent"}, m_event{
m_ctx.CreateEvent("Time:OperationEvent:Event")} {}
: m_ctx{system, "Time:OperationEvent"},
m_event{m_ctx.CreateEvent("Time:OperationEvent:Event")} {}
OperationEvent::~OperationEvent() {
m_ctx.CloseEvent(m_event);

View File

@@ -29,8 +29,8 @@ public:
m_standard_user_system_clock{m_system, m_standard_local_system_clock,
m_standard_network_system_clock},
m_ephemeral_network_clock{m_tick_based_steady_clock}, m_shared_memory{m_system},
m_power_state_request_manager{m_system}, m_alarms{m_system, m_standard_steady_clock,
m_power_state_request_manager},
m_power_state_request_manager{m_system},
m_alarms{m_system, m_standard_steady_clock, m_power_state_request_manager},
m_local_system_clock_context_writer{m_system, m_shared_memory},
m_network_system_clock_context_writer{m_system, m_shared_memory,
m_standard_user_system_clock},

View File

@@ -8,8 +8,8 @@ namespace Service::PSC::Time {
IPowerStateRequestHandler::IPowerStateRequestHandler(
Core::System& system_, PowerStateRequestManager& power_state_request_manager)
: ServiceFramework{system_, "time:p"}, m_system{system}, m_power_state_request_manager{
power_state_request_manager} {
: ServiceFramework{system_, "time:p"}, m_system{system},
m_power_state_request_manager{power_state_request_manager} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&IPowerStateRequestHandler::GetPowerStateRequestEventReadableHandle>, "GetPowerStateRequestEventReadableHandle"},

View File

@@ -37,8 +37,8 @@ StaticService::StaticService(Core::System& system_, StaticServiceSetupInfo setup
m_user_system_clock{m_time->m_standard_user_system_clock},
m_network_system_clock{m_time->m_standard_network_system_clock},
m_time_zone{m_time->m_time_zone},
m_ephemeral_network_clock{m_time->m_ephemeral_network_clock}, m_shared_memory{
m_time->m_shared_memory} {
m_ephemeral_network_clock{m_time->m_ephemeral_network_clock},
m_shared_memory{m_time->m_shared_memory} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&StaticService::GetStandardUserSystemClock>, "GetStandardUserSystemClock"},

View File

@@ -12,8 +12,8 @@ SteadyClock::SteadyClock(Core::System& system_, std::shared_ptr<TimeManager> man
bool can_write_steady_clock, bool can_write_uninitialized_clock)
: ServiceFramework{system_, "ISteadyClock"}, m_system{system},
m_clock_core{manager->m_standard_steady_clock},
m_can_write_steady_clock{can_write_steady_clock}, m_can_write_uninitialized_clock{
can_write_uninitialized_clock} {
m_can_write_steady_clock{can_write_steady_clock},
m_can_write_uninitialized_clock{can_write_uninitialized_clock} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&SteadyClock::GetCurrentTimePoint>, "GetCurrentTimePoint"},

View File

@@ -11,8 +11,8 @@ namespace Service::PSC::Time {
SystemClock::SystemClock(Core::System& system_, SystemClockCore& clock_core, bool can_write_clock,
bool can_write_uninitialized_clock)
: ServiceFramework{system_, "ISystemClock"}, m_system{system}, m_clock_core{clock_core},
m_can_write_clock{can_write_clock}, m_can_write_uninitialized_clock{
can_write_uninitialized_clock} {
m_can_write_clock{can_write_clock},
m_can_write_uninitialized_clock{can_write_uninitialized_clock} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&SystemClock::GetCurrentTime>, "GetCurrentTime"},

View File

@@ -13,8 +13,8 @@ namespace Service::PSC::Time {
TimeZoneService::TimeZoneService(Core::System& system_, StandardSteadyClockCore& clock_core,
TimeZone& time_zone, bool can_write_timezone_device_location)
: ServiceFramework{system_, "ITimeZoneService"}, m_system{system}, m_clock_core{clock_core},
m_time_zone{time_zone}, m_can_write_timezone_device_location{
can_write_timezone_device_location} {
m_time_zone{time_zone},
m_can_write_timezone_device_location{can_write_timezone_device_location} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&TimeZoneService::GetDeviceLocationName>, "GetDeviceLocationName"},

View File

@@ -251,8 +251,8 @@ void SM::UnregisterService(HLERequestContext& ctx) {
}
SM::SM(ServiceManager& service_manager_, Core::System& system_)
: ServiceFramework{system_, "sm:", 4},
service_manager{service_manager_}, kernel{system_.Kernel()} {
: ServiceFramework{system_, "sm:", 4}, service_manager{service_manager_},
kernel{system_.Kernel()} {
RegisterHandlers({
{0, &SM::Initialize, "Initialize"},
{1, &SM::GetServiceCmif, "GetService"},

View File

@@ -15,8 +15,8 @@ namespace Service::VI {
IApplicationDisplayService::IApplicationDisplayService(Core::System& system_,
std::shared_ptr<Container> container)
: ServiceFramework{system_, "IApplicationDisplayService"},
m_container{std::move(container)}, m_context{system, "IApplicationDisplayService"} {
: ServiceFramework{system_, "IApplicationDisplayService"}, m_container{std::move(container)},
m_context{system, "IApplicationDisplayService"} {
// clang-format off
static const FunctionInfo functions[] = {
{100, C<&IApplicationDisplayService::GetRelayService>, "GetRelayService"},

View File

@@ -218,8 +218,8 @@ std::vector<CheatEntry> TextCheatParser::Parse(std::string_view data) const {
CheatEngine::CheatEngine(System& system_, std::vector<CheatEntry> cheats_,
const std::array<u8, 0x20>& build_id_)
: vm{std::make_unique<StandardVmCallbacks>(system_, metadata)},
cheats(std::move(cheats_)), core_timing{system_.CoreTiming()}, system{system_} {
: vm{std::make_unique<StandardVmCallbacks>(system_, metadata)}, cheats(std::move(cheats_)),
core_timing{system_.CoreTiming()}, system{system_} {
metadata.main_nso_build_id = build_id_;
}

View File

@@ -1,294 +0,0 @@
// SPDX-FileCopyrightText: 2017 Citra Emulator Project & 2024 suyu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <array>
#include <mbedtls/ctr_drbg.h>
#include <mbedtls/entropy.h>
#include "common/assert.h"
#include "common/common_types.h"
#include "common/fs/file.h"
#include "common/fs/fs.h"
#include "common/fs/path_util.h"
#include "common/logging/log.h"
#include "common/settings.h"
#include "common/settings_enums.h"
#include "core/file_sys/control_metadata.h"
#include "core/file_sys/patch_manager.h"
#include "core/loader/loader.h"
#include "core/telemetry_session.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{};
mbedtls_entropy_context entropy;
mbedtls_entropy_init(&entropy);
mbedtls_ctr_drbg_context ctr_drbg;
static constexpr std::array<char, 18> personalization{{"suyu Telemetry ID"}};
mbedtls_ctr_drbg_init(&ctr_drbg);
ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy,
reinterpret_cast<const unsigned char*>(personalization.data()),
personalization.size()) == 0);
ASSERT(mbedtls_ctr_drbg_random(&ctr_drbg, reinterpret_cast<unsigned char*>(&telemetry_id),
sizeof(u64)) == 0);
mbedtls_ctr_drbg_free(&ctr_drbg);
mbedtls_entropy_free(&entropy);
return telemetry_id;
}
static const char* TranslateRenderer(Settings::RendererBackend backend) {
switch (backend) {
case Settings::RendererBackend::OpenGL:
return "OpenGL";
case Settings::RendererBackend::Vulkan:
return "Vulkan";
case Settings::RendererBackend::Null:
return "Null";
}
return "Unknown";
}
static const char* TranslateGPUAccuracyLevel(Settings::GpuAccuracy backend) {
switch (backend) {
case Settings::GpuAccuracy::Normal:
return "Normal";
case Settings::GpuAccuracy::High:
return "High";
case Settings::GpuAccuracy::Extreme:
return "Extreme";
}
return "Unknown";
}
static const char* TranslateNvdecEmulation(Settings::NvdecEmulation backend) {
switch (backend) {
case Settings::NvdecEmulation::Off:
return "Off";
case Settings::NvdecEmulation::Cpu:
return "CPU";
case Settings::NvdecEmulation::Gpu:
return "GPU";
}
return "Unknown";
}
static constexpr const char* TranslateVSyncMode(Settings::VSyncMode mode) {
switch (mode) {
case Settings::VSyncMode::Immediate:
return "Immediate";
case Settings::VSyncMode::Mailbox:
return "Mailbox";
case Settings::VSyncMode::Fifo:
return "FIFO";
case Settings::VSyncMode::FifoRelaxed:
return "FIFO Relaxed";
}
return "Unknown";
}
static constexpr const char* TranslateASTCDecodeMode(Settings::AstcDecodeMode mode) {
switch (mode) {
case Settings::AstcDecodeMode::Cpu:
return "CPU";
case Settings::AstcDecodeMode::Gpu:
return "GPU";
case Settings::AstcDecodeMode::CpuAsynchronous:
return "CPU Asynchronous";
}
return "Unknown";
}
u64 GetTelemetryId() {
u64 telemetry_id{};
const auto filename = Common::FS::GetSuyuPath(Common::FS::SuyuPath::ConfigDir) / "telemetry_id";
bool generate_new_id = !Common::FS::Exists(filename);
if (!generate_new_id) {
Common::FS::IOFile file{filename, Common::FS::FileAccessMode::Read,
Common::FS::FileType::BinaryFile};
if (!file.IsOpen()) {
LOG_ERROR(Core, "failed to open telemetry_id: {}",
Common::FS::PathToUTF8String(filename));
return {};
}
if (!file.ReadObject(telemetry_id) || telemetry_id == 0) {
LOG_ERROR(Frontend, "telemetry_id is 0. Generating a new one.", telemetry_id);
generate_new_id = true;
}
}
if (generate_new_id) {
Common::FS::IOFile file{filename, Common::FS::FileAccessMode::Write,
Common::FS::FileType::BinaryFile};
if (!file.IsOpen()) {
LOG_ERROR(Core, "failed to open telemetry_id: {}",
Common::FS::PathToUTF8String(filename));
return {};
}
telemetry_id = GenerateTelemetryId();
if (!file.WriteObject(telemetry_id)) {
LOG_ERROR(Core, "Failed to write telemetry_id to file.");
}
}
return telemetry_id;
}
u64 RegenerateTelemetryId() {
const u64 new_telemetry_id{GenerateTelemetryId()};
const auto filename = Common::FS::GetSuyuPath(Common::FS::SuyuPath::ConfigDir) / "telemetry_id";
Common::FS::IOFile file{filename, Common::FS::FileAccessMode::Write,
Common::FS::FileType::BinaryFile};
if (!file.IsOpen()) {
LOG_ERROR(Core, "failed to open telemetry_id: {}", Common::FS::PathToUTF8String(filename));
return {};
}
if (!file.WriteObject(new_telemetry_id)) {
LOG_ERROR(Core, "Failed to write telemetry_id to file.");
}
return new_telemetry_id;
}
bool VerifyLogin(const std::string& username, const std::string& token) {
#ifdef ENABLE_WEB_SERVICE
return WebService::VerifyLogin(Settings::values.web_api_url.GetValue(), 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>(
Settings::values.web_api_url.GetValue(), Settings::values.suyu_username.GetValue(),
Settings::values.suyu_token.GetValue());
#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 (Settings::values.enable_telemetry) {
backend->Complete();
}
}
void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader,
const Service::FileSystem::FileSystemController& fsc,
const FileSys::ContentProvider& content_provider) {
// 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);
u64 program_id{};
const Loader::ResultStatus res{app_loader.ReadProgramId(program_id)};
if (res == Loader::ResultStatus::Success) {
const std::string formatted_program_id{fmt::format("{:016X}", program_id)};
AddField(Telemetry::FieldType::Session, "ProgramId", formatted_program_id);
std::string name;
app_loader.ReadTitle(name);
if (name.empty()) {
const auto metadata = [&content_provider, &fsc, program_id] {
const FileSys::PatchManager pm{program_id, fsc, content_provider};
return pm.GetControlMetadata();
}();
if (metadata.first != nullptr) {
name = metadata.first->GetApplicationName();
}
}
if (!name.empty()) {
AddField(Telemetry::FieldType::Session, "ProgramName", name);
}
}
AddField(Telemetry::FieldType::Session, "ProgramFormat",
static_cast<u8>(app_loader.GetFileType()));
// Log application information
Telemetry::AppendBuildInfo(field_collection);
// Log user system information
Telemetry::AppendCPUInfo(field_collection);
Telemetry::AppendOSInfo(field_collection);
// Log user configuration information
constexpr auto field_type = Telemetry::FieldType::UserConfig;
AddField(field_type, "Audio_SinkId",
Settings::CanonicalizeEnum(Settings::values.sink_id.GetValue()));
AddField(field_type, "Core_UseMultiCore", Settings::values.use_multi_core.GetValue());
AddField(field_type, "Renderer_Backend",
TranslateRenderer(Settings::values.renderer_backend.GetValue()));
AddField(field_type, "Renderer_UseSpeedLimit", Settings::values.use_speed_limit.GetValue());
AddField(field_type, "Renderer_SpeedLimit", Settings::values.speed_limit.GetValue());
AddField(field_type, "Renderer_UseDiskShaderCache",
Settings::values.use_disk_shader_cache.GetValue());
AddField(field_type, "Renderer_GPUAccuracyLevel",
TranslateGPUAccuracyLevel(Settings::values.gpu_accuracy.GetValue()));
AddField(field_type, "Renderer_UseAsynchronousGpuEmulation",
Settings::values.use_asynchronous_gpu_emulation.GetValue());
AddField(field_type, "Renderer_NvdecEmulation",
TranslateNvdecEmulation(Settings::values.nvdec_emulation.GetValue()));
AddField(field_type, "Renderer_AccelerateASTC",
TranslateASTCDecodeMode(Settings::values.accelerate_astc.GetValue()));
AddField(field_type, "Renderer_UseVsync",
TranslateVSyncMode(Settings::values.vsync_mode.GetValue()));
AddField(field_type, "Renderer_ShaderBackend",
static_cast<u32>(Settings::values.shader_backend.GetValue()));
AddField(field_type, "Renderer_UseAsynchronousShaders",
Settings::values.use_asynchronous_shaders.GetValue());
AddField(field_type, "System_UseDockedMode", Settings::IsDockedMode());
}
bool TelemetrySession::SubmitTestcase() {
#ifdef ENABLE_WEB_SERVICE
auto backend = std::make_unique<WebService::TelemetryJson>(
Settings::values.web_api_url.GetValue(), Settings::values.suyu_username.GetValue(),
Settings::values.suyu_token.GetValue());
field_collection.Accept(*backend);
return backend->SubmitTestcase();
#else
return false;
#endif
}
} // namespace Core

View File

@@ -1,101 +0,0 @@
// SPDX-FileCopyrightText: 2017 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <string>
#include "common/telemetry.h"
namespace FileSys {
class ContentProvider;
}
namespace Loader {
class AppLoader;
}
namespace Service::FileSystem {
class FileSystemController;
}
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.
* @param fsc Filesystem controller to use to retrieve info.
* @param content_provider Content provider to use to retrieve info.
*/
void AddInitialInfo(Loader::AppLoader& app_loader,
const Service::FileSystem::FileSystemController& fsc,
const FileSys::ContentProvider& content_provider);
/**
* 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 suyu username to use for authentication.
* @param token suyu 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