I wanna patch "gaia" to make its boss-hack driver.
here is what I did.
src\burn\cave\d_gaia.cpp
find this#define CAVE_VBLANK_LINES 12
add this
void (*pCaveInitCallback)() = NULL;
find this
static int DrvInit()
{
int nLen;
BurnSetRefreshRate(58.0);
// Find out how much memory is needed
Mem = NULL;
MemIndex();
nLen = MemEnd - (unsigned char *)0;
if ((Mem = (unsigned char *)malloc(nLen)) == NULL) {
return 1;
}
memset(Mem, 0, nLen); // blank all memory
MemIndex(); // Index the allocated memory
// Load the roms into memory
if (LoadRoms()) {
return 1;
}
{
SekInit(0, 0x68000); // Allocate 68000
SekOpen(0);
// Map 68000 memory:
SekMapMemory(Rom01, 0x000000, 0x0FFFFF, SM_ROM); // CPU 0 ROM
SekMapMemory(Ram01, 0x100000, 0x10FFFF, SM_RAM);
SekMapMemory(CaveSpriteRAM, 0x400000, 0x40FFFF, SM_RAM);
SekMapMemory(CaveTileRAM[0], 0x500000, 0x50FFFF, SM_RAM);
SekMapMemory(CaveTileRAM[1], 0x600000, 0x60FFFF, SM_RAM);
SekMapMemory(CaveTileRAM[2], 0x700000, 0x70FFFF, SM_RAM);
SekMapMemory(CavePalSrc, 0xC00000, 0xC0FFFF, SM_ROM); // Palette RAM (write goes through handler)
SekMapHandler(1, 0xC00000, 0xC0FFFF, SM_WRITE); //
SekSetReadWordHandler(0, gaiaReadWord);
SekSetReadByteHandler(0, gaiaReadByte);
SekSetWriteWordHandler(0, gaiaWriteWord);
SekSetWriteByteHandler(0, gaiaWriteByte);
SekSetWriteWordHandler(1, gaiaWriteWordPalette);
SekSetWriteByteHandler(1, gaiaWriteBytePalette);
SekClose();
}
add this if (pCaveInitCallback) {
pCaveInitCallback();
}
add this at the end
// gaiab (Boss version)
static struct BurnRomInfo gaiabRomDesc[] = {
{ "prg1.127", 0x080000, 0x47B904B2, BRF_ESS | BRF_PRG }, // 0 CPU #0 code
{ "prg2.128", 0x080000, 0x469B7794, BRF_ESS | BRF_PRG }, // 1
{ "obj1.736", 0x400000, 0xF4F84E5D, BRF_GRA }, // 2 Sprite data
{ "obj2.738", 0x400000, 0x15C2A9CE, BRF_GRA }, // 3
{ "bg1.989", 0x400000, 0x013A693D, BRF_GRA }, // 4 Layer 0 Tile data
{ "bg2.995", 0x400000, 0x783CC62F, BRF_GRA }, // 5 Layer 1 Tile data
{ "bg3.998", 0x400000, 0xbcd61d1c, BRF_GRA }, // 6 Layer 2 Tile data
{ "snd1.447", 0x400000, 0x92770A52, BRF_SND }, // 7 YMZ280B (AD)PCM data
{ "snd2.454", 0x400000, 0x329AE1CF, BRF_SND }, // 8
{ "snd3.455", 0x400000, 0x4048D64E, BRF_SND }, // 9
};
STD_ROM_PICK(gaiab);
STD_ROM_FN(gaiab);
void gaiab_patch()
{
Rom01[0x87396] = 0x5C;
Rom01[0x87398] = 0x5C;
Rom01[0x8739A] = 0x5C;
Rom01[0x8739C] = 0x5C;
Rom01[0x873BA] = 0xB2;
Rom01[0x873BC] = 0xB2;
Rom01[0x873BE] = 0xB2;
Rom01[0x873C0] = 0xB2;
Rom01[0x93490] = 0x5E;
Rom01[0x93492] = 0x5E;
Rom01[0x93494] = 0x5E;
Rom01[0x93496] = 0x5E;
Rom01[0x93651] = 0xD0;
Rom01[0x93653] = 0xD0;
Rom01[0x93655] = 0xD0;
Rom01[0x93657] = 0xD0;
Rom01[0x938B9] = 0x07;
Rom01[0x938BA] = 0x07;
Rom01[0x938BB] = 0x07;
Rom01[0x938BC] = 0x07;
Rom01[0x938C2] = 0xDC;
Rom01[0x938C4] = 0xEC;
Rom01[0x938C6] = 0xDC;
Rom01[0x938C8] = 0xEC;
Rom01[0x938CA] = 0xDC;
Rom01[0x938CC] = 0xEC;
Rom01[0x938CE] = 0xDC;
Rom01[0x938D0] = 0xEC;
}
int gaiabInit()
{
pCaveInitCallback = gaiab_patch;
return DrvInit();
}
struct BurnDriver BurnDrvgaiab = {
"gaiab", "gaia", NULL, "2006",
"Gaia Crusaders (hidden characters enabled by 0 DAY-S[EGCG])\0", "The sound emulation isn't 100% accurate.", "hack", "Cave",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_CLONE, 2, HARDWARE_CAVE_68K_ONLY,
NULL, gaiabRomInfo, gaiabRomName, gaiaInputInfo, gaiaDIPInfo,
gaiabInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &CaveRecalcPalette,
320, 224, 4, 3
};
Compiling FBA without problem, but the Boss hack driver remain the original one.
I don't know why.
anyone can help?
here is the boss hack patch.