Author Topic: How to convert this MAME code for FBA?  (Read 5726 times)

Offline lxd_bruce

  • Jr. Member
  • **
  • Posts: 75
  • Karma: +1/-0
How to convert this MAME code for FBA?
« on: September 30, 2007, 04:03:53 AM »
I want FBA to run hack games like mameppk.

here is the code for mameppk.

SRC\Emu\driver.h

Code: [Select]
#define GAMEB_HACK(YEAR,NAME,PARENT,BIOS,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS) \
extern game_driver driver_##PARENT; \
game_driver driver_##NAME = \
{ \
__FILE__, \
#PARENT, \
#NAME, \
system_bios_##BIOS, \
FULLNAME, \
#YEAR, \
COMPANY, \
construct_##MACHINE, \
ipt_##INPUT, \
driver_init_##INIT, \
rom_##PARENT, \
(MONITOR)|(FLAGS), \
NULL \
};

I don't know how to convert this MAME code for FBA, anyone can help?

Thanks in advance :wink:

Offline iq_132

  • Administrator
  • *****
  • Posts: 3724
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: How to convert this MAME code for FBA?
« Reply #1 on: October 01, 2007, 12:31:18 AM »
I'm not quite sure what you're asking.  What does this feature do exacly? 
All I see is GAMEB( redefined as GAMEB_HACK


Offline lxd_bruce

  • Jr. Member
  • **
  • Posts: 75
  • Karma: +1/-0
Re: How to convert this MAME code for FBA?
« Reply #2 on: October 01, 2007, 02:54:00 PM »
Sorry for confusing you.

Well, here is my way of adding hack drivers now. I find it inconvenient.

for example, here is a hack driver for s1945p.

Code: [Select]
// s1945pb

static struct BurnRomInfo s1945pbRomDesc[] = {
{ "254-p1.bin",   0x100000, 0xFF8EFCFF, 1 | BRF_ESS | BRF_PRG }, //  0 68K code
{ "254-p2.bin",   0x400000, 0xEFDFD4DD, 1 | BRF_ESS | BRF_PRG }, //  1

{ "254-c1d.bin",   0x800000, 0x7b6902f9, 3 | BRF_GRA }, //  2 Sprite data
{ "254-c2d.bin",   0x800000, 0x51bd4252, 3 | BRF_GRA }, //  3
{ "254-c3d.bin",   0x800000, 0xa38993e4, 3 | BRF_GRA }, //  4
{ "254-c4d.bin",   0x800000, 0xd5696530, 3 | BRF_GRA }, //  5
{ "254-c5d.bin",   0x800000, 0x28764bd6, 3 | BRF_GRA }, //  6
{ "254-c6d.bin",   0x800000, 0x9931bdf1, 3 | BRF_GRA }, //  7
{ "254-c7d.bin",   0x800000, 0x6e12afcd, 3 | BRF_GRA }, //  8
{ "254-c8d.bin",   0x800000, 0x178d4684, 3 | BRF_GRA }, //  9

{ "254-m1.bin",   0x020000, 0x994B4487, 4 | BRF_ESS | BRF_PRG }, // 10 Z80 code

{ "254-v1.bin",   0x400000, 0x844F58FB, 5 | BRF_SND }, // 11 Sound data
{ "254-v2.bin",   0x400000, 0xD9A248F0, 5 | BRF_SND }, // 12
{ "254-v3.bin",   0x400000, 0x0B0D2D33, 5 | BRF_SND }, // 13
{ "254-v4.bin",   0x400000, 0x6D13DC91, 5 | BRF_SND }, // 14
};

STDROMPICKEXT(s1945pb, s1945pb, neogeo);
STD_ROM_FN(s1945pb);

static void s1945pbCallback()
{
        unsigned char *mem8 = Neo68KROM;
        mem8[0x006CEA] = 0x3C;
        mem8[0x006CEB] = 0x10;
        mem8[0x006CEC] = 0x01;
        mem8[0x006CED] = 0x00;
        mem8[0x0074BD] = 0x60;
        mem8[0x0074E2] = 0x1A;
        mem8[0x0074E3] = 0x60;
}


static int s1945pbInit()
{

pNeoInitCallback = s1945pbCallback;

return NeoInit();
}

struct BurnDriver BurnDrvs1945pb = {
"s1945pb", "s1945p", "neogeo", "2006",
"Strikers 1945 plus (decrypted C / Ascender P55 enabled by Yumeji)\0", NULL, "hack", "Neo Geo",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SNK_NEOGEO,
NULL, s1945pbRomInfo, s1945pbRomName, neogeoInputInfo, neogeoDIPInfo,
s1945pbInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
320, 224, 4, 3
};

it works well.

however, to make it work, I can't omit the following code in which the roms are exactly the same as s1945pd (the decrypted C driver of s1945p)  .


Code: [Select]
static struct BurnRomInfo s1945pbRomDesc[] = {
{ "254-p1.bin",   0x100000, 0xFF8EFCFF, 1 | BRF_ESS | BRF_PRG }, //  0 68K code
{ "254-p2.bin",   0x400000, 0xEFDFD4DD, 1 | BRF_ESS | BRF_PRG }, //  1

{ "254-c1d.bin",   0x800000, 0x7b6902f9, 3 | BRF_GRA }, //  2 Sprite data
{ "254-c2d.bin",   0x800000, 0x51bd4252, 3 | BRF_GRA }, //  3
{ "254-c3d.bin",   0x800000, 0xa38993e4, 3 | BRF_GRA }, //  4
{ "254-c4d.bin",   0x800000, 0xd5696530, 3 | BRF_GRA }, //  5
{ "254-c5d.bin",   0x800000, 0x28764bd6, 3 | BRF_GRA }, //  6
{ "254-c6d.bin",   0x800000, 0x9931bdf1, 3 | BRF_GRA }, //  7
{ "254-c7d.bin",   0x800000, 0x6e12afcd, 3 | BRF_GRA }, //  8
{ "254-c8d.bin",   0x800000, 0x178d4684, 3 | BRF_GRA }, //  9

{ "254-m1.bin",   0x020000, 0x994B4487, 4 | BRF_ESS | BRF_PRG }, // 10 Z80 code

{ "254-v1.bin",   0x400000, 0x844F58FB, 5 | BRF_SND }, // 11 Sound data
{ "254-v2.bin",   0x400000, 0xD9A248F0, 5 | BRF_SND }, // 12
{ "254-v3.bin",   0x400000, 0x0B0D2D33, 5 | BRF_SND }, // 13
{ "254-v4.bin",   0x400000, 0x6D13DC91, 5 | BRF_SND }, // 14
};

STDROMPICKEXT(s1945pb, s1945pb, neogeo);
STD_ROM_FN(s1945pb);

In addition, to make FBA find the hack game, there are only two ways.

1. copy the decrypted C roms to the zip file of s1945p
2. copy the roms of s1945p except the original C roms to the zip file of s1945pd and rename the zip file with "s1945pb".


However, if I add the same hack driver to MAME plus! plus!, things are different.

all I need to do is just adding the following code to \src\mame\drivers\neogeo.c
Code: [Select]
DRIVER_INIT( s1945pb )
{
neogeo_fix_bank_type = 1;
neogeo_sfix_decrypt();
        UINT8 *mem8 = memory_region(REGION_CPU1);
        mem8[0x006CEA] = 0x3C;
        mem8[0x006CEB] = 0x10;
        mem8[0x006CEC] = 0x01;
        mem8[0x006CED] = 0x00;
        mem8[0x0074BD] = 0x60;
        mem8[0x0074E2] = 0x1A;
        mem8[0x0074E3] = 0x60;
driver_init_neogeo(machine);
}



GAMEB_HACK( 2006, s1945pb,   s1945pd,     neogeo, neogeo, neogeo,  s1945pb,  ROT0, "hack", "Strikers 1945 Plus (decrypted C / Ascender P55 enabled by Yumeji)", 0 )

and add
Code: [Select]
DRIVER( s1945pb ) /* 0254 (c) 1999 Psikyo */
to \src\mame\mameplusdriv.c.

I don't need to waste code to repeat the same roms.

in addition, I can keep the name of the zip file of s1945pd.

So, how to make FBA run hack drivers like MAME Plus! Plus! ?

which SRC files should I modify?

where should I modify the SRC files?

Thanks in advance, IQ. :wink:


« Last Edit: October 01, 2007, 03:01:35 PM by lxd_bruce »

Offline iq_132

  • Administrator
  • *****
  • Posts: 3724
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: How to convert this MAME code for FBA?
« Reply #3 on: October 01, 2007, 05:15:56 PM »
Ahh.  Try this.

Code: [Select]
static void s1945pbCallback()
{
        unsigned char *mem8 = Neo68KROM;
        mem8[0x006CEA] = 0x3C;
        mem8[0x006CEB] = 0x10;
        mem8[0x006CEC] = 0x01;
        mem8[0x006CED] = 0x00;
        mem8[0x0074BD] = 0x60;
        mem8[0x0074E2] = 0x1A;
        mem8[0x0074E3] = 0x60;
}

static int s1945pbInit()
{
pNeoInitCallback = s1945pbCallback;

return NeoInit();
}

static int s1945pbZipName(char **pszName, unsigned int i)
{
  if (i==0 && pszName!=NULL) { *pszName="neogeo.zip";  return 0; }
  if (i==1 && pszName!=NULL) { *pszName="s1945p.zip";  return 0; }
  if (i==2 && pszName!=NULL) { *pszName="s1945pd.zip";  return 0; }
  return 1;
}

struct BurnDriver BurnDrvs1945pb = {
"s1945pb", "s1945p", "neogeo", "2006",
"Strikers 1945 plus (decrypted C / Ascender P55 enabled by Yumeji)\0", NULL, "hack", "Neo Geo",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SNK_NEOGEO,
s1945pbZipName, s1945pdRomInfo, s1945pdRomName, neogeoInputInfo, neogeoDIPInfo,
s1945pbInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
320, 224, 4, 3
};


Offline lxd_bruce

  • Jr. Member
  • **
  • Posts: 75
  • Karma: +1/-0
Re: How to convert this MAME code for FBA?
« Reply #4 on: October 01, 2007, 09:43:27 PM »
wow, it works now, thanks IQ :cool: