Browse Source

Merge New Patcher from H'uru with DependsManifest for running installers

for prerequisites before updating.

Merge branch 'hoikas/newpatcher-1'
hoikas/keyleaks-1
rarified 5 years ago
parent
commit
69f1fa22b5
  1. 8
      .editorconfig
  2. 77
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plUruLauncher/Main.cpp
  3. 1
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plUruLauncher/Pch.h
  4. 903
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plUruLauncher/SelfPatcher.cpp
  5. 1
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plUruLauncher/plLauncherInfo.h
  6. 22
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plEncryption/plChecksum.cpp
  7. 4
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plEncryption/plChecksum.h
  8. 2
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp

8
.editorconfig

@ -0,0 +1,8 @@
# Indicate there is no need to continue trawling
root = true
# Cyan's source files use tabs... mostly...
[*]
end_of_line = crlf
indent_style = tab
indent_size = 4

77
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plUruLauncher/Main.cpp

@ -157,13 +157,12 @@ static long s_terminationIssued;
static bool s_terminated;
static plLauncherInfo s_launcherInfo;
static HANDLE s_thread;
static HANDLE s_event;
static CEvent s_shutdownDesiredEvent(kEventManualReset);
static HINSTANCE s_hInstance;
static HWND s_dialog;
static CEvent s_dialogCreateEvent(kEventManualReset);
static CCritSect s_critsect;
static LISTDECL(WndEvent, link) s_eventQ;
static CEvent s_shutdownEvent(kEventManualReset);
static CEvent s_shutdownDialogEvent(kEventManualReset);
static wchar s_workingDir[MAX_PATH];
static CEvent s_statusEvent(kEventManualReset);
@ -311,7 +310,7 @@ static void TerminateGame () {
//============================================================================
static void Recv_SetProgress (HWND hwnd, const SetProgressEvent &event) {
SendMessage(GetDlgItem(s_dialog, IDC_PROGRESS), PBM_SETPOS, event.progress, NULL);
SendMessage(GetDlgItem(s_launcherInfo.dialog, IDC_PROGRESS), PBM_SETPOS, event.progress, NULL);
if (pTGApp)
{
@ -329,7 +328,7 @@ static void Recv_SetProgress (HWND hwnd, const SetProgressEvent &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_launcherInfo.dialog, IDC_TEXT), WM_SETTEXT, 0, (LPARAM) event.text);
if (pTGApp)
{
@ -347,7 +346,7 @@ static void Recv_SetText (HWND hwnd, const SetTextEvent &event) {
//============================================================================
static void Recv_SetStatusText (HWND hwnd, const SetStatusTextEvent &event) {
bool b = SendMessage(GetDlgItem(s_dialog, IDC_STATUS_TEXT), WM_SETTEXT, 0, (LPARAM) event.text);
bool b = SendMessage(GetDlgItem(s_launcherInfo.dialog, IDC_STATUS_TEXT), WM_SETTEXT, 0, (LPARAM) event.text);
}
//============================================================================
@ -359,7 +358,7 @@ static void Recv_SetTimeRemaining (HWND hwnd, const SetTimeRemainingEvent &event
if(event.seconds == 0xffffffff)
{
SendMessage(GetDlgItem(s_dialog, IDC_TIMEREMAINING), WM_SETTEXT, 0, (LPARAM) "estimating...");
SendMessage(GetDlgItem(s_launcherInfo.dialog, IDC_TIMEREMAINING), WM_SETTEXT, 0, (LPARAM) "...");
return;
}
@ -392,7 +391,7 @@ static void Recv_SetTimeRemaining (HWND hwnd, const SetTimeRemainingEvent &event
StrPrintf(text, arrsize(text), "%s%d min ", text, minutes);
if( seconds || !text[0])
StrPrintf(text, arrsize(text), "%s%d sec", text, seconds);
bool b = SendMessage(GetDlgItem(s_dialog, IDC_TIMEREMAINING), WM_SETTEXT, 0, (LPARAM) text);
bool b = SendMessage(GetDlgItem(s_launcherInfo.dialog, IDC_TIMEREMAINING), WM_SETTEXT, 0, (LPARAM) text);
}
//============================================================================
@ -402,6 +401,11 @@ static void Recv_SetBytesRemaining (HWND hwnd, const SetBytesRemainingEvent &eve
unsigned decimal;
unsigned bytes = event.bytes;
if (bytes == 0xffffffff) {
SendMessage(GetDlgItem(s_launcherInfo.dialog, IDC_BYTESREMAINING), WM_SETTEXT, 0, (LPARAM) "...");
return;
}
unsigned GB = bytes / 1000000000;
if(GB)
{
@ -416,7 +420,7 @@ static void Recv_SetBytesRemaining (HWND hwnd, const SetBytesRemainingEvent &eve
decimal = bytes / 100000; // to one decimal place
StrPrintf(text, arrsize(text), "%d.%d MB", MB, decimal);
}
bool b = SendMessage(GetDlgItem(s_dialog, IDC_BYTESREMAINING), WM_SETTEXT, 0, (LPARAM) text);
bool b = SendMessage(GetDlgItem(s_launcherInfo.dialog, IDC_BYTESREMAINING), WM_SETTEXT, 0, (LPARAM) text);
}
//============================================================================
@ -462,19 +466,19 @@ static void MessagePump (HWND hwnd) {
// wait for a message or the shutdown event
const DWORD result = MsgWaitForMultipleObjects(
1,
&s_event,
&s_shutdownDesiredEvent.Handle(),
false,
INFINITE,
QS_ALLEVENTS
);
if (result == WAIT_OBJECT_0)
return;
PostQuitMessage(0);
// process windows messages
MSG msg;
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
if (!IsDialogMessage(s_dialog, &msg)) {
if (!IsDialogMessage(s_launcherInfo.dialog, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@ -503,8 +507,8 @@ BOOL CALLBACK SplashDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
if(!s_shutdown)
{
s_shutdown = true;
SendMessage(GetDlgItem(s_dialog, IDC_TEXT), WM_SETTEXT, 0, (LPARAM) "Shutting Down...");
EnableWindow(GetDlgItem(s_dialog, IDCANCEL), false);
SendMessage(GetDlgItem(s_launcherInfo.dialog, IDC_TEXT), WM_SETTEXT, 0, (LPARAM) "Shutting Down...");
EnableWindow(GetDlgItem(s_launcherInfo.dialog, IDCANCEL), false);
}
}
break;
@ -538,12 +542,6 @@ BOOL CALLBACK SplashDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
static void WindowThreadProc(void *) {
InitCommonControls();
s_event = CreateEvent(
(LPSECURITY_ATTRIBUTES) 0,
false, // auto reset
false, // initial state off
(LPCTSTR) 0 // name
);
if (TGIsCider)
{
@ -553,22 +551,22 @@ static void WindowThreadProc(void *) {
pTGApp = pTGLaunchUNIXApp (TG_OLD_DIALOG_POPEN_PATH, "w");
}
s_dialog = ::CreateDialog( s_hInstance, MAKEINTRESOURCE( IDD_DIALOG ), NULL, SplashDialogProc );
SetWindowText(s_dialog, "URU Launcher");
s_launcherInfo.dialog = ::CreateDialog( s_hInstance, MAKEINTRESOURCE( IDD_DIALOG ), NULL, SplashDialogProc );
SetWindowText(s_launcherInfo.dialog, "URU Launcher");
::SetDlgItemText( s_dialog, IDC_TEXT, "Initializing patcher...");
SetTimer(s_dialog, kEventTimer, 250, 0);
::SetDlgItemText( s_launcherInfo.dialog, IDC_TEXT, "Initializing patcher...");
SetTimer(s_launcherInfo.dialog, kEventTimer, 250, 0);
char productString[256];
wchar productStringW[256];
ProductString(productStringW, arrsize(productStringW));
StrToAnsi(productString, productStringW, arrsize(productString));
SendMessage(GetDlgItem(s_dialog, IDC_PRODUCTSTRING), WM_SETTEXT, 0, (LPARAM) productString);
SendMessage(GetDlgItem(s_launcherInfo.dialog, IDC_PRODUCTSTRING), WM_SETTEXT, 0, (LPARAM) productString);
s_dialogCreateEvent.Signal();
MessagePump(s_dialog);
MessagePump(s_launcherInfo.dialog);
if (pTGApp)
{
@ -577,9 +575,9 @@ static void WindowThreadProc(void *) {
pTGApp = NULL;
}
s_dialog = 0;
s_launcherInfo.dialog = 0;
s_shutdown = true;
s_shutdownEvent.Signal();
s_shutdownDialogEvent.Signal();
}
//============================================================================
@ -712,7 +710,7 @@ static void StatusCallback(void *)
HINTERNET hConnect = 0;
// update while we are running
while(!s_shutdown)
do
{
if(BuildTypeServerStatusPath())
{
@ -745,11 +743,9 @@ static void StatusCallback(void *)
WinHttpCloseHandle(hSession);
}
for(unsigned i = 0; i < UPDATE_STATUSMSG_SECONDS && !s_shutdown; ++i)
{
Sleep(1000);
}
}
if (s_shutdownDesiredEvent.Wait(UPDATE_STATUSMSG_SECONDS * 1000))
break;
} while (!s_shutdown);
s_statusEvent.Signal();
}
@ -1062,15 +1058,16 @@ int __stdcall WinMain (
}
ShutdownAsyncCore();
s_statusEvent.Wait(kEventWaitForever);
PostMessage(s_dialog, WM_QUIT, 0, 0); // tell our window to shutdown
s_shutdownEvent.Wait(kEventWaitForever); // wait for our window to shutdown
SetConsoleCtrlHandler(CtrlHandler, FALSE);
// Signal teardown of our junk and stuff.
s_shutdownDesiredEvent.Signal();
// Wait for the hwnd and status event to shutdown
s_statusEvent.Wait(kEventWaitForever);
s_shutdownDialogEvent.Wait(kEventWaitForever);
if (s_event)
CloseHandle(s_event);
SetConsoleCtrlHandler(CtrlHandler, FALSE);
s_eventQ.Clear();
break;

1
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plUruLauncher/Pch.h

@ -52,6 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <process.h>
#include <time.h>
#include "hsThread.h"
#include "pnUtils/pnUtils.h"
#include "pnNetBase/pnNetBase.h"
#include "pnAsyncCore/pnAsyncCore.h"

903
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plUruLauncher/SelfPatcher.cpp

File diff suppressed because it is too large Load Diff

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

@ -87,6 +87,7 @@ struct plLauncherInfo {
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.
HWND dialog;
};

22
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plEncryption/plChecksum.cpp

@ -90,6 +90,11 @@ plMD5Checksum::plMD5Checksum( const char *fileName )
CalcFromFile( fileName );
}
plMD5Checksum::plMD5Checksum( hsStream* stream )
{
CalcFromStream(stream);
}
void plMD5Checksum::Clear()
{
memset( fChecksum, 0, sizeof( fChecksum ) );
@ -98,23 +103,30 @@ void plMD5Checksum::Clear()
void plMD5Checksum::CalcFromFile( const char *fileName )
{
FILE *fp;
hsUNIXStream s;
fValid = false;
if( fp = fopen(fileName, "rb" ) )
if( s.Open(fileName) )
{
CalcFromStream(&s);
s.Close();
}
}
void plMD5Checksum::CalcFromStream( hsStream* stream )
{
UInt32 sPos = stream->GetPosition();
unsigned loadLen = 1024 * 1024;
Start();
UInt8 *buf = TRACKED_NEW UInt8[loadLen];
while(int read = fread(buf, sizeof(UInt8), loadLen, fp))
while(int read = stream->Read(loadLen, buf))
AddTo( read, buf );
delete[] buf;
Finish();
fclose(fp);
}
stream->SetPosition(sPos);
}
void plMD5Checksum::Start( void )

4
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plEncryption/plChecksum.h

@ -58,6 +58,8 @@ public:
SumStorage GetChecksum() { return fSum; }
};
class hsStream;
class plMD5Checksum
{
protected:
@ -74,11 +76,13 @@ class plMD5Checksum
plMD5Checksum();
plMD5Checksum( const plMD5Checksum &rhs );
plMD5Checksum( const char *fileName );
plMD5Checksum( hsStream* stream );
hsBool IsValid( void ) const { return fValid; }
void Clear();
void CalcFromFile( const char *fileName );
void CalcFromStream( hsStream* stream );
void Start( void );
void AddTo( UInt32 size, const UInt8 *buffer );

2
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp

@ -71,7 +71,7 @@ hsBool plPXPhysicalControllerCore::fDebugDisplay = false;
int plPXPhysicalControllerCore::fPXControllersMax = 0;
#define kCCTSkinWidth 0.1f
#define kCCTStepOffset 0.6f
#define kCCTStepOffset 0.7f
#define kCCTZOffset ((fRadius + (fHeight / 2)) + kCCTSkinWidth)
#define kPhysHeightCorrection 0.8f
#define kPhysZOffset ((kCCTZOffset + (kPhysHeightCorrection / 2)) - 0.05f)

Loading…
Cancel
Save