Welcome!
Final Burn Neo => FBN Development => Topic started by: iq_132 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.
-
Fantastic! :cool:
Thank you very much for this code conversion! :biggrin: :biggrin: :biggrin:
-
Thanks IQ , Works well in mame too .
-
I have problem in cps_decrypt.cpp compilation.
In:
bprintf (PRINT_NORMAL, "%x\n", nCpsCodeLen);
I replace this:
// bprintf (PRINT_NORMAL, "%x\n", nCpsCodeLen);
CPS2 decryption is very slow. :p
XOR's is fast. :idiot:
Thanks again! :biggrin:
-
I fix like this
In:
bprintf (PRINT_NORMAL, "%x\n", nCpsCodeLen);
Replace:
bprintf (PRINT_NORMAL, _T("%x\n"), nCpsCodeLen);
-
I have problem in cps_decrypt.cpp compilation.
In:
bprintf (PRINT_NORMAL, "%x\n", nCpsCodeLen);
I replace this:
// 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 .
-
I knew that bprintf would be a problem :(
Anyway, as for the speed, that's just the price you pay for proper emulation.
-
So how long does it take to load on FBA ?
-
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
-
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.
-
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.
-
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 :)
-
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:
-
Easy.
In src/burn/capcom/cps_decrypt.cpp
Find this:
while (k->name)
{
if (strcmp(BurnDrvGetTextA(DRV_NAME), (k->name)) == 0)
{
break;
}
++k;
}
Add this after:
// 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.
-
I add this code and the game not decrypt. :redface:
-
Fixed, check my previous post for the updated code.
-
Now, work fine! :biggrin: :biggrin: :biggrin:
Thank you very much! :cool:
You great! :wink:
-
Didn't test it yet, but quick question: does it work only with the games mentioned in instructions.txt or should it be appliable for all CPS2 games? Can I just remove the XORs for every CPS2 game in the source and expect that they use the original decryption?
Oh, and very good work, IQ! This is excellent.
-
They only work for the games mentioned in the source and no others.
Decryption Keys are needed to add more.
-
Yeah, taking a glance at the code I now realize this as well. Well, it's certainly a start! I'll use it in my next compilation. Thanks for the hard work you guys!
Now back to some hentai anime before I go to bed, lol.
-
thanks for the code. works fine here ;)
-
Here's a port of Nicola's WIP. I removed the .xor saving code; run one of the games and you'll see why :)
Quite a lot of games with keys now and a lot of work to remove the xor files.
-
Very well! :cool:
Now, load fast! :eek:
Thanks! :smilie:
-
Here's a port of Nicola's WIP. I removed the .xor saving code; run one of the games and you'll see why :)
Quite a lot of games with keys now and a lot of work to remove the xor files.
Yes!! Perfectly work~!! :biggrin:
Thank you iq_132 and Nicola's.
-
with the code from 10.01.2007 the decryption works very well, but using the lastest code (14.01.2007) it gives me this error everytime, and if I choose to "ignore" it, the game runs normally. It's happening with all the games that are using xors.
(http://img156.imageshack.us/img156/614/errordf7.th.png) (http://img156.imageshack.us/my.php?image=errordf7.png)
-
Thanks, iq_132, and I made a fix. :D
// we don't have a proper key so use the XOR tables if available
UINT16 *rom = (UINT16 *)CpsRom;
UINT16 *xor = (UINT16 *)CpsCode;
UINT32 length = nCpsCodeLen;
UINT32 i;
if (xor)
{
for (i = 0; i < length/2; i++)
xor ^= rom;
}
-
I using this old iq_132 code:
// we don't have a proper key so use the XOR tables if available
unsigned short *rom = (unsigned short *)CpsRom;
unsigned short *xor1 = (unsigned short *)CpsCode;
int length = nCpsCodeLen;
int i;
if (xor1)
{
for (i = 0; i < length/2; i++)
xor1 ^= rom;
}
}
}
-
Anyone else notice that Nicola posted the key for ssf2tbj?
{ "ssf2tbj", { 0x8758E392,0x3FFA1A50 }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
-
Anyone else notice that Nicola posted the key for ssf2tbj?
{ "ssf2tbj", { 0x8758E392,0x3FFA1A50 }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
It works fine... Confirmed from the FBA 0.2.95.23.
-
New keys from Nicola Salmoria (taken from M.A.M.E 0.111 u5 diff)
// name key upper watchdog
{ "dead", { 0xffffffff,0xffffffff }, /*(1)*/ }, // ffff ffff ffff
{ "ssf2", { 0xb7443350,0x2f4653d7 }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
{ "ssf2u", { 0xf0ae3d08,0x420dd6bf }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
{ "ssf2a", { 0x6260014f,0xd857f7a7 }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
{ "ssf2ar1", { 0x6260014f,0xd857f7a7 }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
{ "ssf2j", { 0x3d9e1e15,0xa58c32ce }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
{ "ssf2jr1", { 0x3d9e1e15,0xa58c32ce }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
{ "ssf2jr2", { 0x3d9e1e15,0xa58c32ce }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
{ "ssf2tb", { 0x3599df35,0xad98284c }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
{ "ssf2tbr1", { 0x3599df35,0xad98284c }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
{ "ssf2tbj", { 0x8758e392,0x3ffa1a50 }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
{ "ddtod", { 0xbea213ce,0xb61e8d81 }, 0x180000 }, // 0C78 1019 4000 cmpi.w #$1019,$4000
{ "ddtodr1", { 0xbea213ce,0xb61e8d81 }, 0x180000 }, // 0C78 1019 4000 cmpi.w #$1019,$4000
{ "ddtodu", { 0x41e77fbe,0x30db090c }, 0x180000 }, // 0C78 1019 4000 cmpi.w #$1019,$4000
{ "ddtodur1", { 0x41e77fbe,0x30db090c }, 0x180000 }, // 0C78 1019 4000 cmpi.w #$1019,$4000
{ "ddtodj", { 0x2f543984,0x1fa51d7a }, 0x180000 }, // 0C78 1019 4000 cmpi.w #$1019,$4000
{ "ddtodjr1", { 0x2f543984,0x1fa51d7a }, 0x180000 }, // 0C78 1019 4000 cmpi.w #$1019,$4000
// { "ddtoda", { /*not enough data*/ }, 0x180000 }, // 0C78 1019 4000 cmpi.w #$1019,$4000
{ "ddtodh", { 0x11e78b50,0x6429d20e }, 0x180000 }, // 0C78 1019 4000 cmpi.w #$1019,$4000
{ "ecofghtr", { 0xd2782128,0x4c8f96f4 }, 0x200000 }, // 0838 0003 7345 btst #3,$7345
// { "ecofghtu", { /* search failed */ }, 0x200000 }, // 0838 0003 7345 btst #3,$7345
// { "uecology", { /* search failed */ }, 0x200000 }, // 0838 0003 7345 btst #3,$7345
// { "ecofghta", { /* search failed */ }, 0x200000 }, // 0838 0003 7345 btst #3,$7345
{ "ssf2t", { 0x5910806e,0xd220add9 }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
{ "ssf2ta", { 0x3460406e,0x502ca919 }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
{ "ssf2tu", { 0x5d90c86f,0xd030eb68 }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
{ "ssf2tur1", { 0x5d90c86f,0xd030eb68 }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
{ "ssf2xj", { 0x38b09823,0xd304e0c0 }, 0x400000 }, // 0838 0007 2000 btst #7,$2000
{ "xmcota", { 0xe6017c4a,0xcddc1dd1 }, 0x100000 }, // 0C80 1972 0301 cmpi.l #$19720301,D0
{ "xmcotau", { 0xbfac7311,0x6ada1605 }, 0x100000 }, // 0C80 1972 0301 cmpi.l #$19720301,D0
// { "xmcotah", { /* MISSING */ }, 0x100000 }, // 0C80 1972 0301 cmpi.l #$19720301,D0
{ "xmcotaj", { 0xbb76009f,0xb38512d6 }, 0x100000 }, // 0C80 1972 0301 cmpi.l #$19720301,D0
{ "xmcotaj1", { 0xbb76009f,0xb38512d6 }, 0x100000 }, // 0C80 1972 0301 cmpi.l #$19720301,D0
{ "xmcotajr", { 0xbb76009f,0xb38512d6 }, 0x100000 }, // 0C80 1972 0301 cmpi.l #$19720301,D0
{ "xmcotaa", { 0xdb187e0c,0x1d247e33 }, 0x100000 }, // 0C80 1972 0301 cmpi.l #$19720301,D0
{ "armwar", { 0xed15db39,0x50143231 }, 0x100000 }, // 3039 0080 4020 move.w $00804020,D0
{ "armwarr1", { 0xed15db39,0x50143231 }, 0x100000 }, // 3039 0080 4020 move.w $00804020,D0
{ "armwaru", { 0x0f2644f0,0x781abc8e }, 0x100000 }, // 3039 0080 4020 move.w $00804020,D0
{ "pgear", { 0x1857a169,0x7f14a641 }, 0x100000 }, // 3039 0080 4020 move.w $00804020,D0
{ "pgearr1", { 0x1857a169,0x7f14a641 }, 0x100000 }, // 3039 0080 4020 move.w $00804020,D0
// { "armwara", { /* MISSING */ }, 0x100000 }, // 3039 0080 4020 move.w $00804020,D0
{ "avsp", { 0x548e151d,0x56374bdc }, 0x100000 }, // 0C80 1234 5678 cmpi.l #$12345678,D0
{ "avspu", { 0x45a46977,0xd860d3ad }, 0x100000 }, // 0C80 1234 5678 cmpi.l #$12345678,D0
{ "avspj", { 0x4339cde4,0x0d7b6c29 }, 0x100000 }, // 0C80 1234 5678 cmpi.l #$12345678,D0
{ "avspa", { 0x22e485fe,0x2e8d8b5c }, 0x100000 }, // 0C80 1234 5678 cmpi.l #$12345678,D0
{ "avsph", { 0x3f94a389,0xc57c61d2 }, 0x100000 }, // 0C80 1234 5678 cmpi.l #$12345678,D0
{ "dstlk", { 0x8202d548,0x4e068862 }, 0x100000 }, // 0838 0000 6160 btst #0,$6160
{ "dstlku", { 0xae094c0c,0x7a138c44 }, 0x100000 }, // 0838 0000 6160 btst #0,$6160
{ "dstlkur1", { 0xae094c0c,0x7a138c44 }, 0x100000 }, // 0838 0000 6160 btst #0,$6160
{ "dstlka", { 0x04048b4e,0x2a498879 }, 0x100000 }, // 0838 0000 6160 btst #0,$6160
{ "vampj", { 0x8817cae1,0xb4d48118 }, 0x100000 }, // 0838 0000 6160 btst #0,$6160
{ "vampja", { 0x8817cae1,0xb4d48118 }, 0x100000 }, // 0838 0000 6160 btst #0,$6160
{ "vampjr1", { 0x8817cae1,0xb4d48118 }, 0x100000 }, // 0838 0000 6160 btst #0,$6160
{ "ringdest", { 0x04055413,0x67806575 }, 0x180000 }, // 3039 0080 4020 move.w $00804020,D0
{ "smbomb", { 0x15014117,0x47008431 }, 0x180000 }, // 3039 0080 4020 move.w $00804020,D0
{ "smbombr1", { 0x15014117,0x47008431 }, 0x180000 }, // 3039 0080 4020 move.w $00804020,D0
{ "cybots", { 0x252c00d2,0xb5142040 }, 0x100000 }, // 0C38 00FF 0C38 cmpi.b #$FF,$0C38
{ "cybotsu", { 0xcd002398,0x05184145 }, 0x100000 }, // 0C38 00FF 0C38 cmpi.b #$FF,$0C38
{ "cybotsj", { 0x04048215,0x34388354 }, 0x100000 }, // 0C38 00FF 0C38 cmpi.b #$FF,$0C38
{ "msh", { 0xf755160b,0x63b0f8b4 }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
{ "mshu", { 0xcf0a032d,0x36a2ea11 }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
{ "mshj", { 0x01c0c951,0x370f4c80 }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
{ "mshjr1", { 0x01c0c951,0x370f4c80 }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
{ "msha", { 0x7fd080dc,0xb6104eee }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
{ "mshh", { 0x606b80ea,0x73555487 }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
{ "mshb", { 0x83571a87,0x41cbf22f }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
{ "nwarr", { 0x6b74b14f,0xc1968654 }, 0x180000 }, // 0838 0000 6160 btst #0,$6160
// { "nwarrh", { /* MISSING */ }, 0x180000 }, // 0838 0000 6160 btst #0,$6160
// { "nwarrb", { /* MISSING */ }, 0x180000 }, // 0838 0000 6160 btst #0,$6160
{ "vhuntj", { 0x13ea2a1b,0x6e0cb9af }, 0x180000 }, // 0838 0000 6160 btst #0,$6160
{ "vhuntjr1", { 0x13ea2a1b,0x6e0cb9af }, 0x180000 }, // 0838 0000 6160 btst #0,$6160
{ "vhuntjr2", { 0x13ea2a1b,0x6e0cb9af }, 0x180000 }, // 0838 0000 6160 btst #0,$6160
{ "sfa", { 0xad2dff0f,0x14b2f040 }, 0x080000 }, // 0C80 0564 2194 cmpi.l #$05642194,D0
{ "sfar1", { 0xad2dff0f,0x14b2f040 }, 0x080000 }, // 0C80 0564 2194 cmpi.l #$05642194,D0
{ "sfar2", { 0xad2dff0f,0x14b2f040 }, 0x080000 }, // 0C80 0564 2194 cmpi.l #$05642194,D0
{ "sfar3", { 0xad2dff0f,0x14b2f040 }, 0x080000 }, // 0C80 0564 2194 cmpi.l #$05642194,D0
{ "sfau", { 0x0b80d40e,0x95d57df5 }, 0x080000 }, // 0C80 0564 2194 cmpi.l #$05642194,D0
// { "sfza", { /*not enough data*/ }, 0x080000 }, // 0C80 0564 2194 cmpi.l #$05642194,D0
{ "sfzj", { 0x54bd7724,0xb62d70b0 }, 0x080000 }, // 0C80 0564 2194 cmpi.l #$05642194,D0
{ "sfzjr1", { 0x54bd7724,0xb62d70b0 }, 0x080000 }, // 0C80 0564 2194 cmpi.l #$05642194,D0
{ "sfzjr2", { 0x54bd7724,0xb62d70b0 }, 0x080000 }, // 0C80 0564 2194 cmpi.l #$05642194,D0
// { "sfzh", { /*not enough data*/ }, 0x080000 }, // 0C80 0564 2194 cmpi.l #$05642194,D0
// { "sfzb", { /* MISSING */ }, 0x080000 }, // 0C80 0564 2194 cmpi.l #$05642194,D0
// { "sfzbr1", { /*not enough data*/ }, 0x080000 }, // 0C80 0564 2194 cmpi.l #$05642194,D0
// { "mmancp2u", { /* MISSING */ }, }, // 0C80 0564 2194 cmpi.l #$05642194,D0 (found in CPS1 version)
// { "rmancp2j", { /* MISSING */ }, }, // 0C80 0564 2194 cmpi.l #$05642194,D0 (found in CPS1 version)
{ "19xx", { 0xc0230312,0x91b3a797 }, 0x200000 }, // 0C81 0095 1101 cmpi.l #$00951101,D1
{ "19xxa", { 0x74c976fe,0xb9979591 }, 0x200000 }, // 0C81 0095 1101 cmpi.l #$00951101,D1
{ "19xxj", { 0x293c170d,0x081fc06e }, 0x200000 }, // 0C81 0095 1101 cmpi.l #$00951101,D1
{ "19xxjr1", { 0x293c170d,0x081fc06e }, 0x200000 }, // 0C81 0095 1101 cmpi.l #$00951101,D1
{ "19xxh", { 0x1f7f8fcb,0x5f333c14 }, 0x200000 }, // 0C81 0095 1101 cmpi.l #$00951101,D1
{ "ddsom", { 0xd524e525,0x3ebdde0c }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
{ "ddsomr1", { 0xd524e525,0x3ebdde0c }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
{ "ddsomr2", { 0xd524e525,0x3ebdde0c }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
{ "ddsomr3", { 0xd524e525,0x3ebdde0c }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
{ "ddsomu", { 0x1905f689,0x818ee7f9 }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
{ "ddsomur1", { 0x1905f689,0x818ee7f9 }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
{ "ddsomj", { 0xe6714024,0x9bdd8d22 }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
{ "ddsomjr1", { 0xe6714024,0x9bdd8d22 }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
{ "ddsoma", { 0x8658a336,0x3fb81a72 }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
// { "ddsomb", { /*not enough data*/ }, 0x100000 }, // 0C81 1966 0419 cmpi.l #$19660419,D1
{ "megaman2", { 0x50601dca,0x69ba5224 }, 0x100000 }, // 0C80 0164 7101 cmpi.l #$01647101,D0
// { "megamn2a", { /*not enough data*/ }, 0x100000 }, // 0C80 0164 7101 cmpi.l #$01647101,D0
{ "rckman2j", { 0x6108e418,0xc659ed29 }, 0x100000 }, // 0C80 0164 7101 cmpi.l #$01647101,D0
{ "qndream", { 0x3b4b2c9e,0x62353d11 }, 0x080000 }, // 0C81 1973 0827 cmpi.l #$19730827,D1
{ "sfa2", { 0xcaa1da01,0xec9b73f5 }, 0x100000 }, // 0C80 3039 9783 cmpi.l #$30399783,D0
{ "sfz2j", { 0xe7a0597c,0x2e335731 }, 0x100000 }, // 0C80 3039 9783 cmpi.l #$30399783,D0
{ "sfz2a", { 0xf61b4c61,0x9df58912 }, 0x100000 }, // 0C80 3039 9783 cmpi.l #$30399783,D0
// { "sfz2b", { /* MISSING */ }, 0x100000 }, // 0C80 3039 9783 cmpi.l #$30399783,D0
// { "sfz2br1", { /* MISSING */ }, 0x100000 }, // 0C80 3039 9783 cmpi.l #$30399783,D0
// { "sfz2h", { /* MISSING */ }, 0x100000 }, // 0C80 3039 9783 cmpi.l #$30399783,D0
// { "sfz2n", { /* MISSING */ }, 0x100000 }, // 0C80 3039 9783 cmpi.l #$30399783,D0
{ "sfz2aj", { 0x1c551364,0x4c1e1001 }, 0x100000 }, // 0C80 8E73 9110 cmpi.l #$8E739110,D0
// { "sfz2ah", { /* MISSING */ }, 0x100000 }, // 0C80 8E73 9110 cmpi.l #$8E739110,D0
// { "sfz2ab", { /* MISSING */ }, 0x100000 }, // 0C80 8E73 9110 cmpi.l #$8E739110,D0
{ "sfz2aa", { 0x209a00e7,0xec434828 }, 0x100000 }, // 0C80 8E73 9110 cmpi.l #$8E739110,D0
// { "spf2t", { /*not enough data*/ }, 0x040000 }, // 0C80 3039 9819 cmpi.l #$30399819,D0
// { "spf2xj", { /*not enough data*/ }, 0x040000 }, // 0C80 3039 9819 cmpi.l #$30399819,D0
// { "spf2ta", { /*not enough data*/ }, 0x040000 }, // 0C80 3039 9819 cmpi.l #$30399819,D0
{ "xmvsf", { 0x5847db77,0xd54b0edb }, 0x100000 }, // 0C81 1972 0327 cmpi.l #$19720327,D1
{ "xmvsfr1", { 0x5847db77,0xd54b0edb }, 0x100000 }, // 0C81 1972 0327 cmpi.l #$19720327,D1
{ "xmvsfu", { 0x854feac0,0xbe2bf740 }, 0x100000 }, // 0C81 1972 0327 cmpi.l #$19720327,D1
{ "xmvsfur1", { 0x854feac0,0xbe2bf740 }, 0x100000 }, // 0C81 1972 0327 cmpi.l #$19720327,D1
// { "xmvsfj", { /* search failed */ }, 0x100000 }, // 0C81 1972 0327 cmpi.l #$19720327,D1
// { "xmvsfjr1", { /* TODO */ }, 0x100000 }, // 0C81 1972 0327 cmpi.l #$19720327,D1
// { "xmvsfjr2", { /* MISSING */ }, 0x100000 }, // 0C81 1972 0327 cmpi.l #$19720327,D1
// { "xmvsfa", { /* TODO */ }, 0x100000 }, // 0C81 1972 0327 cmpi.l #$19720327,D1
// { "xmvsfar1", { /* MISSING */ }, 0x100000 }, // 0C81 1972 0327 cmpi.l #$19720327,D1
// { "xmvsfh", { /* TODO */ }, 0x100000 }, // 0C81 1972 0327 cmpi.l #$19720327,D1
// { "xmvsfb", { /* TODO */ }, 0x100000 }, // 0C81 1972 0327 cmpi.l #$19720327,D1
{ "batcir", { 0x66527aba,0x4c876eef }, 0x200000 }, // 0C81 0097 0131 cmpi.l #$00970131,D1
// { "batcira", { /* search failed */ }, 0x200000 }, // 0C81 0097 0131 cmpi.l #$00970131,D1
{ "batcirj", { 0x288ed340,0x88190069 }, 0x200000 }, // 0C81 0097 0131 cmpi.l #$00970131,D1
{ "csclub", { 0xd4a2b480,0xba7a0857 }, 0x200000 }, // 0C81 0097 0310 cmpi.l #$00970310,D1
{ "cscluba", { 0xe4b41d49,0xe6127e99 }, 0x200000 }, // 0C81 0097 0310 cmpi.l #$00970310,D1
{ "csclubj", { 0x808ba692,0x2ab885d1 }, 0x200000 }, // 0C81 0097 0310 cmpi.l #$00970310,D1
{ "csclubh", { 0x53420cbe,0x48d8eb33 }, 0x200000 }, // 0C81 0097 0310 cmpi.l #$00970310,D1
{ "mshvsf", { 0xdf1a540f,0x66125f89 }, 0x100000 }, // 0C81 1972 1027 cmpi.l #$19721027,D1
{ "mshvsfu", { 0xe98cae72,0x2471d3d9 }, 0x100000 }, // 0C81 1972 1027 cmpi.l #$19721027,D1
{ "mshvsfu1", { 0xe98cae72,0x2471d3d9 }, 0x100000 }, // 0C81 1972 1027 cmpi.l #$19721027,D1
{ "mshvsfj", { 0x017b4fce,0xdc03585e }, 0x100000 }, // 0C81 1972 1027 cmpi.l #$19721027,D1
{ "mshvsfj1", { 0x017b4fce,0xdc03585e }, 0x100000 }, // 0C81 1972 1027 cmpi.l #$19721027,D1
{ "mshvsfj2", { 0x017b4fce,0xdc03585e }, 0x100000 }, // 0C81 1972 1027 cmpi.l #$19721027,D1
{ "mshvsfh", { 0xbf195a84,0x7bd400fa }, 0x100000 }, // 0C81 1972 1027 cmpi.l #$19721027,D1
// { "mshvsfa", { /* search failed */ }, 0x100000 }, // 0C81 1972 1027 cmpi.l #$19721027,D1
// { "mshvsfa1", { /* MISSING */ }, 0x100000 }, // 0C81 1972 1027 cmpi.l #$19721027,D1
{ "mshvsfb", { 0xe589b9f4,0x43220fd6 }, 0x100000 }, // 0C81 1972 1027 cmpi.l #$19721027,D1
{ "mshvsfb1", { 0xe589b9f4,0x43220fd6 }, 0x100000 }, // 0C81 1972 1027 cmpi.l #$19721027,D1
{ "sgemf", { 0x299c262f,0xb0bfe65a }, 0x080000 }, // 0C80 1F74 0D12 cmpi.l #$1F740D12,D0
{ "pfghtj", { 0xb75a406d,0xde1ccce2 }, 0x080000 }, // 0C80 1F74 0D12 cmpi.l #$1F740D12,D0
{ "sgemfa", { 0x64078f0f,0xa4267146 }, 0x080000 }, // 0C80 1F74 0D12 cmpi.l #$1F740D12,D0
// { "sgemfh", { /* search failed */ }, 0x080000 }, // 0C80 1F74 0D12 cmpi.l #$1F740D12,D0
{ "vhunt2", { 0xfb446e5a,0x7a5028d0 }, 0x100000 }, // 0C80 0692 0760 cmpi.l #$06920760,D0
{ "vhunt2r1", { 0xfb446e5a,0x7a5028d0 }, 0x100000 }, // 0C80 0692 0760 cmpi.l #$06920760,D0
{ "vsav", { 0x6064eafc,0x297e848b }, 0x100000 }, // 0C80 726A 4BAF cmpi.l #$726A4BAF,D0
{ "vsavu", { 0xc29aad27,0xb9ec6c19 }, 0x100000 }, // 0C80 726A 4BAF cmpi.l #$726A4BAF,D0
{ "vsavj", { 0xec43deba,0xe255308b }, 0x100000 }, // 0C80 726A 4BAF cmpi.l #$726A4BAF,D0
{ "vsava", { 0xc8b2ecc0,0x9411dcc9 }, 0x100000 }, // 0C80 726A 4BAF cmpi.l #$726A4BAF,D0
{ "vsavh", { 0xef367b7c,0xc9fa54b2 }, 0x100000 }, // 0C80 726A 4BAF cmpi.l #$726A4BAF,D0
{ "vsav2", { 0xff5e7ead,0x58a9c800 }, 0x100000 }, // 0C80 0692 0760 cmpi.l #$06920760,D0
{ "mvsc", { 0x253d2983,0xaa97a70c }, 0x100000 }, // 0C81 1972 0121 cmpi.l #$19720121,D1
{ "mvscu", { 0x65d59b92,0x04612f97 }, 0x100000 }, // 0C81 1972 0121 cmpi.l #$19720121,D1
{ "mvscj", { 0xf207676e,0x15439458 }, 0x100000 }, // 0C81 1972 0121 cmpi.l #$19720121,D1
{ "mvscjr1", { 0xf207676e,0x15439458 }, 0x100000 }, // 0C81 1972 0121 cmpi.l #$19720121,D1
{ "mvsca", { 0x975c90e9,0x6bf06e06 }, 0x100000 }, // 0C81 1972 0121 cmpi.l #$19720121,D1
{ "mvscar1", { 0x975c90e9,0x6bf06e06 }, 0x100000 }, // 0C81 1972 0121 cmpi.l #$19720121,D1
{ "mvsch", { 0x2f778c77,0x573cb129 }, 0x100000 }, // 0C81 1972 0121 cmpi.l #$19720121,D1
{ "mvscb", { 0x38ab355c,0x2b22ada3 }, 0x100000 }, // 0C81 1972 0121 cmpi.l #$19720121,D1
{ "sfa3", { 0xeae8e6b2,0x9deac8b0 }, 0x100000 }, // 0C80 1C62 F5A8 cmpi.l #$1C62F5A8,D0
{ "sfa3r1", { 0xeae8e6b2,0x9deac8b0 }, 0x100000 }, // 0C80 1C62 F5A8 cmpi.l #$1C62F5A8,D0
{ "sfa3b", { 0x609226ad,0x5901f806 }, 0x100000 }, // 0C80 1C62 F5A8 cmpi.l #$1C62F5A8,D0
{ "sfz3j", { 0x7e258ade,0x745e6a88 }, 0x100000 }, // 0C80 1C62 F5A8 cmpi.l #$1C62F5A8,D0
{ "sfz3jr1", { 0x7e258ade,0x745e6a88 }, 0x100000 }, // 0C80 1C62 F5A8 cmpi.l #$1C62F5A8,D0
{ "sfz3jr2", { 0x7e258ade,0x745e6a88 }, 0x100000 }, // 0C80 1C62 F5A8 cmpi.l #$1C62F5A8,D0
{ "sfz3a", { 0x18758a3b,0xc60a59c8 }, 0x100000 }, // 0C80 1C62 F5A8 cmpi.l #$1C62F5A8,D0
{ "sfz3ar1", { 0x18758a3b,0xc60a59c8 }, 0x100000 }, // 0C80 1C62 F5A8 cmpi.l #$1C62F5A8,D0
{ "jyangoku", { 0x5e8d6c8c,0x3adaf591 }, /*?*/ }, // 0C80 3652 1573 cmpi.l #$36521573,D0
{ "hsf2a", { 0x0ff5fe6c,0x42411399 }, 0x100000 }, // 0838 0007 2000 btst #7,$2000
// { "hsf2j", { /* MISSING */ }, 0x100000 }, // 0838 0007 2000 btst #7,$2000
{ "gigawing", { 0x3282aaa0,0x3f418f17 }, 0x100000 }, // 0C81 1972 1027 cmpi.l #$19721027,D1
{ "gwingj", { 0x45fe0d0a,0xc41077d1 }, 0x100000 }, // 0C81 1972 1027 cmpi.l #$19721027,D1
// { "gwinga", { /* search failed */ }, 0x100000 }, // 0C81 1972 1027 cmpi.l #$19721027,D1
{ "mmatrix", { 0x1e3bf539,0xb17b4865 }, 0x180000 }, // B6C0 B447 BACF cmpa.w D0,A3 cmp.w D7,D2 cmpa.w A7,A5
{ "mmatrixj", { 0x05e5d8d1,0x1eb5c5ba }, 0x180000 }, // B6C0 B447 BACF cmpa.w D0,A3 cmp.w D7,D2 cmpa.w A7,A5
{ "mpangj", { 0x2dc8626f,0xdda27163 }, 0x100000 }, // 0C84 347D 89A3 cmpi.l #$347D89A3,D4
{ "pzloop2", { 0x3332206a,0x0077f829 }, 0x400000 }, // 0C82 9A73 15F1 cmpi.l #$9A7315F1,D2
{ "pzloop2j", { 0x3332206a,0x0077f829 }, 0x400000 }, // 0C82 9A73 15F1 cmpi.l #$9A7315F1,D2
{ "choko", { 0x94fae2ee,0xefa4e6b8 }, 0x400000 }, // 0C86 4D17 5B3C cmpi.l #$4D175B3C,D6
{ "dimahoo", { 0x56ca3bdc,0x16575de3 }, 0x080000 }, // BE4C B244 B6C5 cmp.w A4,D7 cmp.w D4,D1 cmpa.w D5,A3
{ "gmahou", { 0x83ec7b61,0xf73b082f }, 0x080000 }, // BE4C B244 B6C5 cmp.w A4,D7 cmp.w D4,D1 cmpa.w D5,A3
{ "1944", { 0x7bad8109,0xd78e933f }, 0x080000 }, // 0C86 7B5D 94F1 cmpi.l #$7B5D94F1,D6
// { "1944j", { /*not enough data*/ }, 0x080000 }, // 0C86 7B5D 94F1 cmpi.l #$7B5D94F1,D6
{ "progear", { 0xf56ec08f,0xadf83a38 }, 0x400000 }, // 0C81 63A1 B8D3 cmpi.l #$63A1B8D3,D1
{ "progearj", { 0xf9fbb86d,0xf5952fad }, 0x400000 }, // 0C81 63A1 B8D3 cmpi.l #$63A1B8D3,D1
// { "progeara", { /* search failed */ }, 0x400000 }, // 0C81 63A1 B8D3 cmpi.l #$63A1B8D3,D1
It's great to see a hard encryption like that being broken, congratulations to Nicola and Andreas for the excellent work on CPS2 :biggrin:.And also iq_132 for converting this code to fba :biggrin:
I dont know if Nicola changed other things on cps2crypt.c, because i only took a look at the mame diff, and its a little messed to understand :p So lets just wait for Nicola's post on his blog :wink:
Anyway, now some Brazilian games work fine, yay! :biggrin:
-
I found it when iq_132 post the file ported from MAME, but I'm not sure.
(http://neo-source.com/index.php?topic=590.0)
I noticed that it exists in FBA Alpha 0.2.96.65 too.
static void cps2_decrypt(const UINT32 *master_key, unsigned int upper_limit)
{
......
#if 1
UINT16 *rom = (UINT16 *)CpsRom;
unsigned int length = upper_limit;
CpsCode = (UINT8*)malloc(length); <== allocated but not free
UINT16 *dec = (UINT16*)CpsCode;
unsigned int i;
#endif
......
Here I made a simple fix. :biggrin:
For CPS2 is fully decrypted now, we don't need the loading xor code.
In cps.cpp, find these in CpsGetROMs()
unsigned char* CpsCodeLoad = CpsCode;
.....
if (!CpsCodeLoad || !CpsRomLoad || !CpsGfxLoad || !CpsZRomLoad || !CpsQSamLoad) {
return 1;
}
....
// XOR tables
if ((ri.nType & 7) == 2) {
if (bLoad) {
BurnLoadRom(CpsCodeLoad, i, 1);
CpsCodeLoad += ri.nLen;
} else {
nCpsCodeLen += ri.nLen;
}
continue;
}
comment them or delete CpsCodeLoad.
in CpsInit(), add this at first:
unsigned char* CpsCodeIn = NULL;
then find:
CpsCode = CpsRom + nCpsRomLen;
if (Cps1Qs == 1) {
CpsEncZRom = CpsCode + nCpsCodeLen;
CpsZRom = CpsEncZRom + nCpsZRomLen * 2;
} else {
CpsZRom = CpsCode + nCpsCodeLen;
}
replace it with:
CpsCodeIn = CpsRom + nCpsRomLen;
if (Cps1Qs == 1) {
CpsEncZRom = CpsCodeIn + nCpsCodeLen;
CpsZRom = CpsEncZRom + nCpsZRomLen * 2;
} else {
CpsZRom = CpsCodeIn + nCpsCodeLen;
}
in CpsExit(), add
free(CpsCode);
before
nCpsCodeLen = nCpsRomLen = nCpsGfxLen = nCpsZRomLen = nCpsQSamLen = nCpsAdLen = 0;
If you want to keep the loading xor code, maybe you should define a new pointer used to point the new allocated memory
in cps2_decrypt() and don't forget to free it in CpsExit().
:p
-
ThanX Leaf! added the fix to the actual FBA Extras so it should be included in R10 version :wink:
SeeYaa!
:biggrin:
-
Hadn't noticed this, nice find Leaf. ^^