first buildable orbis version. a bit ugly.

This commit is contained in:
552eden
2026-07-17 19:24:48 +03:00
parent eb3ae69d3f
commit 1bd4a3455c
15 changed files with 3690 additions and 77 deletions
+14 -5
View File
@@ -1976,8 +1976,9 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
}
}
#else // __ORBIS__
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::FriendsList> friendList;
/*
//sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::FriendsList> friendList;
std::vector<sce::Toolkit::NP::FriendsList> friendList;
sce::Toolkit::NP::FriendInfoRequest requestParam;
memset(&requestParam,0,sizeof(requestParam));
@@ -1986,14 +1987,16 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
requestParam.offset = 0;
requestParam.userInfo.userId = ProfileManager.getUserID(ProfileManager.GetPrimaryPad());
int ret = sce::Toolkit::NP::Friends::Interface::getFriendslist(&friendList, &requestParam, false);
//int ret = sce::Toolkit::NP::Friends::Interface::getFriendslist(&friendList, &requestParam, false);
int ret = 42069;
if( ret == 0 )
{
if( friendList.hasResult() )
if( friendList.hasResult())
{
friendCount = friendList.get()->size();
}
}
}*/
int ret = 42069;
#endif
if( ret == 0 )
{
@@ -2003,12 +2006,18 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
{
#ifdef __PS3__
ret = sceNpBasicGetFriendListEntry( i, &npid );
#elif defined __ORBIS__
//dont touch npid
#else
npid = friendList.get()->at(i).npid;
#endif
if( ret == 0 )
{
#ifndef __ORBIS__
if(strcmp(npid.handle.data, packet->m_playerXuids[packet->m_hostIndex].getOnlineID()) == 0)
#else
if(1==2)
#endif
{
isFriend = true;
break;
@@ -204,11 +204,11 @@ HRESULT SonyLeaderboardManager::fillByIdsQuery(const SceNpId &myNpId, SceNpId* &
case eFM_Friends:
{
// 4J-JEV: Implementation for Orbis & Vita as they a very similar.
#if (defined __ORBIS__) || (defined __PSVITA__)
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::FriendsList> s_friendList;
ret = getFriendsList(s_friendList);
#if (defined __PSVITA__)
std::vector<sce::Toolkit::NP::FriendsList> s_friendList;
//ret = getFriendsList(s_friendList);
ret = 42069;
if(ret != SCE_TOOLKIT_NP_SUCCESS)
{
// Error handling
@@ -246,7 +246,11 @@ HRESULT SonyLeaderboardManager::fillByIdsQuery(const SceNpId &myNpId, SceNpId* &
npIds[0] = myNpId;
}
#elif (defined __ORBIS__)
// Error handling
if (m_eStatsState != eStatsState_Canceled) m_eStatsState = eStatsState_Failed;
app.DebugPrintf("[SonyLeaderboardManager] 'getFriendslist' fail, 0x%x.\n", ret);
return false;
#elif (defined __PS3__)
// PS3
@@ -10,7 +10,9 @@
#include "..\..\TexturePack.h"
#include "..\..\DLCTexturePack.h"
#include "..\..\..\Minecraft.World\StringHelpers.h"
#if defined(__ORBIS__)
#include "..\..\OrbisMedia\strings.h"
#endif
#ifndef _XBOX
#include "UI.h"
#endif
@@ -2,7 +2,9 @@
#include "UI.h"
#include "UIComponent_PressStartToPlay.h"
#include "..\..\..\Minecraft.World\StringHelpers.h"
#if defined(__ORBIS__)
#include "..\..\OrbisMedia\strings.h"
#endif
UIComponent_PressStartToPlay::UIComponent_PressStartToPlay(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
{
// Setup all the Iggy references we need for this scene
@@ -23,6 +23,10 @@
#include "Xbox\Resource.h"
#endif
#if defined(__ORBIS__)
#include "..\..\OrbisMedia\strings.h"
#endif
#define GAME_CREATE_ONLINE_TIMER_ID 0
#define GAME_CREATE_ONLINE_TIMER_TIME 100
@@ -12,9 +12,13 @@
// Singleton
OrbisNPToolkit NPToolkit;
#ifndef __ORBIS__ // sce::Toolkit::NP::Utilities::Future is not implemented in SDK 1.70
sce::Toolkit::NP::Utilities::Future< sce::Toolkit::NP::NpSessionInformation > OrbisNPToolkit::sm_createJoinFuture;
#endif
sce::Toolkit::NP::NpSessionInformation OrbisNPToolkit::m_currentSessionInfo;
#ifndef __ORBIS__
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::MessageAttachment> OrbisNPToolkit::m_messageData;
#endif
void OrbisNPToolkit::presenceCallback( const sce::Toolkit::NP::Event& event )
@@ -130,29 +134,53 @@ void OrbisNPToolkit::sessionsCallback( const sce::Toolkit::NP::Event& event)
{
case sce::Toolkit::NP::Event::npSessionCreateResult: ///< An event generated when the %Np session creation process has been completed.
app.DebugPrintf("npSessionCreateResult");
if(sm_createJoinFuture.hasResult())
#ifdef __ORBIS__
// sce::Toolkit::NP::Utilities::Future is not implemented in SDK 1.70 -
// no way to retrieve the NpSessionInformation payload; m_currentSessionInfo stays zeroed.
if(event.returnCode >= 0)
{
app.DebugPrintf("Session Created Successfully\n");
}
else
{
app.DebugPrintf("Session Creation Failed 0x%x\n",event.returnCode);
}
#else
if(sm_createJoinFuture.hasResult())
{
app.DebugPrintf("Session Created Successfully\n");
m_currentSessionInfo = *sm_createJoinFuture.get();
}
else
}
else
{
app.DebugPrintf("Session Creation Failed 0x%x\n",sm_createJoinFuture.getError());
}
sm_createJoinFuture.reset();
#endif
break;
case sce::Toolkit::NP::Event::npSessionJoinResult: ///< An event generated when the join %Np session process has been completed.
app.DebugPrintf("npSessionJoinResult");
if(sm_createJoinFuture.hasResult())
#ifdef __ORBIS__
if(event.returnCode >= 0)
{
app.DebugPrintf("Session joined successfully\n");
}
else
{
app.DebugPrintf("Session join Failed 0x%x\n",event.returnCode);
}
#else
if(sm_createJoinFuture.hasResult())
{
app.DebugPrintf("Session joined successfully\n");
m_currentSessionInfo = *sm_createJoinFuture.get();
}
else
}
else
{
app.DebugPrintf("Session join Failed 0x%x\n",sm_createJoinFuture.getError());
}
sm_createJoinFuture.reset();
#endif
break;
case sce::Toolkit::NP::Event::npSessionError: ///< An event generated when there was error performing the current %Np session process.
app.DebugPrintf("npSessionError");
@@ -207,6 +235,12 @@ void OrbisNPToolkit::gameCustomDataCallback( const sce::Toolkit::NP::Event& even
break;
case sce::Toolkit::NP::Event::gameCustomDataGameDataResult:
app.DebugPrintf("gameCustomDataGameDataResult");
#ifdef __ORBIS__
// sce::Toolkit::NP::Utilities::Future is not implemented in SDK 1.70 -
// the MessageAttachment payload can't be retrieved, so invite data is unavailable.
app.DebugPrintf("gameCustomDataGameDataResult stubbed (no Future in SDK 1.70), returnCode 0x%08x\n", event.returnCode);
ORBIS_STUBBED;
#else
if(m_messageData.hasResult())
{
SQRNetworkManager_Orbis::GetInviteDataAndProcess(m_messageData.get());
@@ -229,6 +263,7 @@ void OrbisNPToolkit::gameCustomDataCallback( const sce::Toolkit::NP::Event& even
break;
}
}
#endif
break;
case sce::Toolkit::NP::Event::gameCustomDataMessageResult:
app.DebugPrintf("gameCustomDataMessageResult");
@@ -350,6 +385,20 @@ void OrbisNPToolkit::init()
}
// Get network status and inform library
#ifdef __ORBIS__
// sce::Toolkit::NP::Utilities::Future is not implemented in SDK 1.70 -
// query the net state directly instead of going through NetInfo::getNetInfo
int32_t netState = SCE_NET_CTL_STATE_DISCONNECTED;
if (sceNetCtlGetState(&netState) == SCE_OK)
{
ProfileManager.SetNetworkStatus(netState == SCE_NET_CTL_STATE_IPOBTAINED);
}
else
{
// Error means we're disconnected
ProfileManager.SetNetworkStatus(false);
}
#else
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::NetStateBasic> netStateFuture = sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::NetStateBasic>();
sce::Toolkit::NP::NetInfo::Interface::getNetInfo(&netStateFuture);
@@ -369,6 +418,7 @@ void OrbisNPToolkit::init()
// Error message means we're disconnected
ProfileManager.SetNetworkStatus(false);
}
#endif
// // Register Client ID for Auth
// ret = sce::Toolkit::NP::Interface::registerClientId(CLIENT_ID_FOR_SAMPLE);
@@ -409,7 +459,13 @@ void OrbisNPToolkit::createNPSession()
char test[3] = {'R','K','B'};
createSessionRequest.sessionData= test;
createSessionRequest.sessionDataSize = 3;
#ifdef __ORBIS__
// Sessions::Interface::create requires a Future out-param that SDK 1.70 doesn't implement
app.DebugPrintf("createNPSession stubbed (no Future in SDK 1.70)\n");
ORBIS_STUBBED;
#else
ret = sce::Toolkit::NP::Sessions::Interface::create(&createSessionRequest,&sm_createJoinFuture);
#endif
}
@@ -447,12 +503,18 @@ void OrbisNPToolkit::getMessageData(SceNpGameCustomDataEventParam* paramData)
req.itemId = paramData->itemId;
req.userInfo.userId = userId;
#ifdef __ORBIS__
// GameCustomData::Interface::getGameData requires a Future out-param that SDK 1.70 doesn't implement
app.DebugPrintf("getMessageData stubbed (no Future in SDK 1.70)\n");
ORBIS_STUBBED;
#else
ret = sce::Toolkit::NP::GameCustomData::Interface::getGameData(&req, &m_messageData);
if( ret < 0 ) {
//Error handling
} else {
//Error handling
}
#endif
//
@@ -809,7 +809,9 @@ int SQRNetworkManager_Orbis::BasicEventThreadProc( void *lpParameter )
int SQRNetworkManager_Orbis::GetFriendsThreadProc( void* lpParameter )
{
SQRNetworkManager_Orbis *manager = (SQRNetworkManager_Orbis *)lpParameter;
#ifndef __ORBIS__
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::FriendsList> friendList;
#endif
int ret = 0;
manager->m_aFriendSearchResults.clear();
@@ -828,13 +830,13 @@ int SQRNetworkManager_Orbis::GetFriendsThreadProc( void* lpParameter )
requestParam.userInfo.userId = ProfileManager.getUserID(ProfileManager.GetPrimaryPad());
bool async = false;
#ifndef __ORBIS__
ret = sce::Toolkit::NP::Friends::Interface::getFriendslist(&friendList, &requestParam, async);
if(ret != SCE_OK)
{
app.DebugPrintf("getFriendslist failed! 0x%08x\n", ret);
return 0;
}
if (friendList.hasResult())
{
sce::Toolkit::NP::FriendsList::const_iterator iter ;
@@ -851,12 +853,11 @@ int SQRNetworkManager_Orbis::GetFriendsThreadProc( void* lpParameter )
sce::Toolkit::NP::PresenceRequest presenceRequest;
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::PresenceInfo> presenceInfo;
int presenceInfo;
memset(&presenceRequest,0,sizeof(presenceRequest));
strncpy(presenceRequest.onlineId.data,iter->npid.handle.data, strlen(iter->npid.handle.data));
presenceRequest.presenceType = SCE_TOOLKIT_NP_PRESENCE_TYPE_INCONTEXT_INFO;
presenceRequest.userInfo.userId = ProfileManager.getUserID(ProfileManager.GetPrimaryPad());;
ret = sce::Toolkit::NP::Presence::Interface::getPresence(&presenceRequest,&presenceInfo,false);
if( ret < 0 )
{
@@ -903,6 +904,10 @@ int SQRNetworkManager_Orbis::GetFriendsThreadProc( void* lpParameter )
app.DebugPrintf("Check sign-in status\n");
}
#else
app.DebugPrintf( "Friend list is disabled on this build -UbEr\n");
#endif
return 0;
}
@@ -44,9 +44,11 @@ bool SonyCommerce_Orbis::m_bLicenseChecked=false; // Check the trial/
#ifndef __ORBIS__ // sce::Toolkit::NP::Utilities::Future is not implemented in SDK 1.70
sce::Toolkit::NP::Utilities::Future<std::vector<sce::Toolkit::NP::ProductInfo> > g_productList;
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::CategoryInfo> g_categoryInfo;
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::ProductInfoDetailed> g_detailedProductInfo;
#endif
SonyCommerce_Orbis::ProductInfoDetailed s_trialUpgradeProductInfoDetailed;
@@ -180,8 +182,15 @@ int SonyCommerce_Orbis::getProductList(std::vector<ProductInfo>* productList, ch
params.serviceLabel = 0;
app.DebugPrintf("Getting Product List ...\n");
#ifdef __ORBIS__
// Commerce::Interface::getProductList requires a Future out-param that SDK 1.70 doesn't implement -
// report failure so the commerce flow errors out and runs the callback
app.DebugPrintf("getProductList stubbed (no Future in SDK 1.70)\n");
ORBIS_STUBBED;
ret = -1;
#else
ret = sce::Toolkit::NP::Commerce::Interface::getProductList(&g_productList, params, true);
if (ret < 0)
if (ret < 0)
{
app.DebugPrintf("CommerceInterface::getProductList() error. ret = 0x%x\n", ret);
return ret;
@@ -192,7 +201,8 @@ int SonyCommerce_Orbis::getProductList(std::vector<ProductInfo>* productList, ch
// result has returned immediately (don't think this should happen, but was handled in the samples
copyProductList(productList, g_productList.get());
m_event = e_event_commerceGotProductList;
}
}
#endif
return ret;
}
@@ -241,19 +251,27 @@ int SonyCommerce_Orbis::getCategoryInfo(CategoryInfo *pInfo, char *categoryId)
app.DebugPrintf("Getting Category Information...\n");
#ifdef __ORBIS__
// Commerce::Interface::getCategoryInfo requires a Future out-param that SDK 1.70 doesn't implement -
// report failure so the commerce flow errors out and runs the callback
app.DebugPrintf("getCategoryInfo stubbed (no Future in SDK 1.70)\n");
ORBIS_STUBBED;
ret = -1;
#else
ret = sce::Toolkit::NP::Commerce::Interface::getCategoryInfo(&g_categoryInfo, params, true);
if (ret < 0)
if (ret < 0)
{
// error
app.DebugPrintf("Commerce::Interface::getCategoryInfo error: 0x%x\n", ret);
return ret;
}
else if (g_categoryInfo.hasResult())
else if (g_categoryInfo.hasResult())
{
// result has returned immediately (don't think this should happen, but was handled in the samples
copyCategoryInfo(pInfo, g_categoryInfo.get());
m_event = e_event_commerceGotCategoryInfo;
}
#endif
return ret;
}
@@ -289,20 +307,28 @@ int SonyCommerce_Orbis::getDetailedProductInfo(ProductInfoDetailed *pInfo, const
strcpy(params.productId, productId);
app.DebugPrintf("Getting Detailed Product Information ... \n");
app.DebugPrintf("Getting Detailed Product Information ... \n");
#ifdef __ORBIS__
// Commerce::Interface::getDetailedProductInfo requires a Future out-param that SDK 1.70 doesn't implement -
// report failure so the commerce flow errors out and runs the callback
app.DebugPrintf("getDetailedProductInfo stubbed (no Future in SDK 1.70)\n");
ORBIS_STUBBED;
ret = -1;
#else
ret = sce::Toolkit::NP::Commerce::Interface::getDetailedProductInfo(&g_detailedProductInfo, params, true);
if (ret < 0)
if (ret < 0)
{
app.DebugPrintf("CommerceInterface::getDetailedProductInfo() error. ret = 0x%x\n", ret);
return ret;
}
if (g_detailedProductInfo.hasResult())
if (g_detailedProductInfo.hasResult())
{
// result has returned immediately (don't think this should happen, but was handled in the samples
copyDetailedProductInfo(pInfo, g_detailedProductInfo.get());
m_event = e_event_commerceGotDetailedProductInfo;
}
#endif
return ret;
}
@@ -339,19 +365,27 @@ int SonyCommerce_Orbis::addDetailedProductInfo(ProductInfo *pInfo, const char *p
strcpy(params.productId, productId);
app.DebugPrintf("Getting Detailed Product Information ... \n");
app.DebugPrintf("Getting Detailed Product Information ... \n");
#ifdef __ORBIS__
// Commerce::Interface::getDetailedProductInfo requires a Future out-param that SDK 1.70 doesn't implement -
// report failure so the commerce flow errors out and runs the callback
app.DebugPrintf("addDetailedProductInfo stubbed (no Future in SDK 1.70)\n");
ORBIS_STUBBED;
ret = -1;
#else
ret = sce::Toolkit::NP::Commerce::Interface::getDetailedProductInfo(&g_detailedProductInfo, params, true);
if (ret < 0)
if (ret < 0)
{
app.DebugPrintf("CommerceInterface::addDetailedProductInfo() error. ret = 0x%x\n", ret);
}
if (g_detailedProductInfo.hasResult())
if (g_detailedProductInfo.hasResult())
{
// result has returned immediately (don't think this should happen, but was handled in the samples
copyAddDetailedProductInfo(pInfo, g_detailedProductInfo.get());
m_event = e_event_commerceAddedDetailedProductInfo;
}
#endif
return ret;
}
@@ -600,7 +634,7 @@ int SonyCommerce_Orbis::createSession()
//
// sce::Toolkit::NP::Commerce::Interface::CreateSession
//
// This function is provided to maintain compatibility with the PlayStation®Vita and PlayStation®3 platforms. Because commerce on the PlayStation®4 is not session based, SCE_TOOLKIT_NP_SUCCESS is always returned.
// This function is provided to maintain compatibility with the PlayStation�Vita and PlayStation�3 platforms. Because commerce on the PlayStation�4 is not session based, SCE_TOOLKIT_NP_SUCCESS is always returned.
int ret = sce::Toolkit::NP::Commerce::Interface::createSession();
@@ -656,7 +690,12 @@ void SonyCommerce_Orbis::commerce2Handler( const sce::Toolkit::NP::Event& event)
}
case sce::Toolkit::NP::Event::UserEvent::commerceGotCategoryInfo:
{
#ifdef __ORBIS__
// Future payload unavailable in SDK 1.70 - the request is stubbed so this shouldn't fire
app.DebugPrintf("commerceGotCategoryInfo stubbed (no Future in SDK 1.70)\n");
#else
copyCategoryInfo(m_pCategoryInfo, g_categoryInfo.get());
#endif
m_pCategoryInfo = NULL;
m_event = e_event_commerceGotCategoryInfo;
break;
@@ -664,7 +703,12 @@ void SonyCommerce_Orbis::commerce2Handler( const sce::Toolkit::NP::Event& event)
case sce::Toolkit::NP::Event::UserEvent::commerceGotProductList:
{
#ifdef __ORBIS__
// Future payload unavailable in SDK 1.70 - the request is stubbed so this shouldn't fire
app.DebugPrintf("commerceGotProductList stubbed (no Future in SDK 1.70)\n");
#else
copyProductList(m_pProductInfoList, g_productList.get());
#endif
m_pProductInfoDetailed = NULL;
m_event = e_event_commerceGotProductList;
break;
@@ -672,6 +716,12 @@ void SonyCommerce_Orbis::commerce2Handler( const sce::Toolkit::NP::Event& event)
case sce::Toolkit::NP::Event::UserEvent::commerceGotDetailedProductInfo:
{
#ifdef __ORBIS__
// Future payload unavailable in SDK 1.70 - the request is stubbed so this shouldn't fire
app.DebugPrintf("commerceGotDetailedProductInfo stubbed (no Future in SDK 1.70)\n");
m_pProductInfoDetailed = NULL;
m_pProductInfo = NULL;
#else
if(m_pProductInfoDetailed)
{
copyDetailedProductInfo(m_pProductInfoDetailed, g_detailedProductInfo.get());
@@ -682,6 +732,7 @@ void SonyCommerce_Orbis::commerce2Handler( const sce::Toolkit::NP::Event& event)
copyAddDetailedProductInfo(m_pProductInfo, g_detailedProductInfo.get());
m_pProductInfo = NULL;
}
#endif
m_event = e_event_commerceGotDetailedProductInfo;
break;
}
@@ -1145,8 +1196,8 @@ void SonyCommerce_Orbis::CreateSession( CallbackFunc cb, LPVOID lpParam )
setCallback(cb,lpParam);
// We don't need to create a session on PS4, from the Sony docs -
// This function is provided to maintain compatibility with the PlayStation®Vita and PlayStation®3
// platforms. Because commerce on the PlayStation®4 is not session based, SCE_TOOLKIT_NP_SUCCESS is always returned.
// This function is provided to maintain compatibility with the PlayStation�Vita and PlayStation�3
// platforms. Because commerce on the PlayStation�4 is not session based, SCE_TOOLKIT_NP_SUCCESS is always returned.
File diff suppressed because it is too large Load Diff