summaryrefslogtreecommitdiff
path: root/src/maingui.cpp
diff options
context:
space:
mode:
authorcpasjuste <cpasjuste@gmail.com>2020-04-23 09:56:49 +0200
committercpasjuste <cpasjuste@gmail.com>2020-04-23 09:56:49 +0200
commit177077c6563245504e4aa443cce3bdba7c65db42 (patch)
treea2ce14abef48e684b2a52f7da6661449a113c6bb /src/maingui.cpp
parent94162704b6ffe557b65d70faa4b82e082039f75e (diff)
downloadmv-177077c6563245504e4aa443cce3bdba7c65db42.tar.gz
mv-177077c6563245504e4aa443cce3bdba7c65db42.tar.bz2
mv-177077c6563245504e4aa443cce3bdba7c65db42.tar.xz
mv-177077c6563245504e4aa443cce3bdba7c65db42.zip
switch: enable sound and keyboard button by default, disable joysticks for now
Diffstat (limited to 'src/maingui.cpp')
-rw-r--r--src/maingui.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/maingui.cpp b/src/maingui.cpp
index be25ded1d..f10c0efe7 100644
--- a/src/maingui.cpp
+++ b/src/maingui.cpp
@@ -97,26 +97,32 @@ PRAGMA48(GCC diagnostic pop)
#include "debug.h"
-#if defined(__SWITCH__) && !defined(NDEBUG)
+#ifdef __SWITCH__
extern "C" {
#include <switch/runtime/devices/socket.h>
#include <switch/runtime/nxlink.h>
}
+#ifndef NDEBUG
#include <unistd.h>
static int sock = -1;
-void initNxLink() {
+#endif
+void nxInit() {
socketInitializeDefault();
+#ifndef NDEBUG
sock = nxlinkStdio();
if (sock < 0) {
socketExit();
}
+#endif
}
-void deinitNxLink() {
+void NxDeinit() {
+#ifndef NDEBUG
if (sock >= 0) {
close(sock);
- socketExit();
sock = -1;
}
+#endif
+ socketExit();
}
#endif
@@ -130,8 +136,8 @@ int main(int argc, char *argv[])
int mainGui(int argc, char *argv[])
#endif // ANDROID
{
-#if defined(__SWITCH__) && !defined(NDEBUG)
- initNxLink();
+#ifdef __SWITCH__
+ nxInit();
#endif
#if defined(__MINGW32__)
// load mingw crash handler. Won't fail if dll is not present.
@@ -185,8 +191,8 @@ int mainGui(int argc, char *argv[])
IMG_Quit();
#endif // SDL_IMAGE_VERSION_ATLEAST(1, 2, 11)
-#if defined(__SWITCH__) && !defined(NDEBUG)
- deinitNxLink();
+#ifdef __SWITCH__
+ NxDeinit();
#endif
return ret;