HRESULT CScnWait::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled ) { switch(pTimer->nId) { case TM_DELETE: if(FileOperationManager::getInstance().isDone()) { // File Operation is complete KillTimer(TM_DELETE); if(waitReboot) Restart(); else NavigateBack(XUSER_INDEX_ANY); bHandled = TRUE; } break; case TM_TIMEOUT: if(RemovePathCallBack::getInstance().getDone()) { // File Operation is complete KillTimer(TM_DELETE); if(waitReboot) Restart(); else NavigateBack(XUSER_INDEX_ANY); bHandled = TRUE; } break; }; return S_OK; }
HRESULT CScnParentKaiSettings::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled ) { if( hObjPressed == m_SettingList ) { m_SettingScenes[currentSelection].SetFocus(); inChild = true; // Child Scn has Focus bHandled = TRUE; } else if ( hObjPressed == m_Back ) { if(inChild) { m_SettingList.SetFocus(XUSER_INDEX_ANY); inChild = false; } else NavigateBack(XUSER_INDEX_ANY); bHandled = TRUE; } else { // Button press not recognized } // Return successfully return S_OK; }
HRESULT CRetroArchSettings::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled ) { int current_index; if ( hObjPressed == m_settingslist) { current_index = m_settingslist.GetCurSel(); switch(current_index) { case SETTING_EMU_REWIND_ENABLED: g_settings.rewind_enable = !g_settings.rewind_enable; m_settingslist.SetText(SETTING_EMU_REWIND_ENABLED, g_settings.rewind_enable ? L"Rewind: ON" : L"Rewind: OFF"); break; case SETTING_GAMMA_CORRECTION_ENABLED: g_console.gamma_correction_enable = !g_console.gamma_correction_enable; m_settingslist.SetText(SETTING_GAMMA_CORRECTION_ENABLED, g_console.gamma_correction_enable ? L"Gamma correction: ON" : L"Gamma correction: OFF"); break; case SETTING_HARDWARE_FILTERING: g_settings.video.smooth = !g_settings.video.smooth; m_settingslist.SetText(SETTING_HARDWARE_FILTERING, set_filter_element(g_settings.video.smooth)); break; } } if ( hObjPressed == m_back ) NavigateBack(app.hMainScene); bHandled = TRUE; return S_OK; }
HRESULT CScnGameControls::ReloadContent() { // Game was deleted off the hard drive, let's remove it from the database if(pContentItem == NULL) return S_FALSE; //Remove Game from current list if(pGameContent != NULL) { GameContentManager::getInstance().DeleteGameFromList(pGameContent); //Set focus up one if last item in list is removed if(listPack.CurrentIndex == (listPack.ListSize - 1)) { GameContentManager::getInstance().m_cGameList->SetCurSel(listPack.CurrentIndex - 1); GameContentManager::getInstance().m_cGameList->RefreshCurrentItem(); } else { GameContentManager::getInstance().m_cGameList->SetCurSel(listPack.CurrentIndex); GameContentManager::getInstance().m_cGameList->RefreshCurrentItem(); } m_Back.SetFocus(XUSER_INDEX_ANY); NavigateBack(XUSER_INDEX_ANY); } // Delete the item from the database ContentManager::getInstance().DeleteItem(pContentItem); return S_OK; }
HRESULT CRetroArchCoreBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled ) { char path[MAX_PATH_LENGTH]; if(hObjPressed == m_romlist) { int index = m_romlist.GetCurSel(); if(browser.cur[index].d_type != FILE_ATTRIBUTE_DIRECTORY) { memset(strbuffer, 0, sizeof(strbuffer)); wcstombs(strbuffer, (const wchar_t *)m_romlist.GetText(index), sizeof(strbuffer)); sprintf(g_console.launch_app_on_exit, "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmp_browser), strbuffer); g_console.return_to_launcher = true; g_console.menu_enable = false; g_console.mode_switch = MODE_EXIT; } else if(tmp_browser.cur[index].d_type == FILE_ATTRIBUTE_DIRECTORY) { memset(strbuffer, 0, sizeof(strbuffer)); wcstombs(strbuffer, (const wchar_t *)m_romlist.GetText(index), sizeof(strbuffer)); snprintf(path, sizeof(path), "%s%s\\", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmp_browser), strbuffer); filebrowser_fetch_directory_entries(path, &tmp_browser, &m_romlist, &m_rompathtitle); } } else if(hObjPressed == m_back) NavigateBack(app.hMainScene); bHandled = TRUE; return S_OK; }
HRESULT CScnGameControls::ReloadContent(CONTENT_ITEM_TAB sTabId) { if(pContentItem == NULL) return S_FALSE; //Change Game Type pContentItem->MoveItem(sTabId); //Remove Game from current list if(pGameContent != NULL) { GameContentManager::getInstance().DeleteGameFromList(pGameContent); if (listPack.CurrentIndex != 0 || listPack.ListSize > 1) { // nothing to set selection to if we are removing the last item //Set focus up one if last item in list is removed if(listPack.CurrentIndex == (listPack.ListSize - 1)) { GameContentManager::getInstance().m_cGameList->SetCurSel(listPack.CurrentIndex - 1); } else { GameContentManager::getInstance().m_cGameList->SetCurSel(listPack.CurrentIndex); } } m_Back.SetFocus(XUSER_INDEX_ANY); NavigateBack(XUSER_INDEX_ANY); } return S_OK; }
HRESULT CScnGameControls::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled ) { switch(pTimer->nId) { case TM_KEYBOARD: if(XHasOverlappedIoCompleted(&xoKeyboard)) { KillTimer(TM_KEYBOARD); bHandled = TRUE; if(xoKeyboard.dwExtendedError == ERROR_SUCCESS) { pGameContent->ContentRef->setTitle(kbBuffer, TRUE); pGameContent->RefreshContentText(); } } break; case TM_DELETE: // Update file progress UpdateFileProgress(); if(FileOperationManager::getInstance().isDone()) { // File Operation is complete KillTimer(TM_DELETE); m_Loading.SetShow(false); ReloadContent(); NavigateBack(XUSER_INDEX_ANY); bHandled = TRUE; } break; }; return S_OK; }
HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled ) { char path[MAX_PATH_LENGTH]; if(hObjPressed == m_romlist) { int index = m_romlist.GetCurSel(); if(browser.cur[index].d_type != FILE_ATTRIBUTE_DIRECTORY) { struct retro_system_info info; retro_get_system_info(&info); bool block_zip_extract = info.block_extract; memset(strbuffer, 0, sizeof(strbuffer)); wcstombs(strbuffer, (const wchar_t *)m_romlist.GetText(index), sizeof(strbuffer)); if((strstr(strbuffer, ".zip") || strstr(strbuffer, ".ZIP")) && !block_zip_extract) { char path_tmp[1024]; sprintf(path_tmp, "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), strbuffer); rarch_extract_zipfile(path_tmp); } else { memset(g_console.rom_path, 0, sizeof(g_console.rom_path)); sprintf(g_console.rom_path, "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), strbuffer); return_to_game(); g_console.initialize_rarch_enable = 1; } } else if(browser.cur[index].d_type == FILE_ATTRIBUTE_DIRECTORY) { memset(strbuffer, 0, sizeof(strbuffer)); wcstombs(strbuffer, (const wchar_t *)m_romlist.GetText(index), sizeof(strbuffer)); snprintf(path, sizeof(path), "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), strbuffer); filebrowser_fetch_directory_entries(path, &browser, &m_romlist, &m_rompathtitle); } } else if (hObjPressed == m_dir_game) { filebrowser_new(&browser, g_console.default_rom_startup_dir, rarch_console_get_rom_ext()); filebrowser_fetch_directory_entries(g_console.default_rom_startup_dir, &browser, &m_romlist, &m_rompathtitle); } else if (hObjPressed == m_dir_cache) { filebrowser_new(&browser, "cache:", rarch_console_get_rom_ext()); filebrowser_fetch_directory_entries("cache:", &browser, &m_romlist, &m_rompathtitle); } else if(hObjPressed == m_back) NavigateBack(app.hMainScene); bHandled = TRUE; return S_OK; }
HRESULT CRetroArchQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled ) { int current_index; if ( hObjPressed == m_quickmenulist) { current_index = m_quickmenulist.GetCurSel(); switch(current_index) { case MENU_ITEM_LOAD_STATE: if (g_console.emulator_initialized) { rarch_load_state(); return_to_game(); } break; case MENU_ITEM_SAVE_STATE: if (g_console.emulator_initialized) { rarch_save_state(); return_to_game(); } break; case MENU_ITEM_HARDWARE_FILTERING: g_settings.video.smooth = !g_settings.video.smooth; m_quickmenulist.SetText(MENU_ITEM_HARDWARE_FILTERING, set_filter_element(g_settings.video.smooth)); break; case MENU_ITEM_KEEP_ASPECT_RATIO: { if(g_console.aspect_ratio_index < ASPECT_RATIO_END) g_console.aspect_ratio_index++; else g_console.aspect_ratio_index = 0; video_xdk360.set_aspect_ratio(NULL, g_console.aspect_ratio_index); char aspectratio_label[32]; sprintf(aspectratio_label, "Aspect Ratio: %s", aspectratio_lut[g_console.aspect_ratio_index].name); unsigned long dwNum = MultiByteToWideChar(CP_ACP, 0, aspectratio_label, -1, NULL, 0); wchar_t * aspectratio_label_w = new wchar_t[dwNum]; MultiByteToWideChar(CP_ACP, 0, aspectratio_label, -1, aspectratio_label_w, dwNum); m_quickmenulist.SetText(MENU_ITEM_KEEP_ASPECT_RATIO, aspectratio_label_w); delete[] aspectratio_label_w; } break; case MENU_ITEM_OVERSCAN_AMOUNT: break; case MENU_ITEM_ORIENTATION: switch(g_console.screen_orientation) { case ORIENTATION_NORMAL: g_console.screen_orientation = ORIENTATION_VERTICAL; m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, L"Orientation: Vertical"); break; case ORIENTATION_VERTICAL: g_console.screen_orientation = ORIENTATION_FLIPPED; m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, L"Orientation: Flipped"); break; case ORIENTATION_FLIPPED: g_console.screen_orientation = ORIENTATION_FLIPPED_ROTATED; m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, L"Orientation: Flipped Rotated"); break; case ORIENTATION_FLIPPED_ROTATED: g_console.screen_orientation = ORIENTATION_NORMAL; m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, L"Orientation: Normal"); break; } video_xdk360.set_rotation(NULL, g_console.screen_orientation); break; case MENU_ITEM_RESIZE_MODE: break; case MENU_ITEM_FRAME_ADVANCE: if (g_console.emulator_initialized) { g_console.frame_advance_enable = true; g_console.menu_enable = false; g_console.mode_switch = MODE_EMULATION; } break; case MENU_ITEM_SCREENSHOT_MODE: break; case MENU_ITEM_RESET: if (g_console.emulator_initialized) { return_to_game(); rarch_game_reset(); } break; case MENU_ITEM_RETURN_TO_GAME: if (g_console.emulator_initialized) return_to_game(); break; case MENU_ITEM_RETURN_TO_DASHBOARD: return_to_dashboard(); break; } } if ( hObjPressed == m_back ) NavigateBack(app.hMainScene); bHandled = TRUE; return S_OK; }
//---------------------------------------------------------------------------------- // Handler for the button press message. //---------------------------------------------------------------------------------- HRESULT CScnGameControls::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled ) { if(hObjPressed == m_GameScreenshots) { // Launch the Game Screenshots Scene SkinManager::getInstance().setScene("screenshots.xur", *this, false); bHandled = true; } else if (hObjPressed == m_GameSaves) { // Launch the Game Saves Scene SkinManager::getInstance().setScene("savedgames.xur", *this, false); bHandled = true; } else if (hObjPressed == m_ManageTUs) { // Launch the Title Update Manager Scene SkinManager::getInstance().setScene("TitleUpdateManager.xur", *this, false); bHandled = true; } else if (hObjPressed == m_Achievements) { // Launch the Achievements Scene SkinManager::getInstance().setScene("Achievements.xur", *this, false); bHandled = true; } else if (hObjPressed == m_ManageTrainers) { // Launch the Trainers Scene if(PluginLoader::getInstance().IsLoaded() == TRUE) { SkinManager::getInstance().setScene("Trainers.xur", this->m_hObj, false, "Trainers", NULL); }else { XNotifyQueueUICustom(L"This feature requires that you run the FSDPlugin."); } bHandled = true; } else if (hObjPressed == m_RenameGame) { // Initiate the Rename Process memset(&xoKeyboard, 0, sizeof(xoKeyboard)); LPCWSTR szGameTitle = listPack.CurrentGame->Content.m_szTitle; // Launch Keyboard Scene to rename game XShowKeyboardUI(0, VKBD_DEFAULT, szGameTitle, szRenameCaption, szRenameDescription, kbBuffer, 200, &xoKeyboard); SetTimer(TM_KEYBOARD, 50); bHandled = true; } else if (hObjPressed == m_DeleteGame) { // Laucnh a Message Box for Game Deletion // string szGameTitle = wstrtostr(listPack.CurrentGame->Content.m_szTitle); // szTempString = sprintfaW(szDeleteDescription, szGameTitle.c_str()); nMsgType = 1; if (listPack.CurrentGame->ContentRef->GetFileType() == CONTENT_FILE_TYPE_CONTAINER) szTempStringPath = strtowstr(listPack.CurrentGame->ContentRef->getRoot()) + strtowstr(listPack.CurrentGame->ContentRef->getPath()); else szTempStringPath = strtowstr(listPack.CurrentGame->ContentRef->getRoot()) + strtowstr(listPack.CurrentGame->ContentRef->getDirectory()); szTempString = sprintfaW(szDeleteDescription, listPack.CurrentGame->Content.m_szTitle, szTempStringPath.c_str()); ShowMessageBoxEx(L"XuiMessageBox2", CFreestyleUIApp::getInstance().GetRootObj(), szDeleteCaption, szTempString.c_str(), 2, szBtnOk, 1, NULL, NULL); bHandled = true; } else if (hObjPressed == m_MoveGame) { if(bIsNested) { m_GameControls.FindNamedFrame(L"MoveGame", &nFrameStart); m_GameControls.FindNamedFrame(L"EndMoveGame", &nFrameEnd); m_GameControls.PlayTimeline(nFrameStart, nFrameStart, nFrameEnd, false, false); } else { this->FindNamedFrame(L"MoveGame", &nFrameStart); this->FindNamedFrame(L"EndMoveGame", &nFrameEnd); this->PlayTimeline(nFrameStart, nFrameStart, nFrameEnd, false, false); } m_MoveXbox360.SetFocus(XUSER_INDEX_ANY); bBackToMain = true; m_Back.SetText(L"Cancel"); bHandled = true; } else if (hObjPressed == m_Back) { if(bBackToMain) { if(bIsNested) { m_GameControls.FindNamedFrame(L"BackToMain", &nFrameStart); m_GameControls.FindNamedFrame(L"EndBackToMain", &nFrameEnd); m_GameControls.PlayTimeline( nFrameStart, nFrameStart, nFrameEnd, false, false); } else { this->FindNamedFrame(L"BackToMain", &nFrameStart); this->FindNamedFrame(L"EndBackToMain", &nFrameEnd); this->PlayTimeline( nFrameStart, nFrameStart, nFrameEnd, false, false); } m_GameScreenshots.SetFocus(XUSER_INDEX_ANY); bBackToMain = false; m_Back.SetText(L"Back"); } else { NavigateBack(XUSER_INDEX_ANY); } bHandled = true; }else if (hObjPressed == m_DownloadGame) { // Start downloading of assets to refresh if(CFreestyleApp::getInstance().hasInternetConnection() == false) { XNotifyQueueUICustom(L"No network connection detected."); } else { pContentItem->RefreshAssets(); } bHandled = true; // Handle all the Content Moves } else if (hObjPressed == m_MoveXbox360) { ReloadContent(CONTENT_360); bHandled = true; } else if (hObjPressed == m_MoveXBLA) { ReloadContent(CONTENT_XBLA); bHandled = true; } else if (hObjPressed == m_MoveHomebrew) { ReloadContent(CONTENT_HOMEBREW); bHandled = true; } else if (hObjPressed == m_MoveXbox1) { ReloadContent(CONTENT_XBOX1); bHandled = true; } else if (hObjPressed == m_MoveEmulators) { ReloadContent(CONTENT_EMULATOR); bHandled = true; }else if (hObjPressed == m_MoveNoSection) { nMsgType = 2; if (listPack.CurrentGame->ContentRef->GetFileType() == CONTENT_FILE_TYPE_CONTAINER) szTempStringPath = strtowstr(listPack.CurrentGame->ContentRef->getRoot()) + strtowstr(listPack.CurrentGame->ContentRef->getPath()); else szTempStringPath = strtowstr(listPack.CurrentGame->ContentRef->getRoot()) + strtowstr(listPack.CurrentGame->ContentRef->getDirectory()); szTempString = sprintfaW(szRemoveDescription, listPack.CurrentGame->Content.m_szTitle, szTempStringPath.c_str() ); ShowMessageBoxEx(L"XuiMessageBox2", CFreestyleUIApp::getInstance().GetRootObj(), szRemoveCaption, szTempString.c_str(), 2, szBtnOk, 1, NULL, NULL); bHandled = true; } return S_OK; }