Previous 199869 Revisions Next

r18395 Tuesday 9th October, 2012 at 20:10:50 UTC by Wilbert Pol
(MESS) gameboy.c: Added parsing of new software list features. Auto-detect still executes until cartridge ram and sram settings are finalized. (nw)
[src/mess/machine]gb.c

trunk/src/mess/machine/gb.c
r18394r18395
16081608
16091609   /* Claim memory */
16101610   state->m_gb_cart = auto_alloc_array(image.device().machine(), UINT8, filesize);
1611   state->m_MBCType = MBC_UNKNOWN;
1612   state->m_CartType = 0;
16111613
16121614   if (image.software_entry() == NULL)
16131615   {
r18394r18395
16221624      }
16231625   }
16241626   else
1627   {
16251628      memcpy(state->m_gb_cart, image.get_software_region("rom") + load_start, filesize);
16261629
1630      const char *mapper = software_part_get_feature((software_part*)image.part_entry(), "mapper");
1631      const char *rumble = software_part_get_feature((software_part*)image.part_entry(), "rumble");
1632      const char *battery_backed = software_part_get_feature((software_part*)image.part_entry(), "battery_backed");
1633
1634      if ( mapper != NULL )
1635      {
1636         static const struct { const char *mapper_name; int mapper_type; } mapper_types[] =
1637         {
1638            { "MBC1",     MBC_MBC1 },
1639            { "MBC2",     MBC_MBC2 },
1640            { "MMM01",    MBC_MMM01 },
1641            { "MBC3",     MBC_MBC3 },
1642            { "MBC4",     MBC_MBC4 },
1643            { "MBC5",     MBC_MBC5 },
1644            { "TAMA5",    MBC_TAMA5 },
1645            { "HuC1",     MBC_HUC1 },
1646            { "HuC3",     MBC_HUC3 },
1647            { "MBC6",     MBC_MBC6 },
1648            { "MBC7",     MBC_MBC7 },
1649            { "WISDOM",   MBC_WISDOM },
1650            { "MBC1_KOR", MBC_MBC1_KOR },
1651         };
1652
1653         for (int i = 0; i < ARRAY_LENGTH(mapper_types) && state->m_MBCType == MBC_UNKNOWN; i++)
1654         {
1655            if (!mame_stricmp(mapper, mapper_types[i].mapper_name))
1656            {
1657               state->m_MBCType = mapper_types[i].mapper_type;
1658            }
1659         }
1660      }
1661
1662      if ( rumble != NULL )
1663      {
1664         if ( !mame_stricmp(rumble, "yes"))
1665         {
1666            state->m_CartType |= RUMBLE;
1667         }
1668      }
1669
1670      if ( battery_backed != NULL )
1671      {
1672         if ( !mame_stricmp(battery_backed, "yes"))
1673         {
1674            state->m_CartType |= BATTERY;
1675         }
1676      }
1677   }
1678
16271679   gb_header = state->m_gb_cart;
16281680   state->m_ROMBank00 = 0;
16291681

Previous 199869 Revisions Next


© 1997-2024 The MAME Team