changeset 465:dc322bc77ea2

Fix stateview. Update "all" target in Makefile.
author Mike Pavone <pavone@retrodev.com>
date Tue, 10 Sep 2013 21:07:13 -0700
parents 226ed16b1fb6
children bc9e0829ffc7
files Makefile stateview.c
diffstat 2 files changed, 54 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Tue Sep 10 20:36:05 2013 -0700
+++ b/Makefile	Tue Sep 10 21:07:13 2013 -0700
@@ -16,7 +16,7 @@
 Z80OBJS=z80inst.o z80_to_x86.o zruntime.o
 AUDIOOBJS=ym2612.o psg.o wave.o
 
-all : dis trans stateview blastem
+all : dis zdis stateview vgmplay blastem
 
 blastem : blastem.o vdp.o render_sdl.o io.o config.o tern.o gst.o $(M68KOBJS) $(Z80OBJS) $(TRANSOBJS) $(AUDIOOBJS)
 	$(CC) -ggdb -o blastem  blastem.o vdp.o render_sdl.o io.o config.o tern.o gst.o $(M68KOBJS) $(Z80OBJS) $(TRANSOBJS) $(AUDIOOBJS) $(LDFLAGS)
@@ -42,8 +42,8 @@
 ztestgen : ztestgen.o z80inst.o
 	$(CC) -o ztestgen ztestgen.o z80inst.o
 
-stateview : stateview.o vdp.o render_sdl.o
-	$(CC) -o stateview stateview.o vdp.o render_sdl.o `pkg-config --libs $(LIBS)`
+stateview : stateview.o vdp.o render_sdl.o config.o tern.o gst.o
+	$(CC) -o stateview stateview.o vdp.o render_sdl.o config.o tern.o gst.o `pkg-config --libs $(LIBS)`
 
 vgmplay : vgmplay.o render_sdl.o $(AUDIOOBJS)
 	$(CC) -o vgmplay vgmplay.o render_sdl.o $(AUDIOOBJS) `pkg-config --libs $(LIBS)`
--- a/stateview.c	Tue Sep 10 20:36:05 2013 -0700
+++ b/stateview.c	Tue Sep 10 21:07:13 2013 -0700
@@ -7,12 +7,48 @@
 //not used, but referenced by the renderer since it handles input
 io_port gamepad_1;
 io_port gamepad_2;
+uint8_t reset = 1;
+uint8_t busreq = 0;
 
 uint16_t read_dma_value(uint32_t address)
 {
 	return 0;
 }
 
+void ym_data_write(ym2612_context * context, uint8_t value)
+{
+}
+
+void ym_address_write_part1(ym2612_context * context, uint8_t address)
+{
+}
+
+void ym_address_write_part2(ym2612_context * context, uint8_t address)
+{
+}
+
+void handle_keydown(int keycode)
+{
+}
+
+void handle_keyup(int keycode)
+{
+}
+
+void handle_joydown(int joystick, int button)
+{
+}
+
+void handle_joyup(int joystick, int button)
+{
+}
+
+void handle_joy_dpad(int joystick, int dpadnum, uint8_t value)
+{
+}
+
+tern_node * config;
+
 int main(int argc, char ** argv)
 {
 	if (argc < 2) {
@@ -24,23 +60,33 @@
 		fprintf(stderr, "Failed to open %s\n", argv[1]);
 		exit(1);
 	}
-	int width = 320;
-	int height = 240;
+	config = load_config(argv[0]);
+	int width = -1;
+	int height = -1;
 	if (argc > 2) {
 		width = atoi(argv[2]);
 		if (argc > 3) {
 			height = atoi(argv[3]);
-		} else {
-			height = (width/320) * 240;
 		}
 	}
+	int def_width = 0;
+	char *config_width = tern_find_ptr(config, "videowidth");
+	if (config_width) {
+		def_width = atoi(config_width);
+	}
+	if (!def_width) {
+		def_width = 640;
+	}
+	width = width < 320 ? def_width : width;
+	height = height < 240 ? (width/320) * 240 : height;
+
 	vdp_context context;
+	render_init(width, height, "GST State Viewer", 60, 0);
 	init_vdp_context(&context);
 	vdp_load_gst(&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;