Skip to content

Commit 4b8191c

Browse files
mardyWinterMute
authored andcommitted
ogc: add a 320x240 video mode
This is a low resolution video mode with less elongated pixels than, the 640x240 modes provided by libogc.
1 parent 4fb4eba commit 4b8191c

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/video/ogc/SDL_ogcvideo.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
// Inverse of the VI_TVMODE macro
4747
#define VI_FORMAT_FROM_MODE(tvmode) (tvmode >> 2)
4848

49+
/* A video mode with a 320 width; we'll build it programmatically. */
50+
static GXRModeObj s_mode320;
51+
4952
static const GXRModeObj *s_ntsc_modes[] = {
5053
&TVNtsc240Ds,
5154
&TVNtsc480Prog,
@@ -127,6 +130,19 @@ static void add_supported_modes(SDL_VideoDisplay *display, u32 tv_format)
127130
return;
128131
}
129132

133+
/* All libogc video modes are 640 pixel wide, even the 240p ones. While
134+
* this can be useful for some applications, others might prefer a video
135+
* mode with less elongated pixels, such as 320x240. Therefore, let's
136+
* create one: we take the first video mode in the array (which has always
137+
* a height of approximately 240p) and we use it as template to build the
138+
* "mode320": we just set the fbWidth field to 320: the VI interface will
139+
* take care of the horizontal scale for us. */
140+
memcpy(&s_mode320, gx_modes[0], sizeof(s_mode320));
141+
s_mode320.fbWidth = 320;
142+
init_display_mode(&mode, &s_mode320);
143+
SDL_AddDisplayMode(display, &mode);
144+
145+
/* Now add all the "standard" modes from libogc */
130146
while (*gx_modes) {
131147
init_display_mode(&mode, *gx_modes);
132148
SDL_AddDisplayMode(display, &mode);

0 commit comments

Comments
 (0)