Skip to content

Commit

Permalink
Fix all the tests and so on
Browse files Browse the repository at this point in the history
  • Loading branch information
arves100 committed Nov 28, 2023
1 parent 975a6ea commit 3733416
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ set(UNISPY_FORCE_IP "localhost" CACHE STRING "Force a custom IP to connect")
# This is GameSpy built-in memory managed. I don't know if it needs to be disabled but a test requires it.
option(UNISPY_MEM_MANAGED "Enable GameSpy built-in memory manager" ON)

if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(UNISPY_ARCH x64)
else()
set(UNISPY_ARCH x86)
endif()

if(WIN32 OR "${CMAKE_SYSTEM_NAME}" MATCHES "Windows" OR MINGW OR CYGWIN)
option(UNISPY_MSVC_STATIC "Use MSVC static runtime" OFF)

Expand Down
2 changes: 1 addition & 1 deletion Direct2Game/d2gUtil.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void d2giSetServiceUrl(D2GIInstance *theInstance,
{
// allocate memory and initialize it
theInstance->mServiceURLBase = gsimalloc(GS_D2G_MAX_BASE_URL_LEN);
snprintf(theInstance->mServiceURLBase, GS_D2G_MAX_BASE_URL_LEN, "%s.%s/commerce/1.1", __GSIACGamename, UNISPY_FORCE_IP);
snprintf(theInstance->mServiceURLBase, GS_D2G_MAX_BASE_URL_LEN, "%s/commerce/1.1", UNISPY_FORCE_IP);
}
#else
if (theInstance->mServiceURLBase == NULL)
Expand Down
32 changes: 32 additions & 0 deletions GP/gp.h
Original file line number Diff line number Diff line change
Expand Up @@ -2831,6 +2831,38 @@ GPResult gpInvitePlayer(
const gsi_char location[GP_LOCATION_STRING_LEN]
);

///////////////////////////////////////////////////////////////////////////////
// gpGetProfileBuddyList
// Summary
// Get the buddies for a profile.
// Parameters
// connection : [in] A GP connection object initialized with gpInitialize.
// profile : [in] The profile to get the buddy list for.
// maxBuddies : [in] The maximum number of buddies to return. If 0 is passed in,
// all buddies will be returned.
// blocking : [in] GP_BLOCKING or GP_NON_BLOCKING
// callback : [in] A GP callback that will be passed a GPGetProfileBuddyListArg.
// param : [in] Pointer to user-defined data. This value will be passed unmodified
// to the callback function.
// Returns
// GPResult is described in the GP enums section.
// Remarks
// This function returns a valid GPResult. Common return values are: <p>
// GP_NO_ERROR on success. <p>
// GP_PARAMETER_ERROR is returned if connection is NULL, profile is 0, callback is
// NULL, or the connection is not connected. GP_MEMORY_ERROR is returned when an
// allocation fails. <p>
// GP_NETWORK_ERROR is returned when there is a problem connecting to the
// Presence and Messaging backend.
// See Also
// GPGetProfileBuddyListArg
GPResult gpGetProfileBuddyList(GPConnection* connection,
GPProfile profile,
int maxBuddies,
GPEnum blocking,
GPCallback callback,
void* param);

///////////////////////////////////////////////////////////////////////////////
// gpGetReverseBuddies
// Summary
Expand Down
1 change: 1 addition & 0 deletions Peer/PeerTest/PeerTestDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
static char THIS_FILE[] = __FILE__;
#endif

#define NET_PORT 55123
#define VERBOSE 0

/////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion gstats/track/LoginDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void CLoginDlg::OnOK()
{
GPConnection connection;
HCURSOR hourglass;
HCURSOR lastCursor;
HCURSOR lastCursor = LoadCursor(NULL, IDC_ARROW);
GPResult result;

UpdateData();
Expand Down
2 changes: 2 additions & 0 deletions qr2/qr2csample/qr2csample.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ [email protected]
INCLUDES
********/
#include "../qr2.h"
#include "../../natneg/natneg.h"

/********
DEFINES
Expand Down Expand Up @@ -499,6 +500,7 @@ int test_main(int argc, char **argp)
const int isNatNegSupported = 1; // set to '0' if you don't support Nat Negotiation
gsi_time aStartTime = 0; // for sample, so we don't run forever
void * userData = NULL; // optional data that will be passed to the callback functions
unsigned long lastsendtime = 0; // timer used with ACE to send data to connected clients every 2 seconds

// This is for debug output on these platforms.
#if defined (_PS3) || defined (_PS2) || defined (_PSP) || defined(_NITRO) || defined(_PSP2)
Expand Down
19 changes: 16 additions & 3 deletions sc/sciInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@

// This is declared as an extern so it can be overriden when testing
#ifdef UNISPY_FORCE_IP
#define SC_SERVICE_URL_FORMAT GSI_HTTP_PROTOCOL_URL "%s/CompetitionService/CompetitionService.asmx"
#define SC_SERVICE_URL_FORMAT GSI_HTTP_PROTOCOL_URL "%s/CompetitionService/CompetitionService.asmx"
#define SC_GAME_CONFIG_DATA_SERVICE_URL_FORMAT GSI_HTTP_PROTOCOL_URL "%s/AtlasDataServices/GameConfig.asmx"
#else
#define SC_SERVICE_URL_FORMAT GSI_HTTP_PROTOCOL_URL "%s.comp.pubsvs." GSI_DOMAIN_NAME "/CompetitionService/CompetitionService.asmx"
#define SC_SERVICE_URL_FORMAT GSI_HTTP_PROTOCOL_URL "%s.comp.pubsvs." GSI_DOMAIN_NAME "/CompetitionService/CompetitionService.asmx"
#define SC_GAME_CONFIG_DATA_SERVICE_URL_FORMAT GSI_HTTP_PROTOCOL_URL "%s.comp.pubsvs." GSI_DOMAIN_NAME "/AtlasDataServices/GameConfig.asmx"
#endif

char scServiceURL[SC_SERVICE_MAX_URL_LEN] = "";

char scGameConfigDataServiceURL[SC_SERVICE_MAX_URL_LEN] = "";

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -66,11 +68,22 @@ SCResult sciInterfaceCreate(SCInterface** theInterfaceOut)
if (__GSIACResult == GSIACAvailable)
{
if (scServiceURL[0] == '\0')
{
#ifndef UNISPY_FORCE_IP
snprintf(scServiceURL, SC_SERVICE_MAX_URL_LEN, SC_SERVICE_URL_FORMAT, __GSIACGamename);
#else
snprintf(scServiceURL, SC_SERVICE_MAX_URL_LEN, SC_SERVICE_URL_FORMAT, UNISPY_FORCE_IP);
#endif
}

if (scGameConfigDataServiceURL[0] == '\0')
{
#ifndef UNISPY_FORCE_IP
snprintf(scGameConfigDataServiceURL, SC_SERVICE_MAX_URL_LEN, SC_GAME_CONFIG_DATA_SERVICE_URL_FORMAT, __GSIACGamename);
#else
snprintf(scGameConfigDataServiceURL, SC_SERVICE_MAX_URL_LEN, SC_GAME_CONFIG_DATA_SERVICE_URL_FORMAT, UNISPY_FORCE_IP);
#endif
}
}
else
return SCResult_NO_AVAILABILITY_CHECK;
Expand Down
9 changes: 5 additions & 4 deletions webservices/authtest/authtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
#include "../../GP/gp.h"
#include "../AuthService.h"

#if defined(_PS3)
#if defined(_WIN32) && !defined(_XBOX) && defined(_DEBUG)
#include <crtdbg.h>
#elif defined(_PS3)
#include <np.h>
#elif defined(_PSP)
#include <np/np.h>
Expand Down Expand Up @@ -135,9 +137,9 @@ static gsi_bool isBackendAvailable()
static void myLoginCallback(GHTTPResult httpResult, WSLoginResponse * theResponse, void * theUserData)
{
if (httpResult != GHTTPSuccess)
printf("* %s * Failed on player login, HTTP error: %s (%d)\n", (char*)theUserData, ghttpResultString(httpResult), httpResult);
printf("* %s * Failed on player login, HTTP error: %d\n", (char*)theUserData, httpResult);
else if (theResponse->mLoginResult != WSLogin_Success)
printf("* %s * Failed on player login, Login result: %s (%d)\n", (char*)theUserData, wsLoginValueString(theResponse->mLoginResult), theResponse->mLoginResult);
printf("* %s * Failed on player login, Login result: %d\n", (char*)theUserData, theResponse->mLoginResult);
else //Login worked!
{
_tprintf(_T("* %s * Player '%s' logged in.\n"), (char*)theUserData, theResponse->mCertificate.mUniqueNick);
Expand Down Expand Up @@ -685,7 +687,6 @@ static void printHelp()
printf("Defaulting to use GameSpy Test Service ID: %s...\n\n", GAMESPY_DEFAULT_SERVICE_ID);
}

#ifndef _PS3

///////////////////////////////////////////////////////////////////////////////
static void ConnectResponse(GPConnection * pconnection, GPConnectResponseArg * arg, void * param)
Expand Down

0 comments on commit 3733416

Please sign in to comment.