Skip to content

Commit

Permalink
fix: disable trying to upload leaderboard data
Browse files Browse the repository at this point in the history
  • Loading branch information
hero622 committed Oct 30, 2023
1 parent a5f931e commit 20db4d5
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Modules.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
#include "Modules/Tier1.hpp"
#include "Modules/VGui.hpp"
#include "Modules/FileSystem.hpp"
#include "Modules/Matchmaking.hpp"
30 changes: 30 additions & 0 deletions src/Modules/Matchmaking.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "Matchmaking.hpp"

#include "Hook.hpp"
#include "SAR.hpp"

REDECL(Matchmaking::UpdateLeaderboardData);

extern Hook g_UpdateLeaderboardDataHook;
DETOUR(Matchmaking::UpdateLeaderboardData, KeyValues *a2) {
return 0;
}
Hook g_UpdateLeaderboardDataHook(&Matchmaking::UpdateLeaderboardData_Hook);

bool Matchmaking::Init() {
if (!sar.game->Is(SourceGame_Portal2)) {
#ifdef _WIN32
Matchmaking::UpdateLeaderboardData = (decltype(Matchmaking::UpdateLeaderboardData))Memory::Scan(matchmaking->Name(), "55 8B EC 83 EC 08 53 8B D9 8B 03 8B 50 08");
#else
Matchmaking::UpdateLeaderboardData = (decltype(Matchmaking::UpdateLeaderboardData))Memory::Scan(matchmaking->Name(), "55 89 E5 57 56 53 83 EC 2C 8B 45 08 8B 5D 0C");
#endif

g_UpdateLeaderboardDataHook.SetFunc(Matchmaking::UpdateLeaderboardData);
}

return this->hasLoaded;
}
void Matchmaking::Shutdown() {
}

Matchmaking *matchmaking;
15 changes: 15 additions & 0 deletions src/Modules/Matchmaking.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once
#include "Module.hpp"
#include "Utils.hpp"

class Matchmaking : public Module {
public:
// PlayerLocal::UpdateLeaderboardData
DECL_DETOUR(UpdateLeaderboardData, KeyValues *a2);

bool Init() override;
void Shutdown() override;
const char *Name() override { return MODULE("matchmaking"); }
};

extern Matchmaking *matchmaking;
1 change: 1 addition & 0 deletions src/SAR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ bool SAR::Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerF
this->modules->AddModule<Server>(&server);
this->modules->AddModule<MaterialSystem>(&materialSystem);
this->modules->AddModule<FileSystem>(&fileSystem);
this->modules->AddModule<Matchmaking>(&matchmaking);
this->modules->InitAll();

InitSARChecksum();
Expand Down
2 changes: 2 additions & 0 deletions src/SourceAutoRecord.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
<ClCompile Include="Games\PortalStoriesMel.cpp" />
<ClCompile Include="Games\ThinkingWithTimeMachine.cpp" />
<ClCompile Include="Modules\FileSystem.cpp" />
<ClCompile Include="Modules\Matchmaking.cpp" />
<ClCompile Include="Scheduler.cpp" />
<ClCompile Include="Features\ClassDumper.cpp" />
<ClCompile Include="Features\Cvars.cpp" />
Expand Down Expand Up @@ -345,6 +346,7 @@
<ClInclude Include="Games\PortalStoriesMel.hpp" />
<ClInclude Include="Games\ThinkingWithTimeMachine.hpp" />
<ClInclude Include="Modules\FileSystem.hpp" />
<ClInclude Include="Modules\Matchmaking.hpp" />
<ClInclude Include="OffsetsData.hpp" />
<ClInclude Include="Scheduler.hpp" />
<ClInclude Include="Features.hpp" />
Expand Down
6 changes: 6 additions & 0 deletions src/SourceAutoRecord.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@
<ClCompile Include="Features\AutoSubmitMod.cpp">
<Filter>SourceAutoRecord\Features</Filter>
</ClCompile>
<ClCompile Include="Modules\Matchmaking.cpp">
<Filter>SourceAutoRecord\Modules</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\lib\minhook\buffer.h">
Expand Down Expand Up @@ -1290,6 +1293,9 @@
<ClInclude Include="Features\AutoSubmitMod.hpp">
<Filter>SourceAutoRecord\Features</Filter>
</ClInclude>
<ClInclude Include="Modules\Matchmaking.hpp">
<Filter>SourceAutoRecord\Modules</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="SourceAutoRecord">
Expand Down

0 comments on commit 20db4d5

Please sign in to comment.