Skip to content

Commit

Permalink
add 'Damnation' support
Browse files Browse the repository at this point in the history
  • Loading branch information
anzz1 authored Oct 7, 2023
1 parent 7398809 commit 24bb6a2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Please note that the GameSpy protocol is old and does not meet modern password e
| Colin McRae Rally 2005 | <picture><img src="./.github/img/disc.png" title="Retail" alt="(Retail)" /></picture>&nbsp;<a href="https://www.gog.com/en/game/colin_mcrae_rally_2005"><img src="./.github/img/gog.png" title="GOG" alt="(GOG)" /></a> | `dinput8.dll` | n/a | |
| Crysis | <picture><img src="./.github/img/disc.png" title="Retail" alt="(Retail)" /></picture>&nbsp;<a href="https://www.gog.com/en/game/crysis"><img src="./.github/img/gog.png" title="GOG" alt="(GOG)" /></a>&nbsp;<a href="https://store.steampowered.com/app/17300/Crysis/"><img src="./.github/img/steam.png" title="Steam" alt="(Steam)" /></a> | `version.dll` | `version.dll` | <sub><sup>[1]</sup> Replacing game executables with [c1-launcher](https://github.com/ccomrade/c1-launcher/releases/latest) is highly recommended for additional fixes</sub> |
| Crysis Wars | <picture><img src="./.github/img/disc.png" title="Retail" alt="(Retail)" /></picture>&nbsp;<a href="https://www.gog.com/en/game/crysiswarhead"><img src="./.github/img/gog.png" title="GOG" alt="(GOG)" /></a>&nbsp;<a href="https://store.steampowered.com/app/17330/Crysis_Warhead/"><img src="./.github/img/steam.png" title="Steam" alt="(Steam)" /></a> | `version.dll` | `version.dll` | <sub><sup>[1]</sup> Replacing game executables with [c1-launcher](https://github.com/ccomrade/c1-launcher/releases/latest) is highly recommended for additional fixes</sub> |
| Damnation | <picture><img src="./.github/img/disc.png" title="Retail" alt="(Retail)" /></picture>&nbsp;<a href="https://store.steampowered.com/app/12790/Damnation/"><img src="./.github/img/steam.png" title="Steam" alt="(Steam)" /></a> | `dinput8.dll` | n/a | <sub><sup>[1]</sup> Requires [No-CD patch](https://taco.cab/files/games/damnation/Damnation.v1.0.NoCD.zip) to remove SecuROM (V7) protection &nbsp;<sup>**RETAIL**</sup></sub> |
| Deer Hunter 2004 | <picture><img src="./.github/img/disc.png" title="Retail" alt="(Retail)" /></picture> | `dinput8.dll` | n/a | |
| Deer Hunter 2005 | <picture><img src="./.github/img/disc.png" title="Retail" alt="(Retail)" /></picture> | `dinput8.dll` | n/a | |
| F1 Challenge '99-'02 | <picture><img src="./.github/img/disc.png" title="Retail" alt="(Retail)" /></picture> | `dinput8.dll` | n/a | <sub><sup>[1]</sup> Requires [No-CD patch](https://taco.cab/files/games/f1comp/F1.Challenge.99-02.v1.0.NoCD.zip) to remove SafeDisc (V2) protection</sub> |
Expand Down
3 changes: 3 additions & 0 deletions dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "include/game_stbc.h"
#include "include/game_bfme2.h"
#include "include/game_blood2.h"
#include "include/game_dmntn.h"
#endif // !_WIN64

#include "include/picoupnp.h"
Expand Down Expand Up @@ -265,6 +266,8 @@ int __stdcall DllMain(HINSTANCE hInstDLL, DWORD dwReason, LPVOID lpReserved) {
patch_stbc();
} else if (!__stricmp(p, "blood2.exe") || !__stricmp(p, "blood2sv.exe") || !__stricmp(p, "b2nmsrv.exe")) { // Blood II - The Chosen
patch_blood2();
} else if (!__stricmp(p, "damngame.exe")) { // Damnation
patch_dmntn();
} else if (!__stricmp(p, "game.dat") && p2 && !__strcmp(p2, "RTS.exe")) { // Battle for Middle-earth II
patch_bfme2();
} else if (!__stricmp(p, "serioussam.exe") || !__stricmp(p, "sam2.exe") || !__stricmp(p, "dedicatedserver.exe")) { // Serious Sam 1 & 2
Expand Down
22 changes: 22 additions & 0 deletions include/game_dmntn.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// game_dmntn.h

#ifndef __GAME_DMNTN_H
#define __GAME_DMNTN_H

#include "include/global.h"

// Disable HTTPS
__forceinline static void dmntn_disable_https() {
BYTE* ptr = 0;
BYTE search[] = {0xC7,0x41,0x28,0x01,0x00,0x00,0x00,0x8B,0x55,0xFC};
ptr = find_pattern_mem(0, search, search + 9, TRUE);
if (ptr)
write_mem(ptr+3, "\0", 1);
}

__noinline static void patch_dmntn() {
dmntn_disable_https();
gs_replace_pubkey(0);
}

#endif // __GAME_DMNTN_H
2 changes: 1 addition & 1 deletion include/game_ut3.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ __forceinline static void ut3_patch_strings_v21() {
//__forceinline static void ut3_disable_https() {
// BYTE* ptr = 0;
// BYTE search[] = {0xC7,0x41,0x28,0x01,0x00,0x00,0x00,0x8B,0x55,0xFC};
// ptr = find_pattern_mem(search, search + 9);
// ptr = find_pattern_mem(0, search, search + 9, TRUE);
// if (ptr)
// write_mem(ptr+3, "\0", 1);
//}
Expand Down

0 comments on commit 24bb6a2

Please sign in to comment.