diff --git a/makefile b/makefile index afd51ed75b3..8d5209362fb 100644 --- a/makefile +++ b/makefile @@ -28,6 +28,7 @@ # NO_OPENGL = 1 # USE_DISPATCH_GL = 0 # DIRECTINPUT = 7 +# USE_SDL = 1 # SDL2_MULTIAPI = 1 # NO_USE_MIDI = 1 # DONT_USE_NETWORK = 1 @@ -57,6 +58,7 @@ # SDL_FRAMEWORK_PATH = $(HOME)/Library/Frameworks # SDL_LIBVER = sdl # MACOSX_USE_LIBSDL = 1 +# CYGWIN_BUILD = 1 # TARGETOS = windows # CROSS_BUILD = 1 @@ -406,6 +408,14 @@ ifdef DIRECTINPUT PARAMS += --DIRECTINPUT='$(DIRECTINPUT)' endif +ifdef USE_SDL +PARAMS += --USE_SDL='$(USE_SDL)' +endif + +ifdef CYGWIN_BUILD +PARAMS += --CYGWIN_BUILD='$(CYGWIN_BUILD)' +endif + ifdef MESA_INSTALL_ROOT PARAMS += --MESA_INSTALL_ROOT='$(MESA_INSTALL_ROOT)' endif diff --git a/scripts/src/osd/windows.lua b/scripts/src/osd/windows.lua index fcedd0c6710..3b060f64b55 100644 --- a/scripts/src/osd/windows.lua +++ b/scripts/src/osd/windows.lua @@ -21,6 +21,13 @@ function maintargetosdoptions(_target) } end + + if _OPTIONS["USE_SDL"] == "1" then + links { + "SDL.dll", + } + end + local rcfile = MAME_DIR .. "src/" .. _target .. "/osd/windows/" .. _target ..".rc" if os.isfile(rcfile) then @@ -40,7 +47,7 @@ newoption { description = "Minimum DirectInput version to support", allowed = { { "7", "Support DirectInput 7 or later" }, - { "8", "Support DirectInput 8 or later" }, + { "8", "Support DirectInput 8 or later" }, }, } @@ -48,6 +55,42 @@ if not _OPTIONS["DIRECTINPUT"] then _OPTIONS["DIRECTINPUT"] = "8" end +newoption { + trigger = "USE_SDL", + description = "Enable SDL sound output", + allowed = { + { "0", "Disable SDL sound output" }, + { "1", "Enable SDL sound output" }, + }, +} + +if not _OPTIONS["USE_SDL"] then + _OPTIONS["USE_SDL"] = "0" +end + +newoption { + trigger = "CYGWIN_BUILD", + description = "Build with Cygwin tools", + allowed = { + { "0", "Build with MinGW tools" }, + { "1", "Build with Cygwin tools" }, + }, +} + +if not _OPTIONS["CYGWIN_BUILD"] then + _OPTIONS["CYGWIN_BUILD"] = "0" +end + + +if _OPTIONS["CYGWIN_BUILD"] == "1" then + buildoptions { + "-mmo-cygwin", + } + linkoptions { + "-mno-cygwin", + } +end + project ("osd_" .. _OPTIONS["osd"]) uuid (os.uuid("osd_" .. _OPTIONS["osd"])) @@ -157,7 +200,7 @@ project ("ocore_" .. _OPTIONS["osd"]) MAME_DIR .. "src/osd/modules/lib/osdlib_win32.c", } - if _OPTIONS["NOASM"]=="1" then + if _OPTIONS["NOASM"] == "1" then files { MAME_DIR .. "src/osd/modules/sync/work_mini.c", } diff --git a/scripts/src/osd/windows_cfg.lua b/scripts/src/osd/windows_cfg.lua index 8bbba52f8d6..082cdc432eb 100644 --- a/scripts/src/osd/windows_cfg.lua +++ b/scripts/src/osd/windows_cfg.lua @@ -2,11 +2,15 @@ defines { "UNICODE", "_UNICODE", "OSD_WINDOWS", - "USE_SDL=0", "main=utf8_main", "_WIN32_WINNT=0x0501", } +configuration { "Debug" } + defines { + "MALLOC_DEBUG", + } + configuration { "vs*" } flags { "Unicode", @@ -20,3 +24,16 @@ if not _OPTIONS["DONT_USE_NETWORK"] then "OSD_NET_USE_PCAP", } end + +if _OPTIONS["USE_SDL"]=="1" then + defines { + "SDLMAME_SDL2=0", + "USE_XINPUT=0", + "USE_SDL=1", + "USE_SDL_SOUND", + } +else + defines { + "USE_SDL=0", + } +end diff --git a/src/osd/modules/render/drawogl.c b/src/osd/modules/render/drawogl.c index 4a3bf4d1e45..05cd39fe985 100644 --- a/src/osd/modules/render/drawogl.c +++ b/src/osd/modules/render/drawogl.c @@ -32,8 +32,8 @@ #include "modules/lib/osdlib.h" #include "modules/lib/osdobj_common.h" -#ifdef OSD_WINDOWS -#define SDLMAME_SDL2 1 +#if defined(OSD_WINDOWS) && !defined(SDLMAME_SDL2) +#define SDLMAME_SDL2 0 #endif // OpenGL headers @@ -189,9 +189,8 @@ enum // TYPES //============================================================ -#if (SDLMAME_SDL2) +#if defined(OSD_WINDOWS) -#ifdef OSD_WINDOWS class win_gl_context : public osd_gl_context { public: @@ -347,7 +346,8 @@ private: HMODULE win_gl_context::m_module; -#else +#elif SDLMAME_SDL2 + class sdl_gl_context : public osd_gl_context { public: @@ -396,7 +396,7 @@ private: SDL_Window *m_window; char m_error[256]; }; -#endif + #else // SDL 1.2 class sdl12_gl_context : public osd_gl_context @@ -442,7 +442,6 @@ private: char m_error[256]; }; - #endif //============================================================ @@ -763,12 +762,13 @@ int drawogl_init(running_machine &machine, osd_draw_callbacks *callbacks) dll_loaded = 0; load_gl_lib(machine); - if (SDLMAME_SDL2) - { - osd_printf_verbose("Using SDL multi-window OpenGL driver (SDL 2.0+)\n"); - } - else - osd_printf_verbose("Using SDL single-window OpenGL driver (SDL 1.2)\n"); +#if defined(OSD_WINDOWS) + osd_printf_verbose("Using Windows OpenGL driver\n"); +#elif SDLMAME_SDL2 + osd_printf_verbose("Using SDL multi-window OpenGL driver (SDL 2.0+)\n"); +#else + osd_printf_verbose("Using SDL single-window OpenGL driver (SDL 1.2)\n"); +#endif return 0; } @@ -1030,13 +1030,11 @@ void sdl_info_ogl::initialize_gl() int sdl_info_ogl::create() { -#if (SDLMAME_SDL2) // create renderer -#ifdef OSD_WINDOWS +#if defined(OSD_WINDOWS) m_gl_context = global_alloc(win_gl_context(window().m_hwnd)); -#else +#elif SDLMAME_SDL2 m_gl_context = global_alloc(sdl_gl_context(window().sdl_window())); -#endif #else m_gl_context = global_alloc(sdl12_gl_context(window().sdl_surface())); #endif @@ -1530,7 +1528,7 @@ int sdl_info_ogl::draw(const int update) if (m_init_context) { // do some one-time OpenGL setup -#if (SDLMAME_SDL2) +#if SDLMAME_SDL2 // FIXME: SRGB conversion is working on SDL2, may be of use // when we eventually target gamma and monitor profiles. //glEnable(GL_FRAMEBUFFER_SRGB); @@ -1560,7 +1558,7 @@ int sdl_info_ogl::draw(const int update) loadGLExtensions(); } -#if (!SDLMAME_SDL2) +#if !defined(OSD_WINDOWS) && !SDLMAME_SDL2 // force all textures to be regenerated destroy_all_textures(); #endif