Sfoglia il codice sorgente

Only set fposu/mirror flags when the server allows it

Clément Wolf 1 mese fa
parent
commit
78cbc54efc
3 ha cambiato i file con 19 aggiunte e 3 eliminazioni
  1. 2 0
      src/App/Osu/Bancho.h
  2. 9 0
      src/App/Osu/BanchoNetworking.cpp
  3. 8 3
      src/App/Osu/OsuScore.cpp

+ 2 - 0
src/App/Osu/Bancho.h

@@ -27,6 +27,8 @@ struct Bancho {
     bool prefer_daycore = false;
 
     ServerPolicy score_submission_policy = ServerPolicy::NO_PREFERENCE;
+    bool set_fposu_flag = false;
+    bool set_mirror_flag = false;
     bool submit_scores();
 
     UString user_agent;

+ 9 - 0
src/App/Osu/BanchoNetworking.cpp

@@ -80,6 +80,8 @@ void disconnect() {
     bancho.user_id = 0;
 
     bancho.score_submission_policy = ServerPolicy::NO_PREFERENCE;
+    bancho.set_fposu_flag = false;
+    bancho.set_mirror_flag = false;
     bancho.osu->m_optionsMenu->updateLayout();
 
     bancho.osu->m_optionsMenu->logInButton->setText("Log in");
@@ -259,6 +261,13 @@ static void send_bancho_packet(CURL *curl, Packet outgoing) {
             bancho.osu->m_optionsMenu->updateLayout();
             debugLog("Server wants score submission! :D\n");
         }
+
+        if(strstr(header->value, "fposu=1") != NULL) {
+            bancho.set_fposu_flag = true;
+        }
+        if(strstr(header->value, "mirror=1") != NULL) {
+            bancho.set_mirror_flag = true;
+        }
     }
 
     while(response.pos < response.size) {

+ 8 - 3
src/App/Osu/OsuScore.cpp

@@ -7,6 +7,7 @@
 
 #include "OsuScore.h"
 
+#include "Bancho.h"
 #include "BanchoProtocol.h"
 #include "ConVar.h"
 #include "Engine.h"
@@ -584,9 +585,13 @@ int OsuScore::getModsLegacy() {
 
     // Set some unused (in osu!std) mod flags for non-vanilla mods
     // (these flags don't seem to cause issues on osu!stable or bancho.py)
-    if(convar->getConVarByName("osu_playfield_mirror_horizontal")->getBool()) modsLegacy |= ModFlags::Mirror;
-    if(convar->getConVarByName("osu_playfield_mirror_vertical")->getBool()) modsLegacy |= ModFlags::Mirror;
-    if(convar->getConVarByName("osu_mod_fposu")->getBool()) modsLegacy |= ModFlags::FPoSu;
+    if(bancho.set_fposu_flag) {
+        if(convar->getConVarByName("osu_mod_fposu")->getBool()) modsLegacy |= ModFlags::FPoSu;
+    }
+    if(bancho.set_mirror_flag) {
+        if(convar->getConVarByName("osu_playfield_mirror_horizontal")->getBool()) modsLegacy |= ModFlags::Mirror;
+        if(convar->getConVarByName("osu_playfield_mirror_vertical")->getBool()) modsLegacy |= ModFlags::Mirror;
+    }
 
     return modsLegacy;
 }