Revert "Project modernization (#630)"

This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.

This reverts commit a9be52c41a.
This commit is contained in:
Loki Rautio
2026-03-07 21:12:22 -06:00
parent a9be52c41a
commit 087b7e7abf
1373 changed files with 19449 additions and 19903 deletions

View File

@@ -25,7 +25,7 @@ int DQRNetworkManager::m_bootUserIndex;
wstring DQRNetworkManager::m_bootSessionName;
wstring DQRNetworkManager::m_bootServiceConfig;
wstring DQRNetworkManager::m_bootSessionTemplate;
DQRNetworkManager * DQRNetworkManager::s_pDQRManager = nullptr;
DQRNetworkManager * DQRNetworkManager::s_pDQRManager = NULL;
//using namespace Windows::Xbox::Networking;
@@ -87,16 +87,16 @@ DQRNetworkManager::DQRNetworkManager(IDQRNetworkManagerListener *listener)
memset(&m_roomSyncData, 0, sizeof(m_roomSyncData));
memset(m_players, 0, sizeof(m_players));
m_CreateSessionThread = nullptr;
m_GetFriendPartyThread = nullptr;
m_UpdateCustomSessionDataThread = nullptr;
m_CreateSessionThread = NULL;
m_GetFriendPartyThread = NULL;
m_UpdateCustomSessionDataThread = NULL;
m_CheckPartyInviteThread = nullptr;
m_CheckPartyInviteThread = NULL;
m_notifyForFullParty = false;
m_customDataDirtyUpdateTicks = 0;
m_sessionResultCount = 0;
m_sessionSearchResults = nullptr;
m_sessionSearchResults = NULL;
m_joinSessionUserMask = 0;
m_cancelJoinFromSearchResult = false;
@@ -274,7 +274,7 @@ void DQRNetworkManager::JoinSession(int playerMask)
// If we found the session, then set the status of this member to be active (should be reserved). This will stop our slot timing out and us being dropped out of the session.
if( session != nullptr )
{
if(!IsPlayerInSession(joiningUser->XboxUserId, session, nullptr) )
if(!IsPlayerInSession(joiningUser->XboxUserId, session, NULL) )
{
app.DebugPrintf("DNM_INT_STATE_JOINING_FAILED didn't find required player in session\n");
SetState(DNM_INT_STATE_JOINING_FAILED);
@@ -515,7 +515,7 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex)
pPlayer->SetSmallId(smallId);
pPlayer->SetName(ProfileManager.GetUser(userIndex)->DisplayInfo->Gamertag->Data());
pPlayer->SetDisplayName(ProfileManager.GetDisplayName(userIndex));
pPlayer->SetUID(static_cast<PlayerUID>(ProfileManager.GetUser(userIndex)->XboxUserId->Data()));
pPlayer->SetUID(PlayerUID(ProfileManager.GetUser(userIndex)->XboxUserId->Data()));
// Also add to the party so that our friends can find us. The host will get notified of this additional player in the party, but we should ignore since we're already in the session
m_partyController->AddLocalUsersToParty(1 << userIndex, ProfileManager.GetUser(0));
@@ -550,7 +550,7 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex)
pPlayer->SetSmallId(m_currentSmallId++);
pPlayer->SetName(ProfileManager.GetUser(userIndex)->DisplayInfo->Gamertag->Data());
pPlayer->SetDisplayName(ProfileManager.GetDisplayName(userIndex));
pPlayer->SetUID(static_cast<PlayerUID>(ProfileManager.GetUser(userIndex)->XboxUserId->Data()));
pPlayer->SetUID(PlayerUID(ProfileManager.GetUser(userIndex)->XboxUserId->Data()));
// TODO - could this add fail?
if(AddRoomSyncPlayer( pPlayer, 0, userIndex))
@@ -600,7 +600,7 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex)
m_joinSessionXUIDs[userIndex] = ProfileManager.GetUser(userIndex)->XboxUserId;
m_partyController->AddLocalUsersToParty(1 << userIndex, ProfileManager.GetUser(0));
m_addLocalPlayerSuccessPlayer = nullptr;
m_addLocalPlayerSuccessPlayer = NULL;
m_addLocalPlayerState = DNM_ADD_PLAYER_STATE_COMPLETE_SUCCESS;
}
}
@@ -763,7 +763,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetPlayerBySmallId(int idx)
}
}
}
return nullptr;
return NULL;
}
DQRNetworkPlayer *DQRNetworkManager::GetPlayerByXuid(PlayerUID xuid)
@@ -778,7 +778,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetPlayerByXuid(PlayerUID xuid)
}
}
}
return nullptr;
return NULL;
}
// Retrieve player display name by gamertag
@@ -809,7 +809,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetLocalPlayerByUserIndex(int idx)
}
}
}
return nullptr;
return NULL;
}
DQRNetworkPlayer *DQRNetworkManager::GetHostPlayer()
@@ -892,7 +892,7 @@ void DQRNetworkManager::Tick_VoiceChat()
#endif
// If we have to inform the chat integration layer of any players that have joined, do that now
EnterCriticalSection(&m_csVecChatPlayers);
for( size_t i = 0; i < m_vecChatPlayersJoined.size(); i++ )
for( int i = 0; i < m_vecChatPlayersJoined.size(); i++ )
{
int idx = m_vecChatPlayersJoined[i];
if( m_chat )
@@ -967,19 +967,19 @@ void DQRNetworkManager::Tick_Party()
void DQRNetworkManager::Tick_CustomSessionData()
{
// If there was a thread updaing our custom session data, then clear it up if it is done
if( m_UpdateCustomSessionDataThread != nullptr )
if( m_UpdateCustomSessionDataThread != NULL )
{
if( !m_UpdateCustomSessionDataThread->isRunning() )
{
delete m_UpdateCustomSessionDataThread;
m_UpdateCustomSessionDataThread = nullptr;
m_UpdateCustomSessionDataThread = NULL;
}
}
// If our custom data is dirty, and we aren't currently updating, then kick off a thread to update it
if( m_isHosting && ( !m_isOfflineGame ) )
{
if( m_UpdateCustomSessionDataThread == nullptr )
if( m_UpdateCustomSessionDataThread == NULL )
{
if( m_customDataDirtyUpdateTicks )
{
@@ -1003,7 +1003,7 @@ void DQRNetworkManager::Tick_AddAndRemoveLocalPlayers()
// A lot of handling adding local players is handled asynchronously. Trying to avoid having the callbacks that may result from this being called from the task threads, so handling this aspect of it here in the tick
if( m_addLocalPlayerState == DNM_ADD_PLAYER_STATE_COMPLETE_SUCCESS )
{
// If we've completed, and we're the host, then we should have the new player to create stored here in m_localPlayerSuccessCreated. For clients, this will just be nullptr as the actual
// If we've completed, and we're the host, then we should have the new player to create stored here in m_localPlayerSuccessCreated. For clients, this will just be NULL as the actual
// adding of the player happens as part of a longer process of the host creating us a reserved slot etc. etc.
if( m_addLocalPlayerSuccessPlayer )
{
@@ -1201,7 +1201,7 @@ void DQRNetworkManager::Tick_StateMachine()
break;
case DNM_INT_STATE_HOSTING_WAITING_TO_PLAY:
delete m_CreateSessionThread;
m_CreateSessionThread = nullptr;
m_CreateSessionThread = NULL;
// If the game is offline we can transition straight to playing
if (m_isOfflineGame) StartGame();
break;
@@ -1247,10 +1247,10 @@ void DQRNetworkManager::Tick_CheckInviteParty()
if( !m_CheckPartyInviteThread->isRunning() )
{
delete m_CheckPartyInviteThread;
m_CheckPartyInviteThread = nullptr;
m_CheckPartyInviteThread = NULL;
}
}
if( m_CheckPartyInviteThread == nullptr )
if( m_CheckPartyInviteThread == NULL )
{
m_inviteReceived = false;
m_CheckPartyInviteThread = new C4JThread(&DQRNetworkManager::_CheckInviteThreadProc, this, "Check invite thread");
@@ -1326,11 +1326,11 @@ void DQRNetworkManager::HandleSessionChange(MXSM::MultiplayerSession^ multiplaye
{
// 4J-JEV: This id is needed to link stats together.
// I thought setting the value from here would be less intrusive than adding an accessor.
static_cast<DurangoStats *>(GenericStats::getInstance())->setMultiplayerCorrelationId(multiplayerSession->MultiplayerCorrelationId);
((DurangoStats*)GenericStats::getInstance())->setMultiplayerCorrelationId(multiplayerSession->MultiplayerCorrelationId);
}
else
{
static_cast<DurangoStats *>(GenericStats::getInstance())->setMultiplayerCorrelationId( nullptr );
((DurangoStats*)GenericStats::getInstance())->setMultiplayerCorrelationId( nullptr );
}
m_multiplayerSession = multiplayerSession;
@@ -1403,7 +1403,7 @@ bool DQRNetworkManager::IsPlayerInSession( Platform::String^ xboxUserId, MXSM::M
{
Windows::Data::Json::JsonObject^ customConstant = Windows::Data::Json::JsonObject::Parse(member->MemberCustomConstantsJson);
Windows::Data::Json::JsonValue^ customValue = customConstant->GetNamedValue(L"smallId");
*smallId = static_cast<int>(customValue->GetNumber()) & 255;
*smallId = (int)(customValue->GetNumber()) & 255;
}
catch (Platform::COMException^ ex)
{
@@ -1449,7 +1449,7 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData)
for( int j = 0; j < m_roomSyncData.playerCount; j++ )
{
tempPlayers.push_back(m_players[j]);
m_players[j] = nullptr;
m_players[j] = NULL;
}
// For each new player, it's either:
@@ -1509,12 +1509,12 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData)
}
memcpy(&m_roomSyncData, pNewSyncData, sizeof(m_roomSyncData));
for( size_t i = 0; i < tempPlayers.size(); i++ )
for( int i = 0; i < tempPlayers.size(); i++ )
{
m_listener->HandlePlayerLeaving(tempPlayers[i]);
delete tempPlayers[i];
}
for( size_t i = 0; i < newPlayers.size(); i++ )
for( int i = 0; i < newPlayers.size(); i++ )
{
m_listener->HandlePlayerJoined(newPlayers[i]); // For clients, this is where we get notified of local and remote players joining
}
@@ -1592,12 +1592,12 @@ void DQRNetworkManager::RemoveRoomSyncPlayersWithSessionAddress(unsigned int ses
}
m_roomSyncData.playerCount = iWriteIdx;
for( size_t i = 0; i < removedPlayers.size(); i++ )
for( int i = 0; i < removedPlayers.size(); i++ )
{
m_listener->HandlePlayerLeaving(removedPlayers[i]);
delete removedPlayers[i];
memset(&m_roomSyncData.players[m_roomSyncData.playerCount + i], 0, sizeof(PlayerSyncData));
m_players[m_roomSyncData.playerCount + i] = nullptr;
m_players[m_roomSyncData.playerCount + i] = NULL;
}
LeaveCriticalSection(&m_csRoomSyncData);
}
@@ -1623,12 +1623,12 @@ void DQRNetworkManager::RemoveRoomSyncPlayer(DQRNetworkPlayer *pPlayer)
}
m_roomSyncData.playerCount = iWriteIdx;
for( size_t i = 0; i < removedPlayers.size(); i++ )
for( int i = 0; i < removedPlayers.size(); i++ )
{
m_listener->HandlePlayerLeaving(removedPlayers[i]);
delete removedPlayers[i];
memset(&m_roomSyncData.players[m_roomSyncData.playerCount + i], 0, sizeof(PlayerSyncData));
m_players[m_roomSyncData.playerCount + i] = nullptr;
m_players[m_roomSyncData.playerCount + i] = NULL;
}
}
@@ -1643,7 +1643,7 @@ void DQRNetworkManager::SendRoomSyncInfo()
// (2) A single byte internal data tag
// (3) An unsigned int encoding the size of the combined size of all the strings in stage (5)
// (4) The RoomSyncData structure itself
// (5) A wchar nullptr terminated string for every active player to encode the XUID
// (5) A wchar NULL terminated string for every active player to encode the XUID
unsigned int xuidBytes = 0;
for( int i = 0 ; i < m_roomSyncData.playerCount; i++ )
{
@@ -1689,7 +1689,7 @@ void DQRNetworkManager::SendAddPlayerFailed(Platform::String^ xuid)
// (1) 2 byte general header
// (2) A single byte internal data tag
// (3) An unsigned int encoding the size size of the string
// (5) A wchar nullptr terminated string storing the xuid of the player which has failed to join
// (5) A wchar NULL terminated string storing the xuid of the player which has failed to join
unsigned int xuidBytes = sizeof(wchar_t) * ( xuid->Length() + 1 );
@@ -1745,7 +1745,7 @@ void DQRNetworkManager::SendSmallId(bool reliableAndSequential, int playerMask)
{
Windows::Data::Json::JsonObject^ customConstant = Windows::Data::Json::JsonObject::Parse(member->MemberCustomConstantsJson);
Windows::Data::Json::JsonValue^ customValue = customConstant->GetNamedValue(L"smallId");
smallId = static_cast<BYTE>(customValue->GetNumber());
smallId = (BYTE)(customValue->GetNumber());
bFound = true;
}
catch (Platform::COMException^ ex)
@@ -1797,7 +1797,7 @@ int DQRNetworkManager::GetSessionIndexForSmallId(unsigned char smallId)
{
Windows::Data::Json::JsonObject^ customConstant = Windows::Data::Json::JsonObject::Parse(member->MemberCustomConstantsJson);
Windows::Data::Json::JsonValue^ customValue = customConstant->GetNamedValue(L"smallId");
smallIdMember = static_cast<BYTE>(customValue->GetNumber());
smallIdMember = (BYTE)(customValue->GetNumber());
}
catch (Platform::COMException^ ex)
{
@@ -1830,7 +1830,7 @@ int DQRNetworkManager::GetSessionIndexAndSmallIdForHost(unsigned char *smallId)
}
if( smallIdMember > 255 )
{
*smallId = static_cast<BYTE>(smallIdMember);
*smallId = (BYTE)(smallIdMember);
return i;
}
}
@@ -1877,7 +1877,7 @@ Platform::String^ DQRNetworkManager::GetNextSmallIdAsJsonString()
int DQRNetworkManager::_HostGameThreadProc( void* lpParameter )
{
DQRNetworkManager *pDQR = static_cast<DQRNetworkManager *>(lpParameter);
DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter;
return pDQR->HostGameThreadProc();
}
@@ -2190,7 +2190,7 @@ int DQRNetworkManager::HostGameThreadProc()
pPlayer->SetSmallId(smallId);
pPlayer->SetName(user->DisplayInfo->Gamertag->Data());
pPlayer->SetDisplayName(displayName);
pPlayer->SetUID(static_cast<PlayerUID>(user->XboxUserId->Data()));
pPlayer->SetUID(PlayerUID(user->XboxUserId->Data()));
AddRoomSyncPlayer( pPlayer, localSessionAddress, i);
@@ -2208,7 +2208,7 @@ int DQRNetworkManager::HostGameThreadProc()
int DQRNetworkManager::_LeaveRoomThreadProc( void* lpParameter )
{
DQRNetworkManager *pDQR = static_cast<DQRNetworkManager *>(lpParameter);
DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter;
return pDQR->LeaveRoomThreadProc();
}
@@ -2311,7 +2311,7 @@ int DQRNetworkManager::LeaveRoomThreadProc()
int DQRNetworkManager::_TidyUpJoinThreadProc( void* lpParameter )
{
DQRNetworkManager *pDQR = static_cast<DQRNetworkManager *>(lpParameter);
DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter;
return pDQR->TidyUpJoinThreadProc();
}
@@ -2416,7 +2416,7 @@ int DQRNetworkManager::TidyUpJoinThreadProc()
int DQRNetworkManager::_UpdateCustomSessionDataThreadProc( void* lpParameter )
{
DQRNetworkManager *pDQR = static_cast<DQRNetworkManager *>(lpParameter);
DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter;
return pDQR->UpdateCustomSessionDataThreadProc();
}
@@ -2491,7 +2491,7 @@ int DQRNetworkManager::UpdateCustomSessionDataThreadProc()
int DQRNetworkManager::_CheckInviteThreadProc(void* lpParameter)
{
DQRNetworkManager *pDQR = static_cast<DQRNetworkManager *>(lpParameter);
DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter;
return pDQR->CheckInviteThreadProc();
}
@@ -2614,7 +2614,7 @@ void DQRNetworkManager::LeaveRoom()
for( int i = 0; i < m_roomSyncData.playerCount; i++ )
{
delete m_players[i];
m_players[i] = nullptr;
m_players[i] = NULL;
}
memset(&m_roomSyncData, 0, sizeof(m_roomSyncData));
m_displayNames.clear();
@@ -3026,8 +3026,8 @@ void DQRNetworkManager::RequestDisplayName(DQRNetworkPlayer *player)
void DQRNetworkManager::GetProfileCallback(LPVOID pParam, Microsoft::Xbox::Services::Social::XboxUserProfile^ profile)
{
DQRNetworkManager *dqnm = static_cast<DQRNetworkManager *>(pParam);
dqnm->SetDisplayName(static_cast<PlayerUID>(profile->XboxUserId->Data()), profile->GameDisplayName->Data());
DQRNetworkManager *dqnm = (DQRNetworkManager *)pParam;
dqnm->SetDisplayName(PlayerUID(profile->XboxUserId->Data()), profile->GameDisplayName->Data());
}
// Set player display name