Modloader для gta san andreas

Installation

ONI-Modloader
0. Prerequisites:

  • Make SURE you’re using the latest version from Github main branch.
  • Make sure you deleted all previous modloader file in:
    • Windows: \OxygenNotIncluded\OxygenNotIncluded_Data\Managed\
    • Mac: /OxygenNotIncluded/OxygenNotIncluded.app/Contents/Resources/Data/Managed/
  1. Click «Clone or Download» and «Download ZIP» for the current version as the releases may not be up to date.
  2. Copy the contents of the «Managed» folder to the folder:
    • Windows: \OxygenNotIncluded\OxygenNotIncluded_Data\Managed\
    • Mac: /OxygenNotIncluded/OxygenNotIncluded.app/Contents/Resources/Data/Managed/
  3. Create «Mods» folder in the ONI main directory.
    • Windows: \OxygenNotIncluded\Mods\
    • Mac: /OxygenNotIncluded/OxygenNotIncluded.app/Contents/Resources/Mods/
  4. Check for error logs in:

How to debug mods

SIMPLE (recommended)
The easier way to debug a mod is to use the Unity debug logs:

  • Include in your VS project references the library from ONI managed folder: UnityEngine.CoreModule
  • Insert in your code log dump lines like:
    Debug.Log(«…»);

ADVANCED

  • Check in output_log.txt the Unity version used by ONI. Look for it in the first lines: Example: Initialize engine version: 2018.2.7f1
  • Download from here the corresponding «mono.dll» file. This is mono modified to enable debugging.
  • Replace mono.dll in ONI folder: \OxygenNotIncluded\Mono\EmbedRuntime\
  • Visual Studio
    1. Install Unity for Visual Studio
    2. Configure your VS project to output Debugging Info. You must generate .pdb file with complete info.
    3. Compile your project
    4. Execute «lib\pdb2mdb.exe name.dll». This will generate in the same folder a .mdb file. «pdb2mdb.exe» for VS can be found here
    5. Exe, pdb and mdb files must be in Mods ONI folder.
    6. Run Oxygen Not Included.
    7. In VS, select option «Attach to Unity Debugger» and enter the IP: 127.0.0.1:55555
    8. Now your VS must be connected to the Game and stop in your breakpoints.
  • dnSpy
    1. Follow this guide

📦 How to Compile

On Windows, a recent version of the Microsoft Visual C++ compiler suite is required. Both a recent version of the compiler as well as a recent version of the Windows Kit (8.1 or 10) is required. The reason for this is that the SymExtract module which extract the required address offsets depends on the dbghelp library that ships with said Windows Kit versions. There are more dependencies which are nested as git submodules into this repository, so make sure to download them as well when cloning this repository.

git clone --recurse-submodules https://github.com/gomint/modloader.git
or
git pull --recurse-submodules

Lastly, the .pdb file that ships with the desired Bedrock Dedicated Server executable is required. When invoking CMake to build the ModLoader DLL, make sure to specify a CMake variable that specifies the full path to the .pdb file.

Example:

cmake -DMODLOADER_BEDROCK_PDB=<Path to PDB> --build ~/build --target ModLoader

One more note: when compiling for Win64 make sure to explicitly specify the amd64 architecture to MSVC. If you don’t the Preloader binary will not be able to inject the ModLoader DLL into the Bedrock Dedicated Server executable.

How to make a mod

Visual Studio:

  1. Download the modloader installer and extract the PCBSModloader.dll and if needed the 0Harmony.dll to somewhere you can access
  2. Create a new project with the project type being Class Library (.NET Framework)
  3. In the project properties set the target framework to Unity 3.5 .net full Base Class Libraries if you have it available, this aims to reduce incompatibilities since the DLL is going to be loaded into the game context and the game is built with Unity. It might still work with another target framework, but it is not recommended. You might get warnings about references in the project not matching with the target framework, and you should remove those references.
  4. Reference the PCBSModloader.dll and if needed the 0Harmony.dll from your project (Right click on References -> Add Reference… -> Browse…)
  5. Create a class extending Mod from the modloader, the minimum for such a class should look like this:
    using PCBSModloader;
using PCBSModloader;

namespace TestMod
{
    public class Class1 : Mod
    {
        public override string ID { get { return "MyTestMod"; } }

        public override string Version { get { return "0.1"; } }

