Author Topic: kof2002b infos  (Read 21409 times)

Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: kof2002b infos
« Reply #15 on: August 08, 2005, 05:12:46 AM »
Great stuff :)

Now to try and do a Mame conversion .
IQ Forum Member

Offline iq_132

  • Administrator
  • *****
  • Posts: 3723
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: kof2002b infos
« Reply #16 on: August 09, 2005, 01:57:01 AM »
How about this James ;)

Code: [Select]
// Decryption code by IQ_132 -- http;//neosource.1emu.net
void kof2002b_gfx_decrypt(UINT8 *src, int size)
{
int i, j;
int t[8][10] =
{
{ 0, 8, 7, 5, 4, 3, 6, 2, 1 },
{ 1, 0, 8, 5, 4, 3, 7, 6, 2 },
{ 2, 1, 0, 5, 4, 3, 8, 7, 6 },
{ 6, 2, 1, 5, 4, 3, 0, 8, 7 },
{ 7, 6, 2, 5, 4, 3, 1, 0, 8 },
{ 0, 1, 2, 5, 4, 3, 6, 7, 8 },
{ 2, 1, 0, 5, 4, 3, 6, 7, 8 },
{ 8, 0, 7, 5, 4, 3, 6, 2, 1 },
};

UINT8 *dst = malloc(0x10000);

for (i = 0; i < size; i+=0x10000)
{
memcpy(dst, src+i,0x10000);

for (j = 0; j < 0x200; j++)
{
int n = ((j % 0x40) / 8);
int ofst = BITSWAP16(j, 15, 14, 13, 12, 11, 10, 9, t[n][0], t[n][1], t[n][2],
        5, 4, 3, t[n][6], t[n][7], t[n][8]);
memcpy(src+i+ofst*128, dst+j*128, 128);
}
}
free(dst);
}

DRIVER_INIT( kof2002b )
{

kof2002b_gfx_decrypt(memory_region(REGION_GFX3), 0x4000000);
kof2002b_gfx_decrypt(memory_region(REGION_GFX1), 0x0020000);
« Last Edit: March 26, 2009, 03:03:32 PM by iq_132 »


Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: kof2002b infos
« Reply #17 on: August 09, 2005, 02:36:59 AM »
I will give it a test . Thanks IQ :)


EDIT
Yep it seems to work :)


This is how I added it to Mame .

Code: [Select]
// Decryption code by IQ_132 -- http;//neosource.1emu.net
void kof2002b_gfx_decrypt(UINT8 *src, int size)
{
int i, j;
int t[8][10] =
{
{ 0, 8, 7, 3, 4, 5, 6, 2, 1 },
{ 1, 0, 8, 4, 5, 3, 7, 6, 2 },
{ 2, 1, 0, 3, 4, 5, 8, 7, 6 },
{ 6, 2, 1, 5, 3, 4, 0, 8, 7 },
{ 7, 6, 2, 5, 3, 4, 1, 0, 8 },
{ 0, 1, 2, 3, 4, 5, 6, 7, 8 },
{ 2, 1, 0, 4, 5, 3, 6, 7, 8 },
{ 8, 0, 7, 3, 4, 5, 6, 2, 1 },
};

UINT8 *dst = malloc(0x10000);

for (i = 0; i < size; i+=0x10000)
{
memcpy(dst, src+i,0x10000);

for (j = 0; j < 0x200; j++)
{
int n = ((j % 0x40) / 8);
int ofst = BITSWAP16(j, 15, 14, 13, 12, 11, 10, 9, t[n][0], t[n][1], t[n][2],
        t[n][3], t[n][4], t[n][5], t[n][6], t[n][7], t[n][8]);
memcpy(src+i+ofst*128, dst+j*128, 128);
}
}
free(dst);
}

