Previous 199869 Revisions Next

r21854 Thursday 14th March, 2013 at 14:17:12 UTC by Fabio Priuli
updated sgb_hack setup to avoid external access to m_cart. nw.
[src/mess/includes]gb.h
[src/mess/machine]gb.c gb_slot.c gb_slot.h

trunk/src/mess/machine/gb_slot.c
r21853r21854
142142                  device_t(mconfig, type, name, tag, owner, clock),
143143                  device_image_interface(mconfig, *this),
144144                  device_slot_interface(mconfig, *this),
145                  m_sgb_hack(0),
145146                  m_type(GB_MBC_UNKNOWN)
146147{
147148}
r21853r21854
386387
387388      internal_header_logging(ROM + offset, len);
388389
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     
389396      return IMAGE_INIT_PASS;
390397   }
391398
trunk/src/mess/machine/gb_slot.h
r21853r21854
122122   int get_type() { return m_type; }
123123   int get_cart_type(UINT8 *ROM, UINT32 len);
124124   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; }
125127
126128   void setup_ram(UINT8 banks);
127129   void internal_header_logging(UINT8 *ROM, UINT32 len);
r21853r21854
145147   virtual DECLARE_READ8_MEMBER(read_ram);
146148   virtual DECLARE_WRITE8_MEMBER(write_ram);
147149
148// TODO: check how to implement m_sgb_hack without accessing m_cart->m_rom
149//private:
150150   
151protected:
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
151155   int m_type;
152156   device_gb_cart_interface*       m_cart;
153157};
trunk/src/mess/machine/gb.c
r21853r21854
218218   memset(m_sgb_pal_map, 0, sizeof(m_sgb_pal_map));
219219   memset(m_sgb_atf_data, 0, sizeof(m_sgb_atf_data));
220220
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
233221   m_divcount = 0x0004;
234222}
235223
r21853r21854
782770                        {
783771                           int I;
784772                           UINT16 col;
785                           if( m_sgb_hack )
773                           if (m_cartslot && m_cartslot->get_sgb_hack())
786774                           {
787775                              memcpy( m_sgb_tile_map, m_lcd.gb_vram_ptr + 0x1000, 2048 );
788776                              for( I = 0; I < 64; I++ )
trunk/src/mess/includes/gb.h
r21853r21854
127127   UINT8 *m_sgb_tile_data;
128128   UINT8 m_sgb_tile_map[2048];
129129   UINT8 m_sgb_window_mask;
130   UINT8 m_sgb_hack;
131130   //gb_state driver_data;
132131   UINT8       m_gb_io[0x10];
133132

Previous 199869 Revisions Next


© 1997-2024 The MAME Team