i dont understand why you change the original code, even if you didnt put a little of your part... anyway this is my version of the code
// © SNK 1999
/* thanks to Elsemi for the NEO-PCM2 info */
static void neo_pcm2_snk_1999(int value)
{
//rotd, mslug4, pnyaa
data16_t *rom = (data16_t *)memory_region(REGION_SOUND1);
int size = memory_region_length(REGION_SOUND1);
int i, j;
if( rom != NULL )
{
// swap address lines on the whole ROMs /
for( i = 0; i < size / 2; i += ( value / 2 ) ){
data16_t buffer[ (value / 2) ];
memcpy( buffer, &rom[ i ], value );
for( j = 0; j < (value / 2); j++ ){
rom[ i + j ] = buffer[ j ^ (value/4) ];
}
}
}
}
// © PLAYMORE 2002 20-09-2004
static void neo_pcm2_playmore_2002(int value)
{
//kof2002,matrimelee,mslug5 (pcb and mvs),samsho5,svcchaos (pcb and mvs),kof2003 (pcb and mvs),samsh5sp (mvs and aes)
//offset,xor address
unsigned int addrs[7][2]={
{0x000000,0xA5000}, //kof2002
{0xFFCE20,0x01000}, //matrimelee
{0xFE2CF6,0x4E001}, //mslug5
{0xFEB2C0,0x0A000}, //samsho5
{0xFFAC28,0xC2000}, //svcchaos
{0x000000,0x00000}, //kof2003
{0xFFB440,0x02000}, //samsh5sp
};
unsigned int xordata[7][8]={
{0xF9,0xE0,0x5D,0xF3,0xEA,0x92,0xBE,0xEF}, //kof2002
{0xC4,0x83,0xA8,0x5F,0x21,0x27,0x64,0xAF}, //matrimelee
{0xC3,0xFD,0x81,0xAC,0x6D,0xE7,0xBF,0x9E}, //mslug5
{0xCB,0x29,0x7D,0x43,0xD2,0x3A,0xC2,0xB4}, //samsho5
{0xC3,0xFD,0x81,0xAC,0x6D,0xE7,0xBF,0x9E}, //svcchaos
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //kof2003
{0x4B,0xA4,0x63,0x46,0xF0,0x91,0xEA,0x62}, //samsh5sp
};
UINT8 *src = memory_region(REGION_SOUND1);
UINT8 *buf = malloc(0x1000000);
int i, j, d;
memcpy(buf,src,0x1000000);
for (i=0;i<0x1000000;i++){
j=BITSWAP24(i,23,22,21,20,19,18,17,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,16);
j=j^addrs[value][1];
d=((i+addrs[value][0])&0xffffff);
src[j]=buf[d]^xordata[value][j&0x7];
}
free(buf);
}
kof2003 was disabled because the dumper doesnt wanna make it public, anyway thats a shame.