Minor changes

This commit is contained in:
Oil 2014-09-17 23:51:02 +04:00
parent 279ec3d8a3
commit 9d1a2dd376
3 changed files with 38 additions and 38 deletions

View file

@ -12,7 +12,7 @@ struct SemaphoreAttributes
u32 max_count; u32 max_count;
SemaphoreAttributes() {} 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 struct LwMutexAttributes
@ -22,13 +22,15 @@ struct LwMutexAttributes
std::string status; // TODO: check status? std::string status; // TODO: check status?
LwMutexAttributes() {} 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) {} : name(_name), owner_id(_owner_id), status(_status) {}
}; };
class SyncPrimManager class SyncPrimManager
{ {
private: private:
std::mutex m_mutex;
std::map<u32, std::string> m_cond_name; std::map<u32, std::string> m_cond_name;
std::map<u32, std::string> m_mutex_name; std::map<u32, std::string> m_mutex_name;
std::map<u32, std::string> m_lw_cond_name; std::map<u32, std::string> m_lw_cond_name;
@ -40,66 +42,78 @@ public:
// semaphores // semaphores
void AddSemaphoreData(const u32 id, const std::string& name, const u32 count, const u32 max_count) void AddSemaphoreData(const u32 id, const std::string& name, const u32 count, const u32 max_count)
{ {
std::lock_guard<std::mutex> lock(m_mutex);
m_semaph_attr[id] = *(new SemaphoreAttributes(name, count, max_count)); m_semaph_attr[id] = *(new SemaphoreAttributes(name, count, max_count));
} }
void EraseSemaphoreData(const u32 id) void EraseSemaphoreData(const u32 id)
{ {
std::lock_guard<std::mutex> lock(m_mutex);
m_semaph_attr.erase(id); m_semaph_attr.erase(id);
} }
SemaphoreAttributes& GetSemaphoreData(const u32 id) SemaphoreAttributes& GetSemaphoreData(const u32 id)
{ {
std::lock_guard<std::mutex> lock(m_mutex);
return m_semaph_attr[id]; return m_semaph_attr[id];
} }
// lw_mutexes // lw_mutexes
void AddLwMutexData(const u32 id, const std::string& name, const u32 owner_id) void AddLwMutexData(const u32 id, const std::string& name, const u32 owner_id)
{ {
std::lock_guard<std::mutex> lock(m_mutex);
m_lw_mutex_attr[id] = *(new LwMutexAttributes(name, owner_id)); m_lw_mutex_attr[id] = *(new LwMutexAttributes(name, owner_id));
} }
void EraseLwMutexData(const u32 id) void EraseLwMutexData(const u32 id)
{ {
std::lock_guard<std::mutex> lock(m_mutex);
m_lw_mutex_attr.erase(id); m_lw_mutex_attr.erase(id);
} }
LwMutexAttributes& GetLwMutexData(const u32 id) LwMutexAttributes& GetLwMutexData(const u32 id)
{ {
std::lock_guard<std::mutex> lock(m_mutex);
return m_lw_mutex_attr[id]; return m_lw_mutex_attr[id];
} }
// lw_conditions, mutexes, conditions // lw_conditions, mutexes, conditions
void AddSyncPrimData(const IDType type, const u32 id, const std::string& name) void AddSyncPrimData(const IDType type, const u32 id, const std::string& name)
{ {
std::lock_guard<std::mutex> lock(m_mutex);
switch (type) switch (type)
{ {
case TYPE_LWCOND: m_lw_cond_name[id] = name; break; case TYPE_LWCOND: m_lw_cond_name[id] = name; break;
case TYPE_MUTEX: m_mutex_name[id] = name; break; case TYPE_MUTEX: m_mutex_name[id] = name; break;
case TYPE_COND: m_cond_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) void EraseSyncPrimData(const IDType type, const u32 id)
{ {
std::lock_guard<std::mutex> lock(m_mutex);
switch (type) switch (type)
{ {
case TYPE_LWCOND: m_lw_cond_name.erase(id); break; case TYPE_LWCOND: m_lw_cond_name.erase(id); break;
case TYPE_MUTEX: m_mutex_name.erase(id); break; case TYPE_MUTEX: m_mutex_name.erase(id); break;
case TYPE_COND: m_cond_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<std::mutex> lock(m_mutex);
switch (type) switch (type)
{ {
case TYPE_LWCOND: return m_lw_cond_name[id]; case TYPE_LWCOND: return m_lw_cond_name[id];
case TYPE_MUTEX: return m_mutex_name[id]; case TYPE_MUTEX: return m_mutex_name[id];
case TYPE_COND: return m_cond_name[id]; case TYPE_COND: return m_cond_name[id];
default: return fmt::Format("Unknown IDType = %d", type);
} }
} }

View file

@ -118,7 +118,6 @@ void KernelExplorer::Update()
const auto& node = m_tree->AppendItem(root, name); const auto& node = m_tree->AppendItem(root, name);
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_LWCOND); const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_LWCOND);
u32 index = 0;
for (const auto& id : objects) for (const auto& id : objects)
{ {
sprintf(name, "LW Condition Variable: ID = 0x%08x '%s'", id, Emu.GetSyncPrimManager().GetSyncPrimName(TYPE_LWCOND, id).c_str()); sprintf(name, "LW Condition Variable: ID = 0x%08x '%s'", id, Emu.GetSyncPrimManager().GetSyncPrimName(TYPE_LWCOND, id).c_str());

View file

@ -332,7 +332,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
} }
wxDialog diag(this, wxID_ANY, "Settings", wxDefaultPosition); wxDialog diag(this, wxID_ANY, "Settings", wxDefaultPosition);
static const u32 width = 425; static const u32 width = 385;
static const u32 height = 400; static const u32 height = 400;
// Settings panels // Settings panels
@ -341,14 +341,12 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
wxPanel* p_cpu = new wxPanel(nb_config, wxID_ANY); wxPanel* p_cpu = new wxPanel(nb_config, wxID_ANY);
wxPanel* p_graphics = 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_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_io = new wxPanel(nb_config, wxID_ANY);
wxPanel* p_hle = 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_cpu, wxT("Core"));
nb_config->AddPage(p_graphics, wxT("Graphics")); nb_config->AddPage(p_graphics, wxT("Graphics"));
nb_config->AddPage(p_audio, wxT("Audio")); 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_io, wxT("Input / Output"));
nb_config->AddPage(p_hle, wxT("HLE / Misc.")); nb_config->AddPage(p_hle, wxT("HLE / Misc."));
nb_config->AddPage(p_system, wxT("System")); 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_cpu = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* s_subpanel_graphics = new wxBoxSizer(wxVERTICAL); wxBoxSizer* s_subpanel_graphics = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* s_subpanel_audio = 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_io = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* s_subpanel_hle = new wxBoxSizer(wxVERTICAL); wxBoxSizer* s_subpanel_hle = new wxBoxSizer(wxVERTICAL);
@ -378,11 +375,10 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
// Audio // Audio
wxStaticBoxSizer* s_round_audio_out = new wxStaticBoxSizer(wxVERTICAL, p_audio, _("Audio Out")); 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. // 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_hle_log_lvl = new wxStaticBoxSizer(wxVERTICAL, p_hle, _("Log Level"));
wxStaticBoxSizer* s_round_camera_type = new wxStaticBoxSizer(wxVERTICAL, p_hle, _("Camera type"));
// System // System
wxStaticBoxSizer* s_round_sys_lang = new wxStaticBoxSizer(wxVERTICAL, p_system, _("Language")); 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_keyboard_handler = new wxComboBox(p_io, wxID_ANY);
wxComboBox* cbox_mouse_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_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_hle_loglvl = new wxComboBox(p_hle, wxID_ANY);
wxComboBox* cbox_sys_lang = new wxComboBox(p_system, 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("Errors");
cbox_hle_loglvl->Append("Nothing"); cbox_hle_loglvl->Append("Nothing");
cbox_sys_lang->Append("Japanese"); static const char* s_sys_lang_table[] =
cbox_sys_lang->Append("English (US)"); {
cbox_sys_lang->Append("French"); "Japanese", "English (US)", "French", "Spanish", "German", "Italian",
cbox_sys_lang->Append("Spanish"); "Dutch", "Portuguese (PT)", "Russian", "Korean", "Chinese (Trad.)", "Chinese (Simp.)",
cbox_sys_lang->Append("German"); "Finnish", "Swedish", "Danish", "Norwegian", "Polish", "English (UK)"
cbox_sys_lang->Append("Italian"); };
cbox_sys_lang->Append("Dutch");
cbox_sys_lang->Append("Portuguese (PT)"); for (auto& lang : s_sys_lang_table)
cbox_sys_lang->Append("Russian"); {
cbox_sys_lang->Append("Korean"); cbox_sys_lang->Append(lang);
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)");
// Get values from .ini // Get values from .ini
chbox_gs_log_prog ->SetValue(Ini.GSLogPrograms.GetValue()); 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_dump->Enable(Emu.IsStopped());
chbox_audio_conv->Enable(Emu.IsStopped()); chbox_audio_conv->Enable(Emu.IsStopped());
chbox_hle_logging->Enable(Emu.IsStopped()); chbox_hle_logging->Enable(Emu.IsStopped());
cbox_camera_type->Enable(Emu.IsStopped());
chbox_hle_hook_stfunc->Enable(Emu.IsStopped()); chbox_hle_hook_stfunc->Enable(Emu.IsStopped());
s_round_cpu_decoder->Add(cbox_cpu_decoder, wxSizerFlags().Border(wxALL, 5).Expand()); 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_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_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()); 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_dump, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel_audio->Add(chbox_audio_conv, 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. // 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_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_hook_stfunc, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel_hle->Add(chbox_hle_savetty, 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_graphics, false);
diag.SetSizerAndFit(s_subpanel_io, false); diag.SetSizerAndFit(s_subpanel_io, false);
diag.SetSizerAndFit(s_subpanel_audio, false); diag.SetSizerAndFit(s_subpanel_audio, false);
diag.SetSizerAndFit(s_subpanel_camera, false);
diag.SetSizerAndFit(s_subpanel_hle, false); diag.SetSizerAndFit(s_subpanel_hle, false);
diag.SetSizerAndFit(s_subpanel_system, false); diag.SetSizerAndFit(s_subpanel_system, false);
diag.SetSizerAndFit(s_b_panel, false); diag.SetSizerAndFit(s_b_panel, false);