forked from len0rd/rockbox
Enable game sounds in PacBox. Sound is OFF by default but can be enabled from the menu. Enable a function for SWCODEC in the middle of the plugin API, so plugins must be made incompatible (full update).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27202 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
10b8e327d8
commit
cf73340f1e
10 changed files with 473 additions and 24 deletions
|
@ -24,8 +24,10 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "pacbox.h"
|
||||
#include "arcade.h"
|
||||
#include "hardware.h"
|
||||
#include "wsg3.h"
|
||||
#include <string.h>
|
||||
#include "plugin.h"
|
||||
|
||||
|
@ -92,6 +94,43 @@ enum {
|
|||
FlipXY = 0x03
|
||||
};
|
||||
|
||||
// Namco 3-channel Wave Sound Generator wave data (8 waveforms with 32 4-bit entries each)
|
||||
static unsigned char default_sound_prom[] =
|
||||
{
|
||||
0x07, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0D, 0x0E,
|
||||
0x0E, 0x0E, 0x0D, 0x0D, 0x0C, 0x0B, 0x0A, 0x09,
|
||||
0x07, 0x05, 0x04, 0x03, 0x02, 0x01, 0x01, 0x00,
|
||||
0x00, 0x00, 0x01, 0x01, 0x02, 0x03, 0x04, 0x05,
|
||||
0x07, 0x0C, 0x0E, 0x0E, 0x0D, 0x0B, 0x09, 0x0A,
|
||||
0x0B, 0x0B, 0x0A, 0x09, 0x06, 0x04, 0x03, 0x05,
|
||||
0x07, 0x09, 0x0B, 0x0A, 0x08, 0x05, 0x04, 0x03,
|
||||
0x03, 0x04, 0x05, 0x03, 0x01, 0x00, 0x00, 0x02,
|
||||
0x07, 0x0A, 0x0C, 0x0D, 0x0E, 0x0D, 0x0C, 0x0A,
|
||||
0x07, 0x04, 0x02, 0x01, 0x00, 0x01, 0x02, 0x04,
|
||||
0x07, 0x0B, 0x0D, 0x0E, 0x0D, 0x0B, 0x07, 0x03,
|
||||
0x01, 0x00, 0x01, 0x03, 0x07, 0x0E, 0x07, 0x00,
|
||||
0x07, 0x0D, 0x0B, 0x08, 0x0B, 0x0D, 0x09, 0x06,
|
||||
0x0B, 0x0E, 0x0C, 0x07, 0x09, 0x0A, 0x06, 0x02,
|
||||
0x07, 0x0C, 0x08, 0x04, 0x05, 0x07, 0x02, 0x00,
|
||||
0x03, 0x08, 0x05, 0x01, 0x03, 0x06, 0x03, 0x01,
|
||||
0x00, 0x08, 0x0F, 0x07, 0x01, 0x08, 0x0E, 0x07,
|
||||
0x02, 0x08, 0x0D, 0x07, 0x03, 0x08, 0x0C, 0x07,
|
||||
0x04, 0x08, 0x0B, 0x07, 0x05, 0x08, 0x0A, 0x07,
|
||||
0x06, 0x08, 0x09, 0x07, 0x07, 0x08, 0x08, 0x07,
|
||||
0x07, 0x08, 0x06, 0x09, 0x05, 0x0A, 0x04, 0x0B,
|
||||
0x03, 0x0C, 0x02, 0x0D, 0x01, 0x0E, 0x00, 0x0F,
|
||||
0x00, 0x0F, 0x01, 0x0E, 0x02, 0x0D, 0x03, 0x0C,
|
||||
0x04, 0x0B, 0x05, 0x0A, 0x06, 0x09, 0x07, 0x08,
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08,
|
||||
0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
};
|
||||
|
||||
/* Putting this in IRAM actually slows down the iPods, but is good for
|
||||
the Coldfire
|
||||
*/
|
||||
|
@ -110,6 +149,12 @@ void init_PacmanMachine(int dip)
|
|||
z80_reset();
|
||||
rb->memset( &ram_[0x4000], 0xFF, 0x1000 );
|
||||
|
||||
/* Initialize the WSG3 */
|
||||
wsg3_init(SoundClock);
|
||||
|
||||
/* Set the sound PROM to the default values for the original Namco chip */
|
||||
wsg3_set_sound_prom(default_sound_prom);
|
||||
|
||||
/* Initialize parameters */
|
||||
port1_ = 0xFF;
|
||||
port2_ = 0xFF;
|
||||
|
@ -595,6 +640,19 @@ void renderSprites( unsigned char * buffer )
|
|||
}
|
||||
}
|
||||
|
||||
void playSound( int * buf, int len )
|
||||
{
|
||||
/* Clear the buffer */
|
||||
memset( buf, 0, sizeof (int)*len);
|
||||
|
||||
/* Exit now if sound is disabled */
|
||||
if( (output_devices_ & SoundEnabled) == 0 )
|
||||
return;
|
||||
|
||||
/* Let the chip play the sound */
|
||||
wsg3_play_sound( buf, len );
|
||||
}
|
||||
|
||||
/* Enables/disables the speed hack. */
|
||||
int setSpeedHack( int enabled )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue