Browse Source

Merge branch 'master' of https://github.com/H-uru/Plasma into maxfixups

Conflicts:
	CMakeLists.txt
Adam Johnson 13 years ago
parent
commit
5f806ea12e
  1. 10
      CMakeLists.txt
  2. 3
      Sources/Plasma/Apps/plClient/CMakeLists.txt
  3. 109
      Sources/Plasma/Apps/plClient/winmain.cpp
  4. 2
      Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Path.cpp

10
CMakeLists.txt

@ -14,8 +14,16 @@ find_package(Ogg REQUIRED) #TODO: Not required if we aren't building the clie
find_package(Vorbis REQUIRED) #TODO: Not required if we aren't building the client find_package(Vorbis REQUIRED) #TODO: Not required if we aren't building the client
find_package(Speex REQUIRED) #TODO: Not required if we aren't building the client find_package(Speex REQUIRED) #TODO: Not required if we aren't building the client
find_package(DirectX REQUIRED) find_package(DirectX REQUIRED)
find_package(CURL REQUIRED)
find_package(MaxSDK) find_package(MaxSDK)
find_package(Bink) find_package(Bink) #TODO: Find Bink, but don't require it if plPipeline isn't built...
# Or better yet, just eliminate bink altogether
# libCurl isn't smart enough to detect this for us, so we have to configure it ourselves
option(CURL_IS_STATIC "Using the static version of libcurl?" ON)
if(CURL_IS_STATIC)
add_definitions(-DCURL_STATICLIB)
endif(CURL_IS_STATIC)
option(PLASMA_EXTERNAL_RELEASE "Is this release intended for the general public?" OFF) option(PLASMA_EXTERNAL_RELEASE "Is this release intended for the general public?" OFF)

3
Sources/Plasma/Apps/plClient/CMakeLists.txt