        public override string Author { get { return "Me"; } }
    }
}
  1. If you have those three properties implemented build the project
  2. Install the modloader for PC Building Simulator if you haven’t done it yet
  3. Create a folder Mods\TestMod (or whatever name you want) in the <PCBS folder> and put your compiled DLL there.
  4. Run PC Building Simulator, it should say «Modloader initialized» in the upper left corner

To check if your mod has been successfully loaded go to the Mods folder and look for a file called log.txt, it should look something like this:

And that’s it, if your mod name shows up in the log it was successfully loaded. Now you can either implement more of the methods that the Mod base class has available or you can create Harmony patches in your project that will get automatically loaded as the mod gets loaded. You may of course need to reference more assemblies from the game to access those classes and functions, most certainly you will want to reference the Assembly-CSharp-firstpass.dll which contains most of the game’s code, and then you may need to reference Unity DLLs as needed as you use the various Unity functions.

To check the structure of the Assembly-CSharp-firstpass.dll and the various Unity DLLs referenced by it I’d recommend you to use dnSpy if you haven’t already.

Creating a Mod

  1. Feel free to mess with any of the mods from https://github.com/javisar/ONI-Modloader-Mods
  2. ‘Clone or download’ the project from the mod repo.
  3. Copy the following files from ONI Managed folder ‘\OxygenNotIncluded\OxygenNotIncluded_Data\Managed’ to the mod solution folder ‘\Source\lib’
    • UnityEngine.dll
    • UnityEngine.CoreModule.dll
    • Any needed unity UnityEngine.*.dll
    • Any needed ONI Assembly-CSharp-*.dll
  4. Open the solution with Visual Studio.
  5. Create a new class project.
    • To create a Project from scratch the right one is: Visual C#-Class Library (.NET Framework).
    • If you don’t find it like when you have installed Visual Studio with Unity you need to tools-add tools or features and install: .NET Desktop Development.
    • It’s available a Visual Studio Project Template

      Copy the .zip file to ~\Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C# to access the template in VS

  6. Add the previous libs as references of the project.
  7. Compile it to generate the mod dll file.
  8. Test your mod. Move you mod folder to:
    a. ONI-Modloader
    * Windows: %PROGRAMFILES(X86)%\Steam\steamapps\common\OxygenNotIncluded\Mods
    * Mac: /OxygenNotIncluded/OxygenNotIncluded.app/Contents/Resources/Mods/
    b. ONI Builtin Modloader (Steam)
    * Windows: %USERPROFILE%\Documents\Klei\OxygenNotIncluded\mods\local
    * Mac: ???
  9. Check the tutorials at the end of the page.
  10. If you want to go into the ONI code you need to peek with a decompiler like JetBrains dotPeek or ILSpy.

Note: Dlls will be recognized by the mod loader if they reside in the main mod directory and subfolders.

Frequently asked questions

We have put together a couple of questions that are asked all the time. If you have any further questions, please feel free to ask
us on our Discord server.

What’s the difference between the launcher and the mod loader?

The launcher is a handy piece of software that installs
the Raft Mod Loader for you. Using the launcher, your
mod loader installation is automatically kept up to date.The mod loader on the other hand modifies parts of the
code of Raft so that you can easily play with mods.

Something isn’t working! Who can help me?

If you encounter any bugs or run into problems while
installing or using our software, please feel free to
contact us on our Discord server.

Quick Start

ONI-Modloader

  1. Download the Latest Version
  2. Copy ModLoader.dll to ONI Managed folder:
    • Windows: \OxygenNotIncluded\OxygenNotIncluded_Data\Managed\
    • Mac: /OxygenNotIncluded/OxygenNotIncluded.app/Contents/Resources/Data/Managed/
  3. Move your mods to the Mods folder:
    • Windows: \OxygenNotIncluded\Mods\
    • Mac: /OxygenNotIncluded/OxygenNotIncluded.app/Contents/Resources/Mods/

ONI builtin Modloader (Steam)

  1. If you want to use instead the ONI builtin modloader (used for Steam), you have to remove ‘ModLoader.dll’ from ‘Managed’ folder. If ONI detects a modloader, it bypasses Steam mods.
  2. Move your mods to the Mods folder. Be sure that you put each mod in its own folder:
    • Windows: %USERPROFILE%\Documents\Klei\OxygenNotIncluded\mods\dev\
    • Mac: ???

❇ How it Works

