summaryrefslogtreecommitdiff
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
parent94162704b6ffe557b65d70faa4b82e082039f75e (diff)
downloadmanaverse-177077c6563245504e4aa443cce3bdba7c65db42.tar.gz
manaverse-177077c6563245504e4aa443cce3bdba7c65db42.tar.bz2
manaverse-177077c6563245504e4aa443cce3bdba7c65db42.tar.xz
manaverse-177077c6563245504e4aa443cce3bdba7c65db42.zip
switch: enable sound and keyboard button by default, disable joysticks for now
-rw-r--r--src/defaults.cpp10
-rw-r--r--src/input/joystick.cpp12
-rw-r--r--src/maingui.cpp22
3 files changed, 30 insertions, 14 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 794e5698c..b566c3206 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -153,7 +153,11 @@ void setConfigDefaults(Configuration &cfg)
AddDEF("showScreenButtons", false);
AddDEF("showBeingPopup", true);
AddDEF("mouseDirectionMove", false);
+#ifdef __SWITCH__
+ AddDEF("showScreenKeyboard", true);
+#else
AddDEF("showScreenKeyboard", false);
+#endif
AddDEF("fpslimit", 60);
AddDEF("showChatColorsList", true);
AddDEF("customcursor", true);
@@ -165,7 +169,11 @@ void setConfigDefaults(Configuration &cfg)
AddDEF("showEmotesButton", true);
AddDEF("screen", false);
AddDEF("hwaccel", false);
+#ifdef __SWITCH__
+ AddDEF("sound", true);
+#else
AddDEF("sound", false);
+#endif
AddDEF("sfxVolume", 100);
AddDEF("musicVolume", 60);
AddDEF("remember", false);
@@ -177,7 +185,7 @@ void setConfigDefaults(Configuration &cfg)
AddDEF("useScreenshotDirectorySuffix", true);
AddDEF("screenshotDirectorySuffix", "");
#ifdef __SWITCH__
- AddDEF("joystickEnabled", true);
+ AddDEF("joystickEnabled", false);
#else
AddDEF("joystickEnabled", false);
#endif
diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp
index 34f2619b9..814affa46 100644
--- a/src/input/joystick.cpp
+++ b/src/input/joystick.cpp
@@ -178,12 +178,14 @@ bool Joystick::open()
mButtonsNumber = MAX_BUTTONS;
#ifdef __SWITCH__
+ /*
config.setValue("joystick" + toString(mNumber) + "calibrated", true);
- config.setValue("leftTolerance" + toString(mNumber), 100);
- config.setValue("rightTolerance" + toString(mNumber), 100);
- config.setValue("upTolerance" + toString(mNumber), 100);
- config.setValue("downTolerance" + toString(mNumber), 100);
- config.setValue("useInactiveJoystick", true);
+ config.setValue("leftTolerance" + toString(mNumber), 1000);
+ config.setValue("rightTolerance" + toString(mNumber), 1000);
+ config.setValue("upTolerance" + toString(mNumber), 1000);
+ config.setValue("downTolerance" + toString(mNumber), 1000);
+ //config.setValue("useInactiveJoystick", true);
+ */
#endif
mCalibrated = config.getValueBool("joystick"
+ toString(mNumber) + "calibrated", false);
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;