src/mess/drivers/jaguar.c
| r5494 | r5495 | |
| 157 | 157 | astring *fname; |
| 158 | 158 | file_error filerr; |
| 159 | 159 | 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; |
| 164 | 169 | } |
| 165 | 170 | |
| 166 | 171 | static void jaguar_nvram_load(running_machine *machine) |
| r5494 | r5495 | |
| 171 | 176 | if (machine->config->nvram_handler != NULL) |
| 172 | 177 | { |
| 173 | 178 | nvram_file = jaguar_nvram_fopen(machine, OPEN_FLAG_READ); |
| 174 | | eeprom_load(nvram_file); |
| 179 | if (nvram_file) eeprom_load(nvram_file); |
| 175 | 180 | } |
| 176 | 181 | |
| 177 | 182 | for (device = machine->config->devicelist; device != NULL; device = device->next) |
| r5494 | r5495 | |
| 198 | 203 | if (machine->config->nvram_handler != NULL) |
| 199 | 204 | { |
| 200 | 205 | 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); |
| 202 | 207 | } |
| 203 | 208 | |
| 204 | 209 | for (device = machine->config->devicelist; device != NULL; device = device->next) |