4 Angajamente 03e8b13d77 ... c2a49d8f91

Autor SHA1 Permisiunea de a trimite mesaje. Dacă este dezactivată, utilizatorul nu va putea trimite nici un fel de mesaj Data
  Clément Wolf c2a49d8f91 Update changelog 1 lună în urmă
  Clément Wolf 3a3d0083a3 Use crypto random instead of mersenne twister 1 lună în urmă
  Clément Wolf 8dd1c7c617 Add an extra slot to in-game scoreboard 1 lună în urmă
  Clément Wolf 434431b021 Remove extra "." in login packet adapters 1 lună în urmă

+ 1 - 1
src/App/Osu/Bancho.cpp

@@ -542,7 +542,7 @@ Packet build_login_packet() {
     MD5Hash install_md5 = md5((uint8_t *)bancho.install_id.toUtf8(), bancho.install_id.lengthUtf8());
     ;
 
-    bancho.client_hashes = UString::format("%s:%s.:%s:%s:%s:", osu_path_md5.hash, adapters, adapters_md5.hash,
+    bancho.client_hashes = UString::format("%s:%s:%s:%s:%s:", osu_path_md5.hash, adapters, adapters_md5.hash,
                                            install_md5.hash, disk_md5.hash);
     write_bytes(&packet, (uint8_t *)bancho.client_hashes.toUtf8(), bancho.client_hashes.lengthUtf8());
 

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

@@ -36,8 +36,13 @@ OsuChangelog::OsuChangelog(Osu *osu) : OsuScreenBackable(osu) {
     CHANGELOG latest;
     latest.title =
         UString::format("%.2f (%s, %s)", convar->getConVarByName("osu_version")->getFloat(), __DATE__, __TIME__);
+    latest.changes.push_back("- Added replay viewer");
+    latest.changes.push_back("- Added instant replay (press F1 while paused or after failing)");
     latest.changes.push_back("- Added option to disable in-game scoreboard animations");
+    latest.changes.push_back("- Added start_first_main_menu_song_at_preview_point convar (it does what it says)");
+    latest.changes.push_back("- Added extra slot to in-game scoreboard");
     latest.changes.push_back("- Fixed hitobjects being hittable after failing");
+    latest.changes.push_back("- Fixed login packet sending incorrect adapters list");
     latest.changes.push_back("- Removed VR support");
     latest.changes.push_back("- Updated protocol and database version to b20240411.1");
     changelogs.push_back(latest);

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

@@ -261,11 +261,11 @@ void OsuScoreboardSlot::updateIndex(int new_index, bool animate) {
         player_idx = new_index;
     }
 
-    int min_visible_idx = player_idx - 3;
+    int min_visible_idx = player_idx - 4;
     if(min_visible_idx < 0) min_visible_idx = 0;
 
     int max_visible_idx = player_idx;
-    if(max_visible_idx < 4) max_visible_idx = 4;
+    if(max_visible_idx < 5) max_visible_idx = 5;
 
     bool is_visible = new_index == 0 || (new_index >= min_visible_idx && new_index <= max_visible_idx);
 

+ 18 - 7
src/App/Osu/OsuSongBrowser.cpp

@@ -1,4 +1,8 @@
-#include "OsuSongBrowser.h"
+#ifdef _WIN32
+#include <windows.h>
+#else
+#include <sys/random.h>
+#endif
 
 #include "AnimationHandler.h"
 #include "Bancho.h"
@@ -30,6 +34,7 @@
 #include "OsuRoom.h"
 #include "OsuSkin.h"
 #include "OsuSkinImage.h"
+#include "OsuSongBrowser.h"
 #include "OsuUIBackButton.h"
 #include "OsuUIContextMenu.h"
 #include "OsuUISearchOverlay.h"
@@ -388,9 +393,6 @@ bool OsuSongBrowser::SortByTitle::operator()(OsuUISongBrowserButton const *a, Os
 OsuSongBrowser::OsuSongBrowser(Osu *osu) : OsuScreenBackable(osu) {
     m_osu = osu;
 
-    // random selection algorithm init
-    m_rngalg = std::mt19937(time(0));
-
     // sorting/grouping + methods
     m_group = GROUP::GROUP_NO_GROUPING;
     {
@@ -4132,9 +4134,18 @@ void OsuSongBrowser::selectRandomBeatmap() {
        m_selectedBeatmap->getSelectedDifficulty2() != NULL)
         m_previousRandomBeatmaps.push_back(m_selectedBeatmap->getSelectedDifficulty2());
 
-    std::uniform_int_distribution<size_t> rng(0, songButtons.size() - 1);
-    size_t randomIndex = rng(m_rngalg);
-    OsuUISongBrowserSongButton *songButton = dynamic_cast<OsuUISongBrowserSongButton *>(songButtons[randomIndex]);
+    size_t rng;
+#ifdef _WIN32
+    HCRYPTPROV hCryptProv;
+    CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
+    CryptGenRandom(hCryptProv, sizeof(rng), &rng);
+    CryptReleaseContext(hCryptProv, 0);
+#else
+    getrandom(&rng, sizeof(rng), 0);
+#endif
+    size_t randomindex = rng % songButtons.size();
+
+    OsuUISongBrowserSongButton *songButton = dynamic_cast<OsuUISongBrowserSongButton *>(songButtons[randomindex]);
     selectSongButton(songButton);
 }
 

+ 0 - 1
src/App/Osu/OsuSongBrowser.h

@@ -266,7 +266,6 @@ class OsuSongBrowser : public OsuScreenBackable {
     ConVar *m_osu_mod_fposu_ref;
 
     Osu *m_osu;
-    std::mt19937 m_rngalg;
     GROUP m_group;
     std::vector<GROUPING> m_groupings;
     SORT m_sortingMethod;