trunk/src/mess/machine/gb.c
| r18394 | r18395 | |
| 1608 | 1608 | |
| 1609 | 1609 | /* Claim memory */ |
| 1610 | 1610 | state->m_gb_cart = auto_alloc_array(image.device().machine(), UINT8, filesize); |
| 1611 | state->m_MBCType = MBC_UNKNOWN; |
| 1612 | state->m_CartType = 0; |
| 1611 | 1613 | |
| 1612 | 1614 | if (image.software_entry() == NULL) |
| 1613 | 1615 | { |
| r18394 | r18395 | |
| 1622 | 1624 | } |
| 1623 | 1625 | } |
| 1624 | 1626 | else |
| 1627 | { |
| 1625 | 1628 | memcpy(state->m_gb_cart, image.get_software_region("rom") + load_start, filesize); |
| 1626 | 1629 | |
| 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 | |
| 1627 | 1679 | gb_header = state->m_gb_cart; |
| 1628 | 1680 | state->m_ROMBank00 = 0; |
| 1629 | 1681 | |