fix: consoles & dpad being binded to 2 settings

This commit is contained in:
str1k3r committed 2026-09-29 16:41:13 -04:00
1 parent 02da402490
commit fed6871356
150 files changed
+19314 -431

No files matched your search

@@ -12,10 +12,11 @@
// Singleton
OrbisNPToolkit NPToolkit;
#if 0
sce::Toolkit::NP::Utilities::Future< sce::Toolkit::NP::NpSessionInformation > OrbisNPToolkit::sm_createJoinFuture;
sce::Toolkit::NP::NpSessionInformation OrbisNPToolkit::m_currentSessionInfo;
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::MessageAttachment> OrbisNPToolkit::m_messageData;
#endif
void OrbisNPToolkit::presenceCallback( const sce::Toolkit::NP::Event& event )
{
@@ -130,29 +131,25 @@ 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())
if(event.returnCode >= 0)
{
app.DebugPrintf("Session Created Successfully\n");
m_currentSessionInfo = *sm_createJoinFuture.get();
}
else
{
app.DebugPrintf("Session Creation Failed 0x%x\n",sm_createJoinFuture.getError());
}
sm_createJoinFuture.reset();
else
{
app.DebugPrintf("Session Creation Failed 0x%x\n",event.returnCode);
}
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())
if(event.returnCode >= 0)
{
app.DebugPrintf("Session joined successfully\n");
m_currentSessionInfo = *sm_createJoinFuture.get();
}
else
{
app.DebugPrintf("Session join Failed 0x%x\n",sm_createJoinFuture.getError());
}
sm_createJoinFuture.reset();
else
{
app.DebugPrintf("Session join Failed 0x%x\n",event.returnCode);
}
break;
case sce::Toolkit::NP::Event::npSessionError: ///< An event generated when there was error performing the current %Np session process.
app.DebugPrintf("npSessionError");
@@ -206,29 +203,7 @@ void OrbisNPToolkit::gameCustomDataCallback( const sce::Toolkit::NP::Event& even
app.DebugPrintf("gameCustomDataItemListResult");
break;
case sce::Toolkit::NP::Event::gameCustomDataGameDataResult:
app.DebugPrintf("gameCustomDataGameDataResult");
if(m_messageData.hasResult())
{
SQRNetworkManager_Orbis::GetInviteDataAndProcess(m_messageData.get());
}
else
{
app.DebugPrintf("gameCustomDataMessageResult error 0x%08x\n", m_messageData.getError());
UINT uiIDA[1] = { IDS_OK };
switch(m_messageData.getError())
{
case SCE_NP_ERROR_LATEST_PATCH_PKG_EXIST:
case SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED:
app.ShowPatchAvailableError();
break;
case SCE_NP_ERROR_AGE_RESTRICTION:
default:
ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1);
break;
}
}
app.DebugPrintf("gameCustomDataGameDataResult STUB, returnCode 0x%08x\n", event.returnCode);
break;
case sce::Toolkit::NP::Event::gameCustomDataMessageResult:
app.DebugPrintf("gameCustomDataMessageResult");
@@ -350,23 +325,14 @@ void OrbisNPToolkit::init()
}
// Get network status and inform library
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);
// Wait for the net state (< 5ms)
while (netStateFuture.isBusy())
int32_t netState = SCE_NET_CTL_STATE_DISCONNECTED;
if (sceNetCtlGetState(&netState) == SCE_OK)
{
Sleep(1);
}
if (netStateFuture.hasResult())
{
sce::Toolkit::NP::NetStateBasic *netState = netStateFuture.get();
ProfileManager.SetNetworkStatus(netState->connectionStatus == SCE_NET_CTL_STATE_IPOBTAINED);
ProfileManager.SetNetworkStatus(netState == SCE_NET_CTL_STATE_IPOBTAINED);
}
else
{
// Error message means we're disconnected
// Error means we're disconnected
ProfileManager.SetNetworkStatus(false);
}
@@ -409,7 +375,7 @@ void OrbisNPToolkit::createNPSession()
char test[3] = {'R','K','B'};
createSessionRequest.sessionData= test;
createSessionRequest.sessionDataSize = 3;
ret = sce::Toolkit::NP::Sessions::Interface::create(&createSessionRequest,&sm_createJoinFuture);
app.DebugPrintf("createNPSession STUB\n");
}
@@ -447,12 +413,7 @@ void OrbisNPToolkit::getMessageData(SceNpGameCustomDataEventParam* paramData)
req.itemId = paramData->itemId;
req.userInfo.userId = userId;
ret = sce::Toolkit::NP::GameCustomData::Interface::getGameData(&req, &m_messageData);
if( ret < 0 ) {
//Error handling
} else {
//Error handling
}
app.DebugPrintf("getMessageData STUB\n");
//
@@ -19,14 +19,15 @@ public:
static void destroyNPSession();
static void joinNPSession();
static void leaveNPSession();
static SceNpSessionId* getNPSessionID() { return &m_currentSessionInfo.npSessionId; }
static SceNpSessionId* getNPSessionID() { return 0; }
static void getMessageData(SceNpGameCustomDataEventParam* paramData);
#if 0
private:
static sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::NpSessionInformation> sm_createJoinFuture;
static sce::Toolkit::NP::NpSessionInformation m_currentSessionInfo;
static sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::MessageAttachment> m_messageData;
#endif
};
// Singleton
@@ -809,7 +809,6 @@ int SQRNetworkManager_Orbis::BasicEventThreadProc( void *lpParameter )
int SQRNetworkManager_Orbis::GetFriendsThreadProc( void* lpParameter )
{
SQRNetworkManager_Orbis *manager = (SQRNetworkManager_Orbis *)lpParameter;
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::FriendsList> friendList;
int ret = 0;
manager->m_aFriendSearchResults.clear();
@@ -828,81 +827,7 @@ int SQRNetworkManager_Orbis::GetFriendsThreadProc( void* lpParameter )
requestParam.userInfo.userId = ProfileManager.getUserID(ProfileManager.GetPrimaryPad());
bool async = false;
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 ;
int i = 1 ;
bool noFriends = true;
for (iter = friendList.get()->begin(); iter != friendList.get()->end() ; ++iter,i++)
{
manager->m_friendCount++;
noFriends = false;
app.DebugPrintf("------ Friend: %d -----\n",i);
app.DebugPrintf("Online Name: %s\n",iter->npid.handle.data);
app.DebugPrintf("------------------------\n");
sce::Toolkit::NP::PresenceRequest presenceRequest;
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::PresenceInfo> presenceInfo;
memset(&presenceRequest,0,sizeof(presenceRequest));
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 )
{
app.DebugPrintf("getPresence() error. ret = 0x%x\n", ret);
}
else
{
app.DebugPrintf("\nPresence Data Retrieved:\n");
app.DebugPrintf("Platform Type: %s\n", presenceInfo.get()->platformType.c_str());
app.DebugPrintf("Online Status: %s\n", (presenceInfo.get()->onlineStatus == SCE_NP_GAME_PRESENCE_STATUS_OFFLINE)?"OFFLINE":"ONLINE");
app.DebugPrintf("Presence Type (Refer to SCE_TOOLKIT_NP_PRESENCE_TYPE_* flags): %d\n", presenceInfo.get()->presenceType);
app.DebugPrintf("Title ID: %s\n", presenceInfo.get()->gameInfo.npTitleId.c_str());
app.DebugPrintf("Title Name: %s\n", presenceInfo.get()->gameInfo.npTitleName.c_str());
app.DebugPrintf("Title Status String: %s\n", presenceInfo.get()->gameInfo.gameStatus.c_str());
FriendSearchResult result;
memcpy(&result.m_NpId, &iter->npid, sizeof(SceNpId));
result.m_RoomFound = false;
// Only include the friend's game if its the same network id ( this also filters out generally Zeroed PresenceSyncInfo, which we do when we aren't in an active game session)
// if( presenceDetails.size == sizeof(PresenceSyncInfo) )
{
PresenceSyncInfo *pso = (PresenceSyncInfo *)presenceInfo.get()->gameInfo.gameData;
if( pso->netVersion == MINECRAFT_NET_VERSION )
{
if( !pso->inviteOnly )
{
result.m_RoomFound = true;
result.m_RoomId = pso->m_RoomId;
result.m_ServerId = pso->m_ServerId;
CPlatformNetworkManagerSony::MallocAndSetExtDataFromSQRPresenceInfo(&result.m_RoomExtDataReceived, pso);
manager->m_aFriendSearchResults.push_back(result);
}
}
}
}
}
}
else if (friendList.hasError())
{
app.DebugPrintf( "Error occurred while retrieving FriendsList, ret = 0x%x\n", friendList.getError());
app.DebugPrintf("Check sign-in status\n");
}
app.DebugPrintf( "Friend list is disabled on this build\n");
return 0;
}
@@ -44,9 +44,11 @@ bool SonyCommerce_Orbis::m_bLicenseChecked=false; // Check the trial/
#if 0
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,19 +182,8 @@ int SonyCommerce_Orbis::getProductList(std::vector<ProductInfo>* productList, ch
params.serviceLabel = 0;
app.DebugPrintf("Getting Product List ...\n");
ret = sce::Toolkit::NP::Commerce::Interface::getProductList(&g_productList, params, true);
if (ret < 0)
{
app.DebugPrintf("CommerceInterface::getProductList() error. ret = 0x%x\n", ret);
return ret;
}
if (g_productList.hasResult())
{
// 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;
}
app.DebugPrintf("getProductList STUB\n");
ret = -1;
return ret;
}
@@ -239,21 +230,8 @@ int SonyCommerce_Orbis::getCategoryInfo(CategoryInfo *pInfo, char *categoryId)
strcpy(params.categoryId, "");//categoryId);
params.serviceLabel = 0;
app.DebugPrintf("Getting Category Information...\n");
ret = sce::Toolkit::NP::Commerce::Interface::getCategoryInfo(&g_categoryInfo, params, true);
if (ret < 0)
{
// error
app.DebugPrintf("Commerce::Interface::getCategoryInfo error: 0x%x\n", ret);
return ret;
}
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;
}
app.DebugPrintf("getCategoryInfo STUB\n");
ret = -1;
return ret;
}
@@ -288,21 +266,9 @@ int SonyCommerce_Orbis::getDetailedProductInfo(ProductInfoDetailed *pInfo, const
strcpy(params.categoryId, categoryId);
strcpy(params.productId, productId);
app.DebugPrintf("getDetailedProductInfo STUB\n");
ret = -1;
app.DebugPrintf("Getting Detailed Product Information ... \n");
ret = sce::Toolkit::NP::Commerce::Interface::getDetailedProductInfo(&g_detailedProductInfo, params, true);
if (ret < 0)
{
app.DebugPrintf("CommerceInterface::getDetailedProductInfo() error. ret = 0x%x\n", ret);
return ret;
}
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;
}
return ret;
}
@@ -338,20 +304,9 @@ int SonyCommerce_Orbis::addDetailedProductInfo(ProductInfo *pInfo, const char *p
strcpy(params.categoryId, categoryId);
strcpy(params.productId, productId);
app.DebugPrintf("addDetailedProductInfo STUB\n");
ret = -1;
app.DebugPrintf("Getting Detailed Product Information ... \n");
ret = sce::Toolkit::NP::Commerce::Interface::getDetailedProductInfo(&g_detailedProductInfo, params, true);
if (ret < 0)
{
app.DebugPrintf("CommerceInterface::addDetailedProductInfo() error. ret = 0x%x\n", ret);
}
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;
}
return ret;
}
@@ -656,7 +611,7 @@ void SonyCommerce_Orbis::commerce2Handler( const sce::Toolkit::NP::Event& event)
}
case sce::Toolkit::NP::Event::UserEvent::commerceGotCategoryInfo:
{
copyCategoryInfo(m_pCategoryInfo, g_categoryInfo.get());
app.DebugPrintf("commerceGotCategoryInfo STUB\n");
m_pCategoryInfo = NULL;
m_event = e_event_commerceGotCategoryInfo;
break;
@@ -664,7 +619,7 @@ void SonyCommerce_Orbis::commerce2Handler( const sce::Toolkit::NP::Event& event)
case sce::Toolkit::NP::Event::UserEvent::commerceGotProductList:
{
copyProductList(m_pProductInfoList, g_productList.get());
app.DebugPrintf("commerceGotProductList STUB\n");
m_pProductInfoDetailed = NULL;
m_event = e_event_commerceGotProductList;
break;
@@ -672,16 +627,9 @@ void SonyCommerce_Orbis::commerce2Handler( const sce::Toolkit::NP::Event& event)
case sce::Toolkit::NP::Event::UserEvent::commerceGotDetailedProductInfo:
{
if(m_pProductInfoDetailed)
{
copyDetailedProductInfo(m_pProductInfoDetailed, g_detailedProductInfo.get());
m_pProductInfoDetailed = NULL;
}
else
{
copyAddDetailedProductInfo(m_pProductInfo, g_detailedProductInfo.get());
m_pProductInfo = NULL;
}
app.DebugPrintf("commerceGotDetailedProductInfo STUB\n");
m_pProductInfoDetailed = NULL;
m_pProductInfo = NULL;
m_event = e_event_commerceGotDetailedProductInfo;
break;
}
@@ -35,14 +35,21 @@ int g_loadedPCMVoiceDataSizes[4];
int g_loadedPCMVoiceDataPos[4];
char* g_loadedPCMVoiceData[4];
static void CreatePort(uint32_t *portId, const SceVoicePortParam *pArg)
static bool CreatePort(uint32_t *portId, const SceVoicePortParam *pArg)
{
C4JThread::PushAffinityAllCores(); // PS4 only
int err = sceVoiceCreatePort( portId, pArg );
assert(err == SCE_OK);
assert(*portId != SCE_VOICE_INVALID_PORT_ID);
C4JThread::PopAffinity(); // PS4 only
C4JThread::PushAffinityAllCores();
*portId = SCE_VOICE_INVALID_PORT_ID;
int err = sceVoiceCreatePort(portId, pArg);
C4JThread::PopAffinity();
if (err != SCE_OK || *portId == SCE_VOICE_INVALID_PORT_ID)
{
return false;
}
return true;
}
static void DeletePort(uint32_t& port)
@@ -122,7 +129,10 @@ void SonyVoiceChat_Orbis::init()
portArgs.volume = 1.0f;
portArgs.voice.bitrate = VOICE_ENCODED_FORMAT;
#endif
CreatePort( &m_voiceOutPort, &portArgs );
if (!CreatePort(&m_voiceOutPort, &portArgs))
{
return;
}
start();
m_bInitialised = true;