From a1da2e0e4c495cc37a0c20856b36fe71db48f35e Mon Sep 17 00:00:00 2001 From: DimitriPilot3 Date: Mon, 21 Feb 2011 18:01:32 +0000 Subject: [PATCH] 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 --- Languages/cs.po | 2 +- Languages/da.po | 2 +- Languages/de.po | 4 ++-- Languages/dolphin-emu.pot | 2 +- Languages/el.po | 2 +- Languages/en.po | 2 +- Languages/es.po | 4 ++-- Languages/fr.po | 4 ++-- Languages/he.po | 2 +- Languages/hu.po | 2 +- Languages/it.po | 4 ++-- Languages/ja.po | 2 +- Languages/ko.po | 2 +- Languages/nb.po | 2 +- Languages/nl.po | 2 +- Languages/pl.po | 2 +- Languages/pt.po | 4 ++-- Languages/pt_BR.po | 2 +- Languages/ru.po | 2 +- Languages/tr.po | 2 +- Languages/zh_CN.po | 2 +- Languages/zh_TW.po | 2 +- Source/Core/DolphinWX/Src/CheatsWindow.cpp | 17 +++++------------ 23 files changed, 32 insertions(+), 39 deletions(-) diff --git a/Languages/cs.po b/Languages/cs.po index 79b03adc75..13c7174d13 100644 --- a/Languages/cs.po +++ b/Languages/cs.po @@ -4995,7 +4995,7 @@ msgid "You must enter a name!" msgstr "Musíte zadat jméno!" #: 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." #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Languages/da.po b/Languages/da.po index 930c897753..85942288a8 100644 --- a/Languages/da.po +++ b/Languages/da.po @@ -4684,7 +4684,7 @@ msgid "You must enter a name!" msgstr "" #: 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 "" #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Languages/de.po b/Languages/de.po index 1be24e6141..229df899cc 100644 --- a/Languages/de.po +++ b/Languages/de.po @@ -5094,8 +5094,8 @@ msgid "You must enter a name!" msgstr "Sie müssen einen Namen eingeben!" #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 -msgid "You must enter a valid decimal or hex value." -msgstr "Sie müssen eine gültige Dezimalzahl oder gültigen Hex-Wert eingeben!" +msgid "You must enter a valid decimal, hexadecimal or octal value." +msgstr "Sie müssen eine gültige Dezimal-, Hexadezimal- oder Oktalzahl eingeben!" #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 msgid "You must enter a valid profile name." diff --git a/Languages/dolphin-emu.pot b/Languages/dolphin-emu.pot index f31cce49a9..2b2e324129 100644 --- a/Languages/dolphin-emu.pot +++ b/Languages/dolphin-emu.pot @@ -4685,7 +4685,7 @@ msgid "You must enter a name!" msgstr "" #: 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 "" #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Languages/el.po b/Languages/el.po index 1abc2ee32c..2a8f5a9980 100644 --- a/Languages/el.po +++ b/Languages/el.po @@ -5021,7 +5021,7 @@ msgid "You must enter a name!" msgstr "Πρέπει να εισάγετε ένα όνομα!" #: 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 "Πρέπει να εισάγετε μία έγκυρη δεκαδική ή δεκαεξαδική τιμή." #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Languages/en.po b/Languages/en.po index b96cd54e9b..82d31d72cc 100644 --- a/Languages/en.po +++ b/Languages/en.po @@ -4684,7 +4684,7 @@ msgid "You must enter a name!" msgstr "" #: 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 "" #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Languages/es.po b/Languages/es.po index c4d5f9899a..1835e4d541 100644 --- a/Languages/es.po +++ b/Languages/es.po @@ -5060,8 +5060,8 @@ msgid "You must enter a name!" msgstr "Debes escribir un nombre!" #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 -msgid "You must enter a valid decimal or hex value." -msgstr "Debes ingresar un valor decimal o hexadecimal válido." +msgid "You must enter a valid decimal, hexadecimal or octal value." +msgstr "Debes ingresar un valor decimal, hexadecimal o octal válido." #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 msgid "You must enter a valid profile name." diff --git a/Languages/fr.po b/Languages/fr.po index 6387c47338..db112c87fb 100644 --- a/Languages/fr.po +++ b/Languages/fr.po @@ -5058,8 +5058,8 @@ msgid "You must enter a name!" msgstr "Vous devez entrer un nom !" #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 -msgid "You must enter a valid decimal or hex value." -msgstr "Vous devez entrer une valeur décimale ou hexadécimale valide." +msgid "You must enter a valid decimal, hexadecimal or octal value." +msgstr "Vous devez entrer une valeur décimale, hexadécimale ou octale valide." #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 msgid "You must enter a valid profile name." diff --git a/Languages/he.po b/Languages/he.po index 23438df63e..c882a3221a 100644 --- a/Languages/he.po +++ b/Languages/he.po @@ -4688,7 +4688,7 @@ msgid "You must enter a name!" msgstr "" #: 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 "" #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Languages/hu.po b/Languages/hu.po index 11bd788e9c..3446bd1e40 100644 --- a/Languages/hu.po +++ b/Languages/hu.po @@ -5030,7 +5030,7 @@ msgid "You must enter a name!" msgstr "Meg kell adnod egy nevet!" #: 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." #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Languages/it.po b/Languages/it.po index 5a6cc731e2..0d4a0841af 100644 --- a/Languages/it.po +++ b/Languages/it.po @@ -5184,8 +5184,8 @@ msgid "You must enter a name!" msgstr "E' richiesto l'inserimento di un nome!" #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 -msgid "You must enter a valid decimal or hex value." -msgstr "E' necessario inserire un valore decimale o esadecimale." +msgid "You must enter a valid decimal, hexadecimal or octal value." +msgstr "E' necessario inserire un valore decimale, esadecimale o ottale." #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 msgid "You must enter a valid profile name." diff --git a/Languages/ja.po b/Languages/ja.po index 9bb2ac3245..ac7fb85c25 100644 --- a/Languages/ja.po +++ b/Languages/ja.po @@ -4872,7 +4872,7 @@ msgid "You must enter a name!" msgstr "名前が入力されていません!" #: 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 "" #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Languages/ko.po b/Languages/ko.po index d834a9141b..68af0ee0ba 100644 --- a/Languages/ko.po +++ b/Languages/ko.po @@ -4982,7 +4982,7 @@ msgid "You must enter a name!" msgstr "이름을 넣어야 합니다!" #: 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진수 값을 넣어야 합니다." #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Languages/nb.po b/Languages/nb.po index e6da3c262d..b76320104c 100644 --- a/Languages/nb.po +++ b/Languages/nb.po @@ -4942,7 +4942,7 @@ msgid "You must enter a name!" msgstr "" #: 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 "" #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Languages/nl.po b/Languages/nl.po index 6f1c6cefd7..47f96cb411 100644 --- a/Languages/nl.po +++ b/Languages/nl.po @@ -4947,7 +4947,7 @@ msgid "You must enter a name!" msgstr "" #: 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 "" #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Languages/pl.po b/Languages/pl.po index d2b2fb0484..af91ff4f20 100644 --- a/Languages/pl.po +++ b/Languages/pl.po @@ -5031,7 +5031,7 @@ msgid "You must enter a name!" msgstr "Musisz wprowadzić nazwę!" #: 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ą." #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Languages/pt.po b/Languages/pt.po index 21fa622422..3aea201d18 100644 --- a/Languages/pt.po +++ b/Languages/pt.po @@ -5059,8 +5059,8 @@ msgid "You must enter a name!" msgstr "Tem que introduzir um nome!" #: Source/Core/DolphinWX/Src/CheatsWindow.cpp:434 -msgid "You must enter a valid decimal or hex value." -msgstr "Tem que introduzir um número decimal ou hexadecimal válido." +msgid "You must enter a valid decimal, hexadecimal or octal value." +msgstr "Tem que introduzir um número decimal, hexadecimal ou octal válido." #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 msgid "You must enter a valid profile name." diff --git a/Languages/pt_BR.po b/Languages/pt_BR.po index 05d74be641..7bb1e918ab 100644 --- a/Languages/pt_BR.po +++ b/Languages/pt_BR.po @@ -4957,7 +4957,7 @@ msgid "You must enter a name!" msgstr "" #: 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 "" #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Languages/ru.po b/Languages/ru.po index 18f8e7defe..a1f3ce0ab0 100644 --- a/Languages/ru.po +++ b/Languages/ru.po @@ -4974,7 +4974,7 @@ msgid "You must enter a name!" msgstr "Введите название!" #: 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 "Нужно ввести десятичное или шестнадцатиричное число." #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Languages/tr.po b/Languages/tr.po index 4feae37021..793da6d95a 100644 --- a/Languages/tr.po +++ b/Languages/tr.po @@ -5029,7 +5029,7 @@ msgid "You must enter a name!" msgstr "Bir isim girmelisiniz!" #: 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." #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Languages/zh_CN.po b/Languages/zh_CN.po index 63742e88ac..42fce13ec7 100644 --- a/Languages/zh_CN.po +++ b/Languages/zh_CN.po @@ -5014,7 +5014,7 @@ msgid "You must enter a name!" msgstr "您必须输入一个名称!" #: 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 "您必须输入一个十进制或者十六进制值." #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Languages/zh_TW.po b/Languages/zh_TW.po index adf6791719..5aac8871eb 100644 --- a/Languages/zh_TW.po +++ b/Languages/zh_TW.po @@ -4920,7 +4920,7 @@ msgid "You must enter a name!" msgstr "您必須輸入一個名稱!" #: 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 "您必須輸入一個有效的十進制或十六進制數值。" #: Source/Core/DolphinWX/Src/InputConfigDiag.cpp:623 diff --git a/Source/Core/DolphinWX/Src/CheatsWindow.cpp b/Source/Core/DolphinWX/Src/CheatsWindow.cpp index fe06570f93..ba57e24a3d 100644 --- a/Source/Core/DolphinWX/Src/CheatsWindow.cpp +++ b/Source/Core/DolphinWX/Src/CheatsWindow.cpp @@ -385,14 +385,14 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&) e = search_results.end(); std::vector 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; }