add SDL_USE240P flag, and some better video mode config behaviour

this new SDL_USE240P flag must be provided to SDL_SetVideoMode if
the application wants to use a 240p TV video mode _AND_ only is used
if the video mode being set with SDL_SetVideoMode is 320x240. otherwise
libogc's VIDEO_GetPreferredMode is used which will result in either
480i or 480p

also borrowed some of the logic from VIDEO_GetPreferredMode to set an
equivalent video mode to 240p for PAL regions
This commit is contained in:
Gered 2016-10-30 15:23:27 -04:00
parent c40dab22fe
commit ff724a67a4
2 changed files with 52 additions and 4 deletions

View file

@ -135,6 +135,9 @@ typedef struct SDL_Surface {
#define SDL_SRCALPHA 0x00010000 /* Blit uses source alpha blending */ #define SDL_SRCALPHA 0x00010000 /* Blit uses source alpha blending */
#define SDL_PREALLOC 0x01000000 /* Surface uses preallocated memory */ #define SDL_PREALLOC 0x01000000 /* Surface uses preallocated memory */
/* **** added specifically for use with SDL-Wii, used with SDL_SetVideoMode() **** */
#define SDL_USE240P 0x02000000 /* if using 320x240, use a 240p TV video mode */
/* Evaluates to true if the surface needs to be locked before access */ /* Evaluates to true if the surface needs to be locked before access */
#define SDL_MUSTLOCK(surface) \ #define SDL_MUSTLOCK(surface) \
(surface->offset || \ (surface->offset || \

View file

@ -318,13 +318,58 @@ void PickWiiVideoMode(GXRModeObj **picked_mode, int width, int height, Uint32 fl
{ {
*picked_mode = NULL; *picked_mode = NULL;
if (height == 240) if (height == 240 && (flags & SDL_USE240P))
{ {
// implementation based on libogc's VIDEO_GetPreferredMode
//
// TODO: i do not have access to PAL hardware and have only tested this
// for NTSC 240p modes. i assume that this should work for PAL,
// but it might not!
#if defined(HW_RVL)
u32 tvmode = CONF_GetVideo();
switch (tvmode)
{
case CONF_VIDEO_NTSC:
*picked_mode = &TVNtsc240Ds;
break;
case CONF_VIDEO_PAL:
if (CONF_GetEuRGB60() > 0)
*picked_mode = &TVEurgb60Hz240Ds;
else
*picked_mode = &TVPal264Ds;
break;
case CONF_VIDEO_MPAL:
*picked_mode = &TVMpal240Ds;
break;
default:
*picked_mode = &TVNtsc240Ds; *picked_mode = &TVNtsc240Ds;
} }
else if (height == 480) #else
u32 tvmode = VIDEO_GetCurrentTvMode();
switch (tvmode)
{ {
*picked_mode = &TVNtsc480Int; case VI_NTSC:
*picked_mode = &TVNtsc240Ds;
break;
case VI_PAL:
*picked_mode = &TVPal264Ds;
break;
case VI_MPAL:
*picked_mode = &TVMpal240Ds;
break;
case VI_EURGB60:
*picked_mode = &TVEurgb60Hz240Ds;
break;
default:
*picked_mode = &TVNtsc240Ds;
}
#endif
}
else if (height == 240 || height == 480)
{
// fall back to whatever libogc decides to use (either 480i or 480p)
*picked_mode = VIDEO_GetPreferredMode(NULL);
} }
} }