Kaynağa Gözat

Remove switch support

Clément Wolf 3 hafta önce
ebeveyn
işleme
4ad10055de

+ 22 - 58
src/App/Osu/Osu.cpp

@@ -243,25 +243,6 @@ Osu::Osu(int instanceID) {
 
     osu_resolution.setValue(UString::format("%ix%i", engine->getScreenWidth(), engine->getScreenHeight()));
 
-    // OS specific engine settings/overrides
-    if(env->getOS() == Environment::OS::OS_HORIZON) {
-        convar->getConVarByName("fps_max")->setValue(60.0f);
-        convar->getConVarByName("ui_scrollview_resistance")->setValue(25.0f);
-        convar->getConVarByName("osu_scores_legacy_enabled")->setValue(0.0f);       // would collide
-        convar->getConVarByName("osu_collections_legacy_enabled")->setValue(0.0f);  // unnecessary
-        convar->getConVarByName("osu_mod_mafham_render_livesize")->setValue(7.0f);
-        convar->getConVarByName("osu_mod_mafham_render_chunksize")->setValue(12.0f);
-        convar->getConVarByName("osu_mod_touchdevice")->setDefaultFloat(1.0f);
-        convar->getConVarByName("osu_mod_touchdevice")->setValue(1.0f);
-        convar->getConVarByName("osu_key_quick_retry")->setValue(15.0f);            // L, SDL_SCANCODE_L
-        convar->getConVarByName("osu_key_seek_time")->setValue(21.0f);              // R, SDL_SCANCODE_R
-        convar->getConVarByName("osu_key_decrease_local_offset")->setValue(29.0f);  // ZL, SDL_SCANCODE_Z
-        convar->getConVarByName("osu_key_increase_local_offset")->setValue(25.0f);  // ZR, SDL_SCANCODE_V
-        convar->getConVarByName("osu_key_left_click")->setValue(0.0f);              // (disabled)
-        convar->getConVarByName("osu_key_right_click")->setValue(0.0f);             // (disabled)
-        convar->getConVarByName("name")->setValue(env->getUsername());
-    }
-
     env->setWindowResizable(false);
 
     // generate default osu! appdata user path
@@ -555,10 +536,9 @@ void Osu::draw(Graphics *g) {
         return;
     }
 
-    // if we are not using the native window resolution, or in vr mode, or playing on a nintendo switch, or multiple
-    // instances are active, draw into the buffer
-    const bool isBufferedDraw =
-        osu_resolution_enabled.getBool() || env->getOS() == Environment::OS::OS_HORIZON || m_iInstanceID > 0;
+    // if we are not using the native window resolution, or in vr mode, or multiple instances are active,
+    // draw into the buffer
+    const bool isBufferedDraw = osu_resolution_enabled.getBool() || m_iInstanceID > 0;
 
     if(isBufferedDraw) m_backBuffer->enable();
 
@@ -737,42 +717,26 @@ void Osu::draw(Graphics *g) {
         }
 
         g->setBlending(false);
-        {
-            if(env->getOS() == Environment::OS::OS_HORIZON) {
-                // NOTE: the nintendo switch always draws in 1080p, even undocked
-                const Vector2 backupResolution = engine->getGraphics()->getResolution();
-                g->onResolutionChange(Vector2(1920, 1080));
-                {
-                    // NOTE: apparently, after testing with libnx 3.0.0, it now requires half 720p offset when undocked?
-                    if(backupResolution.y < 722) offset.y = 720 / 2;
-
-                    m_backBuffer->draw(g, offset.x * (1.0f + osu_letterboxing_offset_x.getFloat()),
-                                       offset.y * (1.0f + osu_letterboxing_offset_y.getFloat()),
-                                       g_vInternalResolution.x, g_vInternalResolution.y);
-                }
-                g->onResolutionChange(backupResolution);
+        if(osu_letterboxing.getBool()) {
+            m_backBuffer->draw(g, offset.x * (1.0f + osu_letterboxing_offset_x.getFloat()),
+                               offset.y * (1.0f + osu_letterboxing_offset_y.getFloat()), g_vInternalResolution.x,
+                               g_vInternalResolution.y);
+        } else {
+            if(osu_resolution_keep_aspect_ratio.getBool()) {
+                const float scale =
+                    getImageScaleToFitResolution(m_backBuffer->getSize(), engine->getGraphics()->getResolution());
+                const float scaledWidth = m_backBuffer->getWidth() * scale;
+                const float scaledHeight = m_backBuffer->getHeight() * scale;
+                m_backBuffer->draw(
+                    g,
+                    std::max(0.0f, engine->getGraphics()->getResolution().x / 2.0f - scaledWidth / 2.0f) *
+                        (1.0f + osu_letterboxing_offset_x.getFloat()),
+                    std::max(0.0f, engine->getGraphics()->getResolution().y / 2.0f - scaledHeight / 2.0f) *
+                        (1.0f + osu_letterboxing_offset_y.getFloat()),
+                    scaledWidth, scaledHeight);
             } else {
-                if(osu_letterboxing.getBool())
-                    m_backBuffer->draw(g, offset.x * (1.0f + osu_letterboxing_offset_x.getFloat()),
-                                       offset.y * (1.0f + osu_letterboxing_offset_y.getFloat()),
-                                       g_vInternalResolution.x, g_vInternalResolution.y);
-                else {
-                    if(osu_resolution_keep_aspect_ratio.getBool()) {
-                        const float scale = getImageScaleToFitResolution(m_backBuffer->getSize(),
-                                                                         engine->getGraphics()->getResolution());
-                        const float scaledWidth = m_backBuffer->getWidth() * scale;
-                        const float scaledHeight = m_backBuffer->getHeight() * scale;
-                        m_backBuffer->draw(
-                            g,
-                            std::max(0.0f, engine->getGraphics()->getResolution().x / 2.0f - scaledWidth / 2.0f) *
-                                (1.0f + osu_letterboxing_offset_x.getFloat()),
-                            std::max(0.0f, engine->getGraphics()->getResolution().y / 2.0f - scaledHeight / 2.0f) *
-                                (1.0f + osu_letterboxing_offset_y.getFloat()),
-                            scaledWidth, scaledHeight);
-                    } else
-                        m_backBuffer->draw(g, 0, 0, engine->getGraphics()->getResolution().x,
-                                           engine->getGraphics()->getResolution().y);
-                }
+                m_backBuffer->draw(g, 0, 0, engine->getGraphics()->getResolution().x,
+                                   engine->getGraphics()->getResolution().y);
             }
         }
         g->setBlending(true);

+ 1 - 0
src/App/Osu/OsuChangelog.cpp

@@ -52,6 +52,7 @@ OsuChangelog::OsuChangelog(Osu *osu) : OsuScreenBackable(osu) {
     latest.changes.push_back("- Fixed restarting SoundEngine not kicking the player out of play mode");
     latest.changes.push_back("- Fixed ALT key not working on linux");
     latest.changes.push_back("- Disabled score submission when mods are toggled mid-game");
+    latest.changes.push_back("- Removed support for the Nintendo Switch");
     latest.changes.push_back("- Updated protocol version");
     changelogs.push_back(latest);
 

+ 0 - 4
src/App/Osu/OsuDatabase.cpp

@@ -32,10 +32,6 @@ ConVar osu_folder("osu_folder", "C:/Program Files (x86)/osu!/", FCVAR_NONE);
 
 ConVar osu_folder("osu_folder", "/osu!/", FCVAR_NONE);
 
-#elif defined __SWITCH__
-
-ConVar osu_folder("osu_folder", "sdmc:/switch/McOsu/", FCVAR_NONE);
-
 #else
 
 ConVar osu_folder("osu_folder", "", FCVAR_NONE);

+ 2 - 4
src/App/Osu/OsuHUD.cpp

@@ -268,8 +268,6 @@ OsuHUD::OsuHUD(Osu *osu) : OsuScreen(osu) {
     m_tempFont = engine->getResourceManager()->getFont("FONT_DEFAULT");
     m_cursorTrailShader = engine->getResourceManager()->loadShader("cursortrail.vsh", "cursortrail.fsh", "cursortrail");
     m_cursorTrail.reserve(osu_cursor_trail_max_size.getInt() * 2);
-    if(env->getOS() == Environment::OS::OS_HORIZON) m_cursorTrail2.reserve(osu_cursor_trail_max_size.getInt() * 2);
-
     m_cursorTrailVAO = engine->getResourceManager()->createVertexArrayObject(Graphics::PRIMITIVE::PRIMITIVE_QUADS,
                                                                              Graphics::USAGE_TYPE::USAGE_DYNAMIC);
 
@@ -798,9 +796,9 @@ void OsuHUD::drawFps(Graphics *g, McFont *font, float fps) {
     g->popTransform();
 
     // top
-    if(fps >= 200 || (env->getOS() == Environment::OS::OS_HORIZON && fps >= 50))
+    if(fps >= 200)
         g->setColor(0xffffffff);
-    else if(fps >= 120 || (env->getOS() == Environment::OS::OS_HORIZON && fps >= 40))
+    else if(fps >= 120)
         g->setColor(0xffdddd00);
     else {
         const float pulse = std::abs(std::sin(engine->getTime() * 4));

+ 0 - 3
src/App/Osu/OsuMainMenu.cpp

@@ -15,7 +15,6 @@
 #include "Downloader.h"
 #include "Engine.h"
 #include "File.h"
-#include "HorizonSDLEnvironment.h"
 #include "Keyboard.h"
 #include "Mouse.h"
 #include "Osu.h"
@@ -155,8 +154,6 @@ ConVar *OsuMainMenu::m_osu_mod_random_ref = NULL;
 ConVar *OsuMainMenu::m_osu_songbrowser_background_fade_in_duration_ref = NULL;
 
 OsuMainMenu::OsuMainMenu(Osu *osu) : OsuScreen(osu) {
-    if(env->getOS() == Environment::OS::OS_HORIZON) NEOSU_MAIN_BUTTON_TEXT.append(" NX");
-
     if(m_osu_universal_offset_ref == NULL) m_osu_universal_offset_ref = convar->getConVarByName("osu_universal_offset");
     if(m_osu_universal_offset_hardcoded_ref == NULL)
         m_osu_universal_offset_hardcoded_ref = convar->getConVarByName("osu_universal_offset_hardcoded");

+ 9 - 20
src/App/Osu/OsuModSelector.cpp

@@ -207,18 +207,15 @@ OsuModSelector::OsuModSelector(Osu *osu) : OsuScreen(osu) {
     m_ARLock = overrideAR.lock;
     m_ODLock = overrideOD.lock;
 
-    if(env->getOS() != Environment::OS::OS_HORIZON) {
-        OVERRIDE_SLIDER overrideSpeed =
-            addOverrideSlider("Speed/BPM Multiplier", "x", convar->getConVarByName("osu_speed_override"), 0.0f, 2.5f);
+    OVERRIDE_SLIDER overrideSpeed =
+        addOverrideSlider("Speed/BPM Multiplier", "x", convar->getConVarByName("osu_speed_override"), 0.0f, 2.5f);
 
-        overrideSpeed.slider->setChangeCallback(
-            fastdelegate::MakeDelegate(this, &OsuModSelector::onOverrideSliderChange));
-        // overrideSpeed.slider->setValue(-1.0f, false);
-        overrideSpeed.slider->setAnimated(false);  // same quick fix as above
-        overrideSpeed.slider->setLiveUpdate(false);
+    overrideSpeed.slider->setChangeCallback(fastdelegate::MakeDelegate(this, &OsuModSelector::onOverrideSliderChange));
+    // overrideSpeed.slider->setValue(-1.0f, false);
+    overrideSpeed.slider->setAnimated(false);  // same quick fix as above
+    overrideSpeed.slider->setLiveUpdate(false);
 
-        m_speedSlider = overrideSpeed.slider;
-    }
+    m_speedSlider = overrideSpeed.slider;
 
     // build experimental buttons
     addExperimentalLabel(" Experimental Mods (!)");
@@ -236,11 +233,8 @@ OsuModSelector::OsuModSelector(Osu *osu) : OsuScreen(osu) {
                             "Customize the approach circle animation.\nSee osu_mod_approach_different_style.\nSee "
                             "osu_mod_approach_different_initial_size.",
                             convar->getConVarByName("osu_mod_approach_different"));
-
-    if(env->getOS() != Environment::OS::OS_HORIZON)
-        addExperimentalCheckbox("Timewarp", "Speed increases from 100% to 150% over the course of the beatmap.",
-                                convar->getConVarByName("osu_mod_timewarp"));
-
+    addExperimentalCheckbox("Timewarp", "Speed increases from 100% to 150% over the course of the beatmap.",
+                            convar->getConVarByName("osu_mod_timewarp"));
     addExperimentalCheckbox("AR Timewarp", "Approach rate decreases from 100% to 50% over the course of the beatmap.",
                             convar->getConVarByName("osu_mod_artimewarp"));
     addExperimentalCheckbox("Minimize", "Circle size decreases from 100% to 50% over the course of the beatmap.",
@@ -400,11 +394,6 @@ void OsuModSelector::updateButtons(bool initial) {
     getModButtonOnGrid(4, 0)->setAvailable(true);
     getModButtonOnGrid(5, 2)->setAvailable(true);
 
-    if(env->getOS() == Environment::OS::OS_HORIZON) {
-        getModButtonOnGrid(2, 1)->setAvailable(false);
-        getModButtonOnGrid(2, 0)->setAvailable(false);
-    }
-
     if(bancho.is_in_a_multi_room()) {
         if(bancho.room.freemods && !bancho.room.is_host()) {
             getModButtonOnGrid(2, 0)->setAvailable(false);  // Disable DC/HT

+ 72 - 118
src/App/Osu/OsuOptionsMenu.cpp

@@ -567,16 +567,13 @@ OsuOptionsMenu::OsuOptionsMenu(Osu *osu) : OsuScreenBackable(osu) {
     addCheckbox("Use osu!.db database (read-only)",
                 "If you have an existing osu! installation,\nthen this will speed up the initial loading process.",
                 convar->getConVarByName("osu_database_enabled"));
-    if(env->getOS() != Environment::OS::OS_HORIZON)
-        addCheckbox(
-            "Load osu! collection.db (read-only)",
-            "If you have an existing osu! installation,\nalso load and display your created collections from there.",
-            convar->getConVarByName("osu_collections_legacy_enabled"));
-    if(env->getOS() != Environment::OS::OS_HORIZON)
-        addCheckbox(
-            "Load osu! scores.db (read-only)",
-            "If you have an existing osu! installation,\nalso load and display your achieved scores from there.",
-            convar->getConVarByName("osu_scores_legacy_enabled"));
+    addCheckbox(
+        "Load osu! collection.db (read-only)",
+        "If you have an existing osu! installation,\nalso load and display your created collections from there.",
+        convar->getConVarByName("osu_collections_legacy_enabled"));
+    addCheckbox("Load osu! scores.db (read-only)",
+                "If you have an existing osu! installation,\nalso load and display your achieved scores from there.",
+                convar->getConVarByName("osu_scores_legacy_enabled"));
 
     addSpacer();
     addCheckbox("Include Relax/Autopilot for total weighted pp/acc",
@@ -622,48 +619,45 @@ OsuOptionsMenu::OsuOptionsMenu(Osu *osu) : OsuScreenBackable(osu) {
                     convar->getConVarByName("win_processpriority"));
 
     addCheckbox("Show FPS Counter", convar->getConVarByName("osu_draw_fps"));
-    if(env->getOS() != Environment::OS::OS_HORIZON) {
-        addSpacer();
-
-        addCheckbox("Unlimited FPS", convar->getConVarByName("fps_unlimited"));
-
-        CBaseUISlider *fpsSlider =
-            addSlider("FPS Limiter:", 60.0f, 1000.0f, convar->getConVarByName("fps_max"), -1.0f, true);
-        fpsSlider->setChangeCallback(fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onSliderChangeInt));
-        fpsSlider->setKeyDelta(1);
-
-        addSubSection("Layout");
-        OPTIONS_ELEMENT resolutionSelect =
-            addButton("Select Resolution", UString::format("%ix%i", m_osu->getScreenWidth(), m_osu->getScreenHeight()));
-        m_resolutionSelectButton = (CBaseUIButton *)resolutionSelect.elements[0];
-        m_resolutionSelectButton->setClickCallback(
-            fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onResolutionSelect));
-        m_resolutionLabel = (CBaseUILabel *)resolutionSelect.elements[1];
-        m_fullscreenCheckbox = addCheckbox("Fullscreen");
-        m_fullscreenCheckbox->setChangeCallback(fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onFullscreenChange));
-        addCheckbox("Borderless",
-                    "May cause extra input lag if enabled.\nDepends on your operating system version/updates.",
-                    convar->getConVarByName("fullscreen_windowed_borderless"))
-            ->setChangeCallback(fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onBorderlessWindowedChange));
-        addCheckbox("Keep Aspect Ratio",
-                    "Black borders instead of a stretched image.\nOnly relevant if fullscreen is enabled, and "
-                    "letterboxing is disabled.\nUse the two position sliders below to move the viewport around.",
-                    convar->getConVarByName("osu_resolution_keep_aspect_ratio"));
-        addCheckbox("Letterboxing",
-                    "Useful to get the low latency of fullscreen with a smaller game resolution.\nUse the two position "
-                    "sliders below to move the viewport around.",
-                    convar->getConVarByName("osu_letterboxing"));
-        m_letterboxingOffsetXSlider =
-            addSlider("Horizontal position", -1.0f, 1.0f, convar->getConVarByName("osu_letterboxing_offset_x"), 170)
-                ->setChangeCallback(fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onSliderChangeLetterboxingOffset))
-                ->setKeyDelta(0.01f)
-                ->setAnimated(false);
-        m_letterboxingOffsetYSlider =
-            addSlider("Vertical position", -1.0f, 1.0f, convar->getConVarByName("osu_letterboxing_offset_y"), 170)
-                ->setChangeCallback(fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onSliderChangeLetterboxingOffset))
-                ->setKeyDelta(0.01f)
-                ->setAnimated(false);
-    }
+    addSpacer();
+
+    addCheckbox("Unlimited FPS", convar->getConVarByName("fps_unlimited"));
+
+    CBaseUISlider *fpsSlider =
+        addSlider("FPS Limiter:", 60.0f, 1000.0f, convar->getConVarByName("fps_max"), -1.0f, true);
+    fpsSlider->setChangeCallback(fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onSliderChangeInt));
+    fpsSlider->setKeyDelta(1);
+
+    addSubSection("Layout");
+    OPTIONS_ELEMENT resolutionSelect =
+        addButton("Select Resolution", UString::format("%ix%i", m_osu->getScreenWidth(), m_osu->getScreenHeight()));
+    m_resolutionSelectButton = (CBaseUIButton *)resolutionSelect.elements[0];
+    m_resolutionSelectButton->setClickCallback(fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onResolutionSelect));
+    m_resolutionLabel = (CBaseUILabel *)resolutionSelect.elements[1];
+    m_fullscreenCheckbox = addCheckbox("Fullscreen");
+    m_fullscreenCheckbox->setChangeCallback(fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onFullscreenChange));
+    addCheckbox("Borderless",
+                "May cause extra input lag if enabled.\nDepends on your operating system version/updates.",
+                convar->getConVarByName("fullscreen_windowed_borderless"))
+        ->setChangeCallback(fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onBorderlessWindowedChange));
+    addCheckbox("Keep Aspect Ratio",
+                "Black borders instead of a stretched image.\nOnly relevant if fullscreen is enabled, and "
+                "letterboxing is disabled.\nUse the two position sliders below to move the viewport around.",
+                convar->getConVarByName("osu_resolution_keep_aspect_ratio"));
+    addCheckbox("Letterboxing",
+                "Useful to get the low latency of fullscreen with a smaller game resolution.\nUse the two position "
+                "sliders below to move the viewport around.",
+                convar->getConVarByName("osu_letterboxing"));
+    m_letterboxingOffsetXSlider =
+        addSlider("Horizontal position", -1.0f, 1.0f, convar->getConVarByName("osu_letterboxing_offset_x"), 170)
+            ->setChangeCallback(fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onSliderChangeLetterboxingOffset))
+            ->setKeyDelta(0.01f)
+            ->setAnimated(false);
+    m_letterboxingOffsetYSlider =
+        addSlider("Vertical position", -1.0f, 1.0f, convar->getConVarByName("osu_letterboxing_offset_y"), 170)
+            ->setChangeCallback(fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onSliderChangeLetterboxingOffset))
+            ->setKeyDelta(0.01f)
+            ->setAnimated(false);
 
     addSubSection("UI Scaling");
     addCheckbox(
@@ -697,29 +691,24 @@ OsuOptionsMenu::OsuOptionsMenu(Osu *osu) : OsuScreenBackable(osu) {
                 "performance a tiny bit, since there will be less to draw overall.",
                 convar->getConVarByName("osu_slider_shrink"));
     addSpacer();
-    if(env->getOS() != Environment::OS::OS_HORIZON) {
-        addCheckbox("Legacy Slider Renderer (!)",
-                    "WARNING: Only try enabling this on shitty old computers!\nMay or may not improve fps while few "
-                    "sliders are visible.\nGuaranteed lower fps while many sliders are visible!",
-                    convar->getConVarByName("osu_force_legacy_slider_renderer"));
-        addCheckbox("Higher Quality Sliders (!)", "Disable this if your fps drop too low while sliders are visible.",
-                    convar->getConVarByName("osu_options_high_quality_sliders"))
-            ->setChangeCallback(fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onHighQualitySlidersCheckboxChange));
-        m_sliderQualitySlider =
-            addSlider("Slider Quality", 0.0f, 1.0f, convar->getConVarByName("osu_options_slider_quality"));
-        m_sliderQualitySlider->setChangeCallback(
-            fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onSliderChangeSliderQuality));
-    }
+    addCheckbox("Legacy Slider Renderer (!)",
+                "WARNING: Only try enabling this on shitty old computers!\nMay or may not improve fps while few "
+                "sliders are visible.\nGuaranteed lower fps while many sliders are visible!",
+                convar->getConVarByName("osu_force_legacy_slider_renderer"));
+    addCheckbox("Higher Quality Sliders (!)", "Disable this if your fps drop too low while sliders are visible.",
+                convar->getConVarByName("osu_options_high_quality_sliders"))
+        ->setChangeCallback(fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onHighQualitySlidersCheckboxChange));
+    m_sliderQualitySlider =
+        addSlider("Slider Quality", 0.0f, 1.0f, convar->getConVarByName("osu_options_slider_quality"));
+    m_sliderQualitySlider->setChangeCallback(
+        fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onSliderChangeSliderQuality));
 
     //**************************************************************************************************************************//
 
     CBaseUIElement *sectionAudio = addSection("Audio");
 
     addSubSection("Devices");
-    if(env->getOS() == Environment::OS::OS_HORIZON) {
-        addButton("Restart SoundEngine (fix crackling)")
-            ->setClickCallback(fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onOutputDeviceRestart));
-    } else {
+    {
         OPTIONS_ELEMENT outputDeviceSelect = addButton("Select Output Device", "Default", true);
         m_outputDeviceResetButton = outputDeviceSelect.resetButton;
         m_outputDeviceResetButton->setClickCallback(
@@ -820,12 +809,10 @@ OsuOptionsMenu::OsuOptionsMenu(Osu *osu) : OsuScreenBackable(osu) {
     offsetSlider->setChangeCallback(fastdelegate::MakeDelegate(this, &OsuOptionsMenu::onSliderChangeIntMS));
     offsetSlider->setKeyDelta(1);
 
-    if(env->getOS() != Environment::OS::OS_HORIZON) {
-        addSubSection("Songbrowser");
-        addCheckbox("Apply speed/pitch mods while browsing",
-                    "Whether to always apply all mods, or keep the preview music normal.",
-                    convar->getConVarByName("osu_beatmap_preview_mods_live"));
-    }
+    addSubSection("Songbrowser");
+    addCheckbox("Apply speed/pitch mods while browsing",
+                "Whether to always apply all mods, or keep the preview music normal.",
+                convar->getConVarByName("osu_beatmap_preview_mods_live"));
 
     addSubSection("Gameplay");
     addCheckbox("Prefer Nightcore over Double Time",
@@ -924,15 +911,8 @@ OsuOptionsMenu::OsuOptionsMenu(Osu *osu) : OsuScreenBackable(osu) {
     CBaseUIElement *sectionInput = addSection("Input");
 
     addSubSection("Mouse", "scroll");
-    if(env->getOS() == Environment::OS::OS_WINDOWS || env->getOS() == Environment::OS::OS_MACOS ||
-       env->getOS() == Environment::OS::OS_HORIZON) {
-        addSlider("Sensitivity:", (env->getOS() == Environment::OS::OS_HORIZON ? 1.0f : 0.1f), 6.0f,
-                  convar->getConVarByName("mouse_sensitivity"))
-            ->setKeyDelta(0.01f);
-
-        if(env->getOS() == Environment::OS::OS_HORIZON)
-            addSlider("Joystick S.:", 0.1f, 6.0f, convar->getConVarByName("sdl_joystick_mouse_sensitivity"))
-                ->setKeyDelta(0.01f);
+    if(env->getOS() == Environment::OS::OS_WINDOWS || env->getOS() == Environment::OS::OS_MACOS) {
+        addSlider("Sensitivity:", 0.1f, 6.0f, convar->getConVarByName("mouse_sensitivity"))->setKeyDelta(0.01f);
 
         if(env->getOS() == Environment::OS::OS_MACOS) {
             addLabel("");
@@ -960,11 +940,9 @@ OsuOptionsMenu::OsuOptionsMenu(Osu *osu) : OsuScreenBackable(osu) {
         addLabel("Use xinput or xsetwacom to change the tablet area.")->setTextColor(0xff555555);
         addLabel("");
     }
-    if(env->getOS() != Environment::OS::OS_HORIZON) {
-        addCheckbox("Confine Cursor (Windowed)", convar->getConVarByName("osu_confine_cursor_windowed"));
-        addCheckbox("Confine Cursor (Fullscreen)", convar->getConVarByName("osu_confine_cursor_fullscreen"));
-        addCheckbox("Disable Mouse Wheel in Play Mode", convar->getConVarByName("osu_disable_mousewheel"));
-    }
+    addCheckbox("Confine Cursor (Windowed)", convar->getConVarByName("osu_confine_cursor_windowed"));
+    addCheckbox("Confine Cursor (Fullscreen)", convar->getConVarByName("osu_confine_cursor_fullscreen"));
+    addCheckbox("Disable Mouse Wheel in Play Mode", convar->getConVarByName("osu_disable_mousewheel"));
     addCheckbox("Disable Mouse Buttons in Play Mode", convar->getConVarByName("osu_disable_mousebuttons"));
     addCheckbox("Cursor ripples", "The cursor will ripple outwards on clicking.",
                 convar->getConVarByName("osu_draw_cursor_ripples"));
@@ -1338,11 +1316,6 @@ OsuOptionsMenu::OsuOptionsMenu(Osu *osu) : OsuScreenBackable(osu) {
                     "WARNING: Do NOT enable this if you are using a mouse!\nIf this is enabled, then DPI and cm per "
                     "360 will be ignored!",
                     convar->getConVarByName("fposu_absolute_mode"));
-    } else if(env->getOS() == Environment::OS::OS_LINUX) {
-        addSubSection("[Beta] FPoSu 4D Mode - Mouse");
-        addSlider("Sensitivity:", (env->getOS() == Environment::OS::OS_HORIZON ? 1.0f : 0.1f), 6.0f,
-                  convar->getConVarByName("mouse_sensitivity"))
-            ->setKeyDelta(0.01f);
     }
 
     //**************************************************************************************************************************//
@@ -1368,13 +1341,11 @@ OsuOptionsMenu::OsuOptionsMenu(Osu *osu) : OsuScreenBackable(osu) {
     logInButton->setColor(0xff00ff00);
     logInButton->setTextColor(0xffffffff);
 
-    if(env->getOS() != Environment::OS::OS_HORIZON) {
-        addSubSection("Integration");
-        addCheckbox("Rich Presence (Discord + Steam)",
-                    "Shows your current game state in your friends' friendslists.\ne.g.: Playing Gavin G - Reach Out "
-                    "[Cherry Blossom's Insane]",
-                    convar->getConVarByName("osu_rich_presence"));
-    }
+    addSubSection("Integration");
+    addCheckbox("Rich Presence (Discord + Steam)",
+                "Shows your current game state in your friends' friendslists.\ne.g.: Playing Gavin G - Reach Out "
+                "[Cherry Blossom's Insane]",
+                convar->getConVarByName("osu_rich_presence"));
 
     //**************************************************************************************************************************//
 
@@ -2631,33 +2602,16 @@ void OsuOptionsMenu::onLogInClicked() {
 }
 
 void OsuOptionsMenu::onDownloadOsuClicked() {
-    if(env->getOS() == Environment::OS::OS_HORIZON) {
-        m_osu->getNotificationOverlay()->addNotification("Go to https://osu.ppy.sh/", 0xffffffff, false, 0.75f);
-        return;
-    }
-
     m_osu->getNotificationOverlay()->addNotification("Opening browser, please wait ...", 0xffffffff, false, 0.75f);
     env->openURLInDefaultBrowser("https://osu.ppy.sh/");
 }
 
 void OsuOptionsMenu::onManuallyManageBeatmapsClicked() {
-    if(env->getOS() == Environment::OS::OS_HORIZON) {
-        m_osu->getNotificationOverlay()->addNotification("Google \"How to use McOsu without osu!\"", 0xffffffff, false,
-                                                         0.75f);
-        return;
-    }
-
     m_osu->getNotificationOverlay()->addNotification("Opening browser, please wait ...", 0xffffffff, false, 0.75f);
     env->openURLInDefaultBrowser("https://steamcommunity.com/sharedfiles/filedetails/?id=880768265");
 }
 
 void OsuOptionsMenu::onCM360CalculatorLinkClicked() {
-    if(env->getOS() == Environment::OS::OS_HORIZON) {
-        m_osu->getNotificationOverlay()->addNotification("Go to https://www.mouse-sensitivity.com/", 0xffffffff, false,
-                                                         0.75f);
-        return;
-    }
-
     m_osu->getNotificationOverlay()->addNotification("Opening browser, please wait ...", 0xffffffff, false, 0.75f);
     env->openURLInDefaultBrowser("https://www.mouse-sensitivity.com/");
 }

+ 0 - 8
src/App/Osu/OsuPauseMenu.cpp

@@ -136,14 +136,6 @@ void OsuPauseMenu::mouse_update(bool *propagate_clicks) {
     }
 
     if(anim->isAnimating(&m_fWarningArrowsAnimX)) m_fWarningArrowsAnimStartTime = engine->getTime();
-
-    // HACKHACK: handle joystick mouse select, inject enter keydown
-    if(env->getOS() == Environment::OS::OS_HORIZON) {
-        if(engine->getMouse()->isLeftDown()) {
-            KeyboardEvent e(KEY_ENTER);
-            onKeyDown(e);
-        }
-    }
 }
 
 void OsuPauseMenu::onContinueClicked() {

+ 4 - 8
src/App/Osu/OsuSkin.cpp

@@ -429,8 +429,7 @@ void OsuSkin::load() {
     // skin ini
     randomizeFilePath();
     m_sSkinIniFilePath = m_sFilePath;
-    UString defaultSkinIniFilePath =
-        UString(env->getOS() == Environment::OS::OS_HORIZON ? "romfs:/materials/" : MCENGINE_DATA_DIR "/materials/");
+    UString defaultSkinIniFilePath = MCENGINE_DATA_DIR "/materials/";
     defaultSkinIniFilePath.append(OSUSKIN_DEFAULT_SKIN_PATH);
     defaultSkinIniFilePath.append("skin.ini");
     m_sSkinIniFilePath.append("skin.ini");
@@ -1304,15 +1303,13 @@ void OsuSkin::checkLoadImage(Image **addressOfPointer, std::string skinElementNa
     // NOTE: only the default skin is loaded with a resource name (it must never be unloaded by other instances), and it
     // is NOT added to the resources vector
 
-    std::string defaultFilePath1 =
-        env->getOS() == Environment::OS::OS_HORIZON ? "romfs:/materials/" : MCENGINE_DATA_DIR "/materials/";
+    std::string defaultFilePath1 = MCENGINE_DATA_DIR "/materials/";
     defaultFilePath1.append(OSUSKIN_DEFAULT_SKIN_PATH);
     defaultFilePath1.append(skinElementName);
     defaultFilePath1.append("@2x.");
     defaultFilePath1.append(fileExtension);
 
-    std::string defaultFilePath2 =
-        env->getOS() == Environment::OS::OS_HORIZON ? "romfs:/materials/" : MCENGINE_DATA_DIR "/materials/";
+    std::string defaultFilePath2 = MCENGINE_DATA_DIR "/materials/";
     defaultFilePath2.append(OSUSKIN_DEFAULT_SKIN_PATH);
     defaultFilePath2.append(skinElementName);
     defaultFilePath2.append(".");
@@ -1458,8 +1455,7 @@ void OsuSkin::checkLoadSound(Sound **addressOfPointer, std::string skinElementNa
     };
 
     // load default skin
-    std::string defaultpath =
-        env->getOS() == Environment::OS::OS_HORIZON ? "romfs:/materials/" : MCENGINE_DATA_DIR "./materials/";
+    std::string defaultpath = MCENGINE_DATA_DIR "./materials/";
     defaultpath.append(OSUSKIN_DEFAULT_SKIN_PATH);
     defaultpath.append(skinElementName);
     std::string defaultResourceName = resourceName;

+ 2 - 2
src/App/Osu/OsuSkinImage.cpp

@@ -105,12 +105,12 @@ bool OsuSkinImage::loadImage(std::string skinElementName, bool ignoreDefaultSkin
     filepath2.append(skinElementName);
     filepath2.append(".png");
 
-    std::string defaultFilePath1 = env->getOS() == Environment::OS::OS_HORIZON ? "romfs:/materials/" : "./materials/";
+    std::string defaultFilePath1 = "./materials/";
     defaultFilePath1.append(OsuSkin::OSUSKIN_DEFAULT_SKIN_PATH);
     defaultFilePath1.append(skinElementName);
     defaultFilePath1.append("@2x.png");
 
-    std::string defaultFilePath2 = env->getOS() == Environment::OS::OS_HORIZON ? "romfs:/materials/" : "./materials/";
+    std::string defaultFilePath2 = "./materials/";
     defaultFilePath2.append(OsuSkin::OSUSKIN_DEFAULT_SKIN_PATH);
     defaultFilePath2.append(skinElementName);
     defaultFilePath2.append(".png");

+ 2 - 6
src/App/Osu/OsuSongBrowser.cpp

@@ -568,9 +568,7 @@ OsuSongBrowser::OsuSongBrowser(Osu *osu) : OsuScreenBackable(osu) {
     m_scoreBrowser->setDrawFrame(false);
     m_scoreBrowser->setHorizontalScrolling(false);
     m_scoreBrowser->setScrollbarSizeMultiplier(0.25f);
-    m_scoreBrowser->setScrollResistance((env->getOS() == Environment::OS::OS_HORIZON)
-                                            ? convar->getConVarByName("ui_scrollview_resistance")->getInt()
-                                            : 15);  // a bit shitty this check + convar, but works well enough
+    m_scoreBrowser->setScrollResistance(15);
     m_scoreBrowserScoresStillLoadingElement = new OsuUISongBrowserScoresStillLoadingElement(m_osu, "Loading...");
     m_scoreBrowserNoRecordsYetElement = new OsuUISongBrowserNoRecordsSetElement(m_osu, "No records set!");
     m_scoreBrowser->getContainer()->addBaseUIElement(m_scoreBrowserNoRecordsYetElement);
@@ -589,9 +587,7 @@ OsuSongBrowser::OsuSongBrowser(Osu *osu) : OsuScreenBackable(osu) {
     m_songBrowser->setDrawBackground(false);
     m_songBrowser->setDrawFrame(false);
     m_songBrowser->setHorizontalScrolling(false);
-    m_songBrowser->setScrollResistance((env->getOS() == Environment::OS::OS_HORIZON)
-                                           ? convar->getConVarByName("ui_scrollview_resistance")->getInt()
-                                           : 15);  // a bit shitty this check + convar, but works well enough
+    m_songBrowser->setScrollResistance(15);
 
     // beatmap database
     m_db = new OsuDatabase(m_osu);

+ 1 - 4
src/App/Osu/OsuUISongBrowserCollectionButton.cpp

@@ -170,10 +170,7 @@ void OsuUISongBrowserCollectionButton::onContextMenu(UString text, int id) {
                 spacer->setTextColor(0xff888888);
                 spacer->setTextDarkColor(0xff000000);
 
-                label =
-                    m_contextMenu->addButton(env->getOS() == Environment::OS::OS_HORIZON ? "(Click HERE to confirm)"
-                                                                                         : "(Press ENTER to confirm.)",
-                                             id);
+                label = m_contextMenu->addButton("(Press ENTER to confirm.)", id);
                 label->setTextLeft(false);
                 label->setTextColor(0xff555555);
                 label->setTextDarkColor(0xff000000);

+ 1 - 3
src/App/Osu/OsuUISongBrowserSongButton.cpp

@@ -568,9 +568,7 @@ void OsuUISongBrowserSongButton::onAddToCollectionConfirmed(UString text, int id
             spacer->setTextColor(0xff888888);
             spacer->setTextDarkColor(0xff000000);
 
-            label = m_contextMenu->addButton(
-                env->getOS() == Environment::OS::OS_HORIZON ? "(Click HERE to confirm)" : "(Press ENTER to confirm.)",
-                id);
+            label = m_contextMenu->addButton("(Press ENTER to confirm.)", id);
             label->setTextLeft(false);
             label->setTextColor(0xff555555);
             label->setTextDarkColor(0xff000000);

+ 2 - 7
src/App/Osu/OsuUIUserContextMenu.cpp

@@ -108,13 +108,8 @@ void OsuUIUserContextMenuScreen::on_action(UString text, int user_action) {
         m_osu->m_chat->addChannel(user_info->name, true);
     } else if(user_action == VIEW_PROFILE) {
         auto url = UString::format("https://%s/u/%d", bancho.endpoint.toUtf8(), m_user_id);
-        if(env->getOS() == Environment::OS::OS_HORIZON) {
-            m_osu->getNotificationOverlay()->addNotification(url, 0xffffffff, false, 0.75f);
-        } else {
-            m_osu->getNotificationOverlay()->addNotification("Opening browser, please wait ...", 0xffffffff, false,
-                                                             0.75f);
-            env->openURLInDefaultBrowser(url.toUtf8());
-        }
+        m_osu->getNotificationOverlay()->addNotification("Opening browser, please wait ...", 0xffffffff, false, 0.75f);
+        env->openURLInDefaultBrowser(url.toUtf8());
     } else if(user_action == UA_ADD_FRIEND) {
         Packet packet;
         packet.id = FRIEND_ADD;

+ 0 - 4
src/App/Osu/OsuVolumeOverlay.cpp

@@ -34,10 +34,6 @@ OsuVolumeOverlay::OsuVolumeOverlay(Osu *osu) : OsuScreen(osu) {
     osu_volume_master_inactive = convar->getConVarByName("osu_volume_master_inactive");
     osu_volume_change_interval = convar->getConVarByName("osu_volume_change_interval");
 
-    if(env->getOS() == Environment::OS::OS_HORIZON) {
-        osu_volume_music->setValue(0.3f);
-    }
-
     m_fVolumeChangeTime = 0.0f;
     m_fVolumeChangeFade = 1.0f;
     m_fLastVolume = osu_volume_master->getFloat();

+ 1 - 1
src/Engine/Environment.h

@@ -19,7 +19,7 @@ class ContextMenu;
 
 class Environment {
    public:
-    enum class OS { OS_NULL, OS_WINDOWS, OS_LINUX, OS_MACOS, OS_HORIZON };
+    enum class OS { OS_NULL, OS_WINDOWS, OS_LINUX, OS_MACOS };
 
    public:
     Environment();

+ 0 - 1
src/Engine/Input/Mouse.cpp

@@ -139,7 +139,6 @@ void Mouse::update() {
     Vector2 nextPos = osMousePos;
 
     if(osCursorVisible || (!sensitivityAdjustmentNeeded && !mouse_raw_input.getBool()) || m_bAbsolute ||
-       env->getOS() == Environment::OS::OS_HORIZON ||
        env->getOS() == Environment::OS::OS_LINUX)  // HACKHACK: linux hack
     {
         // this block handles visible/active OS cursor movement without sensitivity adjustments, and absolute input

+ 0 - 89
src/Engine/Main/main_Horizon.cpp

@@ -1,89 +0,0 @@
-//================ Copyright (c) 2019, PG, All rights reserved. =================//
-//
-// Purpose:		main entry point (nintendo switch)
-//
-// $NoKeywords: $main
-//===============================================================================//
-
-#include "cbase.h"
-
-#ifdef __SWITCH__
-
-// #define MCENGINE_HORIZON_NXLINK
-
-#ifndef MCENGINE_FEATURE_SDL
-#error SDL2 is currently required for switch builds
-#endif
-
-#include <switch.h>
-#include <unistd.h>  // for close()
-
-#include "ConVar.h"
-#include "HorizonSDLEnvironment.h"
-
-static int s_nxlinkSock = -1;
-
-static void initNxLink() {
-    if(R_FAILED(socketInitializeDefault())) return;
-
-    s_nxlinkSock = nxlinkStdio();
-
-    if(s_nxlinkSock >= 0)
-        printf("printf output now goes to nxlink server");
-    else
-        socketExit();
-}
-
-static void deinitNxLink() {
-    if(s_nxlinkSock >= 0) {
-        close(s_nxlinkSock);
-        socketExit();
-        s_nxlinkSock = -1;
-    }
-}
-
-extern "C" void userAppInit() {
-#ifdef MCENGINE_HORIZON_NXLINK
-
-    initNxLink();
-
-#endif
-}
-
-extern "C" void userAppExit() {
-#ifdef MCENGINE_HORIZON_NXLINK
-
-    deinitNxLink();
-
-#endif
-}
-
-extern int mainSDL(int argc, char *argv[], SDLEnvironment *customSDLEnvironment);
-
-int main(int argc, char *argv[]) {
-    int ret = 0;
-
-    // TODO: user selection applet popup, somehow
-    /*
-    u128 userID;
-    accountGetPreselectedUser(&userID);
-    */
-
-    romfsInit();
-    {
-        appletSetScreenShotPermission(AppletScreenShotPermission_Enable);
-        appletSetFocusHandlingMode(
-            AppletFocusHandlingMode_SuspendHomeSleepNotify);  // TODO: seems broken? no notification is received when
-                                                              // going to sleep
-
-        // NOTE: yuzu emulator timing bug workaround (armGetSystemTick() is way too fast), uncomment for testing
-        // convar->getConVarByName("host_timescale")->setValue(0.018f);
-
-        ret = mainSDL(argc, argv, new HorizonSDLEnvironment());
-    }
-    romfsExit();
-
-    return ret;
-}
-
-#endif

+ 16 - 97
src/Engine/Main/main_SDL.cpp

@@ -19,7 +19,6 @@
 #include "ConVar.h"
 #include "ConsoleBox.h"
 #include "Engine.h"
-#include "HorizonSDLEnvironment.h"
 #include "Mouse.h"
 #include "Profiler.h"
 #include "SDL.h"
@@ -191,14 +190,6 @@ int mainSDL(int argc, char *argv[], SDLEnvironment *customSDLEnvironment) {
     while(g_bRunning) {
         VPROF_MAIN();
 
-        // HACKHACK: switch hack (usb mouse/keyboard support)
-#ifdef __SWITCH__
-
-        HorizonSDLEnvironment *horizonSDLenv = dynamic_cast<HorizonSDLEnvironment *>(environment);
-        if(horizonSDLenv != NULL) horizonSDLenv->update_before_winproc();
-
-#endif
-
         // handle window message queue
         {
             VPROF_BUDGET("SDL", VPROF_BUDGETGROUP_WNDPROC);
@@ -384,9 +375,7 @@ int mainSDL(int argc, char *argv[], SDLEnvironment *customSDLEnvironment) {
                         if(e.jbutton.button == 0)  // KEY_A
                         {
                             g_engine->onMouseLeftChange(true);
-                        } else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 10
-                                                                               : e.jbutton.button == 7) ||
-                                  e.jbutton.button == 1)  // KEY_PLUS/KEY_START || KEY_B
+                        } else if(e.jbutton.button == 7 || e.jbutton.button == 1)  // KEY_PLUS/KEY_START || KEY_B
                             g_engine->onKeyboardKeyDown(SDL_SCANCODE_ESCAPE);
                         else if(e.jbutton.button == 2)  // KEY_X
                         {
@@ -394,53 +383,20 @@ int mainSDL(int argc, char *argv[], SDLEnvironment *customSDLEnvironment) {
                             xDown = true;
                         } else if(e.jbutton.button == 3)  // KEY_Y
                             g_engine->onKeyboardKeyDown(SDL_SCANCODE_Y);
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 21 : false) ||
-                                (env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 13
-                                                                             : false))  // right stick up || dpad up
-                            g_engine->onKeyboardKeyDown(SDL_SCANCODE_UP);
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 23 : false) ||
-                                (env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 15
-                                                                             : false))  // right stick down || dpad down
-                            g_engine->onKeyboardKeyDown(SDL_SCANCODE_DOWN);
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 20 : false) ||
-                                (env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 12
-                                                                             : false))  // right stick left || dpad left
-                            g_engine->onKeyboardKeyDown(SDL_SCANCODE_LEFT);
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 22 : false) ||
-                                (env->getOS() == Environment::OS::OS_HORIZON
-                                     ? e.jbutton.button == 14
-                                     : false))  // right stick right || dpad right
-                            g_engine->onKeyboardKeyDown(SDL_SCANCODE_RIGHT);
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 6
-                                                                             : e.jbutton.button == 4))  // KEY_L
-                            g_engine->onKeyboardKeyDown((
-                                env->getOS() == Environment::OS::OS_HORIZON ? SDL_SCANCODE_L : SDL_SCANCODE_BACKSPACE));
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 7
-                                                                             : e.jbutton.button == 5))  // KEY_R
-                            g_engine->onKeyboardKeyDown(
-                                (env->getOS() == Environment::OS::OS_HORIZON ? SDL_SCANCODE_R : SDL_SCANCODE_LSHIFT));
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 8
-                                                                             : false))  // KEY_ZL
-                            g_engine->onKeyboardKeyDown(SDL_SCANCODE_Z);
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 9
-                                                                             : false))  // KEY_ZR
-                            g_engine->onKeyboardKeyDown(SDL_SCANCODE_V);
-                        else if((env->getOS() == Environment::OS::OS_HORIZON
-                                     ? e.jbutton.button == 11
-                                     : e.jbutton.button == 6))  // KEY_MINUS/KEY_SELECT
+                        else if(e.jbutton.button == 4)  // KEY_L
+                            g_engine->onKeyboardKeyDown(SDL_SCANCODE_BACKSPACE);
+                        else if(e.jbutton.button == 5)  // KEY_R
+                            g_engine->onKeyboardKeyDown(SDL_SCANCODE_LSHIFT);
+                        else if(e.jbutton.button == 6)  // KEY_MINUS/KEY_SELECT
                             g_engine->onKeyboardKeyDown(SDL_SCANCODE_F1);
-                        else if((env->getOS() == Environment::OS::OS_HORIZON
-                                     ? e.jbutton.button == 4
-                                     : e.jbutton.button == 8))  // left stick press
+                        else if(e.jbutton.button == 8)  // left stick press
                         {
                             // toggle options (CTRL + O)
                             g_engine->onKeyboardKeyDown(SDL_SCANCODE_LCTRL);
                             g_engine->onKeyboardKeyDown(SDL_SCANCODE_O);
                             g_engine->onKeyboardKeyUp(SDL_SCANCODE_LCTRL);
                             g_engine->onKeyboardKeyUp(SDL_SCANCODE_O);
-                        } else if((env->getOS() == Environment::OS::OS_HORIZON
-                                       ? e.jbutton.button == 5
-                                       : e.jbutton.button == 9))  // right stick press
+                        } else if(e.jbutton.button == 9)  // right stick press
                         {
                             if(xDown) {
                                 // toggle console
@@ -448,12 +404,6 @@ int mainSDL(int argc, char *argv[], SDLEnvironment *customSDLEnvironment) {
                                 g_engine->onKeyboardKeyDown(SDL_SCANCODE_F1);
                                 g_engine->onKeyboardKeyUp(SDL_SCANCODE_LSHIFT);
                                 g_engine->onKeyboardKeyUp(SDL_SCANCODE_F1);
-                            } else {
-#ifdef __SWITCH__
-
-                                ((HorizonSDLEnvironment *)environment)->showKeyboard();
-
-#endif
                             }
                         }
                         break;
@@ -461,9 +411,7 @@ int mainSDL(int argc, char *argv[], SDLEnvironment *customSDLEnvironment) {
                     case SDL_JOYBUTTONUP:
                         if(e.jbutton.button == 0)  // KEY_A
                             g_engine->onMouseLeftChange(false);
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 10
-                                                                             : e.jbutton.button == 7) ||
-                                e.jbutton.button == 1)  // KEY_PLUS/KEY_START || KEY_B
+                        else if(e.jbutton.button == 7 || e.jbutton.button == 1)  // KEY_PLUS/KEY_START || KEY_B
                             g_engine->onKeyboardKeyUp(SDL_SCANCODE_ESCAPE);
                         else if(e.jbutton.button == 2)  // KEY_X
                         {
@@ -471,40 +419,11 @@ int mainSDL(int argc, char *argv[], SDLEnvironment *customSDLEnvironment) {
                             xDown = false;
                         } else if(e.jbutton.button == 3)  // KEY_Y
                             g_engine->onKeyboardKeyUp(SDL_SCANCODE_Y);
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 21 : false) ||
-                                (env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 13
-                                                                             : false))  // right stick up || dpad up
-                            g_engine->onKeyboardKeyUp(SDL_SCANCODE_UP);
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 23 : false) ||
-                                (env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 15
-                                                                             : false))  // right stick down || dpad down
-                            g_engine->onKeyboardKeyUp(SDL_SCANCODE_DOWN);
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 20 : false) ||
-                                (env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 12
-                                                                             : false))  // right stick left || dpad left
-                            g_engine->onKeyboardKeyUp(SDL_SCANCODE_LEFT);
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 22 : false) ||
-                                (env->getOS() == Environment::OS::OS_HORIZON
-                                     ? e.jbutton.button == 14
-                                     : false))  // right stick right || dpad right
-                            g_engine->onKeyboardKeyUp(SDL_SCANCODE_RIGHT);
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 6
-                                                                             : e.jbutton.button == 4))  // KEY_L
-                            g_engine->onKeyboardKeyUp((
-                                env->getOS() == Environment::OS::OS_HORIZON ? SDL_SCANCODE_L : SDL_SCANCODE_BACKSPACE));
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 7
-                                                                             : e.jbutton.button == 5))  // KEY_R
-                            g_engine->onKeyboardKeyUp(
-                                (env->getOS() == Environment::OS::OS_HORIZON ? SDL_SCANCODE_R : SDL_SCANCODE_LSHIFT));
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 8
-                                                                             : false))  // KEY_ZL
-                            g_engine->onKeyboardKeyUp(SDL_SCANCODE_Z);
-                        else if((env->getOS() == Environment::OS::OS_HORIZON ? e.jbutton.button == 9
-                                                                             : false))  // KEY_ZR
-                            g_engine->onKeyboardKeyUp(SDL_SCANCODE_V);
-                        else if((env->getOS() == Environment::OS::OS_HORIZON
-                                     ? e.jbutton.button == 11
-                                     : e.jbutton.button == 6))  // KEY_MINUS/KEY_SELECT
+                        else if(e.jbutton.button == 4)  // KEY_L
+                            g_engine->onKeyboardKeyUp(SDL_SCANCODE_BACKSPACE);
+                        else if(e.jbutton.button == 5)  // KEY_R
+                            g_engine->onKeyboardKeyUp(SDL_SCANCODE_LSHIFT);
+                        else if(e.jbutton.button == 6)  // KEY_MINUS/KEY_SELECT
                             g_engine->onKeyboardKeyUp(SDL_SCANCODE_F1);
                         break;
 
