Skip to content

Commit

Permalink
Fix keming issue in Turbo leaderboards
Browse files Browse the repository at this point in the history
fixes #4
  • Loading branch information
Phlarx committed Jan 23, 2022
1 parent e9fc1f0 commit a0f573d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
27 changes: 27 additions & 0 deletions FixUI.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace FixUI {
uint oldLength = 0;

void Turbo() {
if(GetApp().Network is null || GetApp().Network.ClientManiaAppPlayground is null){
return;
}
auto playground = GetApp().Network.ClientManiaAppPlayground;

//Only fix UI if the UI changed
if(playground.UILayers.Length != oldLength){
for(uint i = 0; i < playground.UILayers.Length; ++i)
{
auto layer = cast<CGameUILayer>(playground.UILayers[i]);

while(Regex::Contains(layer.ManialinkPage, "posn=\"74\\.")) {
layer.ManialinkPage = Regex::Replace(layer.ManialinkPage, "posn=\"74\\.6725", "posn=\"69.6725"); // 100
layer.ManialinkPage = Regex::Replace(layer.ManialinkPage, "posn=\"81\\.6725", "posn=\"76.6725"); // -
layer.ManialinkPage = Regex::Replace(layer.ManialinkPage, "posn=\"88\\.6725", "posn=\"83.6725"); // 100
print('replaced');
}
}

oldLength = playground.UILayers.Length;
}
}
}
9 changes: 8 additions & 1 deletion Thousandths.as
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,14 @@ void disable() {
trace("Thousandths: patch removed");
}

#if MP4

#if TURBO
void Update(float dt) {
if(!enabled) return;

FixUI::Turbo();
}
#elif MP4
/*
This is ugly, but required, since MP4 menus add the extra digit on already.
This would cause the last digit to be duplicated: 1:23.456 -> 1:23.4566
Expand Down
2 changes: 1 addition & 1 deletion info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ author = "Phlarx"
category = "Race"

siteid = 151
version = "0.2"
version = "0.3"

[game]
# since this is for Turbo and MP4, max_version is just to catch the
Expand Down

0 comments on commit a0f573d

Please sign in to comment.