diff --git a/src/burn/drv/capcom/cps.h b/src/burn/drv/capcom/cps.h index 77a2b4649..4e16b6340 100644 --- a/src/burn/drv/capcom/cps.h +++ b/src/burn/drv/capcom/cps.h @@ -358,6 +358,7 @@ INT32 CpsObjGet(); INT32 FcrashObjGet(); INT32 KodbObjGet(); INT32 DinopicObjGet(); +INT32 DaimakaibObjGet(); INT32 WofhObjGet(); void CpsObjDrawInit(); INT32 Cps1ObjDraw(INT32 nLevelFrom,INT32 nLevelTo); diff --git a/src/burn/drv/capcom/cps_obj.cpp b/src/burn/drv/capcom/cps_obj.cpp index f0785b3e7..2164d36d8 100644 --- a/src/burn/drv/capcom/cps_obj.cpp +++ b/src/burn/drv/capcom/cps_obj.cpp @@ -564,6 +564,67 @@ INT32 DinopicObjGet() return 0; } +INT32 DaimakaibObjGet() +{ + INT32 i; + UINT8 *pg, *po; + struct ObjFrame* pof; + UINT8* Get = NULL; + + pof = of + nGetNext; + + pof->nCount = 0; + + po = pof->Obj; + pof->nShiftX = -0x40; + pof->nShiftY = -0x10; + + // writes a blank sprite, followed by end of sprite list marker, start at 0x10 to ignore these + Get = CpsBootlegSpriteRam + 0x1010; + + if (Get==NULL) return 1; + + // Make a copy of all active sprites in the list + for (pg = Get, i = 0; i < nMax; pg += 8, i++) { + UINT16* ps = (UINT16*)pg; + INT32 n, y, x, a; + + y = BURN_ENDIAN_SWAP_INT16(ps[-1]); + + if (y == 0x8000) { // end of sprite list + break; + } + + n = BURN_ENDIAN_SWAP_INT16(ps[0]); + a = BURN_ENDIAN_SWAP_INT16(ps[1]); + x = BURN_ENDIAN_SWAP_INT16(ps[2]); + + n = GfxRomBankMapper(GFXTYPE_SPRITES, n); + if (n == -1) continue; + + n |= (y & 0x6000) << 3; // high bits of address + + po[0] = n & 0xff; + po[1] = n >> 8; + po[2] = a & 0xff; + po[3] = a >> 8; + po[4] = x & 0xff; + po[5] = x >> 8; + po[6] = y & 0xff; + po[7] = y >> 8; + + pof->nCount++; + po += 8; + } + + nGetNext++; + if (nGetNext >= nFrameCount) { + nGetNext = 0; + } + + return 0; +} + INT32 WofhObjGet() { INT32 i; diff --git a/src/burn/drv/capcom/d_cps1.cpp b/src/burn/drv/capcom/d_cps1.cpp index 71e3ae4f3..1353732c4 100644 --- a/src/burn/drv/capcom/d_cps1.cpp +++ b/src/burn/drv/capcom/d_cps1.cpp @@ -11411,16 +11411,20 @@ static INT32 DaimakaibInit() Ghouls = 1; Port6SoundWrite = 1; Cps1OverrideLayers = 1; - Cps1DisableBgHi = 1; + Cps1ObjGetCallbackFunction = DaimakaibObjGet; + Cps1ObjDrawCallbackFunction = FcrashObjDraw; + CpsMemScanCallbackFunction = CpsBootlegSpriteRamScanCallback; INT32 nRet = DrvInit(); + CpsBootlegSpriteRam = (UINT8*)BurnMalloc(0x4000); + SekOpen(0); - SekMapHandler(1, 0x880000, 0x88ffff, SM_READ | SM_WRITE); + SekMapMemory(CpsBootlegSpriteRam, 0x990000, 0x991fff, SM_RAM); + SekMapHandler(1, 0x880000, 0x88ffff, SM_WRITE); SekSetWriteWordHandler(1, Daimakaib88WriteWord); - SekMapHandler(2, 0x980000, 0x98ffff, SM_READ | SM_WRITE); + SekMapHandler(2, 0x980000, 0x98ffff, SM_WRITE); SekSetWriteWordHandler(2, Daimakaib98WriteWord); - // There are also writes in the 0x99xxxx area (unknown) SekClose(); return nRet;