Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Tuners
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    2. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    3. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    1. Grand Theft Auto Series

      1. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    6. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

      1. GTANet 20th Anniversary
    2. Support

    3. Suggestions

[REL/OpenSrc] GTA ASI Injector


The_GTA
 Share

Recommended Posts

wqkasZJ.png


Hello GTA modders!

here is a small tool for embedding GTA ASI files directly into your GTA .EXE file. By doing so you do not require any ASI loader anymore; the ASI code is "installed" directly into the EXE!

GTAGarage: http://www.gtagarage.com/mods/show.php?id=28541
GTAinside: http://www.gtainside.com/sanandreas/tools/103942-gta-asi-injector

I call it pefrmdllembed. It works by placing the PE image sections of the DLL file into the EXE file + linking in imports.

In the .zip are example EXE files, example DLL files, two sample ASIs from plugin-sdk by DK22Pac and the tool itself.

Command-line usage:​ pefrmdllembed.exe *gta.exe* *plugin.asi* *output_gta.exe*

The tool generates a new EXE file with the ASI injected into. Note that not all ASI files will work with this.

Source code: http://pefrm-units.osdn.jp/pefrmdllembed.html

SA_CreateCar.asi: Press tab to spawn an Infernus.
VC_PedPainting.asi: Tommy will be painted red.

Changelog:
- 09.04.2017 14:00: fixed a bug for ASIs with static TLS initialization callbacks
- 09.04.2017 15:01: cleaned-up the codebase a bit; removed unnecessary import directory
- 10.04.2017 16:05: fixed "floating point support not loaded" error in certain ASIs
- 10.04.2017 20:49: added basic C++ exception handling to error out less violenty
- 10.04.2017 21:23: more clean-up; added good error message for file-creation error
- 11.04.2017 19:42: fixed embedding of ASI resources; now SilentPatchSA/SkyGFX work for 1.0 US
- 15.04.2017 13:32: support for embedding multiple ASI at once
- 16.04.2017 13:48: now ASI exports go into EXE aswell
- 02.08.2017 23:31: added "-impinj" commandline option for PE import redirection
- 14.08.2017 21:15: added "-noexp" commandline option for PE export ignoring; binary size optimizations Edited by The_GTA
Link to comment
Share on other sites

That's nice screenshot you have there. As a member of ant colony I'm glad you thought of us.

Link to comment
Share on other sites

Second! :pp

 

I've a couple of questions which may be stupid, will it affect the compatibility of mods such as FLA, considering that FLA only supports HOODLUM exe but if we inject an ASI mod directly into the exe, will the mod become incompatible?

 

If a mod has an ini file, do we have to make any changes to the ini file like renaming it to something else?

 

To be honest, this is a fantastic idea.

Edited by The_Human
Link to comment
Share on other sites

That's nice screenshot you have there. As a member of ant colony I'm glad you thought of us.

Glad you like it.

 

 

Second! :pp

 

I've a couple of questions which may be stupid, will it affect the compatibility of mods such as FLA, considering that FLA only supports HOODLUM exe but if we inject an ASI mod directly into the exe, will the mod become incompatible?

 

If a mod has an ini file, do we have to make any changes to the ini file like renaming it to something else?

 

To be honest, this is a fantastic idea.

I just generated my very own fastman92_sa.exe

 

ibCZcBx.png

 

Here is what happens:

 

FbAgL1S.png

 

Maybe we need a special version of limit adjuster.

 

Similarly modloader puts out error. I think it is because these ASIs check EXE size.

Edited by The_GTA
  • Like 1
Link to comment
Share on other sites

What about GTA V support?

Should work. I assume you know about the quirks. GetModuleHandle to get the memory base address of GTA V executable, etc.

 

Important: avoid __declspec( thread ) like a plague, it screws up the embedding (pretty sure also the C++11 thead_local thing?)

 

I am speaking about: 64bit exe GTA V is no problem. No experience in anti-cheat for new R* games.

Edited by The_GTA
  • Like 1
Link to comment
Share on other sites

Now we can LITERALLY SilentPatch EXEs.

 

tenor.gif

Link to comment
Share on other sites

Some of these posts are the funniest thing ever... :lol:

 

This sounds interesting!! Like Ash said, now we can have them SilentPatched EXEs :catspider:

Edited by BlackScout
Link to comment
Share on other sites

If a mod has an ini file, do we have to make any changes to the ini file like renaming it to something else?

i second this question.

You only answered FLA question.

 

Link to comment
Share on other sites

 

If a mod has an ini file, do we have to make any changes to the ini file like renaming it to something else?

i second this question.

You only answered FLA question.

 

No change to .ini layout required. Put it like in regular ASI. Unless you depend on behavior of ASI loader (maybe it uses scripts/ folder). Is this ok? :)

 

 

Would this make possible to inject outfit asi into the exe and using silent patch at the same time with both working?

outfit.asi embedded into gta_sa.exe 1.0 US (ignore text, it is wrong):

 

zR9nQ4wm.png

 

SilentPatchSA.asi embedded into gta-sa.exe (Steam):

 

Iar04Jfm.png

 

If outfit.asi would support steam, it could work because you can chain embedding up to ten times? Depends on NT loader behavior.

SilentPatchSA.asi seems to depend on special ASI loader, so it crashes in my 1.0 US executable.

 

Btw, update to the tool; fixed a bug that prevented outfit.asi from working.

 

EDIT: currently fixing bug that prevents SilentPatch from working!

Edited by The_GTA
  • Like 2
Link to comment
Share on other sites

SilentPatchSA.asi seems to depend on special ASI loader, so it crashes in my 1.0 US executable.

w-what

  • Like 2
Link to comment
Share on other sites

w-what

No idea, Silent. But this is what MSVC says (with debug symbols, pe_debug):

 

hdzgF7Om.png

 

Would be great if this issue would not exist because it happens in SkyGFX aswell. :)

Or am I just doing something wrong? forgetting something? this is just done pretty quickly tbh.

 

Null-ptr crash inside d3d9.dll.

Edited by The_GTA
Link to comment
Share on other sites

I've done something similar for Android SO libraries.

 

Plugin Loader Installer

 

modifies the game library e.g libGTASA.so and make it possible to combine together with libFastman92pluginLoader.so

Edited by fastman92
Link to comment
Share on other sites

Vertex shader is created from a data resource in the ASI, maybe that's where the problem is?

 

 

bool ShaderAttach(){	// CGame::InitialiseRenderWare	if ( InitialiseRenderWare() )	{		HMODULE thisModule;		GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCWSTR)ShaderAttach, &thisModule);		HRSRC		resource = FindResourceW(thisModule, MAKEINTRESOURCE(IDR_NVCSHADER), RT_RCDATA);		RwUInt32*	shader = static_cast(LockResource( LoadResource(thisModule, resource) ));		RwD3D9CreateVertexShader(shader, reinterpret_cast(&pNVCShader));		bXMSupported = XMVerifyCPUSupport() != FALSE;		return true;	}	return false;}
NOTE: Currently released Build 28 does not call LockResource but I changed it recently to conform to MSDN specs more. If you wanna know if this was the issue, try this test version which loads the shader this (correct) way:

http://gtaforums.com/topic/669045-silentpatch/?p=1069507640

  • Like 2
Link to comment
Share on other sites

This seems really interesting, but i don't have a clue on how to use it, having a readme for people without scripting knowledge, would be good, or maybe i'm just dumb and can't really understand the instructions on the first post

Link to comment
Share on other sites

Vertex shader is created from a data resource in the ASI, maybe that's where the problem is?

 

NOTE: Currently released Build 28 does not call LockResource but I changed it recently to conform to MSDN specs more. If you wanna know if this was the issue, try this test version which loads the shader this (correct) way:

http://gtaforums.com/topic/669045-silentpatch/?p=1069507640

Thank you very much, Silent! Support for SilentPatchSA.asi for all GTA:SA versions has been added :)

I can even embed both SilentPatch and SkyGFX into one EXE now, topkek.

 

iR6yFiwm.png

 

gcBdUgTm.png

 

 

This seems really interesting, but i don't have a clue on how to use it, having a readme for people without scripting knowledge, would be good, or maybe i'm just dumb and can't really understand the instructions on the first post

Please try opening cmd.exe and run "pefrmdllembed.exe". It gives you instructions in console window. If you do it correctly it will generate a new EXE, if not it wont do anything. :)

 

Maybe we need ASI installer? GUI window with input.exe and input.asi paths?

 

If anything does not work please post screenshot of pefrmdllembed.exe console log. We can help you figure it out.

Edited by The_GTA
  • Like 3
Link to comment
Share on other sites

After testing it seems that it doesn't work very well with cleo.asi

 

Untitled.jpg

Untitled2.jpg

gta1.jpg

 

 

Oh and also, is there is any limit for the asi files i can embed to the executable?

P.S : this is one of the most useful tools I've ever seen by far, really great job.

Edited by DubHaMlg777
Link to comment
Share on other sites

just embedded SilentPatchSA , Ragdoll_physics ..... working fine :lol: thanks for this amazing tool.

skygfx isn't really working , after i embed it and start the game after 5 seconds of gameplay it crashes. and not working with cleo.asi xD

but the positive thing is that it works with most asi plugins :p
one question : does this tool optimize gta sa somehow by making the asi code load directly from gta_sa.exe as if it were built-in the game itself?

Edited by crspo2020
  • Like 1
Link to comment
Share on other sites

After testing it seems that it doesn't work very well with cleo.asi

 

Untitled.jpg

Untitled2.jpg

gta1.jpg

 

 

Oh and also, is there is any limit for the asi files i can embed to the executable?

P.S : this is one of the most useful tools I've ever seen by far, really great job.

Thank you, I appreciate your nice statement :)

 

About 10 .asi is the limit. I just tested it. Beyond that Windows NT will refuse to run EXE.

If you mean limit inside ASI, no known limit. ASI can be as complex as you want ;)

 

About CLEO.ASI limit: yes, unfortunately plugins to CLEO need "CLEO.ASI" file. But not many ASI plugins are this complicated, no? It is unfortunate.

 

 

just embedded SilentPatchSA , Ragdoll_physics ..... working fine :lol: thanks for this amazing tool.

skygfx isn't really working , after i embed it and start the game after 5 seconds of gameplay it crashes. and not working with cleo.asi xD

but the positive thing is that it works with most asi plugins :p

one question : does this tool optimize gta sa somehow by making the asi code load directly from gta_sa.exe as if it were built-in the game itself?

I am happy that you appreciate this tool :)

There was a random crash when I embedded both SkyGFX and SilentPatchSA because my framerate was too high. (I embedded skygfx.asi first, then SilentPatchSA.asi, order sometimes is important).

 

Optimization? This tool guarrantees that .ASI code is executed before any GTA code.

1) because the .asi is part of gta_sa.exe, the OS does not have to load the .asi separately, resulting in faster load time

 

======================

 

I made a video that demonstrates embedding MTA core into gta_sa.exe. Who knew that it works just like an .ASI? :)

 

 

Edited by The_GTA
  • Like 3
Link to comment
Share on other sites

Also open limit adjuster checks exe size which is essential for project 2dfx.

:( so we actually have to ask Link2012 (ModLoader and OLA author) and other modders who made indispensable plugins to make their asi plugins compatible...... maybe it's not hard after all. ;)

Edited by Crspy
  • Like 1
Link to comment
Share on other sites

This is great!!!

:)

 

 

 

so we actually have to ask ThirteenAG(OLA author) and Link2012 (ModLoader author) to make their asi plugins compatible...... maybe it's not hard after all. ;)

Those programmers are very talented so not hard, yes. Idea: check what PE sections exist and perform check-sum check per-section, check if all sections match a GTA exe version. Ignore additional sections (added by pefrmdllembed + other tools).

 

Done by MTA (anti-cheat) and CLEO.asi

Edited by The_GTA
  • Like 2
Link to comment
Share on other sites

Can I inject multiple .asi and .dll files at once?

Yes, tool updated. Put multiple ASI paths at once.

 

pefrmdllembed.exe gta_sa.exe skygfx.asi SilentPatchSA.asi sky_silent_sa.exe

 

Download: https://osdn.net/projects/pefrm-units/downloads/67523/gta_asi_injector.zip/

 

btw dont buy seagate HDD, mine failed today

Edited by The_GTA
  • Like 2
Link to comment
Share on other sites

 

Can I inject multiple .asi and .dll files at once?

Yes, tool updated. Put multiple ASI paths at once.

 

pefrmdllembed.exe gta_sa.exe skygfx.asi SilentPatchSA.asi sky_silent_sa.exe

 

Download: https://osdn.net/projects/pefrm-units/downloads/67523/gta_asi_injector.zip/

 

btw dont buy seagate HDD, mine failed today

 

Nice work man :) ...... check this, my way of injecting asi files

https://youtu.be/pSdZtqCII0w

Link to comment
Share on other sites

Nice work man :) ...... check this, my way of injecting asi files

 

 

Wow, nice trick, Crspy! Was not aware that you could just drag&drop, too. Seems much easier. But do not drag&drop more than two ASI because the last would be overwritten (output exe path). ;)

 

And thank you for putting the tool in your signature. I appreciate it a lot!

Edited by The_GTA
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.