- Fixed Daytona 2 Advertise song. DSB2 MPEG state machine can now begin playing songs from state ST_GOTA4.

- krom: Minor fixes to Main.cpp to support wider ROM set names (up to 9 chars) and compilation under MinGW.
This commit is contained in:
Bart Trzynadlowski 2011-08-03 04:29:33 +00:00
parent 6b55cfb765
commit 6a6788952c
3 changed files with 1317 additions and 1284 deletions

View file

@ -291,9 +291,11 @@ void CDSB1::IOWrite8(UINT32 addr, UINT8 data)
break; break;
case 0xE8: // MPEG volume case 0xE8: // MPEG volume
volume = data;
break; break;
case 0xE9: // MPEG stereo case 0xE9: // MPEG stereo
stereo = data;
break; break;
case 0xF0: // command echo back case 0xF0: // command echo back
@ -394,6 +396,8 @@ void CDSB1::RunFrame(INT16 *audioL, INT16 *audioR)
// Run remaining cycles // Run remaining cycles
Z80.Run(cycles); Z80.Run(cycles);
//printf("VOLUME=%02X STEREO=%02X\n", volume, stereo);
// Decode MPEG for this frame // Decode MPEG for this frame
INT16 *mpegFill[2] = { &mpegL[retainedSamples], &mpegR[retainedSamples] }; INT16 *mpegFill[2] = { &mpegL[retainedSamples], &mpegR[retainedSamples] };
MPEG_Decode(mpegFill, 32000/60-retainedSamples+2); MPEG_Decode(mpegFill, 32000/60-retainedSamples+2);
@ -490,6 +494,7 @@ CDSB1::~CDSB1(void)
Digital Sound Board Type 2: 68K CPU Digital Sound Board Type 2: 68K CPU
******************************************************************************/ ******************************************************************************/
// MPEG state machine
enum enum
{ {
ST_IDLE = 0, ST_IDLE = 0,
@ -510,9 +515,28 @@ enum
ST_GOTB5, ST_GOTB5,
}; };
static const char *stateName[] =
{
"idle",
"st_14_0",
"st_14_1",
"st_got24",
"st_24_0",
"st_24_1",
"st_got74",
"st_gota0",
"st_gota1",
"st_gota4",
"st_gota5",
"st_gotb0",
"st_gotb1",
"st_gotb4",
"st_gotb5"
};
void CDSB2::WriteMPEGFIFO(UINT8 byte) void CDSB2::WriteMPEGFIFO(UINT8 byte)
{ {
//printf("fifo: %x (state %d)\n", byte, mpegState); printf("fifo: %x (state %s)\n", byte, stateName[mpegState]);
switch (mpegState) switch (mpegState)
{ {
case ST_IDLE: case ST_IDLE:
@ -524,6 +548,7 @@ void CDSB2::WriteMPEGFIFO(UINT8 byte)
else if (byte == 0x74 || byte == 0x75) // "start play" else if (byte == 0x74 || byte == 0x75) // "start play"
{ {
MPEG_PlayMemory((const char *) &mpegROM[mpegStart], mpegEnd-mpegStart); MPEG_PlayMemory((const char *) &mpegROM[mpegStart], mpegEnd-mpegStart);
printf("playing %X\n", mpegStart);
mpegState = ST_IDLE; mpegState = ST_IDLE;
playing = 1; playing = 1;
} }
@ -563,11 +588,11 @@ void CDSB2::WriteMPEGFIFO(UINT8 byte)
if (playing) if (playing)
{ {
//printf("Setting loop point to %x\n", mpegStart); printf("Setting loop point to %x\n", mpegStart);
MPEG_PlayMemory((const char *) &mpegROM[mpegStart], mpegEnd-mpegStart); MPEG_PlayMemory((const char *) &mpegROM[mpegStart], mpegEnd-mpegStart);
} }
//printf("mpegStart=%x\n", mpegStart); printf("mpegStart=%x\n", mpegStart);
break; break;
case ST_GOT24: case ST_GOT24:
mpegEnd &= ~0xff0000; mpegEnd &= ~0xff0000;
@ -582,7 +607,7 @@ void CDSB2::WriteMPEGFIFO(UINT8 byte)
case ST_24_1: case ST_24_1:
mpegEnd &= ~0xff; mpegEnd &= ~0xff;
mpegEnd |= (byte); mpegEnd |= (byte);
//printf("mpegEnd=%x\n", mpegEnd); printf("mpegEnd=%x\n", mpegEnd);
// default to full stereo // default to full stereo
// mixer_set_stereo_volume(0, 255, 255); // mixer_set_stereo_volume(0, 255, 255);
@ -599,8 +624,14 @@ void CDSB2::WriteMPEGFIFO(UINT8 byte)
case ST_GOTA1: case ST_GOTA1:
mpegState = ST_IDLE; mpegState = ST_IDLE;
break; break;
case ST_GOTA4: case ST_GOTA4: // dayto2pe plays advertise tune from this state by writing 0x75
mpegState = ST_IDLE; mpegState = ST_IDLE;
if (byte == 0x75)
{
MPEG_PlayMemory((const char *) &mpegROM[mpegStart], mpegEnd-mpegStart);
printf("playing %X (from st_gota4)\n", mpegStart);
playing = 1;
}
break; break;
case ST_GOTA5: case ST_GOTA5:
mpegState = ST_IDLE; mpegState = ST_IDLE;
@ -720,7 +751,7 @@ void CDSB2::Write16(UINT32 addr, UINT16 data)
*(UINT16 *) &ram[addr] = data; *(UINT16 *) &ram[addr] = data;
return; return;
} }
// printf("W16: %x @ %x\n", data, addr); printf("W16: %x @ %x\n", data, addr);
} }
void CDSB2::Write32(UINT32 addr, UINT32 data) void CDSB2::Write32(UINT32 addr, UINT32 data)
@ -732,7 +763,7 @@ void CDSB2::Write32(UINT32 addr, UINT32 data)
*(UINT16 *) &ram[addr+2] = data&0xFFFF; *(UINT16 *) &ram[addr+2] = data&0xFFFF;
return; return;
} }
// printf("W32: %x @ %x\n", data, addr); printf("W32: %x @ %x\n", data, addr);
} }
void CDSB2::SendCommand(UINT8 data) void CDSB2::SendCommand(UINT8 data)

