trunk/src/mess/machine/gb_slot.c
| r21853 | r21854 | |
| 142 | 142 | device_t(mconfig, type, name, tag, owner, clock), |
| 143 | 143 | device_image_interface(mconfig, *this), |
| 144 | 144 | device_slot_interface(mconfig, *this), |
| 145 | m_sgb_hack(0), |
| 145 | 146 | m_type(GB_MBC_UNKNOWN) |
| 146 | 147 | { |
| 147 | 148 | } |
| r21853 | r21854 | |
| 386 | 387 | |
| 387 | 388 | internal_header_logging(ROM + offset, len); |
| 388 | 389 | |
| 390 | // Hack to support Donkey Kong Land 2 + 3 in SGB |
| 391 | // For some reason, these store the tile data differently. Hacks will go once it's been figured out |
| 392 | if (strncmp((const char*)(ROM + 0x134), "DONKEYKONGLAND 2", 16) == 0 || |
| 393 | strncmp((const char*)(ROM + 0x134), "DONKEYKONGLAND 3", 16) == 0) |
| 394 | m_sgb_hack = 1; |
| 395 | |
| 389 | 396 | return IMAGE_INIT_PASS; |
| 390 | 397 | } |
| 391 | 398 | |
trunk/src/mess/machine/gb_slot.h
| r21853 | r21854 | |
| 122 | 122 | int get_type() { return m_type; } |
| 123 | 123 | int get_cart_type(UINT8 *ROM, UINT32 len); |
| 124 | 124 | bool get_mmm01_candidate(UINT8 *ROM, UINT32 len); |
| 125 | // remove me when SGB is properly emulated |
| 126 | int get_sgb_hack() { return m_sgb_hack; } |
| 125 | 127 | |
| 126 | 128 | void setup_ram(UINT8 banks); |
| 127 | 129 | void internal_header_logging(UINT8 *ROM, UINT32 len); |
| r21853 | r21854 | |
| 145 | 147 | virtual DECLARE_READ8_MEMBER(read_ram); |
| 146 | 148 | virtual DECLARE_WRITE8_MEMBER(write_ram); |
| 147 | 149 | |
| 148 | | // TODO: check how to implement m_sgb_hack without accessing m_cart->m_rom |
| 149 | | //private: |
| 150 | 150 | |
| 151 | protected: |
| 152 | // Donkey Kong Land 2 + 3 store SGB border tiles differently... this will be hopefully be removed when SGB is properly emulated! |
| 153 | int m_sgb_hack; |
| 154 | |
| 151 | 155 | int m_type; |
| 152 | 156 | device_gb_cart_interface* m_cart; |
| 153 | 157 | }; |
trunk/src/mess/machine/gb.c
| r21853 | r21854 | |
| 218 | 218 | memset(m_sgb_pal_map, 0, sizeof(m_sgb_pal_map)); |
| 219 | 219 | memset(m_sgb_atf_data, 0, sizeof(m_sgb_atf_data)); |
| 220 | 220 | |
| 221 | | /* HACKS for Donkey Kong Land 2 + 3. |
| 222 | | For some reason that I haven't figured out, they store the tile |
| 223 | | data differently. Hacks will go once I figure it out */ |
| 224 | | m_sgb_hack = 0; |
| 225 | | |
| 226 | | if (m_cartslot->m_cart) // make sure cart is in |
| 227 | | { |
| 228 | | if (strncmp((const char*)(m_cartslot->m_cart->get_rom_base() + 0x134), "DONKEYKONGLAND 2", 16) == 0 || |
| 229 | | strncmp((const char*)(m_cartslot->m_cart->get_rom_base() + 0x134), "DONKEYKONGLAND 3", 16) == 0) |
| 230 | | m_sgb_hack = 1; |
| 231 | | } |
| 232 | | |
| 233 | 221 | m_divcount = 0x0004; |
| 234 | 222 | } |
| 235 | 223 | |
| r21853 | r21854 | |
| 782 | 770 | { |
| 783 | 771 | int I; |
| 784 | 772 | UINT16 col; |
| 785 | | if( m_sgb_hack ) |
| 773 | if (m_cartslot && m_cartslot->get_sgb_hack()) |
| 786 | 774 | { |
| 787 | 775 | memcpy( m_sgb_tile_map, m_lcd.gb_vram_ptr + 0x1000, 2048 ); |
| 788 | 776 | for( I = 0; I < 64; I++ ) |