From 5bce46bd7561ae1857c7e17614133f01f984ae78 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Thu, 5 Mar 2020 21:23:21 +1100 Subject: Removed winpcap and cleaned up network module selection. (nw) The pcap.h header itself has the problematic original BSD license, including the obnoxious advertising clause. Using tap/tun networking on Windows provides a much better experience, so the extra setup is worth it. This patch also allows you to enable pcap on platforms where it's disabled by default with USE_PCAP=1 if you really want to use it. --- scripts/src/osd/mac_cfg.lua | 13 +++++++++++-- scripts/src/osd/modules.lua | 37 +++++++++++++++++++++++++++++++++---- scripts/src/osd/sdl.lua | 5 ----- scripts/src/osd/sdl_cfg.lua | 13 +++++++++++-- scripts/src/osd/windows.lua | 1 - scripts/src/osd/windows_cfg.lua | 14 +++++++++++--- 6 files changed, 66 insertions(+), 17 deletions(-) (limited to 'scripts/src') diff --git a/scripts/src/osd/mac_cfg.lua b/scripts/src/osd/mac_cfg.lua index 76f0ac4ac1b..baa23831723 100644 --- a/scripts/src/osd/mac_cfg.lua +++ b/scripts/src/osd/mac_cfg.lua @@ -7,11 +7,20 @@ forcedincludes { -- MAME_DIR .. "src/osd/sdl/sdlprefix.h" } -if not _OPTIONS["DONT_USE_NETWORK"] then +if _OPTIONS["USE_TAPTUN"]=="1" or _OPTIONS["USE_PCAP"]==1 then defines { "USE_NETWORK", - "OSD_NET_USE_PCAP", } + if _OPTIONS["USE_TAPTUN"]=="1" then + defines { + "OSD_NET_USE_TAPTUN", + } + end + if _OPTIONS["USE_PCAP"]=="1" then + defines { + "OSD_NET_USE_PCAP", + } + end end defines { diff --git a/scripts/src/osd/modules.lua b/scripts/src/osd/modules.lua index 0df5597b254..a1b7f1d26df 100644 --- a/scripts/src/osd/modules.lua +++ b/scripts/src/osd/modules.lua @@ -467,8 +467,21 @@ end newoption { - trigger = "DONT_USE_NETWORK", - description = "Disable network access", + trigger = "USE_TAPTUN", + description = "Include tap/tun network module", + allowed = { + { "0", "Don't include tap/tun network module" }, + { "1", "Include tap/tun network module" }, + }, +} + +newoption { + trigger = "USE_PCAP", + description = "Include pcap network module", + allowed = { + { "0", "Don't include pcap network module" }, + { "1", "Include pcap network module" }, + }, } newoption { @@ -540,7 +553,7 @@ newoption { trigger = "USE_QTDEBUG", description = "Use QT debugger", allowed = { - { "0", "Don't use Qt debugger" }, + { "0", "Don't use Qt debugger" }, { "1", "Use Qt debugger" }, }, } @@ -551,8 +564,24 @@ newoption { } +if not _OPTIONS["USE_TAPTUN"] then + if _OPTIONS["targetos"]=="linux" or _OPTIONS["targetos"]=="windows" then + _OPTIONS["USE_TAPTUN"] = "1" + else + _OPTIONS["USE_TAPTUN"] = "0" + end +end + +if not _OPTIONS["USE_PCAP"] then + if _OPTIONS["targetos"]=="macosx" or _OPTIONS["targetos"]=="netbsd" then + _OPTIONS["USE_PCAP"] = "1" + else + _OPTIONS["USE_PCAP"] = "0" + end +end + if not _OPTIONS["USE_QTDEBUG"] then - if _OPTIONS["targetos"]=="windows" or _OPTIONS["targetos"]=="macosx" or _OPTIONS["targetos"]=="solaris" or _OPTIONS["targetos"]=="haiku" or _OPTIONS["targetos"] == "asmjs" then + if _OPTIONS["targetos"]=="windows" or _OPTIONS["targetos"]=="macosx" or _OPTIONS["targetos"]=="solaris" or _OPTIONS["targetos"]=="haiku" or _OPTIONS["targetos"]=="asmjs" then _OPTIONS["USE_QTDEBUG"] = "0" else _OPTIONS["USE_QTDEBUG"] = "1" diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index 43b1e20e079..10aa9940c52 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -239,21 +239,16 @@ end BASE_TARGETOS = "unix" SDLOS_TARGETOS = "unix" -SDL_NETWORK = "" if _OPTIONS["targetos"]=="linux" then - SDL_NETWORK = "taptun" elseif _OPTIONS["targetos"]=="openbsd" then elseif _OPTIONS["targetos"]=="netbsd" then - SDL_NETWORK = "pcap" elseif _OPTIONS["targetos"]=="haiku" then elseif _OPTIONS["targetos"]=="asmjs" then elseif _OPTIONS["targetos"]=="windows" then BASE_TARGETOS = "win32" SDLOS_TARGETOS = "win32" - SDL_NETWORK = "pcap" elseif _OPTIONS["targetos"]=="macosx" then SDLOS_TARGETOS = "macosx" - SDL_NETWORK = "pcap" end if _OPTIONS["with-bundled-sdl2"]~=nil then diff --git a/scripts/src/osd/sdl_cfg.lua b/scripts/src/osd/sdl_cfg.lua index ad3750184fd..e942e50fdde 100644 --- a/scripts/src/osd/sdl_cfg.lua +++ b/scripts/src/osd/sdl_cfg.lua @@ -7,11 +7,20 @@ forcedincludes { MAME_DIR .. "src/osd/sdl/sdlprefix.h" } -if SDL_NETWORK~="" and not _OPTIONS["DONT_USE_NETWORK"] then +if _OPTIONS["USE_TAPTUN"]=="1" or _OPTIONS["USE_PCAP"]==1 then defines { "USE_NETWORK", - "OSD_NET_USE_" .. string.upper(SDL_NETWORK), } + if _OPTIONS["USE_TAPTUN"]=="1" then + defines { + "OSD_NET_USE_TAPTUN", + } + end + if _OPTIONS["USE_PCAP"]=="1" then + defines { + "OSD_NET_USE_PCAP", + } + end end if _OPTIONS["NO_OPENGL"]~="1" and _OPTIONS["USE_DISPATCH_GL"]~="1" and _OPTIONS["MESA_INSTALL_ROOT"] then diff --git a/scripts/src/osd/windows.lua b/scripts/src/osd/windows.lua index ecb3030c683..963980b22ca 100644 --- a/scripts/src/osd/windows.lua +++ b/scripts/src/osd/windows.lua @@ -227,7 +227,6 @@ project ("ocore_" .. _OPTIONS["osd"]) includedirs { MAME_DIR .. "src/osd/windows", - MAME_DIR .. "src/lib/winpcap", } files { diff --git a/scripts/src/osd/windows_cfg.lua b/scripts/src/osd/windows_cfg.lua index 2735e4df4f0..10e5ee86a21 100644 --- a/scripts/src/osd/windows_cfg.lua +++ b/scripts/src/osd/windows_cfg.lua @@ -37,12 +37,20 @@ else } end -if not _OPTIONS["DONT_USE_NETWORK"] then +if _OPTIONS["USE_TAPTUN"]=="1" or _OPTIONS["USE_PCAP"]==1 then defines { "USE_NETWORK", - "OSD_NET_USE_PCAP", - "OSD_NET_USE_TAPTUN", } + if _OPTIONS["USE_TAPTUN"]=="1" then + defines { + "OSD_NET_USE_TAPTUN", + } + end + if _OPTIONS["USE_PCAP"]=="1" then + defines { + "OSD_NET_USE_PCAP", + } + end end if _OPTIONS["USE_SDL"]=="1" then -- cgit v1.2.3-70-g09d2