summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/network.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/network.cpp')
-rw-r--r--src/emu/network.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/emu/network.cpp b/src/emu/network.cpp
index 1456013a74f..f5e065ac9cb 100644
--- a/src/emu/network.cpp
+++ b/src/emu/network.cpp
@@ -8,13 +8,16 @@
***************************************************************************/
-#include <cctype>
-
#include "emu.h"
#include "network.h"
+
#include "config.h"
+#include "dinetwork.h"
+
#include "xmlfile.h"
+#include <cctype>
+
//**************************************************************************
// NETWORK MANAGER
//**************************************************************************
@@ -26,7 +29,10 @@
network_manager::network_manager(running_machine &machine)
: m_machine(machine)
{
- machine.configuration().config_register("network", config_load_delegate(&network_manager::config_load, this), config_save_delegate(&network_manager::config_save, this));
+ machine.configuration().config_register(
+ "network",
+ configuration_manager::load_delegate(&network_manager::config_load, this),
+ configuration_manager::save_delegate(&network_manager::config_save, this));
}
//-------------------------------------------------
@@ -34,9 +40,9 @@ network_manager::network_manager(running_machine &machine)
// configuration file
//-------------------------------------------------
-void network_manager::config_load(config_type cfg_type, util::xml::data_node const *parentnode)
+void network_manager::config_load(config_type cfg_type, config_level cfg_level, util::xml::data_node const *parentnode)
{
- if ((cfg_type == config_type::GAME) && (parentnode != nullptr))
+ if ((cfg_type == config_type::SYSTEM) && parentnode)
{
for (util::xml::data_node const *node = parentnode->get_child("device"); node; node = node->get_next_sibling("device"))
{
@@ -44,14 +50,14 @@ void network_manager::config_load(config_type cfg_type, util::xml::data_node con
if ((tag != nullptr) && (tag[0] != '\0'))
{
- for (device_network_interface &network : network_interface_iterator(machine().root_device()))
+ for (device_network_interface &network : network_interface_enumerator(machine().root_device()))
{
if (!strcmp(tag, network.device().tag())) {
int interface = node->get_attribute_int("interface", 0);
network.set_interface(interface);
const char *mac_addr = node->get_attribute_string("mac", nullptr);
if (mac_addr != nullptr && strlen(mac_addr) == 17) {
- char mac[7];
+ uint8_t mac[6];
unsigned int mac_num[6];
sscanf(mac_addr, "%02x:%02x:%02x:%02x:%02x:%02x", &mac_num[0], &mac_num[1], &mac_num[2], &mac_num[3], &mac_num[4], &mac_num[5]);
for (int i = 0; i<6; i++) mac[i] = mac_num[i];
@@ -71,19 +77,19 @@ void network_manager::config_load(config_type cfg_type, util::xml::data_node con
void network_manager::config_save(config_type cfg_type, util::xml::data_node *parentnode)
{
- /* only care about game-specific data */
- if (cfg_type == config_type::GAME)
+ // only save about system-specific data
+ if (cfg_type == config_type::SYSTEM)
{
- for (device_network_interface &network : network_interface_iterator(machine().root_device()))
+ for (device_network_interface &network : network_interface_enumerator(machine().root_device()))
{
util::xml::data_node *const node = parentnode->add_child("device", nullptr);
- if (node != nullptr)
+ if (node)
{
node->set_attribute("tag", network.device().tag());
node->set_attribute_int("interface", network.get_interface());
- const char *mac = network.get_mac();
+ const std::array<u8, 6> &mac = network.get_mac();
char mac_addr[6 * 3];
- sprintf(mac_addr, "%02x:%02x:%02x:%02x:%02x:%02x", u8(mac[0]), u8(mac[1]), u8(mac[2]), u8(mac[3]), u8(mac[4]), u8(mac[5]));
+ sprintf(mac_addr, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
node->set_attribute("mac", mac_addr);
}
}