Code Monkey home page Code Monkey logo

igi-internals's Introduction

Project I.G.I Internal

Project I.G.I Internal is Project to access internal methods of the game by using DLL injection method into the game and calling IGI Natives methods to modify/alter the behaviour of the game.
This was originally intended for research project to understand the game mechanics and how developers worked hard to create them.
So don't use this project to misuse the game's identity and source of original game devs.

Pre-Requisite

  • General section.
  • DLL File - This project is DLL file rather than standard application.
  • DLL Injection - This project needs DLL injection into IGI game.
  • Hooking - This project uses Minhook for API calls.
  • GTLibc -C/C++ library for interactig with Game.
  • Pattern Scanning - This project use pattern memory scanning to check Game/Player is loaded properly.
  • Game specific section.
  • IGI Graphs Structure - Project IGI 1 Graph structure data.
  • IGI 3D Models - Project IGI uses 3D models in form of MEF (Mesh External File).
  • IGI Camera View - IGI use game Camera called Viewport to display the game updates.
  • Native section.
  • Native Invoker - Native invoker is a technology to invoke native methods from Game using their Hash with its Handler.

Building DLL project.

Open this project in your favourite IDE (Visual Studio) and build it and your output will be Release/Debug folder depends which configuration you choosed and you will find file IGI-Internals-Release.dll so download your favourite DLL injector make sure its x86(32-bit) compatible otherwise injection wouldn't work or you can use recommended IGI-Injector to inject DLL.

Building project for IGI Editor.

The project could be build for IGI Editor the only thing we need to change is Features.cpp file we have to update with Features file for Editor which could be found here Features_Editor.cpp

Modifying this project.

You can modify the project the only file you need to focus on is Features file which could be found here Features.cpp in DllMainLoop() method go to MENU_SCREEN_INGAME section add you logic for Adding/Removing Buildings/Weapons/A.I etc into the game.

There are shown 5 examples into Features.cpp file.

  • Enable Debug mode.
  • Restart game.
  • Weapon pickup.
  • Frames setting
  • Humanplayer load.

Adding new hashes for Natives.

Lets say you found new hash for Native now how to add them into project and use them. So you have to follow the steps.

  1. First Add your Hash to Natives.hpp class like this
  MY_FIRST_NATIVE = 0x00402F90
  1. Go to Natives folder and open NativeHelper.hpp file and in any relevant section add its definition.
  NATIVE_DECL void MY_FIRST_NATIVE_LOAD() { NATIVE_INVOKE<Void>((Void)HASH::MY_FIRST_NATIVE); }
  1. Now go to Features.cpp class and use it.
  // Native method.
  if (GT_HotKeysPressed(VK_CONTROL, VK_F1)) {
	MY_FIRST_NATIVE_LOAD();
  }

This section requires to be updated.

IGI-Internals Docs

Game Section

Restarting Level.

QTASK::UPDATE();
g_AutoMsgBox->Show("", 70);
LEVEL::LOAD();
g_AutoMsgBox->Show("", 70);

Starting new Level.

LEVEL::SET(level);
QTASK::HASH_INIT(1);
QTASK::UPDATE();
auto StartLevelCaller = (int(__cdecl*)(int))0x00416900;
StartLevelCaller(*(PINT)0x00567C8C);
QTASK::RESET();

Resource Section.

Loading predefined resource.

string resource = "LANGUAGE:objectives.res";
auto res_addr = RESOURCE::LOAD(resource);
LOG_INFO("Resource '%s' loaded at %p",resource,res_addr);

Loading custom resource.

string resource = "LOCAL:my_resource.extension"; //Place your resource in game Local/root directory.
auto res_addr = RESOURCE::LOAD(resource);
LOG_INFO("Resource '%s' loaded at %p",resource,res_addr);

Unloading a resource.

string resource = "MISSION:sounds/sounds.qvm";
RESOURCE::UNLOAD(resource);

Unloading resources.

