Jump to content

Some Fun Fba Code :)


Recommended Posts

  • Replies 34
  • Created
  • Last Reply

Top Posters In This Topic

Actually, I figured it out already :(

 

You want to find this:

 

  if (BurnDrvGetHardwareCode() & HARDWARE_SNK_SWAPV) {
 	for (int i = 0; i < 0x00200000; i++) {
   unsigned char n = YM2610ADPCMAROM[i];
   YM2610ADPCMAROM[i] = YM2610ADPCMAROM[0x00200000 + i];
   YM2610ADPCMAROM[0x00200000 + i] = n;
 	}
 }
}

 

and put the main body of code after it ( The if (nPCM2Value != 0) part)

 

For some reason there is some code in a different place in my fba source.

Edited by iq_132
Link to comment
Share on other sites

heres my working driver for kof2002:

//	The King of Fighters 2002


static struct BurnRomInfo kof2002RomDesc[] = {
{"265-p1.bin", 0x100000, 0x9EDE7323, 0x10}, //  0 68K code
{"265-p2.bin", 0x400000, 0x327266B8, 0x10}, //  1

{"265-c1.bin", 0x800000, 0x2B65A656,    1}, //  3 Sprite data
{"265-c2.bin", 0x800000, 0xADF18983,    1}, //  4
{"265-c3.bin", 0x800000, 0x875E9FD7,    1}, //  5
{"265-c4.bin", 0x800000, 0x2DA13947,    1}, //  6
{"265-c5.bin", 0x800000, 0x61BD165D,    1}, //  7
{"265-c6.bin", 0x800000, 0x03FDD1EB,    1}, //  8
{"265-c7.bin", 0x800000, 0x1A2749D8,    1}, //  9
{"265-c8.bin", 0x800000, 0xAB0BB549,    1}, //  10

{"265-m1d.bin", 0x020000, 0xF6FAB859, 0x10}, // 11 Z80 code

{"265-v1d.bin", 0x800000, 0x0FC9A58D,    2}, //  12 Sound data
{"265-v2d.bin", 0x800000, 0xB8C475A4,    2}, //  13
}; 

STDROMPICKEXT(kof2002, kof2002, neogeo); 
STD_ROM_FN(kof2002);
static void kof2002Decrypt() // Converted to FBA code by IQ_132 (bbs.romshare.net)
{
unsigned char* src = Neo68KROM01+0x100000;
unsigned char* dst = (unsigned char*)malloc(0x400000);

int sec[] = {0x100000,0x280000,0x300000,0x180000,0x000000,0x380000,0x200000,0x080000};

if (dst)
{
 memcpy(dst,src,0x400000);

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

static int kof2002Init()
{
nNeoProtectionXor = 0xec;
pNeoInitCallback = kof2002Decrypt;

return NeoInit();

}
struct BurnDriver BurnDrvkof2002 = {

{"kof2002", "The King of Fighters 2002", "None", "SNK Playmore Corporation", "Neo Geo", "2002", NULL, "neogeo"},
BDF_GAME_WORKING, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_ENCRYPTED_B,
NULL, kof2002RomInfo, kof2002RomName, neogeoInputInfo, neogeoDIPInfo,
kof2002Init, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};

Link to comment
Share on other sites

nm, I got everything now

 

damn Iq, how come you never told me about your site? that place rules!!

 

@noobs who might be reading...no!..Iq's site does not contain roms

Link to comment
Share on other sites

Actually, I figured it out already :lol:

 

You want to find this:

 

  if (BurnDrvGetHardwareCode() & HARDWARE_SNK_SWAPV) {
 	for (int i = 0; i < 0x00200000; i++) {
   unsigned char n = YM2610ADPCMAROM[i];
   YM2610ADPCMAROM[i] = YM2610ADPCMAROM[0x00200000 + i];
   YM2610ADPCMAROM[0x00200000 + i] = n;
 	}
 }
}

 

and put the main body of code after it ( The if (nPCM2Value != 0) part)

 

For some reason there is some code in a different place in my fba source.

wait, where?

 

oh, btw, I'm getting this error

src/burn/neogeo/d_neogeo.cpp: In function `void
  cthd2003_neogeo_gfx_address_fix_do(int, int, int, int, int, int)':
src/burn/neogeo/d_neogeo.cpp:6395: warning: ISO C++ forbids comparison between
  pointer and integer
src/burn/neogeo/d_neogeo.cpp:6395: parse error before `;' token
src/burn/neogeo/d_neogeo.cpp:6415: warning: storage class `static' invalid for
  function `cthd2003_c' declared out of global scope
src/burn/neogeo/d_neogeo.cpp:6415: cannot declare static function inside
  another function
src/burn/neogeo/d_neogeo.cpp:6415: parse error before `{' token
src/burn/neogeo/d_neogeo.cpp:6418: warning: suggest parentheses around
  assignment used as truth value
src/burn/neogeo/d_neogeo.cpp:6419: `cthd2003_neogeo_gfx_address_fix' undeclared

  (first use this function)
src/burn/neogeo/d_neogeo.cpp:6419: (Each undeclared identifier is reported only

  once for each function it appears in.)
src/burn/neogeo/d_neogeo.cpp:6438: warning: storage class `static' invalid for
  function `cthd2003Decrypt' declared out of global scope
src/burn/neogeo/d_neogeo.cpp:6438: cannot declare static function inside
  another function
src/burn/neogeo/d_neogeo.cpp:6438: parse error before `{' token
src/burn/neogeo/d_neogeo.cpp:6441: `romdata' undeclared (first use this
  function)
