Skip to content

Commit

Permalink
video: add RGB 480p progressive mode
Browse files Browse the repository at this point in the history
This mode was used in the Wii arcade board (RVA-001). Detecting it
for use with VIDEO_GetPreferredMode() would require some logic
involving reading /title/00000001/00000002/data/RVA.txt since that
is the main method used to detect the board instead of SC.
Due to the relative clumsiness involved I decided to leave it out
for now.
  • Loading branch information
shizmob committed Jan 28, 2024
1 parent b61db13 commit 2f09ca1
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 12 deletions.
7 changes: 7 additions & 0 deletions gc/ogc/video_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ distribution.
#define VI_MAX_WIDTH_EURGB60 VI_MAX_WIDTH_NTSC
#define VI_MAX_HEIGHT_EURGB60 VI_MAX_HEIGHT_NTSC

#define VI_MAX_WIDTH_DEBUG VI_MAX_WIDTH_NTSC
#define VI_MAX_HEIGHT_DEBUG VI_MAX_HEIGHT_NTSC

#define VIDEO_PadFramebufferWidth(width) ((u16)(((u16)(width) + 15) & ~15)) /*!< macro to pad the width to a multiple of 16 */

/*!
Expand All @@ -133,6 +136,7 @@ distribution.
#define VI_TVMODE_MPAL_PROG VI_TVMODE(VI_MPAL, VI_PROGRESSIVE)

#define VI_TVMODE_DEBUG_INT VI_TVMODE(VI_DEBUG, VI_INTERLACE)
#define VI_TVMODE_DEBUG_PROG VI_TVMODE(VI_DEBUG, VI_PROGRESSIVE)

#define VI_TVMODE_DEBUG_PAL_INT VI_TVMODE(VI_DEBUG_PAL, VI_INTERLACE)
#define VI_TVMODE_DEBUG_PAL_DS VI_TVMODE(VI_DEBUG_PAL, VI_NON_INTERLACE)
Expand Down Expand Up @@ -191,6 +195,9 @@ extern GXRModeObj TVEurgb60Hz480IntAa;
extern GXRModeObj TVEurgb60Hz480Prog;
extern GXRModeObj TVEurgb60Hz480ProgSoft;
extern GXRModeObj TVEurgb60Hz480ProgAa;
extern GXRModeObj TVRgb480Prog; /*!< Video and render mode configuration for 480 lines,progressive,singlefield RGB mode */
extern GXRModeObj TVRgb480ProgSoft;
extern GXRModeObj TVRgb480ProgAa;

/*!
* @}
Expand Down
122 changes: 110 additions & 12 deletions libogc/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,111 @@ GXRModeObj TVEurgb60Hz480ProgAa =
}
};

GXRModeObj TVRgb480Prog =
{
VI_TVMODE_DEBUG_PROG, // viDisplayMode
640, // fbWidth
480, // efbHeight
480, // xfbHeight
(VI_MAX_WIDTH_DEBUG - 640)/2, // viXOrigin
(VI_MAX_HEIGHT_DEBUG - 480)/2, // viYOrigin
640, // viWidth
480, // viHeight
VI_XFBMODE_SF, // xFBmode
GX_TRUE, // rgb
GX_FALSE, // field_rendering
GX_FALSE, // aa

// sample points arranged in increasing Y order
{
{6,6},{6,6},{6,6}, // pix 0, 3 sample points, 1/12 units, 4 bits each
{6,6},{6,6},{6,6}, // pix 1
{6,6},{6,6},{6,6}, // pix 2
{6,6},{6,6},{6,6} // pix 3
},

// vertical filter[7], 1/64 units, 6 bits each
{
0, // line n-1
0, // line n-1
21, // line n
22, // line n
21, // line n
0, // line n+1
0 // line n+1
}
};

GXRModeObj TVRgb480ProgSoft =
{
VI_TVMODE_DEBUG_PROG, // viDisplayMode
640, // fbWidth
480, // efbHeight
480, // xfbHeight
(VI_MAX_WIDTH_DEBUG - 640)/2, // viXOrigin
(VI_MAX_HEIGHT_DEBUG - 480)/2, // viYOrigin
640, // viWidth
480, // viHeight
VI_XFBMODE_SF, // xFBmode
GX_TRUE, // rgb
GX_FALSE, // field_rendering
GX_FALSE, // aa

// sample points arranged in increasing Y order
{
{6,6},{6,6},{6,6}, // pix 0, 3 sample points, 1/12 units, 4 bits each
{6,6},{6,6},{6,6}, // pix 1
{6,6},{6,6},{6,6}, // pix 2
{6,6},{6,6},{6,6} // pix 3
},

// vertical filter[7], 1/64 units, 6 bits each
{
8, // line n-1
8, // line n-1
10, // line n
12, // line n
10, // line n
8, // line n+1
8 // line n+1
}
};

GXRModeObj TVRgb480ProgAa =
{
VI_TVMODE_DEBUG_PROG, // viDisplayMode
640, // fbWidth
480, // efbHeight
480, // xfbHeight
(VI_MAX_WIDTH_DEBUG - 640)/2, // viXOrigin
(VI_MAX_HEIGHT_DEBUG - 480)/2, // viYOrigin
640, // viWidth
480, // viHeight
VI_XFBMODE_SF, // xFBmode
GX_TRUE, // rgb
GX_FALSE, // field_rendering
GX_TRUE, // aa

// sample points arranged in increasing Y order
{
{3,2},{9,6},{3,10}, // pix 0, 3 sample points, 1/12 units, 4 bits each
{3,2},{9,6},{3,10}, // pix 1
{9,2},{3,6},{9,10}, // pix 2
{9,2},{3,6},{9,10} // pix 3
},

// vertical filter[7], 1/64 units, 6 bits each
{
4, // line n-1
8, // line n-1
12, // line n
16, // line n
12, // line n
8, // line n+1
4 // line n+1
}
};


static const u16 taps[26] = {
0x01F0,0x01DC,0x01AE,0x0174,0x0129,0x00DB,
Expand Down Expand Up @@ -1762,9 +1867,11 @@ static const struct _timing* __gettiming(u32 vimode)
{
switch(vimode) {
case VI_TVMODE_NTSC_INT:
case VI_TVMODE_EURGB60_INT:
return &video_timing[0];
break;
case VI_TVMODE_NTSC_DS:
case VI_TVMODE_EURGB60_DS:
return &video_timing[1];
break;
case VI_TVMODE_PAL_INT:
Expand All @@ -1773,30 +1880,21 @@ static const struct _timing* __gettiming(u32 vimode)
case VI_TVMODE_PAL_DS:
return &video_timing[3];
break;
case VI_TVMODE_EURGB60_INT:
return &video_timing[0];
break;
case VI_TVMODE_EURGB60_DS:
return &video_timing[1];
break;
case VI_TVMODE_MPAL_INT:
return &video_timing[4];
break;
case VI_TVMODE_MPAL_DS:
return &video_timing[5];
break;
case VI_TVMODE_NTSC_PROG:
case VI_TVMODE_EURGB60_PROG:
case VI_TVMODE_MPAL_PROG:
case VI_TVMODE_DEBUG_PROG:
return &video_timing[6];
break;
case VI_TVMODE_PAL_PROG:
return &video_timing[7];
break;
case VI_TVMODE_EURGB60_PROG:
return &video_timing[6];
break;
case VI_TVMODE_MPAL_PROG:
return &video_timing[6];
break;
default:
return NULL;
}
Expand Down

0 comments on commit 2f09ca1

Please sign in to comment.