summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/core.cpp11
-rw-r--r--src/core/core.h16
-rw-r--r--src/core/file_sys/archive_ncch.cpp12
-rw-r--r--src/core/hle/service/fs/archive.cpp3
-rw-r--r--src/core/loader/loader.h2
-rw-r--r--src/core/loader/ncch.h2
6 files changed, 22 insertions, 24 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 2456d8aa2..5429bcb26 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -26,7 +26,7 @@ namespace Core {
/*static*/ System System::s_instance;
System::ResultStatus System::RunLoop(int tight_loop) {
- this->status = ResultStatus::Success;
+ status = ResultStatus::Success;
if (!cpu_core) {
return ResultStatus::ErrorNotInitialized;
}
@@ -60,7 +60,7 @@ System::ResultStatus System::RunLoop(int tight_loop) {
HW::Update();
Reschedule();
- return GetStatus();
+ return status;
}
System::ResultStatus System::SingleStep() {
@@ -99,8 +99,8 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file
return init_result;
}
- Loader::ResultStatus load_result = app_loader->Load();
- if (load_result != Loader::ResultStatus::Success) {
+ const Loader::ResultStatus load_result{app_loader->Load()};
+ if (Loader::ResultStatus::Success != load_result) {
LOG_CRITICAL(Core, "Failed to load ROM (Error %i)!", load_result);
System::Shutdown();
@@ -113,9 +113,8 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file
return ResultStatus::ErrorLoader;
}
}
- // this->status will be used for errors while actually running the game
status = ResultStatus::Success;
- return ResultStatus::Success;
+ return status;
}
void System::PrepareReschedule() {
diff --git a/src/core/core.h b/src/core/core.h
index 6e555f954..4e3b6b409 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -108,16 +108,14 @@ public:
PerfStats perf_stats;
FrameLimiter frame_limiter;
- ResultStatus GetStatus() {
- return status;
- }
-
- void SetStatus(ResultStatus new_status, std::string details = std::string()) {
+ void SetStatus(ResultStatus new_status, const char* details = nullptr) {
status = new_status;
- status_details = details;
+ if (details) {
+ status_details = details;
+ }
}
- std::string GetStatusDetails() {
+ const std::string& GetStatusDetails() const {
return status_details;
}
@@ -147,8 +145,8 @@ private:
static System s_instance;
- ResultStatus status;
- std::string status_details;
+ ResultStatus status = ResultStatus::Success;
+ std::string status_details = "";
};
inline ARM_Interface& CPU() {
diff --git a/src/core/file_sys/archive_ncch.cpp b/src/core/file_sys/archive_ncch.cpp
index ad59c053e..6d9007731 100644
--- a/src/core/file_sys/archive_ncch.cpp
+++ b/src/core/file_sys/archive_ncch.cpp
@@ -42,13 +42,13 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path&
if (!file->IsOpen()) {
// High Title ID of the archive: The category (https://3dbrew.org/wiki/Title_list).
- const u32 shared_data_archive = 0x0004009B;
- const u32 system_data_archive = 0x000400DB;
+ constexpr u32 shared_data_archive = 0x0004009B;
+ constexpr u32 system_data_archive = 0x000400DB;
// Low Title IDs.
- const u32 mii_data = 0x00010202;
- const u32 region_manifest = 0x00010402;
- const u32 ng_word_list = 0x00010302;
+ constexpr u32 mii_data = 0x00010202;
+ constexpr u32 region_manifest = 0x00010402;
+ constexpr u32 ng_word_list = 0x00010302;
LOG_DEBUG(Service_FS, "Full Path: %s. Category: 0x%X. Path: 0x%X.", path.DebugStr().c_str(),
high, low);
@@ -60,7 +60,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path&
"Mii data");
} else if (low == region_manifest) {
LOG_ERROR(Service_FS,
- "Failed to get a handle for shared data archive: region manifes");
+ "Failed to get a handle for shared data archive: region manifest.");
Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles,
"Region manifest");
}
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 40d52f54b..21929e966 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -257,8 +257,9 @@ ResultVal<ArchiveHandle> OpenArchive(ArchiveIdCode id_code, FileSys::Path& archi
LOG_TRACE(Service_FS, "Opening archive with id code 0x%08X", id_code);
auto itr = id_code_map.find(id_code);
- if (itr == id_code_map.end())
+ if (itr == id_code_map.end()) {
return FileSys::ERROR_NOT_FOUND;
+ }
CASCADE_RESULT(std::unique_ptr<ArchiveBackend> res, itr->second->Open(archive_path));
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h
index adb3ffdcf..48bbf687d 100644
--- a/src/core/loader/loader.h
+++ b/src/core/loader/loader.h
@@ -101,7 +101,7 @@ public:
* Loads the system mode that this application needs.
* This function defaults to 2 (96MB allocated to the application) if it can't read the
* information.
- * @returns a pair of Optional with the kernel system mode and ResultStatus.
+ * @returns A pair with the optional system mode, and and the status.
*/
virtual std::pair<boost::optional<u32>, ResultStatus> LoadKernelSystemMode() {
// 96MB allocated to the application.
diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h
index 507da7550..0ebd47fd5 100644
--- a/src/core/loader/ncch.h
+++ b/src/core/loader/ncch.h
@@ -179,7 +179,7 @@ public:
/**
* Loads the Exheader and returns the system mode for this application.
- * @returns a pair of Optional with the kernel system mode and ResultStatus
+ * @returns A pair with the optional system mode, and and the status.
*/
std::pair<boost::optional<u32>, ResultStatus> LoadKernelSystemMode() override;