std::vector<string> res_list{"STATUSSCREEN:status.res","LANGUAGE:messages.res","LOCAL:menusystem/missionsprites.res"};
RESOURCE::UNLOAD(res_list);

Unpack a resource .

string resource = "LOCAL:menusystem/ingamemenu.qvm";
auto resource_addr = RESOURCE::UNPACK(resource.c_str());

Flush a resource.

string resource = "LOCAL:language/ENGLISH/menusystem.res";
auto resource_addr = RESOURCE::FIND(resource.c_str());
RESOURCE::FLUSH(resource_addr);

Finding resource address.

string resource = "LOCAL:missions/location0/level1/terrain/terrain.qvm";
auto resource_addr = RESOURCE::FIND(resource.c_str());
LOG_INFO("Resource '%s' loaded at address : %p",resource,resource_addr);

Checking resource loaded.

string resource = "MISSION:AI/2216.qvm";
bool is_loaded = RESOURCE::IS_LOADED(resource);
if(is_loaded) LOG_INFO("Resource is loaded"); 

Saving all resource information.

RESOURCE::ANIMATION_INFO_SAVE("IGI_Animations.txt");
RESOURCE::FONT_INFO_SAVE("IGI_Fonts.txt");
RESOURCE::SOUND_INFO_SAVE("IGI_Sound.txt");
RESOURCE::MATERIAL_INFO_SAVE("IGI_Material.txt");
RESOURCE::LIGHTMAP_INFO_SAVE("IGI_Lightmap.txt");
RESOURCE::OBJECT_INFO_SAVE("IGI_Object.txt");
RESOURCE::RESOURCE_INFO_SAVE("IGI_Resource.txt");
RESOURCE::TERRAIN_INFO_SAVE("IGI_Terrain.txt");
RESOURCE::TEXTURE_INFO_SAVE("IGI_Texture.txt");
RESOURCE::GRAPHICS_2D_INFO_SAVE("IGI_2D_Graphics.txt");
RESOURCE::GRAPHICS_3D_INFO_SAVE("IGI_3D_Graphics.txt");

Resource - MEF Models Section.

Finding MEF Model Name.

string model = "435"; //Watertower Id. or provide full id like '435_01_1'
string model_name = RESOURCE::MEF_FIND_MODEL_NAME(model);
LOG_INFO("Model name: '%s'",model_name.c_str());

Finding MEF Model Id.

string model = "Watertower";
string model_id = RESOURCE::MEF_FIND_MODEL_ID(model,false);
LOG_INFO("Model id: '%s'",model_id.c_str()); // Output: Model id: '435'

Finding MEF Model Full Id.

string model = "Watertower";
string model_id = RESOURCE::MEF_FIND_MODEL_ID(model);
LOG_INFO("Model id: '%s'",model_id.c_str()); // Output: Model id: '435_01_1'

Removing MEF Model by Id

string model = "435";
RESOURCE::MEF_REMOVE_MODEL(model);

Removing MEF Model by Full Id

string model = "435_01_1";
RESOURCE::MEF_REMOVE_MODEL(model);

Removing MEF Model by Name

string model = "Watertower";
RESOURCE::MEF_REMOVE_MODEL(model);

Removing MEF Models.

std::vector<string> models_list{"Watertower","Watchtower","Barracks"};
RESOURCE::MEF_REMOVE_MODELS(models_list);

Restoring MEF Models.

RESOURCE::MEF_RESTORE_MODELS();

Extracting MEF Models.

RESOURCE::MEF_EXTRACT();

Script Section. [QSC= 'Q' Script, QAS = 'Q' Assembler Script]

Parse script file. [QSC to QAS Conversion.]

string qsc_file = "LOCAL:config.qsc"; //Input file.
string qas_file = "LOCAL:config.qas"; //Output file.
int status = SCRIPT::PARSE(qsc_file, qas_file); //Status '0' success, 'Non-zero' error.

Assemble script file. [QAS to QVM Conversion.]

