diff --git a/src/burn/drv/pgm/d_pgm.cpp b/src/burn/drv/pgm/d_pgm.cpp index 7526ee0fd..84e4f3944 100644 --- a/src/burn/drv/pgm/d_pgm.cpp +++ b/src/burn/drv/pgm/d_pgm.cpp @@ -3040,13 +3040,11 @@ static struct BurnRomInfo thegladRomDesc[] = { STDROMPICKEXT(theglad, theglad, pgm) STD_ROM_FN(theglad) -static void thegladPatch() +static void pgm_create_theglad_E0_data() { - pgm_decrypt_theglad(); - // Replace undumpable area of the arm7 internal rom with a custom-built // version created by David Haywood in order to make game playable - static UINT16 thegladEOHackData[0x188/2] = { + static const UINT16 thegladEOHackData[0x188/2] = { 0x000a, 0xea00, 0xfffe, 0xeaff, 0xfffe, 0xeaff, 0xfffe, 0xeaff, 0xfffe, 0xeaff, 0xfffe, 0xeaff, 0xfffe, 0xeaff, 0xf000, 0xe59f, 0x0010, 0x0800, 0x0010, 0x0800, 0xfffe, 0xeaff, 0xfffe, 0xeaff, @@ -3074,16 +3072,15 @@ static void thegladPatch() 0xfffe, 0xeaff, 0x105c, 0xe59f }; - // byte swap for Big Endian arch - for (int i = 0; i < 0x188/2; i++) - { - thegladEOHackData[i] = BURN_ENDIAN_SWAP_INT16(thegladEOHackData[i]); - } - - memmove (PGMARMROM + 0x188, PGMARMROM, 0x4000-0x188); memcpy (PGMARMROM, thegladEOHackData, 0x188); } +static void thegladPatch() +{ + pgm_decrypt_theglad(); + pgm_create_theglad_E0_data(); +} + static INT32 thegladInit() { nPgmAsicRegionHackAddress = 0x3316; @@ -3171,7 +3168,8 @@ STD_ROM_FN(theglad100) static void theglad100Patch() { - thegladPatch(); + pgm_decrypt_theglad(); + pgm_create_theglad_E0_data(); // Hack the jump table in the external rom to work correctly with the internal rom we have... static const UINT16 subroutine_addresses[] = { @@ -4199,29 +4197,43 @@ static struct BurnRomInfo svgpcbRomDesc[] = { { "w05601b064.bin", 0x800000, 0xbfe61a71, 5 | BRF_SND }, // 8 Samples { "w05602b032.bin", 0x400000, 0x0685166d, 5 | BRF_SND }, // 9 - { "svg_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 10 Internal ARM7 Rom +// { "svg_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 10 Internal ARM7 Rom + { "svg_igs027a_execute_only_area", 0x000188, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, // 10 Internal ARM7 Rom + { "svgcpb_igs027a_v100_japan.bin", 0x003e78, 0x7a59da5d, 7 | BRF_PRG | BRF_ESS }, // 11 Internal ARM7 Rom - { "svg_v100jp.u64", 0x400000, 0x399d4a8b, 8 | BRF_PRG | BRF_ESS }, // 11 External ARM7 Rom - { "svg_v100jp.u65", 0x400000, 0x6e1c33b1, 8 | BRF_PRG | BRF_ESS }, // 12 + { "svg_v100jp.u64", 0x400000, 0x399d4a8b, 8 | BRF_PRG | BRF_ESS }, // 12 External ARM7 Rom + { "svg_v100jp.u65", 0x400000, 0x6e1c33b1, 8 | BRF_PRG | BRF_ESS }, // 13 }; STDROMPICKEXT(svgpcb, svgpcb, svgpcbBIOS) // custom bios STD_ROM_FN(svgpcb) +static void svgpcbPatch() +{ + pgm_decrypt_svgpcb(); + pgm_create_theglad_E0_data(); +} + static INT32 svgpcbInit() { - pPgmInitCallback = pgm_decrypt_svgpcb; -// pPgmProtCallback = install_protection_asic27a_svg; + pPgmInitCallback = svgpcbPatch; + pPgmProtCallback = install_protection_asic27a_svg; - return pgmInit(); + nPgmAsicRegionHackAddress = 0x3a8e; + + INT32 nRet = pgmInit(); + + Arm7SetIdleLoopAddress(0x00009e0); + + return nRet; } struct BurnDriverD BurnDrvSvgpcb = { "svgpcb", "svg", NULL, NULL, "2005", "S.V.G. - Spectral vs Generation (V100, Japan, Single PCB Version)\0", "Incomplete Dump", "IGS", "PolyGameMaster", NULL, NULL, NULL, NULL, - BDF_CLONE, 4, HARDWARE_IGS_PGM/* | HARDWARE_IGS_USE_ARM_CPU*/, GBF_SCRFIGHT, 0, - NULL, svgpcbRomInfo, svgpcbRomName, NULL, NULL, pgmInputInfo, jammaDIPInfo, + BDF_CLONE, 4, HARDWARE_IGS_PGM | HARDWARE_IGS_USE_ARM_CPU, GBF_SCRFIGHT, 0, + NULL, svgpcbRomInfo, svgpcbRomName, NULL, NULL, pgmInputInfo, thegladpcbDIPInfo, svgpcbInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; diff --git a/src/burn/drv/pgm/pgm_crypt.cpp b/src/burn/drv/pgm/pgm_crypt.cpp index 8cb9d6c1d..1701d883b 100644 --- a/src/burn/drv/pgm/pgm_crypt.cpp +++ b/src/burn/drv/pgm/pgm_crypt.cpp @@ -14,7 +14,7 @@ void pgm_decrypt_dw2() if ((i & 0x020000) == 0x020000 && (i & 0x001500) != 0x001400) x ^= 0x0002; if ((i & 0x020400) == 0x000000 && (i & 0x002010) != 0x002010) x ^= 0x0400; if ((i & 0x020000) == 0x020000 && (i & 0x000148) != 0x000140) x ^= 0x0400; - + src[i] = BURN_ENDIAN_SWAP_INT16(x); } } @@ -481,7 +481,7 @@ void pgm_decrypt_svg() } } -static const UINT8 svgpcb_tab[0x100] = { // not checked +static const UINT8 svgpcb_tab[0x100] = { 0x49, 0x47, 0x53, 0x30, 0x30, 0x31, 0x37, 0x52, 0x44, 0x31, 0x30, 0x35, 0x30, 0x35, 0x30, 0x34, 0x75, 0x0B, 0xF1, 0x6B, 0x6D, 0xD7, 0xA8, 0xE7, 0x0C, 0xC5, 0x28, 0x81, 0x1F, 0xCF, 0x30, 0x15, 0xA8, 0x0D, 0xDA, 0x76, 0xF8, 0x7D, 0xD6, 0xE1, 0x0A, 0x11, 0xE3, 0xA4, 0x23, 0xFF, 0x8E, 0x0B, @@ -507,12 +507,11 @@ void pgm_decrypt_svgpcb() for (INT32 i = 0; i < nPGMExternalARMLen/2; i++) { UINT16 x = BURN_ENDIAN_SWAP_INT16(src[i]); - // preliminary! if ((i & 0x040080) != 0x000080) x ^= 0x0001; - if ((i & 0x084008) == 0x084008) x ^= 0x0002; + if ((i & 0x104008) == 0x104008) x ^= 0x0002; if ((i & 0x080030) == 0x080010) x ^= 0x0004; if ((i & 0x000242) != 0x000042) x ^= 0x0008; - if ((i & 0x048100) == 0x048000) x ^= 0x0010; + if ((i & 0x008100) == 0x008000) x ^= 0x0010; if ((i & 0x022004) != 0x000004) x ^= 0x0020; if ((i & 0x011800) != 0x010000) x ^= 0x0040; if ((i & 0x000820) == 0x000820) x ^= 0x0080; diff --git a/src/burn/drv/pgm/pgm_run.cpp b/src/burn/drv/pgm/pgm_run.cpp index 0427ad42f..9e40b3fd8 100644 --- a/src/burn/drv/pgm/pgm_run.cpp +++ b/src/burn/drv/pgm/pgm_run.cpp @@ -118,6 +118,7 @@ static INT32 pgmGetRoms(bool bLoad) UINT8 *PGMTileROMLoad = PGMTileROM + 0x180000; UINT8 *PGMSPRMaskROMLoad = PGMSPRMaskROM; UINT8 *PGMSNDROMLoad = ICSSNDROM + 0x400000; + UINT8 *PGMARMROMLoad = PGMARMROM; if (kov2 && bLoad) { PGMSNDROMLoad += 0x400000; @@ -200,7 +201,8 @@ static INT32 pgmGetRoms(bool bLoad) { if (bLoad) { if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { - BurnLoadRom(PGMARMROM, i, 1); + if (ri.nLen == 0x3e78) PGMARMROMLoad += 0x188; + BurnLoadRom(PGMARMROMLoad, i, 1); } } continue; @@ -210,7 +212,7 @@ static INT32 pgmGetRoms(bool bLoad) { if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { if (bLoad) { - BurnLoadRom(PGMUSER0, i, 1); + BurnLoadRom(PGMUSER0Load, i, 1); PGMUSER0Load += ri.nLen; } else { nPGMExternalARMLen += ri.nLen;