Browse Source

Merge pull request #224 from Hoikas/kill-transgaming

Kill transgaming
Branan Purvine-Riley 12 years ago
parent
commit
caa12510de
  1. 225
      Sources/Plasma/Apps/plClient/winmain.cpp
  2. 7
      Sources/Plasma/Apps/plClientPatcher/UruPlayer.cpp
  3. 145
      Sources/Plasma/Apps/plUruLauncher/Main.cpp
  4. 1
      Sources/Plasma/Apps/plUruLauncher/plLauncherInfo.h
  5. 12
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/CMakeLists.txt
  6. 1
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Pch.h
  7. 81
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9x.cpp
  8. 64
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9x.h
  9. 142
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xInt.h
  10. 1224
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xSocket.cpp
  11. 451
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xThread.cpp
  12. 33
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceCore.cpp

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

@ -152,30 +152,6 @@ static wchar_t s_patcherExeName[] = L"UruLauncher.exe";
//============================================================================ //============================================================================
static wchar_t s_physXSetupExeName[] = L"PhysX_Setup.exe"; static wchar_t s_physXSetupExeName[] = L"PhysX_Setup.exe";
//============================================================================
// TRANSGAMING detection & dialog replacement
//============================================================================
typedef BOOL (WINAPI *IsTransgaming) (void);
typedef const char * (WINAPI *TGGetOS) (void);
typedef LPVOID (WINAPI *TGLaunchUNIXApp) (const char *pPath, const char *pMode);
typedef BOOL (WINAPI *TGUNIXAppReadLine) (LPVOID pApp, char *pBuf, int bufSize);
typedef BOOL (WINAPI *TGUNIXAppWriteLine) (LPVOID pApp, const char *pLine);
typedef BOOL (WINAPI *TGUNIXAppClose) (LPVOID pApp);
static bool TGIsCider = false;
static TGLaunchUNIXApp pTGLaunchUNIXApp;
static TGUNIXAppReadLine pTGUNIXAppReadLine;
static TGUNIXAppWriteLine pTGUNIXAppWriteLine;
static TGUNIXAppClose pTGUNIXAppClose;
#define TG_NEW_LOGIN_PATH "C:\\Program Files\\Uru Live\\Cider\\URU Live Login.app"
#define TG_NEW_LOGIN_POPEN_PATH "/transgaming/c_drive/Program Files/Uru Live/Cider/URU Live Login.app/Contents/MacOS/URU Live Login"
#define TG_OLD_LOGIN_POPEN_PATH "/URU Live Login.app/Contents/MacOS/URU Live Login"
#define TG_NEW_EULA_PATH "C:\\Program Files\\Uru Live\\Cider\\URU Live EULA.app"
#define TG_NEW_EULA_POPEN_PATH "/transgaming/c_drive/Program Files/Uru Live/Cider/URU Live EULA.app/Contents/MacOS/URU Live EULA"
#define TG_OLD_EULA_POPEN_PATH "/URU Live EULA.app/Contents/MacOS/URU Live EULA"
//============================================================================ //============================================================================
// LoginDialogParam // LoginDialogParam
//============================================================================ //============================================================================
@ -195,176 +171,6 @@ static void AuthFailedStrings (ENetError authError,
const char **ppStr1, const char **ppStr2, const char **ppStr1, const char **ppStr2,
const wchar_t **ppWStr); const wchar_t **ppWStr);
// Detect whether we're running under TRANSGAMING Cider
//==============================================================================
static void TGDoCiderDetection ()
{
HMODULE hMod = GetModuleHandle ("ntdll");
if (!hMod)
return;
IsTransgaming pIsTg = (IsTransgaming)GetProcAddress (hMod, "IsTransgaming");
if (!pIsTg || !pIsTg ())
return;
TGGetOS pTGOS = (TGGetOS)GetProcAddress (hMod, "TGGetOS");
const char *pOS = NULL;
if (pTGOS)
pOS = pTGOS ();
if (!pOS || strcmp (pOS, "MacOSX"))
return;
TGIsCider = true;
pTGLaunchUNIXApp = (TGLaunchUNIXApp)GetProcAddress (hMod, "TGLaunchUNIXApp");
pTGUNIXAppReadLine = (TGUNIXAppReadLine)GetProcAddress (hMod, "TGUNIXAppReadLine");
pTGUNIXAppWriteLine = (TGUNIXAppWriteLine)GetProcAddress (hMod, "TGUNIXAppWriteLine");
pTGUNIXAppClose = (TGUNIXAppClose)GetProcAddress (hMod, "TGUNIXAppClose");
}
static bool TGRunLoginDialog (LoginDialogParam *pLoginParam)
{
while (true)
{
LPVOID pApp;
if (GetFileAttributes (TG_NEW_LOGIN_PATH) != INVALID_FILE_ATTRIBUTES)
pApp = pTGLaunchUNIXApp (TG_NEW_LOGIN_POPEN_PATH, "r+");
else
pApp = pTGLaunchUNIXApp (TG_OLD_LOGIN_POPEN_PATH, "r+");
if (!pApp)
{
hsMessageBox ("Incomplete or corrupted installation!\nUnable to locate Login dialog",
"Error", hsMessageBoxNormal);
return false;
}
// Send user/pwd/remember
pTGUNIXAppWriteLine (pApp, pLoginParam->username);
if (pLoginParam->remember)
pTGUNIXAppWriteLine (pApp, FAKE_PASS_STRING);
else
pTGUNIXAppWriteLine (pApp, "");
if (pLoginParam->remember)
pTGUNIXAppWriteLine (pApp, "y");
else
pTGUNIXAppWriteLine (pApp, "n");
if (!pTGUNIXAppReadLine (pApp, pLoginParam->username, sizeof (pLoginParam->username)))
{
pTGUNIXAppClose (pApp);
hsMessageBox ("Incomplete or corrupted installation!\nUnable to locate Login dialog",
"Error", hsMessageBoxNormal);
return false;
}
// Check if user selected 'Cancel'
if (StrCmp (pLoginParam->username, "text:", 5) != 0)
{
pTGUNIXAppClose (pApp);
return false;
}
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)))
{
pTGUNIXAppClose (pApp);
hsMessageBox ("Incomplete or corrupted installation!\nLogin dialog not found or working",
"Error", hsMessageBoxNormal);
return false;
}
char Remember[16];
if (!pTGUNIXAppReadLine (pApp, Remember, sizeof (Remember)))
{
pTGUNIXAppClose (pApp);
hsMessageBox ("Incomplete or corrupted installation!\nLogin dialog not found or working",
"Error", hsMessageBoxNormal);
return false;
}
pTGUNIXAppClose (pApp);
pLoginParam->remember = (Remember[0] == 'y');
SaveUserPass (pLoginParam, Password);
// Do login & see if it failed
ENetError auth;
bool cancelled = AuthenticateNetClientComm(&auth, NULL);
if (IS_NET_SUCCESS (auth) && !cancelled)
break;
if (!cancelled)
{
const char *pStr1, *pStr2;
const wchar_t *pWStr;
unsigned int Len;
char *pTmpStr;
AuthFailedStrings (auth, &pStr1, &pStr2, &pWStr);
Len = StrLen (pStr1) + 1;
if (pStr2)
Len += StrLen (pStr2) + 2;
if (pWStr)
Len += StrLen (pWStr) + 2;
pTmpStr = new char[Len];
StrCopy (pTmpStr, pStr1, StrLen (pStr1));
if (pStr2)
{
StrCopy (pTmpStr + StrLen (pTmpStr), "\n\n", 2);
StrCopy (pTmpStr + StrLen (pTmpStr), pStr2, StrLen (pStr2));
}
if (pWStr)
{
StrCopy (pTmpStr + StrLen (pTmpStr), "\n\n", 2);
StrToAnsi (pTmpStr + StrLen (pTmpStr), pWStr, StrLen (pWStr));
}
hsMessageBox (pTmpStr, "Error", hsMessageBoxNormal);
delete [] pTmpStr;
}
else
NetCommDisconnect();
};
return true;
}
bool TGRunTOSDialog ()
{
char Buf[16];
LPVOID pApp;
if (GetFileAttributes (TG_NEW_EULA_PATH) != INVALID_FILE_ATTRIBUTES)
pApp = pTGLaunchUNIXApp (TG_NEW_EULA_POPEN_PATH, "r");
else
pApp = pTGLaunchUNIXApp (TG_OLD_EULA_POPEN_PATH, "r");
if (!pApp)
{
hsMessageBox ("Incomplete or corrupted installation!\nTOS dialog not found or working",
"Error", hsMessageBoxNormal);
return false;
}
if (!pTGUNIXAppReadLine (pApp, Buf, sizeof (Buf)))
{
hsMessageBox ("Incomplete or corrupted installation!\nTOS dialog not found or working",
"Error", hsMessageBoxNormal);
pTGUNIXAppClose (pApp);
return false;
}
pTGUNIXAppClose (pApp);
return (StrCmp (Buf, "accepted") == 0);
}
void DebugMsgF(const char* format, ...); void DebugMsgF(const char* format, ...);
// Handles all the windows messages we might receive // Handles all the windows messages we might receive
@ -1043,10 +849,9 @@ static void SaveUserPass (LoginDialogParam *pLoginParam, char *password)
} }
NetCommSetAccountUsernamePassword(theUser.ToWchar(), pLoginParam->namePassHash); NetCommSetAccountUsernamePassword(theUser.ToWchar(), pLoginParam->namePassHash);
if (TGIsCider)
NetCommSetAuthTokenAndOS(nil, L"mac"); // FIXME: Real OS detection
else NetCommSetAuthTokenAndOS(nil, L"win");
NetCommSetAuthTokenAndOS(nil, L"win");
wchar_t fileAndPath[MAX_PATH]; wchar_t fileAndPath[MAX_PATH];
PathGetInitDirectory(fileAndPath, arrsize(fileAndPath)); PathGetInitDirectory(fileAndPath, arrsize(fileAndPath));
@ -1437,8 +1242,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
} }
} }
TGDoCiderDetection ();
#ifdef PLASMA_EXTERNAL_RELEASE #ifdef PLASMA_EXTERNAL_RELEASE
// if the client was started directly, run the patcher, and shutdown // if the client was started directly, run the patcher, and shutdown
STARTUPINFOW si; STARTUPINFOW si;
@ -1563,24 +1366,16 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
} }
if (doIntroDialogs) { if (doIntroDialogs) {
if (TGIsCider) needExit = ::DialogBoxParam( hInst, MAKEINTRESOURCE( IDD_URULOGIN_MAIN ), NULL, UruLoginDialogProc, (LPARAM)&loginParam ) <= 0;
needExit = !TGRunLoginDialog(&loginParam);
else if (::DialogBoxParam( hInst, MAKEINTRESOURCE( IDD_URULOGIN_MAIN ), NULL, UruLoginDialogProc, (LPARAM)&loginParam ) <= 0)
needExit = true;
} }
if (doIntroDialogs && !needExit) { if (doIntroDialogs && !needExit) {
if (TGIsCider) HINSTANCE hRichEdDll = LoadLibrary("RICHED20.DLL");
needExit = !TGRunTOSDialog (); INT_PTR val = ::DialogBoxParam( hInst, MAKEINTRESOURCE( IDD_URULOGIN_EULA ), NULL, UruTOSDialogProc, (LPARAM)hInst);
else FreeLibrary(hRichEdDll);
{ if (val <= 0) {
HINSTANCE hRichEdDll = LoadLibrary("RICHED20.DLL"); DWORD error = GetLastError();
INT_PTR val = ::DialogBoxParam( hInst, MAKEINTRESOURCE( IDD_URULOGIN_EULA ), NULL, UruTOSDialogProc, (LPARAM)hInst); needExit = true;
FreeLibrary(hRichEdDll);
if (val <= 0) {
DWORD error = GetLastError();
needExit = true;
}
} }
} }

