diff --git a/src/sdl/main.c b/src/sdl/main.c
index 36b32798913dd64aa89f179ecec0dee2a9c80a8e..9227725c9876a90f48dd1c9380ab3695acda90ae 100644 (file)
--- a/src/sdl/main.c
+++ b/src/sdl/main.c
static SDL_Surface *surf = NULL;
static int mode = MODE_NONE;
static int text_input;
+static videomode_t vlist;
/* --- error.h --- */
return s != NULL;
}
+static void init_videomode_list (Uint32 flags) {
+ int i, n;
+ SDL_Rect **r;
+ if (vlist.modes != NULL) {
+ free(vlist.modes);
+ vlist.modes = NULL;
+ vlist.n = 0;
+ }
+ r = SDL_ListModes(NULL, flags);
+ if (r == (SDL_Rect **)-1) {
+ if ((flags & SDL_FULLSCREEN) == 0) {
+ init_videomode_list(flags | SDL_FULLSCREEN);
+ }
+ } else if (r != (SDL_Rect**)0) {
+ n = 0;
+ while (r[n] != NULL) {
+ n++;
+ }
+ vlist.modes = malloc(n * sizeof(videomode_size_t));
+ if (vlist.modes != NULL) {
+ vlist.n = n;
+ for (i = 0; i < n; i++) {
+ vlist.modes[i] = (videomode_size_t) {
+ .w = r[i]->w,
+ .h = r[i]->h
+ };
+ }
+ }
+ }
+}
+
+const videomode_t *Y_get_videomode_list_opengl (int fullscreen) {
+ init_videomode_list(SDL_OPENGL | (fullscreen ? SDL_FULLSCREEN : 0));
+ return &vlist;
+}
+
+const videomode_t *Y_get_videomode_list_software (int fullscreen) {
+ init_videomode_list(SDL_SWSURFACE | SDL_HWPALETTE | (fullscreen ? SDL_FULLSCREEN : 0));
+ return &vlist;
+}
+
void Y_get_videomode (int *w, int *h) {
if (mode != MODE_NONE) {
*w = surf->w;