moving on
[eradicate] / src / sdl / main.c
index 8d60d12..b672ee6 100644 (file)
@@ -27,6 +27,7 @@ int main(int argc, char **argv)
 {
        int s;
        char *env;
+       void *fb_buf;
 
        if((env = getenv("FBSCALE")) && (s = atoi(env))) {
                fbscale = s;
@@ -35,14 +36,15 @@ int main(int argc, char **argv)
 
        xsz = FB_WIDTH * fbscale;
        ysz = FB_HEIGHT * fbscale;
-       fb_width = xsz;
-       fb_height = ysz;
+       fb_width = FB_WIDTH;
+       fb_height = FB_HEIGHT;
 
-       /* allocate 1 extra row as a guard band, until we fucking fix the rasterizer */
-       if(!(fb_pixels = malloc(FB_WIDTH * (FB_HEIGHT + 1) * FB_BPP / CHAR_BIT))) {
+       fb_size = FB_WIDTH * FB_HEIGHT * FB_BPP / 8;
+       if(!(fb_buf = malloc(fb_size + FB_WIDTH * 4))) {
                fprintf(stderr, "failed to allocate virtual framebuffer\n");
                return 1;
        }
+       vmem = fb_pixels = (uint16_t*)((char*)fb_buf + FB_WIDTH * 2);
 
        SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_NOPARACHUTE);
        if(!(fbsurf = SDL_SetVideoMode(xsz, ysz, FB_BPP, sdl_flags))) {
@@ -97,6 +99,8 @@ void blit_frame(void *pixels, int vsync)
        int i, j;
        unsigned short *sptr, *dptr;
 
+       if(show_fps) dbg_fps(pixels);
+
        if(vsync) {
                wait_vsync();
        }