Custom Maid 3D2: ReiPatcher

From Hgames Wiki
Jump to: navigation, search
Icon msgbox notice.png This article is out of date and contains information that might be obsolete. You can find a newer guide for ReiPatcher here and for UnityInjector here..


KISS

all characters are at least 18


Custom Maid 3D2 [edit]


ReiPatcher is an awesome tool made by Hongfire user usagirei. ReiPatcher allows you to apply all kinds of modifications to a game that is made with Unity: you can change how game behaves; you can translate the game into another language; you can edit sounds, textures, models and other in-game assets while the game is running. All in all, the possibilities are limitless!

If somebody linked you to this page, it means you're one of hundreds of people who cannot really understand how to use this neat tool. On the other hand, if you stumbled upon the page yourself, you most likely are seeking for an easy-to-understand tutorial on how to set up and use ReiPatcher. Whichever it might be, you came to the right place. By reading this small tutorial you will become a professional ReiPatcher'er(er?) in no time!

What are we waiting for? Let the patching begin!

Grabbing the tools and getting it organized

Before we can start patching, we need ReiPatcher downloaded!

Head to ReiPatcher and grab the tool! Of course, remember to thank Rei-sama for his hard work by giving him some reputation here (which is one of the many reasons you should join the greate Hongfire community!).

