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

@ -4995,7 +4995,7 @@ msgid "You must enter a name!"
msgstr "Musíte zadat jméno!" msgstr "Musíte zadat jméno!"
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "Musíte zadat platnou desítkovu nebo šestnáctkovou hodnotu." msgstr "Musíte zadat platnou desítkovu nebo šestnáctkovou hodnotu."
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -4684,7 +4684,7 @@ msgid "You must enter a name!"
msgstr "" msgstr ""
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "" msgstr ""
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -5094,8 +5094,8 @@ msgid "You must enter a name!"
msgstr "Sie müssen einen Namen eingeben!" msgstr "Sie müssen einen Namen eingeben!"
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "Sie müssen eine gültige Dezimalzahl oder gültigen Hex-Wert eingeben!" msgstr "Sie müssen eine gültige Dezimal-, Hexadezimal- oder Oktalzahl eingeben!"
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623
msgid "You must enter a valid profile name." msgid "You must enter a valid profile name."

View File

@ -4685,7 +4685,7 @@ msgid "You must enter a name!"
msgstr "" msgstr ""
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "" msgstr ""
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -5021,7 +5021,7 @@ msgid "You must enter a name!"
msgstr "Πρέπει να εισάγετε ένα όνομα!" msgstr "Πρέπει να εισάγετε ένα όνομα!"
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "Πρέπει να εισάγετε μία έγκυρη δεκαδική ή δεκαεξαδική τιμή." msgstr "Πρέπει να εισάγετε μία έγκυρη δεκαδική ή δεκαεξαδική τιμή."
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -4684,7 +4684,7 @@ msgid "You must enter a name!"
msgstr "" msgstr ""
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "" msgstr ""
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -5060,8 +5060,8 @@ msgid "You must enter a name!"
msgstr "Debes escribir un nombre!" msgstr "Debes escribir un nombre!"
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "Debes ingresar un valor decimal o hexadecimal válido." msgstr "Debes ingresar un valor decimal, hexadecimal o octal válido."
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623
msgid "You must enter a valid profile name." msgid "You must enter a valid profile name."

View File

@ -5058,8 +5058,8 @@ msgid "You must enter a name!"
msgstr "Vous devez entrer un nom !" msgstr "Vous devez entrer un nom !"
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "Vous devez entrer une valeur décimale ou hexadécimale valide." msgstr "Vous devez entrer une valeur décimale, hexadécimale ou octale valide."
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623
msgid "You must enter a valid profile name." msgid "You must enter a valid profile name."

View File

@ -4688,7 +4688,7 @@ msgid "You must enter a name!"
msgstr "" msgstr ""
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "" msgstr ""
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -5030,7 +5030,7 @@ msgid "You must enter a name!"
msgstr "Meg kell adnod egy nevet!" msgstr "Meg kell adnod egy nevet!"
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "Be kell írnod egy érvényes decimális vagy hexa értéket." msgstr "Be kell írnod egy érvényes decimális vagy hexa értéket."
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -5184,8 +5184,8 @@ msgid "You must enter a name!"
msgstr "E' richiesto l'inserimento di un nome!" msgstr "E' richiesto l'inserimento di un nome!"
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "E' necessario inserire un valore decimale o esadecimale." msgstr "E' necessario inserire un valore decimale, esadecimale o ottale."
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623
msgid "You must enter a valid profile name." msgid "You must enter a valid profile name."

View File

@ -4872,7 +4872,7 @@ msgid "You must enter a name!"
msgstr "名前が入力されていません!" msgstr "名前が入力されていません!"
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "" msgstr ""
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -4982,7 +4982,7 @@ msgid "You must enter a name!"
msgstr "이름을 넣어야 합니다!" msgstr "이름을 넣어야 합니다!"
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "적합한 10진수나 16진수 값을 넣어야 합니다." msgstr "적합한 10진수나 16진수 값을 넣어야 합니다."
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -4942,7 +4942,7 @@ msgid "You must enter a name!"
msgstr "" msgstr ""
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "" msgstr ""
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -4947,7 +4947,7 @@ msgid "You must enter a name!"
msgstr "" msgstr ""
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "" msgstr ""
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -5031,7 +5031,7 @@ msgid "You must enter a name!"
msgstr "Musisz wprowadzić nazwę!" msgstr "Musisz wprowadzić nazwę!"
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "Musisz wprowadzić poprawną wartość dziesiętną lub szestnastkową." msgstr "Musisz wprowadzić poprawną wartość dziesiętną lub szestnastkową."
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -5059,8 +5059,8 @@ msgid "You must enter a name!"
msgstr "Tem que introduzir um nome!" msgstr "Tem que introduzir um nome!"
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "Tem que introduzir um número decimal ou hexadecimal válido." msgstr "Tem que introduzir um número decimal, hexadecimal ou octal válido."
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623
msgid "You must enter a valid profile name." msgid "You must enter a valid profile name."

View File

@ -4957,7 +4957,7 @@ msgid "You must enter a name!"
msgstr "" msgstr ""
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "" msgstr ""
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -4974,7 +4974,7 @@ msgid "You must enter a name!"
msgstr "Введите название!" msgstr "Введите название!"
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "Нужно ввести десятичное или шестнадцатиричное число." msgstr "Нужно ввести десятичное или шестнадцатиричное число."
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -5029,7 +5029,7 @@ msgid "You must enter a name!"
msgstr "Bir isim girmelisiniz!" msgstr "Bir isim girmelisiniz!"
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "Doğru bir onluk veya onaltılık değer girmelisiniz." msgstr "Doğru bir onluk veya onaltılık değer girmelisiniz."
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -5014,7 +5014,7 @@ msgid "You must enter a name!"
msgstr "您必须输入一个名称!" msgstr "您必须输入一个名称!"
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "您必须输入一个十进制或者十六进制值." msgstr "您必须输入一个十进制或者十六进制值."
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -4920,7 +4920,7 @@ msgid "You must enter a name!"
msgstr "您必須輸入一個名稱!" msgstr "您必須輸入一個名稱!"
#: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434
msgid "You must enter a valid decimal or hex value." msgid "You must enter a valid decimal, hexadecimal or octal value."
msgstr "您必須輸入一個有效的十進制或十六進制數值。" msgstr "您必須輸入一個有效的十進制或十六進制數值。"
#: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623

View File

@ -385,14 +385,14 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
e = search_results.end(); e = search_results.end();
std::vector<CheatSearchResult> filtered_results; std::vector<CheatSearchResult> filtered_results;
int filter_mask = 0;
// determine the selected filter // determine the selected filter
// 1 : equal // 1 : equal
// 2 : greater-than // 2 : greater-than
// 4 : less-than // 4 : less-than
const int filters[] = {7, 6, 1, 2, 4}; 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 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 // parse the user entered x value
if (filter_mask != 7) // don't need the value for the "None" filter if (filter_mask != 7) // don't need the value for the "None" filter
{ {
long parsed_x_val = 0; unsigned long parsed_x_val = 0;
int val_base = 10;
wxString x_val = textctrl_value_x->GetLabel(); 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; return;
} }