Skip to content

Commit

Permalink
Merge pull request #8185 from Techjar/memcard-manager-auto
Browse files Browse the repository at this point in the history
Qt/GCMemcardManager: Load configured memory cards by default
  • Loading branch information
leoetlino authored Nov 9, 2019
2 parents 08b191e + 7dc234a commit c167543
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Source/Core/DolphinQt/GCMemcardManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
#include <QTableWidget>
#include <QTimer>

#include "Common/Config/Config.h"
#include "Common/FileUtil.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"

#include "Core/Config/MainSettings.h"
#include "Core/HW/GCMemcard/GCMemcard.h"

#include "DolphinQt/QtUtils/ModalMessageBox.h"
Expand Down Expand Up @@ -62,6 +64,8 @@ GCMemcardManager::GCMemcardManager(QWidget* parent) : QDialog(parent)
// which means the fastest animation and common denominator is 15 FPS or 66 milliseconds per frame
m_timer->start(1000 / 15);

LoadDefaultMemcards();

// Make the dimensions more reasonable on startup
resize(650, 500);

Expand Down Expand Up @@ -150,6 +154,22 @@ void GCMemcardManager::ConnectWidgets()
}
}

void GCMemcardManager::LoadDefaultMemcards()
{
for (int i = 0; i < SLOT_COUNT; i++)
{
if (Config::Get(i == 0 ? Config::MAIN_SLOT_A : Config::MAIN_SLOT_B) !=
ExpansionInterface::EXIDEVICE_MEMORYCARD)
{
continue;
}

const QString path = QString::fromStdString(
Config::Get(i == 0 ? Config::MAIN_MEMCARD_A_PATH : Config::MAIN_MEMCARD_B_PATH));
SetSlotFile(i, path);
}
}

void GCMemcardManager::SetActiveSlot(int slot)
{
for (int i = 0; i < SLOT_COUNT; i++)
Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinQt/GCMemcardManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class GCMemcardManager : public QDialog

void CreateWidgets();
void ConnectWidgets();
void LoadDefaultMemcards();

void UpdateActions();
void UpdateSlotTable(int slot);
Expand Down

0 comments on commit c167543

Please sign in to comment.