Welcome!

Final Burn Neo => FBN Development => Topic started by: Simone73 on February 02, 2005, 03:58:55 AM

Title: FBA v0.2.95.23 and kof2003
Post by: Simone73 on February 02, 2005, 03:58:55 AM
i'm trying to port kof2003 driver to this new version of fba but i have some doubts.

1. how can i replace the Neo68KROM01 and Neo68KROM02 const ?

2. This Code aren't int the new source

 
Code: [Select]
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) {
nNeo68KROMBank = -1U;
Bankswitch(0);
}

and i can't replace with this
Code: [Select]
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) {
if (!(BurnDrvGetHardwareCode() & HARDWARE_SNK_NEWBANKSYSTEM)) {
nNeo68KROMBank = -1U;
Bankswitch(0);
}
}


how can i fix this ?

TIA
Title: FBA v0.2.95.23 and kof2003
Post by: Shoometsu on February 02, 2005, 04:05:03 AM
Quote from: Simone73
i'm trying to port kof2003 driver to this new version of fba but i have some doubts.

1. how can i replace the Neo68KROM01 and Neo68KROM02 const ?

2. This Code aren't int the new source

 
Code: [Select]
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) {
nNeo68KROMBank = -1U;
Bankswitch(0);
}

and i can't replace with this
Code: [Select]
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) {
if (!(BurnDrvGetHardwareCode() & HARDWARE_SNK_NEWBANKSYSTEM)) {
nNeo68KROMBank = -1U;
Bankswitch(0);
}
}


how can i fix this ?

TIA

found in neo_run.cpp line 1676 but is a newer function:

Code: [Select]
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) {
SekMapMemory(Neo68KROM + nNeo68KROMBank, 0x200000, 0x2FFFFF, SM_ROM);
}

to find it just search for the 1st line ;) :

if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) {
Title: FBA v0.2.95.23 and kof2003
Post by: Simone73 on February 02, 2005, 04:15:05 AM
Quote from: Shoometsu
found in neo_run.cpp line 1676 but is a newer function:

Code: [Select]
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) {
SekMapMemory(Neo68KROM + nNeo68KROMBank, 0x200000, 0x2FFFFF, SM_ROM);
}

to find it just search for the 1st line ;) :

if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) {

yes, i have found that bat i need to replace it completely ?
Title: FBA v0.2.95.23 and kof2003
Post by: iq_132 on February 02, 2005, 11:02:08 AM
basically find this:
Code: [Select]
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) {
        SekMapMemory(Neo68KROM + nNeo68KROMBank, 0x200000, 0x2FFFFF, SM_ROM);
}


and replace it with this:
Code: [Select]
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) {
               if (!(BurnDrvGetHardwareCode() & HARDWARE_SNK_NEWBANKSYSTEM)) {
                              SekMapMemory(Neo68KROM + nNeo68KROMBank, 0x200000, 0x2FFFFF, SM_ROM);
               }
}


To answer your other question...
1. how can i replace the Neo68KROM01 and Neo68KROM02 const ?

Neo68KROM01 = Neo68KROM
Neo68KROM02 = Neo68KROM+0x100000

unsigned char *Neo68KROM01 = Neo68KROM;
unsigned char *Neo68KROM02 = Neo68KROM+0x100000;
Title: FBA v0.2.95.23 and kof2003
Post by: Simone73 on February 02, 2005, 12:59:02 PM
Quote from: iq_132


To answer your other question...
1. how can i replace the Neo68KROM01 and Neo68KROM02 const ?

Neo68KROM01 = Neo68KROM
Neo68KROM02 = Neo68KROM+0x100000

unsigned char *Neo68KROM01 = Neo68KROM;
unsigned char *Neo68KROM02 = Neo68KROM+0x100000;


tnks iq, btw its ok if put this four row in the static int ROMIndex() ?
Title: FBA v0.2.95.23 and kof2003
Post by: iq_132 on February 02, 2005, 01:11:41 PM
You don't need to.
Just put this in the top of d_neogeo.cpp and/or neo_run.cpp
unsigned char *Neo68KROM01 = Neo68KROM;
unsigned char *Neo68KROM02 = Neo68KROM+0x100000;
Title: FBA v0.2.95.23 and kof2003
Post by: Shoometsu on February 02, 2005, 01:51:13 PM
Quote from: iq_132
basically find this:
Code: [Select]
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) {
        SekMapMemory(Neo68KROM + nNeo68KROMBank, 0x200000, 0x2FFFFF, SM_ROM);
}


and replace it with this:
Code: [Select]
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) {
               if (!(BurnDrvGetHardwareCode() & HARDWARE_SNK_NEWBANKSYSTEM)) {
                              SekMapMemory(Neo68KROM + nNeo68KROMBank, 0x200000, 0x2FFFFF, SM_ROM);
               }
}


