MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / LoadSnapshot

Method LoadSnapshot

source/Uthernet1.cpp:1092–1136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1090}
1091
1092bool Uthernet1::LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT version)
1093{
1094 if (version < 1 || version > kUNIT_VERSION)
1095 ThrowErrorInvalidVersion(version);
1096
1097 yamlLoadHelper.LoadBool(SS_YAML_KEY_ENABLED); // FIXME: what is the point of this?
1098 PCapBackend::SetRegistryInterface(m_slot, yamlLoadHelper.LoadString(SS_YAML_KEY_NETWORK_INTERFACE));
1099
1100 tfe_started_tx = yamlLoadHelper.LoadBool(SS_YAML_KEY_STARTED_TX) ? true : false;
1101
1102 // it is meaningless to restore this boolean flag
1103 // as it depends on the availability of npcap on *this* pc
1104 const bool tfe_cannot_use = yamlLoadHelper.LoadBool(SS_YAML_KEY_CANNOT_USE);
1105
1106 txcollect_buffer = yamlLoadHelper.LoadUint(SS_YAML_KEY_TXCOLLECT_BUFFER);
1107 rx_buffer = yamlLoadHelper.LoadUint(SS_YAML_KEY_RX_BUFFER);
1108
1109 if (!yamlLoadHelper.GetSubMap(SS_YAML_KEY_CS8900A_REGS))
1110 throw std::runtime_error("Card: Expected key: " SS_YAML_KEY_CS8900A_REGS);
1111
1112 memset(tfe, 0, TFE_COUNT_IO_REGISTER);
1113 yamlLoadHelper.LoadMemory(tfe, TFE_COUNT_IO_REGISTER);
1114 yamlLoadHelper.PopMap();
1115
1116 if (!yamlLoadHelper.GetSubMap(SS_YAML_KEY_PACKETPAGE_REGS))
1117 throw std::runtime_error("Card: Expected key: " SS_YAML_KEY_PACKETPAGE_REGS);
1118
1119 memset(tfe_packetpage, 0, MAX_PACKETPAGE_ARRAY);
1120 yamlLoadHelper.LoadMemory(tfe_packetpage, MAX_PACKETPAGE_ARRAY);
1121 yamlLoadHelper.PopMap();
1122
1123 // Side effects after PackagePage has been loaded
1124
1125 tfe_packetpage_ptr = GET_TFE_16(TFE_ADDR_PP_PTR);
1126
1127 tfe_sideeffects_write_pp(TFE_PP_ADDR_CC_RXCTL, 0); // set the 6 tfe_recv_* vars
1128
1129 for (UINT i = 0; i < 8; i++)
1130 tfe_sideeffects_write_pp((TFE_PP_ADDR_LOG_ADDR_FILTER + i) & ~1, i & 1); // set tfe_hash_mask
1131
1132 for (UINT i = 0; i < 6; i++)
1133 tfe_sideeffects_write_pp((TFE_PP_ADDR_MAC_ADDR + i) & ~1, i & 1); // set tfe_ia_mac
1134
1135 return true;
1136}

Callers

nothing calls this directly

Calls 6

LoadBoolMethod · 0.80
LoadStringMethod · 0.80
LoadUintMethod · 0.80
LoadMemoryMethod · 0.80
PopMapMethod · 0.80
GetSubMapMethod · 0.45

Tested by

no test coverage detected