1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

SPU Interpreter2 initialization fix

This commit is contained in:
Nekotekina 2015-04-26 01:56:58 +03:00
parent 9cfdce91a1
commit ff359ed118

View File

@ -26,11 +26,17 @@ const g_spu_imm_table_t g_spu_imm;
class spu_inter_func_list_t class spu_inter_func_list_t
{ {
std::array<spu_inter_func_t, 2048> funcs; std::array<spu_inter_func_t, 2048> funcs = {};
std::mutex m_mutex;
public: public:
spu_inter_func_list_t() void initialize()
{ {
std::lock_guard<std::mutex> lock(m_mutex);
if (funcs[0]) return; // check if already initialized
auto inter = new SPUInterpreter2; auto inter = new SPUInterpreter2;
SPUDecoder dec(*inter); SPUDecoder dec(*inter);
@ -49,7 +55,7 @@ public:
return funcs[opcode >> 21]; return funcs[opcode >> 21];
} }
} }
const g_spu_inter_func_list; g_spu_inter_func_list;
SPUThread& GetCurrentSPUThread() SPUThread& GetCurrentSPUThread()
{ {
@ -189,6 +195,7 @@ void SPUThread::DoRun()
case 1: // alternative interpreter case 1: // alternative interpreter
{ {
g_spu_inter_func_list.initialize(); // initialize helper table
break; break;
} }