void PortLockManager::ConnectNunchukCallback( Framework::Controller_ID pad ) { // this gets called initially when the game first runs because the nunchuk is connected. // of course, when this occurs, we shouldn't hid anything because the state hasn't been appropriately set yet. // In this case, the state is not STATE_WAIT_NUNCHUK_DIALOG and the contents of the if statement should be ignored. if(!mPopupStack.Empty()) { // the nunchuk was reconnected. First see if the top layer is displaying the message // about removing the nunchuk. This can be determined if the current state is // STATE_WAIT_NUNCHUK_DIALOG if(mPopupState == STATE_WAIT_NUNCHUK_DIALOG || mPopupState == STATE_START_NUNCHUK_DIALOG) { UI::UIPopupInfo* popupInfo = mPopupStack[ mPopupStack.Height() - 1].popupInfo; popupInfo->SetIgnoreInput( false ); // Victor Chelaru EA Salt Lake 12/14/2006 // Calling HideTopLayer eventually calls the // popup's HideTopPlayer function in the Actionscript. // This is the equivalent of pressing the button when the // popup that indicates that the controller is disconnected // is on the screen. The rest of the cleanup will pop the stack // and delete the UIPopupInfo in the popupInfo->HideTopLayer(); } // Although the top message may not be about the nunchuk, one of the other // popup layers might be displaying a message about the nunchuk being disconnected. // Search through those layers, test the state, and if the state is STATE_WAIT_NUNCHUK_DIALOG. // If so, mark the popup as not still valid and exit the loop. else { // backwards loop to grab the top item for(int i = mPopupStack.Height() - 2; i > -1; i--) { if(mPopupStack[i].state == STATE_WAIT_NUNCHUK_DIALOG) { mPopupStillValid[i] = false; break; } } } } }