View file

@ -188,8 +188,9 @@ private:
UINT32 startLatch; // MPEG start address latch UINT32 startLatch; // MPEG start address latch
UINT32 endLatch; // MPEG end address latch UINT32 endLatch; // MPEG end address latch
UINT8 status; UINT8 status;
UINT8 chain;
UINT8 cmdLatch; UINT8 cmdLatch;
UINT8 volume;
UINT8 stereo;
// Z80 CPU // Z80 CPU
CZ80 Z80; CZ80 Z80;

View file

@ -365,6 +365,7 @@ int Supermodel(const char *zipFile, CModel3 *Model3, CInputs *Inputs, Debugger::
unsigned xResParam, unsigned yResParam, BOOL keepAspectRatio, BOOL fullScreen, BOOL noThrottle, BOOL showFPS, unsigned xResParam, unsigned yResParam, BOOL keepAspectRatio, BOOL fullScreen, BOOL noThrottle, BOOL showFPS,
const char *vsFile, const char *fsFile) const char *vsFile, const char *fsFile)
{ {
CLogger *oldLogger;
#else #else
int Supermodel(const char *zipFile, CInputs *Inputs, unsigned ppcFrequency, BOOL multiThreaded, unsigned xResParam, unsigned yResParam, int Supermodel(const char *zipFile, CInputs *Inputs, unsigned ppcFrequency, BOOL multiThreaded, unsigned xResParam, unsigned yResParam,
BOOL keepAspectRatio, BOOL fullScreen, BOOL noThrottle, BOOL showFPS, const char *vsFile, const char *fsFile) BOOL keepAspectRatio, BOOL fullScreen, BOOL noThrottle, BOOL showFPS, const char *vsFile, const char *fsFile)
@ -422,7 +423,7 @@ int Supermodel(const char *zipFile, CInputs *Inputs, unsigned ppcFrequency, BOOL
#ifdef SUPERMODEL_DEBUGGER #ifdef SUPERMODEL_DEBUGGER
// If debugger was supplied, set it as logger and attach it to system // If debugger was supplied, set it as logger and attach it to system
CLogger *oldLogger = GetLogger(); oldLogger = GetLogger();
if (Debugger != NULL) if (Debugger != NULL)
{ {
SetLogger(Debugger); SetLogger(Debugger);
@ -1028,7 +1029,7 @@ static void PrintGameList(void)
for (i = 0; Model3GameList[i].title != NULL; i++) for (i = 0; Model3GameList[i].title != NULL; i++)
{ {
printf(" %s", Model3GameList[i].id); printf(" %s", Model3GameList[i].id);
for (j = strlen(Model3GameList[i].id); j < 8; j++) // pad for alignment (no game ID is more than 8 letters) for (j = strlen(Model3GameList[i].id); j < 9; j++) // pad for alignment (no game ID is more than 9 letters)
printf(" "); printf(" ");
printf(" %s\n", Model3GameList[i].title); printf(" %s\n", Model3GameList[i].title);
} }