@@ -518,7 +437,7 @@ int mainSDL(int argc, char *argv[], SDLEnvironment *customSDLEnvironment) {
                             else
                                 m_fJoystick0YPercent = clamp<float>((float)e.jaxis.value / 32767.0f, -1.0f, 1.0f);
                         }
-                        if(env->getOS() != Environment::OS::OS_HORIZON) {
+                        {
                             // ZL/ZR
                             if(e.jaxis.axis == 2 || e.jaxis.axis == 5) {
                                 if(e.jaxis.axis == 2) {
@@ -550,7 +469,7 @@ int mainSDL(int argc, char *argv[], SDLEnvironment *customSDLEnvironment) {
 
                     case SDL_JOYHATMOTION:
                         // debugLog("joyhatmotion: hat %i : value = %i\n", (int)e.jhat.hat, (int)e.jhat.value);
-                        if(env->getOS() != Environment::OS::OS_HORIZON) {
+                        {
                             const bool wasHatUpDown = hatUpDown;
                             const bool wasHatDownDown = hatDownDown;
                             const bool wasHatLeftDown = hatLeftDown;

+ 0 - 561
src/Engine/Platform/HorizonSDLEnvironment.cpp

@@ -1,561 +0,0 @@
-//================ Copyright (c) 2019, PG, All rights reserved. =================//
-//
-// Purpose:		nintendo switch SDL environment
-//
-// $NoKeywords: $nxsdlenv
-//===============================================================================//
-
-#ifdef __SWITCH__
-
-#include "HorizonSDLEnvironment.h"
-
-#ifdef MCENGINE_FEATURE_SDL
-
-#include <dirent.h>
-#include <switch.h>
-#include <sys/stat.h>
-
-#include "ConVar.h"
-#include "Engine.h"
-#include "Mouse.h"
-#include "SDL.h"
-#include "SoundEngine.h"
-
-ConVar horizon_snd_chunk_size_docked("horizon_snd_chunk_size_docked", 512, FCVAR_NONE);
-ConVar horizon_snd_chunk_size_undocked("horizon_snd_chunk_size_undocked", 256, FCVAR_NONE);
-
-// HACKHACK: manual keyboard/mouse handling from sdl internals, until audio gets fixed, see
-// https://github.com/devkitPro/SDL/commit/b91efb18a1a4752c03d56594b079aa804fe4e9ea audio was broken here:
-// https://github.com/devkitPro/SDL/commit/51d12c191cdc7eb2ea7acca3daaf5e714b436128
-static const HidKeyboardScancode switch_scancodes[MCENGINE_HORIZON_SDL_NUM_SCANCODES_SWITCH] = {KBD_A,
-                                                                                                KBD_B,
-                                                                                                KBD_C,
-                                                                                                KBD_D,
-                                                                                                KBD_E,
-                                                                                                KBD_F,
-                                                                                                KBD_G,
-                                                                                                KBD_H,
-                                                                                                KBD_I,
-                                                                                                KBD_J,
-                                                                                                KBD_K,
-                                                                                                KBD_L,
-                                                                                                KBD_M,
-                                                                                                KBD_N,
-                                                                                                KBD_O,
-                                                                                                KBD_P,
-                                                                                                KBD_Q,
-                                                                                                KBD_R,
-                                                                                                KBD_S,
-                                                                                                KBD_T,
-                                                                                                KBD_U,
-                                                                                                KBD_V,
-                                                                                                KBD_W,
-                                                                                                KBD_X,
-                                                                                                KBD_Y,
-                                                                                                KBD_Z,
-                                                                                                KBD_1,
-                                                                                                KBD_2,
-                                                                                                KBD_3,
-                                                                                                KBD_4,
-                                                                                                KBD_5,
-                                                                                                KBD_6,
-                                                                                                KBD_7,
-                                                                                                KBD_8,
-                                                                                                KBD_9,
-                                                                                                KBD_0,
-                                                                                                KBD_ENTER,
-                                                                                                KBD_ESC,
-                                                                                                KBD_BACKSPACE,
-                                                                                                KBD_TAB,
-                                                                                                KBD_SPACE,
-                                                                                                KBD_MINUS,
-                                                                                                KBD_EQUAL,
-                                                                                                KBD_LEFTBRACE,
-                                                                                                KBD_RIGHTBRACE,
-                                                                                                KBD_BACKSLASH,
-                                                                                                KBD_HASHTILDE,
-                                                                                                KBD_SEMICOLON,
-                                                                                                KBD_APOSTROPHE,
-                                                                                                KBD_GRAVE,
-                                                                                                KBD_COMMA,
-                                                                                                KBD_DOT,
-                                                                                                KBD_SLASH,
-                                                                                                KBD_CAPSLOCK,
-                                                                                                KBD_F1,
-                                                                                                KBD_F2,
-                                                                                                KBD_F3,
-                                                                                                KBD_F4,
-                                                                                                KBD_F5,
-                                                                                                KBD_F6,
-                                                                                                KBD_F7,
-                                                                                                KBD_F8,
-                                                                                                KBD_F9,
-                                                                                                KBD_F10,
-                                                                                                KBD_F11,
-                                                                                                KBD_F12,
-                                                                                                KBD_SYSRQ,
-                                                                                                KBD_SCROLLLOCK,
-                                                                                                KBD_PAUSE,
-                                                                                                KBD_INSERT,
-                                                                                                KBD_HOME,
-                                                                                                KBD_PAGEUP,
-                                                                                                KBD_DELETE,
-                                                                                                KBD_END,
-                                                                                                KBD_PAGEDOWN,
-                                                                                                KBD_RIGHT,
-                                                                                                KBD_LEFT,
-                                                                                                KBD_DOWN,
-                                                                                                KBD_UP,
-                                                                                                KBD_NUMLOCK,
-                                                                                                KBD_KPSLASH,
-                                                                                                KBD_KPASTERISK,
-                                                                                                KBD_KPMINUS,
-                                                                                                KBD_KPPLUS,
-                                                                                                KBD_KPENTER,
-                                                                                                KBD_KP1,
-                                                                                                KBD_KP2,
-                                                                                                KBD_KP3,
-                                                                                                KBD_KP4,
-                                                                                                KBD_KP5,
-                                                                                                KBD_KP6,
-                                                                                                KBD_KP7,
-                                                                                                KBD_KP8,
-                                                                                                KBD_KP9,
-                                                                                                KBD_KP0,
-                                                                                                KBD_KPDOT,
-                                                                                                KBD_102ND,
-                                                                                                KBD_COMPOSE,
-                                                                                                KBD_POWER,
-                                                                                                KBD_KPEQUAL,
-                                                                                                KBD_F13,
-                                                                                                KBD_F14,
-                                                                                                KBD_F15,
-                                                                                                KBD_F16,
-                                                                                                KBD_F17,
-                                                                                                KBD_F18,
-                                                                                                KBD_F19,
-                                                                                                KBD_F20,
-                                                                                                KBD_F21,
-                                                                                                KBD_F22,
-                                                                                                KBD_F23,
-                                                                                                KBD_F24,
-                                                                                                KBD_OPEN,
-                                                                                                KBD_HELP,
-                                                                                                KBD_PROPS,
-                                                                                                KBD_FRONT,
-                                                                                                KBD_STOP,
-                                                                                                KBD_AGAIN,
-                                                                                                KBD_UNDO,
-                                                                                                KBD_CUT,
-                                                                                                KBD_COPY,
-                                                                                                KBD_PASTE,
-                                                                                                KBD_FIND,
-                                                                                                KBD_MUTE,
-                                                                                                KBD_VOLUMEUP,
-                                                                                                KBD_VOLUMEDOWN,
-                                                                                                KBD_CAPSLOCK_ACTIVE,
-                                                                                                KBD_NUMLOCK_ACTIVE,
-                                                                                                KBD_SCROLLLOCK_ACTIVE,
-                                                                                                KBD_KPCOMMA,
-                                                                                                KBD_KPLEFTPAREN,
-                                                                                                KBD_KPRIGHTPAREN,
-                                                                                                KBD_LEFTCTRL,
-                                                                                                KBD_LEFTSHIFT,
-                                                                                                KBD_LEFTALT,
-                                                                                                KBD_LEFTMETA,
-                                                                                                KBD_RIGHTCTRL,
-                                                                                                KBD_RIGHTSHIFT,
-                                                                                                KBD_RIGHTALT,
-                                                                                                KBD_RIGHTMETA,
-                                                                                                KBD_MEDIA_PLAYPAUSE,
-                                                                                                KBD_MEDIA_STOPCD,
-                                                                                                KBD_MEDIA_PREVIOUSSONG,
-                                                                                                KBD_MEDIA_NEXTSONG,
-                                                                                                KBD_MEDIA_EJECTCD,
-                                                                                                KBD_MEDIA_VOLUMEUP,
-                                                                                                KBD_MEDIA_VOLUMEDOWN,
-                                                                                                KBD_MEDIA_MUTE,
-                                                                                                KBD_MEDIA_WWW,
-                                                                                                KBD_MEDIA_BACK,
-                                                                                                KBD_MEDIA_FORWARD,
-                                                                                                KBD_MEDIA_STOP,
-                                                                                                KBD_MEDIA_FIND,
-                                                                                                KBD_MEDIA_SCROLLUP,
-                                                                                                KBD_MEDIA_SCROLLDOWN,
-                                                                                                KBD_MEDIA_EDIT,
-                                                                                                KBD_MEDIA_SLEEP,
-                                                                                                KBD_MEDIA_COFFEE,
-                                                                                                KBD_MEDIA_REFRESH,
-                                                                                                KBD_MEDIA_CALC};
-
-ConVar *HorizonSDLEnvironment::m_mouse_sensitivity_ref = NULL;
-
-uint8_t HorizonSDLEnvironment::locks = 0;
-bool HorizonSDLEnvironment::keystate[] = {0};
-uint64_t HorizonSDLEnvironment::prev_buttons = 0;
-
-HorizonSDLEnvironment::HorizonSDLEnvironment() : SDLEnvironment(NULL) {
-    if(m_mouse_sensitivity_ref == NULL) m_mouse_sensitivity_ref = convar->getConVarByName("mouse_sensitivity");
-
-    // the switch has its own internal deadzone handling already applied
-    convar->getConVarByName("sdl_joystick0_deadzone")->setValue(0.0f);
-
-    m_bDocked = false;
-
-    m_fLastMouseDeltaTime = 0.0f;
-}
-
-HorizonSDLEnvironment::~HorizonSDLEnvironment() {}
-
-void HorizonSDLEnvironment::update() {
-    // when switching between docked/undocked and sleeping/awake, restart audio and switch resolution
-    // NOTE: for some reason, 256 byte audio buffer causes crackling only when docked, therefore we dynamically switch
-    // between 256 and 512 NOTE: if the console goes to sleep we get audio crackling later, therefore also restart audio
-    // engine when waking up
-    const bool dockedChange = (isDocked() != m_bDocked);
-    if(dockedChange) {
-        if(dockedChange) m_bDocked = !m_bDocked;
-
-        debugLog("HorizonSDLEnvironment: Switching to docked = %i (or waking up) ...\n", (int)m_bDocked);
-
-        // restart sound engine
-        convar->getConVarByName("snd_output_device")->setValue("Default");
-
-        // switch resolution
-        if(dockedChange) {
-            const Vector2 resolution = (m_bDocked ? Vector2(1920, 1080) : Vector2(1280, 720));
-            SDL_SetWindowSize(m_window, resolution.x, resolution.y);
-        }
-    }
-
-    SDLEnvironment::update();
-}
-
-void HorizonSDLEnvironment::update_before_winproc() {
-    hidScanInput();  // for manually handling keyboard/mouse
-
-    // HACKHACK: manually handle keyboard
-    {
-        for(int i = 0; i < MCENGINE_HORIZON_SDL_NUM_SCANCODES_SWITCH; i++) {
-            const HidKeyboardScancode keyCode = switch_scancodes[i];
-
-            if(hidKeyboardHeld(keyCode) && !keystate[i]) {
-                switch(keyCode) {
-                    case SDL_SCANCODE_NUMLOCKCLEAR:
-                        if(!(locks & 0x1)) {
-                            engine->onKeyboardKeyDown(keyCode);
-                            locks |= 0x1;
-                        } else {
-                            engine->onKeyboardKeyUp(keyCode);
-                            locks &= ~0x1;
-                        }
-                        break;
-
-                    case SDL_SCANCODE_CAPSLOCK:
-                        if(!(locks & 0x2)) {
-                            engine->onKeyboardKeyDown(keyCode);
-                            locks |= 0x2;
-                        } else {
-                            engine->onKeyboardKeyUp(keyCode);
-                            locks &= ~0x2;
-                        }
-                        break;
-
-                    case SDL_SCANCODE_SCROLLLOCK:
-                        if(!(locks & 0x4)) {
-                            engine->onKeyboardKeyDown(keyCode);
-                            locks |= 0x4;
-                        } else {
-                            engine->onKeyboardKeyUp(keyCode);
-                            locks &= ~0x4;
-                        }
-                        break;
-
-                    default:
-                        engine->onKeyboardKeyDown(keyCode);
-                }
-
-                keystate[i] = true;
-            } else if(!hidKeyboardHeld(keyCode) && keystate[i]) {
-                switch(keyCode) {
-                    case SDL_SCANCODE_CAPSLOCK:
-                    case SDL_SCANCODE_NUMLOCKCLEAR:
-                    case SDL_SCANCODE_SCROLLLOCK:
-                        break;
-
-                    default:
-                        engine->onKeyboardKeyUp(keyCode);
-                }
-
-                keystate[i] = false;
-            }
-        }
-    }
-
-    // HACKHACK: manually handle mouse
-    {
-        uint64_t buttons = hidMouseButtonsHeld();
-        uint64_t changed_buttons = buttons ^ prev_buttons;
-
-        // buttons
-        if(changed_buttons & MOUSE_LEFT) {
-            if(prev_buttons & MOUSE_LEFT)
-                engine->onMouseLeftChange(false);
-            else
-                engine->onMouseLeftChange(true);
-        }
-
-        if(changed_buttons & MOUSE_RIGHT) {
-            if(prev_buttons & MOUSE_RIGHT)
-                engine->onMouseRightChange(false);
-            else
-                engine->onMouseRightChange(true);
-        }
-
-        if(changed_buttons & MOUSE_MIDDLE) {
-            if(prev_buttons & MOUSE_MIDDLE)
-                engine->onMouseMiddleChange(false);
-            else
-                engine->onMouseMiddleChange(true);
-        }
-
-        prev_buttons = buttons;
-
-        MousePosition newMousePos;
-        hidMouseRead(&newMousePos);
-
-        // raw delta
-        // NOTE: the delta values are framerate dependent (poll-dependent), so basically unusable
-        const int32_t dx = (int32_t)newMousePos.velocityX * 2;
-        const int32_t dy = (int32_t)newMousePos.velocityY * 2;
-
-        if(dx != 0 || dy != 0) {
-            m_fLastMouseDeltaTime = engine->getTime();
-            engine->onMouseRawMove(dx, dy);
-        }
-
-        // position
-        // NOTE: the only use case for mouse control is docked mode. the raw coordinates from hidMouseRead() are
-        // restricted to 720p, so upscaling only gives 1.5x1.5 pixel accuracy at most
-        if(engine->getTime() < m_fLastMouseDeltaTime + 0.5f) {
-            const float rawRangeX = 1280.0f;
-            const float rawRangeY = 720.0f;
-
-            m_vMousePos.x =
-                ((((float)newMousePos.x - rawRangeX / 2.0f) * m_mouse_sensitivity_ref->getFloat()) + rawRangeX / 2.0f) /
-                rawRangeX;
-            m_vMousePos.y =
-                ((((float)newMousePos.y - rawRangeY / 2.0f) * m_mouse_sensitivity_ref->getFloat()) + rawRangeY / 2.0f) /
-                rawRangeY;
-
-            m_vMousePos *= engine->getScreenSize();  // scale to 1080p
-
-            m_vMousePos.x = clamp<float>(m_vMousePos.x, 0.0f, engine->getScreenSize().x);
-            m_vMousePos.y = clamp<float>(m_vMousePos.y, 0.0f, engine->getScreenSize().y);
-
-            engine->getMouse()->onPosChange(m_vMousePos);
-        }
-
-        // scrolling
-        const int scrollVelocityX = (int)newMousePos.scrollVelocityX;
-        const int scrollVelocityY = (int)newMousePos.scrollVelocityY;
-        if(scrollVelocityY != 0) engine->onMouseWheelHorizontal(scrollVelocityY);
-        if(scrollVelocityX != 0) engine->onMouseWheelVertical(scrollVelocityX);
-    }
-}
-
-Environment::OS HorizonSDLEnvironment::getOS() { return Environment::OS::OS_HORIZON; }
-
-void HorizonSDLEnvironment::sleep(unsigned int us) { svcSleepThread(us * 1000); }
-
-UString HorizonSDLEnvironment::getUsername() {
-    UString uUsername = convar->getConVarByName("name")->getString();
-
-    // this was directly taken from the libnx examples
-
-    Result rc = 0;
-
-    AccountUid userID;
-    /// bool account_selected = 0;
-    AccountProfile profile;
-    AccountUserData userdata;
-    AccountProfileBase profilebase;
-
-    char username[0x21];
-
-    memset(&userdata, 0, sizeof(userdata));
-    memset(&profilebase, 0, sizeof(profilebase));
-
-    rc = accountInitialize(AccountServiceType_Application);
-    if(R_FAILED(rc)) debugLog("accountInitialize() failed: 0x%x\n", rc);
-
-    if(R_SUCCEEDED(rc)) {
-        rc = accountGetLastOpenedUser(&userID);
-
-        if(R_FAILED(rc)) debugLog("accountGetActiveUser() failed: 0x%x\n", rc);
-        /// else if(!account_selected)
-        ///{
-        ///	debugLog("No user is currently selected.\n");
-        ///     rc = -1;
-        /// }
-
-        if(R_SUCCEEDED(rc)) {
-            /// debugLog("Current userID: 0x%lx 0x%lx\n", (u64)(userID>>64), (u64)userID);
-
-            rc = accountGetProfile(&profile, userID);
-
-            if(R_FAILED(rc)) debugLog("accountGetProfile() failed: 0x%x\n", rc);
-        }
-
-        if(R_SUCCEEDED(rc)) {
-            rc = accountProfileGet(&profile, &userdata, &profilebase);  // userdata is otional, see libnx acc.h.
-
-            if(R_FAILED(rc)) debugLog("accountProfileGet() failed: 0x%x\n", rc);
-
-            if(R_SUCCEEDED(rc)) {
-                memset(username, 0, sizeof(username));
-                strncpy(username, profilebase.nickname,
-                        sizeof(username) - 1);  // even though profilebase.username usually has a NUL-terminator, don't
-                                                // assume it does for safety.
-                debugLog("Username: %s\n", username);
-                uUsername = UString(username);
-            }
-            accountProfileClose(&profile);
-        }
-        accountExit();
-    }
-
-    return uUsername;
-}
-
-std::vector<UString> HorizonSDLEnvironment::getFilesInFolder(UString folder) {
-    std::vector<UString> files;
-
-    DIR *dir;
-    struct dirent *ent;
-
-    dir = opendir(folder.toUtf8());
-    if(dir == NULL) return files;
-
-    while((ent = readdir(dir))) {
-        const char *name = ent->d_name;
-        UString uName = UString(name);
-        UString fullName = folder;
-        fullName.append(uName);
-
-        struct stat stDirInfo;
-        int statret = stat(
-            fullName.toUtf8(),
-            &stDirInfo);  // NOTE: lstat() always returns 0 in st_mode, seems broken, therefore using stat() for now
-        if(statret < 0) {
-            /// perror (name);
-            /// debugLog("HorizonSDLEnvironment::getFilesInFolder() error, stat() returned %i!\n", lstatret);
-            continue;
-        }
-
-        if(!S_ISDIR(stDirInfo.st_mode)) files.push_back(uName);
-    }
-    closedir(dir);
-
-    return files;
-}
-
-std::vector<UString> HorizonSDLEnvironment::getFoldersInFolder(UString folder) {
-    std::vector<UString> folders;
-
-    DIR *dir;
-    struct dirent *ent;
-
-    dir = opendir(folder.toUtf8());
-    if(dir == NULL) return folders;
-
-    while((ent = readdir(dir))) {
-        const char *name = ent->d_name;
-        UString uName = UString(name);
-        UString fullName = folder;
-        fullName.append(uName);
-
-        struct stat stDirInfo;
-        int statret = stat(
-            fullName.toUtf8(),
-            &stDirInfo);  // NOTE: lstat() always returns 0 in st_mode, seems broken, therefore using stat() for now
-        if(statret < 0) {
-            /// perror (name);
-            /// debugLog("HorizonSDLEnvironment::getFoldersInFolder() error, stat() returned %i!\n", lstatret);
-            continue;
-        }
-
-        if(S_ISDIR(stDirInfo.st_mode)) folders.push_back(uName);
-    }
-    closedir(dir);
-
-    return folders;
-}
-
-std::vector<UString> HorizonSDLEnvironment::getLogicalDrives() {
-    std::vector<UString> drives;
-
-    drives.push_back("sdmc");
-    drives.push_back("romfs");
-
-    return drives;
-}
-
-UString HorizonSDLEnvironment::getFolderFromFilePath(std::string filepath) {
-    // NOTE: #include <libgen.h> and dirname() is undefined, seems like it does not exist anywhere in devkitpro except
-    // the header file
-    debugLog("WARNING: HorizonSDLEnvironment::getFolderFromFilePath() not available!\n");
-    return filepath;
-}
-
-Vector2 HorizonSDLEnvironment::getMousePos() { return m_vMousePos; }
-
-void HorizonSDLEnvironment::setMousePos(int x, int y) {
-    m_vMousePos.x = x;
-    m_vMousePos.y = y;
-}
-
-void HorizonSDLEnvironment::showKeyboard() {
-    // TODO: this is broken. it only works if svcSetHeapSize(&addr, 0xf000000); // 128 MB, but that's not enough for the
-    // rest of the game. switching sizes also crashes later.
-    // https://gbatemp.net/threads/software-keyboard-example-failing.528518/
-
-    SwkbdConfig kbd;
-    Result rc = swkbdCreate(&kbd, 0);
-    printf("swkbdCreate(): 0x%x\n", rc);
-
-    if(R_SUCCEEDED(rc)) {
-        swkbdConfigMakePresetDefault(&kbd);
-
-        char str[256] = {0};
-        rc = swkbdShow(&kbd, str, sizeof(str));
-        printf("swkbdShow(): 0x%x\n", rc);
-
-        swkbdClose(&kbd);
-
-        if(R_SUCCEEDED(rc)) {
-            UString uStr = UString(str);
-            for(int i = 0; i < uStr.length(); i++) {
-                engine->onKeyboardChar(uStr[i]);
-            }
-        }
-    }
-}
-
-bool HorizonSDLEnvironment::isDocked() { return (appletGetOperationMode() == AppletOperationMode_Docked); }
-
-int HorizonSDLEnvironment::getMemAvailableMB() {
-    uint64_t numBytes = 0;
-    svcGetInfo(&numBytes, 6, CUR_PROCESS_HANDLE, 0);
-    return (int)(numBytes / 1024 / 1024);
-}
-
-int HorizonSDLEnvironment::getMemUsedMB() {
-    uint64_t numBytes = 0;
-    svcGetInfo(&numBytes, 7, CUR_PROCESS_HANDLE, 0);
-    return (int)(numBytes / 1024 / 1024);
-}
-
-#endif
-
-#endif

+ 0 - 75
src/Engine/Platform/HorizonSDLEnvironment.h

@@ -1,75 +0,0 @@
-//================ Copyright (c) 2019, PG, All rights reserved. =================//
-//
-// Purpose:		nintendo switch SDL environment
-//
-// $NoKeywords: $nxsdlenv
-//===============================================================================//
-
-#ifdef __SWITCH__
-
-#ifndef HORIZONSDLENVIRONMENT_H
-#define HORIZONSDLENVIRONMENT_H
-
-#include "SDLEnvironment.h"
-
-#ifdef MCENGINE_FEATURE_SDL
-
-#define MCENGINE_HORIZON_SDL_NUM_SCANCODES_SWITCH 160
-
-class ConVar;
-
-class HorizonSDLEnvironment : public SDLEnvironment {
-   public:
-    HorizonSDLEnvironment();
-    virtual ~HorizonSDLEnvironment();
-
-    virtual void update();
-    void update_before_winproc();  // HACKHACK: mouse/keyboard
-
-    // system
-    virtual OS getOS();
-    virtual void sleep(unsigned int us);
-
-    // user
-    virtual UString getUsername();
-
-    // file IO
-    virtual std::vector<UString> getFilesInFolder(UString folder);
-    virtual std::vector<UString> getFoldersInFolder(UString folder);
-    virtual std::vector<UString> getLogicalDrives();
-    virtual std::string getFolderFromFilePath(std::string filepath);
-
-    // window
-    int getDPI() { return 96; }
-
-    // mouse
-    Vector2 getMousePos();
-    void setMousePos(int x, int y);
-
-    // ILLEGAL:
-    void showKeyboard();
-    bool isDocked();
-    int getMemAvailableMB();
-    int getMemUsedMB();
-
-   private:
-    static ConVar *m_mouse_sensitivity_ref;
-
-    bool m_bDocked;
-
-    Vector2 m_vMousePos;
-
-    uint32_t m_sensorHandles[4];
-
-    // HACKHACK: manual keyboard/mouse handling
-    static uint8_t locks;
-    static bool keystate[MCENGINE_HORIZON_SDL_NUM_SCANCODES_SWITCH];
-    static uint64_t prev_buttons;
-    float m_fLastMouseDeltaTime;
-};
-
-#endif
-
-#endif
-
-#endif

+ 0 - 34
src/Engine/Platform/HorizonThread.cpp

@@ -1,34 +0,0 @@
-//================ Copyright (c) 2020, PG, All rights reserved. =================//
-//
-// Purpose:		horizon implementation of thread
-//
-// $NoKeywords: $nxthread $os
-//===============================================================================//
-
-#ifdef __SWITCH__
-
-#include "HorizonThread.h"
-
-#include "Engine.h"
-
-HorizonThread::HorizonThread(McThread::START_ROUTINE start_routine, void *arg) : BaseThread() {
-    Result rc = threadCreate((Thread *)&m_thread, (ThreadFunc)start_routine, arg, NULL, 0x1000000, 0x2B, 2);
-
-    m_bReady = !R_FAILED(rc);
-
-    if(!m_bReady)
-        debugLog("HorizonThread Error: threadCreate() returned %i!\n", (int)rc);
-    else
-        threadStart((Thread *)&m_thread);
-}
-
-HorizonThread::~HorizonThread() {
-    if(!m_bReady) return;
-
-    m_bReady = false;
-
-    threadWaitForExit((Thread *)&m_thread);
-    threadClose((Thread *)&m_thread);
-}
-
-#endif

+ 0 - 32
src/Engine/Platform/HorizonThread.h

@@ -1,32 +0,0 @@
-//================ Copyright (c) 2020, PG, All rights reserved. =================//
-//
-// Purpose:		horizon implementation of thread
-//
-// $NoKeywords: $nxthread $os
-//===============================================================================//
-
-#ifdef __SWITCH__
-
-#ifndef HORIZONTHREAD_H
-#define HORIZONTHREAD_H
-
-#include <switch.h>
-
-#include "Thread.h"
-
-class HorizonThread : public BaseThread {
-   public:
-    HorizonThread(McThread::START_ROUTINE start_routine, void *arg);
-    virtual ~HorizonThread();
-
-    bool isReady() { return m_bReady; }
-
-   private:
-    bool m_bReady;
-
-    Thread m_thread;
-};
-
-#endif
-
-#endif

+ 0 - 41
src/Engine/Platform/HorizonTimer.cpp

@@ -1,41 +0,0 @@
-//================ Copyright (c) 2019, PG, All rights reserved. =================//
-//
-// Purpose:		fps timer
-//
-// $NoKeywords: $nxtime $os
-//===============================================================================//
-
-#ifdef __SWITCH__
-
-#include "HorizonTimer.h"
-
-#include <switch.h>
-
-HorizonTimer::HorizonTimer() : BaseTimer() {
-    m_startTime = 0;
-    m_currentTime = 0;
-
-    m_delta = 0.0;
-    m_elapsedTime = 0.0;
-    m_elapsedTimeMS = 0;
-}
-
-void HorizonTimer::start() {
-    m_startTime = armGetSystemTick();
-    m_currentTime = m_startTime;
-
-    m_delta = 0.0;
-    m_elapsedTime = 0.0;
-    m_elapsedTimeMS = 0;
-}
-
-void HorizonTimer::update() {
-    const uint64_t nowTime = armGetSystemTick();
-
-    m_delta = (double)armTicksToNs(nowTime - m_currentTime) / 1000000000.0;
-    m_elapsedTime = (double)armTicksToNs(nowTime - m_startTime) / 1000000000.0;
-    m_elapsedTimeMS = armTicksToNs(nowTime - m_startTime) / (uint64_t)1000000;
-    m_currentTime = nowTime;
-}
-
-#endif

+ 0 - 38
src/Engine/Platform/HorizonTimer.h

@@ -1,38 +0,0 @@
-//================ Copyright (c) 2019, PG, All rights reserved. =================//
-//
-// Purpose:		fps timer
-//
-// $NoKeywords: $nxtime $os
-//===============================================================================//
-
-#ifdef __SWITCH__
-
-#ifndef HORIZONTIMER_H
-#define HORIZONTIMER_H
-
-#include "Timer.h"
-
-class HorizonTimer : public BaseTimer {
-   public:
-    HorizonTimer();
-    virtual ~HorizonTimer() { ; }
-
-    virtual void start() override;
-    virtual void update() override;
-
-    virtual inline double getDelta() const override { return m_delta; }
-    virtual inline double getElapsedTime() const override { return m_elapsedTime; }
-    virtual inline uint64_t getElapsedTimeMS() const override { return m_elapsedTimeMS; }
-
-   private:
-    uint64_t m_startTime;
-    uint64_t m_currentTime;
-
-    double m_delta;
-    double m_elapsedTime;
-    uint64_t m_elapsedTimeMS;
-};
-
-#endif
-
-#endif

+ 0 - 7
src/Engine/Platform/OpenGLHeaders.h

@@ -53,12 +53,5 @@
 
 #endif
 
-#ifdef __SWITCH__
-
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-
-#endif
-
 #endif
 // clang-format on

+ 0 - 6
src/Engine/Platform/Thread.cpp

@@ -11,7 +11,6 @@
 
 #include "ConVar.h"
 #include "Engine.h"
-#include "HorizonThread.h"
 
 // pthread implementation of Thread
 class PosixThread : public BaseThread {
@@ -49,12 +48,7 @@ ConVar *McThread::debug = &debug_thread;
 
 McThread::McThread(START_ROUTINE start_routine, void *arg) {
     m_baseThread = NULL;
-
-#if defined(__SWITCH__)
-    m_baseThread = new HorizonThread(start_routine, arg);
-#else
     m_baseThread = new PosixThread(start_routine, arg);
-#endif
 }
 
 McThread::~McThread() { SAFE_DELETE(m_baseThread); }

+ 0 - 8
src/Engine/Platform/Timer.cpp

@@ -19,10 +19,6 @@
 
 #include "MacOSTimer.h"
 
-#elif defined __SWITCH__
-
-#include "HorizonTimer.h"
-
 #endif
 
 Timer::Timer() {
@@ -40,10 +36,6 @@ Timer::Timer() {
 
     m_timer = new MacOSTimer();
 
-#elif defined __SWITCH__
-
-    m_timer = new HorizonTimer();
-
 #else
 
 #error Missing Timer implementation for OS!

+ 0 - 17
src/Engine/ResourceManager.cpp

@@ -45,33 +45,16 @@ ConVar debug_rm_("debug_rm", false, FCVAR_NONE);
 
 ConVar *ResourceManager::debug_rm = &debug_rm_;
 
-// HACKHACK: do this with env->getOS() or something
-#ifdef __SWITCH__
-
-const char *ResourceManager::PATH_DEFAULT_IMAGES = "romfs:/materials/";
-const char *ResourceManager::PATH_DEFAULT_FONTS = "romfs:/fonts/";
-const char *ResourceManager::PATH_DEFAULT_SHADERS = "romfs:/shaders/";
-
-#else
-
 const char *ResourceManager::PATH_DEFAULT_IMAGES = MCENGINE_DATA_DIR "materials/";
 const char *ResourceManager::PATH_DEFAULT_FONTS = MCENGINE_DATA_DIR "fonts/";
 const char *ResourceManager::PATH_DEFAULT_SHADERS = MCENGINE_DATA_DIR "shaders/";
 
-#endif
-
 ResourceManager::ResourceManager() {
     m_bNextLoadAsync = false;
     m_iNumResourceInitPerFrameLimit = 1;
 
     m_loadingWork.reserve(32);
 
-    // OS specific engine settings/overrides
-    if(env->getOS() == Environment::OS::OS_HORIZON) {
-        rm_numthreads.setValue(1.0f);
-        rm_numthreads.setDefaultFloat(1.0f);
-    }
-
     // create loader threads
     for(int i = 0; i < rm_numthreads.getInt(); i++) {
         ResourceManagerLoaderThread *loaderThread = new ResourceManagerLoaderThread();

+ 0 - 5
src/Engine/SoundEngine.cpp

@@ -17,7 +17,6 @@
 #include "ConVar.h"
 #include "Engine.h"
 #include "Environment.h"
-#include "HorizonSDLEnvironment.h"
 #include "Osu.h"
 #include "OsuBeatmap.h"
 #include "OsuOptionsMenu.h"
@@ -527,10 +526,6 @@ bool SoundEngine::initializeOutputDevice(OUTPUT_DEVICE device) {
 #endif
     }
 
-    if(env->getOS() == Environment::OS::OS_HORIZON) {
-        osu_universal_offset_hardcoded.setValue(-45.0f);
-    }
-
     m_bReady = true;
     m_currentOutputDevice = device;
     snd_output_device.setValue(m_currentOutputDevice.name);