mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
Addressed Bunnei's review comments, and made some other tweaks:
- Deleted GetStatus() because it wasn't used anywhere outside of Core::System. - Fixed design flaw where the message bar status could be set despite the game being stopped.
This commit is contained in:
parent
ff04320c97
commit
f008b22e3b
|
@ -663,10 +663,11 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
|
|||
switch (result) {
|
||||
case Core::System::ResultStatus::ErrorSystemFiles: {
|
||||
QString message = "Citra was unable to locate a 3DS system archive";
|
||||
if (details != std::string())
|
||||
if (!details.empty()) {
|
||||
message.append(tr(": %1. ").arg(details.c_str()));
|
||||
else
|
||||
} else {
|
||||
message.append(". ");
|
||||
}
|
||||
message.append(common_message);
|
||||
|
||||
answer = QMessageBox::question(this, tr("System Archive Not Found"), message,
|
||||
|
@ -698,11 +699,15 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
|
|||
}
|
||||
|
||||
if (answer == QMessageBox::Yes) {
|
||||
if (emu_thread != nullptr)
|
||||
if (emu_thread) {
|
||||
ShutdownGame();
|
||||
}
|
||||
} else {
|
||||
message_label->setText(status_message);
|
||||
message_label->setVisible(true);
|
||||
// Only show the message if the game is still running.
|
||||
if (emu_thread) {
|
||||
message_label->setText(status_message);
|
||||
message_label->setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue