Previous 15994 Revisions Next

r5495 Sunday 23rd August, 2009 at 15:14:42 UTC by Robbbert
[JAGUAR] Fixed access violation when no cart loaded (regression from last change).
[src/mess/drivers]jaguar.c

src/mess/drivers/jaguar.c
r5494r5495
157157   astring *fname;
158158   file_error filerr;
159159   mame_file *file;
160   fname = astring_assemble_4( astring_alloc(), machine->gamedrv->name, PATH_SEPARATOR, image_basename_noext(image), ".nv");
161   filerr = mame_fopen( SEARCHPATH_NVRAM, astring_c( fname), openflags, &file);
162   astring_free( fname);
163   return (filerr == FILERR_NONE) ? file : NULL;
160   if (image_exists(image))
161   {
162      fname = astring_assemble_4( astring_alloc(), machine->gamedrv->name, PATH_SEPARATOR, image_basename_noext(image), ".nv");
163      filerr = mame_fopen( SEARCHPATH_NVRAM, astring_c( fname), openflags, &file);
164      astring_free( fname);
165      return (filerr == FILERR_NONE) ? file : NULL;
166   }
167   else
168      return NULL;
164169}
165170
166171static void jaguar_nvram_load(running_machine *machine)
r5494r5495
171176   if (machine->config->nvram_handler != NULL)
172177   {
173178      nvram_file = jaguar_nvram_fopen(machine, OPEN_FLAG_READ);
174      eeprom_load(nvram_file);
179      if (nvram_file) eeprom_load(nvram_file);
175180   }
176181
177182   for (device = machine->config->devicelist; device != NULL; device = device->next)
r5494r5495
198203   if (machine->config->nvram_handler != NULL)
199204   {
200205      nvram_file = jaguar_nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
201      eeprom_save(nvram_file);
206      if (nvram_file) eeprom_save(nvram_file);
202207   }
203208
204209   for (device = machine->config->devicelist; device != NULL; device = device->next)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team