Skip to content

Commit 5d255c9

Browse files
rb6502cuavas
authored andcommitted
sdl3: Don't play chicken with the module names, the core was getting confused. [R. Belmont]
1 parent 85fbe5a commit 5d255c9

4 files changed

Lines changed: 46 additions & 34 deletions

File tree

src/osd/modules/lib/osdobj_common.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,17 +237,28 @@ void osd_common_t::register_options()
237237
#if !defined(OSD_WINDOWS) && !defined(SDLMAME_WIN32)
238238
REGISTER_MODULE(m_mod_man, RENDERER_BGFX); // try BGFX after OpenGL on other operating systems for now
239239
#endif
240+
#ifdef SDLMAME_SDL3
241+
REGISTER_MODULE(m_mod_man, RENDERER_SDL3ACCEL);
242+
#if !defined(SDLMAME_EMSCRIPTEN)
243+
REGISTER_MODULE(m_mod_man, RENDERER_SDL3SOFT);
244+
#endif
245+
#else
240246
REGISTER_MODULE(m_mod_man, RENDERER_SDL2);
241247
#if !defined(SDLMAME_EMSCRIPTEN)
242248
REGISTER_MODULE(m_mod_man, RENDERER_SDL1);
249+
#endif
243250
#endif
244251
REGISTER_MODULE(m_mod_man, RENDERER_NONE);
245252

246253
REGISTER_MODULE(m_mod_man, SOUND_WASAPI);
247254
REGISTER_MODULE(m_mod_man, SOUND_XAUDIO2);
248255
REGISTER_MODULE(m_mod_man, SOUND_COREAUDIO);
249256
REGISTER_MODULE(m_mod_man, SOUND_JS);
257+
#ifdef SDLMAME_SDL3
258+
REGISTER_MODULE(m_mod_man, SOUND_SDL3);
259+
#else
250260
REGISTER_MODULE(m_mod_man, SOUND_SDL);
261+
#endif
251262
#ifndef NO_USE_PORTAUDIO
252263
REGISTER_MODULE(m_mod_man, SOUND_PORTAUDIO);
253264
#endif

src/osd/modules/render/drawsdl3accel.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -929,17 +929,17 @@ render_primitive_list *renderer_sdl2::get_primitives()
929929
}
930930

931931

932-
class video_sdl2 : public osd_module, public render_module
932+
class video_sdl3_accel : public osd_module, public render_module
933933
{
934934
public:
935-
video_sdl2()
935+
video_sdl3_accel()
936936
: osd_module(OSD_RENDERER_PROVIDER, "accel")
937937
, m_blit_info_initialized(false)
938938
, m_gllib_loaded(false)
939939
{
940940
std::fill(std::begin(m_blit_info), std::end(m_blit_info), nullptr);
941941
}
942-
~video_sdl2()
942+
~video_sdl3_accel()
943943
{
944944
free_copy_info();
945945
}
@@ -967,7 +967,7 @@ class video_sdl2 : public osd_module, public render_module
967967
static copy_info_t const s_blit_info_default[];
968968
};
969969

970-
int video_sdl2::init(osd_interface &osd, osd_options const &options)
970+
int video_sdl3_accel::init(osd_interface &osd, osd_options const &options)
971971
{
972972
osd_printf_verbose("Using SDL native texturing driver (SDL 3.2+)\n");
973973

@@ -996,7 +996,7 @@ int video_sdl2::init(osd_interface &osd, osd_options const &options)
996996
return 0;
997997
}
998998

999-
std::unique_ptr<osd_renderer> video_sdl2::create(osd_window &window)
999+
std::unique_ptr<osd_renderer> video_sdl3_accel::create(osd_window &window)
10001000
{
10011001
if (!m_blit_info_initialized)
10021002
{
@@ -1009,7 +1009,7 @@ std::unique_ptr<osd_renderer> video_sdl2::create(osd_window &window)
10091009
return std::make_unique<renderer_sdl2>(window, m_blit_info);
10101010
}
10111011

1012-
void video_sdl2::expand_copy_info()
1012+
void video_sdl3_accel::expand_copy_info()
10131013
{
10141014
for (const copy_info_t *bi = s_blit_info_default; bi->src_fmt != -1; bi++)
10151015
{
@@ -1027,7 +1027,7 @@ void video_sdl2::expand_copy_info()
10271027
}
10281028
}
10291029

1030-
void video_sdl2::free_copy_info()
1030+
void video_sdl3_accel::free_copy_info()
10311031
{
10321032
if (m_blit_info_initialized)
10331033
{
@@ -1054,7 +1054,7 @@ void video_sdl2::free_copy_info()
10541054
}
10551055
}
10561056

1057-
void video_sdl2::add_list(copy_info_t const *&head, copy_info_t const &element, Uint32 bm)
1057+
void video_sdl3_accel::add_list(copy_info_t const *&head, copy_info_t const &element, Uint32 bm)
10581058
{
10591059
copy_info_t *const newci = new copy_info_t(element);
10601060

@@ -1072,7 +1072,7 @@ void video_sdl2::add_list(copy_info_t const *&head, copy_info_t const &element,
10721072
#define ENTRY_BM(a,b,f,bm) { SDL_TEXFORMAT_ ## a, SDL_PIXELFORMAT_ ## b, &texcopy_ ## f, bm, #a, #b, 0, 0, 0, 0}
10731073
#define ENTRY_LR(a,b,f) { SDL_TEXFORMAT_ ## a, SDL_PIXELFORMAT_ ## b, &texcopy_ ## f, BM_ALL, #a, #b, 0, 0, 0, -1}
10741074

1075-
copy_info_t const video_sdl2::s_blit_info_default[] =
1075+
copy_info_t const video_sdl3_accel::s_blit_info_default[] =
10761076
{
10771077
/* no rotation */
10781078
ENTRY(ARGB32, ARGB8888, argb32_argb32),
@@ -1158,8 +1158,8 @@ copy_info_t const video_sdl2::s_blit_info_default[] =
11581158

11591159
#else // defined(OSD_SDL) && defined (SDLMAME_SDL3)
11601160

1161-
namespace osd { namespace { MODULE_NOT_SUPPORTED(video_sdl2, OSD_RENDERER_PROVIDER, "accel") } }
1161+
namespace osd { namespace { MODULE_NOT_SUPPORTED(video_sdl3_accel, OSD_RENDERER_PROVIDER, "accel") } }
11621162

11631163
#endif // defined(OSD_SDL) && defined (SDLMAME_SDL3)
11641164

1165-
MODULE_DEFINITION(RENDERER_SDL2, osd::video_sdl2)
1165+
MODULE_DEFINITION(RENDERER_SDL3ACCEL, osd::video_sdl3_accel)

src/osd/modules/render/drawsdl3soft.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -615,10 +615,10 @@ render_primitive_list *renderer_sdl1::get_primitives()
615615
}
616616

617617

618-
class video_sdl1 : public osd_module, public render_module
618+
class video_sdl3soft : public osd_module, public render_module
619619
{
620620
public:
621-
video_sdl1()
621+
video_sdl3soft()
622622
: osd_module(OSD_RENDERER_PROVIDER, "soft")
623623
, m_scale_mode(-1)
624624
{
@@ -640,7 +640,7 @@ class video_sdl1 : public osd_module, public render_module
640640
static sdl_scale_mode const s_scale_modes[];
641641
};
642642

643-
int video_sdl1::init(osd_interface &osd, osd_options const &options)
643+
int video_sdl3soft::init(osd_interface &osd, osd_options const &options)
644644
{
645645
osd_printf_verbose("Using SDL multi-window soft driver (SDL 3.2+)\n");
646646

@@ -656,12 +656,12 @@ int video_sdl1::init(osd_interface &osd, osd_options const &options)
656656
return 0;
657657
}
658658

659-
std::unique_ptr<osd_renderer> video_sdl1::create(osd_window &window)
659+
std::unique_ptr<osd_renderer> video_sdl3soft::create(osd_window &window)
660660
{
661661
return std::make_unique<renderer_sdl1>(window, s_scale_modes[m_scale_mode]);
662662
}
663663

664-
int video_sdl1::get_scale_mode(char const *modestr)
664+
int video_sdl3soft::get_scale_mode(char const *modestr)
665665
{
666666
const sdl_scale_mode *sm = s_scale_modes;
667667
int index = 0;
@@ -675,7 +675,7 @@ int video_sdl1::get_scale_mode(char const *modestr)
675675
return -1;
676676
}
677677

678-
sdl_scale_mode const video_sdl1::s_scale_modes[] = {
678+
sdl_scale_mode const video_sdl3soft::s_scale_modes[] = {
679679
{ "none", 0, 0, 1, 1, DRAW2_SCALEMODE_NEAREST, 0, nullptr },
680680
{ "hwblit", 1, 0, 1, 1, DRAW2_SCALEMODE_LINEAR, 0, nullptr },
681681
{ "hwbest", 1, 0, 1, 1, DRAW2_SCALEMODE_BEST, 0, nullptr },
@@ -692,8 +692,9 @@ sdl_scale_mode const video_sdl1::s_scale_modes[] = {
692692

693693
#else // defined(OSD_SDL) && defined (SDLMAME_SDL3)
694694

695-
namespace osd { namespace { MODULE_NOT_SUPPORTED(video_sdl1, OSD_RENDERER_PROVIDER, "soft") } }
695+
namespace osd { namespace { MODULE_NOT_SUPPORTED(video_sdl3soft, OSD_RENDERER_PROVIDER, "soft") } }
696696

697697
#endif // defined(OSD_SDL) && defined (SDLMAME_SDL3)
698698

699-
MODULE_DEFINITION(RENDERER_SDL1, osd::video_sdl1)
699+
MODULE_DEFINITION(RENDERER_SDL3SOFT, osd::video_sdl3soft)
700+

src/osd/modules/sound/sdl3_sound.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ namespace osd {
3131

3232
namespace {
3333

34-
class sound_sdl : public osd_module, public sound_module
34+
class sound_sdl3 : public osd_module, public sound_module
3535
{
3636
public:
37-
sound_sdl() :
37+
sound_sdl3() :
3838
osd_module(OSD_SOUND_PROVIDER, "sdl"), sound_module()
3939
{
4040
}
4141

42-
virtual ~sound_sdl() { }
42+
virtual ~sound_sdl3() { }
4343

4444
virtual int init(osd_interface &osd, const osd_options &options) override;
4545
virtual void exit() override;
@@ -93,10 +93,10 @@ class sound_sdl : public osd_module, public sound_module
9393
};
9494

9595
//============================================================
96-
// sound_sdl::init
96+
// sound_sdl3::init
9797
//============================================================
9898

99-
int sound_sdl::init(osd_interface &osd, const osd_options &options)
99+
int sound_sdl3::init(osd_interface &osd, const osd_options &options)
100100
{
101101
m_stream_next_id = 1;
102102

@@ -180,18 +180,18 @@ int sound_sdl::init(osd_interface &osd, const osd_options &options)
180180
return 0;
181181
}
182182

183-
void sound_sdl::exit()
183+
void sound_sdl3::exit()
184184
{
185185
SDL_QuitSubSystem(SDL_INIT_AUDIO);
186186
m_devices.clear();
187187
}
188188

189-
uint32_t sound_sdl::get_generation()
189+
uint32_t sound_sdl3::get_generation()
190190
{
191191
return 1;
192192
}
193193

194-
osd::audio_info sound_sdl::get_information()
194+
osd::audio_info sound_sdl3::get_information()
195195
{
196196
enum { FL, FR, FC, LFE, BL, BR, BC, SL, SR, AUX };
197197
static const char *const posname[10] = { "FL", "FR", "FC", "LFE", "BL", "BR", "BC", "SL", "SR", "AUX" };
@@ -247,7 +247,7 @@ osd::audio_info sound_sdl::get_information()
247247
return m_deviceinfo;
248248
}
249249

250-
uint32_t sound_sdl::stream_sink_open(uint32_t node, std::string name, uint32_t rate)
250+
uint32_t sound_sdl3::stream_sink_open(uint32_t node, std::string name, uint32_t rate)
251251
{
252252
const int devnode = node - 1;
253253
const SDL_AudioDeviceID device_id = m_devices[devnode].m_device_id;
@@ -285,7 +285,7 @@ uint32_t sound_sdl::stream_sink_open(uint32_t node, std::string name, uint32_t r
285285
return id;
286286
}
287287

288-
uint32_t sound_sdl::stream_source_open(uint32_t node, std::string name, uint32_t rate)
288+
uint32_t sound_sdl3::stream_source_open(uint32_t node, std::string name, uint32_t rate)
289289
{
290290
const int devnode = node - 1;
291291
const SDL_AudioDeviceID device_id = m_devices[devnode].m_device_id;
@@ -328,7 +328,7 @@ uint32_t sound_sdl::stream_source_open(uint32_t node, std::string name, uint32_t
328328
return id;
329329
}
330330

331-
void sound_sdl::stream_close(uint32_t id)
331+
void sound_sdl3::stream_close(uint32_t id)
332332
{
333333
osd_printf_verbose("SDL Audio: Closing stream id %d\n", id);
334334

@@ -341,7 +341,7 @@ void sound_sdl::stream_close(uint32_t id)
341341
m_streams.erase(si);
342342
}
343343

344-
void sound_sdl::stream_sink_update(uint32_t id, const int16_t *buffer, int samples_this_frame)
344+
void sound_sdl3::stream_sink_update(uint32_t id, const int16_t *buffer, int samples_this_frame)
345345
{
346346
auto si = m_streams.find(id);
347347
if(si == m_streams.end())
@@ -350,7 +350,7 @@ void sound_sdl::stream_sink_update(uint32_t id, const int16_t *buffer, int sampl
350350
SDL_PutAudioStreamData(stream->m_sdl_stream, (void *)buffer, samples_this_frame * sizeof(int16_t) * stream->m_buffer.channels());
351351
}
352352

353-
void sound_sdl::stream_source_update(uint32_t id, int16_t *buffer, int samples_this_frame)
353+
void sound_sdl3::stream_source_update(uint32_t id, int16_t *buffer, int samples_this_frame)
354354
{
355355
auto si = m_streams.find(id);
356356
if (si == m_streams.end())
@@ -365,9 +365,9 @@ void sound_sdl::stream_source_update(uint32_t id, int16_t *buffer, int samples_t
365365

366366
#else // (defined(OSD_SDL) || defined(USE_SDL_SOUND)) && defined(SDLMAME_SDL3)
367367

368-
namespace osd { namespace { MODULE_NOT_SUPPORTED(sound_sdl, OSD_SOUND_PROVIDER, "sdl") } }
368+
namespace osd { namespace { MODULE_NOT_SUPPORTED(sound_sdl3, OSD_SOUND_PROVIDER, "sdl") } }
369369

370370
#endif
371371

372-
MODULE_DEFINITION(SOUND_SDL, osd::sound_sdl)
372+
MODULE_DEFINITION(SOUND_SDL3, osd::sound_sdl3)
373373

0 commit comments

Comments
 (0)