DRIVER_INIT( kof2002b )
{
int sec[] = { 0x02, 0x05, 0x06, 0x03, 0x00, 0x07, 0x04, 0x01 };

int i, rom_size = 0x400000;
UINT8 *src = memory_region(REGION_CPU1)+0x100000;
UINT8 *dst = malloc( rom_size );
 
memcpy( dst, src, rom_size);
for( i=0; i<8; i++){
memcpy( src+i*0x80000, dst+sec[i]*0x80000, 0x80000);
}
free( dst );

kof2002b_gfx_decrypt(memory_region(REGION_GFX3), 0x4000000);
kof2002b_gfx_decrypt(memory_region(REGION_GFX1), 0x0020000);

neo_pcm2_playmore_2002(0); // kof2002
neogeo_fix_bank_type = 0;
init_neogeo();
}
« Last Edit: August 09, 2005, 09:05:33 AM by James33 »
IQ Forum Member

Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
Re: kof2002b infos
« Reply #18 on: August 15, 2005, 10:59:48 PM »
Hem... I have a problem here I hope that you can help me IQ (i tried to see you on Mesenger but you were away)
I have this for patching the m1 rom in kof2k2 plus as you know (or some of you know) kof2002b misses sounds (in the real cart), but in the plus versions the use a "fix" for that, so the Orochi team BGM and other stuff is fixed.
Can you help me making this code "shorter"?... this can geive a headache to the best lector XD
Thanks in advance
See ya!!!!! :biggrin:
« Last Edit: April 30, 2010, 02:46:05 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 CaptainCPS

  • FBNeo Dev
  • ******
  • Posts: 1513
  • Karma: +127/-0
  • FB Alpha Team
    • CaptainCPS's Home
Re: kof2002b infos
« Reply #19 on: August 16, 2005, 11:51:09 AM »
Ok i edited the code Wheuu!! xDDD lot of code there...xDD wow 2758 lines of
patching? right? or that's not patching xD...

well now is more readable i think, and i added something missing ...that was the '' ; '' sign after
every line of code...that hurts xDD

I know IQ can do more for the code ...than i did. So i hope IQ get some time for this ^^

SeeYaa!!!
:-D


« Last Edit: April 30, 2010, 02:46:19 AM by iq_132 »

Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
Re: kof2002b infos
« Reply #20 on: August 16, 2005, 08:59:59 PM »
Hem... i had another thing in mind XD... maybe a table with values or somethig like that (more or less like the svcchaos patch that was released some time ago before the real bankswitch)
Thanks anyway... but that stills big XD
See ya!!!! :biggrin:

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 iq_132

  • Administrator
  • *****
  • Posts: 3723
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: kof2002b infos
« Reply #21 on: August 17, 2005, 01:51:15 AM »
Tell me what crc source and changed m1, and I'll make that for you no problem ;)


Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
Re: kof2002b infos
« Reply #22 on: August 18, 2005, 12:26:00 PM »
From CRC32 AB9D360E to CRC32 (fix) F6FAB859
The last is a fix for kof2002 some time ago... but is used in the plus bootlegs so, for avoiding to use another m1 i prefer to make a table to patch it XD
Thanks in advance
See ya!!!! :biggrin:

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 iq_132

  • Administrator
  • *****
  • Posts: 3723
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: kof2002b infos
« Reply #23 on: August 20, 2005, 10:12:09 PM »
Here ya go.  it's only 300 lines long instead of 5000 lol :p


Offline Shoometsu

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
  • I finally have an avatar XD
Re: kof2002b infos
« Reply #24 on: August 21, 2005, 01:57:56 PM »
did you guys tested this code with the system configured as normal bios, mvs system and asia/euro region ? the game don't start nly in this config here... my code:

Code: [Select]
// The King of Fighters 2002 (bootleg)

static struct BurnRomInfo kof2002bRomDesc[] = {
 {"265-p1.bin", 0x100000, 0x9ede7323, 1 | BRF_ESS | BRF_PRG },
 {"265b-p2.bin", 0x400000, 0x6dbee4df, 1 | BRF_ESS | BRF_PRG },

 {"265b-s1.bin", 0x020000, 0x2255f5bf, 2 | BRF_GRA },

 {"265b-c1.bin", 0x800000, 0xf25d3d66, 3 | BRF_GRA },
 {"265b-c2.bin", 0x800000, 0xe3e66f1d, 3 | BRF_GRA },
 {"265b-c3.bin", 0x800000, 0x8732fa30, 3 | BRF_GRA },
 {"265b-c4.bin", 0x800000, 0x0989fd40, 3 | BRF_GRA },
 {"265b-c5.bin", 0x800000, 0x60635cd2, 3 | BRF_GRA },
 {"265b-c6.bin", 0x800000, 0xbd736824, 3 | BRF_GRA },
 {"265b-c7.bin", 0x800000, 0x2da8d8cf, 3 | BRF_GRA },
 {"265b-c8.bin", 0x800000, 0x2048404a, 3 | BRF_GRA },

 { "265-m1d.bin", 0x020000, 0x1C661A4B, 4 | BRF_ESS | BRF_PRG },

