mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 12:19:12 +00:00
GCMemcard: Rework construction logic to better match our knowledge of the format, while providing better error reporting facilities.
This commit is contained in:
parent
24718c1a38
commit
b54a49eaaf
5 changed files with 369 additions and 223 deletions
|
@ -241,13 +241,14 @@ void GCMemcardManager::UpdateActions()
|
|||
|
||||
void GCMemcardManager::SetSlotFile(int slot, QString path)
|
||||
{
|
||||
auto memcard = std::make_unique<GCMemcard>(path.toStdString());
|
||||
// TODO: Check error codes and give reasonable error messages.
|
||||
auto [error_code, memcard] = GCMemcard::Open(path.toStdString());
|
||||
|
||||
if (!memcard->IsValid())
|
||||
if (error_code.HasCriticalErrors() || !memcard || !memcard->IsValid())
|
||||
return;
|
||||
|
||||
m_slot_file_edit[slot]->setText(path);
|
||||
m_slot_memcard[slot] = std::move(memcard);
|
||||
m_slot_memcard[slot] = std::make_unique<GCMemcard>(std::move(*memcard));
|
||||
|
||||
UpdateSlotTable(slot);
|
||||
UpdateActions();
|
||||
|
|
|
@ -212,9 +212,10 @@ void GameCubePane::OnConfigPressed(int slot)
|
|||
{
|
||||
if (File::Exists(filename.toStdString()))
|
||||
{
|
||||
GCMemcard mc(filename.toStdString());
|
||||
// TODO: check error codes and give reasonable error messages
|
||||
auto [error_code, mc] = GCMemcard::Open(filename.toStdString());
|
||||
|
||||
if (!mc.IsValid())
|
||||
if (error_code.HasCriticalErrors() || !mc || !mc->IsValid())
|
||||
{
|
||||
ModalMessageBox::critical(this, tr("Error"),
|
||||
tr("Cannot use that file as a memory card.\n%1\n"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue