Safer check that Uthernet is active.

Unfortunately we cannot force a hot-activation as this will cause SegFaults in the TFE code.
It does not check if the pcap handle is good, but relies on the initialisation to have succeeded.

Unfortunately, visual feedback on the settings is lost.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2021-06-05 16:57:12 +01:00
parent 087f0f7942
commit abc4a4e1d3
2 changed files with 7 additions and 2 deletions

View file

@ -198,8 +198,7 @@ namespace sa2
void saveTFEEnabled(const int enabled)
{
tfe_enabled = enabled;
REGSAVE(TEXT(REGVALUE_UTHERNET_ACTIVE), tfe_enabled);
REGSAVE(TEXT(REGVALUE_UTHERNET_ACTIVE), enabled);
}
void changeBreakpoint(const DWORD nAddress, const bool enableAndSet)

View file

@ -1015,7 +1015,13 @@ void registerUthernet2()
slirp.reset();
slirp = std::make_shared<SlirpNet>();
#else
const int check = tfe_enabled;
tfe_init();
if (tfe_enabled != check)
{
// tfe initialisation failed
return;
}
#endif
dataAddress = 0;
initialise();