Refactor network implementations to be more reusable and less buggy (#2107)

encapsulate network interfaces
This commit is contained in:
Jesse Talavera
2024-08-01 16:02:45 -04:00
committed by GitHub
parent c6bf5d5181
commit 327ce45124
20 changed files with 715 additions and 439 deletions

View File

@ -62,6 +62,8 @@ using namespace melonDS::Platform;
MainWindow* topWindow = nullptr;
const string kWifiSettingsPath = "wfcsettings.bin";
extern LocalMP localMp;
extern Net net;
EmuInstance::EmuInstance(int inst) : instanceID(inst),
@ -97,7 +99,7 @@ EmuInstance::EmuInstance(int inst) : instanceID(inst),
audioInit();
inputInit();
Net::RegisterInstance(instanceID);
net.RegisterInstance(instanceID);
emuThread = new EmuThread(this);
@ -116,14 +118,13 @@ EmuInstance::EmuInstance(int inst) : instanceID(inst),
EmuInstance::~EmuInstance()
{
// TODO window cleanup and shit?
LocalMP::End(instanceID);
localMp.End(instanceID);
emuThread->emuExit();
emuThread->wait();
delete emuThread;
Net::UnregisterInstance(instanceID);
net.UnregisterInstance(instanceID);
audioDeInit();
inputDeInit();