Author Topic: SVC Chaos driver infos.  (Read 47017 times)

Offline iq_132

  • Administrator
  • *****
  • Posts: 3724
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
SVC Chaos driver infos.
« Reply #75 on: March 20, 2005, 10:28:28 PM »
Hey bms! Check my original post for a better version of that code.
It only needs 2kb more instead of 64mb :)


Offline bms888

  • Jr. Member
  • **
  • Posts: 93
  • Karma: +0/-0
  • Member
SVC Chaos driver infos.
« Reply #76 on: March 20, 2005, 10:37:13 PM »
Quote from: iq_132
Hey bms! Check my original post for a better version of that code.
It only needs 2kb more instead of 64mb :)



Oh,yeah. I,ve tested.^_^

Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
SVC Chaos driver infos.
« Reply #77 on: March 21, 2005, 10:32:34 PM »
Wow! looks great, i'll test it inmeditely
Thanks a lot IQ (for both driver and you know ;) )
See ya!!!!!! :D

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: 3724
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: SVC Chaos driver infos.
« Reply #78 on: June 27, 2005, 02:48:14 PM »
Here's the extra C decryption code for SVC.  but with a small modification:
- I've managed to make it so that this code only takes 8MB of ram instead of
the 64 MB it use to take.  Enjoy ;)

Code: [Select]
// Original MAME by HalRIN - http://www52.tok2.com/home/foge/
// Ported to FBA and modified by IQ_132 - http://neosource.1emu.net/
// SvC Chaos: SNK vs CAPCOM C-ROM decryption (Version 2, Low RAM)
void svcchaos_cx_decrypt(unsigned char* src)
{
int i, j, ofst;
const unsigned char xor1[ 4 ] = {0x34, 0x21, 0xc4, 0xe9,};
unsigned char *pTemp = (unsigned char*)malloc( 0x800000 );

for (i = 0; i < 8; i++)
{
unsigned char *rom = src+i*0x800000;

for( j = 0; j < 0x800000; j++ ) {
rom[ j ] ^= xor1[ (j % 4) ];
}

for( j = 0; j < 0x800000; j += 4 ) {
UINT32 *rom32 = (UINT32*)&rom[ j ];
*rom32 = BITSWAP32( *rom32, 0x09, 0x0d, 0x13, 0x00, 0x17, 0x0f, 0x03, 0x05,
    0x04, 0x0c, 0x11, 0x1e, 0x12, 0x15, 0x0b, 0x06,
    0x1b, 0x0a, 0x1a, 0x1c, 0x14, 0x02, 0x0e, 0x1d,
    0x18, 0x08, 0x01, 0x10, 0x19, 0x1f, 0x07, 0x16 );
}

memcpy( pTemp, rom, 0x800000 );
for( j = 0; j < 0x800000 / 4; j++ ) {
ofst =  BITSWAP24( (j & 0x1fffff), 0x17, 0x16, 0x15, 0x04, 0x0b, 0x0e, 0x08, 0x0c,
                                               0x10, 0x00, 0x0a, 0x13, 0x03, 0x06, 0x02, 0x07,
                                               0x0d, 0x01, 0x11, 0x09, 0x14, 0x0f, 0x12, 0x05 );
ofst ^= 0x0c8923;
ofst += (j & 0xffe00000);
memcpy( &rom[ j * 4 ], &pTemp[ ofst * 4 ], 0x04 );
}
}
free( pTemp );
}


Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
Re: SVC Chaos driver infos.
« Reply #79 on: June 27, 2005, 10:17:37 PM »
Here's the extra C decryption code for SVC.  but with a small modification:
- I've managed to make it so that this code only takes 8MB of ram instead of
the 64 MB it use to take.  Enjoy ;)

Code: [Select]
// Original MAME by HalRIN - http://www52.tok2.com/home/foge/
// Ported to FBA and modified by IQ_132 - http://neosource.1emu.net/
// SvC Chaos: SNK vs CAPCOM C-ROM decryption (Version 2, Low RAM)
void svcchaos_cx_decrypt(unsigned char* src)
{
int i, j, ofst;
const unsigned char xor1[ 4 ] = {0x34, 0x21, 0xc4, 0xe9,};
unsigned char *pTemp = (unsigned char*)malloc( 0x800000 );

for (i = 0; i < 8; i++)
{
unsigned char *rom = src+i*0x800000;

for( j = 0; j < 0x800000; j++ ) {
rom[ j ] ^= xor1[ (j % 4) ];
}

for( j = 0; j < 0x800000; j += 4 ) {
UINT32 *rom32 = (UINT32*)&rom[ j ];
*rom32 = BITSWAP32( *rom32, 0x09, 0x0d, 0x13, 0x00, 0x17, 0x0f, 0x03, 0x05,
    0x04, 0x0c, 0x11, 0x1e, 0x12, 0x15, 0x0b, 0x06,
    0x1b, 0x0a, 0x1a, 0x1c, 0x14, 0x02, 0x0e, 0x1d,
    0x18, 0x08, 0x01, 0x10, 0x19, 0x1f, 0x07, 0x16 );
}

memcpy( pTemp, rom, 0x800000 );
for( j = 0; j < 0x800000 / 4; j++ ) {
ofst =  BITSWAP24( (j & 0x1fffff), 0x17, 0x16, 0x15, 0x04, 0x0b, 0x0e, 0x08, 0x0c,
                                               0x10, 0x00, 0x0a, 0x13, 0x03, 0x06, 0x02, 0x07,
                                               0x0d, 0x01, 0x11, 0x09, 0x14, 0x0f, 0x12, 0x05 );
ofst ^= 0x0c8923;
ofst += (j & 0xffe00000);
memcpy( &rom[ j * 4 ], &pTemp[ ofst * 4 ], 0x04 );
}
}
free( pTemp );
}
Hey!! thanks a lot :)
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 Cookie Monstruo

  • Newbies
  • *
  • Posts: 17
  • Karma: +0/-0
Re: SVC Chaos driver infos.
« Reply #80 on: July 25, 2005, 06:17:47 PM »
sorry for the evil bump, but is there a patch to change 269-m1d (fd602218) to 269-m1d (d193b4fa)?

Offline iq_132

  • Administrator
  • *****
  • Posts: 3724
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: SVC Chaos driver infos.
« Reply #81 on: January 04, 2006, 11:27:30 PM »
I've modified halrin's svcboot cx code a little, it's now low-ram (only 0x800 bytes [2kb] of ram is needed for decryption),
and the code is very short.  Also, it will work for cthd2003, matrimbl, and svcboot

DoPerm(0); // cthd2003, matrimbl
DoPerm(1); // svcboot

Code: [Select]
void DoPerm(int g) // 0 - cthd2003, 1 - svcboot
{
unsigned int idx[2][ 0x10 ] = {
{0,1,2,3,3,4,4,5,0,1,2,3,3,4,4,5}, // cthd2003
{0,1,0,1,2,3,2,3,3,4,3,4,4,5,4,5}, // svcboot
};

unsigned int tbl[ 6 ][ 4 ] = {
{ 3, 0, 1, 2 },
{ 2, 3, 0, 1 },
{ 1, 2, 3, 0 },
{ 0, 1, 2, 3 },
{ 3, 2, 1, 0 },
{ 3, 0, 2, 1 },
};

unsigned char dst[0x800];

for(int i = 0; i < 0x8000; i++)
{
for(int j = 0; j < 16; j++)
{
unsigned int *b = tbl[ idx[g][(i>>(5-g))&0xF] ];
int ofst = BITSWAP08(j, 7, 6, 5, 4, b[3], b[2], b[1], b[0] );
memcpy( dst + j * 0x80, NeoSpriteROM + (i * 0x800) + ofst * 0x80, 0x80 );
}
memcpy (NeoSpriteROM + i * 0x800, dst, 0x800);
}
}
« Last Edit: January 04, 2006, 11:49:49 PM by JiMMy_PaGe »


Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: SVC Chaos driver infos.
« Reply #82 on: January 06, 2006, 01:11:08 AM »
hehe I seen an edit in IQ's post . Must of been for  matrimbl :)
IQ Forum Member

Offline iq_132

  • Administrator
  • *****
  • Posts: 3724
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: SVC Chaos driver infos.
« Reply #83 on: January 06, 2006, 01:38:10 AM »
lol, yeah.  I had //cthd2003, svcboot before.


Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: SVC Chaos driver infos.
« Reply #84 on: January 06, 2006, 09:41:55 PM »
Just so you know that code works well in Mame :)
IQ Forum Member

Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
Re: SVC Chaos driver infos.
« Reply #85 on: February 21, 2006, 10:37:21 AM »
Svc jumper support (Region change)
firts of all make sure svcpcb IS NOT a clone of neogeo (remove "neogeo" form the strict burndriver)
then add this rom info and dipswitches:
Code: [Select]
static struct BurnDIPInfo PCB269DIPList[] = {
// Offset
{0x19, 0xF0, 0x00, 0x00, NULL},

// Defaults
{0x00, 0xFF, 0xFF, 0x00, NULL},
{0x01, 0xFF, 0x7F, 0x00, NULL},
// Fake DIPs
{0x02, 0xFF, 0xFF, 0x86, NULL},

{0, 0xFE, 0, 2,   "Autofire"},
{0x0D, 0x01, 0x04, 0x00, "Off"},
{0x0D, 0x01, 0x04, 0x04, "On"},

// DIP 1
{0, 0xFE, 0, 2,   "Setting mode"},
{0x00, 0x01, 0x01, 0x00, "Off"},
{0x00, 0x01, 0x01, 0x01, "On"},

// 1 or 2 coin slots
{0, 0xFE, 0, 2,   "Coin chutes"},
{0x00, 0x02, 0x02, 0x00, "1"},
{0x02, 0x00, 0x3F, 0x06, NULL},
{0x00, 0x02, 0x02, 0x02, "2"},
{0x02, 0x00, 0x3F, 0x06, NULL},
// 2 or 4 coin slots
{0, 0xFE, 0, 2,   "Coin chutes"},
{0x00, 0x82, 0x02, 0x00, "2"},
{0x02, 0x00, 0x3F, 0x06, NULL},
{0x00, 0x82, 0x02, 0x02, "4"},
{0x02, 0x00, 0x3F, 0x06, NULL},

{0, 0xFE, 0, 5,   "Commmunicaton"},
{0x00, 0x01, 0x38, 0x00, "Disabled"},
{0x00, 0x01, 0x38, 0x08, "Setting 1"},
{0x00, 0x01, 0x38, 0x10, "Setting 2"},
{0x00, 0x01, 0x38, 0x18, "Setting 3"},
{0x00, 0x01, 0x38, 0x20, "Setting 4"},
{0x00, 0x01, 0x38, 0x28, "Setting 5"},
{0x00, 0x01, 0x38, 0x30, "Setting 6"},
{0x00, 0x01, 0x38, 0x38, "Setting 7"},
{0, 0xFE, 0, 2,   "Free play"},
{0x00, 0x01, 0x40, 0x00, "Off"},
{0x00, 0x01, 0x40, 0x40, "On"},
{0, 0xFE, 0, 2,   "Stop mode"},
{0x00, 0x01, 0x80, 0x00, "Off"},
{0x00, 0x01, 0x80, 0x80, "On"},

// Region
{0, 0xFD, 0, 2,   "Region"},
{0x02, 0x02, 0x03, 0x02, "Asia / Europe"},
{0x02, 0x00, 0x30, 0x00, NULL},
{0x02, 0x02, 0x03, 0x03, "Japan"},
{0x02, 0x00, 0x30, 0x00, NULL},
};

STDDIPINFO(PCB269);

static struct BurnRomInfo PCB269RomDesc[] = {
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },

{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "269-bios.bin",   0x080000, 0xb4590283, BRF_BIOS },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },

{ "sm1.sm1",        0x020000, 0x97Cf998B, BRF_ESS | BRF_PRG | BRF_BIOS }, // 10 Z80 program
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },

{ "sfix.sfx",       0x020000, 0x354029FC, BRF_GRA | BRF_BIOS }, // 14 Text layer tiles
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },

{ "000-lo.lo",      0x010000, 0xE09E253C, BRF_ESS | BRF_PRG | BRF_BIOS }, // 18 Zoom table
};


STD_ROM_PICK(PCB269);
STD_ROM_FN(PCB269);

// SvC Chaos - SNK vs CAPCOM (PCB board)

