diff options
author | Zephyron <zephyron@citron-emu.orgq> | 2025-02-16 11:57:23 +1000 |
---|---|---|
committer | Zephyron <zephyron@citron-emu.orgq> | 2025-02-16 11:57:23 +1000 |
commit | a7af4d001bc069b3ad3710667358dd2245f15765 (patch) | |
tree | 93d3be2b3776084c553f123fe6b9b7d8cb313c32 /src/core | |
parent | ef884ce39c47e41351a25fddd09746eb622d2097 (diff) |
service/vi: Improve OpenDisplay validation
Updates the OpenDisplay function in IApplicationDisplayService to properly
validate display names. Instead of only accepting "Default", now validates
against all known valid display names: "Default", "External", "Edid",
"Internal", and "Null".
- Changes log level from WARNING to DEBUG since this is no longer stubbed
- Adds proper validation for all valid display names
- Returns ResultOperationFailed for invalid display names
- Improves logging by including the requested display name
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/hle/service/vi/application_display_service.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/core/hle/service/vi/application_display_service.cpp b/src/core/hle/service/vi/application_display_service.cpp index a3673df14..4fe85d081 100644 --- a/src/core/hle/service/vi/application_display_service.cpp +++ b/src/core/hle/service/vi/application_display_service.cpp @@ -99,11 +99,25 @@ Result IApplicationDisplayService::GetIndirectDisplayTransactionService( } Result IApplicationDisplayService::OpenDisplay(Out<u64> out_display_id, DisplayName display_name) { - LOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_DEBUG(Service_VI, "called with display_name={}", display_name.data()); + // Ensure the display name is null-terminated display_name[display_name.size() - 1] = '\0'; - ASSERT_MSG(strcmp(display_name.data(), "Default") == 0, - "Non-default displays aren't supported yet"); + + // According to switchbrew, only "Default", "External", "Edid", "Internal" and "Null" are valid + const std::array<std::string_view, 5> valid_names = { + "Default", "External", "Edid", "Internal", "Null" + }; + + bool valid_name = false; + for (const auto& name : valid_names) { + if (name == display_name.data()) { + valid_name = true; + break; + } + } + + R_UNLESS(valid_name, ResultOperationFailed); R_RETURN(m_container->OpenDisplay(out_display_id, display_name)); } |