3 Commits 7d68bb5ab7 ... d26da1df68

Author SHA1 Message Date
  kiwec d26da1df68 Ignore asshole characters when sorting skins 2 months ago
  kiwec 50fe55ea52 Optimize song browser 2 months ago
  kiwec 6a1d01c49a Display worst frametime instead of current frametime 2 months ago

+ 1 - 1
Makefile

@@ -9,7 +9,7 @@ CXXFLAGS = -std=c++17 -fmessage-length=0 -fno-exceptions -Wno-sign-compare -Wno-
 CXXFLAGS += `pkgconf --static --cflags $(LIBS)` `curl-config --cflags`
 CXXFLAGS += -Isrc/App -Isrc/App/Osu -Isrc/Engine -Isrc/GUI -Isrc/GUI/Windows -Isrc/GUI/Windows/VinylScratcher -Isrc/Engine/Input -Isrc/Engine/Platform -Isrc/Engine/Main -Isrc/Engine/Renderer -Isrc/Util
 CXXFLAGS += -Ilibraries/bass/include -Ilibraries/bassasio/include -Ilibraries/bassfx/include -Ilibraries/bassmix/include -Ilibraries/basswasapi/include -Ilibraries/bassloud/include
-CXXFLAGS += -g3 -fsanitize=address
+CXXFLAGS += -O2 -g3 -fsanitize=address
 
 LDFLAGS = -ldiscord-rpc -lbass -lbassmix -lbass_fx -lbassloud -lstdc++
 LDFLAGS += `pkgconf --static --libs $(LIBS)` `curl-config --static-libs --libs`

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

