Add ability to disable Q-Sound in CPS-2 drivers, and add Gigaman 2 to d_cps2.cpp

This commit is contained in:
Barry Harris 2012-05-02 08:57:20 +00:00
parent 11d66011af
commit e8ec85b5c4
6 changed files with 210 additions and 41 deletions

View File

@ -4,6 +4,7 @@
INT32 Cps = 0; // 1 = CPS1, 2 = CPS2, 3 = CPS Changer
INT32 Cps1Qs = 0;
INT32 Cps1DisablePSnd = 0; // Disables the Z80 as well
INT32 Cps2DisableQSnd = 0; // Disables the Z80 as well
INT32 nCPS68KClockspeed = 0;
INT32 nCpsCycles = 0; // 68K Cycles per frame
@ -897,6 +898,43 @@ INT32 Cps2LoadTilesSIM(UINT8* Tile, INT32 nStart)
return 0;
}
INT32 Cps2LoadTilesGigaman2(UINT8 *Tile, UINT8 *pSrc)
{
UINT8 *pt = Tile;
UINT8 *pr = pSrc;
for (INT32 b = 0; b < 0x200000 >> 19; b++) {
Cps2Load100000(pt, pr, 0); pt += 0x100000;
Cps2Load100000(pt, pr + 2, 0); pt += 0x100000;
pr += 0x80000;
}
pt = Tile;
pr = pSrc + 0x200000;
for (INT32 b = 0; b < 0x200000 >> 19; b++) {
Cps2Load100000(pt, pr, 2); pt += 0x100000;
Cps2Load100000(pt, pr + 2, 2); pt += 0x100000;
pr += 0x80000;
}
pt = Tile + 4;
pr = pSrc + 0x400000;
for (INT32 b = 0; b < 0x200000 >> 19; b++) {
Cps2Load100000(pt, pr, 0); pt += 0x100000;
Cps2Load100000(pt, pr + 2, 0); pt += 0x100000;
pr += 0x80000;
}
pt = Tile + 4;
pr = pSrc + 0x600000;
for (INT32 b = 0; b < 0x200000 >> 19; b++) {
Cps2Load100000(pt, pr, 2); pt += 0x100000;
Cps2Load100000(pt, pr + 2, 2); pt += 0x100000;
pr += 0x80000;
}
return 0;
}
// ----------------------------------------------------------------
// The file extension indicates the data contained in a file.

View File

@ -17,6 +17,7 @@ extern UINT32 CpsBID[3]; // Board ID changes
extern INT32 Cps; // 1 = CPS1, 2 = CPS2, 3 = CPS CHanger
extern INT32 Cps1Qs;
extern INT32 Cps1DisablePSnd;
extern INT32 Cps2DisableQSnd;
extern INT32 nCPS68KClockspeed;
extern INT32 nCpsCycles; // Cycles per frame
extern INT32 nCpsZ80Cycles;
@ -53,6 +54,7 @@ INT32 CpsLoadStarsByte(UINT8 *pStar, INT32 nStart);
INT32 CpsLoadStarsForgottnAlt(UINT8 *pStar, INT32 nStart);
INT32 Cps2LoadTiles(UINT8 *Tile,INT32 nStart);
INT32 Cps2LoadTilesSIM(UINT8 *Tile,INT32 nStart);
INT32 Cps2LoadTilesGigaman2(UINT8 *Tile, UINT8 *pSrc);
// cps_config.h
#define CPS_B_01 0

View File

