1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

PPU Analyser: follow fallbacks in some cases

Fallback is an "invisible" branch to the next instruction.
This may be necessary for certain cases when patches are used.
This commit is contained in:
Nekotekina 2021-02-06 19:33:17 +03:00
parent 9e9a55df46
commit 0057c89eaa

View File

@ -1670,6 +1670,7 @@ void ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
u32 i_pos = exp;
bool is_good = true;
bool is_fallback = true;
for (; i_pos < lim; i_pos += 4)
{
@ -1692,6 +1693,11 @@ void ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
case ppu_itype::B:
case ppu_itype::BC:
{
if (type == ppu_itype::B)
{
is_fallback = false;
}
if (type == ppu_itype::B || type == ppu_itype::BC)
{
if (entry == 0 && ppu_opcode_t{opc}.aa)
@ -1767,6 +1773,18 @@ void ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
{
i_pos += 4;
}
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)
{
ppu_log.trace("Block target found: 0x%x (i_pos=0x%x)", lim, i_pos);
block_queue.emplace_back(lim, 0);
block_set.emplace(lim);
}
}
if (is_good)
{