Donpachi high-quality music mod [iq_132]

This commit is contained in:
dinkc64 2015-04-16 13:34:03 +00:00
parent 60e62df280
commit d4f29e170a
1 changed files with 116 additions and 11 deletions

View File

@ -2,8 +2,14 @@
#include "cave.h"
#include "msm6295.h"
#define USE_SAMPLE_HACK // allow use of high quality music samples.
#define CAVE_VBLANK_LINES 12
#ifdef USE_SAMPLE_HACK
#include "samples.h"
#endif
static UINT8 DrvJoy1[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
static UINT8 DrvJoy2[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
static UINT16 DrvInput[2] = {0x0000, 0x0000};
@ -26,6 +32,10 @@ static INT8 nUnknownIRQ;
static INT8 nIRQPending;
#ifdef USE_SAMPLE_HACK
static UINT8 previous_sound_write[3] = { 0, 0, 0 };
#endif
static struct BurnInputInfo donpachiInputList[] = {
{"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin"},
{"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"},
@ -56,6 +66,15 @@ static struct BurnInputInfo donpachiInputList[] = {
STDINPUTINFO(donpachi)
static void DrvSampleReset()
{
BurnSampleReset();
// don't autoplay everything @ reset w/ SAMPLE_AUTOLOOP
for (INT32 i = 0;i < 20; i++){
BurnSampleStop(i);
}
}
static void UpdateIRQStatus()
{
nIRQPending = (nVideoIRQ == 0 || nSoundIRQ == 0 || nUnknownIRQ == 0);
@ -259,6 +278,47 @@ void __fastcall donpachiWriteWord(UINT32 sekAddress, UINT16 wordValue)
case 0xB00000:
case 0xB00002:
#ifdef USE_SAMPLE_HACK
if (wordValue == 0x78) {
memset (previous_sound_write, 0, 3);
} else {
previous_sound_write[0] = previous_sound_write[1];
previous_sound_write[1] = previous_sound_write[2];
previous_sound_write[2] = wordValue;
if (previous_sound_write[0] == 0x08) {
UINT16 select = (previous_sound_write[1]*256) + previous_sound_write[2];
INT32 sample = 0xff;
switch (select)
{
// I'm silencing all sounds from the music chip atm, it may be necessary to let some of
// these actually play. Just set use BurnSampleReset, and restore the volume of the music chip.
case 0xcc12: sample = 0x00; break;
case 0x8112: sample = 0x01; break;
case 0x9814: sample = 0x02; break;
case 0xb113: sample = 0x03; break;
case 0xa112: sample = 0x04; break;
case 0xd812: sample = 0x05; break;
case 0x9313: sample = 0x06; break;
case 0xe813: sample = 0x07; break;
case 0xf013: sample = 0x08; break;
case 0xf111: sample = 0x09; break;
case 0x9a13: sample = 0x0a; break;
case 0xf813: sample = 0x0b; break;
case 0xd013: sample = 0x0c; break;
case 0xc813: sample = 0x0d; break;
}
if (sample != 0xff && BurnSampleGetStatus(sample) == 0) {
DrvSampleReset();
BurnSamplePlay(sample);
// bprintf (0, _T("Sample playing: %d\n"), sample);
}
}
}
#endif
MSM6295Command(0, wordValue);
break;
case 0xB00010:
@ -285,6 +345,7 @@ void __fastcall donpachiWriteWord(UINT32 sekAddress, UINT16 wordValue)
INT32 nBank = (sekAddress >> 1) & 3;
INT32 nChip = (sekAddress >> 3) & 1;
INT32 nAddress = wordValue << 16;
while (nAddress > nBankSize[nChip]) {
nAddress -= nBankSize[nChip];
}
@ -322,6 +383,9 @@ static INT32 DrvExit()
MSM6295Exit(0);
MSM6295Exit(1);
#ifdef USE_SAMPLE_HACK
BurnSampleExit();
#endif
CaveTileExit();
CaveSpriteExit();
@ -350,7 +414,10 @@ static INT32 DrvDoReset()
MSM6295Reset(0);
MSM6295Reset(1);
#ifdef USE_SAMPLE_HACK
DrvSampleReset();
memset (previous_sound_write, 0, 3);
#endif
return 0;
}
@ -451,6 +518,9 @@ static INT32 DrvFrame()
if (nSegmentLength) {
MSM6295Render(0, pSoundBuf, nSegmentLength);
MSM6295Render(1, pSoundBuf, nSegmentLength);
#ifdef USE_SAMPLE_HACK
BurnSampleRender(pSoundBuf, nSegmentLength);
#endif
}
}
}
@ -547,7 +617,9 @@ static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
MSM6295Scan(0, nAction);
MSM6295Scan(1, nAction);
#ifdef USE_SAMPLE_HACK
BurnSampleScan(nAction, pnMin);
#endif
SCAN_VAR(nVideoIRQ);
SCAN_VAR(nSoundIRQ);
SCAN_VAR(nUnknownIRQ);
@ -620,7 +692,11 @@ static INT32 DrvInit()
MSM6295Init(0, 8000, 0);
MSM6295Init(1, 16000, 0);
#ifdef USE_SAMPLE_HACK
MSM6295SetRoute(0, 0.00, BURN_SND_ROUTE_BOTH);
#else
MSM6295SetRoute(0, 1.60, BURN_SND_ROUTE_BOTH);
#endif
MSM6295SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH);
MSM6295SampleData[0][0] = MSM6295ROM + 0x100000;
@ -632,6 +708,14 @@ static INT32 DrvInit()
MSM6295SampleData[0][3] = MSM6295ROM + 0x100000;
MSM6295SampleInfo[0][3] = MSM6295ROM + 0x100000 + 0x0300;
#ifdef USE_SAMPLE_HACK
BurnUpdateProgress(0.0, _T("Loading samples..."), 0);
BurnSampleInit(1);
BurnSampleSetAllRoutesAllSamples(0.40, BURN_SND_ROUTE_BOTH);
if (BurnSampleGetStatus(0) == -1) // Samples not found, fallback to internal samples.
MSM6295SetRoute(0, 1.60, BURN_SND_ROUTE_BOTH);
#endif
bDrawScreen = true;
DrvDoReset(); // Reset machine
@ -724,47 +808,68 @@ static struct BurnRomInfo donpachihkRomDesc[] = {
{ "peel18cv8p-15.u18", 0x0155, 0x3f4787e9, BRF_OPT },
};
STD_ROM_PICK(donpachihk)
STD_ROM_FN(donpachihk)
static struct BurnSampleInfo DonpachiSampleDesc[] = {
#ifdef USE_SAMPLE_HACK
{ "02 - Sortie Instruction.wav", SAMPLE_AUTOLOOP },
{ "03 - Silent Outpost Base.wav", SAMPLE_AUTOLOOP },
{ "04 - Gale Force.wav", SAMPLE_AUTOLOOP },
{ "05 - God of Destruction.wav", SAMPLE_AUTOLOOP },
{ "06 - Advance Through the Sky.wav", SAMPLE_AUTOLOOP },
{ "07 - The Battle Intensifies.wav", SAMPLE_AUTOLOOP },
{ "08 - An Equal Match.wav", SAMPLE_AUTOLOOP },
{ "09 - It's All Up To Me!!.wav", SAMPLE_NOLOOP },
{ "10 - Chief's Congratulations.wav", SAMPLE_NOLOOP },
{ "11 - Breakthrough.wav", SAMPLE_NOLOOP },
{ "12 - Pressure.wav", SAMPLE_AUTOLOOP },
{ "13 - My Duty is Done.wav", SAMPLE_AUTOLOOP },
{ "14 - Eternal Soldier.wav", SAMPLE_AUTOLOOP },
{ "15 - Chase in the Dark.wav", SAMPLE_AUTOLOOP },
#endif
{ "", 0 }
};
STD_SAMPLE_PICK(Donpachi)
STD_SAMPLE_FN(Donpachi)
struct BurnDriver BurnDrvDonpachi = {
"donpachi", NULL, NULL, NULL, "1995",
"donpachi", NULL, NULL, "donpachi", "1995",
"DonPachi (USA, ver. 1.12, 95/05/2x)\0", NULL, "Atlus / Cave", "Cave",
L"\u9996\u9818\u8702 DonPachi (USA, ver. 1.12, 95/05/2x)\0", NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_ONLY | HARDWARE_CAVE_M6295, GBF_VERSHOOT, 0,
NULL, donpachiRomInfo, donpachiRomName, NULL, NULL, donpachiInputInfo, NULL,
NULL, donpachiRomInfo, donpachiRomName, DonpachiSampleInfo, DonpachiSampleName, donpachiInputInfo, NULL,
DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
&CaveRecalcPalette, 0x8000, 240, 320, 3, 4
};
struct BurnDriver BurnDrvDonpachij = {
"donpachij", "donpachi", NULL, NULL, "1995",
"donpachij", "donpachi", NULL, "donpachi", "1995",
"DonPachi (Japan, ver. 1.01, 95/05/11)\0", NULL, "Atlus / Cave", "Cave",
L"\u9996\u9818\u8702 DonPachi (Japan, ver. 1.01, 95/05/11)\0", NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_ONLY | HARDWARE_CAVE_M6295, GBF_VERSHOOT, 0,
NULL, donpachijRomInfo, donpachijRomName, NULL, NULL, donpachiInputInfo, NULL,
NULL, donpachijRomInfo, donpachijRomName, DonpachiSampleInfo, DonpachiSampleName, donpachiInputInfo, NULL,
DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
&CaveRecalcPalette, 0x8000, 240, 320, 3, 4
};
struct BurnDriver BurnDrvDonpachikr = {
"donpachikr", "donpachi", NULL, NULL, "1995",
"donpachikr", "donpachi", NULL, "donpachi", "1995",
"DonPachi (Korea, ver. 1.12, 95/05/2x)\0", NULL, "Atlus / Cave", "Cave",
L"\u9996\u9818\u8702 DonPachi (Korea, ver. 1.12, 95/05/2x)\0", NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_ONLY | HARDWARE_CAVE_M6295, GBF_VERSHOOT, 0,
NULL, donpachikrRomInfo, donpachikrRomName, NULL, NULL, donpachiInputInfo, NULL,
NULL, donpachikrRomInfo, donpachikrRomName, DonpachiSampleInfo, DonpachiSampleName, donpachiInputInfo, NULL,
DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
&CaveRecalcPalette, 0x8000, 240, 320, 3, 4
};
struct BurnDriver BurnDrvDonpachihk = {
"donpachihk", "donpachi", NULL, NULL, "1995",
"donpachihk", "donpachi", NULL, "donpachi", "1995",
"DonPachi (Hong Kong, ver. 1.10, 95/05/17)\0", NULL, "Atlus / Cave", "Cave",
L"\u9996\u9818\u8702 DonPachi (Hong Kong, ver. 1.10, 95/05/17)\0", NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_ONLY | HARDWARE_CAVE_M6295, GBF_VERSHOOT, 0,
NULL, donpachihkRomInfo, donpachihkRomName, NULL, NULL, donpachiInputInfo, NULL,
NULL, donpachihkRomInfo, donpachihkRomName, DonpachiSampleInfo, DonpachiSampleName, donpachiInputInfo, NULL,
DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
&CaveRecalcPalette, 0x8000, 240, 320, 3, 4
};