int SndInit() { if (config_options.option_sound_enable) { if ((BurnDrvGetHardwareCode() == HARDWARE_CAPCOM_CPS1) || (BurnDrvGetHardwareCode() == HARDWARE_CAPCOM_CPS1_GENERIC)) //if (1==0) { /*nBurnSoundRate = 11025; nAudioChannels = 1; BUFFSIZE=512; NUM_BUFS=4; expectedperframe=734;*/ nAudioChannels = 2; nBurnSoundRate = 11025; BUFFSIZE=2048/2; NUM_BUFS=6; expectedperframe=1468/2; // printf("using low snd for cps1\n"); } else { switch(config_options.option_samplerate) { case 1: nBurnSoundRate = 22050; BUFFSIZE=2048; NUM_BUFS=6; expectedperframe=1468; break; case 2: nBurnSoundRate = 44100; BUFFSIZE=4096; NUM_BUFS=10; expectedperframe=2936; break; default: nBurnSoundRate = 11025; BUFFSIZE=1024; NUM_BUFS=5; expectedperframe=734; break; } } nBurnSoundLen = ((nBurnSoundRate * 100 /*+ 3000*/) / nBurnFPS ); } pBurnSoundOut = NULL; AudioCurBlock = 0; dspfd = -1; return 0; }
static INT32 pgmMemIndex() { UINT8 *Next; Next = Mem; PGM68KBIOS = Next; Next += 0x0080000; PGM68KROM = Next; Next += nPGM68KROMLen; PGMUSER0 = Next; Next += nPGMExternalARMLen; PGMProtROM = PGMUSER0 + 0x10000; // Olds, Killbld, drgw3 if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { PGMARMROM = Next; Next += 0x0004000; } RamStart = Next; PGM68KRAM = Next; Next += 0x0020000; RamZ80 = Next; Next += 0x0010000; if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { PGMARMShareRAM = Next; Next += 0x0010000; PGMARMShareRAM2 = Next; Next += 0x0010000; PGMARMRAM0 = Next; Next += 0x0001000; // minimum map is 0x1000 - should be 0x400 PGMARMRAM1 = Next; Next += 0x0040000; PGMARMRAM2 = Next; Next += 0x0001000; // minimum map is 0x1000 - should be 0x400 } PGMBgRAM = (UINT32 *) Next; Next += 0x0001000; PGMTxtRAM = (UINT32 *) Next; Next += 0x0002000; PGMRowRAM = (UINT16 *) Next; Next += 0x0001000; // Row Scroll PGMPalRAM = (UINT16 *) Next; Next += 0x0001400; // Palette R5G5B5 PGMVidReg = (UINT16 *) Next; Next += 0x0010000; // Video Regs inc. Zoom Table PGMSprBuf = (UINT16 *) Next; Next += 0x0000a00; RamEnd = Next; RamCurPal = (UINT32 *) Next; Next += (0x0001204 / 2) * sizeof(UINT32); MemEnd = Next; return 0; }
static int pgmMemIndex() { unsigned char *Next; Next = Mem; PGM68KBIOS = Next; Next += 0x0080000; PGM68KROM = Next; Next += nPGM68KROMLen; PGMUSER0 = Next; Next += nPGMExternalARMLen; if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { PGMARMROM = Next; Next += 0x0004000; } RamStart = Next; PGM68KRAM = Next; Next += 0x0020000; RamZ80 = Next; Next += 0x0010000; if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { PGMARMShareRAM = Next; Next += 0x0020000; PGMARMShareRAM2 = Next; Next += 0x0020000; PGMARMRAM0 = Next; Next += 0x0001000; // minimum map is 0x1000 - should be 0x400 PGMARMRAM1 = Next; Next += 0x0040000; PGMARMRAM2 = Next; Next += 0x0001000; // minimum map is 0x1000 - should be 0x400 } PGMBgRAM = (unsigned int *) Next; Next += 0x0001000; PGMTxtRAM = (unsigned int *) Next; Next += 0x0002000; PGMRowRAM = (unsigned short *) Next; Next += 0x0001000; // Row Scroll PGMPalRAM = (unsigned short *) Next; Next += 0x0001400; // Palette R5G5B5 PGMVidReg = (unsigned short *) Next; Next += 0x0010000; // Video Regs inc. Zoom Table PGMSprBuf = (unsigned short *) Next; Next += 0x0000a00; RamEnd = Next; RamCurPal = (unsigned int *) Next; Next += (0x0001202 / 2) * sizeof(unsigned int); MemEnd = Next; return 0; }
// init autofire buttons void __cdecl initAutofire() { if (!nAutofireEnabled) return; // check delay value if (autofireDelay < 1 || autofireDelay > 99) autofireDelay = autofireDefaultDelay; delayCounter = autofireDelay; // choose autofire method method2 = false; int flag = (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK); if (flag == HARDWARE_IGS_PGM) method2 = true; // reset values resetAutofire(); // get button info int nButtons = 0; // buttons per player int nPlayer = 0; int nPlayerTemp = 0; BurnInputInfo bii; for (unsigned int i = 0; i < nGameInpCount; i++) { memset(&bii, 0, sizeof(bii)); BurnDrvGetInputInfo(&bii, i); if (!bii.szName || !bii.pVal) continue; if ((bii.szName[0] == 'P' || bii.szName[0] == 'p') && bii.szName[1] >= '1' && bii.szName[1] <= '4') { nPlayer = bii.szName[1] - '1'; if (nPlayer != nPlayerTemp) { // if it is next player // autofireSize = nButtons; nButtons = 0; } if (!strncmp(" fire", bii.szInfo + 2, 5) && nButtons < MAX_AUTOFIRE_BUTTONS) { autofires[nPlayer][nButtons].value = bii.pVal; autofires[nPlayer][nButtons].inpIndex = i; nButtons++; } nPlayerTemp = nPlayer; } } }
int PcmInit() { memset(Reg,0,sizeof(Reg)); memset(&ChanPos,0,sizeof(ChanPos)); memset(&ChanBank,0,sizeof(ChanBank)); if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2203) { PcmSpeed *= 2; } if (PcmRate>0) { // Make the ChanPos increment value IncVal=(PcmSpeed<<FRAC_SHIFT)/PcmRate; } return 0; }
static int DoLibInit() // Do Init of Burn library driver { int nRet = 0; if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) != HARDWARE_SNK_MVS) { ProgressCreate(); } if (DrvBzipOpen()) { return 1; } nRet = BurnDrvInit(); BzipClose(); ProgressDestroy(); if (nRet) { return 3; } else { return 0; } }
static void GameInpInitMacros() { struct GameInp* pgi; struct BurnInputInfo bii; INT32 nPunchx3[4] = {0, 0, 0, 0}; INT32 nPunchInputs[4][3]; INT32 nKickx3[4] = {0, 0, 0, 0}; INT32 nKickInputs[4][3]; INT32 nNeogeoButtons[4][4]; INT32 nPgmButtons[10][4]; bStreetFighterLayout = false; nMacroCount = 0; nFireButtons = 0; memset(&nNeogeoButtons, 0, sizeof(nNeogeoButtons)); memset(&nPgmButtons, 0, sizeof(nPgmButtons)); for (UINT32 i = 0; i < nGameInpCount; i++) { bii.szName = NULL; BurnDrvGetInputInfo(&bii, i); if (bii.szName == NULL) { bii.szName = ""; } bool bPlayerInInfo = (toupper(bii.szInfo[0]) == 'P' && bii.szInfo[1] >= '1' && bii.szInfo[1] <= '4'); // Because some of the older drivers don't use the standard input naming. bool bPlayerInName = (bii.szName[0] == 'P' && bii.szName[1] >= '1' && bii.szName[1] <= '4'); if (bPlayerInInfo || bPlayerInName) { INT32 nPlayer = 0; if (bPlayerInName) nPlayer = bii.szName[1] - '1'; if (bPlayerInInfo && nPlayer == 0) nPlayer = bii.szInfo[1] - '1'; if (nPlayer == 0) { if (strncmp(" fire", bii.szInfo + 2, 5) == 0) { nFireButtons++; } } if (_stricmp(" Weak Punch", bii.szName + 2) == 0) { nPunchx3[nPlayer] |= 1; nPunchInputs[nPlayer][0] = i; } if (_stricmp(" Medium Punch", bii.szName + 2) == 0) { nPunchx3[nPlayer] |= 2; nPunchInputs[nPlayer][1] = i; } if (_stricmp(" Strong Punch", bii.szName + 2) == 0) { nPunchx3[nPlayer] |= 4; nPunchInputs[nPlayer][2] = i; } if (_stricmp(" Weak Kick", bii.szName + 2) == 0) { nKickx3[nPlayer] |= 1; nKickInputs[nPlayer][0] = i; } if (_stricmp(" Medium Kick", bii.szName + 2) == 0) { nKickx3[nPlayer] |= 2; nKickInputs[nPlayer][1] = i; } if (_stricmp(" Strong Kick", bii.szName + 2) == 0) { nKickx3[nPlayer] |= 4; nKickInputs[nPlayer][2] = i; } if ((BurnDrvGetHardwareCode() & (HARDWARE_PUBLIC_MASK - HARDWARE_PREFIX_CARTRIDGE)) == HARDWARE_SNK_NEOGEO) { if (_stricmp(" Button A", bii.szName + 2) == 0) { nNeogeoButtons[nPlayer][0] = i; } if (_stricmp(" Button B", bii.szName + 2) == 0) { nNeogeoButtons[nPlayer][1] = i; } if (_stricmp(" Button C", bii.szName + 2) == 0) { nNeogeoButtons[nPlayer][2] = i; } if (_stricmp(" Button D", bii.szName + 2) == 0) { nNeogeoButtons[nPlayer][3] = i; } } //if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_IGS_PGM) { { // Use nPgmButtons for Autofire too -dink if ((_stricmp(" Button 1", bii.szName + 2) == 0) || (_stricmp(" fire 1", bii.szInfo + 2) == 0)) { nPgmButtons[nPlayer][0] = i; } if ((_stricmp(" Button 2", bii.szName + 2) == 0) || (_stricmp(" fire 2", bii.szInfo + 2) == 0)) { nPgmButtons[nPlayer][1] = i; } if ((_stricmp(" Button 3", bii.szName + 2) == 0) || (_stricmp(" fire 3", bii.szInfo + 2) == 0)) { nPgmButtons[nPlayer][2] = i; } if ((_stricmp(" Button 4", bii.szName + 2) == 0) || (_stricmp(" fire 4", bii.szInfo + 2) == 0)) { nPgmButtons[nPlayer][3] = i; } if ((_stricmp(" Button 5", bii.szName + 2) == 0) || (_stricmp(" fire 5", bii.szInfo + 2) == 0)) { nPgmButtons[nPlayer][4] = i; } if ((_stricmp(" Button 6", bii.szName + 2) == 0) || (_stricmp(" fire 6", bii.szInfo + 2) == 0)) { nPgmButtons[nPlayer][5] = i; } } } } pgi = GameInp + nGameInpCount; { // Mappable system macros -dink pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; pgi->Macro.nSysMacro = 1; sprintf(pgi->Macro.szName, "System Pause"); pgi->Macro.pVal[0] = ¯oSystemPause; pgi->Macro.nVal[0] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; pgi->Macro.nSysMacro = 1; sprintf(pgi->Macro.szName, "System FFWD"); pgi->Macro.pVal[0] = ¯oSystemFFWD; pgi->Macro.nVal[0] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; pgi->Macro.nSysMacro = 1; sprintf(pgi->Macro.szName, "System Load State"); pgi->Macro.pVal[0] = ¯oSystemLoadState; pgi->Macro.nVal[0] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; pgi->Macro.nSysMacro = 1; sprintf(pgi->Macro.szName, "System Save State"); pgi->Macro.pVal[0] = ¯oSystemSaveState; pgi->Macro.nVal[0] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; pgi->Macro.nSysMacro = 1; sprintf(pgi->Macro.szName, "System UNDO State"); pgi->Macro.pVal[0] = ¯oSystemUNDOState; pgi->Macro.nVal[0] = 1; nMacroCount++; pgi++; } { // Autofire!!! for (INT32 nPlayer = 0; nPlayer < nMaxPlayers; nPlayer++) { for (INT32 i = 0; i < nFireButtons; i++) { pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; pgi->Macro.nSysMacro = 15; // 15 = Auto-Fire mode if ((BurnDrvGetHardwareCode() & (HARDWARE_PUBLIC_MASK - HARDWARE_PREFIX_CARTRIDGE)) == HARDWARE_SEGA_MEGADRIVE) { if (i < 3) { sprintf(pgi->Macro.szName, "P%d Auto-Fire Button %c", nPlayer+1, i+'A'); // A,B,C } else { sprintf(pgi->Macro.szName, "P%d Auto-Fire Button %c", nPlayer+1, i+'X'-3); // X,Y,Z } } else { sprintf(pgi->Macro.szName, "P%d Auto-Fire Button %d", nPlayer+1, i+1); } if ((BurnDrvGetHardwareCode() & (HARDWARE_PUBLIC_MASK - HARDWARE_PREFIX_CARTRIDGE)) == HARDWARE_SNK_NEOGEO) { BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][i]); } else { BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][i]); } pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; nMacroCount++; pgi++; } } } for (INT32 nPlayer = 0; nPlayer < nMaxPlayers; nPlayer++) { if (nPunchx3[nPlayer] == 7) { // Create a 3x punch macro pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i 3× Punch", nPlayer + 1); for (INT32 j = 0; j < 3; j++) { BurnDrvGetInputInfo(&bii, nPunchInputs[nPlayer][j]); pgi->Macro.pVal[j] = bii.pVal; pgi->Macro.nVal[j] = 1; } nMacroCount++; pgi++; } if (nKickx3[nPlayer] == 7) { // Create a 3x kick macro pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i 3× Kick", nPlayer + 1); for (INT32 j = 0; j < 3; j++) { BurnDrvGetInputInfo(&bii, nKickInputs[nPlayer][j]); pgi->Macro.pVal[j] = bii.pVal; pgi->Macro.nVal[j] = 1; } nMacroCount++; pgi++; } if (nFireButtons == 4 && (BurnDrvGetHardwareCode() & (HARDWARE_PUBLIC_MASK - HARDWARE_PREFIX_CARTRIDGE)) == HARDWARE_SNK_NEOGEO) { pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons AB", nPlayer + 1); BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][0]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][1]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons AC", nPlayer + 1); BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][0]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][2]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons AD", nPlayer + 1); BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][0]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][3]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons BC", nPlayer + 1); BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][1]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][2]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons BD", nPlayer + 1); BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][1]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][3]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons CD", nPlayer + 1); BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][2]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][3]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons ABC", nPlayer + 1); BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][0]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][1]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][2]); pgi->Macro.pVal[2] = bii.pVal; pgi->Macro.nVal[2] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons ABD", nPlayer + 1); BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][0]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][1]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][3]); pgi->Macro.pVal[2] = bii.pVal; pgi->Macro.nVal[2] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons ACD", nPlayer + 1); BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][0]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][2]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][3]); pgi->Macro.pVal[2] = bii.pVal; pgi->Macro.nVal[2] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons BCD", nPlayer + 1); BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][1]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][2]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][3]); pgi->Macro.pVal[2] = bii.pVal; pgi->Macro.nVal[2] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons ABCD", nPlayer + 1); BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][0]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][1]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][2]); pgi->Macro.pVal[2] = bii.pVal; pgi->Macro.nVal[2] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][3]); pgi->Macro.pVal[3] = bii.pVal; pgi->Macro.nVal[3] = 1; nMacroCount++; pgi++; } if (nFireButtons == 4 && (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_IGS_PGM) { pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons 12", nPlayer + 1); BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][0]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][1]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons 13", nPlayer + 1); BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][0]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][2]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons 14", nPlayer + 1); BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][0]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][3]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons 23", nPlayer + 1); BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][1]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][2]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons 24", nPlayer + 1); BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][1]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][3]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons 34", nPlayer + 1); BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][2]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][3]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons 123", nPlayer + 1); BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][0]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][1]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][2]); pgi->Macro.pVal[2] = bii.pVal; pgi->Macro.nVal[2] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons 124", nPlayer + 1); BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][0]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][1]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][3]); pgi->Macro.pVal[2] = bii.pVal; pgi->Macro.nVal[2] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons 134", nPlayer + 1); BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][0]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][2]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][3]); pgi->Macro.pVal[2] = bii.pVal; pgi->Macro.nVal[2] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons 234", nPlayer + 1); BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][1]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][2]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][3]); pgi->Macro.pVal[2] = bii.pVal; pgi->Macro.nVal[2] = 1; nMacroCount++; pgi++; pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Buttons 1234", nPlayer + 1); BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][0]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][1]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][2]); pgi->Macro.pVal[2] = bii.pVal; pgi->Macro.nVal[2] = 1; BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][3]); pgi->Macro.pVal[3] = bii.pVal; pgi->Macro.nVal[3] = 1; nMacroCount++; pgi++; } } if ((nPunchx3[0] == 7) && (nKickx3[0] == 7)) { bStreetFighterLayout = true; } if (nFireButtons >= 5 && (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_CAPCOM_CPS2) { bStreetFighterLayout = true; } }
static void onCommand(HWND hDlg, int id, HWND /*hwndCtl*/, UINT codeNotify) { if (bLoading) { return; } switch (id) { case MENU_LOAD: HK_openGame(0); break; case MENU_LOAD_QUICK: HK_quickOpenGame(0); break; case MENU_QUIT: HK_exitGame(0); break; case MENU_EXIT: StopReplay(); AviStop(); FBA_KailleraEnd(); PostQuitMessage(0); menuSync(MENUT_ALL); return; case MENU_PAUSE: HK_pause(0); break; case MENU_CARTR_MOUNT: mountCartridge(true); menuSync(MENUT_FILE); break; case MENU_CARTR_UNMOUNT: mountCartridge(false); menuSync(MENUT_FILE); break; case MENU_STARTNET: if (!kNetGame) { InputSetCooperativeLevel(false, !bAlwaysProcessKey); audio.blank(); SplashDestroy(1); StopReplay(); AviStop(); BurnerDrvExit(); // load kaillera.dll if (FBA_KailleraInit()) { DoNetGame(); } menuSync(MENUT_ALL); InputSetCooperativeLevel(false, !bAlwaysProcessKey); } break; case MENU_STARTREPLAY: HK_playRec(0); break; case MENU_STARTRECORD: HK_startRec(0); break; case MENU_STOPREPLAY: HK_stopRec(0); break; case MENU_AVISTART: HK_startAvi(0); break; case MENU_AVISTOP: HK_stopAvi(0); break; case MENU_AVIINTAUD: nAviIntAudio = !nAviIntAudio; menuSync(MENUT_FILE); break; case MENU_MEMCARD_CREATE: if (useDialogs() && bDrvOkay && !kNetGame && (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_NEOGEO) { InputSetCooperativeLevel(false, !bAlwaysProcessKey); audio.blank(); MemCardEject(); MemCardCreate(); MemCardInsert(); menuSync(MENUT_FILE); GameInpCheckMouse(); } break; case MENU_MEMCARD_SELECT: if (useDialogs() && bDrvOkay && !kNetGame && (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_NEOGEO) { InputSetCooperativeLevel(false, !bAlwaysProcessKey); audio.blank(); MemCardEject(); MemCardSelect(); MemCardInsert(); menuSync(MENUT_FILE); GameInpCheckMouse(); } break; case MENU_MEMCARD_INSERT: if (bDrvOkay && !kNetGame && (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_NEOGEO) { MemCardInsert(); } break; case MENU_MEMCARD_EJECT: if (bDrvOkay && !kNetGame && (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_NEOGEO) { MemCardEject(); } break; case MENU_MEMCARD_TOGGLE: if (bDrvOkay && !kNetGame && (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_NEOGEO) { MemCardToggle(); } break; case MENU_STATE_LOAD_DIALOG: HK_loadStateDialog(0); break; case MENU_STATE_SAVE_DIALOG: HK_saveStateDialog(0); return; case MENU_STATE_PREVSLOT: HK_prevState(0); break; case MENU_STATE_NEXTSLOT: HK_nextState(0); break; case MENU_STATE_LOAD_SLOT: HK_loadCurState(0); break; case MENU_STATE_SAVE_SLOT: HK_saveCurState(0); break; case MENU_STATE_ALLRAM: bDrvSaveAll = !bDrvSaveAll; menuSync(MENUT_FILE); break; case MENU_WLOGSTART: audio.blank(); waveLogStart(); break; case MENU_WLOGEND: audio.blank(); waveLogStop(); break; case MENU_NOSTRETCH: bVidCorrectAspect = 0; bVidFullStretch = 0; simpleReinitScrn(false); menuSync(MENUT_SETTING); break; case MENU_STRETCH: bVidFullStretch = 1; bVidCorrectAspect = 0; simpleReinitScrn(false); menuSync(MENUT_SETTING); break; case MENU_ASPECT: bVidCorrectAspect = 1; bVidFullStretch = 0; simpleReinitScrn(false); menuSync(MENUT_SETTING); break; case MENU_FULL: HK_fullscreen(0); return; case MENU_AUTOSIZE: if (nWindowSize != 0) { nWindowSize = 0; simpleReinitScrn(false); menuSync(MENUT_SETTING); } break; case MENU_WINDOWSIZE1X: HK_windowSize(1); break; case MENU_WINDOWSIZE2X: HK_windowSize(2); break; case MENU_WINDOWSIZE3X: HK_windowSize(3); break; case MENU_WINDOWSIZE4X: HK_windowSize(4); break; case MENU_WINDOWSIZEMAX: HK_windowSizeMax(0); break; case MENU_HOTKEYS: MHkeysCreate(hDlg); break; case MENU_INPUT: HK_configPad(0); break; case MENU_DIPSW: HK_setDips(0); break; case MENU_SETCPUCLOCK: audio.blank(); CPUClockDialog(hDlg); menuSync(MENUT_GAME); GameInpCheckMouse(); break; case MENU_RESETCPUCLOCK: nBurnCPUSpeedAdjust = 0x0100; menuSync(MENUT_GAME); break; // ==> rom save case MENU_SAVEC: bsavedecryptedcs = !bsavedecryptedcs; menuSync(MENUT_GAME); break; case MENU_SAVEP: bsavedecryptedps = !bsavedecryptedps; menuSync(MENUT_GAME); break; case MENU_SAVES: bsavedecrypteds1 = !bsavedecrypteds1; menuSync(MENUT_GAME); break; case MENU_SAVEV: bsavedecryptedvs = !bsavedecryptedvs; menuSync(MENUT_GAME); break; case MENU_SAVEM: bsavedecryptedm1 = !bsavedecryptedm1; menuSync(MENUT_GAME); break; case MENU_SAVEXOR: bsavedecryptedxor = !bsavedecryptedxor; menuSync(MENUT_GAME); break; case MENU_SAVEDPROM: bsavedecryptedprom = !bsavedecryptedprom; menuSync(MENUT_GAME); break; // <== rom save case MENU_LANGUAGE_SELECT: if (useDialogs()) { if (!FBALocaliseLoad()) { menuReinit(); } } break; case MENU_LANGUAGE_UNLOAD: _tcsncpy(szLanguage, _T(""), sizearray(szLanguage)); FBALocaliseExit(); menuReinit(); break; case MENU_GAMELIST_SELECT: if (useDialogs()) { loadGamelist(); } break; case MENU_GAMELIST_EXPORT: if (useDialogs()) { createGamelist(); } break; case MENU_MISCDIR_EDIT: if (useDialogs()) { pathSheetCreate(hDlg); } break; case MENU_ROMDIR_EDIT: if (useDialogs()) { RomsDirCreate(hDlg); } break; case MENU_ENABLECHEAT: HK_cheatEditor(0); break; #ifndef NO_CHEATSEARCH case MENU_CHEATSEARCH: HK_cheatSearch(0); break; #endif // ==> simple jukebox, added by regret case MENU_JUKEBOX: if (useDialogs()) { jukeCreate(); InputSetCooperativeLevel(false, !bAlwaysProcessKey); } break; // <== simple jukebox case MENU_DEBUG: if (useDialogs()) { InputSetCooperativeLevel(false, !bAlwaysProcessKey); DebugCreate(); } break; case MENU_SAVESNAP: { HK_screenShot(0); break; } case MENU_SNAPFACT: HK_shotFactory(0); break; case MENU_SKIN_SELECT: if (useDialogs()) { if (selectSkin() == 0) { simpleReinitScrn(true); } } break; case MENU_SKIN_UNLOAD: _tcsncpy(szPlaceHolder, _T(""), sizearray(szPlaceHolder)); simpleReinitScrn(true); break; case MENU_CLRMAMEPRO_XML: if (useDialogs()) { createDatfileWindows(1); } break; case MENU_CLRMAME_PRO: if (useDialogs()) { createDatfileWindows(0); } break; case MENU_SAVESET: configAppSaveXml(); break; case MENU_LOADSET: configAppLoadXml(); POST_INITIALISE_MESSAGE; break; case MENU_ABOUT: if (useDialogs()) { InputSetCooperativeLevel(false, !bAlwaysProcessKey); audio.blank(); AboutCreate(hDlg); GameInpCheckMouse(); } break; case MENU_SYSINFO: if (useDialogs()) { InputSetCooperativeLevel(false, !bAlwaysProcessKey); audio.blank(); SystemInfoCreate(hDlg); GameInpCheckMouse(); } break; case MENU_CONTENTS: { if (useDialogs()) { FILE* fp = _tfopen(_T("readme.txt"), _T("r")); if (fp) { fclose(fp); ShellExecute(NULL, _T("open"), _T("readme.txt"), NULL, NULL, SW_SHOWNORMAL); } } break; } case MENU_WWW_HOME: ShellExecute(NULL, _T("open"), _T("http://www.barryharris.me.uk/"), NULL, NULL, SW_SHOWNORMAL); break; case MENU_WWW_FORUM: ShellExecute(NULL, _T("open"), _T("http://neosource.1emulation.com/forums/"), NULL, NULL, SW_SHOWNORMAL); break; case MENU_WWW_FORUM1: ShellExecute(NULL, _T("open"), _T("http://www.egcg.com.cn/bbs/"), NULL, NULL, SW_SHOWNORMAL); break; // filters case MENU_SOFT_NONE: vidUseFilter = 0; nVidFilter = 0; VidReinit(); menuSync(MENUT_SETTING); break; case MENU_SOFT_EPXB: case MENU_SOFT_EPXC: case MENU_SOFT_SCALE2X: case MENU_SOFT_SCALE3X: case MENU_SOFT_2XSAI: case MENU_SOFT_SUPER2XSAI: case MENU_SOFT_SUPEREAGLE: case MENU_SOFT_2XPMHQ: case MENU_SOFT_HQ2X: case MENU_SOFT_HQ2XS: case MENU_SOFT_HQ2XBOLD: case MENU_SOFT_HQ3X: case MENU_SOFT_HQ3XS: case MENU_SOFT_HQ3XBOLD: case MENU_SOFT_SCANLINE: case MENU_SOFT_SCANLINE50: case MENU_SOFT_SCANLINE25: case MENU_SOFT_INTERSCANLINE: case MENU_SOFT_INTERSCANLINE50: case MENU_SOFT_INTERSCANLINE25: vidUseFilter = 1; nVidFilter = id - MENU_SOFT_NONE; scrnSize(); VidSwitchFilter(nVidFilter); menuSync(MENUT_SETTING); break; case MENU_FILTER_AUTOSIZE: vidForceFilterSize = !vidForceFilterSize; simpleReinitScrn(true); menuSync(MENUT_SETTING); break; // Options for blitters case MENU_FILTER_POINT: if (vidFilterLinear) { vidFilterLinear = 0; VidReinit(); menuSync(MENUT_SETTING); } break; case MENU_FILTER_LINEAR: if (!vidFilterLinear) { vidFilterLinear = 1; VidReinit(); menuSync(MENUT_SETTING); } break; case MENU_CONFIGALL: if (useDialogs()) { preferenceCreate(hDlg); setWindowAspect(); menuReinit(); simpleReinitScrn(true); mediaReInitAudio(); } break; case MENU_VIDEOCONFIG: if (useDialogs()) { prefVideoCreate(hDlg); setWindowAspect(); simpleReinitScrn(true); } break; case MENU_AUDIOCONFIG: if (useDialogs()) { prefAudioCreate(hDlg); mediaReInitAudio(); } break; case MENU_MISCCONFIG: if (useDialogs()) { prefMiscCreate(hDlg); menuReinit(); VidReinit(); } break; // default: // printf(" * Command %i sent.\n"); } if (ChatActivated()) { switch (codeNotify) { case EN_CHANGE: { bEditTextChanged = true; SendMessage(GetChatWindow(), WM_GETTEXT, (WPARAM)MAX_CHAT_SIZE + 1, (LPARAM)EditText); break; } case EN_KILLFOCUS: { ActivateChat(); break; } case EN_MAXTEXT: { VidSNewShortMsg(FBALoadStringEx(IDS_NETPLAY_TOOMUCH), 0xFF3F3F); break; } } } }
static int pgmGetRoms(bool bLoad) { int kov2 = (strncmp(BurnDrvGetTextA(DRV_NAME), "kov2", 4) == 0) ? 1 : 0; char* pRomName; struct BurnRomInfo ri; struct BurnRomInfo pi; unsigned char *PGMUSER0Load = PGMUSER0; unsigned char *PGM68KROMLoad = PGM68KROM; unsigned char *PGMTileROMLoad = PGMTileROM + 0x180000; unsigned char *PGMSPRMaskROMLoad = PGMSPRMaskROM; unsigned char *PGMSNDROMLoad = ICSSNDROM + 0x400000; if (kov2 && bLoad) { PGMSNDROMLoad += 0x400000; } for (int i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { BurnDrvGetRomInfo(&ri, i); if ((ri.nType & BRF_PRG) && (ri.nType & 0x0f) == 1) { if (bLoad) { BurnDrvGetRomInfo(&pi, i+1); if (ri.nLen == 0x80000 && pi.nLen == 0x80000) { BurnLoadRom(PGM68KROMLoad + 0, i + 0, 2); BurnLoadRom(PGM68KROMLoad + 1, i + 1, 2); PGM68KROMLoad += pi.nLen; i += 1; } else { BurnLoadRom(PGM68KROMLoad, i, 1); } PGM68KROMLoad += ri.nLen; } else { nPGM68KROMLen += ri.nLen; } continue; } if ((ri.nType & BRF_GRA) && (ri.nType & 0x0f) == 2) { if (bLoad) { BurnLoadRom(PGMTileROMLoad, i, 1); PGMTileROMLoad += ri.nLen; } else { nPGMTileROMLen += ri.nLen; } continue; } if ((ri.nType & BRF_GRA) && (ri.nType & 0x0f) == 3) { if (bLoad) { } else { nPGMSPRColROMLen += ri.nLen; } continue; } if ((ri.nType & BRF_GRA) && (ri.nType & 0x0f) == 4) { if (bLoad) { BurnLoadRom(PGMSPRMaskROMLoad, i, 1); PGMSPRMaskROMLoad += ri.nLen; } else { nPGMSPRMaskROMLen += ri.nLen; } continue; } if ((ri.nType & BRF_SND) && (ri.nType & 0x0f) == 5) { if (bLoad) { BurnLoadRom(PGMSNDROMLoad, i, 1); PGMSNDROMLoad += ri.nLen; } else { nPGMSNDROMLen += ri.nLen; } continue; } if ((ri.nType & BRF_PRG) && (ri.nType & 0x0f) == 7) { if (bLoad) { if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { BurnLoadRom(PGMARMROM, i, 1); } } continue; } if ((ri.nType & BRF_PRG) && (ri.nType & 0x0f) == 8) { if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { if (bLoad) { BurnLoadRom(PGMUSER0, i, 1); PGMUSER0Load += ri.nLen; } else { nPGMExternalARMLen += ri.nLen; } } continue; } } if (!bLoad) { nPGMTileROMLen += 0x180000; if (nPGMTileROMLen < 0x400000) nPGMTileROMLen = 0x400000; nPGMSNDROMLen += 0x400000; if (kov2) nPGMSNDROMLen += 0x400000; nPGMSNDROMLen = ((nPGMSNDROMLen-1) | 0xfffff) + 1; nICSSNDROMLen = (nPGMSNDROMLen-1) & 0xf00000; if (nPGMExternalARMLen == 0) nPGMExternalARMLen = 0x200000; bprintf (0, _T("%5.5x, %d\n"), nPGMExternalARMLen, nBurnFPS); } return 0; }
int write_datfile(int nDatType, int bIncMegadrive, FILE* fDat) { int nRet=0; unsigned int nOldSelect=0; unsigned int nGameSelect=0; unsigned int nParentSelect,nBoardROMSelect; nOldSelect=nBurnDrvSelect; // preserve the currently selected driver // Go over each of the games for (nGameSelect=0;nGameSelect<nBurnDrvCount;nGameSelect++) { char sgName[16]; char spName[16]; char sbName[16]; unsigned int i=0; int nPass=0; nBurnDrvSelect=nGameSelect; // Switch to driver nGameSelect if (BurnDrvGetFlags() & BDF_BOARDROM) { continue; } if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_MEGADRIVE) && (bIncMegadrive == 0)) { continue; } if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) != HARDWARE_SEGA_MEGADRIVE) && (bIncMegadrive == 2)) { continue; } strcpy(sgName, BurnDrvGetTextA(DRV_NAME)); strcpy(spName, ""); // make sure this string is empty before we start strcpy(sbName, ""); // make sure this string is empty before we start // Check to see if the game has a parent if (BurnDrvGetTextA(DRV_PARENT)) { nParentSelect=-1U; while (BurnDrvGetTextA(DRV_PARENT)) { strcpy(spName, BurnDrvGetTextA(DRV_PARENT)); for (i=0;i<nBurnDrvCount;i++) { nBurnDrvSelect=i; if (!strcmp(spName, BurnDrvGetTextA(DRV_NAME))) { nParentSelect=i; break; } } } nBurnDrvSelect=nGameSelect; // restore driver select } else nParentSelect=nGameSelect; // Check to see if the game has a BoardROM if (BurnDrvGetTextA(DRV_BOARDROM)) { nBoardROMSelect=-1U; strcpy(sbName, BurnDrvGetTextA(DRV_BOARDROM)); for (i=0;i<nBurnDrvCount;i++) { nBurnDrvSelect=i; if (!strcmp(sbName, BurnDrvGetTextA(DRV_NAME))) { nBoardROMSelect=i; break; } } nBurnDrvSelect=nGameSelect; // restore driver select } else nBoardROMSelect=nGameSelect; if (nDatType == 0) { // Report problems if (nParentSelect==-1U) fprintf(fDat, "# Missing parent %s. It needs to be added to " APP_TITLE "!\n\n", spName); if (nBoardROMSelect==-1U) fprintf(fDat, "# Missing boardROM %s. It needs to be added to " APP_TITLE "!\n\n", sbName); // Write the header fprintf(fDat, "game (\n"); fprintf(fDat, "\tname %s\n", sgName); if (nParentSelect!=nGameSelect && nParentSelect!=-1U) { fprintf(fDat, "\tcloneof %s\n", spName); fprintf(fDat, "\tromof %s\n", spName); } else { // Add "romof" (but not 'cloneof') line for games that have boardROMs if (nBoardROMSelect!=nGameSelect && nBoardROMSelect!=-1U) { fprintf(fDat, "\tromof %s\n", sbName); } } fprintf(fDat, "\tdescription \"%s\"\n", DecorateGameName(nBurnDrvSelect)); fprintf(fDat, "\tyear %s\n", BurnDrvGetTextA(DRV_DATE)); fprintf(fDat, "\tmanufacturer \"%s\"\n", BurnDrvGetTextA(DRV_MANUFACTURER)); } if (nDatType == 2) { // Report problems if (nParentSelect==-1U) fprintf(fDat, "# Missing parent %s. It needs to be added to " APP_TITLE "!\n\n", spName); if (nBoardROMSelect==-1U) fprintf(fDat, "# Missing boardROM %s. It needs to be added to " APP_TITLE "!\n\n", sbName); // Write the header if (nParentSelect!=nGameSelect && nParentSelect!=-1U) { fprintf(fDat, "\t<game name=\"%s\" cloneof=\"%s\" romof=\"%s\">\n", sgName, spName, sbName); } else { // Add "romof" (but not 'cloneof') line for games that have boardROMs if (nBoardROMSelect!=nGameSelect && nBoardROMSelect!=-1U) { fprintf(fDat, "\t<game name=\"%s\" romof=\"%s\">\n", sgName, sbName); } else { fprintf(fDat, "\t<game name=\"%s\">\n", sgName); } } char szGameName[255]; char szGameNameBuffer[255]; char szManufacturer[255]; char szManufacturerBuffer[255]; memset(szGameName, 0, 255); memset(szGameNameBuffer, 0, 255); memset(szManufacturer, 0, 255); memset(szManufacturerBuffer, 0, 255); strcpy(szGameName, DecorateGameName(nBurnDrvSelect)); ReplaceAmpersand(szGameNameBuffer, szGameName); strcpy(szManufacturer, BurnDrvGetTextA(DRV_MANUFACTURER)); ReplaceAmpersand(szManufacturerBuffer, szManufacturer); // fprintf(fDat, "\t\t<description>%s</description>\n", DecorateGameName(nBurnDrvSelect)); fprintf(fDat, "\t\t<description>%s</description>\n", szGameNameBuffer); fprintf(fDat, "\t\t<year>%s</year>\n", BurnDrvGetTextA(DRV_DATE)); // fprintf(fDat, "\t\t<manufacturer>%s</manufacturer>\n", BurnDrvGetTextA(DRV_MANUFACTURER)); fprintf(fDat, "\t\t<manufacturer>%s</manufacturer>\n", szManufacturerBuffer); } // Write the individual ROM info for (nPass=0; nPass<2; nPass++) { nBurnDrvSelect=nGameSelect; // Skip pass 0 if possible if (nPass==0 && (nBoardROMSelect==nGameSelect || nBoardROMSelect==-1U || nDatType == 1 || nDatType == 2)) continue; // Go over each of the files needed for this game (upto 0x0100) for (i=0, nRet=0; nRet==0 && i<0x100; i++) { int nRetTmp=0; struct BurnRomInfo ri; int nLen; unsigned int nCrc; char *szPossibleName=NULL; int j, nMerged=0; memset(&ri,0,sizeof(ri)); // Get info on this file nBurnDrvSelect=nGameSelect; nRet=BurnDrvGetRomInfo(&ri,i); nRet+=BurnDrvGetRomName(&szPossibleName,i,0); if (ri.nLen==0) continue; if (nRet==0) { struct BurnRomInfo riTmp; char *szPossibleNameTmp; nLen=ri.nLen; nCrc=ri.nCrc; // Check for files from boardROMs if (nBoardROMSelect!=nGameSelect && nBoardROMSelect!=-1U) { nBurnDrvSelect=nBoardROMSelect; nRetTmp=0; // Go over each of the files needed for this game (upto 0x0100) for (j=0; nRetTmp==0 && j<0x100; j++) { memset(&riTmp,0,sizeof(riTmp)); nRetTmp+=BurnDrvGetRomInfo(&riTmp,j); nRetTmp+=BurnDrvGetRomName(&szPossibleNameTmp,j,0); if (nRetTmp==0) { if (riTmp.nLen && riTmp.nCrc==nCrc && !strcmp(szPossibleName, szPossibleNameTmp)) { // This file is from a boardROM nMerged|=2; nRetTmp++; } } } } if (!nMerged && nParentSelect!=nGameSelect && nParentSelect!=-1U) { nBurnDrvSelect=nParentSelect; nRetTmp=0; // Go over each of the files needed for this game (upto 0x0100) for (j=0; nRetTmp==0 && j<0x100; j++) { memset(&riTmp,0,sizeof(riTmp)); nRetTmp+=BurnDrvGetRomInfo(&riTmp,j); nRetTmp+=BurnDrvGetRomName(&szPossibleNameTmp,j,0); if (nRetTmp==0) { if (riTmp.nLen && riTmp.nCrc==nCrc && !strcmp(szPossibleName, szPossibleNameTmp)) { // This file is from a parent set nMerged|=1; nRetTmp++; } } } } nBurnDrvSelect=nGameSelect; // Switch back to game } if (nDatType == 0) { // Selectable BIOS meta info if (nPass==0 && nMerged&2 && ri.nType&BRF_SELECT) fprintf(fDat, "\tbiosset ( name %d description \"%s\" %s)\n", i - 128, szPossibleName, ri.nType & BRF_OPT ? "" : "default yes "); // File info if (nPass==1 && !nMerged) { if (ri.nType & BRF_NODUMP) { fprintf(fDat, "\trom ( name %s size %d flags nodump )\n", szPossibleName, ri.nLen); } else { fprintf(fDat, "\trom ( name %s size %d crc %08x )\n", szPossibleName, ri.nLen, ri.nCrc); } } if (nPass==1 && nMerged) { // Selectable BIOS file info if (nMerged&2 && ri.nType&BRF_SELECT) fprintf(fDat, "\trom ( name %s merge %s bios %d size %d crc %08x )\n", szPossibleName, szPossibleName, i - 128, ri.nLen, ri.nCrc); // Files from parent/boardROMs else { if (ri.nType & BRF_NODUMP) { fprintf(fDat, "\trom ( name %s merge %s size %d flags nodump )\n", szPossibleName, szPossibleName, ri.nLen); } else { fprintf(fDat, "\trom ( name %s merge %s size %d crc %08x )\n", szPossibleName, szPossibleName, ri.nLen, ri.nCrc); } } } } if (nDatType == 1) { if (nPass == 0) continue; // No meta info needed if (nParentSelect!=nGameSelect && nParentSelect!=-1U) { nBurnDrvSelect=nParentSelect; // Switch to parent fprintf(fDat, "¬%s¬%s", spName, DecorateGameName(nBurnDrvSelect)); nBurnDrvSelect=nGameSelect; // Switch back to game } else fprintf(fDat, "¬%s¬%s", BurnDrvGetTextA(DRV_NAME), DecorateGameName(nBurnDrvSelect)); fprintf(fDat, "¬%s¬%s", BurnDrvGetTextA(DRV_NAME), DecorateGameName(nBurnDrvSelect)); fprintf(fDat, "¬%s¬%08x¬%d", szPossibleName, ri.nCrc, ri.nLen); if (nParentSelect!=nGameSelect && nParentSelect!=-1U) { // Files from parent fprintf(fDat, "¬%s", spName); } else { // Files from boardROM if (nBoardROMSelect!=nGameSelect && nBoardROMSelect!=-1U) fprintf(fDat, "¬%s", sbName); } if (!nMerged) fprintf(fDat, "¬¬¬\n"); else fprintf(fDat, "¬%s¬\n", szPossibleName); } if (nDatType == 2) { char szPossibleNameBuffer[255]; memset(szPossibleNameBuffer, 0, 255); ReplaceAmpersand(szPossibleNameBuffer, szPossibleName); // File info if (nPass==1 && !nMerged) { if (ri.nType & BRF_NODUMP) { fprintf(fDat, "\t\t<rom name=\"%s\" size=\"%d\" status=\"nodump\"/>\n", szPossibleNameBuffer, ri.nLen); } else { fprintf(fDat, "\t\t<rom name=\"%s\" size=\"%d\" crc=\"%08x\"/>\n", szPossibleNameBuffer, ri.nLen, ri.nCrc); } } if (nPass==1 && nMerged) { // Files from parent/boardROMs if (ri.nType & BRF_NODUMP) { fprintf(fDat, "\t\t<rom name=\"%s\" merge=\"%s\" size=\"%d\" status=\"nodump\"/>\n", szPossibleNameBuffer, szPossibleNameBuffer, ri.nLen); } else { fprintf(fDat, "\t\t<rom name=\"%s\" merge=\"%s\" size=\"%d\" crc=\"%08x\"/>\n", szPossibleNameBuffer, szPossibleNameBuffer, ri.nLen, ri.nCrc); } } } } } if (nDatType == 0) fprintf(fDat, ")\n\n"); if (nDatType == 2) fprintf(fDat, "\t</game>\n"); } if (nDatType == 1 && (bIncMegadrive != 2)) fprintf(fDat, "[RESOURCES]\n"); // Do another pass over each of the games to find boardROMs for (nBurnDrvSelect=0; nBurnDrvSelect<nBurnDrvCount; nBurnDrvSelect++) { int i, nPass; if (!(BurnDrvGetFlags() & BDF_BOARDROM)) { continue; } if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) != HARDWARE_SEGA_MEGADRIVE) && (bIncMegadrive == 2)) { continue; } if (nDatType == 0) { fprintf(fDat, "resource (\n"); fprintf(fDat, "\tname %s\n", BurnDrvGetTextA(DRV_NAME)); fprintf(fDat, "\tdescription \"%s\"\n", DecorateGameName(nBurnDrvSelect)); fprintf(fDat, "\tyear %s\n", BurnDrvGetTextA(DRV_DATE)); fprintf(fDat, "\tmanufacturer \"%s\"\n", BurnDrvGetTextA(DRV_COMMENT)); } if (nDatType == 2) { fprintf(fDat, "\t<game isbios=\"yes\" name=\"%s\">\n", BurnDrvGetTextA(DRV_NAME)); fprintf(fDat, "\t\t<description>%s</description>\n", DecorateGameName(nBurnDrvSelect)); fprintf(fDat, "\t\t<year>%s</year>\n", BurnDrvGetTextA(DRV_DATE)); fprintf(fDat, "\t\t<manufacturer>%s</manufacturer>\n", BurnDrvGetTextA(DRV_MANUFACTURER)); } for (nPass=0; nPass<2; nPass++) { // No meta information needed if (nPass==0 && (nDatType == 1 || nDatType == 2)) continue; // Go over each of the individual files (upto 0x0100) for (i=0; i<0x100; i++) { struct BurnRomInfo ri; char *szPossibleName=NULL; memset(&ri,0,sizeof(ri)); nRet=BurnDrvGetRomInfo(&ri,i); nRet+=BurnDrvGetRomName(&szPossibleName,i,0); if (ri.nLen==0) continue; if (nRet==0) { if (nDatType == 0) { if (nPass==0) { if (ri.nType&BRF_SELECT) fprintf(fDat, "\tbiosset ( name %d description \"%s\" %s)\n", i, szPossibleName, ri.nType & 0x80 ? "" : "default yes "); } else { if (ri.nType&BRF_SELECT) fprintf(fDat, "\trom ( name %s bios %d size %d crc %08x )\n", szPossibleName, i, ri.nLen, ri.nCrc); else fprintf(fDat, "\trom ( name %s size %d crc %08x )\n", szPossibleName, ri.nLen, ri.nCrc); } } if (nDatType == 1) { fprintf(fDat, "¬%s¬%s", BurnDrvGetTextA(DRV_NAME), DecorateGameName(nBurnDrvSelect)); fprintf(fDat, "¬%s¬%s", BurnDrvGetTextA(DRV_NAME), DecorateGameName(nBurnDrvSelect)); fprintf(fDat, "¬%s¬%08x¬%d", szPossibleName, ri.nCrc, ri.nLen); fprintf(fDat, "¬¬¬\n"); } if (nDatType == 2) { char szPossibleNameBuffer[255]; memset(szPossibleNameBuffer, 0, 255); ReplaceAmpersand(szPossibleNameBuffer, szPossibleName); fprintf(fDat, "\t\t<rom name=\"%s\" size=\"%d\" crc=\"%08x\"/>\n", szPossibleNameBuffer, ri.nLen, ri.nCrc); } } } } if (nDatType == 0) fprintf(fDat, ")\n"); if (nDatType == 2) fprintf(fDat, "\t</game>\n"); } // Restore current driver nBurnDrvSelect=nOldSelect; if (nDatType == 2) fprintf(fDat, "</datafile>"); return 0; }
int DrvInit(int nDrvNum, bool bRestore) { int nStatus; DrvExit(); // Make sure exitted MediaExit(); nBurnDrvActive = nDrvNum; // Set the driver number if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_MVS) { BurnExtCartridgeSetupCallback = DrvCartridgeAccess; if (SelMVSDialog()) { POST_INITIALISE_MESSAGE; return 0; } } if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_NEOCD) { if (CDEmuInit()) { FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_CDEMU_INI_FAIL)); FBAPopupDisplay(PUF_TYPE_ERROR); POST_INITIALISE_MESSAGE; return 0; } } MediaInit(); // Define nMaxPlayers early; GameInpInit() needs it (normally defined in DoLibInit()). nMaxPlayers = BurnDrvGetMaxPlayers(); GameInpInit(); // Init game input if(ConfigGameLoad(true)) { ConfigGameLoadHardwareDefaults(); } InputMake(true); GameInpDefault(); if (kNetGame) { nBurnCPUSpeedAdjust = 0x0100; } nStatus = DoLibInit(); // Init the Burn library's driver if (nStatus) { if (nStatus & 2) { BurnDrvExit(); // Exit the driver ScrnTitle(); FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_BURN_INIT), BurnDrvGetText(DRV_FULLNAME)); FBAPopupDisplay(PUF_TYPE_WARNING); } POST_INITIALISE_MESSAGE; return 1; } BurnExtLoadRom = DrvLoadRom; bDrvOkay = 1; // Okay to use all BurnDrv functions if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) { nScreenSize = nScreenSizeVer; bVidArcaderes = bVidArcaderesVer; nVidWidth = nVidVerWidth; nVidHeight = nVidVerHeight; } else { nScreenSize = nScreenSizeHor; bVidArcaderes = bVidArcaderesHor; nVidWidth = nVidHorWidth; nVidHeight = nVidHorHeight; } bSaveRAM = false; if (kNetGame) { KailleraInitInput(); KailleraGetInput(); } else { if (bRestore) { StatedAuto(0); bSaveRAM = true; ConfigCheatLoad(); } } nBurnLayer = 0xFF; // show all layers // Reset the speed throttling code, so we don't 'jump' after the load RunReset(); VidExit(); POST_INITIALISE_MESSAGE; return 0; }
static INT32 pgmGetRoms(bool bLoad) { INT32 kov2 = (strncmp(BurnDrvGetTextA(DRV_NAME), "kov2", 4) == 0) ? 1 : 0; char* pRomName; struct BurnRomInfo ri; struct BurnRomInfo pi; UINT8 *PGMUSER0Load = PGMUSER0; UINT8 *PGM68KROMLoad = PGM68KROM; UINT8 *PGMTileROMLoad = PGMTileROM + 0x180000; UINT8 *PGMSPRMaskROMLoad = PGMSPRMaskROM; UINT8 *PGMSNDROMLoad = ICSSNDROM + 0x400000; UINT8 *PGMARMROMLoad = PGMARMROM; if (kov2 && bLoad) { PGMSNDROMLoad += 0x400000; } for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { BurnDrvGetRomInfo(&ri, i); if ((ri.nType & BRF_PRG) && (ri.nType & 0x0f) == 1) { if (bLoad) { BurnDrvGetRomInfo(&pi, i+1); if (ri.nLen == 0x80000 && pi.nLen == 0x80000) { BurnLoadRom(PGM68KROMLoad + 0, i + 0, 2); BurnLoadRom(PGM68KROMLoad + 1, i + 1, 2); PGM68KROMLoad += pi.nLen; i += 1; } else { BurnLoadRom(PGM68KROMLoad, i, 1); } PGM68KROMLoad += ri.nLen; } else { nPGM68KROMLen += ri.nLen; } continue; } if ((ri.nType & BRF_GRA) && (ri.nType & 0x0f) == 2) { if (bLoad) { BurnLoadRom(PGMTileROMLoad, i, 1); PGMTileROMLoad += ri.nLen; } else { nPGMTileROMLen += ri.nLen; } continue; } if ((ri.nType & BRF_GRA) && (ri.nType & 0x0f) == 3) { if (bLoad) { } else { nPGMSPRColROMLen += ri.nLen; } continue; } if ((ri.nType & BRF_GRA) && (ri.nType & 0x0f) == 4) { if (bLoad) { if (strcmp(BurnDrvGetTextA(DRV_NAME), "pgm3in1") == 0) { if ((PGMSPRMaskROMLoad - PGMSPRMaskROM) == 0x1000000) PGMSPRMaskROMLoad -= 0x100000; } BurnLoadRom(PGMSPRMaskROMLoad, i, 1); PGMSPRMaskROMLoad += ri.nLen; } else { nPGMSPRMaskROMLen += ri.nLen; } continue; } if ((ri.nType & BRF_SND) && (ri.nType & 0x0f) == 5) { if (bLoad) { BurnLoadRom(PGMSNDROMLoad, i, 1); PGMSNDROMLoad += ri.nLen; } else { nPGMSNDROMLen += ri.nLen; } continue; } if ((ri.nType & BRF_PRG) && (ri.nType & 0x0f) == 7) { if (bLoad) { if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { if (ri.nLen == 0x3e78) PGMARMROMLoad += 0x188; BurnLoadRom(PGMARMROMLoad, i, 1); } } continue; } if ((ri.nType & BRF_PRG) && (ri.nType & 0x0f) == 8) { if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { if (bLoad) { BurnLoadRom(PGMUSER0Load, i, 1); PGMUSER0Load += ri.nLen; } else { nPGMExternalARMLen += ri.nLen; } } continue; } } if (!bLoad) { nPGMTileROMLen += 0x180000; if (nPGMTileROMLen < 0x400000) nPGMTileROMLen = 0x400000; nPGMSNDROMLen += 0x400000; if (kov2) nPGMSNDROMLen += 0x400000; nPGMSNDROMLen = ((nPGMSNDROMLen-1) | 0xfffff) + 1; nICSSNDROMLen = nPGMSNDROMLen; if (nPGMExternalARMLen == 0) nPGMExternalARMLen = 0x200000; } return 0; }
static INT32 CpsGetROMs(bool bLoad) { struct BurnRomInfo ri; UINT8* CpsCodeLoad = CpsCode; UINT8* CpsRomLoad = CpsRom; UINT8* CpsGfxLoad = CpsGfx; UINT8* CpsZRomLoad = CpsZRom; UINT8* CpsQSamLoad = (UINT8*)CpsQSam; INT32 nGfxNum = 0; if (bLoad) { if (!CpsCodeLoad || !CpsRomLoad || !CpsGfxLoad || !CpsZRomLoad || !CpsQSamLoad) { return 1; } } else { nCpsCodeLen = nCpsRomLen = nCpsGfxLen = nCpsZRomLen = nCpsQSamLen = 0; nGfxMaxSize = 0; if (BurnDrvGetHardwareCode() & HARDWARE_CAPCOM_CPS2_SIMM) { nGfxMaxSize = ~0U; } } INT32 i = 0; do { ri.nLen = 0; ri.nType = 0; BurnDrvGetRomInfo(&ri, i); if ((ri.nType & 0x0f) == CPS2_PRG_68K) { if (bLoad) { BurnLoadRom(CpsRomLoad, i, 1); CpsRomLoad += ri.nLen; } else { nCpsRomLen += ri.nLen; } i++; } if ((ri.nType & 0x0f) == CPS2_PRG_68K_SIMM) { if (bLoad) { BurnLoadRom(CpsRomLoad + 0x000001, i + 0, 2); BurnLoadRom(CpsRomLoad + 0x000000, i + 1, 2); CpsRomLoad += ri.nLen * 2; i += 2; } else { nCpsRomLen += ri.nLen; i++; } } if ((ri.nType & 0x0f) == CPS2_PRG_68K_XOR_TABLE) { if (bLoad) { BurnLoadRom(CpsCodeLoad, i, 1); CpsCodeLoad += ri.nLen; } else { nCpsCodeLen += ri.nLen; } i++; } if ((ri.nType & 0x0f) == CPS2_GFX) { if (bLoad) { Cps2LoadTiles(CpsGfxLoad, i); CpsGfxLoad += (nGfxMaxSize == ~0U ? ri.nLen : nGfxMaxSize) * 4; i += 4; } else { if (ri.nLen > nGfxMaxSize) { nGfxMaxSize = ri.nLen; } if (ri.nLen < nGfxMaxSize) { nGfxMaxSize = ~0U; } nCpsGfxLen += ri.nLen; nGfxNum++; i++; } } if ((ri.nType & 0x0f) == CPS2_GFX_SIMM) { if (bLoad) { Cps2LoadTilesSIM(CpsGfxLoad, i); CpsGfxLoad += ri.nLen * 8; i += 8; } else { nCpsGfxLen += ri.nLen; i++; } } if ((ri.nType & 0x0f) == CPS2_GFX_SPLIT4) { if (bLoad) { Cps2LoadTilesSplit4(CpsGfxLoad, i); CpsGfxLoad += (nGfxMaxSize == ~0U ? ri.nLen : nGfxMaxSize) * 16; i += 16; } else { if (ri.nLen > nGfxMaxSize) { nGfxMaxSize = ri.nLen; } if (ri.nLen < nGfxMaxSize) { nGfxMaxSize = ~0U; } nCpsGfxLen += ri.nLen; nGfxNum++; i++; } } if ((ri.nType & 0x0f) == CPS2_GFX_SPLIT8) { if (bLoad) { Cps2LoadTilesSplit8(CpsGfxLoad, i); CpsGfxLoad += (nGfxMaxSize == ~0U ? ri.nLen : nGfxMaxSize) * 32; i += 32; } else { if (ri.nLen > nGfxMaxSize) { nGfxMaxSize = ri.nLen; } if (ri.nLen < nGfxMaxSize) { nGfxMaxSize = ~0U; } nCpsGfxLen += ri.nLen; nGfxNum++; i++; } } if ((ri.nType & 0x0f) == CPS2_PRG_Z80) { if (bLoad) { BurnLoadRom(CpsZRomLoad, i, 1); CpsZRomLoad += ri.nLen; } else { nCpsZRomLen += ri.nLen; } i++; } if ((ri.nType & 0x0f) == CPS2_QSND) { if (bLoad) { BurnLoadRom(CpsQSamLoad, i, 1); BurnByteswap(CpsQSamLoad, ri.nLen); CpsQSamLoad += ri.nLen; } else { nCpsQSamLen += ri.nLen; } i++; } if ((ri.nType & 0x0f) == CPS2_QSND_SIMM) { if (bLoad) { BurnLoadRom(CpsQSamLoad, i, 1); BurnByteswap(CpsQSamLoad, ri.nLen); CpsQSamLoad += ri.nLen; } else { nCpsQSamLen += ri.nLen; } i++; } if ((ri.nType & 0x0f) == CPS2_QSND_SIMM_BYTESWAP) { if (bLoad) { BurnLoadRom(CpsQSamLoad + 1, i + 0, 2); BurnLoadRom(CpsQSamLoad + 0, i + 1, 2); i += 2; } else { nCpsQSamLen += ri.nLen; i++; } } } while (ri.nLen); if (bLoad) { #if 0 for (UINT32 i = 0; i < nCpsCodeLen / 4; i++) { ((UINT32*)CpsCode)[i] ^= ((UINT32*)CpsRom)[i]; } #endif cps2_decrypt_game_data(); // if (!nCpsCodeLen) return 1; } else { if (nGfxMaxSize != ~0U) { nCpsGfxLen = nGfxNum * nGfxMaxSize; } #if 1 && defined FBA_DEBUG if (!nCpsCodeLen) { bprintf(PRINT_IMPORTANT, _T(" - 68K ROM size:\t0x%08X (Decrypted with key)\n"), nCpsRomLen); } else { bprintf(PRINT_IMPORTANT, _T(" - 68K ROM size:\t0x%08X (XOR table size: 0x%08X)\n"), nCpsRomLen, nCpsCodeLen); } bprintf(PRINT_IMPORTANT, _T(" - Z80 ROM size:\t0x%08X\n"), nCpsZRomLen); bprintf(PRINT_IMPORTANT, _T(" - Graphics data:\t0x%08X\n"), nCpsGfxLen); bprintf(PRINT_IMPORTANT, _T(" - QSound data:\t0x%08X\n"), nCpsQSamLen); #endif if (/*!nCpsCodeLen ||*/ !nCpsRomLen || !nCpsGfxLen || !nCpsZRomLen || ! nCpsQSamLen) { return 1; } } 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; }
static int CpsGetROMs(bool bLoad) { char* pRomName; struct BurnRomInfo ri; unsigned char* CpsCodeLoad = CpsCode; unsigned char* CpsRomLoad = CpsRom; unsigned char* CpsGfxLoad = CpsGfx; unsigned char* CpsZRomLoad = CpsZRom; unsigned char* CpsQSamLoad = (unsigned char*)CpsQSam; int nGfxNum = 0; if (bLoad) { if (!CpsCodeLoad || !CpsRomLoad || !CpsGfxLoad || !CpsZRomLoad || !CpsQSamLoad) { return 1; } } else { nCpsCodeLen = nCpsRomLen = nCpsGfxLen = nCpsZRomLen = nCpsQSamLen = 0; nGfxMaxSize = 0; if (BurnDrvGetHardwareCode() & HARDWARE_CAPCOM_CPS2_SIMM) { nGfxMaxSize = ~0U; } } for (int i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { BurnDrvGetRomInfo(&ri, i); // SIMM Graphics ROMs if (BurnDrvGetHardwareCode() & HARDWARE_CAPCOM_CPS2_SIMM) { if ((ri.nType & BRF_GRA) && (ri.nType & 8)) { if (bLoad) { Cps2LoadTilesSIM(CpsGfxLoad, i); CpsGfxLoad += ri.nLen * 8; i += 7; } else { nCpsGfxLen += ri.nLen; } continue; } // SIMM QSound sample ROMs if ((ri.nType & BRF_SND) && ((ri.nType & 15) == 13)) { if (bLoad) { BurnLoadRom(CpsQSamLoad, i, 1); BurnByteswap(CpsQSamLoad, ri.nLen); CpsQSamLoad += ri.nLen; } else { nCpsQSamLen += ri.nLen; } continue; } // Different interleave SIMM QSound sample ROMs if ((ri.nType & BRF_SND) && ((ri.nType & 15) == 15)) { if (bLoad) { BurnLoadRom(CpsQSamLoad + 1, i + 0, 2); BurnLoadRom(CpsQSamLoad + 0, i + 1, 2); i += 2; } else { nCpsQSamLen += ri.nLen; } continue; } } // 68K program ROMs if ((ri.nType & 7) == 1) { if (bLoad) { BurnLoadRom(CpsRomLoad, i, 1); CpsRomLoad += ri.nLen; } else { nCpsRomLen += ri.nLen; } continue; } // XOR tables if ((ri.nType & 7) == 2) { if (bLoad) { BurnLoadRom(CpsCodeLoad, i, 1); CpsCodeLoad += ri.nLen; } else { nCpsCodeLen += ri.nLen; } continue; } // Z80 program ROMs if ((ri.nType & 7) == 4) { if (bLoad) { BurnLoadRom(CpsZRomLoad, i, 1); CpsZRomLoad += ri.nLen; } else { nCpsZRomLen += ri.nLen; } continue; } // Normal Graphics ROMs if (ri.nType & BRF_GRA) { if (bLoad) { if ((ri.nType & 15) == 6) { Cps2LoadTilesSplit(CpsGfxLoad, i); CpsGfxLoad += (nGfxMaxSize == ~0U ? ri.nLen : nGfxMaxSize) * 4; i += 15; } else { Cps2LoadTiles(CpsGfxLoad, i); CpsGfxLoad += (nGfxMaxSize == ~0U ? ri.nLen : nGfxMaxSize) * 4; i += 3; } } else { if (ri.nLen > nGfxMaxSize) { nGfxMaxSize = ri.nLen; } if (ri.nLen < nGfxMaxSize) { nGfxMaxSize = ~0U; } nCpsGfxLen += ri.nLen; nGfxNum++; } continue; } // QSound sample ROMs if (ri.nType & BRF_SND) { if (bLoad) { BurnLoadRom(CpsQSamLoad, i, 1); BurnByteswap(CpsQSamLoad, ri.nLen); CpsQSamLoad += ri.nLen; } else { nCpsQSamLen += ri.nLen; } continue; } } if (bLoad) { #if 0 for (unsigned int i = 0; i < nCpsCodeLen / 4; i++) { ((unsigned int*)CpsCode)[i] ^= ((unsigned int*)CpsRom)[i]; } #endif cps2_decrypt_game_data(); // if (!nCpsCodeLen) return 1; } else { if (nGfxMaxSize != ~0U) { nCpsGfxLen = nGfxNum * nGfxMaxSize; } #if 1 && defined FBA_DEBUG if (!nCpsCodeLen) { bprintf(PRINT_IMPORTANT, _T(" - 68K ROM size:\t0x%08X (Decrypted with key)\n"), nCpsRomLen); } else { bprintf(PRINT_IMPORTANT, _T(" - 68K ROM size:\t0x%08X (XOR table size: 0x%08X)\n"), nCpsRomLen, nCpsCodeLen); } bprintf(PRINT_IMPORTANT, _T(" - Z80 ROM size:\t0x%08X\n"), nCpsZRomLen); bprintf(PRINT_IMPORTANT, _T(" - Graphics data:\t0x%08X\n"), nCpsGfxLen); bprintf(PRINT_IMPORTANT, _T(" - QSound data:\t0x%08X\n"), nCpsQSamLen); #endif if (/*!nCpsCodeLen ||*/ !nCpsRomLen || !nCpsGfxLen || !nCpsZRomLen || ! nCpsQSamLen) { return 1; } } return 0; }
INT32 write_datfile(INT32 bType, FILE* fDat) { INT32 nRet=0; UINT32 nOldSelect=0; UINT32 nGameSelect=0; UINT32 nParentSelect,nBoardROMSelect; fprintf(fDat, "<?xml version=\"1.0\"?>\n"); fprintf(fDat, "<!DOCTYPE datafile PUBLIC \"-//FB Alpha//DTD ROM Management Datafile//EN\" \"http://www.logiqx.com/Dats/datafile.dtd\">\n\n"); fprintf(fDat, "<datafile>\n"); fprintf(fDat, "\t<header>\n"); fprintf(fDat, "\t\t<name>" APP_TITLE "</name>\n"); if (bType == DAT_ARCADE_ONLY) _ftprintf(fDat, _T("\t\t<description>") _T(APP_TITLE) _T(" v%s") _T(" Arcade Games</description>\n"), szAppBurnVer); if (bType == DAT_MEGADRIVE_ONLY) _ftprintf(fDat, _T("\t\t<description>") _T(APP_TITLE) _T(" v%s") _T(" Megadrive Games</description>\n"), szAppBurnVer); if (bType == DAT_PCENGINE_ONLY) _ftprintf(fDat, _T("\t\t<description>") _T(APP_TITLE) _T(" v%s") _T(" PC-Engine Games</description>\n"), szAppBurnVer); if (bType == DAT_TG16_ONLY) _ftprintf(fDat, _T("\t\t<description>") _T(APP_TITLE) _T(" v%s") _T(" TurboGrafx 16 Games</description>\n"), szAppBurnVer); if (bType == DAT_SGX_ONLY) _ftprintf(fDat, _T("\t\t<description>") _T(APP_TITLE) _T(" v%s") _T(" SuprGrafx Games</description>\n"), szAppBurnVer); fprintf(fDat, "\t\t<category>Standard DatFile</category>\n"); _ftprintf(fDat, _T("\t\t<version>%s</version>\n"), szAppBurnVer); fprintf(fDat, "\t\t<author>" APP_TITLE "</author>\n"); fprintf(fDat, "\t\t<homepage>http://www.barryharris.me.uk/</homepage>\n"); fprintf(fDat, "\t\t<url>http://www.barryharris.me.uk/</url>\n"); fprintf(fDat, "\t\t<clrmamepro forcenodump=\"ignore\"/>\n"); fprintf(fDat, "\t</header>\n"); nOldSelect=nBurnDrvActive; // preserve the currently selected driver // Go over each of the games for (nGameSelect=0;nGameSelect<nBurnDrvCount;nGameSelect++) { char sgName[32]; char spName[32]; char sbName[32]; char ssName[32]; UINT32 i=0; INT32 nPass=0; nBurnDrvActive=nGameSelect; // Switch to driver nGameSelect if ((BurnDrvGetFlags() & BDF_BOARDROM) || !strcmp(BurnDrvGetTextA(DRV_NAME), "neogeo")) { continue; } if ((((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_MEGADRIVE) || ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_PCENGINE_PCENGINE) || ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_PCENGINE_TG16) || ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_PCENGINE_SGX) ) && (bType == DAT_ARCADE_ONLY)) { continue; } if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) != HARDWARE_SEGA_MEGADRIVE) && (bType == DAT_MEGADRIVE_ONLY)) { continue; } if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) != HARDWARE_PCENGINE_PCENGINE) && (bType == DAT_PCENGINE_ONLY)) { continue; } if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) != HARDWARE_PCENGINE_TG16) && (bType == DAT_TG16_ONLY)) { continue; } if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) != HARDWARE_PCENGINE_SGX) && (bType == DAT_SGX_ONLY)) { continue; } strcpy(sgName, BurnDrvGetTextA(DRV_NAME)); strcpy(spName, ""); // make sure this string is empty before we start strcpy(sbName, ""); // make sure this string is empty before we start strcpy(ssName, ""); // make sure this string is empty before we start // Check to see if the game has a parent if (BurnDrvGetTextA(DRV_PARENT)) { nParentSelect=-1U; while (BurnDrvGetTextA(DRV_PARENT)) { strcpy(spName, BurnDrvGetTextA(DRV_PARENT)); for (i=0;i<nBurnDrvCount;i++) { nBurnDrvActive=i; if (!strcmp(spName, BurnDrvGetTextA(DRV_NAME))) { nParentSelect=i; break; } } } nBurnDrvActive=nGameSelect; // restore driver select } else nParentSelect=nGameSelect; // Check to see if the game has a BoardROM if (BurnDrvGetTextA(DRV_BOARDROM)) { nBoardROMSelect=-1U; strcpy(sbName, BurnDrvGetTextA(DRV_BOARDROM)); for (i=0;i<nBurnDrvCount;i++) { nBurnDrvActive=i; if (!strcmp(sbName, BurnDrvGetTextA(DRV_NAME))) { nBoardROMSelect=i; break; } } nBurnDrvActive=nGameSelect; // restore driver select } else nBoardROMSelect=nGameSelect; if (BurnDrvGetTextA(DRV_SAMPLENAME)) { strcpy(ssName, BurnDrvGetTextA(DRV_SAMPLENAME)); } if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_MEGADRIVE) || ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_PCENGINE_TG16) ) { // remove the md_ or tg_ char Temp[35]; INT32 Length; if (sgName[0]) { Length = strlen(sgName); memset(Temp, 0, 35); strcpy(Temp, sgName); memset(sgName, 0, 32); for (INT32 pos = 0; pos < Length; pos++) { sgName[pos] = Temp[pos + 3]; } } if (spName[0]) { Length = strlen(spName); memset(Temp, 0, 35); strcpy(Temp, spName); memset(spName, 0, 32); for (INT32 pos = 0; pos < Length; pos++) { spName[pos] = Temp[pos + 3]; } } } if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_PCENGINE_PCENGINE) || ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_PCENGINE_SGX) ) { // remove the pce__ or sgx__ char Temp[36]; INT32 Length; if (sgName[0]) { Length = strlen(sgName); memset(Temp, 0, 36); strcpy(Temp, sgName); memset(sgName, 0, 32); for (INT32 pos = 0; pos < Length; pos++) { sgName[pos] = Temp[pos + 4]; } } if (spName[0]) { Length = strlen(spName); memset(Temp, 0, 36); strcpy(Temp, spName); memset(spName, 0, 32); for (INT32 pos = 0; pos < Length; pos++) { spName[pos] = Temp[pos + 4]; } } } // Report problems if (nParentSelect==-1U) fprintf(fDat, "# Missing parent %s. It needs to be added to " APP_TITLE "!\n\n", spName); if (nBoardROMSelect==-1U) fprintf(fDat, "# Missing boardROM %s. It needs to be added to " APP_TITLE "!\n\n", sbName); // Write the header if (nParentSelect!=nGameSelect && nParentSelect!=-1U) { if (!strcmp(ssName, "") || !strcmp(ssName, sgName)) { fprintf(fDat, "\t<game name=\"%s\" cloneof=\"%s\" romof=\"%s\">\n", sgName, spName, spName); } else { fprintf(fDat, "\t<game name=\"%s\" cloneof=\"%s\" romof=\"%s\" sampleof=\"%s\">\n", sgName, spName, spName, ssName); } } else { // Add "romof" (but not 'cloneof') line for games that have boardROMs if (nBoardROMSelect!=nGameSelect && nBoardROMSelect!=-1U) { fprintf(fDat, "\t<game name=\"%s\" romof=\"%s\">\n", sgName, sbName); } else { if (!strcmp(ssName, "") || !strcmp(ssName, sgName)) { fprintf(fDat, "\t<game name=\"%s\">\n", sgName); } else { fprintf(fDat, "\t<game name=\"%s\" sampleof=\"%s\">\n", sgName, ssName); } } } char szGameName[255]; char szGameNameBuffer[255]; char szManufacturer[255]; char szManufacturerBuffer[255]; memset(szGameName, 0, 255); memset(szGameNameBuffer, 0, 255); memset(szManufacturer, 0, 255); memset(szManufacturerBuffer, 0, 255); strcpy(szGameName, DecorateGameName(nBurnDrvActive)); ReplaceAmpersand(szGameNameBuffer, szGameName); memset(szGameName, 0, 255); strcpy(szGameName, szGameNameBuffer); memset(szGameNameBuffer, 0, 255); ReplaceLessThan(szGameNameBuffer, szGameName); memset(szGameName, 0, 255); strcpy(szGameName, szGameNameBuffer); memset(szGameNameBuffer, 0, 255); ReplaceGreaterThan(szGameNameBuffer, szGameName); strcpy(szManufacturer, BurnDrvGetTextA(DRV_MANUFACTURER)); ReplaceAmpersand(szManufacturerBuffer, szManufacturer); memset(szManufacturer, 0, 255); strcpy(szManufacturer, szManufacturerBuffer); memset(szManufacturerBuffer, 0, 255); ReplaceLessThan(szManufacturerBuffer, szManufacturer); memset(szManufacturer, 0, 255); strcpy(szManufacturer, szManufacturerBuffer); memset(szManufacturerBuffer, 0, 255); ReplaceGreaterThan(szManufacturerBuffer, szManufacturer); fprintf(fDat, "\t\t<description>%s</description>\n", szGameNameBuffer); fprintf(fDat, "\t\t<year>%s</year>\n", BurnDrvGetTextA(DRV_DATE)); fprintf(fDat, "\t\t<manufacturer>%s</manufacturer>\n", szManufacturerBuffer); // Write the individual ROM info for (nPass=0; nPass<2; nPass++) { nBurnDrvActive=nGameSelect; // Skip pass 0 if possible (pass 0 only needed for old-style clrMAME format) if (nPass==0 /*&& (nBoardROMSelect==nGameSelect || nBoardROMSelect==-1U)*/) continue; // Go over each of the files needed for this game (upto 0x0100) for (i=0, nRet=0; nRet==0 && i<0x100; i++) { INT32 nRetTmp=0; struct BurnRomInfo ri; INT32 nLen; UINT32 nCrc; char *szPossibleName=NULL; INT32 j, nMerged=0; memset(&ri,0,sizeof(ri)); // Get info on this file nBurnDrvActive=nGameSelect; nRet=BurnDrvGetRomInfo(&ri,i); nRet+=BurnDrvGetRomName(&szPossibleName,i,0); if (ri.nLen==0) continue; if (nRet==0) { struct BurnRomInfo riTmp; char *szPossibleNameTmp; nLen=ri.nLen; nCrc=ri.nCrc; // Check for files from boardROMs if (nBoardROMSelect!=nGameSelect && nBoardROMSelect!=-1U) { nBurnDrvActive=nBoardROMSelect; nRetTmp=0; // Go over each of the files needed for this game (upto 0x0100) for (j=0; nRetTmp==0 && j<0x100; j++) { memset(&riTmp,0,sizeof(riTmp)); nRetTmp+=BurnDrvGetRomInfo(&riTmp,j); nRetTmp+=BurnDrvGetRomName(&szPossibleNameTmp,j,0); if (nRetTmp==0) { if (riTmp.nLen && riTmp.nCrc==nCrc && !strcmp(szPossibleName, szPossibleNameTmp)) { // This file is from a boardROM nMerged|=2; nRetTmp++; } } } } if (!nMerged && nParentSelect!=nGameSelect && nParentSelect!=-1U) { nBurnDrvActive=nParentSelect; nRetTmp=0; // Go over each of the files needed for this game (upto 0x0100) for (j=0; nRetTmp==0 && j<0x100; j++) { memset(&riTmp,0,sizeof(riTmp)); nRetTmp+=BurnDrvGetRomInfo(&riTmp,j); nRetTmp+=BurnDrvGetRomName(&szPossibleNameTmp,j,0); if (nRetTmp==0) { if (riTmp.nLen && riTmp.nCrc==nCrc && !strcmp(szPossibleName, szPossibleNameTmp)) { // This file is from a parent set nMerged|=1; nRetTmp++; } } } } nBurnDrvActive=nGameSelect; // Switch back to game } char szPossibleNameBuffer[255]; char szPossibleNameBuffer2[255]; memset(szPossibleNameBuffer, 0, 255); memset(szPossibleNameBuffer2, 0, 255); ReplaceAmpersand(szPossibleNameBuffer, szPossibleName); strcpy(szPossibleNameBuffer2, szPossibleNameBuffer); memset(szPossibleNameBuffer, 0, 255); ReplaceLessThan(szPossibleNameBuffer, szPossibleNameBuffer2); memset(szPossibleNameBuffer2, 0, 255); strcpy(szPossibleNameBuffer2, szPossibleNameBuffer); memset(szPossibleNameBuffer, 0, 255); ReplaceGreaterThan(szPossibleNameBuffer, szPossibleNameBuffer2); // File info if (nPass==1 && !nMerged) { if (ri.nType & BRF_NODUMP) { fprintf(fDat, "\t\t<rom name=\"%s\" size=\"%d\" status=\"nodump\"/>\n", szPossibleNameBuffer, ri.nLen); } else { fprintf(fDat, "\t\t<rom name=\"%s\" size=\"%d\" crc=\"%08x\"/>\n", szPossibleNameBuffer, ri.nLen, ri.nCrc); } } if (nPass==1 && nMerged) { // Files from parent/boardROMs if (ri.nType & BRF_NODUMP) { fprintf(fDat, "\t\t<rom name=\"%s\" merge=\"%s\" size=\"%d\" status=\"nodump\"/>\n", szPossibleNameBuffer, szPossibleNameBuffer, ri.nLen); } else { fprintf(fDat, "\t\t<rom name=\"%s\" merge=\"%s\" size=\"%d\" crc=\"%08x\"/>\n", szPossibleNameBuffer, szPossibleNameBuffer, ri.nLen, ri.nCrc); } } } // samples if (strcmp(ssName, "")) { for (i=0, nRet=0; nRet==0 && i<0x100; i++) { struct BurnSampleInfo si; char *szPossibleName=NULL; memset(&si,0,sizeof(si)); // Get info on this file nBurnDrvActive=nGameSelect; nRet=BurnDrvGetSampleInfo(&si,i); nRet+=BurnDrvGetSampleName(&szPossibleName,i,0); if (si.nFlags==0) continue; if (nPass == 1) { char szPossibleNameBuffer[255]; char szPossibleNameBuffer2[255]; memset(szPossibleNameBuffer, 0, 255); memset(szPossibleNameBuffer2, 0, 255); ReplaceAmpersand(szPossibleNameBuffer, szPossibleName); strcpy(szPossibleNameBuffer2, szPossibleNameBuffer); memset(szPossibleNameBuffer, 0, 255); ReplaceLessThan(szPossibleNameBuffer, szPossibleNameBuffer2); memset(szPossibleNameBuffer2, 0, 255); strcpy(szPossibleNameBuffer2, szPossibleNameBuffer); memset(szPossibleNameBuffer, 0, 255); ReplaceGreaterThan(szPossibleNameBuffer, szPossibleNameBuffer2); fprintf(fDat, "\t\t<sample name=\"%s\" />\n", szPossibleNameBuffer); } } } } fprintf(fDat, "\t</game>\n"); } // Do another pass over each of the games to find boardROMs for (nBurnDrvActive=0; nBurnDrvActive<nBurnDrvCount; nBurnDrvActive++) { INT32 i, nPass; if (!(BurnDrvGetFlags() & BDF_BOARDROM)) { continue; } if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) != HARDWARE_SEGA_MEGADRIVE) && (bType == DAT_MEGADRIVE_ONLY)) { continue; } if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) != HARDWARE_PCENGINE_PCENGINE) && (bType == DAT_PCENGINE_ONLY)) { continue; } if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) != HARDWARE_PCENGINE_TG16) && (bType == DAT_TG16_ONLY)) { continue; } if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) != HARDWARE_PCENGINE_SGX) && (bType == DAT_SGX_ONLY)) { continue; } fprintf(fDat, "\t<game isbios=\"yes\" name=\"%s\">\n", BurnDrvGetTextA(DRV_NAME)); fprintf(fDat, "\t\t<description>%s</description>\n", DecorateGameName(nBurnDrvActive)); fprintf(fDat, "\t\t<year>%s</year>\n", BurnDrvGetTextA(DRV_DATE)); fprintf(fDat, "\t\t<manufacturer>%s</manufacturer>\n", BurnDrvGetTextA(DRV_MANUFACTURER)); for (nPass=0; nPass<2; nPass++) { // No meta information needed (pass 0 only needed for old-style clrMAME format) if (nPass==0) continue; // Go over each of the individual files (upto 0x0100) for (i=0; i<0x100; i++) { struct BurnRomInfo ri; char *szPossibleName=NULL; memset(&ri,0,sizeof(ri)); nRet=BurnDrvGetRomInfo(&ri,i); nRet+=BurnDrvGetRomName(&szPossibleName,i,0); if (ri.nLen==0) continue; if (nRet==0) { char szPossibleNameBuffer[255]; char szPossibleNameBuffer2[255]; memset(szPossibleNameBuffer, 0, 255); memset(szPossibleNameBuffer2, 0, 255); ReplaceAmpersand(szPossibleNameBuffer, szPossibleName); strcpy(szPossibleNameBuffer2, szPossibleNameBuffer); memset(szPossibleNameBuffer, 0, 255); ReplaceLessThan(szPossibleNameBuffer, szPossibleNameBuffer2); memset(szPossibleNameBuffer2, 0, 255); strcpy(szPossibleNameBuffer2, szPossibleNameBuffer); memset(szPossibleNameBuffer, 0, 255); ReplaceGreaterThan(szPossibleNameBuffer, szPossibleNameBuffer2); fprintf(fDat, "\t\t<rom name=\"%s\" size=\"%d\" crc=\"%08x\"/>\n", szPossibleNameBuffer, ri.nLen, ri.nCrc); } } } fprintf(fDat, "\t</game>\n"); } // Restore current driver nBurnDrvActive=nOldSelect; fprintf(fDat, "</datafile>"); return 0; }
static void GameInpInitMacros() { struct GameInp* pgi; struct BurnInputInfo bii; int nPunchx3[4] = {0, 0, 0, 0}; int nPunchInputs[4][3]; int nKickx3[4] = {0, 0, 0, 0}; int nKickInputs[4][3]; int nNeogeoButtons[4][4]; bStreetFighterLayout = false; nMacroCount = 0; nFireButtons = 0; for (unsigned int i = 0; i < nGameInpCount; i++) { bii.szName = NULL; BurnDrvGetInputInfo(&bii, i); if (bii.szName == NULL) { bii.szName = ""; } if (bii.szName[0] == 'P' && bii.szName[1] >= '1' && bii.szName[1] <= '4') { int nPlayer = bii.szName[1] - '1'; if (nPlayer == 0) { if (strncmp(" fire", bii.szInfo + 2, 5) == 0) { nFireButtons++; } } if (_stricmp(" Weak Punch", bii.szName + 2) == 0) { nPunchx3[nPlayer] |= 1; nPunchInputs[nPlayer][0] = i; } if (_stricmp(" Medium Punch", bii.szName + 2) == 0) { nPunchx3[nPlayer] |= 2; nPunchInputs[nPlayer][1] = i; } if (_stricmp(" Strong Punch", bii.szName + 2) == 0) { nPunchx3[nPlayer] |= 4; nPunchInputs[nPlayer][2] = i; } if (_stricmp(" Weak Kick", bii.szName + 2) == 0) { nKickx3[nPlayer] |= 1; nKickInputs[nPlayer][0] = i; } if (_stricmp(" Medium Kick", bii.szName + 2) == 0) { nKickx3[nPlayer] |= 2; nKickInputs[nPlayer][1] = i; } if (_stricmp(" Strong Kick", bii.szName + 2) == 0) { nKickx3[nPlayer] |= 4; nKickInputs[nPlayer][2] = i; } if (_stricmp(" Button A", bii.szName + 2) == 0) { nNeogeoButtons[nPlayer][0] = i; } if (_stricmp(" Button B", bii.szName + 2) == 0) { nNeogeoButtons[nPlayer][1] = i; } if (_stricmp(" Button C", bii.szName + 2) == 0) { nNeogeoButtons[nPlayer][2] = i; } if (_stricmp(" Button D", bii.szName + 2) == 0) { nNeogeoButtons[nPlayer][3] = i; } } } pgi = GameInputs + nGameInpCount; for (int nPlayer = 0; nPlayer < nMaxPlayers; nPlayer++) { if (nPunchx3[nPlayer] == 7) { // Create a 3x punch macro pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i 3× Punch", nPlayer + 1); for (int j = 0; j < 3; j++) { BurnDrvGetInputInfo(&bii, nPunchInputs[nPlayer][j]); pgi->Macro.pVal[j] = bii.pVal; pgi->Macro.nVal[j] = 1; } nMacroCount++; pgi++; } if (nKickx3[nPlayer] == 7) { // Create a 3x kick macro pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i 3× Kick", nPlayer + 1); for (int j = 0; j < 3; j++) { BurnDrvGetInputInfo(&bii, nKickInputs[nPlayer][j]); pgi->Macro.pVal[j] = bii.pVal; pgi->Macro.nVal[j] = 1; } nMacroCount++; pgi++; } if (nFireButtons == 4 && (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_NEOGEO) { // A + B + C macro pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Button ABC", nPlayer + 1); BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][0]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][1]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][2]); pgi->Macro.pVal[2] = bii.pVal; pgi->Macro.nVal[2] = 1; nMacroCount++; pgi++; // B + C + D macro pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Button BCD", nPlayer + 1); BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][1]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][2]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][3]); pgi->Macro.pVal[2] = bii.pVal; pgi->Macro.nVal[2] = 1; nMacroCount++; pgi++; // A + B + C + D macro pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; sprintf(pgi->Macro.szName, "P%i Button ABCD", nPlayer + 1); BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][0]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][1]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][2]); pgi->Macro.pVal[2] = bii.pVal; pgi->Macro.nVal[2] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][3]); pgi->Macro.pVal[3] = bii.pVal; pgi->Macro.nVal[3] = 1; nMacroCount++; pgi++; } } if ((nPunchx3[0] == 7) && (nKickx3[0] == 7)) { bStreetFighterLayout = true; } if (nFireButtons >= 5 && (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_CAPCOM_CPS2) { bStreetFighterLayout = true; } }
int write_datfile(int bIncMegadrive, FILE* fDat) { int nRet=0; unsigned int nOldSelect=0; unsigned int nGameSelect=0; unsigned int nParentSelect,nBoardROMSelect; nOldSelect=nBurnDrvSelect; // preserve the currently selected driver // Go over each of the games for (nGameSelect=0;nGameSelect<nBurnDrvCount;nGameSelect++) { char sgName[32]; char spName[32]; char sbName[32]; char ssName[32]; unsigned int i=0; int nPass=0; nBurnDrvSelect=nGameSelect; // Switch to driver nGameSelect if (BurnDrvGetFlags() & BDF_BOARDROM) { continue; } if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_MEGADRIVE) && (bIncMegadrive == 0)) { continue; } if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) != HARDWARE_SEGA_MEGADRIVE) && (bIncMegadrive == 2)) { continue; } #if defined (ROM_VERIFY) if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_CAPCOM_CPS3) { continue; } #endif strcpy(sgName, BurnDrvGetTextA(DRV_NAME)); strcpy(spName, ""); // make sure this string is empty before we start strcpy(sbName, ""); // make sure this string is empty before we start strcpy(ssName, ""); // make sure this string is empty before we start // Check to see if the game has a parent if (BurnDrvGetTextA(DRV_PARENT)) { nParentSelect=-1U; while (BurnDrvGetTextA(DRV_PARENT)) { strcpy(spName, BurnDrvGetTextA(DRV_PARENT)); for (i=0;i<nBurnDrvCount;i++) { nBurnDrvSelect=i; if (!strcmp(spName, BurnDrvGetTextA(DRV_NAME))) { nParentSelect=i; break; } } } nBurnDrvSelect=nGameSelect; // restore driver select } else nParentSelect=nGameSelect; // Check to see if the game has a BoardROM if (BurnDrvGetTextA(DRV_BOARDROM)) { nBoardROMSelect=-1U; strcpy(sbName, BurnDrvGetTextA(DRV_BOARDROM)); for (i=0;i<nBurnDrvCount;i++) { nBurnDrvSelect=i; if (!strcmp(sbName, BurnDrvGetTextA(DRV_NAME))) { nBoardROMSelect=i; break; } } nBurnDrvSelect=nGameSelect; // restore driver select } else nBoardROMSelect=nGameSelect; if (BurnDrvGetTextA(DRV_SAMPLENAME)) { strcpy(ssName, BurnDrvGetTextA(DRV_SAMPLENAME)); } if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_MEGADRIVE) { // remove the md_ char Temp[35]; int Length; if (sgName[0]) { Length = strlen(sgName); memset(Temp, 0, 35); strcpy(Temp, sgName); memset(sgName, 0, 32); for (int pos = 0; pos < Length; pos++) { sgName[pos] = Temp[pos + 3]; } } if (spName[0]) { Length = strlen(spName); memset(Temp, 0, 35); strcpy(Temp, spName); memset(spName, 0, 32); for (int pos = 0; pos < Length; pos++) { spName[pos] = Temp[pos + 3]; } } } // Report problems if (nParentSelect==-1U) fprintf(fDat, "# Missing parent %s. It needs to be added to " APP_TITLE "!\n\n", spName); if (nBoardROMSelect==-1U) fprintf(fDat, "# Missing boardROM %s. It needs to be added to " APP_TITLE "!\n\n", sbName); // Write the header if (nParentSelect!=nGameSelect && nParentSelect!=-1U) { if (!strcmp(ssName, "") || !strcmp(ssName, sgName)) { fprintf(fDat, "\t<game name=\"%s\" cloneof=\"%s\" romof=\"%s\">\n", sgName, spName, spName); } else { fprintf(fDat, "\t<game name=\"%s\" cloneof=\"%s\" romof=\"%s\" sampleof=\"%s\">\n", sgName, spName, spName, ssName); } } else { // Add "romof" (but not 'cloneof') line for games that have boardROMs if (nBoardROMSelect!=nGameSelect && nBoardROMSelect!=-1U) { fprintf(fDat, "\t<game name=\"%s\" romof=\"%s\">\n", sgName, sbName); } else { if (!strcmp(ssName, "") || !strcmp(ssName, sgName)) { fprintf(fDat, "\t<game name=\"%s\">\n", sgName); } else { fprintf(fDat, "\t<game name=\"%s\" sampleof=\"%s\">\n", sgName, ssName); } } } char szGameName[255]; char szGameNameBuffer[255]; char szManufacturer[255]; char szManufacturerBuffer[255]; memset(szGameName, 0, 255); memset(szGameNameBuffer, 0, 255); memset(szManufacturer, 0, 255); memset(szManufacturerBuffer, 0, 255); strcpy(szGameName, DecorateGameName(nBurnDrvSelect)); ReplaceAmpersand(szGameNameBuffer, szGameName); strcpy(szManufacturer, BurnDrvGetTextA(DRV_MANUFACTURER)); ReplaceAmpersand(szManufacturerBuffer, szManufacturer); fprintf(fDat, "\t\t<description>%s</description>\n", szGameNameBuffer); fprintf(fDat, "\t\t<year>%s</year>\n", BurnDrvGetTextA(DRV_DATE)); fprintf(fDat, "\t\t<manufacturer>%s</manufacturer>\n", szManufacturerBuffer); // Write the individual ROM info for (nPass=0; nPass<2; nPass++) { nBurnDrvSelect=nGameSelect; // Skip pass 0 if possible (pass 0 only needed for old-style clrMAME format) if (nPass==0 /*&& (nBoardROMSelect==nGameSelect || nBoardROMSelect==-1U)*/) continue; // Go over each of the files needed for this game (upto 0x0100) for (i=0, nRet=0; nRet==0 && i<0x100; i++) { int nRetTmp=0; struct BurnRomInfo ri; int nLen; unsigned int nCrc; char *szPossibleName=NULL; int j, nMerged=0; memset(&ri,0,sizeof(ri)); // Get info on this file nBurnDrvSelect=nGameSelect; nRet=BurnDrvGetRomInfo(&ri,i); nRet+=BurnDrvGetRomName(&szPossibleName,i,0); if (ri.nLen==0) continue; if (nRet==0) { struct BurnRomInfo riTmp; char *szPossibleNameTmp; nLen=ri.nLen; nCrc=ri.nCrc; // Check for files from boardROMs if (nBoardROMSelect!=nGameSelect && nBoardROMSelect!=-1U) { nBurnDrvSelect=nBoardROMSelect; nRetTmp=0; // Go over each of the files needed for this game (upto 0x0100) for (j=0; nRetTmp==0 && j<0x100; j++) { memset(&riTmp,0,sizeof(riTmp)); nRetTmp+=BurnDrvGetRomInfo(&riTmp,j); nRetTmp+=BurnDrvGetRomName(&szPossibleNameTmp,j,0); if (nRetTmp==0) { if (riTmp.nLen && riTmp.nCrc==nCrc && !strcmp(szPossibleName, szPossibleNameTmp)) { // This file is from a boardROM nMerged|=2; nRetTmp++; } } } } if (!nMerged && nParentSelect!=nGameSelect && nParentSelect!=-1U) { nBurnDrvSelect=nParentSelect; nRetTmp=0; // Go over each of the files needed for this game (upto 0x0100) for (j=0; nRetTmp==0 && j<0x100; j++) { memset(&riTmp,0,sizeof(riTmp)); nRetTmp+=BurnDrvGetRomInfo(&riTmp,j); nRetTmp+=BurnDrvGetRomName(&szPossibleNameTmp,j,0); if (nRetTmp==0) { if (riTmp.nLen && riTmp.nCrc==nCrc && !strcmp(szPossibleName, szPossibleNameTmp)) { // This file is from a parent set nMerged|=1; nRetTmp++; } } } } nBurnDrvSelect=nGameSelect; // Switch back to game } char szPossibleNameBuffer[255]; memset(szPossibleNameBuffer, 0, 255); ReplaceAmpersand(szPossibleNameBuffer, szPossibleName); // File info if (nPass==1 && !nMerged) { if (ri.nType & BRF_NODUMP) { fprintf(fDat, "\t\t<rom name=\"%s\" size=\"%d\" status=\"nodump\"/>\n", szPossibleNameBuffer, ri.nLen); } else { fprintf(fDat, "\t\t<rom name=\"%s\" size=\"%d\" crc=\"%08x\"/>\n", szPossibleNameBuffer, ri.nLen, ri.nCrc); } } if (nPass==1 && nMerged) { // Files from parent/boardROMs if (ri.nType & BRF_NODUMP) { fprintf(fDat, "\t\t<rom name=\"%s\" merge=\"%s\" size=\"%d\" status=\"nodump\"/>\n", szPossibleNameBuffer, szPossibleNameBuffer, ri.nLen); } else { fprintf(fDat, "\t\t<rom name=\"%s\" merge=\"%s\" size=\"%d\" crc=\"%08x\"/>\n", szPossibleNameBuffer, szPossibleNameBuffer, ri.nLen, ri.nCrc); } } } // samples if (strcmp(ssName, "")) { for (i=0, nRet=0; nRet==0 && i<0x100; i++) { struct BurnSampleInfo si; char *szPossibleName=NULL; memset(&si,0,sizeof(si)); // Get info on this file nBurnDrvSelect=nGameSelect; nRet=BurnDrvGetSampleInfo(&si,i); nRet+=BurnDrvGetSampleName(&szPossibleName,i,0); if (si.nFlags==0) continue; if (nPass == 1) { char szPossibleNameBuffer[255]; memset(szPossibleNameBuffer, 0, 255); ReplaceAmpersand(szPossibleNameBuffer, szPossibleName); fprintf(fDat, "\t\t<sample name=\"%s\" />\n", szPossibleNameBuffer); } } } } fprintf(fDat, "\t</game>\n"); } // Do another pass over each of the games to find boardROMs for (nBurnDrvSelect=0; nBurnDrvSelect<nBurnDrvCount; nBurnDrvSelect++) { int i, nPass; if (!(BurnDrvGetFlags() & BDF_BOARDROM)) { continue; } if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) != HARDWARE_SEGA_MEGADRIVE) && (bIncMegadrive == 2)) { continue; } fprintf(fDat, "\t<game isbios=\"yes\" name=\"%s\">\n", BurnDrvGetTextA(DRV_NAME)); fprintf(fDat, "\t\t<description>%s</description>\n", DecorateGameName(nBurnDrvSelect)); fprintf(fDat, "\t\t<year>%s</year>\n", BurnDrvGetTextA(DRV_DATE)); fprintf(fDat, "\t\t<manufacturer>%s</manufacturer>\n", BurnDrvGetTextA(DRV_MANUFACTURER)); for (nPass=0; nPass<2; nPass++) { // No meta information needed (pass 0 only needed for old-style clrMAME format) if (nPass==0) continue; // Go over each of the individual files (upto 0x0100) for (i=0; i<0x100; i++) { struct BurnRomInfo ri; char *szPossibleName=NULL; memset(&ri,0,sizeof(ri)); nRet=BurnDrvGetRomInfo(&ri,i); nRet+=BurnDrvGetRomName(&szPossibleName,i,0); if (ri.nLen==0) continue; if (nRet==0) { char szPossibleNameBuffer[255]; memset(szPossibleNameBuffer, 0, 255); ReplaceAmpersand(szPossibleNameBuffer, szPossibleName); fprintf(fDat, "\t\t<rom name=\"%s\" size=\"%d\" crc=\"%08x\"/>\n", szPossibleNameBuffer, ri.nLen, ri.nCrc); } } } fprintf(fDat, "\t</game>\n"); } // Restore current driver nBurnDrvSelect=nOldSelect; fprintf(fDat, "</datafile>"); return 0; }