static int __cdecl BArchiveBurnLoadRom(unsigned char* Dest, int* pnWrote, int i) { if (i < 0 || i >= nRomCount || !RomFind) { return 1; } BurnRomInfo ri; memset(&ri, 0, sizeof(ri)); BurnDrvGetRomInfo(&ri, i); // Get info // show what we're doing char* pszRomName = NULL; BurnDrvGetRomName(&pszRomName, i, 0); if (pszRomName == NULL) { pszRomName = "unknown"; } TCHAR szText[MAX_PATH]; _stprintf(szText, _T("Loading")); if (ri.nType & (BRF_PRG | BRF_GRA | BRF_SND | BRF_BIOS)) { if (ri.nType & BRF_BIOS) { _stprintf (szText + _tcslen(szText), _T(" %s"), _T("BIOS ")); } if (ri.nType & BRF_PRG) { _stprintf (szText + _tcslen(szText), _T(" %s"), _T("program ")); } if (ri.nType & BRF_GRA) { _stprintf (szText + _tcslen(szText), _T(" %s"), _T("graphics ")); } if (ri.nType & BRF_SND) { _stprintf (szText + _tcslen(szText), _T(" %s"), _T("sound ")); } _stprintf(szText + _tcslen(szText), _T("(%hs)..."), pszRomName); } else { _stprintf(szText + _tcslen(szText), _T(" %hs..."), pszRomName); } ProgressUpdateBurner(ri.nLen ? 1.0 / ((double)nTotalSize / ri.nLen) : 0, szText, 0); #if defined (_WIN32) // Check for messages: MSG Msg; while (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) { DispatchMessage(&Msg); } #endif #ifndef LOAD_OPT_ROM // skip loading optional rom if (ri.nType & BRF_OPT) { return 0; } #endif if (RomFind[i].nState == STAT_NOFIND) { // Rom not found in archive at all return 1; } int nWantZip = RomFind[i].nArchive; // Which archive file it is in if (nCurrentArc != nWantZip) { // If we haven't got the right archive file currently open archiveClose(); nCurrentArc = -1; if (archiveOpen(szBArchiveName[nWantZip])) { return 1; } nCurrentArc = nWantZip; } // Read in file and return how many bytes we read if (archiveLoadFile(Dest, ri.nLen, RomFind[i].nPos, pnWrote)) { // Error loading from the archive file FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_LOAD_DISK), pszRomName, getFilenameW(szBArchiveName[nCurrentArc])); FBAPopupDisplay(PUF_TYPE_WARNING); return 1; } return 0; }
static int __cdecl BArchiveBurnLoadRom(unsigned char* Dest, int* pnWrote, int i) { if (i < 0 || i >= nRomCount || !RomFind) { return 1; } BurnRomInfo ri; memset(&ri, 0, sizeof(ri)); BurnDrvGetRomInfo(&ri, i); // Get info // show what we're doing char* pszRomName = NULL; BurnDrvGetRomName(&pszRomName, i, 0); if (pszRomName == NULL) { pszRomName = "unknown"; } TCHAR szText[MAX_PATH]; _stprintf(szText, _T("Loading")); if (ri.nType & (BRF_PRG | BRF_GRA | BRF_SND | BRF_BIOS)) { if (ri.nType & BRF_BIOS) { _stprintf (szText + _tcslen(szText), _T(" %s"), _T("BIOS ")); } if (ri.nType & BRF_PRG) { _stprintf (szText + _tcslen(szText), _T(" %s"), _T("program ")); } if (ri.nType & BRF_GRA) { _stprintf (szText + _tcslen(szText), _T(" %s"), _T("graphics ")); } if (ri.nType & BRF_SND) { _stprintf (szText + _tcslen(szText), _T(" %s"), _T("sound ")); } _stprintf(szText + _tcslen(szText), _T("(%hs)..."), pszRomName); } else { _stprintf(szText + _tcslen(szText), _T(" %hs..."), pszRomName); } ProgressUpdateBurner(ri.nLen ? 1.0 / ((double)nTotalSize / ri.nLen) : 0, szText, 0); #ifndef LOAD_OPT_ROM // skip loading optional rom if (ri.nType & BRF_OPT) { return 0; } #endif if (RomFind[i].nState == STAT_NOFIND) { // Rom not found in archive at all return 1; } int nWantZip = RomFind[i].nArchive; // Which archive file it is in if (nCurrentArc != nWantZip) { // If we haven't got the right archive file currently open archiveClose(); nCurrentArc = -1; if (archiveOpen(szBArchiveName[nWantZip])) { return 1; } nCurrentArc = nWantZip; } // Read in file and return how many bytes we read if (archiveLoadFile(Dest, ri.nLen, RomFind[i].nPos, pnWrote)) { // Error loading from the archive file return 1; } return 0; }