devilutionX/Source/platform/switch/network.cpp
2021-04-25 02:50:31 +02:00

23 lines
519 B
C++

#include <cstdlib>
#include <unistd.h>
#include <switch.h>
#include "platform/switch/network.h"
static int nxlink_sock = -1; // for stdio on Switch
void switch_enable_network()
{
// enable network and stdio on Switch
socketInitializeDefault();
// enable error messages via nxlink on Switch
nxlink_sock = nxlinkStdio();
atexit(switch_disable_network);
}
void switch_disable_network()
{
// disable network and stdio on Switch
if (nxlink_sock != -1)
close(nxlink_sock);
socketExit();
}