From c431e5a233f35eb66ace6496b6af4e7cf6396cba Mon Sep 17 00:00:00 2001
From: Leon Styhre <leon@leonstyhre.com>
Date: Fri, 1 Jan 2021 22:37:21 +0100
Subject: [PATCH] Fixed an issue where the screen would go partly black during
 slide transitions.

---
 es-app/src/guis/GuiCollectionSystemsOptions.cpp | 10 +++++-----
 es-app/src/guis/GuiSettings.cpp                 |  8 ++++----
 es-app/src/guis/GuiSettings.h                   |  6 +++---
 es-app/src/views/ViewController.cpp             |  5 +++++
 es-app/src/views/ViewController.h               |  1 +
 5 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/es-app/src/guis/GuiCollectionSystemsOptions.cpp b/es-app/src/guis/GuiCollectionSystemsOptions.cpp
index 902de5bff..47664ea1e 100644
--- a/es-app/src/guis/GuiCollectionSystemsOptions.cpp
+++ b/es-app/src/guis/GuiCollectionSystemsOptions.cpp
@@ -85,7 +85,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
             setNeedsReloading();
             setNeedsCollectionsUpdate();
             if (!mAddedCustomCollection)
-                setNeedsGoToSystemView(SystemData::sSystemVector.front());
+                setNeedsGoToSystem(SystemData::sSystemVector.front());
         }
     });
 
@@ -139,7 +139,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
                 setNeedsReloading();
                 setNeedsCollectionsUpdate();
                 if (!mAddedCustomCollection)
-                    setNeedsGoToSystemView(SystemData::sSystemVector.front());
+                    setNeedsGoToSystem(SystemData::sSystemVector.front());
             }
         }
     });
@@ -259,7 +259,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
                                 Settings::getInstance()->setString("CollectionSystemsCustom",
                                         collectionsConfigEntry);
                                 setNeedsSaving();
-                                setNeedsGoToSystemView(SystemData::sSystemVector.front());
+                                setNeedsGoToSystem(SystemData::sSystemVector.front());
                             }
                             CollectionSystemsManager::get()->deleteCustomCollection(name);
                             return true;
@@ -322,7 +322,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
             setNeedsSaving();
             setNeedsCollectionsUpdate();
             setNeedsReloading();
-            setNeedsGoToSystemView(SystemData::sSystemVector.front());
+            setNeedsGoToSystem(SystemData::sSystemVector.front());
         }
     });
 
@@ -356,7 +356,7 @@ void GuiCollectionSystemsOptions::createCustomCollection(std::string inName)
     collection_systems_custom->add(collectionName, collectionName, true);
 
     mAddedCustomCollection = true;
-    setNeedsGoToSystemView(newCollection);
+    setNeedsGoToSystem(newCollection);
 
     Window* window = mWindow;
     while (window->peekGui() && window->peekGui() != ViewController::get())
diff --git a/es-app/src/guis/GuiSettings.cpp b/es-app/src/guis/GuiSettings.cpp
index 3ddc12470..4bc9a7ac3 100644
--- a/es-app/src/guis/GuiSettings.cpp
+++ b/es-app/src/guis/GuiSettings.cpp
@@ -30,7 +30,7 @@ GuiSettings::GuiSettings(
         mNeedsSortingCollections(false),
         mGoToSystem(nullptr),
         mNeedsGoToStart(false),
-        mNeedsGoToSystemView(false)
+        mNeedsGoToSystem(false)
 {
     addChild(&mMenu);
     mMenu.addButton("BACK", "back", [this] { delete this; });
@@ -79,11 +79,11 @@ void GuiSettings::save()
     if (mNeedsGoToStart)
         ViewController::get()->goToStart();
 
-    if (mNeedsGoToSystemView)
-        ViewController::get()->goToSystemView(mGoToSystem, false);
+    if (mNeedsGoToSystem)
+        ViewController::get()->goToSystem(mGoToSystem, false);
 
     if (mNeedsSaving || mNeedsCollectionsUpdate || mNeedsReloading || mNeedsSorting ||
-            mNeedsGoToStart || mNeedsGoToSystemView)
+            mNeedsGoToStart || mNeedsGoToSystem)
         mWindow->invalidateCachedBackground();
 }
 
diff --git a/es-app/src/guis/GuiSettings.h b/es-app/src/guis/GuiSettings.h
index 7028ad112..9cc934b80 100644
--- a/es-app/src/guis/GuiSettings.h
+++ b/es-app/src/guis/GuiSettings.h
@@ -39,8 +39,8 @@ public:
     void setNeedsSorting() { mNeedsSorting = true; };
     void setNeedsSortingCollections() { mNeedsSortingCollections = true; };
     void setNeedsGoToStart() { mNeedsGoToStart = true; };
-    void setNeedsGoToSystemView(SystemData* goToSystem)
-            { mNeedsGoToSystemView = true; mGoToSystem = goToSystem; };
+    void setNeedsGoToSystem(SystemData* goToSystem)
+            { mNeedsGoToSystem = true; mGoToSystem = goToSystem; };
 
     bool input(InputConfig* config, Input input) override;
     std::vector<HelpPrompt> getHelpPrompts() override;
@@ -55,7 +55,7 @@ private:
     bool mNeedsSorting;
     bool mNeedsSortingCollections;
     bool mNeedsGoToStart;
-    bool mNeedsGoToSystemView;
+    bool mNeedsGoToSystem;
 
     SystemData* mGoToSystem;
 };
diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp
index 1888aa008..2d87657d6 100644
--- a/es-app/src/views/ViewController.cpp
+++ b/es-app/src/views/ViewController.cpp
@@ -261,6 +261,11 @@ void ViewController::goToSystemView(SystemData* system, bool playTransition)
         playViewTransition(true);
 }
 
+void ViewController::goToSystem(SystemData* system, bool animate)
+{
+    mSystemListView->goToSystem(system, animate);
+}
+
 void ViewController::goToNextGameList()
 {
     assert(mState.viewing == GAME_LIST);
diff --git a/es-app/src/views/ViewController.h b/es-app/src/views/ViewController.h
index e6a6a1d8d..eb09504c6 100644
--- a/es-app/src/views/ViewController.h
+++ b/es-app/src/views/ViewController.h
@@ -50,6 +50,7 @@ public:
     void goToPrevGameList();
     void goToGameList(SystemData* system);
     void goToSystemView(SystemData* system, bool playTransition);
+    void goToSystem(SystemData* system, bool animate);
     void goToStart();
     void ReloadAndGoToStart();