Existing ModLoaders use the LD_PRELOAD option available on UNIX-like systems to inject a DLL into the memory space of the Bedrock Dedicated Server executable before it begins to run any code of its own. Since this option is unavailable on Windows, we instead provide an executable which launches the Bedrock Dedicated Server executable as a new process but suspends it on creation, i.e. before any actual code is executed. It then creates a thread in that newly created process which loads the ModLoader DLL while the rest of the process is still frozen. Only once the DLL loading thread has finished will the process actually resume. This ensures that the ModLoader DLL is injected into the executable’s memory space before it runs any code of its own.

The ModLoader itself contains a mapping of reverse-engineered function pointers to several interesting functions from the Bedrock Dedicated Server executable. These function pointers are retrieved by extracting address offsets from .PDB files shipping with the Bedrock Dedicated Server fully automatically (using a target named SymExtract). Using these functions and a runtime function hooking library allows the ModLoader to integrate with the Bedrock Dedicated Server executable and expose an interface to mods.

There are several limitations to this approach, the most stringent one being that any specific ModLoader DLL version is only compatible with exactly one specific Bedrock Dedicated Server executable. Whenever that executable changes the ModLoader DLL needs to be rebuilt since the address offsets to the required functions might have changed. Furthermore, since ModLoader is accessing internal functions in the Bedrock Dedicated Server their signatures could change at any time, requiring modifications in how ModLoader invokes them.

Installing mods

After you’ve downloaded a mod, you’ll need to take the TXD and DFF and place them in the correct folder. These files must have the name of the GTA harcoded name. They cannot be capitalised at all — it must be completely lowercase. If modloader isn’t loading your mod, make sure it’s in the format of like — not — it’s the number one rule!

Vehicles

Vehicles usually come with a handling file, a TXD (texture) file and a DFF (model) file. ModLoader removes the requirement to understand how to code and lets you easily set up your first vehicle modification. Setting up the handling file needs a little understanding of creating files with custom extensions but setting up the textures and models — the things that make up a visual modification — is super easy.

  1. Copy the texture and model files into the vehicles folder.
  2. If your modification contains a handling configuration and you’d like to add it to your server, read the next section.

Handling configurations

Installing handling configurations take a little bit of playing around, but it’s easy once you get the hang of it. My lamborghini modification for my infernus came with a README file containing the handling line. I won’t go into detail with how they work, but I’ll just teach you how to import them into modloader.

Your README file might contain something like this.
At the moment, MTA (and by extension, modloader), doesn’t support the feature to import the other files mentioned here, but it doesn’t mean that your modification wont work (albeit not as the author intended). But don’t worry. Just copy the handling contents into your clipboard.

You need to copy this to the same vehicles folder. To do this you need to create a file with the same name as your vehicle. In Notepad, just copy it over, and save the file as . It is really important you set the file types as so that the extension is properly set.

Once you’re done with saving it… that’s it. You’ve got your vehicle and handling file imported into modloader!

Skins and weapons

Replacing skins and weapons work pretty much the same way. In the future we may add the ability to change weapon properties which modifications may give you but at the moment we only support textures (TXD) and models (DFF). It’s simple if you’ve read through everything else above, just move the file into the folder!

Installation

First of all, download modloader from here. Make sure to unzip the downloaded package into your resources directory of MTA. Now you must change the folder of the resource from to something like . You can change to whatever you want it to be, for example, for the ABCD server. We strongly recommend you to choose a unique name when doing this so that your users won’t have to download all your modifications again when they join a server with the same resource name.

After you’ve done that, you must give ModLoader access to the restartResource function. The easiest way to do this is by adding under the admin group in acl.xml. Just pop it underneath and you’ll be all set up.

ModLoader versions

The mod loader is managed by the launcher. This means that you don’t have to worry about being up-to-date with the mod loader.
However, this also means that it is impossible to install old
versions of the mod loader. This list is for documentation
purposes only and provides links to the changelogs.

