mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-23 15:22:45 +01:00
Merge pull request #1079 from lioncash/fmt
loader: Make ResultStatus directly compatible with fmt
This commit is contained in:
commit
69236e5aff
5 changed files with 18 additions and 14 deletions
|
@ -4,11 +4,14 @@
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <core/loader/loader.h>
|
|
||||||
|
#include <fmt/ostream.h>
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/file_sys/card_image.h"
|
#include "core/file_sys/card_image.h"
|
||||||
#include "core/file_sys/partition_filesystem.h"
|
#include "core/file_sys/partition_filesystem.h"
|
||||||
#include "core/file_sys/vfs_offset.h"
|
#include "core/file_sys/vfs_offset.h"
|
||||||
|
#include "core/loader/loader.h"
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
|
@ -142,7 +145,7 @@ Loader::ResultStatus XCI::AddNCAFromPartition(XCIPartition part) {
|
||||||
const u16 error_id = static_cast<u16>(nca->GetStatus());
|
const u16 error_id = static_cast<u16>(nca->GetStatus());
|
||||||
LOG_CRITICAL(Loader, "Could not load NCA {}/{}, failed with error code {:04X} ({})",
|
LOG_CRITICAL(Loader, "Could not load NCA {}/{}, failed with error code {:04X} ({})",
|
||||||
partition_names[static_cast<size_t>(part)], nca->GetName(), error_id,
|
partition_names[static_cast<size_t>(part)], nca->GetName(), error_id,
|
||||||
Loader::GetMessageForResultStatus(nca->GetStatus()));
|
nca->GetStatus());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <ostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
|
@ -119,14 +120,9 @@ constexpr std::array<const char*, 36> RESULT_MESSAGES{
|
||||||
"There is no control data available.",
|
"There is no control data available.",
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string GetMessageForResultStatus(ResultStatus status) {
|
std::ostream& operator<<(std::ostream& os, ResultStatus status) {
|
||||||
return GetMessageForResultStatus(static_cast<u16>(status));
|
os << RESULT_MESSAGES.at(static_cast<size_t>(status));
|
||||||
}
|
return os;
|
||||||
|
|
||||||
std::string GetMessageForResultStatus(u16 status) {
|
|
||||||
if (status >= 36)
|
|
||||||
return "";
|
|
||||||
return RESULT_MESSAGES[status];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <iosfwd>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
@ -94,8 +95,7 @@ enum class ResultStatus : u16 {
|
||||||
ErrorNoControl,
|
ErrorNoControl,
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string GetMessageForResultStatus(ResultStatus status);
|
std::ostream& operator<<(std::ostream& os, ResultStatus status);
|
||||||
std::string GetMessageForResultStatus(u16 status);
|
|
||||||
|
|
||||||
/// Interface for loading an application
|
/// Interface for loading an application
|
||||||
class AppLoader : NonCopyable {
|
class AppLoader : NonCopyable {
|
||||||
|
|
|
@ -6,7 +6,10 @@
|
||||||
#include <clocale>
|
#include <clocale>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
#include <fmt/ostream.h>
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
|
|
||||||
#define QT_NO_OPENGL
|
#define QT_NO_OPENGL
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
@ -454,7 +457,7 @@ bool GMainWindow::LoadROM(const QString& filename) {
|
||||||
"While attempting to load the ROM requested, an error occured. Please "
|
"While attempting to load the ROM requested, an error occured. Please "
|
||||||
"refer to the yuzu wiki for more information or the yuzu discord for "
|
"refer to the yuzu wiki for more information or the yuzu discord for "
|
||||||
"additional help.\n\nError Code: {:04X}-{:04X}\nError Description: {}",
|
"additional help.\n\nError Code: {:04X}-{:04X}\nError Description: {}",
|
||||||
loader_id, error_id, Loader::GetMessageForResultStatus(error_id))));
|
loader_id, error_id, static_cast<Loader::ResultStatus>(error_id))));
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::critical(
|
QMessageBox::critical(
|
||||||
this, tr("Error while loading ROM!"),
|
this, tr("Error while loading ROM!"),
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
#include <fmt/ostream.h>
|
||||||
|
|
||||||
#include "common/common_paths.h"
|
#include "common/common_paths.h"
|
||||||
#include "common/logging/backend.h"
|
#include "common/logging/backend.h"
|
||||||
#include "common/logging/filter.h"
|
#include "common/logging/filter.h"
|
||||||
|
@ -194,7 +196,7 @@ int main(int argc, char** argv) {
|
||||||
"While attempting to load the ROM requested, an error occured. Please "
|
"While attempting to load the ROM requested, an error occured. Please "
|
||||||
"refer to the yuzu wiki for more information or the yuzu discord for "
|
"refer to the yuzu wiki for more information or the yuzu discord for "
|
||||||
"additional help.\n\nError Code: {:04X}-{:04X}\nError Description: {}",
|
"additional help.\n\nError Code: {:04X}-{:04X}\nError Description: {}",
|
||||||
loader_id, error_id, Loader::GetMessageForResultStatus(error_id));
|
loader_id, error_id, static_cast<Loader::ResultStatus>(error_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue