Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      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. Grand Theft Auto Series

      1. Bugs*
      2. 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. GTA San Andreas

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

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

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. 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

    2. Support

    3. Suggestions

C# ASI files


Node
 Share

Recommended Posts

What exactly does/can an ASI file do?

 

I've seen multiple mods (Including CLEO) that use an ASI file and are put into the GTA SA directory.

 

What does an ASI file do that script cant?:S

 

Also can an ASI file be created in C# (Stupid question but I like to be certain)

Link to comment
Share on other sites

They are just renamed dynamically linked libraries (DLL). The sound engine used by Vice City and San Andreas would load extensions as .asi files. Basically, any .asi file it finds in game's root directory will be loaded at start up. This makes a call to DLL Main, which lets you access memory, add hooks, and so on.

 

In GTA IV era, this idea was brought back. While the game wouldn't load .asi files automatically, loaders have been written that do that. I will not get into details of how these work, but they effectively replicate the above behavior. The .asi extension has been kept both because people have been used to them and to distinguish mod libraries from libraries used by the game.

 

In principle, with ASI mods you can do absolutely anything in the game. You can change absolutely any behavior. However, it can be quite a bit of work depending on what you want to do. If you are writing an ASI script from scratch, you will have to know exactly which functions you want to hook into, write your own hooks, etc. That requires fairly detailed knowledge of the main process of the GTA game you are working with as well as good understanding of both machine language and whichever high-level language you happen to use.

 

Of course, for GTA IV, you have an option of using Script Hook library which covers most of this. It's not quite as flexible as writing your own hooks from scratch, but it's far easier to use. If you know some basic programming, you can write a basic mod with it.

 

 

And yes, you absolutely can write an ASI mod in C#. There is a ScriptHook.Net library, a modified version of the above, which can be used to write your GTA IV mod in C#. If you want to write an ASI file from scratch, then absolutely any language that can be used to compile a DLL file will do. That naturally includes C#.

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

Thankyou for that information K^2, It's just that I'm working on SAA2 (San Andreas Achievements 2).

 

I was wondering if I could use a .asi file to check if an achievement has been completed and update a text file with the results?

 

I know it sounds simple, but like you said, writing it from scratch takes knowledge and there aren't any tutorials on the internet on how to write asi files that manipulates GTA.

 

Link to comment
Share on other sites

Sounds doable, so long as you can find a good function call to hook into. Basically, you need to find a call that game itself makes that you would exploit to get your custom code called. From there, it's pretty straight forward. Check whatever variables you need to verify an achievement, and do file read/write as normal.

 

By the way, I said ASI would get loaded automatically in Vice and SA. That's wrong. Only Vice did that. San Andreas requires a loader. But it's pretty much the same from there on.

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

  • 4 weeks later...
San Andreas requires a loader. But it's pretty much the same from there on.

If SA required a .asi loader then how does CLEO load its .asi file?

 

Just curious.

Link to comment
Share on other sites

The cleo installer includes an ASI loader in San Andreas (VorbisFile.dll & vorbisHooked.dll). The other III-era games automatically load .asi files. You can find the source of an ASI loader here. The ASI loader uses the "LoadLibrary" function to load a dll.

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.