summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2009-08-24 00:22:56 +0000
committerSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2009-08-24 00:22:56 +0000
commitf865dc1d5ebe04cb07c43406e53490bee2659df2 (patch)
tree3930a6695fa4c8fae1605fcda52099f2ba0cdccb
parent8ce4f04a0ff5f7830b27ff1f47db37ad4b2fb3be (diff)
downloadpcsxr-f865dc1d5ebe04cb07c43406e53490bee2659df2.tar.gz
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@27406 e17a0e51-4ae3-4d35-97c3-1a29b211df97
-rw-r--r--ChangeLog7
-rw-r--r--win32/gui/CheatDlg.c32
-rw-r--r--win32/gui/ConfigurePlugins.c8
-rw-r--r--win32/gui/WndMain.c138
-rw-r--r--win32/pcsx.rc4
-rw-r--r--win32/resource.h1
6 files changed, 131 insertions, 59 deletions
diff --git a/ChangeLog b/ChangeLog
index 7602cbef..63768c4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+August 24, 2009 Wei Mingzhi <weimingzhi@gmail.com>
+
+ * win32/gui/WndMain.c: Set the language to the OS language by default.
+ * win32/gui/ConfigurePlugins.c: Made some strings translatable.
+ * win32/gui/CheatDlg.c: Fixed incorrect usage of SysMessage().
+ * win32/pcsx.rc, win32/resource.h: Fixed manifest.
+
August 23, 2009 Wei Mingzhi <weimingzhi@gmail.com>
* data/pcsx.glade2: Added "..." in menu items which will popup a dialog.
diff --git a/win32/gui/CheatDlg.c b/win32/gui/CheatDlg.c
index 0642e407..88cb3214 100644
--- a/win32/gui/CheatDlg.c
+++ b/win32/gui/CheatDlg.c
@@ -53,10 +53,10 @@ static void UpdateCheatDlg(HWND hW) {
}
}
-static int iEditItem = -1;
+static int iEditItem = -1;
+static char szDescr[256], szCode[1024];
static LRESULT WINAPI CheatEditDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
- char szDescr[256], szCode[1024];
int i;
switch (uMsg) {
@@ -86,7 +86,7 @@ static LRESULT WINAPI CheatEditDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM
Edit_GetText(GetDlgItem(hW, IDC_CODE), szCode, 1024);
if (EditCheat(iEditItem, szDescr, szCode) != 0) {
- SysMessage(_("Error"), _("Invalid cheat code!"));
+ SysMessage(_("Invalid cheat code!"));
}
else {
EndDialog(hW, TRUE);
@@ -109,8 +109,6 @@ static LRESULT WINAPI CheatEditDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM
}
static LRESULT WINAPI CheatAddDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
- char szDescr[256], szCode[1024];
-
switch (uMsg) {
case WM_INITDIALOG:
SetWindowText(hW, _("Add New Cheat"));
@@ -118,6 +116,8 @@ static LRESULT WINAPI CheatAddDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM
Static_SetText(GetDlgItem(hW, IDC_LABEL_CODE), _("Cheat Code:"));
Button_SetText(GetDlgItem(hW, IDOK), _("OK"));
Button_SetText(GetDlgItem(hW, IDCANCEL), _("Cancel"));
+ Edit_SetText(GetDlgItem(hW, IDC_DESCR), szDescr);
+ Edit_SetText(GetDlgItem(hW, IDC_CODE), szCode);
break;
case WM_COMMAND:
@@ -127,7 +127,7 @@ static LRESULT WINAPI CheatAddDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM
Edit_GetText(GetDlgItem(hW, IDC_CODE), szCode, 1024);
if (AddCheat(szDescr, szCode) != 0) {
- SysMessage(_("Error"), _("Invalid cheat code!"));
+ SysMessage(_("Invalid cheat code!"));
}
else {
EndDialog(hW, TRUE);
@@ -201,6 +201,9 @@ LRESULT WINAPI CheatDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
case IDC_ADDCODE:
i = NumCheats;
+ szDescr[0] = '\0';
+ szCode[0] = '\0';
+
DialogBox(gApp.hInstance, MAKEINTRESOURCE(IDD_CHEATEDIT), hW, CheatAddDlgProc);
if (NumCheats > i) {
@@ -384,6 +387,12 @@ static uint32_t current_valuefrom = 0;
static uint32_t current_valueto = 0;
static void UpdateCheatSearchDlg(HWND hW) {
+ char buf[256];
+
+ // clear all combo boxes
+ SendMessage(GetDlgItem(hW, IDC_SEARCHFOR), CB_RESETCONTENT, 0, 0);
+ SendMessage(GetDlgItem(hW, IDC_DATATYPE), CB_RESETCONTENT, 0, 0);
+ SendMessage(GetDlgItem(hW, IDC_DATABASE), CB_RESETCONTENT, 0, 0);
}
LRESULT WINAPI CheatSearchDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
@@ -407,7 +416,7 @@ LRESULT WINAPI CheatSearchDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
break;
case WM_COMMAND:
- switch (wParam) {
+ switch (LOBYTE(wParam)) {
case IDCANCEL:
EndDialog(hW, TRUE);
return TRUE;
@@ -426,6 +435,15 @@ LRESULT WINAPI CheatSearchDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
case IDC_NEWSEARCH:
break;
+
+ case IDC_SEARCHFOR:
+ break;
+
+ case IDC_DATABASE:
+ break;
+
+ case IDC_DATATYPE:
+ break;
}
break;
diff --git a/win32/gui/ConfigurePlugins.c b/win32/gui/ConfigurePlugins.c
index 3e6eaeb0..1bd15202 100644
--- a/win32/gui/ConfigurePlugins.c
+++ b/win32/gui/ConfigurePlugins.c
@@ -195,9 +195,9 @@ BOOL OnConfigurePluginsDialog(HWND hW) {
// BIOS
- lp=(char *)malloc(strlen("HLE") + 1);
+ lp = (char *)malloc(strlen("HLE") + 1);
sprintf(lp, "HLE");
- i=ComboBox_AddString(hWC_BIOS, "Internal HLE Bios");
+ i = ComboBox_AddString(hWC_BIOS, _("Internal HLE Bios"));
ComboBox_SetItemData(hWC_BIOS, i, lp);
if (stricmp(Config.Bios, lp)==0)
ComboBox_SetCurSel(hWC_BIOS, i);
@@ -438,7 +438,7 @@ int SelectPath(HWND hW, char *Title, char *Path) {
void SetPluginsDir(HWND hW) {
char Path[256];
- if (SelectPath(hW, "Select Plugins Directory", Path) == -1) return;
+ if (SelectPath(hW, _("Select Plugins Directory"), Path) == -1) return;
strcpy(Config.PluginsDir, Path);
CleanUpCombos(hW);
OnConfigurePluginsDialog(hW);
@@ -447,7 +447,7 @@ void SetPluginsDir(HWND hW) {
void SetBiosDir(HWND hW) {
char Path[256];
- if (SelectPath(hW, "Select Bios Directory", Path) == -1) return;
+ if (SelectPath(hW, _("Select Bios Directory"), Path) == -1) return;
strcpy(Config.BiosDir, Path);
CleanUpCombos(hW);
OnConfigurePluginsDialog(hW);
diff --git a/win32/gui/WndMain.c b/win32/gui/WndMain.c
index 272b1254..40414ab2 100644
--- a/win32/gui/WndMain.c
+++ b/win32/gui/WndMain.c
@@ -57,6 +57,8 @@ static HDC hdcmem;
static HBITMAP hBm;
static BITMAP bm;
+#ifdef ENABLE_NLS
+
unsigned int langsMax;
typedef struct {
@@ -64,36 +66,35 @@ typedef struct {
} _langs;
_langs *langs = NULL;
-#define MAXFILENAME 256
-
typedef struct {
- char id[8];
- char name[64];
+ char id[8];
+ char name[64];
+ LANGID langid;
} LangDef;
LangDef sLangs[] = {
- { "ar", N_("Arabic") },
- { "ca", N_("Catalan") },
- { "de", N_("German") },
- { "el", N_("Greek") },
- { "en", N_("English") },
- { "es", N_("Spanish") },
- { "fr_FR", N_("French") },
- { "it_IT", N_("Italian") },
- { "pt", N_("Portuguese") },
- { "ro", N_("Romanian") },
- { "ru", N_("Russian") },
- { "zh_CN", N_("Simplified Chinese") },
- { "zh_TW", N_("Traditional Chinese") },
- { "jp", N_("Japanese") },
- { "ko", N_("Korean") },
- { "", "" },
+ { "ar", N_("Arabic"), 0x0401 },
+ { "ca", N_("Catalan"), 0x0403 },
+ { "de", N_("German"), 0x0407 },
+ { "el", N_("Greek"), 0x0408 },
+ { "en", N_("English"), 0x0409 },
+ { "es", N_("Spanish"), 0x040a },
+ { "fr_FR", N_("French"), 0x040c },
+ { "it_IT", N_("Italian"), 0x0410 },
+ { "pt", N_("Portuguese"), 0x0816 },
+ { "ro", N_("Romanian"), 0x0418 },
+ { "ru", N_("Russian"), 0x0419 },
+ { "zh_CN", N_("Simplified Chinese"), 0x0804 },
+ { "zh_TW", N_("Traditional Chinese"), 0x0404 },
+ { "jp", N_("Japanese"), 0x0411 },
+ { "ko", N_("Korean"), 0x0412 },
+ { "", "", 0xFFFF },
};
char *ParseLang(char *id) {
int i=0;
- while (sLangs[i].id[0] != 0) {
+ while (sLangs[i].id[0] != '\0') {
if (!strcmp(id, sLangs[i].id))
return _(sLangs[i].name);
i++;
@@ -102,6 +103,26 @@ char *ParseLang(char *id) {
return id;
}
+static void SetDefaultLang(void) {
+ LANGID langid;
+ int i;
+
+ langid = GetSystemDefaultLangID();
+
+ i = 0;
+ while (sLangs[i].id[0] != '\0') {
+ if (langid == sLangs[i].langid) {
+ strcpy(Config.Lang, sLangs[i].id);
+ return;
+ }
+ i++;
+ }
+
+ strcpy(Config.Lang, "English");
+}
+
+#endif
+
void strcatz(char *dst, char *src) {
int len = strlen(dst) + 1;
strcpy(dst + len, src);
@@ -133,6 +154,15 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
ConfPlug = 1;
+#ifdef ENABLE_NLS
+ {
+ char text[256];
+ SetDefaultLang();
+ sprintf(text, "LANGUAGE=%s", Config.Lang);
+ gettext_putenv(text);
+ }
+#endif
+
ConfigurePlugins(gApp.hWnd);
if (LoadConfig() == -1) {
@@ -140,9 +170,13 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
}
}
+#ifdef ENABLE_NLS
if (Config.Lang[0] == 0) {
- strcpy(Config.Lang, "English");
+ SetDefaultLang();
+ SaveConfig();
+ LoadConfig();
}
+#endif
if (SysInit() == -1) return 1;
@@ -178,7 +212,7 @@ int Slots[5] = { -1, -1, -1, -1, -1 };
void ResetMenuSlots() {
int i;
- for (i=0; i<5; i++) {
+ for (i = 0; i < 5; i++) {
if (Slots[i] == -1)
EnableMenuItem(GetSubMenu(gApp.hMenu, 0), ID_FILE_STATES_LOAD_SLOT1+i, MF_GRAYED);
else
@@ -190,7 +224,7 @@ void UpdateMenuSlots() {
char str[256];
int i;
- for (i=0; i<5; i++) {
+ for (i = 0; i < 5; i++) {
GetStateFilename(str, i);
Slots[i] = CheckState(str);
}
@@ -204,7 +238,8 @@ void OpenConsole() {
}
void CloseConsole() {
- FreeConsole(); hConsole = NULL;
+ FreeConsole();
+ hConsole = NULL;
}
void States_Load(int num) {
@@ -251,8 +286,8 @@ void States_Save(int num) {
void OnStates_LoadOther() {
OPENFILENAME ofn;
- char szFileName[MAXFILENAME];
- char szFileTitle[MAXFILENAME];
+ char szFileName[MAXPATHLEN];
+ char szFileTitle[MAXPATHLEN];
char szFilter[256];
memset(&szFileName, 0, sizeof(szFileName));
@@ -269,10 +304,10 @@ void OnStates_LoadOther() {
ofn.nMaxCustFilter = 0;
ofn.nFilterIndex = 1;
ofn.lpstrFile = szFileName;
- ofn.nMaxFile = MAXFILENAME;
+ ofn.nMaxFile = MAXPATHLEN;
ofn.lpstrInitialDir = NULL;
ofn.lpstrFileTitle = szFileTitle;
- ofn.nMaxFileTitle = MAXFILENAME;
+ ofn.nMaxFileTitle = MAXPATHLEN;
ofn.lpstrTitle = NULL;
ofn.lpstrDefExt = NULL;
ofn.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
@@ -303,8 +338,8 @@ void OnStates_Save5() { States_Save(4); }
void OnStates_SaveOther() {
OPENFILENAME ofn;
- char szFileName[MAXFILENAME];
- char szFileTitle[MAXFILENAME];
+ char szFileName[MAXPATHLEN];
+ char szFileTitle[MAXPATHLEN];
char szFilter[256];
memset(&szFileName, 0, sizeof(szFileName));
@@ -321,10 +356,10 @@ void OnStates_SaveOther() {
ofn.nMaxCustFilter = 0;
ofn.nFilterIndex = 1;
ofn.lpstrFile = szFileName;
- ofn.nMaxFile = MAXFILENAME;
+ ofn.nMaxFile = MAXPATHLEN;
ofn.lpstrInitialDir = NULL;
ofn.lpstrFileTitle = szFileTitle;
- ofn.nMaxFileTitle = MAXFILENAME;
+ ofn.nMaxFileTitle = MAXPATHLEN;
ofn.lpstrTitle = NULL;
ofn.lpstrDefExt = NULL;
ofn.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
@@ -564,6 +599,7 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
return TRUE;
default:
+#ifdef ENABLE_NLS
if (LOWORD(wParam) >= ID_LANGS && LOWORD(wParam) <= (ID_LANGS + langsMax)) {
AccBreak = 1;
DestroyWindow(gApp.hWnd);
@@ -571,6 +607,8 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
CreateMainWindow(SW_NORMAL);
return TRUE;
}
+#endif
+ break;
}
break;
@@ -1236,8 +1274,8 @@ BOOL CALLBACK ConfigureCpuDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
void Open_Mcd_Proc(HWND hW, int mcd) {
OPENFILENAME ofn;
- char szFileName[MAXFILENAME];
- char szFileTitle[MAXFILENAME];
+ char szFileName[MAXPATHLEN];
+ char szFileTitle[MAXPATHLEN];
char szFilter[1024];
char *str;
@@ -1286,10 +1324,10 @@ void Open_Mcd_Proc(HWND hW, int mcd) {
ofn.nMaxCustFilter = 0;
ofn.nFilterIndex = 1;
ofn.lpstrFile = szFileName;
- ofn.nMaxFile = MAXFILENAME;
+ ofn.nMaxFile = MAXPATHLEN;
ofn.lpstrInitialDir = "memcards";
ofn.lpstrFileTitle = szFileTitle;
- ofn.nMaxFileTitle = MAXFILENAME;
+ ofn.nMaxFileTitle = MAXPATHLEN;
ofn.lpstrTitle = NULL;
ofn.lpstrDefExt = "MCR";
ofn.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
@@ -1303,8 +1341,8 @@ void Open_Mcd_Proc(HWND hW, int mcd) {
int Open_File_Proc(char *file) {
OPENFILENAME ofn;
- char szFileName[MAXFILENAME];
- char szFileTitle[MAXFILENAME];
+ char szFileName[MAXPATHLEN];
+ char szFileTitle[MAXPATHLEN];
char szFilter[256];
memset(&szFileName, 0, sizeof(szFileName));
@@ -1322,10 +1360,10 @@ int Open_File_Proc(char *file) {
ofn.nMaxCustFilter = 0;
ofn.nFilterIndex = 1;
ofn.lpstrFile = szFileName;
- ofn.nMaxFile = MAXFILENAME;
+ ofn.nMaxFile = MAXPATHLEN;
ofn.lpstrInitialDir = NULL;
ofn.lpstrFileTitle = szFileTitle;
- ofn.nMaxFileTitle = MAXFILENAME;
+ ofn.nMaxFileTitle = MAXPATHLEN;
ofn.lpstrTitle = NULL;
ofn.lpstrDefExt = "EXE";
ofn.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
@@ -1339,8 +1377,8 @@ int Open_File_Proc(char *file) {
int Open_Iso_Proc(char *file) {
OPENFILENAME ofn;
- char szFileName[MAXFILENAME];
- char szFileTitle[MAXFILENAME];
+ char szFileName[MAXPATHLEN];
+ char szFileTitle[MAXPATHLEN];
char szFilter[256];
char *str;
@@ -1365,10 +1403,10 @@ int Open_Iso_Proc(char *file) {
ofn.nMaxCustFilter = 0;
ofn.nFilterIndex = 1;
ofn.lpstrFile = szFileName;
- ofn.nMaxFile = MAXFILENAME;
+ ofn.nMaxFile = MAXPATHLEN;
ofn.lpstrInitialDir = NULL;
ofn.lpstrFileTitle = szFileTitle;
- ofn.nMaxFileTitle = MAXFILENAME;
+ ofn.nMaxFileTitle = MAXPATHLEN;
ofn.lpstrTitle = NULL;
ofn.lpstrDefExt = "ISO";
ofn.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
@@ -1415,9 +1453,11 @@ int Open_Iso_Proc(char *file) {
void CreateMainMenu() {
MENUITEMINFO item;
HMENU submenu[256];
- char *lang;
char buf[256];
+#ifdef ENABLE_NLS
+ char *lang;
int i;
+#endif
item.cbSize = sizeof(MENUITEMINFO);
item.dwTypeData = buf;
@@ -1471,6 +1511,7 @@ void CreateMainMenu() {
ADDSEPARATOR(0);
ADDMENUITEM(0, _("&Plugins && Bios..."), ID_CONFIGURATION);
+#ifdef ENABLE_NLS
ADDSUBMENU(0, _("&Language"));
if (langs != langs) free(langs);
@@ -1494,6 +1535,7 @@ void CreateMainMenu() {
} else {
ADDMENUITEM(0, _("English"), ID_LANGS);
}
+#endif
ADDSUBMENU(0, _("&Help"));
ADDMENUITEM(0, _("&About..."), ID_HELP_ABOUT);
@@ -1566,6 +1608,8 @@ void CreateMainWindow(int nCmdShow) {
ShowWindow(hWnd, nCmdShow);
}
+#ifdef ENABLE_NLS
+
WIN32_FIND_DATA lFindData;
HANDLE lFind;
int lFirst;
@@ -1608,6 +1652,8 @@ void ChangeLanguage(char *lang) {
LoadConfig();
}
+#endif
+
int SysInit() {
if (Config.PsxOut) OpenConsole();
diff --git a/win32/pcsx.rc b/win32/pcsx.rc
index 7e2d6638..4dca7a5e 100644
--- a/win32/pcsx.rc
+++ b/win32/pcsx.rc
@@ -263,7 +263,7 @@ BEGIN
WS_TABSTOP
LTEXT "Data Base:",IDC_LABEL_DATABASE,147,26,44,8,0,
WS_EX_TRANSPARENT
- COMBOBOX 107,194,24,81,224,CBS_DROPDOWNLIST | WS_VSCROLL |
+ COMBOBOX IDC_DATABASE,194,24,81,224,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
LTEXT "Value:",IDC_LABEL_VALUE,7,43,50,8,0,WS_EX_TRANSPARENT
EDITTEXT IDC_VALUEFROM,60,41,80,12,ES_AUTOHSCROLL
@@ -391,7 +391,7 @@ MAIN_LOGO BITMAP "gui\\pcsx.bmp"
// RT_MANIFEST
//
-24 RT_MANIFEST "gui\\pcsx.exe.manifest"
+1 RT_MANIFEST "gui\\pcsx.exe.manifest"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/win32/resource.h b/win32/resource.h
index 5a1ce57d..5aa19f1c 100644
--- a/win32/resource.h
+++ b/win32/resource.h
@@ -14,6 +14,7 @@
#define IDD_CPUCONF 105
#define IDC_VALUETO 105
#define IDC_DATATYPE 106
+#define IDC_DATABASE 107
#define IDD_NETPLAY 108
#define IDC_LABEL_RESULTSFOUND 108
#define IDD_CONNECT 109