gfx_get_video_modes now returns the right number of modes

This commit is contained in:
Alfred Eriksson 2008-11-08 15:44:22 +00:00
parent 579065bb22
commit c54c9a1e5c

View file

@ -357,7 +357,7 @@ VIDEO_MODE fakemodes[] = {
int gfx_get_video_modes(VIDEO_MODE *list, int maxcount) int gfx_get_video_modes(VIDEO_MODE *list, int maxcount)
{ {
int num_modes = 0; int num_modes = sizeof(fakemodes)/sizeof(VIDEO_MODE);
SDL_Rect **modes; SDL_Rect **modes;
if(config.gfx_display_all_modes) if(config.gfx_display_all_modes)
@ -375,6 +375,7 @@ int gfx_get_video_modes(VIDEO_MODE *list, int maxcount)
if(modes == NULL) if(modes == NULL)
{ {
/* no modes */ /* no modes */
num_modes = 0;
} }
else if(modes == (SDL_Rect**)-1) else if(modes == (SDL_Rect**)-1)
{ {
@ -383,6 +384,7 @@ int gfx_get_video_modes(VIDEO_MODE *list, int maxcount)
else else
{ {
int i; int i;
num_modes = 0;
for(i = 0; modes[i]; ++i) for(i = 0; modes[i]; ++i)
{ {
if(num_modes == maxcount) if(num_modes == maxcount)
@ -396,7 +398,7 @@ int gfx_get_video_modes(VIDEO_MODE *list, int maxcount)
} }
} }
return 1; /* TODO: SDL*/ return num_modes;
} }
void gfx_set_vsync(int val) void gfx_set_vsync(int val)