From e60bae1a942a393a6b8dd3bcc6116dfb7e90cb8d Mon Sep 17 00:00:00 2001
From: Ac_K <Acoustik666@gmail.com>
Date: Sat, 27 Mar 2021 15:41:09 +0100
Subject: [PATCH] misc: Add credit to AmiiboAPI properly and fix a wrong
 warning code (#2150)

* misc: Add credit to AmiiboAPI properly and fix a warning disable

This PR adds a properly credit to AmiiboAPI which is used in our Amiibo emulation in the Readme and in the about window.
I've changed a wrong warning code added in a recent PR too.

* Update README.md

* Fix aligment
---
 README.md                                     |  3 +++
 .../SystemAppletProxy/ICommonStateGetter.cs   |  4 +--
 Ryujinx/Ui/Windows/AboutWindow.Designer.cs    | 25 +++++++++++++++++++
 Ryujinx/Ui/Windows/AboutWindow.cs             |  5 ++++
 4 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 1801078196..c2225a67f2 100644
--- a/README.md
+++ b/README.md
@@ -108,3 +108,6 @@ The Ryujinx.Audio project is licensed under the terms of the LGPLv3 license.
 This project makes use of code authored by the libvpx project, licensed under BSD and the ffmpeg project, licensed under LGPLv3.
 See [LICENSE.txt](LICENSE.txt) and [THIRDPARTY.md](Ryujinx/THIRDPARTY.md) for more details.
  
+## Credits
+
+- [AmiiboAPI](https://www.amiiboapi.com) is used in our Amiibo emulation.
\ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs b/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs
index 27f2d1c8b9..3e0e3a67a6 100644
--- a/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs
@@ -13,10 +13,10 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
         private Lbl.LblControllerServer _lblControllerServer;
 
         private bool _vrModeEnabled;
-#pragma warning disable CS0169
+#pragma warning disable CS0414
         private bool _lcdBacklighOffEnabled;
         private bool _requestExitToLibraryAppletAtExecuteNextProgramEnabled;
-#pragma warning restore CS0169
+#pragma warning restore CS0414
         private int  _messageEventHandle;
         private int  _displayResolutionChangedEventHandle;
 
diff --git a/Ryujinx/Ui/Windows/AboutWindow.Designer.cs b/Ryujinx/Ui/Windows/AboutWindow.Designer.cs
index 99ce9333be..382873c7b3 100644
--- a/Ryujinx/Ui/Windows/AboutWindow.Designer.cs
+++ b/Ryujinx/Ui/Windows/AboutWindow.Designer.cs
@@ -17,6 +17,8 @@ namespace Ryujinx.Ui.Windows
         private Label          _ryujinxLinkLabel;
         private Label          _versionLabel;
         private Label          _disclaimerLabel;
+        private EventBox       _amiiboApiLink;
+        private Label          _amiiboApiLinkLabel;
         private Box            _socialBox;
         private EventBox       _patreonEventBox;
         private Box            _patreonBox;
@@ -157,6 +159,26 @@ namespace Ryujinx.Ui.Windows
             };
             _disclaimerLabel.Attributes.Insert(new Pango.AttrScale(0.8f));
 
+            //
+            // _amiiboApiLink
+            //
+            _amiiboApiLink = new EventBox()
+            {
+                Margin = 5
+            };
+            _amiiboApiLink.ButtonPressEvent += AmiiboApiButton_Pressed;
+
+            //
+            // _amiiboApiLinkLabel
+            //
+            _amiiboApiLinkLabel = new Label("AmiiboAPI (www.amiiboapi.com) is used\nin our Amiibo emulation.")
+            {
+                TooltipText = "Click to open the AmiiboAPI website in your default browser.",
+                Justify     = Justification.Center,
+                Attributes  = new AttrList()
+            };
+            _amiiboApiLinkLabel.Attributes.Insert(new Pango.AttrScale(0.9f));
+
             //
             // _socialBox
             //
@@ -418,6 +440,8 @@ namespace Ryujinx.Ui.Windows
 
             _logoBox.Add(_logoTextBox);
 
+            _amiiboApiLink.Add(_amiiboApiLinkLabel);
+
             _patreonBox.Add(_patreonLogo);
             _patreonBox.Add(_patreonLabel);
             _patreonEventBox.Add(_patreonBox);
@@ -442,6 +466,7 @@ namespace Ryujinx.Ui.Windows
             _leftBox.Add(_logoBox);
             _leftBox.Add(_versionLabel);
             _leftBox.Add(_disclaimerLabel);
+            _leftBox.Add(_amiiboApiLink);
             _leftBox.Add(_socialBox);
 
             _contributorsEventBox.Add(_contributorsLinkLabel);
diff --git a/Ryujinx/Ui/Windows/AboutWindow.cs b/Ryujinx/Ui/Windows/AboutWindow.cs
index 05c6b13e5e..8a77a1391a 100644
--- a/Ryujinx/Ui/Windows/AboutWindow.cs
+++ b/Ryujinx/Ui/Windows/AboutWindow.cs
@@ -47,6 +47,11 @@ namespace Ryujinx.Ui.Windows
             OpenHelper.OpenUrl("https://ryujinx.org");
         }
 
+        private void AmiiboApiButton_Pressed(object sender, ButtonPressEventArgs args)
+        {
+            OpenHelper.OpenUrl("https://amiiboapi.com");
+        }
+
         private void PatreonButton_Pressed(object sender, ButtonPressEventArgs args)
         {
             OpenHelper.OpenUrl("https://www.patreon.com/ryujinx");