Some fixes for the "Cheat Search" feature :

- Replace ToLong() with ToULong(), as to allow values in the [0x80000000..0xFFFFFFFF] range to be parsed correctly without failure.
- Remove the "val_base" hack, as it breaks hexadecimal values beginning with '-'.
Simply passing 0 as the second parameter to ToULong() is enough, as mentioned on this page: http://msdn.microsoft.com/en-us/library/5k9xb7x1%28v=VS.100%29.aspx
- Changed the error message (and some of its translations) to reflect that octal values are now auto-detected ("supported") as well.

To users: 
Note that values beginning with '0' (not "0x" nor "0X") are now interpreted as octal values instead of decimal values. So be careful when using those!

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7223 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
DimitriPilot3
2011-02-21 18:01:32 +00:00
parent 9bf8a58286
commit a1da2e0e4c
23 changed files with 32 additions and 39 deletions

View File

@ -385,14 +385,14 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
e = search_results.end();
std::vector<CheatSearchResult> filtered_results;
int filter_mask = 0;
// determine the selected filter
// 1 : equal
// 2 : greater-than
// 4 : less-than
const int filters[] = {7, 6, 1, 2, 4};
filter_mask = filters[search_type->GetSelection()];
int filter_mask = filters[search_type->GetSelection()];
if (value_x_radiobtn.rad_oldvalue->GetValue()) // using old value comparison
{
@ -419,19 +419,12 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
// parse the user entered x value
if (filter_mask != 7) // don't need the value for the "None" filter
{
long parsed_x_val = 0;
int val_base = 10;
unsigned long parsed_x_val = 0;
wxString x_val = textctrl_value_x->GetLabel();
if (wxT("0x") == x_val.substr(0,2))
{
//x_val = x_val.substr(2); // wxwidgets seems fine parsing a "0x0000" string
val_base = 16;
}
if (!x_val.ToLong(&parsed_x_val, val_base))
if (!x_val.ToULong(&parsed_x_val, 0))
{
PanicAlertT("You must enter a valid decimal or hex value.");
PanicAlertT("You must enter a valid decimal, hexadecimal or octal value.");
return;
}