int LoopInit() { int ret=0; // bits LSb->MSb: // enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound; // alt_renderer, 6button_gamepad, accurate_timing, accurate_sprites PicoOpt=0x1f; PsndRate=44100; //PsndLen=PsndRate/60; // calculated later by pico itself // Init Direct3D: ret=DirectInit(); if (ret) return 1; InputInit(); // Init DirectSound: //DSoundInit(); ret=EmuInit(); if (ret) return 1; FileMenu.init(); LoopMode=8; PicoWriteSound = UpdateSound; return 0; }
int DeviceInit() { ClassInit(); BusInit(); InputInit(); return StorageInit(); }
void SystemInit (void) { TimerInit(); DirInit(); VideoInit(); // Must be before sound/input because of window InputInit(); SoundInit(); //LuaStart(); }
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; }
int main(int argc, char *argv[]) { UINT32 i=0; ConfigAppLoad(); CheckFirstTime(); // check for first time run SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO); BurnLibInit(); SDL_WM_SetCaption( "FBA, SDL port.", "FBA, SDL port."); SDL_ShowCursor(SDL_DISABLE); if (argc == 2) { for (i = 0; i < nBurnDrvCount; i++) { nBurnDrvSelect[0] = i; if (strcmp(BurnDrvGetTextA(0), argv[1]) == 0) { break; } } if (i == nBurnDrvCount) { printf("%s is not supported by FB Alpha.",argv[1]); return 1; } } InputInit(); init_emu(i); RunMessageLoop(); InputExit(); DrvExit(); ConfigAppSave(); BurnLibExit(); SDL_Quit(); return 0; }
CoreManager::CoreManager() : top_input_processor(NULL), io_input_channel(NULL), io_input_channel_id(0) , resize_channel(NULL), resize_channel_id(0), pipe_valid(false), tk(NULL) , utf8(false), gmainloop(NULL), redraw_pending(false), resize_pending(false) , fallback_draw_mode(false) { InputInit(); // if charset isn't utf8 or wcwidth() implementation is broken if (!utf8 || wcwidth(0x2500) != 1) fallback_draw_mode = true; /** * @todo Check the return value. Throw an exception if we can't init curses. */ Curses::screen_init(); // create a new loop gmainloop = g_main_loop_new(NULL, FALSE); DeclareBindables(); }
int SFInitInput(lua_State* l) { InputInit(); return 0; }
int MediaInit() { /* if (ScrnInit()) { // Init the Scrn Window FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_UI_WINDOW)); FBAPopupDisplay(PUF_TYPE_ERROR); return 1; } */ // Screen Size will go here via /* if (bDrvOkay) { if ((BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) && (nVidRotationAdjust & 1)) { BurnDrvGetVisibleSize(&nBmapHeight, &nBmapWidth); BurnDrvGetAspect(&nGameAspectY, &nGameAspectX); } else { BurnDrvGetVisibleSize(&nBmapWidth, &nBmapHeight); BurnDrvGetAspect(&nGameAspectX, &nGameAspectY); } if (nBmapWidth <= 0 || nBmapHeight <= 0) { return 1; } } */ if (!bInputOkay) { InputInit(); // Init Input } // nAppVirtualFps = nBurnFPS; if (!bAudOkay) { AudSoundInit(); // Init Sound (not critical if it fails) } nBurnSoundRate = 0; // Assume no sound pBurnSoundOut = NULL; if (bAudOkay) { nBurnSoundRate = nAudSampleRate[nAudSelect]; nBurnSoundLen = nAudSegLen; } if (!bVidOkay) { // Reinit the video plugin VidInit(); if (!bVidOkay && nVidFullscreen) { nVidFullscreen = 0; MediaExit(); return (MediaInit()); } if (!nVidFullscreen) { // ScrnSize(); // dont' change any screens on the wii } if (!bVidOkay && (bDrvOkay || bVidUsePlaceholder)) { // Make sure the error will be visible // SplashDestroy(1); // FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_UI_MODULE), VidGetModuleName()); // FBAPopupDisplay(PUF_TYPE_ERROR); } if (bVidOkay && ((bRunPause && bAltPause) || !bDrvOkay)) { VidRedraw(); } } return 0; }
bool CapApp::onInit(int argc, char* argv[]) { (void)argc; (void)argv; // ---------------------------------------------- // FTP cellSysmoduleLoadModule(CELL_SYSMODULE_NET); cellNetCtlInit(); cellSysmoduleLoadModule(CELL_SYSMODULE_HTTP); sys_net_initialize_network(); ftp_on(); // Load settings... if(!iniRead()) { iniWrite(); // create settings file... } cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); cellScreenShotEnable(); InputInit(); while(!videoOutIsReady()) { // ... } PSGLinitOptions options = { enable: PSGL_INIT_MAX_SPUS | PSGL_INIT_INITIALIZE_SPUS, maxSPUs: 1, initializeSPUs: GL_FALSE, persistentMemorySize: 0, transientMemorySize: 0, errorConsole: 0, fifoSize: 0, hostMemorySize: 128* 1024*1024, // 128 mbs for host memory }; #if CELL_SDK_VERSION < 0x340000 options.enable |= PSGL_INIT_HOST_MEMORY_SIZE; #endif // Initialize 6 SPUs but reserve 1 SPU as a raw SPU for PSGL sys_spu_initialize(6, 1); psglInit(&options); const unsigned int resolutions[] = { CELL_VIDEO_OUT_RESOLUTION_1080, CELL_VIDEO_OUT_RESOLUTION_960x1080, CELL_VIDEO_OUT_RESOLUTION_720, CELL_VIDEO_OUT_RESOLUTION_480 }; const int numResolutions = sizeof(resolutions) / sizeof(resolutions[0]); int bestResolution = chooseBestResolution(resolutions,numResolutions); getResolutionWidthHeight(bestResolution, deviceWidth, deviceHeight); if(bestResolution) { PSGLdeviceParameters params; params.enable = PSGL_DEVICE_PARAMETERS_COLOR_FORMAT | PSGL_DEVICE_PARAMETERS_DEPTH_FORMAT | PSGL_DEVICE_PARAMETERS_MULTISAMPLING_MODE; params.colorFormat = GL_ARGB_SCE; params.depthFormat = GL_NONE; params.multisamplingMode = GL_MULTISAMPLING_NONE_SCE; params.enable |= PSGL_DEVICE_PARAMETERS_WIDTH_HEIGHT; params.width = deviceWidth; params.height = deviceHeight; device = psglCreateDeviceExtended(¶ms); context = psglCreateContext(); psglMakeCurrent(context, device); psglResetCurrentContext(); initGraphics(); if( cellSysutilRegisterCallback( 0, callback_sysutil_exit, NULL ) < 0 ) { //... } dbgFontInit(); fbaRL = new c_fbaRL(); while(bRun) { onRender(); onUpdate(); cellSysutilCheckCallback(); } } else { // resolution error... } ftp_off(); onShutdown(); return false; } void CapApp::onRender() { if(fbaRL) { fbaRL->DlgDisplayFrame(); } // get render target buffer dimensions and set viewport psglGetRenderBufferDimensions(device,&app.renderWidth,&app.renderHeight); glViewport(0, 0, app.renderWidth, app.renderHeight); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if(fbaRL) { fbaRL->RenderBackground(); } if(fbaRL) { fbaRL->nFrameStep = 0; fbaRL->DisplayFrame(); } if(fbaRL) { fbaRL->nFrameStep = 1; fbaRL->DisplayFrame(); } dbgFontDraw(); psglSwap(); } bool CapApp::onUpdate() { if(!mFrame) mFrame = 0; mFrame++; InputFrameStart(); if(fbaRL) fbaRL->InputFrame(); InputFrameEnd(); return true; } void CapApp::onShutdown() { iniWrite(); // save settings if(context) psglDestroyContext(context); if(device) psglDestroyDevice(device); InputExit(); psglExit(); }
SQInteger SFInitInput(HSQUIRRELVM v) { InputInit(); return 0; }
static int playFile(const char * file) { int status = -1; media_desc_t mdesc; //DBGLOG("playing file: [%s]", file); memset(&mdesc, 0, sizeof(media_desc_t)); mdesc.ftype = NMS_WP_INVALID; if (!InputIsOurFile(file)) return -1; status = InputInit(file, &mdesc); switch (status) { case 0: //everything is fine break; case 1: WPRINT("InputInit: DM320 is locked by something else. Please try again later."); LOCK_PLAYMUTEX(); errorStatus = NMS_STATUS_OUTPUT_LOCKED; UNLOCK_PLAYMUTEX(); goto bail_clean_input; default: WPRINT("InputInit: Unable to init device!"); LOCK_PLAYMUTEX(); errorStatus = NMS_STATUS_NOT_PLAYABLE; UNLOCK_PLAYMUTEX(); goto bail_clean_input; } LOCK_PLAYMUTEX(); InputGetInfo(file, &info); UNLOCK_PLAYMUTEX(); if (InputStart(file)) { status = -1; goto bail_clean_input; } status = OutputInit(&mdesc,OutputGetMode(),curProportions); switch (status) { case 0: //everything is fine break; case 1: WPRINT("OutputInit: DM320 is locked by something else. Please try again later."); LOCK_PLAYMUTEX(); errorStatus = NMS_STATUS_OUTPUT_LOCKED; UNLOCK_PLAYMUTEX(); goto bail_clean_input; default: WPRINT("OutputInit: Unable to init output !"); LOCK_PLAYMUTEX(); if ((playtype == NPT_FILE) || (totalFiles <= 1) || (repeat == 1)) errorStatus = NMS_STATUS_NOT_PLAYABLE; UNLOCK_PLAYMUTEX(); goto bail_clean_input; } OutputActivateMode(0); LOCK_PLAYMUTEX(); playtime = 0; ffrwLevel = 0; sfrwLevel = 0; sfrwLevelFinal = 0; muted = 0; playing = 1; trackChange = TC_DISABLE; UNLOCK_PLAYMUTEX(); if (newThread(&avThread, NULL, avLoop, NULL)) { status = -1; goto bail_clean_input; } return 0; bail_clean_input: LOCK_PLAYMUTEX(); InputFinish(); UNLOCK_PLAYMUTEX(); return status; }
/* ./show_file [-s Size] [-f freetype_font_file] [-h HZK] <text_file> */ int main(int argc, char **argv) { int iError; unsigned int dwFontSize = 16; char acHzkFile[128]; char acFreetypeFile[128]; char acTextFile[128]; char acDisplay[128]; char cOpr; int bList = 0; T_InputEvent tInputEvent; acHzkFile[0] = '\0'; acFreetypeFile[0] = '\0'; acTextFile[0] = '\0'; strcpy(acDisplay, "fb"); while ((iError = getopt(argc, argv, "ls:f:h:d:")) != -1) { switch(iError) { case 'l': { bList = 1; break; } case 's': { dwFontSize = strtoul(optarg, NULL, 0); break; } case 'f': { strncpy(acFreetypeFile, optarg, 128); acFreetypeFile[127] = '\0'; break; } case 'h': { strncpy(acHzkFile, optarg, 128); acHzkFile[127] = '\0'; break; } case 'd': { strncpy(acDisplay, optarg, 128); acDisplay[127] = '\0'; break; } default: { printf("Usage: %s [-s Size] [-d display] [-f font_file] [-h HZK] <text_file>\n", argv[0]); printf("Usage: %s -l\n", argv[0]); return -1; break; } } } if (!bList && (optind >= argc)) { printf("Usage: %s [-s Size] [-d display] [-f font_file] [-h HZK] <text_file>\n", argv[0]); printf("Usage: %s -l\n", argv[0]); return -1; } iError = DisplayInit(); if (iError) { printf("DisplayInit error!\n"); return -1; } iError = FontsInit(); if (iError) { printf("FontsInit error!\n"); return -1; } iError = EncodingInit(); if (iError) { printf("EncodingInit error!\n"); return -1; } iError = InputInit(); if (iError) { printf("InputInit error!\n"); return -1; } if (bList) { printf("supported display:\n"); ShowDispOpr(); printf("supported font:\n"); ShowFontOpr(); printf("supported encoding:\n"); ShowEncodingOpr(); printf("supported input:\n"); ShowInputOpr(); return 0; } strncpy(acTextFile, argv[optind], 128); acTextFile[127] = '\0'; iError = OpenTextFile(acTextFile); if (iError) { printf("OpenTextFile error!\n"); return -1; } iError = SetTextDetail(acHzkFile, acFreetypeFile, dwFontSize); if (iError) { printf("SetTextDetail error!\n"); return -1; } DBG_PRINTF("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__); iError = SelectAndInitDisplay(acDisplay); if (iError) { printf("SelectAndInitDisplay error!\n"); return -1; } iError = AllInputDevicesInit(); if (iError) { DBG_PRINTF("Error AllInputDevicesInit\n"); return -1; } DBG_PRINTF("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__); iError = ShowNextPage(); DBG_PRINTF("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__); if (iError) { printf("Error to show first page\n"); return -1; } printf("Enter 'n' to show next page, 'u' to show previous page, 'q' to exit: "); while (1) { if (0 == GetInputEvent(&tInputEvent)) { if (tInputEvent.iVal == INPUT_VALUE_DOWN) { ShowNextPage(); } else if (tInputEvent.iVal == INPUT_VALUE_UP) { ShowPrePage(); } else if (tInputEvent.iVal == INPUT_VALUE_EXIT) { return 0; } } } return 0; }
int main(int argc, char* argv[]) { init_log(); (void)argc; (void)argv; // [cobralib] unmount iso / eject cobra_send_fake_disc_eject_event(); cobra_umount_disc_image(); // Check if isolist.self is launching this app... FILE* fp_flag = fopen("/dev_hdd0/game/SISO00123/USRDIR/isolist_finished", "r"); if(fp_flag) { // load normally... fclose(fp_flag); *&fp_flag = NULL; // remove the launch flag... cellFsUnlink("/dev_hdd0/game/SISO00123/USRDIR/isolist_finished"); } else { // generate ISO list... sys_game_process_exitspawn((char*)ISOLIST_SELF, NULL, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } if(!LoadModules()) { // error... (void)exit_app(); return 0; } // setup sys callback if(cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL) != CELL_OK) { // error... (void)exit_app(); return 0; } InputInit(); if(InitPSGLVideo(device, context, screen_width, screen_height, render_width, render_height)) { // clear vid on startup (void)render(true); // init font if(!font_init(render_width, render_height)) { bRun = false; } // init app core modules, ftp, settings, etc... if(!init_core()) { bRun = false; } // loop while(bRun) { cellSysutilCheckCallback(); (void)input(); (void)render(false); } } else { // error msg here... } (void)exit_app(); return 0; }