Devbranch network switch

This commit is contained in:
Jasmine Iwanek
2025-08-02 16:53:01 -04:00
parent 0767d5bb2a
commit 6c375d04e2
5 changed files with 32 additions and 8 deletions

View File

@@ -34,13 +34,6 @@ list(APPEND net_sources
net_l80225.c
net_modem.c
utils/getline.c
net_netswitch.c
netswitch.c
pb_common.c
pb_encode.c
pb_decode.c
networkmessage.pb.c
)
find_package(PkgConfig REQUIRED)
@@ -65,6 +58,18 @@ if(WIN32)
target_link_libraries(86Box ws2_32)
endif()
if(NETSWITCH)
add_compile_definitions(USE_NETSWITCH)
list(APPEND net_sources
net_netswitch.c
netswitch.c
pb_common.c
pb_encode.c
pb_decode.c
networkmessage.pb.c
)
endif()
if (UNIX)
find_path(HAS_VDE "libvdeplug.h" PATHS ${VDE_INCLUDE_DIR} "/usr/include /usr/local/include" "/opt/homebrew/include" )
if(HAS_VDE)

View File

@@ -503,11 +503,13 @@ network_attach(void *card_drv, uint8_t *mac, NETRXCB rx, NETSETLINKSTATE set_lin
card->host_drv.priv = card->host_drv.init(card, mac, net_cards_conf[net_card_current].host_dev_name, net_drv_error);
break;
#endif
#ifdef USE_NETSWITCH
case NET_TYPE_NMSWITCH:
case NET_TYPE_NRSWITCH:
card->host_drv = net_netswitch_drv;
card->host_drv.priv = card->host_drv.init(card, mac, &net_cards_conf[net_card_current], net_drv_error);
break;
#endif /* USE_NETSWITCH */
default:
card->host_drv.priv = NULL;
break;
@@ -519,11 +521,13 @@ network_attach(void *card_drv, uint8_t *mac, NETRXCB rx, NETSETLINKSTATE set_lin
if (!card->host_drv.priv) {
if(net_cards_conf[net_card_current].net_type != NET_TYPE_NONE) {
#ifdef USE_NETSWITCH
// FIXME: Hardcoded during dev
// FIXME: Remove when done!
if((net_cards_conf[net_card_current].net_type == NET_TYPE_NMSWITCH) ||
(net_cards_conf[net_card_current].net_type == NET_TYPE_NRSWITCH))
fatal("%s", net_drv_error);
#endif /* USE_NETSWITCH */
// We're here because of a failure
swprintf(tempmsg, sizeof_w(tempmsg), L"%ls:\n\n%s\n\n%ls", plat_get_string(STRING_NET_ERROR), net_drv_error, plat_get_string(STRING_NET_ERROR_DESC));