mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-15 22:54:00 +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
7 changed files with 32 additions and 29 deletions
|
@ -663,10 +663,11 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case Core::System::ResultStatus::ErrorSystemFiles: {
|
case Core::System::ResultStatus::ErrorSystemFiles: {
|
||||||
QString message = "Citra was unable to locate a 3DS system archive";
|
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()));
|
message.append(tr(": %1. ").arg(details.c_str()));
|
||||||
else
|
} else {
|
||||||
message.append(". ");
|
message.append(". ");
|
||||||
|
}
|
||||||
message.append(common_message);
|
message.append(common_message);
|
||||||
|
|
||||||
answer = QMessageBox::question(this, tr("System Archive Not Found"), message,
|
answer = QMessageBox::question(this, tr("System Archive Not Found"), message,
|
||||||
|
@ -698,13 +699,17 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
|
||||||
}
|
}
|
||||||
|
|
||||||
if (answer == QMessageBox::Yes) {
|
if (answer == QMessageBox::Yes) {
|
||||||
if (emu_thread != nullptr)
|
if (emu_thread) {
|
||||||
ShutdownGame();
|
ShutdownGame();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Only show the message if the game is still running.
|
||||||
|
if (emu_thread) {
|
||||||
message_label->setText(status_message);
|
message_label->setText(status_message);
|
||||||
message_label->setVisible(true);
|
message_label->setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool GMainWindow::ConfirmClose() {
|
bool GMainWindow::ConfirmClose() {
|
||||||
if (emu_thread == nullptr || !UISettings::values.confirm_before_closing)
|
if (emu_thread == nullptr || !UISettings::values.confirm_before_closing)
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace Core {
|
||||||
/*static*/ System System::s_instance;
|
/*static*/ System System::s_instance;
|
||||||
|
|
||||||
System::ResultStatus System::RunLoop(int tight_loop) {
|
System::ResultStatus System::RunLoop(int tight_loop) {
|
||||||
this->status = ResultStatus::Success;
|
status = ResultStatus::Success;
|
||||||
if (!cpu_core) {
|
if (!cpu_core) {
|
||||||
return ResultStatus::ErrorNotInitialized;
|
return ResultStatus::ErrorNotInitialized;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ System::ResultStatus System::RunLoop(int tight_loop) {
|
||||||
HW::Update();
|
HW::Update();
|
||||||
Reschedule();
|
Reschedule();
|
||||||
|
|
||||||
return GetStatus();
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
System::ResultStatus System::SingleStep() {
|
System::ResultStatus System::SingleStep() {
|
||||||
|
@ -99,8 +99,8 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file
|
||||||
return init_result;
|
return init_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader::ResultStatus load_result = app_loader->Load();
|
const Loader::ResultStatus load_result{app_loader->Load()};
|
||||||
if (load_result != Loader::ResultStatus::Success) {
|
if (Loader::ResultStatus::Success != load_result) {
|
||||||
LOG_CRITICAL(Core, "Failed to load ROM (Error %i)!", load_result);
|
LOG_CRITICAL(Core, "Failed to load ROM (Error %i)!", load_result);
|
||||||
System::Shutdown();
|
System::Shutdown();
|
||||||
|
|
||||||
|
@ -113,9 +113,8 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file
|
||||||
return ResultStatus::ErrorLoader;
|
return ResultStatus::ErrorLoader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this->status will be used for errors while actually running the game
|
|
||||||
status = ResultStatus::Success;
|
status = ResultStatus::Success;
|
||||||
return ResultStatus::Success;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::PrepareReschedule() {
|
void System::PrepareReschedule() {
|
||||||
|
|
|
@ -108,16 +108,14 @@ public:
|
||||||
PerfStats perf_stats;
|
PerfStats perf_stats;
|
||||||
FrameLimiter frame_limiter;
|
FrameLimiter frame_limiter;
|
||||||
|
|
||||||
ResultStatus GetStatus() {
|
void SetStatus(ResultStatus new_status, const char* details = nullptr) {
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetStatus(ResultStatus new_status, std::string details = std::string()) {
|
|
||||||
status = new_status;
|
status = new_status;
|
||||||
|
if (details) {
|
||||||
status_details = details;
|
status_details = details;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string GetStatusDetails() {
|
const std::string& GetStatusDetails() const {
|
||||||
return status_details;
|
return status_details;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,8 +145,8 @@ private:
|
||||||
|
|
||||||
static System s_instance;
|
static System s_instance;
|
||||||
|
|
||||||
ResultStatus status;
|
ResultStatus status = ResultStatus::Success;
|
||||||
std::string status_details;
|
std::string status_details = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
inline ARM_Interface& CPU() {
|
inline ARM_Interface& CPU() {
|
||||||
|
|
|
@ -42,13 +42,13 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path&
|
||||||
|
|
||||||
if (!file->IsOpen()) {
|
if (!file->IsOpen()) {
|
||||||
// High Title ID of the archive: The category (https://3dbrew.org/wiki/Title_list).
|
// High Title ID of the archive: The category (https://3dbrew.org/wiki/Title_list).
|
||||||
const u32 shared_data_archive = 0x0004009B;
|
constexpr u32 shared_data_archive = 0x0004009B;
|
||||||
const u32 system_data_archive = 0x000400DB;
|
constexpr u32 system_data_archive = 0x000400DB;
|
||||||
|
|
||||||
// Low Title IDs.
|
// Low Title IDs.
|
||||||
const u32 mii_data = 0x00010202;
|
constexpr u32 mii_data = 0x00010202;
|
||||||
const u32 region_manifest = 0x00010402;
|
constexpr u32 region_manifest = 0x00010402;
|
||||||
const u32 ng_word_list = 0x00010302;
|
constexpr u32 ng_word_list = 0x00010302;
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "Full Path: %s. Category: 0x%X. Path: 0x%X.", path.DebugStr().c_str(),
|
LOG_DEBUG(Service_FS, "Full Path: %s. Category: 0x%X. Path: 0x%X.", path.DebugStr().c_str(),
|
||||||
high, low);
|
high, low);
|
||||||
|
@ -60,7 +60,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path&
|
||||||
"Mii data");
|
"Mii data");
|
||||||
} else if (low == region_manifest) {
|
} else if (low == region_manifest) {
|
||||||
LOG_ERROR(Service_FS,
|
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,
|
Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles,
|
||||||
"Region manifest");
|
"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);
|
LOG_TRACE(Service_FS, "Opening archive with id code 0x%08X", id_code);
|
||||||
|
|
||||||
auto itr = id_code_map.find(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;
|
return FileSys::ERROR_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
CASCADE_RESULT(std::unique_ptr<ArchiveBackend> res, itr->second->Open(archive_path));
|
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.
|
* Loads the system mode that this application needs.
|
||||||
* This function defaults to 2 (96MB allocated to the application) if it can't read the
|
* This function defaults to 2 (96MB allocated to the application) if it can't read the
|
||||||
* information.
|
* 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() {
|
virtual std::pair<boost::optional<u32>, ResultStatus> LoadKernelSystemMode() {
|
||||||
// 96MB allocated to the application.
|
// 96MB allocated to the application.
|
||||||
|
|
|
@ -179,7 +179,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the Exheader and returns the system mode for this application.
|
* 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;
|
std::pair<boost::optional<u32>, ResultStatus> LoadKernelSystemMode() override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue