the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 2154 lines 64 kB view raw
1#include "stdafx.h" 2#include "..\..\..\Minecraft.World\Mth.h" 3#include "..\..\..\Minecraft.World\StringHelpers.h" 4#include "..\..\..\Minecraft.World\Random.h" 5#include "..\..\User.h" 6#include "..\..\MinecraftServer.h" 7#include "UI.h" 8#include "UIScene_MainMenu.h" 9#ifdef __ORBIS__ 10#include <error_dialog.h> 11#endif 12 13Random *UIScene_MainMenu::random = new Random(); 14 15EUIScene UIScene_MainMenu::eNavigateWhenReady = (EUIScene) -1; 16 17UIScene_MainMenu::UIScene_MainMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) 18{ 19#ifdef __ORBIS 20 //m_ePatchCheckState=ePatchCheck_Idle; 21 m_bRunGameChosen=false; 22 m_bErrorDialogRunning=false; 23#endif 24 25 26 // Setup all the Iggy references we need for this scene 27 initialiseMovie(); 28 29 parentLayer->addComponent(iPad,eUIComponent_Panorama); 30 parentLayer->addComponent(iPad,eUIComponent_Logo); 31 32 m_eAction=eAction_None; 33 m_bIgnorePress=false; 34 35 36 m_buttons[(int)eControl_PlayGame].init(IDS_PLAY_GAME,eControl_PlayGame); 37 38#ifdef _XBOX_ONE 39 if(!ProfileManager.IsFullVersion()) m_buttons[(int)eControl_PlayGame].setLabel(IDS_PLAY_TRIAL_GAME); 40 app.SetReachedMainMenu(); 41#endif 42 43 m_buttons[(int)eControl_Leaderboards].init(IDS_LEADERBOARDS,eControl_Leaderboards); 44 m_buttons[(int)eControl_Achievements].init( (UIString)IDS_ACHIEVEMENTS,eControl_Achievements); 45 m_buttons[(int)eControl_HelpAndOptions].init(IDS_HELP_AND_OPTIONS,eControl_HelpAndOptions); 46 if(ProfileManager.IsFullVersion()) 47 { 48 m_bTrialVersion=false; 49 m_buttons[(int)eControl_UnlockOrDLC].init(IDS_DOWNLOADABLECONTENT,eControl_UnlockOrDLC); 50 } 51 else 52 { 53 m_bTrialVersion=true; 54 m_buttons[(int)eControl_UnlockOrDLC].init(IDS_UNLOCK_FULL_GAME,eControl_UnlockOrDLC); 55 } 56 57#ifndef _DURANGO 58 m_buttons[(int)eControl_Exit].init(app.GetString(IDS_EXIT_GAME),eControl_Exit); 59#else 60 m_buttons[(int)eControl_XboxHelp].init(IDS_XBOX_HELP_APP, eControl_XboxHelp); 61#endif 62 63#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) 64 // Not allowed to exit from a PS3 game from the game - have to use the PS button 65 removeControl( &m_buttons[(int)eControl_Exit], false ); 66 // We don't have a way to display trophies/achievements, so remove the button 67 removeControl( &m_buttons[(int)eControl_Achievements], false ); 68 m_bLaunchFullVersionPurchase=false; 69#endif 70#ifdef _DURANGO 71 // Allowed to not have achievements in the menu 72 removeControl( &m_buttons[(int)eControl_Achievements], false ); 73 // Not allowed to exit from a Xbox One game from the game - have to use the Home button 74 //removeControl( &m_buttons[(int)eControl_Exit], false ); 75 m_bWaitingForDLCInfo=false; 76#endif 77 78 doHorizontalResizeCheck(); 79 80 m_splash = L""; 81 82 wstring filename = L"splashes.txt"; 83 if( app.hasArchiveFile(filename) ) 84 { 85 byteArray splashesArray = app.getArchiveFile(filename); 86 ByteArrayInputStream bais(splashesArray); 87 InputStreamReader isr( &bais ); 88 BufferedReader br( &isr ); 89 90 wstring line = L""; 91 while ( !(line = br.readLine()).empty() ) 92 { 93 line = trimString( line ); 94 if (line.length() > 0) 95 { 96 m_splashes.push_back(line); 97 } 98 } 99 100 br.close(); 101 } 102 103 m_bIgnorePress=false; 104 m_bLoadTrialOnNetworkManagerReady = false; 105 106 // 4J Stu - Clear out any loaded game rules 107 app.setLevelGenerationOptions(NULL); 108 109 // 4J Stu - Reset the leaving game flag so that we correctly handle signouts while in the menus 110 g_NetworkManager.ResetLeavingGame(); 111 112#if TO_BE_IMPLEMENTED 113 // Fix for #45154 - Frontend: DLC: Content can only be downloaded from the frontend if you have not joined/exited multiplayer 114 XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); 115#endif 116} 117 118UIScene_MainMenu::~UIScene_MainMenu() 119{ 120 m_parentLayer->removeComponent(eUIComponent_Panorama); 121 m_parentLayer->removeComponent(eUIComponent_Logo); 122} 123 124void UIScene_MainMenu::updateTooltips() 125{ 126 int iX = -1; 127 int iA = -1; 128 if(!m_bIgnorePress) 129 { 130 iA = IDS_TOOLTIPS_SELECT; 131 132#ifdef _XBOX_ONE 133 iX = IDS_TOOLTIPS_CHOOSE_USER; 134#elif defined __PSVITA__ 135 if(ProfileManager.IsFullVersion()) 136 { 137 iX = IDS_TOOLTIP_CHANGE_NETWORK_MODE; 138 } 139#endif 140 } 141 ui.SetTooltips( DEFAULT_XUI_MENU_USER, iA, -1, iX); 142} 143 144void UIScene_MainMenu::updateComponents() 145{ 146 m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); 147 m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true); 148} 149 150void UIScene_MainMenu::handleGainFocus(bool navBack) 151{ 152 UIScene::handleGainFocus(navBack); 153 ui.ShowPlayerDisplayname(false); 154 m_bIgnorePress=false; 155 156 if (eNavigateWhenReady >= 0) 157 { 158 return; 159 } 160 161 // 4J-JEV: This needs to come before SetLockedProfile(-1) as it wipes the XbLive contexts. 162 if (!navBack) 163 { 164 for (int iPad = 0; iPad < MAX_LOCAL_PLAYERS; iPad++) 165 { 166 // For returning to menus after exiting a game. 167 if (ProfileManager.IsSignedIn(iPad) ) 168 { 169 ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); 170 } 171 } 172 } 173 ProfileManager.SetLockedProfile(-1); 174 175 m_bIgnorePress = false; 176 updateTooltips(); 177 178#ifdef _DURANGO 179 ProfileManager.ClearGameUsers(); 180#endif 181 182 if(navBack && ProfileManager.IsFullVersion()) 183 { 184 // Replace the Unlock Full Game with Downloadable Content 185 m_buttons[(int)eControl_UnlockOrDLC].setLabel(IDS_DOWNLOADABLECONTENT); 186 } 187 188#if TO_BE_IMPLEMENTED 189 // Fix for #45154 - Frontend: DLC: Content can only be downloaded from the frontend if you have not joined/exited multiplayer 190 XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); 191 m_Timer.SetShow(FALSE); 192#endif 193 m_controlTimer.setVisible( false ); 194 195 // 4J-PB - remove the "hobo humping" message legal say we can't have, and the 1080p one for Vita 196#ifdef __PSVITA__ 197 int splashIndex = eSplashRandomStart + 2 + random->nextInt( (int)m_splashes.size() - (eSplashRandomStart + 2) ); 198#else 199 int splashIndex = eSplashRandomStart + 1 + random->nextInt( (int)m_splashes.size() - (eSplashRandomStart + 1) ); 200#endif 201 202 // Override splash text on certain dates 203 SYSTEMTIME LocalSysTime; 204 GetLocalTime( &LocalSysTime ); 205 if (LocalSysTime.wMonth == 11 && LocalSysTime.wDay == 9) 206 { 207 splashIndex = eSplashHappyBirthdayEx; 208 } 209 else if (LocalSysTime.wMonth == 6 && LocalSysTime.wDay == 1) 210 { 211 splashIndex = eSplashHappyBirthdayNotch; 212 } 213 else if (LocalSysTime.wMonth == 12 && LocalSysTime.wDay == 24) // the Java game shows this on Christmas Eve, so we will too 214 { 215 splashIndex = eSplashMerryXmas; 216 } 217 else if (LocalSysTime.wMonth == 1 && LocalSysTime.wDay == 1) 218 { 219 splashIndex = eSplashHappyNewYear; 220 } 221 //splashIndex = 47; // Very short string 222 //splashIndex = 194; // Very long string 223 //splashIndex = 295; // Coloured 224 //splashIndex = 296; // Noise 225 m_splash = m_splashes.at( splashIndex ); 226} 227 228wstring UIScene_MainMenu::getMoviePath() 229{ 230 return L"MainMenu"; 231} 232 233void UIScene_MainMenu::handleReload() 234{ 235#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) 236 // Not allowed to exit from a PS3 game from the game - have to use the PS button 237 removeControl( &m_buttons[(int)eControl_Exit], false ); 238 // We don't have a way to display trophies/achievements, so remove the button 239 removeControl( &m_buttons[(int)eControl_Achievements], false ); 240#endif 241#ifdef _DURANGO 242 // Allowed to not have achievements in the menu 243 removeControl( &m_buttons[(int)eControl_Achievements], false ); 244#endif 245} 246 247void UIScene_MainMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) 248{ 249 //app.DebugPrintf("UIScene_DebugOverlay handling input for pad %d, key %d, down- %s, pressed- %s, released- %s\n", iPad, key, down?"TRUE":"FALSE", pressed?"TRUE":"FALSE", released?"TRUE":"FALSE"); 250 251 if ( m_bIgnorePress || (eNavigateWhenReady >= 0) ) return; 252 253#if defined (__ORBIS__) || defined (__PSVITA__) 254 // ignore all players except player 0 - it's their profile that is currently being used 255 if(iPad!=0) return; 256#endif 257 258 ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released); 259 260 switch(key) 261 { 262 case ACTION_MENU_OK: 263#ifdef __ORBIS__ 264 case ACTION_MENU_TOUCHPAD_PRESS: 265#endif 266 if(pressed) 267 { 268 ProfileManager.SetPrimaryPad(iPad); 269 ProfileManager.SetLockedProfile(-1); 270 sendInputToMovie(key, repeat, pressed, released); 271 } 272 break; 273#ifdef _XBOX_ONE 274 case ACTION_MENU_X: 275 if(pressed) 276 { 277 m_bIgnorePress = true; 278 ProfileManager.RequestSignInUI(false, false, false, false, false, ChooseUser_SignInReturned, this, iPad); 279 } 280 break; 281#endif 282#ifdef __PSVITA__ 283 case ACTION_MENU_X: 284 if(pressed && ProfileManager.IsFullVersion()) 285 { 286 UINT uiIDA[2]; 287 uiIDA[0]=IDS__NETWORK_PSN; 288 uiIDA[1]=IDS_NETWORK_ADHOC; 289 ui.RequestErrorMessage(IDS_SELECT_NETWORK_MODE_TITLE, IDS_SELECT_NETWORK_MODE_TEXT, uiIDA, 2, XUSER_INDEX_ANY, &UIScene_MainMenu::SelectNetworkModeReturned,this); 290 } 291 break; 292#endif 293 294 case ACTION_MENU_UP: 295 case ACTION_MENU_DOWN: 296 sendInputToMovie(key, repeat, pressed, released); 297 break; 298 } 299} 300 301void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) 302{ 303 int primaryPad = ProfileManager.GetPrimaryPad(); 304 305#ifdef _XBOX_ONE 306 int (*signInReturnedFunc) (LPVOID,const bool, const int iPad, const int iController) = NULL; 307#else 308 int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = NULL; 309#endif 310 311 switch((int)controlId) 312 { 313 case eControl_PlayGame: 314#ifdef __ORBIS__ 315 { 316 m_bIgnorePress=true; 317 318 //CD - Added for audio 319 ui.PlayUISFX(eSFX_Press); 320 321 ProfileManager.RefreshChatAndContentRestrictions(RefreshChatAndContentRestrictionsReturned_PlayGame, this); 322 } 323#else 324 m_eAction=eAction_RunGame; 325 //CD - Added for audio 326 ui.PlayUISFX(eSFX_Press); 327 328 signInReturnedFunc = &UIScene_MainMenu::CreateLoad_SignInReturned; 329#endif 330 break; 331 case eControl_Leaderboards: 332 //CD - Added for audio 333 ui.PlayUISFX(eSFX_Press); 334#ifdef __ORBIS__ 335 ProfileManager.RefreshChatAndContentRestrictions(RefreshChatAndContentRestrictionsReturned_Leaderboards, this); 336#else 337 m_eAction=eAction_RunLeaderboards; 338 signInReturnedFunc = &UIScene_MainMenu::Leaderboards_SignInReturned; 339#endif 340 break; 341 case eControl_Achievements: 342 //CD - Added for audio 343 ui.PlayUISFX(eSFX_Press); 344 345 m_eAction=eAction_RunAchievements; 346 signInReturnedFunc = &UIScene_MainMenu::Achievements_SignInReturned; 347 break; 348 case eControl_HelpAndOptions: 349 //CD - Added for audio 350 ui.PlayUISFX(eSFX_Press); 351 352 m_eAction=eAction_RunHelpAndOptions; 353 signInReturnedFunc = &UIScene_MainMenu::HelpAndOptions_SignInReturned; 354 break; 355 case eControl_UnlockOrDLC: 356 //CD - Added for audio 357 ui.PlayUISFX(eSFX_Press); 358 359 m_eAction=eAction_RunUnlockOrDLC; 360 signInReturnedFunc = &UIScene_MainMenu::UnlockFullGame_SignInReturned; 361 break; 362 case eControl_Exit: 363 //CD - Added for audio 364 ui.PlayUISFX(eSFX_Press); 365 366 if( ProfileManager.IsFullVersion() ) 367 { 368 UINT uiIDA[2]; 369 uiIDA[0]=IDS_CANCEL; 370 uiIDA[1]=IDS_OK; 371 ui.RequestErrorMessage(IDS_WARNING_ARCADE_TITLE, IDS_WARNING_ARCADE_TEXT, uiIDA, 2, XUSER_INDEX_ANY,&UIScene_MainMenu::ExitGameReturned,this); 372 } 373 else 374 { 375#ifdef _XBOX 376#ifdef _XBOX_ONE 377 ui.ShowPlayerDisplayname(true); 378#endif 379 ui.NavigateToScene(primaryPad,eUIScene_TrialExitUpsell); 380#endif 381 } 382 break; 383 384#ifdef _DURANGO 385 case eControl_XboxHelp: 386 ui.PlayUISFX(eSFX_Press); 387 388 m_eAction=eAction_RunXboxHelp; 389 signInReturnedFunc = &UIScene_MainMenu::XboxHelp_SignInReturned; 390 break; 391#endif 392 393 default: __debugbreak(); 394 } 395 396 bool confirmUser = false; 397 398 // Note: if no sign in returned func, assume this isn't required 399 if (signInReturnedFunc != NULL) 400 { 401 if(ProfileManager.IsSignedIn(primaryPad)) 402 { 403 if (confirmUser) 404 { 405 ProfileManager.RequestSignInUI(false, false, true, false, true, signInReturnedFunc, this, primaryPad); 406 } 407 else 408 { 409 RunAction(primaryPad); 410 } 411 } 412 else 413 { 414 // Ask user to sign in 415 UINT uiIDA[2]; 416 uiIDA[0]=IDS_CONFIRM_OK; 417 uiIDA[1]=IDS_CONFIRM_CANCEL; 418 ui.RequestErrorMessage(IDS_MUST_SIGN_IN_TITLE, IDS_MUST_SIGN_IN_TEXT, uiIDA, 2, primaryPad, &UIScene_MainMenu::MustSignInReturned, this); 419 } 420 } 421} 422 423// Run current action 424void UIScene_MainMenu::RunAction(int iPad) 425{ 426 switch(m_eAction) 427 { 428 case eAction_RunGame: 429 RunPlayGame(iPad); 430 break; 431 case eAction_RunLeaderboards: 432 RunLeaderboards(iPad); 433 break; 434 case eAction_RunAchievements: 435 RunAchievements(iPad); 436 break; 437 case eAction_RunHelpAndOptions: 438 RunHelpAndOptions(iPad); 439 break; 440 case eAction_RunUnlockOrDLC: 441 RunUnlockOrDLC(iPad); 442 break; 443#ifdef _DURANGO 444 case eAction_RunXboxHelp: 445 // 4J: Launch the dummy xbox help application. 446 WXS::User^ user = ProfileManager.GetUser(ProfileManager.GetPrimaryPad()); 447 Windows::Xbox::ApplicationModel::Help::Show(user); 448 break; 449#endif 450 } 451} 452 453void UIScene_MainMenu::customDraw(IggyCustomDrawCallbackRegion *region) 454{ 455 if(wcscmp((wchar_t *)region->name,L"Splash")==0) 456 { 457 PIXBeginNamedEvent(0,"Custom draw splash"); 458 customDrawSplash(region); 459 PIXEndNamedEvent(); 460 } 461} 462 463void UIScene_MainMenu::customDrawSplash(IggyCustomDrawCallbackRegion *region) 464{ 465 Minecraft *pMinecraft = Minecraft::GetInstance(); 466 467 // 4J Stu - Move this to the ctor when the main menu is not the first scene we navigate to 468 ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys); 469 m_fScreenWidth=(float)pMinecraft->width_phys; 470 m_fRawWidth=(float)ssc.rawWidth; 471 m_fScreenHeight=(float)pMinecraft->height_phys; 472 m_fRawHeight=(float)ssc.rawHeight; 473 474 475 // Setup GDraw, normal game render states and matrices 476 CustomDrawData *customDrawRegion = ui.setupCustomDraw(this,region); 477 delete customDrawRegion; 478 479 480 Font *font = pMinecraft->font; 481 482 // build and render with the game call 483 glDisable(GL_CULL_FACE); 484 glDisable(GL_DEPTH_TEST); 485 486 glPushMatrix(); 487 488 float width = region->x1 - region->x0; 489 float height = region->y1 - region->y0; 490 float xo = width/2; 491 float yo = height; 492 493 glTranslatef(xo, yo, 0); 494 495 glRotatef(-17, 0, 0, 1); 496 float sss = 1.8f - Mth::abs(Mth::sin(System::currentTimeMillis() % 1000 / 1000.0f * PI * 2) * 0.1f); 497 sss*=(m_fScreenWidth/m_fRawWidth); 498 499 sss = sss * 100 / (font->width(m_splash) + 8 * 4); 500 glScalef(sss, sss, sss); 501 //drawCenteredString(font, splash, 0, -8, 0xffff00); 502 font->drawShadow(m_splash, 0 - (font->width(m_splash)) / 2, -8, 0xffff00); 503 glPopMatrix(); 504 505 glDisable(GL_RESCALE_NORMAL); 506 507 glEnable(GL_DEPTH_TEST); 508 509 510 // Finish GDraw and anything else that needs to be finalised 511 ui.endCustomDraw(region); 512} 513 514int UIScene_MainMenu::MustSignInReturned(void *pParam, int iPad, C4JStorage::EMessageResult result) 515{ 516 UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; 517 518 if(result==C4JStorage::EMessage_ResultAccept) 519 { 520 // we need to specify local game here to display local and LIVE profiles in the list 521 switch(pClass->m_eAction) 522 { 523 case eAction_RunGame: ProfileManager.RequestSignInUI(false, true, false, false, true, &UIScene_MainMenu::CreateLoad_SignInReturned, pClass, iPad ); break; 524 case eAction_RunHelpAndOptions: ProfileManager.RequestSignInUI(false, false, true, false, true, &UIScene_MainMenu::HelpAndOptions_SignInReturned, pClass, iPad ); break; 525 case eAction_RunLeaderboards: ProfileManager.RequestSignInUI(false, false, true, false, true, &UIScene_MainMenu::Leaderboards_SignInReturned, pClass, iPad ); break; 526 case eAction_RunAchievements: ProfileManager.RequestSignInUI(false, false, true, false, true, &UIScene_MainMenu::Achievements_SignInReturned, pClass, iPad ); break; 527 case eAction_RunUnlockOrDLC: ProfileManager.RequestSignInUI(false, false, true, false, true, &UIScene_MainMenu::UnlockFullGame_SignInReturned, pClass, iPad ); break; 528#ifdef _DURANGO 529 case eAction_RunXboxHelp: ProfileManager.RequestSignInUI(false, false, true, false, true, &UIScene_MainMenu::XboxHelp_SignInReturned, pClass, iPad ); break; 530#endif 531 } 532 } 533 else 534 { 535 pClass->m_bIgnorePress=false; 536 // unlock the profile 537 ProfileManager.SetLockedProfile(-1); 538 for(int i=0;i<XUSER_MAX_COUNT;i++) 539 { 540 // if the user is valid, we should set the presence 541 if(ProfileManager.IsSignedIn(i)) 542 { 543 ProfileManager.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, false); 544 } 545 } 546 } 547 548 return 0; 549} 550 551#if defined(__PS3__) || defined(__PSVITA__) || defined(__ORBIS__) 552int UIScene_MainMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result) 553{ 554 UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; 555 556 if(result==C4JStorage::EMessage_ResultAccept) 557 { 558#ifdef __PS3__ 559 // we need to specify local game here to display local and LIVE profiles in the list 560 switch(pClass->m_eAction) 561 { 562 case eAction_RunLeaderboardsPSN: 563 SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_MainMenu::Leaderboards_SignInReturned, pClass); 564 break; 565 case eAction_RunGamePSN: 566 SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_MainMenu::CreateLoad_SignInReturned, pClass); 567 break; 568 case eAction_RunUnlockOrDLCPSN: 569 SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_MainMenu::UnlockFullGame_SignInReturned, pClass); 570 break; 571 } 572#elif defined __PSVITA__ 573 switch(pClass->m_eAction) 574 { 575 case eAction_RunLeaderboardsPSN: 576 //CD - Must force Ad-Hoc off if they want leaderboard PSN sign-in 577 //Save settings change 578 app.SetGameSettings(0, eGameSetting_PSVita_NetworkModeAdhoc, 0); 579 //Force off 580 CGameNetworkManager::setAdhocMode(false); 581 //Now Sign-in 582 SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_MainMenu::Leaderboards_SignInReturned, pClass); 583 break; 584 case eAction_RunGamePSN: 585 if(CGameNetworkManager::usingAdhocMode()) 586 { 587 SQRNetworkManager_AdHoc_Vita::AttemptAdhocSignIn(&UIScene_MainMenu::CreateLoad_SignInReturned, pClass); 588 } 589 else 590 { 591 SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_MainMenu::CreateLoad_SignInReturned, pClass); 592 593 } 594 break; 595 case eAction_RunUnlockOrDLCPSN: 596 //CD - Must force Ad-Hoc off if they want commerce PSN sign-in 597 //Save settings change 598 app.SetGameSettings(0, eGameSetting_PSVita_NetworkModeAdhoc, 0); 599 //Force off 600 CGameNetworkManager::setAdhocMode(false); 601 //Now Sign-in 602 SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_MainMenu::UnlockFullGame_SignInReturned, pClass); 603 break; 604 } 605#else 606 switch(pClass->m_eAction) 607 { 608 case eAction_RunLeaderboardsPSN: 609 SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_MainMenu::Leaderboards_SignInReturned, pClass, true, iPad); 610 break; 611 case eAction_RunGamePSN: 612 SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_MainMenu::CreateLoad_SignInReturned, pClass, true, iPad); 613 break; 614 case eAction_RunUnlockOrDLCPSN: 615 SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_MainMenu::UnlockFullGame_SignInReturned, pClass, true, iPad); 616 break; 617 } 618 619#endif 620 } 621 else 622 { 623 if( pClass->m_eAction == eAction_RunGamePSN ) 624 { 625 if( result == C4JStorage::EMessage_Cancelled) 626 CreateLoad_SignInReturned(pClass, false, 0); 627 else 628 CreateLoad_SignInReturned(pClass, true, 0); 629 } 630 else 631 { 632 pClass->m_bIgnorePress=false; 633 } 634 } 635 636 return 0; 637} 638#endif 639 640#ifdef _XBOX_ONE 641int UIScene_MainMenu::HelpAndOptions_SignInReturned(void *pParam,bool bContinue,int iPad, int iController) 642#else 643int UIScene_MainMenu::HelpAndOptions_SignInReturned(void *pParam,bool bContinue,int iPad) 644#endif 645{ 646 UIScene_MainMenu *pClass = (UIScene_MainMenu *)pParam; 647 648 if(bContinue) 649 { 650 // 4J-JEV: Don't we only need to update rich-presence if the sign-in status changes. 651 ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); 652 653#if TO_BE_IMPLEMENTED 654 if(app.GetTMSDLCInfoRead()) 655#endif 656 { 657 ProfileManager.SetLockedProfile(ProfileManager.GetPrimaryPad()); 658#ifdef _XBOX_ONE 659 ui.ShowPlayerDisplayname(true); 660#endif 661 proceedToScene(iPad, eUIScene_HelpAndOptionsMenu); 662 } 663#if TO_BE_IMPLEMENTED 664 else 665 { 666 // Changing to async TMS calls 667 app.SetTMSAction(iPad,eTMSAction_TMSPP_RetrieveFiles_HelpAndOptions); 668 669 // block all input 670 pClass->m_bIgnorePress=true; 671 // We want to hide everything in this scene and display a timer until we get a completion for the TMS files 672 for(int i=0;i<BUTTONS_MAX;i++) 673 { 674 pClass->m_Buttons[i].SetShow(FALSE); 675 } 676 677 pClass->updateTooltips(); 678 679 pClass->m_Timer.SetShow(TRUE); 680 } 681#endif 682 } 683 else 684 { 685 pClass->m_bIgnorePress=false; 686 // unlock the profile 687 ProfileManager.SetLockedProfile(-1); 688 for(int i=0;i<XUSER_MAX_COUNT;i++) 689 { 690 // if the user is valid, we should set the presence 691 if(ProfileManager.IsSignedIn(i)) 692 { 693 ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); 694 } 695 } 696 } 697 698 return 0; 699} 700 701#ifdef _XBOX_ONE 702int UIScene_MainMenu::ChooseUser_SignInReturned(void *pParam, bool bContinue, int iPad, int iController) 703{ 704 UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; 705 pClass->m_bIgnorePress = false; 706 pClass->updateTooltips(); 707 return 0; 708} 709#endif 710 711#ifdef _XBOX_ONE 712int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, int iPad, int iController) 713#else 714int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, int iPad) 715#endif 716{ 717 UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; 718 719 if(bContinue) 720 { 721 // 4J-JEV: We only need to update rich-presence if the sign-in status changes. 722 ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); 723 724 UINT uiIDA[1] = { IDS_OK }; 725 726 if(ProfileManager.IsGuest(ProfileManager.GetPrimaryPad())) 727 { 728 pClass->m_bIgnorePress=false; 729 ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); 730 } 731 else 732 { 733 ProfileManager.SetLockedProfile(ProfileManager.GetPrimaryPad()); 734 735 736 // change the minecraft player name 737 Minecraft::GetInstance()->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); 738 739 if(ProfileManager.IsFullVersion()) 740 { 741 bool bSignedInLive = ProfileManager.IsSignedInLive(iPad); 742#ifdef __PSVITA__ 743 if(CGameNetworkManager::usingAdhocMode()) 744 { 745 if(SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) 746 { 747 bSignedInLive = true; 748 } 749 else 750 { 751 // adhoc mode, but we didn't make the connection, turn off adhoc mode, and just go with whatever the regular online status is 752 CGameNetworkManager::setAdhocMode(false); 753 bSignedInLive = ProfileManager.IsSignedInLive(iPad); 754 } 755 } 756#endif 757 758 // Check if we're signed in to LIVE 759 if(bSignedInLive) 760 { 761 // 4J-PB - Need to check for installed DLC 762 if(!app.DLCInstallProcessCompleted()) app.StartInstallDLCProcess(iPad); 763 764 if(ProfileManager.IsGuest(iPad)) 765 { 766 pClass->m_bIgnorePress=false; 767 ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); 768 } 769 else 770 { 771 // 4J Stu - Not relevant to PS3 772#ifdef _XBOX_ONE 773// if(app.GetTMSDLCInfoRead() && app.GetBanListRead(iPad)) 774 if(app.GetBanListRead(iPad)) 775 { 776 Minecraft *pMinecraft=Minecraft::GetInstance(); 777 pMinecraft->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); 778 779 // ensure we've applied this player's settings 780 app.ApplyGameSettingsChanged(iPad); 781 782#ifdef _XBOX_ONE 783 ui.ShowPlayerDisplayname(true); 784#endif 785 proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); 786 } 787 else 788 { 789 app.SetTMSAction(iPad,eTMSAction_TMSPP_RetrieveFiles_RunPlayGame); 790 791 // block all input 792 pClass->m_bIgnorePress=true; 793 // We want to hide everything in this scene and display a timer until we get a completion for the TMS files 794 // for(int i=0;i<eControl_Count;i++) 795 // { 796 // m_buttons[i].set(false); 797 // } 798 799 pClass->updateTooltips(); 800 801 pClass->m_controlTimer.setVisible( true ); 802 } 803#endif 804#if TO_BE_IMPLEMENTED 805 // check if all the TMS files are loaded 806 if(app.GetTMSDLCInfoRead() && app.GetTMSXUIDsFileRead() && app.GetBanListRead(iPad)) 807 { 808 if(StorageManager.SetSaveDevice(&UIScene_MainMenu::DeviceSelectReturned,pClass)==true) 809 { 810 // save device already selected 811 812 // ensure we've applied this player's settings 813 app.ApplyGameSettingsChanged(ProfileManager.GetPrimaryPad()); 814 // check for DLC 815 // start timer to track DLC check finished 816 pClass->m_Timer.SetShow(TRUE); 817 XuiSetTimer(pClass->m_hObj,DLC_INSTALLED_TIMER_ID,DLC_INSTALLED_TIMER_TIME); 818 //app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MultiGameJoinLoad); 819 } 820 } 821 else 822 { 823 // Changing to async TMS calls 824 app.SetTMSAction(iPad,eTMSAction_TMSPP_RetrieveFiles_RunPlayGame); 825 826 // block all input 827 pClass->m_bIgnorePress=true; 828 // We want to hide everything in this scene and display a timer until we get a completion for the TMS files 829 for(int i=0;i<BUTTONS_MAX;i++) 830 { 831 pClass->m_Buttons[i].SetShow(FALSE); 832 } 833 834 updateTooltips(); 835 836 pClass->m_Timer.SetShow(TRUE); 837 } 838#else 839 Minecraft *pMinecraft=Minecraft::GetInstance(); 840 pMinecraft->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); 841 842 // ensure we've applied this player's settings 843 app.ApplyGameSettingsChanged(iPad); 844 845#ifdef _XBOX_ONE 846 ui.ShowPlayerDisplayname(true); 847#endif 848 proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); 849#endif 850 } 851 } 852 else 853 { 854#if TO_BE_IMPLEMENTED 855 // offline 856 ProfileManager.DisplayOfflineProfile(&CScene_Main::CreateLoad_OfflineProfileReturned,pClass, ProfileManager.GetPrimaryPad() ); 857#else 858 app.DebugPrintf("Offline Profile returned not implemented\n"); 859#ifdef _XBOX_ONE 860 ui.ShowPlayerDisplayname(true); 861#endif 862 proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); 863#endif 864 } 865 } 866 else 867 { 868 // 4J-PB - if this is the trial game, we can't have any networking 869 // Can't apply the player's settings here - they haven't come back from the QuerySignInStatud call above yet. 870 // Need to let them action in the main loop when they come in 871 // ensure we've applied this player's settings 872 //app.ApplyGameSettingsChanged(iPad); 873 874#if defined(__PS3__) || defined(__ORBIS__) || defined( __PSVITA__) 875 // ensure we've applied this player's settings - we do have them on PS3 876 app.ApplyGameSettingsChanged(iPad); 877#endif 878 879#ifdef __ORBIS__ 880 if(!g_NetworkManager.IsReadyToPlayOrIdle()) 881 { 882 pClass->m_bLoadTrialOnNetworkManagerReady = true; 883 ui.NavigateToScene(iPad, eUIScene_Timer); 884 } 885 else 886#endif 887 { 888 // go straight in to the trial level 889 LoadTrial(); 890 } 891 } 892 } 893 } 894 else 895 { 896 pClass->m_bIgnorePress=false; 897 898 // unlock the profile 899 ProfileManager.SetLockedProfile(-1); 900 for(int i=0;i<XUSER_MAX_COUNT;i++) 901 { 902 // if the user is valid, we should set the presence 903 if(ProfileManager.IsSignedIn(i)) 904 { 905 ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); 906 } 907 } 908 909 } 910 return 0; 911} 912 913#ifdef _XBOX_ONE 914int UIScene_MainMenu::Leaderboards_SignInReturned(void *pParam,bool bContinue,int iPad,int iController) 915#else 916int UIScene_MainMenu::Leaderboards_SignInReturned(void *pParam,bool bContinue,int iPad) 917#endif 918{ 919 UIScene_MainMenu *pClass = (UIScene_MainMenu *)pParam; 920 921 if(bContinue) 922 { 923 // 4J-JEV: We only need to update rich-presence if the sign-in status changes. 924 ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); 925 926 UINT uiIDA[1] = { IDS_OK }; 927 928 // guests can't look at leaderboards 929 if(ProfileManager.IsGuest(ProfileManager.GetPrimaryPad())) 930 { 931 pClass->m_bIgnorePress=false; 932 ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); 933 } 934 else if(!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) 935 { 936 pClass->m_bIgnorePress=false; 937 ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); 938 } 939 else 940 { 941 bool bContentRestricted=false; 942#if defined(__PS3__) || defined(__PSVITA__) 943 ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL); 944#endif 945 if(bContentRestricted) 946 { 947 pClass->m_bIgnorePress=false; 948#if !(defined(_XBOX) || defined(_WINDOWS64) || defined(_XBOX_ONE) ) // 4J Stu - Temp to get the win build running, but so we check this for other platforms 949 // you can't see leaderboards 950 UINT uiIDA[1]; 951 uiIDA[0]=IDS_CONFIRM_OK; 952 ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad()); 953#endif 954 } 955 else 956 { 957 ProfileManager.SetLockedProfile(ProfileManager.GetPrimaryPad()); 958#ifdef _XBOX_ONE 959 ui.ShowPlayerDisplayname(true); 960#endif 961 proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LeaderboardsMenu); 962 } 963 } 964 } 965 else 966 { 967 pClass->m_bIgnorePress=false; 968 // unlock the profile 969 ProfileManager.SetLockedProfile(-1); 970 for(int i=0;i<XUSER_MAX_COUNT;i++) 971 { 972 // if the user is valid, we should set the presence 973 if(ProfileManager.IsSignedIn(i)) 974 { 975 ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); 976 } 977 } 978 979 } 980 return 0; 981} 982 983#ifdef _XBOX_ONE 984int UIScene_MainMenu::Achievements_SignInReturned(void *pParam,bool bContinue,int iPad,int iController) 985#else 986int UIScene_MainMenu::Achievements_SignInReturned(void *pParam,bool bContinue,int iPad) 987#endif 988{ 989 UIScene_MainMenu *pClass = (UIScene_MainMenu *)pParam; 990 991 if (bContinue) 992 { 993 pClass->m_bIgnorePress=false; 994 // 4J-JEV: We only need to update rich-presence if the sign-in status changes. 995 ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); 996 997 XShowAchievementsUI( ProfileManager.GetPrimaryPad() ); 998 } 999 else 1000 { 1001 pClass->m_bIgnorePress=false; 1002 // unlock the profile 1003 ProfileManager.SetLockedProfile(-1); 1004 for(int i=0;i<XUSER_MAX_COUNT;i++) 1005 { 1006 // if the user is valid, we should set the presence 1007 if(ProfileManager.IsSignedIn(i)) 1008 { 1009 ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); 1010 } 1011 } 1012 1013 } 1014 return 0; 1015} 1016 1017#ifdef _XBOX_ONE 1018int UIScene_MainMenu::UnlockFullGame_SignInReturned(void *pParam,bool bContinue,int iPad,int iController) 1019#else 1020int UIScene_MainMenu::UnlockFullGame_SignInReturned(void *pParam,bool bContinue,int iPad) 1021#endif 1022{ 1023 UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; 1024 1025 if (bContinue) 1026 { 1027 // 4J-JEV: We only need to update rich-presence if the sign-in status changes. 1028 ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); 1029 1030 pClass->RunUnlockOrDLC(iPad); 1031 } 1032 else 1033 { 1034 pClass->m_bIgnorePress=false; 1035 // unlock the profile 1036 ProfileManager.SetLockedProfile(-1); 1037 for(int i=0;i<XUSER_MAX_COUNT;i++) 1038 { 1039 // if the user is valid, we should set the presence 1040 if(ProfileManager.IsSignedIn(i)) 1041 { 1042 ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); 1043 } 1044 } 1045 1046 } 1047 1048 return 0; 1049} 1050 1051#ifdef _XBOX_ONE 1052int UIScene_MainMenu::XboxHelp_SignInReturned(void *pParam, bool bContinue, int iPad, int iController) 1053{ 1054 UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; 1055 1056 if (bContinue) 1057 { 1058 // 4J: Launch the dummy xbox help application. 1059 WXS::User^ user = ProfileManager.GetUser(ProfileManager.GetPrimaryPad()); 1060 Windows::Xbox::ApplicationModel::Help::Show(user); 1061 } 1062 else 1063 { 1064 // unlock the profile 1065 ProfileManager.SetLockedProfile(-1); 1066 for(int i=0;i<XUSER_MAX_COUNT;i++) 1067 { 1068 // if the user is valid, we should set the presence 1069 if(ProfileManager.IsSignedIn(i)) 1070 { 1071 ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); 1072 } 1073 } 1074 } 1075 1076 return 0; 1077} 1078#endif 1079 1080int UIScene_MainMenu::ExitGameReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) 1081{ 1082 //UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; 1083 1084 // buttons reversed on this 1085 if(result==C4JStorage::EMessage_ResultDecline) 1086 { 1087 //XLaunchNewImage(XLAUNCH_KEYWORD_DASH_ARCADE, 0); 1088 app.ExitGame(); 1089 } 1090 1091 return 0; 1092} 1093 1094#ifdef __ORBIS__ 1095void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_PlayGame(void *pParam) 1096{ 1097 int primaryPad = ProfileManager.GetPrimaryPad(); 1098 1099 UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; 1100 1101 int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = NULL; 1102 1103 // 4J-PB - Check if there is a patch for the game 1104 pClass->m_errorCode = ProfileManager.getNPAvailability(ProfileManager.GetPrimaryPad()); 1105 1106 bool bPatchAvailable; 1107 switch(pClass->m_errorCode) 1108 { 1109 case SCE_NP_ERROR_LATEST_PATCH_PKG_EXIST: 1110 case SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED: 1111 bPatchAvailable=true; 1112 break; 1113 default: 1114 bPatchAvailable=false; 1115 break; 1116 } 1117 1118 if(!bPatchAvailable) 1119 { 1120 pClass->m_eAction=eAction_RunGame; 1121 signInReturnedFunc = &UIScene_MainMenu::CreateLoad_SignInReturned; 1122 } 1123 else 1124 { 1125 pClass->m_bRunGameChosen=true; 1126 pClass->m_bErrorDialogRunning=true; 1127 int32_t ret=sceErrorDialogInitialize(); 1128 if ( ret==SCE_OK ) 1129 { 1130 SceErrorDialogParam param; 1131 sceErrorDialogParamInitialize( &param ); 1132 // 4J-PB - We want to display the option to get the patch now 1133 param.errorCode = SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED;//pClass->m_errorCode; 1134 ret = sceUserServiceGetInitialUser( &param.userId ); 1135 if ( ret == SCE_OK ) 1136 { 1137 ret=sceErrorDialogOpen( &param ); 1138 } 1139 return; 1140 } 1141 1142// UINT uiIDA[1]; 1143// uiIDA[0]=IDS_OK; 1144// ui.RequestMessageBox(IDS_PATCH_AVAILABLE_TITLE, IDS_PATCH_AVAILABLE_TEXT, uiIDA, 1, XUSER_INDEX_ANY,NULL,pClass); 1145 } 1146 1147 // Check if PSN is unavailable because of age restriction 1148 if (pClass->m_errorCode == SCE_NP_ERROR_AGE_RESTRICTION) 1149 { 1150 UINT uiIDA[1]; 1151 uiIDA[0]=IDS_PRO_NOTONLINE_DECLINE; 1152 ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::PlayOfflineReturned, pClass); 1153 1154 return; 1155 } 1156 1157 bool confirmUser = false; 1158 1159 // Note: if no sign in returned func, assume this isn't required 1160 if (signInReturnedFunc != NULL) 1161 { 1162 if(ProfileManager.IsSignedIn(primaryPad)) 1163 { 1164 if (confirmUser) 1165 { 1166 ProfileManager.RequestSignInUI(false, false, true, false, true, signInReturnedFunc, pClass, primaryPad); 1167 } 1168 else 1169 { 1170 pClass->RunAction(primaryPad); 1171 } 1172 } 1173 else 1174 { 1175 // Ask user to sign in 1176 UINT uiIDA[2]; 1177 uiIDA[0]=IDS_CONFIRM_OK; 1178 uiIDA[1]=IDS_CONFIRM_CANCEL; 1179 ui.RequestErrorMessage(IDS_MUST_SIGN_IN_TITLE, IDS_MUST_SIGN_IN_TEXT, uiIDA, 2, primaryPad, &UIScene_MainMenu::MustSignInReturned, pClass); 1180 } 1181 } 1182} 1183 1184void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_Leaderboards(void *pParam) 1185{ 1186 int primaryPad = ProfileManager.GetPrimaryPad(); 1187 1188 UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; 1189 1190 int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = NULL; 1191 1192 // 4J-PB - Check if there is a patch for the game 1193 pClass->m_errorCode = ProfileManager.getNPAvailability(ProfileManager.GetPrimaryPad()); 1194 1195 bool bPatchAvailable; 1196 switch(pClass->m_errorCode) 1197 { 1198 case SCE_NP_ERROR_LATEST_PATCH_PKG_EXIST: 1199 case SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED: 1200 bPatchAvailable=true; 1201 break; 1202 default: 1203 bPatchAvailable=false; 1204 break; 1205 } 1206 1207 if(!bPatchAvailable) 1208 { 1209 pClass->m_eAction=eAction_RunLeaderboards; 1210 signInReturnedFunc = &UIScene_MainMenu::Leaderboards_SignInReturned; 1211 } 1212 else 1213 { 1214 int32_t ret=sceErrorDialogInitialize(); 1215 pClass->m_bErrorDialogRunning=true; 1216 if ( ret==SCE_OK ) 1217 { 1218 SceErrorDialogParam param; 1219 sceErrorDialogParamInitialize( &param ); 1220 // 4J-PB - We want to display the option to get the patch now 1221 param.errorCode = SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED;//pClass->m_errorCode; 1222 ret = sceUserServiceGetInitialUser( &param.userId ); 1223 if ( ret == SCE_OK ) 1224 { 1225 ret=sceErrorDialogOpen( &param ); 1226 } 1227 } 1228 1229// UINT uiIDA[1]; 1230// uiIDA[0]=IDS_OK; 1231// ui.RequestMessageBox(IDS_PATCH_AVAILABLE_TITLE, IDS_PATCH_AVAILABLE_TEXT, uiIDA, 1, XUSER_INDEX_ANY,NULL,pClass); 1232 } 1233 1234 bool confirmUser = false; 1235 1236 // Update error code 1237 pClass->m_errorCode = ProfileManager.getNPAvailability(ProfileManager.GetPrimaryPad()); 1238 1239 // Check if PSN is unavailable because of age restriction 1240 if (pClass->m_errorCode == SCE_NP_ERROR_AGE_RESTRICTION) 1241 { 1242 UINT uiIDA[1]; 1243 uiIDA[0] = IDS_CONFIRM_OK; 1244 ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, pClass); 1245 1246 return; 1247 } 1248 1249 // Note: if no sign in returned func, assume this isn't required 1250 if (signInReturnedFunc != NULL) 1251 { 1252 if(ProfileManager.IsSignedIn(primaryPad)) 1253 { 1254 if (confirmUser) 1255 { 1256 ProfileManager.RequestSignInUI(false, false, true, false, true, signInReturnedFunc, pClass, primaryPad); 1257 } 1258 else 1259 { 1260 pClass->RunAction(primaryPad); 1261 } 1262 } 1263 else 1264 { 1265 // Ask user to sign in 1266 UINT uiIDA[2]; 1267 uiIDA[0]=IDS_CONFIRM_OK; 1268 uiIDA[1]=IDS_CONFIRM_CANCEL; 1269 ui.RequestErrorMessage(IDS_MUST_SIGN_IN_TITLE, IDS_MUST_SIGN_IN_TEXT, uiIDA, 2, primaryPad, &UIScene_MainMenu::MustSignInReturned, pClass); 1270 } 1271 } 1272} 1273 1274int UIScene_MainMenu::PlayOfflineReturned(void *pParam, int iPad, C4JStorage::EMessageResult result) 1275{ 1276 UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; 1277 1278 if(result==C4JStorage::EMessage_ResultAccept) 1279 { 1280 if (pClass->m_eAction == eAction_RunGame) 1281 { 1282 CreateLoad_SignInReturned(pClass, true, 0); 1283 } 1284 else 1285 { 1286 pClass->m_bIgnorePress=false; 1287 } 1288 } 1289 else 1290 { 1291 pClass->m_bIgnorePress=false; 1292 } 1293 1294 return 0; 1295} 1296#endif 1297 1298void UIScene_MainMenu::RunPlayGame(int iPad) 1299{ 1300 Minecraft *pMinecraft=Minecraft::GetInstance(); 1301 1302 // clear the remembered signed in users so their profiles get read again 1303 app.ClearSignInChangeUsersMask(); 1304 1305 app.ReleaseSaveThumbnail(); 1306 1307 if(ProfileManager.IsGuest(iPad)) 1308 { 1309 UINT uiIDA[1]; 1310 uiIDA[0]=IDS_OK; 1311 1312 m_bIgnorePress=false; 1313 ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); 1314 } 1315 else 1316 { 1317 ProfileManager.SetLockedProfile(iPad); 1318 1319 // 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 1320 ProfileManager.QuerySigninStatus(); 1321 1322 // 4J-PB - Need to check for installed DLC 1323 if(!app.DLCInstallProcessCompleted()) app.StartInstallDLCProcess(iPad); 1324 1325 if(ProfileManager.IsFullVersion()) 1326 { 1327 // are we offline? 1328 bool bSignedInLive = ProfileManager.IsSignedInLive(iPad); 1329#ifdef __PSVITA__ 1330 if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_PSVita_NetworkModeAdhoc) == true) 1331 { 1332 CGameNetworkManager::setAdhocMode(true); 1333 bSignedInLive = SQRNetworkManager_AdHoc_Vita::GetAdhocStatus(); 1334 app.DebugPrintf("Adhoc mode signed in : %s\n", bSignedInLive ? "true" : "false"); 1335 } 1336 else 1337 { 1338 CGameNetworkManager::setAdhocMode(false); 1339 app.DebugPrintf("PSN mode signed in : %s\n", bSignedInLive ? "true" : "false"); 1340 } 1341 1342#endif //__PSVITA__ 1343 1344 if(!bSignedInLive) 1345 { 1346#if defined(__PS3__) || defined __PSVITA__ 1347 // enable input again 1348 m_bIgnorePress=false; 1349 1350 // Not sure why 360 doesn't need this, but leaving as __PS3__ only for now until we see that it does. Without this, on a PS3 offline game, the primary player just gets the default Player1234 type name 1351 pMinecraft->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); 1352 1353 m_eAction=eAction_RunGamePSN; 1354 // get them to sign in to online 1355 UINT uiIDA[2]; 1356 uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; 1357 uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; 1358 1359#ifdef __PSVITA__ 1360 if(CGameNetworkManager::usingAdhocMode()) 1361 { 1362 uiIDA[0]=IDS_NETWORK_ADHOC; 1363 // this should be "Connect to adhoc network" 1364 ui.RequestErrorMessage(IDS_PRO_NOTADHOCONLINE_TITLE, IDS_PRO_NOTADHOCONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this); 1365 } 1366 else 1367 { 1368 /* 4J-PB - Add this after release 1369 // Determine why they're not "signed in live" 1370 if (ProfileManager.IsSignedInPSN(iPad)) 1371 { 1372 m_eAction=eAction_RunGame; 1373 // Signed in to PSN but not connected (no internet access) 1374 1375 UINT uiIDA[1]; 1376 uiIDA[0] = IDS_PRO_NOTONLINE_DECLINE; 1377 ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad, UIScene_MainMenu::PlayOfflineReturned, this, app.GetStringTable()); 1378 } 1379 else 1380 { 1381 m_eAction=eAction_RunGamePSN; 1382 // Not signed in to PSN 1383 ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPad, &UIScene_MainMenu::MustSignInReturnedPSN, this, app.GetStringTable()); 1384 return; 1385 } */ 1386 ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this); 1387 1388 } 1389#else 1390 1391 ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPad, &UIScene_MainMenu::MustSignInReturnedPSN, this); 1392#endif 1393 1394#elif defined __ORBIS__ 1395 1396 // Determine why they're not "signed in live" 1397 if (ProfileManager.isSignedInPSN(iPad)) 1398 { 1399 m_eAction=eAction_RunGame; 1400 // Signed in to PSN but not connected (no internet access) 1401 assert(!ProfileManager.isConnectedToPSN(iPad)); 1402 1403 UINT uiIDA[1]; 1404 uiIDA[0] = IDS_PRO_NOTONLINE_DECLINE; 1405 ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad, UIScene_MainMenu::PlayOfflineReturned, this); 1406 } 1407 else 1408 { 1409 m_eAction=eAction_RunGamePSN; 1410 // Not signed in to PSN 1411 UINT uiIDA[2]; 1412 uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; 1413 uiIDA[1] = IDS_PRO_NOTONLINE_DECLINE; 1414 ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPad, &UIScene_MainMenu::MustSignInReturnedPSN, this); 1415 return; 1416 } 1417#else 1418 ProfileManager.SetLockedProfile(iPad); 1419#ifdef _XBOX_ONE 1420 ui.ShowPlayerDisplayname(true); 1421#endif 1422 proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); 1423#endif 1424 } 1425 else 1426 { 1427#ifdef _XBOX_ONE 1428 if(!app.GetBanListRead(iPad)) 1429 { 1430 app.SetTMSAction(iPad,eTMSAction_TMSPP_RetrieveFiles_RunPlayGame); 1431 1432 // block all input 1433 m_bIgnorePress=true; 1434 // We want to hide everything in this scene and display a timer until we get a completion for the TMS files 1435// for(int i=0;i<eControl_Count;i++) 1436// { 1437// m_buttons[i].set(false); 1438// } 1439 1440 updateTooltips(); 1441 1442 m_controlTimer.setVisible( true ); 1443 } 1444#endif 1445#if TO_BE_IMPLEMENTED 1446 // Check if there is any new DLC 1447 app.ClearNewDLCAvailable(); 1448 StorageManager.GetAvailableDLCCount(iPad); 1449 1450 // check if all the TMS files are loaded 1451 if(app.GetTMSDLCInfoRead() && app.GetTMSXUIDsFileRead() && app.GetBanListRead(iPad)) 1452 { 1453 if(StorageManager.SetSaveDevice(&CScene_Main::DeviceSelectReturned,this)==true) 1454 { 1455 // change the minecraft player name 1456 pMinecraft->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); 1457 // save device already selected 1458 1459 // ensure we've applied this player's settings 1460 app.ApplyGameSettingsChanged(iPad); 1461 // check for DLC 1462 // start timer to track DLC check finished 1463 m_Timer.SetShow(TRUE); 1464 XuiSetTimer(m_hObj,DLC_INSTALLED_TIMER_ID,DLC_INSTALLED_TIMER_TIME); 1465 //app.NavigateToScene(iPad,eUIScene_MultiGameJoinLoad); 1466 } 1467 } 1468 else 1469 { 1470 // Changing to async TMS calls 1471 app.SetTMSAction(iPad,eTMSAction_TMSPP_RetrieveFiles_RunPlayGame); 1472 1473 // block all input 1474 m_bIgnorePress=true; 1475 // We want to hide everything in this scene and display a timer until we get a completion for the TMS files 1476 for(int i=0;i<BUTTONS_MAX;i++) 1477 { 1478 m_Buttons[i].SetShow(FALSE); 1479 } 1480 1481 updateTooltips(); 1482 1483 m_Timer.SetShow(TRUE); 1484 } 1485#else 1486 pMinecraft->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); 1487 1488 // ensure we've applied this player's settings 1489 app.ApplyGameSettingsChanged(iPad); 1490 1491#ifdef _XBOX_ONE 1492 ui.ShowPlayerDisplayname(true); 1493#endif 1494 proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); 1495#endif 1496 } 1497 } 1498 else 1499 { 1500 // 4J-PB - if this is the trial game, we can't have any networking 1501 // go straight in to the trial level 1502 // change the minecraft player name 1503 Minecraft::GetInstance()->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); 1504 1505 // Can't apply the player's settings here - they haven't come back from the QuerySignInStatud call above yet. 1506 // Need to let them action in the main loop when they come in 1507 // ensure we've applied this player's settings 1508 //app.ApplyGameSettingsChanged(iPad); 1509 1510#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) 1511 // ensure we've applied this player's settings - we do have them on PS3 1512 app.ApplyGameSettingsChanged(iPad); 1513#endif 1514 1515#ifdef __ORBIS__ 1516 if(!g_NetworkManager.IsReadyToPlayOrIdle()) 1517 { 1518 m_bLoadTrialOnNetworkManagerReady = true; 1519 ui.NavigateToScene(iPad, eUIScene_Timer); 1520 } 1521 else 1522#endif 1523 { 1524 LoadTrial(); 1525 } 1526 } 1527 } 1528} 1529 1530void UIScene_MainMenu::RunLeaderboards(int iPad) 1531{ 1532 UINT uiIDA[1]; 1533 uiIDA[0]=IDS_OK; 1534 1535 // guests can't look at leaderboards 1536 if(ProfileManager.IsGuest(iPad)) 1537 { 1538 ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); 1539 } 1540 else if(!ProfileManager.IsSignedInLive(iPad)) 1541 { 1542#if defined __PS3__ || defined __PSVITA__ 1543 m_eAction=eAction_RunLeaderboardsPSN; 1544 // get them to sign in to online 1545 UINT uiIDA[1]; 1546 uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; 1547 ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this); 1548 1549/* 4J-PB - Add this after release 1550#elif defined __PSVITA__ 1551 m_eAction=eAction_RunLeaderboardsPSN; 1552 // Determine why they're not "signed in live" 1553 if (ProfileManager.IsSignedInPSN(iPad)) 1554 { 1555 // Signed in to PSN but not connected (no internet access) 1556 UINT uiIDA[1]; 1557 uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; 1558 ui.RequestMessageBox(IDS_PRO_CURRENTLY_NOT_ONLINE_TITLE, IDS_PRO_PSNOFFLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this, app.GetStringTable()); 1559 } 1560 else 1561 { 1562 // Not signed in to PSN 1563 UINT uiIDA[1]; 1564 uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; 1565 ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this, app.GetStringTable()); 1566 return; 1567 }*/ 1568#elif defined __ORBIS__ 1569 m_eAction=eAction_RunLeaderboardsPSN; 1570 // Determine why they're not "signed in live" 1571 if (ProfileManager.isSignedInPSN(iPad)) 1572 { 1573 // Signed in to PSN but not connected (no internet access) 1574 assert(!ProfileManager.isConnectedToPSN(iPad)); 1575 1576 UINT uiIDA[1]; 1577 uiIDA[0] = IDS_OK; 1578 ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad); 1579 } 1580 else 1581 { 1582 // Not signed in to PSN 1583 UINT uiIDA[1]; 1584 uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; 1585 ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this); 1586 return; 1587 } 1588#else 1589 ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); 1590#endif 1591 } 1592 else 1593 { 1594 // we're supposed to check for parental control restrictions before showing leaderboards 1595 // The title enforces the user's NP parental control setting for age-based content 1596 //restriction in network communications. 1597 // If age restrictions are in place and the user's age does not meet 1598 // the age restriction of the title's online service content rating (CERO, ESRB, PEGI, etc.), then the title must 1599 //display a message such as the following and disallow online service for this user. 1600 1601 bool bContentRestricted=false; 1602#if defined(__PS3__) || defined(__PSVITA__) 1603 ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL); 1604#endif 1605 if(bContentRestricted) 1606 { 1607#if !(defined(_XBOX) || defined(_WINDOWS64) || defined(_XBOX_ONE)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms 1608 // you can't see leaderboards 1609 UINT uiIDA[1]; 1610 uiIDA[0]=IDS_CONFIRM_OK; 1611 ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,this); 1612#endif 1613 } 1614 else 1615 { 1616 ProfileManager.SetLockedProfile(iPad); 1617 // 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 1618 ProfileManager.QuerySigninStatus(); 1619 1620#ifdef _XBOX_ONE 1621 ui.ShowPlayerDisplayname(true); 1622#endif 1623 proceedToScene(iPad, eUIScene_LeaderboardsMenu); 1624 } 1625 } 1626} 1627void UIScene_MainMenu::RunUnlockOrDLC(int iPad) 1628{ 1629 UINT uiIDA[1]; 1630 uiIDA[0]=IDS_OK; 1631 1632 // Check if this means downloadable content 1633 if(ProfileManager.IsFullVersion()) 1634 { 1635#ifdef __ORBIS__ 1636 // 4J-PB - Check if there is a patch for the game 1637 m_errorCode = ProfileManager.getNPAvailability(ProfileManager.GetPrimaryPad()); 1638 1639 bool bPatchAvailable; 1640 switch(m_errorCode) 1641 { 1642 case SCE_NP_ERROR_LATEST_PATCH_PKG_EXIST: 1643 case SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED: 1644 bPatchAvailable=true; 1645 break; 1646 default: 1647 bPatchAvailable=false; 1648 break; 1649 } 1650 1651 if(bPatchAvailable) 1652 { 1653 m_bIgnorePress=false; 1654 1655 int32_t ret=sceErrorDialogInitialize(); 1656 m_bErrorDialogRunning=true; 1657 if ( ret==SCE_OK ) 1658 { 1659 SceErrorDialogParam param; 1660 sceErrorDialogParamInitialize( &param ); 1661 // 4J-PB - We want to display the option to get the patch now 1662 param.errorCode = SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED;//pClass->m_errorCode; 1663 ret = sceUserServiceGetInitialUser( &param.userId ); 1664 if ( ret == SCE_OK ) 1665 { 1666 ret=sceErrorDialogOpen( &param ); 1667 } 1668 } 1669 1670// UINT uiIDA[1]; 1671// uiIDA[0]=IDS_OK; 1672// ui.RequestMessageBox(IDS_PATCH_AVAILABLE_TITLE, IDS_PATCH_AVAILABLE_TEXT, uiIDA, 1, XUSER_INDEX_ANY,NULL,this); 1673 return; 1674 } 1675 1676 // Check if PSN is unavailable because of age restriction 1677 if (m_errorCode == SCE_NP_ERROR_AGE_RESTRICTION) 1678 { 1679 m_bIgnorePress=false; 1680 UINT uiIDA[1]; 1681 uiIDA[0] = IDS_OK; 1682 ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, this); 1683 1684 return; 1685 } 1686#endif 1687 // downloadable content 1688 if(ProfileManager.IsSignedInLive(iPad)) 1689 { 1690 if(ProfileManager.IsGuest(iPad)) 1691 { 1692 m_bIgnorePress=false; 1693 ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); 1694 } 1695 else 1696 { 1697 1698 // 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 1699 ProfileManager.QuerySigninStatus(); 1700 1701#if defined _XBOX_ONE 1702 if(app.GetTMSDLCInfoRead()) 1703#endif 1704 { 1705 bool bContentRestricted=false; 1706#if defined(__PS3__) || defined(__PSVITA__) 1707 ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL); 1708#endif 1709 if(bContentRestricted) 1710 { 1711 m_bIgnorePress=false; 1712#if !(defined(_XBOX) || defined(_WINDOWS64) || defined(_XBOX_ONE)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms 1713 // you can't see the store 1714 UINT uiIDA[1]; 1715 uiIDA[0]=IDS_CONFIRM_OK; 1716 ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,this); 1717#endif 1718 } 1719 else 1720 { 1721 ProfileManager.SetLockedProfile(iPad); 1722#ifdef _XBOX_ONE 1723 ui.ShowPlayerDisplayname(true); 1724#endif 1725 proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_DLCMainMenu); 1726 } 1727 } 1728#if defined _XBOX_ONE 1729 else 1730 { 1731 // Changing to async TMS calls 1732 app.SetTMSAction(iPad,eTMSAction_TMSPP_RetrieveFiles_DLCMain); 1733 1734 // block all input 1735 m_bIgnorePress=true; 1736 // We want to hide everything in this scene and display a timer until we get a completion for the TMS files 1737// for(int i=0;i<BUTTONS_MAX;i++) 1738// { 1739// m_Buttons[i].SetShow(FALSE); 1740// } 1741 1742 updateTooltips(); 1743 1744 m_controlTimer.setVisible( true ); 1745 m_bWaitingForDLCInfo=true; 1746 } 1747#endif 1748 1749 // read the DLC info from TMS 1750 /*app.ReadDLCFileFromTMS(iPad);*/ 1751 1752 // We want to navigate to the DLC scene, but block input until we get the DLC file in from TMS 1753 // Don't navigate - we might have an uplink disconnect 1754 //app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DLCMainMenu); 1755 1756 } 1757 } 1758 else 1759 { 1760#if defined(__PS3__) || defined(__PSVITA__) 1761 m_eAction=eAction_RunUnlockOrDLCPSN; 1762 // get them to sign in to online 1763 UINT uiIDA[1]; 1764 uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; 1765 //uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; 1766 ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this); 1767#elif defined __ORBIS__ 1768 m_eAction=eAction_RunUnlockOrDLCPSN; 1769 // Determine why they're not "signed in live" 1770 if (ProfileManager.isSignedInPSN(iPad)) 1771 { 1772 m_bIgnorePress=false; 1773 // Signed in to PSN but not connected (no internet access) 1774 assert(!ProfileManager.isConnectedToPSN(iPad)); 1775 1776 UINT uiIDA[1]; 1777 uiIDA[0] = IDS_OK; 1778 ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad); 1779 } 1780 else 1781 { 1782 // Not signed in to PSN 1783 UINT uiIDA[1]; 1784 uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; 1785 ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this); 1786 return; 1787 } 1788#else 1789 UINT uiIDA[1]; 1790 uiIDA[0]=IDS_OK; 1791 ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); 1792#endif 1793 } 1794 } 1795 else 1796 { 1797 // guests can't buy the game 1798 if(ProfileManager.IsGuest(iPad)) 1799 { 1800 m_bIgnorePress=false; 1801 ui.RequestErrorMessage(IDS_UNLOCK_TITLE, IDS_UNLOCK_GUEST_TEXT, uiIDA, 1,iPad); 1802 } 1803 else if(!ProfileManager.IsSignedInLive(iPad)) 1804 { 1805#if defined(__PS3__) || defined(__PSVITA__) 1806 m_eAction=eAction_RunUnlockOrDLCPSN; 1807 // get them to sign in to online 1808 UINT uiIDA[1]; 1809 uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; 1810 ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this); 1811#elif defined __ORBIS__ 1812 m_eAction=eAction_RunUnlockOrDLCPSN; 1813 // Determine why they're not "signed in live" 1814 if (ProfileManager.isSignedInPSN(iPad)) 1815 { 1816 m_bIgnorePress=false; 1817 // Signed in to PSN but not connected (no internet access) 1818 assert(!ProfileManager.isConnectedToPSN(iPad)); 1819 1820 UINT uiIDA[1]; 1821 uiIDA[0] = IDS_OK; 1822 ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad); 1823 } 1824 else 1825 { 1826 // Not signed in to PSN 1827 UINT uiIDA[1]; 1828 uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; 1829 ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this); 1830 return; 1831 } 1832#else 1833 UINT uiIDA[1]; 1834 uiIDA[0]=IDS_OK; 1835 ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); 1836#endif 1837 1838 } 1839 else 1840 { 1841 // 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 1842 ProfileManager.QuerySigninStatus(); 1843 1844 // check that the commerce is in the right state to be able to display the full version purchase - if the user is fast with the trial version, it can still be retrieving the product list 1845#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) 1846 m_bIgnorePress=true; 1847 m_bLaunchFullVersionPurchase=true; 1848 1849#else 1850 TelemetryManager->RecordUpsellPresented(iPad, eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID); 1851 ProfileManager.DisplayFullVersionPurchase(false,iPad,eSen_UpsellID_Full_Version_Of_Game); 1852#endif 1853 } 1854 } 1855} 1856 1857void UIScene_MainMenu::tick() 1858{ 1859 UIScene::tick(); 1860 1861 if ( (eNavigateWhenReady >= 0) ) 1862 { 1863 1864 int lockedProfile = ProfileManager.GetLockedProfile(); 1865 1866#ifdef _DURANGO 1867 // 4J-JEV: DLC menu contains text localised to system language which we can't change. 1868 // We need to switch to this language in-case it uses a different font. 1869 if (eNavigateWhenReady == eUIScene_DLCMainMenu) setLanguageOverride(false); 1870 1871 bool isSignedIn; 1872 C4JStorage::eOptionsCallback status; 1873 bool pendingFontChange; 1874 if (lockedProfile >= 0) 1875 { 1876 isSignedIn = ProfileManager.IsSignedIn(lockedProfile); 1877 status = app.GetOptionsCallbackStatus(lockedProfile); 1878 pendingFontChange = ui.PendingFontChange(); 1879 1880 if(status == C4JStorage::eOptions_Callback_Idle) 1881 { 1882 // make sure the TMS banned list data is ditched - the player may have gone in to help & options, backed out, and signed out 1883 app.InvalidateBannedList(lockedProfile); 1884 1885 // need to ditch any DLCOffers info 1886 StorageManager.ClearDLCOffers(); 1887 app.ClearAndResetDLCDownloadQueue(); 1888 app.ClearDLCInstalled(); 1889 } 1890 } 1891 1892 if ( (lockedProfile >= 0) 1893 && isSignedIn 1894 && ((status == C4JStorage::eOptions_Callback_Read)||(status == C4JStorage::eOptions_Callback_Write)) 1895 && !pendingFontChange 1896 ) 1897#endif 1898 { 1899 app.DebugPrintf("[MainMenu] Navigating away from MainMenu.\n"); 1900 ui.NavigateToScene(lockedProfile, eNavigateWhenReady); 1901 eNavigateWhenReady = (EUIScene) -1; 1902 } 1903#ifdef _DURANGO 1904 else 1905 { 1906 app.DebugPrintf("[MainMenu] Delaying navigation: lockedProfile=%i, %s, status=%ls, %s.\n", 1907 lockedProfile, 1908 isSignedIn ? "SignedIn" : "SignedOut", 1909 app.toStringOptionsStatus(status).c_str(), 1910 pendingFontChange ? "Pending font change" : "font OK"); 1911 } 1912#endif 1913 } 1914 1915#if defined(__PS3__) || defined (__ORBIS__) || defined(__PSVITA__) 1916 if(m_bLaunchFullVersionPurchase) 1917 { 1918 int iCommerceState=app.GetCommerceState(); 1919 // 4J-PB - if there's a commerce error - store down, player can't access store - let the DisplayFullVersionPurchase show the error 1920 if((iCommerceState==CConsoleMinecraftApp::eCommerce_State_Online) || (iCommerceState==CConsoleMinecraftApp::eCommerce_State_Error)) 1921 { 1922 m_bLaunchFullVersionPurchase=false; 1923 m_bIgnorePress=false; 1924 updateTooltips(); 1925 1926 // 4J-PB - need to check this user can access the store 1927 bool bContentRestricted=false; 1928 ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); 1929 if(bContentRestricted) 1930 { 1931 UINT uiIDA[1]; 1932 uiIDA[0]=IDS_CONFIRM_OK; 1933 ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad()); 1934 } 1935 else 1936 { 1937 TelemetryManager->RecordUpsellPresented(ProfileManager.GetPrimaryPad(), eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID); 1938 ProfileManager.DisplayFullVersionPurchase(false,ProfileManager.GetPrimaryPad(),eSen_UpsellID_Full_Version_Of_Game); 1939 } 1940 } 1941 } 1942 1943 // 4J-PB - check for a trial version changing to a full version 1944 if(m_bTrialVersion) 1945 { 1946 if(ProfileManager.IsFullVersion()) 1947 { 1948 m_bTrialVersion=false; 1949 m_buttons[(int)eControl_UnlockOrDLC].init(app.GetString(IDS_DOWNLOADABLECONTENT),eControl_UnlockOrDLC); 1950 } 1951 } 1952#endif 1953 1954#if defined _XBOX_ONE 1955 if(m_bWaitingForDLCInfo) 1956 { 1957 if(app.GetTMSDLCInfoRead()) 1958 { 1959 m_bWaitingForDLCInfo=false; 1960 ProfileManager.SetLockedProfile(m_iPad); 1961 proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_DLCMainMenu); 1962 } 1963 } 1964 1965 if(g_NetworkManager.ShouldMessageForFullSession()) 1966 { 1967 UINT uiIDA[1]; 1968 uiIDA[0]=IDS_CONFIRM_OK; 1969 ui.RequestErrorMessage( IDS_CONNECTION_FAILED, IDS_IN_PARTY_SESSION_FULL, uiIDA,1,ProfileManager.GetPrimaryPad()); 1970 } 1971#endif 1972 1973#ifdef __ORBIS__ 1974 1975 // process the error dialog (for a patch being available) 1976 // SQRNetworkManager_Orbis::tickErrorDialog also runs the error dialog, so wrap this so this doesn't terminate a signin dialog 1977 if(m_bErrorDialogRunning) 1978 { 1979 SceErrorDialogStatus stat = sceErrorDialogUpdateStatus(); 1980 if( stat == SCE_ERROR_DIALOG_STATUS_FINISHED ) 1981 { 1982 sceErrorDialogTerminate(); 1983 // if m_bRunGameChosen is true, we're here after selecting play game, and we should let the user continue with an offline game 1984 if(m_bRunGameChosen) 1985 { 1986 m_bRunGameChosen=false; 1987 m_eAction = eAction_RunGame; 1988 1989 // give the option of continuing offline 1990 UINT uiIDA[1]; 1991 uiIDA[0]=IDS_PRO_NOTONLINE_DECLINE; 1992 ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION_PATCH_AVAILABLE, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::PlayOfflineReturned, this); 1993 1994 } 1995 m_bErrorDialogRunning=false; 1996 } 1997 } 1998 1999 if(m_bLoadTrialOnNetworkManagerReady && g_NetworkManager.IsReadyToPlayOrIdle()) 2000 { 2001 m_bLoadTrialOnNetworkManagerReady = false; 2002 LoadTrial(); 2003 } 2004 2005#endif 2006} 2007 2008void UIScene_MainMenu::RunAchievements(int iPad) 2009{ 2010#if TO_BE_IMPLEMENTED 2011 UINT uiIDA[1]; 2012 uiIDA[0]=IDS_OK; 2013 2014 // guests can't look at achievements 2015 if(ProfileManager.IsGuest(iPad)) 2016 { 2017 ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); 2018 } 2019 else 2020 { 2021 XShowAchievementsUI( iPad ); 2022 } 2023#endif 2024} 2025 2026void UIScene_MainMenu::RunHelpAndOptions(int iPad) 2027{ 2028 if(ProfileManager.IsGuest(iPad)) 2029 { 2030 UINT uiIDA[1]; 2031 uiIDA[0]=IDS_OK; 2032 ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); 2033 } 2034 else 2035 { 2036 // 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 2037 ProfileManager.QuerySigninStatus(); 2038 2039#if TO_BE_IMPLEMENTED 2040 // 4J-PB - You can be offline and still can go into help and options 2041 if(app.GetTMSDLCInfoRead() || !ProfileManager.IsSignedInLive(iPad)) 2042#endif 2043 { 2044 ProfileManager.SetLockedProfile(iPad); 2045#ifdef _XBOX_ONE 2046 ui.ShowPlayerDisplayname(true); 2047#endif 2048 proceedToScene(iPad, eUIScene_HelpAndOptionsMenu); 2049 } 2050#if TO_BE_IMPLEMENTED 2051 else 2052 { 2053 // Changing to async TMS calls 2054 app.SetTMSAction(iPad,eTMSAction_TMSPP_RetrieveFiles_HelpAndOptions); 2055 2056 // block all input 2057 m_bIgnorePress=true; 2058 // We want to hide everything in this scene and display a timer until we get a completion for the TMS files 2059 for(int i=0;i<BUTTONS_MAX;i++) 2060 { 2061 m_Buttons[i].SetShow(FALSE); 2062 } 2063 2064 updateTooltips(); 2065 2066 m_Timer.SetShow(TRUE); 2067 } 2068#endif 2069 } 2070} 2071 2072void UIScene_MainMenu::LoadTrial(void) 2073{ 2074 app.SetTutorialMode( true ); 2075 2076 // clear out the app's terrain features list 2077 app.ClearTerrainFeaturePosition(); 2078 2079 StorageManager.ResetSaveData(); 2080 2081 // Need to set the mode as trial 2082 ProfileManager.StartTrialGame(); 2083 2084 // No saving in the trial 2085 StorageManager.SetSaveDisabled(true); 2086 app.SetGameHostOption(eGameHostOption_WasntSaveOwner, false); 2087 2088 // Set the global flag, so that we don't disable saving again once the save is complete 2089 app.SetGameHostOption(eGameHostOption_DisableSaving, 1); 2090 2091 StorageManager.SetSaveTitle(L"Tutorial"); 2092 2093 // Reset the autosave time 2094 app.SetAutosaveTimerTime(); 2095 2096 // not online for the trial game 2097 g_NetworkManager.HostGame(0,false,true,MINECRAFT_NET_MAX_PLAYERS,0); 2098 2099#ifndef _XBOX 2100 g_NetworkManager.FakeLocalPlayerJoined(); 2101#endif 2102 2103 NetworkGameInitData *param = new NetworkGameInitData(); 2104 param->seed = 0; 2105 param->saveData = NULL; 2106 param->settings = app.GetGameHostOption( eGameHostOption_Tutorial ) | app.GetGameHostOption(eGameHostOption_DisableSaving); 2107 2108 vector<LevelGenerationOptions *> *generators = app.getLevelGenerators(); 2109 param->levelGen = generators->at(0); 2110 2111 LoadingInputParams *loadingParams = new LoadingInputParams(); 2112 loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; 2113 loadingParams->lpParam = (LPVOID)param; 2114 2115 UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); 2116 completionData->bShowBackground=TRUE; 2117 completionData->bShowLogo=TRUE; 2118 completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes; 2119 completionData->iPad = ProfileManager.GetPrimaryPad(); 2120 loadingParams->completionData = completionData; 2121 2122 ui.ShowTrialTimer(true); 2123 2124#ifdef _XBOX_ONE 2125 ui.ShowPlayerDisplayname(true); 2126#endif 2127 ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams); 2128} 2129 2130void UIScene_MainMenu::handleUnlockFullVersion() 2131{ 2132 m_buttons[(int)eControl_UnlockOrDLC].setLabel(IDS_DOWNLOADABLECONTENT,true); 2133} 2134 2135 2136#ifdef __PSVITA__ 2137int UIScene_MainMenu::SelectNetworkModeReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) 2138{ 2139 UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; 2140 2141 if(result==C4JStorage::EMessage_ResultAccept) 2142 { 2143 app.DebugPrintf("Setting network mode to PSN\n"); 2144 app.SetGameSettings(0, eGameSetting_PSVita_NetworkModeAdhoc, 0); 2145 } 2146 else if(result==C4JStorage::EMessage_ResultDecline) 2147 { 2148 app.DebugPrintf("Setting network mode to Adhoc\n"); 2149 app.SetGameSettings(0, eGameSetting_PSVita_NetworkModeAdhoc, 1); 2150 } 2151 pClass->updateTooltips(); 2152 return 0; 2153} 2154#endif //__PSVITA__