Previous 15994 Revisions Next

r10191 Tuesday 25th January, 2011 at 19:50:35 UTC by Tim Schuerewegen
[GBA] Added workaround for non-creation/use of per game NVRAM files for type FLASH. (aka "cheap hack 1")
[src/mess/drivers]gba.c

src/mess/drivers/gba.c
r10190r10191
5555      device_image_interface *image = dynamic_cast<device_image_interface *>(state->nvimage);
5656      image->battery_save(state->nvptr, state->nvsize);
5757   }
58
59   if (state->flash_size > 0)
60   {
61      device_image_interface *image = dynamic_cast<device_image_interface *>(state->nvimage);
62      UINT8 *nvram = auto_alloc_array( &machine, UINT8, state->flash_size);
63      for (int i = 0; i < state->flash_size; i++)
64      {
65         nvram[i] = state->mFlashDev->read_raw( i);
66      }
67      image->battery_save( nvram, state->flash_size);
68      auto_free( &machine, nvram);
69   }
5870}
5971
6072static PALETTE_INIT( gba )
r10190r10191
20952107        dac_signed_data_w(gb_a_r, 0x80);
20962108        dac_signed_data_w(gb_b_l, 0x80);
20972109        dac_signed_data_w(gb_b_r, 0x80);
2110
2111   if (state->flash_battery_load != 0)
2112   {
2113      device_image_interface *image = dynamic_cast<device_image_interface *>(state->nvimage);
2114      UINT8 *nvram = auto_alloc_array( machine, UINT8, state->flash_size);
2115      image->battery_load( nvram, state->flash_size, 0xff);
2116      for (int i = 0; i < state->flash_size; i++)
2117      {
2118         state->mFlashDev->write_raw( i, nvram[i]);
2119      }
2120      auto_free( machine, nvram);
2121      state->flash_battery_load = 0;
2122   }
20982123}
20992124
21002125static MACHINE_START( gba )
r10190r10191
25142539   state->nvsize = 0;
25152540   state->flash_size = 0;
25162541   state->nvptr = (UINT8 *)NULL;
2542    state->flash_battery_load = 0;
25172543
25182544   if (image.software_entry() == NULL)
25192545   {
r10190r10191
26172643         state->mFlashDev = image.device().machine->device<intelfsh8_device>("pflash");
26182644      else
26192645         state->mFlashDev = image.device().machine->device<intelfsh8_device>("sflash");
2646      state->flash_battery_load = 1;
2647      state->nvimage = image;
26202648   }
26212649
26222650   // mirror the ROM

Previous 15994 Revisions Next


© 1998-2018 The MESS Team