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 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.

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: ???

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.

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.

📦 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.

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
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 не будет опубликован. Обязательные поля помечены *

Adblock
detector