RML version Raft version Release date Changelog
6.2.7 Update 13 2021-12-05 Link
2.2.4 Update 13 2021-06-21 Link
6.2.5 Update 12 2021-06-13 Link
6.2.4 Update 12 2021-04-08 Link
6.2.3 Update 12 2021-02-07 Link
6.2.2 Update 12 2021-02-04 Link
6.2.1 Update 12 2021-02-02 Link
6.2.0 Update 12 2021-02-02 Link
6.1.3 Update 12 2021-02-01 Link
6.1.2 Update 12 2021-01-31 Link
6.1.1 Update 12 2021-01-28 Link
6.1.0 Update 12 2020-11-02 Link
6.0.9 Update 12 2020-10-22 Link
6.0.8 Update 12 2020-10-14 Link
6.0.7 Update 12 2020-10-11 Link
6.0.6 Update 12 2020-10-09 Link
6.0.5 Update 12 2020-10-09 Link
6.0.4 Update 12 2020-10-08 Link
6.0.3 Update 11a 2020-08-12 Link
6.0.2 Update 11a 2020-08-12 Link
6.0.1 Update 11a 2020-08-09 Link
6.0.0 Update 11a 2020-08-06 Link
5.4.9 Update 11 2020-06-11 Link
5.4.8 Update 11 2020-05-22 Link
5.4.7 Update 11 2020-05-22 Link
5.4.6 Update 11 2020-04-25 Link
5.4.5 Update 11 2020-04-22 Link
5.4.4 Update 11 2020-03-12 Link
5.4.3 Update 11 2020-02-16 Link
5.4.2b Update 10.07 2020-01-13 Link
5.4.2a Update 10.07 2020-01-11 Link
5.4.2 Update 10.07 2020-01-11 Link
5.4.1 Update 10.07 2020-01-04 Link
5.4 Update 10.07 2020-01-04 Link
5.3 Update 10.07 2019-12-16 Link
5.2.9a Update 10.04 2019-12-05 Link
5.2.9 Update 10.00 2019-12-03 Link
5.2.8a Update 9.05 2019-12-01 Link
5.2.8 Update 9.05 2019-11-19 Link
5.2.7 Update 9.05 2019-11-11 Link
5.2.6 Update 9.05 2019-11-11 Link
5.2.5 Update 9.05 2019-11-10 Link
5.2.4 Update 9.05 2019-11-04 Link
5.2.3 Update 9.05 2019-11-04 Link
5.2.2 Update 9.05 2019-11-01 Link
5.2.1 Update 9.05 2019-10-31 Link
5.2.0 Update 9.05 2019-10-31 Link
5.1.3 Update 9.05 2019-10-04 Link
5.1.2 Update 9.05 2019-10-01 Link
5.1.1 Update 9.05 2019-09-22 Link
5.1 Update 9.05 2019-09-19 Link
5.0 Update 9.05 2019-09-18 Link
4.3.1 Update 9.05 2019-07-03 Link
4.3 Update 9.05 2019-06-20 Link
4.2.3 Update 9.05 2019-05-22 Link
4.2.1 Update 9.04 2019-05-04 Link
4.2 Update 9.04 2019-05-03 Link
4.1.9 Update 9.04 2019-04-26 Link
4.1.8f2 Update 9.04 2019-04-25 Link
4.1.8f Update 9.04 2019-04-24 Link
4.1.8 Update 9.04 2019-04-24 Link
4.1.7f Update 9.00 2019-04-01 Link
4.1.7 Update 9.00 2019-03-26 Link
4.1.6 Update 9.00 2019-03-17 Link
4.1.5 Update 9.00 2019-03-14 Link
4.1.4 Update 9.00 2019-03-14 Link
4.1.3 Update 9.00 2019-03-13 Link
4.1.2 Update 9.00 2019-03-08 Link
4.1.1 Update 9.00 2019-03-08 Link
4.1 Update 9.03 2019-03-07 Link
4.0-pre-10 Update 9.00 2019-02-10 Link
4.0-pre-9 Update 8.00 2019-02-02 Link
4.0-pre-8 Update 8.00 2018-11-08 Link
4.0-pre-7-u7 Update 7.00 2018-10-15 Link
4.0-pre-7 Update 6.00 2018-10-10 Link
4.0-pre-6 Update 6.00 2018-09-26 Link
4.0-pre-5 Update 6.00 2018-09-02 Link
4.0-pre-4 Update 6.00 2018-09-01 Link
4.0-pre-3 Update 6.00 2018-08-15 Link
4.0-pre-2 Update 6.00 2018-08-15 Link
4.0-pre-1 Update 5.00 2018-08-04 Link
4.0-pre Update 5.00 2018-08-03 Link
3.8 Update 5.00 2018-07-26 Link
3.7 Update 5.00 2018-07-26 Link
3.6.5 Update 5.00 2018-07-26 Link
3.6 Update 1.03 2018-07-25 Link
3.5 Update 1.03 2018-07-25 Link
Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *