aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Garrelou <simon.garrelou@gmail.com>2021-01-09 21:30:36 +0100
committerSimon Garrelou <simon.garrelou@gmail.com>2021-01-09 21:30:36 +0100
commit9e9dc27233e46c691a36f979450a04b6dd769fd6 (patch)
tree9ff4d94068e789a8d8b47c15c053f7da1d86ec8e
parent32d0425ff0594d93d1ef744003556f9355114c1d (diff)
downloadkindle-doom-9e9dc27233e46c691a36f979450a04b6dd769fd6.tar.gz
kindle-doom-9e9dc27233e46c691a36f979450a04b6dd769fd6.zip
Fix flickering + render in landscape
-rw-r--r--src/KINDLE/i_video.c51
1 files changed, 19 insertions, 32 deletions
diff --git a/src/KINDLE/i_video.c b/src/KINDLE/i_video.c
index 6e926d2..b379f97 100644
--- a/src/KINDLE/i_video.c
+++ b/src/KINDLE/i_video.c
@@ -92,8 +92,8 @@ typedef struct {
92 92
93static kindle_key_t kkey; 93static kindle_key_t kkey;
94 94
95#define SCREEN_WIDTH 600 95#define KINDLE_WIDTH 800
96#define SCREEN_HEIGHT 800 96#define KINDLE_HEIGHT 600
97 97
98/////////// FRAMEBUFFER STUFF 98/////////// FRAMEBUFFER STUFF
99static void init_framebuffer() { 99static void init_framebuffer() {
@@ -189,10 +189,10 @@ static int I_TranslateKey(unsigned short code)
189 int rc = 0; 189 int rc = 0;
190 190
191 switch (code) { 191 switch (code) {
192 case KINDLE_LEFT: rc = KEYD_LEFTARROW; break; 192 case KINDLE_LEFT: rc = KEYD_DOWNARROW; break;
193 case KINDLE_RIGHT: rc = KEYD_RIGHTARROW; break; 193 case KINDLE_RIGHT: rc = KEYD_UPARROW; break;
194 case KINDLE_UP: rc = KEYD_UPARROW; break; 194 case KINDLE_UP: rc = KEYD_LEFTARROW; break;
195 case KINDLE_DOWN: rc = KEYD_DOWNARROW; break; 195 case KINDLE_DOWN: rc = KEYD_RIGHTARROW; break;
196 case KINDE_OK: rc = KEYD_RCTRL; break; 196 case KINDE_OK: rc = KEYD_RCTRL; break;
197 default: break; 197 default: break;
198 } 198 }
@@ -320,25 +320,11 @@ void I_FinishUpdate (void)
320{ 320{
321 if (I_SkipFrame()) return; 321 if (I_SkipFrame()) return;
322 322
323 323 for (int x=0; x < SCREENWIDTH; x++) {
324 int h; 324 for (int y=0; y < SCREENHEIGHT; y++) {
325 byte *src; 325 screen[x*600+(599-y)] = ~screens[0].data[y*SCREENWIDTH+x];
326 byte *dest;
327
328
329 dest=screen;
330 src=screens[0].data;
331 h=SCREEN_HEIGHT;
332 for (; h>0; h--)
333 {
334 memcpy(dest,src,SCREENWIDTH); //*V_GetPixelDepth()
335 for (byte* off=dest; off < dest+SCREENWIDTH; off++) {
336 *off = ~*off; // Invert pixel color, 0xFF == black on the e-ink display
337 }
338 dest+=SCREEN_WIDTH;
339 src+=screens[0].byte_pitch;
340 } 326 }
341 327 }
342 328
343 update_framebuffer(0); 329 update_framebuffer(0);
344} 330}
@@ -377,8 +363,8 @@ void I_PreInitGraphics(void)
377// It should be used only for fullscreen modes. 363// It should be used only for fullscreen modes.
378static void I_ClosestResolution (int *width, int *height, int flags) 364static void I_ClosestResolution (int *width, int *height, int flags)
379{ 365{
380 *width=600; 366 *width=KINDLE_WIDTH;
381 *height=800; 367 *height=KINDLE_HEIGHT;
382} 368}
383 369
384// CPhipps - 370// CPhipps -
@@ -406,8 +392,8 @@ void I_CalculateRes(unsigned int width, unsigned int height)
406 SCREENHEIGHT = height; 392 SCREENHEIGHT = height;
407 SCREENPITCH = SCREENWIDTH; 393 SCREENPITCH = SCREENWIDTH;
408 } else { 394 } else {
409 SCREENWIDTH = 600;//(width+15) & ~15; 395 SCREENWIDTH = KINDLE_WIDTH;
410 SCREENHEIGHT = height; 396 SCREENHEIGHT = KINDLE_HEIGHT;
411 if (!(SCREENWIDTH % 1024)) { 397 if (!(SCREENWIDTH % 1024)) {
412 SCREENPITCH = SCREENWIDTH*V_GetPixelDepth()+32; 398 SCREENPITCH = SCREENWIDTH*V_GetPixelDepth()+32;
413 } else { 399 } else {
@@ -512,11 +498,12 @@ void I_UpdateVideoMode(void)
512 498
513 // Get the info needed to render to the display 499 // Get the info needed to render to the display
514 500
501 byte* screen_data = (byte*)malloc(800*600);
515 screens[0].not_on_heap = true; 502 screens[0].not_on_heap = true;
516 screens[0].data = (unsigned char *) (screen); 503 screens[0].data = (unsigned char *) (screen_data);
517 screens[0].byte_pitch = SCREEN_WIDTH; 504 screens[0].byte_pitch = KINDLE_WIDTH;
518 screens[0].short_pitch = SCREEN_WIDTH; // screen->pitch / V_GetModePixelDepth(VID_MODE16); 505 screens[0].short_pitch = KINDLE_WIDTH; // screen->pitch / V_GetModePixelDepth(VID_MODE16);
519 screens[0].int_pitch = SCREEN_WIDTH; // screen->pitch / V_GetModePixelDepth(VID_MODE32); 506 screens[0].int_pitch = KINDLE_WIDTH; // screen->pitch / V_GetModePixelDepth(VID_MODE32);
520 507
521 508
522 V_AllocScreens(); 509 V_AllocScreens();