view stateview.c @ 380:1c8d74f2ab0b

Make the PSG and YM2612 use the master clock internal with an increment based on clock divider so that they stay perflectly in sync. Run both the PSG and YM2612 whenver one of them needs to be run.
author Mike Pavone <pavone@retrodev.com>
date Mon, 03 Jun 2013 21:43:38 -0700
parents 8e2fa485c0f2
children 7e8e179116af
line wrap: on
line source

#include <stdlib.h>
#include <stdio.h>
#include "vdp.h"
#include "render.h"
#include "blastem.h"

//not used, but referenced by the renderer since it handles input
io_port gamepad_1;
io_port gamepad_2;

uint16_t read_dma_value(uint32_t address)
{
	return 0;
}

int main(int argc, char ** argv)
{
	if (argc < 2) {
		fprintf(stderr, "Usage: stateview FILENAME\n");
		exit(1);
	}
	FILE * state_file = fopen(argv[1], "rb");
	if (!state_file) {
		fprintf(stderr, "Failed to open %s\n", argv[1]);
		exit(1);
	}
	int width = 320;
	int height = 240;
	if (argc > 2) {
		width = atoi(argv[2]);
		if (argc > 3) {
			height = atoi(argv[3]);
		} else {
			height = (width/320) * 240;
		}
	}
	vdp_context context;
	init_vdp_context(&context);
	vdp_load_savestate(&context, state_file);
	vdp_run_to_vblank(&context);
	vdp_print_sprite_table(&context);
	printf("Display %s\n", (context.regs[REG_MODE_2] & DISPLAY_ENABLE) ? "enabled" : "disabled");
    render_init(width, height);
    render_context(&context);
    render_wait_quit(&context);
    return 0;
}