static int __cdecl BzipBurnLoadRom(unsigned char* Dest, int* pnWrote, int i) { #if defined (BUILD_WIN32) MSG Msg; #endif struct BurnRomInfo ri; int nWantZip = 0; TCHAR szText[128]; char* pszRomName = NULL; int nRet = 0; if (i < 0 || i >= nRomCount) { return 1; } ri.nLen = 0; BurnDrvGetRomInfo(&ri, i); // Get info // show what we're doing BurnDrvGetRomName(&pszRomName, i, 0); if (pszRomName == NULL) { pszRomName = "unknown"; } _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 (BUILD_WIN32) // Check for messages: while (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) { DispatchMessage(&Msg); } #endif if (RomFind[i].nState == 0) { // Rom not found in zip at all TCHAR szTemp[128] = _T(""); _stprintf(szTemp, "%s (not found)\n",szText); fprintf(stderr, szTemp); AppError(szTemp, 1); return 1; } nWantZip = RomFind[i].nZip; // Which zip file it is in if (nCurrentZip != nWantZip) { // If we haven't got the right zip file currently open ZipClose(); nCurrentZip = -1; if (ZipOpen(TCHARToANSI(szBzipName[nWantZip], NULL, 0))) { return 1; } nCurrentZip = nWantZip; } // Read in file and return how many bytes we read if (ZipLoadFile(Dest, ri.nLen, pnWrote, RomFind[i].nPos)) { // Error loading from the zip file TCHAR szTemp[128] = _T(""); _stprintf(szTemp, _T("%s reading %.30hs from %.30s"), nRet == 2 ? _T("CRC error") : _T("Error"), pszRomName, GetFilenameW(szBzipName[nCurrentZip])); fprintf(stderr, szTemp); AppError(szTemp, 1); return 1; } fprintf(stderr, "%s (OK)\n", szText); return 0; }
static int __cdecl BzipBurnLoadRom(unsigned char* Dest, int* pnWrote, int i) { struct BurnRomInfo ri; int nWantZip = 0; TCHAR szText[128]; char* pszRomName = NULL; //int nRet = 0; if (i < 0 || i >= nRomCount) { return 1; } ri.nLen = 0; BurnDrvGetRomInfo(&ri, i); // Get info // show what we're doing BurnDrvGetRomName(&pszRomName, i, 0); if (pszRomName == NULL) { pszRomName = "unknown"; } sprintf(szText, "%-12s ... %4dKb", pszRomName, ri.nLen/1024 ); if (ri.nType & (BRF_PRG | BRF_GRA | BRF_SND | BRF_BIOS)) { if (ri.nType & BRF_BIOS) { sprintf (szText + strlen(szText), " %s", "BIOS "); } if (ri.nType & BRF_PRG) { sprintf (szText + strlen(szText), " %s", "program "); } if (ri.nType & BRF_GRA) { sprintf (szText + strlen(szText), " %s", "graphics "); } if (ri.nType & BRF_SND) { sprintf (szText + strlen(szText), " %s", "sound "); } } ProgressUpdateBurner(ri.nLen ? 1.0 / ((double)nTotalSize / ri.nLen) : 0, szText, 0); // FIXME: eliminate later in favor of ProgressUpdateBurner show_rom_loading_text(szText, ri.nLen, nTotalSize); if (RomFind[i].nState == 0) { // Rom not found in zip at all TCHAR szTemp[128] = _T(""); _stprintf(szTemp, "%s (not found)\n",szText); fprintf(stderr,szTemp); ProgressError(szTemp, 1); return 1; } nWantZip = RomFind[i].nZip; // Which zip file it is in if (nCurrentZip != nWantZip) { // If we haven't got the right zip file currently open ZipClose(); nCurrentZip = -1; if (ZipOpen(szBzipName[nWantZip])) { printf("%s (open zip err: %s)\n", szText, szBzipName[nWantZip]); return 1; } nCurrentZip = nWantZip; } // Read in file and return how many bytes we read if (ZipLoadFile(Dest, ri.nLen, pnWrote, RomFind[i].nPos)) { printf("%s (ERR)\n", szText); return 1; } printf("%s (OK)\n", szText); 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); #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; }