int MediaInit() { dprintf(_T("s1\n")); if (ScrnInit()) { // Init the Scrn Window FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_UI_WINDOW)); FBAPopupDisplay(PUF_TYPE_ERROR); return 1; } dprintf(_T("s2\n")); if (!bInputOkay) { InputInit(); // Init Input } dprintf(_T("s3\n")); nAppVirtualFps = nBurnFPS; dprintf(_T("s4\n")); if (!bAudOkay) { AudSoundInit(); // Init Sound (not critical if it fails) } dprintf(_T("s5\n")); nBurnSoundRate = 0; // Assume no sound pBurnSoundOut = NULL; if (bAudOkay) { nBurnSoundRate = nAudSampleRate[nAudSelect]; nBurnSoundLen = nAudSegLen; } dprintf(_T("s6\n")); if (!bVidOkay) { dprintf(_T("s7\n")); // Reinit the video plugin VidInit(); if (!bVidOkay && nVidFullscreen) { dprintf(_T("s8\n")); nVidFullscreen = 0; dprintf(_T("s9\n")); MediaExit(); return (MediaInit()); } if (!nVidFullscreen) { ScrnSize(); } dprintf(_T("s10\n")); if (!bVidOkay) { // Make sure the error will be visible SplashDestroy(1); dprintf(_T("s11\n")); FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_UI_MODULE), VidGetModuleName()); FBAPopupDisplay(PUF_TYPE_ERROR); } dprintf(_T("s12\n")); if (bVidOkay && ((bRunPause && bAltPause) || !bDrvOkay)) { VidRedraw(); } } dprintf(_T("s13\n")); return 0; }
static int AppInit() { #if defined (_MSC_VER) && defined (_DEBUG) _CrtSetDbgFlag(_CRTDBG_CHECK_ALWAYS_DF); // Check for memory corruption _CrtSetDbgFlag(_CRTDBG_DELAY_FREE_MEM_DF); // _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF); // #endif OpenDebugLog(); // Create a handle to the main thread of execution DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, 0, false, DUPLICATE_SAME_ACCESS); // Load config for the application ConfigAppLoad(); FBALocaliseInit(szLocalisationTemplate); kailleraInit(); #if 1 || !defined (FBA_DEBUG) // print a warning if we're running for the 1st time if (nIniVersion < nBurnVer) { ScrnInit(); //SplashDestroy(1); FirstUsageCreate(); ConfigAppSave(); // Create initial config file } #endif // Set the thread priority for the main thread SetThreadPriority(GetCurrentThread(), nAppThreadPriority); bCheatsAllowed = true; #ifdef USE_SDL SDL_Init(0); #endif // Init the Burn library BurnLibInit(); ComputeGammaLUT(); if (VidSelect(nVidSelect)) { nVidSelect = 0; VidSelect(nVidSelect); } hAccel = LoadAccelerators(hAppInst, MAKEINTRESOURCE(IDR_ACCELERATOR)); // Build the ROM information CreateROMInfo(); // Write a clrmame dat file if we are verifying roms #if defined (ROM_VERIFY) create_datfile(_T("fba.dat"), 0); #endif bNumlockStatus = SetNumLock(false); return 0; }