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

@@ -7,6 +7,76 @@
using namespace sce::Toolkit::NP;
using namespace sce::Toolkit::NP::Utilities;
class CXuiStringTable;
// Note - there are now 3 types of PlayerUID
// (1) A full online ID - either the primary login, or a sub-signin through to PSN. This has m_onlineID set up as a normal SceNpOnlineId, with dummy[0] set to 0
// (2) An offline ID, where there is also a primary login on the system. This has m_onlineID set up to copy the primary SceNpOnlineId, except with dummy[0] set to the controller ID of this other player
// (3) An offline ID, where there isn't a primary PSN login on the system. This has SceNpOnlineId fully zeroed.
class PlayerUID
{
char m_onlineID[SCE_NP_ONLINEID_MAX_LENGTH];
char term;
bool m_bSignedIntoPSN : 1;
unsigned char m_quadrant : 2;
uint8_t m_macAddress[SCE_NET_ETHER_ADDR_LEN];
int m_userID; // user logged on to the XMB
public:
class Hash
{
public:
std::size_t operator()(const PlayerUID& k) const;
};
PlayerUID();
PlayerUID(int userID, SceNpOnlineId& onlineID, bool bSignedInPSN, int quadrant);
PlayerUID(std::wstring fromString);
bool operator==(const PlayerUID& rhs) const;
bool operator!=(const PlayerUID& rhs);
void setCurrentMacAddress();
std::wstring macAddressStr() const;
std::wstring userIDStr() const;
std::wstring toString() const;
void setOnlineID(SceNpOnlineId& id, bool bSignedIntoPSN);
void setUserID(unsigned int id);
const char* getOnlineID() const { return m_onlineID; }
int getUserID() const { return m_userID; }
int getQuadrant() const { return m_quadrant; }
bool isPrimaryUser() const; // only true if we're on the local machine and signed into the first quadrant;
bool isSignedIntoPSN() const { return m_bSignedIntoPSN; }
void setForAdhoc();
private:
};
typedef PlayerUID *PPlayerUID;
class GameSessionUID
{
char m_onlineID[SCE_NP_ONLINEID_MAX_LENGTH];
char term;
bool m_bSignedIntoPSN : 1;
unsigned char m_quadrant : 2;
public:
GameSessionUID();
GameSessionUID(int nullVal);
bool operator==(const GameSessionUID& rhs) const;
bool operator!=(const GameSessionUID& rhs);
GameSessionUID& operator=(const PlayerUID& rhs);
const char* getOnlineID() const { return m_onlineID; }
int getQuadrant() const { return m_quadrant; }
bool isSignedIntoPSN() const { return m_bSignedIntoPSN; }
void setForAdhoc();
};
enum eAwardType
{
eAwardType_Achievement = 0,
@@ -101,7 +171,7 @@ public:
int GetPrimaryPad();
void SetPrimaryPad(int iPad);
char* GetGamertag(int iPad);
wstring GetDisplayName(int iPad);
std::wstring GetDisplayName(int iPad);
bool IsFullVersion();
void SetFullVersion(bool bFull);

View File

@@ -2,6 +2,8 @@
#include <gxm.h>
class ImageFileBuffer
{
public:
@@ -57,7 +59,7 @@ public:
void Set_matrixDirty();
// Core
void Initialise(ID3D11Device *pDevice, IDXGISwapChain *pSwapChain);
void Initialise();
void InitialiseContext();
void StartFrame();
void Present();
@@ -79,6 +81,8 @@ public:
VERTEX_TYPE_COMPRESSED, // Compressed format - see comment at top of VS_PS3_TS2_CS1.hlsl for description of layout
VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_LIT, // as VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1 with lighting applied,
VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_TEXGEN, // as VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1 with tex gen
VERTEX_TYPE_COMPRESSED_FOG_1,
VERTEX_TYPE_COMPRESSED_FOG_2,
VERTEX_TYPE_COUNT
} eVertexType;
@@ -86,6 +90,9 @@ public:
typedef enum
{
PIXEL_SHADER_TYPE_STANDARD,
PIXEL_SHADER_TYPE_STANDARD2,
PIXEL_SHADER_TYPE_STANDARD3,
PIXEL_SHADER_TYPE_STANDARD4,
PIXEL_SHADER_TYPE_PROJECTION,
PIXEL_SHADER_COUNT
} ePixelShaderType;
@@ -151,6 +158,7 @@ public:
int TextureCreate();
void TextureFree(int idx);
void TextureBind(int idx);
void TextureBind(int layer, int idx);
void TextureBindVertex(int idx);
void TextureSetTextureLevels(int levels);
int TextureGetTextureLevels();

View File

@@ -381,7 +381,7 @@ public:
void SetDLCProductCode(const char* szProductCode);
void SetProductUpgradeKey(const char* szKey);
bool CheckForTrialUpgradeKey(void( *Func)(LPVOID, bool),LPVOID lpParam);
void SetDLCInfoMap(unordered_map<wstring, SONYDLC *>* pSONYDLCMap);
void SetDLCInfoMap(std::unordered_map<wstring, SONYDLC *>* pSONYDLCMap);
void EntitlementsCallback(bool bFoundEntitlements);
};

