diff options
author | cpasjuste <cpasjuste@gmail.com> | 2020-04-22 15:24:08 +0200 |
---|---|---|
committer | cpasjuste <cpasjuste@gmail.com> | 2020-04-22 15:24:08 +0200 |
commit | f43e3aa48aeb561f5c7e85f1b7121aab6a61decd (patch) | |
tree | 1c23a1e1db2676c27a99b6385f0580442b29f7a0 /src/maingui.cpp | |
parent | b0c696eaab501391512b08826c3c9a52023e2be7 (diff) | |
download | manaplus-f43e3aa48aeb561f5c7e85f1b7121aab6a61decd.tar.gz manaplus-f43e3aa48aeb561f5c7e85f1b7121aab6a61decd.tar.bz2 manaplus-f43e3aa48aeb561f5c7e85f1b7121aab6a61decd.tar.xz manaplus-f43e3aa48aeb561f5c7e85f1b7121aab6a61decd.zip |
switch: first commit
Diffstat (limited to 'src/maingui.cpp')
-rw-r--r-- | src/maingui.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/maingui.cpp b/src/maingui.cpp index 176c5cd6e..054db6b05 100644 --- a/src/maingui.cpp +++ b/src/maingui.cpp @@ -97,6 +97,29 @@ PRAGMA48(GCC diagnostic pop) #include "debug.h" +#ifdef __SWITCH__ +extern "C" { +#include <switch/runtime/devices/socket.h> +#include <switch/runtime/nxlink.h> +} +#include <unistd.h> +static int sock = -1; +void initNxLink() { + socketInitializeDefault(); + sock = nxlinkStdio(); + if (sock < 0) { + socketExit(); + } +} +void deinitNxLink() { + if (sock >= 0) { + close(sock); + socketExit(); + sock = -1; + } +} +#endif + char *selfName = nullptr; #ifndef UNITTESTS @@ -107,6 +130,9 @@ int main(int argc, char *argv[]) int mainGui(int argc, char *argv[]) #endif // ANDROID { +#ifdef __SWITCH__ + initNxLink(); +#endif #if defined(__MINGW32__) // load mingw crash handler. Won't fail if dll is not present. // may load libray from current dir, it may not same as program dir @@ -159,6 +185,10 @@ int mainGui(int argc, char *argv[]) IMG_Quit(); #endif // SDL_IMAGE_VERSION_ATLEAST(1, 2, 11) +#ifdef __SWITCH__ + deinitNxLink(); +#endif + return ret; } #else // UNITTESTS |