int WaveLogStart() { TCHAR szFilter[1024]; int nRet; int bOldPause; WaveLogStop(); // make sure old log is closed MakeOfn(szFilter); bOldPause = bRunPause; bRunPause = 1; nRet = GetSaveFileName(&ofn); bRunPause = bOldPause; if (nRet == 0) { return 1; } { WaveLog=_tfopen(szChoice,_T("wb")); if (WaveLog==NULL) { FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_DISK_CREATE)); FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_DISK_SOUND)); FBAPopupDisplay(PUF_TYPE_ERROR); return 1; } WaveLogHeaderStart(WaveLog,nAudSampleRate[nAudSelect]); } MenuEnableItems(); return 0; }
static int __cdecl MemCardDoEject(struct BurnArea* pba) { if (MemCardWrite(szMemoryCardFile, (unsigned char*)pba->Data, pba->nLen) == 0) { nMemoryCardStatus &= ~2; MenuEnableItems(); return 0; } return 1; }
static int __cdecl MemCardDoInsert(struct BurnArea* pba) { if (MemCardRead(szMemoryCardFile, (unsigned char*)pba->Data, pba->nLen)) { return 1; } nMemoryCardStatus |= 2; MenuEnableItems(); return 0; }
int WaveLogStop() { if (WaveLog) { WaveLogHeaderFillIn(WaveLog); fclose(WaveLog); WaveLog = NULL; MenuEnableItems(); } return 0; }
int MemCardCreate() { TCHAR szFilter[1024]; int nRet; _stprintf(szFilter, FBALoadStringEx(hAppInst, IDS_DISK_FILE_CARD, true), _T(APP_TITLE)); memcpy(szFilter + _tcslen(szFilter), _T(" (*.fc)\0*.fc\0\0"), 14 * sizeof(TCHAR)); _stprintf (szMemoryCardFile, _T("memorycard")); MakeOfn(); ofn.lpstrTitle = FBALoadStringEx(hAppInst, IDS_MEMCARD_CREATE, true); ofn.lpstrFilter = szFilter; ofn.Flags |= OFN_OVERWRITEPROMPT; int bOldPause = bRunPause; bRunPause = 1; nRet = GetSaveFileName(&ofn); bRunPause = bOldPause; if (nRet == 0) { return 1; } { unsigned char* pCard; MemCardGetSize(); pCard = (unsigned char*)malloc(nMemoryCardSize); memset(pCard, 0, nMemoryCardSize); bMemCardFC1Format = true; if (MemCardWrite(szMemoryCardFile, pCard, nMemoryCardSize)) { return 1; } if (pCard) { free(pCard); pCard = NULL; } } nMemoryCardStatus = 1; MenuEnableItems(); return 0; }
int MemCardSelect() { TCHAR szFilter[1024]; TCHAR* pszTemp = szFilter; int nRet; pszTemp += _stprintf(pszTemp, FBALoadStringEx(hAppInst, IDS_DISK_ALL_CARD, true)); memcpy(pszTemp, _T(" (*.fc, MEMCARD.\?\?\?)\0*.fc;MEMCARD.\?\?\?\0"), 38 * sizeof(TCHAR)); pszTemp += 38; pszTemp += _stprintf(pszTemp, FBALoadStringEx(hAppInst, IDS_DISK_FILE_CARD, true), _T(APP_TITLE)); memcpy(pszTemp, _T(" (*.fc)\0*.fc\0"), 13 * sizeof(TCHAR)); pszTemp += 13; pszTemp += _stprintf(pszTemp, FBALoadStringEx(hAppInst, IDS_DISK_FILE_CARD, true), _T("MAME")); memcpy(pszTemp, _T(" (MEMCARD.\?\?\?)\0MEMCARD.\?\?\?\0\0"), 28 * sizeof(TCHAR)); MakeOfn(); ofn.lpstrTitle = FBALoadStringEx(hAppInst, IDS_MEMCARD_SELECT, true); ofn.lpstrFilter = szFilter; int bOldPause = bRunPause; bRunPause = 1; nRet = GetOpenFileName(&ofn); bRunPause = bOldPause; if (nRet == 0) { return 1; } MemCardGetSize(); if (nMemoryCardSize <= 0) { return 1; } nMemoryCardStatus = 1; MenuEnableItems(); return 0; }
// With or without sound, run one frame. // If bDraw is true, it's the last frame before we are up to date, and so we should draw the screen static int RunFrame(int bDraw, int bPause) { static int bPrevPause = 0; static int bPrevDraw = 0; extern bool bDoPostInitialize; // Exit Jukebox properly if(bDoPostInitialize == true && bJukeboxInUse == true) { DrvExit(); bJukeboxDisplayed = false; bJukeboxInUse = false; bDoPostInitialize = false; POST_INITIALISE_MESSAGE; } if (bPrevDraw && !bPause) { VidPaint(0); // paint the screen (no need to validate) } if (!bDrvOkay) { return 1; } if (bPause && bJukeboxInUse == true) { GetInput(false); // Update burner inputs, but not game inputs if (bPause != bPrevPause) { VidPaint(2); // Redraw the screen (to ensure mode indicators are updated) } return 0; } if (!bPause && bJukeboxInUse == true) { //if (!bJukeboxDisplayed) JukeboxDialogCreate(); int TracklistDialog(); if (bJukeboxDisplayed == false) TracklistDialog(); nFramesEmulated++; nCurrentFrame++; BurnJukeboxFrame(); return 0; } if (bPause) { GetInput(false); // Update burner inputs, but not game inputs if (bPause != bPrevPause) { VidPaint(2); // Redraw the screen (to ensure mode indicators are updated) } } else { nFramesEmulated++; nCurrentFrame++; if (kNetGame) { GetInput(true); // Update inputs if (KailleraGetInput()) { // Synchronize input with Kaillera return 0; } } else { if (nReplayStatus == 2) { GetInput(false); // Update burner inputs, but not game inputs if (ReplayInput()) { // Read input from file bAltPause = 1; bRunPause = 1; MenuEnableItems(); InputSetCooperativeLevel(false, false); } } else { GetInput(true); // Update inputs } } if (nReplayStatus == 1) { RecordInput(); // Write input to file } if (bDraw) { nFramesRendered++; if (VidFrame()) { // Do one frame AudBlankSound(); } } else { // frame skipping pBurnDraw = NULL; // Make sure no image is drawn BurnDrvFrame(); } if (bShowFPS) { if (nDoFPS < nFramesRendered) { DisplayFPS(); nDoFPS = nFramesRendered + 30; } } } bPrevPause = bPause; bPrevDraw = bDraw; return 0; }
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; }
// With or without sound, run one frame. // If bDraw is true, it's the last frame before we are up to date, and so we should draw the screen static int RunFrame(int bDraw, int bPause) { static int bPrevPause = 0; static int bPrevDraw = 0; if (bPrevDraw && !bPause) { VidPaint(0); // paint the screen (no need to validate) } if (!bDrvOkay) { return 1; } if (bPause) { GetInput(false); // Update burner inputs, but not game inputs if (bPause != bPrevPause) { VidPaint(2); // Redraw the screen (to ensure mode indicators are updated) } } else { nFramesEmulated++; nCurrentFrame++; if (kNetGame) { GetInput(true); // Update inputs if (KailleraGetInput()) { // Synchronize input with Kaillera return 0; } } else { if (nReplayStatus == 2) { GetInput(false); // Update burner inputs, but not game inputs if (ReplayInput()) { // Read input from file bAltPause = 1; bRunPause = 1; MenuEnableItems(); InputSetCooperativeLevel(false, false); } } else { GetInput(true); // Update inputs } } if (nReplayStatus == 1) { RecordInput(); // Write input to file } if (bDraw) { nFramesRendered++; if (VidFrame()) { // Do one frame AudBlankSound(); } } else { // frame skipping pBurnDraw = NULL; // Make sure no image is drawn BurnDrvFrame(); } if (bShowFPS) { if (nDoFPS < nFramesRendered) { DisplayFPS(); nDoFPS = nFramesRendered + 30; } } } bPrevPause = bPause; bPrevDraw = bDraw; return 0; }
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; }