summaryrefslogtreecommitdiff
path: root/vdp.c
diff options
context:
space:
mode:
Diffstat (limited to 'vdp.c')
-rw-r--r--vdp.c61
1 files changed, 0 insertions, 61 deletions
diff --git a/vdp.c b/vdp.c
index 8b2bdaf..ceffc77 100644
--- a/vdp.c
+++ b/vdp.c
@@ -1792,64 +1792,3 @@ void vdp_int_ack(vdp_context * context, uint16_t int_num)
}
}
-#define GST_VDP_REGS 0xFA
-#define GST_VDP_MEM 0x12478
-
-uint8_t vdp_load_gst(vdp_context * context, FILE * state_file)
-{
- uint8_t tmp_buf[CRAM_SIZE*2];
- fseek(state_file, GST_VDP_REGS, SEEK_SET);
- if (fread(context->regs, 1, VDP_REGS, state_file) != VDP_REGS) {
- fputs("Failed to read VDP registers from savestate\n", stderr);
- return 0;
- }
- context->double_res = (context->regs[REG_MODE_4] & (BIT_INTERLACE | BIT_DOUBLE_RES)) == (BIT_INTERLACE | BIT_DOUBLE_RES);
- if (!context->double_res) {
- context->framebuf = context->oddbuf;
- }
- latch_mode(context);
- if (fread(tmp_buf, 1, sizeof(tmp_buf), state_file) != sizeof(tmp_buf)) {
- fputs("Failed to read CRAM from savestate\n", stderr);
- return 0;
- }
- for (int i = 0; i < CRAM_SIZE; i++) {
- uint16_t value;
- context->cram[i] = value = (tmp_buf[i*2+1] << 8) | tmp_buf[i*2];
- context->colors[i] = color_map[value & 0xEEE];
- context->colors[i + CRAM_SIZE] = color_map[(value & 0xEEE) | FBUF_SHADOW];
- context->colors[i + CRAM_SIZE*2] = color_map[(value & 0xEEE) | FBUF_HILIGHT];
- }
- if (fread(tmp_buf, 2, VSRAM_SIZE, state_file) != VSRAM_SIZE) {
- fputs("Failed to read VSRAM from savestate\n", stderr);
- return 0;
- }
- for (int i = 0; i < VSRAM_SIZE; i++) {
- context->vsram[i] = (tmp_buf[i*2+1] << 8) | tmp_buf[i*2];
- }
- fseek(state_file, GST_VDP_MEM, SEEK_SET);
- if (fread(context->vdpmem, 1, VRAM_SIZE, state_file) != VRAM_SIZE) {
- fputs("Failed to read VRAM from savestate\n", stderr);
- return 0;
- }
- return 1;
-}
-
-void vdp_save_state(vdp_context * context, FILE * outfile)
-{
- uint8_t tmp_buf[CRAM_SIZE*2];
- fseek(outfile, GST_VDP_REGS, SEEK_SET);
- fwrite(context->regs, 1, VDP_REGS, outfile);
- for (int i = 0; i < CRAM_SIZE; i++) {
- tmp_buf[i*2] = context->cram[i];
- tmp_buf[i*2+1] = context->cram[i] >> 8;
- }
- fwrite(tmp_buf, 1, sizeof(tmp_buf), outfile);
- for (int i = 0; i < VSRAM_SIZE; i++) {
- tmp_buf[i*2] = context->vsram[i];
- tmp_buf[i*2+1] = context->vsram[i] >> 8;
- }
- fwrite(tmp_buf, 2, VSRAM_SIZE, outfile);
- fseek(outfile, GST_VDP_MEM, SEEK_SET);
- fwrite(context->vdpmem, 1, VRAM_SIZE, outfile);
-}
-