Skip to content

Commit

Permalink
PPUAnalyser: fix std::move nonsense
Browse files Browse the repository at this point in the history
  • Loading branch information
Megamouse committed Jun 12, 2023
1 parent 5d7e75c commit a63934c
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions rpcs3/Emu/Cell/PPUAnalyser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,8 +665,8 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
break;
}

const u32 addr = ptr[0];
const u32 _toc = ptr[1];
const u32& addr = ptr[0];
const u32& _toc = ptr[1];

// Rough Table of Contents borders
//const u32 _toc_begin = _toc - 0x8000;
Expand Down Expand Up @@ -695,8 +695,8 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
if (!ptr[0]) ptr += 4;

// Add function and TOC
const u32 addr = ptr[0];
const u32 toc = ptr[1];
const u32& addr = ptr[0];
const u32& toc = ptr[1];
ppu_log.trace("OPD: [0x%x] 0x%x (TOC=0x%x)", ptr, addr, toc);

TOCs.emplace(toc);
Expand Down Expand Up @@ -1008,11 +1008,11 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
add_toc(toc);
add_func(func.addr, toc, 0);
}
else if (new_func.toc - func.toc != toc_add)
{
//func.toc = -1;
//new_func.toc = -1;
}
//else if (new_func.toc - func.toc != toc_add)
//{
// func.toc = -1;
// new_func.toc = -1;
//}

if (new_func.blocks.empty())
{
Expand Down Expand Up @@ -1055,11 +1055,11 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
add_toc(toc);
add_func(func.addr, toc, 0);
}
else if (new_func.toc - func.toc != toc_add)
{
//func.toc = -1;
//new_func.toc = -1;
}
//else if (new_func.toc - func.toc != toc_add)
//{
// func.toc = -1;
// new_func.toc = -1;
//}

if (new_func.blocks.empty())
{
Expand Down Expand Up @@ -1171,7 +1171,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
return false;
};

for (auto& block : func.blocks)
for (const auto& block : func.blocks)
{
if (!block.second && block.first < func_end)
{
Expand Down Expand Up @@ -1472,7 +1472,8 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
{
break;
}
else if (addr == start && op.opcode == ppu_instructions::NOP())

if (addr == start && op.opcode == ppu_instructions::NOP())
{
if (start == func.addr + func.size)
{
Expand All @@ -1483,16 +1484,19 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
start += 4;
continue;
}
else if (type == ppu_itype::SC && op.opcode != ppu_instructions::SC(0))

if (type == ppu_itype::SC && op.opcode != ppu_instructions::SC(0))
{
break;
}
else if (addr == start && op.opcode == ppu_instructions::BLR())

if (addr == start && op.opcode == ppu_instructions::BLR())
{
start += 4;
continue;
}
else if (type == ppu_itype::B || type == ppu_itype::BC)

if (type == ppu_itype::B || type == ppu_itype::BC)
{
const u32 target = (op.aa ? 0 : addr) + (type == ppu_itype::B ? +op.bt24 : +op.bt14);

Expand Down Expand Up @@ -1539,7 +1543,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
end = 0;
}

for (auto&& [_, func] : as_rvalue(std::move(fmap)))
for (auto&& [_, func] : as_rvalue(fmap))
{
if (func.attr & ppu_attr::no_size && entry)
{
Expand All @@ -1560,7 +1564,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
continue;
}

for (auto [addr, size] : func.blocks)
for (const auto& [addr, size] : func.blocks)
{
if (!size)
{
Expand Down Expand Up @@ -1598,7 +1602,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
for (auto& rel : this->relocs)
{
// Disabled (TODO)
if (1 || !vm::check_addr<4>(rel.addr))
//if (!vm::check_addr<4>(rel.addr))
{
continue;
}
Expand Down Expand Up @@ -1722,9 +1726,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
break;
}

const auto found = fmap.find(target);

if (target != i_pos && found == fmap.cend())
if (target != i_pos && !fmap.contains(target))
{
if (block_set.count(target) == 0)
{
Expand Down Expand Up @@ -1782,9 +1784,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
else if (is_good && is_fallback && lim < end)
{
// Register fallback target
const auto found = fmap.find(lim);

if (found == fmap.cend() && block_set.count(lim) == 0)
if (!fmap.contains(lim) && !block_set.contains(lim))
{
ppu_log.trace("Block target found: 0x%x (i_pos=0x%x)", lim, i_pos);
block_queue.emplace_back(lim, 0);
Expand Down

0 comments on commit a63934c

Please sign in to comment.