Get rid of MSVC's __int64

Use either int64_t, uint64_t or long long and unsigned long long, defined as per C++11 standard
This commit is contained in:
void_17
2026-03-02 15:53:32 +07:00
parent d6ec138710
commit d63f79325f
308 changed files with 5371 additions and 5379 deletions

View File

@@ -114,8 +114,8 @@
#define __RADLITTLEENDIAN__
#ifdef __i386__
#define __RADX86__
#else
#define __RADARM__
#else
#define __RADARM__
#endif
#define RADINLINE inline
#define RADRESTRICT __restrict
@@ -132,7 +132,7 @@
#define __RADX86__
#else
#error Unknown processor
#endif
#endif
#define __RADLITTLEENDIAN__
#define RADINLINE inline
#define RADRESTRICT __restrict
@@ -155,7 +155,7 @@
#define __RADNACL__
#define __RAD32__
#define __RADLITTLEENDIAN__
#define __RADX86__
#define __RADX86__
#define RADINLINE inline
#define RADRESTRICT __restrict
@@ -196,7 +196,7 @@
#define __RAD64REGS__
#define __RADLITTLEENDIAN__
#define RADINLINE inline
#define RADRESTRICT __restrict
#define RADRESTRICT __restrict
#undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__))
@@ -265,7 +265,7 @@
#endif
#undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__))
#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it
#define __RADWIIU__
@@ -480,7 +480,7 @@
#undef RADRESTRICT /* could have been defined above... */
#define RADRESTRICT __restrict
#undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__))
#endif
@@ -885,7 +885,7 @@
#define RAD_ALIGN(type,var,num) type __declspec(align(num)) var
#else
// NOTE: / / is a guaranteed parse error in C/C++.
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
#endif
// WARNING : RAD_TLS should really only be used for debug/tools stuff
@@ -917,8 +917,8 @@
#define RAD_S32 signed int
// But pointers are 64 bits.
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
#define RAD_SINTa __w64 signed __int64
#define RAD_UINTa __w64 unsigned __int64
#define RAD_SINTa __w64 signed int64_t
#define RAD_UINTa __w64 uint64_t
#else // non-vc.net compiler or /Wp64 turned off
#define RAD_UINTa unsigned long long
#define RAD_SINTa signed long long
@@ -976,8 +976,8 @@
#define RAD_U64 unsigned long long
#define RAD_S64 signed long long
#elif defined(__RADX64__) || defined(__RAD32__)
#define RAD_U64 unsigned __int64
#define RAD_S64 signed __int64
#define RAD_U64 unsigned long long
#define RAD_S64 signed long long
#else
// 16-bit
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
@@ -1134,7 +1134,7 @@
// helpers for doing an if ( ) with expect :
// if ( RAD_LIKELY(expr) ) { ... }
#define RAD_LIKELY(expr) RAD_EXPECT(expr,1)
#define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0)
@@ -1324,7 +1324,7 @@
__pragma(warning(push)) \
__pragma(warning(disable:4127)) \
} while(0) \
__pragma(warning(pop))
__pragma(warning(pop))
#define RAD_STATEMENT_END_TRUE \
__pragma(warning(push)) \
@@ -1333,10 +1333,10 @@
__pragma(warning(pop))
#else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif
#else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif
#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT
@@ -1345,7 +1345,7 @@
#define RAD_STATEMENT_END_FALSE \
} while ( (void)0,0 )
#define RAD_STATEMENT_END_TRUE \
} while ( (void)1,1 )
@@ -1355,7 +1355,7 @@
RAD_STATEMENT_START \
code \
RAD_STATEMENT_END_FALSE
#define RAD_INFINITE_LOOP( code ) \
RAD_STATEMENT_START \
code \
@@ -1363,7 +1363,7 @@
// Must be placed after variable declarations for code compiled as .c
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
# define RR_UNUSED_VARIABLE(x) (void) x
#else
# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x))
@@ -1473,7 +1473,7 @@
// just to make gcc shut up about derefing null :
#define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) )
#define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) )
// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object
// you should then RR_ASSERT( &(ret->member) == ptr );
#define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) )
@@ -1482,7 +1482,7 @@
// Cache / prefetch macros :
// RR_PREFETCH for various platforms :
//
//
// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan
// platforms that automatically prefetch sequential (eg. PC) should be a no-op here
// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined
@@ -1707,7 +1707,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 )
//-----------------------------------------------------------
// RAD_NO_BREAK : option if you don't like your assert to break
// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional
#ifdef RAD_NO_BREAK
@@ -1725,7 +1725,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } )
//-----------------------------------
#ifdef RR_DO_ASSERTS
#ifdef RR_DO_ASSERTS
#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp)
#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp)
@@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
#define RR_BSWAP16 _byteswap_ushort
#define RR_BSWAP32 _byteswap_ulong
unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val);
unsigned long long __cdecl _byteswap_uint64 (unsigned long long val);
#pragma intrinsic(_byteswap_uint64)
#define RR_BSWAP64 _byteswap_uint64
@@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
return _Long;
}
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long)
RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
{
__asm {
mov eax, DWORD PTR _Long
@@ -2250,10 +2250,10 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas
#if ( defined(_MSC_VER) && _MSC_VER >= 1300)
unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
unsigned long long __cdecl _rotl64(unsigned long long _Val, int _Shift);
#pragma intrinsic(_rotl64)
#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k))
#define RR_ROTL64(x,k) _rotl64((unsigned long long)(x),(int)(k))
#elif defined(__RADCELL__)
@@ -2262,7 +2262,7 @@ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
#elif defined(__RADLINUX__) || defined(__RADMACAPI__)
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
#else

File diff suppressed because it is too large Load Diff

View File

@@ -114,8 +114,8 @@
#define __RADLITTLEENDIAN__
#ifdef __i386__
#define __RADX86__
#else
#define __RADARM__
#else
#define __RADARM__
#endif
#define RADINLINE inline
#define RADRESTRICT __restrict
@@ -132,7 +132,7 @@
#define __RADX86__
#else
#error Unknown processor
#endif
#endif
#define __RADLITTLEENDIAN__
#define RADINLINE inline
#define RADRESTRICT __restrict
@@ -155,7 +155,7 @@
#define __RADNACL__
#define __RAD32__
#define __RADLITTLEENDIAN__
#define __RADX86__
#define __RADX86__
#define RADINLINE inline
#define RADRESTRICT __restrict
@@ -196,7 +196,7 @@
#define __RAD64REGS__
#define __RADLITTLEENDIAN__
#define RADINLINE inline
#define RADRESTRICT __restrict
#define RADRESTRICT __restrict
#undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__))
@@ -265,7 +265,7 @@
#endif
#undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__))
#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it
#define __RADWIIU__
@@ -480,7 +480,7 @@
#undef RADRESTRICT /* could have been defined above... */
#define RADRESTRICT __restrict
#undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__))
#endif
@@ -885,7 +885,7 @@
#define RAD_ALIGN(type,var,num) type __declspec(align(num)) var
#else
// NOTE: / / is a guaranteed parse error in C/C++.
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
#endif
// WARNING : RAD_TLS should really only be used for debug/tools stuff
@@ -917,8 +917,8 @@
#define RAD_S32 signed int
// But pointers are 64 bits.
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
#define RAD_SINTa __w64 signed __int64
#define RAD_UINTa __w64 unsigned __int64
#define RAD_SINTa __w64 signed long long
#define RAD_UINTa __w64 unsigned long long
#else // non-vc.net compiler or /Wp64 turned off
#define RAD_UINTa unsigned long long
#define RAD_SINTa signed long long
@@ -976,8 +976,8 @@
#define RAD_U64 unsigned long long
#define RAD_S64 signed long long
#elif defined(__RADX64__) || defined(__RAD32__)
#define RAD_U64 unsigned __int64
#define RAD_S64 signed __int64
#define RAD_U64 unsigned long long
#define RAD_S64 signed long long
#else
// 16-bit
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
@@ -1134,7 +1134,7 @@
// helpers for doing an if ( ) with expect :
// if ( RAD_LIKELY(expr) ) { ... }
#define RAD_LIKELY(expr) RAD_EXPECT(expr,1)
#define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0)
@@ -1324,7 +1324,7 @@
__pragma(warning(push)) \
__pragma(warning(disable:4127)) \
} while(0) \
__pragma(warning(pop))
__pragma(warning(pop))
#define RAD_STATEMENT_END_TRUE \
__pragma(warning(push)) \
@@ -1333,10 +1333,10 @@
__pragma(warning(pop))
#else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif
#else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
#define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif
#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT
@@ -1345,7 +1345,7 @@
#define RAD_STATEMENT_END_FALSE \
} while ( (void)0,0 )
#define RAD_STATEMENT_END_TRUE \
} while ( (void)1,1 )
@@ -1355,7 +1355,7 @@
RAD_STATEMENT_START \
code \
RAD_STATEMENT_END_FALSE
#define RAD_INFINITE_LOOP( code ) \
RAD_STATEMENT_START \
code \
@@ -1363,7 +1363,7 @@
// Must be placed after variable declarations for code compiled as .c
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
# define RR_UNUSED_VARIABLE(x) (void) x
#else
# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x))
@@ -1473,7 +1473,7 @@
// just to make gcc shut up about derefing null :
#define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) )
#define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) )
// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object
// you should then RR_ASSERT( &(ret->member) == ptr );
#define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) )
@@ -1482,7 +1482,7 @@
// Cache / prefetch macros :
// RR_PREFETCH for various platforms :
//
//
// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan
// platforms that automatically prefetch sequential (eg. PC) should be a no-op here
// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined
@@ -1707,7 +1707,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 )
//-----------------------------------------------------------
// RAD_NO_BREAK : option if you don't like your assert to break
// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional
#ifdef RAD_NO_BREAK
@@ -1725,7 +1725,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } )
//-----------------------------------
#ifdef RR_DO_ASSERTS
#ifdef RR_DO_ASSERTS
#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp)
#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp)
@@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
#define RR_BSWAP16 _byteswap_ushort
#define RR_BSWAP32 _byteswap_ulong
unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val);
unsigned long long __cdecl _byteswap_uint64 (unsigned long long val);
#pragma intrinsic(_byteswap_uint64)
#define RR_BSWAP64 _byteswap_uint64
@@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
return _Long;
}
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long)
RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long)
{
__asm {
mov eax, DWORD PTR _Long
@@ -2250,10 +2250,10 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas
#if ( defined(_MSC_VER) && _MSC_VER >= 1300)
unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
unsigned long long __cdecl _rotl64(unsigned long long _Val, int _Shift);
#pragma intrinsic(_rotl64)
#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k))
#define RR_ROTL64(x,k) _rotl64((unsigned long long)(x),(int)(k))
#elif defined(__RADCELL__)
@@ -2262,7 +2262,7 @@ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
#elif defined(__RADLINUX__) || defined(__RADMACAPI__)
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
#else

View File

@@ -21,8 +21,8 @@ int (* SQRNetworkManager_Orbis::s_SignInCompleteCallbackFn)(void *pParam, bool b
void * SQRNetworkManager_Orbis::s_SignInCompleteParam = NULL;
sce::Toolkit::NP::PresenceDetails SQRNetworkManager_Orbis::s_lastPresenceInfo;
__int64 SQRNetworkManager_Orbis::s_lastPresenceTime = 0;
__int64 SQRNetworkManager_Orbis::s_resendPresenceTime = 0;
int64_t SQRNetworkManager_Orbis::s_lastPresenceTime = 0;
int64_t SQRNetworkManager_Orbis::s_resendPresenceTime = 0;
bool SQRNetworkManager_Orbis::s_presenceStatusDirty = false;
bool SQRNetworkManager_Orbis::s_presenceDataDirty = false;
@@ -51,7 +51,7 @@ int g_numRUDPContextsBound = 0;
//unsigned int SQRNetworkManager_Orbis::RoomSyncData::playerCount = 0;
// This maps internal to extern states, and needs to match element-by-element the eSQRNetworkManagerInternalState enumerated type
const SQRNetworkManager_Orbis::eSQRNetworkManagerState SQRNetworkManager_Orbis::m_INTtoEXTStateMappings[SQRNetworkManager_Orbis::SNM_INT_STATE_COUNT] =
const SQRNetworkManager_Orbis::eSQRNetworkManagerState SQRNetworkManager_Orbis::m_INTtoEXTStateMappings[SQRNetworkManager_Orbis::SNM_INT_STATE_COUNT] =
{
SNM_STATE_INITIALISING, // SNM_INT_STATE_UNINITIALISED
SNM_STATE_INITIALISING, // SNM_INT_STATE_SIGNING_IN
@@ -143,7 +143,7 @@ void SQRNetworkManager_Orbis::Initialise()
assert( m_state == SNM_INT_STATE_UNINITIALISED );
//Initialize libnetctl
ret = sceNetCtlInit();
if( ( ret < 0 /*&& ret != CELL_NET_CTL_ERROR_NOT_TERMINATED*/ ) || ForceErrorPoint( SNM_FORCE_ERROR_NET_CTL_INIT ) )
@@ -172,14 +172,14 @@ void SQRNetworkManager_Orbis::Initialise()
SonyHttp::init();
ret = sceNpSetNpTitleId(GetSceNpTitleId(), GetSceNpTitleSecret());
if (ret < 0)
if (ret < 0)
{
app.DebugPrintf("sceNpSetNpTitleId failed, ret=%x\n", ret);
assert(0);
}
ret = sceRudpEnableInternalIOThread(RUDP_THREAD_STACK_SIZE, RUDP_THREAD_PRIORITY);
if(ret < 0)
if(ret < 0)
{
app.DebugPrintf("sceRudpEnableInternalIOThread failed with error code 0x%08x\n", ret);
assert(0);
@@ -192,7 +192,7 @@ void SQRNetworkManager_Orbis::Initialise()
else
{
// On Orbis, PSN sign in is only handled by the XMB
SetState(SNM_INT_STATE_IDLE);
SetState(SNM_INT_STATE_IDLE);
}
SonyVoiceChat_Orbis::init();
@@ -299,7 +299,7 @@ void SQRNetworkManager_Orbis::InitialiseAfterOnline()
ret = sceNpMatching2CreateContext(&param, &m_matchingContext);
if( ( ret < 0 ) || ForceErrorPoint( SNM_FORCE_ERROR_CREATE_MATCHING_CONTEXT ) )
{
app.DebugPrintf("SQRNetworkManager_Orbis::InitialiseAfterOnline - sceNpMatching2CreateContext failed with error 0x%08x\n", ret);
@@ -398,7 +398,7 @@ void SQRNetworkManager_Orbis::Tick()
{
// make sure we've removed all the remote players and killed the udp connections before we bail out
if(m_RudpCtxToPlayerMap.size() == 0)
ResetToIdle();
ResetToIdle();
}
EnterCriticalSection(&m_csStateChangeQueue);
@@ -451,7 +451,7 @@ void SQRNetworkManager_Orbis::tickErrorDialog()
if(s_errorDialogRunning)
{
SceErrorDialogStatus s = sceErrorDialogUpdateStatus();
switch (s)
switch (s)
{
case SCE_ERROR_DIALOG_STATUS_NONE:
assert(0);
@@ -465,9 +465,9 @@ void SQRNetworkManager_Orbis::tickErrorDialog()
case SCE_ERROR_DIALOG_STATUS_FINISHED:
sceErrorDialogTerminate();
s_errorDialogRunning = false;
// Start callback timer
s_SignInCompleteCallbackPending = true;
s_SignInCompleteCallbackPending = true;
s_errorDialogClosed = System::currentTimeMillis();
break;
}
@@ -490,9 +490,9 @@ void SQRNetworkManager_Orbis::tickErrorDialog()
SceSystemServiceStatus status = SceSystemServiceStatus();
sceSystemServiceGetStatus(&status);
bool systemUiDisplayed = status.isInBackgroundExecution || status.isSystemUiOverlaid;
if (systemUiDisplayed)
{
{
// Wait till the system goes away
}
else
@@ -583,7 +583,7 @@ void SQRNetworkManager_Orbis::ErrorHandlingTick()
DeleteServerContext();
break;
}
}
// Start hosting a game, by creating a room & joining it. We explicity create a server context here (via GetServerContext) as Sony suggest that
@@ -643,7 +643,7 @@ void SQRNetworkManager_Orbis::UpdateExternalRoomData()
{
if( m_offlineGame ) return;
if( m_isHosting )
{
{
SceNpMatching2SetRoomDataExternalRequest reqParam;
memset( &reqParam, 0, sizeof(reqParam) );
reqParam.roomId = m_room;
@@ -774,13 +774,13 @@ int SQRNetworkManager_Orbis::BasicEventThreadProc( void *lpParameter )
do
{
ret = sceKernelWaitEqueue(manager->m_basicEventQueue, &event, 1, &outEv, NULL);
// If the sys_event_t we've sent here from the handler has a non-zero data1 element, this is to signify that we should terminate the thread
if( event.udata == 0 )
{
// int iEvent;
// SceNpUserInfo from;
// uint8_t buffer[SCE_NP_BASIC_MAX_MESSAGE_SIZE];
// uint8_t buffer[SCE_NP_BASIC_MAX_MESSAGE_SIZE];
// size_t bufferSize = SCE_NP_BASIC_MAX_MESSAGE_SIZE;
// int ret = sceNpBasicGetEvent(&iEvent, &from, &buffer, &bufferSize);
// if( ret == 0 )
@@ -788,7 +788,7 @@ int SQRNetworkManager_Orbis::BasicEventThreadProc( void *lpParameter )
// if( iEvent == SCE_NP_BASIC_EVENT_INCOMING_BOOTABLE_INVITATION )
// {
// // 4J Stu - Don't do this here as it can be very disruptive to gameplay. Players can bring this up from LoadOrJoinMenu, PauseMenu and InGameInfoMenu
// //sceNpBasicRecvMessageCustom(SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE, SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_INCLUDE_BOOTABLE, SYS_MEMORY_CONTAINER_ID_INVALID);
// //sceNpBasicRecvMessageCustom(SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE, SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_INCLUDE_BOOTABLE, SYS_MEMORY_CONTAINER_ID_INVALID);
// }
// if( iEvent == SCE_NP_BASIC_EVENT_RECV_INVITATION_RESULT )
// {
@@ -835,12 +835,12 @@ int SQRNetworkManager_Orbis::GetFriendsThreadProc( void* lpParameter )
return 0;
}
if (friendList.hasResult())
if (friendList.hasResult())
{
sce::Toolkit::NP::FriendsList::const_iterator iter ;
sce::Toolkit::NP::FriendsList::const_iterator iter ;
int i = 1 ;
bool noFriends = true;
for (iter = friendList.get()->begin(); iter != friendList.get()->end() ; ++iter,i++)
for (iter = friendList.get()->begin(); iter != friendList.get()->end() ; ++iter,i++)
{
manager->m_friendCount++;
noFriends = false;
@@ -848,7 +848,7 @@ int SQRNetworkManager_Orbis::GetFriendsThreadProc( void* lpParameter )
app.DebugPrintf("Online Name: %s\n",iter->npid.handle.data);
app.DebugPrintf("------------------------\n");
sce::Toolkit::NP::PresenceRequest presenceRequest;
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::PresenceInfo> presenceInfo;
memset(&presenceRequest,0,sizeof(presenceRequest));
@@ -858,11 +858,11 @@ int SQRNetworkManager_Orbis::GetFriendsThreadProc( void* lpParameter )
ret = sce::Toolkit::NP::Presence::Interface::getPresence(&presenceRequest,&presenceInfo,false);
if( ret < 0 )
if( ret < 0 )
{
app.DebugPrintf("getPresence() error. ret = 0x%x\n", ret);
}
else
else
{
app.DebugPrintf("\nPresence Data Retrieved:\n");
app.DebugPrintf("Platform Type: %s\n", presenceInfo.get()->platformType.c_str());
@@ -897,13 +897,13 @@ int SQRNetworkManager_Orbis::GetFriendsThreadProc( void* lpParameter )
}
}
}
else if (friendList.hasError())
else if (friendList.hasError())
{
app.DebugPrintf( "Error occurred while retrieving FriendsList, ret = 0x%x\n", friendList.getError());
app.DebugPrintf("Check sign-in status\n");
}
return 0;
}
@@ -944,7 +944,7 @@ bool SQRNetworkManager_Orbis::IsReadyToPlayOrIdle()
// Consider as "in session" from the moment that a game is created or joined, until the point where the game itself has been told via state change that we are now idle. The
// game code requires IsInSession to return true as soon as it has asked to do one of these things (even if the state system hasn't really caught up with this request yet), and
// game code requires IsInSession to return true as soon as it has asked to do one of these things (even if the state system hasn't really caught up with this request yet), and
// it also requires that it is informed of the state changes leading up to not being in the session, before this should report false.
bool SQRNetworkManager_Orbis::IsInSession()
{
@@ -1119,7 +1119,7 @@ bool SQRNetworkManager_Orbis::JoinRoom(SceNpMatching2RoomId roomId, SceNpMatchin
m_localPlayerJoinMask = localPlayerMask;
m_localPlayerCount = 0;
m_localPlayerJoined = 0;
for( int i = 0; i < MAX_LOCAL_PLAYER_COUNT; i++ )
{
if( localPlayerMask & ( 1 << i ) ) m_localPlayerCount++;
@@ -1240,7 +1240,7 @@ bool SQRNetworkManager_Orbis::AddLocalPlayerByUserIndex(int idx)
// Sync this back out to our networked clients...
SyncRoomData();
UpdateRemotePlay();
// no connections being made because we're all on the host, so add this player to the existing connections
@@ -1264,7 +1264,7 @@ bool SQRNetworkManager_Orbis::AddLocalPlayerByUserIndex(int idx)
memset(&reqParam, 0, sizeof(reqParam));
memset(&binAttr, 0, sizeof(binAttr));
binAttr.id = SCE_NP_MATCHING2_ROOMMEMBER_BIN_ATTR_INTERNAL_1_ID;
binAttr.ptr = &m_localPlayerJoinMask;
binAttr.size = sizeof(m_localPlayerJoinMask);
@@ -1357,7 +1357,7 @@ bool SQRNetworkManager_Orbis::RemoveLocalPlayerByUserIndex(int idx)
memset(&reqParam, 0, sizeof(reqParam));
memset(&binAttr, 0, sizeof(binAttr));
binAttr.id = SCE_NP_MATCHING2_ROOMMEMBER_BIN_ATTR_INTERNAL_1_ID;
binAttr.ptr = &m_localPlayerJoinMask;
binAttr.size = sizeof(m_localPlayerJoinMask);
@@ -1395,7 +1395,7 @@ void SQRNetworkManager_Orbis::UpdateRemotePlay()
extern uint8_t *mallocAndCreateUTF8ArrayFromString(int iID);
// Bring up a Gui to send an invite so a player that the user can select. This invite will contain the room Id so that
// Bring up a Gui to send an invite so a player that the user can select. This invite will contain the room Id so that
void SQRNetworkManager_Orbis::SendInviteGUI()
{
if(s_bInviteDialogRunning)
@@ -1403,7 +1403,7 @@ void SQRNetworkManager_Orbis::SendInviteGUI()
app.DebugPrintf("SendInviteGUI - Invite dialog is already running so ignoring request\n");
return;
}
s_bInviteDialogRunning = true;
//Set invitation information - this is now exactly the same as the presence information that we synchronise out.
@@ -1428,7 +1428,7 @@ void SQRNetworkManager_Orbis::SendInviteGUI()
messData.dialogFlag = SCE_TOOLKIT_NP_DIALOG_TYPE_USER_EDITABLE;
messData.npIdsCount = 2; // TODO: Set this to the number of available slots
messData.npIds = NULL;
messData.userInfo.userId = userId;
messData.userInfo.userId = userId;
// Set expire to maximum
messData.expireMinutes = 0;
@@ -1451,9 +1451,9 @@ void SQRNetworkManager_Orbis::SendInviteGUI()
// int ret = sce::Toolkit::NP::Messaging::Interface::sendMessage(&messData, SCE_TOOLKIT_NP_MESSAGE_TYPE_INVITE);
free(subject);
free(body);
free(body);
if(ret < SCE_TOOLKIT_NP_SUCCESS )
if(ret < SCE_TOOLKIT_NP_SUCCESS )
{
s_bInviteDialogRunning = false;
app.DebugPrintf("Send Message failed 0x%x ...\n",ret);
@@ -1513,7 +1513,7 @@ void SQRNetworkManager_Orbis::TickInviteGUI()
int32_t ret = sceGameCustomDataDialogGetResult( &dialogResult );
if( SCE_OK != ret )
{
{
app.DebugPrintf( "***** sceGameCustomDataDialogGetResult error:0x%x\n", ret);
}
sceGameCustomDataDialogClose();
@@ -1536,7 +1536,7 @@ void SQRNetworkManager_Orbis::GetInviteDataAndProcess(sce::Toolkit::NP::MessageA
}
// InvitationInfoRequest requestInfo;
// sce::Toolkit::NP::Utilities::Future< NpSessionInvitationInfo > inviteInfo;
//
//
// requestInfo.invitationId = pInvite->invitationId;
// requestInfo.userInfo.npId = pInvite->onlineId;
// int err = sce::Toolkit::NP::Sessions::Interface::getInvitationInfo(&requestInfo, &inviteInfo, false);
@@ -1555,21 +1555,21 @@ void SQRNetworkManager_Orbis::GetInviteDataAndProcess(sce::Toolkit::NP::MessageA
// {
// app.DebugPrintf("getInvitationInfo error 0x%08x", err);
// }
//
//
//
//
//
//
// INVITE_INFO *invite = &m_inviteReceived[m_inviteIndex];
// m_inviteIndex = ( m_inviteIndex + 1 ) % MAX_SIMULTANEOUS_INVITES;
// size_t dataSize = sizeof(INVITE_INFO);
// int ret = sceNpBasicRecvMessageAttachmentLoad(id, invite, &dataSize);
//
//
// // If we fail ( which we might do if we aren't online at this point) then zero the invite information and we'll try and get it later after (possibly) signing in
// if( ret != 0 )
// {
// memset(invite, 0, sizeof( INVITE_INFO ) );
// s_lastInviteIdToRetry = id;
// }
//
//
// m_gameBootInvite = invite;
}
@@ -1647,7 +1647,7 @@ void SQRNetworkManager_Orbis::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/)
{
EnterCriticalSection(&m_csRoomSyncData);
// If we pass an explicit roomSlotPlayerCount, it is because we are removing a player, and this is the count of slots that there were *before* the removal.
// If we pass an explicit roomSlotPlayerCount, it is because we are removing a player, and this is the count of slots that there were *before* the removal.
bool zeroLastSlot = false;
if( roomSlotPlayerCount == -1 )
{
@@ -1751,7 +1751,7 @@ void SQRNetworkManager_Orbis::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/)
}
else
{
FindOrCreateNonNetworkPlayer( i, SQRNetworkPlayer::SNP_TYPE_REMOTE, m_roomSyncData.players[i].m_roomMemberId, m_roomSyncData.players[i].m_localIdx, m_roomSyncData.players[i].m_smallId);
FindOrCreateNonNetworkPlayer( i, SQRNetworkPlayer::SNP_TYPE_REMOTE, m_roomSyncData.players[i].m_roomMemberId, m_roomSyncData.players[i].m_localIdx, m_roomSyncData.players[i].m_smallId);
m_aRoomSlotPlayers[i]->SetUID(m_roomSyncData.players[i].m_UID); // On client, UIDs flow from m_roomSyncData->player data
}
}
@@ -1844,7 +1844,7 @@ bool SQRNetworkManager_Orbis::AddRemotePlayersAndSync( SceNpMatching2RoomMemberI
}
// We want to keep all players from a particular machine together, so search through the room sync data to see if we can find
// any pre-existing players from this machine.
// any pre-existing players from this machine.
int firstIdx = -1;
for( int i = 0; i < m_roomSyncData.getPlayerCount(); i++ )
{
@@ -1950,7 +1950,7 @@ void SQRNetworkManager_Orbis::RemoveRemotePlayersAndSync( SceNpMatching2RoomMemb
// Update mapping from the room slot players to SQRNetworkPlayer instances
MapRoomSlotPlayers();
// And then synchronise this out to all other machines
SyncRoomData();
@@ -1993,7 +1993,7 @@ void SQRNetworkManager_Orbis::RemoveNetworkPlayers( int mask )
removePlayerFromVoiceChat(player);
// Delete the player itself and the mapping from context to player map as this context is no longer valid
delete player;
delete player;
}
else
{
@@ -2107,7 +2107,7 @@ bool SQRNetworkManager_Orbis::GetMatchingContext(eSQRNetworkManagerInternalState
// Starts the process of obtaining a server context. This is an asynchronous operation, at the end of which (if successful), we'll be creating
// a room. General procedure followed here is as suggested by Sony - we get a list of servers, then pick a random one, and see if it is available.
// If not we just cycle round trying other random ones until we either find an available one or fail.
// If not we just cycle round trying other random ones until we either find an available one or fail.
bool SQRNetworkManager_Orbis::GetServerContext()
{
assert(m_state == SNM_INT_STATE_IDLE);
@@ -2165,7 +2165,7 @@ bool SQRNetworkManager_Orbis::GetServerContext(SceNpMatching2ServerId serverId)
// ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED ) ) // Also checking for this as a means of simulating the previous error
// {
// sceNpMatching2DestroyContext(m_matchingContext);
// m_matchingContextValid = false;
// m_matchingContextValid = false;
// if( !GetMatchingContext(SNM_INT_STATE_JOINING_STARTING_MATCHING_CONTEXT) ) return false;
// }
// }
@@ -2298,7 +2298,7 @@ void SQRNetworkManager_Orbis::NetworkPlayerConnectionComplete(SQRNetworkPlayer *
if( ( !wasReady ) && ( isReady ) )
{
HandlePlayerJoined( player );
HandlePlayerJoined( player );
}
}
@@ -2327,7 +2327,7 @@ void SQRNetworkManager_Orbis::NetworkPlayerSmallIdAllocated(SQRNetworkPlayer *pl
if( ( !wasReady ) && ( isReady ) )
{
HandlePlayerJoined( player );
HandlePlayerJoined( player );
}
}
@@ -2345,7 +2345,7 @@ void SQRNetworkManager_Orbis::NetworkPlayerInitialDataReceived(SQRNetworkPlayer
if( ( !wasReady ) && ( isReady ) )
{
HandlePlayerJoined( player );
HandlePlayerJoined( player );
}
}
@@ -2361,7 +2361,7 @@ void SQRNetworkManager_Orbis::HandlePlayerJoined(SQRNetworkPlayer *player)
{
if( m_listener )
{
m_listener->HandlePlayerJoined( player );
m_listener->HandlePlayerJoined( player );
}
app.DebugPrintf(sc_verbose, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> HandlePlayerJoined\n");
@@ -2425,7 +2425,7 @@ std::string getIPAddressString(SceNetInAddr add)
{
char str[32];
unsigned char *vals = (unsigned char*)&add.s_addr;
sprintf(str, "%d.%d.%d.%d", (int)vals[0], (int)vals[1], (int)vals[2], (int)vals[3]);
sprintf(str, "%d.%d.%d.%d", (int)vals[0], (int)vals[1], (int)vals[2], (int)vals[3]);
return std::string(str);
}
@@ -2495,7 +2495,7 @@ bool SQRNetworkManager_Orbis::CreateVoiceRudpConnections(SceNpMatching2RoomId ro
SQRVoiceConnection* pConnection = SonyVoiceChat_Orbis::getVoiceConnectionFromRoomMemberID(peerMemberId);
if(pConnection == NULL)
{
// Create an Rudp context for the voice connection, this will happen regardless of whether the peer is client or host
int rudpCtx;
ret = sceRudpCreateContext( RudpContextCallback, this, &rudpCtx );
@@ -2510,7 +2510,7 @@ bool SQRNetworkManager_Orbis::CreateVoiceRudpConnections(SceNpMatching2RoomId ro
g_numRUDPContextsBound++;
app.DebugPrintf(sc_verbose, "-----------------::::::::::::: sceRudpBind\n" );
ret = sceRudpInitiate( rudpCtx, (SceNetSockaddr*)&sinp2pPeer, sizeof(sinp2pPeer), 0);
ret = sceRudpInitiate( rudpCtx, (SceNetSockaddr*)&sinp2pPeer, sizeof(sinp2pPeer), 0);
if(ret < 0){ app.DebugPrintf("sceRudpInitiate %s failed : 0x%08x\n", getIPAddressString(sinp2pPeer.sin_addr).c_str(), ret); assert(0); }
if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_RUDP_INIT2) ) return false;
app.DebugPrintf(sc_verbose, "-----------------::::::::::::: sceRudpInitiate\n" );
@@ -2521,7 +2521,7 @@ bool SQRNetworkManager_Orbis::CreateVoiceRudpConnections(SceNpMatching2RoomId ro
pConnection = SonyVoiceChat_Orbis::addRemoteConnection(rudpCtx, peerMemberId);
}
for( int i = 0; i < MAX_LOCAL_PLAYER_COUNT; i++ )
{
bool bMaskVal = ( playerMask & ( 1 << i ) );
@@ -2544,11 +2544,11 @@ bool SQRNetworkManager_Orbis::CreateRudpConnections(SceNpMatching2RoomId roomId,
memset(&sinp2pPeer, 0, sizeof(sinp2pPeer));
sinp2pPeer.sin_len = sizeof(sinp2pPeer);
sinp2pPeer.sin_family = AF_INET;
int ret = sceNpMatching2SignalingGetConnectionStatus(m_matchingContext, roomId, peerMemberId, &connStatus, &sinp2pPeer.sin_addr, &sinp2pPeer.sin_port);
app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2SignalingGetConnectionStatus returned 0x%x, connStatus %d peer add:%s peer port:0x%x\n",ret, connStatus,getIPAddressString(sinp2pPeer.sin_addr).c_str(),sinp2pPeer.sin_port);
// Set vport
// Set vport
sinp2pPeer.sin_vport = sceNetHtons(1);
// Create socket & bind, if we don't already have one
@@ -2706,7 +2706,7 @@ void SQRNetworkManager_Orbis::ContextCallback(SceNpMatching2ContextId id, SceNp
manager->m_state == SNM_INT_STATE_HOSTING_STARTING_MATCHING_CONTEXT ||
manager->m_state == SNM_INT_STATE_JOINING_STARTING_MATCHING_CONTEXT)
{
// matching context failed to start (this can happen when you block the IP addresses of the matching servers on your router
// matching context failed to start (this can happen when you block the IP addresses of the matching servers on your router
// agent-0101.ww.sp-int.matching.playstation.net (198.107.157.191)
// static-resource.sp-int.community.playstation.net (203.105.77.140)
app.DebugPrintf("SQRNetworkManager_Orbis::ContextCallback - Error\n");
@@ -2771,7 +2771,7 @@ void SQRNetworkManager_Orbis::ContextCallback(SceNpMatching2ContextId id, SceNp
// unsigned int type, attributes;
// CellGameContentSize gameSize;`
// char dirName[CELL_GAME_DIRNAME_SIZE];
//
//
// if( g_bBootedFromInvite )
// {
// manager->GetInviteDataAndProcess(SCE_NP_BASIC_SELECTED_INVITATION_DATA);
@@ -2789,7 +2789,7 @@ void SQRNetworkManager_Orbis::ContextCallback(SceNpMatching2ContextId id, SceNp
assert(false);
break;
case SCE_NP_MATCHING2_CONTEXT_EVENT_START_OVER:
app.DebugPrintf("SCE_NP_MATCHING2_CONTEXT_EVENT_START_OVER\n");
app.DebugPrintf("eventCause=%u, errorCode=0x%08x\n", eventCause, errorCode);
@@ -2950,7 +2950,7 @@ void SQRNetworkManager_Orbis::DefaultRequestCallback(SceNpMatching2ContextId id,
if( success1 )
{
success2 = manager->CreateRudpConnections(manager->m_room, pRoomMemberData->roomMemberDataInternal->memberId, playerMask, pRoomMemberData->roomMemberDataInternal->memberId);
if( success2 )
if( success2 )
{
bool ret = manager->CreateVoiceRudpConnections( manager->m_room, pRoomMemberData->roomMemberDataInternal->memberId, 0);
assert(ret == true);
@@ -3055,7 +3055,7 @@ void SQRNetworkManager_Orbis::DefaultRequestCallback(SceNpMatching2ContextId id,
void SQRNetworkManager_Orbis::RoomEventCallback(SceNpMatching2ContextId id, SceNpMatching2RoomId roomId, SceNpMatching2Event event, const void *data, void *arg)
{
SQRNetworkManager_Orbis *manager = (SQRNetworkManager_Orbis *)arg;
bool gotEventData = false;
switch( event )
{
@@ -3186,7 +3186,7 @@ void SQRNetworkManager_Orbis::RoomEventCallback(SceNpMatching2ContextId id, SceN
int oldMask = manager->GetOldMask( pRoomMemberData->newRoomMemberDataInternal->memberId );
int addedMask = manager->GetAddedMask(playerMask, oldMask );
int removedMask = manager->GetRemovedMask(playerMask, oldMask );
if( addedMask != 0 )
{
bool success = manager->AddRemotePlayersAndSync( pRoomMemberData->newRoomMemberDataInternal->memberId, addedMask );
@@ -3203,7 +3203,7 @@ void SQRNetworkManager_Orbis::RoomEventCallback(SceNpMatching2ContextId id, SceN
memset(&reqParam, 0, sizeof(reqParam));
memset(&binAttr, 0, sizeof(binAttr));
binAttr.id = SCE_NP_MATCHING2_ROOMMEMBER_BIN_ATTR_INTERNAL_1_ID;
binAttr.ptr = &oldMask;
binAttr.size = sizeof(oldMask);
@@ -3265,7 +3265,7 @@ void SQRNetworkManager_Orbis::RoomEventCallback(SceNpMatching2ContextId id, SceN
}
}
}
}
}
break;
@@ -3426,7 +3426,7 @@ void SQRNetworkManager_Orbis::SysUtilCallback(uint64_t status, uint64_t param, v
// }
// return;
// }
//
//
// if( netstart_result.result != 0 )
// {
// // Failed, or user may have decided not to sign in - maybe need to differentiate here
@@ -3440,7 +3440,7 @@ void SQRNetworkManager_Orbis::SysUtilCallback(uint64_t status, uint64_t param, v
// s_SignInCompleteCallbackFn = NULL;
// }
// }
//
//
// break;
// case CELL_SYSUTIL_NET_CTL_NETSTART_UNLOADED:
// break;
@@ -3608,7 +3608,7 @@ void SQRNetworkManager_Orbis::NetCtlCallback(int eventType, void *arg)
if( eventType == SCE_NET_CTL_EVENT_TYPE_DISCONNECTED)// CELL_NET_CTL_EVENT_LINK_DISCONNECTED )
{
manager->m_bLinkDisconnected = true;
manager->m_listener->HandleDisconnect(false);
manager->m_listener->HandleDisconnect(false);
}
else //if( event == CELL_NET_CTL_EVENT_ESTABLISH )
{
@@ -3762,7 +3762,7 @@ void SQRNetworkManager_Orbis::GetExtDataForRoom( SceNpMatching2RoomId roomId, vo
if( ret == SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED ) // Also checking for this as a means of simulating the previous error
{
sceNpMatching2DestroyContext(m_matchingContext);
m_matchingContextValid = false;
m_matchingContextValid = false;
if( !GetMatchingContext(SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT) )
{
// No matching context, and failed to try and make one. We're really broken here.
@@ -3789,7 +3789,7 @@ bool SQRNetworkManager_Orbis::ForceErrorPoint(eSQRForceError error)
return false;
}
#else
bool SQRNetworkManager_Orbis::aForceError[SNM_FORCE_ERROR_COUNT] =
bool SQRNetworkManager_Orbis::aForceError[SNM_FORCE_ERROR_COUNT] =
{
false, // SNM_FORCE_ERROR_NP2_INIT
false, // SNM_FORCE_ERROR_NET_INITIALIZE_NETWORK
@@ -3919,7 +3919,7 @@ void SQRNetworkManager_Orbis::AttemptPSNSignIn(int (*SignInCompleteCallbackFn)(v
ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA,1,iPad,ErrorPSNDisconnectedDialogReturned,pParam, app.GetStringTable());
}
}
}
int SQRNetworkManager_Orbis::SetRichPresence(const void *data)
{
@@ -3971,13 +3971,13 @@ void SQRNetworkManager_Orbis::SendLastPresenceInfo()
// On PS4 we can't set the status and the data at the same time
unsigned int options = 0;
if( s_presenceDataDirty )
if( s_presenceDataDirty )
{
// Prioritise data over status as it is critical to discovering the network game
s_lastPresenceInfo.presenceType = SCE_TOOLKIT_NP_PRESENCE_DATA;
}
else if( s_presenceStatusDirty )
{
else if( s_presenceStatusDirty )
{
s_lastPresenceInfo.presenceType = SCE_TOOLKIT_NP_PRESENCE_STATUS;
}
else
@@ -4065,7 +4065,7 @@ void SQRNetworkManager_Orbis::removePlayerFromVoiceChat( SQRNetworkPlayer* pPlay
{
if(pPlayer->IsLocal())
{
SonyVoiceChat_Orbis::disconnectLocalPlayer(pPlayer->GetLocalPlayerIndex());
}
else
@@ -4097,7 +4097,7 @@ void SQRNetworkManager_Orbis::removePlayerFromVoiceChat( SQRNetworkPlayer* pPlay
void SQRNetworkManager_Orbis::TickNotify()
{
if (g_NetworkManager.IsInSession() && !g_NetworkManager.IsLocalGame())
{
{
long long currentTime = System::currentTimeMillis();
// Note: interval at which to notify Sony of realtime play, according to docs an interval greater than 1 sec is bad
@@ -4109,7 +4109,7 @@ void SQRNetworkManager_Orbis::TickNotify()
m_lastNotifyTime = currentTime;
for(int i = 0; i < XUSER_MAX_COUNT; i++)
{
if (ProfileManager.IsSignedInLive(i))
if (ProfileManager.IsSignedInLive(i))
{
NotifyRealtimePlusFeature(i);
}
@@ -4143,8 +4143,8 @@ void SQRNetworkManager_Orbis::NotifyRealtimePlusFeature(int iQuadrant)
// {
// app.DebugPrintf("============ Calling CallSignInCompleteCallback and s_SignInCompleteCallbackFn is OK\n");
// bool isSignedIn = ProfileManager.IsSignedInLive(s_SignInCompleteCallbackPad);
//
// s_SignInCompleteCallbackFn(s_SignInCompleteParam, isSignedIn, s_SignInCompleteCallbackPad);
//
// s_SignInCompleteCallbackFn(s_SignInCompleteParam, isSignedIn, s_SignInCompleteCallbackPad);
// s_SignInCompleteCallbackFn = NULL;
// s_SignInCompleteCallbackPad = -1;
// }

View File

@@ -29,7 +29,7 @@ class SQRNetworkManager_Orbis : public SQRNetworkManager
public:
SQRNetworkManager_Orbis(ISQRNetworkManagerListener *listener);
// General
// General
void Tick();
void Initialise();
void Terminate();
@@ -111,7 +111,7 @@ private:
bool m_offlineSQR;
int m_resendExternalRoomDataCountdown;
bool m_matching2initialised;
PresenceSyncInfo m_inviteReceived[MAX_SIMULTANEOUS_INVITES];
PresenceSyncInfo m_inviteReceived[MAX_SIMULTANEOUS_INVITES];
int m_inviteIndex;
static PresenceSyncInfo *m_gameBootInvite;
static PresenceSyncInfo m_gameBootInvite_data;
@@ -222,9 +222,9 @@ private:
std::vector<FriendSearchResult> m_aFriendSearchResults;
// Rudp management and local players
std::unordered_map<int,SQRNetworkPlayer *> m_RudpCtxToPlayerMap;
std::unordered_map<int,SQRNetworkPlayer *> m_RudpCtxToPlayerMap;
std::unordered_map<SceNetInAddr_t, SQRVoiceConnection*> m_NetAddrToVoiceConnectionMap;
std::unordered_map<SceNetInAddr_t, SQRVoiceConnection*> m_NetAddrToVoiceConnectionMap;
bool CreateRudpConnections(SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId peerMemberId, int playerMask, SceNpMatching2RoomMemberId playersPeerMemberId);
bool CreateVoiceRudpConnections(SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId peerMemberId, int playerMask);
@@ -325,8 +325,8 @@ private:
static sce::Toolkit::NP::PresenceDetails s_lastPresenceInfo;
static const int MIN_PRESENCE_RESEND_TIME = 30 * 1000; // Minimum presence send rate - doesn't seem possible to find out what this actually should be
static __int64 s_lastPresenceTime;
static __int64 s_resendPresenceTime;
static int64_t s_lastPresenceTime;
static int64_t s_resendPresenceTime;
static bool s_presenceStatusDirty;
static bool s_presenceDataDirty;
@@ -337,7 +337,7 @@ private:
// Debug
static long long s_roomStartTime;
// Error dialog
static bool s_errorDialogRunning;

View File

@@ -24,9 +24,9 @@ int32_t hBGMAudio;
//static char sc_loadPath[] = {"/app0/"};
//const char* getConsoleHomePath() { return sc_loadPath; }
char* getUsrDirPath()
{
return usrdirPath;
char* getUsrDirPath()
{
return usrdirPath;
}
@@ -34,7 +34,7 @@ int _wcsicmp( const wchar_t * dst, const wchar_t * src )
{
wchar_t f,l;
// validation section
// validation section
// _VALIDATE_RETURN(dst != NULL, EINVAL, _NLSCMPERROR);
// _VALIDATE_RETURN(src != NULL, EINVAL, _NLSCMPERROR);
@@ -61,7 +61,7 @@ size_t wcsnlen(const wchar_t *wcs, size_t maxsize)
}
VOID GetSystemTime( LPSYSTEMTIME lpSystemTime)
VOID GetSystemTime( LPSYSTEMTIME lpSystemTime)
{
SceRtcDateTime dateTime;
int err = sceRtcGetCurrentClock(&dateTime, 0);
@@ -78,8 +78,8 @@ VOID GetSystemTime( LPSYSTEMTIME lpSystemTime)
}
BOOL FileTimeToSystemTime(CONST FILETIME *lpFileTime, LPSYSTEMTIME lpSystemTime) { ORBIS_STUBBED; return false; }
BOOL SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime) { ORBIS_STUBBED; return false; }
VOID GetLocalTime(LPSYSTEMTIME lpSystemTime)
{
VOID GetLocalTime(LPSYSTEMTIME lpSystemTime)
{
SceRtcDateTime dateTime;
int err = sceRtcGetCurrentClockLocalTime(&dateTime);
assert(err == SCE_OK );
@@ -95,21 +95,21 @@ VOID GetLocalTime(LPSYSTEMTIME lpSystemTime)
}
HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { ORBIS_STUBBED; return NULL; }
VOID Sleep(DWORD dwMilliseconds)
{
VOID Sleep(DWORD dwMilliseconds)
{
C4JThread::Sleep(dwMilliseconds);
}
BOOL SetThreadPriority(HANDLE hThread, int nPriority) { ORBIS_STUBBED; return FALSE; }
DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds) { ORBIS_STUBBED; return false; }
LONG InterlockedCompareExchangeRelease(LONG volatile *Destination, LONG Exchange,LONG Comperand )
{
LONG InterlockedCompareExchangeRelease(LONG volatile *Destination, LONG Exchange,LONG Comperand )
{
return sceAtomicCompareAndSwap32((int32_t*)Destination, (int32_t)Comperand, (int32_t)Exchange);
}
LONG64 InterlockedCompareExchangeRelease64(LONG64 volatile *Destination, LONG64 Exchange, LONG64 Comperand)
{
LONG64 InterlockedCompareExchangeRelease64(LONG64 volatile *Destination, LONG64 Exchange, LONG64 Comperand)
{
return sceAtomicCompareAndSwap64((int64_t*)Destination, (int64_t)Comperand, (int64_t)Exchange);
}
@@ -135,10 +135,10 @@ VOID OrbisInit()
sceSysmoduleLoadModule(SCE_SYSMODULE_RUDP);
sceSysmoduleLoadModule(SCE_SYSMODULE_NP_MATCHING2);
sceSysmoduleLoadModule(SCE_SYSMODULE_INVITATION_DIALOG);
sceSysmoduleLoadModule(SCE_SYSMODULE_NP_PARTY );
sceSysmoduleLoadModule(SCE_SYSMODULE_GAME_CUSTOM_DATA_DIALOG );
sceSysmoduleLoadModule(SCE_SYSMODULE_NP_SCORE_RANKING );
sceSysmoduleLoadModule(SCE_SYSMODULE_NP_AUTH );
sceSysmoduleLoadModule(SCE_SYSMODULE_NP_PARTY );
sceSysmoduleLoadModule(SCE_SYSMODULE_GAME_CUSTOM_DATA_DIALOG );
sceSysmoduleLoadModule(SCE_SYSMODULE_NP_SCORE_RANKING );
sceSysmoduleLoadModule(SCE_SYSMODULE_NP_AUTH );
sceSysmoduleLoadModule(SCE_SYSMODULE_NP_COMMERCE);
sceSysmoduleLoadModule(SCE_SYSMODULE_REMOTE_PLAY);
sceSysmoduleLoadModule(SCE_SYSMODULE_ERROR_DIALOG);
@@ -173,7 +173,7 @@ VOID OrbisInit()
hBGMAudio=sceAudioOutOpen(
SCE_USER_SERVICE_USER_ID_SYSTEM,
SCE_AUDIO_OUT_PORT_TYPE_BGM,0,
256,
256,
48000,
2);
@@ -195,7 +195,7 @@ int32_t GetAudioBGMHandle()
return hBGMAudio;
}
VOID InitializeCriticalSection(PCRITICAL_SECTION CriticalSection)
VOID InitializeCriticalSection(PCRITICAL_SECTION CriticalSection)
{
char name[1] = {0};
@@ -209,7 +209,7 @@ VOID InitializeCriticalSection(PCRITICAL_SECTION CriticalSection)
}
VOID InitializeCriticalSectionAndSpinCount(PCRITICAL_SECTION CriticalSection, ULONG SpinCount)
VOID InitializeCriticalSectionAndSpinCount(PCRITICAL_SECTION CriticalSection, ULONG SpinCount)
{
InitializeCriticalSection(CriticalSection);
}
@@ -220,9 +220,9 @@ VOID DeleteCriticalSection(PCRITICAL_SECTION CriticalSection)
assert(err == SCE_OK);
}
extern CRITICAL_SECTION g_singleThreadCS;
extern CRITICAL_SECTION g_singleThreadCS;
VOID EnterCriticalSection(PCRITICAL_SECTION CriticalSection)
VOID EnterCriticalSection(PCRITICAL_SECTION CriticalSection)
{
int err = scePthreadMutexLock(&CriticalSection->mutex);
assert(err == SCE_OK || err == SCE_KERNEL_ERROR_EDEADLK );
@@ -240,7 +240,7 @@ VOID EnterCriticalSection(PCRITICAL_SECTION CriticalSection)
}
VOID LeaveCriticalSection(PCRITICAL_SECTION CriticalSection)
VOID LeaveCriticalSection(PCRITICAL_SECTION CriticalSection)
{
if(--CriticalSection->m_cLock == 0 )
{
@@ -255,7 +255,7 @@ VOID LeaveCriticalSection(PCRITICAL_SECTION CriticalSection)
ULONG TryEnterCriticalSection(PCRITICAL_SECTION CriticalSection)
{
int err = scePthreadMutexTrylock(&CriticalSection->mutex);
int err = scePthreadMutexTrylock(&CriticalSection->mutex);
if((err == SCE_OK || err == SCE_KERNEL_ERROR_EDEADLK ))
{
CriticalSection->m_cLock++;
@@ -266,20 +266,20 @@ ULONG TryEnterCriticalSection(PCRITICAL_SECTION CriticalSection)
DWORD WaitForMultipleObjects(DWORD nCount, CONST HANDLE *lpHandles,BOOL bWaitAll,DWORD dwMilliseconds) { ORBIS_STUBBED; return 0; }
BOOL CloseHandle(HANDLE hObject)
{
BOOL CloseHandle(HANDLE hObject)
{
sceFiosFHCloseSync(NULL,(SceFiosFH)((int64_t)hObject));
return true;
// ORBIS_STUBBED;
// return false;
// ORBIS_STUBBED;
// return false;
}
BOOL SetEvent(HANDLE hEvent) { ORBIS_STUBBED; return false; }
HMODULE GetModuleHandle(LPCSTR lpModuleName) { ORBIS_STUBBED; return 0; }
DWORD GetCurrentThreadId(VOID)
{
DWORD GetCurrentThreadId(VOID)
{
return 0; // TODO
}
DWORD WaitForMultipleObjectsEx(DWORD nCount,CONST HANDLE *lpHandles,BOOL bWaitAll,DWORD dwMilliseconds,BOOL bAlertable ) { ORBIS_STUBBED; return 0; }
@@ -302,10 +302,10 @@ public:
void* m_virtualAddr;
uint64_t m_size;
PageInfo(off_t physAddr, void* virtualAddr, uint64_t size)
PageInfo(off_t physAddr, void* virtualAddr, uint64_t size)
: m_physAddr(physAddr)
, m_virtualAddr(virtualAddr)
, m_size(size)
, m_size(size)
{}
};
void* m_virtualAddr;
@@ -313,7 +313,7 @@ public:
std::vector<PageInfo> m_pagesAllocated;
uint64_t m_allocatedSize;
OrbisVAlloc(void* addr, uint64_t size)
OrbisVAlloc(void* addr, uint64_t size)
: m_virtualAddr(addr)
, m_virtualSize(size)
, m_allocatedSize(0)
@@ -331,7 +331,7 @@ public:
{
uint64_t sizeToAdd = size - m_allocatedSize; // the extra memory size that we have to add on
assert(sizeToAdd >= 0);
if(sizeToAdd == 0)
return m_virtualAddr; // nothing to add
@@ -393,8 +393,8 @@ public:
static std::vector<OrbisVAlloc*> s_orbisVAllocs;
LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect)
{
LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect)
{
if(lpAddress == NULL)
{
void *pAddr = (void*)SCE_KERNEL_APP_MAP_AREA_START_ADDR;
@@ -446,14 +446,14 @@ BOOL VirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType)
else if(dwFreeType == MEM_RELEASE)
{
delete s_orbisVAllocs[idx];
s_orbisVAllocs.erase(s_orbisVAllocs.begin()+idx);
s_orbisVAllocs.erase(s_orbisVAllocs.begin()+idx);
}
return TRUE;
}
DWORD GetFileSize( HANDLE hFile, LPDWORD lpFileSizeHigh )
{
DWORD GetFileSize( HANDLE hFile, LPDWORD lpFileSizeHigh )
{
SceFiosSize FileSize;
SceFiosFH fh = (SceFiosFH)((int64_t)hFile);
//DWORD FileSizeLow;
@@ -468,15 +468,15 @@ DWORD GetFileSize( HANDLE hFile, LPDWORD lpFileSizeHigh )
return (DWORD)FileSize;
}
BOOL GetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize )
{
BOOL GetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize )
{
SceFiosSize FileSize;
SceFiosFH fh = (SceFiosFH)((int64_t)hFile);
FileSize=sceFiosFHGetSize(fh);
lpFileSize->QuadPart=FileSize;
return true;
return true;
}
BOOL WriteFile(
HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped )
@@ -496,7 +496,7 @@ BOOL WriteFile(
}
}
BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped )
BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped )
{
SceFiosFH fh = (SceFiosFH)((int64_t)hFile);
// sceFiosFHReadSync - Non-negative values are the number of bytes read, 0 <= result <= length. Negative values are error codes.
@@ -537,7 +537,7 @@ BOOL SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHi
}
HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
{
char filePath[256];
std::string mountedPath = StorageManager.GetMountedPath(lpFileName);
@@ -549,7 +549,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
strcpy(filePath, lpFileName );
else
sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName );
#ifndef _CONTENT_PACKAGE
app.DebugPrintf("*** Opening %s\n",filePath);
#endif
@@ -557,9 +557,9 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
SceFiosFH fh;
SceFiosOpenParams openParams;
ZeroMemory(&openParams, sizeof(SceFiosOpenParams));
switch(dwDesiredAccess)
{
{
case GENERIC_READ:
openParams.openFlags = SCE_FIOS_O_RDONLY; break;
case GENERIC_WRITE:
@@ -588,21 +588,21 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
return INVALID_HANDLE_VALUE;
}
//assert( err == SCE_FIOS_OK );
return (void*)fh;
}
BOOL CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes){ ORBIS_STUBBED; return false; }
BOOL DeleteFileA(LPCSTR lpFileName) { ORBIS_STUBBED; return false; }
// BOOL XCloseHandle(HANDLE a)
// BOOL XCloseHandle(HANDLE a)
// {
// sceFiosFHCloseSync(NULL,(SceFiosFH)((int64_t)a));
// return true;
// }
DWORD GetFileAttributesA(LPCSTR lpFileName)
DWORD GetFileAttributesA(LPCSTR lpFileName)
{
char filePath[256];
std::string mountedPath = StorageManager.GetMountedPath(lpFileName);
@@ -633,7 +633,7 @@ BOOL MoveFileA(LPCSTR lpExistingFileName, LPCSTR lpNewFileName) { ORBIS_STUBBED;
DWORD GetLastError(VOID) { ORBIS_STUBBED; return 0; }
VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
{
SceLibcMallocManagedSize stat;
int err = malloc_stats(&stat);
@@ -647,20 +647,20 @@ VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
lpBuffer->dwAvailVirtual = stat.maxSystemSize - stat.currentInuseSize;
}
DWORD GetTickCount()
DWORD GetTickCount()
{
// This function returns the current system time at this function is called.
// This function returns the current system time at this function is called.
// The system time is represented the time elapsed since the system starts up in microseconds.
uint64_t sysTime = sceKernelGetProcessTime();
return (DWORD)(sysTime / 1000);
return (DWORD)(sysTime / 1000);
}
// we should really use libperf for this kind of thing, but this will do for now.
BOOL QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency)
{
BOOL QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency)
{
// microseconds
lpFrequency->QuadPart = (1000 * 1000);
return false;
lpFrequency->QuadPart = (1000 * 1000);
return false;
}
BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount)
{
@@ -671,24 +671,24 @@ BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount)
#ifndef _FINAL_BUILD
VOID OutputDebugStringW(LPCWSTR lpOutputString)
{
wprintf(lpOutputString);
VOID OutputDebugStringW(LPCWSTR lpOutputString)
{
wprintf(lpOutputString);
}
VOID OutputDebugStringA(LPCSTR lpOutputString)
{
printf(lpOutputString);
VOID OutputDebugStringA(LPCSTR lpOutputString)
{
printf(lpOutputString);
}
VOID OutputDebugString(LPCSTR lpOutputString)
{
printf(lpOutputString);
VOID OutputDebugString(LPCSTR lpOutputString)
{
printf(lpOutputString);
}
#endif // _CONTENT_PACKAGE
BOOL GetFileAttributesExA(LPCSTR lpFileName,GET_FILEEX_INFO_LEVELS fInfoLevelId,LPVOID lpFileInformation)
{
{
ORBIS_STUBBED;
return false;
}
@@ -696,15 +696,15 @@ HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData) { ORB
BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData) { ORBIS_STUBBED; return false;}
errno_t _itoa_s(int _Value, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%d",_Value); else if(_Radix==16) sprintf(_DstBuf,"%lx",_Value); else return -1; return 0; }
errno_t _i64toa_s(__int64 _Val, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%lld",_Val); else return -1; return 0; }
errno_t _i64toa_s(int64_t _Val, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%lld",_Val); else return -1; return 0; }
DWORD XGetLanguage()
{
DWORD XGetLanguage()
{
unsigned char ucLang = app.GetMinecraftLanguage(0);
int iLang;
// check if we should override the system language or not
if(ucLang==MINECRAFT_LANGUAGE_DEFAULT)
if(ucLang==MINECRAFT_LANGUAGE_DEFAULT)
{
sceSystemServiceParamGetInt(SCE_SYSTEM_SERVICE_PARAM_ID_LANG,&iLang);
}
@@ -747,8 +747,8 @@ DWORD XGetLanguage()
}
}
DWORD XGetLocale()
{
DWORD XGetLocale()
{
int iLang;
sceSystemServiceParamGetInt(SCE_SYSTEM_SERVICE_PARAM_ID_LANG,&iLang);
switch(iLang)
@@ -784,7 +784,7 @@ DWORD XGetLocale()
}
}
DWORD XEnableGuestSignin(BOOL fEnable)
{
return 0;
DWORD XEnableGuestSignin(BOOL fEnable)
{
return 0;
}

View File

@@ -14,7 +14,7 @@ DWORD TlsAlloc(VOID);
LPVOID TlsGetValue(DWORD dwTlsIndex);
BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue);
typedef struct _RECT
typedef struct _RECT
{
LONG left;
LONG top;
@@ -37,16 +37,16 @@ typedef int errno_t;
// // The following field is used for blocking when there is contention for
// // the resource
// //
//
//
// union {
// ULONG_PTR RawEvent[4];
// } Synchronization;
//
//
// //
// // The following three fields control entering and exiting the critical
// // section for the resource
// //
//
//
// LONG LockCount;
// LONG RecursionCount;
// HANDLE OwningThread;
@@ -214,7 +214,7 @@ typedef struct _MEMORYSTATUS {
#define THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE
#define WAIT_TIMEOUT 258L
#define STATUS_ABANDONED_WAIT_0 ((DWORD )0x00000080L)
#define STATUS_ABANDONED_WAIT_0 ((DWORD )0x00000080L)
#define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0 ) + 0 )
#define MAXUINT_PTR (~((UINT_PTR)0))
@@ -256,17 +256,17 @@ typedef struct _MEMORYSTATUS {
#define GENERIC_EXECUTE (0x20000000L)
#define GENERIC_ALL (0x10000000L)
#define FILE_SHARE_READ 0x00000001
#define FILE_SHARE_WRITE 0x00000002
#define FILE_SHARE_DELETE 0x00000004
#define FILE_ATTRIBUTE_READONLY 0x00000001
#define FILE_ATTRIBUTE_HIDDEN 0x00000002
#define FILE_ATTRIBUTE_SYSTEM 0x00000004
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
#define FILE_ATTRIBUTE_DEVICE 0x00000040
#define FILE_ATTRIBUTE_NORMAL 0x00000080
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
#define FILE_SHARE_READ 0x00000001
#define FILE_SHARE_WRITE 0x00000002
#define FILE_SHARE_DELETE 0x00000004
#define FILE_ATTRIBUTE_READONLY 0x00000001
#define FILE_ATTRIBUTE_HIDDEN 0x00000002
#define FILE_ATTRIBUTE_SYSTEM 0x00000004
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
#define FILE_ATTRIBUTE_DEVICE 0x00000040
#define FILE_ATTRIBUTE_NORMAL 0x00000080
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
#define FILE_FLAG_WRITE_THROUGH 0x80000000
#define FILE_FLAG_OVERLAPPED 0x40000000
@@ -286,38 +286,38 @@ typedef struct _MEMORYSTATUS {
#define OPEN_ALWAYS 4
#define TRUNCATE_EXISTING 5
#define PAGE_NOACCESS 0x01
#define PAGE_READONLY 0x02
#define PAGE_READWRITE 0x04
#define PAGE_WRITECOPY 0x08
#define PAGE_EXECUTE 0x10
#define PAGE_EXECUTE_READ 0x20
#define PAGE_EXECUTE_READWRITE 0x40
#define PAGE_EXECUTE_WRITECOPY 0x80
#define PAGE_GUARD 0x100
#define PAGE_NOCACHE 0x200
#define PAGE_WRITECOMBINE 0x400
#define PAGE_USER_READONLY 0x1000
#define PAGE_USER_READWRITE 0x2000
#define MEM_COMMIT 0x1000
#define MEM_RESERVE 0x2000
#define MEM_DECOMMIT 0x4000
#define MEM_RELEASE 0x8000
#define MEM_FREE 0x10000
#define MEM_PRIVATE 0x20000
#define MEM_RESET 0x80000
#define MEM_TOP_DOWN 0x100000
#define MEM_NOZERO 0x800000
#define MEM_LARGE_PAGES 0x20000000
#define MEM_HEAP 0x40000000
#define MEM_16MB_PAGES 0x80000000
#define PAGE_NOACCESS 0x01
#define PAGE_READONLY 0x02
#define PAGE_READWRITE 0x04
#define PAGE_WRITECOPY 0x08
#define PAGE_EXECUTE 0x10
#define PAGE_EXECUTE_READ 0x20
#define PAGE_EXECUTE_READWRITE 0x40
#define PAGE_EXECUTE_WRITECOPY 0x80
#define PAGE_GUARD 0x100
#define PAGE_NOCACHE 0x200
#define PAGE_WRITECOMBINE 0x400
#define PAGE_USER_READONLY 0x1000
#define PAGE_USER_READWRITE 0x2000
#define MEM_COMMIT 0x1000
#define MEM_RESERVE 0x2000
#define MEM_DECOMMIT 0x4000
#define MEM_RELEASE 0x8000
#define MEM_FREE 0x10000
#define MEM_PRIVATE 0x20000
#define MEM_RESET 0x80000
#define MEM_TOP_DOWN 0x100000
#define MEM_NOZERO 0x800000
#define MEM_LARGE_PAGES 0x20000000
#define MEM_HEAP 0x40000000
#define MEM_16MB_PAGES 0x80000000
#define IGNORE 0 // Ignore signal
#define INFINITE 0xFFFFFFFF // Infinite timeout
#define WAIT_FAILED ((DWORD)0xFFFFFFFF)
#define STATUS_WAIT_0 ((DWORD )0x00000000L)
#define STATUS_WAIT_0 ((DWORD )0x00000000L)
#define WAIT_OBJECT_0 ((STATUS_WAIT_0 ) + 0 )
#define STATUS_PENDING ((DWORD )0x00000103L)
#define STATUS_PENDING ((DWORD )0x00000103L)
#define STILL_ACTIVE STATUS_PENDING
DWORD GetLastError(VOID);
@@ -356,9 +356,9 @@ VOID OutputDebugString(LPCSTR lpOutputString);
VOID OutputDebugStringA(LPCSTR lpOutputString);
errno_t _itoa_s(int _Value, char * _DstBuf, size_t _Size, int _Radix);
errno_t _i64toa_s(__int64 _Val, char * _DstBuf, size_t _Size, int _Radix);
errno_t _i64toa_s(int64_t _Val, char * _DstBuf, size_t _Size, int _Radix);
#define __declspec(a)
#define __declspec(a)
extern "C" int _wcsicmp (const wchar_t * dst, const wchar_t * src);
size_t wcsnlen(const wchar_t *wcs, size_t maxsize);

View File

@@ -34,8 +34,6 @@ typedef unsigned int *PUINT;
typedef unsigned char byte;
typedef long __int64;
typedef unsigned long __uint64;
typedef unsigned int DWORD;
typedef int INT;
typedef unsigned long ULONG_PTR, *PULONG_PTR;

View File

@@ -35,7 +35,7 @@ CConsoleMinecraftApp::CConsoleMinecraftApp() : CMinecraftApp()
m_bVoiceChatAndUGCRestricted=false;
m_bDisplayFullVersionPurchase=false;
// #ifdef _DEBUG_MENUS_ENABLED
// #ifdef _DEBUG_MENUS_ENABLED
// debugOverlayCreated = false;
// #endif
@@ -333,7 +333,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImage(SONYDLC *pDLCInfo)
DWORD dwHigh=0;
pDLCInfo->dwImageBytes = GetFileSize(hFile,&dwHigh);
if(pDLCInfo->dwImageBytes!=0)
{
DWORD dwBytesRead;
@@ -400,7 +400,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart()
StorageManager.SetSaveTitle(wWorldName.c_str());
bool isFlat = false;
__int64 seedValue = BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
int64_t seedValue = BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
NetworkGameInitData *param = new NetworkGameInitData();
param->seed = seedValue;
@@ -485,7 +485,7 @@ void CConsoleMinecraftApp::CommerceTick()
break;
case eCommerce_State_GetProductList:
{
{
m_eCommerce_State=eCommerce_State_GetProductList_Pending;
SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo();
std::list<SonyCommerce::CategoryInfoSub>::iterator iter = pCategories->subCategories.begin();
@@ -501,7 +501,7 @@ void CConsoleMinecraftApp::CommerceTick()
break;
case eCommerce_State_AddProductInfoDetailed:
{
{
m_eCommerce_State=eCommerce_State_AddProductInfoDetailed_Pending;
// for each of the products in the categories, get the detailed info. We really only need the long description and price info.
@@ -538,7 +538,7 @@ void CConsoleMinecraftApp::CommerceTick()
break;
case eCommerce_State_RegisterDLC:
{
{
m_eCommerce_State=eCommerce_State_Online;
// register the DLC info
SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo();
@@ -625,20 +625,20 @@ SonyCommerce::CategoryInfo *CConsoleMinecraftApp::GetCategoryInfo()
return &m_CategoryInfo;
}
#endif
#endif
void CConsoleMinecraftApp::ClearCommerceDetails()
{
#ifdef ORBIS_COMMERCE_ENABLED
for(int i=0;i<m_ProductListCategoriesC;i++)
{
std::vector<SonyCommerce::ProductInfo>* pProductList=&m_ProductListA[i];
std::vector<SonyCommerce::ProductInfo>* pProductList=&m_ProductListA[i];
pProductList->clear();
}
if(m_ProductListA!=NULL)
{
delete [] m_ProductListA;
delete [] m_ProductListA;
m_ProductListA=NULL;
}
@@ -674,11 +674,11 @@ void CConsoleMinecraftApp::GetDLCSkuIDFromProductList(char * pchDLCProductID, ch
{
SonyCommerce::ProductInfo Info=*it;
if(strcmp(pchDLCProductID,Info.productId)==0)
{
{
memcpy(pchSkuID,Info.skuId,SCE_NP_COMMERCE2_SKU_ID_LEN);
return;
}
}
}
}
}
return;
@@ -689,7 +689,7 @@ void CConsoleMinecraftApp::GetDLCSkuIDFromProductList(char * pchDLCProductID, ch
void CConsoleMinecraftApp::Checkout(char *pchSkuID)
{
if(m_eCommerce_State==eCommerce_State_Online)
{
{
strcpy(m_pchSkuID,pchSkuID);
m_eCommerce_State=eCommerce_State_Checkout;
}
@@ -698,7 +698,7 @@ void CConsoleMinecraftApp::Checkout(char *pchSkuID)
void CConsoleMinecraftApp::DownloadAlreadyPurchased(char *pchSkuID)
{
if(m_eCommerce_State==eCommerce_State_Online)
{
{
strcpy(m_pchSkuID,pchSkuID);
m_eCommerce_State=eCommerce_State_DownloadAlreadyPurchased;
}
@@ -707,7 +707,7 @@ void CConsoleMinecraftApp::DownloadAlreadyPurchased(char *pchSkuID)
bool CConsoleMinecraftApp::UpgradeTrial()
{
if(m_eCommerce_State==eCommerce_State_Online)
{
{
m_eCommerce_State=eCommerce_State_UpgradeTrial;
return true;
}
@@ -749,12 +749,12 @@ bool CConsoleMinecraftApp::DLCAlreadyPurchased(char *pchTitle)
// {
// std::vector<SonyCommerce::ProductInfo>* pProductList=&m_ProductListA[i];
// AUTO_VAR(itEnd, pProductList->end());
//
//
// for (AUTO_VAR(it, pProductList->begin()); it != itEnd; it++)
// {
// SonyCommerce::ProductInfo Info=*it;
// if(strcmp(pchTitle,Info.skuId)==0)
// {
// {
// ORBIS_STUBBED;
// SCE_NP_COMMERCE2_SKU_PURCHASABILITY_FLAG_OFF
// // if(Info.purchasabilityFlag==SCE_NP_COMMERCE2_SKU_PURCHASABILITY_FLAG_OFF)
@@ -766,7 +766,7 @@ bool CConsoleMinecraftApp::DLCAlreadyPurchased(char *pchTitle)
// // return false;
// // }
// }
// }
// }
// }
// }
#endif // #ifdef ORBIS_COMMERCE_ENABLED
@@ -804,7 +804,7 @@ void CConsoleMinecraftApp::CommerceGetCategoriesCallback(LPVOID lpParam,int err)
if(err==0)
{
pClass->m_ProductListCategoriesC=pClass->m_CategoryInfo.countOfSubCategories;
// allocate the memory for the product info for each categories
// allocate the memory for the product info for each categories
if(pClass->m_CategoryInfo.countOfSubCategories>0)
{
pClass->m_ProductListA = (std::vector<SonyCommerce::ProductInfo> *) new std::vector<SonyCommerce::ProductInfo> [pClass->m_CategoryInfo.countOfSubCategories];
@@ -838,7 +838,7 @@ void CConsoleMinecraftApp::CommerceGetProductListCallback(LPVOID lpParam,int err
{
// we're done, so now retrieve the additional product details for each product
pClass->m_eCommerce_State=eCommerce_State_AddProductInfoDetailed;
pClass->m_bCommerceProductListRetrieved=true;
pClass->m_bCommerceProductListRetrieved=true;
}
else
{
@@ -848,21 +848,21 @@ void CConsoleMinecraftApp::CommerceGetProductListCallback(LPVOID lpParam,int err
else
{
pClass->m_eCommerce_State=eCommerce_State_Error;
pClass->m_bCommerceProductListRetrieved=true;
pClass->m_bCommerceProductListRetrieved=true;
}
}
// void CConsoleMinecraftApp::CommerceGetDetailedProductInfoCallback(LPVOID lpParam,int err)
// {
// CConsoleMinecraftApp *pScene=(CConsoleMinecraftApp *)lpParam;
//
//
// if(err==0)
// {
// pScene->m_eCommerce_State=eCommerce_State_Idle;
// //pScene->m_bCommerceProductListRetrieved=true;
// //pScene->m_bCommerceProductListRetrieved=true;
// }
// //printf("Callback hit, error 0x%08x\n", err);
//
//
// }
void CConsoleMinecraftApp::CommerceAddDetailedProductInfoCallback(LPVOID lpParam,int err)
@@ -882,7 +882,7 @@ void CConsoleMinecraftApp::CommerceAddDetailedProductInfoCallback(LPVOID lpParam
{
// MGH - change this to a while loop so we can skip empty categories.
do
{
{
pClass->m_iCurrentCategory++;
}while(pClass->m_ProductListA[pClass->m_iCurrentCategory].size() == 0 && pClass->m_iCurrentCategory<pClass->m_ProductListCategoriesC);
@@ -891,12 +891,12 @@ void CConsoleMinecraftApp::CommerceAddDetailedProductInfoCallback(LPVOID lpParam
{
// there are no more categories, so we're done
pClass->m_eCommerce_State=eCommerce_State_RegisterDLC;
pClass->m_bProductListAdditionalDetailsRetrieved=true;
pClass->m_bProductListAdditionalDetailsRetrieved=true;
}
else
{
// continue with the next category
pClass->m_eCommerce_State=eCommerce_State_AddProductInfoDetailed;
pClass->m_eCommerce_State=eCommerce_State_AddProductInfoDetailed;
}
}
else
@@ -908,7 +908,7 @@ void CConsoleMinecraftApp::CommerceAddDetailedProductInfoCallback(LPVOID lpParam
else
{
pClass->m_eCommerce_State=eCommerce_State_Error;
pClass->m_bProductListAdditionalDetailsRetrieved=true;
pClass->m_bProductListAdditionalDetailsRetrieved=true;
pClass->m_iCurrentProduct=0;
pClass->m_iCurrentCategory=0;
}
@@ -1062,9 +1062,9 @@ void CConsoleMinecraftApp::SystemServiceTick()
for (int i = 0; i < status.eventNum; i++)
{
ret = sceSystemServiceReceiveEvent(&event);
if (ret == SCE_OK)
if (ret == SCE_OK)
{
switch(event.eventType)
switch(event.eventType)
{
case SCE_SYSTEM_SERVICE_EVENT_GAME_CUSTOM_DATA:
{
@@ -1072,7 +1072,7 @@ void CConsoleMinecraftApp::SystemServiceTick()
// Processing after invitation
//SceNpSessionInvitationEventParam* pInvite = (SceNpSessionInvitationEventParam*)event.data.param;
//SQRNetworkManager_Orbis::GetInviteDataAndProcess(pInvite);
break;
break;
}
case SCE_SYSTEM_SERVICE_EVENT_ON_RESUME:
// Resume means that the user signed out (but came back), sensible thing to do is exit to main menu
@@ -1217,7 +1217,7 @@ bool CConsoleMinecraftApp::CheckForEmptyStore(int iPad)
bool bEmptyStore=true;
if(pCategories!=NULL)
{
{
if(pCategories->countOfProducts>0)
{
bEmptyStore=false;
@@ -1247,7 +1247,7 @@ bool CConsoleMinecraftApp::CheckForEmptyStore(int iPad)
void CConsoleMinecraftApp::ShowPatchAvailableError()
{
int32_t ret=sceErrorDialogInitialize();
if ( ret==SCE_OK )
if ( ret==SCE_OK )
{
m_bPatchAvailableDialogRunning = true;
@@ -1256,7 +1256,7 @@ void CConsoleMinecraftApp::ShowPatchAvailableError()
// 4J-PB - We want to display the option to get the patch now
param.errorCode = SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED;
ret = sceUserServiceGetInitialUser( &param.userId );
if ( ret == SCE_OK )
if ( ret == SCE_OK )
{
ret=sceErrorDialogOpen( &param );
}
@@ -1266,9 +1266,9 @@ void CConsoleMinecraftApp::ShowPatchAvailableError()
void CConsoleMinecraftApp::PatchAvailableDialogTick()
{
if(m_bPatchAvailableDialogRunning)
{
{
SceErrorDialogStatus stat = sceErrorDialogUpdateStatus();
if( stat == SCE_ERROR_DIALOG_STATUS_FINISHED )
if( stat == SCE_ERROR_DIALOG_STATUS_FINISHED )
{
sceErrorDialogTerminate();

View File

@@ -38,7 +38,7 @@ int user_malloc_init(void)
int res;
void *addr;
uint64_t dmemSize = SCE_KERNEL_MAIN_DMEM_SIZE;
s_heapLength = ((size_t)4608) * 1024 * 1024; // Initial allocation for the application
s_heapLength -= ((size_t)4) * 1024 * 1024; // Allocated for TLS
s_heapLength -= ((size_t)2) * 1024 * 1024; // 64K (sometimes?) allocated for razor - rounding up to 2MB here to match our alignment
@@ -106,10 +106,10 @@ void *user_malloc(size_t size)
{
#if 0
static int throttle = 0;
static __int64 lasttime = 0;
static int64_t lasttime = 0;
if( ( throttle % 100 ) == 0 )
{
__int64 nowtime = System::currentTimeMillis();
int64_t nowtime = System::currentTimeMillis();
if( ( nowtime - lasttime ) > 20000 )
{
lasttime = nowtime;