VERY experimental Nintendo Switch 2 emulator
C++
core, main.h: Abort on 32Bit ROMs (#309)
N00byKing6d5b25c13679
diff --git a/src/core/core.cpp b/src/core/core.cppindex 11654d4da7..9f5507a654 100644--- a/src/core/core.cpp+++ b/src/core/core.cpp@@ -92,6 +92,8 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& filereturn ResultStatus::ErrorLoader_ErrorEncrypted;case Loader::ResultStatus::ErrorInvalidFormat:return ResultStatus::ErrorLoader_ErrorInvalidFormat;+ case Loader::ResultStatus::ErrorUnsupportedArch:+ return ResultStatus::ErrorUnsupportedArch;default:return ResultStatus::ErrorSystemMode;}@@ -115,6 +117,8 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& filereturn ResultStatus::ErrorLoader_ErrorEncrypted;case Loader::ResultStatus::ErrorInvalidFormat:return ResultStatus::ErrorLoader_ErrorInvalidFormat;+ case Loader::ResultStatus::ErrorUnsupportedArch:+ return ResultStatus::ErrorUnsupportedArch;default:return ResultStatus::ErrorLoader;}diff --git a/src/core/core.h b/src/core/core.hindex ade456cfc9..f497dc022b 100644--- a/src/core/core.h+++ b/src/core/core.h@@ -44,6 +44,7 @@ public:ErrorSystemFiles, ///< Error in finding system filesErrorSharedFont, ///< Error in finding shared fontErrorVideoCore, ///< Error in the video core+ ErrorUnsupportedArch, ///< Unsupported Architecture (32-Bit ROMs)ErrorUnknown ///< Any other error};diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cppindex 8b4ee970fd..8696c28bd2 100644--- a/src/core/loader/deconstructed_rom_directory.cpp+++ b/src/core/loader/deconstructed_rom_directory.cpp@@ -119,6 +119,11 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(}metadata.Print();+ const FileSys::ProgramAddressSpaceType arch_bits{metadata.GetAddressSpaceType()};+ if (arch_bits == FileSys::ProgramAddressSpaceType::Is32Bit) {+ return ResultStatus::ErrorUnsupportedArch;+ }+// Load NSO modulesVAddr next_load_addr{Memory::PROCESS_IMAGE_VADDR};for (const auto& module : {"rtld", "main", "subsdk0", "subsdk1", "subsdk2", "subsdk3",diff --git a/src/core/loader/loader.h b/src/core/loader/loader.hindex dd44ee9a6d..b1aabb1cb4 100644--- a/src/core/loader/loader.h+++ b/src/core/loader/loader.h@@ -72,6 +72,7 @@ enum class ResultStatus {ErrorAlreadyLoaded,ErrorMemoryAllocationFailed,ErrorEncrypted,+ ErrorUnsupportedArch,};/// Interface for loading an applicationdiff --git a/src/yuzu/main.cpp b/src/yuzu/main.cppindex 793d9d7399..936a2759bc 100644--- a/src/yuzu/main.cpp+++ b/src/yuzu/main.cpp@@ -357,7 +357,12 @@ bool GMainWindow::LoadROM(const QString& filename) {QMessageBox::critical(this, tr("Error while loading ROM!"),tr("The ROM format is not supported."));break;-+ case Core::System::ResultStatus::ErrorUnsupportedArch:+ LOG_CRITICAL(Frontend, "Unsupported architecture detected!",+ filename.toStdString().c_str());+ QMessageBox::critical(this, tr("Error while loading ROM!"),+ tr("The ROM uses currently unusable 32-bit architecture"));+ break;case Core::System::ResultStatus::ErrorSystemMode:LOG_CRITICAL(Frontend, "Failed to load ROM!");QMessageBox::critical(this, tr("Error while loading ROM!"),