summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2022-02-08 04:39:39 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2022-02-08 17:08:04 +0100
commit41b65d38fa57dcfefa9e944ef90c66bb5aa5d254 (patch)
tree8bbe3b47535f45a7e1ac6f45b435bd83c1123c6b /src
parentnfp: Improve implementation (diff)
downloadyuzu-41b65d38fa57dcfefa9e944ef90c66bb5aa5d254.tar
yuzu-41b65d38fa57dcfefa9e944ef90c66bb5aa5d254.tar.gz
yuzu-41b65d38fa57dcfefa9e944ef90c66bb5aa5d254.tar.bz2
yuzu-41b65d38fa57dcfefa9e944ef90c66bb5aa5d254.tar.lz
yuzu-41b65d38fa57dcfefa9e944ef90c66bb5aa5d254.tar.xz
yuzu-41b65d38fa57dcfefa9e944ef90c66bb5aa5d254.tar.zst
yuzu-41b65d38fa57dcfefa9e944ef90c66bb5aa5d254.zip
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/configuration/config.cpp6
-rw-r--r--src/yuzu/main.cpp21
-rw-r--r--src/yuzu/main.ui2
3 files changed, 24 insertions, 5 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 2c8c10c50..53f1a2974 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -75,13 +75,13 @@ const std::array<UISettings::Shortcut, 20> Config::default_hotkeys{{
{QStringLiteral("Exit Fullscreen"), QStringLiteral("Main Window"), {QStringLiteral("Esc"), QStringLiteral(""), Qt::WindowShortcut}},
{QStringLiteral("Exit yuzu"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+Q"), QStringLiteral("Home+Minus"), Qt::WindowShortcut}},
{QStringLiteral("Fullscreen"), QStringLiteral("Main Window"), {QStringLiteral("F11"), QStringLiteral("Home+B"), Qt::WindowShortcut}},
- {QStringLiteral("Load Amiibo"), QStringLiteral("Main Window"), {QStringLiteral("F2"), QStringLiteral("Home+A"), Qt::WidgetWithChildrenShortcut}},
{QStringLiteral("Load File"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+O"), QStringLiteral(""), Qt::WidgetWithChildrenShortcut}},
+ {QStringLiteral("Load/Remove Amiibo"), QStringLiteral("Main Window"), {QStringLiteral("F2"), QStringLiteral("Home+A"), Qt::WidgetWithChildrenShortcut}},
{QStringLiteral("Restart Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F6"), QStringLiteral(""), Qt::WindowShortcut}},
{QStringLiteral("Stop Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F5"), QStringLiteral(""), Qt::WindowShortcut}},
- {QStringLiteral("TAS Start/Stop"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F5"), QStringLiteral(""), Qt::ApplicationShortcut}},
- {QStringLiteral("TAS Reset"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F6"), QStringLiteral(""), Qt::ApplicationShortcut}},
{QStringLiteral("TAS Record"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F7"), QStringLiteral(""), Qt::ApplicationShortcut}},
+ {QStringLiteral("TAS Reset"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F6"), QStringLiteral(""), Qt::ApplicationShortcut}},
+ {QStringLiteral("TAS Start/Stop"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F5"), QStringLiteral(""), Qt::ApplicationShortcut}},
{QStringLiteral("Toggle Filter Bar"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F"), QStringLiteral(""), Qt::WindowShortcut}},
{QStringLiteral("Toggle Framerate Limit"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+U"), QStringLiteral("Home+Y"), Qt::ApplicationShortcut}},
{QStringLiteral("Toggle Mouse Panning"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F9"), QStringLiteral(""), Qt::ApplicationShortcut}},
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index c788db12d..395527607 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -980,7 +980,7 @@ void GMainWindow::InitializeHotkeys() {
hotkey_registry.LoadHotkeys();
LinkActionShortcut(ui->action_Load_File, QStringLiteral("Load File"));
- LinkActionShortcut(ui->action_Load_Amiibo, QStringLiteral("Load Amiibo"));
+ LinkActionShortcut(ui->action_Load_Amiibo, QStringLiteral("Load/Remove Amiibo"));
LinkActionShortcut(ui->action_Exit, QStringLiteral("Exit yuzu"));
LinkActionShortcut(ui->action_Restart, QStringLiteral("Restart Emulation"));
LinkActionShortcut(ui->action_Pause, QStringLiteral("Continue/Pause Emulation"));
@@ -2912,6 +2912,25 @@ void GMainWindow::OnLoadAmiibo() {
return;
}
+ Service::SM::ServiceManager& sm = system->ServiceManager();
+ auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user");
+ if (nfc == nullptr) {
+ QMessageBox::warning(this, tr("Error"),
+ tr("The current game is not looking for amiibos"));
+ return;
+ }
+ const auto nfc_state = nfc->GetCurrentState();
+ if (nfc_state == Service::NFP::DeviceState::TagFound ||
+ nfc_state == Service::NFP::DeviceState::TagMounted) {
+ nfc->CloseAmiibo();
+ return;
+ }
+
+ if (nfc_state != Service::NFP::DeviceState::SearchingForTag) {
+ QMessageBox::warning(this, tr("Error"), tr("The current game is not looking for amiibos"));
+ return;
+ }
+
is_amiibo_file_select_active = true;
const QString extensions{QStringLiteral("*.bin")};
const QString file_filter = tr("Amiibo File (%1);; All Files (*.*)").arg(extensions);
diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui
index 5719b2ee4..6ab95b9a5 100644
--- a/src/yuzu/main.ui
+++ b/src/yuzu/main.ui
@@ -266,7 +266,7 @@
<bool>false</bool>
</property>
<property name="text">
- <string>Load &amp;Amiibo...</string>
+ <string>Load/Remove &amp;Amiibo...</string>
</property>
</action>
<action name="action_Report_Compatibility">