Author Topic: Neo-PCM2 PLAYMORE 2002 code for FBA  (Read 15770 times)

Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
Neo-PCM2 PLAYMORE 2002 code for FBA
« on: November 29, 2004, 08:05:37 PM »
Hi guys, if yiou noticed that mame code, this will not be surprising XD, i hope this works...
neogeo.h
look for this:
Code: [Select]
// neo_run.cpp
add this after:
Code: [Select]
extern int nNeoPCM2PLAYMOREByteswap;
neo_run.cpp
look for this:
Code: [Select]
int nNeoSRAMProtection = -1;
add this after (or after pcm2 code by IQ_132)
Code: [Select]
int nNeoPCM2PLAYMOREByteswap = 0; // PCM2 PLAYMORE chip
Look for this:
Code: [Select]
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;
}
}
}
add this after (or after the IQ_132 PCM2 SNK 1999 code)
Code: [Select]
/* 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 );
}
look for NeoExit() int add after:
Code: [Select]
nNeoSramProtection = 0;
this:
Code: [Select]
nNeoPCM2PLAYMOREByteswap = 0; // exit PCM2 PLAYMORE chip
d_neogeo.cpp
according with the driver give the correct value for each ga,me that uses this chip, for example:
Code: [Select]
static int kof2002Init()
{
nNeoProtectionxor = 0xec
pNeoInitCallback = kof2002Decrypt;
[B]nNeoPCM2PLAYMOREByteswap = 1;[/B]
return NeoInit();
}
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
« Last Edit: May 10, 2005, 02:57:23 AM by iq_132 »

Good and evil co-exist because of the balance, lies are not part of it...

FB Alpha Plus! site infos updated, see the latest info clicking on my profile link...

Offline DsNo

  • Jr. Member
  • **
  • Posts: 56
  • Karma: +9/-0
  • Junior Member
Neo-PCM2 PLAYMORE 2002 code for FBA
« Reply #1 on: November 29, 2004, 09:07:55 PM »
Thanks very march.. FerchogtX!!
Perfectly work!!

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

Online iq_132

  • Administrator
  • *****
  • Posts: 3728
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Neo-PCM2 PLAYMORE 2002 code for FBA
« Reply #2 on: November 29, 2004, 10:40:58 PM »
Here's my version :)


Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
Neo-PCM2 PLAYMORE 2002 code for FBA
« Reply #3 on: November 30, 2004, 01:16:08 AM »
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

Good and evil co-exist because of the balance, lies are not part of it...

FB Alpha Plus! site infos updated, see the latest info clicking on my profile link...

Online iq_132

  • Administrator
  • *****
  • Posts: 3728
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Neo-PCM2 PLAYMORE 2002 code for FBA
« Reply #4 on: November 30, 2004, 03:43:49 AM »
Try this code:

neogeo.h
look for this:
Code: [Select]
// neo_run.cpp
add this after:
Code: [Select]
extern int nNeoPCM2PLAYMOREByteswap;
neo_run.cpp
look for this:
Code: [Select]
int nNeoSRAMProtection = -1;
add this after (or after pcm2 code by IQ_132)
Code: [Select]
int nNeoPCM2PLAYMOREByteswap = 0; // PCM2 PLAYMORE chip
Look for this:
Code: [Select]
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;
}
}
}
add this after (or after the IQ_132 PCM2 SNK 1999 code)
Code: [Select]
/* 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);
}
look for NeoExit() int add after:
Code: [Select]
nNeoSramProtection = 0;
this:
Code: [Select]
nNeoPCM2PLAYMOREByteswap = 0; // exit PCM2 PLAYMORE chip
d_neogeo.cpp
According with the driver, give the correct value for each game that uses this chip; for example:
Code: [Select]
static int kof2002Init()
{
nNeoProtectionxor = 0xec
pNeoInitCallback = kof2002Decrypt;
[B]nNeoPCM2PLAYMOREByteswap = 1;[/B]
return NeoInit();
}



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)
« Last Edit: May 10, 2005, 02:58:36 AM by iq_132 »


Offline Accosta_m

  • Newbies
  • *
  • Posts: 15
  • Karma: +0/-0
  • The Ghost Gundam
Neo-PCM2 PLAYMORE 2002 code for FBA
« Reply #5 on: November 30, 2004, 05:00:14 PM »
Quote from: iq_132
Code: [Select]
static int kof2002Init()
{
nNeoProtectionxor = 0xec
pNeoInitCallback = kof2002Decrypt;
[B]nNeoPCM2PLAYMOREByteswap = 1;[/B]
return NeoInit();
}
Who is the Correct Value for this  :confused:

static int samsho5Init()
{
   nNeoProtectionXor = 0x0f;
   pNeoInitCallback = samsho5Decrypt;
   nNeoPCM2PLAYMOREByteswap = 4;
   return NeoInit();
}

if i use this value the emulation have some sounds error What can i do for fix it??
« Last Edit: May 10, 2005, 02:58:51 AM by iq_132 »
:D     :cool:     :eek:     ;)     :p

Offline Death Metal

  • Member
  • ***
  • Posts: 121
  • Karma: +3/-0
  • Crimson Blade
Neo-PCM2 PLAYMORE 2002 code for FBA
« Reply #6 on: November 30, 2004, 05:59:08 PM »
Quote from: Accosta_m
Who is the Correct Value for this  :confused:

static int samsho5Init()
{
   nNeoProtectionXor = 0x0f;
   pNeoInitCallback = samsho5Decrypt;
   nNeoPCM2PLAYMOREByteswap = 4;
   return NeoInit();
}

if i use this value the emulation have some sounds error What can i do for fix it??


Should be 5, according to FerchogtX's code above (if you're going for Samurai Shodown 5, that is).

Offline Accosta_m

  • Newbies
  • *
  • Posts: 15
  • Karma: +0/-0
  • The Ghost Gundam
Neo-PCM2 PLAYMORE 2002 code for FBA
« Reply #7 on: November 30, 2004, 11:11:25 PM »
Quote from: Death Metal
Should be 5, according to FerchogtX's code above (if you're going for Samurai Shodown 5, that is).


i'm compile with the code IQC code


then what is the value correct for this set  :confused:

static int samsho5Init()
{
nNeoProtectionXor = 0x0f;
pNeoInitCallback = samsho5Decrypt;
nNeoPCM2PLAYMOREByteswap = 4;
return NeoInit();
}

if i put value 4 to according with the IQC code i have noise problems in the moment am emulating the set only in this set

in kof2002, svcchaos,samsho5sp the sound is perfect but i don' test in others setss
:D     :cool:     :eek:     ;)     :p

Offline fataku

  • Newbies
  • *
  • Posts: 22
  • Karma: +0/-0
  • Junior Member
Neo-PCM2 PLAYMORE 2002 code for FBA
« Reply #8 on: December 01, 2004, 12:31:26 AM »
what samsho5 V roms are you using?

Offline Death Metal

  • Member
  • ***
  • Posts: 121
  • Karma: +3/-0
  • Crimson Blade
Neo-PCM2 PLAYMORE 2002 code for FBA
« Reply #9 on: December 01, 2004, 01:02:21 AM »
Quote from: Accosta_m
if i put value 4 to according with the IQC code i have noise problems in the moment am emulating the set only in this set

That's what I said: use 5 instead of 4 for Samurai Shodown 5. But, as fataku implied, you should only use the nNeoPCM2PLAYMOREByteswap variable with encrypted V sets.

Offline Accosta_m

  • Newbies
  • *
  • Posts: 15
  • Karma: +0/-0
  • The Ghost Gundam
Neo-PCM2 PLAYMORE 2002 code for FBA
« Reply #10 on: December 01, 2004, 02:26:58 AM »
270-v1.bin 8.0Mb CRC 7541763a
270-v2.bin 8.0Mb CRC 4e6e7d98

I'm using this V roms and

static int samsho5Init()
{
   nNeoProtectionXor = 0x0f;
   pNeoInitCallback = samsho5Decrypt;
   nNeoPCM2PLAYMOREByteswap = 4;
   return NeoInit();
}

But i have some Questions For the M1
270-m1d.bin 128 kb CRC 18114FB1

And I check the fercho Code and only the sounds of SVCCHAOS and Matrim have bad sound

But the IQC code Have sound perfect in svcchaos but matrim not  :confused:

Who Can i do for Fix It :confused:
:D     :cool:     :eek:     ;)     :p

Offline Death Metal

  • Member
  • ***
  • Posts: 121
  • Karma: +3/-0
  • Crimson Blade
Neo-PCM2 PLAYMORE 2002 code for FBA
« Reply #11 on: December 02, 2004, 11:04:16 AM »
Accosta_m: please inform which V files you are using for both svcchaos and matrim. If you're using the original, encrypted V roms, then Ferchogtx's code might need some tweak (unlikely). From what I gather, you must be trying to load sets already decrypted...?

By the way, the samsho5 roms you're using are correct. Use this init for this driver:

Code: [Select]
static int samsho5Init()
{
nNeoProtectionXor = 0x0f;
pNeoInitCallback = samsho5Decrypt;
nNeoPCM2PLAYMOREByteswap = 5;
return NeoInit();
}

Offline Accosta_m

  • Newbies
  • *
  • Posts: 15
  • Karma: +0/-0
  • The Ghost Gundam
Neo-PCM2 PLAYMORE 2002 code for FBA
« Reply #12 on: December 02, 2004, 02:29:06 PM »
Quote from: Death Metal
Accosta_m: please inform which V files you are using for both svcchaos and matrim.


i'm use the V roms encripted for KOF2002, Samsh5sp, Samsho5, mslug5 and these no have bad sound on the emulation but i use the Fercho Code and these are the V and M roms

For matrim

{"266-m1d.bin",0x020000, 0xf692d84B, 0x10}, // 11 Z80 code (decrypted)

{"266-v1.bin", 0x800000, 0xa4f83690,    2}, // 17 Sound data /* kawaks dev dump */
{"266-v2.bin", 0x800000, 0xd0f69eda,    2}, // 18

nNeoPCM2PLAYMOREByteswap = 2;

For SVCCHAOS

{"269-m1d.bin", 0x020000, 0xFD4F0FF9, 0x10}, //  3 Z80 code
{"269-v1.bin",  0x800000, 0xc659b34c,    2}, //  4 Sound data (Encrypted)
{"269-v2.bin",  0x800000, 0xdd903835,    2}, //  5

  nNeoPCM2PLAYMOREByteswap = 4;
:D     :cool:     :eek:     ;)     :p

Offline Xeon

  • Newbies
  • *
  • Posts: 45
  • Karma: +0/-0
  • Member
Neo-PCM2 PLAYMORE 2002 code for FBA
« Reply #13 on: December 02, 2004, 02:56:44 PM »
try using IQ's code, for some reason Ferchogtx's code didnt work for me either (with SVC) regardless of its case (3 or 4).

Offline Accosta_m

  • Newbies
  • *
  • Posts: 15
  • Karma: +0/-0
  • The Ghost Gundam
Neo-PCM2 PLAYMORE 2002 code for FBA
« Reply #14 on: December 02, 2004, 03:06:14 PM »
Quote from: Xeon
try using IQ's code, for some reason Ferchogtx's code didnt work for me either (with SVC) regardless of its case (3 or 4).


With the code of IQC i have bad soun on Samsho5 or i have bad the V roms

What V roms is need for the IQC Code :confused:
:D     :cool:     :eek:     ;)     :p