mirror of
https://github.com/holub/mame
synced 2025-04-27 18:53:05 +03:00
updated sgb_hack setup to avoid external access to m_cart. nw.
This commit is contained in:
parent
19d98540e7
commit
d2d11bc7e5
@ -127,7 +127,6 @@ public:
|
||||
UINT8 *m_sgb_tile_data;
|
||||
UINT8 m_sgb_tile_map[2048];
|
||||
UINT8 m_sgb_window_mask;
|
||||
UINT8 m_sgb_hack;
|
||||
//gb_state driver_data;
|
||||
UINT8 m_gb_io[0x10];
|
||||
|
||||
|
@ -218,18 +218,6 @@ MACHINE_RESET_MEMBER(gb_state,sgb)
|
||||
memset(m_sgb_pal_map, 0, sizeof(m_sgb_pal_map));
|
||||
memset(m_sgb_atf_data, 0, sizeof(m_sgb_atf_data));
|
||||
|
||||
/* HACKS for Donkey Kong Land 2 + 3.
|
||||
For some reason that I haven't figured out, they store the tile
|
||||
data differently. Hacks will go once I figure it out */
|
||||
m_sgb_hack = 0;
|
||||
|
||||
if (m_cartslot->m_cart) // make sure cart is in
|
||||
{
|
||||
if (strncmp((const char*)(m_cartslot->m_cart->get_rom_base() + 0x134), "DONKEYKONGLAND 2", 16) == 0 ||
|
||||
strncmp((const char*)(m_cartslot->m_cart->get_rom_base() + 0x134), "DONKEYKONGLAND 3", 16) == 0)
|
||||
m_sgb_hack = 1;
|
||||
}
|
||||
|
||||
m_divcount = 0x0004;
|
||||
}
|
||||
|
||||
@ -782,7 +770,7 @@ WRITE8_MEMBER(gb_state::sgb_io_w)
|
||||
{
|
||||
int I;
|
||||
UINT16 col;
|
||||
if( m_sgb_hack )
|
||||
if (m_cartslot && m_cartslot->get_sgb_hack())
|
||||
{
|
||||
memcpy( m_sgb_tile_map, m_lcd.gb_vram_ptr + 0x1000, 2048 );
|
||||
for( I = 0; I < 64; I++ )
|
||||
|
@ -142,6 +142,7 @@ base_gb_cart_slot_device::base_gb_cart_slot_device(const machine_config &mconfig
|
||||
device_t(mconfig, type, name, tag, owner, clock),
|
||||
device_image_interface(mconfig, *this),
|
||||
device_slot_interface(mconfig, *this),
|
||||
m_sgb_hack(0),
|
||||
m_type(GB_MBC_UNKNOWN)
|
||||
{
|
||||
}
|
||||
@ -386,6 +387,12 @@ bool base_gb_cart_slot_device::call_load()
|
||||
|
||||
internal_header_logging(ROM + offset, len);
|
||||
|
||||
// Hack to support Donkey Kong Land 2 + 3 in SGB
|
||||
// For some reason, these store the tile data differently. Hacks will go once it's been figured out
|
||||
if (strncmp((const char*)(ROM + 0x134), "DONKEYKONGLAND 2", 16) == 0 ||
|
||||
strncmp((const char*)(ROM + 0x134), "DONKEYKONGLAND 3", 16) == 0)
|
||||
m_sgb_hack = 1;
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
|
@ -122,6 +122,8 @@ public:
|
||||
int get_type() { return m_type; }
|
||||
int get_cart_type(UINT8 *ROM, UINT32 len);
|
||||
bool get_mmm01_candidate(UINT8 *ROM, UINT32 len);
|
||||
// remove me when SGB is properly emulated
|
||||
int get_sgb_hack() { return m_sgb_hack; }
|
||||
|
||||
void setup_ram(UINT8 banks);
|
||||
void internal_header_logging(UINT8 *ROM, UINT32 len);
|
||||
@ -145,9 +147,11 @@ public:
|
||||
virtual DECLARE_READ8_MEMBER(read_ram);
|
||||
virtual DECLARE_WRITE8_MEMBER(write_ram);
|
||||
|
||||
// TODO: check how to implement m_sgb_hack without accessing m_cart->m_rom
|
||||
//private:
|
||||
|
||||
protected:
|
||||
// Donkey Kong Land 2 + 3 store SGB border tiles differently... this will be hopefully be removed when SGB is properly emulated!
|
||||
int m_sgb_hack;
|
||||
|
||||
int m_type;
|
||||
device_gb_cart_interface* m_cart;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user