Support for Nintendo Switch (#4491)

* WIP support for Nintendo Switch

* OpenAL is usable

* Remove some debug code, add manual crash when DEBUG_NXLINK is on

* Remove more debug logs

* Support touch, account name detection, language detection. Remove resolution settings

* Stylistic changes

* SFXManager: update on main thread

* Add build script, remove crypto.hpp changes, disable opengl recorder on switch

* make: use sudo where needed, libs=>lib, portlib=>portlibs

* make: build harfbuzz with freetype

* main: remove DEBUG_NXLINK

* socket_address: this comment is no longer relevant

* Fix indentation in SDL, remove extra debug logs from InputManager

* InputManager: make log debug, not info

* CMakeLists: add mbedtls include dirs on switch

* main: deinitialize stuff

* main_loop: fix format
This commit is contained in:
Mary
2021-03-03 20:23:23 -05:00
committed by GitHub
parent d1e73f550d
commit d9b8b7acad
29 changed files with 528 additions and 32 deletions

View File

@@ -61,6 +61,22 @@
#include <unistd.h>
#endif
#ifdef __SWITCH__
extern "C" {
#define Event libnx_Event
#define u64 uint64_t
#define u32 uint32_t
#define s64 int64_t
#define s32 int32_t
#include <switch/services/applet.h>
#undef Event
#undef u64
#undef u32
#undef s64
#undef s32
}
#endif
MainLoop* main_loop = 0;
#ifdef WIN32
@@ -427,6 +443,14 @@ void MainLoop::run()
while (!m_abort)
{
#ifdef __SWITCH__
// This feeds us messages (like when the Switch sleeps or requests an exit)
m_abort = !appletMainLoop();
if (m_abort)
{
Log::info("MainLoop", "Aborting main loop because Switch told us to!");
}
#endif
#ifdef WIN32
if (parent != 0 && parent != INVALID_HANDLE_VALUE)
{
@@ -446,7 +470,7 @@ void MainLoop::run()
m_request_abort = true;
}
}
#else
#elif !defined( __SWITCH__ )
// POSIX equivalent
if (m_parent_pid != 0 && getppid() != (int)m_parent_pid)
{