From 9968c229ec8ec22365a613a6a24f25fed021f536 Mon Sep 17 00:00:00 2001 From: diafero Date: Thu, 4 Aug 2011 14:22:59 +0200 Subject: [PATCH 1/6] get rid of a bunch of pointlessnes: GT detection, internal client expiration (?!?), a hard-coded GUID --- Sources/Plasma/Apps/plClient/winmain.cpp | 286 ++++++----------------- 1 file changed, 72 insertions(+), 214 deletions(-) diff --git a/Sources/Plasma/Apps/plClient/winmain.cpp b/Sources/Plasma/Apps/plClient/winmain.cpp index 8d647953..4ddd119d 100644 --- a/Sources/Plasma/Apps/plClient/winmain.cpp +++ b/Sources/Plasma/Apps/plClient/winmain.cpp @@ -157,28 +157,18 @@ static TGUNIXAppClose pTGUNIXAppClose; // LoginDialogParam //============================================================================ struct LoginDialogParam { - bool fromGT; ENetError authError; wchar accountName[kMaxAccountNameLength]; }; -bool AuthenticateNetClientComm(ENetError* result, HWND parentWnd); -bool IsExpired(); -void GetCryptKey(UInt32* cryptKey, unsigned size); -static void SaveUserPass (char *username, char *password, ShaDigest *pNamePassHash, bool remember_password, - bool fromGT); -static void LoadUserPass (const wchar *accountName, char *username, ShaDigest *pNamePassHash, bool *pRemember, - bool fromGT, int *pFocus); -static void AuthFailedStrings (ENetError authError, bool fromGT, +static bool AuthenticateNetClientComm(ENetError* result, HWND parentWnd); +static void GetCryptKey(UInt32* cryptKey, unsigned size); +static void SaveUserPass (char *username, char *password, ShaDigest *pNamePassHash, bool remember_password); +static void LoadUserPass (const wchar *accountName, char *username, ShaDigest *pNamePassHash, bool *pRemember, int *pFocus); +static void AuthFailedStrings (ENetError authError, const char **ppStr1, const char **ppStr2, const wchar **ppWStr); -#if 0 -// For networking -const GUID NEXUS_GUID = { - 0x5bfdb060, 0x6a4, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e}; -#endif - // Detect whether we're running under TRANSGAMING Cider //============================================================================== @@ -206,14 +196,14 @@ static void TGDoCiderDetection () pTGUNIXAppClose = (TGUNIXAppClose)GetProcAddress (hMod, "TGUNIXAppClose"); } -static bool TGRunLoginDialog (const wchar *accountName, bool fromGT) +static bool TGRunLoginDialog (const wchar *accountName) { ShaDigest NamePassHash; char Username[kMaxAccountNameLength + 5]; int Focus; bool bRemember = false; - LoadUserPass (accountName, Username, &NamePassHash, &bRemember, fromGT, &Focus); + LoadUserPass (accountName, Username, &NamePassHash, &bRemember, &Focus); while (true) { @@ -282,7 +272,7 @@ static bool TGRunLoginDialog (const wchar *accountName, bool fromGT) if (Remember[0] == 'y') bRemember = true; - SaveUserPass (Username, Password, &NamePassHash, bRemember, fromGT); + SaveUserPass (Username, Password, &NamePassHash, bRemember); // Do login & see if it failed ENetError auth; @@ -298,7 +288,7 @@ static bool TGRunLoginDialog (const wchar *accountName, bool fromGT) unsigned int Len; char *pTmpStr; - AuthFailedStrings (auth, fromGT, &pStr1, &pStr2, &pWStr); + AuthFailedStrings (auth, &pStr1, &pStr2, &pWStr); Len = StrLen (pStr1) + 1; if (pStr2) @@ -645,7 +635,7 @@ BOOL CALLBACK AuthDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa return DefWindowProc(hwndDlg, uMsg, wParam, lParam); } -bool AuthenticateNetClientComm(ENetError* result, HWND parentWnd) +static bool AuthenticateNetClientComm(ENetError* result, HWND parentWnd) { if (!NetCliAuthQueryConnected()) NetCommConnect(); @@ -878,7 +868,7 @@ inline static dword ToBigEndian (dword value) { return ((value) << 24) | ((value & 0x0000ff00) << 8) | ((value & 0x00ff0000) >> 8) | ((value) >> 24); } -static void AuthFailedStrings (ENetError authError, bool fromGT, +static void AuthFailedStrings (ENetError authError, const char **ppStr1, const char **ppStr2, const wchar **ppWStr) { @@ -912,10 +902,7 @@ static void AuthFailedStrings (ENetError authError, bool fromGT, *ppStr2 = "Disconnected from Myst Online."; break; case kNetErrAuthenticationFailed: - if (fromGT) - *ppStr2 = "GameTap authentication failed, please enter your GameTap username and password."; - else - *ppStr2 = "Incorrect password.\n\nMake sure CAPS LOCK is not on."; + *ppStr2 = "Incorrect password.\n\nMake sure CAPS LOCK is not on."; break; case kNetErrGTServerError: case kNetErrGameTapConnectionFailed: @@ -943,7 +930,7 @@ BOOL CALLBACK AuthFailedDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR const char *pStr1, *pStr2; const wchar *pWStr; - AuthFailedStrings (loginParam->authError, loginParam->fromGT, + AuthFailedStrings (loginParam->authError, &pStr1, &pStr2, &pWStr); if (pStr1) @@ -1014,8 +1001,7 @@ BOOL CALLBACK UruTOSDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l return FALSE; } -static void SaveUserPass (char *username, char *password, ShaDigest *pNamePassHash, bool remember_password, - bool fromGT) +static void SaveUserPass (char *username, char *password, ShaDigest *pNamePassHash, bool remember_password) { UInt32 cryptKey[4]; ZeroMemory(cryptKey, sizeof(cryptKey)); @@ -1061,34 +1047,32 @@ static void SaveUserPass (char *username, char *password, ShaDigest *pNamePassHa else NetCommSetAuthTokenAndOS(nil, L"win"); - if (!fromGT) { - wchar fileAndPath[MAX_PATH]; - PathGetInitDirectory(fileAndPath, arrsize(fileAndPath)); - PathAddFilename(fileAndPath, fileAndPath, L"login.dat", arrsize(fileAndPath)); + wchar fileAndPath[MAX_PATH]; + PathGetInitDirectory(fileAndPath, arrsize(fileAndPath)); + PathAddFilename(fileAndPath, fileAndPath, L"login.dat", arrsize(fileAndPath)); #ifndef PLASMA_EXTERNAL_RELEASE - // internal builds can use the local init directory - wchar localFileAndPath[MAX_PATH]; - StrCopy(localFileAndPath, L"init\\login.dat", arrsize(localFileAndPath)); - if (PathDoesFileExist(localFileAndPath)) - StrCopy(fileAndPath, localFileAndPath, arrsize(localFileAndPath)); + // internal builds can use the local init directory + wchar localFileAndPath[MAX_PATH]; + StrCopy(localFileAndPath, L"init\\login.dat", arrsize(localFileAndPath)); + if (PathDoesFileExist(localFileAndPath)) + StrCopy(fileAndPath, localFileAndPath, arrsize(localFileAndPath)); #endif - hsStream* stream = plEncryptedStream::OpenEncryptedFileWrite(fileAndPath, cryptKey); - if (stream) - { - stream->Write(sizeof(cryptKey), cryptKey); - stream->WriteSafeString(username); - stream->Writebool(remember_password); - if (remember_password) - stream->Write(sizeof(pNamePassHash->data), pNamePassHash->data); - stream->Close(); - delete stream; - } + hsStream* stream = plEncryptedStream::OpenEncryptedFileWrite(fileAndPath, cryptKey); + if (stream) + { + stream->Write(sizeof(cryptKey), cryptKey); + stream->WriteSafeString(username); + stream->Writebool(remember_password); + if (remember_password) + stream->Write(sizeof(pNamePassHash->data), pNamePassHash->data); + stream->Close(); + delete stream; } } static void LoadUserPass (const wchar *accountName, char *username, ShaDigest *pNamePassHash, bool *pRemember, - bool fromGT, int *pFocus) + int *pFocus) { UInt32 cryptKey[4]; ZeroMemory(cryptKey, sizeof(cryptKey)); @@ -1098,55 +1082,47 @@ static void LoadUserPass (const wchar *accountName, char *username, ShaDigest *p *pRemember = false; username[0] = '\0'; - if (!fromGT) - { - wchar fileAndPath[MAX_PATH]; - PathGetInitDirectory(fileAndPath, arrsize(fileAndPath)); - PathAddFilename(fileAndPath, fileAndPath, L"login.dat", arrsize(fileAndPath)); + wchar fileAndPath[MAX_PATH]; + PathGetInitDirectory(fileAndPath, arrsize(fileAndPath)); + PathAddFilename(fileAndPath, fileAndPath, L"login.dat", arrsize(fileAndPath)); #ifndef PLASMA_EXTERNAL_RELEASE - // internal builds can use the local init directory - wchar localFileAndPath[MAX_PATH]; - StrCopy(localFileAndPath, L"init\\login.dat", arrsize(localFileAndPath)); - if (PathDoesFileExist(localFileAndPath)) - StrCopy(fileAndPath, localFileAndPath, arrsize(localFileAndPath)); + // internal builds can use the local init directory + wchar localFileAndPath[MAX_PATH]; + StrCopy(localFileAndPath, L"init\\login.dat", arrsize(localFileAndPath)); + if (PathDoesFileExist(localFileAndPath)) + StrCopy(fileAndPath, localFileAndPath, arrsize(localFileAndPath)); #endif - hsStream* stream = plEncryptedStream::OpenEncryptedFile(fileAndPath, true, cryptKey); - if (stream && !stream->AtEnd()) - { - UInt32 savedKey[4]; - stream->Read(sizeof(savedKey), savedKey); - - if (memcmp(cryptKey, savedKey, sizeof(savedKey)) == 0) - { - temp = stream->ReadSafeString(); + hsStream* stream = plEncryptedStream::OpenEncryptedFile(fileAndPath, true, cryptKey); + if (stream && !stream->AtEnd()) + { + UInt32 savedKey[4]; + stream->Read(sizeof(savedKey), savedKey); - if (temp) - { - StrCopy(username, temp, kMaxAccountNameLength); - delete temp; - } - else - username[0] = '\0'; + if (memcmp(cryptKey, savedKey, sizeof(savedKey)) == 0) + { + temp = stream->ReadSafeString(); - *pRemember = stream->Readbool(); + if (temp) + { + StrCopy(username, temp, kMaxAccountNameLength); + delete temp; + } + else + username[0] = '\0'; - if (*pRemember) - { - stream->Read(sizeof(pNamePassHash->data), pNamePassHash->data); - *pFocus = IDOK; - } - else - *pFocus = IDC_URULOGIN_PASSWORD; - } + *pRemember = stream->Readbool(); - stream->Close(); - delete stream; - } + if (*pRemember) + { + stream->Read(sizeof(pNamePassHash->data), pNamePassHash->data); + *pFocus = IDOK; } else - { - StrToAnsi (username, accountName, kMaxAccountNameLength); *pFocus = IDC_URULOGIN_PASSWORD; + } + + stream->Close(); + delete stream; } } @@ -1219,14 +1195,12 @@ BOOL CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM int focus_control = IDC_URULOGIN_USERNAME; - LoadUserPass (loginParam->accountName, username, &namePassHash, &remember_password, loginParam->fromGT, &focus_control); + LoadUserPass (loginParam->accountName, username, &namePassHash, &remember_password, &focus_control); SetDlgItemText(hwndDlg, IDC_URULOGIN_USERNAME, username); CheckDlgButton(hwndDlg, IDC_URULOGIN_REMEMBERPASS, remember_password ? BST_CHECKED : BST_UNCHECKED); if (remember_password) SetDlgItemText(hwndDlg, IDC_URULOGIN_PASSWORD, FAKE_PASS_STRING); - if (loginParam->fromGT) - EnableWindow(GetDlgItem(hwndDlg, IDC_URULOGIN_REMEMBERPASS), FALSE); SetFocus(GetDlgItem(hwndDlg, focus_control)); @@ -1288,7 +1262,7 @@ BOOL CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM GetDlgItemText(hwndDlg, IDC_URULOGIN_PASSWORD, password, kMaxPasswordLength); remember_password = (IsDlgButtonChecked(hwndDlg, IDC_URULOGIN_REMEMBERPASS) == BST_CHECKED); - SaveUserPass (username, password, &namePassHash, remember_password, loginParam->fromGT); + SaveUserPass (username, password, &namePassHash, remember_password); LoginDialogParam loginParam; MemSet(&loginParam, 0, sizeof(loginParam)); @@ -1589,16 +1563,10 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC return PARABLE_NORMAL_EXIT; } - if (IsExpired()) - { - hsMessageBox("This client is over 30 days old. You need to get a new one.", "Error", hsMessageBoxNormal); - return PARABLE_NORMAL_EXIT; - } - - FILE *serverini = _wfopen(serverIni, L"rb"); - if (serverini) + FILE *serverIniFile = _wfopen(serverIni, L"rb"); + if (serverIniFile) { - fclose(serverini); + fclose(serverIniFile); pfConsoleEngine tempConsole; tempConsole.ExecuteFile(serverIni); } @@ -1616,46 +1584,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC curl_global_init(CURL_GLOBAL_ALL); wchar acctName[kMaxAccountNameLength]; - - // if we're being launched from gametap then don't use the intro dialogs - if (StrStrI(lpCmdLine, "screenname=")) { - doIntroDialogs = false; - - wchar authToken[kMaxPublisherAuthKeyLength]; - wchar os[kMaxGTOSIdLength]; - ShaDigest emptyDigest; - - MemSet(acctName, 0, sizeof(acctName)); - MemSet(authToken, 0, sizeof(authToken)); - MemSet(os, 0, sizeof(os)); - - const char* temp = lpCmdLine; - char token[128]; - while (StrTokenize(&temp, token, arrsize(token), " =")) { - if (StrCmpI(token, "screenname") == 0) { - if (!StrTokenize(&temp, token, arrsize(token), " =")) - break; - - StrToUnicode(acctName, token, arrsize(acctName)); - } - else if (StrCmpI(token, "authtoken") == 0) { - if (!StrTokenize(&temp, token, arrsize(token), " =")) - break; - - StrToUnicode(authToken, token, arrsize(authToken)); - } - else if (StrCmpI(token, "os") == 0) { - if (!StrTokenize(&temp, token, arrsize(token), " =")) - break; - - StrToUnicode(os, token, arrsize(os)); - } - } - - NetCommSetAccountUsernamePassword(acctName, emptyDigest); - NetCommSetAuthTokenAndOS(authToken, os); - } - bool needExit = false; LoginDialogParam loginParam; MemSet(&loginParam, 0, sizeof(loginParam)); @@ -1668,7 +1596,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC if (IS_NET_ERROR(auth) || cancelled) { doIntroDialogs = true; - loginParam.fromGT = true; loginParam.authError = auth; StrCopy(loginParam.accountName, acctName, arrsize(loginParam.accountName)); @@ -1681,7 +1608,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC if (doIntroDialogs) { if (TGIsCider) - needExit = !TGRunLoginDialog (loginParam.accountName, loginParam.fromGT); + needExit = !TGRunLoginDialog (loginParam.accountName); else if (::DialogBoxParam( hInst, MAKEINTRESOURCE( IDD_URULOGIN_MAIN ), NULL, UruLoginDialogProc, (LPARAM)&loginParam ) <= 0) needExit = true; } @@ -1867,76 +1794,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC return PARABLE_NORMAL_EXIT; } -bool IsExpired() -{ - bool expired = false; - -#ifndef PLASMA_EXTERNAL_RELEASE - char ourPath[MAX_PATH]; - GetModuleFileName(NULL, ourPath, sizeof(ourPath)); - DWORD ok = 0; - DWORD size = GetFileVersionInfoSize(ourPath, &ok); - if (size > 0) - { - void* data = TRACKED_NEW UInt8[size]; - GetFileVersionInfo(ourPath, ok, size, data); - - unsigned int descLen = 0; - void* desc = nil; - if (VerQueryValue(data, "\\StringFileInfo\\040904B0\\FileDescription", &desc, &descLen)) - { - const char* buildDateStart = strstr((const char*)desc, " - Built "); - if (buildDateStart) - { - buildDateStart += strlen(" - Built "); - const char* buildDateEnd = strstr(buildDateStart, " at"); - if (buildDateEnd) - { - int len = buildDateEnd-buildDateStart; - - char buf[32]; - strncpy(buf, buildDateStart, len); - buf[len] = '\0'; - - int month = atoi(strtok(buf, "/")); - int day = atoi(strtok(nil, "/")); - int year = atoi(strtok(nil, "/")); - - SYSTEMTIME curTime, buildTime; - GetLocalTime(&buildTime); - GetLocalTime(&curTime); - buildTime.wDay = day; - buildTime.wMonth = month; - buildTime.wYear = year; - - ULARGE_INTEGER iCurTime, iBuildTime; - FILETIME ft; - - SystemTimeToFileTime(&curTime, &ft); - iCurTime.LowPart = ft.dwLowDateTime; - iCurTime.HighPart = ft.dwHighDateTime; - - SystemTimeToFileTime(&buildTime, &ft); - iBuildTime.LowPart = ft.dwLowDateTime; - iBuildTime.HighPart = ft.dwHighDateTime; - - int secsOld = (int)((iCurTime.QuadPart - iBuildTime.QuadPart) / 10000000); - int daysOld = secsOld / (60 * 60 * 24); - - if (daysOld > 30) - expired = true; - } - } - } - - delete [] data; - } -#endif - - return expired; -} - -void GetCryptKey(UInt32* cryptKey, unsigned numElements) +static void GetCryptKey(UInt32* cryptKey, unsigned numElements) { char volName[] = "C:\\"; int index = 0; From 84b5eef9eb118a658d4a98af9d090921a0ad122b Mon Sep 17 00:00:00 2001 From: diafero Date: Thu, 4 Aug 2011 15:16:43 +0200 Subject: [PATCH 2/6] fix plClient -SkipLoginDialog --- Sources/Plasma/Apps/plClient/winmain.cpp | 149 ++++++++++------------- 1 file changed, 66 insertions(+), 83 deletions(-) diff --git a/Sources/Plasma/Apps/plClient/winmain.cpp b/Sources/Plasma/Apps/plClient/winmain.cpp index 4ddd119d..cc5b666f 100644 --- a/Sources/Plasma/Apps/plClient/winmain.cpp +++ b/Sources/Plasma/Apps/plClient/winmain.cpp @@ -158,13 +158,16 @@ static TGUNIXAppClose pTGUNIXAppClose; //============================================================================ struct LoginDialogParam { ENetError authError; - wchar accountName[kMaxAccountNameLength]; + char username[kMaxAccountNameLength]; + ShaDigest namePassHash; + bool remember; + int focus; }; static bool AuthenticateNetClientComm(ENetError* result, HWND parentWnd); static void GetCryptKey(UInt32* cryptKey, unsigned size); -static void SaveUserPass (char *username, char *password, ShaDigest *pNamePassHash, bool remember_password); -static void LoadUserPass (const wchar *accountName, char *username, ShaDigest *pNamePassHash, bool *pRemember, int *pFocus); +static void SaveUserPass (LoginDialogParam *pLoginParam, char *password); +static void LoadUserPass (LoginDialogParam *pLoginParam); static void AuthFailedStrings (ENetError authError, const char **ppStr1, const char **ppStr2, const wchar **ppWStr); @@ -196,15 +199,8 @@ static void TGDoCiderDetection () pTGUNIXAppClose = (TGUNIXAppClose)GetProcAddress (hMod, "TGUNIXAppClose"); } -static bool TGRunLoginDialog (const wchar *accountName) +static bool TGRunLoginDialog (LoginDialogParam *pLoginParam) { - ShaDigest NamePassHash; - char Username[kMaxAccountNameLength + 5]; - int Focus; - bool bRemember = false; - - LoadUserPass (accountName, Username, &NamePassHash, &bRemember, &Focus); - while (true) { LPVOID pApp; @@ -221,17 +217,17 @@ static bool TGRunLoginDialog (const wchar *accountName) } // Send user/pwd/remember - pTGUNIXAppWriteLine (pApp, Username); - if (bRemember) + pTGUNIXAppWriteLine (pApp, pLoginParam->username); + if (pLoginParam->remember) pTGUNIXAppWriteLine (pApp, FAKE_PASS_STRING); else pTGUNIXAppWriteLine (pApp, ""); - if (bRemember) + if (pLoginParam->remember) pTGUNIXAppWriteLine (pApp, "y"); else pTGUNIXAppWriteLine (pApp, "n"); - if (!pTGUNIXAppReadLine (pApp, Username, sizeof (Username))) + if (!pTGUNIXAppReadLine (pApp, pLoginParam->username, sizeof (pLoginParam->username))) { pTGUNIXAppClose (pApp); hsMessageBox ("Incomplete or corrupted installation!\nUnable to locate Login dialog", @@ -240,13 +236,13 @@ static bool TGRunLoginDialog (const wchar *accountName) } // Check if user selected 'Cancel' - if (StrCmp (Username, "text:", 5) != 0) + if (StrCmp (pLoginParam->username, "text:", 5) != 0) { pTGUNIXAppClose (pApp); return false; } - memmove (Username, Username + 5, StrLen (Username) - 5); - Username[StrLen (Username) - 5] = '\0'; + memmove (pLoginParam->username, pLoginParam->username + 5, StrLen (pLoginParam->username) - 5); + pLoginParam->username[StrLen (pLoginParam->username) - 5] = '\0'; char Password[kMaxPasswordLength]; if (!pTGUNIXAppReadLine (pApp, Password, sizeof (Password))) @@ -268,11 +264,8 @@ static bool TGRunLoginDialog (const wchar *accountName) pTGUNIXAppClose (pApp); - bRemember = false; - if (Remember[0] == 'y') - bRemember = true; - - SaveUserPass (Username, Password, &NamePassHash, bRemember); + pLoginParam->remember = (Remember[0] == 'y'); + SaveUserPass (pLoginParam, Password); // Do login & see if it failed ENetError auth; @@ -1001,7 +994,7 @@ BOOL CALLBACK UruTOSDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l return FALSE; } -static void SaveUserPass (char *username, char *password, ShaDigest *pNamePassHash, bool remember_password) +static void SaveUserPass (LoginDialogParam *pLoginParam, char *password) { UInt32 cryptKey[4]; ZeroMemory(cryptKey, sizeof(cryptKey)); @@ -1010,7 +1003,7 @@ static void SaveUserPass (char *username, char *password, ShaDigest *pNamePassHa wchar wusername[kMaxAccountNameLength]; wchar wpassword[kMaxPasswordLength]; - StrToUnicode(wusername, username, arrsize(wusername)); + StrToUnicode(wusername, pLoginParam->username, arrsize(wusername)); // if the password field is the fake string then we've already // loaded the namePassHash from the file @@ -1024,24 +1017,24 @@ static void SaveUserPass (char *username, char *password, ShaDigest *pNamePassHa if (StrLen(domain) == 0 || StrCmpI(domain, L"gametap") == 0) { CryptDigest( kCryptSha1, - pNamePassHash, + &pLoginParam->namePassHash, StrLen(password) * sizeof(password[0]), password ); if (IsMachineLittleEndian()) { - pNamePassHash->data[0] = ToBigEndian(pNamePassHash->data[0]); - pNamePassHash->data[1] = ToBigEndian(pNamePassHash->data[1]); - pNamePassHash->data[2] = ToBigEndian(pNamePassHash->data[2]); - pNamePassHash->data[3] = ToBigEndian(pNamePassHash->data[3]); - pNamePassHash->data[4] = ToBigEndian(pNamePassHash->data[4]); + pLoginParam->namePassHash.data[0] = ToBigEndian(pLoginParam->namePassHash.data[0]); + pLoginParam->namePassHash.data[1] = ToBigEndian(pLoginParam->namePassHash.data[1]); + pLoginParam->namePassHash.data[2] = ToBigEndian(pLoginParam->namePassHash.data[2]); + pLoginParam->namePassHash.data[3] = ToBigEndian(pLoginParam->namePassHash.data[3]); + pLoginParam->namePassHash.data[4] = ToBigEndian(pLoginParam->namePassHash.data[4]); } } else - CryptHashPassword(wusername, wpassword, pNamePassHash); + CryptHashPassword(wusername, wpassword, &pLoginParam->namePassHash); } - NetCommSetAccountUsernamePassword(wusername, *pNamePassHash); + NetCommSetAccountUsernamePassword(wusername, pLoginParam->namePassHash); if (TGIsCider) NetCommSetAuthTokenAndOS(nil, L"mac"); else @@ -1061,26 +1054,25 @@ static void SaveUserPass (char *username, char *password, ShaDigest *pNamePassHa if (stream) { stream->Write(sizeof(cryptKey), cryptKey); - stream->WriteSafeString(username); - stream->Writebool(remember_password); - if (remember_password) - stream->Write(sizeof(pNamePassHash->data), pNamePassHash->data); + stream->WriteSafeString(pLoginParam->username); + stream->Writebool(pLoginParam->remember); + if (pLoginParam->remember) + stream->Write(sizeof(pLoginParam->namePassHash.data), pLoginParam->namePassHash.data); stream->Close(); delete stream; } } -static void LoadUserPass (const wchar *accountName, char *username, ShaDigest *pNamePassHash, bool *pRemember, - int *pFocus) +static void LoadUserPass (LoginDialogParam *pLoginParam) { - UInt32 cryptKey[4]; - ZeroMemory(cryptKey, sizeof(cryptKey)); - GetCryptKey(cryptKey, arrsize(cryptKey)); + UInt32 cryptKey[4]; + ZeroMemory(cryptKey, sizeof(cryptKey)); + GetCryptKey(cryptKey, arrsize(cryptKey)); - char* temp; - *pRemember = false; - username[0] = '\0'; + char* temp; + pLoginParam->remember = false; + pLoginParam->username[0] = '\0'; wchar fileAndPath[MAX_PATH]; PathGetInitDirectory(fileAndPath, arrsize(fileAndPath)); @@ -1104,21 +1096,21 @@ static void LoadUserPass (const wchar *accountName, char *username, ShaDigest *p if (temp) { - StrCopy(username, temp, kMaxAccountNameLength); + StrCopy(pLoginParam->username, temp, kMaxAccountNameLength); delete temp; } - else - username[0] = '\0'; - *pRemember = stream->Readbool(); + pLoginParam->remember = stream->Readbool(); - if (*pRemember) + if (pLoginParam->remember) { - stream->Read(sizeof(pNamePassHash->data), pNamePassHash->data); - *pFocus = IDOK; + stream->Read(sizeof(pLoginParam->namePassHash.data), pLoginParam->namePassHash.data); + pLoginParam->focus = IDOK; } else - *pFocus = IDC_URULOGIN_PASSWORD; + { + pLoginParam->focus = IDC_URULOGIN_PASSWORD; + } } stream->Close(); @@ -1173,8 +1165,7 @@ void StatusCallback(void *param) BOOL CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) { - static ShaDigest namePassHash; - static LoginDialogParam* loginParam; + static LoginDialogParam* pLoginParam; static bool showAuthFailed = false; switch( uMsg ) @@ -1183,28 +1174,21 @@ BOOL CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM { s_loginDlgRunning = true; _beginthread(StatusCallback, 0, hwndDlg); - loginParam = (LoginDialogParam*)lParam; + pLoginParam = (LoginDialogParam*)lParam; SetWindowText(hwndDlg, "Login"); SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(gHInst, MAKEINTRESOURCE(IDI_ICON_DIRT))); EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE); - char username[kMaxAccountNameLength]; - bool remember_password = false; - - int focus_control = IDC_URULOGIN_USERNAME; - - LoadUserPass (loginParam->accountName, username, &namePassHash, &remember_password, &focus_control); - - SetDlgItemText(hwndDlg, IDC_URULOGIN_USERNAME, username); - CheckDlgButton(hwndDlg, IDC_URULOGIN_REMEMBERPASS, remember_password ? BST_CHECKED : BST_UNCHECKED); - if (remember_password) + SetDlgItemText(hwndDlg, IDC_URULOGIN_USERNAME, pLoginParam->username); + CheckDlgButton(hwndDlg, IDC_URULOGIN_REMEMBERPASS, pLoginParam->remember ? BST_CHECKED : BST_UNCHECKED); + if (pLoginParam->remember) SetDlgItemText(hwndDlg, IDC_URULOGIN_PASSWORD, FAKE_PASS_STRING); - SetFocus(GetDlgItem(hwndDlg, focus_control)); + SetFocus(GetDlgItem(hwndDlg, pLoginParam->focus)); - if (IS_NET_ERROR(loginParam->authError)) + if (IS_NET_ERROR(pLoginParam->authError)) { showAuthFailed = true; } @@ -1254,25 +1238,22 @@ BOOL CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM bool ok = (LOWORD(wParam) == IDOK); if (ok) { - char username[kMaxAccountNameLength]; char password[kMaxPasswordLength]; - bool remember_password = false; - GetDlgItemText(hwndDlg, IDC_URULOGIN_USERNAME, username, kMaxAccountNameLength); + GetDlgItemText(hwndDlg, IDC_URULOGIN_USERNAME, pLoginParam->username, kMaxAccountNameLength); GetDlgItemText(hwndDlg, IDC_URULOGIN_PASSWORD, password, kMaxPasswordLength); - remember_password = (IsDlgButtonChecked(hwndDlg, IDC_URULOGIN_REMEMBERPASS) == BST_CHECKED); + pLoginParam->remember = (IsDlgButtonChecked(hwndDlg, IDC_URULOGIN_REMEMBERPASS) == BST_CHECKED); - SaveUserPass (username, password, &namePassHash, remember_password); + SaveUserPass (pLoginParam, password); - LoginDialogParam loginParam; - MemSet(&loginParam, 0, sizeof(loginParam)); - bool cancelled = AuthenticateNetClientComm(&loginParam.authError, hwndDlg); + MemSet(&pLoginParam->authError, 0, sizeof(pLoginParam->authError)); + bool cancelled = AuthenticateNetClientComm(&pLoginParam->authError, hwndDlg); - if (IS_NET_SUCCESS(loginParam.authError) && !cancelled) + if (IS_NET_SUCCESS(pLoginParam->authError) && !cancelled) EndDialog(hwndDlg, ok); else { if (!cancelled) - ::DialogBoxParam(gHInst, MAKEINTRESOURCE( IDD_AUTHFAILED ), hwndDlg, AuthFailedDialogProc, (LPARAM)&loginParam); + ::DialogBoxParam(gHInst, MAKEINTRESOURCE( IDD_AUTHFAILED ), hwndDlg, AuthFailedDialogProc, (LPARAM)pLoginParam); else { NetCommDisconnect(); @@ -1312,7 +1293,7 @@ BOOL CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM { case AUTH_FAILED_TIMER: KillTimer(hwndDlg, AUTH_FAILED_TIMER); - ::DialogBoxParam(gHInst, MAKEINTRESOURCE( IDD_AUTHFAILED ), hwndDlg, AuthFailedDialogProc, (LPARAM)loginParam); + ::DialogBoxParam(gHInst, MAKEINTRESOURCE( IDD_AUTHFAILED ), hwndDlg, AuthFailedDialogProc, (LPARAM)pLoginParam); return TRUE; case AUTH_LOGIN_TIMER: @@ -1583,21 +1564,23 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC curl_global_init(CURL_GLOBAL_ALL); - wchar acctName[kMaxAccountNameLength]; bool needExit = false; LoginDialogParam loginParam; MemSet(&loginParam, 0, sizeof(loginParam)); + LoadUserPass(&loginParam); - if (!doIntroDialogs) { + if (!doIntroDialogs && loginParam.remember) { ENetError auth; + wchar wusername[kMaxAccountNameLength]; + StrToUnicode(wusername, loginParam.username, arrsize(wusername)); + NetCommSetAccountUsernamePassword(wusername, loginParam.namePassHash); bool cancelled = AuthenticateNetClientComm(&auth, NULL); if (IS_NET_ERROR(auth) || cancelled) { doIntroDialogs = true; loginParam.authError = auth; - StrCopy(loginParam.accountName, acctName, arrsize(loginParam.accountName)); if (cancelled) { @@ -1608,7 +1591,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC if (doIntroDialogs) { if (TGIsCider) - needExit = !TGRunLoginDialog (loginParam.accountName); + needExit = !TGRunLoginDialog(&loginParam); else if (::DialogBoxParam( hInst, MAKEINTRESOURCE( IDD_URULOGIN_MAIN ), NULL, UruLoginDialogProc, (LPARAM)&loginParam ) <= 0) needExit = true; } From f9e6f873b6cc0640490daeb84ac5754d9e5c31f7 Mon Sep 17 00:00:00 2001 From: diafero Date: Fri, 5 Aug 2011 14:14:31 +0200 Subject: [PATCH 3/6] remove unused dialogs from plClient --- Sources/Plasma/Apps/plClient/res/plClient.rc | 51 -------------------- Sources/Plasma/Apps/plClient/res/resource.h | 20 -------- 2 files changed, 71 deletions(-) diff --git a/Sources/Plasma/Apps/plClient/res/plClient.rc b/Sources/Plasma/Apps/plClient/res/plClient.rc index abda8c40..5ad90e40 100644 --- a/Sources/Plasma/Apps/plClient/res/plClient.rc +++ b/Sources/Plasma/Apps/plClient/res/plClient.rc @@ -80,57 +80,6 @@ BEGIN PUSHBUTTON "Copy",IDC_COPY,239,26,50,14 END -IDD_URUTAP_LOGIN DIALOGEX 0, 0, 188, 111 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION -CAPTION "Enter Login Info" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - DEFPUSHBUTTON "Enter",IDOK,33,90,50,14 - PUSHBUTTON "Cancel",IDCANCEL,107,90,50,14 - LTEXT "Username",IDC_STATIC,7,7,38,11 - EDITTEXT IDC_URUTAP_USERNAME,52,7,129,13,ES_AUTOHSCROLL - LTEXT "Password",IDC_STATIC,7,30,38,12 - EDITTEXT IDC_URUTAP_PASSWORD,52,28,129,12,ES_PASSWORD | - ES_AUTOHSCROLL - LTEXT "Server",IDC_STATIC,7,54,35,12 - EDITTEXT IDC_URUTAP_SERVER,51,51,130,13,ES_AUTOHSCROLL - CONTROL "Destroy and recreate player",IDC_URUTAP_DESTROY,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,51,70,130,12 -END - -IDD_URU_LOGIN DIALOGEX 0, 0, 200, 133 -STYLE DS_SETFONT | DS_3DLOOK | WS_POPUP | WS_SYSMENU -EXSTYLE WS_EX_STATICEDGE -FONT 12, "Hobo Std", 500, 0, 0x0 -BEGIN - DEFPUSHBUTTON "Submit",IDOK,139,114,50,14 - PUSHBUTTON "Quit",IDCANCEL,77,114,50,14 - EDITTEXT IDC_USERNAME,65,55,110,12,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,65,71,110,12,ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "Username:",IDC_TEXT_USER,25,58,36,8 - LTEXT "Password:",IDC_TEXT_PASS,27,73,34,8 - LTEXT "Welcome to URU!",IDC_TEXT_WELCOME,72,45,57,8 - CONTROL "Remember Password:",IDC_REMEMBER_PASS,"Button", - BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,23,87,85,10 - GROUPBOX "",IDC_BOX_01,5,30,190,79 - GROUPBOX "",IDC_BOX_02,14,38,172,64 - CONTROL 151,IDC_IMAGE_BANNER,"Static",SS_BITMAP | - SS_REALSIZEIMAGE | WS_BORDER,4,4,192,21,WS_EX_CLIENTEDGE -END - -IDD_URU_EULA DIALOGEX 0, 0, 201, 158 -STYLE DS_SETFONT | WS_POPUP | WS_SYSMENU -FONT 12, "Hobo Std", 500, 0, 0x0 -BEGIN - DEFPUSHBUTTON "Accept",IDOK,141,138,50,14 - PUSHBUTTON "Decline",IDCANCEL,79,138,50,14 - CONTROL 151,IDC_IMAGE_BANNER,"Static",SS_BITMAP | - SS_REALSIZEIMAGE | WS_BORDER,4,4,192,21,WS_EX_CLIENTEDGE - GROUPBOX "",IDC_BOX_03,5,30,190,103 - LTEXT "Terms of Use Agreement",IDC_TEXT_TERMS,59,36,83,8 - CONTROL "Custom1",IDC_DYN_EULA,"",WS_TABSTOP,13,46,174,80 -END - IDD_URULOGIN_MAIN DIALOGEX 0, 0, 302, 230 STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP diff --git a/Sources/Plasma/Apps/plClient/res/resource.h b/Sources/Plasma/Apps/plClient/res/resource.h index 6e27c82e..9d35e3a0 100644 --- a/Sources/Plasma/Apps/plClient/res/resource.h +++ b/Sources/Plasma/Apps/plClient/res/resource.h @@ -6,10 +6,7 @@ #define IDD_LOADING 136 #define IDD_EXCEPTION 138 #define IDR_CNSL1 139 -#define IDD_URUTAP_LOGIN 148 -#define IDD_URU_LOGIN 149 #define IDB_BANNER 151 -#define IDD_URU_EULA 152 #define IDD_URULOGIN_MAIN 153 #define IDD_URULOGIN_EULA 154 #define IDD_AUTHFAILED 155 @@ -18,23 +15,6 @@ #define IDC_COPY 1002 #define IDC_MSG 1003 #define IDC_STARTING_TEXT 1004 -#define IDC_URUTAP_USERNAME 1005 -#define IDC_URUTAP_PASSWORD 1006 -#define IDC_URUTAP_SERVER 1008 -#define IDC_URUTAP_DESTROY 1009 -#define IDC_USERNAME 1010 -#define IDC_PASSWORD 1011 -#define IDC_REMEMBER_PASS 1012 -#define IDC_IMAGE_BANNER 1013 -#define IDC_BOX_01 1014 -#define IDC_BOX_02 1015 -#define IDC_TEXT_WELCOME 1016 -#define IDC_TEXT_USER 1017 -#define IDC_TEXT_PASS 1018 -#define IDC_CUSTOM1 1019 -#define IDC_DYN_EULA 1019 -#define IDC_BOX_03 1020 -#define IDC_TEXT_TERMS 1021 #define IDC_URULOGIN_REMEMBERPASS 1022 #define IDC_URULOGIN_USERNAME 1023 #define IDC_URULOGIN_PASSWORD 1024 From 9c28eca30fba7b151a9f25eafa303f94b774f37c Mon Sep 17 00:00:00 2001 From: diafero Date: Sun, 31 Jul 2011 13:35:38 +0200 Subject: [PATCH 4/6] remove pointless "BUILD_TYPE" option... external vs. internal client should really be enough (this also removes some hard-coded Cyan URLs which depended on that option) --- CMakeLists.txt | 18 ---- .../NucleusLib/pnAsyncCoreExe/pnAceLog.cpp | 15 ++-- .../NucleusLib/pnNetBase/Private/pnNbSrvs.cpp | 4 - .../Plasma/NucleusLib/pnNetDiag/pnNdTcp.cpp | 4 +- .../Plasma/NucleusLib/pnNetLog/pnNlCli.cpp | 4 +- .../NucleusLib/pnProduct/CMakeLists.txt | 2 - .../pnProduct/Private/pnPrAllIncludes.h | 1 - .../pnProduct/Private/pnPrBuildId.h | 9 ++ .../pnProduct/Private/pnPrBuildType.cpp | 83 ------------------- .../pnProduct/Private/pnPrBuildType.h | 62 -------------- .../pnProduct/Private/pnPrProductId.cpp | 5 +- .../pnProduct/Private/pnPrProductId.h | 4 +- .../NucleusLib/pnSimpleNet/pnSimpleNet.cpp | 2 +- .../pnUtils/Private/Win32/pnUtW32Path.cpp | 5 -- .../plNetClientComm/plNetClientComm.cpp | 4 +- .../plNetGameLib/Private/plNglAuth.cpp | 2 +- .../plNetGameLib/Private/plNglCsr.cpp | 2 +- .../plNetGameLib/Private/plNglFile.cpp | 2 +- .../plNetGameLib/Private/plNglGame.cpp | 2 +- .../plNetGameLib/Private/plNglGateKeeper.cpp | 2 +- .../PubUtilLib/plSDL/plStateVariable.cpp | 2 +- 21 files changed, 33 insertions(+), 201 deletions(-) delete mode 100644 Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildType.cpp delete mode 100644 Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildType.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 84fc3855..00f11e2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,28 +27,10 @@ if(CURL_IS_STATIC) endif(CURL_IS_STATIC) option(PLASMA_EXTERNAL_RELEASE "Is this release intended for the general public?" OFF) - if(PLASMA_EXTERNAL_RELEASE) add_definitions(-DPLASMA_EXTERNAL_RELEASE) endif(PLASMA_EXTERNAL_RELEASE) -set(PLASMA_BUILD_TYPE "Live" - CACHE STRING "Which type of client to build") -set_property(CACHE PLASMA_BUILD_TYPE PROPERTY STRINGS - "Dev" "QA" "Test" "Beta" "Live") - -if(PLASMA_BUILD_TYPE STREQUAL "Dev") - add_definitions(-DBUILD_TYPE=BUILD_TYPE_DEV) -elseif(PLASMA_BUILD_TYPE STREQUAL "QA") - add_definitions(-DBUILD_TYPE=BUILD_TYPE_QA) -elseif(PLASMA_BUILD_TYPE STREQUAL "Test") - add_definitions(-DBUILD_TYPE=BUILD_TYPE_TEST) -elseif(PLASMA_BUILD_TYPE STREQUAL "Beta") - add_definitions(-DBUILD_TYPE=BUILD_TYPE_BETA) -elseif(PLASMA_BUILD_TYPE STREQUAL "Live") - add_definitions(-DBUILD_TYPE=BUILD_TYPE_LIVE) -endif(PLASMA_BUILD_TYPE STREQUAL "Dev") - set(PLASMA_TARGETS "Client" CACHE STRING "Which set of plasma targets to build and use") set_property(CACHE PLASMA_TARGETS PROPERTY STRINGS diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceLog.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceLog.cpp index 4ba79ef8..fbe86a56 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceLog.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceLog.cpp @@ -32,8 +32,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "Pch.h" #pragma hdrstop -#if defined(PLASMA_EXTERNAL_RELEASE) && (BUILD_TYPE == BUILD_TYPE_LIVE) - // If this is an external live build then don't write log files +#if defined(PLASMA_EXTERNAL_RELEASE) + // If this is an external build then don't write log files #define ACELOG_NO_LOG_FILES #endif @@ -84,11 +84,11 @@ static unsigned s_logSize[kNumLogTypes] = { static const wchar * s_logNameFmt[kNumLogTypes] = { #ifdef SERVER - L"Dbg%02u%02u%02u.%s.log", - L"Inf%02u%02u%02u.%s.log", - L"Err%02u%02u%02u.%s.log", + L"Dbg%02u%02u%02u.log", + L"Inf%02u%02u%02u.log", + L"Err%02u%02u%02u.log", #else - L"%s%02u%02u%02u.%s.log", + L"%s%02u%02u%02u.log", #endif }; @@ -176,8 +176,7 @@ static void GetLogFilename ( #endif timeDesc.year % 100, timeDesc.month, - timeDesc.day, - BuildTypeString() + timeDesc.day ); PathAddFilename(filename, s_directory, filename, chars); } diff --git a/Sources/Plasma/NucleusLib/pnNetBase/Private/pnNbSrvs.cpp b/Sources/Plasma/NucleusLib/pnNetBase/Private/pnNbSrvs.cpp index ed8297a2..eed52801 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/Private/pnNbSrvs.cpp +++ b/Sources/Plasma/NucleusLib/pnNetBase/Private/pnNbSrvs.cpp @@ -32,10 +32,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "../Pch.h" #pragma hdrstop -#ifndef BUILD_TYPE -# error "pnProduct not included" -#endif - /***************************************************************************** * diff --git a/Sources/Plasma/NucleusLib/pnNetDiag/pnNdTcp.cpp b/Sources/Plasma/NucleusLib/pnNetDiag/pnNdTcp.cpp index 73c9ba24..d546e47d 100644 --- a/Sources/Plasma/NucleusLib/pnNetDiag/pnNdTcp.cpp +++ b/Sources/Plasma/NucleusLib/pnNetDiag/pnNdTcp.cpp @@ -622,7 +622,7 @@ static void StartAuthTcpTest ( connect.hdr.connType = (byte) kConnTypeCliToAuth; connect.hdr.hdrBytes = sizeof(connect.hdr); connect.hdr.buildId = BuildId(); - connect.hdr.buildType = BuildType(); + connect.hdr.buildType = BUILD_TYPE_LIVE; connect.hdr.branchId = BranchId(); connect.hdr.productId = ProductId(); connect.data.token = kNilGuid; @@ -665,7 +665,7 @@ static void StartFileTcpTest ( connect.hdr.connType = kConnTypeCliToFile; connect.hdr.hdrBytes = sizeof(connect.hdr); connect.hdr.buildId = 0; - connect.hdr.buildType = BuildType(); + connect.hdr.buildType = BUILD_TYPE_LIVE; connect.hdr.branchId = BranchId(); connect.hdr.productId = ProductId(); connect.data.buildId = BuildId(); diff --git a/Sources/Plasma/NucleusLib/pnNetLog/pnNlCli.cpp b/Sources/Plasma/NucleusLib/pnNetLog/pnNlCli.cpp index 3bf059a2..92234534 100644 --- a/Sources/Plasma/NucleusLib/pnNetLog/pnNlCli.cpp +++ b/Sources/Plasma/NucleusLib/pnNetLog/pnNlCli.cpp @@ -344,13 +344,13 @@ void NetLogConn::Connect ( connect.hdr.connType = kConnTypeSrvToLog; connect.hdr.hdrBytes = sizeof(connect.hdr); connect.hdr.buildId = BuildId(); - connect.hdr.buildType = BuildType(); + connect.hdr.buildType = BUILD_TYPE_LIVE; connect.hdr.branchId = BranchId(); connect.hdr.productId = ProductId(); connect.data.dataBytes = sizeof(connect.data); connect.data.buildId = BuildId(); connect.data.srvType = srvType; - connect.data.buildType = BuildType(); + connect.data.buildType = BUILD_TYPE_LIVE; connect.data.productId = ProductId(); AsyncSocketConnect( diff --git a/Sources/Plasma/NucleusLib/pnProduct/CMakeLists.txt b/Sources/Plasma/NucleusLib/pnProduct/CMakeLists.txt index 06c9b8c4..2acee566 100644 --- a/Sources/Plasma/NucleusLib/pnProduct/CMakeLists.txt +++ b/Sources/Plasma/NucleusLib/pnProduct/CMakeLists.txt @@ -14,8 +14,6 @@ set(pnProduct_PRIVATE Private/pnPrBuildId.cpp Private/pnPrBuildString.h Private/pnPrBuildString.cpp - Private/pnPrBuildType.h - Private/pnPrBuildType.cpp Private/pnPrProductId.h Private/pnPrProductId.cpp ) diff --git a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrAllIncludes.h b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrAllIncludes.h index 3c092ab7..cb3ab703 100644 --- a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrAllIncludes.h +++ b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrAllIncludes.h @@ -36,7 +36,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnUtils/pnUtils.h" #include "pnPrBuildId.h" -#include "pnPrBuildType.h" #include "pnPrBranchId.h" #include "pnPrProductId.h" #include "pnPrBuildString.h" diff --git a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildId.h b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildId.h index a875f56e..eb40764c 100644 --- a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildId.h +++ b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildId.h @@ -43,3 +43,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com unsigned BuildId (); void OverrideBuildId (unsigned buildId); + + +/***************************************************************************** +* +* BuildType definition +* +***/ + +#define BUILD_TYPE_LIVE 50 diff --git a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildType.cpp b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildType.cpp deleted file mode 100644 index a79c9694..00000000 --- a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildType.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildType.cpp -* -***/ - -#include "../Pch.h" -#pragma hdrstop - - -/***************************************************************************** -* -* Exports -* -***/ - -//============================================================================ -unsigned BuildType () { - return BUILD_TYPE; -} - -//============================================================================ -const wchar * BuildTypeString () { - -#if BUILD_TYPE == BUILD_TYPE_DEV - return L"Dev"; -#elif BUILD_TYPE == BUILD_TYPE_QA - return L"QA"; -#elif BUILD_TYPE == BUILD_TYPE_TEST - return L"Test"; -#elif BUILD_TYPE == BUILD_TYPE_BETA - return L"Beta"; -#elif BUILD_TYPE == BUILD_TYPE_LIVE - return L"Live"; -#else -# error "Unknown build type" -#endif - -} - -//============================================================================ -const wchar *BuildTypeServerStatusPath () { - - #if BUILD_TYPE == BUILD_TYPE_DEV - return nil; - #elif BUILD_TYPE == BUILD_TYPE_QA - return nil; - #elif BUILD_TYPE == BUILD_TYPE_TEST - return nil; - #elif BUILD_TYPE == BUILD_TYPE_BETA - return L"/serverstatus/moulbeta.php"; - #elif BUILD_TYPE == BUILD_TYPE_LIVE - return L"/serverstatus/moullive.php"; - #else - # error "Unknown build type" - #endif - -} diff --git a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildType.h b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildType.h deleted file mode 100644 index be3ed13b..00000000 --- a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildType.h +++ /dev/null @@ -1,62 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildType.h -* -***/ - -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNPRODUCT_PRIVATE_PNPRBUILDTYPE_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildType.h included more than once" -#endif -#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNPRODUCT_PRIVATE_PNPRBUILDTYPE_H - - -/***************************************************************************** -* -* BuildType definitions -* -***/ -#ifndef BUILD_TYPE -#define BUILD_TYPE BUILD_TYPE_DEV -#endif - -#define BUILD_TYPE_DEV 10 -#define BUILD_TYPE_QA 20 -#define BUILD_TYPE_TEST 30 -#define BUILD_TYPE_BETA 40 -#define BUILD_TYPE_LIVE 50 - - -/***************************************************************************** -* -* BuildType functions -* -***/ - -unsigned BuildType (); -const wchar * BuildTypeString (); -const wchar * BuildTypeServerStatusPath (); diff --git a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrProductId.cpp b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrProductId.cpp index 544cbe35..2c52d403 100644 --- a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrProductId.cpp +++ b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrProductId.cpp @@ -102,13 +102,12 @@ const wchar * ProductLongName () { //============================================================================ void ProductString (wchar * dest, unsigned destChars) { - // Example: "UruLive.Beta.2.214 - External.Release" + // Example: "UruLive.2.214 - External.Release" StrPrintf( dest, destChars, - L"%s.%s.%u.%u - %s.%s", + L"%s.%u.%u - %s.%s", ProductCoreName(), - BuildTypeString(), BranchId(), BuildId(), #ifdef PLASMA_EXTERNAL_RELEASE diff --git a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrProductId.h b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrProductId.h index 1c7b45c4..f63f53af 100644 --- a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrProductId.h +++ b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrProductId.h @@ -73,6 +73,6 @@ const wchar * ProductShortName (); // e.g: L"Uru" (filenam const wchar * ProductLongName (); // e.g: L"Uru: Ages Beyond Myst" (human friendly) -// Returns: "..." -// Example: "Uru.Beta.3.204" +// Returns: ".. - ." +// Example: "Uru.3.204 - External.Release" void ProductString (wchar * dest, unsigned destChars); diff --git a/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.cpp b/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.cpp index 6a32646d..f5bff7cd 100644 --- a/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.cpp +++ b/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.cpp @@ -366,7 +366,7 @@ static void Connect (const NetAddress & addr, ConnectParam * cp) { connect.hdr.connType = kConnTypeSimpleNet; connect.hdr.hdrBytes = sizeof(connect.hdr); connect.hdr.buildId = BuildId(); - connect.hdr.buildType = BuildType(); + connect.hdr.buildType = BUILD_TYPE_LIVE; connect.hdr.branchId = BranchId(); connect.hdr.productId = ProductId(); connect.data.channelId = cp->channel->GetValue(); diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Path.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Path.cpp index 20120ba2..e36debe0 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Path.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Path.cpp @@ -531,11 +531,6 @@ void PathGetUserDirectory ( // append the product name PathAddFilename(dst, temp, ProductLongName(), dstChars); -#if BUILD_TYPE != BUILD_TYPE_LIVE - // non-live builds live in a subdir - PathAddFilename(dst, dst, BuildTypeString(), dstChars); -#endif - // ensure it exists if (!PathDoesDirectoryExist(dst)) PathCreateDirectory(dst, kPathCreateDirFlagEntireTree); diff --git a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp index 6ebcc363..2e761193 100644 --- a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp @@ -767,8 +767,8 @@ static void IReadNetIni() { } #ifndef PLASMA_EXTERNAL_RELEASE - // @@@: Internal dev build only: Drop a default version of the file if not found - if (!ini && BuildType() == BUILD_TYPE_DEV) { + // @@@: Internal build only: Drop a default version of the file if not found + if (!ini) { EFileError fileError; qword fileSize; qword lastWrite; diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp index b6f67e43..3190ff70 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp @@ -1489,7 +1489,7 @@ static void Connect ( connect.hdr.connType = kConnTypeCliToAuth; connect.hdr.hdrBytes = sizeof(connect.hdr); connect.hdr.buildId = BuildId(); - connect.hdr.buildType = BuildType(); + connect.hdr.buildType = BUILD_TYPE_LIVE; connect.hdr.branchId = BranchId(); connect.hdr.productId = ProductId(); connect.data.token = conn->token; diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.cpp index 266a2996..f0362501 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.cpp @@ -375,7 +375,7 @@ static void Connect ( connect.hdr.connType = kConnTypeCliToCsr; connect.hdr.hdrBytes = sizeof(connect.hdr); connect.hdr.buildId = BuildId(); - connect.hdr.buildType = BuildType(); + connect.hdr.buildType = BUILD_TYPE_LIVE; connect.hdr.branchId = BranchId(); connect.hdr.productId = ProductId(); connect.data.dataBytes = sizeof(connect.data); diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp index 453c7940..45cb986d 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp @@ -502,7 +502,7 @@ static void Connect (CliFileConn * conn) { connect.hdr.connType = kConnTypeCliToFile; connect.hdr.hdrBytes = sizeof(connect.hdr); connect.hdr.buildId = kFileSrvBuildId; - connect.hdr.buildType = BuildType(); + connect.hdr.buildType = BUILD_TYPE_LIVE; connect.hdr.branchId = BranchId(); connect.hdr.productId = ProductId(); connect.data.buildId = conn->buildId; diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp index 69382528..2b611f2b 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp @@ -352,7 +352,7 @@ static void Connect ( connect.hdr.connType = kConnTypeCliToGame; connect.hdr.hdrBytes = sizeof(connect.hdr); connect.hdr.buildId = BuildId(); - connect.hdr.buildType = BuildType(); + connect.hdr.buildType = BUILD_TYPE_LIVE; connect.hdr.branchId = BranchId(); connect.hdr.productId = ProductId(); connect.data.dataBytes = sizeof(connect.data); diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp index 11b4669b..90290213 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp @@ -427,7 +427,7 @@ static void Connect ( connect.hdr.connType = kConnTypeCliToGateKeeper; connect.hdr.hdrBytes = sizeof(connect.hdr); connect.hdr.buildId = BuildId(); - connect.hdr.buildType = BuildType(); + connect.hdr.buildType = BUILD_TYPE_LIVE; connect.hdr.branchId = BranchId(); connect.hdr.productId = ProductId(); connect.data.token = conn->token; diff --git a/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp b/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp index 74779c8c..7e0b56f4 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp +++ b/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp @@ -1161,7 +1161,7 @@ bool plSimpleStateVariable::ConvertTo(plSimpleVarDescriptor* toVar, bool force ) int cnt = toVar->GetCount() ? toVar->GetCount() : fVar.GetCount(); if (cnt > fVar.GetCount()) { - #if BUILD_TYPE == BUILD_TYPE_DEV + #ifndef PLASMA_EXTERNAL_RELEASE FATAL("SDL Convert: array size increased, conversion loses data"); #endif // Reallocate new memory (destroys existing variable state) From 25e12fb3d0d59d1b81650b70d724a9ce2addf908 Mon Sep 17 00:00:00 2001 From: diafero Date: Mon, 8 Aug 2011 11:39:50 +0200 Subject: [PATCH 5/6] remove unused function GetMouseCoords --- Sources/Plasma/Apps/plClient/winmain.cpp | 32 ------------------------ 1 file changed, 32 deletions(-) diff --git a/Sources/Plasma/Apps/plClient/winmain.cpp b/Sources/Plasma/Apps/plClient/winmain.cpp index cc5b666f..8acb8248 100644 --- a/Sources/Plasma/Apps/plClient/winmain.cpp +++ b/Sources/Plasma/Apps/plClient/winmain.cpp @@ -342,38 +342,6 @@ bool TGRunTOSDialog () return (StrCmp (Buf, "accepted") == 0); } -void GetMouseCoords(HWND hWnd, WPARAM wParam, LPARAM lParam, int* xPos, int* yPos, int* fwKeys) -{ - POINT pt; - pt.x=LOWORD(lParam); - pt.y=HIWORD(lParam); -#if 0 - if (ClientToScreen(hWnd, &pt) == false) - HSDebugProc("Error converting client mouse coords to screen"); -#endif - - if (xPos) - *xPos = pt.x; // horizontal position of cursor - if (yPos) - *yPos = pt.y; // vertical position of cursor - -#if 0 - char str[128]; - sprintf(str, "mx=%d my=%d\n", pt.x, pt.y); - hsStatusMessage(str); -#endif - - if (fwKeys) - *fwKeys = wParam; // key flags - - // key flag bits - // MK_CONTROL Set if the CTRL key is down. - // MK_LBUTTON Set if the left mouse button is down. - // MK_MBUTTON Set if the middle mouse button is down. - // MK_RBUTTON Set if the right mouse button is down. - // MK_SHIFT Set if the SHIFT key is down. -} - void DebugMsgF(const char* format, ...); // Handles all the windows messages we might receive From 85404e9b97f2c1b8e511babff89309721a35cbb9 Mon Sep 17 00:00:00 2001 From: diafero Date: Mon, 8 Aug 2011 11:51:49 +0200 Subject: [PATCH 6/6] actually display the status message in the launcher --- Sources/Plasma/Apps/plUruLauncher/Main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/Plasma/Apps/plUruLauncher/Main.cpp b/Sources/Plasma/Apps/plUruLauncher/Main.cpp index 7eafd3b0..77b3c690 100644 --- a/Sources/Plasma/Apps/plUruLauncher/Main.cpp +++ b/Sources/Plasma/Apps/plUruLauncher/Main.cpp @@ -602,6 +602,7 @@ static void StatusCallback(void *) { curl_easy_setopt(hCurl, CURLOPT_USERAGENT, "UruClient/1.0"); curl_easy_setopt(hCurl, CURLOPT_URL, serverUrl); + curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, &CurlCallback); if (serverUrl[0] && curl_easy_perform(hCurl) != 0) // only perform request if there's actually a URL set SetStatusText(s_curlError);