is there a problem if I use the old code? works fine here anyway, but I don't know if would have problems with other sets but kof2003
Title: FBA v0.2.95.23 and kof2003
Post by: Simone73 on February 02, 2005, 01:55:41 PM
i can compile now but i have got a guru meditation...

iq, im sorry but you can check my neogeo drivers ?

plz help me

TIA
Title: FBA v0.2.95.23 and kof2003
Post by: James33 on February 02, 2005, 09:15:40 PM
Have you added drivers to FBA before ?  I do not wish to offend but your source is a mess .
Title: FBA v0.2.95.23 and kof2003
Post by: Simone73 on February 03, 2005, 02:04:45 AM
Quote from: James33
Have you added drivers to FBA before ?  I do not wish to offend but your source is a mess .

I don't understand this term 'mess' becouse of my poor english, btw, yes i have poor knowledge of FBA and general programming too!

James: I do not wish to offend but yours is not an usefull post for me, sorry! if you can, plz help me!

James: The driver for kof2003 is the one from iq!
Title: FBA v0.2.95.23 and kof2003
Post by: Xeon on February 03, 2005, 06:48:54 AM
Quote from: Simone73
I don't understand this term 'mess' becouse of my poor english, btw, yes i have poor knowledge of FBA and general programming too!

James: I do not wish to offend but yours is not an usefull post for me, sorry! if you can, plz help me!

James: The driver for kof2003 is the one from iq!


he only mean your sources are hard to understand because of the lack of formatting, it simply means he did look at your codes to see if he can help you. oh and btw, more than 75% of people compiling emulators have zero clue on programming in general.

just because you didnt receive the reply you expected doesnt mean he didnt even try.
Title: FBA v0.2.95.23 and kof2003
Post by: James33 on February 03, 2005, 09:40:27 AM
I have to choose my words better . By looking at your source it looks like you have code that should not be in d_neogeo  . I have not tried to add games to the new version yet (But I will soon ) Once I get it working I will post full info here  Thats unless someone has already done it .
Title: FBA v0.2.95.23 and kof2003
Post by: Xeon on February 03, 2005, 09:44:53 AM
Quote from: James33
I have to choose my words better . By looking at your source it looks like you have code that should not be in d_neogeo  . I have not tried to add games to the new version yet (But I will soon ) Once I get it working I will post full info here  Thats unless someone has already done it .

 no wonder i didnt actually thought the formatting as that bad (in fact, its still normally readable), i thought it was something on your end :P
Title: FBA v0.2.95.23 and kof2003
Post by: James33 on February 03, 2005, 09:51:09 PM
readable yes  And thats why I say code is in the wrong places
Title: FBA v0.2.95.23 and kof2003
Post by: Shoometsu on February 04, 2005, 06:38:04 PM
this driver works fine here, only add the functions listed in the 1st kof2003 tutorial ;)

notes: I'm using the large k2k3fix.cpp (478 kb) also attemp to the function's names. If u compare with the original PCB driver you should see the name's differences, renaming it correctly according to your source:

Code: [Select]
// The King of Fighters 2003

static struct BurnRomInfo kof2003RomDesc[] = {
{ "271-p1.bin",   0x400000, 0xb9da070c, 1 | BRF_ESS | BRF_PRG }, //  0 68K code
{ "271-p2.bin",   0x400000, 0xda3118c4, 1 | BRF_ESS | BRF_PRG }, //  1
// { "271-p3.bin",   0x100000, 0x5cefd0d2, 1 | BRF_ESS | BRF_PRG }, //  2
{ "271-p3d.bin",  0x100000, 0x59d376da, 1 | BRF_ESS | BRF_PRG }, //  2

{ "271-c1d.bin", 0x1000000, 0xC29ACD28, 3 | BRF_GRA }, //  3 Sprite Data
{ "271-c2d.bin", 0x1000000, 0x328E80B1, 3 | BRF_GRA }, //  4
{ "271-c3d.bin", 0x1000000, 0x020A11F1, 3 | BRF_GRA }, //  5
{ "271-c4d.bin", 0x1000000, 0x991B5ED2, 3 | BRF_GRA }, //  6
{ "271-c5d.bin", 0x1000000, 0xc2de8b66, 3 | BRF_GRA }, //  7
{ "271-c6d.bin", 0x1000000, 0x3ff750db, 3 | BRF_GRA }, //  8

// { "271-m1.bin",  0x080000,  0xd6bcf2bc, 4 | BRF_ESS | BRF_PRG }, // 9 Z80 code
{ "271-m1d.bin", 0x080000,  0x0E86AF8F, 4 | BRF_ESS | BRF_PRG }, // 9 Z80 code

{ "271-v1.bin",  0x1000000, 0x1D96154B, 5 | BRF_SND }, // 10 Sound data

{ "271-bios.bin", 0x040000, 0xc521b5bc, 1 | BRF_ESS | BRF_PRG }, //  11 Special bios
};

STDROMPICKEXT(kof2003, kof2003, neogeo);
STD_ROM_FN(kof2003);

// Code by IQ_132

