Final Burn Neo > FBN Development

Neo-PCM2 PLAYMORE 2002 code for FBA

(1/5) > >>

FerchogtX:
Hi guys, if yiou noticed that mame code, this will not be surprising XD, i hope this works...
neogeo.h
look for this:

--- Code: ---// neo_run.cpp

--- End code ---
add this after:

--- Code: ---extern int nNeoPCM2PLAYMOREByteswap;

--- End code ---
neo_run.cpp
look for this:

--- Code: ---int nNeoSRAMProtection = -1;

--- End code ---
add this after (or after pcm2 code by IQ_132)

--- Code: ---int nNeoPCM2PLAYMOREByteswap = 0; // PCM2 PLAYMORE chip

--- End code ---
Look for this:

--- Code: --- if (BurnDrvGetHardwareCode() & HARDWARE_SNK_SWAPV) {
for (int i = 0; i < 0x00200000; i++) {
unsigned char n = YM2610ADPCMAROM[i];
YM2610ADPCMAROM[i] = YM2610ADPCMAROM[0x00200000 + i];
YM2610ADPCMAROM[0x00200000 + i] = n;
}
}
}

--- End code ---
add this after (or after the IQ_132 PCM2 SNK 1999 code)

--- Code: --- /* Neo-PCM2 PLAYMORE(c) 2002 Sound Chip Emulation */
/* Original code by the vconv (from 2ch), converted to FBA code by FerchogtX */
if (nNeoPCM2PLAYMOREByteswap != 0) {
const unsigned char *PCM2_xor;
const unsigned char kof2002_xor[0x08] = {0xf9,0xe0,0x5d,0xf3,0xea,0x92,0xbe,0xef};
const unsigned char matrim_xor[0x08] = {0xc4,0x83,0xa8,0x5f,0x21,0x27,0x64,0xaf};
const unsigned char ms5_svc_xor[0x08] = {0xc3,0xfd,0x81,0xac,0x6d,0xe7,0xbf,0x9e};
const unsigned char ss5_xor[0x08] = {0xcb,0x29,0x7d,0x43,0xd2,0x3a,0xc2,0xb4};
const unsigned char ss5sp_xor[0x08] = {0x4b,0xa4,0x63,0x46,0xf0,0x91,0xea,0x62};

int v_size = nYM2610ADPCMASize;
unsigned char *rom = YM2610ADPCMAROM;
unsigned char *buf = (unsigned char*)malloc( v_size );
int ofst;

memcpy( buf, rom, v_size );

for( int i = 0; i < v_size; i++ ){
ofst = (i & 0xfefffe) |
  ((i & 0x010000) >> 16) |
  ((i & 0x000001) << 16);

// for kof2002
if (nNeoPCM2PLAYMOREByteswap == 1) {
PCM2_xor = kof2002_xor;
ofst ^= 0xa5000;
rom[ ofst ] = buf[ (i & 0xffffff) ] ^ PCM2_xor[ (ofst & 0x07) ];
}
// for matrim
if (nNeoPCM2PLAYMOREByteswap == 2) {
PCM2_xor = matrim_xor;
ofst ^= 0x01000;
rom[ ofst ] = buf[ ((i + 0xffce20) & 0xffffff) ] ^ PCM2_xor[ (ofst & 0x07) ];
}
// for mslug5
if (nNeoPCM2PLAYMOREByteswap == 3) {
PCM2_xor = ms5_svc_xor;
ofst ^= 0x4e001;
rom[ ofst ] = buf[ ((i + 0xfe2cf6) & 0xffffff) ] ^ PCM2_xor[ (ofst & 0x07) ];
}
// for svcchaos
if (nNeoPCM2PLAYMOREByteswap == 4) {
PCM2_xor = ms5_svc_xor;
ofst ^= 0x4e001;
rom[ ofst ] = buf[ ((i + 0xffac28) & 0xffffff) ] ^ PCM2_xor[ (ofst & 0x07) ];
}
// for samsho5
if (nNeoPCM2PLAYMOREByteswap == 5) {
PCM2_xor = ss5_xor;
ofst ^= 0x0a000;
rom[ ofst ] = buf[ ((i + 0xfeb2c0) & 0xffffff) ] ^ PCM2_xor[ (ofst & 0x07) ];
}
// for samsh5sp
if (nNeoPCM2PLAYMOREByteswap == 6) {
PCM2_xor = ss5sp_xor;
ofst ^= 0x02000;
rom[ ofst ] = buf[ ((i + 0xffb440) & 0xffffff) ] ^ PCM2_xor[ (ofst & 0x07) ];
}
}
free( buf );
}

--- End code ---
look for NeoExit() int add after:

--- Code: ---nNeoSramProtection = 0;

--- End code ---
this:

--- Code: ---nNeoPCM2PLAYMOREByteswap = 0; // exit PCM2 PLAYMORE chip

--- End code ---
d_neogeo.cpp
according with the driver give the correct value for each ga,me that uses this chip, for example:

--- Code: ---static int kof2002Init()
{
nNeoProtectionxor = 0xec
pNeoInitCallback = kof2002Decrypt;
[B]nNeoPCM2PLAYMOREByteswap = 1;[/B]
return NeoInit();
}

--- End code ---
see ya!!!!!! :D
P.D. Edit, svcchaos and ss5 cases were swaped XD, deleted all amp references... that wasn't declared :confused: fixed ss5sp case, used ms5 one XD deleted svc chat table (svc and ms5 uses the same table, thanks to IQ_132 :P) now svcchaos ans ms5 uses the same case.
Edit2: readded case for svcchaos, mem offset is different from ms5 one XD

DsNo:
Thanks very march.. FerchogtX!!
Perfectly work!!

and Changed ( & ) to ( & )... :D

iq_132:
Here's my version :)

FerchogtX:
Great man!!! :P BTW I fixed the src i posted in the first post, now it will work without probs, and cleaned a lil
See ya!!!! :D
P.D. Fixed again the driver XD

iq_132:
Try this code:

neogeo.h
look for this:

--- Code: ---// neo_run.cpp

--- End code ---
add this after:

--- Code: ---extern int nNeoPCM2PLAYMOREByteswap;

--- End code ---
neo_run.cpp
look for this:

--- Code: ---int nNeoSRAMProtection = -1;

--- End code ---
add this after (or after pcm2 code by IQ_132)

--- Code: ---int nNeoPCM2PLAYMOREByteswap = 0; // PCM2 PLAYMORE chip

--- End code ---
Look for this:

--- Code: --- if (BurnDrvGetHardwareCode() & HARDWARE_SNK_SWAPV) {
for (int i = 0; i < 0x00200000; i++) {
unsigned char n = YM2610ADPCMAROM[i];
YM2610ADPCMAROM[i] = YM2610ADPCMAROM[0x00200000 + i];
YM2610ADPCMAROM[0x00200000 + i] = n;
}
}
}

--- End code ---
add this after (or after the IQ_132 PCM2 SNK 1999 code)

--- Code: --- /* Neo-PCM2 PLAYMORE(c) 2002 Sound Chip Emulation */
// some code by Fataku & some by the vconv (from 2ch) - FBA conversion by iq_132
if (nNeoPCM2PLAYMOREByteswap != 0)
{
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
};

int value = (nNeoPCM2PLAYMOREByteswap-1);
UINT8 *rom = YM2610ADPCMAROM;
UINT8 *buf = (UINT8*)malloc(0x1000000);
int ofst;

memcpy(buf,rom,0x1000000);

for(int i=0; i<0x1000000; i++)
{
ofst = (i & 0xfefffe) | ((i & 0x010000) >> 16) | ((i & 0x000001) << 16);
ofst ^= addrs[value][1];
rom[ofst] = (buf[((i + addrs[value][0]) & 0xffffff)] ^ xordata[value][(ofst & 0x07)]);
}

free(buf);
}

--- End code ---
look for NeoExit() int add after:

--- Code: ---nNeoSramProtection = 0;

--- End code ---
this:

--- Code: ---nNeoPCM2PLAYMOREByteswap = 0; // exit PCM2 PLAYMORE chip

--- End code ---
d_neogeo.cpp
According with the driver, give the correct value for each game that uses this chip; for example:

--- Code: ---static int kof2002Init()
{
nNeoProtectionxor = 0xec
pNeoInitCallback = kof2002Decrypt;
[B]nNeoPCM2PLAYMOREByteswap = 1;[/B]
return NeoInit();
}

--- End code ---



btw, I think "nNeoPCM2PLAYMOREBitswap" would be more appropriate.
btw2, All the code except the main body is a complete rip of Ferchogtx's (Just so everyone knows)

Navigation

[0] Message Index

[#] Next page

Go to full version