Previous 199869 Revisions Next

r34621 Monday 26th January, 2015 at 17:15:41 UTC by David Haywood
kill old sim code (nw)
[src/mame/drivers]model2.c model3.c
[src/mame/includes]model3.h

trunk/src/mame/drivers/model2.c
r243132r243133
12221222
12231223/* Protection handling */
12241224
1225static const UINT8 ZGUNProt[] =
1226{
1227   0x7F,0x4E,0x1B,0x1E,0xA8,0x48,0xF5,0x49,0x31,0x32,0x4A,0x09,0x89,0x29,0xC0,0x41,
1228   0x3A,0x49,0x85,0x24,0xA0,0x4D,0x21,0x31,0xEA,0xC3,0x3F,0xAF,0x0E,0x4B,0x25,0x02,
1229   0xFB,0x0F,0x44,0x55,0x2E,0x82,0x55,0xC3,0xCB,0x91,0x52,0x7E,0x72,0x53,0xF2,0xAA,
1230   0x39,0x19,0xB1,0x42,0x33,0x63,0x13,0xFA,0x39,0x9C,0xE0,0x53,0x93,0x8B,0x14,0x91,
1231   0x9D,0x1C,0xFE,0x52,0x59,0xD4,0x2A,0x6A,0xA3,0xC5,0xA0,0xCA,0x92,0x5A,0x58,0xAC,
1232   0x95,0x4A,0x19,0x89,0x65,0xD3,0xA8,0x4A,0xE3,0xCE,0x8D,0x89,0xC5,0x48,0x95,0xE4,
1233   0x94,0xD5,0x73,0x09,0xE4,0x3D,0x2D,0x92,0xC9,0xA7,0xA3,0x53,0x42,0x82,0x55,0x67,
1234   0xE4,0x66,0xD0,0x4A,0x7D,0x4A,0x13,0xDE,0xD7,0x9F,0x38,0xAA,0x00,0x56,0x85,0x0A
1235};
12361225
1237
1238
12391226READ32_MEMBER(model2_state::model2_5881prot_r)
12401227{
12411228   UINT32 retval = 0;
r243132r243133
59045891
59055892DRIVER_INIT_MEMBER(model2_state,genprot)
59065893{   
5907   astring key = parameter(":315_5881:key");
5908
5894   //astring key = parameter(":315_5881:key");
59095895   m_maincpu->space(AS_PROGRAM).install_ram(0x01d80000, 0x01d8ffff);
59105896   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x01d90000, 0x01d9ffff, read32_delegate(FUNC(model2_state::model2_5881prot_r), this), write32_delegate(FUNC(model2_state::model2_5881prot_w), this));
5911
59125897}
59135898
59145899DRIVER_INIT_MEMBER(model2_state,pltkids)
trunk/src/mame/drivers/model3.c
r243132r243133
664664#include "machine/nvram.h"
665665#include "includes/model3.h"
666666
667//#define DECRYPT_ANALYSIS_HACKS
668667
669#ifdef DECRYPT_ANALYSIS_HACKS
670int readcount = 0;
671int segcount = 0;
672#endif
673668
674669void model3_state::update_irq_state()
675670{
r243132r243133
16801675
16811676
16821677
1683
1684static const UINT16 fvipers2_prot_data[] =
1685{
1686   0x2a2a,
1687   0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a, 0x202a, 0x5b5b,
1688   0x4620, 0x6769, 0x7468, 0x6e69, 0x2067, 0x6956, 0x6570, 0x7372,
1689   0x3220, 0x5d20, 0x205d, 0x6e69, 0x3c20, 0x4d3c, 0x444f, 0x4c45,
1690   0x332d, 0x3e3e, 0x4320, 0x706f, 0x7279, 0x6769, 0x7468, 0x2820,
1691   0x2943, 0x3931, 0x3839, 0x5320, 0x4745, 0x2041, 0x6e45, 0x6574,
1692   0x7072, 0x6972, 0x6573, 0x2c73, 0x544c, 0x2e44, 0x2020, 0x4120,
1693   0x6c6c, 0x7220, 0x6769, 0x7468, 0x7220, 0x7365, 0x7265, 0x6576,
1694   0x2e64, 0x2a20, 0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a,
1695};
1696
1697
1698
1699
1700READ64_MEMBER(model3_state::model3_security_r)
1701{
1702   UINT64 retvalue = U64(0xffffffffffffffff);
1703
1704   switch(offset)
1705   {
1706      case 0x00 / 8:    retvalue = 0; break;       /* status */
1707      case 0x1c/8:                    /* security board data read */
1708      {
1709         #ifdef DECRYPT_ANALYSIS_HACKS
1710         readcount += 2;
1711         printf("model3_security_r offset %08x : %08x%08x (%08x%08x) count %08x\n", offset * 8, (UINT32)(retvalue >> 32), (UINT32)(retvalue & 0xffffffff), (UINT32)(mem_mask >> 32), (UINT32)(mem_mask & 0xffffffff), readcount);
1712         #endif
1713         
1714         if (core_stricmp(machine().system().name, "fvipers2") == 0)
1715         {
1716            UINT64 data = (UINT64)fvipers2_prot_data[m_prot_data_ptr++] << 16;
1717            if (m_prot_data_ptr >= 0x41)
1718            {
1719               m_prot_data_ptr = 0;
1720            }
1721            retvalue = data;
1722         }
1723         else
1724         {
1725            retvalue = 0;
1726         }
1727         break;
1728      }
1729   }
1730
1731   return retvalue;
1732}
1733
1734
1735
1736WRITE64_MEMBER(model3_state::model3_security_w)
1737{
1738   if (offset == 0x10 / 8)
1739   {
1740      if (data != 0)
1741         printf("model3_security_w address isn't 0?\n");
1742
1743      first_read = 1;
1744
1745      printf("setting base %08x%08x\n",  (UINT32)(data >> 32), (UINT32)(data & 0xffffffff));
1746   }
1747   else if (offset == 0x18 / 8)
1748   {
1749      UINT16 subkey = data >> (32 + 16);
1750      subkey = ((subkey & 0xff00) >> 8) | ((subkey & 0x00ff) << 8); // endian swap the sub-key for this hardware
1751      printf("model3_5881prot_w setting subkey %04x\n", subkey);
1752
1753#ifdef DECRYPT_ANALYSIS_HACKS // dump out a copy of protection RAM
1754      FILE* fp2;
1755      char filename[256];
1756      sprintf(filename,"xxxencrypted_%s_part%d", machine().system().name, segcount);
1757      segcount++;
1758      readcount = 0;
1759      fp2 = fopen(filename, "w+b");
1760
1761      {
1762         for (int i = 0; i < 0x8000; i++)
1763         {
1764            UINT16 dat = m_maincpu->space().read_word((0xf0180000 + 4 * i));
1765            UINT8* dst2 = (UINT8*)&dat;
1766            fwrite(&dst2[1], 1, 1, fp2);
1767            fwrite(&dst2[0], 1, 1, fp2);
1768         }
1769
1770      }
1771      fclose(fp2);
1772#endif
1773
1774   }
1775   else
1776   {
1777      printf("model3_5881prot_w offset %08x : %08x%08x (%08x%08x)\n", offset * 8, (UINT32)(data >> 32), (UINT32)(data & 0xffffffff), (UINT32)(mem_mask >> 32), (UINT32)(mem_mask & 0xffffffff));
1778   }
1779}
1780
17811678READ64_MEMBER(model3_state::model3_5881prot_r)
17821679{
17831680   UINT64 retvalue = U64(0xffffffffffffffff);
r243132r243133
57325629
57335630DRIVER_INIT_MEMBER(model3_state, genprot)
57345631{
5735   astring key = parameter(":315_5881:key");
5632//   astring key = parameter(":315_5881:key");
57365633
57375634   m_maincpu->space(AS_PROGRAM).install_ram(0xf0180000, 0xf019ffff, 0, 0x0e000000);
57385635
5739   if (key)
5740   {
5741      m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xf01a0000, 0xf01a003f, 0, 0x0e000000, read64_delegate(FUNC(model3_state::model3_5881prot_r), this), write64_delegate(FUNC(model3_state::model3_5881prot_w), this) );                   
5742   }
5743   else
5744   {
5745      m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xf01a0000, 0xf01a003f, 0, 0x0e000000, read64_delegate(FUNC(model3_state::model3_security_r), this), write64_delegate(FUNC(model3_state::model3_security_w), this) );                   
5746   }
5636   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xf01a0000, 0xf01a003f, 0, 0x0e000000, read64_delegate(FUNC(model3_state::model3_5881prot_r), this), write64_delegate(FUNC(model3_state::model3_5881prot_w), this) );                   
5637
57475638}
57485639
57495640DRIVER_INIT_MEMBER(model3_state,model3_10)
trunk/src/mame/includes/model3.h
r243132r243133
230230   DECLARE_WRITE8_MEMBER(model3_sound_w);
231231   DECLARE_READ64_MEMBER(network_r);
232232   DECLARE_WRITE64_MEMBER(network_w);
233   DECLARE_READ64_MEMBER(model3_security_r);
234   DECLARE_WRITE64_MEMBER(model3_security_w);
235233
236
237234   DECLARE_WRITE64_MEMBER(daytona2_rombank_w);
238235   DECLARE_WRITE16_MEMBER(model3snd_ctrl);
239236   UINT32 pci_device_get_reg();


Previous 199869 Revisions Next


© 1997-2024 The MAME Team