fix #408 About Config Files not showing

This commit is contained in:
zilmar 2015-04-20 18:33:38 +10:00
parent edda4f0555
commit bb9023292c
1 changed files with 33 additions and 35 deletions

View File

@ -158,15 +158,13 @@ void CMainGui::AboutIniBox (void)
DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_About_Ini), m_hMainWindow, (DLGPROC)AboutIniBoxProc,(LPARAM)this);
}
DWORD CALLBACK AboutIniBoxProc (HWND WndHandle, DWORD uMsg, DWORD wParam, DWORD /*lParam*/)
DWORD CALLBACK AboutIniBoxProc (HWND hDlg, DWORD uMsg, DWORD wParam, DWORD /*lParam*/)
{
static wchar_t RDBHomePage[300], CHTHomePage[300], RDXHomePage[300];
switch (uMsg) {
case WM_INITDIALOG:
{
HWND hDlg = (HWND)WndHandle;
static const DWORD STRING_SIZE = 200;
wchar_t String[STRING_SIZE];
wchar_t String2[STRING_SIZE];
@ -179,11 +177,11 @@ DWORD CALLBACK AboutIniBoxProc (HWND WndHandle, DWORD uMsg, DWORD wParam, DWORD
//Language
SetDlgItemTextW(hDlg,IDC_LAN,GS(INI_CURRENT_LANG));
swprintf(String, L"%s: %s", GS(INI_AUTHOR),GS(LANGUAGE_AUTHOR));
swprintf(String, sizeof(String) / sizeof(String[0]), L"%s: %s", GS(INI_AUTHOR),GS(LANGUAGE_AUTHOR));
SetDlgItemTextW(hDlg,IDC_LAN_AUTHOR,String);
swprintf(String, L"%s: %s",GS(INI_VERSION),GS(LANGUAGE_VERSION));
swprintf(String, sizeof(String) / sizeof(String[0]), L"%s: %s",GS(INI_VERSION),GS(LANGUAGE_VERSION));
SetDlgItemTextW(hDlg,IDC_LAN_VERSION,String);
swprintf(String, L"%s: %s",GS(INI_DATE),GS(LANGUAGE_DATE));
swprintf(String, sizeof(String) / sizeof(String[0]), L"%s: %s",GS(INI_DATE),GS(LANGUAGE_DATE));
SetDlgItemTextW(hDlg,IDC_LAN_DATE,String);
if (wcslen(GS(LANGUAGE_NAME)) == 0)
{
@ -194,9 +192,8 @@ DWORD CALLBACK AboutIniBoxProc (HWND WndHandle, DWORD uMsg, DWORD wParam, DWORD
}
//RDB
stdstr IniFile = g_Settings->LoadString(SupportFile_RomDatabase).c_str();
SetDlgItemTextW(hDlg,IDC_RDB,GS(INI_CURRENT_RDB));
GetPrivateProfileStringW(L"Meta", L"Author", L"", String, STRING_SIZE, (wchar_t *)IniFile.c_str());
CIniFile RdbIniFile(g_Settings->LoadString(SupportFile_RomDatabase).c_str());
wcsncpy(String, RdbIniFile.GetString("Meta","Author","").ToUTF16().c_str(),sizeof(String) / sizeof(String[0]));
if (wcslen(String) == 0)
{
EnableWindow(GetDlgItem(hDlg,IDC_RDB),FALSE);
@ -205,24 +202,27 @@ DWORD CALLBACK AboutIniBoxProc (HWND WndHandle, DWORD uMsg, DWORD wParam, DWORD
EnableWindow(GetDlgItem(hDlg,IDC_RDB_DATE),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_RDB_HOME),FALSE);
}
swprintf(String2,L"%s: %s",GS(INI_AUTHOR),String);
swprintf(String2, sizeof(String2) / sizeof(String2[0]),L"%s: %s",GS(INI_AUTHOR),String);
SetDlgItemTextW(hDlg,IDC_RDB_AUTHOR,String2);
GetPrivateProfileStringW(L"Meta", L"Version", L"", String, STRING_SIZE, (wchar_t *)IniFile.c_str());
swprintf(String2,L"%s: %s",GS(INI_VERSION),String);
wcsncpy(String, RdbIniFile.GetString("Meta","Version","").ToUTF16().c_str(),sizeof(String) / sizeof(String[0]));
swprintf(String2, sizeof(String2) / sizeof(String2[0]),L"%s: %s",GS(INI_VERSION),String);
SetDlgItemTextW(hDlg,IDC_RDB_VERSION,String2);
GetPrivateProfileStringW(L"Meta", L"Date", L"", String, STRING_SIZE, (wchar_t *)IniFile.c_str());
swprintf(String2,L"%s: %s",GS(INI_DATE),String);
wcsncpy(String, RdbIniFile.GetString("Meta","Date","").ToUTF16().c_str(),sizeof(String) / sizeof(String[0]));
swprintf(String2, sizeof(String2) / sizeof(String2[0]),L"%s: %s",GS(INI_DATE),String);
SetDlgItemTextW(hDlg,IDC_RDB_DATE,String2);
GetPrivateProfileStringW(L"Meta", L"Homepage", L"", RDBHomePage, sizeof(RDBHomePage), (wchar_t *)IniFile.c_str());
wcsncpy(RDBHomePage, RdbIniFile.GetString("Meta","Homepage","").ToUTF16().c_str(),sizeof(RDBHomePage) / sizeof(RDBHomePage[0]));
SetDlgItemTextW(hDlg,IDC_RDB_HOME,GS(INI_HOMEPAGE));
if (wcslen(RDBHomePage) == 0) {
if (wcslen(RDBHomePage) == 0)
{
EnableWindow(GetDlgItem(hDlg,IDC_RDB_HOME),FALSE);
}
//Cheat
SetDlgItemTextW(hDlg,IDC_CHT,GS(INI_CURRENT_CHT));
IniFile = g_Settings->LoadString(SupportFile_Cheats).c_str();
GetPrivateProfileStringW(L"Meta", L"Author", L"", String, STRING_SIZE, (wchar_t *)IniFile.c_str());
CIniFile CheatIniFile(g_Settings->LoadString(SupportFile_Cheats).c_str());
wcsncpy(String, CheatIniFile.GetString("Meta","Author","").ToUTF16().c_str(),sizeof(String) / sizeof(String[0]));
if (wcslen(String) == 0)
{
EnableWindow(GetDlgItem(hDlg,IDC_CHT),FALSE);
@ -231,15 +231,15 @@ DWORD CALLBACK AboutIniBoxProc (HWND WndHandle, DWORD uMsg, DWORD wParam, DWORD
EnableWindow(GetDlgItem(hDlg,IDC_CHT_DATE),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_CHT_HOME),FALSE);
}
swprintf(String2,L"%s: %s",GS(INI_AUTHOR),String);
swprintf(String2, sizeof(String2) / sizeof(String2[0]),L"%s: %s",GS(INI_AUTHOR),String);
SetDlgItemTextW(hDlg,IDC_CHT_AUTHOR,String2);
GetPrivateProfileStringW(L"Meta", L"Version", L"", String, STRING_SIZE, (wchar_t *)IniFile.c_str());
swprintf(String2,L"%s: %s",GS(INI_VERSION),String);
wcsncpy(String, CheatIniFile.GetString("Meta","Version","").ToUTF16().c_str(),sizeof(String) / sizeof(String[0]));
swprintf(String2, sizeof(String2) / sizeof(String2[0]),L"%s: %s",GS(INI_VERSION),String);
SetDlgItemTextW(hDlg,IDC_CHT_VERSION,String2);
GetPrivateProfileStringW(L"Meta", L"Date", L"", String, STRING_SIZE, (wchar_t *)IniFile.c_str());
swprintf(String2,L"%s: %s",GS(INI_DATE),String);
wcsncpy(String, CheatIniFile.GetString("Meta","Date","").ToUTF16().c_str(),sizeof(String) / sizeof(String[0]));
swprintf(String2, sizeof(String2) / sizeof(String2[0]),L"%s: %s",GS(INI_DATE),String);
SetDlgItemTextW(hDlg,IDC_CHT_DATE,String2);
GetPrivateProfileStringW(L"Meta", L"Homepage", L"", CHTHomePage, sizeof(CHTHomePage), (wchar_t *)IniFile.c_str());
wcsncpy(CHTHomePage, CheatIniFile.GetString("Meta","Homepage","").ToUTF16().c_str(),sizeof(CHTHomePage) / sizeof(CHTHomePage[0]));
SetDlgItemTextW(hDlg,IDC_CHT_HOME,GS(INI_HOMEPAGE));
if (wcslen(CHTHomePage) == 0)
{
@ -248,8 +248,8 @@ DWORD CALLBACK AboutIniBoxProc (HWND WndHandle, DWORD uMsg, DWORD wParam, DWORD
//Extended Info
SetDlgItemTextW(hDlg,IDC_RDX,GS(INI_CURRENT_RDX));
IniFile = g_Settings->LoadString(SupportFile_ExtInfo).c_str();
GetPrivateProfileStringW(L"Meta", L"Author", L"", String, STRING_SIZE, (wchar_t *)IniFile.c_str());
CIniFile RdxIniFile(g_Settings->LoadString(SupportFile_ExtInfo).c_str());
wcsncpy(String, RdxIniFile.GetString("Meta","Author","").ToUTF16().c_str(),sizeof(String) / sizeof(String[0]));
if (wcslen(String) == 0)
{
EnableWindow(GetDlgItem(hDlg,IDC_RDX),FALSE);
@ -258,23 +258,21 @@ DWORD CALLBACK AboutIniBoxProc (HWND WndHandle, DWORD uMsg, DWORD wParam, DWORD
EnableWindow(GetDlgItem(hDlg,IDC_RDX_DATE),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_RDX_HOME),FALSE);
}
swprintf(String2,L"%s: %s",GS(INI_AUTHOR),String);
swprintf(String2, sizeof(String2) / sizeof(String2[0]),L"%s: %s",GS(INI_AUTHOR),String);
SetDlgItemTextW(hDlg,IDC_RDX_AUTHOR,String2);
GetPrivateProfileStringW(L"Meta", L"Version", L"", String, STRING_SIZE, (wchar_t *)IniFile.c_str());
swprintf(String2,L"%s: %s",GS(INI_VERSION),String);
wcsncpy(String, RdxIniFile.GetString("Meta","Version","").ToUTF16().c_str(),sizeof(String) / sizeof(String[0]));
swprintf(String2, sizeof(String2) / sizeof(String2[0]),L"%s: %s",GS(INI_VERSION),String);
SetDlgItemTextW(hDlg,IDC_RDX_VERSION,String2);
GetPrivateProfileStringW(L"Meta", L"Date", L"", String, STRING_SIZE, (wchar_t *)IniFile.c_str());
swprintf(String2,L"%s: %s",GS(INI_DATE),String);
wcsncpy(String, RdxIniFile.GetString("Meta","Date","").ToUTF16().c_str(),sizeof(String) / sizeof(String[0]));
swprintf(String2, sizeof(String2) / sizeof(String2[0]),L"%s: %s",GS(INI_DATE),String);
SetDlgItemTextW(hDlg,IDC_RDX_DATE,String2);
GetPrivateProfileStringW(L"Meta", L"Homepage", L"", RDXHomePage, sizeof(CHTHomePage), (wchar_t *)IniFile.c_str());
wcsncpy(RDXHomePage, RdxIniFile.GetString("Meta","Homepage","").ToUTF16().c_str(),sizeof(RDXHomePage) / sizeof(RDXHomePage[0]));
SetDlgItemTextW(hDlg,IDC_RDX_HOME,GS(INI_HOMEPAGE));
if (wcslen(RDXHomePage) == 0)
{
EnableWindow(GetDlgItem(hDlg,IDC_RDX_HOME),FALSE);
}
SetDlgItemTextW(hDlg, IDOK, GS(CHEAT_OK));
}
break;
case WM_COMMAND:
@ -285,7 +283,7 @@ DWORD CALLBACK AboutIniBoxProc (HWND WndHandle, DWORD uMsg, DWORD wParam, DWORD
case IDC_RDX_HOME: ShellExecuteW(NULL,L"open",RDXHomePage,NULL,NULL,SW_SHOWNORMAL); break;
case IDOK:
case IDCANCEL:
EndDialog((HWND)WndHandle,0);
EndDialog(hDlg,0);
break;
}
default: