Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
new update
Browse files Browse the repository at this point in the history
  • Loading branch information
McDaived committed Aug 12, 2023
1 parent 528c867 commit 74b8336
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
Binary file modified App/CS2Downloader.exe
Binary file not shown.
4 changes: 3 additions & 1 deletion CS2Downloader/CS2Downloader.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand Down Expand Up @@ -136,6 +137,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
Expand All @@ -151,4 +153,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
8 changes: 5 additions & 3 deletions CS2Downloader/CS2Downloader.vcxproj.user
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
</PropertyGroup>
</Project>
18 changes: 8 additions & 10 deletions CS2Downloader/CS2Patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
#include <filesystem>

bool Patcher::PatchClient() {
const char* steamCheckBytes[2] = { "\x75\x70\xFF\x15", "\xEB\x70\xFF\x15" };
const char* steamCheckBytes[2] = { "\x75\x73\xFF\x15", "\xEB\x73\xFF\x15" };
const char* versionCheckBytes[4] = { "\x6C\x69\x6D\x69\x74\x65\x64\x62\x65\x74\x61", "\x66\x75\x6C\x6C\x76\x65\x72\x73\x69\x6F\x6E", "\x6C\x69\x6D\x69\x74\x65\x64\x62\x65\x74\x61", "\x66\x75\x6C\x6C\x76\x65\x72\x73\x69\x6F\x6E"};

if (!ReplaceBytes("game/csgo/bin/win64/client.dll", steamCheckBytes[0], steamCheckBytes[1])) {
if (!ReplaceBytes("game/csgo/bin/win64/client.dll", steamCheckBytes[0], steamCheckBytes[1], 4)) {
puts("failed to patch steam check");
return false;
}

if (!ReplaceBytes("game/csgo/bin/win64/client.dll", versionCheckBytes[0], versionCheckBytes[1]) || !ReplaceBytes("game/csgo/bin/win64/client.dll", versionCheckBytes[2], versionCheckBytes[3])) {
if (!ReplaceBytes("game/csgo/bin/win64/client.dll", versionCheckBytes[0], versionCheckBytes[1], 11) || !ReplaceBytes("game/csgo/bin/win64/client.dll", versionCheckBytes[2], versionCheckBytes[3], 11)) {
puts("failed to patch version check");
return false;
}
Expand All @@ -23,7 +23,7 @@ bool Patcher::PatchClient() {
bool Patcher::PatchServer() {
const char* clampCheckBytes[2] = { "\x76\x59\xF2\x0F\x10\x4F\x3C", "\xEB\x59\xF2\x0F\x10\x4F\x3C" };

if (!ReplaceBytes("game/csgo/bin/win64/server.dll", clampCheckBytes[0], clampCheckBytes[1])) {
if (!ReplaceBytes("game/csgo/bin/win64/server.dll", clampCheckBytes[0], clampCheckBytes[1], 7)) {
puts("failed to patch movement clamp");
return false;
}
Expand All @@ -43,12 +43,10 @@ void Patcher::CleanPatchFiles() {
RemoveExistingPatchFiles("game/csgo/bin/win64/server.dll");
}

bool Patcher::ReplaceBytes(const char* filename, const char* searchPattern, const char* replaceBytes) {
size_t replaceLength = strlen(replaceBytes);

bool Patcher::ReplaceBytes(const char* filename, const char* searchPattern, const char* replaceBytes, size_t replaceLength) {
FILE* file = fopen(filename, "rb+");
if (!file) {
printf("failed to open: %s\n", filename);
printf("failed to open file: %s\n", filename);
return false;
}

Expand All @@ -58,7 +56,7 @@ bool Patcher::ReplaceBytes(const char* filename, const char* searchPattern, cons

unsigned char* buffer = (unsigned char*)malloc(fileSize);
if (!buffer) {
printf("failed to allocate memory.\n");
printf("failed to found memory.\n");
fclose(file);
return false;
}
Expand All @@ -78,7 +76,7 @@ bool Patcher::ReplaceBytes(const char* filename, const char* searchPattern, cons
}

if (position > endPosition) {
printf("patcher out of date, report this to nebel: %s | %i\n", filename, (int)replaceLength);
printf("patch out of date: %s | %i\n", filename, (int)replaceLength);
return false;
}

Expand Down
5 changes: 3 additions & 2 deletions CS2Downloader/CS2Patch.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#pragma once

#define _CRT_SECURE_NO_WARNINGS

namespace Patcher {
bool ReplaceBytes(const char* filename, const char* searchPattern, const char* replaceBytes);
bool ReplaceBytes(const char* filename, const char* searchPattern, const char* replaceBytes, size_t replaceLength);
bool PatchClient();
bool PatchServer();
void CleanPatchFiles();
}
}
2 changes: 1 addition & 1 deletion CS2Downloader/global.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
#include <iostream>

namespace Globals {
inline std::string currentVersion = "1.1";
inline std::string currentVersion = "1.3";
inline bool usesNoManifests = false;
}

0 comments on commit 74b8336

Please sign in to comment.