aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/Consoles_App.cpp
diff options
context:
space:
mode:
authorLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
committerLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
commit087b7e7abfe81dd7f0fdcdea36ac9f245950df1a (patch)
tree69454763e73ca764af4e682d3573080b13138a0e /Minecraft.Client/Common/Consoles_App.cpp
parenta9be52c41a02d207233199e98898fe7483d7e817 (diff)
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 a9be52c41a02d207233199e98898fe7483d7e817.
Diffstat (limited to 'Minecraft.Client/Common/Consoles_App.cpp')
-rw-r--r--Minecraft.Client/Common/Consoles_App.cpp560
1 files changed, 286 insertions, 274 deletions
diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp
index c3a623d5..43cf73e1 100644
--- a/Minecraft.Client/Common/Consoles_App.cpp
+++ b/Minecraft.Client/Common/Consoles_App.cpp
@@ -100,7 +100,7 @@ CMinecraftApp::CMinecraftApp()
{
m_eTMSAction[i]=eTMSAction_Idle;
m_eXuiAction[i]=eAppAction_Idle;
- m_eXuiActionParam[i] = nullptr;
+ m_eXuiActionParam[i] = NULL;
//m_dwAdditionalModelParts[i] = 0;
if(FAILED(XUserGetSigninInfo(i,XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY ,&m_currentSigninInfo[i])))
@@ -157,9 +157,9 @@ CMinecraftApp::CMinecraftApp()
// m_bRead_TMS_XUIDS_XML=false;
// m_bRead_TMS_DLCINFO_XML=false;
- m_pDLCFileBuffer=nullptr;
+ m_pDLCFileBuffer=NULL;
m_dwDLCFileSize=0;
- m_pBannedListFileBuffer=nullptr;
+ m_pBannedListFileBuffer=NULL;
m_dwBannedListFileSize=0;
m_bDefaultCapeInstallAttempted=false;
@@ -763,7 +763,7 @@ bool CMinecraftApp::LoadBeaconMenu(int iPad ,shared_ptr<Inventory> inventory, sh
#ifdef _WINDOWS64
static void Win64_GetSettingsPath(char *outPath, DWORD size)
{
- GetModuleFileNameA(nullptr, outPath, size);
+ GetModuleFileNameA(NULL, outPath, size);
char *lastSlash = strrchr(outPath, '\\');
if (lastSlash) *(lastSlash + 1) = '\0';
strncat_s(outPath, size, "settings.dat", _TRUNCATE);
@@ -773,7 +773,7 @@ static void Win64_SaveSettings(GAME_SETTINGS *gs)
if (!gs) return;
char filePath[MAX_PATH] = {};
Win64_GetSettingsPath(filePath, MAX_PATH);
- FILE *f = nullptr;
+ FILE *f = NULL;
if (fopen_s(&f, filePath, "wb") == 0 && f)
{
fwrite(gs, sizeof(GAME_SETTINGS), 1, f);
@@ -785,7 +785,7 @@ static void Win64_LoadSettings(GAME_SETTINGS *gs)
if (!gs) return;
char filePath[MAX_PATH] = {};
Win64_GetSettingsPath(filePath, MAX_PATH);
- FILE *f = nullptr;
+ FILE *f = NULL;
if (fopen_s(&f, filePath, "rb") == 0 && f)
{
GAME_SETTINGS temp = {};
@@ -803,7 +803,7 @@ void CMinecraftApp::InitGameSettings()
#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__)
GameSettingsA[i]=(GAME_SETTINGS *)StorageManager.GetGameDefinedProfileData(i);
#else
- GameSettingsA[i]=static_cast<GAME_SETTINGS *>(ProfileManager.GetGameDefinedProfileData(i));
+ GameSettingsA[i]=(GAME_SETTINGS *)ProfileManager.GetGameDefinedProfileData(i);
#endif
// clear the flag to say the settings have changed
GameSettingsA[i]->bSettingsChanged=false;
@@ -840,7 +840,7 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,con
SetGameSettings(iPad,eGameSetting_FOV,0);
// 4J-PB - Don't reset the difficult level if we're in-game
- if(Minecraft::GetInstance()->level==nullptr)
+ if(Minecraft::GetInstance()->level==NULL)
{
app.DebugPrintf("SetDefaultOptions - Difficulty = 1\n");
SetGameSettings(iPad,eGameSetting_Difficulty,1);
@@ -935,7 +935,7 @@ int CMinecraftApp::DefaultOptionsCallback(LPVOID pParam,C4JStorage::PROFILESETTI
int CMinecraftApp::DefaultOptionsCallback(LPVOID pParam,C_4JProfile::PROFILESETTINGS *pSettings, const int iPad)
#endif
{
- CMinecraftApp *pApp=static_cast<CMinecraftApp *>(pParam);
+ CMinecraftApp *pApp=(CMinecraftApp *)pParam;
// flag the default options to be set
@@ -1372,29 +1372,29 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
case eGameSetting_MusicVolume:
if(iPad==ProfileManager.GetPrimaryPad())
{
- pMinecraft->options->set(Options::Option::MUSIC,static_cast<float>(GameSettingsA[iPad]->ucMusicVolume)/100.0f);
+ pMinecraft->options->set(Options::Option::MUSIC,((float)GameSettingsA[iPad]->ucMusicVolume)/100.0f);
}
break;
- case eGameSetting_SoundFXVolume:
- if (iPad == ProfileManager.GetPrimaryPad())
- {
- pMinecraft->options->set(Options::Option::SOUND, static_cast<float>(GameSettingsA[iPad]->ucSoundFXVolume) / 100.0f);
- }
+ case eGameSetting_SoundFXVolume:
+ if(iPad==ProfileManager.GetPrimaryPad())
+ {
+ pMinecraft->options->set(Options::Option::SOUND,((float)GameSettingsA[iPad]->ucSoundFXVolume)/100.0f);
+ }
break;
case eGameSetting_RenderDistance:
- if (iPad == ProfileManager.GetPrimaryPad())
- {
- int dist = (GameSettingsA[iPad]->uiBitmaskValues >> 16) & 0xFF;
+ if(iPad == ProfileManager.GetPrimaryPad())
+ {
+ int dist = (GameSettingsA[iPad]->uiBitmaskValues >> 16) & 0xFF;
- int level = UIScene_SettingsGraphicsMenu::DistanceToLevel(dist);
- pMinecraft->options->set(Options::Option::RENDER_DISTANCE, 3 - level);
- };
+ int level = UIScene_SettingsGraphicsMenu::DistanceToLevel(dist);
+ pMinecraft->options->set(Options::Option::RENDER_DISTANCE, 3 - level);
+ }
break;
case eGameSetting_Gamma:
if(iPad==ProfileManager.GetPrimaryPad())
{
#if defined(_WIN64) || defined(_WINDOWS64)
- pMinecraft->options->set(Options::Option::GAMMA, static_cast<float>(GameSettingsA[iPad]->ucGamma) / 100.0f);
+ pMinecraft->options->set(Options::Option::GAMMA, ((float)GameSettingsA[iPad]->ucGamma) / 100.0f);
#else
// ucGamma range is 0-100, UpdateGamma is 0 - 32768
float fVal=((float)GameSettingsA[iPad]->ucGamma)*327.68f;
@@ -1421,7 +1421,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
app.SetGameHostOption(eGameHostOption_Difficulty,pMinecraft->options->difficulty);
// send this to the other players if we are in-game
- bool bInGame=pMinecraft->level!=nullptr;
+ bool bInGame=pMinecraft->level!=NULL;
// Game Host only (and for now we can't change the diff while in game, so this shouldn't happen)
if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad()))
@@ -1438,7 +1438,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
case eGameSetting_Sensitivity_InGame:
// 4J-PB - we don't use the options value
// tell the input that we've changed the sensitivity - range of the slider is 0 to 200, default is 100
- pMinecraft->options->set(Options::Option::SENSITIVITY,static_cast<float>(GameSettingsA[iPad]->ucSensitivity)/100.0f);
+ pMinecraft->options->set(Options::Option::SENSITIVITY,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f);
//InputManager.SetJoypadSensitivity(iPad,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f);
break;
@@ -1485,7 +1485,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
break;
case eGameSetting_GamertagsVisible:
{
- bool bInGame=pMinecraft->level!=nullptr;
+ bool bInGame=pMinecraft->level!=NULL;
// Game Host only
if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad()))
@@ -1514,7 +1514,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
case eGameSetting_DisplaySplitscreenGamertags:
for( BYTE idx = 0; idx < XUSER_MAX_COUNT; ++idx)
{
- if(pMinecraft->localplayers[idx] != nullptr)
+ if(pMinecraft->localplayers[idx] != NULL)
{
if(pMinecraft->localplayers[idx]->m_iScreenSection==C4JRender::VIEWPORT_TYPE_FULLSCREEN)
{
@@ -1558,17 +1558,19 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
case eGameSetting_FriendsOfFriends:
//nothing to do here
break;
- case eGameSetting_BedrockFog:
- {
- bool bInGame = pMinecraft->level != nullptr;
-
- if (bInGame && g_NetworkManager.IsHost() && (iPad == ProfileManager.GetPrimaryPad()))
- {
- app.SetGameHostOption(eGameHostOption_BedrockFog, GetGameSettings(iPad, eGameSetting_BedrockFog) ? 1 : 0);
- app.SetXuiServerAction(iPad, eXuiServerAction_ServerSettingChanged_BedrockFog);
- }
- }
- break;
+ case eGameSetting_BedrockFog:
+ {
+ bool bInGame=pMinecraft->level!=NULL;
+
+ // Game Host only
+ if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad()))
+ {
+ // Update the Game Host setting if you are the host and you are in-game
+ app.SetGameHostOption(eGameHostOption_BedrockFog,GetGameSettings(iPad,eGameSetting_BedrockFog)?1:0);
+ app.SetXuiServerAction(iPad,eXuiServerAction_ServerSettingChanged_BedrockFog);
+ }
+ }
+ break;
case eGameSetting_DisplayHUD:
//nothing to do here
break;
@@ -1615,7 +1617,7 @@ void CMinecraftApp::SetPlayerSkin(int iPad,DWORD dwSkinId)
TelemetryManager->RecordSkinChanged(iPad, GameSettingsA[iPad]->dwSelectedSkin);
- if(Minecraft::GetInstance()->localplayers[iPad]!=nullptr) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomSkin(dwSkinId);
+ if(Minecraft::GetInstance()->localplayers[iPad]!=NULL) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomSkin(dwSkinId);
}
@@ -1627,8 +1629,8 @@ wstring CMinecraftApp::GetPlayerSkinName(int iPad)
DWORD CMinecraftApp::GetPlayerSkinId(int iPad)
{
// 4J-PB -check the user has rights to use this skin - they may have had at some point but the entitlement has been removed.
- DLCPack *Pack=nullptr;
- DLCSkinFile *skinFile=nullptr;
+ DLCPack *Pack=NULL;
+ DLCSkinFile *skinFile=NULL;
DWORD dwSkin=GameSettingsA[iPad]->dwSelectedSkin;
wchar_t chars[256];
@@ -1683,7 +1685,7 @@ void CMinecraftApp::SetPlayerCape(int iPad,DWORD dwCapeId)
//SentientManager.RecordSkinChanged(iPad, GameSettingsA[iPad]->dwSelectedSkin);
- if(Minecraft::GetInstance()->localplayers[iPad]!=nullptr) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomCape(dwCapeId);
+ if(Minecraft::GetInstance()->localplayers[iPad]!=NULL) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomCape(dwCapeId);
}
wstring CMinecraftApp::GetPlayerCapeName(int iPad)
@@ -1716,7 +1718,7 @@ unsigned char CMinecraftApp::GetPlayerFavoriteSkinsPos(int iPad)
void CMinecraftApp::SetPlayerFavoriteSkinsPos(int iPad, int iPos)
{
- GameSettingsA[iPad]->ucCurrentFavoriteSkinPos=static_cast<unsigned char>(iPos);
+ GameSettingsA[iPad]->ucCurrentFavoriteSkinPos=(unsigned char)iPos;
GameSettingsA[iPad]->bSettingsChanged = true;
}
@@ -1753,7 +1755,7 @@ void CMinecraftApp::ValidateFavoriteSkins(int iPad)
// Also check they haven't reverted to a trial pack
DLCPack *pDLCPack=app.m_dlcManager.getPackContainingSkin(chars);
- if(pDLCPack!=nullptr)
+ if(pDLCPack!=NULL)
{
// 4J-PB - We should let players add the free skins to their favourites as well!
//DLCFile *pDLCFile=pDLCPack->getFile(DLCManager::e_DLCType_Skin,chars);
@@ -1800,7 +1802,7 @@ void CMinecraftApp::SetMinecraftLanguage(int iPad, unsigned char ucLanguage)
unsigned char CMinecraftApp::GetMinecraftLanguage(int iPad)
{
// if there are no game settings read yet, return the default language
- if(GameSettingsA[iPad]==nullptr)
+ if(GameSettingsA[iPad]==NULL)
{
return 0;
}
@@ -1819,7 +1821,7 @@ void CMinecraftApp::SetMinecraftLocale(int iPad, unsigned char ucLocale)
unsigned char CMinecraftApp::GetMinecraftLocale(int iPad)
{
// if there are no game settings read yet, return the default language
- if(GameSettingsA[iPad]==nullptr)
+ if(GameSettingsA[iPad]==NULL)
{
return 0;
}
@@ -2521,7 +2523,7 @@ unsigned int CMinecraftApp::GetGameSettingsDebugMask(int iPad,bool bOverridePlay
shared_ptr<Player> player = Minecraft::GetInstance()->localplayers[iPad];
- if(bOverridePlayer || player==nullptr)
+ if(bOverridePlayer || player==NULL)
{
return GameSettingsA[iPad]->uiDebugBitmask;
}
@@ -2695,7 +2697,7 @@ int CMinecraftApp::DisplaySavingMessage(void *pParam, C4JStorage::ESavingMessage
void CMinecraftApp::SetActionConfirmed(LPVOID param)
{
- XuiActionParam *actionInfo = static_cast<XuiActionParam *>(param);
+ XuiActionParam *actionInfo = (XuiActionParam *)param;
app.SetAction(actionInfo->iPad, actionInfo->action);
}
@@ -2833,7 +2835,7 @@ void CMinecraftApp::HandleXuiActions(void)
app.SetAutosaveTimerTime();
SetAction(i,eAppAction_Idle);
// Check that there is a name for the save - if we're saving from the tutorial and this is the first save from the tutorial, we'll not have a name
- /*if(StorageManager.GetSaveName()==nullptr)
+ /*if(StorageManager.GetSaveName()==NULL)
{
app.NavigateToScene(i,eUIScene_SaveWorld);
}
@@ -2851,7 +2853,7 @@ void CMinecraftApp::HandleXuiActions(void)
LoadingInputParams *loadingParams = new LoadingInputParams();
loadingParams->func = &UIScene_PauseMenu::SaveWorldThreadProc;
- loadingParams->lpParam = static_cast<LPVOID>(false);
+ loadingParams->lpParam = (LPVOID)false;
// 4J-JEV - PS4: Fix for #5708 - [ONLINE] - If the user pulls their network cable out while saving the title will hang.
loadingParams->waitForThreadToDelete = true;
@@ -2902,7 +2904,7 @@ void CMinecraftApp::HandleXuiActions(void)
ui.ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), false);
// This just allows it to be shown
- if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false);
+ if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false);
//INT saveOrCheckpointId = 0;
//bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId);
@@ -2912,7 +2914,7 @@ void CMinecraftApp::HandleXuiActions(void)
LoadingInputParams *loadingParams = new LoadingInputParams();
loadingParams->func = &UIScene_PauseMenu::SaveWorldThreadProc;
- loadingParams->lpParam = (LPVOID)(true);
+ loadingParams->lpParam = (LPVOID)true;
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
completionData->bShowBackground=TRUE;
@@ -2978,7 +2980,7 @@ void CMinecraftApp::HandleXuiActions(void)
// send the message
for(int idx=0;idx<XUSER_MAX_COUNT;idx++)
{
- if((i!=idx) && (pMinecraft->localplayers[idx]!=nullptr))
+ if((i!=idx) && (pMinecraft->localplayers[idx]!=NULL))
{
XuiBroadcastMessage( CXuiSceneBase::GetPlayerBaseScene(idx), &xuiMsg );
}
@@ -3060,7 +3062,7 @@ void CMinecraftApp::HandleXuiActions(void)
// send the message
for(int idx=0;idx<XUSER_MAX_COUNT;idx++)
{
- if((i!=idx) && (pMinecraft->localplayers[idx]!=nullptr))
+ if((i!=idx) && (pMinecraft->localplayers[idx]!=NULL))
{
XuiBroadcastMessage( CXuiSceneBase::GetPlayerBaseScene(idx), &xuiMsg );
}
@@ -3286,8 +3288,8 @@ void CMinecraftApp::HandleXuiActions(void)
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
// If param is non-null then this is a forced exit by the server, so make sure the player knows why
// 4J Stu - Changed - Don't use the FullScreenProgressScreen for action, use a dialog instead
- completionData->bRequiresUserAction = FALSE;//(param != nullptr) ? TRUE : FALSE;
- completionData->bShowTips = (param != nullptr) ? FALSE : TRUE;
+ completionData->bRequiresUserAction = FALSE;//(param != NULL) ? TRUE : FALSE;
+ completionData->bShowTips = (param != NULL) ? FALSE : TRUE;
completionData->bShowBackground=TRUE;
completionData->bShowLogo=TRUE;
completionData->type = e_ProgressCompletion_NavigateToHomeMenu;
@@ -3399,7 +3401,7 @@ void CMinecraftApp::HandleXuiActions(void)
break;
case eAppAction_WaitForRespawnComplete:
player = pMinecraft->localplayers[i];
- if(player != nullptr && player->GetPlayerRespawned())
+ if(player != NULL && player->GetPlayerRespawned())
{
SetAction(i,eAppAction_Idle);
@@ -3424,7 +3426,7 @@ void CMinecraftApp::HandleXuiActions(void)
break;
case eAppAction_WaitForDimensionChangeComplete:
player = pMinecraft->localplayers[i];
- if(player != nullptr && player->connection && player->connection->isStarted())
+ if(player != NULL && player->connection && player->connection->isStarted())
{
SetAction(i,eAppAction_Idle);
ui.CloseUIScenes(i);
@@ -3738,12 +3740,12 @@ void CMinecraftApp::HandleXuiActions(void)
// unload any texture pack audio
// if there is audio in use, clear out the audio, and unmount the pack
TexturePack *pTexPack=Minecraft::GetInstance()->skins->getSelected();
- DLCTexturePack *pDLCTexPack=nullptr;
+ DLCTexturePack *pDLCTexPack=NULL;
if(pTexPack->hasAudio())
{
// get the dlc texture pack, and store it
- pDLCTexPack=static_cast<DLCTexturePack *>(pTexPack);
+ pDLCTexPack=(DLCTexturePack *)pTexPack;
}
// change to the default texture pack
@@ -3762,11 +3764,11 @@ void CMinecraftApp::HandleXuiActions(void)
pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1);
#ifdef _XBOX
- if(pDLCTexPack->m_pStreamedWaveBank!=nullptr)
+ if(pDLCTexPack->m_pStreamedWaveBank!=NULL)
{
pDLCTexPack->m_pStreamedWaveBank->Destroy();
}
- if(pDLCTexPack->m_pSoundBank!=nullptr)
+ if(pDLCTexPack->m_pSoundBank!=NULL)
{
pDLCTexPack->m_pSoundBank->Destroy();
}
@@ -3785,18 +3787,18 @@ void CMinecraftApp::HandleXuiActions(void)
for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index)
{
if(ProfileManager.IsSignedIn(index) )
- {
- if (index == i || pMinecraft->localplayers[index] != nullptr)
- {
- m_InviteData.dwLocalUsersMask |= g_NetworkManager.GetLocalPlayerMask(index);
- }
+ {
+ if(index==i || pMinecraft->localplayers[index]!=NULL )
+ {
+ m_InviteData.dwLocalUsersMask |= g_NetworkManager.GetLocalPlayerMask( index );
+ }
}
}
#endif
- LoadingInputParams *loadingParams = new LoadingInputParams();
- loadingParams->func = &CGameNetworkManager::ExitAndJoinFromInviteThreadProc;
- loadingParams->lpParam = static_cast<LPVOID>(&m_InviteData);
+ LoadingInputParams *loadingParams = new LoadingInputParams();
+ loadingParams->func = &CGameNetworkManager::ExitAndJoinFromInviteThreadProc;
+ loadingParams->lpParam = (LPVOID)&m_InviteData;
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
completionData->bShowBackground=TRUE;
@@ -3819,7 +3821,7 @@ void CMinecraftApp::HandleXuiActions(void)
g_NetworkManager.SetLocalGame(false);
- JoinFromInviteData *inviteData = static_cast<JoinFromInviteData *>(param);
+ JoinFromInviteData *inviteData = (JoinFromInviteData *)param;
// 4J-PB - clear any previous connection errors
Minecraft::GetInstance()->clearConnectionFailed();
@@ -3894,7 +3896,7 @@ void CMinecraftApp::HandleXuiActions(void)
LoadingInputParams *loadingParams = new LoadingInputParams();
loadingParams->func = &CGameNetworkManager::ChangeSessionTypeThreadProc;
- loadingParams->lpParam = nullptr;
+ loadingParams->lpParam = NULL;
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
#ifdef __PS3__
@@ -3945,7 +3947,7 @@ void CMinecraftApp::HandleXuiActions(void)
#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__)
SetDefaultOptions((C4JStorage::PROFILESETTINGS *)param,i);
#else
- SetDefaultOptions(static_cast<C_4JProfile::PROFILESETTINGS *>(param), i);
+ SetDefaultOptions((C_4JProfile::PROFILESETTINGS *)param,i);
#endif
// if the profile data has been changed, then force a profile write
@@ -3975,7 +3977,7 @@ void CMinecraftApp::HandleXuiActions(void)
LoadingInputParams *loadingParams = new LoadingInputParams();
loadingParams->func = &CMinecraftApp::RemoteSaveThreadProc;
- loadingParams->lpParam = nullptr;
+ loadingParams->lpParam = NULL;
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
completionData->bRequiresUserAction=FALSE;
@@ -4274,7 +4276,7 @@ void CMinecraftApp::HandleXuiActions(void)
SetTMSAction(i,eTMSAction_TMSPP_UserFileList_Waiting);
app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_TitleUser,"\\",eTMSAction_TMSPP_XUIDSFile);
#elif defined _XBOX_ONE
- //StorageManager.TMSPP_DeleteFile(i,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.png",nullptr,nullptr, 0);
+ //StorageManager.TMSPP_DeleteFile(i,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.png",NULL,NULL, 0);
SetTMSAction(i,eTMSAction_TMSPP_UserFileList_Waiting);
app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_TitleUser,eTMSAction_TMSPP_DLCFileOnly);
#else
@@ -4363,7 +4365,7 @@ void CMinecraftApp::HandleXuiActions(void)
int CMinecraftApp::BannedLevelDialogReturned(void *pParam,int iPad,const C4JStorage::EMessageResult result)
{
- CMinecraftApp* pApp = static_cast<CMinecraftApp *>(pParam);
+ CMinecraftApp* pApp = (CMinecraftApp*)pParam;
//Minecraft *pMinecraft=Minecraft::GetInstance();
if(result==C4JStorage::EMessage_ResultAccept)
@@ -4371,7 +4373,7 @@ int CMinecraftApp::BannedLevelDialogReturned(void *pParam,int iPad,const C4JStor
#if defined _XBOX || defined _XBOX_ONE
INetworkPlayer *pHost = g_NetworkManager.GetHostPlayer();
// unban the level
- if (pHost != nullptr)
+ if (pHost != NULL)
{
#if defined _XBOX
pApp->RemoveLevelFromBannedLevelList(iPad,((NetworkPlayerXbox *)pHost)->GetUID(),pApp->GetUniqueMapName());
@@ -4421,10 +4423,10 @@ void CMinecraftApp::loadMediaArchive()
HANDLE hFile = CreateFile( path.c_str(),
GENERIC_READ,
FILE_SHARE_READ,
- nullptr,
+ NULL,
OPEN_EXISTING,
FILE_FLAG_SEQUENTIAL_SCAN,
- nullptr );
+ NULL );
if( hFile != INVALID_HANDLE_VALUE )
{
@@ -4440,7 +4442,7 @@ void CMinecraftApp::loadMediaArchive()
m_fBody,
dwFileSize,
&m_fSize,
- nullptr );
+ NULL );
assert( m_fSize == dwFileSize );
@@ -4452,7 +4454,7 @@ void CMinecraftApp::loadMediaArchive()
{
assert( false );
// AHHHHHHHHHHHH
- m_mediaArchive = nullptr;
+ m_mediaArchive = NULL;
}
#endif
}
@@ -4461,7 +4463,7 @@ void CMinecraftApp::loadStringTable()
{
#ifndef _XBOX
- if(m_stringTable!=nullptr)
+ if(m_stringTable!=NULL)
{
// we need to unload the current string table, this is a reload
delete m_stringTable;
@@ -4475,7 +4477,7 @@ void CMinecraftApp::loadStringTable()
}
else
{
- m_stringTable = nullptr;
+ m_stringTable = NULL;
assert(false);
// AHHHHHHHHH.
}
@@ -4488,7 +4490,7 @@ int CMinecraftApp::PrimaryPlayerSignedOutReturned(void *pParam,int iPad,const C4
//Minecraft *pMinecraft=Minecraft::GetInstance();
// if the player is null, we're in the menus
- //if(Minecraft::GetInstance()->player!=nullptr)
+ //if(Minecraft::GetInstance()->player!=NULL)
// We always create a session before kicking of any of the game code, so even though we may still be joining/creating a game
// at this point we want to handle it differently from just being in a menu
@@ -4509,10 +4511,10 @@ int CMinecraftApp::EthernetDisconnectReturned(void *pParam,int iPad,const C4JSto
Minecraft *pMinecraft=Minecraft::GetInstance();
// if the player is null, we're in the menus
- if (Minecraft::GetInstance()->player != nullptr)
- {
- app.SetAction(pMinecraft->player->GetXboxPad(), eAppAction_EthernetDisconnectedReturned);
- }
+ if(Minecraft::GetInstance()->player!=NULL)
+ {
+ app.SetAction(pMinecraft->player->GetXboxPad(),eAppAction_EthernetDisconnectedReturned);
+ }
else
{
// 4J-PB - turn off the PSN store icon just in case this happened when we were in one of the DLC menus
@@ -4541,7 +4543,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter )
bool saveStats = false;
if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession() )
{
- if(lpParameter != nullptr )
+ if(lpParameter != NULL )
{
switch( app.GetDisconnectReason() )
{
@@ -4573,16 +4575,16 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter )
}
pMinecraft->progressRenderer->progressStartNoAbort( exitReasonStringId );
// 4J - Force a disconnection, this handles the situation that the server has already disconnected
- if( pMinecraft->levels[0] != nullptr ) pMinecraft->levels[0]->disconnect(false);
- if( pMinecraft->levels[1] != nullptr ) pMinecraft->levels[1]->disconnect(false);
+ if( pMinecraft->levels[0] != NULL ) pMinecraft->levels[0]->disconnect(false);
+ if( pMinecraft->levels[1] != NULL ) pMinecraft->levels[1]->disconnect(false);
}
else
{
exitReasonStringId = IDS_EXITING_GAME;
pMinecraft->progressRenderer->progressStartNoAbort( IDS_EXITING_GAME );
- if( pMinecraft->levels[0] != nullptr ) pMinecraft->levels[0]->disconnect();
- if( pMinecraft->levels[1] != nullptr ) pMinecraft->levels[1]->disconnect();
+ if( pMinecraft->levels[0] != NULL ) pMinecraft->levels[0]->disconnect();
+ if( pMinecraft->levels[1] != NULL ) pMinecraft->levels[1]->disconnect();
}
// 4J Stu - This only does something if we actually have a server, so don't need to do any other checks
@@ -4597,7 +4599,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter )
}
else
{
- if(lpParameter != nullptr )
+ if(lpParameter != NULL )
{
switch( app.GetDisconnectReason() )
{
@@ -4634,7 +4636,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter )
pMinecraft->progressRenderer->progressStartNoAbort( exitReasonStringId );
}
}
- pMinecraft->setLevel(nullptr,exitReasonStringId,nullptr,saveStats,true);
+ pMinecraft->setLevel(NULL,exitReasonStringId,nullptr,saveStats,true);
// 4J-JEV: Fix for #106402 - TCR #014 BAS Debug Output:
// TU12: Mass Effect Mash-UP: Save file "Default_DisplayName" is created on all storage devices after signing out from a re-launched pre-generated world
@@ -4660,7 +4662,7 @@ int CMinecraftApp::UnlockFullInviteReturned(void *pParam,int iPad,C4JStorage::EM
// bug 11285 - TCR 001: BAS Game Stability: CRASH - When trying to join a full version game with a trial version, the trial crashes
// 4J-PB - we may be in the main menus here, and we don't have a pMinecraft->player
- if(pMinecraft->player==nullptr)
+ if(pMinecraft->player==NULL)
{
bNoPlayer=true;
}
@@ -4672,7 +4674,7 @@ int CMinecraftApp::UnlockFullInviteReturned(void *pParam,int iPad,C4JStorage::EM
// 4J-PB - need to check this user can access the store
#if defined(__PS3__) || defined(__PSVITA__)
bool bContentRestricted;
- ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr);
+ ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL);
if(bContentRestricted)
{
UINT uiIDA[1];
@@ -4717,7 +4719,7 @@ int CMinecraftApp::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::EMes
// 4J-PB - need to check this user can access the store
#if defined(__PS3__) || defined(__PSVITA__)
bool bContentRestricted;
- ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr);
+ ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL);
if(bContentRestricted)
{
UINT uiIDA[1];
@@ -4772,7 +4774,7 @@ int CMinecraftApp::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::EMes
int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CMinecraftApp* pApp = static_cast<CMinecraftApp *>(pParam);
+ CMinecraftApp* pApp = (CMinecraftApp*)pParam;
Minecraft *pMinecraft=Minecraft::GetInstance();
if(result==C4JStorage::EMessage_ResultAccept)
@@ -4782,7 +4784,7 @@ int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMes
// 4J-PB - need to check this user can access the store
#if defined(__PS3__) || defined(__PSVITA__)
bool bContentRestricted;
- ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr);
+ ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL);
if(bContentRestricted)
{
UINT uiIDA[1];
@@ -4844,7 +4846,7 @@ int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMes
int CMinecraftApp::TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CMinecraftApp* pApp = static_cast<CMinecraftApp *>(pParam);
+ CMinecraftApp* pApp = (CMinecraftApp*)pParam;
Minecraft *pMinecraft=Minecraft::GetInstance();
if(result==C4JStorage::EMessage_ResultAccept)
@@ -4855,7 +4857,7 @@ int CMinecraftApp::TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageR
// 4J-PB - need to check this user can access the store
#if defined(__PS3__) || defined(__PSVITA__)
bool bContentRestricted;
- ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr);
+ ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL);
if(bContentRestricted)
{
UINT uiIDA[1];
@@ -4902,7 +4904,7 @@ int CMinecraftApp::TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageR
void CMinecraftApp::ProfileReadErrorCallback(void *pParam)
{
- CMinecraftApp *pApp=static_cast<CMinecraftApp *>(pParam);
+ CMinecraftApp *pApp=(CMinecraftApp *)pParam;
int iPrimaryPlayer=ProfileManager.GetPrimaryPad();
pApp->SetAction(iPrimaryPlayer, eAppAction_ProfileReadError);
}
@@ -4934,7 +4936,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange
Minecraft::GetInstance()->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad()));
#endif
- CMinecraftApp *pApp=static_cast<CMinecraftApp *>(pParam);
+ CMinecraftApp *pApp=(CMinecraftApp *)pParam;
// check if the primary player signed out
int iPrimaryPlayer=ProfileManager.GetPrimaryPad();
@@ -4999,7 +5001,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange
if(i == iPrimaryPlayer) continue;
// A guest a signed in or out, out of order which invalidates all the guest players we have in the game
- if(hasGuestIdChanged && pApp->m_currentSigninInfo[i].dwGuestNumber != 0 && g_NetworkManager.GetLocalPlayerByUserIndex(i)!=nullptr)
+ if(hasGuestIdChanged && pApp->m_currentSigninInfo[i].dwGuestNumber != 0 && g_NetworkManager.GetLocalPlayerByUserIndex(i)!=NULL)
{
pApp->DebugPrintf("Recommending removal of player at index %d because their guest id changed\n",i);
pApp->SetAction(i, eAppAction_ExitPlayer);
@@ -5023,7 +5025,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange
// 4J-HG: If either the player is in the network manager or in the game, need to exit player
// TODO: Do we need to check the network manager?
- if (g_NetworkManager.GetLocalPlayerByUserIndex(i) != nullptr || Minecraft::GetInstance()->localplayers[i] != nullptr)
+ if (g_NetworkManager.GetLocalPlayerByUserIndex(i) != NULL || Minecraft::GetInstance()->localplayers[i] != NULL)
{
pApp->DebugPrintf("Player %d signed out\n", i);
pApp->SetAction(i, eAppAction_ExitPlayer);
@@ -5034,7 +5036,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange
// check if any of the addition players have signed out of PSN (primary player is handled below)
if(!switchToOffline && i != ProfileManager.GetLockedProfile() && !g_NetworkManager.IsLocalGame())
{
- if(g_NetworkManager.GetLocalPlayerByUserIndex(i)!=nullptr)
+ if(g_NetworkManager.GetLocalPlayerByUserIndex(i)!=NULL)
{
if(ProfileManager.IsSignedInLive(i) == false)
{
@@ -5109,7 +5111,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange
void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, unsigned int uiParam)
{
- CMinecraftApp* pClass = static_cast<CMinecraftApp *>(pParam);
+ CMinecraftApp* pClass = (CMinecraftApp*)pParam;
// push these on to the notifications to be handled in qnet's dowork
@@ -5131,7 +5133,7 @@ void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, un
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
{
if(!InputManager.IsPadConnected(i) &&
- Minecraft::GetInstance()->localplayers[i] != nullptr &&
+ Minecraft::GetInstance()->localplayers[i] != NULL &&
!ui.IsPauseMenuDisplayed(i) && !ui.IsSceneInStack(i, eUIScene_EndPoem) )
{
ui.CloseUIScenes(i);
@@ -5160,7 +5162,7 @@ void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, un
{
DLCTexturePack *pDLCTexPack=(DLCTexturePack *)pTexPack;
XCONTENTDEVICEID deviceID = pDLCTexPack->GetDLCDeviceID();
- if( XContentGetDeviceState( deviceID, nullptr ) != ERROR_SUCCESS )
+ if( XContentGetDeviceState( deviceID, NULL ) != ERROR_SUCCESS )
{
// Set texture pack flag so that it is now considered as not having audio - this is critical so that the next playStreaming does what it is meant to do,
// and also so that we don't try and unmount this again, or play any sounds from it in the future
@@ -5168,11 +5170,11 @@ void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, un
// need to stop the streaming audio - by playing streaming audio from the default texture pack now
Minecraft::GetInstance()->soundEngine->playStreaming(L"", 0, 0, 0, 0, 0);
- if(pDLCTexPack->m_pStreamedWaveBank!=nullptr)
+ if(pDLCTexPack->m_pStreamedWaveBank!=NULL)
{
pDLCTexPack->m_pStreamedWaveBank->Destroy();
}
- if(pDLCTexPack->m_pSoundBank!=nullptr)
+ if(pDLCTexPack->m_pSoundBank!=NULL)
{
pDLCTexPack->m_pSoundBank->Destroy();
}
@@ -5298,7 +5300,7 @@ void CMinecraftApp::SetDebugSequence(const char *pchSeq)
}
int CMinecraftApp::DebugInputCallback(LPVOID pParam)
{
- CMinecraftApp* pClass = static_cast<CMinecraftApp *>(pParam);
+ CMinecraftApp* pClass = (CMinecraftApp*)pParam;
//printf("sequence matched\n");
pClass->m_bDebugOptions=!pClass->m_bDebugOptions;
@@ -5324,7 +5326,7 @@ int CMinecraftApp::GetLocalPlayerCount(void)
Minecraft *pMinecraft = Minecraft::GetInstance();
for(int i=0;i<XUSER_MAX_COUNT;i++)
{
- if(pMinecraft != nullptr && pMinecraft->localplayers[i] != nullptr)
+ if(pMinecraft != NULL && pMinecraft->localplayers[i] != NULL)
{
iPlayerC++;
}
@@ -5474,15 +5476,15 @@ int CMinecraftApp::DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD d
DLCPack *pack = app.m_dlcManager.getPack( CONTENT_DATA_DISPLAY_NAME(ContentData) );
- if( pack != nullptr && pack->IsCorrupt() )
+ if( pack != NULL && pack->IsCorrupt() )
{
app.DebugPrintf("Pack '%ls' is corrupt, removing it from the DLC Manager.\n", CONTENT_DATA_DISPLAY_NAME(ContentData));
app.m_dlcManager.removePack(pack);
- pack = nullptr;
+ pack = NULL;
}
- if(pack == nullptr)
+ if(pack == NULL)
{
app.DebugPrintf("Pack \"%ls\" is not installed, so adding it\n", CONTENT_DATA_DISPLAY_NAME(ContentData));
@@ -5534,8 +5536,8 @@ int CMinecraftApp::DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD d
// bool bRes=app.IsFileInMemoryTextures(wTemp);
// // if the file is not already in the memory textures, then read it from TMS
// if(!bRes)
-// {
-// BYTE* pBuffer = nullptr;
+// {
+// BYTE *pBuffer=NULL;
// DWORD dwSize=0;
// // 4J-PB - out for now for DaveK so he doesn't get the birthday cape
// #ifdef _CONTENT_PACKAGE
@@ -5564,7 +5566,7 @@ void CMinecraftApp::HandleDLC(DLCPack *pack)
// 4J Stu - I don't know why we handle more than one file here any more, however this doesn't seem to work with the PS4 patches
if(dlcFilenames.size() > 0) m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[0], pack);
#else
- for(size_t i=0; i<dlcFilenames.size();i++)
+ for(int i=0; i<dlcFilenames.size();i++)
{
m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[i], pack);
}
@@ -5643,7 +5645,7 @@ void CMinecraftApp::InitTime()
// Get the frequency of the timer
LARGE_INTEGER qwTicksPerSec;
QueryPerformanceFrequency( &qwTicksPerSec );
- m_Time.fSecsPerTick = 1.0f / static_cast<float>(qwTicksPerSec.QuadPart);
+ m_Time.fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart;
// Save the start time
QueryPerformanceCounter( &m_Time.qwTime );
@@ -5669,10 +5671,16 @@ void CMinecraftApp::UpdateTime()
m_Time.qwAppTime.QuadPart += qwDeltaTime.QuadPart;
m_Time.qwTime.QuadPart = qwNewTime.QuadPart;
- m_Time.fElapsedTime = m_Time.fSecsPerTick * static_cast<FLOAT>(qwDeltaTime.QuadPart);
- m_Time.fAppTime = m_Time.fSecsPerTick * static_cast<FLOAT>(m_Time.qwAppTime.QuadPart);
+ m_Time.fElapsedTime = m_Time.fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart));
+ m_Time.fAppTime = m_Time.fSecsPerTick * ((FLOAT)(m_Time.qwAppTime.QuadPart));
}
+
+
+
+
+
+
bool CMinecraftApp::isXuidNotch(PlayerUID xuid)
{
if(m_xuidNotch != INVALID_XUID && xuid != INVALID_XUID)
@@ -5701,7 +5709,7 @@ void CMinecraftApp::AddMemoryTextureFile(const wstring &wName,PBYTE pbData,DWORD
{
EnterCriticalSection(&csMemFilesLock);
// check it's not already in
- PMEMDATA pData=nullptr;
+ PMEMDATA pData=NULL;
auto it = m_MEM_Files.find(wName);
if(it != m_MEM_Files.end())
{
@@ -5712,8 +5720,8 @@ void CMinecraftApp::AddMemoryTextureFile(const wstring &wName,PBYTE pbData,DWORD
if(pData->dwBytes == 0 && dwBytes != 0)
{
- // This should never be nullptr if dwBytes is 0
- if(pData->pbData!=nullptr) delete [] pData->pbData;
+ // This should never be NULL if dwBytes is 0
+ if(pData->pbData!=NULL) delete [] pData->pbData;
pData->pbData=pbData;
pData->dwBytes=dwBytes;
@@ -5809,7 +5817,7 @@ void CMinecraftApp::AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes)
{
EnterCriticalSection(&csMemTPDLock);
// check it's not already in
- PMEMDATA pData=nullptr;
+ PMEMDATA pData=NULL;
auto it = m_MEM_TPD.find(iConfig);
if(it == m_MEM_TPD.end())
{
@@ -5829,7 +5837,7 @@ void CMinecraftApp::RemoveMemoryTPDFile(int iConfig)
{
EnterCriticalSection(&csMemTPDLock);
// check it's not already in
- PMEMDATA pData=nullptr;
+ PMEMDATA pData=NULL;
auto it = m_MEM_TPD.find(iConfig);
if(it != m_MEM_TPD.end())
{
@@ -5844,7 +5852,7 @@ void CMinecraftApp::RemoveMemoryTPDFile(int iConfig)
#ifdef _XBOX
int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile)
{
- DLC_INFO *pDLCInfo=nullptr;
+ DLC_INFO *pDLCInfo=NULL;
// run through the DLC info to find the right texture pack/mash-up pack
for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i)
{
@@ -5862,7 +5870,7 @@ int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile)
#elif defined _XBOX_ONE
int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile)
{
- DLC_INFO *pDLCInfo=nullptr;
+ DLC_INFO *pDLCInfo=NULL;
// run through the DLC info to find the right texture pack/mash-up pack
for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i)
{
@@ -5958,7 +5966,7 @@ void CMinecraftApp::ProcessInvite(DWORD dwUserIndex, DWORD dwLocalUsersMask, con
int CMinecraftApp::ExitAndJoinFromInvite(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CMinecraftApp* pApp = static_cast<CMinecraftApp *>(pParam);
+ CMinecraftApp* pApp = (CMinecraftApp*)pParam;
//Minecraft *pMinecraft=Minecraft::GetInstance();
// buttons are swapped on this menu
@@ -5972,7 +5980,7 @@ int CMinecraftApp::ExitAndJoinFromInvite(void *pParam,int iPad,C4JStorage::EMess
int CMinecraftApp::ExitAndJoinFromInviteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CMinecraftApp *pClass = static_cast<CMinecraftApp *>(pParam);
+ CMinecraftApp *pClass = (CMinecraftApp *)pParam;
// Exit with or without saving
// Decline means save in this dialog
if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultThirdOption)
@@ -6063,7 +6071,7 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor
{
// 4J-PB - need to check this user can access the store
bool bContentRestricted;
- ProfileManager.GetChatAndContentRestrictions(iPad,true,nullptr,&bContentRestricted,nullptr);
+ ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL);
if(bContentRestricted)
{
UINT uiIDA[1];
@@ -6082,7 +6090,7 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor
app.DebugPrintf("Texture Pack - %s\n",pchPackName);
SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName);
- if(pSONYDLCInfo!=nullptr)
+ if(pSONYDLCInfo!=NULL)
{
char chName[42];
char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN];
@@ -6132,7 +6140,7 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor
DLC_INFO *pDLCInfo=app.GetDLCInfoForProductName((WCHAR *)pDLCPack->getName().c_str());
- StorageManager.InstallOffer(1,(WCHAR *)pDLCInfo->wsProductId.c_str(),nullptr,nullptr);
+ StorageManager.InstallOffer(1,(WCHAR *)pDLCInfo->wsProductId.c_str(),NULL,NULL);
// the license change coming in when the offer has been installed will cause this scene to refresh
}
@@ -6165,7 +6173,7 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor
// need to allow downloads here, or the player would need to quit the game to let the download of a texture pack happen. This might affect the network traffic, since the download could take all the bandwidth...
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
- StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr);
+ StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
}
}
else
@@ -6211,7 +6219,7 @@ int CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned(void *pParam,int iPad,C4
uiIDA[1]=IDS_CONFIRM_CANCEL;
// Give the player a warning about the trial version of the texture pack
- ui.RequestErrorMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad,&CMinecraftApp::WarningTrialTexturePackReturned,nullptr);
+ ui.RequestErrorMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad,&CMinecraftApp::WarningTrialTexturePackReturned,NULL);
return S_OK;
}
@@ -6723,7 +6731,7 @@ wstring CMinecraftApp::GetVKReplacement(unsigned int uiVKey)
default:
break;
}
- return nullptr;
+ return NULL;
#else
wstring replacement = L"";
switch(uiVKey)
@@ -6822,7 +6830,7 @@ wstring CMinecraftApp::GetIconReplacement(unsigned int uiIcon)
default:
break;
}
- return nullptr;
+ return NULL;
#else
wchar_t string[128];
@@ -6877,11 +6885,11 @@ HRESULT CMinecraftApp::RegisterMojangData(WCHAR *pXuidName, PlayerUID xuid, WCHA
{
HRESULT hr=S_OK;
eXUID eTempXuid=eXUID_Undefined;
- MOJANG_DATA *pMojangData=nullptr;
+ MOJANG_DATA *pMojangData=NULL;
// ignore the names if we don't recognize them
- if (pXuidName != nullptr)
- {
+ if(pXuidName!=NULL)
+ {
if( wcscmp( pXuidName, L"XUID_NOTCH" ) == 0 )
{
eTempXuid = eXUID_Notch; // might be needed for the apple at some point
@@ -6920,8 +6928,8 @@ HRESULT CMinecraftApp::RegisterConfigValues(WCHAR *pType, int iValue)
HRESULT hr=S_OK;
// #ifdef _XBOX
- // if(pType!=nullptr)
- // {
+ // if(pType!=NULL)
+ // {
// if(wcscmp(pType,L"XboxOneTransfer")==0)
// {
// if(iValue>0)
@@ -6971,8 +6979,8 @@ HRESULT CMinecraftApp::RegisterDLCData(WCHAR *pType, WCHAR *pBannerName, int iGe
}
#endif
- if(pType!=nullptr)
- {
+ if(pType!=NULL)
+ {
if(wcscmp(pType,L"Skin")==0)
{
pDLCData->eDLCType=e_DLC_SkinPack;
@@ -7156,7 +7164,7 @@ bool CMinecraftApp::GetDLCNameForPackID(const int iPackID,char **ppchKeyID)
auto it = DLCTextures_PackID.find(iPackID);
if( it == DLCTextures_PackID.end() )
{
- *ppchKeyID=nullptr;
+ *ppchKeyID=NULL;
return false;
}
else
@@ -7176,21 +7184,21 @@ DLC_INFO *CMinecraftApp::GetDLCInfo(char *pchDLCName)
if( it == DLCInfo.end() )
{
// nothing for this
- return nullptr;
+ return NULL;
}
else
{
return it->second;
}
}
- else return nullptr;
+ else return NULL;
}
DLC_INFO *CMinecraftApp::GetDLCInfoFromTPackID(int iTPID)
{
unordered_map<string, DLC_INFO *>::iterator it= DLCInfo.begin();
- for(size_t i=0;i<DLCInfo.size();i++)
+ for(int i=0;i<DLCInfo.size();i++)
{
if(((DLC_INFO *)it->second)->iConfig==iTPID)
{
@@ -7198,7 +7206,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoFromTPackID(int iTPID)
}
++it;
}
- return nullptr;
+ return NULL;
}
DLC_INFO *CMinecraftApp::GetDLCInfo(int iIndex)
@@ -7254,12 +7262,12 @@ bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,wstring &Produc
}
// DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(wstring &ProductId)
// {
-// return nullptr;
+// return NULL;
// }
DLC_INFO *CMinecraftApp::GetDLCInfoTrialOffer(int iIndex)
{
- return nullptr;
+ return NULL;
}
DLC_INFO *CMinecraftApp::GetDLCInfoFullOffer(int iIndex)
{
@@ -7313,7 +7321,7 @@ bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,ULONGLONG *pull
}
DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial)
{
- //DLC_INFO *pDLCInfo=nullptr;
+ //DLC_INFO *pDLCInfo=NULL;
if(DLCInfo_Trial.size()>0)
{
auto it = DLCInfo_Trial.find(ullOfferID_Trial);
@@ -7321,14 +7329,14 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial)
if( it == DLCInfo_Trial.end() )
{
// nothing for this
- return nullptr;
+ return NULL;
}
else
{
return it->second;
}
}
- else return nullptr;
+ else return NULL;
}
DLC_INFO *CMinecraftApp::GetDLCInfoTrialOffer(int iIndex)
@@ -7378,21 +7386,21 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(WCHAR *pwchProductID)
if( it == DLCInfo_Full.end() )
{
// nothing for this
- return nullptr;
+ return NULL;
}
else
{
return it->second;
}
}
- else return nullptr;
+ else return NULL;
}
DLC_INFO *CMinecraftApp::GetDLCInfoForProductName(WCHAR *pwchProductName)
{
unordered_map<wstring, DLC_INFO *>::iterator it= DLCInfo_Full.begin();
wstring wsProductName=pwchProductName;
- for(size_t i=0;i<DLCInfo_Full.size();i++)
+ for(int i=0;i<DLCInfo_Full.size();i++)
{
DLC_INFO *pDLCInfo=(DLC_INFO *)it->second;
if(wsProductName==pDLCInfo->wsDisplayName)
@@ -7402,7 +7410,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForProductName(WCHAR *pwchProductName)
++it;
}
- return nullptr;
+ return NULL;
}
#elif defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
@@ -7418,14 +7426,14 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full)
if( it == DLCInfo_Full.end() )
{
// nothing for this
- return nullptr;
+ return NULL;
}
else
{
return it->second;
}
}
- else return nullptr;
+ else return NULL;
}
#endif
@@ -7516,7 +7524,7 @@ void CMinecraftApp::ExitGameFromRemoteSave( LPVOID lpParameter )
uiIDA[0]=IDS_CONFIRM_CANCEL;
uiIDA[1]=IDS_CONFIRM_OK;
- ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, primaryPad,&CMinecraftApp::ExitGameFromRemoteSaveDialogReturned,nullptr);
+ ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, primaryPad,&CMinecraftApp::ExitGameFromRemoteSaveDialogReturned,NULL);
}
int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
@@ -7532,9 +7540,9 @@ int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4
{
#ifndef _XBOX
// Inform fullscreen progress scene that it's not being cancelled after all
- UIScene_FullscreenProgress *pScene = static_cast<UIScene_FullscreenProgress *>(ui.FindScene(eUIScene_FullscreenProgress));
+ UIScene_FullscreenProgress *pScene = (UIScene_FullscreenProgress *)ui.FindScene(eUIScene_FullscreenProgress);
#ifdef __PS3__
- if(pScene!=nullptr)
+ if(pScene!=NULL)
#else
if (pScene != nullptr)
#endif
@@ -7550,7 +7558,7 @@ int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4
void CMinecraftApp::SetSpecialTutorialCompletionFlag(int iPad, int index)
{
- if(index >= 0 && index < 32 && GameSettingsA[iPad] != nullptr)
+ if(index >= 0 && index < 32 && GameSettingsA[iPad] != NULL)
{
GameSettingsA[iPad]->uiSpecialTutorialBitmask |= (1<<index);
}
@@ -7579,7 +7587,7 @@ void CMinecraftApp::InvalidateBannedList(int iPad)
if(BannedListA[iPad].pBannedList)
{
delete [] BannedListA[iPad].pBannedList;
- BannedListA[iPad].pBannedList=nullptr;
+ BannedListA[iPad].pBannedList=NULL;
}
}
}
@@ -7608,10 +7616,10 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps
strcpy(pBannedListData->pszLevelName,pszLevelName);
m_vBannedListA[iPad]->push_back(pBannedListData);
- if (bWriteToTMS)
- {
- DWORD dwDataBytes = static_cast<DWORD>(sizeof(BANNEDLISTDATA)* m_vBannedListA[iPad]->size());
- PBANNEDLISTDATA pBannedList = reinterpret_cast<BANNEDLISTDATA*>(new CHAR [dwDataBytes]);
+ if(bWriteToTMS)
+ {
+ DWORD dwDataBytes=(DWORD)(sizeof(BANNEDLISTDATA)*m_vBannedListA[iPad]->size());
+ PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new CHAR [dwDataBytes]);
int iCount=0;
for (PBANNEDLISTDATA pData : *m_vBannedListA[iPad] )
{
@@ -7622,9 +7630,9 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps
//bool bRes=StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(PBYTE)pBannedList, dwDataBytes);
#ifdef _XBOX
- StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,C4JStorage::TMS_UGCTYPE_NONE,"BannedList",(PCHAR) pBannedList, dwDataBytes,nullptr,nullptr, 0);
+ StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,C4JStorage::TMS_UGCTYPE_NONE,"BannedList",(PCHAR) pBannedList, dwDataBytes,NULL,NULL, 0);
#elif defined _XBOX_ONE
- StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,nullptr,nullptr, 0);
+ StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,NULL,NULL, 0);
#endif
}
// update telemetry too
@@ -7658,7 +7666,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha
{
PBANNEDLISTDATA pBannedListData = *it;
- if(pBannedListData!=nullptr)
+ if(pBannedListData!=NULL)
{
#ifdef _XBOX_ONE
PlayerUID bannedPlayerUID = pBannedListData->wchPlayerUID;
@@ -7683,22 +7691,22 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha
}
}
- DWORD dwDataBytes=static_cast<DWORD>(sizeof(BANNEDLISTDATA) * m_vBannedListA[iPad]->size());
+ DWORD dwDataBytes=(DWORD)(sizeof(BANNEDLISTDATA)*m_vBannedListA[iPad]->size());
if(dwDataBytes==0)
{
// wipe the file
#ifdef _XBOX
StorageManager.DeleteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList");
#elif defined _XBOX_ONE
- StorageManager.TMSPP_DeleteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",nullptr,nullptr, 0);
+ StorageManager.TMSPP_DeleteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",NULL,NULL, 0);
#endif
}
else
{
PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new BYTE [dwDataBytes]);
- size_t iSize=m_vBannedListA[iPad]->size();
- for(size_t i=0;i<iSize;i++)
+ int iSize=(int)m_vBannedListA[iPad]->size();
+ for(int i=0;i<iSize;i++)
{
PBANNEDLISTDATA pBannedListData =m_vBannedListA[iPad]->at(i);
@@ -7707,7 +7715,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha
#ifdef _XBOX
StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(PBYTE)pBannedList, dwDataBytes);
#elif defined _XBOX_ONE
- StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,nullptr,nullptr, 0);
+ StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,NULL,NULL, 0);
#endif
delete [] pBannedList;
}
@@ -7751,7 +7759,7 @@ bool CMinecraftApp::AlreadySeenCreditText(const wstring &wstemp)
unsigned int CMinecraftApp::GetDLCCreditsCount()
{
- return static_cast<unsigned int>(vDLCCredits.size());
+ return (unsigned int)vDLCCredits.size();
}
SCreditTextItemDef * CMinecraftApp::GetDLCCredits(int iIndex)
@@ -8171,7 +8179,7 @@ unsigned int CMinecraftApp::GetGameHostOption(unsigned int uiHostSettings, eGame
bool CMinecraftApp::CanRecordStatsAndAchievements()
{
- bool isTutorial = Minecraft::GetInstance() != nullptr && Minecraft::GetInstance()->isTutorial();
+ bool isTutorial = Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->isTutorial();
// 4J Stu - All of these options give the host player some advantage, so should not allow achievements
return !(app.GetGameHostOption(eGameHostOption_HasBeenInCreative) ||
app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) ||
@@ -8870,7 +8878,7 @@ int CMinecraftApp::TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JSto
{
#endif
- CMinecraftApp* pClass = static_cast<CMinecraftApp *>(pParam);
+ CMinecraftApp* pClass = (CMinecraftApp *) pParam;
// find the right one in the vector
EnterCriticalSection(&pClass->csTMSPPDownloadQueue);
@@ -8889,8 +8897,9 @@ int CMinecraftApp::TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JSto
// set this to retrieved whether it found it or not
pCurrent->eState=e_TMS_ContentState_Retrieved;
- if(pFileData!=nullptr)
- {
+ if(pFileData!=NULL)
+ {
+
#ifdef _XBOX_ONE
@@ -9130,7 +9139,7 @@ void CMinecraftApp::ClearTMSPPFilesRetrieved()
int CMinecraftApp::DLCOffersReturned(void *pParam, int iOfferC, DWORD dwType, int iPad)
{
- CMinecraftApp* pClass = static_cast<CMinecraftApp *>(pParam);
+ CMinecraftApp* pClass = (CMinecraftApp *) pParam;
// find the right one in the vector
EnterCriticalSection(&pClass->csTMSPPDownloadQueue);
@@ -9155,10 +9164,10 @@ eDLCContentType CMinecraftApp::Find_eDLCContentType(DWORD dwType)
{
if(m_dwContentTypeA[i]==dwType)
{
- return static_cast<eDLCContentType>(i);
+ return (eDLCContentType)i;
}
}
- return static_cast<eDLCContentType>(0);
+ return (eDLCContentType)0;
}
bool CMinecraftApp::DLCContentRetrieved(eDLCMarketplaceType eType)
{
@@ -9241,7 +9250,7 @@ vector<ModelPart *> * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, vect
vector<ModelPart *> *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID)
{
EnterCriticalSection( &csAdditionalModelParts );
- vector<ModelPart *> *pvModelParts=nullptr;
+ vector<ModelPart *> *pvModelParts=NULL;
if(m_AdditionalModelParts.size()>0)
{
auto it = m_AdditionalModelParts.find(dwSkinID);
@@ -9258,7 +9267,7 @@ vector<ModelPart *> *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID)
vector<SKIN_BOX *> *CMinecraftApp::GetAdditionalSkinBoxes(DWORD dwSkinID)
{
EnterCriticalSection( &csAdditionalSkinBoxes );
- vector<SKIN_BOX *> *pvSkinBoxes=nullptr;
+ vector<SKIN_BOX *> *pvSkinBoxes=NULL;
if(m_AdditionalSkinBoxes.size()>0)
{
auto it = m_AdditionalSkinBoxes.find(dwSkinID);
@@ -9362,92 +9371,95 @@ wstring CMinecraftApp::getSkinPathFromId(DWORD skinId)
}
-int CMinecraftApp::TexturePackDialogReturned(void* pParam, int iPad, C4JStorage::EMessageResult result)
+int CMinecraftApp::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
+
#if defined __PSVITA__ || defined __PS3__ || defined __ORBIS__
- if (result == C4JStorage::EMessage_ResultAccept)
- {
- Minecraft* pMinecraft = Minecraft::GetInstance();
- if (pMinecraft->skins->selectTexturePackById(app.GetRequiredTexturePackID()))
- {
- // it's been installed already
- }
- else
- {
- // we need to enable background downloading for the DLC
- XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
-
- SONYDLC* pSONYDLCInfo = app.GetSONYDLCInfo(app.GetRequiredTexturePackID());
- if (pSONYDLCInfo != nullptr)
- {
- char chName[42];
- char chKeyName[20];
- char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN];
-
- memset(chSkuID, 0, SCE_NP_COMMERCE2_SKU_ID_LEN);
-
- memset(chKeyName, 0, sizeof(chKeyName));
- strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16);
-
- #ifdef __ORBIS__
- strcpy(chName, chKeyName);
- #else
- sprintf(chName, "%s-%s", app.GetCommerceCategory(), chKeyName);
- #endif
-
- app.GetDLCSkuIDFromProductList(chName, chSkuID);
-
- if (app.CheckForEmptyStore(iPad) == false)
- {
- if (app.DLCAlreadyPurchased(chSkuID))
- {
- app.DownloadAlreadyPurchased(chSkuID);
- }
- else
- {
- app.Checkout(chSkuID);
- }
- }
- }
- }
- }
- else
- {
- app.DebugPrintf("Continuing without installing texture pack\n");
- }
+ if(result==C4JStorage::EMessage_ResultAccept)
+ {
+ Minecraft *pMinecraft = Minecraft::GetInstance();
+ if( pMinecraft->skins->selectTexturePackById(app.GetRequiredTexturePackID()) )
+ {
+ // it's been installed already
+ }
+ else
+ {
+ // we need to enable background downloading for the DLC
+ XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
+ SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(app.GetRequiredTexturePackID());
+ if(pSONYDLCInfo!=NULL)
+ {
+ char chName[42];
+ char chKeyName[20];
+ char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN];
+
+ memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN);
+ // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it.
+ // So we assume the first sku for the product is the one we want
+ // MGH - keyname in the DLC file is 16 chars long, but there's no space for a NULL terminating char
+ memset(chKeyName, 0, sizeof(chKeyName));
+ strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16);
+
+ #ifdef __ORBIS__
+ strcpy(chName, chKeyName);
+ #else
+ sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName);
+ #endif
+ app.GetDLCSkuIDFromProductList(chName,chSkuID);
+ // 4J-PB - need to check for an empty store
+ if(app.CheckForEmptyStore(iPad)==false)
+ {
+ if(app.DLCAlreadyPurchased(chSkuID))
+ {
+ app.DownloadAlreadyPurchased(chSkuID);
+ }
+ else
+ {
+ app.Checkout(chSkuID);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ app.DebugPrintf("Continuing without installing texture pack\n");
+ }
#endif
#ifdef _XBOX
- if (result != C4JStorage::EMessage_Cancelled)
- {
- if (app.GetRequiredTexturePackID() != 0)
- {
- XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
-
- ULONGLONG ullOfferID_Full;
- ULONGLONG ullIndexA[1];
- app.GetDLCFullOfferIDForPackID(app.GetRequiredTexturePackID(), &ullOfferID_Full);
-
- if (result == C4JStorage::EMessage_ResultAccept)
- {
- ullIndexA[0] = ullOfferID_Full;
- StorageManager.InstallOffer(1, ullIndexA, nullptr, nullptr);
- }
- else
- {
- DLC_INFO* pDLCInfo = app.GetDLCInfoForFullOfferID(ullOfferID_Full);
- ullIndexA[0] = pDLCInfo->ullOfferID_Trial;
- StorageManager.InstallOffer(1, ullIndexA, nullptr, nullptr);
- }
- }
- }
+ if(result!=C4JStorage::EMessage_Cancelled)
+ {
+ if(app.GetRequiredTexturePackID()!=0)
+ {
+ // we need to enable background downloading for the DLC
+ XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
+
+ ULONGLONG ullOfferID_Full;
+ ULONGLONG ullIndexA[1];
+ app.GetDLCFullOfferIDForPackID(app.GetRequiredTexturePackID(),&ullOfferID_Full);
+
+ if( result==C4JStorage::EMessage_ResultAccept ) // Full version
+ {
+ ullIndexA[0]=ullOfferID_Full;
+ StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
+ }
+ else // trial version
+ {
+ DLC_INFO *pDLCInfo=app.GetDLCInfoForFullOfferID(ullOfferID_Full);
+ ullIndexA[0]=pDLCInfo->ullOfferID_Trial;
+ StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
+ }
+ }
+ }
#endif
- return 0;
+ return 0;
}
+
int CMinecraftApp::getArchiveFileSize(const wstring &filename)
{
- TexturePack *tPack = nullptr;
+ TexturePack *tPack = NULL;
Minecraft *pMinecraft = Minecraft::GetInstance();
if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected();
if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename))
@@ -9459,7 +9471,7 @@ int CMinecraftApp::getArchiveFileSize(const wstring &filename)
bool CMinecraftApp::hasArchiveFile(const wstring &filename)
{
- TexturePack *tPack = nullptr;
+ TexturePack *tPack = NULL;
Minecraft *pMinecraft = Minecraft::GetInstance();
if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected();
if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename)) return true;
@@ -9468,7 +9480,7 @@ bool CMinecraftApp::hasArchiveFile(const wstring &filename)
byteArray CMinecraftApp::getArchiveFile(const wstring &filename)
{
- TexturePack *tPack = nullptr;
+ TexturePack *tPack = NULL;
Minecraft *pMinecraft = Minecraft::GetInstance();
if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected();
if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename))
@@ -9497,19 +9509,19 @@ int CMinecraftApp::GetDLCInfoFullOffersCount()
}
#else
int CMinecraftApp::GetDLCInfoTrialOffersCount()
-{
- return static_cast<int>(DLCInfo_Trial.size());
+{
+ return (int)DLCInfo_Trial.size();
}
-int CMinecraftApp::GetDLCInfoFullOffersCount()
-{
- return static_cast<int>(DLCInfo_Full.size());
+int CMinecraftApp::GetDLCInfoFullOffersCount()
+{
+ return (int)DLCInfo_Full.size();
}
#endif
int CMinecraftApp::GetDLCInfoTexturesOffersCount()
-{
- return static_cast<int>(DLCTextures_PackID.size());
+{
+ return (int)DLCTextures_PackID.size();
}
// AUTOSAVE
@@ -9809,7 +9821,7 @@ void CMinecraftApp::getLocale(vector<wstring> &vecWstrLocales)
locales.push_back(eMCLang_enUS);
locales.push_back(eMCLang_null);
- for (size_t i=0; i<locales.size(); i++)
+ for (int i=0; i<locales.size(); i++)
{
eMCLang lang = locales.at(i);
vecWstrLocales.push_back( m_localeA[lang] );