View File

@@ -51,6 +51,7 @@ extern "C" {
#define CONTEXT_GAME_STATE_BREWING 11
#define CONTEXT_GAME_STATE_ANVIL 12
#define CONTEXT_GAME_STATE_TRADING 13
#define CONTEXT_GAME_STATE_HORSE 14
// Values for X_CONTEXT_PRESENCE

View File

@@ -1,108 +1,34 @@
#pragma once
#include "Common\Leaderboards\SonyLeaderboardManager.h"
#include "Common\Leaderboards\LeaderboardManager.h"
#include "Conf.h"
class PSVitaLeaderboardManager : public LeaderboardManager
{
protected:
enum EStatsState
{
eStatsState_Idle,
eStatsState_Getting,
eStatsState_Failed,
eStatsState_Ready,
eStatsState_Canceled,
//eStatsState_Writing,
eStatsState_Max
};
#include <np.h>
class PSVitaLeaderboardManager : public SonyLeaderboardManager
{
public:
PSVitaLeaderboardManager();
virtual ~PSVitaLeaderboardManager();
private:
unsigned short m_openSessions;
protected:
C4JThread *m_threadScoreboard;
bool m_running;
virtual HRESULT initialiseScoreUtility();
int m_titleContext;
int32_t m_requestId;
virtual bool scoreUtilityAlreadyInitialised(HRESULT hr);
//SceNpId m_myNpId;
virtual HRESULT createTitleContext(const SceNpId &npId);
static int scoreboardThreadEntry(LPVOID lpParam);
void scoreboardThreadInternal();
virtual HRESULT destroyTitleContext(int titleContext);
bool getScoreByIds();
bool getScoreByRange();
virtual HRESULT createTransactionContext(int titleContext);
bool setScore();
queue<RegisterScore> m_views;
virtual HRESULT abortTransactionContext(int transactionContext);
CRITICAL_SECTION m_csViewsLock;
virtual HRESULT destroyTransactionContext(int transactionContext);
EStatsState m_eStatsState; //State of the stats read
// EFilterMode m_eFilterMode;
virtual HRESULT getFriendsList(sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::FriendsList> &friendsList);
ReadScore *m_scores;
unsigned int m_maxRank;
//SceNpScoreRankData *m_stats;
public:
virtual void Tick();// {}
//Open a session
virtual bool OpenSession();// { return true; }
//Close a session
virtual void CloseSession();// {}
//Delete a session
virtual void DeleteSession();// {}
//Write the given stats
//This is called synchronously and will not free any memory allocated for views when it is done
virtual bool WriteStats(unsigned int viewCount, ViewIn views);// { return false; }
virtual bool ReadStats_Friends(LeaderboardReadListener *callback, int difficulty, EStatsType type, PlayerUID myUID, unsigned int startIndex, unsigned int readCount);// { return false; }
virtual bool ReadStats_MyScore(LeaderboardReadListener *callback, int difficulty, EStatsType type, PlayerUID myUID, unsigned int readCount);// { return false; }
virtual bool ReadStats_TopRank(LeaderboardReadListener *callback, int difficulty, EStatsType type, unsigned int startIndex, unsigned int readCount);// { return false; }
//Perform a flush of the stats
virtual void FlushStats();// {}
//Cancel the current operation
virtual void CancelOperation();// {}
//Is the leaderboard manager idle.
virtual bool isIdle();// { return true; }
private:
int getBoardId(int difficulty, EStatsType);
//LeaderboardManager::ReadScore *filterJustScorers(unsigned int &num, LeaderboardManager::ReadScore *friendsData);
SceNpScorePlayerRankData *addPadding(unsigned int num, SceNpScoreRankData *rankData);
void convertToOutput(unsigned int &num, ReadScore *out, SceNpScorePlayerRankData *rankData, SceNpScoreComment *comm);
void toBinary(void *out, SceNpScoreComment *in);
void fromBinary(SceNpScoreComment **out, void *in);
void toBase32(SceNpScoreComment *out, void *in);
void fromBase32(void *out, SceNpScoreComment *in);
void toSymbols(char *);
void fromSymbols(char *);
bool test_string(string);
void initReadScoreStruct(ReadScore &out, SceNpScoreRankData &);
void fillReadScoreStruct(ReadScore &out, SceNpScoreComment &comment);
static bool SortByRank(const ReadScore &lhs, const ReadScore &rhs);
virtual char * getComment(SceNpScoreComment *comment);
};

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];

View File

@@ -304,7 +304,8 @@ LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWO
NumPagesRequired += 1;
}
while( VirtualNumAllocs != NumPagesRequired )
// allocate pages until we reach the required number of pages
while( VirtualNumAllocs < NumPagesRequired )
{
// allocate a new page
void* NewAlloc = malloc(VIRTUAL_PAGE_SIZE);
@@ -941,35 +942,18 @@ int _wtoi(const wchar_t *_Str)
DWORD XGetLanguage()
{
unsigned char ucLang = app.GetMinecraftLanguage(0);
SceInt32 iLang;
// check if we should override the system language or not
if(ucLang==MINECRAFT_LANGUAGE_DEFAULT)
{
sceAppUtilSystemParamGetInt(SCE_SYSTEM_PARAM_ID_LANG,&iLang);
}
else
{
return (DWORD)ucLang;
}
unsigned char ucLang = app.GetMinecraftLanguage(0);
if (ucLang != MINECRAFT_LANGUAGE_DEFAULT) return ucLang;
SceInt32 iLang;
sceAppUtilSystemParamGetInt(SCE_SYSTEM_PARAM_ID_LANG,&iLang);
switch(iLang)
{
case SCE_SYSTEM_PARAM_LANG_JAPANESE : return XC_LANGUAGE_JAPANESE;
case SCE_SYSTEM_PARAM_LANG_ENGLISH_US : return XC_LANGUAGE_ENGLISH;
case SCE_SYSTEM_PARAM_LANG_FRENCH : return XC_LANGUAGE_FRENCH;
case SCE_SYSTEM_PARAM_LANG_SPANISH :
if(app.IsAmericanSKU())
{
return XC_LANGUAGE_LATINAMERICANSPANISH;
}
else
{
return XC_LANGUAGE_SPANISH;
}
case SCE_SYSTEM_PARAM_LANG_SPANISH : return XC_LANGUAGE_SPANISH;
case SCE_SYSTEM_PARAM_LANG_GERMAN : return XC_LANGUAGE_GERMAN;
case SCE_SYSTEM_PARAM_LANG_ITALIAN : return XC_LANGUAGE_ITALIAN;
case SCE_SYSTEM_PARAM_LANG_PORTUGUESE_PT : return XC_LANGUAGE_PORTUGUESE;
@@ -997,6 +981,10 @@ DWORD XGetLanguage()
}
DWORD XGetLocale()
{
// check if we should override the system locale or not
unsigned char ucLocale = app.GetMinecraftLocale(0);
if (ucLocale != MINECRAFT_LANGUAGE_DEFAULT) return ucLocale;
SceInt32 iLang;
sceAppUtilSystemParamGetInt(SCE_SYSTEM_PARAM_ID_LANG,&iLang);
switch(iLang)

View File

@@ -17,7 +17,7 @@
#include "PSVita/Network/PSVita_NPToolkit.h"
#include <message_dialog.h>
#include <savedata_dialog.h>
#include "Common\UI\UI.h"
#include "PSVita\PSVitaExtras\PSVitaStrings.h"
#define VITA_COMMERCE_ENABLED
@@ -111,6 +111,17 @@ SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfo(char *pchTitle)
return pTemp;*/
}
SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfo(int iTexturePackID)
{
for ( AUTO_VAR(it, m_SONYDLCMap.begin()); it != m_SONYDLCMap.end(); ++it )
{
if(it->second->iConfig == iTexturePackID)
return it->second;
}
return NULL;
}
#define WRAPPED_READFILE(hFile,lpBuffer,nNumberOfBytesToRead,lpNumberOfBytesRead,lpOverlapped) {if(ReadFile(hFile,lpBuffer,nNumberOfBytesToRead,lpNumberOfBytesRead,lpOverlapped)==FALSE) { return FALSE;}}
BOOL CConsoleMinecraftApp::ReadProductCodes()
{
@@ -333,6 +344,14 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart()
app.SetGameHostOption(eGameHostOption_HostCanChangeHunger, 1);
app.SetGameHostOption(eGameHostOption_HostCanBeInvisible, 1 );
app.SetGameHostOption(eGameHostOption_MobGriefing, 1 );
app.SetGameHostOption(eGameHostOption_KeepInventory, 0 );
app.SetGameHostOption(eGameHostOption_DoMobSpawning, 1 );
app.SetGameHostOption(eGameHostOption_DoMobLoot, 1 );
app.SetGameHostOption(eGameHostOption_DoTileDrops, 1 );
app.SetGameHostOption(eGameHostOption_NaturalRegeneration, 1 );
app.SetGameHostOption(eGameHostOption_DoDaylightCycle, 1 );
param->settings = app.GetGameHostOption( eGameHostOption_All );
g_NetworkManager.FakeLocalPlayerJoined();
@@ -650,7 +669,7 @@ bool CConsoleMinecraftApp::UpgradeTrial()
{
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());
return true;
}
else
@@ -1057,19 +1076,22 @@ bool CConsoleMinecraftApp::CheckForEmptyStore(int iPad)
SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo();
bool bEmptyStore=true;
if(pCategories->countOfProducts>0)
{
bEmptyStore=false;
}
else
{
for(int i=0;i<pCategories->countOfSubCategories;i++)
if(pCategories!=NULL)
{
if(pCategories->countOfProducts>0)
{
std::vector<SonyCommerce::ProductInfo>*pvProductInfo=app.GetProductList(i);
if(pvProductInfo->size()>0)
bEmptyStore=false;
}
else
{
for(int i=0;i<pCategories->countOfSubCategories;i++)
{
bEmptyStore=false;
break;
std::vector<SonyCommerce::ProductInfo>*pvProductInfo=app.GetProductList(i);
if(pvProductInfo->size()>0)
{
bEmptyStore=false;
break;
}
}
}
}
@@ -1197,7 +1219,7 @@ void CConsoleMinecraftApp::SaveDataTick()
{
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
C4JStorage::EMessageResult res = ui.RequestMessageBox( IDS_SAVE_INCOMPLETE_TITLE, IDS_SAVE_INCOMPLETE_EXPLANATION_QUOTA, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL, app.GetStringTable());
C4JStorage::EMessageResult res = ui.RequestErrorMessage( IDS_SAVE_INCOMPLETE_TITLE, IDS_SAVE_INCOMPLETE_EXPLANATION_QUOTA, uiIDA, 1, ProfileManager.GetPrimaryPad());
if( res != C4JStorage::EMessage_Busy )
{
//Clear the error now it's been dealt with
@@ -1217,18 +1239,30 @@ void CConsoleMinecraftApp::Callback_SaveGameIncomplete(void *pParam, C4JStorage:
if (saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfQuota || saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfLocalStorage)
{
// 4J Stu - If it's quota then we definitely have to delete our saves, so don't show the system UI for this case
if(saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfQuota) blocksRequired = -1;
UINT uiIDA[2];
uiIDA[0]=IDS_CONFIRM_OK;
uiIDA[1]=IDS_CONFIRM_CANCEL;
C4JStorage::EMessageResult res = ui.RequestMessageBox( IDS_SAVE_INCOMPLETE_TITLE, IDS_SAVE_INCOMPLETE_EXPLANATION_QUOTA, uiIDA, 2, ProfileManager.GetPrimaryPad(), &NoSaveSpaceReturned, (void *)blocksRequired, app.GetStringTable());
if(UIScene_LoadOrJoinMenu::isSaveTransferRunning())
{
// 4J MGH - if we're trying to save from the save transfer stuff, only show "ok", and we won't try to save again
if(saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfQuota) blocksRequired = -1;
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
C4JStorage::EMessageResult res = ui.RequestErrorMessage( IDS_SAVE_INCOMPLETE_TITLE, IDS_SAVE_INCOMPLETE_EXPLANATION_QUOTA, uiIDA, 1, ProfileManager.GetPrimaryPad(), &NoSaveSpaceReturned, (void *)blocksRequired);
}
else
{
// 4J Stu - If it's quota then we definitely have to delete our saves, so don't show the system UI for this case
if(saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfQuota) blocksRequired = -1;
UINT uiIDA[2];
uiIDA[0]=IDS_CONFIRM_OK;
uiIDA[1]=IDS_CONFIRM_CANCEL;
C4JStorage::EMessageResult res = ui.RequestErrorMessage( IDS_SAVE_INCOMPLETE_TITLE, IDS_SAVE_INCOMPLETE_EXPLANATION_QUOTA, uiIDA, 2, ProfileManager.GetPrimaryPad(), &NoSaveSpaceReturned, (void *)blocksRequired);
}
}
}
int CConsoleMinecraftApp::NoSaveSpaceReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
if(result==C4JStorage::EMessage_ResultAccept)
if(result==C4JStorage::EMessage_ResultAccept && !UIScene_LoadOrJoinMenu::isSaveTransferRunning()) // MGH - we won't try to save again during a save tranfer
{
int blocksRequired = (int)pParam;
if(blocksRequired > 0)
@@ -1489,12 +1523,11 @@ void CConsoleMinecraftApp::updateSaveDataDeleteDialog()
IDS_CONFIRM_OK
};
ui.RequestMessageBox(
ui.RequestErrorMessage(
IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE,
uiIDA, 2,
0,
&cbConfirmDeleteMessageBox, this,
app.GetStringTable()
&cbConfirmDeleteMessageBox, this
);
m_bSaveDataDeleteDialogState = eSaveDataDeleteState_userConfirmation;

View File

@@ -103,6 +103,7 @@ public:
bool IsAmericanSKU();
//char *GetSKUPostfix();
SONYDLC *GetSONYDLCInfo(char *pchTitle);
SONYDLC *GetSONYDLCInfo(int iTexturePackID);
int GetiFirstSkinFromName(char *pchName);
int GetiConfigFromName(char *pchName);
@@ -214,7 +215,7 @@ private:
bool m_bCommerceInitialised;
bool m_bCommerceProductListRetrieved;
bool m_bProductListAdditionalDetailsRetrieved;
char m_pchSkuID[48];
char m_pchSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN];
int m_eCommerce_State;
int m_ProductListRetrievedC;

View File

@@ -59,6 +59,7 @@
#include "Conf.h"
#include "PSVita/Network/PSVita_NPToolkit.h"
#include "PSVita\Network\SonyVoiceChat_Vita.h"
#include "..\..\Minecraft.World\FireworksRecipe.h"
#include <libsysmodule.h>
#include <libperf.h>
@@ -163,7 +164,7 @@ void DefineActions(void)
InputManager.SetGameJoypadMaps(MAP_STYLE_0,ACTION_MENU_LEFT, _PSV_JOY_BUTTON_DPAD_LEFT | _360_JOY_BUTTON_LSTICK_LEFT);
InputManager.SetGameJoypadMaps(MAP_STYLE_0,ACTION_MENU_RIGHT, _PSV_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT);
InputManager.SetGameJoypadMaps(MAP_STYLE_0,ACTION_MENU_PAGEUP, _360_JOY_BUTTON_LT);
InputManager.SetGameJoypadMaps(MAP_STYLE_0,ACTION_MENU_PAGEDOWN, _360_JOY_BUTTON_RT);
InputManager.SetGameJoypadMaps(MAP_STYLE_0,ACTION_MENU_PAGEDOWN, _360_JOY_BUTTON_BACK);
InputManager.SetGameJoypadMaps(MAP_STYLE_0,ACTION_MENU_RIGHT_SCROLL, _PSV_JOY_BUTTON_R1);
InputManager.SetGameJoypadMaps(MAP_STYLE_0,ACTION_MENU_LEFT_SCROLL, _PSV_JOY_BUTTON_L1);
InputManager.SetGameJoypadMaps(MAP_STYLE_0,ACTION_MENU_PAUSEMENU, _PSV_JOY_BUTTON_START);
@@ -297,11 +298,7 @@ int simpleMessageBoxCallback( UINT uiTitle, UINT uiText,
int(*Func) (LPVOID,int,const C4JStorage::EMessageResult),
LPVOID lpParam )
{
ui.RequestMessageBox( uiTitle, uiText,
uiOptionA, uiOptionC, dwPad,
Func, lpParam, app.GetStringTable(),
NULL, 0
);
ui.RequestErrorMessage( uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam);
return 0;
}
@@ -438,6 +435,7 @@ void LoadSysModule(uint16_t module, const char* moduleName)
{
#ifndef _CONTENT_PACKAGE
printf("Error sceSysmoduleLoadModule %s failed (%d) \n", moduleName, ret );
// are you running the debugger and don't have the Debugging/Mapping File set? - $(ProjectDir)\PSVita\configuration.psp2path
#endif
assert(0);
}
@@ -509,7 +507,7 @@ int main()
// Compression::CreateNewThreadStorage();
app.loadMediaArchive();
RenderManager.Initialise(NULL, NULL);
RenderManager.Initialise();
// Read the file containing the product codes
if(app.ReadProductCodes()==FALSE)
@@ -589,7 +587,7 @@ int main()
ProfileManager.Initialise(
s_npCommunicationConfig,
app.GetCommerceCategory(),// s_serviceId,
PROFILE_VERSION_BUILD_JUNE14,
PROFILE_VERSION_CURRENT,
NUM_PROFILE_VALUES,
NUM_PROFILE_SETTINGS,
dwProfileSettingsA,
@@ -617,7 +615,7 @@ int main()
byteArray baSaveThumbnail = app.getArchiveFile(L"DefaultSaveThumbnail64x64.png");
byteArray baSaveImage = app.getArchiveFile(L"DefaultSaveImage320x176.png");
StorageManager.InitialiseProfileData(PROFILE_VERSION_BUILD_JUNE14,
StorageManager.InitialiseProfileData(PROFILE_VERSION_CURRENT,
NUM_PROFILE_VALUES,
NUM_PROFILE_SETTINGS,
dwProfileSettingsA,
@@ -667,9 +665,9 @@ int main()
// debug switch to trial version
//ProfileManager.SetDebugFullOverride(false);
#if 0
//ProfileManager.AddDLC(2);
StorageManager.SetDLCPackageRoot("DLCDrive");
#if 0
StorageManager.RegisterMarketplaceCountsCallback(&CConsoleMinecraftApp::MarketplaceCountsCallback,(LPVOID)&app);
// Kinect !
@@ -693,7 +691,8 @@ int main()
Compression::CreateNewThreadStorage();
OldChunkStorage::CreateNewThreadStorage();
Level::enableLightingCache();
Tile::CreateNewThreadStorage();
Tile::CreateNewThreadStorage();
FireworksRecipe::CreateNewThreadStorage();
Minecraft::main();
Minecraft *pMinecraft=Minecraft::GetInstance();
@@ -1048,7 +1047,7 @@ int main()
Vec3::resetPool();
// sceRazorCpuSync();
#ifndef _CONTENT_PACKAGE
#if 0 //ndef _CONTENT_PACKAGE
if( InputManager.ButtonDown(0, MINECRAFT_ACTION_DPAD_LEFT) )
{
malloc_managed_size mmsize;

View File

@@ -225,5 +225,14 @@ enum ETelemetryChallenges
eTelemetryTutorial_TradingMenu,
eTelemetryTutorial_Enderchest,
eTelemetryTutorial_Horse, // Java 1.6.4
eTelemetryTutorial_HorseMenu,
eTelemetryTutorial_Fireworks,
eTelemetryTutorial_FireworksMenu,
eTelemetryTutorial_Beacon,
eTelemetryTutorial_BeaconMenu,
eTelemetryTutorial_Hopper,
eTelemetryTutorial_HopperMenu,
// Sent over network as a byte
};

Binary file not shown.

Binary file not shown.