Color Depth configuration is now entirely automatic
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2162 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Changes towards version 0.5:
|
||||
- Color depth is now determined entirely automatically - Michael
|
||||
- Text input is now available in languages other than English
|
||||
(UCS/Unicode; SDL does not support Unicode input on Windows yet;
|
||||
you must have proper font chars installed -- see translations) - Alex
|
||||
|
||||
@@ -132,7 +132,7 @@ typedef struct tfb_dc_signal
|
||||
|
||||
typedef struct tfb_dc_reinit_video
|
||||
{
|
||||
int driver, flags, width, height, bpp;
|
||||
int driver, flags, width, height;
|
||||
} TFB_DrawCommand_ReinitVideo;
|
||||
|
||||
typedef struct tfb_drawcommand
|
||||
|
||||
@@ -55,7 +55,7 @@ enum
|
||||
extern int GfxFlags;
|
||||
|
||||
void TFB_PreInit (void);
|
||||
int TFB_InitGraphics (int driver, int flags, int width, int height, int bpp);
|
||||
int TFB_InitGraphics (int driver, int flags, int width, int height);
|
||||
void TFB_UninitGraphics (void);
|
||||
void TFB_ProcessEvents (void);
|
||||
|
||||
|
||||
@@ -69,11 +69,10 @@ ReInit_Screen (SDL_Surface **screen, SDL_Surface *template, int w, int h)
|
||||
return *screen == 0 ? -1 : 0;
|
||||
}
|
||||
|
||||
int
|
||||
TFB_GL_ConfigureVideo (int driver, int flags, int width, int height, int bpp)
|
||||
static int
|
||||
AttemptColorDepth (int flags, int width, int height, int bpp)
|
||||
{
|
||||
int i, videomode_flags, texture_width, texture_height;
|
||||
GraphicsDriver = driver;
|
||||
int videomode_flags;
|
||||
ScreenColorDepth = bpp;
|
||||
ScreenWidthActual = width;
|
||||
ScreenHeightActual = height;
|
||||
@@ -125,13 +124,31 @@ TFB_GL_ConfigureVideo (int driver, int flags, int width, int height, int bpp)
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "Set the resolution to: %ix%ix%i\n",
|
||||
fprintf (stderr, "Set the resolution to: %ix%ix%i (surface reports %ix%ix%i)\n",
|
||||
width, height, bpp,
|
||||
SDL_GetVideoSurface()->w, SDL_GetVideoSurface()->h,
|
||||
SDL_GetVideoSurface()->format->BitsPerPixel);
|
||||
|
||||
fprintf (stderr, "OpenGL renderer: %s version: %s\n",
|
||||
glGetString (GL_RENDERER), glGetString (GL_VERSION));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
TFB_GL_ConfigureVideo (int driver, int flags, int width, int height)
|
||||
{
|
||||
int i, texture_width, texture_height;
|
||||
GraphicsDriver = driver;
|
||||
|
||||
if (AttemptColorDepth (flags, width, height, 32) &&
|
||||
AttemptColorDepth (flags, width, height, 24) &&
|
||||
AttemptColorDepth (flags, width, height, 16))
|
||||
{
|
||||
fprintf (stderr, "Couldn't set any OpenGL %ix%i video mode!\n",
|
||||
width, height);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (format_conv_surf)
|
||||
SDL_FreeSurface (format_conv_surf);
|
||||
@@ -210,7 +227,7 @@ TFB_GL_ConfigureVideo (int driver, int flags, int width, int height, int bpp)
|
||||
}
|
||||
|
||||
int
|
||||
TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
||||
TFB_GL_InitGraphics (int driver, int flags, int width, int height)
|
||||
{
|
||||
char VideoName[256];
|
||||
|
||||
@@ -224,7 +241,7 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
||||
ScreenWidth = 320;
|
||||
ScreenHeight = 240;
|
||||
|
||||
if (TFB_GL_ConfigureVideo (driver, flags, width, height, bpp))
|
||||
if (TFB_GL_ConfigureVideo (driver, flags, width, height))
|
||||
{
|
||||
fprintf (stderr, "Could not initialize video: "
|
||||
"no fallback at start of program!\n");
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
#include "libs/graphics/sdl/sdl_common.h"
|
||||
|
||||
int TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp);
|
||||
int TFB_GL_ConfigureVideo (int driver, int flags, int width, int height, int bpp);
|
||||
int TFB_GL_InitGraphics (int driver, int flags, int width, int height);
|
||||
int TFB_GL_ConfigureVideo (int driver, int flags, int width, int height);
|
||||
void TFB_GL_UploadTransitionScreen (void);
|
||||
void TFB_GL_SwapBuffers (int force_full_redraw);
|
||||
|
||||
|
||||
@@ -53,14 +53,12 @@ ReInit_Screen (SDL_Surface **screen, SDL_Surface *template, int w, int h)
|
||||
}
|
||||
|
||||
int
|
||||
TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height,
|
||||
int bpp)
|
||||
TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height)
|
||||
{
|
||||
int i, videomode_flags;
|
||||
SDL_Surface *temp_surf;
|
||||
|
||||
GraphicsDriver = driver;
|
||||
ScreenColorDepth = bpp;
|
||||
|
||||
// must use SDL_SWSURFACE, HWSURFACE doesn't work properly
|
||||
// with fades/scaling
|
||||
@@ -85,13 +83,15 @@ TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height,
|
||||
if (flags & TFB_GFXFLAGS_FULLSCREEN)
|
||||
videomode_flags |= SDL_FULLSCREEN;
|
||||
|
||||
/* We'll ask for a 32bpp frame, but it doesn't really matter, because we've set
|
||||
SDL_ANYFORMAT */
|
||||
SDL_Video = SDL_SetVideoMode (ScreenWidthActual, ScreenHeightActual,
|
||||
bpp, videomode_flags);
|
||||
32, videomode_flags);
|
||||
|
||||
if (SDL_Video == NULL)
|
||||
{
|
||||
fprintf (stderr, "Couldn't set %ix%ix%i video mode: %s\n",
|
||||
ScreenWidthActual, ScreenHeightActual, bpp,
|
||||
fprintf (stderr, "Couldn't set %ix%i video mode: %s\n",
|
||||
ScreenWidthActual, ScreenHeightActual,
|
||||
SDL_GetError ());
|
||||
return -1;
|
||||
}
|
||||
@@ -100,6 +100,7 @@ TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height,
|
||||
fprintf (stderr, "Set the resolution to: %ix%ix%i\n",
|
||||
SDL_GetVideoSurface()->w, SDL_GetVideoSurface()->h,
|
||||
SDL_GetVideoSurface()->format->BitsPerPixel);
|
||||
ScreenColorDepth = SDL_GetVideoSurface()->format->BitsPerPixel;
|
||||
}
|
||||
|
||||
// Create a 32bpp surface in a compatible format which will supply
|
||||
@@ -173,7 +174,7 @@ TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height,
|
||||
}
|
||||
|
||||
int
|
||||
TFB_Pure_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
||||
TFB_Pure_InitGraphics (int driver, int flags, int width, int height)
|
||||
{
|
||||
char VideoName[256];
|
||||
|
||||
@@ -193,7 +194,7 @@ TFB_Pure_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
||||
ScreenWidth = 320;
|
||||
ScreenHeight = 240;
|
||||
|
||||
if (TFB_Pure_ConfigureVideo (driver, flags, width, height, bpp))
|
||||
if (TFB_Pure_ConfigureVideo (driver, flags, width, height))
|
||||
{
|
||||
fprintf (stderr, "Could not initialize video: "
|
||||
"no fallback at start of program!\n");
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
#include "libs/graphics/sdl/sdl_common.h"
|
||||
|
||||
int TFB_Pure_InitGraphics (int driver, int flags, int width, int height, int bpp);
|
||||
int TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height, int bpp);
|
||||
int TFB_Pure_InitGraphics (int driver, int flags, int width, int height);
|
||||
int TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height);
|
||||
void TFB_Pure_SwapBuffers (int force_full_redraw);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -76,7 +76,7 @@ TFB_PreInit (void)
|
||||
}
|
||||
|
||||
int
|
||||
TFB_ReInitGraphics (int driver, int flags, int width, int height, int bpp)
|
||||
TFB_ReInitGraphics (int driver, int flags, int width, int height)
|
||||
{
|
||||
int result;
|
||||
char caption[200];
|
||||
@@ -86,17 +86,17 @@ TFB_ReInitGraphics (int driver, int flags, int width, int height, int bpp)
|
||||
if (driver == TFB_GFXDRIVER_SDL_OPENGL)
|
||||
{
|
||||
#ifdef HAVE_OPENGL
|
||||
result = TFB_GL_ConfigureVideo (driver, flags, width, height, bpp);
|
||||
result = TFB_GL_ConfigureVideo (driver, flags, width, height);
|
||||
#else
|
||||
driver = TFB_GFXDRIVER_SDL_PURE;
|
||||
fprintf (stderr, "OpenGL support not compiled in, so using pure "
|
||||
"sdl driver\n");
|
||||
result = TFB_Pure_ConfigureVideo (driver, flags, width, height, bpp);
|
||||
result = TFB_Pure_ConfigureVideo (driver, flags, width, height);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
result = TFB_Pure_ConfigureVideo (driver, flags, width, height, bpp);
|
||||
result = TFB_Pure_ConfigureVideo (driver, flags, width, height);
|
||||
}
|
||||
|
||||
sprintf (caption, "The Ur-Quan Masters v%d.%d.%d%s",
|
||||
@@ -113,33 +113,27 @@ TFB_ReInitGraphics (int driver, int flags, int width, int height, int bpp)
|
||||
}
|
||||
|
||||
int
|
||||
TFB_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
||||
TFB_InitGraphics (int driver, int flags, int width, int height)
|
||||
{
|
||||
int result;
|
||||
char caption[200];
|
||||
|
||||
if (bpp != 15 && bpp != 16 && bpp != 24 && bpp != 32)
|
||||
{
|
||||
fprintf(stderr, "Fatal error: bpp of %d not supported\n", bpp);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
GfxFlags = flags;
|
||||
|
||||
if (driver == TFB_GFXDRIVER_SDL_OPENGL)
|
||||
{
|
||||
#ifdef HAVE_OPENGL
|
||||
result = TFB_GL_InitGraphics (driver, flags, width, height, bpp);
|
||||
result = TFB_GL_InitGraphics (driver, flags, width, height);
|
||||
#else
|
||||
driver = TFB_GFXDRIVER_SDL_PURE;
|
||||
fprintf (stderr, "OpenGL support not compiled in, so using pure "
|
||||
"sdl driver\n");
|
||||
result = TFB_Pure_InitGraphics (driver, flags, width, height, bpp);
|
||||
result = TFB_Pure_InitGraphics (driver, flags, width, height);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
result = TFB_Pure_InitGraphics (driver, flags, width, height, bpp);
|
||||
result = TFB_Pure_InitGraphics (driver, flags, width, height);
|
||||
}
|
||||
|
||||
sprintf (caption, "The Ur-Quan Masters v%d.%d.%d%s",
|
||||
@@ -791,15 +785,12 @@ TFB_FlushGraphics () // Only call from main thread!!
|
||||
case TFB_DRAWCOMMANDTYPE_REINITVIDEO:
|
||||
{
|
||||
int oldDriver = GraphicsDriver;
|
||||
int oldBpp = ScreenColorDepth;
|
||||
if (TFB_ReInitGraphics (DC.data.reinitvideo.driver, DC.data.reinitvideo.flags,
|
||||
DC.data.reinitvideo.width, DC.data.reinitvideo.height,
|
||||
DC.data.reinitvideo.bpp))
|
||||
DC.data.reinitvideo.width, DC.data.reinitvideo.height))
|
||||
{
|
||||
fprintf (stderr, "Could not provide requested mode: reverting to last known driver and bpp.\n");
|
||||
fprintf (stderr, "Could not provide requested mode: reverting to last known driver.\n");
|
||||
if (TFB_ReInitGraphics (oldDriver, DC.data.reinitvideo.flags,
|
||||
DC.data.reinitvideo.width, DC.data.reinitvideo.height,
|
||||
oldBpp))
|
||||
DC.data.reinitvideo.width, DC.data.reinitvideo.height))
|
||||
{
|
||||
fprintf (stderr, "Couldn't reinit at that point either. Your video has been somehow tied in knots.\n");
|
||||
exit (-1);
|
||||
|
||||
@@ -216,8 +216,7 @@ TFB_DrawScreen_WaitForSignal (void)
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawScreen_ReinitVideo (int driver, int flags, int width, int height,
|
||||
int bpp)
|
||||
TFB_DrawScreen_ReinitVideo (int driver, int flags, int width, int height)
|
||||
{
|
||||
TFB_DrawCommand DrawCommand;
|
||||
DrawCommand.Type = TFB_DRAWCOMMANDTYPE_REINITVIDEO;
|
||||
@@ -225,7 +224,6 @@ TFB_DrawScreen_ReinitVideo (int driver, int flags, int width, int height,
|
||||
DrawCommand.data.reinitvideo.flags = flags;
|
||||
DrawCommand.data.reinitvideo.width = width;
|
||||
DrawCommand.data.reinitvideo.height = height;
|
||||
DrawCommand.data.reinitvideo.bpp = bpp;
|
||||
TFB_EnqueueDrawCommand(&DrawCommand);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ void TFB_DrawScreen_CopyToImage (TFB_Image *img, PRECT lpRect, SCREEN src);
|
||||
void TFB_DrawScreen_DeleteImage (TFB_Image *img);
|
||||
void TFB_DrawScreen_DeleteData (void *);
|
||||
void TFB_DrawScreen_WaitForSignal (void);
|
||||
void TFB_DrawScreen_ReinitVideo (int driver, int flags, int width, int height, int bpp);
|
||||
void TFB_DrawScreen_ReinitVideo (int driver, int flags, int width, int height);
|
||||
void TFB_DrawScreen_SetPalette (int paletteIndex, int r, int g, int b);
|
||||
|
||||
TFB_Image *TFB_DrawImage_New (TFB_Canvas canvas);
|
||||
|
||||
+45
-100
@@ -254,23 +254,6 @@ static CHOICE_OPTION driver_opts[] = {
|
||||
} },
|
||||
};
|
||||
|
||||
static CHOICE_OPTION bpp_opts[] = {
|
||||
{ "16",
|
||||
{ "16-bit color depth.",
|
||||
"",
|
||||
""
|
||||
} },
|
||||
{ "24",
|
||||
{ "24-bit color depth.",
|
||||
"",
|
||||
""
|
||||
} },
|
||||
{ "32",
|
||||
{ "32-bit color depth.",
|
||||
"",
|
||||
""
|
||||
} } };
|
||||
|
||||
static CHOICE_OPTION fullscreen_opts[] = {
|
||||
{ "Windowed",
|
||||
{ "Display everything in a window.",
|
||||
@@ -311,7 +294,6 @@ static CHOICE_OPTION adriver_opts[] = {
|
||||
static WIDGET_CHOICE cmdline_opts[] = {
|
||||
{ CHOICE_PREFACE, "Resolution", RES_OPTS, 3, res_opts, 0, 0},
|
||||
{ CHOICE_PREFACE, "Use Framebuffer?", 2, 2, driver_opts, 0, 0},
|
||||
{ CHOICE_PREFACE, "Color depth", 3, 3, bpp_opts, 0, 0 },
|
||||
{ CHOICE_PREFACE, "Scaler", 6, 3, scaler_opts, 0, 0 },
|
||||
{ CHOICE_PREFACE, "Scanlines", 2, 3, scanlines_opts, 0, 0 },
|
||||
{ CHOICE_PREFACE, "Menu Style", 2, 2, menu_opts, 0, 0 },
|
||||
@@ -386,38 +368,37 @@ static WIDGET *main_widgets[] = {
|
||||
|
||||
static WIDGET *graphics_widgets[] = {
|
||||
(WIDGET *)(&cmdline_opts[0]),
|
||||
(WIDGET *)(&cmdline_opts[11]),
|
||||
(WIDGET *)(&cmdline_opts[10]),
|
||||
(WIDGET *)(&cmdline_opts[2]),
|
||||
(WIDGET *)(&cmdline_opts[3]),
|
||||
(WIDGET *)(&cmdline_opts[4]),
|
||||
(WIDGET *)(&prev_button) };
|
||||
|
||||
static WIDGET *audio_widgets[] = {
|
||||
(WIDGET *)(&sliders_opts[0]),
|
||||
(WIDGET *)(&sliders_opts[1]),
|
||||
(WIDGET *)(&sliders_opts[2]),
|
||||
(WIDGET *)(&cmdline_opts[15]),
|
||||
(WIDGET *)(&cmdline_opts[10]),
|
||||
(WIDGET *)(&cmdline_opts[14]),
|
||||
(WIDGET *)(&cmdline_opts[9]),
|
||||
(WIDGET *)(&prev_button) };
|
||||
|
||||
static WIDGET *engine_widgets[] = {
|
||||
(WIDGET *)(&cmdline_opts[4]),
|
||||
(WIDGET *)(&cmdline_opts[5]),
|
||||
(WIDGET *)(&cmdline_opts[6]),
|
||||
(WIDGET *)(&cmdline_opts[7]),
|
||||
(WIDGET *)(&cmdline_opts[8]),
|
||||
(WIDGET *)(&cmdline_opts[9]),
|
||||
(WIDGET *)(&cmdline_opts[14]),
|
||||
(WIDGET *)(&cmdline_opts[12]),
|
||||
(WIDGET *)(&cmdline_opts[18]),
|
||||
(WIDGET *)(&cmdline_opts[13]),
|
||||
(WIDGET *)(&cmdline_opts[11]),
|
||||
(WIDGET *)(&cmdline_opts[17]),
|
||||
(WIDGET *)(&prev_button) };
|
||||
|
||||
static WIDGET *advanced_widgets[] = {
|
||||
#ifdef HAVE_OPENGL
|
||||
(WIDGET *)(&cmdline_opts[1]),
|
||||
#endif
|
||||
(WIDGET *)(&cmdline_opts[2]),
|
||||
(WIDGET *)(&cmdline_opts[13]),
|
||||
(WIDGET *)(&cmdline_opts[12]),
|
||||
(WIDGET *)(&cmdline_opts[15]),
|
||||
(WIDGET *)(&cmdline_opts[16]),
|
||||
(WIDGET *)(&cmdline_opts[17]),
|
||||
(WIDGET *)(&prev_button) };
|
||||
|
||||
|
||||
@@ -479,9 +460,9 @@ static WIDGET_MENU_SCREEN advanced_menu = {
|
||||
"Advanced Options",
|
||||
{ {0, 0}, NULL },
|
||||
#ifdef HAVE_OPENGL
|
||||
6, advanced_widgets,
|
||||
#else
|
||||
5, advanced_widgets,
|
||||
#else
|
||||
4, advanced_widgets,
|
||||
#endif
|
||||
0 };
|
||||
|
||||
@@ -609,23 +590,22 @@ SetDefaults (void)
|
||||
}
|
||||
cmdline_opts[0].selected = opts.res;
|
||||
cmdline_opts[1].selected = opts.driver;
|
||||
cmdline_opts[2].selected = opts.depth;
|
||||
cmdline_opts[3].selected = opts.scaler;
|
||||
cmdline_opts[4].selected = opts.scanlines;
|
||||
cmdline_opts[5].selected = opts.menu;
|
||||
cmdline_opts[6].selected = opts.text;
|
||||
cmdline_opts[7].selected = opts.cscan;
|
||||
cmdline_opts[8].selected = opts.scroll;
|
||||
cmdline_opts[9].selected = opts.subtitles;
|
||||
cmdline_opts[10].selected = opts.music;
|
||||
cmdline_opts[11].selected = opts.fullscreen;
|
||||
cmdline_opts[12].selected = opts.intro;
|
||||
cmdline_opts[13].selected = opts.fps;
|
||||
cmdline_opts[14].selected = opts.meleezoom;
|
||||
cmdline_opts[15].selected = opts.stereo;
|
||||
cmdline_opts[16].selected = opts.adriver;
|
||||
cmdline_opts[17].selected = opts.aquality;
|
||||
cmdline_opts[18].selected = opts.shield;
|
||||
cmdline_opts[2].selected = opts.scaler;
|
||||
cmdline_opts[3].selected = opts.scanlines;
|
||||
cmdline_opts[4].selected = opts.menu;
|
||||
cmdline_opts[5].selected = opts.text;
|
||||
cmdline_opts[6].selected = opts.cscan;
|
||||
cmdline_opts[7].selected = opts.scroll;
|
||||
cmdline_opts[8].selected = opts.subtitles;
|
||||
cmdline_opts[9].selected = opts.music;
|
||||
cmdline_opts[10].selected = opts.fullscreen;
|
||||
cmdline_opts[11].selected = opts.intro;
|
||||
cmdline_opts[12].selected = opts.fps;
|
||||
cmdline_opts[13].selected = opts.meleezoom;
|
||||
cmdline_opts[14].selected = opts.stereo;
|
||||
cmdline_opts[15].selected = opts.adriver;
|
||||
cmdline_opts[16].selected = opts.aquality;
|
||||
cmdline_opts[17].selected = opts.shield;
|
||||
|
||||
sliders_opts[0].value = opts.musicvol;
|
||||
sliders_opts[1].value = opts.sfxvol;
|
||||
@@ -638,23 +618,22 @@ PropagateResults (void)
|
||||
GLOBALOPTS opts;
|
||||
opts.res = cmdline_opts[0].selected;
|
||||
opts.driver = cmdline_opts[1].selected;
|
||||
opts.depth = cmdline_opts[2].selected;
|
||||
opts.scaler = cmdline_opts[3].selected;
|
||||
opts.scanlines = cmdline_opts[4].selected;
|
||||
opts.menu = cmdline_opts[5].selected;
|
||||
opts.text = cmdline_opts[6].selected;
|
||||
opts.cscan = cmdline_opts[7].selected;
|
||||
opts.scroll = cmdline_opts[8].selected;
|
||||
opts.subtitles = cmdline_opts[9].selected;
|
||||
opts.music = cmdline_opts[10].selected;
|
||||
opts.fullscreen = cmdline_opts[11].selected;
|
||||
opts.intro = cmdline_opts[12].selected;
|
||||
opts.fps = cmdline_opts[13].selected;
|
||||
opts.meleezoom = cmdline_opts[14].selected;
|
||||
opts.stereo = cmdline_opts[15].selected;
|
||||
opts.adriver = cmdline_opts[16].selected;
|
||||
opts.aquality = cmdline_opts[17].selected;
|
||||
opts.shield = cmdline_opts[18].selected;
|
||||
opts.scaler = cmdline_opts[2].selected;
|
||||
opts.scanlines = cmdline_opts[3].selected;
|
||||
opts.menu = cmdline_opts[4].selected;
|
||||
opts.text = cmdline_opts[5].selected;
|
||||
opts.cscan = cmdline_opts[6].selected;
|
||||
opts.scroll = cmdline_opts[7].selected;
|
||||
opts.subtitles = cmdline_opts[8].selected;
|
||||
opts.music = cmdline_opts[9].selected;
|
||||
opts.fullscreen = cmdline_opts[10].selected;
|
||||
opts.intro = cmdline_opts[11].selected;
|
||||
opts.fps = cmdline_opts[12].selected;
|
||||
opts.meleezoom = cmdline_opts[13].selected;
|
||||
opts.stereo = cmdline_opts[14].selected;
|
||||
opts.adriver = cmdline_opts[15].selected;
|
||||
opts.aquality = cmdline_opts[16].selected;
|
||||
opts.shield = cmdline_opts[17].selected;
|
||||
|
||||
opts.musicvol = sliders_opts[0].value;
|
||||
opts.sfxvol = sliders_opts[1].value;
|
||||
@@ -832,22 +811,6 @@ GetGlobalOptions (GLOBALOPTS *opts)
|
||||
opts->aquality = OPTVAL_MEDIUM;
|
||||
}
|
||||
|
||||
switch (ScreenColorDepth)
|
||||
{
|
||||
case 16:
|
||||
opts->depth = OPTVAL_16;
|
||||
break;
|
||||
case 24:
|
||||
opts->depth = OPTVAL_24;
|
||||
break;
|
||||
case 32:
|
||||
opts->depth = OPTVAL_32;
|
||||
break;
|
||||
default:
|
||||
opts->depth = OPTVAL_32+1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Work out resolution. On the way, try to guess a good default
|
||||
* for config.alwaysgl, then overwrite it if it was set previously. */
|
||||
opts->driver = OPTVAL_PURE_IF_POSSIBLE;
|
||||
@@ -937,7 +900,6 @@ SetGlobalOptions (GLOBALOPTS *opts)
|
||||
int NewGfxFlags = GfxFlags;
|
||||
int NewWidth = ScreenWidthActual;
|
||||
int NewHeight = ScreenHeightActual;
|
||||
int NewDepth = ScreenColorDepth;
|
||||
int NewDriver = GraphicsDriver;
|
||||
|
||||
NewGfxFlags &= ~TFB_GFXFLAGS_SCALE_ANY;
|
||||
@@ -976,24 +938,8 @@ SetGlobalOptions (GLOBALOPTS *opts)
|
||||
break;
|
||||
}
|
||||
|
||||
switch (opts->depth) {
|
||||
case OPTVAL_16:
|
||||
NewDepth = 16;
|
||||
break;
|
||||
case OPTVAL_24:
|
||||
NewDepth = 24;
|
||||
break;
|
||||
case OPTVAL_32:
|
||||
NewDepth = 32;
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "Can't Happen: Impossible value for BPP\n");
|
||||
break;
|
||||
}
|
||||
|
||||
res_PutInteger ("config.reswidth", NewWidth);
|
||||
res_PutInteger ("config.resheight", NewHeight);
|
||||
res_PutInteger ("config.bpp", NewDepth);
|
||||
res_PutBoolean ("config.alwaysgl", opts->driver == OPTVAL_ALWAYS_GL);
|
||||
res_PutBoolean ("config.usegl", NewDriver == TFB_GFXDRIVER_SDL_OPENGL);
|
||||
|
||||
@@ -1039,12 +985,11 @@ SetGlobalOptions (GLOBALOPTS *opts)
|
||||
|
||||
if ((NewWidth != ScreenWidthActual) ||
|
||||
(NewHeight != ScreenHeightActual) ||
|
||||
(NewDepth != ScreenColorDepth) ||
|
||||
(NewDriver != GraphicsDriver) ||
|
||||
(NewGfxFlags != GfxFlags))
|
||||
{
|
||||
FlushGraphics ();
|
||||
TFB_DrawScreen_ReinitVideo (NewDriver, NewGfxFlags, NewWidth, NewHeight, NewDepth);
|
||||
TFB_DrawScreen_ReinitVideo (NewDriver, NewGfxFlags, NewWidth, NewHeight);
|
||||
FlushGraphics ();
|
||||
}
|
||||
optSubtitles = (opts->subtitles == OPTVAL_ENABLED) ? TRUE : FALSE;
|
||||
|
||||
@@ -63,19 +63,12 @@ typedef enum {
|
||||
OPTVAL_HIGH
|
||||
} OPT_AQUALITYTYPE;
|
||||
|
||||
typedef enum {
|
||||
OPTVAL_16,
|
||||
OPTVAL_24,
|
||||
OPTVAL_32
|
||||
} OPT_DEPTH;
|
||||
|
||||
typedef struct globalopts_struct {
|
||||
OPT_SCALETYPE scaler;
|
||||
OPT_RESTYPE res;
|
||||
OPT_DRIVERTYPE driver;
|
||||
OPT_ADRIVERTYPE adriver;
|
||||
OPT_AQUALITYTYPE aquality;
|
||||
OPT_DEPTH depth;
|
||||
OPT_ENABLABLE fullscreen, subtitles, scanlines, fps, stereo;
|
||||
OPT_CONSOLETYPE music, menu, text, cscan, scroll, intro, meleezoom, shield;
|
||||
int speechvol, musicvol, sfxvol;
|
||||
|
||||
+4
-31
@@ -58,7 +58,6 @@ struct options_struct {
|
||||
int soundFlags;
|
||||
int width;
|
||||
int height;
|
||||
int bpp;
|
||||
const char *configDir;
|
||||
const char *contentDir;
|
||||
const char **addons;
|
||||
@@ -107,7 +106,6 @@ main (int argc, char *argv[])
|
||||
/* .soundFlags = */ audio_QUALITY_MEDIUM,
|
||||
/* .width = */ 640,
|
||||
/* .height = */ 480,
|
||||
/* .bpp = */ 32,
|
||||
/* .configDir = */ NULL,
|
||||
/* .contentDir = */ NULL,
|
||||
/* .addons = */ NULL,
|
||||
@@ -185,10 +183,6 @@ main (int argc, char *argv[])
|
||||
{
|
||||
options.height = res_GetInteger ("config.resheight");
|
||||
}
|
||||
if (res_HasKey ("config.bpp"))
|
||||
{
|
||||
options.bpp = res_GetInteger ("config.bpp");
|
||||
}
|
||||
if (res_HasKey ("config.alwaysgl"))
|
||||
{
|
||||
if (res_GetBoolean ("config.alwaysgl"))
|
||||
@@ -317,17 +311,17 @@ main (int argc, char *argv[])
|
||||
}
|
||||
if (res_HasKey ("config.musicvol"))
|
||||
{
|
||||
int err = parseVolume(res_GetString ("config.musicvol"),
|
||||
parseVolume(res_GetString ("config.musicvol"),
|
||||
&options.musicVolumeScale, "music volume");
|
||||
}
|
||||
if (res_HasKey ("config.sfxvol"))
|
||||
{
|
||||
int err = parseVolume(res_GetString ("config.sfxvol"),
|
||||
parseVolume(res_GetString ("config.sfxvol"),
|
||||
&options.sfxVolumeScale, "SFX volume");
|
||||
}
|
||||
if (res_HasKey ("config.speechvol"))
|
||||
{
|
||||
int err = parseVolume(res_GetString ("config.speechvol"),
|
||||
parseVolume(res_GetString ("config.speechvol"),
|
||||
&options.speechVolumeScale, "speech volume");
|
||||
}
|
||||
|
||||
@@ -377,7 +371,7 @@ main (int argc, char *argv[])
|
||||
SYNC_CLASS_TOPLEVEL | SYNC_CLASS_VIDEO);
|
||||
|
||||
TFB_InitGraphics (options.gfxDriver, options.gfxFlags,
|
||||
options.width, options.height, options.bpp);
|
||||
options.width, options.height);
|
||||
if (options.gammaSet)
|
||||
TFB_SetGamma (options.gamma);
|
||||
InitColorMaps ();
|
||||
@@ -419,7 +413,6 @@ static const char *optString = "+r:d:foc:b:spC:n:?hM:S:T:m:q:ug:l:i:v";
|
||||
static struct option longOptions[] =
|
||||
{
|
||||
{"res", 1, NULL, 'r'},
|
||||
{"bpp", 1, NULL, 'd'},
|
||||
{"fullscreen", 0, NULL, 'f'},
|
||||
{"opengl", 0, NULL, 'o'},
|
||||
{"scale", 1, NULL, 'c'},
|
||||
@@ -531,25 +524,6 @@ parseOptions(int argc, char *argv[], struct options_struct *options)
|
||||
options->height = height;
|
||||
break;
|
||||
}
|
||||
case 'd':
|
||||
{
|
||||
int bpp;
|
||||
int err = parseIntOption(optarg, &bpp, "bpp");
|
||||
if (err)
|
||||
{
|
||||
badArg = TRUE;
|
||||
break;
|
||||
}
|
||||
if (bpp != 8 && bpp != 16 && bpp != 24 && bpp != 32)
|
||||
{
|
||||
fprintf (stderr, "Error: Invalid value specified for "
|
||||
"bpp; it should be either 8, 16, 24, or 32.\n");
|
||||
badArg = TRUE;
|
||||
break;
|
||||
}
|
||||
options->bpp = bpp;
|
||||
break;
|
||||
}
|
||||
case 'f':
|
||||
options->gfxFlags |= TFB_GFXFLAGS_FULLSCREEN;
|
||||
break;
|
||||
@@ -861,7 +835,6 @@ usage (FILE *out, const struct options_struct *defaultOptions)
|
||||
fprintf (out, "Options:\n");
|
||||
fprintf (out, " -r, --res=WIDTHxHEIGHT (default 640x480, bigger "
|
||||
"works only with --opengl)\n");
|
||||
fprintf (out, " -d, --bpp=BITSPERPIXEL (default 32)\n");
|
||||
fprintf (out, " -f, --fullscreen (default off)\n");
|
||||
fprintf (out, " -o, --opengl (default off)\n");
|
||||
fprintf (out, " -c, --scale=MODE (bilinear, biadapt, biadv, triscan, "
|
||||
|
||||
Reference in New Issue
Block a user