Skip to content

Commit 47cdb9d

Browse files
committed
FixC2CRankings: fix anti-piracy that broke C2C ranking scoreboard
1 parent 6e0330d commit 47cdb9d

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

src/hooks_misc.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,41 @@
55
#include "plugin.hpp"
66
#include "game_addrs.hpp"
77

8+
class FixC2CRankings : public Hook
9+
{
10+
// A lot of the C2C ranking code has a strange check that tries to OpenEventA an existing named event based on current process ID
11+
// However no code is included in the game to actually create this event first, so the OpenEventA call fails, and game skips the ranking code body
12+
//
13+
// The only hit for that 0x19EA3FD3 magic number on google is a semi-decompiled Razor1911 crack, which contains code that creates this event
14+
//
15+
// Guess it's probably something that gets created by the SecuROM stub code, and then game devs can add some kind of "if(SECUROM_CHECK) { do stuff }" which inserts the OpenEventA stuff
16+
// For the Steam release it seems they repacked the original pre-securom-wrapper 2006 game EXE without any changes, guess they forgot these checks were included?
17+
public:
18+
std::string_view description() override
19+
{
20+
return "FixC2CRankings";
21+
}
22+
23+
bool validate() override
24+
{
25+
return true;
26+
}
27+
28+
bool apply() override
29+
{
30+
char Buffer[52];
31+
32+
DWORD CurrentProcessId = GetProcessId(GetCurrentProcess());
33+
sprintf(Buffer, "v7_%04d", CurrentProcessId ^ 0x19EA3FD3);
34+
CreateEventA(0, 1, 1, Buffer);
35+
36+
return true;
37+
}
38+
39+
static FixC2CRankings instance;
40+
};
41+
FixC2CRankings FixC2CRankings::instance;
42+
843
class AutoDetectResolution : public Hook
944
{
1045
public:

src/resource.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#define MODULE_VERSION_MAJOR 0
1717
#define MODULE_VERSION_MINOR 2
18-
#define MODULE_VERSION_BUILD 1
18+
#define MODULE_VERSION_BUILD 2
1919
#define MODULE_VERSION_REVISION 0
2020

2121
#define STR(value) #value

0 commit comments

Comments
 (0)