string qas_file = "LOCAL:config.qas"; //Input file.
string qvm_file = "LOCAL:config.qvm"; //Output file.
int status = SCRIPT::ASSEMBLE(qas_file, qvm_file); //Status '0' success, 'Non-zero' error.

Compile script file.[QSC to QVM Conversion.]

string qsc_file = "LOCAL:objects.qsc";//Place 'objects.qsc' file game root/local directory.
SCRIPT::COMPILE(qsc_file); //Output: "objects.qvm".

Cleanup script file.

string q_file = "LOCAL:objects.qas";
SCRIPT::CLEANUP(q_file);

Script Section. - [QVM = 'Q' Virtual Machine].

Loading qvm file.

string qvm_file = "MISSION:sounds/sounds.qvm";
auto qvm_addr = QVM::LOAD(qvm_file);

Reading qvm file.

string qvm_file = "LOCAL:humanplayer/humanplayer.qvm";
int status = QVM::READ(qvm_file); //Status '0' success, 'Non-zero' error.

Cleanup qvm file.

string qvm_file = "LOCAL:common/sounds/sounds.qvm";
auto qvm_addr = QVM::LOAD(qvm_file);
int status = QVM::READ((int)qvm_addr); //Overloaded method 'QVM::READ(int)'
if(status == 0) QVM::CLEANUP(qvm_addr);

Camera section.

Enabling Free camera with controls

Camera::Controls controls;

controls.UP(VK_SPACE); //Key event - Camera Up. (Z-Axis)
controls.DOWN(VK_MENU); //Key event - Camera Down. (Z-Axis)
controls.LEFT(VK_LEFT); //Key event - Camera Left. (Y-Axis)
controls.RIGHT(VK_RIGHT); //Key event - Camera Right. (Y-Axis)
controls.FORWARD(VK_UP); //Key event - Camera Forward. (X-Axis)
controls.BACKWARD(VK_DOWN); //Key event - Camera Backward. (X-Axis)
controls.CALIBRATE(VK_BACK); //Key event - Camera Calibrate. [Reset to X-Axis]
controls.QUIT(VK_RETURN); //Key event - Quit Free cam.
controls.AXIS_OFF(0.5f); //Offset value to move Camera from Axis.

CAMERA::FREECAM(controls);

Memory and Player Operations

Memory and Player Operations

The following code snippets demonstrate various memory and player operations in C++:

Memory Allocation

address_t memory_address = MEMORY::ALLOC(1, 1024);

Memory Deallocation

MEMORY::DEALLOC();

Player Name Setting

PLAYER::INDEX_NAME_SET(0, "Player1");

string player_name = "Player2"; PLAYER::INDEX_NAME_SET(1, player_name);

Player Mission Setting

PLAYER::INDEX_MISSION_SET(0, 2);

Active Player Name Setting

PLAYER::ACTIVE_NAME_SET("ActivePlayer");

string active_player_name = "ActivePlayer2";
PLAYER::ACTIVE_NAME_SET(active_player_name);

Active Player Name and Mission Retrieval

Get the name of the active player.

string active_player_name = PLAYER::ACTIVE_NAME_GET();

Get the mission of the active player.

int active_player_mission = PLAYER::ACTIVE_MISSION_GET();

Active Player Mission Setting

PLAYER::ACTIVE_MISSION_SET(3);

Player Profile Status Check

char* is_profile_active = PLAYER::IS_PROFILE_ACTIVE();

Configuration Operations

Read Default Configuration File

CONFIG::READ();

Read Specified Configuration File

CONFIG::READ("config.cfg");

Write Default Game Configuration File

CONFIG::WRITE();

Write Specified Configuration File

CONFIG::WRITE("weaponconfig.cfg");

Read Default Weapon Configuration File

CONFIG::WEAPON_CONFIG_READ();

Read Specified Weapon Configuration File

CONFIG::WEAPON_CONFIG_READ("my_weapon_config.cfg");

Original Author : HeavenHM@2022.

igi-internals's People

Contributors

haseeb-heaven avatar jones-hm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.