ir:/movie: Replace for-loops with fmt::join
This commit is contained in:
parent
210e558bea
commit
5121fadb4f
|
@ -165,10 +165,8 @@ void ExtraHID::OnDisconnect() {
|
||||||
|
|
||||||
void ExtraHID::HandleConfigureHIDPollingRequest(const std::vector<u8>& request) {
|
void ExtraHID::HandleConfigureHIDPollingRequest(const std::vector<u8>& request) {
|
||||||
if (request.size() != 3) {
|
if (request.size() != 3) {
|
||||||
std::string request_string;
|
LOG_ERROR(Service_IR, "Wrong request size ({}): {}", request.size(),
|
||||||
for (auto request_part : request)
|
fmt::format("{:02x}", fmt::join(request, " ")));
|
||||||
request_string += fmt::format("{:02x} ", request_part);
|
|
||||||
LOG_ERROR(Service_IR, "Wrong request size ({}): {}", request.size(), request_string);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,11 +188,8 @@ void ExtraHID::HandleReadCalibrationDataRequest(const std::vector<u8>& request_b
|
||||||
"ReadCalibrationDataRequest has wrong size");
|
"ReadCalibrationDataRequest has wrong size");
|
||||||
|
|
||||||
if (request_buf.size() != sizeof(ReadCalibrationDataRequest)) {
|
if (request_buf.size() != sizeof(ReadCalibrationDataRequest)) {
|
||||||
std::string request_buf_string;
|
|
||||||
for (auto request_buf_part : request_buf)
|
|
||||||
request_buf_string += fmt::format("{:02x} ", request_buf_part);
|
|
||||||
LOG_ERROR(Service_IR, "Wrong request size ({}): {}", request_buf.size(),
|
LOG_ERROR(Service_IR, "Wrong request size ({}): {}", request_buf.size(),
|
||||||
request_buf_string);
|
fmt::format("{:02x}", fmt::join(request_buf, " ")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,10 +223,7 @@ void ExtraHID::OnReceive(const std::vector<u8>& data) {
|
||||||
HandleReadCalibrationDataRequest(data);
|
HandleReadCalibrationDataRequest(data);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
std::string data_string;
|
LOG_ERROR(Service_IR, "Unknown request: {}", fmt::format("{:02x}", fmt::join(data, " ")));
|
||||||
for (auto data_part : data)
|
|
||||||
data_string += fmt::format("{:02x} ", data_part);
|
|
||||||
LOG_ERROR(Service_IR, "Unknown request: {}", data_string);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,7 +183,7 @@ private:
|
||||||
|
|
||||||
/// Wraps the payload into packet and puts it to the receive buffer
|
/// Wraps the payload into packet and puts it to the receive buffer
|
||||||
void IR_USER::PutToReceive(const std::vector<u8>& payload) {
|
void IR_USER::PutToReceive(const std::vector<u8>& payload) {
|
||||||
LOG_TRACE(Service_IR, "called, data={}", Common::ArrayToString(payload.data(), payload.size()));
|
LOG_TRACE(Service_IR, "called, data={}", fmt::format("{:02x}", fmt::join(payload, " ")));
|
||||||
std::size_t size = payload.size();
|
std::size_t size = payload.size();
|
||||||
|
|
||||||
std::vector<u8> packet;
|
std::vector<u8> packet;
|
||||||
|
@ -361,7 +361,7 @@ void IR_USER::SendIrNop(Kernel::HLERequestContext& ctx) {
|
||||||
ErrorSummary::InvalidState, ErrorLevel::Status));
|
ErrorSummary::InvalidState, ErrorLevel::Status));
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_TRACE(Service_IR, "called, data={}", Common::ArrayToString(buffer.data(), size));
|
LOG_TRACE(Service_IR, "called, data={}", fmt::format("{:02x}", fmt::join(buffer, " ")));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IR_USER::ReleaseReceivedData(Kernel::HLERequestContext& ctx) {
|
void IR_USER::ReleaseReceivedData(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
|
@ -358,9 +358,7 @@ Movie::ValidationResult Movie::ValidateHeader(const CTMHeader& header, u64 progr
|
||||||
return ValidationResult::Invalid;
|
return ValidationResult::Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string revision;
|
std::string revision = fmt::format("{:02x}", fmt::join(header.revision, ""));
|
||||||
for (auto header_part : header.revision)
|
|
||||||
revision += fmt::format("{:02x}", header_part);
|
|
||||||
|
|
||||||
if (!program_id)
|
if (!program_id)
|
||||||
Core::System::GetInstance().GetAppLoader().ReadProgramId(program_id);
|
Core::System::GetInstance().GetAppLoader().ReadProgramId(program_id);
|
||||||
|
|
Reference in New Issue