diff options
author | Tom Ross <midgey@rockbox.org> | 2007-10-16 18:16:22 +0000 |
---|---|---|
committer | Tom Ross <midgey@rockbox.org> | 2007-10-16 18:16:22 +0000 |
commit | 437c3e40ca7579acc20b648319447045649b0873 (patch) | |
tree | 5504a232c510dff3f3872d8c7dee388fcbfafeb5 /apps/plugins/rockboy/lcd.c | |
parent | 0b911fefea7615105244098da1baf4655fa1e721 (diff) | |
download | rockbox-437c3e40ca7579acc20b648319447045649b0873.tar.gz rockbox-437c3e40ca7579acc20b648319447045649b0873.zip |
Code police and clean up for rockboy.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15144 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/rockboy/lcd.c')
-rw-r--r-- | apps/plugins/rockboy/lcd.c | 95 |
1 files changed, 42 insertions, 53 deletions
diff --git a/apps/plugins/rockboy/lcd.c b/apps/plugins/rockboy/lcd.c index 494160dc85..da3b138e51 100644 --- a/apps/plugins/rockboy/lcd.c +++ b/apps/plugins/rockboy/lcd.c | |||
@@ -5,7 +5,9 @@ | |||
5 | #include "mem.h" | 5 | #include "mem.h" |
6 | #include "lcd-gb.h" | 6 | #include "lcd-gb.h" |
7 | #include "fb.h" | 7 | #include "fb.h" |
8 | #ifdef HAVE_LCD_COLOR | ||
8 | #include "palette-presets.h" | 9 | #include "palette-presets.h" |
10 | #endif | ||
9 | #ifdef USE_ASM | 11 | #ifdef USE_ASM |
10 | #include "asm.h" | 12 | #include "asm.h" |
11 | #endif | 13 | #endif |
@@ -59,7 +61,8 @@ static int dmg_pal[4][4]; | |||
59 | fb_data *vdest; | 61 | fb_data *vdest; |
60 | 62 | ||
61 | #ifndef ASM_UPDATEPATPIX | 63 | #ifndef ASM_UPDATEPATPIX |
62 | void updatepatpix(void) | 64 | static void updatepatpix(void) ICODE_ATTR; |
65 | static void updatepatpix(void) | ||
63 | { | 66 | { |
64 | int i, j; | 67 | int i, j; |
65 | #if ((CONFIG_CPU != SH7034) && !defined(CPU_COLDFIRE)) | 68 | #if ((CONFIG_CPU != SH7034) && !defined(CPU_COLDFIRE)) |
@@ -366,7 +369,8 @@ void updatepatpix(void) | |||
366 | 369 | ||
367 | 370 | ||
368 | 371 | ||
369 | void tilebuf(void) | 372 | static void tilebuf(void) ICODE_ATTR; |
373 | static void tilebuf(void) | ||
370 | { | 374 | { |
371 | int i, cnt; | 375 | int i, cnt; |
372 | int base; | 376 | int base; |
@@ -468,7 +472,8 @@ void tilebuf(void) | |||
468 | * WX = WND start (if 0, no need to do anything) -> WY | 472 | * WX = WND start (if 0, no need to do anything) -> WY |
469 | * U = start...something...thingy... 7 at most | 473 | * U = start...something...thingy... 7 at most |
470 | */ | 474 | */ |
471 | void bg_scan(void) | 475 | static void bg_scan(void) ICODE_ATTR; |
476 | static void bg_scan(void) | ||
472 | { | 477 | { |
473 | int cnt; | 478 | int cnt; |
474 | byte *src, *dest; | 479 | byte *src, *dest; |
@@ -508,7 +513,8 @@ void bg_scan(void) | |||
508 | *(dest++) = *(src++); | 513 | *(dest++) = *(src++); |
509 | } | 514 | } |
510 | 515 | ||
511 | void wnd_scan(void) | 516 | static void wnd_scan(void) ICODE_ATTR; |
517 | static void wnd_scan(void) | ||
512 | { | 518 | { |
513 | int cnt; | 519 | int cnt; |
514 | byte *src, *dest; | 520 | byte *src, *dest; |
@@ -554,7 +560,8 @@ static int priused(void *attr) | |||
554 | return (int)((a[0]|a[1]|a[2]|a[3]|a[4]|a[5]|a[6]|a[7])&0x80808080); | 560 | return (int)((a[0]|a[1]|a[2]|a[3]|a[4]|a[5]|a[6]|a[7])&0x80808080); |
555 | } | 561 | } |
556 | 562 | ||
557 | void bg_scan_pri(void) | 563 | static void bg_scan_pri(void) ICODE_ATTR; |
564 | static void bg_scan_pri(void) | ||
558 | { | 565 | { |
559 | int cnt, i; | 566 | int cnt, i; |
560 | byte *src, *dest; | 567 | byte *src, *dest; |
@@ -584,7 +591,8 @@ void bg_scan_pri(void) | |||
584 | memset(dest, src[i&31]&128, cnt); | 591 | memset(dest, src[i&31]&128, cnt); |
585 | } | 592 | } |
586 | 593 | ||
587 | void wnd_scan_pri(void) | 594 | static void wnd_scan_pri(void) ICODE_ATTR; |
595 | static void wnd_scan_pri(void) | ||
588 | { | 596 | { |
589 | int cnt, i; | 597 | int cnt, i; |
590 | byte *src, *dest; | 598 | byte *src, *dest; |
@@ -610,7 +618,7 @@ void wnd_scan_pri(void) | |||
610 | memset(dest, src[i]&128, cnt); | 618 | memset(dest, src[i]&128, cnt); |
611 | } | 619 | } |
612 | 620 | ||
613 | void bg_scan_color(void) | 621 | static void bg_scan_color(void) |
614 | { | 622 | { |
615 | int cnt; | 623 | int cnt; |
616 | byte *src, *dest; | 624 | byte *src, *dest; |
@@ -684,7 +692,7 @@ void bg_scan_color(void) | |||
684 | blendcpy(dest, src, *(tile++), cnt); | 692 | blendcpy(dest, src, *(tile++), cnt); |
685 | } | 693 | } |
686 | 694 | ||
687 | void wnd_scan_color(void) | 695 | static void wnd_scan_color(void) |
688 | { | 696 | { |
689 | int cnt; | 697 | int cnt; |
690 | byte *src, *dest; | 698 | byte *src, *dest; |
@@ -706,12 +714,8 @@ void wnd_scan_color(void) | |||
706 | blendcpy(dest, src, *(tile++), cnt); | 714 | blendcpy(dest, src, *(tile++), cnt); |
707 | } | 715 | } |
708 | 716 | ||
709 | static void recolor(byte *buf, byte fill, int cnt) | 717 | static void spr_enum(void) ICODE_ATTR; |
710 | { | 718 | static void spr_enum(void) |
711 | while (cnt--) *(buf++) |= fill; | ||
712 | } | ||
713 | |||
714 | void spr_enum(void) | ||
715 | { | 719 | { |
716 | int i, j; | 720 | int i, j; |
717 | struct obj *o; | 721 | struct obj *o; |
@@ -764,14 +768,15 @@ void spr_enum(void) | |||
764 | if (VS[i].x > VS[j].x) | 768 | if (VS[i].x > VS[j].x) |
765 | { | 769 | { |
766 | ts = VS[i]; | 770 | ts = VS[i]; |
767 | VS[i] = VS[j]; | 771 | VS[i] = VS[j]; |
768 | VS[j] = ts; | 772 | VS[j] = ts; |
769 | } | 773 | } |
770 | } | 774 | } |
771 | } | 775 | } |
772 | } | 776 | } |
773 | 777 | ||
774 | void spr_scan(void) | 778 | static void spr_scan(void) ICODE_ATTR; |
779 | static void spr_scan(void) | ||
775 | { | 780 | { |
776 | int i, x; | 781 | int i, x; |
777 | byte pal, b, ns = NS; | 782 | byte pal, b, ns = NS; |
@@ -874,26 +879,27 @@ void lcd_begin(void) | |||
874 | #define S3R ((LCD_HEIGHT-((160*DXR)>>16))/2)*LCD_WIDTH+LCD_WIDTH-1 | 879 | #define S3R ((LCD_HEIGHT-((160*DXR)>>16))/2)*LCD_WIDTH+LCD_WIDTH-1 |
875 | #endif | 880 | #endif |
876 | 881 | ||
877 | set_pal(); | 882 | vdest=rb->lcd_framebuffer; |
878 | |||
879 | #ifdef HAVE_LCD_COLOR | 883 | #ifdef HAVE_LCD_COLOR |
884 | set_pal(); | ||
885 | |||
880 | if(options.rotate) | 886 | if(options.rotate) |
881 | { | 887 | { |
882 | if(options.fullscreen == 0) | 888 | if(options.scaling == 0) |
883 | vdest=fb.ptr+S2R; | 889 | vdest+=+S2R; |
884 | else if (options.fullscreen == 1) | 890 | else if (options.scaling == 1) |
885 | vdest=fb.ptr+S3R; | 891 | vdest+=S3R; |
886 | else | 892 | else |
887 | vdest=fb.ptr+S1R; | 893 | vdest+=S1R; |
888 | } | 894 | } |
889 | else | 895 | else |
890 | { | 896 | { |
891 | if(options.fullscreen == 0) | 897 | if(options.scaling == 0) |
892 | vdest=fb.ptr+S2; | 898 | vdest+=S2; |
893 | else if (options.fullscreen == 1) | 899 | else if (options.scaling == 1) |
894 | vdest=fb.ptr+S3; | 900 | vdest+=S3; |
895 | else | 901 | else |
896 | vdest=fb.ptr+S1; | 902 | vdest+=S1; |
897 | } | 903 | } |
898 | #endif | 904 | #endif |
899 | WY = R_WY; | 905 | WY = R_WY; |
@@ -911,7 +917,7 @@ int sremain IDATA_ATTR=LCD_WIDTH-160; | |||
911 | void setvidmode(void) | 917 | void setvidmode(void) |
912 | { | 918 | { |
913 | #ifdef HAVE_LCD_COLOR | 919 | #ifdef HAVE_LCD_COLOR |
914 | switch(options.fullscreen) | 920 | switch(options.scaling) |
915 | { | 921 | { |
916 | case 0: | 922 | case 0: |
917 | if(options.rotate) | 923 | if(options.rotate) |
@@ -1036,7 +1042,6 @@ void lcd_refreshline(void) | |||
1036 | 1042 | ||
1037 | bg_scan(); | 1043 | bg_scan(); |
1038 | wnd_scan(); | 1044 | wnd_scan(); |
1039 | recolor(BUF+WX, 0x04, 160-WX); | ||
1040 | } | 1045 | } |
1041 | spr_scan(); | 1046 | spr_scan(); |
1042 | 1047 | ||
@@ -1097,13 +1102,13 @@ void lcd_refreshline(void) | |||
1097 | #endif | 1102 | #endif |
1098 | } | 1103 | } |
1099 | 1104 | ||
1105 | #ifdef HAVE_LCD_COLOR | ||
1100 | void set_pal(void) | 1106 | void set_pal(void) |
1101 | { | 1107 | { |
1102 | memcpy(dmg_pal,palettes[options.pal], sizeof dmg_pal); | 1108 | memcpy(dmg_pal,palettes[options.pal], sizeof(dmg_pal)); |
1103 | pal_dirty(); | 1109 | pal_dirty(); |
1104 | } | 1110 | } |
1105 | 1111 | ||
1106 | #ifdef HAVE_LCD_COLOR | ||
1107 | static void updatepalette(int i) | 1112 | static void updatepalette(int i) |
1108 | { | 1113 | { |
1109 | int c, r, g, b; | 1114 | int c, r, g, b; |
@@ -1127,13 +1132,13 @@ static void updatepalette(int i) | |||
1127 | #endif | 1132 | #endif |
1128 | PAL[i] = c; | 1133 | PAL[i] = c; |
1129 | } | 1134 | } |
1130 | #endif | 1135 | #endif /* HAVE_LCD_COLOR */ |
1131 | 1136 | ||
1132 | void pal_write(int i, byte b) | 1137 | void pal_write(int i, byte b) |
1133 | { | 1138 | { |
1134 | if (lcd.pal[i] == b) return; | 1139 | if (lcd.pal[i] == b) return; |
1135 | lcd.pal[i] = b; | 1140 | lcd.pal[i] = b; |
1136 | #if LCD_DEPTH ==16 | 1141 | #ifdef HAVE_LCD_COLOR |
1137 | updatepalette(i>>1); | 1142 | updatepalette(i>>1); |
1138 | #endif | 1143 | #endif |
1139 | } | 1144 | } |
@@ -1175,7 +1180,7 @@ void vram_dirty(void) | |||
1175 | 1180 | ||
1176 | void pal_dirty(void) | 1181 | void pal_dirty(void) |
1177 | { | 1182 | { |
1178 | #if LCD_DEPTH ==16 | 1183 | #ifdef HAVE_LCD_COLOR |
1179 | int i; | 1184 | int i; |
1180 | #endif | 1185 | #endif |
1181 | if (!hw.cgb) | 1186 | if (!hw.cgb) |
@@ -1186,7 +1191,7 @@ void pal_dirty(void) | |||
1186 | pal_write_dmg(64, 2, R_OBP0); | 1191 | pal_write_dmg(64, 2, R_OBP0); |
1187 | pal_write_dmg(72, 3, R_OBP1); | 1192 | pal_write_dmg(72, 3, R_OBP1); |
1188 | } | 1193 | } |
1189 | #if LCD_DEPTH ==16 | 1194 | #ifdef HAVE_LCD_COLOR |
1190 | for (i = 0; i < 64; i++) | 1195 | for (i = 0; i < 64; i++) |
1191 | updatepalette(i); | 1196 | updatepalette(i); |
1192 | #endif | 1197 | #endif |
@@ -1198,19 +1203,3 @@ void lcd_reset(void) | |||
1198 | lcd_begin(); | 1203 | lcd_begin(); |
1199 | vram_dirty(); | 1204 | vram_dirty(); |
1200 | } | 1205 | } |
1201 | |||
1202 | |||
1203 | |||
1204 | |||
1205 | |||
1206 | |||
1207 | |||
1208 | |||
1209 | |||
1210 | |||
1211 | |||
1212 | |||
1213 | |||
1214 | |||
1215 | |||
1216 | |||