From 05e24f38f97e2baf5a244e231c5078ede1476a94 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Fri, 1 Jun 2018 15:52:31 +0300 Subject: [PATCH] SPU: use progress dialog --- rpcs3/Emu/Cell/SPURecompiler.cpp | 34 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/rpcs3/Emu/Cell/SPURecompiler.cpp b/rpcs3/Emu/Cell/SPURecompiler.cpp index 9d1ae5f703..f91a3f00ac 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.cpp +++ b/rpcs3/Emu/Cell/SPURecompiler.cpp @@ -15,7 +15,9 @@ #include #include -extern u64 get_system_time(); +extern atomic_t g_progr; +extern atomic_t g_progr_ptotal; +extern atomic_t g_progr_pdone; const spu_decoder s_spu_itype; @@ -130,12 +132,19 @@ void spu_cache::initialize() // Fake LS std::vector> ls(0x10000); - // Used to show progress - u64 timex = get_system_time(); + // Initialize progress dialog + g_progr = "Building SPU cache..."; + g_progr_ptotal += func_list.size(); // Build functions for (auto&& func : func_list) { + if (Emu.IsStopped()) + { + g_progr_pdone++; + continue; + } + // Initialize LS with function data only for (u32 i = 1, pos = func[0]; i < func.size(); i++, pos += 4) { @@ -163,20 +172,13 @@ void spu_cache::initialize() ls[pos / 4] = 0; } - if (Emu.IsStopped()) - { - LOG_ERROR(SPU, "SPU Runtime: Cache building aborted."); - return; - } + g_progr_pdone++; + } - // Print progress every 400 ms - const u64 timed = get_system_time() - timex; - - if (timed >= 400000) - { - LOG_SUCCESS(SPU, "Building SPU cache (%u/%u)...", &func - func_list.data(), func_list.size()); - timex += 400000; - } + if (Emu.IsStopped()) + { + LOG_ERROR(SPU, "SPU Runtime: Cache building aborted."); + return; } LOG_SUCCESS(SPU, "SPU Runtime: Built %u functions.", func_list.size());