Here is the code to be able to automate adding and dropping the bridge for Windows 10. If you have Windows 11 you should be able to use a netsh command to not have to bother with this but win 10 and older apparently do not have the bridge netsh capability and Microsoft is not adding as far as I know.. Just use Launchbox to set this to run before (with wait to exit) and after the game kicks off. It uses a free program called Sikuli that uses AI to find images and click it for you.
1) Create a folder in your documents folder called Mame4.sikuli
2) Create a add_bridge.bat file
java -jar "C:\Users\Emulation\Documents\Mame4.sikuli\sikulixidewin-2.0.6-20230417.153928-17.jar" -r "C:\Users\Emulation\Documents\Mame4.sikuli\Mame_add_bridge.py"
timeout /t 4 /nobreak >nul
C:\Users\Emulation\Documents\Mame4.sikuli\mame_foreground.ahk
3) Create a remove_bridge.bat file
java -jar "C:\Users\Emulation\Documents\Mame4.sikuli\sikulixidewin-2.0.6-20230417.153928-17.jar" -r "C:\Users\Emulation\Documents\Mame4.sikuli\Mame_remove_bridge.py"
timeout /t 4 /nobreak >nul
C:\Users\Emulation\Documents\Mame4.sikuli\BigBox_foreground.ahk
4) Create a BigBox_foreground.ahk file
#Persistent
SetTimer, CheckBigBox, 100
return
CheckBigBox:
If WinExist("Network Connections")
{
WinClose
Sleep, 500 ;wait 500ms to make sure closes ncpa.cpl
}
IfWinExist, ahk_exe BigBox.exe
{
WinActivate
SetTimer, CheckBigBox, Off
ExitApp
}
return
and mame_foreground.ahk but change the exe you use for mame (may be mame.exe or mame64.exe but I use custom names so I can control each with Logitech app)
#NoEnv
#SingleInstance force
#Persistent
Process, Close, mame_foreground.ahk
SetTimer, Checkmame, 100
return
Checkmame:
If WinExist, ahk_exe mame_SFRushRock.exe
{
WinActivate
SetTimer, Checkmame, Off
ExitApp
}
else if WinExist, ahk_exe mame_SFRush2049.exe
{
WinActivate
SetTimer, Checkmame, Off
ExitApp
}
else if WinExist, ahk_exe mame_calspeed.exe
{
WinActivate
SetTimer, Checkmame, Off
ExitApp
}
else if WinExist, ahk_exe mame_SFRush.exe
{
WinActivate
SetTimer, Checkmame, Off
ExitApp
}
else
{
SetTimer, Checkmame, Off
ExitApp
}
return
5) Create a Mame_add_bridge.py
import os
import subprocess
import time
from sikuli import *
# Function to open Network Connections
def open_network_connections():
subprocess.Popen(["control.exe", "ncpa.cpl"])
# Define the image patterns for the network bridge and context menu options
ethernet_pattern = Pattern(Pattern("ethernetmain.png").similar(.80).targetOffset(32,21))
ethernet_pattern_blue = Pattern(Pattern("ethernet_blue.png").targetOffset(26,22))
ethernet_pattern_line = Pattern(Pattern("ethernet_line.png").targetOffset(39,23))
remove_bridge_pattern = Pattern("removebridge.png")
add_bridge_pattern = Pattern("add_bridge.png")
# Open Network Connections window
open_network_connections()
#wait(1) # Wait for the window to open
def check_click_patterns():
matches = findAnyList([ethernet_pattern,ethernet_pattern_blue,ethernet_pattern_line])
if matches:
for match in matches:
if match.getImage() == ethernet_pattern.getImage():
rightClick(match)
print('Ethernet Pattern Found and Clicked')
if exists(add_bridge_pattern):
click(add_bridge_pattern)
print('Clicked add bridge')
return True
elif match.getImage() == ethernet_pattern_blue.getImage():
rightClick(match)
print('Ethernet Pattern Blue Found and Clicked')
if exists(add_bridge_pattern):
click(add_bridge_pattern)
print('Clicked add bridge from blue')
return True
elif match.getImage() == ethernet_pattern_line.getImage():
rightClick(match)
print('Ethernet Pattern Line Found and Clicked')
if exists(add_bridge_pattern):
click(add_bridge_pattern)
print('Clicked add bridge from line')
return True
return False
timeout =2
start_time = time.time()
while True:
if check_click_patterns():
break
if time.time() - start_time > timeout:
print('Timeout Reached, Exiting')
break
#wait(1) #wait a sec before checking again
# Close the Network Connections window
open_network_connections()#make sure back on window
wait(0.2)
type(Key.F4, KeyModifier.ALT)#close
6) Create a Mame_remove_bridge.py
import os
import subprocess
import time
from sikuli import *
# Function to open Network Connections
def open_network_connections():
subprocess.Popen(["control.exe", "ncpa.cpl"])
# Define the image patterns for the network bridge and context menu options
ethernet_pattern = Pattern(Pattern("ethernetmain.png").similar(.80).targetOffset(32,21))
ethernet_pattern_blue = Pattern(Pattern("ethernet_blue.png").targetOffset(26,22))
ethernet_pattern_line = Pattern(Pattern("ethernet_line.png").targetOffset(39,23))
remove_bridge_pattern = Pattern("removebridge.png")
add_bridge_pattern = Pattern("add_bridge.png")
# Open Network Connections window
open_network_connections()
#wait(1) # Wait for the window to open
def check_click_patterns():
matches = findAnyList([ethernet_pattern,ethernet_pattern_blue,ethernet_pattern_line])
if matches:
for match in matches:
if match.getImage() == ethernet_pattern.getImage():
rightClick(match)
print('Ethernet Pattern Found and Clicked')
if exists(remove_bridge_pattern):
click(remove_bridge_pattern)
print('Clicked remove bridge')
return True
elif match.getImage() == ethernet_pattern_blue.getImage():
rightClick(match)
print('Ethernet Pattern Blue Found and Clicked')
if exists(remove_bridge_pattern):
click(remove_bridge_pattern)
print('Clicked remove bridge from blue')
return True
elif match.getImage() == ethernet_pattern_line.getImage():
rightClick(match)
print('Ethernet Pattern Line Found and Clicked')
if exists(remove_bridge_pattern):
click(remove_bridge_pattern)
print('Clicked remove bridge from line')
return True
return False
timeout =2
start_time = time.time()
while True:
if check_click_patterns():
break
if time.time() - start_time > timeout:
print('Timeout Reached, Exiting')
break
#wait(1) #wait a sec before checking again
# Close the Network Connections window
open_network_connections()#make sure back on window
wait(0.2)
type(Key.F4, KeyModifier.ALT)#close
7) Download sikulixidewin-2.0.6-20230417.153928-17.jar for free to be able to run the Sikuli script. This may require installing a jdk first like OpenJDK21U-jdk_x64_windows_hotspot_21.0.3_9.msi for free
8 ) Downoad the attached image files to the same folder. Sikuli looks for these images.
9) Set Launhbox to kick off the add upon start (with wait to exist) and the remove after
Done. Now Sikuli opens up the network adapter screen, looks for the connection called "Ethernet", right clicks it, and says add to bridge. Then after closing, it finds the Ethernet connection, right clicks, and clicks remove from bridge. I have three types of Ethernet images where one is not clicked, one is clicked where it is greyed, and then one where it was clicked but was clicked off of. This works perfect on my pc but should be tested obviously.