src/mess/devices/cartslot.c
| r7092 | r7093 | |
| 327 | 327 | static const cartslot_pcb_type *identify_pcb(const device_config *device) |
| 328 | 328 | { |
| 329 | 329 | const cartslot_config *config = get_config(device); |
| 330 | | astring *pcb_name = astring_alloc(); |
| 330 | astring pcb_name; |
| 331 | 331 | const cartslot_pcb_type *pcb_type = NULL; |
| 332 | 332 | multicart_t *mc; |
| 333 | 333 | int i; |
| r7092 | r7093 | |
| 339 | 339 | if (me == MCERR_NONE) |
| 340 | 340 | { |
| 341 | 341 | /* this was a multicart - read from it */ |
| 342 | | astring_cpyc(pcb_name, mc->pcb_type); |
| 342 | astring_cpyc(&pcb_name, mc->pcb_type); |
| 343 | 343 | multicart_close(mc); |
| 344 | 344 | } |
| 345 | 345 | else |
| r7092 | r7093 | |
| 349 | 349 | if (image_pcb(device) != NULL) |
| 350 | 350 | { |
| 351 | 351 | /* read from hash file */ |
| 352 | | astring_cpyc(pcb_name, image_pcb(device)); |
| 352 | astring_cpyc(&pcb_name, image_pcb(device)); |
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | /* look for PCB type with matching name */ |
| 357 | 357 | for (i = 0; (i < ARRAY_LENGTH(config->pcb_types)) && (config->pcb_types[i].name != NULL); i++) |
| 358 | 358 | { |
| 359 | | if ((config->pcb_types[i].name[0] == '\0') || !strcmp(astring_c(pcb_name), config->pcb_types[i].name)) |
| 359 | if ((config->pcb_types[i].name[0] == '\0') || !strcmp(astring_c(&pcb_name), config->pcb_types[i].name)) |
| 360 | 360 | { |
| 361 | 361 | pcb_type = &config->pcb_types[i]; |
| 362 | 362 | break; |
| r7092 | r7093 | |
| 365 | 365 | |
| 366 | 366 | /* check for unknown PCB type */ |
| 367 | 367 | if ((mc != NULL) && (pcb_type == NULL)) |
| 368 | | fatalerror("Unknown PCB type \"%s\"\n", astring_c(pcb_name)); |
| 368 | fatalerror("Unknown PCB type \"%s\"\n", astring_c(&pcb_name)); |
| 369 | 369 | } |
| 370 | 370 | else |
| 371 | 371 | { |
src/mess/devices/messram.c
| r7092 | r7093 | |
| 191 | 191 | { |
| 192 | 192 | const char *s; |
| 193 | 193 | |
| 194 | | astring *buffer = astring_alloc(); |
| 195 | | astring_cpyc(buffer, config->extra_options); |
| 196 | | astring_replacechr(buffer, ',', 0); |
| 194 | astring buffer; |
| 195 | astring_cpyc(&buffer, config->extra_options); |
| 196 | astring_replacechr(&buffer, ',', 0); |
| 197 | 197 | |
| 198 | | s = astring_c(buffer); |
| 198 | s = astring_c(&buffer); |
| 199 | 199 | |
| 200 | 200 | /* try to parse each option */ |
| 201 | 201 | while(*s != '\0') |
| r7092 | r7093 | |
| 213 | 213 | |
| 214 | 214 | s += strlen(s) + 1; |
| 215 | 215 | } |
| 216 | | |
| 217 | | astring_free(buffer); |
| 218 | 216 | } |
| 219 | 217 | |
| 220 | 218 | } else { |
src/mess/devices/multcart.c
| r7092 | r7093 | |
| 242 | 242 | { |
| 243 | 243 | if (strcmp(ram_type, "persistent")==0) |
| 244 | 244 | { |
| 245 | astring tmp; |
| 246 | |
| 245 | 247 | /* Get the file name. */ |
| 246 | 248 | ram_filename = xml_get_attribute_string(resource_node, "file", NULL); |
| 247 | 249 | if (ram_filename==NULL) |
| 248 | 250 | return MCERR_XML_ERROR; |
| 249 | 251 | |
| 250 | | ram_pathname = astring_assemble_3(astring_alloc(), state->multicart->gamedrv_name, PATH_SEPARATOR, ram_filename); |
| 252 | ram_pathname = astring_assemble_3(&tmp, state->multicart->gamedrv_name, PATH_SEPARATOR, ram_filename); |
| 251 | 253 | |
| 252 | 254 | /* Save the file name so that we can write the contents on unloading. |
| 253 | 255 | If the RAM resource has no filename, we know that it was volatile only. */ |
src/mess/tapectrl.c
| r7092 | r7093 | |
| 92 | 92 | |
| 93 | 93 | static void menu_tape_control_populate(running_machine *machine, ui_menu *menu, tape_control_menu_state *menustate) |
| 94 | 94 | { |
| 95 | | astring *timepos = astring_alloc(); |
| 95 | astring timepos; |
| 96 | 96 | cassette_state state; |
| 97 | 97 | int count = cassette_count(machine); |
| 98 | 98 | UINT32 flags = 0; |
| r7092 | r7093 | |
| 111 | 111 | ui_menu_item_append(menu, image_typename_id(menustate->device), image_filename(menustate->device), flags, NULL); |
| 112 | 112 | |
| 113 | 113 | /* state */ |
| 114 | | tapecontrol_gettime(timepos, menustate->device, NULL, NULL); |
| 114 | tapecontrol_gettime(&timepos, menustate->device, NULL, NULL); |
| 115 | 115 | state = cassette_get_state(menustate->device); |
| 116 | 116 | ui_menu_item_append( |
| 117 | 117 | menu, |
| r7092 | r7093 | |
| 121 | 121 | ? ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? UI_playing : UI_playing_inhibited) |
| 122 | 122 | : ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? UI_recording : UI_recording_inhibited) |
| 123 | 123 | )), |
| 124 | | astring_c(timepos), |
| 124 | astring_c(&timepos), |
| 125 | 125 | 0, |
| 126 | 126 | NULL); |
| 127 | 127 | |
| r7092 | r7093 | |
| 145 | 145 | /* no tape loaded */ |
| 146 | 146 | ui_menu_item_append(menu, ui_getstring(UI_notapeimageloaded), NULL, flags, NULL); |
| 147 | 147 | } |
| 148 | | |
| 149 | | if (timepos != NULL) |
| 150 | | astring_free(timepos); |
| 151 | 148 | } |
| 152 | 149 | |
| 153 | 150 | |
src/mess/image.c
| r7092 | r7093 | |
| 712 | 712 | { |
| 713 | 713 | file_error filerr = FILERR_NOT_FOUND; |
| 714 | 714 | image_error_t err = IMAGE_ERROR_FILENOTFOUND; |
| 715 | | astring *revised_path = astring_alloc(); |
| 715 | astring revised_path; |
| 716 | 716 | |
| 717 | 717 | /* attempt to read the file */ |
| 718 | | filerr = zippath_fopen(path, open_flags, &image->file, revised_path); |
| 718 | filerr = zippath_fopen(path, open_flags, &image->file, &revised_path); |
| 719 | 719 | |
| 720 | 720 | /* did the open succeed? */ |
| 721 | 721 | switch(filerr) |
| r7092 | r7093 | |
| 754 | 754 | |
| 755 | 755 | /* if successful, set the file name */ |
| 756 | 756 | if (filerr == FILERR_NONE) |
| 757 | | set_image_filename(image, astring_c(revised_path)); |
| 757 | set_image_filename(image, astring_c(&revised_path)); |
| 758 | 758 | |
| 759 | | astring_free(revised_path); |
| 760 | 759 | return err; |
| 761 | 760 | } |
| 762 | 761 | |
src/mess/infomess.c
| r7092 | r7093 | |
| 129 | 129 | { |
| 130 | 130 | const char *s; |
| 131 | 131 | |
| 132 | | astring *buffer = astring_alloc(); |
| 133 | | astring_cpyc(buffer, config->extra_options); |
| 134 | | astring_replacechr(buffer, ',', 0); |
| 132 | astring buffer; |
| 133 | astring_cpyc(&buffer, config->extra_options); |
| 134 | astring_replacechr(&buffer, ',', 0); |
| 135 | 135 | |
| 136 | | s = astring_c(buffer); |
| 136 | s = astring_c(&buffer); |
| 137 | 137 | |
| 138 | 138 | /* try to parse each option */ |
| 139 | 139 | while(*s != '\0') |
| r7092 | r7093 | |
| 141 | 141 | fprintf(out, "\t\t<ramoption>%u</ramoption>\n", messram_parse_string(s)); |
| 142 | 142 | s += strlen(s) + 1; |
| 143 | 143 | } |
| 144 | | astring_free(buffer); |
| 145 | 144 | } |
| 146 | 145 | } |
| 147 | 146 | } |
src/mess/filemngr.c
| r7092 | r7093 | |
| 304 | 304 | |
| 305 | 305 | static void menu_file_create_populate(running_machine *machine, ui_menu *menu, void *state, void *selection) |
| 306 | 306 | { |
| 307 | | astring *buffer = astring_alloc(); |
| 307 | astring buffer; |
| 308 | 308 | file_create_menu_state *menustate = (file_create_menu_state *) state; |
| 309 | 309 | const device_config *device = menustate->manager_menustate->selected_device; |
| 310 | 310 | const image_device_format *format; |
| r7092 | r7093 | |
| 313 | 313 | /* append the "New Image Name" item */ |
| 314 | 314 | if (selection == ITEMREF_NEW_IMAGE_NAME) |
| 315 | 315 | { |
| 316 | | astring_assemble_2(buffer, menustate->filename_buffer, "_"); |
| 317 | | new_image_name = astring_c(buffer); |
| 316 | astring_assemble_2(&buffer, menustate->filename_buffer, "_"); |
| 317 | new_image_name = astring_c(&buffer); |
| 318 | 318 | } |
| 319 | 319 | else |
| 320 | 320 | { |
| r7092 | r7093 | |
| 336 | 336 | |
| 337 | 337 | /* set up custom render proc */ |
| 338 | 338 | ui_menu_set_custom_render(menu, file_create_render_extra, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER, 0); |
| 339 | | |
| 340 | | /* cleanup */ |
| 341 | | astring_free(buffer); |
| 342 | 339 | } |
| 343 | 340 | |
| 344 | 341 | |
src/mess/machine/cbmiec.c
| r7092 | r7093 | |
| 363 | 363 | const cbm_iec_daisy_chain *daisy = get_interface(device); |
| 364 | 364 | int i; |
| 365 | 365 | |
| 366 | | astring *tempstring = astring_alloc(); |
| 367 | 366 | cbm_iec_daisy_state *head = NULL; |
| 368 | 367 | cbm_iec_daisy_state **tailptr = &head; |
| 369 | 368 | |
| r7092 | r7093 | |
| 377 | 376 | |
| 378 | 377 | if ((*tailptr)->device == NULL) |
| 379 | 378 | { |
| 380 | | astring_free(tempstring); |
| 381 | 379 | fatalerror("Unable to locate device '%s'", daisy->tag); |
| 382 | 380 | } |
| 383 | 381 | |
| r7092 | r7093 | |
| 397 | 395 | |
| 398 | 396 | cbm_iec->daisy_state = head; |
| 399 | 397 | |
| 400 | | astring_free(tempstring); |
| 401 | | |
| 402 | 398 | /* register for state saving */ |
| 403 | 399 | // state_save_register_device_item(device, 0, cbm_iec->); |
| 404 | 400 | } |
src/mess/machine/beta.c
| r7092 | r7093 | |
| 308 | 308 | static DEVICE_START( beta_disk ) |
| 309 | 309 | { |
| 310 | 310 | beta_disk_state *beta = get_safe_token(device); |
| 311 | | astring *tempstring = astring_alloc(); |
| 311 | astring tempstring; |
| 312 | 312 | |
| 313 | 313 | /* validate arguments */ |
| 314 | 314 | assert(device->tag != NULL); |
| 315 | 315 | |
| 316 | 316 | /* find our WD179x */ |
| 317 | | astring_printf(tempstring, "%s:%s", device->tag.cstr(), "wd179x"); |
| 318 | | beta->wd179x = devtag_get_device(device->machine, astring_c(tempstring)); |
| 319 | | |
| 320 | | astring_free(tempstring); |
| 317 | astring_printf(&tempstring, "%s:%s", device->tag.cstr(), "wd179x"); |
| 318 | beta->wd179x = devtag_get_device(device->machine, astring_c(&tempstring)); |
| 321 | 319 | } |
| 322 | 320 | |
| 323 | 321 | /*------------------------------------------------- |
src/mess/machine/abc77.c
| r7092 | r7093 | |
| 404 | 404 | abc77_t *abc77 = (abc77_t *)device->token; |
| 405 | 405 | const abc77_interface *intf = get_interface(device); |
| 406 | 406 | |
| 407 | | astring *tempstring = astring_alloc(); |
| 407 | astring tempstring; |
| 408 | 408 | |
| 409 | 409 | /* resolve callbacks */ |
| 410 | 410 | devcb_resolve_write_line(&abc77->out_txd_func, &intf->out_txd_func, device); |
| r7092 | r7093 | |
| 412 | 412 | devcb_resolve_write_line(&abc77->out_keydown_func, &intf->out_keydown_func, device); |
| 413 | 413 | |
| 414 | 414 | /* find our CPU */ |
| 415 | | astring_printf(tempstring, "%s:%s", device->tag.cstr(), I8035_TAG); |
| 416 | | abc77->cpu = devtag_get_device(device->machine, astring_c(tempstring)); |
| 417 | | astring_free(tempstring); |
| 415 | astring_printf(&tempstring, "%s:%s", device->tag.cstr(), I8035_TAG); |
| 416 | abc77->cpu = devtag_get_device(device->machine, astring_c(&tempstring)); |
| 418 | 417 | |
| 419 | 418 | /* allocate reset timer */ |
| 420 | 419 | abc77->reset_timer = timer_alloc(device->machine, reset_tick, (FPTR *) device); |
src/mess/machine/ieee488.c
| r7092 | r7093 | |
| 257 | 257 | const ieee488_daisy_chain *daisy = get_interface(device); |
| 258 | 258 | int i; |
| 259 | 259 | |
| 260 | | astring *tempstring = astring_alloc(); |
| 261 | 260 | ieee488_daisy_state *head = NULL; |
| 262 | 261 | ieee488_daisy_state **tailptr = &head; |
| 263 | 262 | |
| r7092 | r7093 | |
| 272 | 271 | |
| 273 | 272 | if ((*tailptr)->device == NULL) |
| 274 | 273 | { |
| 275 | | astring_free(tempstring); |
| 276 | 274 | fatalerror("Unable to locate device '%s'", daisy->tag); |
| 277 | 275 | } |
| 278 | 276 | |
| r7092 | r7093 | |
| 300 | 298 | |
| 301 | 299 | ieee488->daisy_state = head; |
| 302 | 300 | |
| 303 | | astring_free(tempstring); |
| 304 | | |
| 305 | 301 | /* register for state saving */ |
| 306 | 302 | // state_save_register_device_item(device, 0, ieee488->); |
| 307 | 303 | } |