comparison stateview.c @ 487:c08a4efeee7f opengl

Update opengl branch from default. Fix build breakage unrelated to merge
author Mike Pavone <pavone@retrodev.com>
date Sat, 26 Oct 2013 22:38:47 -0700
parents 140af5509ce7
children 6e751a8f46aa
comparison
equal deleted inserted replaced
449:7696d824489d 487:c08a4efeee7f
1 /*
2 Copyright 2013 Michael Pavone
3 This file is part of BlastEm.
4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
5 */
1 #include <stdlib.h> 6 #include <stdlib.h>
2 #include <stdio.h> 7 #include <stdio.h>
3 #include "vdp.h" 8 #include "vdp.h"
4 #include "render.h" 9 #include "render.h"
5 #include "blastem.h" 10 #include "blastem.h"
6 11
7 //not used, but referenced by the renderer since it handles input 12 //not used, but referenced by the renderer since it handles input
8 io_port gamepad_1; 13 io_port gamepad_1;
9 io_port gamepad_2; 14 io_port gamepad_2;
15 uint8_t reset = 1;
16 uint8_t busreq = 0;
10 17
11 uint16_t read_dma_value(uint32_t address) 18 uint16_t read_dma_value(uint32_t address)
12 { 19 {
13 return 0; 20 return 0;
14 } 21 }
22
23 void ym_data_write(ym2612_context * context, uint8_t value)
24 {
25 }
26
27 void ym_address_write_part1(ym2612_context * context, uint8_t address)
28 {
29 }
30
31 void ym_address_write_part2(ym2612_context * context, uint8_t address)
32 {
33 }
34
35 void handle_keydown(int keycode)
36 {
37 }
38
39 void handle_keyup(int keycode)
40 {
41 }
42
43 void handle_joydown(int joystick, int button)
44 {
45 }
46
47 void handle_joyup(int joystick, int button)
48 {
49 }
50
51 void handle_joy_dpad(int joystick, int dpadnum, uint8_t value)
52 {
53 }
54
55 tern_node * config;
15 56
16 int main(int argc, char ** argv) 57 int main(int argc, char ** argv)
17 { 58 {
18 if (argc < 2) { 59 if (argc < 2) {
19 fprintf(stderr, "Usage: stateview FILENAME\n"); 60 fprintf(stderr, "Usage: stateview FILENAME\n");
22 FILE * state_file = fopen(argv[1], "rb"); 63 FILE * state_file = fopen(argv[1], "rb");
23 if (!state_file) { 64 if (!state_file) {
24 fprintf(stderr, "Failed to open %s\n", argv[1]); 65 fprintf(stderr, "Failed to open %s\n", argv[1]);
25 exit(1); 66 exit(1);
26 } 67 }
27 int width = 320; 68 config = load_config(argv[0]);
28 int height = 240; 69 int width = -1;
70 int height = -1;
29 if (argc > 2) { 71 if (argc > 2) {
30 width = atoi(argv[2]); 72 width = atoi(argv[2]);
31 if (argc > 3) { 73 if (argc > 3) {
32 height = atoi(argv[3]); 74 height = atoi(argv[3]);
33 } else {
34 height = (width/320) * 240;
35 } 75 }
36 } 76 }
77 int def_width = 0;
78 char *config_width = tern_find_ptr(config, "videowidth");
79 if (config_width) {
80 def_width = atoi(config_width);
81 }
82 if (!def_width) {
83 def_width = 640;
84 }
85 width = width < 320 ? def_width : width;
86 height = height < 240 ? (width/320) * 240 : height;
87
37 vdp_context context; 88 vdp_context context;
89 render_init(width, height, "GST State Viewer", 60, 0);
38 init_vdp_context(&context); 90 init_vdp_context(&context);
39 vdp_load_gst(&context, state_file); 91 vdp_load_gst(&context, state_file);
40 vdp_run_to_vblank(&context); 92 vdp_run_to_vblank(&context);
41 vdp_print_sprite_table(&context); 93 vdp_print_sprite_table(&context);
42 printf("Display %s\n", (context.regs[REG_MODE_2] & DISPLAY_ENABLE) ? "enabled" : "disabled"); 94 printf("Display %s\n", (context.regs[REG_MODE_2] & DISPLAY_ENABLE) ? "enabled" : "disabled");
43 render_init(width, height);
44 render_context(&context); 95 render_context(&context);
45 render_wait_quit(&context); 96 render_wait_quit(&context);
46 return 0; 97 return 0;
47 } 98 }