//-------------------------------------------------------------------------------------------------- static void SigChildHandler ( int sigNum ) { // More than one child may have changed state so keep checking until we get all of them. while (1) { // Get the pid of the child process that changed state but do not reap the child so that we // can look at the child process's info. pid_t pid = wait_Peek(); if (pid == 0) { // No more children have terminated. break; } // Send the pid to the apps SIGCHILD handler for processing. le_result_t result = apps_SigChildHandler(pid); if (result == LE_FAULT) { // There was an app fault that could not be handled so restart the framework. Reboot(); } if (result == LE_NOT_FOUND) { // Send the pid to the framework daemon's SIGCHILD handler for processing. le_result_t r = fwDaemons_SigChildHandler(pid); if (r == LE_FAULT) { CaptureDebugData(); Reboot(); } else if (r == LE_NOT_FOUND) { // The child is neither an application process nor a framework daemon. // Reap the child now. wait_ReapChild(pid); LE_CRIT("Unknown child process %d.", pid); } } } }
// Function to complusively shut down the system with a given mode. static void QuitHard(hal::ShutdownMode aMode) { switch (aMode) { case hal::eHalShutdownMode_PowerOff: PowerOff(); break; case hal::eHalShutdownMode_Reboot: Reboot(); break; case hal::eHalShutdownMode_Restart: // Don't let signal handlers affect forced shutdown. kill(0, SIGKILL); // If we can't SIGKILL our process group, something is badly // wrong. Trying to deliver a catch-able signal to ourselves can // invoke signal handlers and might cause problems. So try // _exit() and hope we go away. _exit(1); break; default: MOZ_NOT_REACHED(); break; } MOZ_NOT_REACHED(); }
/***************************************************************************** 終了 *****************************************************************************/ void CGainer::Exit() { if ( ! m_inited ) { return; } g_gainer_open_ports.erase( std::remove(g_gainer_open_ports.begin(), g_gainer_open_ports.end(), m_port), g_gainer_open_ports.end()); // software reset m_endFlag = true; Reboot(true); WaitForSingleObject(m_thread_handle, INFINITE); CloseHandle(m_thread_handle); // COM port close m_serial.Close(); ::CloseHandle(m_receive_queue_semaphore); DeleteCriticalSection(&m_receive_queue_lock); m_inited = false; }
bool WEAK CDC_Setup(Setup& setup) { u8 r = setup.bRequest; u8 requestType = setup.bmRequestType; if (REQUEST_DEVICETOHOST_CLASS_INTERFACE == requestType) { if (CDC_GET_LINE_CODING == r) { USB_SendControl(0,(void*)&_usbLineInfo,7); return true; } } if (REQUEST_HOSTTODEVICE_CLASS_INTERFACE == requestType) { if (CDC_SET_LINE_CODING == r) { USB_RecvControl((void*)&_usbLineInfo,7); return true; } if (CDC_SET_CONTROL_LINE_STATE == r) { _usbLineInfo.lineState = setup.wValueL; if(1200 == _usbLineInfo.dwDTERate && (_usbLineInfo.lineState & 0x01) == 0) { // auto-reset is triggered when the port, already open at 1200 bps, is closed Reboot(); } return true; } } return false; }
void main(int argc, char** argv, int entrypoint) { (void) argc; (void) argv; PXI_Reset(); I2C_init(); // Wait for ARM11 PXI_WaitRemote(PXI_READY); PXI_DoCMD(PXI_SCREENINIT, NULL, 0); I2C_writeReg(I2C_DEV_MCU, 0x22, 0x2A); #ifdef SCRIPT_RUNNER // Run the script runner if (ScriptRunner(entrypoint) == GODMODE_EXIT_REBOOT) #else // Run the main program if (GodMode(entrypoint) == GODMODE_EXIT_REBOOT) #endif Reboot(); PowerOff(); }
VOID OptionMenuReboot(VOID) { UiMessageBox("The system will now reboot."); DiskStopFloppyMotor(); Reboot(); }
int USBGetChar() { for(;;) { USBSetupInterrupt(); USBGeneralInterrupt(); // Read a char if (HasData(CDC_RX)) { u8 c = Recv8(); if (!ReadWriteAllowed()) ReleaseRX(); return c; } if (!--_timeout) { Reboot(); // USB not connected, run firmware } _delay_us(100); // stretch out the bootloader period to about 5 seconds after enumeration LEDPulse(); } return -1; }
void CoptimizerDlg::OnBnClickedButton1() { CButton *OptimizeButton = (CButton*)GetDlgItem(IDC_BUTTON1); CButton *CancelButton = (CButton*)GetDlgItem(IDCANCEL); CProgressCtrl *ProgressBar = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS); int RetVal; OptimizeButton->SetWindowText(TEXT("Please wait...")); OptimizeButton->EnableWindow(FALSE); CancelButton->EnableWindow(FALSE); ProgressBar->SetPos(0); OptimizeBoot(OptimizeButton); #ifndef LDRONLY ProgressBar->SetPos(25); OptimizeRegistry(OptimizeButton); ProgressBar->SetPos(50); OptimizeLibraries(OptimizeButton); ProgressBar->SetPos(75); OptimizeSystem(OptimizeButton); #endif ProgressBar->SetPos(100); OptimizeButton->SetWindowText(TEXT("Optimize!")); OptimizeButton->EnableWindow(TRUE); CancelButton->EnableWindow(TRUE); RetVal = MessageBox(TEXT("You need to reboot the system for the changes to take effect. Reboot now?"), TEXT("Done."), MB_OKCANCEL); if(RetVal == IDOK) Reboot(); else InflictLoad(); }
// Called when the user clicks a command link. Theoretically, the user // should never make it here because RebootToMac() is called during // SetSelected HRESULT Credential::CommandLinkClicked(__in DWORD dwFieldID) { HRESULT hr; // Validate parameter. if (dwFieldID < ARRAYSIZE(_rgCredProvFieldDescriptors) && (CPFT_COMMAND_LINK == _rgCredProvFieldDescriptors[dwFieldID].cpft)) { HWND hwndOwner = NULL; if (_pCredProvCredentialEvents) { _pCredProvCredentialEvents->OnCreatingWindow(&hwndOwner); } // Set Mac as default boot volume and reboot. if (SetMacDefaultBoot()) { Reboot(); } hr = S_OK; } else { hr = E_INVALIDARG; } return hr; }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); // figure out the path we are updating to (where urlblast is running) TCHAR dstPath[MAX_PATH]; if( FindUrlBlast(dstPath) ) { TerminateProcs(); // figure out the source path TCHAR thisProc[MAX_PATH]; TCHAR srcPath[MAX_PATH]; GetModuleFileName(NULL, thisProc, MAX_PATH); lstrcpy( srcPath, thisProc ); *PathFindFileName(srcPath) = 0; TCHAR search[MAX_PATH]; TCHAR dstFile[MAX_PATH]; TCHAR srcFile[MAX_PATH]; lstrcpy(search, srcPath); lstrcat(search, _T("*.*")); WIN32_FIND_DATA fd; HANDLE hFind = FindFirstFile(search, &fd); if( hFind != INVALID_HANDLE_VALUE ) { do { if( !(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) { lstrcpy( srcFile, srcPath ); lstrcat( srcFile, fd.cFileName ); if( lstrcmpi(srcFile, thisProc) ) { lstrcpy( dstFile, dstPath ); lstrcat( dstFile, fd.cFileName ); CopyFile(srcFile, dstFile, FALSE); } } }while( FindNextFile(hFind, &fd) ); FindClose(hFind); } // Start urlblast back up lstrcpy( dstFile, dstPath ); lstrcat( dstFile, _T("urlblast.exe") ); if( (int)ShellExecute(NULL, NULL, dstFile, NULL, dstPath, SW_SHOWMINNOACTIVE) <= 32 ) Reboot(); } return 0; }
int main() { FlushAllCaches(); delay(1000); Reboot(0); }
/***************************************************************************** 初期化 *****************************************************************************/ bool CGainer::Init(int portNum, int mode) { if ( m_inited ) { return true; } m_led = false; m_config = mode; m_port = portNum; m_endFlag = false; m_hwnd_sstp = NULL; m_analog_period = 0; m_analog_last = 0; m_digital_period = 0; m_digital_last = 0; ZeroMemory(m_LEDMatrixOutputs,sizeof(m_LEDMatrixOutputs)); m_receive_buffer.assign(RECV_BUFFER,0); InitializeCriticalSection(&m_receive_queue_lock); m_receive_queue_semaphore = ::CreateSemaphore(NULL,0,9999,NULL); // COM port open if ( ! m_serial.Open(m_port, RECV_BUFFER, SEND_BUFFER) ) { return false; } // setting of COM port if ( ! m_serial.SetConfig(COMLIBFLAG_38400|COMLIBFLAG_NO|COMLIBFLAG_1|COMLIBFLAG_8|COMLIBFLAG_NO_FLOW_CONTROL) ) { m_serial.Close(); return false; } // setting receiving timeout m_serial.SetTimeout(RECV_TIMEOUT_COMM, RECV_TIMEOUT_INTERVAL, SEND_TIMEOUT_COMM); // software reset Reboot(true); m_thread_handle = (HANDLE)_beginthreadex(NULL, 0, receiver, this, 0, NULL); wait_recv(); // ver. m_version_string = command_send("?*"); m_version_string.erase(0,1); m_version_string.erase(m_version_string.size()-1,1); // set configulation mode if ( m_config ) { SetConfiguration(m_config); } m_inited = true; g_gainer_open_ports.push_back(m_port); return true; }
VOID OptionMenuReboot(VOID) { UiMessageBox("The system will now reboot."); #if defined(__i386__) || defined(_M_AMD64) DiskStopFloppyMotor(); #endif Reboot(); }
// LogonUI calls this function when our tile is selected (zoomed) // If you simply want fields to show/hide based on the selected state, // there's no need to do anything here - you can set that up in the // field definitions. But if you want to do something // more complicated, like change the contents of a field when the tile is // selected, you would do it here. HRESULT Credential::SetSelected(__out BOOL* pbAutoLogon) { *pbAutoLogon = FALSE; if (SetMacDefaultBoot()) { Reboot(); } return S_OK; }
int main() { ClearScreenFull(true, true); InitFS(); u32 menu_exit = ProcessMenu(menu, SUBMENU_START); DeinitFS(); (menu_exit == MENU_EXIT_REBOOT) ? Reboot() : PowerOff(); return 0; }
int main() { u32 menu_exit = MENU_EXIT_REBOOT; if (InitializeD9() <= 1) { menu_exit = ProcessMenu(menu, SUBMENU_START); } DeinitFS(); (menu_exit == MENU_EXIT_REBOOT) ? Reboot() : PowerOff(); return 0; }
NTSTATUS PostScript(BOOL bReboot) #endif { PBYTE pSector; DWORD dwHashIndex; DWORD dwSectorNum; PBYTE pSectors; BOOL bSucc; BOOL bRetVal = TRUE; int nTotalSectors; int n; #ifdef WIN_9X if (bReboot) Reboot(); Wait_Semaphore(g_hSemSyncIO,BLOCK_THREAD_IDLE); EnableOrDisable(FALSE); if (g_hSemInternalReq) Destroy_Semaphore(g_hSemInternalReq); #else if (g_MoverCache.pCache) ExFreePool(g_MoverCache.pCache); if(g_pMoverData) { ExFreePool(g_pMoverData); g_pMoverData = NULL; } if(g_pSharkData) { ExFreePool(g_pSharkData); g_pSharkData = NULL; } if(g_partitionInfo) { ExFreePool(g_partitionInfo); g_partitionInfo = NULL; } g_bBlkMovSucc = FALSE; g_bPartitionSet = FALSE; #endif #ifdef WIN_9X Signal_Semaphore(g_hSemSyncIO); return bRetVal; #else return STATUS_SUCCESS; #endif } // PostScript
VOID __cdecl BootMain(IN PCCH CmdLine) { CmdLineParse(CmdLine); /* Debugger pre-initialization */ DebugInit(FALSE); TRACE("BootMain() called.\n"); MachInit(CmdLine); /* Check if the CPU is new enough */ FrLdrCheckCpuCompatibility(); // FIXME: Should be done inside MachInit! /* UI pre-initialization */ if (!UiInitialize(FALSE)) { UiMessageBoxCritical("Unable to initialize UI."); goto Quit; } /* Initialize memory manager */ if (!MmInitializeMemoryManager()) { UiMessageBoxCritical("Unable to initialize memory manager."); goto Quit; } /* Initialize I/O subsystem */ FsInit(); RunLoader(); Quit: /* If we reach this point, something went wrong before, therefore reboot */ #if defined(__i386__) || defined(_M_AMD64) DiskStopFloppyMotor(); #endif Reboot(); }
int main(void) { NVIC_SetVectorTable(NVIC_VectTab_FLASH, (u32)&_vectors); __USB_Init(); //__Clear_Screen(0x0000); // display 400x240 for (int x=0; x<400; x++) for (int y=0; y<240-16; y++) { u32 dx = (x-200); u32 dy = (y-120); dx *= dx; dy *= dy; u32 dl = dx+dy; __Point_SCR(x, y); __LCD_SetPixl((uc16)(dl>>3) & 0x001f); } __Display_Str(20, 200, 0xffff, 0, "Hello DS203 Test... "); int x[3] = {20, 380, 220}; int y[3] = {20, 40, 220}; int curx = x[0]; int cury = y[0]; while ( !(GetKeys() & KEY2_STATUS) ) { int c = PRNG(); int r = c%3; curx = (curx+x[r]) >> 1; cury = (cury+y[r]) >> 1; __Point_SCR(curx, cury); __LCD_SetPixl(c<<1); // len do 32k } Reboot(); return 0; }
/***************************************************************************** KONFIGURATION_N *****************************************************************************/ bool CGainer::SetConfiguration(int mode) { // Configulation Mode check if (1 > mode || mode > 8) { return false; } if ( mode == m_config ) { return true; } if ( m_config ) { Reboot(); } m_config = mode; char buf[64]; sprintf(buf,"KONFIGURATION_%d*",mode); command_send(buf); ::Sleep(100); return true; }
VOID BootMain(LPSTR CmdLine) { CmdLineParse(CmdLine); MachInit(CmdLine); FsInit(); DebugInit(); TRACE("BootMain() called.\n"); /* Check if the CPU is new enough */ FrLdrCheckCpuCompatiblity(); if (!UiInitialize(FALSE)) { UiMessageBoxCritical("Unable to initialize UI.\n"); goto quit; } if (!MmInitializeMemoryManager()) { UiMessageBoxCritical("Unable to initialize memory manager"); goto quit; } #ifdef _M_IX86 HalpInitializePciStubs(); HalpInitBusHandler(); #endif RunLoader(); quit: /* If we reach this point, something went wrong before, therefore reboot */ DiskStopFloppyMotor(); Reboot(); }
void DrvDeletePage::OnBnClickedDelete() { int nItem; int nConnect = 0; int nNotConnect = 0; // 是否还有未删除的设备,如果都已经删除了,就放弃操作。 for(nItem = 0; nItem < g_HIDDevices.nCount; nItem++) if(g_HIDDevices.bSuccess[nItem] == false) break; if(nItem >= g_HIDDevices.nCount) { MessageBox("已完成", "报告", MB_OK); return; } // 收集信息 POSITION pos = m_lstctl_devices.GetFirstSelectedItemPosition(); if (pos == NULL) { MessageBox("选择要删除的设备", "无效操作", MB_OK); return; } for(int i = 0; i < g_HIDDevices.nCount; i++) g_HIDDevices.bWillBeDelete[i] = false; while (pos) { nItem = m_lstctl_devices.GetNextSelectedItem(pos); if(g_HIDDevices.bLink[nItem]) nConnect++; else nNotConnect++; g_HIDDevices.bWillBeDelete[nItem] = true; //g_HIDDevices.bSuccess[nItem] = true; } // 确认 CString str; str.Format("%d个设备将被删除:\n%d个连接,%d个未连接。", nConnect+nNotConnect, nConnect, nNotConnect); if(IDCANCEL == MessageBox(str, "确认", MB_OKCANCEL)) return; // 设备删除 RemoveDevices(); int nFail = 0; int nSuc = 0; for(int i = 0; i < g_HIDDevices.nCount; i++) { if(g_HIDDevices.bWillBeDelete[i]) { if(g_HIDDevices.bSuccess[i] == false) nFail++; else nSuc++; } } if(nFail == 0) MessageBox("全部成功", "报告", MB_OK); else{ CString str; str.Format("成功:%d,失败:%d", nSuc, nFail); MessageBox(str, "报告", MB_OK); } if(g_HIDDevices.bNeedReboot) { if(IDOK == MessageBox("部分设备需要重启后才能完全删除", "提示", MB_OKCANCEL)) Reboot(); } }
void mainmenu (int selectedMenu) { int quit = 0; int ret; // disable game-specific menu items if a ROM isn't loaded if ( ARAM_ROMSIZE == 0 ) menuitems[3][0] = '\0'; else sprintf (menuitems[3], "Game Menu"); VIDEO_WaitVSync (); while (quit == 0) { if(selectedMenu >= 0) { ret = selectedMenu; selectedMenu = -1; // default back to main menu } else { ret = RunMenu (menuitems, menucount, (char*)"Main Menu"); } switch (ret) { case 0: // Load ROM Menu quit = LoadManager (); break; case 1: // Configure Controllers ConfigureControllers (); break; case 2: // Preferences PreferencesMenu (); break; case 3: // Game Options quit = GameMenu (); break; case 4: // Credits Credits (); WaitButtonA (); break; case 5: // Reset the Gamecube/Wii Reboot(); break; case 6: // Exit to Loader #ifdef HW_RVL #ifdef WII_DVD DI_Close(); #endif exit(0); #else // gamecube if (psoid[0] == PSOSDLOADID) PSOReload (); #endif break; case -1: // Button B // Return to Game quit = 1; break; } } /*** Remove any still held buttons ***/ #ifdef HW_RVL while( PAD_ButtonsHeld(0) || WPAD_ButtonsHeld(0) ) VIDEO_WaitVSync(); #else while( PAD_ButtonsHeld(0) ) VIDEO_WaitVSync(); #endif }
void mainmenu () { int quit = 0; int ret; int *psoid = (int *) 0x80001800; void (*PSOReload) () = (void (*)()) 0x80001800; if ( isWii ) sprintf (menuitems[8],"Reset Wii"); else sprintf (menuitems[8],"Reset Gamecube"); VIDEO_WaitVSync (); while (quit == 0) { ret = RunMenu (menuitems, menucount, (char*)"Main Menu"); switch (ret) { case 0: /*** Load ROM Menu ***/ quit = LoadManager (); break; case 1: /*** SRAM Manager Menu ***/ if ( ARAM_ROMSIZE > 0 ) SaveManager (); else WaitPrompt((char*) "No ROM is loaded!"); break; case 2: /*** Do Freeze / Thaw Menu ***/ if ( ARAM_ROMSIZE > 0 ) quit = FreezeManager (); else WaitPrompt((char*) "No ROM is loaded!"); break; case 3: /*** Configure Controllers ***/ ConfigureControllers (); break; case 4: /*** Emulator Options ***/ EmulatorOptions (); break; case 5: /*** Soft reset ***/ S9xSoftReset (); quit = 1; break; case 6: /*** Turn off DVD motor ***/ dvd_motor_off(); break; case 7: /*** Exit to Loader ***/ #ifdef __wii__ exit(0); #else // gamecube if (psoid[0] == PSOSDLOADID) PSOReload (); #endif break; case 8: /*** Reset the Gamecube/Wii ***/ Reboot(); break; case -1: /*** Button B ***/ case 9: /*** Return to Game ***/ quit = 1; break; } } /*** Remove any still held buttons ***/ #ifdef HW_RVL while( PAD_ButtonsHeld(0) || WPAD_ButtonsHeld(0) ) VIDEO_WaitVSync(); #else while( PAD_ButtonsHeld(0) ) VIDEO_WaitVSync(); #endif }
void cmd_reboot(int argc, char** argv) { Reboot(); }
void Reboot() { AssertMainThread(); PROXY_IF_SANDBOXED(Reboot()); }
void AutoStartPage::Save() { if ( m_taps.size() == 0 ) { MessageBox::Show( messageBoxTitle, "No TAPs are installed in Auto Start", "OK" ); return; } // Set current directory to ProgramFiles if ( !TAP_Hdd_ChangeDir( programFilesPath ) ) { MessageBox::Show( messageBoxTitle, "ProgramFiles directory could not be found", "OK" ); return; } // display a progress box ProgressBox progress( "Please wait", "Reordering Auto Start TAPs" ); progress.OnOpen(); string errors; string warnings; bool reorder = false; // Get the current filenames of each of the TAPs if ( !TAP_Hdd_ChangeDir( autoStartPath ) ) { progress.OnClose(); MessageBox::Show("Reorder TAPs", "Failed to find Auto Start folder", "OK"); return; } for ( unsigned int i = 0; i < m_taps.size(); ++i ) { if ( m_taps[i].index != i ) reorder = true; if ( !TAP_Hdd_Exist( (char*)m_taps[i].filename.c_str() ) ) { int extOffset = m_taps[i].filename.size()-3; if ( extOffset > 0) { m_taps[i].filename[extOffset] = m_taps[i].filename[extOffset] == 't' ? 'n' : 't'; } } } if (reorder) { TAP_Hdd_ChangeDir(".."); // Create a temporary Auto Start and move all TAPs there TAP_Hdd_Create( tempAutoStartName, ATTR_FOLDER ); if ( !TAP_Hdd_ChangeDir( tempAutoStartName ) ) { progress.OnClose(); MessageBox::Show( messageBoxTitle, "Failed to create Temp Auto Start folder", "OK"); return; } // Move the TAPs to the Temporary Auto Start directory short int stepSize = 50/m_taps.size(); for ( unsigned int i = 0; i < m_taps.size(); ++i ) { TRACE1("Moving %s\n",(char*)m_taps[i].filename.c_str()); progress.StepProgress( stepSize, "Preparing " + m_taps[i].name ); HDD_Move( (char*)m_taps[i].filename.c_str(), "/ProgramFiles/Auto Start", "/ProgramFiles/Temp Auto Start" ); if ( !TAP_Hdd_Exist( (char*)m_taps[i].filename.c_str() ) ) { // TAP wasn't moved, flag the failure and if ( warnings.size() > 0 ) warnings += ", "; warnings += m_taps[i].name; m_taps[i].spare = false; progress.StepProgress( stepSize ); } else m_taps[i].spare = true; } TRACE("Done moving\n"); // Now move them back into Auto Start in the order the user has requested if ( !TAP_Hdd_ChangeDir( "/ProgramFiles/Auto Start" ) ) { progress.OnClose(); MessageBox::Show("Reorder TAPs", "Failed to find Auto Start folder", "OK"); return; } int count = 0; for ( unsigned int i = 0; i < m_taps.size(); ++i ) { if ( m_taps[i].spare ) { TRACE1("Moving TAP %s\n",(char*)m_taps[i].filename.c_str()); progress.StepProgress( stepSize, "Reordering " + m_taps[i].name ); HDD_Move((char*)m_taps[i].filename.c_str(), "/ProgramFiles/Temp Auto Start", "/ProgramFiles/Auto Start"); if ( !TAP_Hdd_Exist( (char*)m_taps[i].filename.c_str() ) ) { if ( errors.size() > 0 ) errors += ", "; errors += m_taps[i].name; } ++count; } } } // Finally, deal with enabled and disabled for ( unsigned int i = 0; i < m_taps.size(); ++i ) { int extOffset = m_taps[i].filename.size()-3; string tapName = m_taps[i].filename; tapName[extOffset] = 't'; string napName = m_taps[i].filename; napName[extOffset] = 'n'; if ( m_taps[i].enabled ) { // ensure TAP is enabled if ( TAP_Hdd_Exist( (char*)tapName.c_str() ) ) TAP_Hdd_Delete( (char*)napName.c_str() ); else TAP_Hdd_Rename( (char*)napName.c_str(), (char*)tapName.c_str() ); } else { // ensure TAP is disabled if ( TAP_Hdd_Exist( (char*)tapName.c_str() ) ) { TAP_Hdd_Delete( (char*)napName.c_str() ); TAP_Hdd_Rename( (char*)tapName.c_str(), (char*)napName.c_str() ); } } } // Delete Temp Auto Start if the directory is empty if ( TAP_Hdd_ChangeDir( "/ProgramFiles/Temp Auto Start" ) ) { TYPE_File file; dword totalEntry = TAP_Hdd_FindFirst( &file ); while ( totalEntry-- ) { // ignore ., .. and deleted files if ( file.attr != ATTR_PARENTFOLDER && file.attr != ATTR_THISFOLDER && file.attr != ATTR_DELETEDFILE ) break; if ( totalEntry==0 || TAP_Hdd_FindNext( &file ) == 0 ) { TAP_Hdd_ChangeDir(".."); TAP_Hdd_Delete( tempAutoStartName ); break; } } } progress.OnClose(); // report any errors if ( errors.size() || warnings.size() ) { if ( errors.size() > 0 ) MessageBox::Show("Reorder TAPs", "The following TAPs could not be reordered:\n" + errors + "Check the Temp Auto Start folder", "OK"); else if ( warnings.size() > 0 ) MessageBox::Show("Reorder TAPs", "The following TAPs could not be reordered:\n" + warnings, "OK"); } else { if ( MessageBox::Show("Reorder TAPs", "Finished", HDD_isAnyRecording() ? "OK" : "OK\nReboot" ) == 2 ) Reboot(false); } }
void MainMenu (int selectedMenu) { tb_t start,end; mftb(&start); int quit = 0; int ret; #ifdef HW_RVL // don't show dvd motor off on the wii menuitems[5][0] = 0; // rename reset/exit items sprintf (menuitems[6], "Return to Wii Menu"); sprintf (menuitems[7], "Return to Homebrew Channel"); #endif // disable game-specific menu items if a ROM isn't loaded if (!ROMLoaded) menuitems[3][0] = '\0'; else sprintf (menuitems[3], "Game Menu"); VIDEO_WaitVSync (); while (quit == 0) { if(selectedMenu >= 0) { ret = selectedMenu; selectedMenu = -1; // default back to main menu } else { ret = RunMenu (menuitems, menucount, (char*)"Main Menu"); } switch (ret) { case 0: // Load ROM Menu quit = LoadManager (); break; case 1: // Configure Controllers ConfigureControllers (); break; case 2: // Preferences PreferencesMenu (); break; case 3: // Game Options quit = GameMenu (); break; case 4: // Credits Credits (); WaitButtonA (); break; case 5: // turn the dvd motor off (GC only) #ifdef HW_DOL dvd_motor_off (); #endif case 6: // Reset the Gamecube/Wii Reboot(); break; case 7: ExitToLoader(); break; case -1: // Button B // Return to Game if(ROMLoaded) quit = 1; break; } } // Wait for buttons to be released int count = 0; // how long we've been waiting for the user to release the button while(count < 50 && ( PAD_ButtonsHeld(0) #ifdef HW_RVL || WPAD_ButtonsHeld(0) #endif )) { VIDEO_WaitVSync(); count++; } mftb(&end); loadtimeradjust += tb_diff_msec(&end, &start); }
s32 what_to_do() { u32 pressed; u32 pressedGC; int selection = 0; int ret; char *optionsstring[3] = { "<Install IOS118 and 118 Channel>", "<Uninstall IOS118 and 118 Channel>", "<Exit>" }; while (true) { Con_ClearLine(); set_highlight(true); printf(optionsstring[selection]); set_highlight(false); waitforbuttonpress(&pressed, &pressedGC); if (pressed == WPAD_BUTTON_LEFT || pressedGC == PAD_BUTTON_LEFT) { if (selection > 0) { selection--; } else { selection =2; } } if (pressed == WPAD_BUTTON_RIGHT || pressedGC == PAD_BUTTON_RIGHT) { if (selection < 2) { selection++; } else { selection = 0; } } if (pressed == WPAD_BUTTON_A || pressedGC == PAD_BUTTON_A) { printf("\n"); if (selection == 0) { printf("About to install IOS118\n"); ret = Install_patched_IOS(36, IOS36version, true, true, true, true, 118, 65535, false); if (ret < 0) { printf("IOS118 Install failed. Press any button to exit...\n"); waitforbuttonpress(NULL, NULL); Reboot(); } printf("\nStep 1 Complete!\n"); printf("IOS118 Installation is complete!\n"); install_channel_118(); printf("\nStep 2 Complete!\n"); printf("118Channel Installation is complete!\n"); printf("Press any button to exit...\n"); waitforbuttonpress(NULL, NULL); Reboot(); return 0; } if (selection == 1) { ISFS_Initialize(); Uninstall_DeleteTicket(1, 118); Uninstall_DeleteTitle(1, 118); Uninstall_118Channel_all(); ISFS_Deinitialize(); } if (selection == 2) { Reboot(); } } } }
void print_all_keys(FILE *fp, bool access_seeprom) { int i; u8 null_key[16]; otp_t *otp_data = memalign(32, sizeof(otp_t)); seeprom_t *seeprom_data = memalign(32, sizeof(seeprom_t)); memset(null_key, 0, sizeof(null_key)); // We'll later use this for the Korean Key check /* Read OTP data into otp_ptr pointer */ bool read_otp = OTP_Mount(); if (!read_otp) { OTP_Unmount(); free(otp_data); if (device == 1) Close_SD(); if (device == 2) Close_USB(); printf("\n\nFatal error: OTP_Mount failed."); sleep(2); Reboot(); } memcpy(otp_data, otp_ptr, sizeof(otp_t)); OTP_Unmount(); if (access_seeprom) { /* Read SEEPROM data into seeprom_ptr pointer */ bool read_seeprom = SEEPROM_Mount(); if (!read_seeprom) { SEEPROM_Unmount(); free(seeprom_data); if (device == 1) Close_SD(); if (device == 2) Close_USB(); printf("\n\nFatal error: SEEPROM_Mount failed."); sleep(2); Reboot(); } memcpy(seeprom_data, seeprom_ptr, sizeof(seeprom_t)); SEEPROM_Unmount(); } for (i = 0; i < 10; i++) { /* The Korean Key will be shown only if it is actually present on the SEEPROM */ /* If it isn't, we'll skip it */ if (access_seeprom && i == 9 && memcmp(seeprom_data->korean_key, null_key, sizeof(seeprom_data->korean_key)) == 0) { continue; } else if (!access_seeprom && (i == 7 || i == 8 || i == 9)) { /* Do not print SEEPROM values if its access is disabled */ continue; } else { fprintf(fp, "[%d] %s:\t", i, key_names[i]); } switch (i) { case 0: // boot1 Hash hex_key_dump(fp, (void *)otp_data->boot1_hash, sizeof(otp_data->boot1_hash)); break; case 1: // Common Key hex_key_dump(fp, (void *)otp_data->common_key, sizeof(otp_data->common_key)); break; case 2: // Console ID hex_key_dump(fp, (void *)otp_data->ng_id, sizeof(otp_data->ng_id)); break; case 3: // ECC Priv Key hex_key_dump(fp, (void *)otp_data->ng_priv, sizeof(otp_data->ng_priv)); break; case 4: // NAND HMAC hex_key_dump(fp, (void *)otp_data->nand_hmac, sizeof(otp_data->nand_hmac)); break; case 5: // NAND AES Key hex_key_dump(fp, (void *)otp_data->nand_key, sizeof(otp_data->nand_key)); break; case 6: // PRNG Key hex_key_dump(fp, (void *)otp_data->rng_key, sizeof(otp_data->rng_key)); break; case 7: // NG Key ID if (access_seeprom) hex_key_dump(fp, (void *)seeprom_data->ng_key_id, sizeof(seeprom_data->ng_key_id)); break; case 8: // NG Signature if (access_seeprom) hex_key_dump(fp, (void *)seeprom_data->ng_sig, sizeof(seeprom_data->ng_sig)); break; case 9: // Korean Key if (access_seeprom && memcmp(seeprom_data->korean_key, null_key, sizeof(seeprom_data->korean_key)) != 0) { hex_key_dump(fp, (void *)seeprom_data->korean_key, sizeof(seeprom_data->korean_key)); } break; default: break; } fprintf(fp, "\n"); } /* Time to free these babies */ free(otp_data); free(seeprom_data); }