core: Move ResultStatus outside of System
Allows it to be a forward declaration in other header files.
This commit is contained in:
parent
218ebc1fe8
commit
17763a44d5
@ -139,8 +139,8 @@ struct System::Impl {
|
|||||||
: kernel{system}, fs_controller{system}, memory{system},
|
: kernel{system}, fs_controller{system}, memory{system},
|
||||||
cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {}
|
cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {}
|
||||||
|
|
||||||
ResultStatus Run() {
|
SystemResultStatus Run() {
|
||||||
status = ResultStatus::Success;
|
status = SystemResultStatus::Success;
|
||||||
|
|
||||||
kernel.Suspend(false);
|
kernel.Suspend(false);
|
||||||
core_timing.SyncPause(false);
|
core_timing.SyncPause(false);
|
||||||
@ -149,8 +149,8 @@ struct System::Impl {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultStatus Pause() {
|
SystemResultStatus Pause() {
|
||||||
status = ResultStatus::Success;
|
status = SystemResultStatus::Success;
|
||||||
|
|
||||||
core_timing.SyncPause(true);
|
core_timing.SyncPause(true);
|
||||||
kernel.Suspend(true);
|
kernel.Suspend(true);
|
||||||
@ -159,7 +159,7 @@ struct System::Impl {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultStatus Init(System& system, Frontend::EmuWindow& emu_window) {
|
SystemResultStatus Init(System& system, Frontend::EmuWindow& emu_window) {
|
||||||
LOG_DEBUG(Core, "initialized OK");
|
LOG_DEBUG(Core, "initialized OK");
|
||||||
|
|
||||||
device_memory = std::make_unique<Core::DeviceMemory>();
|
device_memory = std::make_unique<Core::DeviceMemory>();
|
||||||
@ -197,7 +197,7 @@ struct System::Impl {
|
|||||||
|
|
||||||
gpu_core = VideoCore::CreateGPU(emu_window, system);
|
gpu_core = VideoCore::CreateGPU(emu_window, system);
|
||||||
if (!gpu_core) {
|
if (!gpu_core) {
|
||||||
return ResultStatus::ErrorVideoCore;
|
return SystemResultStatus::ErrorVideoCore;
|
||||||
}
|
}
|
||||||
|
|
||||||
service_manager = std::make_shared<Service::SM::ServiceManager>(kernel);
|
service_manager = std::make_shared<Service::SM::ServiceManager>(kernel);
|
||||||
@ -217,21 +217,22 @@ struct System::Impl {
|
|||||||
|
|
||||||
LOG_DEBUG(Core, "Initialized OK");
|
LOG_DEBUG(Core, "Initialized OK");
|
||||||
|
|
||||||
return ResultStatus::Success;
|
return SystemResultStatus::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultStatus Load(System& system, Frontend::EmuWindow& emu_window, const std::string& filepath,
|
SystemResultStatus Load(System& system, Frontend::EmuWindow& emu_window,
|
||||||
u64 program_id, std::size_t program_index) {
|
const std::string& filepath, u64 program_id,
|
||||||
|
std::size_t program_index) {
|
||||||
app_loader = Loader::GetLoader(system, GetGameFileFromPath(virtual_filesystem, filepath),
|
app_loader = Loader::GetLoader(system, GetGameFileFromPath(virtual_filesystem, filepath),
|
||||||
program_id, program_index);
|
program_id, program_index);
|
||||||
|
|
||||||
if (!app_loader) {
|
if (!app_loader) {
|
||||||
LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);
|
LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);
|
||||||
return ResultStatus::ErrorGetLoader;
|
return SystemResultStatus::ErrorGetLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultStatus init_result{Init(system, emu_window)};
|
SystemResultStatus init_result{Init(system, emu_window)};
|
||||||
if (init_result != ResultStatus::Success) {
|
if (init_result != SystemResultStatus::Success) {
|
||||||
LOG_CRITICAL(Core, "Failed to initialize system (Error {})!",
|
LOG_CRITICAL(Core, "Failed to initialize system (Error {})!",
|
||||||
static_cast<int>(init_result));
|
static_cast<int>(init_result));
|
||||||
Shutdown();
|
Shutdown();
|
||||||
@ -249,8 +250,8 @@ struct System::Impl {
|
|||||||
LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", load_result);
|
LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", load_result);
|
||||||
Shutdown();
|
Shutdown();
|
||||||
|
|
||||||
return static_cast<ResultStatus>(static_cast<u32>(ResultStatus::ErrorLoader) +
|
return static_cast<SystemResultStatus>(
|
||||||
static_cast<u32>(load_result));
|
static_cast<u32>(SystemResultStatus::ErrorLoader) + static_cast<u32>(load_result));
|
||||||
}
|
}
|
||||||
AddGlueRegistrationForProcess(*app_loader, *main_process);
|
AddGlueRegistrationForProcess(*app_loader, *main_process);
|
||||||
kernel.MakeCurrentProcess(main_process.get());
|
kernel.MakeCurrentProcess(main_process.get());
|
||||||
@ -282,7 +283,7 @@ struct System::Impl {
|
|||||||
GetAndResetPerfStats();
|
GetAndResetPerfStats();
|
||||||
perf_stats->BeginSystemFrame();
|
perf_stats->BeginSystemFrame();
|
||||||
|
|
||||||
status = ResultStatus::Success;
|
status = SystemResultStatus::Success;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +356,7 @@ struct System::Impl {
|
|||||||
arp_manager.Register(launch.title_id, launch, std::move(nacp_data));
|
arp_manager.Register(launch.title_id, launch, std::move(nacp_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetStatus(ResultStatus new_status, const char* details = nullptr) {
|
void SetStatus(SystemResultStatus new_status, const char* details = nullptr) {
|
||||||
status = new_status;
|
status = new_status;
|
||||||
if (details) {
|
if (details) {
|
||||||
status_details = details;
|
status_details = details;
|
||||||
@ -411,7 +412,7 @@ struct System::Impl {
|
|||||||
/// Network instance
|
/// Network instance
|
||||||
Network::NetworkInstance network_instance;
|
Network::NetworkInstance network_instance;
|
||||||
|
|
||||||
ResultStatus status = ResultStatus::Success;
|
SystemResultStatus status = SystemResultStatus::Success;
|
||||||
std::string status_details = "";
|
std::string status_details = "";
|
||||||
|
|
||||||
std::unique_ptr<Core::PerfStats> perf_stats;
|
std::unique_ptr<Core::PerfStats> perf_stats;
|
||||||
@ -439,16 +440,16 @@ const CpuManager& System::GetCpuManager() const {
|
|||||||
return impl->cpu_manager;
|
return impl->cpu_manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
System::ResultStatus System::Run() {
|
SystemResultStatus System::Run() {
|
||||||
return impl->Run();
|
return impl->Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
System::ResultStatus System::Pause() {
|
SystemResultStatus System::Pause() {
|
||||||
return impl->Pause();
|
return impl->Pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
System::ResultStatus System::SingleStep() {
|
SystemResultStatus System::SingleStep() {
|
||||||
return ResultStatus::Success;
|
return SystemResultStatus::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::InvalidateCpuInstructionCaches() {
|
void System::InvalidateCpuInstructionCaches() {
|
||||||
@ -463,8 +464,8 @@ void System::Shutdown() {
|
|||||||
impl->Shutdown();
|
impl->Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
|
SystemResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
|
||||||
u64 program_id, std::size_t program_index) {
|
u64 program_id, std::size_t program_index) {
|
||||||
return impl->Load(*this, emu_window, filepath, program_id, program_index);
|
return impl->Load(*this, emu_window, filepath, program_id, program_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,7 +625,7 @@ Loader::ResultStatus System::GetGameName(std::string& out) const {
|
|||||||
return impl->GetGameName(out);
|
return impl->GetGameName(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::SetStatus(ResultStatus new_status, const char* details) {
|
void System::SetStatus(SystemResultStatus new_status, const char* details) {
|
||||||
impl->SetStatus(new_status, details);
|
impl->SetStatus(new_status, details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +104,18 @@ struct PerfStatsResults;
|
|||||||
FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
|
FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
|
||||||
const std::string& path);
|
const std::string& path);
|
||||||
|
|
||||||
|
/// Enumeration representing the return values of the System Initialize and Load process.
|
||||||
|
enum class SystemResultStatus : u32 {
|
||||||
|
Success, ///< Succeeded
|
||||||
|
ErrorNotInitialized, ///< Error trying to use core prior to initialization
|
||||||
|
ErrorGetLoader, ///< Error finding the correct application loader
|
||||||
|
ErrorSystemFiles, ///< Error in finding system files
|
||||||
|
ErrorSharedFont, ///< Error in finding shared font
|
||||||
|
ErrorVideoCore, ///< Error in the video core
|
||||||
|
ErrorUnknown, ///< Any other error
|
||||||
|
ErrorLoader, ///< The base for loader errors (too many to repeat)
|
||||||
|
};
|
||||||
|
|
||||||
class System {
|
class System {
|
||||||
public:
|
public:
|
||||||
using CurrentBuildProcessID = std::array<u8, 0x20>;
|
using CurrentBuildProcessID = std::array<u8, 0x20>;
|
||||||
@ -118,35 +130,23 @@ public:
|
|||||||
System(System&&) = delete;
|
System(System&&) = delete;
|
||||||
System& operator=(System&&) = delete;
|
System& operator=(System&&) = delete;
|
||||||
|
|
||||||
/// Enumeration representing the return values of the System Initialize and Load process.
|
|
||||||
enum class ResultStatus : u32 {
|
|
||||||
Success, ///< Succeeded
|
|
||||||
ErrorNotInitialized, ///< Error trying to use core prior to initialization
|
|
||||||
ErrorGetLoader, ///< Error finding the correct application loader
|
|
||||||
ErrorSystemFiles, ///< Error in finding system files
|
|
||||||
ErrorSharedFont, ///< Error in finding shared font
|
|
||||||
ErrorVideoCore, ///< Error in the video core
|
|
||||||
ErrorUnknown, ///< Any other error
|
|
||||||
ErrorLoader, ///< The base for loader errors (too many to repeat)
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the OS and Application
|
* Run the OS and Application
|
||||||
* This function will start emulation and run the relevant devices
|
* This function will start emulation and run the relevant devices
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] ResultStatus Run();
|
[[nodiscard]] SystemResultStatus Run();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pause the OS and Application
|
* Pause the OS and Application
|
||||||
* This function will pause emulation and stop the relevant devices
|
* This function will pause emulation and stop the relevant devices
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] ResultStatus Pause();
|
[[nodiscard]] SystemResultStatus Pause();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Step the CPU one instruction
|
* Step the CPU one instruction
|
||||||
* @return Result status, indicating whether or not the operation succeeded.
|
* @return Result status, indicating whether or not the operation succeeded.
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] ResultStatus SingleStep();
|
[[nodiscard]] SystemResultStatus SingleStep();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invalidate the CPU instruction caches
|
* Invalidate the CPU instruction caches
|
||||||
@ -166,10 +166,11 @@ public:
|
|||||||
* input.
|
* input.
|
||||||
* @param filepath String path to the executable application to load on the host file system.
|
* @param filepath String path to the executable application to load on the host file system.
|
||||||
* @param program_index Specifies the index within the container of the program to launch.
|
* @param program_index Specifies the index within the container of the program to launch.
|
||||||
* @returns ResultStatus code, indicating if the operation succeeded.
|
* @returns SystemResultStatus code, indicating if the operation succeeded.
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] ResultStatus Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
|
[[nodiscard]] SystemResultStatus Load(Frontend::EmuWindow& emu_window,
|
||||||
u64 program_id = 0, std::size_t program_index = 0);
|
const std::string& filepath, u64 program_id = 0,
|
||||||
|
std::size_t program_index = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if the emulated system is powered on (all subsystems initialized and able to run an
|
* Indicates if the emulated system is powered on (all subsystems initialized and able to run an
|
||||||
@ -295,7 +296,7 @@ public:
|
|||||||
/// Gets the name of the current game
|
/// Gets the name of the current game
|
||||||
[[nodiscard]] Loader::ResultStatus GetGameName(std::string& out) const;
|
[[nodiscard]] Loader::ResultStatus GetGameName(std::string& out) const;
|
||||||
|
|
||||||
void SetStatus(ResultStatus new_status, const char* details);
|
void SetStatus(SystemResultStatus new_status, const char* details);
|
||||||
|
|
||||||
[[nodiscard]] const std::string& GetStatusDetails() const;
|
[[nodiscard]] const std::string& GetStatusDetails() const;
|
||||||
|
|
||||||
|
@ -86,15 +86,15 @@ void EmuThread::run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
running_guard = true;
|
running_guard = true;
|
||||||
Core::System::ResultStatus result = system.Run();
|
Core::SystemResultStatus result = system.Run();
|
||||||
if (result != Core::System::ResultStatus::Success) {
|
if (result != Core::SystemResultStatus::Success) {
|
||||||
running_guard = false;
|
running_guard = false;
|
||||||
this->SetRunning(false);
|
this->SetRunning(false);
|
||||||
emit ErrorThrown(result, system.GetStatusDetails());
|
emit ErrorThrown(result, system.GetStatusDetails());
|
||||||
}
|
}
|
||||||
running_wait.Wait();
|
running_wait.Wait();
|
||||||
result = system.Pause();
|
result = system.Pause();
|
||||||
if (result != Core::System::ResultStatus::Success) {
|
if (result != Core::SystemResultStatus::Success) {
|
||||||
running_guard = false;
|
running_guard = false;
|
||||||
this->SetRunning(false);
|
this->SetRunning(false);
|
||||||
emit ErrorThrown(result, system.GetStatusDetails());
|
emit ErrorThrown(result, system.GetStatusDetails());
|
||||||
|
@ -123,7 +123,7 @@ signals:
|
|||||||
*/
|
*/
|
||||||
void DebugModeLeft();
|
void DebugModeLeft();
|
||||||
|
|
||||||
void ErrorThrown(Core::System::ResultStatus, std::string);
|
void ErrorThrown(Core::SystemResultStatus, std::string);
|
||||||
|
|
||||||
void LoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total);
|
void LoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total);
|
||||||
};
|
};
|
||||||
|
@ -406,7 +406,7 @@ void GMainWindow::RegisterMetaTypes() {
|
|||||||
qRegisterMetaType<Service::AM::Applets::WebExitReason>("Service::AM::Applets::WebExitReason");
|
qRegisterMetaType<Service::AM::Applets::WebExitReason>("Service::AM::Applets::WebExitReason");
|
||||||
|
|
||||||
// Register loader types
|
// Register loader types
|
||||||
qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus");
|
qRegisterMetaType<Core::SystemResultStatus>("Core::SystemResultStatus");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::ControllerSelectorReconfigureControllers(
|
void GMainWindow::ControllerSelectorReconfigureControllers(
|
||||||
@ -1252,13 +1252,13 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
|
|||||||
std::make_unique<QtWebBrowser>(*this), // Web Browser
|
std::make_unique<QtWebBrowser>(*this), // Web Browser
|
||||||
});
|
});
|
||||||
|
|
||||||
const Core::System::ResultStatus result{
|
const Core::SystemResultStatus result{
|
||||||
system.Load(*render_window, filename.toStdString(), program_id, program_index)};
|
system.Load(*render_window, filename.toStdString(), program_id, program_index)};
|
||||||
|
|
||||||
const auto drd_callout = (UISettings::values.callout_flags.GetValue() &
|
const auto drd_callout = (UISettings::values.callout_flags.GetValue() &
|
||||||
static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0;
|
static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0;
|
||||||
|
|
||||||
if (result == Core::System::ResultStatus::Success &&
|
if (result == Core::SystemResultStatus::Success &&
|
||||||
system.GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory &&
|
system.GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory &&
|
||||||
drd_callout) {
|
drd_callout) {
|
||||||
UISettings::values.callout_flags = UISettings::values.callout_flags.GetValue() |
|
UISettings::values.callout_flags = UISettings::values.callout_flags.GetValue() |
|
||||||
@ -1273,14 +1273,14 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
|
|||||||
"wiki</a>. This message will not be shown again."));
|
"wiki</a>. This message will not be shown again."));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != Core::System::ResultStatus::Success) {
|
if (result != Core::SystemResultStatus::Success) {
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case Core::System::ResultStatus::ErrorGetLoader:
|
case Core::SystemResultStatus::ErrorGetLoader:
|
||||||
LOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filename.toStdString());
|
LOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filename.toStdString());
|
||||||
QMessageBox::critical(this, tr("Error while loading ROM!"),
|
QMessageBox::critical(this, tr("Error while loading ROM!"),
|
||||||
tr("The ROM format is not supported."));
|
tr("The ROM format is not supported."));
|
||||||
break;
|
break;
|
||||||
case Core::System::ResultStatus::ErrorVideoCore:
|
case Core::SystemResultStatus::ErrorVideoCore:
|
||||||
QMessageBox::critical(
|
QMessageBox::critical(
|
||||||
this, tr("An error occurred initializing the video core."),
|
this, tr("An error occurred initializing the video core."),
|
||||||
tr("yuzu has encountered an error while running the video core, please see the "
|
tr("yuzu has encountered an error while running the video core, please see the "
|
||||||
@ -1294,8 +1294,8 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (result > Core::System::ResultStatus::ErrorLoader) {
|
if (result > Core::SystemResultStatus::ErrorLoader) {
|
||||||
const u16 loader_id = static_cast<u16>(Core::System::ResultStatus::ErrorLoader);
|
const u16 loader_id = static_cast<u16>(Core::SystemResultStatus::ErrorLoader);
|
||||||
const u16 error_id = static_cast<u16>(result) - loader_id;
|
const u16 error_id = static_cast<u16>(result) - loader_id;
|
||||||
const std::string error_code = fmt::format("({:04X}-{:04X})", loader_id, error_id);
|
const std::string error_code = fmt::format("({:04X}-{:04X})", loader_id, error_id);
|
||||||
LOG_CRITICAL(Frontend, "Failed to load ROM! {}", error_code);
|
LOG_CRITICAL(Frontend, "Failed to load ROM! {}", error_code);
|
||||||
@ -3052,7 +3052,7 @@ void GMainWindow::OnMouseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) {
|
void GMainWindow::OnCoreError(Core::SystemResultStatus result, std::string details) {
|
||||||
QMessageBox::StandardButton answer;
|
QMessageBox::StandardButton answer;
|
||||||
QString status_message;
|
QString status_message;
|
||||||
const QString common_message =
|
const QString common_message =
|
||||||
@ -3067,7 +3067,7 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
|
|||||||
"back to the game list? Continuing emulation may result in crashes, corrupted save "
|
"back to the game list? Continuing emulation may result in crashes, corrupted save "
|
||||||
"data, or other bugs.");
|
"data, or other bugs.");
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case Core::System::ResultStatus::ErrorSystemFiles: {
|
case Core::SystemResultStatus::ErrorSystemFiles: {
|
||||||
QString message;
|
QString message;
|
||||||
if (details.empty()) {
|
if (details.empty()) {
|
||||||
message =
|
message =
|
||||||
@ -3083,7 +3083,7 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Core::System::ResultStatus::ErrorSharedFont: {
|
case Core::SystemResultStatus::ErrorSharedFont: {
|
||||||
const QString message =
|
const QString message =
|
||||||
tr("yuzu was unable to locate the Switch shared fonts. %1").arg(common_message);
|
tr("yuzu was unable to locate the Switch shared fonts. %1").arg(common_message);
|
||||||
answer = QMessageBox::question(this, tr("Shared Fonts Not Found"), message,
|
answer = QMessageBox::question(this, tr("Shared Fonts Not Found"), message,
|
||||||
|
@ -280,7 +280,7 @@ private slots:
|
|||||||
void ResetWindowSize900();
|
void ResetWindowSize900();
|
||||||
void ResetWindowSize1080();
|
void ResetWindowSize1080();
|
||||||
void OnCaptureScreenshot();
|
void OnCaptureScreenshot();
|
||||||
void OnCoreError(Core::System::ResultStatus, std::string);
|
void OnCoreError(Core::SystemResultStatus, std::string);
|
||||||
void OnReinitializeKeys(ReinitializeKeyBehavior behavior);
|
void OnReinitializeKeys(ReinitializeKeyBehavior behavior);
|
||||||
void OnLanguageChanged(const QString& locale);
|
void OnLanguageChanged(const QString& locale);
|
||||||
void OnMouseActivity();
|
void OnMouseActivity();
|
||||||
|
@ -166,27 +166,27 @@ int main(int argc, char** argv) {
|
|||||||
system.SetFilesystem(std::make_shared<FileSys::RealVfsFilesystem>());
|
system.SetFilesystem(std::make_shared<FileSys::RealVfsFilesystem>());
|
||||||
system.GetFileSystemController().CreateFactories(*system.GetFilesystem());
|
system.GetFileSystemController().CreateFactories(*system.GetFilesystem());
|
||||||
|
|
||||||
const Core::System::ResultStatus load_result{system.Load(*emu_window, filepath)};
|
const Core::SystemResultStatus load_result{system.Load(*emu_window, filepath)};
|
||||||
|
|
||||||
switch (load_result) {
|
switch (load_result) {
|
||||||
case Core::System::ResultStatus::ErrorGetLoader:
|
case Core::SystemResultStatus::ErrorGetLoader:
|
||||||
LOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filepath);
|
LOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filepath);
|
||||||
return -1;
|
return -1;
|
||||||
case Core::System::ResultStatus::ErrorLoader:
|
case Core::SystemResultStatus::ErrorLoader:
|
||||||
LOG_CRITICAL(Frontend, "Failed to load ROM!");
|
LOG_CRITICAL(Frontend, "Failed to load ROM!");
|
||||||
return -1;
|
return -1;
|
||||||
case Core::System::ResultStatus::ErrorNotInitialized:
|
case Core::SystemResultStatus::ErrorNotInitialized:
|
||||||
LOG_CRITICAL(Frontend, "CPUCore not initialized");
|
LOG_CRITICAL(Frontend, "CPUCore not initialized");
|
||||||
return -1;
|
return -1;
|
||||||
case Core::System::ResultStatus::ErrorVideoCore:
|
case Core::SystemResultStatus::ErrorVideoCore:
|
||||||
LOG_CRITICAL(Frontend, "Failed to initialize VideoCore!");
|
LOG_CRITICAL(Frontend, "Failed to initialize VideoCore!");
|
||||||
return -1;
|
return -1;
|
||||||
case Core::System::ResultStatus::Success:
|
case Core::SystemResultStatus::Success:
|
||||||
break; // Expected case
|
break; // Expected case
|
||||||
default:
|
default:
|
||||||
if (static_cast<u32>(load_result) >
|
if (static_cast<u32>(load_result) >
|
||||||
static_cast<u32>(Core::System::ResultStatus::ErrorLoader)) {
|
static_cast<u32>(Core::SystemResultStatus::ErrorLoader)) {
|
||||||
const u16 loader_id = static_cast<u16>(Core::System::ResultStatus::ErrorLoader);
|
const u16 loader_id = static_cast<u16>(Core::SystemResultStatus::ErrorLoader);
|
||||||
const u16 error_id = static_cast<u16>(load_result) - loader_id;
|
const u16 error_id = static_cast<u16>(load_result) - loader_id;
|
||||||
LOG_CRITICAL(Frontend,
|
LOG_CRITICAL(Frontend,
|
||||||
"While attempting to load the ROM requested, an error occurred. Please "
|
"While attempting to load the ROM requested, an error occurred. Please "
|
||||||
|
Loading…
Reference in New Issue
Block a user