diff --git a/rpcs3/Emu/SysCalls/SyncPrimitivesManager.h b/rpcs3/Emu/SysCalls/SyncPrimitivesManager.h index 07293bbd96..f4360ae4d2 100644 --- a/rpcs3/Emu/SysCalls/SyncPrimitivesManager.h +++ b/rpcs3/Emu/SysCalls/SyncPrimitivesManager.h @@ -12,7 +12,7 @@ struct SemaphoreAttributes u32 max_count; SemaphoreAttributes() {} - SemaphoreAttributes(const std::string& _name, u32 _count, u32 _max_count) : name(_name), count(_count), max_count(_max_count) {} + SemaphoreAttributes(const std::string& _name, const u32 _count, const u32 _max_count) : name(_name), count(_count), max_count(_max_count) {} }; struct LwMutexAttributes @@ -22,13 +22,15 @@ struct LwMutexAttributes std::string status; // TODO: check status? LwMutexAttributes() {} - LwMutexAttributes(const std::string& _name, u32 _owner_id, std::string _status = "INITIALIZED") + LwMutexAttributes(const std::string& _name, const u32 _owner_id, const std::string& _status = "INITIALIZED") : name(_name), owner_id(_owner_id), status(_status) {} }; class SyncPrimManager { private: + std::mutex m_mutex; + std::map m_cond_name; std::map m_mutex_name; std::map m_lw_cond_name; @@ -40,66 +42,78 @@ public: // semaphores void AddSemaphoreData(const u32 id, const std::string& name, const u32 count, const u32 max_count) { + std::lock_guard lock(m_mutex); m_semaph_attr[id] = *(new SemaphoreAttributes(name, count, max_count)); } void EraseSemaphoreData(const u32 id) { + std::lock_guard lock(m_mutex); m_semaph_attr.erase(id); } SemaphoreAttributes& GetSemaphoreData(const u32 id) { + std::lock_guard lock(m_mutex); return m_semaph_attr[id]; } // lw_mutexes void AddLwMutexData(const u32 id, const std::string& name, const u32 owner_id) { + std::lock_guard lock(m_mutex); m_lw_mutex_attr[id] = *(new LwMutexAttributes(name, owner_id)); } void EraseLwMutexData(const u32 id) { + std::lock_guard lock(m_mutex); m_lw_mutex_attr.erase(id); } LwMutexAttributes& GetLwMutexData(const u32 id) { + std::lock_guard lock(m_mutex); return m_lw_mutex_attr[id]; } // lw_conditions, mutexes, conditions void AddSyncPrimData(const IDType type, const u32 id, const std::string& name) { + std::lock_guard lock(m_mutex); switch (type) { case TYPE_LWCOND: m_lw_cond_name[id] = name; break; case TYPE_MUTEX: m_mutex_name[id] = name; break; case TYPE_COND: m_cond_name[id] = name; break; + default: LOG_ERROR(GENERAL, "Unknown IDType = %d", type); break; } } void EraseSyncPrimData(const IDType type, const u32 id) { + std::lock_guard lock(m_mutex); switch (type) { case TYPE_LWCOND: m_lw_cond_name.erase(id); break; case TYPE_MUTEX: m_mutex_name.erase(id); break; case TYPE_COND: m_cond_name.erase(id); break; - default: LOG_ERROR(GENERAL, "Unknown IDType = %d", type); + default: LOG_ERROR(GENERAL, "Unknown IDType = %d", type); break; } } - std::string& GetSyncPrimName(const IDType type, const u32 id) + std::string GetSyncPrimName(const IDType type, const u32 id) { + std::lock_guard lock(m_mutex); switch (type) { case TYPE_LWCOND: return m_lw_cond_name[id]; case TYPE_MUTEX: return m_mutex_name[id]; case TYPE_COND: return m_cond_name[id]; + + default: return fmt::Format("Unknown IDType = %d", type); } } diff --git a/rpcs3/Gui/KernelExplorer.cpp b/rpcs3/Gui/KernelExplorer.cpp index 64e84e36df..4cec3d2620 100644 --- a/rpcs3/Gui/KernelExplorer.cpp +++ b/rpcs3/Gui/KernelExplorer.cpp @@ -118,7 +118,6 @@ void KernelExplorer::Update() const auto& node = m_tree->AppendItem(root, name); const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_LWCOND); - u32 index = 0; for (const auto& id : objects) { sprintf(name, "LW Condition Variable: ID = 0x%08x '%s'", id, Emu.GetSyncPrimManager().GetSyncPrimName(TYPE_LWCOND, id).c_str()); diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index fc47323a4f..cf2a15e599 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -332,7 +332,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) } wxDialog diag(this, wxID_ANY, "Settings", wxDefaultPosition); - static const u32 width = 425; + static const u32 width = 385; static const u32 height = 400; // Settings panels @@ -341,14 +341,12 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) wxPanel* p_cpu = new wxPanel(nb_config, wxID_ANY); wxPanel* p_graphics = new wxPanel(nb_config, wxID_ANY); wxPanel* p_audio = new wxPanel(nb_config, wxID_ANY); - wxPanel* p_camera = new wxPanel(nb_config, wxID_ANY); wxPanel* p_io = new wxPanel(nb_config, wxID_ANY); wxPanel* p_hle = new wxPanel(nb_config, wxID_ANY); nb_config->AddPage(p_cpu, wxT("Core")); nb_config->AddPage(p_graphics, wxT("Graphics")); nb_config->AddPage(p_audio, wxT("Audio")); - nb_config->AddPage(p_camera, wxT("Camera")); nb_config->AddPage(p_io, wxT("Input / Output")); nb_config->AddPage(p_hle, wxT("HLE / Misc.")); nb_config->AddPage(p_system, wxT("System")); @@ -357,7 +355,6 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) wxBoxSizer* s_subpanel_cpu = new wxBoxSizer(wxVERTICAL); wxBoxSizer* s_subpanel_graphics = new wxBoxSizer(wxVERTICAL); wxBoxSizer* s_subpanel_audio = new wxBoxSizer(wxVERTICAL); - wxBoxSizer* s_subpanel_camera = new wxBoxSizer(wxVERTICAL); wxBoxSizer* s_subpanel_io = new wxBoxSizer(wxVERTICAL); wxBoxSizer* s_subpanel_hle = new wxBoxSizer(wxVERTICAL); @@ -378,11 +375,10 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) // Audio wxStaticBoxSizer* s_round_audio_out = new wxStaticBoxSizer(wxVERTICAL, p_audio, _("Audio Out")); - // Camera - wxStaticBoxSizer* s_round_camera_type = new wxStaticBoxSizer(wxVERTICAL, p_camera, _("Camera type")); - // HLE / Misc. + wxStaticBoxSizer* s_round_hle_misc = new wxStaticBoxSizer(wxHORIZONTAL, p_hle, _("")); wxStaticBoxSizer* s_round_hle_log_lvl = new wxStaticBoxSizer(wxVERTICAL, p_hle, _("Log Level")); + wxStaticBoxSizer* s_round_camera_type = new wxStaticBoxSizer(wxVERTICAL, p_hle, _("Camera type")); // System wxStaticBoxSizer* s_round_sys_lang = new wxStaticBoxSizer(wxVERTICAL, p_system, _("Language")); @@ -396,7 +392,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) wxComboBox* cbox_keyboard_handler = new wxComboBox(p_io, wxID_ANY); wxComboBox* cbox_mouse_handler = new wxComboBox(p_io, wxID_ANY); wxComboBox* cbox_audio_out = new wxComboBox(p_audio, wxID_ANY); - wxComboBox* cbox_camera_type = new wxComboBox(p_camera, wxID_ANY); + wxComboBox* cbox_camera_type = new wxComboBox(p_hle, wxID_ANY); wxComboBox* cbox_hle_loglvl = new wxComboBox(p_hle, wxID_ANY); wxComboBox* cbox_sys_lang = new wxComboBox(p_system, wxID_ANY); @@ -463,24 +459,17 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) cbox_hle_loglvl->Append("Errors"); cbox_hle_loglvl->Append("Nothing"); - cbox_sys_lang->Append("Japanese"); - cbox_sys_lang->Append("English (US)"); - cbox_sys_lang->Append("French"); - cbox_sys_lang->Append("Spanish"); - cbox_sys_lang->Append("German"); - cbox_sys_lang->Append("Italian"); - cbox_sys_lang->Append("Dutch"); - cbox_sys_lang->Append("Portuguese (PT)"); - cbox_sys_lang->Append("Russian"); - cbox_sys_lang->Append("Korean"); - cbox_sys_lang->Append("Chinese (Trad.)"); - cbox_sys_lang->Append("Chinese (Simp.)"); - cbox_sys_lang->Append("Finnish"); - cbox_sys_lang->Append("Swedish"); - cbox_sys_lang->Append("Danish"); - cbox_sys_lang->Append("Norwegian"); - cbox_sys_lang->Append("Polish"); - cbox_sys_lang->Append("English (UK)"); + static const char* s_sys_lang_table[] = + { + "Japanese", "English (US)", "French", "Spanish", "German", "Italian", + "Dutch", "Portuguese (PT)", "Russian", "Korean", "Chinese (Trad.)", "Chinese (Simp.)", + "Finnish", "Swedish", "Danish", "Norwegian", "Polish", "English (UK)" + }; + + for (auto& lang : s_sys_lang_table) + { + cbox_sys_lang->Append(lang); + } // Get values from .ini chbox_gs_log_prog ->SetValue(Ini.GSLogPrograms.GetValue()); @@ -516,6 +505,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) chbox_audio_dump->Enable(Emu.IsStopped()); chbox_audio_conv->Enable(Emu.IsStopped()); chbox_hle_logging->Enable(Emu.IsStopped()); + cbox_camera_type->Enable(Emu.IsStopped()); chbox_hle_hook_stfunc->Enable(Emu.IsStopped()); s_round_cpu_decoder->Add(cbox_cpu_decoder, wxSizerFlags().Border(wxALL, 5).Expand()); @@ -531,9 +521,10 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) s_round_audio_out->Add(cbox_audio_out, wxSizerFlags().Border(wxALL, 5).Expand()); - s_round_camera_type->Add(cbox_camera_type, wxSizerFlags().Border(wxALL, 5).Expand()); - s_round_hle_log_lvl->Add(cbox_hle_loglvl, wxSizerFlags().Border(wxALL, 5).Expand()); + s_round_camera_type->Add(cbox_camera_type, wxSizerFlags().Border(wxALL, 5).Expand()); + s_round_hle_misc->Add(s_round_hle_log_lvl, wxSizerFlags().Border(wxALL, 5).Expand()); + s_round_hle_misc->Add(s_round_camera_type, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_sys_lang->Add(cbox_sys_lang, wxSizerFlags().Border(wxALL, 5).Expand()); @@ -560,11 +551,8 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) s_subpanel_audio->Add(chbox_audio_dump, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel_audio->Add(chbox_audio_conv, wxSizerFlags().Border(wxALL, 5).Expand()); - // Camera - s_subpanel_camera->Add(s_round_camera_type, wxSizerFlags().Border(wxALL, 5).Expand()); - // HLE / Misc. - s_subpanel_hle->Add(s_round_hle_log_lvl, wxSizerFlags().Border(wxALL, 5).Expand()); + s_subpanel_hle->Add(s_round_hle_misc, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel_hle->Add(chbox_hle_logging, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel_hle->Add(chbox_hle_hook_stfunc, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel_hle->Add(chbox_hle_savetty, wxSizerFlags().Border(wxALL, 5).Expand()); @@ -588,7 +576,6 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) diag.SetSizerAndFit(s_subpanel_graphics, false); diag.SetSizerAndFit(s_subpanel_io, false); diag.SetSizerAndFit(s_subpanel_audio, false); - diag.SetSizerAndFit(s_subpanel_camera, false); diag.SetSizerAndFit(s_subpanel_hle, false); diag.SetSizerAndFit(s_subpanel_system, false); diag.SetSizerAndFit(s_b_panel, false);