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)
case 0x8 :
ret = (left >> right) | (left & 0x80000000);
ret = (s32)left >> right;
break;
// 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);
// 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));
_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
wxBoxSizer* const sizer_horz = new wxBoxSizer(wxHORIZONTAL);
sizer_horz->Add(sizer_infobox, 1, wxEXPAND);
sizer_horz->Add(sizer_buttons, 1, wxLEFT | wxALIGN_BOTTOM, 5);
wxBoxSizer* const sizer_vert = new wxBoxSizer(wxVERTICAL);
sizer_vert->Add(sizer_infobox, 1, wxEXPAND);
sizer_vert->Add(sizer_buttons, 0, wxEXPAND | wxTOP, 5);
wxBoxSizer* const sizer_main = new wxBoxSizer(wxVERTICAL);
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);
}
@ -196,8 +197,14 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
{
// read new code
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;
}
break;
// read code lines
@ -240,15 +247,36 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
if (gcodes.size())
{
PanicAlert("Downloaded %lu codes.",
(unsigned long)gcodes.size());
unsigned long added_count = 0;
// append the codes to the code list
std::vector<GeckoCode>::const_iterator
gcodes_iter = gcodes.begin(),
gcodes_end = gcodes.end();
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
UpdateCodeList();

View File

@ -349,7 +349,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
// - 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);
wxGridSizer* const szr_info = new wxGridSizer(2, 5, 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("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("Show Shader Errors"), wxT(""), vconfig.bShowShaderErrors));
}
// - XFB