From 16ffc979c4ea275ad8396409dadb0f2e1fe82d4c Mon Sep 17 00:00:00 2001 From: iq_132 <1191709+iq132@users.noreply.github.com> Date: Wed, 21 Mar 2012 04:06:50 +0000 Subject: [PATCH] Small PGM modification. --- src/burn/drv/pgm/d_pgm.cpp | 38 +++++++----- src/burn/drv/pgm/pgm.h | 1 - src/burn/drv/pgm/pgm_prot.cpp | 113 +++++++--------------------------- src/burn/drv/pgm/pgm_run.cpp | 15 +++-- 4 files changed, 55 insertions(+), 112 deletions(-) diff --git a/src/burn/drv/pgm/d_pgm.cpp b/src/burn/drv/pgm/d_pgm.cpp index c842f1754..3409f9fce 100644 --- a/src/burn/drv/pgm/d_pgm.cpp +++ b/src/burn/drv/pgm/d_pgm.cpp @@ -313,7 +313,7 @@ static struct BurnDIPInfo martmastc102DIPList[] = { }; static struct BurnDIPInfo ddp2DIPList[] = { - {0x2E, 0xFF, 0xFF, 0x00, NULL }, + {0x2E, 0xFF, 0xFF, 0x05, NULL }, {0, 0xFE, 0, 6, "Region (Fake)" }, {0x2E, 0x01, 0x07, 0x00, "China" }, @@ -2140,7 +2140,7 @@ static struct BurnRomInfo ddp2RomDesc[] = { { "m1300.u5", 0x400000, 0x82d4015d, 5 | BRF_SND }, // 5 Samples - { "ddp2_igs027a.bin", 0x004000, 0, 7 | BRF_PRG | BRF_NODUMP },// 6 Internal ARM7 Rom + { "ddp2_igs027a.bin", 0x004000, 0x742D34D2, 7 | BRF_PRG },// 6 Internal ARM7 Rom { "v100.u23", 0x020000, 0x06c3dd29, 8 | BRF_PRG | BRF_ESS }, // 7 External ARM7 Rom }; @@ -2150,23 +2150,28 @@ STD_ROM_FN(ddp2) static INT32 ddp2Init() { + nPGMEnableIRQ4 = 1; pPgmInitCallback = pgm_decrypt_ddp2; - pPgmProtCallback = install_protection_asic27a_ddp2; // simulation -// pPgmProtCallback = install_protection_asic27a_martmast; + pPgmProtCallback = install_protection_asic27a_martmast; - return pgmInit(); + INT32 nRet = pgmInit(); + + Arm7SetIdleLoopAddress(0x8010998); + + return nRet; } -struct BurnDriverD BurnDrvDdp2 = { +struct BurnDriver BurnDrvDdp2 = { "ddp2", NULL, "pgm", NULL, "2001", - "Bee Storm - DoDonPachi II (V102)\0", "Incomplete Dump", "IGS", "PolyGameMaster", + "Bee Storm - DoDonPachi II (V102)\0", NULL, "IGS", "PolyGameMaster", L"Bee Storm - DoDonPatchi II\0\u6012\u9996\u9886\u8702\uff0d\u8702\u66b4 (V102)\0", NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL, 4, HARDWARE_IGS_PGM/* | HARDWARE_IGS_USE_ARM_CPU */, GBF_VERSHOOT, 0, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 4, HARDWARE_IGS_PGM | HARDWARE_IGS_USE_ARM_CPU, GBF_VERSHOOT, 0, NULL, ddp2RomInfo, ddp2RomName, NULL, NULL, pgmInputInfo, ddp2DIPInfo, ddp2Init, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x1200, 224,448,3,4 }; + // Bee Storm - DoDonPachi II (V100) static struct BurnRomInfo ddp2100RomDesc[] = { @@ -2181,7 +2186,7 @@ static struct BurnRomInfo ddp2100RomDesc[] = { { "m1300.u5", 0x400000, 0x82d4015d, 5 | BRF_SND }, // 5 Samples - { "ddp2_igs027a.bin", 0x004000, 0, 7 | BRF_PRG | BRF_NODUMP },// 6 Internal ARM7 Rom + { "ddp2_igs027a.bin", 0x004000, 0x742D34D2, 7 | BRF_PRG },// 6 Internal ARM7 Rom { "v100.u23", 0x020000, 0x06c3dd29, 8 | BRF_PRG | BRF_ESS }, // 7 External ARM7 Rom }; @@ -2189,16 +2194,17 @@ static struct BurnRomInfo ddp2100RomDesc[] = { STDROMPICKEXT(ddp2100, ddp2100, pgm) STD_ROM_FN(ddp2100) -struct BurnDriverD BurnDrvDdp2100 = { +struct BurnDriver BurnDrvDdp2100 = { "ddp2100", "ddp2", "pgm", NULL, "2001", - "Bee Storm - DoDonPachi II (V100)\0", "Incomplete Dump", "IGS", "PolyGameMaster", + "Bee Storm - DoDonPachi II (V100)\0", NULL, "IGS", "PolyGameMaster", L"Bee Storm - DoDonPatchi II\0\u6012\u9996\u9886\u8702\uff0d\u8702\u66b4 (V100)\0", NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL | BDF_CLONE, 4, HARDWARE_IGS_PGM/* | HARDWARE_IGS_USE_ARM_CPU*/, GBF_VERSHOOT, 0, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 4, HARDWARE_IGS_PGM | HARDWARE_IGS_USE_ARM_CPU, GBF_VERSHOOT, 0, NULL, ddp2100RomInfo, ddp2100RomName, NULL, NULL, pgmInputInfo, ddp2DIPInfo, ddp2Init, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x1200, 224,448,3,4 }; + // Bee Storm - DoDonPachi II (V101) static struct BurnRomInfo ddp2101RomDesc[] = { @@ -2213,7 +2219,7 @@ static struct BurnRomInfo ddp2101RomDesc[] = { { "m1300.u5", 0x400000, 0x82d4015d, 5 | BRF_SND }, // 5 Samples - { "ddp2_igs027a.bin", 0x004000, 0, 7 | BRF_PRG | BRF_NODUMP },// 6 Internal ARM7 Rom + { "ddp2_igs027a.bin", 0x004000, 0x742D34D2, 7 | BRF_PRG },// 6 Internal ARM7 Rom { "v100.u23", 0x020000, 0x06c3dd29, 8 | BRF_PRG | BRF_ESS }, // 7 External ARM7 Rom }; @@ -2221,11 +2227,11 @@ static struct BurnRomInfo ddp2101RomDesc[] = { STDROMPICKEXT(ddp2101, ddp2101, pgm) STD_ROM_FN(ddp2101) -struct BurnDriverD BurnDrvDdp2101 = { +struct BurnDriver BurnDrvDdp2101 = { "ddp2101", "ddp2", "pgm", NULL, "2001", - "Bee Storm - DoDonPachi II (V101)\0", "Incomplete Dump", "IGS", "PolyGameMaster", + "Bee Storm - DoDonPachi II (V101)\0", NULL, "IGS", "PolyGameMaster", L"Bee Storm - DoDonPatchi II\0\u6012\u9996\u9886\u8702\uff0d\u8702\u66b4 (V101)\0", NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL | BDF_CLONE, 4, HARDWARE_IGS_PGM/* | HARDWARE_IGS_USE_ARM_CPU */, GBF_VERSHOOT, 0, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 4, HARDWARE_IGS_PGM | HARDWARE_IGS_USE_ARM_CPU, GBF_VERSHOOT, 0, NULL, ddp2101RomInfo, ddp2101RomName, NULL, NULL, pgmInputInfo, ddp2DIPInfo, ddp2Init, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x1200, 224,448,3,4 diff --git a/src/burn/drv/pgm/pgm.h b/src/burn/drv/pgm/pgm.h index 7cf562092..af1c40dc0 100644 --- a/src/burn/drv/pgm/pgm.h +++ b/src/burn/drv/pgm/pgm.h @@ -72,7 +72,6 @@ void install_protection_asic27a_kovsh(); void install_protection_asic27a_martmast(); void install_protection_asic27a_oldsplus(); void install_protection_asic27a_puzlstar(); -void install_protection_asic27a_ddp2(); void install_protection_asic27a_svg(); void install_protection_asic27a_ketsui(); void install_protection_asic27a_ddp3(); diff --git a/src/burn/drv/pgm/pgm_prot.cpp b/src/burn/drv/pgm/pgm_prot.cpp index c41a50638..984a4ab73 100644 --- a/src/burn/drv/pgm/pgm_prot.cpp +++ b/src/burn/drv/pgm/pgm_prot.cpp @@ -1143,15 +1143,32 @@ static inline void pgm_cpu_sync() } } -static void __fastcall asic27a_write_byte(UINT32 /*address*/, UINT8 /*data*/) +static void __fastcall asic27a_write_byte(UINT32 address, UINT8 data) { + if ((address & 0xff0000) == 0xd00000) { + pgm_cpu_sync(); + PGMARMShareRAM[(address & 0xffff)^1] = data; + return; + } + if ((address & 0xfffffe) == 0xd10000) { // ddp2 + pgm_cpu_sync(); + asic27a_to_arm = data & 0xff; + Arm7SetIRQLine(ARM7_FIRQ_LINE, ARM7_HOLD_LINE); + return; + } } static void __fastcall asic27a_write_word(UINT32 address, UINT16 data) { + if ((address & 0xff0000) == 0xd00000) { + pgm_cpu_sync(); + *((UINT16*)(PGMARMShareRAM + (address & 0xfffe))) = BURN_ENDIAN_SWAP_INT16(data); + return; + } + if ((address & 0xfffffe) == 0xd10000) { - // pgm_cpu_sync(); + pgm_cpu_sync(); asic27a_to_arm = data & 0xff; Arm7SetIRQLine(ARM7_FIRQ_LINE, ARM7_HOLD_LINE); return; @@ -1216,15 +1233,13 @@ void install_protection_asic27a_martmast() SekOpen(0); - SekMapMemory(PGMARMShareRAM, 0xd00000, 0xd0ffff, SM_FETCH | SM_WRITE); - - SekMapHandler(4, 0xd00000, 0xd10003, SM_READ); - SekMapHandler(5, 0xd10000, 0xd10003, SM_WRITE); + SekMapMemory(PGMARMShareRAM, 0xd00000, 0xd0ffff, SM_FETCH); + SekMapHandler(4, 0xd00000, 0xd10003, SM_READ | SM_WRITE); SekSetReadWordHandler(4, asic27a_read_word); SekSetReadByteHandler(4, asic27a_read_byte); - SekSetWriteWordHandler(5, asic27a_write_word); - SekSetWriteByteHandler(5, asic27a_write_byte); + SekSetWriteWordHandler(4, asic27a_write_word); + SekSetWriteByteHandler(4, asic27a_write_byte); SekClose(); Arm7Init(1); @@ -2562,85 +2577,3 @@ INT32 ddp3Scan(INT32 nAction, INT32 *) return 0; } - -//------------------------------------------------------------------------------------------- -// ddp2 - preliminary (kludgy) - -static INT32 ddp2_asic27_0xd10000 = 0; - -static void __fastcall Ddp2WriteByte(UINT32 address, UINT8 data) -{ - if ((address & 0xffe000) == 0xd00000) { - PGMUSER0[(address & 0x1fff)^1] = data; - *((UINT16*)(PGMUSER0 + 0x0010)) = 0; - *((UINT16*)(PGMUSER0 + 0x0020)) = 1; - return; - } - - if ((address & 0xffffffe) == 0xd10000) { - ddp2_asic27_0xd10000=data; - return; - } -} - -static void __fastcall Ddp2WriteWord(UINT32 address, UINT16 data) -{ - if ((address & 0xffe000) == 0xd00000) { - *((UINT16*)(PGMUSER0 + (address & 0x1ffe))) = data; - *((UINT16*)(PGMUSER0 + 0x0010)) = 0; - *((UINT16*)(PGMUSER0 + 0x0020)) = 1; - return; - } - - if ((address & 0xffffffe) == 0xd10000) { - ddp2_asic27_0xd10000=data; - return; - } -} - -static UINT8 __fastcall Ddp2ReadByte(UINT32 address) -{ - if ((address & 0xfffffe) == 0xd10000) { - ddp2_asic27_0xd10000++; - ddp2_asic27_0xd10000&=0x7f; - return ddp2_asic27_0xd10000; - } - - if ((address & 0xffe000) == 0xd00000) { - *((UINT16*)(PGMUSER0 + 0x0002)) = PgmInput[7]; // region - *((UINT16*)(PGMUSER0 + 0x1f00)) = 0; - return PGMUSER0[(address & 0x1fff)^1]; - } - - return 0; -} - -static UINT16 __fastcall Ddp2ReadWord(UINT32 address) -{ - if ((address & 0xfffffe) == 0xd10000) { - ddp2_asic27_0xd10000++; - ddp2_asic27_0xd10000&=0x7f; - return ddp2_asic27_0xd10000; - } - - if ((address & 0xffe000) == 0xd00000) { - *((UINT16*)(PGMUSER0 + 0x0002)) = PgmInput[7]; // region - *((UINT16*)(PGMUSER0 + 0x1f00)) = 0; - return *((UINT16*)(PGMUSER0 + (address & 0x1ffe))); - } - - return 0; -} - -void install_protection_asic27a_ddp2() -{ - memset (PGMUSER0, 0, 0x2000); - - SekOpen(0); - SekMapHandler(4, 0xd00000, 0xd1ffff, SM_READ | SM_WRITE); - SekSetReadWordHandler(4, Ddp2ReadWord); - SekSetReadByteHandler(4, Ddp2ReadByte); - SekSetWriteWordHandler(4, Ddp2WriteWord); - SekSetWriteByteHandler(4, Ddp2WriteByte); - SekClose(); -} diff --git a/src/burn/drv/pgm/pgm_run.cpp b/src/burn/drv/pgm/pgm_run.cpp index 31e0f5647..f160d7ea0 100644 --- a/src/burn/drv/pgm/pgm_run.cpp +++ b/src/burn/drv/pgm/pgm_run.cpp @@ -777,18 +777,23 @@ INT32 pgmFrame() SekNewFrame(); ZetNewFrame(); - if (nEnableArm7) Arm7NewFrame(); - if (nEnableArm7) // region hacks + if (nEnableArm7) { - switch (nPGMArm7Type) + Arm7NewFrame(); + + switch (nPGMArm7Type) // region hacks { case 1: // kov/kovsh/kovshp/photoy2k/puzlstar/puzzli2/oldsplus/py2k2 PGMARMShareRAM[0x008] = PgmInput[7]; break; - case 2: // martmast/kov2/ddp2/dw2001 - PGMARMShareRAM[0x138] = PgmInput[7]; + case 2: // martmast/kov2/dw2001/ddp2 + if (strncmp(BurnDrvGetTextA(DRV_NAME), "ddp2", 4) == 0) { + PGMARMShareRAM[0x002] = PgmInput[7]; + } else { + PGMARMShareRAM[0x138] = PgmInput[7]; + } break; case 3: // svg/killbldp/dmnfrnt/theglad/happy6in1