Author Topic: Help need with some MAME code.  (Read 9252 times)

Offline Ashura-X

  • Member
  • ***
  • Posts: 138
  • Karma: +0/-0
Help need with some MAME code.
« on: January 09, 2011, 08:30:20 AM »
Hi guys. On last MAME update some code was modified and I need some expert C to help me to solve it.
Follow up my old source:

Code: [Select]
static DRIVER_INIT( rotdnd )
{
neogeo_state *state = machine->driver_data<neogeo_state>();

int i;
        //extern int neogeo_fixed_layer_bank_type;
//int tx_size = machine->region("maincpu")->base();

        //int rom_size = machine->region(machine, "gfx3");

//unsigned char *src = machine->region("maincpu")->base();

//UINT8 *src = memory_region(machine, "gfx3")+rom_size-tx_size;
//UINT8 *dst = memory_region(machine, "gfx1");
        state->fixed_layer_bank_type = 1;

// for (i = 0;i < tx_size;i++)
// dst[i] = src[(i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];

//DRIVER_INIT_CALL(neogeo);
driver_init_neogeo(machine);
}

Code: [Select]
static DRIVER_INIT( mslug5nd )
{
/* the S data comes from the end fo the C data */
{
//int i;
//int tx_size = memory_region_length(machine, "gfx1");
//int rom_size = memory_region_length(machine, "gfx3");

//UINT8 *src = memory_region(machine, "gfx3")+rom_size-tx_size;
//UINT8 *dst = memory_region(machine, "gfx1");

// for (i = 0;i < tx_size;i++)
// dst[i] = src[(i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];
}
//DRIVER_INIT_CALL(neogeo);
driver_init_neogeo(machine);
}

Code: [Select]
static DRIVER_INIT( svcplusb )
{
       
int i;
/* Descrambling 512k S1 */
unsigned int sec2[]={0x60000,0x40000,0x20000,0x00000};
//UINT8 *srom = (memory_region(machine, "gfx1"));
//UINT8 *dst2 = (memory_region(machine, "0x80000"));
// if (dst2)
// {
// memcpy( dst2, srom, 0x80000 );
// for ( i=0; i<4; ++i )
// {
// memcpy( srom+i*0x20000, dst2+sec2[i], 0x20000 );
// }
// }
// free(dst2);

//DRIVER_INIT_CALL(neogeo);
driver_init_neogeo(machine);
//neogeo_state *state = machine->driver_data<neogeo_state>();
//state->fixed_layer_bank_type = 2;
}

Code: [Select]
static DRIVER_INIT( kof2k3br )
{
int i;
//extern int neogeo_fixed_layer_bank_type;
//int tx_size = machine->region(machine, "gfx1");
//int rom_size = machine->region(machine, "gfx3");
//UINT8 *src = machine->region(machine, "gfx3")+rom_size-tx_size;
//UINT8 *dst = machine->region(machine, "gfx1");
//state->fixed_layer_bank_type = 2;
//neogeo_state *state = machine->driver_data<neogeo_state>();

// for (i = 0;i < tx_size;i++)
// dst[i] = src[(i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];

//DRIVER_INIT_CALL(neogeo);
driver_init_neogeo(machine);
}

Code: [Select]
static DRIVER_INIT( kof10thu )
{
//UINT8 *rom = memory_region( machine, "maincpu" );
//UINT8 *pTemp = (UINT8 *)malloc( 0x800000 );

// int nBank[] =  { 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x07, };
// int i, ofst;

// for( i = 0; i < 0x800000 / 0x100000; i++ ) {
// memcpy( &pTemp[ i * 0x100000 ], &rom[ nBank[ i ] * 0x100000 ], 0x100000 );
// }
//
// for( i = 0; i < 0x800000 / 2; i++ ){
// ofst = BITSWAP8( (i & 0x0000ff), 7, 6, 2, 3, 4, 5, 0, 1 );
// ofst += (i & 0xffff00);
//
// memcpy( &rom[ ofst * 2 ], &pTemp[ i * 2 ], 0x02 );
// }
// free( pTemp );

// svcsplus_sx_decrypt();

// DRIVER_INIT_CALL(neogeo);
driver_init_neogeo(machine);
}

Code: [Select]
static DRIVER_INIT( kof2knd )
{

int i;
extern int neogeo_fixed_layer_bank_type;
//int tx_size = memory_region_length(machine, "gfx1");
//int rom_size = memory_region_length(machine, "gfx3");
//UINT8 *src = memory_region(machine, "gfx3")+rom_size-tx_size;
//UINT8 *dst = memory_region(machine, "gfx1");

// for (i = 0;i < tx_size;i++)
// dst[i] = src[(i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];


//DRIVER_INIT_CALL(neogeo);
driver_init_neogeo(machine);
}

Code: [Select]
static DRIVER_INIT( kof96rm )
{
// Change CLR.W to CLR.B. Is this a bug in the 68k
// emulation of MAME or that of every other emulator?
//memory_region(machine, "maincpu")[0x8CE4] = 0x2d;

//DRIVER_INIT_CALL(neogeo);
driver_init_neogeo(machine);
}

Code: [Select]
DRIVER_INIT( ms5boot )
{
//neogeo_bootleg_text_decrypt(machine, 1);
//DRIVER_INIT_CALL(neogeo);
driver_init_neogeo(machine);
ms5boot_install_protection(machine);
}

Thx for your efforts.  :biggrin:

Offline iq_132

  • Administrator
  • *****
  • Posts: 3728
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: Help need with some MAME code.
« Reply #1 on: January 09, 2011, 06:59:46 PM »
Try these -- I absolutely have not compiled or tested these, so feel free to let me know of any errors.
Code: [Select]

static void extract_neogeo_fix_data(void)
{
int i;
int tx_size = machine->region("fixed")->bytes();
        int rom_size = machine->region("sprites")->bytes();

UINT8 *src = machine->region( "sprites" )->base()+rom_size-tx_size;
UINT8 *dst = machine->region( "fixed" )->base();

for (i = 0;i < tx_size;i++)
dst[i] = src[(i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];
}

static DRIVER_INIT( rotdnd )
{
neogeo_state *state = machine->driver_data<neogeo_state>();

        state->fixed_layer_bank_type = 1;

extract_neogeo_fix_data();

DRIVER_INIT_CALL(neogeo);
}

static DRIVER_INIT( mslug5nd )
{
extract_neogeo_fix_data();

DRIVER_INIT_CALL(neogeo);
}

static DRIVER_INIT( svcplusb )
{
neogeo_state *state = machine->driver_data<neogeo_state>();

int i;
/* Descrambling 512k S1 */
unsigned int sec2[]={0x60000,0x40000,0x20000,0x00000};
UINT8 *srom = machine->region( "fixed" )->base();
UINT8 *dst2 = auto_alloc_array(machine, UINT8,  0x80000 );
if (dst2)
{
memcpy( dst2, srom, 0x80000 );
for ( i=0; i<4; ++i )
{
memcpy( srom+i*0x20000, dst2+sec2[i], 0x20000 );
}
}
free(dst2);

DRIVER_INIT_CALL(neogeo);

state->fixed_layer_bank_type = 2;
}

static DRIVER_INIT( kof2k3br )
{
neogeo_state *state = machine->driver_data<neogeo_state>();
state->fixed_layer_bank_type = 2;

extract_neogeo_fix_data();

DRIVER_INIT_CALL(neogeo);
}

static DRIVER_INIT( kof10thu )
{
UINT8 *rom = machine->region( "maincpu" )->base();
UINT8 *pTemp = auto_alloc_array(machine, UINT8,  0x800000 );

int nBank[] =  { 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x07, };
int i, ofst;

for( i = 0; i < 0x800000 / 0x100000; i++ ) {
memcpy( &pTemp[ i * 0x100000 ], &rom[ nBank[ i ] * 0x100000 ], 0x100000 );
}

for( i = 0; i < 0x800000 / 2; i++ ){
ofst = BITSWAP8( (i & 0x0000ff), 7, 6, 2, 3, 4, 5, 0, 1 );
ofst += (i & 0xffff00);

memcpy( &rom[ ofst * 2 ], &pTemp[ i * 2 ], 0x02 );
}
free( pTemp );

svcsplus_sx_decrypt();

DRIVER_INIT_CALL(neogeo);
}

static DRIVER_INIT( kof2knd )
{
extract_neogeo_fix_data();

DRIVER_INIT_CALL(neogeo);
}

static DRIVER_INIT( kof96rm )
{
// Change CLR.W to CLR.B. Is this a bug in the 68k
// emulation of MAME or that of every other emulator?
machine->region( "maincpu" )->base()[0x8CE4] = 0x2d;

DRIVER_INIT_CALL(neogeo);
}

DRIVER_INIT( ms5boot )
{
//neogeo_bootleg_text_decrypt(machine, 1);   // ????
DRIVER_INIT_CALL(neogeo);
ms5boot_install_protection(machine);
}


Offline Ashura-X

  • Member
  • ***
  • Posts: 138
  • Karma: +0/-0
Re: Help need with some MAME code.
« Reply #2 on: January 10, 2011, 04:48:07 PM »
Well that gimme an error there:

Code: [Select]
D:\emul\mame\compile>make
Compiling src/mame/drivers/neogeo.c...
In file included from src/mame/drivers/neogeo.c:1401:
src/mame/drivers/neodrvr.c: In function 'void extract_neogeo_fix_data()':
src/mame/drivers/neodrvr.c:14659: error: 'machine' was not declared in this scope
src/mame/includes/neogeo.h: In function 'void driver_init_kof10thu(running_machine*)':
src/mame/includes/neogeo.h:228: error: too few arguments to function 'void svcsplus_sx_decrypt(running_machine*)'
src/mame/drivers/neodrvr.c:14765: error: at this point in file

I have more 2 codes on neoboot.c too:

Code: [Select]
void samsh5bl_cx_decrypt( running_machine *machine )
{
// int cx_size = machine->region( machine, "sprites" );
// UINT8 *rom = machine->region( machine, "sprites" );
// UINT8 *buf = machine->region( machine, "cx_size" );
// int i;

// memcpy( buf, rom, cx_size );

// for( i = 0; i < cx_size / 0x40; i++ ) {
// memcpy( &rom[ i * 0x40 ], &buf[ (i ^ 1) * 0x40 ], 0x40 );
// }
// free( buf );
}

void svcsplus_sx_decrypt( running_machine *machine )
{
   int i;
   UINT8 *rom = machine->region( REGION_GFX1 );
   for( i = 0; i < 0x20000; i++)
      rom[i] = BITSWAP8(rom[i], 7, 6, 0, 4, 3, 2, 1, 5);
}
« Last Edit: January 10, 2011, 04:50:47 PM by Ashura-X »

Offline iq_132

  • Administrator
  • *****
  • Posts: 3728
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: Help need with some MAME code.
« Reply #3 on: January 12, 2011, 04:33:27 PM »
Oopsie. Forgot to pass "machine" to the function

Code: [Select]
static void extract_neogeo_fix_data(running_machine *machine)
{
int i;
int tx_size = machine->region("fixed")->bytes();
  int rom_size = machine->region("sprites")->bytes();

UINT8 *src = machine->region( "sprites" )->base()+rom_size-tx_size;
UINT8 *dst = machine->region( "fixed" )->base();

for (i = 0;i < tx_size;i++)
dst[i] = src[(i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];
}

static DRIVER_INIT( rotdnd )
{
neogeo_state *state = machine->driver_data<neogeo_state>();

state->fixed_layer_bank_type = 1;

extract_neogeo_fix_data(machine);

DRIVER_INIT_CALL(neogeo);
}

static DRIVER_INIT( mslug5nd )
{
extract_neogeo_fix_data(machine);

DRIVER_INIT_CALL(neogeo);
}

static DRIVER_INIT( svcplusb )
{
neogeo_state *state = machine->driver_data<neogeo_state>();

int i;
/* Descrambling 512k S1 */
unsigned int sec2[]={0x60000,0x40000,0x20000,0x00000};
UINT8 *srom = machine->region( "fixed" )->base();
UINT8 *dst2 = auto_alloc_array(machine, UINT8,  0x80000 );
if (dst2)
{
memcpy( dst2, srom, 0x80000 );
for ( i=0; i<4; ++i )
{
memcpy( srom+i*0x20000, dst2+sec2[i], 0x20000 );
}
}
free(dst2);

DRIVER_INIT_CALL(neogeo);

state->fixed_layer_bank_type = 2;
}

static DRIVER_INIT( kof2k3br )
{
neogeo_state *state = machine->driver_data<neogeo_state>();
state->fixed_layer_bank_type = 2;

extract_neogeo_fix_data(machine);

DRIVER_INIT_CALL(neogeo);
}

static DRIVER_INIT( kof10thu )
{
UINT8 *rom = machine->region( "maincpu" )->base();
UINT8 *pTemp = auto_alloc_array(machine, UINT8,  0x800000 );

int nBank[] =  { 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x07, };
int i, ofst;

for( i = 0; i < 0x800000 / 0x100000; i++ ) {
memcpy( &pTemp[ i * 0x100000 ], &rom[ nBank[ i ] * 0x100000 ], 0x100000 );
}

for( i = 0; i < 0x800000 / 2; i++ ){
ofst = BITSWAP8( (i & 0x0000ff), 7, 6, 2, 3, 4, 5, 0, 1 );
ofst += (i & 0xffff00);

memcpy( &rom[ ofst * 2 ], &pTemp[ i * 2 ], 0x02 );
}
free( pTemp );

svcsplus_sx_decrypt(machine);

DRIVER_INIT_CALL(neogeo);
}

static DRIVER_INIT( kof2knd )
{
extract_neogeo_fix_data(machine);

DRIVER_INIT_CALL(neogeo);
}

static DRIVER_INIT( kof96rm )
{
// Change CLR.W to CLR.B. Is this a bug in the 68k
// emulation of MAME or that of every other emulator?
machine->region( "maincpu" )->base()[0x8CE4] = 0x2d;

DRIVER_INIT_CALL(neogeo);
}

DRIVER_INIT( ms5boot )
{
//neogeo_bootleg_text_decrypt(machine, 1); // ????
DRIVER_INIT_CALL(neogeo);
ms5boot_install_protection(machine);
}

void samsh5bl_cx_decrypt( running_machine *machine )
{
int cx_size = machine->region( "sprites" )->bytes();
UINT8 *rom = machine->region( "sprites" )->base();
UINT8 *buf = auto_alloc_array(machine, UINT8, cx_size );
int i;

memcpy( buf, rom, cx_size );

for( i = 0; i < cx_size / 0x40; i++ ) {
memcpy( &rom[ i * 0x40 ], &buf[ (i ^ 1) * 0x40 ], 0x40 );
}
auto_free( machine, buf );
}

void svcsplus_sx_decrypt( running_machine *machine )
{
int i;
UINT8 *rom = machine->region( "fixed" )->base();

for( i = 0; i < 0x20000; i++)
rom[i] = BITSWAP8(rom[i], 7, 6, 0, 4, 3, 2, 1, 5);
}
« Last Edit: January 12, 2011, 04:35:40 PM by iq_132 »


Offline Ashura-X

  • Member
  • ***
  • Posts: 138
  • Karma: +0/-0
Re: Help need with some MAME code.
« Reply #4 on: January 12, 2011, 05:17:36 PM »
Thx for all efforts IQ and sorry for bore you, anyway I didn´t how to make all the code to work  :redface:

Code: [Select]
/************************ Mahjong Final Romance 2 (Bootleg) *************************
todo: emulate, not patch!
*************************************************************************************/
//void install_fr2ch_fix( running_machine *machine )
//{
// // Patch out bios call.. 0xC0056A
// *((unsigned short*)(machine->region( machine, "maincpu" ) + 0x1BF2)) = 0x4E71;
// *((unsigned short*)(machine->region( machine, "maincpu" ) + 0x1BF4)) = 0x4E71;
// *((unsigned short*)(machine->region( machine, "maincpu" ) + 0x1BF6)) = 0x4E71;
//}

//void neogeo_bootleg_text_decrypt(INT32 value)
void neogeo_bootleg_text_decrypt(running_machine *machine, int value)
{
INT32 i, ofst, size = machine->region( "fixed" )->bytes();

UINT8 *srom = machine->region( "fixed" )->base();
UINT8 *tmp = machine->region( "fixed" )->bytes();
//int sx_size = machine->region( "fixed" )->bytes();

switch (value) {
// Original code for MAME by fataku
// for kf2k1pla
case 0: {
for (i = 0; i < size; i++) {
srom[i] = BITSWAP8(srom[i], 3, 2, 4, 5, 1, 6, 0, 7);
}
  break;
}
// Original code from mame traduced by FerchogtX
// for ms5boot, svcboot, svcplusa, more
case 1: {
memcpy(tmp + 0x000000, srom + 0x010000, 0x010000);
memcpy(tmp + 0x010000, srom + 0x000000, 0x010000);
memcpy(srom, tmp, size);
break;
}
// Thanks also to HappyASR for the info
// for ms5plus, svcplus, kf2k3bl, more
case 2: {
for (i = 0; i < size; i+= 0x10) {
memcpy(tmp + i + 0, srom + i + 8, 8);
memcpy(tmp + i + 8, srom + i + 0, 8);
}
memcpy (srom, tmp, size);
break;
}
// Original code from MAME -- http://www.mame.net
// for cthd2003
case 3: {
memcpy(tmp + 0 * 0x8000, srom + 0 * 0x8000, 0x8000);
memcpy(tmp + 1 * 0x8000, srom + 2 * 0x8000, 0x8000);
memcpy(tmp + 2 * 0x8000, srom + 1 * 0x8000, 0x8000);
memcpy(tmp + 3 * 0x8000, srom + 3 * 0x8000, 0x8000);
memcpy(srom, tmp, size);
break;
}
// Original code by HalRIN
// for ct2k3sp
case 4: {
memcpy(tmp, srom, size);

for (i = 0; i < size; i++) {
ofst = BITSWAP24((i & 0x1ffff),23,22,21,20,19,18,17,3,0,1,4,2,13,14,16,15,5,6,11,10,9,8,7,12);
ofst += (i >> 17) << 17;
srom[i] = tmp[ofst];
}

memcpy(tmp, srom, size);
memcpy(srom + 0x08000, tmp + 0x10000, 0x8000);
memcpy(srom + 0x10000, tmp + 0x08000, 0x8000);
memcpy(srom + 0x28000, tmp + 0x30000, 0x8000);
memcpy(srom + 0x30000, tmp + 0x28000, 0x8000);
break;
}
// Converted by Jimmy_Page (www.neofighters.com)
// for svcsplus, kof10thu, kf2k2spr, more
case 5: {
for (i = 0; i < size; i++) {
srom[i] = BITSWAP8(srom[i], 7, 6, 0, 4, 3, 2, 1, 5);
}
break;
}
// for kof2k2bl
//case 6: {
// kof2002b_gfx_decrypt(srom, 0x20000);
// break;
//}
// for kf2k5uni
case 7: {
for(i = 0; i < size; i++) {
srom[i] = BITSWAP8(srom[i], 4, 5, 6, 7, 0, 1, 2, 3);
}
break;
}
}
free(tmp);
}

Offline Ashura-X

  • Member
  • ***
  • Posts: 138
  • Karma: +0/-0
Re: Help need with some MAME code.
« Reply #5 on: January 15, 2011, 01:11:26 PM »
Ok, ok got those code to works now and ms5boot starts like a charm :)

Code: [Select]
/************************ Mahjong Final Romance 2 (Bootleg) *************************
todo: emulate, not patch!
*************************************************************************************/
void install_fr2ch_fix( running_machine *machine )
{
// Patch out bios call.. 0xC0056A
*((unsigned short*)(machine->region( "maincpu" ) + 0x1BF2)) = 0x4E71;
*((unsigned short*)(machine->region( "maincpu" ) + 0x1BF4)) = 0x4E71;
*((unsigned short*)(machine->region( "maincpu" ) + 0x1BF6)) = 0x4E71;
}

//void neogeo_bootleg_text_decrypt(INT32 value)
void neogeo_bootleg_text_decrypt(running_machine *machine, int value)
{
int sx_size = machine->region( "fixed" )->bytes();
UINT8 *srom = machine->region( "fixed" )->base();
int i;

UINT8 *tmp = auto_alloc_array(machine, UINT8, sx_size );
memcpy( tmp, srom, sx_size );

switch (value) {
// Original code for MAME by fataku
// for kf2k1pla
case 0: {
for (i = 0; i < sx_size; i++) {
srom[i] = BITSWAP8(srom[i], 3, 2, 4, 5, 1, 6, 0, 7);
}
  break;
}
// Original code from mame traduced by FerchogtX
// for ms5boot, svcboot, svcplusa, more
case 1: {
memcpy(tmp + 0x000000, srom + 0x010000, 0x010000);
memcpy(tmp + 0x010000, srom + 0x000000, 0x010000);
memcpy(srom, tmp, sx_size);
break;
}
// Thanks also to HappyASR for the info
// for ms5plus, svcplus, kf2k3bl, more
case 2: {
for (i = 0; i < sx_size; i+= 0x10) {
memcpy(tmp + i + 0, srom + i + 8, 8);
memcpy(tmp + i + 8, srom + i + 0, 8);
}
memcpy (srom, tmp, sx_size);
break;
}
// Original code from MAME -- http://www.mame.net
// for cthd2003
case 3: {
memcpy(tmp + 0 * 0x8000, srom + 0 * 0x8000, 0x8000);
memcpy(tmp + 1 * 0x8000, srom + 2 * 0x8000, 0x8000);
memcpy(tmp + 2 * 0x8000, srom + 1 * 0x8000, 0x8000);
memcpy(tmp + 3 * 0x8000, srom + 3 * 0x8000, 0x8000);
memcpy(srom, tmp, sx_size);
break;
}
// Converted by Jimmy_Page (www.neofighters.com)
// for svcsplus, kof10thu, kf2k2spr, more
case 4: {
for (i = 0; i < sx_size; i++) {
srom[i] = BITSWAP8(srom[i], 7, 6, 0, 4, 3, 2, 1, 5);
}
break;
}
// for kf2k5uni
case 5: {
for(i = 0; i < sx_size; i++) {
srom[i] = BITSWAP8(srom[i], 4, 5, 6, 7, 0, 1, 2, 3);
}
break;
}
}
free(tmp);
}

Anyway some weird stuff doesn´t allow some games to run fine, below are the codes of those games:

Code: [Select]
ROM_START( kof2k3br ) /* Decrypted C */
        ROM_REGION( 0x800000, "maincpu", 0 )
        ROM_LOAD16_WORD_SWAP( "271-p1br.bin" , 0x000000, 0x800000, CRC(a131786e) SHA1(3754e6361063221138c95c52a3edb3e88a74048a) )
       
ROM_Y_ZOOM

/* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */
ROM_REGION( 0x80000, "fixed", 0 ) /* larger char set */
ROM_FILL( 0x000000, 0x80000, 0 )
ROM_REGION( 0x20000, "fixedbios", 0 )
ROM_LOAD( "sfix.sfix",  0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) )

//      NEO_SFIX_128K( "271br-s1.bin", CRC(f10b69b1) SHA1(518a77d29c0387d4110bb74ecb9a08a4380e8abc) )


//      NEO_BIOS_SOUND_128K( "271-m1.bin", CRC(396e17cd) SHA1(b2962aef711883402e67fcfb475265abe68e2cba) )
        NEO_BIOS_AUDIO_512K( "271-m1_decrypted.bin", CRC(0e86af8f) SHA1(769102b67bb1a699cfa5674d66cdb46ae633cb65) )

        /* decrypted */
        ROM_REGION( 0x1000000, "ymsnd", 0 )
// ROM_LOAD( "271-v1d.bin", 0x000000, 0x800000, CRC(dd6c6a85) )
// ROM_LOAD( "271-v2d.bin", 0x800000, 0x800000, CRC(0e84f8c1) )
        ROM_LOAD( "2k3-v1.bin", 0x000000, 0x400000, CRC(d2b8aa5e) SHA1(498f0556c1de56822141f8043f1ce20444f4ed0a) )
ROM_LOAD( "2k3-v2.bin", 0x400000, 0x400000, CRC(71956ee2) SHA1(a890941e60db358cf45b58909f4719f4826f3bb1) )
ROM_LOAD( "2k3-v3.bin", 0x800000, 0x400000, CRC(ddbbb199) SHA1(0eea4b064bdb8daa03c354fe0a0aa27c4c665bda) )
ROM_LOAD( "2k3-v4.bin", 0xc00000, 0x400000, CRC(01b90c4f) SHA1(387164aa1995d8c11ed939b3afbc294d86d2e27f) )
     
        NO_DELTAT_REGION

        ROM_REGION( 0x4000000, "sprites", 0 )
        ROM_LOAD16_BYTE( "2k3-c1.bin", 0x0000000, 0x800000, CRC(e42fc226) SHA1(1cd9364993e141facdcdd53ec2277df7b275d8a7) )
ROM_LOAD16_BYTE( "2k3-c2.bin", 0x0000001, 0x800000, CRC(1b5e3b58) SHA1(0eb254477a9479541291e43e415310852a0f0bed) )
ROM_LOAD16_BYTE( "2k3-c3.bin", 0x1000000, 0x800000, CRC(d334fdd9) SHA1(1efe30b4f56a55e25ab518cf6999de797b5e407c) )
ROM_LOAD16_BYTE( "2k3-c4.bin", 0x1000001, 0x800000, CRC(0d457699) SHA1(ec73d0c9fc7094d0ac6c0986a6e07cde25893e57) )
ROM_LOAD16_BYTE( "2k3-c5.bin", 0x2000000, 0x800000, CRC(8a91aae4) SHA1(802f4baacf801646be1ef686e105b2e867a6a5df) )
ROM_LOAD16_BYTE( "2k3-c6.bin", 0x2000001, 0x800000, CRC(9f8674b8) SHA1(65964f40b2227d020023fb436579927e65807dcd) )
        ROM_LOAD16_BYTE( "271-c7br.bin", 0x3000000, 0x800000, CRC(f3d81b6e) SHA1(62bf0c9d1d9f7a016d125df64c8328e01e003e43) ) /* Plane 0,1 */
        ROM_LOAD16_BYTE( "271-c8br.bin", 0x3000001, 0x800000, CRC(5310c6dc) SHA1(e9cb89392fa5604d3ac3ba58acdb1b739d1267be) ) /* Plane 2,3 */
