From a626bbf63578fa9141a04ef029d26433bb2e7f94 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sat, 22 Apr 2017 16:00:23 +0300 Subject: [PATCH] PPU Debug fix --- rpcs3/Emu/Cell/PPUThread.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 3d35a054cd..b7e9a4f4a4 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -137,12 +137,12 @@ static bool ppu_fallback(ppu_thread& ppu, ppu_opcode_t op) return false; } -static std::unordered_map s_ppu_toc; +static std::unordered_map* s_ppu_toc; static bool ppu_check_toc(ppu_thread& ppu, ppu_opcode_t op) { // Compare TOC with expected value - const auto found = s_ppu_toc.find(ppu.cia); + const auto found = s_ppu_toc->find(ppu.cia); if (ppu.gpr[2] != found->second) { @@ -878,19 +878,29 @@ extern void ppu_initialize() } } - idm::select([](u32, lv2_prx& prx) + std::vector prx_list; + + idm::select([&](u32, lv2_prx& prx) + { + prx_list.emplace_back(&prx); + }); + + for (auto ptr : prx_list) { if (!Emu.IsStopped()) { - ppu_initialize(prx); + ppu_initialize(*ptr); } - }); + } } extern void ppu_initialize(const ppu_module& info) { if (g_cfg_ppu_decoder.get() != ppu_decoder_type::llvm) { + // Temporarily + s_ppu_toc = fxm::get_always>().get(); + for (const auto& func : info.funcs) { for (auto& block : func.blocks) @@ -900,7 +910,7 @@ extern void ppu_initialize(const ppu_module& info) if (g_cfg_ppu_debug && func.size && func.toc != -1) { - s_ppu_toc.emplace(func.addr, func.toc); + s_ppu_toc->emplace(func.addr, func.toc); ppu_ref(func.addr) = ::narrow(reinterpret_cast(&ppu_check_toc)); } }