[Scummvm-git-logs] scummvm master -> 90d9540ad82eed80a0f85047308ecfdb7bd0700a

aquadran aquadran at gmail.com
Mon Oct 26 20:01:15 UTC 2020


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
90d9540ad8 SWITCH: Add support for 3d games (#2558)


Commit: 90d9540ad82eed80a0f85047308ecfdb7bd0700a
    https://github.com/scummvm/scummvm/commit/90d9540ad82eed80a0f85047308ecfdb7bd0700a
Author: Matthieu Milan (usineur0 at gmail.com)
Date: 2020-10-26T21:01:12+01:00

Commit Message:
SWITCH: Add support for 3d games (#2558)

SWITCH: Add support for 3d games

Changed paths:
    backends/events/switchsdl/switchsdl-events.cpp
    backends/platform/sdl/sdl.cpp
    backends/platform/sdl/switch/switch.cpp
    backends/platform/sdl/switch/switch.mk
    configure


diff --git a/backends/events/switchsdl/switchsdl-events.cpp b/backends/events/switchsdl/switchsdl-events.cpp
index 6bab141ad8..b3cee1820b 100644
--- a/backends/events/switchsdl/switchsdl-events.cpp
+++ b/backends/events/switchsdl/switchsdl-events.cpp
@@ -220,8 +220,15 @@ void SwitchEventSource::preprocessFingerMotion(SDL_Event *event) {
 	if (numFingersDown >= 1) {
 		int x = _mouseX;
 		int y = _mouseY;
-		int xMax = dynamic_cast<WindowedGraphicsManager *>(_graphicsManager)->getWindowWidth() - 1;
-		int yMax = dynamic_cast<WindowedGraphicsManager *>(_graphicsManager)->getWindowHeight() - 1;
+		int xMax;
+		int yMax;
+		if (dynamic_cast<SdlGraphics3dManager *>(_graphicsManager)) {
+			xMax = dynamic_cast<SdlGraphics3dManager *>(_graphicsManager)->getOverlayWidth() - 1;
+			yMax = dynamic_cast<SdlGraphics3dManager *>(_graphicsManager)->getOverlayHeight() - 1;
+		} else {
+			xMax = dynamic_cast<WindowedGraphicsManager *>(_graphicsManager)->getWindowWidth() - 1;
+			yMax = dynamic_cast<WindowedGraphicsManager *>(_graphicsManager)->getWindowHeight() - 1;
+		}
 
 		if (port == 0 && !ConfMan.getBool("touchpad_mouse_mode")) {
 			convertTouchXYToGameXY(event->tfinger.x, event->tfinger.y, &x, &y);
@@ -353,8 +360,15 @@ void SwitchEventSource::preprocessFingerMotion(SDL_Event *event) {
 }
 
 void SwitchEventSource::convertTouchXYToGameXY(float touchX, float touchY, int *gameX, int *gameY) {
-	int screenH = dynamic_cast<WindowedGraphicsManager *>(_graphicsManager)->getWindowHeight();
-	int screenW = dynamic_cast<WindowedGraphicsManager *>(_graphicsManager)->getWindowWidth();
+	int screenH, screenW;
+
+	if (dynamic_cast<SdlGraphics3dManager *>(_graphicsManager)) {
+		screenH = dynamic_cast<SdlGraphics3dManager *>(_graphicsManager)->getOverlayHeight();
+		screenW = dynamic_cast<SdlGraphics3dManager *>(_graphicsManager)->getOverlayWidth();
+	} else {
+		screenH = dynamic_cast<WindowedGraphicsManager *>(_graphicsManager)->getWindowHeight();
+		screenW = dynamic_cast<WindowedGraphicsManager *>(_graphicsManager)->getWindowWidth();
+	}
 
 	const int dispW = TOUCHSCREEN_WIDTH;
 	const int dispH = TOUCHSCREEN_HEIGHT;
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index c2a34f9b09..170d1daa80 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -338,6 +338,7 @@ void OSystem_SDL::detectFramebufferSupport() {
 }
 
 void OSystem_SDL::detectAntiAliasingSupport() {
+#ifndef NINTENDO_SWITCH
 	_capabilities.openGLAntiAliasLevels.clear();
 
 	int requestedSamples = 2;
@@ -380,6 +381,7 @@ void OSystem_SDL::detectAntiAliasingSupport() {
 
 	SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
 	SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
+#endif
 }
 
 #endif // defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS)
diff --git a/backends/platform/sdl/switch/switch.cpp b/backends/platform/sdl/switch/switch.cpp
index 240d5178de..d67a8288ad 100644
--- a/backends/platform/sdl/switch/switch.cpp
+++ b/backends/platform/sdl/switch/switch.cpp
@@ -39,6 +39,7 @@ static const Common::HardwareInputTableEntry switchJoystickButtons[] = {
     { "JOY_Y",              Common::JOYSTICK_BUTTON_Y,              _s("X")           },
     { "JOY_BACK",           Common::JOYSTICK_BUTTON_BACK,           _s("Minus")       },
     { "JOY_START",          Common::JOYSTICK_BUTTON_START,          _s("Plus")        },
+    { "JOY_GUIDE",          Common::JOYSTICK_BUTTON_START,          _s("Plus")        },
     { "JOY_LEFT_STICK",     Common::JOYSTICK_BUTTON_LEFT_STICK,     _s("L3")          },
     { "JOY_RIGHT_STICK",    Common::JOYSTICK_BUTTON_RIGHT_STICK,    _s("R3")          },
     { "JOY_LEFT_SHOULDER",  Common::JOYSTICK_BUTTON_LEFT_SHOULDER,  _s("L")           },
diff --git a/backends/platform/sdl/switch/switch.mk b/backends/platform/sdl/switch/switch.mk
index 358ad501c6..e43db7d7c9 100644
--- a/backends/platform/sdl/switch/switch.mk
+++ b/backends/platform/sdl/switch/switch.mk
@@ -15,6 +15,10 @@ ifdef DIST_FILES_NETWORKING
 endif
 ifdef DIST_FILES_VKEYBD
 	cp $(DIST_FILES_VKEYBD) ./switch_release/scummvm/data
+endif
+ifdef DIST_FILES_SHADERS
+	mkdir -p ./switch_release/scummvm/data/shaders
+	cp $(DIST_FILES_SHADERS) ./switch_release/scummvm/data/shaders
 endif
 	cp $(DIST_FILES_DOCS) ./switch_release/scummvm/doc/
 	cp $(srcdir)/backends/platform/sdl/switch/README.SWITCH ./switch_release/scummvm/doc/
diff --git a/configure b/configure
index 9ff7607678..f7c8c4979f 100755
--- a/configure
+++ b/configure
@@ -3630,6 +3630,7 @@ if test -n "$_host"; then
 			# This might be related to a known crash on OpenGL de-init due
 			# to the OpenGL implementation on this platform.
 			_opengl_mode=gles2
+			_opengl_game_es2=yes
 			_vkeybd=yes
 			_port_mk="backends/platform/sdl/switch/switch.mk"
 			;;
@@ -5391,7 +5392,7 @@ echocheck "OpenGL for game"
 
 if test "$_opengl_game" = auto ; then
 	_opengl_game=no
-	if (test "$_backend" = "sdl" && test "$_opengl" = yes) || test "$_backend" = "android3d"; then
+	if (test "$_backend" = "sdl" && test "$_opengl" = yes) || test "$_backend" = "android3d" || test "$_backend" = "switch"; then
 		# Try different header filenames
 		# 1) GL/gl.h         This is usually used on POSIX and Windows systems
 		# 2) OpenGL/gl.h     This is used on Mac OS X




More information about the Scummvm-git-logs mailing list