mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-08-21 11:13:22 +02:00
service/acc: Early return in failure case in LoadImage()
Allows unindenting the other branch's code.
This commit is contained in:
parent
77e705a8fa
commit
3ec90dc6ef
@ -104,20 +104,20 @@ private:
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
const FileUtil::IOFile image(GetImagePath(user_id), "rb");
|
const FileUtil::IOFile image(GetImagePath(user_id), "rb");
|
||||||
|
|
||||||
if (!image.IsOpen()) {
|
if (!image.IsOpen()) {
|
||||||
LOG_WARNING(Service_ACC,
|
LOG_WARNING(Service_ACC,
|
||||||
"Failed to load user provided image! Falling back to built-in backup...");
|
"Failed to load user provided image! Falling back to built-in backup...");
|
||||||
ctx.WriteBuffer(backup_jpeg);
|
ctx.WriteBuffer(backup_jpeg);
|
||||||
rb.Push<u32>(backup_jpeg_size);
|
rb.Push<u32>(backup_jpeg_size);
|
||||||
} else {
|
return;
|
||||||
const auto size = std::min<u32>(image.GetSize(), MAX_JPEG_IMAGE_SIZE);
|
|
||||||
std::vector<u8> buffer(size);
|
|
||||||
image.ReadBytes(buffer.data(), buffer.size());
|
|
||||||
|
|
||||||
ctx.WriteBuffer(buffer.data(), buffer.size());
|
|
||||||
rb.Push<u32>(buffer.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto size = std::min<u32>(image.GetSize(), MAX_JPEG_IMAGE_SIZE);
|
||||||
|
std::vector<u8> buffer(size);
|
||||||
|
image.ReadBytes(buffer.data(), buffer.size());
|
||||||
|
|
||||||
|
ctx.WriteBuffer(buffer.data(), buffer.size());
|
||||||
|
rb.Push<u32>(buffer.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetImageSize(Kernel::HLERequestContext& ctx) {
|
void GetImageSize(Kernel::HLERequestContext& ctx) {
|
||||||
|
Loading…
Reference in New Issue
Block a user