Final Burn Neo > FBN Development

King of Fighters 2003, The (Set 2)

(1/5) > >>

iq_132:
The code for fba is a little more complex because of the bankswitch being used.
It seems everyone is using different names and versions of the code.  I'm posting
what I have; you may have to edit it a bit to make it work for you.


--- Code: ---// The King of Fighters 2003 (MVS Cart)

static struct BurnRomInfo kof2003aRomDesc[] = {
{ "271-p1c.bin",  0x400000, 0x530ecc14, 1 | BRF_ESS | BRF_PRG }, //  0 68K code
{ "271-p2c.bin",  0x400000, 0xfd568da9, 1 | BRF_ESS | BRF_PRG }, //  1
{ "271-p3d.bin",  0x100000, 0x59d376da, 1 | BRF_ESS | BRF_PRG }, //  2 (decrypted)
{ "271-p3c.bin",  0x100000, 0xaec5b4a9, 0 | BRF_PRG | BRF_OPT }, //  3

{ "271-c1c.bin",  0x800000, 0xb1dc25d0, 3 | BRF_GRA }, //  4 Sprite data
{ "271-c2c.bin",  0x800000, 0xd5362437, 3 | BRF_GRA }, //  5
{ "271-c3c.bin",  0x800000, 0x0a1fbeab, 3 | BRF_GRA }, //  6
{ "271-c4c.bin",  0x800000, 0x87b19a0c, 3 | BRF_GRA }, //  7
{ "271-c5c.bin",  0x800000, 0x704ea371, 3 | BRF_GRA }, //  8
{ "271-c6c.bin",  0x800000, 0x20a1164c, 3 | BRF_GRA }, //  9
{ "271-c7c.bin",  0x800000, 0x189aba7f, 3 | BRF_GRA }, // 10
{ "271-c8c.bin",  0x800000, 0x20ec4fdc, 3 | BRF_GRA }, // 11

{ "271-m1cd.bin", 0x080000, 0x4374CB5C, 4 | BRF_ESS | BRF_PRG }, // 12 Z80 code (decrypted)
{ "271-m1c.bin",  0x080000, 0xf5515629, 0 | BRF_PRG | BRF_OPT }, // 13 Z80 code

{ "271-v1c.bin",  0x800000, 0xffa3f8c7, 5 | BRF_SND }, // 14 Sound data
{ "271-v2c.bin",  0x800000, 0x5382c7d1, 5 | BRF_SND }, // 15
};

STDROMPICKEXT(kof2003a, kof2003a, neogeo);
STD_ROM_FN(kof2003a);

static void px_interleave()
{
unsigned char *src = Neo68KROM;
unsigned char *dst = (unsigned char*)malloc(0x800000);
for (int i = 0; i < 0x800000; i+=4) {
memcpy(dst + i + 0, src + 0x000000 + i / 2, 2);
memcpy(dst + i + 2, src + 0x400000 + i / 2, 2);
}
memcpy(src, dst, 0x800000);
free(dst);
}

void kof2003a_px_decrypt()
{
px_interleave(); // can use code from kof2003 interleave

int i,j;
unsigned char *src = Neo68KROM;
unsigned char *dst = (unsigned char*)malloc(0x900000);

for(i = 0; i < 0x100000; i++)
dst[i] = src[i] ^ 0xFF ^ src[ 0x0FFFE0 + (i % 0x20)];

for(i = 0x100000; i < 0x800000; i++)
dst[i] = src[i] ^ 0xFF ^ src[ 0x7FFFE0 + (i % 0x20)];

for(i = 0x100000; i < 0x800000; i += 4) {
unsigned short *rom16 = (unsigned short*)&dst[i + 1];
*rom16 = (*rom16&0xF00F) | BITSWAP08((*rom16>>4)&0xFF, 1, 0, 3, 2, 5, 4, 7, 6)<<4;
}

for(i = 0; i < 0x10; i++) {
j = (i & 0xf0) + BITSWAP08((i & 0x0f), 7, 6, 5, 4, 0, 1, 2, 3);
memcpy(src + i * 0x10000, dst + j * 0x10000, 0x10000);
}

memcpy(src + 0x100000, src + 0x800000, 0x100000);

for(i = 0x100000; i < 0x800000; i += 0x100) {
j = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00800)
+ (BITSWAP08(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12);
memcpy(src + i + 0x100000, dst + j, 0x100);
}

free(dst);
}

static int kof2003aInit()
{
int nRet;

memset(CartRAM, 0, 0x1000);

nNeoTextROMSize = 0x080000;
nNeoProtectionXor = 0x9D;
pNeoInitCallback = kof2003a_px_decrypt;
pNeoScanCallback = NeoPVCScan;

nRet = NeoInit();

if (nRet == 0) {
PCM2DecryptVInfo Info = {  0xA7001, 0xFF14EA, { 0x4B, 0xA4, 0x63, 0x46, 0xF0, 0x91, 0xEA, 0x62 } };

PCM2DecryptV(&Info);

pvcMapHandler(); // Install Bankswitch handler
}

return nRet;
}

struct BurnDriver BurnDrvkof2003a = {
"kof2003a", "kof2003", "neogeo", "2003",
"The King of Fighters 2003 (set 2)\0", "MVS Version", "SNK Playmore", "Neo Geo",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_ENCRYPTED_B | HARDWARE_SNK_ALTERNATE_TEXT,
NULL, kof2003aRomInfo, kof2003aRomName, neogeoInputInfo, neogeoDIPInfo,
kof2003aInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};

--- End code ---

MichaelNet:
Nice stuff !  :smilie:

Many Thx for the port iq !

DsNo:

--- Quote from: iq_132 on December 18, 2005, 03:46:35 AM ---
--- Code: --- pNeoScanCallback = NeoPVCScan;

--- End code ---

--- End quote ---

My fba compiling error..
I need NeoPVCScan source... Anyone know this?

iq_132:

--- Code: ---unsigned char *NeoCartRAM = (unsigned char*)CartRAM;

int NeoPVCScan(int nAction, int* /*pnMin*/)
{
struct BurnArea ba;

if (nAction & ACB_MEMORY_RAM) {
ba.Data = NeoCartRAM;
ba.nLen = 0x00002000;
ba.nAddress = 0;
ba.szName = "Neo-PVC 68K RAM";
BurnAcb(&ba);
}

return 0;
}

--- End code ---

DsNo:
Thanks!! IQ_132~  :biggrin:

Navigation

[0] Message Index

[#] Next page

Go to full version