@@ -29,11 +29,14 @@ Changelog::Changelog() : ScreenBackable() {
     CHANGELOG latest;
     latest.title =
         UString::format("%.2f (%s, %s)", convar->getConVarByName("osu_version")->getFloat(), __DATE__, __TIME__);
-    latest.changes.push_back("- Added missing UI sounds");
+    latest.changes.push_back("- Added more UI sounds");
     latest.changes.push_back("- Chat: added support for /me command");
     latest.changes.push_back("- Chat: added support for links");
     latest.changes.push_back("- Chat: added support for map links (auto-downloads)");
     latest.changes.push_back("- Chat: added support for multiplayer invite links");
+    latest.changes.push_back("- FPS counter will now display worst frametime instead of current frametime");
+    latest.changes.push_back("- Improved song browser performance");
+    latest.changes.push_back("- Skins are now sorted alphabetically, ignoring meme characters");
     changelogs.push_back(latest);
 
     CHANGELOG v35_05;

+ 32 - 13
src/App/Osu/HUD.cpp

@@ -319,9 +319,6 @@ void HUD::draw(Graphics *g) {
                 g->translate(0, beatmap->getHitcircleDiameter() *
                                     (1.0f / (osu_hud_scale.getFloat() * osu_hud_statistics_scale.getFloat())));
 
-            const int hitObjectIndexForCurrentTime =
-                (beatmap->getHitObjectIndexForCurrentTime() < 1 ? -1 : beatmap->getHitObjectIndexForCurrentTime());
-
             drawStatistics(
                 g, osu->getScore()->getNumMisses(), osu->getScore()->getNumSliderBreaks(),
                 beatmap->getMaxPossibleCombo(), live_stars,
@@ -504,8 +501,9 @@ void HUD::mouse_update(bool *propagate_clicks) {
             m_fFpsUpdate = engine->getTime() + 0.25f;
             m_fCurFps = m_fCurFpsSmooth;
         }
-    } else
+    } else {
         m_fCurFps = (1.0f / engine->getFrameTime());
+    }
 
     // target heatmap cleanup
     if(osu->getModTarget()) {
@@ -786,9 +784,20 @@ void HUD::drawCursorRipples(Graphics *g) {
 }
 
 void HUD::drawFps(Graphics *g, McFont *font, float fps) {
+    static double old_worst_frametime = 0.0;
+    static double new_worst_frametime = 0.0;
+    static double current_second = 0.0;
+    if(current_second + 1.0 > engine->getTime()) {
+        new_worst_frametime = max(new_worst_frametime, engine->getFrameTime());
+    } else {
+        old_worst_frametime = new_worst_frametime;
+        new_worst_frametime = 0.f;
+        current_second = engine->getTime();
+    }
+
     fps = std::round(fps);
     const UString fpsString = UString::format("%i fps", (int)(fps));
-    const UString msString = UString::format("%.1f ms", (1.0f / fps) * 1000.0f);
+    const UString msString = UString::format("%.1f ms", old_worst_frametime * 1000.0f);
 
     const float dpiScale = Osu::getUIScale();
 
@@ -813,17 +822,18 @@ void HUD::drawFps(Graphics *g, McFont *font, float fps) {
     g->popTransform();
 
     // top
-    if(fps >= 200)
-        g->setColor(0xffffffff);
-    else if(fps >= 120)
-        g->setColor(0xffdddd00);
-    else {
-        const float pulse = std::abs(std::sin(engine->getTime() * 4));
-        g->setColor(COLORf(1.0f, 1.0f, 0.26f * pulse, 0.26f * pulse));
-    }
 
     g->pushTransform();
     {
+        if(fps >= 200)
+            g->setColor(0xffffffff);
+        else if(fps >= 120)
+            g->setColor(0xffdddd00);
+        else {
+            const float pulse = std::abs(std::sin(engine->getTime() * 4));
+            g->setColor(COLORf(1.0f, 1.0f, 0.26f * pulse, 0.26f * pulse));
+        }
+
         g->translate(osu->getScreenWidth() - font->getStringWidth(fpsString) - margin,
                      osu->getScreenHeight() - margin - font->getHeight() - margin);
         g->drawString(font, fpsString);
@@ -831,6 +841,15 @@ void HUD::drawFps(Graphics *g, McFont *font, float fps) {
     g->popTransform();
     g->pushTransform();
     {
+        if(old_worst_frametime <= 0.005) {
+            g->setColor(0xffffffff);
+        } else if(old_worst_frametime <= 0.008) {
+            g->setColor(0xffdddd00);
+        } else {
+            const float pulse = std::abs(std::sin(engine->getTime() * 4));
+            g->setColor(COLORf(1.0f, 1.0f, 0.26f * pulse, 0.26f * pulse));
+        }
+
         g->translate(osu->getScreenWidth() - font->getStringWidth(msString) - margin, osu->getScreenHeight() - margin);
         g->drawString(font, msString);
     }

+ 21 - 0
src/App/Osu/OptionsMenu.cpp

@@ -2405,6 +2405,27 @@ void OptionsMenu::onSkinSelect() {
     skinFolder.append(convar->getConVarByName("osu_folder_sub_skins")->getString());
     std::vector<std::string> skinFolders = env->getFoldersInFolder(skinFolder.toUtf8());
 
+    // Sort skins only by alphanum characters, ignore the others
+    std::sort(skinFolders.begin(), skinFolders.end(), [](std::string a, std::string b) {
+        int i = 0;
+        int j = 0;
+        while(i < a.length() && j < b.length()) {
+            if(!isalnum(a[i])) {
+                i++;
+                continue;
+            }
+            if(!isalnum(b[j])) {
+                j++;
+                continue;
+            }
+            char la = tolower(a[i]);
+            char lb = tolower(b[j]);
+            if(la != lb) return la < lb;
+        }
+
+        return false;
+    });
+
     if(skinFolders.size() > 0) {
         m_contextMenu->setPos(m_skinSelectLocalButton->getPos());
         m_contextMenu->setRelPos(m_skinSelectLocalButton->getRelPos());

+ 4 - 0
src/App/Osu/SongBrowser/Button.cpp

@@ -113,6 +113,10 @@ void Button::drawMenuButtonBackground(Graphics *g) {
 }
 
 void Button::mouse_update(bool *propagate_clicks) {
+    // Not correct, but clears most of the lag
+    if(m_vPos.y + m_vSize.y < 0) return;
+    if(m_vPos.y > engine->getScreenHeight()) return;
+
     // HACKHACK: absolutely disgusting
     // temporarily fool CBaseUIElement with modified position and size
     {

+ 2 - 2
src/App/Osu/SongBrowser/SongButton.cpp

@@ -69,12 +69,12 @@ SongButton::~SongButton() {
 }
 
 void SongButton::draw(Graphics *g) {
-    Button::draw(g);
     if(!m_bVisible) return;
-
     if(m_vPos.y + m_vSize.y < 0) return;
     if(m_vPos.y > engine->getScreenHeight()) return;
 
+    Button::draw(g);
+
     // draw background image
     sortChildren();
     if(m_databaseBeatmap != NULL && m_children.size() > 0) {