summaryrefslogtreecommitdiff
path: root/apps/plugins/xworld/sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/xworld/sys.c')
-rw-r--r--apps/plugins/xworld/sys.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/apps/plugins/xworld/sys.c b/apps/plugins/xworld/sys.c
index 0bd1e0dc08..c57da9456b 100644
--- a/apps/plugins/xworld/sys.c
+++ b/apps/plugins/xworld/sys.c
@@ -40,6 +40,7 @@
40#include "engine.h" 40#include "engine.h"
41 41
42static struct System* save_sys; 42static struct System* save_sys;
43static fb_data *lcd_fb = NULL;
43 44
44static bool sys_save_settings(struct System* sys) 45static bool sys_save_settings(struct System* sys)
45{ 46{
@@ -438,6 +439,8 @@ void sys_init(struct System* sys, const char* title)
438 { 439 {
439 sys_reset_settings(sys); 440 sys_reset_settings(sys);
440 } 441 }
442 struct viewport *vp_main = rb->lcd_set_viewport(NULL);
443 lcd_fb = vp_main->buffer->fb_ptr;
441} 444}
442 445
443void sys_destroy(struct System* sys) 446void sys_destroy(struct System* sys)
@@ -584,7 +587,7 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16
584 struct bitmap out_bmp; 587 struct bitmap out_bmp;
585 out_bmp.width = LCD_WIDTH; 588 out_bmp.width = LCD_WIDTH;
586 out_bmp.height = LCD_HEIGHT; 589 out_bmp.height = LCD_HEIGHT;
587 out_bmp.data = (unsigned char*) *rb->lcd_framebuffer; 590 out_bmp.data = (unsigned char*) lcd_fb;
588 591
589#ifdef HAVE_LCD_COLOR 592#ifdef HAVE_LCD_COLOR
590 if(sys->settings.scaling_quality == 1) 593 if(sys->settings.scaling_quality == 1)
@@ -631,25 +634,25 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16
631 { 634 {
632#ifdef HAVE_LCD_COLOR 635#ifdef HAVE_LCD_COLOR
633 int r, g, b; 636 int r, g, b;
634 fb_data pix = *rb->lcd_framebuffer[y * LCD_WIDTH + x]; 637 fb_data pix = lcd_fb[y * LCD_WIDTH + x];
635#if (LCD_DEPTH > 24) 638#if (LCD_DEPTH > 24)
636 r = 0xff - pix.r; 639 r = 0xff - pix.r;
637 g = 0xff - pix.g; 640 g = 0xff - pix.g;
638 b = 0xff - pix.b; 641 b = 0xff - pix.b;
639 *rb->lcd_framebuffer[y * LCD_WIDTH + x] = (fb_data) { b, g, r, 255 }; 642 lcd_fb[y * LCD_WIDTH + x] = (fb_data) { b, g, r, 255 };
640#elif (LCD_DEPTH == 24) 643#elif (LCD_DEPTH == 24)
641 r = 0xff - pix.r; 644 r = 0xff - pix.r;
642 g = 0xff - pix.g; 645 g = 0xff - pix.g;
643 b = 0xff - pix.b; 646 b = 0xff - pix.b;
644 *rb->lcd_framebuffer[y * LCD_WIDTH + x] = (fb_data) { b, g, r }; 647 lcd_fb[y * LCD_WIDTH + x] = (fb_data) { b, g, r };
645#else 648#else
646 r = RGB_UNPACK_RED (pix); 649 r = RGB_UNPACK_RED (pix);
647 g = RGB_UNPACK_GREEN(pix); 650 g = RGB_UNPACK_GREEN(pix);
648 b = RGB_UNPACK_BLUE (pix); 651 b = RGB_UNPACK_BLUE (pix);
649 *rb->lcd_framebuffer[y * LCD_WIDTH + x] = LCD_RGBPACK(0xff - r, 0xff - g, 0xff - b); 652 lcd_fb[y * LCD_WIDTH + x] = LCD_RGBPACK(0xff - r, 0xff - g, 0xff - b);
650#endif 653#endif
651#else 654#else
652 *rb->lcd_framebuffer[y * LCD_WIDTH + x] = LCD_BRIGHTNESS(0xff - *rb->lcd_framebuffer[y * LCD_WIDTH + x]); 655 lcd_fb[y * LCD_WIDTH + x] = LCD_BRIGHTNESS(0xff - lcd_fb[y * LCD_WIDTH + x]);
653#endif 656#endif
654 } 657 }
655 } 658 }
@@ -671,14 +674,14 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16
671 if(prev_frames && orig_fb) 674 if(prev_frames && orig_fb)
672 { 675 {
673 676
674 rb->memcpy(orig_fb, *rb->lcd_framebuffer, sizeof(fb_data) * LCD_WIDTH * LCD_HEIGHT); 677 rb->memcpy(orig_fb, lcd_fb, sizeof(fb_data) * LCD_WIDTH * LCD_HEIGHT);
675 /* fancy useless slow motion blur */ 678 /* fancy useless slow motion blur */
676 for(int y = 0; y < LCD_HEIGHT; ++y) 679 for(int y = 0; y < LCD_HEIGHT; ++y)
677 { 680 {
678 for(int x = 0; x < LCD_WIDTH; ++x) 681 for(int x = 0; x < LCD_WIDTH; ++x)
679 { 682 {
680 int r, g, b; 683 int r, g, b;
681 fb_data pix = *rb->lcd_framebuffer[y * LCD_WIDTH + x]; 684 fb_data pix = lcd_fb[y * LCD_WIDTH + x];
682 r = RGB_UNPACK_RED (pix); 685 r = RGB_UNPACK_RED (pix);
683 g = RGB_UNPACK_GREEN(pix); 686 g = RGB_UNPACK_GREEN(pix);
684 b = RGB_UNPACK_BLUE (pix); 687 b = RGB_UNPACK_BLUE (pix);
@@ -695,7 +698,7 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16
695 r /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1); 698 r /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1);
696 g /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1); 699 g /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1);
697 b /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1); 700 b /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1);
698 *rb->lcd_framebuffer[y * LCD_WIDTH + x] = LCD_RGBPACK(r, g, b); 701 lcd_fb[y * LCD_WIDTH + x] = LCD_RGBPACK(r, g, b);
699 } 702 }
700 } 703 }
701 prev_baseidx -= LCD_WIDTH * LCD_HEIGHT; 704 prev_baseidx -= LCD_WIDTH * LCD_HEIGHT;