static struct BurnRomInfo svcpcbRomDesc[] = {
{ "269-p1.bin", 0x2000000, 0x432CFDFC, 1 | BRF_ESS | BRF_PRG }, // 0 68K code

{ "269-c1.bin", 0x2000000, 0x1B608F9C, 3 | BRF_GRA }, // 1 Sprite data
{ "269-c2.bin", 0x2000000, 0x5A95F294, 3 | BRF_GRA }, // 2

{ "269-m1_decrypted.bin", 0x020000, 0x447b3123, 4 | BRF_ESS | BRF_PRG }, // 3 Z80 code (decrypted)
{ "269-m1.bin",  0x020000, 0x7d337756, 0 | BRF_PRG | BRF_OPT }, // 4 Z80 code

// This uses Neo-PCM2 PLAYMORE(c) 2002 Protection chip
{ "269-v1.bin",  0x800000, 0xC659B34C, 5 | BRF_SND }, // 5 Sound data
{ "269-v2.bin",  0x800000, 0xDD903835, 5 | BRF_SND }, // 6
};

STDROMPICKEXT(svcpcb, svcpcb, PCB269); // note rominfo
STD_ROM_FN(svcpcb);

// Your personal inits should be placed here

struct BurnDriver BurnDrvsvcpcb = {
"svcpcb", NULL, NULL, "2003", // boardrom is NULL because it NOT a neogeo cart
"SvC Chaos - SNK vs CAPCOM (JAMMA PCB)\0", "PCB Custom board / Asia / Japan", "Capcom / Playmore Corporation", "Neo Geo",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_ENCRYPTED_B | HARDWARE_SNK_ALTERNATE_TEXT | HARDWARE_SNK_PCB_BIOS,
NULL, svcpcbRomInfo, svcpcbRomName, neogeoInputInfo, PCB269DIPInfo,
svcpcbInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};
now in neo run.cpp (get sure befor that your'e loading 269-bios.bin in the place #10 (HEX #0x0A)
add this in int neogeoReset after NeoLoad68KBIOS...
Code: [Select]
// Does this is tied directly to the harddip or there's a bankswitch somewhere?
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) == HARDWARE_SNK_PCB_BIOS) {
if (!strcmp(BurnDrvGetTextA(DRV_NAME), "svcpcb") || !strcmp(BurnDrvGetTextA(DRV_NAME), "svcpcbn")) {
int harddip3 = (NeoSystem & 0x03)&1;
switch (NeoSystem & 0x03) {
case 0x02:
case 0x03:
memcpy(Neo68KBIOS, Neo68KBIOS + 0x20000 + harddip3 * 0x20000, 0x20000);
break;
}
}
}
and you're done if you already added Cx decryption routines provided by IQ_132
see ya!!!!!! :D

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: 3724
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: SVC Chaos driver infos.
« Reply #86 on: February 26, 2006, 02:22:43 AM »
Ah, just saw this. Nice work Ferch :)


Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
Re: SVC Chaos driver infos.
« Reply #87 on: February 26, 2006, 08:05:07 PM »
Thanks man!! :D seems that there's not too much movement here... :( where's the people?
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 Death Metal

  • Member
  • ***
  • Posts: 121
  • Karma: +3/-0
  • Crimson Blade
Re: SVC Chaos driver infos.
« Reply #88 on: February 26, 2006, 10:09:22 PM »
Thanks man!! :D seems that there's not too much movement here... :( where's the people?
See ya!!!!!!! :biggrin:
True. I guess there's not been much to discuss lately. I wish we could come up with new features for the emu too, instead of just new drivers (even though you guys are certainly doing great on that departament). I would like to be able to implement more stuff, like introduce it to emulation of new chips (so that the remaining Cave drivers could be added), and perhaps other cool stuff too, but all I can do is a little something here or there, nothing big. :redface: And even though it's an open-source project, not too many people/programmers seem to be interested in working on it, which is a real shame.
« Last Edit: February 26, 2006, 10:11:08 PM by Death Metal »

Offline Shoometsu

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
  • I finally have an avatar XD
Re: SVC Chaos driver infos.
« Reply #89 on: February 27, 2006, 08:50:48 PM »
burn.h

add after:

Code: [Select]
#define HARDWARE_SNK_ALTERNATE_TEXT (0x0080) // KOF2000 text layer banks
#define HARDWARE_SNK_SMA_PROTECTION (0x0100) // SMA protection
#define HARDWARE_SNK_CUSTOM_BANKING (0x0200) // Uses custom banking

this:

Code: [Select]
#define HARDWARE_SNK_PCB_BIOS (0x0400) // Uses PCB BIOS

or else you'll have some comp problems...

edit

fecho, please help me: with this code the game only stays rebooting all the time...
« Last Edit: February 28, 2006, 08:13:50 PM by Shoometsu »
<- Who are you?