@ -13,6 +13,7 @@ endif()
include_directories(${OPENAL_INCLUDE_DIR}) include_directories(${OPENAL_INCLUDE_DIR})
include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${OPENSSL_INCLUDE_DIR})
include_directories(${PYTHON_INCLUDE_DIR}) include_directories(${PYTHON_INCLUDE_DIR})
include_directories(${CURL_INCLUDE_DIR})
set(plClient_HEADERS set(plClient_HEADERS
plClient.h plClient.h
@ -193,6 +194,7 @@ target_link_libraries(plClient ${PHYSX_LIBRARIES})
target_link_libraries(plClient ${Ogg_LIBRARIES}) target_link_libraries(plClient ${Ogg_LIBRARIES})
target_link_libraries(plClient ${Vorbis_LIBRARIES}) target_link_libraries(plClient ${Vorbis_LIBRARIES})
target_link_libraries(plClient ${DirectX_LIBRARIES}) target_link_libraries(plClient ${DirectX_LIBRARIES})
target_link_libraries(plClient ${CURL_LIBRARY})
if(Bink_SDK_AVAILABLE) if(Bink_SDK_AVAILABLE)
target_link_libraries(plClient ${Bink_LIBRARIES}) target_link_libraries(plClient ${Bink_LIBRARIES})
@ -200,7 +202,6 @@ endif()
if (WIN32) if (WIN32)
target_link_libraries(plClient Rpcrt4) target_link_libraries(plClient Rpcrt4)
target_link_libraries(plClient Winhttp)
target_link_libraries(plClient Version) target_link_libraries(plClient Version)
target_link_libraries(plClient Vfw32) target_link_libraries(plClient Vfw32)
target_link_libraries(plClient Ws2_32) target_link_libraries(plClient Ws2_32)

109
Sources/Plasma/Apps/plClient/winmain.cpp

@ -33,9 +33,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <dmdfm.h> // Windows Load EXE into memory suff #include <dmdfm.h> // Windows Load EXE into memory suff
#endif #endif
#include <winsock2.h> #include <curl/curl.h>
#include <windows.h>
#include <WinHttp.h>
#include "HeadSpin.h" #include "HeadSpin.h"
#include "hsStream.h" #include "hsStream.h"
@ -1198,73 +1196,48 @@ static void LoadUserPass (const wchar *accountName, char *username, ShaDigest *p
} }
} }
size_t CurlCallback(void *buffer, size_t size, size_t nmemb, void *param)
{
static char status[256];
HWND hwnd = (HWND)param;
strncpy(status, (const char *)buffer, std::min<size_t>(size * nmemb, 256));
status[255] = 0;
PostMessage(hwnd, WM_USER_SETSTATUSMSG, 0, (LPARAM) status);
return size * nmemb;
}
void StatusCallback(void *param) void StatusCallback(void *param)
{ {
HWND hwnd = (HWND)param; HWND hwnd = (HWND)param;
char *statusUrl = hsWStringToString(GetServerStatusUrl());
CURL *hCurl = curl_easy_init();
// For reporting errors
char curlError[CURL_ERROR_SIZE];
curl_easy_setopt(hCurl, CURLOPT_ERRORBUFFER, curlError);
while(s_loginDlgRunning) while(s_loginDlgRunning)
{ {
// get status message from webpage and display in status area. curl_easy_setopt(hCurl, CURLOPT_URL, statusUrl);
const wchar *path = BuildTypeServerStatusPath(); curl_easy_setopt(hCurl, CURLOPT_USERAGENT, "UruClient/1.0");
if(path) curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, &CurlCallback);
{ curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, param);
HINTERNET hSession = 0;
HINTERNET hConnect = 0; if (curl_easy_perform(hCurl) != 0)
HINTERNET hRequest = 0; PostMessage(hwnd, WM_USER_SETSTATUSMSG, 0, (LPARAM) curlError);
hSession = WinHttpOpen(
L"UruClient/1.0",
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
WINHTTP_NO_PROXY_NAME,
WINHTTP_NO_PROXY_BYPASS, 0
);
if(hSession)
{
HINTERNET hConnect = WinHttpConnect( hSession, STATUS_PATH, INTERNET_DEFAULT_HTTP_PORT, 0);
if(hConnect)
{
HINTERNET hRequest = WinHttpOpenRequest(
hConnect,
L"GET",
path,
NULL,
WINHTTP_NO_REFERER,
WINHTTP_DEFAULT_ACCEPT_TYPES,
0
);
if(hRequest)
{
static char data[256] = {0};
DWORD bytesRead;
WinHttpSendRequest(
hRequest,
WINHTTP_NO_ADDITIONAL_HEADERS,
0,
WINHTTP_NO_REQUEST_DATA,
0,
0,
0
);
WinHttpReceiveResponse(hRequest, 0);
WinHttpReadData(hRequest, data, 255, &bytesRead);
data[bytesRead] = 0;
if(bytesRead)
PostMessage(hwnd, WM_USER_SETSTATUSMSG, 0, (LPARAM) data);
}
}
}
WinHttpCloseHandle(hRequest);
WinHttpCloseHandle(hConnect);
WinHttpCloseHandle(hSession);
}
else
break; // no status message
for(unsigned i = 0; i < UPDATE_STATUSMSG_SECONDS && s_loginDlgRunning; ++i) for(unsigned i = 0; i < UPDATE_STATUSMSG_SECONDS && s_loginDlgRunning; ++i)
{ {
Sleep(1000); Sleep(1000);
} }
} }
delete [] statusUrl;
curl_easy_cleanup(hCurl);
s_statusEvent.Signal(); s_statusEvent.Signal();
} }
@ -1665,7 +1638,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
return PARABLE_NORMAL_EXIT; return PARABLE_NORMAL_EXIT;
} }
/////////<<<<<<<<
FILE *serverini = _wfopen(serverIni, L"rb"); FILE *serverini = _wfopen(serverIni, L"rb");
if (serverini) if (serverini)
{ {
@ -1678,13 +1650,14 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
hsMessageBox("No server.ini file found. Please check your URU installation.", "Error", hsMessageBoxNormal); hsMessageBox("No server.ini file found. Please check your URU installation.", "Error", hsMessageBoxNormal);
return PARABLE_NORMAL_EXIT; return PARABLE_NORMAL_EXIT;
} }
/////////<<<<<<<<
NetCliAuthAutoReconnectEnable(false); NetCliAuthAutoReconnectEnable(false);
NetCommSetReadIniAccountInfo(!doIntroDialogs); NetCommSetReadIniAccountInfo(!doIntroDialogs);
InitNetClientComm(); InitNetClientComm();
curl_global_init(CURL_GLOBAL_ALL);
wchar acctName[kMaxAccountNameLength]; wchar acctName[kMaxAccountNameLength];
// if we're being launched from gametap then don't use the intro dialogs // if we're being launched from gametap then don't use the intro dialogs
@ -1761,15 +1734,17 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
needExit = !TGRunTOSDialog (); needExit = !TGRunTOSDialog ();
else else
{ {
HINSTANCE hRichEdDll = LoadLibrary("RICHED20.DLL"); HINSTANCE hRichEdDll = LoadLibrary("RICHED20.DLL");
INT_PTR val = ::DialogBoxParam( hInst, MAKEINTRESOURCE( IDD_URULOGIN_EULA ), NULL, UruTOSDialogProc, (LPARAM)hInst); INT_PTR val = ::DialogBoxParam( hInst, MAKEINTRESOURCE( IDD_URULOGIN_EULA ), NULL, UruTOSDialogProc, (LPARAM)hInst);
FreeLibrary(hRichEdDll); FreeLibrary(hRichEdDll);
if (val <= 0) { if (val <= 0) {
DWORD error = GetLastError(); DWORD error = GetLastError();
needExit = true; needExit = true;
}
} }
} }
}
curl_global_cleanup();
if (needExit) { if (needExit) {
DeInitNetClientComm(); DeInitNetClientComm();

2
Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Path.cpp

@ -525,7 +525,7 @@ void PathGetUserDirectory (
ASSERT(dstChars); ASSERT(dstChars);
wchar temp[MAX_PATH]; // GetSpecialFolder path requires a buffer of MAX_PATH size or larger wchar temp[MAX_PATH]; // GetSpecialFolder path requires a buffer of MAX_PATH size or larger
if (SHGetSpecialFolderPathW(NULL, temp, CSIDL_PERSONAL, TRUE) == FALSE) if (SHGetSpecialFolderPathW(NULL, temp, CSIDL_LOCAL_APPDATA, TRUE) == FALSE)
StrCopy(temp, L"C:\\", arrsize(temp)); StrCopy(temp, L"C:\\", arrsize(temp));
// append the product name // append the product name

Loading…
Cancel
Save