From ce87650d818bfe89403358380ff21aa1b56bb8a1 Mon Sep 17 00:00:00 2001
From: Xpl0itR <xpl0itr@outlook.com>
Date: Sat, 10 Oct 2020 00:06:48 +0100
Subject: [PATCH] Show confirmation dialog when attempting to close while a
 game is loaded (#1582)

---
 Ryujinx/Ui/MainWindow.cs | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/Ryujinx/Ui/MainWindow.cs b/Ryujinx/Ui/MainWindow.cs
index dafb5a4513..f6c88a7988 100644
--- a/Ryujinx/Ui/MainWindow.cs
+++ b/Ryujinx/Ui/MainWindow.cs
@@ -918,12 +918,22 @@ namespace Ryujinx.Ui
 
         private void Exit_Pressed(object sender, EventArgs args)
         {
-            End(_emulationContext);
+            if (!_gameLoaded || GtkDialog.CreateExitDialog())
+            {
+                End(_emulationContext);
+            }
         }
 
         private void Window_Close(object sender, DeleteEventArgs args)
         {
-            End(_emulationContext);
+            if (!_gameLoaded || GtkDialog.CreateExitDialog())
+            {
+                End(_emulationContext);
+            }
+            else
+            {
+                args.RetVal = true;
+            }
         }
 
         private void StopEmulation_Pressed(object sender, EventArgs args)