Browse Source

Kill high level TransGaming support

Adam Johnson 12 years ago
parent
commit
8a9c3ec177
  1. 211
      Sources/Plasma/Apps/plClient/winmain.cpp
  2. 5
      Sources/Plasma/Apps/plClientPatcher/UruPlayer.cpp
  3. 145
      Sources/Plasma/Apps/plUruLauncher/Main.cpp
  4. 1
      Sources/Plasma/Apps/plUruLauncher/plLauncherInfo.h

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

@ -151,30 +151,6 @@ static wchar_t s_patcherExeName[] = L"UruLauncher.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
//============================================================================
@ -194,176 +170,6 @@ static void AuthFailedStrings (ENetError authError,
const char **ppStr1, const char **ppStr2,
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, ...);
// Handles all the windows messages we might receive
@ -1027,9 +833,8 @@ static void SaveUserPass (LoginDialogParam *pLoginParam, char *password)
}
NetCommSetAccountUsernamePassword(theUser.ToWchar(), pLoginParam->namePassHash);
if (TGIsCider)
NetCommSetAuthTokenAndOS(nil, L"mac");
else
// FIXME: Real OS detection
NetCommSetAuthTokenAndOS(nil, L"win");
wchar_t fileAndPath[MAX_PATH];
@ -1421,8 +1226,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
}
}
TGDoCiderDetection ();
#ifdef PLASMA_EXTERNAL_RELEASE
// if the client was started directly, run the patcher, and shutdown
STARTUPINFOW si;
@ -1547,17 +1350,10 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
}
if (doIntroDialogs) {
if (TGIsCider)
needExit = !TGRunLoginDialog(&loginParam);
else if (::DialogBoxParam( hInst, MAKEINTRESOURCE( IDD_URULOGIN_MAIN ), NULL, UruLoginDialogProc, (LPARAM)&loginParam ) <= 0)
needExit = true;
needExit = ::DialogBoxParam( hInst, MAKEINTRESOURCE( IDD_URULOGIN_MAIN ), NULL, UruLoginDialogProc, (LPARAM)&loginParam ) <= 0;
}
if (doIntroDialogs && !needExit) {
if (TGIsCider)
needExit = !TGRunTOSDialog ();
else
{
HINSTANCE hRichEdDll = LoadLibrary("RICHED20.DLL");
INT_PTR val = ::DialogBoxParam( hInst, MAKEINTRESOURCE( IDD_URULOGIN_EULA ), NULL, UruTOSDialogProc, (LPARAM)hInst);
FreeLibrary(hRichEdDll);
@ -1566,7 +1362,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
needExit = true;
}
}
}
curl_global_cleanup();

5
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
static const wchar_t s_manifest[] = L"Internal";
static const wchar_t s_macmanifest[] = L"macInternal";
static const wchar_t s_thinmanifest[] = L"ThinInternal";
#else
static const wchar_t s_manifest[] = L"External";
static const wchar_t s_macmanifest[] = L"macExternal";
static const wchar_t s_thinmanifest[] = L"ThinExternal";
#endif
@ -760,9 +758,6 @@ static void ThinManifestCallback (
StrPrintf(path, arrsize(path), "%s%S", s_workingDir, manifest[i].clientName);
if(!MD5Check(path, manifest[i].md5)){
s_patchComplete = false;
if (info->IsTGCider)
NetCliFileManifestRequest(ManifestCallback, info, s_macmanifest, info->buildId);
else
NetCliFileManifestRequest(ManifestCallback, info, s_manifest, info->buildId);
break;
}

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
@ -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 () {
s_retCode = 0;
@ -283,37 +233,11 @@ static void TerminateGame () {
//============================================================================
static void Recv_SetProgress (HWND hwnd, const SetProgressEvent &event) {
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) {
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
);
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 );
SetWindowText(s_dialog, "URU Launcher");
@ -541,60 +457,11 @@ static void WindowThreadProc(void *) {
MessagePump(s_dialog);
if (pTGApp)
{
pTGUNIXAppWriteLine (pTGApp, "done");
pTGUNIXAppClose (pTGApp);
pTGApp = NULL;
}
s_dialog = 0;
s_shutdown = true;
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 *)
{
@ -647,8 +514,6 @@ void PrepCallback (int id, void *param) {
s_prepared = true;
if (id)
s_shutdown = true;
else if (TGIsCider && TGCheckForFrameworkUpdate ())
s_shutdown = true;
if (!s_shutdown)
InitGame();
@ -771,8 +636,6 @@ int __stdcall WinMain (
if (!cmdParser.IsSpecified(kArgCwd))
PathGetProgramDirectory(s_workingDir, arrsize(s_workingDir));
TGDoCiderDetection ();
s_hInstance = hInstance;
memset(&s_launcherInfo, 0, sizeof(s_launcherInfo));
StrPrintf(s_launcherInfo.cmdLine, arrsize(s_launcherInfo.cmdLine), appCmdLine);
@ -917,7 +780,6 @@ int __stdcall WinMain (
s_launcherInfo.SetStatusText = SetStatusTextCallback;
s_launcherInfo.SetTimeRemaining = SetTimeRemainingCallback;
s_launcherInfo.SetBytesRemaining = SetBytesRemainingCallback;
s_launcherInfo.IsTGCider = TGIsCider;
PrepareGame();
while (!s_shutdown) // wait for window to be closed
@ -964,13 +826,6 @@ int __stdcall WinMain (
break;
}
if (pTGApp)
{
pTGUNIXAppWriteLine (pTGApp, "done");
pTGUNIXAppClose (pTGApp);
pTGApp = NULL;
}
curl_global_cleanup();
return s_launcherInfo.returnCode;

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

@ -85,7 +85,6 @@ struct plLauncherInfo {
setBytesRemainingCallback SetBytesRemaining;
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.
};

Loading…
Cancel
Save