the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 1288 lines 39 kB view raw
1// Minecraft.cpp : Defines the entry point for the application. 2// 3 4#include "stdafx.h" 5 6#include <assert.h> 7#include "..\XUI\XUI_MainMenu.h" 8#include "..\..\..\Minecraft.Client\SurvivalMode.h" 9#include "..\..\..\Minecraft.World\ConsoleSaveFileIO.h" 10#include "..\..\LocalPlayer.h" 11#include "..\..\..\Minecraft.World\AABB.h" 12#include "..\..\..\Minecraft.World\Vec3.h" 13#include "..\..\User.h" 14//#include "XUI_CreateLoad.h" 15#include "..\..\..\Minecraft.World\StringHelpers.h" 16#include "..\..\..\Minecraft.World\Random.h" 17#include "..\..\MinecraftServer.h" 18#include "..\..\Minecraft.h" 19#include "..\..\Options.h" 20#include "..\..\Font.h" 21#include "..\..\Common\GameRules\ConsoleGameRules.h" 22 23#define DLC_INSTALLED_TIMER_ID 1 24#define DLC_INSTALLED_TIMER_TIME 100 25#define TMS_TIMER_ID 2 26#define TMS_TIMER_TIME 100 27Random *CScene_Main::random = new Random(); 28 29//---------------------------------------------------------------------------------- 30// Performs initialization tasks - retrieves controls. 31//---------------------------------------------------------------------------------- 32HRESULT CScene_Main::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) 33{ 34 MapChildControls(); 35 36 XuiControlSetText(m_Buttons[BUTTON_PLAYGAME],app.GetString(IDS_PLAY_GAME)); 37 XuiControlSetText(m_Buttons[BUTTON_LEADERBOARDS],app.GetString(IDS_LEADERBOARDS)); 38 XuiControlSetText(m_Buttons[BUTTON_ACHIEVEMENTS],app.GetString(IDS_ACHIEVEMENTS)); 39 XuiControlSetText(m_Buttons[BUTTON_HELPANDOPTIONS],app.GetString(IDS_HELP_AND_OPTIONS)); 40 XuiControlSetText(m_Buttons[BUTTON_UNLOCKFULLGAME],app.GetString(IDS_UNLOCK_FULL_GAME)); 41 XuiControlSetText(m_Buttons[BUTTON_EXITGAME],app.GetString(IDS_EXIT_GAME)); 42 43 m_Timer.SetShow(FALSE); 44 m_eAction=eAction_None; 45 46 // Display the tooltips 47 HRESULT hr = S_OK; 48 ui.SetTooltips(DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT); 49 50 // can't set presence until someone is signed in and playing 51 52 // Need to check which menu items to display 53 54 // Are we the trial version? 55 // store the exitgame position 56 m_Buttons[BUTTON_EXITGAME].GetPosition(&m_vPosExitGame); 57 58 if(ProfileManager.IsFullVersion()) 59 { 60 // Replace the Unlock Full Game with Downloadable Content 61 m_Buttons[BUTTON_UNLOCKFULLGAME].SetText(app.GetString(IDS_DOWNLOADABLECONTENT)); 62 XuiElementSetShow(m_Buttons[BUTTON_UNLOCKFULLGAME],TRUE); 63 } 64 65 // Do we have downloadable content? - We need to have this in for a Pre-Cert test, whether or not we have DLC at the time. 66 67 68 CXuiSceneBase::ShowBackground( DEFAULT_XUI_MENU_USER, TRUE ); 69 CXuiSceneBase::ShowLogo( DEFAULT_XUI_MENU_USER, TRUE ); 70 71 const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string 72 WCHAR szResourceLocator[ LOCATOR_SIZE ]; 73 74 // load from the .xzp file 75 const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); 76 swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/splashes.txt"); 77 78 BYTE *splashesData; 79 UINT splashesSize; 80 hr = XuiResourceLoadAllNoLoc(szResourceLocator, &splashesData, &splashesSize); 81 82 if( HRESULT_SUCCEEDED( hr ) ) 83 { 84 //BufferedReader *br = new BufferedReader(new InputStreamReader(InputStream::getResourceAsStream(L"res\\title\\splashes.txt"))); //, Charset.forName("UTF-8") 85 byteArray splashesArray(splashesSize); 86 memcpy(splashesArray.data, splashesData, splashesSize); 87 ByteArrayInputStream *bais= new ByteArrayInputStream(splashesArray); 88 InputStreamReader *isr = new InputStreamReader( bais ); 89 BufferedReader *br = new BufferedReader( isr ); 90 91 wstring line = L""; 92 while ( !(line = br->readLine()).empty() ) 93 { 94 line = trimString( line ); 95 if (line.length() > 0) 96 { 97 m_splashes.push_back(line); 98 } 99 } 100 101 XuiFree(splashesData); // Frees copy returned from XuiResourceLoadAllNoLoc 102 103 br->close(); 104 delete br; 105 delete isr; 106 delete bais; // Frees copy made in splashesArray 107 } 108 109 XuiElementGetBounds(m_Subtitle,&m_fSubtitleWidth, &m_fSubtitleHeight); 110 111#if 1 112 XuiElementSetShow(m_Subtitle, FALSE); 113 XuiElementSetShow(m_SubtitleMCFont, TRUE); 114#else 115 XuiElementSetShow(m_Subtitle, TRUE); 116 XuiElementSetShow(m_SubtitleMCFont, FALSE); 117#endif 118 119 m_bIgnorePress=false; 120 121 // 4J Stu - Clear out any loaded game rules 122 app.setLevelGenerationOptions(NULL); 123 124 // Fix for #45154 - Frontend: DLC: Content can only be downloaded from the frontend if you have not joined/exited multiplayer 125 XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); 126 127 return S_OK; 128} 129 130HRESULT CScene_Main::OnNotifySetFocus(HXUIOBJ hObjSource, XUINotifyFocus *pNotifyFocusData, BOOL& bHandled) 131{ 132 // If we sign out when in the saves list, we get a notifysetfocus in the saves list after the init of the main menu 133 ui.SetTooltips(DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT); 134 135 return S_OK; 136} 137 138 139//---------------------------------------------------------------------------------- 140// Handler for the button press message. 141//---------------------------------------------------------------------------------- 142HRESULT CScene_Main::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled) 143{ 144 // should we ignore the button press? This will be set if we're waiting for a callback from a function launched from a button press 145 if(m_bIgnorePress) return S_OK; 146 147 // This assumes all buttons can only be pressed with the A button 148 ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A); 149 150 unsigned int uiButtonCounter=0; 151 //Minecraft *pMinecraft=Minecraft::GetInstance(); 152 153 while((uiButtonCounter<BUTTONS_MAX) && (m_Buttons[uiButtonCounter]!=hObjPressed)) uiButtonCounter++; 154 155 ProfileManager.SetPrimaryPad(pNotifyPressData->UserIndex); 156 ProfileManager.SetLockedProfile(-1); 157 158 // Determine which button was pressed, 159 // and call the appropriate function. 160 switch(uiButtonCounter) 161 { 162 case BUTTON_PLAYGAME: 163 // Move to the new/load game screen 164 // need a signed in user here 165 166 ProfileManager.SetCurrentGameActivity(pNotifyPressData->UserIndex,CONTEXT_PRESENCE_MENUS,true); 167 168 m_eAction=eAction_RunGame; 169 if(ProfileManager.IsSignedIn(pNotifyPressData->UserIndex)) 170 { 171 RunPlayGame(pNotifyPressData->UserIndex); 172 } 173 else 174 { 175 // get them to sign in 176 UINT uiIDA[2]; 177 uiIDA[0]=IDS_CONFIRM_OK; 178 uiIDA[1]=IDS_CONFIRM_CANCEL; 179 StorageManager.RequestMessageBox(IDS_MUST_SIGN_IN_TITLE, IDS_MUST_SIGN_IN_TEXT, uiIDA, 2, pNotifyPressData->UserIndex,&CScene_Main::MustSignInReturned,this, app.GetStringTable()); 180 } 181 182 break; 183 184 case BUTTON_LEADERBOARDS: 185 m_eAction=eAction_RunLeaderboards; 186 if(ProfileManager.IsSignedIn(pNotifyPressData->UserIndex)) 187 { 188 RunLeaderboards(pNotifyPressData->UserIndex); 189 } 190 else 191 { 192 // get them to sign in 193 //ProfileManager.RequestSignInUI(false, false, true,false,true, &CScene_Main::Leaderboards_SignInReturned, this); 194 // get them to sign in 195 UINT uiIDA[2]; 196 uiIDA[0]=IDS_CONFIRM_OK; 197 uiIDA[1]=IDS_CONFIRM_CANCEL; 198 StorageManager.RequestMessageBox(IDS_MUST_SIGN_IN_TITLE, IDS_MUST_SIGN_IN_TEXT, uiIDA, 2, pNotifyPressData->UserIndex,&CScene_Main::MustSignInReturned,this, app.GetStringTable()); 199 200 } 201 break; 202 case BUTTON_ACHIEVEMENTS: 203 m_eAction=eAction_RunAchievements; 204 if(ProfileManager.IsSignedIn(pNotifyPressData->UserIndex)) 205 { 206 RunAchievements(pNotifyPressData->UserIndex); 207 } 208 else 209 { 210 // get them to sign in 211 //ProfileManager.RequestSignInUI(false, false, true,false,true,&CScene_Main::Achievements_SignInReturned,this ); 212 // get them to sign in 213 UINT uiIDA[2]; 214 uiIDA[0]=IDS_CONFIRM_OK; 215 uiIDA[1]=IDS_CONFIRM_CANCEL; 216 StorageManager.RequestMessageBox(IDS_MUST_SIGN_IN_TITLE, IDS_MUST_SIGN_IN_TEXT, uiIDA, 2, pNotifyPressData->UserIndex,&CScene_Main::MustSignInReturned,this, app.GetStringTable()); 217 218 } 219 220 break; 221 case BUTTON_HELPANDOPTIONS: 222 // need a signed in user here, so we have a profile to write to 223 ProfileManager.SetLockedProfile(pNotifyPressData->UserIndex); 224 225 m_eAction=eAction_RunHelpAndOptions; 226 if(ProfileManager.IsSignedIn(pNotifyPressData->UserIndex)) 227 { 228 RunHelpAndOptions(pNotifyPressData->UserIndex); 229 } 230 else 231 { 232 // get them to sign in 233 //ProfileManager.RequestSignInUI(false, false, true,false,true,&CScene_Main::HelpAndOptions_SignInReturned,this ); 234 // get them to sign in 235 UINT uiIDA[2]; 236 uiIDA[0]=IDS_CONFIRM_OK; 237 uiIDA[1]=IDS_CONFIRM_CANCEL; 238 StorageManager.RequestMessageBox(IDS_MUST_SIGN_IN_TITLE, IDS_MUST_SIGN_IN_TEXT, uiIDA, 2, pNotifyPressData->UserIndex,&CScene_Main::MustSignInReturned,this, app.GetStringTable()); 239 240 } 241 break; 242 // case BUTTON_RETURNTOARCADE: 243 // break; 244 case BUTTON_UNLOCKFULLGAME: 245 { 246 // need a signed in user here 247 ProfileManager.SetLockedProfile(pNotifyPressData->UserIndex); 248 249 m_eAction=eAction_RunUnlockOrDLC; 250 if(ProfileManager.IsSignedIn(pNotifyPressData->UserIndex)) 251 { 252 RunUnlockOrDLC(pNotifyPressData->UserIndex); 253 } 254 else 255 { 256 // get them to sign in 257 UINT uiIDA[2]; 258 uiIDA[0]=IDS_CONFIRM_OK; 259 uiIDA[1]=IDS_CONFIRM_CANCEL; 260 StorageManager.RequestMessageBox(IDS_MUST_SIGN_IN_TITLE, IDS_MUST_SIGN_IN_TEXT, uiIDA, 2, pNotifyPressData->UserIndex,&CScene_Main::MustSignInReturned,this, app.GetStringTable()); 261 } 262 } 263 break; 264 case BUTTON_EXITGAME: 265 if( ProfileManager.IsFullVersion() ) 266 { 267 UINT uiIDA[2]; 268 uiIDA[0]=IDS_CANCEL; 269 uiIDA[1]=IDS_OK; 270 StorageManager.RequestMessageBox(IDS_WARNING_ARCADE_TITLE, IDS_WARNING_ARCADE_TEXT, uiIDA, 2, XUSER_INDEX_ANY,&CScene_Main::ExitGameReturned,this); 271 } 272 else 273 { 274 app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_TrialExitUpsell); 275 } 276 break; 277 278 default: 279 break; 280 } 281 282 283 284 return S_OK; 285} 286 287HRESULT CScene_Main::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled) 288{ 289 ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT); 290 CXuiSceneBase::ShowLogo(DEFAULT_XUI_MENU_USER,TRUE); 291 CXuiSceneBase::ShowBackground( DEFAULT_XUI_MENU_USER, TRUE ); 292 // unlock the locked profile - anyone can navigate the main menu 293 ProfileManager.SetLockedProfile(-1); 294 295 // incase the debug trial version has been set 296 // Are we the trial version? 297 298 m_Buttons[BUTTON_EXITGAME].GetPosition(&m_vPosExitGame); 299 300 for(int i=0;i<BUTTONS_MAX;i++) 301 { 302 m_Buttons[i].SetShow(TRUE); 303 } 304 305 306 if(ProfileManager.IsFullVersion()) 307 { 308 // Replace the Unlock Full Game with Downloadable Content 309 m_Buttons[BUTTON_UNLOCKFULLGAME].SetText(app.GetString(IDS_DOWNLOADABLECONTENT)); 310 XuiElementSetShow(m_Buttons[BUTTON_UNLOCKFULLGAME],TRUE); 311 } 312 313 // Fix for #45154 - Frontend: DLC: Content can only be downloaded from the frontend if you have not joined/exited multiplayer 314 XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); 315 m_bIgnorePress=false; 316 m_Timer.SetShow(FALSE); 317 318 return S_OK; 319} 320 321HRESULT CScene_Main::OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled ) 322{ 323 if(pTransition->dwTransAction==XUI_TRANSITION_ACTION_DESTROY ) return S_OK; 324 325 if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO) 326 { 327 // 4J-PB - remove the "hobo humping" message legal (Sony) say we can't have - pretty sure Microsoft would say the same if they noticed it. 328 int splashIndex = eSplashRandomStart + 1 + random->nextInt( (int)m_splashes.size() - (eSplashRandomStart + 1) ); 329 330 // Override splash text on certain dates 331 SYSTEMTIME LocalSysTime; 332 GetLocalTime( &LocalSysTime ); 333 if (LocalSysTime.wMonth == 11 && LocalSysTime.wDay == 9) 334 { 335 splashIndex = eSplashHappyBirthdayEx; 336 } 337 else if (LocalSysTime.wMonth == 6 && LocalSysTime.wDay == 1) 338 { 339 splashIndex = eSplashHappyBirthdayNotch; 340 } 341 else if (LocalSysTime.wMonth == 12 && LocalSysTime.wDay == 24) // the Java game shows this on Christmas Eve, so we will too 342 { 343 splashIndex = eSplashMerryXmas; 344 } 345 else if (LocalSysTime.wMonth == 1 && LocalSysTime.wDay == 1) 346 { 347 splashIndex = eSplashHappyNewYear; 348 } 349 //splashIndex = 47; // Very short string 350 //splashIndex = 197; // Very long string 351 //splashIndex = 296; // Coloured 352 //splashIndex = 297; // Noise 353 wstring splash = m_splashes.at( splashIndex ); 354 m_Subtitle.SetText(splash.c_str()); 355 m_SubtitleMCFont.SetText(splash.c_str()); 356 357#ifndef OVERRIDE_XUI_FONT_RENDERER 358 XUIRect xuiRect; 359 HRESULT hr=S_OK; 360 float fWidth,fHeight; 361 362 HXUIOBJ visual=NULL; 363 HXUIOBJ pulser, subtitle, text; 364 hr=XuiControlGetVisual(m_Subtitle.m_hObj,&visual); 365 hr=XuiElementGetChildById(visual,L"Pulser",&pulser); 366 hr=XuiElementGetChildById(pulser,L"SubTitle",&subtitle); 367 hr=XuiElementGetChildById(subtitle,L"Text_String",&text); 368 369 memset(&xuiRect, 0, sizeof(xuiRect)); 370 // Start with a base size 371 XuiElementSetBounds(m_Subtitle,m_fSubtitleWidth, m_fSubtitleHeight); 372 hr=XuiTextPresenterMeasureText(text, splash.c_str(), &xuiRect); 373 XuiElementGetBounds(text,&fWidth, &fHeight); 374 375 float diff = fWidth / (xuiRect.right+5); 376 377 diff = min(diff,MAIN_MENU_MAX_TEXT_SCALE); 378 379 // Resize 380 XuiElementGetBounds(m_Subtitle,&fWidth, &fHeight); 381 XuiElementSetBounds(m_Subtitle,fWidth/diff, fHeight); 382 383 // Scale 384 D3DXVECTOR3 vScale(diff,diff,0); 385 XuiElementSetScale(m_Subtitle,&vScale); 386 387 //Adjust pivot for animation 388 D3DXVECTOR3 vPivot; 389 XuiElementGetPivot(subtitle,&vPivot); 390 vPivot.x = vPivot.x + ( ( (fWidth/diff) - fWidth) / 2 ); 391 XuiElementSetPivot(subtitle,&vPivot); 392 393 // 4J-PB - Going to resize buttons if the text is too big to fit on any of them (Br-pt problem with the length of Unlock Full Game) 394 395 float fMaxTextLen=0.0f; 396 float fTextVisualLen; 397 float fMaxButton; 398 399 hr=XuiControlGetVisual(m_Buttons[0].m_hObj,&visual); 400 hr=XuiElementGetChildById(visual,L"text_Label",&text); 401 hr=XuiElementGetBounds(text,&fTextVisualLen,&fHeight); 402 m_Buttons[0].GetBounds(&fMaxButton,&fHeight); 403 404 405 for(int i=0;i<BUTTONS_MAX;i++) 406 { 407 hr=XuiTextPresenterMeasureText(text, m_Buttons[i].GetText(), &xuiRect); 408 if(xuiRect.right>fMaxTextLen) fMaxTextLen=xuiRect.right; 409 } 410 411 if(fTextVisualLen<fMaxTextLen) 412 { 413 D3DXVECTOR3 vec; 414 415 // centre is vec.x+(fWidth/2) 416 for(int i=0;i<BUTTONS_MAX;i++) 417 { 418 // need to resize and reposition the buttons 419 m_Buttons[i].GetPosition(&vec); 420 m_Buttons[i].GetBounds(&fWidth,&fHeight); 421 vec.x= vec.x+(fWidth/2.0f)-(fMaxTextLen/2.0f); 422 423 m_Buttons[i].SetPosition(&vec); 424 m_Buttons[i].SetBounds(fMaxButton+fMaxTextLen-fTextVisualLen,fHeight); 425 } 426 } 427#endif 428 } 429 430 return S_OK; 431} 432 433HRESULT CScene_Main::OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled) 434{ 435#ifdef _MINECON 436 // added so we can skip greyed out items for Minecon 437 pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE); 438 439 if(pControlNavigateData->hObjDest!=NULL) 440 { 441 bHandled=TRUE; 442 } 443#endif 444 return S_OK; 445} 446 447HRESULT CScene_Main::OnKeyDown(XUIMessageInput *pInputData, BOOL& bHandled) 448{ 449 ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode); 450 451 // Don't set handled to true. 452 453 return S_OK; 454} 455 456///////////////////////////////////////////////////////////// 457 458int CScene_Main::SignInReturned(void *pParam,bool bContinue) 459{ 460 CScene_Main* pClass = (CScene_Main*)pParam; 461 462 if(bContinue==true) 463 { 464 StorageManager.SetSaveDevice(&CScene_Main::DeviceSelectReturned,pClass); 465 } 466 467 468 return 0; 469} 470 471int CScene_Main::DeviceSelectReturned(void *pParam,bool bContinue) 472{ 473 CScene_Main* pClass = (CScene_Main*)pParam; 474 //HRESULT hr; 475 476 if(bContinue==true) 477 { 478 // change the minecraft player name 479 Minecraft::GetInstance()->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); 480 // ensure we've applied this player's settings 481 app.ApplyGameSettingsChanged(ProfileManager.GetPrimaryPad()); 482 // check for DLC 483 // start timer to track DLC check finished 484 pClass->m_Timer.SetShow(TRUE); 485 XuiSetTimer(pClass->m_hObj,DLC_INSTALLED_TIMER_ID,DLC_INSTALLED_TIMER_TIME); 486 487 //app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MultiGameJoinLoad); 488 } 489 else 490 { 491 // unlock the profile 492 ProfileManager.SetLockedProfile(-1); 493 ProfileManager.SetPrimaryPad(-1); 494 for(int i=0;i<XUSER_MAX_COUNT;i++) 495 { 496 // if the user is valid, we should set the presence 497 if(ProfileManager.IsSignedIn(i)) 498 { 499 ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); 500 } 501 } 502 } 503 504 return 0; 505} 506 507int CScene_Main::CreateLoad_OfflineProfileReturned(void *pParam,bool bContinue, int iPad) 508{ 509 CScene_Main* pClass = (CScene_Main*)pParam; 510 511 if(bContinue==true) 512 { 513 // accepted offline profiles, so go on to select a device 514 ProfileManager.SetLockedProfile(ProfileManager.GetPrimaryPad()); 515 516 // change the minecraft player name 517 Minecraft::GetInstance()->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); 518 519 if(ProfileManager.IsFullVersion()) 520 { 521 if(StorageManager.SetSaveDevice(&CScene_Main::DeviceSelectReturned,pClass)) 522 { 523 // save device already selected 524 // ensure we've applied this player's settings 525 app.ApplyGameSettingsChanged(ProfileManager.GetPrimaryPad()); 526 527 // check for DLC 528 // start timer to track DLC check finished 529 pClass->m_Timer.SetShow(TRUE); 530 XuiSetTimer(pClass->m_hObj,DLC_INSTALLED_TIMER_ID,DLC_INSTALLED_TIMER_TIME); 531 532 //app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MultiGameJoinLoad); 533 } 534 } 535 else 536 { 537 // 4J-PB - if this is the trial game, we can't have any networking 538 // Can't apply the player's settings here - they haven't come back from the QuerySignInStatud call above yet. 539 // Need to let them action in the main loop when they come in 540 // ensure we've applied this player's settings 541 //app.ApplyGameSettingsChanged(iPad); 542 // go straight in to the trial level 543 LoadTrial(); 544 } 545 } 546 else 547 { 548 // force a sign-in - they were offline, and they want to be online, so don't let it display offline players 549 // set the bAddUser to false to allow offline to go online by selecting the already signed in player again 550 ProfileManager.RequestSignInUI(false, false, true,false,false,&CScene_Main::CreateLoad_SignInReturned,pClass, ProfileManager.GetPrimaryPad() ); 551 } 552 553 return 0; 554} 555 556int CScene_Main::CreateLoad_SignInReturned(void *pParam,bool bContinue, int iPad) 557{ 558 CScene_Main* pClass = (CScene_Main*)pParam; 559 560 if(bContinue==true) 561 { 562 UINT uiIDA[1]; 563 uiIDA[0]=IDS_OK; 564 565 if(ProfileManager.IsGuest(ProfileManager.GetPrimaryPad())) 566 { 567 StorageManager.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); 568 } 569 else 570 { 571 ProfileManager.SetLockedProfile(ProfileManager.GetPrimaryPad()); 572 573 574 // change the minecraft player name 575 Minecraft::GetInstance()->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); 576 577 if(ProfileManager.IsFullVersion()) 578 { 579 // Check if we're signed in to LIVE 580 if(ProfileManager.IsSignedInLive(iPad)) 581 { 582 // 4J-PB - Need to check for installed DLC 583 if(!app.DLCInstallProcessCompleted()) app.StartInstallDLCProcess(iPad); 584 585 if(ProfileManager.IsGuest(iPad)) 586 { 587 StorageManager.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); 588 } 589 else 590 { 591 // check if all the TMS files are loaded 592 if(app.GetTMSDLCInfoRead() && app.GetTMSXUIDsFileRead() && app.GetBanListRead(iPad)) 593 { 594 if(StorageManager.SetSaveDevice(&CScene_Main::DeviceSelectReturned,pClass)==true) 595 { 596 // save device already selected 597 598 // ensure we've applied this player's settings 599 app.ApplyGameSettingsChanged(ProfileManager.GetPrimaryPad()); 600 // check for DLC 601 // start timer to track DLC check finished 602 pClass->m_Timer.SetShow(TRUE); 603 XuiSetTimer(pClass->m_hObj,DLC_INSTALLED_TIMER_ID,DLC_INSTALLED_TIMER_TIME); 604 //app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MultiGameJoinLoad); 605 } 606 } 607 else 608 { 609 // Changing to async TMS calls 610 app.SetTMSAction(iPad,eTMSAction_TMSPP_RetrieveFiles_RunPlayGame); 611 612 // block all input 613 pClass->m_bIgnorePress=true; 614 // We want to hide everything in this scene and display a timer until we get a completion for the TMS files 615 for(int i=0;i<BUTTONS_MAX;i++) 616 { 617 pClass->m_Buttons[i].SetShow(FALSE); 618 } 619 620 // turn off tooltips 621 ui.SetTooltips(DEFAULT_XUI_MENU_USER, -1); 622 623 pClass->m_Timer.SetShow(TRUE); 624 } 625 } 626 } 627 else 628 { 629 // offline 630 ProfileManager.DisplayOfflineProfile(&CScene_Main::CreateLoad_OfflineProfileReturned,pClass, ProfileManager.GetPrimaryPad() ); 631 } 632 } 633 else 634 { 635 // 4J-PB - if this is the trial game, we can't have any networking 636 // Can't apply the player's settings here - they haven't come back from the QuerySignInStatud call above yet. 637 // Need to let them action in the main loop when they come in 638 // ensure we've applied this player's settings 639 //app.ApplyGameSettingsChanged(iPad); 640 641 // go straight in to the trial level 642 LoadTrial(); 643 } 644 } 645 } 646 else 647 { 648 // unlock the profile 649 ProfileManager.SetLockedProfile(-1); 650 for(int i=0;i<XUSER_MAX_COUNT;i++) 651 { 652 // if the user is valid, we should set the presence 653 if(ProfileManager.IsSignedIn(i)) 654 { 655 ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); 656 } 657 } 658 659 } 660 return 0; 661} 662 663int CScene_Main::MustSignInReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) 664{ 665 CScene_Main* pClass = (CScene_Main*)pParam; 666 667 if(result==C4JStorage::EMessage_ResultAccept) 668 { 669 // we need to specify local game here to display local and LIVE profiles in the list 670 switch(pClass->m_eAction) 671 { 672 case eAction_RunGame: 673 ProfileManager.RequestSignInUI(false, true, false,false,true,&CScene_Main::CreateLoad_SignInReturned,pClass ,iPad); 674 break; 675 case eAction_RunLeaderboards: 676 ProfileManager.RequestSignInUI(false, false, true,false,true, &CScene_Main::Leaderboards_SignInReturned, pClass,iPad); 677 break; 678 case eAction_RunAchievements: 679 ProfileManager.RequestSignInUI(false, false, true,false,true,&CScene_Main::Achievements_SignInReturned,pClass,iPad ); 680 break; 681 case eAction_RunHelpAndOptions: 682 ProfileManager.RequestSignInUI(false, false, true,false,true,&CScene_Main::HelpAndOptions_SignInReturned,pClass,iPad ); 683 break; 684 case eAction_RunUnlockOrDLC: 685 ProfileManager.RequestSignInUI(false, false, true,false,true,&CScene_Main::UnlockFullGame_SignInReturned,pClass,iPad ); 686 break; 687 688 } 689 } 690 else 691 { 692 // unlock the profile 693 ProfileManager.SetLockedProfile(-1); 694 for(int i=0;i<XUSER_MAX_COUNT;i++) 695 { 696 // if the user is valid, we should set the presence 697 if(ProfileManager.IsSignedIn(i)) 698 { 699 ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); 700 } 701 } 702 } 703 704 return 0; 705} 706 707 708 709 710int CScene_Main::AchievementsDeviceSelectReturned(void *pParam,bool bContinue) 711{ 712 //CScene_Main* pClass = (CScene_Main*)pParam; 713 //HRESULT hr; 714 715 if(bContinue==true) 716 { 717 XShowAchievementsUI( ProfileManager.GetLockedProfile() ); 718 } 719 720 return 0; 721} 722 723 724int CScene_Main::Leaderboards_SignInReturned(void *pParam,bool bContinue,int iPad) 725{ 726 //CScene_Main* pClass = (CScene_Main*)pParam; 727 728 if(bContinue==true) 729 { 730 UINT uiIDA[1]; 731 uiIDA[0]=IDS_OK; 732 // guests can't look at leaderboards 733 if(ProfileManager.IsGuest(ProfileManager.GetPrimaryPad())) 734 { 735 StorageManager.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); 736 } 737 else if(!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) 738 { 739 StorageManager.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); 740 } 741 else 742 { 743 ProfileManager.SetLockedProfile(ProfileManager.GetPrimaryPad()); 744 app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_LeaderboardsMenu); 745 } 746 } 747 else 748 { 749 // unlock the profile 750 ProfileManager.SetLockedProfile(-1); 751 for(int i=0;i<XUSER_MAX_COUNT;i++) 752 { 753 // if the user is valid, we should set the presence 754 if(ProfileManager.IsSignedIn(i)) 755 { 756 ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); 757 } 758 } 759 760 } 761 return 0; 762} 763 764int CScene_Main::Achievements_SignInReturned(void *pParam,bool bContinue,int iPad) 765{ 766 //CScene_Main* pClass = (CScene_Main*)pParam; 767 768 if(bContinue==true) 769 { 770 XShowAchievementsUI( ProfileManager.GetPrimaryPad() ); 771 } 772 else 773 { 774 // unlock the profile 775 ProfileManager.SetLockedProfile(-1); 776 for(int i=0;i<XUSER_MAX_COUNT;i++) 777 { 778 // if the user is valid, we should set the presence 779 if(ProfileManager.IsSignedIn(i)) 780 { 781 ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); 782 } 783 } 784 785 } 786 return 0; 787} 788int CScene_Main::HelpAndOptions_SignInReturned(void *pParam,bool bContinue,int iPad) 789{ 790 CScene_Main* pClass = (CScene_Main*)pParam; 791 792 if(bContinue==true) 793 { 794 // 4J-PB - You can be offline and still can go into help and options 795 if(app.GetTMSDLCInfoRead() || !ProfileManager.IsSignedInLive(iPad)) 796 { 797 app.NavigateToScene(iPad,eUIScene_HelpAndOptionsMenu); 798 } 799 else 800 { 801 // Changing to async TMS calls 802 app.SetTMSAction(iPad,eTMSAction_TMSPP_RetrieveFiles_HelpAndOptions); 803 804 // block all input 805 pClass->m_bIgnorePress=true; 806 // We want to hide everything in this scene and display a timer until we get a completion for the TMS files 807 for(int i=0;i<BUTTONS_MAX;i++) 808 { 809 pClass->m_Buttons[i].SetShow(FALSE); 810 } 811 812 // turn off tooltips 813 ui.SetTooltips(DEFAULT_XUI_MENU_USER, -1); 814 815 pClass->m_Timer.SetShow(TRUE); 816 } 817 } 818 else 819 { 820 // unlock the profile 821 ProfileManager.SetLockedProfile(-1); 822 for(int i=0;i<XUSER_MAX_COUNT;i++) 823 { 824 // if the user is valid, we should set the presence 825 if(ProfileManager.IsSignedIn(i)) 826 { 827 ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); 828 } 829 } 830 } 831 832 return 0; 833} 834 835int CScene_Main::UnlockFullGame_SignInReturned(void *pParam,bool bContinue,int iPad) 836{ 837 CScene_Main* pClass = (CScene_Main*)pParam; 838 839 if(bContinue==true) 840 { 841 pClass->RunUnlockOrDLC(iPad); 842 } 843 else 844 { 845 // unlock the profile 846 ProfileManager.SetLockedProfile(-1); 847 for(int i=0;i<XUSER_MAX_COUNT;i++) 848 { 849 // if the user is valid, we should set the presence 850 if(ProfileManager.IsSignedIn(i)) 851 { 852 ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); 853 } 854 } 855 856 } 857 858 859 860 return 0; 861} 862int CScene_Main::SaveGameReturned(void *pParam,bool bContinue) 863{ 864 //CScene_Main* pClass = (CScene_Main*)pParam; 865 866 // display a saving complete message 867 ProfileManager.SetLockedProfile(-1); 868 return 0; 869} 870 871int CScene_Main::ExitGameReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) 872{ 873 //CScene_Main* pClass = (CScene_Main*)pParam; 874 875 // buttons reversed on this 876 if(result==C4JStorage::EMessage_ResultDecline) 877 { 878 //XLaunchNewImage(XLAUNCH_KEYWORD_DASH_ARCADE, 0); 879 app.ExitGame(); 880 } 881 882 return 0; 883} 884 885void CScene_Main::LoadTrial(void) 886{ 887 app.SetTutorialMode( true ); 888 889 // clear out the app's terrain features list 890 app.ClearTerrainFeaturePosition(); 891 892 StorageManager.ResetSaveData(); 893 894 // Need to set the mode as trial 895 ProfileManager.StartTrialGame(); 896 897 // No saving in the trial 898 StorageManager.SetSaveDisabled(true); 899 900 StorageManager.SetSaveTitle(L"Tutorial"); 901 902 // Reset the autosave time 903 app.SetAutosaveTimerTime(); 904 905 // not online for the trial game 906 g_NetworkManager.HostGame(0,false,true,MINECRAFT_NET_MAX_PLAYERS,0); 907 908 NetworkGameInitData *param = new NetworkGameInitData(); 909 param->seed = 0; 910 param->saveData = NULL; 911 param->settings = app.GetGameHostOption( eGameHostOption_Tutorial ); 912 913 vector<LevelGenerationOptions *> *generators = app.getLevelGenerators(); 914 param->levelGen = generators->at(0); 915 916 LoadingInputParams *loadingParams = new LoadingInputParams(); 917 loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; 918 loadingParams->lpParam = (LPVOID)param; 919 920 UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); 921 completionData->bShowBackground=TRUE; 922 completionData->bShowLogo=TRUE; 923 completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes; 924 completionData->iPad = ProfileManager.GetPrimaryPad(); 925 loadingParams->completionData = completionData; 926 927 CXuiSceneBase::ShowTrialTimer(TRUE); 928 929 app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams); 930} 931 932 933 934void CScene_Main::RunPlayGame(int iPad) 935{ 936 Minecraft *pMinecraft=Minecraft::GetInstance(); 937 938 app.ReleaseSaveThumbnail(); 939 940 if(ProfileManager.IsGuest(iPad)) 941 { 942 UINT uiIDA[1]; 943 uiIDA[0]=IDS_OK; 944 945 StorageManager.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); 946 } 947 else 948 { 949 ProfileManager.SetLockedProfile(iPad); 950 951 // If the player was signed in before selecting play, we'll not have read the profile yet, so query the sign-in status to get this to happen 952 ProfileManager.QuerySigninStatus(); 953 // 4J-PB - Need to check for installed DLC 954 if(!app.DLCInstallProcessCompleted()) app.StartInstallDLCProcess(iPad); 955 956 if(ProfileManager.IsFullVersion()) 957 { 958 // are we offline? 959 if(!ProfileManager.IsSignedInLive(iPad)) 960 { 961 962 ProfileManager.DisplayOfflineProfile(&CScene_Main::CreateLoad_OfflineProfileReturned,this,iPad ); 963 } 964 else 965 { 966 // Check if there is any new DLC 967 app.ClearNewDLCAvailable(); 968 StorageManager.GetAvailableDLCCount(iPad); 969 970 // check if all the TMS files are loaded 971 if(app.GetTMSDLCInfoRead() && app.GetTMSXUIDsFileRead() && app.GetBanListRead(iPad)) 972 { 973 if(StorageManager.SetSaveDevice(&CScene_Main::DeviceSelectReturned,this)==true) 974 { 975 // change the minecraft player name 976 pMinecraft->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); 977 // save device already selected 978 979 // ensure we've applied this player's settings 980 app.ApplyGameSettingsChanged(iPad); 981 // check for DLC 982 // start timer to track DLC check finished 983 m_Timer.SetShow(TRUE); 984 XuiSetTimer(m_hObj,DLC_INSTALLED_TIMER_ID,DLC_INSTALLED_TIMER_TIME); 985 //app.NavigateToScene(iPad,eUIScene_MultiGameJoinLoad); 986 } 987 } 988 else 989 { 990 // Changing to async TMS calls 991 992 // flag the timer to start the TMS calls when there is nothing happening with TMS. 993 // fix for X360 - 162325 - TCR 001: BAS Game Stability: TU17: The game goes into an infinite loading upon entering the Play Game menu shortly after visiting the Minecraft Store 994 if(app.GetTMSAction(iPad)!=eTMSAction_Idle) 995 { 996 XuiSetTimer(m_hObj,TMS_TIMER_ID,TMS_TIMER_TIME); 997 } 998 else 999 { 1000 app.SetTMSAction(iPad,eTMSAction_TMSPP_RetrieveFiles_RunPlayGame); 1001 } 1002 1003 // block all input 1004 m_bIgnorePress=true; 1005 // We want to hide everything in this scene and display a timer until we get a completion for the TMS files 1006 for(int i=0;i<BUTTONS_MAX;i++) 1007 { 1008 m_Buttons[i].SetShow(FALSE); 1009 } 1010 1011 // turn off tooltips 1012 ui.SetTooltips(DEFAULT_XUI_MENU_USER, -1); 1013 1014 m_Timer.SetShow(TRUE); 1015 } 1016 } 1017 } 1018 else 1019 { 1020 // 4J-PB - if this is the trial game, we can't have any networking 1021 // go straight in to the trial level 1022 // change the minecraft player name 1023 Minecraft::GetInstance()->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); 1024 1025 // Can't apply the player's settings here - they haven't come back from the QuerySignInStatud call above yet. 1026 // Need to let them action in the main loop when they come in 1027 // ensure we've applied this player's settings 1028 //app.ApplyGameSettingsChanged(iPad); 1029 LoadTrial(); 1030 } 1031 } 1032} 1033 1034HRESULT CScene_Main::OnTMSBanFileRetrieved() 1035{ 1036 Minecraft *pMinecraft=Minecraft::GetInstance(); 1037 int iPad=ProfileManager.GetLockedProfile(); 1038 1039 if(StorageManager.SetSaveDevice(&CScene_Main::DeviceSelectReturned,this)==true) 1040 { 1041 // change the minecraft player name 1042 pMinecraft->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); 1043 // save device already selected 1044 1045 // ensure we've applied this player's settings 1046 app.ApplyGameSettingsChanged(iPad); 1047 // check for DLC 1048 // start timer to track DLC check finished 1049 m_Timer.SetShow(TRUE); 1050 XuiSetTimer(m_hObj,DLC_INSTALLED_TIMER_ID,DLC_INSTALLED_TIMER_TIME); 1051 //app.NavigateToScene(iPad,eUIScene_MultiGameJoinLoad); 1052 } 1053 return S_OK; 1054} 1055 1056void CScene_Main::RunLeaderboards(int iPad) 1057{ 1058 UINT uiIDA[1]; 1059 uiIDA[0]=IDS_OK; 1060 1061 // guests can't look at leaderboards 1062 if(ProfileManager.IsGuest(iPad)) 1063 { 1064 StorageManager.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); 1065 } 1066 else if(!ProfileManager.IsSignedInLive(iPad)) 1067 { 1068 StorageManager.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); 1069 } 1070 else 1071 { 1072 ProfileManager.SetLockedProfile(iPad); 1073 // If the player was signed in before selecting play, we'll not have read the profile yet, so query the sign-in status to get this to happen 1074 ProfileManager.QuerySigninStatus(); 1075 1076 app.NavigateToScene(iPad, eUIScene_LeaderboardsMenu); 1077 } 1078} 1079void CScene_Main::RunAchievements(int iPad) 1080{ 1081 UINT uiIDA[1]; 1082 uiIDA[0]=IDS_OK; 1083 1084 // guests can't look at achievements 1085 if(ProfileManager.IsGuest(iPad)) 1086 { 1087 StorageManager.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); 1088 } 1089 else 1090 { 1091 XShowAchievementsUI( iPad ); 1092 } 1093} 1094void CScene_Main::RunHelpAndOptions(int iPad) 1095{ 1096 if(ProfileManager.IsGuest(iPad)) 1097 { 1098 UINT uiIDA[1]; 1099 uiIDA[0]=IDS_OK; 1100 StorageManager.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); 1101 } 1102 else 1103 { 1104 // If the player was signed in before selecting play, we'll not have read the profile yet, so query the sign-in status to get this to happen 1105 ProfileManager.QuerySigninStatus(); 1106 1107 // 4J-PB - You can be offline and still can go into help and options 1108 if(app.GetTMSDLCInfoRead() || !ProfileManager.IsSignedInLive(iPad)) 1109 { 1110 app.NavigateToScene(iPad,eUIScene_HelpAndOptionsMenu); 1111 } 1112 else 1113 { 1114 // Changing to async TMS calls 1115 app.SetTMSAction(iPad,eTMSAction_TMSPP_RetrieveFiles_HelpAndOptions); 1116 1117 // block all input 1118 m_bIgnorePress=true; 1119 // We want to hide everything in this scene and display a timer until we get a completion for the TMS files 1120 for(int i=0;i<BUTTONS_MAX;i++) 1121 { 1122 m_Buttons[i].SetShow(FALSE); 1123 } 1124 1125 // turn off tooltips 1126 ui.SetTooltips(DEFAULT_XUI_MENU_USER, -1); 1127 1128 m_Timer.SetShow(TRUE); 1129 } 1130 } 1131} 1132 1133HRESULT CScene_Main::OnTMSDLCFileRetrieved( ) 1134{ 1135 m_Timer.SetShow(FALSE); 1136 switch(m_eAction) 1137 { 1138 case eAction_RunHelpAndOptions: 1139 app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_HelpAndOptionsMenu); 1140 break; 1141 case eAction_RunUnlockOrDLC: 1142 app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DLCMainMenu); 1143 break; 1144 } 1145 //app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DLCMainMenu); 1146 1147 return S_OK; 1148} 1149 1150void CScene_Main::RunUnlockOrDLC(int iPad) 1151{ 1152 UINT uiIDA[1]; 1153 uiIDA[0]=IDS_OK; 1154 1155 // Check if this means downloadable content 1156 if(ProfileManager.IsFullVersion()) 1157 { 1158 // downloadable content 1159 if(ProfileManager.IsSignedInLive(iPad)) 1160 { 1161 if(ProfileManager.IsGuest(iPad)) 1162 { 1163 StorageManager.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); 1164 } 1165 else 1166 { 1167 // If the player was signed in before selecting play, we'll not have read the profile yet, so query the sign-in status to get this to happen 1168 ProfileManager.QuerySigninStatus(); 1169 1170 if(app.GetTMSDLCInfoRead()) 1171 { 1172 app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DLCMainMenu); 1173 } 1174 else 1175 { 1176 // Changing to async TMS calls 1177 app.SetTMSAction(iPad,eTMSAction_TMSPP_RetrieveFiles_DLCMain); 1178 1179 // block all input 1180 m_bIgnorePress=true; 1181 // We want to hide everything in this scene and display a timer until we get a completion for the TMS files 1182 for(int i=0;i<BUTTONS_MAX;i++) 1183 { 1184 m_Buttons[i].SetShow(FALSE); 1185 } 1186 1187 // turn off tooltips 1188 ui.SetTooltips(DEFAULT_XUI_MENU_USER, -1); 1189 1190 m_Timer.SetShow(TRUE); 1191 } 1192 1193 // read the DLC info from TMS 1194 /*app.ReadDLCFileFromTMS(iPad);*/ 1195 1196 // We want to navigate to the DLC scene, but block input until we get the DLC file in from TMS 1197 // Don't navigate - we might have an uplink disconnect 1198 //app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DLCMainMenu); 1199 1200 } 1201 } 1202 else 1203 { 1204 StorageManager.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); 1205 } 1206 } 1207 else 1208 { 1209 // guests can't buy the game 1210 if(ProfileManager.IsGuest(iPad)) 1211 { 1212 StorageManager.RequestMessageBox(IDS_UNLOCK_TITLE, IDS_UNLOCK_GUEST_TEXT, uiIDA, 1,iPad); 1213 } 1214 else if(!ProfileManager.IsSignedInLive(iPad)) 1215 { 1216 StorageManager.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); 1217 } 1218 else 1219 { 1220 // If the player was signed in before selecting play, we'll not have read the profile yet, so query the sign-in status to get this to happen 1221 ProfileManager.QuerySigninStatus(); 1222 1223 TelemetryManager->RecordUpsellPresented(iPad, eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID); 1224 ProfileManager.DisplayFullVersionPurchase(false,iPad,eSen_UpsellID_Full_Version_Of_Game); 1225 } 1226 } 1227} 1228 1229int CScene_Main::TMSReadFileListReturned(void *pParam,int iPad,C4JStorage::PTMSPP_FILE_LIST pTmsFileList) 1230{ 1231 CScene_Main* pClass = (CScene_Main*)pParam; 1232 1233 // push the file details in to a unordered map if they are not already in there 1234// for(int i=0;i<pTmsFileList->iCount;i++) 1235// { 1236// app.PutTMSPP_FileSize(filenametowstring(pTmsFileList->FileDetailsA[i].szFilename),pTmsFileList->FileDetailsA[i].iFileSize); 1237// } 1238 return 0; 1239} 1240 1241int CScene_Main::TMSFileWriteReturned(void *pParam,int iPad,int iResult) 1242{ 1243 CScene_Main* pClass = (CScene_Main*)pParam; 1244 1245 // push the file details in to a unordered map if they are not already in there 1246 // for(int i=0;i<pTmsFileList->iCount;i++) 1247 // { 1248 // app.PutTMSPP_FileSize(filenametowstring(pTmsFileList->FileDetailsA[i].szFilename),pTmsFileList->FileDetailsA[i].iFileSize); 1249 // } 1250 return 0; 1251} 1252 1253int CScene_Main::TMSFileReadReturned(void *pParam,int iPad,C4JStorage::PTMSPP_FILEDATA pData) 1254{ 1255 CScene_Main* pClass = (CScene_Main*)pParam; 1256 1257 // push the file details in to a unordered map if they are not already in there 1258 // for(int i=0;i<pTmsFileList->iCount;i++) 1259 // { 1260 // app.PutTMSPP_FileSize(filenametowstring(pTmsFileList->FileDetailsA[i].szFilename),pTmsFileList->FileDetailsA[i].iFileSize); 1261 // } 1262 return 0; 1263} 1264 1265HRESULT CScene_Main::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled ) 1266{ 1267 // 4J-PB - TODO - Don't think we can do this - if a 2nd player signs in here with an offline profile, the signed in LIVE player gets re-logged in, and bMultiplayerAllowed is false briefly 1268 if( pTimer->nId == DLC_INSTALLED_TIMER_ID) 1269 { 1270 if(!app.DLCInstallPending()) 1271 { 1272 XuiKillTimer(m_hObj,DLC_INSTALLED_TIMER_ID); 1273 m_Timer.SetShow(FALSE); 1274 app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_LoadOrJoinMenu); 1275 } 1276 } 1277 1278 else if( pTimer->nId == TMS_TIMER_ID) 1279 { 1280 if(app.GetTMSAction(ProfileManager.GetPrimaryPad())==eTMSAction_Idle) 1281 { 1282 app.SetTMSAction(ProfileManager.GetPrimaryPad(),eTMSAction_TMSPP_RetrieveFiles_RunPlayGame); 1283 XuiKillTimer(m_hObj,TMS_TIMER_ID); 1284 } 1285 } 1286 1287 return S_OK; 1288}