diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index cb05e55df..caf40448e 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -25,9 +25,6 @@ if((CMAKE_SYSTEM_NAME MATCHES "Windows") AND ("${CMAKE_CXX_COMPILER_ID}" MATCHES target_link_libraries(storm ${CLANG_RT_BUILTINS_LIBRARY}) endif() endif() -if (CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") - target_compile_definitions(storm PRIVATE -D_POSIX_C_SOURCE=200809L) -endif() #=================== ImGui =================== @@ -44,10 +41,6 @@ target_sources(ImGui ${IMGUI_DIR}/imgui.cpp ) -if (CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") - target_include_directories(ImGui PRIVATE ${DEVKITPRO}/portlibs/switch/include/) -endif() - target_sources(ImGui PRIVATE ${IMGUI_DIR}/backends/imgui_impl_opengl3.cpp diff --git a/extern/ImGui/backends/imgui_impl_glfw.cpp b/extern/ImGui/backends/imgui_impl_glfw.cpp index d5d3769ee..0833a3d25 100644 --- a/extern/ImGui/backends/imgui_impl_glfw.cpp +++ b/extern/ImGui/backends/imgui_impl_glfw.cpp @@ -109,7 +109,7 @@ #define GLFW_HAS_WINDOW_HOVERED (GLFW_VERSION_COMBINED >= 3300) // 3.3+ GLFW_HOVERED #define GLFW_HAS_WINDOW_ALPHA (GLFW_VERSION_COMBINED >= 3300) // 3.3+ glfwSetWindowOpacity #define GLFW_HAS_PER_MONITOR_DPI (GLFW_VERSION_COMBINED >= 3300) // 3.3+ glfwGetMonitorContentScale -#if defined(__EMSCRIPTEN__) || defined(__SWITCH__) // no Vulkan support in GLFW for Emscripten or homebrew Nintendo Switch +#if defined(__EMSCRIPTEN__) // no Vulkan support in GLFW for Emscripten #define GLFW_HAS_VULKAN (0) #else #define GLFW_HAS_VULKAN (GLFW_VERSION_COMBINED >= 3200) // 3.2+ glfwCreateWindowSurface diff --git a/extern/ImGui/imconfig.h b/extern/ImGui/imconfig.h index 394eb92ef..e09dff036 100644 --- a/extern/ImGui/imconfig.h +++ b/extern/ImGui/imconfig.h @@ -127,14 +127,3 @@ namespace ImGui void MyFunction(const char* name, MyMatrix44* mtx); } */ - -#ifdef __SWITCH__ -#define IMGUI_IMPL_OPENGL_LOADER_CUSTOM -#define GL_GLEXT_PROTOTYPES 1 -#include - -#define ImGuiKey_NavGamepadActivate ImGuiKey_GamepadFaceRight -#define ImGuiKey_NavGamepadCancel ImGuiKey_GamepadFaceDown -#define ImGuiKey_NavGamepadMenu ImGuiKey_GamepadFaceUp -#define ImGuiKey_NavGamepadInput ImGuiKey_GamepadFaceLeft -#endif diff --git a/include/libultraship/classes.h b/include/libultraship/classes.h index c940a4226..7b75f8241 100644 --- a/include/libultraship/classes.h +++ b/include/libultraship/classes.h @@ -38,8 +38,5 @@ #ifdef __APPLE__ #include "utils/AppleFolderManager.h" #endif -#ifdef __SWITCH__ -#include "port/switch/SwitchImpl.h" -#endif #endif #endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2577bf1d4..b3ce2ded5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -111,13 +111,7 @@ target_sources(libultraship PRIVATE ${Source_Files__Utils__BinaryTools}) #=================== Port =================== -if (CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") - set(Source_Files__Port - ${CMAKE_CURRENT_SOURCE_DIR}/port/switch/SwitchImpl.h - ${CMAKE_CURRENT_SOURCE_DIR}/port/switch/SwitchImpl.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/port/switch/SwitchPerformanceProfiles.h - ) -elseif (CMAKE_SYSTEM_NAME STREQUAL "Android" OR CMAKE_SYSTEM_NAME STREQUAL "iOS") +if (CMAKE_SYSTEM_NAME STREQUAL "Android" OR CMAKE_SYSTEM_NAME STREQUAL "iOS") set(Source_Files__Port ${CMAKE_CURRENT_SOURCE_DIR}/port/mobile/MobileImpl.h ${CMAKE_CURRENT_SOURCE_DIR}/port/mobile/MobileImpl.cpp @@ -179,7 +173,7 @@ target_include_directories(libultraship #=================== Linking =================== -if (NOT CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") +if (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") target_link_libraries(libultraship PUBLIC "$") else() target_link_libraries(libultraship PUBLIC storm) @@ -201,7 +195,7 @@ target_link_libraries(libultraship PRIVATE libzip::zip) find_package(nlohmann_json REQUIRED) target_link_libraries(libultraship PUBLIC nlohmann_json::nlohmann_json) -if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") +if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) target_link_libraries(libultraship PRIVATE Threads::Threads) diff --git a/src/Context.cpp b/src/Context.cpp index 3abfc9663..124e4b958 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -13,8 +13,6 @@ #ifdef __APPLE__ #include "utils/AppleFolderManager.h" -#elif defined(__SWITCH__) -#include "port/switch/SwitchImpl.h" #endif namespace Ship { @@ -200,22 +198,15 @@ void Context::InitResourceManager(const std::vector& otrFiles, } if (!GetResourceManager()->DidLoadSuccessfully()) { -#if defined(__SWITCH__) - printf("Main OTR file not found!\n"); -#else SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "OTR file not found", "Main OTR file not found. Please generate one", nullptr); SPDLOG_ERROR("Main OTR file not found!"); #ifdef __IOS__ // We need this exit to close the app when we dismiss the dialog exit(0); -#endif #endif return; } -#ifdef __SWITCH__ - Ship::Switch::Init(PostInitPhase); -#endif } void Context::InitControlDeck(std::vector additionalBitmasks) { diff --git a/src/controller/controldevice/controller/mapping/factories/RumbleMappingFactory.cpp b/src/controller/controldevice/controller/mapping/factories/RumbleMappingFactory.cpp index f405b49d0..2f7524eb8 100644 --- a/src/controller/controldevice/controller/mapping/factories/RumbleMappingFactory.cpp +++ b/src/controller/controldevice/controller/mapping/factories/RumbleMappingFactory.cpp @@ -82,11 +82,8 @@ std::shared_ptr RumbleMappingFactory::CreateRumbleMappi } auto controller = SDL_GameControllerOpen(sdlIndex); -#ifdef __SWITCH__ - bool hasRumble = false; -#else bool hasRumble = SDL_GameControllerHasRumble(controller); -#endif + if (hasRumble) { sdlControllersWithRumble[lusIndex] = SDL_GameControllerOpen(sdlIndex); } else { diff --git a/src/controller/controldevice/controller/mapping/sdl/SDLMapping.cpp b/src/controller/controldevice/controller/mapping/sdl/SDLMapping.cpp index a0e6e242a..2c4d719d6 100644 --- a/src/controller/controldevice/controller/mapping/sdl/SDLMapping.cpp +++ b/src/controller/controldevice/controller/mapping/sdl/SDLMapping.cpp @@ -94,12 +94,8 @@ bool SDLMapping::UsesPlaystationLayout() { } bool SDLMapping::UsesSwitchLayout() { -#ifdef __SWITCH__ - return true; -#else auto type = GetSDLControllerType(); return type == SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO || type == SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR; -#endif } bool SDLMapping::UsesXboxLayout() { diff --git a/src/graphic/Fast3D/gfx_opengl.cpp b/src/graphic/Fast3D/gfx_opengl.cpp index f4cf0e89a..ff7ce06f4 100644 --- a/src/graphic/Fast3D/gfx_opengl.cpp +++ b/src/graphic/Fast3D/gfx_opengl.cpp @@ -31,9 +31,6 @@ #elif __APPLE__ #include #include -#elif __SWITCH__ -#include -#include #elif USE_OPENGLES #include #include @@ -752,7 +749,7 @@ static void gfx_opengl_upload_texture(const uint8_t* rgba32_buf, uint32_t width, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgba32_buf); } -#if defined(__SWITCH__) || defined(USE_OPENGLES) +#ifdef USE_OPENGLES #define GL_MIRROR_CLAMP_TO_EDGE 0x8743 #endif @@ -847,7 +844,7 @@ static void gfx_opengl_draw_triangles(float buf_vbo[], size_t buf_vbo_len, size_ } static void gfx_opengl_init(void) { -#if !defined(__SWITCH__) && !defined(__linux__) +#ifndef __linux__ glewInit(); #endif diff --git a/src/graphic/Fast3D/gfx_sdl2.cpp b/src/graphic/Fast3D/gfx_sdl2.cpp index 4de8ff9d7..3ba0411f2 100644 --- a/src/graphic/Fast3D/gfx_sdl2.cpp +++ b/src/graphic/Fast3D/gfx_sdl2.cpp @@ -1,12 +1,6 @@ #include -#ifndef __SWITCH__ #include "libultraship/libultraship.h" -#else -// including libultraship.h on switch leads to conflicting typedefs for u64 and s64 -// so we need to just include classes.h instead here -#include "libultraship/classes.h" -#endif #if defined(ENABLE_OPENGL) || defined(__APPLE__) @@ -24,11 +18,6 @@ #elif __APPLE__ #include #include "gfx_metal.h" -#elif __SWITCH__ -#include -#include -#include -#include "port/switch/SwitchImpl.h" #else #include #define GL_GLEXT_PROTOTYPES 1 @@ -333,10 +322,6 @@ static void gfx_sdl_init(const char* game_name, const char* gfx_api_name, bool s SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); -#elif defined(__SWITCH__) - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); #endif #ifdef _WIN32 @@ -351,13 +336,6 @@ static void gfx_sdl_init(const char* game_name, const char* gfx_api_name, bool s char title[512]; int len = sprintf(title, "%s (%s)", game_name, gfx_api_name); -#ifdef __SWITCH__ - // For Switch we need to set the window width before creating the window - Ship::Switch::GetDisplaySize(&window_width, &window_height); - width = window_width; - height = window_height; -#endif - #ifdef __IOS__ Uint32 flags = SDL_WINDOW_BORDERLESS | SDL_WINDOW_SHOWN; #else @@ -389,22 +367,14 @@ static void gfx_sdl_init(const char* game_name, const char* gfx_api_name, bool s } if (use_opengl) { -#ifndef __SWITCH__ SDL_GL_GetDrawableSize(wnd, &window_width, &window_height); if (start_in_fullscreen) { set_fullscreen(true, false); } -#endif ctx = SDL_GL_CreateContext(wnd); -#ifdef __SWITCH__ - if (!gladLoadGLLoader(SDL_GL_GetProcAddress)) { - printf("Failed to initialize glad\n"); - } -#endif - SDL_GL_MakeCurrent(wnd, ctx); SDL_GL_SetSwapInterval(vsync_enabled ? 1 : 0); @@ -468,16 +438,9 @@ static void gfx_sdl_set_keyboard_callbacks(bool (*on_key_down)(int scancode), bo } static void gfx_sdl_main_loop(void (*run_one_game_iter)(void)) { -#ifdef __SWITCH__ - while (Ship::Switch::IsRunning()) { -#else while (is_running) { -#endif run_one_game_iter(); } -#ifdef __SWITCH__ - Ship::Switch::Exit(); -#endif SDL_DestroyRenderer(renderer); SDL_Quit(); @@ -535,11 +498,7 @@ static void gfx_sdl_handle_single_event(SDL_Event& event) { #endif case SDL_WINDOWEVENT: if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { -#ifdef __SWITCH__ - Ship::Switch::GetDisplaySize(&window_width, &window_height); -#else SDL_GL_GetDrawableSize(wnd, &window_width, &window_height); -#endif } else if (event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(wnd)) { // We listen specifically for main window close because closing main window // on macOS does not trigger SDL_Quit. diff --git a/src/port/switch/SwitchImpl.cpp b/src/port/switch/SwitchImpl.cpp deleted file mode 100644 index 69d118369..000000000 --- a/src/port/switch/SwitchImpl.cpp +++ /dev/null @@ -1,228 +0,0 @@ -#ifdef __SWITCH__ -#include "SwitchImpl.h" -#include -#include -#include "SwitchPerformanceProfiles.h" -#include "public/bridge/consolevariablebridge.h" -#include -#include "Context.h" -#include "audio/Audio.h" - -#include - -#define DOCKED_MODE 1 -#define HANDHELD_MODE 0 - -static AppletHookCookie applet_hook_cookie; -static bool isRunning = true; -static bool hasFocus = true; -static bool isShowingVirtualKeyboard = true; - -void DetectAppletMode(); - -static void on_applet_hook(AppletHookType hook, void* param); - -void Ship::Switch::Init(SwitchPhase phase) { - switch (phase) { - case PreInitPhase: - DetectAppletMode(); - break; - case PostInitPhase: - appletInitializeGamePlayRecording(); -#ifdef DEBUG - socketInitializeDefault(); - nxlinkStdio(); -#endif - appletSetGamePlayRecordingState(true); - appletHook(&applet_hook_cookie, on_applet_hook, NULL); - appletSetFocusHandlingMode(AppletFocusHandlingMode_NoSuspend); - if (!hosversionBefore(8, 0, 0)) { - clkrstInitialize(); - } - break; - } -} - -void Ship::Switch::Exit() { -#ifdef DEBUG - socketExit(); -#endif - clkrstExit(); - appletSetGamePlayRecordingState(false); -} - -void Ship::Switch::ImGuiSetupFont(ImFontAtlas* fonts) { - plInitialize(PlServiceType_User); - static PlFontData stdFontData, extFontData; - - PlFontData fonts_std; - PlFontData fonts_ext; - - plGetSharedFontByType(&fonts_std, PlSharedFontType_Standard); - plGetSharedFontByType(&fonts_ext, PlSharedFontType_NintendoExt); - - ImFontConfig config; - config.FontDataOwnedByAtlas = false; - - strcpy(config.Name, "Nintendo Standard"); - fonts->AddFontFromMemoryTTF(fonts_std.address, fonts_std.size, 24.0f, &config, fonts->GetGlyphRangesCyrillic()); - - strcpy(config.Name, "Nintendo Ext"); - static const ImWchar ranges[] = { - 0xE000, 0xE06B, 0xE070, 0xE07E, 0xE080, 0xE099, 0xE0A0, 0xE0BA, 0xE0C0, 0xE0D6, 0xE0E0, 0xE0F5, 0xE100, - 0xE105, 0xE110, 0xE116, 0xE121, 0xE12C, 0xE130, 0xE13C, 0xE140, 0xE14D, 0xE150, 0xE153, 0, - }; - - fonts->AddFontFromMemoryTTF(fonts_ext.address, fonts_ext.size, 24.0f, &config, ranges); - fonts->Build(); - - plExit(); -} - -void Ship::Switch::ImGuiProcessEvent(bool wantsTextInput) { - ImGuiInputTextState* state = ImGui::GetInputTextState(ImGui::GetActiveID()); - - if (wantsTextInput) { - if (!isShowingVirtualKeyboard) { - state->ClearText(); - - isShowingVirtualKeyboard = true; - SDL_StartTextInput(); - } - } else { - if (isShowingVirtualKeyboard) { - isShowingVirtualKeyboard = false; - SDL_StopTextInput(); - } - } -} - -bool Ship::Switch::IsRunning() { - return isRunning; -} - -void Ship::Switch::GetDisplaySize(int* width, int* height) { - switch (appletGetOperationMode()) { - case DOCKED_MODE: - *width = 1920; - *height = 1080; - break; - case HANDHELD_MODE: - *width = 1280; - *height = 720; - break; - } -} - -void Ship::Switch::ApplyOverclock(void) { - SwitchProfiles perfMode = (SwitchProfiles)CVarGetInteger("gSwitchPerfMode", (int)Ship::MAXIMUM); - - if (perfMode >= 0 && perfMode <= Ship::POWERSAVINGM3) { - if (hosversionBefore(8, 0, 0)) { - pcvSetClockRate(PcvModule_CpuBus, SWITCH_CPU_SPEEDS_VALUES[perfMode]); - } else { - ClkrstSession session = { 0 }; - clkrstOpenSession(&session, PcvModuleId_CpuBus, 3); - clkrstSetClockRate(&session, SWITCH_CPU_SPEEDS_VALUES[perfMode]); - clkrstCloseSession(&session); - } - } -} - -void Ship::Switch::PrintErrorMessageToScreen(const char* str, ...) { - consoleInit(NULL); - srand(time(0)); - - va_list args; - va_start(args, str); - vprintf(str, args); - va_end(args); - - while (appletMainLoop()) { - consoleUpdate(NULL); - } - - consoleExit(NULL); -} - -static void on_applet_hook(AppletHookType hook, void* param) { - AppletFocusState focus_state; - - /* Exit request */ - switch (hook) { - case AppletHookType_OnExitRequest: - isRunning = false; - break; - - /* Focus state*/ - case AppletHookType_OnFocusState: - focus_state = appletGetFocusState(); - hasFocus = focus_state == AppletFocusState_InFocus; - - if (!hasFocus) { - if (hosversionBefore(8, 0, 0)) { - pcvSetClockRate(PcvModule_CpuBus, SWITCH_CPU_SPEEDS_VALUES[Ship::STOCK]); - } else { - ClkrstSession session = { 0 }; - clkrstOpenSession(&session, PcvModuleId_CpuBus, 3); - clkrstSetClockRate(&session, SWITCH_CPU_SPEEDS_VALUES[Ship::STOCK]); - clkrstCloseSession(&session); - } - } else { - Ship::Switch::ApplyOverclock(); - // reinitialize audio subsystem to fix audio problems after resuming from sleep - // see https://github.com/HarbourMasters/Shipwright/issues/3317 - SPDLOG_INFO("restarting SDL audio system to work around audio problems on resume"); - Ship::Context::GetInstance()->GetAudio()->SetAudioBackend(Ship::AudioBackend::SDL); - } - - break; - - /* Performance mode */ - case AppletHookType_OnPerformanceMode: - Ship::Switch::ApplyOverclock(); - break; - default: - break; - } -} - -const char* RandomTexts[] = { - "Psst, don't forget to blame Melon", - "Potsanity when?", - "Why are you acting so random?", - "Enough! My ship sails in the morning", - "Do you want 2 or 7 of those?", - "Lamp oil, rope, bombs you want it, it's yours my friend as long as you have enough rupees", - "You can build it yourself", - "Descargar para android", - "Made with <3 by the Harbour Masters!", - "They say that Kenix is not a developer", - "Squadala we're off", - "They say one once saw an equals not get set equals", - "This is the port all true gamers dock at" - "Enhancements? Times Savers? Cheats? You want them? They're yours my friend!", - "They say you gotta have the BIIIIG salad", - "They say Louis stopped working on the imports so he can focus on the exports", - "They say ZAPD is good software", -}; - -void DetectAppletMode() { - AppletType at = appletGetAppletType(); - if (at == AppletType_Application || at == AppletType_SystemApplication) - return; - - Ship::Switch::PrintErrorMessageToScreen("\x1b[2;2HYou've launched the Ship while in Applet mode." - "\x1b[4;2HPlease relaunch while in full-memory mode." - "\x1b[5;2HHold R when opening any game to enter HBMenu." - "\x1b[44;2H%s.", - RandomTexts[rand() % 25]); -} - -void Ship::Switch::ThrowMissingOTR(std::string OTRPath) { - Ship::Switch::PrintErrorMessageToScreen("\x1b[2;2HYou've launched the Ship without the OTR file." - "\x1b[4;2HPlease relaunch making sure %s exists." - "\x1b[44;2H%s.", - OTRPath.c_str(), RandomTexts[rand() % 25]); -} -#endif diff --git a/src/port/switch/SwitchImpl.h b/src/port/switch/SwitchImpl.h deleted file mode 100644 index 650642770..000000000 --- a/src/port/switch/SwitchImpl.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include -#include - -#ifndef IMGUI_DEFINE_MATH_OPERATORS -#define IMGUI_DEFINE_MATH_OPERATORS -#endif -#include -#include "SwitchPerformanceProfiles.h" - -namespace Ship { -enum SwitchProfiles { MAXIMUM, HIGH, BOOST, STOCK, POWERSAVINGM1, POWERSAVINGM2, POWERSAVINGM3 }; - -enum SwitchPhase { PreInitPhase, PostInitPhase }; - -class Switch { - public: - static void Init(SwitchPhase phase); - static void Exit(); - static void ImGuiSetupFont(ImFontAtlas* fonts); - static void ImGuiProcessEvent(bool wantsTextInput); - static bool IsRunning(); - static void GetDisplaySize(int* width, int* height); - static void ApplyOverclock(); - static void ThrowMissingOTR(std::string OTRPath); - static void PrintErrorMessageToScreen(const char* str, ...); -}; -}; // namespace Ship \ No newline at end of file diff --git a/src/port/switch/SwitchPerformanceProfiles.h b/src/port/switch/SwitchPerformanceProfiles.h deleted file mode 100644 index 44ec3c841..000000000 --- a/src/port/switch/SwitchPerformanceProfiles.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -static const char* SWITCH_CPU_PROFILES[] = { - "Maximum Performance", "High Performance", "Boost Performance", "Stock Performance", - "Powersaving Mode 1", "Powersaving Mode 2", "Powersaving Mode 3", -}; - -static unsigned SWITCH_CPU_SPEEDS_VALUES[] = { 1785000000, 1581000000, 1224000000, 1020000000, - 918000000, 816000000, 714000000 }; \ No newline at end of file diff --git a/src/public/libultra/os.cpp b/src/public/libultra/os.cpp index 6e7ebee22..679bd48b4 100644 --- a/src/public/libultra/os.cpp +++ b/src/public/libultra/os.cpp @@ -18,7 +18,6 @@ int32_t osContInit(OSMesgQueue* mq, uint8_t* controllerBits, OSContStatus* statu exit(EXIT_FAILURE); } -#ifndef __SWITCH__ std::string controllerDb = Ship::Context::LocateFileAcrossAppDirs("gamecontrollerdb.txt"); int mappingsAdded = SDL_GameControllerAddMappingsFromFile(controllerDb.c_str()); if (mappingsAdded >= 0) { @@ -26,7 +25,6 @@ int32_t osContInit(OSMesgQueue* mq, uint8_t* controllerBits, OSContStatus* statu } else { SPDLOG_ERROR("Failed add SDL game controller mappings from \"{}\" ({})", controllerDb, SDL_GetError()); } -#endif Ship::Context::GetInstance()->GetControlDeck()->Init(controllerBits); diff --git a/src/resource/ResourceManager.cpp b/src/resource/ResourceManager.cpp index 0ab670e4a..cc40caa3d 100644 --- a/src/resource/ResourceManager.cpp +++ b/src/resource/ResourceManager.cpp @@ -19,12 +19,10 @@ void ResourceManager::Init(const std::vector& otrFiles, const std:: mResourceLoader = std::make_shared(); mArchiveManager = std::make_shared(); GetArchiveManager()->Init(otrFiles, validHashes); -#if defined(__SWITCH__) - size_t threadCount = 1; -#else + // the extra `- 1` is because we reserve an extra thread for spdlog size_t threadCount = std::max(1, (int32_t)(std::thread::hardware_concurrency() - reservedThreadCount - 1)); -#endif + mThreadPool = std::make_shared(threadCount); if (!DidLoadSuccessfully()) { diff --git a/src/window/Window.cpp b/src/window/Window.cpp index 680c62222..090f555e2 100644 --- a/src/window/Window.cpp +++ b/src/window/Window.cpp @@ -15,8 +15,6 @@ #ifdef __APPLE__ #include "utils/AppleFolderManager.h" -#elif defined(__SWITCH__) -#include "port/switch/SwitchImpl.h" #endif namespace Ship { @@ -259,10 +257,6 @@ std::shared_ptr Window::GetGui() { } bool Window::SupportsWindowedFullscreen() { -#ifdef __SWITCH__ - return false; -#endif - if (GetWindowBackend() == WindowBackend::SDL_OPENGL || GetWindowBackend() == WindowBackend::SDL_METAL) { return true; } diff --git a/src/window/gui/Gui.cpp b/src/window/gui/Gui.cpp index b611ba27e..6a71b2cfc 100644 --- a/src/window/gui/Gui.cpp +++ b/src/window/gui/Gui.cpp @@ -31,10 +31,6 @@ #include #endif -#ifdef __SWITCH__ -#include "port/switch/SwitchImpl.h" -#endif - #if defined(__ANDROID__) || defined(__IOS__) #include "port/mobile/MobileImpl.h" #endif @@ -104,10 +100,6 @@ void Gui::Init(GuiWindowInitData windowImpl) { mImGuiIo->Fonts->AddFontFromMemoryCompressedBase85TTF(fontawesome_compressed_data_base85, iconFontSize, &iconsConfig, sIconsRanges); -#ifdef __SWITCH__ - Ship::Switch::ImGuiSetupFont(mImGuiIo->Fonts); -#endif - #if defined(__ANDROID__) // Scale everything by 2 for Android ImGui::GetStyle().ScaleAllSizes(2.0f); @@ -141,16 +133,9 @@ void Gui::Init(GuiWindowInitData windowImpl) { ImGuiWMInit(); ImGuiBackendInit(); -#ifdef __SWITCH__ - ImGui::GetStyle().ScaleAllSizes(2); -#endif CVarClear("gNewFileDropped"); CVarClear("gDroppedFile"); - -#ifdef __SWITCH__ - Switch::ApplyOverclock(); -#endif } void Gui::ImGuiWMInit() { @@ -228,10 +213,6 @@ void Gui::LoadTextureFromRawImage(const std::string& name, const std::string& pa } bool Gui::SupportsViewports() { -#ifdef __SWITCH__ - return false; -#endif - switch (Context::GetInstance()->GetWindow()->GetWindowBackend()) { case WindowBackend::DX11: return true; @@ -253,9 +234,7 @@ void Gui::Update(WindowEvent event) { case WindowBackend::SDL_OPENGL: case WindowBackend::SDL_METAL: ImGui_ImplSDL2_ProcessEvent(static_cast(event.Sdl.Event)); -#ifdef __SWITCH__ - Ship::Switch::ImGuiProcessEvent(mImGuiIo->WantTextInput); -#elif defined(__ANDROID__) || defined(__IOS__) +#if defined(__ANDROID__) || defined(__IOS__) Ship::Mobile::ImGuiProcessEvent(mImGuiIo->WantTextInput); #endif break; diff --git a/src/window/gui/StatsWindow.cpp b/src/window/gui/StatsWindow.cpp index b318484fc..e356f18fd 100644 --- a/src/window/gui/StatsWindow.cpp +++ b/src/window/gui/StatsWindow.cpp @@ -26,8 +26,6 @@ void StatsWindow::DrawElement() { ImGui::Text("Platform: iOS"); #elif defined(__APPLE__) ImGui::Text("Platform: macOS"); -#elif defined(__SWITCH__) - ImGui::Text("Platform: Nintendo Switch"); #elif defined(__linux__) ImGui::Text("Platform: Linux"); #else