After you have the archive downloaded, extract it to some folder. If you are asked to enter a password, it is most likely byreisen (if it's not, check the maid thread).

After you have extracted everything, you'll find at least the following files:

Filename Purpose and some other information
ExIni.dll Used by ReiPatcher and the majority of user-created plug-ins. Responsible for creating, editing and saving configuration files.
ExIni.pdb and ExIni.xml Mainly used by developers to debug and have a documentation of the ExIni library. If you are not a developer, you don't really need these.
Mono.Cecil.dll and other DLLs starting with Mono.Cecil The most important tool of ReiPatcher that is responsible for patching the game.
ReiPatcher.exe The executable you are going to run every time you want (or need) to patch a game.
ReiPatcher.pdb and ReiPatcher.xml Just as for ExIni.pdb and .xml, they are mainly intended for the developers. You don't really need them unless you are a developer. It is, however, advised that you to keep ReiPatcher.pdb, as it will make it easier to read possible errors.

Now move these files to some directory of your preference. The main point is that all the files stay together. The best place is perhaps the same directory where your games are located. Simply create a folder called ReiPatcher there and put the extracted files in it.

There you go! Now let us test whether ReiPatcher works! Simply hold Shift and rihgt-click on the empty space in ReiPatcher folder. From the context menu that has just appeared select Open command window here. A command prompt should now open. The cursor (_) should be next to the ReiPatcher's directory. Write ReiPatcher.exe and hit Enter. If you copied (or moved) everything correctly, you'll get (almost similar) prompt:

ReiPatcher 0.9.0.8
.NET Assembly Patcher - Powered by Mono.Cecil
Copyright © Usagirei 2015
GIT master [aac43ce754149cbde635f4ef6d5b164aa796fba1]
==============================================================                                 
Switch Usage:
-fc <Config>            Force creation of new configuration file
-c <Config>             Use or create of configuration file 
-w              Waits for user input after patching
-r              Reloads latest Assembly backup 

Exit Codes:
 0                      Success
 1                      NoPatchesApplied
-3                      InternalException
-2                      FileNotFound
-1                      DirectoryNotFound

You are all set! Now onto creating a game configuration!

Creating game configuration

Before patches can be applied, we need to create a configuration file that tells ReiPatcher where the game files are and where to find the patches to apply.

If the game is officially supported by Hongfire community, you'll most likely find ready game configurations online. Most likely they are available on ReiPatcher's original thread.

If, however you are in need to create a new configuration from scratch, simply open the console window in ReiPatcher's directory (by holding Shift, right-clicking on the empty space in the folder and selecting Open command window here) and type the following in the opened console window:

ReiPatcher.exe -fc <NAME>

where <NAME> is the name of the configuration (you're pretty much free to choose what it shall be).

Whichever way you choose to obtain the configuration file, it should be put in the same folder as ReiPatcher.exe. That is not necessary, of course, but it will be A LOT easier to reference the files when patching through the command window.

Now that you have the configuration file, let us examine it. Grab your favourite text editor of your choice (which should obviously be Notepad++, right? RIGHT?!) and open the configuration file you downloaded or created. Within you should see a bunch of (probably weird) syntax. Here's a quick agenda for you to remind/teach how to read .INI files:

  • Lines starting with ; are called comments. They are ignored by ExIni (for the exception the ones starting with @. They are called environment variables and mostly used to load and store path information (which may change depending on the computer and game).
  • Lines of the form Variable=Value are variables that are used by ReiPatcher or other patchers. In ReiPatcher they are primarily used to store paths to different folders.
  • Lines of the form [Name] are called groups. They -- obviously -- group multiple variables together. All variables between two group names (or between a group name and the end of the file) belong to one group. The name of the grouped variables is defined in the upper group name declaration.

After this crash-course into ExIni, here are some of the most important variables used by ReiPatcher. You'll most likely want to edit those to your liking:

Variable name Description
PatchesDir Path to the patcher DLLs for this game configuration. Can be either absolute (ie. starting with drive letter) or relative (only folder name(s)). Depending on the game you'll want this to be <GAME NAME>_Patches. Therefore you'll need to put plug-ins' patch DLLs in the folder called <GAME NAME>_Patches that you must create in ReiPatcher folder.
AssembliesDir Path to game assemblies that are to be patched. If you downloaded the configuration from the Internet, you'll most likely want to leave this as is. In other cases it is most likely of the form <GAME DIRECTORY>\<GAME NAME>_Data\Managed (which, of course, might change depending on the game.
Executable Set this to the path to the game executable, if you want ReiPatcher to launch the game after patching is complete. Leave empty if you don't.
Arguments Additional arguments to use when launching the game.
Directory Root of the game (the one that contains the game's executable).

Any additional values might vary depending on the patches and tools you use, which is why we shall not go deeper into the topic.

After you have added your game configuration (and created the folder for patches as specified in the game configuration file), you can test/run it with ReiPatcher. Simply open the console window in ReiPatcher directory and type:

ReiPatcher.exe -c <NAME>.ini

where <NAME> is the name of your configuration file. If everything went well (and your folder containing the patches is empty), you should see the following output:

ReiPatcher 0.9.0.8
.NET Assembly Patcher - Powered by Mono.Cecil
Copyright © Usagirei 2015
GIT master [aac43ce754149cbde635f4ef6d5b164aa796fba1]
==============================================================================
Loading configuration file: 'CM3D2x64.ini'
============================== Loading Patchers ==============================
Loading Patchers
No Patches Found
================================= Pre-Patch ==================================
============================= Loading Assemblies =============================
================================== Patching ==================================
================================= Post-Patch =================================
================================== Finished ==================================

Since we had no patches in the folder that we specified in the configuration file, no patches were applied! Let us now proceed to actually downloading installing the patches and actually applying them!

Installing the patches

We're almost there! The only step left is to apply the patches!

Download the plug-ins of your choice and extract the downloaded archives.

Unfortunately, there are no strict rules on how to name either the folders in the archive or how to call the DLLs themselves. Therefore, always consult the README included with the plug-ins first! That being said, the most common way to divide the DLLs and other files in the plug-in is to divide them into three folders: Manged, ReiPatcher and UnityInjector. If that's the case, all you need to do is:

  • Copy the contents of Manged to <Game directory>\<GAME>_Data\Managed, where <Game directory> is the path to the game root (the directory where the game's extecutable is) and <GAME> is the game code with the possible addition of some other codes, like CPU architecture.
  • Copy the contents of ReiPatcher to the patches folder specified in the game's configuration file.
  • Copy the contents of UnityInjector to <Game directory>\UnityInjector if the folder does not exist yet, create it.

Other times the developer doesn't bother to separate the DLLs into differenet folders. In these cases they most likely specify the purpose of the DLL by their name. Again, there are not strict rules on this either, but it seems that most developers name their plug-ins in the following manner:

<GAME>.<Plugin name>.<Type>

In that case <GAME> is the game code, <Plugin name> is the name of the plug-in and <Type> is the type of the DLL. Here are the most common type names and where to place the DLLs with that type:

  • Hook (also sometimes blank or Core): put to <Game directory>\<GAME>_Data\Managed, where <Game directory> is the path to the game root (the directory where the game's extecutable is) and <GAME> is the game code with the possible addition of some other codes, like CPU architecture.
  • Patch (or Patcher): Put to the patches folder specified in the game's configuration file.
  • Plugin: Put to <Game directory>\UnityInjector if the folder does not exist yet, create it.

The moment of truth

When you have put everything into place, it is time to run ReiPatcher. Open command window in ReiPatcher folder and type:

ReiPatcher.exe -c <NAME>.ini

where <NAME> is the name of your configuration file. If everything went well, you'll see the green text that specifies that every patch has been applied successfully. Horaay! Now you can enjoy your game with the new plug-ins!

Overview

We briefly discussed how to install ReiPatcher, how to create own game configurations and how to install and apply patches. Much information has been omitted for the sake of simplicity, but this tutorial serves as a nice crash-course into the world of Unity Engine patching.

I hope that you, dear reader, have grasped the most essential knowledge of being a ReiPatcher'er(er?)(er??). Whenever you have issues with patching the game, always consult this tutorial or the original ReiPatcher thread (unless you will get linked back to this tutorial, that is -- in which case you have missed something very obvious).