ROM_END

Code: [Select]
static DRIVER_INIT( kof2k3br )
{
   neogeo_state *state = machine->driver_data<neogeo_state>();
   state->fixed_layer_bank_type = 2;
   extract_neogeo_fix_data(machine);
   DRIVER_INIT_CALL(neogeo);
}

Code: [Select]
ROM_START( kof10thu )
ROM_REGION( 0x800000, "maincpu", 0 )
ROM_LOAD16_WORD_SWAP( "5004-p1u.bin", 0x000000, 0x800000, CRC(dd135fb6) SHA1(4e85814a44ee9fee9760048dd6d6fd2b66521bb1) )

// NEO_SFIX_128K( "kf10-s1u.bin", CRC(7612e182) SHA1(56bf11773e1ecb80bbe8df64b58ac5dcc45754b7) )
// NEO_SFIX_128K( "5004-s1ud.bin", CRC(10de5d7c) SHA1(44f4f523a787cf3094923483b824d7795858aff6) )
NEO_SFIX_128K( "5004-s1ud.bin", CRC(b22ba74f) SHA1(3ba9e9d4b95fef9bf35f76e9d4fb6e1a36aeee5a) )

NEO_BIOS_AUDIO_128K( "kf10-m1.bin", CRC(f6fab859) SHA1(0184aa1394b9f9946d610278b53b846020dd88dc) )

ROM_REGION( 0x1000000, "ymsnd", 0 )
ROM_LOAD( "kf10-v1.bin", 0x000000, 0x800000, CRC(0fc9a58d) SHA1(9d79ef00e2c2abd9f29af5521c2fbe5798bf336f) )
ROM_LOAD( "kf10-v2.bin", 0x800000, 0x800000, CRC(b8c475a4) SHA1(10caf9c69927a223445d2c4b147864c02ce520a8) )

NO_DELTAT_REGION

ROM_REGION( 0x4000000, "sprites", 0 )
ROM_LOAD16_BYTE( "kf10-c1a.bin", 0x0000000, 0x400000, CRC(3bbc0364) SHA1(e8aa7ff82f151ce1db56f259377b64cceef85af0) ) /* Plane 0,1 */
ROM_LOAD16_BYTE( "kf10-c2a.bin", 0x0000001, 0x400000, CRC(91230075) SHA1(d9098e05a7ba6008661147b6bf8bc2f494b8b72b) ) /* Plane 2,3 */
ROM_LOAD16_BYTE( "kf10-c1b.bin", 0x0800000, 0x400000, CRC(b5abfc28) SHA1(eabf60992bb3485c95330065294071ec155bfe7c) ) /* Plane 0,1 */
ROM_LOAD16_BYTE( "kf10-c2b.bin", 0x0800001, 0x400000, CRC(6cc4c6e1) SHA1(be824a944e745ee18efdc45c81fd496a4d624b9c) ) /* Plane 2,3 */
ROM_LOAD16_BYTE( "kf10-c3a.bin", 0x1000000, 0x400000, CRC(5b3d4a16) SHA1(93ac1cd7739100f8c32732644f81f2a19837b131) ) /* Plane 0,1 */
ROM_LOAD16_BYTE( "kf10-c4a.bin", 0x1000001, 0x400000, CRC(c6f3419b) SHA1(340c17a73aeb7bf8a6209f8459e6f00000075b50) ) /* Plane 2,3 */
ROM_LOAD16_BYTE( "kf10-c3b.bin", 0x1800000, 0x400000, CRC(9d2bba19) SHA1(5ebbd0af3f83a60e33c8ccb743e3d5f5a96f1273) ) /* Plane 0,1 */
ROM_LOAD16_BYTE( "kf10-c4b.bin", 0x1800001, 0x400000, CRC(5a4050cb) SHA1(8fd2291f349efa1ed5cd37ad4e273b60fe831a77) ) /* Plane 2,3 */
ROM_LOAD16_BYTE( "kf10-c5a.bin", 0x2000000, 0x400000, CRC(a289d1e1) SHA1(50c7d7ebde6e118a01036cc3e40827fcd9f0d3fd) ) /* Plane 0,1 */
ROM_LOAD16_BYTE( "kf10-c6a.bin", 0x2000001, 0x400000, CRC(e6494b5d) SHA1(18e064b9867ae0b0794065f8dbefd486620419db) ) /* Plane 2,3 */
ROM_LOAD16_BYTE( "kf10-c5b.bin", 0x2800000, 0x400000, CRC(404fff02) SHA1(56d1b32c87ea4885e49264e8b21846e465a20e1f) ) /* Plane 0,1 */
ROM_LOAD16_BYTE( "kf10-c6b.bin", 0x2800001, 0x400000, CRC(f2ccfc9e) SHA1(69db7fac7023785ab94ea711a72dbc2826cfe1a3) ) /* Plane 2,3 */
ROM_LOAD16_BYTE( "kf10-c7a.bin", 0x3000000, 0x400000, CRC(be79c5a8) SHA1(ded3c5eb3571647f50533eb682c2675372ace3fb) ) /* Plane 0,1 */
ROM_LOAD16_BYTE( "kf10-c8a.bin", 0x3000001, 0x400000, CRC(a5952ca4) SHA1(76dbb3cb45ce5a4beffa1ed29491204fc6617e42) ) /* Plane 2,3 */
ROM_LOAD16_BYTE( "kf10-c7b.bin", 0x3800000, 0x400000, CRC(3fdb3542) SHA1(7d2050752a2064cd6729f483a0da93808e2c6033) ) /* Plane 0,1 */
ROM_LOAD16_BYTE( "kf10-c8b.bin", 0x3800001, 0x400000, CRC(661b7a52) SHA1(0ae2ad2389134892f156337332b77adade3ddad1) ) /* Plane 2,3 */
ROM_END

Code: [Select]
static DRIVER_INIT( kof10thu )
{
   UINT8 *rom = machine->region( "maincpu" )->base();
   UINT8 *pTemp = auto_alloc_array(machine, UINT8,  0x800000 );

   int nBank[] =  { 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x07, };
   int i, ofst;

   for( i = 0; i < 0x800000 / 0x100000; i++ ) {
      memcpy( &pTemp[ i * 0x100000 ], &rom[ nBank[ i ] * 0x100000 ], 0x100000 );
   }

   for( i = 0; i < 0x800000 / 2; i++ ){
      ofst = BITSWAP8( (i & 0x0000ff), 7, 6, 2, 3, 4, 5, 0, 1 );
      ofst += (i & 0xffff00);

      memcpy( &rom[ ofst * 2 ], &pTemp[ i * 2 ], 0x02 );
   }
   free( pTemp );

   svcsplus_sx_decrypt(machine);
 
   DRIVER_INIT_CALL(neogeo);
}

Code: [Select]
ROM_START( kof2knd )
ROM_REGION( 0x500000, "maincpu", 0 )
ROM_LOAD16_WORD_SWAP( "257-pg1.bin",  0x000000, 0x100000, CRC(5f809dbe) SHA1(2bc233dcff5622de86d01e3b74b840c7caf12982) )
ROM_LOAD16_WORD_SWAP( "257-pg2.bin",  0x100000, 0x400000, CRC(693c2c5e) SHA1(dc9121b7369ef46596343cac055a00aec81704d4) )