extern void do_kof2003_patch();

static void kof2003_px_decrypt()
{
interleave_pdata();

do_neopvc(1);

unsigned char *rom = Neo68KROM;
unsigned char *buf = (unsigned char*)malloc(0x900000);

memcpy( buf, rom, 0x900000 );
memcpy( &rom[0x100000], &buf[0x800000], 0x100000 );
memcpy( &rom[0x200000], &buf[0x100000], 0x700000 );

free(buf);

rom = (unsigned char*)malloc(0x40000);
BurnLoadRom(rom, 11, 1);
memcpy(Neo68KROM+0x50000,  rom+0x20000, 0x2800);
free(rom);

do_kof2003_patch();
}

unsigned char *NeoCartRAM = (unsigned char *)CartRAM;

unsigned char pvc_r8(unsigned int sekAddress)
{
return *(((unsigned char *)CartRAM)+((sekAddress^1)-0x2fe000));
}

void pvc_w8(unsigned int sekAddress,unsigned char byteValue)
{
*(((unsigned char *)CartRAM)+((sekAddress^1)-0x2fe000))=byteValue;
}

void pvc_CalcBank2()
{
unsigned int offset;
offset=(pvc_r8(0x2ffff2)<<16)|(pvc_r8(0x2ffff3)<<8)|(pvc_r8(0x2ffff0)<<0);
*((unsigned char *) (CartRAM+((0x2ffff0-0x2fe000)^1)))&=0xfe;
*((unsigned char *) (CartRAM+((0x2ffff1-0x2fe000)^1)))=0xa0;
*((unsigned char *) (CartRAM+((0x2ffff2-0x2fe000)^1)))&=0x7f;
Neo68KROM[0x58196]=pvc_r8(0x2ffff3);
SekMapMemory(Neo68KROM+0x100000+offset,0x200000,0x2fdfff,  SM_ROM);
}

unsigned char __fastcall pvcReadByteBankSwitch(unsigned int sekAddress)
{
return pvc_r8(sekAddress);
}

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

void __fastcall pvc2WriteByteBankSwitch(unsigned int sekAddress, unsigned char byteValue)
{
pvc_w8(sekAddress,byteValue);
if(sekAddress>=0x2ffff0 && sekAddress<=0x2ffff3)pvc_CalcBank2();
}

void __fastcall pvc2WriteWordBankSwitch(unsigned int sekAddress, unsigned short wordValue)
{
CartRAM[(sekAddress-0x2fe000)/2]=wordValue;
if(sekAddress>=0x2ffff0 && sekAddress<=0x2ffff3)pvc_CalcBank2();
}

static void pvc2MapHandler()
{
// Install BankSwitch handler
SekMapHandler(5, 0x2fe000, 0x2fffff, SM_READ);
SekSetReadWordHandler(5,  pvcReadWordBankSwitch);
SekSetReadByteHandler(5,  pvcReadByteBankSwitch);

SekMapHandler(5, 0x2fe000, 0x2fffff, SM_WRITE);
SekSetWriteWordHandler(5, pvc2WriteWordBankSwitch);
SekSetWriteByteHandler(5, pvc2WriteByteBankSwitch);
}

static int kof2003Init()
{
int nRet;

memset(CartRAM,0,0x2000);

nNeoTextROMSize = 0x100000;
nNeoTextROMFixType = 6;
nNeoPCM2PLAYMOREByteswap = 6;
// nNeoProtectionXor = 0x9d
pNeoInitCallback=kof2003_px_decrypt;

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

//

struct BurnDriver BurnDrvkof2003 = {
"kof2003", NULL, "neogeo", "2003",
"The King of Fighters 2003\0", NULL , "SNK Playmore Corporation", "Neo Geo",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_NEWBANKSYSTEM | HARDWARE_SNK_ALTERNATE_TEXT,
NULL, kof2003RomInfo, kof2003RomName, neogeoInputInfo, neogeoDIPInfo,
kof2003Init, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};

edit:

the interleave p data and neo pvc functions are declared before all the drivers in d_neogeo.cpp since are used by other games but kof2003 ;)
Title: FBA v0.2.95.23 and kof2003
Post by: osv29 on February 17, 2005, 06:46:22 PM
Quote
the interleave p data and neo pvc functions are declared before all the drivers in d_neogeo.cpp since are used by other games but kof2003


how can i do that??... yes i know i'm a noob but  try a lots of things and i dont know wtf im doing.... :(
thanks in advance
Title: FBA v0.2.95.23 and kof2003
Post by: Shoometsu on February 18, 2005, 05:07:50 AM
Quote from: osv29
how can i do that??... yes i know i'm a noob but  try a lots of things and i dont know wtf im doing.... :(
thanks in advance


just look for the static void interleave_pdata() and static void do_neopvc(int game) functions inside kof2003's driver. you can paste them before all the drivers in d_neogeo.cpp, besides it works with them inside the driver but you can have problems in the futures adding other pcb romsets...