Skip to content

Commit

Permalink
merged with GUI version
Browse files Browse the repository at this point in the history
  • Loading branch information
0xvpr committed Aug 20, 2021
1 parent 05d28ab commit a281979
Show file tree
Hide file tree
Showing 23 changed files with 604 additions and 561 deletions.
21 changes: 8 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
cmake_minimum_required(VERSION 3.6)

project("Splinter Cell 3 Hacks")
project("SCCT GUI")

set(EXEC "sp3")
set(CMAKE_C_STANDARD 99)
set(EXEC "scctgui")
set(CMAKE_C_STANDARD 17)

## Sources
file(GLOB SOURCES src/*.c)

## Includes
include_directories(include)
include_directories("C:\\Program Files (x86)\\Microsoft DirectX SDK (June 2010)\\Include")

## Library
link_directories("C:\\Program Files (x86)\\Microsoft DirectX SDK (June 2010)\\Lib/x86")

## Output DLL
add_library(${EXEC} SHARED ${SOURCES})

## Output DIR
#set_target_properties(${EXEC}
# PROPERTIES
# CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin
# CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin
# CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin
#)

## Library Files
target_link_libraries(${EXEC} Winmm)
target_link_libraries(${EXEC} d3d9 d3dx9)
40 changes: 0 additions & 40 deletions Makefile

This file was deleted.

104 changes: 31 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,58 +1,51 @@
# Splinter Cell Chaos Theory Trainer
### Timeline
- Project started: 03/12/2021
- First release: 03/14/2021
- Final Revision: 05/14/2021
- Project started: 08/18/2021
- Switch from C to CPP: 08/18/2021
- Project completed: 08/19/2021
- Switch from CPP to C: 08/20/2021

## Overview & Demonstration
The main purpose of this project was to get familiar with the C language while also
familiarizing myself with cross platform compilation from Linux (wsl Ubuntu 20.04 LTS)
to Windows*.
familiarizing myself with the Directx9c API.

<img src="./resources/sp3_godmode.gif" width="680" height="400"/>
Godmode Enabled - The player can not receive damage of any kind (invincible) while
enemies convert any and all damage taken to maximum damage. (insta-kill)
<img src="./resources/demo.gif"/>
Demonstration of God Mode, Disable Alarms, and Disable Enemies.
Activated cheats are highlighted in the top left in green.

## Table of Contents
- [What I Learned](#what-i-learned)
- [How it works](#how-it-works)
- [How It Works](#how-it-works)
- [Build Instructions](#build-instructions)
- [Windows](#windows)
- [Linux (Debian)](#linux-debian)
- [Known issues](#known-issues)
- [Known Issues](#known-issues)
- [Goals](#Goals)

## What I Learned
<b>Visual C++ lets you get away with a lot of programming fuckery.</b>
Splinter Cell Chaos Theory has a unique Directx API structure. Text can
not be drawn, and most sprites, tools, and images can only be half drawn
and are very poorly rendered when they are drawn.

Switching to converting the old Visual C/C++ code to C99 was a pain because of the amount of
errors that Visual Studio handled silently on its own. It was an enlightening experience.
There are more things that can be done but I've concluded that it's not
worth the effort.

While cross compiling from Linux to Windows using <code>i686-win64-mingw32-gcc</code> isn't as well
documented as VisualC++ is, it is certainly doable (with serious effort). It took a bit of
research just to get the compiler to compile all of the various non-standard 'MS-isms' that
are included in <code>Windows.h</code> and <code>tlhelp32.h</code>.
## How It Works
Use any DLL injector that you are comfortable with to inject the file into
the <code>splintercell3.exe</code> process.

I originally planned to hook DirectX for an internally hooked GUI, but getting mingw's ld
to recognize <code>detours.h</code> was more work that it was really worth so it was abandoned.
It seems that C++ is much better suited for these types of tasks anyway.

## How it works
Use any DLL injector that you are comfortable with to inject the file into the <code>splintercell3.exe</code> process.
If you don't have a DLL injector, you can use mine <a href="https://github.com/malikrbooker/Vipers-DLL-Injector-2/releases/latest">here</a>.

A resize-able console will pop up letting you know what hacks are available as well as their respective status.
<img src="resources/dll_console_example.png"/>
Once the DLL is injected, you will have access to the following Hacks:
- Numpad 1: God Mode
- Numpad 2: Ghost Mode
- Numpad 3: Super Weapons
- Numpad 4: Disable Alarms
- Numpad 5: Disable Enemies
- Numpad 6: Unlock All Doors

## Build Instructions
### Windows
- Powershell
1. install MinGW
2. add MinGW/bin to path
- WSL
1. install cmake for windows
```
$ make.exe
$ ./install_script.sh
```
- CMake
1. install cmake for windows
- Visual Studio 2019
Expand All @@ -65,43 +58,8 @@ A resize-able console will pop up letting you know what hacks are available as w
$ cmake --build "build" --config "Release"
```
- WSL
```
$ sudo apt install mingw-w64
$ make
```
- Python
```
python3 build.py
```
### Linux (Debian)
- MinGW
```
$ sudo apt install mingw-w64
$ make
```
## Known issues
~~I could not find a reliable 'in game' boolean value or other explicit distinction that would
prevent the user from attempting to execute the code in places that would crash the game.~~ <i>circumvented</i>
These locations include:
- ~~Special cases such as trying to teleport without first equipping weapon~~ <i>(patched May 05, 2021)</i>
- ~~Special cases such as trying to toggle no recoil without first equipping weapon~~ <i>(patched May 05, 2021)</i>
The entity list is also extremely illusive. Sometimes functions that include the EntityList Object end
up returning NULL due to its random nature. The hacks that rely on the EntityList Object tend to work
less reliably as multiple levels are completed.
## Known Issues
If the user presses F3 while the menu is minimized, it will reset position.
## Goals
- [x] Find reliable weapon pointer <i>(patched March 12, 2021)</i>
- [x] ~~Find 'Death' __thiscall~~ <i>(removed - unnecessary)</i>
- [x] Find a way to prevent PolterGheist from breaking the game <i>(patched May 5, 2021)</i>
- [ ] Find reliable entity_list pointer
- [ ] ~~Find reliable player_health pointer~~ <i>(removed - unnecessary)</i>
- [ ] ~~Find reliable 'in game' boolean (or other explicit distinction)~~ <i>(removed - unnecessary)</i>
#### References
*Windows - <i>10 Pro Insider Preview Build 21318.rs_prerelease.210216-1530)</i>
- [ ] ~~Find out how to draw text~~
56 changes: 0 additions & 56 deletions build.py

This file was deleted.

17 changes: 17 additions & 0 deletions include/d3d9hook.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef _D3D9HOOK_H
#define _D3D9HOOK_H

#include <windows.h>
#include <stdbool.h>
#include <d3d9.h>
#include <d3dx9.h>

typedef HRESULT(APIENTRY* tEndScene)(LPDIRECT3DDEVICE9 pDevice);

bool GetD3D9Device(void** pTable, size_t Size);

BOOL CALLBACK EnumWindowsCallback(HWND handle, LPARAM lParam);

HWND GetProcessWindow();

#endif /* _D3D9HOOK_H */
12 changes: 12 additions & 0 deletions include/drawing.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef _DRAWING_H
#define _DRAWING_H

#include "d3d9hook.h"

void draw_DrawBorderBox(int x, int y, int w, int h, int thickness, D3DCOLOR Colour, IDirect3DDevice9* d3dDevice);

void draw_DrawFilledRect(int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9* d3dDevice);

void draw_DrawText(LPCSTR TextToDraw, int x, int y, D3DCOLOR Colour, LPD3DXFONT m_font);

#endif /* _DRAWING_H */
3 changes: 1 addition & 2 deletions include/entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@ typedef struct Weapon
float bloom_y; // + 0x0524
} Weapon;


#endif
#endif
Loading

0 comments on commit a281979

Please sign in to comment.