mirror of
https://github.com/libretro/FBNeo.git
synced 2024-11-27 11:00:27 +00:00
neo_run, intf/cd - cleanup time
This commit is contained in:
parent
d071fcc09f
commit
2e265c6bdd
@ -1,11 +1,10 @@
|
|||||||
// NeoGeo CD-WIP - Jan 25, 2019 - present
|
// NeoGeo CD-WIP - Jan 25, 2019 - present
|
||||||
|
|
||||||
// mit .bin/.cue & .ccd/.img (trurip) unterstutzung (feb.4.2019)
|
// mit .bin/.cue & .ccd/.img (trurip) unterstutzung (feb.4.2019)
|
||||||
// todo:
|
// known issues:
|
||||||
// burner/win32/neocdsel.cpp needs updated to support mode1/2352
|
// Audio Hz rate must be 44100 for proper CDDA speed
|
||||||
// ssrpg bugs in sfx-audio in cutscene after starting game
|
// ssrpg bugs in sfx-audio in cutscene after starting game
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FB Alpha Neo Geo module
|
* FB Alpha Neo Geo module
|
||||||
*
|
*
|
||||||
@ -73,8 +72,6 @@
|
|||||||
#include "bitswap.h"
|
#include "bitswap.h"
|
||||||
#include "neocdlist.h"
|
#include "neocdlist.h"
|
||||||
|
|
||||||
static INT32 isowav_mode = 0;
|
|
||||||
|
|
||||||
// #undef USE_SPEEDHACKS
|
// #undef USE_SPEEDHACKS
|
||||||
|
|
||||||
// #define LOG_IRQ
|
// #define LOG_IRQ
|
||||||
@ -1742,10 +1739,6 @@ void __fastcall neogeoZ80Out(UINT16 nAddress, UINT8 nValue)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x80:
|
|
||||||
bprintf(PRINT_ERROR, _T(" - Z80 port 0x%04X -> 0x%02X.\n"), nAddress, nValue);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
// bprintf(PRINT_NORMAL, _T(" - Z80 port 0x%04X -> 0x%02X.\n"), nAddress, nValue);
|
// bprintf(PRINT_NORMAL, _T(" - Z80 port 0x%04X -> 0x%02X.\n"), nAddress, nValue);
|
||||||
}
|
}
|
||||||
@ -2511,17 +2504,10 @@ static void LC8951UpdateHeader()
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
// HEAD registers have header
|
// HEAD registers have header
|
||||||
if (isowav_mode) {
|
LC8951RegistersR[4] = NeoCDSectorData[12]; // HEAD0
|
||||||
LC8951RegistersR[4] = ((NeoCDSectorMin / 10) << 4) | (NeoCDSectorMin % 10); // HEAD0
|
LC8951RegistersR[5] = NeoCDSectorData[13]; // HEAD1
|
||||||
LC8951RegistersR[5] = ((NeoCDSectorSec / 10) << 4) | (NeoCDSectorSec % 10); // HEAD1
|
LC8951RegistersR[6] = NeoCDSectorData[14]; // HEAD2
|
||||||
LC8951RegistersR[6] = ((NeoCDSectorFrm / 10) << 4) | (NeoCDSectorFrm % 10); // HEAD2
|
LC8951RegistersR[7] = NeoCDSectorData[15]; // HEAD3
|
||||||
LC8951RegistersR[7] = 1; // HEAD3
|
|
||||||
} else {
|
|
||||||
LC8951RegistersR[4] = NeoCDSectorData[12]; // HEAD0
|
|
||||||
LC8951RegistersR[5] = NeoCDSectorData[13]; // HEAD1
|
|
||||||
LC8951RegistersR[6] = NeoCDSectorData[14]; // HEAD2
|
|
||||||
LC8951RegistersR[7] = NeoCDSectorData[15]; // HEAD3
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2540,11 +2526,7 @@ static char* LC8951InitTransfer()
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isowav_mode) {
|
return NeoCDSectorData + 12 + ((LC8951RegistersW[5] << 8) | LC8951RegistersW[4]);
|
||||||
return NeoCDSectorData + ((LC8951RegistersW[5] << 8) | LC8951RegistersW[4]);
|
|
||||||
} else {
|
|
||||||
return NeoCDSectorData + 12 + ((LC8951RegistersW[5] << 8) | LC8951RegistersW[4]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LC8951EndTransfer()
|
static void LC8951EndTransfer()
|
||||||
@ -2565,6 +2547,7 @@ static void LC8951EndTransfer()
|
|||||||
|
|
||||||
static void LC8951Reset()
|
static void LC8951Reset()
|
||||||
{
|
{
|
||||||
|
nLC8951Register = 0;
|
||||||
memset(LC8951RegistersR, 0, sizeof(LC8951RegistersR));
|
memset(LC8951RegistersR, 0, sizeof(LC8951RegistersR));
|
||||||
memset(LC8951RegistersW, 0, sizeof(LC8951RegistersW));
|
memset(LC8951RegistersW, 0, sizeof(LC8951RegistersW));
|
||||||
|
|
||||||
@ -2577,10 +2560,6 @@ static void LC8951Reset()
|
|||||||
LC8951UpdateHeader();
|
LC8951UpdateHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
// for NeoGeo CD (WAV playback)
|
|
||||||
//void wav_exit();
|
|
||||||
//void wav_pause(bool bResume);
|
|
||||||
|
|
||||||
static void NeoCDProcessCommand()
|
static void NeoCDProcessCommand()
|
||||||
{
|
{
|
||||||
memset(NeoCDCommsStatusFIFO, 0, sizeof(NeoCDCommsStatusFIFO));
|
memset(NeoCDCommsStatusFIFO, 0, sizeof(NeoCDCommsStatusFIFO));
|
||||||
@ -2607,29 +2586,16 @@ static void NeoCDProcessCommand()
|
|||||||
case 0: {
|
case 0: {
|
||||||
UINT8* ChannelData = CDEmuReadQChannel();
|
UINT8* ChannelData = CDEmuReadQChannel();
|
||||||
|
|
||||||
if (isowav_mode) {
|
NeoCDCommsStatusFIFO[2] = ChannelData[1] >> 4;
|
||||||
NeoCDCommsStatusFIFO[2] = ChannelData[1] / 10;
|
NeoCDCommsStatusFIFO[3] = ChannelData[1] & 0x0F;
|
||||||
NeoCDCommsStatusFIFO[3] = ChannelData[1] % 10;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[4] = ChannelData[2] / 10;
|
NeoCDCommsStatusFIFO[4] = ChannelData[2] >> 4;
|
||||||
NeoCDCommsStatusFIFO[5] = ChannelData[2] % 10;
|
NeoCDCommsStatusFIFO[5] = ChannelData[2] & 0x0F;
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[6] = ChannelData[3] / 10;
|
NeoCDCommsStatusFIFO[6] = ChannelData[3] >> 4;
|
||||||
NeoCDCommsStatusFIFO[7] = ChannelData[3] % 10;
|
NeoCDCommsStatusFIFO[7] = ChannelData[3] & 0x0F;
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[8] = ChannelData[7];
|
NeoCDCommsStatusFIFO[8] = ChannelData[7];
|
||||||
} else {
|
|
||||||
NeoCDCommsStatusFIFO[2] = ChannelData[1] >> 4;
|
|
||||||
NeoCDCommsStatusFIFO[3] = ChannelData[1] & 0x0F;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[4] = ChannelData[2] >> 4;
|
|
||||||
NeoCDCommsStatusFIFO[5] = ChannelData[2] & 0x0F;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[6] = ChannelData[3] >> 4;
|
|
||||||
NeoCDCommsStatusFIFO[7] = ChannelData[3] & 0x0F;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[8] = ChannelData[7];
|
|
||||||
}
|
|
||||||
|
|
||||||
// bprintf(PRINT_ERROR, _T(" %02i %02i:%02i:%02i %02i:%02i:%02i %02i\n"), ChannelData[0], ChannelData[1], ChannelData[2], ChannelData[3], ChannelData[4], ChannelData[5], ChannelData[6], ChannelData[7]);
|
// bprintf(PRINT_ERROR, _T(" %02i %02i:%02i:%02i %02i:%02i:%02i %02i\n"), ChannelData[0], ChannelData[1], ChannelData[2], ChannelData[3], ChannelData[4], ChannelData[5], ChannelData[6], ChannelData[7]);
|
||||||
|
|
||||||
@ -2638,91 +2604,51 @@ static void NeoCDProcessCommand()
|
|||||||
case 1: {
|
case 1: {
|
||||||
UINT8* ChannelData = CDEmuReadQChannel();
|
UINT8* ChannelData = CDEmuReadQChannel();
|
||||||
|
|
||||||
if (isowav_mode) {
|
NeoCDCommsStatusFIFO[2] = ChannelData[4] >> 4;
|
||||||
NeoCDCommsStatusFIFO[2] = ChannelData[4] / 10;
|
NeoCDCommsStatusFIFO[3] = ChannelData[4] & 0x0F;
|
||||||
NeoCDCommsStatusFIFO[3] = ChannelData[4] % 10;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[4] = ChannelData[5] / 10;
|
NeoCDCommsStatusFIFO[4] = ChannelData[5] >> 4;
|
||||||
NeoCDCommsStatusFIFO[5] = ChannelData[5] % 10;
|
NeoCDCommsStatusFIFO[5] = ChannelData[5] & 0x0F;
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[6] = ChannelData[6] / 10;
|
NeoCDCommsStatusFIFO[6] = ChannelData[6] >> 4;
|
||||||
NeoCDCommsStatusFIFO[7] = ChannelData[6] % 10;
|
NeoCDCommsStatusFIFO[7] = ChannelData[6] & 0x0F;
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[8] = ChannelData[7];
|
NeoCDCommsStatusFIFO[8] = ChannelData[7];
|
||||||
} else {
|
|
||||||
NeoCDCommsStatusFIFO[2] = ChannelData[4] >> 4;
|
|
||||||
NeoCDCommsStatusFIFO[3] = ChannelData[4] & 0x0F;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[4] = ChannelData[5] >> 4;
|
|
||||||
NeoCDCommsStatusFIFO[5] = ChannelData[5] & 0x0F;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[6] = ChannelData[6] >> 4;
|
|
||||||
NeoCDCommsStatusFIFO[7] = ChannelData[6] & 0x0F;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[8] = ChannelData[7];
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
|
|
||||||
UINT8* ChannelData = CDEmuReadQChannel();
|
UINT8* ChannelData = CDEmuReadQChannel();
|
||||||
|
|
||||||
if (isowav_mode) {
|
NeoCDCommsStatusFIFO[2] = ChannelData[0] >> 4;
|
||||||
NeoCDCommsStatusFIFO[2] = ChannelData[0] / 10;
|
NeoCDCommsStatusFIFO[3] = ChannelData[0] & 0x0F;
|
||||||
NeoCDCommsStatusFIFO[3] = ChannelData[0] % 10;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[8] = ChannelData[7];
|
NeoCDCommsStatusFIFO[8] = ChannelData[7];
|
||||||
} else {
|
|
||||||
NeoCDCommsStatusFIFO[2] = ChannelData[0] >> 4;
|
|
||||||
NeoCDCommsStatusFIFO[3] = ChannelData[0] & 0x0F;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[8] = ChannelData[7];
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
UINT8* TOCEntry = CDEmuReadTOC(-2);
|
UINT8* TOCEntry = CDEmuReadTOC(-2);
|
||||||
|
|
||||||
if (isowav_mode) {
|
NeoCDCommsStatusFIFO[2] = TOCEntry[0] >> 4;
|
||||||
NeoCDCommsStatusFIFO[2] = TOCEntry[0] / 10;
|
NeoCDCommsStatusFIFO[3] = TOCEntry[0] & 0x0F;
|
||||||
NeoCDCommsStatusFIFO[3] = TOCEntry[0] % 10;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[4] = TOCEntry[1] / 10;
|
NeoCDCommsStatusFIFO[4] = TOCEntry[1] >> 4;
|
||||||
NeoCDCommsStatusFIFO[5] = TOCEntry[1] % 10;
|
NeoCDCommsStatusFIFO[5] = TOCEntry[1] & 0x0F;
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[6] = TOCEntry[2] / 10;
|
NeoCDCommsStatusFIFO[6] = TOCEntry[2] >> 4;
|
||||||
NeoCDCommsStatusFIFO[7] = TOCEntry[2] % 10;
|
NeoCDCommsStatusFIFO[7] = TOCEntry[2] & 0x0F;
|
||||||
} else {
|
|
||||||
NeoCDCommsStatusFIFO[2] = TOCEntry[0] >> 4;
|
|
||||||
NeoCDCommsStatusFIFO[3] = TOCEntry[0] & 0x0F;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[4] = TOCEntry[1] >> 4;
|
|
||||||
NeoCDCommsStatusFIFO[5] = TOCEntry[1] & 0x0F;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[6] = TOCEntry[2] >> 4;
|
|
||||||
NeoCDCommsStatusFIFO[7] = TOCEntry[2] & 0x0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
UINT8* TOCEntry = CDEmuReadTOC(-1);
|
UINT8* TOCEntry = CDEmuReadTOC(-1);
|
||||||
|
|
||||||
if (isowav_mode) {
|
NeoCDCommsStatusFIFO[2] = TOCEntry[0] > 4;
|
||||||
NeoCDCommsStatusFIFO[2] = TOCEntry[0] / 10;
|
NeoCDCommsStatusFIFO[3] = TOCEntry[0] & 0x0F;
|
||||||
NeoCDCommsStatusFIFO[3] = TOCEntry[0] % 10;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[4] = TOCEntry[1] / 10;
|
NeoCDCommsStatusFIFO[4] = TOCEntry[1] >> 4;
|
||||||
NeoCDCommsStatusFIFO[5] = TOCEntry[1] % 10;
|
NeoCDCommsStatusFIFO[5] = TOCEntry[1] & 0x0F;
|
||||||
} else {
|
|
||||||
NeoCDCommsStatusFIFO[2] = TOCEntry[0] > 4;
|
|
||||||
NeoCDCommsStatusFIFO[3] = TOCEntry[0] & 0x0F;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[4] = TOCEntry[1] >> 4;
|
|
||||||
NeoCDCommsStatusFIFO[5] = TOCEntry[1] & 0x0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2731,42 +2657,26 @@ static void NeoCDProcessCommand()
|
|||||||
|
|
||||||
UINT8* TOCEntry = CDEmuReadTOC(NeoCDTrack);
|
UINT8* TOCEntry = CDEmuReadTOC(NeoCDTrack);
|
||||||
|
|
||||||
if (isowav_mode) {
|
NeoCDCommsStatusFIFO[2] = TOCEntry[0] >> 4;
|
||||||
NeoCDCommsStatusFIFO[2] = TOCEntry[0] / 10;
|
NeoCDCommsStatusFIFO[3] = TOCEntry[0] & 0x0F;
|
||||||
NeoCDCommsStatusFIFO[3] = TOCEntry[0] % 10;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[4] = TOCEntry[1] / 10;
|
NeoCDCommsStatusFIFO[4] = TOCEntry[1] >> 4;
|
||||||
NeoCDCommsStatusFIFO[5] = TOCEntry[1] % 10;
|
NeoCDCommsStatusFIFO[5] = TOCEntry[1] & 0x0F;
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[6] = TOCEntry[2] / 10;
|
NeoCDCommsStatusFIFO[6] = TOCEntry[2] >> 4;
|
||||||
NeoCDCommsStatusFIFO[7] = TOCEntry[2] % 10;
|
NeoCDCommsStatusFIFO[7] = TOCEntry[2] & 0x0F;
|
||||||
} else {
|
|
||||||
NeoCDCommsStatusFIFO[2] = TOCEntry[0] >> 4;
|
|
||||||
NeoCDCommsStatusFIFO[3] = TOCEntry[0] & 0x0F;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[4] = TOCEntry[1] >> 4;
|
|
||||||
NeoCDCommsStatusFIFO[5] = TOCEntry[1] & 0x0F;
|
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[6] = TOCEntry[2] >> 4;
|
|
||||||
NeoCDCommsStatusFIFO[7] = TOCEntry[2] & 0x0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
// bit 3 of the 1st minutes digit indicates a data track
|
// bit 3 of the 1st minutes digit indicates a data track
|
||||||
if (TOCEntry[3] & 4) {
|
if (TOCEntry[3] & 4) {
|
||||||
NeoCDCommsStatusFIFO[6] |= 8;
|
NeoCDCommsStatusFIFO[6] |= 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isowav_mode) {
|
NeoCDCommsStatusFIFO[8] = NeoCDTrack & 0x0F;
|
||||||
NeoCDCommsStatusFIFO[8] = NeoCDTrack % 10;
|
|
||||||
} else {
|
|
||||||
NeoCDCommsStatusFIFO[8] = NeoCDTrack & 0x0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 6: {
|
case 6: {
|
||||||
|
|
||||||
UINT8* ChannelData = CDEmuReadQChannel();
|
UINT8* ChannelData = CDEmuReadQChannel();
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[8] = ChannelData[7];
|
NeoCDCommsStatusFIFO[8] = ChannelData[7];
|
||||||
@ -2775,10 +2685,9 @@ static void NeoCDProcessCommand()
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 7: {
|
case 7: {
|
||||||
|
|
||||||
// must be 02, 0E, 0F, or 05
|
// must be 02, 0E, 0F, or 05
|
||||||
NeoCDCommsStatusFIFO[2] = 0;
|
NeoCDCommsStatusFIFO[2] = 0;
|
||||||
NeoCDCommsStatusFIFO[3] = (isowav_mode) ? 5 : NeoCDAssyStatus;
|
NeoCDCommsStatusFIFO[3] = NeoCDAssyStatus;
|
||||||
|
|
||||||
NeoCDCommsStatusFIFO[4] = 0;
|
NeoCDCommsStatusFIFO[4] = 0;
|
||||||
NeoCDCommsStatusFIFO[5] = 0;
|
NeoCDCommsStatusFIFO[5] = 0;
|
||||||
@ -2805,9 +2714,6 @@ static void NeoCDProcessCommand()
|
|||||||
NeoCDSectorLBA += NeoCDCommsCommandFIFO[6] * (10 );
|
NeoCDSectorLBA += NeoCDCommsCommandFIFO[6] * (10 );
|
||||||
NeoCDSectorLBA += NeoCDCommsCommandFIFO[7] * ( 1 );
|
NeoCDSectorLBA += NeoCDCommsCommandFIFO[7] * ( 1 );
|
||||||
|
|
||||||
if (isowav_mode)
|
|
||||||
NeoCDSectorLBA -= CD_FRAMES_PREGAP;
|
|
||||||
|
|
||||||
CDEmuStartRead();
|
CDEmuStartRead();
|
||||||
// LC8951RegistersR[1] |= 0x20;
|
// LC8951RegistersR[1] |= 0x20;
|
||||||
} else {
|
} else {
|
||||||
@ -2816,11 +2722,7 @@ static void NeoCDProcessCommand()
|
|||||||
bprintf(PRINT_ERROR, _T("*** Switching CD mode to audio while in CD-ROM mode!(PC: 0x%06X)\n"), SekGetPC(-1));
|
bprintf(PRINT_ERROR, _T("*** Switching CD mode to audio while in CD-ROM mode!(PC: 0x%06X)\n"), SekGetPC(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isowav_mode) {
|
CDEmuPlay((NeoCDCommsCommandFIFO[2] * 16) + NeoCDCommsCommandFIFO[3], (NeoCDCommsCommandFIFO[4] * 16) + NeoCDCommsCommandFIFO[5], (NeoCDCommsCommandFIFO[6] * 16) + NeoCDCommsCommandFIFO[7]);
|
||||||
CDEmuPlay((NeoCDCommsCommandFIFO[2] * 10) + NeoCDCommsCommandFIFO[3], (NeoCDCommsCommandFIFO[4] * 10) + NeoCDCommsCommandFIFO[5], (NeoCDCommsCommandFIFO[6] * 10) + NeoCDCommsCommandFIFO[7]);
|
|
||||||
} else {
|
|
||||||
CDEmuPlay((NeoCDCommsCommandFIFO[2] * 16) + NeoCDCommsCommandFIFO[3], (NeoCDCommsCommandFIFO[4] * 16) + NeoCDCommsCommandFIFO[5], (NeoCDCommsCommandFIFO[6] * 16) + NeoCDCommsCommandFIFO[7]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NeoCDAssyStatus = 1;
|
NeoCDAssyStatus = 1;
|
||||||
@ -2843,14 +2745,12 @@ static void NeoCDProcessCommand()
|
|||||||
NeoCDAssyStatus = 4;
|
NeoCDAssyStatus = 4;
|
||||||
bNeoCDLoadSector = false;
|
bNeoCDLoadSector = false;
|
||||||
CDEmuPause();
|
CDEmuPause();
|
||||||
//if (isowav_mode) wav_pause(0);
|
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
// bprintf(PRINT_ERROR, _T(" CD comms received command %i\n"), NeoCDCommsCommandFIFO[0]);
|
// bprintf(PRINT_ERROR, _T(" CD comms received command %i\n"), NeoCDCommsCommandFIFO[0]);
|
||||||
NeoCDAssyStatus = 1;
|
NeoCDAssyStatus = 1;
|
||||||
bNeoCDLoadSector = true;
|
bNeoCDLoadSector = true;
|
||||||
CDEmuResume();
|
CDEmuResume();
|
||||||
//if (isowav_mode) wav_pause(1);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
@ -2868,6 +2768,7 @@ static void NeoCDProcessCommand()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For Double Dragon (Early release) - see notes a few pages below..
|
||||||
static INT32 CheckDMASourceForBlankVectorTable(INT32 dmadest, INT32 dmasrc)
|
static INT32 CheckDMASourceForBlankVectorTable(INT32 dmadest, INT32 dmasrc)
|
||||||
{
|
{
|
||||||
if (dmadest == 0) {
|
if (dmadest == 0) {
|
||||||
@ -3121,10 +3022,6 @@ static void NeoCDDoDMA()
|
|||||||
default: {
|
default: {
|
||||||
bprintf(PRINT_ERROR, _T(" Unknown transfer type 0x%04X (PC: 0x%06X)\n"), NeoCDDMAMode, SekGetPC(-1));
|
bprintf(PRINT_ERROR, _T(" Unknown transfer type 0x%04X (PC: 0x%06X)\n"), NeoCDDMAMode, SekGetPC(-1));
|
||||||
bprintf(PRINT_NORMAL, _T(" ??? : 0x%08X 0x%08X 0x%04X 0x%04X 0x%08X\n"), NeoCDDMAAddress1, NeoCDDMAAddress2, NeoCDDMAValue1, NeoCDDMAValue2, NeoCDDMACount);
|
bprintf(PRINT_NORMAL, _T(" ??? : 0x%08X 0x%08X 0x%04X 0x%04X 0x%08X\n"), NeoCDDMAAddress1, NeoCDDMAAddress2, NeoCDDMAValue1, NeoCDDMAValue2, NeoCDDMACount);
|
||||||
|
|
||||||
extern INT32 bRunPause;
|
|
||||||
bRunPause = 1;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3165,13 +3062,6 @@ static void NeoCDCommsControl(UINT8 clock, UINT8 send)
|
|||||||
|
|
||||||
NeoCDCommsStatusFIFO[0] = NeoCDAssyStatus;
|
NeoCDCommsStatusFIFO[0] = NeoCDAssyStatus;
|
||||||
|
|
||||||
#if 0
|
|
||||||
extern INT32 counter;
|
|
||||||
if (counter) {
|
|
||||||
NeoCDCommsStatusFIFO[0] = counter & 0x0F;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// compute checksum
|
// compute checksum
|
||||||
|
|
||||||
sum = 0;
|
sum = 0;
|
||||||
@ -3210,19 +3100,12 @@ static void NeoCDCommsControl(UINT8 clock, UINT8 send)
|
|||||||
bNeoCDCommsClock = clock;
|
bNeoCDCommsClock = clock;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NeoCDReadSector()
|
static void NeoCDReadSector()
|
||||||
{
|
{
|
||||||
if ((nff0002 & 0x0500)) {
|
if ((nff0002 & 0x0500)) {
|
||||||
if (NeoCDAssyStatus == 1 && bNeoCDLoadSector) {
|
if (NeoCDAssyStatus == 1 && bNeoCDLoadSector) {
|
||||||
|
NeoCDSectorLBA++;
|
||||||
// if (LC8951RegistersW[10] & 0x80) {
|
NeoCDSectorLBA = CDEmuLoadSector(NeoCDSectorLBA, NeoCDSectorData) - 1;
|
||||||
NeoCDSectorLBA++;
|
|
||||||
if (isowav_mode) {
|
|
||||||
NeoCDSectorLBA = CDEmuLoadSector(NeoCDSectorLBA, NeoCDSectorData + 4) - 1;
|
|
||||||
} else {
|
|
||||||
NeoCDSectorLBA = CDEmuLoadSector(NeoCDSectorLBA, NeoCDSectorData) - 1;
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (LC8951RegistersW[10] & 0x80) {
|
if (LC8951RegistersW[10] & 0x80) {
|
||||||
LC8951UpdateHeader();
|
LC8951UpdateHeader();
|
||||||
@ -3234,13 +3117,11 @@ void NeoCDReadSector()
|
|||||||
|
|
||||||
//bprintf(PRINT_IMPORTANT, _T(" Sector %08i (%02i:%02i:%02i) read\n"), NeoCDSectorLBA, NeoCDSectorMin, NeoCDSectorSec, NeoCDSectorFrm);
|
//bprintf(PRINT_IMPORTANT, _T(" Sector %08i (%02i:%02i:%02i) read\n"), NeoCDSectorLBA, NeoCDSectorMin, NeoCDSectorSec, NeoCDSectorFrm);
|
||||||
|
|
||||||
INT32 sectoffs = (isowav_mode) ? 0 : 12;
|
if (NeoCDSectorData[(12 + 4) + 64] == 'g' && !strncmp(NeoCDSectorData + 12 + 4, "Copyright by SNK", 16)) {
|
||||||
|
|
||||||
if (NeoCDSectorData[sectoffs + 4 + 64] == 'g' && !strncmp(NeoCDSectorData + sectoffs + 4, "Copyright by SNK", 16)) {
|
|
||||||
//bprintf(0, _T("\n simulated CDZ protection error\n"));
|
//bprintf(0, _T("\n simulated CDZ protection error\n"));
|
||||||
//bprintf(PRINT_ERROR, _T(" %.70hs\n"), NeoCDSectorData + sectoffs + 4);
|
//bprintf(PRINT_ERROR, _T(" %.70hs\n"), NeoCDSectorData + sectoffs + 4);
|
||||||
|
|
||||||
NeoCDSectorData[sectoffs + 4 + 64] = 'f';
|
NeoCDSectorData[(12 + 4) + 64] = 'f';
|
||||||
|
|
||||||
// LC8951RegistersR[12] = 0x00; // STAT0
|
// LC8951RegistersR[12] = 0x00; // STAT0
|
||||||
}
|
}
|
||||||
@ -3255,11 +3136,10 @@ void NeoCDReadSector()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bNeoCDLoadSector = true;
|
bNeoCDLoadSector = true;
|
||||||
// bNeoCDLoadSector = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 __fastcall neogeoReadByteCDROM(UINT32 sekAddress)
|
static UINT8 __fastcall neogeoReadByteCDROM(UINT32 sekAddress)
|
||||||
{
|
{
|
||||||
// bprintf(PRINT_NORMAL, _T(" - CDROM: 0x%06X read (byte, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1));
|
// bprintf(PRINT_NORMAL, _T(" - CDROM: 0x%06X read (byte, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1));
|
||||||
|
|
||||||
@ -3304,28 +3184,25 @@ UINT8 __fastcall neogeoReadByteCDROM(UINT32 sekAddress)
|
|||||||
return ~0;
|
return ~0;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT16 __fastcall neogeoReadWordCDROM(UINT32 sekAddress)
|
static UINT16 __fastcall neogeoReadWordCDROM(UINT32 sekAddress)
|
||||||
{
|
{
|
||||||
// bprintf(PRINT_NORMAL, _T(" - CDROM: 0x%06X read (word, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1));
|
// bprintf(PRINT_NORMAL, _T(" - CDROM: 0x%06X read (word, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1));
|
||||||
|
|
||||||
#if 1
|
|
||||||
switch (sekAddress & 0xFFFF) {
|
switch (sekAddress & 0xFFFF) {
|
||||||
case 0x011C:
|
case 0x011C:
|
||||||
return ~((0x10 | (NeoSystem & 3)) << 8);
|
return ~((0x10 | (NeoSystem & 3)) << 8);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X read (word, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1));
|
// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X read (word, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1));
|
||||||
|
|
||||||
return ~0;
|
return ~0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __fastcall neogeoWriteByteCDROM(UINT32 sekAddress, UINT8 byteValue)
|
static void __fastcall neogeoWriteByteCDROM(UINT32 sekAddress, UINT8 byteValue)
|
||||||
{
|
{
|
||||||
// bprintf(PRINT_NORMAL, _T(" - Neo Geo CD: 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1));
|
// bprintf(PRINT_NORMAL, _T(" - Neo Geo CD: 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1));
|
||||||
|
|
||||||
switch (sekAddress & 0xFFFF) {
|
switch (sekAddress & 0xFFFF) {
|
||||||
//case 0x000E:
|
|
||||||
case 0x000F:
|
case 0x000F:
|
||||||
NeoCDIRQUpdate(byteValue);
|
NeoCDIRQUpdate(byteValue);
|
||||||
break;
|
break;
|
||||||
@ -3436,9 +3313,6 @@ void __fastcall neogeoWriteByteCDROM(UINT32 sekAddress, UINT8 byteValue)
|
|||||||
// bprintf(PRINT_ERROR, _T(" - NGCD port 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1));
|
// bprintf(PRINT_ERROR, _T(" - NGCD port 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1));
|
||||||
|
|
||||||
MapVectorTable(!(byteValue == 0xFF));
|
MapVectorTable(!(byteValue == 0xFF));
|
||||||
|
|
||||||
//extern INT32 bRunPause;
|
|
||||||
//bRunPause = 1;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x016F:
|
case 0x016F:
|
||||||
@ -3474,7 +3348,7 @@ void __fastcall neogeoWriteByteCDROM(UINT32 sekAddress, UINT8 byteValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __fastcall neogeoWriteWordCDROM(UINT32 sekAddress, UINT16 wordValue)
|
static void __fastcall neogeoWriteWordCDROM(UINT32 sekAddress, UINT16 wordValue)
|
||||||
{
|
{
|
||||||
// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1));
|
// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1));
|
||||||
|
|
||||||
@ -3487,12 +3361,6 @@ void __fastcall neogeoWriteWordCDROM(UINT32 sekAddress, UINT16 wordValue)
|
|||||||
nff0002 = wordValue;
|
nff0002 = wordValue;
|
||||||
|
|
||||||
// LC8951RegistersR[1] |= 0x20;
|
// LC8951RegistersR[1] |= 0x20;
|
||||||
|
|
||||||
/* if (nff0002 & 0x0500)
|
|
||||||
nNeoCDCyclesIRQPeriod = (INT32)(12000000.0 * nBurnCPUSpeedAdjust / (256.0 * 75.0));
|
|
||||||
else
|
|
||||||
nNeoCDCyclesIRQPeriod = (INT32)(12000000.0 * nBurnCPUSpeedAdjust / (256.0 * 75.0));
|
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x000E:
|
case 0x000E:
|
||||||
@ -3564,7 +3432,7 @@ void __fastcall neogeoWriteWordCDROM(UINT32 sekAddress, UINT16 wordValue)
|
|||||||
|
|
||||||
// Reads from / writes to the transfer area
|
// Reads from / writes to the transfer area
|
||||||
|
|
||||||
UINT8 __fastcall neogeoReadByteTransfer(UINT32 sekAddress)
|
static UINT8 __fastcall neogeoReadByteTransfer(UINT32 sekAddress)
|
||||||
{
|
{
|
||||||
// if ((sekAddress & 0x0FFFFF) < 16)
|
// if ((sekAddress & 0x0FFFFF) < 16)
|
||||||
// printf(PRINT_NORMAL, _T(" - NGCD port 0x%06X read (byte, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1));
|
// printf(PRINT_NORMAL, _T(" - NGCD port 0x%06X read (byte, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1));
|
||||||
@ -3590,7 +3458,7 @@ UINT8 __fastcall neogeoReadByteTransfer(UINT32 sekAddress)
|
|||||||
return ~0;
|
return ~0;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT16 __fastcall neogeoReadWordTransfer(UINT32 sekAddress)
|
static UINT16 __fastcall neogeoReadWordTransfer(UINT32 sekAddress)
|
||||||
{
|
{
|
||||||
// if ((sekAddress & 0x0FFFFF) < 16)
|
// if ((sekAddress & 0x0FFFFF) < 16)
|
||||||
// bprintf(PRINT_NORMAL, _T(" - Transfer: 0x%06X read (word, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1));
|
// bprintf(PRINT_NORMAL, _T(" - Transfer: 0x%06X read (word, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1));
|
||||||
@ -3614,7 +3482,7 @@ UINT16 __fastcall neogeoReadWordTransfer(UINT32 sekAddress)
|
|||||||
return ~0;
|
return ~0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __fastcall neogeoWriteByteTransfer(UINT32 sekAddress, UINT8 byteValue)
|
static void __fastcall neogeoWriteByteTransfer(UINT32 sekAddress, UINT8 byteValue)
|
||||||
{
|
{
|
||||||
// if ((sekAddress & 0x0FFFFF) < 16)
|
// if ((sekAddress & 0x0FFFFF) < 16)
|
||||||
// bprintf(PRINT_NORMAL, _T(" - Transfer: 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1));
|
// bprintf(PRINT_NORMAL, _T(" - Transfer: 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1));
|
||||||
@ -3644,7 +3512,7 @@ void __fastcall neogeoWriteByteTransfer(UINT32 sekAddress, UINT8 byteValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __fastcall neogeoWriteWordTransfer(UINT32 sekAddress, UINT16 wordValue)
|
static void __fastcall neogeoWriteWordTransfer(UINT32 sekAddress, UINT16 wordValue)
|
||||||
{
|
{
|
||||||
// if ((sekAddress & 0x0FFFFF) < 16)
|
// if ((sekAddress & 0x0FFFFF) < 16)
|
||||||
// bprintf(PRINT_NORMAL, _T(" - Transfer: 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1));
|
// bprintf(PRINT_NORMAL, _T(" - Transfer: 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1));
|
||||||
@ -3678,7 +3546,7 @@ void __fastcall neogeoWriteWordTransfer(UINT32 sekAddress, UINT16 wordValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT16 __fastcall neogeoCDReadWord68KProgram(UINT32 sekAddress)
|
static UINT16 __fastcall neogeoCDReadWord68KProgram(UINT32 sekAddress)
|
||||||
{
|
{
|
||||||
if (sekAddress < 0x80 && NeoCDVectorSwitch == 0) {
|
if (sekAddress < 0x80 && NeoCDVectorSwitch == 0) {
|
||||||
return *((UINT16*)(NeoVectorActive + sekAddress));
|
return *((UINT16*)(NeoVectorActive + sekAddress));
|
||||||
@ -3687,7 +3555,7 @@ UINT16 __fastcall neogeoCDReadWord68KProgram(UINT32 sekAddress)
|
|||||||
return *((UINT16*)(Neo68KROMActive + sekAddress));
|
return *((UINT16*)(Neo68KROMActive + sekAddress));
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 __fastcall neogeoCDReadByte68KProgram(UINT32 sekAddress)
|
static UINT8 __fastcall neogeoCDReadByte68KProgram(UINT32 sekAddress)
|
||||||
{
|
{
|
||||||
if (sekAddress < 0x80 && NeoCDVectorSwitch == 0) {
|
if (sekAddress < 0x80 && NeoCDVectorSwitch == 0) {
|
||||||
return NeoVectorActive[sekAddress ^ 1];
|
return NeoVectorActive[sekAddress ^ 1];
|
||||||
@ -3764,9 +3632,6 @@ static INT32 neogeoReset()
|
|||||||
#if 1 && defined FBA_DEBUG
|
#if 1 && defined FBA_DEBUG
|
||||||
if (nNeoSystemType & NEO_SYS_CD) {
|
if (nNeoSystemType & NEO_SYS_CD) {
|
||||||
bprintf(PRINT_IMPORTANT, _T(" - Emulating Neo CD system.\n"));
|
bprintf(PRINT_IMPORTANT, _T(" - Emulating Neo CD system.\n"));
|
||||||
|
|
||||||
// exit WAV object if needed
|
|
||||||
//if (isowav_mode) wav_exit();
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -4535,9 +4400,6 @@ static void NeoStandardInputs(INT32 nBank)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define NeoSekRun SekRun
|
|
||||||
#else
|
|
||||||
static INT32 NeoSekRun(const INT32 nCycles)
|
static INT32 NeoSekRun(const INT32 nCycles)
|
||||||
{
|
{
|
||||||
INT32 nCyclesExecutedTotal = 0, nOldCyclesSegment = nCyclesSegment;
|
INT32 nCyclesExecutedTotal = 0, nOldCyclesSegment = nCyclesSegment;
|
||||||
@ -4572,7 +4434,6 @@ static INT32 NeoSekRun(const INT32 nCycles)
|
|||||||
|
|
||||||
return nCyclesExecutedTotal;
|
return nCyclesExecutedTotal;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
INT32 NeoFrame()
|
INT32 NeoFrame()
|
||||||
{
|
{
|
||||||
@ -4787,20 +4648,6 @@ INT32 NeoFrame()
|
|||||||
nuPD4990ATicks = nCyclesExtra[0];
|
nuPD4990ATicks = nCyclesExtra[0];
|
||||||
|
|
||||||
// Run 68000
|
// Run 68000
|
||||||
|
|
||||||
|
|
||||||
if (isowav_mode) {
|
|
||||||
if ((nNeoSystemType & NEO_SYS_CD) && (nff0002 & 0x0050)) {
|
|
||||||
nIRQAcknowledge &= ~0x10;
|
|
||||||
NeoCDIRQUpdate(0);
|
|
||||||
|
|
||||||
if (nff0002 & 0x0500) {
|
|
||||||
NeoCDReadSector();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nCyclesSegment = nSekCyclesScanline * 24;
|
nCyclesSegment = nSekCyclesScanline * 24;
|
||||||
while (SekTotalCycles() < nCyclesSegment) {
|
while (SekTotalCycles() < nCyclesSegment) {
|
||||||
|
|
||||||
@ -5066,7 +4913,7 @@ INT32 NeoFrame()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pBurnSoundOut) {
|
if (pBurnSoundOut) {
|
||||||
if (!(LC8951RegistersW[10] & 4))
|
if ((nNeoSystemType & NEO_SYS_CD) && !(LC8951RegistersW[10] & 4))
|
||||||
CDEmuGetSoundBuffer(pBurnSoundOut, nBurnSoundLen);
|
CDEmuGetSoundBuffer(pBurnSoundOut, nBurnSoundLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ static InterfaceInfo CDEmuInfo = { NULL, NULL, NULL };
|
|||||||
#elif defined BUILD_SDL
|
#elif defined BUILD_SDL
|
||||||
// CD emulation module
|
// CD emulation module
|
||||||
#elif defined (_XBOX)
|
#elif defined (_XBOX)
|
||||||
extern struct CDEmuDo isowavDo;
|
extern struct CDEmuDo cdimgDo;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct CDEmuDo* pCDEmuDo[] =
|
static struct CDEmuDo* pCDEmuDo[] =
|
||||||
@ -23,7 +23,7 @@ static struct CDEmuDo* pCDEmuDo[] =
|
|||||||
#elif defined BUILD_SDL
|
#elif defined BUILD_SDL
|
||||||
// CD emulation module
|
// CD emulation module
|
||||||
#elif defined (_XBOX)
|
#elif defined (_XBOX)
|
||||||
&isowavDo,
|
&cdimgDo,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,595 +0,0 @@
|
|||||||
// ----------------------------------------------------------------------------
|
|
||||||
// iso/cue/wav support
|
|
||||||
/*-----------------------------------------------------------------------------
|
|
||||||
Modified by: CaptainCPS-X
|
|
||||||
Updates:
|
|
||||||
(10/24/2011)
|
|
||||||
- removed libmad and MP3 support
|
|
||||||
- added my custom DirectSound library to add WAV support
|
|
||||||
- removed most (if not all) references to MP3
|
|
||||||
- modified a few other things as needed
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
#include "burner.h"
|
|
||||||
#include "cdsound.h"
|
|
||||||
|
|
||||||
#define MAXIMUM_NUMBER_TRACKS (100)
|
|
||||||
|
|
||||||
#define CD_FRAMES_MINUTE (60 * 75)
|
|
||||||
#define CD_FRAMES_SECOND ( 75)
|
|
||||||
#define CD_FRAMES_PREGAP ( 2 * 75)
|
|
||||||
|
|
||||||
struct isowavTRACK_DATA {
|
|
||||||
char Control;
|
|
||||||
char TrackNumber;
|
|
||||||
char Address[4];
|
|
||||||
TCHAR* Filename;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct isowavCDROM_TOC {
|
|
||||||
char FirstTrack;
|
|
||||||
char LastTrack;
|
|
||||||
isowavTRACK_DATA TrackData[MAXIMUM_NUMBER_TRACKS];
|
|
||||||
};
|
|
||||||
|
|
||||||
static isowavCDROM_TOC* isowavTOC;
|
|
||||||
|
|
||||||
static FILE* isowavFile = NULL;
|
|
||||||
static int isowavTrack = 0;
|
|
||||||
static int isowavLBA = 0;
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
static const char* isowavLBAToMSF(const int LBA)
|
|
||||||
{
|
|
||||||
static char address[4];
|
|
||||||
|
|
||||||
address[0] = 0;
|
|
||||||
address[1] = LBA / CD_FRAMES_MINUTE;
|
|
||||||
address[2] = LBA % CD_FRAMES_MINUTE / CD_FRAMES_SECOND;
|
|
||||||
address[3] = LBA % CD_FRAMES_SECOND;
|
|
||||||
|
|
||||||
return address;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int isowavMSFToLBA(const char* address)
|
|
||||||
{
|
|
||||||
int LBA;
|
|
||||||
|
|
||||||
LBA = address[3];
|
|
||||||
LBA += address[2] * CD_FRAMES_SECOND;
|
|
||||||
LBA += address[1] * CD_FRAMES_MINUTE;
|
|
||||||
|
|
||||||
return LBA;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
static int isowavGetTrackSizes()
|
|
||||||
{
|
|
||||||
// determine the lenght of the .iso / .mp3 files to complete the TOC
|
|
||||||
|
|
||||||
FILE* h;
|
|
||||||
|
|
||||||
for (int i = isowavTOC->FirstTrack - 1; i < isowavTOC->LastTrack; i++) {
|
|
||||||
|
|
||||||
const char* address;
|
|
||||||
|
|
||||||
if (isowavTOC->TrackData[i].Control & 4) {
|
|
||||||
|
|
||||||
// data track
|
|
||||||
|
|
||||||
h = _tfopen(isowavTOC->TrackData[i].Filename, _T("rb"));
|
|
||||||
if (h == NULL) return 1;
|
|
||||||
|
|
||||||
fseek(h, 0, SEEK_END);
|
|
||||||
|
|
||||||
address = isowavLBAToMSF((ftell(h) + 2047) / 2048 + isowavMSFToLBA(isowavTOC->TrackData[i].Address));
|
|
||||||
|
|
||||||
if(h) fclose(h);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// audio track
|
|
||||||
|
|
||||||
h = _tfopen(isowavTOC->TrackData[i].Filename, _T("rb"));
|
|
||||||
if (h == NULL)return 1;
|
|
||||||
|
|
||||||
fseek(h, 0, SEEK_END);
|
|
||||||
|
|
||||||
address = isowavLBAToMSF(((ftell(h) + 2047) / 2048) + isowavMSFToLBA(isowavTOC->TrackData[i].Address));
|
|
||||||
if(h) fclose(h);
|
|
||||||
}
|
|
||||||
|
|
||||||
isowavTOC->TrackData[i + 1].Address[0] += 0; // always 0 [?]
|
|
||||||
isowavTOC->TrackData[i + 1].Address[1] += address[1]; // M
|
|
||||||
isowavTOC->TrackData[i + 1].Address[2] += address[2]; // S
|
|
||||||
isowavTOC->TrackData[i + 1].Address[3] += address[3]; // F
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int isowavTestISO()
|
|
||||||
{
|
|
||||||
TCHAR fullname[MAX_PATH];
|
|
||||||
TCHAR* filename;
|
|
||||||
int length = 0;
|
|
||||||
int offset = 0;
|
|
||||||
int track = 2;
|
|
||||||
FILE* h;
|
|
||||||
|
|
||||||
_tcscpy(fullname, CDEmuImage);
|
|
||||||
length = _tcslen(fullname);
|
|
||||||
|
|
||||||
// assume CD-ROM mode1/2048 format
|
|
||||||
|
|
||||||
if (length <= 4 && (_tcscmp(_T(".iso"), fullname + length - 4) || _tcscmp(_T(".bin"), fullname + length - 4))) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a TOC with only the data track first
|
|
||||||
|
|
||||||
isowavTOC->FirstTrack = 1;
|
|
||||||
isowavTOC->LastTrack = 1;
|
|
||||||
|
|
||||||
isowavTOC->TrackData[0].TrackNumber = 1;
|
|
||||||
|
|
||||||
isowavTOC->TrackData[0].Address[1] = 0;
|
|
||||||
isowavTOC->TrackData[0].Address[2] = 2;
|
|
||||||
isowavTOC->TrackData[0].Address[3] = 0;
|
|
||||||
|
|
||||||
isowavTOC->TrackData[0].Filename = (TCHAR*)malloc((length + 1) * sizeof(TCHAR));
|
|
||||||
if (isowavTOC->TrackData[0].Filename == NULL) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
_tcscpy(isowavTOC->TrackData[0].Filename, fullname);
|
|
||||||
|
|
||||||
isowavTOC->TrackData[0].Control = 4;
|
|
||||||
|
|
||||||
// if the filename has a number in it, try to find .mp3 tracks
|
|
||||||
|
|
||||||
filename = ExtractFilename(fullname);
|
|
||||||
offset = (filename - fullname) + length - 6;
|
|
||||||
while (offset >= 0 && fullname[offset] != _T('0') && fullname[offset + 1] != _T('1')) {
|
|
||||||
offset--;
|
|
||||||
}
|
|
||||||
if (offset < 0) {
|
|
||||||
return isowavGetTrackSizes();
|
|
||||||
}
|
|
||||||
|
|
||||||
_stprintf(fullname + length - 4, _T(".wav"));
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
fullname[offset] = _T('0') + track / 10; fullname[offset + 1] = _T('0') + track % 10;
|
|
||||||
|
|
||||||
if ((h = _tfopen(fullname, _T("rb"))) == NULL) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
fclose(h);
|
|
||||||
|
|
||||||
isowavTOC->TrackData[track - 1].TrackNumber = track;
|
|
||||||
|
|
||||||
isowavTOC->TrackData[track - 1].Filename = (TCHAR*)malloc((length + 1) * sizeof(TCHAR));
|
|
||||||
if (isowavTOC->TrackData[track - 1].Filename == NULL) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
_tcscpy(isowavTOC->TrackData[track - 1].Filename, fullname);
|
|
||||||
|
|
||||||
isowavTOC->LastTrack = track;
|
|
||||||
|
|
||||||
track++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return isowavGetTrackSizes();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int isowavParseCueFile()
|
|
||||||
{
|
|
||||||
TCHAR szLine[1024];
|
|
||||||
TCHAR szFile[1024];
|
|
||||||
TCHAR* s;
|
|
||||||
TCHAR* t;
|
|
||||||
FILE* h;
|
|
||||||
int track = 0;
|
|
||||||
int length;
|
|
||||||
|
|
||||||
isowavTOC->FirstTrack = 1;
|
|
||||||
isowavTOC->LastTrack = 1;
|
|
||||||
|
|
||||||
isowavTOC->TrackData[0].Address[1] = 0;
|
|
||||||
isowavTOC->TrackData[0].Address[2] = 2;
|
|
||||||
isowavTOC->TrackData[0].Address[3] = 0;
|
|
||||||
|
|
||||||
h = _tfopen(CDEmuImage, _T("rt"));
|
|
||||||
if (h == NULL) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
if (_fgetts(szLine, sizeof(szLine), h) == NULL) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
length = _tcslen(szLine);
|
|
||||||
// get rid of the linefeed at the end
|
|
||||||
while (length && (szLine[length - 1] == _T('\r') || szLine[length - 1] == _T('\n'))) {
|
|
||||||
szLine[length - 1] = 0;
|
|
||||||
length--;
|
|
||||||
}
|
|
||||||
|
|
||||||
s = szLine;
|
|
||||||
|
|
||||||
// file info
|
|
||||||
if ((t = LabelCheck(s, _T("FILE"))) != 0) {
|
|
||||||
s = t;
|
|
||||||
|
|
||||||
TCHAR* szQuote;
|
|
||||||
|
|
||||||
// read filename
|
|
||||||
QuoteRead(&szQuote, NULL, s);
|
|
||||||
|
|
||||||
_sntprintf(szFile, ExtractFilename(CDEmuImage) - CDEmuImage, _T("%s"), CDEmuImage);
|
|
||||||
_sntprintf(szFile + (ExtractFilename(CDEmuImage) - CDEmuImage), 1024 - (ExtractFilename(CDEmuImage) - CDEmuImage), _T("/%s"), szQuote);
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// track info
|
|
||||||
if ((t = LabelCheck(s, _T("TRACK"))) != 0) {
|
|
||||||
s = t;
|
|
||||||
|
|
||||||
// track number
|
|
||||||
track = _tcstol(s, &t, 10);
|
|
||||||
|
|
||||||
if (track < 1 || track > MAXIMUM_NUMBER_TRACKS) {
|
|
||||||
fclose(h);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (track < isowavTOC->FirstTrack) {
|
|
||||||
isowavTOC->FirstTrack = track;
|
|
||||||
}
|
|
||||||
if (track > isowavTOC->LastTrack) {
|
|
||||||
isowavTOC->LastTrack = track;
|
|
||||||
}
|
|
||||||
isowavTOC->TrackData[track - 1].TrackNumber = track;
|
|
||||||
|
|
||||||
isowavTOC->TrackData[track - 1].Filename = (TCHAR*)malloc((_tcslen(szFile) + 1) * sizeof(TCHAR));
|
|
||||||
if (isowavTOC->TrackData[track - 1].Filename == NULL) {
|
|
||||||
fclose(h);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
_tcscpy(isowavTOC->TrackData[track - 1].Filename, szFile);
|
|
||||||
|
|
||||||
s = t;
|
|
||||||
|
|
||||||
// type of track
|
|
||||||
|
|
||||||
if ((t = LabelCheck(s, _T("MODE1/2048"))) != 0) {
|
|
||||||
isowavTOC->TrackData[track - 1].Control = 4;
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ((t = LabelCheck(s, _T("AUDIO"))) != 0) {
|
|
||||||
isowavTOC->TrackData[track - 1].Control = 0;
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(h);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// pregap
|
|
||||||
if ((t = LabelCheck(s, _T("PREGAP"))) != 0) {
|
|
||||||
s = t;
|
|
||||||
|
|
||||||
int M, S, F;
|
|
||||||
|
|
||||||
// pregap M
|
|
||||||
M = _tcstol(s, &t, 10);
|
|
||||||
s = t + 1;
|
|
||||||
// pregap S
|
|
||||||
S = _tcstol(s, &t, 10);
|
|
||||||
s = t + 1;
|
|
||||||
// pregap F
|
|
||||||
F = _tcstol(s, &t, 10);
|
|
||||||
|
|
||||||
if (M < 0 || M > 100 || S < 0 || S > 59 || F < 0 || F > 74) {
|
|
||||||
fclose(h);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
isowavTOC->TrackData[track - 1].Address[1] = M;
|
|
||||||
isowavTOC->TrackData[track - 1].Address[2] = S;
|
|
||||||
isowavTOC->TrackData[track - 1].Address[3] = F;
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(h);
|
|
||||||
|
|
||||||
return isowavGetTrackSizes();
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
static int isowavExit()
|
|
||||||
{
|
|
||||||
wav_exit();
|
|
||||||
|
|
||||||
if (isowavFile) {
|
|
||||||
fclose(isowavFile);
|
|
||||||
isowavFile = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
isowavTrack = 0;
|
|
||||||
isowavLBA = 0;
|
|
||||||
|
|
||||||
if (isowavTOC) {
|
|
||||||
for (int i = 0; i < MAXIMUM_NUMBER_TRACKS; i++) {
|
|
||||||
free(isowavTOC->TrackData[i].Filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(isowavTOC);
|
|
||||||
isowavTOC = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int isowavInit()
|
|
||||||
{
|
|
||||||
wav_exit();
|
|
||||||
|
|
||||||
isowavTOC = (isowavCDROM_TOC*)malloc(sizeof(isowavCDROM_TOC));
|
|
||||||
if (isowavTOC == NULL) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
memset(isowavTOC, 0, sizeof(isowavCDROM_TOC));
|
|
||||||
|
|
||||||
TCHAR* filename = ExtractFilename(CDEmuImage);
|
|
||||||
|
|
||||||
if (_tcslen(filename) < 4) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_tcscmp(_T(".cue"), filename + _tcslen(filename) - 4) == 0) {
|
|
||||||
if (isowavParseCueFile()) {
|
|
||||||
dprintf(_T("*** Couldn't parse .cue file\n"));
|
|
||||||
isowavExit();
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (isowavTestISO()) {
|
|
||||||
dprintf(_T("*** Couldn't find .iso / .bin file\n"));
|
|
||||||
isowavExit();
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dprintf(_T(" CD image TOC read\n"));
|
|
||||||
|
|
||||||
for (int i = isowavTOC->FirstTrack - 1; i < isowavTOC->LastTrack; i++) {
|
|
||||||
dprintf(_T(" track %2i start %02i:%02i:%02i control 0x%02X %s\n"), isowavTOC->TrackData[i].TrackNumber, isowavTOC->TrackData[i].Address[1], isowavTOC->TrackData[i].Address[2], isowavTOC->TrackData[i].Address[3], isowavTOC->TrackData[i].Control, isowavTOC->TrackData[i].Filename);
|
|
||||||
}
|
|
||||||
dprintf(_T(" total running time %02i:%02i:%02i\n"), isowavTOC->TrackData[(int)isowavTOC->LastTrack].Address[1], isowavTOC->TrackData[(int)isowavTOC->LastTrack].Address[2], isowavTOC->TrackData[(int)isowavTOC->LastTrack].Address[3]);
|
|
||||||
|
|
||||||
CDEmuStatus = idle;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
TCHAR* GetIsoPath()
|
|
||||||
{
|
|
||||||
if(isowavTOC) {
|
|
||||||
return isowavTOC->TrackData[0].Filename;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int isowavStop()
|
|
||||||
{
|
|
||||||
wav_stop();
|
|
||||||
|
|
||||||
if (isowavFile) {
|
|
||||||
fclose(isowavFile);
|
|
||||||
isowavFile = NULL;
|
|
||||||
}
|
|
||||||
CDEmuStatus = idle;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int isowavPlayLBA(int LBA)
|
|
||||||
{
|
|
||||||
isowavLBA = LBA;
|
|
||||||
|
|
||||||
for (isowavTrack = isowavTOC->FirstTrack - 1; isowavTrack < isowavTOC->LastTrack; isowavTrack++) {
|
|
||||||
if (isowavLBA < isowavMSFToLBA(isowavTOC->TrackData[isowavTrack + 1].Address)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isowavTrack >= isowavTOC->LastTrack) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bprintf(PRINT_IMPORTANT, _T(" playing track %2i - %s\n"), isowavTrack + 1, isowavTOC->TrackData[isowavTrack].Filename);
|
|
||||||
|
|
||||||
isowavFile = _tfopen(isowavTOC->TrackData[isowavTrack].Filename, _T("rb"));
|
|
||||||
if (isowavFile == NULL) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( _tcsstr(isowavTOC->TrackData[isowavTrack].Filename, _T(".wav")) || _tcsstr(isowavTOC->TrackData[isowavTrack].Filename, _T(".WAV"))) {
|
|
||||||
// is a wav, no need to keep this file pointer
|
|
||||||
if (isowavFile) {
|
|
||||||
fclose(isowavFile);
|
|
||||||
isowavFile = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(wav_open(isowavTOC->TrackData[isowavTrack].Filename)) {
|
|
||||||
wav_play();
|
|
||||||
} else {
|
|
||||||
// error creating the WAV stream
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//dprintf(_T("*** WAV: wBitsPerSample: %d \n"), wav->g_pStreamingSound->m_pWaveFile->m_pwfx->wBitsPerSample);
|
|
||||||
//dprintf(_T("*** WAV: nAvgBytesPerSec: %d \n"), wav->g_pStreamingSound->m_pWaveFile->m_pwfx->nAvgBytesPerSec);
|
|
||||||
//dprintf(_T("*** WAV: m_dwSize: %d \n"), wav->g_pStreamingSound->m_pWaveFile->m_dwSize);
|
|
||||||
//dprintf(_T("*** WAV: nBlockAlign: %d \n"), wav->g_pStreamingSound->m_pWaveFile->m_pwfx->nBlockAlign);
|
|
||||||
|
|
||||||
isowavLBA = isowavMSFToLBA(isowavTOC->TrackData[isowavTrack].Address);
|
|
||||||
CDEmuStatus = playing;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int isowavPlay(unsigned char M, unsigned char S, unsigned char F)
|
|
||||||
{
|
|
||||||
const char address[] = { 0, M, S, F };
|
|
||||||
|
|
||||||
return isowavPlayLBA(isowavMSFToLBA(address));
|
|
||||||
}
|
|
||||||
|
|
||||||
static int isowavLoadSector(int LBA, char* pBuffer)
|
|
||||||
{
|
|
||||||
LBA += CD_FRAMES_PREGAP;
|
|
||||||
|
|
||||||
if (LBA != isowavLBA) {
|
|
||||||
|
|
||||||
int track;
|
|
||||||
|
|
||||||
for (track = isowavTOC->FirstTrack - 1; track < isowavTOC->LastTrack; track++) {
|
|
||||||
if (LBA < isowavMSFToLBA(isowavTOC->TrackData[track + 1].Address)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isowavFile == NULL || track != isowavTrack) {
|
|
||||||
isowavStop();
|
|
||||||
|
|
||||||
isowavTrack = track;
|
|
||||||
|
|
||||||
bprintf(PRINT_IMPORTANT, _T(" reading track %2i - %s\n"), isowavTrack + 1, isowavTOC->TrackData[isowavTrack].Filename);
|
|
||||||
|
|
||||||
isowavFile = _tfopen(isowavTOC->TrackData[isowavTrack].Filename, _T("rb"));
|
|
||||||
if (isowavFile == NULL) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fseek(isowavFile, (LBA - isowavMSFToLBA(isowavTOC->TrackData[isowavTrack].Address)) * 2048, SEEK_SET)) {
|
|
||||||
dprintf(_T("*** couldn't seek\n"));
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
isowavLBA = (ftell(isowavFile) + 2047) / 2048;
|
|
||||||
|
|
||||||
CDEmuStatus = reading;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fread(pBuffer, 1, 2048, isowavFile) <= 0) {
|
|
||||||
dprintf(_T("*** couldn't read from file\n"));
|
|
||||||
|
|
||||||
isowavStop();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
isowavLBA = isowavMSFToLBA(isowavTOC->TrackData[isowavTrack].Address) + (ftell(isowavFile) + 2047) / 2048;
|
|
||||||
|
|
||||||
return isowavLBA - CD_FRAMES_PREGAP;
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned char* isowavReadTOC(int track)
|
|
||||||
{
|
|
||||||
static unsigned char TOCEntry[4];
|
|
||||||
|
|
||||||
if (track == -1) {
|
|
||||||
TOCEntry[0] = isowavTOC->FirstTrack - 1;
|
|
||||||
TOCEntry[1] = isowavTOC->LastTrack;
|
|
||||||
TOCEntry[2] = 0;
|
|
||||||
TOCEntry[3] = 0;
|
|
||||||
|
|
||||||
return TOCEntry;
|
|
||||||
}
|
|
||||||
if (track == -2) {
|
|
||||||
TOCEntry[0] = isowavTOC->TrackData[(int)isowavTOC->LastTrack].Address[1];
|
|
||||||
TOCEntry[1] = isowavTOC->TrackData[(int)isowavTOC->LastTrack].Address[2];
|
|
||||||
TOCEntry[2] = isowavTOC->TrackData[(int)isowavTOC->LastTrack].Address[3];
|
|
||||||
|
|
||||||
TOCEntry[3] = 0;
|
|
||||||
|
|
||||||
return TOCEntry;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (track >= isowavTOC->FirstTrack - 1 && track <= isowavTOC->LastTrack) {
|
|
||||||
TOCEntry[0] = isowavTOC->TrackData[track - 1].Address[1];
|
|
||||||
TOCEntry[1] = isowavTOC->TrackData[track - 1].Address[2];
|
|
||||||
TOCEntry[2] = isowavTOC->TrackData[track - 1].Address[3];
|
|
||||||
TOCEntry[3] = isowavTOC->TrackData[track - 1].Control;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TOCEntry;
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned char* isowavReadQChannel()
|
|
||||||
{
|
|
||||||
static unsigned char QChannelData[8];
|
|
||||||
|
|
||||||
switch (CDEmuStatus) {
|
|
||||||
case reading:
|
|
||||||
case playing: {
|
|
||||||
const char* AddressAbs = isowavLBAToMSF(isowavLBA);
|
|
||||||
const char* AddressRel = isowavLBAToMSF(isowavLBA - isowavMSFToLBA(isowavTOC->TrackData[isowavTrack].Address));
|
|
||||||
|
|
||||||
QChannelData[0] = isowavTOC->TrackData[isowavTrack].TrackNumber;
|
|
||||||
|
|
||||||
QChannelData[1] = AddressAbs[1];
|
|
||||||
QChannelData[2] = AddressAbs[2];
|
|
||||||
QChannelData[3] = AddressAbs[3];
|
|
||||||
|
|
||||||
QChannelData[4] = AddressRel[1];
|
|
||||||
QChannelData[5] = AddressRel[2];
|
|
||||||
QChannelData[6] = AddressRel[3];
|
|
||||||
|
|
||||||
QChannelData[7] = isowavTOC->TrackData[isowavTrack].Control;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case paused: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
memset(QChannelData, 0, sizeof(QChannelData));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return QChannelData;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int isowavGetSoundBuffer(short* /*buffer*/, int /*samples*/)
|
|
||||||
{
|
|
||||||
// ---------------------------------------------------------------------
|
|
||||||
// TODO:
|
|
||||||
// Port the old 'isomp3GetSoundBuffer()' function from 'cd_isomp3.cpp'
|
|
||||||
// to use WAVE stream data, porting that function will fix the
|
|
||||||
// 00:00 progress status on the main NeoGeo CD BIOS menu.
|
|
||||||
// ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int isowavGetSettings(InterfaceInfo* /*pInfo*/)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct CDEmuDo isowavDo = { isowavExit, isowavInit, isowavStop, isowavPlay, isowavLoadSector, isowavReadTOC, isowavReadQChannel, isowavGetSoundBuffer, isowavGetSettings, _T("cue/iso/wav CD emulation") };
|
|
@ -1,433 +0,0 @@
|
|||||||
#include "burner.h"
|
|
||||||
#include "cdsound.h"
|
|
||||||
|
|
||||||
WavClass::WavClass()
|
|
||||||
{
|
|
||||||
m_DirectSound = 0;
|
|
||||||
m_primaryBuffer = 0;
|
|
||||||
m_secondaryBuffer1 = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
WavClass::WavClass(const WavClass&)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
WavClass::~WavClass()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WavClass::Initialize(HWND hwnd, TCHAR* szFile)
|
|
||||||
{
|
|
||||||
bool result;
|
|
||||||
|
|
||||||
// Initialize direct sound and the primary sound buffer.
|
|
||||||
result = InitializeDirectSound(hwnd);
|
|
||||||
if(!result)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load a wave audio file onto a secondary buffer.
|
|
||||||
result = LoadWaveFile(szFile, &m_secondaryBuffer1);
|
|
||||||
if(!result)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WavClass::Shutdown()
|
|
||||||
{
|
|
||||||
// Release the secondary buffer.
|
|
||||||
ShutdownWaveFile(&m_secondaryBuffer1);
|
|
||||||
|
|
||||||
// Shutdown the Direct Sound API.
|
|
||||||
ShutdownDirectSound();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WavClass::InitializeDirectSound(HWND hwnd)
|
|
||||||
{
|
|
||||||
HRESULT result;
|
|
||||||
DSBUFFERDESC bufferDesc;
|
|
||||||
WAVEFORMATEX waveFormat;
|
|
||||||
|
|
||||||
// Initialize the direct sound interface pointer for the default sound device.
|
|
||||||
result = _DirectSoundCreate(NULL, &m_DirectSound, NULL);
|
|
||||||
if(FAILED(result))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the cooperative level to priority so the format of the primary sound buffer can be modified.
|
|
||||||
result = m_DirectSound->SetCooperativeLevel(hwnd, DSSCL_PRIORITY);
|
|
||||||
if(FAILED(result))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GUID guidNULL;
|
|
||||||
memset(&guidNULL,0,sizeof(GUID));
|
|
||||||
|
|
||||||
// Setup the primary buffer description.
|
|
||||||
bufferDesc.dwSize = sizeof(DSBUFFERDESC);
|
|
||||||
bufferDesc.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRLVOLUME;
|
|
||||||
bufferDesc.dwBufferBytes = 0;
|
|
||||||
bufferDesc.dwReserved = 0;
|
|
||||||
bufferDesc.lpwfxFormat = NULL;
|
|
||||||
bufferDesc.guid3DAlgorithm = guidNULL; //GUID_NULL;
|
|
||||||
|
|
||||||
// Get control of the primary sound buffer on the default sound device.
|
|
||||||
result = m_DirectSound->CreateSoundBuffer(&bufferDesc, &m_primaryBuffer, NULL);
|
|
||||||
if(FAILED(result))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup the format of the primary sound bufffer.
|
|
||||||
// In this case it is a .WAV file recorded at 44,100 samples per second in 16-bit stereo (cd audio format).
|
|
||||||
waveFormat.wFormatTag = WAVE_FORMAT_PCM;
|
|
||||||
waveFormat.nSamplesPerSec = 44100;
|
|
||||||
waveFormat.wBitsPerSample = 16;
|
|
||||||
waveFormat.nChannels = 2;
|
|
||||||
waveFormat.nBlockAlign = (waveFormat.wBitsPerSample / 8) * waveFormat.nChannels;
|
|
||||||
waveFormat.nAvgBytesPerSec = waveFormat.nSamplesPerSec * waveFormat.nBlockAlign;
|
|
||||||
waveFormat.cbSize = 0;
|
|
||||||
|
|
||||||
// Set the primary buffer to be the wave format specified.
|
|
||||||
result = m_primaryBuffer->SetFormat(&waveFormat);
|
|
||||||
if(FAILED(result))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WavClass::ShutdownDirectSound()
|
|
||||||
{
|
|
||||||
// Release the primary sound buffer pointer.
|
|
||||||
if(m_primaryBuffer)
|
|
||||||
{
|
|
||||||
m_primaryBuffer->Release();
|
|
||||||
m_primaryBuffer = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Release the direct sound interface pointer.
|
|
||||||
if(m_DirectSound)
|
|
||||||
{
|
|
||||||
m_DirectSound->Release();
|
|
||||||
m_DirectSound = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WavClass::LoadWaveFile(TCHAR* filename, IDirectSoundBuffer** secondaryBuffer)
|
|
||||||
{
|
|
||||||
FILE* filePtr;
|
|
||||||
unsigned int count;
|
|
||||||
WaveHeaderType waveFileHeader;
|
|
||||||
WAVEFORMATEX waveFormat;
|
|
||||||
DSBUFFERDESC bufferDesc;
|
|
||||||
HRESULT result;
|
|
||||||
IDirectSoundBuffer* tempBuffer;
|
|
||||||
unsigned char* waveData;
|
|
||||||
unsigned char* bufferPtr;
|
|
||||||
unsigned long bufferSize;
|
|
||||||
|
|
||||||
|
|
||||||
// Open the wave file in binary.
|
|
||||||
filePtr = _tfopen(filename, _T("rb"));
|
|
||||||
if(!filePtr)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read in the wave file header.
|
|
||||||
count = fread(&waveFileHeader, sizeof(waveFileHeader), 1, filePtr);
|
|
||||||
if(count != 1)
|
|
||||||
{
|
|
||||||
fclose(filePtr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that the chunk ID is the RIFF format.
|
|
||||||
if((waveFileHeader.chunkId[0] != 'R') || (waveFileHeader.chunkId[1] != 'I') ||
|
|
||||||
(waveFileHeader.chunkId[2] != 'F') || (waveFileHeader.chunkId[3] != 'F'))
|
|
||||||
{
|
|
||||||
fclose(filePtr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that the file format is the WAVE format.
|
|
||||||
if((waveFileHeader.format[0] != 'W') || (waveFileHeader.format[1] != 'A') ||
|
|
||||||
(waveFileHeader.format[2] != 'V') || (waveFileHeader.format[3] != 'E'))
|
|
||||||
{
|
|
||||||
fclose(filePtr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that the sub chunk ID is the fmt format.
|
|
||||||
if((waveFileHeader.subChunkId[0] != 'f') || (waveFileHeader.subChunkId[1] != 'm') ||
|
|
||||||
(waveFileHeader.subChunkId[2] != 't') || (waveFileHeader.subChunkId[3] != ' '))
|
|
||||||
{
|
|
||||||
fclose(filePtr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that the audio format is WAVE_FORMAT_PCM.
|
|
||||||
if(waveFileHeader.audioFormat != WAVE_FORMAT_PCM)
|
|
||||||
{
|
|
||||||
fclose(filePtr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that the wave file was recorded in stereo format.
|
|
||||||
if(waveFileHeader.numChannels != 2)
|
|
||||||
{
|
|
||||||
fclose(filePtr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that the wave file was recorded at a sample rate of 44.1 KHz.
|
|
||||||
if(waveFileHeader.sampleRate != 44100)
|
|
||||||
{
|
|
||||||
fclose(filePtr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure that the wave file was recorded in 16 bit format.
|
|
||||||
if(waveFileHeader.bitsPerSample != 16)
|
|
||||||
{
|
|
||||||
fclose(filePtr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for the data chunk header.
|
|
||||||
if((waveFileHeader.dataChunkId[0] != 'd') || (waveFileHeader.dataChunkId[1] != 'a') ||
|
|
||||||
(waveFileHeader.dataChunkId[2] != 't') || (waveFileHeader.dataChunkId[3] != 'a'))
|
|
||||||
{
|
|
||||||
fclose(filePtr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the wave format of secondary buffer that this wave file will be loaded onto.
|
|
||||||
waveFormat.wFormatTag = WAVE_FORMAT_PCM;
|
|
||||||
waveFormat.nSamplesPerSec = 44100;
|
|
||||||
waveFormat.wBitsPerSample = 16;
|
|
||||||
waveFormat.nChannels = 2;
|
|
||||||
waveFormat.nBlockAlign = (waveFormat.wBitsPerSample / 8) * waveFormat.nChannels;
|
|
||||||
waveFormat.nAvgBytesPerSec = waveFormat.nSamplesPerSec * waveFormat.nBlockAlign;
|
|
||||||
waveFormat.cbSize = 0;
|
|
||||||
|
|
||||||
GUID guidNULL;
|
|
||||||
memset(&guidNULL,0,sizeof(GUID));
|
|
||||||
|
|
||||||
// Set the buffer description of the secondary sound buffer that the wave file will be loaded onto.
|
|
||||||
bufferDesc.dwSize = sizeof(DSBUFFERDESC);
|
|
||||||
bufferDesc.dwFlags = DSBCAPS_GLOBALFOCUS | DSBCAPS_CTRLPOSITIONNOTIFY | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLPAN | DSBCAPS_CTRLFREQUENCY;
|
|
||||||
bufferDesc.dwBufferBytes = waveFileHeader.dataSize;
|
|
||||||
bufferDesc.dwReserved = 0;
|
|
||||||
bufferDesc.lpwfxFormat = &waveFormat;
|
|
||||||
bufferDesc.guid3DAlgorithm = guidNULL; //GUID_NULL;
|
|
||||||
|
|
||||||
// Create a temporary sound buffer with the specific buffer settings.
|
|
||||||
result = m_DirectSound->CreateSoundBuffer(&bufferDesc, &tempBuffer, NULL);
|
|
||||||
if(FAILED(result))
|
|
||||||
{
|
|
||||||
fclose(filePtr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test the buffer format against the direct sound 8 interface and create the secondary buffer.
|
|
||||||
result = tempBuffer->QueryInterface(IID_IDirectSoundBuffer, (void**)&*secondaryBuffer);
|
|
||||||
if(FAILED(result))
|
|
||||||
{
|
|
||||||
fclose(filePtr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Release the temporary buffer.
|
|
||||||
tempBuffer->Release();
|
|
||||||
tempBuffer = 0;
|
|
||||||
|
|
||||||
// Move to the beginning of the wave data which starts at the end of the data chunk header.
|
|
||||||
fseek(filePtr, sizeof(WaveHeaderType), SEEK_SET);
|
|
||||||
|
|
||||||
// Create a temporary buffer to hold the wave file data.
|
|
||||||
waveData = new unsigned char[waveFileHeader.dataSize];
|
|
||||||
if(!waveData)
|
|
||||||
{
|
|
||||||
fclose(filePtr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read in the wave file data into the newly created buffer.
|
|
||||||
count = fread(waveData, 1, waveFileHeader.dataSize, filePtr);
|
|
||||||
if(count != waveFileHeader.dataSize)
|
|
||||||
{
|
|
||||||
delete [] waveData;
|
|
||||||
waveData = 0;
|
|
||||||
|
|
||||||
fclose(filePtr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close the file once done reading.
|
|
||||||
int error = fclose(filePtr);
|
|
||||||
if(error != 0)
|
|
||||||
{
|
|
||||||
delete [] waveData;
|
|
||||||
waveData = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lock the secondary buffer to write wave data into it.
|
|
||||||
result = (*secondaryBuffer)->Lock(0, waveFileHeader.dataSize, (void**)&bufferPtr, (DWORD*)&bufferSize, NULL, 0, 0);
|
|
||||||
if(FAILED(result))
|
|
||||||
{
|
|
||||||
delete [] waveData;
|
|
||||||
waveData = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy the wave data into the buffer.
|
|
||||||
memcpy(bufferPtr, waveData, waveFileHeader.dataSize);
|
|
||||||
|
|
||||||
// Unlock the secondary buffer after the data has been written to it.
|
|
||||||
result = (*secondaryBuffer)->Unlock((void*)bufferPtr, bufferSize, NULL, 0);
|
|
||||||
if(FAILED(result))
|
|
||||||
{
|
|
||||||
delete [] waveData;
|
|
||||||
waveData = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Release the wave data since it was copied into the secondary buffer.
|
|
||||||
delete [] waveData;
|
|
||||||
waveData = 0;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WavClass::ShutdownWaveFile(IDirectSoundBuffer** secondaryBuffer)
|
|
||||||
{
|
|
||||||
// Release the secondary sound buffer.
|
|
||||||
if(*secondaryBuffer)
|
|
||||||
{
|
|
||||||
(*secondaryBuffer)->Release();
|
|
||||||
*secondaryBuffer = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "cd_interface.h"
|
|
||||||
|
|
||||||
WavClass* wav;
|
|
||||||
extern HWND hScrnWnd;
|
|
||||||
|
|
||||||
void wav_exit()
|
|
||||||
{
|
|
||||||
if(wav) {
|
|
||||||
wav_stop();
|
|
||||||
wav->Shutdown();
|
|
||||||
wav = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int wav_open(TCHAR* szFile)
|
|
||||||
{
|
|
||||||
wav_exit();
|
|
||||||
|
|
||||||
if(hScrnWnd) {
|
|
||||||
wav = new WavClass;
|
|
||||||
wav->Initialize(hScrnWnd, szFile);
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wav_stop()
|
|
||||||
{
|
|
||||||
if(!wav) return;
|
|
||||||
|
|
||||||
wav->GetSecondaryBuffer()->Stop();
|
|
||||||
wav->GetSecondaryBuffer()->SetCurrentPosition( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wav_play()
|
|
||||||
{
|
|
||||||
if(!wav) return;
|
|
||||||
|
|
||||||
HRESULT result;
|
|
||||||
|
|
||||||
// Play the contents of the secondary sound buffer.
|
|
||||||
IDirectSoundBuffer* m_secondaryBuffer1 = wav->GetSecondaryBuffer();
|
|
||||||
if(!m_secondaryBuffer1) {
|
|
||||||
//
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set volume of the buffer to 100%.
|
|
||||||
result = m_secondaryBuffer1->SetVolume(DSBVOLUME_MAX);
|
|
||||||
if(FAILED(result))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = m_secondaryBuffer1->Play(0, 0, DSBPLAY_LOOPING);
|
|
||||||
if(FAILED(result)) {
|
|
||||||
//
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wav_pause(bool bResume)
|
|
||||||
{
|
|
||||||
if(!wav) return;
|
|
||||||
|
|
||||||
if(!bResume)
|
|
||||||
{
|
|
||||||
DWORD pdwStatus;
|
|
||||||
wav->GetSecondaryBuffer()->GetStatus(&pdwStatus);
|
|
||||||
if((pdwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING)
|
|
||||||
{
|
|
||||||
HRESULT result;
|
|
||||||
result = wav->GetSecondaryBuffer()->Stop();
|
|
||||||
if(FAILED(result)) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
DWORD pdwStatus;
|
|
||||||
wav->GetSecondaryBuffer()->GetStatus(&pdwStatus);
|
|
||||||
if((pdwStatus & DSBSTATUS_PLAYING) != DSBSTATUS_PLAYING)
|
|
||||||
{
|
|
||||||
if(CDEmuGetStatus() == playing)
|
|
||||||
{
|
|
||||||
HRESULT result;
|
|
||||||
|
|
||||||
// Set volume of the buffer to 100%.
|
|
||||||
result = wav->GetSecondaryBuffer()->SetVolume(DSBVOLUME_MAX);
|
|
||||||
if(FAILED(result))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = wav->GetSecondaryBuffer()->Play(0, 0, DSBPLAY_LOOPING);
|
|
||||||
if(FAILED(result)) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
#ifndef _WavClass_H_
|
|
||||||
#define _WavClass_H_
|
|
||||||
|
|
||||||
//#include <dsound.h>
|
|
||||||
#include "dsound_core.h"
|
|
||||||
|
|
||||||
class WavClass
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
struct WaveHeaderType
|
|
||||||
{
|
|
||||||
char chunkId[4];
|
|
||||||
unsigned long chunkSize;
|
|
||||||
char format[4];
|
|
||||||
char subChunkId[4];
|
|
||||||
unsigned long subChunkSize;
|
|
||||||
unsigned short audioFormat;
|
|
||||||
unsigned short numChannels;
|
|
||||||
unsigned long sampleRate;
|
|
||||||
unsigned long bytesPerSecond;
|
|
||||||
unsigned short blockAlign;
|
|
||||||
unsigned short bitsPerSample;
|
|
||||||
char dataChunkId[4];
|
|
||||||
unsigned long dataSize;
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
|
||||||
WavClass();
|
|
||||||
WavClass(const WavClass&);
|
|
||||||
~WavClass();
|
|
||||||
|
|
||||||
bool Initialize(HWND, TCHAR*);
|
|
||||||
void Shutdown();
|
|
||||||
|
|
||||||
bool InitializeDirectSound(HWND);
|
|
||||||
void ShutdownDirectSound();
|
|
||||||
|
|
||||||
bool LoadWaveFile(TCHAR*, IDirectSoundBuffer**);
|
|
||||||
void ShutdownWaveFile(IDirectSoundBuffer**);
|
|
||||||
|
|
||||||
bool PlayWaveFile();
|
|
||||||
|
|
||||||
IDirectSound* GetDirectSound() { return m_DirectSound; }
|
|
||||||
IDirectSoundBuffer* GetPrimaryBuffer() { return m_primaryBuffer; }
|
|
||||||
IDirectSoundBuffer* GetSecondaryBuffer() { return m_secondaryBuffer1; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
IDirectSound* m_DirectSound;
|
|
||||||
IDirectSoundBuffer* m_primaryBuffer;
|
|
||||||
IDirectSoundBuffer* m_secondaryBuffer1;
|
|
||||||
};
|
|
||||||
|
|
||||||
void wav_exit();
|
|
||||||
int wav_open(TCHAR* szFile);
|
|
||||||
void wav_stop();
|
|
||||||
void wav_play();
|
|
||||||
void wav_pause(bool bResume);
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user