Skip to content

Commit 925ff3e

Browse files
committed
update docs
1 parent 7b2908d commit 925ff3e

File tree

5 files changed

+86
-36
lines changed

5 files changed

+86
-36
lines changed

Dependencies/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ Please use your own copies of FEZ's binaries. This directory should contain the
1010
- FNA.dll
1111
- MonoMod.exe
1212
- MonoMod.Utils.dll
13+
- MonoMod.RuntimeDetour.dll

Docs/additional.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Additional HAT behaviour
2+
3+
Apart from loading mods, HAT does some additional internal behaviour worth mentioning. Here's a full list:
4+
5+
- `FezLogo` class has been patched in order to draw HAT logo and mod loader tooltip.
6+
- Several methods in `Logger` class have been hooked to override location of debug log files (they're now stored in `%appdata%/FEZ/Debug Logs` directory) and to show an error with stack trace on fatal error.
7+
- `StaticText` class used to fetch localized text has been patched to return a raw string if it's prefixed by `@`. This is useful when you want to create your own menus where you have limited control over how text is displayed.
8+
- `Menu Base` class' `Initialize` method has a hook which adds an additional `MODS` menu, where you can preview a list of currently installed modifications.

Docs/createmods.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Create your own HAT modifications
2+
3+
## Basic mod architecture
4+
5+
Start by creating a mod's directory within `FEZ/Mods` directory. You can name it whatever you'd like, as the mod loader doesn't actually use it for mod identification, but it would be nice if it at least contained the actual mod's name to avoid confusion.
6+
7+
Mod loader expects `Metadata.xml` file in the mod's directory. Create one in a directory you've just made. Its content should look roughly like this:
8+
9+
```xml
10+
<Metadata>
11+
<Name>YourModName</Name>
12+
<Description>Short description of your mod.</Description>
13+
<Author>YourName</Author>
14+
<Version>1.0</Version>
15+
<LibraryName></LibraryName>
16+
<Dependencies>
17+
<DependencyInfo Name="HAT" MinimumVersion="1.0"/>
18+
</Dependencies>
19+
</Metadata>
20+
```
21+
22+
`Name` tag is required and is treated as an unique case-sensitive identifier of your mod - mod loader will load only one mod with the same name (it'll choose the one with the most recent version).
23+
24+
`Version` tag is also required. Mod loader compares two version strings by putting them in an alphanumberical order, however, each number is treated as a separate token, which order is determined by numberical value (this means `1.2beta` will be treated as older version to `1.11`).
25+
26+
`LibraryName` is used to determine a DLL library with C# assembly the mod loader will load. The library should end with `.dll` extension and should be placed in your mod's directory. This tag is optional, as your mod doesn't have to add any new logic.
27+
28+
`Dependencies` is a list of `DependencyInfo` tags. If your mod requires a specific version of HAT mod loader or relies on another mod, your can use these tags to prevent mod loader from loading this mod if given dependencies aren't present. It's entirely optional.
29+
30+
All other fields are purely informational.
31+
32+
## Creating asset mod
33+
34+
If you want to add new assets or override existing ones, create `Assets` directory within your mods directory. All valid files within it will be loaded as game assets with path relative to the `Assets` directory. Currently, the only supported format is `.xnb`, but in the future, a conversion from popular file formats will be implemented, allowing much easier modding process (for isntance, PNG files will be automatically converted to Texture2D assets). As of right now, there isn't really a good way of creating `.xnb` assets and you have to rely on [FEZRepacker](https://github.com/Krzyhau/FEZRepacker).
35+
36+
As an example, here's an instruction on how to change Gomez's house background plane. Keep in mind that right now this process is unnecessarily convoluted and will definitely be simplified with the next FEZRepacker update:
37+
38+
1. Use FEZRepacker to unpack game's `Other.pak` archive.
39+
2. Find `background planes/gomez_house_a.png` file and copy it.
40+
3. Create directory, name it something like `Export`. In it, create `background planes` directory and put a copy of PNG file there.
41+
4. Edit the image however you'd like.
42+
5. Use FEZRepacker to pack the `Export` directory into a PAK package.
43+
6. Use FEZRepacker to unpack previously packed PAK file into XNB files. You should have a modified `gomez_house_a.xnb` file.
44+
7. In your mod's `Assets` directory, create `background planes` directory and put your XNB file there.
45+
8. From now on Gomez's house should have your modified texture.
46+
47+
## Creating custom logic mod
48+
49+
Mod loader loads library file given in metadata as an assembly, then attempts to create instances of every public class inheriting from game's `IGameComponent` interface before initialization (before any services are created). After the game has been initialized (that is, as soon as all necessary services are initiated), it adds created instances into the list of game's components and initializes them, allowing their `Update` and `Draw` (use `DrawableGameComponent`) to be properly executed within the game's loop.
50+
51+
In order to create a HAT-compatible library, start by creating an empty C# library project. Then, add `FEZ.exe`, `FezEngine.dll` and all other needed game's dependencies as references - make sure to set "Copy Local" to "False" on all of those references, otherwise you will ship your mod with copies of those files.
52+
53+
Once you have your project done, create a public class inheriting from either `GameComponent` or `DrawableGameComponent` and add your logic there. Once that's done, build it and put it in the mod's directory.
54+
55+
For help, you can see an example of already functioning custom logic mod: [FEZUG](https://github.com/Krzyhau/FEZUG).
56+
57+
## Distributing your mod
58+
59+
Mod loader is capable of loading ZIP archives the same way directories are loaded. Simply pack all contents of your mod's directory into a ZIP file. In order for other people to use it, they simply need to put the archive in the `FEZ/Mods` directory and it should work right off the bat.

Docs/thumbnail.png

41 KB
Loading

README.md

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,40 @@
1-
# HAT
1+
# HAT - Simple mod loader for FEZ
22

3-
## Overview
3+
![Thumbnail](Docs/thumbnail.png)
44

5-
**HAT** is a [MonoMod](https://github.com/MonoMod/MonoMod)-based mod loader for FEZ, currently in development. When patched into the FEZ instance, it can be used to dynamically load game modifications on the game launch. The mods themselves can add/override assets or inject its own logic.
5+
## Overview
66

7-
## Building
7+
**HAT** is a [MonoMod](https://github.com/MonoMod/MonoMod)-based mod loader for FEZ, currently in development. Its main purpose is to make process of FEZ modding slightly easier for end user.
88

9-
1. Clone repository.
10-
2. Copy all dependencies listed in `Dependencies` directory and paste them into said directory.
11-
3. Build it. idk. it should work.
9+
When patched into the FEZ instance, it can be used to dynamically load game modifications on the game launch. Correctly prepared mods can add/override game assets or inject its own logic through custom-made plugin.
1210

1311
## Installing mod loader
1412

1513
1. Download [MonoMod](https://github.com/MonoMod/MonoMod/releases) (for .NET 4.5.2) and unpack it in the game's directory.
16-
2. Put FEZ.HAT.mm.dll in the game's directory.
14+
2. Download latest `FEZ.HAT.mm.dll` from Release tab and put it in the game's directory.
1715
3. Run command `MonoMod.exe FEZ.exe` (or drag `FEZ.exe` onto `MonoMod.exe`). This should generate new executable file called `MONOMODDED_FEZ.exe`.
1816
4. Run `MONOMODDED_FEZ.exe` and enjoy modding!
1917

2018
In the future, this process will be automated by a custom-made installer/mod manager (something like Olympus for Celeste's Everest).
2119

2220
## Adding mods
2321

24-
1. On first HAT launch, "Mods" directory should be created in the executable's directory. If not, create it.
25-
2. Put a mod in this directory
22+
1. On first HAT launch, `Mods` directory should be created in the executable's directory. If not, create it.
23+
2. Download the mod's archive and put it in this directory.
2624
3. Start the game.
2725

2826
It's that simple!
2927

30-
## Creating your own mod
31-
32-
1. Create a mod's directory. You can name it whatever, but it would be nice if it at least contained the actual mod's name to avoid confusion.
33-
34-
2. In your mod's directory, create `Metadata.xml` file. Its content should look roughly like this:
35-
36-
```xml
37-
<Metadata>
38-
<Name>YourModName</Name>
39-
<Description>Short description of your mod.</Description>
40-
<Author>YourName</Author>
41-
<Version>1.0</Version>
42-
<LibraryName></LibraryName>
43-
</Metadata>
44-
```
28+
## Building HAT
4529

46-
3. If you want to add new assets or override existing ones, create `Assets` directory within your mods directory. All valid files within it will be loaded as game assets with path relative to the `Assets` directory. Currently, the only supported format is `.xnb`. As of right now, there isn't really a good way of creating `.xnb` assets and you have to rely on [FEZRepacker](https://github.com/Krzyhau/FEZRepacker).
47-
48-
4. If you want to append a library with a custom logic, put it in your mod's directory and put its name with extension into the `LibraryName` property in mod's metadata. The library will be loaded only if its extension ends with `.dll`.
49-
50-
## Creating custom logic
51-
52-
Mod loader loads library file given in metadata as an assembly, then attempts to create instances of every public class inheriting from game's `IGameComponent` interface before initialization (before any services are created). After the game has been initialized, it adds created instances into the list of game's components and initializes them, allowing their `Update` and `Draw` (use `DrawableGameComponent`) to be properly executed within the game's loop.
53-
54-
In order to create a HAT-compatible library, start by creating an empty C# library project. Then, add `FEZ.exe`, `FezEngine.dll` and all other needed game's dependencies as references - make sure to set "Copy Local" to "False" on all of those references, otherwise you will ship your mod with copies of those files.
30+
1. Clone repository.
31+
2. Copy all dependencies listed in `Dependencies` directory and paste them into said directory.
32+
3. Build it. idk. it should work.
5533

56-
Once you have your project done, create a public class inheriting from either `GameComponent` or `DrawableGameComponent` and add your logic there. Once that's done, build it and put it in the mod's directory.
34+
## "Documentation"
35+
- [Create your own HAT modifications](/Docs/createmods.md)
36+
- [Additional HAT behaviour](/Docs/additional.md)
5737

58-
For help, you can see an example of already functioning mod: [FEZUG](https://github.com/Krzyhau/FEZUG).
38+
## Mods created for HAT
39+
- [FEZUG](https://github.com/Krzyhau/FEZUG) - a power tool for speedrun practicing and messing with the game (NOT PORTED YET)
40+
- [FezSonezSkin](https://github.com/Krzyhau/FezSonezSkin) - mod replacing Gomez skin with Sonic-like guy seen in Speedrun Mode thumbnail (NOT PORTED YET)

0 commit comments

Comments
 (0)