Skip to content

Commit

Permalink
PPU: Fix access violation on logging
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Jun 23, 2024
1 parent 945bfaf commit 03e3aeb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions rpcs3/Emu/Cell/PPUFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ class ppu_function_manager
return addr + index * 8 + (is_code_addr ? 4 : 0);
}

bool is_func(u32 cia, bool is_code_addr = false) const
{
if (cia % 4 || !addr || cia < addr)
{
return false;
}

return (cia - addr) / 8 < access().size();
}

// Allocation address
u32 addr = 0;

Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/Cell/PPUThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2760,7 +2760,7 @@ void ppu_thread::fast_call(u32 addr, u64 rtoc, bool is_thread_entry)

const auto cia = _this->cia;

if (_this->current_function && vm::read32(cia) != ppu_instructions::SC(0))
if (_this->current_function && g_fxo->get<ppu_function_manager>().is_func(cia))
{
return fmt::format("PPU[0x%x] Thread (%s) [HLE:0x%08x, LR:0x%08x]", _this->id, *name_cache.get(), cia, _this->lr);
}
Expand Down

0 comments on commit 03e3aeb

Please sign in to comment.