/**************************************************************************** * Resume NetworkWait ***************************************************************************/ void ResumeNetworkWait() { networkHalt = true; checkincomming = true; waitforanswer = true; infilesize = 0; connection = -1; LWP_ResumeThread(networkthread); }
void GuiImageAsync::ThreadAddImage(GuiImageAsync *Image) { LWP_MutexLock(ListLock); List.push_back(Image); LWP_MutexUnlock(ListLock); ThreadSleep = false; LWP_ResumeThread(Thread); }
void continueRemovalThread() { #ifdef DEVICE_REMOVAL_THREAD if(rThreadRun) return; rThreadRun = 1; LWP_ResumeThread(removalThread); #endif }
/**************************************************************************** * StartNetworkThread * * Signals the network thread to resume, or creates a new thread ***************************************************************************/ void StartNetworkThread() { netHalt = 0; if(networkthread == LWP_THREAD_NULL) LWP_CreateThread(&networkthread, netcb, NULL, netstack, 8192, 40); else LWP_ResumeThread(networkthread); }
/**************************************************************************** * StopNetworkThread * * Signals the network thread to stop ***************************************************************************/ void StopNetworkThread() { if(networkthread == LWP_THREAD_NULL || !LWP_ThreadIsSuspended(networkthread)) return; netHalt = 2; LWP_ResumeThread(networkthread); // wait for thread to finish LWP_JoinThread(networkthread, NULL); networkthread = LWP_THREAD_NULL; }
void WiiMenu() { // wait for thread to finish while(!LWP_ThreadIsSuspended(keythread)) usleep(100); WII_VideoStop(); SwitchAudioMode(1); HomeMenu(); WII_VideoStart(); SwitchAudioMode(0); if(dosboxCommand[0] != 0) LWP_ResumeThread(keythread); }
bool DownloadUpdate() { bool result = false; if(strlen(updateURL) > 0) { // stop checking if devices were removed/inserted // since we're saving a file LWP_SuspendThread (devicethread); FILE * hfile; char updateFile[50]; sprintf(updateFile, "sd:/%s Update.zip", APPNAME); hfile = fopen (updateFile, "wb"); if (hfile > 0) { int retval; retval = http_request(updateURL, hfile, NULL, (1024*1024*5)); fclose (hfile); } bool unzipResult = unzipArchive(updateFile, (char *)"sd:/"); remove(updateFile); // delete update file if(unzipResult) { result = true; WaitPrompt("Update successful!"); } else { result = false; WaitPrompt("Update failed!"); } updateFound = false; // updating is finished (successful or not!) // go back to checking if devices were inserted/removed LWP_ResumeThread (devicethread); } return result; }
void resume_netinit_thread() { if(initnetthread != LWP_THREAD_NULL) { netInitHalted = 0; LWP_ResumeThread(initnetthread); } }
/**************************************************************************** * ResumeDeviceThread * * Signals the device thread to start, and resumes the thread. ***************************************************************************/ void ResumeDeviceThread() { deviceHalt = false; LWP_ResumeThread(devicethread); }
/*************************************************************************** * Browse subdirectories **************************************************************************/ int ParseDirectory(bool waitParse, bool filter) { int retry = 1; bool mounted = false; parseFilter = filter; ResetBrowser(); // reset browser // add trailing slash if(browser.dir[strlen(browser.dir)-1] != '/') strcat(browser.dir, "/"); // open the directory while(dir == NULL && retry == 1) { mounted = ChangeInterface(browser.dir, NOTSILENT); if(mounted) dir = opendir(browser.dir); else return -1; if(dir == NULL) retry = ErrorPromptRetry("Error opening directory!"); } // if we can't open the dir, try higher levels if (dir == NULL) { char * devEnd = strrchr(browser.dir, '/'); while(!IsDeviceRoot(browser.dir)) { devEnd[0] = 0; // strip slash devEnd = strrchr(browser.dir, '/'); if(devEnd == NULL) break; devEnd[1] = 0; // strip remaining file listing dir = opendir(browser.dir); if (dir) break; } } if(dir == NULL) return -1; if(IsDeviceRoot(browser.dir)) { AddBrowserEntry(); sprintf(browserList[0].filename, ".."); sprintf(browserList[0].displayname, "Up One Level"); browserList[0].length = 0; browserList[0].isdir = 1; // flag this as a dir browserList[0].icon = ICON_FOLDER; browser.numEntries++; } parseHalt = false; ParseDirEntries(); // index first 20 entries LWP_ResumeThread(parsethread); // index remaining entries if(waitParse) // wait for complete parsing { ShowAction("Loading..."); while(!LWP_ThreadIsSuspended(parsethread)) usleep(THREAD_SLEEP); CancelAction(); } return browser.numEntries; }
int main(int argc, char *argv[]) { #ifdef HW_DOL ipl_set_config(6); // disable Qoob modchip #endif #ifdef WII_DVD DI_Init(); // first #endif int selectedMenu = -1; InitDeviceThread(); InitGCVideo (); ResetVideo_Menu (); // change to menu video mode // Controllers PAD_Init(); #ifdef HW_RVL WPAD_Init(); // read wiimote accelerometer and IR data WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR); WPAD_SetVRes(WPAD_CHAN_ALL,640,480); // Wii Power/Reset buttons WPAD_SetPowerButtonCallback((WPADShutdownCallback)ShutdownCB); SYS_SetPowerCallback(ShutdownCB); SYS_SetResetCallback(ResetCB); #endif // Initialise FreeType if (FT_Init ()) { printf ("Cannot initialise font subsystem!\n"); while (1); } InitialiseAudio(); // Initialize libFAT for SD and USB MountAllFAT(); // Initialize DVD subsystem (GameCube only) #ifdef HW_DOL DVD_Init (); #endif // allocate memory to store rom nesrom = (unsigned char *)malloc(1024*1024*3); // 3 MB should be plenty /*** Minimal Emulation Loop ***/ if ( !FCEUI_Initialize() ) { WaitPrompt("Unable to initialize FCE Ultra\n"); ExitToLoader(); } FCEUI_SetGameGenie(0); // 0 - OFF, 1 - ON memset(FDSBIOS, 0, sizeof(FDSBIOS)); // clear FDS BIOS memory cleanSFMDATA(); // clear state data // Set defaults DefaultSettings(); // store path app was loaded from sprintf(appPath, "fceugx"); if(argc > 0 && argv[0] != NULL) CreateAppPath(argv[0]); // Load preferences if(!LoadPrefs()) { WaitPrompt("Preferences reset - check settings!"); selectedMenu = 1; // change to preferences menu } FCEUI_SetSoundQuality(1); // 0 - low, 1 - high, 2 - high (alt.) FCEUI_SetVidSystem(GCSettings.timing); // causes a small 'pop' in the audio while (1) // main loop { #ifdef HW_RVL if(ShutdownRequested) ShutdownWii(); #endif // go back to checking if devices were inserted/removed // since we're entering the menu LWP_ResumeThread (devicethread); MainMenu(selectedMenu); selectedMenu = 2; // return to game menu from now on // stop checking if devices were removed/inserted // since we're starting emulation again LWP_SuspendThread (devicethread); ResetVideo_Emu(); setFrameTimer(); // set frametimer method before emulation SetPalette(); static int fskipc=0; while(1) // emulation loop { uint8 *gfx; int32 *sound; int32 ssize; #ifdef FRAMESKIP fskipc=(fskipc+1)%(frameskip+1); #endif FCEUI_Emulate(&gfx, &sound, &ssize, fskipc); if(!fskipc) { xbsave = gfx; FCEUD_Update(gfx, sound, ssize); } if(ResetRequested) { PowerNES(); // reset game ResetRequested = 0; } if(ConfigRequested) { ResetVideo_Menu(); if (GCSettings.AutoSave == 1) { SaveRAM(GCSettings.SaveMethod, SILENT); } else if (GCSettings.AutoSave == 2) { SaveState(GCSettings.SaveMethod, SILENT); } else if(GCSettings.AutoSave == 3) { SaveRAM(GCSettings.SaveMethod, SILENT); SaveState(GCSettings.SaveMethod, SILENT); } // save zoom level SavePrefs(SILENT); ConfigRequested = 0; break; // leave emulation loop } } } }
/**************************************************************************** * ResumeNetworkThread ***************************************************************************/ void ResumeNetworkThread() { networkHalt = false; LWP_ResumeThread(networkthread); }
/**************************************************************************** * ResumeGui * * Signals the GUI thread to start, and resumes the thread. This is called * after finishing the removal/insertion of new elements, and after initial * GUI setup. ***************************************************************************/ void ResumeGui() { guiHalt = false; LWP_ResumeThread(guithread); }
void DiHandler::Wake() { threadSleep = false; LWP_ResumeThread( thread ); }