Adressed feedback

This commit is contained in:
Frederic Laing
2018-10-25 19:36:53 +02:00
parent b9e209caa8
commit 32c87bf173
14 changed files with 89 additions and 100 deletions

View File

@@ -362,11 +362,11 @@ std::optional<std::pair<Key128, Key128>> ParseTicket(const TicketRaw& ticket,
m_2 = m_2 ^ MGF1<0xDF>(m_1);
const auto offset = FindTicketOffset(m_2);
if (offset)
if (!offset)
return {};
ASSERT(offset.value() > 0);
ASSERT(*offset > 0);
std::memcpy(key_temp.data(), m_2.data() + offset.value(), key_temp.size());
std::memcpy(key_temp.data(), m_2.data() + *offset, key_temp.size());
return std::make_pair(rights_id, key_temp);
}
@@ -661,8 +661,8 @@ void KeyManager::DeriveSDSeedLazy() {
return;
const auto res = DeriveSDSeed();
if (res != std::nullopt)
SetKey(S128KeyType::SDSeed, res.value());
if (res)
SetKey(S128KeyType::SDSeed, *res);
}
static Key128 CalculateCMAC(const u8* source, size_t size, const Key128& key) {
@@ -889,9 +889,9 @@ void KeyManager::DeriveETicket(PartitionDataManager& data) {
for (const auto& raw : res) {
const auto pair = ParseTicket(raw, rsa_key);
if (pair)
if (!pair)
continue;
const auto& [rid, key] = pair.value();
const auto& [rid, key] = *pair;
u128 rights_id;
std::memcpy(rights_id.data(), rid.data(), rid.size());
SetKey(S128KeyType::Titlekey, key, rights_id[1], rights_id[0]);

View File

@@ -310,13 +310,13 @@ bool NCA::ReadRomFSSection(const NCASectionHeader& section, const NCASectionTabl
if (has_rights_id) {
status = Loader::ResultStatus::Success;
key = GetTitlekey();
if (key) {
if (!key) {
status = Loader::ResultStatus::ErrorMissingTitlekey;
return false;
}
} else {
key = GetKeyAreaKey(NCASectionCryptoType::BKTR);
if (key) {
if (!key) {
status = Loader::ResultStatus::ErrorMissingKeyAreaKey;
return false;
}
@@ -331,7 +331,7 @@ bool NCA::ReadRomFSSection(const NCASectionHeader& section, const NCASectionTabl
auto bktr = std::make_shared<BKTR>(
bktr_base_romfs, std::make_shared<OffsetVfsFile>(file, romfs_size, base_offset),
relocation_block, relocation_buckets, subsection_block, subsection_buckets, encrypted,
encrypted ? key.value() : Core::Crypto::Key128{}, base_offset, bktr_base_ivfc_offset,
encrypted ? *key : Core::Crypto::Key128{}, base_offset, bktr_base_ivfc_offset,
section.raw.section_ctr);
// BKTR applies to entire IVFC, so make an offset version to level 6
@@ -461,14 +461,14 @@ VirtualFile NCA::Decrypt(const NCASectionHeader& s_header, VirtualFile in, u64 s
if (has_rights_id) {
status = Loader::ResultStatus::Success;
key = GetTitlekey();
if (key) {
if (!key) {
if (status == Loader::ResultStatus::Success)
status = Loader::ResultStatus::ErrorMissingTitlekey;
return nullptr;
}
} else {
key = GetKeyAreaKey(NCASectionCryptoType::CTR);
if (key) {
if (!key) {
status = Loader::ResultStatus::ErrorMissingKeyAreaKey;
return nullptr;
}

View File

@@ -103,12 +103,12 @@ VirtualFile PatchIPS(const VirtualFile& in, const VirtualFile& ips) {
offset += sizeof(u16);
const auto data = ips->ReadByte(offset++);
if (data)
if (!data)
return nullptr;
if (real_offset + rle_size > in_data.size())
rle_size = static_cast<u16>(in_data.size() - real_offset);
std::memset(in_data.data() + real_offset, data.value(), rle_size);
std::memset(in_data.data() + real_offset, *data, rle_size);
} else { // Standard Patch
auto read = data_size;
if (real_offset + read > in_data.size())

View File

@@ -280,12 +280,12 @@ std::map<std::string, std::string, std::less<>> PatchManager::GetPatchVersionNam
} else {
if (installed->HasEntry(update_tid, ContentRecordType::Program)) {
const auto meta_ver = installed->GetEntryVersion(update_tid);
if (meta_ver || meta_ver.value() == 0) {
if (meta_ver.value_or(0) == 0) {
out.insert_or_assign("Update", "");
} else {
out.insert_or_assign(
"Update",
FormatTitleVersion(meta_ver.value(), TitleVersionFormat::ThreeElements));
FormatTitleVersion(*meta_ver, TitleVersionFormat::ThreeElements));
}
} else if (update_raw != nullptr) {
out.insert_or_assign("Update", "PACKED");

View File

@@ -180,7 +180,7 @@ std::optional<NcaID> RegisteredCache::GetNcaIDFromMetadata(u64 title_id,
return meta_id.at(title_id);
const auto res1 = CheckMapForContentRecord(yuzu_meta, title_id, type);
if (res1 != std::nullopt)
if (res1)
return res1;
return CheckMapForContentRecord(meta, title_id, type);
}
@@ -283,10 +283,7 @@ bool RegisteredCache::HasEntry(RegisteredCacheEntry entry) const {
VirtualFile RegisteredCache::GetEntryUnparsed(u64 title_id, ContentRecordType type) const {
const auto id = GetNcaIDFromMetadata(title_id, type);
if (id)
return nullptr;
return GetFileAtID(id.value());
return id ? GetFileAtID(*id) : nullptr;
}
VirtualFile RegisteredCache::GetEntryUnparsed(RegisteredCacheEntry entry) const {
@@ -307,10 +304,7 @@ std::optional<u32> RegisteredCache::GetEntryVersion(u64 title_id) const {
VirtualFile RegisteredCache::GetEntryRaw(u64 title_id, ContentRecordType type) const {
const auto id = GetNcaIDFromMetadata(title_id, type);
if (id)
return nullptr;
return parser(GetFileAtID(id.value()), id.value());
return id ? parser(GetFileAtID(*id), *id) : nullptr;
}
VirtualFile RegisteredCache::GetEntryRaw(RegisteredCacheEntry entry) const {
@@ -373,11 +367,11 @@ std::vector<RegisteredCacheEntry> RegisteredCache::ListEntriesFilter(
return RegisteredCacheEntry{c.GetTitleID(), r.type};
},
[&title_type, &record_type, &title_id](const CNMT& c, const ContentRecord& r) {
if (title_type != std::nullopt && title_type.value() != c.GetType())
if (title_type && *title_type != c.GetType())
return false;
if (record_type != std::nullopt && record_type.value() != r.type)
if (record_type && *record_type != r.type)
return false;
if (title_id != std::nullopt && title_id.value() != c.GetTitleID())
if (title_id && *title_id != c.GetTitleID())
return false;
return true;
});
@@ -469,11 +463,11 @@ InstallResult RegisteredCache::RawInstallNCA(std::shared_ptr<NCA> nca, const Vfs
// Also, for XCIs the NcaID matters, so if the override id isn't none, use that.
NcaID id{};
if (override_id) {
id = *override_id;
} else {
const auto& data = in->ReadBytes(0x100000);
mbedtls_sha256(data.data(), data.size(), hash.data(), 0);
memcpy(id.data(), hash.data(), 16);
} else {
id = override_id.value();
}
std::string path = GetRelativePathFromNcaID(id, false, true);
@@ -546,7 +540,7 @@ bool RegisteredCacheUnion::HasEntry(RegisteredCacheEntry entry) const {
std::optional<u32> RegisteredCacheUnion::GetEntryVersion(u64 title_id) const {
for (const auto& c : caches) {
const auto res = c->GetEntryVersion(title_id);
if (res != std::nullopt)
if (res)
return res;
}
@@ -619,11 +613,11 @@ std::vector<RegisteredCacheEntry> RegisteredCacheUnion::ListEntriesFilter(
return RegisteredCacheEntry{c.GetTitleID(), r.type};
},
[&title_type, &record_type, &title_id](const CNMT& c, const ContentRecord& r) {
if (title_type != std::nullopt && title_type.value() != c.GetType())
if (title_type && *title_type != c.GetType())
return false;
if (record_type != std::nullopt && record_type.value() != r.type)
if (record_type && *record_type != r.type)
return false;
if (title_id != std::nullopt && title_id.value() != c.GetTitleID())
if (title_id && *title_id != c.GetTitleID())
return false;
return true;
});

View File

@@ -195,7 +195,7 @@ std::size_t ProfileManager::GetOpenUserCount() const {
/// Checks if a user id exists in our profile manager
bool ProfileManager::UserExists(UUID uuid) const {
return GetUserIndex(uuid) != std::nullopt;
return GetUserIndex(uuid).has_value();
}
bool ProfileManager::UserExistsIndex(std::size_t index) const {

View File

@@ -743,7 +743,7 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
Account::ProfileManager profile_manager{};
const auto uuid = profile_manager.GetUser(Settings::values.current_user);
ASSERT(uuid != std::nullopt);
ASSERT(uuid);
params.current_user = uuid->uuid;
IPC::ResponseBuilder rb{ctx, 2, 0, 1};

View File

@@ -134,7 +134,7 @@ void NVFlinger::Compose() {
MicroProfileFlip();
if (buffer) {
if (!buffer) {
auto& system_instance = Core::System::GetInstance();
// There was no queued buffer to draw, render previous frame
@@ -143,7 +143,7 @@ void NVFlinger::Compose() {
continue;
}
auto& igbp_buffer = buffer.value().get().igbp_buffer;
auto& igbp_buffer = buffer->get().igbp_buffer;
// Now send the buffer to the GPU for drawing.
// TODO(Subv): Support more than just disp0. The display device selection is probably based
@@ -153,9 +153,9 @@ void NVFlinger::Compose() {
nvdisp->flip(igbp_buffer.gpu_buffer_id, igbp_buffer.offset, igbp_buffer.format,
igbp_buffer.width, igbp_buffer.height, igbp_buffer.stride,
buffer.value().get().transform, buffer.value().get().crop_rect);
buffer->get().transform, buffer->get().crop_rect);
buffer_queue->ReleaseBuffer(buffer.value().get().slot);
buffer_queue->ReleaseBuffer(buffer->get().slot);
}
}

View File

@@ -509,7 +509,7 @@ private:
const u32 height{request.data.height};
std::optional<u32> slot = buffer_queue->DequeueBuffer(width, height);
if (slot != std::nullopt) {
if (slot) {
// Buffer is available
IGBPDequeueBufferResponseParcel response{*slot};
ctx.WriteBuffer(response.Serialize());

View File

@@ -44,7 +44,7 @@ bool MacroInterpreter::Step(const std::vector<u32>& code, bool is_delay_slot) {
pc += 4;
// Update the program counter if we were delayed
if (delayed_pc != std::nullopt) {
if (delayed_pc) {
ASSERT(is_delay_slot);
pc = *delayed_pc;
delayed_pc = {};

View File

@@ -144,7 +144,7 @@ private:
for (u32 offset = begin; offset != end && offset != PROGRAM_END; ++offset) {
const Instruction instr = {program_code[offset]};
if (const auto opcode = OpCode::Decode(instr)) {
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::EXIT: {
// The EXIT instruction can be predicated, which means that the shader can
// conditionally end on this instruction. We have to consider the case where the
@@ -1464,8 +1464,8 @@ private:
return offset + 1;
}
shader.AddLine(fmt::format("// {}: {} (0x{:016x})", offset, opcode.value().get().GetName(),
instr.value));
shader.AddLine(
fmt::format("// {}: {} (0x{:016x})", offset, opcode->get().GetName(), instr.value));
using Tegra::Shader::Pred;
ASSERT_MSG(instr.pred.full_pred != Pred::NeverExecute,
@@ -1473,7 +1473,7 @@ private:
// Some instructions (like SSY) don't have a predicate field, they are always
// unconditionally executed.
bool can_be_predicated = OpCode::IsPredicatedInstruction(opcode.value().get().GetId());
bool can_be_predicated = OpCode::IsPredicatedInstruction(opcode->get().GetId());
if (can_be_predicated && instr.pred.pred_index != static_cast<u64>(Pred::UnusedIndex)) {
shader.AddLine("if (" +
@@ -1483,7 +1483,7 @@ private:
++shader.scope;
}
switch (opcode.value().get().GetType()) {
switch (opcode->get().GetType()) {
case OpCode::Type::Arithmetic: {
std::string op_a = regs.GetRegisterAsFloat(instr.gpr8);
@@ -1500,7 +1500,7 @@ private:
}
}
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::MOV_C:
case OpCode::Id::MOV_R: {
// MOV does not have neither 'abs' nor 'neg' bits.
@@ -1601,14 +1601,14 @@ private:
}
default: {
LOG_CRITICAL(HW_GPU, "Unhandled arithmetic instruction: {}",
opcode.value().get().GetName());
opcode->get().GetName());
UNREACHABLE();
}
}
break;
}
case OpCode::Type::ArithmeticImmediate: {
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::MOV32_IMM: {
regs.SetRegisterToFloat(instr.gpr0, 0, GetImmediate32(instr), 1, 1);
break;
@@ -1652,7 +1652,7 @@ private:
std::string op_a = instr.bfe.negate_a ? "-" : "";
op_a += regs.GetRegisterAsInteger(instr.gpr8);
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::BFE_IMM: {
std::string inner_shift =
'(' + op_a + " << " + std::to_string(instr.bfe.GetLeftShiftValue()) + ')';
@@ -1664,8 +1664,7 @@ private:
break;
}
default: {
LOG_CRITICAL(HW_GPU, "Unhandled BFE instruction: {}",
opcode.value().get().GetName());
LOG_CRITICAL(HW_GPU, "Unhandled BFE instruction: {}", opcode->get().GetName());
UNREACHABLE();
}
}
@@ -1687,7 +1686,7 @@ private:
}
}
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::SHR_C:
case OpCode::Id::SHR_R:
case OpCode::Id::SHR_IMM: {
@@ -1707,8 +1706,7 @@ private:
regs.SetRegisterToInteger(instr.gpr0, true, 0, op_a + " << " + op_b, 1, 1);
break;
default: {
LOG_CRITICAL(HW_GPU, "Unhandled shift instruction: {}",
opcode.value().get().GetName());
LOG_CRITICAL(HW_GPU, "Unhandled shift instruction: {}", opcode->get().GetName());
UNREACHABLE();
}
}
@@ -1718,7 +1716,7 @@ private:
std::string op_a = regs.GetRegisterAsInteger(instr.gpr8);
std::string op_b = std::to_string(instr.alu.imm20_32.Value());
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::IADD32I:
if (instr.iadd32i.negate_a)
op_a = "-(" + op_a + ')';
@@ -1740,7 +1738,7 @@ private:
}
default: {
LOG_CRITICAL(HW_GPU, "Unhandled ArithmeticIntegerImmediate instruction: {}",
opcode.value().get().GetName());
opcode->get().GetName());
UNREACHABLE();
}
}
@@ -1760,7 +1758,7 @@ private:
}
}
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::IADD_C:
case OpCode::Id::IADD_R:
case OpCode::Id::IADD_IMM: {
@@ -1796,7 +1794,7 @@ private:
}
};
if (opcode.value().get().GetId() == OpCode::Id::IADD3_R) {
if (opcode->get().GetId() == OpCode::Id::IADD3_R) {
apply_height(instr.iadd3.height_a, op_a);
apply_height(instr.iadd3.height_b, op_b);
apply_height(instr.iadd3.height_c, op_c);
@@ -1812,7 +1810,7 @@ private:
op_c = "-(" + op_c + ')';
std::string result;
if (opcode.value().get().GetId() == OpCode::Id::IADD3_R) {
if (opcode->get().GetId() == OpCode::Id::IADD3_R) {
switch (instr.iadd3.mode) {
case Tegra::Shader::IAdd3Mode::RightShift:
// TODO(tech4me): According to
@@ -1887,7 +1885,7 @@ private:
const std::string op_c = regs.GetRegisterAsInteger(instr.gpr39);
std::string lut;
if (opcode.value().get().GetId() == OpCode::Id::LOP3_R) {
if (opcode->get().GetId() == OpCode::Id::LOP3_R) {
lut = '(' + std::to_string(instr.alu.lop3.GetImmLut28()) + ')';
} else {
lut = '(' + std::to_string(instr.alu.lop3.GetImmLut48()) + ')';
@@ -1917,7 +1915,7 @@ private:
case OpCode::Id::LEA_HI: {
std::string op_c;
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::LEA_R2: {
op_a = regs.GetRegisterAsInteger(instr.gpr20);
op_b = regs.GetRegisterAsInteger(instr.gpr39);
@@ -1963,7 +1961,7 @@ private:
op_a = std::to_string(instr.lea.imm.entry_a);
op_c = std::to_string(instr.lea.imm.entry_b);
LOG_CRITICAL(HW_GPU, "Unhandled LEA subinstruction: {}",
opcode.value().get().GetName());
opcode->get().GetName());
UNREACHABLE();
}
}
@@ -1978,7 +1976,7 @@ private:
}
default: {
LOG_CRITICAL(HW_GPU, "Unhandled ArithmeticInteger instruction: {}",
opcode.value().get().GetName());
opcode->get().GetName());
UNREACHABLE();
}
}
@@ -1986,21 +1984,21 @@ private:
break;
}
case OpCode::Type::ArithmeticHalf: {
if (opcode.value().get().GetId() == OpCode::Id::HADD2_C ||
opcode.value().get().GetId() == OpCode::Id::HADD2_R) {
if (opcode->get().GetId() == OpCode::Id::HADD2_C ||
opcode->get().GetId() == OpCode::Id::HADD2_R) {
ASSERT_MSG(instr.alu_half.ftz == 0, "Unimplemented");
}
const bool negate_a =
opcode.value().get().GetId() != OpCode::Id::HMUL2_R && instr.alu_half.negate_a != 0;
opcode->get().GetId() != OpCode::Id::HMUL2_R && instr.alu_half.negate_a != 0;
const bool negate_b =
opcode.value().get().GetId() != OpCode::Id::HMUL2_C && instr.alu_half.negate_b != 0;
opcode->get().GetId() != OpCode::Id::HMUL2_C && instr.alu_half.negate_b != 0;
const std::string op_a =
GetHalfFloat(regs.GetRegisterAsInteger(instr.gpr8, 0, false), instr.alu_half.type_a,
instr.alu_half.abs_a != 0, negate_a);
std::string op_b;
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::HADD2_C:
case OpCode::Id::HMUL2_C:
op_b = regs.GetUniform(instr.cbuf34.index, instr.cbuf34.offset,
@@ -2018,7 +2016,7 @@ private:
op_b = GetHalfFloat(op_b, instr.alu_half.type_b, instr.alu_half.abs_b != 0, negate_b);
const std::string result = [&]() {
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::HADD2_C:
case OpCode::Id::HADD2_R:
return '(' + op_a + " + " + op_b + ')';
@@ -2027,7 +2025,7 @@ private:
return '(' + op_a + " * " + op_b + ')';
default:
LOG_CRITICAL(HW_GPU, "Unhandled half float instruction: {}",
opcode.value().get().GetName());
opcode->get().GetName());
UNREACHABLE();
return std::string("0");
}
@@ -2038,7 +2036,7 @@ private:
break;
}
case OpCode::Type::ArithmeticHalfImmediate: {
if (opcode.value().get().GetId() == OpCode::Id::HADD2_IMM) {
if (opcode->get().GetId() == OpCode::Id::HADD2_IMM) {
ASSERT_MSG(instr.alu_half_imm.ftz == 0, "Unimplemented");
} else {
ASSERT_MSG(instr.alu_half_imm.precision == Tegra::Shader::HalfPrecision::None,
@@ -2052,7 +2050,7 @@ private:
const std::string op_b = UnpackHalfImmediate(instr, true);
const std::string result = [&]() {
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::HADD2_IMM:
return op_a + " + " + op_b;
case OpCode::Id::HMUL2_IMM:
@@ -2078,7 +2076,7 @@ private:
ASSERT_MSG(instr.ffma.tab5980_1 == 0, "FFMA tab5980_1({}) not implemented",
instr.ffma.tab5980_1.Value());
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::FFMA_CR: {
op_b += regs.GetUniform(instr.cbuf34.index, instr.cbuf34.offset,
GLSLRegister::Type::Float);
@@ -2102,8 +2100,7 @@ private:
break;
}
default: {
LOG_CRITICAL(HW_GPU, "Unhandled FFMA instruction: {}",
opcode.value().get().GetName());
LOG_CRITICAL(HW_GPU, "Unhandled FFMA instruction: {}", opcode->get().GetName());
UNREACHABLE();
}
}
@@ -2114,14 +2111,14 @@ private:
break;
}
case OpCode::Type::Hfma2: {
if (opcode.value().get().GetId() == OpCode::Id::HFMA2_RR) {
if (opcode->get().GetId() == OpCode::Id::HFMA2_RR) {
ASSERT_MSG(instr.hfma2.rr.precision == Tegra::Shader::HalfPrecision::None,
"Unimplemented");
} else {
ASSERT_MSG(instr.hfma2.precision == Tegra::Shader::HalfPrecision::None,
"Unimplemented");
}
const bool saturate = opcode.value().get().GetId() == OpCode::Id::HFMA2_RR
const bool saturate = opcode->get().GetId() == OpCode::Id::HFMA2_RR
? instr.hfma2.rr.saturate != 0
: instr.hfma2.saturate != 0;
@@ -2129,7 +2126,7 @@ private:
GetHalfFloat(regs.GetRegisterAsInteger(instr.gpr8, 0, false), instr.hfma2.type_a);
std::string op_b, op_c;
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::HFMA2_CR:
op_b = GetHalfFloat(regs.GetUniform(instr.cbuf34.index, instr.cbuf34.offset,
GLSLRegister::Type::UnsignedInteger),
@@ -2167,7 +2164,7 @@ private:
break;
}
case OpCode::Type::Conversion: {
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::I2I_R: {
ASSERT_MSG(!instr.conversion.selector, "Unimplemented");
@@ -2306,14 +2303,14 @@ private:
}
default: {
LOG_CRITICAL(HW_GPU, "Unhandled conversion instruction: {}",
opcode.value().get().GetName());
opcode->get().GetName());
UNREACHABLE();
}
}
break;
}
case OpCode::Type::Memory: {
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::LD_A: {
// Note: Shouldn't this be interp mode flat? As in no interpolation made.
ASSERT_MSG(instr.gpr8.Value() == Register::ZeroIndex,
@@ -2957,8 +2954,7 @@ private:
break;
}
default: {
LOG_CRITICAL(HW_GPU, "Unhandled memory instruction: {}",
opcode.value().get().GetName());
LOG_CRITICAL(HW_GPU, "Unhandled memory instruction: {}", opcode->get().GetName());
UNREACHABLE();
}
}
@@ -3052,7 +3048,7 @@ private:
instr.hsetp2.abs_a, instr.hsetp2.negate_a);
const std::string op_b = [&]() {
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::HSETP2_R:
return GetHalfFloat(regs.GetRegisterAsInteger(instr.gpr20, 0, false),
instr.hsetp2.type_b, instr.hsetp2.abs_a,
@@ -3114,7 +3110,7 @@ private:
break;
}
case OpCode::Type::PredicateSetPredicate: {
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::PSETP: {
const std::string op_a =
GetPredicateCondition(instr.psetp.pred12, instr.psetp.neg_pred12 != 0);
@@ -3161,7 +3157,7 @@ private:
}
default: {
LOG_CRITICAL(HW_GPU, "Unhandled predicate instruction: {}",
opcode.value().get().GetName());
opcode->get().GetName());
UNREACHABLE();
}
}
@@ -3249,7 +3245,7 @@ private:
instr.hset2.abs_a != 0, instr.hset2.negate_a != 0);
const std::string op_b = [&]() {
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::HSET2_R:
return GetHalfFloat(regs.GetRegisterAsInteger(instr.gpr20, 0, false),
instr.hset2.type_b, instr.hset2.abs_b != 0,
@@ -3298,7 +3294,7 @@ private:
const bool is_signed{instr.xmad.sign_a == 1};
bool is_merge{};
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::XMAD_CR: {
is_merge = instr.xmad.merge_56;
op_b += regs.GetUniform(instr.cbuf34.index, instr.cbuf34.offset,
@@ -3327,8 +3323,7 @@ private:
break;
}
default: {
LOG_CRITICAL(HW_GPU, "Unhandled XMAD instruction: {}",
opcode.value().get().GetName());
LOG_CRITICAL(HW_GPU, "Unhandled XMAD instruction: {}", opcode->get().GetName());
UNREACHABLE();
}
}
@@ -3380,7 +3375,7 @@ private:
break;
}
default: {
switch (opcode.value().get().GetId()) {
switch (opcode->get().GetId()) {
case OpCode::Id::EXIT: {
if (stage == Maxwell3D::Regs::ShaderStage::Fragment) {
EmitFragmentOutputsWrite();
@@ -3575,7 +3570,7 @@ private:
break;
}
default: {
LOG_CRITICAL(HW_GPU, "Unhandled instruction: {}", opcode.value().get().GetName());
LOG_CRITICAL(HW_GPU, "Unhandled instruction: {}", opcode->get().GetName());
UNREACHABLE();
}
}

View File

@@ -125,7 +125,7 @@ void RendererOpenGL::SwapBuffers(
OpenGLState prev_state = OpenGLState::GetCurState();
state.Apply();
if (framebuffer != std::nullopt) {
if (framebuffer) {
// If framebuffer is provided, reload it from memory to a texture
if (screen_info.texture.width != (GLsizei)framebuffer.value().get().width ||
screen_info.texture.height != (GLsizei)framebuffer.value().get().height ||

View File

@@ -173,7 +173,7 @@ void ConfigureSystem::UpdateCurrentUser() {
ui->pm_add->setEnabled(profile_manager->GetUserCount() < Service::Account::MAX_USERS);
const auto& current_user = profile_manager->GetUser(Settings::values.current_user);
ASSERT(current_user != std::nullopt);
ASSERT(current_user);
const auto username = GetAccountUsername(*profile_manager, *current_user);
scene->clear();
@@ -261,7 +261,7 @@ void ConfigureSystem::AddUser() {
void ConfigureSystem::RenameUser() {
const auto user = tree_view->currentIndex().row();
const auto uuid = profile_manager->GetUser(user);
ASSERT(uuid != std::nullopt);
ASSERT(uuid);
Service::Account::ProfileBase profile;
if (!profile_manager->GetProfileBase(*uuid, profile))
@@ -297,7 +297,7 @@ void ConfigureSystem::RenameUser() {
void ConfigureSystem::DeleteUser() {
const auto index = tree_view->currentIndex().row();
const auto uuid = profile_manager->GetUser(index);
ASSERT(uuid != std::nullopt);
ASSERT(uuid);
const auto username = GetAccountUsername(*profile_manager, *uuid);
const auto confirm = QMessageBox::question(
@@ -324,7 +324,7 @@ void ConfigureSystem::DeleteUser() {
void ConfigureSystem::SetUserImage() {
const auto index = tree_view->currentIndex().row();
const auto uuid = profile_manager->GetUser(index);
ASSERT(uuid != std::nullopt);
ASSERT(uuid);
const auto file = QFileDialog::getOpenFileName(this, tr("Select User Image"), QString(),
tr("JPEG Images (*.jpg *.jpeg)"));

View File

@@ -786,7 +786,7 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
ASSERT(index != -1 && index < 8);
const auto user_id = manager.GetUser(index);
ASSERT(user_id != std::nullopt);
ASSERT(user_id);
path = nand_dir + FileSys::SaveDataFactory::GetFullPath(FileSys::SaveDataSpaceId::NandUser,
FileSys::SaveDataType::SaveData,
program_id, user_id->uuid, 0);