aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/PSVita
diff options
context:
space:
mode:
authordaoge <3523206925@qq.com>2026-03-03 03:04:10 +0800
committerGitHub <noreply@github.com>2026-03-03 03:04:10 +0800
commitb3feddfef372618c8a9d7a0abcaf18cfad866c18 (patch)
tree267761c3bb39241ba5c347bfbe2254d06686e287 /Minecraft.Client/PSVita
parent84c31a2331f7a0ec85b9d438992e244f60e5020f (diff)
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 97a43994725008e35fceb984d5549df9c8cea470. * 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>
Diffstat (limited to 'Minecraft.Client/PSVita')
-rw-r--r--Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h72
-rw-r--r--Minecraft.Client/PSVita/4JLibs/inc/4J_Render.h10
-rw-r--r--Minecraft.Client/PSVita/4JLibs/inc/4J_Storage.h2
-rw-r--r--Minecraft.Client/PSVita/4JLibs/libs/4J_Input.abin399700 -> 397820 bytes
-rw-r--r--Minecraft.Client/PSVita/4JLibs/libs/4J_Input_d.abin677400 -> 673732 bytes
-rw-r--r--Minecraft.Client/PSVita/4JLibs/libs/4J_Input_r.abin140788 -> 140792 bytes
-rw-r--r--Minecraft.Client/PSVita/4JLibs/libs/4J_Profile.abin1330094 -> 1609112 bytes
-rw-r--r--Minecraft.Client/PSVita/4JLibs/libs/4J_Profile_d.abin5996680 -> 6593336 bytes
-rw-r--r--Minecraft.Client/PSVita/4JLibs/libs/4J_Profile_r.abin427640 -> 602986 bytes
-rw-r--r--Minecraft.Client/PSVita/4JLibs/libs/4J_Render.abin2733136 -> 1720522 bytes
-rw-r--r--Minecraft.Client/PSVita/4JLibs/libs/4J_Render_d.abin4887672 -> 3217922 bytes
-rw-r--r--Minecraft.Client/PSVita/4JLibs/libs/4J_Render_r.abin823522 -> 578550 bytes
-rw-r--r--Minecraft.Client/PSVita/4JLibs/libs/4J_Storage.abin870476 -> 871108 bytes
-rw-r--r--Minecraft.Client/PSVita/4JLibs/libs/4J_Storage_d.abin2251332 -> 2251302 bytes
-rw-r--r--Minecraft.Client/PSVita/4JLibs/libs/4J_Storage_r.abin321036 -> 323480 bytes
-rw-r--r--Minecraft.Client/PSVita/GameConfig/Minecraft.spa.h1
-rw-r--r--Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp1054
-rw-r--r--Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.h104
-rw-r--r--Minecraft.Client/PSVita/Network/PSVita_NPToolkit.cpp23
-rw-r--r--Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp218
-rw-r--r--Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.h3
-rw-r--r--Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.cpp66
-rw-r--r--Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.h1
-rw-r--r--Minecraft.Client/PSVita/Network/SonyCommerce_Vita.cpp31
-rw-r--r--Minecraft.Client/PSVita/Network/SonyCommerce_Vita.h3
-rw-r--r--Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp44
-rw-r--r--Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.h1
-rw-r--r--Minecraft.Client/PSVita/PSVitaExtras/PsVitaStubs.cpp34
-rw-r--r--Minecraft.Client/PSVita/PSVita_App.cpp81
-rw-r--r--Minecraft.Client/PSVita/PSVita_App.h3
-rw-r--r--Minecraft.Client/PSVita/PSVita_Minecraft.cpp23
-rw-r--r--Minecraft.Client/PSVita/Sentient/TelemetryEnum.h9
-rw-r--r--Minecraft.Client/PSVita/Sound/Minecraft.msscmpbin12276954 -> 14439642 bytes
-rw-r--r--Minecraft.Client/PSVita/Tutorial/Tutorial.mcsbin0 -> 9184230 bytes
-rw-r--r--Minecraft.Client/PSVita/Tutorial/Tutorial.pckbin0 -> 3119 bytes
-rw-r--r--Minecraft.Client/PSVita/app/Region/SCEA/param.sfobin840 -> 840 bytes
-rw-r--r--Minecraft.Client/PSVita/app/Region/SCEE/param.sfobin840 -> 840 bytes
-rw-r--r--Minecraft.Client/PSVita/app/Region/SCEJ/param.sfobin840 -> 840 bytes
38 files changed, 510 insertions, 1273 deletions
diff --git a/Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h b/Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h
index 2fc9385a..ab6b6131 100644
--- a/Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h
+++ b/Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h
@@ -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);
diff --git a/Minecraft.Client/PSVita/4JLibs/inc/4J_Render.h b/Minecraft.Client/PSVita/4JLibs/inc/4J_Render.h
index 750d5fc9..b08c9fba 100644
--- a/Minecraft.Client/PSVita/4JLibs/inc/4J_Render.h
+++ b/Minecraft.Client/PSVita/4JLibs/inc/4J_Render.h
@@ -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();
diff --git a/Minecraft.Client/PSVita/4JLibs/inc/4J_Storage.h b/Minecraft.Client/PSVita/4JLibs/inc/4J_Storage.h
index ecd4dbc3..552c247d 100644
--- a/Minecraft.Client/PSVita/4JLibs/inc/4J_Storage.h
+++ b/Minecraft.Client/PSVita/4JLibs/inc/4J_Storage.h
@@ -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);
};
diff --git a/Minecraft.Client/PSVita/4JLibs/libs/4J_Input.a b/Minecraft.Client/PSVita/4JLibs/libs/4J_Input.a
index 6ddf0cec..3dbc0fc6 100644
--- a/Minecraft.Client/PSVita/4JLibs/libs/4J_Input.a
+++ b/Minecraft.Client/PSVita/4JLibs/libs/4J_Input.a
Binary files differ
diff --git a/Minecraft.Client/PSVita/4JLibs/libs/4J_Input_d.a b/Minecraft.Client/PSVita/4JLibs/libs/4J_Input_d.a
index 6b27613f..141b00b9 100644
--- a/Minecraft.Client/PSVita/4JLibs/libs/4J_Input_d.a
+++ b/Minecraft.Client/PSVita/4JLibs/libs/4J_Input_d.a
Binary files differ
diff --git a/Minecraft.Client/PSVita/4JLibs/libs/4J_Input_r.a b/Minecraft.Client/PSVita/4JLibs/libs/4J_Input_r.a
index 3e966c35..5844343a 100644
--- a/Minecraft.Client/PSVita/4JLibs/libs/4J_Input_r.a
+++ b/Minecraft.Client/PSVita/4JLibs/libs/4J_Input_r.a
Binary files differ
diff --git a/Minecraft.Client/PSVita/4JLibs/libs/4J_Profile.a b/Minecraft.Client/PSVita/4JLibs/libs/4J_Profile.a
index d4bbcca4..0913ae64 100644
--- a/Minecraft.Client/PSVita/4JLibs/libs/4J_Profile.a
+++ b/Minecraft.Client/PSVita/4JLibs/libs/4J_Profile.a
Binary files differ
diff --git a/Minecraft.Client/PSVita/4JLibs/libs/4J_Profile_d.a b/Minecraft.Client/PSVita/4JLibs/libs/4J_Profile_d.a
index 251e7cff..b00f82c4 100644
--- a/Minecraft.Client/PSVita/4JLibs/libs/4J_Profile_d.a
+++ b/Minecraft.Client/PSVita/4JLibs/libs/4J_Profile_d.a
Binary files differ
diff --git a/Minecraft.Client/PSVita/4JLibs/libs/4J_Profile_r.a b/Minecraft.Client/PSVita/4JLibs/libs/4J_Profile_r.a
index 1fa7a3e9..b1ad68f8 100644
--- a/Minecraft.Client/PSVita/4JLibs/libs/4J_Profile_r.a
+++ b/Minecraft.Client/PSVita/4JLibs/libs/4J_Profile_r.a
Binary files differ
diff --git a/Minecraft.Client/PSVita/4JLibs/libs/4J_Render.a b/Minecraft.Client/PSVita/4JLibs/libs/4J_Render.a
index 71989e4c..ae0c2e5e 100644
--- a/Minecraft.Client/PSVita/4JLibs/libs/4J_Render.a
+++ b/Minecraft.Client/PSVita/4JLibs/libs/4J_Render.a
Binary files differ
diff --git a/Minecraft.Client/PSVita/4JLibs/libs/4J_Render_d.a b/Minecraft.Client/PSVita/4JLibs/libs/4J_Render_d.a
index 60f78685..2e7d1011 100644
--- a/Minecraft.Client/PSVita/4JLibs/libs/4J_Render_d.a
+++ b/Minecraft.Client/PSVita/4JLibs/libs/4J_Render_d.a
Binary files differ
diff --git a/Minecraft.Client/PSVita/4JLibs/libs/4J_Render_r.a b/Minecraft.Client/PSVita/4JLibs/libs/4J_Render_r.a
index a9611c74..77d47b5b 100644
--- a/Minecraft.Client/PSVita/4JLibs/libs/4J_Render_r.a
+++ b/Minecraft.Client/PSVita/4JLibs/libs/4J_Render_r.a
Binary files differ
diff --git a/Minecraft.Client/PSVita/4JLibs/libs/4J_Storage.a b/Minecraft.Client/PSVita/4JLibs/libs/4J_Storage.a
index acbe48e0..9ba5bd68 100644
--- a/Minecraft.Client/PSVita/4JLibs/libs/4J_Storage.a
+++ b/Minecraft.Client/PSVita/4JLibs/libs/4J_Storage.a
Binary files differ
diff --git a/Minecraft.Client/PSVita/4JLibs/libs/4J_Storage_d.a b/Minecraft.Client/PSVita/4JLibs/libs/4J_Storage_d.a
index 066596cd..35b9c683 100644
--- a/Minecraft.Client/PSVita/4JLibs/libs/4J_Storage_d.a
+++ b/Minecraft.Client/PSVita/4JLibs/libs/4J_Storage_d.a
Binary files differ
diff --git a/Minecraft.Client/PSVita/4JLibs/libs/4J_Storage_r.a b/Minecraft.Client/PSVita/4JLibs/libs/4J_Storage_r.a
index ca6ead44..631943a9 100644
--- a/Minecraft.Client/PSVita/4JLibs/libs/4J_Storage_r.a
+++ b/Minecraft.Client/PSVita/4JLibs/libs/4J_Storage_r.a
Binary files differ
diff --git a/Minecraft.Client/PSVita/GameConfig/Minecraft.spa.h b/Minecraft.Client/PSVita/GameConfig/Minecraft.spa.h
index e8234ff5..9bf94461 100644
--- a/Minecraft.Client/PSVita/GameConfig/Minecraft.spa.h
+++ b/Minecraft.Client/PSVita/GameConfig/Minecraft.spa.h
@@ -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
diff --git a/Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp b/Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp
index 981d1f40..958999e4 100644
--- a/Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp
+++ b/Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp
@@ -2,11 +2,10 @@
#include "PSVitaLeaderboardManager.h"
-#include "base64.h"
-
-#include "..\PSVita_App.h"
-#include "..\..\Common\Consoles_App.h"
+#include "PSVita\PSVita_App.h"
+#include "PSVita\PSVitaExtras\ShutdownManager.h"
+#include "Common\Consoles_App.h"
#include "Common\Network\Sony\SQRNetworkManager.h"
#include "..\..\..\Minecraft.World\StringHelpers.h"
@@ -15,1056 +14,51 @@
#include <np.h>
-#include "PSVita\PSVitaExtras\ShutdownManager.h"
-
-
LeaderboardManager *LeaderboardManager::m_instance = new PSVitaLeaderboardManager(); //Singleton instance of the LeaderboardManager
-PSVitaLeaderboardManager::PSVitaLeaderboardManager()
-{
- m_eStatsState = eStatsState_Idle;
-
- m_titleContext = -1;
-
- m_myXUID = INVALID_XUID;
+PSVitaLeaderboardManager::PSVitaLeaderboardManager() : SonyLeaderboardManager() {}
- m_scores = NULL; //m_stats = NULL;
-
- m_statsType = eStatsType_Kills;
- m_difficulty = 0;
-
- m_requestId = 0;
-
- m_openSessions = 0;
-
- InitializeCriticalSection(&m_csViewsLock);
-
- m_running = false;
- m_threadScoreboard = NULL;
-}
-
-PSVitaLeaderboardManager::~PSVitaLeaderboardManager()
+HRESULT PSVitaLeaderboardManager::initialiseScoreUtility()
{
- m_running = false;
-
- // 4J-JEV: Wait for thread to stop and hope it doesn't take too long.
- long long startShutdown = System::currentTimeMillis();
- while (m_threadScoreboard->isRunning())
- {
- Sleep(1);
- assert( (System::currentTimeMillis() - startShutdown) < 16 );
- }
-
- delete m_threadScoreboard;
-
- DeleteCriticalSection(&m_csViewsLock);
+ return sceNpScoreInit( SCE_KERNEL_DEFAULT_PRIORITY_USER, SCE_KERNEL_THREAD_CPU_AFFINITY_MASK_DEFAULT, NULL);
}
-int PSVitaLeaderboardManager::scoreboardThreadEntry(LPVOID lpParam)
-{
- ShutdownManager::HasStarted(ShutdownManager::eLeaderboardThread);
- PSVitaLeaderboardManager *self = reinterpret_cast<PSVitaLeaderboardManager *>(lpParam);
-
- self->m_running = true;
- app.DebugPrintf("[LeaderboardManager] Thread started.\n");
-
- bool needsWriting = false;
- do
- {
- if (self->m_openSessions > 0 || needsWriting)
- {
- self->scoreboardThreadInternal();
- }
-
- EnterCriticalSection(&self->m_csViewsLock);
- needsWriting = self->m_views.size() > 0;
- LeaveCriticalSection(&self->m_csViewsLock);
-
- // 4J Stu - We can't write while we aren't signed in to live
- if (!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()))
- {
- needsWriting = false;
- }
-
- if ( (!needsWriting) && (self->m_eStatsState != eStatsState_Getting) )
- {
- Sleep(50); // 4J-JEV: When we're not reading or writing.
- }
-
- } while ( (self->m_running || self->m_eStatsState == eStatsState_Getting || needsWriting)
- && ShutdownManager::ShouldRun(ShutdownManager::eLeaderboardThread)
- );
-
- // 4J-JEV, moved this here so setScore can finish up.
- sceNpScoreDestroyTitleCtx(self->m_titleContext);
- // TODO sceNpScoreTerm();
- app.DebugPrintf("[LeaderboardManager] Thread closed.\n");
- ShutdownManager::HasFinished(ShutdownManager::eLeaderboardThread);
- return 0;
+bool PSVitaLeaderboardManager::scoreUtilityAlreadyInitialised(HRESULT hr)
+{
+ return hr == SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED;
}
-void PSVitaLeaderboardManager::scoreboardThreadInternal()
-{
- // 4J-JEV: Just initialise the context the once now.
- if (m_titleContext == -1)
- {
- int primaryPad = ProfileManager.GetPrimaryPad();
- if (!ProfileManager.IsSignedInLive(primaryPad)) return;
-
- //CD - Init NP Score
- int ret = sceNpScoreInit( SCE_KERNEL_DEFAULT_PRIORITY_USER, SCE_KERNEL_THREAD_CPU_AFFINITY_MASK_DEFAULT, NULL);
- if ( ret < 0 )
- {
- if ( ret != SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED )
- {
- app.DebugPrintf("[LeaderboardManager] sceNpScoreInit() failed. ret = 0x%x\n", ret);
- return;
- }
- else
- {
- app.DebugPrintf("[LeaderboardManager] sceNpScoreInit() already initialised, (0x%x)\n", ret);
- }
- }
-
- SceNpId npId;
- ProfileManager.GetSceNpId(primaryPad,&npId);
-
- ret = sceNpScoreCreateTitleCtx( &s_npCommunicationId, &s_npCommunicationPassphrase, &npId );
-
- if (ret < 0) return;
- else m_titleContext = ret;
- }
- else assert( m_titleContext > 0 ); //Paranoia
-
-
- switch (m_eStatsState)
- {
- case eStatsState_Getting:
- switch(m_eFilterMode)
- {
- case eFM_MyScore:
- case eFM_Friends:
- getScoreByIds();
- break;
- case eFM_TopRank:
- getScoreByRange();
- break;
- }
- break;
-
- case eStatsState_Canceled:
- case eStatsState_Failed:
- case eStatsState_Ready:
- case eStatsState_Idle:
-
- // 4J-JEV: Moved this here, I don't want reading and
- // writing going on at the same time.
- // --
- // 4J-JEV: Writing no longer changes the manager state,
- // we'll manage the write queue seperately.
-
- EnterCriticalSection(&m_csViewsLock);
- bool hasWork = !m_views.empty();
- LeaveCriticalSection(&m_csViewsLock);
-
- if (hasWork)
- {
- setScore();
- }
-
- break;
- }
+HRESULT PSVitaLeaderboardManager::createTitleContext(const SceNpId &npId)
+{
+ return sceNpScoreCreateTitleCtx(&s_npCommunicationId, &s_npCommunicationPassphrase, &npId);
}
-bool PSVitaLeaderboardManager::getScoreByIds()
+HRESULT PSVitaLeaderboardManager::destroyTitleContext(int titleContext)
{
- if (m_eStatsState == eStatsState_Canceled) return false;
-
- // ----------------------------
- SceRtcTick last_sort_date;
- SceNpScoreRankNumber mTotalRecord;
-
- SceNpId *npIds = NULL;
-
-
- int ret;
- uint32_t num = 0;
-
- SceNpScorePlayerRankData *ptr;
- SceNpScoreComment *comments;
- // ----------------------------
-
- // Check for invalid LManager state.
- assert( m_eFilterMode == eFM_Friends
- || m_eFilterMode == eFM_MyScore);
-
- SceNpId myNpId;
- // 4J-PB - should it be user 0?
- if(!ProfileManager.IsSignedInLive(0))
- {
- app.DebugPrintf("[LeaderboardManager] OpenSession() fail: User isn't signed in to PSN\n");
- return false;
- }
- ProfileManager.GetSceNpId(0,&myNpId);
-
- // Get queried users.
- if (m_eFilterMode == eFM_Friends)
- {
- //CD - Altered for Vita
- //4J-JEV - Merged in my changes to Orbis.
- sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::FriendsList> s_friendList;
- int ret = sce::Toolkit::NP::Friends::Interface::getFriendslist(&s_friendList, false);
-
- if(ret != SCE_TOOLKIT_NP_SUCCESS)
- {
- // Error handling
- if (m_eStatsState != eStatsState_Canceled) m_eStatsState = eStatsState_Failed;
- app.DebugPrintf("[LeaderboardManager] getFriendslist fail\n");
- return false;
- }
- else if (s_friendList.hasResult())
- {
- // 4J-JEV: Friends list doesn't include player, leave space for them.
- num = s_friendList.get()->size() + 1;
-
- npIds = new SceNpId[num];
-
- int i = 0;
-
- sce::Toolkit::NP::FriendsList::const_iterator itr;
- for (itr = s_friendList.get()->begin(); itr != s_friendList.get()->end(); itr++)
- {
- npIds[i] = itr->npid;
- i++;
- }
-
- npIds[num-1] = myNpId; // 4J-JEV: Append player to end of query.
- }
- else
- {
- // 4J-JEV: Something terrible must have happend,
- // 'getFriendslist' was supposed to be a synchronous operation.
- __debugbreak();
-
- // 4J-JEV: We can at least fall-back to just the players score.
- num = 1;
- npIds = new SceNpId[1];
- npIds[0] = myNpId;
- }
- }
- else if (m_eFilterMode == eFM_MyScore)
- {
- num = 1;
- npIds = new SceNpId[1];
- npIds[0] = myNpId;
- }
-
- ret = sceNpScoreCreateRequest(m_titleContext);
- if (m_eStatsState == eStatsState_Canceled)
- {
- // Cancel operation has been called, abort.
- app.DebugPrintf("[LeaderboardManager]\tgetScoreByIds() - m_eStatsState == eStatsState_Canceled.\n");
-
- sceNpScoreDeleteRequest(ret);
-
- if (npIds != NULL) delete [] npIds;
- return false;
- }
- else if (ret < 0)
- {
- // Error occurred creating a transacion, abort.
- app.DebugPrintf("[LeaderboardManager]\tgetScoreByIds() - createTransaction failed, ret=0x%X\n", ret);
-
- m_eStatsState = eStatsState_Failed;
-
- if (npIds != NULL) delete [] npIds;
- return false;
- }
- else
- {
- // Transaction created successfully, continue.
- m_requestId = ret;
- app.DebugPrintf("[LeaderboardManager] REQUEST ID A = 0x%X\n",m_requestId );
- }
-
- ptr = new SceNpScorePlayerRankData[num];
- comments = new SceNpScoreComment[num];
-
- /* app.DebugPrintf("sceNpScoreGetRankingByNpId(\n\t transaction=%i,\n\t boardID=0,\n\t npId=%i,\n\t friendCount*sizeof(SceNpId)=%i*%i=%i,\
- rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t NULL, 0, NULL, 0,\n\t friendCount=%i,\n...\n",
- transaction, npId, friendCount, sizeof(SceNpId), friendCount*sizeof(SceNpId),
- rankData, friendCount*sizeof(SceNpScorePlayerRankData), friendCount
- ); */
-
- int boardId = getBoardId(m_difficulty, m_statsType);
- ret = sceNpScoreGetRankingByNpId(
- m_requestId,
- boardId, // BoardId
-
- npIds, sizeof(SceNpId) * num, //IN: Player IDs
- ptr, sizeof(SceNpScorePlayerRankData) * num, //OUT: Rank Data
-
- comments, sizeof(SceNpScoreComment) * num, //OUT: Comments
-
- NULL, 0, // GameData. (unused)
-
- num,
-
- &last_sort_date,
- &mTotalRecord,
-
- NULL // Reserved, specify null.
- );
-
- if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED)
- {
- app.DebugPrintf("[LeaderboardManager] getScoreByIds(): 'sceNpScoreGetRankingByRange' aborted (0x%X).\n", ret);
-
- ret = sceNpScoreDeleteRequest(m_requestId);
- m_requestId = 0;
-
- delete [] ptr;
- delete [] comments;
- delete [] npIds;
-
- return false;
- }
- else if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_GAME_RANKING_NOT_FOUND)
- {
- app.DebugPrintf("[LeaderboardManager] getScoreByIds(): Game ranking not found.\n");
-
- ret = sceNpScoreDeleteRequest(m_requestId);
- m_requestId = 0;
-
- delete [] ptr;
- delete [] comments;
- delete [] npIds;
-
- m_scores = NULL;
- m_readCount = 0;
- m_maxRank = num;
-
- m_eStatsState = eStatsState_Ready;
- return false;
- }
- else if (ret<0) goto error3;
-
- // Return.
- sceNpScoreDeleteRequest(m_requestId);
- m_requestId = 0;
-
- m_readCount = num;
-
- // Filter scorers and construct output structure.
- if (m_scores != NULL) delete [] m_scores;
- m_scores = new ReadScore[m_readCount];
- convertToOutput(m_readCount, m_scores, ptr, comments);
- m_maxRank = m_readCount;
-
- app.DebugPrintf(
- "[LeaderboardManager] getScoreByIds(), Success!\n"
- "\t Board %i\n"
- "\t %i of %i results have an entry\n"
- "1stScore=%i\n",
- boardId,
- m_readCount, num,
- ptr->rankData.scoreValue
- );
-
- // Sort scores
- std::sort(m_scores, m_scores + m_readCount, SortByRank);
-
- delete [] ptr;
- delete [] comments;
- delete [] npIds;
-
- m_eStatsState = eStatsState_Ready;
- return true;
-
- // Error.
-error3:
- if (ret!=SCE_NP_COMMUNITY_ERROR_ABORTED) //0x8002a109
- sceNpScoreDeleteRequest(m_requestId);
- m_requestId = 0;
- delete [] ptr;
- delete [] comments;
-error2:
- if (npIds != NULL) delete [] npIds;
-error1:
- if (m_eStatsState != eStatsState_Canceled) m_eStatsState = eStatsState_Failed;
- app.DebugPrintf("[LeaderboardManger] getScoreByIds() FAILED, ret=0x%X\n", ret);
- return false;
+ return sceNpScoreDestroyTitleCtx(titleContext);
}
-bool PSVitaLeaderboardManager::getScoreByRange()
+HRESULT PSVitaLeaderboardManager::createTransactionContext(int titleContext)
{
- SceRtcTick last_sort_date;
- SceNpScoreRankNumber mTotalRecord;
-
- unsigned int num = m_readCount;
- SceNpScoreRankData *ptr;
- SceNpScoreComment *comments;
-
- assert(m_eFilterMode == eFM_TopRank);
-
- int ret = sceNpScoreCreateRequest(m_titleContext);
- if (m_eStatsState == eStatsState_Canceled)
- {
- // Cancel operation has been called, abort.
- app.DebugPrintf("[LeaderboardManager]\tgetScoreByRange() - m_eStatsState == eStatsState_Canceled.\n");
- sceNpScoreDeleteRequest(ret);
- return false;
- }
- else if (ret < 0)
- {
- // Error occurred creating a transacion, abort.
- m_eStatsState = eStatsState_Failed;
- app.DebugPrintf("[LeaderboardManager]\tgetScoreByRange() - createTransaction failed, ret=0x%X\n", ret);
- return false;
- }
- else
- {
- // Transaction created successfully, continue.
- m_requestId = ret;
- app.DebugPrintf("[LeaderboardManager] REQUEST ID B = 0x%X\n",m_requestId );
- }
-
- ptr = new SceNpScoreRankData[num];
- comments = new SceNpScoreComment[num];
-
- int boardId = getBoardId(m_difficulty, m_statsType);
- ret = sceNpScoreGetRankingByRange(
- m_requestId,
- boardId, // BoardId
-
- m_startIndex,
-
- ptr, sizeof(SceNpScoreRankData) * num, //OUT: Rank Data
-
- comments, sizeof(SceNpScoreComment) * num, //OUT: Comment Data
-
- NULL, 0, // GameData.
-
- num,
-
- &last_sort_date,
- &m_maxRank, // 'Total number of players registered in the target scoreboard.'
-
- NULL // Reserved, specify null.
- );
-
- if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED)
- {
- app.DebugPrintf("[LeaderboardManager] getScoreByRange(): 'sceNpScoreGetRankingByRange' aborted (0x%X).\n", ret);
-
- ret = sceNpScoreDeleteRequest(m_requestId);
- m_requestId = 0;
-
- delete [] ptr;
- delete [] comments;
-
- return false;
- }
- else if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_GAME_RANKING_NOT_FOUND)
- {
- app.DebugPrintf("[LeaderboardManager] getScoreByRange(): Game ranking not found.");
-
- ret = sceNpScoreDeleteRequest(m_requestId);
- m_requestId = 0;
-
- delete [] ptr;
- delete [] comments;
-
- m_scores = NULL;
- m_readCount = 0;
-
- m_eStatsState = eStatsState_Ready;
- return false;
- }
- else if (ret<0) goto error2;
- else
- {
- app.DebugPrintf("[LeaderboardManager] getScoreByRange(), success, 1stScore=%i.\n", ptr->scoreValue);
- }
-
- // Return.
- sceNpScoreDeleteRequest(m_requestId);
- m_requestId = 0;
-
- //m_stats = ptr; //Maybe: addPadding(num,ptr);
-
- if (m_scores != NULL) delete [] m_scores;
- m_readCount = ret;
- m_scores = new ReadScore[m_readCount];
- for (int i=0; i<m_readCount; i++)
- {
- //memcpy(m_scores+i, ptr+i, sizeof(SceNpScoreRankData));
- initReadScoreStruct(m_scores[i], ptr[i]);
- //fromBase32(m_scores+i, comments+i);
- fillReadScoreStruct(m_scores[i], comments[i]);
- }
-
- m_eStatsState = eStatsState_Ready;
- return true;
-
- // Error.
-error2:
- if (ret!=SCE_NP_COMMUNITY_ERROR_ABORTED) //0x8002a109
- sceNpScoreDeleteRequest(m_requestId);
- m_requestId = 0;
-
- delete [] ptr;
- delete [] comments;
-error1:
- if (m_eStatsState != eStatsState_Canceled) m_eStatsState = eStatsState_Failed;
- //app.DebugPrintf("[LeaderboardManager]\tgetScoreByRange() failed, ret=0x%X\n", ret);
- return false;
+ return sceNpScoreCreateRequest(titleContext);
}
-bool PSVitaLeaderboardManager::setScore()
+HRESULT PSVitaLeaderboardManager::abortTransactionContext(int transactionContext)
{
- int ret;
- SceNpId npId;
- int32_t writeTitleContext = 0;
- SceNpScoreRankNumber tmp = 0;
- SceNpScoreComment comment;
-
- // Get next job.
-
- EnterCriticalSection(&m_csViewsLock);
- RegisterScore rscore = m_views.front();
- m_views.pop();
- LeaveCriticalSection(&m_csViewsLock);
-
- if ( ProfileManager.IsGuest(rscore.m_iPad) )
- {
- app.DebugPrintf("[LeaderboardManager] setScore(): m_iPad[%i] is guest.\n", rscore.m_iPad);
- return true;
- }
-
- ProfileManager.GetSceNpId(rscore.m_iPad, &npId);
- writeTitleContext = sceNpScoreCreateTitleCtx( &s_npCommunicationId, &s_npCommunicationPassphrase, &npId);
- if (writeTitleContext < 0)
- {
- app.DebugPrintf("[LeaderboardManager] setScore(): sceNpScoreCreateTitleCtx FAILED, ret == %X.\n", ret);
- return false;
- }
-
- ret = sceNpScoreCreateRequest(writeTitleContext);
-
- // Start emptying queue if leaderboards has been closed.
- if (ret == SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED)
- {
- EnterCriticalSection(&m_csViewsLock);
- m_views.pop();
- LeaveCriticalSection(&m_csViewsLock);
- }
-
- // Error handling.
- if (ret<0)
- {
- app.DebugPrintf("[LeaderboardManager] setScore() FAILED, ret=0x%X\n", ret);
- sceNpScoreDestroyTitleCtx(writeTitleContext);
- return false;
- }
- m_requestId = ret;
- app.DebugPrintf("[LeaderboardManager] REQUEST ID C = 0x%X\n",m_requestId );
-
- toBase32(&comment, (void *) &rscore.m_commentData);
-
- int boardId = getBoardId(rscore.m_difficulty, rscore.m_commentData.m_statsType);
- ret = sceNpScoreRecordScore(
- m_requestId, // transId,
- boardId, // boardId,
- rscore.m_score, //IN: new score,
-
- &comment, // Comments
- NULL, // GameInfo
-
- &tmp, //OUT: current rank,
- NULL, //compareDate
-
- NULL // Reserved, specify null.
- );
-
- if (ret==SCE_NP_COMMUNITY_SERVER_ERROR_NOT_BEST_SCORE) //0x8002A415
- {
- app.DebugPrintf("[LeaderboardManager] setScore(), doesn't beat current score, %i.\n", tmp);
- }
- else if (ret==SCE_NP_COMMUNITY_ERROR_ABORTED) goto error1;//0x8002a109
- else if (ret<0) goto error2;
- else
- {
- app.DebugPrintf("[LeaderboardManager] setScore(), success. boardId=%i, score=%i\n", boardId, rscore.m_score);
- }
-
- // Return.
- sceNpScoreDeleteRequest(m_requestId);
- m_requestId = 0;
- //m_eStatsState = eStatsState_Idle;
- return true;
-
- // Error.
-error2:
- sceNpScoreDeleteRequest(m_requestId);
- m_requestId = 0;
-error1:
- app.DebugPrintf("[LeaderboardManager] setScore() FAILED, ret=0x%X\n", ret);
- sceNpScoreDestroyTitleCtx(writeTitleContext);
- return false;
-}
-
-void PSVitaLeaderboardManager::Tick()
-{
- ReadView view;
-
- switch( m_eStatsState )
- {
- case eStatsState_Ready:
- {
- assert(m_scores != NULL || m_readCount == 0);
-
- view.m_numQueries = m_readCount;
- view.m_queries = m_scores;
-
- // 4J-JEV: Debugging.
- //LeaderboardManager::printStats(view);
-
- eStatsReturn ret = eStatsReturn_NoResults;
- if (view.m_numQueries > 0)
- ret = eStatsReturn_Success;
-
- if (m_readListener != NULL)
- {
- app.DebugPrintf("[LeaderboardManager] OnStatsReadComplete(%i, %i, _), m_readCount=%i.\n", ret, m_maxRank, m_readCount);
- m_readListener->OnStatsReadComplete(ret, m_maxRank, view);
- }
-
- m_eStatsState = eStatsState_Idle;
-
- delete [] m_scores;
- m_scores = NULL;
- }
- break;
-
- case eStatsState_Failed:
- {
- view.m_numQueries = 0;
- view.m_queries = NULL;
-
- if ( m_readListener != NULL )
- m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError, 0, view);
-
- m_eStatsState = eStatsState_Idle;
- }
- break;
-
- case eStatsState_Canceled:
- {
- m_eStatsState = eStatsState_Idle;
- }
- break;
-
- default: // Getting or Idle.
- break;
- }
-}
-
-bool PSVitaLeaderboardManager::OpenSession()
-{
- if (m_openSessions == 0)
- {
- if (m_threadScoreboard == NULL)
- {
- m_threadScoreboard = new C4JThread(&scoreboardThreadEntry, this, "4JScoreboard");
- m_threadScoreboard->SetProcessor(CPU_CORE_LEADERBOARDS);
- m_threadScoreboard->SetPriority(THREAD_PRIORITY_BELOW_NORMAL);
- m_threadScoreboard->Run();
- }
-
- app.DebugPrintf("[LeaderboardManager] OpenSession(): Starting sceNpScore utility.\n");
- }
- else
- {
- app.DebugPrintf("[LeaderboardManager] OpenSession(): Another session opened, total=%i\n", m_openSessions+1);
- }
-
- m_openSessions++;
- return true;
-}
-
-void PSVitaLeaderboardManager::CloseSession()
-{
- m_openSessions--;
-
- if (m_openSessions == 0) app.DebugPrintf("[LeaderboardManager] CloseSession(): Quitting sceNpScore utility.\n");
- else app.DebugPrintf("[LeaderboardManager] CloseSession(): %i sessions still open.\n", m_openSessions);
-}
-
-void PSVitaLeaderboardManager::DeleteSession() {}
-
-bool PSVitaLeaderboardManager::WriteStats(unsigned int viewCount, ViewIn views)
-{
- // Need to cancel read/write operation first.
- //if (m_eStatsState != eStatsState_Idle) return false;
-
- // Write relevant parameters.
- //RegisterScore *regScore = reinterpret_cast<RegisterScore *>(views);
-
- EnterCriticalSection(&m_csViewsLock);
- for (int i=0; i<viewCount; i++)
- {
- app.DebugPrintf("[LeaderboardManager] WriteStats(), starting. difficulty=%i, statsType=%i, score=%i\n",
- views[i].m_difficulty, views[i].m_commentData.m_statsType, views[i].m_score);
-
- m_views.push(views[i]);
- }
- LeaveCriticalSection(&m_csViewsLock);
-
- delete [] views; //*regScore;
-
- //m_eStatsState = eStatsState_Writing;
- return true;
-}
-
-// myUID ignored on PS3.
-bool PSVitaLeaderboardManager::ReadStats_Friends(LeaderboardReadListener *listener, int difficulty, EStatsType type, PlayerUID myUID, unsigned int startIndex, unsigned int readCount)
-{
- // Need to cancel read/write operation first.
- if (m_eStatsState != eStatsState_Idle) return false;
- if (!LeaderboardManager::ReadStats_Friends(listener, difficulty, type, myUID, startIndex, readCount)) return false;
-
- //int ret = sceNpManagerGetNpId(&m_myNpId);
- //if (ret<0) return false;
-
- m_eStatsState = eStatsState_Getting;
- return true;
-}
-
-// myUID ignored on PS3.
-bool PSVitaLeaderboardManager::ReadStats_MyScore(LeaderboardReadListener *listener, int difficulty, EStatsType type, PlayerUID myUID, unsigned int readCount)
-{
- // Need to cancel read/write operation first.
- if (m_eStatsState != eStatsState_Idle) return false;
- if (!LeaderboardManager::ReadStats_MyScore(listener, difficulty, type, myUID, readCount)) return false;
-
- //int ret = sceNpManagerGetNpId(&m_myNpId);
- //if (ret<0) return false;
-
- m_eStatsState = eStatsState_Getting;
- return true;
-}
-
-// myUID ignored on PS3.
-bool PSVitaLeaderboardManager::ReadStats_TopRank(LeaderboardReadListener *listener, int difficulty, EStatsType type, unsigned int startIndex, unsigned int readCount)
-{
- // Need to cancel read/write operation first.
- if (m_eStatsState != eStatsState_Idle) return false;
- if (!LeaderboardManager::ReadStats_TopRank(listener, difficulty, type, startIndex, readCount)) return false;
- m_eStatsState = eStatsState_Getting;
- return true;
-}
-
-void PSVitaLeaderboardManager::FlushStats() {}
-
-void PSVitaLeaderboardManager::CancelOperation()
-{
- m_readListener = NULL;
- m_eStatsState = eStatsState_Canceled;
-
- if (m_requestId != 0)
- {
- int ret = sceNpScoreAbortRequest(m_requestId);
-
- if (ret < 0)
- {
- app.DebugPrintf("[LeaderboardManager] CancelOperation(): Problem encountered aborting current operation, 0x%X.\n", ret);
- }
- else
- {
- app.DebugPrintf("[LeaderboardManager] CancelOperation(): Operation aborted successfully.\n");
- }
- }
- else
- {
- app.DebugPrintf("[LeaderboardManager] CancelOperation(): No current operation.\n");
- }
-}
-
-bool PSVitaLeaderboardManager::isIdle()
-{
- return m_eStatsState == eStatsState_Idle;
-}
-
-int PSVitaLeaderboardManager::getBoardId(int difficulty, EStatsType statsType)
-{
- switch (statsType)
- {
- case eStatsType_Travelling:
- if (0 <= difficulty && difficulty < 4) return 1 + difficulty; // [1,2,3,4]
- else return -1;
-
- case eStatsType_Mining:
- if (0 <= difficulty && difficulty < 4) return 5 + difficulty; // [5,6,7,8]
- else return -1;
-
- case eStatsType_Farming:
- if (0 <= difficulty && difficulty < 4) return 9 + difficulty; // [9,10,11,12]
- else return -1;
-
- case eStatsType_Kills:
- if (1 <= difficulty && difficulty < 4) return 13 + difficulty - 1; // [13,14,15,16]
- else return -1;
-
- default: return -1;
- }
-}
-
-// 4J-JEV: Filter out all friends who don't have scores.
-/*
-SceNpScoreRankData *PSVitaLeaderboardManager::filterJustScorers(unsigned int &num, SceNpScorePlayerRankData *friendsData)
-{
-int num2 = 0;
-for (int i=0; i<num; i++) if (friendsData[i].hasData) num2++;
-num = num2; num2 = 0;
-SceNpScoreRankData *out = new SceNpScoreRankData[num];
-for (int i=0; i<num; i++) if (friendsData[i].hasData) out[num2++] = friendsData[i].rankData;
-return out;
-} */
-
-// 4J-JEV: Unused, here if we want to switch LeaderboardManager::ViewOut to 'SceNpScorePlayerRankData'.
-SceNpScorePlayerRankData *PSVitaLeaderboardManager::addPadding(unsigned int num, SceNpScoreRankData *rankData)
-{
- SceNpScorePlayerRankData *out = new SceNpScorePlayerRankData[num];
- for (int i=0; i<num; i++)
- {
- out[i].hasData = true;
- out[i].rankData = rankData[i];
- }
- delete [] rankData;
- return out;
-}
-
-// 4J-JEV: Filter and create output object.
-void PSVitaLeaderboardManager::convertToOutput(unsigned int &num, ReadScore *out, SceNpScorePlayerRankData *rankData, SceNpScoreComment *comm)
-{
- int j=0;
- for (int i=0; i<num; i++)
- {
- if (rankData[i].hasData)
- {
- initReadScoreStruct( out[j], rankData[i].rankData );
- fillReadScoreStruct( out[j], comm[i] );
-
- j++;
- }
- }
-
- num = j;
-}
-
-void PSVitaLeaderboardManager::toBinary(void *out, SceNpScoreComment *in)
-{
- string decoded = base64_decode( string((char*)in) );
- memcpy(out, decoded.c_str(), RECORD_SIZE);
-}
-
-void PSVitaLeaderboardManager::fromBinary(SceNpScoreComment **out, void *in)
-{
- *out = (SceNpScoreComment *) new unsigned char[SCE_NP_SCORE_COMMENT_MAXLEN + 1];
- string encoded = base64_encode((unsigned char const *) in, RECORD_SIZE);
- memcpy(out, encoded.c_str(), SCE_NP_SCORE_COMMENT_MAXLEN);
-}
-
-void PSVitaLeaderboardManager::toBase32(SceNpScoreComment *out, void *in)
-{
- ZeroMemory(out,sizeof(SceNpScoreComment));
- PBYTE bytes = (PBYTE) in;
- char *chars = out->utf8Comment;
-
- for (int i = 0; i < SCE_NP_SCORE_COMMENT_MAXLEN; i++)
- {
- int sByte = (i*5) / 8;
- int eByte = (5+(i*5)) / 8;
- int dIndex = (i*5) % 8;
-
- unsigned char fivebits = 0;
-
- fivebits = *(bytes+sByte) << dIndex;
-
- if (eByte != sByte)
- fivebits = fivebits | *(bytes+eByte) >> (8-dIndex);
-
- fivebits = (fivebits>>3) & 0x1F;
-
- if (fivebits < 10) // 0 - 9
- chars[i] = '0' + fivebits;
- else if (fivebits < 32) // A - V
- chars[i] = 'A' + (fivebits-10);
- else
- assert(false);
- }
-
- toSymbols(out->utf8Comment);
+ return sceNpScoreAbortRequest(transactionContext);
}
-void PSVitaLeaderboardManager::fromBase32(void *out, SceNpScoreComment *in)
+HRESULT PSVitaLeaderboardManager::destroyTransactionContext(int transactionContext)
{
- PBYTE bytes = (PBYTE) out;
- ZeroMemory(bytes, RECORD_SIZE);
-
- fromSymbols(in->utf8Comment);
-
- char ch[2] = { 0, 0 };
- for (int i = 0; i < SCE_NP_SCORE_COMMENT_MAXLEN; i++)
- {
- ch[0] = in->utf8Comment[i];
- unsigned char fivebits = strtol(ch, NULL, 32) << 3;
-
- int sByte = (i*5) / 8;
- int eByte = (5+(i*5)) / 8;
- int dIndex = (i*5) % 8;
-
- *(bytes + sByte) = *(bytes+sByte) | (fivebits >> dIndex);
-
- if (eByte != sByte)
- *(bytes + eByte) = fivebits << (8-dIndex);
- }
+ return sceNpScoreDeleteRequest(transactionContext);
}
-char symbBase32[32] = {
- ' ', '!','\"', '#', '$', '%', '&','\'', '(', ')',
- '*', '+', '`', '-', '.', '/', ':', ';', '<', '=',
- '>', '?', '[','\\', ']', '^', '_', '{', '|', '}',
- '~', '@'
-};
-
-char charBase32[32] = {
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
- 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
- 'U', 'V'
-};
-
-void PSVitaLeaderboardManager::toSymbols(char *str)
+HRESULT PSVitaLeaderboardManager::getFriendsList(sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::FriendsList> &friendsList)
{
- for (int i = 0; i < 63; i++)
- {
- for (int j=0; j < 32; j++)
- {
- if (str[i]==charBase32[j])
- str[i] =symbBase32[j];
- }
- }
-}
-
-void PSVitaLeaderboardManager::fromSymbols(char *str)
-{
- for (int i = 0; i < 63; i++)
- {
- for (int j=0; j < 32; j++)
- {
- if (str[i]==symbBase32[j])
- str[i] =charBase32[j];
- }
- }
-}
-
-bool PSVitaLeaderboardManager::test_string(string testing)
-{
-#ifndef _CONTENT_PACKAGE
- static SceNpScoreComment comment;
- ZeroMemory(&comment, sizeof(SceNpScoreComment));
- memcpy(&comment, testing.c_str(), SCE_NP_SCORE_COMMENT_MAXLEN);
-
- int ctx = sceNpScoreCreateRequest(m_titleContext);
- if (ctx<0) return false;
-
- int ret = sceNpScoreCensorComment(ctx, (const char *) &comment, NULL);
-
- if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED)
- {
- //app.DebugPrintf("\n[TEST_STRING]: REJECTED ");
- }
- else if (ret < 0)
- {
- sceNpScoreDeleteRequest(ctx);
- return false;
- }
- else
- {
- //app.DebugPrintf("\n[TEST_STRING]: permitted ");
- }
-
- //app.DebugPrintf("'%s'\n", comment.utf8Comment);
- sceNpScoreDeleteRequest(ctx);
- return true;
-#else
- return true;
-#endif
-}
-
-void PSVitaLeaderboardManager::initReadScoreStruct(ReadScore &out, SceNpScoreRankData &rankData)
-{
- ZeroMemory(&out, sizeof(ReadScore));
-
- // Init rank and onlineID
- out.m_uid.setOnlineID( rankData.npId.handle, true );
- out.m_rank = rankData.rank;
-
- // Convert to wstring and copy name.
- wstring wstrName = convStringToWstring( string(rankData.npId.handle.data) ).c_str();
- //memcpy(&out.m_name, wstrName.c_str(), XUSER_NAME_SIZE);
- out.m_name=wstrName;
-}
-
-void PSVitaLeaderboardManager::fillReadScoreStruct(ReadScore &out, SceNpScoreComment &comment)
-{
- StatsData statsData;
- fromBase32( (void *) &statsData, &comment );
-
- switch (statsData.m_statsType)
- {
- case eStatsType_Farming:
- out.m_statsSize = 6;
- out.m_statsData[0] = statsData.m_farming.m_eggs;
- out.m_statsData[1] = statsData.m_farming.m_wheat;
- out.m_statsData[2] = statsData.m_farming.m_mushroom;
- out.m_statsData[3] = statsData.m_farming.m_sugarcane;
- out.m_statsData[4] = statsData.m_farming.m_milk;
- out.m_statsData[5] = statsData.m_farming.m_pumpkin;
- break;
- case eStatsType_Mining:
- out.m_statsSize = 7;
- out.m_statsData[0] = statsData.m_mining.m_dirt;
- out.m_statsData[1] = statsData.m_mining.m_cobblestone;
- out.m_statsData[2] = statsData.m_mining.m_sand;
- out.m_statsData[3] = statsData.m_mining.m_stone;
- out.m_statsData[4] = statsData.m_mining.m_gravel;
- out.m_statsData[5] = statsData.m_mining.m_clay;
- out.m_statsData[6] = statsData.m_mining.m_obsidian;
- break;
- case eStatsType_Kills:
- out.m_statsSize = 7;
- out.m_statsData[0] = statsData.m_kills.m_zombie;
- out.m_statsData[1] = statsData.m_kills.m_skeleton;
- out.m_statsData[2] = statsData.m_kills.m_creeper;
- out.m_statsData[3] = statsData.m_kills.m_spider;
- out.m_statsData[4] = statsData.m_kills.m_spiderJockey;
- out.m_statsData[5] = statsData.m_kills.m_zombiePigman;
- out.m_statsData[6] = statsData.m_kills.m_slime;
- break;
- case eStatsType_Travelling:
- out.m_statsSize = 4;
- out.m_statsData[0] = statsData.m_travelling.m_walked;
- out.m_statsData[1] = statsData.m_travelling.m_fallen;
- out.m_statsData[2] = statsData.m_travelling.m_minecart;
- out.m_statsData[3] = statsData.m_travelling.m_boat;
- break;
- }
+ return sce::Toolkit::NP::Friends::Interface::getFriendslist(&friendsList, false);
}
-bool PSVitaLeaderboardManager::SortByRank(const ReadScore &lhs, const ReadScore &rhs)
+char *PSVitaLeaderboardManager::getComment(SceNpScoreComment *comment)
{
- return lhs.m_rank < rhs.m_rank;
+ return comment->utf8Comment;
} \ No newline at end of file
diff --git a/Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.h b/Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.h
index 9038b277..8101aa31 100644
--- a/Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.h
+++ b/Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.h
@@ -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;
-
- C4JThread *m_threadScoreboard;
- bool m_running;
-
- int m_titleContext;
- int32_t m_requestId;
-
- //SceNpId m_myNpId;
-
- static int scoreboardThreadEntry(LPVOID lpParam);
- void scoreboardThreadInternal();
-
- bool getScoreByIds();
- bool getScoreByRange();
-
- bool setScore();
- queue<RegisterScore> m_views;
-
- CRITICAL_SECTION m_csViewsLock;
-
- EStatsState m_eStatsState; //State of the stats read
- // EFilterMode m_eFilterMode;
-
- 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);
+protected:
- //LeaderboardManager::ReadScore *filterJustScorers(unsigned int &num, LeaderboardManager::ReadScore *friendsData);
+ virtual HRESULT initialiseScoreUtility();
- SceNpScorePlayerRankData *addPadding(unsigned int num, SceNpScoreRankData *rankData);
+ virtual bool scoreUtilityAlreadyInitialised(HRESULT hr);
- void convertToOutput(unsigned int &num, ReadScore *out, SceNpScorePlayerRankData *rankData, SceNpScoreComment *comm);
+ virtual HRESULT createTitleContext(const SceNpId &npId);
- void toBinary(void *out, SceNpScoreComment *in);
- void fromBinary(SceNpScoreComment **out, void *in);
+ virtual HRESULT destroyTitleContext(int titleContext);
- void toBase32(SceNpScoreComment *out, void *in);
- void fromBase32(void *out, SceNpScoreComment *in);
+ virtual HRESULT createTransactionContext(int titleContext);
- void toSymbols(char *);
- void fromSymbols(char *);
+ virtual HRESULT abortTransactionContext(int transactionContext);
- bool test_string(string);
+ virtual HRESULT destroyTransactionContext(int transactionContext);
- void initReadScoreStruct(ReadScore &out, SceNpScoreRankData &);
- void fillReadScoreStruct(ReadScore &out, SceNpScoreComment &comment);
+ virtual HRESULT getFriendsList(sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::FriendsList> &friendsList);
- static bool SortByRank(const ReadScore &lhs, const ReadScore &rhs);
+ virtual char * getComment(SceNpScoreComment *comment);
};
diff --git a/Minecraft.Client/PSVita/Network/PSVita_NPToolkit.cpp b/Minecraft.Client/PSVita/Network/PSVita_NPToolkit.cpp
index fb859761..1c5c45e3 100644
--- a/Minecraft.Client/PSVita/Network/PSVita_NPToolkit.cpp
+++ b/Minecraft.Client/PSVita/Network/PSVita_NPToolkit.cpp
@@ -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;
diff --git a/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp b/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp
index 2b2ccec8..9a95ee08 100644
--- a/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp
+++ b/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp
@@ -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 )
- {
- // Data always going from a remote player, to the host
- playerFrom = manager->GetPlayerFromRudpCtx( ctx_id );
- playerTo = manager->m_aRoomSlotPlayers[0];
- }
- else
+ unsigned char *data = new unsigned char [ dataSize ];
+ int bytesRead = playerIncomingData->ReadDataPacket( data, dataSize );
+ if( bytesRead > 0 )
{
- // 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;
}
-} \ No newline at end of file
+}
+
diff --git a/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.h b/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.h
index 7d9948c9..c1b2d266 100644
--- a/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.h
+++ b/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.h
@@ -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;
diff --git a/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.cpp b/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.cpp
index 6a4e2c72..8182674a 100644
--- a/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.cpp
+++ b/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.cpp
@@ -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()
diff --git a/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.h b/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.h
index 592919d4..0fd0b414 100644
--- a/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.h
+++ b/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.h
@@ -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();
diff --git a/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.cpp b/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.cpp
index 870930f6..09852ccb 100644
--- a/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.cpp
+++ b/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.cpp
@@ -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;
diff --git a/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.h b/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.h
index ad114796..6285832c 100644
--- a/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.h
+++ b/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.h
@@ -201,4 +201,7 @@ public:
static bool getPurchasabilityUpdated();
static bool getDLCUpgradePending();
+ virtual void ShowPsStoreIcon();
+ virtual void HidePsStoreIcon();
+
};
diff --git a/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp b/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp
index 3d9483d2..c103b32f 100644
--- a/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp
+++ b/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp
@@ -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)
diff --git a/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.h b/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.h
index 9c636e41..13b37e3e 100644
--- a/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.h
+++ b/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.h
@@ -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];
diff --git a/Minecraft.Client/PSVita/PSVitaExtras/PsVitaStubs.cpp b/Minecraft.Client/PSVita/PSVitaExtras/PsVitaStubs.cpp
index 87c59535..b9668250 100644
--- a/Minecraft.Client/PSVita/PSVitaExtras/PsVitaStubs.cpp
+++ b/Minecraft.Client/PSVita/PSVitaExtras/PsVitaStubs.cpp
@@ -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)
diff --git a/Minecraft.Client/PSVita/PSVita_App.cpp b/Minecraft.Client/PSVita/PSVita_App.cpp
index a21699c0..48aa25c4 100644
--- a/Minecraft.Client/PSVita/PSVita_App.cpp
+++ b/Minecraft.Client/PSVita/PSVita_App.cpp
@@ -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;
diff --git a/Minecraft.Client/PSVita/PSVita_App.h b/Minecraft.Client/PSVita/PSVita_App.h
index 9a01a610..209fb91a 100644
--- a/Minecraft.Client/PSVita/PSVita_App.h
+++ b/Minecraft.Client/PSVita/PSVita_App.h
@@ -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;
diff --git a/Minecraft.Client/PSVita/PSVita_Minecraft.cpp b/Minecraft.Client/PSVita/PSVita_Minecraft.cpp
index ee13a216..a82adf00 100644
--- a/Minecraft.Client/PSVita/PSVita_Minecraft.cpp
+++ b/Minecraft.Client/PSVita/PSVita_Minecraft.cpp
@@ -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;
diff --git a/Minecraft.Client/PSVita/Sentient/TelemetryEnum.h b/Minecraft.Client/PSVita/Sentient/TelemetryEnum.h
index 77d39a39..3c120f13 100644
--- a/Minecraft.Client/PSVita/Sentient/TelemetryEnum.h
+++ b/Minecraft.Client/PSVita/Sentient/TelemetryEnum.h
@@ -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
}; \ No newline at end of file
diff --git a/Minecraft.Client/PSVita/Sound/Minecraft.msscmp b/Minecraft.Client/PSVita/Sound/Minecraft.msscmp
index a103fac1..0d0df508 100644
--- a/Minecraft.Client/PSVita/Sound/Minecraft.msscmp
+++ b/Minecraft.Client/PSVita/Sound/Minecraft.msscmp
Binary files differ
diff --git a/Minecraft.Client/PSVita/Tutorial/Tutorial.mcs b/Minecraft.Client/PSVita/Tutorial/Tutorial.mcs
new file mode 100644
index 00000000..df6af967
--- /dev/null
+++ b/Minecraft.Client/PSVita/Tutorial/Tutorial.mcs
Binary files differ
diff --git a/Minecraft.Client/PSVita/Tutorial/Tutorial.pck b/Minecraft.Client/PSVita/Tutorial/Tutorial.pck
new file mode 100644
index 00000000..edcf171d
--- /dev/null
+++ b/Minecraft.Client/PSVita/Tutorial/Tutorial.pck
Binary files differ
diff --git a/Minecraft.Client/PSVita/app/Region/SCEA/param.sfo b/Minecraft.Client/PSVita/app/Region/SCEA/param.sfo
index e1bf4c4c..ad95a296 100644
--- a/Minecraft.Client/PSVita/app/Region/SCEA/param.sfo
+++ b/Minecraft.Client/PSVita/app/Region/SCEA/param.sfo
Binary files differ
diff --git a/Minecraft.Client/PSVita/app/Region/SCEE/param.sfo b/Minecraft.Client/PSVita/app/Region/SCEE/param.sfo
index 0483a017..b1ffcbab 100644
--- a/Minecraft.Client/PSVita/app/Region/SCEE/param.sfo
+++ b/Minecraft.Client/PSVita/app/Region/SCEE/param.sfo
Binary files differ
diff --git a/Minecraft.Client/PSVita/app/Region/SCEJ/param.sfo b/Minecraft.Client/PSVita/app/Region/SCEJ/param.sfo
index c2c21805..7a457568 100644
--- a/Minecraft.Client/PSVita/app/Region/SCEJ/param.sfo
+++ b/Minecraft.Client/PSVita/app/Region/SCEJ/param.sfo
Binary files differ