diff --git a/src/core/hle/service/cecd/cecd.cpp b/src/core/hle/service/cecd/cecd.cpp index c1e0d446a6..2daa1116c3 100644 --- a/src/core/hle/service/cecd/cecd.cpp +++ b/src/core/hle/service/cecd/cecd.cpp @@ -620,9 +620,9 @@ void Module::Interface::SetData(Kernel::HLERequestContext& ctx) { void Module::Interface::ReadData(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx); - const u32 dest_buffer_size = rp.Pop(); - const CecSystemInfoType info_type = rp.PopEnum(); - const u32 param_buffer_size = rp.Pop(); + const auto dest_buffer_size = rp.Pop(); + const auto info_type = rp.PopEnum(); + const auto param_buffer_size = rp.Pop(); auto& param_buffer = rp.PopMappedBuffer(); auto& dest_buffer = rp.PopMappedBuffer(); @@ -631,22 +631,23 @@ void Module::Interface::ReadData(Kernel::HLERequestContext& ctx) { std::vector buffer; switch (info_type) { case CecSystemInfoType::EulaVersion: { - auto cfg = Service::CFG::GetModule(cecd->system); - Service::CFG::EULAVersion version = cfg->GetEULAVersion(); - dest_buffer.Write(&version, 0, sizeof(version)); + const auto cfg = Service::CFG::GetModule(cecd->system); + const auto version = cfg->GetEULAVersion(); + buffer = {version.minor, version.major}; break; } case CecSystemInfoType::Eula: - buffer = {0x01}; // Eula agreed - dest_buffer.Write(buffer.data(), 0, buffer.size()); + buffer = {true}; // Eula agreed break; case CecSystemInfoType::ParentControl: - buffer = {0x00}; // No parent control - dest_buffer.Write(buffer.data(), 0, buffer.size()); + buffer = {false}; // No parent control break; default: LOG_ERROR(Service_CECD, "Unknown system info type={:#x}", info_type); + buffer = {}; } + dest_buffer.Write(buffer.data(), 0, + std::min(static_cast(dest_buffer_size), buffer.size())); rb.Push(RESULT_SUCCESS); rb.PushMappedBuffer(param_buffer);