Skip to content

Commit

Permalink
Initial import of vmnet and vmnet_helper. [Kelvin Sherlock, R. Belmont]
Browse files Browse the repository at this point in the history
  • Loading branch information
rb6502 committed Oct 13, 2023
1 parent 33c04f0 commit 99bfb0d
Show file tree
Hide file tree
Showing 10 changed files with 1,601 additions and 1 deletion.
43 changes: 43 additions & 0 deletions scripts/src/osd/modules.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ function osdmodulesbuild()
MAME_DIR .. "src/osd/modules/netdev/none.cpp",
MAME_DIR .. "src/osd/modules/netdev/pcap.cpp",
MAME_DIR .. "src/osd/modules/netdev/taptun.cpp",
MAME_DIR .. "src/osd/modules/netdev/vmnet.cpp",
MAME_DIR .. "src/osd/modules/netdev/vmnet_helper.cpp",
MAME_DIR .. "src/osd/modules/netdev/vmnet_common.cpp",
MAME_DIR .. "src/osd/modules/output/console.cpp",
MAME_DIR .. "src/osd/modules/output/network.cpp",
MAME_DIR .. "src/osd/modules/output/none.cpp",
Expand Down Expand Up @@ -318,6 +321,11 @@ function osdmodulesbuild()
}
end

if _OPTIONS["USE_VMNET"]=="1" then
links {
"vmnet.framework"
}
end
end


Expand Down Expand Up @@ -453,6 +461,7 @@ function osdmodulestargetconf()
if _OPTIONS["targetos"]=="macosx" then
links {
"OpenGL.framework",
"vmnet.framework"
}
elseif _OPTIONS["USE_DISPATCH_GL"]~="1" then
if _OPTIONS["targetos"]=="windows" then
Expand Down Expand Up @@ -568,6 +577,24 @@ newoption {
},
}

newoption {
trigger = "USE_VMNET",
description = "Include vmnet network module (macOS). This builds vmnet support into MAME, so MAME must be run as root to access the network.",
allowed = {
{ "0", "Don't include vmnet network module" },
{ "1", "Include vmnet network module" },
},
}

newoption {
trigger = "USE_VMNET_HELPER",
description = "Include vmnet helper network module (macOS). This works with the external vmnet_helper program, so that MAME doesn't have to run as root.",
allowed = {
{ "0", "Don't include vmnet helper network module" },
{ "1", "Include vmnet network helper module" },
},
}

newoption {
trigger = "NO_OPENGL",
description = "Disable use of OpenGL",
Expand Down Expand Up @@ -689,6 +716,22 @@ if not _OPTIONS["USE_PCAP"] then
end
end

if not _OPTIONS["USE_VMNET"] then
if _OPTIONS["targetos"]=="macosx" then
_OPTIONS["USE_VMNET"] = "1"
else
_OPTIONS["USE_VMNET"] = "0"
end
end

if not _OPTIONS["USE_VMNET_HELPER"] then
if _OPTIONS["targetos"]=="macosx" then
_OPTIONS["USE_VMNET_HELPER"] = "1"
else
_OPTIONS["USE_VMNET_HELPER"] = "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" or _OPTIONS["targetos"]=="android" then
_OPTIONS["USE_QTDEBUG"] = "0"
Expand Down
12 changes: 11 additions & 1 deletion scripts/src/osd/sdl_cfg.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ forcedincludes {
MAME_DIR .. "src/osd/sdl/sdlprefix.h"
}

if _OPTIONS["USE_TAPTUN"]=="1" or _OPTIONS["USE_PCAP"]=="1" then
if _OPTIONS["USE_TAPTUN"]=="1" or _OPTIONS["USE_PCAP"]=="1" or _OPTIONS["USE_VMNET"]=="1" or _OPTIONS["USE_VMNET_HELPER"]=="1" then
defines {
"USE_NETWORK",
}
Expand All @@ -21,6 +21,16 @@ if _OPTIONS["USE_TAPTUN"]=="1" or _OPTIONS["USE_PCAP"]=="1" then
"OSD_NET_USE_PCAP",
}
end
if _OPTIONS["USE_VMNET"]=="1" then
defines {
"OSD_NET_USE_VMNET",
}
end
if _OPTIONS["USE_VMNET_HELPER"]=="1" then
defines {
"OSD_NET_USE_VMNET_HELPER",
}
end
end

if _OPTIONS["NO_OPENGL"]~="1" and _OPTIONS["USE_DISPATCH_GL"]~="1" and _OPTIONS["MESA_INSTALL_ROOT"] then
Expand Down
38 changes: 38 additions & 0 deletions scripts/src/tools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -828,3 +828,41 @@ if (_OPTIONS["osd"] == "sdl") then

strip()
end

--------------------------------------------------
-- vmnet_helper
--------------------------------------------------

if _OPTIONS["targetos"] == "macosx" then
project("vmnet_helper")
uuid ("a0a2d516-f9ac-457f-9dfa-dcdb4ba040c6")
kind "ConsoleApp"

flags {
"Symbols", -- always include minimum symbols for executables
}

if _OPTIONS["SEPARATE_BIN"]~="1" then
targetdir(MAME_DIR)
end

linkoptions {
"-sectcreate __TEXT __info_plist " .. _MAKE.esc(MAME_DIR) .. "src/tools/vmnet_helper.plist",
}

dependency {
{ "vmnet_helper", MAME_DIR .. "src/tools/vmnet_helper.plist", true },
}

links {
"vmnet.framework"
}

files {
MAME_DIR .. "src/tools/vmnet_helper.c",
}

configuration { }

strip()
end
4 changes: 4 additions & 0 deletions src/osd/modules/lib/osdobj_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ void osd_common_t::register_options()
REGISTER_MODULE(m_mod_man, DEBUG_NONE);
#endif

#ifdef SDLMAME_MACOSX
REGISTER_MODULE(m_mod_man, NETDEV_VMNET_HELPER);
REGISTER_MODULE(m_mod_man, NETDEV_VMNET);
#endif
REGISTER_MODULE(m_mod_man, NETDEV_TAPTUN);
REGISTER_MODULE(m_mod_man, NETDEV_PCAP);
REGISTER_MODULE(m_mod_man, NETDEV_NONE);
Expand Down
Loading

0 comments on commit 99bfb0d

Please sign in to comment.