mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-27 00:00:07 -06:00
Merge remote-tracking branch 'origin/master' into season3
# Conflicts: # src/frontend/qt_sdl/EmuInstance.cpp
This commit is contained in:
@ -79,6 +79,9 @@
|
||||
|
||||
#include "CLI.h"
|
||||
|
||||
#include "Net_PCap.h"
|
||||
#include "Net_Slirp.h"
|
||||
|
||||
using namespace melonDS;
|
||||
|
||||
QString* systemThemeName;
|
||||
@ -92,6 +95,38 @@ EmuInstance* emuInstances[kMaxEmuInstances];
|
||||
|
||||
CameraManager* camManager[2];
|
||||
bool camStarted[2];
|
||||
LocalMP localMp;
|
||||
std::optional<LibPCap> pcap;
|
||||
Net net;
|
||||
|
||||
void NetInit()
|
||||
{
|
||||
Config::Table cfg = Config::GetGlobalTable();
|
||||
if (cfg.GetBool("LAN.DirectMode"))
|
||||
{
|
||||
if (!pcap)
|
||||
pcap = LibPCap::New();
|
||||
|
||||
if (pcap)
|
||||
{
|
||||
std::string devicename = cfg.GetString("LAN.Device");
|
||||
std::unique_ptr<Net_PCap> netPcap = pcap->Open(devicename, [](const u8* data, int len) {
|
||||
net.RXEnqueue(data, len);
|
||||
});
|
||||
|
||||
if (netPcap)
|
||||
{
|
||||
net.SetDriver(std::move(netPcap));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
net.SetDriver(std::make_unique<Net_Slirp>([](const u8* data, int len) {
|
||||
net.RXEnqueue(data, len);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool createEmuInstance()
|
||||
@ -286,13 +321,8 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
LocalMP::Init();
|
||||
{
|
||||
Config::Table cfg = Config::GetGlobalTable();
|
||||
bool direct = cfg.GetBool("LAN.DirectMode");
|
||||
std::string devicename = cfg.GetString("LAN.Device");
|
||||
Net::Init(direct, devicename.c_str());
|
||||
}
|
||||
// localMp is initialized at this point
|
||||
NetInit();
|
||||
|
||||
createEmuInstance();
|
||||
|
||||
@ -329,9 +359,6 @@ int main(int argc, char** argv)
|
||||
// but with this we make extra sure they are all deleted
|
||||
deleteAllEmuInstances();
|
||||
|
||||
LocalMP::DeInit();
|
||||
Net::DeInit();
|
||||
|
||||
delete camManager[0];
|
||||
delete camManager[1];
|
||||
|
||||
@ -347,6 +374,12 @@ int main(int argc, char** argv)
|
||||
|
||||
int CALLBACK WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int cmdshow)
|
||||
{
|
||||
if (AttachConsole(ATTACH_PARENT_PROCESS) && GetStdHandle(STD_OUTPUT_HANDLE))
|
||||
{
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
}
|
||||
|
||||
int ret = main(__argc, __argv);
|
||||
|
||||
printf("\n\n>");
|
||||
|
Reference in New Issue
Block a user