static int AppInit() { int nRet=0; // Load config for the application nRet=ConfigAppLoad(); if (nRet!=0) { ConfigAppSave(); // create initial config file } // Set the thread priority SetThreadPriority(GetCurrentThread(),nAppThreadPriority); ComputeGammaLUT(); BurnLibInit(); // Init the Burn library MediaInit(); //ayeye hAccel=LoadAccelerators(hAppInst, MAKEINTRESOURCE(IDR_ACCELERATOR)); hImm32=LoadLibrary("imm32.dll"); return 0; }
int main(int argc, char **argv ) { char path[MAX_PATH]; BurnLibInit(); // init Burn core BurnPathsInit(); // init paths or create them if needed /* if (argc < 2) { int c; printf ("Usage: %s <path to rom><shortname>.zip\n" " ie: %s ./uopoko.zip\n" " Note: Path and .zip extension are mandatory.\n\n", argv[0], argv[0]); printf ("Supported (but not necessarily working) roms:\n\n"); for(nBurnDrvSelect[0] = 0; nBurnDrvSelect[0] < nBurnDrvCount; nBurnDrvSelect[0]++) { nBurnDrvActive = nBurnDrvSelect[0]; printf("%-20s ", BurnDrvGetTextA(DRV_NAME)); c++; if(c == 3) { c = 0; printf("\n"); } } printf ("\n\n"); CreateCapexLists(); // generate rominfo.fba and zipname.fba return 0; } */ ConfigGameDefault(); // alter cfg if any param is given if (argc >= 2) parse_cmd(argc, argv, path); ConfigAppLoad(); if((SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE)) < 0) { printf("Sdl failed to init\n"); exit(0); } if (argc < 2) GuiRun(); else { int drv; if((drv = FindDrvByFileName(path)) >= 0) RunEmulator(drv); } BurnLibExit(); if (argc < 2) ConfigAppSave(); SDL_Quit(); 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; }
int main( int argc, char **argv ) { strcpy(szAppBurnVer,"0.2.97.24"); char path[MAX_PATH]; if (argc < 2) { int c; printf ("Usage: %s <path to rom><shortname>.zip\n ie: %s ./uopoko.zip\n Note: Path and .zip extension are mandatory.\n\n",argv[0], argv[0]); printf ("Supported (but not necessarily working via fba-gp2x) roms:\n\n"); config_options.option_create_lists=1; BurnLibInit(); for (nBurnDrvSelect[0]=0; nBurnDrvSelect[0]<nBurnDrvCount; nBurnDrvSelect[0]++) { nBurnDrvActive=nBurnDrvSelect[0]; printf ("%-20s ", BurnDrvGetTextA(DRV_NAME)); c++; if (c == 3) { c = 0; printf ("\n"); } } printf ("\n\n"); return 0; } /* int tmp; tmp = open("/proc/pandora/nub0/mode", O_RDWR); read (tmp,nub0,10); write (tmp,"absolute",9); close(tmp); printf("Changed nub 0 to joystick\n"); tmp = open("/proc/pandora/nub1/mode", O_RDWR); read (tmp,nub1,10); write (tmp,"absolute",9); close(tmp); printf("Changed nub 1 to joystick\n"); FILE * joyexists; joyexists=NULL; long timeout; timeout=0; while ((joyexists==NULL) && (timeout<100000)) { // printf("."); joyexists=fopen("/dev/input/js0","r"); usleep(20); timeout++; } if (joyexists) { printf("js0 now exists\n"); fclose(joyexists); } else { printf("timeout creating js0... reverting nub 0 to original setting\n"); tmp = open("/proc/pandora/nub0/mode", O_WRONLY); write (tmp,nub0,10); close(tmp); } joyexists=NULL; timeout=0; while ((joyexists==NULL) && (timeout<100000)) { joyexists=fopen("/dev/input/js1","r"); usleep(20); timeout++; } if (joyexists) { printf("js1 now exists\n"); fclose(joyexists); } else { printf("timeout creating js1... reverting nub 1 to original setting\n"); tmp = open("/proc/pandora/nub1/mode", O_WRONLY); write (tmp,nub1,10); close(tmp); } */ //Initialize configuration options config_options.option_sound_enable = 2; config_options.option_rescale = 2; config_options.option_rotate = 0; config_options.option_samplerate = 0; config_options.option_showfps = 1; config_options.option_create_lists=0; config_options.option_forcem68k=0; config_options.option_forcec68k=0; config_options.option_z80core=0; config_options.option_sense=100; strcpy(config_options.option_startspeed,"NULL"); strcpy(config_options.option_selectspeed,"NULL"); strcpy(config_options.option_frontend, "./capex.sh"); printf("about to parse cmd\n"); parse_cmd(argc, argv,path); printf("finshed parsing\n"); config_keymap.up=SDLK_UP; config_keymap.down=SDLK_DOWN; config_keymap.left=SDLK_LEFT; config_keymap.right=SDLK_RIGHT; config_keymap.fire1=SDLK_HOME; //a config_keymap.fire2=SDLK_PAGEDOWN; //x config_keymap.fire3=SDLK_END; //b config_keymap.fire4=SDLK_PAGEUP; //y config_keymap.fire5=SDLK_RSHIFT; config_keymap.fire6=SDLK_RCTRL; config_keymap.coin1=SDLK_LCTRL; config_keymap.start1=SDLK_LALT; config_keymap.pause=SDLK_p; config_keymap.quit=SDLK_q; // gp2x_initialize(); // printf("platform init finished\n"); //Initialize sound thread run_fba_emulator (path); /* if (strcmp(config_options.option_startspeed,config_options.option_selectspeed)) { printf("resetting cpu speed to %s\n",config_options.option_startspeed); int clk; clk = open("/proc/pandora/cpu_mhz_max", O_WRONLY); write (clk,config_options.option_startspeed,strlen(config_options.option_startspeed)+1); close(clk); } gp2x_terminate(config_options.option_frontend); */ return 0; }
void run_fba_emulator(const char *fn) { char build_version[] = "Finalburn Alpha Plus for Pi ("__DATE__")"; // process rom path and name char romname[MAX_PATH]; if (BurnCacheInit(fn, romname)) goto finish; if(config_options.option_showfps) bShowFPS=true; BurnLibInit(); // find rom by name for (nBurnDrvSelect=0; nBurnDrvSelect<nBurnDrvCount; nBurnDrvSelect++) if ( strcasecmp(romname, BurnDrvGetTextA(DRV_NAME)) == 0 ) break; if (nBurnDrvSelect >= nBurnDrvCount) { // unsupport rom ... nBurnDrvSelect = ~0U; logoutput ("rom not supported!\n"); printf ("rom not supported!\n"); goto finish; } logoutput("Attempt to initialise '%s'\n", BurnDrvGetTextA(DRV_FULLNAME)); memset (titlefb, 0, 320*240*2); DrawString (build_version, (uint16*)&titlefb, 10, 20, 320); DrawString ("Based on FinalBurnAlpha", (uint16*)&titlefb, 10, 35, 320); DrawString ("Now loading ... ", (uint16 *)&titlefb, 10, 105, 320); show_rom_loading_text("Open Zip", 0, 0); memcpy (VideoBuffer, titlefb, 320*240*2); pi_video_flip(); InpInit(); InpDIP(); VideoInit(); if (DrvInit(nBurnDrvSelect, false) != 0) { logoutput ("Driver initialisation failed! Likely causes are:\n- Corrupt/Missing ROM(s)\n- I/O Error\n- Memory error\n\n"); printf ("Driver initialisation failed! Likely causes are:\n- Corrupt/Missing ROM(s)\n- I/O Error\n- Memory error\n\n"); goto finish; } RunReset(); frame_count = 0; GameLooping = true; EZX_StartTicks(); logoutput ("Lets go!\n"); logflush(); if (config_options.option_sound_enable) { int timer = 0, tick=0, i=0, fps = 0; bool bRenderFrame; if (SndOpen() == 0) { while (GameLooping) { if (bShowFPS) { timer = EZX_GetTicks(); if(timer-tick>1000000) { fps = nFramesRendered; nFramesRendered = 0; tick = timer; } } //We need to render more audio: bRenderFrame=true; // Render last frame RunOneFrame(bRenderFrame,fps); update_audio_stream(pBurnSoundOut); pi_process_events(); } } } else { int now, done=0, timer = 0, ticks=0, tick=0, i=0, fps = 0; unsigned int frame_limit = nBurnFPS/100, frametime = 100000000/nBurnFPS; while (GameLooping) { timer = EZX_GetTicks()/frametime;; if(timer-tick>frame_limit && bShowFPS) { fps = nFramesRendered; nFramesRendered = 0; tick = timer; } now = timer; ticks=now-done; if(ticks<1) continue; if(ticks>10) ticks=10; for (i=0; i<ticks-1; i++) { RunOneFrame(false,fps); } if(ticks>=1) { RunOneFrame(true,fps); } done = now; } } logoutput ("Finished emulating\n"); finish: logoutput("---- Shutdown Finalburn Alpha plus ----\n\n"); DrvExit(); BurnLibExit(); if (config_options.option_sound_enable) SndExit(); VideoExit(); InpExit(); BurnCacheExit(); }
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; }
int main(int argc, char** argv) { SceCtrlData pad; getcwd(currentPath, MAX_PATH - 1); strcat(currentPath, "/"); strcpy(szAppRomPath, currentPath); strcat(szAppRomPath, "ROMS/"); int thid = sceKernelCreateThread(PBPNAME, CallbackThread, 0x11, 0xFA0, 0, 0); if(thid >= 0) sceKernelStartThread(thid, 0, 0); nGameStage = 1; init_gui(); BurnLibInit(); for (nBurnDrvSelect=0; nBurnDrvSelect<nBurnDrvCount; nBurnDrvSelect++) if ( strcmp("aerofgt", BurnDrvGetText(DRV_NAME)) == 0 ) break; if (nBurnDrvSelect >= nBurnDrvCount) nBurnDrvSelect = ~0U; bBurnUseASMCPUEmulation = false; nInterpolation = 3; pBurnSoundOut = 0; //&mixbuf[0]; nBurnSoundRate = SND_RATE; nBurnSoundLen = 0; //SND_FRAME_SIZE; //BurnDrvGetFullSize(&VideoBufferWidth, &VideoBufferHeight); //printf("%d x %d \n", VideoBufferWidth, VideoBufferHeight); nBurnBpp = 2; nBurnPitch = 512 * 2; BurnHighCol = HighCol16; int ret = 0; //DrvInit(nBurnDrvSelect, false); //if (nRet != 0) return 0; //BurnRecalcPal(); //InpInit(); //InpDIP(); pBurnDraw = (unsigned char *) video_frame_addr(tex_frame, 0, 0); //szAppRomPath //strcat(ui_current_path, "roms"); draw_ui_main(); bGameRunning = 1; while( bGameRunning ) { sceCtrlReadBufferPositive(&pad, 1); if ( nGameStage ) { do_ui_key( pad.Buttons ); update_gui(); sceDisplayWaitVblankStart(); } else { if ( pad.Buttons & PSP_CTRL_LTRIGGER ) { scePowerSetClockFrequency(222, 222, 111); nGameStage = 1; draw_ui_main(); continue; } InpMake(pad.Buttons); nFramesEmulated++; nCurrentFrame++; nFramesRendered++; pBurnDraw = (unsigned char *) video_frame_addr(tex_frame, 0, 0); BurnDrvFrame(); pBurnDraw = NULL; update_gui(); //sceDisplayWaitVblankStart(); } show_frame = draw_frame; draw_frame = sceGuSwapBuffers(); } scePowerSetClockFrequency(222, 222, 111); exit_gui(); DrvExit(); BurnLibExit(); InpExit(); sceKernelExitGame(); }