feat: TU19 (Dec 2014) Features & Content (#155)

* try to resolve merge conflict

* feat: TU19 (Dec 2014) Features & Content (#32)

* December 2014 files

* Working release build

* Fix compilation issues

* Add sound to Windows64Media

* Add DLC content and force Tutorial DLC

* Revert "Add DLC content and force Tutorial DLC"

This reverts commit 97a4399472.

* Disable broken light packing

* Disable breakpoint during DLC texture map load

Allows DLC loading but the DLC textures are still broken

* Fix post build not working

* ...

* fix vs2022 build

* fix cmake build

---------

Co-authored-by: Loki <lokirautio@gmail.com>
This commit is contained in:
daoge
2026-03-03 03:04:10 +08:00
committed by GitHub
parent 84c31a2331
commit b3feddfef3
2069 changed files with 264842 additions and 139522 deletions

View File

@@ -102,7 +102,16 @@ void PSVitaNPToolkit::coreCallback( const sce::Toolkit::NP::Event& event )
break;
case sce::Toolkit::NP::Event::loggedIn: ///< An event from the NetCtl service generated when a connection to the PSN has been established.
app.DebugPrintf("Received core callback: PSN sign in \n");
ProfileManager.SetNetworkStatus(true, true);
SceNetCtlInfo info;
sceNetCtlInetGetInfo(SCE_NET_CTL_INFO_DEVICE, &info);
if(info.device == SCE_NET_CTL_DEVICE_PHONE) // 3G connection, we're not going to allow this
{
ProfileManager.SetNetworkStatus(false, true);
}
else
{
ProfileManager.SetNetworkStatus(true, true);
}
break;
case sce::Toolkit::NP::Event::loggedOut: ///< An event from the NetCtl service generated when a connection to the PSN has been lost.
app.DebugPrintf("Received core callback: PSN sign out \n");
@@ -350,7 +359,17 @@ static void npStateCallback(SceNpServiceState state, int retCode, void *userdata
ProfileManager.SetNetworkStatus(false, true);
break;
case SCE_NP_SERVICE_STATE_ONLINE:
ProfileManager.SetNetworkStatus(true, true);
SceNetCtlInfo info;
sceNetCtlInetGetInfo(SCE_NET_CTL_INFO_DEVICE, &info);
if(info.device == SCE_NET_CTL_DEVICE_PHONE) // 3G connection, we're not going to allow this
{
app.DebugPrintf("Online with 3G connection!!\n");
ProfileManager.SetNetworkStatus(false, true);
}
else
{
ProfileManager.SetNetworkStatus(true, true);
}
break;
default:
break;

View File

@@ -31,6 +31,7 @@ class HelloSyncInfo
public:
SQRNetworkManager::PresenceSyncInfo m_presenceSyncInfo;
GameSessionData m_gameSessionData;
SQRNetworkManager::RoomSyncData m_roomSyncData;
};
@@ -64,6 +65,7 @@ bool SQRNetworkManager_AdHoc_Vita::b_inviteRecvGUIRunning = false;
//unsigned int SQRNetworkManager_AdHoc_Vita::RoomSyncData::playerCount = 0;
SQRNetworkManager_AdHoc_Vita* s_pAdhocVitaManager;// have to use a static var for this as the callback function doesn't take an arg
static bool s_attemptSignInAdhoc = true; // false if we're trying to sign in to the PSN while in adhoc mode, so we can ignore the error if it fails
// This maps internal to extern states, and needs to match element-by-element the eSQRNetworkManagerInternalState enumerated type
const SQRNetworkManager_AdHoc_Vita::eSQRNetworkManagerState SQRNetworkManager_AdHoc_Vita::m_INTtoEXTStateMappings[SQRNetworkManager_AdHoc_Vita::SNM_INT_STATE_COUNT] =
@@ -134,6 +136,7 @@ SQRNetworkManager_AdHoc_Vita::SQRNetworkManager_AdHoc_Vita(ISQRNetworkManagerLis
InitializeCriticalSection(&m_csRoomSyncData);
InitializeCriticalSection(&m_csPlayerState);
InitializeCriticalSection(&m_csStateChangeQueue);
InitializeCriticalSection(&m_csAckQueue);
memset( &m_roomSyncData,0,sizeof(m_roomSyncData)); // MGH - added to fix problem when joining a full room, and the sync data wasn't populated
@@ -482,6 +485,7 @@ void SQRNetworkManager_AdHoc_Vita::InitialiseAfterOnline()
// General tick function to be called from main game loop - any internal tick functions should be called from here.
void SQRNetworkManager_AdHoc_Vita::Tick()
{
TickWriteAcks();
OnlineCheck();
int ret;
if((ret = sceNetCtlCheckCallback()) < 0 )
@@ -494,6 +498,17 @@ void SQRNetworkManager_AdHoc_Vita::Tick()
TickRichPresence();
// TickInviteGUI(); // TODO
// to fix the crash when spamming the x button on signing in to PSN, don't bring up all the disconnect stuff till the pause menu disappears
if(!ui.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad()))
{
if(!m_offlineGame && m_bLinkDisconnected)
{
m_bLinkDisconnected = false;
m_listener->HandleDisconnect(false);
}
}
// if( ( m_gameBootInvite m) && ( s_safeToRespondToGameBootInvite ) )
// {
// m_listener->HandleInviteReceived( ProfileManager.GetPrimaryPad(), m_gameBootInvite );
@@ -678,6 +693,7 @@ void SQRNetworkManager_AdHoc_Vita::UpdateExternalRoomData()
CPlatformNetworkManagerSony::SetSQRPresenceInfoFromExtData( &presenceInfo.m_presenceSyncInfo, m_joinExtData, m_room, m_serverId );
assert(m_joinExtDataSize == sizeof(GameSessionData));
memcpy(&presenceInfo.m_gameSessionData, m_joinExtData, sizeof(GameSessionData));
memcpy(&presenceInfo.m_roomSyncData, &m_roomSyncData, sizeof(RoomSyncData));
SQRNetworkManager_AdHoc_Vita::UpdateRichPresenceCustomData(&presenceInfo, sizeof(HelloSyncInfo) );
// OrbisNPToolkit::createNPSession();
}
@@ -1086,6 +1102,7 @@ void SQRNetworkManager_AdHoc_Vita::ResetToIdle()
}
memset( m_aRoomSlotPlayers, 0, sizeof(m_aRoomSlotPlayers) );
memset( &m_roomSyncData,0,sizeof(m_roomSyncData));
m_hostMemberId = 0;
LeaveCriticalSection(&m_csRoomSyncData);
SetState(SNM_INT_STATE_IDLE);
if(sc_voiceChatEnabled)
@@ -1147,6 +1164,8 @@ bool SQRNetworkManager_AdHoc_Vita::JoinRoom(SceNetInAddr netAddr, int localPlaye
int err = sceNetAdhocMatchingSelectTarget(m_matchingContext, &netAddr, 0, NULL);
m_hostMemberId = getRoomMemberID(&netAddr);
m_hostIPAddr = netAddr;
assert(err == SCE_OK);
return (err == SCE_OK); //GetServerContext( serverId );
@@ -1187,6 +1206,16 @@ void SQRNetworkManager_AdHoc_Vita::LeaveRoom(bool bActuallyLeaveRoom)
// SceNpMatching2LeaveRoomRequest reqParam;
// memset( &reqParam, 0, sizeof(reqParam) );
// reqParam.roomId = m_room;
if(!m_isHosting)
{
int ret = sceNetAdhocMatchingCancelTarget(m_matchingContext, &m_hostIPAddr);
if (ret < 0)
{
app.DebugPrintf("sceNetAdhocMatchingCancelTarget error :[%d] [%x]\n",ret,ret) ;
assert(0);
}
}
SetState(SNM_INT_STATE_LEAVING);
@@ -1774,6 +1803,7 @@ void SQRNetworkManager_AdHoc_Vita::MatchingEventHandler(int id, int event, SceNe
CPlatformNetworkManagerSony::MallocAndSetExtDataFromSQRPresenceInfo(&result.m_RoomExtDataReceived, &pso->m_presenceSyncInfo);
result.m_gameSessionData = malloc(sizeof(GameSessionData));
memcpy(result.m_gameSessionData, &pso->m_gameSessionData, sizeof(GameSessionData));
memcpy(&result.m_roomSyncData, &pso->m_roomSyncData, sizeof(RoomSyncData));
// check we don't have this already
int currIndex = -1;
bool bChanged = false;
@@ -1786,6 +1816,8 @@ void SQRNetworkManager_AdHoc_Vita::MatchingEventHandler(int id, int event, SceNe
bChanged = true;
if(memcmp(&result.m_roomSyncData, &manager->m_aFriendSearchResults[i].m_roomSyncData, sizeof(RoomSyncData)) != 0)
bChanged = true;
if(memcmp(&result.m_roomSyncData, &manager->m_aFriendSearchResults[i].m_roomSyncData, sizeof(RoomSyncData)) != 0)
bChanged = true;
break;
}
}
@@ -1793,6 +1825,7 @@ void SQRNetworkManager_AdHoc_Vita::MatchingEventHandler(int id, int event, SceNe
manager->m_aFriendSearchResults.erase(manager->m_aFriendSearchResults.begin() + currIndex);
if(currIndex<0 || bChanged)
manager->m_aFriendSearchResults.push_back(result);
app.DebugPrintf("m_aFriendSearchResults playerCount : %d\n", result.m_roomSyncData.players[0].m_playerCount);
}
}
else
@@ -1891,13 +1924,16 @@ void SQRNetworkManager_AdHoc_Vita::MatchingEventHandler(int id, int event, SceNe
break;
case SCE_NET_ADHOC_MATCHING_EVENT_LEAVE: // The participation agreement was canceled by the target player
case SCE_NET_ADHOC_MATCHING_EVENT_DENY:
case SCE_NET_ADHOC_MATCHING_EVENT_LEAVE: // The participation agreement was canceled by the target player
case SCE_NET_ADHOC_MATCHING_EVENT_CANCEL: // The join request was canceled by the client
case SCE_NET_ADHOC_MATCHING_EVENT_ERROR: // A protocol error occurred
case SCE_NET_ADHOC_MATCHING_EVENT_TIMEOUT: // The participation agreement was canceled because of a Keep Alive timeout
case SCE_NET_ADHOC_MATCHING_EVENT_DATA_TIMEOUT:
app.SetDisconnectReason(DisconnectPacket::eDisconnect_TimeOut);
if(event == SCE_NET_ADHOC_MATCHING_EVENT_DENY)
app.SetDisconnectReason(DisconnectPacket::eDisconnect_ServerFull);
else
app.SetDisconnectReason(DisconnectPacket::eDisconnect_TimeOut);
ret = sceNetAdhocMatchingCancelTarget(manager->m_matchingContext, peer);
if ( ret < 0 )
{
@@ -1910,7 +1946,12 @@ void SQRNetworkManager_AdHoc_Vita::MatchingEventHandler(int id, int event, SceNe
{
app.DebugPrintf("P2P SCE_NET_ADHOC_MATCHING_EVENT_BYE Received!!\n");
if(event == SCE_NET_ADHOC_MATCHING_EVENT_BYE && ! manager->IsInSession()) //
{
// the BYE event comes through like the HELLO event, so even even if we're not connected
// so make sure we're actually in session
break;
}
SceNpMatching2RoomMemberId peerMemberId = getRoomMemberID(peer);
if( manager->m_isHosting )
{
@@ -2510,7 +2551,10 @@ void SQRNetworkManager_AdHoc_Vita::updateNetCheckDialog()
// SCE_COMMON_DIALOG_RESULT_ABORTED
// Failed, or user may have decided not to sign in - maybe need to differentiate here
SetState(SNM_INT_STATE_INITIALISE_FAILED);
if(s_attemptSignInAdhoc) // don't fail if it was an attempted PSN signin
{
SetState(SNM_INT_STATE_INITIALISE_FAILED);
}
if( s_SignInCompleteCallbackFn )
{
if( s_signInCompleteCallbackIfFailed )
@@ -2606,14 +2650,8 @@ void SQRNetworkManager_AdHoc_Vita::RudpContextCallback(int ctx_id, int event_id,
}
else
{
unsigned int dataSize = sceRudpGetSizeReadable(ctx_id);
unsigned char* buffer = (unsigned char*)malloc(dataSize);
unsigned int bytesRead = sceRudpRead( ctx_id, buffer, dataSize, 0, NULL );
assert(bytesRead == dataSize);
unsigned char* bufferPos = buffer;
unsigned int dataLeft = dataSize;
SQRNetworkPlayer *playerIncomingData = manager->GetPlayerFromRudpCtx( ctx_id );
unsigned int dataSize = playerIncomingData->GetPacketDataSize();
// If we're the host, and this player hasn't yet had its small id confirmed, then the first byte sent to us should be this id
if( manager->m_isHosting )
{
@@ -2623,10 +2661,16 @@ void SQRNetworkManager_AdHoc_Vita::RudpContextCallback(int ctx_id, int event_id,
if( dataSize >= sizeof(SQRNetworkPlayer::InitSendData) )
{
SQRNetworkPlayer::InitSendData ISD;
memcpy(&ISD, bufferPos, sizeof(SQRNetworkPlayer::InitSendData));
manager->NetworkPlayerInitialDataReceived(playerFrom, &ISD);
dataLeft -= sizeof(SQRNetworkPlayer::InitSendData);
bufferPos += sizeof(SQRNetworkPlayer::InitSendData);
int bytesRead = playerFrom->ReadDataPacket( &ISD, sizeof(SQRNetworkPlayer::InitSendData));
if( bytesRead == sizeof(SQRNetworkPlayer::InitSendData) )
{
manager->NetworkPlayerInitialDataReceived(playerFrom, &ISD);
dataSize -= sizeof(SQRNetworkPlayer::InitSendData);
}
else
{
assert(false);
}
}
else
{
@@ -2635,28 +2679,32 @@ void SQRNetworkManager_AdHoc_Vita::RudpContextCallback(int ctx_id, int event_id,
}
}
if( dataLeft > 0 )
if( dataSize > 0 )
{
SQRNetworkPlayer *playerFrom, *playerTo;
if( manager->m_isHosting )
unsigned char *data = new unsigned char [ dataSize ];
int bytesRead = playerIncomingData->ReadDataPacket( data, dataSize );
if( bytesRead > 0 )
{
// Data always going from a remote player, to the host
playerFrom = manager->GetPlayerFromRudpCtx( ctx_id );
playerTo = manager->m_aRoomSlotPlayers[0];
}
else
{
// Data always going from host player, to a local player
playerFrom = manager->m_aRoomSlotPlayers[0];
playerTo = manager->GetPlayerFromRudpCtx( ctx_id );
}
if( ( playerFrom != NULL ) && ( playerTo != NULL ) )
{
manager->m_listener->HandleDataReceived( playerFrom, playerTo, bufferPos, dataLeft );
SQRNetworkPlayer *playerFrom, *playerTo;
if( manager->m_isHosting )
{
// Data always going from a remote player, to the host
playerFrom = manager->GetPlayerFromRudpCtx( ctx_id );
playerTo = manager->m_aRoomSlotPlayers[0];
}
else
{
// Data always going from host player, to a local player
playerFrom = manager->m_aRoomSlotPlayers[0];
playerTo = manager->GetPlayerFromRudpCtx( ctx_id );
}
if( ( playerFrom != NULL ) && ( playerTo != NULL ) )
{
manager->m_listener->HandleDataReceived( playerFrom, playerTo, data, bytesRead );
}
}
delete [] data;
}
delete buffer;
}
}
break;
@@ -2682,16 +2730,20 @@ void SQRNetworkManager_AdHoc_Vita::NetCtlCallback(int eventType, void *arg)
SQRNetworkManager_AdHoc_Vita *manager = (SQRNetworkManager_AdHoc_Vita *)arg;
// Oddly, the disconnect event comes in with a new state of "CELL_NET_CTL_STATE_Connecting"... looks like the event is more important than the state to
// determine what has just happened
if( eventType == SCE_NET_CTL_EVENT_TYPE_DISCONNECTED)// CELL_NET_CTL_EVENT_LINK_DISCONNECTED )
switch(eventType)
{
case SCE_NET_CTL_EVENT_TYPE_DISCONNECTED:
case SCE_NET_CTL_EVENT_TYPE_DISCONNECT_REQ_FINISHED:
manager->m_bLinkDisconnected = true;
manager->m_listener->HandleDisconnect(false);
}
else //if( event == CELL_NET_CTL_EVENT_ESTABLISH )
{
// manager->m_listener->HandleDisconnect(true, true);
break;
case SCE_NET_CTL_EVENT_TYPE_IPOBTAINED:
manager->m_bLinkDisconnected = false;
break;
default:
assert(0);
break;
}
}
// Called when the context has been created, and we are intending to create a room.
@@ -2877,16 +2929,18 @@ bool SQRNetworkManager_AdHoc_Vita::ForceErrorPoint(eSQRForceError err)
}
#endif
void SQRNetworkManager_AdHoc_Vita::AttemptPSNSignIn(int (*SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad), void *pParam, bool callIfFailed/*=false*/)
void SQRNetworkManager_AdHoc_Vita::AttemptAdhocSignIn(int (*SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad), void *pParam, bool callIfFailed/*=false*/)
{
s_SignInCompleteCallbackFn = SignInCompleteCallbackFn;
s_signInCompleteCallbackIfFailed = callIfFailed;
s_SignInCompleteParam = pParam;
app.DebugPrintf("s_SignInCompleteCallbackFn - 0x%08x : s_SignInCompleteParam - 0x%08x\n", (unsigned int)s_SignInCompleteCallbackFn, (unsigned int)s_SignInCompleteParam);
SceNetCheckDialogParam param;
memset(&param, 0x00, sizeof(param));
sceNetCheckDialogParamInit(&param);
s_attemptSignInAdhoc = true; // so we know which sign in we're trying to make in the netCheckUpdate
SceNetAdhocctlGroupName groupName;
memset(groupName.data, 0x00, SCE_NET_ADHOCCTL_GROUPNAME_LEN);
@@ -2915,6 +2969,82 @@ void SQRNetworkManager_AdHoc_Vita::AttemptPSNSignIn(int (*SignInCompleteCallback
}
}
void SQRNetworkManager_AdHoc_Vita::AttemptPSNSignIn(int (*SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad), void *pParam, bool callIfFailed/*=false*/)
{
s_SignInCompleteCallbackFn = SignInCompleteCallbackFn;
s_signInCompleteCallbackIfFailed = callIfFailed;
s_SignInCompleteParam = pParam;
app.DebugPrintf("s_SignInCompleteCallbackFn - 0x%08x : s_SignInCompleteParam - 0x%08x\n", (unsigned int)s_SignInCompleteCallbackFn, (unsigned int)s_SignInCompleteParam);
if(SQRNetworkManager_AdHoc_Vita::GetAdhocStatus())
{
// if the adhoc connection is running, kill it here
sceNetCtlAdhocDisconnect();
}
SceNetCheckDialogParam param;
memset(&param, 0x00, sizeof(param));
sceNetCheckDialogParamInit(&param);
param.mode = SCE_NETCHECK_DIALOG_MODE_PSN_ONLINE;
param.defaultAgeRestriction = ProfileManager.GetMinimumAge();
s_attemptSignInAdhoc = false; // so we know which sign in we're trying to make in the netCheckUpdate
// -------------------------------------------------------------
// MGH - this code is duplicated in the PSN network manager now too, so any changes will have to be made there too
// -------------------------------------------------------------
//CD - Only add if EU sku, not SCEA or SCEJ
if( app.GetProductSKU() == e_sku_SCEE )
{
//CD - Added Country age restrictions
SceNetCheckDialogAgeRestriction restrictions[5];
memset( restrictions, 0x0, sizeof(SceNetCheckDialogAgeRestriction) * 5 );
//Germany
restrictions[0].age = ProfileManager.GetGermanyMinimumAge();
memcpy( restrictions[0].countryCode, "de", 2 );
//Russia
restrictions[1].age = ProfileManager.GetRussiaMinimumAge();
memcpy( restrictions[1].countryCode, "ru", 2 );
//Australia
restrictions[2].age = ProfileManager.GetAustraliaMinimumAge();
memcpy( restrictions[2].countryCode, "au", 2 );
//Japan
restrictions[3].age = ProfileManager.GetJapanMinimumAge();
memcpy( restrictions[3].countryCode, "jp", 2 );
//Korea
restrictions[4].age = ProfileManager.GetKoreaMinimumAge();
memcpy( restrictions[4].countryCode, "kr", 2 );
//Set
param.ageRestriction = restrictions;
param.ageRestrictionCount = 5;
}
memcpy(&param.npCommunicationId.data, &s_npCommunicationId, sizeof(s_npCommunicationId));
param.npCommunicationId.term = '\0';
param.npCommunicationId.num = 0;
int ret = sceNetCheckDialogInit(&param);
ProfileManager.SetSysUIShowing( true );
app.DebugPrintf("------------>>>>>>>> sceNetCheckDialogInit : PSN Mode\n");
if( ret < 0 )
{
if(s_SignInCompleteCallbackFn) // MGH - added after crash on PS4
{
if( s_signInCompleteCallbackIfFailed )
{
s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0);
}
s_SignInCompleteCallbackFn = NULL;
}
}
}
int SQRNetworkManager_AdHoc_Vita::SetRichPresence(const void *data)
{
const sce::Toolkit::NP::PresenceDetails *newPresenceInfo = (const sce::Toolkit::NP::PresenceDetails *)data;
@@ -3010,6 +3140,7 @@ void SQRNetworkManager_AdHoc_Vita::SetPresenceDataStartHostingGame()
CPlatformNetworkManagerSony::SetSQRPresenceInfoFromExtData( &presenceInfo.m_presenceSyncInfo, m_joinExtData, m_room, m_serverId );
assert(m_joinExtDataSize == sizeof(GameSessionData));
memcpy(&presenceInfo.m_gameSessionData, m_joinExtData, sizeof(GameSessionData));
memcpy(&presenceInfo.m_roomSyncData, &m_roomSyncData, sizeof(RoomSyncData));
SQRNetworkManager_AdHoc_Vita::UpdateRichPresenceCustomData(&presenceInfo, sizeof(HelloSyncInfo) );
// OrbisNPToolkit::createNPSession();
}
@@ -3116,4 +3247,5 @@ void SQRNetworkManager_AdHoc_Vita::UpdateLocalIPAddress()
{
m_localIPAddr = localIPAddr;
}
}
}

View File

@@ -104,7 +104,6 @@ public:
static void GetInviteDataAndProcess(sce::Toolkit::NP::MessageAttachment* pInvite);
static bool GetAdhocStatus() { return m_adhocStatus; }
int sendDataPacket(SceNetInAddr addr, EAdhocDataTag tag, void* data, int dataSize);
int sendDataPacket(SceNetInAddr addr, void* data, int dataSize);
@@ -125,6 +124,7 @@ private:
bool m_nextIdleReasonIsFull;
bool m_isHosting;
SceNetInAddr m_localIPAddr;
SceNetInAddr m_hostIPAddr;
SceNpMatching2RoomMemberId m_localMemberId;
SceNpMatching2RoomMemberId m_hostMemberId; // if we're not the host
int m_localPlayerCount;
@@ -316,6 +316,7 @@ private:
public:
static void AttemptPSNSignIn(int (*SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad), void *pParam, bool callIfFailed = false);
static void AttemptAdhocSignIn(int (*SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad), void *pParam, bool callIfFailed = false);
static int (*s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad);
static bool s_signInCompleteCallbackIfFailed;
static void *s_SignInCompleteParam;

View File

@@ -108,6 +108,7 @@ SQRNetworkManager_Vita::SQRNetworkManager_Vita(ISQRNetworkManagerListener *liste
InitializeCriticalSection(&m_csPlayerState);
InitializeCriticalSection(&m_csStateChangeQueue);
InitializeCriticalSection(&m_csMatching);
InitializeCriticalSection(&m_csAckQueue);
memset( &m_roomSyncData,0,sizeof(m_roomSyncData)); // MGH - added to fix problem when joining a full room, and the sync data wasn't populated
@@ -277,6 +278,10 @@ void SQRNetworkManager_Vita::Terminate()
// into SNM_INT_STATE_IDLE at this stage.
void SQRNetworkManager_Vita::InitialiseAfterOnline()
{
// MGH - added, so we don't init the matching2 stuff in trial mode - devtrack #5921
if(!ProfileManager.IsFullVersion())
return;
// SceNpId npId;
// int option = 0;
@@ -358,6 +363,7 @@ void SQRNetworkManager_Vita::InitialiseAfterOnline()
// General tick function to be called from main game loop - any internal tick functions should be called from here.
void SQRNetworkManager_Vita::Tick()
{
TickWriteAcks();
OnlineCheck();
sceNetCtlCheckCallback();
updateNetCheckDialog();
@@ -1527,7 +1533,7 @@ void SQRNetworkManager_Vita::TickJoinablePresenceData()
// Not signed in to PSN
UINT uiIDA[1];
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &MustSignInReturnedPresenceInvite, NULL, app.GetStringTable(), NULL, 0, false);
ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &MustSignInReturnedPresenceInvite, NULL);
}
}
@@ -2105,6 +2111,16 @@ bool SQRNetworkManager_Vita::GetServerContext2()
// using mainly the same code by making a single element list. This is used when joining an existing room.
bool SQRNetworkManager_Vita::GetServerContext(SceNpMatching2ServerId serverId)
{
if(m_state == SNM_INT_STATE_STARTING_CONTEXT)
{
// MGH - added for devtrack 5936 : race between the context starting after going online, and trying to start it here, so skip this one if we're already starting.
m_serverCount = 1;
m_totalServerCount = m_serverCount;
m_aServerId = (SceNpMatching2ServerId *)realloc(m_aServerId, sizeof(SceNpMatching2ServerId) * m_serverCount );
m_aServerId[0] = serverId;
SetState(SNM_INT_STATE_JOINING_STARTING_MATCHING_CONTEXT);
return true;
}
assert(m_state == SNM_INT_STATE_IDLE);
assert(m_serverContextValid == false);
@@ -2895,7 +2911,9 @@ void SQRNetworkManager_Vita::DefaultRequestCallback(SceNpMatching2ContextId id,
manager->SetState(SNM_INT_STATE_JOINING_JOIN_ROOM_FAILED);
if(errorCode == SCE_NP_MATCHING2_SERVER_ERROR_ROOM_FULL) // MGH - added to fix "host has exited" error when 2 players go after the final slot
{
app.DebugPrintf("setting DisconnectPacket::eDisconnect_ServerFull\n");
Minecraft::GetInstance()->connectionDisconnected(ProfileManager.GetPrimaryPad(), DisconnectPacket::eDisconnect_ServerFull);
app.SetDisconnectReason(DisconnectPacket::eDisconnect_ServerFull); // MGH - added to fix when joining from an invite
}
break;
// This is the response to sceNpMatching2GetRoomMemberDataInternal.This only happens on the host, as a response to an incoming connection being established, when we
@@ -3339,6 +3357,17 @@ int SQRNetworkManager_Vita::BasicEventCallback(int event, int retCode, uint32_t
// Implementation of SceNpManagerCallback
void SQRNetworkManager_Vita::OnlineCheck()
{
static bool s_bFullVersion = ProfileManager.IsFullVersion();
if(s_bFullVersion != ProfileManager.IsFullVersion())
{
s_bFullVersion = ProfileManager.IsFullVersion();
// we've switched from trial to full version here, if we're already online, call InitialiseAfterOnline, as this is now returns immediately in trial mode (devtrack #5921)
if(GetOnlineStatus() == true)
{
InitialiseAfterOnline();
}
}
bool bSignedIn = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad());
if(GetOnlineStatus() == false)
{
@@ -3423,9 +3452,22 @@ void SQRNetworkManager_Vita::updateNetCheckDialog()
ret = sceNetCheckDialogTerm();
app.DebugPrintf("NetCheckDialogTerm ret = 0x%x\n", ret);
ProfileManager.SetSysUIShowing( false );
bool bConnectedOK = (netCheckResult.result == SCE_COMMON_DIALOG_RESULT_OK);
if(bConnectedOK)
{
SceNetCtlInfo info;
sceNetCtlInetGetInfo(SCE_NET_CTL_INFO_DEVICE, &info);
if(info.device == SCE_NET_CTL_DEVICE_PHONE) // 3G connection, we're not going to allow this
{
app.DebugPrintf("Online with 3G connection!!\n");
ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_WIFI_REQUIRED_OPERATION, 0 );
bConnectedOK = false;
}
}
app.DebugPrintf("------------>>>>>>>> sceNetCheckDialog finished\n");
if( netCheckResult.result == SCE_COMMON_DIALOG_RESULT_OK )
if( bConnectedOK )
{
if( s_SignInCompleteCallbackFn )
{
@@ -3521,7 +3563,8 @@ void SQRNetworkManager_Vita::RudpContextCallback(int ctx_id, int event_id, int e
}
else
{
unsigned int dataSize = sceRudpGetSizeReadable(ctx_id);
SQRNetworkPlayer *playerIncomingData = manager->GetPlayerFromRudpCtx( ctx_id );
unsigned int dataSize = playerIncomingData->GetPacketDataSize();
// If we're the host, and this player hasn't yet had its small id confirmed, then the first byte sent to us should be this id
if( manager->m_isHosting )
{
@@ -3531,7 +3574,7 @@ void SQRNetworkManager_Vita::RudpContextCallback(int ctx_id, int event_id, int e
if( dataSize >= sizeof(SQRNetworkPlayer::InitSendData) )
{
SQRNetworkPlayer::InitSendData ISD;
unsigned int bytesRead = sceRudpRead( ctx_id, &ISD, sizeof(SQRNetworkPlayer::InitSendData), 0, NULL );
int bytesRead = playerFrom->ReadDataPacket( &ISD, sizeof(SQRNetworkPlayer::InitSendData));
if( bytesRead == sizeof(SQRNetworkPlayer::InitSendData) )
{
manager->NetworkPlayerInitialDataReceived(playerFrom, &ISD);
@@ -3552,7 +3595,7 @@ void SQRNetworkManager_Vita::RudpContextCallback(int ctx_id, int event_id, int e
if( dataSize > 0 )
{
unsigned char *data = new unsigned char [ dataSize ];
unsigned int bytesRead = sceRudpRead( ctx_id, data, dataSize, 0, NULL );
int bytesRead = playerIncomingData->ReadDataPacket( data, dataSize );
if( bytesRead > 0 )
{
SQRNetworkPlayer *playerFrom, *playerTo;
@@ -3868,6 +3911,9 @@ void SQRNetworkManager_Vita::AttemptPSNSignIn(int (*SignInCompleteCallbackFn)(vo
param.mode = SCE_NETCHECK_DIALOG_MODE_PSN_ONLINE;
param.defaultAgeRestriction = ProfileManager.GetMinimumAge();
// -------------------------------------------------------------
// MGH - this code is duplicated in the adhoc manager now too, so any changes will have to be made there too
// -------------------------------------------------------------
//CD - Only add if EU sku, not SCEA or SCEJ
if( app.GetProductSKU() == e_sku_SCEE )
{
@@ -3925,7 +3971,10 @@ int SQRNetworkManager_Vita::SetRichPresence(const void *data)
s_lastPresenceInfo.presenceType = SCE_NP_BASIC_IN_GAME_PRESENCE_TYPE_DEFAULT;
s_presenceStatusDirty = true;
SendLastPresenceInfo();
if(s_resendPresenceCountdown == 0)
{
s_resendPresenceCountdown = 5; // wait a few ticks before setting the rich presence value, so if there's a few being set at one time (like on game startup) we can send them all in a single call
}
// Return as if no error happened no matter what, as we'll be resending ourselves if we need to and don't want the calling system to retry
return 0;
@@ -3938,7 +3987,10 @@ void SQRNetworkManager_Vita::UpdateRichPresenceCustomData(void *data, unsigned i
s_lastPresenceInfo.size = dataBytes;
s_presenceStatusDirty = true;
SendLastPresenceInfo();
if(s_resendPresenceCountdown == 0)
{
s_resendPresenceCountdown = 5; // wait a few ticks before setting the rich presence value, so if there's a few being set at one time (like on game startup) we can send them all in a single call
}
}
void SQRNetworkManager_Vita::TickRichPresence()

View File

@@ -300,6 +300,7 @@ public:
int GetJoiningReadyPercentage();
static void SetPresenceFailedCallback();
GameSessionUID GetHostUID() { return s_lastPresenceSyncInfo.hostPlayerUID; }
bool IsOnlineGame() { return !m_offlineGame; }
private:
static void UpdateRichPresenceCustomData(void *data, unsigned int dataBytes);
static void TickRichPresence();

View File

@@ -54,6 +54,7 @@ sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::CategoryInfo> g_catego
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::ProductInfoDetailed> g_detailedProductInfo;
//sce::Toolkit::NP::Utilities::Future<SceAppUtilBgdlStatus> g_bgdlStatus;
static bool s_showingPSStoreIcon = false;
SonyCommerce_Vita::ProductInfoDetailed s_trialUpgradeProductInfoDetailed;
@@ -186,7 +187,10 @@ int SonyCommerce_Vita::TickLoop(void* lpParam)
if(m_iClearDLCCountdown == 0)
{
app.ClearDLCInstalled();
ui.HandleDLCInstalled(0);
if(g_NetworkManager.IsInSession()) // we're in-game, could be a purchase of a pack after joining an invite from another player
app.StartInstallDLCProcess(0);
else
ui.HandleDLCInstalled(0);
}
}
@@ -591,7 +595,7 @@ void SonyCommerce_Vita::UpgradeTrialCallback2(LPVOID lpParam,int err)
{
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_PRO_UNLOCKGAME_TITLE, IDS_NO_DLCOFFERS, uiIDA,1,ProfileManager.GetPrimaryPad());
C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_PRO_UNLOCKGAME_TITLE, IDS_NO_DLCOFFERS, uiIDA,1,ProfileManager.GetPrimaryPad());
}
m_trialUpgradeCallbackFunc(m_trialUpgradeCallbackParam, m_errorCode);
}
@@ -618,7 +622,7 @@ void SonyCommerce_Vita::UpgradeTrialCallback1(LPVOID lpParam,int err)
{
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_PRO_UNLOCKGAME_TITLE, IDS_NO_DLCOFFERS, uiIDA,1,ProfileManager.GetPrimaryPad());
C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_PRO_UNLOCKGAME_TITLE, IDS_NO_DLCOFFERS, uiIDA,1,ProfileManager.GetPrimaryPad());
m_trialUpgradeCallbackFunc(m_trialUpgradeCallbackParam, m_errorCode);
}
}
@@ -1459,6 +1463,27 @@ bool SonyCommerce_Vita::getDLCUpgradePending()
return false;
}
void SonyCommerce_Vita::ShowPsStoreIcon()
{
if(!s_showingPSStoreIcon)
{
sceNpCommerce2ShowPsStoreIcon(SCE_NP_COMMERCE2_ICON_DISP_RIGHT);
s_showingPSStoreIcon = true;
}
}
void SonyCommerce_Vita::HidePsStoreIcon()
{
if(s_showingPSStoreIcon)
{
sceNpCommerce2HidePsStoreIcon();
s_showingPSStoreIcon = false;
}
}
/*
bool g_bDoCommerceCreateSession = false;
bool g_bDoCommerceGetProductList = false;

View File

@@ -201,4 +201,7 @@ public:
static bool getPurchasabilityUpdated();
static bool getDLCUpgradePending();
virtual void ShowPsStoreIcon();
virtual void HidePsStoreIcon();
};

View File

@@ -116,7 +116,7 @@ void SonyRemoteStorage_Vita::internalCallback(const SceRemoteStorageEvent event,
app.DebugPrintf("Set data progress: %i%%\n", retCode);
m_status = e_setDataInProgress;
m_dataProgress = retCode;
m_startTime = System::currentTimeMillis();
break;
case USER_ACCOUNT_LINKED:
@@ -146,8 +146,12 @@ bool SonyRemoteStorage_Vita::init(CallbackFunc cb, LPVOID lpParam)
m_callbackFunc = cb;
m_callbackParam = lpParam;
m_bTransferStarted = false;
m_bAborting = false;
m_lastErrorCode = SCE_OK;
if(m_bInitialised)
{
internalCallback(USER_ACCOUNT_LINKED, 0);
@@ -293,6 +297,10 @@ bool SonyRemoteStorage_Vita::setDataInternal()
// CompressSaveData(); // check if we need to re-save the file compressed first
snprintf(m_saveFilename, sizeof(m_saveFilename), "%s:%s/GAMEDATA.bin", "savedata0", m_setDataSaveInfo->UTF8SaveFilename);
SceFiosSize outSize = sceFiosFileGetSizeSync(NULL, m_saveFilename);
m_uploadSaveSize = (int)outSize;
strcpy(m_saveFileDesc, m_setDataSaveInfo->UTF8SaveTitle);
m_status = e_setDataInProgress;
@@ -302,39 +310,7 @@ bool SonyRemoteStorage_Vita::setDataInternal()
strcpy(params.pathLocation, m_saveFilename);
sprintf(params.fileName, getRemoteSaveFilename());
DescriptionData descData;
ZeroMemory(&descData, sizeof(DescriptionData));
descData.m_platform[0] = SAVE_FILE_PLATFORM_LOCAL & 0xff;
descData.m_platform[1] = (SAVE_FILE_PLATFORM_LOCAL >> 8) & 0xff;
descData.m_platform[2] = (SAVE_FILE_PLATFORM_LOCAL >> 16) & 0xff;
descData.m_platform[3] = (SAVE_FILE_PLATFORM_LOCAL >> 24)& 0xff;
if(m_thumbnailData)
{
unsigned int uiHostOptions;
bool bHostOptionsRead;
DWORD uiTexturePack;
char seed[22];
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
__int64 iSeed = strtoll(seed,NULL,10);
char seedHex[17];
sprintf(seedHex,"%016llx",iSeed);
memcpy(descData.m_seed,seedHex,16); // Don't copy null
// Save the host options that this world was last played with
char hostOptions[9];
sprintf(hostOptions,"%08x",uiHostOptions);
memcpy(descData.m_hostOptions,hostOptions,8); // Don't copy null
// Save the texture pack id
char texturePack[9];
sprintf(texturePack,"%08x",uiTexturePack);
memcpy(descData.m_texturePack,texturePack,8); // Don't copy null
}
memcpy(descData.m_saveNameUTF8, m_saveFileDesc, strlen(m_saveFileDesc)+1); // plus null
memcpy(params.fileDescription, &descData, sizeof(descData));
GetDescriptionData(params.fileDescription);
if(m_bAborting)

View File

@@ -29,7 +29,6 @@ private:
int m_getDataProgress;
int m_setDataProgress;
char m_saveFilename[SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN];
char m_saveFileDesc[SCE_REMOTE_STORAGE_DATA_DESCRIPTION_MAX_LEN];
char m_remoteFilename[SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN];