Author Topic: FBA port of Nicola's CPS2 decryption code  (Read 20136 times)

Offline iq_132

  • Administrator
  • *****
  • Posts: 3724
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
FBA port of Nicola's CPS2 decryption code
« on: January 09, 2007, 07:30:15 PM »
Here's a quick and dirty port of Nicola's code. 
Also attached is the original file he posted.


Offline BisonSAS

  • Expert
  • *****
  • Posts: 210
  • Karma: +27/-0
  • [NGBRT]
    • NeoGeo BR Team
Re: FBA port of Nicola's CPS2 decryption code
« Reply #1 on: January 09, 2007, 09:29:24 PM »
Fantastic! :cool:

Thank you very much for this code conversion! :biggrin: :biggrin: :biggrin:

Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: FBA port of Nicola's CPS2 decryption code
« Reply #2 on: January 09, 2007, 10:16:18 PM »
Thanks IQ  , Works well in mame too .
IQ Forum Member

Offline BisonSAS

  • Expert
  • *****
  • Posts: 210
  • Karma: +27/-0
  • [NGBRT]
    • NeoGeo BR Team
Re: FBA port of Nicola's CPS2 decryption code
« Reply #3 on: January 09, 2007, 11:37:26 PM »
I have problem in cps_decrypt.cpp compilation.

In:
Code: [Select]
bprintf (PRINT_NORMAL, "%x\n", nCpsCodeLen);
I replace this:
Code: [Select]
// bprintf (PRINT_NORMAL, "%x\n", nCpsCodeLen);
CPS2 decryption is very slow. :p
XOR's is fast. :idiot:

Thanks again! :biggrin:

Offline DsNo

  • Jr. Member
  • **
  • Posts: 56
  • Karma: +9/-0
  • Junior Member
Re: FBA port of Nicola's CPS2 decryption code
« Reply #4 on: January 09, 2007, 11:43:36 PM »
I fix like this

In:
Code: [Select]
bprintf (PRINT_NORMAL, "%x\n", nCpsCodeLen);

Replace:
Code: [Select]
bprintf (PRINT_NORMAL, _T("%x\n"), nCpsCodeLen);
« Last Edit: January 09, 2007, 11:48:45 PM by DsNo »

Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: FBA port of Nicola's CPS2 decryption code
« Reply #5 on: January 10, 2007, 12:58:36 AM »
I have problem in cps_decrypt.cpp compilation.

In:
Code: [Select]
bprintf (PRINT_NORMAL, "%x\n", nCpsCodeLen);
I replace this:
Code: [Select]
// bprintf (PRINT_NORMAL, "%x\n", nCpsCodeLen);
CPS2 decryption is very slow. :p
XOR's is fast. :idiot:

Thanks again! :biggrin:


Seems to work well in Mame maybe a few seconds slower than it would be with the XOR loading .
« Last Edit: January 10, 2007, 01:00:54 AM by James33 »
IQ Forum Member

Offline iq_132

  • Administrator
  • *****
  • Posts: 3724
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: FBA port of Nicola's CPS2 decryption code
« Reply #6 on: January 10, 2007, 07:17:14 AM »
I knew that bprintf would be a problem :(
Anyway, as for the speed, that's just the price you pay for proper emulation.


Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: FBA port of Nicola's CPS2 decryption code
« Reply #7 on: January 10, 2007, 07:57:24 AM »
So how long does it take to load on FBA ?
IQ Forum Member

Offline DsNo

  • Jr. Member
  • **
  • Posts: 56
  • Karma: +9/-0
  • Junior Member
Re: FBA port of Nicola's CPS2 decryption code
« Reply #8 on: January 10, 2007, 09:28:53 AM »
So how long does it take to load on FBA ?

About 3~5 second degree it was caught from the FBA...

OS : Windows XP Professional (32bit)
CPU : Core 2 Duo E6400
RAM : 2GB PC-5300
VGA : GeForce 7600GS

Offline KaNyErO

  • Member
  • ***
  • Posts: 142
  • Karma: +4/-0
Re: FBA port of Nicola's CPS2 decryption code
« Reply #9 on: January 10, 2007, 12:44:44 PM »
well maybe there could be 2 drivers for each game with keys: one with xor and other with only keys, so the user may choose wich one want to launch.

Offline iq_132

  • Administrator
  • *****
  • Posts: 3724
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: FBA port of Nicola's CPS2 decryption code
« Reply #10 on: January 10, 2007, 06:20:08 PM »
It'd be much easier to just make it save the xored program data on the first run, sort of like .NV files with mame, check for those on load, and then use those after the first run.
« Last Edit: January 10, 2007, 06:52:25 PM by iq_132 »


Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: FBA port of Nicola's CPS2 decryption code
« Reply #11 on: January 10, 2007, 07:54:23 PM »
well maybe there could be 2 drivers for each game with keys: one with xor and other with only keys, so the user may choose wich one want to launch.

The way that code was for mame it was able to load the key and if there was no key it would load the xor instead .


About 3~5 second degree it was caught from the FBA...

OS : Windows XP Professional (32bit)
CPU : Core 2 Duo E6400
RAM : 2GB PC-5300
VGA : GeForce 7600GS



I must admit thats not long at all .


It'd be much easier to just make it save the xored program data on the first run, sort of like .NV files with mame, check for those on load, and then use those after the first run.


Cool I need a Mame conversion of this :)
« Last Edit: January 10, 2007, 08:24:34 PM by James33 »
IQ Forum Member

Offline BisonSAS

  • Expert
  • *****
  • Posts: 210
  • Karma: +27/-0
  • [NGBRT]
    • NeoGeo BR Team
Re: FBA port of Nicola's CPS2 decryption code
« Reply #12 on: January 10, 2007, 10:16:04 PM »
It'd be much easier to just make it save the xored program data on the first run, sort of like .NV files with mame, check for those on load, and then use those after the first run.
nice code man! :cool:
load this XOR from zip, is possible? :confused:


Offline iq_132

  • Administrator
  • *****
  • Posts: 3724
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: FBA port of Nicola's CPS2 decryption code
« Reply #13 on: January 10, 2007, 11:40:26 PM »
Easy.

In src/burn/capcom/cps_decrypt.cpp

Find this:

Code: [Select]
while (k->name)
{
if (strcmp(BurnDrvGetTextA(DRV_NAME), (k->name)) == 0)
{
break;
}
++k;
}
Add this after:
Code: [Select]
// Check if xor file is loaded
if (k->name && nCpsCodeLen)
{
int x = nCpsCodeLen-1;
while (x)
if (CpsCode[x] == 0)
x-=1;
else
break;
if (!x) nCpsCodeLen = x;
}
Find this:

   if (k->name)

Replace it with this:

   if (k->name && !nCpsCodeLen)



Then for each game, just add something like this:

   { "xmcota.xor",   0x100000, 0x1b04be6d, 2 | BRF_OPT },


Btw, I wouldn't suggest this modification.  The xors do not compress well at all, this will make the sets bad in rom managers, and it's slower.
« Last Edit: January 11, 2007, 02:01:55 AM by iq_132 »


Offline BisonSAS

  • Expert
  • *****
  • Posts: 210
  • Karma: +27/-0
  • [NGBRT]
    • NeoGeo BR Team
Re: FBA port of Nicola's CPS2 decryption code
« Reply #14 on: January 11, 2007, 12:57:21 AM »
I add this code and the game not decrypt. :redface: