Compare commits

..

5 Commits

Author SHA1 Message Date
FearlessTobi
4c3f898789 configure_debug: Fix small typo 2023-12-12 20:38:54 +01:00
liamwhite
15bebf1695 Merge pull request #12328 from german77/profile_manager
core: Use single instance of profile manager
2023-12-12 11:06:37 -05:00
liamwhite
5c840334b8 Merge pull request #12333 from german77/aruid_free
service: hid: Improve CreateAppletResource implementation and free resources
2023-12-12 11:06:24 -05:00
german77
abfebe5cc4 service: hid: Improve CreateAppletResource implementation and free resources 2023-12-10 16:17:51 -06:00
german77
a22a025c5b core: Use single instance of profile manager 2023-12-10 11:29:43 -06:00
35 changed files with 836 additions and 1694 deletions

View File

@@ -291,9 +291,6 @@ Core::SystemResultStatus EmulationSession::InitializeEmulation(const std::string
// Initialize filesystem.
ConfigureFilesystemProvider(filepath);
// Initialize account manager
m_profile_manager = std::make_unique<Service::Account::ProfileManager>();
// Load the ROM.
m_load_result = m_system.Load(EmulationSession::GetInstance().Window(), filepath);
if (m_load_result != Core::SystemResultStatus::Success) {
@@ -736,8 +733,8 @@ void Java_org_yuzu_yuzu_1emu_NativeLibrary_initializeEmptyUserDirectory(JNIEnv*
auto vfs_nand_dir = EmulationSession::GetInstance().System().GetFilesystem()->OpenDirectory(
Common::FS::PathToUTF8String(nand_dir), FileSys::Mode::Read);
Service::Account::ProfileManager manager;
const auto user_id = manager.GetUser(static_cast<std::size_t>(0));
const auto user_id = EmulationSession::GetInstance().System().GetProfileManager().GetUser(
static_cast<std::size_t>(0));
ASSERT(user_id);
const auto user_save_data_path = FileSys::SaveDataFactory::GetFullPath(

View File

@@ -73,7 +73,6 @@ private:
std::atomic<bool> m_is_running = false;
std::atomic<bool> m_is_paused = false;
SoftwareKeyboard::AndroidKeyboard* m_software_keyboard{};
std::unique_ptr<Service::Account::ProfileManager> m_profile_manager;
std::unique_ptr<FileSys::ManualContentProvider> m_manual_provider;
// GPU driver parameters

View File

@@ -572,10 +572,6 @@ struct Values {
Setting<std::string> yuzu_username{linkage, std::string(), "yuzu_username",
Category::WebService};
Setting<std::string> yuzu_token{linkage, std::string(), "yuzu_token", Category::WebService};
Setting<std::string> report_api_url{linkage, "https://yuzu-cms.ddev.site", "report_api_url",
Category::WebService};
Setting<std::string> yuzu_cookie{linkage, std::string(), "yuzu_cookie", Category::WebService};
Setting<std::string> report_user{linkage, std::string(), "report_user", Category::WebService};
// Add-Ons
std::map<u64, std::vector<std::string>> disabled_addons;

View File

@@ -36,6 +36,7 @@
#include "core/hle/kernel/k_scheduler.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/physical_core.h"
#include "core/hle/service/acc/profile_manager.h"
#include "core/hle/service/am/applets/applets.h"
#include "core/hle/service/apm/apm_controller.h"
#include "core/hle/service/filesystem/filesystem.h"
@@ -130,8 +131,8 @@ FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
struct System::Impl {
explicit Impl(System& system)
: kernel{system}, fs_controller{system}, memory{system}, hid_core{}, room_network{},
cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system},
gpu_dirty_memory_write_manager{} {
cpu_manager{system}, reporter{system}, applet_manager{system}, profile_manager{},
time_manager{system}, gpu_dirty_memory_write_manager{} {
memory.SetGPUDirtyManagers(gpu_dirty_memory_write_manager);
}
@@ -532,6 +533,7 @@ struct System::Impl {
/// Service State
Service::Glue::ARPManager arp_manager;
Service::Account::ProfileManager profile_manager;
Service::Time::TimeManager time_manager;
/// Service manager
@@ -921,6 +923,14 @@ const Service::APM::Controller& System::GetAPMController() const {
return impl->apm_controller;
}
Service::Account::ProfileManager& System::GetProfileManager() {
return impl->profile_manager;
}
const Service::Account::ProfileManager& System::GetProfileManager() const {
return impl->profile_manager;
}
Service::Time::TimeManager& System::GetTimeManager() {
return impl->time_manager;
}

View File

@@ -45,6 +45,10 @@ class Memory;
namespace Service {
namespace Account {
class ProfileManager;
} // namespace Account
namespace AM::Applets {
struct AppletFrontendSet;
class AppletManager;
@@ -383,6 +387,9 @@ public:
[[nodiscard]] Service::APM::Controller& GetAPMController();
[[nodiscard]] const Service::APM::Controller& GetAPMController() const;
[[nodiscard]] Service::Account::ProfileManager& GetProfileManager();
[[nodiscard]] const Service::Account::ProfileManager& GetProfileManager() const;
[[nodiscard]] Service::Time::TimeManager& GetTimeManager();
[[nodiscard]] const Service::Time::TimeManager& GetTimeManager() const;

View File

@@ -112,6 +112,19 @@ void AppletResource::UnregisterAppletResourceUserId(u64 aruid) {
}
}
void AppletResource::FreeAppletResourceId(u64 aruid) {
u64 index = GetIndexFromAruid(aruid);
if (index >= AruidIndexMax) {
return;
}
auto& aruid_data = data[index];
if (aruid_data.flag.is_assigned) {
aruid_data.shared_memory_handle = nullptr;
aruid_data.flag.is_assigned.Assign(false);
}
}
u64 AppletResource::GetActiveAruid() {
return active_aruid;
}
@@ -196,4 +209,80 @@ void AppletResource::EnablePalmaBoostMode(u64 aruid, bool is_enabled) {
data[index].flag.enable_palma_boost_mode.Assign(is_enabled);
}
Result AppletResource::RegisterCoreAppletResource() {
if (ref_counter == std::numeric_limits<s32>::max() - 1) {
return ResultAppletResourceOverflow;
}
if (ref_counter == 0) {
const u64 index = GetIndexFromAruid(0);
if (index < AruidIndexMax) {
return ResultAruidAlreadyRegistered;
}
std::size_t data_index = AruidIndexMax;
for (std::size_t i = 0; i < AruidIndexMax; i++) {
if (!data[i].flag.is_initialized) {
data_index = i;
break;
}
}
if (data_index == AruidIndexMax) {
return ResultAruidNoAvailableEntries;
}
AruidData& aruid_data = data[data_index];
aruid_data.aruid = 0;
aruid_data.flag.is_initialized.Assign(true);
aruid_data.flag.enable_pad_input.Assign(true);
aruid_data.flag.enable_six_axis_sensor.Assign(true);
aruid_data.flag.bit_18.Assign(true);
aruid_data.flag.enable_touchscreen.Assign(true);
data_index = AruidIndexMax;
for (std::size_t i = 0; i < AruidIndexMax; i++) {
if (registration_list.flag[i] == RegistrationStatus::Initialized) {
if (registration_list.aruid[i] != 0) {
continue;
}
data_index = i;
break;
}
if (registration_list.flag[i] == RegistrationStatus::None) {
data_index = i;
break;
}
}
Result result = ResultSuccess;
if (data_index == AruidIndexMax) {
result = CreateAppletResource(0);
} else {
registration_list.flag[data_index] = RegistrationStatus::Initialized;
registration_list.aruid[data_index] = 0;
}
if (result.IsError()) {
UnregisterAppletResourceUserId(0);
return result;
}
}
ref_counter++;
return ResultSuccess;
}
Result AppletResource::UnregisterCoreAppletResource() {
if (ref_counter == 0) {
return ResultAppletResourceNotInitialized;
}
if (--ref_counter == 0) {
UnregisterAppletResourceUserId(0);
}
return ResultSuccess;
}
} // namespace Service::HID

View File

@@ -28,6 +28,8 @@ public:
Result RegisterAppletResourceUserId(u64 aruid, bool enable_input);
void UnregisterAppletResourceUserId(u64 aruid);
void FreeAppletResourceId(u64 aruid);
u64 GetActiveAruid();
Result GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid);
@@ -42,6 +44,9 @@ public:
void SetIsPalmaConnectable(u64 aruid, bool is_connectable);
void EnablePalmaBoostMode(u64 aruid, bool is_enabled);
Result RegisterCoreAppletResource();
Result UnregisterCoreAppletResource();
private:
static constexpr std::size_t AruidIndexMax = 0x20;
@@ -81,6 +86,7 @@ private:
u64 active_aruid{};
AruidRegisterList registration_list{};
std::array<AruidData, AruidIndexMax> data{};
s32 ref_counter{};
Core::System& system;
};

View File

@@ -20,6 +20,9 @@ constexpr Result InvalidNpadId{ErrorModule::HID, 709};
constexpr Result NpadNotConnected{ErrorModule::HID, 710};
constexpr Result InvalidArraySize{ErrorModule::HID, 715};
constexpr Result ResultAppletResourceOverflow{ErrorModule::HID, 1041};
constexpr Result ResultAppletResourceNotInitialized{ErrorModule::HID, 1042};
constexpr Result ResultSharedMemoryNotInitialized{ErrorModule::HID, 1043};
constexpr Result ResultAruidNoAvailableEntries{ErrorModule::HID, 1044};
constexpr Result ResultAruidAlreadyRegistered{ErrorModule::HID, 1046};
constexpr Result ResultAruidNotRegistered{ErrorModule::HID, 1047};

View File

@@ -222,16 +222,14 @@ void IHidServer::CreateAppletResource(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto applet_resource_user_id{rp.Pop<u64>()};
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
Result result = GetResourceManager()->CreateAppletResource(applet_resource_user_id);
if (result.IsSuccess()) {
result = GetResourceManager()->GetNpad()->Activate(applet_resource_user_id);
}
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}, result=0x{:X}",
applet_resource_user_id, result.raw);
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(result);
rb.PushIpcInterface<IAppletResource>(system, resource_manager);
rb.PushIpcInterface<IAppletResource>(system, resource_manager, applet_resource_user_id);
}
void IHidServer::ActivateDebugPad(HLERequestContext& ctx) {

View File

@@ -146,10 +146,36 @@ std::shared_ptr<UniquePad> ResourceManager::GetUniquePad() const {
}
Result ResourceManager::CreateAppletResource(u64 aruid) {
if (aruid == 0) {
const auto result = RegisterCoreAppletResource();
if (result.IsError()) {
return result;
}
return GetNpad()->Activate();
}
const auto result = CreateAppletResourceImpl(aruid);
if (result.IsError()) {
return result;
}
return GetNpad()->Activate(aruid);
}
Result ResourceManager::CreateAppletResourceImpl(u64 aruid) {
std::scoped_lock lock{shared_mutex};
return applet_resource->CreateAppletResource(aruid);
}
Result ResourceManager::RegisterCoreAppletResource() {
std::scoped_lock lock{shared_mutex};
return applet_resource->RegisterCoreAppletResource();
}
Result ResourceManager::UnregisterCoreAppletResource() {
std::scoped_lock lock{shared_mutex};
return applet_resource->UnregisterCoreAppletResource();
}
Result ResourceManager::RegisterAppletResourceUserId(u64 aruid, bool bool_value) {
std::scoped_lock lock{shared_mutex};
return applet_resource->RegisterAppletResourceUserId(aruid, bool_value);
@@ -165,6 +191,11 @@ Result ResourceManager::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle
return applet_resource->GetSharedMemoryHandle(out_handle, aruid);
}
void ResourceManager::FreeAppletResourceId(u64 aruid) {
std::scoped_lock lock{shared_mutex};
applet_resource->FreeAppletResourceId(aruid);
}
void ResourceManager::EnableInput(u64 aruid, bool is_enabled) {
std::scoped_lock lock{shared_mutex};
applet_resource->EnableInput(aruid, is_enabled);
@@ -219,8 +250,10 @@ void ResourceManager::UpdateMotion(std::uintptr_t user_data, std::chrono::nanose
console_six_axis->OnUpdate(core_timing);
}
IAppletResource::IAppletResource(Core::System& system_, std::shared_ptr<ResourceManager> resource)
: ServiceFramework{system_, "IAppletResource"}, resource_manager{resource} {
IAppletResource::IAppletResource(Core::System& system_, std::shared_ptr<ResourceManager> resource,
u64 applet_resource_user_id)
: ServiceFramework{system_, "IAppletResource"}, aruid{applet_resource_user_id},
resource_manager{resource} {
static const FunctionInfo functions[] = {
{0, &IAppletResource::GetSharedMemoryHandle, "GetSharedMemoryHandle"},
};
@@ -274,14 +307,14 @@ IAppletResource::~IAppletResource() {
system.CoreTiming().UnscheduleEvent(default_update_event, 0);
system.CoreTiming().UnscheduleEvent(mouse_keyboard_update_event, 0);
system.CoreTiming().UnscheduleEvent(motion_update_event, 0);
resource_manager->FreeAppletResourceId(aruid);
}
void IAppletResource::GetSharedMemoryHandle(HLERequestContext& ctx) {
LOG_DEBUG(Service_HID, "called");
Kernel::KSharedMemory* handle;
const u64 applet_resource_user_id = resource_manager->GetAppletResource()->GetActiveAruid();
const auto result = resource_manager->GetSharedMemoryHandle(&handle, applet_resource_user_id);
const auto result = resource_manager->GetSharedMemoryHandle(&handle, aruid);
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}, result=0x{:X}", aruid, result.raw);
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(result);

View File

@@ -66,10 +66,13 @@ public:
Result CreateAppletResource(u64 aruid);
Result RegisterCoreAppletResource();
Result UnregisterCoreAppletResource();
Result RegisterAppletResourceUserId(u64 aruid, bool bool_value);
void UnregisterAppletResourceUserId(u64 aruid);
Result GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid);
void FreeAppletResourceId(u64 aruid);
void EnableInput(u64 aruid, bool is_enabled);
void EnableSixAxisSensor(u64 aruid, bool is_enabled);
@@ -82,6 +85,8 @@ public:
void UpdateMotion(std::uintptr_t user_data, std::chrono::nanoseconds ns_late);
private:
Result CreateAppletResourceImpl(u64 aruid);
bool is_initialized{false};
mutable std::mutex shared_mutex;
@@ -121,7 +126,8 @@ private:
class IAppletResource final : public ServiceFramework<IAppletResource> {
public:
explicit IAppletResource(Core::System& system_, std::shared_ptr<ResourceManager> resource);
explicit IAppletResource(Core::System& system_, std::shared_ptr<ResourceManager> resource,
u64 applet_resource_user_id);
~IAppletResource() override;
private:
@@ -132,6 +138,7 @@ private:
std::shared_ptr<Core::Timing::EventType> mouse_keyboard_update_event;
std::shared_ptr<Core::Timing::EventType> motion_update_event;
u64 aruid;
std::shared_ptr<ResourceManager> resource_manager;
};

View File

@@ -44,10 +44,6 @@ public:
[[nodiscard]] virtual std::string GetDeviceVendor() const = 0;
[[nodiscard]] virtual std::string GetDeviceModel() const = 0;
[[nodiscard]] virtual std::string GetDeviceDriverVersion() const = 0;
// Getter/setter functions:
// ------------------------

View File

@@ -28,14 +28,6 @@ public:
return "NULL";
}
[[nodiscard]] std::string GetDeviceModel() const override {
return "NULL";
}
[[nodiscard]] std::string GetDeviceDriverVersion() const override {
return "NULL";
}
private:
Tegra::GPU& m_gpu;
RasterizerNull m_rasterizer;

View File

@@ -687,16 +687,6 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
// program_manager.RestoreGuestPipeline();
}
std::string RendererOpenGL::GetDeviceModel() const {
return reinterpret_cast<char const*>(glGetString(GL_RENDERER));
}
std::string RendererOpenGL::GetDeviceDriverVersion() const {
std::string tmp{"OpenGL: "};
tmp += reinterpret_cast<char const*>(glGetString(GL_VERSION));
return tmp;
}
void RendererOpenGL::RenderScreenshot() {
if (!renderer_settings.screenshot_requested) {
return;

View File

@@ -75,10 +75,6 @@ public:
return device.GetVendorName();
}
[[nodiscard]] std::string GetDeviceModel() const override;
[[nodiscard]] std::string GetDeviceDriverVersion() const override;
private:
/// Initializes the OpenGL state and creates persistent objects.
void InitOpenGLObjects();

View File

@@ -116,16 +116,6 @@ RendererVulkan::~RendererVulkan() {
void(device.GetLogical().WaitIdle());
}
std::string RendererVulkan::GetDeviceModel() const {
return std::string{device.GetModelName()};
}
std::string RendererVulkan::GetDeviceDriverVersion() const {
std::string tmp{"Vulkan: "};
tmp += GetReadableVersion(device.ApiVersion());
return tmp;
}
void RendererVulkan::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
if (!framebuffer) {
return;

View File

@@ -56,10 +56,6 @@ public:
return device.GetDriverName();
}
[[nodiscard]] std::string GetDeviceModel() const override;
[[nodiscard]] std::string GetDeviceDriverVersion() const override;
private:
void Report() const;

View File

@@ -35,6 +35,7 @@ add_executable(yuzu
applets/qt_web_browser_scripts.h
bootmanager.cpp
bootmanager.h
compatdb.ui
compatibility_list.cpp
compatibility_list.h
configuration/configuration_shared.cpp

View File

@@ -14,6 +14,8 @@
#include "common/fs/path_util.h"
#include "common/string_util.h"
#include "core/constants.h"
#include "core/core.h"
#include "core/hle/service/acc/profile_manager.h"
#include "yuzu/applets/qt_profile_select.h"
#include "yuzu/main.h"
#include "yuzu/util/controller_navigation.h"
@@ -47,9 +49,9 @@ QPixmap GetIcon(Common::UUID uuid) {
} // Anonymous namespace
QtProfileSelectionDialog::QtProfileSelectionDialog(
Core::HID::HIDCore& hid_core, QWidget* parent,
Core::System& system, QWidget* parent,
const Core::Frontend::ProfileSelectParameters& parameters)
: QDialog(parent), profile_manager(std::make_unique<Service::Account::ProfileManager>()) {
: QDialog(parent), profile_manager{system.GetProfileManager()} {
outer_layout = new QVBoxLayout;
instruction_label = new QLabel();
@@ -68,7 +70,7 @@ QtProfileSelectionDialog::QtProfileSelectionDialog(
tree_view = new QTreeView;
item_model = new QStandardItemModel(tree_view);
tree_view->setModel(item_model);
controller_navigation = new ControllerNavigation(hid_core, this);
controller_navigation = new ControllerNavigation(system.HIDCore(), this);
tree_view->setAlternatingRowColors(true);
tree_view->setSelectionMode(QHeaderView::SingleSelection);
@@ -106,10 +108,10 @@ QtProfileSelectionDialog::QtProfileSelectionDialog(
SelectUser(tree_view->currentIndex());
});
const auto& profiles = profile_manager->GetAllUsers();
const auto& profiles = profile_manager.GetAllUsers();
for (const auto& user : profiles) {
Service::Account::ProfileBase profile{};
if (!profile_manager->GetProfileBase(user, profile))
if (!profile_manager.GetProfileBase(user, profile))
continue;
const auto username = Common::StringFromFixedZeroTerminatedBuffer(
@@ -134,7 +136,7 @@ QtProfileSelectionDialog::~QtProfileSelectionDialog() {
int QtProfileSelectionDialog::exec() {
// Skip profile selection when there's only one.
if (profile_manager->GetUserCount() == 1) {
if (profile_manager.GetUserCount() == 1) {
user_index = 0;
return QDialog::Accepted;
}

View File

@@ -7,7 +7,6 @@
#include <QDialog>
#include <QList>
#include "core/frontend/applets/profile_select.h"
#include "core/hle/service/acc/profile_manager.h"
class ControllerNavigation;
class GMainWindow;
@@ -20,15 +19,19 @@ class QStandardItemModel;
class QTreeView;
class QVBoxLayout;
namespace Core::HID {
class HIDCore;
} // namespace Core::HID
namespace Core {
class System;
}
namespace Service::Account {
class ProfileManager;
}
class QtProfileSelectionDialog final : public QDialog {
Q_OBJECT
public:
explicit QtProfileSelectionDialog(Core::HID::HIDCore& hid_core, QWidget* parent,
explicit QtProfileSelectionDialog(Core::System& system, QWidget* parent,
const Core::Frontend::ProfileSelectParameters& parameters);
~QtProfileSelectionDialog() override;
@@ -58,7 +61,7 @@ private:
QScrollArea* scroll_area;
QDialogButtonBox* buttons;
std::unique_ptr<Service::Account::ProfileManager> profile_manager;
Service::Account::ProfileManager& profile_manager;
ControllerNavigation* controller_navigation = nullptr;
};

File diff suppressed because it is too large Load Diff

View File

@@ -1,382 +1,43 @@
// SPDX-FileCopyrightText: 2023 Yuzu Emulator Project
// SPDX-FileCopyrightText: 2017 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QButtonGroup>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QListWidget>
#include <QListWidgetItem>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QProgressBar>
#include <QPushButton>
#include <QRadioButton>
#include <QTextEdit>
#include <QVBoxLayout>
#include <QVariant>
#include <memory>
#include <QFutureWatcher>
#include <QWizard>
#include <QWizardPage>
#include <nlohmann/json.hpp>
#include "common/settings.h"
#include "core/telemetry_session.h"
using json = nlohmann::json;
using DirectCreatorUploadResponses = std::array<json, 3>;
namespace Ui {
class CompatDB;
}
enum class CompatibilityStatus {
Perfect = 7,
Playable = 8,
Ingame = 9,
IntroMenu = 10,
WontBoot = 11,
};
class IntroPage : public QWizardPage {
Q_OBJECT
public:
IntroPage(std::string* host_, std::string* username_, std::string* token_, std::string* cookie_,
std::string* current_user_, QNetworkAccessManager& network_manager_,
QWidget* parent = nullptr);
bool isComplete() const override;
void OnLogin(QNetworkReply* reply);
void OnLogout(QNetworkReply* reply);
void Login();
void Logout();
signals:
void UserChange();
void NetworkError(QString error);
void ClearErrors();
void LoggedOut();
private:
QLabel* cookie_verified;
QString login;
QString logout;
QString ready;
QPushButton* report_login;
QPushButton* report_logout;
QRadioButton* login_yes;
QLabel* header;
QVBoxLayout* layout;
QHBoxLayout* h_layout;
std::string* host;
std::string* username;
std::string* token;
std::string* cookie;
std::string* current_user;
QNetworkAccessManager& network_manager;
};
class BootPage : public QWizardPage {
Q_OBJECT
public:
BootPage(QWidget* parent = nullptr);
bool isComplete() const override;
private:
QButtonGroup* game_boot;
QRadioButton* game_boot_yes;
QRadioButton* game_boot_no;
QLabel* header;
QVBoxLayout* layout;
};
class GamePlayPage : public QWizardPage {
Q_OBJECT
public:
GamePlayPage(QWidget* parent = nullptr);
bool isComplete() const override;
private:
QButtonGroup* game_play;
QRadioButton* game_play_yes;
QRadioButton* game_play_no;
QLabel* header;
QVBoxLayout* layout;
};
class FreezePage : public QWizardPage {
Q_OBJECT
public:
FreezePage(QWidget* parent = nullptr);
bool isComplete() const override;
private:
QButtonGroup* freeze;
QRadioButton* freeze_yes;
QRadioButton* freeze_no;
QLabel* header;
QVBoxLayout* layout;
};
class CompletePage : public QWizardPage {
Q_OBJECT
public:
CompletePage(QWidget* parent = nullptr);
bool isComplete() const override;
private:
QButtonGroup* complete;
QRadioButton* complete_yes;
QRadioButton* complete_no;
QLabel* header;
QVBoxLayout* layout;
};
class GraphicalPage : public QWizardPage {
Q_OBJECT
public:
GraphicalPage(QWidget* parent = nullptr);
bool isComplete() const override;
private:
QButtonGroup* graphical;
QRadioButton* graphical_major;
QRadioButton* graphical_minor;
QRadioButton* graphical_none;
QLabel* header;
QVBoxLayout* layout;
};
class AudioPage : public QWizardPage {
Q_OBJECT
public:
AudioPage(QWidget* parent = nullptr);
bool isComplete() const override;
private:
QButtonGroup* audio;
QRadioButton* audio_major;
QRadioButton* audio_minor;
QRadioButton* audio_none;
QLabel* header;
QVBoxLayout* layout;
};
class CommentPage : public QWizardPage {
Q_OBJECT
public:
CommentPage(QWidget* parent = nullptr);
bool isComplete() const override;
private:
QButtonGroup* comment;
QRadioButton* comment_yes;
QRadioButton* comment_no;
QTextEdit* editor;
QLabel* header;
QVBoxLayout* layout;
};
class ReviewPage : public QWizardPage {
Q_OBJECT
public:
ReviewPage(std::string* host_, std::string* cookie_, std::string* csrf_,
std::string yuzu_version_, std::string game_version_, std::string program_id_,
std::string cpu_model_, std::string cpu_brand_string_, std::string ram_,
std::string swap_, std::string gpu_vendor_, std::string gpu_model_,
std::string gpu_version_, std::string os_, Settings::Values& settings_values_,
QNetworkAccessManager& network_manager_, QWidget* parent = nullptr);
CompatibilityStatus CalculateCompatibility() const;
bool isComplete() const override;
void initializePage() override;
void CSRF();
void OnCSRF(QNetworkReply* reply);
void EnableSend(const QString& text);
void Send();
void OnSend(QNetworkReply* reply);
signals:
void NetworkError(QString error);
void ClearErrors();
void ReportMade(QByteArray review);
void SetCSRF(QByteArray csrf_);
private:
QRadioButton* report_sent;
QPushButton* report_send;
QVBoxLayout* layout;
QLabel* review;
QLabel* label;
QLineEdit* label_edit;
QLabel* comment;
QLabel* comment_view;
QLabel* rating;
QLabel* rating_view;
json report;
std::string yuzu_version;
std::string game_version;
std::string program_id;
std::string cpu_model;
std::string cpu_brand_string;
std::string ram;
std::string swap;
std::string gpu_vendor;
std::string gpu_model;
std::string gpu_version;
std::string os;
std::string* host;
std::string* cookie;
std::string* csrf;
QNetworkAccessManager& network_manager;
Settings::Values& settings_values;
};
class ScreenshotsPage : public QWizardPage {
Q_OBJECT
public:
friend class QVariant;
ScreenshotsPage(std::string* host_, std::string* cookie_, std::string* csrf_,
std::string* report_, std::string screenshot_path_,
QNetworkAccessManager& network_manager_, QWidget* parent = nullptr);
bool isComplete() const override;
void initializePage() override;
void UploadFiles();
void RemoveFiles();
void OnUploadURL(QNetworkReply* reply);
void GetUploadURL();
void OnUpload(QNetworkReply* reply);
void OnEdit(QNetworkReply* reply);
void EditReport();
void Checked() {
bool vis = false;
for (int i = 0; i < file_list->count(); i++) {
auto item_ = file_list->item(i);
if (item_->checkState() == Qt::Checked) {
vis = true;
}
}
upload->setVisible(vis);
}
signals:
void NetworkError(QString error);
void ClearErrors();
void ReportChange(QByteArray report_);
public slots:
void UploadProgress(qint64 bytesSent, qint64 bytesTotal);
void PickFiles();
void PickItems(QListWidgetItem* item);
private:
QRadioButton* edit_sent;
QButtonGroup* screenshots;
QRadioButton* screenshots_yes;
QRadioButton* screenshots_no;
QPushButton* upload;
QPushButton* del;
QLabel* info;
QLabel* status;
QLabel* header;
QVBoxLayout* layout;
QFileDialog* file_picker;
QListWidget* file_list;
std::string screenshot_path;
std::string* host;
std::string* cookie;
std::string* csrf;
std::string* report;
json json_report;
QProgressBar* upload_progress;
QNetworkAccessManager& network_manager;
int imgs;
/**
* see:
* https://developers.cloudflare.com/images/cloudflare-images/upload-images/direct-creator-upload/
*/
DirectCreatorUploadResponses dcus;
int uploaded;
int failed;
const QString file_filter =
QString::fromLatin1("PNG (*.png);;JPEG (*.jpg *.jpeg);;WEBP (*.webp)");
};
class ThankYouPage : public QWizardPage {
Q_OBJECT
public:
ThankYouPage(QWidget* parent = nullptr);
Perfect = 0,
Playable = 1,
// Unused: Okay = 2,
Ingame = 3,
IntroMenu = 4,
WontBoot = 5,
};
class CompatDB : public QWizard {
Q_OBJECT
public:
explicit CompatDB(std::string yuzu_verison_, std::string game_version_, std::string program_id_,
std::string cpu_model_, std::string cpu_brand_string_, std::string ram_,
std::string swap_, std::string gpu_vendor_, std::string gpu_model_,
std::string gpu_version_, std::string os_, Settings::Values& settings_values_,
std::string screenshot_path_, QWidget* parent = nullptr);
~CompatDB() = default;
explicit CompatDB(Core::TelemetrySession& telemetry_session_, QWidget* parent = nullptr);
~CompatDB();
int nextId() const override;
enum {
Page_Intro,
Page_GameBoot,
Page_GamePlay,
Page_Freeze,
Page_Complete,
Page_Graphical,
Page_Audio,
Page_Comment,
Page_Review,
Page_Screenshots,
Page_ThankYou
};
public slots:
void OnUserChange();
void NetworkError(QString error);
void Logout();
void ClearErrors();
void SetCSRFToken(QByteArray csrrf_);
void ReportMade(QByteArray report_);
signals:
void UserChange(QString cookie, QString user);
private:
QLabel* network_errors;
QFutureWatcher<bool> testcase_watcher;
std::string host;
std::string username;
std::string token;
std::string cookie;
std::string csrf_token;
std::string current_user;
std::string report;
std::unique_ptr<Ui::CompatDB> ui;
QNetworkAccessManager* network_manager;
void Submit();
CompatibilityStatus CalculateCompatibility() const;
void OnTestcaseSubmitted();
void EnableNext();
Core::TelemetrySession& telemetry_session;
};

398
src/yuzu/compatdb.ui Normal file
View File

@@ -0,0 +1,398 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CompatDB</class>
<widget class="QWizard" name="CompatDB">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>482</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>500</width>
<height>410</height>
</size>
</property>
<property name="windowTitle">
<string>Report Compatibility</string>
</property>
<property name="options">
<set>QWizard::DisabledBackButtonOnLastPage|QWizard::HelpButtonOnRight|QWizard::NoBackButtonOnStartPage</set>
</property>
<widget class="QWizardPage" name="wizard_Info">
<property name="title">
<string>Report Game Compatibility</string>
</property>
<attribute name="pageId">
<string notr="true">0</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="lbl_Spiel">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Should you choose to submit a test case to the &lt;/span&gt;&lt;a href=&quot;https://yuzu-emu.org/game/&quot;&gt;&lt;span style=&quot; font-size:10pt; text-decoration: underline; color:#0000ff;&quot;&gt;yuzu Compatibility List&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;, The following information will be collected and displayed on the site:&lt;/span&gt;&lt;/p&gt;&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Hardware Information (CPU / GPU / Operating System)&lt;/li&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Which version of yuzu you are running&lt;/li&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;The connected yuzu account&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizard_GameBoot">
<property name="title">
<string>Report Game Compatibility</string>
</property>
<attribute name="pageId">
<string notr="true">1</string>
</attribute>
<layout class="QFormLayout" name="formLayout1">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lbl_Independent1">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Does the game boot?&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<spacer name="verticalSpacer1">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="radioButton_GameBoot_Yes">
<property name="text">
<string>Yes The game starts to output video or audio</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QRadioButton" name="radioButton_GameBoot_No">
<property name="text">
<string>No The game doesn't get past the &quot;Launching...&quot; screen</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizard_GamePlay">
<property name="title">
<string>Report Game Compatibility</string>
</property>
<attribute name="pageId">
<string notr="true">2</string>
</attribute>
<layout class="QFormLayout" name="formLayout2">
<item row="2" column="0">
<widget class="QRadioButton" name="radioButton_Gameplay_Yes">
<property name="text">
<string>Yes The game gets past the intro/menu and into gameplay</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QRadioButton" name="radioButton_Gameplay_No">
<property name="text">
<string>No The game crashes or freezes while loading or using the menu</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lbl_Independent2">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Does the game reach gameplay?&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<spacer name="verticalSpacer2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizard_NoFreeze">
<property name="title">
<string>Report Game Compatibility</string>
</property>
<attribute name="pageId">
<string notr="true">3</string>
</attribute>
<layout class="QFormLayout" name="formLayout3">
<item row="2" column="0">
<widget class="QRadioButton" name="radioButton_NoFreeze_Yes">
<property name="text">
<string>Yes The game works without crashes</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QRadioButton" name="radioButton_NoFreeze_No">
<property name="text">
<string>No The game crashes or freezes during gameplay</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lbl_Independent3">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Does the game work without crashing, freezing or locking up during gameplay?&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<spacer name="verticalSpacer3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizard_Complete">
<property name="title">
<string>Report Game Compatibility</string>
</property>
<attribute name="pageId">
<string notr="true">4</string>
</attribute>
<layout class="QFormLayout" name="formLayout4">
<item row="2" column="0">
<widget class="QRadioButton" name="radioButton_Complete_Yes">
<property name="text">
<string>Yes The game can be finished without any workarounds</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QRadioButton" name="radioButton_Complete_No">
<property name="text">
<string>No The game can't progress past a certain area</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lbl_Independent4">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Is the game completely playable from start to finish?&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<spacer name="verticalSpacer4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizard_Graphical">
<property name="title">
<string>Report Game Compatibility</string>
</property>
<attribute name="pageId">
<string notr="true">5</string>
</attribute>
<layout class="QFormLayout" name="formLayout5">
<item row="2" column="0">
<widget class="QRadioButton" name="radioButton_Graphical_Major">
<property name="text">
<string>Major The game has major graphical errors</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QRadioButton" name="radioButton_Graphical_Minor">
<property name="text">
<string>Minor The game has minor graphical errors</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QRadioButton" name="radioButton_Graphical_No">
<property name="text">
<string>None Everything is rendered as it looks on the Nintendo Switch</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lbl_Independent5">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Does the game have any graphical glitches?&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<spacer name="verticalSpacer5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizard_Audio">
<property name="title">
<string>Report Game Compatibility</string>
</property>
<attribute name="pageId">
<string notr="true">6</string>
</attribute>
<layout class="QFormLayout" name="formLayout6">
<item row="2" column="0">
<widget class="QRadioButton" name="radioButton_Audio_Major">
<property name="text">
<string>Major The game has major audio errors</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QRadioButton" name="radioButton_Audio_Minor">
<property name="text">
<string>Minor The game has minor audio errors</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QRadioButton" name="radioButton_Audio_No">
<property name="text">
<string>None Audio is played perfectly</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lbl_Independent6">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Does the game have any audio glitches / missing effects?&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<spacer name="verticalSpacer6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizard_ThankYou">
<property name="title">
<string>Thank you for your submission!</string>
</property>
<attribute name="pageId">
<string notr="true">7</string>
</attribute>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -381,7 +381,7 @@
<item row="5" column="0">
<widget class="QCheckBox" name="disable_buffer_reorder">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;When checked, disables reording of mapped memory uploads which allows to associate uploads with specific draws. May reduce performance in some cases.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;When checked, disables reordering of mapped memory uploads which allows to associate uploads with specific draws. May reduce performance in some cases.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Disable Buffer Reorder</string>

View File

@@ -76,9 +76,9 @@ QString GetProfileUsernameFromUser(QWidget* parent, const QString& description_t
}
} // Anonymous namespace
ConfigureProfileManager::ConfigureProfileManager(const Core::System& system_, QWidget* parent)
ConfigureProfileManager::ConfigureProfileManager(Core::System& system_, QWidget* parent)
: QWidget(parent), ui{std::make_unique<Ui::ConfigureProfileManager>()},
profile_manager(std::make_unique<Service::Account::ProfileManager>()), system{system_} {
profile_manager{system_.GetProfileManager()}, system{system_} {
ui->setupUi(this);
tree_view = new QTreeView;
@@ -149,10 +149,10 @@ void ConfigureProfileManager::SetConfiguration() {
}
void ConfigureProfileManager::PopulateUserList() {
const auto& profiles = profile_manager->GetAllUsers();
const auto& profiles = profile_manager.GetAllUsers();
for (const auto& user : profiles) {
Service::Account::ProfileBase profile{};
if (!profile_manager->GetProfileBase(user, profile))
if (!profile_manager.GetProfileBase(user, profile))
continue;
const auto username = Common::StringFromFixedZeroTerminatedBuffer(
@@ -167,11 +167,11 @@ void ConfigureProfileManager::PopulateUserList() {
}
void ConfigureProfileManager::UpdateCurrentUser() {
ui->pm_add->setEnabled(profile_manager->GetUserCount() < Service::Account::MAX_USERS);
ui->pm_add->setEnabled(profile_manager.GetUserCount() < Service::Account::MAX_USERS);
const auto& current_user = profile_manager->GetUser(Settings::values.current_user.GetValue());
const auto& current_user = profile_manager.GetUser(Settings::values.current_user.GetValue());
ASSERT(current_user);
const auto username = GetAccountUsername(*profile_manager, *current_user);
const auto username = GetAccountUsername(profile_manager, *current_user);
scene->clear();
scene->addPixmap(
@@ -187,11 +187,11 @@ void ConfigureProfileManager::ApplyConfiguration() {
void ConfigureProfileManager::SelectUser(const QModelIndex& index) {
Settings::values.current_user =
std::clamp<s32>(index.row(), 0, static_cast<s32>(profile_manager->GetUserCount() - 1));
std::clamp<s32>(index.row(), 0, static_cast<s32>(profile_manager.GetUserCount() - 1));
UpdateCurrentUser();
ui->pm_remove->setEnabled(profile_manager->GetUserCount() >= 2);
ui->pm_remove->setEnabled(profile_manager.GetUserCount() >= 2);
ui->pm_rename->setEnabled(true);
ui->pm_set_image->setEnabled(true);
}
@@ -204,18 +204,18 @@ void ConfigureProfileManager::AddUser() {
}
const auto uuid = Common::UUID::MakeRandom();
profile_manager->CreateNewUser(uuid, username.toStdString());
profile_manager.CreateNewUser(uuid, username.toStdString());
item_model->appendRow(new QStandardItem{GetIcon(uuid), FormatUserEntryText(username, uuid)});
}
void ConfigureProfileManager::RenameUser() {
const auto user = tree_view->currentIndex().row();
const auto uuid = profile_manager->GetUser(user);
const auto uuid = profile_manager.GetUser(user);
ASSERT(uuid);
Service::Account::ProfileBase profile{};
if (!profile_manager->GetProfileBase(*uuid, profile))
if (!profile_manager.GetProfileBase(*uuid, profile))
return;
const auto new_username = GetProfileUsernameFromUser(this, tr("Enter a new username:"));
@@ -227,7 +227,7 @@ void ConfigureProfileManager::RenameUser() {
std::fill(profile.username.begin(), profile.username.end(), '\0');
std::copy(username_std.begin(), username_std.end(), profile.username.begin());
profile_manager->SetProfileBase(*uuid, profile);
profile_manager.SetProfileBase(*uuid, profile);
item_model->setItem(
user, 0,
@@ -238,9 +238,9 @@ void ConfigureProfileManager::RenameUser() {
void ConfigureProfileManager::ConfirmDeleteUser() {
const auto index = tree_view->currentIndex().row();
const auto uuid = profile_manager->GetUser(index);
const auto uuid = profile_manager.GetUser(index);
ASSERT(uuid);
const auto username = GetAccountUsername(*profile_manager, *uuid);
const auto username = GetAccountUsername(profile_manager, *uuid);
confirm_dialog->SetInfo(username, *uuid, [this, uuid]() { DeleteUser(*uuid); });
confirm_dialog->show();
@@ -252,7 +252,7 @@ void ConfigureProfileManager::DeleteUser(const Common::UUID& uuid) {
}
UpdateCurrentUser();
if (!profile_manager->RemoveUser(uuid)) {
if (!profile_manager.RemoveUser(uuid)) {
return;
}
@@ -265,7 +265,7 @@ void ConfigureProfileManager::DeleteUser(const Common::UUID& uuid) {
void ConfigureProfileManager::SetUserImage() {
const auto index = tree_view->currentIndex().row();
const auto uuid = profile_manager->GetUser(index);
const auto uuid = profile_manager.GetUser(index);
ASSERT(uuid);
const auto file = QFileDialog::getOpenFileName(this, tr("Select User Image"), QString(),
@@ -317,7 +317,7 @@ void ConfigureProfileManager::SetUserImage() {
}
}
const auto username = GetAccountUsername(*profile_manager, *uuid);
const auto username = GetAccountUsername(profile_manager, *uuid);
item_model->setItem(index, 0,
new QStandardItem{GetIcon(*uuid), FormatUserEntryText(username, *uuid)});
UpdateCurrentUser();

View File

@@ -52,7 +52,7 @@ class ConfigureProfileManager : public QWidget {
Q_OBJECT
public:
explicit ConfigureProfileManager(const Core::System& system_, QWidget* parent = nullptr);
explicit ConfigureProfileManager(Core::System& system_, QWidget* parent = nullptr);
~ConfigureProfileManager() override;
void ApplyConfiguration();
@@ -85,7 +85,6 @@ private:
std::unique_ptr<Ui::ConfigureProfileManager> ui;
bool enabled = false;
std::unique_ptr<Service::Account::ProfileManager> profile_manager;
Service::Account::ProfileManager& profile_manager;
const Core::System& system;
};

View File

@@ -42,7 +42,6 @@ ConfigureWeb::ConfigureWeb(QWidget* parent)
&ConfigureWeb::RefreshTelemetryID);
connect(ui->button_verify_login, &QPushButton::clicked, this, &ConfigureWeb::VerifyLogin);
connect(&verify_watcher, &QFutureWatcher<bool>::finished, this, &ConfigureWeb::OnLoginVerified);
connect(ui->button_change_url, &QPushButton::clicked, this, &ConfigureWeb::ChangeURL);
#ifndef USE_DISCORD_PRESENCE
ui->discord_group->setVisible(false);
@@ -94,7 +93,6 @@ void ConfigureWeb::SetConfiguration() {
ui->username->setText(QString::fromStdString(Settings::values.yuzu_username.GetValue()));
}
ui->edit_url->setText(QString::fromStdString(Settings::values.report_api_url.GetValue()));
ui->toggle_telemetry->setChecked(Settings::values.enable_telemetry.GetValue());
ui->edit_token->setText(QString::fromStdString(GenerateDisplayToken(
Settings::values.yuzu_username.GetValue(), Settings::values.yuzu_token.GetValue())));
@@ -180,7 +178,3 @@ void ConfigureWeb::SetWebServiceConfigEnabled(bool enabled) {
ui->label_disable_info->setVisible(!enabled);
ui->groupBoxWebConfig->setEnabled(enabled);
}
void ConfigureWeb::ChangeURL() {
Settings::values.report_api_url = ui->edit_url->text().toStdString();
}

View File

@@ -32,8 +32,6 @@ private:
void SetConfiguration();
void ChangeURL();
bool user_verified = true;
QFutureWatcher<bool> verify_watcher;

View File

@@ -109,53 +109,6 @@
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayoutYuzureport">
<item row="2" column="3">
<widget class="QPushButton" name="button_change_url">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Change</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_url">
<property name="text">
<string>URL: </string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QLineEdit" name="edit_url">
<property name="maxLength">
<number>80</number>
</property>
</widget>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>

View File

@@ -346,7 +346,7 @@ GMainWindow::GMainWindow(std::unique_ptr<QtConfig> config_, bool has_broken_vulk
SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue());
discord_rpc->Update();
play_time_manager = std::make_unique<PlayTime::PlayTimeManager>();
play_time_manager = std::make_unique<PlayTime::PlayTimeManager>(system->GetProfileManager());
system->GetRoomNetwork().Init();
@@ -526,8 +526,7 @@ GMainWindow::GMainWindow(std::unique_ptr<QtConfig> config_, bool has_broken_vulk
continue;
}
const Service::Account::ProfileManager manager;
if (!manager.UserExistsIndex(selected_user)) {
if (!system->GetProfileManager().UserExistsIndex(selected_user)) {
LOG_ERROR(Frontend, "Selected user doesn't exist");
continue;
}
@@ -691,7 +690,7 @@ void GMainWindow::ControllerSelectorRequestExit() {
void GMainWindow::ProfileSelectorSelectProfile(
const Core::Frontend::ProfileSelectParameters& parameters) {
profile_select_applet = new QtProfileSelectionDialog(system->HIDCore(), this, parameters);
profile_select_applet = new QtProfileSelectionDialog(*system, this, parameters);
SCOPE_EXIT({
profile_select_applet->deleteLater();
profile_select_applet = nullptr;
@@ -706,8 +705,8 @@ void GMainWindow::ProfileSelectorSelectProfile(
return;
}
const Service::Account::ProfileManager manager;
const auto uuid = manager.GetUser(static_cast<std::size_t>(profile_select_applet->GetIndex()));
const auto uuid = system->GetProfileManager().GetUser(
static_cast<std::size_t>(profile_select_applet->GetIndex()));
if (!uuid.has_value()) {
emit ProfileSelectorFinishedSelection(std::nullopt);
return;
@@ -1856,7 +1855,7 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
bool GMainWindow::SelectAndSetCurrentUser(
const Core::Frontend::ProfileSelectParameters& parameters) {
QtProfileSelectionDialog dialog(system->HIDCore(), this, parameters);
QtProfileSelectionDialog dialog(*system, this, parameters);
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
dialog.setWindowModality(Qt::WindowModal);
@@ -2271,7 +2270,7 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
.display_options = {},
.purpose = Service::AM::Applets::UserSelectionPurpose::General,
};
QtProfileSelectionDialog dialog(system->HIDCore(), this, parameters);
QtProfileSelectionDialog dialog(*system, this, parameters);
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
dialog.setWindowModality(Qt::WindowModal);
@@ -2288,8 +2287,8 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
return;
}
Service::Account::ProfileManager manager;
const auto user_id = manager.GetUser(static_cast<std::size_t>(index));
const auto user_id =
system->GetProfileManager().GetUser(static_cast<std::size_t>(index));
ASSERT(user_id);
const auto user_save_data_path = FileSys::SaveDataFactory::GetFullPath(
@@ -3617,12 +3616,6 @@ void GMainWindow::ErrorDisplayRequestExit() {
}
}
void GMainWindow::OnReportUserChange(QString cookie_, QString user_) {
Settings::values.yuzu_cookie = cookie_.toStdString();
Settings::values.report_user = user_.toStdString();
config->SaveAllValues();
}
void GMainWindow::OnMenuReportCompatibility() {
#if defined(ARCHITECTURE_x86_64) && !defined(__APPLE__)
const auto& caps = Common::GetCPUCaps();
@@ -3641,64 +3634,7 @@ void GMainWindow::OnMenuReportCompatibility() {
if (!Settings::values.yuzu_token.GetValue().empty() &&
!Settings::values.yuzu_username.GetValue().empty()) {
Loader::AppLoader& app_loader = system->GetAppLoader();
FileSys::ContentProvider& content_provider = system->GetContentProvider();
Service::FileSystem::FileSystemController& fsc = system->GetFileSystemController();
u64 program_id{};
std::string game_version;
std::string formatted_program_id;
const Loader::ResultStatus res{app_loader.ReadProgramId(program_id)};
if (res == Loader::ResultStatus::Success) {
formatted_program_id = fmt::format("{:016X}", program_id);
FileSys::NACP control;
app_loader.ReadControlData(control);
game_version = control.GetVersionString();
if (game_version.empty()) {
const auto metadata = [&content_provider, &fsc, program_id] {
const FileSys::PatchManager pm{program_id, fsc, content_provider};
return pm.GetControlMetadata();
}();
if (auto meta = metadata.first.get(); meta != nullptr) {
game_version = meta->GetVersionString();
}
}
}
std::string yuzu_version = std::string{Common::g_build_name};
if (yuzu_version.empty()) {
yuzu_version = std::string{Common::g_scm_branch};
}
std::string cpu_model{caps.cpu_string};
std::string cpu_brand_string{caps.brand_string};
std::string ram =
fmt::format("{:.2f} GiB", Common::GetMemInfo().TotalPhysicalMemory / f64{1_GiB});
std::string swap =
fmt::format("{:.2f} GiB", Common::GetMemInfo().TotalSwapMemory / f64{1_GiB});
std::string os = PrettyProductName().toStdString();
const auto& renderer = system->GPU().Renderer();
const auto gpu_vendor = renderer.GetDeviceVendor();
const auto gpu_model = renderer.GetDeviceModel();
const auto gpu_version = renderer.GetDeviceDriverVersion();
CompatDB compatdb{yuzu_version,
game_version,
formatted_program_id,
cpu_model,
cpu_brand_string,
ram,
swap,
gpu_vendor,
gpu_model,
gpu_version,
os,
Settings::values,
Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir),
this};
connect(&compatdb, &CompatDB::UserChange, this, &GMainWindow::OnReportUserChange);
CompatDB compatdb{system->TelemetrySession(), this};
compatdb.exec();
} else {
QMessageBox::critical(

View File

@@ -262,7 +262,6 @@ public slots:
void WebBrowserRequestExit();
void OnAppFocusStateChanged(Qt::ApplicationState state);
void OnTasStateChanged();
void OnReportUserChange(QString cookie, QString user);
private:
/// Updates an action's shortcut and text to reflect an updated hotkey from the hotkey registry.

View File

@@ -27,9 +27,9 @@
Lobby::Lobby(QWidget* parent, QStandardItemModel* list,
std::shared_ptr<Core::AnnounceMultiplayerSession> session, Core::System& system_)
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint),
ui(std::make_unique<Ui::Lobby>()), announce_multiplayer_session(session),
profile_manager(std::make_unique<Service::Account::ProfileManager>()), system{system_},
room_network{system.GetRoomNetwork()} {
ui(std::make_unique<Ui::Lobby>()),
announce_multiplayer_session(session), system{system_}, room_network{
system.GetRoomNetwork()} {
ui->setupUi(this);
// setup the watcher for background connections
@@ -299,14 +299,15 @@ void Lobby::OnRefreshLobby() {
}
std::string Lobby::GetProfileUsername() {
const auto& current_user = profile_manager->GetUser(Settings::values.current_user.GetValue());
const auto& current_user =
system.GetProfileManager().GetUser(Settings::values.current_user.GetValue());
Service::Account::ProfileBase profile{};
if (!current_user.has_value()) {
return "";
}
if (!profile_manager->GetProfileBase(*current_user, profile)) {
if (!system.GetProfileManager().GetProfileBase(*current_user, profile)) {
return "";
}

View File

@@ -24,10 +24,6 @@ namespace Core {
class System;
}
namespace Service::Account {
class ProfileManager;
}
/**
* Listing of all public games pulled from services. The lobby should be simple enough for users to
* find the game they want to play, and join it.
@@ -103,7 +99,6 @@ private:
QFutureWatcher<AnnounceMultiplayerRoom::RoomList> room_list_watcher;
std::weak_ptr<Core::AnnounceMultiplayerSession> announce_multiplayer_session;
std::unique_ptr<Service::Account::ProfileManager> profile_manager;
QFutureWatcher<void>* watcher;
Validation validation;
Core::System& system;

View File

@@ -20,8 +20,8 @@ struct PlayTimeElement {
PlayTime play_time;
};
std::optional<std::filesystem::path> GetCurrentUserPlayTimePath() {
const Service::Account::ProfileManager manager;
std::optional<std::filesystem::path> GetCurrentUserPlayTimePath(
const Service::Account::ProfileManager& manager) {
const auto uuid = manager.GetUser(static_cast<s32>(Settings::values.current_user));
if (!uuid.has_value()) {
return std::nullopt;
@@ -30,8 +30,9 @@ std::optional<std::filesystem::path> GetCurrentUserPlayTimePath() {
uuid->RawString().append(".bin");
}
[[nodiscard]] bool ReadPlayTimeFile(PlayTimeDatabase& out_play_time_db) {
const auto filename = GetCurrentUserPlayTimePath();
[[nodiscard]] bool ReadPlayTimeFile(PlayTimeDatabase& out_play_time_db,
const Service::Account::ProfileManager& manager) {
const auto filename = GetCurrentUserPlayTimePath(manager);
if (!filename.has_value()) {
LOG_ERROR(Frontend, "Failed to get current user path");
@@ -66,8 +67,9 @@ std::optional<std::filesystem::path> GetCurrentUserPlayTimePath() {
return true;
}
[[nodiscard]] bool WritePlayTimeFile(const PlayTimeDatabase& play_time_db) {
const auto filename = GetCurrentUserPlayTimePath();
[[nodiscard]] bool WritePlayTimeFile(const PlayTimeDatabase& play_time_db,
const Service::Account::ProfileManager& manager) {
const auto filename = GetCurrentUserPlayTimePath(manager);
if (!filename.has_value()) {
LOG_ERROR(Frontend, "Failed to get current user path");
@@ -96,8 +98,9 @@ std::optional<std::filesystem::path> GetCurrentUserPlayTimePath() {
} // namespace
PlayTimeManager::PlayTimeManager() {
if (!ReadPlayTimeFile(database)) {
PlayTimeManager::PlayTimeManager(Service::Account::ProfileManager& profile_manager)
: manager{profile_manager} {
if (!ReadPlayTimeFile(database, manager)) {
LOG_ERROR(Frontend, "Failed to read play time database! Resetting to default.");
}
}
@@ -142,7 +145,7 @@ void PlayTimeManager::AutoTimestamp(std::stop_token stop_token) {
}
void PlayTimeManager::Save() {
if (!WritePlayTimeFile(database)) {
if (!WritePlayTimeFile(database, manager)) {
LOG_ERROR(Frontend, "Failed to update play time database!");
}
}

View File

@@ -11,6 +11,10 @@
#include "common/common_types.h"
#include "common/polyfill_thread.h"
namespace Service::Account {
class ProfileManager;
}
namespace PlayTime {
using ProgramId = u64;
@@ -19,7 +23,7 @@ using PlayTimeDatabase = std::map<ProgramId, PlayTime>;
class PlayTimeManager {
public:
explicit PlayTimeManager();
explicit PlayTimeManager(Service::Account::ProfileManager& profile_manager);
~PlayTimeManager();
YUZU_NON_COPYABLE(PlayTimeManager);
@@ -32,11 +36,13 @@ public:
void Stop();
private:
void AutoTimestamp(std::stop_token stop_token);
void Save();
PlayTimeDatabase database;
u64 running_program_id;
std::jthread play_time_thread;
void AutoTimestamp(std::stop_token stop_token);
void Save();
Service::Account::ProfileManager& manager;
};
QString ReadablePlayTime(qulonglong time_seconds);