mirror of
https://git.citron-emu.org/Citron/Citron.git
synced 2025-02-23 17:18:47 +01:00
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
This commit is contained in:
parent
ef884ce39c
commit
a7af4d001b
1 changed files with 17 additions and 3 deletions
|
@ -99,11 +99,25 @@ Result IApplicationDisplayService::GetIndirectDisplayTransactionService(
|
||||||
}
|
}
|
||||||
|
|
||||||
Result IApplicationDisplayService::OpenDisplay(Out<u64> out_display_id, DisplayName display_name) {
|
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';
|
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));
|
R_RETURN(m_container->OpenDisplay(out_display_id, display_name));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue