static int MjgtasteInit() { speedhack_address = 0x6000c; speedhack_pc[0] = 0x06031f04; speedhack_pc[1] = 0x0603214c; return DrvInit(MjgtasteLoadCallback, 1, 0x1400000, 0x0400000); }
static int SoldividInit() { speedhack_address = 0x00000c; speedhack_pc[0] = 0x0001AFAC; speedhack_pc[1] = 0x0001AE76; return DrvInit(SoldividLoadCallback, 0, 0x3800000, 0x2000000); }
static int DarakuInit() { speedhack_address = 0x00000c; speedhack_pc[0] = 0x0004761c; speedhack_pc[1] = 0x00047978; return DrvInit(DarakuLoadCallback, 0, 0x3400000, 0); }
void init_emu(int gamenum) { bBurnUseASMCPUEmulation=0; bCheatsAllowed=false; ConfigAppLoad(); ConfigAppSave(); DrvInit(gamenum,0); }
static int SbomberInit() { speedhack_address = 0x00000c; speedhack_pc[0] = 0x060A10EE; speedhack_pc[1] = 0x060A165A; speedhack_pc[2] = 0x060A1382; return DrvInit(SbomberLoadCallback, 0, 0x2800000, 0); }
static int Gunbird2Init() { speedhack_address = 0x004000c; speedhack_pc[0] = 0x06028be6; speedhack_pc[1] = 0x06028974; speedhack_pc[2] = 0x06028e64; return DrvInit(Gunbird2LoadCallback, 1, 0x3800000, 0); }
static int S1945iiInit() { speedhack_address = 0x00000c; speedhack_pc[0] = 0x0609fc6a; speedhack_pc[1] = 0x0609fed4; speedhack_pc[2] = 0x060A0172; return DrvInit(S1945iiLoadCallback, 0, 0x2000000, 0); }
static int demonwld3Init() { int nRet = DrvInit(); if (nRet == 0) { map_hack(0x1828); } return nRet; }
static int S1945iiiInit() { speedhack_address = 0x6000c; speedhack_pc[0] = 0x0602b464; speedhack_pc[1] = 0x0602b97c; speedhack_pc[2] = 0x0602b6e2; speedhack_pc[3] = 0x0602bc1e; return DrvInit(S1945iiiLoadCallback, 1, 0x3800000, 0); }
static int DragnblzInit() { speedhack_address = 0x6000c; speedhack_pc[0] = 0x06027440; speedhack_pc[1] = 0x060276e6; speedhack_pc[2] = 0x06027C74; speedhack_pc[3] = 0x060279A8; return DrvInit(DragnblzLoadCallback, 1, 0x2c00000, 0x0400000); }
static int Tgm2pInit() { speedhack_address = 0x6000c; speedhack_pc[0] = 0x0602ae5a; speedhack_pc[1] = 0x0602b1ac; speedhack_pc[2] = 0x0602b772; speedhack_pc[3] = 0x0602b3f2; return DrvInit(Tgm2LoadCallback, 1, 0x2c00000, 0x0c00000); }
static INT32 demonwld3Init() { INT32 nRet = DrvInit(); if (nRet == 0) { map_hack(0x1828); } return nRet; }
static int GnbarichInit() { speedhack_address = 0x6000c; speedhack_pc[0] = 0x0602CAE8; speedhack_pc[1] = 0x0602CD88; speedhack_pc[2] = 0x0602D2F0; speedhack_pc[3] = 0x0602D042; return DrvInit(GnbarichLoadCallback, 1, 0x2800000, 0x1800000); }
static int Tgm2Init() { speedhack_address = 0x6000c; speedhack_pc[0] = 0x0602895a; speedhack_pc[1] = 0x06028cac; speedhack_pc[2] = 0x06029272; speedhack_pc[3] = 0x06028ef2; return DrvInit(Tgm2LoadCallback, 1, 0x2c00000, 0x0c00000); }
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(); }
int ProcessCmdLine() { unsigned int i; int nOptX = 0, nOptY = 0, nOptD = 0; int nOpt1Size; TCHAR szOpt2[64] = _T(""); TCHAR szName[MAX_PATH]; if (szCmdLine[0] == _T('\"')) { int nLen = _tcslen(szCmdLine); nOpt1Size = 1; while (szCmdLine[nOpt1Size] != _T('\"') && nOpt1Size < nLen) { nOpt1Size++; } if (nOpt1Size == nLen) { szName[0] = 0; } else { nOpt1Size++; _tcsncpy(szName, szCmdLine + 1, nOpt1Size - 2); szName[nOpt1Size - 2] = 0; } } else { int nLen = _tcslen(szCmdLine); nOpt1Size = 0; while (szCmdLine[nOpt1Size] != _T(' ') && nOpt1Size < nLen) { nOpt1Size++; } _tcsncpy(szName, szCmdLine, nOpt1Size); szName[nOpt1Size] = 0; } if (_tcslen(szName)) { if (_tcscmp(szName, _T("-listinfo")) == 0) { write_datfile(0, stdout); return 1; } } _stscanf(&szCmdLine[nOpt1Size], _T("%64s %i x %i x %i"), szOpt2, &nOptX, &nOptY, &nOptD); if (_tcslen(szName)) { bool bFullscreen = 1; bCmdOptUsed = 1; if (_tcscmp(szOpt2, _T("-r")) == 0) { if (nOptX && nOptY) { nVidWidth = nOptX; nVidHeight = nOptY; } if (nOptD) { nVidDepth = nOptD; } } else if (_tcscmp(szOpt2, _T("-a")) == 0) { bVidArcaderes = 1; } else if (_tcscmp(szOpt2, _T("-w")) == 0) { bCmdOptUsed = 0; bFullscreen = 0; } else if (_tcsncmp(szOpt2, _T("-e"), 2) == 0) { bCmdOptUsed = 0; bFullscreen = 0; bHideLoadProgress = 1; nVidEmbeddedWindow = strtol(szOpt2 + 2, NULL, 16); /* Not unicode clean. =( */ if (!IsWindow((HWND)nVidEmbeddedWindow)) { nVidEmbeddedWindow = NULL; bFullscreen = 0; } } if (bFullscreen) { nVidFullscreen = 1; } if (_tcscmp(&szName[_tcslen(szName) - 3], _T(".fs")) == 0) { if (BurnStateLoad(szName, 1, &DrvInitCallback)) { return 1; } else { // bRunPause = 1; } } else { if (_tcscmp(&szName[_tcslen(szName) - 3], _T(".fr")) == 0) { if (StartReplay(szName)) { return 1; } } else if (_tcsncmp(szName, _T("quark:"), 6) == 0) { QuarkInit(szName); } else { for (i = 0; i < nBurnDrvCount; i++) { nBurnDrvSelect = i; if (_tcscmp(BurnDrvGetText(DRV_NAME), szName) == 0) { MediaInit(); DrvInit(i, true); break; } } if (i == nBurnDrvCount) { FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_UI_NOSUPPORT), szName, _T(APP_TITLE)); FBAPopupDisplay(PUF_TYPE_ERROR); return 1; } } } } POST_INITIALISE_MESSAGE; if (!nVidFullscreen) { MenuEnableItems(); } return 0; }
int DrvInitCallback() { return DrvInit(nBurnDrvActive, false); }
static int RenegadeInit() { return DrvInit(MCU_TYPE_RENEGADE); }
static int KuniokunInit() { return DrvInit(MCU_TYPE_KUNIOKUN); }
static int KuniokunbInit() { return DrvInit(MCU_TYPE_NONE); }
int ProcessCmdLine() { unsigned int i; int nOptX = 0, nOptY = 0, nOptD = 0; char szGameName[32] = "", szOpt[2] = ""; sscanf(szCmdLine, "%31s %1s %i x %i x %i", szGameName, szOpt, &nOptX, &nOptY, &nOptD); if (strlen(szGameName)) { bool bFullscreen = 1; for (i = 0; i < nBurnDrvCount; i++) { nBurnDrvSelect = i; if (strcmp(BurnDrvText(0), szGameName) == 0) { bCmdOptUsed = 1; if (strcmp(szOpt, "-r") == 0) { if (nOptX && nOptY) { nVidWidth = nOptX; nVidHeight = nOptY; } if (nOptD) { nVidDepth = nOptD; } } else { if (strcmp(szOpt, "-a") == 0) { bVidArcaderes = 1; } else { if (strcmp(szOpt, "-w") == 0) { bFullscreen = 0; } } } DrvInit(i); if (bDrvOkay && bFullscreen) { nVidFullscreen = 1; } PostMessage(NULL, WM_APP + 0, 0, 0); break; } } if (i == nBurnDrvCount) { char szErrorString[128]; sprintf(szErrorString, "%s is not supported by Final Burn Alpha.", szGameName); AppError(szErrorString, 0); return 1; } } return 0; }
static status_t DevDoLoadDriver(const wchar_t *name, driver_t **driver) { if (_wcsicmp(name, L"ramfs") == 0) *driver = &rd_driver; else if (_wcsicmp(name, L"portfs") == 0) *driver = &port_driver; else if (_wcsicmp(name, L"devfs") == 0) *driver = &devfs_driver; else if (_wcsicmp(name, L"vfs") == 0) *driver = &vfs_driver; else if (_wcsicmp(name, L"tarfs") == 0) *driver = &tarfs_driver; #ifdef WIN32 else if (_wcsicmp(name, L"win32fs") == 0) *driver = &win32fs_driver; #endif else { wchar_t temp[50]; module_t *mod; driver_t *drv; bool (*DrvInit)(driver_t *drv); swprintf(temp, L"%s.drv", name); mod = PeLoad(&proc_idle, temp, 0); if (mod == NULL) { *driver = NULL; return errno; } FOREACH(drv, drv) if (drv->mod == mod) { *driver = drv; return 0; } drv = malloc(sizeof(driver_t)); if (drv == NULL) { PeUnload(&proc_idle, mod); *driver = NULL; return errno; } drv->mod = mod; drv->add_device = NULL; drv->mount_fs = NULL; DrvInit = (void*) mod->entry; if (DrvInit == NULL || !DrvInit(drv)) { PeUnload(&proc_idle, mod); free(drv); *driver = NULL; return errno; } LIST_ADD(drv, drv); *driver = drv; } return 0; }
extern void strategy(ReqPtr p) { word rc, dseg; switch (p->cmd) { case DevInit: devhlp = p->u.ini.devhlp; dseg = ctors(); if ((rc = DrvInit(p->u.ini.cmdline)) & ERROR) { p->u.ino.nunits = 0; p->u.ino.endCode = 0; p->u.ino.endData = 0; } else { p->u.ino.endCode = Offset(&end_code); p->u.ino.endData = dseg; } p->u.ino.bpb = 0; break; case DevBaseInit: devhlp = p->u.ini.devhlp; dseg = ctors(); if ((rc = DrvInitBase(p->u.ini.cmdline)) & ERROR) { p->u.ino.nunits = 0; p->u.ino.endCode = 0; p->u.ino.endData = 0; } else { p->u.ino.endCode = Offset(&end_code); p->u.ino.endData = dseg; p->u.ini.cmdline = 0; } p->u.ino.bpb = 0; break; case DevRead: PUTS(2, "DevRead file="); PUTD(2, p->u.rw.fileno); PUTS(2, ", count="); PUTD(2, p->u.rw.count); PUTC(2, '\n'); rc = DrvRead(p); break; case DevWrite: PUTS(2, "DevWrite file="); PUTD(2, p->u.rw.fileno); PUTS(2, ", count="); PUTD(2, p->u.rw.count); PUTC(2, '\n'); rc = DrvWrite(p, 0); break; case DevWriteVerify: PUTS(2, "DevWriteVerify file="); PUTD(2, p->u.rw.fileno); PUTS(2, ", count="); PUTD(2, p->u.rw.count); PUTC(2, '\n'); rc = DrvWrite(p, 1); break; case DevPeek: PUTS(2, "DevPeek\n"); rc = DrvPeek(p); break; case DevInputStatus: PUTS(2, "DevInputStatus\n"); rc = DrvInputStatus(); break; case DevInputFlush: PUTS(2, "DevInputFlush\n"); rc = DrvInputFlush(); break; case DevOutputStatus: PUTS(2, "DevOutputStatus\n"); rc = DrvOutputStatus(); break; case DevOutputFlush: PUTS(2, "DevOutputFlush\n"); rc = DrvOutputFlush(); break; case DevOpen: PUTS(2, "DevOpen file="); PUTD(2, p->u.oc.fileno); PUTC(2, '\n'); rc = DrvOpen(p); break; case DevClose: PUTS(2, "DevClose file="); PUTD(2, p->u.oc.fileno); PUTC(2, '\n'); rc = DrvClose(p); break; case DevIOCtl: PUTS(2, "DevIOCtl cat="); PUTX(2, p->u.ioc.cat); PUTS(2, ", fcn="); PUTX(2, p->u.ioc.fcn); PUTS(2, ", plen="); PUTD(2, p->u.ioc.plen); PUTS(2, ", dlen="); PUTD(2, p->u.ioc.dlen); PUTC(2, '\n'); rc = DrvIOCtl(p); break; default: rc = ERROR + DONE + InvalidCommand; } PUTS(2, "Status="); PUTX(2, rc); PUTC(2, '\n'); p->status = rc; }
int ProcessCmdLine() { unsigned int i; int nOptX = 0, nOptY = 0, nOptD = 0; int nOpt1Size; TCHAR szOpt2[3] = _T(""); TCHAR szName[MAX_PATH]; if (szCmdLine[0] == _T('\"')) { int nLen = _tcslen(szCmdLine); nOpt1Size = 1; while (szCmdLine[nOpt1Size] != _T('\"') && nOpt1Size < nLen) { nOpt1Size++; } if (nOpt1Size == nLen) { szName[0] = 0; } else { nOpt1Size++; _tcsncpy(szName, szCmdLine + 1, nOpt1Size - 2); szName[nOpt1Size - 2] = 0; } } else { int nLen = _tcslen(szCmdLine); nOpt1Size = 0; while (szCmdLine[nOpt1Size] != _T(' ') && nOpt1Size < nLen) { nOpt1Size++; } _tcsncpy(szName, szCmdLine, nOpt1Size); szName[nOpt1Size] = 0; } if (_tcslen(szName)) { if (_tcscmp(szName, _T("-listinfo")) == 0) { write_datfile(0, 0, stdout); return 1; } if (_tcscmp(szName, _T("-listinfowithmd")) == 0) { write_datfile(0, 1, stdout); return 1; } if (_tcscmp(szName, _T("-listinfomdonly")) == 0) { write_datfile(0, 2, stdout); return 1; } if (_tcscmp(szName, _T("-listextrainfo")) == 0) { int nWidth; int nHeight; int nAspectX; int nAspectY; for (i = 0; i < nBurnDrvCount; i++) { nBurnDrvSelect = i; BurnDrvGetVisibleSize(&nWidth, &nHeight); BurnDrvGetAspect(&nAspectX, &nAspectY); printf("%s\t%ix%i\t%i:%i\t0x%08X\t\"%s\"\t%i\t%i\t%x\t%x\t\"%s\"\n", BurnDrvGetTextA(DRV_NAME), nWidth, nHeight, nAspectX, nAspectY, BurnDrvGetHardwareCode(), BurnDrvGetTextA(DRV_SYSTEM), BurnDrvIsWorking(), BurnDrvGetMaxPlayers(), BurnDrvGetGenreFlags(), BurnDrvGetFamilyFlags(), BurnDrvGetTextA(DRV_COMMENT)); } return 1; } } _stscanf(&szCmdLine[nOpt1Size], _T("%2s %i x %i x %i"), szOpt2, &nOptX, &nOptY, &nOptD); if (_tcslen(szName)) { bool bFullscreen = 1; bCmdOptUsed = 1; if (_tcscmp(szOpt2, _T("-r")) == 0) { if (nOptX && nOptY) { nVidWidth = nOptX; nVidHeight = nOptY; } if (nOptD) { nVidDepth = nOptD; } } else { if (_tcscmp(szOpt2, _T("-a")) == 0) { bVidArcaderes = 1; } else { if (_tcscmp(szOpt2, _T("-w")) == 0) { bCmdOptUsed = 0; bFullscreen = 0; } } } if (bFullscreen) { nVidFullscreen = 1; } if (_tcscmp(&szName[_tcslen(szName) - 3], _T(".fs")) == 0) { if (BurnStateLoad(szName, 1, &DrvInitCallback)) { return 1; } else { // bRunPause = 1; } } else { if (_tcscmp(&szName[_tcslen(szName) - 3], _T(".fr")) == 0) { if (StartReplay(szName)) { return 1; } } else { for (i = 0; i < nBurnDrvCount; i++) { nBurnDrvSelect = i; if (_tcscmp(BurnDrvGetText(DRV_NAME), szName) == 0) { MediaInit(); DrvInit(i, true); break; } } if (i == nBurnDrvCount) { FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_UI_NOSUPPORT), szName, _T(APP_TITLE)); FBAPopupDisplay(PUF_TYPE_ERROR); return 1; } } } } POST_INITIALISE_MESSAGE; if (!nVidFullscreen) { MenuEnableItems(); } return 0; }
int DrvInitCallback() { return DrvInit(nBurnDrvSelect[0], false); }
static void process_key( int key, int down, int repeat ) { if ( !down ) return ; switch( nGameStage ) { /* ---------------------------- Main Menu ---------------------------- */ case 1: //ui_mainmenu_select switch( key ) { case PSP_CTRL_UP: if (ui_mainmenu_select <= 0) break; ui_mainmenu_select--; draw_ui_main(); break; case PSP_CTRL_DOWN: if (ui_mainmenu_select >=9 ) break; ui_mainmenu_select++; draw_ui_main(); break; case PSP_CTRL_LEFT: switch(ui_mainmenu_select) { case 7: if ( cpu_speeds_select > 0 ) { cpu_speeds_select--; draw_ui_main(); } break; } break; case PSP_CTRL_RIGHT: switch(ui_mainmenu_select) { case 7: if ( cpu_speeds_select < 3 ) { cpu_speeds_select++; draw_ui_main(); } break; } break; case PSP_CTRL_CIRCLE: switch( ui_mainmenu_select ) { case 0: nGameStage = 2; strcpy(ui_current_path, szAppRomPath); //ui_current_path[strlen(ui_current_path)-1] = 0; draw_ui_browse(true); break; case 8: // Return to Game if ( nPrevGame < nBurnDrvCount ) { scePowerSetClockFrequency( cpu_speeds[cpu_speeds_select].cpu, cpu_speeds[cpu_speeds_select].cpu, cpu_speeds[cpu_speeds_select].bus ); nGameStage = 0; } break; case 9: // Exit bGameRunning = 0; break; } break; } break; /* ---------------------------- Rom Browse ---------------------------- */ case 2: switch( key ) { case PSP_CTRL_UP: if (find_rom_select == 0) break; if (find_rom_top >= find_rom_select) find_rom_top--; find_rom_select--; draw_ui_browse(false); break; case PSP_CTRL_DOWN: if ((find_rom_select+1) >= find_rom_count) break; find_rom_select++; if ((find_rom_top + find_rom_list_cnt) <= find_rom_select) find_rom_top++; draw_ui_browse(false); break; case PSP_CTRL_CIRCLE: switch( getRomsFileStat(find_rom_select) ) { case -1: // directry { // printf("change dir %s\n", getRomsFileName(find_rom_select) ); char * pn = getRomsFileName(find_rom_select); if ( strcmp("..", pn) ) { strcat(ui_current_path, getRomsFileName(find_rom_select)); strcat(ui_current_path, "/"); } else { if (strlen(strstr(ui_current_path, ":/")) == 2) break; // "ROOT:/" for(int l = strlen(ui_current_path)-1; l>1; l-- ) { ui_current_path[l] = 0; if (ui_current_path[l-1] == '/') break; } } //printf("change dir to %s\n", ui_current_path ); find_rom_count = 0; find_rom_select = 0; find_rom_top = 0; draw_ui_browse(true); } break; default: // rom zip file { nBurnDrvSelect = (unsigned int)getRomsFileStat( find_rom_select ); if (nBurnDrvSelect <= nBurnDrvCount && BurnDrvIsWorking() ) { if ( DrvInit( nBurnDrvSelect, false ) == 0 ) { BurnRecalcPal(); InpInit(); InpDIP(); scePowerSetClockFrequency( cpu_speeds[cpu_speeds_select].cpu, cpu_speeds[cpu_speeds_select].cpu, cpu_speeds[cpu_speeds_select].bus ); nGameStage = 0; } else nBurnDrvSelect = ~0U; } else nBurnDrvSelect = ~0U; nPrevGame = nBurnDrvSelect; //if (nBurnDrvSelect == ~0U) { // bprintf(0, "unkown rom %s", getRomsFileName(find_rom_select)); //} } } break; case PSP_CTRL_CROSS: // cancel nGameStage = 1; draw_ui_main(); break; } break; /* ---------------------------- DIP Setting ---------------------------- */ case 3: break; } }