diff --git a/src/driver.cpp b/src/driver.cpp index f9c68fc266..8ddedb625e 100644 --- a/src/driver.cpp +++ b/src/driver.cpp @@ -41,7 +41,7 @@ static const std::string HWACCELERATION_TEST_FILE = "hwaccel.dat"; ///< Filename * @param name The parameter name we're looking for. * @return The parameter value. */ -const char *GetDriverParam(const StringList &parm, const char *name) +const char *GetDriverParam(std::span parm, const char *name) { if (parm.empty()) return nullptr; @@ -61,7 +61,7 @@ const char *GetDriverParam(const StringList &parm, const char *name) * @param name The parameter name we're looking for. * @return The parameter value. */ -bool GetDriverParamBool(const StringList &parm, const char *name) +bool GetDriverParamBool(std::span parm, const char *name) { return GetDriverParam(parm, name) != nullptr; } @@ -73,7 +73,7 @@ bool GetDriverParamBool(const StringList &parm, const char *name) * @param def The default value if the parameter doesn't exist. * @return The parameter value. */ -int GetDriverParamInt(const StringList &parm, const char *name, int def) +int GetDriverParamInt(std::span parm, const char *name, int def) { const char *p = GetDriverParam(parm, name); return p != nullptr ? atoi(p) : def; diff --git a/src/driver.h b/src/driver.h index ef39391890..06ebe90cfa 100644 --- a/src/driver.h +++ b/src/driver.h @@ -11,11 +11,10 @@ #define DRIVER_H #include "core/enum_type.hpp" -#include "string_type.h" -const char *GetDriverParam(const StringList &parm, const char *name); -bool GetDriverParamBool(const StringList &parm, const char *name); -int GetDriverParamInt(const StringList &parm, const char *name, int def); +const char *GetDriverParam(std::span parm, const char *name); +bool GetDriverParamBool(std::span parm, const char *name); +int GetDriverParamInt(std::span parm, const char *name, int def); /** A driver for communicating with the user. */ class Driver { @@ -25,7 +24,7 @@ public: * @param parm Parameters passed to the driver. * @return std::nullopt if everything went okay, otherwise an error message. */ - virtual std::optional Start(const StringList &parm) = 0; + virtual std::optional Start(std::span parm) = 0; /** * Stop this driver. diff --git a/src/music/allegro_m.cpp b/src/music/allegro_m.cpp index ce9184f15f..a6d5afc663 100644 --- a/src/music/allegro_m.cpp +++ b/src/music/allegro_m.cpp @@ -26,7 +26,7 @@ static MIDI *_midi = nullptr; */ extern int _allegro_instance_count; -std::optional MusicDriver_Allegro::Start(const StringList &) +std::optional MusicDriver_Allegro::Start(std::span ) { if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, nullptr)) { Debug(driver, 0, "allegro: install_allegro failed '{}'", allegro_error); diff --git a/src/music/allegro_m.h b/src/music/allegro_m.h index de59075f5e..70ab499c1b 100644 --- a/src/music/allegro_m.h +++ b/src/music/allegro_m.h @@ -15,7 +15,7 @@ /** Allegro's music player. */ class MusicDriver_Allegro : public MusicDriver { public: - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; diff --git a/src/music/bemidi.cpp b/src/music/bemidi.cpp index 44386cf6c8..9af74cd742 100644 --- a/src/music/bemidi.cpp +++ b/src/music/bemidi.cpp @@ -18,7 +18,7 @@ /** Factory for BeOS' midi player. */ static FMusicDriver_BeMidi iFMusicDriver_BeMidi; -std::optional MusicDriver_BeMidi::Start(const StringList &parm) +std::optional MusicDriver_BeMidi::Start(std::span) { return std::nullopt; } diff --git a/src/music/bemidi.h b/src/music/bemidi.h index 47529aa51d..4d767b3e56 100644 --- a/src/music/bemidi.h +++ b/src/music/bemidi.h @@ -18,7 +18,8 @@ /** The midi player for BeOS. */ class MusicDriver_BeMidi : public MusicDriver { public: - std::optional Start(const StringList ¶m) override; + + std::optional Start(std::span parm) override; void Stop() override; diff --git a/src/music/cocoa_m.cpp b/src/music/cocoa_m.cpp index 9aa847712f..4fd923b016 100644 --- a/src/music/cocoa_m.cpp +++ b/src/music/cocoa_m.cpp @@ -79,7 +79,7 @@ static void DoSetVolume() /** * Initialized the MIDI player, including QuickTime initialization. */ -std::optional MusicDriver_Cocoa::Start(const StringList &) +std::optional MusicDriver_Cocoa::Start(std::span) { if (NewMusicPlayer(&_player) != noErr) return "failed to create music player"; diff --git a/src/music/cocoa_m.h b/src/music/cocoa_m.h index dbf58e425e..97132df389 100644 --- a/src/music/cocoa_m.h +++ b/src/music/cocoa_m.h @@ -14,7 +14,7 @@ class MusicDriver_Cocoa : public MusicDriver { public: - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; diff --git a/src/music/dmusic.cpp b/src/music/dmusic.cpp index 18ee2655a5..0bfdcc1358 100644 --- a/src/music/dmusic.cpp +++ b/src/music/dmusic.cpp @@ -1063,7 +1063,7 @@ static const char *LoadDefaultDLSFile(const char *user_dls) } -std::optional MusicDriver_DMusic::Start(const StringList &parm) +std::optional MusicDriver_DMusic::Start(std::span parm) { /* Initialize COM */ if (FAILED(CoInitializeEx(nullptr, COINIT_MULTITHREADED))) return "COM initialization failed"; diff --git a/src/music/dmusic.h b/src/music/dmusic.h index 32f0943d85..5181451204 100644 --- a/src/music/dmusic.h +++ b/src/music/dmusic.h @@ -17,7 +17,7 @@ class MusicDriver_DMusic : public MusicDriver { public: virtual ~MusicDriver_DMusic(); - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; diff --git a/src/music/extmidi.cpp b/src/music/extmidi.cpp index 22fd8fcfa0..00e586f834 100644 --- a/src/music/extmidi.cpp +++ b/src/music/extmidi.cpp @@ -35,7 +35,7 @@ /** Factory for the midi player that uses external players. */ static FMusicDriver_ExtMidi iFMusicDriver_ExtMidi; -std::optional MusicDriver_ExtMidi::Start(const StringList &parm) +std::optional MusicDriver_ExtMidi::Start(std::span parm) { if (VideoDriver::GetInstance()->GetName() == "allegro" || SoundDriver::GetInstance()->GetName() == "allegro") { diff --git a/src/music/extmidi.h b/src/music/extmidi.h index f08c513008..a4e54abb9e 100644 --- a/src/music/extmidi.h +++ b/src/music/extmidi.h @@ -22,7 +22,7 @@ private: void DoStop(); public: - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; diff --git a/src/music/fluidsynth.cpp b/src/music/fluidsynth.cpp index 4ffd90e620..b31751fb77 100644 --- a/src/music/fluidsynth.cpp +++ b/src/music/fluidsynth.cpp @@ -58,11 +58,11 @@ static void RenderMusicStream(int16_t *buffer, size_t samples) fluid_synth_write_s16(_midi.synth, samples, buffer, 0, 2, buffer, 1, 2); } -std::optional MusicDriver_FluidSynth::Start(const StringList ¶m) +std::optional MusicDriver_FluidSynth::Start(std::span parm) { std::lock_guard lock{ _midi.synth_mutex }; - const char *sfont_name = GetDriverParam(param, "soundfont"); + const char *sfont_name = GetDriverParam(parm, "soundfont"); int sfont_id; Debug(driver, 1, "Fluidsynth: sf {}", sfont_name != nullptr ? sfont_name : "(null)"); diff --git a/src/music/fluidsynth.h b/src/music/fluidsynth.h index ae7a8385d8..0710f2f3d3 100644 --- a/src/music/fluidsynth.h +++ b/src/music/fluidsynth.h @@ -15,7 +15,7 @@ /** Music driver making use of FluidSynth. */ class MusicDriver_FluidSynth : public MusicDriver { public: - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; diff --git a/src/music/null_m.h b/src/music/null_m.h index 9c2ca82855..ecd79b3c90 100644 --- a/src/music/null_m.h +++ b/src/music/null_m.h @@ -15,7 +15,7 @@ /** The music player that does nothing. */ class MusicDriver_Null : public MusicDriver { public: - std::optional Start(const StringList &) override { return std::nullopt; } + std::optional Start(std::span) override { return std::nullopt; } void Stop() override { } diff --git a/src/music/win32_m.cpp b/src/music/win32_m.cpp index a9553123ed..1702e130b1 100644 --- a/src/music/win32_m.cpp +++ b/src/music/win32_m.cpp @@ -367,7 +367,7 @@ void MusicDriver_Win32::SetVolume(uint8_t vol) _midi.new_volume = vol; } -std::optional MusicDriver_Win32::Start(const StringList &parm) +std::optional MusicDriver_Win32::Start(std::span parm) { Debug(driver, 2, "Win32-MIDI: Start: initializing"); diff --git a/src/music/win32_m.h b/src/music/win32_m.h index bd6125420b..1a7d1dc507 100644 --- a/src/music/win32_m.h +++ b/src/music/win32_m.h @@ -15,7 +15,7 @@ /** The Windows music player. */ class MusicDriver_Win32 : public MusicDriver { public: - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; diff --git a/src/sound/allegro_s.cpp b/src/sound/allegro_s.cpp index a44578c160..89065bea24 100644 --- a/src/sound/allegro_s.cpp +++ b/src/sound/allegro_s.cpp @@ -50,7 +50,7 @@ void SoundDriver_Allegro::MainLoop() */ extern int _allegro_instance_count; -std::optional SoundDriver_Allegro::Start(const StringList &parm) +std::optional SoundDriver_Allegro::Start(std::span parm) { if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, nullptr)) { Debug(driver, 0, "allegro: install_allegro failed '{}'", allegro_error); diff --git a/src/sound/allegro_s.h b/src/sound/allegro_s.h index 1026038355..a4159fc44f 100644 --- a/src/sound/allegro_s.h +++ b/src/sound/allegro_s.h @@ -15,7 +15,7 @@ /** Implementation of the allegro sound driver. */ class SoundDriver_Allegro : public SoundDriver { public: - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; diff --git a/src/sound/cocoa_s.cpp b/src/sound/cocoa_s.cpp index 54198b0b5e..8ae0546ab0 100644 --- a/src/sound/cocoa_s.cpp +++ b/src/sound/cocoa_s.cpp @@ -43,7 +43,7 @@ static OSStatus audioCallback(void *, AudioUnitRenderActionFlags *, const AudioT } -std::optional SoundDriver_Cocoa::Start(const StringList &parm) +std::optional SoundDriver_Cocoa::Start(std::span parm) { struct AURenderCallbackStruct callback; AudioStreamBasicDescription requestedDesc; diff --git a/src/sound/cocoa_s.h b/src/sound/cocoa_s.h index 0f32e25b4d..62d5c330c6 100644 --- a/src/sound/cocoa_s.h +++ b/src/sound/cocoa_s.h @@ -14,7 +14,7 @@ class SoundDriver_Cocoa : public SoundDriver { public: - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; std::string_view GetName() const override { return "cocoa"; } diff --git a/src/sound/null_s.h b/src/sound/null_s.h index fb931b84dd..627086a2c2 100644 --- a/src/sound/null_s.h +++ b/src/sound/null_s.h @@ -15,7 +15,7 @@ /** Implementation of the null sound driver. */ class SoundDriver_Null : public SoundDriver { public: - std::optional Start(const StringList &) override { return std::nullopt; } + std::optional Start(std::span) override { return std::nullopt; } void Stop() override { } std::string_view GetName() const override { return "null"; } diff --git a/src/sound/sdl2_s.cpp b/src/sound/sdl2_s.cpp index af12a00a31..44d0588a88 100644 --- a/src/sound/sdl2_s.cpp +++ b/src/sound/sdl2_s.cpp @@ -30,7 +30,7 @@ static void CDECL fill_sound_buffer(void *, Uint8 *stream, int len) MxMixSamples(stream, len / 4); } -std::optional SoundDriver_SDL::Start(const StringList &parm) +std::optional SoundDriver_SDL::Start(std::span parm) { SDL_AudioSpec spec; SDL_AudioSpec spec_actual; diff --git a/src/sound/sdl_s.cpp b/src/sound/sdl_s.cpp index 7b1f93e240..7902f7431b 100644 --- a/src/sound/sdl_s.cpp +++ b/src/sound/sdl_s.cpp @@ -30,7 +30,7 @@ static void CDECL fill_sound_buffer(void *, Uint8 *stream, int len) MxMixSamples(stream, len / 4); } -std::optional SoundDriver_SDL::Start(const StringList &parm) +std::optional SoundDriver_SDL::Start(std::span parm) { SDL_AudioSpec spec; diff --git a/src/sound/sdl_s.h b/src/sound/sdl_s.h index abf9ac6a20..8bcaec553a 100644 --- a/src/sound/sdl_s.h +++ b/src/sound/sdl_s.h @@ -15,7 +15,7 @@ /** Implementation of the SDL sound driver. */ class SoundDriver_SDL : public SoundDriver { public: - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; std::string_view GetName() const override { return "sdl"; } diff --git a/src/sound/win32_s.cpp b/src/sound/win32_s.cpp index e198fb806b..342df83764 100644 --- a/src/sound/win32_s.cpp +++ b/src/sound/win32_s.cpp @@ -59,7 +59,7 @@ static DWORD WINAPI SoundThread(LPVOID) return 0; } -std::optional SoundDriver_Win32::Start(const StringList &parm) +std::optional SoundDriver_Win32::Start(std::span parm) { WAVEFORMATEX wfex; wfex.wFormatTag = WAVE_FORMAT_PCM; diff --git a/src/sound/win32_s.h b/src/sound/win32_s.h index c89e8596d4..45ac72d60e 100644 --- a/src/sound/win32_s.h +++ b/src/sound/win32_s.h @@ -15,7 +15,7 @@ /** Implementation of the sound driver for Windows. */ class SoundDriver_Win32 : public SoundDriver { public: - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; std::string_view GetName() const override { return "win32"; } diff --git a/src/sound/xaudio2_s.cpp b/src/sound/xaudio2_s.cpp index 4b8d8236a6..cf52d6ec5b 100644 --- a/src/sound/xaudio2_s.cpp +++ b/src/sound/xaudio2_s.cpp @@ -138,7 +138,7 @@ static HRESULT CreateXAudio(API_XAudio2Create xAudio2Create) * @return An error message if unsuccessful, or std::nullopt otherwise. * */ -std::optional SoundDriver_XAudio2::Start(const StringList &parm) +std::optional SoundDriver_XAudio2::Start(std::span parm) { HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED); diff --git a/src/sound/xaudio2_s.h b/src/sound/xaudio2_s.h index b4e2591fb4..fbbf0a27da 100644 --- a/src/sound/xaudio2_s.h +++ b/src/sound/xaudio2_s.h @@ -15,7 +15,7 @@ /** Implementation of the XAudio2 sound driver. */ class SoundDriver_XAudio2 : public SoundDriver { public: - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; std::string_view GetName() const override { return "xaudio2"; } diff --git a/src/video/allegro_v.cpp b/src/video/allegro_v.cpp index 8b0406acee..51471d6d53 100644 --- a/src/video/allegro_v.cpp +++ b/src/video/allegro_v.cpp @@ -420,7 +420,7 @@ bool VideoDriver_Allegro::PollEvent() */ int _allegro_instance_count = 0; -std::optional VideoDriver_Allegro::Start(const StringList ¶m) +std::optional VideoDriver_Allegro::Start(std::span parm) { if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, nullptr)) { Debug(driver, 0, "allegro: install_allegro failed '{}'", allegro_error); @@ -448,7 +448,7 @@ std::optional VideoDriver_Allegro::Start(const StringList &par MarkWholeScreenDirty(); set_close_button_callback(HandleExitGameRequest); - this->is_game_threaded = !GetDriverParamBool(param, "no_threads") && !GetDriverParamBool(param, "no_thread"); + this->is_game_threaded = !GetDriverParamBool(parm, "no_threads") && !GetDriverParamBool(parm, "no_thread"); return std::nullopt; } diff --git a/src/video/allegro_v.h b/src/video/allegro_v.h index 8789b1158f..663bf1bb15 100644 --- a/src/video/allegro_v.h +++ b/src/video/allegro_v.h @@ -15,7 +15,7 @@ /** The allegro video driver. */ class VideoDriver_Allegro : public VideoDriver { public: - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; diff --git a/src/video/cocoa/cocoa_ogl.h b/src/video/cocoa/cocoa_ogl.h index a238fbce63..437ad5e575 100644 --- a/src/video/cocoa/cocoa_ogl.h +++ b/src/video/cocoa/cocoa_ogl.h @@ -25,7 +25,7 @@ class VideoDriver_CocoaOpenGL : public VideoDriver_Cocoa { public: VideoDriver_CocoaOpenGL() : VideoDriver_Cocoa(true), gl_context(nullptr), anim_buffer(nullptr), driver_info(this->GetName()) {} - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; bool HasEfficient8Bpp() const override { return true; } diff --git a/src/video/cocoa/cocoa_ogl.mm b/src/video/cocoa/cocoa_ogl.mm index 4b6cdc68c1..ae335c1b87 100644 --- a/src/video/cocoa/cocoa_ogl.mm +++ b/src/video/cocoa/cocoa_ogl.mm @@ -185,7 +185,7 @@ static bool _allowSoftware; static FVideoDriver_CocoaOpenGL iFVideoDriver_CocoaOpenGL; -std::optional VideoDriver_CocoaOpenGL::Start(const StringList ¶m) +std::optional VideoDriver_CocoaOpenGL::Start(std::span parm) { auto err = this->Initialize(); if (err) return err; diff --git a/src/video/cocoa/cocoa_v.h b/src/video/cocoa/cocoa_v.h index edfa39646d..5fa61f245d 100644 --- a/src/video/cocoa/cocoa_v.h +++ b/src/video/cocoa/cocoa_v.h @@ -109,7 +109,7 @@ public: VideoDriver_CocoaQuartz(); - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; /** Return driver name */ diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm index 7b08367cdc..15421a257f 100644 --- a/src/video/cocoa/cocoa_v.mm +++ b/src/video/cocoa/cocoa_v.mm @@ -589,7 +589,7 @@ VideoDriver_CocoaQuartz::VideoDriver_CocoaQuartz() this->cgcontext = nullptr; } -std::optional VideoDriver_CocoaQuartz::Start(const StringList ¶m) +std::optional VideoDriver_CocoaQuartz::Start(std::span parm) { auto err = this->Initialize(); if (err) return err; @@ -613,7 +613,7 @@ std::optional VideoDriver_CocoaQuartz::Start(const StringList this->GameSizeChanged(); this->UpdateVideoModes(); - this->is_game_threaded = !GetDriverParamBool(param, "no_threads") && !GetDriverParamBool(param, "no_thread"); + this->is_game_threaded = !GetDriverParamBool(parm, "no_threads") && !GetDriverParamBool(parm, "no_thread"); return std::nullopt; diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp index c620f44110..3707bf0fe0 100644 --- a/src/video/dedicated_v.cpp +++ b/src/video/dedicated_v.cpp @@ -103,7 +103,7 @@ extern bool SafeLoad(const std::string &filename, SaveLoadOperation fop, Detaile static FVideoDriver_Dedicated iFVideoDriver_Dedicated; -std::optional VideoDriver_Dedicated::Start(const StringList &) +std::optional VideoDriver_Dedicated::Start(std::span) { this->UpdateAutoResolution(); diff --git a/src/video/dedicated_v.h b/src/video/dedicated_v.h index f1271075d8..d82cf6fbc3 100644 --- a/src/video/dedicated_v.h +++ b/src/video/dedicated_v.h @@ -15,7 +15,7 @@ /** The dedicated server video driver. */ class VideoDriver_Dedicated : public VideoDriver { public: - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; diff --git a/src/video/null_v.cpp b/src/video/null_v.cpp index e3a032d71f..1280c0985a 100644 --- a/src/video/null_v.cpp +++ b/src/video/null_v.cpp @@ -19,7 +19,7 @@ /** Factory for the null video driver. */ static FVideoDriver_Null iFVideoDriver_Null; -std::optional VideoDriver_Null::Start(const StringList &parm) +std::optional VideoDriver_Null::Start(std::span parm) { #ifdef _MSC_VER /* Disable the MSVC assertion message box. */ diff --git a/src/video/null_v.h b/src/video/null_v.h index 4e0caffc57..f051c6b724 100644 --- a/src/video/null_v.h +++ b/src/video/null_v.h @@ -18,7 +18,7 @@ private: uint ticks; ///< Amount of ticks to run. public: - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; diff --git a/src/video/sdl2_opengl_v.cpp b/src/video/sdl2_opengl_v.cpp index eec52ef825..0f8b683ef1 100644 --- a/src/video/sdl2_opengl_v.cpp +++ b/src/video/sdl2_opengl_v.cpp @@ -53,9 +53,9 @@ bool VideoDriver_SDL_OpenGL::CreateMainWindow(uint w, uint h, uint flags) return this->VideoDriver_SDL_Base::CreateMainWindow(w, h, flags | SDL_WINDOW_OPENGL); } -std::optional VideoDriver_SDL_OpenGL::Start(const StringList ¶m) +std::optional VideoDriver_SDL_OpenGL::Start(std::span parm) { - auto error = VideoDriver_SDL_Base::Start(param); + auto error = VideoDriver_SDL_Base::Start(parm); if (error) return error; error = this->AllocateContext(); diff --git a/src/video/sdl2_opengl_v.h b/src/video/sdl2_opengl_v.h index b1e2f09f04..06add083eb 100644 --- a/src/video/sdl2_opengl_v.h +++ b/src/video/sdl2_opengl_v.h @@ -14,7 +14,7 @@ class VideoDriver_SDL_OpenGL : public VideoDriver_SDL_Base { public: VideoDriver_SDL_OpenGL() : VideoDriver_SDL_Base(true), gl_context(nullptr), anim_buffer(nullptr) {} - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; diff --git a/src/video/sdl2_v.cpp b/src/video/sdl2_v.cpp index a546e136b0..b7d22a67e3 100644 --- a/src/video/sdl2_v.cpp +++ b/src/video/sdl2_v.cpp @@ -540,7 +540,7 @@ std::optional VideoDriver_SDL_Base::Initialize() return std::nullopt; } -std::optional VideoDriver_SDL_Base::Start(const StringList ¶m) +std::optional VideoDriver_SDL_Base::Start(std::span parm) { if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 0) return "Only real blitters supported"; @@ -548,7 +548,7 @@ std::optional VideoDriver_SDL_Base::Start(const StringList &pa if (error) return error; #ifdef SDL_HINT_MOUSE_AUTO_CAPTURE - if (GetDriverParamBool(param, "no_mouse_capture")) { + if (GetDriverParamBool(parm, "no_mouse_capture")) { /* By default SDL captures the mouse, while a button is pressed. * This is annoying during debugging, when OpenTTD is suspended while the button was pressed. */ @@ -560,7 +560,7 @@ std::optional VideoDriver_SDL_Base::Start(const StringList &pa SDL_SetHint(SDL_HINT_APP_NAME, "OpenTTD"); #endif - this->startup_display = FindStartupDisplay(GetDriverParamInt(param, "display", -1)); + this->startup_display = FindStartupDisplay(GetDriverParamInt(parm, "display", -1)); if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height, false)) { return SDL_GetError(); @@ -582,7 +582,7 @@ std::optional VideoDriver_SDL_Base::Start(const StringList &pa #ifdef __EMSCRIPTEN__ this->is_game_threaded = false; #else - this->is_game_threaded = !GetDriverParamBool(param, "no_threads") && !GetDriverParamBool(param, "no_thread"); + this->is_game_threaded = !GetDriverParamBool(parm, "no_threads") && !GetDriverParamBool(parm, "no_thread"); #endif return std::nullopt; diff --git a/src/video/sdl2_v.h b/src/video/sdl2_v.h index 45c064d0bc..1d9f582207 100644 --- a/src/video/sdl2_v.h +++ b/src/video/sdl2_v.h @@ -19,7 +19,7 @@ class VideoDriver_SDL_Base : public VideoDriver { public: VideoDriver_SDL_Base(bool uses_hardware_acceleration = false) : VideoDriver(uses_hardware_acceleration), sdl_window(nullptr), buffer_locked(false) {} - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index dbff0cb186..21b880ca86 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -582,7 +582,7 @@ bool VideoDriver_SDL::PollEvent() return true; } -std::optional VideoDriver_SDL::Start(const StringList ¶m) +std::optional VideoDriver_SDL::Start(std::span parm) { char buf[30]; _use_hwpalette = GetDriverParamInt(param, "hw_palette", 2); diff --git a/src/video/sdl_v.h b/src/video/sdl_v.h index ca7c37b94a..820ecfce90 100644 --- a/src/video/sdl_v.h +++ b/src/video/sdl_v.h @@ -15,7 +15,7 @@ /** The SDL video driver. */ class VideoDriver_SDL : public VideoDriver { public: - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index f6aa0994cf..2be8afdbad 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -1030,7 +1030,7 @@ void VideoDriver_Win32Base::UnlockVideoBuffer() static FVideoDriver_Win32GDI iFVideoDriver_Win32GDI; -std::optional VideoDriver_Win32GDI::Start(const StringList ¶m) +std::optional VideoDriver_Win32GDI::Start(std::span parm) { if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 0) return "Only real blitters supported"; @@ -1042,7 +1042,7 @@ std::optional VideoDriver_Win32GDI::Start(const StringList &pa MarkWholeScreenDirty(); - this->is_game_threaded = !GetDriverParamBool(param, "no_threads") && !GetDriverParamBool(param, "no_thread"); + this->is_game_threaded = !GetDriverParamBool(parm, "no_threads") && !GetDriverParamBool(parm, "no_thread"); return std::nullopt; } @@ -1320,7 +1320,7 @@ static void LoadWGLExtensions() static FVideoDriver_Win32OpenGL iFVideoDriver_Win32OpenGL; -std::optional VideoDriver_Win32OpenGL::Start(const StringList ¶m) +std::optional VideoDriver_Win32OpenGL::Start(std::span parm) { if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 0) return "Only real blitters supported"; @@ -1356,7 +1356,7 @@ std::optional VideoDriver_Win32OpenGL::Start(const StringList MarkWholeScreenDirty(); - this->is_game_threaded = !GetDriverParamBool(param, "no_threads") && !GetDriverParamBool(param, "no_thread"); + this->is_game_threaded = !GetDriverParamBool(parm, "no_threads") && !GetDriverParamBool(parm, "no_thread"); return std::nullopt; } diff --git a/src/video/win32_v.h b/src/video/win32_v.h index 4344910b01..3aacf1f48d 100644 --- a/src/video/win32_v.h +++ b/src/video/win32_v.h @@ -79,7 +79,7 @@ class VideoDriver_Win32GDI : public VideoDriver_Win32Base { public: VideoDriver_Win32GDI() : dib_sect(nullptr), gdi_palette(nullptr), buffer_bits(nullptr) {} - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override; @@ -120,7 +120,7 @@ class VideoDriver_Win32OpenGL : public VideoDriver_Win32Base { public: VideoDriver_Win32OpenGL() : VideoDriver_Win32Base(true), dc(nullptr), gl_rc(nullptr), anim_buffer(nullptr), driver_info(this->GetName()) {} - std::optional Start(const StringList ¶m) override; + std::optional Start(std::span parm) override; void Stop() override;