#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "game.h"
#include "cdpmi.h"
#include "gfx.h"
#include "vbe.h"
#include "vga.h"
+#include "util.h"
#define SAME_BPP(a, b) \
((a) == (b) || ((a) == 16 && (b) == 15) || ((a) == 15 && (b) == 16) || \
vmptr->rmask = calc_mask(minf.rsize, minf.rpos);
vmptr->gmask = calc_mask(minf.gsize, minf.gpos);
vmptr->bmask = calc_mask(minf.bsize, minf.bpos);
+ vmptr->bpp = vmptr->rbits + vmptr->gbits + vmptr->bbits;
}
if(minf.attr & VBE_ATTR_LFB) {
vmptr->fb_addr = minf.fb_addr;
if(nbuf < 1) nbuf = 1;
if(nbuf > 2) nbuf = 2;
pgcount = nbuf > vm->max_pages ? vm->max_pages : nbuf;
- pgsize = vm->xsz * vm->ysz * vm->pitch;
+ pgsize = vm->ysz * vm->pitch;
fbsize = pgcount * pgsize;
printf("pgcount: %d, pgsize: %d, fbsize: %d\n", pgcount, pgsize, fbsize);
set_text_mode();
return 0;
}
- //memset(vpgaddr[0], 0xaa, pgsize);
+ memset(vpgaddr[0], 0xaa, pgsize);
if(pgcount > 1) {
vpgaddr[1] = (char*)vpgaddr[0] + pgsize;
static void blit_frame_lfb(void *pixels, int vsync)
{
+ if(show_fps) dbg_fps(pixels);
if(vsync) wait_vsync();
- memcpy(vpgaddr[frontidx], pixels, pgsize);
+ memcpy64(vpgaddr[frontidx], pixels, pgsize >> 3);
}
static void blit_frame_banked(void *pixels, int vsync)
unsigned int pending;
unsigned char *pptr = pixels;
+ if(show_fps) dbg_fps(pixels);
+
if(vsync) wait_vsync();
/* assume initial window offset at 0 */
pending = pgsize;
while(pending > 0) {
sz = pending > curmode->bank_size ? curmode->bank_size : pending;
+ //memcpy64((void*)0xa0000, pptr, sz >> 3);
memcpy((void*)0xa0000, pptr, sz);
pptr += sz;
pending -= sz;