ROM_Y_ZOOM

/* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */
ROM_REGION( 0x20000, "fixed", 0 )
ROM_FILL( 0x000000, 0x20000, 0 )
ROM_REGION( 0x20000, "fixedbios", 0 )
ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) )

ROM_REGION( 0x40000, "audiocrypt", 0 )
/* Encrypted, we load it here for reference and replace with decrypted ROM */
ROM_LOAD( "257-m1.bin", 0x00000, 0x40000, CRC(4b749113) SHA1(2af2361146edd0ce3966614d90165a5c1afb8de4) )
/* Decrypted */
NEO_BIOS_AUDIO_256K( "257-m1_bootleg.bin", CRC(d404db70) SHA1(8cd1f3e140a9a367de23544e76371b0491287909) )

ROM_REGION( 0x1000000, "ymsnd", 0 )
ROM_LOAD( "257-v1.bin", 0x000000, 0x400000, CRC(17cde847) SHA1(4bcc0205b70dc6d9216b29025450c9c5b08cb65d) )
ROM_LOAD( "257-v2.bin", 0x400000, 0x400000, CRC(1afb20ff) SHA1(57dfd2de058139345ff2b744a225790baaecd5a2) )
ROM_LOAD( "257-v3.bin", 0x800000, 0x400000, CRC(4605036a) SHA1(51b228a0600d38a6ec37aec4822879ec3b0ee106) )
ROM_LOAD( "257-v4.bin", 0xc00000, 0x400000, CRC(764bbd6b) SHA1(df23c09ca6cf7d0ae5e11ff16e30c159725106b3) )

NO_DELTAT_REGION

ROM_REGION( 0x4000000, "sprites", 0 )
ROM_LOAD16_BYTE( "257-c1d.bin", 0x0000000, 0x800000, CRC(abcdd424) SHA1(1d52aae8a7806d48c098c2a7a77dff6e02ac4870) ) /* Plane 0,1 */
ROM_LOAD16_BYTE( "257-c2d.bin", 0x0000001, 0x800000, CRC(cda33778) SHA1(a619740364c952c443f27ed9b7c395610f2673c7) ) /* Plane 2,3 */
ROM_LOAD16_BYTE( "257-c3d.bin", 0x1000000, 0x800000, CRC(087fb15b) SHA1(f77cb6e670cdf7709d84d770ecf28533cbfbe6de) ) /* Plane 0,1 */
ROM_LOAD16_BYTE( "257-c4d.bin", 0x1000001, 0x800000, CRC(fe9dfde4) SHA1(23750ff0c4bc084d55eea66a5cdd0ef2d6c32cdc) ) /* Plane 2,3 */
ROM_LOAD16_BYTE( "257-c5d.bin", 0x2000000, 0x800000, CRC(03ee4bf4) SHA1(8f26c5bc525a5786de8e25797e2875a1dfe527be) ) /* Plane 0,1 */
ROM_LOAD16_BYTE( "257-c6d.bin", 0x2000001, 0x800000, CRC(8599cc5b) SHA1(9a05fc12273aebfbc4ac22e88b32ae9ecd269462) ) /* Plane 2,3 */
ROM_LOAD16_BYTE( "257-c7d.bin", 0x3000000, 0x800000, CRC(71dfc3e2) SHA1(1889a8dc88993e35f9fd93ce2bee1de52995932d) ) /* Plane 0,1 */
ROM_LOAD16_BYTE( "257-c8d.bin", 0x3000001, 0x800000, CRC(0fa30e5f) SHA1(0cb7fa6b0219e1af2df9b97786c677651a78f37a) ) /* Plane 2,3 */
ROM_END

Code: [Select]
static DRIVER_INIT( kof2knd )
{
   extract_neogeo_fix_data(machine);
   DRIVER_INIT_CALL(neogeo);
}


Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: Help need with some MAME code.
« Reply #6 on: February 02, 2011, 07:23:16 AM »
Wow people still playing around with bootlegs in mame :)
IQ Forum Member

Offline Ashura-X

  • Member
  • ***
  • Posts: 138
  • Karma: +0/-0
Re: Help need with some MAME code.
« Reply #7 on: February 02, 2011, 04:04:49 PM »
Wow people still playing around with bootlegs in mame :)

Yeahh that´s still funny mainly with neogeo ones  ;p