mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-26 17:07:52 -05:00
Merge pull request #12760 from liamwhite/mp-am
am: rewrite for multiprocess support
This commit is contained in:
@ -162,7 +162,7 @@ void QtProfileSelectionDialog::SelectUser(const QModelIndex& index) {
|
||||
|
||||
void QtProfileSelectionDialog::SetWindowTitle(
|
||||
const Core::Frontend::ProfileSelectParameters& parameters) {
|
||||
using Service::AM::Applets::UiMode;
|
||||
using Service::AM::Frontend::UiMode;
|
||||
switch (parameters.mode) {
|
||||
case UiMode::UserCreator:
|
||||
case UiMode::UserCreatorForStarter:
|
||||
@ -193,7 +193,7 @@ void QtProfileSelectionDialog::SetWindowTitle(
|
||||
|
||||
void QtProfileSelectionDialog::SetDialogPurpose(
|
||||
const Core::Frontend::ProfileSelectParameters& parameters) {
|
||||
using Service::AM::Applets::UserSelectionPurpose;
|
||||
using Service::AM::Frontend::UserSelectionPurpose;
|
||||
|
||||
switch (parameters.purpose) {
|
||||
case UserSelectionPurpose::GameCardRegistration:
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace Service::AM::Applets;
|
||||
using namespace Service::AM::Frontend;
|
||||
|
||||
constexpr float BASE_HEADER_FONT_SIZE = 23.0f;
|
||||
constexpr float BASE_SUB_FONT_SIZE = 17.0f;
|
||||
@ -389,7 +389,7 @@ void QtSoftwareKeyboardDialog::ShowNormalKeyboard(QPoint pos, QSize size) {
|
||||
}
|
||||
|
||||
void QtSoftwareKeyboardDialog::ShowTextCheckDialog(
|
||||
Service::AM::Applets::SwkbdTextCheckResult text_check_result,
|
||||
Service::AM::Frontend::SwkbdTextCheckResult text_check_result,
|
||||
std::u16string text_check_message) {
|
||||
switch (text_check_result) {
|
||||
case SwkbdTextCheckResult::Success:
|
||||
@ -1612,7 +1612,7 @@ void QtSoftwareKeyboard::ShowNormalKeyboard() const {
|
||||
}
|
||||
|
||||
void QtSoftwareKeyboard::ShowTextCheckDialog(
|
||||
Service::AM::Applets::SwkbdTextCheckResult text_check_result,
|
||||
Service::AM::Frontend::SwkbdTextCheckResult text_check_result,
|
||||
std::u16string text_check_message) const {
|
||||
emit MainWindowShowTextCheckDialog(text_check_result, std::move(text_check_message));
|
||||
}
|
||||
@ -1662,12 +1662,12 @@ void QtSoftwareKeyboard::ExitKeyboard() const {
|
||||
emit MainWindowExitKeyboard();
|
||||
}
|
||||
|
||||
void QtSoftwareKeyboard::SubmitNormalText(Service::AM::Applets::SwkbdResult result,
|
||||
void QtSoftwareKeyboard::SubmitNormalText(Service::AM::Frontend::SwkbdResult result,
|
||||
std::u16string submitted_text, bool confirmed) const {
|
||||
submit_normal_callback(result, submitted_text, confirmed);
|
||||
}
|
||||
|
||||
void QtSoftwareKeyboard::SubmitInlineText(Service::AM::Applets::SwkbdReplyType reply_type,
|
||||
void QtSoftwareKeyboard::SubmitInlineText(Service::AM::Frontend::SwkbdReplyType reply_type,
|
||||
std::u16string submitted_text,
|
||||
s32 cursor_position) const {
|
||||
submit_inline_callback(reply_type, submitted_text, cursor_position);
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
|
||||
void ShowNormalKeyboard(QPoint pos, QSize size);
|
||||
|
||||
void ShowTextCheckDialog(Service::AM::Applets::SwkbdTextCheckResult text_check_result,
|
||||
void ShowTextCheckDialog(Service::AM::Frontend::SwkbdTextCheckResult text_check_result,
|
||||
std::u16string text_check_message);
|
||||
|
||||
void ShowInlineKeyboard(Core::Frontend::InlineAppearParameters appear_parameters, QPoint pos,
|
||||
@ -52,10 +52,10 @@ public:
|
||||
void ExitKeyboard();
|
||||
|
||||
signals:
|
||||
void SubmitNormalText(Service::AM::Applets::SwkbdResult result, std::u16string submitted_text,
|
||||
void SubmitNormalText(Service::AM::Frontend::SwkbdResult result, std::u16string submitted_text,
|
||||
bool confirmed = false) const;
|
||||
|
||||
void SubmitInlineText(Service::AM::Applets::SwkbdReplyType reply_type,
|
||||
void SubmitInlineText(Service::AM::Frontend::SwkbdReplyType reply_type,
|
||||
std::u16string submitted_text, s32 cursor_position) const;
|
||||
|
||||
public slots:
|
||||
@ -244,7 +244,7 @@ public:
|
||||
|
||||
void ShowNormalKeyboard() const override;
|
||||
|
||||
void ShowTextCheckDialog(Service::AM::Applets::SwkbdTextCheckResult text_check_result,
|
||||
void ShowTextCheckDialog(Service::AM::Frontend::SwkbdTextCheckResult text_check_result,
|
||||
std::u16string text_check_message) const override;
|
||||
|
||||
void ShowInlineKeyboard(
|
||||
@ -262,8 +262,9 @@ signals:
|
||||
|
||||
void MainWindowShowNormalKeyboard() const;
|
||||
|
||||
void MainWindowShowTextCheckDialog(Service::AM::Applets::SwkbdTextCheckResult text_check_result,
|
||||
std::u16string text_check_message) const;
|
||||
void MainWindowShowTextCheckDialog(
|
||||
Service::AM::Frontend::SwkbdTextCheckResult text_check_result,
|
||||
std::u16string text_check_message) const;
|
||||
|
||||
void MainWindowShowInlineKeyboard(
|
||||
Core::Frontend::InlineAppearParameters appear_parameters) const;
|
||||
@ -275,10 +276,10 @@ signals:
|
||||
void MainWindowExitKeyboard() const;
|
||||
|
||||
private:
|
||||
void SubmitNormalText(Service::AM::Applets::SwkbdResult result, std::u16string submitted_text,
|
||||
void SubmitNormalText(Service::AM::Frontend::SwkbdResult result, std::u16string submitted_text,
|
||||
bool confirmed) const;
|
||||
|
||||
void SubmitInlineText(Service::AM::Applets::SwkbdReplyType reply_type,
|
||||
void SubmitInlineText(Service::AM::Frontend::SwkbdReplyType reply_type,
|
||||
std::u16string submitted_text, s32 cursor_position) const;
|
||||
|
||||
mutable SubmitNormalCallback submit_normal_callback;
|
||||
|
@ -96,7 +96,7 @@ QtNXWebEngineView::QtNXWebEngineView(QWidget* parent, Core::System& system,
|
||||
[this] {
|
||||
if (page()->url() == url_interceptor->GetRequestedURL()) {
|
||||
SetFinished(true);
|
||||
SetExitReason(Service::AM::Applets::WebExitReason::WindowClosed);
|
||||
SetExitReason(Service::AM::Frontend::WebExitReason::WindowClosed);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
@ -115,7 +115,7 @@ void QtNXWebEngineView::LoadLocalWebPage(const std::string& main_url,
|
||||
FocusFirstLinkElement();
|
||||
SetUserAgent(UserAgent::WebApplet);
|
||||
SetFinished(false);
|
||||
SetExitReason(Service::AM::Applets::WebExitReason::EndButtonPressed);
|
||||
SetExitReason(Service::AM::Frontend::WebExitReason::EndButtonPressed);
|
||||
SetLastURL("http://localhost/");
|
||||
StartInputThread();
|
||||
|
||||
@ -130,7 +130,7 @@ void QtNXWebEngineView::LoadExternalWebPage(const std::string& main_url,
|
||||
FocusFirstLinkElement();
|
||||
SetUserAgent(UserAgent::WebApplet);
|
||||
SetFinished(false);
|
||||
SetExitReason(Service::AM::Applets::WebExitReason::EndButtonPressed);
|
||||
SetExitReason(Service::AM::Frontend::WebExitReason::EndButtonPressed);
|
||||
SetLastURL("http://localhost/");
|
||||
StartInputThread();
|
||||
|
||||
@ -170,11 +170,11 @@ void QtNXWebEngineView::SetFinished(bool finished_) {
|
||||
finished = finished_;
|
||||
}
|
||||
|
||||
Service::AM::Applets::WebExitReason QtNXWebEngineView::GetExitReason() const {
|
||||
Service::AM::Frontend::WebExitReason QtNXWebEngineView::GetExitReason() const {
|
||||
return exit_reason;
|
||||
}
|
||||
|
||||
void QtNXWebEngineView::SetExitReason(Service::AM::Applets::WebExitReason exit_reason_) {
|
||||
void QtNXWebEngineView::SetExitReason(Service::AM::Frontend::WebExitReason exit_reason_) {
|
||||
exit_reason = exit_reason_;
|
||||
}
|
||||
|
||||
@ -441,7 +441,7 @@ void QtWebBrowser::MainWindowExtractOfflineRomFS() {
|
||||
extract_romfs_callback();
|
||||
}
|
||||
|
||||
void QtWebBrowser::MainWindowWebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason,
|
||||
void QtWebBrowser::MainWindowWebBrowserClosed(Service::AM::Frontend::WebExitReason exit_reason,
|
||||
std::string last_url) {
|
||||
if (callback) {
|
||||
callback(exit_reason, last_url);
|
||||
|
@ -85,8 +85,8 @@ public:
|
||||
[[nodiscard]] bool IsFinished() const;
|
||||
void SetFinished(bool finished_);
|
||||
|
||||
[[nodiscard]] Service::AM::Applets::WebExitReason GetExitReason() const;
|
||||
void SetExitReason(Service::AM::Applets::WebExitReason exit_reason_);
|
||||
[[nodiscard]] Service::AM::Frontend::WebExitReason GetExitReason() const;
|
||||
void SetExitReason(Service::AM::Frontend::WebExitReason exit_reason_);
|
||||
|
||||
[[nodiscard]] const std::string& GetLastURL() const;
|
||||
void SetLastURL(std::string last_url_);
|
||||
@ -176,8 +176,8 @@ private:
|
||||
|
||||
std::atomic<bool> finished{};
|
||||
|
||||
Service::AM::Applets::WebExitReason exit_reason{
|
||||
Service::AM::Applets::WebExitReason::EndButtonPressed};
|
||||
Service::AM::Frontend::WebExitReason exit_reason{
|
||||
Service::AM::Frontend::WebExitReason::EndButtonPressed};
|
||||
|
||||
std::string last_url{"http://localhost/"};
|
||||
|
||||
@ -212,7 +212,7 @@ signals:
|
||||
private:
|
||||
void MainWindowExtractOfflineRomFS();
|
||||
|
||||
void MainWindowWebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason,
|
||||
void MainWindowWebBrowserClosed(Service::AM::Frontend::WebExitReason exit_reason,
|
||||
std::string last_url);
|
||||
|
||||
mutable ExtractROMFSCallback extract_romfs_callback;
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "core/core.h"
|
||||
#include "core/hle/service/am/am.h"
|
||||
#include "core/hle/service/am/applet_ae.h"
|
||||
#include "core/hle/service/am/applet_manager.h"
|
||||
#include "core/hle/service/am/applet_message_queue.h"
|
||||
#include "core/hle/service/am/applet_oe.h"
|
||||
#include "core/hle/service/sm/sm.h"
|
||||
#include "hid_core/frontend/emulated_controller.h"
|
||||
@ -47,22 +49,8 @@ void OnDockedModeChanged(bool last_state, bool new_state, Core::System& system)
|
||||
if (!system.IsPoweredOn()) {
|
||||
return;
|
||||
}
|
||||
Service::SM::ServiceManager& sm = system.ServiceManager();
|
||||
|
||||
// Message queue is shared between these services, we just need to signal an operation
|
||||
// change to one and it will handle both automatically
|
||||
auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE");
|
||||
auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE");
|
||||
bool has_signalled = false;
|
||||
|
||||
if (applet_oe != nullptr) {
|
||||
applet_oe->GetMessageQueue()->OperationModeChanged();
|
||||
has_signalled = true;
|
||||
}
|
||||
|
||||
if (applet_ae != nullptr && !has_signalled) {
|
||||
applet_ae->GetMessageQueue()->OperationModeChanged();
|
||||
}
|
||||
system.GetAppletManager().OperationModeChanged();
|
||||
}
|
||||
|
||||
ConfigureInput::ConfigureInput(Core::System& system_, QWidget* parent)
|
||||
|
@ -596,14 +596,10 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri
|
||||
connect(open_save_location, &QAction::triggered, [this, program_id, path]() {
|
||||
emit OpenFolderRequested(program_id, GameListOpenTarget::SaveData, path);
|
||||
});
|
||||
connect(start_game, &QAction::triggered, [this, path]() {
|
||||
emit BootGame(QString::fromStdString(path), 0, 0, StartGameType::Normal,
|
||||
AmLaunchType::UserInitiated);
|
||||
});
|
||||
connect(start_game_global, &QAction::triggered, [this, path]() {
|
||||
emit BootGame(QString::fromStdString(path), 0, 0, StartGameType::Global,
|
||||
AmLaunchType::UserInitiated);
|
||||
});
|
||||
connect(start_game, &QAction::triggered,
|
||||
[this, path]() { emit BootGame(QString::fromStdString(path), StartGameType::Normal); });
|
||||
connect(start_game_global, &QAction::triggered,
|
||||
[this, path]() { emit BootGame(QString::fromStdString(path), StartGameType::Global); });
|
||||
connect(open_mod_location, &QAction::triggered, [this, program_id, path]() {
|
||||
emit OpenFolderRequested(program_id, GameListOpenTarget::ModData, path);
|
||||
});
|
||||
|
@ -106,8 +106,7 @@ public:
|
||||
static const QStringList supported_file_extensions;
|
||||
|
||||
signals:
|
||||
void BootGame(const QString& game_path, u64 program_id, std::size_t program_index,
|
||||
StartGameType type, AmLaunchType launch_type);
|
||||
void BootGame(const QString& game_path, StartGameType type);
|
||||
void GameChosen(const QString& game_path, const u64 title_id = 0);
|
||||
void OpenFolderRequested(u64 program_id, GameListOpenTarget target,
|
||||
const std::string& game_path);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
#include "core/hle/service/am/applet_manager.h"
|
||||
#include "core/loader/nca.h"
|
||||
#include "core/tools/renderdoc.h"
|
||||
|
||||
@ -39,13 +40,14 @@
|
||||
#include "core/file_sys/vfs/vfs_real.h"
|
||||
#include "core/frontend/applets/cabinet.h"
|
||||
#include "core/frontend/applets/controller.h"
|
||||
#include "core/frontend/applets/general_frontend.h"
|
||||
#include "core/frontend/applets/general.h"
|
||||
#include "core/frontend/applets/mii_edit.h"
|
||||
#include "core/frontend/applets/software_keyboard.h"
|
||||
#include "core/hle/service/acc/profile_manager.h"
|
||||
#include "core/hle/service/am/applet_ae.h"
|
||||
#include "core/hle/service/am/applet_message_queue.h"
|
||||
#include "core/hle/service/am/applet_oe.h"
|
||||
#include "core/hle/service/am/applets/applets.h"
|
||||
#include "core/hle/service/am/frontend/applets.h"
|
||||
#include "core/hle/service/set/system_settings_server.h"
|
||||
#include "frontend_common/content_manager.h"
|
||||
#include "hid_core/frontend/emulated_controller.h"
|
||||
@ -568,7 +570,7 @@ GMainWindow::GMainWindow(std::unique_ptr<QtConfig> config_, bool has_broken_vulk
|
||||
}
|
||||
|
||||
if (!game_path.isEmpty()) {
|
||||
BootGame(game_path);
|
||||
BootGame(game_path, ApplicationAppletParameters());
|
||||
}
|
||||
}
|
||||
|
||||
@ -630,13 +632,14 @@ void GMainWindow::RegisterMetaTypes() {
|
||||
qRegisterMetaType<Core::Frontend::InlineAppearParameters>(
|
||||
"Core::Frontend::InlineAppearParameters");
|
||||
qRegisterMetaType<Core::Frontend::InlineTextParameters>("Core::Frontend::InlineTextParameters");
|
||||
qRegisterMetaType<Service::AM::Applets::SwkbdResult>("Service::AM::Applets::SwkbdResult");
|
||||
qRegisterMetaType<Service::AM::Applets::SwkbdTextCheckResult>(
|
||||
"Service::AM::Applets::SwkbdTextCheckResult");
|
||||
qRegisterMetaType<Service::AM::Applets::SwkbdReplyType>("Service::AM::Applets::SwkbdReplyType");
|
||||
qRegisterMetaType<Service::AM::Frontend::SwkbdResult>("Service::AM::Frontend::SwkbdResult");
|
||||
qRegisterMetaType<Service::AM::Frontend::SwkbdTextCheckResult>(
|
||||
"Service::AM::Frontend::SwkbdTextCheckResult");
|
||||
qRegisterMetaType<Service::AM::Frontend::SwkbdReplyType>(
|
||||
"Service::AM::Frontend::SwkbdReplyType");
|
||||
|
||||
// Web Browser Applet
|
||||
qRegisterMetaType<Service::AM::Applets::WebExitReason>("Service::AM::Applets::WebExitReason");
|
||||
qRegisterMetaType<Service::AM::Frontend::WebExitReason>("Service::AM::Frontend::WebExitReason");
|
||||
|
||||
// Register loader types
|
||||
qRegisterMetaType<Core::SystemResultStatus>("Core::SystemResultStatus");
|
||||
@ -746,7 +749,7 @@ void GMainWindow::SoftwareKeyboardInitialize(
|
||||
if (is_inline) {
|
||||
connect(
|
||||
software_keyboard, &QtSoftwareKeyboardDialog::SubmitInlineText, this,
|
||||
[this](Service::AM::Applets::SwkbdReplyType reply_type, std::u16string submitted_text,
|
||||
[this](Service::AM::Frontend::SwkbdReplyType reply_type, std::u16string submitted_text,
|
||||
s32 cursor_position) {
|
||||
emit SoftwareKeyboardSubmitInlineText(reply_type, submitted_text, cursor_position);
|
||||
},
|
||||
@ -754,7 +757,7 @@ void GMainWindow::SoftwareKeyboardInitialize(
|
||||
} else {
|
||||
connect(
|
||||
software_keyboard, &QtSoftwareKeyboardDialog::SubmitNormalText, this,
|
||||
[this](Service::AM::Applets::SwkbdResult result, std::u16string submitted_text,
|
||||
[this](Service::AM::Frontend::SwkbdResult result, std::u16string submitted_text,
|
||||
bool confirmed) {
|
||||
emit SoftwareKeyboardSubmitNormalText(result, submitted_text, confirmed);
|
||||
},
|
||||
@ -781,7 +784,7 @@ void GMainWindow::SoftwareKeyboardShowNormal() {
|
||||
}
|
||||
|
||||
void GMainWindow::SoftwareKeyboardShowTextCheck(
|
||||
Service::AM::Applets::SwkbdTextCheckResult text_check_result,
|
||||
Service::AM::Frontend::SwkbdTextCheckResult text_check_result,
|
||||
std::u16string text_check_message) {
|
||||
if (!software_keyboard) {
|
||||
LOG_ERROR(Frontend, "The software keyboard is not initialized!");
|
||||
@ -852,7 +855,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
|
||||
|
||||
// Raw input breaks with the web applet, Disable web applets if enabled
|
||||
if (UISettings::values.disable_web_applet || Settings::values.enable_raw_input) {
|
||||
emit WebBrowserClosed(Service::AM::Applets::WebExitReason::WindowClosed,
|
||||
emit WebBrowserClosed(Service::AM::Frontend::WebExitReason::WindowClosed,
|
||||
"http://localhost/");
|
||||
return;
|
||||
}
|
||||
@ -940,7 +943,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
|
||||
if (variant.toBool()) {
|
||||
web_applet->SetFinished(true);
|
||||
web_applet->SetExitReason(
|
||||
Service::AM::Applets::WebExitReason::EndButtonPressed);
|
||||
Service::AM::Frontend::WebExitReason::EndButtonPressed);
|
||||
}
|
||||
});
|
||||
|
||||
@ -950,7 +953,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
|
||||
if (web_applet->GetCurrentURL().contains(QStringLiteral("localhost"))) {
|
||||
if (!web_applet->IsFinished()) {
|
||||
web_applet->SetFinished(true);
|
||||
web_applet->SetExitReason(Service::AM::Applets::WebExitReason::CallbackURL);
|
||||
web_applet->SetExitReason(Service::AM::Frontend::WebExitReason::CallbackURL);
|
||||
}
|
||||
|
||||
web_applet->SetLastURL(web_applet->GetCurrentURL().toStdString());
|
||||
@ -983,7 +986,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
|
||||
#else
|
||||
|
||||
// Utilize the same fallback as the default web browser applet.
|
||||
emit WebBrowserClosed(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/");
|
||||
emit WebBrowserClosed(Service::AM::Frontend::WebExitReason::WindowClosed, "http://localhost/");
|
||||
|
||||
#endif
|
||||
}
|
||||
@ -991,7 +994,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
|
||||
void GMainWindow::WebBrowserRequestExit() {
|
||||
#ifdef YUZU_USE_QT_WEB_ENGINE
|
||||
if (web_applet) {
|
||||
web_applet->SetExitReason(Service::AM::Applets::WebExitReason::ExitRequested);
|
||||
web_applet->SetExitReason(Service::AM::Frontend::WebExitReason::ExitRequested);
|
||||
web_applet->SetFinished(true);
|
||||
}
|
||||
#endif
|
||||
@ -1472,7 +1475,7 @@ void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) {
|
||||
}
|
||||
|
||||
void GMainWindow::ConnectWidgetEvents() {
|
||||
connect(game_list, &GameList::BootGame, this, &GMainWindow::BootGame);
|
||||
connect(game_list, &GameList::BootGame, this, &GMainWindow::BootGameFromList);
|
||||
connect(game_list, &GameList::GameChosen, this, &GMainWindow::OnGameListLoadFile);
|
||||
connect(game_list, &GameList::OpenDirectory, this, &GMainWindow::OnGameListOpenDirectory);
|
||||
connect(game_list, &GameList::OpenFolderRequested, this, &GMainWindow::OnGameListOpenFolder);
|
||||
@ -1760,8 +1763,7 @@ void GMainWindow::AllowOSSleep() {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t program_index,
|
||||
AmLaunchType launch_type) {
|
||||
bool GMainWindow::LoadROM(const QString& filename, Service::AM::FrontendAppletParameters params) {
|
||||
// Shutdown previous session if the emu thread is still active...
|
||||
if (emu_thread != nullptr) {
|
||||
ShutdownGame();
|
||||
@ -1773,11 +1775,11 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
|
||||
|
||||
system->SetFilesystem(vfs);
|
||||
|
||||
if (launch_type == AmLaunchType::UserInitiated) {
|
||||
if (params.launch_type == Service::AM::LaunchType::FrontendInitiated) {
|
||||
system->GetUserChannel().clear();
|
||||
}
|
||||
|
||||
system->SetAppletFrontendSet({
|
||||
system->SetFrontendAppletSet({
|
||||
std::make_unique<QtAmiiboSettings>(*this), // Amiibo Settings
|
||||
(UISettings::values.controller_applet_disabled.GetValue() == true)
|
||||
? nullptr
|
||||
@ -1792,7 +1794,7 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
|
||||
});
|
||||
|
||||
const Core::SystemResultStatus result{
|
||||
system->Load(*render_window, filename.toStdString(), program_id, program_index)};
|
||||
system->Load(*render_window, filename.toStdString(), params)};
|
||||
|
||||
const auto drd_callout = (UISettings::values.callout_flags.GetValue() &
|
||||
static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0;
|
||||
@ -1915,12 +1917,12 @@ void GMainWindow::ConfigureFilesystemProvider(const std::string& filepath) {
|
||||
}
|
||||
}
|
||||
|
||||
void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t program_index,
|
||||
StartGameType type, AmLaunchType launch_type) {
|
||||
void GMainWindow::BootGame(const QString& filename, Service::AM::FrontendAppletParameters params,
|
||||
StartGameType type) {
|
||||
LOG_INFO(Frontend, "yuzu starting...");
|
||||
|
||||
if (program_id == 0 ||
|
||||
program_id > static_cast<u64>(Service::AM::Applets::AppletProgramId::MaxProgramId)) {
|
||||
if (params.program_id == 0 ||
|
||||
params.program_id > static_cast<u64>(Service::AM::AppletProgramId::MaxProgramId)) {
|
||||
StoreRecentFile(filename); // Put the filename on top of the list
|
||||
}
|
||||
|
||||
@ -1935,7 +1937,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
|
||||
|
||||
ConfigureFilesystemProvider(filename.toStdString());
|
||||
const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData());
|
||||
const auto loader = Loader::GetLoader(*system, v_file, program_id, program_index);
|
||||
const auto loader = Loader::GetLoader(*system, v_file, params.program_id, params.program_index);
|
||||
|
||||
if (loader != nullptr && loader->ReadProgramId(title_id) == Loader::ResultStatus::Success &&
|
||||
type == StartGameType::Normal) {
|
||||
@ -1954,10 +1956,10 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
|
||||
|
||||
if (UISettings::values.select_user_on_boot && !user_flag_cmd_line) {
|
||||
const Core::Frontend::ProfileSelectParameters parameters{
|
||||
.mode = Service::AM::Applets::UiMode::UserSelector,
|
||||
.mode = Service::AM::Frontend::UiMode::UserSelector,
|
||||
.invalid_uid_list = {},
|
||||
.display_options = {},
|
||||
.purpose = Service::AM::Applets::UserSelectionPurpose::General,
|
||||
.purpose = Service::AM::Frontend::UserSelectionPurpose::General,
|
||||
};
|
||||
if (SelectAndSetCurrentUser(parameters) == false) {
|
||||
return;
|
||||
@ -1969,7 +1971,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
|
||||
// behavior of asking.
|
||||
user_flag_cmd_line = false;
|
||||
|
||||
if (!LoadROM(filename, program_id, program_index, launch_type)) {
|
||||
if (!LoadROM(filename, params)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2059,6 +2061,10 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
|
||||
OnStartGame();
|
||||
}
|
||||
|
||||
void GMainWindow::BootGameFromList(const QString& filename, StartGameType with_config) {
|
||||
BootGame(filename, ApplicationAppletParameters(), with_config);
|
||||
}
|
||||
|
||||
bool GMainWindow::OnShutdownBegin() {
|
||||
if (!emulation_running) {
|
||||
return false;
|
||||
@ -2160,7 +2166,7 @@ void GMainWindow::OnEmulationStopped() {
|
||||
OnTasStateChanged();
|
||||
render_window->FinalizeCamera();
|
||||
|
||||
system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::None);
|
||||
system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::None);
|
||||
|
||||
// Enable all controllers
|
||||
system->HIDCore().SetSupportedStyleTag({Core::HID::NpadStyleSet::All});
|
||||
@ -2239,7 +2245,10 @@ void GMainWindow::UpdateRecentFiles() {
|
||||
}
|
||||
|
||||
void GMainWindow::OnGameListLoadFile(QString game_path, u64 program_id) {
|
||||
BootGame(game_path, program_id);
|
||||
auto params = ApplicationAppletParameters();
|
||||
params.program_id = program_id;
|
||||
|
||||
BootGame(game_path, params);
|
||||
}
|
||||
|
||||
void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target,
|
||||
@ -2280,10 +2289,10 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
|
||||
// User save data
|
||||
const auto select_profile = [this] {
|
||||
const Core::Frontend::ProfileSelectParameters parameters{
|
||||
.mode = Service::AM::Applets::UiMode::UserSelector,
|
||||
.mode = Service::AM::Frontend::UiMode::UserSelector,
|
||||
.invalid_uid_list = {},
|
||||
.display_options = {},
|
||||
.purpose = Service::AM::Applets::UserSelectionPurpose::General,
|
||||
.purpose = Service::AM::Frontend::UserSelectionPurpose::General,
|
||||
};
|
||||
QtProfileSelectionDialog dialog(*system, this, parameters);
|
||||
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
|
||||
@ -3171,7 +3180,7 @@ void GMainWindow::OnMenuLoadFile() {
|
||||
}
|
||||
|
||||
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
||||
BootGame(filename);
|
||||
BootGame(filename, ApplicationAppletParameters());
|
||||
}
|
||||
|
||||
void GMainWindow::OnMenuLoadFolder() {
|
||||
@ -3185,7 +3194,7 @@ void GMainWindow::OnMenuLoadFolder() {
|
||||
const QDir dir{dir_path};
|
||||
const QStringList matching_main = dir.entryList({QStringLiteral("main")}, QDir::Files);
|
||||
if (matching_main.size() == 1) {
|
||||
BootGame(dir.path() + QDir::separator() + matching_main[0]);
|
||||
BootGame(dir.path() + QDir::separator() + matching_main[0], ApplicationAppletParameters());
|
||||
} else {
|
||||
QMessageBox::warning(this, tr("Invalid Directory Selected"),
|
||||
tr("The directory you have selected does not contain a 'main' file."));
|
||||
@ -3379,7 +3388,7 @@ void GMainWindow::OnMenuRecentFile() {
|
||||
|
||||
const QString filename = action->data().toString();
|
||||
if (QFileInfo::exists(filename)) {
|
||||
BootGame(filename);
|
||||
BootGame(filename, ApplicationAppletParameters());
|
||||
} else {
|
||||
// Display an error message and remove the file from the list.
|
||||
QMessageBox::information(this, tr("File not found"),
|
||||
@ -3417,7 +3426,7 @@ void GMainWindow::OnRestartGame() {
|
||||
// Make a copy since ShutdownGame edits game_path
|
||||
const auto current_game = QString(current_game_path);
|
||||
ShutdownGame();
|
||||
BootGame(current_game);
|
||||
BootGame(current_game, ApplicationAppletParameters());
|
||||
}
|
||||
}
|
||||
|
||||
@ -3485,8 +3494,11 @@ void GMainWindow::OnLoadComplete() {
|
||||
|
||||
void GMainWindow::OnExecuteProgram(std::size_t program_index) {
|
||||
ShutdownGame();
|
||||
BootGame(last_filename_booted, 0, program_index, StartGameType::Normal,
|
||||
AmLaunchType::ApplicationInitiated);
|
||||
|
||||
auto params = ApplicationAppletParameters();
|
||||
params.program_index = static_cast<s32>(program_index);
|
||||
params.launch_type = Service::AM::LaunchType::ApplicationInitiated;
|
||||
BootGame(last_filename_booted, params);
|
||||
}
|
||||
|
||||
void GMainWindow::OnExit() {
|
||||
@ -4153,7 +4165,7 @@ void GMainWindow::OnToggleStatusBar() {
|
||||
}
|
||||
|
||||
void GMainWindow::OnAlbum() {
|
||||
constexpr u64 AlbumId = static_cast<u64>(Service::AM::Applets::AppletProgramId::PhotoViewer);
|
||||
constexpr u64 AlbumId = static_cast<u64>(Service::AM::AppletProgramId::PhotoViewer);
|
||||
auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
|
||||
if (!bis_system) {
|
||||
QMessageBox::warning(this, tr("No firmware available"),
|
||||
@ -4168,15 +4180,15 @@ void GMainWindow::OnAlbum() {
|
||||
return;
|
||||
}
|
||||
|
||||
system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::PhotoViewer);
|
||||
system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::PhotoViewer);
|
||||
|
||||
const auto filename = QString::fromStdString(album_nca->GetFullPath());
|
||||
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
||||
BootGame(filename, AlbumId);
|
||||
BootGame(filename, LibraryAppletParameters(AlbumId, Service::AM::AppletId::PhotoViewer));
|
||||
}
|
||||
|
||||
void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) {
|
||||
constexpr u64 CabinetId = static_cast<u64>(Service::AM::Applets::AppletProgramId::Cabinet);
|
||||
constexpr u64 CabinetId = static_cast<u64>(Service::AM::AppletProgramId::Cabinet);
|
||||
auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
|
||||
if (!bis_system) {
|
||||
QMessageBox::warning(this, tr("No firmware available"),
|
||||
@ -4191,16 +4203,16 @@ void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::Cabinet);
|
||||
system->GetAppletManager().SetCabinetMode(mode);
|
||||
system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::Cabinet);
|
||||
system->GetFrontendAppletHolder().SetCabinetMode(mode);
|
||||
|
||||
const auto filename = QString::fromStdString(cabinet_nca->GetFullPath());
|
||||
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
||||
BootGame(filename, CabinetId);
|
||||
BootGame(filename, LibraryAppletParameters(CabinetId, Service::AM::AppletId::Cabinet));
|
||||
}
|
||||
|
||||
void GMainWindow::OnMiiEdit() {
|
||||
constexpr u64 MiiEditId = static_cast<u64>(Service::AM::Applets::AppletProgramId::MiiEdit);
|
||||
constexpr u64 MiiEditId = static_cast<u64>(Service::AM::AppletProgramId::MiiEdit);
|
||||
auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
|
||||
if (!bis_system) {
|
||||
QMessageBox::warning(this, tr("No firmware available"),
|
||||
@ -4215,16 +4227,15 @@ void GMainWindow::OnMiiEdit() {
|
||||
return;
|
||||
}
|
||||
|
||||
system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::MiiEdit);
|
||||
system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::MiiEdit);
|
||||
|
||||
const auto filename = QString::fromStdString((mii_applet_nca->GetFullPath()));
|
||||
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
||||
BootGame(filename, MiiEditId);
|
||||
BootGame(filename, LibraryAppletParameters(MiiEditId, Service::AM::AppletId::MiiEdit));
|
||||
}
|
||||
|
||||
void GMainWindow::OnOpenControllerMenu() {
|
||||
constexpr u64 ControllerAppletId =
|
||||
static_cast<u64>(Service::AM::Applets::AppletProgramId::Controller);
|
||||
constexpr u64 ControllerAppletId = static_cast<u64>(Service::AM::AppletProgramId::Controller);
|
||||
auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
|
||||
if (!bis_system) {
|
||||
QMessageBox::warning(this, tr("No firmware available"),
|
||||
@ -4240,11 +4251,12 @@ void GMainWindow::OnOpenControllerMenu() {
|
||||
return;
|
||||
}
|
||||
|
||||
system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::Controller);
|
||||
system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::Controller);
|
||||
|
||||
const auto filename = QString::fromStdString((controller_applet_nca->GetFullPath()));
|
||||
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
||||
BootGame(filename, ControllerAppletId);
|
||||
BootGame(filename,
|
||||
LibraryAppletParameters(ControllerAppletId, Service::AM::AppletId::Controller));
|
||||
}
|
||||
|
||||
void GMainWindow::OnCaptureScreenshot() {
|
||||
@ -4564,7 +4576,7 @@ void GMainWindow::OnCheckFirmwareDecryption() {
|
||||
}
|
||||
|
||||
bool GMainWindow::CheckFirmwarePresence() {
|
||||
constexpr u64 MiiEditId = static_cast<u64>(Service::AM::Applets::AppletProgramId::MiiEdit);
|
||||
constexpr u64 MiiEditId = static_cast<u64>(Service::AM::AppletProgramId::MiiEdit);
|
||||
|
||||
auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
|
||||
if (!bis_system) {
|
||||
@ -4727,7 +4739,7 @@ bool GMainWindow::DropAction(QDropEvent* event) {
|
||||
} else {
|
||||
// Game
|
||||
if (ConfirmChangeGame()) {
|
||||
BootGame(filename);
|
||||
BootGame(filename, ApplicationAppletParameters());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -4771,36 +4783,12 @@ void GMainWindow::RequestGameExit() {
|
||||
return;
|
||||
}
|
||||
|
||||
auto& sm{system->ServiceManager()};
|
||||
auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE");
|
||||
auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE");
|
||||
bool has_signalled = false;
|
||||
|
||||
system->SetExitRequested(true);
|
||||
|
||||
if (applet_oe != nullptr) {
|
||||
applet_oe->GetMessageQueue()->RequestExit();
|
||||
has_signalled = true;
|
||||
}
|
||||
|
||||
if (applet_ae != nullptr && !has_signalled) {
|
||||
applet_ae->GetMessageQueue()->RequestExit();
|
||||
}
|
||||
system->GetAppletManager().RequestExit();
|
||||
}
|
||||
|
||||
void GMainWindow::RequestGameResume() {
|
||||
auto& sm{system->ServiceManager()};
|
||||
auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE");
|
||||
auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE");
|
||||
|
||||
if (applet_oe != nullptr) {
|
||||
applet_oe->GetMessageQueue()->RequestResume();
|
||||
return;
|
||||
}
|
||||
|
||||
if (applet_ae != nullptr) {
|
||||
applet_ae->GetMessageQueue()->RequestResume();
|
||||
}
|
||||
system->GetAppletManager().RequestResume();
|
||||
}
|
||||
|
||||
void GMainWindow::filterBarSetChecked(bool state) {
|
||||
@ -4942,6 +4930,22 @@ void GMainWindow::changeEvent(QEvent* event) {
|
||||
QWidget::changeEvent(event);
|
||||
}
|
||||
|
||||
Service::AM::FrontendAppletParameters GMainWindow::ApplicationAppletParameters() {
|
||||
return Service::AM::FrontendAppletParameters{
|
||||
.applet_id = Service::AM::AppletId::Application,
|
||||
.applet_type = Service::AM::AppletType::Application,
|
||||
};
|
||||
}
|
||||
|
||||
Service::AM::FrontendAppletParameters GMainWindow::LibraryAppletParameters(
|
||||
u64 program_id, Service::AM::AppletId applet_id) {
|
||||
return Service::AM::FrontendAppletParameters{
|
||||
.program_id = program_id,
|
||||
.applet_id = applet_id,
|
||||
.applet_type = Service::AM::AppletType::LibraryApplet,
|
||||
};
|
||||
}
|
||||
|
||||
void VolumeButton::wheelEvent(QWheelEvent* event) {
|
||||
|
||||
int num_degrees = event->angleDelta().y() / 8;
|
||||
|
@ -64,11 +64,6 @@ enum class StartGameType {
|
||||
Global, // Only uses global configuration
|
||||
};
|
||||
|
||||
enum class AmLaunchType {
|
||||
UserInitiated,
|
||||
ApplicationInitiated,
|
||||
};
|
||||
|
||||
namespace Core {
|
||||
enum class SystemResultStatus : u32;
|
||||
class System;
|
||||
@ -101,12 +96,17 @@ namespace InputCommon {
|
||||
class InputSubsystem;
|
||||
}
|
||||
|
||||
namespace Service::AM::Applets {
|
||||
namespace Service::AM {
|
||||
struct FrontendAppletParameters;
|
||||
enum class AppletId : u32;
|
||||
} // namespace Service::AM
|
||||
|
||||
namespace Service::AM::Frontend {
|
||||
enum class SwkbdResult : u32;
|
||||
enum class SwkbdTextCheckResult : u32;
|
||||
enum class SwkbdReplyType : u32;
|
||||
enum class WebExitReason : u32;
|
||||
} // namespace Service::AM::Applets
|
||||
} // namespace Service::AM::Frontend
|
||||
|
||||
namespace Service::NFC {
|
||||
class NfcDevice;
|
||||
@ -204,13 +204,13 @@ signals:
|
||||
|
||||
void ProfileSelectorFinishedSelection(std::optional<Common::UUID> uuid);
|
||||
|
||||
void SoftwareKeyboardSubmitNormalText(Service::AM::Applets::SwkbdResult result,
|
||||
void SoftwareKeyboardSubmitNormalText(Service::AM::Frontend::SwkbdResult result,
|
||||
std::u16string submitted_text, bool confirmed);
|
||||
void SoftwareKeyboardSubmitInlineText(Service::AM::Applets::SwkbdReplyType reply_type,
|
||||
void SoftwareKeyboardSubmitInlineText(Service::AM::Frontend::SwkbdReplyType reply_type,
|
||||
std::u16string submitted_text, s32 cursor_position);
|
||||
|
||||
void WebBrowserExtractOfflineRomFS();
|
||||
void WebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason, std::string last_url);
|
||||
void WebBrowserClosed(Service::AM::Frontend::WebExitReason exit_reason, std::string last_url);
|
||||
|
||||
void SigInterrupt();
|
||||
|
||||
@ -228,8 +228,9 @@ public slots:
|
||||
void SoftwareKeyboardInitialize(
|
||||
bool is_inline, Core::Frontend::KeyboardInitializeParameters initialize_parameters);
|
||||
void SoftwareKeyboardShowNormal();
|
||||
void SoftwareKeyboardShowTextCheck(Service::AM::Applets::SwkbdTextCheckResult text_check_result,
|
||||
std::u16string text_check_message);
|
||||
void SoftwareKeyboardShowTextCheck(
|
||||
Service::AM::Frontend::SwkbdTextCheckResult text_check_result,
|
||||
std::u16string text_check_message);
|
||||
void SoftwareKeyboardShowInline(Core::Frontend::InlineAppearParameters appear_parameters);
|
||||
void SoftwareKeyboardHideInline();
|
||||
void SoftwareKeyboardInlineTextChanged(Core::Frontend::InlineTextParameters text_parameters);
|
||||
@ -267,11 +268,10 @@ private:
|
||||
void PreventOSSleep();
|
||||
void AllowOSSleep();
|
||||
|
||||
bool LoadROM(const QString& filename, u64 program_id, std::size_t program_index,
|
||||
AmLaunchType launch_type);
|
||||
void BootGame(const QString& filename, u64 program_id = 0, std::size_t program_index = 0,
|
||||
StartGameType with_config = StartGameType::Normal,
|
||||
AmLaunchType launch_type = AmLaunchType::UserInitiated);
|
||||
bool LoadROM(const QString& filename, Service::AM::FrontendAppletParameters params);
|
||||
void BootGame(const QString& filename, Service::AM::FrontendAppletParameters params,
|
||||
StartGameType with_config = StartGameType::Normal);
|
||||
void BootGameFromList(const QString& filename, StartGameType with_config);
|
||||
void ShutdownGame();
|
||||
|
||||
void ShowTelemetryCallout();
|
||||
@ -324,6 +324,10 @@ private:
|
||||
void SetGamemodeEnabled(bool state);
|
||||
#endif
|
||||
|
||||
Service::AM::FrontendAppletParameters ApplicationAppletParameters();
|
||||
Service::AM::FrontendAppletParameters LibraryAppletParameters(u64 program_id,
|
||||
Service::AM::AppletId applet_id);
|
||||
|
||||
private slots:
|
||||
void OnStartGame();
|
||||
void OnRestartGame();
|
||||
|
Reference in New Issue
Block a user