Author Topic: Modified github kof98pfe driver  (Read 697 times)

Offline DsNo

  • Jr. Member
  • **
  • Posts: 53
  • Karma: +8/-0
  • Junior Member
Modified github kof98pfe driver
« on: February 08, 2019, 03:32:43 AM »
- src\burn\drv\neogeo\d_neogeo.cpp

Code: [Select]
static struct BurnRomInfo kof98pfeRomDesc[] = {
{ "242pfe.p1",  0x100000, 0x23876d95, 1 | BRF_ESS | BRF_PRG }, //  1 68K code
{ "242pfe.p2",  0x400000, 0xadbaa852, 1 | BRF_ESS | BRF_PRG }, //  1 68K code
{ "242pfe.p3",  0x020000, 0x930ea34e, 1 | BRF_ESS | BRF_PRG }, //  1 68K code

{ "242pfe.s1",  0x020000, 0x7f4dbf23, 2 | BRF_GRA },           //  2 Text layer tiles / TC531000

{ "242hx73.c1", 0x800000, 0x379654a5, 3 | BRF_GRA },           //  3 Sprite data
{ "242hx73.c2", 0x800000, 0x9c71fa3d, 3 | BRF_GRA },           //  4
{ "242.c3",     0x800000, 0x22127b4f, 3 | BRF_GRA },           //  5
{ "242.c4",     0x800000, 0x0b4fa044, 3 | BRF_GRA },           //  6
{ "242.c5",     0x800000, 0x9d10bed3, 3 | BRF_GRA },           //  7
{ "242.c6",     0x800000, 0xda07b6a2, 3 | BRF_GRA },           //  8
{ "242pfe.c7",  0x800000, 0x02f09b2e, 3 | BRF_GRA },           //  9
{ "242pfe.c8",  0x800000, 0xd43ab3e6, 3 | BRF_GRA },           // 10

{ "242-mg1.m1", 0x040000, 0x4e7a6b1b, 4 | BRF_ESS | BRF_PRG }, // 11 Z80 code

{ "242.v1",     0x400000, 0xb9ea8051, 5 | BRF_SND },           // 12 Sound data
{ "242.v2",     0x400000, 0xcc11106e, 5 | BRF_SND },           // 13
{ "242.v3",     0x400000, 0x044ea4e1, 5 | BRF_SND },           // 14
{ "242.v4",     0x400000, 0x7985ea30, 5 | BRF_SND },           // 15
};

STDROMPICKEXT(kof98pfe, kof98pfe, neogeo)
STD_ROM_FN(kof98pfe)

static UINT8 *kof98pfeExtraROM;

// static void kof98pfeCallback()
// {
// BurnLoadRom(Neo68KROMActive + 0x700000, 2, 1);
// Neo68KROMActive[0x701af4] = 0x4e;
// Neo68KROMActive[0x701af5] = 0x71;
// Neo68KROMActive[0x701b18] = 0x60;
// Neo68KROMActive[0x701ca2] = 0x60;
// }

static INT32 kof98pfeInit()
{
// NeoCallbackActive->pInitialise = kof98pfeCallback;

INT32 nRet = NeoInit();

if (nRet == 0) {
kof98pfeExtraROM = (UINT8*)BurnMalloc(0x20000);

if (BurnLoadRom(kof98pfeExtraROM, 2, 1)) return 1;

kof98pfeExtraROM[0x1af4] = 0x71;
kof98pfeExtraROM[0x1af5] = 0x4e;
kof98pfeExtraROM[0x1b19] = 0x60;
kof98pfeExtraROM[0x1ca3] = 0x60;

UINT16 *rom = (UINT16*)kof98pfeExtraROM;
for (INT32 i = 0; i < 0x20000/2; i++) {
if (rom[i] == 0x4e7d) rom[i] = 0x4e71;
if (rom[i] == 0x4e7c) rom[i] = 0x4e75;
}

rom = (UINT16*)Neo68KROMActive;

for (INT32 i = 0; i < 0x100000/2; i++) {
if (rom[i] == 0x4e7d) rom[i] = 0x4e71;
if (rom[i] == 0x4e7c) rom[i] = 0x4e75;
}

SekOpen(0);
SekMapMemory(kof98pfeExtraROM, 0x900000, 0x91ffff, MAP_ROM);
SekClose();
}

return nRet;
}

static INT32 kof98pfeExit()
{
BurnFree (kof98pfeExtraROM);

return NeoExit();
}

struct BurnDriver BurnDrvkof98pfe = {
"kof98pfe", "kof98", "neogeo", NULL, "2017",
"Kof'98 (Plus Final Edition)(2017-07-23)(Korean board)\0", NULL, "hack", "Miscellaneous",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE | BDF_HACK, 2, HARDWARE_PREFIX_CARTRIDGE | HARDWARE_SNK_NEOGEO, GBF_VSFIGHT, FBF_KOF,
NULL, kof98pfeRomInfo, kof98pfeRomName, NULL, NULL, NULL, NULL, neogeoInputInfo, neogeoDIPInfo,
kof98pfeInit, kof98pfeExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
0x1000, 320, 224, 4, 3
};

======

- src/burn/drv/neogeo/neo_run.cpp

Code: [Select]
// if (!strcmp("kof98pfe", BurnDrvGetTextA(DRV_NAME))) nCodeSize[nNeoActiveSlot] = 0x720000;

======

github driver (Compile VC2013) : Character Selection -> Black Screen
modified driver (Compile VC2013) : Character Selection -> It works

Offline barbudreadmon

  • Administrator
  • *****
  • Posts: 410
  • Karma: +17/-1
  • lr-fbalpha developer
Re: Modified github kof98pfe driver
« Reply #1 on: February 08, 2019, 04:19:54 AM »
I don't have the black screen with the current version, however as stated in https://github.com/libretro/fbalpha/issues/122 there is something weird in the current code : we load the 3rd m68k code rom in the callback, but soft-patching this code through Neo68KROMActive in the init doesn't work for some reason, so we end up loading it again to a new pointer and patching this pointer instead. Your code makes more sense and it's also removing 1 of the 2 hacks from neo_run.cpp, thanks for sharing.

Offline dink

  • Administrator
  • *****
  • Posts: 3039
  • Karma: +259/-0
  • feed the horse yumyum
Re: Modified github kof98pfe driver
« Reply #2 on: February 08, 2019, 08:52:32 AM »
thanks :)