Merge pull request #5570 from FearlessTobi/port-4698
Port yuzu-emu/yuzu#4698: "General: Make use of std::nullopt where applicable"
This commit is contained in:
commit
1c8461fdea
|
@ -55,7 +55,7 @@ std::optional<BinaryResponse> NullDecoder::ProcessRequest(const BinaryRequest& r
|
||||||
return response;
|
return response;
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(Audio_DSP, "Got unknown binary request: {}", static_cast<u16>(request.cmd));
|
LOG_ERROR(Audio_DSP, "Got unknown binary request: {}", static_cast<u16>(request.cmd));
|
||||||
return {};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace AudioCore::HLE
|
} // namespace AudioCore::HLE
|
||||||
|
|
|
@ -104,7 +104,7 @@ WMFDecoder::Impl::~Impl() {
|
||||||
std::optional<BinaryResponse> WMFDecoder::Impl::ProcessRequest(const BinaryRequest& request) {
|
std::optional<BinaryResponse> WMFDecoder::Impl::ProcessRequest(const BinaryRequest& request) {
|
||||||
if (request.codec != DecoderCodec::AAC) {
|
if (request.codec != DecoderCodec::AAC) {
|
||||||
LOG_ERROR(Audio_DSP, "Got unknown codec {}", static_cast<u16>(request.codec));
|
LOG_ERROR(Audio_DSP, "Got unknown codec {}", static_cast<u16>(request.codec));
|
||||||
return {};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (request.cmd) {
|
switch (request.cmd) {
|
||||||
|
@ -123,7 +123,7 @@ std::optional<BinaryResponse> WMFDecoder::Impl::ProcessRequest(const BinaryReque
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(Audio_DSP, "Got unknown binary request: {}", static_cast<u16>(request.cmd));
|
LOG_ERROR(Audio_DSP, "Got unknown binary request: {}", static_cast<u16>(request.cmd));
|
||||||
return {};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ std::optional<BinaryResponse> WMFDecoder::Impl::Decode(const BinaryRequest& requ
|
||||||
if (request.src_addr < Memory::FCRAM_PADDR ||
|
if (request.src_addr < Memory::FCRAM_PADDR ||
|
||||||
request.src_addr + request.size > Memory::FCRAM_PADDR + Memory::FCRAM_SIZE) {
|
request.src_addr + request.size > Memory::FCRAM_PADDR + Memory::FCRAM_SIZE) {
|
||||||
LOG_ERROR(Audio_DSP, "Got out of bounds src_addr {:08x}", request.src_addr);
|
LOG_ERROR(Audio_DSP, "Got out of bounds src_addr {:08x}", request.src_addr);
|
||||||
return {};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
u8* data = memory.GetFCRAMPointer(request.src_addr - Memory::FCRAM_PADDR);
|
u8* data = memory.GetFCRAMPointer(request.src_addr - Memory::FCRAM_PADDR);
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ std::optional<BinaryResponse> WMFDecoder::Impl::Decode(const BinaryRequest& requ
|
||||||
request.dst_addr_ch0 + out_streams[0].size() >
|
request.dst_addr_ch0 + out_streams[0].size() >
|
||||||
Memory::FCRAM_PADDR + Memory::FCRAM_SIZE) {
|
Memory::FCRAM_PADDR + Memory::FCRAM_SIZE) {
|
||||||
LOG_ERROR(Audio_DSP, "Got out of bounds dst_addr_ch0 {:08x}", request.dst_addr_ch0);
|
LOG_ERROR(Audio_DSP, "Got out of bounds dst_addr_ch0 {:08x}", request.dst_addr_ch0);
|
||||||
return {};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
std::memcpy(memory.GetFCRAMPointer(request.dst_addr_ch0 - Memory::FCRAM_PADDR),
|
std::memcpy(memory.GetFCRAMPointer(request.dst_addr_ch0 - Memory::FCRAM_PADDR),
|
||||||
out_streams[0].data(), out_streams[0].size());
|
out_streams[0].data(), out_streams[0].size());
|
||||||
|
@ -280,7 +280,7 @@ std::optional<BinaryResponse> WMFDecoder::Impl::Decode(const BinaryRequest& requ
|
||||||
request.dst_addr_ch1 + out_streams[1].size() >
|
request.dst_addr_ch1 + out_streams[1].size() >
|
||||||
Memory::FCRAM_PADDR + Memory::FCRAM_SIZE) {
|
Memory::FCRAM_PADDR + Memory::FCRAM_SIZE) {
|
||||||
LOG_ERROR(Audio_DSP, "Got out of bounds dst_addr_ch1 {:08x}", request.dst_addr_ch1);
|
LOG_ERROR(Audio_DSP, "Got out of bounds dst_addr_ch1 {:08x}", request.dst_addr_ch1);
|
||||||
return {};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
std::memcpy(memory.GetFCRAMPointer(request.dst_addr_ch1 - Memory::FCRAM_PADDR),
|
std::memcpy(memory.GetFCRAMPointer(request.dst_addr_ch1 - Memory::FCRAM_PADDR),
|
||||||
out_streams[1].data(), out_streams[1].size());
|
out_streams[1].data(), out_streams[1].size());
|
||||||
|
|
|
@ -234,7 +234,7 @@ std::optional<u32> MemoryRegionInfo::LinearAllocate(u32 size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// No sufficient block found
|
// No sufficient block found
|
||||||
return {};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryRegionInfo::Free(u32 offset, u32 size) {
|
void MemoryRegionInfo::Free(u32 offset, u32 size) {
|
||||||
|
|
|
@ -928,7 +928,7 @@ std::optional<ProgramResult> DecompileProgram(const Pica::Shader::ProgramCode& p
|
||||||
return {ProgramResult{generator.MoveShaderCode()}};
|
return {ProgramResult{generator.MoveShaderCode()}};
|
||||||
} catch (const DecompileFail& exception) {
|
} catch (const DecompileFail& exception) {
|
||||||
LOG_INFO(HW_GPU, "Shader decompilation failed: {}", exception.what());
|
LOG_INFO(HW_GPU, "Shader decompilation failed: {}", exception.what());
|
||||||
return {};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1651,7 +1651,7 @@ std::optional<ShaderDecompiler::ProgramResult> GenerateVertexShader(
|
||||||
get_output_reg, config.state.sanitize_mul);
|
get_output_reg, config.state.sanitize_mul);
|
||||||
|
|
||||||
if (!program_source_opt)
|
if (!program_source_opt)
|
||||||
return {};
|
return std::nullopt;
|
||||||
|
|
||||||
std::string& program_source = program_source_opt->code;
|
std::string& program_source = program_source_opt->code;
|
||||||
|
|
||||||
|
|
Reference in New Issue