diff options
author | TheKoopaKingdom <thekoopakingdom@gmail.com> | 2017-03-08 22:28:30 +0100 |
---|---|---|
committer | TheKoopaKingdom <thekoopakingdom@gmail.com> | 2017-06-03 00:27:56 +0200 |
commit | 1ecb322daa0e2521fe0e179e87889db9aaaf63b0 (patch) | |
tree | 6f8cc571b41a76c7ab93843472809bfc9121abb7 /src/core | |
parent | Fixed encrypted ROM error messages. (diff) | |
download | yuzu-1ecb322daa0e2521fe0e179e87889db9aaaf63b0.tar yuzu-1ecb322daa0e2521fe0e179e87889db9aaaf63b0.tar.gz yuzu-1ecb322daa0e2521fe0e179e87889db9aaaf63b0.tar.bz2 yuzu-1ecb322daa0e2521fe0e179e87889db9aaaf63b0.tar.lz yuzu-1ecb322daa0e2521fe0e179e87889db9aaaf63b0.tar.xz yuzu-1ecb322daa0e2521fe0e179e87889db9aaaf63b0.tar.zst yuzu-1ecb322daa0e2521fe0e179e87889db9aaaf63b0.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/core.cpp | 24 | ||||
-rw-r--r-- | src/core/core.h | 13 | ||||
-rw-r--r-- | src/core/hle/service/apt/apt.cpp | 7 | ||||
-rw-r--r-- | src/core/hle/service/err_f.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/service/fs/fs_user.cpp | 5 |
5 files changed, 43 insertions, 8 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 450e7566d..1861bfa9b 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -59,7 +59,7 @@ System::ResultStatus System::RunLoop(int tight_loop) { HW::Update(); Reschedule(); - return ResultStatus::Success; + return GetStatus(); } System::ResultStatus System::SingleStep() { @@ -73,11 +73,21 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file LOG_CRITICAL(Core, "Failed to obtain loader for %s!", filepath.c_str()); return ResultStatus::ErrorGetLoader; } + boost::optional<u32> system_mode = boost::none; - boost::optional<u32> system_mode{app_loader->LoadKernelSystemMode()}; + Loader::ResultStatus load_result{app_loader->LoadKernelSystemMode(system_mode)}; if (!system_mode) { - LOG_CRITICAL(Core, "Failed to determine system mode!"); - return ResultStatus::ErrorSystemMode; + LOG_CRITICAL(Core, "Failed to determine system mode (Error %i)!", load_result); + System::Shutdown(); + + switch (load_result) { + case Loader::ResultStatus::ErrorEncrypted: + return ResultStatus::ErrorLoader_ErrorEncrypted; + case Loader::ResultStatus::ErrorInvalidFormat: + return ResultStatus::ErrorLoader_ErrorInvalidFormat; + default: + return ResultStatus::ErrorSystemMode; + } } ResultStatus init_result{Init(emu_window, system_mode.get())}; @@ -87,7 +97,7 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file return init_result; } - const Loader::ResultStatus load_result{app_loader->Load()}; + load_result = app_loader->Load(); if (Loader::ResultStatus::Success != load_result) { LOG_CRITICAL(Core, "Failed to load ROM (Error %i)!", load_result); System::Shutdown(); @@ -101,6 +111,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; } @@ -142,7 +154,7 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { GDBStub::Init(); if (!VideoCore::Init(emu_window)) { - return ResultStatus::ErrorVideoCore; + return ResultStatus::ErrorOpenGL; } LOG_DEBUG(Core, "Initialized OK"); diff --git a/src/core/core.h b/src/core/core.h index 6af772831..0963f273e 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -40,7 +40,11 @@ public: ErrorLoader_ErrorEncrypted, ///< Error loading the specified application due to encryption ErrorLoader_ErrorInvalidFormat, ///< Error loading the specified application due to an /// invalid format + ErrorSystemFiles, ///< Error in finding system files + ErrorSharedFont, ///< Error in finding shared font ErrorVideoCore, ///< Error in the video core + ErrorOpenGL, ///< Error when initializing OpenGL + ErrorUnknown ///< Any other error }; /** @@ -105,6 +109,14 @@ public: PerfStats perf_stats; FrameLimiter frame_limiter; + ResultStatus GetStatus() { + return status; + } + + void SetStatus(ResultStatus newStatus) { + status = newStatus; + } + private: /** * Initialize the emulated system. @@ -130,6 +142,7 @@ private: std::unique_ptr<Core::TelemetrySession> telemetry_session; static System s_instance; + ResultStatus status; }; inline ARM_Interface& CPU() { diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 366d1eacf..a92abb58f 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -5,6 +5,7 @@ #include "common/common_paths.h" #include "common/file_util.h" #include "common/logging/log.h" +#include "core/core.h" #include "core/hle/applets/applet.h" #include "core/hle/kernel/event.h" #include "core/hle/kernel/mutex.h" @@ -74,6 +75,7 @@ void GetSharedFont(Service::Interface* self) { LOG_ERROR(Service_APT, "shared font file missing - go dump it from your 3ds"); rb.Push<u32>(-1); // TODO: Find the right error code rb.Skip(1 + 2, true); + Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSharedFont); return; } @@ -279,8 +281,9 @@ void CancelParameter(Service::Interface* self) { rb.Push(RESULT_SUCCESS); // No error rb.Push(true); // Set to Success - LOG_WARNING(Service_APT, "(STUBBED) called check_sender=0x%08X, sender_appid=0x%08X, " - "check_receiver=0x%08X, receiver_appid=0x%08X", + LOG_WARNING(Service_APT, + "(STUBBED) called check_sender=0x%08X, sender_appid=0x%08X, " + "check_receiver=0x%08X, receiver_appid=0x%08X", check_sender, sender_appid, check_receiver, receiver_appid); } diff --git a/src/core/hle/service/err_f.cpp b/src/core/hle/service/err_f.cpp index 9da55f328..4f4dc6dc7 100644 --- a/src/core/hle/service/err_f.cpp +++ b/src/core/hle/service/err_f.cpp @@ -10,6 +10,7 @@ #include "common/bit_field.h" #include "common/common_types.h" #include "common/logging/log.h" +#include "core/core.h" #include "core/hle/result.h" #include "core/hle/service/err_f.h" @@ -172,6 +173,7 @@ static void ThrowFatalError(Interface* self) { const ErrInfo* errinfo = reinterpret_cast<ErrInfo*>(&cmd_buff[1]); LOG_CRITICAL(Service_ERR, "Fatal error type: %s", GetErrType(errinfo->errinfo_common.specifier).c_str()); + Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorUnknown); // Generic Info LogGenericInfo(errinfo->errinfo_common); diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp index e53a970d3..5a4437123 100644 --- a/src/core/hle/service/fs/fs_user.cpp +++ b/src/core/hle/service/fs/fs_user.cpp @@ -8,6 +8,7 @@ #include "common/logging/log.h" #include "common/scope_exit.h" #include "common/string_util.h" +#include "core/core.h" #include "core/file_sys/errors.h" #include "core/hle/kernel/client_session.h" #include "core/hle/result.h" @@ -132,6 +133,10 @@ static void OpenFileDirectly(Service::Interface* self) { LOG_ERROR(Service_FS, "failed to get a handle for archive archive_id=0x%08X archive_path=%s", static_cast<u32>(archive_id), archive_path.DebugStr().c_str()); + if (static_cast<u32>(archive_id) == 0x2345678A) { + Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles); + return; + } cmd_buff[1] = archive_handle.Code().raw; cmd_buff[3] = 0; return; |