Previous 199869 Revisions Next

r32328 Tuesday 23rd September, 2014 at 20:27:21 UTC by Fabio Priuli
(MESS) analogous multisession fix to other systems suffering for the
same problem. weirdly enough other systems (nes, pce, a2600, a7800...)
does seem immune to the problem. nw.
[src/emu/bus/gba]gba_slot.c gba_slot.h
[src/emu/bus/megadrive]md_slot.c md_slot.h
[src/emu/bus/sega8]sega8_slot.c sega8_slot.h
[src/emu/bus/snes]snes_slot.c snes_slot.h
[src/mess/drivers]gba.c megadriv.c sg1000.c snes.c
[src/mess/machine]sms.c

trunk/src/emu/bus/gba/gba_slot.c
r32327r32328
4747void device_gba_cart_interface::nvram_alloc(UINT32 size)
4848{
4949   m_nvram.resize(size/sizeof(UINT32));
50   device().save_item(NAME(m_nvram));
5150}
5251
5352
trunk/src/emu/bus/gba/gba_slot.h
r32327r32328
4141   UINT32 get_nvram_size() { return m_nvram.bytes(); }
4242   void set_rom_size(UINT32 val) { m_rom_size = val; }
4343
44   void save_nvram()   { device().save_item(NAME(m_nvram)); }
45
4446   // internal state
4547   UINT32 *m_rom;  // this points to the cart rom region
4648   dynamic_array<UINT32> m_nvram;
r32327r32328
7678   void setup_ram(UINT8 banks);
7779   void internal_header_logging(UINT8 *ROM, UINT32 len);
7880
81   void save_nvram()   { if (m_cart && m_cart->get_nvram_size()) m_cart->save_nvram(); }
82
7983   virtual iodevice_t image_type() const { return IO_CARTSLOT; }
8084   virtual bool is_readable()  const { return 1; }
8185   virtual bool is_writeable() const { return 0; }
trunk/src/emu/bus/sega8/sega8_slot.c
r32327r32328
8787void device_sega8_cart_interface::ram_alloc(UINT32 size)
8888{
8989   m_ram.resize(size);
90   device().save_item(NAME(m_ram));
9190}
9291
9392
trunk/src/emu/bus/sega8/sega8_slot.h
r32327r32328
7272   void rom_map_setup(UINT32 size);
7373   void ram_map_setup(UINT8 banks);
7474
75   void save_ram() { device().save_item(NAME(m_ram)); }
76
7577//private:
7678   // internal state
7779   dynamic_buffer m_rom;
r32327r32328
118120   int verify_cart(UINT8 *magic, int size);
119121   void set_lphaser_xoffset(UINT8 *rom, int size);
120122
123   void save_ram()   { if (m_cart && m_cart->get_ram_size()) m_cart->save_ram(); }
124
121125   void set_mandatory(bool val) { m_must_be_loaded = val; }
122126   void set_intf(const char * interface) { m_interface = interface; }
123127   void set_ext(const char * extensions) { m_extensions = extensions; }
trunk/src/emu/bus/snes/snes_slot.h
r32327r32328
125125   UINT32 get_rtc_ram_size() { return m_rtc_ram.count(); };
126126
127127   void rom_map_setup(UINT32 size);
128   void save_nvram()   { device().save_item(NAME(m_nvram)); }
129   void save_rtc_ram()   { device().save_item(NAME(m_rtc_ram)); }
128130
129131   // internal state
130132   dynamic_buffer m_rom;
r32327r32328
163165   void setup_nvram();
164166   void internal_header_logging(UINT8 *ROM, UINT32 len);
165167
168   void save_ram()   { if (m_cart && m_cart->get_nvram_size()) m_cart->save_nvram();
169               if (m_cart && m_cart->get_rtc_ram_size()) m_cart->save_rtc_ram(); }
170
166171   virtual iodevice_t image_type() const { return IO_CARTSLOT; }
167172   virtual bool is_readable()  const { return 1; }
168173   virtual bool is_writeable() const { return 0; }
trunk/src/emu/bus/snes/snes_slot.c
r32327r32328
9797void device_sns_cart_interface::nvram_alloc(UINT32 size)
9898{
9999   m_nvram.resize(size);
100   device().save_item(NAME(m_nvram));
101100}
102101
103102
r32327r32328
111110void device_sns_cart_interface::rtc_ram_alloc(UINT32 size)
112111{
113112   m_rtc_ram.resize(size);
114   device().save_item(NAME(m_rtc_ram));
115113}
116114
117115
trunk/src/emu/bus/megadrive/md_slot.c
r32327r32328
9999void device_md_cart_interface::nvram_alloc(size_t size)
100100{
101101   m_nvram.resize(size/sizeof(UINT16));
102   device().save_item(NAME(m_nvram));
103102}
104103
105104//-------------------------------------------------
trunk/src/emu/bus/megadrive/md_slot.h
r32327r32328
108108   virtual UINT32 get_nvram_size() { return m_nvram.bytes(); };
109109   virtual void set_bank_to_rom(const char *banktag, UINT32 offset) {};
110110
111   void save_nvram() { device().save_item(NAME(m_nvram)); }
112
111113   void rom_map_setup(UINT32 size);
112114   UINT32 get_padded_size(UINT32 size);
113115
r32327r32328
170172   void set_must_be_loaded(bool _must_be_loaded) { m_must_be_loaded = _must_be_loaded; }
171173   void file_logging(UINT8 *ROM, UINT32 rom_len, UINT32 nvram_len);
172174
175   void save_nvram() { if (m_cart && m_cart->get_nvram_size()) m_cart->save_nvram(); }
176
173177   // reading and writing
174178   virtual DECLARE_READ16_MEMBER(read);
175179   virtual DECLARE_WRITE16_MEMBER(write);
trunk/src/mess/drivers/snes.c
r32327r32328
19321932      save_item(NAME(m_scope[i].fire_lock), i);
19331933      save_item(NAME(m_scope[i].offscreen), i);
19341934   }
1935
1936   if (m_cartslot)
1937      m_cartslot->save_ram();
19351938}
19361939
19371940void snes_console_state::machine_reset()
trunk/src/mess/drivers/sg1000.c
r32327r32328
638638      m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xffff, 0, 0, read8_delegate(FUNC(sega8_cart_slot_device::read_ram),(sega8_cart_slot_device*)m_cartslot));
639639      m_maincpu->space(AS_PROGRAM).install_write_handler(0xc000, 0xffff, 0, 0, write8_delegate(FUNC(sega8_cart_slot_device::write_ram),(sega8_cart_slot_device*)m_cartslot));
640640   }
641
642   if (m_cartslot)
643      m_cartslot->save_ram();
641644}
642645
643646/*-------------------------------------------------
r32327r32328
676679      m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xffff, 0, 0, read8_delegate(FUNC(sega8_cart_slot_device::read_ram),(sega8_cart_slot_device*)m_cartslot));
677680      m_maincpu->space(AS_PROGRAM).install_write_handler(0xc000, 0xffff, 0, 0, write8_delegate(FUNC(sega8_cart_slot_device::write_ram),(sega8_cart_slot_device*)m_cartslot));
678681   }
682
683   if (m_cartslot)
684      m_cartslot->save_ram();
679685}
680686
681687
trunk/src/mess/drivers/gba.c
r32327r32328
21212121   // install the cart ROM into the address map, if present
21222122   m_cartslot->install_rom();
21232123
2124   // add nvram to save state
2125   m_cartslot->save_nvram();
2126
21242127   // install the cart NVRAM handlers if necessary
21252128   if (m_cartslot->get_type() == GBA_SRAM)
21262129   {
trunk/src/mess/drivers/megadriv.c
r32327r32328
265265      m_io_timeout[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(md_base_state::io_timeout_timer_callback),this), (void*)(FPTR)i);
266266
267267   m_vdp->stop_timers();
268
269   if (m_slotcart)
270      m_slotcart->save_nvram();
268271}
269272
270273MACHINE_START_MEMBER(md_cons_state, ms_megadriv)
trunk/src/mess/machine/sms.c
r32327r32328
831831         m_cards[i] = machine().device<sega8_card_slot_device>(str);
832832      }
833833   }
834
835   if (m_cartslot)
836      m_cartslot->save_ram();
834837}
835838
836839MACHINE_RESET_MEMBER(sms_state,sms)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team