7
Sources/Plasma/Apps/plClientPatcher/UruPlayer.cpp

@ -58,11 +58,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
***/ ***/
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
static const wchar_t s_manifest[] = L"Internal"; static const wchar_t s_manifest[] = L"Internal";
static const wchar_t s_macmanifest[] = L"macInternal";
static const wchar_t s_thinmanifest[] = L"ThinInternal"; static const wchar_t s_thinmanifest[] = L"ThinInternal";
#else #else
static const wchar_t s_manifest[] = L"External"; static const wchar_t s_manifest[] = L"External";
static const wchar_t s_macmanifest[] = L"macExternal";
static const wchar_t s_thinmanifest[] = L"ThinExternal"; static const wchar_t s_thinmanifest[] = L"ThinExternal";
#endif #endif
@ -760,10 +758,7 @@ static void ThinManifestCallback (
StrPrintf(path, arrsize(path), "%s%S", s_workingDir, manifest[i].clientName); StrPrintf(path, arrsize(path), "%s%S", s_workingDir, manifest[i].clientName);
if(!MD5Check(path, manifest[i].md5)){ if(!MD5Check(path, manifest[i].md5)){
s_patchComplete = false; s_patchComplete = false;
if (info->IsTGCider) NetCliFileManifestRequest(ManifestCallback, info, s_manifest, info->buildId);
NetCliFileManifestRequest(ManifestCallback, info, s_macmanifest, info->buildId);
else
NetCliFileManifestRequest(ManifestCallback, info, s_manifest, info->buildId);
break; break;
} }
PatchInfo patchInfo; PatchInfo patchInfo;

145
Sources/Plasma/Apps/plUruLauncher/Main.cpp

@ -108,30 +108,6 @@ struct SetBytesRemainingEvent : WndEvent {
}; };
//============================================================================
// TRANSGAMING detection & dialog replacement
//============================================================================
typedef BOOL (WINAPI *IsTransgaming) (void);
typedef const char * (WINAPI *TGGetOS) (void);
typedef LPVOID (WINAPI *TGLaunchUNIXApp) (const char *pPath, const char *pMode);
typedef BOOL (WINAPI *TGUNIXAppReadLine) (LPVOID pApp, char *pBuf, int bufSize);
typedef BOOL (WINAPI *TGUNIXAppWriteLine) (LPVOID pApp, const char *pLine);
typedef BOOL (WINAPI *TGUNIXAppClose) (LPVOID pApp);
static bool TGIsCider = false;
static void *pTGApp = NULL;
static TGLaunchUNIXApp pTGLaunchUNIXApp;
static TGUNIXAppReadLine pTGUNIXAppReadLine;
static TGUNIXAppWriteLine pTGUNIXAppWriteLine;
static TGUNIXAppClose pTGUNIXAppClose;
#define TG_NEW_DIALOG_PATH "C:\\Program Files\\Uru Live\\Cider\\URU Live Updater.app"
#define TG_NEW_DIALOG_POPEN_PATH "/transgaming/c_drive/Program Files/Uru Live/Cider/URU Live Updater.app/Contents/MacOS/URU Live Updater"
#define TG_OLD_DIALOG_POPEN_PATH "/URU Live Updater.app/Contents/MacOS/URU Live Updater"
#define TG_CUR_FRAMEWORK_FILE "C:\\Program Files\\Uru Live\\Cider\\current.txt"
#define TG_LATEST_FRAMEWORK_FILE "C:\\Program Files\\Uru Live\\Cider\\Frameworks\\version.txt"
/***************************************************************************** /*****************************************************************************
* *
* Private data * Private data
@ -163,32 +139,6 @@ static char s_curlError[CURL_ERROR_SIZE];
* *
***/ ***/
// Detect whether we're running under TRANSGAMING Cider
//==============================================================================
static void TGDoCiderDetection () {
HMODULE hMod = GetModuleHandle ("ntdll");
if (!hMod)
return;
IsTransgaming pIsTg = (IsTransgaming)GetProcAddress (hMod, "IsTransgaming");
if (!pIsTg || !pIsTg ())
return;
TGGetOS pTGOS = (TGGetOS)GetProcAddress (hMod, "TGGetOS");
const char *pOS = NULL;
if (pTGOS)
pOS = pTGOS ();
if (!pOS || strcmp (pOS, "MacOSX"))
return;
TGIsCider = true;
pTGLaunchUNIXApp = (TGLaunchUNIXApp)GetProcAddress (hMod, "TGLaunchUNIXApp");
pTGUNIXAppReadLine = (TGUNIXAppReadLine)GetProcAddress (hMod, "TGUNIXAppReadLine");
pTGUNIXAppWriteLine = (TGUNIXAppWriteLine)GetProcAddress (hMod, "TGUNIXAppWriteLine");
pTGUNIXAppClose = (TGUNIXAppClose)GetProcAddress (hMod, "TGUNIXAppClose");
}
//============================================================================ //============================================================================
static void Abort () { static void Abort () {
s_retCode = 0; s_retCode = 0;
@ -283,37 +233,11 @@ static void TerminateGame () {
//============================================================================ //============================================================================
static void Recv_SetProgress (HWND hwnd, const SetProgressEvent &event) { static void Recv_SetProgress (HWND hwnd, const SetProgressEvent &event) {
SendMessage(GetDlgItem(s_dialog, IDC_PROGRESS), PBM_SETPOS, event.progress, NULL); SendMessage(GetDlgItem(s_dialog, IDC_PROGRESS), PBM_SETPOS, event.progress, NULL);
if (pTGApp)
{
char buf[64];
sprintf (buf, "bar:%d", event.progress);
if (!pTGUNIXAppWriteLine (pTGApp, buf))
{
pTGUNIXAppClose (pTGApp);
pTGApp = NULL;
PostQuitMessage (0);
}
}
} }
//============================================================================ //============================================================================
static void Recv_SetText (HWND hwnd, const SetTextEvent &event) { static void Recv_SetText (HWND hwnd, const SetTextEvent &event) {
bool b = SendMessage(GetDlgItem(s_dialog, IDC_TEXT), WM_SETTEXT, 0, (LPARAM) event.text); bool b = SendMessage(GetDlgItem(s_dialog, IDC_TEXT), WM_SETTEXT, 0, (LPARAM) event.text);
if (pTGApp)
{
char buf[MAX_PATH + 5];
sprintf (buf, "text:%s", event.text);
if (!pTGUNIXAppWriteLine (pTGApp, buf))
{
pTGUNIXAppClose (pTGApp);
pTGApp = NULL;
PostQuitMessage (0);
}
}
} }
//============================================================================ //============================================================================
@ -516,14 +440,6 @@ static void WindowThreadProc(void *) {
(LPCTSTR) 0 // name (LPCTSTR) 0 // name
); );
if (TGIsCider)
{
if (GetFileAttributes (TG_NEW_DIALOG_PATH) != INVALID_FILE_ATTRIBUTES)
pTGApp = pTGLaunchUNIXApp (TG_NEW_DIALOG_POPEN_PATH, "w");
else
pTGApp = pTGLaunchUNIXApp (TG_OLD_DIALOG_POPEN_PATH, "w");
}
s_dialog = ::CreateDialog( s_hInstance, MAKEINTRESOURCE( IDD_DIALOG ), NULL, SplashDialogProc ); s_dialog = ::CreateDialog( s_hInstance, MAKEINTRESOURCE( IDD_DIALOG ), NULL, SplashDialogProc );
SetWindowText(s_dialog, "URU Launcher"); SetWindowText(s_dialog, "URU Launcher");
@ -541,60 +457,11 @@ static void WindowThreadProc(void *) {
MessagePump(s_dialog); MessagePump(s_dialog);
if (pTGApp)
{
pTGUNIXAppWriteLine (pTGApp, "done");
pTGUNIXAppClose (pTGApp);
pTGApp = NULL;
}
s_dialog = 0; s_dialog = 0;
s_shutdown = true; s_shutdown = true;
s_shutdownEvent.Signal(); s_shutdownEvent.Signal();
} }
//============================================================================
static bool TGCheckForFrameworkUpdate ()
{
// If current.txt doesn't exist, then this is the first time we've been
// run. Copy version.txt to current.txt and continue starting up
if (GetFileAttributes (TG_CUR_FRAMEWORK_FILE) == INVALID_FILE_ATTRIBUTES)
{
CopyFile (TG_LATEST_FRAMEWORK_FILE, TG_CUR_FRAMEWORK_FILE, FALSE);
return false;
}
// If it does exist, then compare its contents to the contents of the latest version
// If they match, continue starting up
FILE *CurFile, *LatestFile;
CurFile = fopen (TG_CUR_FRAMEWORK_FILE, "rt");
LatestFile = fopen (TG_LATEST_FRAMEWORK_FILE, "rt");
char CurVer[64], LatestVer[64];
CurVer[0] = '\0';
LatestVer[0] = '\0';
if (CurFile)
{
fgets (CurVer, sizeof (CurVer), CurFile);
fclose (CurFile);
}
if (LatestFile)
{
fgets (LatestVer, sizeof (LatestVer), LatestFile);
fclose (LatestFile);
}
if (strcmp (CurVer, LatestVer) == 0)
return false;
// Contents don't match. Copy the latest to the current, put up a message box
// informing the user to restart the game, and exit
CopyFile (TG_LATEST_FRAMEWORK_FILE, TG_CUR_FRAMEWORK_FILE, FALSE);
MessageBox (nil, "Game framework requires updating. Please restart URU",
"URU Launcher", MB_ICONINFORMATION);
return true;
}
//============================================================================ //============================================================================
static size_t CurlCallback(void *buffer, size_t size, size_t nmemb, void *) static size_t CurlCallback(void *buffer, size_t size, size_t nmemb, void *)
{ {
@ -647,8 +514,6 @@ void PrepCallback (int id, void *param) {
s_prepared = true; s_prepared = true;
if (id) if (id)
s_shutdown = true; s_shutdown = true;
else if (TGIsCider && TGCheckForFrameworkUpdate ())
s_shutdown = true;
if (!s_shutdown) if (!s_shutdown)
InitGame(); InitGame();
@ -771,8 +636,6 @@ int __stdcall WinMain (
if (!cmdParser.IsSpecified(kArgCwd)) if (!cmdParser.IsSpecified(kArgCwd))
PathGetProgramDirectory(s_workingDir, arrsize(s_workingDir)); PathGetProgramDirectory(s_workingDir, arrsize(s_workingDir));
TGDoCiderDetection ();
s_hInstance = hInstance; s_hInstance = hInstance;
memset(&s_launcherInfo, 0, sizeof(s_launcherInfo)); memset(&s_launcherInfo, 0, sizeof(s_launcherInfo));
StrPrintf(s_launcherInfo.cmdLine, arrsize(s_launcherInfo.cmdLine), appCmdLine); StrPrintf(s_launcherInfo.cmdLine, arrsize(s_launcherInfo.cmdLine), appCmdLine);
@ -917,7 +780,6 @@ int __stdcall WinMain (
s_launcherInfo.SetStatusText = SetStatusTextCallback; s_launcherInfo.SetStatusText = SetStatusTextCallback;
s_launcherInfo.SetTimeRemaining = SetTimeRemainingCallback; s_launcherInfo.SetTimeRemaining = SetTimeRemainingCallback;
s_launcherInfo.SetBytesRemaining = SetBytesRemainingCallback; s_launcherInfo.SetBytesRemaining = SetBytesRemainingCallback;
s_launcherInfo.IsTGCider = TGIsCider;
PrepareGame(); PrepareGame();
while (!s_shutdown) // wait for window to be closed while (!s_shutdown) // wait for window to be closed
@ -964,13 +826,6 @@ int __stdcall WinMain (
break; break;
} }
if (pTGApp)
{
pTGUNIXAppWriteLine (pTGApp, "done");
pTGUNIXAppClose (pTGApp);
pTGApp = NULL;
}
curl_global_cleanup(); curl_global_cleanup();
return s_launcherInfo.returnCode; return s_launcherInfo.returnCode;

1
Sources/Plasma/Apps/plUruLauncher/plLauncherInfo.h

@ -85,7 +85,6 @@ struct plLauncherInfo {
setBytesRemainingCallback SetBytesRemaining; setBytesRemainingCallback SetBytesRemaining;
PatchInfo patchInfo; PatchInfo patchInfo;
bool IsTGCider;
DWORD returnCode; // used so we can pass a new process id back to gametap. That way gametap wont think uru has exited when the patcher quits. DWORD returnCode; // used so we can pass a new process id back to gametap. That way gametap wont think uru has exited when the patcher quits.
}; };

12
Sources/Plasma/NucleusLib/pnAsyncCoreExe/CMakeLists.txt

@ -31,14 +31,6 @@ set(pnAsyncCoreExe_PRIVATE_UNIX
Private/Unix/pnAceUx.h Private/Unix/pnAceUx.h
) )
set(pnAsyncCoreExe_PRIVATE_W9X
Private/W9x/pnAceW9x.cpp
Private/W9x/pnAceW9x.h
Private/W9x/pnAceW9xInt.h
Private/W9x/pnAceW9xSocket.cpp
Private/W9x/pnAceW9xThread.cpp
)
set(pnAsyncCoreExe_PRIVATE_WIN32 set(pnAsyncCoreExe_PRIVATE_WIN32
Private/Win32/pnAceW32Dns.cpp Private/Win32/pnAceW32Dns.cpp
Private/Win32/pnAceW32Thread.cpp Private/Win32/pnAceW32Thread.cpp
@ -49,13 +41,11 @@ set(pnAsyncCoreExe_PRIVATE_WIN32
add_library(pnAsyncCoreExe STATIC add_library(pnAsyncCoreExe STATIC
${pnAsyncCoreExe_SOURCES} ${pnAsyncCoreExe_HEADERS} ${pnAsyncCoreExe_SOURCES} ${pnAsyncCoreExe_HEADERS}
${pnAsyncCoreExe_PRIVATE} ${pnAysncCoreExe_PRIVATE_NT} ${pnAsyncCoreExe_PRIVATE} ${pnAysncCoreExe_PRIVATE_NT}
${pnAsyncCoreExe_PRIVATE_UNIX} ${pnAsyncCoreExe_PRIVATE_W9X} ${pnAsyncCoreExe_PRIVATE_UNIX} ${pnAsyncCoreExe_PRIVATE_WIN32})
${pnAsyncCoreExe_PRIVATE_WIN32})
source_group("Source Files" FILES ${pnAsyncCoreExe_SOURCES}) source_group("Source Files" FILES ${pnAsyncCoreExe_SOURCES})
source_group("Header Files" FILES ${pnAsyncCoreExe_HEADERS}) source_group("Header Files" FILES ${pnAsyncCoreExe_HEADERS})
source_group("Private" FILES ${pnAsyncCoreExe_PRIVATE}) source_group("Private" FILES ${pnAsyncCoreExe_PRIVATE})
source_group("Private\\Nt" FILES ${pnAysncCoreExe_PRIVATE_NT}) source_group("Private\\Nt" FILES ${pnAysncCoreExe_PRIVATE_NT})
source_group("Private\\Unix" FILES ${pnAsyncCoreExe_PRIVATE_UNIX}) source_group("Private\\Unix" FILES ${pnAsyncCoreExe_PRIVATE_UNIX})
source_group("Private\\W9x" FILES ${pnAsyncCoreExe_PRIVATE_W9X})
source_group("Private\\Win32" FILES ${pnAsyncCoreExe_PRIVATE_WIN32}) source_group("Private\\Win32" FILES ${pnAsyncCoreExe_PRIVATE_WIN32})

1
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Pch.h

@ -57,7 +57,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsThread.h" #include "hsThread.h"
#include "Private/pnAceInt.h" #include "Private/pnAceInt.h"
#include "Private/W9x/pnAceW9x.h"
#include "Private/Nt/pnAceNt.h" #include "Private/Nt/pnAceNt.h"
#include "Private/Unix/pnAceUx.h" #include "Private/Unix/pnAceUx.h"

81
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9x.cpp

@ -1,81 +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 <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
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/pnAsyncCoreExe/Private/W9x/pnAceW9x.cpp
*
***/
#include "../../Pch.h"
#pragma hdrstop
#include "pnAceW9xInt.h"
/****************************************************************************
*
* Exported functions
*
***/
//===========================================================================
void W9xGetApi (AsyncApi * api) {
using namespace W9x;
api->initialize = W9xThreadInitialize;
api->destroy = W9xThreadDestroy;
api->signalShutdown = W9xThreadSignalShutdown;
api->waitForShutdown = W9xThreadWaitForShutdown;
api->sleep = W9xThreadSleep;
api->socketConnect = W9xSocketConnect;
api->socketConnectCancel = W9xSocketConnectCancel;
api->socketDisconnect = W9xSocketDisconnect;
api->socketDelete = W9xSocketDelete;
api->socketSend = W9xSocketSend;
api->socketWrite = W9xSocketWrite;
api->socketSetNotifyProc = W9xSocketSetNotifyProc;
api->socketSetBacklogAlloc = W9xSocketSetBacklogAlloc;
api->socketStartListening = W9xSocketStartListening;
api->socketStopListening = W9xSocketStopListening;
api->socketEnableNagling = W9xSocketEnableNagling;
}

64
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9x.h

@ -1,64 +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 <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
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/pnAsyncCoreExe/Private/W9x/pnAceW9x.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNASYNCCOREEXE_PRIVATE_W9X_PNACEW9X_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9x.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNASYNCCOREEXE_PRIVATE_W9X_PNACEW9X_H
#ifdef HS_BUILD_FOR_WIN32
/****************************************************************************
*
* Win9x API functions
*
***/
void W9xGetApi (AsyncApi * api);
#endif // HS_BUILD_FOR_WIN32

142
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xInt.h

@ -1,142 +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 <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
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/pnAsyncCoreExe/Private/W9x/pnAceW9xInt.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNASYNCCOREEXE_PRIVATE_W9X_PNACEW9XINT_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xInt.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNASYNCCOREEXE_PRIVATE_W9X_PNACEW9XINT_H
namespace W9x {
/*****************************************************************************
*
* Internal types
*
***/
class CThreadDispObject : public AtomicRef {
public:
CThreadDispObject ();
virtual ~CThreadDispObject () { }
void Close ();
virtual void Complete (void * op, CCritSect * critSect, AsyncId asyncId) = 0;
virtual void Delete (void * op) = 0;
AsyncId Queue (void * op);
};
/*****************************************************************************
*
* W9x internal async API
*
***/
void W9xThreadInitialize ();
void W9xThreadDestroy (unsigned exitThreadWaitMs);
void W9xThreadSignalShutdown ();
void W9xThreadWaitForShutdown ();
void W9xThreadSleep (unsigned sleepMs);
bool W9xThreadWaitId (
AsyncFile file,
AsyncId asyncId,
unsigned timeoutMs
);
void W9xSocketConnect (
AsyncCancelId * cancelId,
const plNetAddress& netAddr,
FAsyncNotifySocketProc notifyProc,
void * param,
const void * sendData,
unsigned sendBytes,
unsigned connectMs,
unsigned localPort
);
void W9xSocketConnectCancel (
FAsyncNotifySocketProc notifyProc,
AsyncCancelId cancelId
);
void W9xSocketDisconnect (
AsyncSocket sock,
bool hardClose
);
void W9xSocketDelete (AsyncSocket sock);
void W9xSocketDestroy ();
bool W9xSocketSend (
AsyncSocket sock,
const void * data,
unsigned bytes
);
bool W9xSocketWrite (
AsyncSocket sock,
const void * buffer,
unsigned bytes,
void * param
);
void W9xSocketSetNotifyProc (
AsyncSocket sock,
FAsyncNotifySocketProc notifyProc
);
void W9xSocketSetBacklogAlloc (
AsyncSocket sock,
unsigned bufferSize
);
unsigned W9xSocketStartListening (
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
);
void W9xSocketStopListening (
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
);
void W9xSocketEnableNagling (
AsyncSocket conn,
bool enable
);
} // namespace W9x

1224
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xSocket.cpp

File diff suppressed because it is too large Load Diff

451
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xThread.cpp

@ -1,451 +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 <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
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/pnAsyncCoreExe/Private/W9x/pnAceW9xThread.cpp
*
***/
#include "../../Pch.h"
#pragma hdrstop
#include "pnAceW9xInt.h"
namespace W9x {
/*****************************************************************************
*
* Private data
*
***/
const unsigned kThreadCount = 2;
static CCritSect s_critSect;
static bool s_destroying;
static HANDLE s_destroyEvent;
static unsigned s_sequence;
static HANDLE s_shutdownEvent;
static HANDLE s_signalEvent;
static HANDLE s_thread[kThreadCount];
/****************************************************************************
*
* ThreadWaitRec
*
***/
struct ThreadWaitRec {
HANDLE event;
LINK(ThreadWaitRec) link;
};
/****************************************************************************
*
* CThreadDispRec
*
***/
class CThreadDispRec {
private:
CThreadDispObject * m_object;
void * m_op;
AsyncId m_ioId;
LISTDECL(ThreadWaitRec, link) m_waitList;
public:
LINK(CThreadDispRec) m_link;
CThreadDispRec (
CThreadDispObject * object,
void * op,
AsyncId * asyncId
);
~CThreadDispRec ();
void Complete (CCritSect * critSect);
AsyncId GetId () const { return m_ioId; }
void LinkWait (ThreadWaitRec * wait);
};
static LISTDECL(CThreadDispRec, m_link) s_dispList;
static LISTDECL(CThreadDispRec, m_link) s_dispInProcList;
//===========================================================================
CThreadDispRec::CThreadDispRec (
CThreadDispObject * object,
void * op,
AsyncId * asyncId
) :
m_object(object),
m_op(op)
{
s_critSect.Enter();
// Verify that this module is not being destroyed
ASSERT(!s_destroying);
// Increment the owning object's reference count
object->IncRef();
// Assign an id
m_ioId = (AsyncId)++s_sequence;
if (!m_ioId)
m_ioId = (AsyncId)++s_sequence;
*asyncId = m_ioId;
// Link this record to the dispatch list
s_dispList.Link(this);
s_critSect.Leave();
}
//===========================================================================
CThreadDispRec::~CThreadDispRec () {
// Delete the operation data
CThreadDispObject * object = m_object;
object->Delete(m_op);
s_critSect.Enter();
// Unlink this record
m_link.Unlink();
// Wake up all threads blocking on this operation. We must unlink each
// wait record before we signal it.
for (ThreadWaitRec * rec; (rec = m_waitList.Head()) != nil; ) {
m_waitList.Unlink(rec);
SetEvent(rec->event);
}
// Decrement the owning object's reference count
object->DecRef();
s_critSect.Leave();
}
//===========================================================================
void CThreadDispRec::Complete (CCritSect * critSect) {
m_object->Complete(m_op, critSect, m_ioId);
}
//===========================================================================
void CThreadDispRec::LinkWait (ThreadWaitRec * wait) {
// The caller should have already claimed the critical section before
// calling this function
m_waitList.Link(wait);
}
/****************************************************************************
*
* CThreadDispObject
*
***/
//===========================================================================
CThreadDispObject::CThreadDispObject () {
IncRef();
}
//===========================================================================
void CThreadDispObject::Close () {
s_critSect.Enter();
DecRef();
s_critSect.Leave();
}
//===========================================================================
AsyncId CThreadDispObject::Queue (void * op) {
AsyncId asyncId = 0;
new CThreadDispRec(this, op, &asyncId);
SetEvent(s_signalEvent);
return asyncId;
}
/****************************************************************************
*
* Thread procedure
*
***/
//===========================================================================
static unsigned THREADCALL W9xThreadProc (AsyncThread *) {
// Perform the main thread loop
for (;;) {
unsigned timeout = (unsigned)-1;
// If an operation is queued, complete it and dispatch a notification.
// The code that processes the operation is responsible for leaving
// our critical section. This ensures that operations are completed
// in order.
s_critSect.Enter();
CThreadDispRec * rec = s_dispList.Head();
if (rec) {
s_dispInProcList.Link(rec);
rec->Complete(&s_critSect);
delete rec;
timeout = 0;
}
else {
s_critSect.Leave();
}
// Consume events, check for destruction, and block if we have
// nothing to do.
HANDLE events[] = {s_destroyEvent, s_signalEvent};
uint32_t result = WaitForMultipleObjects(
arrsize(events),
events,
FALSE,
INFINITE
);
if (result == WAIT_OBJECT_0)
return 0;
}
}
/****************************************************************************
*
* Exported functions
*
***/
//===========================================================================
void W9xThreadDestroy (
unsigned exitThreadWaitMs
) {
// Wait until all outstanding I/O is complete. We allow new I/O
// operations to be queued while old ones are completing.
s_critSect.Enter();
while (s_dispList.Head() || s_dispInProcList.Head()) {
s_critSect.Leave();
Sleep(10);
s_critSect.Enter();
}
// Once all I/O operations are complete, we disallow any future
// I/O operations from being queued.
s_destroying = true;
s_critSect.Leave();
// Signal thread destruction
if (s_destroyEvent)
SetEvent(s_destroyEvent);
// Wait for thread destruction
for (unsigned thread = kThreadCount; thread--; )
if (s_thread[thread]) {
// Wait for the thread to terminate
WaitForSingleObject(s_thread[thread], exitThreadWaitMs);
// Close the thread handle
CloseHandle(s_thread[thread]);
s_thread[thread] = 0;
}
// Destroy internal modules
W9xSocketDestroy();
// Destroy events
if (s_destroyEvent) {
CloseHandle(s_destroyEvent);
s_destroyEvent = 0;
}
if (s_shutdownEvent) {
CloseHandle(s_shutdownEvent);
s_shutdownEvent = 0;
}
if (s_signalEvent) {
CloseHandle(s_signalEvent);
s_signalEvent = 0;
}
}
//===========================================================================
void W9xThreadInitialize () {
// Reset static variables
s_destroying = false;
// Create a manual reset event to use for signaling thread destruction
if (s_destroyEvent)
ResetEvent(s_destroyEvent);
else {
s_destroyEvent = CreateEvent(nil, TRUE, FALSE, nil);
ASSERT(s_destroyEvent);
}
// Create an auto-reset event to use for signaling the thread to process
// notifications
if (!s_signalEvent) {
s_signalEvent = CreateEvent(nil, FALSE, FALSE, nil);
ASSERT(s_signalEvent);
}
// Create a manual reset event to use for signaling application shutdown
if (s_shutdownEvent)
ResetEvent(s_shutdownEvent);
else {
s_shutdownEvent = CreateEvent(nil, TRUE, FALSE, nil);
ASSERT(s_shutdownEvent);
}
// Create threads
for (unsigned thread = 0; thread < kThreadCount; ++thread) {
if (!s_thread[thread]) {
s_thread[thread] = (HANDLE) AsyncThreadCreate(
W9xThreadProc,
(void *) thread,
L"W9xWorkerThread"
);
}
}
}
//===========================================================================
void W9xThreadSignalShutdown () {
SetEvent(s_shutdownEvent);
}
//===========================================================================
void W9xThreadSleep (
unsigned sleepMs
) {
Sleep(sleepMs);
}
//===========================================================================
void W9xThreadWaitForShutdown () {
// We know that the applicaton is finished initializing at this point.
// While it was still initializing, it may have returned an infinite
// sleep time from the idle procedure, which would prevent us from ever
// calling it again. Therefore, we trigger an idle callback here.
SetEvent(s_signalEvent);
// Wait for the application to signal shutdown
WaitForSingleObject(s_shutdownEvent, INFINITE);
}
//===========================================================================
bool W9xThreadWaitId (
AsyncFile file,
AsyncId asyncId,
unsigned timeoutMs
) {
// Find a pending I/O operation with the given id
s_critSect.Enter();
CThreadDispRec * disp;
for (disp = s_dispList.Head(); disp && (disp->GetId() != asyncId); disp = s_dispList.Next(disp))
;
if (!disp)
for (disp = s_dispInProcList.Head(); disp && (disp->GetId() != asyncId); disp = s_dispInProcList.Next(disp))
;
// If we couldn't find the given id, the operation must have already
// completed, so return true.
if (!disp) {
s_critSect.Leave();
return true;
}
// The operation has not completed. If the timeout is zero, return
// false.
if (!timeoutMs) {
s_critSect.Leave();
return false;
}
// Create a wait event
HANDLE event = CreateEvent(nil, FALSE, FALSE, nil);
// Create a wait record and link it to the I/O operation
ThreadWaitRec wait;
wait.event = event;
disp->LinkWait(&wait);
s_critSect.Leave();
// Wait for the operation to complete
DWORD result = WaitForSingleObject(event, timeoutMs);
// If the operation completed then the dispatcher unlinked our wait
// record before signaling it. We can simply free the event and return.
if (result == WAIT_OBJECT_0) {
CloseHandle(event);
return true;
}
// Unlink our wait record from the I/O operation
s_critSect.Enter();
wait.link.Unlink();
s_critSect.Leave();
// Free the event
CloseHandle(event);
// Return false, because the operation did not complete during the
// timeout period
return false;
}
} // namespace W9x

33
Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceCore.cpp

@ -65,7 +65,6 @@ static long s_perf[kNumAsyncPerfCounters];
***/ ***/
AsyncApi g_api; AsyncApi g_api;
bool s_transgaming;
/***************************************************************************** /*****************************************************************************
@ -74,30 +73,6 @@ bool s_transgaming;
* *
***/ ***/
//============================================================================
static void DoTransgamingCheck () {
#ifdef HS_BUILD_FOR_WIN32
#ifdef CLIENT
HMODULE hMod = GetModuleHandle("ntdll");
if (!hMod)
return;
s_transgaming = GetProcAddress(hMod, "IsTransgaming") != nil;
#endif
#endif
}
//===========================================================================
static void IAsyncInitUseW9x () {
#ifdef HS_BUILD_FOR_WIN32
W9xGetApi(&g_api);
#else
ErrorAssert("W9x I/O Not supported on this platform");
#endif
}
//=========================================================================== //===========================================================================
static void IAsyncInitUseNt () { static void IAsyncInitUseNt () {
#ifdef HS_BUILD_FOR_WIN32 #ifdef HS_BUILD_FOR_WIN32
@ -120,13 +95,7 @@ static void IAsyncInitUseUnix () {
//=========================================================================== //===========================================================================
static void IAsyncInitForClient () { static void IAsyncInitForClient () {
#ifdef HS_BUILD_FOR_WIN32 #ifdef HS_BUILD_FOR_WIN32
DoTransgamingCheck(); IAsyncInitUseNt();
if (s_transgaming) {
IAsyncInitUseW9x();
}
else {
IAsyncInitUseNt();
}
#elif HS_BUILD_FOR_UNIX #elif HS_BUILD_FOR_UNIX
IAsyncInitUseUnix(); IAsyncInitUseUnix();
#else #else

Loading…
Cancel
Save