Modding 101
Knowledge Helps
The more you understand about the modding process, the more likely you are to fix your own issues. Hopefully it will also help identify terrible advice from Youtube videos, for example telling you to replace dinput8.dll with other files. It's also important, particularly when things go wrong, to use a mods folder for modding - leave the original game files intact.
ScriptHook5 and Dinput8
So, ever wonder why we need files like ScriptHook5 or what it does? Here are the basics you need to know to become an expert troubleshooter.
GTA 5, and DirectX games in general, looks for certain Windows files when at launch. One of which for GTA 5 is a Microsoft file called dinput8.dll. This file is installed automatically with the Windows OS and is a component of DirectX. It is found in the Windows System 32 folder.
However as it starts, GTA5 looks for dinput8.dll in its root folder first (the folder where GTA5 is installed). Once installed in the root folder, thanks to a programmer named Alexander Blade, GTA5 will find a different version of dinput8.dll (not the one in System 32) and it will load that file.
So in reality, it is dinput8.dll (also called the asi loader) that rules the mod process. It is a modified version of the Microsoft Windows dll of the same name and it works with functions in another Alexander Blade creation called ScripthookV.dll - it is this ScriptHook which allows a hook into the GTA5 RAGE game engine and as a result makes the magic of modding possible.
The mod version of dinput8.dll works with the Windows version of dinput8.dll (peek at the file called asiloader.log) and also loads programs called asi plugins. These plugins include OpenIV.asi, ScriptHookVDotNet.asi, Menyoo.asi, TrainerV.asi, HeapAdjuster.asi, PackfileLimitAdjuster.asi, and NoBoundaryLimits.asi - just to name some of the most important and common ones.
In Blade's words, "Script Hook V is the library that allows us to use GTA V script native functions in custom .asi plugins. Note that it doesn't work in GTA Online, script hook closes GTA V when the player goes in multiplayer. In order to load asi plugins you need to have asi loader installed, you can download it separately or use the latest version that comes with this distrib (dinput8.dll). You must delete previous asi loader version (dsound.dll) if you have one installed."
Your trainer requires dinput8.dll to be loaded and Script Hook V for functionality. ScriptHookVDotNet (SHVDN) is also loaded by dinput8.dll and requires Script Hook V. The SHVDN will allow you to run your own scripts or mod scripts written in dot net versions of languages such as C# and VB. It is not required to run your trainer or other asi file - those need dinput8.dll to load and Script Hook V for functionality.
OpenIV
Now what about OpenIV? Think of it as two separate programs, working together. The OpenIV you mod with allows you to install and edit files. The OpenIV.asi which is loaded by dinput8.dll will load your addons such as vehicles and maps and MLOs and even some peds - in fact anything called dlc.rpf. OpenIV gives you the option to install dinput8.dll (which it calls the asiloader), but you likely have already installed it with Script Hook V first.
Another very powerful tool that can be used for editing GTA 5 files is Code Walker and its RPF Explorer. It allows edits and changes but it can't load addons (dlc.rpf).
Without getting into further detail, mod files such as heap limit adjusters, packfile limit adjusters, and the gameconfig.xml modded version are there to extend the limits of the game - they allow modders to increase the assets (peds, cars, MLOs, etc) beyond what the game can handle by default. Without them the game could crash due to memory issues. Of course there is no guarantee that your PC hardware can handle additional dlc - a common reason for why the game crashes.
Read more about these other essential files here: