projects
/
eradicate
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fucked it up again, need to sleep
[eradicate]
/
src
/
dos
/
main.c
diff --git
a/src/dos/main.c
b/src/dos/main.c
index
ca57152
..
6031b6a
100644
(file)
--- a/
src/dos/main.c
+++ b/
src/dos/main.c
@@
-15,8
+15,9
@@
static struct video_mode *vmode;
int main(int argc, char **argv)
{
int main(int argc, char **argv)
{
+ void *fb_buf;
struct video_mode *vmodes;
struct video_mode *vmodes;
- int vmidx;
+ int vmidx, status = 0;
init_logger("game.log");
init_logger("game.log");
@@
-38,7
+39,14
@@
int main(int argc, char **argv)
fb_width = vmode->xsz;
fb_height = vmode->ysz;
fb_width = vmode->xsz;
fb_height = vmode->ysz;
- fb_size = (vmode->xsz * vmode->bpp / 8) * vmode->ysz;
+ fb_size = vmode->pitch * vmode->ysz;
+
+ if(!(fb_buf = malloc(fb_size + vmode->pitch * 2))) {
+ fprintf(stderr, "failed to allocate framebuffer\n");
+ status = -1;
+ goto break_evloop;
+ }
+ fb_pixels = (char*)fb_buf + vmode->pitch;
reset_timer();
reset_timer();
@@
-53,16
+61,17
@@
int main(int argc, char **argv)
}
break_evloop:
}
break_evloop:
+ free(fb_buf);
set_text_mode();
cleanup_video();
kb_shutdown();
set_text_mode();
cleanup_video();
kb_shutdown();
- return 0;
+ return status;
}
static void draw(void)
{
int i, j;
}
static void draw(void)
{
int i, j;
- uint16_t *pptr = vmem;
+ uint16_t *pptr = fb_pixels;
for(i=0; i<fb_height; i++) {
for(j=0; j<fb_width; j++) {
for(i=0; i<fb_height; i++) {
for(j=0; j<fb_width; j++) {
@@
-70,10
+79,6
@@
static void draw(void)
*pptr++ = chess ? 0xff00 : 0x00ff;
}
}
*pptr++ = chess ? 0xff00 : 0x00ff;
}
}
-}
-void swap_buffers(void *pixels)
-{
- wait_vsync();
- memcpy(vmem, pixels, fb_size);
+ blit_frame(fb_pixels, 1);
}
}