@@ -353,7 +353,7 @@ static void _loadAudioLowPassFilterSettings(void) {
353353#define GBA_CC_BG 0.21f
354354#define GBA_CC_GAMMA_ADJ 1.0f
355355
356- static color_t * ccLUT = NULL ;
356+ static mColor * ccLUT = NULL ;
357357static unsigned ccType = 0 ;
358358static bool colorCorrectionEnabled = false;
359359
@@ -456,7 +456,7 @@ static void _initColorCorrection(void) {
456456
457457 /* Allocate look-up table buffer, if required */
458458 if (!ccLUT ) {
459- size_t lutSize = 65536 * sizeof (color_t );
459+ size_t lutSize = 65536 * sizeof (mColor );
460460 ccLUT = malloc (lutSize );
461461 if (!ccLUT ) {
462462 return ;
@@ -553,17 +553,17 @@ enum frame_blend_method
553553
554554static enum frame_blend_method frameBlendType = FRAME_BLEND_NONE ;
555555static bool frameBlendEnabled = false;
556- static color_t * outputBufferPrev1 = NULL ;
557- static color_t * outputBufferPrev2 = NULL ;
558- static color_t * outputBufferPrev3 = NULL ;
559- static color_t * outputBufferPrev4 = NULL ;
556+ static mColor * outputBufferPrev1 = NULL ;
557+ static mColor * outputBufferPrev2 = NULL ;
558+ static mColor * outputBufferPrev3 = NULL ;
559+ static mColor * outputBufferPrev4 = NULL ;
560560static float * outputBufferAccR = NULL ;
561561static float * outputBufferAccG = NULL ;
562562static float * outputBufferAccB = NULL ;
563563static float frameBlendResponse [4 ] = {0.0f };
564564static bool frameBlendResponseSet = false;
565565
566- static bool _allocateOutputBufferPrev (color_t * * buf ) {
566+ static bool _allocateOutputBufferPrev (mColor * * buf ) {
567567 if (!* buf ) {
568568 * buf = malloc (VIDEO_BUFF_SIZE );
569569 if (!* buf ) {
@@ -721,7 +721,7 @@ static void _loadFrameBlendSettings(void) {
721721}
722722
723723/* General post processing buffers/functions */
724- static color_t * ppOutputBuffer = NULL ;
724+ static mColor * ppOutputBuffer = NULL ;
725725
726726static void (* videoPostProcess )(unsigned width , unsigned height ) = NULL ;
727727
@@ -732,8 +732,8 @@ static void (*videoPostProcess)(unsigned width, unsigned height) = NULL;
732732 * minimise logic in the inner loops where possible */
733733static void videoPostProcessCc (unsigned width , unsigned height ) {
734734
735- color_t * src = outputBuffer ;
736- color_t * dst = ppOutputBuffer ;
735+ mColor * src = outputBuffer ;
736+ mColor * dst = ppOutputBuffer ;
737737 size_t x , y ;
738738
739739 for (y = 0 ; y < height ; y ++ ) {
@@ -747,25 +747,25 @@ static void videoPostProcessCc(unsigned width, unsigned height) {
747747
748748static void videoPostProcessMix (unsigned width , unsigned height ) {
749749
750- color_t * srcCurr = outputBuffer ;
751- color_t * srcPrev = outputBufferPrev1 ;
752- color_t * dst = ppOutputBuffer ;
750+ mColor * srcCurr = outputBuffer ;
751+ mColor * srcPrev = outputBufferPrev1 ;
752+ mColor * dst = ppOutputBuffer ;
753753 size_t x , y ;
754754
755755 for (y = 0 ; y < height ; y ++ ) {
756756 for (x = 0 ; x < width ; x ++ ) {
757757
758758 /* Get colours from current + previous frames */
759- color_t rgbCurr = * (srcCurr + x );
760- color_t rgbPrev = * (srcPrev + x );
759+ mColor rgbCurr = * (srcCurr + x );
760+ mColor rgbPrev = * (srcPrev + x );
761761
762762 /* Store colours for next frame */
763- * (srcPrev + x ) = rgbCurr ;
763+ * (srcPrev + x ) = rgbCurr ;
764764
765765 /* Mix colours
766766 * > "Mixing Packed RGB Pixels Efficiently"
767767 * http://blargg.8bitalley.com/info/rgb_mixing.html */
768- color_t rgbMix = (rgbCurr + rgbPrev + ((rgbCurr ^ rgbPrev ) & 0x821 )) >> 1 ;
768+ mColor rgbMix = (rgbCurr + rgbPrev + ((rgbCurr ^ rgbPrev ) & 0x821 )) >> 1 ;
769769
770770 /* Assign colours for current frame */
771771 * (dst + x ) = colorCorrectionEnabled ?
@@ -779,21 +779,21 @@ static void videoPostProcessMix(unsigned width, unsigned height) {
779779
780780static void videoPostProcessMixSmart (unsigned width , unsigned height ) {
781781
782- color_t * srcCurr = outputBuffer ;
783- color_t * srcPrev1 = outputBufferPrev1 ;
784- color_t * srcPrev2 = outputBufferPrev2 ;
785- color_t * srcPrev3 = outputBufferPrev3 ;
786- color_t * dst = ppOutputBuffer ;
782+ mColor * srcCurr = outputBuffer ;
783+ mColor * srcPrev1 = outputBufferPrev1 ;
784+ mColor * srcPrev2 = outputBufferPrev2 ;
785+ mColor * srcPrev3 = outputBufferPrev3 ;
786+ mColor * dst = ppOutputBuffer ;
787787 size_t x , y ;
788788
789789 for (y = 0 ; y < height ; y ++ ) {
790790 for (x = 0 ; x < width ; x ++ ) {
791791
792792 /* Get colours from current + previous frames */
793- color_t rgbCurr = * (srcCurr + x );
794- color_t rgbPrev1 = * (srcPrev1 + x );
795- color_t rgbPrev2 = * (srcPrev2 + x );
796- color_t rgbPrev3 = * (srcPrev3 + x );
793+ mColor rgbCurr = * (srcCurr + x );
794+ mColor rgbPrev1 = * (srcPrev1 + x );
795+ mColor rgbPrev2 = * (srcPrev2 + x );
796+ mColor rgbPrev3 = * (srcPrev3 + x );
797797
798798 /* Store colours for next frame */
799799 * (srcPrev1 + x ) = rgbCurr ;
@@ -811,7 +811,7 @@ static void videoPostProcessMixSmart(unsigned width, unsigned height) {
811811 /* Mix colours
812812 * > "Mixing Packed RGB Pixels Efficiently"
813813 * http://blargg.8bitalley.com/info/rgb_mixing.html */
814- color_t rgbMix = (rgbCurr + rgbPrev1 + ((rgbCurr ^ rgbPrev1 ) & 0x821 )) >> 1 ;
814+ mColor rgbMix = (rgbCurr + rgbPrev1 + ((rgbCurr ^ rgbPrev1 ) & 0x821 )) >> 1 ;
815815
816816 /* Assign colours for current frame */
817817 * (dst + x ) = colorCorrectionEnabled ?
@@ -833,24 +833,24 @@ static void videoPostProcessMixSmart(unsigned width, unsigned height) {
833833
834834static void videoPostProcessLcdGhost (unsigned width , unsigned height ) {
835835
836- color_t * srcCurr = outputBuffer ;
837- color_t * srcPrev1 = outputBufferPrev1 ;
838- color_t * srcPrev2 = outputBufferPrev2 ;
839- color_t * srcPrev3 = outputBufferPrev3 ;
840- color_t * srcPrev4 = outputBufferPrev4 ;
841- color_t * dst = ppOutputBuffer ;
842- float * response = frameBlendResponse ;
836+ mColor * srcCurr = outputBuffer ;
837+ mColor * srcPrev1 = outputBufferPrev1 ;
838+ mColor * srcPrev2 = outputBufferPrev2 ;
839+ mColor * srcPrev3 = outputBufferPrev3 ;
840+ mColor * srcPrev4 = outputBufferPrev4 ;
841+ mColor * dst = ppOutputBuffer ;
842+ float * response = frameBlendResponse ;
843843 size_t x , y ;
844844
845845 for (y = 0 ; y < height ; y ++ ) {
846846 for (x = 0 ; x < width ; x ++ ) {
847847
848848 /* Get colours from current + previous frames */
849- color_t rgbCurr = * (srcCurr + x );
850- color_t rgbPrev1 = * (srcPrev1 + x );
851- color_t rgbPrev2 = * (srcPrev2 + x );
852- color_t rgbPrev3 = * (srcPrev3 + x );
853- color_t rgbPrev4 = * (srcPrev4 + x );
849+ mColor rgbCurr = * (srcCurr + x );
850+ mColor rgbPrev1 = * (srcPrev1 + x );
851+ mColor rgbPrev2 = * (srcPrev2 + x );
852+ mColor rgbPrev3 = * (srcPrev3 + x );
853+ mColor rgbPrev4 = * (srcPrev4 + x );
854854
855855 /* Store colours for next frame */
856856 * (srcPrev1 + x ) = rgbCurr ;
@@ -879,7 +879,7 @@ static void videoPostProcessLcdGhost(unsigned width, unsigned height) {
879879 float gPrev4 = (float )(rgbPrev4 >> 6 & 0x1F );
880880 float bPrev4 = (float )(rgbPrev4 & 0x1F );
881881
882- /* Mix colours for current frame and convert back to color_t
882+ /* Mix colours for current frame and convert back to mColor
883883 * > Response time effect implemented via an exponential
884884 * drop-off algorithm, taken from the 'Gameboy Classic Shader'
885885 * by Harlequin:
@@ -888,19 +888,19 @@ static void videoPostProcessLcdGhost(unsigned width, unsigned height) {
888888 rCurr += (rPrev2 - rCurr ) * * (response + 1 );
889889 rCurr += (rPrev3 - rCurr ) * * (response + 2 );
890890 rCurr += (rPrev4 - rCurr ) * * (response + 3 );
891- color_t rMix = (color_t )(rCurr + 0.5f ) & 0x1F ;
891+ mColor rMix = (mColor )(rCurr + 0.5f ) & 0x1F ;
892892
893893 gCurr += (gPrev1 - gCurr ) * * response ;
894894 gCurr += (gPrev2 - gCurr ) * * (response + 1 );
895895 gCurr += (gPrev3 - gCurr ) * * (response + 2 );
896896 gCurr += (gPrev4 - gCurr ) * * (response + 3 );
897- color_t gMix = (color_t )(gCurr + 0.5f ) & 0x1F ;
897+ mColor gMix = (mColor )(gCurr + 0.5f ) & 0x1F ;
898898
899899 bCurr += (bPrev1 - bCurr ) * * response ;
900900 bCurr += (bPrev2 - bCurr ) * * (response + 1 );
901901 bCurr += (bPrev3 - bCurr ) * * (response + 2 );
902902 bCurr += (bPrev4 - bCurr ) * * (response + 3 );
903- color_t bMix = (color_t )(bCurr + 0.5f ) & 0x1F ;
903+ mColor bMix = (mColor )(bCurr + 0.5f ) & 0x1F ;
904904
905905 /* Repack colours for current frame */
906906 * (dst + x ) = colorCorrectionEnabled ?
@@ -918,21 +918,21 @@ static void videoPostProcessLcdGhost(unsigned width, unsigned height) {
918918
919919static void videoPostProcessLcdGhostFast (unsigned width , unsigned height ) {
920920
921- color_t * srcCurr = outputBuffer ;
922- float * srcPrevR = outputBufferAccR ;
923- float * srcPrevG = outputBufferAccG ;
924- float * srcPrevB = outputBufferAccB ;
925- color_t * dst = ppOutputBuffer ;
921+ mColor * srcCurr = outputBuffer ;
922+ float * srcPrevR = outputBufferAccR ;
923+ float * srcPrevG = outputBufferAccG ;
924+ float * srcPrevB = outputBufferAccB ;
925+ mColor * dst = ppOutputBuffer ;
926926 size_t x , y ;
927927
928928 for (y = 0 ; y < height ; y ++ ) {
929929 for (x = 0 ; x < width ; x ++ ) {
930930
931931 /* Get colours from current + previous frames */
932- color_t rgbCurr = * (srcCurr + x );
933- float rPrev = * (srcPrevR + x );
934- float gPrev = * (srcPrevG + x );
935- float bPrev = * (srcPrevB + x );
932+ mColor rgbCurr = * (srcCurr + x );
933+ float rPrev = * (srcPrevR + x );
934+ float gPrev = * (srcPrevG + x );
935+ float bPrev = * (srcPrevB + x );
936936
937937 /* Unpack current colours and convert to float */
938938 float rCurr = (float )(rgbCurr >> 11 & 0x1F );
@@ -950,9 +950,9 @@ static void videoPostProcessLcdGhostFast(unsigned width, unsigned height) {
950950 * (srcPrevB + x ) = bMix ;
951951
952952 /* Convert and repack current frame colours */
953- color_t rgbMix = ((color_t )(rMix + 0.5f ) & 0x1F ) << 11
954- | ((color_t )(gMix + 0.5f ) & 0x1F ) << 6
955- | ((color_t )(bMix + 0.5f ) & 0x1F );
953+ mColor rgbMix = ((mColor )(rMix + 0.5f ) & 0x1F ) << 11
954+ | ((mColor )(gMix + 0.5f ) & 0x1F ) << 6
955+ | ((mColor )(bMix + 0.5f ) & 0x1F );
956956
957957 /* Assign colours for current frame */
958958 * (dst + x ) = colorCorrectionEnabled ?
@@ -1682,12 +1682,12 @@ void retro_run(void) {
16821682#if defined(COLOR_16_BIT ) && defined(COLOR_5_6_5 )
16831683 if (videoPostProcess ) {
16841684 videoPostProcess (width , height );
1685- videoCallback (ppOutputBuffer , width , height , VIDEO_WIDTH_MAX * sizeof (color_t ));
1685+ videoCallback (ppOutputBuffer , width , height , VIDEO_WIDTH_MAX * sizeof (mColor ));
16861686 } else
16871687#endif
1688- videoCallback (outputBuffer , width , height , VIDEO_WIDTH_MAX * sizeof (color_t ));
1688+ videoCallback (outputBuffer , width , height , VIDEO_WIDTH_MAX * sizeof (mColor ));
16891689 } else {
1690- videoCallback (NULL , width , height , VIDEO_WIDTH_MAX * sizeof (color_t ));
1690+ videoCallback (NULL , width , height , VIDEO_WIDTH_MAX * sizeof (mColor ));
16911691 }
16921692
16931693#ifdef M_CORE_GBA
0 commit comments