OpenTTD Source 20241224-master-gf74b0cf984
driver.cpp File Reference

Base for all driver handling. More...

#include "stdafx.h"
#include "debug.h"
#include "error.h"
#include "error_func.h"
#include "sound/sound_driver.hpp"
#include "music/music_driver.hpp"
#include "video/video_driver.hpp"
#include "string_func.h"
#include "table/strings.h"
#include "fileio_func.h"
#include <sstream>
#include "safeguards.h"

Go to the source code of this file.

Functions

const char * GetDriverParam (const StringList &parm, const char *name)
 Get a string parameter the list of parameters.
 
bool GetDriverParamBool (const StringList &parm, const char *name)
 Get a boolean parameter the list of parameters.
 
int GetDriverParamInt (const StringList &parm, const char *name, int def)
 Get an integer parameter the list of parameters.
 

Variables

std::string _ini_videodriver
 The video driver a stored in the configuration file.
 
std::vector< Dimension_resolutions
 List of resolutions.
 
Dimension _cur_resolution
 The current resolution.
 
bool _rightclick_emulate
 Whether right clicking is emulated.
 
std::string _ini_sounddriver
 The sound driver a stored in the configuration file.
 
std::string _ini_musicdriver
 The music driver a stored in the configuration file.
 
std::string _ini_blitter
 The blitter as stored in the configuration file.
 
bool _blitter_autodetected
 Was the blitter autodetected or specified by the user?
 
static const std::string HWACCELERATION_TEST_FILE = "hwaccel.dat"
 Filename to test if we crashed last time we tried to use hardware acceleration.
 

Detailed Description

Base for all driver handling.

Definition in file driver.cpp.

Function Documentation

◆ GetDriverParam()

const char * GetDriverParam ( const StringList parm,
const char *  name 
)

Get a string parameter the list of parameters.

Parameters
parmThe parameters.
nameThe parameter name we're looking for.
Returns
The parameter value.

Definition at line 44 of file driver.cpp.

Referenced by GetDriverParamBool(), GetDriverParamInt(), MusicDriver_DMusic::Start(), MusicDriver_ExtMidi::Start(), MusicDriver_FluidSynth::Start(), and MusicDriver_Win32::Start().

◆ GetDriverParamBool()

bool GetDriverParamBool ( const StringList parm,
const char *  name 
)

Get a boolean parameter the list of parameters.

Parameters
parmThe parameters.
nameThe parameter name we're looking for.
Returns
The parameter value.

Definition at line 64 of file driver.cpp.

References GetDriverParam().

Referenced by VideoDriver_SDL_Base::Start(), VideoDriver_SDL::Start(), and VideoDriver_Win32GDI::Start().

◆ GetDriverParamInt()

int GetDriverParamInt ( const StringList parm,
const char *  name,
int  def 
)

Get an integer parameter the list of parameters.

Parameters
parmThe parameters.
nameThe parameter name we're looking for.
defThe default value if the parameter doesn't exist.
Returns
The parameter value.

Definition at line 76 of file driver.cpp.

References GetDriverParam().

Referenced by MusicDriver_DMusic::Start(), MusicDriver_Win32::Start(), SoundDriver_SDL::Start(), SoundDriver_Win32::Start(), SoundDriver_XAudio2::Start(), VideoDriver_Null::Start(), VideoDriver_SDL_Base::Start(), and VideoDriver_SDL::Start().

Variable Documentation

◆ _blitter_autodetected

bool _blitter_autodetected

Was the blitter autodetected or specified by the user?

Definition at line 34 of file driver.cpp.

Referenced by openttd_main(), and SwitchNewGRFBlitter().

◆ _cur_resolution

◆ _ini_blitter

std::string _ini_blitter

The blitter as stored in the configuration file.

Definition at line 33 of file driver.cpp.

Referenced by openttd_main().

◆ _ini_musicdriver

std::string _ini_musicdriver

The music driver a stored in the configuration file.

Definition at line 31 of file driver.cpp.

Referenced by openttd_main().

◆ _ini_sounddriver

std::string _ini_sounddriver

The sound driver a stored in the configuration file.

Definition at line 29 of file driver.cpp.

Referenced by openttd_main().

◆ _ini_videodriver

std::string _ini_videodriver

The video driver a stored in the configuration file.

Definition at line 24 of file driver.cpp.

Referenced by openttd_main().

◆ _resolutions

◆ _rightclick_emulate

bool _rightclick_emulate

Whether right clicking is emulated.

Definition at line 27 of file driver.cpp.

Referenced by VideoDriver_SDL_Base::PollEvent(), and VideoDriver_SDL::PollEvent().

◆ HWACCELERATION_TEST_FILE

const std::string HWACCELERATION_TEST_FILE = "hwaccel.dat"
static

Filename to test if we crashed last time we tried to use hardware acceleration.

Definition at line 36 of file driver.cpp.

Referenced by DriverFactoryBase::MarkVideoDriverOperational(), and DriverFactoryBase::SelectDriverImpl().