comparison stateview.c @ 1640:3602f3b20072

Small cleanup of vdp_context struct layout and removal of separately allocated buffers
author Michael Pavone <pavone@retrodev.com>
date Fri, 16 Nov 2018 19:56:24 -0800
parents 0174759e559f
children c9695252eff4
comparison
equal deleted inserted replaced
1639:93518786f882 1640:3602f3b20072
114 def_width = 640; 114 def_width = 640;
115 } 115 }
116 width = width < 320 ? def_width : width; 116 width = width < 320 ? def_width : width;
117 height = height < 240 ? (width/320) * 240 : height; 117 height = height < 240 ? (width/320) * 240 : height;
118 118
119 vdp_context context;
120 render_init(width, height, "GST State Viewer", 0); 119 render_init(width, height, "GST State Viewer", 0);
121 init_vdp_context(&context, 0); 120 vdp_context *context = init_vdp_context(0);
122 vdp_load_gst(&context, state_file); 121 vdp_load_gst(context, state_file);
123 vdp_run_to_vblank(&context); 122 vdp_run_to_vblank(context);
124 vdp_print_sprite_table(&context); 123 vdp_print_sprite_table(context);
125 printf("Display %s\n", (context.regs[REG_MODE_2] & DISPLAY_ENABLE) ? "enabled" : "disabled"); 124 printf("Display %s\n", (context->regs[REG_MODE_2] & DISPLAY_ENABLE) ? "enabled" : "disabled");
126 if (!(context.regs[REG_MODE_2] & DISPLAY_ENABLE)) { 125 if (!(context->regs[REG_MODE_2] & DISPLAY_ENABLE)) {
127 puts("Forcing display on"); 126 puts("Forcing display on");
128 vdp_control_port_write(&context, 0x8000 | REG_MODE_2 << 8 | context.regs[REG_MODE_2] | DISPLAY_ENABLE); 127 vdp_control_port_write(context, 0x8000 | REG_MODE_2 << 8 | context->regs[REG_MODE_2] | DISPLAY_ENABLE);
129 } 128 }
130 render_wait_quit(&context); 129 render_wait_quit(context);
131 return 0; 130 return 0;
132 } 131 }