|
|
|
@ -70,9 +70,8 @@
|
|
|
|
|
|
|
|
|
|
// These are wrappers to avoid the calls to CreateDirectory and CreateFile because of the Windows
|
|
|
|
|
// defines.
|
|
|
|
|
static FileSys::VirtualDir VfsFilesystemCreateDirectoryWrapper(
|
|
|
|
|
const FileSys::VirtualFilesystem& vfs, const std::string& path, FileSys::OpenMode mode) {
|
|
|
|
|
return vfs->CreateDirectory(path, mode);
|
|
|
|
|
static FileSys::VirtualDir VfsFilesystemCreateDirectoryWrapper(const std::string& path, FileSys::OpenMode mode) {
|
|
|
|
|
return QtCommon::vfs->CreateDirectory(path, mode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::VirtualDir& dir,
|
|
|
|
@ -394,12 +393,10 @@ inline static bool isDarkMode() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GMainWindow::GMainWindow(bool has_broken_vulkan)
|
|
|
|
|
: ui{std::make_unique<Ui::MainWindow>()}, system{std::make_unique<Core::System>()},
|
|
|
|
|
: ui{std::make_unique<Ui::MainWindow>()},
|
|
|
|
|
input_subsystem{std::make_shared<InputCommon::InputSubsystem>()}, user_data_migrator{this},
|
|
|
|
|
vfs{std::make_shared<FileSys::RealVfsFilesystem>()},
|
|
|
|
|
provider{std::make_unique<FileSys::ManualContentProvider>()} {
|
|
|
|
|
QtCommon::SetSystem(system.get());
|
|
|
|
|
QtCommon::SetRootObject(this);
|
|
|
|
|
QtCommon::Init(this);
|
|
|
|
|
|
|
|
|
|
Common::FS::CreateEdenPaths();
|
|
|
|
|
this->config = std::make_unique<QtConfig>();
|
|
|
|
@ -431,7 +428,7 @@ GMainWindow::GMainWindow(bool has_broken_vulkan)
|
|
|
|
|
|
|
|
|
|
UISettings::RestoreWindowState(config);
|
|
|
|
|
|
|
|
|
|
system->Initialize();
|
|
|
|
|
QtCommon::system->Initialize();
|
|
|
|
|
|
|
|
|
|
Common::Log::Initialize();
|
|
|
|
|
Common::Log::Start();
|
|
|
|
@ -453,7 +450,7 @@ GMainWindow::GMainWindow(bool has_broken_vulkan)
|
|
|
|
|
SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue());
|
|
|
|
|
discord_rpc->Update();
|
|
|
|
|
|
|
|
|
|
play_time_manager = std::make_unique<PlayTime::PlayTimeManager>(system->GetProfileManager());
|
|
|
|
|
play_time_manager = std::make_unique<PlayTime::PlayTimeManager>(QtCommon::system->GetProfileManager());
|
|
|
|
|
|
|
|
|
|
Network::Init();
|
|
|
|
|
|
|
|
|
@ -470,7 +467,7 @@ GMainWindow::GMainWindow(bool has_broken_vulkan)
|
|
|
|
|
ConnectMenuEvents();
|
|
|
|
|
ConnectWidgetEvents();
|
|
|
|
|
|
|
|
|
|
system->HIDCore().ReloadInputDevices();
|
|
|
|
|
QtCommon::system->HIDCore().ReloadInputDevices();
|
|
|
|
|
controller_dialog->refreshConfiguration();
|
|
|
|
|
|
|
|
|
|
const auto branch_name = std::string(Common::g_scm_branch);
|
|
|
|
@ -514,7 +511,7 @@ GMainWindow::GMainWindow(bool has_broken_vulkan)
|
|
|
|
|
std::chrono::duration_cast<std::chrono::duration<f64, std::milli>>(
|
|
|
|
|
Common::Windows::SetCurrentTimerResolutionToMaximum())
|
|
|
|
|
.count());
|
|
|
|
|
system->CoreTiming().SetTimerResolutionNs(Common::Windows::GetCurrentTimerResolution());
|
|
|
|
|
QtCommon::system->CoreTiming().SetTimerResolutionNs(Common::Windows::GetCurrentTimerResolution());
|
|
|
|
|
#endif
|
|
|
|
|
UpdateWindowTitle();
|
|
|
|
|
|
|
|
|
@ -540,10 +537,10 @@ GMainWindow::GMainWindow(bool has_broken_vulkan)
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
system->SetContentProvider(std::make_unique<FileSys::ContentProviderUnion>());
|
|
|
|
|
system->RegisterContentProvider(FileSys::ContentProviderUnionSlot::FrontendManual,
|
|
|
|
|
QtCommon::system->SetContentProvider(std::make_unique<FileSys::ContentProviderUnion>());
|
|
|
|
|
QtCommon::system->RegisterContentProvider(FileSys::ContentProviderUnionSlot::FrontendManual,
|
|
|
|
|
provider.get());
|
|
|
|
|
system->GetFileSystemController().CreateFactories(*vfs);
|
|
|
|
|
QtCommon::system->GetFileSystemController().CreateFactories(*QtCommon::vfs);
|
|
|
|
|
|
|
|
|
|
// Remove cached contents generated during the previous session
|
|
|
|
|
RemoveCachedContents();
|
|
|
|
@ -657,7 +654,7 @@ GMainWindow::GMainWindow(bool has_broken_vulkan)
|
|
|
|
|
if (!argument_ok) {
|
|
|
|
|
// try to look it up by username, only finds the first username that matches.
|
|
|
|
|
const std::string user_arg_str = args[user_arg_idx].toStdString();
|
|
|
|
|
const auto user_idx = system->GetProfileManager().GetUserIndex(user_arg_str);
|
|
|
|
|
const auto user_idx = QtCommon::system->GetProfileManager().GetUserIndex(user_arg_str);
|
|
|
|
|
|
|
|
|
|
if (user_idx == std::nullopt) {
|
|
|
|
|
LOG_ERROR(Frontend, "Invalid user argument");
|
|
|
|
@ -667,7 +664,7 @@ GMainWindow::GMainWindow(bool has_broken_vulkan)
|
|
|
|
|
selected_user = user_idx.value();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!system->GetProfileManager().UserExistsIndex(selected_user)) {
|
|
|
|
|
if (!QtCommon::system->GetProfileManager().UserExistsIndex(selected_user)) {
|
|
|
|
|
LOG_ERROR(Frontend, "Selected user doesn't exist");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -758,7 +755,7 @@ void GMainWindow::AmiiboSettingsRequestExit() {
|
|
|
|
|
void GMainWindow::ControllerSelectorReconfigureControllers(
|
|
|
|
|
const Core::Frontend::ControllerParameters& parameters) {
|
|
|
|
|
controller_applet =
|
|
|
|
|
new QtControllerSelectorDialog(this, parameters, input_subsystem.get(), *system);
|
|
|
|
|
new QtControllerSelectorDialog(this, parameters, input_subsystem.get(), *QtCommon::system);
|
|
|
|
|
SCOPE_EXIT {
|
|
|
|
|
controller_applet->deleteLater();
|
|
|
|
|
controller_applet = nullptr;
|
|
|
|
@ -771,8 +768,8 @@ void GMainWindow::ControllerSelectorReconfigureControllers(
|
|
|
|
|
bool is_success = controller_applet->exec() != QDialog::Rejected;
|
|
|
|
|
|
|
|
|
|
// Don't forget to apply settings.
|
|
|
|
|
system->HIDCore().DisableAllControllerConfiguration();
|
|
|
|
|
system->ApplySettings();
|
|
|
|
|
QtCommon::system->HIDCore().DisableAllControllerConfiguration();
|
|
|
|
|
QtCommon::system->ApplySettings();
|
|
|
|
|
config->SaveAllValues();
|
|
|
|
|
|
|
|
|
|
UpdateStatusButtons();
|
|
|
|
@ -788,7 +785,7 @@ void GMainWindow::ControllerSelectorRequestExit() {
|
|
|
|
|
|
|
|
|
|
void GMainWindow::ProfileSelectorSelectProfile(
|
|
|
|
|
const Core::Frontend::ProfileSelectParameters& parameters) {
|
|
|
|
|
profile_select_applet = new QtProfileSelectionDialog(*system, this, parameters);
|
|
|
|
|
profile_select_applet = new QtProfileSelectionDialog(*QtCommon::system, this, parameters);
|
|
|
|
|
SCOPE_EXIT {
|
|
|
|
|
profile_select_applet->deleteLater();
|
|
|
|
|
profile_select_applet = nullptr;
|
|
|
|
@ -803,7 +800,7 @@ void GMainWindow::ProfileSelectorSelectProfile(
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const auto uuid = system->GetProfileManager().GetUser(
|
|
|
|
|
const auto uuid = QtCommon::system->GetProfileManager().GetUser(
|
|
|
|
|
static_cast<std::size_t>(profile_select_applet->GetIndex()));
|
|
|
|
|
if (!uuid.has_value()) {
|
|
|
|
|
emit ProfileSelectorFinishedSelection(std::nullopt);
|
|
|
|
@ -826,7 +823,7 @@ void GMainWindow::SoftwareKeyboardInitialize(
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
software_keyboard = new QtSoftwareKeyboardDialog(render_window, *system, is_inline,
|
|
|
|
|
software_keyboard = new QtSoftwareKeyboardDialog(render_window, *QtCommon::system, is_inline,
|
|
|
|
|
std::move(initialize_parameters));
|
|
|
|
|
|
|
|
|
|
if (is_inline) {
|
|
|
|
@ -943,7 +940,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
web_applet = new QtNXWebEngineView(this, *system, input_subsystem.get());
|
|
|
|
|
web_applet = new QtNXWebEngineView(this, *QtCommon::system, input_subsystem.get());
|
|
|
|
|
|
|
|
|
|
ui->action_Pause->setEnabled(false);
|
|
|
|
|
ui->action_Restart->setEnabled(false);
|
|
|
|
@ -1087,10 +1084,10 @@ void GMainWindow::InitializeWidgets() {
|
|
|
|
|
#ifdef YUZU_ENABLE_COMPATIBILITY_REPORTING
|
|
|
|
|
ui->action_Report_Compatibility->setVisible(true);
|
|
|
|
|
#endif
|
|
|
|
|
render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem, *system);
|
|
|
|
|
render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem, *QtCommon::system);
|
|
|
|
|
render_window->hide();
|
|
|
|
|
|
|
|
|
|
game_list = new GameList(vfs, provider.get(), *play_time_manager, *system, this);
|
|
|
|
|
game_list = new GameList(QtCommon::vfs, provider.get(), *play_time_manager, *QtCommon::system, this);
|
|
|
|
|
ui->horizontalLayout->addWidget(game_list);
|
|
|
|
|
|
|
|
|
|
game_list_placeholder = new GameListPlaceholder(this);
|
|
|
|
@ -1109,7 +1106,7 @@ void GMainWindow::InitializeWidgets() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
multiplayer_state = new MultiplayerState(this, game_list->GetModel(), ui->action_Leave_Room,
|
|
|
|
|
ui->action_Show_Room, *system);
|
|
|
|
|
ui->action_Show_Room, *QtCommon::system);
|
|
|
|
|
multiplayer_state->setVisible(false);
|
|
|
|
|
|
|
|
|
|
// Create status bar
|
|
|
|
@ -1363,12 +1360,12 @@ void GMainWindow::InitializeWidgets() {
|
|
|
|
|
void GMainWindow::InitializeDebugWidgets() {
|
|
|
|
|
QMenu* debug_menu = ui->menu_View_Debugging;
|
|
|
|
|
|
|
|
|
|
waitTreeWidget = new WaitTreeWidget(*system, this);
|
|
|
|
|
waitTreeWidget = new WaitTreeWidget(*QtCommon::system, this);
|
|
|
|
|
addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget);
|
|
|
|
|
waitTreeWidget->hide();
|
|
|
|
|
debug_menu->addAction(waitTreeWidget->toggleViewAction());
|
|
|
|
|
|
|
|
|
|
controller_dialog = new ControllerDialog(system->HIDCore(), input_subsystem, this);
|
|
|
|
|
controller_dialog = new ControllerDialog(QtCommon::system->HIDCore(), input_subsystem, this);
|
|
|
|
|
controller_dialog->hide();
|
|
|
|
|
debug_menu->addAction(controller_dialog->toggleViewAction());
|
|
|
|
|
|
|
|
|
@ -1408,7 +1405,7 @@ void GMainWindow::LinkActionShortcut(QAction* action, const QString& action_name
|
|
|
|
|
|
|
|
|
|
this->addAction(action);
|
|
|
|
|
|
|
|
|
|
auto* controller = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
|
|
|
|
|
auto* controller = QtCommon::system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
|
|
|
|
|
const auto* controller_hotkey =
|
|
|
|
|
hotkey_registry.GetControllerHotkey(main_window, action_name.toStdString(), controller);
|
|
|
|
|
connect(
|
|
|
|
@ -1453,7 +1450,7 @@ void GMainWindow::InitializeHotkeys() {
|
|
|
|
|
const auto connect_shortcut = [&]<typename Fn>(const QString& action_name, const Fn& function) {
|
|
|
|
|
const auto* hotkey =
|
|
|
|
|
hotkey_registry.GetHotkey(main_window.toStdString(), action_name.toStdString(), this);
|
|
|
|
|
auto* controller = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
|
|
|
|
|
auto* controller = QtCommon::system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
|
|
|
|
|
const auto* controller_hotkey = hotkey_registry.GetControllerHotkey(
|
|
|
|
|
main_window.toStdString(), action_name.toStdString(), controller);
|
|
|
|
|
connect(hotkey, &QShortcut::activated, this, function);
|
|
|
|
@ -1479,7 +1476,7 @@ void GMainWindow::InitializeHotkeys() {
|
|
|
|
|
});
|
|
|
|
|
connect_shortcut(QStringLiteral("Toggle Renderdoc Capture"), [this] {
|
|
|
|
|
if (Settings::values.enable_renderdoc_hotkey) {
|
|
|
|
|
system->GetRenderdocAPI().ToggleCapture();
|
|
|
|
|
QtCommon::system->GetRenderdocAPI().ToggleCapture();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
connect_shortcut(QStringLiteral("Toggle Mouse Panning"), [&] {
|
|
|
|
@ -1885,13 +1882,13 @@ bool GMainWindow::LoadROM(const QString& filename, Service::AM::FrontendAppletPa
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
system->SetFilesystem(vfs);
|
|
|
|
|
QtCommon::system->SetFilesystem(QtCommon::vfs);
|
|
|
|
|
|
|
|
|
|
if (params.launch_type == Service::AM::LaunchType::FrontendInitiated) {
|
|
|
|
|
system->GetUserChannel().clear();
|
|
|
|
|
QtCommon::system->GetUserChannel().clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
system->SetFrontendAppletSet({
|
|
|
|
|
QtCommon::system->SetFrontendAppletSet({
|
|
|
|
|
std::make_unique<QtAmiiboSettings>(*this), // Amiibo Settings
|
|
|
|
|
(UISettings::values.controller_applet_disabled.GetValue() == true)
|
|
|
|
|
? nullptr
|
|
|
|
@ -1914,13 +1911,13 @@ bool GMainWindow::LoadROM(const QString& filename, Service::AM::FrontendAppletPa
|
|
|
|
|
|
|
|
|
|
/** Exec */
|
|
|
|
|
const Core::SystemResultStatus result{
|
|
|
|
|
system->Load(*render_window, filename.toStdString(), params)};
|
|
|
|
|
QtCommon::system->Load(*render_window, filename.toStdString(), params)};
|
|
|
|
|
|
|
|
|
|
const auto drd_callout = (UISettings::values.callout_flags.GetValue() &
|
|
|
|
|
static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0;
|
|
|
|
|
|
|
|
|
|
if (result == Core::SystemResultStatus::Success &&
|
|
|
|
|
system->GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory &&
|
|
|
|
|
QtCommon::system->GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory &&
|
|
|
|
|
drd_callout) {
|
|
|
|
|
UISettings::values.callout_flags = UISettings::values.callout_flags.GetValue() |
|
|
|
|
|
static_cast<u32>(CalloutFlag::DRDDeprecation);
|
|
|
|
@ -1985,7 +1982,7 @@ bool GMainWindow::LoadROM(const QString& filename, Service::AM::FrontendAppletPa
|
|
|
|
|
|
|
|
|
|
bool GMainWindow::SelectAndSetCurrentUser(
|
|
|
|
|
const Core::Frontend::ProfileSelectParameters& parameters) {
|
|
|
|
|
QtProfileSelectionDialog dialog(*system, this, parameters);
|
|
|
|
|
QtProfileSelectionDialog dialog(*QtCommon::system, this, parameters);
|
|
|
|
|
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
|
|
|
|
|
Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
|
|
|
|
|
dialog.setWindowModality(Qt::WindowModal);
|
|
|
|
@ -2000,12 +1997,12 @@ bool GMainWindow::SelectAndSetCurrentUser(
|
|
|
|
|
|
|
|
|
|
void GMainWindow::ConfigureFilesystemProvider(const std::string& filepath) {
|
|
|
|
|
// Ensure all NCAs are registered before launching the game
|
|
|
|
|
const auto file = vfs->OpenFile(filepath, FileSys::OpenMode::Read);
|
|
|
|
|
const auto file = QtCommon::vfs->OpenFile(filepath, FileSys::OpenMode::Read);
|
|
|
|
|
if (!file) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto loader = Loader::GetLoader(*system, file);
|
|
|
|
|
auto loader = Loader::GetLoader(*QtCommon::system, file);
|
|
|
|
|
if (!loader) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -2054,8 +2051,8 @@ void GMainWindow::BootGame(const QString& filename, Service::AM::FrontendAppletP
|
|
|
|
|
last_filename_booted = filename;
|
|
|
|
|
|
|
|
|
|
ConfigureFilesystemProvider(filename.toStdString());
|
|
|
|
|
const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData());
|
|
|
|
|
const auto loader = Loader::GetLoader(*system, v_file, params.program_id, params.program_index);
|
|
|
|
|
const auto v_file = Core::GetGameFileFromPath(QtCommon::vfs, filename.toUtf8().constData());
|
|
|
|
|
const auto loader = Loader::GetLoader(*QtCommon::system, v_file, params.program_id, params.program_index);
|
|
|
|
|
|
|
|
|
|
if (loader != nullptr && loader->ReadProgramId(title_id) == Loader::ResultStatus::Success &&
|
|
|
|
|
type == StartGameType::Normal) {
|
|
|
|
@ -2066,8 +2063,8 @@ void GMainWindow::BootGame(const QString& filename, Service::AM::FrontendAppletP
|
|
|
|
|
? Common::FS::PathToUTF8String(file_path.filename())
|
|
|
|
|
: fmt::format("{:016X}", title_id);
|
|
|
|
|
QtConfig per_game_config(config_file_name, Config::ConfigType::PerGameConfig);
|
|
|
|
|
system->HIDCore().ReloadInputDevices();
|
|
|
|
|
system->ApplySettings();
|
|
|
|
|
QtCommon::system->HIDCore().ReloadInputDevices();
|
|
|
|
|
QtCommon::system->ApplySettings();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Settings::LogSettings();
|
|
|
|
@ -2093,19 +2090,19 @@ void GMainWindow::BootGame(const QString& filename, Service::AM::FrontendAppletP
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
system->SetShuttingDown(false);
|
|
|
|
|
QtCommon::system->SetShuttingDown(false);
|
|
|
|
|
game_list->setDisabled(true);
|
|
|
|
|
|
|
|
|
|
// Create and start the emulation thread
|
|
|
|
|
emu_thread = std::make_unique<EmuThread>(*system);
|
|
|
|
|
emu_thread = std::make_unique<EmuThread>(*QtCommon::system);
|
|
|
|
|
emit EmulationStarting(emu_thread.get());
|
|
|
|
|
emu_thread->start();
|
|
|
|
|
|
|
|
|
|
// Register an ExecuteProgram callback such that Core can execute a sub-program
|
|
|
|
|
system->RegisterExecuteProgramCallback(
|
|
|
|
|
QtCommon::system->RegisterExecuteProgramCallback(
|
|
|
|
|
[this](std::size_t program_index_) { render_window->ExecuteProgram(program_index_); });
|
|
|
|
|
|
|
|
|
|
system->RegisterExitCallback([this] {
|
|
|
|
|
QtCommon::system->RegisterExitCallback([this] {
|
|
|
|
|
emu_thread->ForceStop();
|
|
|
|
|
render_window->Exit();
|
|
|
|
|
});
|
|
|
|
@ -2145,11 +2142,11 @@ void GMainWindow::BootGame(const QString& filename, Service::AM::FrontendAppletP
|
|
|
|
|
|
|
|
|
|
std::string title_name;
|
|
|
|
|
std::string title_version;
|
|
|
|
|
const auto res = system->GetGameName(title_name);
|
|
|
|
|
const auto res = QtCommon::system->GetGameName(title_name);
|
|
|
|
|
|
|
|
|
|
const auto metadata = [this, title_id] {
|
|
|
|
|
const FileSys::PatchManager pm(title_id, system->GetFileSystemController(),
|
|
|
|
|
system->GetContentProvider());
|
|
|
|
|
const FileSys::PatchManager pm(title_id, QtCommon::system->GetFileSystemController(),
|
|
|
|
|
QtCommon::system->GetContentProvider());
|
|
|
|
|
return pm.GetControlMetadata();
|
|
|
|
|
}();
|
|
|
|
|
if (metadata.first != nullptr) {
|
|
|
|
@ -2161,16 +2158,16 @@ void GMainWindow::BootGame(const QString& filename, Service::AM::FrontendAppletP
|
|
|
|
|
std::filesystem::path{Common::U16StringFromBuffer(filename.utf16(), filename.size())}
|
|
|
|
|
.filename());
|
|
|
|
|
}
|
|
|
|
|
const bool is_64bit = system->Kernel().ApplicationProcess()->Is64Bit();
|
|
|
|
|
const bool is_64bit = QtCommon::system->Kernel().ApplicationProcess()->Is64Bit();
|
|
|
|
|
const auto instruction_set_suffix = is_64bit ? tr("(64-bit)") : tr("(32-bit)");
|
|
|
|
|
title_name = tr("%1 %2", "%1 is the title name. %2 indicates if the title is 64-bit or 32-bit")
|
|
|
|
|
.arg(QString::fromStdString(title_name), instruction_set_suffix)
|
|
|
|
|
.toStdString();
|
|
|
|
|
LOG_INFO(Frontend, "Booting game: {:016X} | {} | {}", title_id, title_name, title_version);
|
|
|
|
|
const auto gpu_vendor = system->GPU().Renderer().GetDeviceVendor();
|
|
|
|
|
const auto gpu_vendor = QtCommon::system->GPU().Renderer().GetDeviceVendor();
|
|
|
|
|
UpdateWindowTitle(title_name, title_version, gpu_vendor);
|
|
|
|
|
|
|
|
|
|
loading_screen->Prepare(system->GetAppLoader());
|
|
|
|
|
loading_screen->Prepare(QtCommon::system->GetAppLoader());
|
|
|
|
|
loading_screen->show();
|
|
|
|
|
|
|
|
|
|
emulation_running = true;
|
|
|
|
@ -2198,11 +2195,11 @@ bool GMainWindow::OnShutdownBegin() {
|
|
|
|
|
// Disable unlimited frame rate
|
|
|
|
|
Settings::values.use_speed_limit.SetValue(true);
|
|
|
|
|
|
|
|
|
|
if (system->IsShuttingDown()) {
|
|
|
|
|
if (QtCommon::system->IsShuttingDown()) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
system->SetShuttingDown(true);
|
|
|
|
|
QtCommon::system->SetShuttingDown(true);
|
|
|
|
|
discord_rpc->Pause();
|
|
|
|
|
|
|
|
|
|
RequestGameExit();
|
|
|
|
@ -2213,9 +2210,9 @@ bool GMainWindow::OnShutdownBegin() {
|
|
|
|
|
|
|
|
|
|
int shutdown_time = 1000;
|
|
|
|
|
|
|
|
|
|
if (system->DebuggerEnabled()) {
|
|
|
|
|
if (QtCommon::system->DebuggerEnabled()) {
|
|
|
|
|
shutdown_time = 0;
|
|
|
|
|
} else if (system->GetExitLocked()) {
|
|
|
|
|
} else if (QtCommon::system->GetExitLocked()) {
|
|
|
|
|
shutdown_time = 5000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2233,7 +2230,7 @@ bool GMainWindow::OnShutdownBegin() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnShutdownBeginDialog() {
|
|
|
|
|
shutdown_dialog = new OverlayDialog(this, *system, QString{}, tr("Closing software..."),
|
|
|
|
|
shutdown_dialog = new OverlayDialog(this, *QtCommon::system, QString{}, tr("Closing software..."),
|
|
|
|
|
QString{}, QString{}, Qt::AlignHCenter | Qt::AlignVCenter);
|
|
|
|
|
shutdown_dialog->open();
|
|
|
|
|
}
|
|
|
|
@ -2285,10 +2282,10 @@ void GMainWindow::OnEmulationStopped() {
|
|
|
|
|
OnTasStateChanged();
|
|
|
|
|
render_window->FinalizeCamera();
|
|
|
|
|
|
|
|
|
|
system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::None);
|
|
|
|
|
QtCommon::system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::None);
|
|
|
|
|
|
|
|
|
|
// Enable all controllers
|
|
|
|
|
system->HIDCore().SetSupportedStyleTag({Core::HID::NpadStyleSet::All});
|
|
|
|
|
QtCommon::system->HIDCore().SetSupportedStyleTag({Core::HID::NpadStyleSet::All});
|
|
|
|
|
|
|
|
|
|
render_window->removeEventFilter(render_window);
|
|
|
|
|
render_window->setAttribute(Qt::WA_Hover, false);
|
|
|
|
@ -2317,8 +2314,8 @@ void GMainWindow::OnEmulationStopped() {
|
|
|
|
|
// Enable game list
|
|
|
|
|
game_list->setEnabled(true);
|
|
|
|
|
|
|
|
|
|
Settings::RestoreGlobalState(system->IsPoweredOn());
|
|
|
|
|
system->HIDCore().ReloadInputDevices();
|
|
|
|
|
Settings::RestoreGlobalState(QtCommon::system->IsPoweredOn());
|
|
|
|
|
QtCommon::system->HIDCore().ReloadInputDevices();
|
|
|
|
|
UpdateStatusButtons();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2379,15 +2376,15 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
|
|
|
|
|
QString open_target;
|
|
|
|
|
|
|
|
|
|
const auto [user_save_size, device_save_size] = [this, &game_path, &program_id] {
|
|
|
|
|
const FileSys::PatchManager pm{program_id, system->GetFileSystemController(),
|
|
|
|
|
system->GetContentProvider()};
|
|
|
|
|
const FileSys::PatchManager pm{program_id, QtCommon::system->GetFileSystemController(),
|
|
|
|
|
QtCommon::system->GetContentProvider()};
|
|
|
|
|
const auto control = pm.GetControlMetadata().first;
|
|
|
|
|
if (control != nullptr) {
|
|
|
|
|
return std::make_pair(control->GetDefaultNormalSaveSize(),
|
|
|
|
|
control->GetDeviceSaveDataSize());
|
|
|
|
|
} else {
|
|
|
|
|
const auto file = Core::GetGameFileFromPath(vfs, game_path);
|
|
|
|
|
const auto loader = Loader::GetLoader(*system, file);
|
|
|
|
|
const auto file = Core::GetGameFileFromPath(QtCommon::vfs, game_path);
|
|
|
|
|
const auto loader = Loader::GetLoader(*QtCommon::system, file);
|
|
|
|
|
|
|
|
|
|
FileSys::NACP nacp{};
|
|
|
|
|
loader->ReadControlData(nacp);
|
|
|
|
@ -2406,7 +2403,7 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
|
|
|
|
|
open_target = tr("Save Data");
|
|
|
|
|
const auto nand_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::NANDDir);
|
|
|
|
|
auto vfs_nand_dir =
|
|
|
|
|
vfs->OpenDirectory(Common::FS::PathToUTF8String(nand_dir), FileSys::OpenMode::Read);
|
|
|
|
|
QtCommon::vfs->OpenDirectory(Common::FS::PathToUTF8String(nand_dir), FileSys::OpenMode::Read);
|
|
|
|
|
|
|
|
|
|
if (has_user_save) {
|
|
|
|
|
// User save data
|
|
|
|
@ -2417,7 +2414,7 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
|
|
|
|
|
.display_options = {},
|
|
|
|
|
.purpose = Service::AM::Frontend::UserSelectionPurpose::General,
|
|
|
|
|
};
|
|
|
|
|
QtProfileSelectionDialog dialog(*system, this, parameters);
|
|
|
|
|
QtProfileSelectionDialog dialog(*QtCommon::system, this, parameters);
|
|
|
|
|
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
|
|
|
|
|
Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
|
|
|
|
|
dialog.setWindowModality(Qt::WindowModal);
|
|
|
|
@ -2435,7 +2432,7 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const auto user_id =
|
|
|
|
|
system->GetProfileManager().GetUser(static_cast<std::size_t>(index));
|
|
|
|
|
QtCommon::system->GetProfileManager().GetUser(static_cast<std::size_t>(index));
|
|
|
|
|
ASSERT(user_id);
|
|
|
|
|
|
|
|
|
|
const auto user_save_data_path = FileSys::SaveDataFactory::GetFullPath(
|
|
|
|
@ -2623,7 +2620,7 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, QtCommon::Game::GameListR
|
|
|
|
|
QtCommon::Game::RemoveCustomConfiguration(program_id, game_path);
|
|
|
|
|
break;
|
|
|
|
|
case QtCommon::Game::GameListRemoveTarget::CacheStorage:
|
|
|
|
|
QtCommon::Game::RemoveCacheStorage(program_id, vfs.get());
|
|
|
|
|
QtCommon::Game::RemoveCacheStorage(program_id, QtCommon::vfs.get());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2648,7 +2645,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const auto loader =
|
|
|
|
|
Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::OpenMode::Read));
|
|
|
|
|
Loader::GetLoader(*QtCommon::system, QtCommon::vfs->OpenFile(game_path, FileSys::OpenMode::Read));
|
|
|
|
|
if (loader == nullptr) {
|
|
|
|
|
failed();
|
|
|
|
|
return;
|
|
|
|
@ -2657,7 +2654,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
|
|
|
|
|
FileSys::VirtualFile packed_update_raw{};
|
|
|
|
|
loader->ReadUpdateRaw(packed_update_raw);
|
|
|
|
|
|
|
|
|
|
const auto& installed = system->GetContentProvider();
|
|
|
|
|
const auto& installed = QtCommon::system->GetContentProvider();
|
|
|
|
|
|
|
|
|
|
u64 title_id{};
|
|
|
|
|
u8 raw_type{};
|
|
|
|
@ -2689,14 +2686,14 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
|
|
|
|
|
|
|
|
|
|
const auto path = Common::FS::PathToUTF8String(dump_dir / romfs_dir);
|
|
|
|
|
|
|
|
|
|
const FileSys::PatchManager pm{title_id, system->GetFileSystemController(), installed};
|
|
|
|
|
const FileSys::PatchManager pm{title_id, QtCommon::system->GetFileSystemController(), installed};
|
|
|
|
|
auto romfs = pm.PatchRomFS(base_nca.get(), base_romfs, type, packed_update_raw, false);
|
|
|
|
|
|
|
|
|
|
const auto out = VfsFilesystemCreateDirectoryWrapper(vfs, path, FileSys::OpenMode::ReadWrite);
|
|
|
|
|
const auto out = VfsFilesystemCreateDirectoryWrapper(path, FileSys::OpenMode::ReadWrite);
|
|
|
|
|
|
|
|
|
|
if (out == nullptr) {
|
|
|
|
|
failed();
|
|
|
|
|
vfs->DeleteDirectory(path);
|
|
|
|
|
QtCommon::vfs->DeleteDirectory(path);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2710,7 +2707,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
|
|
|
|
|
selections, 0, false, &ok);
|
|
|
|
|
if (!ok) {
|
|
|
|
|
failed();
|
|
|
|
|
vfs->DeleteDirectory(path);
|
|
|
|
|
QtCommon::vfs->DeleteDirectory(path);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2750,7 +2747,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
|
|
|
|
|
} else {
|
|
|
|
|
progress.close();
|
|
|
|
|
failed();
|
|
|
|
|
vfs->DeleteDirectory(path);
|
|
|
|
|
QtCommon::vfs->DeleteDirectory(path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2880,8 +2877,8 @@ void GMainWindow::OnGameListShowList(bool show) {
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) {
|
|
|
|
|
u64 title_id{};
|
|
|
|
|
const auto v_file = Core::GetGameFileFromPath(vfs, file);
|
|
|
|
|
const auto loader = Loader::GetLoader(*system, v_file);
|
|
|
|
|
const auto v_file = Core::GetGameFileFromPath(QtCommon::vfs, file);
|
|
|
|
|
const auto loader = Loader::GetLoader(*QtCommon::system, v_file);
|
|
|
|
|
|
|
|
|
|
if (loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) {
|
|
|
|
|
QMessageBox::information(this, tr("Properties"),
|
|
|
|
@ -3009,7 +3006,7 @@ void GMainWindow::OnMenuInstallToNAND() {
|
|
|
|
|
return false;
|
|
|
|
|
};
|
|
|
|
|
future = QtConcurrent::run([this, &file, progress_callback] {
|
|
|
|
|
return ContentManager::InstallNSP(*system, *vfs, file.toStdString(),
|
|
|
|
|
return ContentManager::InstallNSP(*QtCommon::system, *QtCommon::vfs, file.toStdString(),
|
|
|
|
|
progress_callback);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -3101,7 +3098,7 @@ ContentManager::InstallResult GMainWindow::InstallNCA(const QString& filename) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const bool is_application = index >= static_cast<s32>(FileSys::TitleType::Application);
|
|
|
|
|
const auto& fs_controller = system->GetFileSystemController();
|
|
|
|
|
const auto& fs_controller = QtCommon::system->GetFileSystemController();
|
|
|
|
|
auto* registered_cache = is_application ? fs_controller.GetUserNANDContents()
|
|
|
|
|
: fs_controller.GetSystemNANDContents();
|
|
|
|
|
|
|
|
|
@ -3112,7 +3109,7 @@ ContentManager::InstallResult GMainWindow::InstallNCA(const QString& filename) {
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
};
|
|
|
|
|
return ContentManager::InstallNCA(*vfs, filename.toStdString(), *registered_cache,
|
|
|
|
|
return ContentManager::InstallNCA(*QtCommon::vfs, filename.toStdString(), *registered_cache,
|
|
|
|
|
static_cast<FileSys::TitleType>(index), progress_callback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3141,7 +3138,7 @@ void GMainWindow::OnStartGame() {
|
|
|
|
|
UpdateMenuState();
|
|
|
|
|
OnTasStateChanged();
|
|
|
|
|
|
|
|
|
|
play_time_manager->SetProgramId(system->GetApplicationProcessProgramID());
|
|
|
|
|
play_time_manager->SetProgramId(QtCommon::system->GetApplicationProcessProgramID());
|
|
|
|
|
play_time_manager->Start();
|
|
|
|
|
|
|
|
|
|
discord_rpc->Update();
|
|
|
|
@ -3152,7 +3149,7 @@ void GMainWindow::OnStartGame() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnRestartGame() {
|
|
|
|
|
if (!system->IsPoweredOn()) {
|
|
|
|
|
if (!QtCommon::system->IsPoweredOn()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3200,7 +3197,7 @@ void GMainWindow::OnStopGame() {
|
|
|
|
|
|
|
|
|
|
bool GMainWindow::ConfirmShutdownGame() {
|
|
|
|
|
if (UISettings::values.confirm_before_stopping.GetValue() == ConfirmStop::Ask_Always) {
|
|
|
|
|
if (system->GetExitLocked()) {
|
|
|
|
|
if (QtCommon::system->GetExitLocked()) {
|
|
|
|
|
if (!ConfirmForceLockedExit()) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -3212,7 +3209,7 @@ bool GMainWindow::ConfirmShutdownGame() {
|
|
|
|
|
} else {
|
|
|
|
|
if (UISettings::values.confirm_before_stopping.GetValue() ==
|
|
|
|
|
ConfirmStop::Ask_Based_On_Game &&
|
|
|
|
|
system->GetExitLocked()) {
|
|
|
|
|
QtCommon::system->GetExitLocked()) {
|
|
|
|
|
if (!ConfirmForceLockedExit()) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -3239,12 +3236,12 @@ void GMainWindow::OnExit() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnSaveConfig() {
|
|
|
|
|
system->ApplySettings();
|
|
|
|
|
QtCommon::system->ApplySettings();
|
|
|
|
|
config->SaveAllValues();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) {
|
|
|
|
|
error_applet = new OverlayDialog(render_window, *system, error_code, error_text, QString{},
|
|
|
|
|
error_applet = new OverlayDialog(render_window, *QtCommon::system, error_code, error_text, QString{},
|
|
|
|
|
tr("OK"), Qt::AlignLeft | Qt::AlignVCenter);
|
|
|
|
|
SCOPE_EXIT {
|
|
|
|
|
error_applet->deleteLater();
|
|
|
|
@ -3473,7 +3470,7 @@ void GMainWindow::OnConfigure() {
|
|
|
|
|
|
|
|
|
|
Settings::SetConfiguringGlobal(true);
|
|
|
|
|
ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(),
|
|
|
|
|
vk_device_records, *system,
|
|
|
|
|
vk_device_records, *QtCommon::system,
|
|
|
|
|
!multiplayer_state->IsHostingPublicRoom());
|
|
|
|
|
connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this,
|
|
|
|
|
&GMainWindow::OnLanguageChanged);
|
|
|
|
@ -3574,7 +3571,7 @@ void GMainWindow::OnConfigure() {
|
|
|
|
|
|
|
|
|
|
UpdateStatusButtons();
|
|
|
|
|
controller_dialog->refreshConfiguration();
|
|
|
|
|
system->ApplySettings();
|
|
|
|
|
QtCommon::system->ApplySettings();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnConfigureTas() {
|
|
|
|
@ -3582,7 +3579,7 @@ void GMainWindow::OnConfigureTas() {
|
|
|
|
|
const auto result = dialog.exec();
|
|
|
|
|
|
|
|
|
|
if (result != QDialog::Accepted && !UISettings::values.configuration_applied) {
|
|
|
|
|
Settings::RestoreGlobalState(system->IsPoweredOn());
|
|
|
|
|
Settings::RestoreGlobalState(QtCommon::system->IsPoweredOn());
|
|
|
|
|
return;
|
|
|
|
|
} else if (result == QDialog::Accepted) {
|
|
|
|
|
dialog.ApplyConfiguration();
|
|
|
|
@ -3596,7 +3593,7 @@ void GMainWindow::OnTasStartStop() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Disable system buttons to prevent TAS from executing a hotkey
|
|
|
|
|
auto* controller = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
|
|
|
|
|
auto* controller = QtCommon::system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
|
|
|
|
|
controller->ResetSystemButtons();
|
|
|
|
|
|
|
|
|
|
input_subsystem->GetTas()->StartStop();
|
|
|
|
@ -3612,7 +3609,7 @@ void GMainWindow::OnTasRecord() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Disable system buttons to prevent TAS from recording a hotkey
|
|
|
|
|
auto* controller = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
|
|
|
|
|
auto* controller = QtCommon::system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
|
|
|
|
|
controller->ResetSystemButtons();
|
|
|
|
|
|
|
|
|
|
const bool is_recording = input_subsystem->GetTas()->Record();
|
|
|
|
@ -3634,8 +3631,8 @@ void GMainWindow::OnTasReset() {
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnToggleDockedMode() {
|
|
|
|
|
const bool is_docked = Settings::IsDockedMode();
|
|
|
|
|
auto* player_1 = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
|
|
|
|
|
auto* handheld = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
|
|
|
|
auto* player_1 = QtCommon::system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
|
|
|
|
|
auto* handheld = QtCommon::system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
|
|
|
|
|
|
|
|
|
if (!is_docked && handheld->IsConnected()) {
|
|
|
|
|
QMessageBox::warning(this, tr("Invalid config detected"),
|
|
|
|
@ -3650,7 +3647,7 @@ void GMainWindow::OnToggleDockedMode() {
|
|
|
|
|
Settings::values.use_docked_mode.SetValue(is_docked ? Settings::ConsoleMode::Handheld
|
|
|
|
|
: Settings::ConsoleMode::Docked);
|
|
|
|
|
UpdateDockedButton();
|
|
|
|
|
OnDockedModeChanged(is_docked, !is_docked, *system);
|
|
|
|
|
OnDockedModeChanged(is_docked, !is_docked, *QtCommon::system);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnToggleGpuAccuracy() {
|
|
|
|
@ -3667,7 +3664,7 @@ void GMainWindow::OnToggleGpuAccuracy() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
system->ApplySettings();
|
|
|
|
|
QtCommon::system->ApplySettings();
|
|
|
|
|
UpdateGPUAccuracyButton();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3732,20 +3729,20 @@ void GMainWindow::OnToggleGraphicsAPI() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnConfigurePerGame() {
|
|
|
|
|
const u64 title_id = system->GetApplicationProcessProgramID();
|
|
|
|
|
const u64 title_id = QtCommon::system->GetApplicationProcessProgramID();
|
|
|
|
|
OpenPerGameConfiguration(title_id, current_game_path.toStdString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file_name) {
|
|
|
|
|
const auto v_file = Core::GetGameFileFromPath(vfs, file_name);
|
|
|
|
|
const auto v_file = Core::GetGameFileFromPath(QtCommon::vfs, file_name);
|
|
|
|
|
|
|
|
|
|
Settings::SetConfiguringGlobal(false);
|
|
|
|
|
ConfigurePerGame dialog(this, title_id, file_name, vk_device_records, *system);
|
|
|
|
|
ConfigurePerGame dialog(this, title_id, file_name, vk_device_records, *QtCommon::system);
|
|
|
|
|
dialog.LoadFromFile(v_file);
|
|
|
|
|
const auto result = dialog.exec();
|
|
|
|
|
|
|
|
|
|
if (result != QDialog::Accepted && !UISettings::values.configuration_applied) {
|
|
|
|
|
Settings::RestoreGlobalState(system->IsPoweredOn());
|
|
|
|
|
Settings::RestoreGlobalState(QtCommon::system->IsPoweredOn());
|
|
|
|
|
return;
|
|
|
|
|
} else if (result == QDialog::Accepted) {
|
|
|
|
|
dialog.ApplyConfiguration();
|
|
|
|
@ -3757,9 +3754,9 @@ void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Do not cause the global config to write local settings into the config file
|
|
|
|
|
const bool is_powered_on = system->IsPoweredOn();
|
|
|
|
|
const bool is_powered_on = QtCommon::system->IsPoweredOn();
|
|
|
|
|
Settings::RestoreGlobalState(is_powered_on);
|
|
|
|
|
system->HIDCore().ReloadInputDevices();
|
|
|
|
|
QtCommon::system->HIDCore().ReloadInputDevices();
|
|
|
|
|
|
|
|
|
|
UISettings::values.configuration_applied = false;
|
|
|
|
|
|
|
|
|
@ -3814,7 +3811,7 @@ bool GMainWindow::question(QWidget* parent, const QString& title, const QString&
|
|
|
|
|
box_dialog->setDefaultButton(defaultButton);
|
|
|
|
|
|
|
|
|
|
ControllerNavigation* controller_navigation =
|
|
|
|
|
new ControllerNavigation(system->HIDCore(), box_dialog);
|
|
|
|
|
new ControllerNavigation(QtCommon::system->HIDCore(), box_dialog);
|
|
|
|
|
connect(controller_navigation, &ControllerNavigation::TriggerKeyboardEvent,
|
|
|
|
|
[box_dialog](Qt::Key key) {
|
|
|
|
|
QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, key, Qt::NoModifier);
|
|
|
|
@ -3893,7 +3890,7 @@ void GMainWindow::OnVerifyInstalledContents() {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const std::vector<std::string> result =
|
|
|
|
|
ContentManager::VerifyInstalledContents(*system, *provider, QtProgressCallback);
|
|
|
|
|
ContentManager::VerifyInstalledContents(*QtCommon::system, *provider, QtProgressCallback);
|
|
|
|
|
progress.close();
|
|
|
|
|
|
|
|
|
|
if (result.empty()) {
|
|
|
|
@ -3922,7 +3919,7 @@ void GMainWindow::InstallFirmware(const QString& location, bool recursive) {
|
|
|
|
|
return progress.wasCanceled();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
auto result = QtCommon::Content::InstallFirmware(location, recursive, QtProgressCallback, vfs.get());
|
|
|
|
|
auto result = QtCommon::Content::InstallFirmware(location, recursive, QtProgressCallback, QtCommon::vfs.get());
|
|
|
|
|
|
|
|
|
|
progress.close();
|
|
|
|
|
|
|
|
|
@ -3934,7 +3931,7 @@ void GMainWindow::InstallFirmware(const QString& location, bool recursive) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
auto results =
|
|
|
|
|
ContentManager::VerifyInstalledContents(*system, *provider, VerifyFirmwareCallback, true);
|
|
|
|
|
ContentManager::VerifyInstalledContents(*QtCommon::system, *provider, VerifyFirmwareCallback, true);
|
|
|
|
|
|
|
|
|
|
if (results.size() > 0) {
|
|
|
|
|
const auto failed_names =
|
|
|
|
@ -4018,30 +4015,9 @@ void GMainWindow::OnInstallDecryptionKeys() {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QString key_source_location = QFileDialog::getOpenFileName(
|
|
|
|
|
this, tr("Select Dumped Keys Location"), {}, QStringLiteral("Decryption Keys (*.keys)"), {},
|
|
|
|
|
QFileDialog::ReadOnly);
|
|
|
|
|
if (key_source_location.isEmpty()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
QtCommon::Content::InstallKeys();
|
|
|
|
|
|
|
|
|
|
FirmwareManager::KeyInstallResult result =
|
|
|
|
|
FirmwareManager::InstallKeys(key_source_location.toStdString(), "keys");
|
|
|
|
|
|
|
|
|
|
system->GetFileSystemController().CreateFactories(*vfs);
|
|
|
|
|
game_list->PopulateAsync(UISettings::values.game_dirs);
|
|
|
|
|
|
|
|
|
|
switch (result) {
|
|
|
|
|
case FirmwareManager::KeyInstallResult::Success:
|
|
|
|
|
QMessageBox::information(this, tr("Decryption Keys install succeeded"),
|
|
|
|
|
tr("Decryption Keys were successfully installed"));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
QMessageBox::critical(this, tr("Decryption Keys install failed"),
|
|
|
|
|
tr(FirmwareManager::GetKeyInstallResultString(result)));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OnCheckFirmwareDecryption();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -4078,7 +4054,7 @@ void GMainWindow::OnGameListRefresh()
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnAlbum() {
|
|
|
|
|
constexpr u64 AlbumId = static_cast<u64>(Service::AM::AppletProgramId::PhotoViewer);
|
|
|
|
|
auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
|
|
|
|
|
auto bis_system = QtCommon::system->GetFileSystemController().GetSystemNANDContents();
|
|
|
|
|
if (!bis_system) {
|
|
|
|
|
QMessageBox::warning(this, tr("No firmware available"),
|
|
|
|
|
tr("Please install firmware to use the Album applet."));
|
|
|
|
@ -4092,7 +4068,7 @@ void GMainWindow::OnAlbum() {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::PhotoViewer);
|
|
|
|
|
QtCommon::system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::PhotoViewer);
|
|
|
|
|
|
|
|
|
|
const auto filename = QString::fromStdString(album_nca->GetFullPath());
|
|
|
|
|
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
|
|
|
@ -4101,7 +4077,7 @@ void GMainWindow::OnAlbum() {
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) {
|
|
|
|
|
constexpr u64 CabinetId = static_cast<u64>(Service::AM::AppletProgramId::Cabinet);
|
|
|
|
|
auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
|
|
|
|
|
auto bis_system = QtCommon::system->GetFileSystemController().GetSystemNANDContents();
|
|
|
|
|
if (!bis_system) {
|
|
|
|
|
QMessageBox::warning(this, tr("No firmware available"),
|
|
|
|
|
tr("Please install firmware to use the Cabinet applet."));
|
|
|
|
@ -4115,8 +4091,8 @@ void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::Cabinet);
|
|
|
|
|
system->GetFrontendAppletHolder().SetCabinetMode(mode);
|
|
|
|
|
QtCommon::system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::Cabinet);
|
|
|
|
|
QtCommon::system->GetFrontendAppletHolder().SetCabinetMode(mode);
|
|
|
|
|
|
|
|
|
|
const auto filename = QString::fromStdString(cabinet_nca->GetFullPath());
|
|
|
|
|
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
|
|
|
@ -4125,7 +4101,7 @@ void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) {
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnMiiEdit() {
|
|
|
|
|
constexpr u64 MiiEditId = static_cast<u64>(Service::AM::AppletProgramId::MiiEdit);
|
|
|
|
|
auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
|
|
|
|
|
auto bis_system = QtCommon::system->GetFileSystemController().GetSystemNANDContents();
|
|
|
|
|
if (!bis_system) {
|
|
|
|
|
QMessageBox::warning(this, tr("No firmware available"),
|
|
|
|
|
tr("Please install firmware to use the Mii editor."));
|
|
|
|
@ -4139,7 +4115,7 @@ void GMainWindow::OnMiiEdit() {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::MiiEdit);
|
|
|
|
|
QtCommon::system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::MiiEdit);
|
|
|
|
|
|
|
|
|
|
const auto filename = QString::fromStdString((mii_applet_nca->GetFullPath()));
|
|
|
|
|
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
|
|
|
@ -4148,7 +4124,7 @@ void GMainWindow::OnMiiEdit() {
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnOpenControllerMenu() {
|
|
|
|
|
constexpr u64 ControllerAppletId = static_cast<u64>(Service::AM::AppletProgramId::Controller);
|
|
|
|
|
auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
|
|
|
|
|
auto bis_system = QtCommon::system->GetFileSystemController().GetSystemNANDContents();
|
|
|
|
|
if (!bis_system) {
|
|
|
|
|
QMessageBox::warning(this, tr("No firmware available"),
|
|
|
|
|
tr("Please install firmware to use the Controller Menu."));
|
|
|
|
@ -4163,7 +4139,7 @@ void GMainWindow::OnOpenControllerMenu() {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::Controller);
|
|
|
|
|
QtCommon::system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::Controller);
|
|
|
|
|
|
|
|
|
|
const auto filename = QString::fromStdString((controller_applet_nca->GetFullPath()));
|
|
|
|
|
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
|
|
|
@ -4172,7 +4148,7 @@ void GMainWindow::OnOpenControllerMenu() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnHomeMenu() {
|
|
|
|
|
auto result = FirmwareManager::VerifyFirmware(*system.get());
|
|
|
|
|
auto result = FirmwareManager::VerifyFirmware(*QtCommon::system.get());
|
|
|
|
|
|
|
|
|
|
switch (result) {
|
|
|
|
|
case FirmwareManager::ErrorFirmwareMissing:
|
|
|
|
@ -4209,7 +4185,7 @@ void GMainWindow::OnHomeMenu() {
|
|
|
|
|
// TODO(crueter): So much of this crap is common to qt that I should just move it all tbh
|
|
|
|
|
|
|
|
|
|
constexpr u64 QLaunchId = static_cast<u64>(Service::AM::AppletProgramId::QLaunch);
|
|
|
|
|
auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
|
|
|
|
|
auto bis_system = QtCommon::system->GetFileSystemController().GetSystemNANDContents();
|
|
|
|
|
|
|
|
|
|
auto qlaunch_applet_nca = bis_system->GetEntry(QLaunchId, FileSys::ContentRecordType::Program);
|
|
|
|
|
if (!qlaunch_applet_nca) {
|
|
|
|
@ -4218,7 +4194,7 @@ void GMainWindow::OnHomeMenu() {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::QLaunch);
|
|
|
|
|
QtCommon::system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::QLaunch);
|
|
|
|
|
|
|
|
|
|
const auto filename = QString::fromStdString((qlaunch_applet_nca->GetFullPath()));
|
|
|
|
|
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
|
|
|
@ -4227,7 +4203,7 @@ void GMainWindow::OnHomeMenu() {
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnInitialSetup() {
|
|
|
|
|
constexpr u64 Starter = static_cast<u64>(Service::AM::AppletProgramId::Starter);
|
|
|
|
|
auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
|
|
|
|
|
auto bis_system = QtCommon::system->GetFileSystemController().GetSystemNANDContents();
|
|
|
|
|
if (!bis_system) {
|
|
|
|
|
QMessageBox::warning(this, tr("No firmware available"),
|
|
|
|
|
tr("Please install firmware to use Starter."));
|
|
|
|
@ -4241,7 +4217,7 @@ void GMainWindow::OnInitialSetup() {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::Starter);
|
|
|
|
|
QtCommon::system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::Starter);
|
|
|
|
|
|
|
|
|
|
const auto filename = QString::fromStdString((qlaunch_nca->GetFullPath()));
|
|
|
|
|
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
|
|
|
@ -4288,6 +4264,7 @@ std::filesystem::path GMainWindow::GetShortcutPath(GameListShortcutTarget target
|
|
|
|
|
return shortcut_path;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(crueter): Migrate
|
|
|
|
|
void GMainWindow::CreateShortcut(const std::string &game_path, const u64 program_id, const std::string& game_title_, GameListShortcutTarget target, std::string arguments_, const bool needs_title) {
|
|
|
|
|
// Get path to Eden executable
|
|
|
|
|
std::filesystem::path command = GetEdenCommand();
|
|
|
|
@ -4303,11 +4280,11 @@ void GMainWindow::CreateShortcut(const std::string &game_path, const u64 program
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const FileSys::PatchManager pm{program_id, system->GetFileSystemController(),
|
|
|
|
|
system->GetContentProvider()};
|
|
|
|
|
const FileSys::PatchManager pm{program_id, QtCommon::system->GetFileSystemController(),
|
|
|
|
|
QtCommon::system->GetContentProvider()};
|
|
|
|
|
const auto control = pm.GetControlMetadata();
|
|
|
|
|
const auto loader =
|
|
|
|
|
Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::OpenMode::Read));
|
|
|
|
|
Loader::GetLoader(*QtCommon::system, QtCommon::vfs->OpenFile(game_path, FileSys::OpenMode::Read));
|
|
|
|
|
|
|
|
|
|
std::string game_title{game_title_};
|
|
|
|
|
|
|
|
|
@ -4387,7 +4364,7 @@ void GMainWindow::CreateShortcut(const std::string &game_path, const u64 program
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnCreateHomeMenuShortcut(GameListShortcutTarget target) {
|
|
|
|
|
constexpr u64 QLaunchId = static_cast<u64>(Service::AM::AppletProgramId::QLaunch);
|
|
|
|
|
auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
|
|
|
|
|
auto bis_system = QtCommon::system->GetFileSystemController().GetSystemNANDContents();
|
|
|
|
|
if (!bis_system) {
|
|
|
|
|
QMessageBox::warning(this, tr("No firmware available"),
|
|
|
|
|
tr("Please install firmware to use the home menu."));
|
|
|
|
@ -4413,7 +4390,7 @@ void GMainWindow::OnCaptureScreenshot() {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const u64 title_id = system->GetApplicationProcessProgramID();
|
|
|
|
|
const u64 title_id = QtCommon::system->GetApplicationProcessProgramID();
|
|
|
|
|
const auto screenshot_path =
|
|
|
|
|
QString::fromStdString(Common::FS::GetEdenPathString(Common::FS::EdenPath::ScreenshotsDir));
|
|
|
|
|
const auto date =
|
|
|
|
@ -4574,7 +4551,7 @@ void GMainWindow::OnTasStateChanged() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::UpdateStatusBar() {
|
|
|
|
|
if (emu_thread == nullptr || !system->IsPoweredOn()) {
|
|
|
|
|
if (emu_thread == nullptr || !QtCommon::system->IsPoweredOn()) {
|
|
|
|
|
status_bar_update_timer.stop();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -4585,8 +4562,8 @@ void GMainWindow::UpdateStatusBar() {
|
|
|
|
|
tas_label->clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto results = system->GetAndResetPerfStats();
|
|
|
|
|
auto& shader_notify = system->GPU().ShaderNotify();
|
|
|
|
|
auto results = QtCommon::system->GetAndResetPerfStats();
|
|
|
|
|
auto& shader_notify = QtCommon::system->GPU().ShaderNotify();
|
|
|
|
|
const int shaders_building = shader_notify.ShadersBuilding();
|
|
|
|
|
|
|
|
|
|
if (shaders_building > 0) {
|
|
|
|
@ -4732,7 +4709,7 @@ void GMainWindow::OnMouseActivity() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnCheckFirmwareDecryption() {
|
|
|
|
|
system->GetFileSystemController().CreateFactories(*vfs);
|
|
|
|
|
QtCommon::system->GetFileSystemController().CreateFactories(*QtCommon::vfs);
|
|
|
|
|
if (!ContentManager::AreKeysPresent()) {
|
|
|
|
|
QMessageBox::warning(this, tr("Derivation Components Missing"),
|
|
|
|
|
tr("Encryption keys are missing."));
|
|
|
|
@ -4742,11 +4719,11 @@ void GMainWindow::OnCheckFirmwareDecryption() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool GMainWindow::CheckFirmwarePresence() {
|
|
|
|
|
return FirmwareManager::CheckFirmwarePresence(*system.get());
|
|
|
|
|
return FirmwareManager::CheckFirmwarePresence(*QtCommon::system.get());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::SetFirmwareVersion() {
|
|
|
|
|
const auto pair = FirmwareManager::GetFirmwareVersion(*system.get());
|
|
|
|
|
const auto pair = FirmwareManager::GetFirmwareVersion(*QtCommon::system.get());
|
|
|
|
|
const auto firmware_data = pair.first;
|
|
|
|
|
const auto result = pair.second;
|
|
|
|
|
|
|
|
|
@ -4832,7 +4809,7 @@ bool GMainWindow::ConfirmClose() {
|
|
|
|
|
UISettings::values.confirm_before_stopping.GetValue() == ConfirmStop::Ask_Never) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (!system->GetExitLocked() &&
|
|
|
|
|
if (!QtCommon::system->GetExitLocked() &&
|
|
|
|
|
UISettings::values.confirm_before_stopping.GetValue() == ConfirmStop::Ask_Based_On_Game) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -4862,7 +4839,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
|
|
|
|
|
|
|
|
|
|
render_window->close();
|
|
|
|
|
multiplayer_state->Close();
|
|
|
|
|
system->HIDCore().UnloadInputDevices();
|
|
|
|
|
QtCommon::system->HIDCore().UnloadInputDevices();
|
|
|
|
|
Network::Shutdown();
|
|
|
|
|
|
|
|
|
|
QWidget::closeEvent(event);
|
|
|
|
@ -4933,12 +4910,12 @@ bool GMainWindow::ConfirmForceLockedExit() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::RequestGameExit() {
|
|
|
|
|
if (!system->IsPoweredOn()) {
|
|
|
|
|
if (!QtCommon::system->IsPoweredOn()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
system->SetExitRequested(true);
|
|
|
|
|
system->GetAppletManager().RequestExit();
|
|
|
|
|
QtCommon::system->SetExitRequested(true);
|
|
|
|
|
QtCommon::system->GetAppletManager().RequestExit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::filterBarSetChecked(bool state) {
|
|
|
|
@ -5048,7 +5025,7 @@ void GMainWindow::OnLanguageChanged(const QString& locale) {
|
|
|
|
|
void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) {
|
|
|
|
|
#ifdef USE_DISCORD_PRESENCE
|
|
|
|
|
if (state) {
|
|
|
|
|
discord_rpc = std::make_unique<DiscordRPC::DiscordImpl>(*system);
|
|
|
|
|
discord_rpc = std::make_unique<DiscordRPC::DiscordImpl>(*QtCommon::system);
|
|
|
|
|
} else {
|
|
|
|
|
discord_rpc = std::make_unique<DiscordRPC::NullImpl>();
|
|
|
|
|
}
|
|
|
|
|