Made the "Download Gecko Codes" button not add already existing codes.(fixes issue 3732) Minor fix to gecko code handling. Added a "Show Shader Errors" setting to video config dialog.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6658 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak 2010-12-26 06:23:33 +00:00
parent f2e54074f1
commit 7c5b12c5bc
3 changed files with 41 additions and 12 deletions

View File

@ -681,7 +681,7 @@ bool MathOperation(u32& ret, const u32 left, const u32 right, const u8 type)
// 8 : asr (arithmetic shift right) // 8 : asr (arithmetic shift right)
case 0x8 : case 0x8 :
ret = (left >> right) | (left & 0x80000000); ret = (s32)left >> right;
break; break;
// TODO: these float ops good? // TODO: these float ops good?

View File

@ -41,19 +41,20 @@ CodeConfigPanel::CodeConfigPanel(wxWindow* const parent)
sizer_infobox->Add(m_infobox.listbox_codes, 1, wxEXPAND, 5); sizer_infobox->Add(m_infobox.listbox_codes, 1, wxEXPAND, 5);
// button sizer // button sizer
wxBoxSizer* const sizer_buttons = new wxBoxSizer(wxVERTICAL); wxBoxSizer* const sizer_buttons = new wxBoxSizer(wxHORIZONTAL);
wxButton* const btn_download = new wxButton(this, -1, wxT("Download Codes (WiiRD Database)"), wxDefaultPosition, wxSize(128, -1)); wxButton* const btn_download = new wxButton(this, -1, wxT("Download Codes (WiiRD Database)"), wxDefaultPosition, wxSize(128, -1));
_connect_macro_(btn_download, CodeConfigPanel::DownloadCodes, wxEVT_COMMAND_BUTTON_CLICKED, this); _connect_macro_(btn_download, CodeConfigPanel::DownloadCodes, wxEVT_COMMAND_BUTTON_CLICKED, this);
sizer_buttons->Add(btn_download, 0, wxEXPAND); sizer_buttons->AddStretchSpacer(1);
sizer_buttons->Add(btn_download, 1, wxEXPAND);
// horizontal sizer // horizontal sizer
wxBoxSizer* const sizer_horz = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* const sizer_vert = new wxBoxSizer(wxVERTICAL);
sizer_horz->Add(sizer_infobox, 1, wxEXPAND); sizer_vert->Add(sizer_infobox, 1, wxEXPAND);
sizer_horz->Add(sizer_buttons, 1, wxLEFT | wxALIGN_BOTTOM, 5); sizer_vert->Add(sizer_buttons, 0, wxEXPAND | wxTOP, 5);
wxBoxSizer* const sizer_main = new wxBoxSizer(wxVERTICAL); wxBoxSizer* const sizer_main = new wxBoxSizer(wxVERTICAL);
sizer_main->Add(m_listbox_gcodes, 1, wxALL | wxEXPAND, 5); sizer_main->Add(m_listbox_gcodes, 1, wxALL | wxEXPAND, 5);
sizer_main->Add(sizer_horz, 0, wxALL | wxEXPAND, 5); sizer_main->Add(sizer_vert, 0, wxALL | wxEXPAND, 5);
SetSizerAndFit(sizer_main); SetSizerAndFit(sizer_main);
} }
@ -196,8 +197,14 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
{ {
// read new code // read new code
case 0 : case 0 :
gcode.name = line; // TODO: parse creator name in []s {
std::istringstream ss(line);
std::getline(ss, gcode.name, '['); // stop at [ character (begining of contributer name)
gcode.name = StripSpaces(gcode.name);
// read the code creator name
std::getline(ss, gcode.creator, ']');
read_state = 1; read_state = 1;
}
break; break;
// read code lines // read code lines
@ -240,15 +247,36 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
if (gcodes.size()) if (gcodes.size())
{ {
PanicAlert("Downloaded %lu codes.", unsigned long added_count = 0;
(unsigned long)gcodes.size());
// append the codes to the code list // append the codes to the code list
std::vector<GeckoCode>::const_iterator std::vector<GeckoCode>::const_iterator
gcodes_iter = gcodes.begin(), gcodes_iter = gcodes.begin(),
gcodes_end = gcodes.end(); gcodes_end = gcodes.end();
for (; gcodes_iter!= gcodes_end; ++gcodes_iter) for (; gcodes_iter!= gcodes_end; ++gcodes_iter)
m_gcodes.push_back(*gcodes_iter); {
// only add codes which do not already exist
std::vector<GeckoCode>::const_iterator
existing_gcodes_iter = m_gcodes.begin(),
existing_gcodes_end = m_gcodes.end();
for (;; ++existing_gcodes_iter)
{
if (existing_gcodes_end == existing_gcodes_iter)
{
m_gcodes.push_back(*gcodes_iter);
++added_count;
break;
}
// code with this name+creator exists
if (existing_gcodes_iter->name == gcodes_iter->name &&
existing_gcodes_iter->creator == gcodes_iter->creator)
break;
}
}
PanicAlert("Downloaded %lu codes. (added %lu)",
(unsigned long)gcodes.size(), added_count);
// refresh the list // refresh the list
UpdateCodeList(); UpdateCodeList();

View File

@ -349,7 +349,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
// - info // - info
{ {
wxStaticBoxSizer* const group_info = new wxStaticBoxSizer(wxVERTICAL, page_advanced, wxT("Overlay Information")); wxStaticBoxSizer* const group_info = new wxStaticBoxSizer(wxVERTICAL, page_advanced, wxT("Information"));
szr_advanced->Add(group_info, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); szr_advanced->Add(group_info, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
wxGridSizer* const szr_info = new wxGridSizer(2, 5, 5); wxGridSizer* const szr_info = new wxGridSizer(2, 5, 5);
group_info->Add(szr_info, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); group_info->Add(szr_info, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
@ -359,6 +359,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
szr_info->Add(new SettingCheckBox(page_advanced, wxT("Projection Stats"), proj_stats_tooltip, vconfig.bOverlayProjStats)); szr_info->Add(new SettingCheckBox(page_advanced, wxT("Projection Stats"), proj_stats_tooltip, vconfig.bOverlayProjStats));
szr_info->Add(new SettingCheckBox(page_advanced, wxT("Texture Format"), texfmt_tooltip, vconfig.bTexFmtOverlayEnable)); szr_info->Add(new SettingCheckBox(page_advanced, wxT("Texture Format"), texfmt_tooltip, vconfig.bTexFmtOverlayEnable));
szr_info->Add(new SettingCheckBox(page_advanced, wxT("EFB Copy Regions"), efb_copy_regions_tooltip, vconfig.bShowEFBCopyRegions)); szr_info->Add(new SettingCheckBox(page_advanced, wxT("EFB Copy Regions"), efb_copy_regions_tooltip, vconfig.bShowEFBCopyRegions));
szr_info->Add(new SettingCheckBox(page_advanced, wxT("Show Shader Errors"), wxT(""), vconfig.bShowShaderErrors));
} }
// - XFB // - XFB