comparison stateview.c @ 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 7e8e179116af
children 140af5509ce7
comparison
equal deleted inserted replaced
464:226ed16b1fb6 465:dc322bc77ea2
5 #include "blastem.h" 5 #include "blastem.h"
6 6
7 //not used, but referenced by the renderer since it handles input 7 //not used, but referenced by the renderer since it handles input
8 io_port gamepad_1; 8 io_port gamepad_1;
9 io_port gamepad_2; 9 io_port gamepad_2;
10 uint8_t reset = 1;
11 uint8_t busreq = 0;
10 12
11 uint16_t read_dma_value(uint32_t address) 13 uint16_t read_dma_value(uint32_t address)
12 { 14 {
13 return 0; 15 return 0;
14 } 16 }
17
18 void ym_data_write(ym2612_context * context, uint8_t value)
19 {
20 }
21
22 void ym_address_write_part1(ym2612_context * context, uint8_t address)
23 {
24 }
25
26 void ym_address_write_part2(ym2612_context * context, uint8_t address)
27 {
28 }
29
30 void handle_keydown(int keycode)
31 {
32 }
33
34 void handle_keyup(int keycode)
35 {
36 }
37
38 void handle_joydown(int joystick, int button)
39 {
40 }
41
42 void handle_joyup(int joystick, int button)
43 {
44 }
45
46 void handle_joy_dpad(int joystick, int dpadnum, uint8_t value)
47 {
48 }
49
50 tern_node * config;
15 51
16 int main(int argc, char ** argv) 52 int main(int argc, char ** argv)
17 { 53 {
18 if (argc < 2) { 54 if (argc < 2) {
19 fprintf(stderr, "Usage: stateview FILENAME\n"); 55 fprintf(stderr, "Usage: stateview FILENAME\n");
22 FILE * state_file = fopen(argv[1], "rb"); 58 FILE * state_file = fopen(argv[1], "rb");
23 if (!state_file) { 59 if (!state_file) {
24 fprintf(stderr, "Failed to open %s\n", argv[1]); 60 fprintf(stderr, "Failed to open %s\n", argv[1]);
25 exit(1); 61 exit(1);
26 } 62 }
27 int width = 320; 63 config = load_config(argv[0]);
28 int height = 240; 64 int width = -1;
65 int height = -1;
29 if (argc > 2) { 66 if (argc > 2) {
30 width = atoi(argv[2]); 67 width = atoi(argv[2]);
31 if (argc > 3) { 68 if (argc > 3) {
32 height = atoi(argv[3]); 69 height = atoi(argv[3]);
33 } else {
34 height = (width/320) * 240;
35 } 70 }
36 } 71 }
72 int def_width = 0;
73 char *config_width = tern_find_ptr(config, "videowidth");
74 if (config_width) {
75 def_width = atoi(config_width);
76 }
77 if (!def_width) {
78 def_width = 640;
79 }
80 width = width < 320 ? def_width : width;
81 height = height < 240 ? (width/320) * 240 : height;
82
37 vdp_context context; 83 vdp_context context;
84 render_init(width, height, "GST State Viewer", 60, 0);
38 init_vdp_context(&context); 85 init_vdp_context(&context);
39 vdp_load_gst(&context, state_file); 86 vdp_load_gst(&context, state_file);
40 vdp_run_to_vblank(&context); 87 vdp_run_to_vblank(&context);
41 vdp_print_sprite_table(&context); 88 vdp_print_sprite_table(&context);
42 printf("Display %s\n", (context.regs[REG_MODE_2] & DISPLAY_ENABLE) ? "enabled" : "disabled"); 89 printf("Display %s\n", (context.regs[REG_MODE_2] & DISPLAY_ENABLE) ? "enabled" : "disabled");
43 render_init(width, height);
44 render_context(&context); 90 render_context(&context);
45 render_wait_quit(&context); 91 render_wait_quit(&context);
46 return 0; 92 return 0;
47 } 93 }