diff --git a/src/burn/drivers/cave/d_korokoro.cpp b/src/burn/drivers/cave/d_korokoro.cpp index d24d40f52..965d8431f 100644 --- a/src/burn/drivers/cave/d_korokoro.cpp +++ b/src/burn/drivers/cave/d_korokoro.cpp @@ -263,9 +263,7 @@ static INT32 DrvExit() SekExit(); // Deallocate 68000s - // Deallocate all used memory BurnFree(Mem); - Mem = NULL; return 0; } @@ -286,8 +284,6 @@ static INT32 DrvDoReset() nIRQPending = 0; - YMZ280BReset(); - return 0; } @@ -557,13 +553,13 @@ static INT32 DrvInit() memset(Mem, 0, nLen); // blank all memory MemIndex(); // Index the allocated memory - EEPROMInit(&eeprom_interface_93C46_8bit); - // Load the roms into memory if (LoadRoms()) { return 1; } + EEPROMInit(&eeprom_interface_93C46_8bit); + { SekInit(0, 0x68000); // Allocate 68000 @@ -635,13 +631,13 @@ static INT32 crushermInit() memset(Mem, 0, nLen); // blank all memory MemIndex(); // Index the allocated memory - EEPROMInit(&eeprom_interface_93C46_8bit); - // Load the roms into memory if (crushermLoadRoms()) { return 1; } + EEPROMInit(&eeprom_interface_93C46_8bit); + { SekInit(0, 0x68000); // Allocate 68000 diff --git a/src/burn/drivers/cave/d_mazinger.cpp b/src/burn/drivers/cave/d_mazinger.cpp index 2ad42fef5..38cd731a2 100644 --- a/src/burn/drivers/cave/d_mazinger.cpp +++ b/src/burn/drivers/cave/d_mazinger.cpp @@ -331,11 +331,7 @@ static INT32 DrvExit() DrvOkiBank1 = 0; DrvOkiBank2 = 0; - // Deallocate all used memory - if (Mem) { - free(Mem); - Mem = NULL; - } + BurnFree(Mem); return 0; } @@ -407,7 +403,6 @@ static INT32 DrvFrame() INT32 nCyclesVBlank; INT32 nInterleave = 80; - INT32 nSoundBufferPos = 0; INT32 nCyclesSegment; @@ -478,13 +473,6 @@ static INT32 DrvFrame() } BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2203Update(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } } SekClose(); @@ -492,12 +480,8 @@ static INT32 DrvFrame() BurnTimerEndFrame(nCyclesTotal[1]); if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - BurnYM2203Update(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - } + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); } ZetClose(); @@ -564,31 +548,25 @@ static INT32 LoadRoms() BurnLoadRom(RomZ80, 2, 1); - UINT8 *pTemp = (UINT8*)malloc(0x400000); + UINT8 *pTemp = (UINT8*)BurnMalloc(0x400000); BurnLoadRom(pTemp + 0x000000, 3, 1); BurnLoadRom(pTemp + 0x200000, 4, 1); for (INT32 i = 0; i < 0x400000; i++) { CaveSpriteROM[i ^ 0xdf88] = pTemp[BITSWAP24(i,23,22,21,20,19,9,7,3,15,4,17,14,18,2,16,5,11,8,6,13,1,10,12,0)]; } - if (pTemp) { - free(pTemp); - pTemp = NULL; - } + BurnFree(pTemp); NibbleSwap1(CaveSpriteROM, 0x400000); BurnLoadRom(CaveTileROM[0], 5, 1); NibbleSwap2(CaveTileROM[0], 0x200000); - pTemp = (UINT8*)malloc(0x200000); + pTemp = (UINT8*)BurnMalloc(0x200000); BurnLoadRom(pTemp, 6, 1); for (INT32 i = 0; i < 0x0100000; i++) { CaveTileROM[1][(i << 1) + 1] = (pTemp[(i << 1) + 0] & 15) | ((pTemp[(i << 1) + 1] & 15) << 4); CaveTileROM[1][(i << 1) + 0] = (pTemp[(i << 1) + 0] >> 4) | (pTemp[(i << 1) + 1] & 240); } - if (pTemp) { - free(pTemp); - pTemp = NULL; - } + BurnFree(pTemp); // Load MSM6295 ADPCM data BurnLoadRom(MSM6295ROMSrc, 7, 1); @@ -673,9 +651,7 @@ static double DrvGetTime() static INT32 drvZInit() { ZetInit(1); - ZetOpen(0); - ZetSetInHandler(mazingerZIn); ZetSetOutHandler(mazingerZOut); ZetSetReadHandler(mazingerZRead); @@ -695,16 +671,12 @@ static INT32 drvZInit() ZetMapArea (0xf800, 0xffFF, 0, RamZ80 + 0x0800); // Direct Read from RAM ZetMapArea (0xf800, 0xffFF, 1, RamZ80 + 0x0800); // Direct Write to RAM ZetMapArea (0xf800, 0xffFF, 2, RamZ80 + 0x0800); // - ZetMemEnd(); - ZetClose(); return 0; } -static const UINT8 default_eeprom[16] = {0xED,0xFF,0x00,0x00,0x12,0x31,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; - static INT32 DrvInit() { INT32 nLen; @@ -715,7 +687,7 @@ static INT32 DrvInit() Mem = NULL; MemIndex(); nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)malloc(nLen)) == NULL) { + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { return 1; } memset(Mem, 0, nLen); // blank all memory @@ -763,6 +735,7 @@ static INT32 DrvInit() CaveTileInitLayer(1, 0x400000, 6, 0x4400); BurnYM2203Init(1, 4000000, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnYM2203SetVolumeShift(2); BurnTimerAttachZet(4000000); memcpy(MSM6295ROM, MSM6295ROMSrc, 0x40000); @@ -797,7 +770,7 @@ static struct BurnRomInfo mazingerRomDesc[] = { { "bp943a-4.u64", 0x080000, 0x3fc7f29a, BRF_SND }, // 7 MSM6295 #1 ADPCM data - { "mazinger_world.nv", 0x0080, 0x4f6225c6, BRF_OPT }, + { "mazinger_world.nv", 0x0080, 0x4f6225c6, BRF_ESS | BRF_PRG }, }; @@ -818,7 +791,7 @@ static struct BurnRomInfo mazingerjRomDesc[] = { { "bp943a-4.u64", 0x080000, 0x3fc7f29a, BRF_SND }, // 7 MSM6295 #1 ADPCM data - { "mazinger_japan.nv", 0x0080, 0xf84a2a45, BRF_OPT }, + { "mazinger_japan.nv", 0x0080, 0xf84a2a45, BRF_ESS | BRF_PRG }, }; diff --git a/src/burn/drivers/cave/d_metmqstr.cpp b/src/burn/drivers/cave/d_metmqstr.cpp index b2eb882ad..cbcd97887 100644 --- a/src/burn/drivers/cave/d_metmqstr.cpp +++ b/src/burn/drivers/cave/d_metmqstr.cpp @@ -345,11 +345,7 @@ static INT32 DrvExit() DrvOkiBank2_1 = 0; DrvOkiBank2_2 = 0; - // Deallocate all used memory - if (Mem) { - free(Mem); - Mem = NULL; - } + BurnFree(Mem); return 0; } @@ -670,9 +666,7 @@ static INT32 DrvScan(INT32 nAction, INT32 *pnMin) static INT32 drvZInit() { ZetInit(1); - ZetOpen(0); - ZetSetInHandler(metmqstrZIn); ZetSetOutHandler(metmqstrZOut); ZetSetReadHandler(metmqstrZRead); @@ -688,9 +682,7 @@ static INT32 drvZInit() ZetMapArea (0xe000, 0xFFFF, 0, RamZ80 + 0x0000); // Direct Read from RAM ZetMapArea (0xe000, 0xFFFF, 1, RamZ80 + 0x0000); // Direct Write to RAM ZetMapArea (0xe000, 0xFFFF, 2, RamZ80 + 0x0000); // - ZetMemEnd(); - ZetClose(); return 0; @@ -715,18 +707,18 @@ static INT32 DrvInit() Mem = NULL; MemIndex(); nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)malloc(nLen)) == NULL) { + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { return 1; } memset(Mem, 0, nLen); // blank all memory MemIndex(); // Index the allocated memory - EEPROMInit(&eeprom_interface_93C46); - // Load the roms into memory if (LoadRoms()) { return 1; } + + EEPROMInit(&eeprom_interface_93C46); { SekInit(0, 0x68000); // Allocate 68000 @@ -768,8 +760,8 @@ static INT32 DrvInit() memcpy(MSM6295ROM, MSM6295ROMSrc1, 0x40000); memcpy(MSM6295ROM + 0x100000, MSM6295ROMSrc2, 0x40000); - MSM6295Init(0, 2000000 / 132, 100.0, 1); - MSM6295Init(1, 2000000 / 132, 100.0, 1); + MSM6295Init(0, 2000000 / 132, 30.0, 1); + MSM6295Init(1, 2000000 / 132, 30.0, 1); bDrawScreen = true; diff --git a/src/burn/drivers/cave/d_pwrinst2.cpp b/src/burn/drivers/cave/d_pwrinst2.cpp index 9699b1d18..36e79646d 100644 --- a/src/burn/drivers/cave/d_pwrinst2.cpp +++ b/src/burn/drivers/cave/d_pwrinst2.cpp @@ -423,11 +423,7 @@ static INT32 DrvExit() DrvOkiBank1[0] = DrvOkiBank1[1] = DrvOkiBank1[2] = DrvOkiBank1[3] = 0; DrvOkiBank2[0] = DrvOkiBank2[1] = DrvOkiBank2[2] = DrvOkiBank2[3] = 0; - // Deallocate all used memory - if (Mem) { - free(Mem); - Mem = NULL; - } + BurnFree(Mem); return 0; } @@ -536,7 +532,6 @@ static INT32 DrvFrame() { INT32 nCyclesVBlank; INT32 nInterleave = 100; - INT32 nSoundBufferPos = 0; INT32 nCyclesSegment; @@ -603,14 +598,6 @@ static INT32 DrvFrame() } BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2203Update(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - MSM6295Render(1, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } } SekClose(); @@ -618,13 +605,9 @@ static INT32 DrvFrame() BurnTimerEndFrame(nCyclesTotal[1]); if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - BurnYM2203Update(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - MSM6295Render(1, pSoundBuf, nSegmentLength); - } + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); } ZetClose(); @@ -695,7 +678,7 @@ static INT32 LoadRoms() BurnLoadRom(RomZ80, 4, 1); - UINT8 *pTemp = (UINT8*)malloc(0xe00000); + UINT8 *pTemp = (UINT8*)BurnMalloc(0xe00000); BurnLoadRom(pTemp + 0x000000, 5, 1); BurnLoadRom(pTemp + 0x200000, 6, 1); BurnLoadRom(pTemp + 0x400000, 7, 1); @@ -708,10 +691,7 @@ static INT32 LoadRoms() if (((j & 6) == 0) || ((j & 6) == 6)) j ^= 6; CaveSpriteROM[j ^ 7] = (pTemp[i] >> 4) | (pTemp[i] << 4); } - if (pTemp) { - free(pTemp); - pTemp = NULL; - } + BurnFree(pTemp); NibbleSwap1(CaveSpriteROM, 0xe00000); BurnLoadRom(CaveTileROM[0], 12, 1); @@ -743,7 +723,7 @@ static INT32 PlegendsLoadRoms() BurnLoadRom(RomZ80, 6, 1); - UINT8 *pTemp = (UINT8*)malloc(0x1000000); + UINT8 *pTemp = (UINT8*)BurnMalloc(0x1000000); BurnLoadRom(pTemp + 0x000000, 7, 1); BurnLoadRom(pTemp + 0x200000, 8, 1); BurnLoadRom(pTemp + 0x400000, 9, 1); @@ -757,10 +737,7 @@ static INT32 PlegendsLoadRoms() if (((j & 6) == 0) || ((j & 6) == 6)) j ^= 6; CaveSpriteROM[j ^ 7] = (pTemp[i] >> 4) | (pTemp[i] << 4); } - if (pTemp) { - free(pTemp); - pTemp = NULL; - } + BurnFree(pTemp); NibbleSwap1(CaveSpriteROM, 0x1000000); BurnLoadRom(CaveTileROM[0], 15, 1); @@ -858,9 +835,7 @@ static double DrvGetTime() static INT32 drvZInit() { ZetInit(1); - ZetOpen(0); - ZetSetInHandler(pwrinst2ZIn); ZetSetOutHandler(pwrinst2ZOut); ZetSetReadHandler(pwrinst2ZRead); @@ -876,9 +851,7 @@ static INT32 drvZInit() ZetMapArea (0xE000, 0xFFFF, 0, RamZ80); // Direct Read from RAM ZetMapArea (0xE000, 0xFFFF, 1, RamZ80); // Direct Write to RAM ZetMapArea (0xE000, 0xFFFF, 2, RamZ80); // - ZetMemEnd(); - ZetClose(); return 0; @@ -894,18 +867,18 @@ static INT32 DrvInit() Mem = NULL; MemIndex(); nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)malloc(nLen)) == NULL) { + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { return 1; } memset(Mem, 0, nLen); // blank all memory MemIndex(); // Index the allocated memory - EEPROMInit(&eeprom_interface_93C46); - // Load the roms into memory if (LoadRoms()) { return 1; } + + EEPROMInit(&eeprom_interface_93C46); { SekInit(0, 0x68000); // Allocate 68000 @@ -943,10 +916,11 @@ static INT32 DrvInit() nCaveExtraYOffset = 1; BurnYM2203Init(1, 4000000, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnYM2203SetVolumeShift(2); BurnTimerAttachZet(8000000); - MSM6295Init(0, 3000000 / 165, 50.0, 1); - MSM6295Init(1, 3000000 / 165, 50.0, 1); + MSM6295Init(0, 3000000 / 165, 20.0, 1); + MSM6295Init(1, 3000000 / 165, 30.0, 1); if (!strcmp(BurnDrvGetTextA(DRV_NAME), "pwrinst2")) { UINT16 *rom = (UINT16 *)Rom01; @@ -974,18 +948,18 @@ static INT32 PlegendsInit() Mem = NULL; MemIndex(); nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)malloc(nLen)) == NULL) { + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { return 1; } memset(Mem, 0, nLen); // blank all memory MemIndex(); // Index the allocated memory - EEPROMInit(&eeprom_interface_93C46); - // Load the roms into memory if (PlegendsLoadRoms()) { return 1; } + + EEPROMInit(&eeprom_interface_93C46); { SekInit(0, 0x68000); // Allocate 68000 @@ -1024,10 +998,11 @@ static INT32 PlegendsInit() nCaveExtraYOffset = 1; BurnYM2203Init(1, 4000000, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnYM2203SetVolumeShift(2); BurnTimerAttachZet(8000000); - MSM6295Init(0, 3000000 / 165, 50.0, 1); - MSM6295Init(1, 3000000 / 165, 50.0, 1); + MSM6295Init(0, 3000000 / 165, 20.0, 1); + MSM6295Init(1, 3000000 / 165, 30.0, 1); bDrawScreen = true; diff --git a/src/burn/drivers/cave/d_sailormn.cpp b/src/burn/drivers/cave/d_sailormn.cpp index 946522b70..bce8d96be 100644 --- a/src/burn/drivers/cave/d_sailormn.cpp +++ b/src/burn/drivers/cave/d_sailormn.cpp @@ -454,8 +454,8 @@ static INT32 DrvExit() { EEPROMExit(); - MSM6295Exit(1); MSM6295Exit(0); + MSM6295Exit(1); BurnYM2151Exit(); CaveTileExit(); @@ -466,11 +466,7 @@ static INT32 DrvExit() SekExit(); // Deallocate 68000s - // Deallocate all used memory - if (Mem) { - free(Mem); - Mem = NULL; - } + BurnFree(Mem); return 0; } @@ -482,9 +478,9 @@ static INT32 DrvDoReset() SekClose(); nCurrentBank = -1; - drvZ80Bankswitch(0); - + ZetOpen(0); + drvZ80Bankswitch(0); ZetReset(); ZetClose(); @@ -734,16 +730,13 @@ static INT32 sailormnLoadRoms() // Load Z80 ROM BurnLoadRom(RomZ80, 2, 1); - pTemp = (UINT8*)malloc(0x400000); + pTemp = (UINT8*)BurnMalloc(0x400000); BurnLoadRom(pTemp + 0x000000, 3, 1); BurnLoadRom(pTemp + 0x200000, 4, 1); for (INT32 i = 0; i < 0x400000; i++) { CaveSpriteROM[i ^ 0x950C4] = pTemp[BITSWAP24(i, 23, 22, 21, 20, 15, 10, 12, 6, 11, 1, 13, 3, 16, 17, 2, 5, 14, 7, 18, 8, 4, 19, 9, 0)]; } - if (pTemp) { - free(pTemp); - pTemp = NULL; - } + BurnFree(pTemp); sailormnDecodeSprites(CaveSpriteROM, 0x400000); BurnLoadRom(CaveTileROM[0], 5, 1); @@ -757,7 +750,7 @@ static INT32 sailormnLoadRoms() BurnLoadRom(CaveTileROM[2] + 0x800000, 11, 1); sailormnDecodeTiles(CaveTileROM[2], 0xA00000); - pTemp = (UINT8*)malloc(0x600000); + pTemp = (UINT8*)BurnMalloc(0x600000); BurnLoadRom(pTemp + 0x000000, 12, 1); BurnLoadRom(pTemp + 0x200000, 13, 1); BurnLoadRom(pTemp + 0x400000, 14, 1); @@ -767,10 +760,7 @@ static INT32 sailormnLoadRoms() CaveTileROM[2][(i << 2) + 2] |= (pTemp[i] & 0x30); CaveTileROM[2][(i << 2) + 3] |= (pTemp[i] & 0xC0) >> 2; } - if (pTemp) { - free(pTemp); - pTemp = NULL; - } + BurnFree(pTemp); // Load OKIM6295 data BurnLoadRom(MSM6295ROM + 0x0000000, 15, 1); @@ -803,7 +793,7 @@ static INT32 agalletLoadRoms() BurnLoadRom(CaveTileROM[2], 6, 1); sailormnDecodeTiles(CaveTileROM[2], 0x200000); - UINT8* pTemp = (UINT8*)malloc(0x200000); + UINT8* pTemp = (UINT8*)BurnMalloc(0x200000); BurnLoadRom(pTemp, 7, 1); for (INT32 i = 0; i < 0x0100000; i++) { CaveTileROM[2][(i << 2) + 0] |= (pTemp[i] & 0x03) << 4; @@ -811,10 +801,7 @@ static INT32 agalletLoadRoms() CaveTileROM[2][(i << 2) + 2] |= (pTemp[i] & 0x30); CaveTileROM[2][(i << 2) + 3] |= (pTemp[i] & 0xC0) >> 2; } - if (pTemp) { - free(pTemp); - pTemp = NULL; - } + BurnFree(pTemp); // Load OKIM6295 data BurnLoadRom(MSM6295ROM + 0x0000000, 8, 1); @@ -880,9 +867,6 @@ static INT32 DrvScan(INT32 nAction, INT32 *pnMin) return 0; } -static const UINT8 agallet_default_eeprom[48] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff}; -static const UINT8 sailormn_default_eeprom[18] = {0xa5,0x00,0xa5,0x00,0xa5,0x00,0xa5,0x00,0xa5,0x01,0xa5,0x01,0xa5,0x04,0xa5,0x01,0xa5,0x02}; - static INT32 gameInit() { INT32 nLen; @@ -893,14 +877,12 @@ static INT32 gameInit() Mem = NULL; MemIndex(); nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)malloc(nLen)) == NULL) { + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { return 1; } memset(Mem, 0, nLen); // blank all memory MemIndex(); // Index the allocated memory - - if (nWhichGame) { // Load the roms into memory if (agalletLoadRoms()) { @@ -966,8 +948,8 @@ static INT32 gameInit() BurnYM2151Init(32000000 / 8, 25.0); BurnYM2151SetIrqHandler(&drvYM2151IRQHandler); - MSM6295Init(0, 16000, 80.0, 1); - MSM6295Init(1, 16000, 80.0, 1); + MSM6295Init(0, 16000, 100.0, 1); + MSM6295Init(1, 16000, 100.0, 1); EEPROMInit(&eeprom_interface_93C46); if (!EEPROMAvailable()) EEPROMFill(DefEEPROM,0, 0x80); @@ -1024,7 +1006,7 @@ static struct BurnRomInfo sailormnRomDesc[] = { { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - { "sailormn_europe.nv", 0x0080, 0x59a7dc50, BRF_OPT }, + { "sailormn_europe.nv", 0x0080, 0x59a7dc50, BRF_ESS | BRF_PRG }, }; @@ -1056,7 +1038,7 @@ static struct BurnRomInfo sailormnuRomDesc[] = { { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - { "sailormn_usa.nv", 0x0080, 0x3915abe3, BRF_OPT }, + { "sailormn_usa.nv", 0x0080, 0x3915abe3, BRF_ESS | BRF_PRG }, }; @@ -1088,7 +1070,7 @@ static struct BurnRomInfo sailormnjRomDesc[] = { { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - { "sailormn_japan.nv", 0x0080, 0xea03c30a, BRF_OPT }, + { "sailormn_japan.nv", 0x0080, 0xea03c30a, BRF_ESS | BRF_PRG }, }; @@ -1120,7 +1102,7 @@ static struct BurnRomInfo sailormnkRomDesc[] = { { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - { "sailormn_korea.nv", 0x0080, 0x0e7de398, BRF_OPT }, + { "sailormn_korea.nv", 0x0080, 0x0e7de398, BRF_ESS | BRF_PRG }, }; @@ -1152,7 +1134,7 @@ static struct BurnRomInfo sailormntRomDesc[] = { { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - { "sailormn_taiwan.nv", 0x0080, 0x6c7e8c2a, BRF_OPT }, + { "sailormn_taiwan.nv", 0x0080, 0x6c7e8c2a, BRF_ESS | BRF_PRG }, }; @@ -1184,7 +1166,7 @@ static struct BurnRomInfo sailormnhRomDesc[] = { { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - { "sailormn_hongkong.nv", 0x0080, 0x4d24c874, BRF_OPT }, + { "sailormn_hongkong.nv", 0x0080, 0x4d24c874, BRF_ESS | BRF_PRG }, }; @@ -1216,7 +1198,7 @@ static struct BurnRomInfo sailormnoRomDesc[] = { { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - { "sailormn_europe.nv", 0x0080, 0x59a7dc50, BRF_OPT }, + { "sailormn_europe.nv", 0x0080, 0x59a7dc50, BRF_ESS | BRF_PRG }, }; @@ -1248,7 +1230,7 @@ static struct BurnRomInfo sailormnouRomDesc[] = { { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - { "sailormn_usa.nv", 0x0080, 0x3915abe3, BRF_OPT }, + { "sailormn_usa.nv", 0x0080, 0x3915abe3, BRF_ESS | BRF_PRG }, }; @@ -1280,7 +1262,7 @@ static struct BurnRomInfo sailormnojRomDesc[] = { { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - { "sailormn_japan.nv", 0x0080, 0xea03c30a, BRF_OPT }, + { "sailormn_japan.nv", 0x0080, 0xea03c30a, BRF_ESS | BRF_PRG }, }; @@ -1312,7 +1294,7 @@ static struct BurnRomInfo sailormnokRomDesc[] = { { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - { "sailormn_korea.nv", 0x0080, 0x0e7de398, BRF_OPT }, + { "sailormn_korea.nv", 0x0080, 0x0e7de398, BRF_ESS | BRF_PRG }, }; @@ -1344,7 +1326,7 @@ static struct BurnRomInfo sailormnotRomDesc[] = { { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - { "sailormn_taiwan.nv", 0x0080, 0x6c7e8c2a, BRF_OPT }, + { "sailormn_taiwan.nv", 0x0080, 0x6c7e8c2a, BRF_ESS | BRF_PRG }, }; @@ -1376,7 +1358,7 @@ static struct BurnRomInfo sailormnohRomDesc[] = { { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - { "sailormn_hongkong.nv", 0x0080, 0x4d24c874, BRF_OPT }, + { "sailormn_hongkong.nv", 0x0080, 0x4d24c874, BRF_ESS | BRF_PRG }, }; @@ -1398,7 +1380,7 @@ static struct BurnRomInfo agalletRomDesc[] = { { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data - { "agallet_europe.nv", 0x0080, 0xec38bf65, BRF_OPT }, + { "agallet_europe.nv", 0x0080, 0xec38bf65, BRF_ESS | BRF_PRG }, }; @@ -1420,7 +1402,7 @@ static struct BurnRomInfo agalletuRomDesc[] = { { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data - { "agallet_usa.nv", 0x0080, 0x72e65056, BRF_OPT }, + { "agallet_usa.nv", 0x0080, 0x72e65056, BRF_ESS | BRF_PRG }, }; @@ -1442,7 +1424,7 @@ static struct BurnRomInfo agalletjRomDesc[] = { { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data - { "agallet_japan.nv", 0x0080, 0x0753f547, BRF_OPT }, + { "agallet_japan.nv", 0x0080, 0x0753f547, BRF_ESS | BRF_PRG }, }; @@ -1464,7 +1446,7 @@ static struct BurnRomInfo agalletkRomDesc[] = { { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data - { "agallet_korea.nv", 0x0080, 0x7f41c253, BRF_OPT }, + { "agallet_korea.nv", 0x0080, 0x7f41c253, BRF_ESS | BRF_PRG }, }; @@ -1486,7 +1468,7 @@ static struct BurnRomInfo agallettRomDesc[] = { { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data - { "agallet_taiwan.nv", 0x0080, 0x0af46742, BRF_OPT }, + { "agallet_taiwan.nv", 0x0080, 0x0af46742, BRF_ESS | BRF_PRG }, }; @@ -1508,7 +1490,7 @@ static struct BurnRomInfo agallethRomDesc[] = { { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data - { "agallet_hongkong.nv", 0x0080, 0x998d1a74, BRF_OPT }, + { "agallet_hongkong.nv", 0x0080, 0x998d1a74, BRF_ESS | BRF_PRG }, }; diff --git a/src/burn/drivers/cave/d_tjumpman.cpp b/src/burn/drivers/cave/d_tjumpman.cpp index 1bfe90bc3..f03ff09b4 100644 --- a/src/burn/drivers/cave/d_tjumpman.cpp +++ b/src/burn/drivers/cave/d_tjumpman.cpp @@ -510,11 +510,11 @@ static INT32 DrvInit() memset(Mem, 0, nLen); MemIndex(); - EEPROMInit(&eeprom_interface_93C46); - if (LoadRoms()) { return 1; } + + EEPROMInit(&eeprom_interface_93C46); { SekInit(0, 0x68000); diff --git a/src/burn/drivers/cave/d_uopoko.cpp b/src/burn/drivers/cave/d_uopoko.cpp index 3973f2f03..31fdaa30e 100644 --- a/src/burn/drivers/cave/d_uopoko.cpp +++ b/src/burn/drivers/cave/d_uopoko.cpp @@ -12,6 +12,7 @@ static UINT8 *Mem = NULL, *MemEnd = NULL; static UINT8 *RamStart, *RamEnd; static UINT8 *Rom01; static UINT8 *Ram01; +static UINT8 *DefaultEEPROM = NULL; static UINT8 DrvReset = 0; static UINT8 bDrawScreen; @@ -242,11 +243,7 @@ static INT32 DrvExit() SekExit(); // Deallocate 68000s - // Deallocate all used memory - if (Mem) { - free(Mem); - Mem = NULL; - } + BurnFree(Mem); return 0; } @@ -267,8 +264,6 @@ static INT32 DrvDoReset() nIRQPending = 0; - YMZ280BReset(); - return 0; } @@ -394,6 +389,7 @@ static INT32 MemIndex() CaveSpriteROM = Next; Next += 0x800000; CaveTileROM[0] = Next; Next += 0x400000; // Tile layer 0 YMZ280BROM = Next; Next += 0x200000; + DefaultEEPROM = Next; Next += 0x000080; RamStart = Next; Ram01 = Next; Next += 0x010000; // CPU #0 work RAM CaveTileRAM[0] = Next; Next += 0x008000; @@ -445,6 +441,8 @@ static INT32 LoadRoms() // Load YMZ280B data BurnLoadRom(YMZ280BROM, 4, 1); + + BurnLoadRom(DefaultEEPROM, 5, 1); return 0; } @@ -485,8 +483,6 @@ static INT32 DrvScan(INT32 nAction, INT32 *pnMin) return 0; } -static const UINT8 default_eeprom[16] = {0x00,0x03,0x08,0x00,0xFF,0xFF,0xFF,0xFF,0x08,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF}; - static INT32 DrvInit() { INT32 nLen; @@ -497,20 +493,20 @@ static INT32 DrvInit() Mem = NULL; MemIndex(); nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)malloc(nLen)) == NULL) { + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { return 1; } memset(Mem, 0, nLen); // blank all memory MemIndex(); // Index the allocated memory - EEPROMInit(&eeprom_interface_93C46); - if (!EEPROMAvailable()) EEPROMFill(default_eeprom,0, sizeof(default_eeprom)); - // Load the roms into memory if (LoadRoms()) { return 1; } + EEPROMInit(&eeprom_interface_93C46); + if (!EEPROMAvailable()) EEPROMFill(DefaultEEPROM,0, 0x80); + { SekInit(0, 0x68000); // Allocate 68000 SekOpen(0); @@ -562,7 +558,7 @@ static struct BurnRomInfo uopokoRomDesc[] = { { "u4.bin", 0x200000, 0xA2D0D755, BRF_SND }, // 4 YMZ280B (AD)PCM data - { "eeprom-uopoko.bin", 0x0080, 0xf4a24b95, BRF_OPT }, + { "eeprom-uopoko.bin", 0x0080, 0xf4a24b95, BRF_ESS | BRF_PRG }, }; @@ -579,7 +575,7 @@ static struct BurnRomInfo uopokojRomDesc[] = { { "u4.bin", 0x200000, 0xA2D0D755, BRF_SND }, // 4 YMZ280B (AD)PCM data - { "eeprom-uopoko.bin", 0x0080, 0xf4a24b95, BRF_OPT }, + { "eeprom-uopoko.bin", 0x0080, 0xf4a24b95, BRF_ESS | BRF_PRG }, };