Skip to content

Commit c9349cd

Browse files
committed
Minimal changes for successful build. (#365)
Only builds under VC6. Has some changes to accomodate newer API of public GameSpy SDK. Disables copy protection code in ZH code base (EA already disabled it for Generals code base).
1 parent 994093e commit c9349cd

38 files changed

+197
-49
lines changed

Generals/Code/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ static void queuePatch(Bool mandatory, AsciiString downloadURL)
316316
///////////////////////////////////////////////////////////////////////////////////////
317317

318318
static GHTTPBool motdCallback( GHTTPRequest request, GHTTPResult result,
319-
char * buffer, int bufferLen, void * param )
319+
char * buffer, GHTTPByteCount bufferLen, void * param )
320320
{
321321
Int run = (Int)param;
322322
if (run != timeThroughOnline)
@@ -356,7 +356,7 @@ static GHTTPBool motdCallback( GHTTPRequest request, GHTTPResult result,
356356
///////////////////////////////////////////////////////////////////////////////////////
357357

358358
static GHTTPBool configCallback( GHTTPRequest request, GHTTPResult result,
359-
char * buffer, int bufferLen, void * param )
359+
char * buffer, GHTTPByteCount bufferLen, void * param )
360360
{
361361
Int run = (Int)param;
362362
if (run != timeThroughOnline)
@@ -421,7 +421,7 @@ static GHTTPBool configCallback( GHTTPRequest request, GHTTPResult result,
421421
///////////////////////////////////////////////////////////////////////////////////////
422422

423423
static GHTTPBool configHeadCallback( GHTTPRequest request, GHTTPResult result,
424-
char * buffer, int bufferLen, void * param )
424+
char * buffer, GHTTPByteCount bufferLen, void * param )
425425
{
426426
Int run = (Int)param;
427427
if (run != timeThroughOnline)
@@ -508,7 +508,7 @@ static GHTTPBool configHeadCallback( GHTTPRequest request, GHTTPResult result,
508508

509509
///////////////////////////////////////////////////////////////////////////////////////
510510

511-
static GHTTPBool gamePatchCheckCallback( GHTTPRequest request, GHTTPResult result, char * buffer, int bufferLen, void * param )
511+
static GHTTPBool gamePatchCheckCallback( GHTTPRequest request, GHTTPResult result, char * buffer, GHTTPByteCount bufferLen, void * param )
512512
{
513513
Int run = (Int)param;
514514
if (run != timeThroughOnline)
@@ -598,7 +598,7 @@ void CancelPatchCheckCallback( void )
598598

599599
///////////////////////////////////////////////////////////////////////////////////////
600600

601-
static GHTTPBool overallStatsCallback( GHTTPRequest request, GHTTPResult result, char * buffer, int bufferLen, void * param )
601+
static GHTTPBool overallStatsCallback( GHTTPRequest request, GHTTPResult result, char * buffer, GHTTPByteCount bufferLen, void * param )
602602
{
603603
DEBUG_LOG(("overallStatsCallback() - Result=%d, len=%d\n", result, bufferLen));
604604
if (result != GHTTPSuccess)
@@ -680,7 +680,7 @@ static GHTTPBool overallStatsCallback( GHTTPRequest request, GHTTPResult result,
680680

681681
///////////////////////////////////////////////////////////////////////////////////////
682682

683-
static GHTTPBool numPlayersOnlineCallback( GHTTPRequest request, GHTTPResult result, char * buffer, int bufferLen, void * param )
683+
static GHTTPBool numPlayersOnlineCallback( GHTTPRequest request, GHTTPResult result, char * buffer, GHTTPByteCount bufferLen, void * param )
684684
{
685685
DEBUG_LOG(("numPlayersOnlineCallback() - Result=%d, buffer=[%s], len=%d\n", result, buffer, bufferLen));
686686
if (result != GHTTPSuccess)

Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ void BuddyThreadClass::Thread_Function()
270270
_set_se_translator( DumpExceptionInfo ); // Hook that allows stack trace.
271271
GPConnection gpCon;
272272
GPConnection *con = &gpCon;
273-
gpInitialize( con, 0 );
273+
gpInitialize( con, 675, 0, GP_PARTNERID_GAMESPY );
274274
m_isConnected = m_isConnecting = false;
275275

276276
gpSetCallback( con, GP_ERROR, callbackWrapper, (void *)CALLBACK_ERROR );
@@ -308,7 +308,8 @@ void BuddyThreadClass::Thread_Function()
308308
break;
309309
case BuddyRequest::BUDDYREQUEST_DELETEACCT:
310310
m_isdeleting = true;
311-
gpDeleteProfile( con );
311+
// TheSuperHackers @tweak OmniBlade API was updated since Generals released to require a callback. Passing -1 will make our wrapper ignore this.
312+
gpDeleteProfile( con, callbackWrapper, (void *)(-1) );
312313
break;
313314
case BuddyRequest::BUDDYREQUEST_LOGOUT:
314315
m_isConnecting = m_isConnected = false;
@@ -328,8 +329,9 @@ void BuddyThreadClass::Thread_Function()
328329
m_email = incomingRequest.arg.login.email;
329330
m_pass = incomingRequest.arg.login.password;
330331
m_isNewAccount = TRUE;
331-
m_isConnected = (gpConnectNewUser( con, incomingRequest.arg.login.nick, incomingRequest.arg.login.email,
332-
incomingRequest.arg.login.password, (incomingRequest.arg.login.hasFirewall)?GP_FIREWALL:GP_NO_FIREWALL,
332+
// TheSuperHackers @tweak OmniBlade API was updated since Generals release to require uniquenick which is the same as nick and cdkey is an empty string here.
333+
m_isConnected = (gpConnectNewUser( con, incomingRequest.arg.login.nick, incomingRequest.arg.login.nick, incomingRequest.arg.login.email,
334+
incomingRequest.arg.login.password, "", (incomingRequest.arg.login.hasFirewall)?GP_FIREWALL:GP_NO_FIREWALL,
333335
GP_BLOCKING, callbackWrapper, (void *)CALLBACK_CONNECT ) == GP_NO_ERROR);
334336
if (m_isNewAccount) // if we didn't re-login
335337
{

Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ static enum CallbackType
518518
CALLBACK_MAX
519519
};
520520

521-
void connectCallbackWrapper( PEER peer, PEERBool success, void *param )
521+
void connectCallbackWrapper( PEER peer, PEERBool success, int failureReason, void *param )
522522
{
523523
#ifdef SERVER_DEBUGGING
524524
DEBUG_LOG(("In connectCallbackWrapper()\n"));
@@ -530,7 +530,7 @@ void connectCallbackWrapper( PEER peer, PEERBool success, void *param )
530530
}
531531
}
532532

533-
void nickErrorCallbackWrapper( PEER peer, Int type, const char *nick, void *param )
533+
void nickErrorCallbackWrapper( PEER peer, Int type, const char *nick, int numSuggestedNicks, const gsi_char** suggestedNicks, void *param )
534534
{
535535
if (param != NULL)
536536
{
@@ -657,7 +657,7 @@ static void playerFlagsChangedCallback(PEER peer, RoomType roomType, const char
657657
static void listingGamesCallback(PEER peer, PEERBool success, const char * name, SBServer server, PEERBool staging, int msg, Int percentListed, void * param);
658658
static void roomUTMCallback(PEER peer, RoomType roomType, const char * nick, const char * command, const char * parameters, PEERBool authenticated, void * param);
659659
static void playerUTMCallback(PEER peer, const char * nick, const char * command, const char * parameters, PEERBool authenticated, void * param);
660-
static void gameStartedCallback(PEER peer, UnsignedInt IP, const char *message, void *param);
660+
static void gameStartedCallback(PEER peer, SBServer server, const char *message, void *param);
661661
static void globalKeyChangedCallback(PEER peer, const char *nick, const char *key, const char *val, void *param);
662662
static void roomKeyChangedCallback(PEER peer, RoomType roomType, const char *nick, const char *key, const char *val, void *param);
663663

@@ -2410,7 +2410,7 @@ void roomMessageCallback(PEER peer, RoomType roomType, const char * nick, const
24102410
}
24112411
}
24122412

2413-
void gameStartedCallback( PEER peer, UnsignedInt IP, const char *message, void *param )
2413+
void gameStartedCallback( PEER peer, SBServer server, const char *message, void *param )
24142414
{
24152415
PeerResponse resp;
24162416
resp.peerResponseType = PeerResponse::PEERRESPONSE_GAMESTART;

Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PersistentStorageThread.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ Bool PSThreadClass::tryLogin( Int id, std::string nick, std::string password, st
660660
return m_loginOK;
661661
}
662662

663-
static void getPersistentDataCallback(int localid, int profileid, persisttype_t type, int index, int success, char *data, int len, void *instance)
663+
static void getPersistentDataCallback(int localid, int profileid, persisttype_t type, int index, int success, time_t modified, char *data, int len, void *instance)
664664
{
665665
DEBUG_LOG(("Data get callback: localid: %d profileid: %d success: %d len: %d data: %s\n",localid, profileid, success, len, data));
666666
PSThreadClass *t = (PSThreadClass *)instance;
@@ -753,7 +753,7 @@ static void getPersistentDataCallback(int localid, int profileid, persisttype_t
753753
TheGameSpyPSMessageQueue->addResponse(resp);
754754
}
755755

756-
static void setPersistentDataLocaleCallback(int localid, int profileid, persisttype_t type, int index, int success, void *instance)
756+
static void setPersistentDataLocaleCallback(int localid, int profileid, persisttype_t type, int index, int success, time_t modified, void *instance)
757757
{
758758
DEBUG_LOG(("Data save callback: localid: %d profileid: %d success: %d\n", localid, profileid, success));
759759

@@ -764,7 +764,7 @@ static void setPersistentDataLocaleCallback(int localid, int profileid, persistt
764764
t->decrOpCount();
765765
}
766766

767-
static void setPersistentDataCallback(int localid, int profileid, persisttype_t type, int index, int success, void *instance)
767+
static void setPersistentDataCallback(int localid, int profileid, persisttype_t type, int index, int success, time_t modified, void *instance)
768768
{
769769
DEBUG_LOG(("Data save callback: localid: %d profileid: %d success: %d\n", localid, profileid, success));
770770

@@ -802,7 +802,7 @@ void preAuthCDCallback(int localid, int profileid, int authenticated, char *errm
802802
authInfo->id = profileid;
803803
}
804804

805-
static void getPreorderCallback(int localid, int profileid, persisttype_t type, int index, int success, char *data, int len, void *instance)
805+
static void getPreorderCallback(int localid, int profileid, persisttype_t type, int index, int success, time_t modified, char *data, int len, void *instance)
806806
{
807807
PSThreadClass *t = (PSThreadClass *)instance;
808808
if (!t)

Generals/Code/Tools/PATCHGET/CHATAPI.CPP

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
#include "WWDownload/urlBuilder.h"
4141
#include "debug.h"
4242

43+
namespace patchget
44+
{
45+
4346
enum EVENT_TYPES
4447
{
4548
NOUPDATE_EVENT=0, // don't need to update
@@ -386,7 +389,7 @@ static void queuePatch(bool mandatory, std::string downloadURL)
386389

387390
///////////////////////////////////////////////////////////////////////////////////////
388391

389-
static GHTTPBool patchCheckCallback( GHTTPRequest request, GHTTPResult result, char * buffer, int bufferLen, void * param )
392+
static GHTTPBool patchCheckCallback( GHTTPRequest request, GHTTPResult result, char * buffer, GHTTPByteCount bufferLen, void * param )
390393
{
391394
--checksLeft;
392395
DEBUG_ASSERTCRASH(checksLeft>=0, ("Too many callbacks"));
@@ -1792,3 +1795,5 @@ STDMETHODIMP CChatEventSink::OnSquadInfo(HRESULT, unsigned long, Squad *)
17921795
}
17931796
17941797
*/
1798+
1799+
} // namespace patchget

Generals/Code/Tools/PATCHGET/CHATAPI.H

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,17 @@
3434
#define ARRAY_SIZE(x) int(sizeof(x)/sizeof(x[0]))
3535
#define size_of(typ,id) sizeof(((typ*)0)->id)
3636

37+
namespace patchget
38+
{
39+
40+
int main(int argc, char *argv[]);
3741

3842
void Startup_Chat(void);
3943
void Shutdown_Chat(void);
4044
void Update_If_Required(void);
4145

4246
char const * Fetch_String(int id);
4347

48+
} // namespace patchget
49+
4450
#endif

Generals/Code/Tools/PATCHGET/COMINIT.CPP

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
#include <windows.h>
2626
#include <objbase.h>
2727

28+
namespace patchget
29+
{
30+
2831
ComInit::ComInit()
2932
{
3033
HRESULT hRes = CoInitialize(NULL);
@@ -44,3 +47,4 @@ ComInit::~ComInit()
4447
// Creating this instance will setup all COM stuff & do cleanup on program exit
4548
ComInit Global_COM_Initializer;
4649

50+
} // namespace patchget

Generals/Code/Tools/PATCHGET/COMINIT.H

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
#ifndef COMINIT_HEADER
2020
#define COMINIT_HEADER
2121

22+
namespace patchget
23+
{
24+
2225
//
2326
// Link with this to automatically initialize COM at startup
2427
// - See cominit.cpp for more info
@@ -31,4 +34,6 @@ class ComInit
3134
~ComInit();
3235
};
3336

37+
} // namespace patchget
38+
3439
#endif

Generals/Code/Tools/PATCHGET/DownloadManager.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
#include "DownloadManager.h"
2626
#include "resource.h"
2727

28+
namespace patchget
29+
{
30+
2831
DownloadManager *TheDownloadManager = NULL;
2932

3033
DownloadManager::DownloadManager()
@@ -208,3 +211,5 @@ HRESULT DownloadManager::OnStatusUpdate( int status )
208211
DEBUG_LOG(("DownloadManager::OnStatusUpdate(): %s(%d)\n", s.c_str(), status));
209212
return S_OK;
210213
}
214+
215+
} // namespace patchget

Generals/Code/Tools/PATCHGET/DownloadManager.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
#include <list>
3232

3333
class CDownload;
34+
35+
namespace patchget
36+
{
37+
3438
class QueuedDownload
3539
{
3640
public:
@@ -91,4 +95,6 @@ class DownloadManager : public IDownload
9195

9296
extern DownloadManager *TheDownloadManager;
9397

98+
} // namespace patchget
99+
94100
#endif // __DOWNLOADMANAGER_H__

0 commit comments

Comments
 (0)