summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/file_sys/card_image.cpp7
-rw-r--r--src/core/loader/loader.cpp12
-rw-r--r--src/core/loader/loader.h4
3 files changed, 11 insertions, 12 deletions
diff --git a/src/core/file_sys/card_image.cpp b/src/core/file_sys/card_image.cpp
index 8e05b9d0e..060948f9e 100644
--- a/src/core/file_sys/card_image.cpp
+++ b/src/core/file_sys/card_image.cpp
@@ -4,11 +4,14 @@
4 4
5#include <array> 5#include <array>
6#include <string> 6#include <string>
7#include <core/loader/loader.h> 7
8#include <fmt/ostream.h>
9
8#include "common/logging/log.h" 10#include "common/logging/log.h"
9#include "core/file_sys/card_image.h" 11#include "core/file_sys/card_image.h"
10#include "core/file_sys/partition_filesystem.h" 12#include "core/file_sys/partition_filesystem.h"
11#include "core/file_sys/vfs_offset.h" 13#include "core/file_sys/vfs_offset.h"
14#include "core/loader/loader.h"
12 15
13namespace FileSys { 16namespace FileSys {
14 17
@@ -142,7 +145,7 @@ Loader::ResultStatus XCI::AddNCAFromPartition(XCIPartition part) {
142 const u16 error_id = static_cast<u16>(nca->GetStatus()); 145 const u16 error_id = static_cast<u16>(nca->GetStatus());
143 LOG_CRITICAL(Loader, "Could not load NCA {}/{}, failed with error code {:04X} ({})", 146 LOG_CRITICAL(Loader, "Could not load NCA {}/{}, failed with error code {:04X} ({})",
144 partition_names[static_cast<size_t>(part)], nca->GetName(), error_id, 147 partition_names[static_cast<size_t>(part)], nca->GetName(), error_id,
145 Loader::GetMessageForResultStatus(nca->GetStatus())); 148 nca->GetStatus());
146 } 149 }
147 } 150 }
148 151
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp
index b143f043c..5e07a3f10 100644
--- a/src/core/loader/loader.cpp
+++ b/src/core/loader/loader.cpp
@@ -3,6 +3,7 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <memory> 5#include <memory>
6#include <ostream>
6#include <string> 7#include <string>
7#include "common/logging/log.h" 8#include "common/logging/log.h"
8#include "common/string_util.h" 9#include "common/string_util.h"
@@ -119,14 +120,9 @@ constexpr std::array<const char*, 36> RESULT_MESSAGES{
119 "There is no control data available.", 120 "There is no control data available.",
120}; 121};
121 122
122std::string GetMessageForResultStatus(ResultStatus status) { 123std::ostream& operator<<(std::ostream& os, ResultStatus status) {
123 return GetMessageForResultStatus(static_cast<u16>(status)); 124 os << RESULT_MESSAGES.at(static_cast<size_t>(status));
124} 125 return os;
125
126std::string GetMessageForResultStatus(u16 status) {
127 if (status >= 36)
128 return "";
129 return RESULT_MESSAGES[status];
130} 126}
131 127
132/** 128/**
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h
index 6dffe451a..b74cfbf8a 100644
--- a/src/core/loader/loader.h
+++ b/src/core/loader/loader.h
@@ -5,6 +5,7 @@
5#pragma once 5#pragma once
6 6
7#include <algorithm> 7#include <algorithm>
8#include <iosfwd>
8#include <memory> 9#include <memory>
9#include <string> 10#include <string>
10#include <utility> 11#include <utility>
@@ -94,8 +95,7 @@ enum class ResultStatus : u16 {
94 ErrorNoControl, 95 ErrorNoControl,
95}; 96};
96 97
97std::string GetMessageForResultStatus(ResultStatus status); 98std::ostream& operator<<(std::ostream& os, ResultStatus status);
98std::string GetMessageForResultStatus(u16 status);
99 99
100/// Interface for loading an application 100/// Interface for loading an application
101class AppLoader : NonCopyable { 101class AppLoader : NonCopyable {