@ -29,7 +29,7 @@ static INT32 CpsMemIndex()
CpsSavePal = Next; Next += 0x002000; // Draw Copy of Correct Palette
if (Cps == 2 || Cps1Qs == 1) {
if (((Cps == 2) && !Cps2DisableQSnd) || Cps1Qs == 1) {
CpsZRamC0 = Next; Next += 0x001000; // Z80 c000-cfff
CpsZRamF0 = Next; Next += 0x001000; // Z80 f000-ffff
}
@ -103,7 +103,7 @@ void CpsMapObjectBanks(INT32 nBank)
INT32 __fastcall CPSResetCallback()
{
// Reset instruction on 68000
if (!Cps1DisablePSnd) ZetReset(); // Reset Z80 (CPU #1)
if (((Cps & 1) && !Cps1DisablePSnd) || ((Cps == 2) && !Cps2DisableQSnd)) ZetReset(); // Reset Z80 (CPU #1)
return 0;
}
@ -294,7 +294,7 @@ INT32 CpsMemInit()
SekSetWriteWordHandler(0, CpsWriteWord);
// QSound
if (Cps == 2) {
if ((Cps == 2) && !Cps2DisableQSnd) {
SekMapHandler(1, 0x618000, 0x619FFF, SM_RAM);
SekSetReadByteHandler(1, CPSQSoundC0ReadByte);
@ -352,7 +352,7 @@ static INT32 ScanRam()
ba.Data = CpsRamFF; ba.nLen = 0x010000; ba.szName = "CpsRamFF"; BurnAcb(&ba);
ba.Data = CpsReg; ba.nLen = 0x000100; ba.szName = "CpsReg"; BurnAcb(&ba);
if (Cps == 2 || Cps1Qs == 1) {
if (((Cps == 2) && !Cps2DisableQSnd) || Cps1Qs == 1) {
ba.Data = CpsZRamC0; ba.nLen = 0x001000; ba.szName = "CpsZRamC0"; BurnAcb(&ba);
ba.Data = CpsZRamF0; ba.nLen = 0x001000; ba.szName = "CpsZRamF0"; BurnAcb(&ba);
}
@ -425,10 +425,10 @@ INT32 CpsAreaScan(INT32 nAction, INT32 *pnMin)
}
}
if (Cps == 2 || Cps1Qs == 1) { // Scan QSound chips
if (((Cps == 2) && !Cps2DisableQSnd) || Cps1Qs == 1) { // Scan QSound chips
QsndScan(nAction);
} else { // Scan PSound chips
if (!Cps1DisablePSnd) PsndScan(nAction);
if ((Cps & 1) && !Cps1DisablePSnd) PsndScan(nAction);
}
if (CpsMemScanCallbackFunction) {

View File

@ -50,7 +50,7 @@ static INT32 DrvReset()
SekReset();
SekClose();
if (!Cps1DisablePSnd) {
if (((Cps & 1) && !Cps1DisablePSnd) || ((Cps == 2) && !Cps2DisableQSnd)) {
ZetOpen(0);
ZetReset();
ZetClose();
@ -69,7 +69,7 @@ static INT32 DrvReset()
nCpsCyclesExtra = 0;
if (Cps == 2 || Cps1Qs == 1) { // Sound init (QSound)
if (((Cps == 2) && !Cps2DisableQSnd) || Cps1Qs == 1) { // Sound init (QSound)
QsndReset();
}
@ -139,7 +139,7 @@ INT32 CpsRunInit()
}
}
if (Cps == 2 || Cps1Qs == 1) { // Sound init (QSound)
if (((Cps == 2) && !Cps2DisableQSnd) || Cps1Qs == 1) { // Sound init (QSound)
if (QsndInit()) {
return 1;
}
@ -170,7 +170,7 @@ INT32 CpsRunExit()
if (Cps == 2 || PangEEP || Cps1Qs == 1) EEPROMExit();
// Sound exit
if (Cps == 2 || Cps1Qs == 1) QsndExit();
if (((Cps == 2) && !Cps2DisableQSnd) || Cps1Qs == 1) QsndExit();
if (Cps != 2 && Cps1Qs == 0 && !Cps1DisablePSnd) PsndExit();
// Graphics exit
@ -197,6 +197,8 @@ INT32 CpsRunExit()
CpsRunFrameEndCallbackFunction = NULL;
Cps1VBlankIRQLine = 2;
Cps2DisableQSnd = 0;
return 0;
}
@ -377,7 +379,7 @@ INT32 Cps2Frame()
// prevline = -1;
SekNewFrame();
QsndNewFrame();
if (!Cps2DisableQSnd) QsndNewFrame();
nCpsCycles = (INT32)(((INT64)nCPS68KClockspeed * nBurnCPUSpeedAdjust) / 0x0100);
SekOpen(0);
@ -452,7 +454,7 @@ INT32 Cps2Frame()
nCpsCyclesExtra = SekTotalCycles() - nCpsCycles;
QsndEndFrame();
if (!Cps2DisableQSnd) QsndEndFrame();
SekClose();

View File

@ -461,7 +461,7 @@ void __fastcall CpsWriteWord(UINT32 a, UINT16 d)
if (a == 0x804040) {
if ((d & 0x0008) == 0) {
ZetReset();
if (!Cps2DisableQSnd) ZetReset();
}
}

View File

@ -10064,24 +10064,6 @@ static struct BurnRomInfo ProgearjdRomDesc[] = {
STD_ROM_PICK(Progearjd)
STD_ROM_FN(Progearjd)
static struct BurnRomInfo ProgearjblRomDesc[] = {
{ "pgaj_bl.03", 0x080000, 0x4fef676c, 1 | BRF_ESS | BRF_PRG }, // this fails the rom test - bootleggers probably didn't update checksum
{ "pgaj_bl.04", 0x080000, 0xa069bd3b, 1 | BRF_ESS | BRF_PRG }, // this fails the rom test - bootleggers probably didn't update checksum
{ "pga.13m", 0x400000, 0x5194c198, 3 | BRF_GRA },
{ "pga.15m", 0x400000, 0xb794e83f, 3 | BRF_GRA },
{ "pga.17m", 0x400000, 0x87f22918, 3 | BRF_GRA },
{ "pga.19m", 0x400000, 0x65ffb45b, 3 | BRF_GRA },
{ "pga.01", 0x020000, 0xBDBFA992, 4 | BRF_ESS | BRF_PRG },
{ "pga.11m", 0x400000, 0xabdd224e, 5 | BRF_SND },
{ "pga.12m", 0x400000, 0xdac53406, 5 | BRF_SND },
};
STD_ROM_PICK(Progearjbl)
STD_ROM_FN(Progearjbl)
static struct BurnRomInfo RingdstdRomDesc[] = {
{ "smbed.03b", 0x080000, 0xf6fba4cd, 1 | BRF_ESS | BRF_PRG },
{ "smbed.04b", 0x080000, 0x193bc493, 1 | BRF_ESS | BRF_PRG },
@ -10907,16 +10889,6 @@ struct BurnDriver BurnDrvCpsProgearjd = {
&CpsRecalcPal, 0x1000, 384, 224, 4, 3
};
struct BurnDriver BurnDrvCpsProgearjbl = {
"progearjbl", "progear", NULL, NULL, "2001",
"Progear No Arashi (010117 Japan, decrypted set)\0", NULL, "bootleg", "CPS2",
L"\u30D7\u30ED\u30AE\u30A2\u306E\u5D50 (Progear No Arashi 010117 Japan, decrypted set)\0", NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_CAPCOM_CPS2 | HARDWARE_CAPCOM_CPS2_SIMM, GBF_HORSHOOT, 0,
NULL, ProgearjblRomInfo, ProgearjblRomName, NULL, NULL, ProgearInputInfo, NULL,
PhoenixInit, DrvExit, Cps2Frame, CpsRedraw, CpsAreaScan,
&CpsRecalcPal, 0x1000, 384, 224, 4, 3
};
struct BurnDriver BurnDrvCpsRingdstd = {
"ringdstd", "ringdest", NULL, NULL, "1994",
"Ring of Destruction - slammasters II (940902 Euro Phoenix Edition)\0", NULL, "bootleg", "CPS2",
@ -11096,3 +11068,158 @@ struct BurnDriver BurnDrvCpsXmvsfu1d = {
PhoenixInit, DrvExit, Cps2Frame, CpsRedraw, CpsAreaScan,
&CpsRecalcPal, 0x1000, 384, 224, 4, 3
};
// other bootlegs
// Progear No Arashi (010117 Japan, decrypted set)
static struct BurnRomInfo ProgearjblRomDesc[] = {
{ "pgaj_bl.03", 0x080000, 0x4fef676c, 1 | BRF_ESS | BRF_PRG }, // this fails the rom test - bootleggers probably didn't update checksum
{ "pgaj_bl.04", 0x080000, 0xa069bd3b, 1 | BRF_ESS | BRF_PRG }, // this fails the rom test - bootleggers probably didn't update checksum
{ "pga.13m", 0x400000, 0x5194c198, 3 | BRF_GRA },
{ "pga.15m", 0x400000, 0xb794e83f, 3 | BRF_GRA },
{ "pga.17m", 0x400000, 0x87f22918, 3 | BRF_GRA },
{ "pga.19m", 0x400000, 0x65ffb45b, 3 | BRF_GRA },
{ "pga.01", 0x020000, 0xBDBFA992, 4 | BRF_ESS | BRF_PRG },
{ "pga.11m", 0x400000, 0xabdd224e, 5 | BRF_SND },
{ "pga.12m", 0x400000, 0xdac53406, 5 | BRF_SND },
};
STD_ROM_PICK(Progearjbl)
STD_ROM_FN(Progearjbl)
struct BurnDriver BurnDrvCpsProgearjbl = {
"progearjbl", "progear", NULL, NULL, "2001",
"Progear No Arashi (010117 Japan, decrypted set)\0", NULL, "bootleg", "CPS2",
L"\u30D7\u30ED\u30AE\u30A2\u306E\u5D50 (Progear No Arashi 010117 Japan, decrypted set)\0", NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_CAPCOM_CPS2 | HARDWARE_CAPCOM_CPS2_SIMM, GBF_HORSHOOT, 0,
NULL, ProgearjblRomInfo, ProgearjblRomName, NULL, NULL, ProgearInputInfo, NULL,
PhoenixInit, DrvExit, Cps2Frame, CpsRedraw, CpsAreaScan,
&CpsRecalcPal, 0x1000, 384, 224, 4, 3
};
// Gigaman 2: The Power Fighters (bootleg of Megaman 2)
static struct BurnRomInfo Gigaman2RomDesc[] = {
{ "sys_rom1.bin", 0x400000, 0x2eaa5e10, BRF_ESS | BRF_PRG },
{ "cg_rom1.bin", 0x800000, 0xed55a641, BRF_GRA },
{ "cg_rom2.bin", 0x800000, 0x63918c05, BRF_GRA },
{ "pcm_rom1.bin", 0x800000, 0x41a854ab, BRF_SND },
{ "89c4051.bin", 0x010000, 0x00000000, BRF_PRG | BRF_NODUMP }, // sound MCU
};
STD_ROM_PICK(Gigaman2)
STD_ROM_FN(Gigaman2)
static UINT8 *Gigaman2DummyQsndRam = NULL;
static INT32 Gigaman2Init()
{
Cps = 2;
Cps2DisableQSnd = 1;
CpsLayer1XOffs = -0x09;
CpsLayer2XOffs = -0x09;
CpsLayer3XOffs = -0x09;
nCpsGfxLen = 0x800000;
nCpsRomLen = 0x180000;
nCpsCodeLen = 0x180000;
nCpsZRomLen = 0;
nCpsQSamLen = 0;
nCpsAdLen = 0x800000;
Gigaman2DummyQsndRam = (UINT8*)BurnMalloc(0x20000);
CpsInit();
INT32 nRet = 0;
// Load program rom (seperate data and code)
UINT8 *pTemp = (UINT8*)BurnMalloc(0x400000);
if (!pTemp) return 1;
nRet = BurnLoadRom(pTemp, 0, 1); if (nRet) return 1;
memcpy(CpsRom , pTemp + 0x000000, 0x180000);
memcpy(CpsCode, pTemp + 0x200000, 0x180000);
BurnFree(pTemp);
// Load graphic roms, descramble and decode
pTemp = (UINT8*)BurnMalloc(0xc00000);
if (!pTemp) return 1;
// we are only interested in the first 0x400000 of each rom
nRet = BurnLoadRom(pTemp + 0x000000, 1, 1); if (nRet) return 1;
nRet = BurnLoadRom(pTemp + 0x400000, 2, 1); if (nRet) return 1;
// copy to CpsGfx as a temp buffer and descramble
memcpy(CpsGfx, pTemp, nCpsGfxLen);
memset(pTemp, 0, 0xc00000);
UINT16 *pTemp16 = (UINT16*)pTemp;
UINT16 *CpsGfx16 = (UINT16*)CpsGfx;
for (INT32 i = 0; i < 0x800000 >> 1; i++) {
pTemp16[i] = CpsGfx16[((i & ~7) >> 2) | ((i & 4) << 18) | ((i & 2) >> 1) | ((i & 1) << 21)];
}
// copy back to CpsGfx as a temp buffer and put into a format easier to decode
memcpy(CpsGfx, pTemp, nCpsGfxLen);
memset(pTemp, 0, 0xc00000);
for (INT32 i = 0; i < 0x100000; i++) {
pTemp16[i + 0x000000] = CpsGfx16[(i * 4) + 0];
pTemp16[i + 0x100000] = CpsGfx16[(i * 4) + 1];
pTemp16[i + 0x200000] = CpsGfx16[(i * 4) + 2];
pTemp16[i + 0x300000] = CpsGfx16[(i * 4) + 3];
}
// clear CpsGfx and finally decode
memset(CpsGfx, 0, nCpsGfxLen);
Cps2LoadTilesGigaman2(CpsGfx, pTemp);
BurnFree(pTemp);
// Load the MSM6295 Data
nRet = BurnLoadRom(CpsAd, 3, 1); if (nRet) return 1;
nRet = CpsRunInit();
SekOpen(0);
SekMapMemory(Gigaman2DummyQsndRam, 0x618000, 0x619fff, SM_RAM);
SekClose();
// nCpsNumScanlines = 262; // phoenix sets seem to be sensitive to timing??
return nRet;
}
static INT32 Gigaman2Exit()
{
BurnFree(Gigaman2DummyQsndRam);
return DrvExit();
}
static INT32 Gigaman2Scan(INT32 nAction, INT32 *pnMin)
{
struct BurnArea ba;
if (nAction & ACB_MEMORY_RAM) {
memset(&ba, 0, sizeof(ba));
ba.Data = Gigaman2DummyQsndRam;
ba.nLen = 0x020000;
ba.szName = "Gigaman2DummyQsndRam";
BurnAcb(&ba);
}
return CpsAreaScan(nAction, pnMin);
}
struct BurnDriver BurnDrvCpsGigaman2 = {
"gigaman2", "megaman2", NULL, NULL, "1996",
"Gigaman 2: The Power Fighters (bootleg)\0", "No Sound (MCU not dumped)", "bootleg", "CPS2",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_CAPCOM_CPS2, GBF_VSFIGHT, 0,
NULL, Gigaman2RomInfo, Gigaman2RomName, NULL, NULL, Megaman2InputInfo, NULL,
Gigaman2Init, Gigaman2Exit, Cps2Frame, CpsRedraw, Gigaman2Scan,
&CpsRecalcPal, 0x1000, 384, 224, 4, 3
};