src/burn/neogeo/d_neogeo.cpp:6458: `cthd2003_c' undeclared (first use this
  function)
src/burn/neogeo/d_neogeo.cpp: In function `int cthd2003Init()':
src/burn/neogeo/d_neogeo.cpp:6465: `cthd2003Decrypt' undeclared (first use this

  function)
src/burn/neogeo/d_neogeo.cpp: In function `int kof2003bInit()':
src/burn/neogeo/d_neogeo.cpp:6682: `kof2003bMapHandler' undeclared (first use
  this function)
make: *** [d_neogeo.o] Error 1

 

I changed the kof2003 driver to the set named "kof2003b" (b stands for bootleg) so I can identify it as being bootleg

Edited by Weirdanzeige
Link to comment
Share on other sites

// The King of Fighter's 2003 (Bootleg)

static struct BurnRomInfo kof2003bRomDesc[] = {
{"271-p1.bin"   , 0x400000, 0x92ed6ee3, 0x10}, //  0 68K code
{"271-p2.bin"	, 0x400000, 0x5d3d8bb3, 0x10}, //  1 68k code

{"271-s1.bin"   , 0x020000, 0x7c7829aa,    1}, //  2 Text layer tiles

{"271-c1d.rom"  , 0x800000, 0xe42fc226,    1}, //  3 Sprite data
{"271-c2d.rom"  , 0x800000, 0x1b5e3b58,    1}, //  4
{"271-c3d.rom"  , 0x800000, 0xd334fdd9,    1}, //  5
{"271-c4d.rom"  , 0x800000, 0x0d457699,    1}, //  6
{"271-c5d.rom"  , 0x800000, 0x8a91aae4,    1}, //  7
{"271-c6d.rom"  , 0x800000, 0x9f8674b8,    1}, //  8
{"271-c7d.rom"  , 0x800000, 0x374ea523,    1}, //  9
{"271-c8d.rom"  , 0x800000, 0x75211f4d,    1}, //  10

{"271-m1d.bin"  , 0x080000, 0x0e86af8f, 0x10}, //  11 Z80 code

{"271-v1d.rom"  , 0x400000, 0xd2b8aa5e,    2}, //  12 Sound data
{"271-v2d.rom"  , 0x400000, 0x71956ee2,    2}, //  13
{"271-v3d.rom"  , 0x400000, 0xddbbb199,    2}, //  14
{"271-v4d.rom"  , 0x400000, 0x01b90c4f,    2}, //  15
};

STDROMPICKEXT(kof2003b, kof2003b, neogeo);
STD_ROM_FN(kof2003b);

static unsigned short kof2003_tbl[0x1000];


unsigned char __fastcall kof2003ReadByteBankSwitch(unsigned int sekAddress)
{
return *(((unsigned char *)kof2003_tbl)+((sekAddress^1)-0x2fe000));
}


unsigned short __fastcall kof2003ReadWordBankSwitch(unsigned int sekAddress)
{
return kof2003_tbl[(sekAddress-0x2fe000)/2];
}

static void kof2003WriteBankSwitch(unsigned int sekAddress,unsigned short wordValue,unsigned short valueMask)
{
int address=(sekAddress-0x2fe000)/2,bankaddress;
kof2003_tbl[address]=(wordValue&valueMask)|(~valueMask&kof2003_tbl[address]);
if(address!=0xff8 && address!=0xff9 ) return;
bankaddress=(kof2003_tbl[0xff8]>>8)|(kof2003_tbl[0xff9]<<8);
*(((unsigned char *)kof2003_tbl)+0x1ff0)=0xa0;
*(((unsigned char *)kof2003_tbl)+0x1ff1)&=0xfe;
*(((unsigned char *)kof2003_tbl)+0x1ff3)&=0x7f;
SekMapMemory(Neo68KROM02+bankaddress,0x200000,0x2fdfff,SM_ROM);
Neo68KROM01[0x58196]=kof2003_tbl[0xff9]&0xff;
}


void __fastcall kof2003WriteWordBankSwitch(unsigned int sekAddress, unsigned short wordValue)
{
unsigned short valueMask=0xffff;
kof2003WriteBankSwitch(sekAddress, wordValue, valueMask);
}

void __fastcall kof2003WriteByteBankSwitch(unsigned int sekAddress, unsigned char byteValue)
{
unsigned short wordValue=0,valueMask=0xff;
if(!(sekAddress&1)) {
 wordValue=byteValue<<8;
 valueMask<<=8;
}
else{
 wordValue=byteValue;
}
kof2003WriteBankSwitch(sekAddress,wordValue,valueMask);
}

void kof2003_RomExchange()
{
memcpy(Neo68KROM01+0x100000,Neo68KROM01,0x600000) ;
memcpy(Neo68KROM01,Neo68KROM01+0x700000,0x100000) ;
memset(Neo68KROM01+0x700000,0,0x100000);
}

static void kof2003MapHandler()
{
// Install BankSwitch handler
SekMapHandler(5,	0x2fe000, 0x2fffff, SM_READ);
SekSetReadWordHandler(5,  kof2003ReadWordBankSwitch);
SekSetReadByteHandler(5,  kof2003ReadByteBankSwitch);

SekMapHandler(5,	0x2fe000, 0x2fffff, SM_WRITE);
SekSetWriteWordHandler(5, kof2003WriteWordBankSwitch);
SekSetWriteByteHandler(5, kof2003WriteByteBankSwitch);
}

static int kof2003bInit()
{
int nRet;

memset(kof2003_tbl,0,0x2000);

pNeoInitCallback=kof2003_RomExchange;

nRet=NeoInit();
if(!nRet)
 kof2003MapHandler();
return nRet;
}

struct BurnDriver BurnDrvkof2003b = {
{"kof2003b", "The King of Fighters 2003 ( Bootleg )", NULL, "SNK Playmore Corporation", "Neo Geo", "2003", NULL, "neogeo"},
BDF_GAME_WORKING, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_NEWBANKSYSTEM,
NULL, kof2003bRomInfo, kof2003bRomName, neogeoInputInfo, neogeoDIPInfo,
kof2003bInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};

Link to comment
Share on other sites

ok, nm, I fixed the kof2003 problem, but now I have a problem with ROTD

 

I did what you said to do on your site and I all I hear is that...static-ie sound...

 

how do I fix that?

 

// Rage of the Dragons

static struct BurnRomInfo rotdRomDesc[] = {
{"264-p1.bin", 0x800000, 0xb8cc969d, 0x10}, //  0 68K code

{"264-c1.bin", 0x800000, 0x4f148fee,    1}, //  1 Sprite data
{"264-c2.bin", 0x800000, 0x7cf5ff72,    1}, //  2
{"264-c3.bin", 0x800000, 0x64d84c98,    1}, //  3
{"264-c4.bin", 0x800000, 0x2f394a95,    1}, //  4
{"264-c5.bin", 0x800000, 0x6b99b978,    1}, //  5
{"264-c6.bin", 0x800000, 0x847d5c7d,    1}, //  6
{"264-c7.bin", 0x800000, 0x231d681e,    1}, //  7
{"264-c8.bin", 0x800000, 0xc5edb5c4,    1}, //  8

{"264-m1d.bin", 0x10000, 0xe5f42e7d, 0x10}, //  9 Z80 code

{"264-v1.bin", 0x800000, 0xfa005812,    2}, //  10 Sound data
{"264-v2.bin", 0x800000, 0xc3dc8bf0,    2}, //  11
}; 

STDROMPICKEXT(rotd, rotd, neogeo); 
STD_ROM_FN(rotd);

static int rotdInit()
{
nNeoProtectionXor = 0x3F;
return NeoInit();
nPCM2Value=16;
}

struct BurnDriver BurnDrvrotd = {

{"rotd", "Rage of the Dragons", NULL, "Evoga", "Neo Geo", "2002", NULL, "neogeo"},
BDF_GAME_WORKING, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_ENCRYPTED_B,
NULL, rotdRomInfo, rotdRomName, neogeoInputInfo, neogeoDIPInfo,
rotdInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};

is that where you wanted us to put the nPCM2Value=16; ?

Edited by Weirdanzeige
Link to comment
Share on other sites

ok, nm, I fixed the kof2003 problem, but now I have a problem with ROTD

 

I did what you said to do on your site and I all I hear is that...static-ie sound...

 

how do I fix that?

 

// Rage of the Dragons

static struct BurnRomInfo rotdRomDesc[] = {
{"264-p1.bin", 0x800000, 0xb8cc969d, 0x10}, //  0 68K code

{"264-c1.bin", 0x800000, 0x4f148fee,    1}, //  1 Sprite data
{"264-c2.bin", 0x800000, 0x7cf5ff72,    1}, //  2
{"264-c3.bin", 0x800000, 0x64d84c98,    1}, //  3
{"264-c4.bin", 0x800000, 0x2f394a95,    1}, //  4
{"264-c5.bin", 0x800000, 0x6b99b978,    1}, //  5
{"264-c6.bin", 0x800000, 0x847d5c7d,    1}, //  6
{"264-c7.bin", 0x800000, 0x231d681e,    1}, //  7
{"264-c8.bin", 0x800000, 0xc5edb5c4,    1}, //  8

{"264-m1d.bin", 0x10000, 0xe5f42e7d, 0x10}, //  9 Z80 code

{"264-v1.bin", 0x800000, 0xfa005812,    2}, //  10 Sound data
{"264-v2.bin", 0x800000, 0xc3dc8bf0,    2}, //  11
}; 

STDROMPICKEXT(rotd, rotd, neogeo); 
STD_ROM_FN(rotd);

static int rotdInit()
{
nNeoProtectionXor = 0x3F;
return NeoInit();
nPCM2Value=16;
}

struct BurnDriver BurnDrvrotd = {

{"rotd", "Rage of the Dragons", NULL, "Evoga", "Neo Geo", "2002", NULL, "neogeo"},
BDF_GAME_WORKING, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_ENCRYPTED_B,
NULL, rotdRomInfo, rotdRomName, neogeoInputInfo, neogeoDIPInfo,
rotdInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};

is that where you wanted us to put the nPCM2Value=16; ?

Well, here's mine. The extra code is to fix AES mode.

 

//	Rage of the Dragons (Encrypted Set)

static struct BurnRomInfo rotdRomDesc[] = {
{"264-p1.bin", 0x800000, 0xb8cc969d, 0x10}, //  0 68K code

{"264-c1.bin", 0x800000, 0x4f148fee,    1}, //  2 Sprite data
{"264-c2.bin", 0x800000, 0x7cf5ff72,    1}, //  3
{"264-c3.bin", 0x800000, 0x64d84c98,    1}, //  5
{"264-c4.bin", 0x800000, 0x2f394a95,    1}, //  6
{"264-c5.bin", 0x800000, 0x6b99b978,    1}, //  7
{"264-c6.bin", 0x800000, 0x847d5c7d,    1}, //  8
{"264-c7.bin", 0x800000, 0x231d681e,    1}, //  9
{"264-c8.bin", 0x800000, 0xc5edb5c4,    1}, //  10

{"264-m1d.bin", 0x010000, 0xe5f42e7d, 0x10}, // 11 Z80 code

{"264-v1.bin", 0x800000, 0xfa005812,    2}, //  12 Sound data
{"264-v2.bin", 0x800000, 0xc3dc8bf0,    2}, //  13
}; 

STDROMPICKEXT(rotd, rotd, neogeo); 
STD_ROM_FN(rotd);

static void rotdAESPatch() 
{ 
*((unsigned short*)(Neo68KROM01 + 0x001020)) = 0x4E71; 
*((unsigned short*)(Neo68KROM01 + 0x002400)) = 0x4E71; 
}

static int rotdInit()
{
pNeoInitCallback = rotdAESPatch;
nPCM2Value=16;
nNeoProtectionXor = 0x3F;
return NeoInit();
}

struct BurnDriver BurnDrvrotd = {

{"rotd", "Rage of the Dragons", NULL, "Evoga", "Neo Geo", "2002", NULL, "neogeo"},
BDF_GAME_WORKING, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_ENCRYPTED_B,
NULL, rotdRomInfo, rotdRomName, neogeoInputInfo, neogeoDIPInfo,
rotdInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};

Edited by iq_132
Link to comment
Share on other sites

i guess i suck badly this time. this is the 10th time that ive redone all the steps and im still getting exactly the same error i posted on the first page. any help would be appreciated. thanks in advance.

 

(edit) found a problem similar to mine solved at RomShare. nevermind :D

Edited by Xeon
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...