Commit c9c04a27 authored by Sam Lantinga's avatar Sam Lantinga

Added photon fixes submitted by Luca Barbato

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40205
parent 5c8d9f8f
...@@ -205,7 +205,7 @@ SDL_Rect **ph_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) ...@@ -205,7 +205,7 @@ SDL_Rect **ph_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
void ph_FreeVideoModes(_THIS) void ph_FreeVideoModes(_THIS)
{ {
int i; // int i;
// if ( SDL_modelist ) { // if ( SDL_modelist ) {
// for ( i=0; SDL_modelist[i]; ++i ) { // for ( i=0; SDL_modelist[i]; ++i ) {
...@@ -222,9 +222,10 @@ static void set_best_resolution(_THIS, int width, int height) ...@@ -222,9 +222,10 @@ static void set_best_resolution(_THIS, int width, int height)
if ( use_vidmode ) { if ( use_vidmode ) {
PgDisplaySettings_t settings; PgDisplaySettings_t settings;
PgVideoModeInfo_t current_mode_info; PgVideoModeInfo_t current_mode_info;
PgHWCaps_t my_hwcaps;
unsigned short current_bpp; unsigned short current_bpp;
int i; int i;
/*
if (PgGetVideoMode( &settings ) < 0) if (PgGetVideoMode( &settings ) < 0)
{ {
fprintf(stderr,"error: PgGetVideoMode failed\n"); fprintf(stderr,"error: PgGetVideoMode failed\n");
...@@ -234,6 +235,17 @@ static void set_best_resolution(_THIS, int width, int height) ...@@ -234,6 +235,17 @@ static void set_best_resolution(_THIS, int width, int height)
{ {
fprintf(stderr,"error: PgGetVideoModeInfo failed\n"); fprintf(stderr,"error: PgGetVideoModeInfo failed\n");
return; return;
}
*/
//lu_zero
if (PgGetGraphicsHWCaps(&my_hwcaps) < 0)
{
fprintf(stderr,"set_best_resolution: GetGraphicsHWCaps failed!! \n");
//that HAVE to work
}
if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &current_mode_info) < 0)
{
fprintf(stderr,"set_best_resolution: PgGetVideoModeInfo failed\n");
} }
current_bpp = current_mode_info.bits_per_pixel; current_bpp = current_mode_info.bits_per_pixel;
...@@ -279,13 +291,24 @@ static void get_real_resolution(_THIS, int* w, int* h) ...@@ -279,13 +291,24 @@ static void get_real_resolution(_THIS, int* w, int* h)
{ {
if ( use_vidmode ) { if ( use_vidmode ) {
PgDisplaySettings_t settings; //PgDisplaySettings_t settings;
PgVideoModeInfo_t current_mode_info;
PgHWCaps_t my_hwcaps;
int unused; int unused;
/*
if (PgGetVideoMode( &settings ) >= 0) { if (PgGetVideoMode( &settings ) >= 0) {
*w = settings.xres; *w = settings.xres;
*h = settings.yres; *h = settings.yres;
return; return;
}*/
if (PgGetGraphicsHWCaps(&my_hwcaps) >= 0)
{
if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &current_mode_info) < 0)
{
fprintf(stderr,"get_real_resolution: PgGetVideoModeInfo failed\n");
}
*w = current_mode_info.width;
*h = current_mode_info.height;
} }
} }
// *w = DisplayWidth(SDL_Display, SDL_Screen); // *w = DisplayWidth(SDL_Display, SDL_Screen);
......
...@@ -154,6 +154,7 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -154,6 +154,7 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
int rtnval; int rtnval;
PgDisplaySettings_t mysettings; PgDisplaySettings_t mysettings;
PgVideoModeInfo_t my_mode_info; PgVideoModeInfo_t my_mode_info;
PgHWCaps_t my_hwcaps;
if( NULL == ( event = malloc( EVENT_SIZE ) ) ) if( NULL == ( event = malloc( EVENT_SIZE ) ) )
exit( EXIT_FAILURE ); exit( EXIT_FAILURE );
...@@ -207,13 +208,19 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -207,13 +208,19 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
if(SDL_BlankCursor == NULL) if(SDL_BlankCursor == NULL)
printf("could not create blank cursor\n"); printf("could not create blank cursor\n");
/* Get the video mode */ /* Get the video mode */
/*
if (PgGetVideoMode( &mysettings ) < 0) if (PgGetVideoMode( &mysettings ) < 0)
{ {
fprintf(stderr,"ph_VideoInit: PgGetVideoMode failed\n"); fprintf(stderr,"ph_VideoInit: PgGetVideoMode failed patch A?? \n");
//QNX6/Patch A always fails return code even though call succeeds. fixed Patch B //QNX6/Patch A always fails return code even though call succeeds. fixed Patch B
} }
*/
if (PgGetVideoModeInfo(mysettings.mode, &my_mode_info) < 0) if (PgGetGraphicsHWCaps(&my_hwcaps) < 0)
{
fprintf(stderr,"ph_VideoInit: GetGraphicsHWCaps failed!! \n");
//that HAVE to work
}
if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &my_mode_info) < 0)
{ {
fprintf(stderr,"ph_VideoInit: PgGetVideoModeInfo failed\n"); fprintf(stderr,"ph_VideoInit: PgGetVideoModeInfo failed\n");
} }
...@@ -258,6 +265,7 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -258,6 +265,7 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
{ {
PhRegion_t region_info; PhRegion_t region_info;
PgDisplaySettings_t settings; PgDisplaySettings_t settings;
PgHWCaps_t my_hwcaps;
PgVideoModeInfo_t mode_info; PgVideoModeInfo_t mode_info;
int mode, actual_width, actual_height; int mode, actual_width, actual_height;
PtArg_t arg[5]; PtArg_t arg[5];
...@@ -295,13 +303,20 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -295,13 +303,20 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
/* Get the video mode and set it */ /* Get the video mode and set it */
if (bpp == 0) if (bpp == 0)
{ {
/*again same issue, same solution
if (PgGetVideoMode( &settings ) < 0) if (PgGetVideoMode( &settings ) < 0)
{ {
fprintf(stderr,"error: PgGetVideoMode failed\n"); fprintf(stderr,"error: PgGetVideoMode failed\n");
} }
if (PgGetVideoModeInfo(settings.mode, &mode_info) < 0) */
if (PgGetGraphicsHWCaps(&my_hwcaps) < 0)
{
fprintf(stderr,"ph_SetVideoMode: GetGraphicsHWCaps failed!! \n");
//that HAVE to work
}
if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &mode_info) < 0)
{ {
fprintf(stderr,"error: PgGetVideoModeInfo failed\n"); fprintf(stderr,"ph_SetVideoMode: PgGetVideoModeInfo failed\n");
} }
bpp = mode_info.bits_per_pixel; bpp = mode_info.bits_per_pixel;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment