Mercurial > repos > blastem
comparison lc8951.c @ 2280:9ead0fe69d9b
Implement savestate support for Sega CD
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 08 Jan 2023 14:42:24 -0800 |
parents | 5c28534e6e09 |
children | 9f0c67e5c50a |
comparison
equal
deleted
inserted
replaced
2279:3b5fef896475 | 2280:9ead0fe69d9b |
---|---|
426 if (context->next_byte_cycle != CYCLE_NEVER) { | 426 if (context->next_byte_cycle != CYCLE_NEVER) { |
427 context->next_byte_cycle -= deduction; | 427 context->next_byte_cycle -= deduction; |
428 } | 428 } |
429 printf("cycle is now %u, decode_end %u, transfer_end %u\n", context->cycle, context->decode_end, context->transfer_end); | 429 printf("cycle is now %u, decode_end %u, transfer_end %u\n", context->cycle, context->decode_end, context->transfer_end); |
430 } | 430 } |
431 | |
432 void lc8951_serialize(lc8951 *context, serialize_buffer *buf) | |
433 { | |
434 save_int32(buf, context->cycle); | |
435 save_int32(buf, context->decode_end); | |
436 save_int32(buf, context->transfer_end); | |
437 save_int32(buf, context->next_byte_cycle); | |
438 save_int16(buf, context->sector_counter); | |
439 save_buffer8(buf, context->buffer, sizeof(context->buffer)); | |
440 save_buffer8(buf, context->regs, sizeof(context->regs)); | |
441 save_buffer8(buf, context->comin, sizeof(context->comin)); | |
442 save_int16(buf, context->dac); | |
443 save_int8(buf, context->comin_write); | |
444 save_int8(buf, context->comin_count); | |
445 save_int8(buf, context->ifctrl); | |
446 save_int8(buf, context->ctrl0); | |
447 save_int8(buf, context->ctrl1); | |
448 save_int8(buf, context->ar); | |
449 save_int8(buf, context->ar_mask); | |
450 save_int8(buf, context->triggered); | |
451 save_int8(buf, context->sync_counter); | |
452 } | |
453 | |
454 void lc8951_deserialize(deserialize_buffer *buf, void *vcontext) | |
455 { | |
456 lc8951 *context = vcontext; | |
457 context->cycle = load_int32(buf); | |
458 context->decode_end = load_int32(buf); | |
459 context->transfer_end = load_int32(buf); | |
460 context->next_byte_cycle = load_int32(buf); | |
461 context->sector_counter = load_int16(buf); | |
462 load_buffer8(buf, context->buffer, sizeof(context->buffer)); | |
463 load_buffer8(buf, context->regs, sizeof(context->regs)); | |
464 load_buffer8(buf, context->comin, sizeof(context->comin)); | |
465 context->dac = load_int16(buf); | |
466 context->comin_write = load_int8(buf); | |
467 context->comin_count = load_int8(buf); | |
468 context->ifctrl = load_int8(buf); | |
469 context->ctrl0 = load_int8(buf); | |
470 context->ctrl1 = load_int8(buf); | |
471 context->ar = load_int8(buf); | |
472 context->ar_mask = load_int8(buf); | |
473 context->triggered = load_int8(buf); | |
474 context->sync_counter = load_int8(buf); | |
475 } |