comparison stateview.c @ 803:236a184bf6f0

Merge
author Michael Pavone <pavone@retrodev.com>
date Sun, 26 Jul 2015 16:51:03 -0700
parents 9aff36a172b2
children 574495372d1c
comparison
equal deleted inserted replaced
802:6811f601008f 803:236a184bf6f0
5 */ 5 */
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 #include "vdp.h" 8 #include "vdp.h"
9 #include "render.h" 9 #include "render.h"
10 #include "util.h"
10 #include "blastem.h" 11 #include "blastem.h"
11 12
12 //not used, but referenced by the renderer since it handles input 13 //not used, but referenced by the renderer since it handles input
13 io_port gamepad_1; 14 io_port gamepad_1;
14 io_port gamepad_2; 15 io_port gamepad_2;
15 uint8_t reset = 1; 16 uint8_t reset = 1;
16 uint8_t busreq = 0; 17 uint8_t busreq = 0;
18
19 uint16_t ram[RAM_WORDS];
20 uint8_t z80_ram[Z80_RAM_BYTES];
17 21
18 uint16_t read_dma_value(uint32_t address) 22 uint16_t read_dma_value(uint32_t address)
19 { 23 {
20 return 0; 24 return 0;
21 } 25 }
51 void handle_joy_dpad(int joystick, int dpadnum, uint8_t value) 55 void handle_joy_dpad(int joystick, int dpadnum, uint8_t value)
52 { 56 {
53 } 57 }
54 58
55 tern_node * config; 59 tern_node * config;
60 int headless = 0;
56 61
57 int main(int argc, char ** argv) 62 int main(int argc, char ** argv)
58 { 63 {
59 if (argc < 2) { 64 if (argc < 2) {
60 fprintf(stderr, "Usage: stateview FILENAME\n"); 65 fatal_error("Usage: stateview FILENAME\n");
61 exit(1);
62 } 66 }
63 FILE * state_file = fopen(argv[1], "rb"); 67 FILE * state_file = fopen(argv[1], "rb");
64 if (!state_file) { 68 if (!state_file) {
65 fprintf(stderr, "Failed to open %s\n", argv[1]); 69 fatal_error("Failed to open %s\n", argv[1]);
66 exit(1);
67 } 70 }
68 config = load_config(argv[0]); 71 config = load_config(argv[0]);
69 int width = -1; 72 int width = -1;
70 int height = -1; 73 int height = -1;
71 if (argc > 2) { 74 if (argc > 2) {
85 width = width < 320 ? def_width : width; 88 width = width < 320 ? def_width : width;
86 height = height < 240 ? (width/320) * 240 : height; 89 height = height < 240 ? (width/320) * 240 : height;
87 90
88 vdp_context context; 91 vdp_context context;
89 render_init(width, height, "GST State Viewer", 60, 0); 92 render_init(width, height, "GST State Viewer", 60, 0);
90 init_vdp_context(&context); 93 init_vdp_context(&context, 0);
91 vdp_load_gst(&context, state_file); 94 vdp_load_gst(&context, state_file);
92 vdp_run_to_vblank(&context); 95 vdp_run_to_vblank(&context);
93 vdp_print_sprite_table(&context); 96 vdp_print_sprite_table(&context);
94 printf("Display %s\n", (context.regs[REG_MODE_2] & DISPLAY_ENABLE) ? "enabled" : "disabled"); 97 printf("Display %s\n", (context.regs[REG_MODE_2] & DISPLAY_ENABLE) ? "enabled" : "disabled");
95 render_context(&context); 98 render_context(&context);