 {"265b-v1d.bin", 0x400000, 0x13D98607, 5 | BRF_SND },
 {"265b-v2d.bin", 0x400000, 0x9CF74677, 5 | BRF_SND },
 {"265b-v3d.bin", 0x400000, 0x8E9448B5, 5 | BRF_SND },
 {"265b-v4d.bin", 0x400000, 0x067271B5, 5 | BRF_SND },
};

STDROMPICKEXT(kof2002b, kof2002b, neogeo);
STD_ROM_FN(kof2002b);

// Code by IQ_132

void kof2002b_gfx_decrypt(unsigned char *src, int size)
{
int i, j;
int t[8][10] =
{
{ 0, 8, 7, 3, 4, 5, 6, 2, 1 },
{ 1, 0, 8, 4, 5, 3, 7, 6, 2 },
{ 2, 1, 0, 3, 4, 5, 8, 7, 6 },
{ 6, 2, 1, 5, 3, 4, 0, 8, 7 },
{ 7, 6, 2, 5, 3, 4, 1, 0, 8 },
{ 0, 1, 2, 3, 4, 5, 6, 7, 8 },
{ 2, 1, 0, 4, 5, 3, 6, 7, 8 },
{ 8, 0, 7, 3, 4, 5, 6, 2, 1 },
};

unsigned char *dst = (unsigned char*)malloc(0x10000);

for (i = 0; i < size; i+=0x10000)
{
memcpy(dst, src+i,0x10000);

for (j = 0; j < 0x200; j++)
{
int n = ((j % 0x40) / 8);
int ofst = BITSWAP16(j, 15, 14, 13, 12, 11, 10, 9, t[n][0], t[n][1], t[n][2],t[n][3], t[n][4], t[n][5], t[n][6], t[n][7], t[n][8]);
memcpy(src+i+ofst*128, dst+j*128, 128);
}
}

free(dst);
}

// Descramble code by bms888
static void kof2002b_px_decrypt()
{       
       
int sec[] = { 0x02, 0x05, 0x06, 0x03, 0x00, 0x07, 0x04, 0x01 };

int i, rom_size = 0x400000;
UINT8 *src = Neo68KROM+0x100000;
UINT8 *dst = (UINT8 *)malloc( rom_size );

memcpy( dst, src, rom_size);
for( i=0; i<8; i++){
memcpy( src+i*0x80000, dst+sec[i]*0x80000, 0x80000);
}
free( dst );           
}

static void kof2002b_decrypt()
{
kof2002b_px_decrypt();
kof2002b_gfx_decrypt(NeoSpriteROM,     0x4000000);// Sprite and Text are scrambled/encrypted
kof2002b_gfx_decrypt(NeoTextROM+0x20000, 0x20000);// in the same way every 64kb
}

//

static int kof2002bInit()
{
int nRet;

pNeoInitCallback = kof2002b_decrypt;

nRet = NeoInit();

return nRet;
}

struct BurnDriver BurnDrvkof2002b = {
"kof2002b", "kof2002", "neogeo", "2002",
"The King of Fighters 2002 (bootleg)\0", NULL, "SNK", "Neo Geo",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SNK_NEOGEO,
NULL, kof2002bRomInfo, kof2002bRomName, neogeoInputInfo, neogeoDIPInfo,
kof2002bInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};
« Last Edit: August 21, 2005, 02:04:03 PM by Shoometsu »
<- Who are you?

Offline iq_132

  • Administrator
  • *****
  • Posts: 3723
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: kof2002b infos
« Reply #25 on: August 21, 2005, 04:01:55 PM »
I don't see anything wrong with your driver, and I just tested mine, and it works fine with every bios tested...  :confused:
Maybe something else in your build is messed up?


Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
Re: kof2002b infos
« Reply #26 on: August 21, 2005, 04:56:26 PM »
Here ya go.  it's only 300 lines long instead of 5000 lol :p
Thanks a lot man!!! I'll test inmedia
See ya!!!! :biggrin:

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 Shoometsu

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
  • I finally have an avatar XD
Re: kof2002b infos
« Reply #27 on: August 22, 2005, 09:54:28 PM »
if it's working with you, must be another issue from my build (I'm expect anything afther that tmnt gfx bug :P )

edit 28.08.o5

wow, the same code is working now, I don't know what happened... I'm thinking about to add "cursed" to my build's name :P
« Last Edit: August 28, 2005, 06:44:50 PM by Shoometsu »
<- Who are you?