Skip to content

Commit

Permalink
Merge pull request #18 from 0xvpr/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
0xvpr authored Feb 26, 2024
2 parents a787fd5 + a7d2e47 commit d6a0af1
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 118 deletions.
9 changes: 3 additions & 6 deletions inject.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

# Creator: VPR
# Created: December 14th, 2021
# Updated: December 24th, 2021
# Updated: February 26th, 2024

# This script is intended to work with Pidjeon for a seamless injection process.

TARGET="splintercell3.exe" # Change as necessary
PAYLOAD="lib/sp3.dll" # Change as necessary

function inject {
vpr-pidjeon-x86.exe "${TARGET}" "${PAYLOAD}" -i ManualMap
}

inject
! [[ $(which vpr-pidjeon) ]] && echo 'vpr-pidjeon' not found in path && exit 1
vpr-pidjeon "${TARGET}" "${PAYLOAD}" -i ManualMap
14 changes: 14 additions & 0 deletions src/hacks.asm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ global _hack_ghost_mode
global _hack_super_weapons
global _hack_disable_alarms
global _hack_unlock_all_doors
global _hack_no_clip
global _hack_test

; --------------------------------------------------------------------------- ;
; Definitions ;
Expand Down Expand Up @@ -534,3 +536,15 @@ alarms_disabled:
nop
nop
nop

_hack_no_clip:
ret
nop
nop
nop

_hack_test:
ret
nop
nop
nop
158 changes: 46 additions & 112 deletions src/hacks.c
Original file line number Diff line number Diff line change
@@ -1,112 +1,46 @@
#include "hacks.h"

#include "offsets.h"
#include "entity.h"
#include "mem.h"

extern uintptr_t g_module_base_addr;

unsigned int hack_disable_enemies(int bEnabled)
{
GameWorld* gameWorld = (GameWorld *)memory_find_dynamic_address(g_module_base_addr + offsets_game_world_base,
offsets_game_world_pointers,
(sizeof(offsets_game_world_pointers)/sizeof(offsets_game_world_pointers[0])));
if (!gameWorld)
{
return 0;
}

size_t size = gameWorld->n_entities;

unsigned int total_entities_changed = 0;
for (size_t i = 0; i < size; i++)
{
Entity* entity = gameWorld->entities[i];
if (!entity)
{
break;
}

if (TYPE(entity->lpVtable) == NPC)
{
if (bEnabled)
{
entity->health = 0;
++total_entities_changed;
}
else
{
entity->health = 150;
++total_entities_changed;
}
}
}

return total_entities_changed;
}

void hack_test(void)
{
GameWorld* gameWorld = (GameWorld *)memory_find_dynamic_address(g_module_base_addr + offsets_game_world_base,
offsets_game_world_pointers,
sizeof(offsets_game_world_pointers)/(sizeof(offsets_game_world_pointers[0])));

if (!gameWorld)
{
return;
}

size_t size = gameWorld->n_entities;

Entity* player = NULL;
for (size_t i = size-1; size > 0; --i)
{
Entity* current_entity = gameWorld->entities[i];
if (TYPE(current_entity->lpVtable) == PLAYER)
{
player = current_entity;
break;
}
}

if (player != NULL)
{
// Teleport them all to me
/*for (size_t i = 0; i < size; ++i)*/
/*{*/
/*Entity* current_entity = gameWorld->entities[i];*/
/*if (TYPE(current_entity->lpVtable) == NPC)*/
/*{*/
/*current_entity->x = player->x;*/
/*current_entity->y = player->y;*/
/*current_entity->z = player->z;*/
/*}*/
/*}*/

/*player->lpVtable->function_1(player);*/
/*player->lpVtable->function_2(player);*/
/*player->lpVtable->function_3(player);*/
/*player->lpVtable->func_10_1098DD40(player);*/
/*player->lpVtable->function_5(player);*/
/*player->lpVtable->function_6(player);*/
/*player->lpVtable->function_7(player);*/
/*player->lpVtable->function_8(player);*/
/*player->lpVtable->function_9(player);*/
/*player->lpVtable->function_10(player);*/
/*player->lpVtable->function_11(player);*/
/*player->lpVtable->function_12(player);*/
}

}

void hack_no_clip(int bEnabled)
{
if (bEnabled)
{
// Stop xyz movements

// X movement
// splintercell3.exe+19580D -> fstp dword ptr [edi]
// splintercell3.exe+19580D -> nop nop
}
}
#include "hacks.h"

#include "offsets.h"
#include "entity.h"
#include "mem.h"

extern uintptr_t g_module_base_addr;

unsigned int hack_disable_enemies(int bEnabled)
{
GameWorld* gameWorld = (GameWorld *)memory_find_dynamic_address(g_module_base_addr + offsets_game_world_base,
offsets_game_world_pointers,
(sizeof(offsets_game_world_pointers)/sizeof(offsets_game_world_pointers[0])));
if (!gameWorld)
{
return 0;
}

size_t size = gameWorld->n_entities;

unsigned int total_entities_changed = 0;
for (size_t i = 0; i < size; i++)
{
Entity* entity = gameWorld->entities[i];
if (!entity)
{
break;
}

if (TYPE(entity->lpVtable) == NPC)
{
if (bEnabled)
{
entity->health = 0;
++total_entities_changed;
}
else
{
entity->health = 150;
++total_entities_changed;
}
}
}

return total_entities_changed;
}

0 comments on commit d6a0af1

Please sign in to comment.