SPU: use progress dialog

This commit is contained in:
Nekotekina 2018-06-01 15:52:31 +03:00
parent ea1bb3b90e
commit 05e24f38f9

View file

@ -15,7 +15,9 @@
#include <mutex> #include <mutex>
#include <thread> #include <thread>
extern u64 get_system_time(); extern atomic_t<const char*> g_progr;
extern atomic_t<u64> g_progr_ptotal;
extern atomic_t<u64> g_progr_pdone;
const spu_decoder<spu_itype> s_spu_itype; const spu_decoder<spu_itype> s_spu_itype;
@ -130,12 +132,19 @@ void spu_cache::initialize()
// Fake LS // Fake LS
std::vector<be_t<u32>> ls(0x10000); std::vector<be_t<u32>> ls(0x10000);
// Used to show progress // Initialize progress dialog
u64 timex = get_system_time(); g_progr = "Building SPU cache...";
g_progr_ptotal += func_list.size();
// Build functions // Build functions
for (auto&& func : func_list) for (auto&& func : func_list)
{ {
if (Emu.IsStopped())
{
g_progr_pdone++;
continue;
}
// Initialize LS with function data only // Initialize LS with function data only
for (u32 i = 1, pos = func[0]; i < func.size(); i++, pos += 4) for (u32 i = 1, pos = func[0]; i < func.size(); i++, pos += 4)
{ {
@ -163,22 +172,15 @@ void spu_cache::initialize()
ls[pos / 4] = 0; ls[pos / 4] = 0;
} }
g_progr_pdone++;
}
if (Emu.IsStopped()) if (Emu.IsStopped())
{ {
LOG_ERROR(SPU, "SPU Runtime: Cache building aborted."); LOG_ERROR(SPU, "SPU Runtime: Cache building aborted.");
return; return;
} }
// 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;
}
}
LOG_SUCCESS(SPU, "SPU Runtime: Built %u functions.", func_list.size()); LOG_SUCCESS(SPU, "SPU Runtime: Built %u functions.", func_list.size());
} }